@deepfuture/dui-components 0.0.21 → 1.0.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/README.md +56 -65
- package/_install.js +11 -0
- package/accordion/accordion-item.d.ts +3 -20
- package/accordion/accordion-item.js +93 -292
- package/accordion/accordion.d.ts +3 -18
- package/accordion/accordion.js +9 -247
- package/accordion/index.d.ts +6 -6
- package/accordion/index.js +5 -5
- package/alert-dialog/alert-dialog-close.d.ts +3 -14
- package/alert-dialog/alert-dialog-close.js +4 -34
- package/alert-dialog/alert-dialog-popup.d.ts +3 -32
- package/alert-dialog/alert-dialog-popup.js +68 -317
- package/alert-dialog/alert-dialog-trigger.d.ts +3 -14
- package/alert-dialog/alert-dialog-trigger.js +4 -51
- package/alert-dialog/alert-dialog.d.ts +3 -30
- package/alert-dialog/alert-dialog.js +8 -158
- package/alert-dialog/index.d.ts +11 -11
- package/alert-dialog/index.js +9 -9
- package/all.d.ts +159 -123
- package/all.js +134 -231
- package/avatar/avatar.d.ts +3 -39
- package/avatar/avatar.js +18 -238
- package/avatar/index.d.ts +4 -4
- package/avatar/index.js +3 -3
- package/badge/badge.d.ts +3 -10
- package/badge/badge.js +88 -22
- package/badge/index.d.ts +2 -3
- package/badge/index.js +2 -3
- package/breadcrumb/breadcrumb-ellipsis.d.ts +3 -12
- package/breadcrumb/breadcrumb-ellipsis.js +8 -34
- package/breadcrumb/breadcrumb-item.d.ts +3 -11
- package/breadcrumb/breadcrumb-item.js +7 -26
- package/breadcrumb/breadcrumb-link.d.ts +3 -12
- package/breadcrumb/breadcrumb-link.js +16 -26
- package/breadcrumb/breadcrumb-page.d.ts +3 -11
- package/breadcrumb/breadcrumb-page.js +8 -31
- package/breadcrumb/breadcrumb-separator.d.ts +3 -12
- package/breadcrumb/breadcrumb-separator.js +8 -31
- package/breadcrumb/breadcrumb.d.ts +3 -12
- package/breadcrumb/breadcrumb.js +10 -33
- package/breadcrumb/index.d.ts +12 -13
- package/breadcrumb/index.js +12 -13
- package/button/button.d.ts +3 -32
- package/button/button.js +221 -165
- package/button/index.d.ts +3 -3
- package/button/index.js +3 -3
- package/calendar/calendar.d.ts +3 -31
- package/calendar/calendar.js +71 -481
- package/calendar/index.d.ts +3 -3
- package/calendar/index.js +3 -3
- package/card/card.d.ts +3 -27
- package/card/card.js +80 -163
- package/card/index.d.ts +2 -3
- package/card/index.js +2 -3
- package/card-grid/card-grid.d.ts +3 -15
- package/card-grid/card-grid.js +8 -106
- package/card-grid/index.d.ts +2 -3
- package/card-grid/index.js +2 -3
- package/checkbox/checkbox-group.d.ts +3 -34
- package/checkbox/checkbox-group.js +11 -188
- package/checkbox/checkbox.d.ts +3 -47
- package/checkbox/checkbox.js +43 -341
- package/checkbox/index.d.ts +6 -6
- package/checkbox/index.js +5 -5
- package/collapsible/collapsible.d.ts +3 -20
- package/collapsible/collapsible.js +83 -277
- package/collapsible/index.d.ts +3 -3
- package/collapsible/index.js +3 -3
- package/combobox/combobox.d.ts +3 -47
- package/combobox/combobox.js +136 -538
- package/combobox/index.d.ts +4 -4
- package/combobox/index.js +3 -3
- package/command/command-empty.d.ts +3 -8
- package/command/command-empty.js +10 -88
- package/command/command-group.d.ts +3 -13
- package/command/command-group.js +15 -114
- package/command/command-input.d.ts +3 -11
- package/command/command-input.js +20 -136
- package/command/command-item.d.ts +3 -18
- package/command/command-item.js +24 -212
- package/command/command-list.d.ts +3 -7
- package/command/command-list.js +11 -79
- package/command/command-separator.d.ts +3 -5
- package/command/command-separator.js +10 -11
- package/command/command-shortcut.d.ts +3 -5
- package/command/command-shortcut.js +9 -12
- package/command/command.d.ts +3 -23
- package/command/command.js +10 -339
- package/command/index.d.ts +17 -19
- package/command/index.js +16 -18
- package/data-table/data-table.d.ts +3 -57
- package/data-table/data-table.js +86 -449
- package/data-table/index.d.ts +3 -4
- package/data-table/index.js +2 -3
- package/dialog/dialog-close.d.ts +3 -14
- package/dialog/dialog-close.js +4 -34
- package/dialog/dialog-popup.d.ts +3 -34
- package/dialog/dialog-popup.js +70 -336
- package/dialog/dialog-trigger.d.ts +3 -14
- package/dialog/dialog-trigger.js +4 -51
- package/dialog/dialog.d.ts +3 -30
- package/dialog/dialog.js +8 -158
- package/dialog/index.d.ts +11 -11
- package/dialog/index.js +9 -9
- package/dropzone/dropzone.d.ts +3 -72
- package/dropzone/dropzone.js +29 -407
- package/dropzone/index.d.ts +4 -4
- package/dropzone/index.js +3 -3
- package/field/field.d.ts +3 -30
- package/field/field.js +34 -353
- package/field/index.d.ts +1 -0
- package/field/index.js +1 -0
- package/fieldset/fieldset.d.ts +3 -18
- package/fieldset/fieldset.js +21 -110
- package/fieldset/index.d.ts +1 -0
- package/fieldset/index.js +1 -0
- package/icon/icon.d.ts +3 -15
- package/icon/icon.js +4 -33
- package/icon/index.d.ts +2 -3
- package/icon/index.js +2 -3
- package/input/index.d.ts +3 -3
- package/input/index.js +3 -3
- package/input/input.d.ts +3 -49
- package/input/input.js +57 -238
- package/menu/index.d.ts +4 -5
- package/menu/index.js +4 -5
- package/menu/menu-item.d.ts +3 -13
- package/menu/menu-item.js +41 -91
- package/menu/menu.d.ts +3 -15
- package/menu/menu.js +27 -277
- package/menubar/index.d.ts +3 -4
- package/menubar/index.js +2 -3
- package/menubar/menubar.d.ts +3 -19
- package/menubar/menubar.js +12 -183
- package/number-field/index.d.ts +3 -3
- package/number-field/index.js +3 -3
- package/number-field/number-field.d.ts +3 -55
- package/number-field/number-field.js +205 -698
- package/package.json +126 -113
- package/popover/index.d.ts +11 -11
- package/popover/index.js +9 -9
- package/popover/popover-close.d.ts +3 -12
- package/popover/popover-close.js +4 -32
- package/popover/popover-popup.d.ts +3 -18
- package/popover/popover-popup.js +28 -205
- package/popover/popover-trigger.d.ts +3 -13
- package/popover/popover-trigger.js +4 -73
- package/popover/popover.d.ts +3 -29
- package/popover/popover.js +8 -207
- package/portal/index.d.ts +3 -4
- package/portal/index.js +2 -3
- package/portal/portal.d.ts +3 -27
- package/portal/portal.js +8 -157
- package/preview-card/index.d.ts +9 -9
- package/preview-card/index.js +7 -7
- package/preview-card/preview-card-popup.d.ts +3 -14
- package/preview-card/preview-card-popup.js +29 -194
- package/preview-card/preview-card-trigger.d.ts +3 -12
- package/preview-card/preview-card-trigger.js +4 -74
- package/preview-card/preview-card.d.ts +3 -33
- package/preview-card/preview-card.js +8 -239
- package/progress/index.d.ts +2 -3
- package/progress/index.js +2 -3
- package/progress/progress.d.ts +3 -17
- package/progress/progress.js +28 -130
- package/radio/index.d.ts +6 -6
- package/radio/index.js +5 -5
- package/radio/radio-group.d.ts +3 -37
- package/radio/radio-group.js +8 -200
- package/radio/radio.d.ts +3 -28
- package/radio/radio.js +38 -213
- package/scroll-area/index.d.ts +2 -3
- package/scroll-area/index.js +2 -3
- package/scroll-area/scroll-area.d.ts +3 -36
- package/scroll-area/scroll-area.js +25 -535
- package/select/index.d.ts +3 -4
- package/select/index.js +2 -3
- package/select/select.d.ts +3 -39
- package/select/select.js +115 -425
- package/separator/index.d.ts +2 -3
- package/separator/index.js +2 -3
- package/separator/separator.d.ts +3 -10
- package/separator/separator.js +23 -85
- package/sidebar/index.d.ts +29 -29
- package/sidebar/index.js +27 -32
- package/sidebar/sidebar-content.d.ts +3 -12
- package/sidebar/sidebar-content.js +7 -29
- package/sidebar/sidebar-footer.d.ts +3 -10
- package/sidebar/sidebar-footer.js +7 -20
- package/sidebar/sidebar-group-label.d.ts +3 -15
- package/sidebar/sidebar-group-label.js +17 -41
- package/sidebar/sidebar-group.d.ts +3 -13
- package/sidebar/sidebar-group.js +7 -24
- package/sidebar/sidebar-header.d.ts +3 -10
- package/sidebar/sidebar-header.js +7 -16
- package/sidebar/sidebar-inset.d.ts +3 -13
- package/sidebar/sidebar-inset.js +7 -28
- package/sidebar/sidebar-menu-button.d.ts +3 -26
- package/sidebar/sidebar-menu-button.js +60 -217
- package/sidebar/sidebar-menu-item.d.ts +3 -10
- package/sidebar/sidebar-menu-item.js +7 -19
- package/sidebar/sidebar-menu.d.ts +3 -12
- package/sidebar/sidebar-menu.js +7 -25
- package/sidebar/sidebar-provider.d.ts +3 -34
- package/sidebar/sidebar-provider.js +22 -232
- package/sidebar/sidebar-separator.d.ts +3 -10
- package/sidebar/sidebar-separator.js +9 -19
- package/sidebar/sidebar-trigger.d.ts +3 -14
- package/sidebar/sidebar-trigger.js +10 -46
- package/sidebar/sidebar.d.ts +3 -19
- package/sidebar/sidebar.js +65 -262
- package/slider/index.d.ts +3 -3
- package/slider/index.js +3 -3
- package/slider/slider.d.ts +3 -45
- package/slider/slider.js +97 -382
- package/spinner/index.d.ts +2 -3
- package/spinner/index.js +2 -3
- package/spinner/spinner.d.ts +3 -11
- package/spinner/spinner.js +20 -163
- package/split-button/index.d.ts +3 -1
- package/split-button/index.js +3 -1
- package/split-button/split-button.d.ts +3 -33
- package/split-button/split-button.js +307 -394
- package/stepper/index.d.ts +3 -3
- package/stepper/index.js +3 -3
- package/stepper/stepper.d.ts +3 -41
- package/stepper/stepper.js +57 -381
- package/switch/index.d.ts +3 -3
- package/switch/index.js +3 -3
- package/switch/switch.d.ts +3 -30
- package/switch/switch.js +63 -228
- package/tabs/index.d.ts +12 -12
- package/tabs/index.js +11 -11
- package/tabs/tab.d.ts +3 -14
- package/tabs/tab.js +33 -131
- package/tabs/tabs-indicator.d.ts +3 -9
- package/tabs/tabs-indicator.js +17 -22
- package/tabs/tabs-list.d.ts +3 -15
- package/tabs/tabs-list.js +14 -113
- package/tabs/tabs-panel.d.ts +3 -16
- package/tabs/tabs-panel.js +32 -114
- package/tabs/tabs.d.ts +3 -22
- package/tabs/tabs.js +8 -170
- package/textarea/index.d.ts +4 -4
- package/textarea/index.js +3 -3
- package/textarea/textarea.d.ts +3 -36
- package/textarea/textarea.js +63 -220
- package/toggle/index.d.ts +6 -6
- package/toggle/index.js +5 -5
- package/toggle/toggle-group.d.ts +3 -27
- package/toggle/toggle-group.js +9 -224
- package/toggle/toggle.d.ts +3 -26
- package/toggle/toggle.js +94 -178
- package/tokens/properties.css +361 -0
- package/tokens/prose.css +250 -0
- package/tokens/prose.d.ts +2 -0
- package/tokens/prose.js +4 -0
- package/tokens/tokens-raw.d.ts +2 -0
- package/tokens/tokens-raw.js +2 -0
- package/tokens/tokens.css +409 -0
- package/tokens/tokens.d.ts +2 -0
- package/tokens/tokens.js +5 -0
- package/toolbar/index.d.ts +2 -3
- package/toolbar/index.js +2 -3
- package/toolbar/toolbar.d.ts +3 -11
- package/toolbar/toolbar.js +25 -116
- package/tooltip/index.d.ts +9 -9
- package/tooltip/index.js +7 -7
- package/tooltip/tooltip-popup.d.ts +3 -14
- package/tooltip/tooltip-popup.js +32 -185
- package/tooltip/tooltip-trigger.d.ts +3 -14
- package/tooltip/tooltip-trigger.js +5 -148
- package/tooltip/tooltip.d.ts +3 -35
- package/tooltip/tooltip.js +8 -253
- package/trunc/index.d.ts +2 -3
- package/trunc/index.js +2 -3
- package/trunc/trunc.d.ts +3 -17
- package/trunc/trunc.js +10 -108
- package/_deprecated/center/center.d.ts +0 -14
- package/_deprecated/center/center.js +0 -37
- package/_deprecated/center/index.d.ts +0 -3
- package/_deprecated/center/index.js +0 -3
- package/_deprecated/center/register.js +0 -4
- package/_deprecated/hstack/hstack.d.ts +0 -25
- package/_deprecated/hstack/hstack.js +0 -187
- package/_deprecated/hstack/index.d.ts +0 -4
- package/_deprecated/hstack/index.js +0 -3
- package/_deprecated/hstack/register.d.ts +0 -1
- package/_deprecated/hstack/register.js +0 -4
- package/_deprecated/page-inset/index.d.ts +0 -3
- package/_deprecated/page-inset/index.js +0 -3
- package/_deprecated/page-inset/page-inset.d.ts +0 -28
- package/_deprecated/page-inset/page-inset.js +0 -151
- package/_deprecated/page-inset/register.d.ts +0 -1
- package/_deprecated/page-inset/register.js +0 -4
- package/_deprecated/vstack/index.d.ts +0 -3
- package/_deprecated/vstack/index.js +0 -3
- package/_deprecated/vstack/register.d.ts +0 -1
- package/_deprecated/vstack/register.js +0 -4
- package/_deprecated/vstack/vstack.d.ts +0 -17
- package/_deprecated/vstack/vstack.js +0 -125
- package/accordion/accordion-context.d.ts +0 -15
- package/accordion/accordion-context.js +0 -3
- package/alert-dialog/alert-dialog-context.d.ts +0 -13
- package/alert-dialog/alert-dialog-context.js +0 -3
- package/checkbox/checkbox-group-context.d.ts +0 -11
- package/checkbox/checkbox-group-context.js +0 -3
- package/command/command-context.d.ts +0 -30
- package/command/command-context.js +0 -3
- package/command/command-score.d.ts +0 -6
- package/command/command-score.js +0 -31
- package/dialog/dialog-context.d.ts +0 -13
- package/dialog/dialog-context.js +0 -3
- package/global.d.ts +0 -179
- package/menubar/menubar-context.d.ts +0 -9
- package/menubar/menubar-context.js +0 -2
- package/popover/popover-context.d.ts +0 -17
- package/popover/popover-context.js +0 -3
- package/preview-card/preview-card-context.d.ts +0 -16
- package/preview-card/preview-card-context.js +0 -3
- package/radio/radio-group-context.d.ts +0 -11
- package/radio/radio-group-context.js +0 -2
- package/sidebar/sidebar-context.d.ts +0 -15
- package/sidebar/sidebar-context.js +0 -3
- package/split-button/register.d.ts +0 -1
- package/split-button/register.js +0 -4
- package/tabs/tabs-context.d.ts +0 -8
- package/tabs/tabs-context.js +0 -2
- package/toggle/toggle-group-context.d.ts +0 -9
- package/toggle/toggle-group-context.js +0 -2
- package/tooltip/tooltip-context.d.ts +0 -17
- package/tooltip/tooltip-context.js +0 -3
- /package/{_deprecated/center/register.d.ts → _install.d.ts} +0 -0
package/data-table/data-table.js
CHANGED
|
@@ -1,484 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 });
|
|
39
|
-
};
|
|
40
|
-
import { css, html, LitElement, nothing } from "lit";
|
|
41
|
-
import { property, state } from "lit/decorators.js";
|
|
42
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
43
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
44
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
45
|
-
import { customEvent } from "@deepfuture/dui-core/event";
|
|
46
|
-
// ── Events ─────────────────────────────────────────────────────────────
|
|
47
|
-
export const sortChangeEvent = customEvent("sort-change", {
|
|
48
|
-
bubbles: true,
|
|
49
|
-
composed: true,
|
|
50
|
-
});
|
|
51
|
-
export const pageChangeEvent = customEvent("page-change", {
|
|
52
|
-
bubbles: true,
|
|
53
|
-
composed: true,
|
|
54
|
-
});
|
|
55
|
-
// ── Inline SVG sort icons ──────────────────────────────────────────────
|
|
56
|
-
const chevronUpDown = html `<svg
|
|
57
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
58
|
-
width="100%"
|
|
59
|
-
height="100%"
|
|
60
|
-
viewBox="0 0 24 24"
|
|
61
|
-
fill="none"
|
|
62
|
-
stroke="currentColor"
|
|
63
|
-
stroke-width="2"
|
|
64
|
-
stroke-linecap="round"
|
|
65
|
-
stroke-linejoin="round"
|
|
66
|
-
>
|
|
67
|
-
<path d="m7 15 5 5 5-5" />
|
|
68
|
-
<path d="m7 9 5-5 5 5" />
|
|
69
|
-
</svg>`;
|
|
70
|
-
const chevronUp = html `<svg
|
|
71
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
-
width="100%"
|
|
73
|
-
height="100%"
|
|
74
|
-
viewBox="0 0 24 24"
|
|
75
|
-
fill="none"
|
|
76
|
-
stroke="currentColor"
|
|
77
|
-
stroke-width="2"
|
|
78
|
-
stroke-linecap="round"
|
|
79
|
-
stroke-linejoin="round"
|
|
80
|
-
>
|
|
81
|
-
<path d="m18 15-6-6-6 6" />
|
|
82
|
-
</svg>`;
|
|
83
|
-
const chevronDown = html `<svg
|
|
84
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
-
width="100%"
|
|
86
|
-
height="100%"
|
|
87
|
-
viewBox="0 0 24 24"
|
|
88
|
-
fill="none"
|
|
89
|
-
stroke="currentColor"
|
|
90
|
-
stroke-width="2"
|
|
91
|
-
stroke-linecap="round"
|
|
92
|
-
stroke-linejoin="round"
|
|
93
|
-
>
|
|
94
|
-
<path d="m6 9 6 6 6-6" />
|
|
95
|
-
</svg>`;
|
|
96
|
-
// ── Pure helpers ────────────────────────────────────────────────────────
|
|
97
|
-
function compareValues(a, b) {
|
|
98
|
-
if (a == null && b == null)
|
|
99
|
-
return 0;
|
|
100
|
-
if (a == null)
|
|
101
|
-
return -1;
|
|
102
|
-
if (b == null)
|
|
103
|
-
return 1;
|
|
104
|
-
if (typeof a === "number" && typeof b === "number")
|
|
105
|
-
return a - b;
|
|
106
|
-
if (typeof a === "string" && typeof b === "string")
|
|
107
|
-
return a.localeCompare(b);
|
|
108
|
-
if (a instanceof Date && b instanceof Date)
|
|
109
|
-
return a.getTime() - b.getTime();
|
|
110
|
-
return String(a).localeCompare(String(b));
|
|
111
|
-
}
|
|
112
|
-
function sortData(data, sort) {
|
|
113
|
-
if (!sort)
|
|
114
|
-
return [...data];
|
|
115
|
-
const { column, direction } = sort;
|
|
116
|
-
const multiplier = direction === "asc" ? 1 : -1;
|
|
117
|
-
return [...data].sort((a, b) => multiplier * compareValues(a[column], b[column]));
|
|
118
|
-
}
|
|
119
|
-
function paginateData(data, page, pageSize) {
|
|
120
|
-
const start = (page - 1) * pageSize;
|
|
121
|
-
return data.slice(start, start + pageSize);
|
|
122
|
-
}
|
|
123
|
-
// ── Styles ─────────────────────────────────────────────────────────────
|
|
124
|
-
const hostStyles = css `
|
|
125
|
-
:host {
|
|
126
|
-
display: block;
|
|
127
|
-
}
|
|
128
|
-
`;
|
|
129
|
-
const componentStyles = css `
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiDataTablePrimitive } from "@deepfuture/dui-primitives/data-table";
|
|
3
|
+
import "../_install.js";
|
|
4
|
+
const styles = css `
|
|
130
5
|
.DataTable {
|
|
131
|
-
|
|
132
|
-
flex-direction: column;
|
|
6
|
+
gap: var(--space-2);
|
|
133
7
|
}
|
|
134
8
|
|
|
135
9
|
.TableWindow {
|
|
136
|
-
|
|
10
|
+
border: var(--border-width-thin) solid var(--border);
|
|
11
|
+
border-radius: var(--radius-md);
|
|
12
|
+
scrollbar-color: var(--text-2) transparent;
|
|
13
|
+
scrollbar-width: thin;
|
|
137
14
|
}
|
|
138
15
|
|
|
139
16
|
table {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
thead {
|
|
145
|
-
position: sticky;
|
|
146
|
-
top: 0;
|
|
147
|
-
z-index: 1;
|
|
17
|
+
font-family: var(--font-sans);
|
|
18
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
19
|
+
text-box: trim-both cap alphabetic;
|
|
148
20
|
}
|
|
149
21
|
|
|
150
22
|
th {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
23
|
+
height: var(--component-height-lg);
|
|
24
|
+
padding: 0 var(--space-3);
|
|
25
|
+
font-weight: var(--font-weight-medium);
|
|
26
|
+
font-size: var(--text-xs); line-height: var(--text-xs--line-height);
|
|
27
|
+
text-box: trim-both cap alphabetic;
|
|
28
|
+
color: var(--text-2);
|
|
29
|
+
background: var(--surface-1);
|
|
30
|
+
border-bottom: var(--border-width-thin) solid var(--border);
|
|
154
31
|
}
|
|
155
32
|
|
|
156
|
-
th[aria-sort] {
|
|
157
|
-
|
|
33
|
+
th[aria-sort]:hover {
|
|
34
|
+
color: var(--text-1);
|
|
158
35
|
}
|
|
159
36
|
|
|
160
37
|
.HeaderContent {
|
|
161
|
-
|
|
162
|
-
align-items: center;
|
|
38
|
+
gap: var(--space-1);
|
|
163
39
|
}
|
|
164
40
|
|
|
165
41
|
.SortIcon {
|
|
166
|
-
|
|
167
|
-
|
|
42
|
+
width: var(--space-3_5);
|
|
43
|
+
height: var(--space-3_5);
|
|
44
|
+
opacity: 0.4;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
th[aria-sort="ascending"] .SortIcon,
|
|
48
|
+
th[aria-sort="descending"] .SortIcon {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
color: var(--text-1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
tbody tr {
|
|
54
|
+
border-bottom: var(--border-width-thin) solid var(--border);
|
|
55
|
+
transition-property: background, filter, transform;
|
|
56
|
+
transition-duration: var(--duration-fast);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tbody tr:last-child {
|
|
60
|
+
border-bottom: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
tbody tr:hover {
|
|
64
|
+
background: var(--surface-1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
td {
|
|
68
|
+
padding: var(--space-2) var(--space-3);
|
|
69
|
+
vertical-align: middle;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.EmptyRow td {
|
|
73
|
+
height: var(--space-24);
|
|
74
|
+
text-align: center;
|
|
75
|
+
color: var(--text-2);
|
|
168
76
|
}
|
|
169
77
|
|
|
170
78
|
.Pagination {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
79
|
+
padding: 0 var(--space-1);
|
|
80
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
81
|
+
color: var(--text-2);
|
|
174
82
|
}
|
|
175
83
|
|
|
176
84
|
.PageInfo {
|
|
177
|
-
|
|
178
|
-
align-items: center;
|
|
85
|
+
gap: var(--space-1);
|
|
179
86
|
}
|
|
180
87
|
|
|
181
88
|
.PageControls {
|
|
182
|
-
|
|
183
|
-
align-items: center;
|
|
89
|
+
gap: var(--space-1);
|
|
184
90
|
}
|
|
185
91
|
|
|
186
92
|
.PageButton {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
93
|
+
width: var(--component-height-sm);
|
|
94
|
+
height: var(--component-height-sm);
|
|
95
|
+
border: var(--border-width-thin) solid var(--border);
|
|
96
|
+
border-radius: var(--radius-md);
|
|
97
|
+
color: var(--text-1);
|
|
98
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
99
|
+
transition-property: background;
|
|
100
|
+
transition-duration: var(--duration-fast);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.PageButton:hover:not(:disabled) {
|
|
104
|
+
background: var(--surface-1);
|
|
193
105
|
}
|
|
194
106
|
|
|
195
107
|
.PageButton:disabled {
|
|
196
|
-
|
|
108
|
+
opacity: 0.4;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.PageButton:focus-visible {
|
|
112
|
+
outline: none;
|
|
113
|
+
box-shadow:
|
|
114
|
+
0 0 0 var(--focus-ring-offset) var(--background),
|
|
115
|
+
0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);
|
|
197
116
|
}
|
|
198
117
|
`;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
* Accepts column definitions and row data, with optional sorting and
|
|
204
|
-
* pagination. Cells can be customized via column `render` functions.
|
|
205
|
-
*
|
|
206
|
-
* @fires sort-change - Fired when a sortable column header is clicked. Detail: SortState
|
|
207
|
-
* @fires page-change - Fired when the page changes. Detail: PageState
|
|
208
|
-
*/
|
|
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
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
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
|
-
}
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
this.#sort = { column, direction: "asc" };
|
|
337
|
-
}
|
|
338
|
-
this.#page = 1;
|
|
339
|
-
this.dispatchEvent(sortChangeEvent(this.#sort));
|
|
340
|
-
}
|
|
341
|
-
// ── Pagination handling ───────────────────────────────────────────
|
|
342
|
-
#goToPage(page) {
|
|
343
|
-
this.#page = Math.max(1, Math.min(page, this.#totalPages));
|
|
344
|
-
this.dispatchEvent(pageChangeEvent(this.#pageState));
|
|
345
|
-
}
|
|
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"
|
|
352
|
-
>${this.#sort.direction === "asc" ? chevronUp : chevronDown}</span
|
|
353
|
-
>`;
|
|
354
|
-
}
|
|
355
|
-
return html `<span class="SortIcon">${chevronUpDown}</span>`;
|
|
356
|
-
}
|
|
357
|
-
#renderHeader() {
|
|
358
|
-
return html `
|
|
359
|
-
<thead>
|
|
360
|
-
<tr>
|
|
361
|
-
${this.columns.map((col) => {
|
|
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 `
|
|
371
|
-
<th
|
|
372
|
-
style=${styleMap(style)}
|
|
373
|
-
aria-sort=${sortAttr ?? nothing}
|
|
374
|
-
@click=${col.sortable
|
|
375
|
-
? () => this.#handleSort(col.key)
|
|
376
|
-
: nothing}
|
|
377
|
-
>
|
|
378
|
-
<span class="HeaderContent">
|
|
379
|
-
${col.header} ${this.#renderSortIcon(col)}
|
|
380
|
-
</span>
|
|
381
|
-
</th>
|
|
382
|
-
`;
|
|
383
|
-
})}
|
|
384
|
-
</tr>
|
|
385
|
-
</thead>
|
|
386
|
-
`;
|
|
387
|
-
}
|
|
388
|
-
#renderBody() {
|
|
389
|
-
if (this.#displayRows.length === 0) {
|
|
390
|
-
return html `
|
|
391
|
-
<tbody>
|
|
392
|
-
<tr class="EmptyRow">
|
|
393
|
-
<td colspan=${this.columns.length}>${this.emptyText}</td>
|
|
394
|
-
</tr>
|
|
395
|
-
</tbody>
|
|
396
|
-
`;
|
|
397
|
-
}
|
|
398
|
-
const keyFn = this.rowKey
|
|
399
|
-
? (row, index) => this.rowKey(row)
|
|
400
|
-
: (_row, index) => index;
|
|
401
|
-
return html `
|
|
402
|
-
<tbody>
|
|
403
|
-
${repeat(this.#displayRows, keyFn, (row) => html `
|
|
404
|
-
<tr>
|
|
405
|
-
${this.columns.map((col) => {
|
|
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
|
-
})}
|
|
412
|
-
</tr>
|
|
413
|
-
`)}
|
|
414
|
-
</tbody>
|
|
415
|
-
`;
|
|
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 `
|
|
425
|
-
<div class="Pagination" part="pagination">
|
|
426
|
-
<div class="PageInfo">
|
|
427
|
-
<span>${start}-${end} of ${this.data.length}</span>
|
|
428
|
-
</div>
|
|
429
|
-
<div class="PageControls">
|
|
430
|
-
<button
|
|
431
|
-
class="PageButton"
|
|
432
|
-
?disabled=${isFirst}
|
|
433
|
-
@click=${() => this.#goToPage(1)}
|
|
434
|
-
aria-label="First page"
|
|
435
|
-
>
|
|
436
|
-
<dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m11 17-5-5 5-5"/><path d="m18 17-5-5 5-5"/></svg></dui-icon>
|
|
437
|
-
</button>
|
|
438
|
-
<button
|
|
439
|
-
class="PageButton"
|
|
440
|
-
?disabled=${isFirst}
|
|
441
|
-
@click=${() => this.#goToPage(this.#page - 1)}
|
|
442
|
-
aria-label="Previous page"
|
|
443
|
-
>
|
|
444
|
-
<dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg></dui-icon>
|
|
445
|
-
</button>
|
|
446
|
-
<button
|
|
447
|
-
class="PageButton"
|
|
448
|
-
?disabled=${isLast}
|
|
449
|
-
@click=${() => this.#goToPage(this.#page + 1)}
|
|
450
|
-
aria-label="Next page"
|
|
451
|
-
>
|
|
452
|
-
<dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg></dui-icon>
|
|
453
|
-
</button>
|
|
454
|
-
<button
|
|
455
|
-
class="PageButton"
|
|
456
|
-
?disabled=${isLast}
|
|
457
|
-
@click=${() => this.#goToPage(this.#totalPages)}
|
|
458
|
-
aria-label="Last page"
|
|
459
|
-
>
|
|
460
|
-
<dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 17 5-5-5-5"/><path d="m13 17 5-5-5-5"/></svg></dui-icon>
|
|
461
|
-
</button>
|
|
462
|
-
</div>
|
|
463
|
-
</div>
|
|
464
|
-
`;
|
|
465
|
-
}
|
|
466
|
-
render() {
|
|
467
|
-
return html `
|
|
468
|
-
<div class="DataTable" part="root">
|
|
469
|
-
<div class="TableWindow" part="table-window">
|
|
470
|
-
<table part="table">
|
|
471
|
-
${this.#renderHeader()} ${this.#renderBody()}
|
|
472
|
-
</table>
|
|
473
|
-
</div>
|
|
474
|
-
${this.#renderPagination()}
|
|
475
|
-
</div>
|
|
476
|
-
`;
|
|
477
|
-
}
|
|
478
|
-
constructor() {
|
|
479
|
-
super(...arguments);
|
|
480
|
-
__runInitializers(this, _private_displayRows_extraInitializers);
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
})();
|
|
484
|
-
export { DuiDataTable };
|
|
118
|
+
export class DuiDataTable extends DuiDataTablePrimitive {
|
|
119
|
+
static styles = [...DuiDataTablePrimitive.styles, styles];
|
|
120
|
+
}
|
|
121
|
+
customElements.define(DuiDataTable.tagName, DuiDataTable);
|
package/data-table/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { DuiDataTable };
|
|
3
|
-
export type { ColumnDef, SortDirection, SortState, PageState } from "
|
|
4
|
-
export declare const dataTableFamily: (typeof DuiDataTable)[];
|
|
1
|
+
import "./data-table.js";
|
|
2
|
+
export { DuiDataTable } from "./data-table.js";
|
|
3
|
+
export type { ColumnDef, SortDirection, SortState, PageState } from "@deepfuture/dui-primitives/data-table";
|
package/data-table/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { DuiDataTable };
|
|
3
|
-
export const dataTableFamily = [DuiDataTable];
|
|
1
|
+
import "./data-table.js";
|
|
2
|
+
export { DuiDataTable } from "./data-table.js";
|
package/dialog/dialog-close.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
* `<dui-dialog-close>` — A close button wrapper for the dialog.
|
|
5
|
-
*
|
|
6
|
-
* Wraps slotted content and closes the dialog on click.
|
|
7
|
-
*
|
|
8
|
-
* @slot - Content that closes the dialog (usually a button).
|
|
9
|
-
*/
|
|
10
|
-
export declare class DuiDialogClose extends LitElement {
|
|
11
|
-
#private;
|
|
12
|
-
static tagName: "dui-dialog-close";
|
|
13
|
-
static styles: import("lit").CSSResult[];
|
|
14
|
-
render(): TemplateResult;
|
|
1
|
+
import { DuiDialogClosePrimitive } from "@deepfuture/dui-primitives/dialog";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiDialogClose extends DuiDialogClosePrimitive {
|
|
15
4
|
}
|
package/dialog/dialog-close.js
CHANGED
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
5
|
-
import { dialogContext } from "./dialog-context.js";
|
|
6
|
-
const hostStyles = css `
|
|
7
|
-
:host {
|
|
8
|
-
display: contents;
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
/**
|
|
12
|
-
* `<dui-dialog-close>` — A close button wrapper for the dialog.
|
|
13
|
-
*
|
|
14
|
-
* Wraps slotted content and closes the dialog on click.
|
|
15
|
-
*
|
|
16
|
-
* @slot - Content that closes the dialog (usually a button).
|
|
17
|
-
*/
|
|
18
|
-
export class DuiDialogClose extends LitElement {
|
|
19
|
-
static tagName = "dui-dialog-close";
|
|
20
|
-
static styles = [base, hostStyles];
|
|
21
|
-
#ctx = new ContextConsumer(this, {
|
|
22
|
-
context: dialogContext,
|
|
23
|
-
subscribe: true,
|
|
24
|
-
});
|
|
25
|
-
#handleClick = () => {
|
|
26
|
-
this.#ctx.value?.closeDialog();
|
|
27
|
-
};
|
|
28
|
-
render() {
|
|
29
|
-
return html `
|
|
30
|
-
<span @click="${this.#handleClick}">
|
|
31
|
-
<slot></slot>
|
|
32
|
-
</span>
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
1
|
+
import { DuiDialogClosePrimitive } from "@deepfuture/dui-primitives/dialog";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export class DuiDialogClose extends DuiDialogClosePrimitive {
|
|
35
4
|
}
|
|
5
|
+
customElements.define(DuiDialogClose.tagName, DuiDialogClose);
|