@ukic/canary-web-components 2.0.0-canary.24 → 2.0.0-canary.25
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-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-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-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/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- 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/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-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-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 +260 -102
- package/package.json +3 -3
- package/dist/cjs/helpers-85c5ca15.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-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/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 { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-93509377.js';
|
2
|
-
import { d as
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-93509377.js';
|
2
|
+
import { d as dynamicDebounce, a as isEmptyString, p as pxToRem, i as isSlotUsed, b as addDataToPosition } from './helpers-5bd2012a.js';
|
3
3
|
|
4
4
|
const unsortedIcon = `<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24">
|
5
5
|
<path d="M9 3 5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3z"></path>
|
@@ -13,7 +13,7 @@ const descendingIcon = `<svg focusable="false" aria-hidden="true" viewBox="0 0 2
|
|
13
13
|
<path d="M16.01 11H4v2h12.01v3L20 12l-3.99-4z"></path>
|
14
14
|
</svg>`;
|
15
15
|
|
16
|
-
const icDataTableCss = ":host{position:relative;display:
|
16
|
+
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}}";
|
17
17
|
|
18
18
|
const DataTable = class {
|
19
19
|
constructor(hostRef) {
|
@@ -49,8 +49,11 @@ const DataTable = class {
|
|
49
49
|
this.icPageChangeEvent = false;
|
50
50
|
this.itemsPerPageChange = false;
|
51
51
|
this.DATA_ROW_HEIGHT_STRING = "data-row-height";
|
52
|
+
this.ROW_HEIGHT_CSS_VARIABLE = "--row-height";
|
52
53
|
this.DEFAULT_LINE_HEIGHT = 24;
|
53
54
|
this.densityUpdate = false;
|
55
|
+
this.truncationPatternUpdated = false;
|
56
|
+
this.isNewDebounceDelaySet = false;
|
54
57
|
this.updateSetRowHeight = (typographyEl) => {
|
55
58
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
56
59
|
if (typographyEl) {
|
@@ -58,7 +61,7 @@ const DataTable = class {
|
|
58
61
|
const rowHeight = fontSize *
|
59
62
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
60
63
|
if (typographyEl.scrollHeight > rowHeight) {
|
61
|
-
cellContainer.style.removeProperty(
|
64
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
62
65
|
}
|
63
66
|
}
|
64
67
|
else {
|
@@ -67,24 +70,31 @@ const DataTable = class {
|
|
67
70
|
const rowHeight = fontSize *
|
68
71
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
69
72
|
if (typographyEl.scrollHeight > rowHeight) {
|
70
|
-
cellContainer.style.removeProperty(
|
73
|
+
cellContainer.style.removeProperty(this.ROW_HEIGHT_CSS_VARIABLE);
|
71
74
|
}
|
72
75
|
});
|
73
76
|
}
|
74
77
|
};
|
75
78
|
this.debounceDataTruncation = () => {
|
76
79
|
this.getTypographyElements().forEach((typographyEl) => {
|
77
|
-
|
80
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
81
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
78
82
|
this.resizeObserver = new ResizeObserver(
|
79
83
|
// This gets triggered twice due to updated data and see more/see less button
|
80
|
-
|
81
|
-
// console.log("resizeObserver triggered");
|
84
|
+
dynamicDebounce(() => {
|
82
85
|
this.dataTruncation(typographyEl);
|
83
|
-
|
86
|
+
if (!this.isNewDebounceDelaySet) {
|
87
|
+
this.setNewDebounceDelay(200);
|
88
|
+
}
|
89
|
+
}, () => this.debounceDelay));
|
84
90
|
this.resizeObserver.observe(typographyEl);
|
85
91
|
}
|
86
92
|
});
|
87
93
|
};
|
94
|
+
this.setNewDebounceDelay = (delay) => {
|
95
|
+
this.debounceDelay = delay;
|
96
|
+
this.isNewDebounceDelaySet = true;
|
97
|
+
};
|
88
98
|
this.getLines = (height) => Math.floor(height / this.DEFAULT_LINE_HEIGHT);
|
89
99
|
this.truncate = (typographyEl, cellContainer, tooltip) => {
|
90
100
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
@@ -213,11 +223,40 @@ const DataTable = class {
|
|
213
223
|
}
|
214
224
|
return {};
|
215
225
|
};
|
226
|
+
this.getColumnWidth = (columnWidth) => {
|
227
|
+
// TODO: Setting max width on columns
|
228
|
+
let columnWidthStyling = {};
|
229
|
+
if (columnWidth) {
|
230
|
+
if (typeof columnWidth === "string") {
|
231
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-width"]: columnWidth });
|
232
|
+
}
|
233
|
+
if (typeof columnWidth === "object" && !!Object.keys(columnWidth)) {
|
234
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth) {
|
235
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-min-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.minWidth });
|
236
|
+
}
|
237
|
+
if (columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth) {
|
238
|
+
columnWidthStyling = Object.assign(Object.assign({}, columnWidthStyling), { ["--column-max-width"]: columnWidth === null || columnWidth === void 0 ? void 0 : columnWidth.maxWidth });
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
return columnWidthStyling;
|
243
|
+
};
|
244
|
+
this.getRowHeight = (currentRowHeight, columnProps, rowTextWrap, cell) => {
|
245
|
+
if ((this.truncationPattern || currentRowHeight) &&
|
246
|
+
!(columnProps === null || columnProps === void 0 ? void 0 : columnProps.textWrap) &&
|
247
|
+
!rowTextWrap &&
|
248
|
+
!this.getCellOptions(cell, "textWrap") &&
|
249
|
+
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element") {
|
250
|
+
return {
|
251
|
+
[this.ROW_HEIGHT_CSS_VARIABLE]: this.setRowHeight(currentRowHeight),
|
252
|
+
};
|
253
|
+
}
|
254
|
+
return {};
|
255
|
+
};
|
216
256
|
this.createCells = (row, rowIndex) => {
|
217
257
|
var _a;
|
218
258
|
const rowValues = Object.values(row);
|
219
259
|
const rowKeys = Object.keys(row);
|
220
|
-
const index = rowIndex;
|
221
260
|
const rowOptions = this.getRowOptions(rowKeys, rowValues);
|
222
261
|
let rowAlignment;
|
223
262
|
let rowEmphasis;
|
@@ -226,7 +265,7 @@ const DataTable = class {
|
|
226
265
|
rowAlignment = this.getObjectValue(rowValues[headerIndex], "rowAlignment");
|
227
266
|
rowEmphasis = this.getObjectValue(rowValues[headerIndex], "emphasis");
|
228
267
|
}
|
229
|
-
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index }));
|
268
|
+
const variableRowHeightVal = (_a = this.variableRowHeight) === null || _a === void 0 ? void 0 : _a.call(this, Object.assign(Object.assign({}, row), { index: rowIndex }));
|
230
269
|
const currentRowHeight = variableRowHeightVal
|
231
270
|
? variableRowHeightVal !== "auto" && variableRowHeightVal
|
232
271
|
: this.globalRowHeight !== "auto" && this.globalRowHeight;
|
@@ -247,7 +286,7 @@ const DataTable = class {
|
|
247
286
|
return (h("td", { class: {
|
248
287
|
["table-cell"]: true,
|
249
288
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
250
|
-
} }, h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
289
|
+
}, style: Object.assign({}, this.getColumnWidth(columnProps.columnWidth)) }, h("div", { innerHTML: (columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) === "element" &&
|
251
290
|
!isSlotUsed(this.el, cellSlotName)
|
252
291
|
? cell
|
253
292
|
: 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) ||
|
@@ -262,15 +301,7 @@ const DataTable = class {
|
|
262
301
|
!!((_h = rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.rowAlignment) === null || _h === void 0 ? void 0 : _h.horizontal) ||
|
263
302
|
!!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) ||
|
264
303
|
(rowOptions === null || rowOptions === void 0 ? void 0 : rowOptions.textWrap) ||
|
265
|
-
!!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: {
|
266
|
-
height: (this.truncationPattern || currentRowHeight) &&
|
267
|
-
!columnProps.textWrap &&
|
268
|
-
!rowOptions.textWrap &&
|
269
|
-
!this.getCellOptions(cell, "textWrap") &&
|
270
|
-
(columnProps === null || columnProps === void 0 ? void 0 : columnProps.dataType) !== "element"
|
271
|
-
? this.setRowHeight(currentRowHeight)
|
272
|
-
: null,
|
273
|
-
}, "data-row-height": this.truncationPattern || currentRowHeight
|
304
|
+
!!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
|
274
305
|
? this.setRowHeight(currentRowHeight)
|
275
306
|
: 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" &&
|
276
307
|
!isSlotUsed(this.el, cellSlotName) && (h("ic-typography", { variant: "body", class: {
|
@@ -286,11 +317,11 @@ const DataTable = class {
|
|
286
317
|
});
|
287
318
|
};
|
288
319
|
this.createColumnHeaders = () => {
|
289
|
-
return this.columns.map(({ cellAlignment, colspan, icon, key, title }) => (h("th", { scope: "col", class: {
|
320
|
+
return this.columns.map(({ cellAlignment, colspan, icon, key, title, columnWidth }) => (h("th", { scope: "col", class: {
|
290
321
|
["column-header"]: true,
|
291
322
|
[`table-density-${this.density}`]: this.notDefaultDensity(),
|
292
323
|
["updating-state-headers"]: this.updating && !this.loading,
|
293
|
-
}, colSpan: colspan }, h("div", { class: {
|
324
|
+
}, style: Object.assign({}, this.getColumnWidth(columnWidth)), colSpan: colspan }, h("div", { class: {
|
294
325
|
"column-header-inner-container": true,
|
295
326
|
[`column-header-alignment-${cellAlignment}`]: !!cellAlignment,
|
296
327
|
} }, isSlotUsed(this.el, `${key}-column-icon`) ? (h("slot", { name: `${key}-column-icon` })) : (icon &&
|
@@ -318,16 +349,18 @@ const DataTable = class {
|
|
318
349
|
/**
|
319
350
|
* Ensures that createCells has a value in data to map over to actually render the slot.
|
320
351
|
* Removes the need for the user to add it multiple times.
|
352
|
+
* `addDataToPosition` used to add the element in the correct column order.
|
353
|
+
* Adding empty string value in to give `createCells` something to loop over.
|
321
354
|
*/
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
355
|
+
const organisedData = data.map((row, rowIndex) => {
|
356
|
+
const slottedColumns = this.columns
|
357
|
+
.map(({ key }, index) => isSlotUsed(this.el, `${key}-${rowIndex}`) && { key, index })
|
358
|
+
.filter((col) => !!col);
|
359
|
+
return slottedColumns.length > 0
|
360
|
+
? addDataToPosition(row, slottedColumns, "")
|
361
|
+
: row;
|
329
362
|
});
|
330
|
-
return
|
363
|
+
return organisedData
|
331
364
|
.sort(!this.sortable ? undefined : this.getSortFunction())
|
332
365
|
.map((row, index) => {
|
333
366
|
return (h("tr", {
|
@@ -424,6 +457,22 @@ const DataTable = class {
|
|
424
457
|
this.updateScrollOffset = () => {
|
425
458
|
this.scrollOffset = this.el.shadowRoot.querySelector(".table-row-container").scrollTop;
|
426
459
|
};
|
460
|
+
this.setTableDimensions = () => {
|
461
|
+
let tableHostDimensions = {};
|
462
|
+
if (this.width) {
|
463
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-width"]: this.width });
|
464
|
+
}
|
465
|
+
if (this.height) {
|
466
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-height"]: this.height });
|
467
|
+
}
|
468
|
+
if (this.maxWidth) {
|
469
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-max-width"]: this.maxWidth });
|
470
|
+
}
|
471
|
+
if (this.minWidth) {
|
472
|
+
tableHostDimensions = Object.assign(Object.assign({}, tableHostDimensions), { ["--table-min-width"]: this.minWidth });
|
473
|
+
}
|
474
|
+
return tableHostDimensions;
|
475
|
+
};
|
427
476
|
this.fromRow = 0;
|
428
477
|
this.previousRowsPerPage = undefined;
|
429
478
|
this.rowsPerPage = undefined;
|
@@ -434,15 +483,19 @@ const DataTable = class {
|
|
434
483
|
this.sortedColumnOrder = undefined;
|
435
484
|
this.toRow = undefined;
|
436
485
|
this.currentRowHeight = undefined;
|
486
|
+
this.debounceDelay = 0;
|
437
487
|
this.caption = undefined;
|
438
488
|
this.columns = undefined;
|
439
489
|
this.data = undefined;
|
440
490
|
this.density = "default";
|
441
491
|
this.embedded = false;
|
442
492
|
this.globalRowHeight = "auto";
|
493
|
+
this.height = undefined;
|
443
494
|
this.hideColumnHeaders = false;
|
444
495
|
this.loading = false;
|
445
496
|
this.loadingOptions = undefined;
|
497
|
+
this.maxWidth = undefined;
|
498
|
+
this.minWidth = undefined;
|
446
499
|
this.minimumLoadingDisplayDuration = 1000;
|
447
500
|
this.paginationBarOptions = {
|
448
501
|
itemsPerPageOptions: [
|
@@ -468,10 +521,12 @@ const DataTable = class {
|
|
468
521
|
};
|
469
522
|
this.stickyColumnHeaders = false;
|
470
523
|
this.stickyRowHeaders = false;
|
524
|
+
this.tableLayout = "fixed";
|
471
525
|
this.truncationPattern = undefined;
|
472
526
|
this.updating = false;
|
473
527
|
this.updatingOptions = undefined;
|
474
528
|
this.variableRowHeight = undefined;
|
529
|
+
this.width = undefined;
|
475
530
|
}
|
476
531
|
disconnectedCallback() {
|
477
532
|
var _a;
|
@@ -504,7 +559,8 @@ const DataTable = class {
|
|
504
559
|
}
|
505
560
|
if (this.truncationPattern) {
|
506
561
|
this.getTypographyElements().forEach((typographyEl) => {
|
507
|
-
|
562
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
563
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
508
564
|
this.dataTruncation(typographyEl);
|
509
565
|
}
|
510
566
|
});
|
@@ -515,12 +571,31 @@ const DataTable = class {
|
|
515
571
|
}
|
516
572
|
}
|
517
573
|
componentDidUpdate() {
|
518
|
-
|
574
|
+
// truncation updates invoked here once new/updated data has
|
575
|
+
// rendered to take into account updated .cell-container/ic-typography box model updates.
|
576
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING ||
|
577
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
578
|
+
this.truncateUpdatedData();
|
579
|
+
}
|
519
580
|
}
|
520
581
|
truncateUpdatedData() {
|
521
582
|
if (this.dataUpdated) {
|
522
583
|
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
523
|
-
this.
|
584
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
585
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
586
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
587
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >=
|
588
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
589
|
+
this.resetShowHideTruncation(typographyEl);
|
590
|
+
return;
|
591
|
+
}
|
592
|
+
setTimeout(() => {
|
593
|
+
// slight delay due to data rendering
|
594
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
595
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
596
|
+
}
|
597
|
+
}, 150);
|
598
|
+
});
|
524
599
|
}
|
525
600
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
526
601
|
this.updateTruncationTooltip();
|
@@ -531,23 +606,49 @@ const DataTable = class {
|
|
531
606
|
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
532
607
|
this.updateTruncationTooltip();
|
533
608
|
}
|
609
|
+
if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
610
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
611
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
612
|
+
if (!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
613
|
+
this.createShowHideTruncation(typographyEl, cellContainer);
|
614
|
+
}
|
615
|
+
else {
|
616
|
+
typographyEl.resetTruncation().then(() => {
|
617
|
+
cellContainer.removeAttribute("style");
|
618
|
+
});
|
619
|
+
}
|
620
|
+
});
|
621
|
+
}
|
534
622
|
this.tableSorted = false;
|
535
623
|
}
|
536
624
|
// This function recalculates the tooltip truncation when the rowHeight has been set.
|
537
625
|
// This is in componentDidUpdate so a setTimeout is not used to wait for the render to be complete
|
538
626
|
if (this.rowHeightSet) {
|
539
627
|
const fontSize = parseInt(getComputedStyle(document.documentElement).fontSize);
|
628
|
+
const hasAutoRowHeight = this.globalRowHeight === "auto";
|
540
629
|
this.getTypographyElements().forEach((typographyEl) => {
|
541
630
|
var _a;
|
542
631
|
const cellContainer = this.getCellContainer(typographyEl);
|
543
632
|
const tooltipEl = this.getTooltip(typographyEl);
|
633
|
+
if (hasAutoRowHeight) {
|
634
|
+
cellContainer.style.height = null;
|
635
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
636
|
+
this.removeTooltip(cellContainer, typographyEl, tooltipEl);
|
637
|
+
typographyEl.setAttribute("style", `--ic-line-clamp: 0`);
|
638
|
+
}
|
639
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
640
|
+
this.resetShowHideTruncation(typographyEl);
|
641
|
+
}
|
642
|
+
return;
|
643
|
+
}
|
544
644
|
const rowHeight = fontSize *
|
545
645
|
parseFloat(cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
546
646
|
// If the set row height is bigger than the cell container even
|
547
647
|
// with textWrap, set the row height
|
548
648
|
if (!((_a = cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.style) === null || _a === void 0 ? void 0 : _a.height) &&
|
549
|
-
rowHeight > cellContainer.clientHeight
|
550
|
-
cellContainer.
|
649
|
+
rowHeight > cellContainer.clientHeight &&
|
650
|
+
!cellContainer.classList.contains(this.TEXT_WRAP_STRING)) {
|
651
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
551
652
|
}
|
552
653
|
if (this.truncationPattern) {
|
553
654
|
// If the set row height is bigger than the typography truncation wrapper
|
@@ -613,12 +714,37 @@ const DataTable = class {
|
|
613
714
|
});
|
614
715
|
this.densityUpdate = false;
|
615
716
|
}
|
717
|
+
if (this.truncationPatternUpdated) {
|
718
|
+
if (this.truncationPattern === this.TOOLTIP_STRING) {
|
719
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
720
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
721
|
+
const tooltipEl = this.getTooltip(typographyEl);
|
722
|
+
if (typographyEl.scrollHeight > cellContainer.clientHeight) {
|
723
|
+
this.addTooltipTruncation(typographyEl, cellContainer, tooltipEl);
|
724
|
+
}
|
725
|
+
});
|
726
|
+
}
|
727
|
+
else if (this.truncationPattern === this.SHOW_HIDE_STRING) {
|
728
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
729
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
730
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
731
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
732
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
733
|
+
this.resetShowHideTruncation(typographyEl);
|
734
|
+
return;
|
735
|
+
}
|
736
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
737
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
738
|
+
}
|
739
|
+
});
|
740
|
+
}
|
741
|
+
}
|
616
742
|
}
|
617
743
|
createShowHideTruncation(typographyEl, cellContainer) {
|
618
744
|
typographyEl.checkMaxLines(typographyEl.scrollHeight);
|
619
745
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
620
746
|
typographyEl.setShowHideExpanded(false);
|
621
|
-
cellContainer.style.
|
747
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
622
748
|
}
|
623
749
|
addTooltipTruncation(typographyEl, cellContainer, tooltip) {
|
624
750
|
this.addLineClampCSS(typographyEl, cellContainer);
|
@@ -638,8 +764,9 @@ const DataTable = class {
|
|
638
764
|
handleTypographyTruncationExpandToggle({ detail, }) {
|
639
765
|
const { expanded, typographyEl } = detail;
|
640
766
|
const cellContainer = this.getCellContainer(typographyEl);
|
641
|
-
if (cellContainer.style.
|
642
|
-
|
767
|
+
if (cellContainer.style.getPropertyValue(this.ROW_HEIGHT_CSS_VARIABLE) &&
|
768
|
+
expanded) {
|
769
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, "inherit");
|
643
770
|
}
|
644
771
|
}
|
645
772
|
handlePageChange({ detail, target }) {
|
@@ -689,7 +816,8 @@ const DataTable = class {
|
|
689
816
|
}
|
690
817
|
}
|
691
818
|
truncationPatternHandler(newValue) {
|
692
|
-
if (newValue === this.
|
819
|
+
if (newValue === this.TOOLTIP_STRING) {
|
820
|
+
this.resetShowHideTruncation();
|
693
821
|
this.updateTruncationTooltip(true);
|
694
822
|
// Not using debounceDataTruncation here due to resizeObserver not being triggered
|
695
823
|
this.getTypographyElements().forEach((typographyEl) => {
|
@@ -698,11 +826,27 @@ const DataTable = class {
|
|
698
826
|
this.truncate(typographyEl, cellContainer, tooltip);
|
699
827
|
});
|
700
828
|
}
|
701
|
-
if (newValue === this.
|
829
|
+
if (newValue === this.SHOW_HIDE_STRING) {
|
702
830
|
// ResizeObserver is trigger here due to the see more/see less links being removed.
|
703
831
|
// The resizeObserver will also apply the tooltip where relevant
|
704
|
-
this.
|
832
|
+
this.updateTruncationTooltip(true);
|
833
|
+
this.getTypographyElements().forEach((typographyEl) => {
|
834
|
+
const truncWrapper = this.getTruncWrapper(typographyEl);
|
835
|
+
const cellContainer = this.getCellContainer(typographyEl);
|
836
|
+
if ((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) - this.DEFAULT_LINE_HEIGHT >
|
837
|
+
(truncWrapper === null || truncWrapper === void 0 ? void 0 : truncWrapper.scrollHeight)) {
|
838
|
+
this.resetShowHideTruncation(typographyEl);
|
839
|
+
return;
|
840
|
+
}
|
841
|
+
setTimeout(() => {
|
842
|
+
// slight delay due to data rendering
|
843
|
+
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight)) {
|
844
|
+
this.addShowHideTruncation(cellContainer, typographyEl);
|
845
|
+
}
|
846
|
+
}, 150);
|
847
|
+
});
|
705
848
|
}
|
849
|
+
this.truncationPatternUpdated = true;
|
706
850
|
}
|
707
851
|
async dataHandler(newData) {
|
708
852
|
this.loadingOptions = Object.assign(Object.assign({}, this.loadingOptions), { showBackground: (newData === null || newData === void 0 ? void 0 : newData.length) > 0 });
|
@@ -730,11 +874,13 @@ const DataTable = class {
|
|
730
874
|
typographyEl.checkMaxLines(truncWrapper.scrollHeight);
|
731
875
|
typographyEl.setAttribute("max-lines", `${Math.floor((cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) / this.DEFAULT_LINE_HEIGHT)}`);
|
732
876
|
typographyEl.setShowHideExpanded(false);
|
733
|
-
cellContainer.style.
|
877
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, null);
|
734
878
|
}
|
735
879
|
else {
|
736
880
|
typographyEl.resetTruncation().then(() => {
|
737
|
-
|
881
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
882
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
883
|
+
}
|
738
884
|
});
|
739
885
|
}
|
740
886
|
}
|
@@ -742,7 +888,9 @@ const DataTable = class {
|
|
742
888
|
this.getTypographyElements().forEach((typographyEl) => {
|
743
889
|
const cellContainer = this.getCellContainer(typographyEl);
|
744
890
|
typographyEl.resetTruncation().then(() => {
|
745
|
-
|
891
|
+
if (!typographyEl.closest(this.TEXT_WRAP_CLASS)) {
|
892
|
+
cellContainer.style.setProperty(this.ROW_HEIGHT_CSS_VARIABLE, cellContainer.getAttribute(this.DATA_ROW_HEIGHT_STRING));
|
893
|
+
}
|
746
894
|
});
|
747
895
|
});
|
748
896
|
}
|
@@ -790,11 +938,10 @@ const DataTable = class {
|
|
790
938
|
if (!typographyEl.getAttribute("style") && this.dataUpdated) {
|
791
939
|
this.addLineClampCSS(typographyEl, cellContainer);
|
792
940
|
}
|
793
|
-
// Adding the tableSorted boolean prevents the tooltip
|
794
|
-
// being regenerated and flashing
|
795
941
|
if ((typographyEl === null || typographyEl === void 0 ? void 0 : typographyEl.scrollHeight) > (cellContainer === null || cellContainer === void 0 ? void 0 : cellContainer.clientHeight) &&
|
796
|
-
|
797
|
-
if (!typographyEl.getAttribute("style")
|
942
|
+
this.truncationPattern === this.TOOLTIP_STRING) {
|
943
|
+
if (!typographyEl.getAttribute("style") ||
|
944
|
+
typographyEl.style.cssText.includes("--ic-line-clamp: 0;")) {
|
798
945
|
this.addLineClampCSS(typographyEl, cellContainer);
|
799
946
|
}
|
800
947
|
this.createTruncationTooltip(typographyEl, cellContainer);
|
@@ -823,10 +970,12 @@ const DataTable = class {
|
|
823
970
|
}
|
824
971
|
render() {
|
825
972
|
const { caption, createColumnHeaders, createRows, createUpdatingIndicator, data, hideColumnHeaders, loading, loadingOptions, paginationBarOptions, scrollable, scrollOffset, showPagination, sortable, sortedColumnOrder, sortedColumn, stickyColumnHeaders, updateScrollOffset, updating, } = this;
|
826
|
-
return (h("div", { class: "table-container" }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("div", { class: {
|
973
|
+
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: {
|
827
974
|
["table-row-container"]: true,
|
828
975
|
scrollable,
|
829
|
-
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("table",
|
976
|
+
}, tabIndex: scrollable ? 0 : null, onScroll: updateScrollOffset }, isSlotUsed(this.el, "title-bar") && h("slot", { name: "title-bar" }), h("table", { style: {
|
977
|
+
["--table-layout"]: this.tableLayout,
|
978
|
+
} }, h("caption", { class: "table-caption" }, caption), !hideColumnHeaders && (h("thead", { class: {
|
830
979
|
["column-header-sticky"]: stickyColumnHeaders,
|
831
980
|
["column-header-overlay"]: stickyColumnHeaders && scrollOffset !== 0,
|
832
981
|
} }, h("tr", null, createColumnHeaders()))), updating &&
|
@@ -839,7 +988,7 @@ const DataTable = class {
|
|
839
988
|
"show-background": loadingOptions.showBackground,
|
840
989
|
}, 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
|
841
990
|
? `${sortedColumn} sorted ${sortedColumnOrder}`
|
842
|
-
: "table unsorted"))));
|
991
|
+
: "table unsorted")))));
|
843
992
|
}
|
844
993
|
get el() { return getElement(this); }
|
845
994
|
static get watchers() { return {
|