@quiteer/naive-extra 0.0.1
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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/components/breadcrumb/index.d.ts +0 -0
- package/dist/components/breadcrumb/index.vue.d.ts +3 -0
- package/dist/components/breadcrumb/props.d.ts +0 -0
- package/dist/components/button/action/index.d.ts +3 -0
- package/dist/components/button/action/index.vue.d.ts +118 -0
- package/dist/components/button/action/props.d.ts +63 -0
- package/dist/components/button/action/utils.d.ts +8 -0
- package/dist/components/button/base/index.d.ts +3 -0
- package/dist/components/button/base/index.vue.d.ts +36 -0
- package/dist/components/button/base/props.d.ts +27 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/button/types.d.ts +2 -0
- package/dist/components/form/helper.d.ts +11 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.vue.d.ts +642 -0
- package/dist/components/form/props.d.ts +34 -0
- package/dist/components/icon/IconPicker.vue.d.ts +13 -0
- package/dist/components/icon/iconify.d.ts +25 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.vue.d.ts +12 -0
- package/dist/components/layout/const.d.ts +22 -0
- package/dist/components/layout/context.d.ts +77 -0
- package/dist/components/layout/index.d.ts +5 -0
- package/dist/components/layout/index.vue.d.ts +80 -0
- package/dist/components/layout/layout-parts/AppBreadcrumb.vue.d.ts +3 -0
- package/dist/components/layout/layout-parts/AppFooter.vue.d.ts +18 -0
- package/dist/components/layout/layout-parts/AppHeader.vue.d.ts +18 -0
- package/dist/components/layout/layout-parts/AppLeftLogoInfo.vue.d.ts +3 -0
- package/dist/components/layout/layout-parts/AppMain.vue.d.ts +18 -0
- package/dist/components/layout/layout-parts/AppSidebar.vue.d.ts +4067 -0
- package/dist/components/layout/layout-parts/LayoutTransition.vue.d.ts +58 -0
- package/dist/components/layout/mode.d.ts +0 -0
- package/dist/components/layout/props.d.ts +35 -0
- package/dist/components/layout/types.d.ts +59 -0
- package/dist/components/layout/utils.d.ts +97 -0
- package/dist/components/provider/index.d.ts +3 -0
- package/dist/components/provider/index.vue.d.ts +19 -0
- package/dist/components/provider/props.d.ts +33 -0
- package/dist/components/search-bar/index.d.ts +3 -0
- package/dist/components/search-bar/index.vue.d.ts +1288 -0
- package/dist/components/search-bar/props.d.ts +15 -0
- package/dist/components/table/TableSetting.vue.d.ts +15 -0
- package/dist/components/table/index.d.ts +4 -0
- package/dist/components/table/index.vue.d.ts +17246 -0
- package/dist/components/table/props.d.ts +26 -0
- package/dist/components/table/useColumn.d.ts +15 -0
- package/dist/components/upload/enum.d.ts +18 -0
- package/dist/components/upload/index.d.ts +4 -0
- package/dist/components/upload/index.vue.d.ts +17 -0
- package/dist/components/upload/props.d.ts +7 -0
- package/dist/const/defaults.d.ts +7 -0
- package/dist/const/index.d.ts +2 -0
- package/dist/const/types.d.ts +134 -0
- package/dist/context/color.d.ts +13 -0
- package/dist/context/common.d.ts +117 -0
- package/dist/context/index.d.ts +41 -0
- package/dist/context/layout.d.ts +52 -0
- package/dist/context/loading-bar.d.ts +14 -0
- package/dist/context/locale.d.ts +143 -0
- package/dist/context/menu.d.ts +212 -0
- package/dist/context/message.d.ts +14 -0
- package/dist/context/notification.d.ts +14 -0
- package/dist/context/table.d.ts +917 -0
- package/dist/context/theme.d.ts +20 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/useAdmin.d.ts +0 -0
- package/dist/hooks/useForm.d.ts +54 -0
- package/dist/hooks/useLayout.d.ts +116 -0
- package/dist/hooks/useProviderContext.d.ts +17 -0
- package/dist/hooks/useTable.d.ts +66 -0
- package/dist/hooks/useThemeOverrides.d.ts +8 -0
- package/dist/hooks/useUpload.d.ts +22 -0
- package/dist/index.css +36 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +6771 -0
- package/dist/share/compact.d.ts +16 -0
- package/dist/share/index.d.ts +2 -0
- package/dist/share/menu.d.ts +0 -0
- package/dist/share/route.d.ts +0 -0
- package/dist/share/slot.d.ts +6 -0
- package/dist/utils/form.d.ts +0 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/utils/transformRoutes.d.ts +67 -0
- package/dist/utils/tree.d.ts +6 -0
- package/package.json +53 -0
- package/src/auto-imports.d.ts +73 -0
- package/src/components/breadcrumb/index.ts +0 -0
- package/src/components/breadcrumb/index.vue +0 -0
- package/src/components/breadcrumb/props.ts +0 -0
- package/src/components/button/action/index.ts +4 -0
- package/src/components/button/action/index.vue +313 -0
- package/src/components/button/action/props.ts +78 -0
- package/src/components/button/action/utils.ts +122 -0
- package/src/components/button/base/index.ts +4 -0
- package/src/components/button/base/index.vue +156 -0
- package/src/components/button/base/props.ts +29 -0
- package/src/components/button/index.ts +4 -0
- package/src/components/button/types.ts +2 -0
- package/src/components/form/helper.ts +73 -0
- package/src/components/form/index.ts +5 -0
- package/src/components/form/index.vue +243 -0
- package/src/components/form/props.ts +75 -0
- package/src/components/icon/IconPicker.vue +255 -0
- package/src/components/icon/iconify.ts +80 -0
- package/src/components/icon/index.ts +7 -0
- package/src/components/icon/index.vue +23 -0
- package/src/components/layout/const.ts +102 -0
- package/src/components/layout/context.ts +189 -0
- package/src/components/layout/index.ts +8 -0
- package/src/components/layout/index.vue +64 -0
- package/src/components/layout/layout-parts/AppBreadcrumb.vue +108 -0
- package/src/components/layout/layout-parts/AppFooter.vue +26 -0
- package/src/components/layout/layout-parts/AppHeader.vue +112 -0
- package/src/components/layout/layout-parts/AppLeftLogoInfo.vue +30 -0
- package/src/components/layout/layout-parts/AppMain.vue +34 -0
- package/src/components/layout/layout-parts/AppSidebar.vue +174 -0
- package/src/components/layout/layout-parts/LayoutTransition.vue +366 -0
- package/src/components/layout/mode.ts +0 -0
- package/src/components/layout/props.ts +36 -0
- package/src/components/layout/types.ts +79 -0
- package/src/components/layout/utils.ts +201 -0
- package/src/components/provider/index.ts +5 -0
- package/src/components/provider/index.vue +69 -0
- package/src/components/provider/props.ts +45 -0
- package/src/components/search-bar/index.ts +5 -0
- package/src/components/search-bar/index.vue +282 -0
- package/src/components/search-bar/props.ts +26 -0
- package/src/components/table/TableSetting.vue +253 -0
- package/src/components/table/index.ts +14 -0
- package/src/components/table/index.vue +179 -0
- package/src/components/table/props.ts +29 -0
- package/src/components/table/useColumn.ts +104 -0
- package/src/components/upload/enum.ts +21 -0
- package/src/components/upload/index.ts +9 -0
- package/src/components/upload/index.vue +267 -0
- package/src/components/upload/props.ts +8 -0
- package/src/components.d.ts +154 -0
- package/src/const/defaults.ts +94 -0
- package/src/const/index.ts +2 -0
- package/src/const/types.ts +139 -0
- package/src/context/color.ts +53 -0
- package/src/context/common.ts +27 -0
- package/src/context/index.ts +141 -0
- package/src/context/layout.ts +34 -0
- package/src/context/loading-bar.ts +26 -0
- package/src/context/locale.ts +22 -0
- package/src/context/menu.ts +26 -0
- package/src/context/message.ts +30 -0
- package/src/context/notification.ts +29 -0
- package/src/context/table.ts +32 -0
- package/src/context/theme.ts +35 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useAdmin.ts +0 -0
- package/src/hooks/useForm.ts +272 -0
- package/src/hooks/useLayout.ts +300 -0
- package/src/hooks/useProviderContext.ts +47 -0
- package/src/hooks/useTable.ts +241 -0
- package/src/hooks/useThemeOverrides.ts +18 -0
- package/src/hooks/useUpload.ts +82 -0
- package/src/index.ts +59 -0
- package/src/share/compact.ts +35 -0
- package/src/share/index.ts +2 -0
- package/src/share/menu.ts +0 -0
- package/src/share/route.ts +0 -0
- package/src/share/slot.ts +29 -0
- package/src/utils/form.ts +0 -0
- package/src/utils/index.ts +0 -0
- package/src/utils/transformRoutes.ts +163 -0
- package/src/utils/tree.ts +31 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { UploadFileInfo, UploadProps } from 'naive-ui'
|
|
3
|
+
import type { Props } from './props'
|
|
4
|
+
import { isArray, isString } from '@quiteer/is'
|
|
5
|
+
import { computed, nextTick, ref, useAttrs, watchEffect } from 'vue'
|
|
6
|
+
|
|
7
|
+
interface FileListItem {
|
|
8
|
+
id: string
|
|
9
|
+
name: string
|
|
10
|
+
url: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = defineProps<Props>()
|
|
14
|
+
|
|
15
|
+
const attrs = useAttrs()
|
|
16
|
+
|
|
17
|
+
const uploadProps = computed<UploadProps>(() => {
|
|
18
|
+
return {
|
|
19
|
+
...attrs,
|
|
20
|
+
isErrorState,
|
|
21
|
+
onFinish: handleFinish,
|
|
22
|
+
onRemove: handleRemove,
|
|
23
|
+
onError: handleError,
|
|
24
|
+
onBeforeUpload: handleBeforeUpload
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const modelValue = defineModel<FileListItem[] | string | undefined>('value')
|
|
29
|
+
|
|
30
|
+
const isSingle = computed(() => props.max === 1)
|
|
31
|
+
const accept = computed(() => (props.accept as string) ?? '')
|
|
32
|
+
const fileSize = computed(() => (props.fileSize as number) ?? 0)
|
|
33
|
+
const showTip = computed(() => props.accept || props.fileSize)
|
|
34
|
+
|
|
35
|
+
const fileList = ref<UploadFileInfo[]>([])
|
|
36
|
+
|
|
37
|
+
function transformList(uri: FileListItem[] | undefined | null): UploadFileInfo[] {
|
|
38
|
+
if (!uri)
|
|
39
|
+
return []
|
|
40
|
+
|
|
41
|
+
if (Array.isArray(uri)) {
|
|
42
|
+
return uri.map((item) => {
|
|
43
|
+
return {
|
|
44
|
+
...item,
|
|
45
|
+
status: 'finished'
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
return []
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
watchEffect(() => {
|
|
53
|
+
if (isString(modelValue.value)) {
|
|
54
|
+
fileList.value = [{ id: '0', name: '文件', url: modelValue.value, status: 'finished' }]
|
|
55
|
+
}
|
|
56
|
+
else if (isArray(modelValue.value)) {
|
|
57
|
+
fileList.value = transformList(modelValue.value)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
function isErrorState(xhr: XMLHttpRequest) {
|
|
62
|
+
const responseText = xhr?.responseText
|
|
63
|
+
const response = JSON.parse(responseText)
|
|
64
|
+
return response.code !== 200
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 函数:文件上传完成后的处理
|
|
68
|
+
// 作用:根据配置更新 v-model 的值(字符串或列表),并返回 UploadFileInfo
|
|
69
|
+
function handleFinish({ file, event }: { file: UploadFileInfo, event?: ProgressEvent }) {
|
|
70
|
+
console.log('handleFinish :>> ', file)
|
|
71
|
+
|
|
72
|
+
const result = JSON.parse((event?.target as unknown as any)?.response)?.data as {
|
|
73
|
+
url: string
|
|
74
|
+
fileName: string
|
|
75
|
+
ossId: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (props.dataType === 'string') {
|
|
79
|
+
modelValue.value = result.url
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (!isArray(modelValue.value))
|
|
83
|
+
modelValue.value = []
|
|
84
|
+
nextTick(() => {
|
|
85
|
+
(modelValue.value as FileListItem[])?.push({
|
|
86
|
+
id: result.ossId,
|
|
87
|
+
name: result.fileName,
|
|
88
|
+
url: result.url
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return file
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 函数:移除文件后的处理
|
|
97
|
+
// 作用:根据是否单文件模式更新 v-model 的列表
|
|
98
|
+
function handleRemove({ index }: { index: number }) {
|
|
99
|
+
console.log('handleRemove :>> ', index)
|
|
100
|
+
if (isSingle.value) {
|
|
101
|
+
modelValue.value = []
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
modelValue.value = (modelValue.value as FileListItem[])?.filter((_, i) => i !== index)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 函数:上传错误时的处理
|
|
109
|
+
// 作用:打印后端返回的错误信息
|
|
110
|
+
function handleError(options: { file: UploadFileInfo, event?: ProgressEvent }) {
|
|
111
|
+
console.log('handleError :>> ', options)
|
|
112
|
+
const { event } = options
|
|
113
|
+
// @ts-expect-error Ignore type errors
|
|
114
|
+
const responseText = event?.target?.responseText
|
|
115
|
+
const resObj = JSON.parse(responseText)
|
|
116
|
+
console.error('resObj: ', resObj)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 函数:上传前校验
|
|
120
|
+
// 作用:校验类型、大小、文件名合法性,返回是否允许上传
|
|
121
|
+
function handleBeforeUpload(options: { file: UploadFileInfo, fileList: UploadFileInfo[] }) {
|
|
122
|
+
console.log('handleBeforeUpload: ', options)
|
|
123
|
+
const { file } = options
|
|
124
|
+
|
|
125
|
+
// 校检文件类型
|
|
126
|
+
if (props?.accept) {
|
|
127
|
+
const fileName = file.name.split('.')
|
|
128
|
+
const fileExt = `.${fileName[fileName.length - 1]}`
|
|
129
|
+
const isTypeOk = accept.value.split(',')?.includes(fileExt)
|
|
130
|
+
if (!isTypeOk) {
|
|
131
|
+
return false
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// 校检文件名是否包含特殊字符
|
|
135
|
+
if (file.name.includes(',')) {
|
|
136
|
+
return false
|
|
137
|
+
}
|
|
138
|
+
// 校检文件大小
|
|
139
|
+
if (props.fileSize && file.file?.size) {
|
|
140
|
+
const isLt = file.file?.size / 1024 / 1024 < fileSize.value
|
|
141
|
+
if (!isLt) {
|
|
142
|
+
return false
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return true
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<template>
|
|
150
|
+
<template v-if="props.fileType === 'file'">
|
|
151
|
+
<NUpload v-bind="uploadProps" v-model:file-list="fileList">
|
|
152
|
+
<NButton>上传文件</NButton>
|
|
153
|
+
</NUpload>
|
|
154
|
+
</template>
|
|
155
|
+
<template v-else-if="props.fileType === 'dragger-file'">
|
|
156
|
+
<div class="w-full flex-col">
|
|
157
|
+
<NUpload
|
|
158
|
+
v-bind="uploadProps"
|
|
159
|
+
v-model:file-list="fileList"
|
|
160
|
+
:multiple="!isSingle"
|
|
161
|
+
directory-dnd
|
|
162
|
+
list-type="image"
|
|
163
|
+
>
|
|
164
|
+
<NUploadDragger>
|
|
165
|
+
<div class="mb-12px flex-center">
|
|
166
|
+
<i class="i-material-symbols:upload-file text-58px color-#d8d8db dark:color-#a1a1a2" />
|
|
167
|
+
</div>
|
|
168
|
+
<NText class="text-16px">
|
|
169
|
+
点击或者拖动文件到该区域来上传
|
|
170
|
+
</NText>
|
|
171
|
+
<NP v-if="showTip" depth="3" class="mt-8px text-center">
|
|
172
|
+
请上传
|
|
173
|
+
<template v-if="fileSize">
|
|
174
|
+
大小不超过
|
|
175
|
+
<b class="text-red-500">{{ fileSize }}MB</b>
|
|
176
|
+
</template>
|
|
177
|
+
<template v-if="accept">
|
|
178
|
+
,且格式为
|
|
179
|
+
<b class="text-red-500">{{ accept?.split(',').join('/') }}</b>
|
|
180
|
+
</template>
|
|
181
|
+
的文件
|
|
182
|
+
</NP>
|
|
183
|
+
</NUploadDragger>
|
|
184
|
+
</NUpload>
|
|
185
|
+
</div>
|
|
186
|
+
</template>
|
|
187
|
+
<template v-else-if="props.fileType === 'image-view'">
|
|
188
|
+
<template v-if="!props.disabled">
|
|
189
|
+
<NUpload v-bind="uploadProps" v-model:file-list="fileList" list-type="image-card" />
|
|
190
|
+
</template>
|
|
191
|
+
<NImageGroup v-else>
|
|
192
|
+
<NSpace>
|
|
193
|
+
<NImage v-for="(item, i) in fileList" :key="i" width="100" :src="item.url ?? ''" />
|
|
194
|
+
</NSpace>
|
|
195
|
+
</NImageGroup>
|
|
196
|
+
</template>
|
|
197
|
+
<template v-else-if="props.fileType === 'video-view'">
|
|
198
|
+
<template v-if="!props.disabled">
|
|
199
|
+
<NUpload v-bind="uploadProps" v-model:file-list="fileList" :show-file-list="false">
|
|
200
|
+
<NButton>上传视频</NButton>
|
|
201
|
+
</NUpload>
|
|
202
|
+
<NSpace class="mt-12px">
|
|
203
|
+
<div v-for="(item, i) in fileList" :key="i" style="width: 320px;">
|
|
204
|
+
<video
|
|
205
|
+
v-if="item.url"
|
|
206
|
+
:src="item.url"
|
|
207
|
+
controls
|
|
208
|
+
style="width: 100%; border-radius: 8px; background: #000;"
|
|
209
|
+
/>
|
|
210
|
+
<NText v-else>
|
|
211
|
+
暂无预览
|
|
212
|
+
</NText>
|
|
213
|
+
</div>
|
|
214
|
+
</NSpace>
|
|
215
|
+
</template>
|
|
216
|
+
<NSpace v-else>
|
|
217
|
+
<div v-for="(item, i) in fileList" :key="i" style="width: 320px;">
|
|
218
|
+
<video
|
|
219
|
+
v-if="item.url"
|
|
220
|
+
:src="item.url"
|
|
221
|
+
controls
|
|
222
|
+
style="width: 100%; border-radius: 8px; background: #000;"
|
|
223
|
+
/>
|
|
224
|
+
<NText v-else>
|
|
225
|
+
暂无预览
|
|
226
|
+
</NText>
|
|
227
|
+
</div>
|
|
228
|
+
</NSpace>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<template v-else-if="props.fileType === 'audio-view'">
|
|
232
|
+
<template v-if="!props.disabled">
|
|
233
|
+
<NUpload
|
|
234
|
+
v-bind="uploadProps" v-model:file-list="fileList"
|
|
235
|
+
:show-file-list="false"
|
|
236
|
+
>
|
|
237
|
+
<NButton>上传音频</NButton>
|
|
238
|
+
</NUpload>
|
|
239
|
+
<NSpace class="mt-12px">
|
|
240
|
+
<div v-for="(item, i) in fileList" :key="i" style="width: 320px;">
|
|
241
|
+
<audio
|
|
242
|
+
v-if="item.url"
|
|
243
|
+
:src="item.url"
|
|
244
|
+
controls
|
|
245
|
+
style="width: 100%;"
|
|
246
|
+
/>
|
|
247
|
+
<NText v-else>
|
|
248
|
+
暂无预览
|
|
249
|
+
</NText>
|
|
250
|
+
</div>
|
|
251
|
+
</NSpace>
|
|
252
|
+
</template>
|
|
253
|
+
<NSpace v-else>
|
|
254
|
+
<div v-for="(item, i) in fileList" :key="i" style="width: 320px;">
|
|
255
|
+
<audio
|
|
256
|
+
v-if="item.url"
|
|
257
|
+
:src="item.url"
|
|
258
|
+
controls
|
|
259
|
+
style="width: 100%;"
|
|
260
|
+
/>
|
|
261
|
+
<NText v-else>
|
|
262
|
+
暂无预览
|
|
263
|
+
</NText>
|
|
264
|
+
</div>
|
|
265
|
+
</NSpace>
|
|
266
|
+
</template>
|
|
267
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UploadProps } from 'naive-ui'
|
|
2
|
+
|
|
3
|
+
export interface Props extends /* @vue-ignore */ UploadProps {
|
|
4
|
+
fileType: 'image-view' | 'video-view' | 'audio-view' | 'file' | 'dragger-file'
|
|
5
|
+
fileSize?: number
|
|
6
|
+
/** 传入string返回值为url 不传默认数据为数组形式 */
|
|
7
|
+
dataType?: 'string'
|
|
8
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// biome-ignore lint: disable
|
|
4
|
+
// oxlint-disable
|
|
5
|
+
// ------
|
|
6
|
+
// Generated by unplugin-vue-components
|
|
7
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
8
|
+
import { GlobalComponents } from 'vue'
|
|
9
|
+
|
|
10
|
+
export {}
|
|
11
|
+
|
|
12
|
+
/* prettier-ignore */
|
|
13
|
+
declare module 'vue' {
|
|
14
|
+
export interface GlobalComponents {
|
|
15
|
+
Action: typeof import('./components/button/action/index.vue')['default']
|
|
16
|
+
AppBreadcrumb: typeof import('./components/layout/layout-parts/AppBreadcrumb.vue')['default']
|
|
17
|
+
AppFooter: typeof import('./components/layout/layout-parts/AppFooter.vue')['default']
|
|
18
|
+
AppHeader: typeof import('./components/layout/layout-parts/AppHeader.vue')['default']
|
|
19
|
+
AppLeftLogoInfo: typeof import('./components/layout/layout-parts/AppLeftLogoInfo.vue')['default']
|
|
20
|
+
AppMain: typeof import('./components/layout/layout-parts/AppMain.vue')['default']
|
|
21
|
+
AppSidebar: typeof import('./components/layout/layout-parts/AppSidebar.vue')['default']
|
|
22
|
+
Base: typeof import('./components/button/base/index.vue')['default']
|
|
23
|
+
Breadcrumb: typeof import('./components/breadcrumb/index.vue')['default']
|
|
24
|
+
Form: typeof import('./components/form/index.vue')['default']
|
|
25
|
+
Icon: typeof import('./components/icon/index.vue')['default']
|
|
26
|
+
IconPicker: typeof import('./components/icon/IconPicker.vue')['default']
|
|
27
|
+
Layout: typeof import('./components/layout/index.vue')['default']
|
|
28
|
+
LayoutTransition: typeof import('./components/layout/layout-parts/LayoutTransition.vue')['default']
|
|
29
|
+
NBreadcrumb: typeof import('naive-ui')['NBreadcrumb']
|
|
30
|
+
NBreadcrumbItem: typeof import('naive-ui')['NBreadcrumbItem']
|
|
31
|
+
NButton: typeof import('naive-ui')['NButton']
|
|
32
|
+
NCard: typeof import('naive-ui')['NCard']
|
|
33
|
+
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
|
34
|
+
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
|
35
|
+
NCollapse: typeof import('naive-ui')['NCollapse']
|
|
36
|
+
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
|
|
37
|
+
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
|
38
|
+
NDataTable: typeof import('naive-ui')['NDataTable']
|
|
39
|
+
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
|
40
|
+
NDivider: typeof import('naive-ui')['NDivider']
|
|
41
|
+
NDropdown: typeof import('naive-ui')['NDropdown']
|
|
42
|
+
NEmpty: typeof import('naive-ui')['NEmpty']
|
|
43
|
+
NFlex: typeof import('naive-ui')['NFlex']
|
|
44
|
+
NForm: typeof import('naive-ui')['NForm']
|
|
45
|
+
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
|
46
|
+
NGi: typeof import('naive-ui')['NGi']
|
|
47
|
+
NGrid: typeof import('naive-ui')['NGrid']
|
|
48
|
+
NImage: typeof import('naive-ui')['NImage']
|
|
49
|
+
NImageGroup: typeof import('naive-ui')['NImageGroup']
|
|
50
|
+
NInput: typeof import('naive-ui')['NInput']
|
|
51
|
+
NLayout: typeof import('naive-ui')['NLayout']
|
|
52
|
+
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
|
|
53
|
+
NLayoutFooter: typeof import('naive-ui')['NLayoutFooter']
|
|
54
|
+
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
|
|
55
|
+
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
|
56
|
+
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
|
57
|
+
NMenu: typeof import('naive-ui')['NMenu']
|
|
58
|
+
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
|
59
|
+
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
|
60
|
+
NP: typeof import('naive-ui')['NP']
|
|
61
|
+
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
|
62
|
+
NPopover: typeof import('naive-ui')['NPopover']
|
|
63
|
+
NRadio: typeof import('naive-ui')['NRadio']
|
|
64
|
+
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
|
65
|
+
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
|
66
|
+
NSelect: typeof import('naive-ui')['NSelect']
|
|
67
|
+
NSpace: typeof import('naive-ui')['NSpace']
|
|
68
|
+
NSpin: typeof import('naive-ui')['NSpin']
|
|
69
|
+
NSwitch: typeof import('naive-ui')['NSwitch']
|
|
70
|
+
NTag: typeof import('naive-ui')['NTag']
|
|
71
|
+
NText: typeof import('naive-ui')['NText']
|
|
72
|
+
NTooltip: typeof import('naive-ui')['NTooltip']
|
|
73
|
+
NUpload: typeof import('naive-ui')['NUpload']
|
|
74
|
+
NUploadDragger: typeof import('naive-ui')['NUploadDragger']
|
|
75
|
+
Provider: typeof import('./components/provider/index.vue')['default']
|
|
76
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
|
77
|
+
RouterView: typeof import('vue-router')['RouterView']
|
|
78
|
+
SearchBar: typeof import('./components/search-bar/index.vue')['default']
|
|
79
|
+
Table: typeof import('./components/table/index.vue')['default']
|
|
80
|
+
TableSetting: typeof import('./components/table/TableSetting.vue')['default']
|
|
81
|
+
Upload: typeof import('./components/upload/index.vue')['default']
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// For TSX support
|
|
86
|
+
declare global {
|
|
87
|
+
const Action: typeof import('./components/button/action/index.vue')['default']
|
|
88
|
+
const AppBreadcrumb: typeof import('./components/layout/layout-parts/AppBreadcrumb.vue')['default']
|
|
89
|
+
const AppFooter: typeof import('./components/layout/layout-parts/AppFooter.vue')['default']
|
|
90
|
+
const AppHeader: typeof import('./components/layout/layout-parts/AppHeader.vue')['default']
|
|
91
|
+
const AppLeftLogoInfo: typeof import('./components/layout/layout-parts/AppLeftLogoInfo.vue')['default']
|
|
92
|
+
const AppMain: typeof import('./components/layout/layout-parts/AppMain.vue')['default']
|
|
93
|
+
const AppSidebar: typeof import('./components/layout/layout-parts/AppSidebar.vue')['default']
|
|
94
|
+
const Base: typeof import('./components/button/base/index.vue')['default']
|
|
95
|
+
const Breadcrumb: typeof import('./components/breadcrumb/index.vue')['default']
|
|
96
|
+
const Form: typeof import('./components/form/index.vue')['default']
|
|
97
|
+
const Icon: typeof import('./components/icon/index.vue')['default']
|
|
98
|
+
const IconPicker: typeof import('./components/icon/IconPicker.vue')['default']
|
|
99
|
+
const Layout: typeof import('./components/layout/index.vue')['default']
|
|
100
|
+
const LayoutTransition: typeof import('./components/layout/layout-parts/LayoutTransition.vue')['default']
|
|
101
|
+
const NBreadcrumb: typeof import('naive-ui')['NBreadcrumb']
|
|
102
|
+
const NBreadcrumbItem: typeof import('naive-ui')['NBreadcrumbItem']
|
|
103
|
+
const NButton: typeof import('naive-ui')['NButton']
|
|
104
|
+
const NCard: typeof import('naive-ui')['NCard']
|
|
105
|
+
const NCheckbox: typeof import('naive-ui')['NCheckbox']
|
|
106
|
+
const NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
|
107
|
+
const NCollapse: typeof import('naive-ui')['NCollapse']
|
|
108
|
+
const NCollapseItem: typeof import('naive-ui')['NCollapseItem']
|
|
109
|
+
const NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
|
110
|
+
const NDataTable: typeof import('naive-ui')['NDataTable']
|
|
111
|
+
const NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
|
112
|
+
const NDivider: typeof import('naive-ui')['NDivider']
|
|
113
|
+
const NDropdown: typeof import('naive-ui')['NDropdown']
|
|
114
|
+
const NEmpty: typeof import('naive-ui')['NEmpty']
|
|
115
|
+
const NFlex: typeof import('naive-ui')['NFlex']
|
|
116
|
+
const NForm: typeof import('naive-ui')['NForm']
|
|
117
|
+
const NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
|
118
|
+
const NGi: typeof import('naive-ui')['NGi']
|
|
119
|
+
const NGrid: typeof import('naive-ui')['NGrid']
|
|
120
|
+
const NImage: typeof import('naive-ui')['NImage']
|
|
121
|
+
const NImageGroup: typeof import('naive-ui')['NImageGroup']
|
|
122
|
+
const NInput: typeof import('naive-ui')['NInput']
|
|
123
|
+
const NLayout: typeof import('naive-ui')['NLayout']
|
|
124
|
+
const NLayoutContent: typeof import('naive-ui')['NLayoutContent']
|
|
125
|
+
const NLayoutFooter: typeof import('naive-ui')['NLayoutFooter']
|
|
126
|
+
const NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
|
|
127
|
+
const NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
|
128
|
+
const NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
|
|
129
|
+
const NMenu: typeof import('naive-ui')['NMenu']
|
|
130
|
+
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
|
131
|
+
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
|
132
|
+
const NP: typeof import('naive-ui')['NP']
|
|
133
|
+
const NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
|
134
|
+
const NPopover: typeof import('naive-ui')['NPopover']
|
|
135
|
+
const NRadio: typeof import('naive-ui')['NRadio']
|
|
136
|
+
const NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
|
137
|
+
const NScrollbar: typeof import('naive-ui')['NScrollbar']
|
|
138
|
+
const NSelect: typeof import('naive-ui')['NSelect']
|
|
139
|
+
const NSpace: typeof import('naive-ui')['NSpace']
|
|
140
|
+
const NSpin: typeof import('naive-ui')['NSpin']
|
|
141
|
+
const NSwitch: typeof import('naive-ui')['NSwitch']
|
|
142
|
+
const NTag: typeof import('naive-ui')['NTag']
|
|
143
|
+
const NText: typeof import('naive-ui')['NText']
|
|
144
|
+
const NTooltip: typeof import('naive-ui')['NTooltip']
|
|
145
|
+
const NUpload: typeof import('naive-ui')['NUpload']
|
|
146
|
+
const NUploadDragger: typeof import('naive-ui')['NUploadDragger']
|
|
147
|
+
const Provider: typeof import('./components/provider/index.vue')['default']
|
|
148
|
+
const RouterLink: typeof import('vue-router')['RouterLink']
|
|
149
|
+
const RouterView: typeof import('vue-router')['RouterView']
|
|
150
|
+
const SearchBar: typeof import('./components/search-bar/index.vue')['default']
|
|
151
|
+
const Table: typeof import('./components/table/index.vue')['default']
|
|
152
|
+
const TableSetting: typeof import('./components/table/TableSetting.vue')['default']
|
|
153
|
+
const Upload: typeof import('./components/upload/index.vue')['default']
|
|
154
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { NaiveExtraThemeConfig } from './types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 默认主题配置托底
|
|
5
|
+
*
|
|
6
|
+
* 包含全局组件的默认样式与尺寸行为,确保在用户未提供配置时系统仍能正常运行。
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_THEME_CONFIG: NaiveExtraThemeConfig = {
|
|
9
|
+
themeMode: 'light',
|
|
10
|
+
localeMode: 'zh',
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
palette: {
|
|
13
|
+
primary: '#18a058',
|
|
14
|
+
info: '#2080f0',
|
|
15
|
+
success: '#18a058',
|
|
16
|
+
warning: '#f0a020',
|
|
17
|
+
error: '#d03050'
|
|
18
|
+
},
|
|
19
|
+
common: {},
|
|
20
|
+
table: {
|
|
21
|
+
striped: true,
|
|
22
|
+
rowClassName: undefined,
|
|
23
|
+
onUpdatePage: undefined,
|
|
24
|
+
onUpdatePageSize: undefined,
|
|
25
|
+
tableColor: undefined,
|
|
26
|
+
tableHeaderColor: undefined,
|
|
27
|
+
tableColorStriped: undefined,
|
|
28
|
+
tableColorHover: undefined,
|
|
29
|
+
tdPaddingHorizontal: undefined,
|
|
30
|
+
tdPaddingVertical: undefined,
|
|
31
|
+
thPaddingHorizontal: undefined,
|
|
32
|
+
thPaddingVertical: undefined
|
|
33
|
+
},
|
|
34
|
+
layout: {
|
|
35
|
+
headerHeight: 64,
|
|
36
|
+
footerHeight: 48,
|
|
37
|
+
siderWidth: 240,
|
|
38
|
+
siderCollapsedWidth: 64,
|
|
39
|
+
mixedMenuWidth: 80,
|
|
40
|
+
mixedMenuCollapsedWidth: 48,
|
|
41
|
+
color: undefined,
|
|
42
|
+
colorEmbedded: undefined,
|
|
43
|
+
headerColor: undefined,
|
|
44
|
+
footerColor: undefined,
|
|
45
|
+
siderColor: undefined,
|
|
46
|
+
showFooter: true,
|
|
47
|
+
showHeader: true,
|
|
48
|
+
showTabs: true,
|
|
49
|
+
fixedHeader: true,
|
|
50
|
+
fixedFooter: true
|
|
51
|
+
},
|
|
52
|
+
menu: {
|
|
53
|
+
accordion: true,
|
|
54
|
+
collapsedIconSize: 22,
|
|
55
|
+
iconSize: 20,
|
|
56
|
+
indent: 24,
|
|
57
|
+
inverted: false,
|
|
58
|
+
itemHeight: 42,
|
|
59
|
+
collapsedWidth: 64
|
|
60
|
+
},
|
|
61
|
+
tabs: {
|
|
62
|
+
type: 'card',
|
|
63
|
+
closable: true,
|
|
64
|
+
animated: true,
|
|
65
|
+
showIcon: true
|
|
66
|
+
},
|
|
67
|
+
scrollbar: {
|
|
68
|
+
trigger: 'hover',
|
|
69
|
+
xScrollable: true
|
|
70
|
+
},
|
|
71
|
+
breadcrumb: {
|
|
72
|
+
showIcon: true,
|
|
73
|
+
separator: '/'
|
|
74
|
+
},
|
|
75
|
+
message: {
|
|
76
|
+
duration: 3000,
|
|
77
|
+
max: 3,
|
|
78
|
+
placement: 'top',
|
|
79
|
+
showIcon: true,
|
|
80
|
+
closable: false
|
|
81
|
+
},
|
|
82
|
+
notification: {
|
|
83
|
+
duration: 5000,
|
|
84
|
+
max: 5,
|
|
85
|
+
placement: 'top-right'
|
|
86
|
+
},
|
|
87
|
+
loadingBar: {
|
|
88
|
+
loadingBarStyle: {
|
|
89
|
+
loading: undefined,
|
|
90
|
+
error: undefined
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
overrides: {}
|
|
94
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { GlobalThemeOverrides } from 'naive-ui'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 表格主题配置接口
|
|
5
|
+
*/
|
|
6
|
+
export interface TableThemeConfig {
|
|
7
|
+
/** 是否开启斑马纹 */
|
|
8
|
+
striped?: boolean
|
|
9
|
+
/** 行类名 */
|
|
10
|
+
rowClassName?: string | ((row: any) => string)
|
|
11
|
+
/** 分页回调 */
|
|
12
|
+
onUpdatePage?: (page: number) => void
|
|
13
|
+
/** 每页条数回调 */
|
|
14
|
+
onUpdatePageSize?: (pageSize: number) => void
|
|
15
|
+
/** 表格背景色 */
|
|
16
|
+
tableColor?: string
|
|
17
|
+
/** 表头背景色 */
|
|
18
|
+
tableHeaderColor?: string
|
|
19
|
+
/** 斑马纹颜色 */
|
|
20
|
+
tableColorStriped?: string
|
|
21
|
+
/** 悬浮行背景色 */
|
|
22
|
+
tableColorHover?: string
|
|
23
|
+
/** 单元格左右内边距 */
|
|
24
|
+
tdPaddingHorizontal?: string
|
|
25
|
+
/** 单元格上下内边距 */
|
|
26
|
+
tdPaddingVertical?: string
|
|
27
|
+
/** 表头单元格左右内边距 */
|
|
28
|
+
thPaddingHorizontal?: string
|
|
29
|
+
/** 表头单元格上下内边距 */
|
|
30
|
+
thPaddingVertical?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Naive UI 基础变量类型
|
|
35
|
+
*/
|
|
36
|
+
export type CommonThemeVars = NonNullable<GlobalThemeOverrides['common']>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 泛型对象类型
|
|
40
|
+
*/
|
|
41
|
+
export type Recordable<T = any> = Record<string, T>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 品牌色板类型
|
|
45
|
+
*/
|
|
46
|
+
export interface BrandPalette {
|
|
47
|
+
primary: string
|
|
48
|
+
info: string
|
|
49
|
+
success: string
|
|
50
|
+
warning: string
|
|
51
|
+
error: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 主题配置接口定义
|
|
56
|
+
*/
|
|
57
|
+
export interface NaiveExtraThemeConfig {
|
|
58
|
+
/** 主题模式 */
|
|
59
|
+
themeMode?: 'light' | 'dark' | 'system'
|
|
60
|
+
/** 语言模式 */
|
|
61
|
+
localeMode?: 'zh' | 'en'
|
|
62
|
+
/** 全局圆角 (px) */
|
|
63
|
+
borderRadius?: number
|
|
64
|
+
/** 品牌色板 */
|
|
65
|
+
palette?: Partial<BrandPalette>
|
|
66
|
+
/** 全局基础变量配置 (对应 Naive UI 的 common) */
|
|
67
|
+
common?: CommonThemeVars
|
|
68
|
+
/** 表格相关配置 */
|
|
69
|
+
table?: TableThemeConfig
|
|
70
|
+
/** 布局相关配置 */
|
|
71
|
+
layout?: {
|
|
72
|
+
headerHeight?: number
|
|
73
|
+
footerHeight?: number
|
|
74
|
+
siderWidth?: number
|
|
75
|
+
siderCollapsedWidth?: number
|
|
76
|
+
mixedMenuWidth?: number
|
|
77
|
+
mixedMenuCollapsedWidth?: number
|
|
78
|
+
color?: string
|
|
79
|
+
colorEmbedded?: string
|
|
80
|
+
headerColor?: string
|
|
81
|
+
footerColor?: string
|
|
82
|
+
siderColor?: string
|
|
83
|
+
showFooter?: boolean
|
|
84
|
+
showHeader?: boolean
|
|
85
|
+
showTabs?: boolean
|
|
86
|
+
fixedHeader?: boolean
|
|
87
|
+
fixedFooter?: boolean
|
|
88
|
+
}
|
|
89
|
+
/** 菜单相关配置 */
|
|
90
|
+
menu?: {
|
|
91
|
+
accordion?: boolean
|
|
92
|
+
collapsedIconSize?: number
|
|
93
|
+
iconSize?: number
|
|
94
|
+
indent?: number
|
|
95
|
+
inverted?: boolean
|
|
96
|
+
itemHeight?: number
|
|
97
|
+
collapsedWidth?: number
|
|
98
|
+
}
|
|
99
|
+
/** 标签页相关配置 */
|
|
100
|
+
tabs?: {
|
|
101
|
+
type?: 'line' | 'card' | 'bar'
|
|
102
|
+
closable?: boolean
|
|
103
|
+
animated?: boolean
|
|
104
|
+
showIcon?: boolean
|
|
105
|
+
}
|
|
106
|
+
/** 滚动条相关配置 */
|
|
107
|
+
scrollbar?: {
|
|
108
|
+
trigger?: 'none' | 'hover' | 'always'
|
|
109
|
+
xScrollable?: boolean
|
|
110
|
+
}
|
|
111
|
+
/** 面包屑相关配置 */
|
|
112
|
+
breadcrumb?: {
|
|
113
|
+
showIcon?: boolean
|
|
114
|
+
separator?: string
|
|
115
|
+
}
|
|
116
|
+
/** 消息配置 */
|
|
117
|
+
message?: {
|
|
118
|
+
duration?: number
|
|
119
|
+
max?: number
|
|
120
|
+
placement?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right'
|
|
121
|
+
showIcon?: boolean
|
|
122
|
+
closable?: boolean
|
|
123
|
+
}
|
|
124
|
+
/** 通知配置 */
|
|
125
|
+
notification?: {
|
|
126
|
+
duration?: number
|
|
127
|
+
max?: number
|
|
128
|
+
placement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
129
|
+
}
|
|
130
|
+
/** 加载条配置 */
|
|
131
|
+
loadingBar?: {
|
|
132
|
+
loadingBarStyle?: {
|
|
133
|
+
loading?: string
|
|
134
|
+
error?: string
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** 自定义 Naive UI 组件样式覆盖 (直接映射到 GlobalThemeOverrides) */
|
|
138
|
+
overrides?: GlobalThemeOverrides
|
|
139
|
+
}
|