@editora/ui-core 0.1.25 → 0.2.1
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 +132 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +92 -53
- package/dist/alert-dialog.esm.js +211 -159
- package/dist/alert.cjs.js +42 -33
- package/dist/alert.esm.js +80 -71
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +9 -9
- package/dist/animated-text.esm.js +9 -9
- package/dist/app-header.cjs.js +17 -12
- package/dist/app-header.esm.js +18 -13
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +16 -20
- package/dist/avatar.esm.js +16 -20
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-D-mXMgqc.js → calendar-CzpWDxLc.js} +56 -46
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DkSDFg33.mjs} +127 -117
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +58 -52
- package/dist/chart.esm.js +101 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +9 -13
- package/dist/collapsible.esm.js +9 -13
- package/dist/color-picker.cjs.js +38 -19
- package/dist/color-picker.esm.js +134 -115
- package/dist/combobox.cjs.js +60 -57
- package/dist/combobox.esm.js +96 -92
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-chart.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +21 -18
- package/dist/data-table.esm.js +210 -190
- package/dist/date-field.cjs.js +9 -9
- package/dist/date-field.esm.js +19 -19
- package/dist/date-picker.cjs.js +29 -20
- package/dist/date-picker.esm.js +59 -50
- package/dist/date-range-picker.cjs.js +24 -19
- package/dist/date-range-picker.esm.js +86 -81
- package/dist/date-range-time-picker.cjs.js +27 -20
- package/dist/date-range-time-picker.esm.js +24 -17
- package/dist/date-time-picker.cjs.js +24 -17
- package/dist/date-time-picker.esm.js +89 -82
- package/dist/date-time-utils-C-4eHTyy.js +1 -0
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-zAx4ghvC.mjs} +75 -68
- package/dist/description.cjs.js +4 -4
- package/dist/description.esm.js +4 -4
- package/dist/dialog.cjs.js +59 -43
- package/dist/dialog.esm.js +86 -53
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +7 -7
- package/dist/field.cjs.js +23 -14
- package/dist/field.esm.js +30 -21
- package/dist/fieldset.cjs.js +16 -9
- package/dist/fieldset.esm.js +19 -12
- package/dist/file-upload.cjs.js +79 -37
- package/dist/file-upload.esm.js +154 -112
- package/dist/flex.cjs.js +2 -2
- package/dist/flex.esm.js +8 -8
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +24 -27
- package/dist/form.esm.js +24 -27
- package/dist/gantt.cjs.js +13 -11
- package/dist/gantt.esm.js +13 -11
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +8 -8
- package/dist/hover-card.esm.js +18 -15
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +50 -22
- package/dist/inline-edit.esm.js +77 -49
- package/dist/input.cjs.js +45 -38
- package/dist/input.esm.js +60 -53
- package/dist/label.cjs.js +6 -6
- package/dist/label.esm.js +6 -6
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/masonry-grid.cjs.js +2 -2
- package/dist/masonry-grid.esm.js +11 -11
- package/dist/{menu-item-styles-IGSFLAHu.mjs → menu-item-styles-CdqxPUuw.mjs} +15 -15
- package/dist/{menu-item-styles-B4onAr4C.js → menu-item-styles-DUdyjQ7i.js} +10 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +53 -40
- package/dist/multi-select.esm.js +87 -73
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +28 -17
- package/dist/number-field.esm.js +37 -26
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +10 -10
- package/dist/odometer.cjs.js +9 -9
- package/dist/odometer.esm.js +17 -17
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +39 -34
- package/dist/password-field.esm.js +63 -58
- package/dist/pin-input.cjs.js +18 -14
- package/dist/pin-input.esm.js +24 -20
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +14 -14
- package/dist/quick-actions.esm.js +12 -12
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +16 -13
- package/dist/radio.esm.js +16 -13
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-BRT7E4A8.mjs} +563 -531
- package/dist/runtime-CXw4SGV9.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +42 -75
- package/dist/select.esm.js +57 -89
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/separator.cjs.js +6 -6
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +29 -28
- package/dist/sidebar.esm.js +32 -31
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/sortable.cjs.js +10 -11
- package/dist/sortable.esm.js +10 -11
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +7 -7
- package/dist/split-button.esm.js +17 -16
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +101 -26
- package/dist/tabs.esm.js +187 -112
- package/dist/tags-input.cjs.js +43 -17
- package/dist/tags-input.esm.js +75 -49
- package/dist/textarea.cjs.js +34 -35
- package/dist/textarea.esm.js +50 -51
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +8 -8
- package/dist/time-field.esm.js +29 -29
- package/dist/time-picker.cjs.js +17 -14
- package/dist/time-picker.esm.js +28 -25
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +2 -2
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +37 -38
- package/dist/transfer-list.esm.js +32 -33
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +51 -39
- package/dist/wizard.esm.js +51 -39
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/context-menu.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { E } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
-
import { b as A } from "./portal-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { b as A } from "./portal-DeaM1tYY.mjs";
|
|
3
|
+
import { o as S } from "./overlay-motion-BX3dPLay.mjs";
|
|
4
|
+
import { c as P } from "./dismissable-layer-BmPIoK80.mjs";
|
|
5
|
+
import { e as w } from "./positioner-BE8Nbho2.mjs";
|
|
6
|
+
import { c as O } from "./menu-item-styles-CdqxPUuw.mjs";
|
|
6
7
|
import "./listbox-hMVOhKHC.mjs";
|
|
7
8
|
const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [data-menu-item]', b = [
|
|
8
9
|
":scope > .menuitem",
|
|
@@ -10,7 +11,7 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
10
11
|
':scope > [role="menuitemcheckbox"]',
|
|
11
12
|
':scope > [role="menuitemradio"]',
|
|
12
13
|
":scope > [data-menu-item]"
|
|
13
|
-
].join(", "),
|
|
14
|
+
].join(", "), L = ":scope > .submenu", a = 8, R = 6, C = 420, I = 110, k = [
|
|
14
15
|
"--ui-color-primary",
|
|
15
16
|
"--ui-color-primary-hover",
|
|
16
17
|
"--ui-color-foreground-on-primary",
|
|
@@ -45,7 +46,7 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
45
46
|
"--accent-surface",
|
|
46
47
|
"--accent-indicator",
|
|
47
48
|
"--accent-track"
|
|
48
|
-
],
|
|
49
|
+
], T = [
|
|
49
50
|
{ prefix: "--accent-", from: 1, to: 12 },
|
|
50
51
|
{ prefix: "--accent-a", from: 1, to: 12 },
|
|
51
52
|
{ prefix: "--gray-", from: 1, to: 12 },
|
|
@@ -54,7 +55,7 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
54
55
|
{ prefix: "--white-a", from: 1, to: 12 },
|
|
55
56
|
{ prefix: "--shadow-", from: 1, to: 6 },
|
|
56
57
|
{ prefix: "--radius-", from: 1, to: 6 }
|
|
57
|
-
],
|
|
58
|
+
], z = [
|
|
58
59
|
"--base-context-menu-bg",
|
|
59
60
|
"--base-context-menu-radius",
|
|
60
61
|
"--base-context-menu-shadow",
|
|
@@ -82,7 +83,7 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
82
83
|
--ui-context-menu-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
83
84
|
--ui-context-menu-border-color: color-mix(in srgb, var(--ui-color-border, var(--ui-border, #cbd5e1)) 86%, transparent);
|
|
84
85
|
--ui-context-menu-border: 1px solid var(--ui-context-menu-border-color);
|
|
85
|
-
--ui-context-menu-radius: var(--base-context-menu-radius, var(--ui-radius,
|
|
86
|
+
--ui-context-menu-radius: var(--base-context-menu-radius, var(--ui-radius, 6px));
|
|
86
87
|
--ui-context-menu-shadow: var(--base-context-menu-shadow, var(--shadow-5));
|
|
87
88
|
--ui-context-menu-min-width: var(--base-context-menu-min-width, 240px);
|
|
88
89
|
--ui-context-menu-padding: var(--base-context-menu-padding, 6px);
|
|
@@ -358,7 +359,7 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
358
359
|
flex-direction: column;
|
|
359
360
|
gap: 0;
|
|
360
361
|
}
|
|
361
|
-
${
|
|
362
|
+
${O({
|
|
362
363
|
scopes: ['ui-context-menu [slot="menu"]', 'ui-context-menu [slot="content"]'],
|
|
363
364
|
prefix: "--ui-context-menu",
|
|
364
365
|
itemSelectors: [".menuitem", '[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]', "[data-menu-item]"],
|
|
@@ -413,39 +414,39 @@ const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
413
414
|
bottom: -6px;
|
|
414
415
|
}
|
|
415
416
|
`;
|
|
416
|
-
function
|
|
417
|
+
function B() {
|
|
417
418
|
if (typeof document > "u") return;
|
|
418
419
|
const s = "ui-context-menu-light-dom-style";
|
|
419
420
|
if (document.getElementById(s)) return;
|
|
420
421
|
const t = document.createElement("style");
|
|
421
422
|
t.id = s, t.textContent = v, document.head.appendChild(t);
|
|
422
423
|
}
|
|
423
|
-
function
|
|
424
|
+
function F(s, t) {
|
|
424
425
|
return s.replace(/(^|})\s*([^@}{][^{}]*)\{/g, (e, i, o) => {
|
|
425
426
|
const n = o.split(",").map((r) => r.trim()).filter(Boolean).map((r) => r.startsWith(t) ? r : `${t} ${r}`).join(", ");
|
|
426
427
|
return `${i}
|
|
427
428
|
${n} {`;
|
|
428
429
|
});
|
|
429
430
|
}
|
|
430
|
-
function
|
|
431
|
+
function H(s) {
|
|
431
432
|
const t = s.replace(/:host\(\[([a-z-]+)(?:="([^"]+)")?\]\)/g, (e, i, o) => o != null ? `.ui-context-menu-portal[data-${i}="${o}"]` : `.ui-context-menu-portal[data-${i}="true"]`).replace(/:host/g, ".ui-context-menu-portal");
|
|
432
|
-
return
|
|
433
|
+
return F(t, ".ui-context-menu-portal");
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
+
function D(s) {
|
|
435
436
|
return s.replace(/(^|,)\s*ui-context-menu\b/gm, (t, e) => `${e} .ui-context-menu-portal`);
|
|
436
437
|
}
|
|
437
|
-
const
|
|
438
|
-
${
|
|
439
|
-
function
|
|
438
|
+
const M = `${H(g)}
|
|
439
|
+
${D(v)}`;
|
|
440
|
+
function q(s) {
|
|
440
441
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
441
442
|
}
|
|
442
|
-
function
|
|
443
|
+
function $(s, t) {
|
|
443
444
|
return typeof s == "number" ? { x: s, y: typeof t == "number" ? t : 0 } : s;
|
|
444
445
|
}
|
|
445
|
-
function
|
|
446
|
+
function V(s) {
|
|
446
447
|
return s === "top" || s === "left" || s === "right" ? s : "bottom";
|
|
447
448
|
}
|
|
448
|
-
function
|
|
449
|
+
function N(s) {
|
|
449
450
|
return `${s}-start`;
|
|
450
451
|
}
|
|
451
452
|
function _(s) {
|
|
@@ -458,12 +459,12 @@ function y(s) {
|
|
|
458
459
|
const t = s.trim().toLowerCase();
|
|
459
460
|
return t ? t === "none" ? "0px" : t === "sm" ? "8px" : t === "md" ? "12px" : t === "lg" ? "16px" : t === "full" ? "999px" : t === "square" ? "6px" : t === "soft" ? "16px" : /^\d+(\.\d+)?$/.test(t) ? `${t}px` : s : "";
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
+
function W(s) {
|
|
462
463
|
if (!s.isConnected || s.hidden) return !1;
|
|
463
464
|
const t = window.getComputedStyle(s);
|
|
464
465
|
return !(t.display === "none" || t.visibility === "hidden");
|
|
465
466
|
}
|
|
466
|
-
function
|
|
467
|
+
function G(s) {
|
|
467
468
|
if (!s.isConnected) return !1;
|
|
468
469
|
const t = window.getComputedStyle(s);
|
|
469
470
|
if (t.display === "none" || t.visibility === "hidden") return !1;
|
|
@@ -476,13 +477,13 @@ function x(s) {
|
|
|
476
477
|
const t = s.getAttribute("aria-disabled");
|
|
477
478
|
return s.hasAttribute("disabled") || t === "true" || s.disabled === !0;
|
|
478
479
|
}
|
|
479
|
-
function
|
|
480
|
+
function U(s) {
|
|
480
481
|
for (const t of s)
|
|
481
482
|
if (t instanceof HTMLElement && t.matches(l))
|
|
482
483
|
return t;
|
|
483
484
|
return null;
|
|
484
485
|
}
|
|
485
|
-
class
|
|
486
|
+
class K extends E {
|
|
486
487
|
constructor() {
|
|
487
488
|
super(), this._isOpen = !1, this._anchorEl = null, this._point = { x: 0, y: 0 }, this._restoreFocusEl = null, this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._dismissableLayer = null, this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._contentAnchor = null, this._contentSourceEl = null, this._contentOriginalParent = null, this._positionRaf = null, this._submenuRaf = null, this._anchorTrackRaf = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._submenuIntentTimer = null, this._submenuIntentItem = null, this._hoveredItem = null, this._lastAnchorRect = null, this._resizeListenerBound = !1, this._scrollListenerBound = !1, this._nextOpenSource = "attribute", this._onRootClick = this._onRootClick.bind(this), this._onRootKeyDown = this._onRootKeyDown.bind(this), this._onRootPointerOver = this._onRootPointerOver.bind(this), this._onRootPointerLeave = this._onRootPointerLeave.bind(this), this._onRootFocusIn = this._onRootFocusIn.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onViewportChange = this._onViewportChange.bind(this), this._trackAnchorLayout = this._trackAnchorLayout.bind(this);
|
|
488
489
|
}
|
|
@@ -507,7 +508,7 @@ class U extends E {
|
|
|
507
508
|
];
|
|
508
509
|
}
|
|
509
510
|
connectedCallback() {
|
|
510
|
-
super.connectedCallback(),
|
|
511
|
+
super.connectedCallback(), B(), this.addEventListener("contextmenu", this._onContextMenu), this._syncVisualState(), this._syncOpenState();
|
|
511
512
|
}
|
|
512
513
|
disconnectedCallback() {
|
|
513
514
|
this.removeEventListener("contextmenu", this._onContextMenu), this._unbindGlobalListeners(), this._cancelScheduledWork(), this._teardownPortal(), super.disconnectedCallback();
|
|
@@ -582,7 +583,7 @@ class U extends E {
|
|
|
582
583
|
}
|
|
583
584
|
openAt(t, e) {
|
|
584
585
|
if (!(this.headless || this.isDisabled)) {
|
|
585
|
-
if (this._anchorEl = null, this._point =
|
|
586
|
+
if (this._anchorEl = null, this._point = $(t, e), this._isOpen) {
|
|
586
587
|
this._syncGlobalListeners(!0), this._syncDismissableLayer(), this._schedulePosition(), this._scheduleSubmenuLayout();
|
|
587
588
|
return;
|
|
588
589
|
}
|
|
@@ -695,7 +696,7 @@ class U extends E {
|
|
|
695
696
|
const o = t.getPropertyValue(i).trim();
|
|
696
697
|
o ? this._portalEl.style.setProperty(i, o) : this._portalEl.style.removeProperty(i);
|
|
697
698
|
};
|
|
698
|
-
|
|
699
|
+
k.forEach(e), z.forEach(e), T.forEach(({ prefix: i, from: o, to: n }) => {
|
|
699
700
|
for (let r = o; r <= n; r += 1) e(`${i}${r}`);
|
|
700
701
|
});
|
|
701
702
|
}
|
|
@@ -725,12 +726,12 @@ class U extends E {
|
|
|
725
726
|
if (!t) return;
|
|
726
727
|
const e = document.createElement("div");
|
|
727
728
|
e.className = "ui-context-menu-portal", e.style.position = "absolute", e.style.pointerEvents = "auto", e.innerHTML = `
|
|
728
|
-
<style>${
|
|
729
|
+
<style>${M}</style>
|
|
729
730
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
730
731
|
<div class="state-row" part="state"></div>
|
|
731
732
|
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${l.replace(/"/g, """)}" direct-item-selector="${b.replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active"></ui-listbox>
|
|
732
733
|
</div>
|
|
733
|
-
`, t.appendChild(e), this._portalEl = e, this._portalSurfaceEl = e.querySelector(".surface"), this._portalContentHostEl = e.querySelector("ui-listbox.content-host"), this._moveContentIntoPortal(), this._portalContentHostEl?.refresh(), this._syncPortalVisualState(), this._syncSurfaceState(), this._bindPortalInteractionListeners(), this._syncDismissableLayer();
|
|
734
|
+
`, t.appendChild(e), this._portalEl = e, this._portalSurfaceEl = e.querySelector(".surface"), this._portalContentHostEl = e.querySelector("ui-listbox.content-host"), this._portalSurfaceEl && S(this._portalSurfaceEl, { animate: !1 }), this._moveContentIntoPortal(), this._portalContentHostEl?.refresh(), this._syncPortalVisualState(), this._syncSurfaceState(), this._bindPortalInteractionListeners(), this._syncDismissableLayer();
|
|
734
735
|
}
|
|
735
736
|
_teardownPortal() {
|
|
736
737
|
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._positioner?.destroy(), this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._unbindPortalInteractionListeners(), this._restoreContentFromPortal(), this._portalContentHostEl = null, this._portalSurfaceEl = null, this._portalEl?.parentElement)
|
|
@@ -746,7 +747,7 @@ class U extends E {
|
|
|
746
747
|
this._dismissableLayer?.destroy(), this._dismissableLayer = null;
|
|
747
748
|
return;
|
|
748
749
|
}
|
|
749
|
-
this._dismissableLayer?.destroy(), this._dismissableLayer =
|
|
750
|
+
this._dismissableLayer?.destroy(), this._dismissableLayer = P({
|
|
750
751
|
node: t,
|
|
751
752
|
trigger: this._anchorEl || this,
|
|
752
753
|
closeOnEscape: this.closeOnEscape,
|
|
@@ -792,7 +793,7 @@ class U extends E {
|
|
|
792
793
|
};
|
|
793
794
|
}
|
|
794
795
|
_rebuildPositioner(t, e, i) {
|
|
795
|
-
this._positioner?.destroy(), this._positioner =
|
|
796
|
+
this._positioner?.destroy(), this._positioner = w({
|
|
796
797
|
anchor: this._anchorEl || this._pointVirtualAnchor(),
|
|
797
798
|
floating: t,
|
|
798
799
|
placement: e,
|
|
@@ -838,10 +839,10 @@ class U extends E {
|
|
|
838
839
|
}
|
|
839
840
|
_queryMenuItems(t) {
|
|
840
841
|
const e = t || this._menuHost();
|
|
841
|
-
return e ? (this._listbox()?.queryItems({ container: e }) || []).filter((i) =>
|
|
842
|
+
return e ? (this._listbox()?.queryItems({ container: e }) || []).filter((i) => W(i)) : [];
|
|
842
843
|
}
|
|
843
844
|
_submenuFor(t) {
|
|
844
|
-
return t.querySelector(
|
|
845
|
+
return t.querySelector(L);
|
|
845
846
|
}
|
|
846
847
|
_clearHighlights() {
|
|
847
848
|
this._hoveredItem = null;
|
|
@@ -887,7 +888,7 @@ class U extends E {
|
|
|
887
888
|
}
|
|
888
889
|
_findCurrentItem(t) {
|
|
889
890
|
if (t && typeof t.composedPath == "function") {
|
|
890
|
-
const i =
|
|
891
|
+
const i = U(t.composedPath());
|
|
891
892
|
if (i) return i;
|
|
892
893
|
}
|
|
893
894
|
const e = document.activeElement;
|
|
@@ -971,7 +972,7 @@ class U extends E {
|
|
|
971
972
|
if (!this.typeahead || t.ctrlKey || t.altKey || t.metaKey || t.key.length !== 1 || !/\S/.test(t.key)) return !1;
|
|
972
973
|
const i = e?.closest(".submenu") || this._menuHost();
|
|
973
974
|
if (!i) return !1;
|
|
974
|
-
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key}`.slice(-24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(),
|
|
975
|
+
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key}`.slice(-24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), C);
|
|
975
976
|
const o = this._listbox()?.typeahead(this._typeaheadBuffer, {
|
|
976
977
|
container: i,
|
|
977
978
|
current: e,
|
|
@@ -1019,11 +1020,11 @@ class U extends E {
|
|
|
1019
1020
|
_positionMenu() {
|
|
1020
1021
|
const t = this._surface();
|
|
1021
1022
|
if (!t) return;
|
|
1022
|
-
if (this._anchorEl && !
|
|
1023
|
+
if (this._anchorEl && !G(this._anchorEl)) {
|
|
1023
1024
|
this.close();
|
|
1024
1025
|
return;
|
|
1025
1026
|
}
|
|
1026
|
-
const e =
|
|
1027
|
+
const e = V(this.getAttribute("placement")), i = N(e), o = this._anchorEl ? R : 0;
|
|
1027
1028
|
if (!this._positioner || this._positionerPlacement !== i || this._positionerOffset !== o || this._positionerAnchorEl !== this._anchorEl) {
|
|
1028
1029
|
this._rebuildPositioner(t, i, o);
|
|
1029
1030
|
return;
|
|
@@ -1095,7 +1096,7 @@ class U extends E {
|
|
|
1095
1096
|
this._submenuIntentTimer = null;
|
|
1096
1097
|
const e = this._submenuIntentItem;
|
|
1097
1098
|
this._submenuIntentItem = null, !(!e || !e.isConnected || !this._isOpen) && (this._setOpenBranch(e, !0), this._scheduleSubmenuLayout());
|
|
1098
|
-
},
|
|
1099
|
+
}, I));
|
|
1099
1100
|
}
|
|
1100
1101
|
_onRootKeyDown(t) {
|
|
1101
1102
|
if (!this._isOpen) return;
|
|
@@ -1146,7 +1147,7 @@ class U extends E {
|
|
|
1146
1147
|
this._isOpen && (this._schedulePosition(), this._scheduleSubmenuLayout());
|
|
1147
1148
|
}
|
|
1148
1149
|
render() {
|
|
1149
|
-
const t =
|
|
1150
|
+
const t = q(this._stateText());
|
|
1150
1151
|
this.setContent(`
|
|
1151
1152
|
<style>${g}</style>
|
|
1152
1153
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
@@ -1163,7 +1164,7 @@ class U extends E {
|
|
|
1163
1164
|
return !1;
|
|
1164
1165
|
}
|
|
1165
1166
|
}
|
|
1166
|
-
typeof customElements < "u" && !customElements.get("ui-context-menu") && customElements.define("ui-context-menu",
|
|
1167
|
+
typeof customElements < "u" && !customElements.get("ui-context-menu") && customElements.define("ui-context-menu", K);
|
|
1167
1168
|
export {
|
|
1168
|
-
|
|
1169
|
+
K as UIContextMenu
|
|
1169
1170
|
};
|
package/dist/data-table.cjs.js
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
/* A wide table scrolls inside its own frame. Without this a grid or flex parent grows to the table's width. */
|
|
5
5
|
min-inline-size: 0;
|
|
6
6
|
max-inline-size: 100%;
|
|
7
|
-
--ui-data-table-radius:
|
|
8
|
-
--ui-data-table-border-color: var(--ui-color-border, rgba(15, 23, 42, 0.14));
|
|
7
|
+
--ui-data-table-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
8
|
+
--ui-data-table-border-color: var(--ui-color-line-subtle, var(--ui-color-border, rgba(15, 23, 42, 0.14)));
|
|
9
9
|
--ui-data-table-border: 1px solid var(--ui-data-table-border-color);
|
|
10
|
-
--ui-data-table-bg: var(--ui-color-surface,
|
|
10
|
+
--ui-data-table-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
11
11
|
--ui-data-table-shadow: none;
|
|
12
12
|
--ui-data-table-empty-color: var(--ui-color-muted, #526175);
|
|
13
13
|
--ui-data-table-summary-color: var(--ui-color-muted, #475569);
|
|
14
14
|
--ui-data-table-text: var(--ui-color-text, #0f172a);
|
|
15
15
|
--ui-data-table-header-text: var(--ui-color-text, #1e293b);
|
|
16
|
-
--ui-data-table-header-bg: var(--ui-color-surface-alt, #f8fafc);
|
|
16
|
+
--ui-data-table-header-bg: var(--ui-color-surface-subtle, var(--ui-color-surface-alt, #f8fafc));
|
|
17
17
|
--ui-data-table-footer-text: var(--ui-color-text, #0f172a);
|
|
18
|
-
--ui-data-table-footer-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 88%, var(--ui-color-surface, #ffffff));
|
|
18
|
+
--ui-data-table-footer-bg: var(--ui-color-surface-subtle, color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 88%, var(--ui-color-surface, #ffffff)));
|
|
19
19
|
--ui-data-table-cell-border: color-mix(in srgb, var(--ui-data-table-border-color) 58%, transparent);
|
|
20
|
-
--ui-data-table-striped-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 82%, transparent);
|
|
21
|
-
--ui-data-table-hover-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, transparent);
|
|
22
|
-
--ui-data-table-selected-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 20%, transparent);
|
|
20
|
+
--ui-data-table-striped-bg: var(--ui-color-surface-subtle, color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 82%, transparent));
|
|
21
|
+
--ui-data-table-hover-bg: var(--ui-color-fill, color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, transparent));
|
|
22
|
+
--ui-data-table-selected-bg: var(--ui-color-accent-fill, color-mix(in srgb, var(--ui-color-primary, #2563eb) 20%, transparent));
|
|
23
23
|
--ui-data-table-sort-indicator: color-mix(in srgb, var(--ui-color-muted, #94a3b8) 80%, transparent);
|
|
24
24
|
--ui-data-table-sort-active: var(--ui-color-primary, #2563eb);
|
|
25
25
|
--ui-data-table-resize-handle: color-mix(in srgb, var(--ui-color-muted, #94a3b8) 70%, transparent);
|
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
overflow: auto;
|
|
40
40
|
border: var(--ui-data-table-border);
|
|
41
41
|
border-radius: var(--ui-data-table-radius);
|
|
42
|
-
background:
|
|
43
|
-
linear-gradient(180deg, color-mix(in srgb, var(--ui-data-table-bg) 96%, #ffffff 4%), var(--ui-data-table-bg)),
|
|
44
|
-
var(--ui-data-table-bg);
|
|
42
|
+
background: var(--ui-data-table-bg);
|
|
45
43
|
box-shadow: var(--ui-data-table-shadow);
|
|
46
44
|
transition: border-color var(--ui-data-table-duration) var(--ui-data-table-ease), box-shadow var(--ui-data-table-duration) var(--ui-data-table-ease);
|
|
47
45
|
}
|
|
48
46
|
|
|
47
|
+
.frame[data-scroll-region]:focus-visible {
|
|
48
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-data-table-focus-ring, #2563eb));
|
|
49
|
+
outline-offset: -2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
49
52
|
.frame::before {
|
|
50
53
|
content: '';
|
|
51
54
|
position: absolute;
|
|
@@ -262,19 +265,19 @@
|
|
|
262
265
|
:host([state="loading"]) {
|
|
263
266
|
--ui-data-table-state-bg: color-mix(in srgb, #f59e0b 14%, transparent);
|
|
264
267
|
--ui-data-table-state-border: color-mix(in srgb, #f59e0b 42%, var(--ui-data-table-border-color));
|
|
265
|
-
--ui-data-table-state-text: #92400e;
|
|
268
|
+
--ui-data-table-state-text: var(--ui-color-warning-text, #92400e);
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
:host([state="error"]) {
|
|
269
272
|
--ui-data-table-state-bg: color-mix(in srgb, #ef4444 13%, transparent);
|
|
270
273
|
--ui-data-table-state-border: color-mix(in srgb, #ef4444 42%, var(--ui-data-table-border-color));
|
|
271
|
-
--ui-data-table-state-text: #b91c1c;
|
|
274
|
+
--ui-data-table-state-text: var(--ui-color-danger-text, #b91c1c);
|
|
272
275
|
}
|
|
273
276
|
|
|
274
277
|
:host([state="success"]) {
|
|
275
278
|
--ui-data-table-state-bg: color-mix(in srgb, #16a34a 13%, transparent);
|
|
276
279
|
--ui-data-table-state-border: color-mix(in srgb, #16a34a 42%, var(--ui-data-table-border-color));
|
|
277
|
-
--ui-data-table-state-text: #166534;
|
|
280
|
+
--ui-data-table-state-text: var(--ui-color-success-text, #166534);
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
:host([state="error"]) .frame {
|
|
@@ -548,12 +551,12 @@
|
|
|
548
551
|
}
|
|
549
552
|
|
|
550
553
|
ui-data-table[loading]:not([headless]) > table tbody {
|
|
551
|
-
opacity: 0.
|
|
554
|
+
opacity: 0.7;
|
|
552
555
|
pointer-events: none;
|
|
553
556
|
}
|
|
554
557
|
|
|
555
558
|
ui-data-table[state="loading"]:not([headless]) > table tbody {
|
|
556
|
-
opacity: 0.
|
|
559
|
+
opacity: 0.7;
|
|
557
560
|
pointer-events: none;
|
|
558
561
|
}
|
|
559
562
|
|
|
@@ -655,7 +658,7 @@
|
|
|
655
658
|
color: HighlightText;
|
|
656
659
|
}
|
|
657
660
|
}
|
|
658
|
-
`;function w(){if(typeof document>"u")return;const m="ui-data-table-light-dom-style",t=document.getElementById(m);if(t){t.textContent!==x&&(t.textContent=x);return}const a=document.createElement("style");a.id=m,a.textContent=x,document.head.appendChild(a)}typeof document<"u"&&w();function p(m){return m?(m.textContent||"").replace(/\s+/g," ").trim():""}function
|
|
661
|
+
`;function w(){if(typeof document>"u")return;const m="ui-data-table-light-dom-style",t=document.getElementById(m);if(t){t.textContent!==x&&(t.textContent=x);return}const a=document.createElement("style");a.id=m,a.textContent=x,document.head.appendChild(a)}typeof document<"u"&&w();function p(m){return m?(m.textContent||"").replace(/\s+/g," ").trim():""}function E(m){const t=m.replace(/,/g,"");if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);const a=Date.parse(m);return!Number.isNaN(a)&&/[-/]/.test(m)?a:m.toLowerCase()}const k=new Set(["sticky-header","sticky-footer","striped","hover","compact","bordered","loading","hide-summary","state","shape","variant","elevation"]),R=new Set(["pagination-id","bulk-actions-label","bulk-clear-label","state-text"]);class C extends A.ElementBase{constructor(){super(),this._table=null,this._observer=null,this._sortColumnIndex=-1,this._sortDirection="asc",this._selectedRows=new Set,this._isSyncing=!1,this._isSettingPage=!1,this._isSettingColumnOrder=!1,this._page=1,this._pageCount=1,this._pageSize=10,this._totalRows=0,this._filteredRows=0,this._paginationEl=null,this._resizeState=null,this._columnWidths=new Map,this._frameEl=null,this._scrollObserver=null,this._virtualRaf=0,this._virtualTopSpacer=null,this._virtualBottomSpacer=null,this._dragColumnIndex=-1,this._dragOverColumnIndex=-1,this._ignoreHeaderClickUntil=0,this._syncRaf=0,this._virtualStart=-1,this._virtualEnd=-1,this._virtualVisibleTotal=-1,this._resizeRaf=0,this._pendingResizeColumn=-1,this._pendingResizeWidth=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaginationChange=this._onPaginationChange.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onFrameScroll=this._onFrameScroll.bind(this),this._onDragStart=this._onDragStart.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDrop=this._onDrop.bind(this),this._onDragEnd=this._onDragEnd.bind(this)}static get observedAttributes(){return["headless","empty-text","sortable","selectable","multi-select","sticky-header","sticky-footer","striped","hover","compact","bordered","shape","variant","elevation","loading","state","state-text","filter-query","filter-column","filters","pin-columns","column-order","draggable-columns","resizable-columns","bulk-actions-label","bulk-clear-label","virtualize","row-height","overscan","page","page-size","pagination-id","hide-summary"]}connectedCallback(){super.connectedCallback(),w(),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKeyDown),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("dragstart",this._onDragStart),this.addEventListener("dragover",this._onDragOver),this.addEventListener("drop",this._onDrop),this.addEventListener("dragend",this._onDragEnd),this._observer=new MutationObserver(()=>{this._isSyncing||this._queueSyncStructure()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this._syncPaginationBinding()}disconnectedCallback(){this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("dragstart",this._onDragStart),this.removeEventListener("dragover",this._onDragOver),this.removeEventListener("drop",this._onDrop),this.removeEventListener("dragend",this._onDragEnd),window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),this._resizeState=null,this._frameEl&&(this._frameEl.removeEventListener("scroll",this._onFrameScroll),this._frameEl=null),this._virtualRaf&&(cancelAnimationFrame(this._virtualRaf),this._virtualRaf=0),this._resizeRaf&&(cancelAnimationFrame(this._resizeRaf),this._resizeRaf=0),this._pendingResizeColumn=-1,this._pendingResizeWidth=null,this._syncRaf&&(cancelAnimationFrame(this._syncRaf),this._syncRaf=0),this._clearVirtualSpacers(),this._observer&&(this._observer.disconnect(),this._observer=null),this._detachPaginationListener(),this._scrollObserver?.disconnect(),this._scrollObserver=null,super.disconnectedCallback()}attributeChangedCallback(t,a,e){if(a!==e&&!(t==="column-order"&&this._isSettingColumnOrder)&&!(t==="page"&&this._isSettingPage)){if(t==="headless"){this.requestRender();return}if(t==="empty-text"){this._syncEmptyText();return}if(this.isConnected){if(R.has(t)){t==="pagination-id"?this._syncPaginationBinding():t==="bulk-actions-label"||t==="bulk-clear-label"?this._updateBulkActions():t==="state-text"&&this._syncStateBar();return}if(k.has(t)){t==="hide-summary"?this._updateSummary():(t==="state"||t==="loading")&&this._syncStateBar();return}if(t==="filter-query"||t==="filter-column"||t==="filters"){this._syncStructure(),this._dispatchFilterChange();return}this._queueSyncStructure()}}}render(){if(this.hasAttribute("headless")){this.setContent("<slot></slot>"),this._syncStructure();return}const t=this.getAttribute("empty-text")||"No data available.";this.setContent(`
|
|
659
662
|
<style>${S}</style>
|
|
660
663
|
<div class="statebar" part="state" hidden role="status" aria-live="polite">
|
|
661
664
|
<span class="state-dot" aria-hidden="true"></span>
|
|
@@ -682,4 +685,4 @@
|
|
|
682
685
|
<button type="button" class="bulk-clear" part="bulk-clear"></button>
|
|
683
686
|
</div>
|
|
684
687
|
</div>
|
|
685
|
-
`),this._syncStructure(),this._syncStateBar()}_findTable(){return this.querySelector("table")}_queueSyncStructure(){this.isConnected&&(this._syncRaf||(this._syncRaf=requestAnimationFrame(()=>{this._syncRaf=0,this._syncStructure()})))}_isVirtualSpacerRow(t){return t.hasAttribute("data-virtual-spacer")}_clearVirtualSpacers(){this._virtualTopSpacer?.isConnected&&this._virtualTopSpacer.remove(),this._virtualBottomSpacer?.isConnected&&this._virtualBottomSpacer.remove(),this._virtualTopSpacer=null,this._virtualBottomSpacer=null,this._virtualStart=-1,this._virtualEnd=-1,this._virtualVisibleTotal=-1}_parseRowHeight(){const t=Number(this.getAttribute("row-height")||44);return!Number.isFinite(t)||t<20?44:Math.round(t)}_parseOverscan(){const t=Number(this.getAttribute("overscan")||6);return!Number.isFinite(t)||t<0?6:Math.max(0,Math.floor(t))}_state(){const t=(this.getAttribute("state")||"idle").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:this.hasAttribute("loading")?"loading":"idle"}_stateText(t){const a=(this.getAttribute("state-text")||"").trim();return a||(t==="loading"?"Refreshing table data":t==="error"?"Table data could not be loaded":t==="success"?"Table data is up to date":"")}_syncStateBar(){const t=this.root.querySelector(".statebar"),a=this.root.querySelector(".state-text"),e=this.root.querySelector(".loading-text"),i=this.root.querySelector(".frame"),r=this._table;if(!t)return;const s=this._state();s!=="idle"?t.removeAttribute("hidden"):t.setAttribute("hidden",""),t.setAttribute("data-state",s),t.setAttribute("aria-live",s==="error"?"assertive":"polite");const n=this._stateText(s);a&&(a.textContent=n),e&&(e.textContent=this._stateText("loading"));const u=s==="loading"?"true":"false";i&&i.setAttribute("aria-busy",u),r&&r.setAttribute("aria-busy",u)}_isInteractionBlocked(){return this._state()==="loading"}_isInteractiveTarget(t){if(!t)return!1;const a=t.closest('button, a[href], input, select, textarea, label, summary, details, [contenteditable=""], [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"]');return!(!a||a.classList.contains("resize-handle"))}_headerKey(t,a){if(!t)return`column-${a+1}`;const e=(t.getAttribute("data-key")||"").trim();if(e)return e;const i=p(t);return i?i.toLowerCase().replace(/\s+/g,"_"):`column-${a+1}`}_currentColumnOrderString(){return this._headerCells().map((a,e)=>this._headerKey(a,e)).join(",")}_setColumnOrderAttribute(t){(this.getAttribute("column-order")||"")!==t&&(this._isSettingColumnOrder=!0,this.setAttribute("column-order",t),this._isSettingColumnOrder=!1)}_isRtl(){return typeof window>"u"?!1:getComputedStyle(this).direction==="rtl"}_parsePageSize(){const t=Number(this.getAttribute("page-size")||10);return!Number.isFinite(t)||t<1?10:Math.floor(t)}_parsePage(){const t=Number(this.getAttribute("page")||1);return!Number.isFinite(t)||t<1?1:Math.floor(t)}_parseFilterQuery(){return(this.getAttribute("filter-query")||"").trim().toLowerCase()}_resolveFilterColumnIndex(t){const a=(this.getAttribute("filter-column")||"").trim();if(!a)return-1;const e=Number(a);if(Number.isInteger(e)&&e>=0&&e<t.length)return e;const i=a.toLowerCase();for(let r=0;r<t.length;r+=1){const s=t[r],o=(s.getAttribute("data-key")||"").toLowerCase(),n=p(s).toLowerCase();if(o===i||n===i)return r}return-1}_resolveColumnIndex(t,a){if(typeof a=="number"&&Number.isInteger(a)&&a>=0&&a<t.length)return a;const e=String(a||"").trim();if(!e)return-1;const i=Number(e);if(Number.isInteger(i)&&i>=0&&i<t.length)return i;const r=e.toLowerCase();for(let s=0;s<t.length;s+=1){const o=t[s],n=(o.getAttribute("data-key")||"").toLowerCase(),u=p(o).toLowerCase();if(n===r||u===r||this._headerKey(o,s)===r)return s}return-1}_parseFilters(t){const a=this.getAttribute("filters");if(!a)return[];try{const e=JSON.parse(a);if(!Array.isArray(e))return[];const i=[];return e.forEach(r=>{if(!r||typeof r!="object")return;const s=r.column??r.field??r.key,o=this._resolveColumnIndex(t,s);if(o<0)return;const n=String(r.op||r.operator||"contains").trim().toLowerCase();i.push({columnIndex:o,op:n,value:r.value})}),i}catch{return[]}}_normalizePinTokens(t){return Array.isArray(t)?t.map(a=>String(a).trim()).filter(Boolean):t==null?[]:String(t).split(",").map(a=>a.trim()).filter(Boolean)}_parsePinColumns(t){const a=this.getAttribute("pin-columns");if(!a)return{left:[],right:[]};const e=new Set,i=new Set,r=(u,h)=>{h.forEach(l=>{const d=this._resolveColumnIndex(t,l);d>=0&&u.add(d)})};try{const u=JSON.parse(a);if(u&&typeof u=="object"){r(e,this._normalizePinTokens(u.left)),r(i,this._normalizePinTokens(u.right));const h=Array.from(e).sort((d,c)=>d-c),l=Array.from(i).filter(d=>!e.has(d)).sort((d,c)=>c-d);return{left:h,right:l}}}catch{}a.split(";").map(u=>u.trim()).filter(Boolean).forEach(u=>{const[h,l]=u.split(":"),d=(h||"").trim().toLowerCase(),c=this._normalizePinTokens(l||"");d==="left"&&r(e,c),d==="right"&&r(i,c)});const o=Array.from(e).sort((u,h)=>u-h),n=Array.from(i).filter(u=>!e.has(u)).sort((u,h)=>h-u);return{left:o,right:n}}_setPageAttribute(t){const a=Math.max(1,t);this.getAttribute("page")!==String(a)&&(this._isSettingPage=!0,this.setAttribute("page",String(a)),this._isSettingPage=!1)}_bodyRows(){if(!this._table)return[];const t=this._table.tBodies[0];return t?Array.from(t.rows).filter(a=>!this._isVirtualSpacerRow(a)):[]}_headerCells(){if(!this._table)return[];const t=this._table.tHead?.rows[0];return t?Array.from(t.cells).filter(a=>a.tagName.toLowerCase()==="th"):Array.from(this._table.querySelectorAll("th"))}_clearPinnedColumns(){this._table&&this._table.querySelectorAll("[data-pinned]").forEach(t=>{const a=t;a.removeAttribute("data-pinned"),a.removeAttribute("data-pin-edge"),a.style.left="",a.style.right="",a.style.zIndex=""})}_resolveColumnWidth(t,a){const e=this._columnWidths.get(t);if(typeof e=="number"&&Number.isFinite(e))return Math.max(1,e);const i=a?.getBoundingClientRect().width||a?.offsetWidth||0;return Number.isFinite(i)&&i>0?i:120}_pinCell(t,a,e,i,r){t&&(t.setAttribute("data-pinned",a),i?t.setAttribute("data-pin-edge","true"):t.removeAttribute("data-pin-edge"),a==="left"?(t.style.left=`${Math.max(0,Math.round(e))}px`,t.style.right=""):(t.style.right=`${Math.max(0,Math.round(e))}px`,t.style.left=""),t.style.zIndex=r?"4":"3")}_applyPinnedColumns(){if(!this._table)return;this._clearPinnedColumns();const t=this._headerCells();if(!t.length)return;const{left:a,right:e}=this._parsePinColumns(t);if(!a.length&&!e.length)return;const i=Array.from(this._table.rows).filter(o=>!this._isVirtualSpacerRow(o));let r=0;a.forEach((o,n)=>{const u=this._resolveColumnWidth(o,t[o]),h=n===a.length-1;i.forEach((l,d)=>{const c=l.cells[o];this._pinCell(c,"left",r,h,d===0)}),r+=u});let s=0;e.forEach((o,n)=>{const u=this._resolveColumnWidth(o,t[o]),h=n===e.length-1;i.forEach((l,d)=>{const c=l.cells[o];this._pinCell(c,"right",s,h,d===0)}),s+=u})}_applyColumnOrder(){if(!this._table)return;const t=(this.getAttribute("column-order")||"").trim();if(!t)return;const a=this._table.tHead?.rows[0],e=this._table.tBodies[0];if(!a||!e)return;const i=Array.from(a.cells);if(!i.length)return;const r=t.split(",").map(l=>l.trim()).filter(Boolean);if(!r.length)return;const s=[],o=new Set,n=new Map;i.forEach((l,d)=>{const c=(l.getAttribute("data-key")||p(l)).toLowerCase().trim();c&&n.set(c,d)});for(const l of r){const d=Number(l);if(Number.isInteger(d)&&d>=0&&d<i.length){o.has(d)||(o.add(d),s.push(d));continue}const c=n.get(l.toLowerCase());typeof c=="number"&&!o.has(c)&&(o.add(c),s.push(c))}for(let l=0;l<i.length;l+=1)o.has(l)||s.push(l);if(s.every((l,d)=>l===d))return;s.map(l=>i[l]).forEach(l=>a.appendChild(l)),Array.from(e.rows).filter(l=>!this._isVirtualSpacerRow(l)).forEach(l=>{const d=Array.from(l.cells);s.map(f=>d[f]).filter(Boolean).forEach(f=>l.appendChild(f))}),this._columnWidths.clear()}_moveColumn(t,a){if(!this._table)return!1;const e=this._table.tHead?.rows[0],i=this._table.tBodies[0];if(!e||!i)return!1;const r=Array.from(e.cells),s=r.length;if(!s||t<0||t>=s||a<0||a>=s||t===a)return!1;const o=Array.from({length:s},(l,d)=>d),[n]=o.splice(t,1);o.splice(a,0,n),o.map(l=>r[l]).forEach(l=>e.appendChild(l)),Array.from(i.rows).filter(l=>!this._isVirtualSpacerRow(l)).forEach(l=>{const d=Array.from(l.cells);o.map(f=>d[f]).filter(Boolean).forEach(f=>l.appendChild(f))});const h=new Map;return o.forEach((l,d)=>{const c=this._columnWidths.get(l);typeof c=="number"&&h.set(d,c)}),this._columnWidths=h,this._sortColumnIndex>=0&&(this._sortColumnIndex=o.indexOf(this._sortColumnIndex)),this._syncHeaderState(),this._applyPinnedColumns(),this._syncRowSelectionState(),!0}_clearDragMarkers(){this._headerCells().forEach(a=>{a.removeAttribute("data-dragging"),a.removeAttribute("data-drag-over")}),this._dragOverColumnIndex=-1}_emitColumnOrderChange(t,a){const e=this._currentColumnOrderString();this._setColumnOrderAttribute(e),this.dispatchEvent(new CustomEvent("column-order-change",{detail:{sourceIndex:t,targetIndex:a,order:e,keys:this._headerCells().map((i,r)=>this._headerKey(i,r))},bubbles:!0}))}_focusHeaderAt(t){const e=this._headerCells()[t];e&&e.focus()}_focusSelectableRow(t,a){const e=this._bodyRows().filter(o=>!o.hidden),i=e.indexOf(t);if(i<0)return;const r=Math.min(e.length-1,Math.max(0,i+a)),s=e[r];s&&s.focus()}_headerKeyboardShortcuts(t,a){const e=this._isRtl(),i=e?"ArrowRight":"ArrowLeft",r=e?"ArrowLeft":"ArrowRight",s=[i,r,"Home","End"];return t&&s.push("Enter","Space"),a&&s.push(`Alt+${i}`,`Alt+${r}`),s.join(" ")}_syncStructure(){if(!this._isSyncing){this._isSyncing=!0;try{this._table=this._findTable();const t=this.root.querySelector(".frame");this._frameEl!==t&&(this._frameEl&&this._frameEl.removeEventListener("scroll",this._onFrameScroll),this._frameEl=t,this._frameEl&&this._frameEl.addEventListener("scroll",this._onFrameScroll,{passive:!0}));const a=this.root.querySelector(".empty"),e=this.root.querySelector(".summary");if(this._syncEmptyText(),!this._table){a&&a.removeAttribute("hidden"),e&&(e.textContent=""),this._selectedRows.clear(),this._page=1,this._pageCount=1,this._totalRows=0,this._filteredRows=0,this._clearVirtualization(!1),this._syncPaginationElement(),this._syncStateBar();return}a&&a.setAttribute("hidden",""),this._table.hasAttribute("data-ui-data-table")||this._table.setAttribute("data-ui-data-table","true"),this._table.hasAttribute("role")||this._table.setAttribute("role","table"),this._applyColumnOrder(),this._syncHeaderState(),this._applyPinnedColumns(),this._table.setAttribute("aria-colcount",String(this._headerCells().length||0)),this._applyPagination(!1),a&&(this._filteredRows>0?a.setAttribute("hidden",""):(this._syncEmptyText(),a.removeAttribute("hidden"))),this._applyVirtualization(!1),this._syncRowSelectionState(),this._updateBulkActions(),this._updateSummary(),this._syncPaginationElement(),this._syncStateBar()}finally{this._isSyncing=!1}}}_syncHeaderState(){const t=this.hasAttribute("sortable"),a=this.hasAttribute("draggable-columns"),e=this.hasAttribute("resizable-columns"),i=this._headerKeyboardShortcuts(t,a);this._headerCells().forEach((s,o)=>{if(s.setAttribute("data-col-index",String(o)),s.setAttribute("scope","col"),s.setAttribute("aria-colindex",String(o+1)),t||a?s.setAttribute("aria-keyshortcuts",i):s.removeAttribute("aria-keyshortcuts"),t?s.setAttribute("data-sortable","true"):s.removeAttribute("data-sortable"),t||a?s.hasAttribute("tabindex")||s.setAttribute("tabindex","0"):s.getAttribute("tabindex")==="0"&&s.removeAttribute("tabindex"),o===this._sortColumnIndex&&t?s.setAttribute("aria-sort",this._sortDirection==="asc"?"ascending":"descending"):t?s.setAttribute("aria-sort","none"):s.removeAttribute("aria-sort"),a?(s.setAttribute("data-draggable","true"),s.setAttribute("draggable","true"),s.setAttribute("aria-description","Draggable column header")):(s.removeAttribute("data-draggable"),s.removeAttribute("draggable"),s.removeAttribute("data-dragging"),s.removeAttribute("data-drag-over"),s.removeAttribute("aria-description")),e){s.setAttribute("data-resizable","true");let n=s.querySelector(".resize-handle");n||(n=document.createElement("button"),n.type="button",n.className="resize-handle",n.setAttribute("aria-hidden","true"),n.tabIndex=-1,s.appendChild(n)),n.setAttribute("data-col-index",String(o));const u=this._columnWidths.get(o);typeof u=="number"&&this._setColumnWidth(o,u,!1)}else{s.removeAttribute("data-resizable");const n=s.querySelector(".resize-handle");n&&n.remove()}})}_applyPagination(t){const a=this._bodyRows();this._pageSize=this._parsePageSize(),this._totalRows=a.length;const e=this._parseFilterQuery(),i=this._headerCells(),r=this._resolveFilterColumnIndex(i),s=this._parseFilters(i),o=a.filter(d=>this._rowMatchesFilter(d,e,r,s));this._filteredRows=o.length,this._table?.setAttribute("aria-rowcount",String(this._filteredRows));const n=this._parsePage();this._pageCount=Math.max(1,Math.ceil(o.length/this._pageSize)),this._page=Math.min(this._pageCount,Math.max(1,n)),this._page!==n&&this._setPageAttribute(this._page);const u=(this._page-1)*this._pageSize,h=u+this._pageSize,l=new Set(o);if(a.forEach(d=>{l.has(d)?d.removeAttribute("data-hidden-by-filter"):(d.hidden=!0,d.setAttribute("data-hidden-by-filter",""),d.removeAttribute("data-hidden-by-page"),d.removeAttribute("aria-rowindex"))}),o.forEach((d,c)=>{const f=c>=u&&c<h;d.hidden=!f,f?d.removeAttribute("data-hidden-by-page"):d.setAttribute("data-hidden-by-page",""),d.setAttribute("aria-rowindex",String(c+1))}),t){const d=o.length,c=d===0?0:u+1,f=Math.min(h,d);this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this._page,count:this._pageCount,pageSize:this._pageSize,total:d,start:c,end:f},bubbles:!0}))}}_clearVirtualization(t){this._virtualRaf&&(cancelAnimationFrame(this._virtualRaf),this._virtualRaf=0),this._clearVirtualSpacers(),t&&this._bodyRows().forEach(a=>{a.style.display==="none"&&(a.style.display=""),a.removeAttribute("data-hidden-by-virtual")})}_ensureVirtualSpacer(t){if(!this._table)return null;const a=this._table.tBodies[0];if(!a)return null;const e=t==="top"?this._virtualTopSpacer:this._virtualBottomSpacer;if(e&&e.isConnected)return e;const i=document.createElement("tr");i.setAttribute("data-virtual-spacer",t),i.setAttribute("aria-hidden","true"),i.setAttribute("role","presentation"),i.style.pointerEvents="none";const r=document.createElement("td");return r.style.padding="0",r.style.border="0",r.style.height="0px",r.style.lineHeight="0",r.style.fontSize="0",r.innerHTML=" ",i.appendChild(r),t==="top"?(a.insertBefore(i,a.firstChild),this._virtualTopSpacer=i):(a.appendChild(i),this._virtualBottomSpacer=i),i}_setVirtualSpacerHeight(t,a,e){if(!t)return;const i=t.cells[0]||t.appendChild(document.createElement("td"));i.colSpan!==Math.max(1,e)&&(i.colSpan=Math.max(1,e)),i.style.padding="0",i.style.border="0",i.style.height=`${Math.max(0,Math.round(a))}px`,i.style.lineHeight="0",i.style.fontSize="0"}_applyVirtualization(t){if(!this.hasAttribute("virtualize")||!this._frameEl||!this._table){this._clearVirtualization(!0);return}const e=this._bodyRows().filter(g=>!g.hidden);if(!e.length){this._clearVirtualization(!0);return}const i=this._parseRowHeight(),r=this._parseOverscan(),s=this._frameEl.clientHeight||i*8,o=this._frameEl.scrollTop,n=Math.max(0,Math.floor(o/i)-r),u=Math.min(e.length,Math.ceil((o+s)/i)+r),h=n*i,l=Math.max(0,(e.length-u)*i),d=Math.max(1,this._headerCells().length||e[0]?.cells.length||1),c=this._ensureVirtualSpacer("top"),f=this._ensureVirtualSpacer("bottom");this._setVirtualSpacerHeight(c,h,d),this._setVirtualSpacerHeight(f,l,d);const y=(g,v)=>{v?(g.style.display==="none"&&(g.style.display=""),g.removeAttribute("data-hidden-by-virtual")):(g.style.display!=="none"&&(g.style.display="none"),g.setAttribute("data-hidden-by-virtual",""))};if(!(this._virtualStart>=0&&this._virtualEnd>=this._virtualStart&&this._virtualVisibleTotal===e.length))e.forEach((g,v)=>{y(g,v>=n&&v<u)});else{const g=this._virtualStart,v=this._virtualEnd;for(let b=g;b<Math.min(n,v);b+=1){const _=e[b];_&&y(_,!1)}for(let b=n;b<Math.min(g,u);b+=1){const _=e[b];_&&y(_,!0)}for(let b=Math.max(u,g);b<v;b+=1){const _=e[b];_&&y(_,!1)}for(let b=Math.max(v,n);b<u;b+=1){const _=e[b];_&&y(_,!0)}}this._virtualStart=n,this._virtualEnd=u,this._virtualVisibleTotal=e.length,t&&this.dispatchEvent(new CustomEvent("virtual-range-change",{detail:{start:n,end:Math.max(n,u-1),visible:Math.max(0,u-n),total:e.length},bubbles:!0}))}_updateSummary(){const t=this.root.querySelector(".summary");if(!t)return;const a=this._totalRows,e=this._filteredRows;if(!a||!e){t.textContent="No records";return}const i=(this._page-1)*this._pageSize+1,r=Math.min(this._page*this._pageSize,e);if(e===a){t.textContent=`Showing ${i}-${r} of ${a}`;return}t.textContent=`Showing ${i}-${r} of ${e} filtered records (${a} total)`}_syncEmptyText(){const t=this.root.querySelector(".empty");if(!t)return;const a=!!this._parseFilterQuery();if(this._table&&this._filteredRows===0&&a){t.textContent="No matching records.";return}t.textContent=this.getAttribute("empty-text")||"No data available."}_dispatchFilterChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{query:this.getAttribute("filter-query")||"",filters:this.getAttribute("filters")||"",total:this._totalRows,filtered:this._filteredRows,page:this._page,count:this._pageCount},bubbles:!0}))}_parseComparable(t){const a=t.replace(/,/g,"").trim();return/^-?\d+(\.\d+)?$/.test(a)?Number(a):t.toLowerCase()}_rulePasses(t,a){const e=a.op,i=a.value,r=t.trim(),s=r.toLowerCase();if(e==="empty")return r.length===0;if(e==="notempty"||e==="not-empty")return r.length>0;if(e==="equals"||e==="eq")return s===String(i??"").toLowerCase();if(e==="neq"||e==="not-equals")return s!==String(i??"").toLowerCase();if(e==="startswith"||e==="starts-with")return s.startsWith(String(i??"").toLowerCase());if(e==="endswith"||e==="ends-with")return s.endsWith(String(i??"").toLowerCase());if(e==="in")return(Array.isArray(i)?i.map(n=>String(n).toLowerCase()):String(i??"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)).includes(s);if(e==="gt"||e==="gte"||e==="lt"||e==="lte"||e==="between"){const o=this._parseComparable(r);if(typeof o!="number")return!1;if(e==="between"){const u=Array.isArray(i)?i:String(i??"").split(","),h=Number(u[0]),l=Number(u[1]);return!Number.isFinite(h)||!Number.isFinite(l)?!1:o>=Math.min(h,l)&&o<=Math.max(h,l)}const n=Number(i);return Number.isFinite(n)?e==="gt"?o>n:e==="gte"?o>=n:e==="lt"?o<n:o<=n:!1}return s.includes(String(i??"").toLowerCase())}_rowMatchesFilter(t,a,e,i){if(a){const r=e>=0?p(t.cells[e]):Array.from(t.cells).map(n=>p(n)).join(" ");if(!r)return!1;const s=r.toLowerCase(),o=a.split(/\s+/).filter(Boolean);if(o.length&&!o.every(n=>s.includes(n)))return!1}return i.length?i.every(r=>{const s=t.cells[r.columnIndex];return this._rulePasses(p(s),r)}):!0}_setColumnWidth(t,a,e=!0){if(!this._table)return;const i=Math.max(72,Math.round(a));if(this._columnWidths.set(t,i),Array.from(this._table.rows).forEach(o=>{const n=o.cells[t];n&&(n.style.width=`${i}px`,n.style.minWidth=`${i}px`,n.style.maxWidth=`${i}px`,n.style.boxSizing="border-box")}),!e)return;this._applyPinnedColumns();const s=this._headerCells()[t];this.dispatchEvent(new CustomEvent("column-resize",{detail:{columnIndex:t,key:s?.getAttribute("data-key")||p(s)||`column-${t+1}`,width:i},bubbles:!0}))}_onPointerDown(t){if(!this.hasAttribute("resizable-columns")||!this._table)return;const e=t.target.closest(".resize-handle");if(!e||!this._table.contains(e))return;const i=Number(e.getAttribute("data-col-index"));if(!Number.isInteger(i)||i<0)return;const r=this._headerCells()[i];if(!r)return;t.preventDefault();const s=r.getBoundingClientRect().width;this._resizeState={columnIndex:i,startX:t.clientX,startWidth:s},window.addEventListener("pointermove",this._onPointerMove),window.addEventListener("pointerup",this._onPointerUp)}_onPointerMove(t){if(!this._resizeState)return;const a=t.clientX-this._resizeState.startX,e=this._isRtl()?-a:a;this._pendingResizeColumn=this._resizeState.columnIndex,this._pendingResizeWidth=this._resizeState.startWidth+e,this._setColumnWidth(this._pendingResizeColumn,this._pendingResizeWidth,!1)}_onPointerUp(){if(!this._resizeState)return;const t=this._resizeState;this._resizeState=null,this._resizeRaf&&(cancelAnimationFrame(this._resizeRaf),this._resizeRaf=0),this._pendingResizeColumn===t.columnIndex&&this._pendingResizeWidth!=null&&this._setColumnWidth(t.columnIndex,this._pendingResizeWidth,!1),this._pendingResizeColumn=-1,this._pendingResizeWidth=null,window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp);const a=this._headerCells()[t.columnIndex];if(!a)return;const e=a.getBoundingClientRect().width;this._setColumnWidth(t.columnIndex,e,!0)}_onFrameScroll(){this.hasAttribute("virtualize")&&(this._virtualRaf||(this._virtualRaf=requestAnimationFrame(()=>{this._virtualRaf=0,this._applyVirtualization(!0)})))}_onDragStart(t){if(!this.hasAttribute("draggable-columns")||!this._table)return;const a=t.target;if(a.closest(".resize-handle")){t.preventDefault();return}const e=a.closest("th");if(!e||!this._table.contains(e))return;const r=this._headerCells().indexOf(e);r<0||(this._dragColumnIndex=r,this._dragOverColumnIndex=r,this._clearDragMarkers(),e.setAttribute("data-dragging","true"),t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(r))))}_onDragOver(t){if(!this.hasAttribute("draggable-columns")||!this._table||this._dragColumnIndex<0)return;const e=t.target.closest("th");if(!e||!this._table.contains(e))return;const i=this._headerCells(),r=i.indexOf(e);if(r<0||(t.preventDefault(),this._dragOverColumnIndex===r))return;this._clearDragMarkers(),this._dragOverColumnIndex=r,e.setAttribute("data-drag-over","true");const s=i[this._dragColumnIndex];s&&s.setAttribute("data-dragging","true")}_onDrop(t){if(!this.hasAttribute("draggable-columns")||!this._table||this._dragColumnIndex<0)return;const e=t.target.closest("th");if(!e||!this._table.contains(e))return;const r=this._headerCells().indexOf(e);if(r<0)return;t.preventDefault();const s=this._dragColumnIndex,o=this._moveColumn(s,r);this._clearDragMarkers(),this._dragColumnIndex=-1,this._ignoreHeaderClickUntil=Date.now()+220,o&&(this._applyVirtualization(!1),this._emitColumnOrderChange(s,r))}_onDragEnd(){this._clearDragMarkers(),this._dragColumnIndex=-1}_rowValues(t){const a=this._headerCells(),e=Array.from(t.cells),i={};return e.forEach((r,s)=>{const o=a[s],n=(o?.getAttribute("data-key")||p(o||void 0)||`col_${s+1}`).toLowerCase().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");i[n||`col_${s+1}`]=p(r)}),i}_syncRowSelectionState(){const t=this.hasAttribute("selectable"),a=this._bodyRows();for(const e of Array.from(this._selectedRows))a.includes(e)||this._selectedRows.delete(e);a.forEach(e=>{const i=!e.hidden;t&&i?(e.setAttribute("aria-selected",this._selectedRows.has(e)?"true":"false"),e.setAttribute("aria-keyshortcuts","ArrowUp ArrowDown Home End Enter Space"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"),this._selectedRows.has(e)?e.setAttribute("data-selected","true"):e.removeAttribute("data-selected")):(e.removeAttribute("aria-selected"),e.removeAttribute("aria-keyshortcuts"),e.removeAttribute("data-selected"),e.getAttribute("tabindex")==="0"&&e.removeAttribute("tabindex"))})}_toggleRowSelection(t){const a=this.hasAttribute("multi-select"),e=this._selectedRows.has(t);a||this._selectedRows.clear(),e&&a?this._selectedRows.delete(t):this._selectedRows.add(t),this._syncRowSelectionState(),this._updateBulkActions();const i=this._bodyRows(),r=i.flatMap((o,n)=>this._selectedRows.has(o)?[n]:[]),s=i.filter(o=>this._selectedRows.has(o)).map(o=>this._rowValues(o));this.dispatchEvent(new CustomEvent("row-select",{detail:{index:i.indexOf(t),selected:this._selectedRows.has(t),indices:r,rows:s,page:this._page},bubbles:!0}))}_sortByColumn(t,a){if(!this._table)return;const e=this._table.tBodies[0];if(!e)return;this._sortColumnIndex===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortColumnIndex=t,this._sortDirection="asc"),Array.from(e.rows).filter(o=>!this._isVirtualSpacerRow(o)).map((o,n)=>({row:o,rowIndex:n,value:k(p(o.cells[t]))})).sort((o,n)=>{const u=o.value,h=n.value;let l=0;return typeof u=="number"&&typeof h=="number"?l=u-h:l=String(u).localeCompare(String(h),void 0,{numeric:!0,sensitivity:"base"}),l===0&&(l=o.rowIndex-n.rowIndex),this._sortDirection==="asc"?l:-l}).map(o=>o.row).forEach(o=>e.appendChild(o)),this._syncHeaderState(),this._applyPagination(!1),this._syncRowSelectionState(),this._updateSummary(),this._syncPaginationElement();const s=a.getAttribute("data-key")||p(a)||`column-${t+1}`;this.dispatchEvent(new CustomEvent("sort-change",{detail:{columnIndex:t,key:s,direction:this._sortDirection,page:this._page},bubbles:!0}))}_detachPaginationListener(){this._paginationEl&&(this._paginationEl.removeEventListener("change",this._onPaginationChange),this._paginationEl=null)}_syncPaginationBinding(){this._detachPaginationListener();const t=this.getAttribute("pagination-id");if(!t)return;const a=document.getElementById(t);a&&(this._paginationEl=a,this._paginationEl.addEventListener("change",this._onPaginationChange),this._syncPaginationElement())}_syncPaginationElement(){this._paginationEl&&(this._paginationEl.setAttribute("count",String(this._pageCount||1)),this._paginationEl.setAttribute("page",String(this._page||1)))}_onPaginationChange(t){const a=t.detail,e=Number(a?.page);Number.isFinite(e)&&e!==this._page&&(this._setPageAttribute(e),this._applyPagination(!0),this._syncRowSelectionState(),this._updateSummary(),this._syncPaginationElement())}_onClick(t){if(!this._table)return;const e=t.composedPath().find(r=>r instanceof HTMLElement)||t.target;if(e.closest(".bulk-clear")){const r=this._selectedRows.size;r>0&&(this._selectedRows.clear(),this._syncRowSelectionState(),this._updateBulkActions(),this.dispatchEvent(new CustomEvent("bulk-clear",{detail:{count:r,page:this._page},bubbles:!0})));return}if(!e.closest(".resize-handle")&&!(e.closest("th")&&Date.now()<this._ignoreHeaderClickUntil)&&!this._isInteractionBlocked()){if(this.hasAttribute("sortable")){const r=e.closest("th");if(r&&this._table.contains(r)){if(e!==r&&this._isInteractiveTarget(e))return;const o=this._headerCells().indexOf(r);if(o>=0){this._sortByColumn(o,r);return}}}if(this.hasAttribute("selectable")){const r=e.closest("tbody tr");if(r&&this._table.contains(r)&&!r.hidden&&!this._isVirtualSpacerRow(r)){if(e!==r&&this._isInteractiveTarget(e))return;this._toggleRowSelection(r)}}}}_onKeyDown(t){if(!this._table)return;const a=t.key,e=t.target;if(a==="Escape"&&this._selectedRows.size){const r=this._selectedRows.size;this._selectedRows.clear(),this._syncRowSelectionState(),this._updateBulkActions(),this.dispatchEvent(new CustomEvent("bulk-clear",{detail:{count:r,page:this._page},bubbles:!0}));return}if(this._isInteractionBlocked())return;const i=e.closest("th");if(i&&this._table.contains(i)){const r=this._headerCells(),s=r.indexOf(i);if(s>=0){const n=this._isRtl()?-1:1,u=-n;if(a==="ArrowRight"||a==="ArrowLeft"){t.preventDefault();const h=a==="ArrowRight"?n:u,l=Math.max(0,Math.min(r.length-1,s+h));if(t.altKey&&this.hasAttribute("draggable-columns")&&l!==s){this._moveColumn(s,l)&&(this._ignoreHeaderClickUntil=Date.now()+220,this._emitColumnOrderChange(s,l),this._applyVirtualization(!1),this._focusHeaderAt(l));return}this._focusHeaderAt(l);return}if(a==="Home"||a==="End"){t.preventDefault(),this._focusHeaderAt(a==="Home"?0:r.length-1);return}if((a==="Enter"||a===" ")&&this.hasAttribute("sortable")){if(e!==i&&this._isInteractiveTarget(e))return;t.preventDefault(),this._sortByColumn(s,i);return}}}if(this.hasAttribute("selectable")){const r=e.closest("tbody tr");if(r&&this._table.contains(r)&&!r.hidden&&!this._isVirtualSpacerRow(r)){if(e!==r&&this._isInteractiveTarget(e))return;if(a==="ArrowDown"||a==="ArrowUp"){t.preventDefault(),this._focusSelectableRow(r,a==="ArrowDown"?1:-1);return}if(a==="Home"||a==="End"){t.preventDefault();const s=this._bodyRows().filter(n=>!n.hidden),o=a==="Home"?s[0]:s[s.length-1];o&&o.focus();return}(a==="Enter"||a===" ")&&(t.preventDefault(),this._toggleRowSelection(r))}}}_updateBulkActions(){const t=this.root.querySelector(".bulk");if(!t)return;const a=this.hasAttribute("selectable"),e=this._selectedRows.size;if(!(a&&e>0)){t.setAttribute("hidden","");return}t.removeAttribute("hidden");const r=this.getAttribute("bulk-actions-label")||"{count} selected",s=this.getAttribute("bulk-clear-label")||"Clear selection",o=t.querySelector(".bulk-count");o&&(o.textContent=r.replace("{count}",String(e)));const n=t.querySelector(".bulk-clear");n&&(n.textContent=s)}shouldRenderOnAttributeChange(t,a,e){return!1}}typeof customElements<"u"&&!customElements.get("ui-data-table")&&customElements.define("ui-data-table",C);exports.UIDataTable=C;
|
|
688
|
+
`),this._syncStructure(),this._syncStateBar()}_findTable(){return this.querySelector("table")}_queueSyncStructure(){this.isConnected&&(this._syncRaf||(this._syncRaf=requestAnimationFrame(()=>{this._syncRaf=0,this._syncStructure()})))}_isVirtualSpacerRow(t){return t.hasAttribute("data-virtual-spacer")}_clearVirtualSpacers(){this._virtualTopSpacer?.isConnected&&this._virtualTopSpacer.remove(),this._virtualBottomSpacer?.isConnected&&this._virtualBottomSpacer.remove(),this._virtualTopSpacer=null,this._virtualBottomSpacer=null,this._virtualStart=-1,this._virtualEnd=-1,this._virtualVisibleTotal=-1}_parseRowHeight(){const t=Number(this.getAttribute("row-height")||44);return!Number.isFinite(t)||t<20?44:Math.round(t)}_parseOverscan(){const t=Number(this.getAttribute("overscan")||6);return!Number.isFinite(t)||t<0?6:Math.max(0,Math.floor(t))}_state(){const t=(this.getAttribute("state")||"idle").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:this.hasAttribute("loading")?"loading":"idle"}_stateText(t){const a=(this.getAttribute("state-text")||"").trim();return a||(t==="loading"?"Refreshing table data":t==="error"?"Table data could not be loaded":t==="success"?"Table data is up to date":"")}_syncStateBar(){const t=this.root.querySelector(".statebar"),a=this.root.querySelector(".state-text"),e=this.root.querySelector(".loading-text"),r=this.root.querySelector(".frame"),i=this._table;if(!t)return;const s=this._state();s!=="idle"?t.removeAttribute("hidden"):t.setAttribute("hidden",""),t.setAttribute("data-state",s),t.setAttribute("aria-live",s==="error"?"assertive":"polite");const n=this._stateText(s);a&&(a.textContent=n),e&&(e.textContent=this._stateText("loading"));const u=s==="loading"?"true":"false";r&&r.setAttribute("aria-busy",u),i&&i.setAttribute("aria-busy",u)}_isInteractionBlocked(){return this._state()==="loading"}_isInteractiveTarget(t){if(!t)return!1;const a=t.closest('button, a[href], input, select, textarea, label, summary, details, [contenteditable=""], [contenteditable="true"], [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="menuitem"]');return!(!a||a.classList.contains("resize-handle"))}_headerKey(t,a){if(!t)return`column-${a+1}`;const e=(t.getAttribute("data-key")||"").trim();if(e)return e;const r=p(t);return r?r.toLowerCase().replace(/\s+/g,"_"):`column-${a+1}`}_currentColumnOrderString(){return this._headerCells().map((a,e)=>this._headerKey(a,e)).join(",")}_setColumnOrderAttribute(t){(this.getAttribute("column-order")||"")!==t&&(this._isSettingColumnOrder=!0,this.setAttribute("column-order",t),this._isSettingColumnOrder=!1)}_isRtl(){return typeof window>"u"?!1:getComputedStyle(this).direction==="rtl"}_parsePageSize(){const t=Number(this.getAttribute("page-size")||10);return!Number.isFinite(t)||t<1?10:Math.floor(t)}_parsePage(){const t=Number(this.getAttribute("page")||1);return!Number.isFinite(t)||t<1?1:Math.floor(t)}_parseFilterQuery(){return(this.getAttribute("filter-query")||"").trim().toLowerCase()}_resolveFilterColumnIndex(t){const a=(this.getAttribute("filter-column")||"").trim();if(!a)return-1;const e=Number(a);if(Number.isInteger(e)&&e>=0&&e<t.length)return e;const r=a.toLowerCase();for(let i=0;i<t.length;i+=1){const s=t[i],o=(s.getAttribute("data-key")||"").toLowerCase(),n=p(s).toLowerCase();if(o===r||n===r)return i}return-1}_resolveColumnIndex(t,a){if(typeof a=="number"&&Number.isInteger(a)&&a>=0&&a<t.length)return a;const e=String(a||"").trim();if(!e)return-1;const r=Number(e);if(Number.isInteger(r)&&r>=0&&r<t.length)return r;const i=e.toLowerCase();for(let s=0;s<t.length;s+=1){const o=t[s],n=(o.getAttribute("data-key")||"").toLowerCase(),u=p(o).toLowerCase();if(n===i||u===i||this._headerKey(o,s)===i)return s}return-1}_parseFilters(t){const a=this.getAttribute("filters");if(!a)return[];try{const e=JSON.parse(a);if(!Array.isArray(e))return[];const r=[];return e.forEach(i=>{if(!i||typeof i!="object")return;const s=i.column??i.field??i.key,o=this._resolveColumnIndex(t,s);if(o<0)return;const n=String(i.op||i.operator||"contains").trim().toLowerCase();r.push({columnIndex:o,op:n,value:i.value})}),r}catch{return[]}}_normalizePinTokens(t){return Array.isArray(t)?t.map(a=>String(a).trim()).filter(Boolean):t==null?[]:String(t).split(",").map(a=>a.trim()).filter(Boolean)}_parsePinColumns(t){const a=this.getAttribute("pin-columns");if(!a)return{left:[],right:[]};const e=new Set,r=new Set,i=(u,c)=>{c.forEach(l=>{const d=this._resolveColumnIndex(t,l);d>=0&&u.add(d)})};try{const u=JSON.parse(a);if(u&&typeof u=="object"){i(e,this._normalizePinTokens(u.left)),i(r,this._normalizePinTokens(u.right));const c=Array.from(e).sort((d,h)=>d-h),l=Array.from(r).filter(d=>!e.has(d)).sort((d,h)=>h-d);return{left:c,right:l}}}catch{}a.split(";").map(u=>u.trim()).filter(Boolean).forEach(u=>{const[c,l]=u.split(":"),d=(c||"").trim().toLowerCase(),h=this._normalizePinTokens(l||"");d==="left"&&i(e,h),d==="right"&&i(r,h)});const o=Array.from(e).sort((u,c)=>u-c),n=Array.from(r).filter(u=>!e.has(u)).sort((u,c)=>c-u);return{left:o,right:n}}_setPageAttribute(t){const a=Math.max(1,t);this.getAttribute("page")!==String(a)&&(this._isSettingPage=!0,this.setAttribute("page",String(a)),this._isSettingPage=!1)}_bodyRows(){if(!this._table)return[];const t=this._table.tBodies[0];return t?Array.from(t.rows).filter(a=>!this._isVirtualSpacerRow(a)):[]}_headerCells(){if(!this._table)return[];const t=this._table.tHead?.rows[0];return t?Array.from(t.cells).filter(a=>a.tagName.toLowerCase()==="th"):Array.from(this._table.querySelectorAll("th"))}_clearPinnedColumns(){this._table&&this._table.querySelectorAll("[data-pinned]").forEach(t=>{const a=t;a.removeAttribute("data-pinned"),a.removeAttribute("data-pin-edge"),a.style.left="",a.style.right="",a.style.zIndex=""})}_resolveColumnWidth(t,a){const e=this._columnWidths.get(t);if(typeof e=="number"&&Number.isFinite(e))return Math.max(1,e);const r=a?.getBoundingClientRect().width||a?.offsetWidth||0;return Number.isFinite(r)&&r>0?r:120}_pinCell(t,a,e,r,i){t&&(t.setAttribute("data-pinned",a),r?t.setAttribute("data-pin-edge","true"):t.removeAttribute("data-pin-edge"),a==="left"?(t.style.left=`${Math.max(0,Math.round(e))}px`,t.style.right=""):(t.style.right=`${Math.max(0,Math.round(e))}px`,t.style.left=""),t.style.zIndex=i?"4":"3")}_applyPinnedColumns(){if(!this._table)return;this._clearPinnedColumns();const t=this._headerCells();if(!t.length)return;const{left:a,right:e}=this._parsePinColumns(t);if(!a.length&&!e.length)return;const r=Array.from(this._table.rows).filter(o=>!this._isVirtualSpacerRow(o));let i=0;a.forEach((o,n)=>{const u=this._resolveColumnWidth(o,t[o]),c=n===a.length-1;r.forEach((l,d)=>{const h=l.cells[o];this._pinCell(h,"left",i,c,d===0)}),i+=u});let s=0;e.forEach((o,n)=>{const u=this._resolveColumnWidth(o,t[o]),c=n===e.length-1;r.forEach((l,d)=>{const h=l.cells[o];this._pinCell(h,"right",s,c,d===0)}),s+=u})}_applyColumnOrder(){if(!this._table)return;const t=(this.getAttribute("column-order")||"").trim();if(!t)return;const a=this._table.tHead?.rows[0],e=this._table.tBodies[0];if(!a||!e)return;const r=Array.from(a.cells);if(!r.length)return;const i=t.split(",").map(l=>l.trim()).filter(Boolean);if(!i.length)return;const s=[],o=new Set,n=new Map;r.forEach((l,d)=>{const h=(l.getAttribute("data-key")||p(l)).toLowerCase().trim();h&&n.set(h,d)});for(const l of i){const d=Number(l);if(Number.isInteger(d)&&d>=0&&d<r.length){o.has(d)||(o.add(d),s.push(d));continue}const h=n.get(l.toLowerCase());typeof h=="number"&&!o.has(h)&&(o.add(h),s.push(h))}for(let l=0;l<r.length;l+=1)o.has(l)||s.push(l);if(s.every((l,d)=>l===d))return;s.map(l=>r[l]).forEach(l=>a.appendChild(l)),Array.from(e.rows).filter(l=>!this._isVirtualSpacerRow(l)).forEach(l=>{const d=Array.from(l.cells);s.map(f=>d[f]).filter(Boolean).forEach(f=>l.appendChild(f))}),this._columnWidths.clear()}_moveColumn(t,a){if(!this._table)return!1;const e=this._table.tHead?.rows[0],r=this._table.tBodies[0];if(!e||!r)return!1;const i=Array.from(e.cells),s=i.length;if(!s||t<0||t>=s||a<0||a>=s||t===a)return!1;const o=Array.from({length:s},(l,d)=>d),[n]=o.splice(t,1);o.splice(a,0,n),o.map(l=>i[l]).forEach(l=>e.appendChild(l)),Array.from(r.rows).filter(l=>!this._isVirtualSpacerRow(l)).forEach(l=>{const d=Array.from(l.cells);o.map(f=>d[f]).filter(Boolean).forEach(f=>l.appendChild(f))});const c=new Map;return o.forEach((l,d)=>{const h=this._columnWidths.get(l);typeof h=="number"&&c.set(d,h)}),this._columnWidths=c,this._sortColumnIndex>=0&&(this._sortColumnIndex=o.indexOf(this._sortColumnIndex)),this._syncHeaderState(),this._applyPinnedColumns(),this._syncRowSelectionState(),!0}_clearDragMarkers(){this._headerCells().forEach(a=>{a.removeAttribute("data-dragging"),a.removeAttribute("data-drag-over")}),this._dragOverColumnIndex=-1}_emitColumnOrderChange(t,a){const e=this._currentColumnOrderString();this._setColumnOrderAttribute(e),this.dispatchEvent(new CustomEvent("column-order-change",{detail:{sourceIndex:t,targetIndex:a,order:e,keys:this._headerCells().map((r,i)=>this._headerKey(r,i))},bubbles:!0}))}_focusHeaderAt(t){const e=this._headerCells()[t];e&&e.focus()}_focusSelectableRow(t,a){const e=this._bodyRows().filter(o=>!o.hidden),r=e.indexOf(t);if(r<0)return;const i=Math.min(e.length-1,Math.max(0,r+a)),s=e[i];s&&s.focus()}_headerKeyboardShortcuts(t,a){const e=this._isRtl(),r=e?"ArrowRight":"ArrowLeft",i=e?"ArrowLeft":"ArrowRight",s=[r,i,"Home","End"];return t&&s.push("Enter","Space"),a&&s.push(`Alt+${r}`,`Alt+${i}`),s.join(" ")}_syncScrollRegion(){const t=this._frameEl;if(!t)return;const a=t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1,e=!!this._table?.querySelector('[tabindex="0"], a[href], button, input, select, textarea');if(a&&!e){t.setAttribute("tabindex","0"),t.setAttribute("role","region"),t.setAttribute("data-scroll-region","");const r=(this.getAttribute("aria-label")||"").trim();t.setAttribute("aria-label",r?`${r}, scrollable`:"Scrollable table")}else t.hasAttribute("data-scroll-region")&&(t.removeAttribute("tabindex"),t.removeAttribute("role"),t.removeAttribute("aria-label"),t.removeAttribute("data-scroll-region"))}_watchScrollRegion(){this._scrollObserver?.disconnect(),this._scrollObserver=null,!(!this._frameEl||typeof ResizeObserver>"u")&&(this._scrollObserver=new ResizeObserver(()=>this._syncScrollRegion()),this._scrollObserver.observe(this._frameEl),this._table&&this._scrollObserver.observe(this._table))}_syncStructure(){if(!this._isSyncing){this._isSyncing=!0;try{this._table=this._findTable();const t=this.root.querySelector(".frame");this._frameEl!==t&&(this._frameEl&&this._frameEl.removeEventListener("scroll",this._onFrameScroll),this._frameEl=t,this._frameEl&&this._frameEl.addEventListener("scroll",this._onFrameScroll,{passive:!0}),this._watchScrollRegion());const a=this.root.querySelector(".empty"),e=this.root.querySelector(".summary");if(this._syncEmptyText(),!this._table){a&&a.removeAttribute("hidden"),e&&(e.textContent=""),this._selectedRows.clear(),this._page=1,this._pageCount=1,this._totalRows=0,this._filteredRows=0,this._clearVirtualization(!1),this._syncPaginationElement(),this._syncStateBar();return}a&&a.setAttribute("hidden",""),this._table.hasAttribute("data-ui-data-table")||this._table.setAttribute("data-ui-data-table","true"),this._table.hasAttribute("role")||this._table.setAttribute("role","table"),this._applyColumnOrder(),this._syncHeaderState(),this._applyPinnedColumns(),this._table.setAttribute("aria-colcount",String(this._headerCells().length||0)),this._applyPagination(!1),a&&(this._filteredRows>0?a.setAttribute("hidden",""):(this._syncEmptyText(),a.removeAttribute("hidden"))),this._applyVirtualization(!1),this._syncRowSelectionState(),this._updateBulkActions(),this._updateSummary(),this._syncPaginationElement(),this._syncStateBar()}finally{this._isSyncing=!1}}}_syncHeaderState(){const t=this.hasAttribute("sortable"),a=this.hasAttribute("draggable-columns"),e=this.hasAttribute("resizable-columns"),r=this._headerKeyboardShortcuts(t,a);this._headerCells().forEach((s,o)=>{if(s.setAttribute("data-col-index",String(o)),s.setAttribute("scope","col"),s.setAttribute("aria-colindex",String(o+1)),t||a?s.setAttribute("aria-keyshortcuts",r):s.removeAttribute("aria-keyshortcuts"),t?s.setAttribute("data-sortable","true"):s.removeAttribute("data-sortable"),t||a?s.hasAttribute("tabindex")||s.setAttribute("tabindex","0"):s.getAttribute("tabindex")==="0"&&s.removeAttribute("tabindex"),o===this._sortColumnIndex&&t?s.setAttribute("aria-sort",this._sortDirection==="asc"?"ascending":"descending"):t?s.setAttribute("aria-sort","none"):s.removeAttribute("aria-sort"),a?(s.setAttribute("data-draggable","true"),s.setAttribute("draggable","true"),s.setAttribute("aria-description","Draggable column header")):(s.removeAttribute("data-draggable"),s.removeAttribute("draggable"),s.removeAttribute("data-dragging"),s.removeAttribute("data-drag-over"),s.removeAttribute("aria-description")),e){s.setAttribute("data-resizable","true");let n=s.querySelector(".resize-handle");n||(n=document.createElement("button"),n.type="button",n.className="resize-handle",n.setAttribute("aria-hidden","true"),n.tabIndex=-1,s.appendChild(n)),n.setAttribute("data-col-index",String(o));const u=this._columnWidths.get(o);typeof u=="number"&&this._setColumnWidth(o,u,!1)}else{s.removeAttribute("data-resizable");const n=s.querySelector(".resize-handle");n&&n.remove()}})}_applyPagination(t){const a=this._bodyRows();this._pageSize=this._parsePageSize(),this._totalRows=a.length;const e=this._parseFilterQuery(),r=this._headerCells(),i=this._resolveFilterColumnIndex(r),s=this._parseFilters(r),o=a.filter(d=>this._rowMatchesFilter(d,e,i,s));this._filteredRows=o.length,this._table?.setAttribute("aria-rowcount",String(this._filteredRows));const n=this._parsePage();this._pageCount=Math.max(1,Math.ceil(o.length/this._pageSize)),this._page=Math.min(this._pageCount,Math.max(1,n)),this._page!==n&&this._setPageAttribute(this._page);const u=(this._page-1)*this._pageSize,c=u+this._pageSize,l=new Set(o);if(a.forEach(d=>{l.has(d)?d.removeAttribute("data-hidden-by-filter"):(d.hidden=!0,d.setAttribute("data-hidden-by-filter",""),d.removeAttribute("data-hidden-by-page"),d.removeAttribute("aria-rowindex"))}),o.forEach((d,h)=>{const f=h>=u&&h<c;d.hidden=!f,f?d.removeAttribute("data-hidden-by-page"):d.setAttribute("data-hidden-by-page",""),d.setAttribute("aria-rowindex",String(h+1))}),t){const d=o.length,h=d===0?0:u+1,f=Math.min(c,d);this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this._page,count:this._pageCount,pageSize:this._pageSize,total:d,start:h,end:f},bubbles:!0}))}}_clearVirtualization(t){this._virtualRaf&&(cancelAnimationFrame(this._virtualRaf),this._virtualRaf=0),this._clearVirtualSpacers(),t&&this._bodyRows().forEach(a=>{a.style.display==="none"&&(a.style.display=""),a.removeAttribute("data-hidden-by-virtual")})}_ensureVirtualSpacer(t){if(!this._table)return null;const a=this._table.tBodies[0];if(!a)return null;const e=t==="top"?this._virtualTopSpacer:this._virtualBottomSpacer;if(e&&e.isConnected)return e;const r=document.createElement("tr");r.setAttribute("data-virtual-spacer",t),r.setAttribute("aria-hidden","true"),r.setAttribute("role","presentation"),r.style.pointerEvents="none";const i=document.createElement("td");return i.style.padding="0",i.style.border="0",i.style.height="0px",i.style.lineHeight="0",i.style.fontSize="0",i.innerHTML=" ",r.appendChild(i),t==="top"?(a.insertBefore(r,a.firstChild),this._virtualTopSpacer=r):(a.appendChild(r),this._virtualBottomSpacer=r),r}_setVirtualSpacerHeight(t,a,e){if(!t)return;const r=t.cells[0]||t.appendChild(document.createElement("td"));r.colSpan!==Math.max(1,e)&&(r.colSpan=Math.max(1,e)),r.style.padding="0",r.style.border="0",r.style.height=`${Math.max(0,Math.round(a))}px`,r.style.lineHeight="0",r.style.fontSize="0"}_applyVirtualization(t){if(!this.hasAttribute("virtualize")||!this._frameEl||!this._table){this._clearVirtualization(!0);return}const e=this._bodyRows().filter(g=>!g.hidden);if(!e.length){this._clearVirtualization(!0);return}const r=this._parseRowHeight(),i=this._parseOverscan(),s=this._frameEl.clientHeight||r*8,o=this._frameEl.scrollTop,n=Math.max(0,Math.floor(o/r)-i),u=Math.min(e.length,Math.ceil((o+s)/r)+i),c=n*r,l=Math.max(0,(e.length-u)*r),d=Math.max(1,this._headerCells().length||e[0]?.cells.length||1),h=this._ensureVirtualSpacer("top"),f=this._ensureVirtualSpacer("bottom");this._setVirtualSpacerHeight(h,c,d),this._setVirtualSpacerHeight(f,l,d);const y=(g,v)=>{v?(g.style.display==="none"&&(g.style.display=""),g.removeAttribute("data-hidden-by-virtual")):(g.style.display!=="none"&&(g.style.display="none"),g.setAttribute("data-hidden-by-virtual",""))};if(!(this._virtualStart>=0&&this._virtualEnd>=this._virtualStart&&this._virtualVisibleTotal===e.length))e.forEach((g,v)=>{y(g,v>=n&&v<u)});else{const g=this._virtualStart,v=this._virtualEnd;for(let b=g;b<Math.min(n,v);b+=1){const _=e[b];_&&y(_,!1)}for(let b=n;b<Math.min(g,u);b+=1){const _=e[b];_&&y(_,!0)}for(let b=Math.max(u,g);b<v;b+=1){const _=e[b];_&&y(_,!1)}for(let b=Math.max(v,n);b<u;b+=1){const _=e[b];_&&y(_,!0)}}this._virtualStart=n,this._virtualEnd=u,this._virtualVisibleTotal=e.length,t&&this.dispatchEvent(new CustomEvent("virtual-range-change",{detail:{start:n,end:Math.max(n,u-1),visible:Math.max(0,u-n),total:e.length},bubbles:!0}))}_updateSummary(){const t=this.root.querySelector(".summary");if(!t)return;const a=this._totalRows,e=this._filteredRows;if(!a||!e){t.textContent="No records";return}const r=(this._page-1)*this._pageSize+1,i=Math.min(this._page*this._pageSize,e);if(e===a){t.textContent=`Showing ${r}-${i} of ${a}`;return}t.textContent=`Showing ${r}-${i} of ${e} filtered records (${a} total)`}_syncEmptyText(){const t=this.root.querySelector(".empty");if(!t)return;const a=!!this._parseFilterQuery();if(this._table&&this._filteredRows===0&&a){t.textContent="No matching records.";return}t.textContent=this.getAttribute("empty-text")||"No data available."}_dispatchFilterChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{query:this.getAttribute("filter-query")||"",filters:this.getAttribute("filters")||"",total:this._totalRows,filtered:this._filteredRows,page:this._page,count:this._pageCount},bubbles:!0}))}_parseComparable(t){const a=t.replace(/,/g,"").trim();return/^-?\d+(\.\d+)?$/.test(a)?Number(a):t.toLowerCase()}_rulePasses(t,a){const e=a.op,r=a.value,i=t.trim(),s=i.toLowerCase();if(e==="empty")return i.length===0;if(e==="notempty"||e==="not-empty")return i.length>0;if(e==="equals"||e==="eq")return s===String(r??"").toLowerCase();if(e==="neq"||e==="not-equals")return s!==String(r??"").toLowerCase();if(e==="startswith"||e==="starts-with")return s.startsWith(String(r??"").toLowerCase());if(e==="endswith"||e==="ends-with")return s.endsWith(String(r??"").toLowerCase());if(e==="in")return(Array.isArray(r)?r.map(n=>String(n).toLowerCase()):String(r??"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)).includes(s);if(e==="gt"||e==="gte"||e==="lt"||e==="lte"||e==="between"){const o=this._parseComparable(i);if(typeof o!="number")return!1;if(e==="between"){const u=Array.isArray(r)?r:String(r??"").split(","),c=Number(u[0]),l=Number(u[1]);return!Number.isFinite(c)||!Number.isFinite(l)?!1:o>=Math.min(c,l)&&o<=Math.max(c,l)}const n=Number(r);return Number.isFinite(n)?e==="gt"?o>n:e==="gte"?o>=n:e==="lt"?o<n:o<=n:!1}return s.includes(String(r??"").toLowerCase())}_rowMatchesFilter(t,a,e,r){if(a){const i=e>=0?p(t.cells[e]):Array.from(t.cells).map(n=>p(n)).join(" ");if(!i)return!1;const s=i.toLowerCase(),o=a.split(/\s+/).filter(Boolean);if(o.length&&!o.every(n=>s.includes(n)))return!1}return r.length?r.every(i=>{const s=t.cells[i.columnIndex];return this._rulePasses(p(s),i)}):!0}_setColumnWidth(t,a,e=!0){if(!this._table)return;const r=Math.max(72,Math.round(a));if(this._columnWidths.set(t,r),Array.from(this._table.rows).forEach(o=>{const n=o.cells[t];n&&(n.style.width=`${r}px`,n.style.minWidth=`${r}px`,n.style.maxWidth=`${r}px`,n.style.boxSizing="border-box")}),!e)return;this._applyPinnedColumns();const s=this._headerCells()[t];this.dispatchEvent(new CustomEvent("column-resize",{detail:{columnIndex:t,key:s?.getAttribute("data-key")||p(s)||`column-${t+1}`,width:r},bubbles:!0}))}_onPointerDown(t){if(!this.hasAttribute("resizable-columns")||!this._table)return;const e=t.target.closest(".resize-handle");if(!e||!this._table.contains(e))return;const r=Number(e.getAttribute("data-col-index"));if(!Number.isInteger(r)||r<0)return;const i=this._headerCells()[r];if(!i)return;t.preventDefault();const s=i.getBoundingClientRect().width;this._resizeState={columnIndex:r,startX:t.clientX,startWidth:s},window.addEventListener("pointermove",this._onPointerMove),window.addEventListener("pointerup",this._onPointerUp)}_onPointerMove(t){if(!this._resizeState)return;const a=t.clientX-this._resizeState.startX,e=this._isRtl()?-a:a;this._pendingResizeColumn=this._resizeState.columnIndex,this._pendingResizeWidth=this._resizeState.startWidth+e,this._setColumnWidth(this._pendingResizeColumn,this._pendingResizeWidth,!1)}_onPointerUp(){if(!this._resizeState)return;const t=this._resizeState;this._resizeState=null,this._resizeRaf&&(cancelAnimationFrame(this._resizeRaf),this._resizeRaf=0),this._pendingResizeColumn===t.columnIndex&&this._pendingResizeWidth!=null&&this._setColumnWidth(t.columnIndex,this._pendingResizeWidth,!1),this._pendingResizeColumn=-1,this._pendingResizeWidth=null,window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp);const a=this._headerCells()[t.columnIndex];if(!a)return;const e=a.getBoundingClientRect().width;this._setColumnWidth(t.columnIndex,e,!0)}_onFrameScroll(){this.hasAttribute("virtualize")&&(this._virtualRaf||(this._virtualRaf=requestAnimationFrame(()=>{this._virtualRaf=0,this._applyVirtualization(!0)})))}_onDragStart(t){if(!this.hasAttribute("draggable-columns")||!this._table)return;const a=t.target;if(a.closest(".resize-handle")){t.preventDefault();return}const e=a.closest("th");if(!e||!this._table.contains(e))return;const i=this._headerCells().indexOf(e);i<0||(this._dragColumnIndex=i,this._dragOverColumnIndex=i,this._clearDragMarkers(),e.setAttribute("data-dragging","true"),t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",String(i))))}_onDragOver(t){if(!this.hasAttribute("draggable-columns")||!this._table||this._dragColumnIndex<0)return;const e=t.target.closest("th");if(!e||!this._table.contains(e))return;const r=this._headerCells(),i=r.indexOf(e);if(i<0||(t.preventDefault(),this._dragOverColumnIndex===i))return;this._clearDragMarkers(),this._dragOverColumnIndex=i,e.setAttribute("data-drag-over","true");const s=r[this._dragColumnIndex];s&&s.setAttribute("data-dragging","true")}_onDrop(t){if(!this.hasAttribute("draggable-columns")||!this._table||this._dragColumnIndex<0)return;const e=t.target.closest("th");if(!e||!this._table.contains(e))return;const i=this._headerCells().indexOf(e);if(i<0)return;t.preventDefault();const s=this._dragColumnIndex,o=this._moveColumn(s,i);this._clearDragMarkers(),this._dragColumnIndex=-1,this._ignoreHeaderClickUntil=Date.now()+220,o&&(this._applyVirtualization(!1),this._emitColumnOrderChange(s,i))}_onDragEnd(){this._clearDragMarkers(),this._dragColumnIndex=-1}_rowValues(t){const a=this._headerCells(),e=Array.from(t.cells),r={};return e.forEach((i,s)=>{const o=a[s],n=(o?.getAttribute("data-key")||p(o||void 0)||`col_${s+1}`).toLowerCase().replace(/[^a-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");r[n||`col_${s+1}`]=p(i)}),r}_syncRowSelectionState(){const t=this.hasAttribute("selectable"),a=this._bodyRows();for(const e of Array.from(this._selectedRows))a.includes(e)||this._selectedRows.delete(e);a.forEach(e=>{const r=!e.hidden;t&&r?(e.setAttribute("aria-selected",this._selectedRows.has(e)?"true":"false"),e.setAttribute("aria-keyshortcuts","ArrowUp ArrowDown Home End Enter Space"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"),this._selectedRows.has(e)?e.setAttribute("data-selected","true"):e.removeAttribute("data-selected")):(e.removeAttribute("aria-selected"),e.removeAttribute("aria-keyshortcuts"),e.removeAttribute("data-selected"),e.getAttribute("tabindex")==="0"&&e.removeAttribute("tabindex"))})}_toggleRowSelection(t){const a=this.hasAttribute("multi-select"),e=this._selectedRows.has(t);a||this._selectedRows.clear(),e&&a?this._selectedRows.delete(t):this._selectedRows.add(t),this._syncRowSelectionState(),this._updateBulkActions();const r=this._bodyRows(),i=r.flatMap((o,n)=>this._selectedRows.has(o)?[n]:[]),s=r.filter(o=>this._selectedRows.has(o)).map(o=>this._rowValues(o));this.dispatchEvent(new CustomEvent("row-select",{detail:{index:r.indexOf(t),selected:this._selectedRows.has(t),indices:i,rows:s,page:this._page},bubbles:!0}))}_sortByColumn(t,a){if(!this._table)return;const e=this._table.tBodies[0];if(!e)return;this._sortColumnIndex===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortColumnIndex=t,this._sortDirection="asc"),Array.from(e.rows).filter(o=>!this._isVirtualSpacerRow(o)).map((o,n)=>({row:o,rowIndex:n,value:E(p(o.cells[t]))})).sort((o,n)=>{const u=o.value,c=n.value;let l=0;return typeof u=="number"&&typeof c=="number"?l=u-c:l=String(u).localeCompare(String(c),void 0,{numeric:!0,sensitivity:"base"}),l===0&&(l=o.rowIndex-n.rowIndex),this._sortDirection==="asc"?l:-l}).map(o=>o.row).forEach(o=>e.appendChild(o)),this._syncHeaderState(),this._applyPagination(!1),this._syncRowSelectionState(),this._updateSummary(),this._syncPaginationElement();const s=a.getAttribute("data-key")||p(a)||`column-${t+1}`;this.dispatchEvent(new CustomEvent("sort-change",{detail:{columnIndex:t,key:s,direction:this._sortDirection,page:this._page},bubbles:!0}))}_detachPaginationListener(){this._paginationEl&&(this._paginationEl.removeEventListener("change",this._onPaginationChange),this._paginationEl=null)}_syncPaginationBinding(){this._detachPaginationListener();const t=this.getAttribute("pagination-id");if(!t)return;const a=document.getElementById(t);a&&(this._paginationEl=a,this._paginationEl.addEventListener("change",this._onPaginationChange),this._syncPaginationElement())}_syncPaginationElement(){this._paginationEl&&(this._paginationEl.setAttribute("count",String(this._pageCount||1)),this._paginationEl.setAttribute("page",String(this._page||1)))}_onPaginationChange(t){const a=t.detail,e=Number(a?.page);Number.isFinite(e)&&e!==this._page&&(this._setPageAttribute(e),this._applyPagination(!0),this._syncRowSelectionState(),this._updateSummary(),this._syncPaginationElement())}_onClick(t){if(!this._table)return;const e=t.composedPath().find(i=>i instanceof HTMLElement)||t.target;if(e.closest(".bulk-clear")){const i=this._selectedRows.size;i>0&&(this._selectedRows.clear(),this._syncRowSelectionState(),this._updateBulkActions(),this.dispatchEvent(new CustomEvent("bulk-clear",{detail:{count:i,page:this._page},bubbles:!0})));return}if(!e.closest(".resize-handle")&&!(e.closest("th")&&Date.now()<this._ignoreHeaderClickUntil)&&!this._isInteractionBlocked()){if(this.hasAttribute("sortable")){const i=e.closest("th");if(i&&this._table.contains(i)){if(e!==i&&this._isInteractiveTarget(e))return;const o=this._headerCells().indexOf(i);if(o>=0){this._sortByColumn(o,i);return}}}if(this.hasAttribute("selectable")){const i=e.closest("tbody tr");if(i&&this._table.contains(i)&&!i.hidden&&!this._isVirtualSpacerRow(i)){if(e!==i&&this._isInteractiveTarget(e))return;this._toggleRowSelection(i)}}}}_onKeyDown(t){if(!this._table)return;const a=t.key,e=t.target;if(a==="Escape"&&this._selectedRows.size){const i=this._selectedRows.size;this._selectedRows.clear(),this._syncRowSelectionState(),this._updateBulkActions(),this.dispatchEvent(new CustomEvent("bulk-clear",{detail:{count:i,page:this._page},bubbles:!0}));return}if(this._isInteractionBlocked())return;const r=e.closest("th");if(r&&this._table.contains(r)){const i=this._headerCells(),s=i.indexOf(r);if(s>=0){const n=this._isRtl()?-1:1,u=-n;if(a==="ArrowRight"||a==="ArrowLeft"){t.preventDefault();const c=a==="ArrowRight"?n:u,l=Math.max(0,Math.min(i.length-1,s+c));if(t.altKey&&this.hasAttribute("draggable-columns")&&l!==s){this._moveColumn(s,l)&&(this._ignoreHeaderClickUntil=Date.now()+220,this._emitColumnOrderChange(s,l),this._applyVirtualization(!1),this._focusHeaderAt(l));return}this._focusHeaderAt(l);return}if(a==="Home"||a==="End"){t.preventDefault(),this._focusHeaderAt(a==="Home"?0:i.length-1);return}if((a==="Enter"||a===" ")&&this.hasAttribute("sortable")){if(e!==r&&this._isInteractiveTarget(e))return;t.preventDefault(),this._sortByColumn(s,r);return}}}if(this.hasAttribute("selectable")){const i=e.closest("tbody tr");if(i&&this._table.contains(i)&&!i.hidden&&!this._isVirtualSpacerRow(i)){if(e!==i&&this._isInteractiveTarget(e))return;if(a==="ArrowDown"||a==="ArrowUp"){t.preventDefault(),this._focusSelectableRow(i,a==="ArrowDown"?1:-1);return}if(a==="Home"||a==="End"){t.preventDefault();const s=this._bodyRows().filter(n=>!n.hidden),o=a==="Home"?s[0]:s[s.length-1];o&&o.focus();return}(a==="Enter"||a===" ")&&(t.preventDefault(),this._toggleRowSelection(i))}}}_updateBulkActions(){const t=this.root.querySelector(".bulk");if(!t)return;const a=this.hasAttribute("selectable"),e=this._selectedRows.size;if(!(a&&e>0)){t.setAttribute("hidden","");return}t.removeAttribute("hidden");const i=this.getAttribute("bulk-actions-label")||"{count} selected",s=this.getAttribute("bulk-clear-label")||"Clear selection",o=t.querySelector(".bulk-count");o&&(o.textContent=i.replace("{count}",String(e)));const n=t.querySelector(".bulk-clear");n&&(n.textContent=s)}shouldRenderOnAttributeChange(t,a,e){return!1}}typeof customElements<"u"&&!customElements.get("ui-data-table")&&customElements.define("ui-data-table",C);exports.UIDataTable=C;
|