@sellmate/design-system 1.0.75 → 1.0.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sd-button_4.cjs.entry.js +2 -2
- package/dist/cjs/sd-ghost-button.cjs.entry.js +10 -5
- package/dist/cjs/sd-modal-container.cjs.entry.js +76 -68
- package/dist/cjs/sd-pagination_5.cjs.entry.js +889 -0
- package/dist/cjs/sd-radio-button.cjs.entry.js +6 -1
- package/dist/cjs/sd-select-v2-list-item_4.cjs.entry.js +65 -5
- package/dist/cjs/sd-switch.cjs.entry.js +1 -1
- package/dist/cjs/sd-table.cjs.entry.js +167 -20
- package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
- package/dist/cjs/sd-tag.cjs.entry.js +2 -2
- package/dist/cjs/sd-td.cjs.entry.js +53 -1
- package/dist/cjs/sd-text-link.cjs.entry.js +3 -3
- package/dist/cjs/sd-textarea.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast.cjs.entry.js +2 -2
- package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
- package/dist/collection/components/sd-ghost-button/sd-ghost-button.js +10 -5
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +77 -71
- package/dist/collection/components/sd-radio-button/sd-radio-button.js +6 -1
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +103 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2.js +82 -4
- package/dist/collection/components/sd-switch/sd-switch.js +1 -1
- package/dist/collection/components/sd-table/sd-table.css +1 -1
- package/dist/collection/components/sd-table/sd-table.js +170 -21
- package/dist/collection/components/sd-table/sd-tbody/sd-tbody.js +7 -2
- package/dist/collection/components/sd-table/sd-td/sd-td.js +91 -1
- package/dist/collection/components/sd-table/sd-thead/sd-thead.js +9 -4
- package/dist/collection/components/sd-table/sd-tr/sd-tr.css +8 -0
- package/dist/collection/components/sd-table/sd-tr/sd-tr.js +62 -12
- package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
- package/dist/collection/components/sd-tag/sd-tag.js +2 -2
- package/dist/collection/components/sd-text-link/sd-text-link.js +3 -3
- package/dist/collection/components/sd-textarea/sd-textarea.js +1 -1
- package/dist/collection/components/sd-toast/sd-toast.js +2 -2
- package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
- package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
- package/dist/collection/utils/modal.js +5 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-BALOEavB.js → p-6AvsuYqF.js} +1 -1
- package/dist/components/{p-CTwEbxRN.js → p-6PsyRF61.js} +1 -1
- package/dist/components/{p-DEBakAhm.js → p-7DKZPPev.js} +1 -1
- package/dist/components/p-BBD_1E3n.js +1 -0
- package/dist/components/p-BQvugXhH.js +1 -0
- package/dist/components/p-BRfPoWUn.js +1 -0
- package/dist/components/{p-CHFGWh0m.js → p-C-BOe23n.js} +1 -1
- package/dist/components/p-C7h8lwnU.js +1 -0
- package/dist/components/{p-SDBnyM8D.js → p-CUg9NH6y.js} +1 -1
- package/dist/components/{p-C3dI7f7C.js → p-CgMyz4NQ.js} +1 -1
- package/dist/components/p-Csfj4h1A.js +1 -0
- package/dist/components/{p-Bp0B8tcl.js → p-DAC3TaZV.js} +1 -1
- package/dist/components/p-DfOYYI9m.js +1 -0
- package/dist/components/{p-H-9uoufd.js → p-d4UB2UF7.js} +1 -1
- package/dist/components/p-eEC3ITv0.js +1 -0
- package/dist/components/{p-CWEeXx2E.js → p-nVHDJc9g.js} +1 -1
- package/dist/components/{p-D8fG9Yt7.js → p-rnbt1m4L.js} +1 -1
- package/dist/components/sd-action-modal.js +1 -1
- package/dist/components/sd-barcode-input.js +1 -1
- package/dist/components/sd-chip.js +1 -1
- package/dist/components/sd-confirm-modal.js +1 -1
- package/dist/components/sd-date-picker-calendar.js +1 -1
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker-calendar.js +1 -1
- package/dist/components/sd-date-range-picker.js +1 -1
- package/dist/components/sd-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-ghost-button.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/sd-modal-container.js +1 -1
- package/dist/components/sd-number-input.js +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-radio-button.js +1 -1
- package/dist/components/sd-select-dropdown.js +1 -1
- package/dist/components/sd-select-group.js +1 -1
- package/dist/components/sd-select-multiple-group.js +1 -1
- package/dist/components/sd-select-multiple.js +1 -1
- package/dist/components/sd-select-search-input.js +1 -1
- package/dist/components/sd-select-v2-listbox.js +1 -1
- package/dist/components/sd-select-v2-trigger.js +1 -1
- package/dist/components/sd-select-v2.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-switch.js +1 -1
- package/dist/components/sd-table.js +1 -1
- package/dist/components/sd-tabs.js +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-tbody.js +1 -1
- package/dist/components/sd-td.js +1 -1
- package/dist/components/sd-text-link.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-thead.js +1 -1
- package/dist/components/sd-toast-container.js +1 -1
- package/dist/components/sd-toast.js +1 -1
- package/dist/components/sd-toggle.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/components/sd-tr.js +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/index.esm.js +1 -1
- package/dist/design-system/p-0e1b27cc.entry.js +1 -0
- package/dist/design-system/p-11029f6e.entry.js +1 -0
- package/dist/design-system/{p-cc62c180.entry.js → p-140b40ab.entry.js} +1 -1
- package/dist/design-system/p-34f7345b.entry.js +1 -0
- package/dist/design-system/p-363c9451.entry.js +1 -0
- package/dist/design-system/{p-fdcfaa7c.entry.js → p-506f2b68.entry.js} +1 -1
- package/dist/design-system/{p-8200b5f2.entry.js → p-531a6a82.entry.js} +1 -1
- package/dist/design-system/p-55b65a41.entry.js +1 -0
- package/dist/design-system/{p-d1dfa0e1.entry.js → p-68d0d67e.entry.js} +1 -1
- package/dist/design-system/p-7fe3a466.entry.js +1 -0
- package/dist/design-system/{p-05a1c092.entry.js → p-9466cd93.entry.js} +1 -1
- package/dist/design-system/{p-33bec0e3.entry.js → p-b683f2fe.entry.js} +1 -1
- package/dist/design-system/p-c521e731.entry.js +1 -0
- package/dist/design-system/{p-16a15368.entry.js → p-c9eb70f5.entry.js} +1 -1
- package/dist/design-system/p-d1846df9.entry.js +1 -0
- package/dist/design-system/{p-2d154fe0.entry.js → p-fdb52620.entry.js} +1 -1
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-button_4.entry.js +2 -2
- package/dist/esm/sd-ghost-button.entry.js +10 -5
- package/dist/esm/sd-modal-container.entry.js +76 -68
- package/dist/esm/sd-pagination_5.entry.js +883 -0
- package/dist/esm/sd-radio-button.entry.js +6 -1
- package/dist/esm/sd-select-v2-list-item_4.entry.js +65 -5
- package/dist/esm/sd-switch.entry.js +1 -1
- package/dist/esm/sd-table.entry.js +168 -21
- package/dist/esm/sd-tabs.entry.js +1 -1
- package/dist/esm/sd-tag.entry.js +2 -2
- package/dist/esm/sd-td.entry.js +53 -1
- package/dist/esm/sd-text-link.entry.js +3 -3
- package/dist/esm/sd-textarea.entry.js +1 -1
- package/dist/esm/sd-toast-container.entry.js +1 -1
- package/dist/esm/sd-toast.entry.js +2 -2
- package/dist/esm/sd-toggle.entry.js +1 -1
- package/dist/types/components/sd-ghost-button/sd-ghost-button.d.ts +1 -0
- package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +1 -1
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +6 -4
- package/dist/types/components/sd-radio-button/sd-radio-button.d.ts +1 -0
- package/dist/types/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.d.ts +9 -0
- package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +4 -0
- package/dist/types/components/sd-table/sd-table.d.ts +17 -0
- package/dist/types/components/sd-table/sd-td/sd-td.d.ts +8 -0
- package/dist/types/components/sd-table/sd-tr/sd-tr.d.ts +4 -0
- package/dist/types/components.d.ts +52 -0
- package/hydrate/index.js +481 -141
- package/hydrate/index.mjs +481 -141
- package/package.json +1 -1
- package/dist/cjs/sd-pagination_2.cjs.entry.js +0 -427
- package/dist/cjs/sd-tbody.cjs.entry.js +0 -66
- package/dist/cjs/sd-thead.cjs.entry.js +0 -179
- package/dist/cjs/sd-tr.cjs.entry.js +0 -171
- package/dist/components/p-Bbs5Ws0k.js +0 -1
- package/dist/components/p-CgL8_FSD.js +0 -1
- package/dist/components/p-DuMkBStM.js +0 -1
- package/dist/components/p-vQDL-PZ8.js +0 -1
- package/dist/design-system/p-380198bc.entry.js +0 -1
- package/dist/design-system/p-6b537e2f.entry.js +0 -1
- package/dist/design-system/p-6e90fb80.entry.js +0 -1
- package/dist/design-system/p-7b77c65c.entry.js +0 -1
- package/dist/design-system/p-8f88bd67.entry.js +0 -1
- package/dist/design-system/p-ba5fea6f.entry.js +0 -1
- package/dist/design-system/p-be54d6bd.entry.js +0 -1
- package/dist/design-system/p-c3379a6e.entry.js +0 -1
- package/dist/design-system/p-dc07d618.entry.js +0 -1
- package/dist/design-system/p-ef09409c.entry.js +0 -1
- package/dist/design-system/p-f8237991.entry.js +0 -1
- package/dist/esm/sd-pagination_2.entry.js +0 -424
- package/dist/esm/sd-tbody.entry.js +0 -64
- package/dist/esm/sd-thead.entry.js +0 -177
- package/dist/esm/sd-tr.entry.js +0 -169
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, a as getElement, h, H as Host } from './index-Bp7ytJz5.js';
|
|
2
|
-
import { T as TABLE_ID_ATTR } from './constants-sZMi_32I.js';
|
|
3
|
-
|
|
4
|
-
const sdTheadCss = () => `sd-thead{display:contents}sd-thead *{box-sizing:border-box}.thead{display:table-header-group;height:36px}.thead--sticky{position:sticky;top:0;z-index:120}.tr{display:table-row;width:100%}.th{display:table-cell;background:#F5FAFF;height:36px;padding:0 16px;font-weight:500;vertical-align:middle;border-bottom:1px solid #E1E1E1;-webkit-user-select:none;user-select:none;position:relative;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.th--selected{position:relative;width:52px !important;max-width:52px !important;min-width:52px !important;padding:0 10px 0 24px;text-align:left}.th--selected sd-checkbox label{position:relative}.th--selected sd-checkbox label:before{content:"";position:absolute;inset:-6px}.th.sticky-left{position:sticky;background-color:#F5FAFF;z-index:110 !important;left:var(--sticky-left-offset, 0)}.th.sticky-right{position:sticky;background-color:#F5FAFF;z-index:110 !important;right:var(--sticky-right-offset, 0)}.th.sticky-left-edge:after{content:"";position:absolute;top:0;left:100%;right:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset 12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.th.sticky-right-edge:after{content:"";position:absolute;top:0;left:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset -12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.th.sticky-left-edge.is-scrolled-left{overflow:visible}.th.sticky-left-edge.is-scrolled-left:after{opacity:1}.th.sticky-right-edge.is-scrolled-right{overflow:visible}.th.sticky-right-edge.is-scrolled-right:after{opacity:1}.th__content{display:flex;flex-flow:row nowrap;align-items:center;gap:4px}.th__content--left{justify-content:flex-start}.th__content--center{justify-content:center}.th__content--right{justify-content:flex-end}.th__content--label{white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.th__resizer{position:absolute;top:50%;right:0;transform:translateY(-50%);width:4px;height:16px;cursor:col-resize;z-index:3;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC}.th__resizer--left{right:auto;left:0}`;
|
|
5
|
-
|
|
6
|
-
const SdThead = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
}
|
|
10
|
-
get el() { return getElement(this); }
|
|
11
|
-
columns;
|
|
12
|
-
selectable;
|
|
13
|
-
resizable;
|
|
14
|
-
stickyColumn;
|
|
15
|
-
stickyHeader;
|
|
16
|
-
scrolledLeft;
|
|
17
|
-
scrolledRight;
|
|
18
|
-
rows = [];
|
|
19
|
-
columnWidths = [];
|
|
20
|
-
tableId = '';
|
|
21
|
-
_columns = [];
|
|
22
|
-
_selectable = false;
|
|
23
|
-
_resizable = false;
|
|
24
|
-
_stickyColumn = { left: 0, right: 0 };
|
|
25
|
-
_stickyHeader = false;
|
|
26
|
-
_scrolledLeft = false;
|
|
27
|
-
_scrolledRight = false;
|
|
28
|
-
tableEl = null;
|
|
29
|
-
handleColumnsChange(newCols) {
|
|
30
|
-
if (Array.isArray(newCols) && (this.columnWidths ?? []).length === 0) {
|
|
31
|
-
this.columnWidths = newCols.map(c => parseInt(c.width || '120', 10));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
componentWillLoad() {
|
|
35
|
-
this.syncTableContext();
|
|
36
|
-
this.columnWidths = Array.isArray(this.columnWidths) ? this.columnWidths : [];
|
|
37
|
-
this.resolveConfig();
|
|
38
|
-
if ((this.columnWidths ?? []).length === 0) {
|
|
39
|
-
this.columnWidths = this._columns.map(c => parseInt(c.width || '120', 10));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
componentDidLoad() {
|
|
43
|
-
this.syncTableContext();
|
|
44
|
-
this.resolveConfig();
|
|
45
|
-
}
|
|
46
|
-
syncTableContext() {
|
|
47
|
-
const table = this.el.closest('sd-table');
|
|
48
|
-
this.tableEl = table;
|
|
49
|
-
const fromMethod = table?.getTableIdSync?.();
|
|
50
|
-
const fromAttr = table?.getAttribute(TABLE_ID_ATTR);
|
|
51
|
-
const resolvedTableId = (fromMethod && fromMethod !== 'undefined' ? fromMethod : null) ??
|
|
52
|
-
(fromAttr && fromAttr !== 'undefined' ? fromAttr : null) ??
|
|
53
|
-
'';
|
|
54
|
-
if (resolvedTableId && resolvedTableId !== this.tableId) {
|
|
55
|
-
this.tableId = resolvedTableId;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
resolveConfig() {
|
|
59
|
-
const config = this.tableEl?.getConfigSync?.();
|
|
60
|
-
const resolvedColumns = Array.isArray(this.columns)
|
|
61
|
-
? this.columns
|
|
62
|
-
: Array.isArray(config?.columns)
|
|
63
|
-
? config.columns
|
|
64
|
-
: [];
|
|
65
|
-
this._columns = resolvedColumns;
|
|
66
|
-
this._selectable = this.selectable ?? config?.selectable ?? false;
|
|
67
|
-
this._resizable = this.resizable ?? config?.resizable ?? false;
|
|
68
|
-
this._stickyColumn = this.stickyColumn ?? config?.stickyColumn ?? { left: 0, right: 0 };
|
|
69
|
-
this._stickyHeader = this.stickyHeader ?? config?.stickyHeader ?? false;
|
|
70
|
-
this._scrolledLeft = this.scrolledLeft ?? config?.scrolledLeft ?? false;
|
|
71
|
-
this._scrolledRight = this.scrolledRight ?? config?.scrolledRight ?? false;
|
|
72
|
-
if (Array.isArray(config?.columnWidths) && (this.columnWidths ?? []).length === 0) {
|
|
73
|
-
this.columnWidths = [...config.columnWidths];
|
|
74
|
-
}
|
|
75
|
-
if (!Array.isArray(this.columnWidths)) {
|
|
76
|
-
this.columnWidths = [];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async refreshConfig() {
|
|
80
|
-
this.resolveConfig();
|
|
81
|
-
}
|
|
82
|
-
async setColumnWidths(widths) {
|
|
83
|
-
this.columnWidths = Array.isArray(widths) ? widths : [];
|
|
84
|
-
}
|
|
85
|
-
async refreshSelection() {
|
|
86
|
-
const checkbox = this.el.querySelector('sd-checkbox');
|
|
87
|
-
if (checkbox) {
|
|
88
|
-
checkbox.value = this.getIsAllChecked();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
get visibleColumns() {
|
|
92
|
-
return this._columns.filter(col => col.visible !== false);
|
|
93
|
-
}
|
|
94
|
-
getStickyStyle(colIdx) {
|
|
95
|
-
if (this.tableEl?.getStickyStyleSync) {
|
|
96
|
-
return this.tableEl.getStickyStyleSync(colIdx);
|
|
97
|
-
}
|
|
98
|
-
const leftOffset = this.columnWidths.slice(0, colIdx).reduce((a, b) => a + b, 0) + (this._selectable ? 52 : 0);
|
|
99
|
-
const rightOffset = this.columnWidths
|
|
100
|
-
.filter((_, i) => i >= this.visibleColumns.length - (this._stickyColumn.right || 0) && i > colIdx)
|
|
101
|
-
.reduce((a, b) => a + b, 0);
|
|
102
|
-
return {
|
|
103
|
-
'--sticky-left-offset': `${leftOffset}px`,
|
|
104
|
-
'--sticky-right-offset': `${rightOffset}px`,
|
|
105
|
-
'width': `${this.columnWidths[colIdx]}px`,
|
|
106
|
-
'minWidth': `${this.columnWidths[colIdx]}px`,
|
|
107
|
-
'maxWidth': `${this.columnWidths[colIdx]}px`,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
handleResize(index, event, reversed = false) {
|
|
111
|
-
if (this.tableEl?.handleResize) {
|
|
112
|
-
this.tableEl.handleResize(index, event, reversed);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
handleSelectAll(checked) {
|
|
116
|
-
const currentState = this.getIsAllChecked();
|
|
117
|
-
const nextChecked = currentState === null ? false : !!checked;
|
|
118
|
-
const safeRows = Array.isArray(this.rows) ? this.rows : [];
|
|
119
|
-
if (this.tableEl?.toggleSelectAllSync) {
|
|
120
|
-
this.tableEl.toggleSelectAllSync(nextChecked, safeRows);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
getIsAllChecked() {
|
|
124
|
-
const safeRows = Array.isArray(this.rows) ? this.rows : [];
|
|
125
|
-
if (this.tableEl?.getIsAllCheckedSync && safeRows.length > 0) {
|
|
126
|
-
return this.tableEl.getIsAllCheckedSync(safeRows);
|
|
127
|
-
}
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
render() {
|
|
131
|
-
const safeRows = Array.isArray(this.rows) ? this.rows : [];
|
|
132
|
-
const stickyLeftCount = this._stickyColumn.left || 0;
|
|
133
|
-
const stickyRightCount = this._stickyColumn.right || 0;
|
|
134
|
-
const stickyLeftCols = this.visibleColumns.slice(0, stickyLeftCount);
|
|
135
|
-
const middleCols = this.visibleColumns.slice(stickyLeftCount, this.visibleColumns.length - stickyRightCount);
|
|
136
|
-
const stickyRightCols = this.visibleColumns.slice(this.visibleColumns.length - stickyRightCount);
|
|
137
|
-
return (h(Host, { key: '2358499ef65d88005d03b1246604c0fd8eefdde1', slot: `${this.tableId}-head` }, h("thead", { key: '49bb43a19aeb83f3a60367b26dbb6535ebcec743', class: {
|
|
138
|
-
'thead': true,
|
|
139
|
-
'thead--sticky': this._stickyHeader,
|
|
140
|
-
} }, h("tr", { key: 'cd6388d79e9a4a5d9edbbda05601abbbefcb1ff4', class: "tr" }, this._selectable && (h("th", { key: 'fa09e82368d45e9fb1d32838ef44e609c698609d', class: {
|
|
141
|
-
'th': true,
|
|
142
|
-
'th--selected': true,
|
|
143
|
-
'sticky-left': true,
|
|
144
|
-
'sticky-left-edge': stickyLeftCount === 0,
|
|
145
|
-
'is-scrolled-left': stickyLeftCount === 0 && this._scrolledLeft,
|
|
146
|
-
}, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '5ab4861aecfac9495101363d5bd809d077c7dbc3', value: this.getIsAllChecked(), disabled: !safeRows.length, onSdUpdate: (e) => this.handleSelectAll(e.detail) }))), stickyLeftCols.map((col, idx) => (h("th", { key: col.name, class: {
|
|
147
|
-
'th': true,
|
|
148
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
149
|
-
'sticky-left': true,
|
|
150
|
-
'sticky-left-edge': idx === stickyLeftCount - 1,
|
|
151
|
-
'is-scrolled-left': idx === stickyLeftCount - 1 && this._scrolledLeft,
|
|
152
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(idx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer", onMouseDown: (evt) => this.handleResize(idx, evt) }))))), middleCols.map((col, relativeIdx) => {
|
|
153
|
-
const actualColIdx = stickyLeftCount + relativeIdx;
|
|
154
|
-
return (h("th", { key: col.name, class: {
|
|
155
|
-
th: true,
|
|
156
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
157
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer", onMouseDown: (evt) => this.handleResize(actualColIdx, evt) }))));
|
|
158
|
-
}), stickyRightCols.map((col, relativeIdx) => {
|
|
159
|
-
const actualColIdx = this.visibleColumns.length - stickyRightCount + relativeIdx;
|
|
160
|
-
return (h("th", { key: col.name, class: {
|
|
161
|
-
'th': true,
|
|
162
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
163
|
-
'sticky-right': true,
|
|
164
|
-
'sticky-right-edge': relativeIdx === 0,
|
|
165
|
-
'is-scrolled-right': relativeIdx === 0 && this._scrolledRight,
|
|
166
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer th__resizer--left", onMouseDown: (evt) => this.handleResize(actualColIdx, evt, true) }))));
|
|
167
|
-
})))));
|
|
168
|
-
}
|
|
169
|
-
static get watchers() { return {
|
|
170
|
-
"columns": [{
|
|
171
|
-
"handleColumnsChange": 0
|
|
172
|
-
}]
|
|
173
|
-
}; }
|
|
174
|
-
};
|
|
175
|
-
SdThead.style = sdTheadCss();
|
|
176
|
-
|
|
177
|
-
export { SdThead as sd_thead };
|
package/dist/esm/sd-tr.entry.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, a as getElement, h, H as Host } from './index-Bp7ytJz5.js';
|
|
2
|
-
import { T as TABLE_ID_ATTR } from './constants-sZMi_32I.js';
|
|
3
|
-
|
|
4
|
-
const sdTrCss = () => `sd-tr{display:contents}sd-tr *{box-sizing:border-box}.tr{display:table-row}.tr:hover .td{background-color:#F9F9F9}.td{display:table-cell;height:44px;padding:0 16px;border-bottom:1px solid #E1E1E1;background:white;vertical-align:middle;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.td--left{text-align:left}.td--center{text-align:center}.td--right{text-align:right}.td--selected{position:relative;width:52px !important;max-width:52px !important;min-width:52px !important;padding:0 10px 0 24px;text-align:left}.td--selected sd-checkbox label{position:relative}.td--selected sd-checkbox label:before{content:"";position:absolute;inset:-6px}.td.sticky-left{position:sticky;background-color:white;z-index:100 !important;left:var(--sticky-left-offset, 0)}.td.sticky-right{position:sticky;background-color:white;z-index:100 !important;right:var(--sticky-right-offset, 0)}.td.sticky-left-edge:after{content:"";position:absolute;top:0;left:100%;right:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset 12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.td.sticky-right-edge:after{content:"";position:absolute;top:0;left:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset -12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.td.sticky-left-edge.is-scrolled-left{overflow:visible}.td.sticky-left-edge.is-scrolled-left:after{opacity:1}.td.sticky-right-edge.is-scrolled-right{overflow:visible}.td.sticky-right-edge.is-scrolled-right:after{opacity:1}.tr:hover .td.sticky-left,.tr:hover .td.sticky-right{background-color:#F9F9F9}`;
|
|
5
|
-
|
|
6
|
-
const SdTr = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
}
|
|
10
|
-
get el() { return getElement(this); }
|
|
11
|
-
columns;
|
|
12
|
-
selectable;
|
|
13
|
-
stickyColumn;
|
|
14
|
-
rowKey = '';
|
|
15
|
-
row = {};
|
|
16
|
-
tableId = '';
|
|
17
|
-
columnWidths = [];
|
|
18
|
-
isVisible = true;
|
|
19
|
-
_columns = [];
|
|
20
|
-
_selectable = false;
|
|
21
|
-
_stickyColumn = { left: 0, right: 0 };
|
|
22
|
-
_scrolledLeft = false;
|
|
23
|
-
_scrolledRight = false;
|
|
24
|
-
tableEl = null;
|
|
25
|
-
componentWillLoad() {
|
|
26
|
-
this.syncTableContext();
|
|
27
|
-
this.columnWidths = this.columnWidths ?? [];
|
|
28
|
-
this.resolveConfig();
|
|
29
|
-
this.columnWidths = this._columns.map(c => parseInt(c.width || '120', 10));
|
|
30
|
-
this.updateVisibilitySync();
|
|
31
|
-
}
|
|
32
|
-
componentDidLoad() {
|
|
33
|
-
this.syncTableContext();
|
|
34
|
-
}
|
|
35
|
-
syncTableContext() {
|
|
36
|
-
const table = this.el.closest('sd-table');
|
|
37
|
-
this.tableEl = table;
|
|
38
|
-
const fromMethod = table?.getTableIdSync?.();
|
|
39
|
-
const fromAttr = table?.getAttribute(TABLE_ID_ATTR);
|
|
40
|
-
const resolvedTableId = (fromMethod && fromMethod !== 'undefined' ? fromMethod : null) ??
|
|
41
|
-
(fromAttr && fromAttr !== 'undefined' ? fromAttr : null) ??
|
|
42
|
-
'';
|
|
43
|
-
if (resolvedTableId && resolvedTableId !== this.tableId) {
|
|
44
|
-
this.tableId = resolvedTableId;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
resolveConfig() {
|
|
48
|
-
const config = this.tableEl?.getConfigSync?.();
|
|
49
|
-
this._columns = this.columns ?? config?.columns ?? [];
|
|
50
|
-
this._selectable = this.selectable ?? config?.selectable ?? false;
|
|
51
|
-
this._stickyColumn = this.stickyColumn ?? config?.stickyColumn ?? { left: 0, right: 0 };
|
|
52
|
-
this._scrolledLeft = config?.scrolledLeft ?? false;
|
|
53
|
-
this._scrolledRight = config?.scrolledRight ?? false;
|
|
54
|
-
if (config?.columnWidths && (this.columnWidths ?? []).length === 0) {
|
|
55
|
-
this.columnWidths = [...config.columnWidths];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async refreshConfig() {
|
|
59
|
-
this.resolveConfig();
|
|
60
|
-
}
|
|
61
|
-
async updateVisibility() {
|
|
62
|
-
this.updateVisibilitySync();
|
|
63
|
-
}
|
|
64
|
-
updateVisibilitySync() {
|
|
65
|
-
const rowIndex = parseInt(this.rowKey, 10);
|
|
66
|
-
const pageInfo = this.tableEl?.getPaginationInfoSync?.();
|
|
67
|
-
if (!pageInfo) {
|
|
68
|
-
this.isVisible = true;
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
this.isVisible = rowIndex >= pageInfo.startIndex && rowIndex < pageInfo.endIndex;
|
|
72
|
-
}
|
|
73
|
-
async setColumnWidths(widths) {
|
|
74
|
-
this.columnWidths = widths;
|
|
75
|
-
}
|
|
76
|
-
async refreshSelection() {
|
|
77
|
-
const checkbox = this.el.querySelector('sd-checkbox');
|
|
78
|
-
if (checkbox) {
|
|
79
|
-
checkbox.value = this.isSelected();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
get visibleColumns() {
|
|
83
|
-
return this._columns.filter(col => col.visible !== false);
|
|
84
|
-
}
|
|
85
|
-
formatValue(value) {
|
|
86
|
-
if (value === null || value === undefined) {
|
|
87
|
-
return '';
|
|
88
|
-
}
|
|
89
|
-
if (typeof value === 'number') {
|
|
90
|
-
return value.toLocaleString();
|
|
91
|
-
}
|
|
92
|
-
return String(value);
|
|
93
|
-
}
|
|
94
|
-
getCellValue(column) {
|
|
95
|
-
const { field, format, name } = column;
|
|
96
|
-
const value = typeof field === 'function' ? field(this.row) : field ? this.row[field] : this.row[name];
|
|
97
|
-
return format ? format(value, this.row) : this.formatValue(value);
|
|
98
|
-
}
|
|
99
|
-
getStickyStyle(colIdx) {
|
|
100
|
-
if (this.tableEl?.getStickyStyleSync) {
|
|
101
|
-
return this.tableEl.getStickyStyleSync(colIdx);
|
|
102
|
-
}
|
|
103
|
-
const leftOffset = this.columnWidths.slice(0, colIdx).reduce((a, b) => a + b, 0) + (this._selectable ? 52 : 0);
|
|
104
|
-
const rightOffset = this.columnWidths
|
|
105
|
-
.filter((_, i) => i >= this.visibleColumns.length - (this._stickyColumn.right || 0) && i > colIdx)
|
|
106
|
-
.reduce((a, b) => a + b, 0);
|
|
107
|
-
return {
|
|
108
|
-
'--sticky-left-offset': `${leftOffset}px`,
|
|
109
|
-
'--sticky-right-offset': `${rightOffset}px`,
|
|
110
|
-
'width': `${this.columnWidths[colIdx]}px`,
|
|
111
|
-
'minWidth': `${this.columnWidths[colIdx]}px`,
|
|
112
|
-
'maxWidth': `${this.columnWidths[colIdx]}px`,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
isSelected() {
|
|
116
|
-
if (this.tableEl?.isRowSelectedSync) {
|
|
117
|
-
return this.tableEl.isRowSelectedSync(this.row);
|
|
118
|
-
}
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
handleSelect() {
|
|
122
|
-
if (this.tableEl?.updateRowSelectSync) {
|
|
123
|
-
this.tableEl.updateRowSelectSync(this.row);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
render() {
|
|
127
|
-
const stickyLeftCount = this._stickyColumn.left || 0;
|
|
128
|
-
const stickyRightCount = this._stickyColumn.right || 0;
|
|
129
|
-
const stickyLeftCols = this.visibleColumns.slice(0, stickyLeftCount);
|
|
130
|
-
const middleCols = this.visibleColumns.slice(stickyLeftCount, this.visibleColumns.length - stickyRightCount);
|
|
131
|
-
const stickyRightCols = this.visibleColumns.slice(this.visibleColumns.length - stickyRightCount);
|
|
132
|
-
return (h(Host, { key: 'd6259e5c87cce0fa70f1d849e11416ad69b0cac1', style: { display: this.isVisible ? '' : 'none' } }, h("tr", { key: '90e36c39bede0e07fc1c4d90183a73ebc99b6ed8', class: "tr" }, this._selectable && (h("td", { key: '601f1747063d8e73803304abc2cd767f420f359c', class: {
|
|
133
|
-
'td': true,
|
|
134
|
-
'td--selected': true,
|
|
135
|
-
'sticky-left': true,
|
|
136
|
-
'sticky-left-edge': stickyLeftCount === 0,
|
|
137
|
-
'is-scrolled-left': stickyLeftCount === 0 && this._scrolledLeft,
|
|
138
|
-
}, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '97068a623d3b7876c7e6392e3f5ed81cfc60d592', value: this.isSelected(), onSdUpdate: () => this.handleSelect() }))), stickyLeftCols.map((col, idx) => (h("td", { key: col.name, class: {
|
|
139
|
-
'td': true,
|
|
140
|
-
[`td--${col.align || 'left'}`]: true,
|
|
141
|
-
'sticky-left': true,
|
|
142
|
-
'sticky-left-edge': idx === stickyLeftCount - 1,
|
|
143
|
-
'is-scrolled-left': idx === stickyLeftCount - 1 && this._scrolledLeft,
|
|
144
|
-
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
145
|
-
}, style: this.getStickyStyle(idx) }, h("slot", { name: `${this.tableId}-${typeof col.field === 'string' ? col.field : col.name}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))))), middleCols.map((col, relativeIdx) => {
|
|
146
|
-
const actualColIdx = stickyLeftCount + relativeIdx;
|
|
147
|
-
const fieldName = typeof col.field === 'string' ? col.field : col.name;
|
|
148
|
-
return (h("td", { key: col.name, class: {
|
|
149
|
-
td: true,
|
|
150
|
-
[`td--${col.align || 'left'}`]: true,
|
|
151
|
-
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
152
|
-
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
|
|
153
|
-
}), stickyRightCols.map((col, relativeIdx) => {
|
|
154
|
-
const actualColIdx = this.visibleColumns.length - stickyRightCount + relativeIdx;
|
|
155
|
-
const fieldName = typeof col.field === 'string' ? col.field : col.name;
|
|
156
|
-
return (h("td", { key: col.name, class: {
|
|
157
|
-
'td': true,
|
|
158
|
-
[`td--${col.align || 'left'}`]: true,
|
|
159
|
-
'sticky-right': true,
|
|
160
|
-
'sticky-right-edge': relativeIdx === 0,
|
|
161
|
-
'is-scrolled-right': relativeIdx === 0 && this._scrolledRight,
|
|
162
|
-
[`${col.tdClass}`]: Boolean(col.tdClass),
|
|
163
|
-
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
|
|
164
|
-
}))));
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
SdTr.style = sdTrCss();
|
|
168
|
-
|
|
169
|
-
export { SdTr as sd_tr };
|