@opentiny/vue-renderless 3.13.2 → 3.14.1
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/bigInt.js +2 -2
- package/common/date.js +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/date-util.js +4 -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 +15 -6
- package/date-table/index.js +35 -53
- package/date-table/vue.js +4 -2
- 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 +48 -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 +290 -77
- package/picker/mb.js +42 -0
- package/picker/vue.js +76 -20
- 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 +73 -34
- 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 +442 -393
- package/select/vue.js +278 -164
- 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 +29 -3
- 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/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 +6 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +38 -1
- 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-a2dc0099.d.ts} +4 -1
- 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 +2 -6
- 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/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 +12 -0
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +2 -0
- 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 +14 -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 +1 -1
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -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 +35 -26
- 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/numeric/vue.js
CHANGED
|
@@ -25,7 +25,10 @@ import {
|
|
|
25
25
|
initService,
|
|
26
26
|
dispatchDisplayedValue,
|
|
27
27
|
getDisplayedValue,
|
|
28
|
-
getDisplayOnlyText
|
|
28
|
+
getDisplayOnlyText,
|
|
29
|
+
filterValue,
|
|
30
|
+
handleClear,
|
|
31
|
+
handleChange
|
|
29
32
|
} from "./index";
|
|
30
33
|
const api = [
|
|
31
34
|
"state",
|
|
@@ -37,9 +40,19 @@ const api = [
|
|
|
37
40
|
"handleInputChange",
|
|
38
41
|
"mouseEvent",
|
|
39
42
|
"focus",
|
|
40
|
-
"select"
|
|
43
|
+
"select",
|
|
44
|
+
"handleClear",
|
|
45
|
+
"handleChange"
|
|
41
46
|
];
|
|
42
|
-
const initState = ({
|
|
47
|
+
const initState = ({
|
|
48
|
+
reactive,
|
|
49
|
+
computed,
|
|
50
|
+
props,
|
|
51
|
+
api: api2,
|
|
52
|
+
$service,
|
|
53
|
+
constants,
|
|
54
|
+
parent
|
|
55
|
+
}) => {
|
|
43
56
|
const state = reactive({
|
|
44
57
|
currentValue: props.modelValue,
|
|
45
58
|
userInput: props.modelValue,
|
|
@@ -57,8 +70,13 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
|
|
|
57
70
|
maxDisabled: computed(() => !props.circulate && state.currentValue >= props.max || state.formDisabled),
|
|
58
71
|
controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
|
|
59
72
|
format: computed(() => getUnitPrecision({ service: $service, props })),
|
|
73
|
+
filterMenu: constants.FILTER_OPTION,
|
|
74
|
+
filterValue: computed(() => api2.filterValue()),
|
|
75
|
+
handleClear: computed(() => api2.handleClear()),
|
|
76
|
+
handleChange: computed(() => api2.handleClear()),
|
|
60
77
|
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
|
|
61
|
-
displayOnlyText: computed(() => api2.getDisplayOnlyText())
|
|
78
|
+
displayOnlyText: computed(() => api2.getDisplayOnlyText()),
|
|
79
|
+
controls: props.controls
|
|
62
80
|
});
|
|
63
81
|
return state;
|
|
64
82
|
};
|
|
@@ -67,7 +85,7 @@ const initApi = ({
|
|
|
67
85
|
props,
|
|
68
86
|
state,
|
|
69
87
|
parent,
|
|
70
|
-
|
|
88
|
+
vm,
|
|
71
89
|
emit,
|
|
72
90
|
dispatch,
|
|
73
91
|
constants,
|
|
@@ -75,30 +93,33 @@ const initApi = ({
|
|
|
75
93
|
}) => {
|
|
76
94
|
Object.assign(api2, {
|
|
77
95
|
state,
|
|
78
|
-
focus: focus(
|
|
79
|
-
select: select(
|
|
96
|
+
focus: focus(vm),
|
|
97
|
+
select: select(vm),
|
|
80
98
|
getPrecision: getPrecision(),
|
|
81
99
|
toPrecision: toPrecision(state),
|
|
82
100
|
updated: updated({ constants, parent, state }),
|
|
83
101
|
mounted: mounted({ constants, parent, props, state }),
|
|
84
102
|
unmounted: unmounted({ parent, state }),
|
|
85
103
|
getDecimal: getDecimal(props),
|
|
86
|
-
handleFocus: handleFocus({ emit, state, props, api: api2,
|
|
104
|
+
handleFocus: handleFocus({ emit, state, props, api: api2, vm }),
|
|
87
105
|
decrease: decrease({ api: api2, props, state }),
|
|
88
106
|
increase: increase({ api: api2, props, state }),
|
|
89
107
|
handleInput: handleInput({ state, api: api2, emit, props }),
|
|
90
108
|
getNumPecision: getNumPecision({ api: api2, props }),
|
|
91
|
-
displayValue: displayValue({ props, state }),
|
|
109
|
+
displayValue: displayValue({ props, state, api: api2 }),
|
|
92
110
|
internalDecrease: internalDecrease({ api: api2, state }),
|
|
93
111
|
internalIncrease: internalIncrease({ api: api2, state }),
|
|
94
112
|
handleInputChange: handleInputChange({ api: api2, state, props }),
|
|
95
113
|
mouseEvent: mouseEvent({ api: api2, props, state }),
|
|
96
114
|
handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
|
|
97
|
-
watchValue: watchValue({ api: api2, state, nextTick }),
|
|
115
|
+
watchValue: watchValue({ api: api2, props, state, nextTick }),
|
|
98
116
|
setCurrentValue: setCurrentValue({ api: api2, constants, dispatch, emit, props, state }),
|
|
99
117
|
dispatchDisplayedValue: dispatchDisplayedValue({ api: api2, state, dispatch }),
|
|
100
118
|
getDisplayedValue: getDisplayedValue({ state, props }),
|
|
101
|
-
getDisplayOnlyText: getDisplayOnlyText({ parent, props, state })
|
|
119
|
+
getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
|
|
120
|
+
filterValue: filterValue({ state }),
|
|
121
|
+
handleClear: handleClear({ state, emit }),
|
|
122
|
+
handleChange: handleChange({ state, emit })
|
|
102
123
|
});
|
|
103
124
|
api2.getDecimal(0);
|
|
104
125
|
};
|
|
@@ -108,20 +129,24 @@ const initWatch = ({
|
|
|
108
129
|
props,
|
|
109
130
|
api: api2
|
|
110
131
|
}) => {
|
|
111
|
-
watch(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
watch(
|
|
133
|
+
() => [props.max, props.min],
|
|
134
|
+
([curMax, curMin]) => {
|
|
135
|
+
if (curMax < curMin) {
|
|
136
|
+
throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{ immediate: true }
|
|
140
|
+
);
|
|
116
141
|
watch(() => props.modelValue, api2.watchValue, { immediate: true });
|
|
117
142
|
watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
|
|
118
143
|
};
|
|
119
|
-
const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit,
|
|
144
|
+
const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, vm, constants, dispatch, service, nextTick }) => {
|
|
120
145
|
const api2 = {};
|
|
121
146
|
const $service = initService(service);
|
|
122
|
-
const state = initState({ reactive, computed, props, api: api2, $service, parent });
|
|
147
|
+
const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
|
|
123
148
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
124
|
-
initApi({ api: api2, props, state, parent,
|
|
149
|
+
initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
|
|
125
150
|
initWatch({ state, watch, props, api: api2 });
|
|
126
151
|
onMounted(() => {
|
|
127
152
|
api2.dispatchDisplayedValue();
|
package/option/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { getObj } from "../common/object";
|
|
3
|
+
import { omitText } from "../common/string";
|
|
3
4
|
const escapeRegexpString = (value = "") => String(value).replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
4
5
|
const isEqual = ({ select, state }) => (a, b) => {
|
|
5
6
|
if (!state.isObject) {
|
|
@@ -14,15 +15,26 @@ const contains = ({ select, state }) => (arr = [], target = null) => {
|
|
|
14
15
|
return arr && arr.includes(target);
|
|
15
16
|
} else {
|
|
16
17
|
const valueKey = select.valueKey;
|
|
17
|
-
return arr && arr.some((item) =>
|
|
18
|
+
return arr && arr.some((item) => {
|
|
19
|
+
return getObj(item, valueKey) === getObj(target, valueKey);
|
|
20
|
+
});
|
|
18
21
|
}
|
|
19
22
|
};
|
|
20
|
-
const handleGroupDisabled = (state) => (val) => {
|
|
23
|
+
const handleGroupDisabled = ({ state, vm }) => (val) => {
|
|
21
24
|
state.groupDisabled = val;
|
|
25
|
+
vm.groupDisabled = val;
|
|
22
26
|
};
|
|
23
|
-
const hoverItem = ({ select, props, state
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const hoverItem = ({ select, props, state }) => (e) => {
|
|
28
|
+
const dom = e.target;
|
|
29
|
+
const text = dom.textContent;
|
|
30
|
+
const style = window.getComputedStyle(dom);
|
|
31
|
+
const font = style.font;
|
|
32
|
+
const rect = dom.getBoundingClientRect();
|
|
33
|
+
const textWidth = rect.width - parseInt(style.paddingLeft || 0) - parseInt(style.paddingRight || 0);
|
|
34
|
+
const res = omitText(text, font, textWidth);
|
|
35
|
+
state.showTitle = res.o;
|
|
36
|
+
if (!props.disabled && !state.groupDisabled && !select.state.disabledOptionHover) {
|
|
37
|
+
select.state.hoverIndex = select.state.optionIndexArr.indexOf(state.index);
|
|
26
38
|
}
|
|
27
39
|
};
|
|
28
40
|
const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
|
|
@@ -32,14 +44,19 @@ const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
|
|
|
32
44
|
select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
|
|
33
45
|
}
|
|
34
46
|
};
|
|
35
|
-
const queryChange = ({ props, state }) => (query) => {
|
|
36
|
-
|
|
47
|
+
const queryChange = ({ select, props, state }) => (query) => {
|
|
48
|
+
const oldVisible = state.visible;
|
|
49
|
+
const newVisible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || !!props.created;
|
|
50
|
+
if (oldVisible !== newVisible) {
|
|
51
|
+
state.visible = newVisible;
|
|
52
|
+
select.state.filteredOptionsCount += newVisible ? 1 : -1;
|
|
53
|
+
}
|
|
37
54
|
};
|
|
38
55
|
const toggleEvent = ({ props, vm, type }) => {
|
|
39
56
|
const optionEl = vm.$refs.option;
|
|
40
|
-
|
|
57
|
+
for (let ev in props.events) {
|
|
41
58
|
optionEl[type + "EventListener"](ev, props.events[ev]);
|
|
42
|
-
}
|
|
59
|
+
}
|
|
43
60
|
};
|
|
44
61
|
const initValue = ({ select, props, constants, vm }) => () => {
|
|
45
62
|
if (select.multiple && props.required) {
|
|
@@ -48,6 +65,7 @@ const initValue = ({ select, props, constants, vm }) => () => {
|
|
|
48
65
|
};
|
|
49
66
|
export {
|
|
50
67
|
contains,
|
|
68
|
+
escapeRegexpString,
|
|
51
69
|
handleGroupDisabled,
|
|
52
70
|
hoverItem,
|
|
53
71
|
initValue,
|
package/option/vue.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-G2ADBYYC.js";
|
|
2
5
|
import {
|
|
3
6
|
isEqual,
|
|
4
7
|
contains,
|
|
@@ -16,30 +19,33 @@ const initState = ({ reactive, computed, props, api: api2, markRaw, select, pare
|
|
|
16
19
|
created: computed(() => props.created),
|
|
17
20
|
index: -1,
|
|
18
21
|
select: markRaw(select),
|
|
19
|
-
hover:
|
|
22
|
+
hover: computed(() => !state.select.optimization && state.select.state.hoverValue === state.index),
|
|
20
23
|
visible: true,
|
|
21
24
|
hitState: false,
|
|
22
25
|
groupDisabled: false,
|
|
23
|
-
disabled: computed(() => props.disabled),
|
|
26
|
+
disabled: computed(() => props.disabled || state.groupDisabled),
|
|
24
27
|
isObject: computed(() => Object.prototype.toString.call(props.value).toLowerCase() === "[object object]"),
|
|
25
28
|
currentLabel: computed(() => props.label || (state.isObject ? "" : props.value)),
|
|
29
|
+
showTitle: false,
|
|
26
30
|
currentValue: computed(() => props.value || props.label || ""),
|
|
27
31
|
itemSelected: computed(() => {
|
|
28
32
|
if (!select.multiple) {
|
|
29
|
-
return api2.isEqual(props.value, select.modelValue);
|
|
33
|
+
return api2.isEqual(props.value, select.state.modelValue);
|
|
30
34
|
} else {
|
|
31
|
-
return api2.contains(select.modelValue, props.value);
|
|
35
|
+
return api2.contains(select.state.modelValue, props.value);
|
|
32
36
|
}
|
|
33
37
|
}),
|
|
34
38
|
limitReached: computed(() => {
|
|
35
39
|
if (select.multiple) {
|
|
36
40
|
const multipleLimit = select.state.multipleLimit;
|
|
37
|
-
return !state.itemSelected && (select.modelValue || []).length >= multipleLimit && multipleLimit > 0;
|
|
41
|
+
return !state.itemSelected && (select.state.modelValue || []).length >= multipleLimit && multipleLimit > 0;
|
|
38
42
|
} else {
|
|
39
43
|
return false;
|
|
40
44
|
}
|
|
41
45
|
}),
|
|
42
|
-
selectCls: computed(() =>
|
|
46
|
+
selectCls: computed(() => {
|
|
47
|
+
return state.itemSelected ? "checked-sur" : "check";
|
|
48
|
+
})
|
|
43
49
|
});
|
|
44
50
|
return state;
|
|
45
51
|
};
|
|
@@ -48,10 +54,10 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
|
|
|
48
54
|
state,
|
|
49
55
|
isEqual: isEqual({ select, state }),
|
|
50
56
|
contains: contains({ select, state }),
|
|
51
|
-
hoverItem: hoverItem({ select,
|
|
52
|
-
queryChange: queryChange({ props, state }),
|
|
57
|
+
hoverItem: hoverItem({ select, props, state }),
|
|
58
|
+
queryChange: queryChange({ select, props, state }),
|
|
53
59
|
selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
|
|
54
|
-
handleGroupDisabled: handleGroupDisabled(state),
|
|
60
|
+
handleGroupDisabled: handleGroupDisabled({ state, vm }),
|
|
55
61
|
initValue: initValue({ select, props, constants, vm })
|
|
56
62
|
});
|
|
57
63
|
};
|
|
@@ -87,20 +93,33 @@ const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, sele
|
|
|
87
93
|
onMounted(() => {
|
|
88
94
|
state.el = vm.$el;
|
|
89
95
|
toggleEvent({ props, vm, type: "add" });
|
|
90
|
-
select.
|
|
96
|
+
if (!select.optimization) {
|
|
97
|
+
select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
|
|
98
|
+
}
|
|
91
99
|
api2.initValue();
|
|
92
100
|
});
|
|
93
101
|
};
|
|
94
|
-
const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm }) => {
|
|
102
|
+
const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm, state }) => {
|
|
95
103
|
onBeforeUnmount(() => {
|
|
96
|
-
|
|
104
|
+
let selectedOptions = select.multiple ? select.state.selected : [select.state.selected];
|
|
105
|
+
const index = select.state.cachedOptions.findIndex((opt) => opt.state === state);
|
|
106
|
+
const selectedIndex = selectedOptions.findIndex((opt) => opt.state === state);
|
|
97
107
|
toggleEvent({ props, vm, type: "remove" });
|
|
98
|
-
if (index
|
|
108
|
+
if (index > -1 && selectedIndex < 0) {
|
|
99
109
|
select.state.cachedOptions.splice(index, 1);
|
|
100
110
|
}
|
|
101
|
-
select.onOptionDestroy(select.state.options.
|
|
111
|
+
select.onOptionDestroy(select.state.options.findIndex((opt) => opt.state === state));
|
|
102
112
|
});
|
|
103
113
|
};
|
|
114
|
+
const initSelectState = ({ state, select, markRaw, props }) => {
|
|
115
|
+
let vm = __spreadProps(__spreadValues({}, props), { state });
|
|
116
|
+
select.state.options.push(markRaw(vm));
|
|
117
|
+
select.state.cachedOptions.push(markRaw(vm));
|
|
118
|
+
select.state.optionsIndex++;
|
|
119
|
+
state.index = select.state.optionsIndex;
|
|
120
|
+
select.state.optionsCount++;
|
|
121
|
+
select.state.filteredOptionsCount++;
|
|
122
|
+
};
|
|
104
123
|
const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, parent }) => {
|
|
105
124
|
const api2 = {};
|
|
106
125
|
const select = inject("select");
|
|
@@ -109,12 +128,9 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
|
|
|
109
128
|
initApi({ api: api2, props, state, select, constants, vm });
|
|
110
129
|
initWatch({ watch, props, state, select, constants });
|
|
111
130
|
initOnMounted({ onMounted, props, api: api2, vm, state, constants, select });
|
|
112
|
-
initOnBeforeUnmount({ onBeforeUnmount, props, select, vm });
|
|
113
|
-
select
|
|
114
|
-
|
|
115
|
-
select.state.optionsCount++;
|
|
116
|
-
select.state.filteredOptionsCount++;
|
|
117
|
-
vm.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
|
|
131
|
+
initOnBeforeUnmount({ onBeforeUnmount, props, select, vm, state });
|
|
132
|
+
initSelectState({ state, select, markRaw, props });
|
|
133
|
+
parent.$on(constants.EVENT_NAME.handleGroupDisabled, api2.handleGroupDisabled);
|
|
118
134
|
return api2;
|
|
119
135
|
};
|
|
120
136
|
export {
|
package/option-group/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import "../chunk-G2ADBYYC.js";
|
|
|
2
2
|
const queryChange = ({ select, state, vm }) => () => {
|
|
3
3
|
state.visible = true;
|
|
4
4
|
if (Array.isArray(select.state.options)) {
|
|
5
|
-
const groupOptions = select.state.options.filter(
|
|
6
|
-
|
|
7
|
-
);
|
|
5
|
+
const groupOptions = select.state.options.filter((option) => {
|
|
6
|
+
return option.state.parent.$parent && vm && option.state.parent.$parent.label === vm.label;
|
|
7
|
+
});
|
|
8
8
|
if (Array.isArray(groupOptions)) {
|
|
9
9
|
state.visible = groupOptions.some((option) => option.visible === true);
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.1",
|
|
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": [
|
package/pager/index.js
CHANGED
|
@@ -34,11 +34,11 @@ const computedTotalText = ({ props, t }) => () => {
|
|
|
34
34
|
const HUNDRED_THOUSAND = 1e5;
|
|
35
35
|
const MILLION = 1e6;
|
|
36
36
|
const TEN_MILLION = 1e7;
|
|
37
|
-
if (totals
|
|
37
|
+
if (totals < HUNDRED_THOUSAND) {
|
|
38
38
|
return String(totals);
|
|
39
|
-
} else if (totals
|
|
39
|
+
} else if (totals < MILLION) {
|
|
40
40
|
return t("ui.page.hundredThousand");
|
|
41
|
-
} else if (totals
|
|
41
|
+
} else if (totals < TEN_MILLION) {
|
|
42
42
|
return t("ui.page.million");
|
|
43
43
|
} else {
|
|
44
44
|
return t("ui.page.tenMillion");
|
|
@@ -61,7 +61,7 @@ const watchInternalCurrentPage = ({ state, emit }) => (currentPage) => {
|
|
|
61
61
|
if (state.jumperValue !== value) {
|
|
62
62
|
state.jumperValue = value;
|
|
63
63
|
}
|
|
64
|
-
emit("update:
|
|
64
|
+
emit("update:current-page", currentPage);
|
|
65
65
|
emit("current-change", currentPage);
|
|
66
66
|
state.lastEmittedPage = -1;
|
|
67
67
|
};
|
|
@@ -89,6 +89,17 @@ const watchPageSize = ({ state }) => (pageSize) => {
|
|
|
89
89
|
const watchTotal = ({ state }) => (total) => {
|
|
90
90
|
state.internalTotal = total;
|
|
91
91
|
};
|
|
92
|
+
const watchShowSizes = ({ nextTick, vm }) => (newVal) => {
|
|
93
|
+
if (newVal) {
|
|
94
|
+
nextTick(() => {
|
|
95
|
+
const width = vm.$refs.pageSize[0].getBoundingClientRect().width;
|
|
96
|
+
const popover = document.querySelectorAll(".tiny-pager__selector");
|
|
97
|
+
Array.from(popover).forEach((ele) => {
|
|
98
|
+
ele.style.width = width + "px";
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
92
103
|
const handleSizeChange = ({ props, state, api, emit, vm }) => (val) => {
|
|
93
104
|
val = Number(val);
|
|
94
105
|
if (val !== state.internalPageSize) {
|
|
@@ -322,6 +333,7 @@ const emitChange = ({ state, nextTick, emit }) => () => {
|
|
|
322
333
|
const setTotal = ({ state }) => (val) => {
|
|
323
334
|
state.internalTotal = val;
|
|
324
335
|
};
|
|
336
|
+
const clickSizes = () => (e) => e.stopPropagation();
|
|
325
337
|
export {
|
|
326
338
|
beforeChangeHandler,
|
|
327
339
|
beforeJumperChangeHandler,
|
|
@@ -329,6 +341,7 @@ export {
|
|
|
329
341
|
beforeSizeChangeHandler,
|
|
330
342
|
buildBeforePageChangeParam,
|
|
331
343
|
canJumperGo,
|
|
344
|
+
clickSizes,
|
|
332
345
|
computedInternalLayout,
|
|
333
346
|
computedInternalPageCount,
|
|
334
347
|
computedShowPager,
|
|
@@ -354,5 +367,6 @@ export {
|
|
|
354
367
|
watchInternalPageCount,
|
|
355
368
|
watchPageSize,
|
|
356
369
|
watchPageSizes,
|
|
370
|
+
watchShowSizes,
|
|
357
371
|
watchTotal
|
|
358
372
|
};
|
package/pager/vue.js
CHANGED
|
@@ -25,12 +25,14 @@ import {
|
|
|
25
25
|
getValidCurrentPage,
|
|
26
26
|
emitChange,
|
|
27
27
|
setTotal,
|
|
28
|
+
clickSizes,
|
|
28
29
|
watchInternalCurrentPage,
|
|
29
30
|
watchPageSizes,
|
|
30
31
|
watchCurrentPage,
|
|
31
32
|
watchInternalPageCount,
|
|
32
33
|
watchPageSize,
|
|
33
|
-
watchTotal
|
|
34
|
+
watchTotal,
|
|
35
|
+
watchShowSizes
|
|
34
36
|
} from "./index";
|
|
35
37
|
const api = [
|
|
36
38
|
"state",
|
|
@@ -54,9 +56,11 @@ const api = [
|
|
|
54
56
|
"buildBeforePageChangeParam",
|
|
55
57
|
"getValidCurrentPage",
|
|
56
58
|
"emitChange",
|
|
57
|
-
"setTotal"
|
|
59
|
+
"setTotal",
|
|
60
|
+
"clickSizes"
|
|
58
61
|
];
|
|
59
|
-
const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick, t }) => {
|
|
62
|
+
const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick, t, designConfig }) => {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
60
64
|
const api2 = {};
|
|
61
65
|
const state = reactive({
|
|
62
66
|
showSizes: false,
|
|
@@ -70,7 +74,11 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
|
|
|
70
74
|
showPager: computed(() => api2.computedShowPager()),
|
|
71
75
|
internalLayout: computed(() => api2.computedInternalLayout()),
|
|
72
76
|
totalText: computed(() => api2.computedTotalText()),
|
|
73
|
-
internalPageCount: computed(() => api2.computedInternalPageCount())
|
|
77
|
+
internalPageCount: computed(() => api2.computedInternalPageCount()),
|
|
78
|
+
showJumperSufix: (_b = (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.showJumperSufix) != null ? _b : true,
|
|
79
|
+
align: props.align || ((_c = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _c.align) || "left",
|
|
80
|
+
totalI18n: ((_d = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _d.totalI18n) || "totals",
|
|
81
|
+
totalFixedLeft: (_g = (_f = props.totalFixedLeft) != null ? _f : (_e = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _e.totalFixedLeft) != null ? _g : false
|
|
74
82
|
});
|
|
75
83
|
Object.assign(api2, {
|
|
76
84
|
state,
|
|
@@ -99,13 +107,15 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
|
|
|
99
107
|
buildBeforePageChangeParam: buildBeforePageChangeParam({ state }),
|
|
100
108
|
emitChange: emitChange({ state, nextTick, emit }),
|
|
101
109
|
setTotal: setTotal({ state }),
|
|
110
|
+
clickSizes: clickSizes(),
|
|
102
111
|
// watch
|
|
103
112
|
watchInternalCurrentPage: watchInternalCurrentPage({ state, emit }),
|
|
104
113
|
watchPageSizes: watchPageSizes({ state, props }),
|
|
105
114
|
watchCurrentPage: watchCurrentPage({ state, api: api2 }),
|
|
106
115
|
watchInternalPageCount: watchInternalPageCount({ state, api: api2 }),
|
|
107
116
|
watchPageSize: watchPageSize({ state }),
|
|
108
|
-
watchTotal: watchTotal({ state })
|
|
117
|
+
watchTotal: watchTotal({ state }),
|
|
118
|
+
watchShowSizes: watchShowSizes({ nextTick, vm })
|
|
109
119
|
});
|
|
110
120
|
state.internalCurrentPage = api2.getValidCurrentPage(props.currentPage);
|
|
111
121
|
watch(() => state.internalCurrentPage, api2.watchInternalCurrentPage);
|
|
@@ -114,6 +124,7 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
|
|
|
114
124
|
watch(() => state.internalPageCount, api2.watchInternalPageCount);
|
|
115
125
|
watch(() => props.pageSize, api2.watchPageSize, { immediate: true });
|
|
116
126
|
watch(() => props.total, api2.watchTotal);
|
|
127
|
+
watch(() => state.showSizes, api2.watchShowSizes);
|
|
117
128
|
return api2;
|
|
118
129
|
};
|
|
119
130
|
export {
|