@dt-frames/ui 1.0.10 → 1.0.13
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/es/components/curd/src/components/dialog.d.ts +28 -18
- package/es/components/curd/src/components/props.d.ts +4 -4
- package/es/components/curd/src/types/curd.type.d.ts +3 -2
- package/es/components/forms/src/components/formIcon.d.ts +11 -6
- package/es/components/forms/src/components/formInputUseDialog.d.ts +903 -0
- package/es/components/forms/src/types/form.type.d.ts +3 -1
- package/es/components/index.d.ts +1 -1
- package/es/components/modal/src/components/modal.d.ts +2 -2
- package/es/components/modal/src/components/modalFooter.d.ts +9 -4
- package/es/components/modal/src/index.d.ts +10 -5
- package/es/components/modal/src/props.d.ts +2 -1
- package/es/components/modal/src/types/modal.type.d.ts +5 -2
- package/es/components/source/src/hooks/useFetch.d.ts +2 -2
- package/es/components/source/src/hooks/useSource.d.ts +4 -4
- package/es/components/table/src/components/TableHeader.d.ts +2 -2
- package/es/components/table/src/components/editable/CellComponent.d.ts +14 -0
- package/es/components/table/src/components/editable/EditTableCell.d.ts +88 -0
- package/es/components/table/src/components/editable/componentMap.d.ts +4 -0
- package/es/components/table/src/components/editable/index.d.ts +9 -0
- package/es/components/table/src/hooks/useCustomRow.d.ts +19 -0
- package/es/components/table/src/hooks/useTable.d.ts +2 -2
- package/es/components/table/src/index.d.ts +27 -4
- package/es/components/table/src/props.d.ts +5 -1
- package/es/components/table/src/types/table.type.d.ts +18 -2
- package/es/components/upload/index.d.ts +1 -2
- package/es/components/upload/src/helper.d.ts +1 -0
- package/es/components/upload/src/index.d.ts +40 -13
- package/es/components/upload/src/props.d.ts +4 -1
- package/es/components/upload/src/upload.d.ts +45 -10
- package/es/index.js +589 -212
- package/es/style/components/forms/index.less +23 -0
- package/es/style/components/table/index.less +6 -0
- package/es/style/components/upload/index.less +3 -11
- package/es/style/theme/header/index.less +1 -1
- package/package.json +1 -1
- package/src/components/curd/src/components/dialog.vue +7 -5
- package/src/components/curd/src/components/props.ts +4 -4
- package/src/components/curd/src/hooks/useCurd.tsx +1 -1
- package/src/components/curd/src/types/curd.type.ts +3 -2
- package/src/components/forms/index.less +23 -0
- package/src/components/forms/src/componentMap.ts +2 -0
- package/src/components/forms/src/components/formInputUseDialog.vue +43 -0
- package/src/components/forms/src/components/formItem.vue +10 -10
- package/src/components/forms/src/types/form.type.ts +6 -0
- package/src/components/index.ts +1 -2
- package/src/components/modal/src/components/modalFooter.vue +10 -2
- package/src/components/modal/src/hooks/useModal.ts +12 -4
- package/src/components/modal/src/index.vue +19 -8
- package/src/components/modal/src/props.ts +3 -2
- package/src/components/modal/src/types/modal.type.ts +5 -2
- package/src/components/source/src/hooks/useFetch.ts +6 -4
- package/src/components/source/src/hooks/useSource.ts +5 -4
- package/src/components/table/index.less +6 -0
- package/src/components/table/src/components/TableHeader.vue +2 -2
- package/src/components/table/src/components/editable/CellComponent.ts +57 -0
- package/src/components/table/src/components/editable/EditTableCell.vue +181 -0
- package/src/components/table/src/components/editable/componentMap.ts +18 -0
- package/src/components/table/src/components/editable/index.ts +58 -0
- package/src/components/table/src/hooks/useColumns.ts +15 -8
- package/src/components/table/src/hooks/useCustomRow.ts +86 -0
- package/src/components/table/src/hooks/useRowSelection.ts +1 -1
- package/src/components/table/src/hooks/useTable.ts +1 -1
- package/src/components/table/src/hooks/useTableHeader.ts +1 -1
- package/src/components/table/src/index.vue +20 -3
- package/src/components/table/src/props.ts +4 -1
- package/src/components/table/src/types/table.type.ts +30 -3
- package/src/components/upload/index.less +3 -11
- package/src/components/upload/index.ts +0 -2
- package/src/components/upload/src/helper.ts +29 -1
- package/src/components/upload/src/props.ts +4 -1
- package/src/components/upload/src/upload.vue +88 -63
- package/src/theme/header/index.less +1 -1
- package/src/components/upload/src/index.vue +0 -38
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="file
|
|
3
|
-
<div>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
2
|
+
<div class="dt-file">
|
|
3
|
+
<div class="file-header">
|
|
4
|
+
<div>
|
|
5
|
+
<Upload
|
|
6
|
+
:accept="getStringAccept"
|
|
7
|
+
:multiple="multiple"
|
|
8
|
+
:before-upload="beforeUpload"
|
|
9
|
+
:show-upload-list="false"
|
|
10
|
+
>
|
|
11
|
+
<Button type="primary">
|
|
12
|
+
<span v-icon="'ic:baseline-file-upload'"></span>
|
|
13
|
+
文件上传
|
|
14
|
+
</Button>
|
|
15
|
+
</Upload>
|
|
16
|
+
<Button type="primary" v-if="showTemplateDownload" @click="templateDownload">
|
|
17
|
+
<span v-icon="'ic:baseline-file-download'"></span>
|
|
18
|
+
模板下载
|
|
13
19
|
</Button>
|
|
14
|
-
</
|
|
15
|
-
<
|
|
16
|
-
<span v-icon="'ic:baseline-file-download'"></span>
|
|
17
|
-
模板下载
|
|
18
|
-
</Button>
|
|
20
|
+
</div>
|
|
21
|
+
<slot></slot>
|
|
19
22
|
</div>
|
|
20
|
-
<slot></slot>
|
|
21
|
-
</div>
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
<div class="file-type-tips ant-alert-info">
|
|
25
|
+
<span v-icon="'ant-design:info-circle-outlined'"></span>
|
|
26
|
+
<i>{{ getHelpText }}</i>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<DtTable @register="registerTable"></DtTable>
|
|
30
|
+
|
|
31
|
+
<Image
|
|
32
|
+
:width="200"
|
|
33
|
+
:style="{ display: 'none' }"
|
|
34
|
+
:preview="{
|
|
35
|
+
visible: imgVisable,
|
|
36
|
+
onVisibleChange: setImgVisible,
|
|
37
|
+
}"
|
|
38
|
+
:src="imgSrcRef"
|
|
39
|
+
></Image>
|
|
39
40
|
|
|
41
|
+
</div>
|
|
42
|
+
|
|
40
43
|
</template>
|
|
41
44
|
|
|
42
45
|
<script lang="ts" setup>
|
|
43
|
-
import { h, ref, toRefs, watchEffect } from 'vue'
|
|
46
|
+
import { h, ref, toRefs, watchEffect, watch, computed } from 'vue'
|
|
44
47
|
import { Button, Upload, Image } from 'ant-design-vue'
|
|
45
48
|
import { DtTable, useTable } from '../../table'
|
|
46
49
|
import { basicUploadProps } from './props'
|
|
@@ -53,62 +56,77 @@
|
|
|
53
56
|
|
|
54
57
|
const filesRef = ref([])
|
|
55
58
|
const historyFilesRef = ref([])
|
|
56
|
-
const allFilesRef =
|
|
59
|
+
const allFilesRef = computed(() => {
|
|
60
|
+
return [...historyFilesRef.value, ...filesRef.value ]
|
|
61
|
+
})
|
|
57
62
|
|
|
58
63
|
// 控制图片预览显示隐藏
|
|
59
64
|
const imgVisable = ref( false )
|
|
65
|
+
const imgSrcRef = ref()
|
|
60
66
|
const setImgVisible = (value) => imgVisable.value = value
|
|
61
67
|
|
|
62
68
|
const props = defineProps( basicUploadProps )
|
|
63
69
|
|
|
64
70
|
const { accept, helpText, maxNumber, maxSize } = toRefs(props)
|
|
65
|
-
const {
|
|
71
|
+
const {
|
|
72
|
+
getStringAccept,
|
|
73
|
+
getHelpText
|
|
74
|
+
} = useHelpers( accept, helpText, maxNumber, maxSize )
|
|
66
75
|
|
|
76
|
+
const isImage = (fileType: string) => ['pdf', 'jpg', 'jpeg', 'png', 'bmp', 'gif'].includes( fileType )
|
|
67
77
|
|
|
68
|
-
const [registerTable
|
|
78
|
+
const [registerTable] = useTable({
|
|
69
79
|
tableSetting: false,
|
|
70
80
|
pagination: false,
|
|
71
81
|
dataSource: allFilesRef,
|
|
72
82
|
columns: [
|
|
73
83
|
{ title: '文件名称', dataIndex: 'fileName' },
|
|
74
|
-
{ title: '上传状态', dataIndex: 'fileStatue',
|
|
75
|
-
return h('span', {
|
|
76
|
-
style: `color: ${ row.status === 0 ? 'orange' : 'green' }`,
|
|
77
|
-
}, row.fileStatue)
|
|
78
|
-
} },
|
|
84
|
+
{ title: '上传状态', dataIndex: 'fileStatue', className: 'orange' },
|
|
79
85
|
],
|
|
80
86
|
operations: {
|
|
81
87
|
expand: true,
|
|
82
88
|
btns: [
|
|
83
89
|
{ title: '预览', icon: 'ic:baseline-remove-red-eye',
|
|
84
90
|
ifShow(row) {
|
|
85
|
-
|
|
86
|
-
return
|
|
91
|
+
if( !props.showView ) return false
|
|
92
|
+
return isImage( row.fileName.split('.').pop() )
|
|
87
93
|
},
|
|
88
|
-
action: () => {
|
|
89
|
-
|
|
94
|
+
action: ({ row }) => {
|
|
95
|
+
if( isImage( row.fileName.split('.').pop() ) ) {
|
|
96
|
+
setImgVisible(true)
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
},
|
|
92
|
-
{ title: '
|
|
93
|
-
|
|
100
|
+
{ title: '删除', icon: 'mdi:delete-outline', action: ({row}) => {
|
|
101
|
+
if( !row.status ) historyFilesRef.value = historyFilesRef.value.filter( it => it.fileId !== row.fileId )
|
|
102
|
+
else {
|
|
103
|
+
filesRef.value = filesRef.value.filter( it => it.fileId !== row.fileId )
|
|
104
|
+
}
|
|
105
|
+
} }
|
|
94
106
|
]
|
|
95
107
|
}
|
|
96
108
|
})
|
|
97
109
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
watch(
|
|
111
|
+
() => props.defaultFiles,
|
|
112
|
+
v => {
|
|
113
|
+
if( v ) {
|
|
114
|
+
historyFilesRef.value = props.defaultFiles.map((file, index) => {
|
|
115
|
+
return {
|
|
116
|
+
...file,
|
|
117
|
+
fileId: file.id || index,
|
|
118
|
+
fileName: file.fileName,
|
|
119
|
+
status: 0,
|
|
120
|
+
fileStatue: '历史上传'
|
|
121
|
+
}
|
|
122
|
+
})
|
|
106
123
|
}
|
|
107
|
-
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
immediate: true
|
|
127
|
+
}
|
|
128
|
+
)
|
|
108
129
|
|
|
109
|
-
allFilesRef.value = [...historyFilesRef.value, ...filesRef.value]
|
|
110
|
-
})
|
|
111
|
-
|
|
112
130
|
|
|
113
131
|
function beforeUpload(file: File) {
|
|
114
132
|
const { maxSize } = props
|
|
@@ -139,13 +157,20 @@
|
|
|
139
157
|
if (currentChunk < chunks) {
|
|
140
158
|
loadNext();
|
|
141
159
|
} else {
|
|
142
|
-
|
|
160
|
+
let fileObj = {
|
|
143
161
|
fileName: file.name,
|
|
144
162
|
fileId: spark.end(),
|
|
145
163
|
file,
|
|
146
164
|
status: 1,
|
|
147
165
|
fileStatue: '待上传'
|
|
148
|
-
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if( props.multiple ) {
|
|
169
|
+
filesRef.value.push(fileObj)
|
|
170
|
+
} else {
|
|
171
|
+
historyFilesRef.value = []
|
|
172
|
+
filesRef.value = [fileObj]
|
|
173
|
+
}
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
176
|
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<DtModal
|
|
3
|
-
@save="handleSave()"
|
|
4
|
-
@register="register"
|
|
5
|
-
>
|
|
6
|
-
<div class="dt-upload-wrap">
|
|
7
|
-
<DtUpload ref="uploadRef" :defaultFiles="defaultFiles">
|
|
8
|
-
111
|
|
9
|
-
</DtUpload>
|
|
10
|
-
</div>
|
|
11
|
-
</DtModal>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script lang="ts" setup>
|
|
15
|
-
import { ref } from 'vue'
|
|
16
|
-
import { DtModal, useModal } from '../../modal'
|
|
17
|
-
import DtUpload from './upload.vue'
|
|
18
|
-
|
|
19
|
-
const uploadRef = ref(null)
|
|
20
|
-
const emites = defineEmits(['register'])
|
|
21
|
-
|
|
22
|
-
// 注册弹框
|
|
23
|
-
const [register] = useModal({
|
|
24
|
-
width: '700px',
|
|
25
|
-
title: '文件上传',
|
|
26
|
-
maskClosable: false,
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const defaultFiles = [
|
|
30
|
-
{ fileName: '叮咚发票667.09.pdf', fileId: '1' }
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
// 保存
|
|
34
|
-
function handleSave() {
|
|
35
|
-
console.log(uploadRef.value.allFilesRef)
|
|
36
|
-
alert("s-s-s-")
|
|
37
|
-
}
|
|
38
|
-
</script>
|