@opentiny/vue-renderless 3.29.0 → 3.30.0
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/anchor/index.js +11 -1
- package/anchor/vue.js +2 -2
- package/calendar-view/index.js +44 -2
- package/calendar-view/vue.js +6 -0
- package/drawer/index.js +7 -1
- package/drawer/vue.js +10 -2
- package/fluent-editor/index.js +70 -6
- package/fluent-editor/vue.js +28 -8
- package/input/vue.js +3 -2
- package/package.json +3 -3
- package/rate/index.js +2 -3
- package/rate/vue.js +1 -1
- package/rich-text/index.js +91 -2
- package/rich-text/vue.js +11 -2
- package/select/index.js +5 -0
- package/tabs-mf/index.js +10 -2
- package/time-spinner/index.js +2 -2
- package/tree-select/index.js +49 -14
- package/types/action-menu.type.d.ts +4 -0
- package/types/anchor.type.d.ts +1 -1
- package/types/drawer.type.d.ts +5 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/input.type.d.ts +1 -1
- package/types/popover.type.d.ts +1 -1
- package/types/rate.type.d.ts +1 -2
- package/types/transfer.type.d.ts +3 -3
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-d5ff675d.d.ts → upload-list.type-36a8374a.d.ts} +1 -1
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/user/index.js +5 -5
package/anchor/index.js
CHANGED
|
@@ -160,11 +160,21 @@ const onItersectionObserver = ({ state, props, api, vm, emit }) => () => {
|
|
|
160
160
|
);
|
|
161
161
|
addObserver({ props, state });
|
|
162
162
|
};
|
|
163
|
-
const linkClick = ({
|
|
163
|
+
const linkClick = ({
|
|
164
|
+
state,
|
|
165
|
+
vm,
|
|
166
|
+
emit,
|
|
167
|
+
props,
|
|
168
|
+
api,
|
|
169
|
+
framework
|
|
170
|
+
}) => (e, item) => {
|
|
164
171
|
state.isScroll = true;
|
|
165
172
|
const { link, title } = item;
|
|
166
173
|
const emitLink = { link, title };
|
|
167
174
|
emit("linkClick", e, emitLink);
|
|
175
|
+
if (framework === "vue2" || framework === "vue2.7") {
|
|
176
|
+
emit("link-click", e, emitLink);
|
|
177
|
+
}
|
|
168
178
|
const isChangeHash = setCurrentHash({ state });
|
|
169
179
|
const { scrollContainer } = state;
|
|
170
180
|
state.currentLink = link;
|
package/anchor/vue.js
CHANGED
|
@@ -19,7 +19,7 @@ const api = [
|
|
|
19
19
|
"setScrollContainer",
|
|
20
20
|
"getCurrentAnchor"
|
|
21
21
|
];
|
|
22
|
-
const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive, watch }, { vm, emit, nextTick }) => {
|
|
22
|
+
const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive, watch }, { vm, emit, nextTick, framework }) => {
|
|
23
23
|
const api2 = {};
|
|
24
24
|
const state = reactive({
|
|
25
25
|
currentLink: "",
|
|
@@ -38,7 +38,7 @@ const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive, watch
|
|
|
38
38
|
updated: updated({ api: api2 }),
|
|
39
39
|
unmounted: unmounted({ state, api: api2 }),
|
|
40
40
|
getContainer: getContainer({ props }),
|
|
41
|
-
linkClick: linkClick({ state, vm, emit, props, api: api2 }),
|
|
41
|
+
linkClick: linkClick({ state, vm, emit, props, api: api2, framework }),
|
|
42
42
|
onItersectionObserver: onItersectionObserver({ state, props, api: api2, vm, emit }),
|
|
43
43
|
setScrollContainer: setScrollContainer({ state, api: api2 }),
|
|
44
44
|
getCurrentAnchor: getCurrentAnchor({ vm, state, emit }),
|
package/calendar-view/index.js
CHANGED
|
@@ -59,8 +59,48 @@ const isSelectedDate = ({ state }) => (day) => {
|
|
|
59
59
|
const getDayBgColor = ({ props }) => (day) => {
|
|
60
60
|
const date = day.year + "-" + day.month + "-" + day.value;
|
|
61
61
|
const isFunction = props.setDayBgColor instanceof Function;
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
if (isFunction) {
|
|
63
|
+
const result = props.setDayBgColor(date);
|
|
64
|
+
if (typeof result === "object") {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
if (typeof result === "string" && (result.startsWith("#") || result.startsWith("rgb"))) {
|
|
68
|
+
return { backgroundColor: result };
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
return "white";
|
|
73
|
+
};
|
|
74
|
+
const isColorValue = (value) => {
|
|
75
|
+
if (typeof value !== "string")
|
|
76
|
+
return false;
|
|
77
|
+
if (value.startsWith("#"))
|
|
78
|
+
return true;
|
|
79
|
+
if (value.startsWith("rgb"))
|
|
80
|
+
return true;
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
const getDayBgRawValue = ({ props, day }) => {
|
|
84
|
+
const date = day.year + "-" + day.month + "-" + day.value;
|
|
85
|
+
const isFunction = props.setDayBgColor instanceof Function;
|
|
86
|
+
if (isFunction) {
|
|
87
|
+
return props.setDayBgColor(date);
|
|
88
|
+
}
|
|
89
|
+
return "";
|
|
90
|
+
};
|
|
91
|
+
const getDayBgClass = ({ props }) => (day) => {
|
|
92
|
+
const result = getDayBgRawValue({ props, day });
|
|
93
|
+
if (typeof result === "string" && !isColorValue(result) && result) {
|
|
94
|
+
return "bg-" + result;
|
|
95
|
+
}
|
|
96
|
+
return "";
|
|
97
|
+
};
|
|
98
|
+
const getDayBgStyle = ({ props }) => (day) => {
|
|
99
|
+
const result = getDayBgRawValue({ props, day });
|
|
100
|
+
if (isColorValue(result)) {
|
|
101
|
+
return { backgroundColor: result };
|
|
102
|
+
}
|
|
103
|
+
return {};
|
|
64
104
|
};
|
|
65
105
|
const parseDate = (time) => {
|
|
66
106
|
let date = {};
|
|
@@ -642,7 +682,9 @@ export {
|
|
|
642
682
|
getCurWeekEvent,
|
|
643
683
|
getDatesOfNextWeek,
|
|
644
684
|
getDatesOfPreviousWeek,
|
|
685
|
+
getDayBgClass,
|
|
645
686
|
getDayBgColor,
|
|
687
|
+
getDayBgStyle,
|
|
646
688
|
getEventByDate,
|
|
647
689
|
getEventByMonth,
|
|
648
690
|
getEventByTime,
|
package/calendar-view/vue.js
CHANGED
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
isSelectedDate,
|
|
26
26
|
isStartOrEndDay,
|
|
27
27
|
getDayBgColor,
|
|
28
|
+
getDayBgStyle,
|
|
29
|
+
getDayBgClass,
|
|
28
30
|
isShowNewSchedule,
|
|
29
31
|
genDayTimes,
|
|
30
32
|
isShowMark,
|
|
@@ -62,6 +64,8 @@ const api = [
|
|
|
62
64
|
"isSelectedDate",
|
|
63
65
|
"isStartOrEndDay",
|
|
64
66
|
"getDayBgColor",
|
|
67
|
+
"getDayBgStyle",
|
|
68
|
+
"getDayBgClass",
|
|
65
69
|
"isShowNewSchedule",
|
|
66
70
|
"isShowMark",
|
|
67
71
|
"handleCascaderChange",
|
|
@@ -281,6 +285,8 @@ const initApi = ({ vm, api: api2, state, t, props, emit, nextTick }) => {
|
|
|
281
285
|
isSelectedDate: isSelectedDate({ state }),
|
|
282
286
|
isStartOrEndDay: isStartOrEndDay({ state }),
|
|
283
287
|
getDayBgColor: getDayBgColor({ props }),
|
|
288
|
+
getDayBgStyle: getDayBgStyle({ props }),
|
|
289
|
+
getDayBgClass: getDayBgClass({ props }),
|
|
284
290
|
isShowNewSchedule: isShowNewSchedule({ props }),
|
|
285
291
|
genDayTimes: genDayTimes({ props }),
|
|
286
292
|
isShowMark: isShowMark({ props }),
|
package/drawer/index.js
CHANGED
|
@@ -33,8 +33,14 @@ const closed = ({ state, emit }) => () => {
|
|
|
33
33
|
emit("closed");
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const watchVisible = ({
|
|
36
|
+
const watchVisible = ({ props, parent, api }) => (value) => {
|
|
37
37
|
value ? api.open() : api.close();
|
|
38
|
+
if (value) {
|
|
39
|
+
const el = parent.$el;
|
|
40
|
+
if (props.appendToBody) {
|
|
41
|
+
document.body.appendChild(el);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
};
|
|
39
45
|
const open = ({ state, emit, vm }) => () => {
|
|
40
46
|
if (!state.visible) {
|
package/drawer/vue.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
removeKeydownEvent
|
|
21
21
|
} from "./index";
|
|
22
22
|
const api = ["state", "close", "closed", "confirm", "handleClose", "open"];
|
|
23
|
-
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, constants, designConfig }) => {
|
|
23
|
+
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, parent, constants, designConfig }) => {
|
|
24
24
|
const lockScrollClass = constants.SCROLL_LOCK_CLASS(mode);
|
|
25
25
|
const api2 = {};
|
|
26
26
|
const state = reactive({
|
|
@@ -46,13 +46,17 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
46
46
|
removeKeydownEvent: removeKeydownEvent({ api: api2 }),
|
|
47
47
|
addDragEvent: addDragEvent({ api: api2, vm }),
|
|
48
48
|
removeDragEvent: removeDragEvent({ api: api2, vm }),
|
|
49
|
-
watchVisible: watchVisible({
|
|
49
|
+
watchVisible: watchVisible({ props, parent, api: api2 }),
|
|
50
50
|
showScrollbar: showScrollbar(lockScrollClass),
|
|
51
51
|
hideScrollbar: hideScrollbar(lockScrollClass),
|
|
52
52
|
computedWidth: computedWidth({ state, designConfig, props, constants }),
|
|
53
53
|
computedHeight: computedHeight({ state, designConfig, props, constants })
|
|
54
54
|
});
|
|
55
55
|
onMounted(() => {
|
|
56
|
+
const el = parent.$el;
|
|
57
|
+
if (props.appendToBody && el && el.parentNode !== document.body) {
|
|
58
|
+
document.body.appendChild(el);
|
|
59
|
+
}
|
|
56
60
|
props.dragable && api2.addDragEvent();
|
|
57
61
|
api2.addKeydownEvent();
|
|
58
62
|
if (props.lockScroll && props.visible) {
|
|
@@ -63,6 +67,10 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
63
67
|
props.dragable && api2.removeDragEvent();
|
|
64
68
|
api2.removeKeydownEvent();
|
|
65
69
|
props.lockScroll && api2.hideScrollbar();
|
|
70
|
+
const el = parent.$el;
|
|
71
|
+
if (props.appendToBody && el && el.parentNode) {
|
|
72
|
+
el.parentNode.removeChild(el);
|
|
73
|
+
}
|
|
66
74
|
});
|
|
67
75
|
watch(() => props.visible, api2.watchVisible, { immediate: true });
|
|
68
76
|
watch(
|
package/fluent-editor/index.js
CHANGED
|
@@ -7,6 +7,15 @@ import { xss } from "@opentiny/utils";
|
|
|
7
7
|
import { set } from "../chart-core/deps/utils";
|
|
8
8
|
import { on, off } from "@opentiny/utils";
|
|
9
9
|
import { PopupManager } from "@opentiny/utils";
|
|
10
|
+
const isSafeLinkUrl = (url) => /^(https?:|mailto:|tel:|\/|#)/i.test((url || "").trim());
|
|
11
|
+
const openLink = (url, target = "_blank") => {
|
|
12
|
+
if (target === "_blank") {
|
|
13
|
+
const popup = window.open(url, "_blank", "noopener,noreferrer");
|
|
14
|
+
popup && (popup.opener = null);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
window.location.assign(url);
|
|
18
|
+
};
|
|
10
19
|
const init = ({
|
|
11
20
|
api,
|
|
12
21
|
emit,
|
|
@@ -60,6 +69,8 @@ const init = ({
|
|
|
60
69
|
const quill = new FluentEditor(vm.$refs.editor, state.innerOptions);
|
|
61
70
|
quill.emitter.on("file-change", api.fileOperationToSev);
|
|
62
71
|
state.quill = Object.freeze(quill);
|
|
72
|
+
state.linkClickHandler = api.handleLinkClick;
|
|
73
|
+
on(state.quill.root, "click", state.linkClickHandler);
|
|
63
74
|
setTimeout(api.setToolbarTitle);
|
|
64
75
|
let insertTableButton = vm.$el.querySelector(".ql-better-table");
|
|
65
76
|
const tableModule = state.quill.getModule("better-table");
|
|
@@ -201,12 +212,18 @@ const redoHandler = ({ state }) => () => {
|
|
|
201
212
|
const lineheightHandler = ({ state, FluentEditor }) => (value) => {
|
|
202
213
|
state.quill.format("lineheight", value, FluentEditor.sources.USER);
|
|
203
214
|
};
|
|
204
|
-
const fileHandler = ({ api, state }) => () => {
|
|
215
|
+
const fileHandler = ({ api, state, props }) => () => {
|
|
216
|
+
if (props.disabled) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
205
219
|
const option = state.quill.options.uploadOption;
|
|
206
220
|
const accept = option && option.fileAccept;
|
|
207
221
|
api.inputFileHandler("file", accept);
|
|
208
222
|
};
|
|
209
|
-
const imageHandler = ({ api, state }) => () => {
|
|
223
|
+
const imageHandler = ({ api, state, props }) => () => {
|
|
224
|
+
if (props.disabled) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
210
227
|
const option = state.quill.options.uploadOption;
|
|
211
228
|
const accept = option && option.imageAccept;
|
|
212
229
|
api.inputFileHandler("image", accept);
|
|
@@ -233,7 +250,10 @@ const inputFileHandler = ({ state, UploaderDfls }) => (type, accept) => {
|
|
|
233
250
|
}
|
|
234
251
|
fileInput.click();
|
|
235
252
|
};
|
|
236
|
-
const uploaderDflsHandler = ({ api, modules }) => (range, files, fileFlags, rejectFlags) => {
|
|
253
|
+
const uploaderDflsHandler = ({ api, modules, props }) => (range, files, fileFlags, rejectFlags) => {
|
|
254
|
+
if (props.disabled) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
237
257
|
const fileArr = [];
|
|
238
258
|
const imgArr = [];
|
|
239
259
|
files.forEach((file, index) => fileFlags[index] ? fileArr.push(file) : imgArr.push(file));
|
|
@@ -391,7 +411,15 @@ const handleUploadImage = ({ state, api, FluentEditor, Delta, UploaderDfls }) =>
|
|
|
391
411
|
state.promisesData.push({
|
|
392
412
|
imageEnableMultiUpload
|
|
393
413
|
});
|
|
394
|
-
|
|
414
|
+
const toRead = imageEnableMultiUpload ? files : [file];
|
|
415
|
+
const readFileToBlob = (f) => f.arrayBuffer().then((ab) => new Blob([ab], { type: f.type }));
|
|
416
|
+
const uploadPromise = Promise.all(toRead.map(readFileToBlob)).then((blobs) => {
|
|
417
|
+
result.file = blobs[0];
|
|
418
|
+
result.fileName = file.name;
|
|
419
|
+
result.data.files = blobs;
|
|
420
|
+
api.uploadImageToSev(result);
|
|
421
|
+
});
|
|
422
|
+
state.promises.push(uploadPromise);
|
|
395
423
|
} else {
|
|
396
424
|
const promises = files.map((fileItem) => {
|
|
397
425
|
return new Promise((resolve) => {
|
|
@@ -432,7 +460,7 @@ const insertImageToEditor = ({ state, FluentEditor, Delta }) => (range, { data }
|
|
|
432
460
|
state.quill.updateContents(newContent, FluentEditor.sources.USER);
|
|
433
461
|
};
|
|
434
462
|
const uploadImageToSev = ({ state }) => (event) => {
|
|
435
|
-
const { file, hasRejectedImage, callback } = event;
|
|
463
|
+
const { file, fileName, hasRejectedImage, callback } = event;
|
|
436
464
|
const { files } = event.data;
|
|
437
465
|
if (hasRejectedImage) {
|
|
438
466
|
return;
|
|
@@ -448,7 +476,7 @@ const uploadImageToSev = ({ state }) => (event) => {
|
|
|
448
476
|
return;
|
|
449
477
|
}
|
|
450
478
|
let { fd = new FormData(), xhr = new XMLHttpRequest() } = {};
|
|
451
|
-
fd.append(name, file, file.name);
|
|
479
|
+
fd.append(name, file, fileName || file.name || "file");
|
|
452
480
|
options.csrf && fd.append(options.csrf.token, options.csrf.hash);
|
|
453
481
|
xhr.withCredentials = options.withCredentials !== false;
|
|
454
482
|
xhr.open(method, url, true);
|
|
@@ -633,9 +661,44 @@ const beforeUnmount = ({ state, api, vm }) => () => {
|
|
|
633
661
|
api.removeHandleComposition();
|
|
634
662
|
state.quill.off("selection-change", api.selectionChange);
|
|
635
663
|
state.quill.off("text-change", api.textChange);
|
|
664
|
+
off(state.quill.root, "click", state.linkClickHandler);
|
|
665
|
+
state.linkClickHandler = null;
|
|
636
666
|
state.quill = null;
|
|
637
667
|
delete state.quill;
|
|
638
668
|
};
|
|
669
|
+
const handleLinkClick = ({ props, state }) => (event) => {
|
|
670
|
+
var _a;
|
|
671
|
+
const anchor = ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.closest) && event.target.closest("a[href]");
|
|
672
|
+
if (!anchor) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const rawHref = anchor.getAttribute("href") || "";
|
|
676
|
+
const href = xss.filterUrl(rawHref);
|
|
677
|
+
event.preventDefault();
|
|
678
|
+
if (!href || !isSafeLinkUrl(href)) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
const payload = {
|
|
682
|
+
url: href,
|
|
683
|
+
rawUrl: rawHref,
|
|
684
|
+
target: anchor.getAttribute("target") || "_blank",
|
|
685
|
+
rel: anchor.getAttribute("rel") || "",
|
|
686
|
+
event,
|
|
687
|
+
quill: state.quill
|
|
688
|
+
};
|
|
689
|
+
const beforeLinkOpen = props.beforeLinkOpen;
|
|
690
|
+
if (typeof beforeLinkOpen !== "function") {
|
|
691
|
+
openLink(payload.url, payload.target);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const open = (allow) => allow !== false && openLink(payload.url, payload.target);
|
|
695
|
+
try {
|
|
696
|
+
const result = beforeLinkOpen(payload);
|
|
697
|
+
result && typeof result.then === "function" ? result.then(open).catch(() => {
|
|
698
|
+
}) : open(result);
|
|
699
|
+
} catch (_) {
|
|
700
|
+
}
|
|
701
|
+
};
|
|
639
702
|
const computePreviewOptions = ({ props, state, constants, api }) => () => {
|
|
640
703
|
if (props.picPreview && state.previewImgUrl) {
|
|
641
704
|
let previewOptions = typeof props.picPreview === "boolean" ? constants.PIC_PREVIEW_OPTIONS : props.picPreview;
|
|
@@ -742,6 +805,7 @@ export {
|
|
|
742
805
|
handleCompositionend,
|
|
743
806
|
handleCompositionstart,
|
|
744
807
|
handleDblclick,
|
|
808
|
+
handleLinkClick,
|
|
745
809
|
handleUploadFile,
|
|
746
810
|
handleUploadImage,
|
|
747
811
|
handlers,
|
package/fluent-editor/vue.js
CHANGED
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
handleCompositionend,
|
|
38
38
|
removeHandleComposition,
|
|
39
39
|
checkTableISEndElement,
|
|
40
|
-
alignHandler
|
|
40
|
+
alignHandler,
|
|
41
|
+
handleLinkClick
|
|
41
42
|
} from "./index";
|
|
42
43
|
import { defaultOption, iconOption, iconOptionMobileFirst, simpleToolbar } from "./options";
|
|
43
44
|
const api = ["state", "init", "initContent", "selectionChange", "textChange", "doPreview", "handleDblclick"];
|
|
@@ -50,6 +51,7 @@ const initState = ({ api: api2, reactive, computed, props }) => {
|
|
|
50
51
|
innerContent: "",
|
|
51
52
|
fileUploadUrl: props.fileUpload && props.fileUpload.url || "",
|
|
52
53
|
quill: null,
|
|
54
|
+
linkClickHandler: null,
|
|
53
55
|
fileInput: null,
|
|
54
56
|
previewOptions: computed(() => api2.computePreviewOptions()),
|
|
55
57
|
previewImgUrl: "",
|
|
@@ -109,7 +111,12 @@ const initApi = ({ api: api2, state, service, emit, props, nextTick, FluentEdito
|
|
|
109
111
|
uploadImageToSev: uploadImageToSev({ state }),
|
|
110
112
|
doPreview: doPreview({ props, state, nextTick }),
|
|
111
113
|
stringToJson: stringToJson({ props }),
|
|
112
|
-
setToolbarTips: setToolbarTips({
|
|
114
|
+
setToolbarTips: setToolbarTips({
|
|
115
|
+
api: api2,
|
|
116
|
+
vm,
|
|
117
|
+
FluentEditor,
|
|
118
|
+
iconOption: mode === "mobile-first" ? iconOptionMobileFirst : iconOption
|
|
119
|
+
}),
|
|
113
120
|
getOuterHTML: getOuterHTML(),
|
|
114
121
|
setToolbarTitle: setToolbarTitle({ state, t })
|
|
115
122
|
});
|
|
@@ -118,11 +125,23 @@ const mergeApi = (args) => {
|
|
|
118
125
|
let { api: api2, state, service, emit, props, vm, i18n, watch, nextTick, useBreakpoint } = args;
|
|
119
126
|
let { constants, FluentEditor, UploaderDfls, Delta, defaultOptions } = args;
|
|
120
127
|
Object.assign(api2, {
|
|
121
|
-
init: init({
|
|
128
|
+
init: init({
|
|
129
|
+
api: api2,
|
|
130
|
+
emit,
|
|
131
|
+
props,
|
|
132
|
+
service,
|
|
133
|
+
state,
|
|
134
|
+
FluentEditor,
|
|
135
|
+
UploaderDfls,
|
|
136
|
+
defaultOptions,
|
|
137
|
+
vm,
|
|
138
|
+
useBreakpoint,
|
|
139
|
+
simpleToolbar
|
|
140
|
+
}),
|
|
122
141
|
initContent: initContent({ state, props, api: api2, nextTick }),
|
|
123
|
-
fileHandler: fileHandler({ api: api2, state }),
|
|
124
|
-
imageHandler: imageHandler({ api: api2, state }),
|
|
125
|
-
uploaderDflsHandler: uploaderDflsHandler({ api: api2, modules: defaultOptions.modules }),
|
|
142
|
+
fileHandler: fileHandler({ api: api2, state, props }),
|
|
143
|
+
imageHandler: imageHandler({ api: api2, state, props }),
|
|
144
|
+
uploaderDflsHandler: uploaderDflsHandler({ api: api2, modules: defaultOptions.modules, props }),
|
|
126
145
|
handleUploadFile: handleUploadFile({ api: api2, UploaderDfls }),
|
|
127
146
|
handleUploadImage: handleUploadImage({ state, api: api2, FluentEditor, Delta, UploaderDfls }),
|
|
128
147
|
handlers: handlers({ api: api2 }),
|
|
@@ -138,7 +157,8 @@ const mergeApi = (args) => {
|
|
|
138
157
|
handleComposition: handleComposition({ state, api: api2 }),
|
|
139
158
|
handleCompositionstart: handleCompositionstart({ state }),
|
|
140
159
|
handleCompositionend: handleCompositionend({ state }),
|
|
141
|
-
removeHandleComposition: removeHandleComposition({ state, api: api2 })
|
|
160
|
+
removeHandleComposition: removeHandleComposition({ state, api: api2 }),
|
|
161
|
+
handleLinkClick: handleLinkClick({ props, state })
|
|
142
162
|
});
|
|
143
163
|
};
|
|
144
164
|
const initWatch = ({ watch, state, api: api2, props, vm }) => {
|
|
@@ -172,7 +192,7 @@ const initWatch = ({ watch, state, api: api2, props, vm }) => {
|
|
|
172
192
|
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { service, emit, i18n, constants, nextTick, vm, t, useBreakpoint, mode }, { FluentEditor }) => {
|
|
173
193
|
const api2 = {};
|
|
174
194
|
const { DEFAULTS: UploaderDfls } = FluentEditor.imports["modules/uploader"];
|
|
175
|
-
const Delta = FluentEditor.imports
|
|
195
|
+
const Delta = FluentEditor.imports.delta;
|
|
176
196
|
const state = initState({ reactive, computed, api: api2, props });
|
|
177
197
|
const defaultOptions = defaultOption({ FluentEditor, state, mentionObj: props.mentionObj });
|
|
178
198
|
initApi({ api: api2, state, service, emit, props, nextTick, FluentEditor, UploaderDfls, Delta, vm, t, mode });
|
package/input/vue.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
} from "./index";
|
|
42
42
|
import useStorageBox from "../tall-storage/vue-storage-box";
|
|
43
43
|
import { on, off } from "@opentiny/utils";
|
|
44
|
-
import {
|
|
44
|
+
import { debounceBoth } from "@opentiny/utils";
|
|
45
45
|
const api = [
|
|
46
46
|
"blur",
|
|
47
47
|
"showBox",
|
|
@@ -222,7 +222,8 @@ const mergeApi = ({
|
|
|
222
222
|
}),
|
|
223
223
|
handleFocus: handleFocus({ api: api2, emit, state }),
|
|
224
224
|
handleInput: handleInput({ api: api2, emit, nextTick, state }),
|
|
225
|
-
resizeTextarea:
|
|
225
|
+
resizeTextarea: debounceBoth(200, resizeTextarea({ api: api2, parent, vm, state, props })),
|
|
226
|
+
// 抖动的首尾都要执行一次
|
|
226
227
|
updateIconOffset: updateIconOffset(api2),
|
|
227
228
|
calcTextareaHeight: calcTextareaHeight({
|
|
228
229
|
api: api2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.30.0",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"author": "OpenTiny Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/utils": "~3.
|
|
29
|
-
"@opentiny/vue-hooks": "~3.
|
|
28
|
+
"@opentiny/utils": "~3.30.0",
|
|
29
|
+
"@opentiny/vue-hooks": "~3.30.0",
|
|
30
30
|
"color": "4.2.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/rate/index.js
CHANGED
|
@@ -114,8 +114,7 @@ const showDecimalIcon = ({ props, state }) => (item) => {
|
|
|
114
114
|
const showWhenAllowHalf = props.allowHalf && state.pointerAtLeftHalf && item - 0.5 <= state.currentValue && item > state.currentValue;
|
|
115
115
|
return showWhenDisabled || showWhenAllowHalf;
|
|
116
116
|
};
|
|
117
|
-
const getIconStyle = ({
|
|
118
|
-
const isHalf = api.showDecimalIcon(item);
|
|
117
|
+
const getIconStyle = ({ props, state }) => (item) => {
|
|
119
118
|
const voidColor = props.disabled ? props.disabledVoidColor : props.voidColor;
|
|
120
119
|
if (props.radio) {
|
|
121
120
|
return {
|
|
@@ -124,7 +123,7 @@ const getIconStyle = ({ api, props, state }) => (item) => {
|
|
|
124
123
|
};
|
|
125
124
|
}
|
|
126
125
|
return {
|
|
127
|
-
fill:
|
|
126
|
+
fill: item <= state.currentValue ? state.activeColor : voidColor,
|
|
128
127
|
"font-size": props.size || "18px"
|
|
129
128
|
};
|
|
130
129
|
};
|
package/rate/vue.js
CHANGED
|
@@ -120,7 +120,7 @@ const renderless = (props, { computed, reactive, toRefs, watch, onMounted, onUnm
|
|
|
120
120
|
computedActiveColor: computedActiveColor(props),
|
|
121
121
|
computedActiveClass: computedActiveClass(props),
|
|
122
122
|
showDecimalIcon: showDecimalIcon({ props, state }),
|
|
123
|
-
getIconStyle: getIconStyle({
|
|
123
|
+
getIconStyle: getIconStyle({ props, state })
|
|
124
124
|
}, changeValue.api));
|
|
125
125
|
return api2;
|
|
126
126
|
};
|
package/rich-text/index.js
CHANGED
|
@@ -106,6 +106,26 @@ const initQuill = ({ api, emit, props, vm, service, state, Quill, ImageDrop, Ima
|
|
|
106
106
|
}
|
|
107
107
|
emit("ready", state.quill);
|
|
108
108
|
api.setToolbarTips();
|
|
109
|
+
api.setTooltipI18n();
|
|
110
|
+
state.tooltipI18nHandler = () => setTimeout(() => {
|
|
111
|
+
api.setTooltipI18n();
|
|
112
|
+
api.adjustTooltipPosition();
|
|
113
|
+
});
|
|
114
|
+
state.tooltipResizeHandler = () => api.adjustTooltipPosition();
|
|
115
|
+
vm.$el.addEventListener("click", state.tooltipI18nHandler);
|
|
116
|
+
vm.$el.addEventListener("keyup", state.tooltipI18nHandler);
|
|
117
|
+
window.addEventListener("resize", state.tooltipResizeHandler);
|
|
118
|
+
if (typeof MutationObserver !== "undefined") {
|
|
119
|
+
state.tooltipObserver = new MutationObserver(() => {
|
|
120
|
+
requestAnimationFrame(() => api.adjustTooltipPosition());
|
|
121
|
+
});
|
|
122
|
+
state.tooltipObserver.observe(vm.$el, {
|
|
123
|
+
childList: true,
|
|
124
|
+
subtree: true,
|
|
125
|
+
attributes: true,
|
|
126
|
+
attributeFilter: ["style", "class", "data-mode"]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
109
129
|
};
|
|
110
130
|
const handleClick = ({ state, Quill }) => (event) => {
|
|
111
131
|
const el = event.target;
|
|
@@ -138,6 +158,64 @@ const setToolbarTips = ({ t, vm }) => () => {
|
|
|
138
158
|
});
|
|
139
159
|
}
|
|
140
160
|
};
|
|
161
|
+
const setTooltipI18n = ({ t, vm }) => () => {
|
|
162
|
+
const richTextEl = vm.$el;
|
|
163
|
+
const tips = richTextEl.querySelectorAll(".ql-container .ql-tooltip");
|
|
164
|
+
const getPlaceholderByMode = (mode) => {
|
|
165
|
+
if (mode === "video")
|
|
166
|
+
return t("ui.richText.enterVideo");
|
|
167
|
+
if (mode === "formula")
|
|
168
|
+
return t("ui.richText.enterFormula");
|
|
169
|
+
return t("ui.richText.enterLink");
|
|
170
|
+
};
|
|
171
|
+
if (tips.length) {
|
|
172
|
+
Array.prototype.slice.call(tips).forEach((tip) => {
|
|
173
|
+
const mode = tip.getAttribute("data-mode") || "link";
|
|
174
|
+
const input = tip.querySelector("input[type='text']");
|
|
175
|
+
tip.setAttribute("data-visit-url-text", `${t("ui.richText.visitUrl")}:`);
|
|
176
|
+
tip.setAttribute("data-edit-text", t("ui.richText.edit"));
|
|
177
|
+
tip.setAttribute("data-remove-text", t("ui.richText.remove"));
|
|
178
|
+
tip.setAttribute("data-save-text", t("ui.richText.save"));
|
|
179
|
+
tip.setAttribute("data-enter-link-text", `${t("ui.richText.enterLink")}:`);
|
|
180
|
+
tip.setAttribute("data-enter-formula-text", `${t("ui.richText.enterFormula")}:`);
|
|
181
|
+
tip.setAttribute("data-enter-video-text", `${t("ui.richText.enterVideo")}:`);
|
|
182
|
+
if (input) {
|
|
183
|
+
input.setAttribute("placeholder", getPlaceholderByMode(mode));
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const adjustTooltipPosition = ({ vm }) => () => {
|
|
189
|
+
const container = vm.$el.querySelector(".ql-container");
|
|
190
|
+
const tips = vm.$el.querySelectorAll(".ql-container .ql-tooltip");
|
|
191
|
+
const minGap = 8;
|
|
192
|
+
if (!container) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const containerRect = container.getBoundingClientRect();
|
|
196
|
+
if (tips.length) {
|
|
197
|
+
Array.prototype.slice.call(tips).forEach((tip) => {
|
|
198
|
+
if (!tip.classList.contains("ql-editing")) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const offsetParent = tip.offsetParent || tip.parentElement;
|
|
202
|
+
if (!offsetParent) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const parentRect = offsetParent.getBoundingClientRect();
|
|
206
|
+
const currentLeft = parseFloat(tip.style.left || "0");
|
|
207
|
+
const safeCurrentLeft = Number.isFinite(currentLeft) ? currentLeft : 0;
|
|
208
|
+
const minLeft = containerRect.left - parentRect.left + minGap;
|
|
209
|
+
const maxLeft = containerRect.right - parentRect.left - tip.offsetWidth - minGap;
|
|
210
|
+
if (maxLeft <= minLeft) {
|
|
211
|
+
tip.style.left = `${minLeft}px`;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const clampedLeft = Math.min(Math.max(safeCurrentLeft, minLeft), maxLeft);
|
|
215
|
+
tip.style.left = `${clampedLeft}px`;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
};
|
|
141
219
|
const setPlaceholder = ({ state, props }) => () => {
|
|
142
220
|
if (state.quill) {
|
|
143
221
|
state.quill.root.setAttribute("data-placeholder", props.options.placeholder);
|
|
@@ -220,17 +298,27 @@ const mounted = ({ api, props, state, i18n, watch }) => () => {
|
|
|
220
298
|
api.initQuill();
|
|
221
299
|
}
|
|
222
300
|
if (i18n) {
|
|
223
|
-
watch(() => i18n.locale,
|
|
301
|
+
watch(() => i18n.locale, () => {
|
|
302
|
+
api.setToolbarTips();
|
|
303
|
+
api.setTooltipI18n();
|
|
304
|
+
api.adjustTooltipPosition();
|
|
305
|
+
});
|
|
224
306
|
}
|
|
225
307
|
};
|
|
226
|
-
const beforeUnmount = ({ api, state }) => () => {
|
|
308
|
+
const beforeUnmount = ({ api, state, vm }) => () => {
|
|
227
309
|
state.quill.off("selection-change", api.selectionChange);
|
|
228
310
|
state.quill.off("text-change", api.textChange);
|
|
229
311
|
state.quill.root.removeEventListener("click", api.handleClick);
|
|
312
|
+
state.tooltipI18nHandler && vm.$el.removeEventListener("click", state.tooltipI18nHandler);
|
|
313
|
+
state.tooltipI18nHandler && vm.$el.removeEventListener("keyup", state.tooltipI18nHandler);
|
|
314
|
+
state.tooltipResizeHandler && window.removeEventListener("resize", state.tooltipResizeHandler);
|
|
315
|
+
state.tooltipObserver && state.tooltipObserver.disconnect();
|
|
316
|
+
state.tooltipObserver = null;
|
|
230
317
|
state.quill = null;
|
|
231
318
|
delete state.quill;
|
|
232
319
|
};
|
|
233
320
|
export {
|
|
321
|
+
adjustTooltipPosition,
|
|
234
322
|
beforeUnmount,
|
|
235
323
|
getFileUploadUrl,
|
|
236
324
|
handleClick,
|
|
@@ -243,5 +331,6 @@ export {
|
|
|
243
331
|
selectionChange,
|
|
244
332
|
setPlaceholder,
|
|
245
333
|
setToolbarTips,
|
|
334
|
+
setTooltipI18n,
|
|
246
335
|
textChange
|
|
247
336
|
};
|
package/rich-text/vue.js
CHANGED
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
initContent,
|
|
4
4
|
initQuill,
|
|
5
5
|
setToolbarTips,
|
|
6
|
+
setTooltipI18n,
|
|
7
|
+
adjustTooltipPosition,
|
|
6
8
|
setPlaceholder,
|
|
7
9
|
getFileUploadUrl,
|
|
8
10
|
selectionChange,
|
|
@@ -19,6 +21,8 @@ const api = [
|
|
|
19
21
|
"initContent",
|
|
20
22
|
"initQuill",
|
|
21
23
|
"setToolbarTips",
|
|
24
|
+
"setTooltipI18n",
|
|
25
|
+
"adjustTooltipPosition",
|
|
22
26
|
"setPlaceholder",
|
|
23
27
|
"selectionChange",
|
|
24
28
|
"textChange",
|
|
@@ -32,7 +36,10 @@ const initState = ({ reactive, props, computed, api: api2 }) => {
|
|
|
32
36
|
content: props.modelValue || props.content,
|
|
33
37
|
maxLength: computed(() => api2.maxLength()),
|
|
34
38
|
pasteCanceled: false,
|
|
35
|
-
isDisplayOnly: computed(() => api2.isDisplayOnly())
|
|
39
|
+
isDisplayOnly: computed(() => api2.isDisplayOnly()),
|
|
40
|
+
tooltipI18nHandler: null,
|
|
41
|
+
tooltipResizeHandler: null,
|
|
42
|
+
tooltipObserver: null
|
|
36
43
|
});
|
|
37
44
|
return state;
|
|
38
45
|
};
|
|
@@ -44,12 +51,14 @@ const initApi = (args) => {
|
|
|
44
51
|
initContent: initContent({ state, props, nextTick }),
|
|
45
52
|
initQuill: initQuill({ service, emit, props, api: api2, state, vm, ImageDrop, FileUpload, ImageUpload, Quill }),
|
|
46
53
|
setToolbarTips: setToolbarTips({ t, vm }),
|
|
54
|
+
setTooltipI18n: setTooltipI18n({ t, vm }),
|
|
55
|
+
adjustTooltipPosition: adjustTooltipPosition({ vm }),
|
|
47
56
|
setPlaceholder: setPlaceholder({ state, props }),
|
|
48
57
|
getFileUploadUrl: getFileUploadUrl({ service }),
|
|
49
58
|
selectionChange: selectionChange({ emit, state }),
|
|
50
59
|
textChange: textChange({ emit, vm, state, Modal, t }),
|
|
51
60
|
mounted: mounted({ api: api2, props, state, i18n, watch }),
|
|
52
|
-
beforeUnmount: beforeUnmount({ api: api2, state }),
|
|
61
|
+
beforeUnmount: beforeUnmount({ api: api2, state, vm }),
|
|
53
62
|
maxLength: maxLength({ props, constants }),
|
|
54
63
|
handlePaste: handlePaste({ state }),
|
|
55
64
|
isDisplayOnly: isDisplayOnly({ state, props, parent, nextTick }),
|
package/select/index.js
CHANGED
|
@@ -1131,6 +1131,11 @@ const watchVisible = ({ api, constants, emit, state, vm, props, isMobileFirstMod
|
|
|
1131
1131
|
vm.$refs.scrollbar.handleScroll();
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
+
if (value && state.device === "mb" && state.breakpoint === "default") {
|
|
1135
|
+
if (document.activeElement) {
|
|
1136
|
+
document.activeElement.blur();
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1134
1139
|
}, props.updateDelay);
|
|
1135
1140
|
if (!value && props.shape === "filter") {
|
|
1136
1141
|
state.softFocus = false;
|
package/tabs-mf/index.js
CHANGED
|
@@ -39,7 +39,9 @@ const canLeave = (props) => (newTab, oldTab) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
const changeCurrentName = ({ emit, state }) => (name) => {
|
|
42
|
-
state.items.forEach((item) =>
|
|
42
|
+
state.items.forEach((item) => {
|
|
43
|
+
item.selected = item.name === name;
|
|
44
|
+
});
|
|
43
45
|
emit("update:activeName", name);
|
|
44
46
|
emit("update:modelValue", name);
|
|
45
47
|
};
|
|
@@ -111,7 +113,13 @@ const removeItem = ({ props, state, emit, api }) => (name, silent = false) => {
|
|
|
111
113
|
state.navs = [...state.navs];
|
|
112
114
|
if (isCurrent) {
|
|
113
115
|
const nextName = nextNav ? nextNav.name : ((_a = state.items[0]) == null ? void 0 : _a.name) || "";
|
|
114
|
-
|
|
116
|
+
if (silent) {
|
|
117
|
+
state.items.forEach((item) => {
|
|
118
|
+
item.selected = item.name === nextName;
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
api.changeCurrentName(nextName);
|
|
122
|
+
}
|
|
115
123
|
state.currentItem = state.items.find((item) => item.name === nextName) || null;
|
|
116
124
|
}
|
|
117
125
|
if (!silent) {
|
package/time-spinner/index.js
CHANGED
|
@@ -75,7 +75,7 @@ const handleScroll = ({ api, vm, state }) => (type) => {
|
|
|
75
75
|
api.modifyDateField(type, value);
|
|
76
76
|
};
|
|
77
77
|
const selectDateScroll = ({ state, props }) => (type, value) => {
|
|
78
|
-
if (
|
|
78
|
+
if (props.endDate instanceof Date) {
|
|
79
79
|
const endHours = props.endDate.getHours();
|
|
80
80
|
const endMinutes = props.endDate.getMinutes();
|
|
81
81
|
const endSeconds = props.endDate.getSeconds();
|
|
@@ -86,7 +86,7 @@ const selectDateScroll = ({ state, props }) => (type, value) => {
|
|
|
86
86
|
} else {
|
|
87
87
|
value = state.hours === endHours && state.minutes === endMinutes && value > endSeconds ? state.seconds : value;
|
|
88
88
|
}
|
|
89
|
-
} else if (
|
|
89
|
+
} else if (props.startDate instanceof Date) {
|
|
90
90
|
const startHours = props.startDate.getHours();
|
|
91
91
|
const startMinutes = props.startDate.getMinutes();
|
|
92
92
|
const startSeconds = props.startDate.getSeconds();
|
package/tree-select/index.js
CHANGED
|
@@ -3,18 +3,35 @@ import {
|
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
5
|
import { find } from "@opentiny/utils";
|
|
6
|
+
const getSingleSelectedData = ({ props, data }) => __spreadProps(__spreadValues({}, data), {
|
|
7
|
+
currentLabel: data[props.textField],
|
|
8
|
+
value: data[props.valueField],
|
|
9
|
+
state: {
|
|
10
|
+
currentLabel: data[props.textField]
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const updateSingleSelected = ({ props, vm, data }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
vm.$refs.baseSelectRef.updateSelectedData(data);
|
|
16
|
+
const baseState = vm.$refs.baseSelectRef.state;
|
|
17
|
+
if (!baseState)
|
|
18
|
+
return;
|
|
19
|
+
const currentLabel = (_a = data == null ? void 0 : data[props.textField]) != null ? _a : "";
|
|
20
|
+
baseState.selectedLabel = currentLabel;
|
|
21
|
+
if (props.filterable || props.searchable) {
|
|
22
|
+
baseState.query = currentLabel;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
6
25
|
const filter = ({ vm }) => (value) => {
|
|
7
26
|
vm.$refs.treeRef.filter(value);
|
|
8
27
|
};
|
|
9
28
|
const nodeClick = ({ props, vm, emit }) => (data) => {
|
|
10
29
|
if (!props.multiple) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}));
|
|
30
|
+
updateSingleSelected({
|
|
31
|
+
props,
|
|
32
|
+
vm,
|
|
33
|
+
data: getSingleSelectedData({ props, data })
|
|
34
|
+
});
|
|
18
35
|
emit("change", data[props.valueField]);
|
|
19
36
|
emit("update:modelValue", data[props.valueField]);
|
|
20
37
|
vm.$refs.baseSelectRef.hidePanel();
|
|
@@ -114,17 +131,35 @@ const mounted = ({ api, state, props, vm }) => () => {
|
|
|
114
131
|
const data = options && options.length > 0 ? options[0] : null;
|
|
115
132
|
if (!data)
|
|
116
133
|
return;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
134
|
+
updateSingleSelected({
|
|
135
|
+
props,
|
|
136
|
+
vm,
|
|
137
|
+
data: getSingleSelectedData({ props, data })
|
|
138
|
+
});
|
|
124
139
|
state.currentKey = data[props.valueField];
|
|
125
140
|
}
|
|
126
141
|
};
|
|
127
142
|
const watchValue = ({ api, props, vm, state }) => (newValue, oldValue) => {
|
|
143
|
+
if (!props.multiple) {
|
|
144
|
+
if (newValue === oldValue || newValue === state.currentKey)
|
|
145
|
+
return;
|
|
146
|
+
if (newValue === null || newValue === void 0 || newValue === "") {
|
|
147
|
+
updateSingleSelected({ props, vm, data: {} });
|
|
148
|
+
state.currentKey = "";
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const options = api.getPluginOption(newValue);
|
|
152
|
+
const data = options && options.length > 0 ? options[0] : null;
|
|
153
|
+
if (!data)
|
|
154
|
+
return;
|
|
155
|
+
updateSingleSelected({
|
|
156
|
+
props,
|
|
157
|
+
vm,
|
|
158
|
+
data: getSingleSelectedData({ props, data })
|
|
159
|
+
});
|
|
160
|
+
state.currentKey = data[props.valueField];
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
128
163
|
if (props.multiple) {
|
|
129
164
|
const xorResult = oldValue.filter((item) => !newValue.includes(item));
|
|
130
165
|
const tagId = xorResult[0];
|
package/types/anchor.type.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare const mounted: ({ state, api, props, nextTick }: Pick<IAnchorRenderlessP
|
|
|
49
49
|
declare const updated: ({ api }: Pick<IAnchorRenderlessParams, 'api'>) => () => void;
|
|
50
50
|
declare const unmounted: ({ state, api }: Pick<IAnchorRenderlessParams, 'state' | 'api'>) => () => void;
|
|
51
51
|
declare const onItersectionObserver: ({ state, props, api, vm, emit }: Pick<IAnchorRenderlessParams, 'state' | 'props' | 'api' | 'vm' | 'emit'>) => () => void;
|
|
52
|
-
declare const linkClick: ({ state, vm, emit, props, api }: Pick<IAnchorRenderlessParams, 'state' | 'vm' | 'emit' | 'props' | 'api'>) => (e: Event, item: IAnchorLinkItem) => void;
|
|
52
|
+
declare const linkClick: ({ state, vm, emit, props, api, framework }: Pick<IAnchorRenderlessParams, 'state' | 'vm' | 'emit' | 'props' | 'api' | 'framework'>) => (e: Event, item: IAnchorLinkItem) => void;
|
|
53
53
|
|
|
54
54
|
type IAnchorObject = HTMLElement | null;
|
|
55
55
|
interface IAnchorState {
|
package/types/drawer.type.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ declare const drawerProps: {
|
|
|
15
15
|
DEFAULT_HEIGHT: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
appendToBody: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: () => boolean;
|
|
21
|
+
};
|
|
18
22
|
visible: {
|
|
19
23
|
type: BooleanConstructor;
|
|
20
24
|
default: boolean;
|
|
@@ -81,7 +85,7 @@ declare const close: ({ api }: {
|
|
|
81
85
|
api: IDrawerApi;
|
|
82
86
|
}) => (force?: boolean) => void;
|
|
83
87
|
declare const closed: ({ state, emit }: Pick<IDrawerRenderlessParams, 'state' | 'emit'>) => () => void;
|
|
84
|
-
declare const watchVisible: ({
|
|
88
|
+
declare const watchVisible: ({ props, parent, api }: Pick<IDrawerRenderlessParams, 'props' | 'parent' | 'api'>) => (value: boolean) => void;
|
|
85
89
|
declare const open: ({ state, emit, vm }: Pick<IDrawerRenderlessParams, 'state' | 'emit' | 'vm'>) => () => void;
|
|
86
90
|
declare const confirm: ({ api }: {
|
|
87
91
|
api: IDrawerApi;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { C as IFileUploadAfterDownload, m as IFileUploadApi, D as IFileUploadBatchSegmentDownload, y as IFileUploadBatchSegmentUpload, a as IFileUploadConstants, w as IFileUploadDownloadFileInner, x as IFileUploadDownloadFileSingle, u as IFileUploadDownloadFileSingleInner, t as IFileUploadEdmDownload, s as IFileUploadFile, A as IFileUploadGetFormData, v as IFileUploadLargeDocumentDownload, r as IFileUploadModalVm, o as IFileUploadProps, p as IFileUploadRenderlessParamUtils, q as IFileUploadRenderlessParams, z as IFileUploadSegmentUploadInner, n as IFileUploadService, B as IFileUploadSetWriterFile, E as IFileUploadSliceDownloadChunk, l as IFileUploadState, F as IFileUploadStreamsaver, I as IFileUploadVm } from './upload-list.type-
|
|
2
|
+
export { C as IFileUploadAfterDownload, m as IFileUploadApi, D as IFileUploadBatchSegmentDownload, y as IFileUploadBatchSegmentUpload, a as IFileUploadConstants, w as IFileUploadDownloadFileInner, x as IFileUploadDownloadFileSingle, u as IFileUploadDownloadFileSingleInner, t as IFileUploadEdmDownload, s as IFileUploadFile, A as IFileUploadGetFormData, v as IFileUploadLargeDocumentDownload, r as IFileUploadModalVm, o as IFileUploadProps, p as IFileUploadRenderlessParamUtils, q as IFileUploadRenderlessParams, z as IFileUploadSegmentUploadInner, n as IFileUploadService, B as IFileUploadSetWriterFile, E as IFileUploadSliceDownloadChunk, l as IFileUploadState, F as IFileUploadStreamsaver, I as IFileUploadVm } from './upload-list.type-36a8374a.js';
|
|
3
3
|
import './shared.type.js';
|
package/types/input.type.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ declare const calculateNodeStyling: () => (targetElement: HTMLElement) => {
|
|
|
248
248
|
borderSize: number;
|
|
249
249
|
boxSizing: string;
|
|
250
250
|
};
|
|
251
|
-
declare const calcTextareaHeight: ({ api, hiddenTextarea, props, state, mode, constants }: Pick<IInputRenderlessParams, "
|
|
251
|
+
declare const calcTextareaHeight: ({ api, hiddenTextarea, props, state, mode, constants }: Pick<IInputRenderlessParams, "mode" | "props" | "state" | "api" | "constants"> & {
|
|
252
252
|
hiddenTextarea: HTMLTextAreaElement | null;
|
|
253
253
|
}) => (targetElement: HTMLTextAreaElement, minRows?: number, maxRows?: null) => {
|
|
254
254
|
minHeight?: string | undefined;
|
package/types/popover.type.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ declare const popoverProps: {
|
|
|
93
93
|
*
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
declare const mounted: ({ api, state, constants, props, nextTick, mode }: Pick<IPopoverRenderlessParams, "
|
|
96
|
+
declare const mounted: ({ api, state, constants, props, nextTick, mode }: Pick<IPopoverRenderlessParams, "mode" | "props" | "state" | "api" | "nextTick"> & {
|
|
97
97
|
constants: {
|
|
98
98
|
IDPREFIX: string;
|
|
99
99
|
};
|
package/types/rate.type.d.ts
CHANGED
|
@@ -164,8 +164,7 @@ declare const showDecimalIcon: ({ props, state }: {
|
|
|
164
164
|
props: any;
|
|
165
165
|
state: any;
|
|
166
166
|
}) => (item: any) => any;
|
|
167
|
-
declare const getIconStyle: ({
|
|
168
|
-
api: any;
|
|
167
|
+
declare const getIconStyle: ({ props, state }: {
|
|
169
168
|
props: any;
|
|
170
169
|
state: any;
|
|
171
170
|
}) => (item: any) => {
|
package/types/transfer.type.d.ts
CHANGED
|
@@ -112,14 +112,14 @@ declare const getSourceData: ({ props, Tree }: Pick<ITransferRenderlessParams, "
|
|
|
112
112
|
Tree: string;
|
|
113
113
|
}) => () => unknown[];
|
|
114
114
|
/** 返回右边的数据项 */
|
|
115
|
-
declare const getTargetData: ({ props, state, Tree, Table }: Pick<ITransferRenderlessParams, "
|
|
115
|
+
declare const getTargetData: ({ props, state, Tree, Table }: Pick<ITransferRenderlessParams, "props" | "state"> & {
|
|
116
116
|
Tree: string;
|
|
117
117
|
Table: string;
|
|
118
118
|
}) => () => unknown;
|
|
119
119
|
declare const onSourceCheckedChange: ({ emit, state }: Pick<ITransferRenderlessParams, 'emit' | 'state'>) => (val: string[], movedKeys: string[]) => void;
|
|
120
120
|
declare const onTargetCheckedChange: ({ emit, state }: Pick<ITransferRenderlessParams, 'emit' | 'state'>) => (val: string[], movedKeys: string[]) => void;
|
|
121
121
|
declare const addToLeft: ({ emit, props, state }: Pick<ITransferRenderlessParams, 'emit' | 'props' | 'state'>) => (value: undefined | 'all') => void;
|
|
122
|
-
declare const addToRight: ({ emit, refs, props, state, Tree }: Pick<ITransferRenderlessParams, "
|
|
122
|
+
declare const addToRight: ({ emit, refs, props, state, Tree }: Pick<ITransferRenderlessParams, "emit" | "props" | "state" | "refs"> & {
|
|
123
123
|
Tree: string;
|
|
124
124
|
}) => (value: undefined | 'all') => void;
|
|
125
125
|
declare const clearQuery: (refs: ITransferRenderlessParams['refs']) => (which: 'left' | 'right') => void;
|
|
@@ -130,7 +130,7 @@ declare const logicFun: ({ props, emit, state, vm }: Pick<ITransferRenderlessPar
|
|
|
130
130
|
pullMode?: "sort" | undefined;
|
|
131
131
|
}) => void;
|
|
132
132
|
/** 组件加载后,给左右面板初始化Sortable的功能 */
|
|
133
|
-
declare const sortableEvent: ({ api, droppanel, props, queryDom, refs }: Pick<ITransferRenderlessParams, "props" | "
|
|
133
|
+
declare const sortableEvent: ({ api, droppanel, props, queryDom, refs }: Pick<ITransferRenderlessParams, "props" | "api" | "refs"> & {
|
|
134
134
|
droppanel: string;
|
|
135
135
|
queryDom: string;
|
|
136
136
|
}) => () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtractPropTypes } from 'vue';
|
|
2
2
|
import { ISharedRenderlessParamUtils, ISharedRenderlessFunctionParams } from './shared.type.js';
|
|
3
|
-
import { I as IFileUploadVm, a as IFileUploadConstants } from './upload-list.type-
|
|
3
|
+
import { I as IFileUploadVm, a as IFileUploadConstants } from './upload-list.type-36a8374a.js';
|
|
4
4
|
|
|
5
5
|
declare const UploadDraggerProps: {
|
|
6
6
|
disabled: BooleanConstructor;
|
|
@@ -489,7 +489,7 @@ declare const sliceDownloadChunk: ({ state }: Pick<IFileUploadRenderlessParams,
|
|
|
489
489
|
declare const batchSegmentDownload: ({ state, api }: Pick<IFileUploadRenderlessParams, 'state' | 'api'>) => ({ batchIndex, batches, docId, isBatch, isLessThan17G }: IFileUploadBatchSegmentDownload) => void;
|
|
490
490
|
declare const downloadFileInner: ({ api, props, state }: Pick<IFileUploadRenderlessParams, 'api' | 'props' | 'state'>) => ({ batchIndex, file, range, isBatch, isChunk, isLessThan17G }: IFileUploadDownloadFileInner) => void;
|
|
491
491
|
declare const afterDownload: ({ api, state }: Pick<IFileUploadRenderlessParams, 'api' | 'state'>) => ({ batchIndex, range, data, file, isBatch, isChunk, isLessThan17G }: IFileUploadAfterDownload) => void;
|
|
492
|
-
declare const setWriterFile: ({ state, emit, Streamsaver }: Pick<IFileUploadRenderlessParams, "
|
|
492
|
+
declare const setWriterFile: ({ state, emit, Streamsaver }: Pick<IFileUploadRenderlessParams, "emit" | "state"> & {
|
|
493
493
|
Streamsaver: IFileUploadStreamsaver;
|
|
494
494
|
}) => ({ data, index, isLessThan17G, file }: IFileUploadSetWriterFile) => Function;
|
|
495
495
|
declare const getFormData$1: ({ constants, props, state }: Pick<IFileUploadRenderlessParams, 'constants' | 'props' | 'state'>) => ({ formData, file, type }: IFileUploadGetFormData) => IUploadFormData;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-
|
|
2
|
+
export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-36a8374a.js';
|
|
3
3
|
import './shared.type.js';
|
package/types/upload.type.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-
|
|
2
|
+
export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-36a8374a.js';
|
|
3
3
|
import './shared.type.js';
|
package/user/index.js
CHANGED
|
@@ -286,7 +286,7 @@ const userChange = ({ api, emit, props, state, dispatch, constants }) => (value,
|
|
|
286
286
|
const syncCacheIds = ({ props, state }) => (ids, queryIds, cacheData) => {
|
|
287
287
|
const { cacheFields, cacheKey } = props;
|
|
288
288
|
const { valueField } = state;
|
|
289
|
-
const cacheUsers = toJson(window.
|
|
289
|
+
const cacheUsers = toJson(window.sessionStorage.getItem(cacheKey)) || {};
|
|
290
290
|
const caseCacheUsers = getLowerCaseObj(cacheUsers);
|
|
291
291
|
ids.forEach((id) => {
|
|
292
292
|
const caseId = toLowerCase(id);
|
|
@@ -294,7 +294,7 @@ const syncCacheIds = ({ props, state }) => (ids, queryIds, cacheData) => {
|
|
|
294
294
|
if (cacheUser2) {
|
|
295
295
|
const textField = state.textField === "userCN" || state.textField === "userId" || state.textField === "dept" ? "" : state.textField;
|
|
296
296
|
if (textField !== "" && !cacheUser2.a) {
|
|
297
|
-
window.
|
|
297
|
+
window.sessionStorage.removeItem(cacheKey);
|
|
298
298
|
queryIds.push(id);
|
|
299
299
|
}
|
|
300
300
|
const user = {
|
|
@@ -344,7 +344,7 @@ const getUsers = ({ api, props, state, emit }) => (value) => {
|
|
|
344
344
|
});
|
|
345
345
|
};
|
|
346
346
|
const updateCache = ({ props, state }) => () => {
|
|
347
|
-
const users = toJson(window.
|
|
347
|
+
const users = toJson(window.sessionStorage.getItem(props.cacheKey)) || {};
|
|
348
348
|
const currDate = toDateStr(/* @__PURE__ */ new Date(), "yyyyMMdd");
|
|
349
349
|
if (currDate !== users.t) {
|
|
350
350
|
users.t = currDate;
|
|
@@ -362,12 +362,12 @@ const updateCache = ({ props, state }) => () => {
|
|
|
362
362
|
state.cache = users;
|
|
363
363
|
};
|
|
364
364
|
const saveCache = ({ props }) => (cache) => {
|
|
365
|
-
window.
|
|
365
|
+
window.sessionStorage.setItem(props.cacheKey, toJsonStr(cache));
|
|
366
366
|
};
|
|
367
367
|
const cacheUser = ({ api, props, service, state }) => (users) => {
|
|
368
368
|
const { cacheKey } = props;
|
|
369
369
|
const { valueField } = state;
|
|
370
|
-
const cacheUser2 = toJson(window.
|
|
370
|
+
const cacheUser2 = toJson(window.sessionStorage.getItem(cacheKey)) || {};
|
|
371
371
|
const cacheFields = service.userCache;
|
|
372
372
|
let user;
|
|
373
373
|
for (let i = 0; i < users.length; i++) {
|