@opentiny/vue-renderless 3.9.3 → 3.10.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/vue.js +25 -2
- package/anchor/index.js +3 -3
- package/anchor/vue.js +7 -1
- package/area/index.js +4 -4
- package/button/vue.js +4 -2
- package/button-group/index.js +8 -1
- package/button-group/vue.js +5 -10
- package/calendar/index.js +14 -14
- package/calendar-bar/index.js +3 -3
- package/carousel-item/index.js +1 -1
- package/cascader/vue.js +1 -1
- package/cascader-mobile/index.js +299 -0
- package/cascader-mobile/vue.js +102 -0
- package/cascader-panel/store.js +3 -1
- package/chart-boxplot/index.js +0 -1
- package/chart-core/deps/constants.js +20 -2
- package/chart-core/index.js +9 -1
- package/chart-core/modules/extend.js +14 -1
- package/chart-gauge/index.js +3 -1
- package/chart-graph/index.js +3 -1
- package/chart-map/index.js +11 -1
- package/chart-scatter/index.js +10 -2
- package/chart-waterfall/index.js +4 -1
- package/checkbox/index.js +8 -16
- package/checkbox/vue.js +7 -9
- package/column-list-item/vue.js +10 -1
- package/common/bigInt.js +4 -11
- package/common/date.js +2 -2
- package/common/deps/ResizeObserver.js +3 -1
- package/common/deps/date-util.js +9 -1
- package/common/deps/date.js +18 -5
- package/common/deps/fastdom/async.js +41 -0
- package/common/deps/fastdom/index.js +9 -0
- package/common/deps/fastdom/sandbox.js +53 -0
- package/common/deps/fastdom/singleton.js +80 -0
- package/common/deps/fullscreen/screenfull.js +16 -2
- package/common/deps/memorize.js +3 -3
- package/common/deps/popup-manager.js +0 -1
- package/common/deps/requestAnimationFrame.js +1 -1
- package/common/deps/throttle.js +2 -2
- package/common/deps/tree-model/node.js +23 -11
- package/common/deps/tree-model/tree-store.js +28 -7
- package/common/deps/vue-popper.js +14 -2
- package/common/deps/vue-popup.js +16 -23
- package/common/index.js +7 -35
- package/common/runtime.js +1 -1
- package/common/validate/rules/type.js +3 -1
- package/credit-card-form/vue.js +2 -2
- package/date-panel/index.js +35 -31
- package/date-panel/vue.js +12 -12
- package/date-picker/index.js +9 -5
- package/date-picker/vue.js +20 -8
- package/date-picker-mobile/index.js +3 -3
- package/date-range/index.js +91 -19
- package/date-range/vue.js +19 -11
- package/date-table/index.js +39 -6
- package/date-table/vue.js +2 -2
- package/dept/index.js +1 -1
- package/detail-page/vue.js +9 -1
- package/dialog-box/index.js +11 -2
- package/dialog-box/vue.js +30 -6
- package/dialog-select/index.js +27 -5
- package/dialog-select/vue.js +11 -4
- package/drop-roles/index.js +3 -1
- package/dropdown/index.js +28 -7
- package/dropdown/vue.js +12 -7
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +3 -3
- package/dropdown-item/vue.js +12 -10
- package/dropdown-menu/index.js +13 -14
- package/dropdown-menu/vue.js +8 -7
- package/espace/vue.js +9 -1
- package/fall-menu/vue.js +12 -1
- package/file-upload/index.js +137 -89
- package/file-upload/vue.js +24 -14
- package/filter/index.js +1 -1
- package/filter/vue.js +1 -3
- package/floating-button/index.js +73 -0
- package/floating-button/vue.js +35 -0
- package/form/index.js +13 -4
- package/form/vue.js +7 -2
- package/form-item/index.js +4 -1
- package/form-item/vue.js +6 -3
- package/fullscreen/vue.js +24 -3
- package/grid/plugins/exportExcel.js +54 -8
- package/grid/static/base/helperGetHGSKeys.js +1 -4
- package/grid/utils/common.js +15 -11
- package/grid/utils/dom.js +5 -1
- package/guide/index.js +2 -3
- package/hrapprover/index.js +3 -1
- package/index-bar/vue.js +8 -1
- package/input/index.js +1 -11
- package/input/vue.js +6 -12
- package/ip-address/index.js +4 -11
- package/ip-address/vue.js +8 -1
- package/link-menu/vue.js +22 -2
- package/locales/index.js +4 -2
- package/logon-user/index.js +3 -1
- package/logout/index.js +6 -2
- package/milestone/vue.js +1 -1
- package/mini-picker/index.js +12 -10
- package/mini-picker/vue.js +10 -10
- package/modal/index.js +5 -3
- package/modal/vue.js +4 -2
- package/month-range/index.js +18 -18
- package/month-range/vue.js +16 -4
- package/month-table/index.js +7 -3
- package/multi-select/vue.js +1 -9
- package/nav-menu/index.js +33 -4
- package/nav-menu/vue.js +9 -1
- package/notify/vue.js +12 -1
- package/numeric/vue.js +6 -2
- package/option/index.js +10 -2
- package/option/vue.js +20 -9
- package/option-group/index.js +3 -1
- package/package.json +1 -1
- package/picker/index.js +88 -17
- package/picker/vue.js +42 -17
- package/picker-column/index.js +6 -6
- package/picker-column/vue.js +5 -5
- package/popconfirm/vue.js +3 -1
- package/popeditor/index.js +55 -13
- package/popeditor/vue.js +23 -7
- package/popover/vue.js +1 -2
- package/popup/vue.js +15 -2
- package/progress/index.js +9 -7
- package/progress/vue.js +12 -4
- package/pull-refresh/vue.js +10 -1
- package/query-builder/index.js +9 -0
- package/query-builder/vue.js +18 -0
- package/radio/vue.js +3 -1
- package/radio-button/vue.js +1 -1
- package/rate/index.js +8 -2
- package/rate/vue.js +27 -4
- package/recycle-scroller/index.js +0 -1
- package/scrollbar/vue-bar.js +18 -2
- package/search/index.js +12 -5
- package/search/vue.js +7 -5
- package/select/index.js +567 -283
- package/select/vue.js +141 -85
- package/select-dropdown/vue.js +8 -6
- package/select-mobile/index.js +26 -13
- package/select-mobile/vue.js +14 -5
- package/select-view/index.js +5 -21
- package/select-view/vue.js +0 -3
- package/selected-box/index.js +3 -1
- package/slider/index.js +5 -5
- package/slider/vue.js +16 -0
- package/slider-button/index.js +41 -0
- package/slider-button/vue.js +36 -0
- package/slider-button-group/slide-button.js +142 -0
- package/slider-button-group/vue.js +52 -0
- package/steps/slide-bar.js +0 -1
- package/switch/index.js +1 -1
- package/switch/vue.js +1 -1
- package/tab-bar/index.js +8 -6
- package/tab-nav/index.js +19 -13
- package/tab-nav/vue.js +10 -9
- package/tabs/index.js +21 -17
- package/tabs/vue.js +1 -4
- package/tag/vue.js +2 -1
- package/tag-group/index.js +23 -10
- package/tag-group/vue.js +5 -4
- package/time/index.js +8 -8
- package/time/vue.js +9 -9
- package/time-line/index.js +24 -2
- package/time-line/vue.js +30 -4
- package/time-panel/index.js +2 -2
- package/time-panel/vue.js +2 -2
- package/time-range/index.js +24 -21
- package/time-range/vue.js +26 -16
- package/time-spinner/index.js +32 -21
- package/time-spinner/vue.js +37 -12
- package/timeline-item/index.js +77 -0
- package/timeline-item/vue.js +44 -0
- package/toggle-menu/vue.js +0 -1
- package/tooltip/index.js +11 -12
- package/tooltip/vue.js +11 -1
- package/top-box/vue.js +13 -1
- package/tree/index.js +228 -15
- package/tree/vue.js +119 -15
- package/tree-menu/index.js +35 -0
- package/tree-menu/vue.js +27 -5
- package/tree-node/index.js +75 -10
- package/tree-node/vue.js +45 -23
- package/upload/index.js +90 -49
- package/upload/vue.js +22 -10
- package/upload-dragger/index.js +4 -3
- package/upload-list/index.js +67 -16
- package/upload-list/vue.js +26 -9
- package/user/index.js +7 -4
- package/user-link/index.js +2 -1
- package/wizard/index.js +4 -1
- package/wizard/vue.js +19 -2
- package/year-range/index.js +1 -1
- package/year-range/vue.js +3 -3
- package/year-table/index.js +2 -2
package/date-panel/index.js
CHANGED
|
@@ -26,18 +26,19 @@ import { on, off } from "../common/deps/dom";
|
|
|
26
26
|
import { getDateWithNewTimezone, getLocalTimezone } from "../common/date";
|
|
27
27
|
import { fillChar } from "../common/string";
|
|
28
28
|
const getYearLabel = ({ state, t }) => () => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const { YearI18n, Year, PanelYearNum } = DATEPICKER;
|
|
30
|
+
const yearTranslation = t(YearI18n);
|
|
31
|
+
if (state.currentView === Year) {
|
|
32
|
+
const startYear = state.startYear;
|
|
32
33
|
if (yearTranslation) {
|
|
33
|
-
return startYear + " " + yearTranslation + " - " + (startYear +
|
|
34
|
+
return startYear + " " + yearTranslation + " - " + (startYear + PanelYearNum - 1) + " " + yearTranslation;
|
|
34
35
|
}
|
|
35
|
-
return startYear + " - " + (startYear +
|
|
36
|
+
return startYear + " - " + (startYear + PanelYearNum - 1);
|
|
36
37
|
}
|
|
37
38
|
return state.year + " " + yearTranslation;
|
|
38
39
|
};
|
|
39
40
|
const watchValue = ({ api, state }) => (value) => {
|
|
40
|
-
if (
|
|
41
|
+
if ([DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode) && state.value) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
if (isDate(value)) {
|
|
@@ -48,7 +49,7 @@ const watchValue = ({ api, state }) => (value) => {
|
|
|
48
49
|
};
|
|
49
50
|
const watchDefaultValue = ({ state }) => (value) => {
|
|
50
51
|
if (!isDate(state.value)) {
|
|
51
|
-
state.date = value ? new Date(value) :
|
|
52
|
+
state.date = value ? new Date(value) : new Date();
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
const watchTimePickerVisible = ({ nextTick, vm }) => (value) => {
|
|
@@ -65,32 +66,32 @@ const watchSelectionMode = ({ state }) => (value) => {
|
|
|
65
66
|
}
|
|
66
67
|
} else if (value === DATEPICKER.Dates) {
|
|
67
68
|
state.currentView = DATEPICKER.Date;
|
|
68
|
-
} else if (
|
|
69
|
+
} else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(value)) {
|
|
69
70
|
state.currentView = DATEPICKER.Year;
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
|
-
const proxyTimePickerDataProperties = ({
|
|
73
|
+
const proxyTimePickerDataProperties = ({ vm, state, watch }) => () => {
|
|
73
74
|
const format = (timeFormat) => {
|
|
74
|
-
if (refs.timepicker) {
|
|
75
|
-
refs.timepicker.state.format = timeFormat;
|
|
75
|
+
if (vm.$refs.timepicker) {
|
|
76
|
+
vm.$refs.timepicker.state.format = timeFormat;
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
const value = (value2) => {
|
|
79
|
-
if (refs.timepicker) {
|
|
80
|
-
refs.timepicker.state.value = null;
|
|
80
|
+
if (vm.$refs.timepicker) {
|
|
81
|
+
vm.$refs.timepicker.state.value = null;
|
|
81
82
|
if (value2) {
|
|
82
|
-
refs.timepicker.state.value = value2;
|
|
83
|
+
vm.$refs.timepicker.state.value = value2;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
const date = (date2) => {
|
|
87
|
-
if (refs.timepicker) {
|
|
88
|
-
refs.timepicker.state.date = date2;
|
|
88
|
+
if (vm.$refs.timepicker) {
|
|
89
|
+
vm.$refs.timepicker.state.date = date2;
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
92
|
const selectableRange = (selectableRange2) => {
|
|
92
|
-
if (refs.timepicker) {
|
|
93
|
-
refs.timepicker.state.selectableRange = selectableRange2;
|
|
93
|
+
if (vm.$refs.timepicker) {
|
|
94
|
+
vm.$refs.timepicker.state.selectableRange = selectableRange2;
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
watch(() => state.value, value);
|
|
@@ -123,14 +124,14 @@ const cusPrevMonth = ({ state }) => () => state.date = prevMonth(state.date);
|
|
|
123
124
|
const cusNextMonth = ({ state }) => () => state.date = nextMonth(state.date);
|
|
124
125
|
const cusPrevYear = ({ state }) => () => {
|
|
125
126
|
if (state.currentView === DATEPICKER.Year) {
|
|
126
|
-
state.
|
|
127
|
+
state.startYear = state.startYear - DATEPICKER.PanelYearNum;
|
|
127
128
|
} else {
|
|
128
129
|
state.date = prevYear(state.date);
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
132
|
const cusNextYear = ({ state }) => () => {
|
|
132
133
|
if (state.currentView === DATEPICKER.Year) {
|
|
133
|
-
state.
|
|
134
|
+
state.startYear = state.startYear + DATEPICKER.PanelYearNum;
|
|
134
135
|
} else {
|
|
135
136
|
state.date = nextYear(state.date);
|
|
136
137
|
}
|
|
@@ -186,12 +187,15 @@ const handleDatePick = ({ api, state, t }) => (value) => {
|
|
|
186
187
|
api.cusEmit(value, true);
|
|
187
188
|
}
|
|
188
189
|
};
|
|
189
|
-
const handleYearPick = ({ api, state }) => (
|
|
190
|
+
const handleYearPick = ({ api, state }) => (value) => {
|
|
190
191
|
if (state.selectionMode === DATEPICKER.Year) {
|
|
191
|
-
state.date = modifyDate(state.date,
|
|
192
|
+
state.date = modifyDate(state.date, value, 0, 2);
|
|
192
193
|
api.cusEmit(state.date);
|
|
194
|
+
} else if ([DATEPICKER.Years].includes(state.selectionMode)) {
|
|
195
|
+
state.date = value.map((year) => new Date(year, 0, 2));
|
|
196
|
+
api.cusEmit(state.date, state.selectionMode === DATEPICKER.YearRange ? value.length < 2 : true);
|
|
193
197
|
} else {
|
|
194
|
-
state.date = changeYearMonthAndClampDate(state.date,
|
|
198
|
+
state.date = changeYearMonthAndClampDate(state.date, value, state.month);
|
|
195
199
|
state.currentView = DATEPICKER.Month;
|
|
196
200
|
}
|
|
197
201
|
};
|
|
@@ -202,7 +206,7 @@ const dateToLocaleStringForIE = (timezone, value) => {
|
|
|
202
206
|
return new Date(offsetTime);
|
|
203
207
|
};
|
|
204
208
|
const changeToNow = ({ api, state }) => () => {
|
|
205
|
-
const now =
|
|
209
|
+
const now = new Date();
|
|
206
210
|
const timezone = state.timezone;
|
|
207
211
|
const isServiceTimezone = timezone.isServiceTimezone;
|
|
208
212
|
let disabledDate = !state.disabledDate;
|
|
@@ -216,7 +220,7 @@ const changeToNow = ({ api, state }) => () => {
|
|
|
216
220
|
if (disabledDate && api.checkDateWithinRange(now)) {
|
|
217
221
|
if (!isServiceTimezone) {
|
|
218
222
|
if (state.showTimezone && state.selectedTz) {
|
|
219
|
-
state.date = dateToLocaleStringForIE(state.selectedTz.offset,
|
|
223
|
+
state.date = dateToLocaleStringForIE(state.selectedTz.offset, now);
|
|
220
224
|
} else {
|
|
221
225
|
state.date = now;
|
|
222
226
|
}
|
|
@@ -226,7 +230,7 @@ const changeToNow = ({ api, state }) => () => {
|
|
|
226
230
|
}
|
|
227
231
|
};
|
|
228
232
|
const confirm = ({ api, state, t }) => () => {
|
|
229
|
-
if (
|
|
233
|
+
if ([DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode)) {
|
|
230
234
|
api.cusEmit(state.value);
|
|
231
235
|
} else {
|
|
232
236
|
let value = state.value ? state.value : modifyWithTimeString(api.getDefaultValue(), state.defaultTime, t);
|
|
@@ -242,7 +246,7 @@ const confirm = ({ api, state, t }) => () => {
|
|
|
242
246
|
const resetView = ({ state }) => () => {
|
|
243
247
|
if (state.selectionMode === DATEPICKER.Month) {
|
|
244
248
|
state.currentView = DATEPICKER.Month;
|
|
245
|
-
} else if (
|
|
249
|
+
} else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(state.selectionMode)) {
|
|
246
250
|
state.currentView = DATEPICKER.Year;
|
|
247
251
|
} else {
|
|
248
252
|
state.currentView = DATEPICKER.Date;
|
|
@@ -297,13 +301,13 @@ const handleKeyControl = ({ state, emit }) => (keyCode) => {
|
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
303
|
};
|
|
300
|
-
const handleVisibleTimeChange = ({ api,
|
|
304
|
+
const handleVisibleTimeChange = ({ api, vm, state, t }) => (value) => {
|
|
301
305
|
const time = parseDate(value, state.timeFormat, t);
|
|
302
306
|
if (time && api.checkDateWithinRange(time)) {
|
|
303
307
|
state.date = modifyDate(time, state.year, state.month, state.monthDate);
|
|
304
308
|
state.userInputTime = null;
|
|
305
|
-
if (refs.timepicker) {
|
|
306
|
-
refs.timepicker.state.value = state.date;
|
|
309
|
+
if (vm.$refs.timepicker) {
|
|
310
|
+
vm.$refs.timepicker.state.value = state.date;
|
|
307
311
|
}
|
|
308
312
|
state.timePickerVisible = false;
|
|
309
313
|
api.cusEmit(state.date, true);
|
|
@@ -322,7 +326,7 @@ const handleVisibleDateChange = ({ api, state, t }) => (value) => {
|
|
|
322
326
|
}
|
|
323
327
|
};
|
|
324
328
|
const isValidValue = ({ api, state }) => (value) => value && !isNaN(value) && (typeof state.disabledDate === "function" ? !state.disabledDate(value) : true) && api.checkDateWithinRange(value);
|
|
325
|
-
const getDefaultValue = (state) => () => state.defaultValue ? new Date(state.defaultValue) :
|
|
329
|
+
const getDefaultValue = (state) => () => state.defaultValue ? new Date(state.defaultValue) : new Date();
|
|
326
330
|
const checkDateWithinRange = ({ state }) => (date) => state.selectableRange.length > 0 ? timeWithinRange(date, state.selectableRange, state.format || "HH:mm:ss") : true;
|
|
327
331
|
const selectTz = ({ emit, state }) => (tz) => {
|
|
328
332
|
if (state.timezone.isServiceTimezone) {
|
package/date-panel/vue.js
CHANGED
|
@@ -75,7 +75,7 @@ const api = [
|
|
|
75
75
|
const initState = ({ reactive, computed, api: api2, i18n }) => {
|
|
76
76
|
const state = reactive({
|
|
77
77
|
popperClass: "",
|
|
78
|
-
date:
|
|
78
|
+
date: new Date(),
|
|
79
79
|
value: "",
|
|
80
80
|
defaultValue: null,
|
|
81
81
|
defaultTime: null,
|
|
@@ -101,12 +101,12 @@ const initState = ({ reactive, computed, api: api2, i18n }) => {
|
|
|
101
101
|
tz: "",
|
|
102
102
|
selectedTz: null,
|
|
103
103
|
animationName: "",
|
|
104
|
-
startYear: Math.floor(
|
|
105
|
-
year: computed(() => state.date.getFullYear()),
|
|
106
|
-
month: computed(() => state.date.getMonth()),
|
|
104
|
+
startYear: Math.floor(new Date().getFullYear() / 10) * 10,
|
|
105
|
+
year: computed(() => !Array.isArray(state.date) && state.date.getFullYear()),
|
|
106
|
+
month: computed(() => !Array.isArray(state.date) && state.date.getMonth()),
|
|
107
107
|
week: computed(() => getWeekNumber(state.date)),
|
|
108
108
|
monthDate: computed(() => state.date.getDate()),
|
|
109
|
-
footerVisible: computed(() => state.showTime ||
|
|
109
|
+
footerVisible: computed(() => state.showTime || [DATEPICKER.Dates, DATEPICKER.Years].includes(state.selectionMode)),
|
|
110
110
|
visibleTime: computed(() => api2.computerVisibleTime()),
|
|
111
111
|
visibleDate: computed(() => api2.computerVisibleDate()),
|
|
112
112
|
yearLabel: computed(() => api2.getYearLabel()),
|
|
@@ -114,7 +114,7 @@ const initState = ({ reactive, computed, api: api2, i18n }) => {
|
|
|
114
114
|
dateFormat: computed(() => state.format ? extractDateFormat(state.format.replace(state.timefmt, "")) : DATE.Date),
|
|
115
115
|
lang: computed(() => i18n ? i18n.locale.replace(/_/g, "-") : "zh-CN"),
|
|
116
116
|
isShowTz: computed(() => state.showTimezone && state.showTime),
|
|
117
|
-
isShowFooter: computed(() => state.footerVisible && state.currentView
|
|
117
|
+
isShowFooter: computed(() => state.footerVisible && [DATEPICKER.Date, DATEPICKER.Year].includes(state.currentView))
|
|
118
118
|
});
|
|
119
119
|
state.needChangeTimezoneData = true;
|
|
120
120
|
return state;
|
|
@@ -146,7 +146,7 @@ const initWatch = ({ watch, state, api: api2, nextTick }) => {
|
|
|
146
146
|
);
|
|
147
147
|
watch(() => state.visible, api2.watchVisible);
|
|
148
148
|
};
|
|
149
|
-
const initApi = ({ api: api2, state, t, emit, nextTick, vm,
|
|
149
|
+
const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch }) => {
|
|
150
150
|
Object.assign(api2, {
|
|
151
151
|
t,
|
|
152
152
|
state,
|
|
@@ -171,7 +171,7 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, refs, watch }) => {
|
|
|
171
171
|
watchTimePickerVisible: watchTimePickerVisible({ nextTick, vm }),
|
|
172
172
|
checkDateWithinRange: checkDateWithinRange({ state }),
|
|
173
173
|
watchSelectionMode: watchSelectionMode({ state }),
|
|
174
|
-
proxyTimePickerDataProperties: proxyTimePickerDataProperties({
|
|
174
|
+
proxyTimePickerDataProperties: proxyTimePickerDataProperties({ vm, state, watch }),
|
|
175
175
|
handleKeyControl: handleKeyControl({ state, emit }),
|
|
176
176
|
doPick: doPick(emit),
|
|
177
177
|
searchTz: searchTz({ api: api2, state }),
|
|
@@ -186,20 +186,20 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, refs, watch }) => {
|
|
|
186
186
|
handleMonthPick: handleMonthPick({ api: api2, state }),
|
|
187
187
|
handleVisibleDateChange: handleVisibleDateChange({ api: api2, state, t }),
|
|
188
188
|
handleTimePick: handleTimePick({ api: api2, state, t }),
|
|
189
|
-
handleVisibleTimeChange: handleVisibleTimeChange({ api: api2, refs, state, t }),
|
|
190
189
|
handleYearPick: handleYearPick({ api: api2, state }),
|
|
191
190
|
handleDatePick: handleDatePick({ api: api2, state, t }),
|
|
192
|
-
handleShortcutClick: handleShortcutClick(api2),
|
|
193
191
|
computerVisibleTime: computerVisibleTime({ state, t }),
|
|
192
|
+
handleShortcutClick: handleShortcutClick(api2),
|
|
194
193
|
computerVisibleDate: computerVisibleDate({ state, t }),
|
|
194
|
+
handleVisibleTimeChange: handleVisibleTimeChange({ api: api2, vm, state, t }),
|
|
195
195
|
computerTimeFormat: computerTimeFormat({ state })
|
|
196
196
|
});
|
|
197
197
|
};
|
|
198
|
-
const renderless = (props, { computed, reactive, watch, nextTick }, { t,
|
|
198
|
+
const renderless = (props, { computed, reactive, watch, nextTick }, { t, emit: $emit, vm, i18n }) => {
|
|
199
199
|
const api2 = {};
|
|
200
200
|
const emit = props.emitter ? props.emitter.emit : $emit;
|
|
201
201
|
const state = initState({ reactive, computed, api: api2, i18n });
|
|
202
|
-
initApi({ api: api2, state, t, emit, nextTick, vm,
|
|
202
|
+
initApi({ api: api2, state, t, emit, nextTick, vm, watch });
|
|
203
203
|
initWatch({ watch, state, api: api2, nextTick });
|
|
204
204
|
return api2;
|
|
205
205
|
};
|
package/date-picker/index.js
CHANGED
|
@@ -98,7 +98,11 @@ const padZero = (num, targetLength = 2) => {
|
|
|
98
98
|
const updateColumnValue = ({ constants, nextTick, props, refs, state }) => () => {
|
|
99
99
|
const value = state.innerValue;
|
|
100
100
|
const { formatter } = props;
|
|
101
|
-
let values = [
|
|
101
|
+
let values = [
|
|
102
|
+
formatter("year", `${value.getFullYear()}`),
|
|
103
|
+
formatter("month", padZero(value.getMonth() + 1)),
|
|
104
|
+
formatter("day", padZero(value.getDate()))
|
|
105
|
+
];
|
|
102
106
|
if (props.type === constants.DateTime) {
|
|
103
107
|
values.push(formatter("hour", padZero(value.getHours())), formatter("minute", padZero(value.getMinutes())));
|
|
104
108
|
}
|
|
@@ -156,7 +160,7 @@ function times(n, iteratee) {
|
|
|
156
160
|
}
|
|
157
161
|
return result;
|
|
158
162
|
}
|
|
159
|
-
const
|
|
163
|
+
const getOriginColumns = (state) => () => state.ranges.map(({ type, range: rangeArr }) => {
|
|
160
164
|
let values = times(rangeArr[1] - rangeArr[0] + 1, (index) => {
|
|
161
165
|
const value = padZero(rangeArr[0] + index);
|
|
162
166
|
return value;
|
|
@@ -212,7 +216,7 @@ const hookMounted = ({ constants, parent, refs, nextTick }) => () => {
|
|
|
212
216
|
parent.$emit(constants.HookMounted, refs.refrence.$el);
|
|
213
217
|
});
|
|
214
218
|
};
|
|
215
|
-
const
|
|
219
|
+
const showPickerAndLockScroll = ({ constants, state }) => () => {
|
|
216
220
|
state.visible = true;
|
|
217
221
|
document.body.style.overflow = constants.Hidden;
|
|
218
222
|
state.isReadonly = true;
|
|
@@ -228,7 +232,7 @@ export {
|
|
|
228
232
|
getColumns,
|
|
229
233
|
getDisplayValue,
|
|
230
234
|
getMonthEndDay,
|
|
231
|
-
|
|
235
|
+
getOriginColumns,
|
|
232
236
|
getRanges,
|
|
233
237
|
getTrueValue,
|
|
234
238
|
hookMounted,
|
|
@@ -236,7 +240,7 @@ export {
|
|
|
236
240
|
onChange,
|
|
237
241
|
onConfirm,
|
|
238
242
|
padZero,
|
|
239
|
-
|
|
243
|
+
showPickerAndLockScroll,
|
|
240
244
|
times,
|
|
241
245
|
updateColumnValue,
|
|
242
246
|
updateInnerValue
|
package/date-picker/vue.js
CHANGED
|
@@ -2,14 +2,14 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
import {
|
|
3
3
|
getBoundary,
|
|
4
4
|
clearDisplayValue,
|
|
5
|
-
|
|
5
|
+
showPickerAndLockScroll,
|
|
6
6
|
hookMounted,
|
|
7
7
|
getMonthEndDay,
|
|
8
8
|
getDisplayValue,
|
|
9
9
|
getRanges,
|
|
10
10
|
onConfirm,
|
|
11
11
|
onCancel,
|
|
12
|
-
|
|
12
|
+
getOriginColumns,
|
|
13
13
|
getColumns,
|
|
14
14
|
updateInnerValue,
|
|
15
15
|
formatValue,
|
|
@@ -17,7 +17,15 @@ import {
|
|
|
17
17
|
updateColumnValue
|
|
18
18
|
} from "./index";
|
|
19
19
|
import { DATE } from "../common";
|
|
20
|
-
const api = [
|
|
20
|
+
const api = [
|
|
21
|
+
"state",
|
|
22
|
+
"clearDisplayValue",
|
|
23
|
+
"showPickerAndLockScroll",
|
|
24
|
+
"hookMounted",
|
|
25
|
+
"onConfirm",
|
|
26
|
+
"onCancel",
|
|
27
|
+
"onChange"
|
|
28
|
+
];
|
|
21
29
|
const setWatchFn = ({ api: api2, watch, props, state, emit }) => {
|
|
22
30
|
watch(
|
|
23
31
|
() => props.minDate,
|
|
@@ -68,13 +76,17 @@ const setWatchFn = ({ api: api2, watch, props, state, emit }) => {
|
|
|
68
76
|
}
|
|
69
77
|
);
|
|
70
78
|
};
|
|
71
|
-
const renderless = (props,
|
|
72
|
-
const api2 = {
|
|
79
|
+
const renderless = (props, { computed, onMounted, reactive, watch }, { constants, emit, nextTick, refs, parent }) => {
|
|
80
|
+
const api2 = {
|
|
81
|
+
formatValue: formatValue(props),
|
|
82
|
+
getMonthEndDay: getMonthEndDay(constants),
|
|
83
|
+
hookMounted: hookMounted({ constants, parent, refs, nextTick })
|
|
84
|
+
};
|
|
73
85
|
const state = reactive({
|
|
74
86
|
visible: false,
|
|
75
87
|
innerValue: formatValue(props)(props.modelValue),
|
|
76
88
|
ranges: computed(() => api2.getRanges()),
|
|
77
|
-
originColumns: computed(() => api2.
|
|
89
|
+
originColumns: computed(() => api2.getOriginColumns()),
|
|
78
90
|
columns: computed(() => api2.getColumns()),
|
|
79
91
|
displayValue: "",
|
|
80
92
|
isReadonly: false,
|
|
@@ -82,12 +94,12 @@ const renderless = (props, context, { computed, onMounted, reactive, watch }, {
|
|
|
82
94
|
});
|
|
83
95
|
Object.assign(api2, {
|
|
84
96
|
state,
|
|
85
|
-
|
|
97
|
+
getOriginColumns: getOriginColumns(state),
|
|
86
98
|
onCancel: onCancel({ emit, state }),
|
|
87
99
|
getColumns: getColumns({ props, state }),
|
|
88
100
|
clearDisplayValue: clearDisplayValue(state),
|
|
89
101
|
getDisplayValue: getDisplayValue({ constants, DATE, props, state }),
|
|
90
|
-
|
|
102
|
+
showPickerAndLockScroll: showPickerAndLockScroll({ constants, state }),
|
|
91
103
|
updateColumnValue: updateColumnValue({ constants, nextTick, props, refs, state })
|
|
92
104
|
});
|
|
93
105
|
api2.getBoundary = getBoundary({ api: api2, constants, props });
|
|
@@ -11,7 +11,7 @@ const isSameDay = (day1, day2) => {
|
|
|
11
11
|
return theDay1.getFullYear() === theDay2.getFullYear() && theDay1.getMonth() === theDay2.getMonth() && theDay1.getDate() === theDay2.getDate();
|
|
12
12
|
};
|
|
13
13
|
const getCurrentDate = () => (dateValue) => {
|
|
14
|
-
const today =
|
|
14
|
+
const today = new Date();
|
|
15
15
|
const theDate = new Date(dateValue);
|
|
16
16
|
const year = theDate.getFullYear();
|
|
17
17
|
const month = theDate.getMonth() + 1;
|
|
@@ -53,7 +53,7 @@ const loadingDate = ({ state, api }) => (direction) => {
|
|
|
53
53
|
}, 300);
|
|
54
54
|
};
|
|
55
55
|
const initPanel = ({ state, api }) => (dateValue, direction, yearNum = 1) => {
|
|
56
|
-
const currentDate = dateValue || (Array.isArray(state.date) ? state.date[1] : state.date) ||
|
|
56
|
+
const currentDate = dateValue || (Array.isArray(state.date) ? state.date[1] : state.date) || new Date();
|
|
57
57
|
let month = currentDate.getMonth() + 1;
|
|
58
58
|
let year = direction === "top" ? currentDate.getFullYear() - 1 : currentDate.getFullYear();
|
|
59
59
|
if (yearNum === 1 && !direction) {
|
|
@@ -130,7 +130,7 @@ const watchModelValue = ({ props, state }) => () => {
|
|
|
130
130
|
state.date = modelValue && modelValue.length ? modelValue.map((date) => new Date(date)) : [];
|
|
131
131
|
}
|
|
132
132
|
if (["datetime", "date"].includes(type)) {
|
|
133
|
-
state.date = modelValue ? new Date(modelValue) :
|
|
133
|
+
state.date = modelValue ? new Date(modelValue) : new Date();
|
|
134
134
|
}
|
|
135
135
|
if (["datetimerange", "datetime"].includes(type)) {
|
|
136
136
|
const length = type === "datetime" ? 1 : 2;
|
package/date-range/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
prevMonth,
|
|
13
13
|
modifyWithTimeString
|
|
14
14
|
} from "../common/deps/date-util";
|
|
15
|
-
const calcDefaultValue = (
|
|
16
|
-
if (Array.isArray(
|
|
17
|
-
return [new Date(
|
|
18
|
-
} else if (
|
|
19
|
-
return [new Date(
|
|
15
|
+
const calcDefaultValue = (defaultVal) => {
|
|
16
|
+
if (Array.isArray(defaultVal)) {
|
|
17
|
+
return [new Date(defaultVal[0]), new Date(defaultVal[1])];
|
|
18
|
+
} else if (defaultVal) {
|
|
19
|
+
return [new Date(defaultVal), nextDate(new Date(defaultVal), 1)];
|
|
20
20
|
}
|
|
21
|
-
return [
|
|
21
|
+
return [new Date(), nextDate(new Date(), 1)];
|
|
22
22
|
};
|
|
23
23
|
const getMinVisibleDate = ({ state, t }) => () => {
|
|
24
24
|
if (state.dateUserInput.min !== null) {
|
|
@@ -70,7 +70,9 @@ const watchMinDate = ({ state, t, vm }) => (value) => {
|
|
|
70
70
|
}
|
|
71
71
|
if (state.maxDate && state.maxDate < state.minDate) {
|
|
72
72
|
const format = "HH:mm:ss";
|
|
73
|
-
minTimePicker.state.selectableRange = [
|
|
73
|
+
minTimePicker.state.selectableRange = [
|
|
74
|
+
[parseDate(formatDate(state.minDate, format, t), format, t), parseDate("23:59:59", format, t)]
|
|
75
|
+
];
|
|
74
76
|
}
|
|
75
77
|
if (value) {
|
|
76
78
|
minTimePicker.state.value = value;
|
|
@@ -154,13 +156,23 @@ const handleDateInput = ({ state, t }) => (value, type) => {
|
|
|
154
156
|
return;
|
|
155
157
|
}
|
|
156
158
|
if (type === "min") {
|
|
157
|
-
state.minDate = modifyDate(
|
|
159
|
+
state.minDate = modifyDate(
|
|
160
|
+
state.minDate || new Date(),
|
|
161
|
+
parsedValue.getFullYear(),
|
|
162
|
+
parsedValue.getMonth(),
|
|
163
|
+
parsedValue.getDate()
|
|
164
|
+
);
|
|
158
165
|
state.leftDate = new Date(parsedValue);
|
|
159
166
|
if (!state.unlinkPanels) {
|
|
160
167
|
state.rightDate = nextMonth(state.leftDate);
|
|
161
168
|
}
|
|
162
169
|
} else {
|
|
163
|
-
state.maxDate = modifyDate(
|
|
170
|
+
state.maxDate = modifyDate(
|
|
171
|
+
state.maxDate || new Date(),
|
|
172
|
+
parsedValue.getFullYear(),
|
|
173
|
+
parsedValue.getMonth(),
|
|
174
|
+
parsedValue.getDate()
|
|
175
|
+
);
|
|
164
176
|
state.rightDate = new Date(parsedValue);
|
|
165
177
|
if (!state.unlinkPanels) {
|
|
166
178
|
state.leftDate = prevMonth(parsedValue);
|
|
@@ -172,12 +184,22 @@ const handleDateChange = ({ state, t }) => (value, type) => {
|
|
|
172
184
|
const parsedValue = parseDate(value, state.dateFormat, t);
|
|
173
185
|
if (parsedValue) {
|
|
174
186
|
if (type === "min") {
|
|
175
|
-
state.minDate = modifyDate(
|
|
187
|
+
state.minDate = modifyDate(
|
|
188
|
+
state.minDate || new Date(),
|
|
189
|
+
parsedValue.getFullYear(),
|
|
190
|
+
parsedValue.getMonth(),
|
|
191
|
+
parsedValue.getDate()
|
|
192
|
+
);
|
|
176
193
|
if (state.minDate > state.maxDate) {
|
|
177
194
|
state.maxDate = state.minDate;
|
|
178
195
|
}
|
|
179
196
|
} else {
|
|
180
|
-
state.maxDate = modifyDate(
|
|
197
|
+
state.maxDate = modifyDate(
|
|
198
|
+
state.maxDate || new Date(),
|
|
199
|
+
parsedValue.getFullYear(),
|
|
200
|
+
parsedValue.getMonth(),
|
|
201
|
+
parsedValue.getDate()
|
|
202
|
+
);
|
|
181
203
|
if (state.maxDate < state.minDate) {
|
|
182
204
|
state.minDate = state.maxDate;
|
|
183
205
|
}
|
|
@@ -192,9 +214,19 @@ const handleTimeInput = ({ state, t }) => (value, type) => {
|
|
|
192
214
|
const parsedValue = parseDate(value, state.timeFormat, t);
|
|
193
215
|
if (parsedValue) {
|
|
194
216
|
if (type === "min") {
|
|
195
|
-
state.minDate = modifyTime(
|
|
217
|
+
state.minDate = modifyTime(
|
|
218
|
+
state.minDate,
|
|
219
|
+
parsedValue.getHours(),
|
|
220
|
+
parsedValue.getMinutes(),
|
|
221
|
+
parsedValue.getSeconds()
|
|
222
|
+
);
|
|
196
223
|
} else {
|
|
197
|
-
state.maxDate = modifyTime(
|
|
224
|
+
state.maxDate = modifyTime(
|
|
225
|
+
state.maxDate,
|
|
226
|
+
parsedValue.getHours(),
|
|
227
|
+
parsedValue.getMinutes(),
|
|
228
|
+
parsedValue.getSeconds()
|
|
229
|
+
);
|
|
198
230
|
}
|
|
199
231
|
}
|
|
200
232
|
};
|
|
@@ -202,14 +234,24 @@ const handleTimeChange = ({ state, t, vm }) => (value, type) => {
|
|
|
202
234
|
const parsedValue = parseDate(value, state.timeFormat, t);
|
|
203
235
|
if (parsedValue) {
|
|
204
236
|
if (type === "min") {
|
|
205
|
-
state.minDate = modifyTime(
|
|
237
|
+
state.minDate = modifyTime(
|
|
238
|
+
state.minDate,
|
|
239
|
+
parsedValue.getHours(),
|
|
240
|
+
parsedValue.getMinutes(),
|
|
241
|
+
parsedValue.getSeconds()
|
|
242
|
+
);
|
|
206
243
|
if (state.minDate > state.maxDate) {
|
|
207
244
|
state.maxDate = state.minDate;
|
|
208
245
|
}
|
|
209
246
|
vm.$refs.minTimePicker.state.value = state.minDate;
|
|
210
247
|
state.minTimePickerVisible = false;
|
|
211
248
|
} else {
|
|
212
|
-
state.maxDate = modifyTime(
|
|
249
|
+
state.maxDate = modifyTime(
|
|
250
|
+
state.maxDate,
|
|
251
|
+
parsedValue.getHours(),
|
|
252
|
+
parsedValue.getMinutes(),
|
|
253
|
+
parsedValue.getSeconds()
|
|
254
|
+
);
|
|
213
255
|
if (state.maxDate < state.minDate) {
|
|
214
256
|
state.minDate = state.maxDate;
|
|
215
257
|
}
|
|
@@ -220,8 +262,17 @@ const handleTimeChange = ({ state, t, vm }) => (value, type) => {
|
|
|
220
262
|
};
|
|
221
263
|
const handleRangePick = ({ api, state, t }) => (val, close = true) => {
|
|
222
264
|
const defaultTime = state.defaultTime || [];
|
|
223
|
-
|
|
224
|
-
|
|
265
|
+
let minDateVal = val.minDate;
|
|
266
|
+
let maxDateVal = val.maxDate;
|
|
267
|
+
if (state.singleSelect) {
|
|
268
|
+
Object.assign(state.rangeState, { selecting: false });
|
|
269
|
+
const effectDate = val.minDate || val.maxDate;
|
|
270
|
+
const rangeDate = state.shortcutType === "startFrom" ? state.maxRangeDate : state.minRangeDate;
|
|
271
|
+
minDateVal = rangeDate > effectDate ? effectDate : rangeDate;
|
|
272
|
+
maxDateVal = rangeDate > effectDate ? rangeDate : effectDate;
|
|
273
|
+
}
|
|
274
|
+
const minDate = modifyWithTimeString(minDateVal, defaultTime[0], t);
|
|
275
|
+
const maxDate = modifyWithTimeString(maxDateVal, defaultTime[1], t);
|
|
225
276
|
if (state.maxDate === maxDate && state.minDate === minDate) {
|
|
226
277
|
return;
|
|
227
278
|
}
|
|
@@ -237,7 +288,20 @@ const handleRangePick = ({ api, state, t }) => (val, close = true) => {
|
|
|
237
288
|
}
|
|
238
289
|
api.handleConfirm();
|
|
239
290
|
};
|
|
240
|
-
const handleShortcutClick = (api) => (shortcut) => {
|
|
291
|
+
const handleShortcutClick = (state, api) => (shortcut) => {
|
|
292
|
+
if (shortcut.type) {
|
|
293
|
+
state.singleSelect = true;
|
|
294
|
+
state.shortcutType = shortcut.type;
|
|
295
|
+
state.shortcutText = shortcut.text;
|
|
296
|
+
if (shortcut.type === "startFrom" && shortcut.endDate && isDate(shortcut.endDate)) {
|
|
297
|
+
state.maxRangeDate = shortcut.endDate;
|
|
298
|
+
}
|
|
299
|
+
if (shortcut.type === "endAt" && shortcut.startDate && isDate(shortcut.startDate)) {
|
|
300
|
+
state.minRangeDate = shortcut.startDate;
|
|
301
|
+
}
|
|
302
|
+
state.value = [];
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
241
305
|
if (shortcut.onClick) {
|
|
242
306
|
const picker = {
|
|
243
307
|
$emit: (type, [start, end]) => {
|
|
@@ -251,7 +315,7 @@ const doPick = (emit) => (start, end) => {
|
|
|
251
315
|
emit("pick", [start, end], false);
|
|
252
316
|
};
|
|
253
317
|
const handleMinTimePick = ({ state }) => (value, visible, first) => {
|
|
254
|
-
state.minDate = state.minDate ||
|
|
318
|
+
state.minDate = state.minDate || new Date();
|
|
255
319
|
if (value) {
|
|
256
320
|
state.minDate = modifyTime(state.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
|
|
257
321
|
}
|
|
@@ -327,6 +391,13 @@ const setTimeFormat = ({ nextTick, vm, state }) => () => {
|
|
|
327
391
|
const computerBtnDisabled = ({ state, api }) => () => !(state.minDate && state.maxDate && !state.selecting && api.isValidValue([state.minDate, state.maxDate]));
|
|
328
392
|
const computerLabel = ({ state, t }) => (type) => `${state[type].getFullYear()} ${t("ui.datepicker.year")} ${t(`ui.datepicker.month${state[type].getMonth() + 1}`)}`;
|
|
329
393
|
const computerEnableYearArrow = (state) => () => state.unlinkPanels && state.rightYear * 12 + state.rightMonth - (state.leftYear * 12 + state.leftMonth + 1) >= 12;
|
|
394
|
+
const watchPickerVisible = ({ state, constants }) => (val) => {
|
|
395
|
+
if (!val) {
|
|
396
|
+
state.singleSelect = false;
|
|
397
|
+
state.minRangeDate = constants.startDate;
|
|
398
|
+
state.maxRangeDate = constants.endDate;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
330
401
|
export {
|
|
331
402
|
calcDefaultValue,
|
|
332
403
|
computerBtnDisabled,
|
|
@@ -367,5 +438,6 @@ export {
|
|
|
367
438
|
watchMaxTimePickerVisible,
|
|
368
439
|
watchMinDate,
|
|
369
440
|
watchMinTimePickerVisible,
|
|
441
|
+
watchPickerVisible,
|
|
370
442
|
watchValue
|
|
371
443
|
};
|