@opentiny/vue-renderless 3.13.1 → 3.14.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 +20 -13
- package/action-sheet/vue.js +8 -7
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +18 -4
- package/calendar-view/index.js +5 -1
- package/calendar-view/vue.js +16 -3
- package/card-group/vue.js +4 -2
- package/cascader/index.js +86 -34
- package/cascader/vue.js +61 -20
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +36 -23
- package/cascader-mobile/vue.js +6 -0
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +18 -1
- package/checkbox/vue.js +15 -7
- package/checkbox-group/vue.js +1 -0
- package/col/vue.js +1 -1
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/date.js +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +44 -11
- package/common/deps/resize-event.js +1 -0
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +2 -2
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +38 -20
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +2 -2
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +14 -6
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +46 -14
- package/dialog-box/vue.js +30 -7
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +27 -5
- package/drawer/vue.js +14 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +20 -7
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +68 -18
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +8 -0
- package/form-item/index.js +5 -5
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/plugins/export.js +5 -2
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -1
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +81 -20
- package/input/vue.js +44 -18
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/link/vue.js +3 -1
- package/loading/index.js +2 -2
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/menu/index.js +15 -2
- package/menu/vue.js +22 -17
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/modal/index.js +44 -4
- package/modal/vue.js +18 -4
- package/multi-select/index.js +186 -11
- package/multi-select/vue.js +60 -15
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +46 -12
- package/numeric/vue.js +44 -19
- package/option/index.js +27 -9
- package/option/vue.js +37 -21
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +18 -4
- package/pager/vue.js +16 -5
- package/picker/index.js +258 -49
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/vue.js +3 -0
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +71 -32
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +13 -13
- package/pull-refresh/vue.js +5 -4
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/rich-text/clipboard.js +54 -0
- package/rich-text/index.js +192 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +382 -0
- package/rich-text/vue.js +102 -0
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +9 -9
- package/search/vue.js +8 -6
- package/select/index.js +457 -389
- package/select/vue.js +257 -161
- package/select-dropdown/index.js +61 -3
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/selected-box/index.js +2 -0
- package/selected-box/vue.js +6 -3
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +70 -17
- package/slider/vue.js +16 -7
- package/split/index.js +5 -3
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +30 -5
- package/tab-nav/vue.js +16 -4
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +16 -4
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tabs-mf/wheel.js +1 -0
- package/tag/index.js +1 -1
- package/tag-group/index.js +2 -1
- package/time/index.js +5 -2
- package/time/vue.js +1 -1
- package/time-line/index.js +3 -3
- package/time-line/vue.js +2 -2
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +6 -3
- package/tooltip/vue.js +4 -4
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +31 -5
- package/tree-menu/vue.js +28 -15
- package/tree-node/index.js +18 -18
- package/tree-node/vue.js +6 -5
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +1 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button-group.type.d.ts +3 -3
- package/types/button.type.d.ts +4 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +329 -1
- package/types/checkbox.type.d.ts +9 -3
- package/types/collapse.type.d.ts +20 -3
- package/types/date-picker.type.d.ts +37 -0
- package/types/dialog-box.type.d.ts +13 -3
- package/types/drawer.type.d.ts +133 -1
- package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +1 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +123 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-222799ae.d.ts} +5 -2
- package/types/form.type.d.ts +1 -1
- package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
- package/types/input.type.d.ts +1 -5
- package/types/ip-address.type.d.ts +160 -1
- package/types/link.type.d.ts +6 -3
- package/types/loading.type.d.ts +7 -0
- package/types/milestone.type.d.ts +1 -1
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +29 -2
- package/types/numeric.type.d.ts +41 -10
- package/types/pager.type.d.ts +13 -1
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +5 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +3 -1
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +49 -10
- package/types/steps.type.d.ts +15 -4
- package/types/switch.type.d.ts +3 -3
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-nav.type.d.ts +7 -2
- package/types/tabs.type.d.ts +9 -1
- package/types/tag-group.type.d.ts +64 -1
- package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/tooltip.type.d.ts +2 -2
- package/types/transfer.type.d.ts +185 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-a29aea50.d.ts} +31 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +146 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +64 -34
- package/upload/vue.js +9 -5
- package/upload-dragger/index.js +22 -20
- package/upload-list/index.js +24 -18
- package/upload-list/vue.js +9 -4
- package/user/index.js +34 -25
- package/user/vue.js +1 -1
- package/user-head/index.js +3 -3
- package/watermark/index.js +11 -0
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
- package/common/deps/modal-queue.js +0 -6
- package/common/deps/requestAnimationFrame.js +0 -25
package/cascader/index.js
CHANGED
|
@@ -50,12 +50,27 @@ const watchValue = ({ api, state }) => (value) => {
|
|
|
50
50
|
setTimeout(api.computePresentContent);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
const watchCheckedValue = ({
|
|
53
|
+
const watchCheckedValue = ({
|
|
54
|
+
nextTick,
|
|
55
|
+
constants,
|
|
56
|
+
dispatch,
|
|
57
|
+
api,
|
|
58
|
+
emit,
|
|
59
|
+
state
|
|
60
|
+
}) => (value) => {
|
|
61
|
+
state.presentText = state.presentTags.length ? "" : null;
|
|
54
62
|
const { checkStrictly, multiple } = state.config;
|
|
55
|
-
|
|
63
|
+
nextTick(() => {
|
|
64
|
+
api.computePresentContent();
|
|
65
|
+
});
|
|
56
66
|
if (!multiple && !checkStrictly && state.dropDownVisible) {
|
|
57
67
|
api.toggleDropDownVisible(false);
|
|
58
68
|
}
|
|
69
|
+
nextTick(() => {
|
|
70
|
+
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormChange, [
|
|
71
|
+
state.multiple ? state.presentText : state.inputValue
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
59
74
|
emit("update:modelValue", value);
|
|
60
75
|
emit("change", value);
|
|
61
76
|
setTimeout(api.updateStyle);
|
|
@@ -85,10 +100,16 @@ const isEmpty = (val) => {
|
|
|
85
100
|
}
|
|
86
101
|
return false;
|
|
87
102
|
};
|
|
88
|
-
const selfMounted = ({
|
|
89
|
-
|
|
103
|
+
const selfMounted = ({
|
|
104
|
+
api,
|
|
105
|
+
parent,
|
|
106
|
+
props,
|
|
107
|
+
vm,
|
|
108
|
+
state
|
|
109
|
+
}) => () => {
|
|
110
|
+
const { input } = vm.$refs;
|
|
90
111
|
const inputSizeMap = { medium: 36, small: 32, mini: 28 };
|
|
91
|
-
input && (input.$parent.popperElm = refs.popper);
|
|
112
|
+
input && (input.$parent.popperElm = vm.$refs.popper);
|
|
92
113
|
if (input && input.$el) {
|
|
93
114
|
state.inputInitialHeight = input.$el.offsetHeight || inputSizeMap[state.realSize] || 30;
|
|
94
115
|
}
|
|
@@ -111,11 +132,16 @@ const selfMounted = ({ api, parent, props, refs, state }) => () => {
|
|
|
111
132
|
});
|
|
112
133
|
addResizeListener(parent.$el, api.updateStyle);
|
|
113
134
|
};
|
|
114
|
-
const toggleDropDownVisible = ({
|
|
135
|
+
const toggleDropDownVisible = ({
|
|
136
|
+
emit,
|
|
137
|
+
vm,
|
|
138
|
+
state,
|
|
139
|
+
updatePopper
|
|
140
|
+
}) => (visible) => {
|
|
115
141
|
if (state.isDisabled) {
|
|
116
142
|
return;
|
|
117
143
|
}
|
|
118
|
-
const { input } = refs;
|
|
144
|
+
const { input } = vm.$refs;
|
|
119
145
|
visible = !isNull(visible) ? visible : !state.dropDownVisible;
|
|
120
146
|
if (visible !== state.dropDownVisible) {
|
|
121
147
|
state.dropDownVisible = visible;
|
|
@@ -152,21 +178,18 @@ const handleKeyDown = ({ api }) => (event) => {
|
|
|
152
178
|
const handleFocus = (emit) => (e) => {
|
|
153
179
|
emit("focus", e);
|
|
154
180
|
};
|
|
155
|
-
const handleBlur = ({
|
|
181
|
+
const handleBlur = ({ emit, api, props }) => (e) => {
|
|
156
182
|
if (props.filterable) {
|
|
157
183
|
api.computePresentContent();
|
|
158
184
|
}
|
|
159
|
-
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
|
|
160
|
-
state.multiple ? state.presentText : state.inputValue
|
|
161
|
-
]);
|
|
162
185
|
emit("blur", e);
|
|
163
186
|
};
|
|
164
|
-
const handleInput = ({ api, state,
|
|
187
|
+
const handleInput = ({ api, state, vm }) => (val, event) => {
|
|
165
188
|
event = event || window.event;
|
|
166
189
|
if (!event) {
|
|
167
190
|
return;
|
|
168
191
|
}
|
|
169
|
-
const reference = refs.reference;
|
|
192
|
+
const reference = vm.$refs.reference;
|
|
170
193
|
const key = "init-flag";
|
|
171
194
|
const value = "true";
|
|
172
195
|
const isIE = browser.name === "ie";
|
|
@@ -185,7 +208,7 @@ const handleInput = ({ api, state, refs }) => (val, event) => {
|
|
|
185
208
|
state.filtering = false;
|
|
186
209
|
}
|
|
187
210
|
};
|
|
188
|
-
const handleClear = (state) => () => {
|
|
211
|
+
const handleClear = (state) => (_event) => {
|
|
189
212
|
state.presentText = "";
|
|
190
213
|
state.panel.clearCheckedNodes();
|
|
191
214
|
};
|
|
@@ -194,13 +217,13 @@ const handleExpandChange = ({ constants, dispatch, emit, nextTick, state, update
|
|
|
194
217
|
dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
|
|
195
218
|
state.multiple ? state.presentText : state.inputValue
|
|
196
219
|
]);
|
|
197
|
-
updatePopper(state.panel.$parent);
|
|
220
|
+
updatePopper(state.panel.$parent.$el);
|
|
198
221
|
});
|
|
199
222
|
emit("expand-change", value);
|
|
200
223
|
emit("active-item-change", value);
|
|
201
224
|
};
|
|
202
|
-
const focusFirstNode = ({
|
|
203
|
-
const { popper, suggestionPanel } = refs;
|
|
225
|
+
const focusFirstNode = ({ vm, state }) => () => {
|
|
226
|
+
const { popper, suggestionPanel } = vm.$refs;
|
|
204
227
|
let firstNode = null;
|
|
205
228
|
if (state.filtering && suggestionPanel) {
|
|
206
229
|
firstNode = suggestionPanel.$el.querySelector(CASCADER.SugItem);
|
|
@@ -246,13 +269,19 @@ const computePresentTags = ({ api, props, state }) => () => {
|
|
|
246
269
|
}
|
|
247
270
|
state.checkedNodes = checkedNodes;
|
|
248
271
|
state.presentTags = tags;
|
|
272
|
+
state.inputValue = null;
|
|
273
|
+
state.presentText = null;
|
|
249
274
|
if (props.hoverExpand) {
|
|
250
275
|
api.calcCollapseTags();
|
|
251
276
|
}
|
|
252
277
|
};
|
|
253
|
-
const calcCollapseTags = ({
|
|
278
|
+
const calcCollapseTags = ({
|
|
279
|
+
state,
|
|
280
|
+
vm,
|
|
281
|
+
nextTick
|
|
282
|
+
}) => () => {
|
|
254
283
|
nextTick(() => {
|
|
255
|
-
const content = refs["tags-content"];
|
|
284
|
+
const content = vm.$refs["tags-content"];
|
|
256
285
|
if (state.inputHover || state.dropDownVisible) {
|
|
257
286
|
return state.isHidden = true;
|
|
258
287
|
}
|
|
@@ -292,17 +321,17 @@ const calcCollapseTags = ({ state, refs, nextTick }) => () => {
|
|
|
292
321
|
}
|
|
293
322
|
});
|
|
294
323
|
};
|
|
295
|
-
const watchInputHover = ({
|
|
324
|
+
const watchInputHover = ({ vm }) => (newVal) => {
|
|
296
325
|
const [inputHover, dropDownVisible] = newVal;
|
|
297
326
|
if (!inputHover && !dropDownVisible) {
|
|
298
|
-
const content = refs["tags-content"];
|
|
327
|
+
const content = vm.$refs["tags-content"];
|
|
299
328
|
content && content.scrollTo({ top: 0, left: 0 });
|
|
300
329
|
}
|
|
301
330
|
};
|
|
302
|
-
const handleMouseenter = ({
|
|
331
|
+
const handleMouseenter = ({ vm, state }) => ($event) => {
|
|
303
332
|
const dom = $event.target;
|
|
304
333
|
const textNode = dom && dom.querySelector("span");
|
|
305
|
-
const { tooltip } = refs;
|
|
334
|
+
const { tooltip } = vm.$refs;
|
|
306
335
|
if (textNode && tooltip && textNode.scrollWidth > textNode.offsetWidth) {
|
|
307
336
|
const text = textNode.textContent;
|
|
308
337
|
tooltip.state.referenceElm = dom;
|
|
@@ -314,7 +343,12 @@ const handleMouseenter = ({ refs, state }) => ($event) => {
|
|
|
314
343
|
}
|
|
315
344
|
};
|
|
316
345
|
const handleMouseleave = ({ state }) => () => state.tooltipVisible = false;
|
|
317
|
-
const getSuggestions = ({
|
|
346
|
+
const getSuggestions = ({
|
|
347
|
+
nextTick,
|
|
348
|
+
props,
|
|
349
|
+
state,
|
|
350
|
+
updatePopper
|
|
351
|
+
}) => () => {
|
|
318
352
|
let filterMethod = null;
|
|
319
353
|
if (!(props.filterMethod && typeof props.filterMethod === "function")) {
|
|
320
354
|
filterMethod = (node, keyword) => ~node.text.indexOf(keyword);
|
|
@@ -325,8 +359,9 @@ const getSuggestions = ({ nextTick, props, state, updatePopper }) => () => {
|
|
|
325
359
|
if (node.isDisabled) {
|
|
326
360
|
return false;
|
|
327
361
|
}
|
|
362
|
+
;
|
|
328
363
|
node.text = node.getText(props.showAllLevels, props.separator) || "";
|
|
329
|
-
return filterMethod(node, state.inputValue);
|
|
364
|
+
return filterMethod == null ? void 0 : filterMethod(node, state.inputValue);
|
|
330
365
|
});
|
|
331
366
|
if (state.multiple) {
|
|
332
367
|
state.presentTags.forEach((tag) => {
|
|
@@ -385,14 +420,19 @@ const handleSuggestionClick = ({ api, state }) => (index) => {
|
|
|
385
420
|
api.toggleDropDownVisible(false);
|
|
386
421
|
}
|
|
387
422
|
};
|
|
388
|
-
const deleteTag = ({
|
|
423
|
+
const deleteTag = ({
|
|
424
|
+
emit,
|
|
425
|
+
state,
|
|
426
|
+
api
|
|
427
|
+
}) => (index) => {
|
|
389
428
|
const val = state.checkedValue[index];
|
|
390
429
|
state.checkedValue = state.checkedValue.filter((n, i) => i !== index);
|
|
430
|
+
api.handleMouseleave();
|
|
391
431
|
emit("remove-tag", val);
|
|
392
432
|
};
|
|
393
|
-
const updateStyle = ({ parent,
|
|
433
|
+
const updateStyle = ({ parent, vm, state, updatePopper, nextTick, props }) => () => {
|
|
394
434
|
const $el = parent.$el;
|
|
395
|
-
const { suggestionPanel } = refs;
|
|
435
|
+
const { suggestionPanel } = vm.$refs;
|
|
396
436
|
const inputInner = $el.querySelector(CASCADER.InputClass);
|
|
397
437
|
if (!inputInner) {
|
|
398
438
|
return;
|
|
@@ -416,21 +456,28 @@ const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) =>
|
|
|
416
456
|
updatePopper();
|
|
417
457
|
} else {
|
|
418
458
|
nextTick(() => {
|
|
419
|
-
if (state.
|
|
459
|
+
if (state.multiple && state.isDisplayOnly) {
|
|
420
460
|
inputInner.style.height = "auto";
|
|
421
461
|
}
|
|
422
462
|
});
|
|
423
463
|
}
|
|
424
464
|
};
|
|
425
465
|
const getCheckedNodes = (state) => (leafOnly) => state.panel.getCheckedNodes(leafOnly, state.checkedValue);
|
|
426
|
-
const setInputHeightToTag = ({
|
|
466
|
+
const setInputHeightToTag = ({
|
|
467
|
+
nextTick,
|
|
468
|
+
parent,
|
|
469
|
+
state
|
|
470
|
+
}) => () => {
|
|
427
471
|
nextTick(() => {
|
|
472
|
+
var _a;
|
|
428
473
|
const parentEl = parent.$el;
|
|
429
|
-
const height = parentEl.querySelector(CASCADER.TagClass).offsetHeight + 6 + "px";
|
|
474
|
+
const height = ((_a = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.TagClass)) == null ? void 0 : _a.offsetHeight) + 6 + "px";
|
|
430
475
|
if (!state.isDisplayOnly) {
|
|
431
|
-
parentEl.querySelector(CASCADER.InputClass)
|
|
476
|
+
const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
|
|
477
|
+
inputDom && (inputDom.style.height = height);
|
|
432
478
|
} else {
|
|
433
|
-
parentEl.querySelector(CASCADER.InputClass)
|
|
479
|
+
const inputDom = parentEl == null ? void 0 : parentEl.querySelector(CASCADER.InputClass);
|
|
480
|
+
inputDom && (inputDom.style.height = "auto");
|
|
434
481
|
}
|
|
435
482
|
});
|
|
436
483
|
};
|
|
@@ -450,7 +497,12 @@ const handleBeforeUpdate = ({ props, api, state }) => () => {
|
|
|
450
497
|
api.computePresentContent();
|
|
451
498
|
}
|
|
452
499
|
};
|
|
453
|
-
const showPlaceholder = ({
|
|
500
|
+
const showPlaceholder = ({
|
|
501
|
+
props,
|
|
502
|
+
state,
|
|
503
|
+
t,
|
|
504
|
+
constants
|
|
505
|
+
}) => () => {
|
|
454
506
|
let placeholder = null;
|
|
455
507
|
placeholder = state.multiple && state.presentTags.length || state.present ? "" : props.placeholder || t(constants.placeholder);
|
|
456
508
|
return placeholder;
|
package/cascader/vue.js
CHANGED
|
@@ -58,7 +58,17 @@ const api = [
|
|
|
58
58
|
"handleMouseenter",
|
|
59
59
|
"handleMouseleave"
|
|
60
60
|
];
|
|
61
|
-
const initState = ({
|
|
61
|
+
const initState = ({
|
|
62
|
+
reactive,
|
|
63
|
+
props,
|
|
64
|
+
computed,
|
|
65
|
+
parent,
|
|
66
|
+
api: api2,
|
|
67
|
+
t,
|
|
68
|
+
constants,
|
|
69
|
+
vm,
|
|
70
|
+
inject
|
|
71
|
+
}) => {
|
|
62
72
|
const state = reactive({
|
|
63
73
|
showAutoWidth: inject("showAutoWidth", null),
|
|
64
74
|
/** popper 元素是否显示。 它是通过v-show 绑定到页面上,造成隐藏时,popperJs并没有destory,有一定的性能影响 */
|
|
@@ -85,7 +95,7 @@ const initState = ({ reactive, props, computed, parent, api: api2, t, constants,
|
|
|
85
95
|
leafOnly: computed(() => !state.config.checkStrictly),
|
|
86
96
|
readonly: computed(() => !props.filterable || state.multiple),
|
|
87
97
|
clearBtnVisible: computed(() => api2.computClearVisible()),
|
|
88
|
-
panel: computed(() => refs.panel),
|
|
98
|
+
panel: computed(() => vm.$refs.panel),
|
|
89
99
|
placeholder: computed(() => props.placeholder || t(constants.placeholder)),
|
|
90
100
|
inputValues: computed(() => state.multiple ? state.presentText : state.inputValue),
|
|
91
101
|
collapseTagsLength: 0,
|
|
@@ -95,18 +105,30 @@ const initState = ({ reactive, props, computed, parent, api: api2, t, constants,
|
|
|
95
105
|
});
|
|
96
106
|
return state;
|
|
97
107
|
};
|
|
98
|
-
const initApi = ({
|
|
108
|
+
const initApi = ({
|
|
109
|
+
api: api2,
|
|
110
|
+
state,
|
|
111
|
+
constants,
|
|
112
|
+
dispatch,
|
|
113
|
+
emit,
|
|
114
|
+
vm,
|
|
115
|
+
props,
|
|
116
|
+
updatePopper,
|
|
117
|
+
nextTick,
|
|
118
|
+
parent,
|
|
119
|
+
t
|
|
120
|
+
}) => {
|
|
99
121
|
Object.assign(api2, {
|
|
100
122
|
state,
|
|
101
123
|
handleFocus: handleFocus(emit),
|
|
102
124
|
handleClear: handleClear(state),
|
|
103
125
|
getCheckedNodes: getCheckedNodes(state),
|
|
104
|
-
deleteTag: deleteTag({ emit, state }),
|
|
126
|
+
deleteTag: deleteTag({ emit, state, api: api2 }),
|
|
105
127
|
handleDropdownLeave: handleDropdownLeave(state),
|
|
106
|
-
focusFirstNode: focusFirstNode({
|
|
128
|
+
focusFirstNode: focusFirstNode({ vm, state }),
|
|
107
129
|
computClearVisible: computClearVisible({ props, state }),
|
|
108
130
|
showPlaceholder: showPlaceholder({ props, state, t, constants }),
|
|
109
|
-
updateStyle: updateStyle({ parent,
|
|
131
|
+
updateStyle: updateStyle({ parent, vm, state, updatePopper, nextTick, props }),
|
|
110
132
|
getSuggestions: getSuggestions({ nextTick, props, state, updatePopper }),
|
|
111
133
|
handleExpandChange: handleExpandChange({ constants, emit, dispatch, nextTick, state, updatePopper }),
|
|
112
134
|
getConfig: getConfig({ parent, props }),
|
|
@@ -115,23 +137,30 @@ const initApi = ({ api: api2, state, constants, dispatch, emit, refs, props, upd
|
|
|
115
137
|
handleDelete: handleDelete({ api: api2, state }),
|
|
116
138
|
computePresentText: computePresentText({ props, state }),
|
|
117
139
|
handleSuggestionKeyDown: handleSuggestionKeyDown({ api: api2 }),
|
|
118
|
-
handleInput: handleInput({ api: api2, state,
|
|
140
|
+
handleInput: handleInput({ api: api2, state, vm }),
|
|
119
141
|
handleKeyDown: handleKeyDown({ api: api2 }),
|
|
120
142
|
watchValue: watchValue({ api: api2, state }),
|
|
121
143
|
computePresentTags: computePresentTags({ api: api2, props, state }),
|
|
122
144
|
computePresentContent: computePresentContent({ api: api2, state }),
|
|
123
|
-
watchCheckedValue: watchCheckedValue({ api: api2, emit, state }),
|
|
124
|
-
toggleDropDownVisible: toggleDropDownVisible({ emit,
|
|
125
|
-
selfMounted: selfMounted({ api: api2, parent, props,
|
|
145
|
+
watchCheckedValue: watchCheckedValue({ constants, dispatch, api: api2, nextTick, emit, state }),
|
|
146
|
+
toggleDropDownVisible: toggleDropDownVisible({ emit, vm, state, updatePopper }),
|
|
147
|
+
selfMounted: selfMounted({ api: api2, parent, props, vm, state }),
|
|
126
148
|
handleBeforeUpdate: handleBeforeUpdate({ props, api: api2, state }),
|
|
127
|
-
handleBlur: handleBlur({
|
|
128
|
-
calcCollapseTags: calcCollapseTags({
|
|
129
|
-
watchInputHover: watchInputHover({
|
|
130
|
-
handleMouseenter: handleMouseenter({
|
|
149
|
+
handleBlur: handleBlur({ emit, api: api2, props }),
|
|
150
|
+
calcCollapseTags: calcCollapseTags({ vm, state, nextTick }),
|
|
151
|
+
watchInputHover: watchInputHover({ vm }),
|
|
152
|
+
handleMouseenter: handleMouseenter({ vm, state }),
|
|
131
153
|
handleMouseleave: handleMouseleave({ state })
|
|
132
154
|
});
|
|
133
155
|
};
|
|
134
|
-
const initWatch = ({
|
|
156
|
+
const initWatch = ({
|
|
157
|
+
watch,
|
|
158
|
+
state,
|
|
159
|
+
api: api2,
|
|
160
|
+
props,
|
|
161
|
+
nextTick,
|
|
162
|
+
updatePopper
|
|
163
|
+
}) => {
|
|
135
164
|
watch(() => state.disabled, api2.computePresentContent);
|
|
136
165
|
watch(() => props.modelValue, api2.watchValue);
|
|
137
166
|
watch(() => state.checkedValue, api2.watchCheckedValue);
|
|
@@ -165,7 +194,18 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, updatePopper }) =
|
|
|
165
194
|
);
|
|
166
195
|
watch([() => state.inputHover, () => state.dropDownVisible], api2.watchInputHover);
|
|
167
196
|
};
|
|
168
|
-
const renderless = (props, {
|
|
197
|
+
const renderless = (props, {
|
|
198
|
+
computed,
|
|
199
|
+
onMounted,
|
|
200
|
+
onBeforeUnmount,
|
|
201
|
+
onDeactivated,
|
|
202
|
+
onUpdated,
|
|
203
|
+
onBeforeUpdate,
|
|
204
|
+
reactive,
|
|
205
|
+
toRefs,
|
|
206
|
+
watch,
|
|
207
|
+
inject
|
|
208
|
+
}, { t, emit, nextTick, constants, parent, slots, dispatch, vm }) => {
|
|
169
209
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
170
210
|
const { updatePopper } = userPopper({
|
|
171
211
|
reactive,
|
|
@@ -174,26 +214,27 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, onDeactivated
|
|
|
174
214
|
props: __spreadProps(__spreadValues({}, props), {
|
|
175
215
|
placement: DATEPICKER.PlacementMap.left,
|
|
176
216
|
popperOptions: { boundariesPadding: 0, gpuAcceleration: false },
|
|
177
|
-
visibleArrow:
|
|
217
|
+
visibleArrow: false,
|
|
178
218
|
offset: 0,
|
|
179
219
|
boundariesPadding: 5,
|
|
180
220
|
arrowOffset: 35
|
|
181
221
|
}),
|
|
182
222
|
toRefs,
|
|
183
|
-
|
|
223
|
+
vm,
|
|
184
224
|
slots,
|
|
185
225
|
nextTick,
|
|
186
226
|
onBeforeUnmount,
|
|
187
227
|
onDeactivated
|
|
188
228
|
});
|
|
189
229
|
const api2 = {};
|
|
190
|
-
const state = initState({ reactive, props, computed, parent, api: api2, t, constants,
|
|
191
|
-
initApi({ api: api2, state, constants, dispatch, emit,
|
|
230
|
+
const state = initState({ reactive, props, computed, parent, api: api2, t, constants, vm, inject });
|
|
231
|
+
initApi({ api: api2, state, constants, dispatch, emit, vm, props, updatePopper, nextTick, parent, t });
|
|
192
232
|
initWatch({ watch, state, api: api2, props, nextTick, updatePopper });
|
|
193
233
|
onBeforeUpdate(api2.handleBeforeUpdate);
|
|
194
234
|
onUpdated(api2.updateStyle);
|
|
195
235
|
onMounted(api2.selfMounted);
|
|
196
236
|
parent.$on("handle-clear", (event) => {
|
|
237
|
+
;
|
|
197
238
|
api2.handleClear(event);
|
|
198
239
|
});
|
|
199
240
|
onBeforeUnmount(() => removeResizeListener(parent.$el, api2.updateStyle));
|
package/cascader-menu/index.js
CHANGED
|
@@ -3,11 +3,11 @@ const handleExpand = (state) => (e) => state.activeNode = e.target;
|
|
|
3
3
|
const handleMouseMove = ({
|
|
4
4
|
api,
|
|
5
5
|
parent,
|
|
6
|
-
|
|
6
|
+
vm,
|
|
7
7
|
state,
|
|
8
8
|
svg
|
|
9
9
|
}) => (e) => {
|
|
10
|
-
const
|
|
10
|
+
const hoverZone = vm.$refs.hoverZone;
|
|
11
11
|
if (!state.activeNode || !hoverZone) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -15,9 +15,9 @@ const handleMouseMove = ({
|
|
|
15
15
|
if (state.hoverTimer) {
|
|
16
16
|
clearTimeout(state.hoverTimer);
|
|
17
17
|
}
|
|
18
|
-
const { left } = refs.cascaderMenu.$parent.$el.getBoundingClientRect();
|
|
18
|
+
const { left } = vm.$refs.cascaderMenu.$parent.$el.getBoundingClientRect();
|
|
19
19
|
const startX = e.clientX - left;
|
|
20
|
-
const { offsetWidth, offsetHeight } = refs.cascaderMenu.$parent.$el;
|
|
20
|
+
const { offsetWidth, offsetHeight } = vm.$refs.cascaderMenu.$parent.$el;
|
|
21
21
|
const top = state.activeNode.offsetTop;
|
|
22
22
|
const bottom = top + state.activeNode.offsetHeight;
|
|
23
23
|
hoverZone.innerHTML = `
|
|
@@ -25,11 +25,11 @@ const handleMouseMove = ({
|
|
|
25
25
|
${svg}${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
|
|
26
26
|
`;
|
|
27
27
|
} else if (!state.hoverTimer) {
|
|
28
|
-
state.hoverTimer = setTimeout(api.clearHoverZone, parent.state.config.hoverThreshold);
|
|
28
|
+
state.hoverTimer = setTimeout(api.clearHoverZone, parent.$parent.state.config.hoverThreshold);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
const clearHoverZone = (
|
|
32
|
-
const { hoverZone } = refs;
|
|
31
|
+
const clearHoverZone = ({ vm }) => () => {
|
|
32
|
+
const { hoverZone } = vm.$refs.hoverZone;
|
|
33
33
|
if (!hoverZone) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
package/cascader-menu/vue.js
CHANGED
|
@@ -4,7 +4,6 @@ import { CASCADER } from "../common";
|
|
|
4
4
|
import { random } from "../common/string";
|
|
5
5
|
const api = ["state", "handleMouseMove", "handleExpand"];
|
|
6
6
|
const renderless = (props, { computed, reactive }, { vm, parent }) => {
|
|
7
|
-
const refs = vm.$refs;
|
|
8
7
|
const api2 = {};
|
|
9
8
|
const state = reactive({
|
|
10
9
|
activeNode: null,
|
|
@@ -15,9 +14,9 @@ const renderless = (props, { computed, reactive }, { vm, parent }) => {
|
|
|
15
14
|
});
|
|
16
15
|
Object.assign(api2, {
|
|
17
16
|
state,
|
|
18
|
-
clearHoverZone: clearHoverZone(
|
|
17
|
+
clearHoverZone: clearHoverZone({ vm }),
|
|
19
18
|
handleExpand: handleExpand(state),
|
|
20
|
-
handleMouseMove: handleMouseMove({ api: api2, parent,
|
|
19
|
+
handleMouseMove: handleMouseMove({ api: api2, parent, vm, state, svg: CASCADER.SvgStr })
|
|
21
20
|
});
|
|
22
21
|
return api2;
|
|
23
22
|
};
|
package/cascader-mobile/index.js
CHANGED
|
@@ -6,16 +6,13 @@ const close = ({ state, emit }) => () => {
|
|
|
6
6
|
emit("close", false);
|
|
7
7
|
};
|
|
8
8
|
const syncCheckStatus = ({ state, props, api }) => (value) => {
|
|
9
|
-
const { valueField, textField, modelValue: propsModelValue
|
|
9
|
+
const { valueField, textField, modelValue: propsModelValue } = props;
|
|
10
10
|
const { lazy, isLeaf: leafField } = api.getNodeConfig();
|
|
11
11
|
let currentData;
|
|
12
12
|
let navList = [];
|
|
13
13
|
let modelValue = value || propsModelValue || [];
|
|
14
14
|
let len = modelValue.length;
|
|
15
15
|
let isLeaf;
|
|
16
|
-
if (!visible) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
16
|
for (let i = 0; i < len; i++) {
|
|
20
17
|
const id = modelValue[i];
|
|
21
18
|
currentData = state.store.getNode(id);
|
|
@@ -42,7 +39,6 @@ const watchVisible = ({ emit, state, props, api }) => (visible) => {
|
|
|
42
39
|
const { modelValue } = props;
|
|
43
40
|
if (visible) {
|
|
44
41
|
api.watchModelValue(modelValue);
|
|
45
|
-
api.initTreeStore();
|
|
46
42
|
}
|
|
47
43
|
setTimeout(() => {
|
|
48
44
|
state.toggle = visible;
|
|
@@ -115,19 +111,35 @@ const loopSearchOption = ({
|
|
|
115
111
|
textField,
|
|
116
112
|
prefixValue,
|
|
117
113
|
prefixText,
|
|
118
|
-
textSplit = "/"
|
|
114
|
+
textSplit = "/",
|
|
115
|
+
filterMethod,
|
|
116
|
+
level,
|
|
117
|
+
checkStrictly
|
|
119
118
|
}) => {
|
|
120
119
|
const list = [];
|
|
121
120
|
options.forEach((item) => {
|
|
121
|
+
if (item.disabled) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
122
124
|
const text = item[textField];
|
|
123
125
|
const textNavStr = prefixText ? prefixText + textSplit + text : text;
|
|
124
126
|
const value = [...prefixValue, item[valueField]];
|
|
125
127
|
const children = item[childrenField];
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if (checkStrictly === true || !children || children.length === 0) {
|
|
129
|
+
if (typeof filterMethod === "function") {
|
|
130
|
+
const matched = filterMethod({ data: item, label: item.label, value: item.value, level }, input);
|
|
131
|
+
if (matched) {
|
|
132
|
+
list.push({
|
|
133
|
+
[valueField]: value,
|
|
134
|
+
[textField]: textNavStr
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
} else if (text.includes(input)) {
|
|
138
|
+
list.push({
|
|
139
|
+
[valueField]: value,
|
|
140
|
+
[textField]: textNavStr
|
|
141
|
+
});
|
|
142
|
+
}
|
|
131
143
|
}
|
|
132
144
|
if (children && children.length) {
|
|
133
145
|
const arr = loopSearchOption({
|
|
@@ -138,7 +150,10 @@ const loopSearchOption = ({
|
|
|
138
150
|
textField,
|
|
139
151
|
prefixValue: value,
|
|
140
152
|
prefixText: textNavStr,
|
|
141
|
-
textSplit
|
|
153
|
+
textSplit,
|
|
154
|
+
filterMethod,
|
|
155
|
+
level: level + 1,
|
|
156
|
+
checkStrictly
|
|
142
157
|
});
|
|
143
158
|
list.push(...arr);
|
|
144
159
|
}
|
|
@@ -160,7 +175,10 @@ const searchMethod = ({ state, props, api }) => () => {
|
|
|
160
175
|
valueField,
|
|
161
176
|
textField,
|
|
162
177
|
prefixValue: [],
|
|
163
|
-
prefixText: ""
|
|
178
|
+
prefixText: "",
|
|
179
|
+
filterMethod: searchConfig.filterMethod,
|
|
180
|
+
level: 0,
|
|
181
|
+
checkStrictly: props.nodeConfig.checkStrictly
|
|
164
182
|
});
|
|
165
183
|
}
|
|
166
184
|
if (typeof list.then === "function") {
|
|
@@ -169,12 +187,12 @@ const searchMethod = ({ state, props, api }) => () => {
|
|
|
169
187
|
state.search.filterOptions = list;
|
|
170
188
|
}
|
|
171
189
|
};
|
|
172
|
-
const searchBoxToggle = ({ state, props, api }) => (
|
|
190
|
+
const searchBoxToggle = ({ state, props, api }) => (isShow) => {
|
|
173
191
|
const { searchConfig = {} } = props;
|
|
174
192
|
const { lazy } = api.getNodeConfig();
|
|
175
|
-
state.search.show =
|
|
193
|
+
state.search.show = isShow;
|
|
176
194
|
state.search.input = "";
|
|
177
|
-
if (
|
|
195
|
+
if (isShow) {
|
|
178
196
|
state.search.options = !lazy && searchConfig.options && searchConfig.options.length ? searchConfig.options : state.store.getAllData();
|
|
179
197
|
api.searchMethod();
|
|
180
198
|
}
|
|
@@ -198,8 +216,7 @@ const created = ({ api }) => () => {
|
|
|
198
216
|
api.initTreeStore();
|
|
199
217
|
};
|
|
200
218
|
const loadData = ({ props, state }) => (data) => {
|
|
201
|
-
|
|
202
|
-
if (!visible) {
|
|
219
|
+
if (!props.visible) {
|
|
203
220
|
return;
|
|
204
221
|
}
|
|
205
222
|
state.store.setData(data);
|
|
@@ -230,7 +247,7 @@ const getNodeConfig = ({ constants, props }) => () => {
|
|
|
230
247
|
return Object.assign({ nodeKey: valueField }, constants.defaultNodeConfig, nodeConfig);
|
|
231
248
|
};
|
|
232
249
|
const initTreeStore = ({ props, state, api }) => () => {
|
|
233
|
-
const { data, textField
|
|
250
|
+
const { data, textField } = props;
|
|
234
251
|
const {
|
|
235
252
|
nodeKey,
|
|
236
253
|
lazy,
|
|
@@ -247,10 +264,6 @@ const initTreeStore = ({ props, state, api }) => () => {
|
|
|
247
264
|
defaultExpandAll,
|
|
248
265
|
filterNodeMethod
|
|
249
266
|
} = api.getNodeConfig();
|
|
250
|
-
if (!visible || state.store) {
|
|
251
|
-
api.syncCheckStatus();
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
267
|
state.store = new TreeStore({
|
|
255
268
|
key: nodeKey,
|
|
256
269
|
data,
|
package/cascader-mobile/vue.js
CHANGED
|
@@ -67,6 +67,11 @@ const renderless = (props, { computed, reactive, watch }, { emit, constants }) =
|
|
|
67
67
|
computedNavList: computed(() => api2.computedNavListHandler()),
|
|
68
68
|
showButton: computed(() => {
|
|
69
69
|
const len = state.navList.length;
|
|
70
|
+
if (!props.nodeConfig.checkStrictly) {
|
|
71
|
+
if (state.level < len - 1) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
70
75
|
return len && (props.nodeConfig.checkStrictly || state.navList[len - 1].isLeaf);
|
|
71
76
|
})
|
|
72
77
|
});
|
|
@@ -92,6 +97,7 @@ const renderless = (props, { computed, reactive, watch }, { emit, constants }) =
|
|
|
92
97
|
isSelected: isSelected({ state, api: api2, props })
|
|
93
98
|
});
|
|
94
99
|
api2.created();
|
|
100
|
+
api2.syncCheckStatus();
|
|
95
101
|
watch(() => props.visible, api2.watchVisible);
|
|
96
102
|
watch(() => props.modelValue, api2.watchModelValue, { immediate: true, deep: true });
|
|
97
103
|
watch(() => props.data, api2.loadData, { deep: true });
|
package/cascader-node/index.js
CHANGED
|
@@ -15,9 +15,11 @@ const handleExpand = ({ api, parent, props, state }) => () => {
|
|
|
15
15
|
if (!state.isLeaf) {
|
|
16
16
|
api.handleExpand();
|
|
17
17
|
}
|
|
18
|
-
if (multiple) {
|
|
18
|
+
if (multiple && state.isLeaf) {
|
|
19
19
|
const checked = state.isLeaf ? props.node.checked : false;
|
|
20
20
|
api.handleMultiCheckChange(Boolean(checked));
|
|
21
|
+
} else {
|
|
22
|
+
parent.handleExpand(props.node);
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
25
|
} else {
|
|
@@ -37,10 +39,20 @@ const isInPath = (props) => (pathNodes) => {
|
|
|
37
39
|
const selectedPathNode = pathNodes[props.node.level - 1] || {};
|
|
38
40
|
return selectedPathNode.uid === props.node.uid;
|
|
39
41
|
};
|
|
42
|
+
const handleNodeClick = ({ state, api }) => () => {
|
|
43
|
+
if (!state.isDisabled) {
|
|
44
|
+
if (state.isLeaf) {
|
|
45
|
+
api.handleCheckChange();
|
|
46
|
+
} else {
|
|
47
|
+
api.handleExpand();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
40
51
|
export {
|
|
41
52
|
comptCheckPath,
|
|
42
53
|
handleCheckChange,
|
|
43
54
|
handleExpand,
|
|
44
55
|
handleMultiCheckChange,
|
|
56
|
+
handleNodeClick,
|
|
45
57
|
isInPath
|
|
46
58
|
};
|