@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/fluent-editor/index.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { extend } from "../common/object";
|
|
3
3
|
import { isNull } from "../common/type";
|
|
4
|
-
import { xss } from "
|
|
4
|
+
import { xss } from "@opentiny/utils";
|
|
5
5
|
import { set } from "../chart-core/deps/utils";
|
|
6
6
|
import { on, off } from "../common/deps/dom";
|
|
7
7
|
import PopupManager from "../common/deps/popup-manager";
|
|
8
|
-
const init = ({
|
|
8
|
+
const init = ({
|
|
9
|
+
api,
|
|
10
|
+
emit,
|
|
11
|
+
props,
|
|
12
|
+
service,
|
|
13
|
+
state,
|
|
14
|
+
FluentEditor,
|
|
15
|
+
UploaderDfls,
|
|
16
|
+
defaultOptions,
|
|
17
|
+
vm,
|
|
18
|
+
useBreakpoint,
|
|
19
|
+
simpleToolbar
|
|
20
|
+
}) => () => {
|
|
21
|
+
var _a;
|
|
9
22
|
UploaderDfls.enableMultiUpload = { file: true, image: true };
|
|
10
23
|
UploaderDfls.handler = api.uploaderDflsHandler;
|
|
11
24
|
UploaderDfls.imagePasteFailCallback = props.imagePasteFailCallback;
|
|
@@ -30,6 +43,7 @@ const init = ({ api, emit, props, service, state, FluentEditor, UploaderDfls, de
|
|
|
30
43
|
if (current.value === "default") {
|
|
31
44
|
state.innerOptions.modules.toolbar = simpleToolbar;
|
|
32
45
|
}
|
|
46
|
+
(_a = props.beforeEditorInit) == null ? void 0 : _a.call(props, FluentEditor);
|
|
33
47
|
const quill = new FluentEditor(vm.$refs.editor, state.innerOptions);
|
|
34
48
|
quill.emitter.on("file-change", api.fileOperationToSev);
|
|
35
49
|
state.quill = Object.freeze(quill);
|
|
@@ -128,7 +142,8 @@ const handleCompositionend = ({ state }) => (event) => {
|
|
|
128
142
|
state.quill.root.classList.add("ql-blank");
|
|
129
143
|
}
|
|
130
144
|
} else {
|
|
131
|
-
let data = state.quill.container.innerHTML
|
|
145
|
+
let data = state.quill.container.innerHTML;
|
|
146
|
+
let range = state.quill.getSelection(true);
|
|
132
147
|
const [mentionItem, offset] = state.quill.getLeaf(range.index);
|
|
133
148
|
if (mentionItem.statics.blotName === "break" || mentionItem.statics.blotName === "text" && offset === 0) {
|
|
134
149
|
state.quill.clipboard.dangerouslyPasteHTML(data);
|
|
@@ -136,7 +151,8 @@ const handleCompositionend = ({ state }) => (event) => {
|
|
|
136
151
|
if (mentionItem.statics.blotName === "break") {
|
|
137
152
|
state.quill.setSelection(range.index + event.data.length);
|
|
138
153
|
} else {
|
|
139
|
-
let pattern = /[\u4E00-\u9FA5\
|
|
154
|
+
let pattern = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
|
|
155
|
+
let flag;
|
|
140
156
|
if (pattern.test(event.data)) {
|
|
141
157
|
flag = true;
|
|
142
158
|
}
|
|
@@ -194,7 +210,7 @@ const inputFileHandler = ({ state, UploaderDfls }) => (type, accept) => {
|
|
|
194
210
|
fileInput.classList.add(`ql-${type}`);
|
|
195
211
|
fileInput.setAttribute("type", "file");
|
|
196
212
|
fileInput.setAttribute("accept", mimeTypes);
|
|
197
|
-
if (UploaderDfls.enableMultiUpload
|
|
213
|
+
if (UploaderDfls.enableMultiUpload.file && type === "file" || UploaderDfls.enableMultiUpload.image && type === "image") {
|
|
198
214
|
fileInput.setAttribute("multiple", "");
|
|
199
215
|
}
|
|
200
216
|
fileInput.onchange = () => {
|
|
@@ -218,7 +234,7 @@ const uploaderDflsHandler = ({ api, modules }) => (range, files, fileFlags, reje
|
|
|
218
234
|
}
|
|
219
235
|
};
|
|
220
236
|
const handleUploadFile = ({ api, UploaderDfls }) => (range, files, hasRejectedFile) => {
|
|
221
|
-
const fileEnableMultiUpload = UploaderDfls.enableMultiUpload === true || UploaderDfls.enableMultiUpload
|
|
237
|
+
const fileEnableMultiUpload = UploaderDfls.enableMultiUpload === true || UploaderDfls.enableMultiUpload.file;
|
|
222
238
|
api.fileOperationToSev({
|
|
223
239
|
operation: "upload",
|
|
224
240
|
data: fileEnableMultiUpload ? { files } : { file: files[0] },
|
|
@@ -325,7 +341,7 @@ const fileOperationToSev = ({ state }) => (event) => {
|
|
|
325
341
|
const handleUploadImage = ({ state, api, FluentEditor, Delta, UploaderDfls }) => (range, { file, files }, hasRejectedImage) => {
|
|
326
342
|
if (state.quill.options.uploadOption.imageUploadToServer) {
|
|
327
343
|
const index = state.promisesData.length;
|
|
328
|
-
const imageEnableMultiUpload = UploaderDfls.enableMultiUpload
|
|
344
|
+
const imageEnableMultiUpload = UploaderDfls.enableMultiUpload.image;
|
|
329
345
|
const result = {
|
|
330
346
|
file,
|
|
331
347
|
data: { files: [file] },
|
|
@@ -359,7 +375,7 @@ const handleUploadImage = ({ state, api, FluentEditor, Delta, UploaderDfls }) =>
|
|
|
359
375
|
}
|
|
360
376
|
};
|
|
361
377
|
if (imageEnableMultiUpload) {
|
|
362
|
-
result
|
|
378
|
+
result.data = { files };
|
|
363
379
|
}
|
|
364
380
|
state.promisesData.push({
|
|
365
381
|
imageEnableMultiUpload
|
|
@@ -587,7 +603,7 @@ const doPreview = ({ props, state, nextTick }) => (elem) => {
|
|
|
587
603
|
}
|
|
588
604
|
};
|
|
589
605
|
const handleDblclick = ({ props, api }) => (e) => {
|
|
590
|
-
if (props.picPreview && e && e.type === "dblclick" && [...e.target.classList].
|
|
606
|
+
if (props.picPreview && e && e.type === "dblclick" && [...e.target.classList].includes("blot-formatter__overlay") && e.target.dataset.image) {
|
|
591
607
|
api.doPreview(e.target);
|
|
592
608
|
}
|
|
593
609
|
};
|
package/form/vue.js
CHANGED
|
@@ -95,7 +95,7 @@ const renderless = (props, { computed, inject, provide, reactive, watch, onBefor
|
|
|
95
95
|
provide("showAutoWidth", state.showAutoWidth);
|
|
96
96
|
const unbindDialogEvent = bindDialogEvent({ api: api2, dialog, state });
|
|
97
97
|
onBeforeUnmount(unbindDialogEvent);
|
|
98
|
-
watch(() => props.rules, api2.watchRules);
|
|
98
|
+
watch(() => props.rules, api2.watchRules, { deep: props.validateOnRuleChange === "deep" });
|
|
99
99
|
return api2;
|
|
100
100
|
};
|
|
101
101
|
export {
|
package/grid/plugins/export.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../../chunk-G2ADBYYC.js";
|
|
4
|
-
import { xss } from "
|
|
4
|
+
import { xss } from "@opentiny/utils";
|
|
5
5
|
import browser from "../../common/browser";
|
|
6
6
|
import { toTreeArray } from "../static";
|
|
7
7
|
import { getCellValue, getFuncText } from "../utils";
|
package/guide/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 createShepherd = ({ state, props, Shepherd, offset, designConfig }) => () => {
|
|
4
4
|
const tour = newTour(state, Shepherd, offset, designConfig);
|
|
5
5
|
state.tour = tour;
|
package/image/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import { on, off, getScrollContainer, isInContainer } from "../common/deps/dom";
|
|
3
3
|
import { typeOf } from "../common/type";
|
|
4
4
|
import { rafThrottle } from "../image-viewer";
|
|
5
|
-
import { xss } from "
|
|
5
|
+
import { xss } from "@opentiny/utils";
|
|
6
6
|
const isSupportObjectFit = () => document.documentElement.style.objectFit !== void 0;
|
|
7
7
|
const isHtmlElement = (node) => node && node.nodeType === Node.ELEMENT_NODE;
|
|
8
8
|
const computedGetImageStyle = ({ props, api }) => () => {
|
package/image-viewer/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
import { on, off } from "../common/deps/dom";
|
|
5
5
|
import { KEY_CODE } from "../common";
|
|
6
6
|
import PopupManager from "../common/deps/popup-manager";
|
|
7
|
-
import { xss } from "
|
|
8
|
-
|
|
7
|
+
import { xss } from "@opentiny/utils";
|
|
8
|
+
import { isBrowser } from "../common/browser";
|
|
9
|
+
const isFirefox = () => isBrowser ? !!window.navigator.userAgent.match(/firefox/i) : false;
|
|
9
10
|
const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
|
|
10
11
|
const rafThrottle = (fn) => {
|
|
11
12
|
let locked = false;
|
package/input/vue.js
CHANGED
|
@@ -333,6 +333,9 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, onUpdated, re
|
|
|
333
333
|
api2.setShowMoreBtn(true);
|
|
334
334
|
on(window, "resize", api2.setShowMoreBtn);
|
|
335
335
|
}
|
|
336
|
+
if (vm.$attrs.autofocus) {
|
|
337
|
+
api2.focus();
|
|
338
|
+
}
|
|
336
339
|
});
|
|
337
340
|
onBeforeUnmount(() => {
|
|
338
341
|
if (props.type === "textarea" && props.popupMore && state.isDisplayOnly) {
|
package/link/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { xss } from "
|
|
2
|
+
import { xss } from "@opentiny/utils";
|
|
3
3
|
import { handleClick } from "./index";
|
|
4
4
|
const api = ["state", "handleClick"];
|
|
5
5
|
const renderless = (props, { inject, reactive, computed }, { emit, parent }) => {
|
package/locales/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 getLocales = ({ api, service, state }) => () => {
|
|
4
4
|
Promise.all([service.getLocale(), service.getCurrentLocale()]).then(([locales, current]) => {
|
|
5
5
|
state.locales = locales || ["zhCN"];
|
package/logout/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 logout = ({ service, state, props }) => () => {
|
|
4
4
|
let { isMock, isLocal, redirectUrl = "", getLogoutUrl, showLogin } = service;
|
|
5
5
|
if (typeof props.beforeLogout === "function" && !state.logout) {
|
package/menu/index.js
CHANGED
package/milestone/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { isBrowser } from "../common/browser";
|
|
2
3
|
const hexToRgb = (hex) => {
|
|
3
|
-
if (hex.includes("var")) {
|
|
4
|
+
if (hex.includes("var") && isBrowser) {
|
|
4
5
|
hex = hex.replace(/var\(|\)/g, "");
|
|
5
6
|
hex = getComputedStyle(document.documentElement).getPropertyValue(hex);
|
|
6
7
|
}
|
package/modal/index.js
CHANGED
|
@@ -227,7 +227,6 @@ const close = ({ emit, parent, props, state }) => (type) => {
|
|
|
227
227
|
setTimeout(() => {
|
|
228
228
|
state.visible = false;
|
|
229
229
|
let params = { type, $modal: parent };
|
|
230
|
-
emit("close", params);
|
|
231
230
|
if (events.hide) {
|
|
232
231
|
events.hide.call(parent, params);
|
|
233
232
|
} else {
|
package/nav-menu/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import PopupManager from "../common/deps/popup-manager";
|
|
|
5
5
|
import { mapTree } from "../grid/static";
|
|
6
6
|
import { transformTreeData } from "../common/array";
|
|
7
7
|
import { on, off } from "../common/deps/dom";
|
|
8
|
-
import { xss } from "
|
|
8
|
+
import { xss } from "@opentiny/utils";
|
|
9
|
+
import { isBrowser } from "../common/browser";
|
|
9
10
|
const { nextZIndex } = PopupManager;
|
|
10
11
|
const computedIsShowMore = ({ props, state }) => () => !/^(retract|fixed|hidden)$/.test(props.overflow) && state.more && state.more.length;
|
|
11
12
|
const computedPopClass = (state) => () => {
|
|
@@ -97,6 +98,9 @@ const initData = ({
|
|
|
97
98
|
props,
|
|
98
99
|
state
|
|
99
100
|
}) => () => {
|
|
101
|
+
if (props.defaultActive) {
|
|
102
|
+
state.defaultActiveId = props.defaultActive;
|
|
103
|
+
}
|
|
100
104
|
const { textField = "title", urlField = "url", key = "id" } = fields || {};
|
|
101
105
|
const { parentKey, data } = props;
|
|
102
106
|
const isFullUrl = (url) => /^(https?:\/\/|\/\/)[\s\S]+$/.test(url);
|
|
@@ -303,12 +307,17 @@ const clickMenu = ({ api, props, state }) => (item, index, parentIndex) => {
|
|
|
303
307
|
if (index === void 0) {
|
|
304
308
|
return;
|
|
305
309
|
}
|
|
310
|
+
if (state.defaultActiveId) {
|
|
311
|
+
state.defaultActiveId = item.id;
|
|
312
|
+
state.selectedIndex = -1;
|
|
313
|
+
}
|
|
306
314
|
if (state.enterMenu) {
|
|
307
315
|
state.subIndex = -1;
|
|
308
316
|
state.subItemSelectedIndex = -1;
|
|
309
317
|
api.setActiveMenu(index);
|
|
310
318
|
}
|
|
311
319
|
if (state.enterMoreMenu) {
|
|
320
|
+
state.selectedIndex = -1;
|
|
312
321
|
state.moreItemSelectedIndex = index;
|
|
313
322
|
} else {
|
|
314
323
|
state.subItemSelectedIndex = index;
|
|
@@ -339,18 +348,22 @@ const skip = ({ api, router, fields }) => (item, flag = false) => {
|
|
|
339
348
|
}
|
|
340
349
|
};
|
|
341
350
|
const getPoint = ({ api, parent }) => () => {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
351
|
+
if (!isBrowser)
|
|
352
|
+
return 0;
|
|
353
|
+
else {
|
|
354
|
+
const items = parent.$el.querySelectorAll(".menu>li");
|
|
355
|
+
let index = 0;
|
|
356
|
+
if (items) {
|
|
357
|
+
index = items.length;
|
|
358
|
+
for (let i = 0; i < items.length; i++) {
|
|
359
|
+
if (api.isHide(items[i])) {
|
|
360
|
+
index = index - (items.length - i);
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
350
363
|
}
|
|
351
364
|
}
|
|
365
|
+
return index;
|
|
352
366
|
}
|
|
353
|
-
return index;
|
|
354
367
|
};
|
|
355
368
|
const classify = ({ api, props, state }) => () => {
|
|
356
369
|
var _a;
|
|
@@ -364,7 +377,7 @@ const calcWidth = ({ parent, props, state }) => () => {
|
|
|
364
377
|
let toolbarWidth = parent.$slots.toolbar ? el.querySelector(".slot-toolbar").offsetWidth : 0;
|
|
365
378
|
let menuWidth = el.offsetWidth;
|
|
366
379
|
let width = props.overflow === "retract" ? 0 : menuWidth - toolbarWidth - logoWidth;
|
|
367
|
-
width = width -
|
|
380
|
+
width = width - 90;
|
|
368
381
|
state.width = width < 200 ? 0 : width;
|
|
369
382
|
state.popMenuTop = el.offsetHeight;
|
|
370
383
|
};
|
|
@@ -403,6 +416,58 @@ const handleTitleMouseenter = ({ state, vm }) => ($event) => {
|
|
|
403
416
|
const handleTitleMouseleave = ({ state }) => () => {
|
|
404
417
|
state.tooltipVisible = false;
|
|
405
418
|
};
|
|
419
|
+
const getMoreSelected = ({ state }) => () => {
|
|
420
|
+
let isSelected = false;
|
|
421
|
+
if (state == null ? void 0 : state.more.length) {
|
|
422
|
+
state.more.forEach((item) => {
|
|
423
|
+
var _a;
|
|
424
|
+
if ((item == null ? void 0 : item.id) === state.defaultActiveId) {
|
|
425
|
+
isSelected = true;
|
|
426
|
+
} else if ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) {
|
|
427
|
+
isSelected = getSelectedState(item.children, state.defaultActiveId);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return isSelected;
|
|
432
|
+
};
|
|
433
|
+
const getTabSelected = ({ state }) => (item, index) => {
|
|
434
|
+
var _a;
|
|
435
|
+
let isChildSelected = false;
|
|
436
|
+
if ((item == null ? void 0 : item.id) && ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length)) {
|
|
437
|
+
isChildSelected = getSelectedState(item.children, state.defaultActiveId);
|
|
438
|
+
}
|
|
439
|
+
let isSelected = (item == null ? void 0 : item.id) === state.defaultActiveId || isChildSelected || index === state.selectedIndex;
|
|
440
|
+
return isSelected;
|
|
441
|
+
};
|
|
442
|
+
const getLeftSelected = ({ state }) => (item, index) => {
|
|
443
|
+
var _a;
|
|
444
|
+
let isLeftChildSelected = false;
|
|
445
|
+
if ((item == null ? void 0 : item.id) && ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length)) {
|
|
446
|
+
isLeftChildSelected = getSelectedState(item.children, state.defaultActiveId);
|
|
447
|
+
}
|
|
448
|
+
let isSelected = (item == null ? void 0 : item.id) === state.defaultActiveId || isLeftChildSelected || index === state.moreItemSelectedIndex;
|
|
449
|
+
return isSelected;
|
|
450
|
+
};
|
|
451
|
+
const getLastChildSelected = ({ state }) => (item, i, index) => {
|
|
452
|
+
let isSelected = (item == null ? void 0 : item.id) === state.defaultActiveId || i === state.subItemSelectedIndex && index === state.subIndex;
|
|
453
|
+
return isSelected;
|
|
454
|
+
};
|
|
455
|
+
const getSelectedState = (itemData, id) => {
|
|
456
|
+
let isSelected = false;
|
|
457
|
+
itemData.forEach((data) => {
|
|
458
|
+
var _a;
|
|
459
|
+
if ((data == null ? void 0 : data.id) === id) {
|
|
460
|
+
isSelected = true;
|
|
461
|
+
} else if ((_a = data == null ? void 0 : data.children) == null ? void 0 : _a.length) {
|
|
462
|
+
data == null ? void 0 : data.children.forEach((dataChildren) => {
|
|
463
|
+
if ((dataChildren == null ? void 0 : dataChildren.id) === id) {
|
|
464
|
+
isSelected = true;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
return isSelected;
|
|
470
|
+
};
|
|
406
471
|
export {
|
|
407
472
|
calcWidth,
|
|
408
473
|
classify,
|
|
@@ -412,9 +477,13 @@ export {
|
|
|
412
477
|
computedPopClass,
|
|
413
478
|
computedPopStyle,
|
|
414
479
|
computedSubMenus,
|
|
480
|
+
getLastChildSelected,
|
|
481
|
+
getLeftSelected,
|
|
482
|
+
getMoreSelected,
|
|
415
483
|
getPoint,
|
|
416
484
|
getRoute,
|
|
417
485
|
getSelectedIndex,
|
|
486
|
+
getTabSelected,
|
|
418
487
|
getTag,
|
|
419
488
|
getUrl,
|
|
420
489
|
handleTitleMouseenter,
|
package/nav-menu/vue.js
CHANGED
|
@@ -31,6 +31,10 @@ import {
|
|
|
31
31
|
setActiveMenu,
|
|
32
32
|
initService,
|
|
33
33
|
handleTitleMouseenter,
|
|
34
|
+
getMoreSelected,
|
|
35
|
+
getTabSelected,
|
|
36
|
+
getLeftSelected,
|
|
37
|
+
getLastChildSelected,
|
|
34
38
|
handleTitleMouseleave
|
|
35
39
|
} from "./index";
|
|
36
40
|
const api = [
|
|
@@ -56,6 +60,10 @@ const api = [
|
|
|
56
60
|
"getRoute",
|
|
57
61
|
"setActiveMenu",
|
|
58
62
|
"handleTitleMouseenter",
|
|
63
|
+
"getMoreSelected",
|
|
64
|
+
"getLeftSelected",
|
|
65
|
+
"getLastChildSelected",
|
|
66
|
+
"getTabSelected",
|
|
59
67
|
"handleTitleMouseleave"
|
|
60
68
|
];
|
|
61
69
|
const initState = ({ reactive, api: api2, computed, vm }) => reactive({
|
|
@@ -64,6 +72,7 @@ const initState = ({ reactive, api: api2, computed, vm }) => reactive({
|
|
|
64
72
|
width: -1,
|
|
65
73
|
enterMenu: false,
|
|
66
74
|
popMenuTop: 0,
|
|
75
|
+
defaultActiveId: null,
|
|
67
76
|
subMenu: [],
|
|
68
77
|
showMore: false,
|
|
69
78
|
showPopmenu: false,
|
|
@@ -78,7 +87,6 @@ const initState = ({ reactive, api: api2, computed, vm }) => reactive({
|
|
|
78
87
|
isShowSetting: false,
|
|
79
88
|
tooltipVisible: false,
|
|
80
89
|
tooltipContent: "",
|
|
81
|
-
marginLeft: 0,
|
|
82
90
|
isSaaSTheme: vm.theme === "saas",
|
|
83
91
|
menuClass: "",
|
|
84
92
|
isShowMore: computed(() => api2.computedIsShowMore()),
|
|
@@ -120,6 +128,10 @@ const initApi = ({ api: api2, state, props, parent, fetchMenuData, fields, route
|
|
|
120
128
|
hideSubMenu: hideSubMenu({ api: api2, parent, state }),
|
|
121
129
|
showSubMenu: showSubMenu({ api: api2, nextTick, parent, state, vm }),
|
|
122
130
|
handleTitleMouseenter: handleTitleMouseenter({ state, vm }),
|
|
131
|
+
getMoreSelected: getMoreSelected({ state }),
|
|
132
|
+
getLeftSelected: getLeftSelected({ state }),
|
|
133
|
+
getLastChildSelected: getLastChildSelected({ state }),
|
|
134
|
+
getTabSelected: getTabSelected({ state }),
|
|
123
135
|
handleTitleMouseleave: handleTitleMouseleave({ state })
|
|
124
136
|
});
|
|
125
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.1",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"color": "4.2.3",
|
|
29
|
-
"
|
|
29
|
+
"@opentiny/utils": "^1.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"esno": "^4.7.0",
|
package/picker/index.js
CHANGED
|
@@ -403,6 +403,10 @@ const handleInput = ({ state, props, api }) => (val, event) => {
|
|
|
403
403
|
const val2 = event.target.value;
|
|
404
404
|
state.userInput = val2;
|
|
405
405
|
}
|
|
406
|
+
if (state.type === "time-select") {
|
|
407
|
+
state.picker.state.isFilter = true;
|
|
408
|
+
state.picker.state.filterVal = state.userInput;
|
|
409
|
+
}
|
|
406
410
|
};
|
|
407
411
|
const formatInputValue = ({ props, state }) => ({ event, prevValue = "" }) => {
|
|
408
412
|
const val = event.target.value;
|
|
@@ -739,6 +743,9 @@ const handleKeydown = ({ api, state }) => (event) => {
|
|
|
739
743
|
}
|
|
740
744
|
if (keyCode === 13) {
|
|
741
745
|
if (state.userInput === "" || api.isValidValue(api.parseString(state.displayValue))) {
|
|
746
|
+
if (state.type === "time-select") {
|
|
747
|
+
state.userInput = state.picker.state.items.length ? state.picker.state.items[0].value : "";
|
|
748
|
+
}
|
|
742
749
|
api.handleChange();
|
|
743
750
|
state.pickerVisible = state.picker.state.visible = false;
|
|
744
751
|
api.blur();
|
|
@@ -756,6 +763,9 @@ const handleKeydown = ({ api, state }) => (event) => {
|
|
|
756
763
|
};
|
|
757
764
|
const hidePicker = ({ destroyPopper, state }) => () => {
|
|
758
765
|
if (state.picker) {
|
|
766
|
+
if (state.type === "time-select") {
|
|
767
|
+
state.picker.state.isFilter = false;
|
|
768
|
+
}
|
|
759
769
|
state.picker.resetView && state.picker.resetView();
|
|
760
770
|
state.pickerVisible = state.picker.visible = state.picker.state.visible = false;
|
|
761
771
|
destroyPopper();
|
package/rich-text/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { extend } from "../common/object";
|
|
3
|
-
import { xss } from "
|
|
3
|
+
import { xss } from "@opentiny/utils";
|
|
4
4
|
import { getToolbarTips, defaultOptions } from "./options";
|
|
5
5
|
import registerTableModule from "./table-module";
|
|
6
6
|
import registerCustomClipboard from "./clipboard";
|
package/rich-text-editor/vue.js
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
5
|
import {
|
|
6
|
+
Active,
|
|
7
|
+
closeTablePanel,
|
|
8
|
+
eventClick,
|
|
9
|
+
eventImg,
|
|
6
10
|
handleChange,
|
|
7
11
|
setLink,
|
|
8
|
-
tableMouseMove,
|
|
9
|
-
tableChoose,
|
|
10
|
-
toggleTablePanel,
|
|
11
|
-
closeTablePanel,
|
|
12
12
|
shouldShow,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
tableChoose,
|
|
14
|
+
tableMouseMove,
|
|
15
|
+
toggleTablePanel
|
|
16
16
|
} from "./index";
|
|
17
17
|
const api = [
|
|
18
18
|
"state",
|
|
@@ -184,7 +184,7 @@ const renderless = (props, { computed, onBeforeUnmount, reactive, watch }, { vm,
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
const defaultOptions =
|
|
187
|
+
const defaultOptions = {
|
|
188
188
|
extensions: [
|
|
189
189
|
StarterKit == null ? void 0 : StarterKit.configure({
|
|
190
190
|
// 开启多人协作功能要关闭默认的history模式
|
|
@@ -254,8 +254,9 @@ const renderless = (props, { computed, onBeforeUnmount, reactive, watch }, { vm,
|
|
|
254
254
|
onDestroy() {
|
|
255
255
|
emit("destroy");
|
|
256
256
|
}
|
|
257
|
-
}
|
|
258
|
-
let options =
|
|
257
|
+
};
|
|
258
|
+
let options = __spreadValues(__spreadValues({}, defaultOptions), props.options);
|
|
259
|
+
options.extensions = [.../* @__PURE__ */ new Set([...defaultOptions.extensions, ...props.options.extensions || []])];
|
|
259
260
|
const state = reactive({
|
|
260
261
|
editor: new Editor(options),
|
|
261
262
|
toolbar: computed(() => props.customToolBar.length ? props.customToolBar : defaultToolBar),
|
package/roles/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 showList = (state) => () => state.showPopover = true;
|
|
4
4
|
const show = (state) => () => state.showIcon = false;
|
|
5
5
|
const hide = (state) => () => state.showIcon = true;
|
package/select/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { fastdom } from "../common/deps/fastdom";
|
|
|
20
20
|
import { deepClone } from "../picker-column";
|
|
21
21
|
import { escapeRegexpString } from "../option";
|
|
22
22
|
import { correctTarget } from "../common/event";
|
|
23
|
+
import { isBrowser } from "../common/browser";
|
|
23
24
|
const handleComposition = ({ api, nextTick, state }) => (event) => {
|
|
24
25
|
const text = event.target.value;
|
|
25
26
|
if (event.type === "compositionend") {
|
|
@@ -396,18 +397,28 @@ const toggleCheckAll = ({ api, state, props }) => (filtered) => {
|
|
|
396
397
|
api.directEmitChange(value);
|
|
397
398
|
};
|
|
398
399
|
const handleFocus = ({ emit, props, state }) => (event) => {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
400
|
+
state.willFocusRun = true;
|
|
401
|
+
state.willFocusTimer && clearTimeout(state.willFocusTimer);
|
|
402
|
+
state.willFocusTimer = setTimeout(() => {
|
|
403
|
+
state.willFocusTimer = 0;
|
|
404
|
+
if (!state.willFocusRun)
|
|
405
|
+
return;
|
|
406
|
+
if (!state.softFocus) {
|
|
407
|
+
if (props.shape === "filter") {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (props.automaticDropdown || props.filterable || props.searchable) {
|
|
411
|
+
state.visible = true;
|
|
412
|
+
state.softFocus = true;
|
|
413
|
+
}
|
|
407
414
|
emit("focus", event);
|
|
415
|
+
} else {
|
|
416
|
+
if (state.searchSingleCopy && state.selectedLabel) {
|
|
417
|
+
emit("focus", event);
|
|
418
|
+
}
|
|
419
|
+
state.softFocus = false;
|
|
408
420
|
}
|
|
409
|
-
|
|
410
|
-
}
|
|
421
|
+
}, 10);
|
|
411
422
|
};
|
|
412
423
|
const focus = ({ vm, state }) => () => {
|
|
413
424
|
if (!state.softFocus) {
|
|
@@ -420,6 +431,7 @@ const blur = ({ vm, state }) => () => {
|
|
|
420
431
|
};
|
|
421
432
|
const handleBlur = ({ constants, dispatch, emit, state, designConfig }) => (event) => {
|
|
422
433
|
var _a;
|
|
434
|
+
state.willFocusRun = false;
|
|
423
435
|
clearTimeout(state.timer);
|
|
424
436
|
const target = event.target;
|
|
425
437
|
state.timer = setTimeout(() => {
|
|
@@ -1624,12 +1636,8 @@ const computedShowNewOption = ({ props, state }) => () => {
|
|
|
1624
1636
|
};
|
|
1625
1637
|
const computedShowCopy = ({ props, state }) => () => props.multiple && props.copyable && state.inputHovering && state.selected.length;
|
|
1626
1638
|
const computedOptionsAllDisabled = (state) => () => state.options.filter((option) => option.visible).every((option) => option.disabled);
|
|
1627
|
-
const computedDisabledTooltipContent = ({
|
|
1628
|
-
|
|
1629
|
-
return state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join(";");
|
|
1630
|
-
} else {
|
|
1631
|
-
return state.selected.state ? state.selected.state.currentLabel : state.selected.currentLabel;
|
|
1632
|
-
}
|
|
1639
|
+
const computedDisabledTooltipContent = ({ state }) => () => {
|
|
1640
|
+
return state.displayOnlyContent;
|
|
1633
1641
|
};
|
|
1634
1642
|
const computedSelectDisabled = ({ state }) => () => state.isDisabled || state.isDisplayOnly;
|
|
1635
1643
|
const computedIsExpand = ({ props, state }) => () => {
|
|
@@ -1675,12 +1683,14 @@ const watchInitValue = ({ props, emit }) => (value) => {
|
|
|
1675
1683
|
}
|
|
1676
1684
|
};
|
|
1677
1685
|
const watchShowClose = ({ nextTick, state, parent }) => () => {
|
|
1686
|
+
if (!isBrowser)
|
|
1687
|
+
return;
|
|
1678
1688
|
nextTick(() => {
|
|
1679
1689
|
const parentEl = parent.$el;
|
|
1680
1690
|
const inputEl = parentEl.querySelector('input[data-tag="tiny-input-inner"]');
|
|
1681
1691
|
if (inputEl) {
|
|
1682
1692
|
const { paddingRight } = getComputedStyle(inputEl);
|
|
1683
|
-
state.inputPaddingRight = parseFloat(paddingRight);
|
|
1693
|
+
state.inputPaddingRight = parseFloat(paddingRight) || 0;
|
|
1684
1694
|
}
|
|
1685
1695
|
});
|
|
1686
1696
|
};
|