Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tree-grid component #1226

Merged
merged 93 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
ca01d5f
fix(theme): setup tree-grid component
Tibing Jan 11, 2019
433f6b7
feat(theme): setup treegrid
Tibing Jan 14, 2019
a8871c1
feat(tree-grid): implement basic data source
Tibing Jan 18, 2019
c7a7684
feat(tree-grid): basic filtering
Tibing Jan 18, 2019
156035b
feat(tree-grid): basic sorting
Tibing Jan 18, 2019
33abbc9
chore(tree-grid): todo for move search out of tree grid
Tibing Jan 18, 2019
acba9b3
refactor(tree-grid): move features in separate services
Tibing Jan 18, 2019
0f58c50
feat(tree-grid): move filter outside of tree grid
Tibing Jan 18, 2019
cbfbeb9
fix(tree-grid): filtering
Tibing Jan 18, 2019
3855f3a
refactor(tree-grid): move data management in separate service
Tibing Jan 18, 2019
48d747c
refactor(tree-grid): move tree grid model in separate file
Tibing Jan 18, 2019
58ce846
refactor(tree grid): camel case attribute selectors
yggg Jan 23, 2019
5b53f8f
refactor(tree grid): move ckd overrides to cdk dir
yggg Jan 28, 2019
85984c6
feat(tree grid): change tree content to presentation node
yggg Jan 30, 2019
bf88ff0
fix(treegrid): use mapped type
yggg Jan 30, 2019
7e82506
feat(treegrid): add base table to exports
yggg Jan 30, 2019
55f4755
fix(treegrid): add missing exports
yggg Jan 30, 2019
665ae07
refactor(treegrid): remove Base in class names
yggg Jan 30, 2019
61bdbf3
feat(treegrid): add data getter
yggg Jan 30, 2019
1fdbde0
refactor(treegrid): rename tree grid module
yggg Jan 30, 2019
946210d
refactor(treegrid): remove Base in class name
yggg Jan 30, 2019
7b6398c
feat(treegrid): add treegrid row export
yggg Jan 30, 2019
6ce0788
feat(treegrid): deep toggle row on double click
yggg Jan 30, 2019
459b742
feat(treegrid): add expanded property
yggg Feb 1, 2019
f4a0f62
feat(treegrid): add default row level
yggg Feb 4, 2019
89a92e9
feat(tree-grid-cell): add padding nested rows to cells
yggg Feb 4, 2019
7e124e5
feat(tree-grid): add styling
yggg Feb 5, 2019
f730e3b
docs(treegrid): use row toggle in showcase
yggg Feb 5, 2019
d2dab5f
refactor(sort header): provide icon via directive
yggg Feb 5, 2019
a51606c
test(tree-grid): add tree grid component tests
yggg Feb 6, 2019
a20627e
docs(tree-grid): put showcase on card
yggg Feb 6, 2019
7166214
feat(tree-grid): make filter and sort service extendable
yggg Feb 6, 2019
53f4070
refactor(tree-grid): rename spec file
yggg Feb 6, 2019
cdff95e
feat(tree-grid): add row and column defs mappings
yggg Feb 6, 2019
f1c6593
feat(tree-grid): remove element selectors
yggg Feb 8, 2019
2791d32
fix(tree-grid-row): set data row cell width
yggg Feb 8, 2019
2934ffe
fix(tree-grid): add missing styles
yggg Feb 8, 2019
9756013
feat(tree-grid): add row toggle component
yggg Feb 8, 2019
d222b23
refactor(tree-grid): add header row mapping
yggg Feb 8, 2019
ea5e851
fix(tree-grid): get sort header button color from theme
yggg Feb 8, 2019
d240fce
feat(nbSort): add sort output
yggg Feb 8, 2019
dc5d593
docs(tree grid): document components and add examples
yggg Feb 8, 2019
bf3c93c
feat(tree-grid): add missing tree grid mappings
yggg Feb 11, 2019
35a4288
docs(tree-grid): change group and page names
yggg Feb 11, 2019
aa3d606
refactor(tree-grid): pass data directly into nbTreeGrid
yggg Feb 11, 2019
67966fc
fix(tree-grid-footer-row): add styles
yggg Feb 11, 2019
cf40141
fix(tree-grid-footer-cell): use proper class to inject col def
yggg Feb 11, 2019
fc58fd9
fix(tree-grid): use row dom index as data index
yggg Feb 11, 2019
b820010
fix(tree-grid): provide tree grid cells as cdk cells
yggg Feb 11, 2019
2a9c30e
fix(tree-grid): listen to footer defs change
yggg Feb 11, 2019
13b7265
fix(tree-grid): check footer rows count
yggg Feb 11, 2019
d7253f4
feat(tree-grid): responsive columns
yggg Feb 11, 2019
5840602
docs(tree-grid): add examples min height
yggg Feb 11, 2019
86cfd24
fix(tree-grid-column): allow all falsy values in hideOn and showOn
yggg Feb 11, 2019
3f0a530
docs(tree-grid): add responsive example
yggg Feb 11, 2019
e506565
docs(tree-grid): add sort and filter services description
yggg Feb 11, 2019
68683e3
docs(tree-grid): simplify responsive example
yggg Feb 11, 2019
274a0ac
Merge branch 'master' into feat/tree-grid
yggg Feb 11, 2019
d841525
Merge branch 'master' into feat/tree-grid
yggg Feb 12, 2019
f721a1e
docs(tree-grid): change examples data to dirs tree
yggg Feb 12, 2019
cbaf15f
fix(tree-grid): style sort header button by class
yggg Feb 12, 2019
bf339f6
docs(tree-grid): show only one sort icon
yggg Feb 12, 2019
91435e8
docs(tree-grid): capitalize header text
yggg Feb 12, 2019
9bee502
feat(tree-grid): calc default level padding
yggg Feb 12, 2019
76eff43
feat(tree-grid): hide cells overflow
yggg Feb 12, 2019
93c73bf
feat(tree-grid): add equal columns option
yggg Feb 12, 2019
041baa8
docs(tree-grid): add responsiveness to showcase example
yggg Feb 12, 2019
0076fb4
refactor(tree-grid-row-toggle): change row to expanded input
yggg Feb 12, 2019
8b08b2a
docs(tree-grid): use different row toggle component
yggg Feb 12, 2019
a331079
fix(tree-grid): cell overflow
yggg Feb 12, 2019
1bdb16a
feat(tree grid sort header): add default sort icon
yggg Feb 12, 2019
8323d15
docs(tree grid): add custom icons example
yggg Feb 12, 2019
c75b8da
fix(tree-grid): use relative imports in theme dir
yggg Feb 12, 2019
47aabe3
fix(build): add cdk modules to rollup conf
yggg Feb 12, 2019
6753f16
test(tree grid): use tree grid directives in test component
yggg Feb 12, 2019
8bd2ef8
fix(tree grid): detect changes after updating visible columns
yggg Feb 13, 2019
b17498e
docs(tree grid): remove unused method
yggg Feb 13, 2019
16abfd1
fix(tree grid): add null check when setting data
yggg Feb 13, 2019
5f92889
docs(tree grid): show sort icon only on sorted column
yggg Feb 13, 2019
26fead8
feat(tree grid): add tree class
yggg Feb 13, 2019
9c4d134
test(tree grid): fix component selectors
yggg Feb 13, 2019
6e95dfb
refactor(tree grid): remove private modifier
yggg Feb 13, 2019
14336c7
style(tree-grid): remove unused code
yggg Feb 15, 2019
085a64c
docs(tree-grid): change example name
yggg Feb 15, 2019
a6f33f9
feat(tree-grid filter input): add debounce
yggg Feb 15, 2019
56ea5d9
feat(tree grid row): config dblclick delay and click to toggle
yggg Feb 15, 2019
44a24d8
docs(tree grid row toggle): add directive description
yggg Feb 15, 2019
c4a4c72
docs(tree grid): add example with disabled clickToToggle
yggg Feb 15, 2019
2ff5d2d
fix(tree grid): consistent color of sort/toggle icons
yggg Feb 15, 2019
4d2645e
fix(tree grid): add missing components exports
yggg Feb 15, 2019
48313f8
docs(tree grid): fix sort in custom icons example
yggg Feb 15, 2019
0fb00fd
Merge branch 'master' into feat/tree-grid
tibing-old-email Feb 15, 2019
5a83eee
Merge branch 'master' into feat/tree-grid
nnixaa Feb 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/assets/images/components/tree-grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions docs/structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,29 @@ export const structure = [
'NbCalendarKitModule',
],
},
{
type: 'group',
name: 'Data Table',
},
{
type: 'tabs',
name: 'Tree Grid',
icon: 'tree-grid.svg',
source: [
'NbTreeGridComponent',
'NbTreeGridNode',
'NbTreeGridPresentationNode',
'NbTreeGridSortService',
'NbTreeGridFilterService',
'NbTreeGridColumnDefDirective',
'NbTreeGridRowDefDirective',
'NbTreeGridRowComponent',
'NbSortDirective',
'NbSortHeaderComponent',
'NbFilterInputDirective',
'NbTreeGridRowToggleDirective',
],
},
],
},
{
Expand Down
2 changes: 2 additions & 0 deletions scripts/gulp/tasks/bundle/rollup-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const ROLLUP_GLOBALS = {
'@angular/cdk/portal': 'ng.cdk.portal',
'@angular/cdk/a11y': 'ng.cdk.a11y',
'@angular/cdk/scrolling': 'ng.cdk.scrolling',
'@angular/cdk/table': 'ng.cdk.table',
'@angular/cdk/bidi': 'ng.cdk.bidi',


// RxJS dependencies
Expand Down
47 changes: 47 additions & 0 deletions src/app/playground-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,53 @@ export const PLAYGROUND_COMPONENTS: ComponentLink[] = [
},
],
},
{
path: 'tree-grid',
children: [
{
path: 'tree-grid-showcase.component',
link: '/tree-grid/tree-grid-showcase.component',
component: 'TreeGridShowcaseComponent',
name: 'Tree Grid Showcase',
},
{
path: 'tree-grid-sortable.component',
link: '/tree-grid/tree-grid-sortable.component',
component: 'TreeGridSortableComponent',
name: 'Tree Grid Sortable',
},
{
path: 'tree-grid-filterable.component',
link: '/tree-grid/tree-grid-filterable.component',
component: 'TreeGridFilterableComponent',
name: 'Tree Grid Filterable',
},
{
path: 'tree-grid-basic.component',
link: '/tree-grid/tree-grid-basic.component',
component: 'TreeGridBasicComponent',
name: 'Tree Grid Basic',
},
{
path: 'tree-grid-responsive.component',
link: '/tree-grid/tree-grid-responsive.component',
component: 'TreeGridResponsiveComponent',
name: 'Tree Grid Responsive',
},
{
path: 'tree-grid-custom-icons.component',
link: '/tree-grid/tree-grid-custom-icons.component',
component: 'TreeGridCustomIconsComponent',
name: 'Tree Grid Custom Icons',
},
{
path: 'tree-grid-disable-click-toggle.component',
link: '/tree-grid/tree-grid-disable-click-toggle.component',
component: 'TreeGridDisableClickToggleComponent',
name: 'Tree Grid Disable Click Toggle',
},
],
},
{
path: 'bootstrap',
children: [
Expand Down
10 changes: 10 additions & 0 deletions src/framework/theme/components/cdk/bidi/bidi.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { BidiModule, Directionality } from '@angular/cdk/bidi';
import { NbDirectionality } from './bidi';

@NgModule({
providers: [
{ provide: NbDirectionality, useExisting: Directionality },
],
})
export class NbBidiModule extends BidiModule {}
5 changes: 5 additions & 0 deletions src/framework/theme/components/cdk/bidi/bidi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Injectable } from '@angular/core';
import { Directionality } from '@angular/cdk/bidi';

@Injectable()
export class NbDirectionality extends Directionality {}
2 changes: 2 additions & 0 deletions src/framework/theme/components/cdk/bidi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './bidi';
export * from './bidi.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { CollectionViewer, ListRange } from '@angular/cdk/collections';
import { Observable } from 'rxjs';

export interface NbCollectionViewer extends CollectionViewer {
viewChange: Observable<ListRange>;
}
1 change: 1 addition & 0 deletions src/framework/theme/components/cdk/collections/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './collection-viewer';
2 changes: 2 additions & 0 deletions src/framework/theme/components/cdk/platform/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './platform.module';
export * from './platform';
10 changes: 10 additions & 0 deletions src/framework/theme/components/cdk/platform/platform.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { Platform, PlatformModule } from '@angular/cdk/platform';
import { NbPlatform } from './platform';

@NgModule({
providers: [
{ provide: NbPlatform, useExisting: Platform },
],
})
export class NbPlatformModule extends PlatformModule {}
3 changes: 3 additions & 0 deletions src/framework/theme/components/cdk/platform/platform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Platform } from '@angular/cdk/platform';

export class NbPlatform extends Platform {}
121 changes: 121 additions & 0 deletions src/framework/theme/components/cdk/table/cell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license infornbion.
*/

import { Directive, ElementRef, InjectionToken, Input } from '@angular/core';
import {
CdkCell,
CdkCellDef,
CdkColumnDef,
CdkFooterCell,
CdkFooterCellDef,
CdkHeaderCell,
CdkHeaderCellDef,
} from '@angular/cdk/table';

/**
* Cell definition for the nb-table.
* Captures the template of a column's data row cell as well as cell-specific properties.
*/
@Directive({
selector: '[nbCellDef]',
providers: [{ provide: CdkCellDef, useExisting: NbCellDefDirective }],
})
export class NbCellDefDirective extends CdkCellDef {
}

/**
* Header cell definition for the nb-table.
* Captures the template of a column's header cell and as well as cell-specific properties.
*/
@Directive({
selector: '[nbHeaderCellDef]',
providers: [{ provide: CdkHeaderCellDef, useExisting: NbHeaderCellDefDirective }],
})
export class NbHeaderCellDefDirective extends CdkHeaderCellDef {
}

/**
* Footer cell definition for the nb-table.
* Captures the template of a column's footer cell and as well as cell-specific properties.
*/
@Directive({
selector: '[nbFooterCellDef]',
providers: [{ provide: CdkFooterCellDef, useExisting: NbFooterCellDefDirective }],
})
export class NbFooterCellDefDirective extends CdkFooterCellDef {
}

export const NB_SORT_HEADER_COLUMN_DEF = new InjectionToken('NB_SORT_HEADER_COLUMN_DEF');

/**
* Column definition for the nb-table.
* Defines a set of cells available for a table column.
*/
@Directive({
selector: '[nbColumnDef]',
providers: [
{ provide: CdkColumnDef, useExisting: NbColumnDefDirective },
{ provide: NB_SORT_HEADER_COLUMN_DEF, useExisting: NbColumnDefDirective },
],
})
export class NbColumnDefDirective extends CdkColumnDef {
/** Unique name for this column. */
@Input('nbColumnDef') name: string;

/** Whether this column should be sticky positioned at the start of the row */
@Input() sticky: boolean;

/** Whether this column should be sticky positioned on the end of the row */
@Input() stickyEnd: boolean;
}

/** Header cell template container that adds the right classes and role. */
@Directive({
selector: 'nb-header-cell, th[nbHeaderCell]',
host: {
'class': 'nb-header-cell',
'role': 'columnheader',
},
})
export class NbHeaderCellDirective extends CdkHeaderCell {
constructor(columnDef: NbColumnDefDirective,
elementRef: ElementRef<HTMLElement>) {
super(columnDef, elementRef);
elementRef.nativeElement.classList.add(`nb-column-${columnDef.cssClassFriendlyName}`);
}
}

/** Footer cell template container that adds the right classes and role. */
@Directive({
selector: 'nb-footer-cell, td[nbFooterCell]',
host: {
'class': 'nb-footer-cell',
'role': 'gridcell',
},
})
export class NbFooterCellDirective extends CdkFooterCell {
constructor(columnDef: NbColumnDefDirective,
elementRef: ElementRef) {
super(columnDef, elementRef);
elementRef.nativeElement.classList.add(`nb-column-${columnDef.cssClassFriendlyName}`);
}
}

/** Cell template container that adds the right classes and role. */
@Directive({
selector: 'nb-cell, td[nbCell]',
host: {
'class': 'nb-cell',
'role': 'gridcell',
},
})
export class NbCellDirective extends CdkCell {
constructor(columnDef: NbColumnDefDirective,
elementRef: ElementRef<HTMLElement>) {
super(columnDef, elementRef);
elementRef.nativeElement.classList.add(`nb-column-${columnDef.cssClassFriendlyName}`);
}
}
3 changes: 3 additions & 0 deletions src/framework/theme/components/cdk/table/data-source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { DataSource } from '@angular/cdk/table';

export abstract class NbDataSource<T> extends DataSource<T> {}
5 changes: 5 additions & 0 deletions src/framework/theme/components/cdk/table/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './table.module';
export * from './cell';
export * from './row';
export * from './data-source';
export * from './type-mappings';
Loading