@opentiny/vue-renderless 3.26.0 → 3.28.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/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/calendar-view/index.js +6 -3
- package/calendar-view/vue.js +9 -5
- package/color-picker/vue.js +4 -0
- package/color-select-panel/alpha-select/index.js +17 -12
- package/color-select-panel/alpha-select/vue.js +4 -2
- package/color-select-panel/hue-select/index.js +42 -11
- package/color-select-panel/hue-select/vue.js +32 -6
- package/color-select-panel/index.js +223 -39
- package/color-select-panel/linear-gradient/index.js +131 -0
- package/color-select-panel/linear-gradient/vue.js +21 -0
- package/color-select-panel/sv-select/index.js +12 -9
- package/color-select-panel/sv-select/vue.js +4 -2
- package/color-select-panel/utils/color-map.js +154 -0
- package/color-select-panel/utils/color-points.js +86 -0
- package/color-select-panel/utils/color.js +1 -1
- package/color-select-panel/utils/context.js +14 -0
- package/color-select-panel/vue.js +3 -3
- package/common/deps/infinite-scroll.js +1 -1
- package/dialog-box/index.js +3 -3
- package/dialog-box/vue.js +1 -0
- package/drawer/index.js +20 -0
- package/drawer/vue.js +9 -1
- package/dropdown/index.js +10 -4
- package/file-upload/index.js +18 -4
- 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/index.js +3 -3
- package/guide/vue.js +11 -1
- package/input/vue.js +2 -1
- package/package.json +3 -3
- package/picker/index.js +30 -13
- package/picker/vue.js +10 -0
- package/popover/index.js +1 -1
- package/rich-text/index.js +42 -0
- package/select/index.js +32 -15
- package/select/vue.js +31 -10
- package/select-dropdown/vue.js +8 -3
- package/select-wrapper/vue.js +134 -0
- package/slider/vue.js +7 -0
- package/space/index.js +30 -0
- package/space/vue.js +39 -0
- package/switch/vue.js +19 -0
- package/tab-nav/index.js +2 -2
- package/tabs-mf/index.js +9 -1
- package/tabs-mf/vue-nav.js +70 -22
- package/tabs-mf/vue-slider-bar.js +24 -0
- package/tabs-mf/vue.js +23 -5
- package/tag/index.js +1 -1
- package/transfer-panel/index.js +2 -1
- package/tree-menu/index.js +4 -0
- package/tree-menu/vue.js +3 -0
- package/tree-select/index.js +13 -4
- package/tree-select/vue.js +19 -3
- package/types/autocomplete.type.d.ts +2 -1
- package/types/color-select-panel.type.d.ts +197 -1
- package/types/date-picker.type.d.ts +38 -2
- package/types/file-upload.type.d.ts +1 -1
- 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/input.type.d.ts +1 -1
- package/types/modal.type.d.ts +4 -0
- package/types/numeric.type.d.ts +1 -1
- package/types/picker.type.d.ts +42 -2
- package/types/popeditor.type.d.ts +76 -4
- package/types/popover.type.d.ts +1 -1
- package/types/space.type.d.ts +31 -0
- package/types/switch.type.d.ts +2 -1
- package/types/transfer.type.d.ts +3 -3
- package/types/tree-menu.type.d.ts +38 -2
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-36a8374a.d.ts → upload-list.type-d5ff675d.d.ts} +1 -1
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
import { draggable } from "./use-drag";
|
|
3
|
+
import { getClientXY } from "./getClientXY";
|
|
4
|
+
class ColorPoint {
|
|
5
|
+
constructor(color, cursorLeft) {
|
|
6
|
+
this.color = color;
|
|
7
|
+
this.cursorLeft = cursorLeft;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const useColorPoints = (props, hooks, ctx) => {
|
|
11
|
+
const { ref, watch, readonly } = hooks;
|
|
12
|
+
const points = ctx.colorPoints;
|
|
13
|
+
const actviePoint = ctx.activeColor;
|
|
14
|
+
const deg = ref(45);
|
|
15
|
+
const linearGradientValue = ref("");
|
|
16
|
+
const addPoint = (point) => {
|
|
17
|
+
points.value.push(point);
|
|
18
|
+
};
|
|
19
|
+
const removePoint = (point) => {
|
|
20
|
+
points.value = points.value.filter((curPoint) => curPoint !== point);
|
|
21
|
+
};
|
|
22
|
+
const updateDeg = (_deg) => {
|
|
23
|
+
deg.value = _deg;
|
|
24
|
+
};
|
|
25
|
+
const onDrag = (wrapper, event) => {
|
|
26
|
+
const wrapperEl = wrapper.value;
|
|
27
|
+
if (!wrapperEl) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const rect = wrapperEl.getBoundingClientRect();
|
|
31
|
+
const { clientX } = getClientXY(event);
|
|
32
|
+
actviePoint.value.cursorLeft = Math.min(Math.max(clientX - rect.left, 0), rect.width);
|
|
33
|
+
};
|
|
34
|
+
const onClick = (element, point) => {
|
|
35
|
+
const el = element;
|
|
36
|
+
actviePoint.value = point;
|
|
37
|
+
draggable(el, {
|
|
38
|
+
drag(event) {
|
|
39
|
+
onDrag(props.wrapper, event);
|
|
40
|
+
},
|
|
41
|
+
end(event) {
|
|
42
|
+
onDrag(props.wrapper, event);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const getRelativePos = (wrapper, point) => {
|
|
47
|
+
const wrapperEl = wrapper.value;
|
|
48
|
+
const rect = wrapperEl.getBoundingClientRect();
|
|
49
|
+
return (point.cursorLeft / rect.width * 100).toFixed(0);
|
|
50
|
+
};
|
|
51
|
+
const setActivePoint = (point) => {
|
|
52
|
+
actviePoint.value = point;
|
|
53
|
+
};
|
|
54
|
+
const getActviePoint = () => actviePoint;
|
|
55
|
+
const toString = () => {
|
|
56
|
+
const colroString = points.value.map(
|
|
57
|
+
(point) => [point.color.value, `${getRelativePos(props.wrapper, point)}%`].join(" ")
|
|
58
|
+
);
|
|
59
|
+
linearGradientValue.value = `linear-gradient(${deg.value}deg, ${colroString.join(",")})`;
|
|
60
|
+
};
|
|
61
|
+
watch(deg, toString, { deep: true });
|
|
62
|
+
watch(
|
|
63
|
+
actviePoint,
|
|
64
|
+
() => {
|
|
65
|
+
if (!props.wrapper.value) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
toString();
|
|
69
|
+
},
|
|
70
|
+
{ deep: true }
|
|
71
|
+
);
|
|
72
|
+
return {
|
|
73
|
+
onClick,
|
|
74
|
+
linearGradientValue: readonly(linearGradientValue),
|
|
75
|
+
updateDeg,
|
|
76
|
+
removePoint,
|
|
77
|
+
addPoint,
|
|
78
|
+
setActivePoint,
|
|
79
|
+
getActviePoint,
|
|
80
|
+
onDrag
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
ColorPoint,
|
|
85
|
+
useColorPoints
|
|
86
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
const ContextKey = Symbol("");
|
|
3
|
+
const createContext = (data, hooks) => {
|
|
4
|
+
hooks.provide(ContextKey, data);
|
|
5
|
+
return data;
|
|
6
|
+
};
|
|
7
|
+
const useContext = (hooks) => {
|
|
8
|
+
return hooks.inject(ContextKey);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
ContextKey,
|
|
12
|
+
createContext,
|
|
13
|
+
useContext
|
|
14
|
+
};
|
|
@@ -16,8 +16,8 @@ const api = [
|
|
|
16
16
|
"onHistoryClick",
|
|
17
17
|
"onClickOutside"
|
|
18
18
|
];
|
|
19
|
-
const renderless = (props, hooks, utils) => {
|
|
20
|
-
const state = initState(props, hooks);
|
|
19
|
+
const renderless = (props, hooks, utils, ext) => {
|
|
20
|
+
const state = initState(props, hooks, utils, ext);
|
|
21
21
|
const {
|
|
22
22
|
open,
|
|
23
23
|
close,
|
|
@@ -32,7 +32,7 @@ const renderless = (props, hooks, utils) => {
|
|
|
32
32
|
onPredefineColorClick,
|
|
33
33
|
onHistoryClick,
|
|
34
34
|
onClickOutside
|
|
35
|
-
} = initApi(props, state, utils);
|
|
35
|
+
} = initApi(props, state, utils, hooks, ext);
|
|
36
36
|
const api2 = {
|
|
37
37
|
state,
|
|
38
38
|
open,
|
|
@@ -24,7 +24,7 @@ const parseAttrValue = (attrVal, type, defaultVal) => {
|
|
|
24
24
|
const computeScrollOptions = (el, instance) => Object.entries(attrs).reduce((accumulator, [name, option]) => {
|
|
25
25
|
const { type, default: defaultValue } = option;
|
|
26
26
|
const attrKey = `infinite-scroll-${name}`;
|
|
27
|
-
const $attrValue = instance.$el.getAttribute(attrKey);
|
|
27
|
+
const $attrValue = (instance == null ? void 0 : instance.$el) && typeof instance.$el.getAttribute === "function" ? instance.$el.getAttribute(attrKey) : null;
|
|
28
28
|
const attrValue = el.getAttribute(attrKey);
|
|
29
29
|
let value;
|
|
30
30
|
if (isNull(attrValue) && isNull($attrValue) || !isNull(attrValue)) {
|
package/dialog-box/index.js
CHANGED
|
@@ -129,14 +129,14 @@ const handleClose = ({
|
|
|
129
129
|
if (typeof props.beforeClose === "function" && props.beforeClose(type) === false) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
+
if (!emitEvent(emit, "before-close", api.hide)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
132
135
|
const el = parent.$el;
|
|
133
136
|
if (props.rightSlide) {
|
|
134
137
|
const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
|
|
135
138
|
dialogBoxDom.style.left = "";
|
|
136
139
|
}
|
|
137
|
-
if (!emitEvent(emit, "before-close", api.hide)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
140
|
api.hide(type);
|
|
141
141
|
};
|
|
142
142
|
const hide = ({ api, emit, state, props }) => (cancel) => {
|
package/dialog-box/vue.js
CHANGED
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,13 +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
|
-
|
|
295
|
-
|
|
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
|
+
}
|
|
296
306
|
} else {
|
|
297
|
-
|
|
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
|
+
}
|
|
298
312
|
}
|
|
299
313
|
if (state.isEdm || Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
300
314
|
if (!isNaN(Number(maxSize)) && file.size > maxSize * 1024 * 1024) {
|
|
@@ -2136,7 +2150,7 @@ const getTipMessage = ({ t, api, constants }) => ({ accept, fileSize, limit }) =
|
|
|
2136
2150
|
});
|
|
2137
2151
|
}
|
|
2138
2152
|
if (fileSize && acceptTip.length !== 0) {
|
|
2139
|
-
acceptTip += `${t(constants.COMMA)}
|
|
2153
|
+
acceptTip += `${t(constants.COMMA)}`;
|
|
2140
2154
|
}
|
|
2141
2155
|
let fileSizeTip = "";
|
|
2142
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
|
};
|