@groupteknology/vuno 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -27
- package/dist/module.d.mts +14 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +80 -13
- package/dist/runtime/app/assets/css/dialog.css +1 -0
- package/dist/runtime/app/assets/css/main.css +1 -0
- package/dist/runtime/app/assets/css/stylesheet.css +1 -0
- package/dist/runtime/app/assets/css/theme.css +1 -0
- package/dist/runtime/app/assets/css/tokens.css +1 -0
- package/dist/runtime/app/components/Alert/Alert.d.vue.ts +20 -0
- package/dist/runtime/app/components/Alert/Alert.theme.d.ts +13 -0
- package/dist/runtime/app/components/Alert/Alert.theme.js +13 -0
- package/dist/runtime/app/components/Alert/Alert.vue +59 -0
- package/dist/runtime/app/components/Alert/Alert.vue.d.ts +20 -0
- package/dist/runtime/app/components/App/App.d.vue.ts +52 -0
- package/dist/runtime/app/components/App/App.vue +150 -0
- package/dist/runtime/app/components/App/App.vue.d.ts +52 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.d.vue.ts +7 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.vue +39 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.vue.d.ts +7 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.d.vue.ts +8 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.vue +19 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.vue.d.ts +8 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.d.vue.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.theme.d.ts +13 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.theme.js +18 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.vue +64 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.vue.d.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.d.vue.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.theme.d.ts +15 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.theme.js +16 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.vue +100 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.vue.d.ts +11 -0
- package/dist/runtime/app/components/Avatar/Avatar.d.vue.ts +27 -0
- package/dist/runtime/app/components/Avatar/Avatar.theme.d.ts +30 -0
- package/dist/runtime/app/components/Avatar/Avatar.theme.js +22 -0
- package/dist/runtime/app/components/Avatar/Avatar.vue +51 -0
- package/dist/runtime/app/components/Avatar/Avatar.vue.d.ts +27 -0
- package/dist/runtime/app/components/Badge/Badge.d.vue.ts +40 -0
- package/dist/runtime/app/components/Badge/Badge.theme.d.ts +40 -0
- package/dist/runtime/app/components/Badge/Badge.theme.js +22 -0
- package/dist/runtime/app/components/Badge/Badge.vue +28 -0
- package/dist/runtime/app/components/Badge/Badge.vue.d.ts +40 -0
- package/dist/runtime/app/components/Button/Button.d.vue.ts +49 -0
- package/dist/runtime/app/components/Button/Button.theme.d.ts +88 -0
- package/dist/runtime/app/components/Button/Button.theme.js +59 -0
- package/dist/runtime/app/components/Button/Button.vue +78 -0
- package/dist/runtime/app/components/Button/Button.vue.d.ts +49 -0
- package/dist/runtime/app/components/Card/Card.d.vue.ts +94 -0
- package/dist/runtime/app/components/Card/Card.theme.d.ts +57 -0
- package/dist/runtime/app/components/Card/Card.theme.js +62 -0
- package/dist/runtime/app/components/Card/Card.vue +45 -0
- package/dist/runtime/app/components/Card/Card.vue.d.ts +94 -0
- package/dist/runtime/app/components/Code/Code.d.vue.ts +19 -0
- package/dist/runtime/app/components/Code/Code.theme.d.ts +11 -0
- package/dist/runtime/app/components/Code/Code.theme.js +12 -0
- package/dist/runtime/app/components/Code/Code.vue +109 -0
- package/dist/runtime/app/components/Code/Code.vue.d.ts +19 -0
- package/dist/runtime/app/components/Confirm/Confirm.d.vue.ts +35 -0
- package/dist/runtime/app/components/Confirm/Confirm.theme.d.ts +12 -0
- package/dist/runtime/app/components/Confirm/Confirm.theme.js +13 -0
- package/dist/runtime/app/components/Confirm/Confirm.vue +83 -0
- package/dist/runtime/app/components/Confirm/Confirm.vue.d.ts +35 -0
- package/dist/runtime/app/components/Container/Container.d.vue.ts +42 -0
- package/dist/runtime/app/components/Container/Container.theme.d.ts +53 -0
- package/dist/runtime/app/components/Container/Container.theme.js +31 -0
- package/dist/runtime/app/components/Container/Container.vue +20 -0
- package/dist/runtime/app/components/Container/Container.vue.d.ts +42 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.d.vue.ts +26 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.theme.d.ts +16 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.theme.js +13 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.vue +26 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.theme.d.ts +12 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.theme.js +13 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.vue +173 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.theme.js +2 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.vue +39 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.d.vue.ts +40 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.theme.d.ts +30 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.theme.js +10 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.vue +40 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.vue.d.ts +40 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.theme.d.ts +27 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.theme.js +18 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.vue +88 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.theme.js +2 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.vue +51 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.theme.js +2 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.vue +99 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.d.vue.ts +66 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.theme.d.ts +88 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.theme.js +55 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.vue +187 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.vue.d.ts +66 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.d.vue.ts +24 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.theme.js +2 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.vue +61 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.vue.d.ts +24 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.theme.js +2 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.vue +47 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.theme.js +2 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.vue +62 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.theme.js +2 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.vue +41 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.d.vue.ts +32 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.theme.d.ts +54 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.theme.js +31 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.vue +80 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.vue.d.ts +32 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.d.vue.ts +17 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.theme.d.ts +6 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.theme.js +7 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.vue +74 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.vue.d.ts +17 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.theme.js +2 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.vue +45 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.d.vue.ts +97 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.theme.d.ts +36 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.theme.js +49 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.vue +196 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.vue.d.ts +97 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/option.d.ts +25 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/option.js +6 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/useVunoSelectState.d.ts +30 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/useVunoSelectState.js +142 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.theme.js +2 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.vue +113 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.theme.js +2 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.vue +37 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.theme.d.ts +39 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.theme.js +20 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.vue +46 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.theme.js +2 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.vue +41 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.theme.d.ts +34 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.theme.js +20 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.vue +97 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.theme.js +2 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.vue +45 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.d.vue.ts +34 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.theme.d.ts +36 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.theme.js +37 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.vue +43 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.vue.d.ts +34 -0
- package/dist/runtime/app/components/Form/Form.d.vue.ts +52 -0
- package/dist/runtime/app/components/Form/Form.theme.d.ts +9 -0
- package/dist/runtime/app/components/Form/Form.theme.js +10 -0
- package/dist/runtime/app/components/Form/Form.vue +129 -0
- package/dist/runtime/app/components/Form/Form.vue.d.ts +52 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.d.vue.ts +7 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.vue +67 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.vue.d.ts +7 -0
- package/dist/runtime/app/components/Form/internal/grid.d.ts +9 -0
- package/dist/runtime/app/components/Form/internal/grid.js +91 -0
- package/dist/runtime/app/components/Form/internal/standard-schema.d.ts +29 -0
- package/dist/runtime/app/components/Form/internal/standard-schema.js +15 -0
- package/dist/runtime/app/components/Form/internal/useVunoFormState.d.ts +43 -0
- package/dist/runtime/app/components/Form/internal/useVunoFormState.js +81 -0
- package/dist/runtime/app/components/FormField/FormField.d.vue.ts +35 -0
- package/dist/runtime/app/components/FormField/FormField.theme.d.ts +62 -0
- package/dist/runtime/app/components/FormField/FormField.theme.js +28 -0
- package/dist/runtime/app/components/FormField/FormField.vue +124 -0
- package/dist/runtime/app/components/FormField/FormField.vue.d.ts +35 -0
- package/dist/runtime/app/components/FormModal/FormModal.d.vue.ts +63 -0
- package/dist/runtime/app/components/FormModal/FormModal.theme.d.ts +8 -0
- package/dist/runtime/app/components/FormModal/FormModal.theme.js +9 -0
- package/dist/runtime/app/components/FormModal/FormModal.vue +95 -0
- package/dist/runtime/app/components/FormModal/FormModal.vue.d.ts +63 -0
- package/dist/runtime/app/components/FormSection/FormSection.d.vue.ts +15 -0
- package/dist/runtime/app/components/FormSection/FormSection.theme.d.ts +12 -0
- package/dist/runtime/app/components/FormSection/FormSection.theme.js +14 -0
- package/dist/runtime/app/components/FormSection/FormSection.vue +45 -0
- package/dist/runtime/app/components/FormSection/FormSection.vue.d.ts +15 -0
- package/dist/runtime/app/components/Icon/Icon.d.vue.ts +6 -0
- package/dist/runtime/app/components/Icon/Icon.vue +32 -0
- package/dist/runtime/app/components/Icon/Icon.vue.d.ts +6 -0
- package/dist/runtime/app/components/Menu/Menu.d.vue.ts +36 -0
- package/dist/runtime/app/components/Menu/Menu.theme.d.ts +17 -0
- package/dist/runtime/app/components/Menu/Menu.theme.js +20 -0
- package/dist/runtime/app/components/Menu/Menu.vue +182 -0
- package/dist/runtime/app/components/Menu/Menu.vue.d.ts +36 -0
- package/dist/runtime/app/components/Modal/Modal.d.vue.ts +43 -0
- package/dist/runtime/app/components/Modal/Modal.theme.d.ts +59 -0
- package/dist/runtime/app/components/Modal/Modal.theme.js +47 -0
- package/dist/runtime/app/components/Modal/Modal.vue +215 -0
- package/dist/runtime/app/components/Modal/Modal.vue.d.ts +43 -0
- package/dist/runtime/app/components/Navbar/Navbar.d.vue.ts +45 -0
- package/dist/runtime/app/components/Navbar/Navbar.theme.d.ts +31 -0
- package/dist/runtime/app/components/Navbar/Navbar.theme.js +32 -0
- package/dist/runtime/app/components/Navbar/Navbar.vue +47 -0
- package/dist/runtime/app/components/Navbar/Navbar.vue.d.ts +45 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.d.vue.ts +38 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.theme.d.ts +32 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.theme.js +35 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.vue +187 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.vue.d.ts +38 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.d.vue.ts +31 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.theme.d.ts +26 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.theme.js +27 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.vue +236 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.vue.d.ts +31 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.d.vue.ts +14 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.theme.d.ts +9 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.theme.js +10 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.vue +81 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.vue.d.ts +14 -0
- package/dist/runtime/app/components/Page/Page.d.vue.ts +40 -0
- package/dist/runtime/app/components/Page/Page.theme.d.ts +32 -0
- package/dist/runtime/app/components/Page/Page.theme.js +31 -0
- package/dist/runtime/app/components/Page/Page.vue +132 -0
- package/dist/runtime/app/components/Page/Page.vue.d.ts +40 -0
- package/dist/runtime/app/components/Pagination/Pagination.d.vue.ts +33 -0
- package/dist/runtime/app/components/Pagination/Pagination.theme.d.ts +13 -0
- package/dist/runtime/app/components/Pagination/Pagination.theme.js +14 -0
- package/dist/runtime/app/components/Pagination/Pagination.vue +129 -0
- package/dist/runtime/app/components/Pagination/Pagination.vue.d.ts +33 -0
- package/dist/runtime/app/components/Slideover/Slideover.d.vue.ts +43 -0
- package/dist/runtime/app/components/Slideover/Slideover.theme.d.ts +35 -0
- package/dist/runtime/app/components/Slideover/Slideover.theme.js +24 -0
- package/dist/runtime/app/components/Slideover/Slideover.vue +58 -0
- package/dist/runtime/app/components/Slideover/Slideover.vue.d.ts +43 -0
- package/dist/runtime/app/components/State/State.d.vue.ts +14 -0
- package/dist/runtime/app/components/State/State.theme.d.ts +19 -0
- package/dist/runtime/app/components/State/State.theme.js +26 -0
- package/dist/runtime/app/components/State/State.vue +66 -0
- package/dist/runtime/app/components/State/State.vue.d.ts +14 -0
- package/dist/runtime/app/components/Table/Table.d.vue.ts +80 -0
- package/dist/runtime/app/components/Table/Table.theme.d.ts +50 -0
- package/dist/runtime/app/components/Table/Table.theme.js +64 -0
- package/dist/runtime/app/components/Table/Table.vue +483 -0
- package/dist/runtime/app/components/Table/Table.vue.d.ts +80 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.vue +26 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.theme.d.ts +21 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.theme.js +11 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.vue +32 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.vue +16 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.vue +21 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.vue +24 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.vue +17 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.theme.d.ts +13 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.theme.js +11 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.vue +16 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.d.vue.ts +22 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.vue +48 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.vue.d.ts +22 -0
- package/dist/runtime/app/components/Table/internal/column.d.ts +9 -0
- package/dist/runtime/app/components/Table/internal/column.js +5 -0
- package/dist/runtime/app/components/Table/internal/query.d.ts +18 -0
- package/dist/runtime/app/components/Table/internal/query.js +8 -0
- package/dist/runtime/app/components/Table/internal/selection.d.ts +29 -0
- package/dist/runtime/app/components/Table/internal/selection.js +10 -0
- package/dist/runtime/app/components/Table/internal/useVunoTable.d.ts +93 -0
- package/dist/runtime/app/components/Table/internal/useVunoTable.js +153 -0
- package/dist/runtime/app/components/Table/internal/useVunoTableSelection.d.ts +21 -0
- package/dist/runtime/app/components/Table/internal/useVunoTableSelection.js +29 -0
- package/dist/runtime/app/components/Tabs/Tabs.d.vue.ts +49 -0
- package/dist/runtime/app/components/Tabs/Tabs.theme.d.ts +32 -0
- package/dist/runtime/app/components/Tabs/Tabs.theme.js +23 -0
- package/dist/runtime/app/components/Tabs/Tabs.vue +119 -0
- package/dist/runtime/app/components/Tabs/Tabs.vue.d.ts +49 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.d.vue.ts +40 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.theme.d.ts +12 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.theme.js +13 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.vue +139 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.vue.d.ts +40 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.d.vue.ts +41 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.theme.d.ts +50 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.theme.js +38 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.vue +33 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.vue.d.ts +41 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.d.vue.ts +23 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.vue +63 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.vue.d.ts +23 -0
- package/dist/runtime/app/components/internal/Input/Input.d.vue.ts +52 -0
- package/dist/runtime/app/components/internal/Input/Input.theme.d.ts +30 -0
- package/dist/runtime/app/components/internal/Input/Input.theme.js +21 -0
- package/dist/runtime/app/components/internal/Input/Input.vue +66 -0
- package/dist/runtime/app/components/internal/Input/Input.vue.d.ts +52 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.d.vue.ts +36 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.theme.d.ts +31 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.theme.js +26 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.vue +221 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.vue.d.ts +36 -0
- package/dist/runtime/app/components/internal/NumberInput/number.d.ts +42 -0
- package/dist/runtime/app/components/internal/NumberInput/number.js +64 -0
- package/dist/runtime/app/composables/defineShortcuts.d.ts +19 -0
- package/dist/runtime/app/composables/defineShortcuts.js +68 -0
- package/dist/runtime/app/composables/internal/useVunoAnchor.d.ts +45 -0
- package/dist/runtime/app/composables/internal/useVunoAnchor.js +35 -0
- package/dist/runtime/app/composables/internal/useVunoControlGroup.d.ts +17 -0
- package/dist/runtime/app/composables/internal/useVunoControlGroup.js +18 -0
- package/dist/runtime/app/composables/internal/useVunoPortal.d.ts +18 -0
- package/dist/runtime/app/composables/internal/useVunoPortal.js +12 -0
- package/dist/runtime/app/composables/useConfirm.d.ts +15 -0
- package/dist/runtime/app/composables/useConfirm.js +5 -0
- package/dist/runtime/app/composables/useContext.d.ts +11 -0
- package/dist/runtime/app/composables/useContext.js +9 -0
- package/dist/runtime/app/composables/useCrud.d.ts +23 -0
- package/dist/runtime/app/composables/useCrud.js +153 -0
- package/dist/runtime/app/composables/useField.d.ts +10 -0
- package/dist/runtime/app/composables/useField.js +42 -0
- package/dist/runtime/app/composables/useForm.d.ts +5 -0
- package/dist/runtime/app/composables/useForm.js +9 -0
- package/dist/runtime/app/composables/useModal.d.ts +21 -0
- package/dist/runtime/app/composables/useModal.js +24 -0
- package/dist/runtime/app/composables/useOverlay.d.ts +22 -0
- package/dist/runtime/app/composables/useOverlay.js +10 -0
- package/dist/runtime/app/composables/useTableQuery.d.ts +10 -0
- package/dist/runtime/app/composables/useTableQuery.js +126 -0
- package/dist/runtime/app/composables/useTheme.d.ts +31 -0
- package/dist/runtime/app/composables/useTheme.js +29 -0
- package/dist/runtime/app/composables/useToast.d.ts +28 -0
- package/dist/runtime/app/composables/useToast.js +13 -0
- package/dist/runtime/app/internal/keys.d.ts +43 -0
- package/dist/runtime/app/internal/keys.js +8 -0
- package/dist/runtime/app/internal/slots.d.ts +22 -0
- package/dist/runtime/app/internal/slots.js +24 -0
- package/dist/runtime/app/plugins/vue-query.d.ts +8 -0
- package/dist/runtime/app/plugins/vue-query.js +13 -0
- package/dist/runtime/app/theme/icons.d.ts +2 -0
- package/dist/runtime/app/theme/icons.js +43 -0
- package/dist/runtime/app/theme/index.d.ts +1168 -0
- package/dist/runtime/app/theme/index.js +120 -0
- package/dist/runtime/app/theme/messages.d.ts +2 -0
- package/dist/runtime/app/theme/messages.js +70 -0
- package/dist/runtime/app/theme/shared.d.ts +42 -0
- package/dist/runtime/app/theme/shared.js +24 -0
- package/dist/runtime/app/types/alert.d.ts +13 -0
- package/dist/runtime/app/types/alert.js +0 -0
- package/dist/runtime/app/types/app-config.d.ts +8 -0
- package/dist/runtime/app/types/app-config.js +1 -0
- package/dist/runtime/app/types/app.d.ts +83 -0
- package/dist/runtime/app/types/app.js +0 -0
- package/dist/runtime/app/types/base.d.ts +78 -0
- package/dist/runtime/app/types/base.js +0 -0
- package/dist/runtime/app/types/confirm.d.ts +19 -0
- package/dist/runtime/app/types/confirm.js +0 -0
- package/dist/runtime/app/types/crud.d.ts +108 -0
- package/dist/runtime/app/types/crud.js +0 -0
- package/dist/runtime/app/types/field-type.d.ts +4 -0
- package/dist/runtime/app/types/field-type.js +0 -0
- package/dist/runtime/app/types/field.d.ts +233 -0
- package/dist/runtime/app/types/field.js +0 -0
- package/dist/runtime/app/types/form.d.ts +67 -0
- package/dist/runtime/app/types/form.js +0 -0
- package/dist/runtime/app/types/index.d.ts +16 -0
- package/dist/runtime/app/types/index.js +1 -0
- package/dist/runtime/app/types/page.d.ts +61 -0
- package/dist/runtime/app/types/page.js +0 -0
- package/dist/runtime/app/types/responsive.d.ts +8 -0
- package/dist/runtime/app/types/responsive.js +0 -0
- package/dist/runtime/app/types/shortcuts.d.ts +44 -0
- package/dist/runtime/app/types/shortcuts.js +0 -0
- package/dist/runtime/app/types/slots.d.ts +30 -0
- package/dist/runtime/app/types/slots.js +0 -0
- package/dist/runtime/app/types/state.d.ts +35 -0
- package/dist/runtime/app/types/state.js +0 -0
- package/dist/runtime/app/types/table.d.ts +287 -0
- package/dist/runtime/app/types/table.js +0 -0
- package/dist/runtime/app/types/theme.d.ts +251 -0
- package/dist/runtime/app/types/theme.js +0 -0
- package/dist/runtime/app/utils/format.d.ts +18 -0
- package/dist/runtime/app/utils/format.js +36 -0
- package/dist/runtime/app/utils/pagination.d.ts +41 -0
- package/dist/runtime/app/utils/pagination.js +32 -0
- package/dist/runtime/app/utils/path.d.ts +16 -0
- package/dist/runtime/app/utils/path.js +76 -0
- package/dist/runtime/app/utils/query-key.d.ts +20 -0
- package/dist/runtime/app/utils/query-key.js +7 -0
- package/dist/runtime/app/utils/theme.d.ts +44 -0
- package/dist/runtime/app/utils/theme.js +43 -0
- package/dist/types.d.mts +3 -11
- package/package.json +18 -3
- package/dist/module.d.cts +0 -2
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { VunoColor, VunoSize } from './base.js';
|
|
2
|
+
import type { VunoField } from './field.js';
|
|
3
|
+
import type { VunoUi } from './slots.js';
|
|
4
|
+
type WithType<TColumn, TType extends string> = TColumn & {
|
|
5
|
+
type: TType;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* `Omit` que recorre la unión miembro a miembro.
|
|
9
|
+
*
|
|
10
|
+
* El `Omit` de TypeScript aplana la unión en un solo objeto con las claves
|
|
11
|
+
* comunes, y con ella se lleva por delante el discriminante: el resultado ya no
|
|
12
|
+
* distingue un `badge` de un `date`.
|
|
13
|
+
*/
|
|
14
|
+
type OmitEach<TUnion, TKey extends PropertyKey> = TUnion extends unknown ? Omit<TUnion, TKey> : never;
|
|
15
|
+
export type VunoTableSortDirection = 'asc' | 'desc';
|
|
16
|
+
export type VunoTableSort = {
|
|
17
|
+
column: string;
|
|
18
|
+
direction: VunoTableSortDirection;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Estado de consulta de la tabla. Es el `v-model:query` y la única fuente de
|
|
22
|
+
* verdad: en modo servidor el consumidor observa este objeto, pide su página
|
|
23
|
+
* y devuelve `data` y `total`.
|
|
24
|
+
*/
|
|
25
|
+
export type VunoTableFilters = Record<string, unknown>;
|
|
26
|
+
export type VunoTableQuery = {
|
|
27
|
+
/** Valores del panel de filtros, indexados por el `name` de cada campo. */
|
|
28
|
+
filters: VunoTableFilters;
|
|
29
|
+
page: number;
|
|
30
|
+
pageSize: number;
|
|
31
|
+
search: string;
|
|
32
|
+
sort: null | VunoTableSort;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Fallo de la consulta, con el reintento DENTRO. Es un objeto y no dos props
|
|
36
|
+
* sueltas a propósito: así no se puede pintar un error sin ofrecer salida.
|
|
37
|
+
*
|
|
38
|
+
* Existe porque sin él una consulta fallida se normaliza a lista vacía
|
|
39
|
+
* (`data ?? []`) y la tabla dice «No hay resultados»: afirma que no hay nada
|
|
40
|
+
* cuando lo que pasa es que no se pudo saber.
|
|
41
|
+
*/
|
|
42
|
+
export type VunoTableFailure = {
|
|
43
|
+
hint?: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
retry: () => void;
|
|
46
|
+
};
|
|
47
|
+
/** Qué mostrar cuando la consulta va bien y no hay ninguna fila. */
|
|
48
|
+
export type VunoTableEmpty = {
|
|
49
|
+
hint?: string;
|
|
50
|
+
icon?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
};
|
|
53
|
+
export type VunoTableAlign = 'center' | 'end' | 'start';
|
|
54
|
+
/**
|
|
55
|
+
* Una fila. `object` y no `Record<string, unknown>` a propósito: un `interface`
|
|
56
|
+
* de TypeScript no tiene firma de índice implícita, así que no satisface un
|
|
57
|
+
* `Record`, y los tipos de respuesta de una API se declaran como `interface`
|
|
58
|
+
* casi siempre. Con el `Record`, cada consumidor tenía que escribir
|
|
59
|
+
* `type Fila = SuInterface & Record<string, unknown>` para poder usar la tabla,
|
|
60
|
+
* y el error que salía —«no assignable to VunoTableRow»— no señalaba la causa.
|
|
61
|
+
*
|
|
62
|
+
* La firma de índice no hacía falta para nada: los valores se leen con
|
|
63
|
+
* `getPath`, que recorre el objeto en tiempo de ejecución y acepta `unknown`.
|
|
64
|
+
*/
|
|
65
|
+
export type VunoTableRow = object;
|
|
66
|
+
/**
|
|
67
|
+
* Nota: no hay `searchable` por columna. La búsqueda la resuelve el endpoint,
|
|
68
|
+
* que es quien sabe sobre qué campos puede buscar; declararlo aquí sugeriría
|
|
69
|
+
* que la tabla filtra, y no lo hace.
|
|
70
|
+
*/
|
|
71
|
+
export type VunoTableColumnBase<TRow extends VunoTableRow = VunoTableRow> = {
|
|
72
|
+
align?: VunoTableAlign;
|
|
73
|
+
class?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Ruta del valor en la fila. Admite anidado: `'proveedor.nombre'`.
|
|
76
|
+
*
|
|
77
|
+
* Sigue haciendo falta con `value`: nombra la columna para el orden y para
|
|
78
|
+
* el slot `cell-<key>`.
|
|
79
|
+
*/
|
|
80
|
+
key: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
sortable?: boolean;
|
|
83
|
+
ui?: VunoUi<'avatar' | 'badge' | 'cellBoolean' | 'cellCurrency' | 'cellDate' | 'cellNumber' | 'cellText' | 'menu'>;
|
|
84
|
+
width?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Calcula el valor a partir de la fila entera, en lugar de leerlo de `key`.
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* { key: 'role', type: 'badge', value: (row) => traducirRol(row.role) }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Sustituye de dónde sale el valor, no cómo se pinta: lo que devuelve sigue
|
|
93
|
+
* pasando por el formato de su tipo de columna —moneda, fecha, el `map` de
|
|
94
|
+
* un badge—, así que se combinan.
|
|
95
|
+
*
|
|
96
|
+
* Cuidado al ordenar: `sortable` ordena en servidor por `key`, y el servidor
|
|
97
|
+
* no conoce esta función. Si el valor mostrado no se deriva de `key` de
|
|
98
|
+
* forma monótona, el orden no coincidirá con lo que se ve.
|
|
99
|
+
*/
|
|
100
|
+
value?: (row: TRow) => unknown;
|
|
101
|
+
};
|
|
102
|
+
export type VunoTableColumnText<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
103
|
+
truncate?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export type VunoTableColumnNumber<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
106
|
+
decimals?: number;
|
|
107
|
+
};
|
|
108
|
+
export type VunoTableColumnCurrency<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
109
|
+
currency?: string;
|
|
110
|
+
decimals?: number;
|
|
111
|
+
};
|
|
112
|
+
export type VunoTableColumnDate<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
113
|
+
dateStyle?: 'full' | 'long' | 'medium' | 'short';
|
|
114
|
+
timeStyle?: 'full' | 'long' | 'medium' | 'short';
|
|
115
|
+
};
|
|
116
|
+
export type VunoTableColumnBoolean<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
117
|
+
falseLabel?: string;
|
|
118
|
+
trueLabel?: string;
|
|
119
|
+
};
|
|
120
|
+
/** Traduce el valor crudo a una etiqueta con color, p. ej. estados. */
|
|
121
|
+
export type VunoTableBadgeMap = Record<string, {
|
|
122
|
+
color?: VunoColor;
|
|
123
|
+
label?: string;
|
|
124
|
+
}>;
|
|
125
|
+
export type VunoTableColumnBadge<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
126
|
+
color?: VunoColor;
|
|
127
|
+
map?: VunoTableBadgeMap;
|
|
128
|
+
};
|
|
129
|
+
export type VunoTableColumnImage<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
130
|
+
alt?: string;
|
|
131
|
+
/** Clave de la fila de la que sacar el texto alternativo. */
|
|
132
|
+
altKey?: string;
|
|
133
|
+
size?: Exclude<VunoSize, 'xl'>;
|
|
134
|
+
};
|
|
135
|
+
/** Delega el contenido en el slot `cell-<key>`. */
|
|
136
|
+
export type VunoTableColumnCustom<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow>;
|
|
137
|
+
export type VunoTableAction<TRow extends VunoTableRow = VunoTableRow> = {
|
|
138
|
+
onSelect: (row: TRow) => void;
|
|
139
|
+
color?: VunoColor;
|
|
140
|
+
icon?: string;
|
|
141
|
+
label: string;
|
|
142
|
+
/** Dibuja un separador encima de la acción. */
|
|
143
|
+
separator?: boolean;
|
|
144
|
+
disabled?: (row: TRow) => boolean;
|
|
145
|
+
/** Oculta la acción para esa fila concreta. */
|
|
146
|
+
hidden?: (row: TRow) => boolean;
|
|
147
|
+
};
|
|
148
|
+
export type VunoTableColumnActions<TRow extends VunoTableRow = VunoTableRow> = VunoTableColumnBase<TRow> & {
|
|
149
|
+
actions: VunoTableAction<TRow>[];
|
|
150
|
+
};
|
|
151
|
+
/** Unión discriminada por `type`, igual que `VunoField` en los formularios. */
|
|
152
|
+
export type VunoTableColumn<TRow extends VunoTableRow = VunoTableRow> = WithType<VunoTableColumnActions<TRow>, 'actions'> | WithType<VunoTableColumnBadge<TRow>, 'badge'> | WithType<VunoTableColumnBoolean<TRow>, 'boolean'> | WithType<VunoTableColumnCurrency<TRow>, 'currency'> | WithType<VunoTableColumnCustom<TRow>, 'custom'> | WithType<VunoTableColumnDate<TRow>, 'date'> | WithType<VunoTableColumnImage<TRow>, 'image'> | WithType<VunoTableColumnNumber<TRow>, 'number'> | WithType<VunoTableColumnText<TRow>, 'text'>;
|
|
153
|
+
export type VunoTableColumnType = VunoTableColumn['type'];
|
|
154
|
+
/** Extrae los props de un tipo concreto de columna: `VunoTableColumnOf<'badge'>`. */
|
|
155
|
+
export type VunoTableColumnOf<TType extends VunoTableColumnType> = Extract<VunoTableColumn, {
|
|
156
|
+
type: TType;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Tipos que pinta una celda.
|
|
160
|
+
*
|
|
161
|
+
* `actions` y `custom` quedan fuera porque no los resuelve la celda: el menú de
|
|
162
|
+
* acciones y el slot propio los pinta la tabla, que es quien tiene los eventos.
|
|
163
|
+
*/
|
|
164
|
+
export type VunoTableCellType = Exclude<VunoTableColumnType, 'actions' | 'custom'>;
|
|
165
|
+
/**
|
|
166
|
+
* La columna tal y como la ve una celda: la misma, sin `value`.
|
|
167
|
+
*
|
|
168
|
+
* `value` es lo único de una columna que depende del tipo de la fila, y la
|
|
169
|
+
* celda no lo usa: el valor le llega ya resuelto. Dejarlo fuera es lo que
|
|
170
|
+
* permite que una celda pinte la columna de cualquier tabla. Con él dentro, una
|
|
171
|
+
* `VunoTableColumn<TuFila>` no vale donde se espera una `VunoTableColumn`,
|
|
172
|
+
* porque una función que sabe leer tu fila no sabe leer un objeto cualquiera, y
|
|
173
|
+
* esa es una diferencia real y no un capricho del compilador.
|
|
174
|
+
*/
|
|
175
|
+
export type VunoTableCellColumn<TType extends VunoTableCellType = VunoTableCellType> = OmitEach<VunoTableColumnOf<TType>, 'value'>;
|
|
176
|
+
/** Props comunes a toda celda. El valor llega resuelto para no repetir `getPath`. */
|
|
177
|
+
export type VunoTableCellProps<TType extends VunoTableCellType = VunoTableCellType> = {
|
|
178
|
+
column: VunoTableCellColumn<TType>;
|
|
179
|
+
row: VunoTableRow;
|
|
180
|
+
value: unknown;
|
|
181
|
+
};
|
|
182
|
+
export type VunoTableDefinition<TRow extends VunoTableRow = VunoTableRow> = {
|
|
183
|
+
columns: VunoTableColumn<TRow>[];
|
|
184
|
+
/** Texto e icono cuando no hay ninguna fila. */
|
|
185
|
+
empty?: VunoTableEmpty;
|
|
186
|
+
/**
|
|
187
|
+
* Campos del panel lateral de filtros. Son los mismos de un formulario, así
|
|
188
|
+
* que un filtro se declara igual que se declara un campo.
|
|
189
|
+
*/
|
|
190
|
+
filters?: VunoField[];
|
|
191
|
+
/** Tamaños ofrecidos en el selector de filas por página. */
|
|
192
|
+
pageSizes?: number[];
|
|
193
|
+
/**
|
|
194
|
+
* Si el endpoint pagina. Por defecto `true`.
|
|
195
|
+
*
|
|
196
|
+
* En `false` desaparecen el paginador y el selector de tamaño, y el pie
|
|
197
|
+
* pasa a decir cuántos resultados hay y nada más.
|
|
198
|
+
*/
|
|
199
|
+
paginated?: boolean;
|
|
200
|
+
/** Campo que identifica la fila; se usa como clave de selección. */
|
|
201
|
+
rowKey?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Con qué se **nombra** una fila para quien no ve la pantalla.
|
|
204
|
+
*
|
|
205
|
+
* No lo confundas con `rowKey`, que identifica para la selección y puede ser
|
|
206
|
+
* un número opaco: esto es lo que se lee en voz alta. Va dentro del nombre
|
|
207
|
+
* accesible de la casilla y del menú de acciones de cada fila —«Elegir
|
|
208
|
+
* Cafetera italiana», «Acciones de Cafetera italiana»—, que sin él se
|
|
209
|
+
* llamaban las veinte igual.
|
|
210
|
+
*
|
|
211
|
+
* **Sin declararlo se adivina**, y se adivina bien en el caso corriente: la
|
|
212
|
+
* primera columna de texto, que es la misma pista que usa quien mira la
|
|
213
|
+
* pantalla. Se declara cuando adivinar no vale — una tabla cuya primera
|
|
214
|
+
* columna de texto es un estado que se repite («Activo», «Activo»,
|
|
215
|
+
* «Activo»), o una donde lo que identifica la fila son dos columnas juntas.
|
|
216
|
+
*
|
|
217
|
+
* Las dos formas dicen cosas distintas:
|
|
218
|
+
*
|
|
219
|
+
* - Una **cadena es una ruta dentro de la fila**, igual que `rowKey` y que
|
|
220
|
+
* la `key` de una columna: `'name'`, `'client.name'`. No es un rótulo
|
|
221
|
+
* literal — un literal nombraría todas las filas igual, que es justo el
|
|
222
|
+
* defecto que esto viene a quitar.
|
|
223
|
+
* - Una **función** es la salida para lo que no cabe en una ruta: juntar dos
|
|
224
|
+
* campos, recortar, o componer un nombre que no está guardado.
|
|
225
|
+
*
|
|
226
|
+
* Lo que devuelva vacío cae al número de fila —«fila 3»— y **no** a la
|
|
227
|
+
* heurística: declarar es decir cuál es la fuente, y volver a adivinar por
|
|
228
|
+
* detrás dejaría unas filas nombradas por la columna declarada y otras por
|
|
229
|
+
* otra, sin que nada lo dijera.
|
|
230
|
+
*/
|
|
231
|
+
rowLabel?: ((row: TRow) => string) | string;
|
|
232
|
+
/**
|
|
233
|
+
* Si el endpoint busca. Por defecto `true`.
|
|
234
|
+
*
|
|
235
|
+
* En `false` no se pinta la barra de búsqueda. No es cosmética: una barra
|
|
236
|
+
* que no filtra es una promesa que la pantalla no puede cumplir, y como
|
|
237
|
+
* funciona visualmente nadie la reporta como defecto.
|
|
238
|
+
*
|
|
239
|
+
* Es del endpoint y no de cada columna: quien decide sobre qué campos se
|
|
240
|
+
* busca es el servidor, no la tabla.
|
|
241
|
+
*/
|
|
242
|
+
searchable?: boolean;
|
|
243
|
+
searchPlaceholder?: string;
|
|
244
|
+
selectable?: boolean;
|
|
245
|
+
};
|
|
246
|
+
export type VunoTableQueryOptions = {
|
|
247
|
+
/**
|
|
248
|
+
* Nombres de los filtros que viajan en la URL. Hace falta declararlos
|
|
249
|
+
* porque al arrancar sin valores no habría forma de saber cuáles leer.
|
|
250
|
+
*/
|
|
251
|
+
filterKeys?: string[];
|
|
252
|
+
filters?: VunoTableFilters;
|
|
253
|
+
/**
|
|
254
|
+
* Cómo se escribe en el historial del navegador.
|
|
255
|
+
*
|
|
256
|
+
* - `replace` (por defecto): no deja rastro. Recargar y compartir el
|
|
257
|
+
* enlace funcionan, pero el botón atrás sale de la página en vez de
|
|
258
|
+
* deshacer el último filtro.
|
|
259
|
+
* - `push`: cada cambio es una entrada, así que atrás deshace filtro a
|
|
260
|
+
* filtro. A cambio, teclear en el buscador llena el historial —el
|
|
261
|
+
* antirrebote de la tabla lo suaviza, pero no lo evita.
|
|
262
|
+
*/
|
|
263
|
+
history?: 'push' | 'replace';
|
|
264
|
+
page?: number;
|
|
265
|
+
pageSize?: number;
|
|
266
|
+
/** Prefijo de los parámetros, para tener varias tablas en la misma página. */
|
|
267
|
+
prefix?: string;
|
|
268
|
+
search?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Orden inicial de la tabla. Admite la forma corta `'sku'` (ascendente).
|
|
271
|
+
*
|
|
272
|
+
* Declararlo cambia el ciclo de la cabecera: en vez de asc → desc → sin
|
|
273
|
+
* orden, el tercer clic devuelve a este orden.
|
|
274
|
+
*
|
|
275
|
+
* Va aquí y no en la definición porque el primer `fetch` —el del servidor
|
|
276
|
+
* incluido— tiene que salir ya ordenado; aplicarlo al montar la tabla
|
|
277
|
+
* provocaría una segunda petición y un parpadeo.
|
|
278
|
+
*/
|
|
279
|
+
sort?: null | string | VunoTableSort;
|
|
280
|
+
/**
|
|
281
|
+
* Guarda el estado en la query string: el enlace es compartible y recargar
|
|
282
|
+
* conserva los filtros. Si además quieres que el botón atrás los deshaga,
|
|
283
|
+
* usa `history: 'push'`.
|
|
284
|
+
*/
|
|
285
|
+
url?: boolean;
|
|
286
|
+
};
|
|
287
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import type { VunoSlots } from './base.js';
|
|
2
|
+
import type { VunoFieldInputType, VunoFieldType } from './field-type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Claves tematizables, y **cada una se llama como su componente sin la `V`**:
|
|
5
|
+
* `VCard` se personaliza con `card`, `VNumberInput` con `numberInput`.
|
|
6
|
+
*
|
|
7
|
+
* No siempre fue así y por eso está escrito aquí: llegaron a convivir un
|
|
8
|
+
* prefijo `base` en veinte claves y un `app` en tres, que no describían el
|
|
9
|
+
* componente sino la carpeta donde estaba archivado, de modo que **solo 7 de
|
|
10
|
+
* los 30 componentes públicos tenían una clave adivinable**. Para personalizar
|
|
11
|
+
* había que consultar una tabla.
|
|
12
|
+
*
|
|
13
|
+
* Queda **una** excepción: `control` no es un componente sino la caja que
|
|
14
|
+
* comparten el campo de texto, el área y el combobox, para que los tres bordes
|
|
15
|
+
* no diverjan.
|
|
16
|
+
*
|
|
17
|
+
* Eran dos. La otra era `state`, compartida por `VEmptyState` y
|
|
18
|
+
* `VFailureState`, y se resolvió por donde había que resolverla: los dos eran
|
|
19
|
+
* el mismo bloque con una variante `tone`, así que ahora son un componente,
|
|
20
|
+
* `VState`, y la clave vuelve a llamarse como él. Una clave compartida por dos
|
|
21
|
+
* componentes era la señal de que sobraba uno.
|
|
22
|
+
*
|
|
23
|
+
* Y una advertencia sobre este mismo párrafo: **decía que
|
|
24
|
+
* `types-contract.test.ts` comprueba la regla y nombra las excepciones una a
|
|
25
|
+
* una, y no es verdad.** Ese test vigila otra cosa —que los tipos públicos
|
|
26
|
+
* vivan en `types/` y salgan por su índice—, y la regla de nombres no la
|
|
27
|
+
* comprueba nadie. Se escribió la frase con la intención puesta y nadie volvió
|
|
28
|
+
* a mirar; queda dicho aquí para que quien añada una excepción sepa que no hay
|
|
29
|
+
* red debajo.
|
|
30
|
+
*/
|
|
31
|
+
export type VunoThemeKey = 'alert' | 'avatar' | 'badge' | 'button' | 'card' | 'cellBoolean' | 'cellCurrency' | 'cellDate' | 'cellNumber' | 'cellText' | 'checkbox' | 'code' | 'confirm' | 'container' | 'control' | 'controlGroup' | 'fieldInput' | 'fileUpload' | 'form' | 'formField' | 'formModal' | 'formSection' | 'input' | 'menu' | 'modal' | 'navbar' | 'navigationList' | 'navigationMenu' | 'navigationToc' | 'numberInput' | 'page' | 'pagination' | 'radioGroup' | 'select' | 'slideover' | 'state' | 'switch' | 'table' | 'tabs' | 'tagsInput' | 'textarea' | 'toast' | 'toaster' | 'tooltip' | `field${Capitalize<Exclude<VunoFieldType, VunoFieldInputType>>}`;
|
|
32
|
+
/**
|
|
33
|
+
* Slots que se aplican cuando una dimensión toma cierto valor: `color: 'error'`
|
|
34
|
+
* o `variant: 'solid'`. Se funden sobre los slots base en el orden en que el
|
|
35
|
+
* componente los pide.
|
|
36
|
+
*/
|
|
37
|
+
export type VunoThemeVariants = Record<string, Record<string, VunoSlots>>;
|
|
38
|
+
/**
|
|
39
|
+
* Clases que solo se aplican cuando **coinciden varias variantes a la vez**.
|
|
40
|
+
*
|
|
41
|
+
* Las claves que no son `class` son las condiciones, y se cumplen todas o no se
|
|
42
|
+
* aplica ninguna: `{ color: 'neutral', variant: 'link', class: { base: '…' } }`
|
|
43
|
+
* solo entra cuando el botón es las dos cosas.
|
|
44
|
+
*
|
|
45
|
+
* Existe para lo que la variable de acento no alcanza. El mecanismo de serie
|
|
46
|
+
* —el color asigna `--vuno-accent` y la variante la consume— cubre el caso
|
|
47
|
+
* corriente sin escribir combinaciones, y por eso sigue siendo el primero al
|
|
48
|
+
* que acudir. Lo que no cubre es cuando una pareja concreta necesita algo que
|
|
49
|
+
* no es un color: un borde que solo esa combinación quiere, un relleno
|
|
50
|
+
* distinto. Antes de esto, la única salida era declarar la pareja como una
|
|
51
|
+
* variante más y perder la ortogonalidad.
|
|
52
|
+
*/
|
|
53
|
+
export type VunoThemeCompoundVariant = {
|
|
54
|
+
class: VunoSlots;
|
|
55
|
+
} & Record<string, string | undefined | VunoSlots>;
|
|
56
|
+
export type VunoThemeEntry = {
|
|
57
|
+
/**
|
|
58
|
+
* Las combinaciones, que se aplican **después** de las variantes sueltas de
|
|
59
|
+
* su mismo nivel. Ese orden es el que las hace útiles: lo específico llega
|
|
60
|
+
* al final y gana el conflicto que tailwind-merge deshace.
|
|
61
|
+
*/
|
|
62
|
+
compoundVariants?: VunoThemeCompoundVariant[];
|
|
63
|
+
slots?: VunoSlots;
|
|
64
|
+
/**
|
|
65
|
+
* Evita declarar cada combinación: un botón con siete colores y cuatro
|
|
66
|
+
* variantes son veintiocho casos escritos a mano si cada uno fija sus
|
|
67
|
+
* clases. Aquí el color solo asigna las variables de acento
|
|
68
|
+
* —`--vuno-accent`, `--vuno-accent-contrast`— y la variante las consume
|
|
69
|
+
* con `bg-(--vuno-accent)`, así que son siete más cuatro y no hay
|
|
70
|
+
* combinaciones compuestas que mantener.
|
|
71
|
+
*
|
|
72
|
+
* Para lo que esa vía no alcanza está `compoundVariants`, que es la
|
|
73
|
+
* excepción y no el camino: cada entrada suya **sí** es una combinación que
|
|
74
|
+
* alguien mantiene.
|
|
75
|
+
*/
|
|
76
|
+
variants?: VunoThemeVariants;
|
|
77
|
+
};
|
|
78
|
+
export type VunoThemeConfig = {
|
|
79
|
+
[TKey in VunoThemeKey]?: VunoThemeEntry;
|
|
80
|
+
};
|
|
81
|
+
export type VunoIcons = {
|
|
82
|
+
actions: string;
|
|
83
|
+
addItem: string;
|
|
84
|
+
/** Celda booleana sin etiquetas: el «no». */
|
|
85
|
+
booleanFalse: string;
|
|
86
|
+
/** Celda booleana sin etiquetas: el «sí». */
|
|
87
|
+
booleanTrue: string;
|
|
88
|
+
/** Separador entre segmentos de la ruta de navegación. */
|
|
89
|
+
breadcrumbSeparator: string;
|
|
90
|
+
clearSearch: string;
|
|
91
|
+
close: string;
|
|
92
|
+
codeCopied: string;
|
|
93
|
+
codeCopy: string;
|
|
94
|
+
confirm: string;
|
|
95
|
+
empty: string;
|
|
96
|
+
failure: string;
|
|
97
|
+
fileMoveDown: string;
|
|
98
|
+
fileMoveUp: string;
|
|
99
|
+
fileRemove: string;
|
|
100
|
+
fileUpload: string;
|
|
101
|
+
filter: string;
|
|
102
|
+
/** La flecha que despliega una rama de la navegación. */
|
|
103
|
+
navigationToggle: string;
|
|
104
|
+
/** Búsqueda o filtros sin coincidencias. */
|
|
105
|
+
noMatches: string;
|
|
106
|
+
notifyError: string;
|
|
107
|
+
notifyInfo: string;
|
|
108
|
+
notifySuccess: string;
|
|
109
|
+
notifyWarning: string;
|
|
110
|
+
numberDecrement: string;
|
|
111
|
+
numberIncrement: string;
|
|
112
|
+
/** Controles del paginador: primera, anterior, siguiente y última. */
|
|
113
|
+
paginationFirst: string;
|
|
114
|
+
paginationLast: string;
|
|
115
|
+
paginationNext: string;
|
|
116
|
+
paginationPrevious: string;
|
|
117
|
+
passwordHide: string;
|
|
118
|
+
passwordShow: string;
|
|
119
|
+
removeItem: string;
|
|
120
|
+
retry: string;
|
|
121
|
+
search: string;
|
|
122
|
+
/** La flecha del desplegable de un `select`. */
|
|
123
|
+
selectOpen: string;
|
|
124
|
+
/** La marca de la opción elegida. */
|
|
125
|
+
selectSelected: string;
|
|
126
|
+
slugEdit: string;
|
|
127
|
+
slugReset: string;
|
|
128
|
+
sort: string;
|
|
129
|
+
sortAsc: string;
|
|
130
|
+
sortDesc: string;
|
|
131
|
+
};
|
|
132
|
+
export type VunoMessages = {
|
|
133
|
+
addItem: string;
|
|
134
|
+
applyFilters: string;
|
|
135
|
+
/** Valores accesibles de una celda booleana que se representa visualmente con un icono. */
|
|
136
|
+
booleanFalse: string;
|
|
137
|
+
booleanTrue: string;
|
|
138
|
+
/** Nombre accesible de la ruta de navegación. */
|
|
139
|
+
breadcrumb: string;
|
|
140
|
+
cancel: string;
|
|
141
|
+
clearFilters: string;
|
|
142
|
+
/** Acción del estado «no hay coincidencias». */
|
|
143
|
+
clearQuery: string;
|
|
144
|
+
clearSearch: string;
|
|
145
|
+
clearSelection: string;
|
|
146
|
+
close: string;
|
|
147
|
+
codeCopied: string;
|
|
148
|
+
codeCopiedAnnouncement: string;
|
|
149
|
+
codeCopy: string;
|
|
150
|
+
codeCopyFailed: string;
|
|
151
|
+
codeRegion: string;
|
|
152
|
+
/** Distingue el selector del sistema del hexadecimal de al lado, que sin esto se anuncian igual. */
|
|
153
|
+
colorPicker: string;
|
|
154
|
+
confirm: string;
|
|
155
|
+
confirmDescription: string;
|
|
156
|
+
confirmTitle: string;
|
|
157
|
+
created: string;
|
|
158
|
+
deleted: string;
|
|
159
|
+
deleteFailed: string;
|
|
160
|
+
/** Título y nombre accesible del índice de una página de documentación. */
|
|
161
|
+
documentToc: string;
|
|
162
|
+
emptyArray: string;
|
|
163
|
+
/** Segunda línea del estado vacío. Vacía por defecto: vuno no sabe qué falta en una lista ajena. */
|
|
164
|
+
emptyHint: string;
|
|
165
|
+
emptyTable: string;
|
|
166
|
+
failureHint: string;
|
|
167
|
+
failureTitle: string;
|
|
168
|
+
fileMoveDown: string;
|
|
169
|
+
fileMoveUp: string;
|
|
170
|
+
fileRemove: string;
|
|
171
|
+
filters: string;
|
|
172
|
+
filtersTitle: string;
|
|
173
|
+
/**
|
|
174
|
+
* Nombre accesible de la barra de navegación.
|
|
175
|
+
*
|
|
176
|
+
* Lo lleva porque `VNavbar` es un `<nav>` y en la misma pantalla suele haber
|
|
177
|
+
* otro —la navegación lateral de la aplicación—: dos regiones de navegación
|
|
178
|
+
* sin nombre se anuncian igual y no se distinguen. Es el mismo defecto que
|
|
179
|
+
* ya se arregló en el paginador.
|
|
180
|
+
*/
|
|
181
|
+
navbarLabel: string;
|
|
182
|
+
/** Lista vacía porque la búsqueda o los filtros no casan con nada. */
|
|
183
|
+
noMatches: string;
|
|
184
|
+
noMatchesHint: string;
|
|
185
|
+
/** Botones del campo numérico. */
|
|
186
|
+
numberDecrement: string;
|
|
187
|
+
numberIncrement: string;
|
|
188
|
+
of: string;
|
|
189
|
+
/** Compone el nombre de cada número: «Página 3». */
|
|
190
|
+
page: string;
|
|
191
|
+
/** Nombre accesible del selector de filas por página. */
|
|
192
|
+
pageSize: string;
|
|
193
|
+
paginationFirst: string;
|
|
194
|
+
/** Nombre accesible de la región del paginador, que es un `<nav>`. */
|
|
195
|
+
paginationLabel: string;
|
|
196
|
+
paginationLast: string;
|
|
197
|
+
paginationNext: string;
|
|
198
|
+
paginationPrevious: string;
|
|
199
|
+
passwordHide: string;
|
|
200
|
+
passwordShow: string;
|
|
201
|
+
removeItem: string;
|
|
202
|
+
/** Pie de una tabla que no pagina: «30 resultados». */
|
|
203
|
+
results: string;
|
|
204
|
+
retry: string;
|
|
205
|
+
/**
|
|
206
|
+
* Con qué se nombra una fila que no tiene nada que la nombre: «fila 3».
|
|
207
|
+
*
|
|
208
|
+
* Se usa como respaldo del nombre accesible de la casilla y del menú, donde
|
|
209
|
+
* la alternativa era que las veinte filas se llamaran igual.
|
|
210
|
+
*/
|
|
211
|
+
row: string;
|
|
212
|
+
/** Acciones de una fila. Lleva detrás el nombre de la fila. */
|
|
213
|
+
rowActions: string;
|
|
214
|
+
rowSelected: string;
|
|
215
|
+
rowsSelected: string;
|
|
216
|
+
save: string;
|
|
217
|
+
saveFailed: string;
|
|
218
|
+
searchPlaceholder: string;
|
|
219
|
+
/** Nombres accesibles de las casillas de la tabla. */
|
|
220
|
+
selectAll: string;
|
|
221
|
+
selectPlaceholder: string;
|
|
222
|
+
/**
|
|
223
|
+
* Elegir **una** fila. Lleva detrás el nombre de la fila, como el botón de
|
|
224
|
+
* quitar un archivo lleva el del archivo: sin eso, las veinte casillas de
|
|
225
|
+
* una página se anuncian con el mismo nombre y no hay forma de saber cuál
|
|
226
|
+
* es cuál sin ver la pantalla.
|
|
227
|
+
*/
|
|
228
|
+
selectRow: string;
|
|
229
|
+
/** Nombre accesible del disparador del `select`. */
|
|
230
|
+
selectToggle: string;
|
|
231
|
+
showing: string;
|
|
232
|
+
/** Enlace que salta las filas y deja el foco en el pie de la tabla. */
|
|
233
|
+
skipTable: string;
|
|
234
|
+
slugEdit: string;
|
|
235
|
+
slugReset: string;
|
|
236
|
+
updated: string;
|
|
237
|
+
};
|
|
238
|
+
/** Forma de `app.config.ts` → `vuno`. */
|
|
239
|
+
export type VunoAppConfig = VunoThemeConfig & {
|
|
240
|
+
icons?: Partial<VunoIcons>;
|
|
241
|
+
/**
|
|
242
|
+
* Con qué idioma se formatean las fechas, los números y las monedas.
|
|
243
|
+
*
|
|
244
|
+
* Se declara en vez de leerse del navegador **a propósito**: con render en
|
|
245
|
+
* servidor, el servidor no tiene navegador del que leerlo, así que un
|
|
246
|
+
* idioma adivinado da un precio en el HTML y otro al hidratar. Se ve como
|
|
247
|
+
* un parpadeo del número y se diagnostica fatal.
|
|
248
|
+
*/
|
|
249
|
+
locale?: string;
|
|
250
|
+
messages?: Partial<VunoMessages>;
|
|
251
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function formatSlug(value?: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Los formateadores reciben el idioma ya resuelto —el de `useLocale`, que
|
|
4
|
+
* sale del `app.config` del proyecto— en lugar de fijar uno: qué idioma habla
|
|
5
|
+
* la aplicación lo decide quien la escribe, no este paquete.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatNumber(value: unknown, locale?: string, decimals?: number): string;
|
|
8
|
+
export declare function formatCurrency(value: unknown, locale?: string, currency?: string, decimals?: number): string;
|
|
9
|
+
export declare function formatDate(value: unknown, locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
10
|
+
/**
|
|
11
|
+
* Un color hexadecimal en su forma de seis cifras, o nada si no lo es.
|
|
12
|
+
*
|
|
13
|
+
* Existe porque `<input type="color">` **solo** entiende seis cifras: con
|
|
14
|
+
* `#fff` —que es válido en CSS y lo que se escribe a mano— se pone en negro sin
|
|
15
|
+
* avisar, así que la muestra pintaba blanco y el selector abría negro. Los dos
|
|
16
|
+
* controles del mismo campo decían cosas distintas.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toHexColor(value?: string): string | undefined;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function formatSlug(value) {
|
|
2
|
+
if (!value) return "";
|
|
3
|
+
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4
|
+
}
|
|
5
|
+
export function formatNumber(value, locale, decimals) {
|
|
6
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
7
|
+
const parsed = Number(value);
|
|
8
|
+
if (Number.isNaN(parsed)) return "";
|
|
9
|
+
return new Intl.NumberFormat(locale, {
|
|
10
|
+
maximumFractionDigits: decimals ?? 2,
|
|
11
|
+
minimumFractionDigits: decimals ?? 0
|
|
12
|
+
}).format(parsed);
|
|
13
|
+
}
|
|
14
|
+
export function formatCurrency(value, locale, currency = "EUR", decimals) {
|
|
15
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
16
|
+
const parsed = Number(value);
|
|
17
|
+
if (Number.isNaN(parsed)) return "";
|
|
18
|
+
return new Intl.NumberFormat(locale, {
|
|
19
|
+
currency,
|
|
20
|
+
maximumFractionDigits: decimals ?? 2,
|
|
21
|
+
minimumFractionDigits: decimals ?? 2,
|
|
22
|
+
style: "currency"
|
|
23
|
+
}).format(parsed);
|
|
24
|
+
}
|
|
25
|
+
export function formatDate(value, locale, options) {
|
|
26
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
27
|
+
const date = value instanceof Date ? value : new Date(String(value));
|
|
28
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
29
|
+
return new Intl.DateTimeFormat(locale, options ?? { dateStyle: "medium" }).format(date);
|
|
30
|
+
}
|
|
31
|
+
export function toHexColor(value) {
|
|
32
|
+
if (!value) return void 0;
|
|
33
|
+
const shorthand = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(value);
|
|
34
|
+
if (shorthand) return `#${shorthand[1]}${shorthand[1]}${shorthand[2]}${shorthand[2]}${shorthand[3]}${shorthand[3]}`.toLowerCase();
|
|
35
|
+
return /^#[0-9a-f]{6}$/i.test(value) ? value.toLowerCase() : void 0;
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Marca el salto entre dos páginas que no son consecutivas. */
|
|
2
|
+
export type VunoPageGap = 'gap';
|
|
3
|
+
/**
|
|
4
|
+
* Cuántas páginas hay. Cero cuando no hay nada que paginar, y también cuando el
|
|
5
|
+
* tamaño de página no es un número de filas: sin tamaño no hay páginas, y
|
|
6
|
+
* devolver `1` fingiría una que no se puede pedir.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPageCount(total: number, pageSize: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* La página que se puede enseñar, dado cuántas filas hay en total.
|
|
11
|
+
*
|
|
12
|
+
* Una página por encima del final no es un conjunto vacío: es un enlace
|
|
13
|
+
* guardado que dejó de valer, o un tamaño de página que cambió. Devolver la
|
|
14
|
+
* última con filas permite corregir la consulta en vez de afirmar que no hay
|
|
15
|
+
* nada, que sería falso sobre el conjunto entero.
|
|
16
|
+
*
|
|
17
|
+
* Con `total` en cero no se toca: ahí el vacío sí es real y la página en la que
|
|
18
|
+
* uno esté da igual.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clampPage(page: number, total: number, pageSize: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Qué se pinta en el paginador: los números y los saltos, en orden.
|
|
23
|
+
*
|
|
24
|
+
* Siempre aparecen la primera y la última —son los dos destinos que alguien
|
|
25
|
+
* busca sin saber su número— y las `siblings` a cada lado de la actual, que son
|
|
26
|
+
* las que se alcanzan de un clic. Entre dos que no se tocan va un `'gap'`.
|
|
27
|
+
*
|
|
28
|
+
* La regla de fondo es que **una elipsis que no ahorra sitio no se pone**, y de
|
|
29
|
+
* ahí salen los dos casos que más se fallan:
|
|
30
|
+
*
|
|
31
|
+
* - **Pocas páginas se enseñan enteras.** Un paginador con saltos ocupa como
|
|
32
|
+
* mucho `2 × siblings + 5` posiciones —los dos extremos, los dos saltos y la
|
|
33
|
+
* ventana—, así que por debajo de eso esconder páginas no estrecha nada y
|
|
34
|
+
* solo quita destinos.
|
|
35
|
+
* - **Un hueco de una sola página se rellena.** Cambiar `4` por `…` ocupa lo
|
|
36
|
+
* mismo y deja de ser un enlace.
|
|
37
|
+
*
|
|
38
|
+
* La página se acota antes de calcular: una fuera de rango —un enlace viejo—
|
|
39
|
+
* daría una ventana de vecinas que no existen y un paginador sin la actual.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getPageItems(page: number, pageCount: number, siblings?: number): (number | VunoPageGap)[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function getPageCount(total, pageSize) {
|
|
2
|
+
if (total <= 0) return 0;
|
|
3
|
+
if (pageSize <= 0) return 0;
|
|
4
|
+
return Math.ceil(total / pageSize);
|
|
5
|
+
}
|
|
6
|
+
export function clampPage(page, total, pageSize) {
|
|
7
|
+
const last = getPageCount(total, pageSize);
|
|
8
|
+
if (last <= 0) return page;
|
|
9
|
+
return Math.min(page, last);
|
|
10
|
+
}
|
|
11
|
+
export function getPageItems(page, pageCount, siblings = 1) {
|
|
12
|
+
if (pageCount <= 0) return [];
|
|
13
|
+
const current = Math.min(Math.max(page, 1), pageCount);
|
|
14
|
+
const around = Math.max(siblings, 0);
|
|
15
|
+
if (pageCount <= around * 2 + 5) return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
16
|
+
const shown = /* @__PURE__ */ new Set([1, pageCount]);
|
|
17
|
+
for (let candidate = current - around; candidate <= current + around; candidate++) {
|
|
18
|
+
if (candidate >= 1 && candidate <= pageCount) shown.add(candidate);
|
|
19
|
+
}
|
|
20
|
+
const pages = [...shown].sort((a, b) => a - b);
|
|
21
|
+
const items = [];
|
|
22
|
+
for (const [index, value] of pages.entries()) {
|
|
23
|
+
const previous = pages[index - 1];
|
|
24
|
+
if (previous !== void 0) {
|
|
25
|
+
const hole = value - previous - 1;
|
|
26
|
+
if (hole === 1) items.push(previous + 1);
|
|
27
|
+
else if (hole > 1) items.push("gap");
|
|
28
|
+
}
|
|
29
|
+
items.push(value);
|
|
30
|
+
}
|
|
31
|
+
return items;
|
|
32
|
+
}
|