@opentiny/vue-renderless 3.27.0 → 3.28.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/autocomplete/index.js +7 -2
- package/autocomplete/vue.js +1 -1
- package/base-select/index.js +189 -86
- package/base-select/vue.js +82 -20
- package/drawer/index.js +20 -0
- package/drawer/vue.js +9 -1
- package/dropdown/index.js +10 -4
- package/file-upload/index.js +18 -5
- package/form-item/index.js +28 -16
- package/form-item/vue.js +50 -11
- package/grid/static/array/eachTree.js +1 -0
- package/grid/utils/common.js +10 -3
- package/grid-select/index.js +418 -32
- package/grid-select/vue.js +103 -9
- package/guide/vue.js +11 -1
- package/package.json +3 -3
- package/picker/index.js +30 -13
- package/popover/index.js +1 -1
- package/rich-text/index.js +42 -0
- package/select/index.js +2 -2
- package/select/vue.js +3 -2
- package/select-dropdown/vue.js +8 -3
- package/select-wrapper/vue.js +134 -0
- package/switch/vue.js +19 -0
- package/tabs-mf/index.js +9 -1
- package/tabs-mf/vue-nav.js +66 -9
- package/tabs-mf/vue.js +21 -5
- package/transfer-panel/index.js +2 -1
- package/tree-select/index.js +13 -4
- package/tree-select/vue.js +19 -3
- package/types/autocomplete.type.d.ts +2 -1
- package/types/date-picker.type.d.ts +38 -2
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-dd403065.d.ts → form.type-a54e1c06.d.ts} +2 -2
- package/types/form.type.d.ts +1 -1
- package/types/modal.type.d.ts +4 -0
- package/types/picker.type.d.ts +38 -2
- package/types/popeditor.type.d.ts +76 -4
- package/types/switch.type.d.ts +1 -0
- package/types/tree-menu.type.d.ts +38 -2
package/base-select/vue.js
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
watchPropsOption,
|
|
58
58
|
onMouseenterNative,
|
|
59
59
|
onMouseleaveNative,
|
|
60
|
+
onMouseenterSelf,
|
|
60
61
|
onCopying,
|
|
61
62
|
defaultOnQueryChange,
|
|
62
63
|
queryChange,
|
|
@@ -100,10 +101,14 @@ import {
|
|
|
100
101
|
updateSelectedData,
|
|
101
102
|
hidePanel,
|
|
102
103
|
computedShowTagText,
|
|
103
|
-
isTagClosable
|
|
104
|
+
isTagClosable,
|
|
105
|
+
computedCurrentSizeMap,
|
|
106
|
+
watchOptionsWhenAutoSelect
|
|
104
107
|
} from "./index";
|
|
105
108
|
import { debounce } from "@opentiny/utils";
|
|
106
109
|
import { isNumber } from "@opentiny/utils";
|
|
110
|
+
import { useUserAgent } from "@opentiny/vue-hooks";
|
|
111
|
+
import { isServer } from "@opentiny/utils";
|
|
107
112
|
const api = [
|
|
108
113
|
"state",
|
|
109
114
|
"toggleCheckAll",
|
|
@@ -148,6 +153,7 @@ const api = [
|
|
|
148
153
|
"navigateOptions",
|
|
149
154
|
"onMouseenterNative",
|
|
150
155
|
"onMouseleaveNative",
|
|
156
|
+
"onMouseenterSelf",
|
|
151
157
|
"onCopying",
|
|
152
158
|
"handleDropdownClick",
|
|
153
159
|
"handleEnterTag",
|
|
@@ -160,14 +166,25 @@ const api = [
|
|
|
160
166
|
"computedShowTagText",
|
|
161
167
|
"isTagClosable"
|
|
162
168
|
];
|
|
163
|
-
const initState = ({
|
|
169
|
+
const initState = ({
|
|
170
|
+
reactive,
|
|
171
|
+
computed,
|
|
172
|
+
props,
|
|
173
|
+
api: api2,
|
|
174
|
+
emitter,
|
|
175
|
+
parent,
|
|
176
|
+
constants,
|
|
177
|
+
isMobileFirstMode,
|
|
178
|
+
useBreakpoint,
|
|
179
|
+
vm,
|
|
180
|
+
designConfig
|
|
181
|
+
}) => {
|
|
164
182
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
165
183
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
166
184
|
selectEmitter: emitter(),
|
|
167
185
|
datas: [],
|
|
168
186
|
initDatas: [],
|
|
169
187
|
query: "",
|
|
170
|
-
magicKey: 0,
|
|
171
188
|
options: [],
|
|
172
189
|
visible: false,
|
|
173
190
|
showCopy: computed(() => api2.computedShowCopy()),
|
|
@@ -185,7 +202,7 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
185
202
|
optionsAllDisabled: computed(() => api2.computedOptionsAllDisabled()),
|
|
186
203
|
collapseTagSize: computed(() => api2.computedCollapseTagSize()),
|
|
187
204
|
showNewOption: computed(() => api2.computedShowNewOption()),
|
|
188
|
-
selectSize: computed(() => props.size || state.formItemSize),
|
|
205
|
+
selectSize: computed(() => !isServer ? props.size || state.formItemSize : 0),
|
|
189
206
|
optimizeOpts: computed(() => api2.computeOptimizeOpts()),
|
|
190
207
|
optimizeStore: { valueIndex: 0, recycleScrollerHeight: computed(() => api2.recycleScrollerHeight()) },
|
|
191
208
|
collapseTags: computed(() => api2.computeCollapseTags()),
|
|
@@ -202,11 +219,39 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
202
219
|
selectedCopy: [],
|
|
203
220
|
compareValue: null,
|
|
204
221
|
selectedVal: computed(
|
|
205
|
-
() => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
206
|
-
),
|
|
207
|
-
displayOnlyContent: computed(
|
|
208
|
-
() => props.multiple && Array.isArray(state.selected) ? state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("; ") : ""
|
|
222
|
+
() => isMobileFirstMode && state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
209
223
|
),
|
|
224
|
+
displayOnlyContent: computed(() => {
|
|
225
|
+
var _a;
|
|
226
|
+
if (vm.$slots.reference) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
if (props.multiple) {
|
|
230
|
+
if (Array.isArray(state.selected)) {
|
|
231
|
+
if (state.isDisplayOnly && props.options && props.options.length > 0) {
|
|
232
|
+
return state.selected.map((item) => {
|
|
233
|
+
const find = props.options.find((opt) => opt[props.valueField] === item.value);
|
|
234
|
+
return find ? find[props.textField] : "";
|
|
235
|
+
}).join("; ");
|
|
236
|
+
} else {
|
|
237
|
+
return state.selected.map((item) => item.state ? item.state.currentLabel : item.currentLabel).join("; ");
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
return "";
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
if (state.selected) {
|
|
244
|
+
if (state.isDisplayOnly && props.options && props.options.length > 0) {
|
|
245
|
+
const find = props.options.find((opt) => opt[props.valueField] === state.selected.value);
|
|
246
|
+
return find ? find[props.textField] : "";
|
|
247
|
+
} else {
|
|
248
|
+
return ((_a = state.selected.state) == null ? void 0 : _a.currentLabel) || state.selected.currentLabel || state.selected.label || "";
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
return "";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}),
|
|
210
255
|
breakpoint: useBreakpoint ? useBreakpoint().current : "",
|
|
211
256
|
isSaaSTheme: vm.theme === "saas",
|
|
212
257
|
disabledOptionHover: false,
|
|
@@ -220,11 +265,18 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
220
265
|
return designConfig.state.autoHideDownIcon;
|
|
221
266
|
}
|
|
222
267
|
return true;
|
|
223
|
-
})()
|
|
268
|
+
})(),
|
|
269
|
+
designConfig,
|
|
270
|
+
currentSizeMap: computed(() => api2.computedCurrentSizeMap()),
|
|
271
|
+
rootAutoTipConfig: computed(() => __spreadValues({
|
|
272
|
+
content: state.displayOnlyContent,
|
|
273
|
+
always: !!state.displayOnlyContent
|
|
274
|
+
}, props.tooltipConfig))
|
|
224
275
|
}));
|
|
225
276
|
return state;
|
|
226
277
|
};
|
|
227
278
|
const initStateAdd = ({ computed, props, api: api2, parent }) => {
|
|
279
|
+
const { isIOS } = useUserAgent();
|
|
228
280
|
return {
|
|
229
281
|
selectedTags: [],
|
|
230
282
|
tips: "",
|
|
@@ -269,16 +321,20 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => {
|
|
|
269
321
|
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
|
|
270
322
|
isDisabled: computed(() => props.disabled || (parent.form || {}).disabled),
|
|
271
323
|
isShowTagText: computed(() => api2.computedShowTagText()),
|
|
272
|
-
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
|
|
324
|
+
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && (props.filterable || props.searchable)),
|
|
273
325
|
childrenName: computed(() => "children"),
|
|
274
326
|
tooltipContent: {},
|
|
275
327
|
isHidden: false,
|
|
276
328
|
optionIndexArr: [],
|
|
329
|
+
isIOS,
|
|
277
330
|
showCollapseTag: false,
|
|
278
331
|
exceedMaxVisibleRow: false,
|
|
279
332
|
// 是否超出默认最大显示行数
|
|
280
|
-
toHideIndex: Infinity
|
|
333
|
+
toHideIndex: Infinity,
|
|
281
334
|
// 第一个超出被隐藏的索引
|
|
335
|
+
willFocusRun: false,
|
|
336
|
+
// 进入focus时,延时等一下看是否触发blur,触发则不进入focus
|
|
337
|
+
willFocusTimer: 0
|
|
282
338
|
};
|
|
283
339
|
};
|
|
284
340
|
const initApi = ({
|
|
@@ -308,12 +364,12 @@ const initApi = ({
|
|
|
308
364
|
getChildValue: getChildValue(),
|
|
309
365
|
getOption: getOption({ props, state, api: api2 }),
|
|
310
366
|
getSelectedOption: getSelectedOption({ props, state }),
|
|
311
|
-
emitChange: emitChange({ emit, props, state, constants }),
|
|
312
|
-
directEmitChange: directEmitChange({ emit, props, state, constants }),
|
|
367
|
+
emitChange: emitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
368
|
+
directEmitChange: directEmitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
313
369
|
toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
|
|
314
370
|
showTip: showTip({ props, state, vm }),
|
|
315
371
|
onOptionDestroy: onOptionDestroy(state),
|
|
316
|
-
setSoftFocus: setSoftFocus({ vm, state }),
|
|
372
|
+
setSoftFocus: setSoftFocus({ vm, state, props }),
|
|
317
373
|
resetInputWidth: resetInputWidth({ vm, state }),
|
|
318
374
|
resetHoverIndex: resetHoverIndex({ props, state }),
|
|
319
375
|
resetDatas: resetDatas({ props, state }),
|
|
@@ -332,6 +388,7 @@ const initApi = ({
|
|
|
332
388
|
watchPropsOption: watchPropsOption({ constants, parent, props, state }),
|
|
333
389
|
onMouseenterNative: onMouseenterNative({ state }),
|
|
334
390
|
onMouseleaveNative: onMouseleaveNative({ state }),
|
|
391
|
+
onMouseenterSelf: onMouseenterSelf({ state }),
|
|
335
392
|
onCopying: onCopying({ state, vm }),
|
|
336
393
|
watchHoverIndex: watchHoverIndex({ state }),
|
|
337
394
|
computeOptimizeOpts: computeOptimizeOpts({ props, designConfig }),
|
|
@@ -339,16 +396,16 @@ const initApi = ({
|
|
|
339
396
|
computeMultipleLimit: computeMultipleLimit({ props, state }),
|
|
340
397
|
watchInputHover: watchInputHover({ vm }),
|
|
341
398
|
initQuery: initQuery({ props, state, constants, vm }),
|
|
342
|
-
updateModelValue: updateModelValue({ props, emit, state }),
|
|
399
|
+
updateModelValue: updateModelValue({ props, emit, state, isMobileFirstMode }),
|
|
343
400
|
computedTagsStyle: computedTagsStyle({ props, parent, state, vm }),
|
|
344
|
-
computedReadonly: computedReadonly({ props, state }),
|
|
401
|
+
computedReadonly: computedReadonly({ props, state, isMobileFirstMode }),
|
|
345
402
|
computedShowClose: computedShowClose({ props, state }),
|
|
346
403
|
computedCollapseTagSize: computedCollapseTagSize(state),
|
|
347
|
-
computedShowNewOption: computedShowNewOption({ props, state }),
|
|
404
|
+
computedShowNewOption: computedShowNewOption({ props, state, isMobileFirstMode }),
|
|
348
405
|
computedShowCopy: computedShowCopy({ props, state }),
|
|
349
406
|
computedOptionsAllDisabled: computedOptionsAllDisabled(state),
|
|
350
|
-
computedDisabledTooltipContent: computedDisabledTooltipContent(state),
|
|
351
|
-
computedSelectDisabled: computedSelectDisabled({
|
|
407
|
+
computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
|
|
408
|
+
computedSelectDisabled: computedSelectDisabled({ state }),
|
|
352
409
|
computedIsExpand: computedIsExpand({ props, state }),
|
|
353
410
|
watchInitValue: watchInitValue({ props, emit }),
|
|
354
411
|
watchShowClose: watchShowClose({ nextTick, state, parent }),
|
|
@@ -360,7 +417,9 @@ const initApi = ({
|
|
|
360
417
|
computedShowTagText: computedShowTagText({ state }),
|
|
361
418
|
isTagClosable: isTagClosable(),
|
|
362
419
|
updateSelectedData: updateSelectedData({ state }),
|
|
363
|
-
hidePanel: hidePanel({ state })
|
|
420
|
+
hidePanel: hidePanel({ state }),
|
|
421
|
+
computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig }),
|
|
422
|
+
watchOptionsWhenAutoSelect: watchOptionsWhenAutoSelect({ state, props, nextTick, api: api2 })
|
|
364
423
|
});
|
|
365
424
|
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
|
|
366
425
|
};
|
|
@@ -485,6 +544,8 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
|
485
544
|
};
|
|
486
545
|
const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
487
546
|
watch(() => [...state.options], api2.watchOptions);
|
|
547
|
+
watch(() => state.options, api2.watchOptionsWhenAutoSelect);
|
|
548
|
+
props.options && watch(() => props.options, api2.watchOptionsWhenAutoSelect);
|
|
488
549
|
watch(() => state.hoverIndex, api2.watchHoverIndex);
|
|
489
550
|
props.options && watch(() => props.options, api2.watchPropsOption, { immediate: true, deep: true });
|
|
490
551
|
props.optimization && watch(() => state.optimizeOpts, api2.watchOptimizeOpts, { immediate: true });
|
|
@@ -505,6 +566,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
505
566
|
emitter,
|
|
506
567
|
parent,
|
|
507
568
|
constants,
|
|
569
|
+
isMobileFirstMode,
|
|
508
570
|
useBreakpoint,
|
|
509
571
|
vm,
|
|
510
572
|
designConfig
|
package/drawer/index.js
CHANGED
|
@@ -57,6 +57,23 @@ const handleClose = ({ emit, props, state }) => (type, force) => {
|
|
|
57
57
|
}, 200);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
+
const keydown = ({ api, state, props }) => (event) => {
|
|
61
|
+
if (!state.visible) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!props.closeOnPressEscape) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (event.key === "Escape" || event.key === "Esc") {
|
|
68
|
+
api.handleClose("esc", true);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const addKeydownEvent = ({ api }) => () => {
|
|
72
|
+
document.addEventListener("keydown", api.keydown);
|
|
73
|
+
};
|
|
74
|
+
const removeKeydownEvent = ({ api }) => () => {
|
|
75
|
+
document.removeEventListener("keydown", api.keydown);
|
|
76
|
+
};
|
|
60
77
|
const mousedown = ({ state, vm }) => (event) => {
|
|
61
78
|
event.preventDefault();
|
|
62
79
|
const touch = event.touches ? event.touches[0] : event;
|
|
@@ -127,17 +144,20 @@ const hideScrollbar = (lockScrollClass) => () => {
|
|
|
127
144
|
};
|
|
128
145
|
export {
|
|
129
146
|
addDragEvent,
|
|
147
|
+
addKeydownEvent,
|
|
130
148
|
close,
|
|
131
149
|
computedHeight,
|
|
132
150
|
computedWidth,
|
|
133
151
|
confirm,
|
|
134
152
|
handleClose,
|
|
135
153
|
hideScrollbar,
|
|
154
|
+
keydown,
|
|
136
155
|
mousedown,
|
|
137
156
|
mousemove,
|
|
138
157
|
mouseup,
|
|
139
158
|
open,
|
|
140
159
|
removeDragEvent,
|
|
160
|
+
removeKeydownEvent,
|
|
141
161
|
showScrollbar,
|
|
142
162
|
watchVisible
|
|
143
163
|
};
|
package/drawer/vue.js
CHANGED
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
handleClose,
|
|
14
14
|
computedWidth,
|
|
15
15
|
computedHeight,
|
|
16
|
-
open
|
|
16
|
+
open,
|
|
17
|
+
keydown,
|
|
18
|
+
addKeydownEvent,
|
|
19
|
+
removeKeydownEvent
|
|
17
20
|
} from "./index";
|
|
18
21
|
const api = ["state", "close", "confirm", "handleClose", "open"];
|
|
19
22
|
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, constants, designConfig }) => {
|
|
@@ -36,6 +39,9 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
36
39
|
mousedown: mousedown({ state, vm }),
|
|
37
40
|
mousemove: mousemove({ state, props, emit }),
|
|
38
41
|
mouseup: mouseup({ state }),
|
|
42
|
+
keydown: keydown({ api: api2, state, props }),
|
|
43
|
+
addKeydownEvent: addKeydownEvent({ api: api2 }),
|
|
44
|
+
removeKeydownEvent: removeKeydownEvent({ api: api2 }),
|
|
39
45
|
addDragEvent: addDragEvent({ api: api2, vm }),
|
|
40
46
|
removeDragEvent: removeDragEvent({ api: api2, vm }),
|
|
41
47
|
watchVisible: watchVisible({ state, api: api2 }),
|
|
@@ -46,12 +52,14 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
46
52
|
});
|
|
47
53
|
onMounted(() => {
|
|
48
54
|
props.dragable && api2.addDragEvent();
|
|
55
|
+
api2.addKeydownEvent();
|
|
49
56
|
if (props.lockScroll && props.visible) {
|
|
50
57
|
api2.showScrollbar();
|
|
51
58
|
}
|
|
52
59
|
});
|
|
53
60
|
onBeforeUnmount(() => {
|
|
54
61
|
props.dragable && api2.removeDragEvent();
|
|
62
|
+
api2.removeKeydownEvent();
|
|
55
63
|
props.lockScroll && api2.hideScrollbar();
|
|
56
64
|
});
|
|
57
65
|
watch(() => props.visible, api2.watchVisible, { immediate: true });
|
package/dropdown/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const show = ({ props, state, emit }) => () => {
|
|
|
23
23
|
() => {
|
|
24
24
|
state.visible = true;
|
|
25
25
|
},
|
|
26
|
-
state.trigger === "click" ? 0 : props.showTimeout
|
|
26
|
+
state.trigger === "click" || state.trigger === "contextmenu" ? 0 : props.showTimeout
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -43,7 +43,7 @@ const hide = ({ api, props, state, emit }) => () => {
|
|
|
43
43
|
() => {
|
|
44
44
|
state.visible = false;
|
|
45
45
|
},
|
|
46
|
-
state.trigger === "click" ? 0 : props.hideTimeout
|
|
46
|
+
state.trigger === "click" || state.trigger === "contextmenu" ? 0 : props.hideTimeout
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -118,7 +118,7 @@ const removeTabindex = (state) => () => {
|
|
|
118
118
|
const initAria = ({ state, props }) => () => {
|
|
119
119
|
var _a, _b, _c, _d, _e;
|
|
120
120
|
(_a = state.dropdownElm) == null ? void 0 : _a.setAttribute("id", state.listId);
|
|
121
|
-
(_b = state.triggerElm) == null ? void 0 : _b.setAttribute("aria-haspopup", "
|
|
121
|
+
(_b = state.triggerElm) == null ? void 0 : _b.setAttribute("aria-haspopup", "menu");
|
|
122
122
|
(_c = state.triggerElm) == null ? void 0 : _c.setAttribute("aria-controls", state.listId);
|
|
123
123
|
if (!props.splitButton || !props.singleButton) {
|
|
124
124
|
(_d = state.triggerElm) == null ? void 0 : _d.setAttribute("role", "button");
|
|
@@ -143,7 +143,12 @@ const initEvent = ({ api, props, state, vm, mode }) => () => {
|
|
|
143
143
|
if (state.visibleIsBoolean) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
if (state.trigger === "
|
|
146
|
+
if (state.trigger === "contextmenu") {
|
|
147
|
+
on(state.triggerElm, "contextmenu", (e) => {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
api.handleClick();
|
|
150
|
+
});
|
|
151
|
+
} else if (state.trigger === "hover") {
|
|
147
152
|
on(state.triggerElm, "mouseenter", api.show);
|
|
148
153
|
on(state.triggerElm, "mouseleave", api.hide);
|
|
149
154
|
on(state.dropdownElm, "mouseenter", api.show);
|
|
@@ -212,6 +217,7 @@ const beforeDistory = ({ vm, api, state }) => () => {
|
|
|
212
217
|
off(state.triggerElm, "mouseenter", api.show);
|
|
213
218
|
off(state.triggerElm, "mouseleave", api.hide);
|
|
214
219
|
off(state.triggerElm, "click", api.handleClick);
|
|
220
|
+
off(state.triggerElm, "contextmenu", api.handleClick);
|
|
215
221
|
state.triggerElm = null;
|
|
216
222
|
}
|
|
217
223
|
if (state.dropdownElm) {
|
package/file-upload/index.js
CHANGED
|
@@ -288,14 +288,27 @@ const properFileSize = ({
|
|
|
288
288
|
Modal,
|
|
289
289
|
t
|
|
290
290
|
}) => (file) => {
|
|
291
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
291
292
|
if ([void 0, null].includes(file.size))
|
|
292
293
|
return true;
|
|
293
294
|
let maxSize = 0;
|
|
294
|
-
state.
|
|
295
|
-
if (
|
|
296
|
-
|
|
295
|
+
const edmConfigSingleFileMaxSize = ((_b = (_a = state.edmToken) == null ? void 0 : _a.config) == null ? void 0 : _b.singleFileMaxSize) || ((_d = (_c = props.edm) == null ? void 0 : _c.config) == null ? void 0 : _d.singleFileMaxSize) ? (((_f = (_e = state.edmToken) == null ? void 0 : _e.config) == null ? void 0 : _f.singleFileMaxSize) || ((_h = (_g = props.edm) == null ? void 0 : _g.config) == null ? void 0 : _h.singleFileMaxSize)) / 1024 : null;
|
|
296
|
+
if (state.isEdm) {
|
|
297
|
+
if (edmConfigSingleFileMaxSize !== null) {
|
|
298
|
+
maxSize = edmConfigSingleFileMaxSize;
|
|
299
|
+
} else if (Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
300
|
+
maxSize = Number(props.fileSize[1]) / 1024;
|
|
301
|
+
} else if (props.fileSize) {
|
|
302
|
+
maxSize = Number(props.fileSize) / 1024;
|
|
303
|
+
} else {
|
|
304
|
+
maxSize = state.singleMaxSize / 1024;
|
|
305
|
+
}
|
|
297
306
|
} else {
|
|
298
|
-
|
|
307
|
+
if (Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
308
|
+
maxSize = Math.max(Number(props.fileSize[0]) / 1024, Number(props.fileSize[1]) / 1024);
|
|
309
|
+
} else {
|
|
310
|
+
maxSize = Number(props.fileSize) / 1024;
|
|
311
|
+
}
|
|
299
312
|
}
|
|
300
313
|
if (state.isEdm || Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
301
314
|
if (!isNaN(Number(maxSize)) && file.size > maxSize * 1024 * 1024) {
|
|
@@ -2137,7 +2150,7 @@ const getTipMessage = ({ t, api, constants }) => ({ accept, fileSize, limit }) =
|
|
|
2137
2150
|
});
|
|
2138
2151
|
}
|
|
2139
2152
|
if (fileSize && acceptTip.length !== 0) {
|
|
2140
|
-
acceptTip += `${t(constants.COMMA)}
|
|
2153
|
+
acceptTip += `${t(constants.COMMA)}`;
|
|
2141
2154
|
}
|
|
2142
2155
|
let fileSizeTip = "";
|
|
2143
2156
|
let kibibyte = 1024;
|
package/form-item/index.js
CHANGED
|
@@ -15,7 +15,10 @@ const watchError = (state) => (value) => {
|
|
|
15
15
|
const watchValidateStatus = (state) => (value) => {
|
|
16
16
|
state.validateState = value;
|
|
17
17
|
};
|
|
18
|
-
const computedGetValidateType = ({ props, state }) => () =>
|
|
18
|
+
const computedGetValidateType = ({ props, state }) => () => {
|
|
19
|
+
var _a;
|
|
20
|
+
return props.validateType || (state.formInstance ? (_a = state.formInstance) == null ? void 0 : _a.validateType : "");
|
|
21
|
+
};
|
|
19
22
|
const computedValidateIcon = ({ props, state }) => () => {
|
|
20
23
|
var _a, _b, _c, _d;
|
|
21
24
|
return (_d = (_c = props.validateIcon) != null ? _c : (_b = (_a = state == null ? void 0 : state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.validateIcon) != null ? _d : null;
|
|
@@ -38,23 +41,25 @@ const computedIsErrorBlock = ({ props, state }) => () => {
|
|
|
38
41
|
return (_c = (_b = (_a = state == null ? void 0 : state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.isErrorBlock) != null ? _c : false;
|
|
39
42
|
};
|
|
40
43
|
const computedLabelStyle = ({ props, state }) => () => {
|
|
44
|
+
var _a, _b;
|
|
41
45
|
const result = { width: "" };
|
|
42
|
-
if (state.form.labelPosition === POSITION.Top) {
|
|
46
|
+
if (((_a = state.form) == null ? void 0 : _a.labelPosition) === POSITION.Top) {
|
|
43
47
|
return result;
|
|
44
48
|
}
|
|
45
|
-
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
49
|
+
const labelWidth = props.labelWidth || ((_b = state.form) == null ? void 0 : _b.state.labelWidth);
|
|
46
50
|
if (labelWidth) {
|
|
47
51
|
result.width = labelWidth;
|
|
48
52
|
}
|
|
49
53
|
return result;
|
|
50
54
|
};
|
|
51
55
|
const computedValueStyle = ({ props, state }) => () => {
|
|
56
|
+
var _a, _b;
|
|
52
57
|
const result = { width: "" };
|
|
53
|
-
if (state.form.labelPosition === POSITION.Top) {
|
|
58
|
+
if (((_a = state.form) == null ? void 0 : _a.labelPosition) === POSITION.Top) {
|
|
54
59
|
result.width = "100%";
|
|
55
60
|
return result;
|
|
56
61
|
}
|
|
57
|
-
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
62
|
+
const labelWidth = props.labelWidth || ((_b = state.form) == null ? void 0 : _b.state.labelWidth);
|
|
58
63
|
if (labelWidth) {
|
|
59
64
|
if (labelWidth === "auto") {
|
|
60
65
|
result.width = labelWidth;
|
|
@@ -65,20 +70,21 @@ const computedValueStyle = ({ props, state }) => () => {
|
|
|
65
70
|
return result;
|
|
66
71
|
};
|
|
67
72
|
const computedContentStyle = ({ props, state }) => () => {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
68
74
|
const result = {};
|
|
69
75
|
const label = props.label;
|
|
70
|
-
if (state.form.labelPosition === POSITION.Top || state.form.inline) {
|
|
76
|
+
if (((_a = state.form) == null ? void 0 : _a.labelPosition) === POSITION.Top || ((_b = state.form) == null ? void 0 : _b.inline)) {
|
|
71
77
|
return result;
|
|
72
78
|
}
|
|
73
79
|
if (!label && !props.labelWidth && state.isNested) {
|
|
74
80
|
return result;
|
|
75
81
|
}
|
|
76
|
-
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
82
|
+
const labelWidth = props.labelWidth || ((_d = (_c = state.form) == null ? void 0 : _c.state) == null ? void 0 : _d.labelWidth);
|
|
77
83
|
if (labelWidth === "auto") {
|
|
78
84
|
if (props.labelWidth === "auto") {
|
|
79
85
|
result.marginLeft = state.computedLabelWidth;
|
|
80
|
-
} else if (state.form.state.labelWidth === "auto") {
|
|
81
|
-
result.marginLeft = state.formInstance.state.autoLabelWidth;
|
|
86
|
+
} else if (((_f = (_e = state.form) == null ? void 0 : _e.state) == null ? void 0 : _f.labelWidth) === "auto") {
|
|
87
|
+
result.marginLeft = (_h = (_g = state.formInstance) == null ? void 0 : _g.state) == null ? void 0 : _h.autoLabelWidth;
|
|
82
88
|
}
|
|
83
89
|
} else {
|
|
84
90
|
result.marginLeft = labelWidth;
|
|
@@ -143,7 +149,8 @@ const getPropByPath = (obj, path, strict) => {
|
|
|
143
149
|
};
|
|
144
150
|
};
|
|
145
151
|
const computedFieldValue = ({ props, state }) => () => {
|
|
146
|
-
|
|
152
|
+
var _a;
|
|
153
|
+
const model = (_a = state.form) == null ? void 0 : _a.model;
|
|
147
154
|
if (!model || !props.prop) {
|
|
148
155
|
return;
|
|
149
156
|
}
|
|
@@ -214,12 +221,13 @@ const clearValidate = (state) => () => {
|
|
|
214
221
|
state.validateDisabled = false;
|
|
215
222
|
};
|
|
216
223
|
const resetField = ({ api, nextTick, props, state }) => () => {
|
|
224
|
+
var _a;
|
|
217
225
|
if (state.getValidateType === "tip") {
|
|
218
226
|
state.canShowTip = false;
|
|
219
227
|
}
|
|
220
228
|
state.validateState = "";
|
|
221
229
|
state.validateMessage = "";
|
|
222
|
-
let model = state.form.model || {};
|
|
230
|
+
let model = ((_a = state.form) == null ? void 0 : _a.model) || {};
|
|
223
231
|
let value = state.fieldValue;
|
|
224
232
|
let path = props.prop || "";
|
|
225
233
|
if (path && path.includes(":")) {
|
|
@@ -239,7 +247,8 @@ const resetField = ({ api, nextTick, props, state }) => () => {
|
|
|
239
247
|
api.broadcast("timeSelect", "fieldReset", state.initialValue);
|
|
240
248
|
};
|
|
241
249
|
const getRules = ({ props, state }) => () => {
|
|
242
|
-
|
|
250
|
+
var _a;
|
|
251
|
+
let formRules = ((_a = state.form) == null ? void 0 : _a.rules) || {};
|
|
243
252
|
const selfRules = props.rules;
|
|
244
253
|
const requiredRule = props.required !== void 0 ? { required: Boolean(props.required) } : [];
|
|
245
254
|
const prop = getPropByPath(formRules, props.prop || "");
|
|
@@ -325,6 +334,7 @@ const wrapValidate = ({
|
|
|
325
334
|
}
|
|
326
335
|
};
|
|
327
336
|
const handleMouseenter = ({ state }) => (e) => {
|
|
337
|
+
var _a, _b;
|
|
328
338
|
if (!state.isDisplayOnly || !state.typeName || !state.form)
|
|
329
339
|
return;
|
|
330
340
|
const dom = e.target;
|
|
@@ -340,22 +350,24 @@ const handleMouseenter = ({ state }) => (e) => {
|
|
|
340
350
|
overHeight = true;
|
|
341
351
|
}
|
|
342
352
|
if (res.o || overHeight) {
|
|
343
|
-
state.form.showTooltip(dom, state.displayedValue);
|
|
353
|
+
(_b = (_a = state.form).showTooltip) == null ? void 0 : _b.call(_a, dom, state.displayedValue);
|
|
344
354
|
}
|
|
345
355
|
};
|
|
346
356
|
const handleLabelMouseenter = ({ props, state, slots }) => (e) => {
|
|
347
|
-
|
|
357
|
+
var _a, _b, _c;
|
|
358
|
+
if (!((_a = state.form) == null ? void 0 : _a.overflowTitle) || !state.form || slots.label)
|
|
348
359
|
return;
|
|
349
360
|
const label = e.target;
|
|
350
361
|
if (label && label.scrollWidth > label.offsetWidth) {
|
|
351
|
-
state.form.showTooltip(label, props.label + state.form.labelSuffix);
|
|
362
|
+
(_c = (_b = state.form).showTooltip) == null ? void 0 : _c.call(_b, label, props.label + state.form.labelSuffix);
|
|
352
363
|
}
|
|
353
364
|
};
|
|
354
365
|
const handleMouseleave = (state) => () => {
|
|
355
366
|
state.form && state.form.hideTooltip();
|
|
356
367
|
};
|
|
357
368
|
const getDisplayedValue = ({ state }) => (param) => {
|
|
358
|
-
|
|
369
|
+
var _a;
|
|
370
|
+
if (!((_a = state.formInstance) == null ? void 0 : _a.displayOnly))
|
|
359
371
|
return;
|
|
360
372
|
state.typeName = param.type;
|
|
361
373
|
state.isBasicComp = true;
|
package/form-item/vue.js
CHANGED
|
@@ -84,22 +84,58 @@ const initState = ({
|
|
|
84
84
|
form: computed(() => api2.computedForm()),
|
|
85
85
|
fieldValue: computed(() => api2.computedFieldValue()),
|
|
86
86
|
isRequired: computed(() => api2.computedIsRequired()),
|
|
87
|
-
formInline: computed(() =>
|
|
88
|
-
|
|
87
|
+
formInline: computed(() => {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_a = state.formInstance) == null ? void 0 : _a.inline;
|
|
90
|
+
}),
|
|
91
|
+
formSize: computed(() => {
|
|
92
|
+
var _a;
|
|
93
|
+
return (_a = state.formInstance) == null ? void 0 : _a.size;
|
|
94
|
+
}),
|
|
89
95
|
formItemSize: computed(() => props.size || state.formSize),
|
|
90
|
-
isDisplayOnly: computed(() =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
isDisplayOnly: computed(() => {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.displayOnly) != null ? _b : false;
|
|
99
|
+
}),
|
|
100
|
+
labelPosition: computed(() => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.labelPosition) != null ? _b : "right";
|
|
103
|
+
}),
|
|
104
|
+
hideRequiredAsterisk: computed(() => {
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
return (_c = (_b = (_a = state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.hideRequiredAsterisk) != null ? _c : false;
|
|
107
|
+
}),
|
|
108
|
+
labelSuffix: computed(() => {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.labelSuffix) != null ? _b : "";
|
|
111
|
+
}),
|
|
112
|
+
labelWidth: computed(() => {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.labelWidth) != null ? _b : "";
|
|
115
|
+
}),
|
|
116
|
+
showMessage: computed(() => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.showMessage) != null ? _b : true;
|
|
119
|
+
}),
|
|
96
120
|
sizeClass: computed(() => state.formItemSize),
|
|
97
121
|
getValidateType: computed(() => api2.computedGetValidateType()),
|
|
98
122
|
validateIcon: computed(() => api2.computedValidateIcon()),
|
|
99
123
|
isErrorInline: computed(() => api2.computedIsErrorInline()),
|
|
100
124
|
isErrorBlock: computed(() => api2.computedIsErrorBlock()),
|
|
101
|
-
|
|
102
|
-
|
|
125
|
+
/**
|
|
126
|
+
* TODO: There is a potential issue here. Need to confirm whether to keep this logic.
|
|
127
|
+
* There does not have disabled prop in form-item, but disabled is used here, I think it is a mistake.
|
|
128
|
+
* If not, need to add disabled prop in form-item component.
|
|
129
|
+
*/
|
|
130
|
+
// @ts-expect-error Need to confirm whether to keep this logic
|
|
131
|
+
disabled: computed(() => {
|
|
132
|
+
var _a;
|
|
133
|
+
return ((_a = state.formInstance) == null ? void 0 : _a.disabled) || props.disabled;
|
|
134
|
+
}),
|
|
135
|
+
tooltipType: computed(() => {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
return (_b = (_a = state.formInstance) == null ? void 0 : _a.state.tooltipType) != null ? _b : "normal";
|
|
138
|
+
}),
|
|
103
139
|
// 标记表单项下是否有多个子节点
|
|
104
140
|
isMultiple: false
|
|
105
141
|
});
|
|
@@ -145,7 +181,10 @@ const initApi = ({ api: api2, state, dispatch, broadcast, props, constants, vm,
|
|
|
145
181
|
const initWatch = ({ watch, api: api2, props, state }) => {
|
|
146
182
|
watch(() => props.error, api2.watchError, { immediate: true });
|
|
147
183
|
watch(() => props.validateStatus, api2.watchValidateStatus);
|
|
148
|
-
watch(() =>
|
|
184
|
+
watch(() => {
|
|
185
|
+
var _a;
|
|
186
|
+
return (_a = state.formInstance) == null ? void 0 : _a.displayOnly;
|
|
187
|
+
}, api2.clearDisplayedValue);
|
|
149
188
|
};
|
|
150
189
|
const renderless = (props, { computed, inject, onMounted, onUnmounted, provide, reactive, watch }, { vm, constants, t, nextTick, broadcast, dispatch, mode, slots }) => {
|
|
151
190
|
const api2 = {};
|
package/grid/utils/common.js
CHANGED
|
@@ -11,7 +11,7 @@ const getRowid = ($table, row) => {
|
|
|
11
11
|
const rowId = get(row, getRowkey($table));
|
|
12
12
|
return rowId ? encodeURIComponent(rowId) : "";
|
|
13
13
|
};
|
|
14
|
-
const getColumnList = (columns, options = {}, level = 0) => {
|
|
14
|
+
const getColumnList = ($table, columns, options = {}, level = 0) => {
|
|
15
15
|
const result = [];
|
|
16
16
|
columns.forEach((column, index) => {
|
|
17
17
|
var _a;
|
|
@@ -25,8 +25,15 @@ const getColumnList = (columns, options = {}, level = 0) => {
|
|
|
25
25
|
if (level === 0 && !options.isGroup && hasChildren) {
|
|
26
26
|
options.isGroup = true;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const isLeaf = !hasChildren;
|
|
29
|
+
options.columnCaches.push({
|
|
30
|
+
colid: column.id,
|
|
31
|
+
column,
|
|
32
|
+
index,
|
|
33
|
+
isLeaf,
|
|
34
|
+
columnIndex: isLeaf ? $table.markColumnIndex++ : null
|
|
35
|
+
});
|
|
36
|
+
result.push.apply(result, hasChildren ? getColumnList($table, column.children, options, level + 1) : [column]);
|
|
30
37
|
});
|
|
31
38
|
return result;
|
|
32
39
|
};
|