carbon-components-angular 5.12.1 → 5.12.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/Label.html +5 -5
- package/docs/documentation/components/Table.html +134 -136
- package/docs/documentation/components/TableHead.html +42 -84
- package/docs/documentation/components/TextInputLabelComponent.html +5 -5
- package/docs/documentation/coverage.html +3 -3
- package/docs/documentation/directives/IconDirective.html +1 -1
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +42 -38
- package/docs/documentation/modules/TimePickerModule.html +42 -38
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +24 -24
- package/docs/documentation/modules/TimePickerSelectModule.html +24 -24
- package/docs/documentation/modules/ToggleModule/dependencies.svg +45 -41
- package/docs/documentation/modules/ToggleModule.html +45 -41
- package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TooltipModule.html +28 -28
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +177 -188
- package/docs/storybook/5868.140403a3.iframe.bundle.js +1 -0
- package/docs/storybook/7153.22bf775d.iframe.bundle.js +1 -0
- package/docs/storybook/901.ed9f5b53.iframe.bundle.js +1 -0
- package/docs/storybook/9558.78351910.iframe.bundle.js +1 -0
- package/docs/storybook/9672.655955b8.iframe.bundle.js +1 -0
- package/docs/storybook/accordion-accordion-stories.87b53382.iframe.bundle.js +1 -0
- package/docs/storybook/breadcrumb-breadcrumb-stories.8580abca.iframe.bundle.js +1 -0
- package/docs/storybook/button-button-set-stories.550078d0.iframe.bundle.js +1 -0
- package/docs/storybook/button-button-stories.56fe9922.iframe.bundle.js +1 -0
- package/docs/storybook/{progress-bar-progress-bar-stories.5fb7d045.iframe.bundle.js → button-icon-button-stories.9a01c5b5.iframe.bundle.js} +1 -1
- package/docs/storybook/{code-snippet-code-snippet-stories.ec4fca0a.iframe.bundle.js → code-snippet-code-snippet-stories.2d191731.iframe.bundle.js} +1 -1
- package/docs/storybook/{combobox-combobox-stories.a311e67b.iframe.bundle.js → combobox-combobox-stories.48876c96.iframe.bundle.js} +1 -1
- package/docs/storybook/{context-menu-context-menu-stories.158ccd1c.iframe.bundle.js → context-menu-context-menu-stories.70d2f130.iframe.bundle.js} +1 -1
- package/docs/storybook/{datepicker-datepicker-stories.ef9bfd14.iframe.bundle.js → datepicker-datepicker-stories.178ad9bd.iframe.bundle.js} +1 -1
- package/docs/storybook/{dialog-overflow-menu-overflow-menu-stories.f6323fbc.iframe.bundle.js → dialog-overflow-menu-overflow-menu-stories.ae41f3c6.iframe.bundle.js} +1 -1
- package/docs/storybook/dropdown-dropdown-stories.4ea6bced.iframe.bundle.js +1 -0
- package/docs/storybook/icon-icon-stories.7c3f9291.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{index-stories.10b4ce67.iframe.bundle.js → index-stories.71fe20a3.iframe.bundle.js} +1 -1
- package/docs/storybook/inline-loading-inline-loading-stories.335b2571.iframe.bundle.js +1 -0
- package/docs/storybook/main.4241d66b.iframe.bundle.js +1 -0
- package/docs/storybook/{number-input-number-stories.ca6f8990.iframe.bundle.js → number-input-number-stories.0bc36a19.iframe.bundle.js} +1 -1
- package/docs/storybook/{button-button-stories.82a8e128.iframe.bundle.js → progress-bar-progress-bar-stories.4fafc0aa.iframe.bundle.js} +1 -1
- package/docs/storybook/progress-indicator-progress-indicator-stories.9f002dac.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/radio-radio-stories.887c598e.iframe.bundle.js +1 -0
- package/docs/storybook/{runtime~main.73b5bfb0.iframe.bundle.js → runtime~main.584e1b10.iframe.bundle.js} +1 -1
- package/docs/storybook/{dropdown-dropdown-stories.1ae77006.iframe.bundle.js → search-search-stories.bbb770c2.iframe.bundle.js} +1 -1
- package/docs/storybook/structured-list-structured-list-stories.6c6d8ade.iframe.bundle.js +1 -0
- package/docs/storybook/table-table-stories.2c7e06c4.iframe.bundle.js +1 -0
- package/docs/storybook/tag-tag-stories.5e95b96d.iframe.bundle.js +1 -0
- package/docs/storybook/ui-shell-ui-shell-stories.ccdf4ff8.iframe.bundle.js +1 -0
- package/esm2020/icon/icon.directive.mjs +2 -2
- package/esm2020/input/label.component.mjs +5 -5
- package/esm2020/input/text-input-label.component.mjs +5 -5
- package/esm2020/table/head/table-head.component.mjs +2 -10
- package/esm2020/table/table.component.mjs +2 -4
- package/fesm2015/carbon-components-angular-icon.mjs +1 -1
- package/fesm2015/carbon-components-angular-icon.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-input.mjs +8 -8
- package/fesm2015/carbon-components-angular-input.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-table.mjs +2 -12
- package/fesm2015/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-icon.mjs +1 -1
- package/fesm2020/carbon-components-angular-icon.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-input.mjs +8 -8
- package/fesm2020/carbon-components-angular-input.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-table.mjs +2 -12
- package/fesm2020/carbon-components-angular-table.mjs.map +1 -1
- package/package.json +1 -1
- package/table/head/table-head.component.d.ts +1 -6
- package/docs/storybook/5868.2c92ef26.iframe.bundle.js +0 -1
- package/docs/storybook/7153.ce84c62a.iframe.bundle.js +0 -1
- package/docs/storybook/901.0cee8749.iframe.bundle.js +0 -1
- package/docs/storybook/9558.680ea348.iframe.bundle.js +0 -1
- package/docs/storybook/9672.2cc3d4f7.iframe.bundle.js +0 -1
- package/docs/storybook/accordion-accordion-stories.9a7b324c.iframe.bundle.js +0 -1
- package/docs/storybook/breadcrumb-breadcrumb-stories.88919630.iframe.bundle.js +0 -1
- package/docs/storybook/button-button-set-stories.68d26789.iframe.bundle.js +0 -1
- package/docs/storybook/button-icon-button-stories.5d232e73.iframe.bundle.js +0 -1
- package/docs/storybook/icon-icon-stories.c5e1074f.iframe.bundle.js +0 -1
- package/docs/storybook/inline-loading-inline-loading-stories.c54dee33.iframe.bundle.js +0 -1
- package/docs/storybook/main.fe6c3f7d.iframe.bundle.js +0 -1
- package/docs/storybook/progress-indicator-progress-indicator-stories.e18e124a.iframe.bundle.js +0 -1
- package/docs/storybook/radio-radio-stories.82373213.iframe.bundle.js +0 -1
- package/docs/storybook/search-search-stories.30a933b1.iframe.bundle.js +0 -1
- package/docs/storybook/structured-list-structured-list-stories.38bd94fc.iframe.bundle.js +0 -1
- package/docs/storybook/table-table-stories.c0b6231b.iframe.bundle.js +0 -1
- package/docs/storybook/tag-tag-stories.e0c5cc20.iframe.bundle.js +0 -1
- package/docs/storybook/ui-shell-ui-shell-stories.704e84bd.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -5219,12 +5219,12 @@
|
|
|
5219
5219
|
},
|
|
5220
5220
|
{
|
|
5221
5221
|
"name": "CustomHeaderItem",
|
|
5222
|
-
"id": "class-CustomHeaderItem-
|
|
5222
|
+
"id": "class-CustomHeaderItem-43dec1fee39d015661af87a2e0758230b3fe81f583b813b9295a920fa61c1f02e93d480424afab37673e46ee64fddb53093c74715a7b4269e5e642504d5fa75b",
|
|
5223
5223
|
"file": "src/table/stories/app-custom-table.component.ts",
|
|
5224
5224
|
"deprecated": false,
|
|
5225
5225
|
"deprecationMessage": "",
|
|
5226
5226
|
"type": "class",
|
|
5227
|
-
"sourceCode": "import {\n\tTemplateRef,\n\tComponent,\n\tViewChild,\n\
|
|
5227
|
+
"sourceCode": "import {\n\tTemplateRef,\n\tComponent,\n\tViewChild,\n\tInput,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { TableModel } from \"../table-model.class\";\nimport { TableItem } from \"../table-item.class\";\nimport { TableHeaderItem } from \"../table-header-item.class\";\nimport { clone } from \"../../utils/index\";\n\nexport class CustomHeaderItem extends TableHeaderItem {\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@Component({\n\tselector: \"app-custom-table\",\n\ttemplate: `\n\t\t<cds-table-toolbar [model]=\"model\">\n\t\t\t<button cdsButton=\"primary\" (click)=\"addRow()\">Add row</button>\n\t\t\t<button cdsButton=\"primary\" (click)=\"addColumn()\">Add column</button>\n\t\t</cds-table-toolbar>\n\n\t\t<ng-template #customTableItemTemplate let-data=\"data\">\n\t\t\t<a [attr.href]=\"data.link\">{{data.name}} {{data.surname}}</a>\n\t\t</ng-template>\n\t\t<ng-template #customHeaderTemplate let-data=\"data\">\n\t\t\t<i cdsTableHeadCellLabel><a [attr.href]=\"data.link\">{{data.name}}</a></i>\n\t\t</ng-template>\n\n\t\t<cds-table\n\t\t\t[model]=\"model\"\n\t\t\t[size]=\"size\"\n\t\t\t[sortable]=\"sortable\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[stickyHeader]=\"stickyHeader\"\n\t\t\t[striped]=\"striped\"\n\t\t\t[isDataGrid]=\"isDataGrid\"\n\t\t\t(rowClick)=\"onRowClick($event)\"\n\t\t\t(sort)=\"customSort($event)\">\n\t\t</cds-table>\n\t`\n})\nexport class DynamicTableStory implements AfterViewInit {\n\t@Input() model = new TableModel();\n\t@Input() size = \"md\";\n\t@Input() showSelectionColumn = true;\n\t@Input() striped = true;\n\t@Input() isDataGrid = false;\n\t@Input() sortable = true;\n\t@Input() stickyHeader = false;\n\t@Input() skeleton = false;\n\n\t@ViewChild(\"customHeaderTemplate\")\n\tprotected customHeaderTemplate: TemplateRef<any>;\n\n\t@ViewChild(\"customTableItemTemplate\")\n\tprotected customTableItemTemplate: TemplateRef<any>;\n\n\tngAfterViewInit() {\n\t\tthis.model.data = [\n\t\t\t[new TableItem({ data: \"Name 1\" }), new TableItem({ data: { name: \"Lessy\", link: \"#\" }, template: this.customTableItemTemplate })],\n\t\t\t[new TableItem({ data: \"Name 3\" }), new TableItem({ data: \"swer\" })],\n\t\t\t[new TableItem({ data: \"Name 2\" }), new TableItem({ data: { name: \"Alice\", surname: \"Bob\" }, template: this.customTableItemTemplate })],\n\t\t\t[new TableItem({ data: \"Name 4\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 5\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 6\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 7\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 8\" }), new TableItem({ data: \"twer\" })]\n\t\t];\n\t\tthis.model.header = [\n\t\t\tnew TableHeaderItem({ data: \"Very long title indeed\" }),\n\t\t\tnew CustomHeaderItem({\n\t\t\t\tdata: { name: \"Custom header\", link: \"#\" },\n\t\t\t\ttemplate: this.customHeaderTemplate,\n\t\t\t\tariaSortLabel: \"Custom header\"\n\t\t\t})\n\t\t];\n\t}\n\n\tcustomSort(index: number) {\n\t\tthis.sort(this.model, index);\n\t}\n\n\tsort(model, index: number) {\n\t\tif (model.header[index].sorted) {\n\t\t\t// if already sorted flip sorting direction\n\t\t\tmodel.header[index].ascending = model.header[index].descending;\n\t\t}\n\t\tmodel.sort(index);\n\t}\n\n\taddRow() {\n\t\tconst lastRowCopy = clone(this.model.row(this.model.data.length - 1));\n\t\tthis.model.addRow(lastRowCopy);\n\t}\n\n\taddColumn() {\n\t\tlet column = Array(this.model.data.length).fill(null).map(() => new TableItem({ data: `Column ${this.model.row(0).length}` }));\n\t\tthis.model.addColumn(column);\n\t}\n\n\tonRowClick(index: number) {\n\t\tconsole.log(\"Row item selected:\", index);\n\t}\n}\n",
|
|
5228
5228
|
"properties": [
|
|
5229
5229
|
{
|
|
5230
5230
|
"name": "ariaSortLabel",
|
|
@@ -12509,12 +12509,12 @@
|
|
|
12509
12509
|
},
|
|
12510
12510
|
{
|
|
12511
12511
|
"name": "IconDirective",
|
|
12512
|
-
"id": "directive-IconDirective-
|
|
12512
|
+
"id": "directive-IconDirective-8463d60dfe16c7bcf8a3776aa062892b7dd8d0f0d8ceaa3f80d037e1c83283698ccdba55f20b7202922f234b399c05507119f32acd459dd7ffc168fdd0b768e4",
|
|
12513
12513
|
"file": "src/icon/icon.directive.ts",
|
|
12514
12514
|
"type": "directive",
|
|
12515
12515
|
"description": "<p>A directive for applying styling to an input element.</p>\n<p>Example:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><input cdsText/></code></pre></div><p>See the <a href=\"http://www.carbondesignsystem.com/components/text-input/code\">vanilla carbon docs</a> for more detail.</p>\n",
|
|
12516
12516
|
"rawdescription": "\n\nA directive for applying styling to an input element.\n\nExample:\n\n```html\n<input cdsText/>\n```\n\nSee the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n",
|
|
12517
|
-
"sourceCode": "import {\n\tAfterViewInit,\n\tDirective,\n\tElementRef,\n\tInput,\n\tOnChanges,\n\tSimpleChanges\n} from \"@angular/core\";\nimport { IconService } from \"./icon.service\";\nimport { getAttributes } from \"@carbon/icon-helpers\";\n\n/**\n * A directive for applying styling to an input element.\n *\n * Example:\n *\n * ```html\n * <input cdsText/>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsIcon], [ibmIcon]\"\n})\nexport class IconDirective implements AfterViewInit, OnChanges {\n\n\t/**\n\t * @deprecated since v5 - Use `cdsIcon` input property instead\n\t */\n\t@Input() set ibmIcon(iconName: string) {\n\t\tthis.cdsIcon = iconName;\n\t}\n\n\tstatic titleIdCounter = 0;\n\n\t@Input() cdsIcon = \"\";\n\n\t@Input() size = \"16\";\n\n\t@Input() title = \"\";\n\n\t@Input() ariaLabel = \"\";\n\n\t@Input() ariaLabelledBy = \"\";\n\n\t@Input() ariaHidden = \"\";\n\n\t@Input() isFocusable = false;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected iconService: IconService\n\t) {}\n\n\trenderIcon(iconName: string) {\n\t\tconst root = this.elementRef.nativeElement as HTMLElement;\n\n\t\tlet icon;\n\t\ttry {\n\t\t\ticon = this.iconService.get(iconName, this.size.toString());\n\t\t} catch (error) {\n\t\t\tconsole.warn(error);\n\t\t\t// bail out\n\t\t\treturn;\n\t\t}\n\n\t\tconst domParser = new DOMParser();\n\t\tconst rawSVG = icon.svg;\n\t\tconst svgElement = domParser.parseFromString(rawSVG, \"image/svg+xml\").documentElement;\n\n\t\tlet node: ChildNode = root.tagName.toUpperCase() !== \"SVG\" ? svgElement : svgElement.firstChild;\n\t\troot.innerHTML = \"\"; // Clear root element\n\t\twhile (node) {\n\t\t\t// importNode makes a clone of the node\n\t\t\t// this ensures we keep looping over the nodes in the parsed document\n\t\t\troot.appendChild(root.ownerDocument.importNode(node, true));\n\t\t\t// type the node because the angular compiler freaks out if it\n\t\t\t// ends up thinking it's a `Node` instead of a `ChildNode`\n\t\t\tnode = node.nextSibling as ChildNode;\n\t\t}\n\n\t\tconst svg = root.tagName.toUpperCase() !== \"SVG\" ? svgElement : root;\n\t\tsvg.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n\n\t\tconst attributes = getAttributes({\n\t\t\twidth: icon.attrs.width,\n\t\t\theight: icon.attrs.height,\n\t\t\tviewBox: icon.attrs.viewBox,\n\t\t\ttitle: this.title,\n\t\t\t\"aria-label\": this.ariaLabel,\n\t\t\t\"aria-labelledby\": this.ariaLabelledBy,\n\t\t\t\"aria-hidden\": this.ariaHidden,\n\t\t\tfocusable: this.isFocusable.toString()\n\t\t});\n\n\t\tconst attrKeys = Object.keys(attributes);\n\t\tfor (let i = 0; i < attrKeys.length; i++) {\n\t\t\tconst key = attrKeys[i];\n\t\t\tconst value = attributes[key];\n\n\t\t\tif (key === \"title\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tsvg.setAttribute(key, value);\n\t\t\t}\n\t\t}\n\n\t\tif (attributes[\"title\"]) {\n\t\t\tconst title = document.createElement(\"title\");\n\t\t\ttitle.textContent = attributes.title;\n\t\t\tIconDirective.titleIdCounter++;\n\t\t\ttitle.setAttribute(\"id\", `${icon.name}-title-${IconDirective.titleIdCounter}`);\n\t\t\t// title must be first for screen readers\n\t\t\tsvg.insertBefore(title, svg.firstElementChild);\n\t\t\tsvg.setAttribute(\"aria-labelledby\", `${icon.name}-title-${IconDirective.titleIdCounter}`);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tthis.renderIcon(this.cdsIcon);\n\t}\n\n\tngOnChanges({ cdsIcon }: SimpleChanges) {\n\t\t// We want to ignore first change to let the icon register\n\t\t// and add only after view has been initialized\n\t\tif (!cdsIcon.isFirstChange()) {\n\t\t\tthis.renderIcon(this.cdsIcon);\n\t\t}\n\t}\n}\n",
|
|
12517
|
+
"sourceCode": "import {\n\tAfterViewInit,\n\tDirective,\n\tElementRef,\n\tInput,\n\tOnChanges,\n\tSimpleChanges\n} from \"@angular/core\";\nimport { IconService } from \"./icon.service\";\nimport { getAttributes } from \"@carbon/icon-helpers\";\n\n/**\n * A directive for applying styling to an input element.\n *\n * Example:\n *\n * ```html\n * <input cdsText/>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsIcon], [ibmIcon]\"\n})\nexport class IconDirective implements AfterViewInit, OnChanges {\n\n\t/**\n\t * @deprecated since v5 - Use `cdsIcon` input property instead\n\t */\n\t@Input() set ibmIcon(iconName: string) {\n\t\tthis.cdsIcon = iconName;\n\t}\n\n\tstatic titleIdCounter = 0;\n\n\t@Input() cdsIcon = \"\";\n\n\t@Input() size = \"16\";\n\n\t@Input() title = \"\";\n\n\t@Input() ariaLabel = \"\";\n\n\t@Input() ariaLabelledBy = \"\";\n\n\t@Input() ariaHidden = \"\";\n\n\t@Input() isFocusable = false;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected iconService: IconService\n\t) {}\n\n\trenderIcon(iconName: string) {\n\t\tconst root = this.elementRef.nativeElement as HTMLElement;\n\n\t\tlet icon;\n\t\ttry {\n\t\t\ticon = this.iconService.get(iconName, this.size.toString());\n\t\t} catch (error) {\n\t\t\tconsole.warn(error);\n\t\t\t// bail out\n\t\t\treturn;\n\t\t}\n\n\t\tconst domParser = new DOMParser();\n\t\tconst rawSVG = icon.svg;\n\t\tconst svgElement = domParser.parseFromString(rawSVG, \"image/svg+xml\").documentElement;\n\n\t\tlet node: ChildNode = root.tagName.toUpperCase() !== \"SVG\" ? svgElement : svgElement.firstChild;\n\t\troot.innerHTML = \"\"; // Clear root element\n\t\twhile (node) {\n\t\t\t// importNode makes a clone of the node\n\t\t\t// this ensures we keep looping over the nodes in the parsed document\n\t\t\troot.appendChild(root.ownerDocument.importNode(node, true));\n\t\t\t// type the node because the angular compiler freaks out if it\n\t\t\t// ends up thinking it's a `Node` instead of a `ChildNode`\n\t\t\tnode = node.nextSibling as ChildNode;\n\t\t}\n\n\t\tconst svg = root.tagName.toUpperCase() !== \"SVG\" ? svgElement : root;\n\t\tsvg.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n\n\t\tconst attributes = getAttributes({\n\t\t\twidth: icon.attrs.width,\n\t\t\theight: icon.attrs.height,\n\t\t\tviewBox: icon.attrs.viewBox,\n\t\t\ttitle: this.title,\n\t\t\t\"aria-label\": this.ariaLabel,\n\t\t\t\"aria-labelledby\": this.ariaLabelledBy,\n\t\t\t\"aria-hidden\": this.ariaHidden,\n\t\t\tfocusable: this.isFocusable.toString()\n\t\t});\n\n\t\tconst attrKeys = Object.keys(attributes);\n\t\tfor (let i = 0; i < attrKeys.length; i++) {\n\t\t\tconst key = attrKeys[i];\n\t\t\tconst value = attributes[key];\n\n\t\t\tif (key === \"title\") {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tsvg.setAttribute(key, value);\n\t\t\t}\n\t\t}\n\n\t\tif (attributes[\"title\"]) {\n\t\t\tconst title = document.createElement(\"title\");\n\t\t\ttitle.textContent = attributes.title;\n\t\t\tIconDirective.titleIdCounter++;\n\t\t\ttitle.setAttribute(\"id\", `${icon.name}-title-${IconDirective.titleIdCounter}`);\n\t\t\t// title must be first for screen readers\n\t\t\tsvg.insertBefore(title, svg.firstElementChild);\n\t\t\tsvg.setAttribute(\"aria-labelledby\", `${icon.name}-title-${IconDirective.titleIdCounter}`);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tthis.renderIcon(this.cdsIcon);\n\t}\n\n\tngOnChanges({ cdsIcon }: SimpleChanges) {\n\t\t// We want to ignore first change to let the icon register\n\t\t// and add only after view has been initialized\n\t\tif (cdsIcon && !cdsIcon.isFirstChange()) {\n\t\t\tthis.renderIcon(this.cdsIcon);\n\t\t}\n\t}\n}\n",
|
|
12518
12518
|
"selector": "[cdsIcon], [ibmIcon]",
|
|
12519
12519
|
"providers": [],
|
|
12520
12520
|
"hostDirectives": [],
|
|
@@ -28402,7 +28402,7 @@
|
|
|
28402
28402
|
},
|
|
28403
28403
|
{
|
|
28404
28404
|
"name": "DynamicTableStory",
|
|
28405
|
-
"id": "component-DynamicTableStory-
|
|
28405
|
+
"id": "component-DynamicTableStory-43dec1fee39d015661af87a2e0758230b3fe81f583b813b9295a920fa61c1f02e93d480424afab37673e46ee64fddb53093c74715a7b4269e5e642504d5fa75b",
|
|
28406
28406
|
"file": "src/table/stories/app-custom-table.component.ts",
|
|
28407
28407
|
"encapsulation": [],
|
|
28408
28408
|
"entryComponents": [],
|
|
@@ -28622,12 +28622,12 @@
|
|
|
28622
28622
|
"description": "",
|
|
28623
28623
|
"rawdescription": "\n",
|
|
28624
28624
|
"type": "component",
|
|
28625
|
-
"sourceCode": "import {\n\tTemplateRef,\n\tComponent,\n\tViewChild,\n\
|
|
28625
|
+
"sourceCode": "import {\n\tTemplateRef,\n\tComponent,\n\tViewChild,\n\tInput,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { TableModel } from \"../table-model.class\";\nimport { TableItem } from \"../table-item.class\";\nimport { TableHeaderItem } from \"../table-header-item.class\";\nimport { clone } from \"../../utils/index\";\n\nexport class CustomHeaderItem extends TableHeaderItem {\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@Component({\n\tselector: \"app-custom-table\",\n\ttemplate: `\n\t\t<cds-table-toolbar [model]=\"model\">\n\t\t\t<button cdsButton=\"primary\" (click)=\"addRow()\">Add row</button>\n\t\t\t<button cdsButton=\"primary\" (click)=\"addColumn()\">Add column</button>\n\t\t</cds-table-toolbar>\n\n\t\t<ng-template #customTableItemTemplate let-data=\"data\">\n\t\t\t<a [attr.href]=\"data.link\">{{data.name}} {{data.surname}}</a>\n\t\t</ng-template>\n\t\t<ng-template #customHeaderTemplate let-data=\"data\">\n\t\t\t<i cdsTableHeadCellLabel><a [attr.href]=\"data.link\">{{data.name}}</a></i>\n\t\t</ng-template>\n\n\t\t<cds-table\n\t\t\t[model]=\"model\"\n\t\t\t[size]=\"size\"\n\t\t\t[sortable]=\"sortable\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t\t[stickyHeader]=\"stickyHeader\"\n\t\t\t[striped]=\"striped\"\n\t\t\t[isDataGrid]=\"isDataGrid\"\n\t\t\t(rowClick)=\"onRowClick($event)\"\n\t\t\t(sort)=\"customSort($event)\">\n\t\t</cds-table>\n\t`\n})\nexport class DynamicTableStory implements AfterViewInit {\n\t@Input() model = new TableModel();\n\t@Input() size = \"md\";\n\t@Input() showSelectionColumn = true;\n\t@Input() striped = true;\n\t@Input() isDataGrid = false;\n\t@Input() sortable = true;\n\t@Input() stickyHeader = false;\n\t@Input() skeleton = false;\n\n\t@ViewChild(\"customHeaderTemplate\")\n\tprotected customHeaderTemplate: TemplateRef<any>;\n\n\t@ViewChild(\"customTableItemTemplate\")\n\tprotected customTableItemTemplate: TemplateRef<any>;\n\n\tngAfterViewInit() {\n\t\tthis.model.data = [\n\t\t\t[new TableItem({ data: \"Name 1\" }), new TableItem({ data: { name: \"Lessy\", link: \"#\" }, template: this.customTableItemTemplate })],\n\t\t\t[new TableItem({ data: \"Name 3\" }), new TableItem({ data: \"swer\" })],\n\t\t\t[new TableItem({ data: \"Name 2\" }), new TableItem({ data: { name: \"Alice\", surname: \"Bob\" }, template: this.customTableItemTemplate })],\n\t\t\t[new TableItem({ data: \"Name 4\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 5\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 6\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 7\" }), new TableItem({ data: \"twer\" })],\n\t\t\t[new TableItem({ data: \"Name 8\" }), new TableItem({ data: \"twer\" })]\n\t\t];\n\t\tthis.model.header = [\n\t\t\tnew TableHeaderItem({ data: \"Very long title indeed\" }),\n\t\t\tnew CustomHeaderItem({\n\t\t\t\tdata: { name: \"Custom header\", link: \"#\" },\n\t\t\t\ttemplate: this.customHeaderTemplate,\n\t\t\t\tariaSortLabel: \"Custom header\"\n\t\t\t})\n\t\t];\n\t}\n\n\tcustomSort(index: number) {\n\t\tthis.sort(this.model, index);\n\t}\n\n\tsort(model, index: number) {\n\t\tif (model.header[index].sorted) {\n\t\t\t// if already sorted flip sorting direction\n\t\t\tmodel.header[index].ascending = model.header[index].descending;\n\t\t}\n\t\tmodel.sort(index);\n\t}\n\n\taddRow() {\n\t\tconst lastRowCopy = clone(this.model.row(this.model.data.length - 1));\n\t\tthis.model.addRow(lastRowCopy);\n\t}\n\n\taddColumn() {\n\t\tlet column = Array(this.model.data.length).fill(null).map(() => new TableItem({ data: `Column ${this.model.row(0).length}` }));\n\t\tthis.model.addColumn(column);\n\t}\n\n\tonRowClick(index: number) {\n\t\tconsole.log(\"Row item selected:\", index);\n\t}\n}\n",
|
|
28626
28626
|
"assetsDirs": [],
|
|
28627
28627
|
"styleUrlsData": "",
|
|
28628
28628
|
"stylesData": "",
|
|
28629
28629
|
"implements": [
|
|
28630
|
-
"
|
|
28630
|
+
"AfterViewInit"
|
|
28631
28631
|
]
|
|
28632
28632
|
},
|
|
28633
28633
|
{
|
|
@@ -33235,7 +33235,7 @@
|
|
|
33235
33235
|
},
|
|
33236
33236
|
{
|
|
33237
33237
|
"name": "Label",
|
|
33238
|
-
"id": "component-Label-
|
|
33238
|
+
"id": "component-Label-85ae03d1a6f24f3865f358410eff294acd9616a673c528045d0ad91a9ea366a3617c8675b4032ff09ed32efc5bb71effe767001bfad2a6ea8c435946c2bf4275",
|
|
33239
33239
|
"file": "src/input/label.component.ts",
|
|
33240
33240
|
"encapsulation": [],
|
|
33241
33241
|
"entryComponents": [],
|
|
@@ -33245,7 +33245,7 @@
|
|
|
33245
33245
|
"selector": "cds-label, ibm-label",
|
|
33246
33246
|
"styleUrls": [],
|
|
33247
33247
|
"styles": [],
|
|
33248
|
-
"template": "<ng-template #inputContentTemplate>\n\t<ng-content select=\"input,textarea,div\"></ng-content>\n</ng-template>\n\n<ng-template #labelContentTemplate>\n\t<ng-content></ng-content>\n</ng-template>\n\n<ng-container [ngSwitch]=\"type\">\n\t<ng-container *ngSwitchCase=\"'TextArea'\">\n\t\t<cds-textarea-label\n\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t[textAreaTemplate]=\"inputContentTemplate\">\n\t\t</cds-textarea-label>\n\t</ng-container>\n\t<ng-container *ngSwitchCase=\"'TextInput'\">\n\t\t<cds-text-label\n\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t[textInputTemplate]=\"inputContentTemplate\">\n\t\t</cds-text-label>\n\t</ng-container>\n\t<ng-container *ngSwitchDefault>\n\t\t<ng-template [ngTemplateOutlet]=\"default\"></ng-template>\n\t</ng-container>\n</ng-container>\n\n<ng-template #default>\n\t<label\n\t\t[for]=\"labelInputID\"\n\t\t[attr.aria-label]=\"ariaLabel\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--skeleton': skeleton\n\t\t}\">\n\t\t<ng-template [ngTemplateOutlet]=\"labelContentTemplate\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t}\"\n\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t#wrapper>\n\t\t<svg\n\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\
|
|
33248
|
+
"template": "<ng-template #inputContentTemplate>\n\t<ng-content select=\"input,textarea,div\"></ng-content>\n</ng-template>\n\n<ng-template #labelContentTemplate>\n\t<ng-content></ng-content>\n</ng-template>\n\n<ng-container [ngSwitch]=\"type\">\n\t<ng-container *ngSwitchCase=\"'TextArea'\">\n\t\t<cds-textarea-label\n\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t[textAreaTemplate]=\"inputContentTemplate\">\n\t\t</cds-textarea-label>\n\t</ng-container>\n\t<ng-container *ngSwitchCase=\"'TextInput'\">\n\t\t<cds-text-label\n\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t[textInputTemplate]=\"inputContentTemplate\">\n\t\t</cds-text-label>\n\t</ng-container>\n\t<ng-container *ngSwitchDefault>\n\t\t<ng-template [ngTemplateOutlet]=\"default\"></ng-template>\n\t</ng-container>\n</ng-container>\n\n<ng-template #default>\n\t<label\n\t\t[for]=\"labelInputID\"\n\t\t[attr.aria-label]=\"ariaLabel\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--skeleton': skeleton\n\t\t}\">\n\t\t<ng-template [ngTemplateOutlet]=\"labelContentTemplate\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t}\"\n\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t#wrapper>\n\t\t<svg\n\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--text-input__invalid-icon\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t\t</svg>\n\t\t<ng-template [ngTemplateOutlet]=\"inputContentTemplate\"></ng-template>\n\t</div>\n\t<div\n\t\t*ngIf=\"!skeleton && helperText && !invalid && !warn\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n</ng-template>\n\t",
|
|
33249
33249
|
"templateUrl": [],
|
|
33250
33250
|
"viewProviders": [],
|
|
33251
33251
|
"hostDirectives": [],
|
|
@@ -33477,7 +33477,7 @@
|
|
|
33477
33477
|
"description": "<p><a href=\"../../?path=/story/components-input--label\">See demo</a></p>\n<p>To prevent attribute drilling, use <code>ibm-text-label</code> or <code>ibm-textarea-label</code> components</p>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-label>\n Label\n <input cdsText type="text" class="input-field">\n</cds-label></code></pre></div>",
|
|
33478
33478
|
"rawdescription": "\n\n[See demo](../../?path=/story/components-input--label)\n\nTo prevent attribute drilling, use `ibm-text-label` or `ibm-textarea-label` components\n\n```html\n<cds-label>\n\tLabel\n\t<input cdsText type=\"text\" class=\"input-field\">\n</cds-label>\n```\n",
|
|
33479
33479
|
"type": "component",
|
|
33480
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tContentChild,\n\tAfterContentInit,\n\tChangeDetectorRef\n} from \"@angular/core\";\n\nimport { TextArea } from \"./text-area.directive\";\nimport { TextInput } from \"./input.directive\";\n\n/**\n * [See demo](../../?path=/story/components-input--label)\n *\n * To prevent attribute drilling, use `ibm-text-label` or `ibm-textarea-label` components\n *\n * ```html\n * <cds-label>\n * \tLabel\n * \t<input cdsText type=\"text\" class=\"input-field\">\n * </cds-label>\n * ```\n */\n@Component({\n\tselector: \"cds-label, ibm-label\",\n\ttemplate: `\n\t\t<ng-template #inputContentTemplate>\n\t\t\t<ng-content select=\"input,textarea,div\"></ng-content>\n\t\t</ng-template>\n\n\t\t<ng-template #labelContentTemplate>\n\t\t\t<ng-content></ng-content>\n\t\t</ng-template>\n\n\t\t<ng-container [ngSwitch]=\"type\">\n\t\t\t<ng-container *ngSwitchCase=\"'TextArea'\">\n\t\t\t\t<cds-textarea-label\n\t\t\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t\t\t[textAreaTemplate]=\"inputContentTemplate\">\n\t\t\t\t</cds-textarea-label>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngSwitchCase=\"'TextInput'\">\n\t\t\t\t<cds-text-label\n\t\t\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t\t\t[textInputTemplate]=\"inputContentTemplate\">\n\t\t\t\t</cds-text-label>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngSwitchDefault>\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"default\"></ng-template>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\n\t\t<ng-template #default>\n\t\t\t<label\n\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--skeleton': skeleton\n\t\t\t\t}\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"labelContentTemplate\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t\t\t}\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t#wrapper>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\t\
|
|
33480
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tContentChild,\n\tAfterContentInit,\n\tChangeDetectorRef\n} from \"@angular/core\";\n\nimport { TextArea } from \"./text-area.directive\";\nimport { TextInput } from \"./input.directive\";\n\n/**\n * [See demo](../../?path=/story/components-input--label)\n *\n * To prevent attribute drilling, use `ibm-text-label` or `ibm-textarea-label` components\n *\n * ```html\n * <cds-label>\n * \tLabel\n * \t<input cdsText type=\"text\" class=\"input-field\">\n * </cds-label>\n * ```\n */\n@Component({\n\tselector: \"cds-label, ibm-label\",\n\ttemplate: `\n\t\t<ng-template #inputContentTemplate>\n\t\t\t<ng-content select=\"input,textarea,div\"></ng-content>\n\t\t</ng-template>\n\n\t\t<ng-template #labelContentTemplate>\n\t\t\t<ng-content></ng-content>\n\t\t</ng-template>\n\n\t\t<ng-container [ngSwitch]=\"type\">\n\t\t\t<ng-container *ngSwitchCase=\"'TextArea'\">\n\t\t\t\t<cds-textarea-label\n\t\t\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t\t\t[textAreaTemplate]=\"inputContentTemplate\">\n\t\t\t\t</cds-textarea-label>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngSwitchCase=\"'TextInput'\">\n\t\t\t\t<cds-text-label\n\t\t\t\t\t[labelInputID]=\"labelInputID\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[ariaLabel]=\"ariaLabel\"\n\t\t\t\t\t[labelTemplate]=\"labelContentTemplate\"\n\t\t\t\t\t[textInputTemplate]=\"inputContentTemplate\">\n\t\t\t\t</cds-text-label>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngSwitchDefault>\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"default\"></ng-template>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\n\t\t<ng-template #default>\n\t\t\t<label\n\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--skeleton': skeleton\n\t\t\t\t}\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"labelContentTemplate\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t\t\t}\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t#wrapper>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-input__invalid-icon\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"inputContentTemplate\"></ng-template>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"!skeleton && helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</ng-template>\n\t`\n})\nexport class Label implements AfterContentInit, AfterViewInit {\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = `cds-label-${Label.labelCounter++}`;\n\t/**\n\t * Set to `true` for disabled state.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t@ViewChild(\"wrapper\") wrapper: ElementRef<HTMLDivElement>;\n\n\t@ContentChild(TextArea) textArea: TextArea;\n\n\t// @ts-ignore\n\t@ContentChild(TextInput, { static: false }) textInput: TextInput;\n\n\t@HostBinding(\"class.cds--form-item\") get labelClass() {\n\t\treturn this.type === undefined;\n\t}\n\n\ttype: \"TextArea\" | \"TextInput\";\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Update wrapper class if a textarea is hosted.\n\t */\n\tngAfterContentInit() {\n\t\tif (this.textArea) {\n\t\t\tthis.type = \"TextArea\";\n\t\t} else if (this.textInput) {\n\t\t\tthis.type = \"TextInput\";\n\t\t}\n\t}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label`.\n\t */\n\tngAfterViewInit() {\n\t\t// Will only be called when `default` template is being used\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `input` & `textarea` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"input,textarea\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\n",
|
|
33481
33481
|
"assetsDirs": [],
|
|
33482
33482
|
"styleUrlsData": "",
|
|
33483
33483
|
"stylesData": "",
|
|
@@ -50461,7 +50461,7 @@
|
|
|
50461
50461
|
},
|
|
50462
50462
|
{
|
|
50463
50463
|
"name": "Table",
|
|
50464
|
-
"id": "component-Table-
|
|
50464
|
+
"id": "component-Table-06d4bcd125acee9b5d25fce31d35b3f30b2d06e51d6dc8beb1728c292e43ea3a7c4104c328dd70351b3808d84ae3a81818cbe0a6bfe162b938eff9ce853c8bc7",
|
|
50465
50465
|
"file": "src/table/table.component.ts",
|
|
50466
50466
|
"encapsulation": [],
|
|
50467
50467
|
"entryComponents": [],
|
|
@@ -50473,7 +50473,7 @@
|
|
|
50473
50473
|
"styles": [
|
|
50474
50474
|
"\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t"
|
|
50475
50475
|
],
|
|
50476
|
-
"template": "<table\n\tcdsTable\n\t[sortable]=\"sortable\"\n\t[noBorder]=\"noBorder\"\n\t[ngClass]=\"{'cds--data-table--sticky-header': stickyHeader}\"\n\t[size]=\"size\"\n\t[striped]=\"striped\"\n\t[skeleton]=\"skeleton\"\n\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t[attr.aria-describedby]=\"ariaDescribedby\">\n\t<thead\n\t\tcdsTableHead\n\t\t[sortable]=\"sortable\"\n\t\t(deselectAll)=\"onDeselectAll()\"\n\t\t(selectAll)=\"onSelectAll()\"\n\t\t(sort)=\"doSort($event)\"\n\t\t[checkboxHeaderLabel]=\"getCheckboxHeaderLabel()\"\n\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t[model]=\"model\"\n\t\t[
|
|
50476
|
+
"template": "<table\n\tcdsTable\n\t[sortable]=\"sortable\"\n\t[noBorder]=\"noBorder\"\n\t[ngClass]=\"{'cds--data-table--sticky-header': stickyHeader}\"\n\t[size]=\"size\"\n\t[striped]=\"striped\"\n\t[skeleton]=\"skeleton\"\n\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t[attr.aria-describedby]=\"ariaDescribedby\">\n\t<thead\n\t\tcdsTableHead\n\t\t[sortable]=\"sortable\"\n\t\t(deselectAll)=\"onDeselectAll()\"\n\t\t(selectAll)=\"onSelectAll()\"\n\t\t(sort)=\"doSort($event)\"\n\t\t[checkboxHeaderLabel]=\"getCheckboxHeaderLabel()\"\n\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t[model]=\"model\"\n\t\t[selectAllCheckbox]=\"selectAllCheckbox\"\n\t\t[selectAllCheckboxSomeSelected]=\"selectAllCheckboxSomeSelected\"\n\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[sortAscendingLabel]=\"sortAscendingLabel\"\n\t\t[sortDescendingLabel]=\"sortDescendingLabel\"\n\t\t[stickyHeader]=\"stickyHeader\">\n\t</thead>\n\t<tbody\n\t\tcdsTableBody\n\t\t(deselectRow)=\"onSelectRow($event)\"\n\t\t(scroll)=\"onScroll($event)\"\n\t\t(selectRow)=\"onSelectRow($event)\"\n\t\t[checkboxRowLabel]=\"getCheckboxRowLabel()\"\n\t\t[enableSingleSelect]=\"enableSingleSelect\"\n\t\t(rowClick)=\"onRowClick($event)\"\n\t\t[expandButtonAriaLabel]=\"expandButtonAriaLabel\"\n\t\t[model]=\"model\"\n\t\t[size]=\"size\"\n\t\t[ngStyle]=\"{'overflow-y': 'scroll'}\"\n\t\t[selectionLabelColumn]=\"selectionLabelColumn\"\n\t\t[showSelectionColumn]=\"showSelectionColumn\"\n\t\t[skeleton]=\"skeleton\"\n\t\t*ngIf=\"!noData; else noDataTemplate\">\n\t</tbody>\n\t<ng-template #noDataTemplate><ng-content></ng-content></ng-template>\n\t<tfoot>\n\t\t<ng-template\n\t\t\t[ngTemplateOutlet]=\"footerTemplate\">\n\t\t</ng-template>\n\t\t<tr *ngIf=\"this.model.isLoading\">\n\t\t\t<td class=\"table_loading-indicator\">\n\t\t\t\t<div class=\"cds--loading cds--loading--small\">\n\t\t\t\t\t<svg class=\"cds--loading__svg\" viewBox=\"-75 -75 150 150\">\n\t\t\t\t\t\t<circle class=\"cds--loading__stroke\" cx=\"0\" cy=\"0\" r=\"37.5\" />\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr *ngIf=\"this.model.isEnd\">\n\t\t\t<td class=\"table_end-indicator\">\n\t\t\t\t<h5>{{getEndOfDataText() | async}}</h5>\n\t\t\t\t<button (click)=\"scrollToTop($event)\" class=\"btn--secondary-sm\">\n\t\t\t\t\t{{getScrollTopText() | async}}\n\t\t\t\t</button>\n\t\t\t</td>\n\t\t</tr>\n\t</tfoot>\n</table>\n",
|
|
50477
50477
|
"templateUrl": [],
|
|
50478
50478
|
"viewProviders": [],
|
|
50479
50479
|
"hostDirectives": [],
|
|
@@ -50484,7 +50484,7 @@
|
|
|
50484
50484
|
"deprecationMessage": "",
|
|
50485
50485
|
"rawdescription": "\n\nId of the table header description element\n",
|
|
50486
50486
|
"description": "<p>Id of the table header description element</p>\n",
|
|
50487
|
-
"line":
|
|
50487
|
+
"line": 308,
|
|
50488
50488
|
"type": "string",
|
|
50489
50489
|
"decorators": []
|
|
50490
50490
|
},
|
|
@@ -50494,7 +50494,7 @@
|
|
|
50494
50494
|
"deprecationMessage": "",
|
|
50495
50495
|
"rawdescription": "\n\nId of the table header title element\n",
|
|
50496
50496
|
"description": "<p>Id of the table header title element</p>\n",
|
|
50497
|
-
"line":
|
|
50497
|
+
"line": 304,
|
|
50498
50498
|
"type": "string",
|
|
50499
50499
|
"decorators": []
|
|
50500
50500
|
},
|
|
@@ -50505,7 +50505,7 @@
|
|
|
50505
50505
|
"deprecationMessage": "",
|
|
50506
50506
|
"rawdescription": "\n\nControls whether to enable multiple or single row selection.\n",
|
|
50507
50507
|
"description": "<p>Controls whether to enable multiple or single row selection.</p>\n",
|
|
50508
|
-
"line":
|
|
50508
|
+
"line": 397,
|
|
50509
50509
|
"type": "boolean",
|
|
50510
50510
|
"decorators": []
|
|
50511
50511
|
},
|
|
@@ -50515,15 +50515,15 @@
|
|
|
50515
50515
|
"deprecationMessage": "",
|
|
50516
50516
|
"jsdoctags": [
|
|
50517
50517
|
{
|
|
50518
|
-
"pos":
|
|
50519
|
-
"end":
|
|
50518
|
+
"pos": 12372,
|
|
50519
|
+
"end": 12552,
|
|
50520
50520
|
"flags": 8421376,
|
|
50521
50521
|
"modifierFlagsCache": 0,
|
|
50522
50522
|
"transformFlags": 0,
|
|
50523
50523
|
"kind": 330,
|
|
50524
50524
|
"tagName": {
|
|
50525
|
-
"pos":
|
|
50526
|
-
"end":
|
|
50525
|
+
"pos": 12373,
|
|
50526
|
+
"end": 12377,
|
|
50527
50527
|
"flags": 8421376,
|
|
50528
50528
|
"modifierFlagsCache": 0,
|
|
50529
50529
|
"transformFlags": 0,
|
|
@@ -50533,7 +50533,7 @@
|
|
|
50533
50533
|
"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"
|
|
50534
50534
|
}
|
|
50535
50535
|
],
|
|
50536
|
-
"line":
|
|
50536
|
+
"line": 425,
|
|
50537
50537
|
"type": "string | Observable",
|
|
50538
50538
|
"decorators": []
|
|
50539
50539
|
},
|
|
@@ -50543,7 +50543,7 @@
|
|
|
50543
50543
|
"deprecationMessage": "",
|
|
50544
50544
|
"rawdescription": "\n\nSet footer template to customize what is displayed in the tfoot section of the table\n",
|
|
50545
50545
|
"description": "<p>Set footer template to customize what is displayed in the tfoot section of the table</p>\n",
|
|
50546
|
-
"line":
|
|
50546
|
+
"line": 486,
|
|
50547
50547
|
"type": "TemplateRef<any>",
|
|
50548
50548
|
"decorators": []
|
|
50549
50549
|
},
|
|
@@ -50553,7 +50553,7 @@
|
|
|
50553
50553
|
"deprecationMessage": "",
|
|
50554
50554
|
"rawdescription": "\n\nSet to `true` for a data grid with keyboard interactions.\n",
|
|
50555
50555
|
"description": "<p>Set to <code>true</code> for a data grid with keyboard interactions.</p>\n",
|
|
50556
|
-
"line":
|
|
50556
|
+
"line": 366,
|
|
50557
50557
|
"type": "boolean",
|
|
50558
50558
|
"decorators": []
|
|
50559
50559
|
},
|
|
@@ -50563,7 +50563,7 @@
|
|
|
50563
50563
|
"deprecationMessage": "",
|
|
50564
50564
|
"rawdescription": "\n\n`TableModel` with data the table is to display.\n",
|
|
50565
50565
|
"description": "<p><code>TableModel</code> with data the table is to display.</p>\n",
|
|
50566
|
-
"line":
|
|
50566
|
+
"line": 314,
|
|
50567
50567
|
"type": "TableModel",
|
|
50568
50568
|
"decorators": []
|
|
50569
50569
|
},
|
|
@@ -50572,7 +50572,7 @@
|
|
|
50572
50572
|
"defaultValue": "true",
|
|
50573
50573
|
"deprecated": false,
|
|
50574
50574
|
"deprecationMessage": "",
|
|
50575
|
-
"line":
|
|
50575
|
+
"line": 383,
|
|
50576
50576
|
"type": "boolean",
|
|
50577
50577
|
"decorators": []
|
|
50578
50578
|
},
|
|
@@ -50583,7 +50583,7 @@
|
|
|
50583
50583
|
"deprecationMessage": "",
|
|
50584
50584
|
"rawdescription": "\n\nDistance (in px) from the bottom that view has to reach before\n`scrollLoad` event is emitted.\n",
|
|
50585
50585
|
"description": "<p>Distance (in px) from the bottom that view has to reach before\n<code>scrollLoad</code> event is emitted.</p>\n",
|
|
50586
|
-
"line":
|
|
50586
|
+
"line": 403,
|
|
50587
50587
|
"type": "number",
|
|
50588
50588
|
"decorators": []
|
|
50589
50589
|
},
|
|
@@ -50593,7 +50593,7 @@
|
|
|
50593
50593
|
"deprecationMessage": "",
|
|
50594
50594
|
"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",
|
|
50595
50595
|
"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>",
|
|
50596
|
-
"line":
|
|
50596
|
+
"line": 498,
|
|
50597
50597
|
"type": "number",
|
|
50598
50598
|
"decorators": []
|
|
50599
50599
|
},
|
|
@@ -50604,7 +50604,7 @@
|
|
|
50604
50604
|
"deprecationMessage": "",
|
|
50605
50605
|
"rawdescription": "\n\nControls whether to show the selection checkboxes column or not.\n",
|
|
50606
50606
|
"description": "<p>Controls whether to show the selection checkboxes column or not.</p>\n",
|
|
50607
|
-
"line":
|
|
50607
|
+
"line": 392,
|
|
50608
50608
|
"type": "boolean",
|
|
50609
50609
|
"decorators": []
|
|
50610
50610
|
},
|
|
@@ -50615,7 +50615,7 @@
|
|
|
50615
50615
|
"deprecationMessage": "",
|
|
50616
50616
|
"rawdescription": "\n\nSize of the table rows.\n",
|
|
50617
50617
|
"description": "<p>Size of the table rows.</p>\n",
|
|
50618
|
-
"line":
|
|
50618
|
+
"line": 358,
|
|
50619
50619
|
"type": "TableRowSize",
|
|
50620
50620
|
"decorators": []
|
|
50621
50621
|
},
|
|
@@ -50626,7 +50626,7 @@
|
|
|
50626
50626
|
"deprecationMessage": "",
|
|
50627
50627
|
"rawdescription": "\n\nSet to `true` for a loading table.\n",
|
|
50628
50628
|
"description": "<p>Set to <code>true</code> for a loading table.</p>\n",
|
|
50629
|
-
"line":
|
|
50629
|
+
"line": 362,
|
|
50630
50630
|
"type": "boolean",
|
|
50631
50631
|
"decorators": []
|
|
50632
50632
|
},
|
|
@@ -50637,7 +50637,7 @@
|
|
|
50637
50637
|
"deprecationMessage": "",
|
|
50638
50638
|
"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",
|
|
50639
50639
|
"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",
|
|
50640
|
-
"line":
|
|
50640
|
+
"line": 381,
|
|
50641
50641
|
"type": "boolean",
|
|
50642
50642
|
"decorators": []
|
|
50643
50643
|
},
|
|
@@ -50645,7 +50645,7 @@
|
|
|
50645
50645
|
"name": "sortAscendingLabel",
|
|
50646
50646
|
"deprecated": false,
|
|
50647
50647
|
"deprecationMessage": "",
|
|
50648
|
-
"line":
|
|
50648
|
+
"line": 439,
|
|
50649
50649
|
"type": "string | Observable",
|
|
50650
50650
|
"decorators": []
|
|
50651
50651
|
},
|
|
@@ -50653,7 +50653,7 @@
|
|
|
50653
50653
|
"name": "sortDescendingLabel",
|
|
50654
50654
|
"deprecated": false,
|
|
50655
50655
|
"deprecationMessage": "",
|
|
50656
|
-
"line":
|
|
50656
|
+
"line": 432,
|
|
50657
50657
|
"type": "string | Observable",
|
|
50658
50658
|
"decorators": []
|
|
50659
50659
|
},
|
|
@@ -50664,7 +50664,7 @@
|
|
|
50664
50664
|
"deprecationMessage": "",
|
|
50665
50665
|
"rawdescription": "\n\nSet to `true` to stick the header to the top of the table\n",
|
|
50666
50666
|
"description": "<p>Set to <code>true</code> to stick the header to the top of the table</p>\n",
|
|
50667
|
-
"line":
|
|
50667
|
+
"line": 481,
|
|
50668
50668
|
"type": "boolean",
|
|
50669
50669
|
"decorators": []
|
|
50670
50670
|
},
|
|
@@ -50675,7 +50675,7 @@
|
|
|
50675
50675
|
"deprecationMessage": "",
|
|
50676
50676
|
"rawdescription": "\n\nSet to `false` to remove table rows (zebra) stripes.\n",
|
|
50677
50677
|
"description": "<p>Set to <code>false</code> to remove table rows (zebra) stripes.</p>\n",
|
|
50678
|
-
"line":
|
|
50678
|
+
"line": 471,
|
|
50679
50679
|
"type": "boolean",
|
|
50680
50680
|
"decorators": []
|
|
50681
50681
|
},
|
|
@@ -50685,7 +50685,7 @@
|
|
|
50685
50685
|
"deprecationMessage": "",
|
|
50686
50686
|
"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",
|
|
50687
50687
|
"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>",
|
|
50688
|
-
"line":
|
|
50688
|
+
"line": 459,
|
|
50689
50689
|
"type": "any",
|
|
50690
50690
|
"decorators": []
|
|
50691
50691
|
}
|
|
@@ -50700,15 +50700,15 @@
|
|
|
50700
50700
|
"description": "<p>Emits if all rows are deselected.</p>\n",
|
|
50701
50701
|
"jsdoctags": [
|
|
50702
50702
|
{
|
|
50703
|
-
"pos":
|
|
50704
|
-
"end":
|
|
50703
|
+
"pos": 17272,
|
|
50704
|
+
"end": 17287,
|
|
50705
50705
|
"flags": 8421376,
|
|
50706
50706
|
"modifierFlagsCache": 0,
|
|
50707
50707
|
"transformFlags": 0,
|
|
50708
50708
|
"kind": 344,
|
|
50709
50709
|
"tagName": {
|
|
50710
|
-
"pos":
|
|
50711
|
-
"end":
|
|
50710
|
+
"pos": 17273,
|
|
50711
|
+
"end": 17278,
|
|
50712
50712
|
"flags": 8421376,
|
|
50713
50713
|
"modifierFlagsCache": 0,
|
|
50714
50714
|
"transformFlags": 0,
|
|
@@ -50717,8 +50717,8 @@
|
|
|
50717
50717
|
},
|
|
50718
50718
|
"comment": "",
|
|
50719
50719
|
"name": {
|
|
50720
|
-
"pos":
|
|
50721
|
-
"end":
|
|
50720
|
+
"pos": 17279,
|
|
50721
|
+
"end": 17284,
|
|
50722
50722
|
"flags": 8421376,
|
|
50723
50723
|
"modifierFlagsCache": 0,
|
|
50724
50724
|
"transformFlags": 0,
|
|
@@ -50729,7 +50729,7 @@
|
|
|
50729
50729
|
"isBracketed": false
|
|
50730
50730
|
}
|
|
50731
50731
|
],
|
|
50732
|
-
"line":
|
|
50732
|
+
"line": 570,
|
|
50733
50733
|
"type": "EventEmitter"
|
|
50734
50734
|
},
|
|
50735
50735
|
{
|
|
@@ -50741,15 +50741,15 @@
|
|
|
50741
50741
|
"description": "<p>Emits if a single row is deselected.</p>\n",
|
|
50742
50742
|
"jsdoctags": [
|
|
50743
50743
|
{
|
|
50744
|
-
"pos":
|
|
50745
|
-
"end":
|
|
50744
|
+
"pos": 17561,
|
|
50745
|
+
"end": 17619,
|
|
50746
50746
|
"flags": 8421376,
|
|
50747
50747
|
"modifierFlagsCache": 0,
|
|
50748
50748
|
"transformFlags": 0,
|
|
50749
50749
|
"kind": 344,
|
|
50750
50750
|
"tagName": {
|
|
50751
|
-
"pos":
|
|
50752
|
-
"end":
|
|
50751
|
+
"pos": 17562,
|
|
50752
|
+
"end": 17567,
|
|
50753
50753
|
"flags": 8421376,
|
|
50754
50754
|
"modifierFlagsCache": 0,
|
|
50755
50755
|
"transformFlags": 0,
|
|
@@ -50758,8 +50758,8 @@
|
|
|
50758
50758
|
},
|
|
50759
50759
|
"comment": "<p>({model: this.model, deselectedRowIndex: index})</p>\n",
|
|
50760
50760
|
"name": {
|
|
50761
|
-
"pos":
|
|
50762
|
-
"end":
|
|
50761
|
+
"pos": 17568,
|
|
50762
|
+
"end": 17568,
|
|
50763
50763
|
"flags": 8552448,
|
|
50764
50764
|
"modifierFlagsCache": 0,
|
|
50765
50765
|
"transformFlags": 0,
|
|
@@ -50770,7 +50770,7 @@
|
|
|
50770
50770
|
"isBracketed": false
|
|
50771
50771
|
}
|
|
50772
50772
|
],
|
|
50773
|
-
"line":
|
|
50773
|
+
"line": 584,
|
|
50774
50774
|
"type": "EventEmitter"
|
|
50775
50775
|
},
|
|
50776
50776
|
{
|
|
@@ -50780,7 +50780,7 @@
|
|
|
50780
50780
|
"deprecationMessage": "",
|
|
50781
50781
|
"rawdescription": "\n\nEmits if a row item excluding expandButtons, checkboxes, or radios is clicked.\n",
|
|
50782
50782
|
"description": "<p>Emits if a row item excluding expandButtons, checkboxes, or radios is clicked.</p>\n",
|
|
50783
|
-
"line":
|
|
50783
|
+
"line": 589,
|
|
50784
50784
|
"type": "EventEmitter"
|
|
50785
50785
|
},
|
|
50786
50786
|
{
|
|
@@ -50790,7 +50790,7 @@
|
|
|
50790
50790
|
"deprecationMessage": "",
|
|
50791
50791
|
"rawdescription": "\n\nEmits when table requires more data to be loaded.\n",
|
|
50792
50792
|
"description": "<p>Emits when table requires more data to be loaded.</p>\n",
|
|
50793
|
-
"line":
|
|
50793
|
+
"line": 594,
|
|
50794
50794
|
"type": "EventEmitter"
|
|
50795
50795
|
},
|
|
50796
50796
|
{
|
|
@@ -50802,15 +50802,15 @@
|
|
|
50802
50802
|
"description": "<p>Emits if all rows are selected.</p>\n",
|
|
50803
50803
|
"jsdoctags": [
|
|
50804
50804
|
{
|
|
50805
|
-
"pos":
|
|
50806
|
-
"end":
|
|
50805
|
+
"pos": 17151,
|
|
50806
|
+
"end": 17166,
|
|
50807
50807
|
"flags": 8421376,
|
|
50808
50808
|
"modifierFlagsCache": 0,
|
|
50809
50809
|
"transformFlags": 0,
|
|
50810
50810
|
"kind": 344,
|
|
50811
50811
|
"tagName": {
|
|
50812
|
-
"pos":
|
|
50813
|
-
"end":
|
|
50812
|
+
"pos": 17152,
|
|
50813
|
+
"end": 17157,
|
|
50814
50814
|
"flags": 8421376,
|
|
50815
50815
|
"modifierFlagsCache": 0,
|
|
50816
50816
|
"transformFlags": 0,
|
|
@@ -50819,8 +50819,8 @@
|
|
|
50819
50819
|
},
|
|
50820
50820
|
"comment": "",
|
|
50821
50821
|
"name": {
|
|
50822
|
-
"pos":
|
|
50823
|
-
"end":
|
|
50822
|
+
"pos": 17158,
|
|
50823
|
+
"end": 17163,
|
|
50824
50824
|
"flags": 8421376,
|
|
50825
50825
|
"modifierFlagsCache": 0,
|
|
50826
50826
|
"transformFlags": 0,
|
|
@@ -50831,7 +50831,7 @@
|
|
|
50831
50831
|
"isBracketed": false
|
|
50832
50832
|
}
|
|
50833
50833
|
],
|
|
50834
|
-
"line":
|
|
50834
|
+
"line": 563,
|
|
50835
50835
|
"type": "EventEmitter"
|
|
50836
50836
|
},
|
|
50837
50837
|
{
|
|
@@ -50843,15 +50843,15 @@
|
|
|
50843
50843
|
"description": "<p>Emits if a single row is selected.</p>\n",
|
|
50844
50844
|
"jsdoctags": [
|
|
50845
50845
|
{
|
|
50846
|
-
"pos":
|
|
50847
|
-
"end":
|
|
50846
|
+
"pos": 17396,
|
|
50847
|
+
"end": 17452,
|
|
50848
50848
|
"flags": 8421376,
|
|
50849
50849
|
"modifierFlagsCache": 0,
|
|
50850
50850
|
"transformFlags": 0,
|
|
50851
50851
|
"kind": 344,
|
|
50852
50852
|
"tagName": {
|
|
50853
|
-
"pos":
|
|
50854
|
-
"end":
|
|
50853
|
+
"pos": 17397,
|
|
50854
|
+
"end": 17402,
|
|
50855
50855
|
"flags": 8421376,
|
|
50856
50856
|
"modifierFlagsCache": 0,
|
|
50857
50857
|
"transformFlags": 0,
|
|
@@ -50860,8 +50860,8 @@
|
|
|
50860
50860
|
},
|
|
50861
50861
|
"comment": "<p>({model: this.model, selectedRowIndex: index})</p>\n",
|
|
50862
50862
|
"name": {
|
|
50863
|
-
"pos":
|
|
50864
|
-
"end":
|
|
50863
|
+
"pos": 17403,
|
|
50864
|
+
"end": 17403,
|
|
50865
50865
|
"flags": 8552448,
|
|
50866
50866
|
"modifierFlagsCache": 0,
|
|
50867
50867
|
"transformFlags": 0,
|
|
@@ -50872,7 +50872,7 @@
|
|
|
50872
50872
|
"isBracketed": false
|
|
50873
50873
|
}
|
|
50874
50874
|
],
|
|
50875
|
-
"line":
|
|
50875
|
+
"line": 577,
|
|
50876
50876
|
"type": "EventEmitter"
|
|
50877
50877
|
},
|
|
50878
50878
|
{
|
|
@@ -50884,15 +50884,15 @@
|
|
|
50884
50884
|
"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>",
|
|
50885
50885
|
"jsdoctags": [
|
|
50886
50886
|
{
|
|
50887
|
-
"pos":
|
|
50888
|
-
"end":
|
|
50887
|
+
"pos": 15613,
|
|
50888
|
+
"end": 15858,
|
|
50889
50889
|
"flags": 8421376,
|
|
50890
50890
|
"modifierFlagsCache": 0,
|
|
50891
50891
|
"transformFlags": 0,
|
|
50892
50892
|
"kind": 330,
|
|
50893
50893
|
"tagName": {
|
|
50894
|
-
"pos":
|
|
50895
|
-
"end":
|
|
50894
|
+
"pos": 15614,
|
|
50895
|
+
"end": 15623,
|
|
50896
50896
|
"flags": 8421376,
|
|
50897
50897
|
"modifierFlagsCache": 0,
|
|
50898
50898
|
"transformFlags": 0,
|
|
@@ -50902,15 +50902,15 @@
|
|
|
50902
50902
|
"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"
|
|
50903
50903
|
},
|
|
50904
50904
|
{
|
|
50905
|
-
"pos":
|
|
50906
|
-
"end":
|
|
50905
|
+
"pos": 15858,
|
|
50906
|
+
"end": 17052,
|
|
50907
50907
|
"flags": 8421376,
|
|
50908
50908
|
"modifierFlagsCache": 0,
|
|
50909
50909
|
"transformFlags": 0,
|
|
50910
50910
|
"kind": 330,
|
|
50911
50911
|
"tagName": {
|
|
50912
|
-
"pos":
|
|
50913
|
-
"end":
|
|
50912
|
+
"pos": 15859,
|
|
50913
|
+
"end": 15864,
|
|
50914
50914
|
"flags": 8421376,
|
|
50915
50915
|
"modifierFlagsCache": 0,
|
|
50916
50916
|
"transformFlags": 0,
|
|
@@ -50920,7 +50920,7 @@
|
|
|
50920
50920
|
"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"
|
|
50921
50921
|
}
|
|
50922
50922
|
],
|
|
50923
|
-
"line":
|
|
50923
|
+
"line": 556,
|
|
50924
50924
|
"type": "EventEmitter"
|
|
50925
50925
|
}
|
|
50926
50926
|
],
|
|
@@ -50933,7 +50933,7 @@
|
|
|
50933
50933
|
"type": "",
|
|
50934
50934
|
"optional": false,
|
|
50935
50935
|
"description": "",
|
|
50936
|
-
"line":
|
|
50936
|
+
"line": 613,
|
|
50937
50937
|
"modifierKind": [
|
|
50938
50938
|
123
|
|
50939
50939
|
]
|
|
@@ -50946,7 +50946,7 @@
|
|
|
50946
50946
|
"type": "string",
|
|
50947
50947
|
"optional": false,
|
|
50948
50948
|
"description": "",
|
|
50949
|
-
"line":
|
|
50949
|
+
"line": 614,
|
|
50950
50950
|
"modifierKind": [
|
|
50951
50951
|
123
|
|
50952
50952
|
]
|
|
@@ -50959,7 +50959,7 @@
|
|
|
50959
50959
|
"type": "",
|
|
50960
50960
|
"optional": false,
|
|
50961
50961
|
"description": "",
|
|
50962
|
-
"line":
|
|
50962
|
+
"line": 612,
|
|
50963
50963
|
"modifierKind": [
|
|
50964
50964
|
123
|
|
50965
50965
|
]
|
|
@@ -50972,7 +50972,7 @@
|
|
|
50972
50972
|
"type": "",
|
|
50973
50973
|
"optional": false,
|
|
50974
50974
|
"description": "<p>Controls if all checkboxes are viewed as selected.</p>\n",
|
|
50975
|
-
"line":
|
|
50975
|
+
"line": 599,
|
|
50976
50976
|
"rawdescription": "\n\nControls if all checkboxes are viewed as selected.\n"
|
|
50977
50977
|
},
|
|
50978
50978
|
{
|
|
@@ -50983,7 +50983,7 @@
|
|
|
50983
50983
|
"type": "",
|
|
50984
50984
|
"optional": false,
|
|
50985
50985
|
"description": "<p>Controls the indeterminate state of the header checkbox.</p>\n",
|
|
50986
|
-
"line":
|
|
50986
|
+
"line": 604,
|
|
50987
50987
|
"rawdescription": "\n\nControls the indeterminate state of the header checkbox.\n"
|
|
50988
50988
|
},
|
|
50989
50989
|
{
|
|
@@ -50994,7 +50994,7 @@
|
|
|
50994
50994
|
"type": "",
|
|
50995
50995
|
"optional": false,
|
|
50996
50996
|
"description": "<p>Allows table content to scroll horizontally</p>\n",
|
|
50997
|
-
"line":
|
|
50997
|
+
"line": 476,
|
|
50998
50998
|
"rawdescription": "\n\nAllows table content to scroll horizontally\n",
|
|
50999
50999
|
"decorators": [
|
|
51000
51000
|
{
|
|
@@ -51027,7 +51027,7 @@
|
|
|
51027
51027
|
"optional": false,
|
|
51028
51028
|
"returnType": "void",
|
|
51029
51029
|
"typeParameters": [],
|
|
51030
|
-
"line":
|
|
51030
|
+
"line": 809,
|
|
51031
51031
|
"deprecated": false,
|
|
51032
51032
|
"deprecationMessage": "",
|
|
51033
51033
|
"jsdoctags": [
|
|
@@ -51076,7 +51076,7 @@
|
|
|
51076
51076
|
"optional": false,
|
|
51077
51077
|
"returnType": "void",
|
|
51078
51078
|
"typeParameters": [],
|
|
51079
|
-
"line":
|
|
51079
|
+
"line": 814,
|
|
51080
51080
|
"deprecated": false,
|
|
51081
51081
|
"deprecationMessage": "",
|
|
51082
51082
|
"jsdoctags": [
|
|
@@ -51134,7 +51134,7 @@
|
|
|
51134
51134
|
"optional": false,
|
|
51135
51135
|
"returnType": "void",
|
|
51136
51136
|
"typeParameters": [],
|
|
51137
|
-
"line":
|
|
51137
|
+
"line": 819,
|
|
51138
51138
|
"deprecated": false,
|
|
51139
51139
|
"deprecationMessage": "",
|
|
51140
51140
|
"jsdoctags": [
|
|
@@ -51192,7 +51192,7 @@
|
|
|
51192
51192
|
"optional": false,
|
|
51193
51193
|
"returnType": "void",
|
|
51194
51194
|
"typeParameters": [],
|
|
51195
|
-
"line":
|
|
51195
|
+
"line": 823,
|
|
51196
51196
|
"deprecated": false,
|
|
51197
51197
|
"deprecationMessage": "",
|
|
51198
51198
|
"jsdoctags": [
|
|
@@ -51244,7 +51244,7 @@
|
|
|
51244
51244
|
"optional": false,
|
|
51245
51245
|
"returnType": "void",
|
|
51246
51246
|
"typeParameters": [],
|
|
51247
|
-
"line":
|
|
51247
|
+
"line": 803,
|
|
51248
51248
|
"deprecated": false,
|
|
51249
51249
|
"deprecationMessage": "",
|
|
51250
51250
|
"jsdoctags": [
|
|
@@ -51293,7 +51293,7 @@
|
|
|
51293
51293
|
"optional": false,
|
|
51294
51294
|
"returnType": "void",
|
|
51295
51295
|
"typeParameters": [],
|
|
51296
|
-
"line":
|
|
51296
|
+
"line": 831,
|
|
51297
51297
|
"deprecated": false,
|
|
51298
51298
|
"deprecationMessage": "",
|
|
51299
51299
|
"jsdoctags": [
|
|
@@ -51345,7 +51345,7 @@
|
|
|
51345
51345
|
"optional": false,
|
|
51346
51346
|
"returnType": "void",
|
|
51347
51347
|
"typeParameters": [],
|
|
51348
|
-
"line":
|
|
51348
|
+
"line": 784,
|
|
51349
51349
|
"deprecated": false,
|
|
51350
51350
|
"deprecationMessage": "",
|
|
51351
51351
|
"jsdoctags": [
|
|
@@ -51388,7 +51388,7 @@
|
|
|
51388
51388
|
"optional": false,
|
|
51389
51389
|
"returnType": "void",
|
|
51390
51390
|
"typeParameters": [],
|
|
51391
|
-
"line":
|
|
51391
|
+
"line": 779,
|
|
51392
51392
|
"deprecated": false,
|
|
51393
51393
|
"deprecationMessage": "",
|
|
51394
51394
|
"jsdoctags": [
|
|
@@ -51431,7 +51431,7 @@
|
|
|
51431
51431
|
"optional": false,
|
|
51432
51432
|
"returnType": "void",
|
|
51433
51433
|
"typeParameters": [],
|
|
51434
|
-
"line":
|
|
51434
|
+
"line": 766,
|
|
51435
51435
|
"deprecated": false,
|
|
51436
51436
|
"deprecationMessage": "",
|
|
51437
51437
|
"jsdoctags": [
|
|
@@ -51461,7 +51461,7 @@
|
|
|
51461
51461
|
"optional": false,
|
|
51462
51462
|
"returnType": "void",
|
|
51463
51463
|
"typeParameters": [],
|
|
51464
|
-
"line":
|
|
51464
|
+
"line": 694,
|
|
51465
51465
|
"deprecated": false,
|
|
51466
51466
|
"deprecationMessage": ""
|
|
51467
51467
|
},
|
|
@@ -51478,7 +51478,7 @@
|
|
|
51478
51478
|
"optional": false,
|
|
51479
51479
|
"returnType": "void",
|
|
51480
51480
|
"typeParameters": [],
|
|
51481
|
-
"line":
|
|
51481
|
+
"line": 842,
|
|
51482
51482
|
"deprecated": false,
|
|
51483
51483
|
"deprecationMessage": "",
|
|
51484
51484
|
"jsdoctags": [
|
|
@@ -51499,7 +51499,7 @@
|
|
|
51499
51499
|
"optional": false,
|
|
51500
51500
|
"returnType": "void",
|
|
51501
51501
|
"typeParameters": [],
|
|
51502
|
-
"line":
|
|
51502
|
+
"line": 664,
|
|
51503
51503
|
"deprecated": false,
|
|
51504
51504
|
"deprecationMessage": ""
|
|
51505
51505
|
},
|
|
@@ -51516,7 +51516,7 @@
|
|
|
51516
51516
|
"optional": false,
|
|
51517
51517
|
"returnType": "void",
|
|
51518
51518
|
"typeParameters": [],
|
|
51519
|
-
"line":
|
|
51519
|
+
"line": 290,
|
|
51520
51520
|
"deprecated": false,
|
|
51521
51521
|
"deprecationMessage": "",
|
|
51522
51522
|
"modifierKind": [
|
|
@@ -51540,7 +51540,7 @@
|
|
|
51540
51540
|
"optional": false,
|
|
51541
51541
|
"returnType": "any",
|
|
51542
51542
|
"typeParameters": [],
|
|
51543
|
-
"line":
|
|
51543
|
+
"line": 881,
|
|
51544
51544
|
"deprecated": false,
|
|
51545
51545
|
"deprecationMessage": ""
|
|
51546
51546
|
},
|
|
@@ -51550,7 +51550,7 @@
|
|
|
51550
51550
|
"optional": false,
|
|
51551
51551
|
"returnType": "any",
|
|
51552
51552
|
"typeParameters": [],
|
|
51553
|
-
"line":
|
|
51553
|
+
"line": 885,
|
|
51554
51554
|
"deprecated": false,
|
|
51555
51555
|
"deprecationMessage": ""
|
|
51556
51556
|
},
|
|
@@ -51560,7 +51560,7 @@
|
|
|
51560
51560
|
"optional": false,
|
|
51561
51561
|
"returnType": "any",
|
|
51562
51562
|
"typeParameters": [],
|
|
51563
|
-
"line":
|
|
51563
|
+
"line": 889,
|
|
51564
51564
|
"deprecated": false,
|
|
51565
51565
|
"deprecationMessage": ""
|
|
51566
51566
|
},
|
|
@@ -51570,7 +51570,7 @@
|
|
|
51570
51570
|
"optional": false,
|
|
51571
51571
|
"returnType": "any",
|
|
51572
51572
|
"typeParameters": [],
|
|
51573
|
-
"line":
|
|
51573
|
+
"line": 871,
|
|
51574
51574
|
"deprecated": false,
|
|
51575
51575
|
"deprecationMessage": ""
|
|
51576
51576
|
},
|
|
@@ -51580,7 +51580,7 @@
|
|
|
51580
51580
|
"optional": false,
|
|
51581
51581
|
"returnType": "any",
|
|
51582
51582
|
"typeParameters": [],
|
|
51583
|
-
"line":
|
|
51583
|
+
"line": 897,
|
|
51584
51584
|
"deprecated": false,
|
|
51585
51585
|
"deprecationMessage": ""
|
|
51586
51586
|
},
|
|
@@ -51590,7 +51590,7 @@
|
|
|
51590
51590
|
"optional": false,
|
|
51591
51591
|
"returnType": "any",
|
|
51592
51592
|
"typeParameters": [],
|
|
51593
|
-
"line":
|
|
51593
|
+
"line": 893,
|
|
51594
51594
|
"deprecated": false,
|
|
51595
51595
|
"deprecationMessage": ""
|
|
51596
51596
|
},
|
|
@@ -51607,7 +51607,7 @@
|
|
|
51607
51607
|
"optional": false,
|
|
51608
51608
|
"returnType": "{ value: any; }",
|
|
51609
51609
|
"typeParameters": [],
|
|
51610
|
-
"line":
|
|
51610
|
+
"line": 864,
|
|
51611
51611
|
"deprecated": false,
|
|
51612
51612
|
"deprecationMessage": "",
|
|
51613
51613
|
"jsdoctags": [
|
|
@@ -51628,7 +51628,7 @@
|
|
|
51628
51628
|
"optional": false,
|
|
51629
51629
|
"returnType": "any",
|
|
51630
51630
|
"typeParameters": [],
|
|
51631
|
-
"line":
|
|
51631
|
+
"line": 877,
|
|
51632
51632
|
"deprecated": false,
|
|
51633
51633
|
"deprecationMessage": ""
|
|
51634
51634
|
},
|
|
@@ -51638,7 +51638,7 @@
|
|
|
51638
51638
|
"optional": false,
|
|
51639
51639
|
"returnType": "any",
|
|
51640
51640
|
"typeParameters": [],
|
|
51641
|
-
"line":
|
|
51641
|
+
"line": 874,
|
|
51642
51642
|
"deprecated": false,
|
|
51643
51643
|
"deprecationMessage": ""
|
|
51644
51644
|
},
|
|
@@ -51648,7 +51648,7 @@
|
|
|
51648
51648
|
"optional": false,
|
|
51649
51649
|
"returnType": "void",
|
|
51650
51650
|
"typeParameters": [],
|
|
51651
|
-
"line":
|
|
51651
|
+
"line": 710,
|
|
51652
51652
|
"deprecated": false,
|
|
51653
51653
|
"deprecationMessage": ""
|
|
51654
51654
|
},
|
|
@@ -51665,7 +51665,7 @@
|
|
|
51665
51665
|
"optional": false,
|
|
51666
51666
|
"returnType": "void",
|
|
51667
51667
|
"typeParameters": [],
|
|
51668
|
-
"line":
|
|
51668
|
+
"line": 729,
|
|
51669
51669
|
"deprecated": false,
|
|
51670
51670
|
"deprecationMessage": "",
|
|
51671
51671
|
"jsdoctags": [
|
|
@@ -51693,7 +51693,7 @@
|
|
|
51693
51693
|
"optional": false,
|
|
51694
51694
|
"returnType": "void",
|
|
51695
51695
|
"typeParameters": [],
|
|
51696
|
-
"line":
|
|
51696
|
+
"line": 793,
|
|
51697
51697
|
"deprecated": false,
|
|
51698
51698
|
"deprecationMessage": "",
|
|
51699
51699
|
"rawdescription": "\n\nTriggered when the user scrolls on the `<tbody>` element.\nEmits the `scrollLoad` event.\n",
|
|
@@ -51716,7 +51716,7 @@
|
|
|
51716
51716
|
"optional": false,
|
|
51717
51717
|
"returnType": "void",
|
|
51718
51718
|
"typeParameters": [],
|
|
51719
|
-
"line":
|
|
51719
|
+
"line": 705,
|
|
51720
51720
|
"deprecated": false,
|
|
51721
51721
|
"deprecationMessage": ""
|
|
51722
51722
|
},
|
|
@@ -51733,7 +51733,7 @@
|
|
|
51733
51733
|
"optional": false,
|
|
51734
51734
|
"returnType": "void",
|
|
51735
51735
|
"typeParameters": [],
|
|
51736
|
-
"line":
|
|
51736
|
+
"line": 715,
|
|
51737
51737
|
"deprecated": false,
|
|
51738
51738
|
"deprecationMessage": "",
|
|
51739
51739
|
"jsdoctags": [
|
|
@@ -51762,7 +51762,7 @@
|
|
|
51762
51762
|
"optional": false,
|
|
51763
51763
|
"returnType": "void",
|
|
51764
51764
|
"typeParameters": [],
|
|
51765
|
-
"line":
|
|
51765
|
+
"line": 749,
|
|
51766
51766
|
"deprecated": false,
|
|
51767
51767
|
"deprecationMessage": "",
|
|
51768
51768
|
"jsdoctags": [
|
|
@@ -51791,7 +51791,7 @@
|
|
|
51791
51791
|
"optional": false,
|
|
51792
51792
|
"returnType": "void",
|
|
51793
51793
|
"typeParameters": [],
|
|
51794
|
-
"line":
|
|
51794
|
+
"line": 859,
|
|
51795
51795
|
"deprecated": false,
|
|
51796
51796
|
"deprecationMessage": "",
|
|
51797
51797
|
"rawdescription": "\n\nTriggered when the user scrolls on the `<tbody>` element.\nEmits the `scrollLoad` event.\n",
|
|
@@ -51827,7 +51827,7 @@
|
|
|
51827
51827
|
"optional": false,
|
|
51828
51828
|
"returnType": "void",
|
|
51829
51829
|
"typeParameters": [],
|
|
51830
|
-
"line":
|
|
51830
|
+
"line": 279,
|
|
51831
51831
|
"deprecated": false,
|
|
51832
51832
|
"deprecationMessage": "",
|
|
51833
51833
|
"modifierKind": [
|
|
@@ -51873,7 +51873,7 @@
|
|
|
51873
51873
|
"optional": false,
|
|
51874
51874
|
"returnType": "any",
|
|
51875
51875
|
"typeParameters": [],
|
|
51876
|
-
"line":
|
|
51876
|
+
"line": 260,
|
|
51877
51877
|
"deprecated": false,
|
|
51878
51878
|
"deprecationMessage": "",
|
|
51879
51879
|
"rawdescription": "\n\nCreates a skeleton model with a row and column count specified by the user\n\nExample:\n\n```typescript\nthis.model = Table.skeletonModel(5, 5);\n```\n",
|
|
@@ -51908,7 +51908,7 @@
|
|
|
51908
51908
|
"optional": false,
|
|
51909
51909
|
"returnType": "void",
|
|
51910
51910
|
"typeParameters": [],
|
|
51911
|
-
"line":
|
|
51911
|
+
"line": 733,
|
|
51912
51912
|
"deprecated": false,
|
|
51913
51913
|
"deprecationMessage": ""
|
|
51914
51914
|
}
|
|
@@ -51923,7 +51923,7 @@
|
|
|
51923
51923
|
"deprecationMessage": "",
|
|
51924
51924
|
"rawdescription": "\n\nAllows table content to scroll horizontally\n",
|
|
51925
51925
|
"description": "<p>Allows table content to scroll horizontally</p>\n",
|
|
51926
|
-
"line":
|
|
51926
|
+
"line": 476,
|
|
51927
51927
|
"type": "boolean",
|
|
51928
51928
|
"decorators": []
|
|
51929
51929
|
}
|
|
@@ -51934,7 +51934,7 @@
|
|
|
51934
51934
|
"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>",
|
|
51935
51935
|
"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",
|
|
51936
51936
|
"type": "component",
|
|
51937
|
-
"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[size]=\"size\"\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\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\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",
|
|
51937
|
+
"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\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\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",
|
|
51938
51938
|
"assetsDirs": [],
|
|
51939
51939
|
"styleUrlsData": "",
|
|
51940
51940
|
"stylesData": "\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t\n",
|
|
@@ -51963,7 +51963,7 @@
|
|
|
51963
51963
|
"deprecationMessage": ""
|
|
51964
51964
|
}
|
|
51965
51965
|
],
|
|
51966
|
-
"line":
|
|
51966
|
+
"line": 639,
|
|
51967
51967
|
"rawdescription": "\n\nCreates an instance of Table.\n",
|
|
51968
51968
|
"jsdoctags": [
|
|
51969
51969
|
{
|
|
@@ -52016,7 +52016,7 @@
|
|
|
52016
52016
|
}
|
|
52017
52017
|
],
|
|
52018
52018
|
"returnType": "void",
|
|
52019
|
-
"line":
|
|
52019
|
+
"line": 314,
|
|
52020
52020
|
"rawdescription": "\n\n`TableModel` with data the table is to display.\n",
|
|
52021
52021
|
"description": "<p><code>TableModel</code> with data the table is to display.</p>\n",
|
|
52022
52022
|
"jsdoctags": [
|
|
@@ -52035,7 +52035,7 @@
|
|
|
52035
52035
|
"name": "model",
|
|
52036
52036
|
"type": "",
|
|
52037
52037
|
"returnType": "TableModel",
|
|
52038
|
-
"line":
|
|
52038
|
+
"line": 351
|
|
52039
52039
|
}
|
|
52040
52040
|
},
|
|
52041
52041
|
"isDataGrid": {
|
|
@@ -52054,7 +52054,7 @@
|
|
|
52054
52054
|
}
|
|
52055
52055
|
],
|
|
52056
52056
|
"returnType": "void",
|
|
52057
|
-
"line":
|
|
52057
|
+
"line": 366,
|
|
52058
52058
|
"rawdescription": "\n\nSet to `true` for a data grid with keyboard interactions.\n",
|
|
52059
52059
|
"description": "<p>Set to <code>true</code> for a data grid with keyboard interactions.</p>\n",
|
|
52060
52060
|
"jsdoctags": [
|
|
@@ -52073,7 +52073,7 @@
|
|
|
52073
52073
|
"name": "isDataGrid",
|
|
52074
52074
|
"type": "boolean",
|
|
52075
52075
|
"returnType": "boolean",
|
|
52076
|
-
"line":
|
|
52076
|
+
"line": 385
|
|
52077
52077
|
}
|
|
52078
52078
|
},
|
|
52079
52079
|
"expandButtonAriaLabel": {
|
|
@@ -52092,7 +52092,7 @@
|
|
|
52092
52092
|
}
|
|
52093
52093
|
],
|
|
52094
52094
|
"returnType": "void",
|
|
52095
|
-
"line":
|
|
52095
|
+
"line": 425,
|
|
52096
52096
|
"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",
|
|
52097
52097
|
"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",
|
|
52098
52098
|
"jsdoctags": [
|
|
@@ -52111,7 +52111,7 @@
|
|
|
52111
52111
|
"name": "expandButtonAriaLabel",
|
|
52112
52112
|
"type": "",
|
|
52113
52113
|
"returnType": "",
|
|
52114
|
-
"line":
|
|
52114
|
+
"line": 428
|
|
52115
52115
|
}
|
|
52116
52116
|
},
|
|
52117
52117
|
"sortDescendingLabel": {
|
|
@@ -52130,7 +52130,7 @@
|
|
|
52130
52130
|
}
|
|
52131
52131
|
],
|
|
52132
52132
|
"returnType": "void",
|
|
52133
|
-
"line":
|
|
52133
|
+
"line": 432,
|
|
52134
52134
|
"jsdoctags": [
|
|
52135
52135
|
{
|
|
52136
52136
|
"name": "value",
|
|
@@ -52147,7 +52147,7 @@
|
|
|
52147
52147
|
"name": "sortDescendingLabel",
|
|
52148
52148
|
"type": "",
|
|
52149
52149
|
"returnType": "",
|
|
52150
|
-
"line":
|
|
52150
|
+
"line": 435
|
|
52151
52151
|
}
|
|
52152
52152
|
},
|
|
52153
52153
|
"sortAscendingLabel": {
|
|
@@ -52166,7 +52166,7 @@
|
|
|
52166
52166
|
}
|
|
52167
52167
|
],
|
|
52168
52168
|
"returnType": "void",
|
|
52169
|
-
"line":
|
|
52169
|
+
"line": 439,
|
|
52170
52170
|
"jsdoctags": [
|
|
52171
52171
|
{
|
|
52172
52172
|
"name": "value",
|
|
@@ -52183,7 +52183,7 @@
|
|
|
52183
52183
|
"name": "sortAscendingLabel",
|
|
52184
52184
|
"type": "",
|
|
52185
52185
|
"returnType": "",
|
|
52186
|
-
"line":
|
|
52186
|
+
"line": 442
|
|
52187
52187
|
}
|
|
52188
52188
|
},
|
|
52189
52189
|
"translations": {
|
|
@@ -52202,7 +52202,7 @@
|
|
|
52202
52202
|
}
|
|
52203
52203
|
],
|
|
52204
52204
|
"returnType": "void",
|
|
52205
|
-
"line":
|
|
52205
|
+
"line": 459,
|
|
52206
52206
|
"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",
|
|
52207
52207
|
"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>",
|
|
52208
52208
|
"jsdoctags": [
|
|
@@ -52224,7 +52224,7 @@
|
|
|
52224
52224
|
"name": "noData",
|
|
52225
52225
|
"type": "",
|
|
52226
52226
|
"returnType": "",
|
|
52227
|
-
"line":
|
|
52227
|
+
"line": 606
|
|
52228
52228
|
}
|
|
52229
52229
|
}
|
|
52230
52230
|
}
|
|
@@ -53467,7 +53467,7 @@
|
|
|
53467
53467
|
},
|
|
53468
53468
|
{
|
|
53469
53469
|
"name": "TableHead",
|
|
53470
|
-
"id": "component-TableHead-
|
|
53470
|
+
"id": "component-TableHead-32ba6d2ca460923efa25feb01055b692fbca4b444e812dc78335aa3950bf7ee2dbc8dbbc244e750fe32091db0beb5601c3ddca079626094b9066932ba332adf6",
|
|
53471
53471
|
"file": "src/table/head/table-head.component.ts",
|
|
53472
53472
|
"encapsulation": [],
|
|
53473
53473
|
"entryComponents": [],
|
|
@@ -53479,7 +53479,7 @@
|
|
|
53479
53479
|
"styles": [
|
|
53480
53480
|
"\n\t\t.cds--table-expand-v2 {\n\t\t\tpadding-left: 2.5rem;\n\t\t}\n\t"
|
|
53481
53481
|
],
|
|
53482
|
-
"template": "<ng-container *ngIf=\"model\">\n\t<tr>\n\t\t<th\n\t\t\tcdsTableHeadExpand\n\t\t\t*ngIf=\"model.hasExpandableRows()\"\n\t\t\tscope=\"col\"\n\t\t\t[ngClass]=\"{'cds--table-expand-v2': stickyHeader}\"\n\t\t\t[id]=\"model.getId('expand')\">\n\t\t</th>\n\t\t<th\n\t\t\t*ngIf=\"!skeleton && showSelectionColumn && enableSingleSelect\"\n\t\t\tscope=\"col\"\n\t\t\tstyle=\"width: 0;\"\n\t\t\t[id]=\"model.getId('select')\">\n\t\t\t<!-- add width 0; since the carbon styles don't seem to constrain this headers width -->\n\t\t</th>\n\t\t<th\n\t\t\tcdsTableHeadCheckbox\n\t\t\t*ngIf=\"!skeleton && showSelectionColumn && !enableSingleSelect\"\n\t\t\tscope=\"col\"\n\t\t\t[checked]=\"selectAllCheckbox\"\n\t\t\t[indeterminate]=\"selectAllCheckboxSomeSelected\"\n\t\t\t[ariaLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t[
|
|
53482
|
+
"template": "<ng-container *ngIf=\"model\">\n\t<tr>\n\t\t<th\n\t\t\tcdsTableHeadExpand\n\t\t\t*ngIf=\"model.hasExpandableRows()\"\n\t\t\tscope=\"col\"\n\t\t\t[ngClass]=\"{'cds--table-expand-v2': stickyHeader}\"\n\t\t\t[id]=\"model.getId('expand')\">\n\t\t</th>\n\t\t<th\n\t\t\t*ngIf=\"!skeleton && showSelectionColumn && enableSingleSelect\"\n\t\t\tscope=\"col\"\n\t\t\tstyle=\"width: 0;\"\n\t\t\t[id]=\"model.getId('select')\">\n\t\t\t<!-- add width 0; since the carbon styles don't seem to constrain this headers width -->\n\t\t</th>\n\t\t<th\n\t\t\tcdsTableHeadCheckbox\n\t\t\t*ngIf=\"!skeleton && showSelectionColumn && !enableSingleSelect\"\n\t\t\tscope=\"col\"\n\t\t\t[checked]=\"selectAllCheckbox\"\n\t\t\t[indeterminate]=\"selectAllCheckboxSomeSelected\"\n\t\t\t[ariaLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[name]=\"model.getHeaderId('select')\"\n\t\t\t(change)=\"onSelectAllCheckboxChange()\"\n\t\t\t[id]=\"model.getId('select')\">\n\t\t</th>\n\t\t<ng-container *ngFor=\"let column of model.header; let i = index\">\n\t\t\t<th\n\t\t\t\t*ngIf=\"column && column.visible\"\n\t\t\t\t[ngStyle]=\"column.style\"\n\t\t\t\tcdsTableHeadCell\n\t\t\t\tscope=\"col\"\n\t\t\t\t[class]=\"column.className\"\n\t\t\t\t[sortable]=\"sortable\"\n\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t[id]=\"model.getId(i)\"\n\t\t\t\t[column]=\"column\"\n\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t\t\t[attr.colspan]=\"column.colSpan\"\n\t\t\t\t[attr.rowspan]=\"column.rowSpan\"\n\t\t\t\t(sort)=\"sort.emit(i)\">\n\t\t\t</th>\n\t\t</ng-container>\n\t\t<th *ngIf=\"!skeleton && stickyHeader && scrollbarWidth\"\n\t\t\tscope=\"col\"\n\t\t\t[ngStyle]=\"{'width': scrollbarWidth + 'px', 'padding': 0, 'border': 0}\">\n\t\t\t<!--\n\t\t\t\tScrollbar pushes body to the left so this header column is added to push\n\t\t\t\tthe title bar the same amount and keep the header and body columns aligned.\n\t\t\t-->\n\t\t</th>\n\t</tr>\n</ng-container>\n<ng-content></ng-content>\n",
|
|
53483
53483
|
"templateUrl": [],
|
|
53484
53484
|
"viewProviders": [],
|
|
53485
53485
|
"hostDirectives": [],
|
|
@@ -53488,7 +53488,7 @@
|
|
|
53488
53488
|
"name": "checkboxHeaderLabel",
|
|
53489
53489
|
"deprecated": false,
|
|
53490
53490
|
"deprecationMessage": "",
|
|
53491
|
-
"line":
|
|
53491
|
+
"line": 114,
|
|
53492
53492
|
"type": "string | Observable",
|
|
53493
53493
|
"decorators": []
|
|
53494
53494
|
},
|
|
@@ -53497,7 +53497,7 @@
|
|
|
53497
53497
|
"defaultValue": "false",
|
|
53498
53498
|
"deprecated": false,
|
|
53499
53499
|
"deprecationMessage": "",
|
|
53500
|
-
"line":
|
|
53500
|
+
"line": 97,
|
|
53501
53501
|
"type": "boolean",
|
|
53502
53502
|
"decorators": []
|
|
53503
53503
|
},
|
|
@@ -53505,7 +53505,7 @@
|
|
|
53505
53505
|
"name": "filterTitle",
|
|
53506
53506
|
"deprecated": false,
|
|
53507
53507
|
"deprecationMessage": "",
|
|
53508
|
-
"line":
|
|
53508
|
+
"line": 141,
|
|
53509
53509
|
"type": "string | Observable",
|
|
53510
53510
|
"decorators": []
|
|
53511
53511
|
},
|
|
@@ -53513,7 +53513,7 @@
|
|
|
53513
53513
|
"name": "model",
|
|
53514
53514
|
"deprecated": false,
|
|
53515
53515
|
"deprecationMessage": "",
|
|
53516
|
-
"line":
|
|
53516
|
+
"line": 93,
|
|
53517
53517
|
"type": "TableModel",
|
|
53518
53518
|
"decorators": []
|
|
53519
53519
|
},
|
|
@@ -53522,7 +53522,7 @@
|
|
|
53522
53522
|
"defaultValue": "false",
|
|
53523
53523
|
"deprecated": false,
|
|
53524
53524
|
"deprecationMessage": "",
|
|
53525
|
-
"line":
|
|
53525
|
+
"line": 101,
|
|
53526
53526
|
"type": "boolean",
|
|
53527
53527
|
"decorators": []
|
|
53528
53528
|
},
|
|
@@ -53531,7 +53531,7 @@
|
|
|
53531
53531
|
"defaultValue": "false",
|
|
53532
53532
|
"deprecated": false,
|
|
53533
53533
|
"deprecationMessage": "",
|
|
53534
|
-
"line":
|
|
53534
|
+
"line": 99,
|
|
53535
53535
|
"type": "boolean",
|
|
53536
53536
|
"decorators": []
|
|
53537
53537
|
},
|
|
@@ -53540,27 +53540,16 @@
|
|
|
53540
53540
|
"defaultValue": "true",
|
|
53541
53541
|
"deprecated": false,
|
|
53542
53542
|
"deprecationMessage": "",
|
|
53543
|
-
"line":
|
|
53543
|
+
"line": 95,
|
|
53544
53544
|
"type": "boolean",
|
|
53545
53545
|
"decorators": []
|
|
53546
53546
|
},
|
|
53547
|
-
{
|
|
53548
|
-
"name": "size",
|
|
53549
|
-
"defaultValue": "\"md\"",
|
|
53550
|
-
"deprecated": false,
|
|
53551
|
-
"deprecationMessage": "",
|
|
53552
|
-
"rawdescription": "\n\nSize of the table rows.\n",
|
|
53553
|
-
"description": "<p>Size of the table rows.</p>\n",
|
|
53554
|
-
"line": 117,
|
|
53555
|
-
"type": "TableRowSize",
|
|
53556
|
-
"decorators": []
|
|
53557
|
-
},
|
|
53558
53547
|
{
|
|
53559
53548
|
"name": "skeleton",
|
|
53560
53549
|
"defaultValue": "false",
|
|
53561
53550
|
"deprecated": false,
|
|
53562
53551
|
"deprecationMessage": "",
|
|
53563
|
-
"line":
|
|
53552
|
+
"line": 103,
|
|
53564
53553
|
"type": "boolean",
|
|
53565
53554
|
"decorators": []
|
|
53566
53555
|
},
|
|
@@ -53571,7 +53560,7 @@
|
|
|
53571
53560
|
"deprecationMessage": "",
|
|
53572
53561
|
"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",
|
|
53573
53562
|
"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",
|
|
53574
|
-
"line":
|
|
53563
|
+
"line": 111,
|
|
53575
53564
|
"type": "boolean",
|
|
53576
53565
|
"decorators": []
|
|
53577
53566
|
},
|
|
@@ -53579,7 +53568,7 @@
|
|
|
53579
53568
|
"name": "sortAscendingLabel",
|
|
53580
53569
|
"deprecated": false,
|
|
53581
53570
|
"deprecationMessage": "",
|
|
53582
|
-
"line":
|
|
53571
|
+
"line": 132,
|
|
53583
53572
|
"type": "string | Observable",
|
|
53584
53573
|
"decorators": []
|
|
53585
53574
|
},
|
|
@@ -53587,7 +53576,7 @@
|
|
|
53587
53576
|
"name": "sortDescendingLabel",
|
|
53588
53577
|
"deprecated": false,
|
|
53589
53578
|
"deprecationMessage": "",
|
|
53590
|
-
"line":
|
|
53579
|
+
"line": 123,
|
|
53591
53580
|
"type": "string | Observable",
|
|
53592
53581
|
"decorators": []
|
|
53593
53582
|
},
|
|
@@ -53596,7 +53585,7 @@
|
|
|
53596
53585
|
"defaultValue": "false",
|
|
53597
53586
|
"deprecated": false,
|
|
53598
53587
|
"deprecationMessage": "",
|
|
53599
|
-
"line":
|
|
53588
|
+
"line": 105,
|
|
53600
53589
|
"type": "boolean",
|
|
53601
53590
|
"decorators": []
|
|
53602
53591
|
}
|
|
@@ -53611,15 +53600,15 @@
|
|
|
53611
53600
|
"description": "<p>Emits if all rows are deselected.</p>\n",
|
|
53612
53601
|
"jsdoctags": [
|
|
53613
53602
|
{
|
|
53614
|
-
"pos":
|
|
53615
|
-
"end":
|
|
53603
|
+
"pos": 4075,
|
|
53604
|
+
"end": 4090,
|
|
53616
53605
|
"flags": 8421376,
|
|
53617
53606
|
"modifierFlagsCache": 0,
|
|
53618
53607
|
"transformFlags": 0,
|
|
53619
53608
|
"kind": 344,
|
|
53620
53609
|
"tagName": {
|
|
53621
|
-
"pos":
|
|
53622
|
-
"end":
|
|
53610
|
+
"pos": 4076,
|
|
53611
|
+
"end": 4081,
|
|
53623
53612
|
"flags": 8421376,
|
|
53624
53613
|
"modifierFlagsCache": 0,
|
|
53625
53614
|
"transformFlags": 0,
|
|
@@ -53628,8 +53617,8 @@
|
|
|
53628
53617
|
},
|
|
53629
53618
|
"comment": "",
|
|
53630
53619
|
"name": {
|
|
53631
|
-
"pos":
|
|
53632
|
-
"end":
|
|
53620
|
+
"pos": 4082,
|
|
53621
|
+
"end": 4087,
|
|
53633
53622
|
"flags": 8421376,
|
|
53634
53623
|
"modifierFlagsCache": 0,
|
|
53635
53624
|
"transformFlags": 0,
|
|
@@ -53640,7 +53629,7 @@
|
|
|
53640
53629
|
"isBracketed": false
|
|
53641
53630
|
}
|
|
53642
53631
|
],
|
|
53643
|
-
"line":
|
|
53632
|
+
"line": 164,
|
|
53644
53633
|
"type": "EventEmitter"
|
|
53645
53634
|
},
|
|
53646
53635
|
{
|
|
@@ -53652,15 +53641,15 @@
|
|
|
53652
53641
|
"description": "<p>Emits if all rows are selected.</p>\n",
|
|
53653
53642
|
"jsdoctags": [
|
|
53654
53643
|
{
|
|
53655
|
-
"pos":
|
|
53656
|
-
"end":
|
|
53644
|
+
"pos": 3951,
|
|
53645
|
+
"end": 3966,
|
|
53657
53646
|
"flags": 8421376,
|
|
53658
53647
|
"modifierFlagsCache": 0,
|
|
53659
53648
|
"transformFlags": 0,
|
|
53660
53649
|
"kind": 344,
|
|
53661
53650
|
"tagName": {
|
|
53662
|
-
"pos":
|
|
53663
|
-
"end":
|
|
53651
|
+
"pos": 3952,
|
|
53652
|
+
"end": 3957,
|
|
53664
53653
|
"flags": 8421376,
|
|
53665
53654
|
"modifierFlagsCache": 0,
|
|
53666
53655
|
"transformFlags": 0,
|
|
@@ -53669,8 +53658,8 @@
|
|
|
53669
53658
|
},
|
|
53670
53659
|
"comment": "",
|
|
53671
53660
|
"name": {
|
|
53672
|
-
"pos":
|
|
53673
|
-
"end":
|
|
53661
|
+
"pos": 3958,
|
|
53662
|
+
"end": 3963,
|
|
53674
53663
|
"flags": 8421376,
|
|
53675
53664
|
"modifierFlagsCache": 0,
|
|
53676
53665
|
"transformFlags": 0,
|
|
@@ -53681,7 +53670,7 @@
|
|
|
53681
53670
|
"isBracketed": false
|
|
53682
53671
|
}
|
|
53683
53672
|
],
|
|
53684
|
-
"line":
|
|
53673
|
+
"line": 158,
|
|
53685
53674
|
"type": "EventEmitter"
|
|
53686
53675
|
},
|
|
53687
53676
|
{
|
|
@@ -53691,7 +53680,7 @@
|
|
|
53691
53680
|
"deprecationMessage": "",
|
|
53692
53681
|
"rawdescription": "\n\nEmits an index of the column that wants to be sorted.\n",
|
|
53693
53682
|
"description": "<p>Emits an index of the column that wants to be sorted.</p>\n",
|
|
53694
|
-
"line":
|
|
53683
|
+
"line": 152,
|
|
53695
53684
|
"type": "EventEmitter"
|
|
53696
53685
|
}
|
|
53697
53686
|
],
|
|
@@ -53704,7 +53693,7 @@
|
|
|
53704
53693
|
"type": "number",
|
|
53705
53694
|
"optional": false,
|
|
53706
53695
|
"description": "",
|
|
53707
|
-
"line":
|
|
53696
|
+
"line": 166,
|
|
53708
53697
|
"modifierKind": [
|
|
53709
53698
|
123
|
|
53710
53699
|
]
|
|
@@ -53717,7 +53706,7 @@
|
|
|
53717
53706
|
"optional": false,
|
|
53718
53707
|
"returnType": "Observable<string>",
|
|
53719
53708
|
"typeParameters": [],
|
|
53720
|
-
"line":
|
|
53709
|
+
"line": 189,
|
|
53721
53710
|
"deprecated": false,
|
|
53722
53711
|
"deprecationMessage": ""
|
|
53723
53712
|
},
|
|
@@ -53727,7 +53716,7 @@
|
|
|
53727
53716
|
"optional": false,
|
|
53728
53717
|
"returnType": "Observable<string>",
|
|
53729
53718
|
"typeParameters": [],
|
|
53730
|
-
"line":
|
|
53719
|
+
"line": 201,
|
|
53731
53720
|
"deprecated": false,
|
|
53732
53721
|
"deprecationMessage": ""
|
|
53733
53722
|
},
|
|
@@ -53737,7 +53726,7 @@
|
|
|
53737
53726
|
"optional": false,
|
|
53738
53727
|
"returnType": "Observable<string>",
|
|
53739
53728
|
"typeParameters": [],
|
|
53740
|
-
"line":
|
|
53729
|
+
"line": 197,
|
|
53741
53730
|
"deprecated": false,
|
|
53742
53731
|
"deprecationMessage": ""
|
|
53743
53732
|
},
|
|
@@ -53747,7 +53736,7 @@
|
|
|
53747
53736
|
"optional": false,
|
|
53748
53737
|
"returnType": "Observable<string>",
|
|
53749
53738
|
"typeParameters": [],
|
|
53750
|
-
"line":
|
|
53739
|
+
"line": 193,
|
|
53751
53740
|
"deprecated": false,
|
|
53752
53741
|
"deprecationMessage": ""
|
|
53753
53742
|
},
|
|
@@ -53757,7 +53746,7 @@
|
|
|
53757
53746
|
"optional": false,
|
|
53758
53747
|
"returnType": "void",
|
|
53759
53748
|
"typeParameters": [],
|
|
53760
|
-
"line":
|
|
53749
|
+
"line": 181,
|
|
53761
53750
|
"deprecated": false,
|
|
53762
53751
|
"deprecationMessage": ""
|
|
53763
53752
|
}
|
|
@@ -53771,7 +53760,7 @@
|
|
|
53771
53760
|
"description": "<p>A subcomponent that creates the thead of the table</p>\n<h2>Basic usage</h2>\n<div><pre class=\"line-numbers\"><code class=\"language-html\"> <thead cdsTableHead [model]="model"></thead></code></pre></div>",
|
|
53772
53761
|
"rawdescription": "\n\nA subcomponent that creates the thead of the table\n\n## Basic usage\n\n```html\n\t<thead cdsTableHead [model]=\"model\"></thead>\n```\n",
|
|
53773
53762
|
"type": "component",
|
|
53774
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tAfterViewInit\n} from \"@angular/core\";\n\nimport { TableModel } from \"../table-model.class\";\nimport { getScrollbarWidth } from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\nimport { TableRowSize } from \"../table.types\";\n\n/**\n * A subcomponent that creates the thead of the table\n *\n * ## Basic usage\n *\n * ```html\n * \t<thead cdsTableHead [model]=\"model\"></thead>\n * ```\n */\n@Component({\n\t// tslint:disable-next-line:component-selector\n\tselector: \"[cdsTableHead], [ibmTableHead]\",\n\ttemplate: `\n\t<ng-container *ngIf=\"model\">\n\t\t<tr>\n\t\t\t<th\n\t\t\t\tcdsTableHeadExpand\n\t\t\t\t*ngIf=\"model.hasExpandableRows()\"\n\t\t\t\tscope=\"col\"\n\t\t\t\t[ngClass]=\"{'cds--table-expand-v2': stickyHeader}\"\n\t\t\t\t[id]=\"model.getId('expand')\">\n\t\t\t</th>\n\t\t\t<th\n\t\t\t\t*ngIf=\"!skeleton && showSelectionColumn && enableSingleSelect\"\n\t\t\t\tscope=\"col\"\n\t\t\t\tstyle=\"width: 0;\"\n\t\t\t\t[id]=\"model.getId('select')\">\n\t\t\t\t<!-- add width 0; since the carbon styles don't seem to constrain this headers width -->\n\t\t\t</th>\n\t\t\t<th\n\t\t\t\tcdsTableHeadCheckbox\n\t\t\t\t*ngIf=\"!skeleton && showSelectionColumn && !enableSingleSelect\"\n\t\t\t\tscope=\"col\"\n\t\t\t\t[checked]=\"selectAllCheckbox\"\n\t\t\t\t[indeterminate]=\"selectAllCheckboxSomeSelected\"\n\t\t\t\t[ariaLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t\t[
|
|
53763
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tAfterViewInit\n} from \"@angular/core\";\n\nimport { TableModel } from \"../table-model.class\";\nimport { getScrollbarWidth } from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\nimport { TableRowSize } from \"../table.types\";\n\n/**\n * A subcomponent that creates the thead of the table\n *\n * ## Basic usage\n *\n * ```html\n * \t<thead cdsTableHead [model]=\"model\"></thead>\n * ```\n */\n@Component({\n\t// tslint:disable-next-line:component-selector\n\tselector: \"[cdsTableHead], [ibmTableHead]\",\n\ttemplate: `\n\t<ng-container *ngIf=\"model\">\n\t\t<tr>\n\t\t\t<th\n\t\t\t\tcdsTableHeadExpand\n\t\t\t\t*ngIf=\"model.hasExpandableRows()\"\n\t\t\t\tscope=\"col\"\n\t\t\t\t[ngClass]=\"{'cds--table-expand-v2': stickyHeader}\"\n\t\t\t\t[id]=\"model.getId('expand')\">\n\t\t\t</th>\n\t\t\t<th\n\t\t\t\t*ngIf=\"!skeleton && showSelectionColumn && enableSingleSelect\"\n\t\t\t\tscope=\"col\"\n\t\t\t\tstyle=\"width: 0;\"\n\t\t\t\t[id]=\"model.getId('select')\">\n\t\t\t\t<!-- add width 0; since the carbon styles don't seem to constrain this headers width -->\n\t\t\t</th>\n\t\t\t<th\n\t\t\t\tcdsTableHeadCheckbox\n\t\t\t\t*ngIf=\"!skeleton && showSelectionColumn && !enableSingleSelect\"\n\t\t\t\tscope=\"col\"\n\t\t\t\t[checked]=\"selectAllCheckbox\"\n\t\t\t\t[indeterminate]=\"selectAllCheckboxSomeSelected\"\n\t\t\t\t[ariaLabel]=\"getCheckboxHeaderLabel()\"\n\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t[name]=\"model.getHeaderId('select')\"\n\t\t\t\t(change)=\"onSelectAllCheckboxChange()\"\n\t\t\t\t[id]=\"model.getId('select')\">\n\t\t\t</th>\n\t\t\t<ng-container *ngFor=\"let column of model.header; let i = index\">\n\t\t\t\t<th\n\t\t\t\t\t*ngIf=\"column && column.visible\"\n\t\t\t\t\t[ngStyle]=\"column.style\"\n\t\t\t\t\tcdsTableHeadCell\n\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t[class]=\"column.className\"\n\t\t\t\t\t[sortable]=\"sortable\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[id]=\"model.getId(i)\"\n\t\t\t\t\t[column]=\"column\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[filterTitle]=\"getFilterTitle()\"\n\t\t\t\t\t[attr.colspan]=\"column.colSpan\"\n\t\t\t\t\t[attr.rowspan]=\"column.rowSpan\"\n\t\t\t\t\t(sort)=\"sort.emit(i)\">\n\t\t\t\t</th>\n\t\t\t</ng-container>\n\t\t\t<th *ngIf=\"!skeleton && stickyHeader && scrollbarWidth\"\n\t\t\t\tscope=\"col\"\n\t\t\t\t[ngStyle]=\"{'width': scrollbarWidth + 'px', 'padding': 0, 'border': 0}\">\n\t\t\t\t<!--\n\t\t\t\t\tScrollbar pushes body to the left so this header column is added to push\n\t\t\t\t\tthe title bar the same amount and keep the header and body columns aligned.\n\t\t\t\t-->\n\t\t\t</th>\n\t\t</tr>\n\t</ng-container>\n\t<ng-content></ng-content>\n\t`,\n\tstyles: [`\n\t\t.cds--table-expand-v2 {\n\t\t\tpadding-left: 2.5rem;\n\t\t}\n\t`]\n})\nexport class TableHead implements AfterViewInit {\n\t@Input() model: TableModel;\n\n\t@Input() showSelectionColumn = true;\n\n\t@Input() enableSingleSelect = false;\n\n\t@Input() selectAllCheckboxSomeSelected = false;\n\n\t@Input() selectAllCheckbox = false;\n\n\t@Input() skeleton = false;\n\n\t@Input() stickyHeader = false;\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()\n\tset checkboxHeaderLabel(value: string | Observable<string>) {\n\t\tthis._checkboxHeaderLabel.override(value);\n\t}\n\n\tget checkboxHeaderLabel() {\n\t\treturn this._checkboxHeaderLabel.value;\n\t}\n\n\t@Input()\n\tset sortDescendingLabel(value: string | Observable<string>) {\n\t\tthis._sortDescendingLabel.override(value);\n\t}\n\n\tget sortDescendingLabel() {\n\t\treturn this._sortDescendingLabel.value;\n\t}\n\n\t@Input()\n\tset sortAscendingLabel(value: string | Observable<string>) {\n\t\tthis._sortAscendingLabel.override(value);\n\t}\n\n\tget sortAscendingLabel() {\n\t\treturn this._sortAscendingLabel.value;\n\t}\n\n\t@Input()\n\tset filterTitle(value: string | Observable<string>) {\n\t\tthis._filterTitle.override(value);\n\t}\n\n\tget filterTitle() {\n\t\treturn this._filterTitle.value;\n\t}\n\n\t/**\n\t * Emits an index of the column that wants to be sorted.\n\t */\n\t@Output() sort = new EventEmitter<number>();\n\t/**\n\t * Emits if all rows are selected.\n\t *\n\t * @param model\n\t */\n\t@Output() selectAll = new EventEmitter<TableModel>();\n\t/**\n\t * Emits if all rows are deselected.\n\t *\n\t * @param model\n\t */\n\t@Output() deselectAll = new EventEmitter<TableModel>();\n\n\tpublic scrollbarWidth = 0;\n\n\tprotected _checkboxHeaderLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_HEADER\");\n\tprotected _sortDescendingLabel = this.i18n.getOverridable(\"TABLE.SORT_DESCENDING\");\n\tprotected _sortAscendingLabel = this.i18n.getOverridable(\"TABLE.SORT_ASCENDING\");\n\tprotected _filterTitle = this.i18n.getOverridable(\"TABLE.FILTER\");\n\n\tconstructor(protected i18n: I18n) {}\n\n\tngAfterViewInit() {\n\t\tsetTimeout(() => {\n\t\t\tthis.scrollbarWidth = getScrollbarWidth();\n\t\t});\n\t}\n\n\tonSelectAllCheckboxChange() {\n\t\tif (!this.selectAllCheckbox && !this.selectAllCheckboxSomeSelected) {\n\t\t\tthis.selectAll.emit(this.model);\n\t\t} else {\n\t\t\tthis.deselectAll.emit(this.model);\n\t\t}\n\t}\n\n\tgetCheckboxHeaderLabel(): Observable<string> {\n\t\treturn this._checkboxHeaderLabel.subject;\n\t}\n\n\tgetSortDescendingLabel(): Observable<string> {\n\t\treturn this._sortDescendingLabel.subject;\n\t}\n\n\tgetSortAscendingLabel(): Observable<string> {\n\t\treturn this._sortAscendingLabel.subject;\n\t}\n\n\tgetFilterTitle(): Observable<string> {\n\t\treturn this._filterTitle.subject;\n\t}\n}\n",
|
|
53775
53764
|
"assetsDirs": [],
|
|
53776
53765
|
"styleUrlsData": "",
|
|
53777
53766
|
"stylesData": "\n\t\t.cds--table-expand-v2 {\n\t\t\tpadding-left: 2.5rem;\n\t\t}\n\t\n",
|
|
@@ -53788,7 +53777,7 @@
|
|
|
53788
53777
|
"deprecationMessage": ""
|
|
53789
53778
|
}
|
|
53790
53779
|
],
|
|
53791
|
-
"line":
|
|
53780
|
+
"line": 171,
|
|
53792
53781
|
"jsdoctags": [
|
|
53793
53782
|
{
|
|
53794
53783
|
"name": "i18n",
|
|
@@ -53821,7 +53810,7 @@
|
|
|
53821
53810
|
}
|
|
53822
53811
|
],
|
|
53823
53812
|
"returnType": "void",
|
|
53824
|
-
"line":
|
|
53813
|
+
"line": 114,
|
|
53825
53814
|
"jsdoctags": [
|
|
53826
53815
|
{
|
|
53827
53816
|
"name": "value",
|
|
@@ -53838,7 +53827,7 @@
|
|
|
53838
53827
|
"name": "checkboxHeaderLabel",
|
|
53839
53828
|
"type": "",
|
|
53840
53829
|
"returnType": "",
|
|
53841
|
-
"line":
|
|
53830
|
+
"line": 118
|
|
53842
53831
|
}
|
|
53843
53832
|
},
|
|
53844
53833
|
"sortDescendingLabel": {
|
|
@@ -53857,7 +53846,7 @@
|
|
|
53857
53846
|
}
|
|
53858
53847
|
],
|
|
53859
53848
|
"returnType": "void",
|
|
53860
|
-
"line":
|
|
53849
|
+
"line": 123,
|
|
53861
53850
|
"jsdoctags": [
|
|
53862
53851
|
{
|
|
53863
53852
|
"name": "value",
|
|
@@ -53874,7 +53863,7 @@
|
|
|
53874
53863
|
"name": "sortDescendingLabel",
|
|
53875
53864
|
"type": "",
|
|
53876
53865
|
"returnType": "",
|
|
53877
|
-
"line":
|
|
53866
|
+
"line": 127
|
|
53878
53867
|
}
|
|
53879
53868
|
},
|
|
53880
53869
|
"sortAscendingLabel": {
|
|
@@ -53893,7 +53882,7 @@
|
|
|
53893
53882
|
}
|
|
53894
53883
|
],
|
|
53895
53884
|
"returnType": "void",
|
|
53896
|
-
"line":
|
|
53885
|
+
"line": 132,
|
|
53897
53886
|
"jsdoctags": [
|
|
53898
53887
|
{
|
|
53899
53888
|
"name": "value",
|
|
@@ -53910,7 +53899,7 @@
|
|
|
53910
53899
|
"name": "sortAscendingLabel",
|
|
53911
53900
|
"type": "",
|
|
53912
53901
|
"returnType": "",
|
|
53913
|
-
"line":
|
|
53902
|
+
"line": 136
|
|
53914
53903
|
}
|
|
53915
53904
|
},
|
|
53916
53905
|
"filterTitle": {
|
|
@@ -53929,7 +53918,7 @@
|
|
|
53929
53918
|
}
|
|
53930
53919
|
],
|
|
53931
53920
|
"returnType": "void",
|
|
53932
|
-
"line":
|
|
53921
|
+
"line": 141,
|
|
53933
53922
|
"jsdoctags": [
|
|
53934
53923
|
{
|
|
53935
53924
|
"name": "value",
|
|
@@ -53946,7 +53935,7 @@
|
|
|
53946
53935
|
"name": "filterTitle",
|
|
53947
53936
|
"type": "",
|
|
53948
53937
|
"returnType": "",
|
|
53949
|
-
"line":
|
|
53938
|
+
"line": 145
|
|
53950
53939
|
}
|
|
53951
53940
|
}
|
|
53952
53941
|
}
|
|
@@ -57983,7 +57972,7 @@
|
|
|
57983
57972
|
},
|
|
57984
57973
|
{
|
|
57985
57974
|
"name": "TextInputLabelComponent",
|
|
57986
|
-
"id": "component-TextInputLabelComponent-
|
|
57975
|
+
"id": "component-TextInputLabelComponent-f71db8d45024d4106cce6fdcc7be99bf211ca1f2c08b0f6c33cb0a9634f00cb220fc0afa62fa70e04331278e9ea1c79f92cbdd189d9f12c3dc382b60aafc14f7",
|
|
57987
57976
|
"file": "src/input/text-input-label.component.ts",
|
|
57988
57977
|
"encapsulation": [],
|
|
57989
57978
|
"entryComponents": [],
|
|
@@ -57993,7 +57982,7 @@
|
|
|
57993
57982
|
"selector": "cds-text-label, ibm-text-label",
|
|
57994
57983
|
"styleUrls": [],
|
|
57995
57984
|
"styles": [],
|
|
57996
|
-
"template": "<label\n\t[for]=\"labelInputID\"\n\t[attr.aria-label]=\"ariaLabel\"\n\tclass=\"cds--label\"\n\t[ngClass]=\"{\n\t\t'cds--label--disabled': disabled,\n\t\t'cds--skeleton': skeleton\n\t}\">\n\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t<ng-template #labelContent>\n\t\t<ng-content></ng-content>\n\t</ng-template>\n</label>\n<div\n\tclass=\"cds--text-input__field-wrapper\"\n\t[ngClass]=\"{\n\t\t'cds--text-input__field-wrapper--warning': warn\n\t}\"\n\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t#wrapper>\n\t<svg\n\t\t*ngIf=\"!warn && invalid\"\n\t\
|
|
57985
|
+
"template": "<label\n\t[for]=\"labelInputID\"\n\t[attr.aria-label]=\"ariaLabel\"\n\tclass=\"cds--label\"\n\t[ngClass]=\"{\n\t\t'cds--label--disabled': disabled,\n\t\t'cds--skeleton': skeleton\n\t}\">\n\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t<ng-template #labelContent>\n\t\t<ng-content></ng-content>\n\t</ng-template>\n</label>\n<div\n\tclass=\"cds--text-input__field-wrapper\"\n\t[ngClass]=\"{\n\t\t'cds--text-input__field-wrapper--warning': warn\n\t}\"\n\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t#wrapper>\n\t<svg\n\t\t*ngIf=\"!warn && invalid\"\n\t\tcdsIcon=\"warning--filled\"\n\t\tsize=\"16\"\n\t\tclass=\"cds--text-input__invalid-icon\">\n\t</svg>\n\t<svg\n\t\t*ngIf=\"!invalid && warn\"\n\t\tcdsIcon=\"warning--alt--filled\"\n\t\tsize=\"16\"\n\t\tclass=\"cds--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t</svg>\n\t<ng-template *ngIf=\"textInputTemplate; else textInputContent\" [ngTemplateOutlet]=\"textInputTemplate\"></ng-template>\n\t<ng-template #textInputContent>\n\t\t<ng-content select=\"input[type=text],div\"></ng-content>\n\t</ng-template>\n</div>\n<div\n\t*ngIf=\"!skeleton && helperText && !invalid && !warn\"\n\tclass=\"cds--form__helper-text\"\n\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n</div>\n<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n</div>\n<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n</div>\n\t",
|
|
57997
57986
|
"templateUrl": [],
|
|
57998
57987
|
"viewProviders": [],
|
|
57999
57988
|
"hostDirectives": [],
|
|
@@ -58218,7 +58207,7 @@
|
|
|
58218
58207
|
"description": "",
|
|
58219
58208
|
"rawdescription": "\n",
|
|
58220
58209
|
"type": "component",
|
|
58221
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tChangeDetectorRef\n} from \"@angular/core\";\n\n@Component({\n\tselector: \"cds-text-label, ibm-text-label\",\n\ttemplate: `\n\t\t<label\n\t\t\t[for]=\"labelInputID\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\tclass=\"cds--label\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t'cds--skeleton': skeleton\n\t\t\t}\">\n\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t<ng-template #labelContent>\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</ng-template>\n\t\t</label>\n\t\t<div\n\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t#wrapper>\n\t\t\t<svg\n\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\
|
|
58210
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tChangeDetectorRef\n} from \"@angular/core\";\n\n@Component({\n\tselector: \"cds-text-label, ibm-text-label\",\n\ttemplate: `\n\t\t<label\n\t\t\t[for]=\"labelInputID\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\tclass=\"cds--label\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t'cds--skeleton': skeleton\n\t\t\t}\">\n\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t<ng-template #labelContent>\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</ng-template>\n\t\t</label>\n\t\t<div\n\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--text-input__field-wrapper--warning': warn\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t#wrapper>\n\t\t\t<svg\n\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\tsize=\"16\"\n\t\t\t\tclass=\"cds--text-input__invalid-icon\">\n\t\t\t</svg>\n\t\t\t<svg\n\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\tsize=\"16\"\n\t\t\t\tclass=\"cds--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t\t\t</svg>\n\t\t\t<ng-template *ngIf=\"textInputTemplate; else textInputContent\" [ngTemplateOutlet]=\"textInputTemplate\"></ng-template>\n\t\t\t<ng-template #textInputContent>\n\t\t\t\t<ng-content select=\"input[type=text],div\"></ng-content>\n\t\t\t</ng-template>\n\t\t</div>\n\t\t<div\n\t\t\t*ngIf=\"!skeleton && helperText && !invalid && !warn\"\n\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t</div>\n\t\t<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t</div>\n\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t</div>\n\t`\n})\nexport class TextInputLabelComponent implements AfterViewInit {\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = \"ibm-text-input-\" + TextInputLabelComponent.labelCounter++;\n\n\t/**\n\t * Set to `true` for a disabled label.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\n\t/**\n\t * Helper input property for ease of migration\n\t * Since we cannot pass ng-content down easily from label component, we will accept the templates\n\t */\n\t@Input() labelTemplate: TemplateRef<any>;\n\t@Input() textInputTemplate: TemplateRef<any>;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t// @ts-ignore\n\t@ViewChild(\"wrapper\", { static: false }) wrapper: ElementRef<HTMLDivElement>;\n\n\t@HostBinding(\"class.cds--form-item\") labelClass = true;\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label`.\n\t */\n\tngAfterViewInit() {\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `input` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"input\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\n",
|
|
58222
58211
|
"assetsDirs": [],
|
|
58223
58212
|
"styleUrlsData": "",
|
|
58224
58213
|
"stylesData": "",
|
|
@@ -81416,8 +81405,8 @@
|
|
|
81416
81405
|
"type": "component",
|
|
81417
81406
|
"linktype": "component",
|
|
81418
81407
|
"name": "TableHead",
|
|
81419
|
-
"coveragePercent":
|
|
81420
|
-
"coverageCount": "
|
|
81408
|
+
"coveragePercent": 21,
|
|
81409
|
+
"coverageCount": "5/23",
|
|
81421
81410
|
"status": "low"
|
|
81422
81411
|
},
|
|
81423
81412
|
{
|