@getflip/swirl-components 0.225.2 → 0.226.0
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/components.json +1 -1
- package/dist/cjs/swirl-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/swirl-table-column.cjs.entry.js +1 -1
- package/dist/cjs/swirl-table.cjs.entry.js +34 -5
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-table/swirl-table.js +34 -5
- package/dist/collection/components/swirl-table/swirl-table.spec.js +1 -1
- package/dist/collection/components/swirl-table-cell/swirl-table-cell.css +2 -0
- package/dist/collection/components/swirl-table-column/swirl-table-column.css +2 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-table-cell.js +1 -1
- package/dist/components/swirl-table-column.js +1 -1
- package/dist/components/swirl-table.js +34 -5
- package/dist/esm/swirl-table-cell.entry.js +1 -1
- package/dist/esm/swirl-table-column.entry.js +1 -1
- package/dist/esm/swirl-table.entry.js +34 -5
- package/dist/swirl-components/{p-37588551.entry.js → p-1f46d2bf.entry.js} +1 -1
- package/dist/swirl-components/{p-9eca1d3a.entry.js → p-2824cfca.entry.js} +1 -1
- package/dist/swirl-components/p-e8fdfc29.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-table/swirl-table.d.ts +10 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-a00005a8.entry.js +0 -1
package/components.json
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-6aba64ed.js');
|
|
6
6
|
|
|
7
|
-
const swirlTableCellCss = ":host{display:flex;overflow:auto;padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);flex-basis:0;flex-grow:1;flex-shrink:1;align-items:center;background-color:var(--s-surface-default);word-break:break-word;-webkit-hyphens:auto;hyphens:auto;transition:box-shadow 0.15s}:host(.table-cell--is-sticky){position:sticky}:host(.table-cell--is-sticky-right){position:sticky;right:0;overflow:hidden}:host(.table-cell--has-shadow-right){box-shadow:var(--swirl-table-sticky-right-shadow)}:host(.table-cell--has-shadow-left){box-shadow:var(--swirl-table-sticky-left-shadow)}:host *{box-sizing:border-box}";
|
|
7
|
+
const swirlTableCellCss = ":host{display:flex;overflow:auto;padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);flex-basis:0;flex-grow:1;flex-shrink:1;align-items:center;background-color:var(--s-surface-default);word-break:break-word;-webkit-hyphens:auto;hyphens:auto;transition:box-shadow 0.15s}:host(.table-cell--is-sticky){position:sticky;z-index:1}:host(.table-cell--is-sticky-right){position:sticky;z-index:1;right:0;overflow:hidden}:host(.table-cell--has-shadow-right){box-shadow:var(--swirl-table-sticky-right-shadow)}:host(.table-cell--has-shadow-left){box-shadow:var(--swirl-table-sticky-left-shadow)}:host *{box-sizing:border-box}";
|
|
8
8
|
const SwirlTableCellStyle0 = swirlTableCellCss;
|
|
9
9
|
|
|
10
10
|
const SwirlTableCell = class {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-6aba64ed.js');
|
|
6
6
|
const utils = require('./utils-c82e5573.js');
|
|
7
7
|
|
|
8
|
-
const swirlTableColumnCss = ":host{display:flex;overflow:hidden;padding-top:var(--s-space-12);padding-right:var(--s-space-16);padding-bottom:var(--s-space-12);padding-left:var(--s-space-16);flex-basis:0;flex-grow:1;flex-shrink:1;align-items:center;border-bottom:var(--s-border-width-default) solid var(--s-border-default);color:var(--s-text-subdued);background-color:var(--s-surface-default);font-size:var(--s-font-size-sm);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-sm);white-space:nowrap;letter-spacing:var(--s-letter-spacing-tighter);text-overflow:ellipsis;transition:box-shadow 0.15s;gap:var(--s-space-8)}:host(.table-column--is-sticky){position:sticky}:host(.table-column--is-sticky-right){position:sticky;right:0}:host(.table-column--has-shadow-right){box-shadow:var(--swirl-table-sticky-right-shadow)}:host(.table-column--has-shadow-left){box-shadow:var(--swirl-table-sticky-left-shadow)}:host *{box-sizing:border-box}.table-column__sort-indicator{display:inline-flex;width:1.25rem;height:1.25rem;flex-grow:0;flex-shrink:0}";
|
|
8
|
+
const swirlTableColumnCss = ":host{display:flex;overflow:hidden;padding-top:var(--s-space-12);padding-right:var(--s-space-16);padding-bottom:var(--s-space-12);padding-left:var(--s-space-16);flex-basis:0;flex-grow:1;flex-shrink:1;align-items:center;border-bottom:var(--s-border-width-default) solid var(--s-border-default);color:var(--s-text-subdued);background-color:var(--s-surface-default);font-size:var(--s-font-size-sm);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-sm);white-space:nowrap;letter-spacing:var(--s-letter-spacing-tighter);text-overflow:ellipsis;transition:box-shadow 0.15s;gap:var(--s-space-8)}:host(.table-column--is-sticky){position:sticky;z-index:1}:host(.table-column--is-sticky-right){position:sticky;z-index:1;right:0}:host(.table-column--has-shadow-right){box-shadow:var(--swirl-table-sticky-right-shadow)}:host(.table-column--has-shadow-left){box-shadow:var(--swirl-table-sticky-left-shadow)}:host *{box-sizing:border-box}.table-column__sort-indicator{display:inline-flex;width:1.25rem;height:1.25rem;flex-grow:0;flex-shrink:0}";
|
|
9
9
|
const SwirlTableColumnStyle0 = swirlTableColumnCss;
|
|
10
10
|
|
|
11
11
|
const SwirlTableColumn = class {
|
|
@@ -84,7 +84,6 @@ const SwirlTable = class {
|
|
|
84
84
|
index.registerInstance(this, hostRef);
|
|
85
85
|
this.triggerRerender = utils.debounce(async () => {
|
|
86
86
|
await this.updateLayout();
|
|
87
|
-
this.updateScrolledState();
|
|
88
87
|
this.updateEmptyState();
|
|
89
88
|
}, 0, true);
|
|
90
89
|
this.updateLayout = dist(async () => {
|
|
@@ -95,13 +94,13 @@ const SwirlTable = class {
|
|
|
95
94
|
this.layoutEmptyRow();
|
|
96
95
|
this.layoutRowGroups();
|
|
97
96
|
this.layOutCellsAndColumns();
|
|
97
|
+
this.updateScrolledState();
|
|
98
98
|
}, 16, { leading: true });
|
|
99
99
|
this.onScroll = () => {
|
|
100
100
|
this.updateScrolledState();
|
|
101
101
|
};
|
|
102
102
|
this.onSlotChange = async () => {
|
|
103
103
|
await this.updateLayout();
|
|
104
|
-
this.updateScrolledState();
|
|
105
104
|
this.updateEmptyState();
|
|
106
105
|
};
|
|
107
106
|
this.caption = undefined;
|
|
@@ -112,14 +111,39 @@ const SwirlTable = class {
|
|
|
112
111
|
this.scrolled = undefined;
|
|
113
112
|
this.scrolledToEnd = undefined;
|
|
114
113
|
}
|
|
114
|
+
async componentDidLoad() {
|
|
115
|
+
this.setupIntersectionObserver();
|
|
116
|
+
}
|
|
117
|
+
disconnectedCallback() {
|
|
118
|
+
this.intersectionObserver?.disconnect();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Set up an Intersection Observer to monitor when the table container becomes visible.
|
|
122
|
+
* This is important because the table's layout may need updating when it becomes visible,
|
|
123
|
+
* especially if it is rendered within a modal that opens after rendering.
|
|
124
|
+
*/
|
|
125
|
+
setupIntersectionObserver() {
|
|
126
|
+
this.intersectionObserver = new IntersectionObserver(this.onVisibilityChange.bind(this), {
|
|
127
|
+
threshold: 0,
|
|
128
|
+
});
|
|
129
|
+
this.intersectionObserver.observe(this.container);
|
|
130
|
+
}
|
|
131
|
+
async onVisibilityChange(entries) {
|
|
132
|
+
const inViewport = entries.some((entry) => entry.isIntersecting);
|
|
133
|
+
if (inViewport) {
|
|
134
|
+
// Delay layout update to ensure the container is fully visible,
|
|
135
|
+
// especially if it was initially rendered in a modal.
|
|
136
|
+
setTimeout(async () => {
|
|
137
|
+
await this.updateLayout();
|
|
138
|
+
}, 100);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
115
141
|
async componentDidRender() {
|
|
116
142
|
await this.updateLayout();
|
|
117
|
-
this.updateScrolledState();
|
|
118
143
|
this.updateEmptyState();
|
|
119
144
|
}
|
|
120
145
|
async onWindowResize() {
|
|
121
146
|
await this.updateLayout();
|
|
122
|
-
this.updateScrolledState();
|
|
123
147
|
}
|
|
124
148
|
/**
|
|
125
149
|
* Force a re-render of the table
|
|
@@ -151,6 +175,7 @@ const SwirlTable = class {
|
|
|
151
175
|
column.style.right = "";
|
|
152
176
|
column.style.left = "";
|
|
153
177
|
column.style.position = "";
|
|
178
|
+
column.style.zIndex = "";
|
|
154
179
|
});
|
|
155
180
|
}
|
|
156
181
|
resetCellStyles() {
|
|
@@ -161,10 +186,14 @@ const SwirlTable = class {
|
|
|
161
186
|
cell.style.left = "";
|
|
162
187
|
cell.style.right = "";
|
|
163
188
|
cell.style.position = "";
|
|
189
|
+
cell.style.zIndex = "";
|
|
164
190
|
});
|
|
165
191
|
}
|
|
166
192
|
updateScrolledState() {
|
|
167
193
|
const isMobile = utils.isMobileViewport();
|
|
194
|
+
if (this.container === undefined) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
168
197
|
const scrollable = this.container.scrollWidth > this.container.clientWidth;
|
|
169
198
|
const scrolled = this.container.scrollLeft > 0;
|
|
170
199
|
const scrolledToEnd = Math.ceil(this.container.clientWidth + this.container.scrollLeft) >=
|
|
@@ -297,7 +326,7 @@ const SwirlTable = class {
|
|
|
297
326
|
this.empty = !Boolean(rowsContainer) || rowsContainer.children.length === 0;
|
|
298
327
|
}
|
|
299
328
|
render() {
|
|
300
|
-
return (index.h(index.Host, { key: '
|
|
329
|
+
return (index.h(index.Host, { key: '375c7b9ed74b08a4dd4f93a40390b36ef9ba7cf6' }, index.h("div", { key: '280f0d90c5899074c8ab783df64ee9a3c8fce7af', class: "table" }, index.h("div", { key: 'ba9d29fb8b7743a1259dabe64535284cda3e3ac7', class: "table__container", onScroll: this.onScroll, ref: (el) => (this.container = el) }, index.h("div", { key: 'e00b9870884c3585a45329c1f44a769a7f74bebd', "aria-describedby": Boolean(this.caption) ? "caption" : undefined, "aria-label": this.label, role: "table", class: "table__table" }, this.caption && (index.h("swirl-visually-hidden", { key: 'd3c2ab9771d93e6f8a71724637b2e10e3a04044a' }, index.h("div", { key: 'f658fd8feb639bd39d450085228344bc7b9fd043', id: "caption" }, this.caption))), index.h("div", { key: 'f300cf2d69f449cdd87b1413e3295ea0f4d1ef11', role: "rowgroup" }, index.h("div", { key: 'a21c8da3eb5482467e304609d95dbf7ae666d2d2', class: "table__header", role: "row" }, index.h("slot", { key: '8c510369deb673df8ec0ac591d5bc6b66d3fc2b2', name: "columns", onSlotchange: this.onSlotChange }))), index.h("div", { key: '1b50c67e78e176cb31f10c5469d0a1b07f60891d', class: "table__body" }, index.h("slot", { key: 'ae50a28f390ff6a2d349bb685445f29245f29751', name: "rows", onSlotchange: this.onSlotChange }), this.empty && (index.h("div", { key: 'd2ff20c0f27d4e0743696cbbcb524b7ff573ceba', class: "table__empty-row", role: "row" }, index.h("div", { key: 'aa51ecd760c1f7ef830be9ce2405119a1f870c89', "aria-colspan": this.getColumns().length, class: "table__empty-row-cell", role: "cell" }, index.h("swirl-text", { key: 'c6f7156718c95fce2b8e6d51b5ba9547c6404e47', align: "center", size: "sm" }, this.emptyStateLabel))))))))));
|
|
301
330
|
}
|
|
302
331
|
get el() { return index.getElement(this); }
|
|
303
332
|
};
|