From 8fd663e0e5cfe07f9f75b65cb1af72a20c1fb04f Mon Sep 17 00:00:00 2001 From: Ah jung <735878602@qq.com> Date: Thu, 15 Jul 2021 15:18:00 +0800 Subject: [PATCH] =?UTF-8?q?readme=E6=9B=B4=E6=96=B0=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .browserslistrc | 3 - .editorconfig | 19 ----- .prettierrc.js | 20 ------ .yarnrc | 8 --- LICENSE | 2 +- README.md | 1 + src/hooks/setting/useDesignSetting.ts | 2 +- src/hooks/setting/useProjectSetting.ts | 2 +- types/config.d.ts | 20 +++--- types/global.d.ts | 97 ++++++++++++++++++++++++++ types/index.d.ts | 22 ++++++ types/modules.d.ts | 13 ++-- types/schema.d.ts | 59 ---------------- types/shims/shims-app.d.ts | 67 ------------------ types/shims/shims-tsx.d.ts | 18 ----- types/shims/shims-vue.d.ts | 24 ------- types/tableColumn.d.ts | 27 ------- types/vuex.d.ts | 14 ---- vite.config.ts | 4 ++ 19 files changed, 143 insertions(+), 279 deletions(-) delete mode 100644 .browserslistrc delete mode 100644 .editorconfig delete mode 100644 .prettierrc.js delete mode 100644 .yarnrc create mode 100644 types/global.d.ts create mode 100644 types/index.d.ts delete mode 100644 types/schema.d.ts delete mode 100644 types/shims/shims-app.d.ts delete mode 100644 types/shims/shims-tsx.d.ts delete mode 100644 types/shims/shims-vue.d.ts delete mode 100644 types/tableColumn.d.ts delete mode 100644 types/vuex.d.ts diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 214388f..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,3 +0,0 @@ -> 1% -last 2 versions -not dead diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dccf841..0000000 --- a/.editorconfig +++ /dev/null @@ -1,19 +0,0 @@ -root = true - -[*] -charset=utf-8 -end_of_line=lf -insert_final_newline=true -indent_style=space -indent_size=2 -max_line_length = 100 - -[*.{yml,yaml,json}] -indent_style = space -indent_size = 2 - -[*.md] -trim_trailing_whitespace = false - -[Makefile] -indent_style = tab diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 0c20bc9..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - printWidth: 100, - tabWidth: 2, - useTabs: false, - semi: true, - vueIndentScriptAndStyle: true, - singleQuote: true, - quoteProps: 'as-needed', - bracketSpacing: true, - trailingComma: 'es5', - jsxBracketSameLine: false, - jsxSingleQuote: false, - arrowParens: 'always', - insertPragma: false, - requirePragma: false, - proseWrap: 'never', - htmlWhitespaceSensitivity: 'strict', - endOfLine: 'lf', - rangeStart: 0, -}; diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index d82a8f2..0000000 --- a/.yarnrc +++ /dev/null @@ -1,8 +0,0 @@ -registry "https://registry.npm.taobao.org" - -sass_binary_site "https://npm.taobao.org/mirrors/node-sass/" -phantomjs_cdnurl "http://cnpmjs.org/downloads" -electron_mirror "https://npm.taobao.org/mirrors/electron/" -sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/" -profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/" -chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver" diff --git a/LICENSE b/LICENSE index 0c4a714..d012d2a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 bqy +Copyright (c) 2021-present Naive Ui Admin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index be70a90..fd36120 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Naive Ui Admin 是一个免费开源的中后台模版,使用了最新的`vue3 - [x] 主控台 - [ ] 监控页 - [x] 工作台 +- [x] 表单页面 ### 页面组件 #### ProTable diff --git a/src/hooks/setting/useDesignSetting.ts b/src/hooks/setting/useDesignSetting.ts index f521c94..5bd487c 100644 --- a/src/hooks/setting/useDesignSetting.ts +++ b/src/hooks/setting/useDesignSetting.ts @@ -1,4 +1,4 @@ -import { computed, unref, ref } from 'vue'; +import { computed } from 'vue'; import { useDesignSettingStore } from '@/store/modules/designSetting'; export function useDesignSetting() { diff --git a/src/hooks/setting/useProjectSetting.ts b/src/hooks/setting/useProjectSetting.ts index 502aa1f..f834859 100644 --- a/src/hooks/setting/useProjectSetting.ts +++ b/src/hooks/setting/useProjectSetting.ts @@ -1,4 +1,4 @@ -import { computed, unref, ref } from 'vue'; +import { computed } from 'vue'; import { useProjectSettingStore } from '@/store/modules/projectSetting'; export function useProjectSetting() { diff --git a/types/config.d.ts b/types/config.d.ts index 3e15adc..0e4f347 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -1,12 +1,10 @@ -export interface GlobConfig { - // Site title - title: string; - // Service interface url - apiUrl: string; - // Upload url - uploadUrl?: string; - // Service interface url prefix - urlPrefix?: string; - // Project abbreviation - shortName: string; +export interface ProjectSettingState { + navMode: string,//导航模式 + navTheme: string,//导航风格 + headerSetting: object,//顶部设置 + showFooter: boolean, //页脚 + menuSetting: object, //多标签 + multiTabsSetting: object,//多标签 + crumbsSetting: object,//面包屑 + permissionMode: string//权限模式 } diff --git a/types/global.d.ts b/types/global.d.ts new file mode 100644 index 0000000..cc8a098 --- /dev/null +++ b/types/global.d.ts @@ -0,0 +1,97 @@ +import type { + ComponentRenderProxy, + VNode, + VNodeChild, + ComponentPublicInstance, + FunctionalComponent, + PropType as VuePropType, +} from 'vue'; + +declare global { + const __APP_INFO__: { + pkg: { + name: string; + version: string; + dependencies: Recordable; + devDependencies: Recordable; + }; + lastBuildTime: string; + }; + // declare interface Window { + // // Global vue app instance + // __APP__: App; + // } + + // vue + declare type PropType = VuePropType; + declare type VueNode = VNodeChild | JSX.Element; + + export type Writable = { + -readonly [P in keyof T]: T[P]; + }; + + declare type Nullable = T | null; + declare type NonNullable = T extends null | undefined ? never : T; + declare type Recordable = Record; + declare type ReadonlyRecordable = { + readonly [key: string]: T; + }; + declare type Indexable = { + [key: string]: T; + }; + declare type DeepPartial = { + [P in keyof T]?: DeepPartial; + }; + declare type TimeoutHandle = ReturnType; + declare type IntervalHandle = ReturnType; + + declare interface ChangeEvent extends Event { + target: HTMLInputElement; + } + + declare interface WheelEvent { + path?: EventTarget[]; + } + + interface ImportMetaEnv extends ViteEnv { + __: unknown; + } + + declare interface ViteEnv { + VITE_PORT: number; + VITE_USE_MOCK: boolean; + VITE_PUBLIC_PATH: string; + VITE_GLOB_APP_TITLE: string; + VITE_GLOB_APP_SHORT_NAME: string; + VITE_DROP_CONSOLE: boolean; + } + + declare function parseInt(s: string | number, radix?: number): number; + + declare function parseFloat(string: string | number): number; + + namespace JSX { + // tslint:disable no-empty-interface + type Element = VNode; + // tslint:disable no-empty-interface + type ElementClass = ComponentRenderProxy; + + interface ElementAttributesProperty { + $props: any; + } + + interface IntrinsicElements { + [elem: string]: any; + } + + interface IntrinsicAttributes { + [elem: string]: any; + } + } +} + +declare module 'vue' { + export type JSXComponent = + | { new(): ComponentPublicInstance } + | FunctionalComponent; +} diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..8d49ad0 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,22 @@ +declare interface Fn { + (...arg: T[]): R; +} + +declare interface PromiseFn { + (...arg: T[]): Promise; +} + +declare type RefType = T | null; + + +declare type EmitType = (event: string, ...args: any[]) => void; + +declare type TargetContext = '_self' | '_blank'; + +declare interface ComponentElRef { + $el: T; +} + +declare type ComponentRef = ComponentElRef | null; + +declare type ElRef = Nullable; diff --git a/types/modules.d.ts b/types/modules.d.ts index 5e65414..b57b3cf 100644 --- a/types/modules.d.ts +++ b/types/modules.d.ts @@ -1,9 +1,10 @@ -declare module 'mitt' { - import mitt from 'mitt' - export default mitt +declare module '*.vue' { + import { DefineComponent } from 'vue'; + const Component: DefineComponent<{}, {}, any>; + export default Component; } -declare module 'blueimp-md5' { - import md5 from 'blueimp-md5' - export default md5 +declare module 'virtual:*' { + const result: any; + export default result; } diff --git a/types/schema.d.ts b/types/schema.d.ts deleted file mode 100644 index 723631c..0000000 --- a/types/schema.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { VNode, ComponentInternalInstance, HTMLAttributes, CSSProperties } from 'vue' -import { RuleObject } from 'ant-design-vue/lib/form/interface' -import { FormItemProps } from 'ant-design-vue/lib/form/FormItem' -import { FormProps, ValidationRule } from 'ant-design-vue/lib/form/Form' - -declare global { - declare interface OptionItem { - label: string - value: string | number - [key: string]: any - } - - declare type Rule = - | ValidationRule - | { - trigger?: 'blur' | 'change' | string['blur' | 'change'] - } - - declare interface FormItem extends Partial { - type?: - | 'input' - | 'textarea' - | 'select' - | 'radio' - | 'checkbox' - | 'input-number' - | 'inputRange' - | 'switch' - | VNode - label?: string // 表单标签 - field: string // 表单字段 - value: any // 表单默认值 - props?: Partial< - HTMLAttributes | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any - > // 表单属性 - rules?: Rule[] // 表单验证规则 - options?: OptionItem[] // 可选项 - eventObject?: object // 事件对象,例如:{ mousedown: doThis, mouseup: doThat } 将会动态绑定为:v-on="{ mousedown: doThis, mouseup: doThat }" - loading?: boolean // 异步数据是否加载 - asyncValue?: ( - formItem: FormItem, - formInstance: ComponentInternalInstance | null - ) => Promise // 异步数据 - asyncOptions?: ( - formItem: FormItem, - formInstance: ComponentInternalInstance | null - ) => Promise // 异步选项的数据 - hidden?: boolean // 是否隐藏表单项 - placeholder?: string - } - - interface FormSchema extends Partial { - style?: CSSProperties // 表单样式 - formItemLayout?: object // 表单布局 - watchKeys?: string[] - watchCallback?: (watchKeys: string[], { dynamicForm, modelRef }) => any - formItem: FormItem[] - } -} diff --git a/types/shims/shims-app.d.ts b/types/shims/shims-app.d.ts deleted file mode 100644 index 6f922be..0000000 --- a/types/shims/shims-app.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -declare module '*.bmp' { - const src: string - export default src -} - -declare module '*.gif' { - const src: string - export default src -} - -declare module '*.jpg' { - const src: string - export default src -} - -declare module '*.jpeg' { - const src: string - export default src -} - -declare module '*.png' { - const src: string - export default src -} - -declare module '*.webp' { - const src: string - export default src -} - -declare module '*.module.css' { - const classes: { readonly [key: string]: string } - export default classes -} - -declare module '*.module.scss' { - const classes: { readonly [key: string]: string } - export default classes -} - -declare module '*.module.less' { - const classes: { readonly [key: string]: string } - export default classes -} - -declare module '*.module.sass' { - const classes: { readonly [key: string]: string } - export default classes -} - -declare module 'moment/locale/*' { - const LocaleMessage: { [key: string]: any } - export default LocaleMessage -} - -declare module 'ant-design-vue/es/locale-provider/*' { - const LocaleMessage: { [key: string]: any } - export default LocaleMessage -} - -// ant-design-vue/es/base -declare module 'ant-design-vue/es/base' { - class Base { - static install(vue: typeof Vue): void - } - export default Base -} diff --git a/types/shims/shims-tsx.d.ts b/types/shims/shims-tsx.d.ts deleted file mode 100644 index 22dc021..0000000 --- a/types/shims/shims-tsx.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Vue, { VNode } from 'vue' - -declare module '*.tsx' { - import Vue from 'compatible-vue' - export default Vue -} - -declare global { - namespace JSX { - // tslint:disable no-empty-interface - type Element = VNode - // tslint:disable no-empty-interface - type ElementClass = Vue - interface IntrinsicElements { - [elem: string]: any - } - } -} diff --git a/types/shims/shims-vue.d.ts b/types/shims/shims-vue.d.ts deleted file mode 100644 index 51a2400..0000000 --- a/types/shims/shims-vue.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -declare module '*.vue' { - import { defineComponent } from 'vue' - const component: ReturnType - export default component -} - -// declare module '*.vue' { -// import * as vue from 'vue'; -// export declare const render: vue.RootRenderFunction -// } - -// declare module '@vue/runtime-core' { -// interface ComponentCustomProperties { -// $createLoading: () => any -// } -// } - -declare type Nullable = T | null - -declare type CustomizedHTMLElement = HTMLElement & T - -declare type Indexable = { - [key: string]: T -} diff --git a/types/tableColumn.d.ts b/types/tableColumn.d.ts deleted file mode 100644 index fe06bad..0000000 --- a/types/tableColumn.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ColumnProps, TableProps } from 'ant-design-vue/lib/table/interface' - -declare global { - interface ActionOptions { - type: 'select' | 'button' | 'text' | 'popconfirm' // 控制类型,默认为a,可选: select | button | text - text: string - permission?: { - // 权限 - action?: 'create' | 'delete' | 'update' | 'retrieve' // CRUD权限:创建(Create)、更新(Update)、读取(Retrieve)和删除(Delete)操作 - effect?: 'disabled' - } - props?: any // 组件属性,v-bind="props" - func?: ({ text, record, index }, callback: (...rest) => any) => any // 动作事件触发回调 - } - - interface TableColumn extends ColumnProps { - title: string - dataIndex: string - width?: number - slots?: { - customRender: string - } - slotsType?: 'format' | 'link' | 'component' - slotsFunc?: (...rest) => any - actions?: ActionOptions[] - } -} diff --git a/types/vuex.d.ts b/types/vuex.d.ts deleted file mode 100644 index 3705868..0000000 --- a/types/vuex.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ComponentCustomProperties } from 'vue' -import { Store } from 'vuex' - -declare module '@vue/runtime-core' { - // declare your own store states - interface State { - count: number - } - - // provide typings for `this.$store` - interface ComponentCustomProperties { - $store: Store - } -} diff --git a/vite.config.ts b/vite.config.ts index 5d5be45..6aa180e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -21,6 +21,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { esbuild: {}, resolve: { alias: [ + { + find: /\/#\//, + replacement: pathResolve('types') + '/' + }, { find: '@', replacement: pathResolve('src') + '/' -- GitLab