fx-platform-ui 1.0.2 → 1.0.4-alpha1
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/lib/components/modal/index.d.ts +2 -0
- package/lib/components/modal/src/confirm-modal.vue.d.ts +2 -0
- package/lib/components/modal/src/content.vue.d.ts +17 -0
- package/lib/components/modal/src/index.d.ts +2 -0
- package/lib/components/upload/index.d.ts +2 -0
- package/lib/components/upload/src/hook/useUpload.d.ts +20 -0
- package/lib/components/upload/src/plat-upload-props.d.ts +131 -0
- package/lib/components/upload/src/types/acceptMax.d.ts +5 -0
- package/lib/components/upload/src/types/index.d.ts +1 -0
- package/lib/fx-platform-ui.mjs +4376 -82944
- package/lib/fx-platform-ui.umd.js +1 -202
- package/lib/style.css +1 -1
- package/package.json +19 -3
- package/packages/component.ts +22 -2
- package/packages/components/form/src/plat-form-props.ts +2 -1
- package/packages/components/modal/index.ts +9 -0
- package/packages/components/modal/src/confirm-modal.vue +58 -0
- package/packages/components/modal/src/content.vue +23 -0
- package/packages/components/modal/src/index.module.less +23 -0
- package/packages/components/modal/src/index.tsx +80 -0
- package/packages/components/modal/src/modal.vue +60 -0
- package/packages/components/modal/src/plat-modal-props.ts +55 -0
- package/packages/components/table/src/index.vue +6 -2
- package/packages/components/table/src/plat-table-props.ts +6 -1
- package/packages/components/upload/index.ts +10 -0
- package/packages/components/upload/src/hook/useUpload.ts +133 -0
- package/packages/components/upload/src/index.vue +158 -0
- package/packages/components/upload/src/plat-upload-props.ts +80 -0
- package/packages/components/upload/src/types/acceptMax.ts +5 -0
- package/packages/components/upload/src/types/index.ts +1 -0
- package/lib/packages/components/table/src/hook/useTableMethods.d.ts +0 -21
- package/lib/src/env.d.ts +0 -8
- /package/lib/{packages/components → components}/area/index.d.ts +0 -0
- /package/lib/{packages/components → components}/area/src/index.vue.d.ts +0 -0
- /package/lib/{packages/components → components}/confirm/index.d.ts +0 -0
- /package/lib/{packages/components → components}/confirm/src/confirm.vue.d.ts +0 -0
- /package/lib/{packages/components → components}/confirm/src/index.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/index.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/hook/index.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/hook/useEditorState.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/index.vue.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/plat-editor-emits.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/plat-editor-props.d.ts +0 -0
- /package/lib/{packages/components → components}/editor/src/type/index.d.ts +0 -0
- /package/lib/{packages/components → components}/form/index.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/hook/index.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/hook/useFormContext.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/hook/useFormEvents.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/hook/useFormLabel.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/hook/useFormMethods.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/methods.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/plat-form-emits.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/types/form.d.ts +0 -0
- /package/lib/{packages/components → components}/form/src/types/index.d.ts +0 -0
- /package/lib/{packages/components → components}/table/index.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/components/index.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/components/table-action.vue.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/components/tool-bar.vue.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/hook/index.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/hook/useTableForm.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/plat-table-emits.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/type/column.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/type/index.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/type/table.d.ts +0 -0
- /package/lib/{packages/components → components}/table/src/type/tableAction.d.ts +0 -0
- /package/lib/{packages/components → components}/tag-input/index.d.ts +0 -0
- /package/lib/{packages/components → components}/tag-input/src/index.vue.d.ts +0 -0
- /package/lib/{packages/index.d.ts → index.d.ts} +0 -0
- /package/lib/{packages/types → types}/global.d.ts +0 -0
- /package/lib/{packages/types → types}/index.d.ts +0 -0
- /package/lib/{packages/utils → utils}/dateUtil.d.ts +0 -0
- /package/lib/{packages/utils → utils}/index.d.ts +0 -0
- /package/lib/{packages/utils → utils}/is/index.d.ts +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { VNode, PropType, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { modalProps } from 'ant-design-vue/es/modal/Modal'
|
|
3
|
+
|
|
4
|
+
export const platModalProps = {
|
|
5
|
+
...modalProps(),
|
|
6
|
+
visible: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: false
|
|
9
|
+
},
|
|
10
|
+
centered: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
maskClosable: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
cancelText: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '取消'
|
|
21
|
+
},
|
|
22
|
+
okText: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '确定'
|
|
25
|
+
},
|
|
26
|
+
// 内容
|
|
27
|
+
content: {
|
|
28
|
+
type: [Object, String, Function] as PropType<VNode | string | (() => void)>,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
// 内容样式
|
|
32
|
+
contentStyle: {
|
|
33
|
+
type: Object as PropType<Recordable>,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
},
|
|
36
|
+
// 关闭函数
|
|
37
|
+
onCancel: {
|
|
38
|
+
type: Function as PropType<(() => Promise<any>) | (() => void)>
|
|
39
|
+
},
|
|
40
|
+
// 确认函数
|
|
41
|
+
onOk: {
|
|
42
|
+
type: Function as PropType<(() => Promise<any>) | (() => void)>
|
|
43
|
+
},
|
|
44
|
+
// 销毁函数
|
|
45
|
+
destroy: {
|
|
46
|
+
type: Function as PropType<(() => Promise<any>) | undefined>,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
close: {
|
|
50
|
+
type: Function as PropType<() => Promise<any>>,
|
|
51
|
+
default: () => {}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type PlatModalProps = Partial<ExtractPropTypes<typeof platModalProps>>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
</template>
|
|
72
72
|
|
|
73
73
|
<script lang="ts" setup>
|
|
74
|
-
import { onUpdated,
|
|
74
|
+
import { onUpdated, onBeforeMount } from 'vue'
|
|
75
75
|
import { Table } from 'ant-design-vue'
|
|
76
76
|
import PlForm from '../../form'
|
|
77
77
|
import { isFunction } from '../../../utils/is'
|
|
@@ -105,7 +105,11 @@ const {
|
|
|
105
105
|
fetchData
|
|
106
106
|
} = tableMethods
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
onBeforeMount(() => {
|
|
109
|
+
if (props.immediate) {
|
|
110
|
+
fetchData()
|
|
111
|
+
}
|
|
112
|
+
})
|
|
109
113
|
|
|
110
114
|
const instance = {
|
|
111
115
|
...props,
|
|
@@ -72,7 +72,12 @@ export const platTableProps = {
|
|
|
72
72
|
default: false
|
|
73
73
|
},
|
|
74
74
|
/** 通过dom操作分页样式 */
|
|
75
|
-
updatePageVnode: Function
|
|
75
|
+
updatePageVnode: Function,
|
|
76
|
+
/** 是否首次表格加载 */
|
|
77
|
+
immediate: {
|
|
78
|
+
type: Boolean as PropType<boolean>,
|
|
79
|
+
default: true
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
export type PlatTableProps = ExtractPropTypes<typeof platTableProps>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { unref, computed, toRefs } from 'vue'
|
|
2
|
+
import mime from 'mime'
|
|
3
|
+
import type { PlatUploadProps } from '../plat-upload-props'
|
|
4
|
+
// 错误常量状态
|
|
5
|
+
export enum ErrorStatus {
|
|
6
|
+
// 文件大小超出限制
|
|
7
|
+
FILE_SIZE = 'FILE_SIZE',
|
|
8
|
+
// 文件数量超出限制
|
|
9
|
+
FILE_NUMBER = 'FILE_NUMBER',
|
|
10
|
+
// 文件名称长度超出限制
|
|
11
|
+
FILE_NAME_LENGTH = 'FILE_NAME_LENGTH',
|
|
12
|
+
// 文件类型不符合
|
|
13
|
+
FILE_TYPE = 'FILE_TYPE',
|
|
14
|
+
// 单个文件数量超出限制
|
|
15
|
+
FILE_ACCEPT_NUMBER = 'FILE_ACCEPT_NUMBER'
|
|
16
|
+
}
|
|
17
|
+
export type UseUploadParams = {
|
|
18
|
+
props: PlatUploadProps
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useUpload({ props }: UseUploadParams) {
|
|
22
|
+
const { accept, maxSize, maxNumber, maxFileNameLength, rmsMaxFileArr } =
|
|
23
|
+
toRefs(props)
|
|
24
|
+
// 文件类型限制
|
|
25
|
+
const getAccept = computed(() => {
|
|
26
|
+
const _accept = unref(accept)
|
|
27
|
+
if (_accept && _accept.length > 0) {
|
|
28
|
+
return _accept
|
|
29
|
+
}
|
|
30
|
+
return []
|
|
31
|
+
})
|
|
32
|
+
// 文件类型限制获取字符串模式(ant design 需要)
|
|
33
|
+
const getStringAccept = computed(() => {
|
|
34
|
+
return unref(getAccept)
|
|
35
|
+
.map((item) => {
|
|
36
|
+
if (item.indexOf('/') > 0 || item.startsWith('.')) {
|
|
37
|
+
return item
|
|
38
|
+
} else {
|
|
39
|
+
return `.${item}`
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
.join(',')
|
|
43
|
+
})
|
|
44
|
+
// 检查文件大小
|
|
45
|
+
const checkFileSize = (file: File) => {
|
|
46
|
+
// 通过promise方式验证文件大小
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const _maxSize = unref(maxSize)
|
|
49
|
+
if (_maxSize && file.size > _maxSize * 1024 * 1024) {
|
|
50
|
+
reject({
|
|
51
|
+
status: ErrorStatus.FILE_SIZE,
|
|
52
|
+
text: `${file.name} 文件大小超出限制,最大为${_maxSize}MB,请重新上传!`
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
resolve(true)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
// 检查文件数量
|
|
59
|
+
const checkFileNumber = (fileList: File[]) => {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
const _maxNumber = unref(maxNumber)
|
|
62
|
+
if (_maxNumber && fileList.length > _maxNumber) {
|
|
63
|
+
reject({
|
|
64
|
+
status: ErrorStatus.FILE_NUMBER,
|
|
65
|
+
text: `一次性最多上传${_maxNumber}个文件,请重新上传!`
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
resolve(true)
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
// 检查文件名称长度
|
|
72
|
+
const checkFileNameLength = (file: File) => {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
const _maxFileNameLength = unref(maxFileNameLength)
|
|
75
|
+
if (_maxFileNameLength && file.name.length > _maxFileNameLength) {
|
|
76
|
+
reject({
|
|
77
|
+
status: ErrorStatus.FILE_NAME_LENGTH,
|
|
78
|
+
text: `${file.name} 文件名称长度超出限制,最大为${_maxFileNameLength}个字符,请重新上传!`
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
resolve(true)
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
// 检查文件类型
|
|
85
|
+
const checkFileType = (file: File) => {
|
|
86
|
+
const fileType: any = mime.getExtension(file.type)
|
|
87
|
+
console.log('fileType', mime.getExtension(file.type))
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
const _accept = unref(getAccept)
|
|
90
|
+
if (_accept.length > 0 && !_accept.includes(fileType)) {
|
|
91
|
+
reject({
|
|
92
|
+
status: ErrorStatus.FILE_TYPE,
|
|
93
|
+
text: `${file.name} 文件类型不符合,请重新上传!`
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
resolve(true)
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
// 根据文件类型 结合历史文件(fileList),添加数量限制
|
|
100
|
+
const checkFileLimit = (fileList: File[]) => {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const rmsMaxFileArrValue = unref(rmsMaxFileArr) || []
|
|
103
|
+
if (rmsMaxFileArrValue.length > 0) {
|
|
104
|
+
rmsMaxFileArrValue?.forEach((item) => {
|
|
105
|
+
const fileType = item.accept
|
|
106
|
+
const fileCount = fileList.filter((file) => {
|
|
107
|
+
const fileFileType: any = mime.getExtension(file.type)
|
|
108
|
+
console.log(fileType.includes(fileFileType))
|
|
109
|
+
return fileType.includes(fileFileType)
|
|
110
|
+
}).length
|
|
111
|
+
console.log(item)
|
|
112
|
+
console.log('fileCount', fileCount, item.maxNum, item.historyNum)
|
|
113
|
+
if (item.maxNum < item.historyNum + fileCount) {
|
|
114
|
+
reject({
|
|
115
|
+
status: ErrorStatus.FILE_ACCEPT_NUMBER,
|
|
116
|
+
text: `一次性最多上传${item.maxNum}个${item.accept}文件,请重新上传!`
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
resolve(true)
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
getAccept,
|
|
126
|
+
getStringAccept,
|
|
127
|
+
checkFileSize,
|
|
128
|
+
checkFileNumber,
|
|
129
|
+
checkFileNameLength,
|
|
130
|
+
checkFileType,
|
|
131
|
+
checkFileLimit
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-upload
|
|
4
|
+
:accept="getStringAccept"
|
|
5
|
+
v-bind="omit(getProps, ['accept', 'api', 'onChange'])"
|
|
6
|
+
:before-upload="beforeUploadFn"
|
|
7
|
+
:custom-request="customRequest"
|
|
8
|
+
@change="uploadOnChange"
|
|
9
|
+
>
|
|
10
|
+
<template #default>
|
|
11
|
+
<a-button v-bind="getProps.uploadButtonProps">
|
|
12
|
+
<upload-outlined></upload-outlined> {{ getProps.uploadTitle }}
|
|
13
|
+
</a-button>
|
|
14
|
+
</template>
|
|
15
|
+
<template v-for="item in Object.keys($slots)" #[item]="data" :key="item">
|
|
16
|
+
<slot :name="item" v-bind="data || {}"></slot>
|
|
17
|
+
</template>
|
|
18
|
+
</a-upload>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { computed } from 'vue'
|
|
24
|
+
import { UploadOutlined } from '@ant-design/icons-vue'
|
|
25
|
+
import { omit, throttle } from 'lodash-es'
|
|
26
|
+
import { message, Upload } from 'ant-design-vue'
|
|
27
|
+
import { isFunction } from '../../../utils/is'
|
|
28
|
+
import { platUploadProps } from './plat-upload-props'
|
|
29
|
+
import { useUpload } from './hook/useUpload'
|
|
30
|
+
|
|
31
|
+
defineOptions({
|
|
32
|
+
name: 'PlUpload'
|
|
33
|
+
})
|
|
34
|
+
const props = defineProps(platUploadProps)
|
|
35
|
+
const emit = defineEmits(['change', 'beforeChange', 'error'])
|
|
36
|
+
|
|
37
|
+
const getProps = computed(() => props as Recordable)
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
getStringAccept,
|
|
41
|
+
checkFileSize,
|
|
42
|
+
checkFileNumber,
|
|
43
|
+
checkFileNameLength,
|
|
44
|
+
checkFileType,
|
|
45
|
+
checkFileLimit
|
|
46
|
+
} = useUpload({
|
|
47
|
+
props
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// 自定义上传判断
|
|
51
|
+
const customRequest = computed(() => {
|
|
52
|
+
// 没有api 且 当前属于循环上传
|
|
53
|
+
if (!isFunction(props.api) && props.polling) {
|
|
54
|
+
return null
|
|
55
|
+
}
|
|
56
|
+
return customRequestApi
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// 计算属性判断是否循环上传,不同上传方式走的逻辑不一样
|
|
60
|
+
const beforeUploadFn = computed(() => {
|
|
61
|
+
if (props.polling) {
|
|
62
|
+
return beforeUpload
|
|
63
|
+
}
|
|
64
|
+
return beforeAllUpload
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// 校验成功的文件
|
|
68
|
+
const uploadedSuccessFiles = new Set()
|
|
69
|
+
const beforeAllUpload = async (file, fileList) => {
|
|
70
|
+
if (file.uid === fileList[0].uid) {
|
|
71
|
+
uploadedSuccessFiles.clear()
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
await Promise.all([
|
|
75
|
+
checkFileSize(file),
|
|
76
|
+
checkFileNumber(fileList),
|
|
77
|
+
checkFileNameLength(file),
|
|
78
|
+
checkFileType(file)
|
|
79
|
+
])
|
|
80
|
+
uploadedSuccessFiles.add(file)
|
|
81
|
+
} catch (error: any) {
|
|
82
|
+
emit('error', error)
|
|
83
|
+
const { text } = error
|
|
84
|
+
if (props.showErrorMsg) {
|
|
85
|
+
throttledShowErrorMessage(text)
|
|
86
|
+
}
|
|
87
|
+
return Upload.LIST_IGNORE
|
|
88
|
+
}
|
|
89
|
+
if (uploadedSuccessFiles.size === fileList.length) {
|
|
90
|
+
emit('beforeChange', fileList, uploadedSuccessFiles)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 添加节流 防止多次弹窗
|
|
95
|
+
const throttledShowErrorMessage = throttle(
|
|
96
|
+
(text) => {
|
|
97
|
+
message.error(text)
|
|
98
|
+
},
|
|
99
|
+
1000,
|
|
100
|
+
{
|
|
101
|
+
leading: true,
|
|
102
|
+
trailing: false
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
// 上传前校验
|
|
107
|
+
const beforeUpload = async (file, fileList) => {
|
|
108
|
+
// promise.all全部判断
|
|
109
|
+
try {
|
|
110
|
+
const res = await Promise.all([
|
|
111
|
+
checkFileSize(file),
|
|
112
|
+
checkFileNumber(fileList),
|
|
113
|
+
checkFileNameLength(file),
|
|
114
|
+
checkFileType(file),
|
|
115
|
+
checkFileLimit(fileList)
|
|
116
|
+
])
|
|
117
|
+
return res
|
|
118
|
+
} catch (error: any) {
|
|
119
|
+
emit('error', error)
|
|
120
|
+
const { text } = error
|
|
121
|
+
if (props.showErrorMsg) {
|
|
122
|
+
throttledShowErrorMessage(text)
|
|
123
|
+
}
|
|
124
|
+
return Upload.LIST_IGNORE
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const uploadOnChange = (file) => {
|
|
129
|
+
emit('change', file)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const customRequestApi = async (file) => {
|
|
133
|
+
if (!props.polling) {
|
|
134
|
+
return null
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const { data } = await props.api(
|
|
138
|
+
{
|
|
139
|
+
data: {
|
|
140
|
+
...(props.uploadParams || {})
|
|
141
|
+
},
|
|
142
|
+
file: file.file,
|
|
143
|
+
name: props.name
|
|
144
|
+
},
|
|
145
|
+
function onUploadProgress(progressEvent: ProgressEvent) {
|
|
146
|
+
const complete =
|
|
147
|
+
((progressEvent.loaded / progressEvent.total) * 100) | 0
|
|
148
|
+
file.onProgress({ percent: complete }, file)
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
file.onSuccess(data, file)
|
|
152
|
+
} catch (e) {
|
|
153
|
+
file.onError(e, file)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<style lang="less" scoped></style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { uploadProps } from 'ant-design-vue/es/upload/interface'
|
|
3
|
+
import type { ButtonType } from 'ant-design-vue/es/button/buttonTypes'
|
|
4
|
+
import type { AcceptMax } from './types'
|
|
5
|
+
|
|
6
|
+
export const platUploadProps = {
|
|
7
|
+
...uploadProps(),
|
|
8
|
+
// 上传按钮名称
|
|
9
|
+
uploadTitle: {
|
|
10
|
+
type: String as PropType<string>,
|
|
11
|
+
default: '上传附件'
|
|
12
|
+
},
|
|
13
|
+
// 根据后缀,或者其他
|
|
14
|
+
accept: {
|
|
15
|
+
type: Array as PropType<string[]>,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
// 上传提示
|
|
19
|
+
uploadTips: {
|
|
20
|
+
type: String as PropType<string>,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
// 文件最大多少 单位MB 默认2MB
|
|
24
|
+
maxSize: {
|
|
25
|
+
type: Number as PropType<number>,
|
|
26
|
+
default: 2
|
|
27
|
+
},
|
|
28
|
+
// 最大数量的文件 默认10个
|
|
29
|
+
maxNumber: {
|
|
30
|
+
type: Number as PropType<number>,
|
|
31
|
+
default: 10
|
|
32
|
+
},
|
|
33
|
+
// 上传附件的名称字符长度限制
|
|
34
|
+
maxFileNameLength: {
|
|
35
|
+
type: Number as PropType<number>,
|
|
36
|
+
default: 100
|
|
37
|
+
},
|
|
38
|
+
// 允许上传多个文件
|
|
39
|
+
multiple: {
|
|
40
|
+
type: Boolean as PropType<boolean>,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
// 上传参数
|
|
44
|
+
uploadParams: {
|
|
45
|
+
type: Object as PropType<any>,
|
|
46
|
+
default: {}
|
|
47
|
+
},
|
|
48
|
+
// 上传api
|
|
49
|
+
api: {
|
|
50
|
+
type: Function as PropType<PromiseFn>,
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
// 发到后台的文件参数名
|
|
54
|
+
name: {
|
|
55
|
+
type: String as PropType<string>,
|
|
56
|
+
default: 'file'
|
|
57
|
+
},
|
|
58
|
+
// 是否循环上传,默认循环上传
|
|
59
|
+
polling: {
|
|
60
|
+
type: Boolean as PropType<boolean>,
|
|
61
|
+
default: true
|
|
62
|
+
},
|
|
63
|
+
// rms项目上传模式
|
|
64
|
+
rmsMaxFileArr: {
|
|
65
|
+
type: Array as PropType<AcceptMax[]>,
|
|
66
|
+
default: []
|
|
67
|
+
},
|
|
68
|
+
// 上传按钮配置项
|
|
69
|
+
uploadButtonProps: {
|
|
70
|
+
type: Object as PropType<Partial<ButtonType>>,
|
|
71
|
+
default: () => ({})
|
|
72
|
+
},
|
|
73
|
+
// 使用组件错误提示
|
|
74
|
+
showErrorMsg: {
|
|
75
|
+
type: Boolean as PropType<boolean>,
|
|
76
|
+
default: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type PlatUploadProps = Partial<ExtractPropTypes<typeof platUploadProps>>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './acceptMax'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TableState } from './useTableState';
|
|
2
|
-
import type { PlatTableProps } from '../plat-table-props';
|
|
3
|
-
import type { VNode } from 'vue';
|
|
4
|
-
import type { OnChangeCallbackParams, TableColumn } from '../type';
|
|
5
|
-
export declare type UseTableMethodsContext = {
|
|
6
|
-
state: TableState;
|
|
7
|
-
props: PlatTableProps;
|
|
8
|
-
emit: any;
|
|
9
|
-
};
|
|
10
|
-
export declare const useTableMethods: ({ state, props, emit }: UseTableMethodsContext) => {
|
|
11
|
-
setProps: (props: any) => void;
|
|
12
|
-
getComponent: (comp: VNode | string) => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}>;
|
|
15
|
-
handleSubmit: (params: any, page?: number) => void;
|
|
16
|
-
handleTableChange: (...rest: OnChangeCallbackParams) => Promise<void>;
|
|
17
|
-
getColumnKey: (column: TableColumn) => string | number;
|
|
18
|
-
fetchData: (params?: {}, rest?: OnChangeCallbackParams) => any;
|
|
19
|
-
getQueryFormRef: () => any;
|
|
20
|
-
reload: (resetPageIndex?: boolean) => any;
|
|
21
|
-
};
|
package/lib/src/env.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
declare module '*.vue' {
|
|
4
|
-
import type { DefineComponent } from 'vue'
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
6
|
-
const component: DefineComponent<{}, {}, any>
|
|
7
|
-
export default component
|
|
8
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|