@opentiny/vue-renderless 3.22.0 → 3.24.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/autocomplete/index.js +3 -0
- package/base-select/index.js +1 -2
- package/calendar-view/index.js +25 -3
- package/calendar-view/vue.js +4 -1
- package/cascader-node/vue.js +11 -1
- package/date-panel/index.js +7 -1
- package/date-range/index.js +3 -0
- package/dialog-select/index.js +19 -6
- package/dialog-select/vue.js +2 -2
- package/file-upload/index.js +30 -9
- package/grid/plugins/export.js +6 -0
- package/image-viewer/vue.js +1 -1
- package/month-range/index.js +3 -0
- package/number-animation/index.js +53 -0
- package/number-animation/vue.js +27 -0
- package/package.json +3 -3
- package/picker/index.js +18 -13
- package/picker/vue.js +5 -5
- package/qr-code/vue.js +1 -1
- package/select/index.js +2 -1
- package/tabs-mf/index.js +4 -0
- package/tabs-mf/vue-bar.js +4 -3
- package/transfer/index.js +41 -0
- package/transfer/vue.js +64 -24
- package/transfer-panel/index.js +5 -0
- package/tree-select/index.js +67 -21
- package/tree-select/vue.js +27 -3
- package/types/action-menu.type.d.ts +1 -0
- package/types/action-sheet.type.d.ts +1 -0
- package/types/alert.type.d.ts +1 -0
- package/types/amount.type.d.ts +1 -0
- package/types/area.type.d.ts +1 -0
- package/types/async-flowchart.type.d.ts +1 -0
- package/types/autocomplete.type.d.ts +1 -0
- package/types/badge.type.d.ts +1 -0
- package/types/breadcrumb-item.type.d.ts +1 -0
- package/types/breadcrumb.type.d.ts +1 -0
- package/types/button-group.type.d.ts +1 -0
- package/types/button.type.d.ts +2 -1
- package/types/cascader.type.d.ts +1 -0
- package/types/checkbox.type.d.ts +1 -0
- package/types/collapse-item.type.d.ts +1 -0
- package/types/collapse.type.d.ts +1 -0
- package/types/dialog-box.type.d.ts +1 -0
- package/types/divider.type.d.ts +1 -0
- package/types/drawer.type.d.ts +1 -0
- package/types/{dropdown-item.type-c9badbc1.d.ts → dropdown-item.type-b3ced3ce.d.ts} +2 -0
- 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 -0
- package/types/fall-menu.type.d.ts +1 -0
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +1 -0
- package/types/floatbar.type.d.ts +1 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-4e0ec0a1.d.ts → form.type-dd403065.d.ts} +2 -0
- package/types/form.type.d.ts +1 -1
- package/types/image.type.d.ts +1 -0
- package/types/{index-a975a7a2.d.ts → index-cada95ca.d.ts} +2 -0
- package/types/input.type.d.ts +1 -0
- package/types/ip-address.type.d.ts +1 -0
- package/types/link.type.d.ts +1 -0
- package/types/load-list.type.d.ts +1 -0
- package/types/loading.type.d.ts +1 -0
- package/types/milestone.type.d.ts +1 -0
- package/types/mind-map.type.d.ts +1 -0
- package/types/modal.type.d.ts +1 -0
- package/types/nav-menu.type.d.ts +1 -0
- package/types/numeric.type.d.ts +1 -0
- package/types/pager.type.d.ts +1 -0
- package/types/popconfirm.type.d.ts +1 -0
- package/types/popeditor.type.d.ts +5 -0
- package/types/popover.type.d.ts +1 -0
- package/types/progress.type.d.ts +1 -0
- package/types/radio-button.type.d.ts +1 -0
- package/types/radio-group.type.d.ts +1 -0
- package/types/radio.type.d.ts +1 -0
- package/types/rate.type.d.ts +1 -0
- package/types/search.type.d.ts +1 -0
- package/types/skeleton-item.type.d.ts +1 -0
- package/types/skeleton.type.d.ts +1 -0
- package/types/slider.type.d.ts +1 -0
- package/types/statistic.type.d.ts +1 -0
- package/types/steps.type.d.ts +5 -0
- package/types/switch.type.d.ts +1 -0
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-item.type.d.ts +1 -0
- package/types/tab-nav.type.d.ts +1 -1
- package/types/tabs.type.d.ts +1 -0
- package/types/tag-group.type.d.ts +1 -0
- package/types/tag.type.d.ts +1 -0
- package/types/{time-line.type-9fb16096.d.ts → time-line.type-ad280ca5.d.ts} +2 -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 +1 -0
- package/types/transfer.type.d.ts +4 -0
- package/types/tree-menu.type.d.ts +1 -0
- package/types/upload-dragger.type.d.ts +2 -1
- package/types/{upload-list.type-eaf82b7a.d.ts → upload-list.type-36a8374a.d.ts} +4 -1
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-contact.type.d.ts +1 -0
- package/types/user-head.type.d.ts +3 -2
- package/types/wizard.type.d.ts +1 -0
- package/year-table/index.js +4 -1
package/autocomplete/index.js
CHANGED
package/base-select/index.js
CHANGED
|
@@ -222,7 +222,6 @@ const getResultOfSetSelected = ({ state, api, props }) => {
|
|
|
222
222
|
return result;
|
|
223
223
|
};
|
|
224
224
|
const setSelected = ({ api, nextTick, props, vm, state }) => () => {
|
|
225
|
-
var _a, _b, _c, _d;
|
|
226
225
|
if (!props.multiple) {
|
|
227
226
|
const option = getOptionOfSetSelected({ api, props });
|
|
228
227
|
state.selected = option;
|
|
@@ -231,7 +230,7 @@ const setSelected = ({ api, nextTick, props, vm, state }) => () => {
|
|
|
231
230
|
} else {
|
|
232
231
|
const result = getResultOfSetSelected({ state, props, api });
|
|
233
232
|
state.selectCls = result.length ? result.length === state.options.length ? "checked-sur" : "halfselect" : "check";
|
|
234
|
-
if (!
|
|
233
|
+
if (!vm.$slots.panel) {
|
|
235
234
|
state.selected = result;
|
|
236
235
|
}
|
|
237
236
|
state.selected.length && (state.selectedLabel = "");
|
package/calendar-view/index.js
CHANGED
|
@@ -233,7 +233,16 @@ function splitEvent(props, event) {
|
|
|
233
233
|
}
|
|
234
234
|
return result;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const computedSelectDay = ({ state }) => (day) => {
|
|
237
|
+
if (!day || !day.value || day.disabled)
|
|
238
|
+
return false;
|
|
239
|
+
if (state.multiSelect) {
|
|
240
|
+
return state.selectedDates.includes(day.value);
|
|
241
|
+
} else {
|
|
242
|
+
return state.selectedDate === day.value;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const selectDay = ({ props, state, emit, api }) => (day, i) => {
|
|
237
246
|
if (!day || !day.value || day.disabled)
|
|
238
247
|
return;
|
|
239
248
|
state.activedWeekIndex = i;
|
|
@@ -247,9 +256,10 @@ const selectDay = ({ state, emit }) => (day, i) => {
|
|
|
247
256
|
} else {
|
|
248
257
|
state.selectedDates.push(date);
|
|
249
258
|
}
|
|
259
|
+
const dateEvent = dealEvents(props, api, state.selectedDates);
|
|
250
260
|
emit("update:modelValue", state.selectedDates);
|
|
251
261
|
emit("selected-date-change", state.selectedDates);
|
|
252
|
-
emit("date-click",
|
|
262
|
+
emit("date-click", state.selectedDates, dateEvent);
|
|
253
263
|
} else {
|
|
254
264
|
if (day.isNext) {
|
|
255
265
|
const { year, month } = nextMonth(state.activeYear, state.activeMonth);
|
|
@@ -263,10 +273,21 @@ const selectDay = ({ state, emit }) => (day, i) => {
|
|
|
263
273
|
}
|
|
264
274
|
state.selectedDate = day.value.toString().length > 2 ? day.value : `${state.activeYear}-${state.activeMonth}-${day.value}`;
|
|
265
275
|
state.showSelectedDateEvents = true;
|
|
276
|
+
const dateEvent = dealEvents(props, api, [state.selectedDate]);
|
|
266
277
|
emit("update:modelValue", state.selectedDate);
|
|
267
|
-
emit("date-click", state.selectedDate);
|
|
278
|
+
emit("date-click", state.selectedDate, dateEvent[0]);
|
|
268
279
|
}
|
|
269
280
|
};
|
|
281
|
+
const dealEvents = (props, api, date) => {
|
|
282
|
+
return date.map((item) => {
|
|
283
|
+
let event = api.getEventByTime(item, props._constants.DAY_START_TIME, props._constants.DAY_END_TIME);
|
|
284
|
+
event.forEach((e) => {
|
|
285
|
+
delete e.dayArr;
|
|
286
|
+
delete e.dayNumber;
|
|
287
|
+
});
|
|
288
|
+
return event;
|
|
289
|
+
});
|
|
290
|
+
};
|
|
270
291
|
const getEventByMonth = ({ state }) => (year, month) => {
|
|
271
292
|
const result = [];
|
|
272
293
|
const days = getDays(Number(year), Number(month));
|
|
@@ -608,6 +629,7 @@ function resetTouchStatus(state) {
|
|
|
608
629
|
export {
|
|
609
630
|
computeCascaderOptions,
|
|
610
631
|
computedCalendar,
|
|
632
|
+
computedSelectDay,
|
|
611
633
|
currentDateChange,
|
|
612
634
|
dateIsToday,
|
|
613
635
|
genDayTimes,
|
package/calendar-view/vue.js
CHANGED
|
@@ -2,6 +2,7 @@ import "../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import {
|
|
3
3
|
computedCalendar,
|
|
4
4
|
handleEvents,
|
|
5
|
+
computedSelectDay,
|
|
5
6
|
selectDay,
|
|
6
7
|
getEventByTime,
|
|
7
8
|
isToday,
|
|
@@ -47,6 +48,7 @@ const api = [
|
|
|
47
48
|
"isToday",
|
|
48
49
|
"dateIsToday",
|
|
49
50
|
"getEventByTime",
|
|
51
|
+
"computedSelectDay",
|
|
50
52
|
"selectDay",
|
|
51
53
|
"toToday",
|
|
52
54
|
"getPrevWeek",
|
|
@@ -254,7 +256,8 @@ const initApi = ({ vm, api: api2, state, t, props, emit, nextTick }) => {
|
|
|
254
256
|
computeCascaderOptions: computeCascaderOptions(t),
|
|
255
257
|
isToday: isToday(state),
|
|
256
258
|
dateIsToday: dateIsToday(),
|
|
257
|
-
selectDay: selectDay({ state, emit }),
|
|
259
|
+
selectDay: selectDay({ props, state, emit, api: api2 }),
|
|
260
|
+
computedSelectDay: computedSelectDay({ state }),
|
|
258
261
|
getEventByTime: getEventByTime({ props, state }),
|
|
259
262
|
toToday: toToday({ state, api: api2, nextTick }),
|
|
260
263
|
getAllWednesdaysInYear: getAllWednesdaysInYear({ state }),
|
package/cascader-node/vue.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
handleNodeClick
|
|
9
9
|
} from "./index";
|
|
10
10
|
const api = ["state", "handleMultiCheckChange", "handleCheckChange", "handleExpand", "handleNodeClick"];
|
|
11
|
-
const renderless = (props, { computed, reactive, inject }, { dispatch }) => {
|
|
11
|
+
const renderless = (props, { computed, reactive, inject, watch }, { dispatch }) => {
|
|
12
12
|
const parent = inject("panel");
|
|
13
13
|
const api2 = {};
|
|
14
14
|
const state = reactive({
|
|
@@ -24,6 +24,16 @@ const renderless = (props, { computed, reactive, inject }, { dispatch }) => {
|
|
|
24
24
|
return parent.state.renderLabelFn ? parent.state.renderLabelFn({ node: props.node, data: props.node.data }) : props.node.label;
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
|
+
if (parent.state.config.expandTrigger !== "click") {
|
|
28
|
+
watch(
|
|
29
|
+
() => state.checkedValue,
|
|
30
|
+
(checkedValue) => {
|
|
31
|
+
if (checkedValue.includes(props.node.value)) {
|
|
32
|
+
api2.handleExpand();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
27
37
|
Object.assign(api2, {
|
|
28
38
|
state,
|
|
29
39
|
isInPath: isInPath(props),
|
package/date-panel/index.js
CHANGED
|
@@ -453,7 +453,13 @@ const getRenderTz = ({ state }) => (value) => {
|
|
|
453
453
|
if (!state.showTimezone || !value) {
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
456
|
-
|
|
456
|
+
const lang = state.lang.replace(/[-_]/g, "").toLowerCase();
|
|
457
|
+
Object.keys(value).forEach((key) => {
|
|
458
|
+
if (key.replace(/[-_]/g, "").toLowerCase() === lang) {
|
|
459
|
+
value[lang] = value[key];
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
state.renderTzdata = value[lang];
|
|
457
463
|
if (state.renderTzdata) {
|
|
458
464
|
const { isServiceTimezone, to } = state.timezone;
|
|
459
465
|
const selectedTz = state.selectedTz || {};
|
package/date-range/index.js
CHANGED
|
@@ -396,6 +396,9 @@ const handleConfirm = ({ api, emit, state, props, t }) => (visible = false) => {
|
|
|
396
396
|
emit("update:modelValue", [start, end]);
|
|
397
397
|
emit("select-change", [start, end]);
|
|
398
398
|
}
|
|
399
|
+
if (state.minDate && !state.maxDate) {
|
|
400
|
+
emit("pick", [state.minDate, state.maxDate], visible, true);
|
|
401
|
+
}
|
|
399
402
|
};
|
|
400
403
|
const isValidValue = ({ state }) => (value) => Array.isArray(value) && value && value[0] && value[1] && toDate1(value[0]) && toDate1(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof state.disabledDate === "function" ? !state.disabledDate(value[0]) && !state.disabledDate(value[1]) : true);
|
|
401
404
|
const resetView = ({ state }) => () => {
|
package/dialog-select/index.js
CHANGED
|
@@ -44,7 +44,8 @@ const queryGridData = ({ api, props, state }) => () => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
const multiGridSelectAll = ({ api, props, state }) => ({ selection, checked }) => {
|
|
47
|
+
const multiGridSelectAll = ({ api, props, state }) => ({ selection, checked, $table }, event) => {
|
|
48
|
+
var _a, _b;
|
|
48
49
|
if (checked) {
|
|
49
50
|
arrayEach(selection, (item) => {
|
|
50
51
|
const index = findIndexOf(state.selectedValues, (val) => val === item[props.valueField]);
|
|
@@ -67,9 +68,12 @@ const multiGridSelectAll = ({ api, props, state }) => ({ selection, checked }) =
|
|
|
67
68
|
state.selectedChanged = true;
|
|
68
69
|
}
|
|
69
70
|
api.selectedBoxInit();
|
|
71
|
+
if ((_b = (_a = props.gridOp) == null ? void 0 : _a.events) == null ? void 0 : _b.selectAll) {
|
|
72
|
+
props.gridOp.events.selectAll({ selection, checked, $table }, event);
|
|
73
|
+
}
|
|
70
74
|
};
|
|
71
|
-
const multiGridSelectChange = ({ api, props, state, vm }) => ({ row, checked }) => {
|
|
72
|
-
var _a, _b, _c, _d, _e;
|
|
75
|
+
const multiGridSelectChange = ({ api, props, state, vm }) => ({ row, checked, $table }, event) => {
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
73
77
|
const property = props.valueField;
|
|
74
78
|
const grid = (_a = vm.$refs) == null ? void 0 : _a.multiGrid;
|
|
75
79
|
const selectedRows = grid.getSelectRecords();
|
|
@@ -103,6 +107,9 @@ const multiGridSelectChange = ({ api, props, state, vm }) => ({ row, checked })
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
api.selectedBoxInit();
|
|
110
|
+
if ((_g = (_f = props.gridOp) == null ? void 0 : _f.events) == null ? void 0 : _g.selectChange) {
|
|
111
|
+
props.gridOp.events.selectChange({ row, checked, $table }, event);
|
|
112
|
+
}
|
|
106
113
|
};
|
|
107
114
|
const selectedBoxInit = ({ props, vm, nextTick }) => () => {
|
|
108
115
|
const { multi, showSelectedBox } = props;
|
|
@@ -112,7 +119,7 @@ const selectedBoxInit = ({ props, vm, nextTick }) => () => {
|
|
|
112
119
|
});
|
|
113
120
|
}
|
|
114
121
|
};
|
|
115
|
-
const selectedBoxClear = ({ props, state, vm }) => () => {
|
|
122
|
+
const selectedBoxClear = ({ props, state, vm, emit }) => () => {
|
|
116
123
|
const { multi, popseletor } = props;
|
|
117
124
|
if (multi && popseletor === "grid") {
|
|
118
125
|
vm.$refs.multiGrid.clearSelection();
|
|
@@ -123,6 +130,7 @@ const selectedBoxClear = ({ props, state, vm }) => () => {
|
|
|
123
130
|
state.selectedValues = [];
|
|
124
131
|
state.selectedDatas = [];
|
|
125
132
|
state.selectedChanged = true;
|
|
133
|
+
emit("clear");
|
|
126
134
|
};
|
|
127
135
|
const setTreeSelection = ({ api, state, vm, props }) => (keys, value) => {
|
|
128
136
|
const tree = vm.$refs.multiTree;
|
|
@@ -198,7 +206,7 @@ const setSelection = ({ props, api }) => (data, value) => {
|
|
|
198
206
|
}
|
|
199
207
|
};
|
|
200
208
|
const getSelection = ({ state }) => () => state.selectedDatas;
|
|
201
|
-
const selectedBoxDelete = ({ props, state, vm }) => ({ option: row }) => {
|
|
209
|
+
const selectedBoxDelete = ({ props, state, vm, emit }) => ({ option: row }) => {
|
|
202
210
|
const { multi, popseletor } = props;
|
|
203
211
|
if (multi && popseletor === "grid") {
|
|
204
212
|
vm.$refs.multiGrid.setSelection(
|
|
@@ -215,6 +223,7 @@ const selectedBoxDelete = ({ props, state, vm }) => ({ option: row }) => {
|
|
|
215
223
|
state.selectedDatas = [...state.selectedDatas.slice(0, index), ...state.selectedDatas.slice(index + 1)];
|
|
216
224
|
state.selectedChanged = true;
|
|
217
225
|
}
|
|
226
|
+
emit("delete", row);
|
|
218
227
|
};
|
|
219
228
|
const selectedBoxDrag = ({ props, state }) => ({ state: { select } }) => {
|
|
220
229
|
if (select && select.length) {
|
|
@@ -420,10 +429,14 @@ const multiTreeRadio = ({ api, props }) => () => {
|
|
|
420
429
|
api.multiTreeCheck();
|
|
421
430
|
}
|
|
422
431
|
};
|
|
423
|
-
const multiGridRadioChange = ({ props, state }) => ({ row }) => {
|
|
432
|
+
const multiGridRadioChange = ({ props, state }) => ({ row, $table }, event) => {
|
|
433
|
+
var _a, _b;
|
|
424
434
|
state.selectedValues = [row[props.valueField]];
|
|
425
435
|
state.selectedDatas = [row];
|
|
426
436
|
state.selectedChanged = true;
|
|
437
|
+
if ((_b = (_a = props.gridOp) == null ? void 0 : _a.events) == null ? void 0 : _b.radioChange) {
|
|
438
|
+
props.gridOp.events.radioChange({ row, $table }, event);
|
|
439
|
+
}
|
|
427
440
|
};
|
|
428
441
|
const watchMulti = ({ api, state, props }) => () => {
|
|
429
442
|
state.splitValue = props.multi ? 0.7 : 1;
|
package/dialog-select/vue.js
CHANGED
|
@@ -92,8 +92,8 @@ const renderless = (props, { reactive, computed, watch }, { vm, nextTick, emit,
|
|
|
92
92
|
state,
|
|
93
93
|
computedGridColumns: computedGridColumns(props),
|
|
94
94
|
selectedBoxInit: selectedBoxInit({ props, vm, nextTick }),
|
|
95
|
-
selectedBoxClear: selectedBoxClear({ props, state, vm }),
|
|
96
|
-
selectedBoxDelete: selectedBoxDelete({ props, state, vm }),
|
|
95
|
+
selectedBoxClear: selectedBoxClear({ props, state, vm, emit }),
|
|
96
|
+
selectedBoxDelete: selectedBoxDelete({ props, state, vm, emit }),
|
|
97
97
|
selectedBoxDrag: selectedBoxDrag({ props, state }),
|
|
98
98
|
doMultiTreeFilter: doMultiTreeFilter({ props, state, nextTick, vm }),
|
|
99
99
|
multiTreeFilterNode: multiTreeFilterNode(props),
|
package/file-upload/index.js
CHANGED
|
@@ -133,6 +133,14 @@ const onBeforeIsPromise = ({
|
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
|
+
const isAcceptType = (acceptArray, file, constants, fileType) => {
|
|
137
|
+
return acceptArray.some((type) => {
|
|
138
|
+
if (type.toLowerCase() === constants.IMAGE_TYPE) {
|
|
139
|
+
return constants.FILE_TYPE.PICTURE.split("/").includes(fileType);
|
|
140
|
+
}
|
|
141
|
+
return new RegExp(`(${type.trim()})$`, "i").test(file.name);
|
|
142
|
+
});
|
|
143
|
+
};
|
|
136
144
|
const getFileType = ({ file }) => {
|
|
137
145
|
const { name, url } = file;
|
|
138
146
|
let fileType = "";
|
|
@@ -164,7 +172,7 @@ const beforeUpload = ({
|
|
|
164
172
|
constants,
|
|
165
173
|
t,
|
|
166
174
|
state
|
|
167
|
-
}) => (file, autoRemove, doUpload) => {
|
|
175
|
+
}) => (file, autoRemove, doUpload, isMergeUpload = false) => {
|
|
168
176
|
if (state.isEdm && file.name.length > 255) {
|
|
169
177
|
remove({ api, file, autoRemove });
|
|
170
178
|
return Modal.message({
|
|
@@ -176,15 +184,28 @@ const beforeUpload = ({
|
|
|
176
184
|
let isValid = true;
|
|
177
185
|
const accept = state.isEdm ? state.accept : props.accept;
|
|
178
186
|
const types = constants.FILE_TYPE[state.triggerClickType.toUpperCase()];
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
const acceptArray = accept ? accept.split(",") : [];
|
|
188
|
+
let fileType = "";
|
|
189
|
+
if (isMergeUpload) {
|
|
190
|
+
const fileRow = [];
|
|
191
|
+
fileType = file.raw.flatMap((f) => {
|
|
192
|
+
const type = getFileType({ file: f });
|
|
193
|
+
if (accept) {
|
|
194
|
+
const isExist = isAcceptType(acceptArray, f, constants, type);
|
|
195
|
+
isExist ? fileRow.push(f) : remove({ api, file: f, autoRemove });
|
|
184
196
|
}
|
|
185
|
-
return
|
|
197
|
+
return type;
|
|
186
198
|
});
|
|
187
|
-
|
|
199
|
+
if (!fileRow.length) {
|
|
200
|
+
isValid = false;
|
|
201
|
+
}
|
|
202
|
+
file.raw = fileRow;
|
|
203
|
+
} else {
|
|
204
|
+
fileType = getFileType({ file });
|
|
205
|
+
if (accept) {
|
|
206
|
+
const isExist = isAcceptType(acceptArray, file, constants, fileType);
|
|
207
|
+
!isExist && (isValid = false);
|
|
208
|
+
}
|
|
188
209
|
}
|
|
189
210
|
if (state.triggerClickType && types) {
|
|
190
211
|
const isExist = types.split("/").includes(fileType);
|
|
@@ -465,7 +486,7 @@ const handleStart = ({
|
|
|
465
486
|
if (!state.isEdm && props.autoUpload) {
|
|
466
487
|
if (props.multiple && props.mergeService) {
|
|
467
488
|
const handler = (file) => vm.$refs[constants.UPLOAD_INNER].$refs[constants.UPLOAD_INNER_TEMPLATE].upload(file.raw);
|
|
468
|
-
rawFiles.length && api.beforeUpload({ raw: rawFiles }, true, handler);
|
|
489
|
+
rawFiles.length && api.beforeUpload({ raw: rawFiles }, true, handler, true);
|
|
469
490
|
} else {
|
|
470
491
|
rawFiles.forEach((rawFile) => {
|
|
471
492
|
const file = api.getFile(rawFile);
|
package/grid/plugins/export.js
CHANGED
|
@@ -39,6 +39,12 @@ const getCsvContent = ($table, opts, oColumns, oData) => {
|
|
|
39
39
|
const { columns, datas } = getCsvData(opts, oData, oColumns, tableEl);
|
|
40
40
|
let content = "\uFEFF";
|
|
41
41
|
const transfrom = (str) => {
|
|
42
|
+
if (str === null || str === void 0) {
|
|
43
|
+
return "" + tab;
|
|
44
|
+
}
|
|
45
|
+
if (typeof str === "number" && isNaN(str)) {
|
|
46
|
+
return "-" + tab;
|
|
47
|
+
}
|
|
42
48
|
if (typeof str === "string" && str.replace(/ /g, "").match(/[\s,"]/)) {
|
|
43
49
|
str = '"' + str.replace(/"/g, '""') + '"';
|
|
44
50
|
}
|
package/image-viewer/vue.js
CHANGED
|
@@ -210,7 +210,7 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
|
|
|
210
210
|
() => {
|
|
211
211
|
state.urlList = props.urlList;
|
|
212
212
|
},
|
|
213
|
-
{ deep: true }
|
|
213
|
+
{ deep: true, immediate: true }
|
|
214
214
|
);
|
|
215
215
|
};
|
|
216
216
|
const renderless = (props, { computed, onMounted, onBeforeUnmount, onUpdated, reactive, watch, inject, provide }, { t, parent, nextTick, emit, constants, vm, mode }) => {
|
package/month-range/index.js
CHANGED
|
@@ -135,6 +135,9 @@ const handleConfirm = ({ api, emit, state, props, t }) => (visible = false) => {
|
|
|
135
135
|
emit("update:modelValue", [start, end]);
|
|
136
136
|
emit("select-change", [start, end]);
|
|
137
137
|
}
|
|
138
|
+
if (state.minDate && !state.maxDate) {
|
|
139
|
+
emit("pick", [state.minDate, state.maxDate], visible, true);
|
|
140
|
+
}
|
|
138
141
|
};
|
|
139
142
|
const isValidValue = (state) => (value) => Array.isArray(value) && value && value[1] && value[0] && isDate(value[1]) && isDate(value[0]) && value[0].getTime() <= value[1].getTime() && (typeof state.disabledDate === "function" ? !state.disabledDate(value[1]) && !state.disabledDate(value[0]) : true);
|
|
140
143
|
const resetView = (state) => () => {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const onFinish = ({ emit, props, state }) => () => {
|
|
3
|
+
state.value = props.to;
|
|
4
|
+
state.animating = false;
|
|
5
|
+
emit("finish");
|
|
6
|
+
};
|
|
7
|
+
const easeOut = (t) => 1 - (1 - t) ** 5;
|
|
8
|
+
const play = ({ props, state, api }) => () => {
|
|
9
|
+
animate(state, props, api);
|
|
10
|
+
};
|
|
11
|
+
const animate = (state, props, api) => {
|
|
12
|
+
state.animating = true;
|
|
13
|
+
state.value = props.from;
|
|
14
|
+
if (props.from !== props.to) {
|
|
15
|
+
const startTime = performance.now();
|
|
16
|
+
const tick = () => {
|
|
17
|
+
const current = performance.now();
|
|
18
|
+
const elapsedTime = Math.min(current - startTime, props.duration);
|
|
19
|
+
const currentValue = props.from + (props.to - props.from) * easeOut(elapsedTime / props.duration);
|
|
20
|
+
if (elapsedTime === props.duration) {
|
|
21
|
+
api.onFinish();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
state.value = currentValue;
|
|
25
|
+
requestAnimationFrame(tick);
|
|
26
|
+
};
|
|
27
|
+
tick();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const formattedValue = ({ state, props }) => () => {
|
|
31
|
+
if (typeof state.value !== "number" && typeof state.value !== "string")
|
|
32
|
+
return;
|
|
33
|
+
if (typeof props.precision !== "number")
|
|
34
|
+
return;
|
|
35
|
+
const numValue = Number(state.value);
|
|
36
|
+
if (isNaN(numValue) || !isFinite(numValue))
|
|
37
|
+
return;
|
|
38
|
+
if (numValue === 0) {
|
|
39
|
+
return numValue.toFixed(props.precision);
|
|
40
|
+
}
|
|
41
|
+
let formatValue = numValue.toFixed(props.precision);
|
|
42
|
+
if (typeof props.separator === "string" && props.separator !== "") {
|
|
43
|
+
const [integerPart, decimalPart] = formatValue.split(".");
|
|
44
|
+
formatValue = integerPart.replace(/(\d)(?=(\d{3})+$)/g, "$1" + props.separator) + (decimalPart ? "." + decimalPart : "");
|
|
45
|
+
}
|
|
46
|
+
return formatValue;
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
animate,
|
|
50
|
+
formattedValue,
|
|
51
|
+
onFinish,
|
|
52
|
+
play
|
|
53
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { play, formattedValue, onFinish } from "./index";
|
|
3
|
+
const api = ["state", "play", "formattedValue", "onFinish"];
|
|
4
|
+
const renderless = (props, { onMounted, computed, reactive }, { emit }) => {
|
|
5
|
+
const api2 = {};
|
|
6
|
+
const state = reactive({
|
|
7
|
+
animating: true,
|
|
8
|
+
value: props.from,
|
|
9
|
+
showValue: computed(() => api2.formattedValue(state, props))
|
|
10
|
+
});
|
|
11
|
+
onMounted(() => {
|
|
12
|
+
if (props.active) {
|
|
13
|
+
api2.play(props, state);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.assign(api2, {
|
|
17
|
+
state,
|
|
18
|
+
play: play({ props, state, api: api2 }),
|
|
19
|
+
formattedValue: formattedValue({ state, props }),
|
|
20
|
+
onFinish: onFinish({ emit, props, state })
|
|
21
|
+
});
|
|
22
|
+
return api2;
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
api,
|
|
26
|
+
renderless
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.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.24.0",
|
|
29
|
+
"@opentiny/vue-hooks": "~3.24.0",
|
|
30
30
|
"color": "4.2.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/picker/index.js
CHANGED
|
@@ -46,8 +46,8 @@ const watchMobileVisible = ({ api, props, state, nextTick }) => ([dateMobileVisi
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick }) => (value) => {
|
|
50
|
-
if (props.readonly || state.pickerDisabled || state.isMobileScreen)
|
|
49
|
+
const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick, isPCMode }) => (value) => {
|
|
50
|
+
if (props.readonly || state.pickerDisabled || state.isMobileScreen && !isPCMode)
|
|
51
51
|
return;
|
|
52
52
|
if (value) {
|
|
53
53
|
api.showPicker();
|
|
@@ -704,18 +704,18 @@ const handleClose = ({ api, props, state }) => () => {
|
|
|
704
704
|
api.emitInput(oldValue, true);
|
|
705
705
|
}
|
|
706
706
|
};
|
|
707
|
-
const handleFocus = ({ emit, vm, state, api, props }) => () => {
|
|
707
|
+
const handleFocus = ({ emit, vm, state, api, props, isPCMode }) => () => {
|
|
708
708
|
const type = state.type;
|
|
709
709
|
if (props.readonly || state.pickerDisabled) {
|
|
710
710
|
return;
|
|
711
711
|
}
|
|
712
712
|
if (DATEPICKER.TriggerTypes.includes(type)) {
|
|
713
|
-
if (state.isMobileScreen
|
|
713
|
+
if (!state.isMobileScreen || isPCMode) {
|
|
714
|
+
state.pickerVisible = true;
|
|
715
|
+
} else if (state.isDateMobileComponent) {
|
|
714
716
|
api.dateMobileToggle(true);
|
|
715
|
-
} else if (state.
|
|
717
|
+
} else if (state.isTimeMobileComponent) {
|
|
716
718
|
api.timeMobileToggle(true);
|
|
717
|
-
} else {
|
|
718
|
-
state.pickerVisible = true;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
emit("focus", vm.$refs.reference);
|
|
@@ -786,14 +786,19 @@ const showPicker = ({ api, nextTick, updatePopper, state }) => () => {
|
|
|
786
786
|
state.picker.adjustSpinners && state.picker.adjustSpinners();
|
|
787
787
|
});
|
|
788
788
|
};
|
|
789
|
-
const handlePick = ({ state, api }) => (date = "", visible = false) => {
|
|
789
|
+
const handlePick = ({ state, api }) => (date = "", visible = false, chooseOne = false) => {
|
|
790
790
|
if (!state.picker)
|
|
791
791
|
return;
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
792
|
+
if (chooseOne) {
|
|
793
|
+
const minDate = date && date[0] || "";
|
|
794
|
+
state.userInput = [api.formatToString(minDate), null];
|
|
795
|
+
} else {
|
|
796
|
+
state.userInput = null;
|
|
797
|
+
state.pickerVisible = state.picker.state.visible = visible;
|
|
798
|
+
api.emitInput(date, visible);
|
|
799
|
+
state.date = date;
|
|
800
|
+
state.picker.resetView && state.picker.resetView();
|
|
801
|
+
}
|
|
797
802
|
};
|
|
798
803
|
const handleSelectRange = (state) => (start, end, pos) => {
|
|
799
804
|
if (state.refInput.length === 0) {
|
package/picker/vue.js
CHANGED
|
@@ -154,7 +154,7 @@ const initState = ({ api: api2, reactive, vm, computed, props, utils, parent, br
|
|
|
154
154
|
});
|
|
155
155
|
return state;
|
|
156
156
|
};
|
|
157
|
-
const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent }) => {
|
|
157
|
+
const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent, isPCMode }) => {
|
|
158
158
|
const { t, emit, dispatch, nextTick, vm } = vnode;
|
|
159
159
|
const { TimePanel, TimeRangePanel } = others;
|
|
160
160
|
const { destroyPopper, popperElm, updatePopper } = initPopper({ props, hooks, vnode });
|
|
@@ -166,7 +166,7 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent
|
|
|
166
166
|
hidePicker: hidePicker({ destroyPopper, state }),
|
|
167
167
|
handleSelectChange: ({ tz, date }) => !state.ranged && emit("select-change", { tz, date }),
|
|
168
168
|
getPanel: getPanel(others),
|
|
169
|
-
handleFocus: handleFocus({ emit, vm, state, api: api2, props }),
|
|
169
|
+
handleFocus: handleFocus({ emit, vm, state, api: api2, props, isPCMode }),
|
|
170
170
|
getTimezone: getTimezone({ props, utils }),
|
|
171
171
|
emitChange: emitChange({ api: api2, dispatch, emit, props, state }),
|
|
172
172
|
parsedValue: parsedValue({ api: api2, props, state, t }),
|
|
@@ -189,7 +189,7 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent
|
|
|
189
189
|
handleClose: handleClose({ api: api2, props, state }),
|
|
190
190
|
displayValue: displayValue({ api: api2, props, state }),
|
|
191
191
|
handlePick: handlePick({ api: api2, state }),
|
|
192
|
-
watchPickerVisible: watchPickerVisible({ api: api2, vm, dispatch, emit, props, state, nextTick }),
|
|
192
|
+
watchPickerVisible: watchPickerVisible({ api: api2, vm, dispatch, emit, props, state, nextTick, isPCMode }),
|
|
193
193
|
watchMobileVisible: watchMobileVisible({ api: api2, props, state, nextTick }),
|
|
194
194
|
formatToString: formatToString({ api: api2, state }),
|
|
195
195
|
watchIsRange: watchIsRange({ api: api2, state, TimePanel, TimeRangePanel }),
|
|
@@ -263,12 +263,12 @@ const initWatch = ({ api: api2, state, props, watch, markRaw }) => {
|
|
|
263
263
|
const renderless = (props, hooks, vnode, others) => {
|
|
264
264
|
const api2 = {};
|
|
265
265
|
const { reactive, computed, watch, onBeforeUnmount, inject, markRaw, onMounted } = hooks;
|
|
266
|
-
const { vm, service, parent, useBreakpoint } = vnode;
|
|
266
|
+
const { vm, service, parent, useBreakpoint, isPCMode } = vnode;
|
|
267
267
|
const { utils = {} } = service || {};
|
|
268
268
|
const breakpoint = useBreakpoint();
|
|
269
269
|
const state = initState({ api: api2, reactive, vm, computed, props, utils, parent, inject, breakpoint });
|
|
270
270
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
271
|
-
initApi({ api: api2, props, hooks, state, vnode, others, utils, parent });
|
|
271
|
+
initApi({ api: api2, props, hooks, state, vnode, others, utils, parent, isPCMode });
|
|
272
272
|
initWatch({ api: api2, state, props, watch, markRaw });
|
|
273
273
|
api2.initGlobalTimezone();
|
|
274
274
|
onMounted(() => {
|
package/qr-code/vue.js
CHANGED
|
@@ -17,7 +17,7 @@ const renderless = (props, { reactive, watch, onMounted }, { vm, emit }, { QRCod
|
|
|
17
17
|
api2.draw();
|
|
18
18
|
});
|
|
19
19
|
watch(
|
|
20
|
-
() => [props.level, props.value],
|
|
20
|
+
() => [props.level, props.value, props.color, props.style, props.size, props.icon, props.iconSize, props.bordered],
|
|
21
21
|
() => {
|
|
22
22
|
api2.draw();
|
|
23
23
|
api2.change();
|
package/select/index.js
CHANGED
|
@@ -621,7 +621,8 @@ const handleOptionSelect = ({ api, nextTick, props, vm, state }) => (option, byC
|
|
|
621
621
|
state.visible = false;
|
|
622
622
|
}
|
|
623
623
|
state.isSilentBlur = byClick;
|
|
624
|
-
|
|
624
|
+
if (!props.automaticDropdown)
|
|
625
|
+
api.setSoftFocus();
|
|
625
626
|
if (state.visible) {
|
|
626
627
|
return;
|
|
627
628
|
}
|
package/tabs-mf/index.js
CHANGED
|
@@ -204,6 +204,9 @@ const wheelListener = ({ vm, api, tabs, state }) => debounce(10, (e) => {
|
|
|
204
204
|
});
|
|
205
205
|
const getBoundRect = (vm) => () => vm.$el.getBoundingClientRect();
|
|
206
206
|
const handleClickDropdownItem = (tabs) => (name) => tabs.clickMore(name);
|
|
207
|
+
const scrollToLeft = (tabs) => () => {
|
|
208
|
+
tabs.scrollTo(tabs.state.navs[0].name);
|
|
209
|
+
};
|
|
207
210
|
const key = (opt) => opt.name + "-" + random();
|
|
208
211
|
const emitAdd = (tabs) => () => {
|
|
209
212
|
tabs.$emit("edit", null, "add");
|
|
@@ -279,6 +282,7 @@ export {
|
|
|
279
282
|
onTouchstart,
|
|
280
283
|
removeItem,
|
|
281
284
|
scrollTo,
|
|
285
|
+
scrollToLeft,
|
|
282
286
|
setActive,
|
|
283
287
|
sortItem,
|
|
284
288
|
unobserveTabSwipeSize,
|
package/tabs-mf/vue-bar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { addResizeListener, removeResizeListener } from "@opentiny/utils";
|
|
3
|
-
import { wheelListener, getBoundRect, handleClickDropdownItem, key, emitAdd } from "./index";
|
|
3
|
+
import { wheelListener, getBoundRect, handleClickDropdownItem, key, emitAdd, scrollToLeft } from "./index";
|
|
4
4
|
import { getAddWheelListener } from "./wheel";
|
|
5
5
|
const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
|
|
6
|
-
const api = ["state", "wheelListener", "handleClickDropdownItem", "key", "emitAdd"];
|
|
6
|
+
const api = ["state", "wheelListener", "handleClickDropdownItem", "key", "emitAdd", "scrollToLeft"];
|
|
7
7
|
const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject, computed }, { vm }) => {
|
|
8
8
|
const tabs = inject("tabs", null);
|
|
9
9
|
const state = reactive({
|
|
@@ -21,7 +21,8 @@ const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject
|
|
|
21
21
|
getBoundRect: getBoundRect(vm),
|
|
22
22
|
handleClickDropdownItem: handleClickDropdownItem(tabs),
|
|
23
23
|
key,
|
|
24
|
-
emitAdd: emitAdd(tabs)
|
|
24
|
+
emitAdd: emitAdd(tabs),
|
|
25
|
+
scrollToLeft: scrollToLeft(tabs)
|
|
25
26
|
};
|
|
26
27
|
Object.assign(api2, {
|
|
27
28
|
state,
|