@nutui/nutui 3.1.16-beta.1 → 3.1.17
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/CHANGELOG.md +59 -1
- package/dist/nutui.d.ts +3 -1
- package/dist/nutui.es.js +1759 -689
- package/dist/nutui.umd.js +1765 -690
- package/dist/packages/_es/ActionSheet.js +2 -2
- package/dist/packages/_es/Address.js +60 -7
- package/dist/packages/_es/Audio.js +289 -0
- package/dist/packages/_es/Avatar.js +1 -1
- package/dist/packages/_es/BackTop.js +1 -1
- package/dist/packages/_es/Badge.js +1 -1
- package/dist/packages/_es/Barrage.js +1 -1
- package/dist/packages/_es/Button.js +13 -4
- package/dist/packages/_es/Calendar.js +428 -209
- package/dist/packages/_es/Card.js +1 -2
- package/dist/packages/_es/Cascader.js +2 -2
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +2 -2
- package/dist/packages/_es/CheckboxGroup.js +1 -1
- package/dist/packages/_es/CircleProgress.js +1 -1
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +1 -1
- package/dist/packages/_es/CollapseItem.js +1 -1
- package/dist/packages/_es/CountDown.js +1 -1
- package/dist/packages/_es/CountUp.js +1 -1
- package/dist/packages/_es/DatePicker.js +1 -2
- package/dist/packages/_es/Dialog.js +1 -1
- package/dist/packages/_es/Divider.js +1 -1
- package/dist/packages/_es/Drag.js +1 -1
- package/dist/packages/_es/Elevator.js +10 -5
- package/dist/packages/_es/Empty.js +1 -1
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +1 -1
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +1 -1
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +1 -3
- package/dist/packages/_es/Indicator.js +1 -1
- package/dist/packages/_es/InfiniteLoading.js +1 -1
- package/dist/packages/_es/Input.js +7 -2
- package/dist/packages/_es/InputNumber.js +1 -1
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/Menu.js +2 -2
- package/dist/packages/_es/MenuItem.js +1 -1
- package/dist/packages/_es/Navbar.js +1 -1
- package/dist/packages/_es/NoticeBar.js +1 -4
- package/dist/packages/_es/Notify.js +1 -1
- package/dist/packages/_es/NumberKeyboard.js +1 -2
- package/dist/packages/_es/OverLay.js +1 -1
- package/dist/packages/_es/Pagination.js +1 -1
- package/dist/packages/_es/Picker.js +1 -1
- package/dist/packages/_es/Popover.js +1 -1
- package/dist/packages/_es/Popup.js +1 -1
- package/dist/packages/_es/Price.js +2 -2
- package/dist/packages/_es/Progress.js +24 -11
- package/dist/packages/_es/Radio.js +2 -2
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +3 -3
- package/dist/packages/_es/Rate.js +1 -1
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +1 -1
- package/dist/packages/_es/ShortPassword.js +5 -2
- package/dist/packages/_es/SideNavBar.js +1 -1
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +1 -1
- package/dist/packages/_es/Skeleton.js +8 -6
- package/dist/packages/_es/Sku.js +1 -1
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +143 -0
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +2 -2
- package/dist/packages/_es/Swiper.js +1 -1
- package/dist/packages/_es/SwiperItem.js +3 -8
- package/dist/packages/_es/Switch.js +2 -2
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +1 -1
- package/dist/packages/_es/TabbarItem.js +1 -1
- package/dist/packages/_es/Table.js +2 -2
- package/dist/packages/_es/Tabs.js +1 -1
- package/dist/packages/_es/Tag.js +1 -1
- package/dist/packages/_es/TextArea.js +1 -1
- package/dist/packages/_es/TimeDetail.js +1 -1
- package/dist/packages/_es/TimePannel.js +1 -1
- package/dist/packages/_es/TimeSelect.js +1 -1
- package/dist/packages/_es/Toast.js +1 -1
- package/dist/packages/_es/Uploader.js +1 -1
- package/dist/packages/_es/Video.js +1 -55
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index2.js +28 -56
- package/dist/packages/_es/index3.js +56 -28
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/address/index.scss +8 -0
- package/dist/packages/audio/index.scss +66 -0
- package/dist/packages/audiooperate/index.scss +13 -0
- package/dist/packages/calendar/index.scss +47 -41
- package/dist/packages/calendaritem/index.scss +57 -42
- package/dist/packages/elevator/index.scss +3 -0
- package/dist/packages/infiniteloading/index.scss +1 -1
- package/dist/packages/input/index.scss +4 -2
- package/dist/packages/range/index.scss +4 -4
- package/dist/packages/row/index.scss +3 -0
- package/dist/packages/sticky/index.scss +5 -0
- package/dist/packages/tabbar/index.scss +4 -2
- package/dist/style.css +1 -1
- package/dist/styles/font/config.json +6 -1
- package/dist/styles/font/demo_index.html +118 -3
- package/dist/styles/font/iconfont.css +23 -3
- package/dist/styles/font/iconfont.js +25 -24
- package/dist/styles/font/iconfont.json +35 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +43 -40
- package/dist/styles/variables.scss +34 -31
- package/package.json +12 -13
|
@@ -15,11 +15,11 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.16
|
|
18
|
+
* @nutui/nutui v3.1.16 Fri Feb 25 2022 18:32:15 GMT+0800 (中国标准时间)
|
|
19
19
|
* (c) 2021 @jdf2e.
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
22
|
-
import { ref, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode,
|
|
22
|
+
import { ref, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, normalizeStyle, createTextVNode, resolveComponent, createBlock, withCtx, createSlots } from "vue";
|
|
23
23
|
import { c as createComponent } from "./component.js";
|
|
24
24
|
import { r as requestAniFrame } from "./raf.js";
|
|
25
25
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
@@ -119,12 +119,36 @@ const _sfc_main$1 = create$1({
|
|
|
119
119
|
type: Boolean,
|
|
120
120
|
default: true
|
|
121
121
|
},
|
|
122
|
+
showTitle: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: true
|
|
125
|
+
},
|
|
126
|
+
showSubTitle: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true
|
|
129
|
+
},
|
|
130
|
+
showToday: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: true
|
|
133
|
+
},
|
|
122
134
|
title: {
|
|
123
135
|
type: String,
|
|
124
136
|
default: "\u65E5\u5386\u9009\u62E9"
|
|
125
137
|
},
|
|
126
|
-
|
|
138
|
+
confirmText: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: "\u786E\u8BA4"
|
|
141
|
+
},
|
|
142
|
+
startText: {
|
|
127
143
|
type: String,
|
|
144
|
+
default: "\u5F00\u59CB"
|
|
145
|
+
},
|
|
146
|
+
endText: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: "\u7ED3\u675F"
|
|
149
|
+
},
|
|
150
|
+
defaultValue: {
|
|
151
|
+
type: [String, Array],
|
|
128
152
|
default: null
|
|
129
153
|
},
|
|
130
154
|
startDate: {
|
|
@@ -136,15 +160,32 @@ const _sfc_main$1 = create$1({
|
|
|
136
160
|
default: Utils.getDay(365)
|
|
137
161
|
}
|
|
138
162
|
},
|
|
139
|
-
emits: ["choose", "update", "close"],
|
|
140
|
-
setup(props, { emit }) {
|
|
163
|
+
emits: ["choose", "update", "close", "select"],
|
|
164
|
+
setup(props, { emit, slots }) {
|
|
141
165
|
const weeks = ref(["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]);
|
|
142
166
|
const months = ref(null);
|
|
143
167
|
const monthsPanel = ref(null);
|
|
144
168
|
const weeksPanel = ref(null);
|
|
169
|
+
const viewArea = ref(null);
|
|
170
|
+
const viewHeight = ref(0);
|
|
171
|
+
const compConthsData = computed(() => {
|
|
172
|
+
return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
|
|
173
|
+
});
|
|
174
|
+
const showTopBtn = computed(() => {
|
|
175
|
+
return slots.btn;
|
|
176
|
+
});
|
|
177
|
+
const topInfo = computed(() => {
|
|
178
|
+
return slots.topInfo;
|
|
179
|
+
});
|
|
180
|
+
const bottomInfo = computed(() => {
|
|
181
|
+
return slots.bottomInfo;
|
|
182
|
+
});
|
|
145
183
|
const state = reactive({
|
|
146
184
|
yearMonthTitle: "",
|
|
185
|
+
defaultRange: [],
|
|
147
186
|
currDate: "",
|
|
187
|
+
propStartDate: "",
|
|
188
|
+
propEndDate: "",
|
|
148
189
|
unLoadPrev: false,
|
|
149
190
|
touchParams: {
|
|
150
191
|
startY: 0,
|
|
@@ -164,7 +205,10 @@ const _sfc_main$1 = create$1({
|
|
|
164
205
|
startData: "",
|
|
165
206
|
endData: "",
|
|
166
207
|
isRange: props.type === "range",
|
|
167
|
-
timer: 0
|
|
208
|
+
timer: 0,
|
|
209
|
+
currentIndex: 0,
|
|
210
|
+
avgHeight: 0,
|
|
211
|
+
monthsNum: 0
|
|
168
212
|
});
|
|
169
213
|
const splitDate = (date) => {
|
|
170
214
|
return date.split("-");
|
|
@@ -176,14 +220,14 @@ const _sfc_main$1 = create$1({
|
|
|
176
220
|
return Utils.isEqual(state.currDate[1], currDate);
|
|
177
221
|
};
|
|
178
222
|
const getCurrDate = (day, month, isRange) => {
|
|
179
|
-
return
|
|
223
|
+
return month.curData[0] + "-" + month.curData[1] + "-" + Utils.getNumTwoBit(+day.day);
|
|
180
224
|
};
|
|
181
225
|
const getClass = (day, month, isRange) => {
|
|
182
|
-
const currDate = getCurrDate(day, month
|
|
226
|
+
const currDate = getCurrDate(day, month);
|
|
183
227
|
if (day.type == "curr") {
|
|
184
228
|
if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
|
|
185
229
|
return `${state.dayPrefix}-active`;
|
|
186
|
-
} else if (
|
|
230
|
+
} else if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
187
231
|
return `${state.dayPrefix}-disabled`;
|
|
188
232
|
} else if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length == 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
189
233
|
return `${state.dayPrefix}-choose`;
|
|
@@ -203,9 +247,8 @@ const _sfc_main$1 = create$1({
|
|
|
203
247
|
}
|
|
204
248
|
};
|
|
205
249
|
const chooseDay = (day, month, isFirst, isRange) => {
|
|
206
|
-
if (getClass(day, month
|
|
250
|
+
if (getClass(day, month) != `${state.dayPrefix}-disabled`) {
|
|
207
251
|
let days = [...month.curData];
|
|
208
|
-
days = isRange ? days.splice(3) : days.splice(0, 3);
|
|
209
252
|
days[2] = typeof day.day == "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
210
253
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
211
254
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
@@ -232,8 +275,11 @@ const _sfc_main$1 = create$1({
|
|
|
232
275
|
}
|
|
233
276
|
}
|
|
234
277
|
}
|
|
235
|
-
if (
|
|
236
|
-
|
|
278
|
+
if (!isFirst) {
|
|
279
|
+
emit("select", state.chooseData);
|
|
280
|
+
if (props.isAutoBackFill) {
|
|
281
|
+
confirm();
|
|
282
|
+
}
|
|
237
283
|
}
|
|
238
284
|
}
|
|
239
285
|
};
|
|
@@ -251,26 +297,47 @@ const _sfc_main$1 = create$1({
|
|
|
251
297
|
month = month == 12 ? 1 : ++month;
|
|
252
298
|
break;
|
|
253
299
|
}
|
|
254
|
-
return [
|
|
255
|
-
year,
|
|
256
|
-
Utils.getNumTwoBit(month),
|
|
257
|
-
Utils.getMonthDays(String(year), String(month))
|
|
258
|
-
];
|
|
300
|
+
return [year, Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month))];
|
|
259
301
|
};
|
|
260
|
-
const getDaysStatus = (days, type) => {
|
|
302
|
+
const getDaysStatus = (days, type, dateInfo) => {
|
|
303
|
+
let { year, month } = dateInfo;
|
|
261
304
|
if (type == "prev" && days >= 7) {
|
|
262
305
|
days -= 7;
|
|
263
306
|
}
|
|
264
307
|
return Array.from(Array(days), (v, k) => {
|
|
265
308
|
return {
|
|
266
309
|
day: k + 1,
|
|
267
|
-
type
|
|
310
|
+
type,
|
|
311
|
+
year,
|
|
312
|
+
month
|
|
268
313
|
};
|
|
269
314
|
});
|
|
270
315
|
};
|
|
316
|
+
const getPreDaysStatus = (days, type, dateInfo, preCurrMonthDays) => {
|
|
317
|
+
let { year, month } = dateInfo;
|
|
318
|
+
if (type == "prev" && days >= 7) {
|
|
319
|
+
days -= 7;
|
|
320
|
+
}
|
|
321
|
+
let months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
|
|
322
|
+
return {
|
|
323
|
+
day: k + 1,
|
|
324
|
+
type,
|
|
325
|
+
year,
|
|
326
|
+
month
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
return months2.slice(preCurrMonthDays - days);
|
|
330
|
+
};
|
|
271
331
|
const getMonth = (curData, type) => {
|
|
272
332
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
333
|
+
let preMonth = curData[1] - 1;
|
|
334
|
+
let preYear = curData[0];
|
|
335
|
+
if (preMonth <= 0) {
|
|
336
|
+
preMonth = 12;
|
|
337
|
+
preYear += 1;
|
|
338
|
+
}
|
|
273
339
|
const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
|
|
340
|
+
const preCurrMonthDays = Utils.getMonthDays(preYear + "", preMonth + "");
|
|
274
341
|
const title = {
|
|
275
342
|
year: curData[0],
|
|
276
343
|
month: curData[1]
|
|
@@ -279,10 +346,16 @@ const _sfc_main$1 = create$1({
|
|
|
279
346
|
curData,
|
|
280
347
|
title: `${title.year}\u5E74${title.month}\u6708`,
|
|
281
348
|
monthData: [
|
|
282
|
-
...
|
|
283
|
-
...getDaysStatus(currMonthDays, "curr")
|
|
349
|
+
...getPreDaysStatus(preMonthDays, "prev", { month: preMonth, year: preYear }, preCurrMonthDays),
|
|
350
|
+
...getDaysStatus(currMonthDays, "curr", title)
|
|
284
351
|
]
|
|
285
352
|
};
|
|
353
|
+
monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
|
|
354
|
+
let cssScrollHeight = 0;
|
|
355
|
+
if (state.monthsData.length > 0) {
|
|
356
|
+
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
357
|
+
}
|
|
358
|
+
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
286
359
|
if (type == "next") {
|
|
287
360
|
if (!state.endData || !Utils.compareDate(`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(state.endData[0], state.endData[1])}`, `${curData[0]}-${curData[1]}-${curData[2]}`)) {
|
|
288
361
|
state.monthsData.push(monthInfo);
|
|
@@ -296,44 +369,97 @@ const _sfc_main$1 = create$1({
|
|
|
296
369
|
}
|
|
297
370
|
};
|
|
298
371
|
const initData = () => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
372
|
+
let propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
|
|
373
|
+
let propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
|
|
374
|
+
state.propStartDate = propStartDate;
|
|
375
|
+
state.propEndDate = propEndDate;
|
|
376
|
+
state.startData = splitDate(propStartDate);
|
|
377
|
+
state.endData = splitDate(propEndDate);
|
|
378
|
+
if (!props.defaultValue || Array.isArray(props.defaultValue) && props.defaultValue.length <= 0) {
|
|
302
379
|
state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
|
|
303
380
|
} else {
|
|
304
381
|
state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;
|
|
305
382
|
}
|
|
383
|
+
const startDate = {
|
|
384
|
+
year: Number(state.startData[0]),
|
|
385
|
+
month: Number(state.startData[1])
|
|
386
|
+
};
|
|
387
|
+
const endDate = {
|
|
388
|
+
year: Number(state.endData[0]),
|
|
389
|
+
month: Number(state.endData[1])
|
|
390
|
+
};
|
|
391
|
+
let monthsNum = endDate.month - startDate.month;
|
|
392
|
+
if (endDate.year - startDate.year > 0) {
|
|
393
|
+
monthsNum = monthsNum + 12 * (endDate.year - startDate.year);
|
|
394
|
+
}
|
|
395
|
+
getMonth(state.startData, "next");
|
|
396
|
+
let i = 1;
|
|
397
|
+
do {
|
|
398
|
+
getMonth(getCurrData("next"), "next");
|
|
399
|
+
} while (i++ < monthsNum);
|
|
400
|
+
state.monthsNum = monthsNum;
|
|
306
401
|
if (state.isRange && Array.isArray(state.currDate)) {
|
|
307
|
-
if (
|
|
308
|
-
state.currDate.splice(0, 1,
|
|
402
|
+
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
403
|
+
state.currDate.splice(0, 1, propStartDate);
|
|
309
404
|
}
|
|
310
|
-
if (
|
|
311
|
-
state.currDate.splice(1, 1,
|
|
405
|
+
if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
|
|
406
|
+
state.currDate.splice(1, 1, propEndDate);
|
|
312
407
|
}
|
|
313
|
-
state.defaultData = [
|
|
314
|
-
...splitDate(state.currDate[0]),
|
|
315
|
-
...splitDate(state.currDate[1])
|
|
316
|
-
];
|
|
408
|
+
state.defaultData = [...splitDate(state.currDate[0]), ...splitDate(state.currDate[1])];
|
|
317
409
|
} else {
|
|
318
|
-
if (
|
|
319
|
-
state.currDate =
|
|
320
|
-
} else if (
|
|
321
|
-
state.currDate =
|
|
410
|
+
if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
|
|
411
|
+
state.currDate = propStartDate;
|
|
412
|
+
} else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
|
|
413
|
+
state.currDate = propEndDate;
|
|
322
414
|
}
|
|
323
415
|
state.defaultData = [...splitDate(state.currDate)];
|
|
324
416
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
417
|
+
let current = 0;
|
|
418
|
+
let lastCurrent = 0;
|
|
419
|
+
state.monthsData.forEach((item, index2) => {
|
|
420
|
+
if (item.title == `${state.defaultData[0]}\u5E74${state.defaultData[1]}\u6708`) {
|
|
421
|
+
current = index2;
|
|
422
|
+
}
|
|
423
|
+
if (state.isRange) {
|
|
424
|
+
if (item.title == `${state.defaultData[3]}\u5E74${state.defaultData[4]}\u6708`) {
|
|
425
|
+
lastCurrent = index2;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
setDefaultRange(monthsNum, current);
|
|
430
|
+
state.currentIndex = current;
|
|
431
|
+
state.yearMonthTitle = state.monthsData[state.currentIndex].title;
|
|
331
432
|
if (state.isRange) {
|
|
332
|
-
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[
|
|
333
|
-
chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[
|
|
433
|
+
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
|
|
434
|
+
chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[lastCurrent], true);
|
|
334
435
|
} else {
|
|
335
|
-
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[
|
|
436
|
+
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
|
|
336
437
|
}
|
|
438
|
+
let lastItem = state.monthsData[state.monthsData.length - 1];
|
|
439
|
+
let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
440
|
+
requestAniFrame(() => {
|
|
441
|
+
if ((months == null ? void 0 : months.value) && (monthsPanel == null ? void 0 : monthsPanel.value) && (viewArea == null ? void 0 : viewArea.value)) {
|
|
442
|
+
viewHeight.value = months.value.clientHeight;
|
|
443
|
+
monthsPanel.value.style.height = `${containerHeight}px`;
|
|
444
|
+
months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
|
|
448
|
+
};
|
|
449
|
+
const setDefaultRange = (monthsNum, current) => {
|
|
450
|
+
if (monthsNum >= 3) {
|
|
451
|
+
if (current > 0 && current < monthsNum) {
|
|
452
|
+
state.defaultRange = [current - 1, current + 3];
|
|
453
|
+
} else if (current == 0) {
|
|
454
|
+
state.defaultRange = [current, current + 4];
|
|
455
|
+
} else if (current == monthsNum) {
|
|
456
|
+
state.defaultRange = [current - 2, current + 2];
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
state.defaultRange = [0, monthsNum + 2];
|
|
460
|
+
}
|
|
461
|
+
let defaultScrollTop = state.monthsData[state.defaultRange[0]].cssScrollHeight;
|
|
462
|
+
state.translateY = defaultScrollTop;
|
|
337
463
|
};
|
|
338
464
|
const isActive = (day, month) => {
|
|
339
465
|
return state.isRange && day.type == "curr" && getClass(day, month) == "calendar-month-day-active";
|
|
@@ -346,139 +472,72 @@ const _sfc_main$1 = create$1({
|
|
|
346
472
|
}
|
|
347
473
|
};
|
|
348
474
|
const isEndTip = (day, month) => {
|
|
349
|
-
|
|
475
|
+
if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
|
|
476
|
+
return isActive(day, month);
|
|
477
|
+
}
|
|
478
|
+
return false;
|
|
479
|
+
};
|
|
480
|
+
const rangeTip = (day, month) => {
|
|
481
|
+
if (state.currDate.length >= 2) {
|
|
482
|
+
return Utils.isEqual(state.currDate[0], state.currDate[1]);
|
|
483
|
+
}
|
|
350
484
|
};
|
|
351
485
|
const isCurrDay = (month, day) => {
|
|
352
486
|
const date = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
353
487
|
return Utils.isEqual(date, Utils.date2Str(new Date()));
|
|
354
488
|
};
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const top = weeksPanel == null ? void 0 : weeksPanel.value.getBoundingClientRect().bottom;
|
|
362
|
-
const monthsDoms = monthsPanel.value.getElementsByClassName("calendar-month");
|
|
363
|
-
for (let i = 0; i < monthsDoms.length; i++) {
|
|
364
|
-
if (monthsDoms[i].getBoundingClientRect().top <= top && monthsDoms[i].getBoundingClientRect().bottom >= top) {
|
|
365
|
-
state.yearMonthTitle = state.monthsData[i].title;
|
|
366
|
-
} else if (state.scrollDistance === 0) {
|
|
367
|
-
state.yearMonthTitle = state.monthsData[0].title;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
};
|
|
373
|
-
const setTransform = (translateY = 0, type, time = 1e3) => {
|
|
374
|
-
if (monthsPanel == null ? void 0 : monthsPanel.value) {
|
|
375
|
-
if (type === "end") {
|
|
376
|
-
monthsPanel.value.style.webkitTransition = `transform ${time}ms cubic-bezier(0.19, 1, 0.22, 1)`;
|
|
377
|
-
clearTimeout(state.timer);
|
|
378
|
-
state.timer = setTimeout(() => {
|
|
379
|
-
loadScroll();
|
|
380
|
-
}, time);
|
|
381
|
-
} else {
|
|
382
|
-
monthsPanel.value.style.webkitTransition = "";
|
|
383
|
-
loadScroll();
|
|
384
|
-
}
|
|
385
|
-
monthsPanel.value.style.webkitTransform = `translateY(${translateY}px)`;
|
|
386
|
-
state.scrollDistance = translateY;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
const setMove = (move, type, time) => {
|
|
390
|
-
var _a, _b;
|
|
391
|
-
let updateMove = move + state.transformY;
|
|
392
|
-
const h = ((_a = months.value) == null ? void 0 : _a.offsetHeight) || 0;
|
|
393
|
-
const offsetHeight = ((_b = monthsPanel.value) == null ? void 0 : _b.offsetHeight) || 0;
|
|
394
|
-
if (type === "end") {
|
|
395
|
-
if (updateMove > 0) {
|
|
396
|
-
updateMove = 0;
|
|
489
|
+
const mothsViewScroll = (e) => {
|
|
490
|
+
var currentScrollTop = e.target.scrollTop;
|
|
491
|
+
let current = Math.floor(currentScrollTop / state.avgHeight);
|
|
492
|
+
if (current == 0) {
|
|
493
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
494
|
+
current += 1;
|
|
397
495
|
}
|
|
398
|
-
|
|
399
|
-
|
|
496
|
+
} else if (current > 0 && current < state.monthsNum - 1) {
|
|
497
|
+
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
498
|
+
current += 1;
|
|
400
499
|
}
|
|
401
|
-
if (
|
|
402
|
-
|
|
500
|
+
if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
|
|
501
|
+
current -= 1;
|
|
403
502
|
}
|
|
404
|
-
setTransform(updateMove, type, time);
|
|
405
503
|
} else {
|
|
406
|
-
if (
|
|
407
|
-
|
|
504
|
+
if (currentScrollTop + viewHeight.value < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight) {
|
|
505
|
+
current -= 1;
|
|
408
506
|
}
|
|
409
|
-
if (
|
|
410
|
-
|
|
507
|
+
if (current + 1 <= state.monthsNum && currentScrollTop + viewHeight.value >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
|
|
508
|
+
current += 1;
|
|
411
509
|
}
|
|
412
|
-
if (
|
|
413
|
-
|
|
510
|
+
if (currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
|
|
511
|
+
current -= 1;
|
|
414
512
|
}
|
|
415
|
-
setTransform(updateMove);
|
|
416
513
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
state.touchParams.startY = changedTouches.pageY;
|
|
421
|
-
state.touchParams.startTime = event.timeStamp || Date.now();
|
|
422
|
-
state.transformY = state.scrollDistance;
|
|
423
|
-
};
|
|
424
|
-
const touchMove = (event) => {
|
|
425
|
-
const changedTouches = event.changedTouches[0];
|
|
426
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
427
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
428
|
-
const move = state.touchParams.lastY - state.touchParams.startY;
|
|
429
|
-
if (Math.abs(move) < 5) {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
setMove(move);
|
|
433
|
-
};
|
|
434
|
-
const touchEnd = (event) => {
|
|
435
|
-
var _a, _b;
|
|
436
|
-
const changedTouches = event.changedTouches[0];
|
|
437
|
-
state.touchParams.lastY = changedTouches.pageY;
|
|
438
|
-
state.touchParams.lastTime = event.timeStamp || Date.now();
|
|
439
|
-
let move = state.touchParams.lastY - state.touchParams.startY;
|
|
440
|
-
if (Math.abs(move) < 5) {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
const updateMove = move + state.transformY;
|
|
444
|
-
const h = ((_a = months.value) == null ? void 0 : _a.offsetHeight) || 0;
|
|
445
|
-
const offsetHeight = ((_b = monthsPanel.value) == null ? void 0 : _b.offsetHeight) || 0;
|
|
446
|
-
if (updateMove > 0) {
|
|
447
|
-
getMonth(getCurrData("prev"), "prev");
|
|
448
|
-
} else if (updateMove < 0 && updateMove < -offsetHeight + (Math.abs(move) > h ? Math.abs(move) : h) * 5) {
|
|
449
|
-
getMonth(getCurrData("next"), "next");
|
|
450
|
-
if (Math.abs(move) >= 300) {
|
|
451
|
-
getMonth(getCurrData("next"), "next");
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
|
|
455
|
-
if (moveTime <= 300) {
|
|
456
|
-
move = move * 2;
|
|
457
|
-
moveTime = moveTime + 1e3;
|
|
458
|
-
setMove(move, "end", moveTime);
|
|
459
|
-
} else {
|
|
460
|
-
setMove(move, "end");
|
|
514
|
+
if (state.currentIndex !== current) {
|
|
515
|
+
state.currentIndex = current;
|
|
516
|
+
setDefaultRange(state.monthsNum, current);
|
|
461
517
|
}
|
|
518
|
+
state.yearMonthTitle = state.monthsData[current].title;
|
|
462
519
|
};
|
|
463
520
|
const resetRender = () => {
|
|
464
521
|
state.chooseData.splice(0);
|
|
465
522
|
state.monthsData.splice(0);
|
|
466
|
-
state.scrollDistance = 0;
|
|
467
|
-
state.translateY = 0;
|
|
468
|
-
setTransform(state.scrollDistance);
|
|
469
523
|
initData();
|
|
470
524
|
};
|
|
471
525
|
initData();
|
|
472
526
|
watch(() => props.defaultValue, (val) => {
|
|
473
527
|
if (val) {
|
|
474
|
-
|
|
528
|
+
if (props.poppable) {
|
|
529
|
+
resetRender();
|
|
530
|
+
}
|
|
475
531
|
}
|
|
476
532
|
});
|
|
477
533
|
return __spreadValues(__spreadValues({
|
|
478
534
|
weeks,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
535
|
+
compConthsData,
|
|
536
|
+
showTopBtn,
|
|
537
|
+
topInfo,
|
|
538
|
+
bottomInfo,
|
|
539
|
+
rangeTip,
|
|
540
|
+
mothsViewScroll,
|
|
482
541
|
getClass,
|
|
483
542
|
isStartTip,
|
|
484
543
|
isEndTip,
|
|
@@ -487,38 +546,52 @@ const _sfc_main$1 = create$1({
|
|
|
487
546
|
confirm,
|
|
488
547
|
monthsPanel,
|
|
489
548
|
months,
|
|
490
|
-
weeksPanel
|
|
549
|
+
weeksPanel,
|
|
550
|
+
viewArea
|
|
491
551
|
}, toRefs(state)), toRefs(props));
|
|
492
552
|
}
|
|
493
553
|
});
|
|
494
|
-
const _hoisted_1 = {
|
|
495
|
-
|
|
554
|
+
const _hoisted_1 = {
|
|
555
|
+
key: 0,
|
|
556
|
+
class: "calendar-title"
|
|
557
|
+
};
|
|
558
|
+
const _hoisted_2 = {
|
|
559
|
+
key: 1,
|
|
560
|
+
class: "calendar-top-slot"
|
|
561
|
+
};
|
|
496
562
|
const _hoisted_3 = {
|
|
563
|
+
key: 2,
|
|
564
|
+
class: "calendar-curr-month"
|
|
565
|
+
};
|
|
566
|
+
const _hoisted_4 = {
|
|
497
567
|
class: "calendar-weeks",
|
|
498
568
|
ref: "weeksPanel"
|
|
499
569
|
};
|
|
500
|
-
const
|
|
570
|
+
const _hoisted_5 = {
|
|
501
571
|
class: "calendar-months-panel",
|
|
502
572
|
ref: "monthsPanel"
|
|
503
573
|
};
|
|
504
|
-
const _hoisted_5 = { class: "calendar-loading-tip" };
|
|
505
574
|
const _hoisted_6 = { class: "calendar-month-title" };
|
|
506
575
|
const _hoisted_7 = { class: "calendar-month-con" };
|
|
507
576
|
const _hoisted_8 = ["onClick"];
|
|
508
577
|
const _hoisted_9 = { class: "calendar-day" };
|
|
509
578
|
const _hoisted_10 = {
|
|
510
579
|
key: 0,
|
|
511
|
-
class: "calendar-curr-tips"
|
|
580
|
+
class: "calendar-curr-tips calendar-curr-tips-top"
|
|
512
581
|
};
|
|
513
582
|
const _hoisted_11 = {
|
|
514
583
|
key: 1,
|
|
515
|
-
class: "calendar-
|
|
584
|
+
class: "calendar-curr-tips calendar-curr-tips-bottom"
|
|
516
585
|
};
|
|
517
586
|
const _hoisted_12 = {
|
|
518
587
|
key: 2,
|
|
519
|
-
class: "calendar-
|
|
588
|
+
class: "calendar-curr-tip-curr"
|
|
520
589
|
};
|
|
521
590
|
const _hoisted_13 = {
|
|
591
|
+
key: 4,
|
|
592
|
+
class: "calendar-day-tip"
|
|
593
|
+
};
|
|
594
|
+
const _hoisted_14 = {
|
|
522
595
|
key: 0,
|
|
523
596
|
class: "nut-calendar-footer"
|
|
524
597
|
};
|
|
@@ -532,11 +605,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
532
605
|
createElementVNode("view", {
|
|
533
606
|
class: normalizeClass(["nut-calendar-header", { "nut-calendar-header-tile": !_ctx.poppable }])
|
|
534
607
|
}, [
|
|
535
|
-
_ctx.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
]
|
|
539
|
-
|
|
608
|
+
_ctx.showTitle ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
609
|
+
_ctx.showTopBtn ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
610
|
+
renderSlot(_ctx.$slots, "btn")
|
|
611
|
+
])) : createCommentVNode("", true),
|
|
612
|
+
_ctx.showSubTitle ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.yearMonthTitle), 1)) : createCommentVNode("", true),
|
|
613
|
+
createElementVNode("view", _hoisted_4, [
|
|
540
614
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.weeks, (item, index2) => {
|
|
541
615
|
return openBlock(), createElementBlock("view", {
|
|
542
616
|
class: "calendar-week-item",
|
|
@@ -548,44 +622,67 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
548
622
|
createElementVNode("view", {
|
|
549
623
|
class: "nut-calendar-content",
|
|
550
624
|
ref: "months",
|
|
551
|
-
|
|
552
|
-
onTouchmove: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.touchMove && _ctx.touchMove(...args), ["stop", "prevent"])),
|
|
553
|
-
onTouchend: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.touchEnd && _ctx.touchEnd(...args), ["stop"]))
|
|
625
|
+
onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.mothsViewScroll && _ctx.mothsViewScroll(...args))
|
|
554
626
|
}, [
|
|
555
|
-
createElementVNode("view",
|
|
556
|
-
createElementVNode("view",
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
627
|
+
createElementVNode("view", _hoisted_5, [
|
|
628
|
+
createElementVNode("view", {
|
|
629
|
+
class: "viewArea",
|
|
630
|
+
ref: "viewArea",
|
|
631
|
+
style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
|
|
632
|
+
}, [
|
|
633
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsData, (month, index2) => {
|
|
634
|
+
return openBlock(), createElementBlock("view", {
|
|
635
|
+
class: "calendar-month",
|
|
636
|
+
key: index2
|
|
637
|
+
}, [
|
|
638
|
+
createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
|
|
639
|
+
createElementVNode("view", _hoisted_7, [
|
|
640
|
+
createElementVNode("view", {
|
|
641
|
+
class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
|
|
642
|
+
}, [
|
|
643
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
|
|
644
|
+
return openBlock(), createElementBlock("view", {
|
|
645
|
+
key: i,
|
|
646
|
+
class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
|
|
647
|
+
onClick: ($event) => _ctx.chooseDay(day, month)
|
|
648
|
+
}, [
|
|
649
|
+
createElementVNode("view", _hoisted_9, [
|
|
650
|
+
renderSlot(_ctx.$slots, "day", {
|
|
651
|
+
date: day.type == "curr" ? day : ""
|
|
652
|
+
}, () => [
|
|
653
|
+
createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
|
|
654
|
+
])
|
|
655
|
+
]),
|
|
656
|
+
_ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
|
|
657
|
+
renderSlot(_ctx.$slots, "topInfo", {
|
|
658
|
+
date: day.type == "curr" ? day : ""
|
|
659
|
+
})
|
|
660
|
+
])) : createCommentVNode("", true),
|
|
661
|
+
_ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
662
|
+
renderSlot(_ctx.$slots, "bottomInfo", {
|
|
663
|
+
date: day.type == "curr" ? day : ""
|
|
664
|
+
})
|
|
665
|
+
])) : createCommentVNode("", true),
|
|
666
|
+
!_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(month, day.day) ? (openBlock(), createElementBlock("view", _hoisted_12, " \u4ECA\u5929 ")) : createCommentVNode("", true),
|
|
667
|
+
_ctx.isStartTip(day, month) ? (openBlock(), createElementBlock("view", {
|
|
668
|
+
key: 3,
|
|
669
|
+
class: normalizeClass(["calendar-day-tip", { "calendar-curr-tips-top": _ctx.rangeTip(day, month) }])
|
|
670
|
+
}, toDisplayString(_ctx.startText), 3)) : createCommentVNode("", true),
|
|
671
|
+
_ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText), 1)) : createCommentVNode("", true)
|
|
672
|
+
], 10, _hoisted_8);
|
|
673
|
+
}), 128))
|
|
674
|
+
], 2)
|
|
675
|
+
])
|
|
676
|
+
]);
|
|
677
|
+
}), 128))
|
|
678
|
+
], 4)
|
|
582
679
|
], 512)
|
|
583
680
|
], 544),
|
|
584
|
-
_ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view",
|
|
681
|
+
_ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_14, [
|
|
585
682
|
createElementVNode("view", {
|
|
586
683
|
class: "calendar-confirm-btn",
|
|
587
|
-
onClick: _cache[
|
|
588
|
-
},
|
|
684
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirm && _ctx.confirm(...args))
|
|
685
|
+
}, toDisplayString(_ctx.confirmText), 1)
|
|
589
686
|
])) : createCommentVNode("", true)
|
|
590
687
|
], 2);
|
|
591
688
|
}
|
|
@@ -608,16 +705,40 @@ const _sfc_main = create({
|
|
|
608
705
|
type: Boolean,
|
|
609
706
|
default: true
|
|
610
707
|
},
|
|
708
|
+
showTitle: {
|
|
709
|
+
type: Boolean,
|
|
710
|
+
default: true
|
|
711
|
+
},
|
|
712
|
+
showSubTitle: {
|
|
713
|
+
type: Boolean,
|
|
714
|
+
default: true
|
|
715
|
+
},
|
|
611
716
|
visible: {
|
|
612
717
|
type: Boolean,
|
|
613
718
|
default: false
|
|
614
719
|
},
|
|
720
|
+
showToday: {
|
|
721
|
+
type: Boolean,
|
|
722
|
+
default: true
|
|
723
|
+
},
|
|
615
724
|
title: {
|
|
616
725
|
type: String,
|
|
617
726
|
default: "\u65E5\u5386\u9009\u62E9"
|
|
618
727
|
},
|
|
728
|
+
confirmText: {
|
|
729
|
+
type: String,
|
|
730
|
+
default: "\u786E\u8BA4"
|
|
731
|
+
},
|
|
732
|
+
startText: {
|
|
733
|
+
type: String,
|
|
734
|
+
default: "\u5F00\u59CB"
|
|
735
|
+
},
|
|
736
|
+
endText: {
|
|
737
|
+
type: String,
|
|
738
|
+
default: "\u7ED3\u675F"
|
|
739
|
+
},
|
|
619
740
|
defaultValue: {
|
|
620
|
-
type: String
|
|
741
|
+
type: [String, Array]
|
|
621
742
|
},
|
|
622
743
|
startDate: {
|
|
623
744
|
type: String,
|
|
@@ -628,8 +749,20 @@ const _sfc_main = create({
|
|
|
628
749
|
default: Utils.getDay(365)
|
|
629
750
|
}
|
|
630
751
|
},
|
|
631
|
-
emits: ["choose", "close", "update:visible"],
|
|
632
|
-
setup(props, { emit }) {
|
|
752
|
+
emits: ["choose", "close", "update:visible", "select"],
|
|
753
|
+
setup(props, { emit, slots }) {
|
|
754
|
+
const showTopBtn = computed(() => {
|
|
755
|
+
return slots.btn;
|
|
756
|
+
});
|
|
757
|
+
const topInfo = computed(() => {
|
|
758
|
+
return slots.topInfo;
|
|
759
|
+
});
|
|
760
|
+
const dayInfo = computed(() => {
|
|
761
|
+
return slots.day;
|
|
762
|
+
});
|
|
763
|
+
const bottomInfo = computed(() => {
|
|
764
|
+
return slots.bottomInfo;
|
|
765
|
+
});
|
|
633
766
|
const calendarRef = ref(null);
|
|
634
767
|
const update = () => {
|
|
635
768
|
emit("update:visible", false);
|
|
@@ -642,6 +775,9 @@ const _sfc_main = create({
|
|
|
642
775
|
close();
|
|
643
776
|
emit("choose", param);
|
|
644
777
|
};
|
|
778
|
+
const select = (param) => {
|
|
779
|
+
emit("select", param);
|
|
780
|
+
};
|
|
645
781
|
const closePopup = () => {
|
|
646
782
|
close();
|
|
647
783
|
};
|
|
@@ -650,7 +786,12 @@ const _sfc_main = create({
|
|
|
650
786
|
update,
|
|
651
787
|
close,
|
|
652
788
|
choose,
|
|
653
|
-
|
|
789
|
+
select,
|
|
790
|
+
calendarRef,
|
|
791
|
+
showTopBtn,
|
|
792
|
+
topInfo,
|
|
793
|
+
dayInfo,
|
|
794
|
+
bottomInfo
|
|
654
795
|
};
|
|
655
796
|
}
|
|
656
797
|
});
|
|
@@ -664,37 +805,115 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
664
805
|
round: "",
|
|
665
806
|
closeable: true,
|
|
666
807
|
onClickOverlay: _ctx.closePopup,
|
|
667
|
-
onClickCloseIcon: _ctx.closePopup
|
|
808
|
+
onClickCloseIcon: _ctx.closePopup,
|
|
809
|
+
"destroy-on-close": true,
|
|
810
|
+
style: { height: "85vh" }
|
|
668
811
|
}, {
|
|
669
812
|
default: withCtx(() => [
|
|
670
|
-
|
|
813
|
+
_ctx.visible ? (openBlock(), createBlock(_component_nut_calendar_item, {
|
|
814
|
+
key: 0,
|
|
671
815
|
props: "",
|
|
672
816
|
ref: "calendarRef",
|
|
673
817
|
type: _ctx.type,
|
|
674
818
|
"is-auto-back-fill": _ctx.isAutoBackFill,
|
|
675
819
|
poppable: _ctx.poppable,
|
|
676
820
|
title: _ctx.title,
|
|
821
|
+
"confirm-text": _ctx.confirmText,
|
|
822
|
+
"start-text": _ctx.startText,
|
|
823
|
+
"end-text": _ctx.endText,
|
|
677
824
|
"default-value": _ctx.defaultValue,
|
|
825
|
+
"show-today": _ctx.showToday,
|
|
678
826
|
"start-date": _ctx.startDate,
|
|
679
827
|
"end-date": _ctx.endDate,
|
|
680
828
|
onUpdate: _ctx.update,
|
|
681
829
|
onClose: _ctx.close,
|
|
682
|
-
onChoose: _ctx.choose
|
|
683
|
-
|
|
830
|
+
onChoose: _ctx.choose,
|
|
831
|
+
onSelect: _ctx.select,
|
|
832
|
+
"show-title": _ctx.showTitle,
|
|
833
|
+
"show-sub-title": _ctx.showSubTitle
|
|
834
|
+
}, createSlots({ _: 2 }, [
|
|
835
|
+
_ctx.showTopBtn ? {
|
|
836
|
+
name: "btn",
|
|
837
|
+
fn: withCtx(() => [
|
|
838
|
+
renderSlot(_ctx.$slots, "btn")
|
|
839
|
+
])
|
|
840
|
+
} : void 0,
|
|
841
|
+
_ctx.dayInfo ? {
|
|
842
|
+
name: "day",
|
|
843
|
+
fn: withCtx((date) => [
|
|
844
|
+
renderSlot(_ctx.$slots, "day", {
|
|
845
|
+
date: date.date
|
|
846
|
+
})
|
|
847
|
+
])
|
|
848
|
+
} : void 0,
|
|
849
|
+
_ctx.topInfo ? {
|
|
850
|
+
name: "topInfo",
|
|
851
|
+
fn: withCtx((date) => [
|
|
852
|
+
renderSlot(_ctx.$slots, "topInfo", {
|
|
853
|
+
date: date.date
|
|
854
|
+
})
|
|
855
|
+
])
|
|
856
|
+
} : void 0,
|
|
857
|
+
_ctx.bottomInfo ? {
|
|
858
|
+
name: "bottomInfo",
|
|
859
|
+
fn: withCtx((date) => [
|
|
860
|
+
renderSlot(_ctx.$slots, "bottomInfo", {
|
|
861
|
+
date: date.date
|
|
862
|
+
})
|
|
863
|
+
])
|
|
864
|
+
} : void 0
|
|
865
|
+
]), 1032, ["type", "is-auto-back-fill", "poppable", "title", "confirm-text", "start-text", "end-text", "default-value", "show-today", "start-date", "end-date", "onUpdate", "onClose", "onChoose", "onSelect", "show-title", "show-sub-title"])) : createCommentVNode("", true)
|
|
684
866
|
]),
|
|
685
|
-
_:
|
|
867
|
+
_: 3
|
|
686
868
|
}, 8, ["visible", "onClickOverlay", "onClickCloseIcon"])) : (openBlock(), createBlock(_component_nut_calendar_item, {
|
|
687
869
|
key: 1,
|
|
688
870
|
type: _ctx.type,
|
|
689
871
|
"is-auto-back-fill": _ctx.isAutoBackFill,
|
|
690
872
|
poppable: _ctx.poppable,
|
|
691
873
|
title: _ctx.title,
|
|
874
|
+
"confirm-text": _ctx.confirmText,
|
|
875
|
+
"start-text": _ctx.startText,
|
|
876
|
+
"end-text": _ctx.endText,
|
|
692
877
|
"default-value": _ctx.defaultValue,
|
|
693
878
|
"start-date": _ctx.startDate,
|
|
694
879
|
"end-date": _ctx.endDate,
|
|
695
880
|
onClose: _ctx.close,
|
|
696
|
-
onChoose: _ctx.choose
|
|
697
|
-
|
|
881
|
+
onChoose: _ctx.choose,
|
|
882
|
+
onSelect: _ctx.select,
|
|
883
|
+
"show-title": _ctx.showTitle,
|
|
884
|
+
"show-sub-title": _ctx.showSubTitle
|
|
885
|
+
}, createSlots({ _: 2 }, [
|
|
886
|
+
_ctx.showTopBtn ? {
|
|
887
|
+
name: "btn",
|
|
888
|
+
fn: withCtx(() => [
|
|
889
|
+
renderSlot(_ctx.$slots, "btn")
|
|
890
|
+
])
|
|
891
|
+
} : void 0,
|
|
892
|
+
_ctx.dayInfo ? {
|
|
893
|
+
name: "day",
|
|
894
|
+
fn: withCtx((date) => [
|
|
895
|
+
renderSlot(_ctx.$slots, "day", {
|
|
896
|
+
date: date.date
|
|
897
|
+
})
|
|
898
|
+
])
|
|
899
|
+
} : void 0,
|
|
900
|
+
_ctx.topInfo ? {
|
|
901
|
+
name: "topInfo",
|
|
902
|
+
fn: withCtx((date) => [
|
|
903
|
+
renderSlot(_ctx.$slots, "topInfo", {
|
|
904
|
+
date: date.date
|
|
905
|
+
})
|
|
906
|
+
])
|
|
907
|
+
} : void 0,
|
|
908
|
+
_ctx.bottomInfo ? {
|
|
909
|
+
name: "bottomInfo",
|
|
910
|
+
fn: withCtx((date) => [
|
|
911
|
+
renderSlot(_ctx.$slots, "bottomInfo", {
|
|
912
|
+
date: date.date
|
|
913
|
+
})
|
|
914
|
+
])
|
|
915
|
+
} : void 0
|
|
916
|
+
]), 1032, ["type", "is-auto-back-fill", "poppable", "title", "confirm-text", "start-text", "end-text", "default-value", "start-date", "end-date", "onClose", "onChoose", "onSelect", "show-title", "show-sub-title"]));
|
|
698
917
|
}
|
|
699
918
|
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
700
919
|
export { index as default };
|