@opentiny/vue-renderless 3.8.3 → 3.9.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/action-sheet/index.js +1 -1
- package/action-sheet/vue.js +12 -12
- package/alert/index.js +2 -2
- package/alert/vue.js +3 -3
- package/anchor/index.js +40 -23
- package/anchor/vue.js +5 -2
- package/button-group/index.js +6 -0
- package/button-group/vue.js +10 -5
- package/carousel/index.js +18 -20
- package/carousel/vue.js +29 -5
- package/carousel-item/index.js +2 -1
- package/carousel-item/vue.js +14 -2
- package/cascader/index.js +110 -11
- package/cascader/vue.js +35 -12
- package/chart-heatmap/index.js +12 -12
- package/checkbox/index.js +19 -6
- package/checkbox/vue.js +38 -20
- package/common/bigInt.js +2 -1
- package/common/browser.js +43 -37
- package/common/deps/ResizeObserver.js +2 -2
- package/common/deps/popper.js +26 -24
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/common/validate/util.js +3 -2
- package/drawer/index.js +16 -1
- package/drawer/vue.js +14 -3
- package/dropdown-item/mf.js +1 -1
- package/dropdown-menu/index.js +3 -0
- package/dropdown-menu/vue.js +20 -2
- package/file-upload/index.js +0 -1
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +2 -2
- package/image/vue.js +12 -1
- package/input/index.js +15 -3
- package/input/vue.js +34 -8
- package/ip-address/index.js +4 -4
- package/month-table/index.js +5 -2
- package/numeric/index.js +6 -3
- package/numeric/vue.js +1 -1
- package/package.json +8 -1
- package/pager/vue.js +2 -2
- package/popconfirm/index.js +1 -0
- package/popconfirm/vue.js +4 -2
- package/popover/index.js +19 -12
- package/popover/vue.js +15 -5
- package/progress/index.js +44 -6
- package/progress/vue.js +15 -4
- package/radio/index.js +2 -0
- package/radio/vue.js +3 -0
- package/record/index.js +166 -59
- package/record/vue.js +31 -14
- package/roles/index.js +5 -5
- package/roles/vue.js +1 -1
- package/slider/index.js +3 -1
- package/steps/index.js +8 -0
- package/steps/vue.js +3 -2
- package/switch/vue.js +9 -2
- package/tabs-mf/vue-bar.js +1 -1
- package/text-popup/vue.js +2 -1
- package/time-line/index.js +8 -0
- package/time-line/vue.js +2 -1
- package/tooltip/index.js +35 -25
- package/tooltip/vue.js +1 -1
- package/tree/index.js +1 -1
- package/user-head/vue.js +8 -1
package/common/validate/util.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../../chunk-PKUHTIDK.js";
|
|
4
4
|
import { hasOwn, isNull } from "../type";
|
|
5
|
+
import { log } from "../xss";
|
|
5
6
|
const formatRegExp = /%[sdj%]/g;
|
|
6
7
|
let warning = () => void 0;
|
|
7
8
|
function convertFieldsError(errors) {
|
|
@@ -138,7 +139,7 @@ function asyncMap(objArray, option, func, callback) {
|
|
|
138
139
|
const flattenArr = flattenObjArr(objArray);
|
|
139
140
|
asyncSerialArray(flattenArr, func, next);
|
|
140
141
|
});
|
|
141
|
-
pending2.catch((error) => error);
|
|
142
|
+
pending2.catch((error) => error.errors && error.fields || log.logger.error(error));
|
|
142
143
|
return pending2;
|
|
143
144
|
}
|
|
144
145
|
let firstFields = option.firstFields || [];
|
|
@@ -168,7 +169,7 @@ function asyncMap(objArray, option, func, callback) {
|
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
171
|
});
|
|
171
|
-
pending.catch((
|
|
172
|
+
pending.catch((error) => error.errors && error.fields || log.logger.error(error));
|
|
172
173
|
return pending;
|
|
173
174
|
}
|
|
174
175
|
function complementError(rule) {
|
package/drawer/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import debounce from "../common/deps/debounce";
|
|
3
|
+
import { addClass, removeClass } from "../common/deps/dom";
|
|
3
4
|
const close = ({ emit, state }) => () => {
|
|
4
5
|
state.toggle = false;
|
|
5
6
|
emit("close", state);
|
|
@@ -70,14 +71,28 @@ const removeDragEvent = ({ api, vm }) => () => {
|
|
|
70
71
|
el.removeEventListener("touchmove", api.mousemove);
|
|
71
72
|
el.removeEventListener("touchend", api.mouseup);
|
|
72
73
|
};
|
|
74
|
+
const showScrollbar = (lockScrollClass) => () => {
|
|
75
|
+
addClass(document.body, lockScrollClass);
|
|
76
|
+
};
|
|
77
|
+
const hideScrollbar = (lockScrollClass) => () => {
|
|
78
|
+
removeClass(document.body, lockScrollClass);
|
|
79
|
+
};
|
|
80
|
+
const watchVisibleNotImmediate = ({ api, props }) => (visible) => {
|
|
81
|
+
if (props.lockScroll) {
|
|
82
|
+
visible ? api.showScrollbar() : api.hideScrollbar();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
73
85
|
export {
|
|
74
86
|
addDragEvent,
|
|
75
87
|
close,
|
|
76
88
|
confirm,
|
|
89
|
+
hideScrollbar,
|
|
77
90
|
mousedown,
|
|
78
91
|
mousemove,
|
|
79
92
|
mouseup,
|
|
80
93
|
removeDragEvent,
|
|
94
|
+
showScrollbar,
|
|
81
95
|
watchToggle,
|
|
82
|
-
watchVisible
|
|
96
|
+
watchVisible,
|
|
97
|
+
watchVisibleNotImmediate
|
|
83
98
|
};
|
package/drawer/vue.js
CHANGED
|
@@ -8,10 +8,14 @@ import {
|
|
|
8
8
|
mouseup,
|
|
9
9
|
mousemove,
|
|
10
10
|
addDragEvent,
|
|
11
|
-
removeDragEvent
|
|
11
|
+
removeDragEvent,
|
|
12
|
+
showScrollbar,
|
|
13
|
+
hideScrollbar,
|
|
14
|
+
watchVisibleNotImmediate
|
|
12
15
|
} from "./index";
|
|
13
16
|
const api = ["state", "close", "confirm"];
|
|
14
|
-
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm }) => {
|
|
17
|
+
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, constants }) => {
|
|
18
|
+
const lockScrollClass = constants.SCROLL_LOCK_CLASS(mode);
|
|
15
19
|
const api2 = {};
|
|
16
20
|
const state = reactive({
|
|
17
21
|
toggle: false,
|
|
@@ -29,13 +33,20 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
29
33
|
addDragEvent: addDragEvent({ api: api2, vm }),
|
|
30
34
|
removeDragEvent: removeDragEvent({ api: api2, vm }),
|
|
31
35
|
watchVisible: watchVisible({ state }),
|
|
32
|
-
watchToggle: watchToggle({ emit })
|
|
36
|
+
watchToggle: watchToggle({ emit }),
|
|
37
|
+
showScrollbar: showScrollbar(lockScrollClass),
|
|
38
|
+
hideScrollbar: hideScrollbar(lockScrollClass),
|
|
39
|
+
watchVisibleNotImmediate: watchVisibleNotImmediate({ api: api2, props })
|
|
33
40
|
});
|
|
34
41
|
onMounted(() => {
|
|
35
42
|
props.dragable && api2.addDragEvent();
|
|
43
|
+
if (props.lockScroll && props.visible) {
|
|
44
|
+
api2.showScrollbar();
|
|
45
|
+
}
|
|
36
46
|
});
|
|
37
47
|
onBeforeUnmount(() => {
|
|
38
48
|
props.dragable && api2.removeDragEvent();
|
|
49
|
+
props.lockScroll && api2.hideScrollbar();
|
|
39
50
|
});
|
|
40
51
|
watch(() => props.visible, api2.watchVisible, { immediate: true });
|
|
41
52
|
watch(() => state.toggle, api2.watchToggle);
|
package/dropdown-item/mf.js
CHANGED
|
@@ -3,7 +3,7 @@ import { omitText } from "../common/string";
|
|
|
3
3
|
const api = ["dataStore", "handleClick", "dataStore", "mouseEnter", "mouseLeave"];
|
|
4
4
|
const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
5
5
|
const api2 = {};
|
|
6
|
-
const dropdownMenuVm = inject("
|
|
6
|
+
const dropdownMenuVm = inject("dropdownMenu");
|
|
7
7
|
const multiStage = inject("multiStage");
|
|
8
8
|
let dataStore = reactive({
|
|
9
9
|
checkedStatus: dropdownMenuVm.checkedStatus,
|
package/dropdown-menu/index.js
CHANGED
|
@@ -88,6 +88,9 @@ const useVuePopper = ({ api, props, hooks, instance, state }) => {
|
|
|
88
88
|
dropdown.popperElm = popper.popperElm.value = vm.$el;
|
|
89
89
|
popper.referenceElm.value = dropdown.$el;
|
|
90
90
|
dropdown.initDomOperation();
|
|
91
|
+
if (dropdown.inheritWidth) {
|
|
92
|
+
dropdown.popperElm.style.minWidth = dropdown.$el.clientWidth + "px";
|
|
93
|
+
}
|
|
91
94
|
});
|
|
92
95
|
onBeforeUnmount(() => {
|
|
93
96
|
popper.destroyPopper("remove");
|
package/dropdown-menu/vue.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
toggleItem,
|
|
4
|
+
updateOffset,
|
|
5
|
+
clickOutside,
|
|
6
|
+
getScroller,
|
|
7
|
+
useVuePopper,
|
|
8
|
+
mounted,
|
|
9
|
+
handleMenuItemClick,
|
|
10
|
+
handleMouseenter,
|
|
11
|
+
handleMouseleave
|
|
12
|
+
} from "./index";
|
|
13
|
+
const api = [
|
|
14
|
+
"state",
|
|
15
|
+
"toggleItem",
|
|
16
|
+
"updateOffset",
|
|
17
|
+
"clickOutside",
|
|
18
|
+
"doDestroy",
|
|
19
|
+
"handleMouseenter",
|
|
20
|
+
"handleMouseleave"
|
|
21
|
+
];
|
|
4
22
|
const renderless = (props, hooks, instance) => {
|
|
5
23
|
const api2 = {};
|
|
6
24
|
const { reactive, provide, onMounted } = hooks;
|
package/file-upload/index.js
CHANGED
|
@@ -535,7 +535,6 @@ const handleRemove = ({ api, emit, props, state, constants }) => (file, raw) =>
|
|
|
535
535
|
file = api.getFile(raw);
|
|
536
536
|
}
|
|
537
537
|
let doRemove = () => {
|
|
538
|
-
file.status = constants.FILE_STATUS.FAIL;
|
|
539
538
|
api.abort(file);
|
|
540
539
|
let fileList = state.uploadFiles;
|
|
541
540
|
fileList.splice(fileList.indexOf(file), 1);
|
package/grid/utils/column.js
CHANGED
|
@@ -40,6 +40,7 @@ function setBasicProperty(column, context) {
|
|
|
40
40
|
column.treeNode = context.treeNode;
|
|
41
41
|
column.renderer = context.renderer;
|
|
42
42
|
column.editor = context.editor;
|
|
43
|
+
column.operationConfig = context.operationConfig;
|
|
43
44
|
}
|
|
44
45
|
function ColumnConfig(context, { renderHeader, renderCell, renderData } = {}, config = {}) {
|
|
45
46
|
setBasicProperty(this, context);
|
package/grid/utils/dom.js
CHANGED
|
@@ -5,8 +5,6 @@ import { arrayIndexOf } from "../static";
|
|
|
5
5
|
const ATTR_NAME = "data-rowid";
|
|
6
6
|
const CELL_CLS = ".tiny-grid-cell";
|
|
7
7
|
const ROW_CLS = ".tiny-grid-body__row";
|
|
8
|
-
const htmlEl = document.querySelector("html");
|
|
9
|
-
const bodyEl = document.body;
|
|
10
8
|
const isPx = (val) => val && /^\d+(px)?$/.test(val);
|
|
11
9
|
const isScale = (val) => val && /^\d+%$/.test(val);
|
|
12
10
|
const updateCellTitle = (event) => {
|
|
@@ -126,6 +124,8 @@ const getEventTargetNode = (event, container, queryCls) => {
|
|
|
126
124
|
};
|
|
127
125
|
function getNodeOffset(el, container, rest) {
|
|
128
126
|
if (el) {
|
|
127
|
+
const htmlEl = document.querySelector("html");
|
|
128
|
+
const bodyEl = document.body;
|
|
129
129
|
const parentEl = el.parentNode;
|
|
130
130
|
rest.top += el.offsetTop;
|
|
131
131
|
rest.left += el.offsetLeft;
|
package/image/vue.js
CHANGED
|
@@ -15,7 +15,18 @@ import {
|
|
|
15
15
|
mounted,
|
|
16
16
|
deleteHander
|
|
17
17
|
} from "./index";
|
|
18
|
-
const api = [
|
|
18
|
+
const api = [
|
|
19
|
+
"state",
|
|
20
|
+
"src",
|
|
21
|
+
"zIndex",
|
|
22
|
+
"previewSrcList",
|
|
23
|
+
"loadImage",
|
|
24
|
+
"clickHandler",
|
|
25
|
+
"closeViewer",
|
|
26
|
+
"handleLoad",
|
|
27
|
+
"handleError",
|
|
28
|
+
"deleteHander"
|
|
29
|
+
];
|
|
19
30
|
const initState = ({ reactive, computed, api: api2, props, images }) => {
|
|
20
31
|
const state = reactive({
|
|
21
32
|
mfPreviewVisible: props.previewVisible,
|
package/input/index.js
CHANGED
|
@@ -46,7 +46,7 @@ const calculateNodeStyling = () => (targetElement) => {
|
|
|
46
46
|
const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
|
|
47
47
|
return { contextStyle, paddingSize, borderSize, boxSizing };
|
|
48
48
|
};
|
|
49
|
-
const calcTextareaHeight = ({ api, hiddenTextarea, props }) => (targetElement, minRows = 1, maxRows = null) => {
|
|
49
|
+
const calcTextareaHeight = ({ api, hiddenTextarea, props, state }) => (targetElement, minRows = 1, maxRows = null) => {
|
|
50
50
|
if (!hiddenTextarea) {
|
|
51
51
|
hiddenTextarea = document.createElement("textarea");
|
|
52
52
|
document.body.appendChild(hiddenTextarea);
|
|
@@ -74,8 +74,12 @@ const calcTextareaHeight = ({ api, hiddenTextarea, props }) => (targetElement, m
|
|
|
74
74
|
if (props.height) {
|
|
75
75
|
minHeight = props.height;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (!state.isDisplayOnly) {
|
|
78
|
+
height = Math.max(minHeight, height);
|
|
79
|
+
textareaStyle.minHeight = `${minHeight}px`;
|
|
80
|
+
} else {
|
|
81
|
+
textareaStyle.minHeight = `0px`;
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
if (maxRows !== null) {
|
|
81
85
|
let maxHeight = singleRowHeight * maxRows;
|
|
@@ -250,6 +254,12 @@ const getDisplayedValue = ({ state, props }) => () => {
|
|
|
250
254
|
return props.displayOnlyContent || state.nativeInputValue || "-";
|
|
251
255
|
}
|
|
252
256
|
};
|
|
257
|
+
const handleDrop = (emit) => (event) => {
|
|
258
|
+
emit("drop", event);
|
|
259
|
+
};
|
|
260
|
+
const handleDragStart = (emit) => (event) => {
|
|
261
|
+
emit("dragstart", event);
|
|
262
|
+
};
|
|
253
263
|
export {
|
|
254
264
|
blur,
|
|
255
265
|
calcIconOffset,
|
|
@@ -266,6 +276,8 @@ export {
|
|
|
266
276
|
handleCompositionEnd,
|
|
267
277
|
handleCompositionStart,
|
|
268
278
|
handleCompositionUpdate,
|
|
279
|
+
handleDragStart,
|
|
280
|
+
handleDrop,
|
|
269
281
|
handleEnterDisplayOnlyContent,
|
|
270
282
|
handleFocus,
|
|
271
283
|
handleInput,
|
package/input/vue.js
CHANGED
|
@@ -30,7 +30,9 @@ import {
|
|
|
30
30
|
handleEnterDisplayOnlyContent,
|
|
31
31
|
hiddenPassword,
|
|
32
32
|
dispatchDisplayedValue,
|
|
33
|
-
getDisplayedValue
|
|
33
|
+
getDisplayedValue,
|
|
34
|
+
handleDrop,
|
|
35
|
+
handleDragStart
|
|
34
36
|
} from "./index";
|
|
35
37
|
import useStorageBox from "../tall-storage/vue-storage-box";
|
|
36
38
|
const api = [
|
|
@@ -63,7 +65,9 @@ const api = [
|
|
|
63
65
|
"isMemoryStorage",
|
|
64
66
|
"hasSelection",
|
|
65
67
|
"handleEnterDisplayOnlyContent",
|
|
66
|
-
"hiddenPassword"
|
|
68
|
+
"hiddenPassword",
|
|
69
|
+
"handleDrop",
|
|
70
|
+
"handleDragStart"
|
|
67
71
|
];
|
|
68
72
|
const initState = ({ reactive, computed, mode, props, parent, constants }) => {
|
|
69
73
|
const state = reactive({
|
|
@@ -77,21 +81,29 @@ const initState = ({ reactive, computed, mode, props, parent, constants }) => {
|
|
|
77
81
|
checkedLable: "",
|
|
78
82
|
sheetvalue: props.modelValue,
|
|
79
83
|
inputSize: computed(() => props.size || state.formItemSize),
|
|
80
|
-
showClear: computed(
|
|
84
|
+
showClear: computed(
|
|
85
|
+
() => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
|
|
86
|
+
),
|
|
81
87
|
upperLimit: computed(() => parent.$attrs.maxlength),
|
|
82
88
|
textLength: computed(() => textLength(props.modelValue)),
|
|
83
89
|
inputExceed: computed(() => state.isWordLimitVisible && state.textLength > state.upperLimit),
|
|
84
90
|
formItemSize: computed(() => (parent.formItem || {}).formItemSize),
|
|
85
91
|
validateIcon: computed(() => constants.VALIDATE_ICON[state.validateState]),
|
|
86
92
|
showWordLimit: computed(() => props.showWordLimit && parent.$attrs.maxlength),
|
|
87
|
-
inputDisabled: computed(
|
|
93
|
+
inputDisabled: computed(
|
|
94
|
+
() => props.disabled || (parent.auiForm || {}).disabled || state.isDisplayOnly || (parent.tinyForm || {}).displayOnly
|
|
95
|
+
),
|
|
88
96
|
validateState: computed(() => parent.formItem ? parent.formItem.validateState : ""),
|
|
89
97
|
textareaStyle: computed(() => __spreadProps(__spreadValues({}, state.textareaCalcStyle), {
|
|
90
98
|
resize: props.resize
|
|
91
99
|
})),
|
|
92
100
|
needStatusIcon: computed(() => parent.tinyForm ? parent.tinyForm.statusIcon : false),
|
|
93
|
-
showPwdVisible: computed(
|
|
94
|
-
|
|
101
|
+
showPwdVisible: computed(
|
|
102
|
+
() => props.showPassword && !state.inputDisabled && !props.readonly && (!!state.nativeInputValue || state.focused)
|
|
103
|
+
),
|
|
104
|
+
nativeInputValue: computed(
|
|
105
|
+
() => props.modelValue === null || props.modelValue === void 0 ? "" : String(props.modelValue)
|
|
106
|
+
),
|
|
95
107
|
isWordLimitVisible: computed(
|
|
96
108
|
() => (props.showWordLimit && parent.$attrs.maxlength || props.counter) && (parent.type === "text" || parent.type === "textarea") && !state.inputDisabled && !props.readonly && !props.showPassword
|
|
97
109
|
),
|
|
@@ -119,7 +131,9 @@ const initApi = ({ api: api2, state, dispatch, broadcast, emit, refs, props, CLA
|
|
|
119
131
|
handleCompositionStart: handleCompositionStart(state),
|
|
120
132
|
handleCompositionUpdate: handleCompositionUpdate(state),
|
|
121
133
|
dispatchDisplayedValue: dispatchDisplayedValue({ state, props, dispatch, api: api2 }),
|
|
122
|
-
getDisplayedValue: getDisplayedValue({ state, props })
|
|
134
|
+
getDisplayedValue: getDisplayedValue({ state, props }),
|
|
135
|
+
handleDrop: handleDrop(emit),
|
|
136
|
+
handleDragStart: handleDragStart(emit)
|
|
123
137
|
});
|
|
124
138
|
};
|
|
125
139
|
const mergeApi = ({ storages, api: api2, componentName, props, emit, eventName, nextTick, parent, state, refs }) => {
|
|
@@ -148,7 +162,8 @@ const mergeApi = ({ storages, api: api2, componentName, props, emit, eventName,
|
|
|
148
162
|
calcTextareaHeight: calcTextareaHeight({
|
|
149
163
|
api: api2,
|
|
150
164
|
hiddenTextarea: null,
|
|
151
|
-
props
|
|
165
|
+
props,
|
|
166
|
+
state
|
|
152
167
|
}),
|
|
153
168
|
setNativeInputValue: setNativeInputValue({ api: api2, state }),
|
|
154
169
|
handleCompositionEnd: handleCompositionEnd({ api: api2, state }),
|
|
@@ -193,6 +208,17 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, emit, componentNa
|
|
|
193
208
|
});
|
|
194
209
|
}
|
|
195
210
|
);
|
|
211
|
+
watch(
|
|
212
|
+
() => state.isDisplayOnly,
|
|
213
|
+
() => {
|
|
214
|
+
nextTick(() => {
|
|
215
|
+
api2.setNativeInputValue();
|
|
216
|
+
api2.resizeTextarea();
|
|
217
|
+
api2.updateIconOffset();
|
|
218
|
+
api2.dispatchDisplayedValue();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
);
|
|
196
222
|
watch(
|
|
197
223
|
() => state.sheetvalue,
|
|
198
224
|
(value) => api2.watchFormSelect(value),
|
package/ip-address/index.js
CHANGED
|
@@ -115,7 +115,7 @@ const keyup = ({ api, props }) => ({ item, index, event }) => {
|
|
|
115
115
|
item.value = item.value.replace(/\D/g, "");
|
|
116
116
|
return false;
|
|
117
117
|
}
|
|
118
|
-
if ([KEY_CODE.Space, KEY_CODE.NumpadDecimal, KEY_CODE.NumpadComma].includes(keyCode) && value) {
|
|
118
|
+
if ([KEY_CODE.Tab, KEY_CODE.Space, KEY_CODE.NumpadDecimal, KEY_CODE.NumpadComma].includes(keyCode) && value) {
|
|
119
119
|
api.select({ index: nextIndex });
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
@@ -126,14 +126,14 @@ const keyup = ({ api, props }) => ({ item, index, event }) => {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
const checkError1 = ({ Space, NumpadDecimal, NumpadComma, keyCode, value }) => [Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
|
|
129
|
+
const checkError1 = ({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) => [Tab, Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
|
|
130
130
|
const checkError2 = (newValue) => newValue && (isNaN(newValue) || newValue > IPTHRESHOLD.Max);
|
|
131
131
|
const checkError3 = ({ isfilterKeyCodes, isSelected, value }) => !isfilterKeyCodes && !isSelected && value === "0";
|
|
132
132
|
const checkError4 = ({ isfilterKeyCodes, isSelected, value, key }) => !isfilterKeyCodes && !isSelected && value + key > IPTHRESHOLD.Max;
|
|
133
133
|
const checkError5 = ({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV }) => isNaN(key) && !isfilterKeyCodes && !(!value && ctrlKey && keyCode === KeyV);
|
|
134
134
|
const isError = ({ key, value, isSelected, isfilterKeyCodes, ctrlKey, keyCode, newValue }) => {
|
|
135
|
-
const { Space, NumpadDecimal, NumpadComma, KeyV } = KEY_CODE;
|
|
136
|
-
return checkError1({ Space, NumpadDecimal, NumpadComma, keyCode, value }) || checkError2(newValue) || checkError3({ isfilterKeyCodes, isSelected, value }) || checkError4({ isfilterKeyCodes, isSelected, value, key }) || checkError5({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV });
|
|
135
|
+
const { Tab, Space, NumpadDecimal, NumpadComma, KeyV } = KEY_CODE;
|
|
136
|
+
return checkError1({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) || checkError2(newValue) || checkError3({ isfilterKeyCodes, isSelected, value }) || checkError4({ isfilterKeyCodes, isSelected, value, key }) || checkError5({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV });
|
|
137
137
|
};
|
|
138
138
|
const keydown = ({ api, props, state }) => ({ item, index, event }) => {
|
|
139
139
|
const { target, key, keyCode, ctrlKey } = event;
|
package/month-table/index.js
CHANGED
|
@@ -58,8 +58,11 @@ const getRows = ({ props, state, vm }) => () => {
|
|
|
58
58
|
return tableRows;
|
|
59
59
|
};
|
|
60
60
|
const markRange = ({ props, state }) => (minDate, maxDate) => {
|
|
61
|
-
minDate =
|
|
62
|
-
maxDate =
|
|
61
|
+
minDate = getMonthTimestamp(minDate);
|
|
62
|
+
maxDate = getMonthTimestamp(maxDate);
|
|
63
|
+
if (minDate > maxDate) {
|
|
64
|
+
[minDate, maxDate] = [maxDate, minDate];
|
|
65
|
+
}
|
|
63
66
|
const rows = state.rows;
|
|
64
67
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
65
68
|
const row = rows[i];
|
package/numeric/index.js
CHANGED
|
@@ -58,7 +58,7 @@ const increase = ({ api, props, state }) => () => {
|
|
|
58
58
|
if (state.inputDisabled || state.maxDisabled) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
const value = props.modelValue || 0;
|
|
61
|
+
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
|
|
62
62
|
let newVal = api.internalIncrease({ val: value, step: props.step });
|
|
63
63
|
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
|
64
64
|
api.setCurrentValue(newVal);
|
|
@@ -73,7 +73,7 @@ const decrease = ({ api, props, state }) => () => {
|
|
|
73
73
|
if (state.inputDisabled || state.minDisabled) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const value = props.modelValue || 0;
|
|
76
|
+
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
|
|
77
77
|
let newVal = api.internalDecrease({ val: value, step: props.step });
|
|
78
78
|
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
|
79
79
|
api.setCurrentValue(newVal);
|
|
@@ -92,7 +92,10 @@ const handleBlur = ({ constants, dispatch, emit, props, state, api }) => (event)
|
|
|
92
92
|
dispatch(constants.COMPONENT_NAME, constants.EVENT_NAME.blur, [state.displayValue]);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
const handleFocus = ({ emit, state, props, api }) => (event) => {
|
|
95
|
+
const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
|
|
96
|
+
if (props.disabled) {
|
|
97
|
+
refs.input.blur();
|
|
98
|
+
}
|
|
96
99
|
state.inputStatus = true;
|
|
97
100
|
const currentValue = api.getDecimal(state.currentValue);
|
|
98
101
|
if (!currentValue.isNaN() && !isNull(state.currentValue)) {
|
package/numeric/vue.js
CHANGED
|
@@ -60,7 +60,7 @@ const initApi = ({ api: api2, props, state, parent, refs, emit, dispatch, consta
|
|
|
60
60
|
mounted: mounted({ constants, parent, props, refs, state }),
|
|
61
61
|
unmounted: unmounted({ parent, state }),
|
|
62
62
|
getDecimal: getDecimal(props),
|
|
63
|
-
handleFocus: handleFocus({ emit, state, props, api: api2 }),
|
|
63
|
+
handleFocus: handleFocus({ emit, state, props, api: api2, refs }),
|
|
64
64
|
decrease: decrease({ api: api2, props, state }),
|
|
65
65
|
increase: increase({ api: api2, props, state }),
|
|
66
66
|
handleInput: handleInput({ state, api: api2, emit, props }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
],
|
|
17
17
|
"author": "OpenTiny Team",
|
|
18
18
|
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git@github.com:opentiny/tiny-vue.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/opentiny/tiny-vue/issues"
|
|
25
|
+
},
|
|
19
26
|
"sideEffects": false,
|
|
20
27
|
"scripts": {
|
|
21
28
|
"build": "tsup",
|
package/pager/vue.js
CHANGED
package/popconfirm/index.js
CHANGED
package/popconfirm/vue.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { show, hide, confirm } from "./index";
|
|
3
3
|
const api = ["state", "show", "hide", "confirm"];
|
|
4
|
-
const renderless = (props, { computed, reactive }, { emit, constants }) => {
|
|
4
|
+
const renderless = (props, { computed, reactive }, { emit, constants, designConfig }) => {
|
|
5
|
+
var _a;
|
|
5
6
|
const api2 = {};
|
|
7
|
+
const designIcon = (_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a[props.type];
|
|
6
8
|
const state = reactive({
|
|
7
9
|
isLock: false,
|
|
8
10
|
showPopover: false,
|
|
9
|
-
getIcon: computed(() => typeof props.type === "object" ? props.type : constants.ICON_MAP[props.type])
|
|
11
|
+
getIcon: computed(() => typeof props.type === "object" ? props.type : designIcon || constants.ICON_MAP[props.type])
|
|
10
12
|
});
|
|
11
13
|
Object.assign(api2, {
|
|
12
14
|
state,
|
package/popover/index.js
CHANGED
|
@@ -26,11 +26,13 @@ const processTrigger = ({ api, state, props, nextTick }) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const mounted = ({ api, state, constants, props, nextTick }) => () => {
|
|
29
|
+
const mounted = ({ api, state, constants, props, nextTick, mode }) => () => {
|
|
30
30
|
state.mounted = true;
|
|
31
31
|
const { referenceElm, popperElm, tooltipId } = state;
|
|
32
32
|
if (referenceElm) {
|
|
33
|
-
|
|
33
|
+
if (mode !== "mobile-first") {
|
|
34
|
+
addClass(referenceElm, `${constants.IDPREFIX}__reference`);
|
|
35
|
+
}
|
|
34
36
|
referenceElm.setAttribute("aria-describedby", tooltipId);
|
|
35
37
|
referenceElm.setAttribute("tabindex", props.tabindex);
|
|
36
38
|
popperElm.setAttribute("tabindex", 0);
|
|
@@ -133,17 +135,22 @@ const cleanup = ({ props, state }) => () => {
|
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
const destroyed = ({ state, api }) => () => {
|
|
136
|
-
const
|
|
137
|
-
off(
|
|
138
|
-
off(
|
|
139
|
-
off(
|
|
140
|
-
off(
|
|
141
|
-
off(
|
|
142
|
-
off(
|
|
143
|
-
off(
|
|
144
|
-
off(reference, "mouseleave", api.handleMouseLeave);
|
|
145
|
-
off(reference, "mouseenter", api.handleMouseEnter);
|
|
138
|
+
const { referenceElm, popperElm } = state;
|
|
139
|
+
off(referenceElm, "click", api.doToggle);
|
|
140
|
+
off(referenceElm, "mouseup", api.doClose);
|
|
141
|
+
off(referenceElm, "mousedown", api.doShow);
|
|
142
|
+
off(referenceElm, "focusin", api.doShow);
|
|
143
|
+
off(referenceElm, "focusout", api.doClose);
|
|
144
|
+
off(referenceElm, "mouseleave", api.handleMouseLeave);
|
|
145
|
+
off(referenceElm, "mouseenter", api.handleMouseEnter);
|
|
146
146
|
off(document, "click", api.handleDocumentClick);
|
|
147
|
+
off(popperElm, "focusin", api.handleFocus);
|
|
148
|
+
off(popperElm, "focusout", api.handleBlur);
|
|
149
|
+
off(popperElm, "mouseenter", api.handleMouseEnter);
|
|
150
|
+
off(popperElm, "mouseleave", api.handleMouseLeave);
|
|
151
|
+
off(referenceElm, "click", api.handleClick);
|
|
152
|
+
off(referenceElm, "focusout", api.handleBlur);
|
|
153
|
+
off(referenceElm, "keydown", api.handleKeydown);
|
|
147
154
|
};
|
|
148
155
|
const computedTooltipId = (constants) => () => `${constants.IDPREFIX}-${guid("", 4)}`;
|
|
149
156
|
const wrapMounted = ({ api, props, refs, state }) => () => {
|
package/popover/vue.js
CHANGED
|
@@ -21,7 +21,16 @@ import {
|
|
|
21
21
|
observeCallback
|
|
22
22
|
} from "./index";
|
|
23
23
|
import userPopper from "../common/deps/vue-popper";
|
|
24
|
-
const api = [
|
|
24
|
+
const api = [
|
|
25
|
+
"state",
|
|
26
|
+
"handleAfterEnter",
|
|
27
|
+
"handleAfterLeave",
|
|
28
|
+
"doToggle",
|
|
29
|
+
"doShow",
|
|
30
|
+
"doClose",
|
|
31
|
+
"doDestroy",
|
|
32
|
+
"handleItemClick"
|
|
33
|
+
];
|
|
25
34
|
const initState = ({ reactive, computed, api: api2, popperElm, showPopper, referenceElm }) => {
|
|
26
35
|
const state = reactive({
|
|
27
36
|
popperElm,
|
|
@@ -29,14 +38,15 @@ const initState = ({ reactive, computed, api: api2, popperElm, showPopper, refer
|
|
|
29
38
|
timer: null,
|
|
30
39
|
mounted: false,
|
|
31
40
|
referenceElm,
|
|
41
|
+
xPlacement: "bottom",
|
|
32
42
|
tooltipId: computed(() => api2.computedTooltipId())
|
|
33
43
|
});
|
|
34
44
|
return state;
|
|
35
45
|
};
|
|
36
|
-
const initApi = ({ api: api2, props, state, refs, emit, doDestroy, constants, nextTick, vm }) => {
|
|
46
|
+
const initApi = ({ api: api2, props, state, refs, emit, doDestroy, constants, nextTick, vm, mode }) => {
|
|
37
47
|
Object.assign(api2, {
|
|
38
48
|
state,
|
|
39
|
-
mounted: mounted({ api: api2, state, constants, props, nextTick }),
|
|
49
|
+
mounted: mounted({ api: api2, state, constants, props, nextTick, mode }),
|
|
40
50
|
cleanup: cleanup({ state, props }),
|
|
41
51
|
destroyed: destroyed({ state, api: api2 }),
|
|
42
52
|
doDestroy,
|
|
@@ -81,13 +91,13 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
|
|
|
81
91
|
}
|
|
82
92
|
);
|
|
83
93
|
};
|
|
84
|
-
const renderless = (props, { reactive, computed, watch, toRefs, onBeforeUnmount, onMounted, onUnmounted, onActivated, onDeactivated }, { $prefix, emit, vm, refs, slots, nextTick }) => {
|
|
94
|
+
const renderless = (props, { reactive, computed, watch, toRefs, onBeforeUnmount, onMounted, onUnmounted, onActivated, onDeactivated }, { $prefix, emit, vm, refs, slots, nextTick, mode }) => {
|
|
85
95
|
const api2 = {};
|
|
86
96
|
const constants = { IDPREFIX: `${$prefix.toLowerCase()}-popover` };
|
|
87
97
|
const options = { emit, onBeforeUnmount, nextTick, reactive, props, watch, onDeactivated, refs, slots, toRefs };
|
|
88
98
|
const { showPopper, popperElm, referenceElm, doDestroy } = userPopper(options);
|
|
89
99
|
const state = initState({ reactive, computed, api: api2, popperElm, showPopper, referenceElm });
|
|
90
|
-
initApi({ api: api2, constants, props, state, refs, emit, doDestroy, nextTick, vm });
|
|
100
|
+
initApi({ api: api2, constants, props, state, refs, emit, doDestroy, nextTick, vm, mode });
|
|
91
101
|
onDeactivated(() => {
|
|
92
102
|
api2.destroyed();
|
|
93
103
|
api2.cleanup();
|