@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
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-4cf27b16.js');
|
6
|
-
const helpers = require('./helpers-
|
6
|
+
const helpers = require('./helpers-6817cfbb.js');
|
7
7
|
|
8
8
|
const unsortedIcon = `<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24">
|
9
9
|
<path d="M9 3 5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3z"></path>
|
@@ -17,7 +17,7 @@ const descendingIcon = `<svg focusable="false" aria-hidden="true" viewBox="0 0 2
|
|
17
17
|
<path d="M16.01 11H4v2h12.01v3L20 12l-3.99-4z"></path>
|
18
18
|
</svg>`;
|
19
19
|
|
20
|
-
const icDataTableCss = ":host{position:relative;display:
|
20
|
+
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}}";
|
21
21
|
|
22
22
|
const DataTable = class {
|
23
23
|
constructor(hostRef) {
|
@@ -53,8 +53,11 @@ const DataTable = class {
|
|
53
53
|
this.icPageChangeEvent = false;
|
54
54
|
this.itemsPerPageChange = false;
|
55
55
|
this.DATA_ROW_HEIGHT_STRING = "data-row-height";
|
56
|
+
this.ROW_HEIGHT_CSS_VARIABLE = "--row-height";
|
56
57
|
this.DEFAULT_LINE_HEIGHT = 24;
|
57
58
|
this.densityUpdate = false;
|
59
|
+
this.truncationPatternUpdated = false;
|
60
|
+
this.isNewDebounceDelaySet = false;
|
58
61
|
this.updateSetRowHeight = (typographyEl) => {
|
59
62
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
60
63
|
if (typographyEl) {
|
@@ -62,7 +65,7 @@ const DataTable = class {
|
|
62
65
|
const rowHeight = fontSize *
|
63
66
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
64
67
|
if (typographyEl.scrollHeight > rowHeight) {
|
65
|
-
cellContainer.style.removeProperty(
|
68
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
66
69
|
}
|
67
70
|
}
|
68
71
|
else {
|
@@ -71,24 +74,31 @@ const DataTable = class {
|
|
71
74
|
const rowHeight = fontSize *
|
72
75
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
73
76
|
if (typographyEl.scrollHeight > rowHeight) {
|
74
|
-
cellContainer.style.removeProperty(
|
77
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
75
78
|
}
|
76
79
|
});
|
77
80
|
}
|
78
81
|
};
|
79
82
|
this.debounceDataTruncation = () => {
|
80
83
|
this.getTypographyElements().forEach((typographyEl) => {
|
81
|
-
|
84
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
85
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
82
86
|
this.resizeObserver = new ResizeObserver(
|
83
87
|
// This gets triggered twice due to updated data and see more/see less button
|
84
|
-
helpers.
|
85
|
-
// console.log("resizeObserver triggered");
|
88
|
+
helpers.dynamicDebounce(() => {
|
86
89
|
this.dataTruncation(typographyEl);
|
87
|
-
|
90
|
+
if (!this.isNewDebounceDelaySet) {
|
91
|
+
this.setNewDebounceDelay(200);
|
92
|
+
}
|
93
|
+
}, () => this.debounceDelay));
|
88
94
|
this.resizeObserver.observe(typographyEl);
|
89
95
|
}
|
90
96
|
});
|
91
97
|
};
|
98
|
+
this.setNewDebounceDelay = (delay) => {
|
99
|
+
this.debounceDelay = delay;
|
100
|
+
this.isNewDebounceDelaySet = true;
|
101
|
+
};
|
92
102
|
this.getLines = (height) => Math.floor(height / this.DEFAULT_LINE_HEIGHT);
|
93
103
|
this.truncate = (typographyEl, cellContainer, tooltip) => {
|
94
104
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
@@ -217,11 +227,40 @@ const DataTable = class {
|
|
217
227
|
}
|
218
228
|
return {};
|
219
229
|
};
|
230
|
+
this.getColumnWidth = (columnWidth) => {
|
231
|
+
// TODO: Setting max width on columns
|
232
|
+
let columnWidthStyling = {};
|
233
|
+
if (columnWidth) {
|
234
|
+
if (typeof columnWidth === "string") {
|
235
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-width"]: columnWidth });
|
236
|
+
}
|
237
|
+
if (typeof columnWidth === "object" && !!Object.keys(columnWidth)) {
|
238
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth) {
|
239
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-min-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth });
|
240
|
+
}
|
241
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth) {
|
242
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-max-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth });
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
return columnWidthStyling;
|
247
|
+
};
|
248
|
+
this.getRowHeight = (currentRowHeight, columnProps, rowTextWrap, cell) => {
|
249
|
+
if ((this.truncationPattern || currentRowHeight) &&
|
250
|
+
!(columnProps === null || columnProps === void 0 ? void 0 : columnProps.textWrap) &&
|
251
|
+
!rowTextWrap &&
|
252
|
+
!this.getCellOptions(cell, "textWrap") &&
|
253
|
+
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element") {
|
254
|
+
return {
|
255
|
+
[this.ROW_HEIGHT_CSS_VARIABLE]: this.setRowHeight(currentRowHeight),
|
256
|
+
};
|
257
|
+
}
|
258
|
+
return {};
|
259
|
+
};
|
220
260
|
this.createCells = (row, rowIndex) => {
|
221
261
|
var _a;
|
222
262
|
const rowValues = Object.values(row);
|
223
263
|
const rowKeys = Object.keys(row);
|
224
|
-
const index$1 = rowIndex;
|
225
264
|
const rowOptions = this.getRowOptions(rowKeys, rowValues);
|
226
265
|
let rowAlignment;
|
227
266
|
let rowEmphasis;
|
@@ -230,7 +269,7 @@ const DataTable = class {
|
|
230
269
|
rowAlignment = this.getObjectValue(rowValues[headerIndex], "rowAlignment");
|
231
270
|
rowEmphasis = this.getObjectValue(rowValues[headerIndex], "emphasis");
|
232
271
|
}
|
233
|
-
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index:
|
272
|
+
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index: rowIndex }));
|
234
273
|
const currentRowHeight = variableRowHeightVal
|
235
274
|
? variableRowHeightVal !== "auto" && variableRowHeightVal
|
236
275
|
: this.globalRowHeight !== "auto" && this.globalRowHeight;
|
@@ -251,7 +290,7 @@ const DataTable = class {
|
|
251
290
|
return (index.h("td", { class: {
|
252
291
|
["table-cell"]: true,
|
253
292
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
254
|
-
} }, index.h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
293
|
+
}, style: Object.assign({}, this.getColumnWidth(columnProps.columnWidth)) }, index.h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
255
294
|
!helpers.isSlotUsed(this.el, cellSlotName)
|
256
295
|
? cell
|
257
296
|
: 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) ||
|
@@ -266,15 +305,7 @@ const DataTable = class {
|
|
266
305
|
!!((_h = rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.rowAlignment) === null || _h === void 0 ? void 0 : _h.horizontal) ||
|
267
306
|
!!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) ||
|
268
307
|
(rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.textWrap) ||
|
269
|
-
!!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: {
|
270
|
-
height: (this.truncationPattern || currentRowHeight) &&
|
271
|
-
!columnProps.textWrap &&
|
272
|
-
!rowOptions.textWrap &&
|
273
|
-
!this.getCellOptions(cell, "textWrap") &&
|
274
|
-
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element"
|
275
|
-
? this.setRowHeight(currentRowHeight)
|
276
|
-
: null,
|
277
|
-
}, "data-row-height": this.truncationPattern || currentRowHeight
|
308
|
+
!!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
|
278
309
|
? this.setRowHeight(currentRowHeight)
|
279
310
|
: null }, helpers.isSlotUsed(this.el, cellSlotName) ? (index.h("slot", { name: cellSlotName })) : (index.h(index.Fragment, null, helpers.isSlotUsed(this.el, `${cellSlotName}-icon`) ? (index.h("slot", { name: `${cellSlotName}-icon` })) : ((hasIcon || ((_k = columnProps === null || columnProps === void 0 ? void 0 : columnProps.icon) === null || _k === void 0 ? void 0 : _k.onAllCells)) && (index.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" &&
|
280
311
|
!helpers.isSlotUsed(this.el, cellSlotName) && (index.h("ic-typography", { variant: "body", class: {
|
@@ -290,11 +321,11 @@ const DataTable = class {
|
|
290
321
|
});
|
291
322
|
};
|
292
323
|
this.createColumnHeaders = () => {
|
293
|
-
return this.columns.map(({ cellAlignment, colspan, icon, key, title }) => (index.h("th", { scope: "col", class: {
|
324
|
+
return this.columns.map(({ cellAlignment, colspan, icon, key, title, columnWidth }) => (index.h("th", { scope: "col", class: {
|
294
325
|
["column-header"]: true,
|
295
326
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
296
327
|
["updating-state-headers"]: this.updating && !this.loading,
|
297
|
-
}, colSpan: colspan }, index.h("div", { class: {
|
328
|
+
}, style: Object.assign({}, this.getColumnWidth(columnWidth)), colSpan: colspan }, index.h("div", { class: {
|
298
329
|
"column-header-inner-container": true,
|
299
330
|
[`column-header-alignment-${cellAlignment}`]: !!cellAlignment,
|
300
331
|
} }, helpers.isSlotUsed(this.el, `${key}-column-icon`) ? (index.h("slot", { name: `${key}-column-icon` })) : (icon &&
|
@@ -322,16 +353,18 @@ const DataTable = class {
|
|
322
353
|
/**
|
323
354
|
* Ensures that createCells has a value in data to map over to actually render the slot.
|
324
355
|
* Removes the need for the user to add it multiple times.
|
356
|
+
* `addDataToPosition` used to add the element in the correct column order.
|
357
|
+
* Adding empty string value in to give `createCells` something to loop over.
|
325
358
|
*/
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
359
|
+
const organisedData = data.map((row, rowIndex) => {
|
360
|
+
const slottedColumns = this.columns
|
361
|
+
.map(({ key }, index) => helpers.isSlotUsed(this.el, `${key}-${rowIndex}`) && { key, index })
|
362
|
+
.filter((col) => !!col);
|
363
|
+
return slottedColumns.length > 0
|
364
|
+
? helpers.addDataToPosition(row, slottedColumns, "")
|
365
|
+
: row;
|
333
366
|
});
|
334
|
-
return
|
367
|
+
return organisedData
|
335
368
|
.sort(!this.sortable ? undefined : this.getSortFunction())
|
336
369
|
.map((row, index$1) => {
|
337
370
|
return (index.h("tr", {
|
@@ -428,6 +461,22 @@ const DataTable = class {
|
|
428
461
|
this.updateScrollOffset = () => {
|
429
462
|
this.scrollOffset = this.el.shadowRoot.querySelector(".table-row-container").scrollTop;
|
430
463
|
};
|
464
|
+
this.setTableDimensions = () => {
|
465
|
+
let tableHostDimensions = {};
|
466
|
+
if (this.width) {
|
467
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-width"]: this.width });
|
468
|
+
}
|
469
|
+
if (this.height) {
|
470
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-height"]: this.height });
|
471
|
+
}
|
472
|
+
if (this.maxWidth) {
|
473
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-max-width"]: this.maxWidth });
|
474
|
+
}
|
475
|
+
if (this.minWidth) {
|
476
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-min-width"]: this.minWidth });
|
477
|
+
}
|
478
|
+
return tableHostDimensions;
|
479
|
+
};
|
431
480
|
this.fromRow = 0;
|
432
481
|
this.previousRowsPerPage = undefined;
|
433
482
|
this.rowsPerPage = undefined;
|
@@ -438,15 +487,19 @@ const DataTable = class {
|
|
438
487
|
this.sortedColumnOrder = undefined;
|
439
488
|
this.toRow = undefined;
|
440
489
|
this.currentRowHeight = undefined;
|
490
|
+
this.debounceDelay = 0;
|
441
491
|
this.caption = undefined;
|
442
492
|
this.columns = undefined;
|
443
493
|
this.data = undefined;
|
444
494
|
this.density = "default";
|
445
495
|
this.embedded = false;
|
446
496
|
this.globalRowHeight = "auto";
|
497
|
+
this.height = undefined;
|
447
498
|
this.hideColumnHeaders = false;
|
448
499
|
this.loading = false;
|
449
500
|
this.loadingOptions = undefined;
|
501
|
+
this.maxWidth = undefined;
|
502
|
+
this.minWidth = undefined;
|
450
503
|
this.minimumLoadingDisplayDuration = 1000;
|
451
504
|
this.paginationBarOptions = {
|
452
505
|
itemsPerPageOptions: [
|
@@ -472,10 +525,12 @@ const DataTable = class {
|
|
472
525
|
};
|
473
526
|
this.stickyColumnHeaders = false;
|
474
527
|
this.stickyRowHeaders = false;
|
528
|
+
this.tableLayout = "fixed";
|
475
529
|
this.truncationPattern = undefined;
|
476
530
|
this.updating = false;
|
477
531
|
this.updatingOptions = undefined;
|
478
532
|
this.variableRowHeight = undefined;
|
533
|
+
this.width = undefined;
|
479
534
|
}
|
480
535
|
disconnectedCallback() {
|
481
536
|
var _a;
|
@@ -508,7 +563,8 @@ const DataTable = class {
|
|
508
563
|
}
|
509
564
|
if (this.truncationPattern) {
|
510
565
|
this.getTypographyElements().forEach((typographyEl) => {
|
511
|
-
|
566
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
567
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
512
568
|
this.dataTruncation(typographyEl);
|
513
569
|
}
|
514
570
|
});
|
@@ -519,12 +575,31 @@ const DataTable = class {
|
|
519
575
|
}
|
520
576
|
}
|
521
577
|
componentDidUpdate() {
|
522
|
-
|
578
|
+
// truncation updates invoked here once new/updated data has
|
579
|
+
// rendered to take into account updated .cell-container/ic-typography box model updates.
|
580
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING ||
|
581
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
582
|
+
this.truncateUpdatedData();
|
583
|
+
}
|
523
584
|
}
|
524
585
|
truncateUpdatedData() {
|
525
586
|
if (this.dataUpdated) {
|
526
587
|
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
527
|
-
this.
|
588
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
589
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
590
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
591
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >=
|
592
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
593
|
+
this.resetShowHideTruncation(typographyEl);
|
594
|
+
return;
|
595
|
+
}
|
596
|
+
setTimeout(() => {
|
597
|
+
// slight delay due to data rendering
|
598
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
599
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
600
|
+
}
|
601
|
+
}, 150);
|
602
|
+
});
|
528
603
|
}
|
529
604
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
530
605
|
this.updateTruncationTooltip();
|
@@ -535,23 +610,49 @@ const DataTable = class {
|
|
535
610
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
536
611
|
this.updateTruncationTooltip();
|
537
612
|
}
|
613
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
614
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
615
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
616
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
617
|
+
this.createShowHideTruncation(typographyEl, cellContainer);
|
618
|
+
}
|
619
|
+
else {
|
620
|
+
typographyEl.resetTruncation().then(() => {
|
621
|
+
cellContainer.removeAttribute("style");
|
622
|
+
});
|
623
|
+
}
|
624
|
+
});
|
625
|
+
}
|
538
626
|
this.tableSorted = false;
|
539
627
|
}
|
540
628
|
// This function recalculates the tooltip truncation when the rowHeight has been set.
|
541
629
|
// This is in componentDidUpdate so a setTimeout is not used to wait for the render to be complete
|
542
630
|
if (this.rowHeightSet) {
|
543
631
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
632
|
+
const hasAutoRowHeight = this.globalRowHeight === "auto";
|
544
633
|
this.getTypographyElements().forEach((typographyEl) => {
|
545
634
|
var _a;
|
546
635
|
const cellContainer = this.getCellContainer(typographyEl);
|
547
636
|
const tooltipEl = this.getTooltip(typographyEl);
|
637
|
+
if (hasAutoRowHeight) {
|
638
|
+
cellContainer.style.height = null;
|
639
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
640
|
+
this.removeTooltip(cellContainer, typographyEl, tooltipEl);
|
641
|
+
typographyEl.setAttribute("style", `--ic-line-clamp: 0`);
|
642
|
+
}
|
643
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
644
|
+
this.resetShowHideTruncation(typographyEl);
|
645
|
+
}
|
646
|
+
return;
|
647
|
+
}
|
548
648
|
const rowHeight = fontSize *
|
549
649
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
550
650
|
// If the set row height is bigger than the cell container even
|
551
651
|
// with textWrap, set the row height
|
552
652
|
if (!((_a = cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.style) === null || _a === void 0 ? void 0 : _a.height) &&
|
553
|
-
rowHeight > cellContainer.clientHeight
|
554
|
-
cellContainer.
|
653
|
+
rowHeight > cellContainer.clientHeight &&
|
654
|
+
!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
655
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
555
656
|
}
|
556
657
|
if (this.truncationPattern) {
|
557
658
|
// If the set row height is bigger than the typography truncation wrapper
|
@@ -617,12 +718,37 @@ const DataTable = class {
|
|
617
718
|
});
|
618
719
|
this.densityUpdate = false;
|
619
720
|
}
|
721
|
+
if (this.truncationPatternUpdated) {
|
722
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
723
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
724
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
725
|
+
const tooltipEl = this.getTooltip(typographyEl);
|
726
|
+
if (typographyEl.scrollHeight > cellContainer.clientHeight) {
|
727
|
+
this.addTooltipTruncation(typographyEl, cellContainer, tooltipEl);
|
728
|
+
}
|
729
|
+
});
|
730
|
+
}
|
731
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
732
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
733
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
734
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
735
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
736
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
737
|
+
this.resetShowHideTruncation(typographyEl);
|
738
|
+
return;
|
739
|
+
}
|
740
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
741
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
742
|
+
}
|
743
|
+
});
|
744
|
+
}
|
745
|
+
}
|
620
746
|
}
|
621
747
|
createShowHideTruncation(typographyEl, cellContainer) {
|
622
748
|
typographyEl.checkMaxLines(typographyEl.scrollHeight);
|
623
749
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
624
750
|
typographyEl.setShowHideExpanded(false);
|
625
|
-
cellContainer.style.
|
751
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
626
752
|
}
|
627
753
|
addTooltipTruncation(typographyEl, cellContainer, tooltip) {
|
628
754
|
this.addLineClampCSS(typographyEl, cellContainer);
|
@@ -642,8 +768,9 @@ const DataTable = class {
|
|
642
768
|
handleTypographyTruncationExpandToggle({ detail, }) {
|
643
769
|
const { expanded, typographyEl } = detail;
|
644
770
|
const cellContainer = this.getCellContainer(typographyEl);
|
645
|
-
if (cellContainer.style.
|
646
|
-
|
771
|
+
if (cellContainer.style.getPropertyValue(this.ROW_HEIGHT_CSS_VARIABLE) &&
|
772
|
+
expanded) {
|
773
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, "inherit");
|
647
774
|
}
|
648
775
|
}
|
649
776
|
handlePageChange({ detail, target }) {
|
@@ -693,7 +820,8 @@ const DataTable = class {
|
|
693
820
|
}
|
694
821
|
}
|
695
822
|
truncationPatternHandler(newValue) {
|
696
|
-
if (newValue === this.
|
823
|
+
if (newValue === this.TOOLTIP_STRING) {
|
824
|
+
this.resetShowHideTruncation();
|
697
825
|
this.updateTruncationTooltip(true);
|
698
826
|
// Not using debounceDataTruncation here due to resizeObserver not being triggered
|
699
827
|
this.getTypographyElements().forEach((typographyEl) => {
|
@@ -702,11 +830,27 @@ const DataTable = class {
|
|
702
830
|
this.truncate(typographyEl, cellContainer, tooltip);
|
703
831
|
});
|
704
832
|
}
|
705
|
-
if (newValue === this.
|
833
|
+
if (newValue === this.SHOW_HIDE_STRING) {
|
706
834
|
// ResizeObserver is trigger here due to the see more/see less links being removed.
|
707
835
|
// The resizeObserver will also apply the tooltip where relevant
|
708
|
-
this.
|
836
|
+
this.updateTruncationTooltip(true);
|
837
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
838
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
839
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
840
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
841
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
842
|
+
this.resetShowHideTruncation(typographyEl);
|
843
|
+
return;
|
844
|
+
}
|
845
|
+
setTimeout(() => {
|
846
|
+
// slight delay due to data rendering
|
847
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
848
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
849
|
+
}
|
850
|
+
}, 150);
|
851
|
+
});
|
709
852
|
}
|
853
|
+
this.truncationPatternUpdated = true;
|
710
854
|
}
|
711
855
|
async dataHandler(newData) {
|
712
856
|
this.loadingOptions = Object.assign(Object.assign({}, this.loadingOptions), { showBackground: (newData === null || newData === void 0 ? void 0 : newData.length) > 0 });
|
@@ -734,11 +878,13 @@ const DataTable = class {
|
|
734
878
|
typographyEl.checkMaxLines(truncWrapper.scrollHeight);
|
735
879
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
736
880
|
typographyEl.setShowHideExpanded(false);
|
737
|
-
cellContainer.style.
|
881
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
738
882
|
}
|
739
883
|
else {
|
740
884
|
typographyEl.resetTruncation().then(() => {
|
741
|
-
|
885
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
886
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
887
|
+
}
|
742
888
|
});
|
743
889
|
}
|
744
890
|
}
|
@@ -746,7 +892,9 @@ const DataTable = class {
|
|
746
892
|
this.getTypographyElements().forEach((typographyEl) => {
|
747
893
|
const cellContainer = this.getCellContainer(typographyEl);
|
748
894
|
typographyEl.resetTruncation().then(() => {
|
749
|
-
|
895
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
896
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
897
|
+
}
|
750
898
|
});
|
751
899
|
});
|
752
900
|
}
|
@@ -794,11 +942,10 @@ const DataTable = class {
|
|
794
942
|
if (!typographyEl.getAttribute("style") && this.dataUpdated) {
|
795
943
|
this.addLineClampCSS(typographyEl, cellContainer);
|
796
944
|
}
|
797
|
-
// Adding the tableSorted boolean prevents the tooltip
|
798
|
-
// being regenerated and flashing
|
799
945
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) &&
|
800
|
-
|
801
|
-
if (!typographyEl.getAttribute("style")
|
946
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
947
|
+
if (!typographyEl.getAttribute("style") ||
|
948
|
+
typographyEl.style.cssText.includes("--ic-line-clamp: 0;")) {
|
802
949
|
this.addLineClampCSS(typographyEl, cellContainer);
|
803
950
|
}
|
804
951
|
this.createTruncationTooltip(typographyEl, cellContainer);
|
@@ -827,10 +974,12 @@ const DataTable = class {
|
|
827
974
|
}
|
828
975
|
render() {
|
829
976
|
const { caption, createColumnHeaders, createRows, createUpdatingIndicator, data, hideColumnHeaders, loading, loadingOptions, paginationBarOptions, scrollable, scrollOffset, showPagination, sortable, sortedColumnOrder, sortedColumn, stickyColumnHeaders, updateScrollOffset, updating, } = this;
|
830
|
-
return (index.h("div", { class: "table-container" }, helpers.isSlotUsed(this.el, "title-bar") && index.h("slot", { name: "title-bar" }), index.h("div", { class: {
|
977
|
+
return (index.h(index.Host, { style: Object.assign({}, this.setTableDimensions()) }, index.h("div", { class: "table-container" }, helpers.isSlotUsed(this.el, "title-bar") && index.h("slot", { name: "title-bar" }), index.h("div", { class: {
|
831
978
|
["table-row-container"]: true,
|
832
979
|
scrollable,
|
833
|
-
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, helpers.isSlotUsed(this.el, "title-bar") && index.h("slot", { name: "title-bar" }), index.h("table",
|
980
|
+
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, helpers.isSlotUsed(this.el, "title-bar") && index.h("slot", { name: "title-bar" }), index.h("table", { style: {
|
981
|
+
["--table-layout"]: this.tableLayout,
|
982
|
+
} }, index.h("caption", { class: "table-caption" }, caption), !hideColumnHeaders && (index.h("thead", { class: {
|
834
983
|
["column-header-sticky"]: stickyColumnHeaders,
|
835
984
|
["column-header-overlay"]: stickyColumnHeaders && scrollOffset !== 0,
|
836
985
|
} }, index.h("tr", null, createColumnHeaders()))), updating &&
|
@@ -843,7 +992,7 @@ const DataTable = class {
|
|
843
992
|
"show-background": loadingOptions.showBackground,
|
844
993
|
}, 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 || helpers.isSlotUsed(this.el, "pagination-bar")) && (index.h("div", { class: "pagination-container" }, helpers.isSlotUsed(this.el, "pagination-bar") ? (index.h("slot", { name: "pagination-bar" })) : (index.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 && (index.h("div", { class: "screen-reader-sort-text", "aria-live": "polite" }, sortedColumnOrder !== "unsorted" && sortedColumn
|
845
994
|
? `${sortedColumn} sorted ${sortedColumnOrder}`
|
846
|
-
: "table unsorted"))));
|
995
|
+
: "table unsorted")))));
|
847
996
|
}
|
848
997
|
get el() { return index.getElement(this); }
|
849
998
|
static get watchers() { return {
|