@editora/ui-core 0.1.25 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +76 -45
- package/dist/alert-dialog.esm.js +179 -135
- package/dist/alert.cjs.js +41 -32
- package/dist/alert.esm.js +79 -70
- 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 +4 -4
- package/dist/animated-text.esm.js +4 -4
- package/dist/app-header.cjs.js +5 -5
- package/dist/app-header.esm.js +6 -6
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +13 -17
- package/dist/avatar.esm.js +13 -17
- 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-B3PUKHQm.mjs → calendar-DmxiZrR7.mjs} +126 -117
- package/dist/{calendar-D-mXMgqc.js → calendar-o273O28D.js} +53 -44
- 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 +52 -52
- package/dist/chart.esm.js +95 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +7 -11
- package/dist/collapsible.esm.js +7 -11
- package/dist/color-picker.cjs.js +36 -17
- package/dist/color-picker.esm.js +132 -113
- package/dist/combobox.cjs.js +57 -54
- package/dist/combobox.esm.js +62 -58
- 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-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-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-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-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 +18 -15
- package/dist/data-table.esm.js +207 -187
- package/dist/date-field.cjs.js +8 -8
- package/dist/date-field.esm.js +7 -7
- package/dist/date-picker.cjs.js +27 -18
- package/dist/date-picker.esm.js +57 -48
- package/dist/date-range-picker.cjs.js +22 -17
- package/dist/date-range-picker.esm.js +31 -26
- package/dist/date-range-time-picker.cjs.js +26 -19
- package/dist/date-range-time-picker.esm.js +23 -16
- package/dist/date-time-picker.cjs.js +23 -16
- package/dist/date-time-picker.esm.js +88 -81
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-B4hAkt36.mjs} +75 -68
- package/dist/date-time-utils-DdigV4hs.js +1 -0
- package/dist/dialog.cjs.js +57 -41
- package/dist/dialog.esm.js +84 -51
- 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.cjs.js +22 -13
- package/dist/field.esm.js +54 -45
- package/dist/fieldset.cjs.js +18 -11
- package/dist/fieldset.esm.js +20 -13
- package/dist/file-upload.cjs.js +77 -35
- package/dist/file-upload.esm.js +152 -110
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +20 -23
- package/dist/form.esm.js +20 -23
- package/dist/gantt.cjs.js +6 -6
- package/dist/gantt.esm.js +6 -6
- package/dist/hover-card.cjs.js +7 -7
- package/dist/hover-card.esm.js +7 -7
- 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 +47 -19
- package/dist/inline-edit.esm.js +66 -38
- package/dist/input.cjs.js +44 -37
- package/dist/input.esm.js +59 -52
- 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/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 +48 -35
- package/dist/multi-select.esm.js +67 -53
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +27 -16
- package/dist/number-field.esm.js +36 -25
- package/dist/odometer.cjs.js +5 -5
- package/dist/odometer.esm.js +3 -3
- 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 +38 -33
- package/dist/password-field.esm.js +62 -57
- package/dist/pin-input.cjs.js +17 -13
- package/dist/pin-input.esm.js +23 -19
- 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.d.ts +3 -1
- package/dist/portal.d.ts.map +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/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 +13 -13
- package/dist/quick-actions.esm.js +11 -11
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +15 -12
- package/dist/radio.esm.js +15 -12
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-CQM6wZOc.mjs} +498 -514
- package/dist/runtime-DxCl0A5q.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 +40 -73
- package/dist/select.esm.js +55 -87
- 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/sidebar.cjs.js +22 -22
- package/dist/sidebar.esm.js +25 -25
- 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/sortable.cjs.js +4 -5
- package/dist/sortable.esm.js +4 -5
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +5 -5
- package/dist/split-button.esm.js +15 -14
- 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 +91 -21
- package/dist/tabs.esm.js +182 -112
- package/dist/tags-input.cjs.js +41 -15
- package/dist/tags-input.esm.js +73 -47
- package/dist/textarea.cjs.js +32 -33
- package/dist/textarea.esm.js +38 -39
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +7 -7
- package/dist/time-field.esm.js +6 -6
- package/dist/time-picker.cjs.js +16 -13
- package/dist/time-picker.esm.js +27 -24
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- 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 +28 -29
- package/dist/transfer-list.esm.js +28 -29
- 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 +39 -36
- package/dist/wizard.esm.js +39 -36
- 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/data-table.esm.js
CHANGED
|
@@ -5,22 +5,22 @@ const A = `
|
|
|
5
5
|
/* A wide table scrolls inside its own frame. Without this a grid or flex parent grows to the table's width. */
|
|
6
6
|
min-inline-size: 0;
|
|
7
7
|
max-inline-size: 100%;
|
|
8
|
-
--ui-data-table-radius:
|
|
9
|
-
--ui-data-table-border-color: var(--ui-color-border, rgba(15, 23, 42, 0.14));
|
|
8
|
+
--ui-data-table-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
9
|
+
--ui-data-table-border-color: var(--ui-color-line-subtle, var(--ui-color-border, rgba(15, 23, 42, 0.14)));
|
|
10
10
|
--ui-data-table-border: 1px solid var(--ui-data-table-border-color);
|
|
11
|
-
--ui-data-table-bg: var(--ui-color-surface,
|
|
11
|
+
--ui-data-table-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
12
12
|
--ui-data-table-shadow: none;
|
|
13
13
|
--ui-data-table-empty-color: var(--ui-color-muted, #526175);
|
|
14
14
|
--ui-data-table-summary-color: var(--ui-color-muted, #475569);
|
|
15
15
|
--ui-data-table-text: var(--ui-color-text, #0f172a);
|
|
16
16
|
--ui-data-table-header-text: var(--ui-color-text, #1e293b);
|
|
17
|
-
--ui-data-table-header-bg: var(--ui-color-surface-alt, #f8fafc);
|
|
17
|
+
--ui-data-table-header-bg: var(--ui-color-surface-subtle, var(--ui-color-surface-alt, #f8fafc));
|
|
18
18
|
--ui-data-table-footer-text: var(--ui-color-text, #0f172a);
|
|
19
|
-
--ui-data-table-footer-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 88%, var(--ui-color-surface, #ffffff));
|
|
19
|
+
--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)));
|
|
20
20
|
--ui-data-table-cell-border: color-mix(in srgb, var(--ui-data-table-border-color) 58%, transparent);
|
|
21
|
-
--ui-data-table-striped-bg: color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 82%, transparent);
|
|
22
|
-
--ui-data-table-hover-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, transparent);
|
|
23
|
-
--ui-data-table-selected-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 20%, transparent);
|
|
21
|
+
--ui-data-table-striped-bg: var(--ui-color-surface-subtle, color-mix(in srgb, var(--ui-color-surface-alt, #f8fafc) 82%, transparent));
|
|
22
|
+
--ui-data-table-hover-bg: var(--ui-color-fill, color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, transparent));
|
|
23
|
+
--ui-data-table-selected-bg: var(--ui-color-accent-fill, color-mix(in srgb, var(--ui-color-primary, #2563eb) 20%, transparent));
|
|
24
24
|
--ui-data-table-sort-indicator: color-mix(in srgb, var(--ui-color-muted, #94a3b8) 80%, transparent);
|
|
25
25
|
--ui-data-table-sort-active: var(--ui-color-primary, #2563eb);
|
|
26
26
|
--ui-data-table-resize-handle: color-mix(in srgb, var(--ui-color-muted, #94a3b8) 70%, transparent);
|
|
@@ -40,13 +40,16 @@ const A = `
|
|
|
40
40
|
overflow: auto;
|
|
41
41
|
border: var(--ui-data-table-border);
|
|
42
42
|
border-radius: var(--ui-data-table-radius);
|
|
43
|
-
background:
|
|
44
|
-
linear-gradient(180deg, color-mix(in srgb, var(--ui-data-table-bg) 96%, #ffffff 4%), var(--ui-data-table-bg)),
|
|
45
|
-
var(--ui-data-table-bg);
|
|
43
|
+
background: var(--ui-data-table-bg);
|
|
46
44
|
box-shadow: var(--ui-data-table-shadow);
|
|
47
45
|
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);
|
|
48
46
|
}
|
|
49
47
|
|
|
48
|
+
.frame[data-scroll-region]:focus-visible {
|
|
49
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-data-table-focus-ring, #2563eb));
|
|
50
|
+
outline-offset: -2px;
|
|
51
|
+
}
|
|
52
|
+
|
|
50
53
|
.frame::before {
|
|
51
54
|
content: '';
|
|
52
55
|
position: absolute;
|
|
@@ -549,12 +552,12 @@ const A = `
|
|
|
549
552
|
}
|
|
550
553
|
|
|
551
554
|
ui-data-table[loading]:not([headless]) > table tbody {
|
|
552
|
-
opacity: 0.
|
|
555
|
+
opacity: 0.7;
|
|
553
556
|
pointer-events: none;
|
|
554
557
|
}
|
|
555
558
|
|
|
556
559
|
ui-data-table[state="loading"]:not([headless]) > table tbody {
|
|
557
|
-
opacity: 0.
|
|
560
|
+
opacity: 0.7;
|
|
558
561
|
pointer-events: none;
|
|
559
562
|
}
|
|
560
563
|
|
|
@@ -677,7 +680,7 @@ function S(m) {
|
|
|
677
680
|
const a = Date.parse(m);
|
|
678
681
|
return !Number.isNaN(a) && /[-/]/.test(m) ? a : m.toLowerCase();
|
|
679
682
|
}
|
|
680
|
-
const
|
|
683
|
+
const E = /* @__PURE__ */ new Set([
|
|
681
684
|
"sticky-header",
|
|
682
685
|
"sticky-footer",
|
|
683
686
|
"striped",
|
|
@@ -690,7 +693,7 @@ const k = /* @__PURE__ */ new Set([
|
|
|
690
693
|
"shape",
|
|
691
694
|
"variant",
|
|
692
695
|
"elevation"
|
|
693
|
-
]),
|
|
696
|
+
]), k = /* @__PURE__ */ new Set([
|
|
694
697
|
"pagination-id",
|
|
695
698
|
"bulk-actions-label",
|
|
696
699
|
"bulk-clear-label",
|
|
@@ -698,7 +701,7 @@ const k = /* @__PURE__ */ new Set([
|
|
|
698
701
|
]);
|
|
699
702
|
class R extends C {
|
|
700
703
|
constructor() {
|
|
701
|
-
super(), this._table = null, this._observer = null, this._sortColumnIndex = -1, this._sortDirection = "asc", this._selectedRows = /* @__PURE__ */ 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 = /* @__PURE__ */ new Map(), this._frameEl = 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);
|
|
704
|
+
super(), this._table = null, this._observer = null, this._sortColumnIndex = -1, this._sortDirection = "asc", this._selectedRows = /* @__PURE__ */ 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 = /* @__PURE__ */ 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);
|
|
702
705
|
}
|
|
703
706
|
static get observedAttributes() {
|
|
704
707
|
return [
|
|
@@ -747,7 +750,7 @@ class R extends C {
|
|
|
747
750
|
}), this._syncPaginationBinding();
|
|
748
751
|
}
|
|
749
752
|
disconnectedCallback() {
|
|
750
|
-
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(), super.disconnectedCallback();
|
|
753
|
+
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();
|
|
751
754
|
}
|
|
752
755
|
attributeChangedCallback(t, a, e) {
|
|
753
756
|
if (a !== e && !(t === "column-order" && this._isSettingColumnOrder) && !(t === "page" && this._isSettingPage)) {
|
|
@@ -760,11 +763,11 @@ class R extends C {
|
|
|
760
763
|
return;
|
|
761
764
|
}
|
|
762
765
|
if (this.isConnected) {
|
|
763
|
-
if (
|
|
766
|
+
if (k.has(t)) {
|
|
764
767
|
t === "pagination-id" ? this._syncPaginationBinding() : t === "bulk-actions-label" || t === "bulk-clear-label" ? this._updateBulkActions() : t === "state-text" && this._syncStateBar();
|
|
765
768
|
return;
|
|
766
769
|
}
|
|
767
|
-
if (
|
|
770
|
+
if (E.has(t)) {
|
|
768
771
|
t === "hide-summary" ? this._updateSummary() : (t === "state" || t === "loading") && this._syncStateBar();
|
|
769
772
|
return;
|
|
770
773
|
}
|
|
@@ -842,14 +845,14 @@ class R extends C {
|
|
|
842
845
|
return a || (t === "loading" ? "Refreshing table data" : t === "error" ? "Table data could not be loaded" : t === "success" ? "Table data is up to date" : "");
|
|
843
846
|
}
|
|
844
847
|
_syncStateBar() {
|
|
845
|
-
const t = this.root.querySelector(".statebar"), a = this.root.querySelector(".state-text"), e = this.root.querySelector(".loading-text"),
|
|
848
|
+
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;
|
|
846
849
|
if (!t) return;
|
|
847
850
|
const s = this._state();
|
|
848
851
|
s !== "idle" ? t.removeAttribute("hidden") : t.setAttribute("hidden", ""), t.setAttribute("data-state", s), t.setAttribute("aria-live", s === "error" ? "assertive" : "polite");
|
|
849
852
|
const n = this._stateText(s);
|
|
850
853
|
a && (a.textContent = n), e && (e.textContent = this._stateText("loading"));
|
|
851
854
|
const u = s === "loading" ? "true" : "false";
|
|
852
|
-
|
|
855
|
+
r && r.setAttribute("aria-busy", u), i && i.setAttribute("aria-busy", u);
|
|
853
856
|
}
|
|
854
857
|
_isInteractionBlocked() {
|
|
855
858
|
return this._state() === "loading";
|
|
@@ -865,8 +868,8 @@ class R extends C {
|
|
|
865
868
|
if (!t) return `column-${a + 1}`;
|
|
866
869
|
const e = (t.getAttribute("data-key") || "").trim();
|
|
867
870
|
if (e) return e;
|
|
868
|
-
const
|
|
869
|
-
return
|
|
871
|
+
const r = p(t);
|
|
872
|
+
return r ? r.toLowerCase().replace(/\s+/g, "_") : `column-${a + 1}`;
|
|
870
873
|
}
|
|
871
874
|
_currentColumnOrderString() {
|
|
872
875
|
return this._headerCells().map((a, e) => this._headerKey(a, e)).join(",");
|
|
@@ -894,10 +897,10 @@ class R extends C {
|
|
|
894
897
|
const e = Number(a);
|
|
895
898
|
if (Number.isInteger(e) && e >= 0 && e < t.length)
|
|
896
899
|
return e;
|
|
897
|
-
const
|
|
898
|
-
for (let
|
|
899
|
-
const s = t[
|
|
900
|
-
if (o ===
|
|
900
|
+
const r = a.toLowerCase();
|
|
901
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
902
|
+
const s = t[i], o = (s.getAttribute("data-key") || "").toLowerCase(), n = p(s).toLowerCase();
|
|
903
|
+
if (o === r || n === r) return i;
|
|
901
904
|
}
|
|
902
905
|
return -1;
|
|
903
906
|
}
|
|
@@ -905,12 +908,12 @@ class R extends C {
|
|
|
905
908
|
if (typeof a == "number" && Number.isInteger(a) && a >= 0 && a < t.length) return a;
|
|
906
909
|
const e = String(a || "").trim();
|
|
907
910
|
if (!e) return -1;
|
|
908
|
-
const
|
|
909
|
-
if (Number.isInteger(
|
|
910
|
-
const
|
|
911
|
+
const r = Number(e);
|
|
912
|
+
if (Number.isInteger(r) && r >= 0 && r < t.length) return r;
|
|
913
|
+
const i = e.toLowerCase();
|
|
911
914
|
for (let s = 0; s < t.length; s += 1) {
|
|
912
915
|
const o = t[s], n = (o.getAttribute("data-key") || "").toLowerCase(), u = p(o).toLowerCase();
|
|
913
|
-
if (n ===
|
|
916
|
+
if (n === i || u === i || this._headerKey(o, s) === i) return s;
|
|
914
917
|
}
|
|
915
918
|
return -1;
|
|
916
919
|
}
|
|
@@ -920,14 +923,14 @@ class R extends C {
|
|
|
920
923
|
try {
|
|
921
924
|
const e = JSON.parse(a);
|
|
922
925
|
if (!Array.isArray(e)) return [];
|
|
923
|
-
const
|
|
924
|
-
return e.forEach((
|
|
925
|
-
if (!
|
|
926
|
-
const s =
|
|
926
|
+
const r = [];
|
|
927
|
+
return e.forEach((i) => {
|
|
928
|
+
if (!i || typeof i != "object") return;
|
|
929
|
+
const s = i.column ?? i.field ?? i.key, o = this._resolveColumnIndex(t, s);
|
|
927
930
|
if (o < 0) return;
|
|
928
|
-
const n = String(
|
|
929
|
-
|
|
930
|
-
}),
|
|
931
|
+
const n = String(i.op || i.operator || "contains").trim().toLowerCase();
|
|
932
|
+
r.push({ columnIndex: o, op: n, value: i.value });
|
|
933
|
+
}), r;
|
|
931
934
|
} catch {
|
|
932
935
|
return [];
|
|
933
936
|
}
|
|
@@ -938,8 +941,8 @@ class R extends C {
|
|
|
938
941
|
_parsePinColumns(t) {
|
|
939
942
|
const a = this.getAttribute("pin-columns");
|
|
940
943
|
if (!a) return { left: [], right: [] };
|
|
941
|
-
const e = /* @__PURE__ */ new Set(),
|
|
942
|
-
|
|
944
|
+
const e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (u, c) => {
|
|
945
|
+
c.forEach((l) => {
|
|
943
946
|
const d = this._resolveColumnIndex(t, l);
|
|
944
947
|
d >= 0 && u.add(d);
|
|
945
948
|
});
|
|
@@ -947,17 +950,17 @@ class R extends C {
|
|
|
947
950
|
try {
|
|
948
951
|
const u = JSON.parse(a);
|
|
949
952
|
if (u && typeof u == "object") {
|
|
950
|
-
|
|
951
|
-
const
|
|
952
|
-
return { left:
|
|
953
|
+
i(e, this._normalizePinTokens(u.left)), i(r, this._normalizePinTokens(u.right));
|
|
954
|
+
const c = Array.from(e).sort((d, h) => d - h), l = Array.from(r).filter((d) => !e.has(d)).sort((d, h) => h - d);
|
|
955
|
+
return { left: c, right: l };
|
|
953
956
|
}
|
|
954
957
|
} catch {
|
|
955
958
|
}
|
|
956
959
|
a.split(";").map((u) => u.trim()).filter(Boolean).forEach((u) => {
|
|
957
|
-
const [
|
|
958
|
-
d === "left" &&
|
|
960
|
+
const [c, l] = u.split(":"), d = (c || "").trim().toLowerCase(), h = this._normalizePinTokens(l || "");
|
|
961
|
+
d === "left" && i(e, h), d === "right" && i(r, h);
|
|
959
962
|
});
|
|
960
|
-
const o = Array.from(e).sort((u,
|
|
963
|
+
const o = Array.from(e).sort((u, c) => u - c), n = Array.from(r).filter((u) => !e.has(u)).sort((u, c) => c - u);
|
|
961
964
|
return { left: o, right: n };
|
|
962
965
|
}
|
|
963
966
|
_setPageAttribute(t) {
|
|
@@ -983,11 +986,11 @@ class R extends C {
|
|
|
983
986
|
_resolveColumnWidth(t, a) {
|
|
984
987
|
const e = this._columnWidths.get(t);
|
|
985
988
|
if (typeof e == "number" && Number.isFinite(e)) return Math.max(1, e);
|
|
986
|
-
const
|
|
987
|
-
return Number.isFinite(
|
|
989
|
+
const r = a?.getBoundingClientRect().width || a?.offsetWidth || 0;
|
|
990
|
+
return Number.isFinite(r) && r > 0 ? r : 120;
|
|
988
991
|
}
|
|
989
|
-
_pinCell(t, a, e,
|
|
990
|
-
t && (t.setAttribute("data-pinned", a),
|
|
992
|
+
_pinCell(t, a, e, r, i) {
|
|
993
|
+
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");
|
|
991
994
|
}
|
|
992
995
|
_applyPinnedColumns() {
|
|
993
996
|
if (!this._table) return;
|
|
@@ -996,21 +999,21 @@ class R extends C {
|
|
|
996
999
|
if (!t.length) return;
|
|
997
1000
|
const { left: a, right: e } = this._parsePinColumns(t);
|
|
998
1001
|
if (!a.length && !e.length) return;
|
|
999
|
-
const
|
|
1000
|
-
let
|
|
1002
|
+
const r = Array.from(this._table.rows).filter((o) => !this._isVirtualSpacerRow(o));
|
|
1003
|
+
let i = 0;
|
|
1001
1004
|
a.forEach((o, n) => {
|
|
1002
|
-
const u = this._resolveColumnWidth(o, t[o]),
|
|
1003
|
-
|
|
1004
|
-
const
|
|
1005
|
-
this._pinCell(
|
|
1006
|
-
}),
|
|
1005
|
+
const u = this._resolveColumnWidth(o, t[o]), c = n === a.length - 1;
|
|
1006
|
+
r.forEach((l, d) => {
|
|
1007
|
+
const h = l.cells[o];
|
|
1008
|
+
this._pinCell(h, "left", i, c, d === 0);
|
|
1009
|
+
}), i += u;
|
|
1007
1010
|
});
|
|
1008
1011
|
let s = 0;
|
|
1009
1012
|
e.forEach((o, n) => {
|
|
1010
|
-
const u = this._resolveColumnWidth(o, t[o]),
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
this._pinCell(
|
|
1013
|
+
const u = this._resolveColumnWidth(o, t[o]), c = n === e.length - 1;
|
|
1014
|
+
r.forEach((l, d) => {
|
|
1015
|
+
const h = l.cells[o];
|
|
1016
|
+
this._pinCell(h, "right", s, c, d === 0);
|
|
1014
1017
|
}), s += u;
|
|
1015
1018
|
});
|
|
1016
1019
|
}
|
|
@@ -1020,48 +1023,48 @@ class R extends C {
|
|
|
1020
1023
|
if (!t) return;
|
|
1021
1024
|
const a = this._table.tHead?.rows[0], e = this._table.tBodies[0];
|
|
1022
1025
|
if (!a || !e) return;
|
|
1023
|
-
const
|
|
1024
|
-
if (!i.length) return;
|
|
1025
|
-
const r = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1026
|
+
const r = Array.from(a.cells);
|
|
1026
1027
|
if (!r.length) return;
|
|
1028
|
+
const i = t.split(",").map((l) => l.trim()).filter(Boolean);
|
|
1029
|
+
if (!i.length) return;
|
|
1027
1030
|
const s = [], o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
+
r.forEach((l, d) => {
|
|
1032
|
+
const h = (l.getAttribute("data-key") || p(l)).toLowerCase().trim();
|
|
1033
|
+
h && n.set(h, d);
|
|
1031
1034
|
});
|
|
1032
|
-
for (const l of
|
|
1035
|
+
for (const l of i) {
|
|
1033
1036
|
const d = Number(l);
|
|
1034
|
-
if (Number.isInteger(d) && d >= 0 && d <
|
|
1037
|
+
if (Number.isInteger(d) && d >= 0 && d < r.length) {
|
|
1035
1038
|
o.has(d) || (o.add(d), s.push(d));
|
|
1036
1039
|
continue;
|
|
1037
1040
|
}
|
|
1038
|
-
const
|
|
1039
|
-
typeof
|
|
1041
|
+
const h = n.get(l.toLowerCase());
|
|
1042
|
+
typeof h == "number" && !o.has(h) && (o.add(h), s.push(h));
|
|
1040
1043
|
}
|
|
1041
|
-
for (let l = 0; l <
|
|
1044
|
+
for (let l = 0; l < r.length; l += 1)
|
|
1042
1045
|
o.has(l) || s.push(l);
|
|
1043
1046
|
if (s.every((l, d) => l === d)) return;
|
|
1044
|
-
s.map((l) =>
|
|
1047
|
+
s.map((l) => r[l]).forEach((l) => a.appendChild(l)), Array.from(e.rows).filter((l) => !this._isVirtualSpacerRow(l)).forEach((l) => {
|
|
1045
1048
|
const d = Array.from(l.cells);
|
|
1046
1049
|
s.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1047
1050
|
}), this._columnWidths.clear();
|
|
1048
1051
|
}
|
|
1049
1052
|
_moveColumn(t, a) {
|
|
1050
1053
|
if (!this._table) return !1;
|
|
1051
|
-
const e = this._table.tHead?.rows[0],
|
|
1052
|
-
if (!e || !
|
|
1053
|
-
const
|
|
1054
|
+
const e = this._table.tHead?.rows[0], r = this._table.tBodies[0];
|
|
1055
|
+
if (!e || !r) return !1;
|
|
1056
|
+
const i = Array.from(e.cells), s = i.length;
|
|
1054
1057
|
if (!s || t < 0 || t >= s || a < 0 || a >= s || t === a) return !1;
|
|
1055
1058
|
const o = Array.from({ length: s }, (l, d) => d), [n] = o.splice(t, 1);
|
|
1056
|
-
o.splice(a, 0, n), o.map((l) =>
|
|
1059
|
+
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) => {
|
|
1057
1060
|
const d = Array.from(l.cells);
|
|
1058
1061
|
o.map((f) => d[f]).filter(Boolean).forEach((f) => l.appendChild(f));
|
|
1059
1062
|
});
|
|
1060
|
-
const
|
|
1063
|
+
const c = /* @__PURE__ */ new Map();
|
|
1061
1064
|
return o.forEach((l, d) => {
|
|
1062
|
-
const
|
|
1063
|
-
typeof
|
|
1064
|
-
}), this._columnWidths =
|
|
1065
|
+
const h = this._columnWidths.get(l);
|
|
1066
|
+
typeof h == "number" && c.set(d, h);
|
|
1067
|
+
}), this._columnWidths = c, this._sortColumnIndex >= 0 && (this._sortColumnIndex = o.indexOf(this._sortColumnIndex)), this._syncHeaderState(), this._applyPinnedColumns(), this._syncRowSelectionState(), !0;
|
|
1065
1068
|
}
|
|
1066
1069
|
_clearDragMarkers() {
|
|
1067
1070
|
this._headerCells().forEach((a) => {
|
|
@@ -1076,7 +1079,7 @@ class R extends C {
|
|
|
1076
1079
|
sourceIndex: t,
|
|
1077
1080
|
targetIndex: a,
|
|
1078
1081
|
order: e,
|
|
1079
|
-
keys: this._headerCells().map((
|
|
1082
|
+
keys: this._headerCells().map((r, i) => this._headerKey(r, i))
|
|
1080
1083
|
},
|
|
1081
1084
|
bubbles: !0
|
|
1082
1085
|
})
|
|
@@ -1087,14 +1090,31 @@ class R extends C {
|
|
|
1087
1090
|
e && e.focus();
|
|
1088
1091
|
}
|
|
1089
1092
|
_focusSelectableRow(t, a) {
|
|
1090
|
-
const e = this._bodyRows().filter((o) => !o.hidden),
|
|
1091
|
-
if (
|
|
1092
|
-
const
|
|
1093
|
+
const e = this._bodyRows().filter((o) => !o.hidden), r = e.indexOf(t);
|
|
1094
|
+
if (r < 0) return;
|
|
1095
|
+
const i = Math.min(e.length - 1, Math.max(0, r + a)), s = e[i];
|
|
1093
1096
|
s && s.focus();
|
|
1094
1097
|
}
|
|
1095
1098
|
_headerKeyboardShortcuts(t, a) {
|
|
1096
|
-
const e = this._isRtl(),
|
|
1097
|
-
return t && s.push("Enter", "Space"), a && s.push(`Alt+${
|
|
1099
|
+
const e = this._isRtl(), r = e ? "ArrowRight" : "ArrowLeft", i = e ? "ArrowLeft" : "ArrowRight", s = [r, i, "Home", "End"];
|
|
1100
|
+
return t && s.push("Enter", "Space"), a && s.push(`Alt+${r}`, `Alt+${i}`), s.join(" ");
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* A frame that scrolls but holds nothing focusable (a loading or read-only table in a narrow
|
|
1104
|
+
* container) cannot be scrolled from the keyboard. Make it a focusable, named region while that is true.
|
|
1105
|
+
*/
|
|
1106
|
+
_syncScrollRegion() {
|
|
1107
|
+
const t = this._frameEl;
|
|
1108
|
+
if (!t) return;
|
|
1109
|
+
const a = t.scrollWidth > t.clientWidth + 1 || t.scrollHeight > t.clientHeight + 1, e = !!this._table?.querySelector('[tabindex="0"], a[href], button, input, select, textarea');
|
|
1110
|
+
if (a && !e) {
|
|
1111
|
+
t.setAttribute("tabindex", "0"), t.setAttribute("role", "region"), t.setAttribute("data-scroll-region", "");
|
|
1112
|
+
const r = (this.getAttribute("aria-label") || "").trim();
|
|
1113
|
+
t.setAttribute("aria-label", r ? `${r}, scrollable` : "Scrollable table");
|
|
1114
|
+
} else t.hasAttribute("data-scroll-region") && (t.removeAttribute("tabindex"), t.removeAttribute("role"), t.removeAttribute("aria-label"), t.removeAttribute("data-scroll-region"));
|
|
1115
|
+
}
|
|
1116
|
+
_watchScrollRegion() {
|
|
1117
|
+
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));
|
|
1098
1118
|
}
|
|
1099
1119
|
_syncStructure() {
|
|
1100
1120
|
if (!this._isSyncing) {
|
|
@@ -1102,7 +1122,7 @@ class R extends C {
|
|
|
1102
1122
|
try {
|
|
1103
1123
|
this._table = this._findTable();
|
|
1104
1124
|
const t = this.root.querySelector(".frame");
|
|
1105
|
-
this._frameEl !== t && (this._frameEl && this._frameEl.removeEventListener("scroll", this._onFrameScroll), this._frameEl = t, this._frameEl && this._frameEl.addEventListener("scroll", this._onFrameScroll, { passive: !0 }));
|
|
1125
|
+
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());
|
|
1106
1126
|
const a = this.root.querySelector(".empty"), e = this.root.querySelector(".summary");
|
|
1107
1127
|
if (this._syncEmptyText(), !this._table) {
|
|
1108
1128
|
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();
|
|
@@ -1115,9 +1135,9 @@ class R extends C {
|
|
|
1115
1135
|
}
|
|
1116
1136
|
}
|
|
1117
1137
|
_syncHeaderState() {
|
|
1118
|
-
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"),
|
|
1138
|
+
const t = this.hasAttribute("sortable"), a = this.hasAttribute("draggable-columns"), e = this.hasAttribute("resizable-columns"), r = this._headerKeyboardShortcuts(t, a);
|
|
1119
1139
|
this._headerCells().forEach((s, o) => {
|
|
1120
|
-
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",
|
|
1140
|
+
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) {
|
|
1121
1141
|
s.setAttribute("data-resizable", "true");
|
|
1122
1142
|
let n = s.querySelector(".resize-handle");
|
|
1123
1143
|
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));
|
|
@@ -1133,18 +1153,18 @@ class R extends C {
|
|
|
1133
1153
|
_applyPagination(t) {
|
|
1134
1154
|
const a = this._bodyRows();
|
|
1135
1155
|
this._pageSize = this._parsePageSize(), this._totalRows = a.length;
|
|
1136
|
-
const e = this._parseFilterQuery(),
|
|
1156
|
+
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));
|
|
1137
1157
|
this._filteredRows = o.length, this._table?.setAttribute("aria-rowcount", String(this._filteredRows));
|
|
1138
1158
|
const n = this._parsePage();
|
|
1139
1159
|
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);
|
|
1140
|
-
const u = (this._page - 1) * this._pageSize,
|
|
1160
|
+
const u = (this._page - 1) * this._pageSize, c = u + this._pageSize, l = new Set(o);
|
|
1141
1161
|
if (a.forEach((d) => {
|
|
1142
1162
|
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"));
|
|
1143
|
-
}), o.forEach((d,
|
|
1144
|
-
const f =
|
|
1145
|
-
d.hidden = !f, f ? d.removeAttribute("data-hidden-by-page") : d.setAttribute("data-hidden-by-page", ""), d.setAttribute("aria-rowindex", String(
|
|
1163
|
+
}), o.forEach((d, h) => {
|
|
1164
|
+
const f = h >= u && h < c;
|
|
1165
|
+
d.hidden = !f, f ? d.removeAttribute("data-hidden-by-page") : d.setAttribute("data-hidden-by-page", ""), d.setAttribute("aria-rowindex", String(h + 1));
|
|
1146
1166
|
}), t) {
|
|
1147
|
-
const d = o.length,
|
|
1167
|
+
const d = o.length, h = d === 0 ? 0 : u + 1, f = Math.min(c, d);
|
|
1148
1168
|
this.dispatchEvent(
|
|
1149
1169
|
new CustomEvent("page-change", {
|
|
1150
1170
|
detail: {
|
|
@@ -1152,7 +1172,7 @@ class R extends C {
|
|
|
1152
1172
|
count: this._pageCount,
|
|
1153
1173
|
pageSize: this._pageSize,
|
|
1154
1174
|
total: d,
|
|
1155
|
-
start:
|
|
1175
|
+
start: h,
|
|
1156
1176
|
end: f
|
|
1157
1177
|
},
|
|
1158
1178
|
bubbles: !0
|
|
@@ -1171,15 +1191,15 @@ class R extends C {
|
|
|
1171
1191
|
if (!a) return null;
|
|
1172
1192
|
const e = t === "top" ? this._virtualTopSpacer : this._virtualBottomSpacer;
|
|
1173
1193
|
if (e && e.isConnected) return e;
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
const
|
|
1177
|
-
return
|
|
1194
|
+
const r = document.createElement("tr");
|
|
1195
|
+
r.setAttribute("data-virtual-spacer", t), r.setAttribute("aria-hidden", "true"), r.setAttribute("role", "presentation"), r.style.pointerEvents = "none";
|
|
1196
|
+
const i = document.createElement("td");
|
|
1197
|
+
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;
|
|
1178
1198
|
}
|
|
1179
1199
|
_setVirtualSpacerHeight(t, a, e) {
|
|
1180
1200
|
if (!t) return;
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1201
|
+
const r = t.cells[0] || t.appendChild(document.createElement("td"));
|
|
1202
|
+
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";
|
|
1183
1203
|
}
|
|
1184
1204
|
_applyVirtualization(t) {
|
|
1185
1205
|
if (!this.hasAttribute("virtualize") || !this._frameEl || !this._table) {
|
|
@@ -1191,8 +1211,8 @@ class R extends C {
|
|
|
1191
1211
|
this._clearVirtualization(!0);
|
|
1192
1212
|
return;
|
|
1193
1213
|
}
|
|
1194
|
-
const
|
|
1195
|
-
this._setVirtualSpacerHeight(
|
|
1214
|
+
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");
|
|
1215
|
+
this._setVirtualSpacerHeight(h, c, d), this._setVirtualSpacerHeight(f, l, d);
|
|
1196
1216
|
const y = (g, v) => {
|
|
1197
1217
|
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", ""));
|
|
1198
1218
|
};
|
|
@@ -1239,12 +1259,12 @@ class R extends C {
|
|
|
1239
1259
|
t.textContent = "No records";
|
|
1240
1260
|
return;
|
|
1241
1261
|
}
|
|
1242
|
-
const
|
|
1262
|
+
const r = (this._page - 1) * this._pageSize + 1, i = Math.min(this._page * this._pageSize, e);
|
|
1243
1263
|
if (e === a) {
|
|
1244
|
-
t.textContent = `Showing ${
|
|
1264
|
+
t.textContent = `Showing ${r}-${i} of ${a}`;
|
|
1245
1265
|
return;
|
|
1246
1266
|
}
|
|
1247
|
-
t.textContent = `Showing ${
|
|
1267
|
+
t.textContent = `Showing ${r}-${i} of ${e} filtered records (${a} total)`;
|
|
1248
1268
|
}
|
|
1249
1269
|
_syncEmptyText() {
|
|
1250
1270
|
const t = this.root.querySelector(".empty");
|
|
@@ -1276,45 +1296,45 @@ class R extends C {
|
|
|
1276
1296
|
return /^-?\d+(\.\d+)?$/.test(a) ? Number(a) : t.toLowerCase();
|
|
1277
1297
|
}
|
|
1278
1298
|
_rulePasses(t, a) {
|
|
1279
|
-
const e = a.op,
|
|
1280
|
-
if (e === "empty") return
|
|
1281
|
-
if (e === "notempty" || e === "not-empty") return
|
|
1282
|
-
if (e === "equals" || e === "eq") return s === String(
|
|
1283
|
-
if (e === "neq" || e === "not-equals") return s !== String(
|
|
1284
|
-
if (e === "startswith" || e === "starts-with") return s.startsWith(String(
|
|
1285
|
-
if (e === "endswith" || e === "ends-with") return s.endsWith(String(
|
|
1299
|
+
const e = a.op, r = a.value, i = t.trim(), s = i.toLowerCase();
|
|
1300
|
+
if (e === "empty") return i.length === 0;
|
|
1301
|
+
if (e === "notempty" || e === "not-empty") return i.length > 0;
|
|
1302
|
+
if (e === "equals" || e === "eq") return s === String(r ?? "").toLowerCase();
|
|
1303
|
+
if (e === "neq" || e === "not-equals") return s !== String(r ?? "").toLowerCase();
|
|
1304
|
+
if (e === "startswith" || e === "starts-with") return s.startsWith(String(r ?? "").toLowerCase());
|
|
1305
|
+
if (e === "endswith" || e === "ends-with") return s.endsWith(String(r ?? "").toLowerCase());
|
|
1286
1306
|
if (e === "in")
|
|
1287
|
-
return (Array.isArray(
|
|
1307
|
+
return (Array.isArray(r) ? r.map((n) => String(n).toLowerCase()) : String(r ?? "").split(",").map((n) => n.trim().toLowerCase()).filter(Boolean)).includes(s);
|
|
1288
1308
|
if (e === "gt" || e === "gte" || e === "lt" || e === "lte" || e === "between") {
|
|
1289
|
-
const o = this._parseComparable(
|
|
1309
|
+
const o = this._parseComparable(i);
|
|
1290
1310
|
if (typeof o != "number") return !1;
|
|
1291
1311
|
if (e === "between") {
|
|
1292
|
-
const u = Array.isArray(
|
|
1293
|
-
return !Number.isFinite(
|
|
1312
|
+
const u = Array.isArray(r) ? r : String(r ?? "").split(","), c = Number(u[0]), l = Number(u[1]);
|
|
1313
|
+
return !Number.isFinite(c) || !Number.isFinite(l) ? !1 : o >= Math.min(c, l) && o <= Math.max(c, l);
|
|
1294
1314
|
}
|
|
1295
|
-
const n = Number(
|
|
1315
|
+
const n = Number(r);
|
|
1296
1316
|
return Number.isFinite(n) ? e === "gt" ? o > n : e === "gte" ? o >= n : e === "lt" ? o < n : o <= n : !1;
|
|
1297
1317
|
}
|
|
1298
|
-
return s.includes(String(
|
|
1318
|
+
return s.includes(String(r ?? "").toLowerCase());
|
|
1299
1319
|
}
|
|
1300
|
-
_rowMatchesFilter(t, a, e,
|
|
1320
|
+
_rowMatchesFilter(t, a, e, r) {
|
|
1301
1321
|
if (a) {
|
|
1302
|
-
const
|
|
1303
|
-
if (!
|
|
1304
|
-
const s =
|
|
1322
|
+
const i = e >= 0 ? p(t.cells[e]) : Array.from(t.cells).map((n) => p(n)).join(" ");
|
|
1323
|
+
if (!i) return !1;
|
|
1324
|
+
const s = i.toLowerCase(), o = a.split(/\s+/).filter(Boolean);
|
|
1305
1325
|
if (o.length && !o.every((n) => s.includes(n))) return !1;
|
|
1306
1326
|
}
|
|
1307
|
-
return
|
|
1308
|
-
const s = t.cells[
|
|
1309
|
-
return this._rulePasses(p(s),
|
|
1327
|
+
return r.length ? r.every((i) => {
|
|
1328
|
+
const s = t.cells[i.columnIndex];
|
|
1329
|
+
return this._rulePasses(p(s), i);
|
|
1310
1330
|
}) : !0;
|
|
1311
1331
|
}
|
|
1312
1332
|
_setColumnWidth(t, a, e = !0) {
|
|
1313
1333
|
if (!this._table) return;
|
|
1314
|
-
const
|
|
1315
|
-
if (this._columnWidths.set(t,
|
|
1334
|
+
const r = Math.max(72, Math.round(a));
|
|
1335
|
+
if (this._columnWidths.set(t, r), Array.from(this._table.rows).forEach((o) => {
|
|
1316
1336
|
const n = o.cells[t];
|
|
1317
|
-
n && (n.style.width = `${
|
|
1337
|
+
n && (n.style.width = `${r}px`, n.style.minWidth = `${r}px`, n.style.maxWidth = `${r}px`, n.style.boxSizing = "border-box");
|
|
1318
1338
|
}), !e) return;
|
|
1319
1339
|
this._applyPinnedColumns();
|
|
1320
1340
|
const s = this._headerCells()[t];
|
|
@@ -1323,7 +1343,7 @@ class R extends C {
|
|
|
1323
1343
|
detail: {
|
|
1324
1344
|
columnIndex: t,
|
|
1325
1345
|
key: s?.getAttribute("data-key") || p(s) || `column-${t + 1}`,
|
|
1326
|
-
width:
|
|
1346
|
+
width: r
|
|
1327
1347
|
},
|
|
1328
1348
|
bubbles: !0
|
|
1329
1349
|
})
|
|
@@ -1333,14 +1353,14 @@ class R extends C {
|
|
|
1333
1353
|
if (!this.hasAttribute("resizable-columns") || !this._table) return;
|
|
1334
1354
|
const e = t.target.closest(".resize-handle");
|
|
1335
1355
|
if (!e || !this._table.contains(e)) return;
|
|
1336
|
-
const
|
|
1337
|
-
if (!Number.isInteger(
|
|
1338
|
-
const
|
|
1339
|
-
if (!
|
|
1356
|
+
const r = Number(e.getAttribute("data-col-index"));
|
|
1357
|
+
if (!Number.isInteger(r) || r < 0) return;
|
|
1358
|
+
const i = this._headerCells()[r];
|
|
1359
|
+
if (!i) return;
|
|
1340
1360
|
t.preventDefault();
|
|
1341
|
-
const s =
|
|
1361
|
+
const s = i.getBoundingClientRect().width;
|
|
1342
1362
|
this._resizeState = {
|
|
1343
|
-
columnIndex:
|
|
1363
|
+
columnIndex: r,
|
|
1344
1364
|
startX: t.clientX,
|
|
1345
1365
|
startWidth: s
|
|
1346
1366
|
}, window.addEventListener("pointermove", this._onPointerMove), window.addEventListener("pointerup", this._onPointerUp);
|
|
@@ -1373,58 +1393,58 @@ class R extends C {
|
|
|
1373
1393
|
}
|
|
1374
1394
|
const e = a.closest("th");
|
|
1375
1395
|
if (!e || !this._table.contains(e)) return;
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1396
|
+
const i = this._headerCells().indexOf(e);
|
|
1397
|
+
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))));
|
|
1378
1398
|
}
|
|
1379
1399
|
_onDragOver(t) {
|
|
1380
1400
|
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1381
1401
|
const e = t.target.closest("th");
|
|
1382
1402
|
if (!e || !this._table.contains(e)) return;
|
|
1383
|
-
const
|
|
1384
|
-
if (
|
|
1385
|
-
this._clearDragMarkers(), this._dragOverColumnIndex =
|
|
1386
|
-
const s =
|
|
1403
|
+
const r = this._headerCells(), i = r.indexOf(e);
|
|
1404
|
+
if (i < 0 || (t.preventDefault(), this._dragOverColumnIndex === i)) return;
|
|
1405
|
+
this._clearDragMarkers(), this._dragOverColumnIndex = i, e.setAttribute("data-drag-over", "true");
|
|
1406
|
+
const s = r[this._dragColumnIndex];
|
|
1387
1407
|
s && s.setAttribute("data-dragging", "true");
|
|
1388
1408
|
}
|
|
1389
1409
|
_onDrop(t) {
|
|
1390
1410
|
if (!this.hasAttribute("draggable-columns") || !this._table || this._dragColumnIndex < 0) return;
|
|
1391
1411
|
const e = t.target.closest("th");
|
|
1392
1412
|
if (!e || !this._table.contains(e)) return;
|
|
1393
|
-
const
|
|
1394
|
-
if (
|
|
1413
|
+
const i = this._headerCells().indexOf(e);
|
|
1414
|
+
if (i < 0) return;
|
|
1395
1415
|
t.preventDefault();
|
|
1396
|
-
const s = this._dragColumnIndex, o = this._moveColumn(s,
|
|
1397
|
-
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s,
|
|
1416
|
+
const s = this._dragColumnIndex, o = this._moveColumn(s, i);
|
|
1417
|
+
this._clearDragMarkers(), this._dragColumnIndex = -1, this._ignoreHeaderClickUntil = Date.now() + 220, o && (this._applyVirtualization(!1), this._emitColumnOrderChange(s, i));
|
|
1398
1418
|
}
|
|
1399
1419
|
_onDragEnd() {
|
|
1400
1420
|
this._clearDragMarkers(), this._dragColumnIndex = -1;
|
|
1401
1421
|
}
|
|
1402
1422
|
_rowValues(t) {
|
|
1403
|
-
const a = this._headerCells(), e = Array.from(t.cells),
|
|
1404
|
-
return e.forEach((
|
|
1423
|
+
const a = this._headerCells(), e = Array.from(t.cells), r = {};
|
|
1424
|
+
return e.forEach((i, s) => {
|
|
1405
1425
|
const o = a[s], n = (o?.getAttribute("data-key") || p(o || void 0) || `col_${s + 1}`).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1406
|
-
|
|
1407
|
-
}),
|
|
1426
|
+
r[n || `col_${s + 1}`] = p(i);
|
|
1427
|
+
}), r;
|
|
1408
1428
|
}
|
|
1409
1429
|
_syncRowSelectionState() {
|
|
1410
1430
|
const t = this.hasAttribute("selectable"), a = this._bodyRows();
|
|
1411
1431
|
for (const e of Array.from(this._selectedRows))
|
|
1412
1432
|
a.includes(e) || this._selectedRows.delete(e);
|
|
1413
1433
|
a.forEach((e) => {
|
|
1414
|
-
const
|
|
1415
|
-
t &&
|
|
1434
|
+
const r = !e.hidden;
|
|
1435
|
+
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"));
|
|
1416
1436
|
});
|
|
1417
1437
|
}
|
|
1418
1438
|
_toggleRowSelection(t) {
|
|
1419
1439
|
const a = this.hasAttribute("multi-select"), e = this._selectedRows.has(t);
|
|
1420
1440
|
a || this._selectedRows.clear(), e && a ? this._selectedRows.delete(t) : this._selectedRows.add(t), this._syncRowSelectionState(), this._updateBulkActions();
|
|
1421
|
-
const
|
|
1441
|
+
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));
|
|
1422
1442
|
this.dispatchEvent(
|
|
1423
1443
|
new CustomEvent("row-select", {
|
|
1424
1444
|
detail: {
|
|
1425
|
-
index:
|
|
1445
|
+
index: r.indexOf(t),
|
|
1426
1446
|
selected: this._selectedRows.has(t),
|
|
1427
|
-
indices:
|
|
1447
|
+
indices: i,
|
|
1428
1448
|
rows: s,
|
|
1429
1449
|
page: this._page
|
|
1430
1450
|
},
|
|
@@ -1441,9 +1461,9 @@ class R extends C {
|
|
|
1441
1461
|
rowIndex: n,
|
|
1442
1462
|
value: S(p(o.cells[t]))
|
|
1443
1463
|
})).sort((o, n) => {
|
|
1444
|
-
const u = o.value,
|
|
1464
|
+
const u = o.value, c = n.value;
|
|
1445
1465
|
let l = 0;
|
|
1446
|
-
return typeof u == "number" && typeof
|
|
1466
|
+
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;
|
|
1447
1467
|
}).map((o) => o.row).forEach((o) => e.appendChild(o)), this._syncHeaderState(), this._applyPagination(!1), this._syncRowSelectionState(), this._updateSummary(), this._syncPaginationElement();
|
|
1448
1468
|
const s = a.getAttribute("data-key") || p(a) || `column-${t + 1}`;
|
|
1449
1469
|
this.dispatchEvent(
|
|
@@ -1477,29 +1497,29 @@ class R extends C {
|
|
|
1477
1497
|
}
|
|
1478
1498
|
_onClick(t) {
|
|
1479
1499
|
if (!this._table) return;
|
|
1480
|
-
const e = t.composedPath().find((
|
|
1500
|
+
const e = t.composedPath().find((i) => i instanceof HTMLElement) || t.target;
|
|
1481
1501
|
if (e.closest(".bulk-clear")) {
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1502
|
+
const i = this._selectedRows.size;
|
|
1503
|
+
i > 0 && (this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: i, page: this._page }, bubbles: !0 })));
|
|
1484
1504
|
return;
|
|
1485
1505
|
}
|
|
1486
1506
|
if (!e.closest(".resize-handle") && !(e.closest("th") && Date.now() < this._ignoreHeaderClickUntil) && !this._isInteractionBlocked()) {
|
|
1487
1507
|
if (this.hasAttribute("sortable")) {
|
|
1488
|
-
const
|
|
1489
|
-
if (
|
|
1490
|
-
if (e !==
|
|
1491
|
-
const o = this._headerCells().indexOf(
|
|
1508
|
+
const i = e.closest("th");
|
|
1509
|
+
if (i && this._table.contains(i)) {
|
|
1510
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1511
|
+
const o = this._headerCells().indexOf(i);
|
|
1492
1512
|
if (o >= 0) {
|
|
1493
|
-
this._sortByColumn(o,
|
|
1513
|
+
this._sortByColumn(o, i);
|
|
1494
1514
|
return;
|
|
1495
1515
|
}
|
|
1496
1516
|
}
|
|
1497
1517
|
}
|
|
1498
1518
|
if (this.hasAttribute("selectable")) {
|
|
1499
|
-
const
|
|
1500
|
-
if (
|
|
1501
|
-
if (e !==
|
|
1502
|
-
this._toggleRowSelection(
|
|
1519
|
+
const i = e.closest("tbody tr");
|
|
1520
|
+
if (i && this._table.contains(i) && !i.hidden && !this._isVirtualSpacerRow(i)) {
|
|
1521
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1522
|
+
this._toggleRowSelection(i);
|
|
1503
1523
|
}
|
|
1504
1524
|
}
|
|
1505
1525
|
}
|
|
@@ -1508,19 +1528,19 @@ class R extends C {
|
|
|
1508
1528
|
if (!this._table) return;
|
|
1509
1529
|
const a = t.key, e = t.target;
|
|
1510
1530
|
if (a === "Escape" && this._selectedRows.size) {
|
|
1511
|
-
const
|
|
1512
|
-
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count:
|
|
1531
|
+
const i = this._selectedRows.size;
|
|
1532
|
+
this._selectedRows.clear(), this._syncRowSelectionState(), this._updateBulkActions(), this.dispatchEvent(new CustomEvent("bulk-clear", { detail: { count: i, page: this._page }, bubbles: !0 }));
|
|
1513
1533
|
return;
|
|
1514
1534
|
}
|
|
1515
1535
|
if (this._isInteractionBlocked()) return;
|
|
1516
|
-
const
|
|
1517
|
-
if (
|
|
1518
|
-
const
|
|
1536
|
+
const r = e.closest("th");
|
|
1537
|
+
if (r && this._table.contains(r)) {
|
|
1538
|
+
const i = this._headerCells(), s = i.indexOf(r);
|
|
1519
1539
|
if (s >= 0) {
|
|
1520
1540
|
const n = this._isRtl() ? -1 : 1, u = -n;
|
|
1521
1541
|
if (a === "ArrowRight" || a === "ArrowLeft") {
|
|
1522
1542
|
t.preventDefault();
|
|
1523
|
-
const
|
|
1543
|
+
const c = a === "ArrowRight" ? n : u, l = Math.max(0, Math.min(i.length - 1, s + c));
|
|
1524
1544
|
if (t.altKey && this.hasAttribute("draggable-columns") && l !== s) {
|
|
1525
1545
|
this._moveColumn(s, l) && (this._ignoreHeaderClickUntil = Date.now() + 220, this._emitColumnOrderChange(s, l), this._applyVirtualization(!1), this._focusHeaderAt(l));
|
|
1526
1546
|
return;
|
|
@@ -1529,22 +1549,22 @@ class R extends C {
|
|
|
1529
1549
|
return;
|
|
1530
1550
|
}
|
|
1531
1551
|
if (a === "Home" || a === "End") {
|
|
1532
|
-
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 :
|
|
1552
|
+
t.preventDefault(), this._focusHeaderAt(a === "Home" ? 0 : i.length - 1);
|
|
1533
1553
|
return;
|
|
1534
1554
|
}
|
|
1535
1555
|
if ((a === "Enter" || a === " ") && this.hasAttribute("sortable")) {
|
|
1536
|
-
if (e !==
|
|
1537
|
-
t.preventDefault(), this._sortByColumn(s,
|
|
1556
|
+
if (e !== r && this._isInteractiveTarget(e)) return;
|
|
1557
|
+
t.preventDefault(), this._sortByColumn(s, r);
|
|
1538
1558
|
return;
|
|
1539
1559
|
}
|
|
1540
1560
|
}
|
|
1541
1561
|
}
|
|
1542
1562
|
if (this.hasAttribute("selectable")) {
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1545
|
-
if (e !==
|
|
1563
|
+
const i = e.closest("tbody tr");
|
|
1564
|
+
if (i && this._table.contains(i) && !i.hidden && !this._isVirtualSpacerRow(i)) {
|
|
1565
|
+
if (e !== i && this._isInteractiveTarget(e)) return;
|
|
1546
1566
|
if (a === "ArrowDown" || a === "ArrowUp") {
|
|
1547
|
-
t.preventDefault(), this._focusSelectableRow(
|
|
1567
|
+
t.preventDefault(), this._focusSelectableRow(i, a === "ArrowDown" ? 1 : -1);
|
|
1548
1568
|
return;
|
|
1549
1569
|
}
|
|
1550
1570
|
if (a === "Home" || a === "End") {
|
|
@@ -1553,7 +1573,7 @@ class R extends C {
|
|
|
1553
1573
|
o && o.focus();
|
|
1554
1574
|
return;
|
|
1555
1575
|
}
|
|
1556
|
-
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(
|
|
1576
|
+
(a === "Enter" || a === " ") && (t.preventDefault(), this._toggleRowSelection(i));
|
|
1557
1577
|
}
|
|
1558
1578
|
}
|
|
1559
1579
|
}
|
|
@@ -1566,8 +1586,8 @@ class R extends C {
|
|
|
1566
1586
|
return;
|
|
1567
1587
|
}
|
|
1568
1588
|
t.removeAttribute("hidden");
|
|
1569
|
-
const
|
|
1570
|
-
o && (o.textContent =
|
|
1589
|
+
const i = this.getAttribute("bulk-actions-label") || "{count} selected", s = this.getAttribute("bulk-clear-label") || "Clear selection", o = t.querySelector(".bulk-count");
|
|
1590
|
+
o && (o.textContent = i.replace("{count}", String(e)));
|
|
1571
1591
|
const n = t.querySelector(".bulk-clear");
|
|
1572
1592
|
n && (n.textContent = s);
|
|
1573
1593
|
}
|