@opentiny/vue-renderless 3.13.1 → 3.13.2
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/package.json +1 -1
- package/select/index.js +30 -24
- package/select/vue.js +5 -3
- package/tree-menu/index.js +2 -2
- package/types/date-picker.type.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
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/select/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const gridOnQueryChange = ({ props, vm, constants, state }) => (value) => {
|
|
|
69
69
|
state.remoteData = data.filter((row) => !~selectedIds.indexOf(row[valueField])).concat(state.selected);
|
|
70
70
|
} else {
|
|
71
71
|
vm.$refs.selectGrid.clearRadioRow();
|
|
72
|
-
vm.$refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue
|
|
72
|
+
vm.$refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue === item[props.valueField]));
|
|
73
73
|
state.remoteData = data;
|
|
74
74
|
}
|
|
75
75
|
vm.$refs.selectGrid.$refs.tinyTable.lastScrollTop = 0;
|
|
@@ -190,6 +190,11 @@ const emitChange = ({ emit, props, state, constants }) => (value) => {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
+
const directEmitChange = ({ emit, props, state }) => (value, key) => {
|
|
194
|
+
if (state.device === "mb" && props.multiple)
|
|
195
|
+
return;
|
|
196
|
+
emit("change", value, key);
|
|
197
|
+
};
|
|
193
198
|
const clearNoMatchValue = ({ props, emit }) => (newModelValue) => {
|
|
194
199
|
if (!props.clearNoMatchValue) {
|
|
195
200
|
return;
|
|
@@ -281,7 +286,7 @@ const setGridOrTreeSelected = ({ props, state, vm, isTree, api }) => {
|
|
|
281
286
|
}
|
|
282
287
|
const isRemote = state.filterOrSearch && props.remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function");
|
|
283
288
|
const nestdata = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
284
|
-
const data = find(nestdata, (item) => props.modelValue
|
|
289
|
+
const data = find(nestdata, (item) => props.modelValue === item[props.valueField]);
|
|
285
290
|
if (isEmptyObject(data)) {
|
|
286
291
|
api.clearNoMatchValue("");
|
|
287
292
|
return;
|
|
@@ -322,7 +327,7 @@ const getPluginOption = ({ api, props, state }) => (value, isTree) => {
|
|
|
322
327
|
const isRemote = state.filterOrSearch && props.remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function");
|
|
323
328
|
const { textField, valueField } = props;
|
|
324
329
|
const sourceData = isRemote ? state.remoteData : isTree ? api.getTreeData(state.treeData) : state.gridData;
|
|
325
|
-
const selNode = find(sourceData, (item) => item[valueField]
|
|
330
|
+
const selNode = find(sourceData, (item) => item[valueField] === value);
|
|
326
331
|
const items = [];
|
|
327
332
|
if (selNode) {
|
|
328
333
|
selNode.currentLabel = selNode[textField];
|
|
@@ -330,12 +335,21 @@ const getPluginOption = ({ api, props, state }) => (value, isTree) => {
|
|
|
330
335
|
}
|
|
331
336
|
return items;
|
|
332
337
|
};
|
|
333
|
-
const toggleCheckAll = ({ api,
|
|
338
|
+
const toggleCheckAll = ({ api, state }) => () => {
|
|
334
339
|
const getEnabledValues = (options) => {
|
|
335
340
|
let values = [];
|
|
336
341
|
for (let i = 0; i < options.length; i++) {
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
const isEnabled = !options[i].state.disabled && !options[i].state.groupDisabled;
|
|
343
|
+
const isRequired = options[i].required;
|
|
344
|
+
const isDisabledAndChecked = !isEnabled && options[i].state.selectCls === "checked-sur";
|
|
345
|
+
if (state.isSelectAll) {
|
|
346
|
+
if (isRequired || isDisabledAndChecked) {
|
|
347
|
+
values.push(options[i].value);
|
|
348
|
+
}
|
|
349
|
+
} else {
|
|
350
|
+
if (isEnabled || isRequired || isDisabledAndChecked) {
|
|
351
|
+
values.push(options[i].value);
|
|
352
|
+
}
|
|
339
353
|
}
|
|
340
354
|
}
|
|
341
355
|
return values;
|
|
@@ -347,22 +361,12 @@ const toggleCheckAll = ({ api, emit, state, props }) => () => {
|
|
|
347
361
|
const unchecked = state.options.filter((item) => !item.disabled && item.state.selectCls === "check");
|
|
348
362
|
unchecked.length ? value = getEnabledValues(state.options) : value = [];
|
|
349
363
|
} else if (state.selectCls === "checked-sur") {
|
|
350
|
-
value =
|
|
351
|
-
}
|
|
352
|
-
const requiredValue = [];
|
|
353
|
-
if (props.multiple) {
|
|
354
|
-
state.options.forEach((opt) => {
|
|
355
|
-
if (opt.required)
|
|
356
|
-
requiredValue.push(opt.value);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
if (Array.isArray(value)) {
|
|
360
|
-
value = requiredValue.concat(value.filter((val) => !requiredValue.find((requireVal) => requireVal === val)));
|
|
364
|
+
value = getEnabledValues(state.options);
|
|
361
365
|
}
|
|
362
366
|
api.setSoftFocus();
|
|
363
367
|
state.isSilentBlur = true;
|
|
364
368
|
api.updateModelValue(value);
|
|
365
|
-
|
|
369
|
+
api.directEmitChange(value);
|
|
366
370
|
};
|
|
367
371
|
const resetFilter = ({ state, api }) => () => {
|
|
368
372
|
state.query = "";
|
|
@@ -831,7 +835,7 @@ const calcOverFlow = ({ vm, props, state }) => (height) => {
|
|
|
831
835
|
} else {
|
|
832
836
|
for (let i = 1; i < tags.length; i++) {
|
|
833
837
|
let tx = tags[i].getBoundingClientRect().x;
|
|
834
|
-
if (tx
|
|
838
|
+
if (tx === x) {
|
|
835
839
|
state.overflow = i - 1;
|
|
836
840
|
break;
|
|
837
841
|
}
|
|
@@ -930,7 +934,7 @@ const toHide = ({ constants, state, props, vm, api, nextTick }) => () => {
|
|
|
930
934
|
);
|
|
931
935
|
} else {
|
|
932
936
|
vm.$refs.selectGrid.clearRadioRow();
|
|
933
|
-
vm.$refs.selectGrid.setRadioRow(find(fullData, (item) => props.modelValue
|
|
937
|
+
vm.$refs.selectGrid.setRadioRow(find(fullData, (item) => props.modelValue === item[props.valueField]));
|
|
934
938
|
}
|
|
935
939
|
if (state.filterOrSearch && typeof props.filterMethod === "function") {
|
|
936
940
|
vm.$refs.selectGrid.handleTableData(true);
|
|
@@ -1071,6 +1075,7 @@ const nodeCheckClick = ({ emit, props, state, api }) => (data, { checkedKeys, ch
|
|
|
1071
1075
|
state.selected = checkedNodes.filter((node) => {
|
|
1072
1076
|
node.currentLabel = node[props.textField];
|
|
1073
1077
|
node.value = node[props.valueField];
|
|
1078
|
+
return node;
|
|
1074
1079
|
});
|
|
1075
1080
|
api.updateModelValue(checkedKeys);
|
|
1076
1081
|
emit("change", checkedKeys, checkedNodes);
|
|
@@ -1150,7 +1155,7 @@ const buildRadioConfig = ({ props, state }) => () => {
|
|
|
1150
1155
|
const radioConfig = props.radioConfig;
|
|
1151
1156
|
return __spreadValues(__spreadValues({}, radioConfig), { checkRowKey, highlight });
|
|
1152
1157
|
};
|
|
1153
|
-
const onMouseenterNative = ({ state }) => (
|
|
1158
|
+
const onMouseenterNative = ({ state }) => () => {
|
|
1154
1159
|
state.inputHovering = true;
|
|
1155
1160
|
if (state.searchSingleCopy && state.selectedLabel) {
|
|
1156
1161
|
state.softFocus = true;
|
|
@@ -1199,7 +1204,7 @@ const calcCollapseTags = ({ state, vm }) => () => {
|
|
|
1199
1204
|
const collapseTagWidth = collapseTag && parseFloat(collapseTagContentWidth) + parseFloat(marginRight);
|
|
1200
1205
|
const tagList = Array.from(tags.querySelectorAll(".tiny-tag"));
|
|
1201
1206
|
let { total, dom, idx } = { total: collapseTagWidth, dom: null, idx: 0 };
|
|
1202
|
-
tagList.
|
|
1207
|
+
tagList.forEach((tag, index) => {
|
|
1203
1208
|
if (tag !== collapseTag) {
|
|
1204
1209
|
const { width: tagContentWidth, marginRight: marginRight2 } = tag && window.getComputedStyle(tag);
|
|
1205
1210
|
total += parseFloat(tagContentWidth) + parseFloat(marginRight2);
|
|
@@ -1521,8 +1526,8 @@ const watchShowClose = ({ nextTick, state, parent }) => () => {
|
|
|
1521
1526
|
}
|
|
1522
1527
|
});
|
|
1523
1528
|
};
|
|
1524
|
-
const computedGetIcon = ({ constants, designConfig, props }) => (
|
|
1525
|
-
return props.dropdownIcon || (designConfig == null ? void 0 : designConfig.icons[
|
|
1529
|
+
const computedGetIcon = ({ constants, designConfig, props }) => (iconKey = "dropdownIcon") => {
|
|
1530
|
+
return props.dropdownIcon || (designConfig == null ? void 0 : designConfig.icons[iconKey]) || (constants == null ? void 0 : constants.ICON_MAP[iconKey]);
|
|
1526
1531
|
};
|
|
1527
1532
|
const computedGetTagType = ({ designConfig, props }) => () => {
|
|
1528
1533
|
var _a;
|
|
@@ -1564,6 +1569,7 @@ export {
|
|
|
1564
1569
|
deletePrevTag,
|
|
1565
1570
|
deleteSelected,
|
|
1566
1571
|
deleteTag,
|
|
1572
|
+
directEmitChange,
|
|
1567
1573
|
doDestroy,
|
|
1568
1574
|
emitChange,
|
|
1569
1575
|
emptyText,
|
package/select/vue.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
scrollToOption,
|
|
23
23
|
handleMenuEnter,
|
|
24
24
|
emitChange,
|
|
25
|
+
directEmitChange,
|
|
25
26
|
getOption,
|
|
26
27
|
setSelected,
|
|
27
28
|
handleFocus,
|
|
@@ -213,7 +214,7 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => ({
|
|
|
213
214
|
defaultCheckedKeys: [],
|
|
214
215
|
filterOrSearch: computed(() => props.filterable || props.searchable)
|
|
215
216
|
});
|
|
216
|
-
const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants
|
|
217
|
+
const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants }) => {
|
|
217
218
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
218
219
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
219
220
|
selectEmitter: emitter(),
|
|
@@ -246,7 +247,7 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
246
247
|
key: 0,
|
|
247
248
|
isSelectAll: computed(() => state.selectCls === "checked-sur"),
|
|
248
249
|
isHalfSelect: computed(() => state.selectCls === "halfselect"),
|
|
249
|
-
getIcon: computed(() => api2.computedGetIcon(
|
|
250
|
+
getIcon: computed(() => api2.computedGetIcon()),
|
|
250
251
|
getTagType: computed(() => api2.computedGetTagType()),
|
|
251
252
|
isShowDropdownIcon: computed(() => api2.computedShowDropdownIcon())
|
|
252
253
|
}));
|
|
@@ -277,7 +278,7 @@ const addApi = ({ api: api2, props, state, emit, constants, parent, nextTick, di
|
|
|
277
278
|
handleQueryChange: handleQueryChange({ api: api2, constants, nextTick, props, vm, state }),
|
|
278
279
|
handleOptionSelect: handleOptionSelect({ api: api2, nextTick, props, vm, state }),
|
|
279
280
|
getPluginOption: getPluginOption({ api: api2, props, state }),
|
|
280
|
-
toggleCheckAll: toggleCheckAll({ api: api2,
|
|
281
|
+
toggleCheckAll: toggleCheckAll({ api: api2, state }),
|
|
281
282
|
handleDebouncedQueryChange: handleDebouncedQueryChange({ state, api: api2 }),
|
|
282
283
|
debouncedQueryChange: debouncedQueryChange({ props, api: api2 }),
|
|
283
284
|
debouncedOnInputChange: debounce(state.debounce, () => {
|
|
@@ -328,6 +329,7 @@ const initApi = ({
|
|
|
328
329
|
getChildValue: getChildValue(),
|
|
329
330
|
getOption: getOption({ props, state }),
|
|
330
331
|
emitChange: emitChange({ emit, props, state, constants }),
|
|
332
|
+
directEmitChange: directEmitChange({ emit, props, state }),
|
|
331
333
|
toggleMenu: toggleMenu({ vm, state, props }),
|
|
332
334
|
showTip: showTip({ props, state, vm }),
|
|
333
335
|
onOptionDestroy: onOptionDestroy(state),
|
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
|
};
|
|
@@ -28,7 +28,7 @@ declare const $constants: {
|
|
|
28
28
|
};
|
|
29
29
|
declare const datePickerProps: {
|
|
30
30
|
type: {
|
|
31
|
-
type: PropType<"date" | "dates" | "
|
|
31
|
+
type: PropType<"date" | "dates" | "year" | "years" | "yearrange" | "month" | "week" | "daterange" | "datetimerange" | "monthrange" | "datetime">;
|
|
32
32
|
default: string;
|
|
33
33
|
};
|
|
34
34
|
_constants: {
|