vlite3 0.1.0 → 0.1.2
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/components/Accordion/Accordion.vue.d.ts +44 -0
- package/components/Accordion/Accordion.vue.js +95 -0
- package/components/Accordion/Accordion.vue2.js +4 -0
- package/components/Accordion/AccordionContent.vue.d.ts +22 -0
- package/components/Accordion/AccordionContent.vue.js +7 -0
- package/components/Accordion/AccordionContent.vue2.js +47 -0
- package/components/Accordion/AccordionItem.vue.d.ts +56 -0
- package/components/Accordion/AccordionItem.vue.js +115 -0
- package/components/Accordion/AccordionItem.vue2.js +4 -0
- package/components/Accordion/AccordionTrigger.vue.d.ts +43 -0
- package/components/Accordion/AccordionTrigger.vue.js +94 -0
- package/components/Accordion/AccordionTrigger.vue2.js +4 -0
- package/components/Accordion/index.d.ts +5 -0
- package/components/Accordion/types.d.ts +33 -0
- package/components/Alert.vue.d.ts +36 -0
- package/components/Alert.vue.js +84 -0
- package/components/Alert.vue2.js +4 -0
- package/components/Avatar.vue.d.ts +32 -0
- package/components/Avatar.vue.js +78 -0
- package/components/Avatar.vue2.js +4 -0
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +32 -0
- package/components/AvatarUploader/AvatarUploader.vue.js +99 -0
- package/components/AvatarUploader/AvatarUploader.vue2.js +4 -0
- package/{src/components/AvatarUploader/index.ts → components/AvatarUploader/index.d.ts} +2 -2
- package/components/Badge.vue.d.ts +25 -0
- package/components/Badge.vue.js +27 -0
- package/components/Badge.vue2.js +4 -0
- package/components/Button.vue.d.ts +26 -0
- package/components/Button.vue.js +107 -0
- package/components/Button.vue2.js +4 -0
- package/components/ButtonGroup.vue.d.ts +29 -0
- package/components/ButtonGroup.vue.js +7 -0
- package/components/ButtonGroup.vue2.js +30 -0
- package/components/Carousel/Carousel.vue.d.ts +847 -0
- package/components/Carousel/Carousel.vue.js +7 -0
- package/components/Carousel/Carousel.vue2.js +68 -0
- package/components/Carousel/index.d.ts +2 -0
- package/components/Carousel/types.d.ts +24 -0
- package/components/CheckBox.vue.d.ts +27 -0
- package/components/CheckBox.vue.js +115 -0
- package/components/CheckBox.vue2.js +4 -0
- package/components/Chip/Chip.vue.d.ts +33 -0
- package/components/Chip/Chip.vue.js +113 -0
- package/components/Chip/Chip.vue2.js +4 -0
- package/components/Chip/index.d.ts +2 -0
- package/components/Chip/types.d.ts +12 -0
- package/components/ChoiceBox/ChoiceBox.vue.d.ts +32 -0
- package/components/ChoiceBox/ChoiceBox.vue.js +141 -0
- package/components/ChoiceBox/ChoiceBox.vue2.js +4 -0
- package/components/ChoiceBox/index.d.ts +2 -0
- package/components/ColorPicker/ColorIro.vue.d.ts +18 -0
- package/components/ColorPicker/ColorIro.vue.js +142 -0
- package/components/ColorPicker/ColorIro.vue3.js +5 -0
- package/components/ColorPicker/ColorPicker.vue.d.ts +22 -0
- package/components/ColorPicker/ColorPicker.vue.js +56 -0
- package/components/ColorPicker/ColorPicker.vue2.js +4 -0
- package/components/ConfirmationModal.vue.d.ts +39 -0
- package/components/ConfirmationModal.vue.js +55 -0
- package/components/ConfirmationModal.vue2.js +4 -0
- package/components/DataTable/DataTable.vue.d.ts +60 -0
- package/components/DataTable/DataTable.vue.js +7 -0
- package/components/DataTable/DataTable.vue2.js +310 -0
- package/components/DataTable/DataTableHeader.vue.d.ts +14 -0
- package/components/DataTable/DataTableHeader.vue.js +49 -0
- package/components/DataTable/DataTableHeader.vue2.js +4 -0
- package/components/DataTable/DataTableRow.vue.d.ts +51 -0
- package/components/DataTable/DataTableRow.vue.js +114 -0
- package/components/DataTable/DataTableRow.vue2.js +4 -0
- package/components/DataTable/DataTableToolbar.vue.d.ts +31 -0
- package/components/DataTable/DataTableToolbar.vue.js +45 -0
- package/components/DataTable/DataTableToolbar.vue2.js +4 -0
- package/components/DataTable/index.d.ts +4 -0
- package/components/DataTable/types.d.ts +75 -0
- package/components/DatePicker.vue.d.ts +44 -0
- package/components/DatePicker.vue.js +84 -0
- package/components/DatePicker.vue2.js +4 -0
- package/components/Dropdown/Dropdown.vue.d.ts +105 -0
- package/components/Dropdown/Dropdown.vue.js +206 -0
- package/components/Dropdown/Dropdown.vue2.js +4 -0
- package/components/Dropdown/DropdownBooleanItem.vue.d.ts +12 -0
- package/components/Dropdown/DropdownBooleanItem.vue.js +41 -0
- package/components/Dropdown/DropdownBooleanItem.vue2.js +4 -0
- package/components/Dropdown/DropdownGroupedLayout.vue.d.ts +21 -0
- package/components/Dropdown/DropdownGroupedLayout.vue.js +73 -0
- package/components/Dropdown/DropdownGroupedLayout.vue2.js +4 -0
- package/components/Dropdown/DropdownItem.vue.d.ts +35 -0
- package/components/Dropdown/DropdownItem.vue.js +56 -0
- package/components/Dropdown/DropdownItem.vue2.js +4 -0
- package/components/Dropdown/DropdownMenu.vue.d.ts +73 -0
- package/components/Dropdown/DropdownMenu.vue.js +232 -0
- package/components/Dropdown/DropdownMenu.vue2.js +4 -0
- package/components/Dropdown/DropdownTrigger.vue.d.ts +15 -0
- package/components/Dropdown/DropdownTrigger.vue.js +26 -0
- package/components/Dropdown/DropdownTrigger.vue2.js +4 -0
- package/components/Dropdown/composables/useDropdownIds.d.ts +5 -0
- package/components/Dropdown/composables/useDropdownIds.js +20 -0
- package/components/Dropdown/composables/useDropdownNavigation.d.ts +19 -0
- package/components/Dropdown/composables/useDropdownNavigation.js +49 -0
- package/components/Dropdown/composables/useDropdownSelection.d.ts +16 -0
- package/components/Dropdown/composables/useDropdownSelection.js +41 -0
- package/components/Dropdown/index.d.ts +6 -0
- package/components/FilePicker/FilePicker.vue.d.ts +65 -0
- package/components/FilePicker/FilePicker.vue.js +285 -0
- package/components/FilePicker/FilePicker.vue2.js +4 -0
- package/components/FilePicker/index.d.ts +2 -0
- package/components/FileTree/FileTree.vue.d.ts +20 -0
- package/components/FileTree/FileTree.vue.js +139 -0
- package/components/FileTree/FileTree.vue2.js +4 -0
- package/components/FileTree/FileTreeNode.vue.d.ts +28 -0
- package/components/FileTree/FileTreeNode.vue.js +184 -0
- package/components/FileTree/FileTreeNode.vue2.js +4 -0
- package/components/FileTree/index.d.ts +4 -0
- package/components/FileTree/types.d.ts +36 -0
- package/components/FileTree/useTreeSelection.d.ts +12 -0
- package/components/FileTree/useTreeSelection.js +25 -0
- package/components/Form/CustomFields.vue.d.ts +38 -0
- package/components/Form/CustomFields.vue.js +7 -0
- package/components/Form/CustomFields.vue2.js +161 -0
- package/components/Form/Form.vue.d.ts +94 -0
- package/components/Form/Form.vue.js +7 -0
- package/components/Form/Form.vue2.js +238 -0
- package/components/Form/FormField.vue.d.ts +28 -0
- package/components/Form/FormField.vue.js +207 -0
- package/components/Form/FormField.vue2.js +4 -0
- package/components/Form/FormFields.vue.d.ts +29 -0
- package/components/Form/FormFields.vue.js +7 -0
- package/components/Form/FormFields.vue2.js +95 -0
- package/components/Form/composables/useFileUpload.d.ts +24 -0
- package/components/Form/composables/useFileUpload.js +40 -0
- package/components/Form/composables/useForm.d.ts +48 -0
- package/components/Form/composables/useForm.js +109 -0
- package/components/Form/index.d.ts +9 -0
- package/components/Form/types.d.ts +167 -0
- package/components/Form/utils/form.utils.d.ts +44 -0
- package/components/Form/utils/form.utils.js +97 -0
- package/components/Heatmap/Heatmap.vue.d.ts +26 -0
- package/components/Heatmap/Heatmap.vue.js +7 -0
- package/components/Heatmap/Heatmap.vue2.js +326 -0
- package/components/Heatmap/index.d.ts +2 -0
- package/components/Heatmap/types.d.ts +66 -0
- package/components/Icon.vue.d.ts +7 -0
- package/components/Icon.vue.js +25 -0
- package/components/Icon.vue2.js +4 -0
- package/components/IconPicker.vue.d.ts +38 -0
- package/components/IconPicker.vue.js +124 -0
- package/components/IconPicker.vue2.js +4 -0
- package/components/Input.vue.d.ts +54 -0
- package/components/Input.vue.js +267 -0
- package/components/Input.vue2.js +4 -0
- package/components/Label.vue.d.ts +23 -0
- package/components/Label.vue.js +23 -0
- package/components/Label.vue2.js +4 -0
- package/components/Logo.vue.d.ts +2 -0
- package/components/Logo.vue.js +10 -0
- package/components/Logo.vue2.js +4 -0
- package/components/Masonry/Masonry.vue.d.ts +31 -0
- package/components/Masonry/Masonry.vue.js +7 -0
- package/components/Masonry/Masonry.vue2.js +83 -0
- package/components/Masonry/index.d.ts +2 -0
- package/components/Masonry/types.d.ts +33 -0
- package/components/Masonry/types.js +10 -0
- package/components/Modal.vue.d.ts +52 -0
- package/components/Modal.vue.js +116 -0
- package/components/Modal.vue2.js +4 -0
- package/components/MultiSelect/MultiSelect.vue.d.ts +40 -0
- package/components/MultiSelect/MultiSelect.vue.js +126 -0
- package/components/MultiSelect/MultiSelect.vue2.js +4 -0
- package/components/MultiSelect/index.d.ts +1 -0
- package/components/Navbar/Navbar.vue.d.ts +51 -0
- package/components/Navbar/Navbar.vue.js +198 -0
- package/components/Navbar/Navbar.vue2.js +4 -0
- package/components/Navbar/NavbarGroup.vue.d.ts +24 -0
- package/components/Navbar/NavbarGroup.vue.js +23 -0
- package/components/Navbar/NavbarGroup.vue2.js +4 -0
- package/components/Navbar/NavbarItem.vue.d.ts +40 -0
- package/components/Navbar/NavbarItem.vue.js +104 -0
- package/components/Navbar/NavbarItem.vue2.js +4 -0
- package/components/Navbar/index.d.ts +3 -0
- package/components/OTPInput/OTPInput.vue.d.ts +33 -0
- package/components/OTPInput/OTPInput.vue.js +115 -0
- package/components/OTPInput/OTPInput.vue2.js +4 -0
- package/components/OTPInput/index.d.ts +1 -0
- package/components/Pagination/Pagination.vue.d.ts +34 -0
- package/components/Pagination/Pagination.vue.js +196 -0
- package/components/Pagination/Pagination.vue2.js +4 -0
- package/components/Pagination/index.d.ts +1 -0
- package/components/PricingPlan/PricingPlan.vue.d.ts +22 -0
- package/components/PricingPlan/PricingPlan.vue.js +55 -0
- package/components/PricingPlan/PricingPlan.vue2.js +4 -0
- package/components/PricingPlan/PricingPlanItem.vue.d.ts +17 -0
- package/components/PricingPlan/PricingPlanItem.vue.js +94 -0
- package/components/PricingPlan/PricingPlanItem.vue2.js +4 -0
- package/components/PricingPlan/index.d.ts +3 -0
- package/components/PricingPlan/types.d.ts +25 -0
- package/components/SidePanel.vue.d.ts +64 -0
- package/components/SidePanel.vue.js +7 -0
- package/components/SidePanel.vue2.js +131 -0
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +11 -0
- package/components/SidebarMenu/SidebarMenu.vue.js +78 -0
- package/components/SidebarMenu/SidebarMenu.vue2.js +4 -0
- package/components/SidebarMenu/SidebarMenuItem.vue.d.ts +9 -0
- package/components/SidebarMenu/SidebarMenuItem.vue.js +269 -0
- package/components/SidebarMenu/SidebarMenuItem.vue3.js +5 -0
- package/components/SidebarMenu/index.d.ts +3 -0
- package/components/SidebarMenu/types.d.ts +35 -0
- package/components/Slider.vue.d.ts +31 -0
- package/components/Slider.vue.js +157 -0
- package/components/Slider.vue2.js +4 -0
- package/components/Switch.vue.d.ts +16 -0
- package/components/Switch.vue.js +40 -0
- package/components/Switch.vue2.js +4 -0
- package/components/Tabes/Tabes.vue.d.ts +21 -0
- package/components/Tabes/Tabes.vue.js +75 -0
- package/components/Tabes/Tabes.vue2.js +4 -0
- package/components/Tabes/index.d.ts +2 -0
- package/components/Tabes/types.d.ts +8 -0
- package/components/Textarea.vue.d.ts +22 -0
- package/components/Textarea.vue.js +34 -0
- package/components/Textarea.vue2.js +4 -0
- package/components/ThemeToggle.vue.d.ts +2 -0
- package/components/ThemeToggle.vue.js +18 -0
- package/components/ThemeToggle.vue2.js +4 -0
- package/components/Timeline.vue.d.ts +39 -0
- package/components/Timeline.vue.js +174 -0
- package/components/Timeline.vue2.js +4 -0
- package/components/ToastNotification.vue.d.ts +7 -0
- package/components/ToastNotification.vue.js +7 -0
- package/components/ToastNotification.vue2.js +151 -0
- package/components/Tooltip.vue.d.ts +31 -0
- package/components/Tooltip.vue.js +45 -0
- package/components/Tooltip.vue2.js +4 -0
- package/components/Workbook/Sheet.vue.d.ts +38 -0
- package/components/Workbook/Sheet.vue.js +141 -0
- package/components/Workbook/Sheet.vue2.js +4 -0
- package/components/Workbook/Workbook.vue.d.ts +54 -0
- package/components/Workbook/Workbook.vue.js +7 -0
- package/components/Workbook/Workbook.vue2.js +146 -0
- package/components/Workbook/WorkbookAddButton.vue.d.ts +6 -0
- package/components/Workbook/WorkbookAddButton.vue.js +20 -0
- package/components/Workbook/WorkbookAddButton.vue2.js +4 -0
- package/components/Workbook/index.d.ts +3 -0
- package/components/Workbook/types.d.ts +34 -0
- package/composables/useKeyStroke.d.ts +21 -0
- package/composables/useKeyStroke.js +93 -0
- package/composables/useNotifications.d.ts +113 -0
- package/composables/useNotifications.js +99 -0
- package/composables/useTheme.d.ts +6 -0
- package/composables/useTheme.js +32 -0
- package/core/config.d.ts +29 -0
- package/core/config.js +12 -0
- package/core/index.d.ts +31 -0
- package/core/index.js +15 -0
- package/directives/vRipple.d.ts +4 -0
- package/directives/vRipple.js +17 -0
- package/index.d.ts +49 -0
- package/index.js +156 -0
- package/package.json +2 -2
- package/style.css +590 -0
- package/types/alert.type.d.ts +10 -0
- package/{src/types/avatar.type.ts → types/avatar.type.d.ts} +8 -9
- package/types/button.d.ts +15 -0
- package/types/buttongroup.type.d.ts +1 -0
- package/{src/types/config.type.ts → types/config.type.d.ts} +13 -16
- package/types/form.type.d.ts +45 -0
- package/types/index.d.ts +10 -0
- package/types/navbar.type.d.ts +27 -0
- package/types/sidepanel.type.d.ts +13 -0
- package/types/styles.d.ts +28 -0
- package/types/timeline.type.d.ts +9 -0
- package/{src/utils/functions.ts → utils/functions.d.ts} +1 -9
- package/utils/functions.js +11 -0
- package/utils/index.d.ts +2 -0
- package/utils/object.d.ts +6 -0
- package/utils/object.js +14 -0
- package/.vscode/extensions.json +0 -3
- package/LICENSE +0 -21
- package/index.html +0 -16
- package/scripts/bundle-css.js +0 -45
- package/src/App.vue +0 -7
- package/src/components/Accordion/Accordion.vue +0 -139
- package/src/components/Accordion/AccordionContent.vue +0 -63
- package/src/components/Accordion/AccordionItem.vue +0 -163
- package/src/components/Accordion/AccordionTrigger.vue +0 -125
- package/src/components/Accordion/index.ts +0 -5
- package/src/components/Accordion/types.ts +0 -41
- package/src/components/Alert.vue +0 -112
- package/src/components/Avatar.vue +0 -110
- package/src/components/AvatarUploader/AvatarUploader.vue +0 -129
- package/src/components/Badge.vue +0 -45
- package/src/components/Button.vue +0 -122
- package/src/components/ButtonGroup.vue +0 -173
- package/src/components/Carousel/Carousel.vue +0 -84
- package/src/components/Carousel/index.ts +0 -2
- package/src/components/Carousel/types.ts +0 -25
- package/src/components/CheckBox.vue +0 -132
- package/src/components/Chip/Chip.vue +0 -158
- package/src/components/Chip/index.ts +0 -2
- package/src/components/Chip/types.ts +0 -23
- package/src/components/ChoiceBox/ChoiceBox.vue +0 -181
- package/src/components/ChoiceBox/index.ts +0 -2
- package/src/components/ColorPicker/ColorIro.vue +0 -207
- package/src/components/ColorPicker/ColorPicker.vue +0 -61
- package/src/components/ConfirmationModal.vue +0 -46
- package/src/components/DataTable/DataTable.vue +0 -478
- package/src/components/DataTable/DataTableHeader.vue +0 -78
- package/src/components/DataTable/DataTableRow.vue +0 -171
- package/src/components/DataTable/DataTableToolbar.vue +0 -45
- package/src/components/DataTable/index.ts +0 -5
- package/src/components/DataTable/types.ts +0 -85
- package/src/components/DatePicker.vue +0 -102
- package/src/components/Dropdown/Dropdown.vue +0 -348
- package/src/components/Dropdown/DropdownBooleanItem.vue +0 -40
- package/src/components/Dropdown/DropdownGroupedLayout.vue +0 -115
- package/src/components/Dropdown/DropdownItem.vue +0 -56
- package/src/components/Dropdown/DropdownMenu.vue +0 -374
- package/src/components/Dropdown/DropdownTrigger.vue +0 -27
- package/src/components/Dropdown/composables/useDropdownIds.ts +0 -27
- package/src/components/Dropdown/composables/useDropdownNavigation.ts +0 -109
- package/src/components/Dropdown/composables/useDropdownSelection.ts +0 -106
- package/src/components/Dropdown/index.ts +0 -6
- package/src/components/FilePicker/FilePicker.vue +0 -459
- package/src/components/FilePicker/index.ts +0 -2
- package/src/components/FileTree/FileTree.vue +0 -334
- package/src/components/FileTree/FileTreeNode.vue +0 -225
- package/src/components/FileTree/index.ts +0 -2
- package/src/components/FileTree/types.ts +0 -31
- package/src/components/FileTree/useTreeSelection.ts +0 -66
- package/src/components/Form/CustomFields.vue +0 -294
- package/src/components/Form/Form.vue +0 -406
- package/src/components/Form/FormField.vue +0 -404
- package/src/components/Form/FormFields.vue +0 -161
- package/src/components/Form/composables/useFileUpload.ts +0 -112
- package/src/components/Form/composables/useForm.ts +0 -356
- package/src/components/Form/index.ts +0 -16
- package/src/components/Form/types.ts +0 -203
- package/src/components/Form/utils/form.utils.ts +0 -209
- package/src/components/Heatmap/Heatmap.vue +0 -629
- package/src/components/Heatmap/index.ts +0 -2
- package/src/components/Heatmap/types.ts +0 -84
- package/src/components/Icon.vue +0 -47
- package/src/components/IconPicker.vue +0 -138
- package/src/components/Input.vue +0 -366
- package/src/components/Label.vue +0 -25
- package/src/components/Logo.vue +0 -5
- package/src/components/Masonry/Masonry.vue +0 -148
- package/src/components/Masonry/index.ts +0 -2
- package/src/components/Masonry/types.ts +0 -44
- package/src/components/Modal.vue +0 -135
- package/src/components/MultiSelect/MultiSelect.vue +0 -176
- package/src/components/MultiSelect/index.ts +0 -1
- package/src/components/Navbar/Navbar.vue +0 -277
- package/src/components/Navbar/NavbarGroup.vue +0 -27
- package/src/components/Navbar/NavbarItem.vue +0 -124
- package/src/components/Navbar/index.ts +0 -3
- package/src/components/OTPInput/OTPInput.vue +0 -220
- package/src/components/OTPInput/index.ts +0 -1
- package/src/components/Pagination/Pagination.vue +0 -238
- package/src/components/Pagination/index.ts +0 -1
- package/src/components/PricingPlan/PricingPlan.vue +0 -102
- package/src/components/PricingPlan/PricingPlanItem.vue +0 -148
- package/src/components/PricingPlan/index.ts +0 -3
- package/src/components/PricingPlan/types.ts +0 -29
- package/src/components/SidePanel.vue +0 -184
- package/src/components/SidebarMenu/SidebarMenu.vue +0 -146
- package/src/components/SidebarMenu/SidebarMenuItem.vue +0 -333
- package/src/components/SidebarMenu/index.ts +0 -3
- package/src/components/SidebarMenu/types.ts +0 -54
- package/src/components/Slider.vue +0 -181
- package/src/components/Switch.vue +0 -51
- package/src/components/Tabes/Tabes.vue +0 -112
- package/src/components/Tabes/index.ts +0 -2
- package/src/components/Tabes/types.ts +0 -17
- package/src/components/Textarea.vue +0 -48
- package/src/components/ThemeToggle.vue +0 -14
- package/src/components/Timeline.vue +0 -250
- package/src/components/ToastNotification.vue +0 -257
- package/src/components/Tooltip.vue +0 -25
- package/src/components/Workbook/Sheet.vue +0 -185
- package/src/components/Workbook/Workbook.vue +0 -231
- package/src/components/Workbook/WorkbookAddButton.vue +0 -17
- package/src/components/Workbook/index.ts +0 -3
- package/src/components/Workbook/types.ts +0 -43
- package/src/composables/useKeyStroke.ts +0 -291
- package/src/composables/useNotifications.ts +0 -206
- package/src/composables/useTheme.ts +0 -55
- package/src/core/config.ts +0 -37
- package/src/core/index.ts +0 -49
- package/src/css/base.css +0 -148
- package/src/css/input.css +0 -61
- package/src/css/main.css +0 -6
- package/src/css/theme.css +0 -344
- package/src/directives/vRipple.ts +0 -38
- package/src/index.ts +0 -53
- package/src/main.ts +0 -5
- package/src/playground/Playground.vue +0 -429
- package/src/playground/composables/useGetUsers.ts +0 -538
- package/src/playground/demos/AccordionDemo.vue +0 -361
- package/src/playground/demos/AlertDemo.vue +0 -36
- package/src/playground/demos/AvatarDemo.vue +0 -41
- package/src/playground/demos/AvatarUploaderDemo.vue +0 -133
- package/src/playground/demos/BadgeDemo.vue +0 -31
- package/src/playground/demos/BadgesDemo.vue +0 -26
- package/src/playground/demos/ButtonDemo.vue +0 -99
- package/src/playground/demos/ButtonGroupDemo.vue +0 -39
- package/src/playground/demos/ButtonsDemo.vue +0 -111
- package/src/playground/demos/CarouselDemo.vue +0 -135
- package/src/playground/demos/CheckBoxDemo.vue +0 -43
- package/src/playground/demos/ChipDemo.vue +0 -190
- package/src/playground/demos/ChoiceBoxDemo.vue +0 -160
- package/src/playground/demos/ColorPickerDemo.vue +0 -30
- package/src/playground/demos/ColorsDemo.vue +0 -295
- package/src/playground/demos/DataTableDemo.vue +0 -215
- package/src/playground/demos/DatePickerDemo.vue +0 -43
- package/src/playground/demos/DisplayDemo.vue +0 -101
- package/src/playground/demos/DropdownDemo.vue +0 -651
- package/src/playground/demos/FilePickerDemo.vue +0 -175
- package/src/playground/demos/FileTreeDemo.vue +0 -150
- package/src/playground/demos/FormDemo.vue +0 -1144
- package/src/playground/demos/HeatmapDemo.vue +0 -467
- package/src/playground/demos/IconPickerDemo.vue +0 -27
- package/src/playground/demos/InputDemo.vue +0 -80
- package/src/playground/demos/InputsDemo.vue +0 -127
- package/src/playground/demos/LabelDemo.vue +0 -32
- package/src/playground/demos/MasonryDemo.vue +0 -241
- package/src/playground/demos/ModalDemo.vue +0 -67
- package/src/playground/demos/MultiSelectDemo.vue +0 -300
- package/src/playground/demos/NavbarDemo.vue +0 -59
- package/src/playground/demos/NavigationDemo.vue +0 -116
- package/src/playground/demos/OTPInputDemo.vue +0 -170
- package/src/playground/demos/OverlaysDemo.vue +0 -104
- package/src/playground/demos/PaginationDemo.vue +0 -130
- package/src/playground/demos/PricingPlanDemo.vue +0 -110
- package/src/playground/demos/SidePanelDemo.vue +0 -45
- package/src/playground/demos/SidebarMenuDemo.vue +0 -170
- package/src/playground/demos/SliderDemo.vue +0 -48
- package/src/playground/demos/SwitchDemo.vue +0 -40
- package/src/playground/demos/TabesDemo.vue +0 -178
- package/src/playground/demos/TextareaDemo.vue +0 -31
- package/src/playground/demos/ThemeToggleDemo.vue +0 -20
- package/src/playground/demos/TimelineDemo.vue +0 -43
- package/src/playground/demos/ToastDemo.vue +0 -111
- package/src/playground/demos/TooltipDemo.vue +0 -30
- package/src/playground/demos/WorkbookDemo.vue +0 -227
- package/src/types/alert.type.ts +0 -11
- package/src/types/button.ts +0 -36
- package/src/types/buttongroup.type.ts +0 -1
- package/src/types/form.type.ts +0 -75
- package/src/types/index.ts +0 -11
- package/src/types/navbar.type.ts +0 -28
- package/src/types/sidepanel.type.ts +0 -14
- package/src/types/styles.ts +0 -42
- package/src/types/timeline.type.ts +0 -11
- package/src/utils/index.ts +0 -2
- package/src/utils/object.ts +0 -40
- package/tsconfig.app.json +0 -27
- package/tsconfig.json +0 -48
- package/tsconfig.node.json +0 -18
- package/tsconfig.node.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- package/vercel.json +0 -8
- package/vite.config.d.ts +0 -2
- package/vite.config.js +0 -63
- package/vite.config.ts +0 -64
- package/vite.config.vercel.ts +0 -17
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, watch, computed, toRaw } from 'vue'
|
|
3
|
-
import type { FileNode, FileTreeProps, FileTreeEvents } from './types'
|
|
4
|
-
import FileTreeNode from './FileTreeNode.vue'
|
|
5
|
-
// Removed unused uuid import
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<FileTreeProps>(), {
|
|
8
|
-
modelValue: () => [],
|
|
9
|
-
data: () => [],
|
|
10
|
-
selectionMode: 'single',
|
|
11
|
-
showCheckboxes: false,
|
|
12
|
-
defaultExpandedKeys: () => [],
|
|
13
|
-
highlightSearch: true,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits<FileTreeEvents>()
|
|
17
|
-
|
|
18
|
-
// State
|
|
19
|
-
const expandedKeys = ref(new Set<string>(props.defaultExpandedKeys))
|
|
20
|
-
const loadingKeys = ref(new Set<string>())
|
|
21
|
-
// We maintain local indeterminate logic manually or derive it.
|
|
22
|
-
// Deriving Indeterminate State:
|
|
23
|
-
// We need a map of Parent -> Children.
|
|
24
|
-
// If 'multiple' mode and checkboxes:
|
|
25
|
-
// Indeterminate = Some but not all children selected.
|
|
26
|
-
// This requires traversing the entire tree or having a flat map.
|
|
27
|
-
// To support "Efficient performance", we should flatten the tree map once on data change.
|
|
28
|
-
|
|
29
|
-
// Helper: Flatten Tree & Map Parents
|
|
30
|
-
const nodeMap = ref(new Map<string, FileNode>())
|
|
31
|
-
const parentMap = ref(new Map<string, string>())
|
|
32
|
-
|
|
33
|
-
const buildMaps = (nodes: FileNode[], parentId?: string) => {
|
|
34
|
-
for (const node of nodes) {
|
|
35
|
-
nodeMap.value.set(node.id, node)
|
|
36
|
-
if (parentId) parentMap.value.set(node.id, parentId)
|
|
37
|
-
if (node.children) {
|
|
38
|
-
buildMaps(node.children, node.id)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
watch(
|
|
44
|
-
() => props.data,
|
|
45
|
-
(newData) => {
|
|
46
|
-
nodeMap.value.clear()
|
|
47
|
-
parentMap.value.clear()
|
|
48
|
-
buildMaps(newData)
|
|
49
|
-
},
|
|
50
|
-
{ immediate: true, deep: true }
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
// Helper: Get All Descendants IDs
|
|
54
|
-
const getDescendants = (node: FileNode): string[] => {
|
|
55
|
-
let ids: string[] = []
|
|
56
|
-
if (node.children) {
|
|
57
|
-
for (const child of node.children) {
|
|
58
|
-
ids.push(child.id)
|
|
59
|
-
ids = ids.concat(getDescendants(child))
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return ids
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Selection State
|
|
66
|
-
const selectedKeys = computed(() => new Set(props.modelValue))
|
|
67
|
-
|
|
68
|
-
// Indeterminate State Calculation
|
|
69
|
-
const indeterminateKeys = computed(() => {
|
|
70
|
-
const indeterminate = new Set<string>()
|
|
71
|
-
if (props.selectionMode !== 'multiple') return indeterminate
|
|
72
|
-
|
|
73
|
-
// Bottom-up traversal or check every folder?
|
|
74
|
-
// Check every folder in nodeMap?
|
|
75
|
-
// Optimized: We can assume if we are strictly managing state, we might know.
|
|
76
|
-
// But let's verify.
|
|
77
|
-
|
|
78
|
-
// We iterate all nodes where isFolder is true
|
|
79
|
-
nodeMap.value.forEach((node) => {
|
|
80
|
-
if ((node.isFolder || (node.children && node.children.length)) && node.children) {
|
|
81
|
-
const allChildrenCount = node.children.length
|
|
82
|
-
if (allChildrenCount === 0) return
|
|
83
|
-
|
|
84
|
-
let selectedCount = 0
|
|
85
|
-
let indeterminateCount = 0
|
|
86
|
-
|
|
87
|
-
// Shallow check of direct children is enough IF we propagate correctly?
|
|
88
|
-
// No, usually 'indeterminate' implies ANY descendant is selected but not all.
|
|
89
|
-
// Standard definition:
|
|
90
|
-
// Checked: All descendants checked.
|
|
91
|
-
// Indeterminate: Some descendants checked (or some indeterminate).
|
|
92
|
-
// Unchecked: No descendants checked.
|
|
93
|
-
|
|
94
|
-
// Let's rely on a recursive helper that might be heavy?
|
|
95
|
-
// For large trees, this computed might be slow.
|
|
96
|
-
// Better: Update indeterminate set during selection mutation.
|
|
97
|
-
// BUT `modelValue` is a prop we don't own. We strictly react to it.
|
|
98
|
-
// So we MUST compute it from `modelValue`.
|
|
99
|
-
|
|
100
|
-
// Optimization:
|
|
101
|
-
// Recursive check logic is unavoidable if we only have the list of selected IDs.
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
// Re-approach: Traverse bottom-up?
|
|
106
|
-
// Since we have parentMap, we can just look at leaves? No.
|
|
107
|
-
|
|
108
|
-
// Let's do a standard recursive check from Root.
|
|
109
|
-
const traverse = (node: FileNode): { status: 'checked' | 'unchecked' | 'indeterminate' } => {
|
|
110
|
-
if (!node.children || node.children.length === 0) {
|
|
111
|
-
return selectedKeys.value.has(node.id) ? { status: 'checked' } : { status: 'unchecked' }
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
let hasChecked = false
|
|
115
|
-
let hasUnchecked = false
|
|
116
|
-
let hasIndeterminate = false
|
|
117
|
-
|
|
118
|
-
for (const child of node.children) {
|
|
119
|
-
const res = traverse(child)
|
|
120
|
-
if (res.status === 'checked') hasChecked = true
|
|
121
|
-
if (res.status === 'unchecked') hasUnchecked = true
|
|
122
|
-
if (res.status === 'indeterminate') hasIndeterminate = true
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (hasIndeterminate || (hasChecked && hasUnchecked)) {
|
|
126
|
-
indeterminate.add(node.id)
|
|
127
|
-
return { status: 'indeterminate' }
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (hasChecked) return { status: 'checked' }
|
|
131
|
-
return { status: 'unchecked' }
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
props.data.forEach(traverse)
|
|
135
|
-
|
|
136
|
-
return indeterminate
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
// Handlers
|
|
140
|
-
const handleToggleExpand = async (node: FileNode) => {
|
|
141
|
-
if (node.disabled) return
|
|
142
|
-
|
|
143
|
-
const isExpanded = expandedKeys.value.has(node.id)
|
|
144
|
-
|
|
145
|
-
if (isExpanded) {
|
|
146
|
-
// Collapse: Recursive close
|
|
147
|
-
expandedKeys.value.delete(node.id)
|
|
148
|
-
|
|
149
|
-
// Find all descendants and remove them from expandedKeys
|
|
150
|
-
// We use the original node from map to get full hierarchy
|
|
151
|
-
const originalNode = nodeMap.value.get(node.id) || node
|
|
152
|
-
const descendants = getDescendants(originalNode)
|
|
153
|
-
descendants.forEach((id) => expandedKeys.value.delete(id))
|
|
154
|
-
|
|
155
|
-
emit('expand', node, false)
|
|
156
|
-
} else {
|
|
157
|
-
// Expand
|
|
158
|
-
expandedKeys.value.add(node.id)
|
|
159
|
-
emit('expand', node, true)
|
|
160
|
-
|
|
161
|
-
// Async Load
|
|
162
|
-
if (props.loadData && !node.isLoaded && (!node.children || node.children.length === 0)) {
|
|
163
|
-
loadingKeys.value.add(node.id)
|
|
164
|
-
try {
|
|
165
|
-
await props.loadData(node)
|
|
166
|
-
} finally {
|
|
167
|
-
loadingKeys.value.delete(node.id)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const handleToggleSelect = (node: FileNode) => {
|
|
174
|
-
if (node.disabled) return
|
|
175
|
-
|
|
176
|
-
// Use original node from map to ensure we have all children, not just filtered ones
|
|
177
|
-
const originalNode = nodeMap.value.get(node.id) || node
|
|
178
|
-
|
|
179
|
-
let newSelected = new Set(selectedKeys.value)
|
|
180
|
-
const isCurrentlySelected = newSelected.has(node.id)
|
|
181
|
-
|
|
182
|
-
if (props.selectionMode === 'single') {
|
|
183
|
-
newSelected.clear()
|
|
184
|
-
if (!isCurrentlySelected) {
|
|
185
|
-
newSelected.add(node.id)
|
|
186
|
-
}
|
|
187
|
-
} else if (props.selectionMode === 'multiple') {
|
|
188
|
-
// Recursive Logic using original structure
|
|
189
|
-
const descendants = getDescendants(originalNode)
|
|
190
|
-
const targetState = !isCurrentlySelected // Toggle
|
|
191
|
-
|
|
192
|
-
const updateSet = (id: string, add: boolean) => {
|
|
193
|
-
if (add) newSelected.add(id)
|
|
194
|
-
else newSelected.delete(id)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// 1. Update Node and All Descendants
|
|
198
|
-
updateSet(node.id, targetState)
|
|
199
|
-
descendants.forEach((id) => updateSet(id, targetState))
|
|
200
|
-
|
|
201
|
-
// 2. Update Ancestors (Bubble Up)
|
|
202
|
-
let curr = originalNode
|
|
203
|
-
while (true) {
|
|
204
|
-
const parentId = parentMap.value.get(curr.id)
|
|
205
|
-
if (!parentId) break
|
|
206
|
-
|
|
207
|
-
const parent = nodeMap.value.get(parentId)
|
|
208
|
-
if (!parent) break
|
|
209
|
-
|
|
210
|
-
// Check all children of parent
|
|
211
|
-
if (!parent.children) break
|
|
212
|
-
|
|
213
|
-
const allSiblingsSelected = parent.children.every((child) => newSelected.has(child.id))
|
|
214
|
-
|
|
215
|
-
if (allSiblingsSelected) {
|
|
216
|
-
newSelected.add(parent.id)
|
|
217
|
-
} else {
|
|
218
|
-
newSelected.delete(parent.id)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
curr = parent
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
emit('update:modelValue', Array.from(newSelected))
|
|
226
|
-
emit('select', originalNode, !isCurrentlySelected)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Search Filtering
|
|
230
|
-
// We don't mutate `data` prop. We filter visibly?
|
|
231
|
-
// If we use v-show on nodes, we need to pass `searchQuery` down.
|
|
232
|
-
// BUT `FileTreeNode` handles visibility?
|
|
233
|
-
// Better: We compute a filtered tree or set of "Visible IDs".
|
|
234
|
-
// And we Auto-Expand.
|
|
235
|
-
|
|
236
|
-
const filteredData = computed(() => {
|
|
237
|
-
// If no search, return match
|
|
238
|
-
// Actually, passing data as-is and letting nodes decide highlight is one thing,
|
|
239
|
-
// but filtering (hiding non-matches) implies structure change.
|
|
240
|
-
// "The tree should automatically expand folders that contain matching results"
|
|
241
|
-
|
|
242
|
-
if (!props.searchQuery) return props.data
|
|
243
|
-
|
|
244
|
-
// Return same structure?
|
|
245
|
-
// We usually want to show the path to the match.
|
|
246
|
-
// We can just rely on `v-show` if we pass a "isVisible" prop?
|
|
247
|
-
// Or we create a filtered clone? Clone is safer for render loops.
|
|
248
|
-
|
|
249
|
-
// Let's do a filter+clone.
|
|
250
|
-
const query = props.searchQuery.toLowerCase()
|
|
251
|
-
|
|
252
|
-
const filterNode = (node: FileNode): FileNode | null => {
|
|
253
|
-
const match = node.label.toLowerCase().includes(query)
|
|
254
|
-
let filteredChildren: FileNode[] = []
|
|
255
|
-
|
|
256
|
-
if (node.children) {
|
|
257
|
-
filteredChildren = node.children.map(filterNode).filter((n) => n !== null) as FileNode[]
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (match || filteredChildren.length > 0) {
|
|
261
|
-
// Return clone properties + filtered children
|
|
262
|
-
return {
|
|
263
|
-
...node,
|
|
264
|
-
children: filteredChildren,
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return null
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return props.data.map(filterNode).filter((n) => n !== null) as FileNode[]
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
// Auto Expand on Search
|
|
275
|
-
watch(
|
|
276
|
-
() => props.searchQuery,
|
|
277
|
-
(newVal) => {
|
|
278
|
-
if (newVal) {
|
|
279
|
-
const query = newVal.toLowerCase()
|
|
280
|
-
const toExpand = new Set<string>()
|
|
281
|
-
|
|
282
|
-
const visit = (node: FileNode): boolean => {
|
|
283
|
-
let childMatch = false
|
|
284
|
-
if (node.children) {
|
|
285
|
-
for (const child of node.children) {
|
|
286
|
-
if (visit(child)) childMatch = true
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const selfMatch = node.label.toLowerCase().includes(query)
|
|
291
|
-
|
|
292
|
-
if (childMatch) {
|
|
293
|
-
toExpand.add(node.id)
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return selfMatch || childMatch
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
props.data.forEach(visit)
|
|
300
|
-
|
|
301
|
-
// Merge with existing expanded
|
|
302
|
-
toExpand.forEach((id) => expandedKeys.value.add(id))
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
</script>
|
|
307
|
-
|
|
308
|
-
<template>
|
|
309
|
-
<div :class="['w-full h-full overflow-y-auto', props.class]">
|
|
310
|
-
<!-- Debug Info (Temporary) -->
|
|
311
|
-
<!-- <div class="text-xs text-red-500 border-b p-1">
|
|
312
|
-
Data Len: {{ data.length }} | Filtered: {{ filteredData.length }} | Search: "{{ searchQuery }}"
|
|
313
|
-
</div> -->
|
|
314
|
-
|
|
315
|
-
<template v-if="filteredData.length > 0">
|
|
316
|
-
<FileTreeNode
|
|
317
|
-
v-for="node in filteredData"
|
|
318
|
-
:key="node.id"
|
|
319
|
-
:node="node"
|
|
320
|
-
:selection-mode="selectionMode"
|
|
321
|
-
:selected-keys="selectedKeys"
|
|
322
|
-
:expanded-keys="expandedKeys"
|
|
323
|
-
:indeterminate-keys="indeterminateKeys"
|
|
324
|
-
:loading-keys="loadingKeys"
|
|
325
|
-
:show-checkboxes="showCheckboxes"
|
|
326
|
-
:highlight-search="highlightSearch"
|
|
327
|
-
:search-query="searchQuery"
|
|
328
|
-
@toggle-expand="handleToggleExpand"
|
|
329
|
-
@toggle-select="handleToggleSelect"
|
|
330
|
-
@click-node="(n) => emit('node-click', n)" />
|
|
331
|
-
</template>
|
|
332
|
-
<div v-else class="text-sm text-muted-foreground p-4 text-center">No results found.</div>
|
|
333
|
-
</div>
|
|
334
|
-
</template>
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, inject } from 'vue'
|
|
3
|
-
import type { FileNode, FileTreeSelectionMode } from './types'
|
|
4
|
-
import Icon from '../Icon.vue'
|
|
5
|
-
import CheckBox from '../CheckBox.vue'
|
|
6
|
-
|
|
7
|
-
defineOptions({
|
|
8
|
-
name: 'FileTreeNode',
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
node: FileNode
|
|
13
|
-
depth?: number
|
|
14
|
-
selectionMode?: FileTreeSelectionMode
|
|
15
|
-
selectedKeys: Set<string>
|
|
16
|
-
indeterminateKeys: Set<string>
|
|
17
|
-
expandedKeys: Set<string>
|
|
18
|
-
loadingKeys: Set<string>
|
|
19
|
-
showCheckboxes?: boolean
|
|
20
|
-
highlightSearch?: boolean
|
|
21
|
-
searchQuery?: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
25
|
-
depth: 0,
|
|
26
|
-
selectionMode: 'single',
|
|
27
|
-
showCheckboxes: false,
|
|
28
|
-
highlightSearch: false,
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const emit = defineEmits<{
|
|
32
|
-
(e: 'toggle-expand', node: FileNode): void
|
|
33
|
-
(e: 'toggle-select', node: FileNode): void
|
|
34
|
-
(e: 'click-node', node: FileNode): void
|
|
35
|
-
}>()
|
|
36
|
-
|
|
37
|
-
// Computed
|
|
38
|
-
const isSelected = computed(() => props.selectedKeys.has(props.node.id))
|
|
39
|
-
const isIndeterminate = computed(() => props.indeterminateKeys.has(props.node.id))
|
|
40
|
-
const isExpanded = computed(() => props.expandedKeys.has(props.node.id))
|
|
41
|
-
const isLoading = computed(() => props.loadingKeys.has(props.node.id))
|
|
42
|
-
|
|
43
|
-
const isFolder = computed(
|
|
44
|
-
() => props.node.isFolder || (props.node.children && props.node.children.length > 0)
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
const paddingLeft = computed(() => {
|
|
48
|
-
return props.depth * 20 + 'px' // 20px per level
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
// Truncation Helper
|
|
52
|
-
const truncatedLabel = computed(() => {
|
|
53
|
-
const label = props.node.label
|
|
54
|
-
const maxLength = 35 // Max chars before truncation logic kicks in
|
|
55
|
-
|
|
56
|
-
if (label.length <= maxLength) return label
|
|
57
|
-
|
|
58
|
-
// Attempt to preserve extension
|
|
59
|
-
const lastDotIndex = label.lastIndexOf('.')
|
|
60
|
-
|
|
61
|
-
// If no extension or it's a folder usually (folders might have dots too but fewer rules)
|
|
62
|
-
// or extension is too long (weird case)
|
|
63
|
-
if (lastDotIndex === -1 || label.length - lastDotIndex > 10) {
|
|
64
|
-
return label.substring(0, maxLength) + '...'
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const ext = label.substring(lastDotIndex)
|
|
68
|
-
const name = label.substring(0, lastDotIndex)
|
|
69
|
-
|
|
70
|
-
// We want total length ~ maxLength
|
|
71
|
-
// Available for name = maxLength - ext.length - 3 (for '...')
|
|
72
|
-
const available = Math.max(0, maxLength - ext.length - 3)
|
|
73
|
-
|
|
74
|
-
return name.substring(0, available) + '...' + ext
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
// Highlight Search
|
|
78
|
-
const labelParts = computed(() => {
|
|
79
|
-
const displayText = truncatedLabel.value
|
|
80
|
-
|
|
81
|
-
if (!props.highlightSearch || !props.searchQuery) {
|
|
82
|
-
return [{ text: displayText, highlight: false }]
|
|
83
|
-
}
|
|
84
|
-
const query = props.searchQuery.toLowerCase()
|
|
85
|
-
const index = displayText.toLowerCase().indexOf(query)
|
|
86
|
-
|
|
87
|
-
if (index === -1) return [{ text: displayText, highlight: false }]
|
|
88
|
-
|
|
89
|
-
return [
|
|
90
|
-
{ text: displayText.slice(0, index), highlight: false },
|
|
91
|
-
{
|
|
92
|
-
text: displayText.slice(index, index + query.length),
|
|
93
|
-
highlight: true,
|
|
94
|
-
},
|
|
95
|
-
{ text: displayText.slice(index + query.length), highlight: false },
|
|
96
|
-
]
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
// Handlers
|
|
100
|
-
const handleExpand = (e?: MouseEvent) => {
|
|
101
|
-
if (e) e.stopPropagation()
|
|
102
|
-
emit('toggle-expand', props.node)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const handleSelect = (e?: Event | boolean) => {
|
|
106
|
-
// Checkbox change
|
|
107
|
-
emit('toggle-select', props.node)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const handleClick = (e: MouseEvent) => {
|
|
111
|
-
e.stopPropagation()
|
|
112
|
-
|
|
113
|
-
// UX Improvement:
|
|
114
|
-
// If Folder -> Expand/Collapse
|
|
115
|
-
if (isFolder.value) {
|
|
116
|
-
handleExpand()
|
|
117
|
-
} else {
|
|
118
|
-
// If File -> Toggle Selection (if mode allows)
|
|
119
|
-
// Works for both checkbox and single mode
|
|
120
|
-
if (props.selectionMode !== 'none') {
|
|
121
|
-
emit('toggle-select', props.node)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
emit('click-node', props.node)
|
|
126
|
-
}
|
|
127
|
-
</script>
|
|
128
|
-
|
|
129
|
-
<template>
|
|
130
|
-
<div class="flex flex-col select-none">
|
|
131
|
-
<!-- Node Row -->
|
|
132
|
-
<div
|
|
133
|
-
class="group flex items-center py-1 pr-2 rounded-md hover:bg-accent/50 transition-colors cursor-pointer min-h-[32px]"
|
|
134
|
-
:class="{
|
|
135
|
-
'bg-accent/50 text-accent-foreground':
|
|
136
|
-
isSelected && selectionMode === 'single' && !showCheckboxes,
|
|
137
|
-
'opacity-50 pointer-events-none': node.disabled,
|
|
138
|
-
}"
|
|
139
|
-
:style="{ paddingLeft }"
|
|
140
|
-
@click="handleClick"
|
|
141
|
-
:title="node.label">
|
|
142
|
-
<!-- Expand Logic: Chevron or Spacer -->
|
|
143
|
-
<!-- We keep the button for explicit chevron clicking, but row click also triggers it -->
|
|
144
|
-
<button
|
|
145
|
-
v-if="isFolder"
|
|
146
|
-
type="button"
|
|
147
|
-
class="p-1 mr-1 rounded-sm hover:bg-muted text-muted-foreground transition-transform duration-200 focus:outline-none"
|
|
148
|
-
:class="{ 'rotate-90': isExpanded }"
|
|
149
|
-
@click.stop="handleExpand">
|
|
150
|
-
<Icon icon="lucide:chevron-right" class="w-4 h-4" />
|
|
151
|
-
</button>
|
|
152
|
-
<div v-else class="w-6 mr-1" />
|
|
153
|
-
<!-- Spacer for non-folders -->
|
|
154
|
-
|
|
155
|
-
<!-- Checkbox -->
|
|
156
|
-
<div
|
|
157
|
-
v-if="showCheckboxes && selectionMode !== 'none'"
|
|
158
|
-
class="mr-2 flex items-center justify-center bg-transparent"
|
|
159
|
-
@click.stop>
|
|
160
|
-
<CheckBox
|
|
161
|
-
:checked="isSelected"
|
|
162
|
-
:indeterminate="isIndeterminate"
|
|
163
|
-
:disabled="node.disabled"
|
|
164
|
-
@update:checked="handleSelect"
|
|
165
|
-
rounded="sm"
|
|
166
|
-
size="sm" />
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<!-- Icon -->
|
|
170
|
-
<div class="mr-2 text-muted-foreground shrink-0">
|
|
171
|
-
<Icon v-if="isLoading" icon="lucide:loader-2" class="w-4 h-4 animate-spin" />
|
|
172
|
-
<Icon v-else-if="node.icon" :icon="node.icon" class="w-4 h-4" />
|
|
173
|
-
<Icon
|
|
174
|
-
v-else-if="isFolder"
|
|
175
|
-
:icon="isExpanded ? 'lucide:folder-open' : 'lucide:folder'"
|
|
176
|
-
class="w-4 h-4" />
|
|
177
|
-
<Icon v-else icon="lucide:file" class="w-4 h-4" />
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
<!-- Label -->
|
|
181
|
-
<div class="flex-1 truncate text-sm font-medium">
|
|
182
|
-
<template v-for="(part, i) in labelParts" :key="i">
|
|
183
|
-
<span
|
|
184
|
-
:class="{
|
|
185
|
-
'bg-yellow-100 text-yellow-900 rounded-sm px-0.5': part.highlight,
|
|
186
|
-
}"
|
|
187
|
-
>{{ part.text }}</span
|
|
188
|
-
>
|
|
189
|
-
</template>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<!-- Children (Recursive) -->
|
|
194
|
-
<div v-if="isExpanded && isFolder && !isLoading" class="relative flex flex-col">
|
|
195
|
-
<!-- Vertical Line -->
|
|
196
|
-
<div
|
|
197
|
-
class="absolute top-1 bottom-1 border-l border-border"
|
|
198
|
-
:style="{ left: depth * 20 + 10 + 'px' }"></div>
|
|
199
|
-
|
|
200
|
-
<template v-if="node.children && node.children.length > 0">
|
|
201
|
-
<FileTreeNode
|
|
202
|
-
v-for="child in node.children"
|
|
203
|
-
:key="child.id"
|
|
204
|
-
:node="child"
|
|
205
|
-
:depth="depth + 1"
|
|
206
|
-
:selection-mode="selectionMode"
|
|
207
|
-
:selected-keys="selectedKeys"
|
|
208
|
-
:expanded-keys="expandedKeys"
|
|
209
|
-
:indeterminate-keys="indeterminateKeys"
|
|
210
|
-
:loading-keys="loadingKeys"
|
|
211
|
-
:show-checkboxes="showCheckboxes"
|
|
212
|
-
:highlight-search="highlightSearch"
|
|
213
|
-
:search-query="searchQuery"
|
|
214
|
-
@toggle-expand="(n) => $emit('toggle-expand', n)"
|
|
215
|
-
@toggle-select="(n) => $emit('toggle-select', n)"
|
|
216
|
-
@click-node="(n) => $emit('click-node', n)" />
|
|
217
|
-
</template>
|
|
218
|
-
<!-- Empty State - Adjusted Padding -->
|
|
219
|
-
<div
|
|
220
|
-
v-else-if="isExpanded && isFolder && (!node.children || node.children.length === 0)"
|
|
221
|
-
class="py-0.5 text-xs text-muted-foreground italic"
|
|
222
|
-
:style="{ paddingLeft: (depth + 1) * 20 + 26 + 'px' }"></div>
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</template>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface FileNode {
|
|
2
|
-
id: string
|
|
3
|
-
label: string
|
|
4
|
-
isFolder?: boolean
|
|
5
|
-
children?: FileNode[]
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
icon?: string
|
|
8
|
-
data?: any
|
|
9
|
-
isLoaded?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type FileTreeSelectionMode = 'single' | 'multiple' | 'none'
|
|
13
|
-
|
|
14
|
-
export interface FileTreeProps {
|
|
15
|
-
data: FileNode[]
|
|
16
|
-
modelValue?: string[]
|
|
17
|
-
selectionMode?: FileTreeSelectionMode
|
|
18
|
-
showCheckboxes?: boolean
|
|
19
|
-
defaultExpandedKeys?: string[]
|
|
20
|
-
loadData?: (node: FileNode) => Promise<FileNode[]>
|
|
21
|
-
searchQuery?: string
|
|
22
|
-
highlightSearch?: boolean
|
|
23
|
-
class?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface FileTreeEvents {
|
|
27
|
-
(e: 'update:modelValue', value: string[]): void
|
|
28
|
-
(e: 'select', node: FileNode, selected: boolean): void
|
|
29
|
-
(e: 'expand', node: FileNode, expanded: boolean): void
|
|
30
|
-
(e: 'node-click', node: FileNode): void
|
|
31
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { computed, type Ref } from 'vue'
|
|
2
|
-
import type { FileNode } from './types'
|
|
3
|
-
|
|
4
|
-
interface UseTreeSelectionProps {
|
|
5
|
-
data: Ref<FileNode[]>
|
|
6
|
-
selectedKeys: Ref<Set<string>>
|
|
7
|
-
selectionMode: Ref<'single' | 'multiple' | 'none'>
|
|
8
|
-
emit: (event: 'update:modelValue' | 'select', ...args: any[]) => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function useTreeSelection({
|
|
12
|
-
data,
|
|
13
|
-
selectedKeys,
|
|
14
|
-
selectionMode,
|
|
15
|
-
emit,
|
|
16
|
-
}: UseTreeSelectionProps) {
|
|
17
|
-
// Helper to find parent of a node (needed for verifying indeterminate state upwards)
|
|
18
|
-
// Since we don't have back-pointers, we might need a map or traverse.
|
|
19
|
-
// For performance on large trees, a flat map of ID -> ParentID is useful.
|
|
20
|
-
// But let's start with traversal if needed, or assume we handle it via events propagating up/down?
|
|
21
|
-
// Actually, standard approach:
|
|
22
|
-
// 1. Flatten map for quick lookups?
|
|
23
|
-
// 2. Or recursive "check all" down, and "verify all" up.
|
|
24
|
-
|
|
25
|
-
// Let's implement a recursive toggle.
|
|
26
|
-
|
|
27
|
-
const toggleSelection = (node: FileNode, selected: boolean) => {
|
|
28
|
-
if (node.disabled) return
|
|
29
|
-
|
|
30
|
-
const newSelected = new Set(selectedKeys.value)
|
|
31
|
-
|
|
32
|
-
if (selectionMode.value === 'single') {
|
|
33
|
-
newSelected.clear()
|
|
34
|
-
if (selected) {
|
|
35
|
-
newSelected.add(node.id)
|
|
36
|
-
}
|
|
37
|
-
} else if (selectionMode.value === 'multiple') {
|
|
38
|
-
// Recursive selection
|
|
39
|
-
const traverse = (n: FileNode, val: boolean) => {
|
|
40
|
-
if (n.disabled) return
|
|
41
|
-
if (val) newSelected.add(n.id)
|
|
42
|
-
else newSelected.delete(n.id)
|
|
43
|
-
|
|
44
|
-
if (n.children) {
|
|
45
|
-
n.children.forEach((c) => traverse(c, val))
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
traverse(node, selected)
|
|
49
|
-
|
|
50
|
-
// We also need to re-verify parents (if a child is unchecked, parent must be unchecked)
|
|
51
|
-
// This is tricky without parent pointers.
|
|
52
|
-
// OPTION: We assume the parent component (FileTree) re-calculates or we use a helper to re-evaluate the whole tree state based on leaves?
|
|
53
|
-
// "Selecting a folder should recursively select all nested files".
|
|
54
|
-
// "Unselecting a child -> Parent unselected" is standard but not explicitly requested, but implies consistency.
|
|
55
|
-
// Let's implement robust consistency in the main component or here if we have access to full tree.
|
|
56
|
-
// We have `data` ref. We can rebuild consistency.
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
emit('update:modelValue', Array.from(newSelected))
|
|
60
|
-
emit('select', node, selected)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
toggleSelection,
|
|
65
|
-
}
|
|
66
|
-
}
|