@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/tree/index.js
CHANGED
|
@@ -193,7 +193,7 @@ const afterLoadHandler = ({ state, emit, props, api }) => (params) => {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
const initTreeStore = ({ api, props, state, emit }) => () => {
|
|
196
|
-
const { nodeKey, data, lazy, load,
|
|
196
|
+
const { nodeKey, data, lazy, load, currentNodeKey, checkStrictly, checkDescendants } = props;
|
|
197
197
|
const { defaultCheckedKeys, defaultExpandedKeys, autoExpandParent, defaultExpandAll, filterNodeMethod } = props;
|
|
198
198
|
state.store = new TreeStore({
|
|
199
199
|
key: nodeKey,
|
|
@@ -213,7 +213,9 @@ const initTreeStore = ({ api, props, state, emit }) => () => {
|
|
|
213
213
|
});
|
|
214
214
|
state.root = state.store.root;
|
|
215
215
|
api.initIsCurrent();
|
|
216
|
-
|
|
216
|
+
if (props.willChangeView) {
|
|
217
|
+
api.initPlainNodeStore();
|
|
218
|
+
}
|
|
217
219
|
};
|
|
218
220
|
const created = ({ api, state }) => () => {
|
|
219
221
|
state.isTree = true;
|
|
@@ -533,6 +535,10 @@ const saveNode = ({ state, emit, api }) => () => {
|
|
|
533
535
|
};
|
|
534
536
|
const addNode = ({ api }) => (node) => {
|
|
535
537
|
const newNode = { label: "" };
|
|
538
|
+
const isLeafField = node.store && node.store.props.isLeaf;
|
|
539
|
+
if (isLeafField) {
|
|
540
|
+
newNode[isLeafField] = true;
|
|
541
|
+
}
|
|
536
542
|
Object.defineProperty(newNode, "_isNewNode", {
|
|
537
543
|
value: true,
|
|
538
544
|
enumerable: false,
|
|
@@ -573,13 +579,22 @@ const deleteAction = ({ state, api, emit }) => () => {
|
|
|
573
579
|
emit("delete-node", node);
|
|
574
580
|
api.remove(state.action.node, isSaveChildNode, true);
|
|
575
581
|
};
|
|
576
|
-
const deleteConfirm = ({ state }) => (event2, node) => {
|
|
582
|
+
const deleteConfirm = ({ state, props, api }) => (event2, node) => {
|
|
577
583
|
state.action.type = "delete";
|
|
578
584
|
state.action.node = node;
|
|
579
585
|
state.action.isLeaf = !node.childNodes || !node.childNodes.length;
|
|
580
586
|
state.action.referenceElm = event2.currentTarget;
|
|
581
587
|
state.action.popoverVisible = false;
|
|
582
588
|
state.action.isSaveChildNode = false;
|
|
589
|
+
if (typeof props.deleteNodeMethod === "function") {
|
|
590
|
+
const promise = props.deleteNodeMethod({ event: event2, node });
|
|
591
|
+
if (promise && typeof promise.then === "function") {
|
|
592
|
+
promise.then((bool) => bool && api.deleteAction());
|
|
593
|
+
} else if (promise) {
|
|
594
|
+
api.deleteAction();
|
|
595
|
+
}
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
583
598
|
setTimeout(() => {
|
|
584
599
|
state.action.popoverVisible = true;
|
|
585
600
|
}, 300);
|
|
@@ -650,7 +665,9 @@ const initPlainNodeStore = ({ props, state }) => () => {
|
|
|
650
665
|
state.plainNodeStore = plainNodeStore;
|
|
651
666
|
};
|
|
652
667
|
const handleCheckPlainNode = ({ props, emit }) => (e, plainNode) => {
|
|
653
|
-
|
|
668
|
+
if (props.showCheckbox) {
|
|
669
|
+
plainNode.node.setChecked(e, !props.checkStrictly);
|
|
670
|
+
}
|
|
654
671
|
emit("check-plain", plainNode, e);
|
|
655
672
|
};
|
|
656
673
|
const handleClickPlainNode = (emit) => (e, plainNode) => {
|
package/tree/vue.js
CHANGED
|
@@ -119,7 +119,7 @@ const api = [
|
|
|
119
119
|
];
|
|
120
120
|
const initState = ({ reactive, emitter, props, computed, api: api2 }) => {
|
|
121
121
|
const state = reactive({
|
|
122
|
-
loaded:
|
|
122
|
+
loaded: !props.lazy,
|
|
123
123
|
checkEasily: false,
|
|
124
124
|
root: null,
|
|
125
125
|
store: null,
|
|
@@ -164,7 +164,7 @@ const initState = ({ reactive, emitter, props, computed, api: api2 }) => {
|
|
|
164
164
|
});
|
|
165
165
|
return state;
|
|
166
166
|
};
|
|
167
|
-
const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit
|
|
167
|
+
const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit }) => ({
|
|
168
168
|
state,
|
|
169
169
|
dispatch,
|
|
170
170
|
broadcast,
|
|
@@ -208,11 +208,11 @@ const initApi = ({ state, dispatch, broadcast, props, vm, constants, t, emit, re
|
|
|
208
208
|
initIsCurrent: debounce(20, initIsCurrent({ props, state })),
|
|
209
209
|
setCheckedByNodeKey: setCheckedByNodeKey({ props, state })
|
|
210
210
|
});
|
|
211
|
-
const initWatcher = ({ watch, props, api: api2, state }) => {
|
|
211
|
+
const initWatcher = ({ watch, props, api: api2, state, isVue2 }) => {
|
|
212
212
|
watch(() => props.defaultCheckedKeys, api2.watchDefaultCheckedKeys);
|
|
213
213
|
watch(() => props.defaultExpandedKeys, api2.watchDefaultExpandedKeys);
|
|
214
214
|
watch(() => props.defaultExpandedKeysHighlight, api2.initIsCurrent);
|
|
215
|
-
watch(() => props.data, api2.watchData, { deep:
|
|
215
|
+
watch(() => props.data, api2.watchData, { deep: !isVue2 });
|
|
216
216
|
watch(() => props.checkboxItems, api2.watchCheckboxItems);
|
|
217
217
|
watch(() => props.checkStrictly, api2.watchCheckStrictly);
|
|
218
218
|
watch(() => props.defaultCheckedKeys, api2.setCurrentRadio, { immediate: true });
|
|
@@ -231,9 +231,11 @@ const initWatcher = ({ watch, props, api: api2, state }) => {
|
|
|
231
231
|
(value) => state.action.addDisabled = value || [],
|
|
232
232
|
{ immediate: true }
|
|
233
233
|
);
|
|
234
|
-
|
|
234
|
+
if (props.willChangeView) {
|
|
235
|
+
watch(() => state.root, api2.initPlainNodeStore, { deep: true });
|
|
236
|
+
}
|
|
235
237
|
};
|
|
236
|
-
const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, provide, onBeforeUnmount }, { vm, t, emit, constants, broadcast, dispatch, service, emitter, nextTick }) => {
|
|
238
|
+
const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, provide, onBeforeUnmount }, { vm, t, emit, constants, broadcast, dispatch, service, emitter, nextTick }, { isVue2 }) => {
|
|
237
239
|
const api2 = {};
|
|
238
240
|
const state = initState({ reactive, emitter, props, computed, api: api2 });
|
|
239
241
|
provide("parentEmitter", state.emitter);
|
|
@@ -247,7 +249,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, pr
|
|
|
247
249
|
wrapMounted: wrapMounted({ api: api2, props, service }),
|
|
248
250
|
initTreeStore: initTreeStore({ api: api2, props, state, emit }),
|
|
249
251
|
deleteAction: deleteAction({ state, api: api2, emit }),
|
|
250
|
-
deleteConfirm: deleteConfirm({ state }),
|
|
252
|
+
deleteConfirm: deleteConfirm({ state, props, api: api2 }),
|
|
251
253
|
getSameDataIndex,
|
|
252
254
|
loopGetTreeData,
|
|
253
255
|
cancelDelete: cancelDelete({ state }),
|
|
@@ -267,7 +269,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, pr
|
|
|
267
269
|
handleClickPlainNode: handleClickPlainNode(emit)
|
|
268
270
|
});
|
|
269
271
|
api2.created();
|
|
270
|
-
initWatcher({ watch, props, api: api2, state });
|
|
272
|
+
initWatcher({ watch, props, api: api2, state, isVue2 });
|
|
271
273
|
onMounted(api2.wrapMounted);
|
|
272
274
|
onUpdated(api2.updated);
|
|
273
275
|
onBeforeUnmount(api2.beforeUnmount);
|
package/tree-menu/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../chunk-G2ADBYYC.js";
|
|
4
|
-
const initData = ({ state, props, service, api }) => () => {
|
|
4
|
+
const initData = ({ state, props, service, api }) => async () => {
|
|
5
5
|
if (props.data) {
|
|
6
6
|
state.data = props.data;
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
if (typeof service.getMenuDataSync === "function") {
|
|
10
|
-
const menuData = service.getMenuDataSync();
|
|
10
|
+
const menuData = await service.getMenuDataSync();
|
|
11
11
|
state.data = api.setMenuKey({ newData: [], menuData });
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -38,11 +38,13 @@ const setMenuKey = (api) => ({ newData, menuData }) => {
|
|
|
38
38
|
});
|
|
39
39
|
return newData;
|
|
40
40
|
};
|
|
41
|
-
const filterNode = () => (value, data) => {
|
|
41
|
+
const filterNode = (props) => (value, data) => {
|
|
42
|
+
var _a;
|
|
42
43
|
if (!value) {
|
|
43
44
|
return true;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const propsLabel = ((_a = props.props) == null ? void 0 : _a.label) || "label";
|
|
47
|
+
return data[propsLabel].includes(value);
|
|
46
48
|
};
|
|
47
49
|
const watchFilterText = ({ vm }) => (value) => {
|
|
48
50
|
vm.$refs.tree.filter(value);
|
|
@@ -68,8 +70,11 @@ const nodeExpand = (emit) => (nodeData, node) => {
|
|
|
68
70
|
const nodeCollapse = (emit) => (nodeData, node) => {
|
|
69
71
|
emit("node-collapse", nodeData, node);
|
|
70
72
|
};
|
|
71
|
-
const nodeClick = (emit) => (nodeData, node) => {
|
|
73
|
+
const nodeClick = ({ emit, props, state }) => (nodeData, node) => {
|
|
72
74
|
emit("node-click", nodeData, node);
|
|
75
|
+
if (props.showExpand && state.isExpand) {
|
|
76
|
+
state.isExpand = false;
|
|
77
|
+
}
|
|
73
78
|
};
|
|
74
79
|
const checkChange = (emit) => (data, checked, indeterminate) => {
|
|
75
80
|
emit("check-change", data, checked, indeterminate);
|
|
@@ -109,17 +114,38 @@ const setCurrentNode = ({ vm }) => (key) => {
|
|
|
109
114
|
const getCurrentNode = ({ vm }) => () => {
|
|
110
115
|
return vm.$refs.tree.getCurrentNode();
|
|
111
116
|
};
|
|
117
|
+
const handleToggleMenu = ({ state, vm }) => (type) => {
|
|
118
|
+
state.isExpand = !state.isExpand;
|
|
119
|
+
if (type === "expand") {
|
|
120
|
+
state.currentKey = state.nodeKey !== null ? [state.nodeKey] : [];
|
|
121
|
+
} else {
|
|
122
|
+
state.nodeKey = vm.$refs.tree.getCurrentKey();
|
|
123
|
+
vm.$refs.tree.expandAllNodes(false);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const computedTreeStyle = ({ props }) => () => {
|
|
127
|
+
let minusHeight = 0;
|
|
128
|
+
if (props.showExpand) {
|
|
129
|
+
minusHeight += 64;
|
|
130
|
+
}
|
|
131
|
+
if (props.showFilter) {
|
|
132
|
+
minusHeight += 42;
|
|
133
|
+
}
|
|
134
|
+
return { "height": `calc(100% - ${minusHeight}px)` };
|
|
135
|
+
};
|
|
112
136
|
export {
|
|
113
137
|
check,
|
|
114
138
|
checkChange,
|
|
115
139
|
collapseChange,
|
|
116
140
|
collapseMenu,
|
|
141
|
+
computedTreeStyle,
|
|
117
142
|
currentChange,
|
|
118
143
|
expandMenu,
|
|
119
144
|
filterNode,
|
|
120
145
|
getCurrentKey,
|
|
121
146
|
getCurrentNode,
|
|
122
147
|
getTitle,
|
|
148
|
+
handleToggleMenu,
|
|
123
149
|
initData,
|
|
124
150
|
nodeClick,
|
|
125
151
|
nodeCollapse,
|
package/tree-menu/vue.js
CHANGED
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
setCurrentKey,
|
|
23
23
|
getCurrentKey,
|
|
24
24
|
setCurrentNode,
|
|
25
|
-
getCurrentNode
|
|
25
|
+
getCurrentNode,
|
|
26
|
+
handleToggleMenu,
|
|
27
|
+
computedTreeStyle
|
|
26
28
|
} from "./index";
|
|
27
29
|
const api = [
|
|
28
30
|
"state",
|
|
@@ -48,23 +50,32 @@ const api = [
|
|
|
48
50
|
"setCurrentKey",
|
|
49
51
|
"getCurrentKey",
|
|
50
52
|
"setCurrentNode",
|
|
51
|
-
"getCurrentNode"
|
|
53
|
+
"getCurrentNode",
|
|
54
|
+
"handleToggleMenu"
|
|
52
55
|
];
|
|
53
|
-
const renderless = (props, { watch, reactive, onMounted }, { t, service, emit, vm }) => {
|
|
56
|
+
const renderless = (props, { computed, watch, reactive, onMounted }, { t, service, emit, vm }) => {
|
|
54
57
|
service = service || { base: {} };
|
|
55
58
|
service = { getMenuDataSync: props.getMenuDataSync || service.base.getMenuDataSync };
|
|
59
|
+
const api2 = {};
|
|
56
60
|
const state = reactive({
|
|
57
61
|
data: [],
|
|
58
62
|
filterText: "",
|
|
59
|
-
|
|
63
|
+
isExpand: false,
|
|
64
|
+
isCollapsed: false,
|
|
65
|
+
nodeKey: null,
|
|
66
|
+
currentKey: [],
|
|
67
|
+
treeStyle: computed(() => api2.computedTreeStyle()),
|
|
68
|
+
defaultExpandedKeys: computed(
|
|
69
|
+
() => props.defaultExpandedKeys && props.defaultExpandedKeys.length ? props.defaultExpandedKeys : state.currentKey
|
|
70
|
+
)
|
|
60
71
|
});
|
|
61
|
-
Object.assign(
|
|
72
|
+
Object.assign(api2, {
|
|
62
73
|
t,
|
|
63
74
|
state,
|
|
64
75
|
check: check(emit),
|
|
65
|
-
filterNode: filterNode(),
|
|
76
|
+
filterNode: filterNode(props),
|
|
66
77
|
nodeDrop: nodeDrop(emit),
|
|
67
|
-
nodeClick: nodeClick(emit),
|
|
78
|
+
nodeClick: nodeClick({ emit, props, state }),
|
|
68
79
|
nodeExpand: nodeExpand(emit),
|
|
69
80
|
nodeDragEnd: nodeDragEnd(emit),
|
|
70
81
|
checkChange: checkChange(emit),
|
|
@@ -75,24 +86,26 @@ const renderless = (props, { watch, reactive, onMounted }, { t, service, emit, v
|
|
|
75
86
|
currentChange: currentChange(emit),
|
|
76
87
|
watchFilterText: watchFilterText({ vm }),
|
|
77
88
|
getTitle: getTitle(props),
|
|
78
|
-
setMenuKey: setMenuKey(
|
|
79
|
-
initData: initData({ state, props, service, api }),
|
|
89
|
+
setMenuKey: setMenuKey(api2),
|
|
90
|
+
initData: initData({ state, props, service, api: api2 }),
|
|
80
91
|
collapseChange: collapseChange({ state, props, emit }),
|
|
81
|
-
collapseMenu: collapseMenu({ state, props, api }),
|
|
82
|
-
expandMenu: expandMenu({ state, props, api }),
|
|
92
|
+
collapseMenu: collapseMenu({ state, props, api: api2 }),
|
|
93
|
+
expandMenu: expandMenu({ state, props, api: api2 }),
|
|
83
94
|
setCurrentKey: setCurrentKey({ vm }),
|
|
84
95
|
getCurrentKey: getCurrentKey({ vm }),
|
|
85
96
|
setCurrentNode: setCurrentNode({ vm }),
|
|
86
|
-
getCurrentNode: getCurrentNode({ vm })
|
|
97
|
+
getCurrentNode: getCurrentNode({ vm }),
|
|
98
|
+
handleToggleMenu: handleToggleMenu({ state, vm }),
|
|
99
|
+
computedTreeStyle: computedTreeStyle({ props })
|
|
87
100
|
});
|
|
88
101
|
watch(
|
|
89
102
|
() => props.data,
|
|
90
103
|
(value) => state.data = value,
|
|
91
104
|
{ immediate: true }
|
|
92
105
|
);
|
|
93
|
-
watch(() => state.filterText,
|
|
94
|
-
onMounted(
|
|
95
|
-
return
|
|
106
|
+
watch(() => state.filterText, api2.watchFilterText, { deep: true });
|
|
107
|
+
onMounted(api2.initData);
|
|
108
|
+
return api2;
|
|
96
109
|
};
|
|
97
110
|
export {
|
|
98
111
|
api,
|
package/tree-node/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const handleSelectChange = ({ props, state }) => (checked, indeterminate) => {
|
|
|
47
47
|
state.oldChecked = checked;
|
|
48
48
|
state.indeterminate = indeterminate;
|
|
49
49
|
};
|
|
50
|
-
const handleClick = ({ api, vm, props, state }) => (e) => {
|
|
50
|
+
const handleClick = ({ api, vm, props, state }) => (e, trigger) => {
|
|
51
51
|
const store = state.tree.state.store;
|
|
52
52
|
state.tree.clearCurrentStore(props.node);
|
|
53
53
|
if (!state.tree.onlyCheckChildren) {
|
|
@@ -58,7 +58,7 @@ const handleClick = ({ api, vm, props, state }) => (e) => {
|
|
|
58
58
|
state.tree.$emit("current-change", store.currentNode ? store.currentNode.data : null, store.currentNode);
|
|
59
59
|
}
|
|
60
60
|
state.tree.currentNode = vm;
|
|
61
|
-
if (state.tree.checkOnClickNode && !props.node.disabled) {
|
|
61
|
+
if (state.tree.checkOnClickNode && !props.node.disabled && trigger !== "checkbox") {
|
|
62
62
|
e.target.checked = !props.node.checked;
|
|
63
63
|
api.handleCheckChange(null, e);
|
|
64
64
|
}
|
|
@@ -68,18 +68,15 @@ const handleClick = ({ api, vm, props, state }) => (e) => {
|
|
|
68
68
|
state.tree.$emit("node-click", props.node.data, props.node, vm);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
+
api.handleExpandClick(false);
|
|
71
72
|
} else {
|
|
72
73
|
if (!state.tree.collapsible || !state.tree.expandOnClickNode) {
|
|
73
74
|
!props.node.disabled && state.tree.$emit("node-click", props.node.data, props.node, vm);
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
-
if (!state.tree.onlyCheckChildren) {
|
|
78
77
|
if (state.tree.expandOnClickNode && isCheck) {
|
|
79
78
|
api.handleExpandClick(isCheck);
|
|
80
79
|
}
|
|
81
|
-
} else {
|
|
82
|
-
api.handleExpandClick(false);
|
|
83
80
|
}
|
|
84
81
|
};
|
|
85
82
|
const closeMenu = (state) => () => {
|
|
@@ -202,10 +199,12 @@ const onSiblingToggleExpand = ({ state, props }) => ({ isExpand, sibling }) => {
|
|
|
202
199
|
}
|
|
203
200
|
};
|
|
204
201
|
const watchExpandedChange = ({ state, props }) => () => {
|
|
205
|
-
state.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
if (state.tree.accordion) {
|
|
203
|
+
state.parentEmitter.emit("sibling-node-toggle-expand", {
|
|
204
|
+
isExpand: props.node.expanded,
|
|
205
|
+
sibling: props.node
|
|
206
|
+
});
|
|
207
|
+
}
|
|
209
208
|
};
|
|
210
209
|
const openEdit = ({ state, vm }) => (node) => {
|
|
211
210
|
state.tree.state.emitter.emit("tree-node-edit", node);
|
|
@@ -229,16 +228,17 @@ const addNode = ({ state, props, api }) => (event, node) => {
|
|
|
229
228
|
api.openEdit();
|
|
230
229
|
state.tree.state.emitter.emit("tree-node-add", event, node);
|
|
231
230
|
};
|
|
232
|
-
const computedExpandIcon = ({ designConfig }) => (
|
|
233
|
-
|
|
234
|
-
|
|
231
|
+
const computedExpandIcon = ({ designConfig }) => (treeRoot, state) => {
|
|
232
|
+
var _a, _b;
|
|
233
|
+
if (state.tree.icon) {
|
|
234
|
+
return state.tree.icon;
|
|
235
235
|
}
|
|
236
|
-
if (showLine) {
|
|
237
|
-
const expandIcon = (designConfig == null ? void 0 : designConfig.icons.expanded) || "icon-minus-square";
|
|
238
|
-
const collapseIcon = (designConfig == null ? void 0 : designConfig.icons.collapse) || "icon-plus-square";
|
|
239
|
-
return expanded ? expandIcon : collapseIcon;
|
|
236
|
+
if (treeRoot.showLine) {
|
|
237
|
+
const expandIcon = ((_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a.expanded) || "icon-minus-square";
|
|
238
|
+
const collapseIcon = ((_b = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _b.collapse) || "icon-plus-square";
|
|
239
|
+
return state.expanded ? expandIcon : collapseIcon;
|
|
240
240
|
}
|
|
241
|
-
return
|
|
241
|
+
return "icon-chevron-right";
|
|
242
242
|
};
|
|
243
243
|
const computedIndent = () => ({ node, showLine }, { tree }) => {
|
|
244
244
|
return (node.level > 1 ? 1 : 0) * (parseInt(tree.indent) + (showLine ? 8 : 0)) + parseInt(tree.baseIndent) + "px";
|
package/tree-node/vue.js
CHANGED
|
@@ -70,7 +70,7 @@ const initState = ({ reactive, treeRoot, props, emitter, $parentEmitter, vm, api
|
|
|
70
70
|
});
|
|
71
71
|
return state;
|
|
72
72
|
};
|
|
73
|
-
const initApi = ({ api: api2, state, dispatch, broadcast, vm, props,
|
|
73
|
+
const initApi = ({ api: api2, state, dispatch, broadcast, vm, props, treeRoot, nextTick, emit, designConfig }) => {
|
|
74
74
|
Object.assign(api2, {
|
|
75
75
|
state,
|
|
76
76
|
dispatch,
|
|
@@ -109,15 +109,16 @@ const initWatcher = ({ watch, state, api: api2, props }) => {
|
|
|
109
109
|
watch(() => props.node.checked, api2.watchChecked, { deep: true });
|
|
110
110
|
watch(() => props.node.expanded, api2.watchExpanded, { deep: true });
|
|
111
111
|
};
|
|
112
|
-
const renderless = (props, { reactive, watch, inject, provide, computed }, {
|
|
112
|
+
const renderless = (props, { reactive, watch, inject, provide, computed }, { vm, nextTick, emit, broadcast, dispatch, emitter, designConfig }, { isVue2 }) => {
|
|
113
113
|
const api2 = {};
|
|
114
|
-
const parent = inject("parentTree") || parentVm;
|
|
115
114
|
const treeRoot = inject("TreeRoot");
|
|
116
115
|
const $parentEmitter = inject("parentEmitter");
|
|
117
116
|
const state = initState({ reactive, treeRoot, props, emitter, $parentEmitter, vm, api: api2, computed });
|
|
118
|
-
state.
|
|
117
|
+
if (state.tree.accordion) {
|
|
118
|
+
state.parentEmitter.on("sibling-node-toggle-expand", (event) => api2.onSiblingToggleExpand(event));
|
|
119
|
+
}
|
|
119
120
|
provide("parentEmitter", state.emitter);
|
|
120
|
-
initApi({ api: api2, state, dispatch, broadcast, vm, props,
|
|
121
|
+
initApi({ api: api2, state, dispatch, broadcast, vm, props, treeRoot, nextTick, emit, designConfig });
|
|
121
122
|
initWatcher({ watch, state, api: api2, props });
|
|
122
123
|
api2.created((childrenKey) => {
|
|
123
124
|
watch(
|
|
@@ -1,2 +1,119 @@
|
|
|
1
|
+
import { CSSProperties, ExtractPropTypes } from 'vue';
|
|
2
|
+
import { ISharedRenderlessParamUtils } from './shared.type.js';
|
|
1
3
|
|
|
2
|
-
|
|
4
|
+
declare const actionSheetProps: {
|
|
5
|
+
menus: {
|
|
6
|
+
type: ArrayConstructor;
|
|
7
|
+
default: () => never[];
|
|
8
|
+
};
|
|
9
|
+
modelValue: (ArrayConstructor | StringConstructor | NumberConstructor)[];
|
|
10
|
+
beforeClose: FunctionConstructor;
|
|
11
|
+
visible: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
ellipsis: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
height: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
valueField: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
textField: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
title: StringConstructor;
|
|
32
|
+
showHeader: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
showFooter: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
showClose: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: () => boolean;
|
|
43
|
+
};
|
|
44
|
+
fullscreen: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: () => boolean;
|
|
47
|
+
};
|
|
48
|
+
customClass: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
|
|
49
|
+
contentClass: StringConstructor;
|
|
50
|
+
type: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
mask: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
maskClosable: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
lockScroll: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
66
|
+
flex: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
contentPosition: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
contentStyle: {
|
|
75
|
+
type: ObjectConstructor;
|
|
76
|
+
default: () => {};
|
|
77
|
+
};
|
|
78
|
+
tiny_mode: StringConstructor;
|
|
79
|
+
tiny_mode_root: BooleanConstructor;
|
|
80
|
+
tiny_template: (FunctionConstructor | ObjectConstructor)[];
|
|
81
|
+
tiny_renderless: FunctionConstructor;
|
|
82
|
+
tiny_theme: StringConstructor;
|
|
83
|
+
tiny_chart_theme: ObjectConstructor;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
interface IActionSheetState {
|
|
87
|
+
toggle: boolean;
|
|
88
|
+
sheetMaskStyle: CSSProperties;
|
|
89
|
+
sheetContentStyle: CSSProperties;
|
|
90
|
+
scroll: null | object;
|
|
91
|
+
}
|
|
92
|
+
type IActionSheetProps = ExtractPropTypes<typeof actionSheetProps>;
|
|
93
|
+
type IActionSheetRenderlessParamUtils = ISharedRenderlessParamUtils<null>;
|
|
94
|
+
interface IActionSheetApi {
|
|
95
|
+
state: IActionSheetState;
|
|
96
|
+
setSheetStyle: ({ state, props }: {
|
|
97
|
+
state: IActionSheetState;
|
|
98
|
+
props: IActionSheetProps;
|
|
99
|
+
}) => void;
|
|
100
|
+
initScrollMenu: ({ state, nextTick, refs, BScroll }: {
|
|
101
|
+
state: IActionSheetState;
|
|
102
|
+
nextTick: IActionSheetRenderlessParamUtils['nextTick'];
|
|
103
|
+
refs: IActionSheetRenderlessParamUtils['refs'];
|
|
104
|
+
BScroll: object;
|
|
105
|
+
}) => void;
|
|
106
|
+
visibleHandle: ({ emit, state }: {
|
|
107
|
+
emit: IActionSheetRenderlessParamUtils['emit'];
|
|
108
|
+
state: IActionSheetState;
|
|
109
|
+
}) => void;
|
|
110
|
+
watchVisible: (value: boolean) => void;
|
|
111
|
+
menuHandle: (item: any) => void;
|
|
112
|
+
confirm: () => void;
|
|
113
|
+
selectOption: (option: any) => void;
|
|
114
|
+
actionSelectOption: (option: any, index: any) => void;
|
|
115
|
+
close: () => void;
|
|
116
|
+
hide: () => void;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { IActionSheetApi, IActionSheetProps, IActionSheetRenderlessParamUtils, IActionSheetState };
|
package/types/alert.type.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare const alertProps: {
|
|
|
76
76
|
type: BooleanConstructor;
|
|
77
77
|
default: boolean;
|
|
78
78
|
};
|
|
79
|
-
customClass: (
|
|
79
|
+
customClass: (ArrayConstructor | StringConstructor | ObjectConstructor)[];
|
|
80
80
|
offset: {
|
|
81
81
|
type: (StringConstructor | NumberConstructor)[];
|
|
82
82
|
default: number;
|