@opentiny/vue-renderless 3.20.3 → 3.21.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/badge/vue.js +1 -1
- package/base-select/index.js +3 -0
- package/bulletin-board/index.js +1 -1
- package/button/index.js +1 -1
- package/cascader/index.js +10 -8
- package/cascader-panel/vue.js +1 -1
- package/cascader-select/column-index.js +3 -0
- package/chart-core/deps/utils.js +1 -1
- package/chart-core/index.js +1 -1
- package/common/browser.js +2 -0
- package/common/deps/eSpaceCtrl.js +3 -2
- package/common/deps/fastdom/singleton.js +9 -1
- package/common/deps/fullscreen/screenfull.js +54 -25
- package/common/deps/popper.js +18 -18
- package/common/deps/touch-emulator.js +15 -10
- package/common/deps/upload-ajax.js +1 -1
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +5 -2
- package/common/validate/util.js +1 -1
- package/dialog-box/index.js +6 -3
- package/divider/index.js +47 -0
- package/divider/vue.js +24 -3
- package/dropdown/index.js +44 -26
- package/dropdown/vue.js +17 -8
- package/espace/index.js +1 -1
- package/fall-menu/index.js +1 -1
- package/file-upload/index.js +71 -67
- package/file-upload/vue.js +6 -6
- package/floatbar/index.js +1 -1
- package/fluent-editor/index.js +25 -9
- package/form/vue.js +1 -1
- package/grid/plugins/export.js +1 -1
- package/guide/index.js +1 -1
- package/image/index.js +1 -1
- package/image-viewer/index.js +3 -2
- package/input/vue.js +3 -0
- package/link/vue.js +1 -1
- package/locales/index.js +1 -1
- package/logout/index.js +1 -1
- package/menu/index.js +1 -1
- package/milestone/index.js +2 -1
- package/modal/index.js +0 -1
- package/nav-menu/index.js +80 -11
- package/nav-menu/vue.js +13 -1
- package/package.json +2 -2
- package/picker/index.js +10 -0
- package/rich-text/index.js +1 -1
- package/rich-text/module/file-upload.js +1 -1
- package/rich-text/module/image-upload.js +1 -1
- package/rich-text-editor/vue.js +11 -10
- package/roles/index.js +1 -1
- package/select/index.js +27 -17
- package/select/vue.js +33 -5
- package/select-dropdown/vue.js +2 -1
- package/split/index.js +2 -1
- package/statistic/index.js +5 -2
- package/tabbar-item/vue.js +1 -1
- package/tabs-mf/wheel.js +14 -9
- package/time-panel/index.js +8 -1
- package/time-panel/vue.js +2 -0
- package/time-spinner/index.js +2 -1
- package/toggle-menu/index.js +1 -1
- package/transfer/index.js +1 -5
- package/tree-menu/index.js +5 -1
- package/tree-menu/vue.js +5 -2
- package/types/alert.type.d.ts +4 -0
- package/types/dialog-box.type.d.ts +10 -0
- package/types/divider.type.d.ts +94 -0
- package/types/dropdown.type.d.ts +9 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +2 -2
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-f6fb4c38.d.ts → form.type-4e0ec0a1.d.ts} +2 -1
- package/types/form.type.d.ts +1 -1
- package/types/image.type.d.ts +1 -1
- package/types/nav-menu.type.d.ts +1 -0
- package/types/statistic.type.d.ts +2 -5
- package/types/tree-menu.type.d.ts +19 -0
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-6189e4c9.d.ts → upload-list.type-eaf82b7a.d.ts} +4 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-contact.type.d.ts +1 -1
- package/upload-dragger/index.js +49 -24
- package/upload-dragger/vue.js +1 -0
- package/upload-list/index.js +1 -1
- package/upload-list/vue.js +2 -1
- package/user/index.js +1 -1
- package/user-contact/index.js +1 -1
- package/year-table/index.js +2 -2
- package/common/xss.js +0 -191
package/dropdown/index.js
CHANGED
|
@@ -11,19 +11,23 @@ const watchFocusing = (parent) => (value) => {
|
|
|
11
11
|
value ? addClass(selfDefine, "focusing") : removeClass(selfDefine, "focusing");
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
const show = ({ props, state }) => () => {
|
|
14
|
+
const show = ({ props, state, emit }) => () => {
|
|
15
15
|
if (props.disabled) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
if (state.visibleIsBoolean) {
|
|
19
|
+
emit("update:visible", true);
|
|
20
|
+
} else {
|
|
21
|
+
clearTimeout(Number(state.timeout));
|
|
22
|
+
state.timeout = setTimeout(
|
|
23
|
+
() => {
|
|
24
|
+
state.visible = true;
|
|
25
|
+
},
|
|
26
|
+
state.trigger === "click" ? 0 : props.showTimeout
|
|
27
|
+
);
|
|
28
|
+
}
|
|
25
29
|
};
|
|
26
|
-
const hide = ({ api, props, state }) => () => {
|
|
30
|
+
const hide = ({ api, props, state, emit }) => () => {
|
|
27
31
|
if (props.disabled) {
|
|
28
32
|
return;
|
|
29
33
|
}
|
|
@@ -31,20 +35,28 @@ const hide = ({ api, props, state }) => () => {
|
|
|
31
35
|
if (props.tabindex >= 0 && state.triggerElm) {
|
|
32
36
|
api.resetTabindex(state.triggerElm);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (state.visibleIsBoolean) {
|
|
39
|
+
emit("update:visible", false);
|
|
40
|
+
} else {
|
|
41
|
+
clearTimeout(Number(state.timeout));
|
|
42
|
+
state.timeout = setTimeout(
|
|
43
|
+
() => {
|
|
44
|
+
state.visible = false;
|
|
45
|
+
},
|
|
46
|
+
state.trigger === "click" ? 0 : props.hideTimeout
|
|
47
|
+
);
|
|
48
|
+
}
|
|
41
49
|
};
|
|
42
50
|
const handleClick = ({ api, props, state, emit }) => () => {
|
|
43
51
|
if (props.disabled) {
|
|
44
52
|
return;
|
|
45
53
|
}
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
if (state.visibleIsBoolean) {
|
|
55
|
+
emit("handle-click", props.visible);
|
|
56
|
+
} else {
|
|
57
|
+
emit("handle-click", state.visible);
|
|
58
|
+
state.visible ? api.hide() : api.show();
|
|
59
|
+
}
|
|
48
60
|
};
|
|
49
61
|
const handleTriggerKeyDown = ({ api, state }) => (event) => {
|
|
50
62
|
const keyCode = event.keyCode;
|
|
@@ -62,7 +74,7 @@ const handleTriggerKeyDown = ({ api, state }) => (event) => {
|
|
|
62
74
|
api.hide();
|
|
63
75
|
}
|
|
64
76
|
};
|
|
65
|
-
const handleItemKeyDown = ({ api, props, state }) => (event) => {
|
|
77
|
+
const handleItemKeyDown = ({ api, props, state, emit }) => (event) => {
|
|
66
78
|
const keyCode = event.keyCode;
|
|
67
79
|
const target = event.target;
|
|
68
80
|
const currentIndex = state.menuItemsArray.indexOf(target);
|
|
@@ -124,9 +136,12 @@ const initEvent = ({ api, props, state, vm, mode }) => () => {
|
|
|
124
136
|
on(state.triggerElm, "keydown", api.handleTriggerKeyDown);
|
|
125
137
|
(_a = state.dropdownElm) == null ? void 0 : _a.addEventListener("keydown", api.handleItemKeyDown, true);
|
|
126
138
|
if (!props.splitButton || !props.singleButton) {
|
|
127
|
-
on(state.triggerElm, "focus",
|
|
128
|
-
on(state.triggerElm, "blur",
|
|
129
|
-
on(state.triggerElm, "click",
|
|
139
|
+
on(state.triggerElm, "focus", api.toggleFocusOnTrue);
|
|
140
|
+
on(state.triggerElm, "blur", api.toggleFocusOnFalse);
|
|
141
|
+
on(state.triggerElm, "click", api.toggleFocusOnFalse);
|
|
142
|
+
}
|
|
143
|
+
if (state.visibleIsBoolean) {
|
|
144
|
+
return;
|
|
130
145
|
}
|
|
131
146
|
if (state.trigger === "hover") {
|
|
132
147
|
on(state.triggerElm, "mouseenter", api.show);
|
|
@@ -176,14 +191,16 @@ const mounted = ({ api, vm, state, broadcast }) => () => {
|
|
|
176
191
|
vm.$on("selected-index", (selectedIndex) => {
|
|
177
192
|
broadcast("TinyDropdownMenu", "menu-selected-index", selectedIndex);
|
|
178
193
|
});
|
|
179
|
-
|
|
194
|
+
if (!state.visibleIsBoolean) {
|
|
195
|
+
vm.$on("is-disabled", api.clickOutside);
|
|
196
|
+
}
|
|
180
197
|
};
|
|
181
198
|
const beforeDistory = ({ vm, api, state }) => () => {
|
|
182
199
|
if (state.triggerElm) {
|
|
183
200
|
off(state.triggerElm, "keydown", api.handleTriggerKeyDown);
|
|
184
|
-
off(state.triggerElm, "focus",
|
|
185
|
-
off(state.triggerElm, "blur",
|
|
186
|
-
off(state.triggerElm, "click",
|
|
201
|
+
off(state.triggerElm, "focus", api.toggleFocusOnTrue);
|
|
202
|
+
off(state.triggerElm, "blur", api.toggleFocusOnFalse);
|
|
203
|
+
off(state.triggerElm, "click", api.toggleFocusOnFalse);
|
|
187
204
|
off(state.triggerElm, "mouseenter", api.show);
|
|
188
205
|
off(state.triggerElm, "mouseleave", api.hide);
|
|
189
206
|
off(state.triggerElm, "click", api.handleClick);
|
|
@@ -221,6 +238,7 @@ export {
|
|
|
221
238
|
removeTabindex,
|
|
222
239
|
resetTabindex,
|
|
223
240
|
show,
|
|
241
|
+
toggleFocus,
|
|
224
242
|
triggerElmFocus,
|
|
225
243
|
watchFocusing,
|
|
226
244
|
watchVisible
|
package/dropdown/vue.js
CHANGED
|
@@ -18,10 +18,11 @@ import {
|
|
|
18
18
|
initDomOperation,
|
|
19
19
|
mounted,
|
|
20
20
|
beforeDistory,
|
|
21
|
-
clickOutside
|
|
21
|
+
clickOutside,
|
|
22
|
+
toggleFocus
|
|
22
23
|
} from "./index";
|
|
23
24
|
const api = ["state", "handleMainButtonClick", "hide", "show", "initDomOperation", "handleClick", "clickOutside"];
|
|
24
|
-
const renderless = (props, { reactive, watch, provide, onMounted, computed }, { emit, parent, broadcast, vm, nextTick, mode, designConfig }) => {
|
|
25
|
+
const renderless = (props, { reactive, watch, provide, onMounted, computed, onBeforeUnmount }, { emit, parent, broadcast, vm, nextTick, mode, designConfig }) => {
|
|
25
26
|
const api2 = {};
|
|
26
27
|
const state = reactive({
|
|
27
28
|
visible: false,
|
|
@@ -38,19 +39,20 @@ const renderless = (props, { reactive, watch, provide, onMounted, computed }, {
|
|
|
38
39
|
trigger: computed(() => {
|
|
39
40
|
var _a;
|
|
40
41
|
return props.trigger || ((_a = designConfig == null ? void 0 : designConfig.props) == null ? void 0 : _a.trigger) || "hover";
|
|
41
|
-
})
|
|
42
|
+
}),
|
|
43
|
+
visibleIsBoolean: computed(() => typeof props.visible === "boolean")
|
|
42
44
|
});
|
|
43
45
|
provide("dropdownVm", vm);
|
|
44
46
|
Object.assign(api2, {
|
|
45
47
|
state,
|
|
46
48
|
watchVisible: watchVisible({ broadcast, emit, nextTick }),
|
|
47
49
|
watchFocusing: watchFocusing(parent),
|
|
48
|
-
show: show({ props, state }),
|
|
49
|
-
hide: hide({ api: api2, props, state }),
|
|
50
|
+
show: show({ props, state, emit }),
|
|
51
|
+
hide: hide({ api: api2, props, state, emit }),
|
|
50
52
|
mounted: mounted({ api: api2, vm, state, broadcast }),
|
|
51
53
|
handleClick: handleClick({ api: api2, props, state, emit }),
|
|
52
54
|
handleTriggerKeyDown: handleTriggerKeyDown({ api: api2, state }),
|
|
53
|
-
handleItemKeyDown: handleItemKeyDown({ api: api2, props, state }),
|
|
55
|
+
handleItemKeyDown: handleItemKeyDown({ api: api2, props, state, emit }),
|
|
54
56
|
resetTabindex: resetTabindex(api2),
|
|
55
57
|
removeTabindex: removeTabindex(state),
|
|
56
58
|
initAria: initAria({ state, props }),
|
|
@@ -60,11 +62,18 @@ const renderless = (props, { reactive, watch, provide, onMounted, computed }, {
|
|
|
60
62
|
triggerElmFocus: triggerElmFocus(state),
|
|
61
63
|
initDomOperation: initDomOperation({ api: api2, state, vm }),
|
|
62
64
|
beforeDistory: beforeDistory({ vm, api: api2, state }),
|
|
63
|
-
clickOutside: clickOutside({ props, api: api2 })
|
|
65
|
+
clickOutside: clickOutside({ props, api: api2 }),
|
|
66
|
+
toggleFocusOnTrue: toggleFocus({ state, value: true }),
|
|
67
|
+
toggleFocusOnFalse: toggleFocus({ state, value: false })
|
|
64
68
|
});
|
|
65
|
-
|
|
69
|
+
if (typeof props.visible === "boolean") {
|
|
70
|
+
watch(() => props.visible, api2.watchVisible);
|
|
71
|
+
} else {
|
|
72
|
+
watch(() => state.visible, api2.watchVisible);
|
|
73
|
+
}
|
|
66
74
|
watch(() => state.focusing, api2.watchFocusing);
|
|
67
75
|
onMounted(api2.mounted);
|
|
76
|
+
onBeforeUnmount(api2.beforeDistory);
|
|
68
77
|
return api2;
|
|
69
78
|
};
|
|
70
79
|
export {
|
package/espace/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { xss } from "
|
|
2
|
+
import { xss } from "@opentiny/utils";
|
|
3
3
|
const getUserHref = ({ api, props }) => (item) => {
|
|
4
4
|
const type = item.type ? String(item.type).toLocaleLowerCase() : "";
|
|
5
5
|
const value = item.value ? String(item.value).toLocaleLowerCase() : "";
|
package/fall-menu/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import { REFRESH_INTERVAL } from "../common";
|
|
3
3
|
import { on, off } from "../common/deps/dom";
|
|
4
4
|
import PopupManager from "../common/deps/popup-manager";
|
|
5
|
-
import { xss } from "
|
|
5
|
+
import { xss } from "@opentiny/utils";
|
|
6
6
|
const arrowClick = (state) => (opt) => {
|
|
7
7
|
state.pager += opt;
|
|
8
8
|
};
|
package/file-upload/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
5
|
import { extend } from "../common/object";
|
|
6
|
-
import { xss, log } from "
|
|
6
|
+
import { xss, log, crypt } from "@opentiny/utils";
|
|
7
7
|
import uploadAjax from "../common/deps/upload-ajax";
|
|
8
8
|
import { isObject } from "../common/type";
|
|
9
9
|
import { isEmptyObject } from "../common/type";
|
|
@@ -273,12 +273,14 @@ const properFileSize = ({
|
|
|
273
273
|
} else {
|
|
274
274
|
maxSize = state.isEdm ? Math.min(state.singleMaxSize) : props.fileSize / 1024;
|
|
275
275
|
}
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
message
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
if (state.isEdm || Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
277
|
+
if (!isNaN(Number(maxSize)) && file.size > maxSize * 1024 * 1024) {
|
|
278
|
+
Modal.message({
|
|
279
|
+
message: t(constants.EDM.EXCEED, { maxSize: api.formatFileSize(Number(maxSize * 1024 * 1024)) }),
|
|
280
|
+
status: "warning"
|
|
281
|
+
});
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
282
284
|
}
|
|
283
285
|
if (file.size <= 0) {
|
|
284
286
|
Modal.message({
|
|
@@ -312,7 +314,7 @@ const addFileToList = ({
|
|
|
312
314
|
if (state.isEdm) {
|
|
313
315
|
let fileBase = { serverName: "", docRelativePath: "", docId: "", docVersion: "", cacheSign: rawFile.uid };
|
|
314
316
|
file = Object.assign(file, fileBase);
|
|
315
|
-
props.edm.upload.isFolder && (file.path = rawFile.webkitRelativePath.match(/.*\//g)[0]);
|
|
317
|
+
props.edm.upload.isFolder && rawFile.webkitRelativePath && (file.path = rawFile.webkitRelativePath.match(/.*\//g)[0]);
|
|
316
318
|
}
|
|
317
319
|
state.cacheDocuments[file.uid] = file;
|
|
318
320
|
mode === "mobile" && calcFileForMobile(rawFile, file);
|
|
@@ -363,45 +365,24 @@ const getFileHash = ({
|
|
|
363
365
|
Modal,
|
|
364
366
|
constants,
|
|
365
367
|
t,
|
|
366
|
-
CryptoJS,
|
|
367
368
|
state
|
|
368
|
-
}) => ({ file,
|
|
369
|
+
}) => ({ file, showTips }) => {
|
|
369
370
|
if (showTips) {
|
|
370
371
|
Modal.message({
|
|
371
372
|
message: `${t(constants.EDM.CALCHASH)}`,
|
|
372
373
|
status: "warning"
|
|
373
374
|
});
|
|
374
375
|
}
|
|
375
|
-
const chunks = Math.ceil(file.size / chunkSize);
|
|
376
|
-
let chunkIndex = 0;
|
|
377
|
-
let start = chunkIndex * chunkSize;
|
|
378
|
-
let end = Math.min(file.size, start + chunkSize);
|
|
379
|
-
let chunk = file.raw.slice(start, end);
|
|
380
|
-
const hasher = CryptoJS.algo.SHA256.create();
|
|
381
|
-
let calculated = 0;
|
|
382
376
|
return new Promise((resolve) => {
|
|
383
377
|
const reader = new FileReader();
|
|
384
|
-
reader.readAsArrayBuffer(
|
|
385
|
-
reader.onload = (e) => {
|
|
378
|
+
reader.readAsArrayBuffer(file.raw);
|
|
379
|
+
reader.onload = async (e) => {
|
|
386
380
|
if (file.status === constants.FILE_STATUS.FAIL)
|
|
387
381
|
return;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
if (chunkIndex < chunks) {
|
|
393
|
-
start = chunkIndex * chunkSize;
|
|
394
|
-
end = Math.min(file.size, start + chunkSize);
|
|
395
|
-
calculated += end - start;
|
|
396
|
-
emit("hash-progress", Math.min(Math.floor(calculated / file.size * 100), 100));
|
|
397
|
-
chunk = file.raw.slice(start, end);
|
|
398
|
-
reader.readAsArrayBuffer(chunk);
|
|
399
|
-
} else {
|
|
400
|
-
const hash = hasher.finalize().toString();
|
|
401
|
-
file.hash = file.raw.hash = hash;
|
|
402
|
-
resolve(hash);
|
|
403
|
-
emit("hash-progress", 100);
|
|
404
|
-
}
|
|
382
|
+
const hash = await crypt.sha256(e.target && e.target.result);
|
|
383
|
+
file.hash = file.raw.hash = hash;
|
|
384
|
+
resolve(hash);
|
|
385
|
+
emit("hash-progress", 100);
|
|
405
386
|
};
|
|
406
387
|
reader.onerror = (err) => {
|
|
407
388
|
file.status = constants.FILE_STATUS.FAIL;
|
|
@@ -463,7 +444,7 @@ const handleStart = ({
|
|
|
463
444
|
isLargeFileHash = true;
|
|
464
445
|
}
|
|
465
446
|
}
|
|
466
|
-
api.getFileHash({ file: file2,
|
|
447
|
+
api.getFileHash({ file: file2, showTips: isLargeFileHash }).then((hash) => resolve(hash));
|
|
467
448
|
}).then(() => {
|
|
468
449
|
if (props.autoUpload) {
|
|
469
450
|
const tokenParams = { token: props.edm.upload.token, file: file2, type: "upload" };
|
|
@@ -983,7 +964,7 @@ const downloadFileSingle = ({
|
|
|
983
964
|
onDownloadProgress(evt) {
|
|
984
965
|
let progress = calcProgress(evt, isChunk);
|
|
985
966
|
if (progress !== 100) {
|
|
986
|
-
!isChunk && emit("download", progress, evt);
|
|
967
|
+
!isChunk && emit("download", progress, evt, {}, file);
|
|
987
968
|
}
|
|
988
969
|
if (typeof file === "object") {
|
|
989
970
|
file.percentage = progress;
|
|
@@ -997,7 +978,7 @@ const downloadFileSingle = ({
|
|
|
997
978
|
return;
|
|
998
979
|
handleSuccess2(data, "", range.index);
|
|
999
980
|
const { checkcode, "content-size": fileSize } = data.headers;
|
|
1000
|
-
!isChunk && emit("download", 100, "", { checkcode, fileSize });
|
|
981
|
+
!isChunk && emit("download", 100, "", { checkcode, fileSize }, file);
|
|
1001
982
|
if (typeof file === "object") {
|
|
1002
983
|
file.percentage = 100;
|
|
1003
984
|
setTimeout(() => file.status = constants.FILE_STATUS.SUCESS, 1e3);
|
|
@@ -1053,7 +1034,7 @@ const downloadFileBatch = ({
|
|
|
1053
1034
|
onDownloadProgress(evt) {
|
|
1054
1035
|
let progress = calcProgress(evt);
|
|
1055
1036
|
if (progress !== 100) {
|
|
1056
|
-
emit("download", progress, evt);
|
|
1037
|
+
emit("download", progress, evt, {}, file);
|
|
1057
1038
|
}
|
|
1058
1039
|
}
|
|
1059
1040
|
}
|
|
@@ -1063,7 +1044,7 @@ const downloadFileBatch = ({
|
|
|
1063
1044
|
if (api.validateDownloadStatus({ downloadOps: props.edm.download || {}, file, isLessThan17G, data: data2 }))
|
|
1064
1045
|
return;
|
|
1065
1046
|
const { "content-size": fileSize, checkcode } = data2.headers;
|
|
1066
|
-
emit("download", 100, "", { fileSize, checkcode });
|
|
1047
|
+
emit("download", 100, "", { fileSize, checkcode }, file);
|
|
1067
1048
|
handleSuccess2(data2, "zip");
|
|
1068
1049
|
});
|
|
1069
1050
|
});
|
|
@@ -1132,12 +1113,12 @@ const downloadFileSingleHwh5 = ({ state, props, emit, constants }) => ({ file })
|
|
|
1132
1113
|
onProgress: (event) => {
|
|
1133
1114
|
const { progress } = JSON.parse(event);
|
|
1134
1115
|
if (progress * 1 !== 100) {
|
|
1135
|
-
emit("download", progress);
|
|
1116
|
+
emit("download", progress, event, {}, file);
|
|
1136
1117
|
}
|
|
1137
1118
|
}
|
|
1138
1119
|
};
|
|
1139
1120
|
downloadToEDM(options).then((data) => {
|
|
1140
|
-
emit("download", 100, "", { data });
|
|
1121
|
+
emit("download", 100, "", { data }, file);
|
|
1141
1122
|
});
|
|
1142
1123
|
};
|
|
1143
1124
|
const downloadFile = ({ api, state }) => (file) => {
|
|
@@ -1172,7 +1153,8 @@ const downloadFileSingleInner = ({ props, state, api, constants }) => ({ file, i
|
|
|
1172
1153
|
api.downloadFileSingleHwh5({ file });
|
|
1173
1154
|
return;
|
|
1174
1155
|
}
|
|
1175
|
-
const
|
|
1156
|
+
const param = { docId: file.docId, docVersion: file.docVersion };
|
|
1157
|
+
const promise = state.hasFileInfoInterface ? api.getDownloadFileInfo(param) : Promise.resolve();
|
|
1176
1158
|
promise.then((fileInfo) => {
|
|
1177
1159
|
const { fileSize } = fileInfo || {};
|
|
1178
1160
|
const isLargeFile = fileSize > state.docSize && fileSize > state.chunkSize;
|
|
@@ -1184,7 +1166,7 @@ const downloadFileSingleInner = ({ props, state, api, constants }) => ({ file, i
|
|
|
1184
1166
|
});
|
|
1185
1167
|
});
|
|
1186
1168
|
};
|
|
1187
|
-
const getDownloadFileInfo = ({ api, state, props, service }) => ({ docId }) => {
|
|
1169
|
+
const getDownloadFileInfo = ({ api, state, props, service }) => ({ docId, docVersion }) => {
|
|
1188
1170
|
return service.getDocumentInfoUrl().then((url) => {
|
|
1189
1171
|
return new Promise((resolve, reject) => {
|
|
1190
1172
|
service.request({
|
|
@@ -1193,7 +1175,7 @@ const getDownloadFileInfo = ({ api, state, props, service }) => ({ docId }) => {
|
|
|
1193
1175
|
withCredentials: props.withCredentials,
|
|
1194
1176
|
headers: Object.assign(props.headers, state.headers),
|
|
1195
1177
|
cancelToken: api.createDownloadCancelToken({ docId }),
|
|
1196
|
-
data: { docInfoVO: { ids: [docId], docType: "", docVersion: "" } }
|
|
1178
|
+
data: { docInfoVO: { ids: [docId], docType: "", docVersion: docVersion || "" } }
|
|
1197
1179
|
}).then((res) => {
|
|
1198
1180
|
const { data } = res || {};
|
|
1199
1181
|
if (data && data.status === 200) {
|
|
@@ -1223,7 +1205,7 @@ const sliceDownloadChunk = ({ state }) => (file) => {
|
|
|
1223
1205
|
let endRange = -1;
|
|
1224
1206
|
for (let i = 0; i < chunkSize; i++) {
|
|
1225
1207
|
startRange = endRange + 1;
|
|
1226
|
-
endRange = Math.min(file.fileSize, startRange + state.chunkSize);
|
|
1208
|
+
endRange = Math.min(file.fileSize, startRange + state.chunkSize - 1);
|
|
1227
1209
|
if (endRange < startRange) {
|
|
1228
1210
|
return downloadChunkArray;
|
|
1229
1211
|
}
|
|
@@ -1305,10 +1287,14 @@ const downloadFileInner = ({ api, props, state }) => ({ batchIndex, file, range,
|
|
|
1305
1287
|
const afterDownload = ({ api, state }) => ({ batchIndex, range, data, file, isBatch, isChunk, isLessThan17G }) => {
|
|
1306
1288
|
if (data.status === 200) {
|
|
1307
1289
|
const key = file.docId + "-" + batchIndex;
|
|
1308
|
-
|
|
1309
|
-
|
|
1290
|
+
if (state.downloadBatchQueue[key] !== void 0) {
|
|
1291
|
+
state.downloadBatchQueue[key] += 1;
|
|
1292
|
+
} else {
|
|
1293
|
+
state.downloadBatchQueue[key] = 0;
|
|
1294
|
+
}
|
|
1310
1295
|
} else {
|
|
1311
|
-
const
|
|
1296
|
+
const key = file.docId + "-" + range.index;
|
|
1297
|
+
const countDownloadReplay = state.downloadReplayAtoms[key];
|
|
1312
1298
|
if (countDownloadReplay && countDownloadReplay >= 2) {
|
|
1313
1299
|
const msgArray = [
|
|
1314
1300
|
"The number of retry times exceeds the threshold! [docId:",
|
|
@@ -1318,11 +1304,14 @@ const afterDownload = ({ api, state }) => ({ batchIndex, range, data, file, isBa
|
|
|
1318
1304
|
"]"
|
|
1319
1305
|
];
|
|
1320
1306
|
log.logger.warn(msgArray.join(""));
|
|
1321
|
-
delete state.downloadReplayAtoms[
|
|
1307
|
+
delete state.downloadReplayAtoms[key];
|
|
1322
1308
|
} else {
|
|
1309
|
+
if (state.downloadReplayAtoms[key] === void 0) {
|
|
1310
|
+
state.downloadReplayAtoms[key] = 0;
|
|
1311
|
+
}
|
|
1323
1312
|
const msgArray = ["replay ", countDownloadReplay, "! [docId:", file.docId, ", chunk:", range.index, "]"];
|
|
1324
1313
|
log.logger.warn(msgArray.join(""));
|
|
1325
|
-
state.downloadReplayAtoms[
|
|
1314
|
+
state.downloadReplayAtoms[key] += 1;
|
|
1326
1315
|
api.downloadFileInner({ batchIndex, range, file, isBatch, isChunk, isLessThan17G });
|
|
1327
1316
|
}
|
|
1328
1317
|
}
|
|
@@ -1354,11 +1343,11 @@ const setWriterFile = ({
|
|
|
1354
1343
|
delete downloadChunkFile[index];
|
|
1355
1344
|
if (index + 1 >= chunkNum) {
|
|
1356
1345
|
delete state.downloadChunkFile[file.docId];
|
|
1357
|
-
emit("download", 100, "", { fileSize, checkcode });
|
|
1346
|
+
emit("download", 100, "", { fileSize, checkcode }, file);
|
|
1358
1347
|
writer.close();
|
|
1359
1348
|
} else {
|
|
1360
1349
|
const progress = Math.ceil(downloaded / fileSize * 100) || 0;
|
|
1361
|
-
progress !== 100 && emit("download", progress);
|
|
1350
|
+
progress !== 100 && emit("download", progress, "", { fileSize, checkcode }, file);
|
|
1362
1351
|
index++;
|
|
1363
1352
|
writerStreamSaver();
|
|
1364
1353
|
}
|
|
@@ -1371,10 +1360,10 @@ const setWriterFile = ({
|
|
|
1371
1360
|
if (index + 1 >= chunkNum) {
|
|
1372
1361
|
delete state.downloadChunkFile[file.docId];
|
|
1373
1362
|
aLinkDownload({ blob: new Blob(fileData), name: docName });
|
|
1374
|
-
emit("download", 100, "", { fileSize, checkcode });
|
|
1363
|
+
emit("download", 100, "", { fileSize, checkcode }, file);
|
|
1375
1364
|
} else {
|
|
1376
1365
|
const progress = Math.ceil(downloaded / fileSize * 100) || 0;
|
|
1377
|
-
progress !== 100 && emit("download", progress);
|
|
1366
|
+
progress !== 100 && emit("download", progress, "", { fileSize, checkcode }, file);
|
|
1378
1367
|
index++;
|
|
1379
1368
|
writerStreamSaver();
|
|
1380
1369
|
}
|
|
@@ -1497,10 +1486,14 @@ const afterUpload = ({
|
|
|
1497
1486
|
}) => {
|
|
1498
1487
|
if (data.status === 200) {
|
|
1499
1488
|
const key = file.docId + "-" + batchIndex;
|
|
1500
|
-
|
|
1501
|
-
|
|
1489
|
+
if (state.batchQueue[key] !== void 0) {
|
|
1490
|
+
state.batchQueue[key] += 1;
|
|
1491
|
+
} else {
|
|
1492
|
+
state.batchQueue[key] = 0;
|
|
1493
|
+
}
|
|
1502
1494
|
} else {
|
|
1503
|
-
const
|
|
1495
|
+
const key = file.docId + "-" + file.chunk;
|
|
1496
|
+
const countReplay = state.replayAtoms[key];
|
|
1504
1497
|
if (countReplay && countReplay >= 2) {
|
|
1505
1498
|
const msgArray = [
|
|
1506
1499
|
"The number of retry times exceeds the threshold! [docId:",
|
|
@@ -1510,11 +1503,14 @@ const afterUpload = ({
|
|
|
1510
1503
|
"]"
|
|
1511
1504
|
];
|
|
1512
1505
|
log.logger.warn(msgArray.join(""));
|
|
1513
|
-
delete state.replayAtoms[
|
|
1506
|
+
delete state.replayAtoms[key];
|
|
1514
1507
|
} else {
|
|
1508
|
+
if (state.replayAtoms[key] === void 0) {
|
|
1509
|
+
state.replayAtoms[key] = 0;
|
|
1510
|
+
}
|
|
1515
1511
|
const msgArray = ["replay ", countReplay, "! [docId:", file.docId, ", chunk:", file.chunk, "]"];
|
|
1516
1512
|
log.logger.warn(msgArray.join(""));
|
|
1517
|
-
state.replayAtoms[
|
|
1513
|
+
state.replayAtoms[key] += 1;
|
|
1518
1514
|
api.segmentUpload(batchIndex, file, progress);
|
|
1519
1515
|
}
|
|
1520
1516
|
}
|
|
@@ -1583,8 +1579,7 @@ const segmentUpload = ({
|
|
|
1583
1579
|
service,
|
|
1584
1580
|
state,
|
|
1585
1581
|
emit,
|
|
1586
|
-
constants
|
|
1587
|
-
CryptoJS
|
|
1582
|
+
constants
|
|
1588
1583
|
}) => (batchIndex, file, progress) => {
|
|
1589
1584
|
if (typeof file.then === "function") {
|
|
1590
1585
|
file.then(
|
|
@@ -1593,10 +1588,9 @@ const segmentUpload = ({
|
|
|
1593
1588
|
return resolve(file2);
|
|
1594
1589
|
const reader = new FileReader();
|
|
1595
1590
|
reader.readAsArrayBuffer(file2);
|
|
1596
|
-
reader.onload = (e) => {
|
|
1591
|
+
reader.onload = async (e) => {
|
|
1597
1592
|
if (props.edm.isCheckCode === true) {
|
|
1598
|
-
|
|
1599
|
-
const hash = CryptoJS.SHA256(wordArray).toString();
|
|
1593
|
+
const hash = await crypt.sha256(e.target && e.target.result);
|
|
1600
1594
|
file2.hash = hash;
|
|
1601
1595
|
}
|
|
1602
1596
|
resolve(file2);
|
|
@@ -1741,7 +1735,17 @@ const getToken = ({
|
|
|
1741
1735
|
if (["preview", "download"].includes(type) && props.accept) {
|
|
1742
1736
|
state.accept = props.accept;
|
|
1743
1737
|
} else if (whitelist) {
|
|
1744
|
-
|
|
1738
|
+
if (props.accept) {
|
|
1739
|
+
let propsAccept = "";
|
|
1740
|
+
props.accept.toString().split(",").forEach((item) => {
|
|
1741
|
+
if (!whitelist.includes(item)) {
|
|
1742
|
+
propsAccept += `,${item}`;
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
state.accept = whitelist + propsAccept;
|
|
1746
|
+
} else {
|
|
1747
|
+
state.accept = whitelist;
|
|
1748
|
+
}
|
|
1745
1749
|
}
|
|
1746
1750
|
state.headers[constants.EDM.EDMTOKEN] = result.edmToken || "";
|
|
1747
1751
|
state.headers[constants.EDM.TRACEID] = result.traceId || "";
|
package/file-upload/vue.js
CHANGED
|
@@ -227,10 +227,10 @@ const initApi = ({ api: api2, state, props, constants, vm, $service, t, Modal, e
|
|
|
227
227
|
formatFileSize
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
|
-
const mergeApi = ({ api: api2, props, $service, state, constants, emit, mode, Modal, t, vm,
|
|
230
|
+
const mergeApi = ({ api: api2, props, $service, state, constants, emit, mode, Modal, t, vm, Streamsaver }) => {
|
|
231
231
|
Object.assign(api2, {
|
|
232
232
|
segmentUploadInit: segmentUploadInit({ api: api2, props, service: $service, state, constants }),
|
|
233
|
-
segmentUpload: segmentUpload({ api: api2, props, service: $service, state, emit, constants
|
|
233
|
+
segmentUpload: segmentUpload({ api: api2, props, service: $service, state, emit, constants }),
|
|
234
234
|
addFileToList: addFileToList({ api: api2, constants, emit, props, state, mode }),
|
|
235
235
|
downloadFile: downloadFile({ api: api2, state }),
|
|
236
236
|
downloadFileSingleInner: downloadFileSingleInner({ props, state, api: api2, constants }),
|
|
@@ -257,7 +257,7 @@ const mergeApi = ({ api: api2, props, $service, state, constants, emit, mode, Mo
|
|
|
257
257
|
downloadFileInner: downloadFileInner({ api: api2, props, state }),
|
|
258
258
|
setWriterFile: setWriterFile({ state, emit, Streamsaver }),
|
|
259
259
|
afterDownload: afterDownload({ api: api2, state }),
|
|
260
|
-
getFileHash: getFileHash({ emit, Modal, constants, t,
|
|
260
|
+
getFileHash: getFileHash({ emit, Modal, constants, t, state }),
|
|
261
261
|
modifyServiceUrlSingle: modifyServiceUrlSingle({ state, props, constants }),
|
|
262
262
|
getKiaScanTip: getKiaScanTip({ Modal, constants, t }),
|
|
263
263
|
downloadFileSingle: downloadFileSingle({ service: $service, constants, props, state, api: api2, emit }),
|
|
@@ -303,7 +303,7 @@ const initWatch = ({ watch, state, api: api2, props, $service }) => {
|
|
|
303
303
|
watch(() => props.edm, api2.computeDocChunkSize, { deep: true, immediate: true });
|
|
304
304
|
};
|
|
305
305
|
let getApi = () => ({});
|
|
306
|
-
const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactive, ref, watch, onMounted }, { t, vm, parent, emit, service, mode, constants, useBreakpoint }, { Modal,
|
|
306
|
+
const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactive, ref, watch, onMounted }, { t, vm, parent, emit, service, mode, constants, useBreakpoint }, { Modal, Streamsaver }) => {
|
|
307
307
|
let api2 = {};
|
|
308
308
|
const $service = initService({ props, service });
|
|
309
309
|
const httpRequest = $service.httpRequest;
|
|
@@ -320,13 +320,13 @@ const renderless = (props, { computed, inject, onBeforeUnmount, provide, reactiv
|
|
|
320
320
|
useBreakpoint
|
|
321
321
|
});
|
|
322
322
|
initApi({ api: api2, state, props, constants, vm, $service, t, Modal, emit });
|
|
323
|
-
mergeApi({ api: api2, props, $service, state, constants, emit, mode, Modal, t, vm,
|
|
323
|
+
mergeApi({ api: api2, props, $service, state, constants, emit, mode, Modal, t, vm, Streamsaver });
|
|
324
324
|
getApi = () => api2;
|
|
325
325
|
provide("uploader", parent);
|
|
326
326
|
onMounted(api2.mounted);
|
|
327
327
|
onBeforeUnmount(() => {
|
|
328
328
|
api2.onBeforeDestroy();
|
|
329
|
-
api2 =
|
|
329
|
+
api2 = null;
|
|
330
330
|
vm.$off("drag-over");
|
|
331
331
|
});
|
|
332
332
|
initWatch({ watch, state, api: api2, props, $service });
|
package/floatbar/index.js
CHANGED