@opentiny/vue-renderless 3.25.0 → 3.27.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/calendar-view/index.js +6 -3
- package/calendar-view/vue.js +9 -5
- package/color-picker/vue.js +4 -0
- package/color-select-panel/alpha-select/index.js +17 -12
- package/color-select-panel/alpha-select/vue.js +4 -2
- package/color-select-panel/hue-select/index.js +47 -16
- package/color-select-panel/hue-select/vue.js +32 -6
- package/color-select-panel/index.js +236 -8
- package/color-select-panel/linear-gradient/index.js +131 -0
- package/color-select-panel/linear-gradient/vue.js +21 -0
- package/color-select-panel/sv-select/index.js +12 -9
- package/color-select-panel/sv-select/vue.js +4 -2
- package/color-select-panel/utils/color-map.js +154 -0
- package/color-select-panel/utils/color-points.js +86 -0
- package/color-select-panel/utils/color.js +1 -1
- package/color-select-panel/utils/context.js +14 -0
- package/color-select-panel/vue.js +9 -4
- package/common/deps/infinite-scroll.js +1 -1
- package/dialog-box/index.js +3 -3
- package/dialog-box/vue.js +1 -0
- package/dropdown/vue.js +3 -1
- package/file-upload/index.js +3 -2
- package/file-upload/vue.js +1 -1
- package/fluent-editor/index.js +1 -1
- package/form-item/vue.js +1 -1
- package/guide/index.js +3 -3
- package/input/index.js +2 -1
- package/input/vue.js +2 -1
- package/package.json +3 -3
- package/pager/vue.js +1 -1
- package/picker/vue.js +10 -0
- package/popeditor/index.js +3 -3
- package/search/index.js +6 -2
- package/search/vue.js +1 -1
- package/select/index.js +30 -13
- package/select/vue.js +34 -10
- package/slider/vue.js +7 -0
- package/slider-button/vue.js +1 -0
- package/slider-button-group/vue.js +1 -0
- package/space/index.js +30 -0
- package/space/vue.js +39 -0
- package/tab-nav/index.js +2 -2
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +4 -1
- package/tabs-mf/vue-nav.js +9 -18
- package/tabs-mf/vue-slider-bar.js +24 -0
- package/tabs-mf/vue.js +3 -1
- package/tag/index.js +1 -1
- package/tree-menu/index.js +4 -0
- package/tree-menu/vue.js +3 -0
- package/types/button-group.type.d.ts +2 -1
- package/types/button.type.d.ts +2 -1
- package/types/color-select-panel.type.d.ts +197 -1
- package/types/dialog-box.type.d.ts +4 -11
- package/types/numeric.type.d.ts +1 -1
- package/types/pager.type.d.ts +2 -1
- package/types/picker.type.d.ts +4 -0
- package/types/radio-button.type.d.ts +1 -0
- package/types/radio-group.type.d.ts +2 -1
- package/types/radio.type.d.ts +2 -1
- package/types/slider.type.d.ts +2 -1
- package/types/space.type.d.ts +31 -0
- package/types/switch.type.d.ts +1 -1
- package/types/tabs.type.d.ts +2 -0
- package/types/user-contact.type.d.ts +1 -11
- package/user/index.js +6 -5
- package/user/vue.js +1 -1
package/input/vue.js
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "./index";
|
|
42
42
|
import useStorageBox from "../tall-storage/vue-storage-box";
|
|
43
43
|
import { on, off } from "@opentiny/utils";
|
|
44
|
+
import { debounce } from "@opentiny/utils";
|
|
44
45
|
const api = [
|
|
45
46
|
"blur",
|
|
46
47
|
"showBox",
|
|
@@ -221,7 +222,7 @@ const mergeApi = ({
|
|
|
221
222
|
}),
|
|
222
223
|
handleFocus: handleFocus({ api: api2, emit, state }),
|
|
223
224
|
handleInput: handleInput({ api: api2, emit, nextTick, state }),
|
|
224
|
-
resizeTextarea: resizeTextarea({ api: api2, parent, vm, state, props }),
|
|
225
|
+
resizeTextarea: debounce(200, resizeTextarea({ api: api2, parent, vm, state, props })),
|
|
225
226
|
updateIconOffset: updateIconOffset(api2),
|
|
226
227
|
calcTextareaHeight: calcTextareaHeight({
|
|
227
228
|
api: api2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"author": "OpenTiny Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/utils": "~3.
|
|
29
|
-
"@opentiny/vue-hooks": "~3.
|
|
28
|
+
"@opentiny/utils": "~3.27.0",
|
|
29
|
+
"@opentiny/vue-hooks": "~3.27.0",
|
|
30
30
|
"color": "4.2.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/pager/vue.js
CHANGED
|
@@ -135,8 +135,8 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
|
|
|
135
135
|
watchShowSizes: watchShowSizes({ nextTick, vm }),
|
|
136
136
|
watchInternalPageSize: watchInternalPageSize({ emit, props })
|
|
137
137
|
});
|
|
138
|
-
state.internalCurrentPage = api2.getValidCurrentPage(props.currentPage);
|
|
139
138
|
state.internalPageSize = api2.getInternalPageSize();
|
|
139
|
+
state.internalCurrentPage = api2.getValidCurrentPage(props.currentPage);
|
|
140
140
|
watch(() => state.internalCurrentPage, api2.watchInternalCurrentPage);
|
|
141
141
|
watch(() => state.internalPageSize, api2.watchInternalPageSize);
|
|
142
142
|
watch(() => props.currentPage, api2.watchCurrentPage);
|
package/picker/vue.js
CHANGED
|
@@ -150,6 +150,10 @@ const initState = ({ api: api2, reactive, vm, computed, props, utils, parent, br
|
|
|
150
150
|
),
|
|
151
151
|
showSeconds: computed(
|
|
152
152
|
() => (state.format || props.pickerOptions && props.pickerOptions.format || "ss").includes("ss")
|
|
153
|
+
),
|
|
154
|
+
innerWidth: 0,
|
|
155
|
+
breakLine: computed(
|
|
156
|
+
() => (state.innerWidth < 230 && state.type === "daterange" || state.innerWidth < 335 && state.type === "datetimerange") && state.displayValue && state.displayValue[1]
|
|
153
157
|
)
|
|
154
158
|
});
|
|
155
159
|
return state;
|
|
@@ -271,8 +275,13 @@ const renderless = (props, hooks, vnode, others) => {
|
|
|
271
275
|
initApi({ api: api2, props, hooks, state, vnode, others, utils, parent, isPCMode });
|
|
272
276
|
initWatch({ api: api2, state, props, watch, markRaw });
|
|
273
277
|
api2.initGlobalTimezone();
|
|
278
|
+
const resizeHandler = () => {
|
|
279
|
+
state.innerWidth = vm.$refs.reference.offsetWidth;
|
|
280
|
+
};
|
|
274
281
|
onMounted(() => {
|
|
275
282
|
api2.setInputPaddingLeft();
|
|
283
|
+
state.innerWidth = vm.$refs.reference.offsetWidth;
|
|
284
|
+
window.addEventListener("resize", resizeHandler);
|
|
276
285
|
});
|
|
277
286
|
parent.$on("handle-clear", (event) => {
|
|
278
287
|
state.showClose = true;
|
|
@@ -280,6 +289,7 @@ const renderless = (props, hooks, vnode, others) => {
|
|
|
280
289
|
});
|
|
281
290
|
onBeforeUnmount(() => {
|
|
282
291
|
api2.destroyPopper("remove");
|
|
292
|
+
window.removeEventListener("resize", resizeHandler);
|
|
283
293
|
state.popperElm = null;
|
|
284
294
|
state.picker = null;
|
|
285
295
|
});
|
package/popeditor/index.js
CHANGED
|
@@ -106,9 +106,6 @@ const handleConfirm = ({ api, constants, emit, props, state }) => (skipBeforeClo
|
|
|
106
106
|
if (skipBeforeClose !== true && typeof props.beforeClose === "function" && props.beforeClose("confirm") === false) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
if (props.autoReset) {
|
|
110
|
-
handleReset({ api, state, props })();
|
|
111
|
-
}
|
|
112
109
|
if (props.popseletor === constants.TYPE_GRID) {
|
|
113
110
|
props.multi ? api.getMultiSelectedData({ props, state }) : api.getRadioSelectedData();
|
|
114
111
|
if (!isNull(state.commitValue)) {
|
|
@@ -130,6 +127,9 @@ const handleConfirm = ({ api, constants, emit, props, state }) => (skipBeforeClo
|
|
|
130
127
|
emit("change", commitValue, state.treeSelectList);
|
|
131
128
|
}
|
|
132
129
|
}
|
|
130
|
+
if (props.autoReset) {
|
|
131
|
+
handleReset({ api, state, props })();
|
|
132
|
+
}
|
|
133
133
|
state.open = false;
|
|
134
134
|
};
|
|
135
135
|
const handleReset = ({ api, state, props }) => () => {
|
package/search/index.js
CHANGED
|
@@ -27,6 +27,7 @@ const searchClick = ({ emit, props, state }) => (event) => {
|
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
if (props.mini && state.collapse) {
|
|
29
29
|
state.collapse = false;
|
|
30
|
+
emit("expand");
|
|
30
31
|
} else {
|
|
31
32
|
emit("search", state.searchValue, state.currentValue);
|
|
32
33
|
}
|
|
@@ -37,11 +38,14 @@ const searchEnterKey = ({ api, props, vm, nextTick }) => (event) => {
|
|
|
37
38
|
nextTick(() => vm.$refs.input.blur());
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
const clickOutside = ({ parent, props, state }) => (event) => {
|
|
41
|
+
const clickOutside = ({ parent, props, state, emit }) => (event) => {
|
|
41
42
|
const path = (event == null ? void 0 : event.composedPath) && event.composedPath();
|
|
42
43
|
if (path ? !path.includes(parent.$el) : !parent.$el.contains(event.target)) {
|
|
43
44
|
state.show = false;
|
|
44
|
-
props.mini && !state.currentValue &&
|
|
45
|
+
if (props.mini && !state.currentValue && !state.collapse) {
|
|
46
|
+
state.collapse = true;
|
|
47
|
+
emit("collapse");
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
51
|
const setDefaultType = (searchTypes, typeValue) => {
|
package/search/vue.js
CHANGED
|
@@ -76,7 +76,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, toR
|
|
|
76
76
|
handleChange: handleChange({ emit, state }),
|
|
77
77
|
showSelector: showSelector({ vm, state }),
|
|
78
78
|
searchClick: searchClick({ emit, props, state }),
|
|
79
|
-
clickOutside: clickOutside({ parent, props, state }),
|
|
79
|
+
clickOutside: clickOutside({ parent, props, state, emit }),
|
|
80
80
|
emitInput: emitInput({ emit })
|
|
81
81
|
}, formatSearchTypes2.api);
|
|
82
82
|
Object.assign(api2, {
|
package/select/index.js
CHANGED
|
@@ -179,8 +179,8 @@ const handleMenuEnter = ({ api, nextTick, state, props }) => () => {
|
|
|
179
179
|
nextTick(() => api.scrollToOption(state.selected));
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
|
|
183
|
-
if (state.device === "mb" && props.multiple && !changed)
|
|
182
|
+
const emitChange = ({ emit, props, state, constants, isMobileFirstMode }) => (value, changed) => {
|
|
183
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple && !changed)
|
|
184
184
|
return;
|
|
185
185
|
const seekItem = (val, arr, items, flag) => {
|
|
186
186
|
if (constants.TYPE.Tree === flag) {
|
|
@@ -220,8 +220,8 @@ const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
const directEmitChange = ({ emit, props, state }) => (value, key) => {
|
|
224
|
-
if (state.device === "mb" && props.multiple)
|
|
223
|
+
const directEmitChange = ({ emit, props, state, isMobileFirstMode }) => (value, key) => {
|
|
224
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple)
|
|
225
225
|
return;
|
|
226
226
|
emit("change", value, key);
|
|
227
227
|
};
|
|
@@ -1101,7 +1101,7 @@ const toHide = ({ constants, state, props, vm, api }) => () => {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
|
-
const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) => {
|
|
1104
|
+
const watchVisible = ({ api, constants, emit, state, vm, props, isMobileFirstMode }) => (value) => {
|
|
1105
1105
|
var _a;
|
|
1106
1106
|
if ((props.filterable || props.searchable || props.remote) && !value) {
|
|
1107
1107
|
(_a = vm.$refs.reference) == null ? void 0 : _a.blur();
|
|
@@ -1109,7 +1109,7 @@ const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) =>
|
|
|
1109
1109
|
if (api.onCopying()) {
|
|
1110
1110
|
return;
|
|
1111
1111
|
}
|
|
1112
|
-
if (value && props.multiple && state.device === "mb") {
|
|
1112
|
+
if (value && props.multiple && isMobileFirstMode && state.device === "mb") {
|
|
1113
1113
|
state.selectedCopy = state.selected.slice();
|
|
1114
1114
|
}
|
|
1115
1115
|
setTimeout(() => {
|
|
@@ -1147,12 +1147,28 @@ const watchOptions = ({ api, constants, nextTick, parent, props, state }) => ()
|
|
|
1147
1147
|
api.resetInputHeight();
|
|
1148
1148
|
}
|
|
1149
1149
|
nextTick(() => {
|
|
1150
|
-
|
|
1150
|
+
var _a;
|
|
1151
|
+
if (parent.$el.querySelector("input") !== document.activeElement && // filterable时, 从 input 框离开了
|
|
1152
|
+
!(((_a = document.activeElement) == null ? void 0 : _a.classList.contains("tiny-input__inner")) && // 并且当前不在下拉面板的searchable 的input中时, 才需要更新一下setSelect
|
|
1153
|
+
document.activeElement.closest(".tiny-select-dropdown__search"))) {
|
|
1151
1154
|
api.setSelected();
|
|
1152
1155
|
}
|
|
1153
1156
|
});
|
|
1154
1157
|
api.getOptionIndexArr();
|
|
1155
1158
|
};
|
|
1159
|
+
const watchOptionsWhenAutoSelect = ({ nextTick, props, state, api }) => () => {
|
|
1160
|
+
if (props.autoSelect && props.remote) {
|
|
1161
|
+
nextTick(() => {
|
|
1162
|
+
var _a, _b;
|
|
1163
|
+
if (((_a = props.options) == null ? void 0 : _a.length) === 1 || state.options.length === 1) {
|
|
1164
|
+
const { valueField } = props;
|
|
1165
|
+
const option = ((_b = props.options) == null ? void 0 : _b.length) === 1 ? props.options[0] : state.options[0];
|
|
1166
|
+
api.updateModelValue(props.multiple ? [option[props.valueField]] : option[props.valueField]);
|
|
1167
|
+
state.visible = false;
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1156
1172
|
const getOptionIndexArr = ({ props, state, api }) => () => {
|
|
1157
1173
|
setTimeout(() => {
|
|
1158
1174
|
state.optionIndexArr = api.queryVisibleOptions().map((item) => Number(item.getAttribute("data-index")));
|
|
@@ -1586,9 +1602,9 @@ const computeMultipleLimit = ({ props, state }) => () => {
|
|
|
1586
1602
|
const { optimizeOpts } = state;
|
|
1587
1603
|
return optmzApis.natural(multiple && optimization ? multipleLimit || optimizeOpts.limit : multipleLimit);
|
|
1588
1604
|
};
|
|
1589
|
-
const updateModelValue = ({ props, emit, state }) => (value, needUpdate) => {
|
|
1605
|
+
const updateModelValue = ({ props, emit, state, isMobileFirstMode }) => (value, needUpdate) => {
|
|
1590
1606
|
state.isClickChoose = true;
|
|
1591
|
-
if (state.device === "mb" && props.multiple && !needUpdate) {
|
|
1607
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple && !needUpdate) {
|
|
1592
1608
|
state.modelValue = value;
|
|
1593
1609
|
} else {
|
|
1594
1610
|
emit("update:modelValue", value);
|
|
@@ -1626,17 +1642,17 @@ const computedTagsStyle = ({ props, parent, state, vm }) => () => {
|
|
|
1626
1642
|
}
|
|
1627
1643
|
return tagsStyle;
|
|
1628
1644
|
};
|
|
1629
|
-
const computedReadonly = ({ props, state }) => () => {
|
|
1645
|
+
const computedReadonly = ({ props, state, isMobileFirstMode }) => () => {
|
|
1630
1646
|
if (state.isIOS && props.filterable) {
|
|
1631
1647
|
return false;
|
|
1632
1648
|
} else {
|
|
1633
|
-
return state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1649
|
+
return isMobileFirstMode && state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1634
1650
|
}
|
|
1635
1651
|
};
|
|
1636
1652
|
const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && (state.inputHovering || props.multiple && state.visible) && (props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "");
|
|
1637
1653
|
const computedCollapseTagSize = (state) => () => state.selectSize;
|
|
1638
|
-
const computedShowNewOption = ({ props, state }) => () => {
|
|
1639
|
-
const query = state.device === "mb" ? state.queryValue : state.query;
|
|
1654
|
+
const computedShowNewOption = ({ props, state, isMobileFirstMode }) => () => {
|
|
1655
|
+
const query = isMobileFirstMode && state.device === "mb" ? state.queryValue : state.query;
|
|
1640
1656
|
return (props.filterable || props.searchable) && props.allowCreate && query && !state.options.filter((option) => !option.created).some((option) => option.state.currentLabel === state.query);
|
|
1641
1657
|
};
|
|
1642
1658
|
const computedShowCopy = ({ props, state }) => () => props.multiple && props.copyable && state.inputHovering && state.selected.length;
|
|
@@ -1845,6 +1861,7 @@ export {
|
|
|
1845
1861
|
watchInputHover,
|
|
1846
1862
|
watchOptimizeOpts,
|
|
1847
1863
|
watchOptions,
|
|
1864
|
+
watchOptionsWhenAutoSelect,
|
|
1848
1865
|
watchPropsOption,
|
|
1849
1866
|
watchShowClose,
|
|
1850
1867
|
watchValue,
|
package/select/vue.js
CHANGED
|
@@ -113,7 +113,8 @@ import {
|
|
|
113
113
|
computedIsExpand,
|
|
114
114
|
computedShowTagText,
|
|
115
115
|
isTagClosable,
|
|
116
|
-
computedCurrentSizeMap
|
|
116
|
+
computedCurrentSizeMap,
|
|
117
|
+
watchOptionsWhenAutoSelect
|
|
117
118
|
} from "./index";
|
|
118
119
|
import { debounce } from "@opentiny/utils";
|
|
119
120
|
import { isNumber } from "@opentiny/utils";
|
|
@@ -183,7 +184,19 @@ const api = [
|
|
|
183
184
|
"computedShowTagText",
|
|
184
185
|
"isTagClosable"
|
|
185
186
|
];
|
|
186
|
-
const initState = ({
|
|
187
|
+
const initState = ({
|
|
188
|
+
reactive,
|
|
189
|
+
computed,
|
|
190
|
+
props,
|
|
191
|
+
api: api2,
|
|
192
|
+
emitter,
|
|
193
|
+
parent,
|
|
194
|
+
constants,
|
|
195
|
+
isMobileFirstMode,
|
|
196
|
+
useBreakpoint,
|
|
197
|
+
vm,
|
|
198
|
+
designConfig
|
|
199
|
+
}) => {
|
|
187
200
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
188
201
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
189
202
|
selectEmitter: emitter(),
|
|
@@ -224,10 +237,13 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
224
237
|
selectedCopy: [],
|
|
225
238
|
compareValue: null,
|
|
226
239
|
selectedVal: computed(
|
|
227
|
-
() => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
240
|
+
() => isMobileFirstMode && state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
228
241
|
),
|
|
229
242
|
displayOnlyContent: computed(() => {
|
|
230
243
|
var _a;
|
|
244
|
+
if (vm.$slots.reference) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
231
247
|
if (props.multiple) {
|
|
232
248
|
if (Array.isArray(state.selected)) {
|
|
233
249
|
if (state.isDisplayOnly && props.options && props.options.length > 0) {
|
|
@@ -269,7 +285,11 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
269
285
|
return true;
|
|
270
286
|
})(),
|
|
271
287
|
designConfig,
|
|
272
|
-
currentSizeMap: computed(() => api2.computedCurrentSizeMap())
|
|
288
|
+
currentSizeMap: computed(() => api2.computedCurrentSizeMap()),
|
|
289
|
+
rootAutoTipConfig: computed(() => __spreadValues({
|
|
290
|
+
content: state.displayOnlyContent,
|
|
291
|
+
always: !!state.displayOnlyContent
|
|
292
|
+
}, props.tooltipConfig))
|
|
273
293
|
}));
|
|
274
294
|
return state;
|
|
275
295
|
};
|
|
@@ -368,8 +388,8 @@ const initApi = ({
|
|
|
368
388
|
getChildValue: getChildValue(),
|
|
369
389
|
getOption: getOption({ props, state, api: api2 }),
|
|
370
390
|
getSelectedOption: getSelectedOption({ props, state }),
|
|
371
|
-
emitChange: emitChange({ emit, props, state, constants }),
|
|
372
|
-
directEmitChange: directEmitChange({ emit, props, state, constants }),
|
|
391
|
+
emitChange: emitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
392
|
+
directEmitChange: directEmitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
373
393
|
toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
|
|
374
394
|
showTip: showTip({ props, state, vm }),
|
|
375
395
|
onOptionDestroy: onOptionDestroy(state),
|
|
@@ -410,12 +430,12 @@ const initApi = ({
|
|
|
410
430
|
computeMultipleLimit: computeMultipleLimit({ props, state }),
|
|
411
431
|
watchInputHover: watchInputHover({ vm }),
|
|
412
432
|
initQuery: initQuery({ props, state, constants, vm }),
|
|
413
|
-
updateModelValue: updateModelValue({ props, emit, state }),
|
|
433
|
+
updateModelValue: updateModelValue({ props, emit, state, isMobileFirstMode }),
|
|
414
434
|
computedTagsStyle: computedTagsStyle({ props, parent, state, vm }),
|
|
415
|
-
computedReadonly: computedReadonly({ props, state }),
|
|
435
|
+
computedReadonly: computedReadonly({ props, state, isMobileFirstMode }),
|
|
416
436
|
computedShowClose: computedShowClose({ props, state }),
|
|
417
437
|
computedCollapseTagSize: computedCollapseTagSize(state),
|
|
418
|
-
computedShowNewOption: computedShowNewOption({ props, state }),
|
|
438
|
+
computedShowNewOption: computedShowNewOption({ props, state, isMobileFirstMode }),
|
|
419
439
|
computedShowCopy: computedShowCopy({ props, state }),
|
|
420
440
|
computedOptionsAllDisabled: computedOptionsAllDisabled(state),
|
|
421
441
|
computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
|
|
@@ -431,7 +451,8 @@ const initApi = ({
|
|
|
431
451
|
clearNoMatchValue: clearNoMatchValue({ props, emit }),
|
|
432
452
|
computedShowTagText: computedShowTagText({ state }),
|
|
433
453
|
isTagClosable: isTagClosable(),
|
|
434
|
-
computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig })
|
|
454
|
+
computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig }),
|
|
455
|
+
watchOptionsWhenAutoSelect: watchOptionsWhenAutoSelect({ state, props, nextTick, api: api2 })
|
|
435
456
|
});
|
|
436
457
|
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
|
|
437
458
|
};
|
|
@@ -567,6 +588,8 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
|
567
588
|
};
|
|
568
589
|
const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
569
590
|
watch(() => [...state.options], api2.watchOptions);
|
|
591
|
+
watch(() => state.options, api2.watchOptionsWhenAutoSelect);
|
|
592
|
+
props.options && watch(() => props.options, api2.watchOptionsWhenAutoSelect);
|
|
570
593
|
if (props.renderType === "grid" && !props.optimization) {
|
|
571
594
|
watch(() => state.gridData, api2.setSelected, { immediate: true });
|
|
572
595
|
}
|
|
@@ -593,6 +616,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
593
616
|
emitter,
|
|
594
617
|
parent,
|
|
595
618
|
constants,
|
|
619
|
+
isMobileFirstMode,
|
|
596
620
|
useBreakpoint,
|
|
597
621
|
vm,
|
|
598
622
|
designConfig
|
package/slider/vue.js
CHANGED
|
@@ -172,6 +172,13 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
172
172
|
api2.setActiveButtonValue(value);
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
|
+
watch(
|
|
176
|
+
() => props.vertical,
|
|
177
|
+
() => {
|
|
178
|
+
api2.setBarStyle();
|
|
179
|
+
api2.setButtonStyle();
|
|
180
|
+
}
|
|
181
|
+
);
|
|
175
182
|
watch(
|
|
176
183
|
() => state.leftBtnValue,
|
|
177
184
|
(newVal) => {
|
package/slider-button/vue.js
CHANGED
|
@@ -4,6 +4,7 @@ const api = ["state", "handleChange"];
|
|
|
4
4
|
const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount, watch }, { emit, parent, dispatch, constants, nextTick, vm }) => {
|
|
5
5
|
const state = reactive({
|
|
6
6
|
disabled: inject("disabled", null) || props.disabled,
|
|
7
|
+
displayed: inject("displayed", null) || props.displayed,
|
|
7
8
|
type: inject("sliderType", null),
|
|
8
9
|
value: computed({
|
|
9
10
|
get: () => api2.getValue(),
|
|
@@ -47,6 +47,7 @@ const renderless = (props, { reactive, provide, onMounted, onBeforeUnmount, watc
|
|
|
47
47
|
provide("sliderType", props.type);
|
|
48
48
|
provide("sliderSize", props.size);
|
|
49
49
|
provide("disabled", props.disabled);
|
|
50
|
+
provide("displayed", props.displayed);
|
|
50
51
|
onMounted(() => {
|
|
51
52
|
api2.getChangePosition(props.modelValue);
|
|
52
53
|
api2.watchVisible();
|
package/space/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const sizeMap = {
|
|
3
|
+
small: "8px",
|
|
4
|
+
medium: "16px",
|
|
5
|
+
large: "24px"
|
|
6
|
+
};
|
|
7
|
+
const parseGap = (gap) => {
|
|
8
|
+
if (typeof gap === "number")
|
|
9
|
+
return `${gap}px`;
|
|
10
|
+
if (gap in sizeMap)
|
|
11
|
+
return sizeMap[gap];
|
|
12
|
+
if (typeof gap === "string")
|
|
13
|
+
return gap;
|
|
14
|
+
return "0px";
|
|
15
|
+
};
|
|
16
|
+
const getGapStyle = (props) => {
|
|
17
|
+
const gapProp = props.size;
|
|
18
|
+
if (Array.isArray(gapProp)) {
|
|
19
|
+
const [horizontal, vertical] = gapProp;
|
|
20
|
+
return {
|
|
21
|
+
gap: `${parseGap(vertical)} ${parseGap(horizontal)}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
gap: parseGap(gapProp)
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
getGapStyle
|
|
30
|
+
};
|
package/space/vue.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { getGapStyle } from "./index";
|
|
3
|
+
const api = ["state", "orderedChildren"];
|
|
4
|
+
function isVNodeFn(node) {
|
|
5
|
+
return !!(node && (node.__v_isVNode || node.componentOptions));
|
|
6
|
+
}
|
|
7
|
+
const renderless = (props, hooks, { slots }) => {
|
|
8
|
+
const { reactive, computed } = hooks;
|
|
9
|
+
const state = reactive({
|
|
10
|
+
gapStyle: computed(() => getGapStyle(props))
|
|
11
|
+
});
|
|
12
|
+
const orderedChildren = computed(() => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const children = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
|
|
15
|
+
const validChildren = children.filter((v) => {
|
|
16
|
+
if (!isVNodeFn(v))
|
|
17
|
+
return false;
|
|
18
|
+
const type = v.type;
|
|
19
|
+
return type !== "Comment" && type !== Symbol.for("v-comment");
|
|
20
|
+
});
|
|
21
|
+
if (!((_b = props.order) == null ? void 0 : _b.length))
|
|
22
|
+
return validChildren;
|
|
23
|
+
const map = {};
|
|
24
|
+
validChildren.forEach((child) => {
|
|
25
|
+
var _a2, _b2, _c;
|
|
26
|
+
const key = (_c = child.key) != null ? _c : Array.isArray((_a2 = child.props) == null ? void 0 : _a2.class) ? child.props.class.join(" ") : (_b2 = child.props) == null ? void 0 : _b2.class;
|
|
27
|
+
if (key)
|
|
28
|
+
map[String(key)] = child;
|
|
29
|
+
});
|
|
30
|
+
const sorted = props.order.map((k) => map[k]).filter(Boolean);
|
|
31
|
+
const rest = validChildren.filter((v) => !props.order.includes(String(v.key)));
|
|
32
|
+
return [...sorted, ...rest];
|
|
33
|
+
});
|
|
34
|
+
return { state, orderedChildren };
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
api,
|
|
38
|
+
renderless
|
|
39
|
+
};
|
package/tab-nav/index.js
CHANGED
|
@@ -301,11 +301,11 @@ const watchCurrentName = ({ nextTick, vm, state }) => () => {
|
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
303
|
const handleTitleMouseenter = ({ state, vm, props }) => (e, title) => {
|
|
304
|
-
const dom = e.target;
|
|
305
|
-
const el = title == null ? void 0 : title.el;
|
|
306
304
|
if (props.tooltipConfig) {
|
|
307
305
|
return;
|
|
308
306
|
}
|
|
307
|
+
const dom = e.target;
|
|
308
|
+
const el = title == null ? void 0 : title.el;
|
|
309
309
|
if (dom && el && el.scrollWidth > el.offsetWidth) {
|
|
310
310
|
const tooltip = vm.$refs.tooltip;
|
|
311
311
|
tooltip.state.referenceElm = dom;
|
package/tabs/vue.js
CHANGED
package/tabs-mf/index.js
CHANGED
|
@@ -203,7 +203,10 @@ const wheelListener = ({ vm, api, tabs, state }) => debounce(10, (e) => {
|
|
|
203
203
|
Object.assign(state, { moreList, moreLeft, moreRight });
|
|
204
204
|
});
|
|
205
205
|
const getBoundRect = (vm) => () => vm.$el.getBoundingClientRect();
|
|
206
|
-
const handleClickDropdownItem = (tabs) => (
|
|
206
|
+
const handleClickDropdownItem = (tabs) => (navItem, event) => {
|
|
207
|
+
tabs.$emit("click", navItem, event);
|
|
208
|
+
tabs.clickMore(navItem.name);
|
|
209
|
+
};
|
|
207
210
|
const scrollToLeft = (tabs) => () => {
|
|
208
211
|
tabs.scrollTo(tabs.state.navs[0].name);
|
|
209
212
|
};
|
package/tabs-mf/vue-nav.js
CHANGED
|
@@ -6,37 +6,28 @@ const renderless = (props, { reactive, inject, computed, onMounted, onBeforeUnmo
|
|
|
6
6
|
navItems: computed(() => tabs.state.items),
|
|
7
7
|
currentNav: computed(() => tabs.state.navs[state.currentIndex]),
|
|
8
8
|
currentIndex: computed(
|
|
9
|
-
() => tabs.state.navs.findIndex((item) => tabs.state.
|
|
9
|
+
() => tabs.state.navs.findIndex((item) => tabs.state.cacheCurrentItem && tabs.state.cacheCurrentItem.name === item.name)
|
|
10
10
|
),
|
|
11
11
|
currentWidth: 0,
|
|
12
12
|
currentPosition: 0
|
|
13
13
|
});
|
|
14
|
-
let
|
|
14
|
+
let observer;
|
|
15
15
|
onMounted(() => {
|
|
16
16
|
observer = new MutationObserver((mutationsList) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cancelAnimationFrame(rafId);
|
|
21
|
-
}
|
|
22
|
-
rafId = requestAnimationFrame(() => {
|
|
23
|
-
const nav = state.currentNav;
|
|
24
|
-
state.currentWidth = nav && nav.$el.offsetWidth || 0;
|
|
25
|
-
state.currentPosition = nav && nav.$el.offsetLeft || 0;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
17
|
+
const nav = state.currentNav;
|
|
18
|
+
state.currentWidth = nav && nav.$el.offsetWidth || 0;
|
|
19
|
+
state.currentPosition = nav && nav.$el.offsetLeft || 0;
|
|
29
20
|
});
|
|
30
21
|
observer.observe(vm.$el, { attributes: true, subtree: true });
|
|
31
22
|
});
|
|
32
23
|
onBeforeUnmount(() => {
|
|
33
|
-
if (rafId) {
|
|
34
|
-
cancelAnimationFrame(rafId);
|
|
35
|
-
}
|
|
36
24
|
observer.disconnect();
|
|
37
25
|
observer = null;
|
|
38
26
|
});
|
|
39
|
-
|
|
27
|
+
Object.assign(api, {
|
|
28
|
+
state
|
|
29
|
+
});
|
|
30
|
+
return api;
|
|
40
31
|
};
|
|
41
32
|
export {
|
|
42
33
|
api,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const api = ["state"];
|
|
3
|
+
const renderless = (props, { reactive, inject, computed, onMounted, onUnmounted, onUpdated }, { vm, emit }) => {
|
|
4
|
+
const tabs = inject("tabs", null);
|
|
5
|
+
const state = reactive({
|
|
6
|
+
currentNav: computed(() => props.currentNav || null),
|
|
7
|
+
currentWidth: computed(() => props.currentWidth + "px"),
|
|
8
|
+
currentPosition: computed(() => props.currentPosition + "px")
|
|
9
|
+
});
|
|
10
|
+
const handleTransitionEnd = () => {
|
|
11
|
+
tabs.state.currentItem = tabs.state.cacheCurrentItem;
|
|
12
|
+
};
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
vm.$el.addEventListener("transitionend", handleTransitionEnd);
|
|
15
|
+
});
|
|
16
|
+
onUnmounted(() => {
|
|
17
|
+
vm.$el.removeEventListener("transitionend", handleTransitionEnd);
|
|
18
|
+
});
|
|
19
|
+
return { state };
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
api,
|
|
23
|
+
renderless
|
|
24
|
+
};
|
package/tabs-mf/vue.js
CHANGED
|
@@ -37,7 +37,8 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
37
37
|
const state = reactive({
|
|
38
38
|
items: [],
|
|
39
39
|
navs: [],
|
|
40
|
-
currentItem:
|
|
40
|
+
currentItem: null,
|
|
41
|
+
cacheCurrentItem: computed(() => state.items.find((item) => item.selected)),
|
|
41
42
|
key: computed(() => state.currentItem ? state.currentItem.name : random()),
|
|
42
43
|
separator: props.separator,
|
|
43
44
|
swipeable: computed(() => api2.computedSwipeable()),
|
|
@@ -83,6 +84,7 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
83
84
|
);
|
|
84
85
|
onMounted(() => {
|
|
85
86
|
nextTick(() => api2.observeTabSwipeSize());
|
|
87
|
+
state.currentItem = state.cacheCurrentItem;
|
|
86
88
|
props.activeName && api2.scrollTo(props.activeName);
|
|
87
89
|
props.modelValue && api2.scrollTo(props.modelValue);
|
|
88
90
|
});
|
package/tag/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const handleClose = ({ emit, props, state }) => (event) => {
|
|
|
8
8
|
props.beforeDelete ? props.beforeDelete(close) : close();
|
|
9
9
|
};
|
|
10
10
|
const handleClick = ({ emit, props, parent, state }) => (event) => {
|
|
11
|
-
if (props.
|
|
11
|
+
if (props.disabled)
|
|
12
12
|
return;
|
|
13
13
|
parent.$parent && parent.$parent.tagSelectable && event.stopPropagation();
|
|
14
14
|
state.selected = !state.selected;
|
package/tree-menu/index.js
CHANGED
|
@@ -56,6 +56,9 @@ const watchFilterText = ({ vm }) => (value) => {
|
|
|
56
56
|
const nodeDragStart = (emit) => (node, event) => {
|
|
57
57
|
emit("node-drag-start", node, event);
|
|
58
58
|
};
|
|
59
|
+
const inputChange = ({ emit, state }) => () => {
|
|
60
|
+
emit("input-change", state.filterText);
|
|
61
|
+
};
|
|
59
62
|
const nodeDragEnter = (emit) => (dragNode, dropNode, event) => {
|
|
60
63
|
emit("node-drag-enter", dragNode, dropNode, event);
|
|
61
64
|
};
|
|
@@ -155,6 +158,7 @@ export {
|
|
|
155
158
|
getTree,
|
|
156
159
|
handleToggleMenu,
|
|
157
160
|
initData,
|
|
161
|
+
inputChange,
|
|
158
162
|
nodeClick,
|
|
159
163
|
nodeCollapse,
|
|
160
164
|
nodeDragEnd,
|
package/tree-menu/vue.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
watchFilterText,
|
|
7
7
|
nodeDragStart,
|
|
8
8
|
nodeDragEnter,
|
|
9
|
+
inputChange,
|
|
9
10
|
nodeDragOver,
|
|
10
11
|
nodeDragEnd,
|
|
11
12
|
nodeDrop,
|
|
@@ -35,6 +36,7 @@ const api = [
|
|
|
35
36
|
"filterNode",
|
|
36
37
|
"nodeDragStart",
|
|
37
38
|
"nodeDragEnter",
|
|
39
|
+
"inputChange",
|
|
38
40
|
"nodeDragOver",
|
|
39
41
|
"nodeDragEnd",
|
|
40
42
|
"nodeDrop",
|
|
@@ -86,6 +88,7 @@ const renderless = (props, { computed, watch, reactive, onMounted }, { t, servic
|
|
|
86
88
|
nodeDragOver: nodeDragOver(emit),
|
|
87
89
|
nodeDragStart: nodeDragStart(emit),
|
|
88
90
|
nodeDragEnter: nodeDragEnter(emit),
|
|
91
|
+
inputChange: inputChange({ emit, state }),
|
|
89
92
|
currentChange: currentChange(emit),
|
|
90
93
|
watchFilterText: watchFilterText({ vm }),
|
|
91
94
|
getTitle: getTitle(props),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
import { PropType } from '@opentiny/vue-common';
|
|
2
3
|
import { IButtonGroupNode as IButtonGroupNode$1 } from '@opentiny/vue-renderless/types/button-group.type';
|
|
3
4
|
import { ISharedRenderlessFunctionParams, ISharedRenderlessParamUtils } from './shared.type.js';
|
|
4
5
|
|