v-nuxt-ui 0.1.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 +153 -0
- package/dist/module.d.mts +13 -0
- package/dist/module.json +15 -0
- package/dist/module.mjs +45 -0
- package/dist/runtime/assets/css/main.css +1 -0
- package/dist/runtime/assets/css/transition.css +1 -0
- package/dist/runtime/components/CircleProgress.d.vue.ts +17 -0
- package/dist/runtime/components/CircleProgress.vue +75 -0
- package/dist/runtime/components/CircleProgress.vue.d.ts +17 -0
- package/dist/runtime/components/DeleteModal.d.vue.ts +14 -0
- package/dist/runtime/components/DeleteModal.vue +57 -0
- package/dist/runtime/components/DeleteModal.vue.d.ts +14 -0
- package/dist/runtime/components/Dnd.client.d.vue.ts +25 -0
- package/dist/runtime/components/Dnd.client.vue +47 -0
- package/dist/runtime/components/Dnd.client.vue.d.ts +25 -0
- package/dist/runtime/components/EChart.client.d.vue.ts +19 -0
- package/dist/runtime/components/EChart.client.vue +72 -0
- package/dist/runtime/components/EChart.client.vue.d.ts +19 -0
- package/dist/runtime/components/Empty.d.vue.ts +12 -0
- package/dist/runtime/components/Empty.vue +26 -0
- package/dist/runtime/components/Empty.vue.d.ts +12 -0
- package/dist/runtime/components/PermissionWrapper.d.vue.ts +23 -0
- package/dist/runtime/components/PermissionWrapper.vue +51 -0
- package/dist/runtime/components/PermissionWrapper.vue.d.ts +23 -0
- package/dist/runtime/components/ScrollArea.d.vue.ts +26 -0
- package/dist/runtime/components/ScrollArea.vue +201 -0
- package/dist/runtime/components/ScrollArea.vue.d.ts +26 -0
- package/dist/runtime/components/Spin.d.vue.ts +16 -0
- package/dist/runtime/components/Spin.vue +22 -0
- package/dist/runtime/components/Spin.vue.d.ts +16 -0
- package/dist/runtime/components/SqlEditor.d.vue.ts +23 -0
- package/dist/runtime/components/SqlEditor.vue +255 -0
- package/dist/runtime/components/SqlEditor.vue.d.ts +23 -0
- package/dist/runtime/components/Watermark.d.vue.ts +44 -0
- package/dist/runtime/components/Watermark.vue +162 -0
- package/dist/runtime/components/Watermark.vue.d.ts +44 -0
- package/dist/runtime/components/badge/CodeModal.client.d.vue.ts +11 -0
- package/dist/runtime/components/badge/CodeModal.client.vue +77 -0
- package/dist/runtime/components/badge/CodeModal.client.vue.d.ts +11 -0
- package/dist/runtime/components/badge/CodeTooltip.client.d.vue.ts +9 -0
- package/dist/runtime/components/badge/CodeTooltip.client.vue +57 -0
- package/dist/runtime/components/badge/CodeTooltip.client.vue.d.ts +9 -0
- package/dist/runtime/components/button/Dropdown.d.vue.ts +31 -0
- package/dist/runtime/components/button/Dropdown.vue +123 -0
- package/dist/runtime/components/button/Dropdown.vue.d.ts +31 -0
- package/dist/runtime/components/button/Theme.d.vue.ts +19 -0
- package/dist/runtime/components/button/Theme.vue +45 -0
- package/dist/runtime/components/button/Theme.vue.d.ts +19 -0
- package/dist/runtime/components/date-picker/Input.d.vue.ts +18 -0
- package/dist/runtime/components/date-picker/Input.vue +39 -0
- package/dist/runtime/components/date-picker/Input.vue.d.ts +18 -0
- package/dist/runtime/components/date-picker/index.d.vue.ts +26 -0
- package/dist/runtime/components/date-picker/index.vue +223 -0
- package/dist/runtime/components/date-picker/index.vue.d.ts +26 -0
- package/dist/runtime/components/flow/FlowEdge.client.d.vue.ts +5 -0
- package/dist/runtime/components/flow/FlowEdge.client.vue +110 -0
- package/dist/runtime/components/flow/FlowEdge.client.vue.d.ts +5 -0
- package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +8 -0
- package/dist/runtime/components/flow/FlowNode.client.vue +79 -0
- package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +8 -0
- package/dist/runtime/components/flow/FlowStats.d.vue.ts +7 -0
- package/dist/runtime/components/flow/FlowStats.vue +17 -0
- package/dist/runtime/components/flow/FlowStats.vue.d.ts +7 -0
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +14 -0
- package/dist/runtime/components/flow/FlowToolbar.vue +113 -0
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +14 -0
- package/dist/runtime/components/form/create-modal-template/WithApi.d.vue.ts +19 -0
- package/dist/runtime/components/form/create-modal-template/WithApi.vue +36 -0
- package/dist/runtime/components/form/create-modal-template/WithApi.vue.d.ts +19 -0
- package/dist/runtime/components/form/create-modal-template/index.d.vue.ts +19 -0
- package/dist/runtime/components/form/create-modal-template/index.vue +75 -0
- package/dist/runtime/components/form/create-modal-template/index.vue.d.ts +19 -0
- package/dist/runtime/components/form/field/AsyncObjectSelect.d.vue.ts +23 -0
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue +46 -0
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue.d.ts +23 -0
- package/dist/runtime/components/form/field/AsyncSelect.d.vue.ts +26 -0
- package/dist/runtime/components/form/field/AsyncSelect.vue +140 -0
- package/dist/runtime/components/form/field/AsyncSelect.vue.d.ts +26 -0
- package/dist/runtime/components/form/field/AsyncTreeSelect.d.vue.ts +27 -0
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue +130 -0
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue.d.ts +27 -0
- package/dist/runtime/components/form/field/ButtonSwitch.d.vue.ts +19 -0
- package/dist/runtime/components/form/field/ButtonSwitch.vue +29 -0
- package/dist/runtime/components/form/field/ButtonSwitch.vue.d.ts +19 -0
- package/dist/runtime/components/form/field/DatePicker.d.vue.ts +26 -0
- package/dist/runtime/components/form/field/DatePicker.vue +89 -0
- package/dist/runtime/components/form/field/DatePicker.vue.d.ts +26 -0
- package/dist/runtime/components/form/field/DynamicInput.d.vue.ts +14 -0
- package/dist/runtime/components/form/field/DynamicInput.vue +52 -0
- package/dist/runtime/components/form/field/DynamicInput.vue.d.ts +14 -0
- package/dist/runtime/components/form/field/DynamicObjectInput.d.vue.ts +20 -0
- package/dist/runtime/components/form/field/DynamicObjectInput.vue +82 -0
- package/dist/runtime/components/form/field/DynamicObjectInput.vue.d.ts +20 -0
- package/dist/runtime/components/form/field/Input.d.vue.ts +17 -0
- package/dist/runtime/components/form/field/Input.vue +41 -0
- package/dist/runtime/components/form/field/Input.vue.d.ts +17 -0
- package/dist/runtime/components/form/field/InputPassword.d.vue.ts +17 -0
- package/dist/runtime/components/form/field/InputPassword.vue +40 -0
- package/dist/runtime/components/form/field/InputPassword.vue.d.ts +17 -0
- package/dist/runtime/components/form/field/InputStringNumber.d.vue.ts +16 -0
- package/dist/runtime/components/form/field/InputStringNumber.vue +56 -0
- package/dist/runtime/components/form/field/InputStringNumber.vue.d.ts +16 -0
- package/dist/runtime/components/form/field/Select.d.vue.ts +16 -0
- package/dist/runtime/components/form/field/Select.vue +29 -0
- package/dist/runtime/components/form/field/Select.vue.d.ts +16 -0
- package/dist/runtime/components/form/field/SqlEditor.d.vue.ts +10 -0
- package/dist/runtime/components/form/field/SqlEditor.vue +28 -0
- package/dist/runtime/components/form/field/SqlEditor.vue.d.ts +10 -0
- package/dist/runtime/components/form/field/TreeSelectTransfer.d.vue.ts +4 -0
- package/dist/runtime/components/form/field/TreeSelectTransfer.vue +89 -0
- package/dist/runtime/components/form/field/TreeSelectTransfer.vue.d.ts +4 -0
- package/dist/runtime/components/form/field/index.d.vue.ts +26 -0
- package/dist/runtime/components/form/field/index.vue +212 -0
- package/dist/runtime/components/form/field/index.vue.d.ts +26 -0
- package/dist/runtime/components/form/index.d.vue.ts +21 -0
- package/dist/runtime/components/form/index.vue +77 -0
- package/dist/runtime/components/form/index.vue.d.ts +21 -0
- package/dist/runtime/components/layout/ModuleMenu.d.vue.ts +6 -0
- package/dist/runtime/components/layout/ModuleMenu.vue +48 -0
- package/dist/runtime/components/layout/ModuleMenu.vue.d.ts +6 -0
- package/dist/runtime/components/layout/ThemePicker.d.vue.ts +3 -0
- package/dist/runtime/components/layout/ThemePicker.vue +100 -0
- package/dist/runtime/components/layout/ThemePicker.vue.d.ts +3 -0
- package/dist/runtime/components/layout/UserMenu.d.vue.ts +7 -0
- package/dist/runtime/components/layout/UserMenu.vue +77 -0
- package/dist/runtime/components/layout/UserMenu.vue.d.ts +7 -0
- package/dist/runtime/components/layout/default.d.vue.ts +13 -0
- package/dist/runtime/components/layout/default.vue +82 -0
- package/dist/runtime/components/layout/default.vue.d.ts +13 -0
- package/dist/runtime/components/placeholder/Svg.d.vue.ts +3 -0
- package/dist/runtime/components/placeholder/Svg.vue +22 -0
- package/dist/runtime/components/placeholder/Svg.vue.d.ts +3 -0
- package/dist/runtime/components/simple-table/index.d.vue.ts +21 -0
- package/dist/runtime/components/simple-table/index.vue +159 -0
- package/dist/runtime/components/simple-table/index.vue.d.ts +21 -0
- package/dist/runtime/components/table/ExcelExportModal.d.vue.ts +28 -0
- package/dist/runtime/components/table/ExcelExportModal.vue +82 -0
- package/dist/runtime/components/table/ExcelExportModal.vue.d.ts +28 -0
- package/dist/runtime/components/table/Page.d.vue.ts +26 -0
- package/dist/runtime/components/table/Page.vue +130 -0
- package/dist/runtime/components/table/Page.vue.d.ts +26 -0
- package/dist/runtime/components/table/Pagination.d.vue.ts +19 -0
- package/dist/runtime/components/table/Pagination.vue +51 -0
- package/dist/runtime/components/table/Pagination.vue.d.ts +19 -0
- package/dist/runtime/components/table/TooltipCell.d.vue.ts +7 -0
- package/dist/runtime/components/table/TooltipCell.vue +23 -0
- package/dist/runtime/components/table/TooltipCell.vue.d.ts +7 -0
- package/dist/runtime/components/table/column/ActionHeader.d.vue.ts +21 -0
- package/dist/runtime/components/table/column/ActionHeader.vue +155 -0
- package/dist/runtime/components/table/column/ActionHeader.vue.d.ts +21 -0
- package/dist/runtime/components/table/expansion/Field.d.vue.ts +18 -0
- package/dist/runtime/components/table/expansion/Field.vue +33 -0
- package/dist/runtime/components/table/expansion/Field.vue.d.ts +18 -0
- package/dist/runtime/components/table/expansion/Layout.d.vue.ts +13 -0
- package/dist/runtime/components/table/expansion/Layout.vue +8 -0
- package/dist/runtime/components/table/expansion/Layout.vue.d.ts +13 -0
- package/dist/runtime/components/table/header/index.d.vue.ts +19 -0
- package/dist/runtime/components/table/header/index.vue +221 -0
- package/dist/runtime/components/table/header/index.vue.d.ts +19 -0
- package/dist/runtime/components/table/header/settings/columns/DndList.d.vue.ts +32 -0
- package/dist/runtime/components/table/header/settings/columns/DndList.vue +46 -0
- package/dist/runtime/components/table/header/settings/columns/DndList.vue.d.ts +32 -0
- package/dist/runtime/components/table/header/settings/columns/Item.d.vue.ts +18 -0
- package/dist/runtime/components/table/header/settings/columns/Item.vue +59 -0
- package/dist/runtime/components/table/header/settings/columns/Item.vue.d.ts +18 -0
- package/dist/runtime/components/table/header/settings/columns/index.d.vue.ts +24 -0
- package/dist/runtime/components/table/header/settings/columns/index.vue +143 -0
- package/dist/runtime/components/table/header/settings/columns/index.vue.d.ts +24 -0
- package/dist/runtime/components/table/header/settings/index.d.vue.ts +25 -0
- package/dist/runtime/components/table/header/settings/index.vue +35 -0
- package/dist/runtime/components/table/header/settings/index.vue.d.ts +25 -0
- package/dist/runtime/components/table/index.d.vue.ts +26 -0
- package/dist/runtime/components/table/index.vue +121 -0
- package/dist/runtime/components/table/index.vue.d.ts +26 -0
- package/dist/runtime/components/table/query/order/Item.d.vue.ts +28 -0
- package/dist/runtime/components/table/query/order/Item.vue +85 -0
- package/dist/runtime/components/table/query/order/Item.vue.d.ts +28 -0
- package/dist/runtime/components/table/query/order/Newer.d.vue.ts +25 -0
- package/dist/runtime/components/table/query/order/Newer.vue +50 -0
- package/dist/runtime/components/table/query/order/Newer.vue.d.ts +25 -0
- package/dist/runtime/components/table/query/order/index.d.vue.ts +19 -0
- package/dist/runtime/components/table/query/order/index.vue +108 -0
- package/dist/runtime/components/table/query/order/index.vue.d.ts +19 -0
- package/dist/runtime/components/table/query/where/Newer.d.vue.ts +14 -0
- package/dist/runtime/components/table/query/where/Newer.vue +44 -0
- package/dist/runtime/components/table/query/where/Newer.vue.d.ts +14 -0
- package/dist/runtime/components/table/query/where/index.d.vue.ts +21 -0
- package/dist/runtime/components/table/query/where/index.vue +108 -0
- package/dist/runtime/components/table/query/where/index.vue.d.ts +21 -0
- package/dist/runtime/components/table/query/where/simple/index.d.vue.ts +7 -0
- package/dist/runtime/components/table/query/where/simple/index.vue +47 -0
- package/dist/runtime/components/table/query/where/simple/index.vue.d.ts +7 -0
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.d.vue.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +65 -0
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue.d.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.d.vue.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +68 -0
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue.d.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/index.d.vue.ts +20 -0
- package/dist/runtime/components/table/query/where/simple/item/index.vue +56 -0
- package/dist/runtime/components/table/query/where/simple/item/index.vue.d.ts +20 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.d.vue.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +152 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue.d.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.d.vue.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +232 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue.d.ts +27 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Input.d.vue.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Input.vue +57 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Input.vue.d.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/InputNumber.d.vue.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/InputNumber.vue +45 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/InputNumber.vue.d.ts +29 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.d.vue.ts +28 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +62 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue.d.ts +28 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/index.d.vue.ts +19 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +72 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue.d.ts +19 -0
- package/dist/runtime/composables/api/flow/index.d.ts +3 -0
- package/dist/runtime/composables/api/flow/index.js +3 -0
- package/dist/runtime/composables/api/flow/useFlowApi.d.ts +1 -0
- package/dist/runtime/composables/api/flow/useFlowApi.js +1 -0
- package/dist/runtime/composables/api/flow/useFlowNodeApi.d.ts +1 -0
- package/dist/runtime/composables/api/flow/useFlowNodeApi.js +1 -0
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.d.ts +1 -0
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.js +1 -0
- package/dist/runtime/composables/api/index.d.ts +4 -0
- package/dist/runtime/composables/api/index.js +4 -0
- package/dist/runtime/composables/api/sys/index.d.ts +9 -0
- package/dist/runtime/composables/api/sys/index.js +9 -0
- package/dist/runtime/composables/api/sys/useAuthApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useAuthApi.js +13 -0
- package/dist/runtime/composables/api/sys/useCompanyApi.d.ts +1 -0
- package/dist/runtime/composables/api/sys/useCompanyApi.js +3 -0
- package/dist/runtime/composables/api/sys/useDepartmentApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useDepartmentApi.js +30 -0
- package/dist/runtime/composables/api/sys/useJobTitleApi.d.ts +1 -0
- package/dist/runtime/composables/api/sys/useJobTitleApi.js +3 -0
- package/dist/runtime/composables/api/sys/useLoginApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useLoginApi.js +13 -0
- package/dist/runtime/composables/api/sys/useMenuApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useMenuApi.js +32 -0
- package/dist/runtime/composables/api/sys/useRoleApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useRoleApi.js +20 -0
- package/dist/runtime/composables/api/sys/useRowRecord.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useRowRecord.js +8 -0
- package/dist/runtime/composables/api/sys/useUserApi.d.ts +0 -0
- package/dist/runtime/composables/api/sys/useUserApi.js +39 -0
- package/dist/runtime/composables/api/useApi.d.ts +0 -0
- package/dist/runtime/composables/api/useApi.js +103 -0
- package/dist/runtime/composables/api/useModel.d.ts +3 -0
- package/dist/runtime/composables/api/useModel.js +4 -0
- package/dist/runtime/composables/flow/index.d.ts +3 -0
- package/dist/runtime/composables/flow/index.js +3 -0
- package/dist/runtime/composables/flow/useFlow.d.ts +0 -0
- package/dist/runtime/composables/flow/useFlow.js +162 -0
- package/dist/runtime/composables/flow/useFlowResize.d.ts +56 -0
- package/dist/runtime/composables/flow/useFlowResize.js +148 -0
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +14 -0
- package/dist/runtime/composables/flow/useFlowStyles.js +32 -0
- package/dist/runtime/composables/index.d.ts +13 -0
- package/dist/runtime/composables/index.js +13 -0
- package/dist/runtime/composables/table/index.d.ts +9 -0
- package/dist/runtime/composables/table/index.js +9 -0
- package/dist/runtime/composables/table/useTable.d.ts +0 -0
- package/dist/runtime/composables/table/useTable.js +340 -0
- package/dist/runtime/composables/table/useTableColumns.d.ts +30 -0
- package/dist/runtime/composables/table/useTableColumns.js +214 -0
- package/dist/runtime/composables/table/useTableData.d.ts +29 -0
- package/dist/runtime/composables/table/useTableData.js +92 -0
- package/dist/runtime/composables/table/useTableOpr.d.ts +8 -0
- package/dist/runtime/composables/table/useTableOpr.js +91 -0
- package/dist/runtime/composables/table/useTablePagination.d.ts +7 -0
- package/dist/runtime/composables/table/useTablePagination.js +29 -0
- package/dist/runtime/composables/table/useTableQuery.d.ts +23 -0
- package/dist/runtime/composables/table/useTableQuery.js +131 -0
- package/dist/runtime/composables/table/useTableRowActions.d.ts +18 -0
- package/dist/runtime/composables/table/useTableRowActions.js +154 -0
- package/dist/runtime/composables/table/useTableRowSelection.d.ts +6 -0
- package/dist/runtime/composables/table/useTableRowSelection.js +26 -0
- package/dist/runtime/composables/table/useTableView.d.ts +0 -0
- package/dist/runtime/composables/table/useTableView.js +150 -0
- package/dist/runtime/composables/useApp.d.ts +22 -0
- package/dist/runtime/composables/useApp.js +83 -0
- package/dist/runtime/composables/useAuth.d.ts +14 -0
- package/dist/runtime/composables/useAuth.js +92 -0
- package/dist/runtime/composables/useBoolean.d.ts +58 -0
- package/dist/runtime/composables/useBoolean.js +71 -0
- package/dist/runtime/composables/useDate.d.ts +25 -0
- package/dist/runtime/composables/useDate.js +157 -0
- package/dist/runtime/composables/useEChart.d.ts +103 -0
- package/dist/runtime/composables/useEChart.js +120 -0
- package/dist/runtime/composables/useForm.d.ts +0 -0
- package/dist/runtime/composables/useForm.js +60 -0
- package/dist/runtime/composables/usePermission.d.ts +10 -0
- package/dist/runtime/composables/usePermission.js +53 -0
- package/dist/runtime/composables/useRouterPush.d.ts +8 -0
- package/dist/runtime/composables/useRouterPush.js +37 -0
- package/dist/runtime/composables/useSidebarMenu.d.ts +36 -0
- package/dist/runtime/composables/useSidebarMenu.js +131 -0
- package/dist/runtime/composables/useTheme.d.ts +20 -0
- package/dist/runtime/composables/useTheme.js +94 -0
- package/dist/runtime/constants/columns.d.ts +3 -0
- package/dist/runtime/constants/columns.js +52 -0
- package/dist/runtime/constants/flow.d.ts +12 -0
- package/dist/runtime/constants/flow.js +24 -0
- package/dist/runtime/constants/index.d.ts +6 -0
- package/dist/runtime/constants/index.js +6 -0
- package/dist/runtime/constants/menu.d.ts +9 -0
- package/dist/runtime/constants/menu.js +11 -0
- package/dist/runtime/constants/options.d.ts +8 -0
- package/dist/runtime/constants/options.js +15 -0
- package/dist/runtime/constants/time.d.ts +7 -0
- package/dist/runtime/constants/time.js +12 -0
- package/dist/runtime/constants/user.d.ts +7 -0
- package/dist/runtime/constants/user.js +7 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/01.nuxtUIEnhancement.d.ts +18 -0
- package/dist/runtime/plugins/01.nuxtUIEnhancement.js +52 -0
- package/dist/runtime/plugins/02.dayjs.d.ts +13 -0
- package/dist/runtime/plugins/02.dayjs.js +9 -0
- package/dist/runtime/plugins/03.theme.d.ts +2 -0
- package/dist/runtime/plugins/03.theme.js +33 -0
- package/dist/runtime/plugins/04.head.d.ts +2 -0
- package/dist/runtime/plugins/04.head.js +29 -0
- package/dist/runtime/types/app.d.ts +42 -0
- package/dist/runtime/types/app.js +0 -0
- package/dist/runtime/types/cmds/login.d.ts +23 -0
- package/dist/runtime/types/cmds/sys.d.ts +10 -0
- package/dist/runtime/types/cmds/user.d.ts +8 -0
- package/dist/runtime/types/components/date.d.ts +5 -0
- package/dist/runtime/types/components/date.js +0 -0
- package/dist/runtime/types/components/dnd.d.ts +14 -0
- package/dist/runtime/types/components/dnd.js +0 -0
- package/dist/runtime/types/components/form/field.d.ts +102 -0
- package/dist/runtime/types/components/form/field.js +0 -0
- package/dist/runtime/types/components/form/index.d.ts +27 -0
- package/dist/runtime/types/components/form/index.js +1 -0
- package/dist/runtime/types/components/index.d.ts +4 -0
- package/dist/runtime/types/components/index.js +4 -0
- package/dist/runtime/types/components/table/column.d.ts +35 -0
- package/dist/runtime/types/components/table/column.js +0 -0
- package/dist/runtime/types/components/table/header.d.ts +33 -0
- package/dist/runtime/types/components/table/header.js +0 -0
- package/dist/runtime/types/components/table/index.d.ts +103 -0
- package/dist/runtime/types/components/table/index.js +4 -0
- package/dist/runtime/types/components/table/pagination.d.ts +14 -0
- package/dist/runtime/types/components/table/pagination.js +0 -0
- package/dist/runtime/types/components/table/query/index.d.ts +2 -0
- package/dist/runtime/types/components/table/query/index.js +2 -0
- package/dist/runtime/types/components/table/query/order.d.ts +16 -0
- package/dist/runtime/types/components/table/query/order.js +0 -0
- package/dist/runtime/types/components/table/query/where.d.ts +26 -0
- package/dist/runtime/types/components/table/query/where.js +0 -0
- package/dist/runtime/types/constants/time.d.ts +5 -0
- package/dist/runtime/types/index.d.ts +14 -0
- package/dist/runtime/types/index.js +6 -0
- package/dist/runtime/types/localStorage.d.ts +15 -0
- package/dist/runtime/types/locale.d.ts +81 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/models/base.d.ts +16 -0
- package/dist/runtime/types/models/flow.d.ts +31 -0
- package/dist/runtime/types/models/sys.d.ts +107 -0
- package/dist/runtime/types/query.d.ts +45 -0
- package/dist/runtime/types/query.js +1 -0
- package/dist/runtime/types/request.d.ts +55 -0
- package/dist/runtime/types/request.js +22 -0
- package/dist/runtime/types/storage.d.ts +10 -0
- package/dist/runtime/types/storage.js +11 -0
- package/dist/runtime/utils/array.d.ts +1 -0
- package/dist/runtime/utils/array.js +3 -0
- package/dist/runtime/utils/diff.d.ts +2 -0
- package/dist/runtime/utils/diff.js +81 -0
- package/dist/runtime/utils/download/index.d.ts +1 -0
- package/dist/runtime/utils/download/index.js +1 -0
- package/dist/runtime/utils/download/tagA.d.ts +2 -0
- package/dist/runtime/utils/download/tagA.js +14 -0
- package/dist/runtime/utils/emoji.d.ts +1 -0
- package/dist/runtime/utils/emoji.js +57 -0
- package/dist/runtime/utils/excel.d.ts +3 -0
- package/dist/runtime/utils/excel.js +63 -0
- package/dist/runtime/utils/form.d.ts +2 -0
- package/dist/runtime/utils/form.js +142 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.js +11 -0
- package/dist/runtime/utils/request.d.ts +3 -0
- package/dist/runtime/utils/request.js +3 -0
- package/dist/runtime/utils/string.d.ts +6 -0
- package/dist/runtime/utils/string.js +18 -0
- package/dist/runtime/utils/tree.d.ts +8 -0
- package/dist/runtime/utils/tree.js +54 -0
- package/dist/runtime/utils/type.d.ts +1 -0
- package/dist/runtime/utils/type.js +3 -0
- package/dist/runtime/utils/vueuse.d.ts +1 -0
- package/dist/runtime/utils/vueuse.js +20 -0
- package/dist/types.d.mts +3 -0
- package/package.json +108 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { computed, ref, useTemplateRef, nextTick } from "vue";
|
|
2
|
+
import { useTableQuery } from "./useTableQuery.js";
|
|
3
|
+
import { useTablePagination } from "./useTablePagination.js";
|
|
4
|
+
import { useTableData } from "./useTableData.js";
|
|
5
|
+
import { useTableRowSelection } from "./useTableRowSelection.js";
|
|
6
|
+
import { useTableColumns } from "./useTableColumns.js";
|
|
7
|
+
import { useTableRowActions } from "./useTableRowActions.js";
|
|
8
|
+
import { useTableOpr } from "./useTableOpr.js";
|
|
9
|
+
export function useTable(props) {
|
|
10
|
+
const {
|
|
11
|
+
// table-level props
|
|
12
|
+
name,
|
|
13
|
+
disableCreation,
|
|
14
|
+
disableRefresh,
|
|
15
|
+
disableBatchDeletion,
|
|
16
|
+
disableSettings,
|
|
17
|
+
disableFetchOnMounted,
|
|
18
|
+
useApiGroup,
|
|
19
|
+
apiListFn,
|
|
20
|
+
fetchAll,
|
|
21
|
+
onEditRowFromModal,
|
|
22
|
+
exportExcel,
|
|
23
|
+
// header-level props
|
|
24
|
+
extraButtons,
|
|
25
|
+
onNew,
|
|
26
|
+
// where query
|
|
27
|
+
disableWhereQuery,
|
|
28
|
+
extraWhereQueryOptions,
|
|
29
|
+
extraWhereQueryInitValues,
|
|
30
|
+
// order query
|
|
31
|
+
disableOrderQuery,
|
|
32
|
+
extraOrderQueryOptions,
|
|
33
|
+
// column-level props
|
|
34
|
+
bizColumns,
|
|
35
|
+
extraRowActions,
|
|
36
|
+
treeifyColName,
|
|
37
|
+
commonColumnProps,
|
|
38
|
+
// row-level props
|
|
39
|
+
rowKey = "id",
|
|
40
|
+
disableRowActions,
|
|
41
|
+
disableRowUpdate,
|
|
42
|
+
disableRowCopy,
|
|
43
|
+
disableRowDeletion,
|
|
44
|
+
disableRowSelection,
|
|
45
|
+
expandable,
|
|
46
|
+
rowSpanColumns,
|
|
47
|
+
customRowCopyFn
|
|
48
|
+
} = props;
|
|
49
|
+
const queryComposable = useTableQuery({
|
|
50
|
+
name,
|
|
51
|
+
bizColumns,
|
|
52
|
+
extraWhereQueryOptions,
|
|
53
|
+
extraWhereQueryInitValues,
|
|
54
|
+
extraOrderQueryOptions
|
|
55
|
+
});
|
|
56
|
+
const {
|
|
57
|
+
whereQueryOptions,
|
|
58
|
+
whereQueryInitValues,
|
|
59
|
+
orderQueryOptions,
|
|
60
|
+
orderQueryInitValues,
|
|
61
|
+
initStorageColumns,
|
|
62
|
+
localStgSettings,
|
|
63
|
+
whereQuery,
|
|
64
|
+
whereQueryOpen,
|
|
65
|
+
orderQuery,
|
|
66
|
+
isWhereQueryValueEmpty,
|
|
67
|
+
pruneWhereQuery
|
|
68
|
+
} = queryComposable;
|
|
69
|
+
const paginationComposable = useTablePagination(localStgSettings);
|
|
70
|
+
const { pagination, pageSizeDropdownMenuItems } = paginationComposable;
|
|
71
|
+
const dataComposable = useTableData({
|
|
72
|
+
name,
|
|
73
|
+
rowKey,
|
|
74
|
+
apiListFn,
|
|
75
|
+
useApiGroup,
|
|
76
|
+
fetchAll,
|
|
77
|
+
treeifyColName,
|
|
78
|
+
disableFetchOnMounted,
|
|
79
|
+
pagination,
|
|
80
|
+
pruneWhereQuery,
|
|
81
|
+
whereQuery,
|
|
82
|
+
orderQuery,
|
|
83
|
+
clearRowSelection: () => rowSelectionComposable.clearRowSelection()
|
|
84
|
+
});
|
|
85
|
+
const {
|
|
86
|
+
data,
|
|
87
|
+
treeifyData,
|
|
88
|
+
stats,
|
|
89
|
+
total,
|
|
90
|
+
createRow,
|
|
91
|
+
updateRow,
|
|
92
|
+
deleteRow,
|
|
93
|
+
fetching,
|
|
94
|
+
fetchList,
|
|
95
|
+
debouncedFetchList
|
|
96
|
+
} = dataComposable;
|
|
97
|
+
const rowSelectionComposable = useTableRowSelection(data, rowKey);
|
|
98
|
+
const { rowSelection, selectedIds, clearRowSelection: _clearRowSelection } = rowSelectionComposable;
|
|
99
|
+
const whereQueryRef = useTemplateRef("proTableQueryWhere");
|
|
100
|
+
const onFilterClick = (field) => {
|
|
101
|
+
whereQueryOpen.value = true;
|
|
102
|
+
const currentItems = whereQuery.value?.items ?? [];
|
|
103
|
+
const existingItem = currentItems.find((item) => item.field === field);
|
|
104
|
+
if (!existingItem) {
|
|
105
|
+
const col = bizColumns.find((c) => c["accessorKey"] === field);
|
|
106
|
+
if (col?.filterOption) {
|
|
107
|
+
whereQuery.value = {
|
|
108
|
+
...whereQuery.value,
|
|
109
|
+
items: [...currentItems, {
|
|
110
|
+
field,
|
|
111
|
+
opr: col.filterOption.defaultOpr ?? useTableOpr().getDefaultOprByType(col.filterOption.type),
|
|
112
|
+
value: null,
|
|
113
|
+
custom: col.filterOption.custom
|
|
114
|
+
}]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const tryFocus = (retries) => {
|
|
119
|
+
nextTick(() => {
|
|
120
|
+
const focused = whereQueryRef.value?.focusField(field);
|
|
121
|
+
if (!focused && retries > 0) {
|
|
122
|
+
setTimeout(() => tryFocus(retries - 1), 50);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
tryFocus(3);
|
|
127
|
+
};
|
|
128
|
+
const columnsComposable = useTableColumns({
|
|
129
|
+
bizColumns,
|
|
130
|
+
commonColumnProps,
|
|
131
|
+
localStgSettings,
|
|
132
|
+
initStorageColumns,
|
|
133
|
+
orderQuery,
|
|
134
|
+
orderQueryInitValues,
|
|
135
|
+
onUpdateOrderQuery: (query) => orderQuery.value = query,
|
|
136
|
+
onFilterClick,
|
|
137
|
+
debouncedFetchList,
|
|
138
|
+
fetching,
|
|
139
|
+
treeifyColName,
|
|
140
|
+
disableRowSelection,
|
|
141
|
+
expandable
|
|
142
|
+
});
|
|
143
|
+
const {
|
|
144
|
+
selectionColumn,
|
|
145
|
+
expandColumn,
|
|
146
|
+
clonedBizColumns,
|
|
147
|
+
columnsWithTreeifyExpander,
|
|
148
|
+
columnPinning
|
|
149
|
+
} = columnsComposable;
|
|
150
|
+
const rowActionsComposable = useTableRowActions({
|
|
151
|
+
rowKey,
|
|
152
|
+
disableRowActions,
|
|
153
|
+
disableRowUpdate,
|
|
154
|
+
disableRowCopy,
|
|
155
|
+
disableRowDeletion,
|
|
156
|
+
onEditRowFromModal,
|
|
157
|
+
extraRowActions,
|
|
158
|
+
useApiGroup,
|
|
159
|
+
customRowCopyFn,
|
|
160
|
+
fetchList
|
|
161
|
+
});
|
|
162
|
+
const { getRowActions, generateActionColumn } = rowActionsComposable;
|
|
163
|
+
const columns = computed(() => {
|
|
164
|
+
const newCols = [];
|
|
165
|
+
if (!disableRowSelection) {
|
|
166
|
+
newCols.push(selectionColumn);
|
|
167
|
+
}
|
|
168
|
+
if (expandable) {
|
|
169
|
+
newCols.push(expandColumn);
|
|
170
|
+
}
|
|
171
|
+
newCols.push(...columnsWithTreeifyExpander.value);
|
|
172
|
+
if (rowSpanColumns && rowSpanColumns.length > 0 && data.value.length > 0) {
|
|
173
|
+
const rowSpanIdxObj = {};
|
|
174
|
+
rowSpanColumns.forEach((colName, colIdx) => {
|
|
175
|
+
let prevValue = void 0;
|
|
176
|
+
let prevStartIdx = 0;
|
|
177
|
+
let prevSpan = 1;
|
|
178
|
+
let prevMaxRowSpan = 1;
|
|
179
|
+
for (let rowIdx = 0; rowIdx < data.value.length; rowIdx++) {
|
|
180
|
+
const row = data.value[rowIdx];
|
|
181
|
+
const value = row[colName];
|
|
182
|
+
if (colIdx === 0) {
|
|
183
|
+
if (rowIdx === 0 || value !== prevValue) {
|
|
184
|
+
prevValue = value;
|
|
185
|
+
prevStartIdx = rowIdx;
|
|
186
|
+
prevSpan = 1;
|
|
187
|
+
} else {
|
|
188
|
+
prevSpan++;
|
|
189
|
+
}
|
|
190
|
+
if (!rowSpanIdxObj[colName]) rowSpanIdxObj[colName] = [];
|
|
191
|
+
rowSpanIdxObj[colName][prevStartIdx] = prevSpan;
|
|
192
|
+
if (rowIdx > prevStartIdx) rowSpanIdxObj[colName][rowIdx] = 0;
|
|
193
|
+
} else {
|
|
194
|
+
const prevColName = rowSpanColumns[colIdx - 1];
|
|
195
|
+
let groupStart = rowIdx;
|
|
196
|
+
while (groupStart >= 0 && row[prevColName] === data.value[groupStart][prevColName]) {
|
|
197
|
+
groupStart--;
|
|
198
|
+
}
|
|
199
|
+
groupStart++;
|
|
200
|
+
let maxRowspan = 0;
|
|
201
|
+
for (let i = groupStart; i <= rowIdx; i++) {
|
|
202
|
+
maxRowspan = Math.max(maxRowspan, rowSpanIdxObj[prevColName][i] ?? 1);
|
|
203
|
+
}
|
|
204
|
+
if (rowIdx === 0 || value !== prevValue || prevSpan >= prevMaxRowSpan) {
|
|
205
|
+
prevValue = value;
|
|
206
|
+
prevStartIdx = rowIdx;
|
|
207
|
+
prevSpan = 1;
|
|
208
|
+
prevMaxRowSpan = maxRowspan;
|
|
209
|
+
} else {
|
|
210
|
+
prevSpan++;
|
|
211
|
+
}
|
|
212
|
+
if (!rowSpanIdxObj[colName]) rowSpanIdxObj[colName] = [];
|
|
213
|
+
rowSpanIdxObj[colName][prevStartIdx] = Math.min(prevSpan, maxRowspan);
|
|
214
|
+
if (rowIdx > prevStartIdx) rowSpanIdxObj[colName][rowIdx] = 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
newCols.forEach((col) => {
|
|
219
|
+
if (rowSpanColumns.includes(col["accessorKey"])) {
|
|
220
|
+
col.meta = col.meta || {};
|
|
221
|
+
col.meta.class = col.meta.class || {};
|
|
222
|
+
col.meta.rowspan = col.meta.rowspan || {};
|
|
223
|
+
col.meta.class.td = (cell) => {
|
|
224
|
+
const rowIdx = cell.row.index;
|
|
225
|
+
const rowspan = rowSpanIdxObj[col["accessorKey"]]?.[rowIdx] ?? 1;
|
|
226
|
+
return rowspan === 0 ? "hidden" : "";
|
|
227
|
+
};
|
|
228
|
+
col.meta.rowspan.td = (cell) => {
|
|
229
|
+
const rowIdx = cell.row.index;
|
|
230
|
+
const rowspan = rowSpanIdxObj[col["accessorKey"]]?.[rowIdx] ?? 1;
|
|
231
|
+
return rowspan === 0 ? "" : rowspan.toString();
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (!disableRowActions) {
|
|
237
|
+
newCols.push(generateActionColumn());
|
|
238
|
+
}
|
|
239
|
+
return newCols;
|
|
240
|
+
});
|
|
241
|
+
const tblContextMenuItems = ref([]);
|
|
242
|
+
function onContextmenu(_e, row) {
|
|
243
|
+
tblContextMenuItems.value = getRowActions(row);
|
|
244
|
+
}
|
|
245
|
+
const tblProps = computed(() => ({
|
|
246
|
+
data: treeifyColName ? treeifyData.value : data.value,
|
|
247
|
+
columns: columns.value,
|
|
248
|
+
loading: fetching.value,
|
|
249
|
+
sticky: true,
|
|
250
|
+
getSubRows: (row) => row["children"],
|
|
251
|
+
expanded: treeifyColName ? true : void 0,
|
|
252
|
+
columnPinning: columnPinning.value,
|
|
253
|
+
onContextmenu
|
|
254
|
+
}));
|
|
255
|
+
const tblWhereQueryProps = computed(() => ({
|
|
256
|
+
whereOptions: whereQueryOptions.value,
|
|
257
|
+
defaultWhereQuery: whereQueryInitValues.value,
|
|
258
|
+
whereQuery: whereQuery.value,
|
|
259
|
+
onUpdateWhereQuery: (query) => whereQuery.value = query,
|
|
260
|
+
whereQueryOpen: whereQueryOpen.value,
|
|
261
|
+
onUpdateWhereQueryOpen: (open) => whereQueryOpen.value = open,
|
|
262
|
+
isWhereQueryValueEmpty: isWhereQueryValueEmpty.value,
|
|
263
|
+
fetching: fetching.value,
|
|
264
|
+
triggerFetching: fetchList,
|
|
265
|
+
bizColumns
|
|
266
|
+
}));
|
|
267
|
+
const tblOrderQueryProps = computed(() => ({
|
|
268
|
+
orderOptions: orderQueryOptions.value,
|
|
269
|
+
defaultOrderQuery: orderQueryInitValues.value,
|
|
270
|
+
orderQuery: orderQuery.value,
|
|
271
|
+
onUpdateOrderQuery: (query) => orderQuery.value = query,
|
|
272
|
+
fetching: fetching.value,
|
|
273
|
+
triggerFetching: debouncedFetchList,
|
|
274
|
+
bizColumns
|
|
275
|
+
}));
|
|
276
|
+
const tblHeaderProps = computed(() => ({
|
|
277
|
+
name,
|
|
278
|
+
fetching: fetching.value,
|
|
279
|
+
rawBizColumns: bizColumns,
|
|
280
|
+
onUpdateBizColumns: (columns2) => {
|
|
281
|
+
clonedBizColumns.value = columns2;
|
|
282
|
+
},
|
|
283
|
+
initStorageColumns: initStorageColumns.value,
|
|
284
|
+
onNew,
|
|
285
|
+
apiGroup: useApiGroup,
|
|
286
|
+
fetchList,
|
|
287
|
+
onEditRowFromModal,
|
|
288
|
+
selectedIds: selectedIds.value,
|
|
289
|
+
disableCreation,
|
|
290
|
+
disableWhereQuery,
|
|
291
|
+
whereQueryProps: tblWhereQueryProps.value,
|
|
292
|
+
disableOrderQuery,
|
|
293
|
+
orderQueryProps: tblOrderQueryProps.value,
|
|
294
|
+
disableBatchDeletion,
|
|
295
|
+
disableRefresh,
|
|
296
|
+
disableSettings,
|
|
297
|
+
exportExcel,
|
|
298
|
+
extraWhereQueryInitValues,
|
|
299
|
+
extraButtons
|
|
300
|
+
}));
|
|
301
|
+
const tblPaginationProps = computed(() => ({
|
|
302
|
+
data: data.value,
|
|
303
|
+
selectedIds: selectedIds.value,
|
|
304
|
+
pageNum: pagination.value.pageNum ?? 1,
|
|
305
|
+
pageSize: pagination.value.pageSize ?? 10,
|
|
306
|
+
total: total.value ?? 0,
|
|
307
|
+
onUpdatePage: (pageNum) => pagination.value.pageNum = pageNum,
|
|
308
|
+
hidePagination: fetchAll,
|
|
309
|
+
fetching: fetching.value,
|
|
310
|
+
pageSizeDropdownMenuItems: pageSizeDropdownMenuItems.value
|
|
311
|
+
}));
|
|
312
|
+
return {
|
|
313
|
+
// data
|
|
314
|
+
data,
|
|
315
|
+
createRow,
|
|
316
|
+
updateRow,
|
|
317
|
+
deleteRow,
|
|
318
|
+
stats,
|
|
319
|
+
// row selection
|
|
320
|
+
rowSelection,
|
|
321
|
+
onUpdateRowSelection: (newRowSelection) => rowSelection.value = newRowSelection,
|
|
322
|
+
selectedIds,
|
|
323
|
+
// crud
|
|
324
|
+
fetching,
|
|
325
|
+
fetchList,
|
|
326
|
+
debouncedFetchList,
|
|
327
|
+
// where query
|
|
328
|
+
whereQueryOpen: whereQueryOpen.value,
|
|
329
|
+
onUpdateWhereQueryOpen: (open) => whereQueryOpen.value = open,
|
|
330
|
+
// columns
|
|
331
|
+
columns,
|
|
332
|
+
// props
|
|
333
|
+
tblProps,
|
|
334
|
+
tblWhereQueryProps,
|
|
335
|
+
tblHeaderProps,
|
|
336
|
+
tblPaginationProps,
|
|
337
|
+
// others
|
|
338
|
+
tblContextMenuItems
|
|
339
|
+
};
|
|
340
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { ColumnPinningState } from '@tanstack/table-core';
|
|
3
|
+
import type { VColumn, OrderQuery } from '#v/types';
|
|
4
|
+
interface UseTableColumnsReturn<T> {
|
|
5
|
+
selectionColumn: VColumn<T>;
|
|
6
|
+
expandColumn: VColumn<T>;
|
|
7
|
+
clonedBizColumns: Ref<VColumn<T>[]>;
|
|
8
|
+
columnsWithCommonProps: Ref<VColumn<T>[]>;
|
|
9
|
+
sortedColumns: ComputedRef<VColumn<T>[]>;
|
|
10
|
+
columnsWithFilterOptions: ComputedRef<VColumn<T>[]>;
|
|
11
|
+
columnsWithSortableHeader: ComputedRef<VColumn<T>[]>;
|
|
12
|
+
columnsWithTreeifyExpander: ComputedRef<VColumn<T>[]>;
|
|
13
|
+
columnPinning: ComputedRef<ColumnPinningState>;
|
|
14
|
+
}
|
|
15
|
+
export declare function useTableColumns<T>(props: {
|
|
16
|
+
bizColumns: VColumn<T>[];
|
|
17
|
+
commonColumnProps?: any;
|
|
18
|
+
localStgSettings: Ref<LocalStorage.TableSettings<T>>;
|
|
19
|
+
initStorageColumns: ComputedRef<LocalStorage.Column[]>;
|
|
20
|
+
orderQuery: ComputedRef<OrderQuery<T>>;
|
|
21
|
+
orderQueryInitValues: ComputedRef<OrderQuery<T>>;
|
|
22
|
+
onUpdateOrderQuery: (query: OrderQuery<T>) => void;
|
|
23
|
+
onFilterClick: (field: string) => void;
|
|
24
|
+
debouncedFetchList: () => void;
|
|
25
|
+
fetching: Ref<boolean>;
|
|
26
|
+
treeifyColName?: keyof T;
|
|
27
|
+
disableRowSelection?: boolean;
|
|
28
|
+
expandable?: boolean;
|
|
29
|
+
}): UseTableColumnsReturn<T>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { computed, ref, h } from "vue";
|
|
2
|
+
import TableColumnActionHeader from "#v/components/table/column/ActionHeader.vue";
|
|
3
|
+
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
4
|
+
import UCheckbox from "@nuxt/ui/components/Checkbox.vue";
|
|
5
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
6
|
+
import { defu } from "defu";
|
|
7
|
+
import { cloneJson } from "#v/utils";
|
|
8
|
+
export function useTableColumns(props) {
|
|
9
|
+
const {
|
|
10
|
+
bizColumns,
|
|
11
|
+
commonColumnProps = { meta: { class: { td: "min-w-8" } } },
|
|
12
|
+
localStgSettings,
|
|
13
|
+
initStorageColumns,
|
|
14
|
+
orderQuery,
|
|
15
|
+
onUpdateOrderQuery,
|
|
16
|
+
onFilterClick,
|
|
17
|
+
debouncedFetchList,
|
|
18
|
+
fetching,
|
|
19
|
+
treeifyColName,
|
|
20
|
+
disableRowSelection,
|
|
21
|
+
expandable
|
|
22
|
+
} = props;
|
|
23
|
+
const selectionColumn = {
|
|
24
|
+
id: "select",
|
|
25
|
+
header: ({ table }) => h(UCheckbox, {
|
|
26
|
+
"modelValue": table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
27
|
+
"onUpdate:modelValue": (value) => table.toggleAllPageRowsSelected(Boolean(value)),
|
|
28
|
+
"ariaLabel": "\u9009\u62E9\u6240\u6709\u884C"
|
|
29
|
+
}),
|
|
30
|
+
cell: ({ row }) => h(UCheckbox, {
|
|
31
|
+
"modelValue": row.getIsSelected() ? true : row.getIsSomeSelected() ? "indeterminate" : false,
|
|
32
|
+
"onUpdate:modelValue": (value) => row.toggleSelected(Boolean(value)),
|
|
33
|
+
"ariaLabel": "\u9009\u62E9\u884C"
|
|
34
|
+
}),
|
|
35
|
+
meta: {
|
|
36
|
+
class: {
|
|
37
|
+
th: "w-12 min-w-12 px-4",
|
|
38
|
+
// 无数据的时候也有宽度
|
|
39
|
+
td: "w-12 min-w-12"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
size: 48
|
|
43
|
+
};
|
|
44
|
+
const expandColumn = {
|
|
45
|
+
id: "expand",
|
|
46
|
+
cell: ({ row }) => h("div", { class: "flex" }, [
|
|
47
|
+
h(UIcon, {
|
|
48
|
+
"name": "i-lucide-chevron-left",
|
|
49
|
+
"aria-label": "Expand",
|
|
50
|
+
"role": "expand-col",
|
|
51
|
+
"class": `${row.getIsExpanded() ? "-rotate-90" : ""} duration-200 cursor-pointer size-4 text-dimmed`,
|
|
52
|
+
"onClick": () => row.toggleExpanded()
|
|
53
|
+
})
|
|
54
|
+
]),
|
|
55
|
+
meta: {
|
|
56
|
+
class: {
|
|
57
|
+
td: "w-12 min-w-12"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
size: 48
|
|
61
|
+
};
|
|
62
|
+
const clonedBizColumns = ref(bizColumns);
|
|
63
|
+
const columnsWithCommonProps = ref(
|
|
64
|
+
clonedBizColumns.value.map((col) => defu(col, cloneJson(commonColumnProps)))
|
|
65
|
+
);
|
|
66
|
+
const sortedColumns = computed(() => {
|
|
67
|
+
const sortedKeys = (localStgSettings.value.columns ?? initStorageColumns.value).filter((c) => c.checked).map((c) => c.accessorKey);
|
|
68
|
+
return sortedKeys.map((key) => columnsWithCommonProps.value.find((col) => col["accessorKey"] === key)).filter(Boolean);
|
|
69
|
+
});
|
|
70
|
+
const columnsWithFilterOptions = computed(() => {
|
|
71
|
+
return sortedColumns.value.map((col) => {
|
|
72
|
+
if (!col.filterOption) {
|
|
73
|
+
return col;
|
|
74
|
+
}
|
|
75
|
+
switch (col.filterOption.type) {
|
|
76
|
+
case "select":
|
|
77
|
+
if (col.cell) return col;
|
|
78
|
+
return {
|
|
79
|
+
...col,
|
|
80
|
+
cell: ({ cell }) => {
|
|
81
|
+
const item = col.filterOption?.["items"].find((item2) => item2.value === cell.getValue());
|
|
82
|
+
return item ? h(UBadge, {
|
|
83
|
+
color: item?.color ?? "neutral",
|
|
84
|
+
variant: col.filterOption?.["variant"] ?? "outline",
|
|
85
|
+
icon: item?.icon
|
|
86
|
+
}, () => item?.label ?? "\u672A\u77E5\u503C") : "";
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
default:
|
|
90
|
+
return col;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const columnsWithSortableHeader = computed(() => {
|
|
95
|
+
return columnsWithFilterOptions.value.map((col) => ({
|
|
96
|
+
...col,
|
|
97
|
+
header: ({ column }) => {
|
|
98
|
+
const field = col["accessorKey"];
|
|
99
|
+
const orderQueryIndex = orderQuery.value.findIndex((item) => item.field === field);
|
|
100
|
+
const orderQueryItem = orderQueryIndex >= 0 ? orderQuery.value[orderQueryIndex] : void 0;
|
|
101
|
+
const orderIndex = orderQuery.value.length > 1 && orderQueryIndex >= 0 ? orderQueryIndex + 1 : void 0;
|
|
102
|
+
const onUpdateOrderOpr = (nextOrder) => {
|
|
103
|
+
if (nextOrder !== null) {
|
|
104
|
+
const newQuery = [...orderQuery.value];
|
|
105
|
+
if (orderQueryIndex >= 0) {
|
|
106
|
+
newQuery[orderQueryIndex] = { field, order: nextOrder };
|
|
107
|
+
} else {
|
|
108
|
+
newQuery.push({ field, order: nextOrder });
|
|
109
|
+
}
|
|
110
|
+
onUpdateOrderQuery(newQuery);
|
|
111
|
+
} else {
|
|
112
|
+
const newOrderQuery = [...orderQuery.value];
|
|
113
|
+
newOrderQuery.splice(orderQueryIndex, 1);
|
|
114
|
+
onUpdateOrderQuery(newOrderQuery);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const accessorKey = col["accessorKey"];
|
|
118
|
+
const onUpdatePinned = (position) => {
|
|
119
|
+
const columns = [...localStgSettings.value.columns ?? initStorageColumns.value];
|
|
120
|
+
const idx = columns.findIndex((c) => c.accessorKey === accessorKey);
|
|
121
|
+
if (idx >= 0) {
|
|
122
|
+
columns[idx] = { ...columns[idx], fixed: position };
|
|
123
|
+
localStgSettings.value = { ...localStgSettings.value, columns };
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
return h(TableColumnActionHeader, {
|
|
127
|
+
label: col.header,
|
|
128
|
+
accessorKey,
|
|
129
|
+
fetchList: debouncedFetchList,
|
|
130
|
+
disabled: fetching.value,
|
|
131
|
+
enableOrder: col.sortOption !== void 0,
|
|
132
|
+
isOrdered: Boolean(orderQueryItem),
|
|
133
|
+
orderOpr: orderQueryItem?.order,
|
|
134
|
+
orderIndex,
|
|
135
|
+
onUpdateOrderOpr,
|
|
136
|
+
isPinned: column.getIsPinned(),
|
|
137
|
+
onUpdatePinned,
|
|
138
|
+
enableFilter: col.filterOption !== void 0,
|
|
139
|
+
onFilterClick,
|
|
140
|
+
onHideColumn: (key) => {
|
|
141
|
+
const columns = [...localStgSettings.value.columns ?? initStorageColumns.value];
|
|
142
|
+
const idx = columns.findIndex((c) => c.accessorKey === key);
|
|
143
|
+
if (idx >= 0) {
|
|
144
|
+
columns[idx] = { ...columns[idx], checked: false };
|
|
145
|
+
localStgSettings.value = { ...localStgSettings.value, columns };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
});
|
|
152
|
+
const columnsWithTreeifyExpander = computed(() => {
|
|
153
|
+
if (!treeifyColName || columnsWithSortableHeader.value.length === 0) return columnsWithSortableHeader.value;
|
|
154
|
+
const treeifyCol = {
|
|
155
|
+
...columnsWithSortableHeader.value[0],
|
|
156
|
+
cell: (cellProps) => {
|
|
157
|
+
const originalCellContent = (() => {
|
|
158
|
+
const originalCell = columnsWithSortableHeader.value[0]?.cell;
|
|
159
|
+
if (typeof originalCell === "function") {
|
|
160
|
+
return originalCell(cellProps);
|
|
161
|
+
} else if (originalCell) {
|
|
162
|
+
return originalCell;
|
|
163
|
+
}
|
|
164
|
+
return cellProps.getValue();
|
|
165
|
+
})();
|
|
166
|
+
return h(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
style: {
|
|
170
|
+
paddingLeft: `${cellProps.row.depth}rem`
|
|
171
|
+
},
|
|
172
|
+
class: "flex items-center gap-2"
|
|
173
|
+
},
|
|
174
|
+
[
|
|
175
|
+
h(UIcon, {
|
|
176
|
+
name: cellProps.row.getIsExpanded() && cellProps.row.getCanExpand() ? "i-lucide-chevron-down" : "i-lucide-chevron-right",
|
|
177
|
+
onClick: cellProps.row.getToggleExpandedHandler(),
|
|
178
|
+
class: `cursor-pointer ${!cellProps.row.getCanExpand() && "opacity-0"}`
|
|
179
|
+
}),
|
|
180
|
+
originalCellContent
|
|
181
|
+
]
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
return [treeifyCol, ...columnsWithSortableHeader.value.slice(1)];
|
|
186
|
+
});
|
|
187
|
+
const columnPinning = computed(() => {
|
|
188
|
+
const leftPinnedKeys = [];
|
|
189
|
+
if (!disableRowSelection) {
|
|
190
|
+
leftPinnedKeys.push("select");
|
|
191
|
+
}
|
|
192
|
+
if (expandable) {
|
|
193
|
+
leftPinnedKeys.push("expand");
|
|
194
|
+
}
|
|
195
|
+
leftPinnedKeys.push(...localStgSettings.value.columns?.filter((c) => c.fixed === "left" && c.checked).map((c) => c.accessorKey) ?? []);
|
|
196
|
+
const rightPinnedKeys = localStgSettings.value.columns?.filter((c) => c.fixed === "right" && c.checked).map((c) => c.accessorKey) ?? [];
|
|
197
|
+
rightPinnedKeys.push("actions");
|
|
198
|
+
return {
|
|
199
|
+
left: leftPinnedKeys,
|
|
200
|
+
right: rightPinnedKeys
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
selectionColumn,
|
|
205
|
+
expandColumn,
|
|
206
|
+
clonedBizColumns,
|
|
207
|
+
columnsWithCommonProps,
|
|
208
|
+
sortedColumns,
|
|
209
|
+
columnsWithFilterOptions,
|
|
210
|
+
columnsWithSortableHeader,
|
|
211
|
+
columnsWithTreeifyExpander,
|
|
212
|
+
columnPinning
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { StatsItem, Pagination, WhereQuery, OrderQuery } from '#v/types';
|
|
3
|
+
export declare function useTableData<T>(props: {
|
|
4
|
+
name: string;
|
|
5
|
+
rowKey: keyof T;
|
|
6
|
+
apiListFn?: (...args: any[]) => any;
|
|
7
|
+
useApiGroup?: (...args: any[]) => any;
|
|
8
|
+
fetchAll?: boolean;
|
|
9
|
+
treeifyColName?: keyof T;
|
|
10
|
+
disableFetchOnMounted?: boolean;
|
|
11
|
+
pagination: Ref<Pagination>;
|
|
12
|
+
pruneWhereQuery: (query: WhereQuery<T> | undefined) => WhereQuery<T> | undefined;
|
|
13
|
+
whereQuery: ComputedRef<WhereQuery<T> | undefined>;
|
|
14
|
+
orderQuery: ComputedRef<OrderQuery<T>>;
|
|
15
|
+
clearRowSelection: () => void;
|
|
16
|
+
}): {
|
|
17
|
+
data: Ref<T[], T[]>;
|
|
18
|
+
treeifyData: ComputedRef<(T & {
|
|
19
|
+
children: T[];
|
|
20
|
+
})[]>;
|
|
21
|
+
stats: Ref<StatsItem[][], StatsItem[][]>;
|
|
22
|
+
total: Ref<number, number>;
|
|
23
|
+
createRow: (model: T) => number;
|
|
24
|
+
updateRow: (model: T) => void;
|
|
25
|
+
deleteRow: (model: T) => void;
|
|
26
|
+
fetching: Ref<boolean, boolean>;
|
|
27
|
+
fetchList: (fromStart?: boolean) => Promise<void>;
|
|
28
|
+
debouncedFetchList: import("@vueuse/core").UseDebounceFnReturn<(fromStart?: boolean) => Promise<void>>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ref, computed, watch, onMounted } from "vue";
|
|
2
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
import { useFetching } from "../useBoolean.js";
|
|
4
|
+
import { treeifyModels } from "#v/utils";
|
|
5
|
+
const defaultPageSize = 10;
|
|
6
|
+
export function useTableData(props) {
|
|
7
|
+
const {
|
|
8
|
+
name,
|
|
9
|
+
rowKey,
|
|
10
|
+
apiListFn,
|
|
11
|
+
useApiGroup,
|
|
12
|
+
fetchAll,
|
|
13
|
+
treeifyColName,
|
|
14
|
+
disableFetchOnMounted,
|
|
15
|
+
pagination,
|
|
16
|
+
pruneWhereQuery,
|
|
17
|
+
whereQuery,
|
|
18
|
+
orderQuery,
|
|
19
|
+
clearRowSelection
|
|
20
|
+
} = props;
|
|
21
|
+
const apiGroup = useApiGroup?.();
|
|
22
|
+
const data = ref([]);
|
|
23
|
+
const stats = ref([]);
|
|
24
|
+
const treeifyData = computed(() => {
|
|
25
|
+
if (!treeifyColName) return [];
|
|
26
|
+
return treeifyModels(data.value, rowKey, treeifyColName, 0);
|
|
27
|
+
});
|
|
28
|
+
const createRow = (model) => data.value.unshift(model);
|
|
29
|
+
const updateRow = (model) => {
|
|
30
|
+
const index = data.value.findIndex((item) => item[rowKey] === model[rowKey]);
|
|
31
|
+
if (index !== -1) {
|
|
32
|
+
data.value[index] = model;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const deleteRow = (model) => {
|
|
36
|
+
const index = data.value.findIndex((item) => item[rowKey] === model[rowKey]);
|
|
37
|
+
if (index !== -1) {
|
|
38
|
+
data.value.splice(index, 1);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const { fetching, startFetching, endFetching } = useFetching();
|
|
42
|
+
const total = ref(0);
|
|
43
|
+
async function fetchList(fromStart = false) {
|
|
44
|
+
if (!apiListFn && !apiGroup?.countAndList) {
|
|
45
|
+
console.warn("No apiListFn or apiGroup.countAndList provided for table:", name);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
startFetching();
|
|
50
|
+
const { data: fetchedData } = await (apiListFn ?? apiGroup?.countAndList)({
|
|
51
|
+
pagination: {
|
|
52
|
+
pageNum: fromStart ? 1 : pagination.value.pageNum ?? 1,
|
|
53
|
+
pageSize: fetchAll ? 0 : pagination.value.pageSize ?? defaultPageSize
|
|
54
|
+
},
|
|
55
|
+
whereQuery: pruneWhereQuery(whereQuery.value),
|
|
56
|
+
orderQuery: orderQuery.value
|
|
57
|
+
});
|
|
58
|
+
if (fetchedData.value?.data) {
|
|
59
|
+
data.value = fetchedData.value.data.list;
|
|
60
|
+
total.value = fetchedData.value.data.total;
|
|
61
|
+
pagination.value.pageNum = fetchedData.value.data.pageNum;
|
|
62
|
+
pagination.value.pageSize = fetchedData.value.data.pageSize;
|
|
63
|
+
stats.value = fetchedData.value.data.stats || [];
|
|
64
|
+
clearRowSelection();
|
|
65
|
+
}
|
|
66
|
+
} finally {
|
|
67
|
+
endFetching();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const debouncedFetchList = useDebounceFn(fetchList, 512);
|
|
71
|
+
watch(
|
|
72
|
+
() => [pagination.value.pageNum, pagination.value.pageSize],
|
|
73
|
+
async () => await fetchList()
|
|
74
|
+
);
|
|
75
|
+
onMounted(async () => {
|
|
76
|
+
if (!disableFetchOnMounted) {
|
|
77
|
+
await fetchList();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
data,
|
|
82
|
+
treeifyData,
|
|
83
|
+
stats,
|
|
84
|
+
total,
|
|
85
|
+
createRow,
|
|
86
|
+
updateRow,
|
|
87
|
+
deleteRow,
|
|
88
|
+
fetching,
|
|
89
|
+
fetchList,
|
|
90
|
+
debouncedFetchList
|
|
91
|
+
};
|
|
92
|
+
}
|