@ukic/canary-web-components 2.0.0-canary.24 → 2.0.0-canary.26
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/{helpers-85c5ca15.js → helpers-6817cfbb.js} +20 -31
- package/dist/cjs/helpers-6817cfbb.js.map +1 -0
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +9 -4
- package/dist/cjs/ic-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +2 -2
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-card-horizontal.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-table.cjs.entry.js +200 -51
- package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-date-input.cjs.entry.js +3 -2
- package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-date-picker.cjs.entry.js +3 -1
- package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-empty-state_2.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-with-multi.cjs.entry.js +1 -1
- package/dist/cjs/ic-pagination_4.cjs.entry.js +2 -1
- package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-select-with-multi.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast-region.cjs.entry.js +6 -0
- package/dist/cjs/ic-toast-region.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tree-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-tree-view.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ic-data-table/ic-data-table.css +31 -7
- package/dist/collection/components/ic-data-table/ic-data-table.js +298 -56
- package/dist/collection/components/ic-data-table/ic-data-table.js.map +1 -1
- package/dist/collection/components/ic-data-table/ic-data-table.types.js.map +1 -1
- package/dist/collection/components/ic-data-table/story-data.js +143 -54
- package/dist/collection/components/ic-data-table/story-data.js.map +1 -1
- package/dist/collection/components/ic-date-input/ic-date-input.js +20 -1
- package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -1
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +9 -0
- package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +1 -1
- package/dist/collection/components/ic-date-picker/ic-date-picker.js +20 -0
- package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -1
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +10 -0
- package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +1 -1
- package/dist/collection/utils/helpers.js +22 -0
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/components/helpers2.js +18 -29
- package/dist/components/helpers2.js.map +1 -1
- package/dist/components/ic-accordion.js +1 -1
- package/dist/components/ic-accordion.js.map +1 -1
- package/dist/components/ic-alert2.js +11 -5
- package/dist/components/ic-alert2.js.map +1 -1
- package/dist/components/ic-badge.js +2 -2
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-data-table.js +207 -52
- package/dist/components/ic-data-table.js.map +1 -1
- package/dist/components/ic-date-input2.js +3 -1
- package/dist/components/ic-date-input2.js.map +1 -1
- package/dist/components/ic-date-picker.js +3 -0
- package/dist/components/ic-date-picker.js.map +1 -1
- package/dist/components/ic-dialog.js.map +1 -1
- package/dist/components/ic-text-field2.js +3 -1
- package/dist/components/ic-text-field2.js.map +1 -1
- package/dist/components/ic-toast-region.js +6 -0
- package/dist/components/ic-toast-region.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-13993bf3.entry.js → p-01bc462e.entry.js} +2 -2
- package/dist/core/p-01bc462e.entry.js.map +1 -0
- package/dist/core/{p-401d0c66.entry.js → p-20997691.entry.js} +2 -2
- package/dist/core/p-297e99cf.js +2 -0
- package/dist/core/p-297e99cf.js.map +1 -0
- package/dist/core/p-40e5fa80.entry.js +2 -0
- package/dist/core/p-40e5fa80.entry.js.map +1 -0
- package/dist/core/p-673a4a62.entry.js.map +1 -1
- package/dist/core/p-6af080d3.entry.js +2 -0
- package/dist/core/p-6af080d3.entry.js.map +1 -0
- package/dist/core/p-74abc3bb.entry.js +2 -0
- package/dist/core/p-74abc3bb.entry.js.map +1 -0
- package/dist/core/{p-4309460f.entry.js → p-80d6a6b5.entry.js} +2 -2
- package/dist/core/{p-06732eaf.entry.js → p-92f701e7.entry.js} +2 -2
- package/dist/core/{p-ec9edecf.entry.js → p-989310a8.entry.js} +2 -2
- package/dist/core/p-989310a8.entry.js.map +1 -0
- package/dist/core/{p-ede631c5.entry.js → p-9b34989b.entry.js} +2 -2
- package/dist/core/p-bd1f8741.entry.js +2 -0
- package/dist/core/p-bd1f8741.entry.js.map +1 -0
- package/dist/core/{p-57043b1e.entry.js → p-c6bdbe69.entry.js} +2 -2
- package/dist/core/{p-a052bb95.entry.js → p-c98ce508.entry.js} +2 -2
- package/dist/core/{p-b29e96b5.entry.js → p-d362992d.entry.js} +2 -2
- package/dist/core/{p-b97eba08.entry.js → p-ee8a3de6.entry.js} +2 -2
- package/dist/core/p-ee8a3de6.entry.js.map +1 -0
- package/dist/core/p-f5fbfbc9.entry.js +2 -0
- package/dist/core/p-f5fbfbc9.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-f543bc77.js → helpers-5bd2012a.js} +19 -30
- package/dist/esm/helpers-5bd2012a.js.map +1 -0
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-accordion.entry.js.map +1 -1
- package/dist/esm/ic-alert.entry.js +10 -5
- package/dist/esm/ic-alert.entry.js.map +1 -1
- package/dist/esm/ic-badge.entry.js +2 -2
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-card-horizontal.entry.js +1 -1
- package/dist/esm/ic-data-table-title-bar.entry.js +1 -1
- package/dist/esm/ic-data-table.entry.js +201 -52
- package/dist/esm/ic-data-table.entry.js.map +1 -1
- package/dist/esm/ic-date-input.entry.js +3 -2
- package/dist/esm/ic-date-input.entry.js.map +1 -1
- package/dist/esm/ic-date-picker.entry.js +3 -1
- package/dist/esm/ic-date-picker.entry.js.map +1 -1
- package/dist/esm/ic-dialog.entry.js.map +1 -1
- package/dist/esm/ic-empty-state_2.entry.js +1 -1
- package/dist/esm/ic-menu-with-multi.entry.js +1 -1
- package/dist/esm/ic-pagination_4.entry.js +2 -1
- package/dist/esm/ic-pagination_4.entry.js.map +1 -1
- package/dist/esm/ic-select-with-multi.entry.js +1 -1
- package/dist/esm/ic-toast-region.entry.js +6 -0
- package/dist/esm/ic-toast-region.entry.js.map +1 -1
- package/dist/esm/ic-tree-item.entry.js +1 -1
- package/dist/esm/ic-tree-view.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-data-table/ic-data-table.d.ts +32 -9
- package/dist/types/components/ic-data-table/ic-data-table.types.d.ts +12 -4
- package/dist/types/components/ic-data-table/story-data.d.ts +69 -8
- package/dist/types/components/ic-date-input/ic-date-input.d.ts +4 -0
- package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +4 -0
- package/dist/types/components.d.ts +62 -6
- package/dist/types/interface.d.ts +1 -0
- package/dist/types/utils/helpers.d.ts +6 -0
- package/hydrate/index.js +267 -103
- package/package.json +6 -6
- package/dist/cjs/helpers-85c5ca15.js.map +0 -1
- package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js +0 -146
- package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js.map +0 -1
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js +0 -2040
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js.map +0 -1
- package/dist/core/p-13993bf3.entry.js.map +0 -1
- package/dist/core/p-1f9cb805.entry.js +0 -2
- package/dist/core/p-1f9cb805.entry.js.map +0 -1
- package/dist/core/p-3f2723aa.entry.js +0 -2
- package/dist/core/p-3f2723aa.entry.js.map +0 -1
- package/dist/core/p-59993f36.entry.js +0 -2
- package/dist/core/p-59993f36.entry.js.map +0 -1
- package/dist/core/p-91cf89c8.entry.js +0 -2
- package/dist/core/p-91cf89c8.entry.js.map +0 -1
- package/dist/core/p-9777ebb1.entry.js +0 -2
- package/dist/core/p-9777ebb1.entry.js.map +0 -1
- package/dist/core/p-adbe0d89.js +0 -2
- package/dist/core/p-adbe0d89.js.map +0 -1
- package/dist/core/p-b97eba08.entry.js.map +0 -1
- package/dist/core/p-ec9edecf.entry.js.map +0 -1
- package/dist/esm/helpers-f543bc77.js.map +0 -1
- package/dist/types/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.d.ts +0 -1
- /package/dist/core/{p-401d0c66.entry.js.map → p-20997691.entry.js.map} +0 -0
- /package/dist/core/{p-4309460f.entry.js.map → p-80d6a6b5.entry.js.map} +0 -0
- /package/dist/core/{p-06732eaf.entry.js.map → p-92f701e7.entry.js.map} +0 -0
- /package/dist/core/{p-ede631c5.entry.js.map → p-9b34989b.entry.js.map} +0 -0
- /package/dist/core/{p-57043b1e.entry.js.map → p-c6bdbe69.entry.js.map} +0 -0
- /package/dist/core/{p-a052bb95.entry.js.map → p-c98ce508.entry.js.map} +0 -0
- /package/dist/core/{p-b29e96b5.entry.js.map → p-d362992d.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
2
|
-
import { d as
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
|
+
import { d as dynamicDebounce, a as isEmptyString, p as pxToRem, i as isSlotUsed, b as addDataToPosition } from './helpers2.js';
|
3
3
|
import { d as defineCustomElement$h } from './ic-button2.js';
|
4
4
|
import { d as defineCustomElement$g } from './ic-empty-state2.js';
|
5
5
|
import { d as defineCustomElement$f } from './ic-input-component-container2.js';
|
@@ -29,7 +29,7 @@ const descendingIcon = `<svg focusable="false" aria-hidden="true" viewBox="0 0 2
|
|
29
29
|
<path d="M16.01 11H4v2h12.01v3L20 12l-3.99-4z"></path>
|
30
30
|
</svg>`;
|
31
31
|
|
32
|
-
const icDataTableCss = ":host{position:relative;display:
|
32
|
+
const icDataTableCss = ":host{position:relative;display:inline-flex;max-height:100%;width:var(--table-width, 100%);height:100%;min-width:var(--table-min-width);max-width:var(--table-max-width)}tbody{vertical-align:top}.table-container{position:relative;height:calc(100% - var(--ic-space-xxxs));display:flex;flex-direction:column;width:100%}.cell-container{display:flex;min-height:1.5rem;overflow-y:hidden;height:var(--row-height)}.truncation-show-hide{overflow:visible;display:block}.cell-icon.truncation-show-hide{display:flex}.cell-container:not(.data-type-element,.truncation-show-hide){overflow-x:hidden}ic-loading-indicator{position:sticky;top:20px}.table-row-container{position:relative;height:100%;overflow:auto;transition:var(--ic-easing-transition-fast);overflow-anchor:none}:host([show-pagination=\"true\"]) .table-row-container{height:calc(100% - 3.5625rem)}table{table-layout:var(--table-layout, \"fixed\");border-spacing:0;width:100%;height:var(--table-height, auto)}.table-row-container:focus{outline:none;box-shadow:var(--ic-border-focus);border-radius:var(--ic-border-radius);transition:var(--ic-easing-transition-fast);z-index:1}:host([embedded=\"true\"]) .table-row-container{border:var(--ic-border-light)}.column-header-inner-container{padding:var(--ic-space-xs);box-sizing:border-box}.column-header-sticky{position:sticky;top:0;z-index:1}.column-header-overlay{position:sticky;top:0;z-index:1;box-shadow:0 0.375rem var(--ic-space-xs) calc(var(--ic-space-xxs * -1))\n rgb(0 0 0 / 20%)}.row-header-sticky{position:sticky;left:0}.column-header,.table-row{box-sizing:border-box}.table-row-selected{background-color:var(--ic-table-row-selected) !important}.sort-button{margin-left:auto}.sort-button:hover{background-color:var(--ic-action-dark-bg-hover)}.sort-button:active{background-color:var(--ic-action-dark-bg-active)}.sort-button svg{color:var(--ic-architectural-black)}.sort-button-unsorted svg{color:var(--ic-color-tertiary-text)}.table-density-dense .column-header-inner-container,td.table-density-dense{padding:var(--ic-space-xxs) var(--ic-space-xs) !important}.text-dense{font-size:var(--ic-font-size-label)}.table-density-spacious .column-header-inner-container,td.table-density-spacious{padding:0.625rem var(--ic-space-xs) !important}.text-spacious{font-size:1.125rem}.column-header-text{font-weight:var(--ic-font-weight-bold)}.row-header,.column-header{text-align:left;padding:var(--ic-space-xs);background-color:var(--ic-architectural-40);border-right:var(--ic-border-light);border-bottom:var(--ic-border-light)}.column-header{padding:0;width:var(--column-width);min-width:var(--column-min-width, 4rem);max-width:var(--column-max-width)}.column-header:last-child{border-right:none}.scrollable .column-header:last-child{border-right:var(--ic-border-light) !important}:host([embedded=\"true\"]) tr:last-child .table-cell,:host([embedded=\"true\"]) tr:last-child .row-header{border-bottom:none}.column-header-alignment-left,.row-header-alignment-left,.cell-alignment-left{text-align:left !important;justify-content:start !important}.column-header-alignment-right,.row-header-alignment-right,.cell-alignment-right{text-align:right !important;justify-content:end !important}.cell-alignment-right.truncation-tooltip ic-tooltip ic-typography{padding-right:calc(var(--ic-space-xxs) + var(--ic-space-xs))}.cell-alignment-right.truncation-show-hide ic-typography{--ellipsis-padding-right:calc(var(--ic-space-xxs) + var(--ic-space-xs))}.column-header-alignment-center,.row-header-alignment-center,.cell-alignment-center{text-align:center !important;justify-content:center !important}.table-row:nth-child(even){background-color:var(--ic-architectural-20)}.table-cell{padding:var(--ic-space-xs);border-bottom:solid var(--ic-architectural-100) var(--ic-space-1px);overflow:hidden;box-sizing:border-box;max-width:var(--column-max-width);min-width:var(--column-min-width)}.data-type-string,.data-type-address{text-align:left;vertical-align:top}.data-type-number,.data-type-date{text-align:right;justify-content:end;vertical-align:top}.cell-alignment-top{vertical-align:top;align-items:flex-start}.cell-alignment-middle{vertical-align:middle;align-items:center}.cell-alignment-bottom{vertical-align:bottom;align-items:flex-end}.cell-emphasis-low{color:var(--ic-color-secondary-text)}.cell-emphasis-high{font-weight:var(--ic-font-weight-bold)}.pagination-container{background-color:var(--ic-architectural-40);border-top:var(--ic-border-light)}.screen-reader-sort-text,.table-caption{position:absolute;left:-100rem}.table-cell,.column-header,.row-header{word-wrap:break-word;white-space:pre-wrap}.loading-empty{padding:var(--ic-space-xl) var(--ic-space-xxl);margin-top:var(--ic-space-xl)}.updating-state{padding:0;border-bottom:var(--ic-border-light)}.updating-state-headers{border-bottom:none}.loading{position:absolute;left:calc(50% - 5.9741rem);opacity:0;transition:opacity var(--ic-transition-duration-slow)}.loading.show-background{background-color:var(--ic-architectural-white);border:var(--ic-border-light)}.loading.show{opacity:1}.icon,::slotted(svg){height:var(--ic-space-lg);width:var(--ic-space-lg);margin-right:var(--ic-space-xxs)}.column-header-alignment-right>.icon,.row-header-alignment-right>.icon,.cell-alignment-right>.icon,.column-header-alignment-right>::slotted(svg),.row-header-alignment-right>::slotted(svg),.cell-alignment-right>::slotted(svg){margin-right:auto}.column-header-alignment-center>ic-typography,.row-header-alignment-right>ic-typography,.cell-alignment-center>ic-typography{flex:1}.icon>svg{height:var(--ic-space-lg);width:var(--ic-space-lg);display:inline-block}.truncation-tooltip ic-typography{display:-webkit-box;-webkit-line-clamp:var(--ic-line-clamp, 0);-webkit-box-orient:vertical;overflow:hidden}.truncation-tooltip ic-typography,.truncation-show-hide ic-typography{white-space:normal}.ic-tooltip-overflow{overflow:hidden;width:100%}@media screen and (min-width: 576px){.column-header-inner-container{display:flex;align-items:center}}";
|
33
33
|
|
34
34
|
const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLElement {
|
35
35
|
constructor() {
|
@@ -67,8 +67,11 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
67
67
|
this.icPageChangeEvent = false;
|
68
68
|
this.itemsPerPageChange = false;
|
69
69
|
this.DATA_ROW_HEIGHT_STRING = "data-row-height";
|
70
|
+
this.ROW_HEIGHT_CSS_VARIABLE = "--row-height";
|
70
71
|
this.DEFAULT_LINE_HEIGHT = 24;
|
71
72
|
this.densityUpdate = false;
|
73
|
+
this.truncationPatternUpdated = false;
|
74
|
+
this.isNewDebounceDelaySet = false;
|
72
75
|
this.updateSetRowHeight = (typographyEl) => {
|
73
76
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
74
77
|
if (typographyEl) {
|
@@ -76,7 +79,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
76
79
|
const rowHeight = fontSize *
|
77
80
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
78
81
|
if (typographyEl.scrollHeight > rowHeight) {
|
79
|
-
cellContainer.style.removeProperty(
|
82
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
80
83
|
}
|
81
84
|
}
|
82
85
|
else {
|
@@ -85,24 +88,31 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
85
88
|
const rowHeight = fontSize *
|
86
89
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
87
90
|
if (typographyEl.scrollHeight > rowHeight) {
|
88
|
-
cellContainer.style.removeProperty(
|
91
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
89
92
|
}
|
90
93
|
});
|
91
94
|
}
|
92
95
|
};
|
93
96
|
this.debounceDataTruncation = () => {
|
94
97
|
this.getTypographyElements().forEach((typographyEl) => {
|
95
|
-
|
98
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
99
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
96
100
|
this.resizeObserver = new ResizeObserver(
|
97
101
|
// This gets triggered twice due to updated data and see more/see less button
|
98
|
-
|
99
|
-
// console.log("resizeObserver triggered");
|
102
|
+
dynamicDebounce(() => {
|
100
103
|
this.dataTruncation(typographyEl);
|
101
|
-
|
104
|
+
if (!this.isNewDebounceDelaySet) {
|
105
|
+
this.setNewDebounceDelay(200);
|
106
|
+
}
|
107
|
+
}, () => this.debounceDelay));
|
102
108
|
this.resizeObserver.observe(typographyEl);
|
103
109
|
}
|
104
110
|
});
|
105
111
|
};
|
112
|
+
this.setNewDebounceDelay = (delay) => {
|
113
|
+
this.debounceDelay = delay;
|
114
|
+
this.isNewDebounceDelaySet = true;
|
115
|
+
};
|
106
116
|
this.getLines = (height) => Math.floor(height / this.DEFAULT_LINE_HEIGHT);
|
107
117
|
this.truncate = (typographyEl, cellContainer, tooltip) => {
|
108
118
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
@@ -231,11 +241,40 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
231
241
|
}
|
232
242
|
return {};
|
233
243
|
};
|
244
|
+
this.getColumnWidth = (columnWidth) => {
|
245
|
+
// TODO: Setting max width on columns
|
246
|
+
let columnWidthStyling = {};
|
247
|
+
if (columnWidth) {
|
248
|
+
if (typeof columnWidth === "string") {
|
249
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-width"]: columnWidth });
|
250
|
+
}
|
251
|
+
if (typeof columnWidth === "object" && !!Object.keys(columnWidth)) {
|
252
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth) {
|
253
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-min-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth });
|
254
|
+
}
|
255
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth) {
|
256
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-max-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth });
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
return columnWidthStyling;
|
261
|
+
};
|
262
|
+
this.getRowHeight = (currentRowHeight, columnProps, rowTextWrap, cell) => {
|
263
|
+
if ((this.truncationPattern || currentRowHeight) &&
|
264
|
+
!(columnProps === null || columnProps === void 0 ? void 0 : columnProps.textWrap) &&
|
265
|
+
!rowTextWrap &&
|
266
|
+
!this.getCellOptions(cell, "textWrap") &&
|
267
|
+
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element") {
|
268
|
+
return {
|
269
|
+
[this.ROW_HEIGHT_CSS_VARIABLE]: this.setRowHeight(currentRowHeight),
|
270
|
+
};
|
271
|
+
}
|
272
|
+
return {};
|
273
|
+
};
|
234
274
|
this.createCells = (row, rowIndex) => {
|
235
275
|
var _a;
|
236
276
|
const rowValues = Object.values(row);
|
237
277
|
const rowKeys = Object.keys(row);
|
238
|
-
const index = rowIndex;
|
239
278
|
const rowOptions = this.getRowOptions(rowKeys, rowValues);
|
240
279
|
let rowAlignment;
|
241
280
|
let rowEmphasis;
|
@@ -244,7 +283,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
244
283
|
rowAlignment = this.getObjectValue(rowValues[headerIndex], "rowAlignment");
|
245
284
|
rowEmphasis = this.getObjectValue(rowValues[headerIndex], "emphasis");
|
246
285
|
}
|
247
|
-
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index }));
|
286
|
+
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index: rowIndex }));
|
248
287
|
const currentRowHeight = variableRowHeightVal
|
249
288
|
? variableRowHeightVal !== "auto" && variableRowHeightVal
|
250
289
|
: this.globalRowHeight !== "auto" && this.globalRowHeight;
|
@@ -265,7 +304,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
265
304
|
return (h("td", { class: {
|
266
305
|
["table-cell"]: true,
|
267
306
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
268
|
-
} }, h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
307
|
+
}, style: Object.assign({}, this.getColumnWidth(columnProps.columnWidth)) }, h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
269
308
|
!isSlotUsed(this.el, cellSlotName)
|
270
309
|
? cell
|
271
310
|
: null, class: Object.assign({ "cell-container": (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element", [`cell-alignment-${((_a = columnProps === null || columnProps === void 0 ? void 0 : columnProps.columnAlignment) === null || _a === void 0 ? void 0 : _a.vertical) ||
|
@@ -280,15 +319,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
280
319
|
!!((_h = rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.rowAlignment) === null || _h === void 0 ? void 0 : _h.horizontal) ||
|
281
320
|
!!this.getCellAlignment(cell, "horizontal"), [`data-type-${columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType}`]: true, [this.TEXT_WRAP_STRING]: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.textWrap) ||
|
282
321
|
(rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.textWrap) ||
|
283
|
-
!!this.getCellOptions(cell, "textWrap"), ["cell-icon"]: hasIcon || !!((_j = columnProps === null || columnProps === void 0 ? void 0 : columnProps.icon) === null || _j === void 0 ? void 0 : _j.icon) }, this.setTruncationClass()), style: {
|
284
|
-
height: (this.truncationPattern || currentRowHeight) &&
|
285
|
-
!columnProps.textWrap &&
|
286
|
-
!rowOptions.textWrap &&
|
287
|
-
!this.getCellOptions(cell, "textWrap") &&
|
288
|
-
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element"
|
289
|
-
? this.setRowHeight(currentRowHeight)
|
290
|
-
: null,
|
291
|
-
}, "data-row-height": this.truncationPattern || currentRowHeight
|
322
|
+
!!this.getCellOptions(cell, "textWrap"), ["cell-icon"]: hasIcon || !!((_j = columnProps === null || columnProps === void 0 ? void 0 : columnProps.icon) === null || _j === void 0 ? void 0 : _j.icon) }, this.setTruncationClass()), style: Object.assign(Object.assign({}, this.getRowHeight(currentRowHeight, columnProps, rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.textWrap, cell)), this.getColumnWidth(columnProps === null || columnProps === void 0 ? void 0 : columnProps.columnWidth)), "data-row-height": this.truncationPattern || currentRowHeight
|
292
323
|
? this.setRowHeight(currentRowHeight)
|
293
324
|
: null }, isSlotUsed(this.el, cellSlotName) ? (h("slot", { name: cellSlotName })) : (h(Fragment, null, isSlotUsed(this.el, `${cellSlotName}-icon`) ? (h("slot", { name: `${cellSlotName}-icon` })) : ((hasIcon || ((_k = columnProps === null || columnProps === void 0 ? void 0 : columnProps.icon) === null || _k === void 0 ? void 0 : _k.onAllCells)) && (h("span", { class: "icon", innerHTML: cellValue("icon") || (columnProps === null || columnProps === void 0 ? void 0 : columnProps.icon.icon) }))), (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element" &&
|
294
325
|
!isSlotUsed(this.el, cellSlotName) && (h("ic-typography", { variant: "body", class: {
|
@@ -304,11 +335,11 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
304
335
|
});
|
305
336
|
};
|
306
337
|
this.createColumnHeaders = () => {
|
307
|
-
return this.columns.map(({ cellAlignment, colspan, icon, key, title }) => (h("th", { scope: "col", class: {
|
338
|
+
return this.columns.map(({ cellAlignment, colspan, icon, key, title, columnWidth }) => (h("th", { scope: "col", class: {
|
308
339
|
["column-header"]: true,
|
309
340
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
310
341
|
["updating-state-headers"]: this.updating && !this.loading,
|
311
|
-
}, colSpan: colspan }, h("div", { class: {
|
342
|
+
}, style: Object.assign({}, this.getColumnWidth(columnWidth)), colSpan: colspan }, h("div", { class: {
|
312
343
|
"column-header-inner-container": true,
|
313
344
|
[`column-header-alignment-${cellAlignment}`]: !!cellAlignment,
|
314
345
|
} }, isSlotUsed(this.el, `${key}-column-icon`) ? (h("slot", { name: `${key}-column-icon` })) : (icon &&
|
@@ -336,16 +367,18 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
336
367
|
/**
|
337
368
|
* Ensures that createCells has a value in data to map over to actually render the slot.
|
338
369
|
* Removes the need for the user to add it multiple times.
|
370
|
+
* `addDataToPosition` used to add the element in the correct column order.
|
371
|
+
* Adding empty string value in to give `createCells` something to loop over.
|
339
372
|
*/
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
373
|
+
const organisedData = data.map((row, rowIndex) => {
|
374
|
+
const slottedColumns = this.columns
|
375
|
+
.map(({ key }, index) => isSlotUsed(this.el, `${key}-${rowIndex}`) && { key, index })
|
376
|
+
.filter((col) => !!col);
|
377
|
+
return slottedColumns.length > 0
|
378
|
+
? addDataToPosition(row, slottedColumns, "")
|
379
|
+
: row;
|
347
380
|
});
|
348
|
-
return
|
381
|
+
return organisedData
|
349
382
|
.sort(!this.sortable ? undefined : this.getSortFunction())
|
350
383
|
.map((row, index) => {
|
351
384
|
return (h("tr", {
|
@@ -442,6 +475,22 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
442
475
|
this.updateScrollOffset = () => {
|
443
476
|
this.scrollOffset = this.el.shadowRoot.querySelector(".table-row-container").scrollTop;
|
444
477
|
};
|
478
|
+
this.setTableDimensions = () => {
|
479
|
+
let tableHostDimensions = {};
|
480
|
+
if (this.width) {
|
481
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-width"]: this.width });
|
482
|
+
}
|
483
|
+
if (this.height) {
|
484
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-height"]: this.height });
|
485
|
+
}
|
486
|
+
if (this.maxWidth) {
|
487
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-max-width"]: this.maxWidth });
|
488
|
+
}
|
489
|
+
if (this.minWidth) {
|
490
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-min-width"]: this.minWidth });
|
491
|
+
}
|
492
|
+
return tableHostDimensions;
|
493
|
+
};
|
445
494
|
this.fromRow = 0;
|
446
495
|
this.previousRowsPerPage = undefined;
|
447
496
|
this.rowsPerPage = undefined;
|
@@ -452,15 +501,19 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
452
501
|
this.sortedColumnOrder = undefined;
|
453
502
|
this.toRow = undefined;
|
454
503
|
this.currentRowHeight = undefined;
|
504
|
+
this.debounceDelay = 0;
|
455
505
|
this.caption = undefined;
|
456
506
|
this.columns = undefined;
|
457
507
|
this.data = undefined;
|
458
508
|
this.density = "default";
|
459
509
|
this.embedded = false;
|
460
510
|
this.globalRowHeight = "auto";
|
511
|
+
this.height = undefined;
|
461
512
|
this.hideColumnHeaders = false;
|
462
513
|
this.loading = false;
|
463
514
|
this.loadingOptions = undefined;
|
515
|
+
this.maxWidth = undefined;
|
516
|
+
this.minWidth = undefined;
|
464
517
|
this.minimumLoadingDisplayDuration = 1000;
|
465
518
|
this.paginationBarOptions = {
|
466
519
|
itemsPerPageOptions: [
|
@@ -486,10 +539,12 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
486
539
|
};
|
487
540
|
this.stickyColumnHeaders = false;
|
488
541
|
this.stickyRowHeaders = false;
|
542
|
+
this.tableLayout = "fixed";
|
489
543
|
this.truncationPattern = undefined;
|
490
544
|
this.updating = false;
|
491
545
|
this.updatingOptions = undefined;
|
492
546
|
this.variableRowHeight = undefined;
|
547
|
+
this.width = undefined;
|
493
548
|
}
|
494
549
|
disconnectedCallback() {
|
495
550
|
var _a;
|
@@ -522,7 +577,8 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
522
577
|
}
|
523
578
|
if (this.truncationPattern) {
|
524
579
|
this.getTypographyElements().forEach((typographyEl) => {
|
525
|
-
|
580
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
581
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
526
582
|
this.dataTruncation(typographyEl);
|
527
583
|
}
|
528
584
|
});
|
@@ -533,12 +589,31 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
533
589
|
}
|
534
590
|
}
|
535
591
|
componentDidUpdate() {
|
536
|
-
|
592
|
+
// truncation updates invoked here once new/updated data has
|
593
|
+
// rendered to take into account updated .cell-container/ic-typography box model updates.
|
594
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING ||
|
595
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
596
|
+
this.truncateUpdatedData();
|
597
|
+
}
|
537
598
|
}
|
538
599
|
truncateUpdatedData() {
|
539
600
|
if (this.dataUpdated) {
|
540
601
|
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
541
|
-
this.
|
602
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
603
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
604
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
605
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >=
|
606
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
607
|
+
this.resetShowHideTruncation(typographyEl);
|
608
|
+
return;
|
609
|
+
}
|
610
|
+
setTimeout(() => {
|
611
|
+
// slight delay due to data rendering
|
612
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
613
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
614
|
+
}
|
615
|
+
}, 150);
|
616
|
+
});
|
542
617
|
}
|
543
618
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
544
619
|
this.updateTruncationTooltip();
|
@@ -549,23 +624,49 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
549
624
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
550
625
|
this.updateTruncationTooltip();
|
551
626
|
}
|
627
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
628
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
629
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
630
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
631
|
+
this.createShowHideTruncation(typographyEl, cellContainer);
|
632
|
+
}
|
633
|
+
else {
|
634
|
+
typographyEl.resetTruncation().then(() => {
|
635
|
+
cellContainer.removeAttribute("style");
|
636
|
+
});
|
637
|
+
}
|
638
|
+
});
|
639
|
+
}
|
552
640
|
this.tableSorted = false;
|
553
641
|
}
|
554
642
|
// This function recalculates the tooltip truncation when the rowHeight has been set.
|
555
643
|
// This is in componentDidUpdate so a setTimeout is not used to wait for the render to be complete
|
556
644
|
if (this.rowHeightSet) {
|
557
645
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
646
|
+
const hasAutoRowHeight = this.globalRowHeight === "auto";
|
558
647
|
this.getTypographyElements().forEach((typographyEl) => {
|
559
648
|
var _a;
|
560
649
|
const cellContainer = this.getCellContainer(typographyEl);
|
561
650
|
const tooltipEl = this.getTooltip(typographyEl);
|
651
|
+
if (hasAutoRowHeight) {
|
652
|
+
cellContainer.style.height = null;
|
653
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
654
|
+
this.removeTooltip(cellContainer, typographyEl, tooltipEl);
|
655
|
+
typographyEl.setAttribute("style", `--ic-line-clamp: 0`);
|
656
|
+
}
|
657
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
658
|
+
this.resetShowHideTruncation(typographyEl);
|
659
|
+
}
|
660
|
+
return;
|
661
|
+
}
|
562
662
|
const rowHeight = fontSize *
|
563
663
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
564
664
|
// If the set row height is bigger than the cell container even
|
565
665
|
// with textWrap, set the row height
|
566
666
|
if (!((_a = cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.style) === null || _a === void 0 ? void 0 : _a.height) &&
|
567
|
-
rowHeight > cellContainer.clientHeight
|
568
|
-
cellContainer.
|
667
|
+
rowHeight > cellContainer.clientHeight &&
|
668
|
+
!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
669
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
569
670
|
}
|
570
671
|
if (this.truncationPattern) {
|
571
672
|
// If the set row height is bigger than the typography truncation wrapper
|
@@ -631,12 +732,37 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
631
732
|
});
|
632
733
|
this.densityUpdate = false;
|
633
734
|
}
|
735
|
+
if (this.truncationPatternUpdated) {
|
736
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
737
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
738
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
739
|
+
const tooltipEl = this.getTooltip(typographyEl);
|
740
|
+
if (typographyEl.scrollHeight > cellContainer.clientHeight) {
|
741
|
+
this.addTooltipTruncation(typographyEl, cellContainer, tooltipEl);
|
742
|
+
}
|
743
|
+
});
|
744
|
+
}
|
745
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
746
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
747
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
748
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
749
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
750
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
751
|
+
this.resetShowHideTruncation(typographyEl);
|
752
|
+
return;
|
753
|
+
}
|
754
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
755
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
756
|
+
}
|
757
|
+
});
|
758
|
+
}
|
759
|
+
}
|
634
760
|
}
|
635
761
|
createShowHideTruncation(typographyEl, cellContainer) {
|
636
762
|
typographyEl.checkMaxLines(typographyEl.scrollHeight);
|
637
763
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
638
764
|
typographyEl.setShowHideExpanded(false);
|
639
|
-
cellContainer.style.
|
765
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
640
766
|
}
|
641
767
|
addTooltipTruncation(typographyEl, cellContainer, tooltip) {
|
642
768
|
this.addLineClampCSS(typographyEl, cellContainer);
|
@@ -656,8 +782,9 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
656
782
|
handleTypographyTruncationExpandToggle({ detail, }) {
|
657
783
|
const { expanded, typographyEl } = detail;
|
658
784
|
const cellContainer = this.getCellContainer(typographyEl);
|
659
|
-
if (cellContainer.style.
|
660
|
-
|
785
|
+
if (cellContainer.style.getPropertyValue(this.ROW_HEIGHT_CSS_VARIABLE) &&
|
786
|
+
expanded) {
|
787
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, "inherit");
|
661
788
|
}
|
662
789
|
}
|
663
790
|
handlePageChange({ detail, target }) {
|
@@ -707,7 +834,8 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
707
834
|
}
|
708
835
|
}
|
709
836
|
truncationPatternHandler(newValue) {
|
710
|
-
if (newValue === this.
|
837
|
+
if (newValue === this.TOOLTIP_STRING) {
|
838
|
+
this.resetShowHideTruncation();
|
711
839
|
this.updateTruncationTooltip(true);
|
712
840
|
// Not using debounceDataTruncation here due to resizeObserver not being triggered
|
713
841
|
this.getTypographyElements().forEach((typographyEl) => {
|
@@ -716,11 +844,27 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
716
844
|
this.truncate(typographyEl, cellContainer, tooltip);
|
717
845
|
});
|
718
846
|
}
|
719
|
-
if (newValue === this.
|
847
|
+
if (newValue === this.SHOW_HIDE_STRING) {
|
720
848
|
// ResizeObserver is trigger here due to the see more/see less links being removed.
|
721
849
|
// The resizeObserver will also apply the tooltip where relevant
|
722
|
-
this.
|
850
|
+
this.updateTruncationTooltip(true);
|
851
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
852
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
853
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
854
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
855
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
856
|
+
this.resetShowHideTruncation(typographyEl);
|
857
|
+
return;
|
858
|
+
}
|
859
|
+
setTimeout(() => {
|
860
|
+
// slight delay due to data rendering
|
861
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
862
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
863
|
+
}
|
864
|
+
}, 150);
|
865
|
+
});
|
723
866
|
}
|
867
|
+
this.truncationPatternUpdated = true;
|
724
868
|
}
|
725
869
|
async dataHandler(newData) {
|
726
870
|
this.loadingOptions = Object.assign(Object.assign({}, this.loadingOptions), { showBackground: (newData === null || newData === void 0 ? void 0 : newData.length) > 0 });
|
@@ -748,11 +892,13 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
748
892
|
typographyEl.checkMaxLines(truncWrapper.scrollHeight);
|
749
893
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
750
894
|
typographyEl.setShowHideExpanded(false);
|
751
|
-
cellContainer.style.
|
895
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
752
896
|
}
|
753
897
|
else {
|
754
898
|
typographyEl.resetTruncation().then(() => {
|
755
|
-
|
899
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
900
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
901
|
+
}
|
756
902
|
});
|
757
903
|
}
|
758
904
|
}
|
@@ -760,7 +906,9 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
760
906
|
this.getTypographyElements().forEach((typographyEl) => {
|
761
907
|
const cellContainer = this.getCellContainer(typographyEl);
|
762
908
|
typographyEl.resetTruncation().then(() => {
|
763
|
-
|
909
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
910
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
911
|
+
}
|
764
912
|
});
|
765
913
|
});
|
766
914
|
}
|
@@ -808,11 +956,10 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
808
956
|
if (!typographyEl.getAttribute("style") && this.dataUpdated) {
|
809
957
|
this.addLineClampCSS(typographyEl, cellContainer);
|
810
958
|
}
|
811
|
-
// Adding the tableSorted boolean prevents the tooltip
|
812
|
-
// being regenerated and flashing
|
813
959
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) &&
|
814
|
-
|
815
|
-
if (!typographyEl.getAttribute("style")
|
960
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
961
|
+
if (!typographyEl.getAttribute("style") ||
|
962
|
+
typographyEl.style.cssText.includes("--ic-line-clamp: 0;")) {
|
816
963
|
this.addLineClampCSS(typographyEl, cellContainer);
|
817
964
|
}
|
818
965
|
this.createTruncationTooltip(typographyEl, cellContainer);
|
@@ -841,10 +988,12 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
841
988
|
}
|
842
989
|
render() {
|
843
990
|
const { caption, createColumnHeaders, createRows, createUpdatingIndicator, data, hideColumnHeaders, loading, loadingOptions, paginationBarOptions, scrollable, scrollOffset, showPagination, sortable, sortedColumnOrder, sortedColumn, stickyColumnHeaders, updateScrollOffset, updating, } = this;
|
844
|
-
return (h("div", { class: "table-container" }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("div", { class: {
|
991
|
+
return (h(Host, { style: Object.assign({}, this.setTableDimensions()) }, h("div", { class: "table-container" }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("div", { class: {
|
845
992
|
["table-row-container"]: true,
|
846
993
|
scrollable,
|
847
|
-
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("table",
|
994
|
+
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("table", { style: {
|
995
|
+
["--table-layout"]: this.tableLayout,
|
996
|
+
} }, h("caption", { class: "table-caption" }, caption), !hideColumnHeaders && (h("thead", { class: {
|
848
997
|
["column-header-sticky"]: stickyColumnHeaders,
|
849
998
|
["column-header-overlay"]: stickyColumnHeaders && scrollOffset !== 0,
|
850
999
|
} }, h("tr", null, createColumnHeaders()))), updating &&
|
@@ -857,7 +1006,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
857
1006
|
"show-background": loadingOptions.showBackground,
|
858
1007
|
}, description: loadingOptions.description || "Loading table data", label: loadingOptions.label || "Loading...", labelDuration: loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.labelDuration, max: loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.max, min: loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.min, progress: loadingOptions === null || loadingOptions === void 0 ? void 0 : loadingOptions.progress, ref: (el) => (this.loadingIndicator = el) })), (showPagination || isSlotUsed(this.el, "pagination-bar")) && (h("div", { class: "pagination-container" }, isSlotUsed(this.el, "pagination-bar") ? (h("slot", { name: "pagination-bar" })) : (h("ic-pagination-bar", { totalItems: data.length, type: paginationBarOptions.type, rangeLabelType: paginationBarOptions.rangeLabelType, showItemsPerPageControl: paginationBarOptions.showItemsPerPageControl, showGoToPageControl: paginationBarOptions.showGoToPageControl, itemsPerPageOptions: paginationBarOptions.itemsPerPageOptions, alignment: paginationBarOptions.alignment, appearance: paginationBarOptions.appearance, itemLabel: paginationBarOptions.itemLabel, pageLabel: paginationBarOptions.pageLabel, hideRangeLabel: paginationBarOptions.hideRangeLabel })))), sortable && (h("div", { class: "screen-reader-sort-text", "aria-live": "polite" }, sortedColumnOrder !== "unsorted" && sortedColumn
|
859
1008
|
? `${sortedColumn} sorted ${sortedColumnOrder}`
|
860
|
-
: "table unsorted"))));
|
1009
|
+
: "table unsorted")))));
|
861
1010
|
}
|
862
1011
|
get el() { return this; }
|
863
1012
|
static get watchers() { return {
|
@@ -876,9 +1025,12 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
876
1025
|
"density": [1025],
|
877
1026
|
"embedded": [4],
|
878
1027
|
"globalRowHeight": [1032, "global-row-height"],
|
1028
|
+
"height": [1],
|
879
1029
|
"hideColumnHeaders": [4, "hide-column-headers"],
|
880
1030
|
"loading": [1028],
|
881
1031
|
"loadingOptions": [16],
|
1032
|
+
"maxWidth": [1, "max-width"],
|
1033
|
+
"minWidth": [1, "min-width"],
|
882
1034
|
"minimumLoadingDisplayDuration": [2, "minimum-loading-display-duration"],
|
883
1035
|
"paginationBarOptions": [16],
|
884
1036
|
"showPagination": [4, "show-pagination"],
|
@@ -886,10 +1038,12 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
886
1038
|
"sortOptions": [16],
|
887
1039
|
"stickyColumnHeaders": [4, "sticky-column-headers"],
|
888
1040
|
"stickyRowHeaders": [4, "sticky-row-headers"],
|
1041
|
+
"tableLayout": [1, "table-layout"],
|
889
1042
|
"truncationPattern": [1, "truncation-pattern"],
|
890
1043
|
"updating": [4],
|
891
1044
|
"updatingOptions": [16],
|
892
1045
|
"variableRowHeight": [1040],
|
1046
|
+
"width": [1],
|
893
1047
|
"fromRow": [32],
|
894
1048
|
"previousRowsPerPage": [32],
|
895
1049
|
"rowsPerPage": [32],
|
@@ -900,6 +1054,7 @@ const DataTable = /*@__PURE__*/ proxyCustomElement(class DataTable extends HTMLE
|
|
900
1054
|
"sortedColumnOrder": [32],
|
901
1055
|
"toRow": [32],
|
902
1056
|
"currentRowHeight": [32],
|
1057
|
+
"debounceDelay": [32],
|
903
1058
|
"resetRowHeights": [64]
|
904
1059
|
}, [[0, "typographyTruncationExpandToggle", "handleTypographyTruncationExpandToggle"], [0, "icPageChange", "handlePageChange"], [0, "icItemsPerPageChange", "handleItemsPerPageChange"], [0, "icTableDensityUpdate", "handleDensityChange"], [8, "click", "clickListener"]], {
|
905
1060
|
"loading": ["loadingHandler"],
|