@ibiz-template/mob-vue3-components 0.7.41-alpha.11 → 0.7.41-alpha.12
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/dist/{index-q0SBDv6c.js → index-yGM1h2Ma.js} +12 -12
- package/dist/index-yGM1h2Ma.js.map +1 -0
- package/dist/index.min.css +9 -9
- package/dist/index.system.min.js +1 -1
- package/dist/{quill-sraxwYmv.js → quill-7fiycnP7.js} +2 -2
- package/dist/{quill-sraxwYmv.js.map → quill-7fiycnP7.js.map} +1 -1
- package/dist/{quill-editor-5QOfComp.js → quill-editor-Nndlb9WE.js} +2 -2
- package/dist/{quill-editor-5QOfComp.js.map → quill-editor-Nndlb9WE.js.map} +1 -1
- package/dist/{quill-editor-preview-65f3RVj0.js → quill-editor-preview-GUdcFmjn.js} +2 -2
- package/dist/{quill-editor-preview-65f3RVj0.js.map → quill-editor-preview-GUdcFmjn.js.map} +1 -1
- package/es/editor/dropdown-list/ibiz-cascader-dropdown/ibiz-cascader-dropdown.d.ts +1 -1
- package/es/editor/dropdown-list/ibiz-cascader-dropdown/ibiz-cascader-dropdown.mjs +11 -4
- package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.d.ts +2 -0
- package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +3 -0
- package/es/editor/upload/upload-editor.controller.d.ts +4 -0
- package/es/editor/upload/upload-editor.controller.mjs +15 -1
- package/es/editor/upload/use/use-van-upload.d.ts +1 -0
- package/es/editor/upload/use/use-van-upload.mjs +8 -2
- package/es/util/directive/loading.mjs +1 -0
- package/lib/editor/dropdown-list/ibiz-cascader-dropdown/ibiz-cascader-dropdown.cjs +10 -3
- package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +3 -0
- package/lib/editor/upload/upload-editor.controller.cjs +15 -1
- package/lib/editor/upload/use/use-van-upload.cjs +8 -2
- package/lib/util/directive/loading.cjs +1 -0
- package/package.json +1 -1
- package/dist/index-q0SBDv6c.js.map +0 -1
- package/es/editor/upload/use/use-ibiz-upload.d.ts +0 -95
- package/es/editor/upload/use/use-ibiz-upload.mjs +0 -170
- package/lib/editor/upload/use/use-ibiz-upload.cjs +0 -175
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { UploadEditorController } from '../upload-editor.controller';
|
|
3
|
-
export type FileInfo = {
|
|
4
|
-
name: string;
|
|
5
|
-
id: string;
|
|
6
|
-
status?: 'uploading' | 'finished' | 'fail' | 'cancel';
|
|
7
|
-
percentage?: number;
|
|
8
|
-
url?: string;
|
|
9
|
-
/**
|
|
10
|
-
* 文件名(不带后缀)
|
|
11
|
-
*/
|
|
12
|
-
fileName?: string;
|
|
13
|
-
/**
|
|
14
|
-
* 文件类型(拓展名)
|
|
15
|
-
*/
|
|
16
|
-
fileExt?: string;
|
|
17
|
-
/**
|
|
18
|
-
* 是否是图片
|
|
19
|
-
*/
|
|
20
|
-
isImage?: boolean;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* 格式化文件信息
|
|
24
|
-
*
|
|
25
|
-
* @author lxm
|
|
26
|
-
* @date 2022-11-18 15:11:38
|
|
27
|
-
* @param {FileInfo} file
|
|
28
|
-
*/
|
|
29
|
-
export declare function formatFileInfo(file: FileInfo, downloadUrl: string): FileInfo;
|
|
30
|
-
/**
|
|
31
|
-
* 文件上传组件初始化,解析props并得到downloadUrl、uploadUrl、fileList
|
|
32
|
-
*
|
|
33
|
-
* @author lxm
|
|
34
|
-
* @date 2022-11-21 10:11:01
|
|
35
|
-
* @export
|
|
36
|
-
* @param {{
|
|
37
|
-
* data: Ref<IData>;
|
|
38
|
-
* value: Ref<string>;
|
|
39
|
-
* controller: Ref<UploadEditorController>;
|
|
40
|
-
* }} props
|
|
41
|
-
* @returns {*}
|
|
42
|
-
*/
|
|
43
|
-
export declare function useIBizUploadInit(props: {
|
|
44
|
-
data: Ref<IData>;
|
|
45
|
-
value: Ref<string | undefined>;
|
|
46
|
-
controller: Ref<UploadEditorController>;
|
|
47
|
-
}): {
|
|
48
|
-
downloadUrl: Ref<string>;
|
|
49
|
-
uploadUrl: Ref<string>;
|
|
50
|
-
valueList: Ref<FileInfo[]>;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* 使用文件上传功能,传递外部已存在的文件集合,上传下载基础路径
|
|
54
|
-
*
|
|
55
|
-
* @author lxm
|
|
56
|
-
* @date 2022-11-21 10:11:01
|
|
57
|
-
* @export
|
|
58
|
-
* @param {{
|
|
59
|
-
* downloadUrl: Ref<string>;
|
|
60
|
-
* uploadUrl: Ref<string>;
|
|
61
|
-
* value: Ref<
|
|
62
|
-
* {
|
|
63
|
-
* name: string;
|
|
64
|
-
* id: string;
|
|
65
|
-
* url?: string;
|
|
66
|
-
* }[]
|
|
67
|
-
* >;
|
|
68
|
-
* }} opts
|
|
69
|
-
* @returns {*}
|
|
70
|
-
*/
|
|
71
|
-
export declare function useIBizUpload(opts: {
|
|
72
|
-
downloadUrl: Ref<string>;
|
|
73
|
-
uploadUrl: Ref<string>;
|
|
74
|
-
value: Ref<{
|
|
75
|
-
name: string;
|
|
76
|
-
id: string;
|
|
77
|
-
url?: string;
|
|
78
|
-
}[]>;
|
|
79
|
-
multiple?: boolean;
|
|
80
|
-
accept?: string;
|
|
81
|
-
}): {
|
|
82
|
-
selectFile: () => void;
|
|
83
|
-
fileList: Ref<{
|
|
84
|
-
name: string;
|
|
85
|
-
id: string;
|
|
86
|
-
status?: 'uploading' | 'finished' | 'fail' | 'cancel' | undefined;
|
|
87
|
-
percentage?: number | undefined;
|
|
88
|
-
url?: string | undefined;
|
|
89
|
-
fileName?: string | undefined;
|
|
90
|
-
fileExt?: string | undefined;
|
|
91
|
-
isImage?: boolean | undefined;
|
|
92
|
-
}[]>;
|
|
93
|
-
uploadState: Ref<'loading' | 'undo' | 'done'>;
|
|
94
|
-
};
|
|
95
|
-
export declare function openImagePreview(file: FileInfo): Promise<void>;
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { isImage, uploadFile } from '@ibiz-template/core';
|
|
2
|
-
import { ref, watch } from 'vue';
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
function formatFileInfo(file, downloadUrl) {
|
|
6
|
-
file.url = downloadUrl.replace("%fileId%", file.id);
|
|
7
|
-
if (!file.status) {
|
|
8
|
-
file.status = "finished";
|
|
9
|
-
}
|
|
10
|
-
if (!file.fileName) {
|
|
11
|
-
const index = file.name.lastIndexOf(".");
|
|
12
|
-
file.fileName = file.name.substring(0, index);
|
|
13
|
-
file.fileExt = file.name.substring(index);
|
|
14
|
-
file.isImage = isImage(file.name);
|
|
15
|
-
}
|
|
16
|
-
return file;
|
|
17
|
-
}
|
|
18
|
-
function useIBizUploadInit(props) {
|
|
19
|
-
const uploadUrl = ref("");
|
|
20
|
-
const downloadUrl = ref("");
|
|
21
|
-
const valueList = ref([]);
|
|
22
|
-
watch(
|
|
23
|
-
props.data,
|
|
24
|
-
(newVal) => {
|
|
25
|
-
if (newVal) {
|
|
26
|
-
const urls = ibiz.util.file.calcFileUpDownUrl(
|
|
27
|
-
props.controller.value.context,
|
|
28
|
-
props.controller.value.params,
|
|
29
|
-
newVal,
|
|
30
|
-
props.controller.value.editorParams
|
|
31
|
-
);
|
|
32
|
-
uploadUrl.value = urls.uploadUrl;
|
|
33
|
-
downloadUrl.value = urls.downloadUrl;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{ immediate: true, deep: true }
|
|
37
|
-
);
|
|
38
|
-
watch(
|
|
39
|
-
props.value,
|
|
40
|
-
(newVal) => {
|
|
41
|
-
valueList.value = !newVal ? [] : JSON.parse(newVal);
|
|
42
|
-
if (valueList.value.length && downloadUrl.value) {
|
|
43
|
-
valueList.value.forEach((file) => {
|
|
44
|
-
formatFileInfo(file, downloadUrl.value);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{ immediate: true }
|
|
49
|
-
);
|
|
50
|
-
watch(
|
|
51
|
-
downloadUrl,
|
|
52
|
-
(newVal) => {
|
|
53
|
-
if (newVal && valueList.value.length) {
|
|
54
|
-
valueList.value.forEach((file) => {
|
|
55
|
-
formatFileInfo(file, newVal);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{ immediate: true }
|
|
60
|
-
);
|
|
61
|
-
return {
|
|
62
|
-
downloadUrl,
|
|
63
|
-
uploadUrl,
|
|
64
|
-
valueList
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function useIBizUpload(opts) {
|
|
68
|
-
const uploadState = ref("undo");
|
|
69
|
-
const fileList = ref([]);
|
|
70
|
-
const { downloadUrl, value, uploadUrl } = opts;
|
|
71
|
-
watch(
|
|
72
|
-
value,
|
|
73
|
-
(newVal) => {
|
|
74
|
-
if (newVal.length > 0) {
|
|
75
|
-
fileList.value = [];
|
|
76
|
-
newVal.forEach((item) => {
|
|
77
|
-
fileList.value.push(formatFileInfo(item, downloadUrl.value));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
immediate: true,
|
|
83
|
-
deep: true
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
const beforeUpload = (fileData, files) => {
|
|
87
|
-
files.forEach((file) => {
|
|
88
|
-
fileList.value.push({
|
|
89
|
-
name: file.name,
|
|
90
|
-
status: file.status,
|
|
91
|
-
percentage: file.percentage,
|
|
92
|
-
id: file.uid,
|
|
93
|
-
url: ""
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return true;
|
|
97
|
-
};
|
|
98
|
-
const onProgress = (files) => {
|
|
99
|
-
files.forEach((file) => {
|
|
100
|
-
fileList.value.find((item) => {
|
|
101
|
-
if (item.id === file.uid) {
|
|
102
|
-
item.percentage = file.percentage;
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
const onSuccess = (resultFiles, res) => {
|
|
110
|
-
resultFiles.forEach((file) => {
|
|
111
|
-
fileList.value.find((item) => {
|
|
112
|
-
if (item.id === file.uid) {
|
|
113
|
-
item.status = file.status;
|
|
114
|
-
item.id = res.data.fileid;
|
|
115
|
-
item.name = res.data.filename;
|
|
116
|
-
formatFileInfo(item, downloadUrl.value);
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
return false;
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
const onError = (resultFiles, error) => {
|
|
124
|
-
resultFiles.forEach((file) => {
|
|
125
|
-
fileList.value.find((item) => {
|
|
126
|
-
if (item.id === file.uid) {
|
|
127
|
-
item.status = file.status;
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
console.error(error);
|
|
134
|
-
};
|
|
135
|
-
const onFinish = (_resultFiles) => {
|
|
136
|
-
fileList.value = fileList.value.filter((file) => file.status === "finished");
|
|
137
|
-
uploadState.value = "done";
|
|
138
|
-
};
|
|
139
|
-
const selectFile = () => {
|
|
140
|
-
uploadFile({
|
|
141
|
-
multiple: opts.multiple,
|
|
142
|
-
accept: opts.accept,
|
|
143
|
-
uploadUrl: uploadUrl.value,
|
|
144
|
-
beforeUpload,
|
|
145
|
-
progress: onProgress,
|
|
146
|
-
success: onSuccess,
|
|
147
|
-
error: onError,
|
|
148
|
-
finish: onFinish
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
return {
|
|
152
|
-
selectFile,
|
|
153
|
-
fileList,
|
|
154
|
-
uploadState
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
function openImagePreview(file) {
|
|
158
|
-
return ibiz.overlay.modal(
|
|
159
|
-
"ImagePreview",
|
|
160
|
-
{ file },
|
|
161
|
-
{
|
|
162
|
-
width: "auto",
|
|
163
|
-
height: "auto",
|
|
164
|
-
placement: "center",
|
|
165
|
-
modalClass: "ibiz-image-preview-modal"
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export { formatFileInfo, openImagePreview, useIBizUpload, useIBizUploadInit };
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@ibiz-template/core');
|
|
4
|
-
var vue = require('vue');
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
function formatFileInfo(file, downloadUrl) {
|
|
8
|
-
file.url = downloadUrl.replace("%fileId%", file.id);
|
|
9
|
-
if (!file.status) {
|
|
10
|
-
file.status = "finished";
|
|
11
|
-
}
|
|
12
|
-
if (!file.fileName) {
|
|
13
|
-
const index = file.name.lastIndexOf(".");
|
|
14
|
-
file.fileName = file.name.substring(0, index);
|
|
15
|
-
file.fileExt = file.name.substring(index);
|
|
16
|
-
file.isImage = core.isImage(file.name);
|
|
17
|
-
}
|
|
18
|
-
return file;
|
|
19
|
-
}
|
|
20
|
-
function useIBizUploadInit(props) {
|
|
21
|
-
const uploadUrl = vue.ref("");
|
|
22
|
-
const downloadUrl = vue.ref("");
|
|
23
|
-
const valueList = vue.ref([]);
|
|
24
|
-
vue.watch(
|
|
25
|
-
props.data,
|
|
26
|
-
(newVal) => {
|
|
27
|
-
if (newVal) {
|
|
28
|
-
const urls = ibiz.util.file.calcFileUpDownUrl(
|
|
29
|
-
props.controller.value.context,
|
|
30
|
-
props.controller.value.params,
|
|
31
|
-
newVal,
|
|
32
|
-
props.controller.value.editorParams
|
|
33
|
-
);
|
|
34
|
-
uploadUrl.value = urls.uploadUrl;
|
|
35
|
-
downloadUrl.value = urls.downloadUrl;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{ immediate: true, deep: true }
|
|
39
|
-
);
|
|
40
|
-
vue.watch(
|
|
41
|
-
props.value,
|
|
42
|
-
(newVal) => {
|
|
43
|
-
valueList.value = !newVal ? [] : JSON.parse(newVal);
|
|
44
|
-
if (valueList.value.length && downloadUrl.value) {
|
|
45
|
-
valueList.value.forEach((file) => {
|
|
46
|
-
formatFileInfo(file, downloadUrl.value);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{ immediate: true }
|
|
51
|
-
);
|
|
52
|
-
vue.watch(
|
|
53
|
-
downloadUrl,
|
|
54
|
-
(newVal) => {
|
|
55
|
-
if (newVal && valueList.value.length) {
|
|
56
|
-
valueList.value.forEach((file) => {
|
|
57
|
-
formatFileInfo(file, newVal);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{ immediate: true }
|
|
62
|
-
);
|
|
63
|
-
return {
|
|
64
|
-
downloadUrl,
|
|
65
|
-
uploadUrl,
|
|
66
|
-
valueList
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function useIBizUpload(opts) {
|
|
70
|
-
const uploadState = vue.ref("undo");
|
|
71
|
-
const fileList = vue.ref([]);
|
|
72
|
-
const { downloadUrl, value, uploadUrl } = opts;
|
|
73
|
-
vue.watch(
|
|
74
|
-
value,
|
|
75
|
-
(newVal) => {
|
|
76
|
-
if (newVal.length > 0) {
|
|
77
|
-
fileList.value = [];
|
|
78
|
-
newVal.forEach((item) => {
|
|
79
|
-
fileList.value.push(formatFileInfo(item, downloadUrl.value));
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
immediate: true,
|
|
85
|
-
deep: true
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
const beforeUpload = (fileData, files) => {
|
|
89
|
-
files.forEach((file) => {
|
|
90
|
-
fileList.value.push({
|
|
91
|
-
name: file.name,
|
|
92
|
-
status: file.status,
|
|
93
|
-
percentage: file.percentage,
|
|
94
|
-
id: file.uid,
|
|
95
|
-
url: ""
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
return true;
|
|
99
|
-
};
|
|
100
|
-
const onProgress = (files) => {
|
|
101
|
-
files.forEach((file) => {
|
|
102
|
-
fileList.value.find((item) => {
|
|
103
|
-
if (item.id === file.uid) {
|
|
104
|
-
item.percentage = file.percentage;
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
const onSuccess = (resultFiles, res) => {
|
|
112
|
-
resultFiles.forEach((file) => {
|
|
113
|
-
fileList.value.find((item) => {
|
|
114
|
-
if (item.id === file.uid) {
|
|
115
|
-
item.status = file.status;
|
|
116
|
-
item.id = res.data.fileid;
|
|
117
|
-
item.name = res.data.filename;
|
|
118
|
-
formatFileInfo(item, downloadUrl.value);
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
return false;
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
const onError = (resultFiles, error) => {
|
|
126
|
-
resultFiles.forEach((file) => {
|
|
127
|
-
fileList.value.find((item) => {
|
|
128
|
-
if (item.id === file.uid) {
|
|
129
|
-
item.status = file.status;
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
console.error(error);
|
|
136
|
-
};
|
|
137
|
-
const onFinish = (_resultFiles) => {
|
|
138
|
-
fileList.value = fileList.value.filter((file) => file.status === "finished");
|
|
139
|
-
uploadState.value = "done";
|
|
140
|
-
};
|
|
141
|
-
const selectFile = () => {
|
|
142
|
-
core.uploadFile({
|
|
143
|
-
multiple: opts.multiple,
|
|
144
|
-
accept: opts.accept,
|
|
145
|
-
uploadUrl: uploadUrl.value,
|
|
146
|
-
beforeUpload,
|
|
147
|
-
progress: onProgress,
|
|
148
|
-
success: onSuccess,
|
|
149
|
-
error: onError,
|
|
150
|
-
finish: onFinish
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
return {
|
|
154
|
-
selectFile,
|
|
155
|
-
fileList,
|
|
156
|
-
uploadState
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function openImagePreview(file) {
|
|
160
|
-
return ibiz.overlay.modal(
|
|
161
|
-
"ImagePreview",
|
|
162
|
-
{ file },
|
|
163
|
-
{
|
|
164
|
-
width: "auto",
|
|
165
|
-
height: "auto",
|
|
166
|
-
placement: "center",
|
|
167
|
-
modalClass: "ibiz-image-preview-modal"
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
exports.formatFileInfo = formatFileInfo;
|
|
173
|
-
exports.openImagePreview = openImagePreview;
|
|
174
|
-
exports.useIBizUpload = useIBizUpload;
|
|
175
|
-
exports.useIBizUploadInit = useIBizUploadInit;
|