@krak-stack/registry 0.10.20 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -3
- package/README.md +11 -8
- package/dist/components/agent/index.d.ts +454 -0
- package/dist/components/agent/react.d.ts +55 -0
- package/dist/components/agent/react.js +2594 -0
- package/dist/components/agent/schema.d.ts +55 -0
- package/dist/components/animated-list/classes.d.ts +9 -0
- package/dist/components/animated-list/html.d.ts +11 -0
- package/dist/components/animated-list/html.js +533 -0
- package/dist/components/animated-list/index.d.ts +205 -0
- package/dist/components/animated-list/react.d.ts +11 -0
- package/dist/components/animated-list/react.js +711 -0
- package/dist/components/animated-list/schema.d.ts +44 -0
- package/dist/components/animated-number/html.d.ts +19 -0
- package/dist/components/animated-number/html.js +101 -0
- package/dist/components/animated-number/index.d.ts +80 -0
- package/dist/components/{ui/animated-number.d.ts → animated-number/react.d.ts} +2 -7
- package/dist/components/animated-number/react.js +278 -0
- package/dist/components/animated-number/schema.d.ts +9 -0
- package/dist/components/app-brand/classes.d.ts +11 -0
- package/dist/components/app-brand/html.d.ts +26 -0
- package/dist/components/app-brand/html.js +78 -0
- package/dist/components/app-brand/react.d.ts +12 -0
- package/dist/components/app-brand/react.js +86 -0
- package/dist/components/app-brand/schema.d.ts +36 -0
- package/dist/components/app-switcher/classes.d.ts +15 -0
- package/dist/components/app-switcher/html.d.ts +72 -0
- package/dist/components/app-switcher/html.js +327 -0
- package/dist/components/app-switcher/index.d.ts +47 -0
- package/dist/components/app-switcher/react.d.ts +12 -0
- package/dist/components/{ui/app-switcher.js → app-switcher/react.js} +84 -15
- package/dist/components/app-switcher/schema.d.ts +39 -0
- package/dist/components/async-action-button/classes.d.ts +11 -0
- package/dist/components/async-action-button/html.d.ts +46 -0
- package/dist/components/async-action-button/html.js +266 -0
- package/dist/components/async-action-button/index.d.ts +73 -0
- package/dist/components/async-action-button/react.d.ts +10 -0
- package/dist/components/async-action-button/react.js +378 -0
- package/dist/components/async-action-button/schema.d.ts +28 -0
- package/dist/{services/events/client/audit-log-table.d.ts → components/audit-log-table/react.d.ts} +2 -2
- package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js} +2180 -909
- package/dist/components/auto-height/html.d.ts +8 -0
- package/dist/components/auto-height/html.js +81 -0
- package/dist/components/auto-height/index.d.ts +2 -0
- package/dist/components/{ui/auto-height.d.ts → auto-height/react.d.ts} +2 -4
- package/dist/components/auto-height/react.js +75 -0
- package/dist/components/auto-height/schema.d.ts +7 -0
- package/dist/components/bulk-list-input/classes.d.ts +7 -0
- package/dist/components/bulk-list-input/html.d.ts +41 -0
- package/dist/components/bulk-list-input/html.js +265 -0
- package/dist/components/bulk-list-input/index.d.ts +76 -0
- package/dist/components/bulk-list-input/react.d.ts +12 -0
- package/dist/components/{ui/bulk-list-input.js → bulk-list-input/react.js} +71 -4
- package/dist/components/bulk-list-input/schema.d.ts +33 -0
- package/dist/components/choice-cards/classes.d.ts +19 -0
- package/dist/components/choice-cards/html.d.ts +76 -0
- package/dist/components/choice-cards/html.js +237 -0
- package/dist/components/choice-cards/index.d.ts +1 -0
- package/dist/components/choice-cards/react.d.ts +21 -0
- package/dist/components/{ui/choice-cards.js → choice-cards/react.js} +29 -10
- package/dist/components/choice-cards/schema.d.ts +100 -0
- package/dist/components/code-block/classes.d.ts +13 -0
- package/dist/components/code-block/html.d.ts +21 -0
- package/dist/components/code-block/html.js +381 -0
- package/dist/components/code-block/index.d.ts +4 -0
- package/dist/components/code-block/react.d.ts +4 -0
- package/dist/components/code-block/react.js +493 -0
- package/dist/components/code-block/schema.d.ts +29 -0
- package/dist/components/color-input/classes.d.ts +9 -0
- package/dist/components/color-input/html.d.ts +48 -0
- package/dist/components/color-input/html.js +187 -0
- package/dist/components/color-input/index.d.ts +88 -0
- package/dist/components/color-input/react.d.ts +7 -0
- package/dist/components/{ui/color-picker.js → color-input/react.js} +165 -233
- package/dist/components/color-input/schema.d.ts +40 -0
- package/dist/components/copy-button/html.d.ts +48 -0
- package/dist/components/copy-button/html.js +266 -0
- package/dist/components/copy-button/index.d.ts +73 -0
- package/dist/components/copy-button/react.d.ts +12 -0
- package/dist/components/copy-button/react.js +388 -0
- package/dist/components/copy-button/schema.d.ts +37 -0
- package/dist/components/copy-value/html.d.ts +37 -0
- package/dist/components/copy-value/html.js +426 -0
- package/dist/components/copy-value/index.d.ts +57 -0
- package/dist/components/copy-value/react.d.ts +9 -0
- package/dist/components/copy-value/react.js +682 -0
- package/dist/components/copy-value/schema.d.ts +45 -0
- package/dist/components/cron-input/classes.d.ts +25 -0
- package/dist/components/cron-input/html.d.ts +36 -0
- package/dist/components/cron-input/html.js +204 -0
- package/dist/components/cron-input/index.d.ts +59 -0
- package/dist/components/cron-input/react.d.ts +7 -0
- package/dist/components/{ui/cron-expression-editor.js → cron-input/react.js} +126 -54
- package/dist/components/cron-input/schema.d.ts +24 -0
- package/dist/components/danger-confirmation/classes.d.ts +7 -0
- package/dist/components/danger-confirmation/html.d.ts +39 -0
- package/dist/components/danger-confirmation/html.js +227 -0
- package/dist/components/danger-confirmation/index.d.ts +113 -0
- package/dist/components/{ui/danger-confirmation.d.ts → danger-confirmation/react.d.ts} +3 -12
- package/dist/components/danger-confirmation/react.js +550 -0
- package/dist/components/danger-confirmation/schema.d.ts +34 -0
- package/dist/components/data-table/classes.d.ts +63 -0
- package/dist/components/data-table/html.d.ts +1938 -0
- package/dist/components/data-table/html.js +2682 -0
- package/dist/components/data-table/index.d.ts +2686 -0
- package/dist/components/data-table/react.d.ts +578 -0
- package/dist/components/{ui/data-table.js → data-table/react.js} +2174 -897
- package/dist/components/data-table/schema.d.ts +3012 -0
- package/dist/components/date-input/classes.d.ts +17 -0
- package/dist/components/date-input/html.d.ts +60 -0
- package/dist/components/date-input/html.js +418 -0
- package/dist/components/date-input/index.d.ts +91 -0
- package/dist/components/date-input/react.d.ts +10 -0
- package/dist/components/{ui/date-picker.js → date-input/react.js} +233 -79
- package/dist/components/date-input/schema.d.ts +41 -0
- package/dist/components/editable-text/classes.d.ts +17 -0
- package/dist/components/editable-text/html.d.ts +51 -0
- package/dist/components/editable-text/html.js +370 -0
- package/dist/components/editable-text/index.d.ts +143 -0
- package/dist/components/editable-text/react.d.ts +6 -0
- package/dist/components/editable-text/react.js +499 -0
- package/dist/components/editable-text/schema.d.ts +31 -0
- package/dist/components/editing-locale-switcher/classes.d.ts +7 -0
- package/dist/components/editing-locale-switcher/html.d.ts +27 -0
- package/dist/components/editing-locale-switcher/html.js +250 -0
- package/dist/components/editing-locale-switcher/index.d.ts +52 -0
- package/dist/components/editing-locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/editing-locale-switcher.js → editing-locale-switcher/react.js} +63 -10
- package/dist/components/editing-locale-switcher/schema.d.ts +16 -0
- package/dist/components/{ui/effect-form.d.ts → effect-form/react.d.ts} +2 -2
- package/dist/components/{ui/effect-form.js → effect-form/react.js} +302 -76
- package/dist/components/effectcn/alert-dialog.d.ts +13 -0
- package/dist/components/effectcn/button.d.ts +31 -0
- package/dist/components/effectcn/calendar.d.ts +12 -0
- package/dist/components/effectcn/checkbox.d.ts +10 -0
- package/dist/components/effectcn/combobox.d.ts +25 -0
- package/dist/components/effectcn/dialog.d.ts +19 -0
- package/dist/components/effectcn/field.d.ts +11 -0
- package/dist/components/effectcn/file-drop.d.ts +8 -0
- package/dist/components/effectcn/input.d.ts +26 -0
- package/dist/components/effectcn/menu.d.ts +85 -0
- package/dist/components/effectcn/menubar.d.ts +8 -0
- package/dist/components/effectcn/popover.d.ts +18 -0
- package/dist/components/effectcn/scroll-area.d.ts +12 -0
- package/dist/components/effectcn/select.d.ts +68 -0
- package/dist/components/effectcn/toast.d.ts +29 -0
- package/dist/components/email-composer/index.d.ts +229 -0
- package/dist/components/email-composer/labels.d.ts +12 -0
- package/dist/components/email-composer/react.d.ts +5 -0
- package/dist/components/{ui/email-composer.js → email-composer/react.js} +618 -135
- package/dist/components/email-composer/schema.d.ts +42 -0
- package/dist/components/email-editor/classes.d.ts +21 -0
- package/dist/components/email-editor/html.d.ts +360 -0
- package/dist/components/email-editor/html.js +1706 -0
- package/dist/components/email-editor/index.d.ts +693 -0
- package/dist/components/{ui/email-editor.d.ts → email-editor/labels.d.ts} +1 -21
- package/dist/components/email-editor/legacy-editor.html.d.ts +160 -0
- package/dist/components/email-editor/react.d.ts +11 -0
- package/dist/components/{ui/email-editor.js → email-editor/react.js} +778 -256
- package/dist/components/email-editor/schema.d.ts +162 -0
- package/dist/components/error-component/classes.d.ts +7 -0
- package/dist/components/error-component/html.d.ts +120 -0
- package/dist/components/error-component/html.js +346 -0
- package/dist/components/error-component/index.d.ts +69 -0
- package/dist/components/error-component/react.d.ts +8 -0
- package/dist/components/error-component/react.js +744 -0
- package/dist/components/error-component/schema.d.ts +56 -0
- package/dist/components/file-input/classes.d.ts +7 -0
- package/dist/components/file-input/html.d.ts +95 -0
- package/dist/components/file-input/html.js +368 -0
- package/dist/components/file-input/index.d.ts +99 -0
- package/dist/components/file-input/react.d.ts +11 -0
- package/dist/components/{ui/file-picker.js → file-input/react.js} +122 -19
- package/dist/components/file-input/schema.d.ts +37 -0
- package/dist/components/{ui/form.d.ts → form/react.d.ts} +7 -7
- package/dist/components/{ui/form.js → form/react.js} +300 -74
- package/dist/components/icon-input/html.d.ts +55 -0
- package/dist/components/icon-input/html.js +538 -0
- package/dist/components/icon-input/index.d.ts +143 -0
- package/dist/components/icon-input/react.d.ts +6 -0
- package/dist/components/{ui/icon-input.js → icon-input/react.js} +459 -89
- package/dist/components/icon-input/schema.d.ts +23 -0
- package/dist/components/image-crop-editor/classes.d.ts +19 -0
- package/dist/components/image-crop-editor/html.d.ts +66 -0
- package/dist/components/image-crop-editor/html.js +561 -0
- package/dist/components/image-crop-editor/index.d.ts +183 -0
- package/dist/components/image-crop-editor/react.d.ts +8 -0
- package/dist/components/image-crop-editor/react.js +802 -0
- package/dist/components/image-crop-editor/schema.d.ts +54 -0
- package/dist/components/krakstack-provider/html.d.ts +17 -0
- package/dist/components/krakstack-provider/html.js +37 -0
- package/dist/components/krakstack-provider/index.d.ts +7 -0
- package/dist/components/krakstack-provider/react.d.ts +8 -0
- package/dist/components/{ui/krakstack-provider.js → krakstack-provider/react.js} +14 -5
- package/dist/components/krakstack-provider/schema.d.ts +6 -0
- package/dist/components/loading/classes.d.ts +5 -0
- package/dist/components/loading/html.d.ts +18 -0
- package/dist/components/loading/html.js +166 -0
- package/dist/components/loading/index.d.ts +6 -0
- package/dist/components/loading/react.d.ts +4 -0
- package/dist/components/loading/react.js +51 -0
- package/dist/components/loading/schema.d.ts +23 -0
- package/dist/components/locale-switcher/html.d.ts +22 -0
- package/dist/components/locale-switcher/html.js +264 -0
- package/dist/components/locale-switcher/index.d.ts +50 -0
- package/dist/components/locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/locale-switcher.js → locale-switcher/react.js} +55 -22
- package/dist/components/locale-switcher/schema.d.ts +12 -0
- package/dist/components/map-menu/classes.d.ts +13 -0
- package/dist/components/map-menu/google-maps.d.ts +80 -0
- package/dist/components/map-menu/google-viewport.d.ts +7 -0
- package/dist/components/map-menu/html.d.ts +274 -0
- package/dist/components/map-menu/html.js +934 -0
- package/dist/components/map-menu/index.d.ts +246 -0
- package/dist/components/map-menu/map.d.ts +47 -0
- package/dist/components/map-menu/react.d.ts +40 -0
- package/dist/components/{ui/map-menu.js → map-menu/react.js} +321 -83
- package/dist/components/map-menu/schema.d.ts +132 -0
- package/dist/components/markdown/classes.d.ts +1 -0
- package/dist/components/markdown/html.d.ts +23 -0
- package/dist/components/markdown/html.js +510 -0
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/react.d.ts +3 -0
- package/dist/components/markdown/react.js +546 -0
- package/dist/components/markdown/schema.d.ts +20 -0
- package/dist/components/notification-menu/classes.d.ts +11 -0
- package/dist/components/notification-menu/html.d.ts +67 -0
- package/dist/components/notification-menu/html.js +425 -0
- package/dist/components/notification-menu/index.d.ts +132 -0
- package/dist/components/notification-menu/react.d.ts +57 -0
- package/dist/components/notification-menu/react.js +829 -0
- package/dist/components/notification-menu/schema.d.ts +59 -0
- package/dist/components/pagination/classes.d.ts +19 -0
- package/dist/components/pagination/html.d.ts +49 -0
- package/dist/components/pagination/html.js +387 -0
- package/dist/components/pagination/index.d.ts +109 -0
- package/dist/components/pagination/react.d.ts +9 -0
- package/dist/components/{ui/pagination.js → pagination/react.js} +123 -23
- package/dist/components/pagination/schema.d.ts +36 -0
- package/dist/components/phone-number-input/classes.d.ts +17 -0
- package/dist/components/phone-number-input/html.d.ts +52 -0
- package/dist/components/phone-number-input/html.js +655 -0
- package/dist/components/phone-number-input/index.d.ts +59 -0
- package/dist/components/phone-number-input/react.d.ts +11 -0
- package/dist/components/{ui/phone-number-input.js → phone-number-input/react.js} +368 -138
- package/dist/components/phone-number-input/schema.d.ts +31 -0
- package/dist/components/presence-transition/html.d.ts +13 -0
- package/dist/components/presence-transition/html.js +128 -0
- package/dist/components/presence-transition/index.d.ts +57 -0
- package/dist/components/{ui/presence-transition.d.ts → presence-transition/react.d.ts} +3 -5
- package/dist/components/presence-transition/react.js +293 -0
- package/dist/components/presence-transition/schema.d.ts +7 -0
- package/dist/components/registry-previews/component-example.d.ts +31 -0
- package/dist/components/registry-previews/component-example.js +679 -0
- package/dist/components/registry-previews/html-preview.d.ts +17 -0
- package/dist/components/registry-previews/html-preview.js +83 -0
- package/dist/components/rich-text-editor/classes.d.ts +15 -0
- package/dist/components/rich-text-editor/engine.d.ts +9 -0
- package/dist/components/rich-text-editor/html.d.ts +246 -0
- package/dist/components/rich-text-editor/html.js +830 -0
- package/dist/components/rich-text-editor/index.d.ts +453 -0
- package/dist/components/rich-text-editor/labels.d.ts +42 -0
- package/dist/components/rich-text-editor/react.d.ts +19 -0
- package/dist/components/{ui/rich-text-editor.js → rich-text-editor/react.js} +521 -100
- package/dist/components/rich-text-editor/schema.d.ts +116 -0
- package/dist/components/search-menu/classes.d.ts +9 -0
- package/dist/components/search-menu/html.d.ts +127 -0
- package/dist/components/search-menu/html.js +432 -0
- package/dist/components/search-menu/index.d.ts +85 -0
- package/dist/components/search-menu/react.d.ts +18 -0
- package/dist/components/{ui/search-menu.js → search-menu/react.js} +290 -31
- package/dist/components/search-menu/schema.d.ts +78 -0
- package/dist/components/select-with-custom-input/classes.d.ts +17 -0
- package/dist/components/select-with-custom-input/html.d.ts +60 -0
- package/dist/components/select-with-custom-input/html.js +238 -0
- package/dist/components/select-with-custom-input/index.d.ts +114 -0
- package/dist/components/select-with-custom-input/react.d.ts +7 -0
- package/dist/components/{ui/select-with-custom-input.js → select-with-custom-input/react.js} +127 -22
- package/dist/components/select-with-custom-input/schema.d.ts +54 -0
- package/dist/components/sidebar-layout/classes.d.ts +21 -0
- package/dist/components/sidebar-layout/html.d.ts +97 -0
- package/dist/components/sidebar-layout/html.js +361 -0
- package/dist/components/sidebar-layout/index.d.ts +57 -0
- package/dist/components/sidebar-layout/react.d.ts +30 -0
- package/dist/components/{ui/sidebar-layout.js → sidebar-layout/react.js} +353 -39
- package/dist/components/sidebar-layout/schema.d.ts +54 -0
- package/dist/components/stats-card/classes.d.ts +11 -0
- package/dist/components/stats-card/html.d.ts +15 -0
- package/dist/components/stats-card/html.js +55 -0
- package/dist/components/stats-card/react.d.ts +7 -0
- package/dist/components/{ui/stats-card.js → stats-card/react.js} +19 -15
- package/dist/components/stats-card/schema.d.ts +14 -0
- package/dist/components/stepper/classes.d.ts +39 -0
- package/dist/components/stepper/html.d.ts +107 -0
- package/dist/components/stepper/html.js +397 -0
- package/dist/components/stepper/index.d.ts +83 -0
- package/dist/components/stepper/react.d.ts +17 -0
- package/dist/components/{ui/stepper.js → stepper/react.js} +120 -21
- package/dist/components/stepper/schema.d.ts +52 -0
- package/dist/components/support/classes.d.ts +55 -0
- package/dist/components/support/form.d.ts +19 -0
- package/dist/components/support/html.d.ts +266 -0
- package/dist/components/support/html.js +604 -0
- package/dist/components/support/index.d.ts +226 -0
- package/dist/components/support/multipart.d.ts +21 -0
- package/dist/components/support/react.d.ts +54 -0
- package/dist/components/support/react.js +1252 -0
- package/dist/components/support/schema.d.ts +69 -0
- package/dist/components/support.d.ts +1 -66
- package/dist/components/theme-switcher/html.d.ts +28 -0
- package/dist/components/theme-switcher/html.js +288 -0
- package/dist/components/theme-switcher/index.d.ts +59 -0
- package/dist/components/{ui/theme-switcher.d.ts → theme-switcher/react.d.ts} +4 -12
- package/dist/components/{ui/theme-switcher.js → theme-switcher/react.js} +69 -35
- package/dist/components/theme-switcher/schema.d.ts +33 -0
- package/dist/components/time-input/classes.d.ts +23 -0
- package/dist/components/time-input/html.d.ts +75 -0
- package/dist/components/time-input/html.js +571 -0
- package/dist/components/time-input/index.d.ts +164 -0
- package/dist/components/time-input/react.d.ts +7 -0
- package/dist/components/{ui/time-picker.js → time-input/react.js} +286 -114
- package/dist/components/time-input/schema.d.ts +96 -0
- package/dist/components/timezone-input/classes.d.ts +13 -0
- package/dist/components/timezone-input/html.d.ts +58 -0
- package/dist/components/timezone-input/html.js +804 -0
- package/dist/components/timezone-input/index.d.ts +170 -0
- package/dist/components/timezone-input/react.d.ts +9 -0
- package/dist/components/{ui/timezone-select.js → timezone-input/react.js} +493 -106
- package/dist/components/timezone-input/schema.d.ts +43 -0
- package/dist/components/toast/classes.d.ts +7 -0
- package/dist/components/toast/html.d.ts +34 -0
- package/dist/components/toast/html.js +280 -0
- package/dist/components/toast/index.d.ts +10 -0
- package/dist/components/toast/react.d.ts +9 -0
- package/dist/components/{ui/toast.js → toast/react.js} +35 -15
- package/dist/components/toast/schema.d.ts +24 -0
- package/dist/{services/events/client/tracking-notice.d.ts → components/tracking-notice/react.d.ts} +7 -1
- package/dist/{services/events/client/tracking-notice.js → components/tracking-notice/react.js} +13 -7
- package/dist/components/ui/animated-list.d.ts +1 -21
- package/dist/components/ui/app-brand.d.ts +1 -33
- package/dist/components/ui/async-action-button.d.ts +1 -17
- package/dist/components/ui/code-block.d.ts +1 -14
- package/dist/components/ui/copy-button.d.ts +1 -21
- package/dist/components/ui/data-table.d.ts +1 -584
- package/dist/components/ui/krakstack-provider.d.ts +1 -9
- package/dist/components/ui/loading.d.ts +1 -13
- package/dist/components/ui/pagination.d.ts +1 -47
- package/dist/components/ui/rich-text-editor.d.ts +1 -72
- package/dist/components/ui/search-menu.d.ts +1 -36
- package/dist/components/ui/sidebar-layout.d.ts +1 -40
- package/dist/components/ui/virtualized-combobox.d.ts +1 -59
- package/dist/components/unsaved-changes-guard/html.d.ts +34 -0
- package/dist/components/unsaved-changes-guard/html.js +172 -0
- package/dist/components/unsaved-changes-guard/index.d.ts +56 -0
- package/dist/components/unsaved-changes-guard/react.d.ts +4 -0
- package/dist/components/{ui/unsaved-changes-guard.js → unsaved-changes-guard/react.js} +74 -11
- package/dist/components/unsaved-changes-guard/schema.d.ts +37 -0
- package/dist/components/upload-attachment/classes.d.ts +11 -0
- package/dist/components/upload-attachment/html.d.ts +84 -0
- package/dist/components/upload-attachment/html.js +312 -0
- package/dist/components/upload-attachment/index.d.ts +72 -0
- package/dist/components/upload-attachment/react.d.ts +9 -0
- package/dist/components/{ui/upload-attachment.js → upload-attachment/react.js} +114 -17
- package/dist/components/upload-attachment/schema.d.ts +53 -0
- package/dist/components/virtualized-combobox/classes.d.ts +7 -0
- package/dist/components/virtualized-combobox/html.d.ts +97 -0
- package/dist/components/virtualized-combobox/html.js +310 -0
- package/dist/components/virtualized-combobox/index.d.ts +182 -0
- package/dist/components/virtualized-combobox/react.d.ts +31 -0
- package/dist/components/{ui/virtualized-combobox.js → virtualized-combobox/react.js} +160 -40
- package/dist/components/virtualized-combobox/schema.d.ts +92 -0
- package/dist/components/webhook-delivery-table/html.d.ts +216 -0
- package/dist/components/webhook-delivery-table/html.js +3008 -0
- package/dist/components/webhook-delivery-table/index.d.ts +405 -0
- package/dist/components/webhook-delivery-table/react.d.ts +13 -0
- package/dist/{services/webhooks/client/delivery-table.js → components/webhook-delivery-table/react.js} +2461 -948
- package/dist/components/webhook-delivery-table/schema.d.ts +134 -0
- package/dist/lib/docs.d.ts +17 -1
- package/dist/lib/docs.integrations.server.js +358 -73
- package/dist/lib/docs.js +863 -295
- package/dist/lib/docs.server.js +342 -57
- package/dist/lib/documentation-toolkit.d.ts +4 -4
- package/dist/lib/documentation-toolkit.js +354 -69
- package/dist/lib/effect-ui-adapter/model-runtime.d.ts +17 -0
- package/dist/lib/effect-ui-adapter/use-model.d.ts +9 -0
- package/dist/lib/effectcn-form.d.ts +3 -0
- package/dist/lib/effectcn-form.js +54 -0
- package/dist/lib/email-composer/index.d.ts +12 -0
- package/dist/lib/email-composer/schema.d.ts +14 -0
- package/dist/lib/httpapi-toolkit.d.ts +1 -1
- package/dist/lib/lucide-effect.d.ts +39 -0
- package/dist/lib/markdown/content.d.ts +1 -12
- package/dist/lib/rich-text/model.d.ts +5 -0
- package/dist/lib/webfetch-toolkit.d.ts +1 -1
- package/dist/services/agent/client/index.js +697 -181
- package/dist/services/agent/client/widget.d.ts +1 -55
- package/dist/services/notification/client/index.js +138 -27
- package/dist/services/notification/client/notification-menu.d.ts +1 -85
- package/dist/services/notification/public.js +138 -27
- package/dist/services/opentelemetry/browser.js +15 -9
- package/dist/services/webhooks/index.d.ts +4 -3
- package/package.json +181 -142
- package/dist/components/support-dialog.js +0 -881
- package/dist/components/support.js +0 -881
- package/dist/components/ui/animated-list.js +0 -414
- package/dist/components/ui/animated-number.js +0 -75
- package/dist/components/ui/app-brand.js +0 -126
- package/dist/components/ui/app-switcher.d.ts +0 -26
- package/dist/components/ui/async-action-button.js +0 -149
- package/dist/components/ui/auto-height.js +0 -86
- package/dist/components/ui/bulk-list-input.d.ts +0 -25
- package/dist/components/ui/choice-cards.d.ts +0 -33
- package/dist/components/ui/code-block.js +0 -221
- package/dist/components/ui/color-picker.d.ts +0 -31
- package/dist/components/ui/copy-button.js +0 -138
- package/dist/components/ui/copy-value.d.ts +0 -24
- package/dist/components/ui/copy-value.js +0 -352
- package/dist/components/ui/cron-expression-editor.d.ts +0 -16
- package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
- package/dist/components/ui/danger-confirmation.js +0 -398
- package/dist/components/ui/date-picker.d.ts +0 -33
- package/dist/components/ui/date-picker.schema.d.ts +0 -9
- package/dist/components/ui/editable-text.d.ts +0 -19
- package/dist/components/ui/editable-text.js +0 -341
- package/dist/components/ui/editing-locale-switcher.d.ts +0 -11
- package/dist/components/ui/error-component.d.ts +0 -34
- package/dist/components/ui/error-component.js +0 -387
- package/dist/components/ui/file-picker.d.ts +0 -37
- package/dist/components/ui/icon-input.d.ts +0 -58
- package/dist/components/ui/image-crop-editor.d.ts +0 -41
- package/dist/components/ui/image-crop-editor.js +0 -417
- package/dist/components/ui/loading.js +0 -39
- package/dist/components/ui/locale-switcher.d.ts +0 -11
- package/dist/components/ui/map-menu-map.d.ts +0 -115
- package/dist/components/ui/map-menu.d.ts +0 -87
- package/dist/components/ui/phone-number-input.d.ts +0 -22
- package/dist/components/ui/phone-number-input.schema.d.ts +0 -7
- package/dist/components/ui/presence-transition.js +0 -94
- package/dist/components/ui/select-with-custom-input.d.ts +0 -36
- package/dist/components/ui/stats-card.d.ts +0 -12
- package/dist/components/ui/stepper.d.ts +0 -37
- package/dist/components/ui/time-picker.d.ts +0 -50
- package/dist/components/ui/time-picker.schema.d.ts +0 -28
- package/dist/components/ui/timezone-select.d.ts +0 -57
- package/dist/components/ui/timezone-select.schema.d.ts +0 -9
- package/dist/components/ui/toast.d.ts +0 -18
- package/dist/components/ui/unsaved-changes-guard.d.ts +0 -16
- package/dist/components/ui/upload-attachment.d.ts +0 -39
- package/dist/services/notification/persistence/drizzle.d.ts +0 -868
- package/dist/services/notification/persistence/drizzle.js +0 -214
- package/dist/services/notification/persistence/index.d.ts +0 -2
- package/dist/services/notification/persistence/index.js +0 -227
- package/dist/services/notification/persistence/schema.d.ts +0 -143
- package/dist/services/notification/persistence/schema.js +0 -118
- package/dist/services/webhooks/client/delivery-table.d.ts +0 -62
package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js}
RENAMED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
// ../../src/components/
|
|
2
|
-
import { useAtom, useAtomSet } from "@effect/atom-react";
|
|
1
|
+
// ../../src/components/data-table/react.tsx
|
|
3
2
|
import { ScrollArea as ScrollAreaPrimitive2 } from "@base-ui/react/scroll-area";
|
|
4
|
-
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
5
3
|
import { useVirtualizer, useWindowVirtualizer } from "@tanstack/react-virtual";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { AsyncResult, Atom } from "effect/reactivity";
|
|
4
|
+
import { Formatter, Option as Option4, Schema as Schema6 } from "effect";
|
|
5
|
+
import { Component as Component3, View as View2 } from "effect/ui";
|
|
9
6
|
import {
|
|
10
7
|
ArrowDown,
|
|
11
8
|
ArrowUp,
|
|
@@ -30,15 +27,17 @@ import {
|
|
|
30
27
|
X
|
|
31
28
|
} from "lucide-react";
|
|
32
29
|
import {
|
|
33
|
-
createContext,
|
|
30
|
+
createContext as createContext2,
|
|
34
31
|
isValidElement,
|
|
35
|
-
useCallback,
|
|
36
|
-
useContext,
|
|
32
|
+
useCallback as useCallback2,
|
|
33
|
+
useContext as useContext2,
|
|
34
|
+
useEffect as useEffect2,
|
|
37
35
|
useId as useId2,
|
|
38
|
-
useLayoutEffect,
|
|
36
|
+
useLayoutEffect as useLayoutEffect2,
|
|
39
37
|
useMemo as useMemo2,
|
|
40
|
-
useRef,
|
|
41
|
-
useState
|
|
38
|
+
useRef as useRef2,
|
|
39
|
+
useState as useState2,
|
|
40
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
42
41
|
} from "react";
|
|
43
42
|
import { createPortal } from "react-dom";
|
|
44
43
|
|
|
@@ -504,38 +503,51 @@ function SelectScrollDownButton({
|
|
|
504
503
|
});
|
|
505
504
|
}
|
|
506
505
|
|
|
507
|
-
// ../../src/components/
|
|
506
|
+
// ../../src/components/loading/react.tsx
|
|
508
507
|
import { Loader2 } from "lucide-react";
|
|
509
|
-
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
510
|
-
|
|
508
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
509
|
+
|
|
510
|
+
// ../../src/components/loading/classes.ts
|
|
511
|
+
var resolveLoadingClasses = ({
|
|
512
|
+
classes,
|
|
513
|
+
variant,
|
|
514
|
+
className
|
|
515
|
+
}) => ({
|
|
516
|
+
root: cn(classes?.root ?? "text-muted-foreground flex items-center justify-center gap-2 text-sm", variant === "centered" && (classes?.centered ?? "min-h-[50svh] w-full"), className),
|
|
517
|
+
icon: classes?.icon ?? "size-4 motion-safe:animate-spin"
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// ../../src/components/loading/index.ts
|
|
511
521
|
var labels = {
|
|
512
|
-
en:
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
fr: {
|
|
516
|
-
loading: "Chargement..."
|
|
517
|
-
}
|
|
522
|
+
en: "Loading...",
|
|
523
|
+
fr: "Chargement..."
|
|
518
524
|
};
|
|
519
|
-
var loadingLabel = (locale, messages) => messages?.[locale]?.loading ?? messages?.[locale.split("-")[0] ?? locale]?.loading ?? (locale.startsWith("fr") ? labels.fr
|
|
525
|
+
var loadingLabel = (locale, messages) => messages?.[locale]?.loading ?? messages?.[locale.split("-")[0] ?? locale]?.loading ?? (locale.startsWith("fr") ? labels.fr : labels.en);
|
|
526
|
+
|
|
527
|
+
// ../../src/components/loading/react.tsx
|
|
528
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
520
529
|
function Loading({
|
|
521
530
|
className,
|
|
531
|
+
classes,
|
|
522
532
|
label,
|
|
523
533
|
locale: localeOverride,
|
|
524
534
|
messages,
|
|
525
535
|
variant = "inline"
|
|
526
536
|
}) {
|
|
527
537
|
const locale = useKrakstackLocale(localeOverride);
|
|
538
|
+
const slots = resolveLoadingClasses({ classes, variant, className });
|
|
528
539
|
return /* @__PURE__ */ jsxs4("div", {
|
|
529
|
-
|
|
540
|
+
role: "status",
|
|
541
|
+
className: slots.root,
|
|
530
542
|
children: [
|
|
531
543
|
/* @__PURE__ */ jsx9(Loader2, {
|
|
532
|
-
|
|
544
|
+
"aria-hidden": "true",
|
|
545
|
+
className: slots.icon
|
|
533
546
|
}),
|
|
534
547
|
label ?? loadingLabel(locale, messages)
|
|
535
548
|
]
|
|
536
549
|
});
|
|
537
550
|
}
|
|
538
|
-
|
|
539
551
|
// ../../src/components/ui/menubar.tsx
|
|
540
552
|
import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
|
|
541
553
|
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
|
|
@@ -710,7 +722,7 @@ function MenubarSubContent({
|
|
|
710
722
|
});
|
|
711
723
|
}
|
|
712
724
|
|
|
713
|
-
// ../../src/components/
|
|
725
|
+
// ../../src/components/pagination/react.tsx
|
|
714
726
|
import {
|
|
715
727
|
ChevronLeft,
|
|
716
728
|
ChevronRight,
|
|
@@ -718,8 +730,79 @@ import {
|
|
|
718
730
|
ChevronsRight
|
|
719
731
|
} from "lucide-react";
|
|
720
732
|
import { useId } from "react";
|
|
721
|
-
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
722
|
-
|
|
733
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider/react";
|
|
734
|
+
|
|
735
|
+
// ../../src/components/pagination/classes.ts
|
|
736
|
+
var paginationClasses = {
|
|
737
|
+
root: "flex flex-col gap-3 px-2 sm:flex-row sm:items-center sm:justify-between",
|
|
738
|
+
summary: "text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",
|
|
739
|
+
controls: "flex items-center gap-4 sm:justify-end",
|
|
740
|
+
controlGroup: "flex items-center gap-2",
|
|
741
|
+
navigation: "flex items-center gap-1",
|
|
742
|
+
compactRoot: "gap-2 px-0 sm:flex-col sm:items-stretch",
|
|
743
|
+
compactControls: "flex-wrap justify-between gap-2 sm:justify-between"
|
|
744
|
+
};
|
|
745
|
+
var resolvePaginationClasses = (overrides) => ({
|
|
746
|
+
...paginationClasses,
|
|
747
|
+
...overrides
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
// ../../src/components/pagination/index.ts
|
|
751
|
+
import { Schema as Schema2 } from "effect";
|
|
752
|
+
import { Component, UiSchema } from "effect/ui";
|
|
753
|
+
|
|
754
|
+
// ../../src/components/pagination/schema.ts
|
|
755
|
+
import { Schema, Struct } from "effect";
|
|
756
|
+
var Labels = Schema.Struct({
|
|
757
|
+
pageSize: Schema.optional(Schema.String),
|
|
758
|
+
goToFirstPage: Schema.optional(Schema.String),
|
|
759
|
+
goToPreviousPage: Schema.optional(Schema.String),
|
|
760
|
+
goToNextPage: Schema.optional(Schema.String),
|
|
761
|
+
goToLastPage: Schema.optional(Schema.String)
|
|
762
|
+
}).annotate({ identifier: "PaginationLabelOverrides" });
|
|
763
|
+
var Translations = Schema.Record(Schema.String, Schema.UndefinedOr(Labels));
|
|
764
|
+
var PaginationClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(paginationClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "PaginationClassesOverrides" });
|
|
765
|
+
var PaginationPropsSchema = Schema.Struct({
|
|
766
|
+
classes: Schema.optional(PaginationClassesOverridesSchema),
|
|
767
|
+
className: Schema.optional(Schema.String),
|
|
768
|
+
pageSizeContentClassName: Schema.optional(Schema.String),
|
|
769
|
+
compact: Schema.optional(Schema.Boolean),
|
|
770
|
+
locale: Schema.optional(Schema.String),
|
|
771
|
+
messages: Schema.optional(Translations),
|
|
772
|
+
page: Schema.Int,
|
|
773
|
+
pageCount: Schema.Int,
|
|
774
|
+
pageSize: Schema.Int,
|
|
775
|
+
pageSizes: Schema.optional(Schema.Array(Schema.Int)),
|
|
776
|
+
selectedRows: Schema.optional(Schema.Int),
|
|
777
|
+
showResults: Schema.optional(Schema.Boolean),
|
|
778
|
+
totalRows: Schema.Int
|
|
779
|
+
}).annotate({ identifier: "PaginationProps" });
|
|
780
|
+
|
|
781
|
+
// ../../src/components/pagination/index.ts
|
|
782
|
+
var PaginationMessage = UiSchema.TaggedEnum({
|
|
783
|
+
Opened: {},
|
|
784
|
+
Closed: {},
|
|
785
|
+
PageRequested: { page: Schema2.Int },
|
|
786
|
+
SizeRequested: { pageSize: Schema2.Int }
|
|
787
|
+
}).annotate({ identifier: "PaginationMessage" });
|
|
788
|
+
var PaginationEvents = UiSchema.TaggedEnum({
|
|
789
|
+
PageChanged: { page: Schema2.Int },
|
|
790
|
+
PageSizeChanged: { pageSize: Schema2.Int }
|
|
791
|
+
}).annotate({ identifier: "PaginationEvents" });
|
|
792
|
+
var paginationOptions = {
|
|
793
|
+
name: "Pagination",
|
|
794
|
+
props: PaginationPropsSchema,
|
|
795
|
+
model: Schema2.Boolean,
|
|
796
|
+
message: PaginationMessage,
|
|
797
|
+
events: PaginationEvents,
|
|
798
|
+
restore: false
|
|
799
|
+
};
|
|
800
|
+
var update = Component.define(paginationOptions).update({
|
|
801
|
+
Opened: () => true,
|
|
802
|
+
Closed: () => false,
|
|
803
|
+
PageRequested: ($, { page }) => $.set($.model).emit(PaginationEvents.PageChanged({ page })),
|
|
804
|
+
SizeRequested: ($, { pageSize }) => $.set(false).emit(PaginationEvents.PageSizeChanged({ pageSize }))
|
|
805
|
+
});
|
|
723
806
|
var messages = {
|
|
724
807
|
en: {
|
|
725
808
|
pageSize: "Page size",
|
|
@@ -747,7 +830,35 @@ var paginationMessages = (locale = "en", translations) => ({
|
|
|
747
830
|
...translations?.[locale.split("-")[0] ?? locale],
|
|
748
831
|
...translations?.[locale]
|
|
749
832
|
});
|
|
833
|
+
var defaultPageSizes = [20, 50, 100];
|
|
834
|
+
var paginationPageLabel = (page, pageCount, pageOf) => pageCount > 0 ? pageOf(page + 1, pageCount) : undefined;
|
|
835
|
+
var paginationNavigation = (page, pageCount) => ({
|
|
836
|
+
goToFirstPage: {
|
|
837
|
+
page: 0,
|
|
838
|
+
disabled: pageCount <= 0 || page <= 0,
|
|
839
|
+
edge: true
|
|
840
|
+
},
|
|
841
|
+
goToPreviousPage: {
|
|
842
|
+
page: page - 1,
|
|
843
|
+
disabled: pageCount <= 0 || page <= 0,
|
|
844
|
+
edge: false
|
|
845
|
+
},
|
|
846
|
+
goToNextPage: {
|
|
847
|
+
page: page + 1,
|
|
848
|
+
disabled: pageCount <= 0 || page + 1 >= pageCount,
|
|
849
|
+
edge: false
|
|
850
|
+
},
|
|
851
|
+
goToLastPage: {
|
|
852
|
+
page: pageCount - 1,
|
|
853
|
+
disabled: pageCount <= 0 || page + 1 >= pageCount,
|
|
854
|
+
edge: true
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
// ../../src/components/pagination/react.tsx
|
|
859
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
750
860
|
function Pagination({
|
|
861
|
+
classes: classOverrides,
|
|
751
862
|
className,
|
|
752
863
|
pageSizeContentClassName,
|
|
753
864
|
compact = false,
|
|
@@ -758,22 +869,23 @@ function Pagination({
|
|
|
758
869
|
page,
|
|
759
870
|
pageCount,
|
|
760
871
|
pageSize,
|
|
761
|
-
pageSizes =
|
|
872
|
+
pageSizes = defaultPageSizes,
|
|
762
873
|
selectedRows = 0,
|
|
763
874
|
showResults = true,
|
|
764
875
|
totalRows
|
|
765
876
|
}) {
|
|
877
|
+
const paginationClasses = resolvePaginationClasses(classOverrides);
|
|
766
878
|
const locale = useKrakstackLocale2(localeOverride);
|
|
767
879
|
const labels = paginationMessages(locale, messageOverrides);
|
|
768
880
|
const pageSizeId = useId();
|
|
769
|
-
const
|
|
770
|
-
const
|
|
881
|
+
const navigation = paginationNavigation(page, pageCount);
|
|
882
|
+
const pageLabel = paginationPageLabel(page, pageCount, labels.pageOf);
|
|
771
883
|
return /* @__PURE__ */ jsxs6("div", {
|
|
772
884
|
"data-slot": "pagination",
|
|
773
|
-
className: cn(
|
|
885
|
+
className: cn(paginationClasses.root, compact && paginationClasses.compactRoot, className),
|
|
774
886
|
children: [
|
|
775
887
|
showResults ? /* @__PURE__ */ jsxs6("div", {
|
|
776
|
-
className:
|
|
888
|
+
className: paginationClasses.summary,
|
|
777
889
|
children: [
|
|
778
890
|
/* @__PURE__ */ jsx11("span", {
|
|
779
891
|
children: labels.results(totalRows)
|
|
@@ -784,10 +896,10 @@ function Pagination({
|
|
|
784
896
|
]
|
|
785
897
|
}) : null,
|
|
786
898
|
/* @__PURE__ */ jsxs6("div", {
|
|
787
|
-
className: cn(
|
|
899
|
+
className: cn(paginationClasses.controls, compact && paginationClasses.compactControls),
|
|
788
900
|
children: [
|
|
789
901
|
/* @__PURE__ */ jsxs6("div", {
|
|
790
|
-
className:
|
|
902
|
+
className: paginationClasses.controlGroup,
|
|
791
903
|
children: [
|
|
792
904
|
/* @__PURE__ */ jsx11(Label, {
|
|
793
905
|
htmlFor: pageSizeId,
|
|
@@ -822,19 +934,19 @@ function Pagination({
|
|
|
822
934
|
]
|
|
823
935
|
}),
|
|
824
936
|
/* @__PURE__ */ jsxs6("div", {
|
|
825
|
-
className:
|
|
937
|
+
className: paginationClasses.controlGroup,
|
|
826
938
|
children: [
|
|
827
|
-
/* @__PURE__ */ jsx11("div", {
|
|
939
|
+
pageLabel !== undefined && /* @__PURE__ */ jsx11("div", {
|
|
828
940
|
className: "flex items-center justify-center text-sm font-medium sm:block",
|
|
829
|
-
children:
|
|
941
|
+
children: pageLabel
|
|
830
942
|
}),
|
|
831
943
|
/* @__PURE__ */ jsxs6("div", {
|
|
832
|
-
className:
|
|
944
|
+
className: paginationClasses.navigation,
|
|
833
945
|
children: [
|
|
834
946
|
/* @__PURE__ */ jsxs6(Button, {
|
|
835
947
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
836
|
-
disabled:
|
|
837
|
-
onClick: () => onPageChange(
|
|
948
|
+
disabled: navigation.goToFirstPage.disabled,
|
|
949
|
+
onClick: () => onPageChange(navigation.goToFirstPage.page),
|
|
838
950
|
type: "button",
|
|
839
951
|
children: [
|
|
840
952
|
/* @__PURE__ */ jsx11("span", {
|
|
@@ -846,8 +958,8 @@ function Pagination({
|
|
|
846
958
|
}),
|
|
847
959
|
/* @__PURE__ */ jsxs6(Button, {
|
|
848
960
|
className: "h-8 w-8 p-0",
|
|
849
|
-
disabled:
|
|
850
|
-
onClick: () => onPageChange(page
|
|
961
|
+
disabled: navigation.goToPreviousPage.disabled,
|
|
962
|
+
onClick: () => onPageChange(navigation.goToPreviousPage.page),
|
|
851
963
|
type: "button",
|
|
852
964
|
children: [
|
|
853
965
|
/* @__PURE__ */ jsx11("span", {
|
|
@@ -859,8 +971,8 @@ function Pagination({
|
|
|
859
971
|
}),
|
|
860
972
|
/* @__PURE__ */ jsxs6(Button, {
|
|
861
973
|
className: "h-8 w-8 p-0",
|
|
862
|
-
disabled:
|
|
863
|
-
onClick: () => onPageChange(page
|
|
974
|
+
disabled: navigation.goToNextPage.disabled,
|
|
975
|
+
onClick: () => onPageChange(navigation.goToNextPage.page),
|
|
864
976
|
type: "button",
|
|
865
977
|
children: [
|
|
866
978
|
/* @__PURE__ */ jsx11("span", {
|
|
@@ -872,8 +984,8 @@ function Pagination({
|
|
|
872
984
|
}),
|
|
873
985
|
/* @__PURE__ */ jsxs6(Button, {
|
|
874
986
|
className: cn("hidden h-8 w-8 p-0 lg:flex", compact && "!hidden"),
|
|
875
|
-
disabled:
|
|
876
|
-
onClick: () => onPageChange(
|
|
987
|
+
disabled: navigation.goToLastPage.disabled,
|
|
988
|
+
onClick: () => onPageChange(navigation.goToLastPage.page),
|
|
877
989
|
type: "button",
|
|
878
990
|
children: [
|
|
879
991
|
/* @__PURE__ */ jsx11("span", {
|
|
@@ -892,7 +1004,6 @@ function Pagination({
|
|
|
892
1004
|
]
|
|
893
1005
|
});
|
|
894
1006
|
}
|
|
895
|
-
|
|
896
1007
|
// ../../src/components/ui/scroll-area.tsx
|
|
897
1008
|
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
898
1009
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -1045,7 +1156,7 @@ import {
|
|
|
1045
1156
|
DateTime,
|
|
1046
1157
|
Effect,
|
|
1047
1158
|
Option,
|
|
1048
|
-
Schema,
|
|
1159
|
+
Schema as Schema3,
|
|
1049
1160
|
SchemaGetter,
|
|
1050
1161
|
SchemaIssue,
|
|
1051
1162
|
SchemaTransformation
|
|
@@ -1057,25 +1168,25 @@ var parseSortParam = (sort) => {
|
|
|
1057
1168
|
}
|
|
1058
1169
|
return { id, direction: sort.startsWith("-") ? "desc" : "asc" };
|
|
1059
1170
|
};
|
|
1060
|
-
var SortDirection =
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
]).pipe(
|
|
1171
|
+
var SortDirection = Schema3.Union([
|
|
1172
|
+
Schema3.Literal("asc"),
|
|
1173
|
+
Schema3.Literal("desc")
|
|
1174
|
+
]).pipe(Schema3.annotate({
|
|
1064
1175
|
identifier: "SortDirection",
|
|
1065
1176
|
title: "Sort Direction",
|
|
1066
1177
|
description: "Sort direction for list query results.",
|
|
1067
1178
|
examples: ["asc", "desc"]
|
|
1068
1179
|
}));
|
|
1069
|
-
var SortParam =
|
|
1070
|
-
id:
|
|
1180
|
+
var SortParam = Schema3.Struct({
|
|
1181
|
+
id: Schema3.NonEmptyString,
|
|
1071
1182
|
direction: SortDirection
|
|
1072
|
-
}).pipe(
|
|
1183
|
+
}).pipe(Schema3.annotate({
|
|
1073
1184
|
identifier: "SortParam",
|
|
1074
1185
|
title: "Sort Parameter",
|
|
1075
1186
|
description: "Decoded sort parameter with a field id and direction.",
|
|
1076
1187
|
examples: [{ id: "publicName", direction: "asc" }]
|
|
1077
1188
|
}));
|
|
1078
|
-
var SortParamFromString =
|
|
1189
|
+
var SortParamFromString = Schema3.String.pipe(Schema3.decodeTo(SortParam, SchemaTransformation.transformEffect({
|
|
1079
1190
|
decode: (sort) => {
|
|
1080
1191
|
const sortParam = parseSortParam(sort);
|
|
1081
1192
|
if (!sortParam) {
|
|
@@ -1084,13 +1195,13 @@ var SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTr
|
|
|
1084
1195
|
return Effect.succeed(sortParam);
|
|
1085
1196
|
},
|
|
1086
1197
|
encode: (sort) => Effect.succeed(sort.direction === "desc" ? `-${sort.id}` : sort.id)
|
|
1087
|
-
})),
|
|
1198
|
+
})), Schema3.annotate({
|
|
1088
1199
|
identifier: "SortParamFromString",
|
|
1089
1200
|
title: "Sort Parameter From String",
|
|
1090
1201
|
description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
|
|
1091
1202
|
examples: [{ id: "publicName", direction: "asc" }]
|
|
1092
1203
|
}));
|
|
1093
|
-
var SortParamsFromString =
|
|
1204
|
+
var SortParamsFromString = Schema3.String.pipe(Schema3.decodeTo(Schema3.Array(SortParam), SchemaTransformation.transformEffect({
|
|
1094
1205
|
decode: (sort) => {
|
|
1095
1206
|
if (sort === "")
|
|
1096
1207
|
return Effect.succeed([]);
|
|
@@ -1105,8 +1216,8 @@ var SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortP
|
|
|
1105
1216
|
}
|
|
1106
1217
|
return Effect.succeed(sortParams);
|
|
1107
1218
|
},
|
|
1108
|
-
encode: (sort) => Effect.succeed(sort.map((part) =>
|
|
1109
|
-
})),
|
|
1219
|
+
encode: (sort) => Effect.succeed(sort.map((part) => Schema3.encodeSync(SortParamFromString)(part)).join(","))
|
|
1220
|
+
})), Schema3.annotate({
|
|
1110
1221
|
identifier: "SortParamsFromString",
|
|
1111
1222
|
title: "Sort Parameters From String",
|
|
1112
1223
|
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
@@ -1117,104 +1228,1556 @@ var SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortP
|
|
|
1117
1228
|
]
|
|
1118
1229
|
]
|
|
1119
1230
|
}));
|
|
1120
|
-
var SortParamsArray =
|
|
1121
|
-
var SortParams =
|
|
1231
|
+
var SortParamsArray = Schema3.Array(SortParam);
|
|
1232
|
+
var SortParams = Schema3.declare(Schema3.is(SortParamsArray), {
|
|
1122
1233
|
identifier: "SortParams",
|
|
1123
|
-
toCodec: () =>
|
|
1124
|
-
toCodecStringTree: () =>
|
|
1234
|
+
toCodec: () => Schema3.link()(SortParamsArray, SchemaTransformation.passthrough()),
|
|
1235
|
+
toCodecStringTree: () => Schema3.link()(SortParamsFromString, SchemaTransformation.passthrough())
|
|
1125
1236
|
});
|
|
1126
|
-
var TextFilterOperator =
|
|
1237
|
+
var TextFilterOperator = Schema3.Literals([
|
|
1127
1238
|
"contains",
|
|
1128
1239
|
"equals",
|
|
1129
1240
|
"startsWith",
|
|
1130
1241
|
"endsWith"
|
|
1131
1242
|
]).annotate({ identifier: "TextFilterOperator" });
|
|
1132
|
-
var FilterCalendarDate =
|
|
1133
|
-
var ColumnFilter =
|
|
1134
|
-
|
|
1135
|
-
id:
|
|
1136
|
-
kind:
|
|
1243
|
+
var FilterCalendarDate = Schema3.String.check(Schema3.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema3.makeFilter((value) => Option.exists(DateTime.make(value), (date) => DateTime.formatIsoDateUtc(date) === value))).annotate({ identifier: "FilterCalendarDate" });
|
|
1244
|
+
var ColumnFilter = Schema3.Union([
|
|
1245
|
+
Schema3.Struct({
|
|
1246
|
+
id: Schema3.NonEmptyString,
|
|
1247
|
+
kind: Schema3.Literal("text"),
|
|
1137
1248
|
operator: TextFilterOperator,
|
|
1138
|
-
value:
|
|
1249
|
+
value: Schema3.NonEmptyString
|
|
1250
|
+
}),
|
|
1251
|
+
Schema3.Struct({
|
|
1252
|
+
id: Schema3.NonEmptyString,
|
|
1253
|
+
kind: Schema3.Literal("number"),
|
|
1254
|
+
min: Schema3.optional(Schema3.Finite),
|
|
1255
|
+
max: Schema3.optional(Schema3.Finite)
|
|
1256
|
+
}).check(Schema3.makeFilter((range) => (range.min !== undefined || range.max !== undefined) && (range.min === undefined || range.max === undefined || range.min <= range.max))),
|
|
1257
|
+
Schema3.Struct({
|
|
1258
|
+
id: Schema3.NonEmptyString,
|
|
1259
|
+
kind: Schema3.Literal("date"),
|
|
1260
|
+
from: Schema3.optional(FilterCalendarDate),
|
|
1261
|
+
to: Schema3.optional(FilterCalendarDate)
|
|
1262
|
+
}).check(Schema3.makeFilter((range) => (range.from !== undefined || range.to !== undefined) && (range.from === undefined || range.to === undefined || range.from <= range.to))),
|
|
1263
|
+
Schema3.Struct({
|
|
1264
|
+
id: Schema3.NonEmptyString,
|
|
1265
|
+
kind: Schema3.Literal("boolean"),
|
|
1266
|
+
value: Schema3.Boolean
|
|
1267
|
+
}),
|
|
1268
|
+
Schema3.Struct({
|
|
1269
|
+
id: Schema3.NonEmptyString,
|
|
1270
|
+
kind: Schema3.Literal("values"),
|
|
1271
|
+
values: Schema3.NonEmptyArray(Schema3.String)
|
|
1272
|
+
})
|
|
1273
|
+
]).annotate({ identifier: "ColumnFilter" });
|
|
1274
|
+
var ColumnFiltersArray = Schema3.Array(ColumnFilter);
|
|
1275
|
+
var ColumnFilters = Schema3.declare(Schema3.is(ColumnFiltersArray), {
|
|
1276
|
+
identifier: "ColumnFilters",
|
|
1277
|
+
toCodec: () => Schema3.link()(ColumnFiltersArray, SchemaTransformation.passthrough()),
|
|
1278
|
+
toCodecStringTree: () => Schema3.link()(Schema3.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
|
|
1279
|
+
});
|
|
1280
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
1281
|
+
var Query = Schema3.Struct({
|
|
1282
|
+
page: Schema3.optional(Schema3.Union([Schema3.Finite, Schema3.FiniteFromString]).check(Schema3.isInt(), Schema3.isGreaterThanOrEqualTo(0))).pipe(Schema3.decodeTo(Schema3.Int.check(Schema3.isGreaterThanOrEqualTo(0)), {
|
|
1283
|
+
decode: SchemaGetter.withDefault(Effect.succeed(0)),
|
|
1284
|
+
encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
|
|
1285
|
+
})),
|
|
1286
|
+
pageSize: Schema3.optional(Schema3.Union([Schema3.Finite, Schema3.FiniteFromString]).check(Schema3.isInt(), Schema3.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema3.decodeTo(Schema3.Int.check(Schema3.isBetween({ minimum: 1, maximum: 100 })), {
|
|
1287
|
+
decode: SchemaGetter.withDefault(Effect.succeed(DEFAULT_PAGE_SIZE)),
|
|
1288
|
+
encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== DEFAULT_PAGE_SIZE))
|
|
1289
|
+
})),
|
|
1290
|
+
globalFilter: Schema3.optional(Schema3.String),
|
|
1291
|
+
sort: Schema3.optional(SortParams),
|
|
1292
|
+
filters: Schema3.optional(ColumnFilters)
|
|
1293
|
+
}).annotate({
|
|
1294
|
+
identifier: "Query",
|
|
1295
|
+
title: "Query",
|
|
1296
|
+
description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
|
|
1297
|
+
examples: [
|
|
1298
|
+
{
|
|
1299
|
+
page: 0,
|
|
1300
|
+
pageSize: DEFAULT_PAGE_SIZE,
|
|
1301
|
+
globalFilter: "housing",
|
|
1302
|
+
sort: [
|
|
1303
|
+
{ id: "publicName", direction: "desc" },
|
|
1304
|
+
{ id: "createdAt", direction: "asc" }
|
|
1305
|
+
]
|
|
1306
|
+
}
|
|
1307
|
+
]
|
|
1308
|
+
});
|
|
1309
|
+
var QueryStandard = Schema3.toStandardSchemaV1(Query);
|
|
1310
|
+
var PaginationMeta = Schema3.Struct({
|
|
1311
|
+
page: Schema3.Int,
|
|
1312
|
+
pageSize: Schema3.Int,
|
|
1313
|
+
total: Schema3.Int,
|
|
1314
|
+
pageCount: Schema3.Int
|
|
1315
|
+
}).pipe(Schema3.annotate({
|
|
1316
|
+
identifier: "PaginationMeta",
|
|
1317
|
+
title: "Pagination Metadata",
|
|
1318
|
+
description: "Pagination metadata returned with a paginated list response.",
|
|
1319
|
+
examples: [{ page: 0, pageSize: 20, total: 125, pageCount: 7 }]
|
|
1320
|
+
}));
|
|
1321
|
+
|
|
1322
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1323
|
+
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
1324
|
+
import {
|
|
1325
|
+
createContext,
|
|
1326
|
+
useCallback,
|
|
1327
|
+
useContext,
|
|
1328
|
+
useEffect,
|
|
1329
|
+
useLayoutEffect,
|
|
1330
|
+
useRef,
|
|
1331
|
+
useState,
|
|
1332
|
+
useSyncExternalStore
|
|
1333
|
+
} from "react";
|
|
1334
|
+
|
|
1335
|
+
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
1336
|
+
import { MessageLog, Renderer, View } from "effect/ui";
|
|
1337
|
+
import { BrowserHost, Html } from "effect/ui/html";
|
|
1338
|
+
import { Cause, Effect as Effect2, Fiber } from "effect";
|
|
1339
|
+
var node = () => ({ children: [] });
|
|
1340
|
+
var modelHost = (commit) => {
|
|
1341
|
+
const remove = (child) => {
|
|
1342
|
+
if (!child.parent)
|
|
1343
|
+
return;
|
|
1344
|
+
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
1345
|
+
delete child.parent;
|
|
1346
|
+
};
|
|
1347
|
+
return {
|
|
1348
|
+
createElement: node,
|
|
1349
|
+
createText: node,
|
|
1350
|
+
setText: () => {},
|
|
1351
|
+
setAttr: () => {},
|
|
1352
|
+
setProp: () => {},
|
|
1353
|
+
setEvents: () => {},
|
|
1354
|
+
insertBefore: (parent, child, before) => {
|
|
1355
|
+
if (child === before)
|
|
1356
|
+
return;
|
|
1357
|
+
remove(child);
|
|
1358
|
+
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
1359
|
+
parent.children.splice(index, 0, child);
|
|
1360
|
+
child.parent = parent;
|
|
1361
|
+
},
|
|
1362
|
+
remove,
|
|
1363
|
+
parentOf: (child) => child.parent,
|
|
1364
|
+
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
1365
|
+
elements: ["html"],
|
|
1366
|
+
controlled: new Set,
|
|
1367
|
+
runsMounts: false,
|
|
1368
|
+
commit
|
|
1369
|
+
};
|
|
1370
|
+
};
|
|
1371
|
+
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
1372
|
+
let currentProps = props;
|
|
1373
|
+
let root;
|
|
1374
|
+
let active = true;
|
|
1375
|
+
let failure;
|
|
1376
|
+
const publish = () => {
|
|
1377
|
+
if (!active)
|
|
1378
|
+
return;
|
|
1379
|
+
if (failure) {
|
|
1380
|
+
publishSnapshot({ error: failure });
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
const current = root?.model();
|
|
1384
|
+
if (current !== undefined)
|
|
1385
|
+
publishSnapshot({ model: current });
|
|
1386
|
+
};
|
|
1387
|
+
const fiber = Effect2.runFork(Effect2.scoped(Effect2.gen(function* () {
|
|
1388
|
+
const mounted = yield* Renderer.mount(component, Effect2.succeed(props), node(), {
|
|
1389
|
+
head: false,
|
|
1390
|
+
onEmit,
|
|
1391
|
+
fallback: ({ cause }) => {
|
|
1392
|
+
failure = new Error("Effect UI root failed", {
|
|
1393
|
+
cause: Cause.squash(cause)
|
|
1394
|
+
});
|
|
1395
|
+
return View.text("");
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1398
|
+
if (!active)
|
|
1399
|
+
return;
|
|
1400
|
+
root = mounted;
|
|
1401
|
+
if (props !== currentProps)
|
|
1402
|
+
mounted.setProps(currentProps);
|
|
1403
|
+
publish();
|
|
1404
|
+
return yield* Effect2.never;
|
|
1405
|
+
}).pipe(Effect2.provide(Renderer.layer(modelHost(publish))), Effect2.provideService(Html.Host, BrowserHost.htmlHost), Effect2.provideService(MessageLog.MessageLog, messageLog))));
|
|
1406
|
+
return {
|
|
1407
|
+
send: (message) => {
|
|
1408
|
+
root?.send(message);
|
|
1409
|
+
publish();
|
|
1410
|
+
},
|
|
1411
|
+
setProps: (next) => {
|
|
1412
|
+
currentProps = next;
|
|
1413
|
+
root?.setProps(next);
|
|
1414
|
+
},
|
|
1415
|
+
dispose: () => {
|
|
1416
|
+
active = false;
|
|
1417
|
+
root = undefined;
|
|
1418
|
+
Effect2.runFork(Fiber.interrupt(fiber));
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1424
|
+
"use client";
|
|
1425
|
+
var ModelMessageLogContext = createContext(undefined);
|
|
1426
|
+
var useModel = (component, props, options = {}) => {
|
|
1427
|
+
const contextLog = useContext(ModelMessageLogContext);
|
|
1428
|
+
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
1429
|
+
const [store] = useState(() => {
|
|
1430
|
+
const initial = { model: component.init(props).model };
|
|
1431
|
+
let snapshot = initial;
|
|
1432
|
+
const listeners = new Set;
|
|
1433
|
+
return {
|
|
1434
|
+
subscribe: (listener) => {
|
|
1435
|
+
listeners.add(listener);
|
|
1436
|
+
return () => {
|
|
1437
|
+
listeners.delete(listener);
|
|
1438
|
+
};
|
|
1439
|
+
},
|
|
1440
|
+
getSnapshot: () => snapshot,
|
|
1441
|
+
getServerSnapshot: () => initial,
|
|
1442
|
+
publish: (next) => {
|
|
1443
|
+
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
1444
|
+
return;
|
|
1445
|
+
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
1446
|
+
return;
|
|
1447
|
+
snapshot = next;
|
|
1448
|
+
listeners.forEach((listener) => listener());
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
});
|
|
1452
|
+
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
1453
|
+
const committed = useRef(props);
|
|
1454
|
+
const onEmit = useRef(options.onEmit);
|
|
1455
|
+
const runtime = useRef(undefined);
|
|
1456
|
+
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
1457
|
+
useLayoutEffect(() => {
|
|
1458
|
+
onEmit.current = options.onEmit;
|
|
1459
|
+
committed.current = props;
|
|
1460
|
+
runtime.current?.setProps(props);
|
|
1461
|
+
}, [props, options.onEmit]);
|
|
1462
|
+
useEffect(() => {
|
|
1463
|
+
if (messageLog === null)
|
|
1464
|
+
return;
|
|
1465
|
+
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
1466
|
+
runtime.current = mounted;
|
|
1467
|
+
return () => {
|
|
1468
|
+
runtime.current = undefined;
|
|
1469
|
+
mounted.dispose();
|
|
1470
|
+
};
|
|
1471
|
+
}, [component, messageLog, store]);
|
|
1472
|
+
if ("error" in snapshot)
|
|
1473
|
+
throw snapshot.error;
|
|
1474
|
+
return { model: snapshot.model, send };
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
// ../../src/components/data-table/react.tsx
|
|
1478
|
+
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
1479
|
+
|
|
1480
|
+
// ../../src/components/data-table/classes.ts
|
|
1481
|
+
var tableClasses = {
|
|
1482
|
+
selectionCell: "w-10 p-0 align-middle",
|
|
1483
|
+
selectionCenter: "grid place-items-center",
|
|
1484
|
+
count: "inline-flex min-w-5 shrink-0 items-center justify-center rounded-full bg-secondary px-1.5 py-0.5 text-xs font-medium tabular-nums text-secondary-foreground",
|
|
1485
|
+
selectedTrigger: "bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground",
|
|
1486
|
+
toolbar: "flex min-w-0 shrink-0 flex-wrap items-center gap-2",
|
|
1487
|
+
toolbarSearch: "relative min-w-0 flex-[1_1_12rem]",
|
|
1488
|
+
toolbarMenus: "w-max min-w-0 max-w-full",
|
|
1489
|
+
menubar: "h-auto w-full flex-wrap justify-start border border-input bg-transparent",
|
|
1490
|
+
cell: "overflow-hidden",
|
|
1491
|
+
cellContent: "min-w-0 wrap-anywhere",
|
|
1492
|
+
actionTrigger: "size-8 focus-visible:ring-inset",
|
|
1493
|
+
actionsCell: "sticky right-0 z-20 w-10 min-w-10 cursor-default bg-background p-0 transition-colors group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))]",
|
|
1494
|
+
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
1495
|
+
header: "relative h-12 p-0",
|
|
1496
|
+
stickyHeader: "sticky top-0 z-30 bg-background",
|
|
1497
|
+
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
1498
|
+
headerTrigger: "absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 focus-visible:ring-inset",
|
|
1499
|
+
resizeHandle: "absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-border hover:after:w-0.5 hover:after:bg-primary/60 focus-visible:after:w-0.5 focus-visible:after:bg-ring",
|
|
1500
|
+
relationshipCell: "grid min-h-16 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0",
|
|
1501
|
+
relationshipTrigger: "h-full w-full min-w-0 justify-between rounded-none px-2 text-start focus-visible:ring-inset",
|
|
1502
|
+
reference: "flex min-w-0 items-center gap-2",
|
|
1503
|
+
referenceAvatar: "relative grid size-8 shrink-0 place-items-center overflow-hidden bg-muted text-xs font-medium",
|
|
1504
|
+
referenceText: "flex min-w-0 flex-col leading-tight",
|
|
1505
|
+
group: "bg-muted/40 hover:bg-accent!",
|
|
1506
|
+
groupContent: "flex min-w-0 items-center gap-2 py-2 pe-1 ps-2",
|
|
1507
|
+
groupSticky: "sticky start-0 w-[100cqw] max-w-full",
|
|
1508
|
+
groupTrigger: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-start font-medium",
|
|
1509
|
+
referenceName: "truncate font-medium",
|
|
1510
|
+
referenceDescription: "text-muted-foreground truncate text-xs"
|
|
1511
|
+
};
|
|
1512
|
+
var resolveTableClasses = (overrides) => ({
|
|
1513
|
+
...tableClasses,
|
|
1514
|
+
...overrides
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
// ../../src/components/data-table/index.ts
|
|
1518
|
+
import { DateTime as DateTime3, Effect as Effect3, Option as Option3, Redacted, Schema as Schema5, Stream } from "effect";
|
|
1519
|
+
import { Csv } from "effect/encoding";
|
|
1520
|
+
import { Command, Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
1521
|
+
|
|
1522
|
+
// ../../src/components/data-table/schema.ts
|
|
1523
|
+
import { DateTime as DateTime2, Option as Option2, Schema as Schema4, Struct as Struct2, Tuple } from "effect";
|
|
1524
|
+
var TableClassesOverridesSchema = Schema4.Record(Schema4.Literals(Struct2.keys(tableClasses)), Schema4.optionalKey(Schema4.String)).annotate({ identifier: "TableClassesOverrides" });
|
|
1525
|
+
var DataTableCommonPropsSchema = Schema4.Struct({
|
|
1526
|
+
classes: Schema4.optional(TableClassesOverridesSchema),
|
|
1527
|
+
className: Schema4.optionalKey(Schema4.String),
|
|
1528
|
+
locale: Schema4.optionalKey(Schema4.String)
|
|
1529
|
+
}).annotate({ identifier: "DataTableCommonProps" });
|
|
1530
|
+
var DataTableSortSchema = Schema4.Struct({
|
|
1531
|
+
id: Schema4.NonEmptyString,
|
|
1532
|
+
direction: Schema4.Literals(["asc", "desc"])
|
|
1533
|
+
}).annotate({ identifier: "DataTableSort" });
|
|
1534
|
+
var queryFields = {
|
|
1535
|
+
page: Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0)),
|
|
1536
|
+
pageSize: Schema4.Int.check(Schema4.isBetween({ minimum: 1, maximum: 100 })),
|
|
1537
|
+
globalFilter: Schema4.optional(Schema4.String),
|
|
1538
|
+
sort: Schema4.optional(Schema4.Array(DataTableSortSchema)),
|
|
1539
|
+
filters: Schema4.optional(Schema4.Array(ColumnFilter))
|
|
1540
|
+
};
|
|
1541
|
+
var DataTableQuerySchema = Schema4.Struct(queryFields).annotate({
|
|
1542
|
+
identifier: "DataTableQuery"
|
|
1543
|
+
});
|
|
1544
|
+
var PageSizes = Schema4.NonEmptyArray(Schema4.Int.check(Schema4.isBetween({ minimum: 1, maximum: 100 })));
|
|
1545
|
+
var DataTableCommonFeaturesSchema = Schema4.Struct({
|
|
1546
|
+
search: Schema4.optionalKey(Schema4.Boolean),
|
|
1547
|
+
filtering: Schema4.optionalKey(Schema4.Boolean),
|
|
1548
|
+
sorting: Schema4.optionalKey(Schema4.Boolean),
|
|
1549
|
+
columnVisibility: Schema4.optionalKey(Schema4.Boolean)
|
|
1550
|
+
});
|
|
1551
|
+
var PaginationSchema = Schema4.Union([
|
|
1552
|
+
Schema4.Struct({
|
|
1553
|
+
mode: Schema4.optionalKey(Schema4.Literal("client")),
|
|
1554
|
+
pageSizes: Schema4.optionalKey(PageSizes)
|
|
1555
|
+
}).annotate({ identifier: "DataTableClientPagination" }),
|
|
1556
|
+
Schema4.Struct({
|
|
1557
|
+
mode: Schema4.Literal("server"),
|
|
1558
|
+
rowCount: Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0)),
|
|
1559
|
+
pageSizes: Schema4.optionalKey(PageSizes)
|
|
1560
|
+
}).annotate({ identifier: "DataTableServerPagination" })
|
|
1561
|
+
]);
|
|
1562
|
+
var DataTableItemSchema = Schema4.Struct({
|
|
1563
|
+
value: Schema4.NonEmptyString,
|
|
1564
|
+
label: Schema4.String
|
|
1565
|
+
}).annotate({ identifier: "DataTableItem" });
|
|
1566
|
+
var DataTableReferenceSchema = Schema4.Struct({
|
|
1567
|
+
label: Schema4.String,
|
|
1568
|
+
description: Schema4.optionalKey(Schema4.String),
|
|
1569
|
+
imageSrc: Schema4.optionalKey(Schema4.NullOr(Schema4.String))
|
|
1570
|
+
}).annotate({ identifier: "DataTableReference" });
|
|
1571
|
+
var CalendarDate = Schema4.String.check(Schema4.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema4.makeFilter((value) => Option2.exists(DateTime2.make(value), (date) => DateTime2.formatIsoDateUtc(date) === value))).annotate({ identifier: "DataTableCalendarDate" });
|
|
1572
|
+
var isCalendarDate = Schema4.is(CalendarDate);
|
|
1573
|
+
var InstantString = Schema4.String.check(Schema4.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema4.makeFilter((value) => isCalendarDate(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
|
|
1574
|
+
var DataTableDateInputSchema = Schema4.Union([
|
|
1575
|
+
Schema4.Date,
|
|
1576
|
+
Schema4.Int,
|
|
1577
|
+
CalendarDate,
|
|
1578
|
+
InstantString
|
|
1579
|
+
]).annotate({ identifier: "DataTableDateInput" });
|
|
1580
|
+
var DateStyle = Schema4.Literals(["full", "long", "medium", "short"]);
|
|
1581
|
+
var DataTableDateFormatSchema = Schema4.Struct({
|
|
1582
|
+
locale: Schema4.optionalKey(Schema4.String),
|
|
1583
|
+
timeZone: Schema4.optionalKey(Schema4.String),
|
|
1584
|
+
dateStyle: Schema4.optionalKey(DateStyle),
|
|
1585
|
+
exportFormat: Schema4.optionalKey(Schema4.Literals(["iso", "formatted"]))
|
|
1586
|
+
}).annotate({ identifier: "DataTableDateFormat" });
|
|
1587
|
+
var DataTableDateTimeFormatSchema = Schema4.Struct({
|
|
1588
|
+
...DataTableDateFormatSchema.fields,
|
|
1589
|
+
timeStyle: Schema4.optionalKey(DateStyle),
|
|
1590
|
+
hour12: Schema4.optionalKey(Schema4.Boolean)
|
|
1591
|
+
}).annotate({ identifier: "DataTableDateTimeFormat" });
|
|
1592
|
+
var DataTableCellValueSchema = Schema4.NullOr(Schema4.Union([
|
|
1593
|
+
Schema4.String,
|
|
1594
|
+
Schema4.Boolean,
|
|
1595
|
+
Schema4.Finite,
|
|
1596
|
+
Schema4.Array(DataTableItemSchema),
|
|
1597
|
+
DataTableReferenceSchema
|
|
1598
|
+
])).annotate({ identifier: "DataTableCellValue" });
|
|
1599
|
+
var DataTableActionSchema = Schema4.Struct({
|
|
1600
|
+
id: Schema4.NonEmptyString,
|
|
1601
|
+
name: Schema4.String,
|
|
1602
|
+
variant: Schema4.optionalKey(Schema4.Literals(["default", "destructive"])),
|
|
1603
|
+
disabled: Schema4.optionalKey(Schema4.Boolean)
|
|
1604
|
+
}).annotate({ identifier: "DataTableAction" });
|
|
1605
|
+
var DataTableRowSchema = Schema4.Struct({
|
|
1606
|
+
id: Schema4.NonEmptyString,
|
|
1607
|
+
label: Schema4.String,
|
|
1608
|
+
cells: Schema4.Record(Schema4.String, DataTableCellValueSchema),
|
|
1609
|
+
actions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
1610
|
+
primaryActionId: Schema4.optionalKey(Schema4.String),
|
|
1611
|
+
groups: Schema4.optionalKey(Schema4.Record(Schema4.String, Schema4.Array(Schema4.String))),
|
|
1612
|
+
selectable: Schema4.optionalKey(Schema4.Boolean),
|
|
1613
|
+
disabledColumnIds: Schema4.optionalKey(Schema4.Array(Schema4.String))
|
|
1614
|
+
}).annotate({ identifier: "DataTableRow" });
|
|
1615
|
+
var column = {
|
|
1616
|
+
id: Schema4.NonEmptyString,
|
|
1617
|
+
headerName: Schema4.String,
|
|
1618
|
+
sortable: Schema4.optionalKey(Schema4.Boolean),
|
|
1619
|
+
hideable: Schema4.optionalKey(Schema4.Boolean),
|
|
1620
|
+
export: Schema4.optionalKey(Schema4.Boolean),
|
|
1621
|
+
width: Schema4.optionalKey(Schema4.Number),
|
|
1622
|
+
minWidth: Schema4.optionalKey(Schema4.Number),
|
|
1623
|
+
maxWidth: Schema4.optionalKey(Schema4.Number),
|
|
1624
|
+
resizable: Schema4.optionalKey(Schema4.Boolean),
|
|
1625
|
+
truncate: Schema4.optionalKey(Schema4.Boolean),
|
|
1626
|
+
searchable: Schema4.optionalKey(Schema4.Boolean),
|
|
1627
|
+
filterable: Schema4.optionalKey(Schema4.Boolean),
|
|
1628
|
+
emptyLabel: Schema4.optionalKey(Schema4.String),
|
|
1629
|
+
nulls: Schema4.optionalKey(Schema4.Literals(["first", "last"]))
|
|
1630
|
+
};
|
|
1631
|
+
var DataTableFieldSchema = Schema4.Union([
|
|
1632
|
+
Schema4.Struct({ ...column, type: Schema4.Literal("text") }),
|
|
1633
|
+
Schema4.Struct({
|
|
1634
|
+
...column,
|
|
1635
|
+
type: Schema4.Literal("number"),
|
|
1636
|
+
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
1637
|
+
locale: Schema4.optionalKey(Schema4.String),
|
|
1638
|
+
style: Schema4.optionalKey(Schema4.Literals(["decimal", "percent", "currency", "unit"])),
|
|
1639
|
+
currency: Schema4.optionalKey(Schema4.String),
|
|
1640
|
+
unit: Schema4.optionalKey(Schema4.String),
|
|
1641
|
+
notation: Schema4.optionalKey(Schema4.Literals(["standard", "scientific", "engineering", "compact"])),
|
|
1642
|
+
minimumFractionDigits: Schema4.optionalKey(Schema4.Int.check(Schema4.isBetween({ minimum: 0, maximum: 20 }))),
|
|
1643
|
+
maximumFractionDigits: Schema4.optionalKey(Schema4.Int.check(Schema4.isBetween({ minimum: 0, maximum: 20 }))),
|
|
1644
|
+
exportFormat: Schema4.optionalKey(Schema4.Literals(["raw", "formatted"]))
|
|
1645
|
+
}).annotate({ identifier: "DataTableNumberFormat" }))
|
|
1646
|
+
}),
|
|
1647
|
+
Schema4.Struct({ ...column, type: Schema4.Literal("reference") }),
|
|
1648
|
+
Schema4.Struct({
|
|
1649
|
+
...column,
|
|
1650
|
+
type: Schema4.Literal("date"),
|
|
1651
|
+
typeOptions: Schema4.optionalKey(DataTableDateFormatSchema)
|
|
1652
|
+
}),
|
|
1653
|
+
Schema4.Struct({
|
|
1654
|
+
...column,
|
|
1655
|
+
type: Schema4.Literal("dateTime"),
|
|
1656
|
+
typeOptions: Schema4.optionalKey(DataTableDateTimeFormatSchema)
|
|
1657
|
+
}),
|
|
1658
|
+
Schema4.Struct({
|
|
1659
|
+
...column,
|
|
1660
|
+
type: Schema4.Literal("boolean"),
|
|
1661
|
+
editable: Schema4.optionalKey(Schema4.Boolean),
|
|
1662
|
+
typeOptions: Schema4.optionalKey(Schema4.Struct({
|
|
1663
|
+
trueLabel: Schema4.optionalKey(Schema4.String),
|
|
1664
|
+
falseLabel: Schema4.optionalKey(Schema4.String),
|
|
1665
|
+
exportFormat: Schema4.optionalKey(Schema4.Literals(["raw", "formatted"]))
|
|
1666
|
+
}).annotate({ identifier: "DataTableBooleanFormat" }))
|
|
1667
|
+
}),
|
|
1668
|
+
Schema4.Struct({
|
|
1669
|
+
...column,
|
|
1670
|
+
type: Schema4.Literal("list"),
|
|
1671
|
+
filterOptions: Schema4.optionalKey(Schema4.Array(DataTableItemSchema)),
|
|
1672
|
+
options: Schema4.optionalKey(Schema4.Array(DataTableItemSchema)),
|
|
1673
|
+
allowRemove: Schema4.optionalKey(Schema4.Boolean),
|
|
1674
|
+
itemActions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
1675
|
+
display: Schema4.optionalKey(Schema4.Literals(["list", "icon"])),
|
|
1676
|
+
visibleCount: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0))),
|
|
1677
|
+
actionsLabel: Schema4.optionalKey(Schema4.String),
|
|
1678
|
+
manageLabel: Schema4.optionalKey(Schema4.String)
|
|
1679
|
+
})
|
|
1680
|
+
]).annotate({ identifier: "DataTableField" });
|
|
1681
|
+
var DataTableColumnSchema = DataTableFieldSchema.mapMembers(Tuple.map(Schema4.fieldsAssign({
|
|
1682
|
+
fields: Schema4.optionalKey(Schema4.Array(DataTableFieldSchema))
|
|
1683
|
+
}))).annotate({ identifier: "DataTableColumn" });
|
|
1684
|
+
var DataTableLabelsSchema = Schema4.Struct({
|
|
1685
|
+
actions: Schema4.optionalKey(Schema4.String),
|
|
1686
|
+
addItem: Schema4.optionalKey(Schema4.String),
|
|
1687
|
+
listDetails: Schema4.optionalKey(Schema4.String),
|
|
1688
|
+
empty: Schema4.optionalKey(Schema4.String),
|
|
1689
|
+
filters: Schema4.optionalKey(Schema4.String),
|
|
1690
|
+
filtersClear: Schema4.optionalKey(Schema4.String),
|
|
1691
|
+
filterColumn: Schema4.optionalKey(Schema4.String),
|
|
1692
|
+
filterClear: Schema4.optionalKey(Schema4.String),
|
|
1693
|
+
filterApply: Schema4.optionalKey(Schema4.String),
|
|
1694
|
+
filterValue: Schema4.optionalKey(Schema4.String),
|
|
1695
|
+
filterOperator: Schema4.optionalKey(Schema4.String),
|
|
1696
|
+
filterContains: Schema4.optionalKey(Schema4.String),
|
|
1697
|
+
filterEquals: Schema4.optionalKey(Schema4.String),
|
|
1698
|
+
filterStartsWith: Schema4.optionalKey(Schema4.String),
|
|
1699
|
+
filterEndsWith: Schema4.optionalKey(Schema4.String),
|
|
1700
|
+
filterMin: Schema4.optionalKey(Schema4.String),
|
|
1701
|
+
filterMax: Schema4.optionalKey(Schema4.String),
|
|
1702
|
+
filterFrom: Schema4.optionalKey(Schema4.String),
|
|
1703
|
+
filterTo: Schema4.optionalKey(Schema4.String),
|
|
1704
|
+
filterTrue: Schema4.optionalKey(Schema4.String),
|
|
1705
|
+
filterFalse: Schema4.optionalKey(Schema4.String),
|
|
1706
|
+
filterInvalid: Schema4.optionalKey(Schema4.String),
|
|
1707
|
+
columns: Schema4.optionalKey(Schema4.String),
|
|
1708
|
+
sortBy: Schema4.optionalKey(Schema4.String),
|
|
1709
|
+
hideColumn: Schema4.optionalKey(Schema4.String),
|
|
1710
|
+
loading: Schema4.optionalKey(Schema4.String),
|
|
1711
|
+
removeItem: Schema4.optionalKey(Schema4.String),
|
|
1712
|
+
search: Schema4.optionalKey(Schema4.String),
|
|
1713
|
+
selectAllRows: Schema4.optionalKey(Schema4.String),
|
|
1714
|
+
selectRow: Schema4.optionalKey(Schema4.String),
|
|
1715
|
+
selected: Schema4.optionalKey(Schema4.String),
|
|
1716
|
+
sortAsc: Schema4.optionalKey(Schema4.String),
|
|
1717
|
+
sortDesc: Schema4.optionalKey(Schema4.String),
|
|
1718
|
+
sortClear: Schema4.optionalKey(Schema4.String),
|
|
1719
|
+
view: Schema4.optionalKey(Schema4.String),
|
|
1720
|
+
tableView: Schema4.optionalKey(Schema4.String),
|
|
1721
|
+
galleryView: Schema4.optionalKey(Schema4.String),
|
|
1722
|
+
groupBy: Schema4.optionalKey(Schema4.String),
|
|
1723
|
+
export: Schema4.optionalKey(Schema4.String),
|
|
1724
|
+
exportFailed: Schema4.optionalKey(Schema4.String),
|
|
1725
|
+
moveUp: Schema4.optionalKey(Schema4.String),
|
|
1726
|
+
moveDown: Schema4.optionalKey(Schema4.String),
|
|
1727
|
+
reorder: Schema4.optionalKey(Schema4.String),
|
|
1728
|
+
refresh: Schema4.optionalKey(Schema4.String),
|
|
1729
|
+
resize: Schema4.optionalKey(Schema4.String)
|
|
1730
|
+
}).annotate({ identifier: "DataTableLabels" });
|
|
1731
|
+
var DataTableViewSchema = Schema4.Literals(["table", "gallery"]);
|
|
1732
|
+
var DataTablePreferencesSchema = Schema4.Struct({
|
|
1733
|
+
columnVisibility: Schema4.Record(Schema4.String, Schema4.Boolean),
|
|
1734
|
+
columnSizing: Schema4.Record(Schema4.String, Schema4.Finite),
|
|
1735
|
+
grouping: Schema4.optionalKey(Schema4.Array(Schema4.String)),
|
|
1736
|
+
view: DataTableViewSchema
|
|
1737
|
+
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
1738
|
+
var GroupField = Schema4.Struct({
|
|
1739
|
+
id: Schema4.NonEmptyString,
|
|
1740
|
+
label: Schema4.String,
|
|
1741
|
+
actionsLabel: Schema4.optionalKey(Schema4.String),
|
|
1742
|
+
groups: Schema4.optionalKey(Schema4.Array(Schema4.Struct({
|
|
1743
|
+
id: Schema4.String,
|
|
1744
|
+
label: Schema4.String,
|
|
1745
|
+
empty: Schema4.optionalKey(Schema4.String)
|
|
1746
|
+
}).annotate({ identifier: "DataTableGroupLabel" }))),
|
|
1747
|
+
actions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
1748
|
+
movable: Schema4.optionalKey(Schema4.Boolean)
|
|
1749
|
+
}).annotate({ identifier: "DataTableGroupField" });
|
|
1750
|
+
var DataTablePropsSchema = Schema4.Struct({
|
|
1751
|
+
...DataTableCommonPropsSchema.fields,
|
|
1752
|
+
label: Schema4.String,
|
|
1753
|
+
rowData: Schema4.Array(DataTableRowSchema),
|
|
1754
|
+
rowActivation: Schema4.optionalKey(Schema4.Boolean),
|
|
1755
|
+
columnDefs: Schema4.Array(DataTableColumnSchema),
|
|
1756
|
+
status: Schema4.optionalKey(Schema4.Struct({
|
|
1757
|
+
loading: Schema4.optionalKey(Schema4.Boolean),
|
|
1758
|
+
empty: Schema4.optionalKey(Schema4.String),
|
|
1759
|
+
error: Schema4.optionalKey(Schema4.String)
|
|
1760
|
+
})),
|
|
1761
|
+
sort: Schema4.optionalKey(Schema4.Array(DataTableSortSchema)),
|
|
1762
|
+
sortMode: Schema4.optionalKey(Schema4.Literals(["client", "server"])),
|
|
1763
|
+
search: Schema4.optionalKey(Schema4.Boolean),
|
|
1764
|
+
columnFilters: Schema4.optionalKey(Schema4.Boolean),
|
|
1765
|
+
state: Schema4.optionalKey(DataTableQuerySchema),
|
|
1766
|
+
features: Schema4.optionalKey(Schema4.Struct({
|
|
1767
|
+
...DataTableCommonFeaturesSchema.fields,
|
|
1768
|
+
pagination: Schema4.optionalKey(Schema4.Union([Schema4.Literal(false), PaginationSchema])),
|
|
1769
|
+
grouping: Schema4.optionalKey(Schema4.Struct({
|
|
1770
|
+
initial: Schema4.optionalKey(Schema4.Array(Schema4.String)),
|
|
1771
|
+
fields: Schema4.Array(GroupField)
|
|
1772
|
+
}).annotate({ identifier: "DataTableGrouping" })),
|
|
1773
|
+
gallery: Schema4.optionalKey(Schema4.Struct({
|
|
1774
|
+
name: Schema4.String,
|
|
1775
|
+
description: Schema4.optionalKey(Schema4.String),
|
|
1776
|
+
image: Schema4.optionalKey(Schema4.String),
|
|
1777
|
+
tags: Schema4.optionalKey(Schema4.Array(Schema4.String))
|
|
1778
|
+
}).annotate({ identifier: "DataTableGallery" })),
|
|
1779
|
+
reordering: Schema4.optionalKey(Schema4.Boolean),
|
|
1780
|
+
export: Schema4.optionalKey(Schema4.Struct({
|
|
1781
|
+
baseName: Schema4.String,
|
|
1782
|
+
scope: Schema4.optionalKey(Schema4.Literals(["filteredRows", "currentPage"])),
|
|
1783
|
+
builtIn: Schema4.optionalKey(Schema4.Boolean),
|
|
1784
|
+
actions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema)),
|
|
1785
|
+
pending: Schema4.optionalKey(Schema4.Boolean),
|
|
1786
|
+
failed: Schema4.optionalKey(Schema4.Boolean)
|
|
1787
|
+
}).annotate({ identifier: "DataTableExport" })),
|
|
1788
|
+
refresh: Schema4.optionalKey(Schema4.Boolean),
|
|
1789
|
+
virtualization: Schema4.optionalKey(Schema4.Union([
|
|
1790
|
+
Schema4.Boolean,
|
|
1791
|
+
Schema4.Struct({
|
|
1792
|
+
scroll: Schema4.optionalKey(Schema4.Literals(["table", "internal", "page"])),
|
|
1793
|
+
height: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThan(0))),
|
|
1794
|
+
estimateRowHeight: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThan(0))),
|
|
1795
|
+
overscan: Schema4.optionalKey(Schema4.Int.check(Schema4.isGreaterThanOrEqualTo(0)))
|
|
1796
|
+
}).annotate({ identifier: "DataTableVirtualization" })
|
|
1797
|
+
]))
|
|
1798
|
+
}).annotate({ identifier: "DataTableHtmlFeatures" })),
|
|
1799
|
+
initialState: Schema4.optionalKey(Schema4.Struct({
|
|
1800
|
+
...queryFields,
|
|
1801
|
+
page: Schema4.optional(queryFields.page),
|
|
1802
|
+
pageSize: Schema4.optional(queryFields.pageSize),
|
|
1803
|
+
columnVisibility: Schema4.optionalKey(Schema4.Record(Schema4.String, Schema4.Boolean)),
|
|
1804
|
+
view: Schema4.optionalKey(DataTableViewSchema)
|
|
1805
|
+
}).annotate({ identifier: "DataTableInitialQuery" })),
|
|
1806
|
+
pagination: Schema4.optionalKey(PaginationSchema),
|
|
1807
|
+
selection: Schema4.optionalKey(Schema4.Struct({
|
|
1808
|
+
selectedRowIds: Schema4.optionalKey(Schema4.Array(Schema4.String)),
|
|
1809
|
+
bulkActionsLabel: Schema4.optionalKey(Schema4.String),
|
|
1810
|
+
bulkActions: Schema4.optionalKey(Schema4.Array(DataTableActionSchema))
|
|
1811
|
+
})),
|
|
1812
|
+
messages: Schema4.optionalKey(Schema4.Record(Schema4.String, DataTableLabelsSchema))
|
|
1813
|
+
}).annotate({ identifier: "DataTableProps" });
|
|
1814
|
+
var DataTableFilterDraftSchema = Schema4.Struct({
|
|
1815
|
+
id: Schema4.String,
|
|
1816
|
+
primary: Schema4.String,
|
|
1817
|
+
secondary: Schema4.String,
|
|
1818
|
+
operator: TextFilterOperator,
|
|
1819
|
+
values: Schema4.Array(Schema4.String)
|
|
1820
|
+
}).annotate({ identifier: "DataTableFilterDraft" });
|
|
1821
|
+
|
|
1822
|
+
// ../../src/components/data-table/index.ts
|
|
1823
|
+
var defaultMessages = {
|
|
1824
|
+
en: {
|
|
1825
|
+
actions: "Actions",
|
|
1826
|
+
addItem: "Add item...",
|
|
1827
|
+
listDetails: "View all items",
|
|
1828
|
+
empty: "No results.",
|
|
1829
|
+
filters: "Filters",
|
|
1830
|
+
filtersClear: "Clear all filters",
|
|
1831
|
+
filterColumn: "Column",
|
|
1832
|
+
filterClear: "Clear filter",
|
|
1833
|
+
filterApply: "Apply filter",
|
|
1834
|
+
filterValue: "Value",
|
|
1835
|
+
filterOperator: "Operator",
|
|
1836
|
+
filterContains: "Contains",
|
|
1837
|
+
filterEquals: "Equals",
|
|
1838
|
+
filterStartsWith: "Starts with",
|
|
1839
|
+
filterEndsWith: "Ends with",
|
|
1840
|
+
filterMin: "Minimum",
|
|
1841
|
+
filterMax: "Maximum",
|
|
1842
|
+
filterFrom: "From (UTC)",
|
|
1843
|
+
filterTo: "To (UTC)",
|
|
1844
|
+
filterTrue: "True",
|
|
1845
|
+
filterFalse: "False",
|
|
1846
|
+
filterInvalid: "Enter a valid filter. Ranges must be in ascending order.",
|
|
1847
|
+
columns: "Columns",
|
|
1848
|
+
sortBy: "Sort by",
|
|
1849
|
+
hideColumn: "Hide column",
|
|
1850
|
+
loading: "Loading...",
|
|
1851
|
+
removeItem: "Remove",
|
|
1852
|
+
search: "Search",
|
|
1853
|
+
selectAllRows: "Select all rows on this page",
|
|
1854
|
+
selectRow: "Select row",
|
|
1855
|
+
selected: "Selected",
|
|
1856
|
+
sortAsc: "Ascending",
|
|
1857
|
+
sortDesc: "Descending",
|
|
1858
|
+
sortClear: "Clear sorting",
|
|
1859
|
+
view: "View",
|
|
1860
|
+
tableView: "Table",
|
|
1861
|
+
galleryView: "Gallery",
|
|
1862
|
+
groupBy: "Group by",
|
|
1863
|
+
export: "Export",
|
|
1864
|
+
exportFailed: "Export failed. Please try again.",
|
|
1865
|
+
refresh: "Refresh",
|
|
1866
|
+
moveUp: "Move up",
|
|
1867
|
+
moveDown: "Move down",
|
|
1868
|
+
reorder: "Drag to reorder",
|
|
1869
|
+
resize: "Resize column"
|
|
1870
|
+
},
|
|
1871
|
+
fr: {
|
|
1872
|
+
actions: "Actions",
|
|
1873
|
+
addItem: "Ajouter un élément...",
|
|
1874
|
+
listDetails: "Afficher tous les éléments",
|
|
1875
|
+
empty: "Aucun résultat.",
|
|
1876
|
+
filters: "Filtres",
|
|
1877
|
+
filtersClear: "Effacer tous les filtres",
|
|
1878
|
+
filterColumn: "Colonne",
|
|
1879
|
+
filterClear: "Effacer le filtre",
|
|
1880
|
+
filterApply: "Appliquer le filtre",
|
|
1881
|
+
filterValue: "Valeur",
|
|
1882
|
+
filterOperator: "Opérateur",
|
|
1883
|
+
filterContains: "Contient",
|
|
1884
|
+
filterEquals: "Égal à",
|
|
1885
|
+
filterStartsWith: "Commence par",
|
|
1886
|
+
filterEndsWith: "Se termine par",
|
|
1887
|
+
filterMin: "Minimum",
|
|
1888
|
+
filterMax: "Maximum",
|
|
1889
|
+
filterFrom: "Du (UTC)",
|
|
1890
|
+
filterTo: "Au (UTC)",
|
|
1891
|
+
filterTrue: "Vrai",
|
|
1892
|
+
filterFalse: "Faux",
|
|
1893
|
+
filterInvalid: "Saisissez un filtre valide. Les bornes doivent être dans l’ordre croissant.",
|
|
1894
|
+
columns: "Colonnes",
|
|
1895
|
+
sortBy: "Trier par",
|
|
1896
|
+
hideColumn: "Masquer la colonne",
|
|
1897
|
+
loading: "Chargement...",
|
|
1898
|
+
removeItem: "Retirer",
|
|
1899
|
+
search: "Rechercher",
|
|
1900
|
+
selectAllRows: "Sélectionner toutes les lignes de cette page",
|
|
1901
|
+
selectRow: "Sélectionner la ligne",
|
|
1902
|
+
selected: "Sélectionnés",
|
|
1903
|
+
sortAsc: "Croissant",
|
|
1904
|
+
sortDesc: "Décroissant",
|
|
1905
|
+
sortClear: "Effacer le tri",
|
|
1906
|
+
view: "Affichage",
|
|
1907
|
+
tableView: "Tableau",
|
|
1908
|
+
galleryView: "Galerie",
|
|
1909
|
+
groupBy: "Grouper par",
|
|
1910
|
+
export: "Exporter",
|
|
1911
|
+
exportFailed: "L’exportation a échoué. Veuillez réessayer.",
|
|
1912
|
+
refresh: "Rafraîchir",
|
|
1913
|
+
moveUp: "Déplacer vers le haut",
|
|
1914
|
+
moveDown: "Déplacer vers le bas",
|
|
1915
|
+
reorder: "Glisser pour réorganiser",
|
|
1916
|
+
resize: "Redimensionner la colonne"
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
var compareTableText = (left, right, locale) => left.localeCompare(right, locale, { numeric: true, sensitivity: "base" });
|
|
1920
|
+
var isTableText = Schema5.is(Schema5.String);
|
|
1921
|
+
var isTableNumber = Schema5.is(Schema5.Finite);
|
|
1922
|
+
var isTableBoolean = Schema5.is(Schema5.Boolean);
|
|
1923
|
+
var isTableReference = Schema5.is(DataTableReferenceSchema);
|
|
1924
|
+
var isTableList = Schema5.is(Schema5.Array(DataTableItemSchema));
|
|
1925
|
+
var tableInitials = (label) => label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
1926
|
+
var formatNumberValue = (value, options, defaultLocale = "en") => {
|
|
1927
|
+
const { locale, ...format } = options ?? {};
|
|
1928
|
+
return new Intl.NumberFormat(locale ?? defaultLocale, format).format(value);
|
|
1929
|
+
};
|
|
1930
|
+
var tableBooleanLabel = (value, options) => (value ? options?.trueLabel : options?.falseLabel) ?? String(value);
|
|
1931
|
+
var decodeDateInput = Schema5.decodeUnknownOption(DataTableDateInputSchema);
|
|
1932
|
+
var resolveDate = (value, type) => Option3.getOrUndefined(Option3.flatMap(decodeDateInput(value), (input) => {
|
|
1933
|
+
const calendarOnly = isCalendarDate(input);
|
|
1934
|
+
if (calendarOnly && type === "dateTime")
|
|
1935
|
+
return Option3.none();
|
|
1936
|
+
return Option3.map(DateTime3.make(input), (instant) => ({
|
|
1937
|
+
instant,
|
|
1938
|
+
calendarOnly
|
|
1939
|
+
}));
|
|
1940
|
+
}));
|
|
1941
|
+
var formatDateValue = (date, column, locale = "en") => DateTime3.format(date.instant, {
|
|
1942
|
+
locale: column.typeOptions?.locale ?? locale,
|
|
1943
|
+
timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
|
|
1944
|
+
dateStyle: column.typeOptions?.dateStyle ?? "medium",
|
|
1945
|
+
timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
|
|
1946
|
+
hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
|
|
1947
|
+
});
|
|
1948
|
+
var dateIsoValue = (date) => date.calendarOnly ? DateTime3.formatIsoDateUtc(date.instant) : DateTime3.formatIso(date.instant);
|
|
1949
|
+
var matchesDateFilter = (date, filter) => {
|
|
1950
|
+
if (!date)
|
|
1951
|
+
return false;
|
|
1952
|
+
const day = DateTime3.formatIsoDateUtc(date.instant);
|
|
1953
|
+
return (filter.from === undefined || day >= filter.from) && (filter.to === undefined || day <= filter.to);
|
|
1954
|
+
};
|
|
1955
|
+
var matchesFilterText = (value, filter) => {
|
|
1956
|
+
const text = value.toLocaleLowerCase();
|
|
1957
|
+
const query = filter.value.toLocaleLowerCase();
|
|
1958
|
+
switch (filter.operator) {
|
|
1959
|
+
case "contains":
|
|
1960
|
+
return text.includes(query);
|
|
1961
|
+
case "equals":
|
|
1962
|
+
return text === query;
|
|
1963
|
+
case "startsWith":
|
|
1964
|
+
return text.startsWith(query);
|
|
1965
|
+
case "endsWith":
|
|
1966
|
+
return text.endsWith(query);
|
|
1967
|
+
}
|
|
1968
|
+
};
|
|
1969
|
+
var tableFilterKind = (column, hasOptions = false) => hasOptions || column.type === "list" ? "values" : column.type === "reference" ? "text" : column.type === "dateTime" ? "date" : column.type ?? "text";
|
|
1970
|
+
var matchesTableFilter = (filter, value, type, text, values) => {
|
|
1971
|
+
switch (filter.kind) {
|
|
1972
|
+
case "text":
|
|
1973
|
+
return matchesFilterText(text(), filter);
|
|
1974
|
+
case "number":
|
|
1975
|
+
return isTableNumber(value) && (filter.min === undefined || value >= filter.min) && (filter.max === undefined || value <= filter.max);
|
|
1976
|
+
case "boolean":
|
|
1977
|
+
return value === filter.value;
|
|
1978
|
+
case "values":
|
|
1979
|
+
return values().some((value) => filter.values.includes(value));
|
|
1980
|
+
case "date":
|
|
1981
|
+
return matchesDateFilter(resolveDate(value, type === "dateTime" ? "dateTime" : "date"), filter);
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
var tableDataColumns = (columns) => columns.flatMap((column) => column.fields?.length ? column.fields.map((field) => ({
|
|
1985
|
+
...field,
|
|
1986
|
+
id: `${column.id}.${field.id}`,
|
|
1987
|
+
headerName: `${column.headerName} / ${field.headerName}`,
|
|
1988
|
+
sortable: column.sortable === false ? false : field.sortable,
|
|
1989
|
+
searchable: column.searchable === false ? false : field.searchable,
|
|
1990
|
+
filterable: column.filterable === false ? false : field.filterable,
|
|
1991
|
+
export: column.export === false ? false : field.export
|
|
1992
|
+
})) : [column]);
|
|
1993
|
+
var filterTableColumns = (rows, columns, filters) => {
|
|
1994
|
+
const byId = new Map(columns.filter(({ filterable }) => filterable !== false).map((column) => [column.id, column]));
|
|
1995
|
+
const active = filters.filter((filter) => {
|
|
1996
|
+
const column = byId.get(filter.id);
|
|
1997
|
+
return column && tableFilterKind(column) === filter.kind;
|
|
1998
|
+
});
|
|
1999
|
+
if (!active.length)
|
|
2000
|
+
return rows;
|
|
2001
|
+
return rows.filter((row) => active.every((filter) => {
|
|
2002
|
+
const value = row.cells[filter.id];
|
|
2003
|
+
return matchesTableFilter(filter, value, byId.get(filter.id)?.type, () => isTableText(value) ? value : isTableReference(value) ? `${value.label} ${value.description ?? ""}`.trim() : "", () => isTableList(value) ? value.map(({ value }) => value) : []);
|
|
2004
|
+
}));
|
|
2005
|
+
};
|
|
2006
|
+
var columnValue = (column, value) => {
|
|
2007
|
+
switch (column.type) {
|
|
2008
|
+
case "text":
|
|
2009
|
+
return isTableText(value) ? value : null;
|
|
2010
|
+
case "number":
|
|
2011
|
+
case "boolean":
|
|
2012
|
+
case "date":
|
|
2013
|
+
case "dateTime":
|
|
2014
|
+
return tableSortScalar(column.type, value);
|
|
2015
|
+
case "reference":
|
|
2016
|
+
return isTableReference(value) ? value.label : null;
|
|
2017
|
+
case "list":
|
|
2018
|
+
return isTableList(value) ? value.map(({ label }) => label).join(", ") : null;
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
var tableSortScalar = (type, value) => {
|
|
2022
|
+
if (type === "number")
|
|
2023
|
+
return isTableNumber(value) ? value : null;
|
|
2024
|
+
if (type === "boolean")
|
|
2025
|
+
return isTableBoolean(value) ? Number(value) : null;
|
|
2026
|
+
const date = resolveDate(value, type);
|
|
2027
|
+
return date ? DateTime3.toEpochMillis(date.instant) : null;
|
|
2028
|
+
};
|
|
2029
|
+
var compareTableSortValues = (left, right, direction, nulls, locale) => {
|
|
2030
|
+
if (left === right)
|
|
2031
|
+
return 0;
|
|
2032
|
+
const nullOrder = nulls === "first" ? -1 : 1;
|
|
2033
|
+
if (left === null)
|
|
2034
|
+
return nullOrder;
|
|
2035
|
+
if (right === null)
|
|
2036
|
+
return -nullOrder;
|
|
2037
|
+
const comparison = isTableNumber(left) && isTableNumber(right) ? left - right : compareTableText(String(left), String(right), locale);
|
|
2038
|
+
return direction === "asc" ? comparison : -comparison;
|
|
2039
|
+
};
|
|
2040
|
+
var sortTableRows = (rows, columns, sort, locale) => {
|
|
2041
|
+
const byId = new Map(columns.map((column) => [column.id, column]));
|
|
2042
|
+
return rows.slice().sort((leftRow, rightRow) => {
|
|
2043
|
+
for (const { id, direction } of sort) {
|
|
2044
|
+
const column = byId.get(id);
|
|
2045
|
+
if (!column || column.sortable === false)
|
|
2046
|
+
continue;
|
|
2047
|
+
const left = columnValue(column, leftRow.cells[id]);
|
|
2048
|
+
const right = columnValue(column, rightRow.cells[id]);
|
|
2049
|
+
const comparison = compareTableSortValues(left, right, direction, column.nulls, locale);
|
|
2050
|
+
if (comparison !== 0)
|
|
2051
|
+
return comparison;
|
|
2052
|
+
}
|
|
2053
|
+
return 0;
|
|
2054
|
+
});
|
|
2055
|
+
};
|
|
2056
|
+
var filterTableRows = (rows, columns, search, locale) => {
|
|
2057
|
+
const query = search.trim().toLocaleLowerCase(locale);
|
|
2058
|
+
if (!query)
|
|
2059
|
+
return rows;
|
|
2060
|
+
const searchable = columns.filter(({ searchable }) => searchable !== false);
|
|
2061
|
+
return rows.filter((row) => searchable.some((column) => {
|
|
2062
|
+
const value = row.cells[column.id];
|
|
2063
|
+
if (column.type === "date" || column.type === "dateTime") {
|
|
2064
|
+
const date = resolveDate(value, column.type);
|
|
2065
|
+
return !!date && `${formatDateValue(date, column, locale)} ${dateIsoValue(date)}`.toLocaleLowerCase(locale).includes(query);
|
|
2066
|
+
}
|
|
2067
|
+
const text = column.type === "reference" && isTableReference(value) ? `${value.label} ${value.description ?? ""}` : column.type === "number" && isTableNumber(value) ? `${formatNumberValue(value, column.typeOptions, locale)} ${value}` : column.type === "boolean" && isTableBoolean(value) ? `${tableBooleanLabel(value, column.typeOptions)} ${value}` : String(columnValue(column, value) ?? "");
|
|
2068
|
+
return text.toLocaleLowerCase(locale).includes(query);
|
|
2069
|
+
}));
|
|
2070
|
+
};
|
|
2071
|
+
var updateSelectedRows = (selected, targets, checked) => {
|
|
2072
|
+
const next = new Set(selected);
|
|
2073
|
+
for (const id of targets) {
|
|
2074
|
+
if (checked)
|
|
2075
|
+
next.add(id);
|
|
2076
|
+
else
|
|
2077
|
+
next.delete(id);
|
|
2078
|
+
}
|
|
2079
|
+
return Array.from(next);
|
|
2080
|
+
};
|
|
2081
|
+
var resolveTablePage = (rowCount, query) => {
|
|
2082
|
+
const pageSize = Math.max(1, query.pageSize);
|
|
2083
|
+
const pageCount = Math.max(1, Math.ceil(rowCount / pageSize));
|
|
2084
|
+
const page = Math.min(pageCount - 1, Math.max(0, query.page));
|
|
2085
|
+
const start = page * pageSize;
|
|
2086
|
+
return { page, pageCount, start, end: start + pageSize };
|
|
2087
|
+
};
|
|
2088
|
+
var edit = UiSchema2.TaggedEnum({
|
|
2089
|
+
SetBoolean: { value: Schema5.Boolean },
|
|
2090
|
+
AddItem: { itemId: Schema5.String },
|
|
2091
|
+
RemoveItem: { itemId: Schema5.String }
|
|
2092
|
+
}).annotate({ identifier: "DataTableEdit" });
|
|
2093
|
+
var eventFields = {
|
|
2094
|
+
RowActivated: { rowId: Schema5.String },
|
|
2095
|
+
ItemActionRequested: {
|
|
2096
|
+
rowId: Schema5.String,
|
|
2097
|
+
columnId: Schema5.String,
|
|
2098
|
+
itemId: Schema5.String,
|
|
2099
|
+
actionId: Schema5.String
|
|
2100
|
+
},
|
|
2101
|
+
RefreshRequested: {},
|
|
2102
|
+
ExportRequested: { actionId: Schema5.String },
|
|
2103
|
+
GroupActionRequested: {
|
|
2104
|
+
fieldId: Schema5.String,
|
|
2105
|
+
groupId: Schema5.String,
|
|
2106
|
+
actionId: Schema5.String
|
|
2107
|
+
},
|
|
2108
|
+
GroupMoveRequested: {
|
|
2109
|
+
rowId: Schema5.String,
|
|
2110
|
+
fieldId: Schema5.String,
|
|
2111
|
+
groupId: Schema5.String
|
|
2112
|
+
},
|
|
2113
|
+
RowsReordered: { rowIds: Schema5.Array(Schema5.String) },
|
|
2114
|
+
StateChanged: { state: DataTableQuerySchema },
|
|
2115
|
+
SortChanged: { sort: Schema5.Array(DataTableSortSchema) },
|
|
2116
|
+
SelectionChanged: { selectedRowIds: Schema5.Array(Schema5.String) },
|
|
2117
|
+
CellEditRequested: { rowId: Schema5.String, columnId: Schema5.String, edit },
|
|
2118
|
+
RowActionRequested: { rowId: Schema5.String, actionId: Schema5.String },
|
|
2119
|
+
BulkActionRequested: {
|
|
2120
|
+
rowIds: Schema5.Array(Schema5.String),
|
|
2121
|
+
actionId: Schema5.String
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
var DataTableEvents = UiSchema2.TaggedEnum(eventFields).annotate({
|
|
2125
|
+
identifier: "DataTableEvents"
|
|
2126
|
+
});
|
|
2127
|
+
var DataTableMessage = UiSchema2.TaggedEnum({
|
|
2128
|
+
ReferenceImageFailed: { src: Schema5.String },
|
|
2129
|
+
RowActivated: eventFields.RowActivated,
|
|
2130
|
+
PreferencesLoaded: { preferences: Schema5.NullOr(DataTablePreferencesSchema) },
|
|
2131
|
+
ItemActionRequested: eventFields.ItemActionRequested,
|
|
2132
|
+
BuiltInExportRequested: {
|
|
2133
|
+
format: Schema5.Literals(["csv", "json"]),
|
|
2134
|
+
locale: Schema5.optionalKey(Schema5.String)
|
|
2135
|
+
},
|
|
2136
|
+
ExportStarted: {},
|
|
2137
|
+
ExportFinished: { failed: Schema5.Boolean },
|
|
2138
|
+
RefreshRequested: {},
|
|
2139
|
+
ExportRequested: eventFields.ExportRequested,
|
|
2140
|
+
GroupActionRequested: eventFields.GroupActionRequested,
|
|
2141
|
+
GroupMoveRequested: eventFields.GroupMoveRequested,
|
|
2142
|
+
ReorderRequested: {
|
|
2143
|
+
rowId: Schema5.String,
|
|
2144
|
+
targetId: Schema5.String,
|
|
2145
|
+
after: Schema5.Boolean
|
|
2146
|
+
},
|
|
2147
|
+
DragStarted: { rowId: Schema5.String },
|
|
2148
|
+
DragEnded: {},
|
|
2149
|
+
DragDropped: { targetId: Schema5.String },
|
|
2150
|
+
GroupDropped: { fieldId: Schema5.String, groupId: Schema5.String },
|
|
2151
|
+
ViewPicked: { view: DataTableViewSchema },
|
|
2152
|
+
GroupingToggled: { fieldId: Schema5.String },
|
|
2153
|
+
GroupToggled: { key: Schema5.String },
|
|
2154
|
+
ColumnResized: { id: Schema5.String, delta: Schema5.Finite },
|
|
2155
|
+
ColumnResizeReset: { id: Schema5.String },
|
|
2156
|
+
ResizeStarted: { id: Schema5.String, x: Schema5.Finite, pointerId: Schema5.Int },
|
|
2157
|
+
ResizeMoved: { x: Schema5.Finite, pointerId: Schema5.Int },
|
|
2158
|
+
ResizeEnded: { pointerId: Schema5.Int },
|
|
2159
|
+
ColumnFiltersCleared: { id: Schema5.String },
|
|
2160
|
+
ColumnSortCleared: { id: Schema5.String },
|
|
2161
|
+
CellEditRequested: eventFields.CellEditRequested,
|
|
2162
|
+
RowActionRequested: eventFields.RowActionRequested,
|
|
2163
|
+
MenuOpened: { key: Schema5.String },
|
|
2164
|
+
MenuClosed: { key: Schema5.String },
|
|
2165
|
+
MenuQueryChanged: { key: Schema5.String, query: Schema5.String },
|
|
2166
|
+
SubmenuOpened: {
|
|
2167
|
+
key: Schema5.String,
|
|
2168
|
+
filterColumnId: Schema5.optionalKey(Schema5.String)
|
|
2169
|
+
},
|
|
2170
|
+
SubmenuClosed: { key: Schema5.String },
|
|
2171
|
+
SearchChanged: { value: Schema5.String },
|
|
2172
|
+
FilterInputChanged: {
|
|
2173
|
+
field: Schema5.Literals(["primary", "secondary"]),
|
|
2174
|
+
value: Schema5.String
|
|
2175
|
+
},
|
|
2176
|
+
FilterOperatorChanged: { operator: TextFilterOperator },
|
|
2177
|
+
FilterValueToggled: { value: Schema5.String, checked: Schema5.Boolean },
|
|
2178
|
+
FilterApplied: {},
|
|
2179
|
+
ColumnFilterChanged: {
|
|
2180
|
+
id: Schema5.String,
|
|
2181
|
+
filter: Schema5.NullOr(ColumnFilter)
|
|
2182
|
+
},
|
|
2183
|
+
FilterCleared: {},
|
|
2184
|
+
FiltersCleared: {},
|
|
2185
|
+
PageRequested: { page: Schema5.Int },
|
|
2186
|
+
ServerPageInvalidated: {},
|
|
2187
|
+
PageSizeRequested: { pageSize: Schema5.Int },
|
|
2188
|
+
SortRequested: {
|
|
2189
|
+
columnId: Schema5.String,
|
|
2190
|
+
direction: Schema5.NullOr(DataTableSortSchema.fields.direction)
|
|
2191
|
+
},
|
|
2192
|
+
ColumnVisibilityChanged: { id: Schema5.String, visible: Schema5.Boolean },
|
|
2193
|
+
SelectionRequested: {
|
|
2194
|
+
rowIds: Schema5.Array(Schema5.String),
|
|
2195
|
+
checked: Schema5.Boolean
|
|
2196
|
+
},
|
|
2197
|
+
BulkActionRequested: { actionId: Schema5.String }
|
|
2198
|
+
}).annotate({ identifier: "DataTableMessage" });
|
|
2199
|
+
var dataTableOptions = {
|
|
2200
|
+
name: "DataTable",
|
|
2201
|
+
props: DataTablePropsSchema,
|
|
2202
|
+
model: Schema5.Struct({
|
|
2203
|
+
menu: Schema5.NullOr(Schema5.String),
|
|
2204
|
+
submenu: Schema5.NullOr(Schema5.String),
|
|
2205
|
+
menuQuery: Schema5.String,
|
|
2206
|
+
failedImages: Schema5.Array(Schema5.String),
|
|
2207
|
+
selectedRowIds: Schema5.Array(Schema5.String),
|
|
2208
|
+
query: DataTableQuerySchema,
|
|
2209
|
+
preferencesLoaded: Schema5.Boolean,
|
|
2210
|
+
columnVisibility: Schema5.Record(Schema5.String, Schema5.Boolean),
|
|
2211
|
+
columnSizing: Schema5.Record(Schema5.String, Schema5.Finite),
|
|
2212
|
+
view: DataTableViewSchema,
|
|
2213
|
+
grouping: Schema5.Array(Schema5.String),
|
|
2214
|
+
collapsedGroups: Schema5.Record(Schema5.String, Schema5.Boolean),
|
|
2215
|
+
dragging: Schema5.NullOr(Schema5.String),
|
|
2216
|
+
exporting: Schema5.Boolean,
|
|
2217
|
+
exportFailed: Schema5.Boolean,
|
|
2218
|
+
resizing: Schema5.NullOr(Schema5.Struct({
|
|
2219
|
+
id: Schema5.String,
|
|
2220
|
+
x: Schema5.Finite,
|
|
2221
|
+
width: Schema5.Finite,
|
|
2222
|
+
pointerId: Schema5.Int
|
|
2223
|
+
}).annotate({ identifier: "DataTableResizeSession" })),
|
|
2224
|
+
filterDraft: Schema5.NullOr(DataTableFilterDraftSchema),
|
|
2225
|
+
invalidFilter: Schema5.Boolean
|
|
2226
|
+
}).annotate({ identifier: "DataTableModel" }),
|
|
2227
|
+
message: DataTableMessage,
|
|
2228
|
+
events: DataTableEvents,
|
|
2229
|
+
restore: false
|
|
2230
|
+
};
|
|
2231
|
+
var available = (props) => props.status?.error === undefined && (!props.status?.loading || props.rowData.length > 0);
|
|
2232
|
+
var tableQuery = (props, model) => props.state ?? { ...model.query, sort: props.sort ?? model.query.sort };
|
|
2233
|
+
var tableFeatures = (props) => ({
|
|
2234
|
+
...props.features,
|
|
2235
|
+
search: props.features?.search ?? props.search ?? true,
|
|
2236
|
+
filtering: props.features?.filtering ?? props.columnFilters ?? true,
|
|
2237
|
+
sorting: props.features?.sorting ?? true,
|
|
2238
|
+
columnVisibility: props.features?.columnVisibility ?? true,
|
|
2239
|
+
pagination: props.features?.pagination ?? props.pagination
|
|
2240
|
+
});
|
|
2241
|
+
var tableSelectedRowIds = (props, model) => {
|
|
2242
|
+
const supplied = new Set(props.rowData.map(({ id }) => id));
|
|
2243
|
+
return [
|
|
2244
|
+
...new Set(props.selection?.selectedRowIds ?? model.selectedRowIds)
|
|
2245
|
+
].filter((id) => supplied.has(id));
|
|
2246
|
+
};
|
|
2247
|
+
var serverPageCorrection = (props, model) => {
|
|
2248
|
+
const pagination = tableFeatures(props).pagination;
|
|
2249
|
+
if (!pagination || pagination.mode !== "server")
|
|
2250
|
+
return;
|
|
2251
|
+
const query = tableQuery(props, model);
|
|
2252
|
+
const { page } = resolveTablePage(pagination.rowCount, query);
|
|
2253
|
+
if (query.page !== page)
|
|
2254
|
+
return { requested: query.page, page, size: query.pageSize };
|
|
2255
|
+
};
|
|
2256
|
+
var tablePreferencesKey = (pathname, columns, gallery) => `data-table:${pathname}:${columns.join(",")}:${gallery ? "gallery" : "table"}:ui`;
|
|
2257
|
+
var preferencesJson = Schema5.fromJsonString(DataTablePreferencesSchema);
|
|
2258
|
+
var decodePreferences = Schema5.decodeUnknownOption(preferencesJson);
|
|
2259
|
+
var encodePreferences = Schema5.encodeSync(preferencesJson);
|
|
2260
|
+
var readTablePreferences = (key, host = globalThis.window) => {
|
|
2261
|
+
try {
|
|
2262
|
+
return Option3.getOrNull(decodePreferences(host?.localStorage.getItem(key)));
|
|
2263
|
+
} catch {
|
|
2264
|
+
return null;
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
var writeTablePreferences = (key, preferences, host = globalThis.window) => {
|
|
2268
|
+
try {
|
|
2269
|
+
host?.localStorage.setItem(key, encodePreferences(preferences));
|
|
2270
|
+
} catch {}
|
|
2271
|
+
};
|
|
2272
|
+
var tablePreferences = (model) => model.preferencesLoaded ? {
|
|
2273
|
+
columnVisibility: model.columnVisibility,
|
|
2274
|
+
columnSizing: model.columnSizing,
|
|
2275
|
+
grouping: model.grouping,
|
|
2276
|
+
view: model.view
|
|
2277
|
+
} : null;
|
|
2278
|
+
var tableColumnLimits = (column) => {
|
|
2279
|
+
const min = column.minWidth ?? 96;
|
|
2280
|
+
return { min, max: Math.max(min, column.maxWidth ?? 640) };
|
|
2281
|
+
};
|
|
2282
|
+
var clampTableWidth = (column, width = column.width ?? 208) => {
|
|
2283
|
+
const { min, max } = tableColumnLimits(column);
|
|
2284
|
+
return Math.min(max, Math.max(min, width));
|
|
2285
|
+
};
|
|
2286
|
+
var tableColumnWidth = (column, sizing) => clampTableWidth(column, sizing[column.id]);
|
|
2287
|
+
var tableLayoutWidth = (widths, utilityColumns) => widths.reduce((total, width) => total + width, utilityColumns * 40);
|
|
2288
|
+
var tableResizeStep = (key) => key === "ArrowLeft" ? -8 : key === "ArrowRight" ? 8 : 0;
|
|
2289
|
+
var activeTableGroups = (grouping, fields) => grouping.flatMap((id) => fields.find((field) => field.id === id) ?? []);
|
|
2290
|
+
var tableGrouping = (props, model) => activeTableGroups(model.grouping, props.features?.grouping?.fields ?? []);
|
|
2291
|
+
var canReorderTableRows = (props, model) => !!props.features?.reordering && !tableGrouping(props, model).length && !tableQuery(props, model).sort?.length;
|
|
2292
|
+
var partitionTableGroups = (rows, known, memberships) => {
|
|
2293
|
+
const groups = new Map(known.map((id) => [id, []]));
|
|
2294
|
+
for (const row of rows) {
|
|
2295
|
+
for (const id of new Set(memberships(row))) {
|
|
2296
|
+
const group = groups.get(id);
|
|
2297
|
+
if (group)
|
|
2298
|
+
group.push(row);
|
|
2299
|
+
else
|
|
2300
|
+
groups.set(id, [row]);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
return groups;
|
|
2304
|
+
};
|
|
2305
|
+
var tableGroupKey = (parent, fieldId, groupId) => `${parent ? `${parent}/` : ""}${encodeURIComponent(fieldId)}:${encodeURIComponent(groupId)}`;
|
|
2306
|
+
var reorderRows = ($, rowId, targetId, after) => {
|
|
2307
|
+
const rowIds = $.props.rowData.map(({ id }) => id);
|
|
2308
|
+
const next = $.evolve({ dragging: null });
|
|
2309
|
+
if (!available($.props) || !canReorderTableRows($.props, $.model) || rowId === targetId || !rowIds.includes(rowId) || !rowIds.includes(targetId))
|
|
2310
|
+
return next;
|
|
2311
|
+
const reordered = rowIds.filter((id) => id !== rowId);
|
|
2312
|
+
reordered.splice(reordered.indexOf(targetId) + Number(after), 0, rowId);
|
|
2313
|
+
return next.emit(DataTableEvents.RowsReordered({ rowIds: reordered }));
|
|
2314
|
+
};
|
|
2315
|
+
var moveGroup = ($, rowId, fieldId, groupId) => {
|
|
2316
|
+
const field = tableGrouping($.props, $.model).find(({ id }) => id === fieldId);
|
|
2317
|
+
const row = $.props.rowData.find(({ id }) => id === rowId);
|
|
2318
|
+
const next = $.evolve({ dragging: null });
|
|
2319
|
+
if (!available($.props) || !field?.movable || !row || row.groups?.[fieldId]?.includes(groupId))
|
|
2320
|
+
return next;
|
|
2321
|
+
if (!field.groups?.some(({ id }) => id === groupId) && !$.props.rowData.some((row) => row.groups?.[fieldId]?.includes(groupId)))
|
|
2322
|
+
return next;
|
|
2323
|
+
return next.emit(DataTableEvents.GroupMoveRequested({ rowId, fieldId, groupId }));
|
|
2324
|
+
};
|
|
2325
|
+
var changeQuery = ($, patch, ui = {}, legacy) => {
|
|
2326
|
+
const current = tableQuery($.props, $.model);
|
|
2327
|
+
const state = { ...current, ...patch };
|
|
2328
|
+
if (state.page === current.page && state.pageSize === current.pageSize && state.globalFilter === current.globalFilter && state.filters === current.filters && state.sort === current.sort)
|
|
2329
|
+
return $.evolve(ui);
|
|
2330
|
+
const step = $.evolve({
|
|
2331
|
+
...ui,
|
|
2332
|
+
query: $.props.state ? $.model.query : { ...state, sort: $.props.sort ? $.model.query.sort : state.sort }
|
|
2333
|
+
}).emit(DataTableEvents.StateChanged({ state }));
|
|
2334
|
+
return legacy ? step.emit(legacy) : step;
|
|
2335
|
+
};
|
|
2336
|
+
var tableFilterDraft = (id, current) => ({
|
|
2337
|
+
id,
|
|
2338
|
+
primary: current?.kind === "text" || current?.kind === "boolean" ? String(current.value) : current?.kind === "number" ? String(current.min ?? "") : current?.kind === "date" ? current.from ?? "" : "",
|
|
2339
|
+
secondary: current?.kind === "number" ? String(current.max ?? "") : current?.kind === "date" ? current.to ?? "" : "",
|
|
2340
|
+
operator: current?.kind === "text" ? current.operator : "contains",
|
|
2341
|
+
values: current?.kind === "values" ? current.values : []
|
|
2342
|
+
});
|
|
2343
|
+
var decodeFilter = Schema5.decodeUnknownOption(ColumnFilter);
|
|
2344
|
+
var decodeBound = Schema5.decodeOption(Schema5.FiniteFromString);
|
|
2345
|
+
var parseTableFilterDraft = (kind, {
|
|
2346
|
+
id,
|
|
2347
|
+
primary,
|
|
2348
|
+
secondary,
|
|
2349
|
+
operator,
|
|
2350
|
+
values
|
|
2351
|
+
}) => {
|
|
2352
|
+
switch (kind) {
|
|
2353
|
+
case "number": {
|
|
2354
|
+
const min = primary.trim() ? decodeBound(primary) : Option3.some(undefined);
|
|
2355
|
+
const max = secondary.trim() ? decodeBound(secondary) : Option3.some(undefined);
|
|
2356
|
+
return Option3.isNone(min) || Option3.isNone(max) ? Option3.none() : decodeFilter({ id, kind, min: min.value, max: max.value });
|
|
2357
|
+
}
|
|
2358
|
+
case "boolean":
|
|
2359
|
+
return decodeFilter({
|
|
2360
|
+
id,
|
|
2361
|
+
kind,
|
|
2362
|
+
value: primary === "true" ? true : primary === "false" ? false : undefined
|
|
2363
|
+
});
|
|
2364
|
+
case "values":
|
|
2365
|
+
return decodeFilter({ id, kind, values });
|
|
2366
|
+
case "date":
|
|
2367
|
+
return decodeFilter({
|
|
2368
|
+
id,
|
|
2369
|
+
kind,
|
|
2370
|
+
from: primary || undefined,
|
|
2371
|
+
to: secondary || undefined
|
|
2372
|
+
});
|
|
2373
|
+
case "text":
|
|
2374
|
+
return decodeFilter({ id, kind, operator, value: primary.trim() });
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
var changeColumnFilter = ($, id, filter, ui) => {
|
|
2378
|
+
const filters = (tableQuery($.props, $.model).filters ?? []).filter((current) => current.id !== id);
|
|
2379
|
+
if (filter)
|
|
2380
|
+
filters.push(filter);
|
|
2381
|
+
return changeQuery($, { filters: filters.length ? filters : undefined, page: 0 }, ui);
|
|
2382
|
+
};
|
|
2383
|
+
var projectDataTableRows = (source, query, {
|
|
2384
|
+
pagination,
|
|
2385
|
+
grouped,
|
|
2386
|
+
sortMode,
|
|
2387
|
+
search,
|
|
2388
|
+
filter,
|
|
2389
|
+
sort
|
|
2390
|
+
}) => {
|
|
2391
|
+
const server = pagination && pagination.mode === "server";
|
|
2392
|
+
const filtered = server ? source : filter(search(source, query.globalFilter ?? ""), query.filters ?? []);
|
|
2393
|
+
const ordered = !server && sortMode !== "server" && query.sort?.length ? sort(filtered, query.sort) : filtered;
|
|
2394
|
+
const { pageSize } = query;
|
|
2395
|
+
const totalRows = server ? pagination.rowCount : ordered.length;
|
|
2396
|
+
const { page, pageCount, start, end } = resolveTablePage(totalRows, query);
|
|
2397
|
+
const paginationVisible = !!pagination && (server || !grouped);
|
|
2398
|
+
const rows = paginationVisible && !server ? ordered.slice(start, end) : ordered;
|
|
2399
|
+
return {
|
|
2400
|
+
rows,
|
|
2401
|
+
filtered,
|
|
2402
|
+
ordered,
|
|
2403
|
+
pageSize,
|
|
2404
|
+
totalRows,
|
|
2405
|
+
pageCount,
|
|
2406
|
+
page,
|
|
2407
|
+
paginationVisible
|
|
2408
|
+
};
|
|
2409
|
+
};
|
|
2410
|
+
var dataTablePage = (props, model, locale) => {
|
|
2411
|
+
const pagination = tableFeatures(props).pagination;
|
|
2412
|
+
const columns = tableDataColumns(props.columnDefs);
|
|
2413
|
+
return {
|
|
2414
|
+
...projectDataTableRows(props.rowData, tableQuery(props, model), {
|
|
2415
|
+
pagination,
|
|
2416
|
+
grouped: tableGrouping(props, model).length > 0,
|
|
2417
|
+
sortMode: props.sortMode,
|
|
2418
|
+
search: (rows, value) => filterTableRows(rows, columns, value, locale),
|
|
2419
|
+
filter: (rows, filters) => filterTableColumns(rows, columns, filters),
|
|
2420
|
+
sort: (rows, sorting) => sortTableRows(rows, columns, sorting, locale)
|
|
2421
|
+
}),
|
|
2422
|
+
pageSizes: pagination && pagination.pageSizes || defaultPageSizes
|
|
2423
|
+
};
|
|
2424
|
+
};
|
|
2425
|
+
var encodeTableCsv = (headers, data) => Effect3.runSync(Stream.fromIterable([headers, ...data]).pipe(Stream.map((row) => row.map((value) => value == null ? "" : String(value))), Stream.pipeThroughChannel(Csv.encodeString({ newline: `
|
|
2426
|
+
` })), Stream.runCollect, Effect3.map((parts) => parts.join("").slice(0, -1))));
|
|
2427
|
+
var tableExportFilename = (name, extension) => name.includes(".") ? name.replace(/\.[^/.]+$/, `.${extension}`) : `${name}.${extension}`;
|
|
2428
|
+
var downloadTableBlob = (content, type, filename) => {
|
|
2429
|
+
const url = window.URL.createObjectURL(new Blob([content], { type }));
|
|
2430
|
+
const link = document.createElement("a");
|
|
2431
|
+
link.href = url;
|
|
2432
|
+
link.download = filename;
|
|
2433
|
+
document.body.appendChild(link);
|
|
2434
|
+
try {
|
|
2435
|
+
link.click();
|
|
2436
|
+
} finally {
|
|
2437
|
+
link.remove();
|
|
2438
|
+
requestAnimationFrame(() => window.URL.revokeObjectURL(url));
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
var tableExportValue = (column, row, locale) => {
|
|
2442
|
+
const value = row.cells[column.id];
|
|
2443
|
+
switch (column.type) {
|
|
2444
|
+
case "date":
|
|
2445
|
+
case "dateTime": {
|
|
2446
|
+
const date = resolveDate(value, column.type);
|
|
2447
|
+
return !date ? null : column.typeOptions?.exportFormat === "formatted" ? formatDateValue(date, column, locale) : dateIsoValue(date);
|
|
2448
|
+
}
|
|
2449
|
+
case "reference":
|
|
2450
|
+
return isTableReference(value) ? [value.label, value.description].filter(Boolean).join(" — ") : "";
|
|
2451
|
+
case "list":
|
|
2452
|
+
return isTableList(value) ? value.map(({ label }) => label).join(", ") : "";
|
|
2453
|
+
case "boolean":
|
|
2454
|
+
return !isTableBoolean(value) ? null : column.typeOptions?.exportFormat === "formatted" ? tableBooleanLabel(value, column.typeOptions) : value;
|
|
2455
|
+
case "number":
|
|
2456
|
+
return !isTableNumber(value) ? null : column.typeOptions?.exportFormat === "formatted" ? formatNumberValue(value, column.typeOptions, locale) : value;
|
|
2457
|
+
default:
|
|
2458
|
+
return columnValue(column, value);
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
var DownloadTable = Command.make("DataTable/Download", {
|
|
2462
|
+
args: {
|
|
2463
|
+
filename: Schema5.String,
|
|
2464
|
+
content: Schema5.Redacted(Schema5.String, { disallowJsonEncode: true }),
|
|
2465
|
+
type: Schema5.String
|
|
2466
|
+
}
|
|
2467
|
+
}, ({ filename, content, type }) => Effect3.try(() => downloadTableBlob(Redacted.value(content), type, filename)).pipe(Effect3.match({
|
|
2468
|
+
onSuccess: () => DataTableMessage.ExportFinished({ failed: false }),
|
|
2469
|
+
onFailure: () => DataTableMessage.ExportFinished({ failed: true })
|
|
2470
|
+
})));
|
|
2471
|
+
var update2 = Component2.define(dataTableOptions).update({
|
|
2472
|
+
ReferenceImageFailed: ($, { src }) => $.model.failedImages.includes(src) ? $.model : $.evolve({ failedImages: [...$.model.failedImages, src] }),
|
|
2473
|
+
RowActivated: ($, { rowId }) => $.props.rowActivation && available($.props) && $.props.rowData.some(({ id }) => id === rowId) ? $.emit(DataTableEvents.RowActivated({ rowId })) : $.model,
|
|
2474
|
+
PreferencesLoaded: ($, { preferences }) => $.model.preferencesLoaded ? $.model : $.evolve({
|
|
2475
|
+
preferencesLoaded: true,
|
|
2476
|
+
columnVisibility: {
|
|
2477
|
+
...$.model.columnVisibility,
|
|
2478
|
+
...preferences?.columnVisibility
|
|
2479
|
+
},
|
|
2480
|
+
columnSizing: preferences?.columnSizing ?? $.model.columnSizing,
|
|
2481
|
+
grouping: preferences?.grouping ?? $.model.grouping,
|
|
2482
|
+
view: $.props.features?.gallery ? preferences?.view ?? $.model.view : "table"
|
|
2483
|
+
}),
|
|
2484
|
+
ItemActionRequested: ($, request) => {
|
|
2485
|
+
const row = $.props.rowData.find(({ id }) => id === request.rowId);
|
|
2486
|
+
const column = $.props.columnDefs.find(({ id }) => id === request.columnId);
|
|
2487
|
+
const items = row?.cells[request.columnId];
|
|
2488
|
+
return available($.props) && column?.type === "list" && isTableList(items) && items.some(({ value }) => value === request.itemId) && column.itemActions?.some(({ id, disabled }) => id === request.actionId && !disabled) ? $.emit(DataTableEvents.ItemActionRequested(request)) : $.model;
|
|
2489
|
+
},
|
|
2490
|
+
ExportStarted: ($) => $.evolve({ exporting: true, exportFailed: false }),
|
|
2491
|
+
ExportFinished: ($, { failed }) => $.evolve({ exporting: false, exportFailed: failed }),
|
|
2492
|
+
BuiltInExportRequested: ($, { format, locale = $.props.locale ?? "en" }) => {
|
|
2493
|
+
const feature = $.props.features?.export;
|
|
2494
|
+
if (!feature || feature.pending || $.model.exporting || feature.builtIn === false || !available($.props))
|
|
2495
|
+
return $.model;
|
|
2496
|
+
const projection = dataTablePage($.props, $.model, locale);
|
|
2497
|
+
const rows = feature.scope === "currentPage" ? projection.rows : projection.ordered;
|
|
2498
|
+
if (!rows.length)
|
|
2499
|
+
return $.model;
|
|
2500
|
+
const columns = tableDataColumns($.props.columnDefs.filter(({ id, export: enabled }) => enabled !== false && $.model.columnVisibility[id] !== false)).filter(({ export: enabled }) => enabled !== false);
|
|
2501
|
+
const content = format === "csv" ? encodeTableCsv(columns.map(({ headerName }) => headerName), rows.map((row) => columns.map((column) => tableExportValue(column, row, locale)))) : JSON.stringify(rows.map((row) => Object.fromEntries(columns.map((column) => [
|
|
2502
|
+
column.id,
|
|
2503
|
+
tableExportValue(column, row, locale)
|
|
2504
|
+
]))), null, 2);
|
|
2505
|
+
return $.evolve({ menu: null, exporting: true, exportFailed: false }).run(DownloadTable.make({
|
|
2506
|
+
content: Redacted.make(content),
|
|
2507
|
+
filename: tableExportFilename(feature.baseName, format),
|
|
2508
|
+
type: format === "csv" ? "text/csv;charset=utf-8" : "application/json;charset=utf-8"
|
|
2509
|
+
}));
|
|
2510
|
+
},
|
|
2511
|
+
RefreshRequested: ($) => $.props.features?.refresh ? $.emit(DataTableEvents.RefreshRequested()) : $.model,
|
|
2512
|
+
ExportRequested: ($, { actionId }) => !$.props.features?.export?.pending && $.props.features?.export?.actions?.some(({ id, disabled }) => id === actionId && !disabled) ? $.emit(DataTableEvents.ExportRequested({ actionId })) : $.model,
|
|
2513
|
+
GroupActionRequested: ($, request) => available($.props) && $.props.features?.grouping?.fields.some(({ id, actions }) => id === request.fieldId && actions?.some(({ id, disabled }) => id === request.actionId && !disabled)) ? $.emit(DataTableEvents.GroupActionRequested(request)) : $.model,
|
|
2514
|
+
GroupMoveRequested: ($, { rowId, fieldId, groupId }) => moveGroup($, rowId, fieldId, groupId),
|
|
2515
|
+
ReorderRequested: ($, { rowId, targetId, after }) => reorderRows($, rowId, targetId, after),
|
|
2516
|
+
DragStarted: ($, { rowId }) => $.evolve({ dragging: rowId }),
|
|
2517
|
+
DragEnded: ($) => $.evolve({ dragging: null }),
|
|
2518
|
+
DragDropped: ($, { targetId }) => $.model.dragging === null ? $.model : reorderRows($, $.model.dragging, targetId, $.props.rowData.findIndex(({ id }) => id === $.model.dragging) < $.props.rowData.findIndex(({ id }) => id === targetId)),
|
|
2519
|
+
GroupDropped: ($, { fieldId, groupId }) => $.model.dragging === null ? $.model : moveGroup($, $.model.dragging, fieldId, groupId),
|
|
2520
|
+
ViewPicked: ($, { view }) => view === "table" || $.props.features?.gallery ? $.evolve({ view, menu: null }) : $.model,
|
|
2521
|
+
GroupingToggled: ($, { fieldId }) => $.props.features?.grouping?.fields.some(({ id }) => id === fieldId) ? $.evolve({
|
|
2522
|
+
grouping: updateSelectedRows($.model.grouping, [fieldId], !$.model.grouping.includes(fieldId))
|
|
2523
|
+
}) : $.model,
|
|
2524
|
+
GroupToggled: ($, { key }) => $.evolve({
|
|
2525
|
+
collapsedGroups: {
|
|
2526
|
+
...$.model.collapsedGroups,
|
|
2527
|
+
[key]: !$.model.collapsedGroups[key]
|
|
2528
|
+
}
|
|
1139
2529
|
}),
|
|
1140
|
-
|
|
1141
|
-
id
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
id
|
|
1154
|
-
|
|
1155
|
-
|
|
2530
|
+
ColumnResized: ($, { id, delta }) => {
|
|
2531
|
+
const column = $.props.columnDefs.find((column) => column.id === id);
|
|
2532
|
+
if (!column || column.resizable === false)
|
|
2533
|
+
return $.model;
|
|
2534
|
+
const sizing = {
|
|
2535
|
+
...$.model.columnSizing,
|
|
2536
|
+
[id]: tableColumnWidth(column, $.model.columnSizing) + delta
|
|
2537
|
+
};
|
|
2538
|
+
return $.evolve({
|
|
2539
|
+
columnSizing: { ...sizing, [id]: tableColumnWidth(column, sizing) }
|
|
2540
|
+
});
|
|
2541
|
+
},
|
|
2542
|
+
ColumnResizeReset: ($, { id }) => {
|
|
2543
|
+
const column = $.props.columnDefs.find((column) => column.id === id);
|
|
2544
|
+
if (!column || column.resizable === false)
|
|
2545
|
+
return $.model;
|
|
2546
|
+
return $.evolve({
|
|
2547
|
+
columnSizing: {
|
|
2548
|
+
...$.model.columnSizing,
|
|
2549
|
+
[id]: clampTableWidth(column)
|
|
2550
|
+
}
|
|
2551
|
+
});
|
|
2552
|
+
},
|
|
2553
|
+
ResizeStarted: ($, { id, x, pointerId }) => {
|
|
2554
|
+
const column = $.props.columnDefs.find((column) => column.id === id);
|
|
2555
|
+
return column && column.resizable !== false ? $.evolve({
|
|
2556
|
+
resizing: {
|
|
2557
|
+
id,
|
|
2558
|
+
x,
|
|
2559
|
+
pointerId,
|
|
2560
|
+
width: tableColumnWidth(column, $.model.columnSizing)
|
|
2561
|
+
}
|
|
2562
|
+
}) : $.model;
|
|
2563
|
+
},
|
|
2564
|
+
ResizeMoved: ($, { x, pointerId }) => {
|
|
2565
|
+
const resize = $.model.resizing;
|
|
2566
|
+
const column = resize && $.props.columnDefs.find(({ id }) => id === resize.id);
|
|
2567
|
+
if (!resize || resize.pointerId !== pointerId || !column || column.resizable === false)
|
|
2568
|
+
return $.model;
|
|
2569
|
+
return $.evolve({
|
|
2570
|
+
columnSizing: {
|
|
2571
|
+
...$.model.columnSizing,
|
|
2572
|
+
[resize.id]: tableColumnWidth(column, {
|
|
2573
|
+
[resize.id]: resize.width + x - resize.x
|
|
2574
|
+
})
|
|
2575
|
+
}
|
|
2576
|
+
});
|
|
2577
|
+
},
|
|
2578
|
+
ResizeEnded: ($, { pointerId }) => $.model.resizing?.pointerId === pointerId ? $.evolve({ resizing: null }) : $.model,
|
|
2579
|
+
ColumnFiltersCleared: ($, { id }) => {
|
|
2580
|
+
const column = $.props.columnDefs.find((column) => column.id === id);
|
|
2581
|
+
if (!column || !tableFeatures($.props).filtering)
|
|
2582
|
+
return $.model;
|
|
2583
|
+
const owned = new Set([
|
|
2584
|
+
id,
|
|
2585
|
+
...tableDataColumns([column]).map(({ id }) => id)
|
|
2586
|
+
]);
|
|
2587
|
+
const filters = tableQuery($.props, $.model).filters?.filter(({ id }) => !owned.has(id));
|
|
2588
|
+
return changeQuery($, { filters: filters?.length ? filters : undefined, page: 0 }, { filterDraft: null, invalidFilter: false });
|
|
2589
|
+
},
|
|
2590
|
+
ColumnSortCleared: ($, { id }) => {
|
|
2591
|
+
const column = $.props.columnDefs.find((column) => column.id === id);
|
|
2592
|
+
if (!column || !tableFeatures($.props).sorting)
|
|
2593
|
+
return $.model;
|
|
2594
|
+
const owned = new Set([
|
|
2595
|
+
id,
|
|
2596
|
+
...tableDataColumns([column]).map(({ id }) => id)
|
|
2597
|
+
]);
|
|
2598
|
+
const sort = (tableQuery($.props, $.model).sort ?? []).filter(({ id }) => !owned.has(id));
|
|
2599
|
+
return changeQuery($, { sort }, {}, DataTableEvents.SortChanged({ sort }));
|
|
2600
|
+
},
|
|
2601
|
+
MenuOpened: ($, { key }) => $.evolve({ menu: key, submenu: null, menuQuery: "" }),
|
|
2602
|
+
MenuQueryChanged: ($, { key, query }) => $.model.menu === key ? $.evolve({ menuQuery: query }) : $.model,
|
|
2603
|
+
MenuClosed: ($, { key }) => $.model.menu === key ? $.evolve({ menu: null, submenu: null }) : $.model,
|
|
2604
|
+
SubmenuOpened: ($, { key, filterColumnId }) => $.evolve({
|
|
2605
|
+
submenu: key,
|
|
2606
|
+
menuQuery: "",
|
|
2607
|
+
...filterColumnId === undefined ? {} : {
|
|
2608
|
+
filterDraft: tableFilterDraft(filterColumnId, tableQuery($.props, $.model).filters?.find(({ id }) => id === filterColumnId)),
|
|
2609
|
+
invalidFilter: false
|
|
2610
|
+
}
|
|
2611
|
+
}),
|
|
2612
|
+
SubmenuClosed: ($, { key }) => $.model.submenu === key ? $.evolve({ submenu: null }) : $.model,
|
|
2613
|
+
SearchChanged: ($, { value }) => tableFeatures($.props).search ? changeQuery($, { globalFilter: value || undefined, page: 0 }, { menu: null }) : $.model,
|
|
2614
|
+
FilterInputChanged: ($, { field, value }) => {
|
|
2615
|
+
const draft = $.model.filterDraft;
|
|
2616
|
+
return draft ? $.evolve({
|
|
2617
|
+
filterDraft: { ...draft, [field]: value },
|
|
2618
|
+
invalidFilter: false
|
|
2619
|
+
}) : $.model;
|
|
2620
|
+
},
|
|
2621
|
+
FilterOperatorChanged: ($, { operator }) => {
|
|
2622
|
+
const draft = $.model.filterDraft;
|
|
2623
|
+
return draft ? $.evolve({
|
|
2624
|
+
filterDraft: { ...draft, operator },
|
|
2625
|
+
invalidFilter: false
|
|
2626
|
+
}) : $.model;
|
|
2627
|
+
},
|
|
2628
|
+
FilterValueToggled: ($, { value, checked }) => {
|
|
2629
|
+
const draft = $.model.filterDraft;
|
|
2630
|
+
return draft ? $.evolve({
|
|
2631
|
+
filterDraft: {
|
|
2632
|
+
...draft,
|
|
2633
|
+
values: updateSelectedRows(draft.values, [value], checked)
|
|
2634
|
+
},
|
|
2635
|
+
invalidFilter: false
|
|
2636
|
+
}) : $.model;
|
|
2637
|
+
},
|
|
2638
|
+
FilterApplied: ($) => {
|
|
2639
|
+
const draft = $.model.filterDraft;
|
|
2640
|
+
if (!tableFeatures($.props).filtering || !draft)
|
|
2641
|
+
return $.model;
|
|
2642
|
+
const column = tableDataColumns($.props.columnDefs).find(({ id, filterable }) => id === draft.id && filterable !== false);
|
|
2643
|
+
if (!column)
|
|
2644
|
+
return $.model;
|
|
2645
|
+
const decoded = parseTableFilterDraft(tableFilterKind(column), draft);
|
|
2646
|
+
return Option3.isNone(decoded) ? $.evolve({ invalidFilter: true }) : changeColumnFilter($, draft.id, decoded.value, {
|
|
2647
|
+
invalidFilter: false
|
|
2648
|
+
});
|
|
2649
|
+
},
|
|
2650
|
+
FilterCleared: ($) => {
|
|
2651
|
+
const draft = $.model.filterDraft;
|
|
2652
|
+
if (!draft)
|
|
2653
|
+
return $.model;
|
|
2654
|
+
return changeColumnFilter($, draft.id, null, {
|
|
2655
|
+
filterDraft: tableFilterDraft(draft.id),
|
|
2656
|
+
invalidFilter: false
|
|
2657
|
+
});
|
|
2658
|
+
},
|
|
2659
|
+
ColumnFilterChanged: ($, { id, filter }) => {
|
|
2660
|
+
if (!tableFeatures($.props).filtering || !tableDataColumns($.props.columnDefs).some((column) => column.id === id && column.filterable !== false) || filter && filter.id !== id)
|
|
2661
|
+
return $.model;
|
|
2662
|
+
return changeColumnFilter($, id, filter);
|
|
2663
|
+
},
|
|
2664
|
+
FiltersCleared: ($) => changeQuery($, { filters: undefined, page: 0 }, {
|
|
2665
|
+
filterDraft: null,
|
|
2666
|
+
invalidFilter: false
|
|
1156
2667
|
}),
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
})
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
2668
|
+
PageRequested: ($, { page }) => tableFeatures($.props).pagination && page >= 0 ? changeQuery($, { page }, { menu: null }) : $.model,
|
|
2669
|
+
ServerPageInvalidated: ($) => {
|
|
2670
|
+
const correction = serverPageCorrection($.props, $.model);
|
|
2671
|
+
return correction ? changeQuery($, { page: correction.page }) : $.model;
|
|
2672
|
+
},
|
|
2673
|
+
PageSizeRequested: ($, { pageSize }) => {
|
|
2674
|
+
const pagination = tableFeatures($.props).pagination;
|
|
2675
|
+
return pagination && (pagination.pageSizes ?? defaultPageSizes).includes(pageSize) ? changeQuery($, { pageSize, page: 0 }, { menu: null }) : $.model;
|
|
2676
|
+
},
|
|
2677
|
+
SortRequested: ($, { columnId, direction }) => {
|
|
2678
|
+
if (!tableFeatures($.props).sorting || !tableDataColumns($.props.columnDefs).some(({ id, sortable }) => id === columnId && sortable !== false))
|
|
2679
|
+
return $.model;
|
|
2680
|
+
const sort = direction === null ? (tableQuery($.props, $.model).sort ?? []).filter(({ id }) => id !== columnId) : [{ id: columnId, direction }];
|
|
2681
|
+
return changeQuery($, { sort: sort.length ? sort : undefined, page: 0 }, {}, DataTableEvents.SortChanged({ sort }));
|
|
2682
|
+
},
|
|
2683
|
+
ColumnVisibilityChanged: ($, { id, visible }) => tableFeatures($.props).columnVisibility && $.props.columnDefs.some((column) => column.id === id && column.hideable !== false) ? $.evolve({
|
|
2684
|
+
columnVisibility: { ...$.model.columnVisibility, [id]: visible }
|
|
2685
|
+
}) : $.model,
|
|
2686
|
+
SelectionRequested: ($, { rowIds, checked }) => {
|
|
2687
|
+
if (!available($.props) || !$.props.selection)
|
|
2688
|
+
return $.model;
|
|
2689
|
+
const requested = new Set(rowIds);
|
|
2690
|
+
const targets = $.props.rowData.filter((row) => row.selectable !== false && requested.has(row.id)).map(({ id }) => id);
|
|
2691
|
+
if (targets.length === 0)
|
|
2692
|
+
return $.model;
|
|
2693
|
+
const controlled = $.props.selection.selectedRowIds;
|
|
2694
|
+
const selectedRowIds = updateSelectedRows(controlled ?? $.model.selectedRowIds, targets, checked);
|
|
2695
|
+
return $.evolve(controlled ? {} : { selectedRowIds }).emit(DataTableEvents.SelectionChanged({ selectedRowIds }));
|
|
2696
|
+
},
|
|
2697
|
+
CellEditRequested: ($, { rowId, columnId, edit }) => {
|
|
2698
|
+
if (!available($.props))
|
|
2699
|
+
return $.model;
|
|
2700
|
+
const row = $.props.rowData.find(({ id }) => id === rowId);
|
|
2701
|
+
const column = $.props.columnDefs.find(({ id }) => id === columnId);
|
|
2702
|
+
if (!row || !column || row.disabledColumnIds?.includes(columnId))
|
|
2703
|
+
return $.model;
|
|
2704
|
+
const value = row.cells[columnId];
|
|
2705
|
+
if (edit._tag === "SetBoolean") {
|
|
2706
|
+
if (column.type !== "boolean" || !column.editable || !isTableBoolean(value) || edit.value === value)
|
|
2707
|
+
return $.model;
|
|
2708
|
+
} else {
|
|
2709
|
+
if (column.type !== "list")
|
|
2710
|
+
return $.model;
|
|
2711
|
+
const items = isTableList(value) ? value : [];
|
|
2712
|
+
const contains = items.some(({ value }) => value === edit.itemId);
|
|
2713
|
+
if (edit._tag === "AddItem") {
|
|
2714
|
+
if (contains || !column.options?.some(({ value }) => value === edit.itemId))
|
|
2715
|
+
return $.model;
|
|
2716
|
+
} else if (!contains || !column.allowRemove)
|
|
2717
|
+
return $.model;
|
|
1195
2718
|
}
|
|
1196
|
-
|
|
2719
|
+
return $.emit(DataTableEvents.CellEditRequested({ rowId, columnId, edit }));
|
|
2720
|
+
},
|
|
2721
|
+
RowActionRequested: ($, { rowId, actionId }) => {
|
|
2722
|
+
const row = $.props.rowData.find(({ id }) => id === rowId);
|
|
2723
|
+
if (!available($.props) || !row?.actions?.some(({ id, disabled }) => id === actionId && !disabled))
|
|
2724
|
+
return $.model;
|
|
2725
|
+
return $.emit(DataTableEvents.RowActionRequested({ rowId, actionId }));
|
|
2726
|
+
},
|
|
2727
|
+
BulkActionRequested: ($, { actionId }) => {
|
|
2728
|
+
const selection = $.props.selection;
|
|
2729
|
+
if (!available($.props) || !selection?.bulkActions?.some(({ id, disabled }) => id === actionId && !disabled))
|
|
2730
|
+
return $.model;
|
|
2731
|
+
const rowIds = tableSelectedRowIds($.props, $.model);
|
|
2732
|
+
return rowIds.length > 0 ? $.emit(DataTableEvents.BulkActionRequested({ actionId, rowIds })) : $.model;
|
|
2733
|
+
}
|
|
1197
2734
|
});
|
|
1198
|
-
var
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
2735
|
+
var dataTableBehaviours = {
|
|
2736
|
+
subscriptions: ({
|
|
2737
|
+
props,
|
|
2738
|
+
model
|
|
2739
|
+
}) => {
|
|
2740
|
+
const correction = serverPageCorrection(props, model);
|
|
2741
|
+
return correction ? [
|
|
2742
|
+
Subscription.make("reconcile-server-page", [correction.requested, correction.page, correction.size], () => Stream.make(DataTableMessage.ServerPageInvalidated()))
|
|
2743
|
+
] : [];
|
|
2744
|
+
},
|
|
2745
|
+
init: ({ props }) => ({
|
|
2746
|
+
menu: null,
|
|
2747
|
+
submenu: null,
|
|
2748
|
+
menuQuery: "",
|
|
2749
|
+
failedImages: [],
|
|
2750
|
+
selectedRowIds: [],
|
|
2751
|
+
query: {
|
|
2752
|
+
globalFilter: props.initialState?.globalFilter,
|
|
2753
|
+
filters: props.initialState?.filters,
|
|
2754
|
+
sort: props.initialState?.sort,
|
|
2755
|
+
page: props.initialState?.page ?? 0,
|
|
2756
|
+
pageSize: props.initialState?.pageSize ?? (props.pagination?.mode === undefined ? props.pagination?.pageSizes?.[0] : undefined) ?? DEFAULT_PAGE_SIZE
|
|
2757
|
+
},
|
|
2758
|
+
columnVisibility: props.initialState?.columnVisibility ?? {},
|
|
2759
|
+
preferencesLoaded: false,
|
|
2760
|
+
columnSizing: {},
|
|
2761
|
+
view: props.initialState?.view ?? "table",
|
|
2762
|
+
grouping: props.features?.grouping?.initial ?? [],
|
|
2763
|
+
collapsedGroups: {},
|
|
2764
|
+
dragging: null,
|
|
2765
|
+
exporting: false,
|
|
2766
|
+
exportFailed: false,
|
|
2767
|
+
resizing: null,
|
|
2768
|
+
filterDraft: null,
|
|
2769
|
+
invalidFilter: false
|
|
2770
|
+
}),
|
|
2771
|
+
update: update2
|
|
2772
|
+
};
|
|
1210
2773
|
|
|
1211
|
-
// ../../src/components/
|
|
1212
|
-
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
2774
|
+
// ../../src/components/data-table/react.tsx
|
|
1213
2775
|
import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
|
|
1214
|
-
var DataTableStylesContext =
|
|
2776
|
+
var DataTableStylesContext = createContext2(undefined);
|
|
2777
|
+
var DataTableSlotClassesContext = createContext2(resolveTableClasses());
|
|
1215
2778
|
var styledTablePart = (Part, slot, style) => {
|
|
1216
2779
|
const StyledPart = (props) => {
|
|
1217
|
-
const styles =
|
|
2780
|
+
const styles = useContext2(DataTableStylesContext);
|
|
1218
2781
|
const className = cn(props.className, style(styles));
|
|
1219
2782
|
return /* @__PURE__ */ jsx15(Part, {
|
|
1220
2783
|
"data-table-slot": slot,
|
|
@@ -1250,27 +2813,21 @@ var DropdownMenuLabel2 = styledTablePart(DropdownMenuLabel, "row-menu-label", (s
|
|
|
1250
2813
|
var DropdownMenuSeparator2 = styledTablePart(DropdownMenuSeparator, "row-menu-separator", (s) => s?.menu?.separator);
|
|
1251
2814
|
var SelectContent2 = styledTablePart(SelectContent, "select-popup", (s) => s?.popup?.select);
|
|
1252
2815
|
var TooltipContent2 = styledTablePart(TooltipContent, "tooltip", (s) => s?.popup?.tooltip);
|
|
1253
|
-
var DataTablePersistedUiStateSchema = Schema2.Struct({
|
|
1254
|
-
columnVisibility: Schema2.Record(Schema2.String, Schema2.Boolean),
|
|
1255
|
-
columnSizing: Schema2.Record(Schema2.String, Schema2.Finite),
|
|
1256
|
-
grouping: Schema2.optionalKey(Schema2.Array(Schema2.String)),
|
|
1257
|
-
view: Schema2.Literals(["table", "gallery"])
|
|
1258
|
-
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
1259
|
-
var dataTableStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
1260
2816
|
var DataTableReferenceCell = ({
|
|
1261
2817
|
item,
|
|
1262
2818
|
emptyLabel = "—",
|
|
1263
2819
|
imageVariant = "circle"
|
|
1264
2820
|
}) => {
|
|
1265
|
-
const
|
|
2821
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
2822
|
+
const [failedImage, setFailedImage] = useState2();
|
|
1266
2823
|
if (!item)
|
|
1267
2824
|
return emptyLabel;
|
|
1268
|
-
const initials = item.label
|
|
2825
|
+
const initials = tableInitials(item.label);
|
|
1269
2826
|
return /* @__PURE__ */ jsxs9("div", {
|
|
1270
|
-
className:
|
|
2827
|
+
className: tableClasses.reference,
|
|
1271
2828
|
children: [
|
|
1272
2829
|
/* @__PURE__ */ jsx15("div", {
|
|
1273
|
-
className: cn(
|
|
2830
|
+
className: cn(tableClasses.referenceAvatar, imageVariant === "circle" ? "rounded-full" : "rounded-md", item.iconClassName),
|
|
1274
2831
|
children: item.icon ? /* @__PURE__ */ jsx15("span", {
|
|
1275
2832
|
"aria-hidden": "true",
|
|
1276
2833
|
className: "[&_svg]:size-4",
|
|
@@ -1286,14 +2843,14 @@ var DataTableReferenceCell = ({
|
|
|
1286
2843
|
})
|
|
1287
2844
|
}),
|
|
1288
2845
|
/* @__PURE__ */ jsxs9("div", {
|
|
1289
|
-
className:
|
|
2846
|
+
className: tableClasses.referenceText,
|
|
1290
2847
|
children: [
|
|
1291
2848
|
/* @__PURE__ */ jsx15("span", {
|
|
1292
|
-
className:
|
|
2849
|
+
className: tableClasses.referenceName,
|
|
1293
2850
|
children: item.label
|
|
1294
2851
|
}),
|
|
1295
2852
|
item.description ? /* @__PURE__ */ jsx15("span", {
|
|
1296
|
-
className:
|
|
2853
|
+
className: tableClasses.referenceDescription,
|
|
1297
2854
|
children: item.description
|
|
1298
2855
|
}) : null
|
|
1299
2856
|
]
|
|
@@ -1305,28 +2862,10 @@ var referenceText = (item) => item ? [item.label, item.description].filter(Boole
|
|
|
1305
2862
|
var messages2 = {
|
|
1306
2863
|
en: {
|
|
1307
2864
|
...paginationMessages("en"),
|
|
1308
|
-
|
|
1309
|
-
addItem: "Add item...",
|
|
1310
|
-
empty: "No results.",
|
|
1311
|
-
loading: "Loading...",
|
|
2865
|
+
...defaultMessages.en,
|
|
1312
2866
|
filter: "Filter results...",
|
|
1313
|
-
filters: "Filters",
|
|
1314
|
-
filtersClear: "Clear all filters",
|
|
1315
|
-
filterClear: "Clear filter",
|
|
1316
|
-
filterApply: "Apply filter",
|
|
1317
|
-
filterValue: "Value",
|
|
1318
|
-
filterOperator: "Operator",
|
|
1319
|
-
filterContains: "Contains",
|
|
1320
|
-
filterEquals: "Equals",
|
|
1321
|
-
filterStartsWith: "Starts with",
|
|
1322
|
-
filterEndsWith: "Ends with",
|
|
1323
|
-
filterMin: "Minimum",
|
|
1324
|
-
filterMax: "Maximum",
|
|
1325
2867
|
filterFrom: "From (UTC)",
|
|
1326
2868
|
filterTo: "To (UTC)",
|
|
1327
|
-
filterTrue: "True",
|
|
1328
|
-
filterFalse: "False",
|
|
1329
|
-
filterInvalid: "Enter a valid filter. Ranges must be in ascending order.",
|
|
1330
2869
|
export: "Export",
|
|
1331
2870
|
exportCsv: "CSV",
|
|
1332
2871
|
exportJson: "JSON",
|
|
@@ -1337,45 +2876,20 @@ var messages2 = {
|
|
|
1337
2876
|
galleryView: "Gallery",
|
|
1338
2877
|
columns: "Columns",
|
|
1339
2878
|
groupBy: "Group by",
|
|
1340
|
-
sortAsc: "Ascending",
|
|
1341
|
-
sortDesc: "Descending",
|
|
1342
|
-
sortClear: "Clear sorting",
|
|
1343
2879
|
sortBy: "Sort by",
|
|
1344
2880
|
hideColumn: "Hide column",
|
|
1345
2881
|
reorder: "Drag to reorder",
|
|
1346
|
-
removeItem: "Remove",
|
|
1347
2882
|
moveUp: "Move up",
|
|
1348
2883
|
moveDown: "Move down",
|
|
1349
2884
|
resizeColumn: (column) => `Resize ${column} column`,
|
|
1350
|
-
listDetails: "View all items"
|
|
1351
|
-
selectAllRows: "Select all rows on this page",
|
|
1352
|
-
selectRow: "Select row",
|
|
1353
|
-
selected: "Selected"
|
|
2885
|
+
listDetails: "View all items"
|
|
1354
2886
|
},
|
|
1355
2887
|
fr: {
|
|
1356
2888
|
...paginationMessages("fr"),
|
|
1357
|
-
|
|
1358
|
-
addItem: "Ajouter un élément...",
|
|
1359
|
-
empty: "Aucun résultat.",
|
|
1360
|
-
loading: "Chargement...",
|
|
2889
|
+
...defaultMessages.fr,
|
|
1361
2890
|
filter: "Filtrer les résultats...",
|
|
1362
|
-
filters: "Filtres",
|
|
1363
|
-
filtersClear: "Effacer tous les filtres",
|
|
1364
|
-
filterClear: "Effacer le filtre",
|
|
1365
|
-
filterApply: "Appliquer le filtre",
|
|
1366
|
-
filterValue: "Valeur",
|
|
1367
|
-
filterOperator: "Opérateur",
|
|
1368
|
-
filterContains: "Contient",
|
|
1369
|
-
filterEquals: "Égal à",
|
|
1370
|
-
filterStartsWith: "Commence par",
|
|
1371
|
-
filterEndsWith: "Se termine par",
|
|
1372
|
-
filterMin: "Minimum",
|
|
1373
|
-
filterMax: "Maximum",
|
|
1374
2891
|
filterFrom: "Du (UTC)",
|
|
1375
2892
|
filterTo: "Au (UTC)",
|
|
1376
|
-
filterTrue: "Vrai",
|
|
1377
|
-
filterFalse: "Faux",
|
|
1378
|
-
filterInvalid: "Saisissez un filtre valide. Les bornes doivent être dans l’ordre croissant.",
|
|
1379
2893
|
export: "Exporter",
|
|
1380
2894
|
exportCsv: "CSV",
|
|
1381
2895
|
exportJson: "JSON",
|
|
@@ -1386,20 +2900,13 @@ var messages2 = {
|
|
|
1386
2900
|
galleryView: "Galerie",
|
|
1387
2901
|
columns: "Colonnes",
|
|
1388
2902
|
groupBy: "Grouper par",
|
|
1389
|
-
sortAsc: "Croissant",
|
|
1390
|
-
sortDesc: "Décroissant",
|
|
1391
|
-
sortClear: "Effacer le tri",
|
|
1392
2903
|
sortBy: "Trier par",
|
|
1393
2904
|
hideColumn: "Masquer la colonne",
|
|
1394
2905
|
reorder: "Glisser pour réordonner",
|
|
1395
|
-
removeItem: "Retirer",
|
|
1396
2906
|
moveUp: "Déplacer vers le haut",
|
|
1397
2907
|
moveDown: "Déplacer vers le bas",
|
|
1398
2908
|
resizeColumn: (column) => `Redimensionner la colonne ${column}`,
|
|
1399
|
-
listDetails: "Afficher tous les éléments"
|
|
1400
|
-
selectAllRows: "Sélectionner toutes les lignes de cette page",
|
|
1401
|
-
selectRow: "Sélectionner la ligne",
|
|
1402
|
-
selected: "Sélectionnés"
|
|
2909
|
+
listDetails: "Afficher tous les éléments"
|
|
1403
2910
|
}
|
|
1404
2911
|
};
|
|
1405
2912
|
var dataTableMessages = (locale = "en", translations) => ({
|
|
@@ -1407,32 +2914,6 @@ var dataTableMessages = (locale = "en", translations) => ({
|
|
|
1407
2914
|
...translations?.[locale.split("-")[0] ?? locale],
|
|
1408
2915
|
...translations?.[locale]
|
|
1409
2916
|
});
|
|
1410
|
-
var DEFAULT_MIN_WIDTH = 96;
|
|
1411
|
-
var DEFAULT_WIDTH = 208;
|
|
1412
|
-
var DEFAULT_MAX_WIDTH = 640;
|
|
1413
|
-
var DEFAULT_QUERY = {
|
|
1414
|
-
page: 0,
|
|
1415
|
-
pageSize: DEFAULT_PAGE_SIZE
|
|
1416
|
-
};
|
|
1417
|
-
var DEFAULT_UI_STATE = {
|
|
1418
|
-
columnVisibility: {},
|
|
1419
|
-
columnSizing: {},
|
|
1420
|
-
rowSelection: {},
|
|
1421
|
-
grouping: [],
|
|
1422
|
-
collapsedGroups: {},
|
|
1423
|
-
view: "table"
|
|
1424
|
-
};
|
|
1425
|
-
var persistedUiFromState = (state) => ({
|
|
1426
|
-
columnVisibility: state.columnVisibility,
|
|
1427
|
-
columnSizing: state.columnSizing,
|
|
1428
|
-
grouping: state.grouping,
|
|
1429
|
-
view: state.view
|
|
1430
|
-
});
|
|
1431
|
-
var transientUiFromState = (state) => ({
|
|
1432
|
-
rowSelection: state.rowSelection,
|
|
1433
|
-
collapsedGroups: state.collapsedGroups
|
|
1434
|
-
});
|
|
1435
|
-
var clampWidth = (column, width) => Math.min(column.maxWidth ?? DEFAULT_MAX_WIDTH, Math.max(column.minWidth ?? DEFAULT_MIN_WIDTH, width));
|
|
1436
2917
|
var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
1437
2918
|
const ids = new Set;
|
|
1438
2919
|
const columns = columnDefs.map((colDef) => {
|
|
@@ -1447,7 +2928,7 @@ var normalizeDataTableColumns = (columnDefs, columnSizing = {}) => {
|
|
|
1447
2928
|
return {
|
|
1448
2929
|
id,
|
|
1449
2930
|
colDef,
|
|
1450
|
-
width:
|
|
2931
|
+
width: clampTableWidth(colDef, columnSizing[id])
|
|
1451
2932
|
};
|
|
1452
2933
|
});
|
|
1453
2934
|
for (const column of columns) {
|
|
@@ -1468,7 +2949,7 @@ var getDataTableFieldColumns = (column) => (column.colDef.fields ?? []).map(({ i
|
|
|
1468
2949
|
}));
|
|
1469
2950
|
var getDataTableSortColumns = (columns) => columns.flatMap((column) => column.colDef.sortable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.sortable !== false));
|
|
1470
2951
|
var getDataTableExportColumns = (visibleColumns) => visibleColumns.flatMap((column) => column.colDef.fields?.length ? getDataTableFieldColumns(column).filter((_field, index) => column.colDef.fields?.[index]?.export !== false) : [column]);
|
|
1471
|
-
var getDataTableWidth = (columns, utilityColumns = 0) => columns.
|
|
2952
|
+
var getDataTableWidth = (columns, utilityColumns = 0) => tableLayoutWidth(columns.map(({ width }) => width), utilityColumns);
|
|
1472
2953
|
var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
1473
2954
|
const ids = new Set;
|
|
1474
2955
|
return rowData.map((data, index) => {
|
|
@@ -1488,58 +2969,20 @@ var buildDataTableRows = (rowData, columns, getRowId) => {
|
|
|
1488
2969
|
};
|
|
1489
2970
|
});
|
|
1490
2971
|
};
|
|
1491
|
-
var
|
|
1492
|
-
var InstantString = Schema2.String.check(Schema2.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema2.makeFilter((value) => Schema2.is(CalendarDate)(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
|
|
1493
|
-
var DateInput = Schema2.Union([
|
|
1494
|
-
Schema2.Date,
|
|
1495
|
-
Schema2.Int,
|
|
1496
|
-
CalendarDate,
|
|
1497
|
-
InstantString
|
|
1498
|
-
]).annotate({
|
|
1499
|
-
identifier: "DataTableDateInput"
|
|
1500
|
-
});
|
|
1501
|
-
var decodeDateInput = Schema2.decodeUnknownOption(DateInput);
|
|
1502
|
-
var resolveDate = (value, type) => Option2.getOrUndefined(Option2.flatMap(decodeDateInput(value), (input) => {
|
|
1503
|
-
const calendarOnly = Schema2.is(CalendarDate)(input);
|
|
1504
|
-
if (calendarOnly && type === "dateTime")
|
|
1505
|
-
return Option2.none();
|
|
1506
|
-
return Option2.map(DateTime2.make(input), (instant) => ({
|
|
1507
|
-
instant,
|
|
1508
|
-
calendarOnly
|
|
1509
|
-
}));
|
|
1510
|
-
}));
|
|
1511
|
-
var formatDateValue = (date, column, locale = "en") => DateTime2.format(date.instant, {
|
|
1512
|
-
locale: column.typeOptions?.locale ?? locale,
|
|
1513
|
-
timeZone: date.calendarOnly ? "UTC" : column.typeOptions?.timeZone ?? "UTC",
|
|
1514
|
-
dateStyle: column.typeOptions?.dateStyle ?? "medium",
|
|
1515
|
-
timeStyle: column.type === "dateTime" ? column.typeOptions?.timeStyle ?? "short" : undefined,
|
|
1516
|
-
hour12: column.type === "dateTime" ? column.typeOptions?.hour12 : undefined
|
|
1517
|
-
});
|
|
1518
|
-
var dateIsoValue = (date) => date.calendarOnly ? DateTime2.formatIsoDateUtc(date.instant) : DateTime2.formatIso(date.instant);
|
|
1519
|
-
var NumberValue = Schema2.Finite.annotate({
|
|
2972
|
+
var NumberValue = Schema6.Finite.annotate({
|
|
1520
2973
|
identifier: "DataTableNumberValue"
|
|
1521
2974
|
});
|
|
1522
|
-
var BooleanValue =
|
|
2975
|
+
var BooleanValue = Schema6.Boolean.annotate({
|
|
1523
2976
|
identifier: "DataTableBooleanValue"
|
|
1524
2977
|
});
|
|
1525
|
-
var decodeNumberValue =
|
|
1526
|
-
var decodeBooleanValue =
|
|
1527
|
-
var
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
...format
|
|
1534
|
-
} = options;
|
|
1535
|
-
return new Intl.NumberFormat(locale ?? defaultLocale, format).format(value);
|
|
1536
|
-
};
|
|
1537
|
-
var scalarText = Schema2.is(Schema2.Union([
|
|
1538
|
-
Schema2.String,
|
|
1539
|
-
Schema2.Finite,
|
|
1540
|
-
Schema2.Boolean,
|
|
1541
|
-
Schema2.BigInt,
|
|
1542
|
-
Schema2.Symbol
|
|
2978
|
+
var decodeNumberValue = Schema6.decodeUnknownOption(NumberValue);
|
|
2979
|
+
var decodeBooleanValue = Schema6.decodeUnknownOption(BooleanValue);
|
|
2980
|
+
var scalarText = Schema6.is(Schema6.Union([
|
|
2981
|
+
Schema6.String,
|
|
2982
|
+
Schema6.Finite,
|
|
2983
|
+
Schema6.Boolean,
|
|
2984
|
+
Schema6.BigInt,
|
|
2985
|
+
Schema6.Symbol
|
|
1543
2986
|
]));
|
|
1544
2987
|
var dataTableValueText = (value) => value == null ? "" : scalarText(value) ? String(value) : Formatter.format(value);
|
|
1545
2988
|
var booleanLabel = (value, options) => value ? options?.trueLabel : options?.falseLabel;
|
|
@@ -1547,13 +2990,13 @@ var getDataTableExportValue = (row, column, locale = "en") => {
|
|
|
1547
2990
|
const value = row.values.get(column.id);
|
|
1548
2991
|
const colDef = column.colDef;
|
|
1549
2992
|
if (colDef.type === "number") {
|
|
1550
|
-
const number =
|
|
2993
|
+
const number = Option4.getOrUndefined(decodeNumberValue(value));
|
|
1551
2994
|
if (number === undefined)
|
|
1552
2995
|
return null;
|
|
1553
2996
|
return colDef.typeOptions?.exportFormat === "formatted" ? formatNumberValue(number, colDef.typeOptions, locale) : number;
|
|
1554
2997
|
}
|
|
1555
2998
|
if (colDef.type === "boolean") {
|
|
1556
|
-
const boolean =
|
|
2999
|
+
const boolean = Option4.getOrUndefined(decodeBooleanValue(value));
|
|
1557
3000
|
if (boolean === undefined)
|
|
1558
3001
|
return null;
|
|
1559
3002
|
return colDef.typeOptions?.exportFormat === "formatted" ? booleanLabel(boolean, colDef.typeOptions) ?? String(boolean) : boolean;
|
|
@@ -1578,10 +3021,10 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1578
3021
|
const date = resolveDate(value, colDef.type);
|
|
1579
3022
|
text = date ? `${formatDateValue(date, colDef, locale)} ${dateIsoValue(date)}` : "";
|
|
1580
3023
|
} else if (colDef.type === "number") {
|
|
1581
|
-
const number =
|
|
3024
|
+
const number = Option4.getOrUndefined(decodeNumberValue(value));
|
|
1582
3025
|
text = number === undefined ? "" : `${formatNumberValue(number, colDef.typeOptions, locale)} ${number}`;
|
|
1583
3026
|
} else if (colDef.type === "boolean") {
|
|
1584
|
-
const boolean =
|
|
3027
|
+
const boolean = Option4.getOrUndefined(decodeBooleanValue(value));
|
|
1585
3028
|
text = boolean === undefined ? "" : `${booleanLabel(boolean, colDef.typeOptions) ?? ""} ${boolean}`;
|
|
1586
3029
|
}
|
|
1587
3030
|
return text.toLocaleLowerCase().includes(query);
|
|
@@ -1590,7 +3033,7 @@ var filterDataTableRows = (rows, columns, globalFilter, locale = "en") => {
|
|
|
1590
3033
|
var getDataTableFilterColumns = (columns) => columns.flatMap((column) => column.colDef.filterable === false ? [] : ((column.colDef.fields?.length) ? getDataTableFieldColumns(column) : [column]).filter(({ colDef }) => colDef.filterable !== false));
|
|
1591
3034
|
var getDataTableFilterKind = ({
|
|
1592
3035
|
colDef
|
|
1593
|
-
}) => colDef
|
|
3036
|
+
}) => tableFilterKind(colDef, !!colDef.filterOptions);
|
|
1594
3037
|
var getDataTableFilterOptions = (rows, column) => {
|
|
1595
3038
|
const { colDef } = column;
|
|
1596
3039
|
if (colDef.filterOptions)
|
|
@@ -1618,39 +3061,8 @@ var filterDataTableColumnRows = (rows, columns, filters) => {
|
|
|
1618
3061
|
rowIndex: row.index,
|
|
1619
3062
|
colDef: column.colDef
|
|
1620
3063
|
}) : row.values.get(column.id);
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
const text = dataTableValueText(value).toLocaleLowerCase();
|
|
1624
|
-
const query = filter.value.toLocaleLowerCase();
|
|
1625
|
-
switch (filter.operator) {
|
|
1626
|
-
case "contains":
|
|
1627
|
-
return text.includes(query);
|
|
1628
|
-
case "equals":
|
|
1629
|
-
return text === query;
|
|
1630
|
-
case "startsWith":
|
|
1631
|
-
return text.startsWith(query);
|
|
1632
|
-
case "endsWith":
|
|
1633
|
-
return text.endsWith(query);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
case "number": {
|
|
1637
|
-
const number = Option2.getOrUndefined(decodeNumberValue(value));
|
|
1638
|
-
return number !== undefined && (filter.min === undefined || number >= filter.min) && (filter.max === undefined || number <= filter.max);
|
|
1639
|
-
}
|
|
1640
|
-
case "date": {
|
|
1641
|
-
const date = resolveDate(value, column.colDef.type === "dateTime" ? "dateTime" : "date");
|
|
1642
|
-
if (!date)
|
|
1643
|
-
return false;
|
|
1644
|
-
const day = DateTime2.formatIsoDateUtc(date.instant);
|
|
1645
|
-
return (filter.from === undefined || day >= filter.from) && (filter.to === undefined || day <= filter.to);
|
|
1646
|
-
}
|
|
1647
|
-
case "boolean":
|
|
1648
|
-
return Option2.getOrUndefined(decodeBooleanValue(value)) === filter.value;
|
|
1649
|
-
case "values": {
|
|
1650
|
-
const values = column.colDef.type === "list" ? column.colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [dataTableValueText(value)];
|
|
1651
|
-
return filter.values.some((selected) => values.includes(selected));
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
3064
|
+
const { colDef } = column;
|
|
3065
|
+
return matchesTableFilter(filter, value, colDef.type, () => dataTableValueText(value), () => colDef.type === "list" ? colDef.typeOptions.getItems(row.data).map((item) => item.value ?? item.label) : [dataTableValueText(value)]);
|
|
1654
3066
|
}));
|
|
1655
3067
|
};
|
|
1656
3068
|
var sortDataTableRows = (rows, columns, sorting) => {
|
|
@@ -1666,49 +3078,19 @@ var sortDataTableRows = (rows, columns, sorting) => {
|
|
|
1666
3078
|
const leftValue = left.row.values.get(sort.id);
|
|
1667
3079
|
const rightValue = right.row.values.get(sort.id);
|
|
1668
3080
|
const colDef = column.colDef;
|
|
1669
|
-
if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean")) {
|
|
1670
|
-
const
|
|
1671
|
-
const rightScalar = colDef.type === "number" ? Option2.getOrUndefined(decodeNumberValue(rightValue)) : Option2.getOrUndefined(Option2.map(decodeBooleanValue(rightValue), Number));
|
|
1672
|
-
if (leftScalar === undefined || rightScalar === undefined) {
|
|
1673
|
-
if (leftScalar === undefined && rightScalar === undefined)
|
|
1674
|
-
continue;
|
|
1675
|
-
const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
|
|
1676
|
-
return leftScalar === undefined ? nullOrder : -nullOrder;
|
|
1677
|
-
}
|
|
1678
|
-
const comparison = leftScalar - rightScalar;
|
|
3081
|
+
if (!colDef.comparator && (colDef.type === "number" || colDef.type === "boolean" || colDef.type === "date" || colDef.type === "dateTime")) {
|
|
3082
|
+
const comparison = compareTableSortValues(tableSortScalar(colDef.type, leftValue), tableSortScalar(colDef.type, rightValue), sort.direction, colDef.typeOptions?.nulls);
|
|
1679
3083
|
if (comparison !== 0)
|
|
1680
|
-
return
|
|
3084
|
+
return comparison;
|
|
1681
3085
|
continue;
|
|
1682
3086
|
}
|
|
1683
|
-
|
|
1684
|
-
const leftDate = resolveDate(leftValue, colDef.type);
|
|
1685
|
-
const rightDate = resolveDate(rightValue, colDef.type);
|
|
1686
|
-
if (!leftDate || !rightDate) {
|
|
1687
|
-
if (!leftDate && !rightDate)
|
|
1688
|
-
continue;
|
|
1689
|
-
const nullOrder = colDef.typeOptions?.nulls === "first" ? -1 : 1;
|
|
1690
|
-
return !leftDate ? nullOrder : -nullOrder;
|
|
1691
|
-
}
|
|
1692
|
-
const comparison = DateTime2.toEpochMillis(leftDate.instant) - DateTime2.toEpochMillis(rightDate.instant);
|
|
1693
|
-
if (comparison !== 0)
|
|
1694
|
-
return sort.direction === "desc" ? -comparison : comparison;
|
|
1695
|
-
continue;
|
|
1696
|
-
}
|
|
1697
|
-
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema2.is(Schema2.Finite)(leftValue) && Schema2.is(Schema2.Finite)(rightValue) ? leftValue - rightValue : dataTableValueText(leftValue).localeCompare(dataTableValueText(rightValue), undefined, { numeric: true, sensitivity: "base" });
|
|
3087
|
+
const comparison = column.colDef.comparator ? column.colDef.comparator(leftValue, rightValue, left.row.data, right.row.data) : Object.is(leftValue, rightValue) ? 0 : leftValue === null || leftValue === undefined ? 1 : rightValue === null || rightValue === undefined ? -1 : Schema6.is(Schema6.Finite)(leftValue) && Schema6.is(Schema6.Finite)(rightValue) ? leftValue - rightValue : compareTableText(dataTableValueText(leftValue), dataTableValueText(rightValue));
|
|
1698
3088
|
if (comparison !== 0)
|
|
1699
3089
|
return sort.direction === "desc" ? -comparison : comparison;
|
|
1700
3090
|
}
|
|
1701
3091
|
return left.stableIndex - right.stableIndex;
|
|
1702
3092
|
}).map(({ row }) => row);
|
|
1703
3093
|
};
|
|
1704
|
-
var paginateDataTableRows = (rows, pagination) => {
|
|
1705
|
-
const pageSize = Math.max(1, pagination.pageSize);
|
|
1706
|
-
const lastPageIndex = Math.max(0, Math.ceil(rows.length / pageSize) - 1);
|
|
1707
|
-
const pageIndex = Math.min(lastPageIndex, Math.max(0, pagination.page));
|
|
1708
|
-
const start = pageIndex * pageSize;
|
|
1709
|
-
return rows.slice(start, start + pageSize);
|
|
1710
|
-
};
|
|
1711
|
-
var sameDataTableState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort && left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
|
|
1712
3094
|
var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
1713
3095
|
const sourceIndex = rows.findIndex((row) => row.id === sourceRowId);
|
|
1714
3096
|
const targetIndex = rows.findIndex((row) => row.id === targetRowId);
|
|
@@ -1721,10 +3103,10 @@ var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
|
1721
3103
|
reordered.splice(targetIndex, 0, source);
|
|
1722
3104
|
return reordered;
|
|
1723
3105
|
};
|
|
1724
|
-
var RowIdContext =
|
|
1725
|
-
var ColumnIdContext =
|
|
3106
|
+
var RowIdContext = createContext2(null);
|
|
3107
|
+
var ColumnIdContext = createContext2(null);
|
|
1726
3108
|
var useRequiredId = (context) => {
|
|
1727
|
-
const id =
|
|
3109
|
+
const id = useContext2(context);
|
|
1728
3110
|
if (!id)
|
|
1729
3111
|
throw new Error("DataTable internal ID context is missing");
|
|
1730
3112
|
return id;
|
|
@@ -1754,7 +3136,7 @@ var clearDragPresentation = (root) => {
|
|
|
1754
3136
|
element.removeAttribute("data-drop-position");
|
|
1755
3137
|
});
|
|
1756
3138
|
};
|
|
1757
|
-
var resolveConfig = (props
|
|
3139
|
+
var resolveConfig = (props) => {
|
|
1758
3140
|
const features = props.features ?? {};
|
|
1759
3141
|
const selection = features.selection;
|
|
1760
3142
|
const getRowId = selection && selection.getRowId || props.getRowId || undefined;
|
|
@@ -1763,8 +3145,6 @@ var resolveConfig = (props, onUiStateChange) => {
|
|
|
1763
3145
|
}
|
|
1764
3146
|
return {
|
|
1765
3147
|
getRowId,
|
|
1766
|
-
onStateChange: props.onStateChange,
|
|
1767
|
-
onUiStateChange,
|
|
1768
3148
|
status: props.status ?? {},
|
|
1769
3149
|
features,
|
|
1770
3150
|
onRowClicked: props.onRowClicked,
|
|
@@ -1779,83 +3159,39 @@ var queryFromState = (state) => ({
|
|
|
1779
3159
|
filters: state.filters,
|
|
1780
3160
|
sort: state.sort
|
|
1781
3161
|
});
|
|
1782
|
-
var uiFromState = (state) => ({
|
|
1783
|
-
columnVisibility: state.columnVisibility,
|
|
1784
|
-
columnSizing: state.columnSizing,
|
|
1785
|
-
rowSelection: state.rowSelection,
|
|
1786
|
-
grouping: state.grouping,
|
|
1787
|
-
collapsedGroups: state.collapsedGroups,
|
|
1788
|
-
view: state.view
|
|
1789
|
-
});
|
|
1790
|
-
var sameUiState = (left, right) => left.columnVisibility === right.columnVisibility && left.columnSizing === right.columnSizing && left.rowSelection === right.rowSelection && left.grouping === right.grouping && left.collapsedGroups === right.collapsedGroups && left.view === right.view;
|
|
1791
|
-
var sameQueryState = (left, right) => left.page === right.page && left.pageSize === right.pageSize && left.globalFilter === right.globalFilter && left.filters === right.filters && left.sort === right.sort;
|
|
1792
|
-
var initialPublicState = (props, uiState) => ({
|
|
1793
|
-
...queryFromState(props.state ?? { ...DEFAULT_QUERY, ...props.initialState }),
|
|
1794
|
-
...uiState
|
|
1795
|
-
});
|
|
1796
3162
|
var buildDataTableModel = (store) => {
|
|
1797
3163
|
const columns = normalizeDataTableColumns(store.columnDefs, store.state.columnSizing);
|
|
1798
3164
|
const selection = store.config.features.selection;
|
|
1799
3165
|
const rowId = selection && selection.getRowId || store.config.getRowId || undefined;
|
|
1800
3166
|
const rows = buildDataTableRows(store.rowData, columns, rowId);
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
3167
|
+
const page = projectDataTableRows(rows, store.state, {
|
|
3168
|
+
pagination: store.config.features.pagination,
|
|
3169
|
+
grouped: getActiveGrouping(store).length > 0,
|
|
3170
|
+
search: (rows, value) => filterDataTableRows(rows, columns, value, store.config.locale),
|
|
3171
|
+
filter: (rows, filters) => filterDataTableColumnRows(rows, columns, filters),
|
|
3172
|
+
sort: (rows, sorting) => sortDataTableRows(rows, columns, sorting)
|
|
3173
|
+
});
|
|
1807
3174
|
return {
|
|
1808
3175
|
columns,
|
|
1809
3176
|
visibleColumns: columns.filter(({ id }) => store.state.columnVisibility[id] !== false),
|
|
1810
3177
|
rows,
|
|
1811
|
-
filteredRows,
|
|
1812
|
-
sortedRows,
|
|
1813
|
-
pageRows,
|
|
1814
|
-
|
|
1815
|
-
|
|
3178
|
+
filteredRows: page.filtered,
|
|
3179
|
+
sortedRows: page.ordered,
|
|
3180
|
+
pageRows: page.rows,
|
|
3181
|
+
page: page.page,
|
|
3182
|
+
pageCount: page.pageCount,
|
|
3183
|
+
paginationVisible: page.paginationVisible,
|
|
3184
|
+
totalRows: page.totalRows
|
|
1816
3185
|
};
|
|
1817
3186
|
};
|
|
1818
|
-
var useTableAtom = (tableAtom) => useAtom(tableAtom);
|
|
1819
|
-
var changeState = (setStore, update) => {
|
|
1820
|
-
setStore((store) => {
|
|
1821
|
-
const proposed = update(store.state);
|
|
1822
|
-
const query = queryFromState(proposed);
|
|
1823
|
-
if (!sameQueryState(query, store.state)) {
|
|
1824
|
-
store.config.onStateChange?.(query);
|
|
1825
|
-
}
|
|
1826
|
-
const uiState = uiFromState(proposed);
|
|
1827
|
-
if (!sameUiState(uiState, store.state)) {
|
|
1828
|
-
store.config.onUiStateChange(uiState);
|
|
1829
|
-
}
|
|
1830
|
-
const state = store.controlledState ? { ...proposed, ...queryFromState(store.controlledState) } : proposed;
|
|
1831
|
-
if (sameDataTableState(state, store.state))
|
|
1832
|
-
return store;
|
|
1833
|
-
const next = { ...store, state };
|
|
1834
|
-
return { ...next, model: buildDataTableModel(next) };
|
|
1835
|
-
});
|
|
1836
|
-
};
|
|
1837
3187
|
var deriveModel = (store) => store.model;
|
|
1838
3188
|
var groupDataTableRows = (rows, fields, depth = 0, parentKey = "") => {
|
|
1839
3189
|
const field = fields[0];
|
|
1840
3190
|
if (!field)
|
|
1841
3191
|
return [];
|
|
1842
|
-
const groups =
|
|
1843
|
-
field.getGroupIds?.().forEach((id) => groups.set(id, []));
|
|
1844
|
-
rows.forEach((row) => {
|
|
1845
|
-
const ids = field.getRowGroupIds?.(row.data) ?? [
|
|
1846
|
-
field.getGroupId(row.data)
|
|
1847
|
-
];
|
|
1848
|
-
ids.forEach((id) => {
|
|
1849
|
-
const group = groups.get(id);
|
|
1850
|
-
if (group)
|
|
1851
|
-
group.push(row);
|
|
1852
|
-
else
|
|
1853
|
-
groups.set(id, [row]);
|
|
1854
|
-
});
|
|
1855
|
-
});
|
|
3192
|
+
const groups = partitionTableGroups(rows, field.getGroupIds?.() ?? [], (row) => field.getRowGroupIds?.(row.data) ?? [field.getGroupId(row.data)]);
|
|
1856
3193
|
return Array.from(groups, ([groupId, groupRows]) => {
|
|
1857
|
-
const
|
|
1858
|
-
const key = `${parentKey}${parentKey ? "/" : ""}${segment}`;
|
|
3194
|
+
const key = tableGroupKey(parentKey, field.id, groupId);
|
|
1859
3195
|
return {
|
|
1860
3196
|
key,
|
|
1861
3197
|
groupId,
|
|
@@ -1866,15 +3202,9 @@ var groupDataTableRows = (rows, fields, depth = 0, parentKey = "") => {
|
|
|
1866
3202
|
};
|
|
1867
3203
|
});
|
|
1868
3204
|
};
|
|
1869
|
-
var getDataTableSelectableRows = (model, grouped, isRowSelectable) => (grouped ? model.sortedRows : model.pageRows).filter((row) => isRowSelectable?.(row.data) ?? true);
|
|
1870
3205
|
var getActiveGrouping = (store) => {
|
|
1871
3206
|
const grouping = store.config.features.grouping;
|
|
1872
|
-
|
|
1873
|
-
return [];
|
|
1874
|
-
return store.state.grouping.flatMap((id) => {
|
|
1875
|
-
const field = grouping.fields.find((candidate) => candidate.id === id);
|
|
1876
|
-
return field ? [field] : [];
|
|
1877
|
-
});
|
|
3207
|
+
return activeTableGroups(store.state.grouping, grouping && grouping.fields || []);
|
|
1878
3208
|
};
|
|
1879
3209
|
var canReorderRows = (store) => {
|
|
1880
3210
|
const pagination = store.config.features.pagination;
|
|
@@ -1911,7 +3241,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1911
3241
|
if (colDef.type === "number") {
|
|
1912
3242
|
if (colDef.valueFormatter)
|
|
1913
3243
|
return colDef.valueFormatter(params);
|
|
1914
|
-
const number =
|
|
3244
|
+
const number = Option4.getOrUndefined(decodeNumberValue(value));
|
|
1915
3245
|
return /* @__PURE__ */ jsx15("span", {
|
|
1916
3246
|
className: "block text-left tabular-nums",
|
|
1917
3247
|
children: number === undefined ? colDef.typeOptions?.emptyLabel ?? "—" : formatNumberValue(number, colDef.typeOptions, locale)
|
|
@@ -1920,7 +3250,7 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1920
3250
|
if (colDef.type === "boolean") {
|
|
1921
3251
|
if (colDef.valueFormatter)
|
|
1922
3252
|
return colDef.valueFormatter(params);
|
|
1923
|
-
const boolean =
|
|
3253
|
+
const boolean = Option4.getOrUndefined(decodeBooleanValue(value));
|
|
1924
3254
|
if (boolean === undefined)
|
|
1925
3255
|
return colDef.typeOptions?.emptyLabel ?? "—";
|
|
1926
3256
|
const options = colDef.typeOptions;
|
|
@@ -1983,37 +3313,25 @@ var renderCell = (row, column, locale = "en", labels = dataTableMessages(locale)
|
|
|
1983
3313
|
return column.colDef.valueFormatter?.(params) ?? (value === null || value === undefined ? null : dataTableValueText(value));
|
|
1984
3314
|
};
|
|
1985
3315
|
var nodeText = (node) => {
|
|
1986
|
-
if (
|
|
3316
|
+
if (Schema6.is(Schema6.String)(node) || Schema6.is(Schema6.Finite)(node))
|
|
1987
3317
|
return String(node);
|
|
1988
3318
|
if (!isValidElement(node))
|
|
1989
3319
|
return "";
|
|
1990
|
-
if (
|
|
3320
|
+
if (Schema6.is(Schema6.String)(node.props.title))
|
|
1991
3321
|
return node.props.title;
|
|
1992
3322
|
return nodeText(node.props.children);
|
|
1993
3323
|
};
|
|
1994
3324
|
var columnLabel = (column) => nodeText(column.colDef.headerName) || column.id;
|
|
1995
|
-
var withExtension = (fileName, extension) => fileName.includes(".") ? fileName.replace(/\.[^/.]+$/, `.${extension}`) : `${fileName}.${extension}`;
|
|
1996
3325
|
var downloadCsv = (headers, data, fileName = "data.csv") => {
|
|
1997
|
-
|
|
1998
|
-
` })), Stream.runCollect, Effect2.map((parts) => parts.join("").slice(0, -1))));
|
|
1999
|
-
downloadBlob(content, "text/csv;charset=utf-8", withExtension(fileName, "csv"));
|
|
2000
|
-
};
|
|
2001
|
-
var downloadJson = (data, fileName = "data.json") => downloadBlob(JSON.stringify(data, null, 2), "application/json;charset=utf-8", withExtension(fileName, "json"));
|
|
2002
|
-
var downloadBlob = (content, type, fileName) => {
|
|
2003
|
-
const url = window.URL.createObjectURL(new Blob([content], { type }));
|
|
2004
|
-
const link = document.createElement("a");
|
|
2005
|
-
link.href = url;
|
|
2006
|
-
link.download = fileName;
|
|
2007
|
-
document.body.appendChild(link);
|
|
2008
|
-
link.click();
|
|
2009
|
-
link.remove();
|
|
2010
|
-
requestAnimationFrame(() => window.URL.revokeObjectURL(url));
|
|
3326
|
+
downloadTableBlob(encodeTableCsv(headers, data), "text/csv;charset=utf-8", tableExportFilename(fileName, "csv"));
|
|
2011
3327
|
};
|
|
3328
|
+
var downloadJson = (data, fileName = "data.json") => downloadTableBlob(JSON.stringify(data, null, 2), "application/json;charset=utf-8", tableExportFilename(fileName, "json"));
|
|
2012
3329
|
var DataTableRowActions = ({
|
|
2013
3330
|
actions,
|
|
2014
3331
|
row,
|
|
2015
3332
|
title
|
|
2016
3333
|
}) => {
|
|
3334
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
2017
3335
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
2018
3336
|
if (!visible.length)
|
|
2019
3337
|
return null;
|
|
@@ -2022,7 +3340,7 @@ var DataTableRowActions = ({
|
|
|
2022
3340
|
/* @__PURE__ */ jsx15(DropdownMenuTrigger2, {
|
|
2023
3341
|
onClick: (event) => event.stopPropagation(),
|
|
2024
3342
|
render: /* @__PURE__ */ jsxs9(Button, {
|
|
2025
|
-
className: "
|
|
3343
|
+
className: cn(tableClasses.actionTrigger, "[&_svg:not([class*='size-'])]:size-4"),
|
|
2026
3344
|
size: "icon",
|
|
2027
3345
|
variant: "ghost",
|
|
2028
3346
|
children: [
|
|
@@ -2061,10 +3379,10 @@ var DataTableRowActions = ({
|
|
|
2061
3379
|
});
|
|
2062
3380
|
};
|
|
2063
3381
|
var DataTableRowActionMenu = ({
|
|
2064
|
-
|
|
3382
|
+
table,
|
|
2065
3383
|
row
|
|
2066
3384
|
}) => {
|
|
2067
|
-
const [store] =
|
|
3385
|
+
const [store] = table;
|
|
2068
3386
|
const rowId = row.id;
|
|
2069
3387
|
const rowActions = store.config.features.rowActions || undefined;
|
|
2070
3388
|
const reordering = store.config.features.reordering;
|
|
@@ -2098,12 +3416,12 @@ var DataTableRowActionMenu = ({
|
|
|
2098
3416
|
});
|
|
2099
3417
|
};
|
|
2100
3418
|
var DataTableToolbar = ({
|
|
2101
|
-
|
|
3419
|
+
table
|
|
2102
3420
|
}) => {
|
|
2103
|
-
const
|
|
2104
|
-
const
|
|
2105
|
-
const
|
|
2106
|
-
const
|
|
3421
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
3422
|
+
const [store, send] = table;
|
|
3423
|
+
const exportPending = useRef2(false);
|
|
3424
|
+
const { exporting, exportFailed } = store.ui;
|
|
2107
3425
|
const { features, labels } = store.config;
|
|
2108
3426
|
const model = deriveModel(store);
|
|
2109
3427
|
const selectedRows = getSelectedRows(store, model);
|
|
@@ -2113,7 +3431,6 @@ var DataTableToolbar = ({
|
|
|
2113
3431
|
const hasToolbar = !!toolbar || features.search !== false || features.filtering !== false || features.sorting !== false || features.columnVisibility !== false || !!features.export || !!features.gallery || !!grouping || !!features.refresh || !!bulkActions && selectedRows.length > 0;
|
|
2114
3432
|
if (!hasToolbar)
|
|
2115
3433
|
return null;
|
|
2116
|
-
const update = (next) => changeState(setStore, next);
|
|
2117
3434
|
const visibleBulkActions = bulkActions ? bulkActions.items.filter((action) => !action.visible || action.visible(selectedRows)) : [];
|
|
2118
3435
|
const exportRows = features.export && features.export.scope === "currentPage" ? model.pageRows : model.sortedRows;
|
|
2119
3436
|
const exportColumns = getDataTableExportColumns(model.visibleColumns);
|
|
@@ -2125,46 +3442,38 @@ var DataTableToolbar = ({
|
|
|
2125
3442
|
if (exportPending.current || action.disabled)
|
|
2126
3443
|
return;
|
|
2127
3444
|
exportPending.current = true;
|
|
2128
|
-
|
|
2129
|
-
|
|
3445
|
+
send(DataTableMessage.ExportStarted());
|
|
3446
|
+
let failed = false;
|
|
2130
3447
|
try {
|
|
2131
3448
|
await action.onExport();
|
|
2132
3449
|
} catch (error) {
|
|
2133
|
-
|
|
3450
|
+
failed = true;
|
|
2134
3451
|
if (exportFeature)
|
|
2135
3452
|
exportFeature.onError?.(error, action);
|
|
2136
3453
|
} finally {
|
|
2137
3454
|
exportPending.current = false;
|
|
2138
|
-
|
|
3455
|
+
send(DataTableMessage.ExportFinished({ failed }));
|
|
2139
3456
|
}
|
|
2140
3457
|
};
|
|
2141
3458
|
return /* @__PURE__ */ jsxs9("div", {
|
|
2142
|
-
className: cn("
|
|
3459
|
+
className: cn(tableClasses.toolbar, "pb-4"),
|
|
2143
3460
|
children: [
|
|
2144
3461
|
features.search !== false ? /* @__PURE__ */ jsxs9("div", {
|
|
2145
|
-
className:
|
|
3462
|
+
className: tableClasses.toolbarSearch,
|
|
2146
3463
|
children: [
|
|
2147
3464
|
/* @__PURE__ */ jsx15(Search, {
|
|
2148
3465
|
className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2"
|
|
2149
3466
|
}),
|
|
2150
3467
|
/* @__PURE__ */ jsx15(Input2, {
|
|
2151
3468
|
className: "px-9",
|
|
2152
|
-
onChange: (event) =>
|
|
2153
|
-
...state,
|
|
2154
|
-
globalFilter: event.target.value,
|
|
2155
|
-
page: 0
|
|
2156
|
-
})),
|
|
3469
|
+
onChange: (event) => send(DataTableMessage.SearchChanged({ value: event.target.value })),
|
|
2157
3470
|
placeholder: labels.filter,
|
|
2158
3471
|
value: store.state.globalFilter ?? ""
|
|
2159
3472
|
}),
|
|
2160
3473
|
store.state.globalFilter ? /* @__PURE__ */ jsx15(Button, {
|
|
2161
3474
|
"aria-label": labels.filter,
|
|
2162
3475
|
className: "absolute top-1/2 right-1 size-7 -translate-y-1/2 active:not-aria-[haspopup]:-translate-y-1/2",
|
|
2163
|
-
onClick: () =>
|
|
2164
|
-
...state,
|
|
2165
|
-
globalFilter: undefined,
|
|
2166
|
-
page: 0
|
|
2167
|
-
})),
|
|
3476
|
+
onClick: () => send(DataTableMessage.SearchChanged({ value: "" })),
|
|
2168
3477
|
size: "icon",
|
|
2169
3478
|
variant: "ghost",
|
|
2170
3479
|
children: /* @__PURE__ */ jsx15(X, {})
|
|
@@ -2172,19 +3481,19 @@ var DataTableToolbar = ({
|
|
|
2172
3481
|
]
|
|
2173
3482
|
}) : null,
|
|
2174
3483
|
/* @__PURE__ */ jsx15("div", {
|
|
2175
|
-
className:
|
|
3484
|
+
className: tableClasses.toolbarMenus,
|
|
2176
3485
|
children: /* @__PURE__ */ jsxs9(Menubar2, {
|
|
2177
3486
|
modal: false,
|
|
2178
|
-
className: "
|
|
3487
|
+
className: cn(tableClasses.menubar, "[&_[data-slot=menubar-trigger]]:gap-2 [&_[data-slot=menubar-trigger]_svg]:size-4"),
|
|
2179
3488
|
children: [
|
|
2180
3489
|
visibleBulkActions.length ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2181
3490
|
children: [
|
|
2182
3491
|
/* @__PURE__ */ jsxs9(MenubarTrigger2, {
|
|
2183
|
-
className: "
|
|
3492
|
+
className: cn(tableClasses.selectedTrigger, "aria-expanded:bg-primary/90"),
|
|
2184
3493
|
children: [
|
|
2185
3494
|
labels.selected,
|
|
2186
|
-
/* @__PURE__ */ jsx15(
|
|
2187
|
-
|
|
3495
|
+
/* @__PURE__ */ jsx15("span", {
|
|
3496
|
+
className: tableClasses.count,
|
|
2188
3497
|
children: selectedRows.length
|
|
2189
3498
|
}),
|
|
2190
3499
|
/* @__PURE__ */ jsx15(ChevronDown, {})
|
|
@@ -2214,7 +3523,7 @@ var DataTableToolbar = ({
|
|
|
2214
3523
|
}) : null,
|
|
2215
3524
|
toolbar && toolbar.items,
|
|
2216
3525
|
features.filtering !== false ? /* @__PURE__ */ jsx15(FilterMenu, {
|
|
2217
|
-
|
|
3526
|
+
table
|
|
2218
3527
|
}) : null,
|
|
2219
3528
|
grouping ? /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2220
3529
|
children: [
|
|
@@ -2238,10 +3547,7 @@ var DataTableToolbar = ({
|
|
|
2238
3547
|
/* @__PURE__ */ jsx15(MenubarSeparator2, {}),
|
|
2239
3548
|
grouping.fields.map((field) => /* @__PURE__ */ jsx15(MenubarCheckboxItem2, {
|
|
2240
3549
|
checked: store.state.grouping.includes(field.id),
|
|
2241
|
-
onCheckedChange: (
|
|
2242
|
-
...state,
|
|
2243
|
-
grouping: checked ? [...state.grouping, field.id] : state.grouping.filter((id) => id !== field.id)
|
|
2244
|
-
})),
|
|
3550
|
+
onCheckedChange: () => send(DataTableMessage.GroupingToggled({ fieldId: field.id })),
|
|
2245
3551
|
children: field.label
|
|
2246
3552
|
}, field.id))
|
|
2247
3553
|
]
|
|
@@ -2250,13 +3556,13 @@ var DataTableToolbar = ({
|
|
|
2250
3556
|
]
|
|
2251
3557
|
}) : null,
|
|
2252
3558
|
features.sorting !== false ? /* @__PURE__ */ jsx15(SortMenu, {
|
|
2253
|
-
|
|
3559
|
+
table
|
|
2254
3560
|
}) : null,
|
|
2255
3561
|
features.gallery ? /* @__PURE__ */ jsx15(ViewMenu, {
|
|
2256
|
-
|
|
3562
|
+
table
|
|
2257
3563
|
}) : null,
|
|
2258
3564
|
features.columnVisibility !== false ? /* @__PURE__ */ jsx15(ColumnMenu, {
|
|
2259
|
-
|
|
3565
|
+
table
|
|
2260
3566
|
}) : null,
|
|
2261
3567
|
features.refresh ? /* @__PURE__ */ jsx15(MenubarMenu, {
|
|
2262
3568
|
children: /* @__PURE__ */ jsxs9(MenubarTrigger2, {
|
|
@@ -2337,18 +3643,12 @@ var DataTableToolbar = ({
|
|
|
2337
3643
|
}),
|
|
2338
3644
|
exportFeature && exportFailed ? /* @__PURE__ */ jsx15("p", {
|
|
2339
3645
|
role: "alert",
|
|
2340
|
-
className: "text-destructive
|
|
3646
|
+
className: "text-destructive basis-full text-sm",
|
|
2341
3647
|
children: labels.exportFailed ?? dataTableMessages(store.config.locale).exportFailed
|
|
2342
3648
|
}) : null
|
|
2343
3649
|
]
|
|
2344
3650
|
});
|
|
2345
3651
|
};
|
|
2346
|
-
var withColumnFilter = (state, id, filter) => {
|
|
2347
|
-
const filters = (state.filters ?? []).filter((current) => current.id !== id);
|
|
2348
|
-
if (filter)
|
|
2349
|
-
filters.push(filter);
|
|
2350
|
-
return { ...state, page: 0, filters: filters.length ? filters : undefined };
|
|
2351
|
-
};
|
|
2352
3652
|
var FilterEditor = ({
|
|
2353
3653
|
column,
|
|
2354
3654
|
rows,
|
|
@@ -2358,20 +3658,19 @@ var FilterEditor = ({
|
|
|
2358
3658
|
}) => {
|
|
2359
3659
|
const inputId = useId2();
|
|
2360
3660
|
const kind = getDataTableFilterKind(column);
|
|
2361
|
-
const [
|
|
2362
|
-
const
|
|
2363
|
-
const [operator, setOperator] = useState(current?.kind === "text" ? current.operator : "contains");
|
|
3661
|
+
const [draft, setDraft] = useState2(() => tableFilterDraft(column.id, current));
|
|
3662
|
+
const { primary, secondary, operator } = draft;
|
|
2364
3663
|
const operatorOptions = [
|
|
2365
3664
|
{ value: "contains", label: labels.filterContains },
|
|
2366
3665
|
{ value: "equals", label: labels.filterEquals },
|
|
2367
3666
|
{ value: "startsWith", label: labels.filterStartsWith },
|
|
2368
3667
|
{ value: "endsWith", label: labels.filterEndsWith }
|
|
2369
3668
|
];
|
|
2370
|
-
const [invalid, setInvalid] =
|
|
2371
|
-
const [optionSearch, setOptionSearch] =
|
|
3669
|
+
const [invalid, setInvalid] = useState2(false);
|
|
3670
|
+
const [optionSearch, setOptionSearch] = useState2("");
|
|
2372
3671
|
const apply = (candidate) => {
|
|
2373
|
-
const decoded =
|
|
2374
|
-
if (
|
|
3672
|
+
const decoded = parseTableFilterDraft(kind, candidate);
|
|
3673
|
+
if (Option4.isNone(decoded)) {
|
|
2375
3674
|
setInvalid(true);
|
|
2376
3675
|
return;
|
|
2377
3676
|
}
|
|
@@ -2383,7 +3682,7 @@ var FilterEditor = ({
|
|
|
2383
3682
|
children: [
|
|
2384
3683
|
/* @__PURE__ */ jsxs9(MenubarRadioGroup, {
|
|
2385
3684
|
value: current?.kind === "boolean" ? String(current.value) : "",
|
|
2386
|
-
onValueChange: (value) => apply({
|
|
3685
|
+
onValueChange: (value) => apply({ ...draft, primary: value }),
|
|
2387
3686
|
children: [
|
|
2388
3687
|
/* @__PURE__ */ jsx15(MenubarRadioItem2, {
|
|
2389
3688
|
value: "true",
|
|
@@ -2429,9 +3728,9 @@ var FilterEditor = ({
|
|
|
2429
3728
|
checked: selected.includes(option.value),
|
|
2430
3729
|
closeOnClick: false,
|
|
2431
3730
|
onCheckedChange: (checked) => {
|
|
2432
|
-
const values =
|
|
3731
|
+
const values = updateSelectedRows(selected, [option.value], checked);
|
|
2433
3732
|
if (values.length)
|
|
2434
|
-
apply({
|
|
3733
|
+
apply({ ...draft, values });
|
|
2435
3734
|
else
|
|
2436
3735
|
onChange(undefined);
|
|
2437
3736
|
},
|
|
@@ -2468,29 +3767,7 @@ var FilterEditor = ({
|
|
|
2468
3767
|
},
|
|
2469
3768
|
onSubmit: (event) => {
|
|
2470
3769
|
event.preventDefault();
|
|
2471
|
-
|
|
2472
|
-
apply({ id: column.id, kind, operator, value: primary.trim() });
|
|
2473
|
-
else if (kind === "date") {
|
|
2474
|
-
const draft = { id: column.id, kind };
|
|
2475
|
-
if (primary)
|
|
2476
|
-
draft.from = primary;
|
|
2477
|
-
if (secondary)
|
|
2478
|
-
draft.to = secondary;
|
|
2479
|
-
apply(draft);
|
|
2480
|
-
} else {
|
|
2481
|
-
const min = primary ? Schema2.decodeOption(Schema2.FiniteFromString)(primary) : Option2.some(undefined);
|
|
2482
|
-
const max = secondary ? Schema2.decodeOption(Schema2.FiniteFromString)(secondary) : Option2.some(undefined);
|
|
2483
|
-
if (Option2.isNone(min) || Option2.isNone(max)) {
|
|
2484
|
-
setInvalid(true);
|
|
2485
|
-
return;
|
|
2486
|
-
}
|
|
2487
|
-
const draft = { id: column.id, kind };
|
|
2488
|
-
if (min.value !== undefined)
|
|
2489
|
-
draft.min = min.value;
|
|
2490
|
-
if (max.value !== undefined)
|
|
2491
|
-
draft.max = max.value;
|
|
2492
|
-
apply(draft);
|
|
2493
|
-
}
|
|
3770
|
+
apply(draft);
|
|
2494
3771
|
},
|
|
2495
3772
|
children: [
|
|
2496
3773
|
/* @__PURE__ */ jsxs9(FieldGroup, {
|
|
@@ -2505,9 +3782,9 @@ var FilterEditor = ({
|
|
|
2505
3782
|
items: operatorOptions,
|
|
2506
3783
|
value: operator,
|
|
2507
3784
|
onValueChange: (value) => {
|
|
2508
|
-
const decoded =
|
|
2509
|
-
if (
|
|
2510
|
-
|
|
3785
|
+
const decoded = Schema6.decodeUnknownOption(TextFilterOperator)(value);
|
|
3786
|
+
if (Option4.isSome(decoded))
|
|
3787
|
+
setDraft({ ...draft, operator: decoded.value });
|
|
2511
3788
|
},
|
|
2512
3789
|
children: [
|
|
2513
3790
|
/* @__PURE__ */ jsx15(SelectTrigger, {
|
|
@@ -2540,7 +3817,7 @@ var FilterEditor = ({
|
|
|
2540
3817
|
value: primary,
|
|
2541
3818
|
"aria-invalid": invalid || undefined,
|
|
2542
3819
|
onChange: (event) => {
|
|
2543
|
-
|
|
3820
|
+
setDraft({ ...draft, primary: event.target.value });
|
|
2544
3821
|
setInvalid(false);
|
|
2545
3822
|
}
|
|
2546
3823
|
})
|
|
@@ -2560,7 +3837,7 @@ var FilterEditor = ({
|
|
|
2560
3837
|
value: secondary,
|
|
2561
3838
|
"aria-invalid": invalid || undefined,
|
|
2562
3839
|
onChange: (event) => {
|
|
2563
|
-
|
|
3840
|
+
setDraft({ ...draft, secondary: event.target.value });
|
|
2564
3841
|
setInvalid(false);
|
|
2565
3842
|
}
|
|
2566
3843
|
})
|
|
@@ -2586,8 +3863,7 @@ var FilterEditor = ({
|
|
|
2586
3863
|
size: "sm",
|
|
2587
3864
|
variant: "outline",
|
|
2588
3865
|
onClick: () => {
|
|
2589
|
-
|
|
2590
|
-
setSecondary("");
|
|
3866
|
+
setDraft({ ...draft, primary: "", secondary: "" });
|
|
2591
3867
|
setInvalid(false);
|
|
2592
3868
|
onChange(undefined);
|
|
2593
3869
|
},
|
|
@@ -2599,9 +3875,9 @@ var FilterEditor = ({
|
|
|
2599
3875
|
});
|
|
2600
3876
|
};
|
|
2601
3877
|
var FilterMenu = ({
|
|
2602
|
-
|
|
3878
|
+
table
|
|
2603
3879
|
}) => {
|
|
2604
|
-
const [store,
|
|
3880
|
+
const [store, send] = table;
|
|
2605
3881
|
const model = deriveModel(store);
|
|
2606
3882
|
const columns = model.columns.flatMap((parent) => getDataTableFilterColumns([parent]).map((column) => ({
|
|
2607
3883
|
column,
|
|
@@ -2610,7 +3886,7 @@ var FilterMenu = ({
|
|
|
2610
3886
|
if (!columns.length)
|
|
2611
3887
|
return null;
|
|
2612
3888
|
const filters = store.state.filters ?? [];
|
|
2613
|
-
const update = (id, filter) =>
|
|
3889
|
+
const update = (id, filter) => send(DataTableMessage.ColumnFilterChanged({ id, filter: filter ?? null }));
|
|
2614
3890
|
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2615
3891
|
children: [
|
|
2616
3892
|
/* @__PURE__ */ jsxs9(MenubarTrigger2, {
|
|
@@ -2663,11 +3939,7 @@ var FilterMenu = ({
|
|
|
2663
3939
|
children: [
|
|
2664
3940
|
/* @__PURE__ */ jsx15(MenubarSeparator2, {}),
|
|
2665
3941
|
/* @__PURE__ */ jsxs9(MenubarItem2, {
|
|
2666
|
-
onClick: () =>
|
|
2667
|
-
...state,
|
|
2668
|
-
page: 0,
|
|
2669
|
-
filters: undefined
|
|
2670
|
-
})),
|
|
3942
|
+
onClick: () => send(DataTableMessage.FiltersCleared()),
|
|
2671
3943
|
children: [
|
|
2672
3944
|
/* @__PURE__ */ jsx15(X, {}),
|
|
2673
3945
|
store.config.labels.filtersClear
|
|
@@ -2682,9 +3954,9 @@ var FilterMenu = ({
|
|
|
2682
3954
|
});
|
|
2683
3955
|
};
|
|
2684
3956
|
var SortMenu = ({
|
|
2685
|
-
|
|
3957
|
+
table
|
|
2686
3958
|
}) => {
|
|
2687
|
-
const [store,
|
|
3959
|
+
const [store, send] = table;
|
|
2688
3960
|
const columns = deriveModel(store).columns.flatMap((column) => getDataTableSortColumns([column]).map((field) => field.id === column.id ? field : {
|
|
2689
3961
|
...field,
|
|
2690
3962
|
colDef: {
|
|
@@ -2695,11 +3967,7 @@ var SortMenu = ({
|
|
|
2695
3967
|
if (!columns.length)
|
|
2696
3968
|
return null;
|
|
2697
3969
|
const current = store.state.sort?.[0];
|
|
2698
|
-
const sort = (id, direction) =>
|
|
2699
|
-
...state,
|
|
2700
|
-
sort: [{ id, direction }],
|
|
2701
|
-
page: 0
|
|
2702
|
-
}));
|
|
3970
|
+
const sort = (id, direction) => send(DataTableMessage.SortRequested({ columnId: id, direction }));
|
|
2703
3971
|
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2704
3972
|
children: [
|
|
2705
3973
|
/* @__PURE__ */ jsxs9(MenubarTrigger2, {
|
|
@@ -2753,9 +4021,9 @@ var SortMenu = ({
|
|
|
2753
4021
|
children: [
|
|
2754
4022
|
/* @__PURE__ */ jsx15(MenubarSeparator2, {}),
|
|
2755
4023
|
/* @__PURE__ */ jsxs9(MenubarItem2, {
|
|
2756
|
-
onClick: () =>
|
|
2757
|
-
|
|
2758
|
-
|
|
4024
|
+
onClick: () => send(DataTableMessage.SortRequested({
|
|
4025
|
+
columnId: column.id,
|
|
4026
|
+
direction: null
|
|
2759
4027
|
})),
|
|
2760
4028
|
children: [
|
|
2761
4029
|
/* @__PURE__ */ jsx15(X, {}),
|
|
@@ -2777,9 +4045,9 @@ var SortMenu = ({
|
|
|
2777
4045
|
});
|
|
2778
4046
|
};
|
|
2779
4047
|
var ViewMenu = ({
|
|
2780
|
-
|
|
4048
|
+
table
|
|
2781
4049
|
}) => {
|
|
2782
|
-
const [store,
|
|
4050
|
+
const [store, send] = table;
|
|
2783
4051
|
return /* @__PURE__ */ jsxs9(MenubarMenu, {
|
|
2784
4052
|
children: [
|
|
2785
4053
|
/* @__PURE__ */ jsxs9(MenubarTrigger2, {
|
|
@@ -2802,12 +4070,9 @@ var ViewMenu = ({
|
|
|
2802
4070
|
/* @__PURE__ */ jsx15(MenubarSeparator2, {}),
|
|
2803
4071
|
/* @__PURE__ */ jsxs9(MenubarRadioGroup, {
|
|
2804
4072
|
onValueChange: (input) => {
|
|
2805
|
-
const view =
|
|
2806
|
-
if (
|
|
2807
|
-
|
|
2808
|
-
...state,
|
|
2809
|
-
view: view.value
|
|
2810
|
-
}));
|
|
4073
|
+
const view = Schema6.decodeUnknownOption(DataTableViewSchema)(input);
|
|
4074
|
+
if (Option4.isSome(view)) {
|
|
4075
|
+
send(DataTableMessage.ViewPicked({ view: view.value }));
|
|
2811
4076
|
}
|
|
2812
4077
|
},
|
|
2813
4078
|
value: store.state.view,
|
|
@@ -2837,9 +4102,9 @@ var ViewMenu = ({
|
|
|
2837
4102
|
});
|
|
2838
4103
|
};
|
|
2839
4104
|
var ColumnMenu = ({
|
|
2840
|
-
|
|
4105
|
+
table
|
|
2841
4106
|
}) => {
|
|
2842
|
-
const [store,
|
|
4107
|
+
const [store, send] = table;
|
|
2843
4108
|
const columns = deriveModel(store).columns.filter(({ colDef }) => colDef.hideable !== false);
|
|
2844
4109
|
if (!columns.length)
|
|
2845
4110
|
return null;
|
|
@@ -2865,13 +4130,7 @@ var ColumnMenu = ({
|
|
|
2865
4130
|
/* @__PURE__ */ jsx15(MenubarSeparator2, {}),
|
|
2866
4131
|
columns.map((column) => /* @__PURE__ */ jsx15(MenubarCheckboxItem2, {
|
|
2867
4132
|
checked: store.state.columnVisibility[column.id] !== false,
|
|
2868
|
-
onCheckedChange: (visible) =>
|
|
2869
|
-
...state,
|
|
2870
|
-
columnVisibility: {
|
|
2871
|
-
...state.columnVisibility,
|
|
2872
|
-
[column.id]: visible
|
|
2873
|
-
}
|
|
2874
|
-
})),
|
|
4133
|
+
onCheckedChange: (visible) => send(DataTableMessage.ColumnVisibilityChanged({ id: column.id, visible })),
|
|
2875
4134
|
children: columnLabel(column)
|
|
2876
4135
|
}, column.id))
|
|
2877
4136
|
]
|
|
@@ -2881,54 +4140,43 @@ var ColumnMenu = ({
|
|
|
2881
4140
|
});
|
|
2882
4141
|
};
|
|
2883
4142
|
var ResizeHandle = ({
|
|
2884
|
-
|
|
4143
|
+
table
|
|
2885
4144
|
}) => {
|
|
2886
|
-
const
|
|
4145
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4146
|
+
const [store, send] = table;
|
|
2887
4147
|
const columnId = useRequiredId(ColumnIdContext);
|
|
2888
|
-
const resizeRef = useRef(null);
|
|
2889
4148
|
const column = deriveModel(store).columns.find(({ id }) => id === columnId);
|
|
2890
4149
|
if (!column || column.colDef.resizable === false)
|
|
2891
4150
|
return null;
|
|
2892
|
-
const
|
|
2893
|
-
...state,
|
|
2894
|
-
columnSizing: {
|
|
2895
|
-
...state.columnSizing,
|
|
2896
|
-
[column.id]: clampWidth(column.colDef, width)
|
|
2897
|
-
}
|
|
2898
|
-
}));
|
|
4151
|
+
const { min, max } = tableColumnLimits(column.colDef);
|
|
2899
4152
|
const onPointerDown = (event) => {
|
|
2900
4153
|
if (event.button !== 0)
|
|
2901
4154
|
return;
|
|
2902
4155
|
event.preventDefault();
|
|
2903
4156
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
};
|
|
4157
|
+
send(DataTableMessage.ResizeStarted({
|
|
4158
|
+
id: column.id,
|
|
4159
|
+
x: event.clientX,
|
|
4160
|
+
pointerId: event.pointerId
|
|
4161
|
+
}));
|
|
2909
4162
|
};
|
|
2910
4163
|
const onPointerMove = (event) => {
|
|
2911
|
-
|
|
2912
|
-
if (!drag || drag.pointerId !== event.pointerId)
|
|
2913
|
-
return;
|
|
2914
|
-
resize(drag.startWidth + event.clientX - drag.startX);
|
|
2915
|
-
};
|
|
2916
|
-
const reset = () => {
|
|
2917
|
-
resizeRef.current = null;
|
|
4164
|
+
send(DataTableMessage.ResizeMoved({ x: event.clientX, pointerId: event.pointerId }));
|
|
2918
4165
|
};
|
|
4166
|
+
const reset = (event) => send(DataTableMessage.ResizeEnded({ pointerId: event.pointerId }));
|
|
2919
4167
|
return /* @__PURE__ */ jsx15("button", {
|
|
2920
4168
|
"aria-label": store.config.labels.resizeColumn(columnLabel(column)),
|
|
2921
4169
|
"aria-orientation": "vertical",
|
|
2922
|
-
"aria-valuemax":
|
|
2923
|
-
"aria-valuemin":
|
|
4170
|
+
"aria-valuemax": max,
|
|
4171
|
+
"aria-valuemin": min,
|
|
2924
4172
|
"aria-valuenow": column.width,
|
|
2925
|
-
className:
|
|
2926
|
-
onDoubleClick: () =>
|
|
4173
|
+
className: tableClasses.resizeHandle,
|
|
4174
|
+
onDoubleClick: () => send(DataTableMessage.ColumnResizeReset({ id: column.id })),
|
|
2927
4175
|
onKeyDown: (event) => {
|
|
2928
|
-
const delta = event.key
|
|
4176
|
+
const delta = tableResizeStep(event.key);
|
|
2929
4177
|
if (delta) {
|
|
2930
4178
|
event.preventDefault();
|
|
2931
|
-
|
|
4179
|
+
send(DataTableMessage.ColumnResized({ id: column.id, delta }));
|
|
2932
4180
|
}
|
|
2933
4181
|
},
|
|
2934
4182
|
onPointerDown,
|
|
@@ -2941,12 +4189,12 @@ var ResizeHandle = ({
|
|
|
2941
4189
|
});
|
|
2942
4190
|
};
|
|
2943
4191
|
var DragHandle = ({
|
|
2944
|
-
|
|
4192
|
+
table
|
|
2945
4193
|
}) => {
|
|
2946
|
-
const [store
|
|
4194
|
+
const [store] = table;
|
|
2947
4195
|
const rowId = useRequiredId(RowIdContext);
|
|
2948
|
-
const dragRef =
|
|
2949
|
-
const [overlay, setOverlay] =
|
|
4196
|
+
const dragRef = useRef2(null);
|
|
4197
|
+
const [overlay, setOverlay] = useState2(null);
|
|
2950
4198
|
const reset = (element) => {
|
|
2951
4199
|
clearDragPresentation(element.closest("[data-table-root]"));
|
|
2952
4200
|
dragRef.current = null;
|
|
@@ -3001,7 +4249,8 @@ var DragHandle = ({
|
|
|
3001
4249
|
const elements = document.elementsFromPoint(event.clientX, event.clientY);
|
|
3002
4250
|
const rowTarget = findTableDragTarget(elements, "[data-table-row]", root);
|
|
3003
4251
|
const groupTarget = findTableDragTarget(elements, "[data-table-group]", root);
|
|
3004
|
-
|
|
4252
|
+
if (drag.active) {
|
|
4253
|
+
const current = store;
|
|
3005
4254
|
const targetRowId = rowTarget?.dataset.tableRow;
|
|
3006
4255
|
const targetGroupKey = groupTarget?.dataset.tableGroup;
|
|
3007
4256
|
const model = deriveModel(current);
|
|
@@ -3017,8 +4266,7 @@ var DragHandle = ({
|
|
|
3017
4266
|
} else if (drag.active && source && targetRowId && reordering && canReorderRows(current) && source.id !== targetRowId) {
|
|
3018
4267
|
reordering.onReorder(reorderDataTableRows(model.rows, source.id, targetRowId));
|
|
3019
4268
|
}
|
|
3020
|
-
|
|
3021
|
-
});
|
|
4269
|
+
}
|
|
3022
4270
|
reset(event.currentTarget);
|
|
3023
4271
|
};
|
|
3024
4272
|
const cancel = (event) => {
|
|
@@ -3069,22 +4317,15 @@ var DragHandle = ({
|
|
|
3069
4317
|
]
|
|
3070
4318
|
});
|
|
3071
4319
|
};
|
|
3072
|
-
var toggleRow = (
|
|
3073
|
-
const rowSelection = { ...state.rowSelection, [rowId]: selected };
|
|
3074
|
-
const selection = store.config.features.selection;
|
|
3075
|
-
if (selection) {
|
|
3076
|
-
const model = deriveModel(store);
|
|
3077
|
-
selection.onSelectionChange?.(model.rows.filter((row) => rowSelection[row.id]).map((row) => row.data));
|
|
3078
|
-
}
|
|
3079
|
-
return { ...state, rowSelection };
|
|
3080
|
-
});
|
|
4320
|
+
var toggleRow = (send, rowId, checked) => send(DataTableMessage.SelectionRequested({ rowIds: [rowId], checked }));
|
|
3081
4321
|
var TableDataRow = ({
|
|
3082
|
-
|
|
4322
|
+
table,
|
|
3083
4323
|
row,
|
|
3084
4324
|
virtualIndex,
|
|
3085
4325
|
measureRef
|
|
3086
4326
|
}) => {
|
|
3087
|
-
const
|
|
4327
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4328
|
+
const [store, send] = table;
|
|
3088
4329
|
const model = deriveModel(store);
|
|
3089
4330
|
const selection = store.config.features.selection;
|
|
3090
4331
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
@@ -3106,37 +4347,40 @@ var TableDataRow = ({
|
|
|
3106
4347
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
3107
4348
|
children: [
|
|
3108
4349
|
selection ? /* @__PURE__ */ jsx15(TableCell2, {
|
|
3109
|
-
className:
|
|
4350
|
+
className: tableClasses.selectionCell,
|
|
3110
4351
|
onClick: (event) => event.stopPropagation(),
|
|
3111
|
-
children: /* @__PURE__ */ jsx15(
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
4352
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
4353
|
+
className: tableClasses.selectionCenter,
|
|
4354
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
4355
|
+
"aria-label": store.config.labels.selectRow,
|
|
4356
|
+
checked: !!store.state.rowSelection[row.id],
|
|
4357
|
+
disabled: !selectable,
|
|
4358
|
+
onCheckedChange: (checked) => toggleRow(send, row.id, checked)
|
|
4359
|
+
})
|
|
3116
4360
|
})
|
|
3117
4361
|
}) : null,
|
|
3118
4362
|
draggable ? /* @__PURE__ */ jsx15(TableCell2, {
|
|
3119
4363
|
className: "w-10 pr-0",
|
|
3120
4364
|
children: /* @__PURE__ */ jsx15(DragHandle, {
|
|
3121
|
-
|
|
4365
|
+
table
|
|
3122
4366
|
})
|
|
3123
4367
|
}) : null,
|
|
3124
4368
|
model.visibleColumns.map((column) => /* @__PURE__ */ jsx15(TableCell2, {
|
|
3125
|
-
className: cn("min-w-24
|
|
4369
|
+
className: cn(tableClasses.cell, "min-w-24 has-[[data-slot=data-table-boolean-cell]]:relative has-[[data-slot=data-table-boolean-cell]]:p-0 has-[[data-slot=data-table-list-cell]]:relative has-[[data-slot=data-table-list-cell]]:p-0", column.colDef.truncate ? "whitespace-nowrap" : "whitespace-normal"),
|
|
3126
4370
|
style: { width: column.width },
|
|
3127
4371
|
children: /* @__PURE__ */ jsx15("div", {
|
|
3128
|
-
className: cn(
|
|
4372
|
+
className: cn(tableClasses.cellContent, column.colDef.truncate && "truncate"),
|
|
3129
4373
|
children: renderCell(row, column, store.config.locale, store.config.labels)
|
|
3130
4374
|
})
|
|
3131
4375
|
}, column.id)),
|
|
3132
4376
|
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15(TableCell2, {
|
|
3133
|
-
className: "
|
|
4377
|
+
className: cn(tableClasses.actionsCell, "group-data-[state=selected]/row:bg-muted"),
|
|
3134
4378
|
onClick: (event) => event.stopPropagation(),
|
|
3135
4379
|
children: /* @__PURE__ */ jsx15("div", {
|
|
3136
|
-
className:
|
|
4380
|
+
className: tableClasses.actionsAlign,
|
|
3137
4381
|
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3138
4382
|
row,
|
|
3139
|
-
|
|
4383
|
+
table
|
|
3140
4384
|
})
|
|
3141
4385
|
})
|
|
3142
4386
|
}) : null
|
|
@@ -3186,35 +4430,30 @@ var GroupActions = ({
|
|
|
3186
4430
|
});
|
|
3187
4431
|
};
|
|
3188
4432
|
var GroupHeaderRow = ({
|
|
3189
|
-
|
|
4433
|
+
table,
|
|
3190
4434
|
section,
|
|
3191
4435
|
colSpan,
|
|
3192
4436
|
virtualIndex,
|
|
3193
4437
|
measureRef
|
|
3194
4438
|
}) => {
|
|
3195
|
-
const
|
|
4439
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4440
|
+
const [store, send] = table;
|
|
3196
4441
|
const collapsed = !!store.state.collapsedGroups[section.key];
|
|
3197
4442
|
return /* @__PURE__ */ jsx15(TableRow2, {
|
|
3198
4443
|
ref: measureRef,
|
|
3199
4444
|
"data-index": virtualIndex,
|
|
3200
4445
|
"aria-rowindex": virtualIndex === undefined ? undefined : virtualIndex + 2,
|
|
3201
|
-
className: "
|
|
3202
|
-
onClick: () =>
|
|
3203
|
-
...state,
|
|
3204
|
-
collapsedGroups: {
|
|
3205
|
-
...state.collapsedGroups,
|
|
3206
|
-
[section.key]: !collapsed
|
|
3207
|
-
}
|
|
3208
|
-
})),
|
|
4446
|
+
className: cn(tableClasses.group, "cursor-pointer"),
|
|
4447
|
+
onClick: () => send(DataTableMessage.GroupToggled({ key: section.key })),
|
|
3209
4448
|
children: /* @__PURE__ */ jsx15(TableCell2, {
|
|
3210
4449
|
className: "p-0",
|
|
3211
4450
|
colSpan,
|
|
3212
4451
|
children: /* @__PURE__ */ jsxs9("div", {
|
|
3213
|
-
className:
|
|
4452
|
+
className: cn(tableClasses.groupContent, tableClasses.groupSticky),
|
|
3214
4453
|
children: [
|
|
3215
4454
|
/* @__PURE__ */ jsxs9("button", {
|
|
3216
4455
|
"aria-expanded": !collapsed,
|
|
3217
|
-
className:
|
|
4456
|
+
className: tableClasses.groupTrigger,
|
|
3218
4457
|
style: { paddingLeft: section.depth * 20 },
|
|
3219
4458
|
type: "button",
|
|
3220
4459
|
children: [
|
|
@@ -3229,9 +4468,8 @@ var GroupHeaderRow = ({
|
|
|
3229
4468
|
})
|
|
3230
4469
|
]
|
|
3231
4470
|
}),
|
|
3232
|
-
/* @__PURE__ */ jsx15(
|
|
3233
|
-
className:
|
|
3234
|
-
variant: "secondary",
|
|
4471
|
+
/* @__PURE__ */ jsx15("span", {
|
|
4472
|
+
className: tableClasses.count,
|
|
3235
4473
|
children: section.rows.length
|
|
3236
4474
|
}),
|
|
3237
4475
|
/* @__PURE__ */ jsx15(GroupActions, {
|
|
@@ -3245,10 +4483,10 @@ var GroupHeaderRow = ({
|
|
|
3245
4483
|
});
|
|
3246
4484
|
};
|
|
3247
4485
|
var GroupedTable = ({
|
|
3248
|
-
|
|
4486
|
+
table,
|
|
3249
4487
|
sections
|
|
3250
4488
|
}) => {
|
|
3251
|
-
const [store] =
|
|
4489
|
+
const [store] = table;
|
|
3252
4490
|
const model = deriveModel(store);
|
|
3253
4491
|
const extra = (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
|
|
3254
4492
|
const renderSections = (items) => items.flatMap((section) => {
|
|
@@ -3259,7 +4497,7 @@ var GroupedTable = ({
|
|
|
3259
4497
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
3260
4498
|
children: [
|
|
3261
4499
|
/* @__PURE__ */ jsx15(GroupHeaderRow, {
|
|
3262
|
-
|
|
4500
|
+
table,
|
|
3263
4501
|
section,
|
|
3264
4502
|
colSpan: model.visibleColumns.length + extra
|
|
3265
4503
|
}),
|
|
@@ -3267,7 +4505,7 @@ var GroupedTable = ({
|
|
|
3267
4505
|
value: row.id,
|
|
3268
4506
|
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
3269
4507
|
row,
|
|
3270
|
-
|
|
4508
|
+
table
|
|
3271
4509
|
})
|
|
3272
4510
|
}, `${section.key}:${row.id}`)) : [
|
|
3273
4511
|
/* @__PURE__ */ jsx15(TableRow2, {
|
|
@@ -3287,9 +4525,10 @@ var GroupedTable = ({
|
|
|
3287
4525
|
});
|
|
3288
4526
|
};
|
|
3289
4527
|
var ColumnHeaderMenu = ({
|
|
3290
|
-
|
|
4528
|
+
table
|
|
3291
4529
|
}) => {
|
|
3292
|
-
const
|
|
4530
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4531
|
+
const [store, send] = table;
|
|
3293
4532
|
const columnId = useRequiredId(ColumnIdContext);
|
|
3294
4533
|
const model = deriveModel(store);
|
|
3295
4534
|
const column = model.columns.find(({ id }) => id === columnId);
|
|
@@ -3305,18 +4544,13 @@ var ColumnHeaderMenu = ({
|
|
|
3305
4544
|
rows: model.rows,
|
|
3306
4545
|
current: store.state.filters?.find((filter) => filter.id === field.id),
|
|
3307
4546
|
labels: store.config.labels,
|
|
3308
|
-
onChange: (filter) =>
|
|
4547
|
+
onChange: (filter) => send(DataTableMessage.ColumnFilterChanged({ id: field.id, filter: filter ?? null }))
|
|
3309
4548
|
});
|
|
3310
4549
|
const sortingEnabled = store.config.features.sorting !== false && sortColumns.length > 0;
|
|
3311
4550
|
const hidingEnabled = store.config.features.columnVisibility !== false && column.colDef.hideable !== false;
|
|
3312
4551
|
const ownsSort = (id) => id === column.id || sortColumns.some((field) => field.id === id);
|
|
3313
4552
|
const sort = store.state.sort?.find(({ id }) => ownsSort(id));
|
|
3314
|
-
const
|
|
3315
|
-
const setSort = (id, direction) => update((state) => ({
|
|
3316
|
-
...state,
|
|
3317
|
-
sort: [{ id, direction }],
|
|
3318
|
-
page: 0
|
|
3319
|
-
}));
|
|
4553
|
+
const setSort = (id, direction) => send(DataTableMessage.SortRequested({ columnId: id, direction }));
|
|
3320
4554
|
const label = columnLabel(column);
|
|
3321
4555
|
const sortItems = (field) => /* @__PURE__ */ jsxs9(Fragment, {
|
|
3322
4556
|
children: [
|
|
@@ -3350,7 +4584,7 @@ var ColumnHeaderMenu = ({
|
|
|
3350
4584
|
render: /* @__PURE__ */ jsxs9(Button, {
|
|
3351
4585
|
"aria-label": label,
|
|
3352
4586
|
"aria-description": activeFilters.length ? `${store.config.labels.filters}: ${activeFilters.length}` : undefined,
|
|
3353
|
-
className:
|
|
4587
|
+
className: tableClasses.headerTrigger,
|
|
3354
4588
|
variant: "ghost",
|
|
3355
4589
|
children: [
|
|
3356
4590
|
/* @__PURE__ */ jsx15("span", {
|
|
@@ -3382,10 +4616,7 @@ var ColumnHeaderMenu = ({
|
|
|
3382
4616
|
]
|
|
3383
4617
|
}, field.id)) : sortItems(column),
|
|
3384
4618
|
sort ? /* @__PURE__ */ jsxs9(DropdownMenuItem2, {
|
|
3385
|
-
onClick: () =>
|
|
3386
|
-
...state,
|
|
3387
|
-
sort: state.sort?.filter(({ id }) => !ownsSort(id))
|
|
3388
|
-
})),
|
|
4619
|
+
onClick: () => send(DataTableMessage.ColumnSortCleared({ id: column.id })),
|
|
3389
4620
|
children: [
|
|
3390
4621
|
/* @__PURE__ */ jsx15(X, {}),
|
|
3391
4622
|
" ",
|
|
@@ -3427,14 +4658,7 @@ var ColumnHeaderMenu = ({
|
|
|
3427
4658
|
]
|
|
3428
4659
|
}),
|
|
3429
4660
|
activeFilters.length ? /* @__PURE__ */ jsxs9(DropdownMenuItem2, {
|
|
3430
|
-
onClick: () =>
|
|
3431
|
-
const filters = state.filters?.filter(({ id }) => !ownsFilter(id));
|
|
3432
|
-
return {
|
|
3433
|
-
...state,
|
|
3434
|
-
page: 0,
|
|
3435
|
-
filters: filters?.length ? filters : undefined
|
|
3436
|
-
};
|
|
3437
|
-
}),
|
|
4661
|
+
onClick: () => send(DataTableMessage.ColumnFiltersCleared({ id: column.id })),
|
|
3438
4662
|
children: [
|
|
3439
4663
|
/* @__PURE__ */ jsx15(X, {}),
|
|
3440
4664
|
store.config.labels.filterClear
|
|
@@ -3444,12 +4668,9 @@ var ColumnHeaderMenu = ({
|
|
|
3444
4668
|
}) : null,
|
|
3445
4669
|
(sortingEnabled || filteringEnabled) && hidingEnabled ? /* @__PURE__ */ jsx15(DropdownMenuSeparator2, {}) : null,
|
|
3446
4670
|
hidingEnabled ? /* @__PURE__ */ jsxs9(DropdownMenuItem2, {
|
|
3447
|
-
onClick: () =>
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
...state.columnVisibility,
|
|
3451
|
-
[column.id]: false
|
|
3452
|
-
}
|
|
4671
|
+
onClick: () => send(DataTableMessage.ColumnVisibilityChanged({
|
|
4672
|
+
id: column.id,
|
|
4673
|
+
visible: false
|
|
3453
4674
|
})),
|
|
3454
4675
|
children: [
|
|
3455
4676
|
/* @__PURE__ */ jsx15(EyeOff, {}),
|
|
@@ -3464,36 +4685,37 @@ var ColumnHeaderMenu = ({
|
|
|
3464
4685
|
});
|
|
3465
4686
|
};
|
|
3466
4687
|
var DataTableHeader = ({
|
|
3467
|
-
|
|
4688
|
+
table,
|
|
3468
4689
|
sticky
|
|
3469
4690
|
}) => {
|
|
3470
|
-
const
|
|
4691
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4692
|
+
const [store, send] = table;
|
|
3471
4693
|
const model = deriveModel(store);
|
|
3472
4694
|
const selection = store.config.features.selection;
|
|
3473
|
-
const grouped = getActiveGrouping(store).length > 0;
|
|
3474
4695
|
const draggable = canDragRows(store);
|
|
3475
|
-
const selectableRows =
|
|
4696
|
+
const selectableRows = model.pageRows.filter((row) => !selection || (selection.isRowSelectable?.(row.data) ?? true));
|
|
3476
4697
|
const allSelected = selectableRows.length > 0 && selectableRows.every((row) => store.state.rowSelection[row.id]);
|
|
3477
4698
|
const someSelected = selectableRows.some((row) => store.state.rowSelection[row.id]);
|
|
3478
4699
|
return /* @__PURE__ */ jsx15(TableHeader2, {
|
|
3479
|
-
className: sticky ?
|
|
4700
|
+
className: sticky ? cn(tableClasses.stickyHeader, tableClasses.stickyHeaderRule, "[&_tr]:border-b-0") : undefined,
|
|
3480
4701
|
children: /* @__PURE__ */ jsxs9(TableRow2, {
|
|
3481
4702
|
"aria-rowindex": sticky ? 1 : undefined,
|
|
3482
4703
|
children: [
|
|
3483
4704
|
selection ? /* @__PURE__ */ jsx15(TableHead2, {
|
|
3484
|
-
className:
|
|
3485
|
-
children: /* @__PURE__ */ jsx15(
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
4705
|
+
className: tableClasses.selectionCell,
|
|
4706
|
+
children: /* @__PURE__ */ jsx15("div", {
|
|
4707
|
+
className: tableClasses.selectionCenter,
|
|
4708
|
+
children: /* @__PURE__ */ jsx15(Checkbox, {
|
|
4709
|
+
"aria-label": store.config.labels.selectAllRows,
|
|
4710
|
+
checked: allSelected,
|
|
4711
|
+
indeterminate: someSelected && !allSelected,
|
|
4712
|
+
onCheckedChange: (checked) => {
|
|
4713
|
+
send(DataTableMessage.SelectionRequested({
|
|
4714
|
+
rowIds: selectableRows.map(({ id }) => id),
|
|
4715
|
+
checked
|
|
4716
|
+
}));
|
|
4717
|
+
}
|
|
4718
|
+
})
|
|
3497
4719
|
})
|
|
3498
4720
|
}) : null,
|
|
3499
4721
|
draggable ? /* @__PURE__ */ jsx15(TableHead2, {
|
|
@@ -3503,17 +4725,17 @@ var DataTableHeader = ({
|
|
|
3503
4725
|
const direction = store.state.sort?.find(({ id }) => id === column.id)?.direction;
|
|
3504
4726
|
return /* @__PURE__ */ jsx15(TableHead2, {
|
|
3505
4727
|
"aria-sort": direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined,
|
|
3506
|
-
className:
|
|
4728
|
+
className: tableClasses.header,
|
|
3507
4729
|
scope: "col",
|
|
3508
4730
|
style: { width: column.width },
|
|
3509
4731
|
children: /* @__PURE__ */ jsxs9(ColumnIdContext.Provider, {
|
|
3510
4732
|
value: column.id,
|
|
3511
4733
|
children: [
|
|
3512
4734
|
/* @__PURE__ */ jsx15(ColumnHeaderMenu, {
|
|
3513
|
-
|
|
4735
|
+
table
|
|
3514
4736
|
}),
|
|
3515
4737
|
/* @__PURE__ */ jsx15(ResizeHandle, {
|
|
3516
|
-
|
|
4738
|
+
table
|
|
3517
4739
|
})
|
|
3518
4740
|
]
|
|
3519
4741
|
})
|
|
@@ -3527,13 +4749,13 @@ var DataTableHeader = ({
|
|
|
3527
4749
|
});
|
|
3528
4750
|
};
|
|
3529
4751
|
var VirtualTableRows = ({
|
|
3530
|
-
|
|
4752
|
+
table,
|
|
3531
4753
|
rows,
|
|
3532
4754
|
sections,
|
|
3533
4755
|
viewport,
|
|
3534
4756
|
colSpan
|
|
3535
4757
|
}) => {
|
|
3536
|
-
const [{ state, config }] =
|
|
4758
|
+
const [{ state, config }] = table;
|
|
3537
4759
|
const { element: scrollElement, headerHeight } = viewport;
|
|
3538
4760
|
const pageScroll = viewport.options.scroll === "page";
|
|
3539
4761
|
const scrollMargin = viewport.pageOffset ?? headerHeight;
|
|
@@ -3565,7 +4787,7 @@ var VirtualTableRows = ({
|
|
|
3565
4787
|
result.push({ key: `row:${row.id}`, kind: "data", row });
|
|
3566
4788
|
return result;
|
|
3567
4789
|
}, [rows, sections, state.collapsedGroups]);
|
|
3568
|
-
|
|
4790
|
+
useLayoutEffect2(() => {
|
|
3569
4791
|
if (!pageScroll && scrollElement)
|
|
3570
4792
|
scrollElement.scrollTop = 0;
|
|
3571
4793
|
}, [
|
|
@@ -3580,7 +4802,7 @@ var VirtualTableRows = ({
|
|
|
3580
4802
|
]);
|
|
3581
4803
|
const options = {
|
|
3582
4804
|
count: entries.length,
|
|
3583
|
-
getItemKey:
|
|
4805
|
+
getItemKey: useCallback2((index) => entries[index].key, [entries]),
|
|
3584
4806
|
estimateSize: () => viewport.options.estimateRowHeight ?? 64,
|
|
3585
4807
|
overscan: viewport.options.overscan ?? 5,
|
|
3586
4808
|
scrollMargin
|
|
@@ -3618,7 +4840,7 @@ var VirtualTableRows = ({
|
|
|
3618
4840
|
return /* @__PURE__ */ jsx15(TableDataRow, {
|
|
3619
4841
|
measureRef: virtualizer.measureElement,
|
|
3620
4842
|
row: entry.row,
|
|
3621
|
-
|
|
4843
|
+
table,
|
|
3622
4844
|
virtualIndex: index
|
|
3623
4845
|
}, key);
|
|
3624
4846
|
if (entry.kind === "header")
|
|
@@ -3626,7 +4848,7 @@ var VirtualTableRows = ({
|
|
|
3626
4848
|
measureRef: virtualizer.measureElement,
|
|
3627
4849
|
section: entry.section,
|
|
3628
4850
|
colSpan,
|
|
3629
|
-
|
|
4851
|
+
table,
|
|
3630
4852
|
virtualIndex: index
|
|
3631
4853
|
}, key);
|
|
3632
4854
|
return /* @__PURE__ */ jsx15(TableRow2, {
|
|
@@ -3645,21 +4867,20 @@ var VirtualTableRows = ({
|
|
|
3645
4867
|
});
|
|
3646
4868
|
};
|
|
3647
4869
|
var DataTableBody = ({
|
|
3648
|
-
|
|
4870
|
+
table,
|
|
3649
4871
|
viewport
|
|
3650
4872
|
}) => {
|
|
3651
|
-
const styles =
|
|
3652
|
-
const [store] =
|
|
4873
|
+
const styles = useContext2(DataTableStylesContext);
|
|
4874
|
+
const [store] = table;
|
|
3653
4875
|
const model = deriveModel(store);
|
|
3654
4876
|
const fields = getActiveGrouping(store);
|
|
3655
|
-
const
|
|
3656
|
-
const rows = grouped ? model.sortedRows : model.pageRows;
|
|
4877
|
+
const rows = model.pageRows;
|
|
3657
4878
|
const sections = useMemo2(() => groupDataTableRows(rows, fields), [rows, fields]);
|
|
3658
4879
|
const colSpan = model.visibleColumns.length + (store.config.features.selection ? 1 : 0) + (hasRowActionMenu(store) ? 1 : 0) + (canDragRows(store) ? 1 : 0);
|
|
3659
4880
|
const showGroups = sections.length && (rows.length || !store.config.status.loading) && !store.config.status.error;
|
|
3660
4881
|
if (showGroups && !viewport) {
|
|
3661
4882
|
return /* @__PURE__ */ jsx15(GroupedTable, {
|
|
3662
|
-
|
|
4883
|
+
table,
|
|
3663
4884
|
sections
|
|
3664
4885
|
});
|
|
3665
4886
|
}
|
|
@@ -3685,30 +4906,17 @@ var DataTableBody = ({
|
|
|
3685
4906
|
colSpan,
|
|
3686
4907
|
rows,
|
|
3687
4908
|
sections,
|
|
3688
|
-
|
|
4909
|
+
table,
|
|
3689
4910
|
viewport
|
|
3690
4911
|
}) : rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
3691
4912
|
value: row.id,
|
|
3692
4913
|
children: /* @__PURE__ */ jsx15(TableDataRow, {
|
|
3693
4914
|
row,
|
|
3694
|
-
|
|
4915
|
+
table
|
|
3695
4916
|
})
|
|
3696
4917
|
}, row.id))
|
|
3697
4918
|
});
|
|
3698
4919
|
};
|
|
3699
|
-
var GalleryImage = ({ src, alt }) => {
|
|
3700
|
-
const [failed, setFailed] = useState(false);
|
|
3701
|
-
if (failed)
|
|
3702
|
-
return null;
|
|
3703
|
-
return /* @__PURE__ */ jsx15("img", {
|
|
3704
|
-
src,
|
|
3705
|
-
alt,
|
|
3706
|
-
loading: "lazy",
|
|
3707
|
-
decoding: "async",
|
|
3708
|
-
className: "aspect-video w-full object-cover",
|
|
3709
|
-
onError: () => setFailed(true)
|
|
3710
|
-
});
|
|
3711
|
-
};
|
|
3712
4920
|
var GalleryTag = ({
|
|
3713
4921
|
row,
|
|
3714
4922
|
column,
|
|
@@ -3735,9 +4943,9 @@ var GalleryTag = ({
|
|
|
3735
4943
|
});
|
|
3736
4944
|
};
|
|
3737
4945
|
var GalleryCard = ({
|
|
3738
|
-
|
|
4946
|
+
table
|
|
3739
4947
|
}) => {
|
|
3740
|
-
const [store,
|
|
4948
|
+
const [store, send] = table;
|
|
3741
4949
|
const rowId = useRequiredId(RowIdContext);
|
|
3742
4950
|
const model = deriveModel(store);
|
|
3743
4951
|
const row = model.sortedRows.find((candidate) => candidate.id === rowId);
|
|
@@ -3766,10 +4974,14 @@ var GalleryCard = ({
|
|
|
3766
4974
|
},
|
|
3767
4975
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
3768
4976
|
children: [
|
|
3769
|
-
imageSrc ? /* @__PURE__ */ jsx15(
|
|
4977
|
+
imageSrc && !store.ui.failedImages.includes(imageSrc) ? /* @__PURE__ */ jsx15("img", {
|
|
3770
4978
|
src: imageSrc,
|
|
3771
|
-
alt: gallery.image?.getAlt?.(row.data) ?? ""
|
|
3772
|
-
|
|
4979
|
+
alt: gallery.image?.getAlt?.(row.data) ?? "",
|
|
4980
|
+
loading: "lazy",
|
|
4981
|
+
decoding: "async",
|
|
4982
|
+
className: "aspect-video w-full object-cover",
|
|
4983
|
+
onError: () => send(DataTableMessage.ReferenceImageFailed({ src: imageSrc }))
|
|
4984
|
+
}) : null,
|
|
3773
4985
|
/* @__PURE__ */ jsxs9(CardHeader, {
|
|
3774
4986
|
className: cn("relative", hasRowActionMenu(store) && "pr-12"),
|
|
3775
4987
|
children: [
|
|
@@ -3780,11 +4992,11 @@ var GalleryCard = ({
|
|
|
3780
4992
|
"aria-label": store.config.labels.selectRow,
|
|
3781
4993
|
checked: !!store.state.rowSelection[row.id],
|
|
3782
4994
|
disabled: !selectable,
|
|
3783
|
-
onCheckedChange: (checked) => toggleRow(
|
|
4995
|
+
onCheckedChange: (checked) => toggleRow(send, row.id, checked),
|
|
3784
4996
|
onClick: (event) => event.stopPropagation()
|
|
3785
4997
|
}) : null,
|
|
3786
4998
|
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
3787
|
-
|
|
4999
|
+
table
|
|
3788
5000
|
}) : null
|
|
3789
5001
|
]
|
|
3790
5002
|
}) : null,
|
|
@@ -3813,7 +5025,7 @@ var GalleryCard = ({
|
|
|
3813
5025
|
onClick: (event) => event.stopPropagation(),
|
|
3814
5026
|
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3815
5027
|
row,
|
|
3816
|
-
|
|
5028
|
+
table
|
|
3817
5029
|
})
|
|
3818
5030
|
}) : null
|
|
3819
5031
|
]
|
|
@@ -3822,13 +5034,13 @@ var GalleryCard = ({
|
|
|
3822
5034
|
});
|
|
3823
5035
|
};
|
|
3824
5036
|
var DataTableGallery = ({
|
|
3825
|
-
|
|
5037
|
+
table
|
|
3826
5038
|
}) => {
|
|
3827
|
-
const styles =
|
|
3828
|
-
const [store,
|
|
5039
|
+
const styles = useContext2(DataTableStylesContext);
|
|
5040
|
+
const [store, send] = table;
|
|
3829
5041
|
const model = deriveModel(store);
|
|
3830
5042
|
const fields = getActiveGrouping(store);
|
|
3831
|
-
const rows =
|
|
5043
|
+
const rows = model.pageRows;
|
|
3832
5044
|
const sections = groupDataTableRows(rows, fields);
|
|
3833
5045
|
if (store.config.status.error) {
|
|
3834
5046
|
return /* @__PURE__ */ jsx15("div", {
|
|
@@ -3860,7 +5072,7 @@ var DataTableGallery = ({
|
|
|
3860
5072
|
children: rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
3861
5073
|
value: row.id,
|
|
3862
5074
|
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
3863
|
-
|
|
5075
|
+
table
|
|
3864
5076
|
})
|
|
3865
5077
|
}, row.id))
|
|
3866
5078
|
});
|
|
@@ -3868,13 +5080,7 @@ var DataTableGallery = ({
|
|
|
3868
5080
|
const renderSections = (sections) => sections.map((section) => {
|
|
3869
5081
|
const collapsed = !!store.state.collapsedGroups[section.key];
|
|
3870
5082
|
const targetKey = getGroupDropKey(section.field.id, section.groupId);
|
|
3871
|
-
const toggleCollapsed = () =>
|
|
3872
|
-
...state,
|
|
3873
|
-
collapsedGroups: {
|
|
3874
|
-
...state.collapsedGroups,
|
|
3875
|
-
[section.key]: !collapsed
|
|
3876
|
-
}
|
|
3877
|
-
}));
|
|
5083
|
+
const toggleCollapsed = () => send(DataTableMessage.GroupToggled({ key: section.key }));
|
|
3878
5084
|
return /* @__PURE__ */ jsxs9("section", {
|
|
3879
5085
|
className: "data-[drop-target=true]:ring-primary space-y-3 rounded-lg transition-shadow data-[drop-target=true]:ring-2",
|
|
3880
5086
|
"data-table-group": section.field.onMoveToGroup ? targetKey : undefined,
|
|
@@ -3916,7 +5122,7 @@ var DataTableGallery = ({
|
|
|
3916
5122
|
children: section.rows.map((row) => /* @__PURE__ */ jsx15(RowIdContext.Provider, {
|
|
3917
5123
|
value: row.id,
|
|
3918
5124
|
children: /* @__PURE__ */ jsx15(GalleryCard, {
|
|
3919
|
-
|
|
5125
|
+
table
|
|
3920
5126
|
})
|
|
3921
5127
|
}, `${section.key}:${row.id}`))
|
|
3922
5128
|
}) : /* @__PURE__ */ jsx15("div", {
|
|
@@ -3932,28 +5138,22 @@ var DataTableGallery = ({
|
|
|
3932
5138
|
});
|
|
3933
5139
|
};
|
|
3934
5140
|
var DataTablePagination = ({
|
|
3935
|
-
|
|
5141
|
+
table
|
|
3936
5142
|
}) => {
|
|
3937
|
-
const styles =
|
|
3938
|
-
const [store,
|
|
5143
|
+
const styles = useContext2(DataTableStylesContext);
|
|
5144
|
+
const [store, send] = table;
|
|
3939
5145
|
const model = deriveModel(store);
|
|
3940
5146
|
const pagination = store.config.features.pagination ?? false;
|
|
3941
|
-
const
|
|
3942
|
-
const paginationVisible = pagination !== false && !clientGrouping;
|
|
5147
|
+
const { paginationVisible, page } = model;
|
|
3943
5148
|
const pageIndex = store.state.page;
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
changeState(setStore, (state) => ({
|
|
3948
|
-
...state,
|
|
3949
|
-
page: maxPageIndex
|
|
3950
|
-
}));
|
|
5149
|
+
useLayoutEffect2(() => {
|
|
5150
|
+
if (paginationVisible && pagination && pagination.mode === "client" && pageIndex > page) {
|
|
5151
|
+
send(DataTableMessage.PageRequested({ page }));
|
|
3951
5152
|
}
|
|
3952
|
-
}, [
|
|
3953
|
-
if (!paginationVisible)
|
|
5153
|
+
}, [page, pageIndex, pagination, paginationVisible, send]);
|
|
5154
|
+
if (!paginationVisible || !pagination)
|
|
3954
5155
|
return null;
|
|
3955
5156
|
const selected = model.rows.filter((row) => store.state.rowSelection[row.id]).length;
|
|
3956
|
-
const setPagination = (next) => changeState(setStore, (state) => ({ ...state, ...next }));
|
|
3957
5157
|
return /* @__PURE__ */ jsx15("div", {
|
|
3958
5158
|
"data-table-slot": "pagination",
|
|
3959
5159
|
className: cn("shrink-0 pt-4", styles?.pagination),
|
|
@@ -3961,9 +5161,9 @@ var DataTablePagination = ({
|
|
|
3961
5161
|
pageSizeContentClassName: styles?.popup?.select,
|
|
3962
5162
|
locale: store.config.locale,
|
|
3963
5163
|
messages: { [store.config.locale]: store.config.labels },
|
|
3964
|
-
onPageChange: (page) =>
|
|
3965
|
-
onPageSizeChange: (pageSize) =>
|
|
3966
|
-
page
|
|
5164
|
+
onPageChange: (page) => send(DataTableMessage.PageRequested({ page })),
|
|
5165
|
+
onPageSizeChange: (pageSize) => send(DataTableMessage.PageSizeRequested({ pageSize })),
|
|
5166
|
+
page,
|
|
3967
5167
|
pageCount: model.pageCount,
|
|
3968
5168
|
pageSize: store.state.pageSize,
|
|
3969
5169
|
pageSizes: pagination.pageSizes,
|
|
@@ -3972,156 +5172,226 @@ var DataTablePagination = ({
|
|
|
3972
5172
|
})
|
|
3973
5173
|
});
|
|
3974
5174
|
};
|
|
5175
|
+
var ReactTableModel = Component3.define(dataTableOptions).make({
|
|
5176
|
+
...dataTableBehaviours,
|
|
5177
|
+
view: () => View2.text("")
|
|
5178
|
+
});
|
|
5179
|
+
var modelField = (id, definition) => {
|
|
5180
|
+
const field = {
|
|
5181
|
+
id,
|
|
5182
|
+
headerName: id,
|
|
5183
|
+
type: definition.type ?? "text"
|
|
5184
|
+
};
|
|
5185
|
+
if (definition.sortable !== undefined)
|
|
5186
|
+
field.sortable = definition.sortable;
|
|
5187
|
+
if (definition.filterable !== undefined)
|
|
5188
|
+
field.filterable = definition.filterable;
|
|
5189
|
+
return field;
|
|
5190
|
+
};
|
|
5191
|
+
var modelColumns = (definitions) => normalizeDataTableColumns(definitions).map(({ id, colDef }) => {
|
|
5192
|
+
const column = modelField(id, colDef);
|
|
5193
|
+
if (colDef.width !== undefined)
|
|
5194
|
+
column.width = colDef.width;
|
|
5195
|
+
if (colDef.minWidth !== undefined)
|
|
5196
|
+
column.minWidth = colDef.minWidth;
|
|
5197
|
+
if (colDef.maxWidth !== undefined)
|
|
5198
|
+
column.maxWidth = colDef.maxWidth;
|
|
5199
|
+
if (colDef.hideable !== undefined)
|
|
5200
|
+
column.hideable = colDef.hideable;
|
|
5201
|
+
if (colDef.resizable !== undefined)
|
|
5202
|
+
column.resizable = colDef.resizable;
|
|
5203
|
+
if (colDef.fields)
|
|
5204
|
+
column.fields = colDef.fields.map((field) => modelField(field.id, field));
|
|
5205
|
+
return column;
|
|
5206
|
+
});
|
|
3975
5207
|
var getTableLayoutClass = (virtualization) => virtualization && virtualization !== true && virtualization.scroll === "internal" ? "flex min-h-0 flex-1 flex-col" : undefined;
|
|
3976
|
-
var HydratedDataTable = ({
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
const grouping =
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
setTransientUiState(transientUiFromState(state));
|
|
3995
|
-
}, [setPersistedUiState, setTransientUiState]);
|
|
3996
|
-
const validatedConfig = resolveConfig(props, (state) => setUiState(state));
|
|
3997
|
-
const [tableAtom] = useState(() => {
|
|
3998
|
-
const initial = {
|
|
3999
|
-
rowData: props.rowData,
|
|
4000
|
-
columnDefs: props.columnDefs,
|
|
4001
|
-
config: validatedConfig,
|
|
4002
|
-
state: initialPublicState(props, uiState),
|
|
4003
|
-
controlledState: props.state
|
|
5208
|
+
var HydratedDataTable = (props) => {
|
|
5209
|
+
const config = useMemo2(() => resolveConfig(props), [props]);
|
|
5210
|
+
const columns = useMemo2(() => modelColumns(props.columnDefs), [props.columnDefs]);
|
|
5211
|
+
const selection = config.features.selection;
|
|
5212
|
+
const modelProps = useMemo2(() => {
|
|
5213
|
+
const { features } = config;
|
|
5214
|
+
const grouping = features.grouping;
|
|
5215
|
+
const pagination = features.pagination;
|
|
5216
|
+
const [firstSize, ...otherSizes] = pagination && pagination.pageSizes || [];
|
|
5217
|
+
const modelFeatures = {
|
|
5218
|
+
search: features.search !== false,
|
|
5219
|
+
filtering: features.filtering !== false,
|
|
5220
|
+
sorting: features.sorting !== false,
|
|
5221
|
+
columnVisibility: features.columnVisibility !== false,
|
|
5222
|
+
pagination: pagination ? {
|
|
5223
|
+
...pagination,
|
|
5224
|
+
pageSizes: firstSize === undefined ? undefined : [firstSize, ...otherSizes]
|
|
5225
|
+
} : false
|
|
4004
5226
|
};
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
useLayoutEffect(() => {
|
|
4012
|
-
setStore((store) => {
|
|
4013
|
-
const features = props.features ?? {};
|
|
4014
|
-
const selection = features.selection;
|
|
4015
|
-
const config = {
|
|
4016
|
-
getRowId: selection && selection.getRowId || props.getRowId || undefined,
|
|
4017
|
-
onStateChange: props.onStateChange,
|
|
4018
|
-
onUiStateChange: (state) => setUiState(state),
|
|
4019
|
-
status: props.status ?? {},
|
|
4020
|
-
features,
|
|
4021
|
-
onRowClicked: props.onRowClicked,
|
|
4022
|
-
labels: dataTableMessages(props.locale, props.messages),
|
|
4023
|
-
locale: props.locale ?? "en"
|
|
4024
|
-
};
|
|
4025
|
-
const state = {
|
|
4026
|
-
...store.state,
|
|
4027
|
-
...uiState,
|
|
4028
|
-
...queryFromState(props.state ?? store.state)
|
|
5227
|
+
if (features.gallery)
|
|
5228
|
+
modelFeatures.gallery = { name: features.gallery.name };
|
|
5229
|
+
if (grouping) {
|
|
5230
|
+
modelFeatures.grouping = {
|
|
5231
|
+
initial: grouping.initial ?? [],
|
|
5232
|
+
fields: grouping.fields.map(({ id }) => ({ id, label: id }))
|
|
4029
5233
|
};
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
config,
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
5234
|
+
}
|
|
5235
|
+
const input = {
|
|
5236
|
+
label: "",
|
|
5237
|
+
columnDefs: columns,
|
|
5238
|
+
rowData: selection ? props.rowData.map((row, index) => ({
|
|
5239
|
+
id: config.getRowId?.(row) ?? String(index),
|
|
5240
|
+
label: "",
|
|
5241
|
+
cells: {},
|
|
5242
|
+
selectable: selection.isRowSelectable?.(row) ?? true
|
|
5243
|
+
})) : [],
|
|
5244
|
+
features: modelFeatures
|
|
5245
|
+
};
|
|
5246
|
+
if (selection)
|
|
5247
|
+
input.selection = {};
|
|
5248
|
+
if (props.state)
|
|
5249
|
+
input.state = props.state;
|
|
5250
|
+
if (props.initialState)
|
|
5251
|
+
input.initialState = props.initialState;
|
|
5252
|
+
return input;
|
|
4041
5253
|
}, [
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
props.
|
|
4045
|
-
props.locale,
|
|
4046
|
-
props.messages,
|
|
4047
|
-
props.onRowClicked,
|
|
4048
|
-
props.onStateChange,
|
|
5254
|
+
columns,
|
|
5255
|
+
config,
|
|
5256
|
+
props.initialState,
|
|
4049
5257
|
props.rowData,
|
|
4050
5258
|
props.state,
|
|
4051
|
-
|
|
4052
|
-
setStore,
|
|
4053
|
-
setUiState,
|
|
4054
|
-
uiState
|
|
5259
|
+
selection
|
|
4055
5260
|
]);
|
|
5261
|
+
const { model, send } = useModel(ReactTableModel, modelProps, {
|
|
5262
|
+
onEmit: (event) => {
|
|
5263
|
+
if (event._tag === "StateChanged") {
|
|
5264
|
+
props.onStateChange?.(queryFromState(event.state));
|
|
5265
|
+
} else if (event._tag === "SelectionChanged" && selection) {
|
|
5266
|
+
const selected = new Set(event.selectedRowIds);
|
|
5267
|
+
selection.onSelectionChange?.(props.rowData.filter((_, index) => {
|
|
5268
|
+
const id = modelProps.rowData[index]?.id;
|
|
5269
|
+
return id !== undefined && selected.has(id);
|
|
5270
|
+
}));
|
|
5271
|
+
}
|
|
5272
|
+
}
|
|
5273
|
+
});
|
|
5274
|
+
const [storageKey] = useState2(() => tablePreferencesKey(globalThis.window?.location.pathname ?? "/", columns.map(({ id }) => id), !!props.features?.gallery));
|
|
5275
|
+
useEffect2(() => {
|
|
5276
|
+
if (!model.preferencesLoaded) {
|
|
5277
|
+
send(DataTableMessage.PreferencesLoaded({
|
|
5278
|
+
preferences: readTablePreferences(storageKey)
|
|
5279
|
+
}));
|
|
5280
|
+
}
|
|
5281
|
+
}, [model, send, storageKey]);
|
|
5282
|
+
const { columnVisibility, columnSizing, grouping, view, preferencesLoaded } = model;
|
|
5283
|
+
const loadedPreferences = useRef2(false);
|
|
5284
|
+
useEffect2(() => {
|
|
5285
|
+
const preferences = tablePreferences({
|
|
5286
|
+
columnVisibility,
|
|
5287
|
+
columnSizing,
|
|
5288
|
+
grouping,
|
|
5289
|
+
view,
|
|
5290
|
+
preferencesLoaded
|
|
5291
|
+
});
|
|
5292
|
+
if (!preferences)
|
|
5293
|
+
return;
|
|
5294
|
+
if (!loadedPreferences.current) {
|
|
5295
|
+
loadedPreferences.current = true;
|
|
5296
|
+
return;
|
|
5297
|
+
}
|
|
5298
|
+
writeTablePreferences(storageKey, preferences);
|
|
5299
|
+
}, [
|
|
5300
|
+
columnVisibility,
|
|
5301
|
+
columnSizing,
|
|
5302
|
+
grouping,
|
|
5303
|
+
view,
|
|
5304
|
+
preferencesLoaded,
|
|
5305
|
+
storageKey
|
|
5306
|
+
]);
|
|
5307
|
+
const query = modelProps.state ?? model.query;
|
|
5308
|
+
const { collapsedGroups, selectedRowIds } = model;
|
|
5309
|
+
const galleryEnabled = !!props.features?.gallery;
|
|
5310
|
+
const state = useMemo2(() => ({
|
|
5311
|
+
...query,
|
|
5312
|
+
columnVisibility,
|
|
5313
|
+
columnSizing,
|
|
5314
|
+
grouping,
|
|
5315
|
+
view: galleryEnabled ? view : "table",
|
|
5316
|
+
collapsedGroups,
|
|
5317
|
+
rowSelection: Object.fromEntries(selectedRowIds.map((id) => [id, true]))
|
|
5318
|
+
}), [
|
|
5319
|
+
query,
|
|
5320
|
+
columnVisibility,
|
|
5321
|
+
columnSizing,
|
|
5322
|
+
grouping,
|
|
5323
|
+
view,
|
|
5324
|
+
galleryEnabled,
|
|
5325
|
+
collapsedGroups,
|
|
5326
|
+
selectedRowIds
|
|
5327
|
+
]);
|
|
5328
|
+
const store = useMemo2(() => {
|
|
5329
|
+
const source = {
|
|
5330
|
+
rowData: props.rowData,
|
|
5331
|
+
columnDefs: props.columnDefs,
|
|
5332
|
+
config,
|
|
5333
|
+
state
|
|
5334
|
+
};
|
|
5335
|
+
return { ...source, model: buildDataTableModel(source) };
|
|
5336
|
+
}, [props.rowData, props.columnDefs, config, state]);
|
|
5337
|
+
const table = [{ ...store, ui: model }, send];
|
|
5338
|
+
if (!preferencesLoaded)
|
|
5339
|
+
return /* @__PURE__ */ jsx15(TablePlaceholder, {
|
|
5340
|
+
props
|
|
5341
|
+
});
|
|
4056
5342
|
return /* @__PURE__ */ jsxs9("div", {
|
|
4057
5343
|
className: cn("w-full max-w-full min-w-0 rounded-md", getTableLayoutClass(props.features?.virtualization), props.className),
|
|
4058
5344
|
"data-table-root": "",
|
|
4059
5345
|
children: [
|
|
4060
5346
|
/* @__PURE__ */ jsx15(DataTableToolbar, {
|
|
4061
|
-
|
|
5347
|
+
table
|
|
4062
5348
|
}),
|
|
4063
5349
|
/* @__PURE__ */ jsx15(DataTableContent, {
|
|
4064
|
-
|
|
5350
|
+
table
|
|
4065
5351
|
}),
|
|
4066
5352
|
/* @__PURE__ */ jsx15(DataTablePagination, {
|
|
4067
|
-
|
|
5353
|
+
table
|
|
4068
5354
|
})
|
|
4069
5355
|
]
|
|
4070
5356
|
});
|
|
4071
5357
|
};
|
|
5358
|
+
var subscribeToHydration = () => () => {};
|
|
5359
|
+
var clientSnapshot = () => true;
|
|
5360
|
+
var serverSnapshot = () => false;
|
|
5361
|
+
var TablePlaceholder = ({
|
|
5362
|
+
props
|
|
5363
|
+
}) => /* @__PURE__ */ jsx15("div", {
|
|
5364
|
+
"aria-busy": "true",
|
|
5365
|
+
className: cn("invisible w-full max-w-full min-w-0 rounded-md", getTableLayoutClass(props.features?.virtualization), props.className),
|
|
5366
|
+
"data-table-root": ""
|
|
5367
|
+
});
|
|
4072
5368
|
var DataTable = (props) => {
|
|
4073
5369
|
const locale = useKrakstackLocale3(props.locale);
|
|
4074
|
-
const
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
const viewCapability = props.features?.gallery ? "gallery" : "table";
|
|
4079
|
-
return Atom.kvs({
|
|
4080
|
-
mode: "async",
|
|
4081
|
-
runtime: dataTableStorageRuntime,
|
|
4082
|
-
key: `data-table:${pathname}:${columnIds}:${viewCapability}:ui`,
|
|
4083
|
-
schema: DataTablePersistedUiStateSchema,
|
|
4084
|
-
defaultValue: () => ({
|
|
4085
|
-
...persistedUiFromState(DEFAULT_UI_STATE),
|
|
4086
|
-
view: props.features?.gallery ? props.initialState?.view ?? "table" : "table",
|
|
4087
|
-
grouping: props.features?.grouping ? props.features.grouping.initial ?? [] : []
|
|
4088
|
-
})
|
|
4089
|
-
});
|
|
4090
|
-
});
|
|
4091
|
-
const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtom);
|
|
4092
|
-
const persistedUiState = useMemo2(() => AsyncResult.isSuccess(persistedUiResult) ? {
|
|
4093
|
-
...persistedUiResult.value,
|
|
4094
|
-
columnVisibility: {
|
|
4095
|
-
...initialColumnVisibility,
|
|
4096
|
-
...persistedUiResult.value.columnVisibility
|
|
4097
|
-
}
|
|
4098
|
-
} : undefined, [initialColumnVisibility, persistedUiResult]);
|
|
4099
|
-
if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
|
|
4100
|
-
return /* @__PURE__ */ jsx15("div", {
|
|
4101
|
-
"aria-busy": "true",
|
|
4102
|
-
className: cn("invisible w-full max-w-full min-w-0 rounded-md", getTableLayoutClass(props.features?.virtualization), props.className),
|
|
4103
|
-
"data-table-root": ""
|
|
5370
|
+
const hydrated = useSyncExternalStore2(subscribeToHydration, clientSnapshot, serverSnapshot);
|
|
5371
|
+
if (!hydrated)
|
|
5372
|
+
return /* @__PURE__ */ jsx15(TablePlaceholder, {
|
|
5373
|
+
props
|
|
4104
5374
|
});
|
|
4105
|
-
}
|
|
4106
5375
|
return /* @__PURE__ */ jsx15(DataTableStylesContext.Provider, {
|
|
4107
5376
|
value: props.classNames,
|
|
4108
|
-
children: /* @__PURE__ */ jsx15(
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
5377
|
+
children: /* @__PURE__ */ jsx15(DataTableSlotClassesContext.Provider, {
|
|
5378
|
+
value: resolveTableClasses(props.classes),
|
|
5379
|
+
children: /* @__PURE__ */ jsx15(HydratedDataTable, {
|
|
5380
|
+
...props,
|
|
5381
|
+
locale
|
|
5382
|
+
})
|
|
4113
5383
|
})
|
|
4114
5384
|
});
|
|
4115
5385
|
};
|
|
4116
5386
|
var DataTableContent = ({
|
|
4117
|
-
|
|
5387
|
+
table
|
|
4118
5388
|
}) => {
|
|
4119
|
-
const [store] =
|
|
4120
|
-
const [scrollElement, setScrollElement] =
|
|
4121
|
-
const [headerHeight, setHeaderHeight] =
|
|
4122
|
-
const [pageTable, setPageTable] =
|
|
4123
|
-
const [pageOffset, setPageOffset] =
|
|
4124
|
-
|
|
5389
|
+
const [store] = table;
|
|
5390
|
+
const [scrollElement, setScrollElement] = useState2(null);
|
|
5391
|
+
const [headerHeight, setHeaderHeight] = useState2(48);
|
|
5392
|
+
const [pageTable, setPageTable] = useState2(null);
|
|
5393
|
+
const [pageOffset, setPageOffset] = useState2();
|
|
5394
|
+
useLayoutEffect2(() => {
|
|
4125
5395
|
const header = pageTable?.querySelector("thead");
|
|
4126
5396
|
if (!pageTable || !header)
|
|
4127
5397
|
return;
|
|
@@ -4136,7 +5406,7 @@ var DataTableContent = ({
|
|
|
4136
5406
|
observer?.disconnect();
|
|
4137
5407
|
};
|
|
4138
5408
|
}, [pageTable]);
|
|
4139
|
-
|
|
5409
|
+
useLayoutEffect2(() => {
|
|
4140
5410
|
const header = scrollElement?.querySelector("thead");
|
|
4141
5411
|
if (!header)
|
|
4142
5412
|
return;
|
|
@@ -4150,7 +5420,7 @@ var DataTableContent = ({
|
|
|
4150
5420
|
}, [scrollElement]);
|
|
4151
5421
|
if (store.config.features.gallery && store.state.view === "gallery") {
|
|
4152
5422
|
return /* @__PURE__ */ jsx15(DataTableGallery, {
|
|
4153
|
-
|
|
5423
|
+
table
|
|
4154
5424
|
});
|
|
4155
5425
|
}
|
|
4156
5426
|
const model = deriveModel(store);
|
|
@@ -4176,10 +5446,10 @@ var DataTableContent = ({
|
|
|
4176
5446
|
style: { width: `max(100%, ${width}px)` },
|
|
4177
5447
|
children: [
|
|
4178
5448
|
/* @__PURE__ */ jsx15(DataTableHeader, {
|
|
4179
|
-
|
|
5449
|
+
table
|
|
4180
5450
|
}),
|
|
4181
5451
|
/* @__PURE__ */ jsx15(DataTableBody, {
|
|
4182
|
-
|
|
5452
|
+
table,
|
|
4183
5453
|
viewport: {
|
|
4184
5454
|
element: null,
|
|
4185
5455
|
headerHeight: 0,
|
|
@@ -4216,10 +5486,10 @@ var DataTableContent = ({
|
|
|
4216
5486
|
children: [
|
|
4217
5487
|
/* @__PURE__ */ jsx15(DataTableHeader, {
|
|
4218
5488
|
sticky: true,
|
|
4219
|
-
|
|
5489
|
+
table
|
|
4220
5490
|
}),
|
|
4221
5491
|
/* @__PURE__ */ jsx15(DataTableBody, {
|
|
4222
|
-
|
|
5492
|
+
table,
|
|
4223
5493
|
viewport: { element: scrollElement, headerHeight, options }
|
|
4224
5494
|
})
|
|
4225
5495
|
]
|
|
@@ -4245,10 +5515,10 @@ var DataTableContent = ({
|
|
|
4245
5515
|
style: { width: `max(100%, ${width}px)` },
|
|
4246
5516
|
children: [
|
|
4247
5517
|
/* @__PURE__ */ jsx15(DataTableHeader, {
|
|
4248
|
-
|
|
5518
|
+
table
|
|
4249
5519
|
}),
|
|
4250
5520
|
/* @__PURE__ */ jsx15(DataTableBody, {
|
|
4251
|
-
|
|
5521
|
+
table
|
|
4252
5522
|
})
|
|
4253
5523
|
]
|
|
4254
5524
|
}),
|
|
@@ -4259,6 +5529,7 @@ var DataTableContent = ({
|
|
|
4259
5529
|
});
|
|
4260
5530
|
};
|
|
4261
5531
|
var DataTableListCell = (props) => {
|
|
5532
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
4262
5533
|
const locale = useKrakstackLocale3(props.locale);
|
|
4263
5534
|
const resolvedProps = { ...props, locale };
|
|
4264
5535
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
@@ -4276,7 +5547,7 @@ var DataTableListCell = (props) => {
|
|
|
4276
5547
|
}
|
|
4277
5548
|
const menuLabel = actionsLabel ?? (itemActions?.length ? labels.actions : labels.listDetails);
|
|
4278
5549
|
return /* @__PURE__ */ jsx15("div", {
|
|
4279
|
-
className:
|
|
5550
|
+
className: tableClasses.relationshipCell,
|
|
4280
5551
|
"data-slot": "data-table-list-cell",
|
|
4281
5552
|
onClick: (event) => event.stopPropagation(),
|
|
4282
5553
|
onPointerDown: (event) => event.stopPropagation(),
|
|
@@ -4291,7 +5562,7 @@ var DataTableListCell = (props) => {
|
|
|
4291
5562
|
onItemClick,
|
|
4292
5563
|
trigger: /* @__PURE__ */ jsxs9(Button, {
|
|
4293
5564
|
"aria-label": menuLabel,
|
|
4294
|
-
className:
|
|
5565
|
+
className: tableClasses.relationshipTrigger,
|
|
4295
5566
|
variant: "ghost",
|
|
4296
5567
|
children: [
|
|
4297
5568
|
/* @__PURE__ */ jsx15(DataTableListSummaryContent, {
|
|
@@ -4320,8 +5591,9 @@ var EditableDataTableListCell = ({
|
|
|
4320
5591
|
locale = "en",
|
|
4321
5592
|
messages
|
|
4322
5593
|
}) => {
|
|
4323
|
-
const
|
|
4324
|
-
const [
|
|
5594
|
+
const tableClasses = useContext2(DataTableSlotClassesContext);
|
|
5595
|
+
const [selected, setSelected] = useState2([...items]);
|
|
5596
|
+
const [previousItems, setPreviousItems] = useState2(items);
|
|
4325
5597
|
if (previousItems !== items) {
|
|
4326
5598
|
setPreviousItems(items);
|
|
4327
5599
|
setSelected([...items]);
|
|
@@ -4351,7 +5623,7 @@ var EditableDataTableListCell = ({
|
|
|
4351
5623
|
];
|
|
4352
5624
|
return /* @__PURE__ */ jsx15("div", {
|
|
4353
5625
|
"data-slot": "data-table-list-cell",
|
|
4354
|
-
className:
|
|
5626
|
+
className: tableClasses.relationshipCell,
|
|
4355
5627
|
onClick: (event) => event.stopPropagation(),
|
|
4356
5628
|
onPointerDown: (event) => event.stopPropagation(),
|
|
4357
5629
|
children: /* @__PURE__ */ jsx15(DataTableListMenu, {
|
|
@@ -4408,7 +5680,7 @@ var DataTableListMenu = ({
|
|
|
4408
5680
|
trigger
|
|
4409
5681
|
}) => {
|
|
4410
5682
|
const entries = items.map((item) => {
|
|
4411
|
-
const normalized =
|
|
5683
|
+
const normalized = Schema6.is(Schema6.String)(item) ? { label: item } : item;
|
|
4412
5684
|
const visibleActions = actions.filter((action) => action.visible?.(normalized) ?? true);
|
|
4413
5685
|
return { item: normalized, visibleActions };
|
|
4414
5686
|
});
|
|
@@ -4509,8 +5781,8 @@ var DataTableListAddMenu = ({
|
|
|
4509
5781
|
options,
|
|
4510
5782
|
searchLabel
|
|
4511
5783
|
}) => {
|
|
4512
|
-
const [search, setSearch] =
|
|
4513
|
-
const focusSearch =
|
|
5784
|
+
const [search, setSearch] = useState2("");
|
|
5785
|
+
const focusSearch = useCallback2((input) => {
|
|
4514
5786
|
input?.focus({ preventScroll: true });
|
|
4515
5787
|
}, []);
|
|
4516
5788
|
const labels = dataTableMessages(locale, messages);
|
|
@@ -4578,7 +5850,7 @@ var DataTableListSummaryContent = ({
|
|
|
4578
5850
|
showMenu,
|
|
4579
5851
|
visibleCount = 3
|
|
4580
5852
|
}) => {
|
|
4581
|
-
const normalized = items.map((item) =>
|
|
5853
|
+
const normalized = items.map((item) => Schema6.is(Schema6.String)(item) ? { label: item } : item);
|
|
4582
5854
|
if (!normalized.length)
|
|
4583
5855
|
return /* @__PURE__ */ jsx15("span", {
|
|
4584
5856
|
className: "text-muted-foreground",
|
|
@@ -4683,21 +5955,20 @@ var DataTableListEntry = ({
|
|
|
4683
5955
|
]
|
|
4684
5956
|
});
|
|
4685
5957
|
};
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
import { useKrakstackLocale as useKrakstackLocale4 } from "@krak-stack/registry/krakstack-provider";
|
|
5958
|
+
// ../../src/components/audit-log-table/react.tsx
|
|
5959
|
+
import { useKrakstackLocale as useKrakstackLocale4 } from "@krak-stack/registry/krakstack-provider/react";
|
|
4689
5960
|
|
|
4690
5961
|
// ../../src/services/events/record.ts
|
|
4691
|
-
import { Option as
|
|
4692
|
-
var TextValue =
|
|
5962
|
+
import { Option as Option5, Schema as Schema7 } from "effect";
|
|
5963
|
+
var TextValue = Schema7.Struct({ stringValue: Schema7.String }).annotate({
|
|
4693
5964
|
identifier: "EventTextValue"
|
|
4694
5965
|
});
|
|
4695
|
-
var TextArrayValue =
|
|
4696
|
-
arrayValue:
|
|
5966
|
+
var TextArrayValue = Schema7.Struct({
|
|
5967
|
+
arrayValue: Schema7.Struct({ values: Schema7.Array(TextValue) })
|
|
4697
5968
|
}).annotate({ identifier: "EventTextArrayValue" });
|
|
4698
|
-
var eventTextAttribute = (record, key) =>
|
|
5969
|
+
var eventTextAttribute = (record, key) => Schema7.decodeUnknownOption(TextValue)(record.attributes.find((attribute) => attribute.key === key)?.value).pipe(Option5.map((value) => value.stringValue), Option5.getOrNull);
|
|
4699
5970
|
|
|
4700
|
-
// ../../src/
|
|
5971
|
+
// ../../src/components/audit-log-table/react.tsx
|
|
4701
5972
|
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4702
5973
|
var translations = {
|
|
4703
5974
|
en: {
|