@deepfuture/dui-components 0.0.12 → 0.0.13

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.
Files changed (89) hide show
  1. package/_deprecated/center/center.js +2 -2
  2. package/_deprecated/hstack/hstack.js +79 -33
  3. package/_deprecated/page-inset/page-inset.js +104 -56
  4. package/_deprecated/vstack/vstack.js +61 -19
  5. package/accordion/accordion-item.js +217 -147
  6. package/accordion/accordion.js +214 -149
  7. package/alert-dialog/alert-dialog-close.js +2 -2
  8. package/alert-dialog/alert-dialog-popup.js +230 -166
  9. package/alert-dialog/alert-dialog-trigger.js +2 -2
  10. package/alert-dialog/alert-dialog.js +128 -73
  11. package/avatar/avatar.js +175 -115
  12. package/badge/badge.js +2 -2
  13. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  14. package/breadcrumb/breadcrumb-item.js +2 -2
  15. package/breadcrumb/breadcrumb-link.js +2 -2
  16. package/breadcrumb/breadcrumb-page.js +2 -2
  17. package/breadcrumb/breadcrumb-separator.js +2 -2
  18. package/breadcrumb/breadcrumb.js +2 -2
  19. package/button/button.js +109 -65
  20. package/calendar/calendar.js +368 -290
  21. package/checkbox/checkbox-group.js +146 -87
  22. package/checkbox/checkbox.js +232 -167
  23. package/collapsible/collapsible.js +210 -132
  24. package/combobox/combobox.js +318 -252
  25. package/command/command-empty.js +67 -25
  26. package/command/command-group.js +87 -47
  27. package/command/command-input.js +84 -44
  28. package/command/command-item.js +168 -124
  29. package/command/command-list.js +60 -18
  30. package/command/command-separator.js +2 -2
  31. package/command/command-shortcut.js +2 -2
  32. package/command/command.js +297 -232
  33. package/data-table/data-table.js +225 -153
  34. package/dialog/dialog-close.js +2 -2
  35. package/dialog/dialog-popup.js +247 -181
  36. package/dialog/dialog-trigger.js +2 -2
  37. package/dialog/dialog.js +128 -73
  38. package/dropzone/dropzone.js +310 -249
  39. package/icon/icon.js +2 -2
  40. package/input/input.js +204 -143
  41. package/link/link.js +62 -24
  42. package/menu/menu-item.js +66 -24
  43. package/menu/menu.js +189 -136
  44. package/menubar/menubar.js +142 -91
  45. package/number-field/number-field.js +277 -204
  46. package/package.json +2 -2
  47. package/popover/popover-close.js +2 -2
  48. package/popover/popover-popup.js +126 -76
  49. package/popover/popover-trigger.js +2 -2
  50. package/popover/popover.js +181 -120
  51. package/portal/portal.js +128 -86
  52. package/preview-card/preview-card-popup.js +114 -66
  53. package/preview-card/preview-card-trigger.js +2 -2
  54. package/preview-card/preview-card.js +211 -142
  55. package/progress/progress.js +91 -45
  56. package/radio/radio-group.js +153 -90
  57. package/radio/radio.js +137 -94
  58. package/scroll-area/scroll-area.js +382 -283
  59. package/select/select.js +260 -203
  60. package/separator/separator.js +60 -18
  61. package/sidebar/sidebar-content.js +2 -2
  62. package/sidebar/sidebar-footer.js +2 -2
  63. package/sidebar/sidebar-group-label.js +2 -2
  64. package/sidebar/sidebar-group.js +2 -2
  65. package/sidebar/sidebar-header.js +2 -2
  66. package/sidebar/sidebar-inset.js +2 -2
  67. package/sidebar/sidebar-menu-button.js +118 -74
  68. package/sidebar/sidebar-menu-item.js +2 -2
  69. package/sidebar/sidebar-menu.js +2 -2
  70. package/sidebar/sidebar-provider.js +202 -129
  71. package/sidebar/sidebar-separator.js +2 -2
  72. package/sidebar/sidebar-trigger.js +2 -2
  73. package/sidebar/sidebar.js +150 -85
  74. package/slider/slider.js +217 -159
  75. package/spinner/spinner.js +70 -28
  76. package/switch/switch.js +174 -111
  77. package/tabs/tab.js +89 -47
  78. package/tabs/tabs-indicator.js +2 -2
  79. package/tabs/tabs-list.js +92 -54
  80. package/tabs/tabs-panel.js +90 -44
  81. package/tabs/tabs.js +130 -71
  82. package/textarea/textarea.js +153 -95
  83. package/toggle/toggle-group.js +184 -125
  84. package/toggle/toggle.js +131 -76
  85. package/toolbar/toolbar.js +79 -33
  86. package/tooltip/tooltip-popup.js +108 -60
  87. package/tooltip/tooltip-trigger.js +93 -55
  88. package/tooltip/tooltip.js +225 -154
  89. package/trunc/trunc.js +78 -34
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/data-table */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
7
39
  };
8
40
  import { css, html, LitElement, nothing } from "lit";
9
- import { property } from "lit/decorators.js";
41
+ import { property, state } from "lit/decorators.js";
10
42
  import { repeat } from "lit/directives/repeat.js";
11
43
  import { styleMap } from "lit/directives/style-map.js";
12
44
  import { base } from "@deepfuture/dui-core/base";
@@ -174,173 +206,222 @@ const componentStyles = css `
174
206
  * @fires sort-change - Fired when a sortable column header is clicked. Detail: SortState
175
207
  * @fires page-change - Fired when the page changes. Detail: PageState
176
208
  */
177
- export class DuiDataTable extends LitElement {
178
- static { this.tagName = "dui-data-table"; }
179
- static { this.styles = [base, hostStyles, componentStyles]; }
180
- #columns_accessor_storage = [];
181
- /** Column definitions describing each visible column. */
182
- get columns() { return this.#columns_accessor_storage; }
183
- set columns(value) { this.#columns_accessor_storage = value; }
184
- #data_accessor_storage = [];
185
- /** The full data array. Sorting and pagination are applied internally. */
186
- get data() { return this.#data_accessor_storage; }
187
- set data(value) { this.#data_accessor_storage = value; }
188
- #pageSize_accessor_storage = 10;
189
- /** Number of rows per page. Set to 0 to disable pagination. */
190
- get pageSize() { return this.#pageSize_accessor_storage; }
191
- set pageSize(value) { this.#pageSize_accessor_storage = value; }
192
- #rowKey_accessor_storage = undefined;
193
- /** Key function to derive a unique identifier from each row. */
194
- get rowKey() { return this.#rowKey_accessor_storage; }
195
- set rowKey(value) { this.#rowKey_accessor_storage = value; }
196
- #emptyText_accessor_storage = "No results.";
197
- /** Text shown when the data array is empty. */
198
- get emptyText() { return this.#emptyText_accessor_storage; }
199
- set emptyText(value) { this.#emptyText_accessor_storage = value; }
200
- #sort_accessor_storage = null;
201
- get #sort() { return this.#sort_accessor_storage; }
202
- set #sort(value) { this.#sort_accessor_storage = value; }
203
- #page_accessor_storage = 1;
204
- get #page() { return this.#page_accessor_storage; }
205
- set #page(value) { this.#page_accessor_storage = value; }
206
- #displayRows_accessor_storage = [];
207
- get #displayRows() { return this.#displayRows_accessor_storage; }
208
- set #displayRows(value) { this.#displayRows_accessor_storage = value; }
209
- // ── Lifecycle ──────────────────────────────────────────────────────
210
- willUpdate(changed) {
211
- // Recompute display rows when data, sort, page, or pageSize change.
212
- if (changed.has("data") ||
213
- changed.has("pageSize") ||
214
- changed.has("#sort") ||
215
- changed.has("#page")) {
216
- // Reset page when data changes.
217
- if (changed.has("data")) {
218
- this.#page = 1;
219
- }
220
- const sorted = sortData(this.data, this.#sort);
221
- if (this.pageSize > 0) {
222
- this.#displayRows = paginateData(sorted, this.#page, this.pageSize);
223
- }
224
- else {
225
- this.#displayRows = sorted;
209
+ let DuiDataTable = (() => {
210
+ let _classSuper = LitElement;
211
+ let _columns_decorators;
212
+ let _columns_initializers = [];
213
+ let _columns_extraInitializers = [];
214
+ let _data_decorators;
215
+ let _data_initializers = [];
216
+ let _data_extraInitializers = [];
217
+ let _pageSize_decorators;
218
+ let _pageSize_initializers = [];
219
+ let _pageSize_extraInitializers = [];
220
+ let _rowKey_decorators;
221
+ let _rowKey_initializers = [];
222
+ let _rowKey_extraInitializers = [];
223
+ let _emptyText_decorators;
224
+ let _emptyText_initializers = [];
225
+ let _emptyText_extraInitializers = [];
226
+ let _private_sort_decorators;
227
+ let _private_sort_initializers = [];
228
+ let _private_sort_extraInitializers = [];
229
+ let _private_sort_descriptor;
230
+ let _private_page_decorators;
231
+ let _private_page_initializers = [];
232
+ let _private_page_extraInitializers = [];
233
+ let _private_page_descriptor;
234
+ let _private_displayRows_decorators;
235
+ let _private_displayRows_initializers = [];
236
+ let _private_displayRows_extraInitializers = [];
237
+ let _private_displayRows_descriptor;
238
+ return class DuiDataTable extends _classSuper {
239
+ static {
240
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
241
+ _columns_decorators = [property({ attribute: false })];
242
+ _data_decorators = [property({ attribute: false })];
243
+ _pageSize_decorators = [property({ type: Number, attribute: "page-size" })];
244
+ _rowKey_decorators = [property({ attribute: false })];
245
+ _emptyText_decorators = [property({ attribute: "empty-text" })];
246
+ _private_sort_decorators = [state()];
247
+ _private_page_decorators = [state()];
248
+ _private_displayRows_decorators = [state()];
249
+ __esDecorate(this, null, _columns_decorators, { kind: "accessor", name: "columns", static: false, private: false, access: { has: obj => "columns" in obj, get: obj => obj.columns, set: (obj, value) => { obj.columns = value; } }, metadata: _metadata }, _columns_initializers, _columns_extraInitializers);
250
+ __esDecorate(this, null, _data_decorators, { kind: "accessor", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
251
+ __esDecorate(this, null, _pageSize_decorators, { kind: "accessor", name: "pageSize", static: false, private: false, access: { has: obj => "pageSize" in obj, get: obj => obj.pageSize, set: (obj, value) => { obj.pageSize = value; } }, metadata: _metadata }, _pageSize_initializers, _pageSize_extraInitializers);
252
+ __esDecorate(this, null, _rowKey_decorators, { kind: "accessor", name: "rowKey", static: false, private: false, access: { has: obj => "rowKey" in obj, get: obj => obj.rowKey, set: (obj, value) => { obj.rowKey = value; } }, metadata: _metadata }, _rowKey_initializers, _rowKey_extraInitializers);
253
+ __esDecorate(this, null, _emptyText_decorators, { kind: "accessor", name: "emptyText", static: false, private: false, access: { has: obj => "emptyText" in obj, get: obj => obj.emptyText, set: (obj, value) => { obj.emptyText = value; } }, metadata: _metadata }, _emptyText_initializers, _emptyText_extraInitializers);
254
+ __esDecorate(this, _private_sort_descriptor = { get: __setFunctionName(function () { return this.#sort_accessor_storage; }, "#sort", "get"), set: __setFunctionName(function (value) { this.#sort_accessor_storage = value; }, "#sort", "set") }, _private_sort_decorators, { kind: "accessor", name: "#sort", static: false, private: true, access: { has: obj => #sort in obj, get: obj => obj.#sort, set: (obj, value) => { obj.#sort = value; } }, metadata: _metadata }, _private_sort_initializers, _private_sort_extraInitializers);
255
+ __esDecorate(this, _private_page_descriptor = { get: __setFunctionName(function () { return this.#page_accessor_storage; }, "#page", "get"), set: __setFunctionName(function (value) { this.#page_accessor_storage = value; }, "#page", "set") }, _private_page_decorators, { kind: "accessor", name: "#page", static: false, private: true, access: { has: obj => #page in obj, get: obj => obj.#page, set: (obj, value) => { obj.#page = value; } }, metadata: _metadata }, _private_page_initializers, _private_page_extraInitializers);
256
+ __esDecorate(this, _private_displayRows_descriptor = { get: __setFunctionName(function () { return this.#displayRows_accessor_storage; }, "#displayRows", "get"), set: __setFunctionName(function (value) { this.#displayRows_accessor_storage = value; }, "#displayRows", "set") }, _private_displayRows_decorators, { kind: "accessor", name: "#displayRows", static: false, private: true, access: { has: obj => #displayRows in obj, get: obj => obj.#displayRows, set: (obj, value) => { obj.#displayRows = value; } }, metadata: _metadata }, _private_displayRows_initializers, _private_displayRows_extraInitializers);
257
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
258
+ }
259
+ static tagName = "dui-data-table";
260
+ static styles = [base, hostStyles, componentStyles];
261
+ #columns_accessor_storage = __runInitializers(this, _columns_initializers, []);
262
+ /** Column definitions describing each visible column. */
263
+ get columns() { return this.#columns_accessor_storage; }
264
+ set columns(value) { this.#columns_accessor_storage = value; }
265
+ #data_accessor_storage = (__runInitializers(this, _columns_extraInitializers), __runInitializers(this, _data_initializers, []));
266
+ /** The full data array. Sorting and pagination are applied internally. */
267
+ get data() { return this.#data_accessor_storage; }
268
+ set data(value) { this.#data_accessor_storage = value; }
269
+ #pageSize_accessor_storage = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _pageSize_initializers, 10));
270
+ /** Number of rows per page. Set to 0 to disable pagination. */
271
+ get pageSize() { return this.#pageSize_accessor_storage; }
272
+ set pageSize(value) { this.#pageSize_accessor_storage = value; }
273
+ #rowKey_accessor_storage = (__runInitializers(this, _pageSize_extraInitializers), __runInitializers(this, _rowKey_initializers, undefined));
274
+ /** Key function to derive a unique identifier from each row. */
275
+ get rowKey() { return this.#rowKey_accessor_storage; }
276
+ set rowKey(value) { this.#rowKey_accessor_storage = value; }
277
+ #emptyText_accessor_storage = (__runInitializers(this, _rowKey_extraInitializers), __runInitializers(this, _emptyText_initializers, "No results."));
278
+ /** Text shown when the data array is empty. */
279
+ get emptyText() { return this.#emptyText_accessor_storage; }
280
+ set emptyText(value) { this.#emptyText_accessor_storage = value; }
281
+ #sort_accessor_storage = (__runInitializers(this, _emptyText_extraInitializers), __runInitializers(this, _private_sort_initializers, null));
282
+ get #sort() { return _private_sort_descriptor.get.call(this); }
283
+ set #sort(value) { return _private_sort_descriptor.set.call(this, value); }
284
+ #page_accessor_storage = (__runInitializers(this, _private_sort_extraInitializers), __runInitializers(this, _private_page_initializers, 1));
285
+ get #page() { return _private_page_descriptor.get.call(this); }
286
+ set #page(value) { return _private_page_descriptor.set.call(this, value); }
287
+ #displayRows_accessor_storage = (__runInitializers(this, _private_page_extraInitializers), __runInitializers(this, _private_displayRows_initializers, []));
288
+ get #displayRows() { return _private_displayRows_descriptor.get.call(this); }
289
+ set #displayRows(value) { return _private_displayRows_descriptor.set.call(this, value); }
290
+ // ── Lifecycle ──────────────────────────────────────────────────────
291
+ willUpdate(changed) {
292
+ // Recompute display rows when data, sort, page, or pageSize change.
293
+ if (changed.has("data") ||
294
+ changed.has("pageSize") ||
295
+ changed.has("#sort") ||
296
+ changed.has("#page")) {
297
+ // Reset page when data changes.
298
+ if (changed.has("data")) {
299
+ this.#page = 1;
300
+ }
301
+ const sorted = sortData(this.data, this.#sort);
302
+ if (this.pageSize > 0) {
303
+ this.#displayRows = paginateData(sorted, this.#page, this.pageSize);
304
+ }
305
+ else {
306
+ this.#displayRows = sorted;
307
+ }
226
308
  }
227
309
  }
228
- }
229
- // ── Computed ───────────────────────────────────────────────────────
230
- get #totalPages() {
231
- if (this.pageSize <= 0)
232
- return 1;
233
- return Math.max(1, Math.ceil(this.data.length / this.pageSize));
234
- }
235
- get #pageState() {
236
- return {
237
- page: this.#page,
238
- pageSize: this.pageSize,
239
- totalRows: this.data.length,
240
- totalPages: this.#totalPages,
241
- };
242
- }
243
- // ── Sort handling ─────────────────────────────────────────────────
244
- #handleSort(column) {
245
- if (this.#sort?.column === column) {
246
- if (this.#sort.direction === "asc") {
247
- this.#sort = { column, direction: "desc" };
310
+ // ── Computed ───────────────────────────────────────────────────────
311
+ get #totalPages() {
312
+ if (this.pageSize <= 0)
313
+ return 1;
314
+ return Math.max(1, Math.ceil(this.data.length / this.pageSize));
315
+ }
316
+ get #pageState() {
317
+ return {
318
+ page: this.#page,
319
+ pageSize: this.pageSize,
320
+ totalRows: this.data.length,
321
+ totalPages: this.#totalPages,
322
+ };
323
+ }
324
+ // ── Sort handling ─────────────────────────────────────────────────
325
+ #handleSort(column) {
326
+ if (this.#sort?.column === column) {
327
+ if (this.#sort.direction === "asc") {
328
+ this.#sort = { column, direction: "desc" };
329
+ }
330
+ else {
331
+ // desc → clear
332
+ this.#sort = null;
333
+ }
248
334
  }
249
335
  else {
250
- // desc clear
251
- this.#sort = null;
336
+ this.#sort = { column, direction: "asc" };
252
337
  }
338
+ this.#page = 1;
339
+ this.dispatchEvent(sortChangeEvent(this.#sort));
253
340
  }
254
- else {
255
- this.#sort = { column, direction: "asc" };
341
+ // ── Pagination handling ───────────────────────────────────────────
342
+ #goToPage(page) {
343
+ this.#page = Math.max(1, Math.min(page, this.#totalPages));
344
+ this.dispatchEvent(pageChangeEvent(this.#pageState));
256
345
  }
257
- this.#page = 1;
258
- this.dispatchEvent(sortChangeEvent(this.#sort));
259
- }
260
- // ── Pagination handling ───────────────────────────────────────────
261
- #goToPage(page) {
262
- this.#page = Math.max(1, Math.min(page, this.#totalPages));
263
- this.dispatchEvent(pageChangeEvent(this.#pageState));
264
- }
265
- // ── Render ────────────────────────────────────────────────────────
266
- #renderSortIcon(column) {
267
- if (!column.sortable)
268
- return nothing;
269
- if (this.#sort?.column === column.key) {
270
- return html `<span class="SortIcon"
346
+ // ── Render ────────────────────────────────────────────────────────
347
+ #renderSortIcon(column) {
348
+ if (!column.sortable)
349
+ return nothing;
350
+ if (this.#sort?.column === column.key) {
351
+ return html `<span class="SortIcon"
271
352
  >${this.#sort.direction === "asc" ? chevronUp : chevronDown}</span
272
353
  >`;
354
+ }
355
+ return html `<span class="SortIcon">${chevronUpDown}</span>`;
273
356
  }
274
- return html `<span class="SortIcon">${chevronUpDown}</span>`;
275
- }
276
- #renderHeader() {
277
- return html `
357
+ #renderHeader() {
358
+ return html `
278
359
  <thead>
279
360
  <tr>
280
361
  ${this.columns.map((col) => {
281
- const style = col.width ? { width: col.width } : {};
282
- const sortAttr = col.sortable
283
- ? this.#sort?.column === col.key
284
- ? this.#sort.direction === "asc"
285
- ? "ascending"
286
- : "descending"
287
- : "none"
288
- : undefined;
289
- return html `
362
+ const style = col.width ? { width: col.width } : {};
363
+ const sortAttr = col.sortable
364
+ ? this.#sort?.column === col.key
365
+ ? this.#sort.direction === "asc"
366
+ ? "ascending"
367
+ : "descending"
368
+ : "none"
369
+ : undefined;
370
+ return html `
290
371
  <th
291
372
  style=${styleMap(style)}
292
373
  aria-sort=${sortAttr ?? nothing}
293
374
  @click=${col.sortable
294
- ? () => this.#handleSort(col.key)
295
- : nothing}
375
+ ? () => this.#handleSort(col.key)
376
+ : nothing}
296
377
  >
297
378
  <span class="HeaderContent">
298
379
  ${col.header} ${this.#renderSortIcon(col)}
299
380
  </span>
300
381
  </th>
301
382
  `;
302
- })}
383
+ })}
303
384
  </tr>
304
385
  </thead>
305
386
  `;
306
- }
307
- #renderBody() {
308
- if (this.#displayRows.length === 0) {
309
- return html `
387
+ }
388
+ #renderBody() {
389
+ if (this.#displayRows.length === 0) {
390
+ return html `
310
391
  <tbody>
311
392
  <tr class="EmptyRow">
312
393
  <td colspan=${this.columns.length}>${this.emptyText}</td>
313
394
  </tr>
314
395
  </tbody>
315
396
  `;
316
- }
317
- const keyFn = this.rowKey
318
- ? (row, index) => this.rowKey(row)
319
- : (_row, index) => index;
320
- return html `
397
+ }
398
+ const keyFn = this.rowKey
399
+ ? (row, index) => this.rowKey(row)
400
+ : (_row, index) => index;
401
+ return html `
321
402
  <tbody>
322
403
  ${repeat(this.#displayRows, keyFn, (row) => html `
323
404
  <tr>
324
405
  ${this.columns.map((col) => {
325
- const value = row[col.key];
326
- const content = col.render
327
- ? col.render(value, row)
328
- : (value ?? "");
329
- return html `<td>${content}</td>`;
330
- })}
406
+ const value = row[col.key];
407
+ const content = col.render
408
+ ? col.render(value, row)
409
+ : (value ?? "");
410
+ return html `<td>${content}</td>`;
411
+ })}
331
412
  </tr>
332
413
  `)}
333
414
  </tbody>
334
415
  `;
335
- }
336
- #renderPagination() {
337
- if (this.pageSize <= 0 || this.data.length === 0)
338
- return nothing;
339
- const start = (this.#page - 1) * this.pageSize + 1;
340
- const end = Math.min(this.#page * this.pageSize, this.data.length);
341
- const isFirst = this.#page === 1;
342
- const isLast = this.#page === this.#totalPages;
343
- return html `
416
+ }
417
+ #renderPagination() {
418
+ if (this.pageSize <= 0 || this.data.length === 0)
419
+ return nothing;
420
+ const start = (this.#page - 1) * this.pageSize + 1;
421
+ const end = Math.min(this.#page * this.pageSize, this.data.length);
422
+ const isFirst = this.#page === 1;
423
+ const isLast = this.#page === this.#totalPages;
424
+ return html `
344
425
  <div class="Pagination" part="pagination">
345
426
  <div class="PageInfo">
346
427
  <span>${start}-${end} of ${this.data.length}</span>
@@ -381,9 +462,9 @@ export class DuiDataTable extends LitElement {
381
462
  </div>
382
463
  </div>
383
464
  `;
384
- }
385
- render() {
386
- return html `
465
+ }
466
+ render() {
467
+ return html `
387
468
  <div class="DataTable" part="root">
388
469
  <div class="TableWindow" part="table-window">
389
470
  <table part="table">
@@ -393,20 +474,11 @@ export class DuiDataTable extends LitElement {
393
474
  ${this.#renderPagination()}
394
475
  </div>
395
476
  `;
396
- }
397
- }
398
- __decorate([
399
- property({ attribute: false })
400
- ], DuiDataTable.prototype, "columns", null);
401
- __decorate([
402
- property({ attribute: false })
403
- ], DuiDataTable.prototype, "data", null);
404
- __decorate([
405
- property({ type: Number, attribute: "page-size" })
406
- ], DuiDataTable.prototype, "pageSize", null);
407
- __decorate([
408
- property({ attribute: false })
409
- ], DuiDataTable.prototype, "rowKey", null);
410
- __decorate([
411
- property({ attribute: "empty-text" })
412
- ], DuiDataTable.prototype, "emptyText", null);
477
+ }
478
+ constructor() {
479
+ super(...arguments);
480
+ __runInitializers(this, _private_displayRows_extraInitializers);
481
+ }
482
+ };
483
+ })();
484
+ export { DuiDataTable };
@@ -16,8 +16,8 @@ const hostStyles = css `
16
16
  * @slot - Content that closes the dialog (usually a button).
17
17
  */
18
18
  export class DuiDialogClose extends LitElement {
19
- static { this.tagName = "dui-dialog-close"; }
20
- static { this.styles = [base, hostStyles]; }
19
+ static tagName = "dui-dialog-close";
20
+ static styles = [base, hostStyles];
21
21
  #ctx = new ContextConsumer(this, {
22
22
  context: dialogContext,
23
23
  subscribe: true,