@melodicdev/components 4.0.0 → 4.1.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 +4 -4
- package/assets/fonts/phosphor/phosphor.css +5 -25
- package/assets/melodic-components.css +50 -25
- package/assets/melodic-components.js +9230 -7814
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.css +1 -21
- package/assets/melodic-components.min.js +1895 -26471
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.styles.js +83 -78
- package/lib/components/data-display/activity-feed/activity-feed.styles.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed.styles.js +10 -5
- package/lib/components/data-display/avatar/avatar.styles.d.ts.map +1 -1
- package/lib/components/data-display/avatar/avatar.styles.js +23 -18
- package/lib/components/data-display/badge/badge.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.js +54 -48
- package/lib/components/data-display/badge-group/badge-group.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge-group/badge-group.styles.js +34 -29
- package/lib/components/data-display/calendar-view/calendar-view.styles.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.styles.js +174 -155
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +43 -2
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +94 -8
- package/lib/components/data-display/data-grid/data-grid.styles.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.styles.js +139 -117
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +19 -10
- package/lib/components/data-display/data-grid/index.d.ts +1 -0
- package/lib/components/data-display/data-grid/index.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.js +40 -35
- package/lib/components/data-display/list/list.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list.styles.js +10 -5
- package/lib/components/data-display/profile-card/profile-card.styles.d.ts.map +1 -1
- package/lib/components/data-display/profile-card/profile-card.styles.js +71 -66
- package/lib/components/data-display/stat-card/stat-card.styles.d.ts.map +1 -1
- package/lib/components/data-display/stat-card/stat-card.styles.js +67 -63
- package/lib/components/data-display/table/index.d.ts +1 -0
- package/lib/components/data-display/table/index.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.d.ts +16 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +28 -3
- package/lib/components/data-display/table/table.styles.d.ts.map +1 -1
- package/lib/components/data-display/table/table.styles.js +101 -90
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +8 -6
- package/lib/components/data-display/table-core/index.d.ts +2 -2
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -1
- package/lib/components/data-display/table-core/table-core.d.ts +16 -2
- package/lib/components/data-display/table-core/table-core.d.ts.map +1 -1
- package/lib/components/data-display/table-core/table-core.js +32 -5
- package/lib/components/data-display/tag/tag.styles.d.ts.map +1 -1
- package/lib/components/data-display/tag/tag.styles.js +78 -66
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +89 -76
- package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.styles.js +110 -106
- package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
- package/lib/components/feedback/spinner/spinner.styles.js +18 -13
- package/lib/components/feedback/toast/index.d.ts +1 -0
- package/lib/components/feedback/toast/index.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.styles.js +20 -0
- package/lib/components/feedback/toast/toast.component.d.ts +16 -0
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +63 -5
- package/lib/components/feedback/toast/toast.service.d.ts +14 -0
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +41 -0
- package/lib/components/feedback/toast/toast.styles.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.styles.js +80 -69
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +14 -4
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +40 -96
- package/lib/components/forms/autocomplete/autocomplete.styles.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.styles.js +191 -170
- package/lib/components/forms/autocomplete/autocomplete.template.js +7 -1
- package/lib/components/forms/button/button.styles.d.ts.map +1 -1
- package/lib/components/forms/button/button.styles.js +73 -57
- package/lib/components/forms/button-group/button-group-item.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group-item.styles.js +11 -0
- package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.styles.js +24 -19
- package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.styles.js +94 -78
- package/lib/components/forms/date-picker/calendar.component.d.ts +20 -7
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +88 -13
- package/lib/components/forms/date-picker/calendar.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.styles.js +171 -147
- package/lib/components/forms/date-picker/date-picker.component.d.ts +2 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +70 -18
- package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.styles.js +109 -92
- package/lib/components/forms/date-time-picker/date-time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/date-time-picker.styles.js +99 -83
- package/lib/components/forms/date-time-picker/tz-utils.d.ts.map +1 -1
- package/lib/components/forms/date-time-picker/tz-utils.js +24 -3
- package/lib/components/forms/file-upload/file-upload-item.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload-item.styles.js +13 -1
- package/lib/components/forms/file-upload/file-upload.styles.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.styles.js +108 -92
- package/lib/components/forms/form-field/form-field.component.d.ts +18 -1
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +55 -16
- package/lib/components/forms/form-field/form-field.styles.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.styles.js +92 -74
- package/lib/components/forms/input/input.styles.d.ts.map +1 -1
- package/lib/components/forms/input/input.styles.js +98 -82
- package/lib/components/forms/listbox-core/index.d.ts +3 -0
- package/lib/components/forms/listbox-core/index.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/index.js +2 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts +57 -0
- package/lib/components/forms/listbox-core/listbox-core.d.ts.map +1 -0
- package/lib/components/forms/listbox-core/listbox-core.js +168 -0
- package/lib/components/forms/radio/radio-group.styles.js +1 -1
- package/lib/components/forms/radio/radio.styles.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.styles.js +89 -73
- package/lib/components/forms/radio-card-group/radio-card-group.styles.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card-group.styles.js +40 -35
- package/lib/components/forms/radio-card-group/radio-card.styles.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.styles.js +124 -108
- package/lib/components/forms/select/select.component.d.ts +12 -4
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +41 -110
- package/lib/components/forms/select/select.styles.d.ts.map +1 -1
- package/lib/components/forms/select/select.styles.js +181 -159
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +25 -9
- package/lib/components/forms/slider/slider.component.js +1 -1
- package/lib/components/forms/slider/slider.styles.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.styles.js +93 -77
- package/lib/components/forms/slider/slider.template.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.template.js +5 -1
- package/lib/components/forms/textarea/textarea.styles.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.styles.js +97 -81
- package/lib/components/forms/time-picker/time-picker.component.d.ts +1 -2
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +8 -17
- package/lib/components/forms/time-picker/time-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.styles.js +220 -194
- package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.styles.js +95 -79
- package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
- package/lib/components/foundation/card/card.styles.js +62 -46
- package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
- package/lib/components/foundation/container/container.styles.js +15 -10
- package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.styles.js +29 -24
- package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.styles.js +16 -10
- package/lib/components/general/icon/icon.styles.d.ts.map +1 -1
- package/lib/components/general/icon/icon.styles.js +12 -8
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +5 -3
- package/lib/components/navigation/breadcrumb/breadcrumb.styles.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb.styles.js +9 -4
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +74 -69
- package/lib/components/navigation/sidebar/sidebar-group.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-group.styles.js +23 -18
- package/lib/components/navigation/sidebar/sidebar-item.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.styles.js +105 -100
- package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar.styles.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.styles.js +180 -175
- package/lib/components/navigation/sidebar/sidebar.template.js +2 -2
- package/lib/components/navigation/steps/step.styles.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.styles.js +155 -150
- package/lib/components/navigation/steps/steps.styles.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.styles.js +175 -170
- package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.styles.js +12 -7
- package/lib/components/navigation/tabs/tab.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab.styles.js +41 -36
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +4 -1
- package/lib/components/navigation/tabs/tabs.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.styles.js +134 -129
- package/lib/components/overlays/dialog/dialog.component.d.ts +15 -2
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +33 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts +8 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +1 -0
- package/lib/components/overlays/dialog/dialog.styles.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.styles.js +78 -73
- package/lib/components/overlays/dialog/index.d.ts +1 -0
- package/lib/components/overlays/dialog/index.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.d.ts +18 -3
- package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.js +59 -16
- package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.styles.js +82 -77
- package/lib/components/overlays/dropdown/dropdown-item.styles.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.styles.js +60 -43
- package/lib/components/overlays/dropdown/dropdown.styles.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.styles.js +35 -30
- package/lib/components/overlays/popover/popover.component.d.ts +12 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +28 -1
- package/lib/components/overlays/popover/popover.styles.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.styles.js +36 -31
- package/lib/components/overlays/popover/popover.template.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.template.js +2 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +8 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +10 -3
- package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.styles.js +34 -28
- package/lib/components/pages/auth/auth-layout.styles.d.ts +1 -1
- package/lib/components/pages/auth/auth-layout.styles.d.ts.map +1 -1
- package/lib/components/pages/auth/auth-layout.styles.js +86 -81
- package/lib/components/pages/dashboard/dashboard-page.styles.d.ts.map +1 -1
- package/lib/components/pages/dashboard/dashboard-page.styles.js +39 -34
- package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.styles.js +63 -57
- package/lib/components/sections/hero/hero-section.styles.js +97 -97
- package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.styles.js +69 -64
- package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.styles.js +56 -51
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +22 -3
- package/lib/theme/presets/base.preset.d.ts.map +1 -1
- package/lib/theme/presets/base.preset.js +17 -0
- package/lib/theme/presets/dark.preset.d.ts +8 -0
- package/lib/theme/presets/dark.preset.d.ts.map +1 -1
- package/lib/theme/presets/dark.preset.js +9 -0
- package/lib/theme/presets/light.preset.d.ts +6 -0
- package/lib/theme/presets/light.preset.d.ts.map +1 -1
- package/lib/theme/presets/light.preset.js +7 -0
- package/lib/theme/tokens/all-tokens.d.ts +10 -0
- package/lib/theme/tokens/all-tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.d.ts +8 -0
- package/lib/theme/tokens/colors.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/colors.tokens.js +11 -0
- package/lib/theme/tokens/transitions.tokens.d.ts +1 -0
- package/lib/theme/tokens/transitions.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/transitions.tokens.js +3 -0
- package/lib/theme/tokens/typography.tokens.d.ts +1 -0
- package/lib/theme/tokens/typography.tokens.d.ts.map +1 -1
- package/lib/theme/tokens/typography.tokens.js +1 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts +16 -8
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -1
- package/lib/utils/accessibility/cross-root-aria.js +58 -22
- package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.js +9 -19
- package/lib/utils/accessibility/focus-utils.d.ts +10 -1
- package/lib/utils/accessibility/focus-utils.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-utils.js +48 -14
- package/lib/utils/accessibility/index.d.ts +2 -1
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -1
- package/lib/utils/positioning/compute-position.d.ts +6 -1
- package/lib/utils/positioning/compute-position.d.ts.map +1 -1
- package/lib/utils/positioning/compute-position.js +3 -2
- package/lib/utils/positioning/middlewares/flip.middleware.js +2 -51
- package/package.json +8 -5
- package/assets/fonts/phosphor/Phosphor-Bold.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Bold.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Bold.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Fill.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Fill.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Light.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Light.woff +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.svg +0 -3057
- package/assets/fonts/phosphor/Phosphor-Thin.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor-Thin.woff +0 -0
- package/assets/fonts/phosphor/Phosphor.svg +0 -3056
- package/assets/fonts/phosphor/Phosphor.ttf +0 -0
- package/assets/fonts/phosphor/Phosphor.woff +0 -0
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { IElementRef, OnCreate, OnDestroy, OnRender, OnPropertyChange } from '@melodicdev/core';
|
|
2
2
|
import type { DataGridColumn, SortDirection } from './data-grid.types.js';
|
|
3
|
+
import type { TableRowKey } from '../table-core/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Name of the custom property that carries a column's live width.
|
|
6
|
+
*
|
|
7
|
+
* The column key used to be interpolated as-is, so a key that is not a valid
|
|
8
|
+
* CSS identifier (`user.name`, `first name`, `a/b`) produced an invalid
|
|
9
|
+
* `var()` — which invalidates the whole `grid-template-columns` declaration
|
|
10
|
+
* and collapsed the grid. Keys that are already valid keep the same name.
|
|
11
|
+
*/
|
|
12
|
+
export declare function columnWidthVar(key: string): string;
|
|
3
13
|
/**
|
|
4
14
|
* ml-data-grid — Full-featured data grid with virtual scrolling, sorting, filtering,
|
|
5
15
|
* selection, column resizing, column reordering, pinned columns, and pagination.
|
|
@@ -52,10 +62,24 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
52
62
|
virtual: boolean;
|
|
53
63
|
/** Show per-column filter inputs below the header row */
|
|
54
64
|
showFilterRow: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Make rows keyboard-operable: each row becomes a tab stop and Enter/Space
|
|
67
|
+
* fire `ml:row-click` (which a click always fires). Set this when you
|
|
68
|
+
* listen for `ml:row-click`. Mirrors ml-table's `clickable-rows`.
|
|
69
|
+
*/
|
|
70
|
+
clickableRows: boolean;
|
|
55
71
|
/** Column definitions */
|
|
56
72
|
columns: DataGridColumn[];
|
|
57
73
|
/** Row data */
|
|
58
74
|
rows: Record<string, unknown>[];
|
|
75
|
+
/**
|
|
76
|
+
* Row identity: a property name (attribute `row-key="id"`) or a function
|
|
77
|
+
* `(row, index) => key`. Optional. When set, each rendered row's DOM
|
|
78
|
+
* follows its record across sorting, filtering and paging instead of being
|
|
79
|
+
* reused by position, so state held inside custom cells stays with the
|
|
80
|
+
* right row.
|
|
81
|
+
*/
|
|
82
|
+
rowKey: TableRowKey | null;
|
|
59
83
|
sortKey: string;
|
|
60
84
|
sortDirection: SortDirection;
|
|
61
85
|
filters: Record<string, string>;
|
|
@@ -112,20 +136,37 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
112
136
|
get allSelected(): boolean;
|
|
113
137
|
get someSelected(): boolean;
|
|
114
138
|
isRowSelected: (index: number) => boolean;
|
|
139
|
+
/** 1-based position of a page row within the whole (filtered) dataset; the header is row 1. */
|
|
140
|
+
rowAriaIndex: (pageIndex: number) => number;
|
|
141
|
+
/** `repeat` key for a rendered row (see `rowKey`). */
|
|
142
|
+
getRowKey: (row: Record<string, unknown>, index: number) => unknown;
|
|
115
143
|
handleSort: (col: DataGridColumn) => void;
|
|
116
144
|
handleFilterInput: (key: string, e: Event) => void;
|
|
117
145
|
handleSelectAll: () => void;
|
|
118
146
|
handleSelectRow: (index: number, e: Event) => void;
|
|
119
147
|
handleRowClick: (row: Record<string, unknown>, index: number) => void;
|
|
148
|
+
/** Enter/Space on a focused row fires `ml:row-click` (see `clickableRows`). */
|
|
149
|
+
handleRowKeyDown: (row: Record<string, unknown>, index: number, event: KeyboardEvent) => void;
|
|
120
150
|
handleResizeStart: (key: string, e: PointerEvent) => void;
|
|
121
151
|
handleResizeMove: (key: string, e: PointerEvent) => void;
|
|
122
152
|
private _pendingResizeWidth;
|
|
123
153
|
handleResizeEnd: () => void;
|
|
154
|
+
/**
|
|
155
|
+
* Abandon an in-flight column resize without committing it.
|
|
156
|
+
*
|
|
157
|
+
* A `pointercancel` (touch scroll takeover, the OS stealing the pointer)
|
|
158
|
+
* or losing pointer capture never produces a `pointerup`, which left the
|
|
159
|
+
* grid stuck in its "resizing" state with a stray live width applied.
|
|
160
|
+
*/
|
|
161
|
+
handleResizeCancel: () => void;
|
|
162
|
+
/** Resize a column by `delta` px (keyboard path) and announce the new width. */
|
|
163
|
+
resizeColumnBy: (key: string, delta: number) => void;
|
|
124
164
|
/**
|
|
125
165
|
* Keyboard equivalents for the header's mouse-only interactions.
|
|
126
166
|
*
|
|
127
|
-
* Enter/Space sorts; Ctrl/Cmd + Arrow moves the column
|
|
128
|
-
* reordering and click-to-sort
|
|
167
|
+
* Enter/Space sorts; Ctrl/Cmd + Arrow moves the column; Shift + Arrow
|
|
168
|
+
* resizes it. Drag-and-drop reordering, drag-to-resize and click-to-sort
|
|
169
|
+
* were otherwise unreachable without a mouse.
|
|
129
170
|
*/
|
|
130
171
|
handleHeaderKeyDown: (col: DataGridColumn, event: KeyboardEvent) => void;
|
|
131
172
|
/** Move a column `delta` positions and announce the new order. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"data-grid.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAmBa,iBAAkB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB;IAC9F,UAAU,EAAG,WAAW,CAAC;IAIhC,0CAA0C;IACnC,UAAU,UAAS;IAE1B,kCAAkC;IAC3B,OAAO,UAAS;IAEvB,8BAA8B;IACvB,SAAS,UAAQ;IAExB,wBAAwB;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEhC,2CAA2C;IACpC,SAAS,SAAM;IAEtB,iDAAiD;IAC1C,WAAW,SAAM;IAExB,kFAAkF;IAC3E,UAAU,UAAS;IAE1B,8BAA8B;IACvB,QAAQ,SAAM;IAErB,2DAA2D;IACpD,OAAO,UAAQ;IAEtB,yDAAyD;IAClD,aAAa,UAAS;IAE7B;;;;OAIG;IACI,aAAa,UAAS;IAI7B,yBAAyB;IAClB,OAAO,EAAE,cAAc,EAAE,CAAM;IAEtC,eAAe;IACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAM;IAE5C;;;;;;OAMG;IACI,MAAM,EAAE,WAAW,GAAG,IAAI,CAAQ;IAIlC,OAAO,SAAM;IACb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AAE,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,IAAI,CAEzE;IAEF,+EAA+E;IACxE,gBAAgB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,aAAa,KAAG,IAAI,CAUjG;IAEK,iBAAiB,GAAI,KAAK,MAAM,EAAE,GAAG,YAAY,KAAG,IAAI,CAO7D;IAEK,gBAAgB,GAAI,KAAK,MAAM,EAAE,GAAG,YAAY,KAAG,IAAI,CAY5D;IAEF,OAAO,CAAC,mBAAmB,CAAuB;IAE3C,eAAe,QAAO,IAAI,CAiB/B;IAEF;;;;;;OAMG;IACI,kBAAkB,QAAO,IAAI,CAMlC;IAEF,gFAAgF;IACzE,cAAc,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAgBxD;IAEF;;;;;;OAMG;IACI,mBAAmB,GAAI,KAAK,cAAc,EAAE,OAAO,aAAa,KAAG,IAAI,CAuB5E;IAEF,kEAAkE;IAC3D,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAqBpD;IAEK,eAAe,GAAI,KAAK,MAAM,EAAE,GAAG,SAAS,KAAG,IAAI,CAGxD;IAEK,cAAc,GAAI,KAAK,MAAM,EAAE,GAAG,SAAS,KAAG,IAAI,CAGvD;IAEK,aAAa,QAAO,IAAI,CAG7B;IAEK,UAAU,GAAI,WAAW,MAAM,KAAG,IAAI,CAwB3C;IAEK,QAAQ,GAAI,MAAM,MAAM,KAAG,IAAI,CAgBpC;CACF"}
|
|
@@ -7,8 +7,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
8
|
import { dataGridTemplate } from './data-grid.template.js';
|
|
9
9
|
import { dataGridStyles } from './data-grid.styles.js';
|
|
10
|
-
import { TableCore } from '../table-core/index.js';
|
|
11
|
-
|
|
10
|
+
import { TableCore, memoOn, resolveRowKey } from '../table-core/index.js';
|
|
11
|
+
/** Step, in px, for keyboard column resizing (Shift + Arrow). */
|
|
12
|
+
const KEYBOARD_RESIZE_STEP = 16;
|
|
13
|
+
/**
|
|
14
|
+
* Name of the custom property that carries a column's live width.
|
|
15
|
+
*
|
|
16
|
+
* The column key used to be interpolated as-is, so a key that is not a valid
|
|
17
|
+
* CSS identifier (`user.name`, `first name`, `a/b`) produced an invalid
|
|
18
|
+
* `var()` — which invalidates the whole `grid-template-columns` declaration
|
|
19
|
+
* and collapsed the grid. Keys that are already valid keep the same name.
|
|
20
|
+
*/
|
|
21
|
+
export function columnWidthVar(key) {
|
|
22
|
+
const safe = /^[a-zA-Z0-9_-]+$/.test(key) ? key : key.replace(/[^a-zA-Z0-9_-]/g, (char) => `_${char.codePointAt(0).toString(16)}_`);
|
|
23
|
+
return `--ml-grid-col-${safe}`;
|
|
24
|
+
}
|
|
12
25
|
/**
|
|
13
26
|
* ml-data-grid — Full-featured data grid with virtual scrolling, sorting, filtering,
|
|
14
27
|
* selection, column resizing, column reordering, pinned columns, and pagination.
|
|
@@ -62,11 +75,25 @@ let DataGridComponent = class DataGridComponent {
|
|
|
62
75
|
this.virtual = true;
|
|
63
76
|
/** Show per-column filter inputs below the header row */
|
|
64
77
|
this.showFilterRow = false;
|
|
78
|
+
/**
|
|
79
|
+
* Make rows keyboard-operable: each row becomes a tab stop and Enter/Space
|
|
80
|
+
* fire `ml:row-click` (which a click always fires). Set this when you
|
|
81
|
+
* listen for `ml:row-click`. Mirrors ml-table's `clickable-rows`.
|
|
82
|
+
*/
|
|
83
|
+
this.clickableRows = false;
|
|
65
84
|
// ── Properties ───────────────────────────────────────────────────────────────
|
|
66
85
|
/** Column definitions */
|
|
67
86
|
this.columns = [];
|
|
68
87
|
/** Row data */
|
|
69
88
|
this.rows = [];
|
|
89
|
+
/**
|
|
90
|
+
* Row identity: a property name (attribute `row-key="id"`) or a function
|
|
91
|
+
* `(row, index) => key`. Optional. When set, each rendered row's DOM
|
|
92
|
+
* follows its record across sorting, filtering and paging instead of being
|
|
93
|
+
* reused by position, so state held inside custom cells stays with the
|
|
94
|
+
* right row.
|
|
95
|
+
*/
|
|
96
|
+
this.rowKey = null;
|
|
70
97
|
// ── Sort state ───────────────────────────────────────────────────────────────
|
|
71
98
|
this.sortKey = '';
|
|
72
99
|
this.sortDirection = 'asc';
|
|
@@ -110,6 +137,13 @@ let DataGridComponent = class DataGridComponent {
|
|
|
110
137
|
this._sortedRowsMemo = memoOn();
|
|
111
138
|
this._pagedRowsMemo = memoOn();
|
|
112
139
|
this.isRowSelected = (index) => this._core.isRowSelected(index);
|
|
140
|
+
/** 1-based position of a page row within the whole (filtered) dataset; the header is row 1. */
|
|
141
|
+
this.rowAriaIndex = (pageIndex) => {
|
|
142
|
+
const pageOffset = this.serverSide ? 0 : (this.currentPage - 1) * this.pageSize;
|
|
143
|
+
return pageOffset + pageIndex + 2;
|
|
144
|
+
};
|
|
145
|
+
/** `repeat` key for a rendered row (see `rowKey`). */
|
|
146
|
+
this.getRowKey = (row, index) => resolveRowKey(this.rowKey, row, index);
|
|
113
147
|
// ── Event handlers ────────────────────────────────────────────────────────────
|
|
114
148
|
this.handleSort = (col) => {
|
|
115
149
|
// Sorting restarts pagination from the first page before events fire.
|
|
@@ -141,6 +175,17 @@ let DataGridComponent = class DataGridComponent {
|
|
|
141
175
|
this.handleRowClick = (row, index) => {
|
|
142
176
|
this._core.emitRowClick(row, index);
|
|
143
177
|
};
|
|
178
|
+
/** Enter/Space on a focused row fires `ml:row-click` (see `clickableRows`). */
|
|
179
|
+
this.handleRowKeyDown = (row, index, event) => {
|
|
180
|
+
if (!this.clickableRows || event.target !== event.currentTarget) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (event.key !== 'Enter' && event.key !== ' ') {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
this._core.emitRowClick(row, index);
|
|
188
|
+
};
|
|
144
189
|
this.handleResizeStart = (key, e) => {
|
|
145
190
|
this.resizingKey = key;
|
|
146
191
|
this._resizeStartX = e.clientX;
|
|
@@ -160,7 +205,7 @@ let DataGridComponent = class DataGridComponent {
|
|
|
160
205
|
// cell — on each pointermove. Drive the live drag through a CSS custom
|
|
161
206
|
// property instead and commit the value once, on pointerup.
|
|
162
207
|
this._pendingResizeWidth = width;
|
|
163
|
-
this.elementRef.style.setProperty(
|
|
208
|
+
this.elementRef.style.setProperty(columnWidthVar(key), `${width}px`);
|
|
164
209
|
};
|
|
165
210
|
this._pendingResizeWidth = null;
|
|
166
211
|
this.handleResizeEnd = () => {
|
|
@@ -168,7 +213,7 @@ let DataGridComponent = class DataGridComponent {
|
|
|
168
213
|
return;
|
|
169
214
|
if (this._pendingResizeWidth !== null) {
|
|
170
215
|
this.colWidths = { ...this.colWidths, [this.resizingKey]: this._pendingResizeWidth };
|
|
171
|
-
this.elementRef.style.removeProperty(
|
|
216
|
+
this.elementRef.style.removeProperty(columnWidthVar(this.resizingKey));
|
|
172
217
|
this._pendingResizeWidth = null;
|
|
173
218
|
}
|
|
174
219
|
this.elementRef.dispatchEvent(new CustomEvent('ml:column-resize', {
|
|
@@ -178,13 +223,52 @@ let DataGridComponent = class DataGridComponent {
|
|
|
178
223
|
}));
|
|
179
224
|
this.resizingKey = null;
|
|
180
225
|
};
|
|
226
|
+
/**
|
|
227
|
+
* Abandon an in-flight column resize without committing it.
|
|
228
|
+
*
|
|
229
|
+
* A `pointercancel` (touch scroll takeover, the OS stealing the pointer)
|
|
230
|
+
* or losing pointer capture never produces a `pointerup`, which left the
|
|
231
|
+
* grid stuck in its "resizing" state with a stray live width applied.
|
|
232
|
+
*/
|
|
233
|
+
this.handleResizeCancel = () => {
|
|
234
|
+
if (!this.resizingKey)
|
|
235
|
+
return;
|
|
236
|
+
this.elementRef.style.removeProperty(columnWidthVar(this.resizingKey));
|
|
237
|
+
this._pendingResizeWidth = null;
|
|
238
|
+
this.resizingKey = null;
|
|
239
|
+
};
|
|
240
|
+
/** Resize a column by `delta` px (keyboard path) and announce the new width. */
|
|
241
|
+
this.resizeColumnBy = (key, delta) => {
|
|
242
|
+
const col = this.columns.find((c) => c.key === key);
|
|
243
|
+
if (!col || col.resizable === false)
|
|
244
|
+
return;
|
|
245
|
+
const minW = col.minWidth ?? 80;
|
|
246
|
+
const width = Math.max(minW, (this.columnWidths[key] ?? 150) + delta);
|
|
247
|
+
if (width === this.columnWidths[key])
|
|
248
|
+
return;
|
|
249
|
+
this.colWidths = { ...this.colWidths, [key]: width };
|
|
250
|
+
this.elementRef.dispatchEvent(new CustomEvent('ml:column-resize', {
|
|
251
|
+
bubbles: true,
|
|
252
|
+
composed: true,
|
|
253
|
+
detail: { key, width }
|
|
254
|
+
}));
|
|
255
|
+
};
|
|
181
256
|
/**
|
|
182
257
|
* Keyboard equivalents for the header's mouse-only interactions.
|
|
183
258
|
*
|
|
184
|
-
* Enter/Space sorts; Ctrl/Cmd + Arrow moves the column
|
|
185
|
-
* reordering and click-to-sort
|
|
259
|
+
* Enter/Space sorts; Ctrl/Cmd + Arrow moves the column; Shift + Arrow
|
|
260
|
+
* resizes it. Drag-and-drop reordering, drag-to-resize and click-to-sort
|
|
261
|
+
* were otherwise unreachable without a mouse.
|
|
186
262
|
*/
|
|
187
263
|
this.handleHeaderKeyDown = (col, event) => {
|
|
264
|
+
if (event.shiftKey && !event.ctrlKey && !event.metaKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
265
|
+
if (col.resizable === false) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
event.preventDefault();
|
|
269
|
+
this.resizeColumnBy(col.key, event.key === 'ArrowLeft' ? -KEYBOARD_RESIZE_STEP : KEYBOARD_RESIZE_STEP);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
188
272
|
if ((event.ctrlKey || event.metaKey) && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
189
273
|
if (col.reorderable === false) {
|
|
190
274
|
return;
|
|
@@ -392,7 +476,7 @@ let DataGridComponent = class DataGridComponent {
|
|
|
392
476
|
get gridTemplateColumns() {
|
|
393
477
|
// `var(--ml-grid-col-<key>, <committed>px)` lets a live column drag
|
|
394
478
|
// update the layout by writing one custom property, without a render.
|
|
395
|
-
const cols = this.orderedColumns.map((col) => `var(
|
|
479
|
+
const cols = this.orderedColumns.map((col) => `var(${columnWidthVar(col.key)}, ${this.columnWidths[col.key] ?? 150}px)`).join(' ');
|
|
396
480
|
return this.selectable ? `44px ${cols}` : cols;
|
|
397
481
|
}
|
|
398
482
|
getPinnedLeftOffset(key) {
|
|
@@ -462,7 +546,9 @@ DataGridComponent = __decorate([
|
|
|
462
546
|
'server-side',
|
|
463
547
|
'page-size',
|
|
464
548
|
'virtual',
|
|
465
|
-
'show-filter-row'
|
|
549
|
+
'show-filter-row',
|
|
550
|
+
'clickable-rows',
|
|
551
|
+
'row-key'
|
|
466
552
|
]
|
|
467
553
|
})
|
|
468
554
|
], DataGridComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"data-grid.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAwjB1B,CAAC"}
|