@nuxt/ui 2.18.3 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/cli/commands/init.mjs +83 -0
- package/cli/index.mjs +15 -0
- package/cli/package.json +13 -0
- package/cli/templates.mjs +171 -0
- package/cli/utils.mjs +17 -0
- package/dist/module.d.mts +10 -26
- package/dist/module.d.ts +10 -26
- package/dist/module.json +3 -3
- package/dist/module.mjs +2620 -152
- package/dist/runtime/assets/css/animations.css +1 -0
- package/dist/runtime/components/Accordion.vue +67 -0
- package/dist/runtime/components/Accordion.vue.d.ts +492 -0
- package/dist/runtime/components/Alert.vue +78 -0
- package/dist/runtime/components/Alert.vue.d.ts +548 -0
- package/dist/runtime/components/App.vue +32 -0
- package/dist/runtime/components/App.vue.d.ts +25 -0
- package/dist/runtime/components/Avatar.vue +48 -0
- package/dist/runtime/components/Avatar.vue.d.ts +384 -0
- package/dist/runtime/components/AvatarGroup.vue +74 -0
- package/dist/runtime/components/AvatarGroup.vue.d.ts +381 -0
- package/dist/runtime/components/Badge.vue +24 -0
- package/dist/runtime/components/Badge.vue.d.ts +422 -0
- package/dist/runtime/components/Breadcrumb.vue +60 -0
- package/dist/runtime/components/Breadcrumb.vue.d.ts +307 -0
- package/dist/runtime/components/Button.vue +55 -0
- package/dist/runtime/components/Button.vue.d.ts +949 -0
- package/dist/runtime/components/ButtonGroup.vue +29 -0
- package/dist/runtime/components/ButtonGroup.vue.d.ts +182 -0
- package/dist/runtime/components/Card.vue +33 -0
- package/dist/runtime/components/Card.vue.d.ts +191 -0
- package/dist/runtime/components/Checkbox.vue +89 -0
- package/dist/runtime/components/Checkbox.vue.d.ts +819 -0
- package/dist/runtime/components/Chip.vue +43 -0
- package/dist/runtime/components/Chip.vue.d.ts +590 -0
- package/dist/runtime/components/Collapsible.vue +33 -0
- package/dist/runtime/components/Collapsible.vue.d.ts +159 -0
- package/dist/runtime/components/CommandPalette.vue +210 -0
- package/dist/runtime/components/CommandPalette.vue.d.ts +684 -0
- package/dist/runtime/components/Container.vue +20 -0
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/ContextMenu.vue +51 -0
- package/dist/runtime/components/ContextMenu.vue.d.ts +796 -0
- package/dist/runtime/components/ContextMenuContent.vue +108 -0
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Drawer.vue +73 -0
- package/dist/runtime/components/Drawer.vue.d.ts +343 -0
- package/dist/runtime/components/DropdownMenu.vue +55 -0
- package/dist/runtime/components/DropdownMenu.vue.d.ts +815 -0
- package/dist/runtime/components/DropdownMenuContent.vue +111 -0
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Form.vue +206 -0
- package/dist/runtime/components/Form.vue.d.ts +39 -0
- package/dist/runtime/components/FormField.vue +82 -0
- package/dist/runtime/components/FormField.vue.d.ts +356 -0
- package/dist/runtime/components/Icon.vue +16 -0
- package/dist/runtime/components/Icon.vue.d.ts +17 -0
- package/dist/runtime/components/Input.vue +140 -0
- package/dist/runtime/components/Input.vue.d.ts +1137 -0
- package/dist/runtime/components/InputMenu.vue +264 -0
- package/dist/runtime/components/InputMenu.vue.d.ts +2121 -0
- package/dist/runtime/components/Kbd.vue +27 -0
- package/dist/runtime/components/Kbd.vue.d.ts +169 -0
- package/dist/runtime/components/Link.vue +83 -0
- package/dist/runtime/components/Link.vue.d.ts +76 -0
- package/dist/runtime/components/LinkBase.vue +50 -0
- package/dist/runtime/components/LinkBase.vue.d.ts +49 -0
- package/dist/runtime/components/Modal.vue +100 -0
- package/dist/runtime/components/Modal.vue.d.ts +319 -0
- package/dist/runtime/components/ModalProvider.vue +12 -0
- package/dist/runtime/components/NavigationMenu.vue +125 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1789 -0
- package/dist/runtime/components/Pagination.vue +80 -0
- package/dist/runtime/components/Pagination.vue.d.ts +295 -0
- package/dist/runtime/components/Popover.vue +52 -0
- package/dist/runtime/components/Popover.vue.d.ts +197 -0
- package/dist/runtime/components/Progress.vue +126 -0
- package/dist/runtime/components/Progress.vue.d.ts +1781 -0
- package/dist/runtime/components/RadioGroup.vue +111 -0
- package/dist/runtime/components/RadioGroup.vue.d.ts +1715 -0
- package/dist/runtime/components/Select.vue +148 -0
- package/dist/runtime/components/Select.vue.d.ts +1569 -0
- package/dist/runtime/components/SelectMenu.vue +208 -0
- package/dist/runtime/components/SelectMenu.vue.d.ts +1661 -0
- package/dist/runtime/components/Separator.vue +47 -0
- package/dist/runtime/components/Separator.vue.d.ts +0 -0
- package/dist/runtime/components/Skeleton.vue +19 -0
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +101 -0
- package/dist/runtime/components/Slideover.vue.d.ts +375 -0
- package/dist/runtime/components/SlideoverProvider.vue +12 -0
- package/dist/runtime/components/Slider.vue +83 -0
- package/dist/runtime/components/Slider.vue.d.ts +0 -0
- package/dist/runtime/components/Switch.vue +80 -0
- package/dist/runtime/components/Switch.vue.d.ts +1676 -0
- package/dist/runtime/components/Tabs.vue +61 -0
- package/dist/runtime/components/Tabs.vue.d.ts +934 -0
- package/dist/runtime/components/Textarea.vue +149 -0
- package/dist/runtime/components/Textarea.vue.d.ts +1133 -0
- package/dist/runtime/components/Toast.vue +112 -0
- package/dist/runtime/components/Toast.vue.d.ts +0 -0
- package/dist/runtime/components/Toaster.vue +109 -0
- package/dist/runtime/components/Toaster.vue.d.ts +362 -0
- package/dist/runtime/components/Tooltip.vue +52 -0
- package/dist/runtime/components/Tooltip.vue.d.ts +248 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +7 -5
- package/dist/runtime/composables/defineShortcuts.js +94 -65
- package/dist/runtime/composables/useAvatarGroup.d.ts +10 -0
- package/dist/runtime/composables/useAvatarGroup.js +10 -0
- package/dist/runtime/composables/useButtonGroup.d.ts +12 -17
- package/dist/runtime/composables/useButtonGroup.js +6 -56
- package/dist/runtime/composables/useComponentIcons.d.ts +26 -0
- package/dist/runtime/composables/useComponentIcons.js +26 -0
- package/dist/runtime/composables/useFormField.d.ts +31 -0
- package/dist/runtime/composables/useFormField.js +50 -0
- package/dist/runtime/composables/useKbd.d.ts +28 -0
- package/dist/runtime/composables/useKbd.js +46 -0
- package/dist/runtime/composables/useModal.d.ts +8 -4
- package/dist/runtime/composables/useModal.js +1 -0
- package/dist/runtime/composables/useSlideover.d.ts +9 -5
- package/dist/runtime/composables/useSlideover.js +3 -2
- package/dist/runtime/composables/useToast.d.ts +9 -17
- package/dist/runtime/composables/useToast.js +27 -13
- package/dist/runtime/plugins/colors.d.ts +0 -2
- package/dist/runtime/plugins/colors.js +9 -17
- package/dist/runtime/plugins/modal.d.ts +0 -0
- package/dist/runtime/plugins/slideover.d.ts +0 -0
- package/dist/runtime/plugins/{slideovers.js → slideover.js} +3 -3
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/component.d.ts +17 -14
- package/dist/runtime/types/component.js +0 -0
- package/dist/runtime/types/form.d.ts +63 -32
- package/dist/runtime/types/form.js +12 -0
- package/dist/runtime/types/index.d.ts +41 -30
- package/dist/runtime/types/index.js +42 -31
- package/dist/runtime/types/utils.d.ts +13 -32
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/utils/form.d.ts +15 -0
- package/dist/runtime/utils/form.js +66 -0
- package/dist/runtime/utils/fuse.d.ts +4 -0
- package/dist/runtime/utils/fuse.js +63 -0
- package/dist/runtime/utils/index.d.ts +4 -10
- package/dist/runtime/utils/index.js +40 -60
- package/dist/runtime/utils/link.d.ts +58 -71
- package/dist/runtime/utils/link.js +4 -124
- package/package.json +47 -45
- package/dist/runtime/components/data/Table.vue +0 -355
- package/dist/runtime/components/data/Table.vue.d.ts +0 -439
- package/dist/runtime/components/elements/Accordion.vue +0 -185
- package/dist/runtime/components/elements/Accordion.vue.d.ts +0 -224
- package/dist/runtime/components/elements/Alert.vue +0 -139
- package/dist/runtime/components/elements/Alert.vue.d.ts +0 -194
- package/dist/runtime/components/elements/Avatar.vue +0 -160
- package/dist/runtime/components/elements/Avatar.vue.d.ts +0 -255
- package/dist/runtime/components/elements/AvatarGroup.d.ts +0 -56
- package/dist/runtime/components/elements/AvatarGroup.js +0 -58
- package/dist/runtime/components/elements/Badge.vue +0 -75
- package/dist/runtime/components/elements/Badge.vue.d.ts +0 -109
- package/dist/runtime/components/elements/Button.vue +0 -193
- package/dist/runtime/components/elements/Button.vue.d.ts +0 -504
- package/dist/runtime/components/elements/ButtonGroup.d.ts +0 -153
- package/dist/runtime/components/elements/ButtonGroup.js +0 -51
- package/dist/runtime/components/elements/Carousel.vue +0 -165
- package/dist/runtime/components/elements/Carousel.vue.d.ts +0 -159
- package/dist/runtime/components/elements/Chip.vue +0 -85
- package/dist/runtime/components/elements/Chip.vue.d.ts +0 -162
- package/dist/runtime/components/elements/Dropdown.vue +0 -254
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +0 -254
- package/dist/runtime/components/elements/Icon.vue +0 -30
- package/dist/runtime/components/elements/Icon.vue.d.ts +0 -47
- package/dist/runtime/components/elements/Kbd.vue +0 -59
- package/dist/runtime/components/elements/Kbd.vue.d.ts +0 -86
- package/dist/runtime/components/elements/Link.vue +0 -95
- package/dist/runtime/components/elements/Link.vue.d.ts +0 -225
- package/dist/runtime/components/elements/Meter.vue +0 -170
- package/dist/runtime/components/elements/Meter.vue.d.ts +0 -279
- package/dist/runtime/components/elements/MeterGroup.d.ts +0 -135
- package/dist/runtime/components/elements/MeterGroup.js +0 -159
- package/dist/runtime/components/elements/Progress.vue +0 -203
- package/dist/runtime/components/elements/Progress.vue.d.ts +0 -280
- package/dist/runtime/components/forms/Checkbox.vue +0 -143
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +0 -179
- package/dist/runtime/components/forms/Form.vue +0 -222
- package/dist/runtime/components/forms/Form.vue.d.ts +0 -53
- package/dist/runtime/components/forms/FormGroup.vue +0 -128
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +0 -169
- package/dist/runtime/components/forms/Input.vue +0 -300
- package/dist/runtime/components/forms/Input.vue.d.ts +0 -482
- package/dist/runtime/components/forms/InputMenu.vue +0 -439
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +0 -700
- package/dist/runtime/components/forms/Radio.vue +0 -140
- package/dist/runtime/components/forms/Radio.vue.d.ts +0 -168
- package/dist/runtime/components/forms/RadioGroup.vue +0 -145
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +0 -176
- package/dist/runtime/components/forms/Range.vue +0 -173
- package/dist/runtime/components/forms/Range.vue.d.ts +0 -268
- package/dist/runtime/components/forms/Select.vue +0 -322
- package/dist/runtime/components/forms/Select.vue.d.ts +0 -471
- package/dist/runtime/components/forms/SelectMenu.vue +0 -546
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +0 -754
- package/dist/runtime/components/forms/Textarea.vue +0 -231
- package/dist/runtime/components/forms/Textarea.vue.d.ts +0 -436
- package/dist/runtime/components/forms/Toggle.vue +0 -171
- package/dist/runtime/components/forms/Toggle.vue.d.ts +0 -262
- package/dist/runtime/components/layout/Card.vue +0 -63
- package/dist/runtime/components/layout/Card.vue.d.ts +0 -89
- package/dist/runtime/components/layout/Container.vue +0 -48
- package/dist/runtime/components/layout/Container.vue.d.ts +0 -53
- package/dist/runtime/components/layout/Divider.vue +0 -108
- package/dist/runtime/components/layout/Divider.vue.d.ts +0 -198
- package/dist/runtime/components/layout/Skeleton.vue +0 -46
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +0 -53
- package/dist/runtime/components/navigation/Breadcrumb.vue +0 -82
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +0 -95
- package/dist/runtime/components/navigation/CommandPalette.vue +0 -345
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +0 -390
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +0 -152
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +0 -60
- package/dist/runtime/components/navigation/HorizontalNavigation.vue +0 -102
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +0 -99
- package/dist/runtime/components/navigation/Pagination.vue +0 -270
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +0 -260
- package/dist/runtime/components/navigation/Tabs.vue +0 -160
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +0 -165
- package/dist/runtime/components/navigation/VerticalNavigation.vue +0 -105
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +0 -113
- package/dist/runtime/components/overlays/ContextMenu.vue +0 -85
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +0 -126
- package/dist/runtime/components/overlays/Modal.vue +0 -122
- package/dist/runtime/components/overlays/Modal.vue.d.ts +0 -166
- package/dist/runtime/components/overlays/Modals.client.vue +0 -18
- package/dist/runtime/components/overlays/Notification.vue +0 -212
- package/dist/runtime/components/overlays/Notification.vue.d.ts +0 -235
- package/dist/runtime/components/overlays/Notifications.vue +0 -69
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +0 -66
- package/dist/runtime/components/overlays/Popover.vue +0 -213
- package/dist/runtime/components/overlays/Popover.vue.d.ts +0 -220
- package/dist/runtime/components/overlays/Slideover.vue +0 -152
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +0 -167
- package/dist/runtime/components/overlays/Slideovers.client.vue +0 -18
- package/dist/runtime/components/overlays/Tooltip.vue +0 -127
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +0 -165
- package/dist/runtime/composables/useCarouselScroll.d.ts +0 -2
- package/dist/runtime/composables/useCarouselScroll.js +0 -37
- package/dist/runtime/composables/useCopyToClipboard.d.ts +0 -10
- package/dist/runtime/composables/useCopyToClipboard.js +0 -26
- package/dist/runtime/composables/useFormGroup.d.ts +0 -18
- package/dist/runtime/composables/useFormGroup.js +0 -49
- package/dist/runtime/composables/usePopper.d.ts +0 -268
- package/dist/runtime/composables/usePopper.js +0 -94
- package/dist/runtime/composables/useShortcuts.d.ts +0 -12
- package/dist/runtime/composables/useShortcuts.js +0 -26
- package/dist/runtime/composables/useTimer.d.ts +0 -8
- package/dist/runtime/composables/useTimer.js +0 -51
- package/dist/runtime/composables/useUI.d.ts +0 -10
- package/dist/runtime/composables/useUI.js +0 -24
- package/dist/runtime/plugins/modals.d.ts +0 -2
- package/dist/runtime/plugins/slideovers.d.ts +0 -2
- package/dist/runtime/types/accordion.d.ts +0 -9
- package/dist/runtime/types/alert.d.ts +0 -12
- package/dist/runtime/types/avatar.d.ts +0 -17
- package/dist/runtime/types/badge.d.ts +0 -15
- package/dist/runtime/types/breadcrumb.d.ts +0 -10
- package/dist/runtime/types/button.d.ts +0 -31
- package/dist/runtime/types/chip.d.ts +0 -15
- package/dist/runtime/types/clipboard.d.ts +0 -3
- package/dist/runtime/types/command-palette.d.ts +0 -29
- package/dist/runtime/types/divider.d.ts +0 -3
- package/dist/runtime/types/dropdown.d.ts +0 -15
- package/dist/runtime/types/form-group.d.ts +0 -5
- package/dist/runtime/types/horizontal-navigation.d.ts +0 -13
- package/dist/runtime/types/input.d.ts +0 -8
- package/dist/runtime/types/kbd.d.ts +0 -5
- package/dist/runtime/types/link.d.ts +0 -12
- package/dist/runtime/types/meter.d.ts +0 -5
- package/dist/runtime/types/modal.d.ts +0 -18
- package/dist/runtime/types/notification.d.ts +0 -24
- package/dist/runtime/types/popper.d.ts +0 -17
- package/dist/runtime/types/progress.d.ts +0 -6
- package/dist/runtime/types/range.d.ts +0 -7
- package/dist/runtime/types/select.d.ts +0 -8
- package/dist/runtime/types/slideover.d.ts +0 -16
- package/dist/runtime/types/tabs.d.ts +0 -8
- package/dist/runtime/types/textarea.d.ts +0 -8
- package/dist/runtime/types/toggle.d.ts +0 -7
- package/dist/runtime/types/tooltip.d.ts +0 -7
- package/dist/runtime/types/vertical-navigation.d.ts +0 -13
- package/dist/runtime/ui.config/data/table.d.ts +0 -81
- package/dist/runtime/ui.config/data/table.js +0 -80
- package/dist/runtime/ui.config/elements/accordion.d.ts +0 -23
- package/dist/runtime/ui.config/elements/accordion.js +0 -22
- package/dist/runtime/ui.config/elements/alert.d.ts +0 -41
- package/dist/runtime/ui.config/elements/alert.js +0 -40
- package/dist/runtime/ui.config/elements/avatar.d.ts +0 -60
- package/dist/runtime/ui.config/elements/avatar.js +0 -59
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +0 -6
- package/dist/runtime/ui.config/elements/avatarGroup.js +0 -5
- package/dist/runtime/ui.config/elements/badge.d.ts +0 -34
- package/dist/runtime/ui.config/elements/badge.js +0 -33
- package/dist/runtime/ui.config/elements/button.d.ts +0 -81
- package/dist/runtime/ui.config/elements/button.js +0 -80
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +0 -101
- package/dist/runtime/ui.config/elements/buttonGroup.js +0 -19
- package/dist/runtime/ui.config/elements/carousel.d.ts +0 -27
- package/dist/runtime/ui.config/elements/carousel.js +0 -26
- package/dist/runtime/ui.config/elements/chip.d.ts +0 -35
- package/dist/runtime/ui.config/elements/chip.js +0 -34
- package/dist/runtime/ui.config/elements/dropdown.d.ts +0 -59
- package/dist/runtime/ui.config/elements/dropdown.js +0 -57
- package/dist/runtime/ui.config/elements/kbd.d.ts +0 -17
- package/dist/runtime/ui.config/elements/kbd.js +0 -16
- package/dist/runtime/ui.config/elements/meter.d.ts +0 -77
- package/dist/runtime/ui.config/elements/meter.js +0 -76
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +0 -52
- package/dist/runtime/ui.config/elements/meterGroup.js +0 -24
- package/dist/runtime/ui.config/elements/progress.d.ts +0 -75
- package/dist/runtime/ui.config/elements/progress.js +0 -74
- package/dist/runtime/ui.config/forms/checkbox.d.ts +0 -19
- package/dist/runtime/ui.config/forms/checkbox.js +0 -18
- package/dist/runtime/ui.config/forms/formGroup.d.ts +0 -26
- package/dist/runtime/ui.config/forms/formGroup.js +0 -26
- package/dist/runtime/ui.config/forms/input.d.ts +0 -110
- package/dist/runtime/ui.config/forms/input.js +0 -109
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +0 -64
- package/dist/runtime/ui.config/forms/inputMenu.js +0 -62
- package/dist/runtime/ui.config/forms/radio.d.ts +0 -18
- package/dist/runtime/ui.config/forms/radio.js +0 -17
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +0 -9
- package/dist/runtime/ui.config/forms/radioGroup.js +0 -8
- package/dist/runtime/ui.config/forms/range.d.ts +0 -64
- package/dist/runtime/ui.config/forms/range.js +0 -63
- package/dist/runtime/ui.config/forms/select.d.ts +0 -111
- package/dist/runtime/ui.config/forms/select.js +0 -13
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +0 -70
- package/dist/runtime/ui.config/forms/selectMenu.js +0 -32
- package/dist/runtime/ui.config/forms/textarea.d.ts +0 -109
- package/dist/runtime/ui.config/forms/textarea.js +0 -10
- package/dist/runtime/ui.config/forms/toggle.d.ts +0 -63
- package/dist/runtime/ui.config/forms/toggle.js +0 -62
- package/dist/runtime/ui.config/index.d.ts +0 -43
- package/dist/runtime/ui.config/index.js +0 -43
- package/dist/runtime/ui.config/layout/card.d.ts +0 -24
- package/dist/runtime/ui.config/layout/card.js +0 -23
- package/dist/runtime/ui.config/layout/container.d.ts +0 -6
- package/dist/runtime/ui.config/layout/container.js +0 -5
- package/dist/runtime/ui.config/layout/divider.d.ts +0 -52
- package/dist/runtime/ui.config/layout/divider.js +0 -51
- package/dist/runtime/ui.config/layout/skeleton.d.ts +0 -6
- package/dist/runtime/ui.config/layout/skeleton.js +0 -5
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +0 -21
- package/dist/runtime/ui.config/navigation/breadcrumb.js +0 -20
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +0 -72
- package/dist/runtime/ui.config/navigation/commandPalette.js +0 -71
- package/dist/runtime/ui.config/navigation/horizontalNavigation.d.ts +0 -27
- package/dist/runtime/ui.config/navigation/horizontalNavigation.js +0 -26
- package/dist/runtime/ui.config/navigation/pagination.d.ts +0 -35
- package/dist/runtime/ui.config/navigation/pagination.js +0 -34
- package/dist/runtime/ui.config/navigation/tabs.d.ts +0 -35
- package/dist/runtime/ui.config/navigation/tabs.js +0 -34
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +0 -34
- package/dist/runtime/ui.config/navigation/verticalNavigation.js +0 -33
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +0 -31
- package/dist/runtime/ui.config/overlays/contextMenu.js +0 -25
- package/dist/runtime/ui.config/overlays/modal.d.ts +0 -36
- package/dist/runtime/ui.config/overlays/modal.js +0 -37
- package/dist/runtime/ui.config/overlays/notification.d.ts +0 -50
- package/dist/runtime/ui.config/overlays/notification.js +0 -50
- package/dist/runtime/ui.config/overlays/notifications.d.ts +0 -7
- package/dist/runtime/ui.config/overlays/notifications.js +0 -6
- package/dist/runtime/ui.config/overlays/popover.d.ts +0 -47
- package/dist/runtime/ui.config/overlays/popover.js +0 -41
- package/dist/runtime/ui.config/overlays/slideover.d.ts +0 -35
- package/dist/runtime/ui.config/overlays/slideover.js +0 -36
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +0 -37
- package/dist/runtime/ui.config/overlays/tooltip.js +0 -34
- package/dist/runtime/ui.config/popper.d.ts +0 -8
- package/dist/runtime/ui.config/popper.js +0 -9
- package/dist/runtime/ui.css +0 -1
- package/dist/runtime/utils/colors.d.ts +0 -11
- package/dist/runtime/utils/colors.js +0 -299
- package/dist/runtime/utils/lodash.d.ts +0 -2
- package/dist/runtime/utils/lodash.js +0 -23
- package/dist/runtime/plugins/{modals.js → modal.js} +1 -1
|
@@ -1,124 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
required: false
|
|
6
|
-
},
|
|
7
|
-
href: {
|
|
8
|
-
type: [String, Object],
|
|
9
|
-
default: void 0,
|
|
10
|
-
required: false
|
|
11
|
-
},
|
|
12
|
-
// Attributes
|
|
13
|
-
target: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: void 0,
|
|
16
|
-
required: false
|
|
17
|
-
},
|
|
18
|
-
rel: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: void 0,
|
|
21
|
-
required: false
|
|
22
|
-
},
|
|
23
|
-
noRel: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: void 0,
|
|
26
|
-
required: false
|
|
27
|
-
},
|
|
28
|
-
// Prefetching
|
|
29
|
-
prefetch: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: void 0,
|
|
32
|
-
required: false
|
|
33
|
-
},
|
|
34
|
-
noPrefetch: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: void 0,
|
|
37
|
-
required: false
|
|
38
|
-
},
|
|
39
|
-
// Styling
|
|
40
|
-
activeClass: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: void 0,
|
|
43
|
-
required: false
|
|
44
|
-
},
|
|
45
|
-
exactActiveClass: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: void 0,
|
|
48
|
-
required: false
|
|
49
|
-
},
|
|
50
|
-
prefetchedClass: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: void 0,
|
|
53
|
-
required: false
|
|
54
|
-
},
|
|
55
|
-
// Vue Router's `<RouterLink>` additional props
|
|
56
|
-
replace: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: void 0,
|
|
59
|
-
required: false
|
|
60
|
-
},
|
|
61
|
-
ariaCurrentValue: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: void 0,
|
|
64
|
-
required: false
|
|
65
|
-
},
|
|
66
|
-
// Edge cases handling
|
|
67
|
-
external: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: void 0,
|
|
70
|
-
required: false
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const uLinkProps = {
|
|
74
|
-
as: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "button"
|
|
77
|
-
},
|
|
78
|
-
type: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "button"
|
|
81
|
-
},
|
|
82
|
-
disabled: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: null
|
|
85
|
-
},
|
|
86
|
-
active: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: void 0
|
|
89
|
-
},
|
|
90
|
-
exact: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: false
|
|
93
|
-
},
|
|
94
|
-
exactQuery: {
|
|
95
|
-
type: Boolean,
|
|
96
|
-
default: false
|
|
97
|
-
},
|
|
98
|
-
exactHash: {
|
|
99
|
-
type: Boolean,
|
|
100
|
-
default: false
|
|
101
|
-
},
|
|
102
|
-
inactiveClass: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: void 0
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
export const getNuxtLinkProps = (props) => {
|
|
108
|
-
const keys = Object.keys(nuxtLinkProps);
|
|
109
|
-
return keys.reduce((acc, key) => {
|
|
110
|
-
if (props[key] !== void 0) {
|
|
111
|
-
acc[key] = props[key];
|
|
112
|
-
}
|
|
113
|
-
return acc;
|
|
114
|
-
}, {});
|
|
115
|
-
};
|
|
116
|
-
export const getULinkProps = (props) => {
|
|
117
|
-
const keys = [...Object.keys(nuxtLinkProps), ...Object.keys(uLinkProps), "ariaLabel"];
|
|
118
|
-
return keys.reduce((acc, key) => {
|
|
119
|
-
if (props[key] !== void 0) {
|
|
120
|
-
acc[key] = props[key];
|
|
121
|
-
}
|
|
122
|
-
return acc;
|
|
123
|
-
}, {});
|
|
124
|
-
};
|
|
1
|
+
import { reactivePick } from "@vueuse/core";
|
|
2
|
+
export function pickLinkProps(link) {
|
|
3
|
+
return reactivePick(link, "active", "activeClass", "ariaCurrentValue", "ariaLabel", "as", "disabled", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "href", "inactiveClass", "noPrefetch", "noRel", "prefetch", "prefetchedClass", "rel", "replace", "target", "to", "type");
|
|
4
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
|
-
"version": "
|
|
4
|
-
"packageManager": "pnpm@9.
|
|
5
|
-
"repository":
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
|
+
"packageManager": "pnpm@9.9.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/nuxt/ui.git"
|
|
8
|
+
},
|
|
6
9
|
"homepage": "https://ui.nuxt.com",
|
|
7
10
|
"type": "module",
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
14
|
+
"types": "./dist/module.d.ts",
|
|
11
15
|
"import": "./dist/module.mjs",
|
|
12
16
|
"require": "./dist/module.cjs"
|
|
13
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"./runtime/*": "./dist/runtime/*"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"nuxt-ui": "./cli/index.mjs"
|
|
14
22
|
},
|
|
15
23
|
"main": "./dist/module.cjs",
|
|
16
24
|
"types": "./dist/types.d.ts",
|
|
17
25
|
"files": [
|
|
18
|
-
"dist"
|
|
26
|
+
"dist",
|
|
27
|
+
"cli"
|
|
19
28
|
],
|
|
20
29
|
"engines": {
|
|
21
30
|
"node": ">=v16.20.2"
|
|
@@ -23,63 +32,56 @@
|
|
|
23
32
|
"scripts": {
|
|
24
33
|
"build": "nuxt-module-build build",
|
|
25
34
|
"prepack": "pnpm build",
|
|
26
|
-
"dev": "nuxi dev
|
|
27
|
-
"
|
|
28
|
-
"
|
|
35
|
+
"dev": "DEV=true nuxi dev playground",
|
|
36
|
+
"dev:build": "nuxi build playground",
|
|
37
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare docs",
|
|
38
|
+
"docs": "DEV=true nuxi dev docs",
|
|
39
|
+
"docs:build": "nuxi build docs",
|
|
40
|
+
"docs:prepare": "nuxt-component-meta docs",
|
|
29
41
|
"lint": "eslint .",
|
|
30
42
|
"lint:fix": "eslint . --fix",
|
|
31
|
-
"typecheck": "vue-tsc --noEmit && nuxi typecheck docs",
|
|
32
|
-
"
|
|
33
|
-
"release": "release-it"
|
|
34
|
-
"test": "vitest"
|
|
43
|
+
"typecheck": "vue-tsc --noEmit && nuxi typecheck playground && nuxi typecheck docs",
|
|
44
|
+
"test": "vitest",
|
|
45
|
+
"release": "release-it"
|
|
35
46
|
},
|
|
36
47
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
46
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
47
|
-
"@tailwindcss/forms": "^0.5.7",
|
|
48
|
-
"@tailwindcss/typography": "^0.5.13",
|
|
49
|
-
"@vueuse/core": "^10.11.0",
|
|
50
|
-
"@vueuse/integrations": "^10.11.0",
|
|
51
|
-
"@vueuse/math": "^10.11.0",
|
|
48
|
+
"@nuxt/icon": "^1.5.1",
|
|
49
|
+
"@nuxt/kit": "^3.13.1",
|
|
50
|
+
"@nuxt/schema": "^3.13.1",
|
|
51
|
+
"@nuxtjs/color-mode": "^3.4.4",
|
|
52
|
+
"@tailwindcss/postcss": "4.0.0-alpha.22",
|
|
53
|
+
"@tailwindcss/vite": "4.0.0-alpha.22",
|
|
54
|
+
"@vueuse/core": "^11.0.3",
|
|
55
|
+
"@vueuse/integrations": "^11.0.3",
|
|
52
56
|
"defu": "^6.1.4",
|
|
53
|
-
"fuse.js": "^
|
|
57
|
+
"fuse.js": "^7.0.0",
|
|
54
58
|
"ohash": "^1.1.3",
|
|
55
|
-
"
|
|
59
|
+
"radix-vue": "^1.9.5",
|
|
56
60
|
"scule": "^1.3.0",
|
|
57
|
-
"tailwind-
|
|
58
|
-
"tailwindcss": "
|
|
61
|
+
"tailwind-variants": "^0.2.1",
|
|
62
|
+
"tailwindcss": "4.0.0-alpha.22",
|
|
63
|
+
"vaul-vue": "^0.2.0"
|
|
59
64
|
},
|
|
60
65
|
"devDependencies": {
|
|
61
|
-
"@nuxt/eslint-config": "^0.
|
|
62
|
-
"@nuxt/module-builder": "^0.8.
|
|
63
|
-
"@nuxt/test-utils": "^3.14.
|
|
66
|
+
"@nuxt/eslint-config": "^0.5.5",
|
|
67
|
+
"@nuxt/module-builder": "^0.8.3",
|
|
68
|
+
"@nuxt/test-utils": "^3.14.1",
|
|
64
69
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
65
70
|
"@vue/test-utils": "^2.4.6",
|
|
66
|
-
"eslint": "^
|
|
67
|
-
"happy-dom": "^
|
|
71
|
+
"eslint": "^9.9.1",
|
|
72
|
+
"happy-dom": "^15.7.3",
|
|
68
73
|
"joi": "^17.13.3",
|
|
69
|
-
"nuxt": "^3.
|
|
74
|
+
"nuxt": "^3.13.1",
|
|
70
75
|
"release-it": "^17.6.0",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"vitest": "^2.0.4",
|
|
76
|
-
"vitest-environment-nuxt": "^1.0.0",
|
|
77
|
-
"vue-tsc": "^2.0.29",
|
|
76
|
+
"valibot": "^0.41.0",
|
|
77
|
+
"vitest": "^2.0.5",
|
|
78
|
+
"vitest-environment-nuxt": "^1.0.1",
|
|
79
|
+
"vue-tsc": "^2.1.6",
|
|
78
80
|
"yup": "^1.4.0",
|
|
79
81
|
"zod": "^3.23.8"
|
|
80
82
|
},
|
|
81
83
|
"resolutions": {
|
|
82
84
|
"@nuxt/ui": "workspace:*",
|
|
83
|
-
"
|
|
85
|
+
"happy-dom": "14.12.3"
|
|
84
86
|
}
|
|
85
87
|
}
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="ui.wrapper" v-bind="attrs">
|
|
3
|
-
<table :class="[ui.base, ui.divide]">
|
|
4
|
-
<slot v-if="$slots.caption || caption" name="caption">
|
|
5
|
-
<caption :class="ui.caption">
|
|
6
|
-
{{ caption }}
|
|
7
|
-
</caption>
|
|
8
|
-
</slot>
|
|
9
|
-
<thead :class="ui.thead">
|
|
10
|
-
<tr :class="ui.tr.base">
|
|
11
|
-
<th v-if="modelValue" scope="col" :class="ui.checkbox.padding">
|
|
12
|
-
<UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" v-bind="ui.default.checkbox" aria-label="Select all" @change="onChange" />
|
|
13
|
-
</th>
|
|
14
|
-
|
|
15
|
-
<th v-if="$slots.expand" scope="col" :class="ui.tr.base">
|
|
16
|
-
<span class="sr-only">Expand</span>
|
|
17
|
-
</th>
|
|
18
|
-
|
|
19
|
-
<th
|
|
20
|
-
v-for="(column, index) in columns"
|
|
21
|
-
:key="index"
|
|
22
|
-
scope="col"
|
|
23
|
-
:class="[ui.th.base, ui.th.padding, ui.th.color, ui.th.font, ui.th.size, column.class]"
|
|
24
|
-
:aria-sort="getAriaSort(column)"
|
|
25
|
-
>
|
|
26
|
-
<slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
|
|
27
|
-
<UButton
|
|
28
|
-
v-if="column.sortable"
|
|
29
|
-
v-bind="{ ...(ui.default.sortButton || {}), ...sortButton }"
|
|
30
|
-
:icon="(!sort.column || sort.column !== column.key) ? (sortButton.icon || ui.default.sortButton.icon) : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
|
|
31
|
-
:label="column[columnAttribute]"
|
|
32
|
-
@click="onSort(column)"
|
|
33
|
-
/>
|
|
34
|
-
<span v-else>{{ column[columnAttribute] }}</span>
|
|
35
|
-
</slot>
|
|
36
|
-
</th>
|
|
37
|
-
</tr>
|
|
38
|
-
|
|
39
|
-
<tr v-if="loading && progress">
|
|
40
|
-
<td :colspan="0" :class="ui.progress.wrapper">
|
|
41
|
-
<UProgress v-bind="{ ...(ui.default.progress || {}), ...progress }" size="2xs" />
|
|
42
|
-
</td>
|
|
43
|
-
</tr>
|
|
44
|
-
</thead>
|
|
45
|
-
<tbody :class="ui.tbody">
|
|
46
|
-
<tr v-if="loadingState && loading && !rows.length">
|
|
47
|
-
<td :colspan="columns.length + (modelValue ? 1 : 0)">
|
|
48
|
-
<slot name="loading-state">
|
|
49
|
-
<div :class="ui.loadingState.wrapper">
|
|
50
|
-
<UIcon v-if="loadingState.icon" :name="loadingState.icon" :class="ui.loadingState.icon" aria-hidden="true" />
|
|
51
|
-
<p :class="ui.loadingState.label">
|
|
52
|
-
{{ loadingState.label }}
|
|
53
|
-
</p>
|
|
54
|
-
</div>
|
|
55
|
-
</slot>
|
|
56
|
-
</td>
|
|
57
|
-
</tr>
|
|
58
|
-
|
|
59
|
-
<tr v-else-if="emptyState && !rows.length">
|
|
60
|
-
<td :colspan="columns.length + (modelValue ? 1 : 0)">
|
|
61
|
-
<slot name="empty-state">
|
|
62
|
-
<div :class="ui.emptyState.wrapper">
|
|
63
|
-
<UIcon v-if="emptyState.icon" :name="emptyState.icon" :class="ui.emptyState.icon" aria-hidden="true" />
|
|
64
|
-
<p :class="ui.emptyState.label">
|
|
65
|
-
{{ emptyState.label }}
|
|
66
|
-
</p>
|
|
67
|
-
</div>
|
|
68
|
-
</slot>
|
|
69
|
-
</td>
|
|
70
|
-
</tr>
|
|
71
|
-
|
|
72
|
-
<template v-else>
|
|
73
|
-
<template v-for="(row, index) in rows" :key="index">
|
|
74
|
-
<tr :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
|
|
75
|
-
<td v-if="modelValue" :class="ui.checkbox.padding">
|
|
76
|
-
<UCheckbox v-model="selected" :value="row" v-bind="ui.default.checkbox" aria-label="Select row" @click.stop />
|
|
77
|
-
</td>
|
|
78
|
-
|
|
79
|
-
<td
|
|
80
|
-
v-if="$slots.expand"
|
|
81
|
-
:class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size]"
|
|
82
|
-
>
|
|
83
|
-
<UButton
|
|
84
|
-
v-bind="{ ...(ui.default.expandButton || {}), ...expandButton }"
|
|
85
|
-
:ui="{ icon: { base: [ui.expand.icon, openedRows.includes(index) && 'rotate-180'] } }"
|
|
86
|
-
@click="toggleOpened(index)"
|
|
87
|
-
/>
|
|
88
|
-
</td>
|
|
89
|
-
|
|
90
|
-
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class]">
|
|
91
|
-
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
|
|
92
|
-
{{ getRowData(row, column.key) }}
|
|
93
|
-
</slot>
|
|
94
|
-
</td>
|
|
95
|
-
</tr>
|
|
96
|
-
<tr v-if="openedRows.includes(index)">
|
|
97
|
-
<td colspan="100%">
|
|
98
|
-
<slot
|
|
99
|
-
name="expand"
|
|
100
|
-
:row="row"
|
|
101
|
-
:index="index"
|
|
102
|
-
/>
|
|
103
|
-
</td>
|
|
104
|
-
</tr>
|
|
105
|
-
</template>
|
|
106
|
-
</template>
|
|
107
|
-
</tbody>
|
|
108
|
-
</table>
|
|
109
|
-
</div>
|
|
110
|
-
</template>
|
|
111
|
-
|
|
112
|
-
<script>
|
|
113
|
-
import { ref, computed, defineComponent, toRaw, toRef } from "vue";
|
|
114
|
-
import { upperFirst } from "scule";
|
|
115
|
-
import { defu } from "defu";
|
|
116
|
-
import { useVModel } from "@vueuse/core";
|
|
117
|
-
import UIcon from "../elements/Icon.vue";
|
|
118
|
-
import UButton from "../elements/Button.vue";
|
|
119
|
-
import UProgress from "../elements/Progress.vue";
|
|
120
|
-
import UCheckbox from "../forms/Checkbox.vue";
|
|
121
|
-
import { useUI } from "../../composables/useUI";
|
|
122
|
-
import { mergeConfig, get } from "../../utils";
|
|
123
|
-
import appConfig from "#build/app.config";
|
|
124
|
-
import { table } from "#ui/ui.config";
|
|
125
|
-
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.table, table);
|
|
126
|
-
function defaultComparator(a, z) {
|
|
127
|
-
return a === z;
|
|
128
|
-
}
|
|
129
|
-
function defaultSort(a, b, direction) {
|
|
130
|
-
if (a === b) {
|
|
131
|
-
return 0;
|
|
132
|
-
}
|
|
133
|
-
if (direction === "asc") {
|
|
134
|
-
return a < b ? -1 : 1;
|
|
135
|
-
} else {
|
|
136
|
-
return a > b ? -1 : 1;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export default defineComponent({
|
|
140
|
-
components: {
|
|
141
|
-
UIcon,
|
|
142
|
-
UButton,
|
|
143
|
-
UProgress,
|
|
144
|
-
UCheckbox
|
|
145
|
-
},
|
|
146
|
-
inheritAttrs: false,
|
|
147
|
-
props: {
|
|
148
|
-
modelValue: {
|
|
149
|
-
type: Array,
|
|
150
|
-
default: null
|
|
151
|
-
},
|
|
152
|
-
by: {
|
|
153
|
-
type: [String, Function],
|
|
154
|
-
default: () => defaultComparator
|
|
155
|
-
},
|
|
156
|
-
rows: {
|
|
157
|
-
type: Array,
|
|
158
|
-
default: () => []
|
|
159
|
-
},
|
|
160
|
-
columns: {
|
|
161
|
-
type: Array,
|
|
162
|
-
default: null
|
|
163
|
-
},
|
|
164
|
-
columnAttribute: {
|
|
165
|
-
type: String,
|
|
166
|
-
default: "label"
|
|
167
|
-
},
|
|
168
|
-
sort: {
|
|
169
|
-
type: Object,
|
|
170
|
-
default: () => ({})
|
|
171
|
-
},
|
|
172
|
-
sortMode: {
|
|
173
|
-
type: String,
|
|
174
|
-
default: "auto"
|
|
175
|
-
},
|
|
176
|
-
sortButton: {
|
|
177
|
-
type: Object,
|
|
178
|
-
default: () => config.default.sortButton
|
|
179
|
-
},
|
|
180
|
-
sortAscIcon: {
|
|
181
|
-
type: String,
|
|
182
|
-
default: () => config.default.sortAscIcon
|
|
183
|
-
},
|
|
184
|
-
sortDescIcon: {
|
|
185
|
-
type: String,
|
|
186
|
-
default: () => config.default.sortDescIcon
|
|
187
|
-
},
|
|
188
|
-
expandButton: {
|
|
189
|
-
type: Object,
|
|
190
|
-
default: () => config.default.expandButton
|
|
191
|
-
},
|
|
192
|
-
loading: {
|
|
193
|
-
type: Boolean,
|
|
194
|
-
default: false
|
|
195
|
-
},
|
|
196
|
-
loadingState: {
|
|
197
|
-
type: Object,
|
|
198
|
-
default: () => config.default.loadingState
|
|
199
|
-
},
|
|
200
|
-
emptyState: {
|
|
201
|
-
type: Object,
|
|
202
|
-
default: () => config.default.emptyState
|
|
203
|
-
},
|
|
204
|
-
caption: {
|
|
205
|
-
type: String,
|
|
206
|
-
default: null
|
|
207
|
-
},
|
|
208
|
-
progress: {
|
|
209
|
-
type: Object,
|
|
210
|
-
default: () => config.default.progress
|
|
211
|
-
},
|
|
212
|
-
class: {
|
|
213
|
-
type: [String, Object, Array],
|
|
214
|
-
default: () => ""
|
|
215
|
-
},
|
|
216
|
-
ui: {
|
|
217
|
-
type: Object,
|
|
218
|
-
default: () => ({})
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
emits: ["update:modelValue", "update:sort"],
|
|
222
|
-
setup(props, { emit, attrs: $attrs }) {
|
|
223
|
-
const { ui, attrs } = useUI("table", toRef(props, "ui"), config, toRef(props, "class"));
|
|
224
|
-
const columns = computed(() => props.columns ?? Object.keys(props.rows[0] ?? {}).map((key) => ({ key, label: upperFirst(key), sortable: false, class: void 0, sort: defaultSort })));
|
|
225
|
-
const sort = useVModel(props, "sort", emit, { passive: true, defaultValue: defu({}, props.sort, { column: null, direction: "asc" }) });
|
|
226
|
-
const openedRows = ref([]);
|
|
227
|
-
const savedSort = { column: sort.value.column, direction: null };
|
|
228
|
-
const rows = computed(() => {
|
|
229
|
-
if (!sort.value?.column || props.sortMode === "manual") {
|
|
230
|
-
return props.rows;
|
|
231
|
-
}
|
|
232
|
-
const { column, direction } = sort.value;
|
|
233
|
-
return props.rows.slice().sort((a, b) => {
|
|
234
|
-
const aValue = get(a, column);
|
|
235
|
-
const bValue = get(b, column);
|
|
236
|
-
const sort2 = columns.value.find((col) => col.key === column)?.sort ?? defaultSort;
|
|
237
|
-
return sort2(aValue, bValue, direction);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
const selected = computed({
|
|
241
|
-
get() {
|
|
242
|
-
return props.modelValue;
|
|
243
|
-
},
|
|
244
|
-
set(value) {
|
|
245
|
-
emit("update:modelValue", value);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
const indeterminate = computed(() => selected.value && selected.value.length > 0 && selected.value.length < props.rows.length);
|
|
249
|
-
const emptyState = computed(() => {
|
|
250
|
-
if (props.emptyState === null) return null;
|
|
251
|
-
return { ...ui.value.default.emptyState, ...props.emptyState };
|
|
252
|
-
});
|
|
253
|
-
const loadingState = computed(() => {
|
|
254
|
-
if (props.loadingState === null) return null;
|
|
255
|
-
return { ...ui.value.default.loadingState, ...props.loadingState };
|
|
256
|
-
});
|
|
257
|
-
function compare(a, z) {
|
|
258
|
-
if (typeof props.by === "string") {
|
|
259
|
-
const property = props.by;
|
|
260
|
-
return a?.[property] === z?.[property];
|
|
261
|
-
}
|
|
262
|
-
return props.by(a, z);
|
|
263
|
-
}
|
|
264
|
-
function isSelected(row) {
|
|
265
|
-
if (!props.modelValue) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
return selected.value.some((item) => compare(toRaw(item), toRaw(row)));
|
|
269
|
-
}
|
|
270
|
-
function onSort(column) {
|
|
271
|
-
if (sort.value.column === column.key) {
|
|
272
|
-
const direction = !column.direction || column.direction === "asc" ? "desc" : "asc";
|
|
273
|
-
if (sort.value.direction === direction) {
|
|
274
|
-
sort.value = defu({}, savedSort, { column: null, direction: "asc" });
|
|
275
|
-
} else {
|
|
276
|
-
sort.value = { column: sort.value.column, direction: sort.value.direction === "asc" ? "desc" : "asc" };
|
|
277
|
-
}
|
|
278
|
-
} else {
|
|
279
|
-
sort.value = { column: column.key, direction: column.direction || "asc" };
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
function onSelect(row) {
|
|
283
|
-
if (!$attrs.onSelect) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
$attrs.onSelect(row);
|
|
287
|
-
}
|
|
288
|
-
function selectAllRows() {
|
|
289
|
-
props.rows.forEach((row) => {
|
|
290
|
-
if (isSelected(row)) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
selected.value.push(row);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
function onChange(checked) {
|
|
297
|
-
if (checked) {
|
|
298
|
-
selectAllRows();
|
|
299
|
-
} else {
|
|
300
|
-
selected.value = [];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
function getRowData(row, rowKey, defaultValue = "") {
|
|
304
|
-
return get(row, rowKey, defaultValue);
|
|
305
|
-
}
|
|
306
|
-
function toggleOpened(index) {
|
|
307
|
-
if (openedRows.value.includes(index)) {
|
|
308
|
-
openedRows.value = openedRows.value.filter((i) => i !== index);
|
|
309
|
-
} else {
|
|
310
|
-
openedRows.value.push(index);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
function getAriaSort(column) {
|
|
314
|
-
if (!column.sortable) {
|
|
315
|
-
return void 0;
|
|
316
|
-
}
|
|
317
|
-
if (sort.value.column !== column.key) {
|
|
318
|
-
return "none";
|
|
319
|
-
}
|
|
320
|
-
if (sort.value.direction === "asc") {
|
|
321
|
-
return "ascending";
|
|
322
|
-
}
|
|
323
|
-
if (sort.value.direction === "desc") {
|
|
324
|
-
return "descending";
|
|
325
|
-
}
|
|
326
|
-
return void 0;
|
|
327
|
-
}
|
|
328
|
-
return {
|
|
329
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
330
|
-
ui,
|
|
331
|
-
attrs,
|
|
332
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
333
|
-
sort,
|
|
334
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
335
|
-
columns,
|
|
336
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
337
|
-
rows,
|
|
338
|
-
selected,
|
|
339
|
-
indeterminate,
|
|
340
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
341
|
-
emptyState,
|
|
342
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
343
|
-
loadingState,
|
|
344
|
-
openedRows,
|
|
345
|
-
isSelected,
|
|
346
|
-
onSort,
|
|
347
|
-
onSelect,
|
|
348
|
-
onChange,
|
|
349
|
-
getRowData,
|
|
350
|
-
toggleOpened,
|
|
351
|
-
getAriaSort
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
</script>
|