carbon-components-angular 5.23.1 → 5.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation/components/SideNavItem.html +2 -2
- package/docs/documentation/components/Table.html +131 -130
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/TagModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TagModule.html +4 -4
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +83 -83
- package/docs/documentation/modules/TilesModule.html +83 -83
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +41 -45
- package/docs/documentation/modules/TimePickerModule.html +41 -45
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +48 -44
- package/docs/documentation/modules/TimePickerSelectModule.html +48 -44
- package/docs/documentation/modules/ToggleModule/dependencies.svg +40 -44
- package/docs/documentation/modules/ToggleModule.html +40 -44
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggletipModule.html +4 -4
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TreeviewModule.html +4 -4
- package/docs/documentation.json +116 -116
- package/docs/storybook/{3348.4c108918.iframe.bundle.js → 3348.9d9f3238.iframe.bundle.js} +1 -1
- package/docs/storybook/5868.9e6e15e4.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{main.058586e7.iframe.bundle.js → main.6483d603.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.e62f61de.iframe.bundle.js → runtime~main.307461f0.iframe.bundle.js} +1 -1
- package/esm2020/table/table.component.mjs +3 -5
- package/esm2020/ui-shell/sidenav/sidenav-item.component.mjs +2 -2
- package/fesm2015/carbon-components-angular-table.mjs +3 -4
- package/fesm2015/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-ui-shell.mjs +1 -1
- package/fesm2015/carbon-components-angular-ui-shell.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-table.mjs +2 -4
- package/fesm2020/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-ui-shell.mjs +1 -1
- package/fesm2020/carbon-components-angular-ui-shell.mjs.map +1 -1
- package/package.json +1 -1
- package/docs/storybook/5868.f5a4be2e.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -47515,7 +47515,7 @@
|
|
|
47515
47515
|
},
|
|
47516
47516
|
{
|
|
47517
47517
|
"name": "SideNavItem",
|
|
47518
|
-
"id": "component-SideNavItem-
|
|
47518
|
+
"id": "component-SideNavItem-251be0e8c644af56dccc6a6f8363a640a33f5a2e1722e5c1e1f4ff7c7c99f8b5de68c8d6cc36f030811f929fc12def7346c6a18d137831418a4f178e9129b9b8",
|
|
47519
47519
|
"file": "src/ui-shell/sidenav/sidenav-item.component.ts",
|
|
47520
47520
|
"encapsulation": [],
|
|
47521
47521
|
"entryComponents": [],
|
|
@@ -47594,7 +47594,7 @@
|
|
|
47594
47594
|
},
|
|
47595
47595
|
{
|
|
47596
47596
|
"name": "useRouter",
|
|
47597
|
-
"defaultValue": "
|
|
47597
|
+
"defaultValue": "false",
|
|
47598
47598
|
"deprecated": false,
|
|
47599
47599
|
"deprecationMessage": "",
|
|
47600
47600
|
"rawdescription": "\n\nUse the routerLink attribute on <a> tag for navigation instead of using event handlers\n",
|
|
@@ -47712,7 +47712,7 @@
|
|
|
47712
47712
|
"description": "<p><code>SideNavItem</code> can either be a child of <code>SideNav</code> or <code>SideNavMenu</code></p>\n",
|
|
47713
47713
|
"rawdescription": "\n\n`SideNavItem` can either be a child of `SideNav` or `SideNavMenu`\n",
|
|
47714
47714
|
"type": "component",
|
|
47715
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOptional,\n\tOutput,\n\tEventEmitter,\n\tOnChanges,\n\tHostBinding,\n\tSimpleChanges\n} from \"@angular/core\";\nimport { DomSanitizer } from \"@angular/platform-browser\";\nimport { Router } from \"@angular/router\";\n\n/**\n * `SideNavItem` can either be a child of `SideNav` or `SideNavMenu`\n */\n@Component({\n\tselector: \"cds-sidenav-item, ibm-sidenav-item\",\n\ttemplate: `\n\t\t<a *ngIf=\"!useRouter; else sidenavItemRouterTpl\"\n\t\t class=\"cds--side-nav__link\"\n\t\t [ngClass]=\"{\n\t\t\t\t'cds--side-nav__item--active': active\n\t\t\t}\"\n\t\t [href]=\"href\"\n\t\t [attr.aria-current]=\"(active ? 'page' : null)\"\n\t\t [attr.title]=\"title ? title : null\"\n\t\t (click)=\"navigate($event)\">\n\t\t\t<ng-template [ngTemplateOutlet]=\"sidenavItemContentTpl\"></ng-template>\n\t\t</a>\n\n\t\t<ng-template #sidenavItemRouterTpl>\n\t\t\t<a\n\t\t\t\t[routerLink]=\"route\"\n\t\t\t\trouterLinkActive=\"cds--side-nav__item--active\"\n\t\t\t\tariaCurrentWhenActive=\"page\"\n\t\t\t\t[attr.title]=\"title ? title : null\"\n\t\t\t\tclass=\"cds--side-nav__link\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"sidenavItemContentTpl\"></ng-template>\n\t\t\t</a>\n\t\t</ng-template>\n\n\t\t<ng-template #sidenavItemContentTpl>\n\t\t\t<div *ngIf=\"!isSubMenu\" class=\"cds--side-nav__icon\">\n\t\t\t\t<ng-content select=\"svg, [icon]\"></ng-content>\n\t\t\t</div>\n\t\t\t<span class=\"cds--side-nav__link-text\">\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</span>\n\t\t</ng-template>\n\t`,\n\tstyles: [`\n\t\t:host {\n\t\t\tdisplay: list-item;\n\t\t}\n\t`]\n})\nexport class SideNavItem implements OnChanges {\n\t/**\n\t * Link for the item. NOTE: *do not* pass unsafe or untrusted values, this has the potential to open you up to XSS attacks\n\t */\n\t@Input() set href(v: string) {\n\t\t// Needed when component is created dynamically with a model.\n\t\tif (v === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._href = v;\n\t}\n\n\tget href() {\n\t\treturn this.domSanitizer.bypassSecurityTrustUrl(this._href) as string;\n\t}\n\n\t/**\n\t * Use the routerLink attribute on <a> tag for navigation instead of using event handlers\n\t */\n\t@Input() useRouter =
|
|
47715
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOptional,\n\tOutput,\n\tEventEmitter,\n\tOnChanges,\n\tHostBinding,\n\tSimpleChanges\n} from \"@angular/core\";\nimport { DomSanitizer } from \"@angular/platform-browser\";\nimport { Router } from \"@angular/router\";\n\n/**\n * `SideNavItem` can either be a child of `SideNav` or `SideNavMenu`\n */\n@Component({\n\tselector: \"cds-sidenav-item, ibm-sidenav-item\",\n\ttemplate: `\n\t\t<a *ngIf=\"!useRouter; else sidenavItemRouterTpl\"\n\t\t class=\"cds--side-nav__link\"\n\t\t [ngClass]=\"{\n\t\t\t\t'cds--side-nav__item--active': active\n\t\t\t}\"\n\t\t [href]=\"href\"\n\t\t [attr.aria-current]=\"(active ? 'page' : null)\"\n\t\t [attr.title]=\"title ? title : null\"\n\t\t (click)=\"navigate($event)\">\n\t\t\t<ng-template [ngTemplateOutlet]=\"sidenavItemContentTpl\"></ng-template>\n\t\t</a>\n\n\t\t<ng-template #sidenavItemRouterTpl>\n\t\t\t<a\n\t\t\t\t[routerLink]=\"route\"\n\t\t\t\trouterLinkActive=\"cds--side-nav__item--active\"\n\t\t\t\tariaCurrentWhenActive=\"page\"\n\t\t\t\t[attr.title]=\"title ? title : null\"\n\t\t\t\tclass=\"cds--side-nav__link\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"sidenavItemContentTpl\"></ng-template>\n\t\t\t</a>\n\t\t</ng-template>\n\n\t\t<ng-template #sidenavItemContentTpl>\n\t\t\t<div *ngIf=\"!isSubMenu\" class=\"cds--side-nav__icon\">\n\t\t\t\t<ng-content select=\"svg, [icon]\"></ng-content>\n\t\t\t</div>\n\t\t\t<span class=\"cds--side-nav__link-text\">\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</span>\n\t\t</ng-template>\n\t`,\n\tstyles: [`\n\t\t:host {\n\t\t\tdisplay: list-item;\n\t\t}\n\t`]\n})\nexport class SideNavItem implements OnChanges {\n\t/**\n\t * Link for the item. NOTE: *do not* pass unsafe or untrusted values, this has the potential to open you up to XSS attacks\n\t */\n\t@Input() set href(v: string) {\n\t\t// Needed when component is created dynamically with a model.\n\t\tif (v === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._href = v;\n\t}\n\n\tget href() {\n\t\treturn this.domSanitizer.bypassSecurityTrustUrl(this._href) as string;\n\t}\n\n\t/**\n\t * Use the routerLink attribute on <a> tag for navigation instead of using event handlers\n\t */\n\t@Input() useRouter = false;\n\n\t@HostBinding(\"class.cds--side-nav__item\") get sideNav() {\n\t\treturn !this.isSubMenu;\n\t}\n\n\t@HostBinding(\"class.cds--side-nav__menu-item\") get menuItem() {\n\t\treturn this.isSubMenu;\n\t}\n\n\t/**\n\t * Toggles the active (current page) state for the link.\n\t */\n\t@Input() active = false;\n\n\t/**\n\t * Array of commands to send to the router when the link is activated\n\t * See: https://angular.io/api/router/Router#navigate\n\t */\n\t@Input() route: any[];\n\n\t@Input() isSubMenu = false;\n\n\t/**\n\t * Router options. Used in conjunction with `route`\n\t * See: https://angular.io/api/router/Router#navigate\n\t */\n\t@Input() routeExtras: any;\n\n\t/**\n\t * Title attribute of the anchor element.\n\t */\n\t@Input() title: string;\n\n\t/**\n\t * Emits the navigation status promise when the link is activated\n\t */\n\t@Output() navigation = new EventEmitter<Promise<boolean>>();\n\n\t/**\n\t * Emits when `active` input is changed. This is mainly used to indicate to any parent menu items that a\n\t * child sidenav item is active or not active.\n\t */\n\t@Output() selected = new EventEmitter<boolean>();\n\n\t@HostBinding(\"attr.role\") role = \"listitem\";\n\n\tprotected _href = \"#\";\n\n\tconstructor(protected domSanitizer: DomSanitizer, @Optional() protected router: Router) {}\n\n\tngOnChanges(changes: SimpleChanges) {\n\t\tif (changes.active) {\n\t\t\tthis.selected.emit(this.active);\n\t\t}\n\t}\n\n\tnavigate(event: MouseEvent) {\n\t\tif (this.router && this.route) {\n\t\t\tevent.preventDefault();\n\t\t\tconst status = this.router.navigate(this.route, this.routeExtras);\n\t\t\tthis.navigation.emit(status);\n\t\t} else if (this._href === \"#\") {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n}\n",
|
|
47716
47716
|
"assetsDirs": [],
|
|
47717
47717
|
"styleUrlsData": "",
|
|
47718
47718
|
"stylesData": "\n\t\t:host {\n\t\t\tdisplay: list-item;\n\t\t}\n\t\n",
|
|
@@ -51737,7 +51737,7 @@
|
|
|
51737
51737
|
},
|
|
51738
51738
|
{
|
|
51739
51739
|
"name": "Table",
|
|
51740
|
-
"id": "component-Table-
|
|
51740
|
+
"id": "component-Table-6d18aab8c1dcae26f2a66afd909fc4e266afd9e851aee8813007e53a0d111ca2abcac002be665d1d36d90b606f1da766faa33ad5c9afec71b25346aeef7cde74",
|
|
51741
51741
|
"file": "src/table/table.component.ts",
|
|
51742
51742
|
"encapsulation": [],
|
|
51743
51743
|
"entryComponents": [],
|
|
@@ -51760,7 +51760,7 @@
|
|
|
51760
51760
|
"deprecationMessage": "",
|
|
51761
51761
|
"rawdescription": "\n\nId of the table header description element\n",
|
|
51762
51762
|
"description": "<p>Id of the table header description element</p>\n",
|
|
51763
|
-
"line":
|
|
51763
|
+
"line": 309,
|
|
51764
51764
|
"type": "string",
|
|
51765
51765
|
"decorators": []
|
|
51766
51766
|
},
|
|
@@ -51770,7 +51770,7 @@
|
|
|
51770
51770
|
"deprecationMessage": "",
|
|
51771
51771
|
"rawdescription": "\n\nId of the table header title element\n",
|
|
51772
51772
|
"description": "<p>Id of the table header title element</p>\n",
|
|
51773
|
-
"line":
|
|
51773
|
+
"line": 305,
|
|
51774
51774
|
"type": "string",
|
|
51775
51775
|
"decorators": []
|
|
51776
51776
|
},
|
|
@@ -51781,7 +51781,7 @@
|
|
|
51781
51781
|
"deprecationMessage": "",
|
|
51782
51782
|
"rawdescription": "\n\nControls whether to enable multiple or single row selection.\n",
|
|
51783
51783
|
"description": "<p>Controls whether to enable multiple or single row selection.</p>\n",
|
|
51784
|
-
"line":
|
|
51784
|
+
"line": 398,
|
|
51785
51785
|
"type": "boolean",
|
|
51786
51786
|
"decorators": []
|
|
51787
51787
|
},
|
|
@@ -51791,15 +51791,15 @@
|
|
|
51791
51791
|
"deprecationMessage": "",
|
|
51792
51792
|
"jsdoctags": [
|
|
51793
51793
|
{
|
|
51794
|
-
"pos":
|
|
51795
|
-
"end":
|
|
51794
|
+
"pos": 12311,
|
|
51795
|
+
"end": 12491,
|
|
51796
51796
|
"flags": 8421376,
|
|
51797
51797
|
"modifierFlagsCache": 0,
|
|
51798
51798
|
"transformFlags": 0,
|
|
51799
51799
|
"kind": 330,
|
|
51800
51800
|
"tagName": {
|
|
51801
|
-
"pos":
|
|
51802
|
-
"end":
|
|
51801
|
+
"pos": 12312,
|
|
51802
|
+
"end": 12316,
|
|
51803
51803
|
"flags": 8421376,
|
|
51804
51804
|
"modifierFlagsCache": 0,
|
|
51805
51805
|
"transformFlags": 0,
|
|
@@ -51809,7 +51809,7 @@
|
|
|
51809
51809
|
"comment": "<ul>\n<li>Enable column resize when Carbon officially supports feature\nSet to <code>true</code> to enable users to resize columns.</li>\n</ul>\n<p>Works for columns with width set in pixels.</p>\n"
|
|
51810
51810
|
}
|
|
51811
51811
|
],
|
|
51812
|
-
"line":
|
|
51812
|
+
"line": 426,
|
|
51813
51813
|
"type": "string | Observable",
|
|
51814
51814
|
"decorators": []
|
|
51815
51815
|
},
|
|
@@ -51819,7 +51819,7 @@
|
|
|
51819
51819
|
"deprecationMessage": "",
|
|
51820
51820
|
"rawdescription": "\n\nSet footer template to customize what is displayed in the tfoot section of the table\n",
|
|
51821
51821
|
"description": "<p>Set footer template to customize what is displayed in the tfoot section of the table</p>\n",
|
|
51822
|
-
"line":
|
|
51822
|
+
"line": 487,
|
|
51823
51823
|
"type": "TemplateRef<any>",
|
|
51824
51824
|
"decorators": []
|
|
51825
51825
|
},
|
|
@@ -51829,7 +51829,7 @@
|
|
|
51829
51829
|
"deprecationMessage": "",
|
|
51830
51830
|
"rawdescription": "\n\nSet to `true` for a data grid with keyboard interactions.\n",
|
|
51831
51831
|
"description": "<p>Set to <code>true</code> for a data grid with keyboard interactions.</p>\n",
|
|
51832
|
-
"line":
|
|
51832
|
+
"line": 367,
|
|
51833
51833
|
"type": "boolean",
|
|
51834
51834
|
"decorators": []
|
|
51835
51835
|
},
|
|
@@ -51839,7 +51839,7 @@
|
|
|
51839
51839
|
"deprecationMessage": "",
|
|
51840
51840
|
"rawdescription": "\n\n`TableModel` with data the table is to display.\n",
|
|
51841
51841
|
"description": "<p><code>TableModel</code> with data the table is to display.</p>\n",
|
|
51842
|
-
"line":
|
|
51842
|
+
"line": 315,
|
|
51843
51843
|
"type": "TableModel",
|
|
51844
51844
|
"decorators": []
|
|
51845
51845
|
},
|
|
@@ -51848,7 +51848,7 @@
|
|
|
51848
51848
|
"defaultValue": "true",
|
|
51849
51849
|
"deprecated": false,
|
|
51850
51850
|
"deprecationMessage": "",
|
|
51851
|
-
"line":
|
|
51851
|
+
"line": 384,
|
|
51852
51852
|
"type": "boolean",
|
|
51853
51853
|
"decorators": []
|
|
51854
51854
|
},
|
|
@@ -51859,7 +51859,7 @@
|
|
|
51859
51859
|
"deprecationMessage": "",
|
|
51860
51860
|
"rawdescription": "\n\nDistance (in px) from the bottom that view has to reach before\n`scrollLoad` event is emitted.\n",
|
|
51861
51861
|
"description": "<p>Distance (in px) from the bottom that view has to reach before\n<code>scrollLoad</code> event is emitted.</p>\n",
|
|
51862
|
-
"line":
|
|
51862
|
+
"line": 404,
|
|
51863
51863
|
"type": "number",
|
|
51864
51864
|
"decorators": []
|
|
51865
51865
|
},
|
|
@@ -51869,7 +51869,7 @@
|
|
|
51869
51869
|
"deprecationMessage": "",
|
|
51870
51870
|
"rawdescription": "\n\nUsed to populate the row selection checkbox label with a useful value if set.\n\nExample:\n```\n<cds-table [selectionLabelColumn]=\"0\"></cds-table>\n<!-- results in aria-label=\"Select first column value\"\n(where \"first column value\" is the value of the first column in the row -->\n```\n",
|
|
51871
51871
|
"description": "<p>Used to populate the row selection checkbox label with a useful value if set.</p>\n<p>Example:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-none\"><cds-table [selectionLabelColumn]="0"></cds-table>\n<!-- results in aria-label="Select first column value"\n(where "first column value" is the value of the first column in the row --></code></pre></div>",
|
|
51872
|
-
"line":
|
|
51872
|
+
"line": 499,
|
|
51873
51873
|
"type": "number",
|
|
51874
51874
|
"decorators": []
|
|
51875
51875
|
},
|
|
@@ -51880,7 +51880,7 @@
|
|
|
51880
51880
|
"deprecationMessage": "",
|
|
51881
51881
|
"rawdescription": "\n\nControls whether to show the selection checkboxes column or not.\n",
|
|
51882
51882
|
"description": "<p>Controls whether to show the selection checkboxes column or not.</p>\n",
|
|
51883
|
-
"line":
|
|
51883
|
+
"line": 393,
|
|
51884
51884
|
"type": "boolean",
|
|
51885
51885
|
"decorators": []
|
|
51886
51886
|
},
|
|
@@ -51891,7 +51891,7 @@
|
|
|
51891
51891
|
"deprecationMessage": "",
|
|
51892
51892
|
"rawdescription": "\n\nSize of the table rows.\n",
|
|
51893
51893
|
"description": "<p>Size of the table rows.</p>\n",
|
|
51894
|
-
"line":
|
|
51894
|
+
"line": 359,
|
|
51895
51895
|
"type": "TableRowSize",
|
|
51896
51896
|
"decorators": []
|
|
51897
51897
|
},
|
|
@@ -51902,7 +51902,7 @@
|
|
|
51902
51902
|
"deprecationMessage": "",
|
|
51903
51903
|
"rawdescription": "\n\nSet to `true` for a loading table.\n",
|
|
51904
51904
|
"description": "<p>Set to <code>true</code> for a loading table.</p>\n",
|
|
51905
|
-
"line":
|
|
51905
|
+
"line": 363,
|
|
51906
51906
|
"type": "boolean",
|
|
51907
51907
|
"decorators": []
|
|
51908
51908
|
},
|
|
@@ -51913,7 +51913,7 @@
|
|
|
51913
51913
|
"deprecationMessage": "",
|
|
51914
51914
|
"rawdescription": "\n\nSetting sortable to false will disable all headers including headers which are sortable. Is is\npossible to set the sortable state on the header item to disable/enable sorting for only some headers.\n",
|
|
51915
51915
|
"description": "<p>Setting sortable to false will disable all headers including headers which are sortable. Is is\npossible to set the sortable state on the header item to disable/enable sorting for only some headers.</p>\n",
|
|
51916
|
-
"line":
|
|
51916
|
+
"line": 382,
|
|
51917
51917
|
"type": "boolean",
|
|
51918
51918
|
"decorators": []
|
|
51919
51919
|
},
|
|
@@ -51921,7 +51921,7 @@
|
|
|
51921
51921
|
"name": "sortAscendingLabel",
|
|
51922
51922
|
"deprecated": false,
|
|
51923
51923
|
"deprecationMessage": "",
|
|
51924
|
-
"line":
|
|
51924
|
+
"line": 440,
|
|
51925
51925
|
"type": "string | Observable",
|
|
51926
51926
|
"decorators": []
|
|
51927
51927
|
},
|
|
@@ -51929,7 +51929,7 @@
|
|
|
51929
51929
|
"name": "sortDescendingLabel",
|
|
51930
51930
|
"deprecated": false,
|
|
51931
51931
|
"deprecationMessage": "",
|
|
51932
|
-
"line":
|
|
51932
|
+
"line": 433,
|
|
51933
51933
|
"type": "string | Observable",
|
|
51934
51934
|
"decorators": []
|
|
51935
51935
|
},
|
|
@@ -51940,7 +51940,7 @@
|
|
|
51940
51940
|
"deprecationMessage": "",
|
|
51941
51941
|
"rawdescription": "\n\nSet to `true` to stick the header to the top of the table\n",
|
|
51942
51942
|
"description": "<p>Set to <code>true</code> to stick the header to the top of the table</p>\n",
|
|
51943
|
-
"line":
|
|
51943
|
+
"line": 482,
|
|
51944
51944
|
"type": "boolean",
|
|
51945
51945
|
"decorators": []
|
|
51946
51946
|
},
|
|
@@ -51951,7 +51951,7 @@
|
|
|
51951
51951
|
"deprecationMessage": "",
|
|
51952
51952
|
"rawdescription": "\n\nSet to `false` to remove table rows (zebra) stripes.\n",
|
|
51953
51953
|
"description": "<p>Set to <code>false</code> to remove table rows (zebra) stripes.</p>\n",
|
|
51954
|
-
"line":
|
|
51954
|
+
"line": 472,
|
|
51955
51955
|
"type": "boolean",
|
|
51956
51956
|
"decorators": []
|
|
51957
51957
|
},
|
|
@@ -51961,7 +51961,7 @@
|
|
|
51961
51961
|
"deprecationMessage": "",
|
|
51962
51962
|
"rawdescription": "\n\nExpects an object that contains some or all of:\n```\n{\n\t\t\"FILTER\": \"Filter\",\n\t\t\"END_OF_DATA\": \"You've reached the end of your content\",\n\t\t\"SCROLL_TOP\": \"Scroll to top\",\n\t\t\"CHECKBOX_HEADER\": \"Select all rows\",\n\t\t\"CHECKBOX_ROW\": \"Select row\"\n}\n```\n",
|
|
51963
51963
|
"description": "<p>Expects an object that contains some or all of:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-none\">{\n "FILTER": "Filter",\n "END_OF_DATA": "You've reached the end of your content",\n "SCROLL_TOP": "Scroll to top",\n "CHECKBOX_HEADER": "Select all rows",\n "CHECKBOX_ROW": "Select row"\n}</code></pre></div>",
|
|
51964
|
-
"line":
|
|
51964
|
+
"line": 460,
|
|
51965
51965
|
"type": "any",
|
|
51966
51966
|
"decorators": []
|
|
51967
51967
|
}
|
|
@@ -51976,15 +51976,15 @@
|
|
|
51976
51976
|
"description": "<p>Emits if all rows are deselected.</p>\n",
|
|
51977
51977
|
"jsdoctags": [
|
|
51978
51978
|
{
|
|
51979
|
-
"pos":
|
|
51980
|
-
"end":
|
|
51979
|
+
"pos": 17211,
|
|
51980
|
+
"end": 17226,
|
|
51981
51981
|
"flags": 8421376,
|
|
51982
51982
|
"modifierFlagsCache": 0,
|
|
51983
51983
|
"transformFlags": 0,
|
|
51984
51984
|
"kind": 344,
|
|
51985
51985
|
"tagName": {
|
|
51986
|
-
"pos":
|
|
51987
|
-
"end":
|
|
51986
|
+
"pos": 17212,
|
|
51987
|
+
"end": 17217,
|
|
51988
51988
|
"flags": 8421376,
|
|
51989
51989
|
"modifierFlagsCache": 0,
|
|
51990
51990
|
"transformFlags": 0,
|
|
@@ -51993,8 +51993,8 @@
|
|
|
51993
51993
|
},
|
|
51994
51994
|
"comment": "",
|
|
51995
51995
|
"name": {
|
|
51996
|
-
"pos":
|
|
51997
|
-
"end":
|
|
51996
|
+
"pos": 17218,
|
|
51997
|
+
"end": 17223,
|
|
51998
51998
|
"flags": 8421376,
|
|
51999
51999
|
"modifierFlagsCache": 0,
|
|
52000
52000
|
"transformFlags": 0,
|
|
@@ -52005,7 +52005,7 @@
|
|
|
52005
52005
|
"isBracketed": false
|
|
52006
52006
|
}
|
|
52007
52007
|
],
|
|
52008
|
-
"line":
|
|
52008
|
+
"line": 571,
|
|
52009
52009
|
"type": "EventEmitter"
|
|
52010
52010
|
},
|
|
52011
52011
|
{
|
|
@@ -52017,15 +52017,15 @@
|
|
|
52017
52017
|
"description": "<p>Emits if a single row is deselected.</p>\n",
|
|
52018
52018
|
"jsdoctags": [
|
|
52019
52019
|
{
|
|
52020
|
-
"pos":
|
|
52021
|
-
"end":
|
|
52020
|
+
"pos": 17500,
|
|
52021
|
+
"end": 17558,
|
|
52022
52022
|
"flags": 8421376,
|
|
52023
52023
|
"modifierFlagsCache": 0,
|
|
52024
52024
|
"transformFlags": 0,
|
|
52025
52025
|
"kind": 344,
|
|
52026
52026
|
"tagName": {
|
|
52027
|
-
"pos":
|
|
52028
|
-
"end":
|
|
52027
|
+
"pos": 17501,
|
|
52028
|
+
"end": 17506,
|
|
52029
52029
|
"flags": 8421376,
|
|
52030
52030
|
"modifierFlagsCache": 0,
|
|
52031
52031
|
"transformFlags": 0,
|
|
@@ -52034,8 +52034,8 @@
|
|
|
52034
52034
|
},
|
|
52035
52035
|
"comment": "<p>({model: this.model, deselectedRowIndex: index})</p>\n",
|
|
52036
52036
|
"name": {
|
|
52037
|
-
"pos":
|
|
52038
|
-
"end":
|
|
52037
|
+
"pos": 17507,
|
|
52038
|
+
"end": 17507,
|
|
52039
52039
|
"flags": 8552448,
|
|
52040
52040
|
"modifierFlagsCache": 0,
|
|
52041
52041
|
"transformFlags": 0,
|
|
@@ -52046,7 +52046,7 @@
|
|
|
52046
52046
|
"isBracketed": false
|
|
52047
52047
|
}
|
|
52048
52048
|
],
|
|
52049
|
-
"line":
|
|
52049
|
+
"line": 585,
|
|
52050
52050
|
"type": "EventEmitter"
|
|
52051
52051
|
},
|
|
52052
52052
|
{
|
|
@@ -52056,7 +52056,7 @@
|
|
|
52056
52056
|
"deprecationMessage": "",
|
|
52057
52057
|
"rawdescription": "\n\nEmits if a row item excluding expandButtons, checkboxes, or radios is clicked.\n",
|
|
52058
52058
|
"description": "<p>Emits if a row item excluding expandButtons, checkboxes, or radios is clicked.</p>\n",
|
|
52059
|
-
"line":
|
|
52059
|
+
"line": 590,
|
|
52060
52060
|
"type": "EventEmitter"
|
|
52061
52061
|
},
|
|
52062
52062
|
{
|
|
@@ -52066,7 +52066,7 @@
|
|
|
52066
52066
|
"deprecationMessage": "",
|
|
52067
52067
|
"rawdescription": "\n\nEmits when table requires more data to be loaded.\n",
|
|
52068
52068
|
"description": "<p>Emits when table requires more data to be loaded.</p>\n",
|
|
52069
|
-
"line":
|
|
52069
|
+
"line": 595,
|
|
52070
52070
|
"type": "EventEmitter"
|
|
52071
52071
|
},
|
|
52072
52072
|
{
|
|
@@ -52078,15 +52078,15 @@
|
|
|
52078
52078
|
"description": "<p>Emits if all rows are selected.</p>\n",
|
|
52079
52079
|
"jsdoctags": [
|
|
52080
52080
|
{
|
|
52081
|
-
"pos":
|
|
52082
|
-
"end":
|
|
52081
|
+
"pos": 17090,
|
|
52082
|
+
"end": 17105,
|
|
52083
52083
|
"flags": 8421376,
|
|
52084
52084
|
"modifierFlagsCache": 0,
|
|
52085
52085
|
"transformFlags": 0,
|
|
52086
52086
|
"kind": 344,
|
|
52087
52087
|
"tagName": {
|
|
52088
|
-
"pos":
|
|
52089
|
-
"end":
|
|
52088
|
+
"pos": 17091,
|
|
52089
|
+
"end": 17096,
|
|
52090
52090
|
"flags": 8421376,
|
|
52091
52091
|
"modifierFlagsCache": 0,
|
|
52092
52092
|
"transformFlags": 0,
|
|
@@ -52095,8 +52095,8 @@
|
|
|
52095
52095
|
},
|
|
52096
52096
|
"comment": "",
|
|
52097
52097
|
"name": {
|
|
52098
|
-
"pos":
|
|
52099
|
-
"end":
|
|
52098
|
+
"pos": 17097,
|
|
52099
|
+
"end": 17102,
|
|
52100
52100
|
"flags": 8421376,
|
|
52101
52101
|
"modifierFlagsCache": 0,
|
|
52102
52102
|
"transformFlags": 0,
|
|
@@ -52107,7 +52107,7 @@
|
|
|
52107
52107
|
"isBracketed": false
|
|
52108
52108
|
}
|
|
52109
52109
|
],
|
|
52110
|
-
"line":
|
|
52110
|
+
"line": 564,
|
|
52111
52111
|
"type": "EventEmitter"
|
|
52112
52112
|
},
|
|
52113
52113
|
{
|
|
@@ -52119,15 +52119,15 @@
|
|
|
52119
52119
|
"description": "<p>Emits if a single row is selected.</p>\n",
|
|
52120
52120
|
"jsdoctags": [
|
|
52121
52121
|
{
|
|
52122
|
-
"pos":
|
|
52123
|
-
"end":
|
|
52122
|
+
"pos": 17335,
|
|
52123
|
+
"end": 17391,
|
|
52124
52124
|
"flags": 8421376,
|
|
52125
52125
|
"modifierFlagsCache": 0,
|
|
52126
52126
|
"transformFlags": 0,
|
|
52127
52127
|
"kind": 344,
|
|
52128
52128
|
"tagName": {
|
|
52129
|
-
"pos":
|
|
52130
|
-
"end":
|
|
52129
|
+
"pos": 17336,
|
|
52130
|
+
"end": 17341,
|
|
52131
52131
|
"flags": 8421376,
|
|
52132
52132
|
"modifierFlagsCache": 0,
|
|
52133
52133
|
"transformFlags": 0,
|
|
@@ -52136,8 +52136,8 @@
|
|
|
52136
52136
|
},
|
|
52137
52137
|
"comment": "<p>({model: this.model, selectedRowIndex: index})</p>\n",
|
|
52138
52138
|
"name": {
|
|
52139
|
-
"pos":
|
|
52140
|
-
"end":
|
|
52139
|
+
"pos": 17342,
|
|
52140
|
+
"end": 17342,
|
|
52141
52141
|
"flags": 8552448,
|
|
52142
52142
|
"modifierFlagsCache": 0,
|
|
52143
52143
|
"transformFlags": 0,
|
|
@@ -52148,7 +52148,7 @@
|
|
|
52148
52148
|
"isBracketed": false
|
|
52149
52149
|
}
|
|
52150
52150
|
],
|
|
52151
|
-
"line":
|
|
52151
|
+
"line": 578,
|
|
52152
52152
|
"type": "EventEmitter"
|
|
52153
52153
|
},
|
|
52154
52154
|
{
|
|
@@ -52160,15 +52160,15 @@
|
|
|
52160
52160
|
"description": "<p>Emits an index of the column that wants to be sorted.</p>\n<p>If no observers are provided (default), table will attempt to do a simple sort of the data loaded\ninto the model.</p>\n<p>If an observer is provided, table will not attempt any sorting of its own and it is up to the observer\nto sort the table. This is what you typically want if you're using a backend query to get the sorted\ndata or want to sort data across multiple pages.</p>\n<p>Usage:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-typescript\">@Component({\n selector: "app-table",\n template: `\n <cds-table\n [model]="model"\n (sort)="simpleSort($event)">\n No data.\n </cds-table>\n `\n})\nexport class TableApp implements OnInit, OnChanges {\n @Input() model = new TableModel();\n\n ngOnInit() {\n this.model.header = [\n new TableHeaderItem({ data: "Name" }),\n new TableHeaderItem({ data: "hwer" })\n ];\n\n this.model.data = [\n [new TableItem({ data: "Name 1" }), new TableItem({ data: "qwer" })],\n [new TableItem({ data: "Name 3" }), new TableItem({ data: "zwer" })],\n [new TableItem({ data: "Name 2" }), new TableItem({ data: "swer" })],\n [new TableItem({ data: "Name 4" }), new TableItem({data: "twer"})],\n [new TableItem({ data: "Name 5" }), new TableItem({data: "twer"})],\n [new TableItem({ data: "Name 6" }), new TableItem({data: "twer"})]\n ];\n }\n\n simpleSort(index: number) {\n // this function does a simple sort, which is the default for the table and if that's\n // all you want, you don't need to do this.\n\n // here you can query your backend and update the model.data based on the result\n if (this.model.header[index].sorted) {\n // if already sorted flip sorting direction\n this.model.header[index].ascending = this.model.header[index].descending;\n }\n this.model.sort(index);\n }\n}</code></pre></div>",
|
|
52161
52161
|
"jsdoctags": [
|
|
52162
52162
|
{
|
|
52163
|
-
"pos":
|
|
52164
|
-
"end":
|
|
52163
|
+
"pos": 15552,
|
|
52164
|
+
"end": 15797,
|
|
52165
52165
|
"flags": 8421376,
|
|
52166
52166
|
"modifierFlagsCache": 0,
|
|
52167
52167
|
"transformFlags": 0,
|
|
52168
52168
|
"kind": 330,
|
|
52169
52169
|
"tagName": {
|
|
52170
|
-
"pos":
|
|
52171
|
-
"end":
|
|
52170
|
+
"pos": 15553,
|
|
52171
|
+
"end": 15562,
|
|
52172
52172
|
"flags": 8421376,
|
|
52173
52173
|
"modifierFlagsCache": 0,
|
|
52174
52174
|
"transformFlags": 0,
|
|
@@ -52178,15 +52178,15 @@
|
|
|
52178
52178
|
"comment": "<p>({\nselector: "app-table",\ntemplate: <code><cds-table [model]="model" (sort)="simpleSort($event)"> No data. </cds-table></code>\n})\nexport class TableApp implements OnInit, OnChanges {</p>\n"
|
|
52179
52179
|
},
|
|
52180
52180
|
{
|
|
52181
|
-
"pos":
|
|
52182
|
-
"end":
|
|
52181
|
+
"pos": 15797,
|
|
52182
|
+
"end": 16991,
|
|
52183
52183
|
"flags": 8421376,
|
|
52184
52184
|
"modifierFlagsCache": 0,
|
|
52185
52185
|
"transformFlags": 0,
|
|
52186
52186
|
"kind": 330,
|
|
52187
52187
|
"tagName": {
|
|
52188
|
-
"pos":
|
|
52189
|
-
"end":
|
|
52188
|
+
"pos": 15798,
|
|
52189
|
+
"end": 15803,
|
|
52190
52190
|
"flags": 8421376,
|
|
52191
52191
|
"modifierFlagsCache": 0,
|
|
52192
52192
|
"transformFlags": 0,
|
|
@@ -52196,7 +52196,7 @@
|
|
|
52196
52196
|
"comment": "<p>() model = new TableModel();</p>\n<p>ngOnInit() {\nthis.model.header = [\nnew TableHeaderItem({ data: "Name" }),\nnew TableHeaderItem({ data: "hwer" })\n];</p>\n<p>this.model.data = [\n[new TableItem({ data: "Name 1" }), new TableItem({ data: "qwer" })],\n[new TableItem({ data: "Name 3" }), new TableItem({ data: "zwer" })],\n[new TableItem({ data: "Name 2" }), new TableItem({ data: "swer" })],\n[new TableItem({ data: "Name 4" }), new TableItem({data: "twer"})],\n[new TableItem({ data: "Name 5" }), new TableItem({data: "twer"})],\n[new TableItem({ data: "Name 6" }), new TableItem({data: "twer"})]\n];\n}</p>\n<p>simpleSort(index: number) {\n// this function does a simple sort, which is the default for the table and if that's\n// all you want, you don't need to do this.</p>\n<p>// here you can query your backend and update the model.data based on the result\nif (this.model.header[index].sorted) {\n// if already sorted flip sorting direction\nthis.model.header[index].ascending = this.model.header[index].descending;\n}\nthis.model.sort(index);\n}\n}\n```</p>\n"
|
|
52197
52197
|
}
|
|
52198
52198
|
],
|
|
52199
|
-
"line":
|
|
52199
|
+
"line": 557,
|
|
52200
52200
|
"type": "EventEmitter"
|
|
52201
52201
|
}
|
|
52202
52202
|
],
|
|
@@ -52209,7 +52209,7 @@
|
|
|
52209
52209
|
"type": "",
|
|
52210
52210
|
"optional": false,
|
|
52211
52211
|
"description": "",
|
|
52212
|
-
"line":
|
|
52212
|
+
"line": 614,
|
|
52213
52213
|
"modifierKind": [
|
|
52214
52214
|
123
|
|
52215
52215
|
]
|
|
@@ -52222,7 +52222,7 @@
|
|
|
52222
52222
|
"type": "string",
|
|
52223
52223
|
"optional": false,
|
|
52224
52224
|
"description": "",
|
|
52225
|
-
"line":
|
|
52225
|
+
"line": 615,
|
|
52226
52226
|
"modifierKind": [
|
|
52227
52227
|
123
|
|
52228
52228
|
]
|
|
@@ -52235,7 +52235,7 @@
|
|
|
52235
52235
|
"type": "",
|
|
52236
52236
|
"optional": false,
|
|
52237
52237
|
"description": "",
|
|
52238
|
-
"line":
|
|
52238
|
+
"line": 613,
|
|
52239
52239
|
"modifierKind": [
|
|
52240
52240
|
123
|
|
52241
52241
|
]
|
|
@@ -52248,7 +52248,7 @@
|
|
|
52248
52248
|
"type": "",
|
|
52249
52249
|
"optional": false,
|
|
52250
52250
|
"description": "<p>Controls if all checkboxes are viewed as selected.</p>\n",
|
|
52251
|
-
"line":
|
|
52251
|
+
"line": 600,
|
|
52252
52252
|
"rawdescription": "\n\nControls if all checkboxes are viewed as selected.\n"
|
|
52253
52253
|
},
|
|
52254
52254
|
{
|
|
@@ -52259,7 +52259,7 @@
|
|
|
52259
52259
|
"type": "",
|
|
52260
52260
|
"optional": false,
|
|
52261
52261
|
"description": "<p>Controls the indeterminate state of the header checkbox.</p>\n",
|
|
52262
|
-
"line":
|
|
52262
|
+
"line": 605,
|
|
52263
52263
|
"rawdescription": "\n\nControls the indeterminate state of the header checkbox.\n"
|
|
52264
52264
|
},
|
|
52265
52265
|
{
|
|
@@ -52270,7 +52270,7 @@
|
|
|
52270
52270
|
"type": "",
|
|
52271
52271
|
"optional": false,
|
|
52272
52272
|
"description": "<p>Allows table content to scroll horizontally</p>\n",
|
|
52273
|
-
"line":
|
|
52273
|
+
"line": 477,
|
|
52274
52274
|
"rawdescription": "\n\nAllows table content to scroll horizontally\n",
|
|
52275
52275
|
"decorators": [
|
|
52276
52276
|
{
|
|
@@ -52303,7 +52303,7 @@
|
|
|
52303
52303
|
"optional": false,
|
|
52304
52304
|
"returnType": "void",
|
|
52305
52305
|
"typeParameters": [],
|
|
52306
|
-
"line":
|
|
52306
|
+
"line": 810,
|
|
52307
52307
|
"deprecated": false,
|
|
52308
52308
|
"deprecationMessage": "",
|
|
52309
52309
|
"jsdoctags": [
|
|
@@ -52352,7 +52352,7 @@
|
|
|
52352
52352
|
"optional": false,
|
|
52353
52353
|
"returnType": "void",
|
|
52354
52354
|
"typeParameters": [],
|
|
52355
|
-
"line":
|
|
52355
|
+
"line": 815,
|
|
52356
52356
|
"deprecated": false,
|
|
52357
52357
|
"deprecationMessage": "",
|
|
52358
52358
|
"jsdoctags": [
|
|
@@ -52410,7 +52410,7 @@
|
|
|
52410
52410
|
"optional": false,
|
|
52411
52411
|
"returnType": "void",
|
|
52412
52412
|
"typeParameters": [],
|
|
52413
|
-
"line":
|
|
52413
|
+
"line": 820,
|
|
52414
52414
|
"deprecated": false,
|
|
52415
52415
|
"deprecationMessage": "",
|
|
52416
52416
|
"jsdoctags": [
|
|
@@ -52468,7 +52468,7 @@
|
|
|
52468
52468
|
"optional": false,
|
|
52469
52469
|
"returnType": "void",
|
|
52470
52470
|
"typeParameters": [],
|
|
52471
|
-
"line":
|
|
52471
|
+
"line": 824,
|
|
52472
52472
|
"deprecated": false,
|
|
52473
52473
|
"deprecationMessage": "",
|
|
52474
52474
|
"jsdoctags": [
|
|
@@ -52520,7 +52520,7 @@
|
|
|
52520
52520
|
"optional": false,
|
|
52521
52521
|
"returnType": "void",
|
|
52522
52522
|
"typeParameters": [],
|
|
52523
|
-
"line":
|
|
52523
|
+
"line": 804,
|
|
52524
52524
|
"deprecated": false,
|
|
52525
52525
|
"deprecationMessage": "",
|
|
52526
52526
|
"jsdoctags": [
|
|
@@ -52569,7 +52569,7 @@
|
|
|
52569
52569
|
"optional": false,
|
|
52570
52570
|
"returnType": "void",
|
|
52571
52571
|
"typeParameters": [],
|
|
52572
|
-
"line":
|
|
52572
|
+
"line": 832,
|
|
52573
52573
|
"deprecated": false,
|
|
52574
52574
|
"deprecationMessage": "",
|
|
52575
52575
|
"jsdoctags": [
|
|
@@ -52621,7 +52621,7 @@
|
|
|
52621
52621
|
"optional": false,
|
|
52622
52622
|
"returnType": "void",
|
|
52623
52623
|
"typeParameters": [],
|
|
52624
|
-
"line":
|
|
52624
|
+
"line": 785,
|
|
52625
52625
|
"deprecated": false,
|
|
52626
52626
|
"deprecationMessage": "",
|
|
52627
52627
|
"jsdoctags": [
|
|
@@ -52664,7 +52664,7 @@
|
|
|
52664
52664
|
"optional": false,
|
|
52665
52665
|
"returnType": "void",
|
|
52666
52666
|
"typeParameters": [],
|
|
52667
|
-
"line":
|
|
52667
|
+
"line": 780,
|
|
52668
52668
|
"deprecated": false,
|
|
52669
52669
|
"deprecationMessage": "",
|
|
52670
52670
|
"jsdoctags": [
|
|
@@ -52707,7 +52707,7 @@
|
|
|
52707
52707
|
"optional": false,
|
|
52708
52708
|
"returnType": "void",
|
|
52709
52709
|
"typeParameters": [],
|
|
52710
|
-
"line":
|
|
52710
|
+
"line": 767,
|
|
52711
52711
|
"deprecated": false,
|
|
52712
52712
|
"deprecationMessage": "",
|
|
52713
52713
|
"jsdoctags": [
|
|
@@ -52737,7 +52737,7 @@
|
|
|
52737
52737
|
"optional": false,
|
|
52738
52738
|
"returnType": "void",
|
|
52739
52739
|
"typeParameters": [],
|
|
52740
|
-
"line":
|
|
52740
|
+
"line": 695,
|
|
52741
52741
|
"deprecated": false,
|
|
52742
52742
|
"deprecationMessage": ""
|
|
52743
52743
|
},
|
|
@@ -52754,7 +52754,7 @@
|
|
|
52754
52754
|
"optional": false,
|
|
52755
52755
|
"returnType": "void",
|
|
52756
52756
|
"typeParameters": [],
|
|
52757
|
-
"line":
|
|
52757
|
+
"line": 843,
|
|
52758
52758
|
"deprecated": false,
|
|
52759
52759
|
"deprecationMessage": "",
|
|
52760
52760
|
"jsdoctags": [
|
|
@@ -52775,7 +52775,7 @@
|
|
|
52775
52775
|
"optional": false,
|
|
52776
52776
|
"returnType": "void",
|
|
52777
52777
|
"typeParameters": [],
|
|
52778
|
-
"line":
|
|
52778
|
+
"line": 665,
|
|
52779
52779
|
"deprecated": false,
|
|
52780
52780
|
"deprecationMessage": ""
|
|
52781
52781
|
},
|
|
@@ -52816,7 +52816,7 @@
|
|
|
52816
52816
|
"optional": false,
|
|
52817
52817
|
"returnType": "any",
|
|
52818
52818
|
"typeParameters": [],
|
|
52819
|
-
"line":
|
|
52819
|
+
"line": 879,
|
|
52820
52820
|
"deprecated": false,
|
|
52821
52821
|
"deprecationMessage": ""
|
|
52822
52822
|
},
|
|
@@ -52826,7 +52826,7 @@
|
|
|
52826
52826
|
"optional": false,
|
|
52827
52827
|
"returnType": "any",
|
|
52828
52828
|
"typeParameters": [],
|
|
52829
|
-
"line":
|
|
52829
|
+
"line": 883,
|
|
52830
52830
|
"deprecated": false,
|
|
52831
52831
|
"deprecationMessage": ""
|
|
52832
52832
|
},
|
|
@@ -52836,7 +52836,7 @@
|
|
|
52836
52836
|
"optional": false,
|
|
52837
52837
|
"returnType": "any",
|
|
52838
52838
|
"typeParameters": [],
|
|
52839
|
-
"line":
|
|
52839
|
+
"line": 887,
|
|
52840
52840
|
"deprecated": false,
|
|
52841
52841
|
"deprecationMessage": ""
|
|
52842
52842
|
},
|
|
@@ -52846,7 +52846,7 @@
|
|
|
52846
52846
|
"optional": false,
|
|
52847
52847
|
"returnType": "any",
|
|
52848
52848
|
"typeParameters": [],
|
|
52849
|
-
"line":
|
|
52849
|
+
"line": 869,
|
|
52850
52850
|
"deprecated": false,
|
|
52851
52851
|
"deprecationMessage": ""
|
|
52852
52852
|
},
|
|
@@ -52856,7 +52856,7 @@
|
|
|
52856
52856
|
"optional": false,
|
|
52857
52857
|
"returnType": "any",
|
|
52858
52858
|
"typeParameters": [],
|
|
52859
|
-
"line":
|
|
52859
|
+
"line": 895,
|
|
52860
52860
|
"deprecated": false,
|
|
52861
52861
|
"deprecationMessage": ""
|
|
52862
52862
|
},
|
|
@@ -52866,7 +52866,7 @@
|
|
|
52866
52866
|
"optional": false,
|
|
52867
52867
|
"returnType": "any",
|
|
52868
52868
|
"typeParameters": [],
|
|
52869
|
-
"line":
|
|
52869
|
+
"line": 891,
|
|
52870
52870
|
"deprecated": false,
|
|
52871
52871
|
"deprecationMessage": ""
|
|
52872
52872
|
},
|
|
@@ -52883,7 +52883,7 @@
|
|
|
52883
52883
|
"optional": false,
|
|
52884
52884
|
"returnType": "{ value: any; }",
|
|
52885
52885
|
"typeParameters": [],
|
|
52886
|
-
"line":
|
|
52886
|
+
"line": 862,
|
|
52887
52887
|
"deprecated": false,
|
|
52888
52888
|
"deprecationMessage": "",
|
|
52889
52889
|
"jsdoctags": [
|
|
@@ -52904,7 +52904,7 @@
|
|
|
52904
52904
|
"optional": false,
|
|
52905
52905
|
"returnType": "any",
|
|
52906
52906
|
"typeParameters": [],
|
|
52907
|
-
"line":
|
|
52907
|
+
"line": 875,
|
|
52908
52908
|
"deprecated": false,
|
|
52909
52909
|
"deprecationMessage": ""
|
|
52910
52910
|
},
|
|
@@ -52914,7 +52914,7 @@
|
|
|
52914
52914
|
"optional": false,
|
|
52915
52915
|
"returnType": "any",
|
|
52916
52916
|
"typeParameters": [],
|
|
52917
|
-
"line":
|
|
52917
|
+
"line": 872,
|
|
52918
52918
|
"deprecated": false,
|
|
52919
52919
|
"deprecationMessage": ""
|
|
52920
52920
|
},
|
|
@@ -52924,7 +52924,7 @@
|
|
|
52924
52924
|
"optional": false,
|
|
52925
52925
|
"returnType": "void",
|
|
52926
52926
|
"typeParameters": [],
|
|
52927
|
-
"line":
|
|
52927
|
+
"line": 711,
|
|
52928
52928
|
"deprecated": false,
|
|
52929
52929
|
"deprecationMessage": ""
|
|
52930
52930
|
},
|
|
@@ -52941,7 +52941,7 @@
|
|
|
52941
52941
|
"optional": false,
|
|
52942
52942
|
"returnType": "void",
|
|
52943
52943
|
"typeParameters": [],
|
|
52944
|
-
"line":
|
|
52944
|
+
"line": 730,
|
|
52945
52945
|
"deprecated": false,
|
|
52946
52946
|
"deprecationMessage": "",
|
|
52947
52947
|
"jsdoctags": [
|
|
@@ -52969,7 +52969,7 @@
|
|
|
52969
52969
|
"optional": false,
|
|
52970
52970
|
"returnType": "void",
|
|
52971
52971
|
"typeParameters": [],
|
|
52972
|
-
"line":
|
|
52972
|
+
"line": 794,
|
|
52973
52973
|
"deprecated": false,
|
|
52974
52974
|
"deprecationMessage": "",
|
|
52975
52975
|
"rawdescription": "\n\nTriggered when the user scrolls on the `<tbody>` element.\nEmits the `scrollLoad` event.\n",
|
|
@@ -52992,7 +52992,7 @@
|
|
|
52992
52992
|
"optional": false,
|
|
52993
52993
|
"returnType": "void",
|
|
52994
52994
|
"typeParameters": [],
|
|
52995
|
-
"line":
|
|
52995
|
+
"line": 706,
|
|
52996
52996
|
"deprecated": false,
|
|
52997
52997
|
"deprecationMessage": ""
|
|
52998
52998
|
},
|
|
@@ -53009,7 +53009,7 @@
|
|
|
53009
53009
|
"optional": false,
|
|
53010
53010
|
"returnType": "void",
|
|
53011
53011
|
"typeParameters": [],
|
|
53012
|
-
"line":
|
|
53012
|
+
"line": 716,
|
|
53013
53013
|
"deprecated": false,
|
|
53014
53014
|
"deprecationMessage": "",
|
|
53015
53015
|
"jsdoctags": [
|
|
@@ -53038,7 +53038,7 @@
|
|
|
53038
53038
|
"optional": false,
|
|
53039
53039
|
"returnType": "void",
|
|
53040
53040
|
"typeParameters": [],
|
|
53041
|
-
"line":
|
|
53041
|
+
"line": 750,
|
|
53042
53042
|
"deprecated": false,
|
|
53043
53043
|
"deprecationMessage": "",
|
|
53044
53044
|
"jsdoctags": [
|
|
@@ -53067,7 +53067,7 @@
|
|
|
53067
53067
|
"optional": false,
|
|
53068
53068
|
"returnType": "void",
|
|
53069
53069
|
"typeParameters": [],
|
|
53070
|
-
"line":
|
|
53070
|
+
"line": 857,
|
|
53071
53071
|
"deprecated": false,
|
|
53072
53072
|
"deprecationMessage": "",
|
|
53073
53073
|
"rawdescription": "\n\nTriggered when the user scrolls on the `<tbody>` element.\nEmits the `scrollLoad` event.\n",
|
|
@@ -53184,7 +53184,7 @@
|
|
|
53184
53184
|
"optional": false,
|
|
53185
53185
|
"returnType": "void",
|
|
53186
53186
|
"typeParameters": [],
|
|
53187
|
-
"line":
|
|
53187
|
+
"line": 734,
|
|
53188
53188
|
"deprecated": false,
|
|
53189
53189
|
"deprecationMessage": ""
|
|
53190
53190
|
}
|
|
@@ -53199,7 +53199,7 @@
|
|
|
53199
53199
|
"deprecationMessage": "",
|
|
53200
53200
|
"rawdescription": "\n\nAllows table content to scroll horizontally\n",
|
|
53201
53201
|
"description": "<p>Allows table content to scroll horizontally</p>\n",
|
|
53202
|
-
"line":
|
|
53202
|
+
"line": 477,
|
|
53203
53203
|
"type": "boolean",
|
|
53204
53204
|
"decorators": []
|
|
53205
53205
|
}
|
|
@@ -53210,7 +53210,7 @@
|
|
|
53210
53210
|
"description": "<p>Build your table with this component by extending things that differ from default.</p>\n<p><a href=\"../../?path=/story/components-table--basic\">See demo</a></p>\n<p>Instead of the usual write-your-own-html approach you had with <code><table></code>,\ncarbon table uses model-view-controller approach.</p>\n<p>Here, you create a view (with built-in controller) and provide it a model.\nChanges you make to the model are reflected in the view. Provide same model you use\nin the table to the <code><cds-pagination></code> components.\nThey provide a different view over the same data.</p>\n<h2>Basic usage</h2>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-table [model]="model"></cds-table></code></pre></div><div><pre class=\"line-numbers\"><code class=\"language-typescript\">public model = new TableModel();\n\nthis.model.data = [\n [new TableItem({data: "asdf"}), new TableItem({data: "qwer"})],\n [new TableItem({data: "csdf"}), new TableItem({data: "zwer"})],\n [new TableItem({data: "bsdf"}), new TableItem({data: "swer"})],\n [new TableItem({data: "csdf"}), new TableItem({data: "twer"})]\n];</code></pre></div><h2>Customization</h2>\n<p>If you have custom data in your table, you need a way to display it. You can do that\nby providing a template to <code>TableItem</code>.</p>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><ng-template #customTableItemTemplate let-data="data">\n <a [routerLink]="data.link">{{data.name}} {{data.surname}}</a>\n</ng-template></code></pre></div><div><pre class=\"line-numbers\"><code class=\"language-typescript\">customTableItemTemplate: TemplateRef<any>;\n\nthis.customModel.data = [\n [new TableItem({data: "asdf"}), new TableItem({data: {name: "Lessy", link: "/table"}, template: this.customTableItemTemplate})],\n [new TableItem({data: "csdf"}), new TableItem({data: "swer"})],\n [new TableItem({data: "bsdf"}), new TableItem({data: {name: "Alice", surname: "Bob"}, template: this.customTableItemTemplate})],\n [new TableItem({data: "csdf"}), new TableItem({data: "twer"})],\n];</code></pre></div><h3>Sorting and filtering</h3>\n<p>In case you need custom sorting and/or filtering you should subclass <code>TableHeaderItem</code>\nand override needed functions.</p>\n<div><pre class=\"line-numbers\"><code class=\"language-typescript\">class FilterableHeaderItem extends TableHeaderItem {\n // custom filter function\n filter(item: TableItem): boolean {\n if (typeof item.data === "string" && item.data.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n item.data.name && item.data.name.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n item.data.surname && item.data.surname.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0) {\n return false;\n }\n return true;\n }\n\n set filterCount(n) {}\n get filterCount() {\n return (this.filterData && this.filterData.data && this.filterData.data.length > 0) ? 1 : 0;\n }\n\n // used for custom sorting\n compare(one: TableItem, two: TableItem) {\n const stringOne = (one.data.name || one.data.surname || one.data).toLowerCase();\n const stringTwo = (two.data.name || two.data.surname || two.data).toLowerCase();\n\n if (stringOne > stringTwo) {\n return 1;\n } else if (stringOne < stringTwo) {\n return -1;\n } else {\n return 0;\n }\n }\n}</code></pre></div><p>If you want to do your sorting on the backend or query for sorted data as a result of user\nclicking the table header, check table <a href=\"#sort\"><code>sort</code></a> output documentation</p>\n<p>See <code>TableHeaderItem</code> class for more information.</p>\n<h2>No data template</h2>\n<p>When table has no data to show, it can show a message you provide it instead.</p>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-table [model]="model">No data.</cds-table></code></pre></div><p>... will show <code>No data.</code> message, but you can get creative and provide any template you want\nto replace table's default <code>tbody</code>.</p>\n<h2>Use pagination as table footer</h2>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-pagination [model]="model" (selectPage)="selectPage($event)"></cds-pagination></code></pre></div><p><code>selectPage()</code> function should fetch the data from backend, create new <code>data</code>, apply it to <code>model.data</code>,\nand update <code>model.currentPage</code>.</p>\n<p>If the data your server returns is a two dimensional array of objects, it would look something like this:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-typescript\">selectPage(page) {\n this.getPage(page).then((data: Array<Array<any>>) => {\n // set the data and update page\n this.model.data = this.prepareData(data);\n this.model.currentPage = page;\n });\n}\n\nprotected prepareData(data: Array<Array<any>>) {\n // create new data from the service data\n let newData = [];\n data.forEach(dataRow => {\n let row = [];\n dataRow.forEach(dataElement => {\n row.push(new TableItem({\n data: dataElement,\n template: typeof dataElement === "string" ? undefined : this.paginationTableItemTemplate\n // your template can handle all the data types so you don't have to conditionally set it\n // you can also set different templates for different columns based on index\n }));\n });\n newData.push(row);\n });\n return newData;\n}</code></pre></div>",
|
|
53211
53211
|
"rawdescription": "\n\nBuild your table with this component by extending things that differ from default.\n\n[See demo](../../?path=/story/components-table--basic)\n\nInstead of the usual write-your-own-html approach you had with `<table>`,\ncarbon table uses model-view-controller approach.\n\nHere, you create a view (with built-in controller) and provide it a model.\nChanges you make to the model are reflected in the view. Provide same model you use\nin the table to the `<cds-pagination>` components.\nThey provide a different view over the same data.\n\n## Basic usage\n\n```html\n<cds-table [model]=\"model\"></cds-table>\n```\n\n```typescript\npublic model = new TableModel();\n\nthis.model.data = [\n\t[new TableItem({data: \"asdf\"}), new TableItem({data: \"qwer\"})],\n\t[new TableItem({data: \"csdf\"}), new TableItem({data: \"zwer\"})],\n\t[new TableItem({data: \"bsdf\"}), new TableItem({data: \"swer\"})],\n\t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})]\n];\n```\n\n## Customization\n\nIf you have custom data in your table, you need a way to display it. You can do that\nby providing a template to `TableItem`.\n\n```html\n<ng-template #customTableItemTemplate let-data=\"data\">\n\t<a [routerLink]=\"data.link\">{{data.name}} {{data.surname}}</a>\n</ng-template>\n```\n\n```typescript\ncustomTableItemTemplate: TemplateRef<any>;\n\nthis.customModel.data = [\n\t[new TableItem({data: \"asdf\"}), new TableItem({data: {name: \"Lessy\", link: \"/table\"}, template: this.customTableItemTemplate})],\n\t[new TableItem({data: \"csdf\"}), new TableItem({data: \"swer\"})],\n\t[new TableItem({data: \"bsdf\"}), new TableItem({data: {name: \"Alice\", surname: \"Bob\"}, template: this.customTableItemTemplate})],\n\t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})],\n];\n```\n\n### Sorting and filtering\n\nIn case you need custom sorting and/or filtering you should subclass `TableHeaderItem`\nand override needed functions.\n\n```typescript\nclass FilterableHeaderItem extends TableHeaderItem {\n\t// custom filter function\n\tfilter(item: TableItem): boolean {\n\t\tif (typeof item.data === \"string\" && item.data.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n\t\titem.data.name && item.data.name.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n\t\titem.data.surname && item.data.surname.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tset filterCount(n) {}\n\tget filterCount() {\n\t\treturn (this.filterData && this.filterData.data && this.filterData.data.length > 0) ? 1 : 0;\n\t}\n\n\t// used for custom sorting\n\tcompare(one: TableItem, two: TableItem) {\n\t\tconst stringOne = (one.data.name || one.data.surname || one.data).toLowerCase();\n\t\tconst stringTwo = (two.data.name || two.data.surname || two.data).toLowerCase();\n\n\t\tif (stringOne > stringTwo) {\n\t\t\treturn 1;\n\t\t} else if (stringOne < stringTwo) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n```\n\nIf you want to do your sorting on the backend or query for sorted data as a result of user\nclicking the table header, check table [`sort`](#sort) output documentation\n\nSee `TableHeaderItem` class for more information.\n\n## No data template\n\nWhen table has no data to show, it can show a message you provide it instead.\n\n```html\n<cds-table [model]=\"model\">No data.</cds-table>\n```\n\n... will show `No data.` message, but you can get creative and provide any template you want\nto replace table's default `tbody`.\n\n## Use pagination as table footer\n\n```html\n<cds-pagination [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination>\n```\n\n`selectPage()` function should fetch the data from backend, create new `data`, apply it to `model.data`,\nand update `model.currentPage`.\n\nIf the data your server returns is a two dimensional array of objects, it would look something like this:\n\n```typescript\nselectPage(page) {\n\tthis.getPage(page).then((data: Array<Array<any>>) => {\n\t\t// set the data and update page\n\t\tthis.model.data = this.prepareData(data);\n\t\tthis.model.currentPage = page;\n\t});\n}\n\nprotected prepareData(data: Array<Array<any>>) {\n\t// create new data from the service data\n\tlet newData = [];\n\tdata.forEach(dataRow => {\n\t\tlet row = [];\n\t\tdataRow.forEach(dataElement => {\n\t\t\trow.push(new TableItem({\n\t\t\t\tdata: dataElement,\n\t\t\t\ttemplate: typeof dataElement === \"string\" ? undefined : this.paginationTableItemTemplate\n\t\t\t\t// your template can handle all the data types so you don't have to conditionally set it\n\t\t\t\t// you can also set different templates for different columns based on index\n\t\t\t}));\n\t\t});\n\t\tnewData.push(row);\n\t});\n\treturn newData;\n}\n```\n",
|
|
53212
53212
|
"type": "component",
|
|
53213
|
-
"sourceCode": "import {\n\tComponent,\n\tApplicationRef,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tAfterViewInit,\n\tTemplateRef,\n\tOnDestroy,\n\tHostBinding\n} from \"@angular/core\";\nimport { Subscription, fromEvent, Observable } from \"rxjs\";\n\nimport { TableModel } from \"./table-model.class\";\nimport { TableHeaderItem } from \"./table-header-item.class\";\nimport { TableItem } from \"./table-item.class\";\n\nimport { getFocusElementList, tabbableSelectorIgnoreTabIndex } from \"carbon-components-angular/common\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { DataGridInteractionModel } from \"./data-grid-interaction-model.class\";\nimport { TableDomAdapter } from \"./table-adapter.class\";\nimport { TableRowSize } from \"./table.types\";\n\n/**\n * Build your table with this component by extending things that differ from default.\n *\n * [See demo](../../?path=/story/components-table--basic)\n *\n * Instead of the usual write-your-own-html approach you had with `<table>`,\n * carbon table uses model-view-controller approach.\n *\n * Here, you create a view (with built-in controller) and provide it a model.\n * Changes you make to the model are reflected in the view. Provide same model you use\n * in the table to the `<cds-pagination>` components.\n * They provide a different view over the same data.\n *\n * ## Basic usage\n *\n * ```html\n * <cds-table [model]=\"model\"></cds-table>\n * ```\n *\n * ```typescript\n * public model = new TableModel();\n *\n * this.model.data = [\n * \t[new TableItem({data: \"asdf\"}), new TableItem({data: \"qwer\"})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"zwer\"})],\n * \t[new TableItem({data: \"bsdf\"}), new TableItem({data: \"swer\"})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})]\n * ];\n * ```\n *\n * ## Customization\n *\n * If you have custom data in your table, you need a way to display it. You can do that\n * by providing a template to `TableItem`.\n *\n * ```html\n * <ng-template #customTableItemTemplate let-data=\"data\">\n * \t<a [routerLink]=\"data.link\">{{data.name}} {{data.surname}}</a>\n * </ng-template>\n * ```\n *\n * ```typescript\n * customTableItemTemplate: TemplateRef<any>;\n *\n * this.customModel.data = [\n * \t[new TableItem({data: \"asdf\"}), new TableItem({data: {name: \"Lessy\", link: \"/table\"}, template: this.customTableItemTemplate})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"swer\"})],\n * \t[new TableItem({data: \"bsdf\"}), new TableItem({data: {name: \"Alice\", surname: \"Bob\"}, template: this.customTableItemTemplate})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})],\n * ];\n * ```\n *\n * ### Sorting and filtering\n *\n * In case you need custom sorting and/or filtering you should subclass `TableHeaderItem`\n * and override needed functions.\n *\n * ```typescript\n * class FilterableHeaderItem extends TableHeaderItem {\n * \t// custom filter function\n * \tfilter(item: TableItem): boolean {\n * \t\tif (typeof item.data === \"string\" && item.data.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n * \t\titem.data.name && item.data.name.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n * \t\titem.data.surname && item.data.surname.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0) {\n * \t\t\treturn false;\n * \t\t}\n * \t\treturn true;\n * \t}\n *\n * \tset filterCount(n) {}\n * \tget filterCount() {\n * \t\treturn (this.filterData && this.filterData.data && this.filterData.data.length > 0) ? 1 : 0;\n * \t}\n *\n * \t// used for custom sorting\n * \tcompare(one: TableItem, two: TableItem) {\n * \t\tconst stringOne = (one.data.name || one.data.surname || one.data).toLowerCase();\n * \t\tconst stringTwo = (two.data.name || two.data.surname || two.data).toLowerCase();\n *\n * \t\tif (stringOne > stringTwo) {\n * \t\t\treturn 1;\n * \t\t} else if (stringOne < stringTwo) {\n * \t\t\treturn -1;\n * \t\t} else {\n * \t\t\treturn 0;\n * \t\t}\n * \t}\n * }\n * ```\n *\n * If you want to do your sorting on the backend or query for sorted data as a result of user\n * clicking the table header, check table [`sort`](#sort) output documentation\n *\n * See `TableHeaderItem` class for more information.\n *\n * ## No data template\n *\n * When table has no data to show, it can show a message you provide it instead.\n *\n * ```html\n * <cds-table [model]=\"model\">No data.</cds-table>\n * ```\n *\n * ... will show `No data.` message, but you can get creative and provide any template you want\n * to replace table's default `tbody`.\n *\n * ## Use pagination as table footer\n *\n * ```html\n * <cds-pagination [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination>\n * ```\n *\n * `selectPage()` function should fetch the data from backend, create new `data`, apply it to `model.data`,\n * and update `model.currentPage`.\n *\n * If the data your server returns is a two dimensional array of objects, it would look something like this:\n *\n * ```typescript\n * selectPage(page) {\n * \tthis.getPage(page).then((data: Array<Array<any>>) => {\n * \t\t// set the data and update page\n * \t\tthis.model.data = this.prepareData(data);\n * \t\tthis.model.currentPage = page;\n * \t});\n * }\n *\n * protected prepareData(data: Array<Array<any>>) {\n * \t// create new data from the service data\n * \tlet newData = [];\n * \tdata.forEach(dataRow => {\n * \t\tlet row = [];\n * \t\tdataRow.forEach(dataElement => {\n * \t\t\trow.push(new TableItem({\n * \t\t\t\tdata: dataElement,\n * \t\t\t\ttemplate: typeof dataElement === \"string\" ? undefined : this.paginationTableItemTemplate\n * \t\t\t\t// your template can handle all the data types so you don't have to conditionally set it\n * \t\t\t\t// you can also set different templates for different columns based on index\n * \t\t\t}));\n * \t\t});\n * \t\tnewData.push(row);\n * \t});\n * \treturn newData;\n * }\n * ```\n */\n@Component({\n\tselector: \"cds-table, ibm-table\",\n\ttemplate: `\n\t<table\n\t\tcdsTable\n\t\t[sortable]=\"sortable\"\n\t\t[noBorder]=\"noBorder\"\n\t\t[ngClass]=\"{'cds--data-table--sticky-header': stickyHeader}\"\n\t\t[size]=\"size\"\n\t\t[striped]=\"striped\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t\t[attr.aria-describedby]=\"ariaDescribedby\">\n\t\t<thead\n\t\t\tcdsTableHead\n\t\t\t[sortable]=\"sortable\"\n\t\t\t(deselectAll)=\"onDeselectAll()\"\n\t\t\t(selectAll)=\"onSelectAll()\"\n\t\t\t(sort)=\"doSort($event)\"\n\t\t\t[checkboxHeaderLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t\t[model]=\"model\"\n\t\t\t[selectAllCheckbox]=\"selectAllCheckbox\"\n\t\t\t[selectAllCheckboxSomeSelected]=\"selectAllCheckboxSomeSelected\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[sortAscendingLabel]=\"sortAscendingLabel\"\n\t\t\t[sortDescendingLabel]=\"sortDescendingLabel\"\n\t\t\t[stickyHeader]=\"stickyHeader\">\n\t\t</thead>\n\t\t<tbody\n\t\t\tcdsTableBody\n\t\t\t(deselectRow)=\"onSelectRow($event)\"\n\t\t\t(scroll)=\"onScroll($event)\"\n\t\t\t(selectRow)=\"onSelectRow($event)\"\n\t\t\t[checkboxRowLabel]=\"getCheckboxRowLabel()\"\n\t\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t\t(rowClick)=\"onRowClick($event)\"\n\t\t\t[expandButtonAriaLabel]=\"expandButtonAriaLabel\"\n\t\t\t[model]=\"model\"\n\t\t\t[size]=\"size\"\n\t\t\t[ngStyle]=\"{'overflow-y': 'scroll'}\"\n\t\t\t[selectionLabelColumn]=\"selectionLabelColumn\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t*ngIf=\"!noData; else noDataTemplate\">\n\t\t</tbody>\n\t\t<ng-template #noDataTemplate><ng-content></ng-content></ng-template>\n\t\t<tfoot>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"footerTemplate\">\n\t\t\t</ng-template>\n\t\t\t<tr *ngIf=\"this.model.isLoading\">\n\t\t\t\t<td class=\"table_loading-indicator\">\n\t\t\t\t\t<div class=\"cds--loading cds--loading--small\">\n\t\t\t\t\t\t<svg class=\"cds--loading__svg\" viewBox=\"-75 -75 150 150\">\n\t\t\t\t\t\t\t<circle class=\"cds--loading__stroke\" cx=\"0\" cy=\"0\" r=\"37.5\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr *ngIf=\"this.model.isEnd\">\n\t\t\t\t<td class=\"table_end-indicator\">\n\t\t\t\t\t<h5>{{getEndOfDataText() | async}}</h5>\n\t\t\t\t\t<button (click)=\"scrollToTop($event)\" class=\"btn--secondary-sm\">\n\t\t\t\t\t\t{{getScrollTopText() | async}}\n\t\t\t\t\t</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tfoot>\n\t</table>\n\t`,\n\tstyles: [`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t`]\n})\nexport class Table implements AfterViewInit, OnDestroy {\n\t/**\n\t * Creates a skeleton model with a row and column count specified by the user\n\t *\n\t * Example:\n\t *\n\t * ```typescript\n\t * this.model = Table.skeletonModel(5, 5);\n\t * ```\n\t */\n\tstatic skeletonModel(rowCount: number, columnCount: number) {\n\t\tconst model = new TableModel();\n\t\tlet header = new Array<TableHeaderItem>();\n\t\tlet data = new Array<Array<TableItem>>();\n\t\tlet row = new Array<TableItem>();\n\n\t\tfor (let i = 0; i < columnCount; i++) {\n\t\t\theader.push(new TableHeaderItem());\n\t\t\trow.push(new TableItem());\n\t\t}\n\t\tfor (let i = 0; i < rowCount - 1; i++) {\n\t\t\tdata.push(row);\n\t\t}\n\n\t\tmodel.header = header;\n\t\tmodel.data = data;\n\t\treturn model;\n\t}\n\n\tstatic setTabIndex(element: HTMLElement, index: -1 | 0) {\n\t\tconst focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);\n\t\tif (element.firstElementChild && element.firstElementChild.classList.contains(\"cds--table-sort\") && focusElementList.length > 1) {\n\t\t\tfocusElementList[1].tabIndex = index;\n\t\t} else if (focusElementList.length > 0) {\n\t\t\tfocusElementList[0].tabIndex = index;\n\t\t} else {\n\t\t\telement.tabIndex = index;\n\t\t}\n\t}\n\n\tstatic focus(element: HTMLElement) {\n\t\tconst focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);\n\t\tif (element.firstElementChild && element.firstElementChild.classList.contains(\"cds--table-sort\") && focusElementList.length > 1) {\n\t\t\tfocusElementList[1].focus();\n\t\t} else if (focusElementList.length > 0) {\n\t\t\tfocusElementList[0].focus();\n\t\t} else {\n\t\t\telement.focus();\n\t\t}\n\t}\n\n\t/**\n\t * Id of the table header title element\n\t */\n\t@Input() ariaLabelledby: string;\n\t/**\n\t * Id of the table header description element\n\t */\n\t@Input() ariaDescribedby: string;\n\n\t/**\n\t * `TableModel` with data the table is to display.\n\t */\n\t@Input()\n\tset model(m: TableModel) {\n\t\tif (this._model) {\n\t\t\tthis.subscriptions.unsubscribe();\n\t\t\t// Need to create a new subscription instance here because unsubscribing prevents any new subscriptions\n\t\t\t// from being added for some reason. When a new model is set, none of the subscriptions would exist.\n\t\t\tthis.subscriptions = new Subscription();\n\t\t}\n\n\t\tthis._model = m;\n\n\t\tconst rowsChange = this._model.rowsSelectedChange.subscribe(() => this.updateSelectAllCheckbox());\n\t\tconst dataChange = this._model.dataChange.subscribe(() => {\n\t\t\tif (this.isDataGrid) {\n\t\t\t\tthis.resetTabIndex();\n\t\t\t}\n\t\t\tthis.updateSelectAllCheckbox();\n\t\t});\n\n\t\tthis.subscriptions.add(rowsChange);\n\t\tthis.subscriptions.add(dataChange);\n\n\t\tif (this.isDataGrid) {\n\t\t\tconst expandedChange = this._model.rowsExpandedChange.subscribe(() => {\n\t\t\t\t// Allows the expanded row to have a focus state when it exists in the DOM\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst expandedRows = this.elementRef.nativeElement.querySelectorAll(\".cds--expandable-row:not(.cds--parent-row)\");\n\t\t\t\t\tArray.from<any>(expandedRows).forEach(row => {\n\t\t\t\t\t\tif (row.firstElementChild.tabIndex === undefined || row.firstElementChild.tabIndex !== -1) {\n\t\t\t\t\t\t\trow.firstElementChild.tabIndex = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.subscriptions.add(expandedChange);\n\t\t}\n\t}\n\n\tget model(): TableModel {\n\t\treturn this._model;\n\t}\n\n\t/**\n\t * Size of the table rows.\n\t */\n\t@Input() size: TableRowSize = \"md\";\n\t/**\n\t * Set to `true` for a loading table.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for a data grid with keyboard interactions.\n\t */\n\t@Input() set isDataGrid(value: boolean) {\n\t\tthis._isDataGrid = value;\n\t\tif (this.isViewReady) {\n\t\t\tif (value) {\n\t\t\t\tthis.enableDataGridInteractions();\n\t\t\t} else {\n\t\t\t\tthis.disableDataGridInteractions();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setting sortable to false will disable all headers including headers which are sortable. Is is\n\t * possible to set the sortable state on the header item to disable/enable sorting for only some headers.\n\t */\n\t@Input() sortable = true;\n\n\t@Input() noBorder = true;\n\n\tget isDataGrid(): boolean {\n\t\treturn this._isDataGrid;\n\t}\n\n\t/**\n\t * Controls whether to show the selection checkboxes column or not.\n\t */\n\t@Input() showSelectionColumn = true;\n\n\t/**\n\t * Controls whether to enable multiple or single row selection.\n\t */\n\t@Input() enableSingleSelect = false;\n\n\t/**\n\t * Distance (in px) from the bottom that view has to reach before\n\t * `scrollLoad` event is emitted.\n\t */\n\t@Input() scrollLoadDistance = 0;\n\n\t/**\n\t * @todo - Enable column resize when Carbon officially supports feature\n\t * Set to `true` to enable users to resize columns.\n\t *\n\t * Works for columns with width set in pixels.\n\t *\n\t */\n\t// @Input() columnsResizable = false;\n\n\t/**\n\t * @todo - Enable columns drag & drop when Carbon officially supports feature\n\t * Set to `true` to enable users to drag and drop columns.\n\t *\n\t * Changing the column order in table changes table model. Be aware of it when you add additional data\n\t * to the model.\n\t *\n\t */\n\t// @Input() columnsDraggable = false;\n\n\t@Input()\n\tset expandButtonAriaLabel(value: string | Observable<string>) {\n\t\tthis._expandButtonAriaLabel.override(value);\n\t}\n\tget expandButtonAriaLabel() {\n\t\treturn this._expandButtonAriaLabel.value;\n\t}\n\t@Input()\n\tset sortDescendingLabel(value: string | Observable<string>) {\n\t\tthis._sortDescendingLabel.override(value);\n\t}\n\tget sortDescendingLabel() {\n\t\treturn this._sortDescendingLabel.value;\n\t}\n\t@Input()\n\tset sortAscendingLabel(value: string | Observable<string>) {\n\t\tthis._sortAscendingLabel.override(value);\n\t}\n\tget sortAscendingLabel() {\n\t\treturn this._sortAscendingLabel.value;\n\t}\n\n\t/**\n\t * Expects an object that contains some or all of:\n\t * ```\n\t * {\n\t *\t\t\"FILTER\": \"Filter\",\n\t *\t\t\"END_OF_DATA\": \"You've reached the end of your content\",\n\t *\t\t\"SCROLL_TOP\": \"Scroll to top\",\n\t *\t\t\"CHECKBOX_HEADER\": \"Select all rows\",\n\t *\t\t\"CHECKBOX_ROW\": \"Select row\"\n\t * }\n\t * ```\n\t */\n\t@Input()\n\tset translations(value) {\n\t\tconst valueWithDefaults = merge(this.i18n.getMultiple(\"TABLE\"), value);\n\t\tthis._filterTitle.override(valueWithDefaults.FILTER);\n\t\tthis._endOfDataText.override(valueWithDefaults.END_OF_DATA);\n\t\tthis._scrollTopText.override(valueWithDefaults.SCROLL_TOP);\n\t\tthis._checkboxHeaderLabel.override(valueWithDefaults.CHECKBOX_HEADER);\n\t\tthis._checkboxRowLabel.override(valueWithDefaults.CHECKBOX_ROW);\n\t}\n\n\t/**\n\t * Set to `false` to remove table rows (zebra) stripes.\n\t */\n\t@Input() striped = true;\n\n\t/**\n\t * Allows table content to scroll horizontally\n\t */\n\t@HostBinding(\"class.cds--data-table-content\") tableContent = true;\n\n\t/**\n\t * Set to `true` to stick the header to the top of the table\n\t */\n\t@HostBinding(\"class.cds--data-table_inner-container\") @Input() stickyHeader = false;\n\n\t/**\n\t * Set footer template to customize what is displayed in the tfoot section of the table\n\t */\n\t@Input() footerTemplate: TemplateRef<any>;\n\n\t/**\n\t * Used to populate the row selection checkbox label with a useful value if set.\n\t *\n\t * Example:\n\t * ```\n\t * <cds-table [selectionLabelColumn]=\"0\"></cds-table>\n\t * <!-- results in aria-label=\"Select first column value\"\n\t * (where \"first column value\" is the value of the first column in the row -->\n\t * ```\n\t */\n\t@Input() selectionLabelColumn: number;\n\n\t/**\n\t * Emits an index of the column that wants to be sorted.\n\t *\n\t * If no observers are provided (default), table will attempt to do a simple sort of the data loaded\n\t * into the model.\n\t *\n\t * If an observer is provided, table will not attempt any sorting of its own and it is up to the observer\n\t * to sort the table. This is what you typically want if you're using a backend query to get the sorted\n\t * data or want to sort data across multiple pages.\n\t *\n\t * Usage:\n\t *\n\t * ```typescript\n\t * @Component({\n\t * \tselector: \"app-table\",\n\t * \ttemplate: `\n\t * \t\t<cds-table\n\t * \t\t\t[model]=\"model\"\n\t * \t\t\t(sort)=\"simpleSort($event)\">\n\t * \t\t\tNo data.\n\t * \t\t</cds-table>\n\t * \t`\n\t * })\n\t * export class TableApp implements OnInit, OnChanges {\n\t * \t@Input() model = new TableModel();\n\t *\n\t * \tngOnInit() {\n\t * \t\tthis.model.header = [\n\t * \t\t\tnew TableHeaderItem({ data: \"Name\" }),\n\t * \t\t\tnew TableHeaderItem({ data: \"hwer\" })\n\t * \t\t];\n\t *\n\t * \t\tthis.model.data = [\n\t * \t\t\t[new TableItem({ data: \"Name 1\" }), new TableItem({ data: \"qwer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 3\" }), new TableItem({ data: \"zwer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 2\" }), new TableItem({ data: \"swer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 4\" }), new TableItem({data: \"twer\"})],\n\t * \t\t\t[new TableItem({ data: \"Name 5\" }), new TableItem({data: \"twer\"})],\n\t * \t\t\t[new TableItem({ data: \"Name 6\" }), new TableItem({data: \"twer\"})]\n\t * \t\t];\n\t * \t}\n\t *\n\t * \tsimpleSort(index: number) {\n\t * \t\t// this function does a simple sort, which is the default for the table and if that's\n\t * \t\t// all you want, you don't need to do this.\n\t *\n\t * \t\t// here you can query your backend and update the model.data based on the result\n\t * \t\tif (this.model.header[index].sorted) {\n\t * \t\t\t// if already sorted flip sorting direction\n\t * \t\t\tthis.model.header[index].ascending = this.model.header[index].descending;\n\t * \t\t}\n\t * \t\tthis.model.sort(index);\n\t * \t}\n\t * }\n\t * ```\n\t */\n\t@Output() sort = new EventEmitter<number>();\n\n\t/**\n\t * Emits if all rows are selected.\n\t *\n\t * @param model\n\t */\n\t@Output() selectAll = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if all rows are deselected.\n\t *\n\t * @param model\n\t */\n\t@Output() deselectAll = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a single row is selected.\n\t *\n\t * @param ({model: this.model, selectedRowIndex: index})\n\t */\n\t@Output() selectRow = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a single row is deselected.\n\t *\n\t * @param ({model: this.model, deselectedRowIndex: index})\n\t */\n\t@Output() deselectRow = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a row item excluding expandButtons, checkboxes, or radios is clicked.\n\t */\n\t@Output() rowClick = new EventEmitter<number>();\n\n\t/**\n\t * Emits when table requires more data to be loaded.\n\t */\n\t@Output() scrollLoad = new EventEmitter<TableModel>();\n\n\t/**\n\t * Controls if all checkboxes are viewed as selected.\n\t */\n\tselectAllCheckbox = false;\n\n\t/**\n\t * Controls the indeterminate state of the header checkbox.\n\t */\n\tselectAllCheckboxSomeSelected = false;\n\n\tget noData() {\n\t\treturn !this.model.data ||\n\t\t\tthis.model.data.length === 0 ||\n\t\t\tthis.model.data.length === 1 && this.model.data[0].length === 0;\n\t}\n\n\tpublic isColumnDragging = false;\n\tpublic columnDraggedHoverIndex = -1;\n\tpublic columnDraggedPosition = \"\";\n\n\tprotected _model: TableModel;\n\tprotected _isDataGrid = false;\n\t// flag to prevent getters/setters from querying the view before it's fully instantiated\n\tprotected isViewReady = false;\n\n\tprotected subscriptions = new Subscription();\n\tprotected positionSubscription: Subscription;\n\n\tprotected interactionModel: DataGridInteractionModel;\n\tprotected interactionPositionSubscription: Subscription;\n\n\tprotected _expandButtonAriaLabel = this.i18n.getOverridable(\"TABLE.EXPAND_BUTTON\");\n\tprotected _sortDescendingLabel = this.i18n.getOverridable(\"TABLE.SORT_DESCENDING\");\n\tprotected _sortAscendingLabel = this.i18n.getOverridable(\"TABLE.SORT_ASCENDING\");\n\tprotected _checkboxHeaderLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_HEADER\");\n\tprotected _checkboxRowLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_ROW\");\n\tprotected _endOfDataText = this.i18n.getOverridable(\"TABLE.END_OF_DATA\");\n\tprotected _scrollTopText = this.i18n.getOverridable(\"TABLE.SCROLL_TOP\");\n\tprotected _filterTitle = this.i18n.getOverridable(\"TABLE.FILTER\");\n\n\tprotected columnResizeWidth: number;\n\tprotected columnResizeMouseX: number;\n\tprotected mouseMoveSubscription: Subscription;\n\tprotected mouseUpSubscription: Subscription;\n\n\t/**\n\t * Creates an instance of Table.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected applicationRef: ApplicationRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngAfterViewInit() {\n\t\tthis.isViewReady = true;\n\t\tif (this.isDataGrid) {\n\t\t\tthis.enableDataGridInteractions();\n\t\t}\n\t}\n\n\tngOnDestroy() {\n\t\tthis.subscriptions.unsubscribe();\n\t\tif (this.positionSubscription) {\n\t\t\tthis.positionSubscription.unsubscribe();\n\t\t}\n\t}\n\n\tenableDataGridInteractions() {\n\t\t// if we have an `interactioModel` we've already enabled datagrid\n\t\tif (this.interactionModel) {\n\t\t\treturn;\n\t\t}\n\t\tconst table = this.elementRef.nativeElement.querySelector(\"table\") as HTMLTableElement;\n\t\tconst tableAdapter = new TableDomAdapter(table);\n\t\tconst keydownEventStream = fromEvent<KeyboardEvent>(table, \"keydown\");\n\t\tconst clickEventStream = fromEvent<MouseEvent>(table, \"click\");\n\t\tthis.interactionModel = new DataGridInteractionModel(keydownEventStream, clickEventStream, tableAdapter);\n\t\tthis.positionSubscription = this.interactionModel.position.subscribe(event => {\n\t\t\tconst [currentRow, currentColumn] = event.current;\n\t\t\tconst [previousRow, previousColumn] = event.previous;\n\n\t\t\tconst currentElement = tableAdapter.getCell(currentRow, currentColumn);\n\t\t\tTable.setTabIndex(currentElement, 0);\n\n\t\t\t// if the model has just initialized don't focus or reset anything\n\t\t\tif (previousRow === -1 || previousColumn === -1) { return; }\n\t\t\t// Make the previous cell unfocusable (if it's not the current)\n\t\t\tif (previousRow !== currentRow || previousColumn !== currentColumn) {\n\t\t\t\tconst previousElement = tableAdapter.getCell(previousRow, previousColumn);\n\t\t\t\tTable.setTabIndex(previousElement, -1);\n\t\t\t}\n\t\t\tTable.focus(currentElement);\n\t\t});\n\t\t// call this after assigning `this.interactionModel` since it depends on it\n\t\tthis.resetTabIndex();\n\t}\n\n\tdisableDataGridInteractions() {\n\t\t// unsubscribe first so we don't cause the focus to fly around\n\t\tif (this.positionSubscription) {\n\t\t\tthis.positionSubscription.unsubscribe();\n\t\t}\n\t\t// undo tab indexing (also resets the model)\n\t\tthis.resetTabIndex(0);\n\t\t// null out the model ref\n\t\tthis.interactionModel = null;\n\t}\n\n\tonSelectAll() {\n\t\tthis.model.selectAll(true);\n\t\tthis.selectAll.emit(this.model);\n\t}\n\n\tonDeselectAll() {\n\t\tthis.model.selectAll(false);\n\t\tthis.deselectAll.emit(this.model);\n\t}\n\n\tonSelectRow(event) {\n\t\t// check for the existence of the selectedRowIndex property\n\t\tif (Object.keys(event).includes(\"selectedRowIndex\")) {\n\t\t\tif (this.enableSingleSelect) {\n\t\t\t\tthis.model.selectAll(false);\n\t\t\t}\n\t\t\tthis.model.selectRow(event.selectedRowIndex, true);\n\t\t\tthis.selectRow.emit(event);\n\t\t} else {\n\t\t\tthis.model.selectRow(event.deselectedRowIndex, false);\n\t\t\tthis.deselectRow.emit(event);\n\t\t}\n\t}\n\n\tonRowClick(index: number) {\n\t\tthis.rowClick.emit(index);\n\t}\n\n\tupdateSelectAllCheckbox() {\n\t\tconst selectedRowsCount = this.model.selectedRowsCount();\n\n\t\tif (selectedRowsCount <= 0) {\n\t\t\t// reset select all checkbox if nothing selected\n\t\t\tthis.selectAllCheckbox = false;\n\t\t\tthis.selectAllCheckboxSomeSelected = false;\n\t\t} else if (selectedRowsCount < this.model.data.length) {\n\t\t\tthis.selectAllCheckbox = true;\n\t\t\tthis.selectAllCheckboxSomeSelected = true;\n\t\t} else {\n\t\t\tthis.selectAllCheckbox = true;\n\t\t\tthis.selectAllCheckboxSomeSelected = false;\n\t\t}\n\t}\n\n\tresetTabIndex(newTabIndex = -1) {\n\t\t// ensure the view is ready for the reset before we preform the actual reset\n\t\tsetTimeout(() => {\n\t\t\t// reset all the tabIndexes we can find\n\t\t\tconst focusElementList = getFocusElementList(this.elementRef.nativeElement, tabbableSelectorIgnoreTabIndex);\n\t\t\tif (focusElementList) {\n\t\t\t\tfocusElementList.forEach(tabbable => {\n\t\t\t\t\ttabbable.tabIndex = newTabIndex;\n\t\t\t\t});\n\t\t\t}\n\t\t\t// reset interaction model positions and tabIndexes\n\t\t\tif (this.interactionModel) {\n\t\t\t\tthis.interactionModel.resetTabIndexes(newTabIndex);\n\t\t\t}\n\t\t});\n\t}\n\n\tcolumnResizeStart(event, column) {\n\t\tthis.columnResizeWidth = parseInt(column.style.width, 10);\n\t\tthis.columnResizeMouseX = event.clientX;\n\t\tevent.preventDefault();\n\n\t\tthis.mouseMoveSubscription = fromEvent(document.body, \"mousemove\").subscribe(event => {\n\t\t\tthis.columnResizeProgress(event, column);\n\t\t});\n\t\tthis.mouseUpSubscription = fromEvent(document.body, \"mouseup\").subscribe(event => {\n\t\t\tthis.columnResizeEnd(event, column);\n\t\t});\n\t}\n\n\tcolumnResizeProgress(event, column) {\n\t\tconst move = event.clientX - this.columnResizeMouseX;\n\t\tcolumn.style.width = `${this.columnResizeWidth + move}px`;\n\t}\n\n\tcolumnResizeEnd(event, column) {\n\t\tthis.mouseMoveSubscription.unsubscribe();\n\t\tthis.mouseUpSubscription.unsubscribe();\n\t}\n\n\t/**\n\t * Triggered when the user scrolls on the `<tbody>` element.\n\t * Emits the `scrollLoad` event.\n\t */\n\tonScroll(event) {\n\t\tconst distanceFromBottom = event.target.scrollHeight - event.target.clientHeight - event.target.scrollTop;\n\n\t\tif (distanceFromBottom <= this.scrollLoadDistance) {\n\t\t\tthis.scrollLoad.emit(this.model);\n\t\t} else {\n\t\t\tthis.model.isEnd = false;\n\t\t}\n\t}\n\n\tcolumnDragStart(event, columnIndex) {\n\t\tthis.isColumnDragging = true;\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t\tevent.dataTransfer.setData(\"columnIndex\", JSON.stringify(columnIndex));\n\t}\n\n\tcolumnDragEnd(event, columnIndex) {\n\t\tthis.isColumnDragging = false;\n\t\tthis.columnDraggedHoverIndex = -1;\n\t}\n\n\tcolumnDragEnter(event, position, columnIndex) {\n\t\tthis.columnDraggedPosition = position;\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t}\n\n\tcolumnDragLeave(event, position, columnIndex) {\n\t\tthis.columnDraggedPosition = \"\";\n\t}\n\n\tcolumnDragover(event, position, columnIndex) {\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t\tthis.columnDraggedPosition = position;\n\n\t\t// needed to tell browser to allow dropping\n\t\tevent.preventDefault();\n\t}\n\n\tcolumnDrop(event, position, columnIndex) {\n\t\tthis.isColumnDragging = false;\n\t\tthis.columnDraggedHoverIndex = -1;\n\t\tthis.columnDraggedPosition = \"\";\n\n\t\tthis.model.moveColumn(\n\t\t\tparseInt(event.dataTransfer.getData(\"columnIndex\"), 10),\n\t\t\tcolumnIndex + (position === \"right\" ? 1 : 0)\n\t\t);\n\t}\n\n\tdoSort(index: number) {\n\t\tif (this.sort.observers.length === 0) {\n\t\t\t// no sort provided so do the simple sort\n\t\t\tthis.model.cycleSortState(index);\n\t\t\tthis.model.sort(index);\n\t\t}\n\n\t\tthis.sort.emit(index);\n\t}\n\n\t/**\n\t * Triggered when the user scrolls on the `<tbody>` element.\n\t * Emits the `scrollLoad` event.\n\t */\n\tscrollToTop(event) {\n\t\tevent.target.parentElement.parentElement.parentElement.parentElement.children[1].scrollTop = 0;\n\t\tthis.model.isEnd = false;\n\t}\n\n\tgetSelectionLabelValue(row: TableItem[]) {\n\t\tif (!this.selectionLabelColumn) {\n\t\t\treturn { value: this.i18n.get().TABLE.ROW };\n\t\t}\n\t\treturn { value: row[this.selectionLabelColumn].data };\n\t}\n\n\tgetExpandButtonAriaLabel() {\n\t\treturn this._expandButtonAriaLabel.subject;\n\t}\n\tgetSortDescendingLabel() {\n\t\treturn this._sortDescendingLabel.subject;\n\t}\n\tgetSortAscendingLabel() {\n\t\treturn this._sortAscendingLabel.subject;\n\t}\n\n\tgetCheckboxHeaderLabel() {\n\t\treturn this._checkboxHeaderLabel.subject;\n\t}\n\n\tgetCheckboxRowLabel() {\n\t\treturn this._checkboxRowLabel.subject;\n\t}\n\n\tgetEndOfDataText() {\n\t\treturn this._endOfDataText.subject;\n\t}\n\n\tgetScrollTopText() {\n\t\treturn this._scrollTopText.subject;\n\t}\n\n\tgetFilterTitle() {\n\t\treturn this._filterTitle.subject;\n\t}\n}\n",
|
|
53213
|
+
"sourceCode": "import {\n\tComponent,\n\tApplicationRef,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tAfterViewInit,\n\tTemplateRef,\n\tOnDestroy,\n\tHostBinding\n} from \"@angular/core\";\nimport { Subscription, fromEvent, Observable } from \"rxjs\";\n\nimport { TableModel } from \"./table-model.class\";\nimport { TableHeaderItem } from \"./table-header-item.class\";\nimport { TableItem } from \"./table-item.class\";\n\nimport { getFocusElementList, tabbableSelectorIgnoreTabIndex } from \"carbon-components-angular/common\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { DataGridInteractionModel } from \"./data-grid-interaction-model.class\";\nimport { TableDomAdapter } from \"./table-adapter.class\";\nimport { TableRowSize } from \"./table.types\";\n\n/**\n * Build your table with this component by extending things that differ from default.\n *\n * [See demo](../../?path=/story/components-table--basic)\n *\n * Instead of the usual write-your-own-html approach you had with `<table>`,\n * carbon table uses model-view-controller approach.\n *\n * Here, you create a view (with built-in controller) and provide it a model.\n * Changes you make to the model are reflected in the view. Provide same model you use\n * in the table to the `<cds-pagination>` components.\n * They provide a different view over the same data.\n *\n * ## Basic usage\n *\n * ```html\n * <cds-table [model]=\"model\"></cds-table>\n * ```\n *\n * ```typescript\n * public model = new TableModel();\n *\n * this.model.data = [\n * \t[new TableItem({data: \"asdf\"}), new TableItem({data: \"qwer\"})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"zwer\"})],\n * \t[new TableItem({data: \"bsdf\"}), new TableItem({data: \"swer\"})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})]\n * ];\n * ```\n *\n * ## Customization\n *\n * If you have custom data in your table, you need a way to display it. You can do that\n * by providing a template to `TableItem`.\n *\n * ```html\n * <ng-template #customTableItemTemplate let-data=\"data\">\n * \t<a [routerLink]=\"data.link\">{{data.name}} {{data.surname}}</a>\n * </ng-template>\n * ```\n *\n * ```typescript\n * customTableItemTemplate: TemplateRef<any>;\n *\n * this.customModel.data = [\n * \t[new TableItem({data: \"asdf\"}), new TableItem({data: {name: \"Lessy\", link: \"/table\"}, template: this.customTableItemTemplate})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"swer\"})],\n * \t[new TableItem({data: \"bsdf\"}), new TableItem({data: {name: \"Alice\", surname: \"Bob\"}, template: this.customTableItemTemplate})],\n * \t[new TableItem({data: \"csdf\"}), new TableItem({data: \"twer\"})],\n * ];\n * ```\n *\n * ### Sorting and filtering\n *\n * In case you need custom sorting and/or filtering you should subclass `TableHeaderItem`\n * and override needed functions.\n *\n * ```typescript\n * class FilterableHeaderItem extends TableHeaderItem {\n * \t// custom filter function\n * \tfilter(item: TableItem): boolean {\n * \t\tif (typeof item.data === \"string\" && item.data.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n * \t\titem.data.name && item.data.name.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0 ||\n * \t\titem.data.surname && item.data.surname.toLowerCase().indexOf(this.filterData.data.toLowerCase()) >= 0) {\n * \t\t\treturn false;\n * \t\t}\n * \t\treturn true;\n * \t}\n *\n * \tset filterCount(n) {}\n * \tget filterCount() {\n * \t\treturn (this.filterData && this.filterData.data && this.filterData.data.length > 0) ? 1 : 0;\n * \t}\n *\n * \t// used for custom sorting\n * \tcompare(one: TableItem, two: TableItem) {\n * \t\tconst stringOne = (one.data.name || one.data.surname || one.data).toLowerCase();\n * \t\tconst stringTwo = (two.data.name || two.data.surname || two.data).toLowerCase();\n *\n * \t\tif (stringOne > stringTwo) {\n * \t\t\treturn 1;\n * \t\t} else if (stringOne < stringTwo) {\n * \t\t\treturn -1;\n * \t\t} else {\n * \t\t\treturn 0;\n * \t\t}\n * \t}\n * }\n * ```\n *\n * If you want to do your sorting on the backend or query for sorted data as a result of user\n * clicking the table header, check table [`sort`](#sort) output documentation\n *\n * See `TableHeaderItem` class for more information.\n *\n * ## No data template\n *\n * When table has no data to show, it can show a message you provide it instead.\n *\n * ```html\n * <cds-table [model]=\"model\">No data.</cds-table>\n * ```\n *\n * ... will show `No data.` message, but you can get creative and provide any template you want\n * to replace table's default `tbody`.\n *\n * ## Use pagination as table footer\n *\n * ```html\n * <cds-pagination [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination>\n * ```\n *\n * `selectPage()` function should fetch the data from backend, create new `data`, apply it to `model.data`,\n * and update `model.currentPage`.\n *\n * If the data your server returns is a two dimensional array of objects, it would look something like this:\n *\n * ```typescript\n * selectPage(page) {\n * \tthis.getPage(page).then((data: Array<Array<any>>) => {\n * \t\t// set the data and update page\n * \t\tthis.model.data = this.prepareData(data);\n * \t\tthis.model.currentPage = page;\n * \t});\n * }\n *\n * protected prepareData(data: Array<Array<any>>) {\n * \t// create new data from the service data\n * \tlet newData = [];\n * \tdata.forEach(dataRow => {\n * \t\tlet row = [];\n * \t\tdataRow.forEach(dataElement => {\n * \t\t\trow.push(new TableItem({\n * \t\t\t\tdata: dataElement,\n * \t\t\t\ttemplate: typeof dataElement === \"string\" ? undefined : this.paginationTableItemTemplate\n * \t\t\t\t// your template can handle all the data types so you don't have to conditionally set it\n * \t\t\t\t// you can also set different templates for different columns based on index\n * \t\t\t}));\n * \t\t});\n * \t\tnewData.push(row);\n * \t});\n * \treturn newData;\n * }\n * ```\n */\n@Component({\n\tselector: \"cds-table, ibm-table\",\n\ttemplate: `\n\t<table\n\t\tcdsTable\n\t\t[sortable]=\"sortable\"\n\t\t[noBorder]=\"noBorder\"\n\t\t[ngClass]=\"{'cds--data-table--sticky-header': stickyHeader}\"\n\t\t[size]=\"size\"\n\t\t[striped]=\"striped\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t\t[attr.aria-describedby]=\"ariaDescribedby\">\n\t\t<thead\n\t\t\tcdsTableHead\n\t\t\t[sortable]=\"sortable\"\n\t\t\t(deselectAll)=\"onDeselectAll()\"\n\t\t\t(selectAll)=\"onSelectAll()\"\n\t\t\t(sort)=\"doSort($event)\"\n\t\t\t[checkboxHeaderLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t\t[model]=\"model\"\n\t\t\t[selectAllCheckbox]=\"selectAllCheckbox\"\n\t\t\t[selectAllCheckboxSomeSelected]=\"selectAllCheckboxSomeSelected\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[sortAscendingLabel]=\"sortAscendingLabel\"\n\t\t\t[sortDescendingLabel]=\"sortDescendingLabel\"\n\t\t\t[stickyHeader]=\"stickyHeader\">\n\t\t</thead>\n\t\t<tbody\n\t\t\tcdsTableBody\n\t\t\t(deselectRow)=\"onSelectRow($event)\"\n\t\t\t(scroll)=\"onScroll($event)\"\n\t\t\t(selectRow)=\"onSelectRow($event)\"\n\t\t\t[checkboxRowLabel]=\"getCheckboxRowLabel()\"\n\t\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t\t(rowClick)=\"onRowClick($event)\"\n\t\t\t[expandButtonAriaLabel]=\"expandButtonAriaLabel\"\n\t\t\t[model]=\"model\"\n\t\t\t[size]=\"size\"\n\t\t\t[ngStyle]=\"{'overflow-y': 'scroll'}\"\n\t\t\t[selectionLabelColumn]=\"selectionLabelColumn\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t*ngIf=\"!noData; else noDataTemplate\">\n\t\t</tbody>\n\t\t<ng-template #noDataTemplate><ng-content></ng-content></ng-template>\n\t\t<tfoot>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"footerTemplate\">\n\t\t\t</ng-template>\n\t\t\t<tr *ngIf=\"this.model.isLoading\">\n\t\t\t\t<td class=\"table_loading-indicator\">\n\t\t\t\t\t<div class=\"cds--loading cds--loading--small\">\n\t\t\t\t\t\t<svg class=\"cds--loading__svg\" viewBox=\"-75 -75 150 150\">\n\t\t\t\t\t\t\t<circle class=\"cds--loading__stroke\" cx=\"0\" cy=\"0\" r=\"37.5\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr *ngIf=\"this.model.isEnd\">\n\t\t\t\t<td class=\"table_end-indicator\">\n\t\t\t\t\t<h5>{{getEndOfDataText() | async}}</h5>\n\t\t\t\t\t<button (click)=\"scrollToTop($event)\" class=\"btn--secondary-sm\">\n\t\t\t\t\t\t{{getScrollTopText() | async}}\n\t\t\t\t\t</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tfoot>\n\t</table>\n\t`,\n\tstyles: [`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t`]\n})\nexport class Table implements AfterViewInit, OnDestroy {\n\t/**\n\t * Creates a skeleton model with a row and column count specified by the user\n\t *\n\t * Example:\n\t *\n\t * ```typescript\n\t * this.model = Table.skeletonModel(5, 5);\n\t * ```\n\t */\n\tstatic skeletonModel(rowCount: number, columnCount: number) {\n\t\tconst model = new TableModel();\n\t\tlet header = new Array<TableHeaderItem>();\n\t\tlet data = new Array<Array<TableItem>>();\n\t\tlet row = new Array<TableItem>();\n\n\t\tfor (let i = 0; i < columnCount; i++) {\n\t\t\theader.push(new TableHeaderItem());\n\t\t\trow.push(new TableItem());\n\t\t}\n\t\tfor (let i = 0; i < rowCount - 1; i++) {\n\t\t\tdata.push(row);\n\t\t}\n\n\t\tmodel.header = header;\n\t\tmodel.data = data;\n\t\treturn model;\n\t}\n\n\tstatic setTabIndex(element: HTMLElement, index: -1 | 0) {\n\t\tconst focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);\n\t\tif (element.firstElementChild && element.firstElementChild.classList.contains(\"cds--table-sort\") && focusElementList.length > 1) {\n\t\t\tfocusElementList[1].tabIndex = index;\n\t\t} else if (focusElementList.length > 0) {\n\t\t\tfocusElementList[0].tabIndex = index;\n\t\t} else {\n\t\t\telement.tabIndex = index;\n\t\t}\n\t}\n\n\tstatic focus(element: HTMLElement) {\n\t\tconst focusElementList = getFocusElementList(element, tabbableSelectorIgnoreTabIndex);\n\t\tif (\n\t\t\t(element.firstElementChild?.classList.contains(\"cds--table-sort\") && focusElementList.length > 1) ||\n\t\t\tfocusElementList.length > 0\n\t\t) {\n\t\t\tfocusElementList[0].focus();\n\t\t} else {\n\t\t\telement.focus();\n\t\t}\n\t}\n\n\t/**\n\t * Id of the table header title element\n\t */\n\t@Input() ariaLabelledby: string;\n\t/**\n\t * Id of the table header description element\n\t */\n\t@Input() ariaDescribedby: string;\n\n\t/**\n\t * `TableModel` with data the table is to display.\n\t */\n\t@Input()\n\tset model(m: TableModel) {\n\t\tif (this._model) {\n\t\t\tthis.subscriptions.unsubscribe();\n\t\t\t// Need to create a new subscription instance here because unsubscribing prevents any new subscriptions\n\t\t\t// from being added for some reason. When a new model is set, none of the subscriptions would exist.\n\t\t\tthis.subscriptions = new Subscription();\n\t\t}\n\n\t\tthis._model = m;\n\n\t\tconst rowsChange = this._model.rowsSelectedChange.subscribe(() => this.updateSelectAllCheckbox());\n\t\tconst dataChange = this._model.dataChange.subscribe(() => {\n\t\t\tif (this.isDataGrid) {\n\t\t\t\tthis.resetTabIndex();\n\t\t\t}\n\t\t\tthis.updateSelectAllCheckbox();\n\t\t});\n\n\t\tthis.subscriptions.add(rowsChange);\n\t\tthis.subscriptions.add(dataChange);\n\n\t\tif (this.isDataGrid) {\n\t\t\tconst expandedChange = this._model.rowsExpandedChange.subscribe(() => {\n\t\t\t\t// Allows the expanded row to have a focus state when it exists in the DOM\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst expandedRows = this.elementRef.nativeElement.querySelectorAll(\".cds--expandable-row:not(.cds--parent-row)\");\n\t\t\t\t\tArray.from<any>(expandedRows).forEach(row => {\n\t\t\t\t\t\tif (row.firstElementChild.tabIndex === undefined || row.firstElementChild.tabIndex !== -1) {\n\t\t\t\t\t\t\trow.firstElementChild.tabIndex = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.subscriptions.add(expandedChange);\n\t\t}\n\t}\n\n\tget model(): TableModel {\n\t\treturn this._model;\n\t}\n\n\t/**\n\t * Size of the table rows.\n\t */\n\t@Input() size: TableRowSize = \"md\";\n\t/**\n\t * Set to `true` for a loading table.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for a data grid with keyboard interactions.\n\t */\n\t@Input() set isDataGrid(value: boolean) {\n\t\tthis._isDataGrid = value;\n\t\tif (this.isViewReady) {\n\t\t\tif (value) {\n\t\t\t\tthis.enableDataGridInteractions();\n\t\t\t} else {\n\t\t\t\tthis.disableDataGridInteractions();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setting sortable to false will disable all headers including headers which are sortable. Is is\n\t * possible to set the sortable state on the header item to disable/enable sorting for only some headers.\n\t */\n\t@Input() sortable = true;\n\n\t@Input() noBorder = true;\n\n\tget isDataGrid(): boolean {\n\t\treturn this._isDataGrid;\n\t}\n\n\t/**\n\t * Controls whether to show the selection checkboxes column or not.\n\t */\n\t@Input() showSelectionColumn = true;\n\n\t/**\n\t * Controls whether to enable multiple or single row selection.\n\t */\n\t@Input() enableSingleSelect = false;\n\n\t/**\n\t * Distance (in px) from the bottom that view has to reach before\n\t * `scrollLoad` event is emitted.\n\t */\n\t@Input() scrollLoadDistance = 0;\n\n\t/**\n\t * @todo - Enable column resize when Carbon officially supports feature\n\t * Set to `true` to enable users to resize columns.\n\t *\n\t * Works for columns with width set in pixels.\n\t *\n\t */\n\t// @Input() columnsResizable = false;\n\n\t/**\n\t * @todo - Enable columns drag & drop when Carbon officially supports feature\n\t * Set to `true` to enable users to drag and drop columns.\n\t *\n\t * Changing the column order in table changes table model. Be aware of it when you add additional data\n\t * to the model.\n\t *\n\t */\n\t// @Input() columnsDraggable = false;\n\n\t@Input()\n\tset expandButtonAriaLabel(value: string | Observable<string>) {\n\t\tthis._expandButtonAriaLabel.override(value);\n\t}\n\tget expandButtonAriaLabel() {\n\t\treturn this._expandButtonAriaLabel.value;\n\t}\n\t@Input()\n\tset sortDescendingLabel(value: string | Observable<string>) {\n\t\tthis._sortDescendingLabel.override(value);\n\t}\n\tget sortDescendingLabel() {\n\t\treturn this._sortDescendingLabel.value;\n\t}\n\t@Input()\n\tset sortAscendingLabel(value: string | Observable<string>) {\n\t\tthis._sortAscendingLabel.override(value);\n\t}\n\tget sortAscendingLabel() {\n\t\treturn this._sortAscendingLabel.value;\n\t}\n\n\t/**\n\t * Expects an object that contains some or all of:\n\t * ```\n\t * {\n\t *\t\t\"FILTER\": \"Filter\",\n\t *\t\t\"END_OF_DATA\": \"You've reached the end of your content\",\n\t *\t\t\"SCROLL_TOP\": \"Scroll to top\",\n\t *\t\t\"CHECKBOX_HEADER\": \"Select all rows\",\n\t *\t\t\"CHECKBOX_ROW\": \"Select row\"\n\t * }\n\t * ```\n\t */\n\t@Input()\n\tset translations(value) {\n\t\tconst valueWithDefaults = merge(this.i18n.getMultiple(\"TABLE\"), value);\n\t\tthis._filterTitle.override(valueWithDefaults.FILTER);\n\t\tthis._endOfDataText.override(valueWithDefaults.END_OF_DATA);\n\t\tthis._scrollTopText.override(valueWithDefaults.SCROLL_TOP);\n\t\tthis._checkboxHeaderLabel.override(valueWithDefaults.CHECKBOX_HEADER);\n\t\tthis._checkboxRowLabel.override(valueWithDefaults.CHECKBOX_ROW);\n\t}\n\n\t/**\n\t * Set to `false` to remove table rows (zebra) stripes.\n\t */\n\t@Input() striped = true;\n\n\t/**\n\t * Allows table content to scroll horizontally\n\t */\n\t@HostBinding(\"class.cds--data-table-content\") tableContent = true;\n\n\t/**\n\t * Set to `true` to stick the header to the top of the table\n\t */\n\t@HostBinding(\"class.cds--data-table_inner-container\") @Input() stickyHeader = false;\n\n\t/**\n\t * Set footer template to customize what is displayed in the tfoot section of the table\n\t */\n\t@Input() footerTemplate: TemplateRef<any>;\n\n\t/**\n\t * Used to populate the row selection checkbox label with a useful value if set.\n\t *\n\t * Example:\n\t * ```\n\t * <cds-table [selectionLabelColumn]=\"0\"></cds-table>\n\t * <!-- results in aria-label=\"Select first column value\"\n\t * (where \"first column value\" is the value of the first column in the row -->\n\t * ```\n\t */\n\t@Input() selectionLabelColumn: number;\n\n\t/**\n\t * Emits an index of the column that wants to be sorted.\n\t *\n\t * If no observers are provided (default), table will attempt to do a simple sort of the data loaded\n\t * into the model.\n\t *\n\t * If an observer is provided, table will not attempt any sorting of its own and it is up to the observer\n\t * to sort the table. This is what you typically want if you're using a backend query to get the sorted\n\t * data or want to sort data across multiple pages.\n\t *\n\t * Usage:\n\t *\n\t * ```typescript\n\t * @Component({\n\t * \tselector: \"app-table\",\n\t * \ttemplate: `\n\t * \t\t<cds-table\n\t * \t\t\t[model]=\"model\"\n\t * \t\t\t(sort)=\"simpleSort($event)\">\n\t * \t\t\tNo data.\n\t * \t\t</cds-table>\n\t * \t`\n\t * })\n\t * export class TableApp implements OnInit, OnChanges {\n\t * \t@Input() model = new TableModel();\n\t *\n\t * \tngOnInit() {\n\t * \t\tthis.model.header = [\n\t * \t\t\tnew TableHeaderItem({ data: \"Name\" }),\n\t * \t\t\tnew TableHeaderItem({ data: \"hwer\" })\n\t * \t\t];\n\t *\n\t * \t\tthis.model.data = [\n\t * \t\t\t[new TableItem({ data: \"Name 1\" }), new TableItem({ data: \"qwer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 3\" }), new TableItem({ data: \"zwer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 2\" }), new TableItem({ data: \"swer\" })],\n\t * \t\t\t[new TableItem({ data: \"Name 4\" }), new TableItem({data: \"twer\"})],\n\t * \t\t\t[new TableItem({ data: \"Name 5\" }), new TableItem({data: \"twer\"})],\n\t * \t\t\t[new TableItem({ data: \"Name 6\" }), new TableItem({data: \"twer\"})]\n\t * \t\t];\n\t * \t}\n\t *\n\t * \tsimpleSort(index: number) {\n\t * \t\t// this function does a simple sort, which is the default for the table and if that's\n\t * \t\t// all you want, you don't need to do this.\n\t *\n\t * \t\t// here you can query your backend and update the model.data based on the result\n\t * \t\tif (this.model.header[index].sorted) {\n\t * \t\t\t// if already sorted flip sorting direction\n\t * \t\t\tthis.model.header[index].ascending = this.model.header[index].descending;\n\t * \t\t}\n\t * \t\tthis.model.sort(index);\n\t * \t}\n\t * }\n\t * ```\n\t */\n\t@Output() sort = new EventEmitter<number>();\n\n\t/**\n\t * Emits if all rows are selected.\n\t *\n\t * @param model\n\t */\n\t@Output() selectAll = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if all rows are deselected.\n\t *\n\t * @param model\n\t */\n\t@Output() deselectAll = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a single row is selected.\n\t *\n\t * @param ({model: this.model, selectedRowIndex: index})\n\t */\n\t@Output() selectRow = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a single row is deselected.\n\t *\n\t * @param ({model: this.model, deselectedRowIndex: index})\n\t */\n\t@Output() deselectRow = new EventEmitter<Object>();\n\n\t/**\n\t * Emits if a row item excluding expandButtons, checkboxes, or radios is clicked.\n\t */\n\t@Output() rowClick = new EventEmitter<number>();\n\n\t/**\n\t * Emits when table requires more data to be loaded.\n\t */\n\t@Output() scrollLoad = new EventEmitter<TableModel>();\n\n\t/**\n\t * Controls if all checkboxes are viewed as selected.\n\t */\n\tselectAllCheckbox = false;\n\n\t/**\n\t * Controls the indeterminate state of the header checkbox.\n\t */\n\tselectAllCheckboxSomeSelected = false;\n\n\tget noData() {\n\t\treturn !this.model.data ||\n\t\t\tthis.model.data.length === 0 ||\n\t\t\tthis.model.data.length === 1 && this.model.data[0].length === 0;\n\t}\n\n\tpublic isColumnDragging = false;\n\tpublic columnDraggedHoverIndex = -1;\n\tpublic columnDraggedPosition = \"\";\n\n\tprotected _model: TableModel;\n\tprotected _isDataGrid = false;\n\t// flag to prevent getters/setters from querying the view before it's fully instantiated\n\tprotected isViewReady = false;\n\n\tprotected subscriptions = new Subscription();\n\tprotected positionSubscription: Subscription;\n\n\tprotected interactionModel: DataGridInteractionModel;\n\tprotected interactionPositionSubscription: Subscription;\n\n\tprotected _expandButtonAriaLabel = this.i18n.getOverridable(\"TABLE.EXPAND_BUTTON\");\n\tprotected _sortDescendingLabel = this.i18n.getOverridable(\"TABLE.SORT_DESCENDING\");\n\tprotected _sortAscendingLabel = this.i18n.getOverridable(\"TABLE.SORT_ASCENDING\");\n\tprotected _checkboxHeaderLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_HEADER\");\n\tprotected _checkboxRowLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_ROW\");\n\tprotected _endOfDataText = this.i18n.getOverridable(\"TABLE.END_OF_DATA\");\n\tprotected _scrollTopText = this.i18n.getOverridable(\"TABLE.SCROLL_TOP\");\n\tprotected _filterTitle = this.i18n.getOverridable(\"TABLE.FILTER\");\n\n\tprotected columnResizeWidth: number;\n\tprotected columnResizeMouseX: number;\n\tprotected mouseMoveSubscription: Subscription;\n\tprotected mouseUpSubscription: Subscription;\n\n\t/**\n\t * Creates an instance of Table.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected applicationRef: ApplicationRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngAfterViewInit() {\n\t\tthis.isViewReady = true;\n\t\tif (this.isDataGrid) {\n\t\t\tthis.enableDataGridInteractions();\n\t\t}\n\t}\n\n\tngOnDestroy() {\n\t\tthis.subscriptions.unsubscribe();\n\t\tif (this.positionSubscription) {\n\t\t\tthis.positionSubscription.unsubscribe();\n\t\t}\n\t}\n\n\tenableDataGridInteractions() {\n\t\t// if we have an `interactioModel` we've already enabled datagrid\n\t\tif (this.interactionModel) {\n\t\t\treturn;\n\t\t}\n\t\tconst table = this.elementRef.nativeElement.querySelector(\"table\") as HTMLTableElement;\n\t\tconst tableAdapter = new TableDomAdapter(table);\n\t\tconst keydownEventStream = fromEvent<KeyboardEvent>(table, \"keydown\");\n\t\tconst clickEventStream = fromEvent<MouseEvent>(table, \"click\");\n\t\tthis.interactionModel = new DataGridInteractionModel(keydownEventStream, clickEventStream, tableAdapter);\n\t\tthis.positionSubscription = this.interactionModel.position.subscribe(event => {\n\t\t\tconst [currentRow, currentColumn] = event.current;\n\t\t\tconst [previousRow, previousColumn] = event.previous;\n\n\t\t\tconst currentElement = tableAdapter.getCell(currentRow, currentColumn);\n\t\t\tTable.setTabIndex(currentElement, 0);\n\n\t\t\t// if the model has just initialized don't focus or reset anything\n\t\t\tif (previousRow === -1 || previousColumn === -1) { return; }\n\t\t\t// Make the previous cell unfocusable (if it's not the current)\n\t\t\tif (previousRow !== currentRow || previousColumn !== currentColumn) {\n\t\t\t\tconst previousElement = tableAdapter.getCell(previousRow, previousColumn);\n\t\t\t\tTable.setTabIndex(previousElement, -1);\n\t\t\t}\n\t\t\tTable.focus(currentElement);\n\t\t});\n\t\t// call this after assigning `this.interactionModel` since it depends on it\n\t\tthis.resetTabIndex();\n\t}\n\n\tdisableDataGridInteractions() {\n\t\t// unsubscribe first so we don't cause the focus to fly around\n\t\tif (this.positionSubscription) {\n\t\t\tthis.positionSubscription.unsubscribe();\n\t\t}\n\t\t// undo tab indexing (also resets the model)\n\t\tthis.resetTabIndex(0);\n\t\t// null out the model ref\n\t\tthis.interactionModel = null;\n\t}\n\n\tonSelectAll() {\n\t\tthis.model.selectAll(true);\n\t\tthis.selectAll.emit(this.model);\n\t}\n\n\tonDeselectAll() {\n\t\tthis.model.selectAll(false);\n\t\tthis.deselectAll.emit(this.model);\n\t}\n\n\tonSelectRow(event) {\n\t\t// check for the existence of the selectedRowIndex property\n\t\tif (Object.keys(event).includes(\"selectedRowIndex\")) {\n\t\t\tif (this.enableSingleSelect) {\n\t\t\t\tthis.model.selectAll(false);\n\t\t\t}\n\t\t\tthis.model.selectRow(event.selectedRowIndex, true);\n\t\t\tthis.selectRow.emit(event);\n\t\t} else {\n\t\t\tthis.model.selectRow(event.deselectedRowIndex, false);\n\t\t\tthis.deselectRow.emit(event);\n\t\t}\n\t}\n\n\tonRowClick(index: number) {\n\t\tthis.rowClick.emit(index);\n\t}\n\n\tupdateSelectAllCheckbox() {\n\t\tconst selectedRowsCount = this.model.selectedRowsCount();\n\n\t\tif (selectedRowsCount <= 0) {\n\t\t\t// reset select all checkbox if nothing selected\n\t\t\tthis.selectAllCheckbox = false;\n\t\t\tthis.selectAllCheckboxSomeSelected = false;\n\t\t} else if (selectedRowsCount < this.model.data.length) {\n\t\t\tthis.selectAllCheckbox = true;\n\t\t\tthis.selectAllCheckboxSomeSelected = true;\n\t\t} else {\n\t\t\tthis.selectAllCheckbox = true;\n\t\t\tthis.selectAllCheckboxSomeSelected = false;\n\t\t}\n\t}\n\n\tresetTabIndex(newTabIndex = -1) {\n\t\t// ensure the view is ready for the reset before we preform the actual reset\n\t\tsetTimeout(() => {\n\t\t\t// reset all the tabIndexes we can find\n\t\t\tconst focusElementList = getFocusElementList(this.elementRef.nativeElement, tabbableSelectorIgnoreTabIndex);\n\t\t\tif (focusElementList) {\n\t\t\t\tfocusElementList.forEach(tabbable => {\n\t\t\t\t\ttabbable.tabIndex = newTabIndex;\n\t\t\t\t});\n\t\t\t}\n\t\t\t// reset interaction model positions and tabIndexes\n\t\t\tif (this.interactionModel) {\n\t\t\t\tthis.interactionModel.resetTabIndexes(newTabIndex);\n\t\t\t}\n\t\t});\n\t}\n\n\tcolumnResizeStart(event, column) {\n\t\tthis.columnResizeWidth = parseInt(column.style.width, 10);\n\t\tthis.columnResizeMouseX = event.clientX;\n\t\tevent.preventDefault();\n\n\t\tthis.mouseMoveSubscription = fromEvent(document.body, \"mousemove\").subscribe(event => {\n\t\t\tthis.columnResizeProgress(event, column);\n\t\t});\n\t\tthis.mouseUpSubscription = fromEvent(document.body, \"mouseup\").subscribe(event => {\n\t\t\tthis.columnResizeEnd(event, column);\n\t\t});\n\t}\n\n\tcolumnResizeProgress(event, column) {\n\t\tconst move = event.clientX - this.columnResizeMouseX;\n\t\tcolumn.style.width = `${this.columnResizeWidth + move}px`;\n\t}\n\n\tcolumnResizeEnd(event, column) {\n\t\tthis.mouseMoveSubscription.unsubscribe();\n\t\tthis.mouseUpSubscription.unsubscribe();\n\t}\n\n\t/**\n\t * Triggered when the user scrolls on the `<tbody>` element.\n\t * Emits the `scrollLoad` event.\n\t */\n\tonScroll(event) {\n\t\tconst distanceFromBottom = event.target.scrollHeight - event.target.clientHeight - event.target.scrollTop;\n\n\t\tif (distanceFromBottom <= this.scrollLoadDistance) {\n\t\t\tthis.scrollLoad.emit(this.model);\n\t\t} else {\n\t\t\tthis.model.isEnd = false;\n\t\t}\n\t}\n\n\tcolumnDragStart(event, columnIndex) {\n\t\tthis.isColumnDragging = true;\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t\tevent.dataTransfer.setData(\"columnIndex\", JSON.stringify(columnIndex));\n\t}\n\n\tcolumnDragEnd(event, columnIndex) {\n\t\tthis.isColumnDragging = false;\n\t\tthis.columnDraggedHoverIndex = -1;\n\t}\n\n\tcolumnDragEnter(event, position, columnIndex) {\n\t\tthis.columnDraggedPosition = position;\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t}\n\n\tcolumnDragLeave(event, position, columnIndex) {\n\t\tthis.columnDraggedPosition = \"\";\n\t}\n\n\tcolumnDragover(event, position, columnIndex) {\n\t\tthis.columnDraggedHoverIndex = columnIndex;\n\t\tthis.columnDraggedPosition = position;\n\n\t\t// needed to tell browser to allow dropping\n\t\tevent.preventDefault();\n\t}\n\n\tcolumnDrop(event, position, columnIndex) {\n\t\tthis.isColumnDragging = false;\n\t\tthis.columnDraggedHoverIndex = -1;\n\t\tthis.columnDraggedPosition = \"\";\n\n\t\tthis.model.moveColumn(\n\t\t\tparseInt(event.dataTransfer.getData(\"columnIndex\"), 10),\n\t\t\tcolumnIndex + (position === \"right\" ? 1 : 0)\n\t\t);\n\t}\n\n\tdoSort(index: number) {\n\t\tif (this.sort.observers.length === 0) {\n\t\t\t// no sort provided so do the simple sort\n\t\t\tthis.model.cycleSortState(index);\n\t\t\tthis.model.sort(index);\n\t\t}\n\n\t\tthis.sort.emit(index);\n\t}\n\n\t/**\n\t * Triggered when the user scrolls on the `<tbody>` element.\n\t * Emits the `scrollLoad` event.\n\t */\n\tscrollToTop(event) {\n\t\tevent.target.parentElement.parentElement.parentElement.parentElement.children[1].scrollTop = 0;\n\t\tthis.model.isEnd = false;\n\t}\n\n\tgetSelectionLabelValue(row: TableItem[]) {\n\t\tif (!this.selectionLabelColumn) {\n\t\t\treturn { value: this.i18n.get().TABLE.ROW };\n\t\t}\n\t\treturn { value: row[this.selectionLabelColumn].data };\n\t}\n\n\tgetExpandButtonAriaLabel() {\n\t\treturn this._expandButtonAriaLabel.subject;\n\t}\n\tgetSortDescendingLabel() {\n\t\treturn this._sortDescendingLabel.subject;\n\t}\n\tgetSortAscendingLabel() {\n\t\treturn this._sortAscendingLabel.subject;\n\t}\n\n\tgetCheckboxHeaderLabel() {\n\t\treturn this._checkboxHeaderLabel.subject;\n\t}\n\n\tgetCheckboxRowLabel() {\n\t\treturn this._checkboxRowLabel.subject;\n\t}\n\n\tgetEndOfDataText() {\n\t\treturn this._endOfDataText.subject;\n\t}\n\n\tgetScrollTopText() {\n\t\treturn this._scrollTopText.subject;\n\t}\n\n\tgetFilterTitle() {\n\t\treturn this._filterTitle.subject;\n\t}\n}\n",
|
|
53214
53214
|
"assetsDirs": [],
|
|
53215
53215
|
"styleUrlsData": "",
|
|
53216
53216
|
"stylesData": "\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t\n",
|
|
@@ -53239,7 +53239,7 @@
|
|
|
53239
53239
|
"deprecationMessage": ""
|
|
53240
53240
|
}
|
|
53241
53241
|
],
|
|
53242
|
-
"line":
|
|
53242
|
+
"line": 640,
|
|
53243
53243
|
"rawdescription": "\n\nCreates an instance of Table.\n",
|
|
53244
53244
|
"jsdoctags": [
|
|
53245
53245
|
{
|
|
@@ -53292,7 +53292,7 @@
|
|
|
53292
53292
|
}
|
|
53293
53293
|
],
|
|
53294
53294
|
"returnType": "void",
|
|
53295
|
-
"line":
|
|
53295
|
+
"line": 315,
|
|
53296
53296
|
"rawdescription": "\n\n`TableModel` with data the table is to display.\n",
|
|
53297
53297
|
"description": "<p><code>TableModel</code> with data the table is to display.</p>\n",
|
|
53298
53298
|
"jsdoctags": [
|
|
@@ -53311,7 +53311,7 @@
|
|
|
53311
53311
|
"name": "model",
|
|
53312
53312
|
"type": "",
|
|
53313
53313
|
"returnType": "TableModel",
|
|
53314
|
-
"line":
|
|
53314
|
+
"line": 352
|
|
53315
53315
|
}
|
|
53316
53316
|
},
|
|
53317
53317
|
"isDataGrid": {
|
|
@@ -53330,7 +53330,7 @@
|
|
|
53330
53330
|
}
|
|
53331
53331
|
],
|
|
53332
53332
|
"returnType": "void",
|
|
53333
|
-
"line":
|
|
53333
|
+
"line": 367,
|
|
53334
53334
|
"rawdescription": "\n\nSet to `true` for a data grid with keyboard interactions.\n",
|
|
53335
53335
|
"description": "<p>Set to <code>true</code> for a data grid with keyboard interactions.</p>\n",
|
|
53336
53336
|
"jsdoctags": [
|
|
@@ -53349,7 +53349,7 @@
|
|
|
53349
53349
|
"name": "isDataGrid",
|
|
53350
53350
|
"type": "boolean",
|
|
53351
53351
|
"returnType": "boolean",
|
|
53352
|
-
"line":
|
|
53352
|
+
"line": 386
|
|
53353
53353
|
}
|
|
53354
53354
|
},
|
|
53355
53355
|
"expandButtonAriaLabel": {
|
|
@@ -53368,7 +53368,7 @@
|
|
|
53368
53368
|
}
|
|
53369
53369
|
],
|
|
53370
53370
|
"returnType": "void",
|
|
53371
|
-
"line":
|
|
53371
|
+
"line": 426,
|
|
53372
53372
|
"rawdescription": "\n\nSet to `true` to enable users to drag and drop columns.\n\nChanging the column order in table changes table model. Be aware of it when you add additional data\nto the model.\n\n",
|
|
53373
53373
|
"description": "<p>Set to <code>true</code> to enable users to drag and drop columns.</p>\n<p>Changing the column order in table changes table model. Be aware of it when you add additional data\nto the model.</p>\n",
|
|
53374
53374
|
"jsdoctags": [
|
|
@@ -53387,7 +53387,7 @@
|
|
|
53387
53387
|
"name": "expandButtonAriaLabel",
|
|
53388
53388
|
"type": "",
|
|
53389
53389
|
"returnType": "",
|
|
53390
|
-
"line":
|
|
53390
|
+
"line": 429
|
|
53391
53391
|
}
|
|
53392
53392
|
},
|
|
53393
53393
|
"sortDescendingLabel": {
|
|
@@ -53406,7 +53406,7 @@
|
|
|
53406
53406
|
}
|
|
53407
53407
|
],
|
|
53408
53408
|
"returnType": "void",
|
|
53409
|
-
"line":
|
|
53409
|
+
"line": 433,
|
|
53410
53410
|
"jsdoctags": [
|
|
53411
53411
|
{
|
|
53412
53412
|
"name": "value",
|
|
@@ -53423,7 +53423,7 @@
|
|
|
53423
53423
|
"name": "sortDescendingLabel",
|
|
53424
53424
|
"type": "",
|
|
53425
53425
|
"returnType": "",
|
|
53426
|
-
"line":
|
|
53426
|
+
"line": 436
|
|
53427
53427
|
}
|
|
53428
53428
|
},
|
|
53429
53429
|
"sortAscendingLabel": {
|
|
@@ -53442,7 +53442,7 @@
|
|
|
53442
53442
|
}
|
|
53443
53443
|
],
|
|
53444
53444
|
"returnType": "void",
|
|
53445
|
-
"line":
|
|
53445
|
+
"line": 440,
|
|
53446
53446
|
"jsdoctags": [
|
|
53447
53447
|
{
|
|
53448
53448
|
"name": "value",
|
|
@@ -53459,7 +53459,7 @@
|
|
|
53459
53459
|
"name": "sortAscendingLabel",
|
|
53460
53460
|
"type": "",
|
|
53461
53461
|
"returnType": "",
|
|
53462
|
-
"line":
|
|
53462
|
+
"line": 443
|
|
53463
53463
|
}
|
|
53464
53464
|
},
|
|
53465
53465
|
"translations": {
|
|
@@ -53478,7 +53478,7 @@
|
|
|
53478
53478
|
}
|
|
53479
53479
|
],
|
|
53480
53480
|
"returnType": "void",
|
|
53481
|
-
"line":
|
|
53481
|
+
"line": 460,
|
|
53482
53482
|
"rawdescription": "\n\nExpects an object that contains some or all of:\n```\n{\n\t\t\"FILTER\": \"Filter\",\n\t\t\"END_OF_DATA\": \"You've reached the end of your content\",\n\t\t\"SCROLL_TOP\": \"Scroll to top\",\n\t\t\"CHECKBOX_HEADER\": \"Select all rows\",\n\t\t\"CHECKBOX_ROW\": \"Select row\"\n}\n```\n",
|
|
53483
53483
|
"description": "<p>Expects an object that contains some or all of:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-none\">{\n "FILTER": "Filter",\n "END_OF_DATA": "You've reached the end of your content",\n "SCROLL_TOP": "Scroll to top",\n "CHECKBOX_HEADER": "Select all rows",\n "CHECKBOX_ROW": "Select row"\n}</code></pre></div>",
|
|
53484
53484
|
"jsdoctags": [
|
|
@@ -53500,7 +53500,7 @@
|
|
|
53500
53500
|
"name": "noData",
|
|
53501
53501
|
"type": "",
|
|
53502
53502
|
"returnType": "",
|
|
53503
|
-
"line":
|
|
53503
|
+
"line": 607
|
|
53504
53504
|
}
|
|
53505
53505
|
}
|
|
53506
53506
|
}
|