@opentiny/vue-renderless 3.14.0 → 3.15.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/LICENSE +22 -0
- package/action-menu/index.js +44 -0
- package/action-menu/vue.js +25 -8
- package/calendar-view/index.js +21 -13
- package/calendar-view/vue.js +6 -3
- package/cascader/index.js +1 -1
- package/cascader-select/index.js +5 -0
- package/cascader-select/vue.js +3 -1
- package/common/bigInt.js +2 -2
- package/common/deps/date-util.js +4 -2
- package/common/deps/vue-popper.js +22 -2
- package/common/index.js +15 -2
- package/common/runtime.js +1 -1
- package/date-range/vue.js +1 -0
- package/date-table/index.js +30 -53
- package/date-table/vue.js +1 -1
- package/dept/index.js +8 -1
- package/dept/vue.js +10 -1
- package/dialog-box/index.js +12 -6
- package/dialog-box/vue.js +1 -1
- package/dropdown-item/mf.js +2 -2
- package/file-upload/index.js +0 -1
- package/grid/utils/dom.js +30 -10
- package/image/index.js +4 -0
- package/image/vue.js +6 -3
- package/image-viewer/vue.js +3 -1
- package/input/index.js +6 -1
- package/input/vue.js +9 -5
- package/modal/index.js +1 -1
- package/numeric/index.js +9 -20
- package/numeric/vue.js +3 -12
- package/option-group/index.js +13 -0
- package/option-group/vue.js +19 -6
- package/package.json +7 -7
- package/picker/index.js +218 -193
- package/picker/vue.js +7 -4
- package/popconfirm/index.js +6 -0
- package/popconfirm/vue.js +11 -3
- package/popeditor/index.js +2 -2
- package/popover/index.js +4 -1
- package/popover/vue.js +2 -1
- package/quarter-panel/index.js +61 -0
- package/quarter-panel/vue.js +46 -0
- package/select/index.js +111 -55
- package/select/vue.js +53 -19
- package/skeleton/vue.js +2 -2
- package/skeleton-item/vue.js +1 -1
- package/statistic/index.js +22 -0
- package/statistic/vue.js +20 -0
- package/tabs/index.js +16 -1
- package/tall-storage/index.js +1 -1
- package/time-picker-mobile/index.js +10 -1
- package/time-picker-mobile/vue.js +5 -3
- package/time-spinner/index.js +52 -1
- package/time-spinner/vue.js +4 -2
- package/timeline-item/index.js +14 -1
- package/timeline-item/vue.js +7 -4
- package/tree/index.js +8 -4
- package/tree/vue.js +3 -3
- package/tree-node/index.js +2 -2
- package/types/action-menu.type.d.ts +40 -12
- package/types/action-sheet.type.d.ts +2 -2
- package/types/alert.type.d.ts +1 -1
- package/types/checkbox.type.d.ts +3 -3
- package/types/collapse.type.d.ts +1 -1
- package/types/date-table.type.d.ts +13 -0
- package/types/dialog-box.type.d.ts +1 -1
- package/types/drawer.type.d.ts +1 -1
- package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-222799ae.d.ts → form.type-8e30b25c.d.ts} +2 -1
- package/types/form.type.d.ts +1 -1
- package/types/image.type.d.ts +4 -0
- package/types/input.type.d.ts +3 -1
- package/types/milestone.type.d.ts +1 -1
- package/types/numeric.type.d.ts +4 -5
- package/types/pager.type.d.ts +1 -1
- package/types/popconfirm.type.d.ts +8 -0
- package/types/popeditor.type.d.ts +1 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +1 -1
- package/types/skeleton.type.d.ts +1 -1
- package/types/statistic.type.d.ts +56 -0
- package/types/steps.type.d.ts +1 -1
- package/types/switch.type.d.ts +3 -3
- package/types/tag.type.d.ts +4 -1
- package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/transfer.type.d.ts +3 -3
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-a29aea50.d.ts → upload-list.type-f34997c8.d.ts} +9 -5
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/user/index.js +1 -1
- package/credit-card/index.js +0 -93
- package/credit-card/vue.js +0 -62
- package/credit-card-form/index.js +0 -112
- package/credit-card-form/vue.js +0 -119
- package/detail-page/index.js +0 -79
- package/detail-page/vue.js +0 -78
- package/slide-bar/index.js +0 -67
- package/slide-bar/vue.js +0 -32
package/dialog-box/index.js
CHANGED
|
@@ -141,25 +141,25 @@ const handleClose = ({
|
|
|
141
141
|
if (!emitEvent(emit, "before-close", api.hide)) {
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
api.hide();
|
|
144
|
+
api.hide(type);
|
|
145
145
|
};
|
|
146
146
|
const hide = ({ api, emit, state, props }) => (cancel) => {
|
|
147
147
|
if (cancel !== false) {
|
|
148
148
|
state.emitter.emit("boxclose", props.isFormReset);
|
|
149
149
|
emit("update:visible", false);
|
|
150
150
|
emit("change", false);
|
|
151
|
-
emit("close");
|
|
151
|
+
emit("close", cancel);
|
|
152
152
|
state.closed = true;
|
|
153
153
|
api.hideScrollbar();
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
const handleConfirm = ({ api, emit }) => () => {
|
|
157
157
|
emit("confirm");
|
|
158
|
-
api.handleClose();
|
|
158
|
+
api.handleClose("confirm");
|
|
159
159
|
};
|
|
160
160
|
const handleCancel = ({ api, emit }) => () => {
|
|
161
161
|
emit("cancel");
|
|
162
|
-
api.handleClose();
|
|
162
|
+
api.handleClose("cancel");
|
|
163
163
|
};
|
|
164
164
|
const updatePopper = ({ api, constants }) => () => {
|
|
165
165
|
api.broadcast(constants.SELECT_DROPDOWN, "updatePopper");
|
|
@@ -193,11 +193,17 @@ const closeAllPopover = (parent) => {
|
|
|
193
193
|
component.state.visible = false;
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
|
-
const handleDrag = ({
|
|
196
|
+
const handleDrag = ({
|
|
197
|
+
parent,
|
|
198
|
+
props,
|
|
199
|
+
state,
|
|
200
|
+
emit,
|
|
201
|
+
vm
|
|
202
|
+
}) => (event) => {
|
|
197
203
|
if (!props.draggable) {
|
|
198
204
|
return;
|
|
199
205
|
}
|
|
200
|
-
let modalBoxElem =
|
|
206
|
+
let modalBoxElem = vm.$refs.dialog;
|
|
201
207
|
event.preventDefault();
|
|
202
208
|
let demMousemove = document.onmousemove;
|
|
203
209
|
let demMouseup = document.onmouseup;
|
package/dialog-box/vue.js
CHANGED
|
@@ -119,7 +119,7 @@ const initApi = ({
|
|
|
119
119
|
afterLeave: afterLeave(emit),
|
|
120
120
|
hideScrollbar: hideScrollbar(lockScrollClass),
|
|
121
121
|
showScrollbar: showScrollbar(lockScrollClass),
|
|
122
|
-
handleDrag: handleDrag({ parent, props, state, emit })
|
|
122
|
+
handleDrag: handleDrag({ parent, props, state, emit, vm })
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
const initWatch = ({ watch, state, api: api2, props }) => {
|
package/dropdown-item/mf.js
CHANGED
|
@@ -43,7 +43,7 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
|
43
43
|
dataStore2.showContent = false;
|
|
44
44
|
dispatch("TinyDropdownMenu", "mouseleave-tips", [dataStore2.showContent, dataStore2.itemLabel]);
|
|
45
45
|
};
|
|
46
|
-
const mouseEnter = ({ vm: vm2, dataStore: dataStore2 }) => (e) => {
|
|
46
|
+
const mouseEnter = ({ vm: vm2, dataStore: dataStore2, props: props2 }) => (e) => {
|
|
47
47
|
const dom = e.target;
|
|
48
48
|
const text = dom.textContent;
|
|
49
49
|
const font = window.getComputedStyle(dom).font;
|
|
@@ -54,7 +54,7 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
|
|
|
54
54
|
tooltip.state.referenceElm = dom;
|
|
55
55
|
tooltip.state.popperElm && (tooltip.state.popperElm.style.display = "none");
|
|
56
56
|
tooltip.doDestroy();
|
|
57
|
-
dataStore2.itemLabel = text;
|
|
57
|
+
dataStore2.itemLabel = props2.tooltipContent || text;
|
|
58
58
|
if (vm2.$refs.level.scrollWidth > vm2.$refs.level.offsetWidth) {
|
|
59
59
|
dataStore2.showContent = true;
|
|
60
60
|
}
|
package/file-upload/index.js
CHANGED
|
@@ -88,7 +88,6 @@ const watchFileList = ({ constants, state, props, api }) => (fileList) => {
|
|
|
88
88
|
let uploadFiles = fileList && fileList.map((file) => {
|
|
89
89
|
file.uid = file.uid || Date.now() + state.tempIndex++;
|
|
90
90
|
file.status = file.status || constants.FILE_STATUS.SUCESS;
|
|
91
|
-
file.type = api.getFileSourceType({ file });
|
|
92
91
|
return file;
|
|
93
92
|
});
|
|
94
93
|
if ([constants.LIST_TYPE.PICTURE_SINGLE, constants.LIST_TYPE.DRAG_SINGLE].includes(props.listType)) {
|
package/grid/utils/dom.js
CHANGED
|
@@ -47,17 +47,34 @@ function getFixedLeft($table, from, column, body, offset) {
|
|
|
47
47
|
}
|
|
48
48
|
return scrollLeft;
|
|
49
49
|
}
|
|
50
|
+
function computeScrollLeft($table, td) {
|
|
51
|
+
const { tableBody } = $table.$refs;
|
|
52
|
+
const { visibleColumn } = $table;
|
|
53
|
+
const { scrollLeft: bodyLeft, clientWidth: bodyWidth } = tableBody.$el;
|
|
54
|
+
let leftWidth = 0;
|
|
55
|
+
let rightWidth = 0;
|
|
56
|
+
visibleColumn.forEach((column) => {
|
|
57
|
+
if (column.fixed === "left") {
|
|
58
|
+
leftWidth += column.renderWidth;
|
|
59
|
+
} else if (column.fixed === "right") {
|
|
60
|
+
rightWidth += column.renderWidth;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const tdLeft = td._accumulateRenderWidth || td.offsetLeft + (td.offsetParent ? td.offsetParent.offsetLeft : 0);
|
|
64
|
+
const tdWidth = td._renderWidth || td.clientWidth;
|
|
65
|
+
let scrollLeft;
|
|
66
|
+
if (tdLeft < bodyLeft + leftWidth) {
|
|
67
|
+
scrollLeft = tdLeft - leftWidth;
|
|
68
|
+
} else if (tdLeft + tdWidth > bodyLeft + bodyWidth - rightWidth) {
|
|
69
|
+
scrollLeft = tdLeft + tdWidth - bodyWidth + rightWidth;
|
|
70
|
+
} else {
|
|
71
|
+
scrollLeft = bodyLeft;
|
|
72
|
+
}
|
|
73
|
+
return scrollLeft;
|
|
74
|
+
}
|
|
50
75
|
function setBodyLeft(body, td, $table, column, move) {
|
|
51
76
|
const { isLeftArrow, isRightArrow, from } = move || {};
|
|
52
|
-
|
|
53
|
-
const bodySrcollLeft = body.scrollLeft;
|
|
54
|
-
const tdOffsetLeft = td.offsetLeft + (td.offsetParent ? td.offsetParent.offsetLeft : 0);
|
|
55
|
-
const tdWidth = td.clientWidth;
|
|
56
|
-
if (tdOffsetLeft < bodySrcollLeft || tdOffsetLeft > bodySrcollLeft + bodyWidth) {
|
|
57
|
-
from !== column && (body.scrollLeft = tdOffsetLeft);
|
|
58
|
-
} else if (tdOffsetLeft + tdWidth >= bodyWidth + bodySrcollLeft) {
|
|
59
|
-
body.scrollLeft = bodySrcollLeft + tdWidth;
|
|
60
|
-
}
|
|
77
|
+
body.scrollLeft = computeScrollLeft($table, td);
|
|
61
78
|
if (from) {
|
|
62
79
|
const direction = isLeftArrow ? "left" : isRightArrow ? "right" : null;
|
|
63
80
|
const fixedDom = $table.elemStore[`${direction}-body-list`];
|
|
@@ -92,7 +109,10 @@ const colToVisible = ($table, column, move) => {
|
|
|
92
109
|
}
|
|
93
110
|
scrollLeft += visibleColumn[index].renderWidth;
|
|
94
111
|
}
|
|
95
|
-
gridbodyEl.scrollLeft =
|
|
112
|
+
gridbodyEl.scrollLeft = computeScrollLeft($table, {
|
|
113
|
+
_accumulateRenderWidth: scrollLeft,
|
|
114
|
+
_renderWidth: column.renderWidth
|
|
115
|
+
});
|
|
96
116
|
}
|
|
97
117
|
});
|
|
98
118
|
};
|
package/image/index.js
CHANGED
|
@@ -42,6 +42,9 @@ const handleError = ({ state, emit }) => (event) => {
|
|
|
42
42
|
state.error = true;
|
|
43
43
|
emit("error", event);
|
|
44
44
|
};
|
|
45
|
+
const handleSwitch = ({ emit }) => (index) => {
|
|
46
|
+
emit("change-index", index);
|
|
47
|
+
};
|
|
45
48
|
const handleLazyLoad = ({ state, api, vm, nextTick }) => () => {
|
|
46
49
|
if (isInContainer(vm.$el, state._scrollContainer)) {
|
|
47
50
|
nextTick(() => state.show = true);
|
|
@@ -125,6 +128,7 @@ export {
|
|
|
125
128
|
handleError,
|
|
126
129
|
handleLazyLoad,
|
|
127
130
|
handleLoad,
|
|
131
|
+
handleSwitch,
|
|
128
132
|
loadImage,
|
|
129
133
|
mounted,
|
|
130
134
|
removeLazyLoadListener
|
package/image/vue.js
CHANGED
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
closeViewer,
|
|
15
15
|
mounted,
|
|
16
16
|
deleteHander,
|
|
17
|
-
filterImageUrl
|
|
17
|
+
filterImageUrl,
|
|
18
|
+
handleSwitch
|
|
18
19
|
} from "./index";
|
|
19
20
|
const api = [
|
|
20
21
|
"state",
|
|
@@ -26,7 +27,8 @@ const api = [
|
|
|
26
27
|
"closeViewer",
|
|
27
28
|
"handleLoad",
|
|
28
29
|
"handleError",
|
|
29
|
-
"deleteHander"
|
|
30
|
+
"deleteHander",
|
|
31
|
+
"handleSwitch"
|
|
30
32
|
];
|
|
31
33
|
const initState = ({
|
|
32
34
|
reactive,
|
|
@@ -78,7 +80,8 @@ const initApi = ({
|
|
|
78
80
|
computedGetImageStyle: computedGetImageStyle({ api: api2, props }),
|
|
79
81
|
addLazyLoadListener: addLazyLoadListener({ api: api2, props, state, vm }),
|
|
80
82
|
deleteHander: deleteHander(emit),
|
|
81
|
-
filterImageUrl: filterImageUrl(props)
|
|
83
|
+
filterImageUrl: filterImageUrl(props),
|
|
84
|
+
handleSwitch: handleSwitch({ emit })
|
|
82
85
|
});
|
|
83
86
|
};
|
|
84
87
|
const initWatch = ({ watch, state, api: api2, props }) => {
|
package/image-viewer/vue.js
CHANGED
|
@@ -164,7 +164,9 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
|
|
|
164
164
|
watch(
|
|
165
165
|
() => state.index,
|
|
166
166
|
(value) => {
|
|
167
|
-
|
|
167
|
+
if (!props.keepStyle) {
|
|
168
|
+
api2.reset();
|
|
169
|
+
}
|
|
168
170
|
props.onSwitch(value);
|
|
169
171
|
},
|
|
170
172
|
{ immediate: true }
|
package/input/index.js
CHANGED
|
@@ -55,7 +55,9 @@ const calcTextareaHeight = ({
|
|
|
55
55
|
api,
|
|
56
56
|
hiddenTextarea,
|
|
57
57
|
props,
|
|
58
|
-
state
|
|
58
|
+
state,
|
|
59
|
+
mode,
|
|
60
|
+
constants
|
|
59
61
|
}) => (targetElement, minRows = 1, maxRows = null) => {
|
|
60
62
|
if (!targetElement) {
|
|
61
63
|
return {
|
|
@@ -72,6 +74,9 @@ const calcTextareaHeight = ({
|
|
|
72
74
|
hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
|
|
73
75
|
let height = hiddenTextarea.scrollHeight;
|
|
74
76
|
const textareaStyle = {};
|
|
77
|
+
if (mode === "mobile") {
|
|
78
|
+
height = Math.max(hiddenTextarea.scrollHeight, constants.TEXTAREA_HEIGHT_MOBILE);
|
|
79
|
+
}
|
|
75
80
|
if (boxSizing === STYLE.ContentBox) {
|
|
76
81
|
height = height - paddingSize;
|
|
77
82
|
}
|
package/input/vue.js
CHANGED
|
@@ -95,8 +95,8 @@ const initState = ({
|
|
|
95
95
|
checkedLabel: "",
|
|
96
96
|
enteredTextarea: false,
|
|
97
97
|
sheetvalue: props.modelValue,
|
|
98
|
-
inputSize: computed(() => props.size || state.formItemSize),
|
|
99
|
-
inputSizeMf: computed(() => props.size || (parent.tinyForm || {}).size),
|
|
98
|
+
inputSize: computed(() => props.size || state.formItemSize || (parent.tinyForm || {}).size),
|
|
99
|
+
inputSizeMf: computed(() => props.size || state.formItemSize || (parent.tinyForm || {}).size),
|
|
100
100
|
showClear: computed(
|
|
101
101
|
() => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
|
|
102
102
|
),
|
|
@@ -179,7 +179,9 @@ const mergeApi = ({
|
|
|
179
179
|
nextTick,
|
|
180
180
|
parent,
|
|
181
181
|
state,
|
|
182
|
-
vm
|
|
182
|
+
vm,
|
|
183
|
+
mode,
|
|
184
|
+
constants
|
|
183
185
|
}) => {
|
|
184
186
|
const { storageData, isMemoryStorage, addMemory, searchMemory, selectedMemory } = storages;
|
|
185
187
|
return Object.assign(api2, {
|
|
@@ -208,7 +210,9 @@ const mergeApi = ({
|
|
|
208
210
|
api: api2,
|
|
209
211
|
hiddenTextarea: null,
|
|
210
212
|
props,
|
|
211
|
-
state
|
|
213
|
+
state,
|
|
214
|
+
mode,
|
|
215
|
+
constants
|
|
212
216
|
}),
|
|
213
217
|
setNativeInputValue: setNativeInputValue({ api: api2, state }),
|
|
214
218
|
handleCompositionEnd: handleCompositionEnd({ api: api2, state }),
|
|
@@ -300,7 +304,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, toRefs, w
|
|
|
300
304
|
initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm, nextTick });
|
|
301
305
|
const storages = useStorageBox({ api: api2, props, reactive, toRefs });
|
|
302
306
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
303
|
-
mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm });
|
|
307
|
+
mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm, mode, constants });
|
|
304
308
|
initWatch({ watch, state, api: api2, props, nextTick, emit, componentName, eventName });
|
|
305
309
|
onMounted(() => {
|
|
306
310
|
api2.setNativeInputValue();
|
package/modal/index.js
CHANGED
package/numeric/index.js
CHANGED
|
@@ -16,14 +16,11 @@ const initService = (service) => {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
const getDecimal = (props) => (value) => getMiniDecimal(value, props.plugin);
|
|
19
|
-
const watchValue = ({ api, props, state
|
|
19
|
+
const watchValue = ({ api, props, state }) => (value) => {
|
|
20
20
|
if (value === state.currentValue) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
api.setCurrentValue(value, props.changeCompat);
|
|
24
|
-
nextTick(() => {
|
|
25
|
-
api.dispatchDisplayedValue();
|
|
26
|
-
});
|
|
27
24
|
};
|
|
28
25
|
const toPrecision = (state) => ({ num, precision }) => {
|
|
29
26
|
if (precision === void 0) {
|
|
@@ -61,7 +58,8 @@ const increase = ({ api, props, state }) => () => {
|
|
|
61
58
|
if (state.inputDisabled || state.maxDisabled) {
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
64
|
-
const
|
|
61
|
+
const userInput = props.stringMode ? state.userInput : Number(state.userInput);
|
|
62
|
+
const value = (props.mouseWheel ? state.displayValue : userInput) || 0;
|
|
65
63
|
if (value.toString().includes("e")) {
|
|
66
64
|
return;
|
|
67
65
|
}
|
|
@@ -79,7 +77,8 @@ const decrease = ({ api, props, state }) => () => {
|
|
|
79
77
|
if (state.inputDisabled || state.minDisabled) {
|
|
80
78
|
return;
|
|
81
79
|
}
|
|
82
|
-
const
|
|
80
|
+
const userInput = props.stringMode ? state.userInput : Number(state.userInput);
|
|
81
|
+
const value = (props.mouseWheel ? state.displayValue : userInput) || 0;
|
|
83
82
|
if (value.toString().includes("e")) {
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
@@ -130,10 +129,10 @@ const focus = (vm) => () => {
|
|
|
130
129
|
vm.$refs.input.focus();
|
|
131
130
|
};
|
|
132
131
|
const getEmitValue = (args) => {
|
|
133
|
-
let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal } = args;
|
|
132
|
+
let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal, emptyValue } = args;
|
|
134
133
|
let { max, min, api, props, format, plugin, stringMode } = args;
|
|
135
134
|
if (!newVal && newVal !== 0) {
|
|
136
|
-
emitValue = allowEmpty ?
|
|
135
|
+
emitValue = allowEmpty ? emptyValue : defaultVal;
|
|
137
136
|
} else if (bigNew.isNaN()) {
|
|
138
137
|
emitValue = oldVal;
|
|
139
138
|
} else {
|
|
@@ -164,7 +163,7 @@ const setCurrentValue = ({
|
|
|
164
163
|
props,
|
|
165
164
|
state
|
|
166
165
|
}) => (newVal, emitChangeFlag = true) => {
|
|
167
|
-
const { max, min, allowEmpty, validateEvent, stringMode, plugin } = props;
|
|
166
|
+
const { max, min, allowEmpty, validateEvent, stringMode, plugin, emptyValue } = props;
|
|
168
167
|
const { format } = state;
|
|
169
168
|
const oldVal = state.currentValue;
|
|
170
169
|
const bigNew = api.getDecimal(newVal);
|
|
@@ -174,7 +173,7 @@ const setCurrentValue = ({
|
|
|
174
173
|
state.userInput = state.currentValue;
|
|
175
174
|
return;
|
|
176
175
|
}
|
|
177
|
-
let args = { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal };
|
|
176
|
+
let args = { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal, emptyValue };
|
|
178
177
|
Object.assign(args, { max, min, api, props, format, plugin, stringMode });
|
|
179
178
|
let ret = getEmitValue(args);
|
|
180
179
|
newVal = ret.newVal;
|
|
@@ -319,14 +318,6 @@ const getUnitPrecision = ({
|
|
|
319
318
|
rounding = isNumber(format.rounding) ? format.rounding : serFra.rounding;
|
|
320
319
|
return __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, defaultFmt), { fraction, rounding }), serFmt), format);
|
|
321
320
|
};
|
|
322
|
-
const dispatchDisplayedValue = ({ state, api, dispatch }) => () => {
|
|
323
|
-
if (state.isDisplayOnly) {
|
|
324
|
-
dispatch("FormItem", "displayed-value-changed", { type: "numeric", val: api.getDisplayedValue() });
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
const getDisplayedValue = ({ state, props }) => () => {
|
|
328
|
-
return state.displayValue || state.displayValue === 0 ? state.displayValue + " " + (props.unit || "") : "-";
|
|
329
|
-
};
|
|
330
321
|
const getDisplayOnlyText = ({ parent, state, props }) => () => {
|
|
331
322
|
const showEmptyValue = props.showEmptyValue || (parent.tinyForm || {}).showEmptyValue;
|
|
332
323
|
if (showEmptyValue) {
|
|
@@ -354,13 +345,11 @@ const handleChange = ({ state, emit }) => () => {
|
|
|
354
345
|
};
|
|
355
346
|
export {
|
|
356
347
|
decrease,
|
|
357
|
-
dispatchDisplayedValue,
|
|
358
348
|
displayValue,
|
|
359
349
|
filterValue,
|
|
360
350
|
focus,
|
|
361
351
|
getDecimal,
|
|
362
352
|
getDisplayOnlyText,
|
|
363
|
-
getDisplayedValue,
|
|
364
353
|
getNumPecision,
|
|
365
354
|
getPrecision,
|
|
366
355
|
getUnitPrecision,
|
package/numeric/vue.js
CHANGED
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
getDecimal,
|
|
24
24
|
unmounted,
|
|
25
25
|
initService,
|
|
26
|
-
dispatchDisplayedValue,
|
|
27
|
-
getDisplayedValue,
|
|
28
26
|
getDisplayOnlyText,
|
|
29
27
|
filterValue,
|
|
30
28
|
handleClear,
|
|
@@ -112,10 +110,8 @@ const initApi = ({
|
|
|
112
110
|
handleInputChange: handleInputChange({ api: api2, state, props }),
|
|
113
111
|
mouseEvent: mouseEvent({ api: api2, props, state }),
|
|
114
112
|
handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
|
|
115
|
-
watchValue: watchValue({ api: api2, props, state
|
|
113
|
+
watchValue: watchValue({ api: api2, props, state }),
|
|
116
114
|
setCurrentValue: setCurrentValue({ api: api2, constants, dispatch, emit, props, state }),
|
|
117
|
-
dispatchDisplayedValue: dispatchDisplayedValue({ api: api2, state, dispatch }),
|
|
118
|
-
getDisplayedValue: getDisplayedValue({ state, props }),
|
|
119
115
|
getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
|
|
120
116
|
filterValue: filterValue({ state }),
|
|
121
117
|
handleClear: handleClear({ state, emit }),
|
|
@@ -124,7 +120,6 @@ const initApi = ({
|
|
|
124
120
|
api2.getDecimal(0);
|
|
125
121
|
};
|
|
126
122
|
const initWatch = ({
|
|
127
|
-
state,
|
|
128
123
|
watch,
|
|
129
124
|
props,
|
|
130
125
|
api: api2
|
|
@@ -139,7 +134,6 @@ const initWatch = ({
|
|
|
139
134
|
{ immediate: true }
|
|
140
135
|
);
|
|
141
136
|
watch(() => props.modelValue, api2.watchValue, { immediate: true });
|
|
142
|
-
watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
|
|
143
137
|
};
|
|
144
138
|
const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, vm, constants, dispatch, service, nextTick }) => {
|
|
145
139
|
const api2 = {};
|
|
@@ -147,11 +141,8 @@ const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reacti
|
|
|
147
141
|
const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
|
|
148
142
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
149
143
|
initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
|
|
150
|
-
initWatch({
|
|
151
|
-
onMounted(
|
|
152
|
-
api2.dispatchDisplayedValue();
|
|
153
|
-
api2.mounted();
|
|
154
|
-
});
|
|
144
|
+
initWatch({ watch, props, api: api2 });
|
|
145
|
+
onMounted(api2.mounted);
|
|
155
146
|
onUpdated(api2.updated);
|
|
156
147
|
onUnmounted(api2.unmounted);
|
|
157
148
|
return api2;
|
package/option-group/index.js
CHANGED
|
@@ -10,6 +10,19 @@ const queryChange = ({ select, state, vm }) => () => {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
+
const observeCallback = ({ state, api }) => (mutationsList) => {
|
|
14
|
+
for (let mutation of mutationsList) {
|
|
15
|
+
if (mutation.type === "childList") {
|
|
16
|
+
if (state.timer) {
|
|
17
|
+
clearTimeout(state.timer);
|
|
18
|
+
}
|
|
19
|
+
state.timer = setTimeout(() => {
|
|
20
|
+
api.queryChange();
|
|
21
|
+
}, 100);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
13
25
|
export {
|
|
26
|
+
observeCallback,
|
|
14
27
|
queryChange
|
|
15
28
|
};
|
package/option-group/vue.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { queryChange } from "./index";
|
|
2
|
+
import { queryChange, observeCallback } from "./index";
|
|
3
3
|
const api = ["state", "queryChange"];
|
|
4
|
-
const renderless = (props, { onMounted, reactive, watch, inject }, { broadcast, vm }) => {
|
|
4
|
+
const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject }, { broadcast, vm }) => {
|
|
5
5
|
const select = inject("select");
|
|
6
6
|
const constants = select._constants;
|
|
7
7
|
const state = reactive({
|
|
8
|
-
visible: true
|
|
8
|
+
visible: true,
|
|
9
|
+
timer: null
|
|
9
10
|
});
|
|
10
|
-
const api2 = {
|
|
11
|
+
const api2 = {};
|
|
12
|
+
Object.assign(api2, {
|
|
11
13
|
state,
|
|
12
|
-
queryChange: queryChange({ select, state, vm })
|
|
13
|
-
|
|
14
|
+
queryChange: queryChange({ select, state, vm }),
|
|
15
|
+
observeCallback: observeCallback({ state, api: api2 })
|
|
16
|
+
});
|
|
14
17
|
watch(
|
|
15
18
|
() => props.disabled,
|
|
16
19
|
(value) => {
|
|
@@ -19,11 +22,21 @@ const renderless = (props, { onMounted, reactive, watch, inject }, { broadcast,
|
|
|
19
22
|
{ immediate: true }
|
|
20
23
|
);
|
|
21
24
|
onMounted(() => {
|
|
25
|
+
if (select.filterable) {
|
|
26
|
+
const config = { attributes: false, childList: true, subtree: false };
|
|
27
|
+
api2.observer = new MutationObserver(api2.observeCallback);
|
|
28
|
+
if (vm.$refs.selectGroup) {
|
|
29
|
+
api2.observer.observe(vm.$refs.selectGroup, config);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
22
32
|
if (props.disabled) {
|
|
23
33
|
broadcast(constants.COMPONENT_NAME.Option, constants.EVENT_NAME.handleGroupDisabled, props.disabled);
|
|
24
34
|
}
|
|
25
35
|
select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
|
|
26
36
|
});
|
|
37
|
+
onBeforeUnmount(() => {
|
|
38
|
+
api2.observer && api2.observer.disconnect();
|
|
39
|
+
});
|
|
27
40
|
return api2;
|
|
28
41
|
};
|
|
29
42
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.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": [
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
"url": "https://github.com/opentiny/tiny-vue/issues"
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsup",
|
|
29
|
-
"build:fast": "npm run build && npm run release",
|
|
30
|
-
"postversion": "pnpm build",
|
|
31
|
-
"release": "esno ./scripts/postbuild.ts && shx cp README.md dist"
|
|
32
|
-
},
|
|
33
27
|
"dependencies": {
|
|
34
28
|
"xss": "1.0.11",
|
|
35
29
|
"color": "4.2.3"
|
|
@@ -37,5 +31,11 @@
|
|
|
37
31
|
"devDependencies": {
|
|
38
32
|
"esno": "^0.16.3",
|
|
39
33
|
"tsup": "7.2.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
37
|
+
"build:fast": "npm run build && npm run release",
|
|
38
|
+
"postversion": "pnpm build",
|
|
39
|
+
"release": "esno ./scripts/postbuild.ts && shx cp README.md dist"
|
|
40
40
|
}
|
|
41
41
|
}
|