From 814f4211b0d780a55ad0c4a6f802dbc133cbb0d0 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 11 Oct 2022 14:06:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=20vue3=201.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/package.json | 12 ++--- yudao-ui-admin-vue3/src/types/components.d.ts | 52 +++++++++++++++++++ .../src/types/configGlobal.d.ts | 4 ++ .../src/types/contextMenu.d.ts | 7 +++ .../src/types/descriptions.d.ts | 11 ++++ .../src/types/elementPlus.d.ts | 3 ++ yudao-ui-admin-vue3/src/types/form.d.ts | 45 ++++++++++++++++ yudao-ui-admin-vue3/src/types/icon.d.ts | 5 ++ yudao-ui-admin-vue3/src/types/infoTip.d.ts | 4 ++ yudao-ui-admin-vue3/src/types/layout.d.ts | 1 + .../src/types/localeDropdown.d.ts | 10 ++++ yudao-ui-admin-vue3/src/types/qrcode.d.ts | 9 ++++ yudao-ui-admin-vue3/src/types/table.d.ts | 36 +++++++++++++ yudao-ui-admin-vue3/src/types/theme.d.ts | 16 ++++++ 14 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 yudao-ui-admin-vue3/src/types/components.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/configGlobal.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/contextMenu.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/descriptions.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/elementPlus.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/form.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/icon.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/infoTip.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/layout.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/localeDropdown.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/qrcode.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/table.d.ts create mode 100644 yudao-ui-admin-vue3/src/types/theme.d.ts diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json index 6963e8da9..52c0f5311 100644 --- a/yudao-ui-admin-vue3/package.json +++ b/yudao-ui-admin-vue3/package.json @@ -42,7 +42,7 @@ "lodash-es": "^4.17.21", "mitt": "^3.0.0", "nprogress": "^0.2.0", - "pinia": "^2.0.22", + "pinia": "^2.0.23", "qrcode": "^1.5.1", "qs": "^6.11.0", "url": "^0.11.0", @@ -56,17 +56,17 @@ "devDependencies": { "@commitlint/cli": "^17.1.2", "@commitlint/config-conventional": "^17.1.0", - "@iconify/json": "^2.1.119", + "@iconify/json": "^2.1.120", "@intlify/vite-plugin-vue-i18n": "^6.0.3", "@purge-icons/generated": "^0.9.0", "@types/intro.js": "^5.1.0", "@types/lodash-es": "^4.17.6", - "@types/node": "^18.8.3", + "@types/node": "^18.8.4", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.5.0", "@types/qs": "^6.9.7", - "@typescript-eslint/eslint-plugin": "^5.39.0", - "@typescript-eslint/parser": "^5.39.0", + "@typescript-eslint/eslint-plugin": "^5.40.0", + "@typescript-eslint/parser": "^5.40.0", "@vitejs/plugin-vue": "^3.1.2", "@vitejs/plugin-vue-jsx": "^2.0.1", "autoprefixer": "^10.4.12", @@ -92,7 +92,7 @@ "stylelint-order": "^5.0.0", "typescript": "4.8.4", "unplugin-vue-macros": "^0.12.0", - "vite": "3.1.6", + "vite": "3.1.7", "vite-plugin-compression": "^0.5.1", "vite-plugin-eslint": "^1.8.1", "vite-plugin-html": "^3.2.0", diff --git a/yudao-ui-admin-vue3/src/types/components.d.ts b/yudao-ui-admin-vue3/src/types/components.d.ts new file mode 100644 index 000000000..45523f922 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/components.d.ts @@ -0,0 +1,52 @@ +export type ComponentName = + | 'Radio' + | 'RadioButton' + | 'Checkbox' + | 'CheckboxButton' + | 'Input' + | 'Autocomplete' + | 'InputNumber' + | 'Select' + | 'Cascader' + | 'Switch' + | 'Slider' + | 'TimePicker' + | 'DatePicker' + | 'Rate' + | 'ColorPicker' + | 'Transfer' + | 'Divider' + | 'TimeSelect' + | 'SelectV2' + | 'InputPassword' + | 'Editor' + +export type ColProps = { + span?: number + xs?: number + sm?: number + md?: number + lg?: number + xl?: number + tag?: string +} + +export type ComponentOptions = { + label?: string + value?: FormValueType + disabled?: boolean + key?: string | number + children?: ComponentOptions[] + options?: ComponentOptions[] +} & Recordable + +export type ComponentOptionsAlias = { + labelField?: string + valueField?: string +} + +export type ComponentProps = { + optionsAlias?: ComponentOptionsAlias + options?: ComponentOptions[] + optionsSlot?: boolean +} & Recordable diff --git a/yudao-ui-admin-vue3/src/types/configGlobal.d.ts b/yudao-ui-admin-vue3/src/types/configGlobal.d.ts new file mode 100644 index 000000000..f6d7b3c39 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/configGlobal.d.ts @@ -0,0 +1,4 @@ +import { ElementPlusSize } from './elementPlus' +export interface ConfigGlobalTypes { + size?: ElementPlusSize +} diff --git a/yudao-ui-admin-vue3/src/types/contextMenu.d.ts b/yudao-ui-admin-vue3/src/types/contextMenu.d.ts new file mode 100644 index 000000000..0738d0e35 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/contextMenu.d.ts @@ -0,0 +1,7 @@ +export type contextMenuSchema = { + disabled?: boolean + divided?: boolean + icon?: string + label: string + command?: (item: contextMenuSchema) => void +} diff --git a/yudao-ui-admin-vue3/src/types/descriptions.d.ts b/yudao-ui-admin-vue3/src/types/descriptions.d.ts new file mode 100644 index 000000000..6fb99b047 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/descriptions.d.ts @@ -0,0 +1,11 @@ +export interface DescriptionsSchema { + span?: number // 占多少分 + field: string // 字段名 + label?: string // label名 + width?: string | number + minWidth?: string | number + align?: 'left' | 'center' | 'right' + labelAlign?: 'left' | 'center' | 'right' + className?: string + labelClassName?: string +} diff --git a/yudao-ui-admin-vue3/src/types/elementPlus.d.ts b/yudao-ui-admin-vue3/src/types/elementPlus.d.ts new file mode 100644 index 000000000..2c6b76e77 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/elementPlus.d.ts @@ -0,0 +1,3 @@ +export type ElementPlusSize = 'default' | 'small' | 'large' + +export type ElementPlusInfoType = 'success' | 'info' | 'warning' | 'danger' diff --git a/yudao-ui-admin-vue3/src/types/form.d.ts b/yudao-ui-admin-vue3/src/types/form.d.ts new file mode 100644 index 000000000..8673ec7d5 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/form.d.ts @@ -0,0 +1,45 @@ +import type { CSSProperties } from 'vue' +import { ColProps, ComponentProps, ComponentName } from '@/types/components' +import { FormValueType, FormValueType } from '@/types/form' +import type { AxiosPromise } from 'axios' + +export type FormSetPropsType = { + field: string + path: string + value: any +} + +export type FormValueType = string | number | string[] | number[] | boolean | undefined | null + +export type FormItemProps = { + labelWidth?: string | number + required?: boolean + rules?: Recordable + error?: string + showMessage?: boolean + inlineMessage?: boolean + style?: CSSProperties +} + +export type FormSchema = { + // 唯一值 + field: string + // 标题 + label?: string + // 提示 + labelMessage?: string + // col组件属性 + colProps?: ColProps + // 表单组件属性,slots对应的是表单组件的插槽,规则:${field}-xxx,具体可以查看element-plus文档 + componentProps?: { slots?: Recordable } & ComponentProps + // formItem组件属性 + formItemProps?: FormItemProps + // 渲染的组件 + component?: ComponentName + // 初始值 + value?: FormValueType + // 是否隐藏 + hidden?: boolean + // 远程加载下拉项 + api?: () => AxiosPromise +} diff --git a/yudao-ui-admin-vue3/src/types/icon.d.ts b/yudao-ui-admin-vue3/src/types/icon.d.ts new file mode 100644 index 000000000..d1ffcdb50 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/icon.d.ts @@ -0,0 +1,5 @@ +export interface IconTypes { + size?: number + color?: string + icon: string +} diff --git a/yudao-ui-admin-vue3/src/types/infoTip.d.ts b/yudao-ui-admin-vue3/src/types/infoTip.d.ts new file mode 100644 index 000000000..6eff083dc --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/infoTip.d.ts @@ -0,0 +1,4 @@ +export interface TipSchema { + label: string + keys?: string[] +} diff --git a/yudao-ui-admin-vue3/src/types/layout.d.ts b/yudao-ui-admin-vue3/src/types/layout.d.ts new file mode 100644 index 000000000..cad3e2af0 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/layout.d.ts @@ -0,0 +1 @@ +export type LayoutType = 'classic' | 'topLeft' | 'top' | 'cutMenu' diff --git a/yudao-ui-admin-vue3/src/types/localeDropdown.d.ts b/yudao-ui-admin-vue3/src/types/localeDropdown.d.ts new file mode 100644 index 000000000..c749dce72 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/localeDropdown.d.ts @@ -0,0 +1,10 @@ +export interface Language { + el: Recordable + name: string +} + +export interface LocaleDropdownType { + lang: LocaleType + name?: string + elLocale?: Language +} diff --git a/yudao-ui-admin-vue3/src/types/qrcode.d.ts b/yudao-ui-admin-vue3/src/types/qrcode.d.ts new file mode 100644 index 000000000..86cdf0b96 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/qrcode.d.ts @@ -0,0 +1,9 @@ +export interface QrcodeLogo { + src?: string + logoSize?: number + bgColor?: string + borderSize?: number + crossOrigin?: string + borderRadius?: number + logoRadius?: number +} diff --git a/yudao-ui-admin-vue3/src/types/table.d.ts b/yudao-ui-admin-vue3/src/types/table.d.ts new file mode 100644 index 000000000..5adf91f47 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/table.d.ts @@ -0,0 +1,36 @@ +export type TableColumn = { + field: string + label?: string + children?: TableColumn[] +} & Recordable + +export type TableSlotDefault = { + row: Recordable + column: TableColumn + $index: number +} & Recordable + +export interface Pagination { + small?: boolean + background?: boolean + pageSize?: number + defaultPageSize?: number + total?: number + pageCount?: number + pagerCount?: number + currentPage?: number + defaultCurrentPage?: number + layout?: string + pageSizes?: number[] + popperClass?: string + prevText?: string + nextText?: string + disabled?: boolean + hideOnSinglePage?: boolean +} + +export interface TableSetPropsType { + field: string + path: string + value: any +} diff --git a/yudao-ui-admin-vue3/src/types/theme.d.ts b/yudao-ui-admin-vue3/src/types/theme.d.ts new file mode 100644 index 000000000..ad649b027 --- /dev/null +++ b/yudao-ui-admin-vue3/src/types/theme.d.ts @@ -0,0 +1,16 @@ +export type ThemeTypes = { + elColorPrimary?: string + leftMenuBorderColor?: string + leftMenuBgColor?: string + leftMenuBgLightColor?: string + leftMenuBgActiveColor?: string + leftMenuCollapseBgActiveColor?: string + leftMenuTextColor?: string + leftMenuTextActiveColor?: string + logoTitleTextColor?: string + logoBorderColor?: string + topHeaderBgColor?: string + topHeaderTextColor?: string + topHeaderHoverColor?: string + topToolBorderColor?: string +}