@melodicdev/components 2.0.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/assets/melodic-components.js +5570 -4150
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +6466 -5147
- package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts +15 -14
- package/lib/components/data-display/activity-feed/activity-feed-item.component.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.component.js +36 -16
- 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 +4 -0
- package/lib/components/data-display/activity-feed/activity-feed-item.template.d.ts.map +1 -1
- package/lib/components/data-display/activity-feed/activity-feed-item.template.js +15 -14
- package/lib/components/data-display/avatar/avatar.component.d.ts +9 -4
- package/lib/components/data-display/avatar/avatar.component.d.ts.map +1 -1
- package/lib/components/data-display/avatar/avatar.component.js +12 -3
- package/lib/components/data-display/avatar/avatar.template.js +1 -1
- package/lib/components/data-display/badge/badge.component.d.ts +2 -3
- package/lib/components/data-display/badge/badge.component.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.d.ts.map +1 -1
- package/lib/components/data-display/badge/badge.styles.js +56 -35
- package/lib/components/data-display/badge/badge.types.d.ts +2 -0
- package/lib/components/data-display/badge/badge.types.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +10 -0
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.js +59 -27
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +6 -5
- 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 +49 -110
- 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 +2 -6
- package/lib/components/data-display/list/list-item.component.d.ts +15 -6
- package/lib/components/data-display/list/list-item.component.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.component.js +57 -6
- package/lib/components/data-display/list/list-item.styles.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.styles.js +5 -0
- package/lib/components/data-display/list/list-item.template.d.ts.map +1 -1
- package/lib/components/data-display/list/list-item.template.js +18 -12
- package/lib/components/data-display/profile-card/profile-card.component.d.ts +2 -2
- package/lib/components/data-display/profile-card/profile-card.component.d.ts.map +1 -1
- package/lib/components/data-display/profile-card/profile-card.component.js +17 -15
- package/lib/components/data-display/profile-card/profile-card.template.js +1 -1
- package/lib/components/data-display/stat-card/stat-card.component.d.ts +6 -6
- package/lib/components/data-display/stat-card/stat-card.component.d.ts.map +1 -1
- package/lib/components/data-display/stat-card/stat-card.component.js +14 -6
- package/lib/components/data-display/stat-card/stat-card.template.js +4 -4
- package/lib/components/data-display/table/table.component.d.ts +7 -5
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +40 -117
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +1 -6
- package/lib/components/data-display/table-core/index.d.ts +3 -0
- package/lib/components/data-display/table-core/index.d.ts.map +1 -0
- package/lib/components/data-display/table-core/index.js +2 -0
- package/lib/components/data-display/table-core/table-core.d.ts +137 -0
- package/lib/components/data-display/table-core/table-core.d.ts.map +1 -0
- package/lib/components/data-display/table-core/table-core.js +225 -0
- package/lib/components/data-display/tag/tag.component.d.ts +14 -7
- package/lib/components/data-display/tag/tag.component.d.ts.map +1 -1
- package/lib/components/data-display/tag/tag.component.js +29 -5
- package/lib/components/data-display/tag/tag.template.js +2 -2
- package/lib/components/data-display/tag/tag.types.d.ts +8 -1
- package/lib/components/data-display/tag/tag.types.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.component.d.ts +6 -3
- package/lib/components/feedback/alert/alert.component.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.component.js +13 -4
- package/lib/components/feedback/alert/alert.template.js +1 -1
- package/lib/components/feedback/progress/progress.component.d.ts +4 -0
- package/lib/components/feedback/progress/progress.component.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.component.js +9 -0
- package/lib/components/feedback/progress/progress.template.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.template.js +19 -5
- package/lib/components/feedback/toast/toast.component.d.ts +6 -3
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +13 -4
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +2 -1
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +12 -4
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +39 -30
- package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.template.js +14 -0
- package/lib/components/forms/button/button.component.d.ts +28 -3
- package/lib/components/forms/button/button.component.d.ts.map +1 -1
- package/lib/components/forms/button/button.component.js +81 -6
- package/lib/components/forms/button/button.template.js +1 -1
- package/lib/components/forms/button/button.types.d.ts +8 -1
- package/lib/components/forms/button/button.types.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group-item.component.d.ts +2 -2
- package/lib/components/forms/button-group/button-group-item.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.d.ts +4 -2
- package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.js +3 -1
- package/lib/components/forms/button-group/button-group.styles.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.styles.js +15 -1
- package/lib/components/forms/button-group/button-group.template.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.template.js +4 -2
- package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -2
- package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.component.js +3 -1
- package/lib/components/forms/checkbox/checkbox.styles.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.styles.js +19 -0
- package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.template.js +4 -2
- package/lib/components/forms/date-picker/calendar.component.js +1 -1
- package/lib/components/forms/date-picker/date-picker.component.d.ts +11 -4
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +99 -32
- package/lib/components/forms/date-picker/date-picker.styles.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.styles.js +0 -10
- package/lib/components/forms/date-picker/date-picker.template.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.template.js +3 -4
- package/lib/components/forms/file-upload/file-upload-item.component.d.ts +7 -0
- package/lib/components/forms/file-upload/file-upload-item.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload-item.component.js +15 -0
- package/lib/components/forms/file-upload/file-upload.component.d.ts +15 -0
- package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.component.js +56 -0
- package/lib/components/forms/form-field/form-field.component.d.ts +12 -4
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +50 -31
- package/lib/components/forms/form-field/form-field.template.js +1 -1
- package/lib/components/forms/input/input.component.d.ts +2 -2
- package/lib/components/forms/input/input.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio-group.component.d.ts +6 -0
- package/lib/components/forms/radio/radio-group.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio-group.component.js +69 -2
- package/lib/components/forms/radio/radio-group.template.js +1 -1
- package/lib/components/forms/radio/radio.component.d.ts +7 -2
- package/lib/components/forms/radio/radio.component.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.component.js +5 -0
- package/lib/components/forms/radio/radio.template.d.ts.map +1 -1
- package/lib/components/forms/radio/radio.template.js +1 -0
- package/lib/components/forms/select/select.component.d.ts +13 -6
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +32 -36
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +6 -2
- package/lib/components/forms/slider/slider.component.d.ts +2 -2
- package/lib/components/forms/slider/slider.component.d.ts.map +1 -1
- package/lib/components/forms/slider/slider.component.js +5 -1
- package/lib/components/forms/textarea/textarea.component.d.ts +2 -2
- package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.component.d.ts +4 -2
- package/lib/components/forms/toggle/toggle.component.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.component.js +3 -1
- package/lib/components/forms/toggle/toggle.styles.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.styles.js +19 -0
- package/lib/components/forms/toggle/toggle.template.d.ts.map +1 -1
- package/lib/components/forms/toggle/toggle.template.js +11 -3
- package/lib/components/foundation/card/card.component.d.ts +7 -6
- package/lib/components/foundation/card/card.component.d.ts.map +1 -1
- package/lib/components/foundation/card/card.component.js +18 -7
- package/lib/components/foundation/card/card.styles.d.ts.map +1 -1
- package/lib/components/foundation/card/card.styles.js +5 -0
- package/lib/components/foundation/card/card.template.d.ts.map +1 -1
- package/lib/components/foundation/card/card.template.js +16 -11
- package/lib/components/foundation/divider/divider.component.d.ts +5 -4
- package/lib/components/foundation/divider/divider.component.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.component.js +11 -3
- package/lib/components/foundation/divider/divider.styles.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.styles.js +6 -0
- package/lib/components/foundation/divider/divider.template.d.ts +5 -0
- package/lib/components/foundation/divider/divider.template.d.ts.map +1 -1
- package/lib/components/foundation/divider/divider.template.js +9 -6
- package/lib/components/general/icon/icon.template.d.ts.map +1 -1
- package/lib/components/general/icon/icon.template.js +3 -1
- package/lib/components/navigation/pagination/pagination.component.d.ts +5 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.component.js +22 -10
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +6 -4
- package/lib/components/navigation/sidebar/sidebar-item.component.d.ts +4 -4
- package/lib/components/navigation/sidebar/sidebar-item.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.component.js +11 -4
- package/lib/components/navigation/sidebar/sidebar-item.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +7 -0
- package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.component.js +48 -5
- package/lib/components/navigation/steps/step-panel.component.d.ts +7 -0
- package/lib/components/navigation/steps/step-panel.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step-panel.component.js +7 -0
- package/lib/components/navigation/steps/step-panel.template.d.ts +1 -1
- package/lib/components/navigation/steps/step-panel.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/step-panel.template.js +2 -2
- package/lib/components/navigation/steps/step.component.d.ts +2 -2
- package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.component.js +8 -2
- package/lib/components/navigation/steps/step.template.js +1 -1
- package/lib/components/navigation/steps/steps.component.d.ts +3 -1
- package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.component.js +47 -14
- package/lib/components/navigation/steps/steps.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.template.js +5 -1
- package/lib/components/navigation/tabs/tab-panel.component.d.ts +7 -0
- package/lib/components/navigation/tabs/tab-panel.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.component.js +7 -0
- package/lib/components/navigation/tabs/tab-panel.template.d.ts +1 -1
- package/lib/components/navigation/tabs/tab-panel.template.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.template.js +2 -2
- package/lib/components/navigation/tabs/tabs.component.d.ts +5 -3
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +49 -14
- package/lib/components/navigation/tabs/tabs.template.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.template.js +6 -1
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +17 -2
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +52 -6
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +5 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts +2 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +46 -18
- package/lib/components/overlays/drawer/drawer.component.d.ts +9 -2
- package/lib/components/overlays/drawer/drawer.component.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.component.js +34 -4
- package/lib/components/overlays/drawer/drawer.styles.d.ts.map +1 -1
- package/lib/components/overlays/drawer/drawer.styles.js +4 -0
- package/lib/components/overlays/dropdown/dropdown-item.component.d.ts +5 -2
- package/lib/components/overlays/dropdown/dropdown-item.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.component.js +18 -0
- package/lib/components/overlays/dropdown/dropdown-item.template.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown-item.template.js +0 -3
- package/lib/components/overlays/dropdown/dropdown.component.d.ts +8 -4
- package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.component.js +61 -60
- package/lib/components/overlays/popover/popover.component.d.ts +6 -4
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +37 -51
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +29 -4
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +73 -31
- package/lib/components/overlays/tooltip/tooltip.styles.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.styles.js +22 -10
- package/lib/components/overlays/tooltip/tooltip.template.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.template.js +3 -2
- package/lib/components/pages/auth/login-page.component.d.ts +11 -4
- package/lib/components/pages/auth/login-page.component.d.ts.map +1 -1
- package/lib/components/pages/auth/login-page.component.js +18 -5
- package/lib/components/pages/auth/login-page.template.d.ts.map +1 -1
- package/lib/components/pages/auth/login-page.template.js +9 -10
- package/lib/components/pages/auth/signup-page.component.d.ts +11 -4
- package/lib/components/pages/auth/signup-page.component.d.ts.map +1 -1
- package/lib/components/pages/auth/signup-page.component.js +18 -5
- package/lib/components/pages/auth/signup-page.template.d.ts.map +1 -1
- package/lib/components/pages/auth/signup-page.template.js +9 -10
- package/lib/components/pages/dashboard/dashboard-page.component.d.ts +18 -11
- package/lib/components/pages/dashboard/dashboard-page.component.d.ts.map +1 -1
- package/lib/components/pages/dashboard/dashboard-page.component.js +55 -13
- package/lib/components/pages/dashboard/dashboard-page.template.js +1 -1
- package/lib/components/sections/app-shell/app-shell.component.d.ts +6 -6
- package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.component.js +14 -6
- package/lib/components/sections/app-shell/app-shell.template.js +3 -3
- package/lib/components/sections/hero/hero-section.component.d.ts +6 -3
- package/lib/components/sections/hero/hero-section.component.d.ts.map +1 -1
- package/lib/components/sections/hero/hero-section.component.js +13 -4
- package/lib/components/sections/hero/hero-section.template.js +2 -2
- package/lib/components/sections/page-header/page-header.component.d.ts +16 -17
- package/lib/components/sections/page-header/page-header.component.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.component.js +36 -25
- package/lib/components/sections/page-header/page-header.styles.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.styles.js +9 -0
- package/lib/components/sections/page-header/page-header.template.d.ts +5 -0
- package/lib/components/sections/page-header/page-header.template.d.ts.map +1 -1
- package/lib/components/sections/page-header/page-header.template.js +42 -31
- package/lib/components/sections/page-section/page-section.component.d.ts +16 -12
- package/lib/components/sections/page-section/page-section.component.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.component.js +34 -12
- package/lib/components/sections/page-section/page-section.styles.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.styles.js +6 -0
- package/lib/components/sections/page-section/page-section.template.d.ts +6 -0
- package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.template.js +26 -15
- package/lib/components/sections/page-section/sanitize-href.function.d.ts +12 -0
- package/lib/components/sections/page-section/sanitize-href.function.d.ts.map +1 -0
- package/lib/components/sections/page-section/sanitize-href.function.js +15 -0
- package/lib/directives/tooltip.directive.d.ts +8 -2
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +103 -9
- package/lib/functions/deprecation.functions.d.ts +21 -0
- package/lib/functions/deprecation.functions.d.ts.map +1 -0
- package/lib/functions/deprecation.functions.js +44 -0
- package/lib/functions/index.d.ts +2 -0
- package/lib/functions/index.d.ts.map +1 -1
- package/lib/functions/index.js +2 -0
- package/lib/functions/watch-slot-presence.function.d.ts +17 -0
- package/lib/functions/watch-slot-presence.function.d.ts.map +1 -0
- package/lib/functions/watch-slot-presence.function.js +27 -0
- package/lib/theme/functions/create-theme.function.d.ts +15 -1
- package/lib/theme/functions/create-theme.function.d.ts.map +1 -1
- package/lib/theme/functions/create-theme.function.js +57 -11
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/types/index.d.ts +8 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.d.ts +19 -1
- package/lib/utils/accessibility/focus-trap.d.ts.map +1 -1
- package/lib/utils/accessibility/focus-trap.js +77 -8
- 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/accessibility/live-region.d.ts +10 -3
- package/lib/utils/accessibility/live-region.d.ts.map +1 -1
- package/lib/utils/accessibility/live-region.js +64 -35
- package/lib/utils/directives/click-outside.directive.d.ts.map +1 -1
- package/lib/utils/directives/click-outside.directive.js +5 -3
- package/lib/utils/overlay/index.d.ts +4 -0
- package/lib/utils/overlay/index.d.ts.map +1 -0
- package/lib/utils/overlay/index.js +2 -0
- package/lib/utils/overlay/overlay-positioner.d.ts +54 -0
- package/lib/utils/overlay/overlay-positioner.d.ts.map +1 -0
- package/lib/utils/overlay/overlay-positioner.js +85 -0
- package/lib/utils/overlay/toggle-dismiss-guard.d.ts +24 -0
- package/lib/utils/overlay/toggle-dismiss-guard.d.ts.map +1 -0
- package/lib/utils/overlay/toggle-dismiss-guard.js +36 -0
- package/lib/utils/positioning/auto-update.d.ts.map +1 -1
- package/lib/utils/positioning/auto-update.js +3 -0
- package/lib/utils/positioning/compute-position.d.ts.map +1 -1
- package/lib/utils/positioning/compute-position.js +8 -4
- package/lib/utils/positioning/middlewares/flip.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/flip.middleware.js +10 -3
- package/lib/utils/positioning/middlewares/offset.middleware.d.ts +15 -0
- package/lib/utils/positioning/middlewares/offset.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/offset.middleware.js +31 -1
- package/lib/utils/positioning/middlewares/shift.middleware.d.ts +13 -3
- package/lib/utils/positioning/middlewares/shift.middleware.d.ts.map +1 -1
- package/lib/utils/positioning/middlewares/shift.middleware.js +15 -7
- package/package.json +6 -2
|
@@ -18,6 +18,20 @@ export function parseDate(iso) {
|
|
|
18
18
|
const [y, m, d] = iso.split('T')[0].split('-').map(Number);
|
|
19
19
|
return new Date(y, m - 1, d);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse an event timestamp on the single timezone basis the calendar uses
|
|
23
|
+
* everywhere: LOCAL time. Full timestamps go through `new Date(iso)` so any
|
|
24
|
+
* offset/Z suffix is honored and converted to local time; date-only strings
|
|
25
|
+
* are treated as local midnight (never `new Date('YYYY-MM-DD')`, which is UTC
|
|
26
|
+
* midnight and shifts a day in negative-offset timezones).
|
|
27
|
+
*/
|
|
28
|
+
export function parseEventDate(iso) {
|
|
29
|
+
return iso.includes('T') ? new Date(iso) : parseDate(iso);
|
|
30
|
+
}
|
|
31
|
+
/** Local-time calendar date (YYYY-MM-DD) of an event timestamp. */
|
|
32
|
+
export function toLocalIsoDate(date) {
|
|
33
|
+
return toIsoDate(date.getFullYear(), date.getMonth(), date.getDate());
|
|
34
|
+
}
|
|
21
35
|
export function isSameDay(a, b) {
|
|
22
36
|
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
23
37
|
}
|
|
@@ -54,7 +68,7 @@ export function getISOWeekNumber(date) {
|
|
|
54
68
|
return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
|
|
55
69
|
}
|
|
56
70
|
export function formatTime(iso) {
|
|
57
|
-
const date =
|
|
71
|
+
const date = parseEventDate(iso);
|
|
58
72
|
const h = date.getHours();
|
|
59
73
|
const m = date.getMinutes();
|
|
60
74
|
const ampm = h >= 12 ? 'PM' : 'AM';
|
|
@@ -133,10 +147,10 @@ export function getWeekdayHeaders(weekStartsOn = 0) {
|
|
|
133
147
|
});
|
|
134
148
|
}
|
|
135
149
|
export function getEventsForDate(events, iso) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
// Bucket by the event's LOCAL calendar date — the same basis used to render
|
|
151
|
+
// its time — so a `…T23:00:00Z` event never lands on its UTC date while
|
|
152
|
+
// displaying a local-shifted time on the wrong day.
|
|
153
|
+
return events.filter(e => toLocalIsoDate(parseEventDate(e.start)) === iso);
|
|
140
154
|
}
|
|
141
155
|
export function getMonthAbbrev(date) {
|
|
142
156
|
return MONTH_ABBREVS[date.getMonth()];
|
|
@@ -147,31 +161,48 @@ export function getDayAbbrev(date) {
|
|
|
147
161
|
export function getDayName(date) {
|
|
148
162
|
return DAY_NAMES[date.getDay()];
|
|
149
163
|
}
|
|
150
|
-
function getMinutesFromMidnight(iso) {
|
|
151
|
-
const date = new Date(iso);
|
|
152
|
-
return date.getHours() * 60 + date.getMinutes();
|
|
153
|
-
}
|
|
154
164
|
/** Convert minutes from midnight to a 1-based grid row (30-min increments, 48 rows) */
|
|
155
165
|
function minutesToGridRow(minutes) {
|
|
156
166
|
return Math.floor(minutes / TIME_INCREMENT) + 1;
|
|
157
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* An event's in-day occupancy in local minutes from midnight.
|
|
170
|
+
*
|
|
171
|
+
* Events that cross midnight (or otherwise end on a later local day than they
|
|
172
|
+
* start) are clamped to the end of the start day, so grid spans stay valid
|
|
173
|
+
* (gridRowEnd >= gridRowStart) and column packing sees real occupancy instead
|
|
174
|
+
* of an end that is numerically before the start. Degenerate/reversed inputs
|
|
175
|
+
* within one day are clamped to a minimum positive span.
|
|
176
|
+
*/
|
|
177
|
+
function getEventSpan(event) {
|
|
178
|
+
const startDate = parseEventDate(event.start);
|
|
179
|
+
const endDate = parseEventDate(event.end);
|
|
180
|
+
const start = startDate.getHours() * 60 + startDate.getMinutes();
|
|
181
|
+
let end = endDate.getHours() * 60 + endDate.getMinutes();
|
|
182
|
+
if (!isSameDay(startDate, endDate)) {
|
|
183
|
+
end = 24 * 60;
|
|
184
|
+
}
|
|
185
|
+
return { start, end: Math.max(end, start + 1) };
|
|
186
|
+
}
|
|
158
187
|
export function layoutOverlappingEvents(events) {
|
|
159
188
|
if (events.length === 0)
|
|
160
189
|
return [];
|
|
190
|
+
const spans = new Map();
|
|
191
|
+
for (const event of events) {
|
|
192
|
+
spans.set(event.id, getEventSpan(event));
|
|
193
|
+
}
|
|
194
|
+
const spanOf = (event) => spans.get(event.id);
|
|
161
195
|
const sorted = [...events].sort((a, b) => {
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
const bDuration = getMinutesFromMidnight(b.end) - bStart;
|
|
168
|
-
return bDuration - aDuration;
|
|
196
|
+
const aSpan = spanOf(a);
|
|
197
|
+
const bSpan = spanOf(b);
|
|
198
|
+
if (aSpan.start !== bSpan.start)
|
|
199
|
+
return aSpan.start - bSpan.start;
|
|
200
|
+
return (bSpan.end - bSpan.start) - (aSpan.end - aSpan.start);
|
|
169
201
|
});
|
|
170
202
|
const columns = [];
|
|
171
203
|
const eventColumns = new Map();
|
|
172
204
|
for (const event of sorted) {
|
|
173
|
-
const start =
|
|
174
|
-
const end = getMinutesFromMidnight(event.end);
|
|
205
|
+
const { start, end } = spanOf(event);
|
|
175
206
|
let placed = false;
|
|
176
207
|
for (let col = 0; col < columns.length; col++) {
|
|
177
208
|
const lastInCol = columns[col][columns[col].length - 1];
|
|
@@ -195,16 +226,16 @@ export function layoutOverlappingEvents(events) {
|
|
|
195
226
|
continue;
|
|
196
227
|
const group = [event];
|
|
197
228
|
visited.add(event.id);
|
|
198
|
-
let groupEnd =
|
|
229
|
+
let groupEnd = spanOf(event).end;
|
|
199
230
|
let maxCol = eventColumns.get(event.id) + 1;
|
|
200
231
|
for (const other of sorted) {
|
|
201
232
|
if (visited.has(other.id))
|
|
202
233
|
continue;
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
234
|
+
const otherSpan = spanOf(other);
|
|
235
|
+
if (otherSpan.start < groupEnd) {
|
|
205
236
|
group.push(other);
|
|
206
237
|
visited.add(other.id);
|
|
207
|
-
groupEnd = Math.max(groupEnd,
|
|
238
|
+
groupEnd = Math.max(groupEnd, otherSpan.end);
|
|
208
239
|
maxCol = Math.max(maxCol, eventColumns.get(other.id) + 1);
|
|
209
240
|
}
|
|
210
241
|
}
|
|
@@ -213,14 +244,15 @@ export function layoutOverlappingEvents(events) {
|
|
|
213
244
|
const result = [];
|
|
214
245
|
for (const group of groups) {
|
|
215
246
|
for (const event of group.events) {
|
|
216
|
-
const start =
|
|
217
|
-
const end = getMinutesFromMidnight(event.end);
|
|
247
|
+
const { start, end } = spanOf(event);
|
|
218
248
|
const col = eventColumns.get(event.id);
|
|
219
249
|
const total = group.totalColumns;
|
|
250
|
+
const gridRowStart = minutesToGridRow(start);
|
|
251
|
+
const gridRowEnd = Math.max(minutesToGridRow(end), gridRowStart + 1);
|
|
220
252
|
result.push({
|
|
221
253
|
event,
|
|
222
|
-
gridRowStart
|
|
223
|
-
gridRowEnd
|
|
254
|
+
gridRowStart,
|
|
255
|
+
gridRowEnd,
|
|
224
256
|
left: col / total,
|
|
225
257
|
width: 1 / total
|
|
226
258
|
});
|
|
@@ -270,7 +302,7 @@ export function getMiniCalendarDots(year, month, events) {
|
|
|
270
302
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
271
303
|
for (let d = 1; d <= daysInMonth; d++) {
|
|
272
304
|
const iso = toIsoDate(year, month, d);
|
|
273
|
-
if (events.some(e => e.start
|
|
305
|
+
if (events.some(e => toLocalIsoDate(parseEventDate(e.start)) === iso)) {
|
|
274
306
|
dots.add(iso);
|
|
275
307
|
}
|
|
276
308
|
}
|
|
@@ -19,7 +19,10 @@ import type { DataGridColumn, SortDirection } from './data-grid.types.js';
|
|
|
19
19
|
*
|
|
20
20
|
* @fires ml:sort - { key, direction }
|
|
21
21
|
* @fires ml:filter - { filters: Record<string, string> }
|
|
22
|
-
* @fires ml:select - { selectedRows
|
|
22
|
+
* @fires ml:select - { selectedRows, selectedIndices, allSelected } where `selectedRows`
|
|
23
|
+
* contains the selected row OBJECTS and `selectedIndices` their indices in the original
|
|
24
|
+
* `rows` array (consumer order). Also emitted when sorting/filtering/paging clears a
|
|
25
|
+
* non-empty selection. BREAKING (2.x): `selectedRows` previously contained page-relative indices.
|
|
23
26
|
* @fires ml:row-click - { row, index }
|
|
24
27
|
* @fires ml:column-resize - { key, width }
|
|
25
28
|
* @fires ml:column-reorder - { order: string[] }
|
|
@@ -65,8 +68,8 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
65
68
|
resizingKey: string | null;
|
|
66
69
|
draggingKey: string | null;
|
|
67
70
|
dragOverKey: string | null;
|
|
68
|
-
|
|
69
|
-
private
|
|
71
|
+
/** Shared table pipeline: sorting, selection, ml:* events, virtual window. */
|
|
72
|
+
private _core;
|
|
70
73
|
private _resizeStartX;
|
|
71
74
|
private _resizeStartWidth;
|
|
72
75
|
get rowHeight(): number;
|
|
@@ -74,7 +77,6 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
74
77
|
onCreate(): void;
|
|
75
78
|
onRender(): void;
|
|
76
79
|
onDestroy(): void;
|
|
77
|
-
private _attachScroller;
|
|
78
80
|
private _syncColumnState;
|
|
79
81
|
get filteredRows(): Record<string, unknown>[];
|
|
80
82
|
get sortedRows(): Record<string, unknown>[];
|
|
@@ -109,6 +111,5 @@ export declare class DataGridComponent implements IElementRef, OnCreate, OnDestr
|
|
|
109
111
|
handleDragEnd: () => void;
|
|
110
112
|
handleDrop: (targetKey: string) => void;
|
|
111
113
|
goToPage: (page: number) => void;
|
|
112
|
-
private _emitSelect;
|
|
113
114
|
}
|
|
114
115
|
//# sourceMappingURL=data-grid.component.d.ts.map
|
|
@@ -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;AAK1E
|
|
1
|
+
{"version":3,"file":"data-grid.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.component.ts"],"names":[],"mappings":"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"}
|
|
@@ -7,7 +7,7 @@ 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 {
|
|
10
|
+
import { TableCore } from '../table-core/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* ml-data-grid — Full-featured data grid with virtual scrolling, sorting, filtering,
|
|
13
13
|
* selection, column resizing, column reordering, pinned columns, and pagination.
|
|
@@ -27,7 +27,10 @@ import { VirtualScroller } from '../../../utils/virtual-scroll/index.js';
|
|
|
27
27
|
*
|
|
28
28
|
* @fires ml:sort - { key, direction }
|
|
29
29
|
* @fires ml:filter - { filters: Record<string, string> }
|
|
30
|
-
* @fires ml:select - { selectedRows
|
|
30
|
+
* @fires ml:select - { selectedRows, selectedIndices, allSelected } where `selectedRows`
|
|
31
|
+
* contains the selected row OBJECTS and `selectedIndices` their indices in the original
|
|
32
|
+
* `rows` array (consumer order). Also emitted when sorting/filtering/paging clears a
|
|
33
|
+
* non-empty selection. BREAKING (2.x): `selectedRows` previously contained page-relative indices.
|
|
31
34
|
* @fires ml:row-click - { row, index }
|
|
32
35
|
* @fires ml:column-resize - { key, width }
|
|
33
36
|
* @fires ml:column-reorder - { order: string[] }
|
|
@@ -83,65 +86,46 @@ let DataGridComponent = class DataGridComponent {
|
|
|
83
86
|
// ── Reorder drag state (reactive) ────────────────────────────────────────────
|
|
84
87
|
this.draggingKey = null;
|
|
85
88
|
this.dragOverKey = null;
|
|
86
|
-
// ── Private (non-reactive)
|
|
89
|
+
// ── Private (non-reactive) drag intermediates and shared core ────────────────
|
|
87
90
|
// Properties starting with _ are intentionally excluded from reactivity.
|
|
88
|
-
|
|
89
|
-
this.
|
|
91
|
+
/** Shared table pipeline: sorting, selection, ml:* events, virtual window. */
|
|
92
|
+
this._core = new TableCore(this, {
|
|
93
|
+
viewportSelector: '.ml-data-grid__viewport',
|
|
94
|
+
displayRows: () => this.processedRows
|
|
95
|
+
});
|
|
90
96
|
this._resizeStartX = 0;
|
|
91
97
|
this._resizeStartWidth = 0;
|
|
92
|
-
this.isRowSelected = (index) => this.
|
|
98
|
+
this.isRowSelected = (index) => this._core.isRowSelected(index);
|
|
93
99
|
// ── Event handlers ────────────────────────────────────────────────────────────
|
|
94
100
|
this.handleSort = (col) => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
this.sortKey = col.key;
|
|
102
|
-
this.sortDirection = 'asc';
|
|
103
|
-
}
|
|
104
|
-
this.currentPage = 1;
|
|
105
|
-
// Selection is positional; sorting reorders rows, so clear it (otherwise
|
|
106
|
-
// the same indices would point at different rows).
|
|
107
|
-
this.selectedIndices = [];
|
|
108
|
-
this._scroller.invalidate();
|
|
109
|
-
this.elementRef.dispatchEvent(new CustomEvent('ml:sort', {
|
|
110
|
-
bubbles: true,
|
|
111
|
-
composed: true,
|
|
112
|
-
detail: { key: this.sortKey, direction: this.sortDirection }
|
|
113
|
-
}));
|
|
101
|
+
// Sorting restarts pagination from the first page before events fire.
|
|
102
|
+
this._core.handleSortClick(col, () => {
|
|
103
|
+
this.currentPage = 1;
|
|
104
|
+
});
|
|
114
105
|
};
|
|
115
106
|
this.handleFilterInput = (key, e) => {
|
|
116
107
|
const val = e.target.value;
|
|
117
108
|
this.filters = { ...this.filters, [key]: val };
|
|
118
109
|
this.currentPage = 1;
|
|
119
110
|
// Filtering changes which rows are present; positional selection no longer applies.
|
|
120
|
-
|
|
121
|
-
this.
|
|
111
|
+
const hadSelection = this._core.clearSelection();
|
|
112
|
+
this._core.invalidateScroller();
|
|
122
113
|
this.elementRef.dispatchEvent(new CustomEvent('ml:filter', {
|
|
123
114
|
bubbles: true,
|
|
124
115
|
composed: true,
|
|
125
116
|
detail: { filters: this.filters }
|
|
126
117
|
}));
|
|
118
|
+
if (hadSelection)
|
|
119
|
+
this._core.emitSelect();
|
|
127
120
|
};
|
|
128
121
|
this.handleSelectAll = () => {
|
|
129
|
-
this.
|
|
130
|
-
this._emitSelect();
|
|
122
|
+
this._core.toggleSelectAll();
|
|
131
123
|
};
|
|
132
124
|
this.handleSelectRow = (index, e) => {
|
|
133
|
-
|
|
134
|
-
this.selectedIndices = this.selectedIndices.includes(index)
|
|
135
|
-
? this.selectedIndices.filter(i => i !== index)
|
|
136
|
-
: [...this.selectedIndices, index];
|
|
137
|
-
this._emitSelect();
|
|
125
|
+
this._core.toggleSelectRow(index, e);
|
|
138
126
|
};
|
|
139
127
|
this.handleRowClick = (row, index) => {
|
|
140
|
-
this.
|
|
141
|
-
bubbles: true,
|
|
142
|
-
composed: true,
|
|
143
|
-
detail: { row, index }
|
|
144
|
-
}));
|
|
128
|
+
this._core.emitRowClick(row, index);
|
|
145
129
|
};
|
|
146
130
|
this.handleResizeStart = (key, e) => {
|
|
147
131
|
this.resizingKey = key;
|
|
@@ -215,15 +199,16 @@ let DataGridComponent = class DataGridComponent {
|
|
|
215
199
|
this.currentPage = page;
|
|
216
200
|
// Selection indices are page-relative; clear on page change so the header
|
|
217
201
|
// checkbox and ml:select don't report rows from the previous page.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this._scroller.invalidate();
|
|
202
|
+
const hadSelection = this._core.clearSelection();
|
|
203
|
+
this._core.scrollViewportToTop();
|
|
204
|
+
this._core.invalidateScroller();
|
|
222
205
|
this.elementRef.dispatchEvent(new CustomEvent('ml:page-change', {
|
|
223
206
|
bubbles: true,
|
|
224
207
|
composed: true,
|
|
225
208
|
detail: { page: this.currentPage, pageSize: this.pageSize }
|
|
226
209
|
}));
|
|
210
|
+
if (hadSelection)
|
|
211
|
+
this._core.emitSelect();
|
|
227
212
|
};
|
|
228
213
|
}
|
|
229
214
|
// ── Row height by size ────────────────────────────────────────────────────────
|
|
@@ -236,19 +221,24 @@ let DataGridComponent = class DataGridComponent {
|
|
|
236
221
|
this._syncColumnState(newVal);
|
|
237
222
|
}
|
|
238
223
|
if (name === 'rows') {
|
|
239
|
-
// Selection is positional; a new dataset invalidates it.
|
|
240
|
-
//
|
|
241
|
-
// before the assignment)
|
|
242
|
-
|
|
243
|
-
|
|
224
|
+
// Selection is positional; a new dataset invalidates it. The virtual
|
|
225
|
+
// window recomputes after the new value commits (onPropertyChange fires
|
|
226
|
+
// before the assignment) — after clamping the page when the new dataset
|
|
227
|
+
// has fewer pages than the current one (internal filter/sort already
|
|
228
|
+
// reset it; an external rows replacement must not leave e.g.
|
|
229
|
+
// "Page 5 of 2" and a blank grid).
|
|
230
|
+
this._core.handleRowsChange(() => {
|
|
231
|
+
if (this.currentPage > this.totalPages) {
|
|
232
|
+
this.currentPage = this.totalPages;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
244
235
|
}
|
|
245
236
|
}
|
|
246
237
|
onCreate() {
|
|
247
238
|
this._syncColumnState(this.columns);
|
|
248
|
-
this.
|
|
239
|
+
this._core.attachScroller();
|
|
249
240
|
}
|
|
250
241
|
onRender() {
|
|
251
|
-
this._attachScroller();
|
|
252
242
|
// Update CSS variable for filter row sticky offset
|
|
253
243
|
const shadow = this.elementRef.shadowRoot;
|
|
254
244
|
if (shadow) {
|
|
@@ -260,40 +250,12 @@ let DataGridComponent = class DataGridComponent {
|
|
|
260
250
|
}
|
|
261
251
|
}
|
|
262
252
|
}
|
|
263
|
-
|
|
264
|
-
if (this._viewport && this._viewport.clientHeight === 0 && this.processedRows.length > 0) {
|
|
265
|
-
const approxEnd = Math.min(this.processedRows.length, Math.ceil(600 / this.rowHeight) + 6);
|
|
266
|
-
if (approxEnd !== this.endIndex) {
|
|
267
|
-
this.endIndex = approxEnd;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (!this.virtual) {
|
|
271
|
-
const total = this.processedRows.length;
|
|
272
|
-
if (this.endIndex !== total)
|
|
273
|
-
this.endIndex = total;
|
|
274
|
-
}
|
|
253
|
+
this._core.syncRenderWindow();
|
|
275
254
|
}
|
|
276
255
|
onDestroy() {
|
|
277
|
-
this.
|
|
278
|
-
this._viewport = null;
|
|
256
|
+
this._core.detach();
|
|
279
257
|
}
|
|
280
258
|
// ── Private helpers ───────────────────────────────────────────────────────────
|
|
281
|
-
_attachScroller() {
|
|
282
|
-
if (this._viewport)
|
|
283
|
-
return; // already attached
|
|
284
|
-
const shadow = this.elementRef.shadowRoot;
|
|
285
|
-
if (!shadow)
|
|
286
|
-
return;
|
|
287
|
-
this._viewport = shadow.querySelector('.ml-data-grid__viewport');
|
|
288
|
-
if (!this._viewport)
|
|
289
|
-
return;
|
|
290
|
-
this._scroller.attach(this._viewport, {
|
|
291
|
-
rowHeight: () => this.rowHeight,
|
|
292
|
-
itemCount: () => this.processedRows.length,
|
|
293
|
-
onUpdate: (start, end) => { this.startIndex = start; this.endIndex = end; },
|
|
294
|
-
enabled: () => this.virtual,
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
259
|
_syncColumnState(cols) {
|
|
298
260
|
this.colOrder = cols.map(c => c.key);
|
|
299
261
|
const newWidths = {};
|
|
@@ -312,21 +274,9 @@ let DataGridComponent = class DataGridComponent {
|
|
|
312
274
|
return this.rows.filter(row => entries.every(([key, val]) => String(row[key] ?? '').toLowerCase().includes(val.toLowerCase())));
|
|
313
275
|
}
|
|
314
276
|
get sortedRows() {
|
|
315
|
-
if (this.serverSide
|
|
277
|
+
if (this.serverSide)
|
|
316
278
|
return this.filteredRows;
|
|
317
|
-
|
|
318
|
-
const dir = this.sortDirection === 'asc' ? 1 : -1;
|
|
319
|
-
return [...this.filteredRows].sort((a, b) => {
|
|
320
|
-
const aVal = a[key];
|
|
321
|
-
const bVal = b[key];
|
|
322
|
-
if (aVal == null)
|
|
323
|
-
return bVal == null ? 0 : 1;
|
|
324
|
-
if (bVal == null)
|
|
325
|
-
return -1;
|
|
326
|
-
if (typeof aVal === 'number' && typeof bVal === 'number')
|
|
327
|
-
return (aVal - bVal) * dir;
|
|
328
|
-
return String(aVal).localeCompare(String(bVal)) * dir;
|
|
329
|
-
});
|
|
279
|
+
return this._core.sortRows(this.filteredRows);
|
|
330
280
|
}
|
|
331
281
|
get pagedRows() {
|
|
332
282
|
if (this.serverSide)
|
|
@@ -338,9 +288,7 @@ let DataGridComponent = class DataGridComponent {
|
|
|
338
288
|
return this.pagedRows;
|
|
339
289
|
}
|
|
340
290
|
get visibleRows() {
|
|
341
|
-
|
|
342
|
-
return this.processedRows;
|
|
343
|
-
return this.processedRows.slice(this.startIndex, this.endIndex);
|
|
291
|
+
return this._core.visibleRows;
|
|
344
292
|
}
|
|
345
293
|
get totalRows() {
|
|
346
294
|
return this.serverSide ? this.rows.length : this.filteredRows.length;
|
|
@@ -413,26 +361,17 @@ let DataGridComponent = class DataGridComponent {
|
|
|
413
361
|
return null;
|
|
414
362
|
}
|
|
415
363
|
get topSpacerHeight() {
|
|
416
|
-
return this.
|
|
364
|
+
return this._core.topSpacerHeight;
|
|
417
365
|
}
|
|
418
366
|
get bottomSpacerHeight() {
|
|
419
|
-
|
|
420
|
-
return 0;
|
|
421
|
-
return Math.max(0, (this.processedRows.length - this.endIndex) * this.rowHeight);
|
|
367
|
+
return this._core.bottomSpacerHeight;
|
|
422
368
|
}
|
|
423
369
|
// ── Selection ─────────────────────────────────────────────────────────────────
|
|
424
370
|
get allSelected() {
|
|
425
|
-
return this.
|
|
371
|
+
return this._core.allSelected;
|
|
426
372
|
}
|
|
427
373
|
get someSelected() {
|
|
428
|
-
return this.
|
|
429
|
-
}
|
|
430
|
-
_emitSelect() {
|
|
431
|
-
this.elementRef.dispatchEvent(new CustomEvent('ml:select', {
|
|
432
|
-
bubbles: true,
|
|
433
|
-
composed: true,
|
|
434
|
-
detail: { selectedRows: this.selectedIndices, allSelected: this.allSelected }
|
|
435
|
-
}));
|
|
374
|
+
return this._core.someSelected;
|
|
436
375
|
}
|
|
437
376
|
};
|
|
438
377
|
DataGridComponent = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"data-grid.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/data-grid/data-grid.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAUlE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAgOpD"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { html, classMap, when, repeat } from '@melodicdev/core';
|
|
2
|
-
|
|
3
|
-
if (col.render)
|
|
4
|
-
return col.render(row[col.key], row, index);
|
|
5
|
-
const val = row[col.key];
|
|
6
|
-
return val == null ? '' : val;
|
|
7
|
-
}
|
|
2
|
+
import { renderCell } from '../table-core/index.js';
|
|
8
3
|
function pinStyle(c, col) {
|
|
9
4
|
if (col.pinned === 'left')
|
|
10
5
|
return `left: ${c.getPinnedLeftOffset(col.key)}px`;
|
|
@@ -96,6 +91,7 @@ export function dataGridTemplate(c) {
|
|
|
96
91
|
@pointerdown=${(e) => c.handleResizeStart(col.key, e)}
|
|
97
92
|
@pointermove=${(e) => c.handleResizeMove(col.key, e)}
|
|
98
93
|
@pointerup=${c.handleResizeEnd}
|
|
94
|
+
@click=${(e) => e.stopPropagation()}
|
|
99
95
|
></div>
|
|
100
96
|
`)}
|
|
101
97
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IElementRef } from '@melodicdev/core';
|
|
1
|
+
import type { IElementRef, OnCreate, OnRender } from '@melodicdev/core';
|
|
2
2
|
/**
|
|
3
3
|
* ml-list-item - Individual item within a list
|
|
4
4
|
*
|
|
@@ -14,7 +14,7 @@ import type { IElementRef } from '@melodicdev/core';
|
|
|
14
14
|
* @slot default - Main content (overrides primary/secondary text)
|
|
15
15
|
* @slot trailing - Right side content (badges, indicators, actions)
|
|
16
16
|
*/
|
|
17
|
-
export declare class ListItemComponent implements IElementRef {
|
|
17
|
+
export declare class ListItemComponent implements IElementRef, OnCreate, OnRender {
|
|
18
18
|
elementRef: HTMLElement;
|
|
19
19
|
/** Primary text */
|
|
20
20
|
primary: string;
|
|
@@ -24,9 +24,18 @@ export declare class ListItemComponent implements IElementRef {
|
|
|
24
24
|
disabled: boolean;
|
|
25
25
|
/** Enable hover/focus states for clickable items */
|
|
26
26
|
interactive: boolean;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
|
|
27
|
+
/** Whether the leading slot has content (kept in sync via slotchange) */
|
|
28
|
+
hasLeadingSlot: boolean;
|
|
29
|
+
/** Whether the trailing slot has content (kept in sync via slotchange) */
|
|
30
|
+
hasTrailingSlot: boolean;
|
|
31
|
+
onCreate(): void;
|
|
32
|
+
onRender(): void;
|
|
33
|
+
private readonly _handleKeyDown;
|
|
34
|
+
/**
|
|
35
|
+
* Reflect interactive semantics onto the host: without a tabindex/role the
|
|
36
|
+
* `:host([interactive]:focus-visible)` styling is dead and keyboard users
|
|
37
|
+
* can never reach a clickable item.
|
|
38
|
+
*/
|
|
39
|
+
private syncHostA11y;
|
|
31
40
|
}
|
|
32
41
|
//# sourceMappingURL=list-item.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-item.component.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKxE;;;;;;;;;;;;;;GAcG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,QAAQ,EAAE,QAAQ;IACjE,UAAU,EAAG,WAAW,CAAC;IAEhC,mBAAmB;IACZ,OAAO,SAAM;IAEpB,qBAAqB;IACd,SAAS,SAAM;IAEtB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,oDAAoD;IAC7C,WAAW,UAAS;IAE3B,yEAAyE;IAClE,cAAc,UAAS;IAE9B,0EAA0E;IACnE,eAAe,UAAS;IAExB,QAAQ,IAAI,IAAI;IAkBhB,QAAQ,IAAI,IAAI;IAIvB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAO7B;IAEF;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAkBpB"}
|
|
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
|
+
import { watchSlotPresence } from '../../../functions/index.js';
|
|
8
9
|
import { listItemTemplate } from './list-item.template.js';
|
|
9
10
|
import { listItemStyles } from './list-item.styles.js';
|
|
10
11
|
/**
|
|
@@ -32,14 +33,64 @@ let ListItemComponent = class ListItemComponent {
|
|
|
32
33
|
this.disabled = false;
|
|
33
34
|
/** Enable hover/focus states for clickable items */
|
|
34
35
|
this.interactive = false;
|
|
36
|
+
/** Whether the leading slot has content (kept in sync via slotchange) */
|
|
37
|
+
this.hasLeadingSlot = false;
|
|
38
|
+
/** Whether the trailing slot has content (kept in sync via slotchange) */
|
|
39
|
+
this.hasTrailingSlot = false;
|
|
40
|
+
this._handleKeyDown = (event) => {
|
|
41
|
+
if (!this.interactive || this.disabled)
|
|
42
|
+
return;
|
|
43
|
+
if (event.target !== this.elementRef)
|
|
44
|
+
return;
|
|
45
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
46
|
+
return;
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
this.elementRef.click();
|
|
49
|
+
};
|
|
35
50
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
onCreate() {
|
|
52
|
+
const shadow = this.elementRef.shadowRoot;
|
|
53
|
+
if (shadow) {
|
|
54
|
+
// Slot presence is reactive: content added/removed after mount projects
|
|
55
|
+
// correctly instead of being frozen at first render.
|
|
56
|
+
watchSlotPresence(shadow, (name, hasContent) => {
|
|
57
|
+
if (name === 'leading')
|
|
58
|
+
this.hasLeadingSlot = hasContent;
|
|
59
|
+
else if (name === 'trailing')
|
|
60
|
+
this.hasTrailingSlot = hasContent;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Keyboard activation for interactive items: Enter/Space trigger the same
|
|
64
|
+
// click consumers already listen for on the host.
|
|
65
|
+
this.elementRef.addEventListener('keydown', this._handleKeyDown);
|
|
66
|
+
this.syncHostA11y();
|
|
39
67
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
68
|
+
onRender() {
|
|
69
|
+
this.syncHostA11y();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reflect interactive semantics onto the host: without a tabindex/role the
|
|
73
|
+
* `:host([interactive]:focus-visible)` styling is dead and keyboard users
|
|
74
|
+
* can never reach a clickable item.
|
|
75
|
+
*/
|
|
76
|
+
syncHostA11y() {
|
|
77
|
+
const host = this.elementRef;
|
|
78
|
+
if (this.interactive) {
|
|
79
|
+
host.setAttribute('role', 'button');
|
|
80
|
+
if (this.disabled) {
|
|
81
|
+
host.removeAttribute('tabindex');
|
|
82
|
+
host.setAttribute('aria-disabled', 'true');
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
host.setAttribute('tabindex', '0');
|
|
86
|
+
host.removeAttribute('aria-disabled');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
host.setAttribute('role', 'listitem');
|
|
91
|
+
host.removeAttribute('tabindex');
|
|
92
|
+
host.removeAttribute('aria-disabled');
|
|
93
|
+
}
|
|
43
94
|
}
|
|
44
95
|
};
|
|
45
96
|
ListItemComponent = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"list-item.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAiG1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"list-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/data-display/list/list-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAsBpD"}
|