Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Bug 终结者
vue-vben-admin
提交
5e8ef2f6
V
vue-vben-admin
项目概览
Bug 终结者
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e8ef2f6
编写于
4月 06, 2023
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 添加 defineOptions
上级
8e5a6b7c
变更
25
展开全部
隐藏空白更改
内联
并排
Showing
25 changed file
with
346 addition
and
159 deletion
+346
-159
internal/eslint-config/package.json
internal/eslint-config/package.json
+2
-0
internal/eslint-config/src/index.ts
internal/eslint-config/src/index.ts
+26
-8
internal/ts-config/package.json
internal/ts-config/package.json
+3
-1
internal/ts-config/vue-app.json
internal/ts-config/vue-app.json
+2
-1
internal/vite-config/package.json
internal/vite-config/package.json
+5
-2
internal/vite-config/src/plugins/index.ts
internal/vite-config/src/plugins/index.ts
+3
-1
package.json
package.json
+3
-4
packages/hooks/src/index.ts
packages/hooks/src/index.ts
+2
-2
packages/hooks/src/onMountedOrActivated.ts
packages/hooks/src/onMountedOrActivated.ts
+0
-0
packages/hooks/src/useAttrs.ts
packages/hooks/src/useAttrs.ts
+8
-6
packages/hooks/tsconfig.json
packages/hooks/tsconfig.json
+1
-1
packages/types/src/utils.ts
packages/types/src/utils.ts
+31
-1
packages/types/tsconfig.json
packages/types/tsconfig.json
+1
-1
pnpm-lock.yaml
pnpm-lock.yaml
+198
-83
src/App.vue
src/App.vue
+4
-4
src/components/Button/src/BasicButton.vue
src/components/Button/src/BasicButton.vue
+7
-9
src/components/Button/src/PopConfirmButton.vue
src/components/Button/src/PopConfirmButton.vue
+2
-2
src/components/Description/src/Description.vue
src/components/Description/src/Description.vue
+17
-6
src/components/Drawer/src/BasicDrawer.vue
src/components/Drawer/src/BasicDrawer.vue
+2
-2
src/components/Form/src/components/ApiRadioGroup.vue
src/components/Form/src/components/ApiRadioGroup.vue
+6
-5
src/components/Form/src/components/ApiSelect.vue
src/components/Form/src/components/ApiSelect.vue
+3
-3
src/components/Form/src/components/RadioButtonGroup.vue
src/components/Form/src/components/RadioButtonGroup.vue
+1
-1
src/components/Modal/src/components/Modal.tsx
src/components/Modal/src/components/Modal.tsx
+2
-2
src/main.ts
src/main.ts
+14
-11
tsconfig.json
tsconfig.json
+3
-3
未找到文件。
internal/eslint-config/package.json
浏览文件 @
5e8ef2f6
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
"eslint-config-prettier"
:
"^8.8.0"
,
"eslint-config-prettier"
:
"^8.8.0"
,
"eslint-plugin-import"
:
"^2.27.5"
,
"eslint-plugin-import"
:
"^2.27.5"
,
"eslint-plugin-prettier"
:
"^4.2.1"
,
"eslint-plugin-prettier"
:
"^4.2.1"
,
"eslint-plugin-simple-import-sort"
:
"^10.0.0"
,
"eslint-plugin-unused-imports"
:
"^2.0.0"
,
"eslint-plugin-vue"
:
"^9.10.0"
,
"eslint-plugin-vue"
:
"^9.10.0"
,
"vue-eslint-parser"
:
"^9.1.1"
"vue-eslint-parser"
:
"^9.1.1"
}
}
...
...
internal/eslint-config/src/index.ts
浏览文件 @
5e8ef2f6
...
@@ -17,7 +17,14 @@ export default {
...
@@ -17,7 +17,14 @@ export default {
createDefaultProgram
:
false
,
createDefaultProgram
:
false
,
extraFileExtensions
:
[
'
.vue
'
],
extraFileExtensions
:
[
'
.vue
'
],
},
},
plugins
:
[
'
vue
'
,
'
@typescript-eslint
'
,
'
import
'
],
plugins
:
[
'
vue
'
,
'
@typescript-eslint
'
,
'
import
'
,
// TODO: 改造完成后开启
// 'unused-imports',
// 'simple-import-sort',
],
extends
:
[
extends
:
[
'
eslint:recommended
'
,
'
eslint:recommended
'
,
'
plugin:vue/vue3-recommended
'
,
'
plugin:vue/vue3-recommended
'
,
...
@@ -30,10 +37,26 @@ export default {
...
@@ -30,10 +37,26 @@ export default {
'
no-use-before-define
'
:
'
off
'
,
'
no-use-before-define
'
:
'
off
'
,
'
space-before-function-paren
'
:
'
off
'
,
'
space-before-function-paren
'
:
'
off
'
,
// TODO: 改造完成后开启
// 'simple-import-sort/imports': 'error',
// 'simple-import-sort/exports': 'error',
'
import/first
'
:
'
error
'
,
'
import/first
'
:
'
error
'
,
'
import/newline-after-import
'
:
'
error
'
,
'
import/newline-after-import
'
:
'
error
'
,
'
import/no-duplicates
'
:
'
error
'
,
'
import/no-duplicates
'
:
'
error
'
,
// 'unused-imports/no-unused-imports': 'error',
// 'unused-imports/no-unused-vars': [
// 'warn',
// { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
// ],
'
@typescript-eslint/no-unused-vars
'
:
[
'
error
'
,
{
argsIgnorePattern
:
'
^_
'
,
varsIgnorePattern
:
'
^_
'
,
},
],
'
@typescript-eslint/ban-ts-ignore
'
:
'
off
'
,
'
@typescript-eslint/ban-ts-ignore
'
:
'
off
'
,
'
@typescript-eslint/explicit-function-return-type
'
:
'
off
'
,
'
@typescript-eslint/explicit-function-return-type
'
:
'
off
'
,
'
@typescript-eslint/no-explicit-any
'
:
'
off
'
,
'
@typescript-eslint/no-explicit-any
'
:
'
off
'
,
...
@@ -44,13 +67,7 @@ export default {
...
@@ -44,13 +67,7 @@ export default {
'
@typescript-eslint/ban-types
'
:
'
off
'
,
'
@typescript-eslint/ban-types
'
:
'
off
'
,
'
@typescript-eslint/no-non-null-assertion
'
:
'
off
'
,
'
@typescript-eslint/no-non-null-assertion
'
:
'
off
'
,
'
@typescript-eslint/explicit-module-boundary-types
'
:
'
off
'
,
'
@typescript-eslint/explicit-module-boundary-types
'
:
'
off
'
,
'
@typescript-eslint/no-unused-vars
'
:
[
'
@typescript-eslint/no-unused-vars
'
:
'
off
'
,
'
error
'
,
{
argsIgnorePattern
:
'
^_
'
,
varsIgnorePattern
:
'
^_
'
,
},
],
'
vue/script-setup-uses-vars
'
:
'
error
'
,
'
vue/script-setup-uses-vars
'
:
'
error
'
,
'
vue/no-reserved-component-names
'
:
'
off
'
,
'
vue/no-reserved-component-names
'
:
'
off
'
,
'
vue/custom-event-name-casing
'
:
'
off
'
,
'
vue/custom-event-name-casing
'
:
'
off
'
,
...
@@ -87,4 +104,5 @@ export default {
...
@@ -87,4 +104,5 @@ export default {
// },
// },
// ],
// ],
},
},
globals
:
{
defineOptions
:
'
readonly
'
},
};
};
internal/ts-config/package.json
浏览文件 @
5e8ef2f6
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
"node-server.json"
"node-server.json"
],
],
"dependencies"
:
{
"dependencies"
:
{
"@types/node"
:
"^18.15.11"
"@types/node"
:
"^18.15.11"
,
"unplugin-vue-define-options"
:
"^1.3.3"
,
"vite"
:
"^4.3.0-beta.2"
}
}
}
}
internal/ts-config/vue.json
→
internal/ts-config/vue
-app
.json
浏览文件 @
5e8ef2f6
{
{
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"display"
:
"Vue
Library
"
,
"display"
:
"Vue
Application
"
,
"extends"
:
"./base.json"
,
"extends"
:
"./base.json"
,
"compilerOptions"
:
{
"compilerOptions"
:
{
"jsx"
:
"preserve"
,
"jsx"
:
"preserve"
,
"lib"
:
[
"ESNext"
,
"DOM"
],
"lib"
:
[
"ESNext"
,
"DOM"
],
"noImplicitAny"
:
false
"noImplicitAny"
:
false
}
}
}
}
internal/vite-config/package.json
浏览文件 @
5e8ef2f6
...
@@ -32,11 +32,13 @@
...
@@ -32,11 +32,13 @@
},
},
"dependencies"
:
{
"dependencies"
:
{
"@ant-design/colors"
:
"^7.0.0"
,
"@ant-design/colors"
:
"^7.0.0"
,
"vite"
:
"^4.3.0-beta.
1
"
"vite"
:
"^4.3.0-beta.
2
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/fs-extra"
:
"^11.0.1"
,
"@types/fs-extra"
:
"^11.0.1"
,
"ant-design-vue"
:
"^3.2.16"
,
"@vitejs/plugin-vue"
:
"^4.1.0"
,
"@vitejs/plugin-vue-jsx"
:
"^3.0.1"
,
"ant-design-vue"
:
"^3.2.17"
,
"dayjs"
:
"^1.11.7"
,
"dayjs"
:
"^1.11.7"
,
"dotenv"
:
"^16.0.3"
,
"dotenv"
:
"^16.0.3"
,
"fs-extra"
:
"^11.1.1"
,
"fs-extra"
:
"^11.1.1"
,
...
@@ -46,6 +48,7 @@
...
@@ -46,6 +48,7 @@
"rollup-plugin-visualizer"
:
"^5.9.0"
,
"rollup-plugin-visualizer"
:
"^5.9.0"
,
"sass"
:
"^1.60.0"
,
"sass"
:
"^1.60.0"
,
"unocss"
:
"^0.50.6"
,
"unocss"
:
"^0.50.6"
,
"unplugin-vue-define-options"
:
"^1.3.3"
,
"vite-plugin-compression"
:
"^0.5.1"
,
"vite-plugin-compression"
:
"^0.5.1"
,
"vite-plugin-dts"
:
"^2.2.0"
,
"vite-plugin-dts"
:
"^2.2.0"
,
"vite-plugin-html"
:
"^3.2.0"
,
"vite-plugin-html"
:
"^3.2.0"
,
...
...
internal/vite-config/src/plugins/index.ts
浏览文件 @
5e8ef2f6
...
@@ -8,6 +8,8 @@ import { createAppConfigPlugin } from './appConfig';
...
@@ -8,6 +8,8 @@ import { createAppConfigPlugin } from './appConfig';
import
vue
from
'
@vitejs/plugin-vue
'
;
import
vue
from
'
@vitejs/plugin-vue
'
;
import
vueJsx
from
'
@vitejs/plugin-vue-jsx
'
;
import
vueJsx
from
'
@vitejs/plugin-vue-jsx
'
;
import
purgeIcons
from
'
vite-plugin-purge-icons
'
;
import
purgeIcons
from
'
vite-plugin-purge-icons
'
;
// @ts-ignore
import
DefineOptions
from
'
unplugin-vue-define-options/vite
'
;
interface
Options
{
interface
Options
{
isBuild
:
boolean
;
isBuild
:
boolean
;
...
@@ -18,7 +20,7 @@ interface Options {
...
@@ -18,7 +20,7 @@ interface Options {
}
}
async
function
createPlugins
({
isBuild
,
root
,
enableMock
,
compress
,
enableAnalyze
}:
Options
)
{
async
function
createPlugins
({
isBuild
,
root
,
enableMock
,
compress
,
enableAnalyze
}:
Options
)
{
const
vitePlugins
:
(
PluginOption
|
PluginOption
[])[]
=
[
vue
(),
vueJsx
()];
const
vitePlugins
:
(
PluginOption
|
PluginOption
[])[]
=
[
vue
(),
vueJsx
()
,
DefineOptions
()
];
const
appConfigPlugin
=
await
createAppConfigPlugin
({
root
,
isBuild
});
const
appConfigPlugin
=
await
createAppConfigPlugin
({
root
,
isBuild
});
vitePlugins
.
push
(
appConfigPlugin
);
vitePlugins
.
push
(
appConfigPlugin
);
...
...
package.json
浏览文件 @
5e8ef2f6
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
"devDependencies"
:
{
"devDependencies"
:
{
"
@commitlint/cli
"
:
"
^17.5.1
"
,
"
@commitlint/cli
"
:
"
^17.5.1
"
,
"
@commitlint/config-conventional
"
:
"
^17.4.4
"
,
"
@commitlint/config-conventional
"
:
"
^17.4.4
"
,
"
@iconify/json
"
:
"
^2.2.4
5
"
,
"
@iconify/json
"
:
"
^2.2.4
6
"
,
"
@purge-icons/generated
"
:
"
^0.9.0
"
,
"
@purge-icons/generated
"
:
"
^0.9.0
"
,
"
@types/codemirror
"
:
"
^5.60.7
"
,
"
@types/codemirror
"
:
"
^5.60.7
"
,
"
@types/crypto-js
"
:
"
^4.1.1
"
,
"
@types/crypto-js
"
:
"
^4.1.1
"
,
...
@@ -126,8 +126,6 @@
...
@@ -126,8 +126,6 @@
"
@vben/stylelint-config
"
:
"
workspace:*
"
,
"
@vben/stylelint-config
"
:
"
workspace:*
"
,
"
@vben/ts-config
"
:
"
workspace:*
"
,
"
@vben/ts-config
"
:
"
workspace:*
"
,
"
@vben/vite-config
"
:
"
workspace:*
"
,
"
@vben/vite-config
"
:
"
workspace:*
"
,
"
@vitejs/plugin-vue
"
:
"
^4.1.0
"
,
"
@vitejs/plugin-vue-jsx
"
:
"
^3.0.1
"
,
"
@vue/compiler-sfc
"
:
"
^3.2.47
"
,
"
@vue/compiler-sfc
"
:
"
^3.2.47
"
,
"
@vue/test-utils
"
:
"
^2.3.2
"
,
"
@vue/test-utils
"
:
"
^2.3.2
"
,
"
cross-env
"
:
"
^7.0.3
"
,
"
cross-env
"
:
"
^7.0.3
"
,
...
@@ -141,7 +139,8 @@
...
@@ -141,7 +139,8 @@
"
turbo
"
:
"
^1.8.8
"
,
"
turbo
"
:
"
^1.8.8
"
,
"
typescript
"
:
"
^5.0.3
"
,
"
typescript
"
:
"
^5.0.3
"
,
"
unbuild
"
:
"
^1.2.0
"
,
"
unbuild
"
:
"
^1.2.0
"
,
"
vite
"
:
"
^4.3.0-beta.1
"
,
"
unplugin-vue-define-options
"
:
"
^1.3.3
"
,
"
vite
"
:
"
^4.3.0-beta.2
"
,
"
vite-plugin-mock
"
:
"
^2.9.6
"
,
"
vite-plugin-mock
"
:
"
^2.9.6
"
,
"
vue-tsc
"
:
"
^1.2.0
"
"
vue-tsc
"
:
"
^1.2.0
"
},
},
...
...
packages/hooks/src/index.ts
浏览文件 @
5e8ef2f6
// life-cycle
export
*
from
'
./onMountedOrActivated
'
;
export
*
from
'
./
lifecycle/onMountedOrActivated
'
;
export
*
from
'
./
useAttrs
'
;
packages/hooks/src/
lifecycle/
onMountedOrActivated.ts
→
packages/hooks/src/onMountedOrActivated.ts
浏览文件 @
5e8ef2f6
文件已移动
src/hooks/core
/useAttrs.ts
→
packages/hooks/src
/useAttrs.ts
浏览文件 @
5e8ef2f6
import
{
getCurrentInstance
,
reactive
,
shallowRef
,
watchEffect
}
from
'
vue
'
;
import
{
getCurrentInstance
,
reactive
,
shallowRef
,
watchEffect
}
from
'
vue
'
;
import
type
{
Ref
}
from
'
vue
'
;
import
{
type
Recordable
}
from
'
@vben/types
'
;
interface
Param
s
{
interface
Option
s
{
excludeListeners
?:
boolean
;
excludeListeners
?:
boolean
;
excludeKeys
?:
string
[];
excludeKeys
?:
string
[];
excludeDefaultKeys
?:
boolean
;
excludeDefaultKeys
?:
boolean
;
...
@@ -10,15 +10,15 @@ interface Params {
...
@@ -10,15 +10,15 @@ interface Params {
const
DEFAULT_EXCLUDE_KEYS
=
[
'
class
'
,
'
style
'
];
const
DEFAULT_EXCLUDE_KEYS
=
[
'
class
'
,
'
style
'
];
const
LISTENER_PREFIX
=
/^on
[
A-Z
]
/
;
const
LISTENER_PREFIX
=
/^on
[
A-Z
]
/
;
export
function
entries
<
T
>
(
obj
:
Recordable
<
T
>
):
[
string
,
T
][]
{
function
entries
<
T
>
(
obj
:
Recordable
<
T
>
):
[
string
,
T
][]
{
return
Object
.
keys
(
obj
).
map
((
key
:
string
)
=>
[
key
,
obj
[
key
]]);
return
Object
.
keys
(
obj
).
map
((
key
:
string
)
=>
[
key
,
obj
[
key
]]);
}
}
export
function
useAttrs
(
params
:
Params
=
{}):
Ref
<
Recordable
>
|
{}
{
function
useAttrs
(
options
:
Options
=
{}):
Recordable
<
any
>
{
const
instance
=
getCurrentInstance
();
const
instance
=
getCurrentInstance
();
if
(
!
instance
)
return
{};
if
(
!
instance
)
return
{};
const
{
excludeListeners
=
false
,
excludeKeys
=
[],
excludeDefaultKeys
=
true
}
=
param
s
;
const
{
excludeListeners
=
false
,
excludeKeys
=
[],
excludeDefaultKeys
=
true
}
=
option
s
;
const
attrs
=
shallowRef
({});
const
attrs
=
shallowRef
({});
const
allExcludeKeys
=
excludeKeys
.
concat
(
excludeDefaultKeys
?
DEFAULT_EXCLUDE_KEYS
:
[]);
const
allExcludeKeys
=
excludeKeys
.
concat
(
excludeDefaultKeys
?
DEFAULT_EXCLUDE_KEYS
:
[]);
...
@@ -32,10 +32,12 @@ export function useAttrs(params: Params = {}): Ref<Recordable> | {} {
...
@@ -32,10 +32,12 @@ export function useAttrs(params: Params = {}): Ref<Recordable> | {} {
}
}
return
acm
;
return
acm
;
},
{}
as
Recordable
);
},
{}
as
Recordable
<
any
>
);
attrs
.
value
=
res
;
attrs
.
value
=
res
;
});
});
return
attrs
;
return
attrs
;
}
}
export
{
useAttrs
};
packages/hooks/tsconfig.json
浏览文件 @
5e8ef2f6
{
{
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"extends"
:
"@vben/ts-config/vue.json"
,
"extends"
:
"@vben/ts-config/vue
-app
.json"
,
"include"
:
[
"src"
]
"include"
:
[
"src"
]
}
}
packages/types/src/utils.ts
浏览文件 @
5e8ef2f6
...
@@ -13,4 +13,34 @@ type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
...
@@ -13,4 +13,34 @@ type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
*/
*/
type
AnyNormalFunction
=
(...
arg
:
any
)
=>
any
;
type
AnyNormalFunction
=
(...
arg
:
any
)
=>
any
;
export
{
type
AnyFunction
,
type
AnyPromiseFunction
,
type
AnyNormalFunction
};
/**
* T | null 包装
*/
type
Nullable
<
T
>
=
T
|
null
;
/**
* T | Not null 包装
*/
type
NonNullable
<
T
>
=
T
extends
null
|
undefined
?
never
:
T
;
/**
* 字符串类型对象
*/
type
Recordable
<
T
>
=
Record
<
string
,
T
>
;
/**
* 字符串类型对象(只读)
*/
type
ReadonlyRecordable
<
T
=
any
>
=
{
readonly
[
key
:
string
]:
T
;
};
export
{
type
AnyFunction
,
type
AnyPromiseFunction
,
type
AnyNormalFunction
,
type
Nullable
,
type
NonNullable
,
type
Recordable
,
type
ReadonlyRecordable
,
};
packages/types/tsconfig.json
浏览文件 @
5e8ef2f6
{
{
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"extends"
:
"@vben/ts-config/vue.json"
,
"extends"
:
"@vben/ts-config/vue
-app
.json"
,
"include"
:
[
"src"
]
"include"
:
[
"src"
]
}
}
pnpm-lock.yaml
浏览文件 @
5e8ef2f6
此差异已折叠。
点击以展开。
src/App.vue
浏览文件 @
5e8ef2f6
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ConfigProvider
}
from
'
ant-design-vue
'
;
import
{
ConfigProvider
}
from
'
ant-design-vue
'
;
import
{
AppProvider
}
from
'
/@/components/Application
'
;
import
{
AppProvider
}
from
'
@/components/Application
'
;
import
{
useTitle
}
from
'
/@/hooks/web/useTitle
'
;
import
{
useTitle
}
from
'
@/hooks/web/useTitle
'
;
import
{
useLocale
}
from
'
/@/locales/useLocale
'
;
import
{
useLocale
}
from
'
@/locales/useLocale
'
;
import
'
dayjs/locale/zh-cn
'
;
import
'
dayjs/locale/zh-cn
'
;
// support Multi-language
// support Multi-language
const
{
getAntdLocale
}
=
useLocale
();
const
{
getAntdLocale
}
=
useLocale
();
...
...
src/components/Button/src/BasicButton.vue
浏览文件 @
5e8ef2f6
...
@@ -8,20 +8,18 @@
...
@@ -8,20 +8,18 @@
</Button>
</Button>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
setup
>
import
{
defineComponent
}
from
'
vue
'
;
import
{
Button
}
from
'
ant-design-vue
'
;
import
{
Button
}
from
'
ant-design-vue
'
;
export
default
defineComponent
({
import
{
computed
,
unref
}
from
'
vue
'
;
import
Icon
from
'
/@/components/Icon/src/Icon.vue
'
;
import
{
buttonProps
}
from
'
./props
'
;
import
{
useAttrs
}
from
'
@vben/hooks
'
;
defineOptions
({
name
:
'
AButton
'
,
name
:
'
AButton
'
,
extends
:
Button
,
extends
:
Button
,
inheritAttrs
:
false
,
inheritAttrs
:
false
,
});
});
</
script
>
<
script
lang=
"ts"
setup
>
import
{
computed
,
unref
}
from
'
vue
'
;
import
Icon
from
'
/@/components/Icon/src/Icon.vue
'
;
import
{
buttonProps
}
from
'
./props
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttrs
'
;
const
props
=
defineProps
(
buttonProps
);
const
props
=
defineProps
(
buttonProps
);
// get component class
// get component class
...
...
src/components/Button/src/PopConfirmButton.vue
浏览文件 @
5e8ef2f6
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
{
Popconfirm
}
from
'
ant-design-vue
'
;
import
{
Popconfirm
}
from
'
ant-design-vue
'
;
import
{
extendSlots
}
from
'
/@/utils/helper/tsxHelper
'
;
import
{
extendSlots
}
from
'
/@/utils/helper/tsxHelper
'
;
import
{
omit
}
from
'
lodash-es
'
;
import
{
omit
}
from
'
lodash-es
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
const
props
=
{
const
props
=
{
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
return
()
=>
{
return
()
=>
{
const
bindValues
=
omit
(
unref
(
getBindValues
),
'
icon
'
);
const
bindValues
=
omit
(
unref
(
getBindValues
),
'
icon
'
);
const
btnBind
=
omit
(
bindValues
,
'
title
'
)
as
Recordable
;
const
btnBind
=
omit
(
bindValues
,
'
title
'
)
as
any
;
if
(
btnBind
.
disabled
)
btnBind
.
color
=
''
;
if
(
btnBind
.
disabled
)
btnBind
.
color
=
''
;
const
Button
=
h
(
BasicButton
,
btnBind
,
extendSlots
(
slots
));
const
Button
=
h
(
BasicButton
,
btnBind
,
extendSlots
(
slots
));
...
...
src/components/Description/src/Description.vue
浏览文件 @
5e8ef2f6
<
script
lang=
"tsx"
>
<
script
lang=
"tsx"
>
import
type
{
DescriptionProps
,
DescInstance
,
DescItem
}
from
'
./typing
'
;
import
type
{
DescriptionProps
,
DescInstance
,
DescItem
}
from
'
./typing
'
;
import
type
{
DescriptionsProps
}
from
'
ant-design-vue/es/descriptions/index
'
;
import
type
{
DescriptionsProps
}
from
'
ant-design-vue/es/descriptions/index
'
;
import
type
{
CSSProperties
}
from
'
vue
'
;
import
type
{
CollapseContainerOptions
}
from
'
/@/components/Container/index
'
;
import
type
{
CollapseContainerOptions
}
from
'
/@/components/Container/index
'
;
import
{
defineComponent
,
computed
,
ref
,
unref
,
toRefs
}
from
'
vue
'
;
import
{
type
CSSProperties
,
type
PropType
,
defineComponent
,
computed
,
ref
,
unref
,
toRefs
,
}
from
'
vue
'
;
import
{
get
}
from
'
lodash-es
'
;
import
{
get
}
from
'
lodash-es
'
;
import
{
Descriptions
}
from
'
ant-design-vue
'
;
import
{
Descriptions
}
from
'
ant-design-vue
'
;
import
{
CollapseContainer
}
from
'
/@/components/Container/index
'
;
import
{
CollapseContainer
}
from
'
/@/components/Container/index
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
getSlot
}
from
'
/@/utils/helper/tsxHelper
'
;
import
{
getSlot
}
from
'
/@/utils/helper/tsxHelper
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
const
props
=
{
const
props
=
{
useCollapse
:
{
type
:
Boolean
,
default
:
true
},
useCollapse
:
{
type
:
Boolean
,
default
:
true
},
...
@@ -22,7 +29,7 @@
...
@@ -22,7 +29,7 @@
},
},
bordered
:
{
type
:
Boolean
,
default
:
true
},
bordered
:
{
type
:
Boolean
,
default
:
true
},
column
:
{
column
:
{
type
:
[
Number
,
Object
]
as
PropType
<
number
|
Recordable
>
,
type
:
[
Number
,
Object
],
default
:
()
=>
{
default
:
()
=>
{
return
{
xxl
:
4
,
xl
:
3
,
lg
:
3
,
md
:
3
,
sm
:
2
,
xs
:
1
};
return
{
xxl
:
4
,
xl
:
3
,
lg
:
3
,
md
:
3
,
sm
:
2
,
xs
:
1
};
},
},
...
@@ -52,7 +59,7 @@
...
@@ -52,7 +59,7 @@
const
getMergeProps
=
computed
(()
=>
{
const
getMergeProps
=
computed
(()
=>
{
return
{
return
{
...
props
,
...
props
,
...(
unref
(
propsRef
)
as
Recordable
),
...(
unref
(
propsRef
)
as
any
),
}
as
DescriptionProps
;
}
as
DescriptionProps
;
});
});
...
@@ -89,7 +96,10 @@
...
@@ -89,7 +96,10 @@
*/
*/
function
setDescProps
(
descProps
:
Partial
<
DescriptionProps
>
):
void
{
function
setDescProps
(
descProps
:
Partial
<
DescriptionProps
>
):
void
{
// Keep the last setDrawerProps
// Keep the last setDrawerProps
propsRef
.
value
=
{
...(
unref
(
propsRef
)
as
Recordable
),
...
descProps
}
as
Recordable
;
propsRef
.
value
=
{
...(
unref
(
propsRef
)
as
Record
<
string
,
any
>
),
...
descProps
,
}
as
Record
<
string
,
any
>
;
}
}
// Prevent line breaks
// Prevent line breaks
...
@@ -121,6 +131,7 @@
...
@@ -121,6 +131,7 @@
return
null
;
return
null
;
}
}
const
getField
=
get
(
_data
,
field
);
const
getField
=
get
(
_data
,
field
);
// eslint-disable-next-line
if
(
getField
&&
!
toRefs
(
_data
).
hasOwnProperty
(
field
))
{
if
(
getField
&&
!
toRefs
(
_data
).
hasOwnProperty
(
field
))
{
return
isFunction
(
render
)
?
render
(
''
,
_data
)
:
''
;
return
isFunction
(
render
)
?
render
(
''
,
_data
)
:
''
;
}
}
...
...
src/components/Drawer/src/BasicDrawer.vue
浏览文件 @
5e8ef2f6
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
import
{
ScrollContainer
}
from
'
/@/components/Container
'
;
import
{
ScrollContainer
}
from
'
/@/components/Container
'
;
import
{
basicProps
}
from
'
./props
'
;
import
{
basicProps
}
from
'
./props
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
Drawer
,
ScrollContainer
,
DrawerFooter
,
DrawerHeader
},
components
:
{
Drawer
,
ScrollContainer
,
DrawerFooter
,
DrawerHeader
},
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
const
{
prefixVar
,
prefixCls
}
=
useDesign
(
'
basic-drawer
'
);
const
{
prefixVar
,
prefixCls
}
=
useDesign
(
'
basic-drawer
'
);
const
drawerInstance
:
DrawerInstance
=
{
const
drawerInstance
:
DrawerInstance
=
{
setDrawerProps
:
setDrawerProps
,
setDrawerProps
:
setDrawerProps
as
any
,
emitVisible
:
undefined
,
emitVisible
:
undefined
,
};
};
...
...
src/components/Form/src/components/ApiRadioGroup.vue
浏览文件 @
5e8ef2f6
...
@@ -19,14 +19,15 @@
...
@@ -19,14 +19,15 @@
</RadioGroup>
</RadioGroup>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
PropType
,
ref
,
watchEffect
,
computed
,
unref
,
watch
}
from
'
vue
'
;
import
{
defineComponent
,
type
PropType
,
ref
,
watchEffect
,
computed
,
unref
,
watch
}
from
'
vue
'
;
import
{
Radio
}
from
'
ant-design-vue
'
;
import
{
Radio
}
from
'
ant-design-vue
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
import
{
get
,
omit
}
from
'
lodash-es
'
;
import
{
get
,
omit
}
from
'
lodash-es
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
type
OptionsItem
=
{
label
:
string
;
value
:
string
|
number
|
boolean
;
disabled
?:
boolean
};
type
OptionsItem
=
{
label
:
string
;
value
:
string
|
number
|
boolean
;
disabled
?:
boolean
};
export
default
defineComponent
({
export
default
defineComponent
({
...
@@ -38,11 +39,11 @@
...
@@ -38,11 +39,11 @@
},
},
props
:
{
props
:
{
api
:
{
api
:
{
type
:
Function
as
PropType
<
(
arg
?:
Recordable
|
string
)
=>
Promise
<
OptionsItem
[]
>>
,
type
:
Function
as
PropType
<
(
arg
?:
any
|
string
)
=>
Promise
<
OptionsItem
[]
>>
,
default
:
null
,
default
:
null
,
},
},
params
:
{
params
:
{
type
:
[
Object
,
String
]
as
PropType
<
Recordable
|
string
>
,
type
:
[
Object
,
String
]
as
PropType
<
any
|
string
>
,
default
:
()
=>
({}),
default
:
()
=>
({}),
},
},
value
:
{
value
:
{
...
@@ -73,7 +74,7 @@
...
@@ -73,7 +74,7 @@
const
getOptions
=
computed
(()
=>
{
const
getOptions
=
computed
(()
=>
{
const
{
labelField
,
valueField
,
numberToString
}
=
props
;
const
{
labelField
,
valueField
,
numberToString
}
=
props
;
return
unref
(
options
).
reduce
((
prev
,
next
:
Recordable
)
=>
{
return
unref
(
options
).
reduce
((
prev
,
next
:
any
)
=>
{
if
(
next
)
{
if
(
next
)
{
const
value
=
next
[
valueField
];
const
value
=
next
[
valueField
];
prev
.
push
({
prev
.
push
({
...
...
src/components/Form/src/components/ApiSelect.vue
浏览文件 @
5e8ef2f6
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
import
{
Select
}
from
'
ant-design-vue
'
;
import
{
Select
}
from
'
ant-design-vue
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
import
{
get
,
omit
}
from
'
lodash-es
'
;
import
{
get
,
omit
}
from
'
lodash-es
'
;
import
{
LoadingOutlined
}
from
'
@ant-design/icons-vue
'
;
import
{
LoadingOutlined
}
from
'
@ant-design/icons-vue
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
value
:
[
Array
,
Object
,
String
,
Number
],
value
:
[
Array
,
Object
,
String
,
Number
],
numberToString
:
propTypes
.
bool
,
numberToString
:
propTypes
.
bool
,
api
:
{
api
:
{
type
:
Function
as
PropType
<
(
arg
?:
Recordable
)
=>
Promise
<
OptionsItem
[]
>>
,
type
:
Function
as
PropType
<
(
arg
?:
any
)
=>
Promise
<
OptionsItem
[]
>>
,
default
:
null
,
default
:
null
,
},
},
// api params
// api params
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
const
getOptions
=
computed
(()
=>
{
const
getOptions
=
computed
(()
=>
{
const
{
labelField
,
valueField
,
numberToString
}
=
props
;
const
{
labelField
,
valueField
,
numberToString
}
=
props
;
return
unref
(
options
).
reduce
((
prev
,
next
:
Recordable
)
=>
{
return
unref
(
options
).
reduce
((
prev
,
next
:
any
)
=>
{
if
(
next
)
{
if
(
next
)
{
const
value
=
get
(
next
,
valueField
);
const
value
=
get
(
next
,
valueField
);
prev
.
push
({
prev
.
push
({
...
...
src/components/Form/src/components/RadioButtonGroup.vue
浏览文件 @
5e8ef2f6
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
{
Radio
}
from
'
ant-design-vue
'
;
import
{
Radio
}
from
'
ant-design-vue
'
;
import
{
isString
}
from
'
/@/utils/is
'
;
import
{
isString
}
from
'
/@/utils/is
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useRuleFormItem
}
from
'
/@/hooks/component/useFormItem
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
type
OptionsItem
=
{
label
:
string
;
value
:
string
|
number
|
boolean
;
disabled
?:
boolean
};
type
OptionsItem
=
{
label
:
string
;
value
:
string
|
number
|
boolean
;
disabled
?:
boolean
};
type
RadioItem
=
string
|
OptionsItem
;
type
RadioItem
=
string
|
OptionsItem
;
...
...
src/components/Modal/src/components/Modal.tsx
浏览文件 @
5e8ef2f6
...
@@ -2,13 +2,13 @@ import { Modal } from 'ant-design-vue';
...
@@ -2,13 +2,13 @@ import { Modal } from 'ant-design-vue';
import
{
defineComponent
,
toRefs
,
unref
}
from
'
vue
'
;
import
{
defineComponent
,
toRefs
,
unref
}
from
'
vue
'
;
import
{
basicProps
}
from
'
../props
'
;
import
{
basicProps
}
from
'
../props
'
;
import
{
useModalDragMove
}
from
'
../hooks/useModalDrag
'
;
import
{
useModalDragMove
}
from
'
../hooks/useModalDrag
'
;
import
{
useAttrs
}
from
'
/@/hooks/core/useAttr
s
'
;
import
{
useAttrs
}
from
'
@vben/hook
s
'
;
import
{
extendSlots
}
from
'
/@/utils/helper/tsxHelper
'
;
import
{
extendSlots
}
from
'
/@/utils/helper/tsxHelper
'
;
export
default
defineComponent
({
export
default
defineComponent
({
name
:
'
Modal
'
,
name
:
'
Modal
'
,
inheritAttrs
:
false
,
inheritAttrs
:
false
,
props
:
basicProps
,
props
:
basicProps
as
any
,
emits
:
[
'
cancel
'
],
emits
:
[
'
cancel
'
],
setup
(
props
,
{
slots
,
emit
})
{
setup
(
props
,
{
slots
,
emit
})
{
const
{
visible
,
draggable
,
destroyOnClose
}
=
toRefs
(
props
);
const
{
visible
,
draggable
,
destroyOnClose
}
=
toRefs
(
props
);
...
...
src/main.ts
浏览文件 @
5e8ef2f6
import
'
uno.css
'
;
import
'
uno.css
'
;
import
'
/
@/design/index.less
'
;
import
'
@/design/index.less
'
;
import
'
/
@/components/VxeTable/src/css/index.scss
'
;
import
'
@/components/VxeTable/src/css/index.scss
'
;
import
'
ant-design-vue/dist/antd.css
'
;
import
'
ant-design-vue/dist/antd.css
'
;
// Register icon sprite
// Register icon sprite
import
'
virtual:svg-icons-register
'
;
import
'
virtual:svg-icons-register
'
;
import
App
from
'
./App.vue
'
;
import
{
createApp
}
from
'
vue
'
;
import
{
createApp
}
from
'
vue
'
;
import
{
initAppConfigStore
}
from
'
/@/logics/initAppConfig
'
;
import
{
setupErrorHandle
}
from
'
/@/logics/error-handle
'
;
import
{
registerGlobComp
}
from
'
@/components/registerGlobComp
'
;
import
{
router
,
setupRouter
}
from
'
/@/router
'
;
import
{
setupGlobDirectives
}
from
'
@/directives
'
;
import
{
setupRouterGuard
}
from
'
/@/router/guard
'
;
import
{
setupI18n
}
from
'
@/locales/setupI18n
'
;
import
{
setupStore
}
from
'
/@/store
'
;
import
{
setupErrorHandle
}
from
'
@/logics/error-handle
'
;
import
{
setupGlobDirectives
}
from
'
/@/directives
'
;
import
{
initAppConfigStore
}
from
'
@/logics/initAppConfig
'
;
import
{
setupI18n
}
from
'
/@/locales/setupI18n
'
;
import
{
router
,
setupRouter
}
from
'
@/router
'
;
import
{
registerGlobComp
}
from
'
/@/components/registerGlobComp
'
;
import
{
setupRouterGuard
}
from
'
@/router/guard
'
;
import
{
setupStore
}
from
'
@/store
'
;
import
App
from
'
./App.vue
'
;
async
function
bootstrap
()
{
async
function
bootstrap
()
{
const
app
=
createApp
(
App
);
const
app
=
createApp
(
App
);
...
...
tsconfig.json
浏览文件 @
5e8ef2f6
{
{
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"$schema"
:
"https://json.schemastore.org/tsconfig"
,
"extends"
:
"@vben/ts-config/vue.json"
,
"extends"
:
"@vben/ts-config/vue
-app
.json"
,
"compilerOptions"
:
{
"compilerOptions"
:
{
"baseUrl"
:
".
/
"
,
"baseUrl"
:
"."
,
"types"
:
[
"vite/client"
],
"types"
:
[
"vite/client"
,
"unplugin-vue-define-options/macros-global"
],
"paths"
:
{
"paths"
:
{
"/@/*"
:
[
"src/*"
],
"/@/*"
:
[
"src/*"
],
"/#/*"
:
[
"types/*"
],
"/#/*"
:
[
"types/*"
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录