@antify/ui-module 1.1.3
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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +131 -0
- package/dist/module.d.ts +131 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +339 -0
- package/dist/runtime/assets/tailwind.css +1 -0
- package/dist/runtime/components/AntAccordion.vue +59 -0
- package/dist/runtime/components/AntAccordionItem.vue +66 -0
- package/dist/runtime/components/AntAlert.vue +137 -0
- package/dist/runtime/components/AntDropdown.vue +79 -0
- package/dist/runtime/components/AntIcon.vue +51 -0
- package/dist/runtime/components/AntKeycap.vue +24 -0
- package/dist/runtime/components/AntListGroup.vue +24 -0
- package/dist/runtime/components/AntListGroupItem.vue +81 -0
- package/dist/runtime/components/AntModal.vue +87 -0
- package/dist/runtime/components/AntPagination.vue +201 -0
- package/dist/runtime/components/AntPopover.vue +112 -0
- package/dist/runtime/components/AntSkeleton.vue +38 -0
- package/dist/runtime/components/AntSpinner.vue +95 -0
- package/dist/runtime/components/AntTag.vue +79 -0
- package/dist/runtime/components/AntToast.vue +109 -0
- package/dist/runtime/components/AntToaster.vue +46 -0
- package/dist/runtime/components/AntTooltip.vue +165 -0
- package/dist/runtime/components/Main.stories.mdx +10 -0
- package/dist/runtime/components/__stories/AntAccordion.stories.d.ts +9 -0
- package/dist/runtime/components/__stories/AntAccordion.stories.mjs +97 -0
- package/dist/runtime/components/__stories/AntAlert.stories.d.ts +10 -0
- package/dist/runtime/components/__stories/AntAlert.stories.mjs +75 -0
- package/dist/runtime/components/__stories/AntDropdown.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntDropdown.stories.mjs +52 -0
- package/dist/runtime/components/__stories/AntIcon.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntIcon.stories.mjs +90 -0
- package/dist/runtime/components/__stories/AntKeycap.stories.d.ts +9 -0
- package/dist/runtime/components/__stories/AntKeycap.stories.mjs +59 -0
- package/dist/runtime/components/__stories/AntListGroup.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntListGroup.stories.mjs +36 -0
- package/dist/runtime/components/__stories/AntListGroupItem.stories.d.ts +10 -0
- package/dist/runtime/components/__stories/AntListGroupItem.stories.mjs +62 -0
- package/dist/runtime/components/__stories/AntModal.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntModal.stories.mjs +78 -0
- package/dist/runtime/components/__stories/AntPagination.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntPagination.stories.mjs +39 -0
- package/dist/runtime/components/__stories/AntPopover.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntPopover.stories.mjs +47 -0
- package/dist/runtime/components/__stories/AntSkeleton.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntSkeleton.stories.mjs +43 -0
- package/dist/runtime/components/__stories/AntSpinner.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntSpinner.stories.mjs +34 -0
- package/dist/runtime/components/__stories/AntTag.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntTag.stories.mjs +44 -0
- package/dist/runtime/components/__stories/AntToast.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntToast.stories.mjs +66 -0
- package/dist/runtime/components/__stories/AntToaster.stories.d.ts +34 -0
- package/dist/runtime/components/__stories/AntToaster.stories.mjs +42 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.mjs +43 -0
- package/dist/runtime/components/__types/Accordion.types.d.ts +4 -0
- package/dist/runtime/components/__types/Accordion.types.mjs +5 -0
- package/dist/runtime/components/__types/AntIcon.types.d.ts +5 -0
- package/dist/runtime/components/__types/AntIcon.types.mjs +6 -0
- package/dist/runtime/components/__types/AntToaster.types.d.ts +8 -0
- package/dist/runtime/components/__types/AntToaster.types.mjs +0 -0
- package/dist/runtime/components/__types/index.d.ts +2 -0
- package/dist/runtime/components/__types/index.mjs +2 -0
- package/dist/runtime/components/buttons/AntButton.vue +227 -0
- package/dist/runtime/components/buttons/AntCreateButton.vue +32 -0
- package/dist/runtime/components/buttons/AntDeleteButton.vue +32 -0
- package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +32 -0
- package/dist/runtime/components/buttons/AntSaveButton.vue +31 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +15 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +272 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__types/AntButton.type.d.ts +4 -0
- package/dist/runtime/components/buttons/__types/AntButton.type.mjs +5 -0
- package/dist/runtime/components/buttons/__types/index.d.ts +1 -0
- package/dist/runtime/components/buttons/__types/index.mjs +1 -0
- package/dist/runtime/components/crud/AntCrud.vue +42 -0
- package/dist/runtime/components/crud/AntCrudDetail.vue +11 -0
- package/dist/runtime/components/crud/AntCrudDetailActions.vue +51 -0
- package/dist/runtime/components/crud/AntCrudDetailNav.vue +51 -0
- package/dist/runtime/components/crud/AntCrudTableFilter.vue +120 -0
- package/dist/runtime/components/crud/AntCrudTableNav.vue +129 -0
- package/dist/runtime/components/crud/__stories/AntCrud.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrud.stories.mjs +126 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetail.stories.d.ts +7 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetail.stories.mjs +80 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailActions.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailActions.stories.mjs +25 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailNav.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailNav.stories.mjs +41 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableFilter.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableFilter.stories.mjs +25 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableNav.stories.d.ts +8 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableNav.stories.mjs +56 -0
- package/dist/runtime/components/dialogs/AntDeleteDialog.vue +29 -0
- package/dist/runtime/components/dialogs/AntDialog.vue +147 -0
- package/dist/runtime/components/dialogs/__stories/AndDeleteDialog.stories.d.ts +6 -0
- package/dist/runtime/components/dialogs/__stories/AndDeleteDialog.stories.mjs +30 -0
- package/dist/runtime/components/dialogs/__stories/AntDialog.stories.d.ts +6 -0
- package/dist/runtime/components/dialogs/__stories/AntDialog.stories.mjs +60 -0
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +145 -0
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +91 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.mjs +286 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckboxGroup.stories.d.ts +7 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckboxGroup.stories.mjs +96 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__types/AntCheckbox.d.ts +6 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__types/AntCheckbox.mjs +0 -0
- package/dist/runtime/components/form/AntFormGroup.vue +21 -0
- package/dist/runtime/components/form/AntFormGroupLabel.vue +5 -0
- package/dist/runtime/components/form/AntNumberInput.vue +170 -0
- package/dist/runtime/components/form/AntRadioWidget/AntRadio.vue +139 -0
- package/dist/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +80 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.mjs +79 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadioGroup.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadioGroup.stories.mjs +125 -0
- package/dist/runtime/components/form/AntRadioWidget/__types/AntRadio.type.d.ts +9 -0
- package/dist/runtime/components/form/AntRadioWidget/__types/AntRadio.type.mjs +0 -0
- package/dist/runtime/components/form/AntRangeSlider.vue +81 -0
- package/dist/runtime/components/form/AntRichTextEditor.vue +237 -0
- package/dist/runtime/components/form/AntSearch.vue +76 -0
- package/dist/runtime/components/form/AntSelect.vue +346 -0
- package/dist/runtime/components/form/AntSwitch.vue +145 -0
- package/dist/runtime/components/form/AntSwitcher.vue +184 -0
- package/dist/runtime/components/form/AntTextInput.vue +73 -0
- package/dist/runtime/components/form/AntTextarea.vue +170 -0
- package/dist/runtime/components/form/AntUnitInput.vue +99 -0
- package/dist/runtime/components/form/Elements/AntBaseInput.vue +216 -0
- package/dist/runtime/components/form/Elements/AntDropDown.vue +160 -0
- package/dist/runtime/components/form/Elements/AntField.vue +102 -0
- package/dist/runtime/components/form/Elements/AntInputDescription.vue +55 -0
- package/dist/runtime/components/form/Elements/AntInputLabel.vue +55 -0
- package/dist/runtime/components/form/Elements/AntInputLimiter.vue +55 -0
- package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.d.ts +9 -0
- package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.mjs +168 -0
- package/dist/runtime/components/form/Elements/__stories/AntField.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntField.stories.mjs +80 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputDescription.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputDescription.stories.mjs +34 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLabel.stories.d.ts +7 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLabel.stories.mjs +46 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLimiter.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLimiter.stories.mjs +37 -0
- package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.d.ts +16 -0
- package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.mjs +17 -0
- package/dist/runtime/components/form/Elements/__types/index.d.ts +1 -0
- package/dist/runtime/components/form/Elements/__types/index.mjs +1 -0
- package/dist/runtime/components/form/Elements/index.d.ts +6 -0
- package/dist/runtime/components/form/Elements/index.mjs +12 -0
- package/dist/runtime/components/form/__stories/AntFormGroup.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntFormGroup.stories.mjs +33 -0
- package/dist/runtime/components/form/__stories/AntFormGroupLabel.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntFormGroupLabel.stories.mjs +20 -0
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.d.ts +7 -0
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.mjs +67 -0
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.mjs +40 -0
- package/dist/runtime/components/form/__stories/AntRichTextEditor.stories-old.d.ts +0 -0
- package/dist/runtime/components/form/__stories/AntRichTextEditor.stories-old.mjs +0 -0
- package/dist/runtime/components/form/__stories/AntSearch.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntSearch.stories.mjs +43 -0
- package/dist/runtime/components/form/__stories/AntSelect.stories.d.ts +13 -0
- package/dist/runtime/components/form/__stories/AntSelect.stories.mjs +220 -0
- package/dist/runtime/components/form/__stories/AntSwitch.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntSwitch.stories.mjs +215 -0
- package/dist/runtime/components/form/__stories/AntSwitcher.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntSwitcher.stories.mjs +225 -0
- package/dist/runtime/components/form/__stories/AntTextInput.stories.d.ts +7 -0
- package/dist/runtime/components/form/__stories/AntTextInput.stories.mjs +68 -0
- package/dist/runtime/components/form/__stories/AntTextarea.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntTextarea.stories.mjs +128 -0
- package/dist/runtime/components/form/__stories/AntUnitInput.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntUnitInput.stories.mjs +84 -0
- package/dist/runtime/components/form/__types/AntSelect.type.d.ts +4 -0
- package/dist/runtime/components/form/__types/AntSelect.type.mjs +0 -0
- package/dist/runtime/components/form/__types/AntSwitcher.type.d.ts +4 -0
- package/dist/runtime/components/form/__types/AntSwitcher.type.mjs +0 -0
- package/dist/runtime/components/form/__types/AntTextInput.type.d.ts +7 -0
- package/dist/runtime/components/form/__types/AntTextInput.type.mjs +8 -0
- package/dist/runtime/components/form/__types/index.d.ts +3 -0
- package/dist/runtime/components/form/__types/index.mjs +3 -0
- package/dist/runtime/components/form/index.d.ts +11 -0
- package/dist/runtime/components/form/index.mjs +22 -0
- package/dist/runtime/components/index.d.ts +22 -0
- package/dist/runtime/components/index.mjs +41 -0
- package/dist/runtime/components/layouts/AntNavLeftLayout.vue +36 -0
- package/dist/runtime/components/layouts/__stories/AntNavLeftLayout.stories.d.ts +7 -0
- package/dist/runtime/components/layouts/__stories/AntNavLeftLayout.stories.mjs +68 -0
- package/dist/runtime/components/navbar/AntNavbar.vue +25 -0
- package/dist/runtime/components/navbar/AntNavbarItem.vue +78 -0
- package/dist/runtime/components/navbar/__stories/AntNavbar.stories.d.ts +6 -0
- package/dist/runtime/components/navbar/__stories/AntNavbar.stories.mjs +66 -0
- package/dist/runtime/components/navbar/__types/NavbarItem.d.ts +10 -0
- package/dist/runtime/components/navbar/__types/NavbarItem.mjs +0 -0
- package/dist/runtime/components/table/AntTable.vue +192 -0
- package/dist/runtime/components/table/AntTableSortButton.vue +26 -0
- package/dist/runtime/components/table/AntTd.vue +70 -0
- package/dist/runtime/components/table/AntTh.vue +67 -0
- package/dist/runtime/components/table/__stories/AntTable.stories.d.ts +9 -0
- package/dist/runtime/components/table/__stories/AntTable.stories.mjs +274 -0
- package/dist/runtime/components/table/__types/TableHeader.type.d.ts +31 -0
- package/dist/runtime/components/table/__types/TableHeader.type.mjs +19 -0
- package/dist/runtime/components/tabs/AntTabItem.vue +115 -0
- package/dist/runtime/components/tabs/AntTabs.vue +47 -0
- package/dist/runtime/components/tabs/__stories/AntTabItem.stories.d.ts +6 -0
- package/dist/runtime/components/tabs/__stories/AntTabItem.stories.mjs +32 -0
- package/dist/runtime/components/tabs/__stories/AntTabs.stories.d.ts +9 -0
- package/dist/runtime/components/tabs/__stories/AntTabs.stories.mjs +173 -0
- package/dist/runtime/components/tabs/__types/AntTabItem.types.d.ts +17 -0
- package/dist/runtime/components/tabs/__types/AntTabItem.types.mjs +6 -0
- package/dist/runtime/components/transitions/AntTransitionCollapseHeight.vue +92 -0
- package/dist/runtime/composables/useUi.d.ts +20 -0
- package/dist/runtime/composables/useUi.mjs +31 -0
- package/dist/runtime/composables/useUiClient.d.ts +34 -0
- package/dist/runtime/composables/useUiClient.mjs +61 -0
- package/dist/runtime/composables/useValidator.d.ts +1 -0
- package/dist/runtime/composables/useValidator.mjs +1 -0
- package/dist/runtime/enums/ColorType.enum.d.ts +16 -0
- package/dist/runtime/enums/ColorType.enum.mjs +18 -0
- package/dist/runtime/enums/Direction.enum.d.ts +4 -0
- package/dist/runtime/enums/Direction.enum.mjs +5 -0
- package/dist/runtime/enums/Grouped.enum.d.ts +6 -0
- package/dist/runtime/enums/Grouped.enum.mjs +7 -0
- package/dist/runtime/enums/Position.enum.d.ts +12 -0
- package/dist/runtime/enums/Position.enum.mjs +14 -0
- package/dist/runtime/enums/Size.enum.d.ts +4 -0
- package/dist/runtime/enums/Size.enum.mjs +5 -0
- package/dist/runtime/enums/index.d.ts +4 -0
- package/dist/runtime/enums/index.mjs +4 -0
- package/dist/runtime/env.d.ts +8 -0
- package/dist/runtime/handler.d.ts +1 -0
- package/dist/runtime/handler.mjs +5 -0
- package/dist/runtime/plugins/toaster.d.ts +22 -0
- package/dist/runtime/plugins/toaster.mjs +53 -0
- package/dist/runtime/plugins/ui-module.d.ts +2 -0
- package/dist/runtime/plugins/ui-module.mjs +13 -0
- package/dist/runtime/shims/vue.d.ts +5 -0
- package/dist/runtime/tailwind.config.d.ts +182 -0
- package/dist/runtime/tailwind.config.mjs +196 -0
- package/dist/runtime/types/AntListGroupItem.type.d.ts +11 -0
- package/dist/runtime/types/AntListGroupItem.type.mjs +12 -0
- package/dist/runtime/types/AntTag.type.d.ts +8 -0
- package/dist/runtime/types/AntTag.type.mjs +9 -0
- package/dist/runtime/types/Checkbox.type.d.ts +8 -0
- package/dist/runtime/types/Checkbox.type.mjs +0 -0
- package/dist/runtime/types/NavItem.type.d.ts +9 -0
- package/dist/runtime/types/NavItem.type.mjs +0 -0
- package/dist/runtime/types/RadioButton.type.d.ts +5 -0
- package/dist/runtime/types/RadioButton.type.mjs +0 -0
- package/dist/runtime/types/Tabs.type.d.ts +6 -0
- package/dist/runtime/types/Tabs.type.mjs +0 -0
- package/dist/runtime/types/Toaster.type.d.ts +6 -0
- package/dist/runtime/types/Toaster.type.mjs +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.mjs +7 -0
- package/dist/runtime/types.d.ts +7 -0
- package/dist/runtime/types.mjs +7 -0
- package/dist/runtime/utils/helper.d.ts +4 -0
- package/dist/runtime/utils/helper.mjs +12 -0
- package/dist/runtime/utils.d.ts +14 -0
- package/dist/runtime/utils.mjs +20 -0
- package/dist/types.d.mts +8 -0
- package/dist/types.d.ts +8 -0
- package/package.json +81 -0
- package/src/runtime/components/AntAccordion.vue +59 -0
- package/src/runtime/components/AntAccordionItem.vue +104 -0
- package/src/runtime/components/AntAlert.vue +137 -0
- package/src/runtime/components/AntDropdown.vue +100 -0
- package/src/runtime/components/AntIcon.vue +51 -0
- package/src/runtime/components/AntKeycap.vue +24 -0
- package/src/runtime/components/AntListGroup.vue +24 -0
- package/src/runtime/components/AntListGroupItem.vue +81 -0
- package/src/runtime/components/AntModal.vue +129 -0
- package/src/runtime/components/AntPagination.vue +201 -0
- package/src/runtime/components/AntPopover.vue +133 -0
- package/src/runtime/components/AntSkeleton.vue +38 -0
- package/src/runtime/components/AntSpinner.vue +95 -0
- package/src/runtime/components/AntTag.vue +79 -0
- package/src/runtime/components/AntToast.vue +109 -0
- package/src/runtime/components/AntToaster.vue +71 -0
- package/src/runtime/components/AntTooltip.vue +165 -0
- package/src/runtime/components/buttons/AntButton.vue +227 -0
- package/src/runtime/components/buttons/AntCreateButton.vue +32 -0
- package/src/runtime/components/buttons/AntDeleteButton.vue +32 -0
- package/src/runtime/components/buttons/AntSaveAndNewButton.vue +32 -0
- package/src/runtime/components/buttons/AntSaveButton.vue +31 -0
- package/src/runtime/components/crud/AntCrud.vue +66 -0
- package/src/runtime/components/crud/AntCrudDetail.vue +11 -0
- package/src/runtime/components/crud/AntCrudDetailActions.vue +51 -0
- package/src/runtime/components/crud/AntCrudDetailNav.vue +51 -0
- package/src/runtime/components/crud/AntCrudTableFilter.vue +120 -0
- package/src/runtime/components/crud/AntCrudTableNav.vue +129 -0
- package/src/runtime/components/dialogs/AntDeleteDialog.vue +29 -0
- package/src/runtime/components/dialogs/AntDialog.vue +181 -0
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +167 -0
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +91 -0
- package/src/runtime/components/form/AntFormGroup.vue +21 -0
- package/src/runtime/components/form/AntFormGroupLabel.vue +5 -0
- package/src/runtime/components/form/AntNumberInput.vue +170 -0
- package/src/runtime/components/form/AntRadioWidget/AntRadio.vue +164 -0
- package/src/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +80 -0
- package/src/runtime/components/form/AntRangeSlider.vue +101 -0
- package/src/runtime/components/form/AntRichTextEditor.vue +237 -0
- package/src/runtime/components/form/AntSearch.vue +76 -0
- package/src/runtime/components/form/AntSelect.vue +346 -0
- package/src/runtime/components/form/AntSwitch.vue +145 -0
- package/src/runtime/components/form/AntSwitcher.vue +200 -0
- package/src/runtime/components/form/AntTextInput.vue +73 -0
- package/src/runtime/components/form/AntTextarea.vue +170 -0
- package/src/runtime/components/form/AntUnitInput.vue +99 -0
- package/src/runtime/components/form/Elements/AntBaseInput.vue +247 -0
- package/src/runtime/components/form/Elements/AntDropDown.vue +160 -0
- package/src/runtime/components/form/Elements/AntField.vue +102 -0
- package/src/runtime/components/form/Elements/AntInputDescription.vue +55 -0
- package/src/runtime/components/form/Elements/AntInputLabel.vue +55 -0
- package/src/runtime/components/form/Elements/AntInputLimiter.vue +55 -0
- package/src/runtime/components/layouts/AntNavLeftLayout.vue +36 -0
- package/src/runtime/components/navbar/AntNavbar.vue +25 -0
- package/src/runtime/components/navbar/AntNavbarItem.vue +78 -0
- package/src/runtime/components/table/AntTable.vue +192 -0
- package/src/runtime/components/table/AntTableSortButton.vue +26 -0
- package/src/runtime/components/table/AntTd.vue +70 -0
- package/src/runtime/components/table/AntTh.vue +67 -0
- package/src/runtime/components/tabs/AntTabItem.vue +115 -0
- package/src/runtime/components/tabs/AntTabs.vue +47 -0
- package/src/runtime/components/transitions/AntTransitionCollapseHeight.vue +96 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {AntTableSortDirection, type TableHeader} from './__types/TableHeader.type';
|
|
3
|
+
import {computed, ref, type Ref, watch} from 'vue';
|
|
4
|
+
import {useVModel} from '@vueuse/core';
|
|
5
|
+
import {ColorType} from '../../enums';
|
|
6
|
+
import AntTh from './AntTh.vue';
|
|
7
|
+
import AntTd from './AntTd.vue';
|
|
8
|
+
import AntSpinner from '../AntSpinner.vue';
|
|
9
|
+
import AntSkeleton from '../AntSkeleton.vue';
|
|
10
|
+
|
|
11
|
+
defineOptions({ inheritAttrs: false });
|
|
12
|
+
|
|
13
|
+
const emits = defineEmits([
|
|
14
|
+
'update:modelValue',
|
|
15
|
+
'update:skeleton',
|
|
16
|
+
'update:selectedRow',
|
|
17
|
+
'rowClick',
|
|
18
|
+
'updateSort'
|
|
19
|
+
]);
|
|
20
|
+
// TODO:: add pagination prop and pagination to table
|
|
21
|
+
const props = withDefaults(
|
|
22
|
+
defineProps<{
|
|
23
|
+
selectedRow?: Record<string, unknown> | undefined,
|
|
24
|
+
headers: TableHeader[];
|
|
25
|
+
data: Record<string, unknown>[];
|
|
26
|
+
rowKey?: string;
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
selectableRows?: boolean;
|
|
29
|
+
showLightVersion?: boolean;
|
|
30
|
+
}>(), {
|
|
31
|
+
rowKey: 'id',
|
|
32
|
+
loading: false,
|
|
33
|
+
selectableRows: false,
|
|
34
|
+
showLightVersion: false,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const selected: Ref<Record<string, unknown> | undefined> = useVModel(props, 'selectedRow', emits);
|
|
38
|
+
const _loading: Ref<boolean> = useVModel(props, 'loading', emits);
|
|
39
|
+
const _showLightVersion = ref(props.showLightVersion);
|
|
40
|
+
const _headers = computed(() => {
|
|
41
|
+
// if (_showLightVersion.value) {
|
|
42
|
+
// const lightHeaders = props.headers.filter(header => header.lightVersion);
|
|
43
|
+
//
|
|
44
|
+
// return lightHeaders.length > 0 ? lightHeaders : [props.headers[0]];
|
|
45
|
+
// }
|
|
46
|
+
|
|
47
|
+
return props.headers;
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
watch(() => props.showLightVersion, (val) => {
|
|
51
|
+
setTimeout(() => _showLightVersion.value = val, val ? 200 : 400)
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function sortTable(header: TableHeader, newDirection: AntTableSortDirection) {
|
|
55
|
+
// TODO:: Sorting is always done externally, here should only be a emit sort with header and direction.
|
|
56
|
+
// TODO:: Save current sort in some kind of prop (maybe same as pagination?)
|
|
57
|
+
// TODO:: Multi column sort?
|
|
58
|
+
// if (newDirection !== AntTableSortDirection.neutral) {
|
|
59
|
+
// if (header.sort) {
|
|
60
|
+
// const sortFn = header.sort;
|
|
61
|
+
// internalRows.value.sort((a, b) => sortFn(a, b, newDirection));
|
|
62
|
+
// } else {
|
|
63
|
+
// internalRows.value.sort((a: Record<string, unknown>, b: Record<string, unknown>) => {
|
|
64
|
+
// if (newDirection === AntTableSortDirection.asc) {
|
|
65
|
+
// return (a[header.identifier] as string) < (b[header.identifier] as string) ? -1 : 1
|
|
66
|
+
// } else {
|
|
67
|
+
// return (a[header.identifier] as string) > (b[header.identifier] as string) ? -1 : 1
|
|
68
|
+
// }
|
|
69
|
+
// });
|
|
70
|
+
// }
|
|
71
|
+
// } else {
|
|
72
|
+
// // Reset sort to default
|
|
73
|
+
// internalRows.value = [ ...props.data ];
|
|
74
|
+
// }
|
|
75
|
+
|
|
76
|
+
emits('updateSort', header, newDirection);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function rowClick(elem: Record<string, unknown>): void {
|
|
80
|
+
selected.value = elem;
|
|
81
|
+
|
|
82
|
+
emits('rowClick', elem);
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<div
|
|
88
|
+
class="relative inline-block min-w-full align-middle h-full"
|
|
89
|
+
data-e2e="table"
|
|
90
|
+
>
|
|
91
|
+
<div class="overflow-hidden h-full overflow-x-auto overflow-y-auto">
|
|
92
|
+
<table
|
|
93
|
+
v-bind="$attrs"
|
|
94
|
+
class="min-w-full max-h-full relative"
|
|
95
|
+
:class="{'h-full': data.length === 0 && !_loading}"
|
|
96
|
+
>
|
|
97
|
+
<thead class="bg-neutral-100 sticky top-0 z-10">
|
|
98
|
+
<tr>
|
|
99
|
+
<slot name="headerFirstCell"/>
|
|
100
|
+
|
|
101
|
+
<template v-for="(header, index) in _headers">
|
|
102
|
+
<AntTh
|
|
103
|
+
v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
|
|
104
|
+
:key="`table-header-${header.identifier}-${index}`"
|
|
105
|
+
:header="header"
|
|
106
|
+
@sort="sortTable"
|
|
107
|
+
>
|
|
108
|
+
<template #headerContent>
|
|
109
|
+
<slot name="headerContent" v-bind="header"/>
|
|
110
|
+
</template>
|
|
111
|
+
</AntTh>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<slot name="headerLastCell"></slot>
|
|
115
|
+
</tr>
|
|
116
|
+
</thead>
|
|
117
|
+
|
|
118
|
+
<tbody class="bg-white relative">
|
|
119
|
+
<!-- TODO:: Add some kind of virtual list for very large tree data (or required pagination??) -->
|
|
120
|
+
<tr
|
|
121
|
+
v-for="(elem, index) in data"
|
|
122
|
+
:key="`table-row-${elem[rowKey]}-${index}`"
|
|
123
|
+
:id="elem[rowKey] as string"
|
|
124
|
+
class="transition-all"
|
|
125
|
+
:class="{
|
|
126
|
+
'bg-primary-300 text-primary-300-font': elem === selected,
|
|
127
|
+
'bg-neutral-50 text-neutral-50-font': elem !== selected && index % 2 === 0,
|
|
128
|
+
'bg-neutral-100 text-neutral-100-font': elem !== selected && index % 2 !== 0,
|
|
129
|
+
'cursor-pointer': selectableRows
|
|
130
|
+
}"
|
|
131
|
+
>
|
|
132
|
+
<slot name="rowFirstCell" v-bind="{ elem }"/>
|
|
133
|
+
|
|
134
|
+
<template v-for="(header, index) in _headers">
|
|
135
|
+
<AntTd
|
|
136
|
+
v-if="!_showLightVersion || (_showLightVersion && header.lightVersion)"
|
|
137
|
+
:header="header"
|
|
138
|
+
:element="elem"
|
|
139
|
+
:align="header.align"
|
|
140
|
+
:key="`table-cell-${header.identifier}-${index}`"
|
|
141
|
+
@click="rowClick(elem)"
|
|
142
|
+
>
|
|
143
|
+
<template #beforeCellContent="props">
|
|
144
|
+
<slot name="beforeCellContent" v-bind="props"/>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<template #cellContent="props">
|
|
148
|
+
<slot name="cellContent" v-bind="props"/>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<template #afterCellContent="props">
|
|
152
|
+
<slot name="afterCellContent" v-bind="props"/>
|
|
153
|
+
</template>
|
|
154
|
+
</AntTd>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<slot name="rowLastCell" v-bind="{ elem }"/>
|
|
158
|
+
</tr>
|
|
159
|
+
|
|
160
|
+
<tr v-if="data.length <= 0 && !_loading">
|
|
161
|
+
<td
|
|
162
|
+
colspan="100"
|
|
163
|
+
class="w-full h-full py-2 text-center text-neutral-50-font text-lg"
|
|
164
|
+
>
|
|
165
|
+
<slot name="emptyState">
|
|
166
|
+
<div class="flex items-center flex-col">
|
|
167
|
+
<span class="font-semibold">We couldn't find any entry</span>
|
|
168
|
+
</div>
|
|
169
|
+
</slot>
|
|
170
|
+
</td>
|
|
171
|
+
</tr>
|
|
172
|
+
|
|
173
|
+
</tbody>
|
|
174
|
+
</table>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<div
|
|
178
|
+
v-if="data.length > 0 && _loading"
|
|
179
|
+
class="absolute bg-opacity-50 w-full top-0 bottom-0 bg-neutral-300 flex items-center justify-center"
|
|
180
|
+
>
|
|
181
|
+
<AntSpinner class="!w-24 !h-24" :color-type="ColorType.primary"/>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<div
|
|
185
|
+
v-if="!data || data.length <= 0 && _loading"
|
|
186
|
+
class="absolute bg-opacity-50 w-full top-[40px] bottom-0 bg-neutral-300 flex items-center justify-center"
|
|
187
|
+
>
|
|
188
|
+
<AntSkeleton
|
|
189
|
+
v-model="_loading" absolute/>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import AntIcon from '../AntIcon.vue';
|
|
4
|
+
import { faAngleDown, faAngleUp, faMinus } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { IconSize } from '../__types';
|
|
6
|
+
import { AntTableSortDirection } from './__types/TableHeader.type';
|
|
7
|
+
|
|
8
|
+
defineEmits([ 'sortClick' ])
|
|
9
|
+
withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
sortDirection?: AntTableSortDirection
|
|
12
|
+
}>(), {
|
|
13
|
+
sortDirection: AntTableSortDirection.neutral
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<button
|
|
19
|
+
class="bg-neutral-50 text-neutral-50-font rounded h-[26px] w-[26px] flex items-center justify-center"
|
|
20
|
+
@click="$emit('sortClick')"
|
|
21
|
+
>
|
|
22
|
+
<AntIcon v-if="sortDirection === AntTableSortDirection.asc" :icon="faAngleDown" :size="IconSize.sm"/>
|
|
23
|
+
<AntIcon v-if="sortDirection === AntTableSortDirection.desc" :icon="faAngleUp" :size="IconSize.sm"/>
|
|
24
|
+
<AntIcon v-if="sortDirection === AntTableSortDirection.neutral" :icon="faMinus" :size="IconSize.sm"/>
|
|
25
|
+
</button>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { AntTableAlign, AntTableRowTypes, type TableHeader } from './__types/TableHeader.type';
|
|
4
|
+
import { computed } from 'vue';
|
|
5
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
6
|
+
|
|
7
|
+
const props =
|
|
8
|
+
withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
element: Record<string, unknown>;
|
|
11
|
+
header: TableHeader;
|
|
12
|
+
align?: AntTableAlign
|
|
13
|
+
}>(), {
|
|
14
|
+
align: AntTableAlign.left
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const cellClasses = computed(() => ({
|
|
18
|
+
'whitespace-nowrap px-2.5 py-0 h-[40px] text-sm font-medium relative': true,
|
|
19
|
+
'text-right': props.align === AntTableAlign.right,
|
|
20
|
+
'text-center': props.align === AntTableAlign.center
|
|
21
|
+
}))
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<td
|
|
26
|
+
:class="cellClasses"
|
|
27
|
+
>
|
|
28
|
+
<slot
|
|
29
|
+
name="beforeCellContent"
|
|
30
|
+
v-bind="{ elem: element, header: header }"
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
v-if="header.type === AntTableRowTypes.text"
|
|
35
|
+
:class="header.rowClassList"
|
|
36
|
+
>
|
|
37
|
+
{{ element[header.identifier] }}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div
|
|
41
|
+
v-else-if="header.type === AntTableRowTypes.link && header.toProp"
|
|
42
|
+
>
|
|
43
|
+
<router-link :to="element[header.toProp] as RouteLocationRaw" class="absolute inset-0">
|
|
44
|
+
</router-link>
|
|
45
|
+
{{ element[header.identifier] }}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
v-else-if="header.type === AntTableRowTypes.html"
|
|
50
|
+
:class="header.rowClassList"
|
|
51
|
+
v-html="element[header.identifier]"
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<div
|
|
55
|
+
v-else-if="header.type === AntTableRowTypes.slot"
|
|
56
|
+
:class="header.rowClassList"
|
|
57
|
+
>
|
|
58
|
+
<slot name="cellContent" v-bind="{ element, header }"></slot>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<slot
|
|
62
|
+
name="afterCellContent"
|
|
63
|
+
v-bind="{ elem: element, header: header }"
|
|
64
|
+
/>
|
|
65
|
+
</td>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { AntTableAlign, AntTableSortDirection, type TableHeader } from './__types/TableHeader.type';
|
|
4
|
+
import { computed, ref, type Ref } from 'vue';
|
|
5
|
+
import AntTableSortButton from './AntTableSortButton.vue';
|
|
6
|
+
|
|
7
|
+
defineEmits([ 'sort' ])
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
header: TableHeader
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const headerClasses = computed(() => {
|
|
13
|
+
const classes = {
|
|
14
|
+
[props.header.headerClassList || '']: true,
|
|
15
|
+
'px-2.5 py-0 h-[40px] text-sm text-neutral-100-font uppercase font-semi-bold': true,
|
|
16
|
+
'text-left': !props.header.align || props.header.align === AntTableAlign.left,
|
|
17
|
+
'text-center': props.header.align === AntTableAlign.center,
|
|
18
|
+
'text-right': props.header.align === AntTableAlign.right,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return classes;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const cellClasses = computed(() => ({
|
|
25
|
+
'flex gap-2.5 items-center': true,
|
|
26
|
+
'justify-start': !props.header.align || props.header.align === AntTableAlign.left,
|
|
27
|
+
'justify-center': props.header.align === AntTableAlign.center,
|
|
28
|
+
'justify-end': props.header.align === AntTableAlign.right,
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
// TODO:: Initial sort should be possible with this
|
|
32
|
+
const sortDirection: Ref<AntTableSortDirection> = ref(AntTableSortDirection.neutral);
|
|
33
|
+
|
|
34
|
+
function getNewSortDirection(): AntTableSortDirection {
|
|
35
|
+
if (sortDirection.value === AntTableSortDirection.neutral) {
|
|
36
|
+
sortDirection.value = AntTableSortDirection.asc;
|
|
37
|
+
return AntTableSortDirection.asc;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (sortDirection.value === AntTableSortDirection.asc) {
|
|
41
|
+
sortDirection.value = AntTableSortDirection.desc;
|
|
42
|
+
return AntTableSortDirection.desc;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
sortDirection.value = AntTableSortDirection.neutral;
|
|
46
|
+
return AntTableSortDirection.neutral;
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<th
|
|
52
|
+
scope="col"
|
|
53
|
+
:class="headerClasses"
|
|
54
|
+
>
|
|
55
|
+
<div :class="cellClasses">
|
|
56
|
+
<slot name="headerContent" v-bind="header">
|
|
57
|
+
{{ header.title }}
|
|
58
|
+
</slot>
|
|
59
|
+
|
|
60
|
+
<AntTableSortButton
|
|
61
|
+
v-if="header.sortable"
|
|
62
|
+
@sort-click="$emit('sort', header, getNewSortDirection())"
|
|
63
|
+
:sort-direction="sortDirection"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
</th>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import AntIcon from '../AntIcon.vue';
|
|
3
|
+
import {
|
|
4
|
+
faExclamationCircle,
|
|
5
|
+
faExclamationTriangle,
|
|
6
|
+
type IconDefinition
|
|
7
|
+
} from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import {computed} from 'vue';
|
|
9
|
+
import {type RouteLocationRaw, useRoute} from 'vue-router';
|
|
10
|
+
import {ColorType} from './__types/AntTabItem.types';
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<{
|
|
13
|
+
label: string;
|
|
14
|
+
active: boolean;
|
|
15
|
+
colorType?: ColorType
|
|
16
|
+
showIcon?: boolean;
|
|
17
|
+
icon?: IconDefinition;
|
|
18
|
+
to?: RouteLocationRaw;
|
|
19
|
+
expanded?: boolean;
|
|
20
|
+
}>(), {
|
|
21
|
+
colorType: ColorType.base,
|
|
22
|
+
showIcon: true,
|
|
23
|
+
});
|
|
24
|
+
const route = useRoute();
|
|
25
|
+
|
|
26
|
+
const icons = {
|
|
27
|
+
[ColorType.base]: null,
|
|
28
|
+
[ColorType.danger]: faExclamationCircle,
|
|
29
|
+
[ColorType.warning]: faExclamationTriangle,
|
|
30
|
+
};
|
|
31
|
+
const iconRight = computed<IconDefinition | null>(() => icons[props.colorType]);
|
|
32
|
+
const _active = computed<boolean>(() => {
|
|
33
|
+
if (typeof props.to === 'string') {
|
|
34
|
+
return route.path === props.to;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof props.to === 'object' && props.to?.name !== undefined) {
|
|
38
|
+
return route.name === props.to.name;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return props.active;
|
|
42
|
+
});
|
|
43
|
+
const containerClasses = computed(() => {
|
|
44
|
+
const variants: Record<ColorType, string> = {
|
|
45
|
+
[ColorType.base]: 'hover:bg-neutral-100',
|
|
46
|
+
[ColorType.warning]: 'hover:bg-warning-100',
|
|
47
|
+
[ColorType.danger]: 'hover:bg-danger-100',
|
|
48
|
+
};
|
|
49
|
+
const activeVariants: Record<ColorType, string> = {
|
|
50
|
+
[ColorType.base]: 'text-primary-500 border-primary-500',
|
|
51
|
+
[ColorType.warning]: 'text-warning-500 border-warning-500',
|
|
52
|
+
[ColorType.danger]: 'text-danger-500 border-danger-500',
|
|
53
|
+
};
|
|
54
|
+
const notActiveVariants: Record<ColorType, string> = {
|
|
55
|
+
[ColorType.base]: 'text-neutral-50-font border-neutral-50',
|
|
56
|
+
[ColorType.warning]: 'text-warning-500',
|
|
57
|
+
[ColorType.danger]: 'text-danger-500',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
'p-2.5 hover:cursor-pointer text-center flex items-center justify-center gap-2.5 bg-neutral-50 transition-[background-color] relative': true,
|
|
62
|
+
'grow': props.expanded,
|
|
63
|
+
[variants[props.colorType]]: true,
|
|
64
|
+
[activeVariants[props.colorType]]: _active.value,
|
|
65
|
+
[notActiveVariants[props.colorType]]: !_active.value,
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const borderBoxClasses = computed(() => {
|
|
69
|
+
const variants: Record<ColorType, string> = {
|
|
70
|
+
[ColorType.base]: 'bg-primary-500',
|
|
71
|
+
[ColorType.warning]: 'bg-warning-500',
|
|
72
|
+
[ColorType.danger]: 'bg-danger-500',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
'h-[2px] w-full bg-danger-500 absolute bottom-0': true,
|
|
77
|
+
[variants[props.colorType]]: true,
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const iconColor = computed(() => {
|
|
81
|
+
const variants = {
|
|
82
|
+
[ColorType.base]: 'text-neutral-100-font',
|
|
83
|
+
[ColorType.warning]: 'text-warning-500',
|
|
84
|
+
[ColorType.danger]: 'text-danger-500',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return variants[props.colorType];
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<component
|
|
93
|
+
:is="to !== undefined ? 'router-link' : 'div'"
|
|
94
|
+
:to="to"
|
|
95
|
+
:class="containerClasses"
|
|
96
|
+
>
|
|
97
|
+
<slot name="iconLeft">
|
|
98
|
+
<AntIcon
|
|
99
|
+
v-if="icon"
|
|
100
|
+
:icon="icon"
|
|
101
|
+
:color="_active ? 'text-primary-500' : 'text-neutral-50-font'"
|
|
102
|
+
/>
|
|
103
|
+
</slot>
|
|
104
|
+
|
|
105
|
+
<slot>{{ label }}</slot>
|
|
106
|
+
|
|
107
|
+
<AntIcon
|
|
108
|
+
v-if="iconRight && showIcon"
|
|
109
|
+
:icon="iconRight"
|
|
110
|
+
:color="iconColor"
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
<div v-if="_active" :class="borderBoxClasses" />
|
|
114
|
+
</component>
|
|
115
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import AntTabItem from './AntTabItem.vue';
|
|
3
|
+
import {type TabItem} from './__types/AntTabItem.types';
|
|
4
|
+
import {useVModel} from '@vueuse/core';
|
|
5
|
+
import {computed} from 'vue';
|
|
6
|
+
|
|
7
|
+
const emits = defineEmits(['update:modelValue']);
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
modelValue?: string;
|
|
10
|
+
tabItems?: TabItem[];
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
}>(), {
|
|
13
|
+
expanded: false,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const currentActive = useVModel(props, 'modelValue', emits);
|
|
17
|
+
const containerClasses = computed(() => ({
|
|
18
|
+
'flex items-stretch bg-neutral-300 gap-px transition-all h-full': true,
|
|
19
|
+
'w-fit': !props.expanded,
|
|
20
|
+
'w-full': props.expanded,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
function clickTab(tabItem: TabItem) {
|
|
24
|
+
if (tabItem.clickHandler) {
|
|
25
|
+
tabItem.clickHandler();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
currentActive.value = tabItem.id;
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div :class="containerClasses">
|
|
34
|
+
<slot>
|
|
35
|
+
<AntTabItem
|
|
36
|
+
v-for="(tabItem, index) in tabItems"
|
|
37
|
+
:key="`tab-item-${index}`"
|
|
38
|
+
v-bind="tabItem"
|
|
39
|
+
@click="clickTab(tabItem)"
|
|
40
|
+
:active="currentActive === tabItem.id"
|
|
41
|
+
:expanded="expanded"
|
|
42
|
+
>
|
|
43
|
+
<slot name="content" v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"></slot>
|
|
44
|
+
</AntTabItem>
|
|
45
|
+
</slot>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* It is not possible to smoothly animate height or max-height with CSS transitions not using a fixed value
|
|
4
|
+
* like 'height: 1rem';
|
|
5
|
+
*
|
|
6
|
+
* This component does it via javascript.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
// TODO:: fix typescript errors
|
|
11
|
+
/**
|
|
12
|
+
* @param {HTMLElement} element
|
|
13
|
+
*/
|
|
14
|
+
function beforeEnter(element) {
|
|
15
|
+
requestAnimationFrame(() => {
|
|
16
|
+
if (!element.style.height) {
|
|
17
|
+
element.style.height = '0px';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
element.style.display = '';
|
|
21
|
+
// element.style.display = null;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {HTMLElement} element
|
|
27
|
+
*/
|
|
28
|
+
function enter(element) {
|
|
29
|
+
requestAnimationFrame(() => {
|
|
30
|
+
requestAnimationFrame(() => {
|
|
31
|
+
element.style.height = `${element.scrollHeight}px`;
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {HTMLElement} element
|
|
38
|
+
*/
|
|
39
|
+
function afterEnter(element) {
|
|
40
|
+
element.style.height = '';
|
|
41
|
+
// element.style.height = null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {HTMLElement} element
|
|
46
|
+
*/
|
|
47
|
+
function beforeLeave(element) {
|
|
48
|
+
requestAnimationFrame(() => {
|
|
49
|
+
if (!element.style.height) {
|
|
50
|
+
element.style.height = `${element.offsetHeight}px`;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {HTMLElement} element
|
|
57
|
+
*/
|
|
58
|
+
function leave(element) {
|
|
59
|
+
requestAnimationFrame(() => {
|
|
60
|
+
requestAnimationFrame(() => {
|
|
61
|
+
element.style.height = '0px';
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {HTMLElement} element
|
|
68
|
+
*/
|
|
69
|
+
function afterLeave(element) {
|
|
70
|
+
element.style.height = '';
|
|
71
|
+
// element.style.height = null;
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<transition
|
|
77
|
+
enter-active-class="enter-active"
|
|
78
|
+
leave-active-class="leave-active"
|
|
79
|
+
@before-enter="beforeEnter"
|
|
80
|
+
@enter="enter"
|
|
81
|
+
@after-enter="afterEnter"
|
|
82
|
+
@before-leave="beforeLeave"
|
|
83
|
+
@leave="leave"
|
|
84
|
+
@after-leave="afterLeave"
|
|
85
|
+
>
|
|
86
|
+
<slot/>
|
|
87
|
+
</transition>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<style scoped>
|
|
91
|
+
.enter-active,
|
|
92
|
+
.leave-active {
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
transition: height .4s ease-in-out;
|
|
95
|
+
}
|
|
96
|
+
</style>
|