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,255 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, watch, onUnmounted } from "vue";
|
|
3
|
+
import { useColorMode } from "#imports";
|
|
4
|
+
import { format } from "sql-formatter";
|
|
5
|
+
const value = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
tables: { type: Array, required: false, default: () => [] },
|
|
8
|
+
columns: { type: Object, required: false, default: () => ({}) }
|
|
9
|
+
});
|
|
10
|
+
const colorMode = useColorMode();
|
|
11
|
+
let editor = null;
|
|
12
|
+
let monaco = null;
|
|
13
|
+
let completionProvider = null;
|
|
14
|
+
const getTheme = () => {
|
|
15
|
+
return colorMode.value === "dark" ? "vs-dark" : "vs";
|
|
16
|
+
};
|
|
17
|
+
const formatSQL = () => {
|
|
18
|
+
if (editor) {
|
|
19
|
+
const currentValue = editor.getValue();
|
|
20
|
+
const formatted = format(currentValue, { language: "postgresql" });
|
|
21
|
+
editor.setValue(formatted);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getValue = () => {
|
|
25
|
+
return editor?.getValue() || "";
|
|
26
|
+
};
|
|
27
|
+
const setValue = (newValue) => {
|
|
28
|
+
if (editor) {
|
|
29
|
+
editor.setValue(newValue);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
onMounted(async () => {
|
|
33
|
+
monaco = await import("monaco-editor");
|
|
34
|
+
completionProvider = monaco.languages.registerCompletionItemProvider("sql", {
|
|
35
|
+
triggerCharacters: [" ", ",", ".", "(", "\n"],
|
|
36
|
+
provideCompletionItems: (model, position) => {
|
|
37
|
+
const suggestions = [];
|
|
38
|
+
const wordInfo = model.getWordUntilPosition(position);
|
|
39
|
+
const range = {
|
|
40
|
+
startLineNumber: position.lineNumber,
|
|
41
|
+
endLineNumber: position.lineNumber,
|
|
42
|
+
startColumn: wordInfo.startColumn,
|
|
43
|
+
endColumn: wordInfo.endColumn
|
|
44
|
+
};
|
|
45
|
+
const textBeforeCursor = model.getValueInRange({
|
|
46
|
+
startLineNumber: 1,
|
|
47
|
+
startColumn: 1,
|
|
48
|
+
endLineNumber: position.lineNumber,
|
|
49
|
+
endColumn: position.column
|
|
50
|
+
});
|
|
51
|
+
const textBeforeCursorUpper = textBeforeCursor.toUpperCase();
|
|
52
|
+
const currentLine = model.getLineContent(position.lineNumber).toUpperCase();
|
|
53
|
+
const isAfterFrom = /\bFROM\s+\w*$/i.test(textBeforeCursorUpper) || /\bJOIN\s+\w*$/i.test(textBeforeCursorUpper);
|
|
54
|
+
const isAfterSelect = /\bSELECT\s+(?:\w+\s*,\s*)*\w*$/i.test(textBeforeCursorUpper) || /,\s*\w*$/i.test(currentLine);
|
|
55
|
+
const isAfterWhere = /\bWHERE\s+(?:.*?\s+)?(?:AND|OR)?\s*\w*$/i.test(textBeforeCursorUpper);
|
|
56
|
+
const declaredTables = [];
|
|
57
|
+
const fromMatches = textBeforeCursor.matchAll(/\b(?:FROM|JOIN)\s+(\w+)/gi);
|
|
58
|
+
for (const match of fromMatches) {
|
|
59
|
+
const tableName = match[1];
|
|
60
|
+
const foundTable = props.tables.find((t) => t.toLowerCase() === tableName.toLowerCase());
|
|
61
|
+
if (foundTable) {
|
|
62
|
+
declaredTables.push(foundTable);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const commonKeywords = [
|
|
66
|
+
"SELECT",
|
|
67
|
+
"FROM",
|
|
68
|
+
"WHERE",
|
|
69
|
+
"JOIN",
|
|
70
|
+
"INNER JOIN",
|
|
71
|
+
"LEFT JOIN",
|
|
72
|
+
"RIGHT JOIN",
|
|
73
|
+
"AND",
|
|
74
|
+
"OR",
|
|
75
|
+
"ORDER BY",
|
|
76
|
+
"GROUP BY",
|
|
77
|
+
"LIMIT",
|
|
78
|
+
"AS",
|
|
79
|
+
"ON"
|
|
80
|
+
];
|
|
81
|
+
const otherKeywords = [
|
|
82
|
+
"FULL JOIN",
|
|
83
|
+
"NOT",
|
|
84
|
+
"IN",
|
|
85
|
+
"LIKE",
|
|
86
|
+
"BETWEEN",
|
|
87
|
+
"IS",
|
|
88
|
+
"NULL",
|
|
89
|
+
"HAVING",
|
|
90
|
+
"ASC",
|
|
91
|
+
"DESC",
|
|
92
|
+
"OFFSET",
|
|
93
|
+
"DISTINCT",
|
|
94
|
+
"INSERT INTO",
|
|
95
|
+
"VALUES",
|
|
96
|
+
"UPDATE",
|
|
97
|
+
"SET",
|
|
98
|
+
"DELETE FROM",
|
|
99
|
+
"CREATE TABLE",
|
|
100
|
+
"DROP TABLE",
|
|
101
|
+
"ALTER TABLE",
|
|
102
|
+
"COUNT",
|
|
103
|
+
"SUM",
|
|
104
|
+
"AVG",
|
|
105
|
+
"MAX",
|
|
106
|
+
"MIN",
|
|
107
|
+
"UNION",
|
|
108
|
+
"UNION ALL",
|
|
109
|
+
"EXISTS",
|
|
110
|
+
"CASE",
|
|
111
|
+
"WHEN",
|
|
112
|
+
"THEN",
|
|
113
|
+
"ELSE",
|
|
114
|
+
"END"
|
|
115
|
+
];
|
|
116
|
+
if (isAfterFrom) {
|
|
117
|
+
props.tables.forEach((table) => {
|
|
118
|
+
suggestions.push({
|
|
119
|
+
label: table,
|
|
120
|
+
kind: monaco.languages.CompletionItemKind.Class,
|
|
121
|
+
insertText: table,
|
|
122
|
+
detail: "\u8868\u540D",
|
|
123
|
+
sortText: "0_" + table,
|
|
124
|
+
// 使用 0_ 前缀确保排在最前
|
|
125
|
+
range
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
} else if (isAfterSelect || isAfterWhere) {
|
|
129
|
+
if (declaredTables.length > 0) {
|
|
130
|
+
declaredTables.forEach((tableName) => {
|
|
131
|
+
const fields = props.columns[tableName] || [];
|
|
132
|
+
fields.forEach((field) => {
|
|
133
|
+
suggestions.push({
|
|
134
|
+
label: field,
|
|
135
|
+
kind: monaco.languages.CompletionItemKind.Field,
|
|
136
|
+
insertText: field,
|
|
137
|
+
detail: `${tableName} \u5B57\u6BB5`,
|
|
138
|
+
sortText: "0_" + field,
|
|
139
|
+
range
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
Object.entries(props.columns).forEach(([tableName, fields]) => {
|
|
145
|
+
fields.forEach((field) => {
|
|
146
|
+
suggestions.push({
|
|
147
|
+
label: field,
|
|
148
|
+
kind: monaco.languages.CompletionItemKind.Field,
|
|
149
|
+
insertText: field,
|
|
150
|
+
detail: `${tableName} \u5B57\u6BB5`,
|
|
151
|
+
sortText: "0_" + field,
|
|
152
|
+
range
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
commonKeywords.forEach((keyword) => {
|
|
159
|
+
suggestions.push({
|
|
160
|
+
label: keyword,
|
|
161
|
+
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
162
|
+
insertText: keyword,
|
|
163
|
+
detail: "SQL \u5173\u952E\u5B57",
|
|
164
|
+
sortText: "1_" + keyword,
|
|
165
|
+
range
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
otherKeywords.forEach((keyword) => {
|
|
169
|
+
suggestions.push({
|
|
170
|
+
label: keyword,
|
|
171
|
+
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
172
|
+
insertText: keyword,
|
|
173
|
+
detail: "SQL \u5173\u952E\u5B57",
|
|
174
|
+
sortText: "2_" + keyword,
|
|
175
|
+
range
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
props.tables.forEach((table) => {
|
|
179
|
+
suggestions.push({
|
|
180
|
+
label: table,
|
|
181
|
+
kind: monaco.languages.CompletionItemKind.Class,
|
|
182
|
+
insertText: table,
|
|
183
|
+
detail: "\u8868\u540D",
|
|
184
|
+
sortText: "3_" + table,
|
|
185
|
+
range
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
Object.entries(props.columns).forEach(([tableName, fields]) => {
|
|
189
|
+
fields.forEach((field) => {
|
|
190
|
+
suggestions.push({
|
|
191
|
+
label: field,
|
|
192
|
+
kind: monaco.languages.CompletionItemKind.Field,
|
|
193
|
+
insertText: field,
|
|
194
|
+
detail: `${tableName} \u5B57\u6BB5`,
|
|
195
|
+
sortText: "4_" + field,
|
|
196
|
+
range
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return { suggestions };
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
const container = document.getElementById("editor");
|
|
205
|
+
if (container) {
|
|
206
|
+
editor = monaco.editor.create(container, {
|
|
207
|
+
value: value.value,
|
|
208
|
+
language: "sql",
|
|
209
|
+
theme: getTheme(),
|
|
210
|
+
automaticLayout: true,
|
|
211
|
+
fontSize: 14,
|
|
212
|
+
minimap: { enabled: false },
|
|
213
|
+
scrollBeyondLastLine: false,
|
|
214
|
+
wordWrap: "on",
|
|
215
|
+
tabSize: 2,
|
|
216
|
+
lineNumbers: "on",
|
|
217
|
+
glyphMargin: false,
|
|
218
|
+
folding: false,
|
|
219
|
+
lineNumbersMinChars: 3,
|
|
220
|
+
overviewRulerBorder: false,
|
|
221
|
+
hideCursorInOverviewRuler: true,
|
|
222
|
+
scrollbar: {
|
|
223
|
+
horizontal: "auto",
|
|
224
|
+
vertical: "auto"
|
|
225
|
+
},
|
|
226
|
+
autoClosingBrackets: "always",
|
|
227
|
+
autoClosingOvertype: "always",
|
|
228
|
+
autoClosingQuotes: "always"
|
|
229
|
+
});
|
|
230
|
+
editor.onDidChangeModelContent(() => {
|
|
231
|
+
if (editor) {
|
|
232
|
+
value.value = editor.getValue();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
watch(() => colorMode.value, () => {
|
|
238
|
+
if (editor) {
|
|
239
|
+
monaco.editor.setTheme(getTheme());
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
onUnmounted(() => {
|
|
243
|
+
editor?.dispose();
|
|
244
|
+
completionProvider?.dispose();
|
|
245
|
+
});
|
|
246
|
+
defineExpose({
|
|
247
|
+
formatSQL,
|
|
248
|
+
getValue,
|
|
249
|
+
setValue
|
|
250
|
+
});
|
|
251
|
+
</script>
|
|
252
|
+
|
|
253
|
+
<template>
|
|
254
|
+
<div id="editor" class="h-100" />
|
|
255
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
tables?: string[];
|
|
3
|
+
columns?: Record<string, string[]>;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = Props;
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
'modelValue': string | null | undefined;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
|
+
formatSQL: () => void;
|
|
12
|
+
getValue: () => any;
|
|
13
|
+
setValue: (newValue: string) => void;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:modelValue": (value: string | null | undefined) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
tables: string[];
|
|
20
|
+
columns: Record<string, string[]>;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
text?: string | string[];
|
|
3
|
+
fontSize?: number;
|
|
4
|
+
fontWeight?: string | number;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontColor?: string;
|
|
7
|
+
lineHeight?: number;
|
|
8
|
+
rotate?: number;
|
|
9
|
+
gap?: number;
|
|
10
|
+
opacity?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
14
|
+
xOffset?: number;
|
|
15
|
+
yOffset?: number;
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
}
|
|
18
|
+
declare var __VLS_1: {};
|
|
19
|
+
type __VLS_Slots = {} & {
|
|
20
|
+
default?: (props: typeof __VLS_1) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
text: string | string[];
|
|
25
|
+
fontSize: number;
|
|
26
|
+
fontWeight: string | number;
|
|
27
|
+
fontColor: string;
|
|
28
|
+
lineHeight: number;
|
|
29
|
+
rotate: number;
|
|
30
|
+
gap: number;
|
|
31
|
+
opacity: number;
|
|
32
|
+
debug: boolean;
|
|
33
|
+
textAlign: "left" | "center" | "right";
|
|
34
|
+
xOffset: number;
|
|
35
|
+
yOffset: number;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useColorMode } from "@vueuse/core";
|
|
3
|
+
import { ref, onMounted, watch } from "vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
text: { type: [String, Array], required: false, default: "Watermark" },
|
|
6
|
+
fontSize: { type: Number, required: false, default: 13 },
|
|
7
|
+
fontWeight: { type: [String, Number], required: false, default: 300 },
|
|
8
|
+
fontFamily: { type: String, required: false },
|
|
9
|
+
fontColor: { type: String, required: false, default: "text-neutral-200 dark:text-neutral-700" },
|
|
10
|
+
lineHeight: { type: Number, required: false, default: 16 },
|
|
11
|
+
rotate: { type: Number, required: false, default: -16 },
|
|
12
|
+
gap: { type: Number, required: false, default: 128 },
|
|
13
|
+
opacity: { type: Number, required: false, default: 0.6 },
|
|
14
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
15
|
+
debug: { type: Boolean, required: false, default: false },
|
|
16
|
+
textAlign: { type: String, required: false, default: "center" },
|
|
17
|
+
xOffset: { type: Number, required: false, default: 0 },
|
|
18
|
+
yOffset: { type: Number, required: false, default: 0 },
|
|
19
|
+
zIndex: { type: Number, required: false }
|
|
20
|
+
});
|
|
21
|
+
const watermarkStyle = ref("");
|
|
22
|
+
const canvas = import.meta.client ? document.createElement("canvas") : null;
|
|
23
|
+
const ctx = canvas ? canvas.getContext("2d") : null;
|
|
24
|
+
function getRatio(context) {
|
|
25
|
+
if (!context) return 1;
|
|
26
|
+
const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1;
|
|
27
|
+
return (window.devicePixelRatio || 1) / backingStore;
|
|
28
|
+
}
|
|
29
|
+
const getTailwindColor = (className) => {
|
|
30
|
+
if (!import.meta.client) return props.fontColor;
|
|
31
|
+
const tempElement = document.createElement("div");
|
|
32
|
+
tempElement.className = className;
|
|
33
|
+
tempElement.style.position = "absolute";
|
|
34
|
+
tempElement.style.visibility = "hidden";
|
|
35
|
+
document.body.appendChild(tempElement);
|
|
36
|
+
const computedColor = getComputedStyle(tempElement).color;
|
|
37
|
+
document.body.removeChild(tempElement);
|
|
38
|
+
return computedColor;
|
|
39
|
+
};
|
|
40
|
+
const fontsReady = ref(false);
|
|
41
|
+
onMounted(async () => {
|
|
42
|
+
if (import.meta.client && "fonts" in document) {
|
|
43
|
+
try {
|
|
44
|
+
await document.fonts.ready;
|
|
45
|
+
fontsReady.value = true;
|
|
46
|
+
} catch {
|
|
47
|
+
fontsReady.value = true;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
fontsReady.value = true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const generateWatermark = () => {
|
|
54
|
+
if (props.disabled || !props.text || !canvas || !ctx || !fontsReady.value) {
|
|
55
|
+
watermarkStyle.value = "";
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const ratio = getRatio(ctx);
|
|
59
|
+
let color = props.fontColor;
|
|
60
|
+
if (color.startsWith("text-") || color.includes("dark:")) {
|
|
61
|
+
color = getTailwindColor(color);
|
|
62
|
+
}
|
|
63
|
+
const fontSize = props.fontSize * ratio;
|
|
64
|
+
const lineHeight = props.lineHeight * ratio;
|
|
65
|
+
ctx.font = `${props.fontWeight} ${fontSize}px ${props.fontFamily}`;
|
|
66
|
+
const texts = Array.isArray(props.text) ? props.text : [props.text];
|
|
67
|
+
let maxWidth = 0;
|
|
68
|
+
const textLines = texts.map((line) => {
|
|
69
|
+
const width = ctx.measureText(line).width;
|
|
70
|
+
maxWidth = Math.max(maxWidth, width);
|
|
71
|
+
return { line, width };
|
|
72
|
+
});
|
|
73
|
+
const textHeight = texts.length * lineHeight;
|
|
74
|
+
const rad = props.rotate * Math.PI / 180;
|
|
75
|
+
const cos = Math.abs(Math.cos(rad));
|
|
76
|
+
const sin = Math.abs(Math.sin(rad));
|
|
77
|
+
const rotatedWidth = maxWidth * cos + textHeight * sin;
|
|
78
|
+
const rotatedHeight = maxWidth * sin + textHeight * cos;
|
|
79
|
+
const canvasWidth = Math.ceil(rotatedWidth + props.gap * ratio);
|
|
80
|
+
const canvasHeight = Math.ceil(rotatedHeight + props.gap * ratio);
|
|
81
|
+
canvas.width = canvasWidth;
|
|
82
|
+
canvas.height = canvasHeight;
|
|
83
|
+
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
|
84
|
+
ctx.imageSmoothingEnabled = true;
|
|
85
|
+
ctx.font = `${props.fontWeight} ${fontSize}px ${props.fontFamily}`;
|
|
86
|
+
ctx.fillStyle = color;
|
|
87
|
+
ctx.textBaseline = "top";
|
|
88
|
+
ctx.translate(canvasWidth / 2, canvasHeight / 2);
|
|
89
|
+
ctx.rotate(rad);
|
|
90
|
+
if (props.debug) {
|
|
91
|
+
ctx.strokeStyle = "red";
|
|
92
|
+
ctx.strokeRect(-maxWidth / 2, -textHeight / 2, maxWidth, textHeight);
|
|
93
|
+
}
|
|
94
|
+
textLines.forEach(({ line, width }, index) => {
|
|
95
|
+
let alignOffset = 0;
|
|
96
|
+
switch (props.textAlign) {
|
|
97
|
+
case "left":
|
|
98
|
+
alignOffset = -maxWidth / 2;
|
|
99
|
+
break;
|
|
100
|
+
case "center":
|
|
101
|
+
alignOffset = -width / 2;
|
|
102
|
+
break;
|
|
103
|
+
case "right":
|
|
104
|
+
alignOffset = maxWidth / 2 - width;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
const x = alignOffset + props.xOffset * ratio;
|
|
108
|
+
const y = -textHeight / 2 + index * lineHeight + props.yOffset * ratio;
|
|
109
|
+
ctx.fillText(line, x, y);
|
|
110
|
+
});
|
|
111
|
+
const dataURL = canvas.toDataURL("image/png");
|
|
112
|
+
const styleWidth = canvasWidth / ratio;
|
|
113
|
+
const styleHeight = canvasHeight / ratio;
|
|
114
|
+
watermarkStyle.value = `
|
|
115
|
+
background-image: url(${dataURL});
|
|
116
|
+
background-repeat: repeat;
|
|
117
|
+
background-size: ${styleWidth}px ${styleHeight}px;
|
|
118
|
+
`;
|
|
119
|
+
};
|
|
120
|
+
watch(
|
|
121
|
+
() => [
|
|
122
|
+
props.text,
|
|
123
|
+
props.fontSize,
|
|
124
|
+
props.fontWeight,
|
|
125
|
+
props.fontFamily,
|
|
126
|
+
props.fontColor,
|
|
127
|
+
props.lineHeight,
|
|
128
|
+
props.rotate,
|
|
129
|
+
props.gap,
|
|
130
|
+
props.disabled,
|
|
131
|
+
props.textAlign,
|
|
132
|
+
props.xOffset,
|
|
133
|
+
props.yOffset,
|
|
134
|
+
fontsReady.value
|
|
135
|
+
],
|
|
136
|
+
generateWatermark,
|
|
137
|
+
{ immediate: true, deep: true }
|
|
138
|
+
);
|
|
139
|
+
const colorMode = useColorMode();
|
|
140
|
+
watch(() => colorMode.value, generateWatermark);
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
generateWatermark();
|
|
143
|
+
});
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<div class="relative flex overflow-hidden size-full">
|
|
148
|
+
<!-- 水印层 -->
|
|
149
|
+
<div
|
|
150
|
+
v-if="!disabled && watermarkStyle"
|
|
151
|
+
class="absolute inset-0 pointer-events-none select-none"
|
|
152
|
+
:style="`
|
|
153
|
+
${watermarkStyle}
|
|
154
|
+
opacity: ${opacity};
|
|
155
|
+
z-index: ${zIndex ?? 0};
|
|
156
|
+
`"
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
<!-- 内容 -->
|
|
160
|
+
<slot />
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
text?: string | string[];
|
|
3
|
+
fontSize?: number;
|
|
4
|
+
fontWeight?: string | number;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontColor?: string;
|
|
7
|
+
lineHeight?: number;
|
|
8
|
+
rotate?: number;
|
|
9
|
+
gap?: number;
|
|
10
|
+
opacity?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
14
|
+
xOffset?: number;
|
|
15
|
+
yOffset?: number;
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
}
|
|
18
|
+
declare var __VLS_1: {};
|
|
19
|
+
type __VLS_Slots = {} & {
|
|
20
|
+
default?: (props: typeof __VLS_1) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
text: string | string[];
|
|
25
|
+
fontSize: number;
|
|
26
|
+
fontWeight: string | number;
|
|
27
|
+
fontColor: string;
|
|
28
|
+
lineHeight: number;
|
|
29
|
+
rotate: number;
|
|
30
|
+
gap: number;
|
|
31
|
+
opacity: number;
|
|
32
|
+
debug: boolean;
|
|
33
|
+
textAlign: "left" | "center" | "right";
|
|
34
|
+
xOffset: number;
|
|
35
|
+
yOffset: number;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
data: string | Record<string, any> | undefined | null;
|
|
3
|
+
lang?: 'json' | 'sql' | 'text';
|
|
4
|
+
title?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
title: string;
|
|
8
|
+
lang: "json" | "sql" | "text";
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch } from "vue";
|
|
3
|
+
import { useClipboard, useColorMode } from "@vueuse/core";
|
|
4
|
+
import { codeToHtml } from "shiki";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
data: { type: null, required: true },
|
|
7
|
+
lang: { type: String, required: false, default: "text" },
|
|
8
|
+
title: { type: String, required: false, default: "\u67E5\u770B" }
|
|
9
|
+
});
|
|
10
|
+
const open = ref(false);
|
|
11
|
+
const colorMode = useColorMode();
|
|
12
|
+
const { copy, copied } = useClipboard();
|
|
13
|
+
const codeText = computed(() => {
|
|
14
|
+
if (props.data == null) return "";
|
|
15
|
+
if (typeof props.data === "string") return props.data;
|
|
16
|
+
return JSON.stringify(props.data, null, 2);
|
|
17
|
+
});
|
|
18
|
+
const highlightedHtml = ref("");
|
|
19
|
+
const updateHighlight = async () => {
|
|
20
|
+
const text = codeText.value;
|
|
21
|
+
if (!text) {
|
|
22
|
+
highlightedHtml.value = "";
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (props.lang === "text") {
|
|
26
|
+
highlightedHtml.value = "";
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
highlightedHtml.value = await codeToHtml(text, {
|
|
31
|
+
lang: props.lang,
|
|
32
|
+
theme: colorMode.value === "dark" ? "github-dark" : "github-light"
|
|
33
|
+
});
|
|
34
|
+
} catch {
|
|
35
|
+
highlightedHtml.value = "";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
watch([codeText, () => colorMode.value], updateHighlight, { immediate: true });
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<UModal v-model:open="open" :title="title">
|
|
43
|
+
<UBadge
|
|
44
|
+
icon="i-lucide-expand"
|
|
45
|
+
color="neutral"
|
|
46
|
+
variant="subtle"
|
|
47
|
+
label="查看"
|
|
48
|
+
class="cursor-pointer"
|
|
49
|
+
@click="open = true"
|
|
50
|
+
/>
|
|
51
|
+
<template #body>
|
|
52
|
+
<div class="overflow-hidden text-sm">
|
|
53
|
+
<template v-if="highlightedHtml">
|
|
54
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
55
|
+
<div class="overflow-auto" v-html="highlightedHtml" />
|
|
56
|
+
</template>
|
|
57
|
+
<pre v-else class="whitespace-pre-wrap">{{ codeText }}</pre>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<template #footer="{ close }">
|
|
61
|
+
<UButton
|
|
62
|
+
icon="i-lucide-x"
|
|
63
|
+
label="关闭"
|
|
64
|
+
color="neutral"
|
|
65
|
+
variant="outline"
|
|
66
|
+
@click="close"
|
|
67
|
+
/>
|
|
68
|
+
<UButton
|
|
69
|
+
:icon="copied ? 'i-lucide-copy-check' : 'i-lucide-copy'"
|
|
70
|
+
label="复制"
|
|
71
|
+
color="neutral"
|
|
72
|
+
variant="outline"
|
|
73
|
+
@click="copy(codeText)"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
</UModal>
|
|
77
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
data: string | Record<string, any> | undefined | null;
|
|
3
|
+
lang?: 'json' | 'sql' | 'text';
|
|
4
|
+
title?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
title: string;
|
|
8
|
+
lang: "json" | "sql" | "text";
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
data: string | Record<string, any> | undefined | null;
|
|
3
|
+
lang?: 'json' | 'sql' | 'text';
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
lang: "json" | "sql" | "text";
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|