vue-devui 1.0.0-rc.13 → 1.0.0-rc.14
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/README.md +160 -156
- package/auto-complete/index.es.js +151 -1
- package/auto-complete/index.umd.js +17 -17
- package/date-picker-pro/index.es.js +1274 -125
- package/date-picker-pro/index.umd.js +15 -15
- package/date-picker-pro/style.css +1 -1
- package/editable-select/index.es.js +152 -2
- package/editable-select/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +156 -6
- package/input/index.umd.js +14 -14
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +152 -2
- package/pagination/index.umd.js +1 -1
- package/search/index.es.js +156 -6
- package/search/index.umd.js +13 -13
- package/select/index.es.js +156 -6
- package/select/index.umd.js +13 -13
- package/splitter/index.es.js +157 -7
- package/splitter/index.umd.js +13 -13
- package/style.css +1 -1
- package/table/index.es.js +164 -4
- package/table/index.umd.js +14 -14
- package/textarea/index.es.js +2 -1
- package/textarea/index.umd.js +5 -5
- package/time-picker/index.es.js +151 -1
- package/time-picker/index.umd.js +13 -13
- package/time-select/index.es.js +157 -7
- package/time-select/index.umd.js +13 -13
- package/tree/index.es.js +296 -19
- package/tree/index.umd.js +14 -14
- package/tree/style.css +1 -1
- package/upload/index.es.js +151 -1
- package/upload/index.umd.js +1 -1
- package/vue-devui.es.js +13196 -12879
- package/vue-devui.umd.js +20 -20
- package/LICENSE +0 -23
|
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, shallowRef, resolveDynamicComponent, getCurrentInstance, onBeforeMount, render, resolveDirective, toRef,
|
|
36
|
+
import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, shallowRef, resolveDynamicComponent, getCurrentInstance, onBeforeMount, isVNode, onUpdated, toRaw, watchEffect, render, resolveDirective, toRef, renderSlot, useSlots } from "vue";
|
|
37
37
|
import { onClickOutside } from "@vueuse/core";
|
|
38
38
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
39
39
|
const datePickerProCommonProps = {
|
|
@@ -53,7 +53,8 @@ const datePickerProCommonProps = {
|
|
|
53
53
|
default: false
|
|
54
54
|
},
|
|
55
55
|
calendarRange: {
|
|
56
|
-
type: Array
|
|
56
|
+
type: Array,
|
|
57
|
+
default: [1970, 2099]
|
|
57
58
|
},
|
|
58
59
|
limitDateRange: {
|
|
59
60
|
type: Array
|
|
@@ -2371,7 +2372,7 @@ var lodash = { exports: {} };
|
|
|
2371
2372
|
end = end === undefined$1 ? length : end;
|
|
2372
2373
|
return !start && end >= length ? array4 : baseSlice(array4, start, end);
|
|
2373
2374
|
}
|
|
2374
|
-
var
|
|
2375
|
+
var clearTimeout2 = ctxClearTimeout || function(id) {
|
|
2375
2376
|
return root.clearTimeout(id);
|
|
2376
2377
|
};
|
|
2377
2378
|
function cloneBuffer(buffer, isDeep) {
|
|
@@ -4220,7 +4221,7 @@ var lodash = { exports: {} };
|
|
|
4220
4221
|
}
|
|
4221
4222
|
function cancel() {
|
|
4222
4223
|
if (timerId !== undefined$1) {
|
|
4223
|
-
|
|
4224
|
+
clearTimeout2(timerId);
|
|
4224
4225
|
}
|
|
4225
4226
|
lastInvokeTime = 0;
|
|
4226
4227
|
lastArgs = lastCallTime = lastThis = timerId = undefined$1;
|
|
@@ -4238,7 +4239,7 @@ var lodash = { exports: {} };
|
|
|
4238
4239
|
return leadingEdge(lastCallTime);
|
|
4239
4240
|
}
|
|
4240
4241
|
if (maxing) {
|
|
4241
|
-
|
|
4242
|
+
clearTimeout2(timerId);
|
|
4242
4243
|
timerId = setTimeout2(timerExpired, wait);
|
|
4243
4244
|
return invokeFunc(lastCallTime);
|
|
4244
4245
|
}
|
|
@@ -8411,6 +8412,155 @@ function useInputFunction(input2) {
|
|
|
8411
8412
|
return { select, focus, blur };
|
|
8412
8413
|
}
|
|
8413
8414
|
var input = "";
|
|
8415
|
+
function deepAssign(...objects) {
|
|
8416
|
+
const isObject2 = (obj) => obj && typeof obj === "object";
|
|
8417
|
+
return objects.reduce((prev, from) => {
|
|
8418
|
+
Object.keys(from).forEach((key) => {
|
|
8419
|
+
const pVal = prev[key];
|
|
8420
|
+
const oVal = from[key];
|
|
8421
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
8422
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
8423
|
+
} else if (isObject2(pVal) && isObject2(oVal)) {
|
|
8424
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
8425
|
+
} else {
|
|
8426
|
+
prev[key] = oVal;
|
|
8427
|
+
}
|
|
8428
|
+
});
|
|
8429
|
+
return prev;
|
|
8430
|
+
}, {});
|
|
8431
|
+
}
|
|
8432
|
+
var zhCN = {
|
|
8433
|
+
pagination: {
|
|
8434
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
8435
|
+
goToText: "\u8DF3\u81F3"
|
|
8436
|
+
},
|
|
8437
|
+
accordion: {
|
|
8438
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
8439
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
8440
|
+
},
|
|
8441
|
+
autoCompleteDropdown: {
|
|
8442
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
8443
|
+
},
|
|
8444
|
+
cascaderList: {
|
|
8445
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
8446
|
+
},
|
|
8447
|
+
colorPicker: {
|
|
8448
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
8449
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
8450
|
+
},
|
|
8451
|
+
datePickerPro: {
|
|
8452
|
+
ok: "\u786E\u5B9A",
|
|
8453
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
8454
|
+
month1: "1\u6708",
|
|
8455
|
+
month2: "2\u6708",
|
|
8456
|
+
month3: "3\u6708",
|
|
8457
|
+
month4: "4\u6708",
|
|
8458
|
+
month5: "5\u6708",
|
|
8459
|
+
month6: "6\u6708",
|
|
8460
|
+
month7: "7\u6708",
|
|
8461
|
+
month8: "8\u6708",
|
|
8462
|
+
month9: "9\u6708",
|
|
8463
|
+
month10: "10\u6708",
|
|
8464
|
+
month11: "11\u6708",
|
|
8465
|
+
month12: "12\u6708",
|
|
8466
|
+
year: "\u5E74",
|
|
8467
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
8468
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
8469
|
+
getWeekDays() {
|
|
8470
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
8471
|
+
},
|
|
8472
|
+
getTimeArr() {
|
|
8473
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
8474
|
+
},
|
|
8475
|
+
getYearMonthStr(year, month) {
|
|
8476
|
+
return `${year}\u5E74${month}\u6708`;
|
|
8477
|
+
}
|
|
8478
|
+
},
|
|
8479
|
+
editableSelect: {
|
|
8480
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
8481
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
8482
|
+
},
|
|
8483
|
+
input: {
|
|
8484
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
8485
|
+
},
|
|
8486
|
+
splitterBar: {
|
|
8487
|
+
collapse: "\u6536\u8D77",
|
|
8488
|
+
expand: "\u5C55\u5F00"
|
|
8489
|
+
},
|
|
8490
|
+
stepsGuide: {
|
|
8491
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
8492
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
8493
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
8494
|
+
},
|
|
8495
|
+
table: {
|
|
8496
|
+
selectAll: "\u5168\u9009",
|
|
8497
|
+
ok: "\u786E\u5B9A"
|
|
8498
|
+
},
|
|
8499
|
+
timePopup: {
|
|
8500
|
+
ok: "\u786E\u5B9A"
|
|
8501
|
+
},
|
|
8502
|
+
transfer: {
|
|
8503
|
+
unit: "\u9879",
|
|
8504
|
+
panelUnit: "\u9879",
|
|
8505
|
+
headerUnit: "\u9879",
|
|
8506
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
8507
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
8508
|
+
},
|
|
8509
|
+
tree: {
|
|
8510
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
8511
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
8512
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
8513
|
+
},
|
|
8514
|
+
upload: {
|
|
8515
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
8516
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
8517
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
8518
|
+
},
|
|
8519
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
8520
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
8521
|
+
},
|
|
8522
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
8523
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
8524
|
+
},
|
|
8525
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
8526
|
+
return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
8527
|
+
}
|
|
8528
|
+
},
|
|
8529
|
+
search: {
|
|
8530
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
8531
|
+
},
|
|
8532
|
+
select: {
|
|
8533
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
8534
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
8535
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
8536
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
8537
|
+
},
|
|
8538
|
+
tagInput: {
|
|
8539
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
8540
|
+
},
|
|
8541
|
+
timeSelect: {
|
|
8542
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
8543
|
+
}
|
|
8544
|
+
};
|
|
8545
|
+
const lang = ref("zh-CN");
|
|
8546
|
+
let langMessages = reactive({
|
|
8547
|
+
[lang.value]: zhCN
|
|
8548
|
+
});
|
|
8549
|
+
const Locale = {
|
|
8550
|
+
messages() {
|
|
8551
|
+
return langMessages[lang.value];
|
|
8552
|
+
},
|
|
8553
|
+
lang() {
|
|
8554
|
+
return lang.value;
|
|
8555
|
+
},
|
|
8556
|
+
use(newLang, newMessages2) {
|
|
8557
|
+
lang.value = newLang;
|
|
8558
|
+
this.add({ [newLang]: newMessages2 });
|
|
8559
|
+
},
|
|
8560
|
+
add(newMessages2 = {}) {
|
|
8561
|
+
langMessages = deepAssign(langMessages, newMessages2);
|
|
8562
|
+
}
|
|
8563
|
+
};
|
|
8414
8564
|
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
8415
8565
|
function get(object4, path) {
|
|
8416
8566
|
const keys = path.split(".");
|
|
@@ -8424,7 +8574,8 @@ function get(object4, path) {
|
|
|
8424
8574
|
function createI18nTranslate(name, app, newPrefix) {
|
|
8425
8575
|
const prefix = newPrefix || camelize(name) + ".";
|
|
8426
8576
|
return (path) => {
|
|
8427
|
-
|
|
8577
|
+
var _a;
|
|
8578
|
+
const messages2 = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
8428
8579
|
const message = get(messages2, prefix + path) || get(messages2, path);
|
|
8429
8580
|
return message;
|
|
8430
8581
|
};
|
|
@@ -8535,8 +8686,12 @@ var Input = defineComponent({
|
|
|
8535
8686
|
const DAY_DURATION = 24 * 60 * 60 * 1e3;
|
|
8536
8687
|
const yearItemHeight = 30;
|
|
8537
8688
|
const calendarItemHeight = 186;
|
|
8538
|
-
const
|
|
8689
|
+
const yearListHeight = 305;
|
|
8690
|
+
const calendarListHeight = 270;
|
|
8691
|
+
const monthPickerHeight = 300;
|
|
8539
8692
|
const monthCalendarItemHeight = 186;
|
|
8693
|
+
const yearPickerHeight = 186;
|
|
8694
|
+
const yearCalendarItemHeight = 48;
|
|
8540
8695
|
function useCalendarSelected(props, ctx) {
|
|
8541
8696
|
const today = ref(new Date());
|
|
8542
8697
|
const calendarRange = ref([]);
|
|
@@ -8742,25 +8897,25 @@ function useCalendarPanel(props, ctx) {
|
|
|
8742
8897
|
};
|
|
8743
8898
|
const goToYearDate = (index2) => {
|
|
8744
8899
|
updateYearActive(index2);
|
|
8745
|
-
let
|
|
8746
|
-
if (
|
|
8747
|
-
|
|
8900
|
+
let scrollIndex = index2 - 4;
|
|
8901
|
+
if (scrollIndex < 0) {
|
|
8902
|
+
scrollIndex = 0;
|
|
8748
8903
|
}
|
|
8749
8904
|
nextTick(() => {
|
|
8750
8905
|
var _a;
|
|
8751
8906
|
const scrollEl = yearScrollRef.value;
|
|
8752
|
-
(_a = scrollEl == null ? void 0 : scrollEl.
|
|
8907
|
+
(_a = scrollEl == null ? void 0 : scrollEl.scrollTo) == null ? void 0 : _a.call(scrollEl, scrollIndex);
|
|
8753
8908
|
});
|
|
8754
8909
|
};
|
|
8755
8910
|
const goToMonthDate = () => {
|
|
8756
|
-
let
|
|
8757
|
-
if (
|
|
8758
|
-
|
|
8911
|
+
let scrollIndex = currentMonthIndex.value;
|
|
8912
|
+
if (scrollIndex < 0) {
|
|
8913
|
+
scrollIndex = 0;
|
|
8759
8914
|
}
|
|
8760
8915
|
nextTick(() => {
|
|
8761
8916
|
var _a;
|
|
8762
8917
|
const scrollEl = monthScrollRef.value;
|
|
8763
|
-
(_a = scrollEl == null ? void 0 : scrollEl.
|
|
8918
|
+
(_a = scrollEl == null ? void 0 : scrollEl.scrollTo) == null ? void 0 : _a.call(scrollEl, scrollIndex);
|
|
8764
8919
|
});
|
|
8765
8920
|
};
|
|
8766
8921
|
const goToShowDate = (date4) => {
|
|
@@ -8780,12 +8935,10 @@ function useCalendarPanel(props, ctx) {
|
|
|
8780
8935
|
};
|
|
8781
8936
|
onBeforeMount(() => {
|
|
8782
8937
|
today.value = new Date();
|
|
8783
|
-
|
|
8784
|
-
calendarRange.value = props.calendarRange;
|
|
8785
|
-
} else {
|
|
8786
|
-
calendarRange.value = [today.value.getFullYear() - 3, today.value.getFullYear() + 3];
|
|
8787
|
-
}
|
|
8938
|
+
calendarRange.value = props.calendarRange;
|
|
8788
8939
|
initCalendarData();
|
|
8940
|
+
});
|
|
8941
|
+
onMounted(() => {
|
|
8789
8942
|
initCalendarShow();
|
|
8790
8943
|
});
|
|
8791
8944
|
const handlerSetRangeDate = (day) => {
|
|
@@ -8835,9 +8988,6 @@ function useCalendarPanel(props, ctx) {
|
|
|
8835
8988
|
goToShowDate(date4);
|
|
8836
8989
|
}
|
|
8837
8990
|
};
|
|
8838
|
-
const handleScrollYearList = (e) => {
|
|
8839
|
-
e.currentTarget;
|
|
8840
|
-
};
|
|
8841
8991
|
const debounceScrollMonth = lodash.exports.throttle((newScrollTop) => {
|
|
8842
8992
|
currentMonthIndex.value = Math.floor(newScrollTop / calendarItemHeight) + (newScrollTop % calendarItemHeight > 100 ? 1 : 0);
|
|
8843
8993
|
const yearIndex = isListCollapse.value ? Math.floor(currentMonthIndex.value / 12) : currentMonthIndex.value + Math.floor(currentMonthIndex.value / 12) + 1;
|
|
@@ -8884,7 +9034,6 @@ function useCalendarPanel(props, ctx) {
|
|
|
8884
9034
|
handlerSelectDate,
|
|
8885
9035
|
handlerYearCollapse,
|
|
8886
9036
|
handlerClickMonth,
|
|
8887
|
-
handleScrollYearList,
|
|
8888
9037
|
handleScrollMonthList,
|
|
8889
9038
|
isDateSelected,
|
|
8890
9039
|
isStartDate,
|
|
@@ -8893,6 +9042,976 @@ function useCalendarPanel(props, ctx) {
|
|
|
8893
9042
|
isDisabled
|
|
8894
9043
|
};
|
|
8895
9044
|
}
|
|
9045
|
+
const virtualListProps = {
|
|
9046
|
+
data: {
|
|
9047
|
+
type: Array,
|
|
9048
|
+
default: () => []
|
|
9049
|
+
},
|
|
9050
|
+
component: {
|
|
9051
|
+
type: String,
|
|
9052
|
+
default: "div"
|
|
9053
|
+
},
|
|
9054
|
+
height: {
|
|
9055
|
+
type: Number,
|
|
9056
|
+
default: 100
|
|
9057
|
+
},
|
|
9058
|
+
itemHeight: {
|
|
9059
|
+
type: Number,
|
|
9060
|
+
default: 0
|
|
9061
|
+
},
|
|
9062
|
+
virtual: {
|
|
9063
|
+
type: Boolean,
|
|
9064
|
+
default: true
|
|
9065
|
+
},
|
|
9066
|
+
fullHeight: {
|
|
9067
|
+
type: Boolean
|
|
9068
|
+
},
|
|
9069
|
+
itemKey: {
|
|
9070
|
+
type: [String, Number, Function]
|
|
9071
|
+
}
|
|
9072
|
+
};
|
|
9073
|
+
const resizeObserverContainerProps = {
|
|
9074
|
+
height: {
|
|
9075
|
+
type: Number
|
|
9076
|
+
},
|
|
9077
|
+
offset: {
|
|
9078
|
+
type: Number || void 0
|
|
9079
|
+
},
|
|
9080
|
+
disabled: {
|
|
9081
|
+
type: Function
|
|
9082
|
+
},
|
|
9083
|
+
onInnerResize: {
|
|
9084
|
+
type: Function
|
|
9085
|
+
}
|
|
9086
|
+
};
|
|
9087
|
+
const scrollBarProps = {
|
|
9088
|
+
scrollTop: {
|
|
9089
|
+
type: Number
|
|
9090
|
+
},
|
|
9091
|
+
scrollHeight: {
|
|
9092
|
+
type: Number
|
|
9093
|
+
},
|
|
9094
|
+
height: {
|
|
9095
|
+
type: Number
|
|
9096
|
+
},
|
|
9097
|
+
count: {
|
|
9098
|
+
type: Number
|
|
9099
|
+
},
|
|
9100
|
+
onScroll: {
|
|
9101
|
+
type: Function
|
|
9102
|
+
},
|
|
9103
|
+
onStartMove: {
|
|
9104
|
+
type: Function
|
|
9105
|
+
},
|
|
9106
|
+
onStopMove: {
|
|
9107
|
+
type: Function
|
|
9108
|
+
}
|
|
9109
|
+
};
|
|
9110
|
+
const resizeObserverProps = {
|
|
9111
|
+
disabled: {
|
|
9112
|
+
type: Boolean
|
|
9113
|
+
},
|
|
9114
|
+
onResize: {
|
|
9115
|
+
type: Function
|
|
9116
|
+
}
|
|
9117
|
+
};
|
|
9118
|
+
function useVirtual(props) {
|
|
9119
|
+
const isVirtual = computed(() => {
|
|
9120
|
+
const {
|
|
9121
|
+
height,
|
|
9122
|
+
virtual
|
|
9123
|
+
} = props;
|
|
9124
|
+
return !!(virtual !== false && height);
|
|
9125
|
+
});
|
|
9126
|
+
const inVirtual = computed(() => {
|
|
9127
|
+
const {
|
|
9128
|
+
height,
|
|
9129
|
+
data
|
|
9130
|
+
} = props;
|
|
9131
|
+
return isVirtual.value && data && 20 * data.length > height;
|
|
9132
|
+
});
|
|
9133
|
+
return {
|
|
9134
|
+
isVirtual,
|
|
9135
|
+
inVirtual
|
|
9136
|
+
};
|
|
9137
|
+
}
|
|
9138
|
+
function useHeights(mergedData, getKey) {
|
|
9139
|
+
const instance = /* @__PURE__ */ new Map();
|
|
9140
|
+
let heights = /* @__PURE__ */ new Map();
|
|
9141
|
+
const updatedMark = ref(Symbol("update"));
|
|
9142
|
+
watch(mergedData, () => {
|
|
9143
|
+
heights = /* @__PURE__ */ new Map();
|
|
9144
|
+
updatedMark.value = Symbol("update");
|
|
9145
|
+
});
|
|
9146
|
+
let heightUpdateId = 0;
|
|
9147
|
+
function collectHeight() {
|
|
9148
|
+
heightUpdateId += 1;
|
|
9149
|
+
const currentId = heightUpdateId;
|
|
9150
|
+
Promise.resolve().then(() => {
|
|
9151
|
+
if (currentId !== heightUpdateId) {
|
|
9152
|
+
return;
|
|
9153
|
+
}
|
|
9154
|
+
instance.forEach((element, key) => {
|
|
9155
|
+
if (element && element.offsetParent) {
|
|
9156
|
+
const {
|
|
9157
|
+
offsetHeight
|
|
9158
|
+
} = element;
|
|
9159
|
+
if (heights.get(key) !== offsetHeight) {
|
|
9160
|
+
updatedMark.value = Symbol("update");
|
|
9161
|
+
heights.set(key, element.offsetHeight);
|
|
9162
|
+
}
|
|
9163
|
+
}
|
|
9164
|
+
});
|
|
9165
|
+
});
|
|
9166
|
+
}
|
|
9167
|
+
function setInstance(item, ins) {
|
|
9168
|
+
const key = getKey(item);
|
|
9169
|
+
if (ins) {
|
|
9170
|
+
instance.set(key, ins.$el || ins);
|
|
9171
|
+
collectHeight();
|
|
9172
|
+
} else {
|
|
9173
|
+
instance.delete(key);
|
|
9174
|
+
}
|
|
9175
|
+
}
|
|
9176
|
+
return [setInstance, collectHeight, heights, updatedMark];
|
|
9177
|
+
}
|
|
9178
|
+
var useOriginScroll = (isScrollAtTop, isScrollAtBottom) => {
|
|
9179
|
+
let lock = false;
|
|
9180
|
+
let lockTimeout = null;
|
|
9181
|
+
function lockScroll2() {
|
|
9182
|
+
if (lockTimeout) {
|
|
9183
|
+
clearTimeout(lockTimeout);
|
|
9184
|
+
}
|
|
9185
|
+
lock = true;
|
|
9186
|
+
lockTimeout = setTimeout(() => {
|
|
9187
|
+
lock = false;
|
|
9188
|
+
}, 50);
|
|
9189
|
+
}
|
|
9190
|
+
return (deltaY, smoothOffset = false) => {
|
|
9191
|
+
const originScroll = deltaY < 0 && isScrollAtTop.value || deltaY > 0 && isScrollAtBottom.value;
|
|
9192
|
+
if (smoothOffset && originScroll) {
|
|
9193
|
+
if (lockTimeout) {
|
|
9194
|
+
clearTimeout(lockTimeout);
|
|
9195
|
+
}
|
|
9196
|
+
lock = false;
|
|
9197
|
+
} else if (!originScroll || lock) {
|
|
9198
|
+
lockScroll2();
|
|
9199
|
+
}
|
|
9200
|
+
return !lock && originScroll;
|
|
9201
|
+
};
|
|
9202
|
+
};
|
|
9203
|
+
const isValid = (value) => {
|
|
9204
|
+
return value !== void 0 && value !== null && value !== "";
|
|
9205
|
+
};
|
|
9206
|
+
const isEmptyElement = (c) => {
|
|
9207
|
+
var _a, _b;
|
|
9208
|
+
return !!c && (c.type === Comment || c.type === Fragment && ((_a = c == null ? void 0 : c.children) == null ? void 0 : _a.length) === 0 || c.type === Text && ((_b = c == null ? void 0 : c.children) == null ? void 0 : _b.trim()) === "");
|
|
9209
|
+
};
|
|
9210
|
+
const flattenChildren = (children, filterEmpty = true) => {
|
|
9211
|
+
const temp = Array.isArray(children) ? children : [children];
|
|
9212
|
+
const res = [];
|
|
9213
|
+
temp.forEach((child) => {
|
|
9214
|
+
if (Array.isArray(child)) {
|
|
9215
|
+
res.push(...flattenChildren(child, filterEmpty));
|
|
9216
|
+
} else if (child && child.type === Fragment) {
|
|
9217
|
+
res.push(...flattenChildren(child.children, filterEmpty));
|
|
9218
|
+
} else if (child && isVNode(child)) {
|
|
9219
|
+
if (filterEmpty && !isEmptyElement(child)) {
|
|
9220
|
+
res.push(child);
|
|
9221
|
+
} else if (!filterEmpty) {
|
|
9222
|
+
res.push(child);
|
|
9223
|
+
}
|
|
9224
|
+
} else if (isValid(child)) {
|
|
9225
|
+
res.push(child);
|
|
9226
|
+
}
|
|
9227
|
+
});
|
|
9228
|
+
return res;
|
|
9229
|
+
};
|
|
9230
|
+
const findDOMNode = (instance) => {
|
|
9231
|
+
var _a;
|
|
9232
|
+
let node = ((_a = instance == null ? void 0 : instance.vnode) == null ? void 0 : _a.el) || instance && ((instance == null ? void 0 : instance.$el) || instance);
|
|
9233
|
+
while (node && !node.tagName) {
|
|
9234
|
+
node = node.nextSibling;
|
|
9235
|
+
}
|
|
9236
|
+
return node;
|
|
9237
|
+
};
|
|
9238
|
+
const isFF = typeof navigator === "object" && /Firefox/i.test(navigator.userAgent);
|
|
9239
|
+
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta) {
|
|
9240
|
+
let offsetRef = 0;
|
|
9241
|
+
let nextFrame = null;
|
|
9242
|
+
let wheelValue = null;
|
|
9243
|
+
let isMouseScroll = false;
|
|
9244
|
+
const originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
|
|
9245
|
+
const onRawWheel = (event) => {
|
|
9246
|
+
var _a;
|
|
9247
|
+
if (!inVirtual.value) {
|
|
9248
|
+
return;
|
|
9249
|
+
}
|
|
9250
|
+
if (nextFrame) {
|
|
9251
|
+
window.cancelAnimationFrame(nextFrame);
|
|
9252
|
+
}
|
|
9253
|
+
const {
|
|
9254
|
+
deltaY
|
|
9255
|
+
} = event;
|
|
9256
|
+
offsetRef += deltaY;
|
|
9257
|
+
wheelValue = deltaY;
|
|
9258
|
+
if (originScroll(deltaY, false)) {
|
|
9259
|
+
return;
|
|
9260
|
+
}
|
|
9261
|
+
if (!isFF) {
|
|
9262
|
+
(_a = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a.call(event);
|
|
9263
|
+
}
|
|
9264
|
+
nextFrame = window.requestAnimationFrame(() => {
|
|
9265
|
+
const patchMultiple = isMouseScroll ? 10 : 1;
|
|
9266
|
+
onWheelDelta(offsetRef * patchMultiple);
|
|
9267
|
+
offsetRef = 0;
|
|
9268
|
+
});
|
|
9269
|
+
};
|
|
9270
|
+
const onFireFoxScroll = (event) => {
|
|
9271
|
+
if (!inVirtual.value) {
|
|
9272
|
+
return;
|
|
9273
|
+
}
|
|
9274
|
+
isMouseScroll = event.detail === wheelValue;
|
|
9275
|
+
};
|
|
9276
|
+
return [onRawWheel, onFireFoxScroll];
|
|
9277
|
+
}
|
|
9278
|
+
const SMOOTH_PTG = 14 / 15;
|
|
9279
|
+
function useMobileTouchMove(inVirtual, listRef, callback) {
|
|
9280
|
+
let touched = false;
|
|
9281
|
+
let touchY = 0;
|
|
9282
|
+
let element = null;
|
|
9283
|
+
let interval = null;
|
|
9284
|
+
const onTouchMove = (e) => {
|
|
9285
|
+
if (touched) {
|
|
9286
|
+
const currentY = Math.ceil(e.touches[0].pageY);
|
|
9287
|
+
let offsetY = touchY - currentY;
|
|
9288
|
+
touchY = currentY;
|
|
9289
|
+
if (callback(offsetY)) {
|
|
9290
|
+
e.preventDefault();
|
|
9291
|
+
}
|
|
9292
|
+
if (interval) {
|
|
9293
|
+
clearInterval(interval);
|
|
9294
|
+
}
|
|
9295
|
+
interval = setInterval(() => {
|
|
9296
|
+
offsetY *= SMOOTH_PTG;
|
|
9297
|
+
if (!callback(offsetY, true) || Math.abs(offsetY) <= 0.1) {
|
|
9298
|
+
if (interval) {
|
|
9299
|
+
clearInterval(interval);
|
|
9300
|
+
}
|
|
9301
|
+
}
|
|
9302
|
+
}, 16);
|
|
9303
|
+
}
|
|
9304
|
+
};
|
|
9305
|
+
const cleanUpEvents = () => {
|
|
9306
|
+
if (element) {
|
|
9307
|
+
element.removeEventListener("touchmove", onTouchMove);
|
|
9308
|
+
element.removeEventListener("touchend", () => {
|
|
9309
|
+
touched = false;
|
|
9310
|
+
cleanUpEvents();
|
|
9311
|
+
});
|
|
9312
|
+
}
|
|
9313
|
+
};
|
|
9314
|
+
const onTouchEnd = () => {
|
|
9315
|
+
touched = false;
|
|
9316
|
+
cleanUpEvents();
|
|
9317
|
+
};
|
|
9318
|
+
const onTouchStart = (e) => {
|
|
9319
|
+
cleanUpEvents();
|
|
9320
|
+
if (e.touches.length === 1 && !touched) {
|
|
9321
|
+
touched = true;
|
|
9322
|
+
touchY = Math.ceil(e.touches[0].pageY);
|
|
9323
|
+
element = e.target;
|
|
9324
|
+
element.addEventListener("touchmove", onTouchMove, {
|
|
9325
|
+
passive: false
|
|
9326
|
+
});
|
|
9327
|
+
element.addEventListener("touchend", onTouchEnd);
|
|
9328
|
+
}
|
|
9329
|
+
};
|
|
9330
|
+
onMounted(() => {
|
|
9331
|
+
watch(inVirtual, (val) => {
|
|
9332
|
+
var _a, _b;
|
|
9333
|
+
(_a = listRef.value) == null ? void 0 : _a.removeEventListener("touchstart", onTouchStart);
|
|
9334
|
+
cleanUpEvents();
|
|
9335
|
+
if (interval) {
|
|
9336
|
+
clearInterval(interval);
|
|
9337
|
+
}
|
|
9338
|
+
if (val) {
|
|
9339
|
+
(_b = listRef.value) == null ? void 0 : _b.addEventListener("touchstart", onTouchStart, {
|
|
9340
|
+
passive: false
|
|
9341
|
+
});
|
|
9342
|
+
}
|
|
9343
|
+
}, {
|
|
9344
|
+
immediate: true
|
|
9345
|
+
});
|
|
9346
|
+
});
|
|
9347
|
+
}
|
|
9348
|
+
var ResizeObserver$1 = defineComponent({
|
|
9349
|
+
name: "ResizeObserver",
|
|
9350
|
+
props: resizeObserverProps,
|
|
9351
|
+
emits: ["resize"],
|
|
9352
|
+
setup(props, {
|
|
9353
|
+
slots
|
|
9354
|
+
}) {
|
|
9355
|
+
const state = reactive({
|
|
9356
|
+
width: 0,
|
|
9357
|
+
height: 0,
|
|
9358
|
+
offsetHeight: 0,
|
|
9359
|
+
offsetWidth: 0
|
|
9360
|
+
});
|
|
9361
|
+
const currentElement = ref(null);
|
|
9362
|
+
const resizeObserver = ref(null);
|
|
9363
|
+
const destroyObserver = () => {
|
|
9364
|
+
if (resizeObserver.value) {
|
|
9365
|
+
resizeObserver.value.disconnect();
|
|
9366
|
+
resizeObserver.value = null;
|
|
9367
|
+
}
|
|
9368
|
+
};
|
|
9369
|
+
const onTriggerResize = (entries) => {
|
|
9370
|
+
const {
|
|
9371
|
+
onResize
|
|
9372
|
+
} = props;
|
|
9373
|
+
const target = entries[0].target;
|
|
9374
|
+
const {
|
|
9375
|
+
width,
|
|
9376
|
+
height
|
|
9377
|
+
} = target.getBoundingClientRect();
|
|
9378
|
+
const {
|
|
9379
|
+
offsetWidth,
|
|
9380
|
+
offsetHeight
|
|
9381
|
+
} = target;
|
|
9382
|
+
const fixedWidth = Math.floor(width);
|
|
9383
|
+
const fixedHeight = Math.floor(height);
|
|
9384
|
+
if (state.width !== fixedWidth || state.height !== fixedHeight || state.offsetWidth !== offsetWidth || state.offsetHeight !== offsetHeight) {
|
|
9385
|
+
const size = {
|
|
9386
|
+
width: fixedWidth,
|
|
9387
|
+
height: fixedHeight,
|
|
9388
|
+
offsetWidth,
|
|
9389
|
+
offsetHeight
|
|
9390
|
+
};
|
|
9391
|
+
Object.assign(state, size);
|
|
9392
|
+
if (onResize) {
|
|
9393
|
+
Promise.resolve().then(() => {
|
|
9394
|
+
onResize(__spreadProps(__spreadValues({}, size), {
|
|
9395
|
+
offsetWidth,
|
|
9396
|
+
offsetHeight
|
|
9397
|
+
}), target);
|
|
9398
|
+
});
|
|
9399
|
+
}
|
|
9400
|
+
}
|
|
9401
|
+
};
|
|
9402
|
+
const instance = getCurrentInstance();
|
|
9403
|
+
const registerObserver = () => {
|
|
9404
|
+
const {
|
|
9405
|
+
disabled
|
|
9406
|
+
} = props;
|
|
9407
|
+
if (disabled) {
|
|
9408
|
+
destroyObserver();
|
|
9409
|
+
return;
|
|
9410
|
+
}
|
|
9411
|
+
if (instance) {
|
|
9412
|
+
const element = findDOMNode(instance);
|
|
9413
|
+
const elementChanged = element !== currentElement.value;
|
|
9414
|
+
if (elementChanged) {
|
|
9415
|
+
destroyObserver();
|
|
9416
|
+
currentElement.value = element;
|
|
9417
|
+
}
|
|
9418
|
+
if (!resizeObserver.value && element) {
|
|
9419
|
+
resizeObserver.value = new ResizeObserver(onTriggerResize);
|
|
9420
|
+
resizeObserver.value.observe(element);
|
|
9421
|
+
}
|
|
9422
|
+
}
|
|
9423
|
+
};
|
|
9424
|
+
onMounted(() => {
|
|
9425
|
+
registerObserver();
|
|
9426
|
+
});
|
|
9427
|
+
onUpdated(() => {
|
|
9428
|
+
registerObserver();
|
|
9429
|
+
});
|
|
9430
|
+
onUnmounted(() => {
|
|
9431
|
+
destroyObserver();
|
|
9432
|
+
});
|
|
9433
|
+
return () => {
|
|
9434
|
+
var _a;
|
|
9435
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots)[0];
|
|
9436
|
+
};
|
|
9437
|
+
}
|
|
9438
|
+
});
|
|
9439
|
+
const INIT_INNER_STYLE = {
|
|
9440
|
+
display: "flex",
|
|
9441
|
+
flexDirection: "column"
|
|
9442
|
+
};
|
|
9443
|
+
var ResizeObserverContainer = defineComponent({
|
|
9444
|
+
name: "ResizeObserverContainer",
|
|
9445
|
+
props: resizeObserverContainerProps,
|
|
9446
|
+
setup(props, ctx) {
|
|
9447
|
+
const {
|
|
9448
|
+
height,
|
|
9449
|
+
offset: offset2
|
|
9450
|
+
} = toRefs(props);
|
|
9451
|
+
const outerStyle = ref({});
|
|
9452
|
+
const innerStyle = ref(INIT_INNER_STYLE);
|
|
9453
|
+
watch([() => height.value, () => offset2.value], () => {
|
|
9454
|
+
if (props.offset !== void 0) {
|
|
9455
|
+
outerStyle.value = {
|
|
9456
|
+
height: `${height.value}px`,
|
|
9457
|
+
position: "relative",
|
|
9458
|
+
overflow: "hidden"
|
|
9459
|
+
};
|
|
9460
|
+
innerStyle.value = __spreadProps(__spreadValues({}, innerStyle.value), {
|
|
9461
|
+
transform: `translateY(${offset2.value}px)`,
|
|
9462
|
+
position: "absolute",
|
|
9463
|
+
left: 0,
|
|
9464
|
+
right: 0,
|
|
9465
|
+
top: 0
|
|
9466
|
+
});
|
|
9467
|
+
}
|
|
9468
|
+
}, {
|
|
9469
|
+
immediate: true
|
|
9470
|
+
});
|
|
9471
|
+
return () => createVNode("div", {
|
|
9472
|
+
"style": outerStyle.value
|
|
9473
|
+
}, [createVNode(ResizeObserver$1, {
|
|
9474
|
+
"onResize": ({
|
|
9475
|
+
offsetHeight
|
|
9476
|
+
}) => {
|
|
9477
|
+
if (offsetHeight && props.onInnerResize) {
|
|
9478
|
+
props.onInnerResize();
|
|
9479
|
+
}
|
|
9480
|
+
}
|
|
9481
|
+
}, {
|
|
9482
|
+
default: () => {
|
|
9483
|
+
var _a, _b;
|
|
9484
|
+
return [createVNode("div", {
|
|
9485
|
+
"style": innerStyle.value
|
|
9486
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
9487
|
+
}
|
|
9488
|
+
})]);
|
|
9489
|
+
}
|
|
9490
|
+
});
|
|
9491
|
+
function getPageY(e) {
|
|
9492
|
+
return "touches" in e ? e.touches[0].pageY : e.pageY;
|
|
9493
|
+
}
|
|
9494
|
+
var ScrollBar = defineComponent({
|
|
9495
|
+
name: "ScrollBar",
|
|
9496
|
+
props: scrollBarProps,
|
|
9497
|
+
setup(props, ctx) {
|
|
9498
|
+
const scrollbarRef = ref(null);
|
|
9499
|
+
const thumbRef = ref(null);
|
|
9500
|
+
const moveRaf = ref(0);
|
|
9501
|
+
const state = reactive({
|
|
9502
|
+
dragging: false,
|
|
9503
|
+
pageY: null,
|
|
9504
|
+
startTop: null,
|
|
9505
|
+
visible: false
|
|
9506
|
+
});
|
|
9507
|
+
const visibleTimeout = ref(null);
|
|
9508
|
+
const canScroll = computed(() => {
|
|
9509
|
+
return (props.scrollHeight || 0) > (props.height || 0);
|
|
9510
|
+
});
|
|
9511
|
+
const getSpinHeight = () => {
|
|
9512
|
+
const {
|
|
9513
|
+
height = 0,
|
|
9514
|
+
count = 0
|
|
9515
|
+
} = props;
|
|
9516
|
+
let baseHeight = height / count * 10;
|
|
9517
|
+
baseHeight = Math.max(baseHeight, 20);
|
|
9518
|
+
baseHeight = Math.min(baseHeight, height / 2);
|
|
9519
|
+
return Math.floor(baseHeight);
|
|
9520
|
+
};
|
|
9521
|
+
const getEnableScrollRange = () => {
|
|
9522
|
+
const {
|
|
9523
|
+
scrollHeight = 0,
|
|
9524
|
+
height = 0
|
|
9525
|
+
} = props;
|
|
9526
|
+
return scrollHeight - height || 0;
|
|
9527
|
+
};
|
|
9528
|
+
const getEnableHeightRange = () => {
|
|
9529
|
+
const {
|
|
9530
|
+
height = 0
|
|
9531
|
+
} = props;
|
|
9532
|
+
const spinHeight = getSpinHeight();
|
|
9533
|
+
return height - spinHeight || 0;
|
|
9534
|
+
};
|
|
9535
|
+
const getTop = () => {
|
|
9536
|
+
const {
|
|
9537
|
+
scrollTop = 0
|
|
9538
|
+
} = props;
|
|
9539
|
+
const enableScrollRange = getEnableScrollRange();
|
|
9540
|
+
const enableHeightRange = getEnableHeightRange();
|
|
9541
|
+
if (scrollTop === 0 || enableScrollRange === 0) {
|
|
9542
|
+
return 0;
|
|
9543
|
+
}
|
|
9544
|
+
const ptg = scrollTop / enableScrollRange;
|
|
9545
|
+
return ptg * enableHeightRange;
|
|
9546
|
+
};
|
|
9547
|
+
const onMouseMove = (e) => {
|
|
9548
|
+
const {
|
|
9549
|
+
dragging,
|
|
9550
|
+
pageY,
|
|
9551
|
+
startTop
|
|
9552
|
+
} = state;
|
|
9553
|
+
const {
|
|
9554
|
+
onScroll
|
|
9555
|
+
} = props;
|
|
9556
|
+
window.cancelAnimationFrame(moveRaf.value);
|
|
9557
|
+
if (dragging) {
|
|
9558
|
+
const offsetY = getPageY(e) - (pageY || 0);
|
|
9559
|
+
const newTop = (startTop || 0) + offsetY;
|
|
9560
|
+
const enableScrollRange = getEnableScrollRange();
|
|
9561
|
+
const enableHeightRange = getEnableHeightRange();
|
|
9562
|
+
const ptg = enableHeightRange ? newTop / enableHeightRange : 0;
|
|
9563
|
+
const newScrollTop = Math.ceil(ptg * enableScrollRange);
|
|
9564
|
+
moveRaf.value = window.requestAnimationFrame(() => {
|
|
9565
|
+
if (onScroll) {
|
|
9566
|
+
onScroll(newScrollTop);
|
|
9567
|
+
}
|
|
9568
|
+
});
|
|
9569
|
+
}
|
|
9570
|
+
};
|
|
9571
|
+
const onMouseUp = (callback) => {
|
|
9572
|
+
const {
|
|
9573
|
+
onStopMove
|
|
9574
|
+
} = props;
|
|
9575
|
+
state.dragging = false;
|
|
9576
|
+
if (onStopMove) {
|
|
9577
|
+
onStopMove();
|
|
9578
|
+
}
|
|
9579
|
+
if (callback) {
|
|
9580
|
+
callback();
|
|
9581
|
+
}
|
|
9582
|
+
};
|
|
9583
|
+
const onMouseDown = (e, callback) => {
|
|
9584
|
+
var _a, _b;
|
|
9585
|
+
const {
|
|
9586
|
+
onStartMove
|
|
9587
|
+
} = props;
|
|
9588
|
+
Object.assign(state, {
|
|
9589
|
+
dragging: true,
|
|
9590
|
+
pageY: getPageY(e),
|
|
9591
|
+
startTop: getTop()
|
|
9592
|
+
});
|
|
9593
|
+
if (onStartMove) {
|
|
9594
|
+
onStartMove();
|
|
9595
|
+
}
|
|
9596
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
9597
|
+
window.addEventListener("mouseup", () => onMouseUp(callback));
|
|
9598
|
+
(_a = thumbRef == null ? void 0 : thumbRef.value) == null ? void 0 : _a.addEventListener("touchmove", onMouseMove, {
|
|
9599
|
+
passive: false
|
|
9600
|
+
});
|
|
9601
|
+
(_b = thumbRef == null ? void 0 : thumbRef.value) == null ? void 0 : _b.addEventListener("touchend", () => onMouseUp(callback));
|
|
9602
|
+
e.stopPropagation();
|
|
9603
|
+
e.preventDefault();
|
|
9604
|
+
};
|
|
9605
|
+
const removeEvents = () => {
|
|
9606
|
+
var _a, _b, _c, _d;
|
|
9607
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
9608
|
+
window.removeEventListener("mouseup", () => onMouseUp(removeEvents));
|
|
9609
|
+
(_a = scrollbarRef == null ? void 0 : scrollbarRef.value) == null ? void 0 : _a.removeEventListener("touchstart", (e) => {
|
|
9610
|
+
e.preventDefault();
|
|
9611
|
+
}, {
|
|
9612
|
+
passive: false
|
|
9613
|
+
});
|
|
9614
|
+
(_b = thumbRef == null ? void 0 : thumbRef.value) == null ? void 0 : _b.removeEventListener("touchstart", (e) => onMouseDown(e, removeEvents), {
|
|
9615
|
+
passive: false
|
|
9616
|
+
});
|
|
9617
|
+
(_c = thumbRef == null ? void 0 : thumbRef.value) == null ? void 0 : _c.removeEventListener("touchmove", onMouseMove, {
|
|
9618
|
+
passive: false
|
|
9619
|
+
});
|
|
9620
|
+
(_d = thumbRef == null ? void 0 : thumbRef.value) == null ? void 0 : _d.removeEventListener("touchend", () => onMouseUp(removeEvents));
|
|
9621
|
+
window.cancelAnimationFrame(moveRaf.value);
|
|
9622
|
+
};
|
|
9623
|
+
const onContainerMouseDown = (e) => {
|
|
9624
|
+
e.stopPropagation();
|
|
9625
|
+
e.preventDefault();
|
|
9626
|
+
};
|
|
9627
|
+
onBeforeUnmount(() => {
|
|
9628
|
+
removeEvents();
|
|
9629
|
+
if (visibleTimeout.value) {
|
|
9630
|
+
clearTimeout(visibleTimeout.value);
|
|
9631
|
+
}
|
|
9632
|
+
});
|
|
9633
|
+
onMounted(() => {
|
|
9634
|
+
var _a, _b;
|
|
9635
|
+
(_a = scrollbarRef == null ? void 0 : scrollbarRef.value) == null ? void 0 : _a.addEventListener("touchstart", (e) => {
|
|
9636
|
+
e.preventDefault();
|
|
9637
|
+
}, {
|
|
9638
|
+
passive: false
|
|
9639
|
+
});
|
|
9640
|
+
(_b = thumbRef.value) == null ? void 0 : _b.addEventListener("touchstart", (e) => onMouseDown(e, removeEvents), {
|
|
9641
|
+
passive: false
|
|
9642
|
+
});
|
|
9643
|
+
});
|
|
9644
|
+
const onShowBar = () => {
|
|
9645
|
+
if (visibleTimeout.value) {
|
|
9646
|
+
clearTimeout(visibleTimeout.value);
|
|
9647
|
+
}
|
|
9648
|
+
state.visible = true;
|
|
9649
|
+
visibleTimeout.value = setTimeout(() => {
|
|
9650
|
+
state.visible = false;
|
|
9651
|
+
}, 1e3);
|
|
9652
|
+
};
|
|
9653
|
+
ctx.expose({
|
|
9654
|
+
onShowBar
|
|
9655
|
+
});
|
|
9656
|
+
return () => {
|
|
9657
|
+
const display = canScroll.value && state.visible ? void 0 : "none";
|
|
9658
|
+
return createVNode("div", {
|
|
9659
|
+
"ref": scrollbarRef,
|
|
9660
|
+
"style": {
|
|
9661
|
+
width: "8px",
|
|
9662
|
+
top: 0,
|
|
9663
|
+
bottom: 0,
|
|
9664
|
+
right: 0,
|
|
9665
|
+
position: "absolute",
|
|
9666
|
+
display
|
|
9667
|
+
},
|
|
9668
|
+
"onMousedown": onContainerMouseDown,
|
|
9669
|
+
"onMousemove": onShowBar
|
|
9670
|
+
}, [createVNode("div", {
|
|
9671
|
+
"ref": thumbRef,
|
|
9672
|
+
"style": {
|
|
9673
|
+
width: "100%",
|
|
9674
|
+
height: getSpinHeight() + "px",
|
|
9675
|
+
top: getTop() + "px",
|
|
9676
|
+
left: 0,
|
|
9677
|
+
position: "absolute",
|
|
9678
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
9679
|
+
borderRadius: "99px",
|
|
9680
|
+
cursor: "pointer",
|
|
9681
|
+
userSelect: "none"
|
|
9682
|
+
},
|
|
9683
|
+
"onMousedown": (e) => onMouseDown(e, removeEvents)
|
|
9684
|
+
}, null)]);
|
|
9685
|
+
};
|
|
9686
|
+
}
|
|
9687
|
+
});
|
|
9688
|
+
function _isSlot$1(s) {
|
|
9689
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9690
|
+
}
|
|
9691
|
+
const Item = ({
|
|
9692
|
+
setRef
|
|
9693
|
+
}, {
|
|
9694
|
+
slots
|
|
9695
|
+
}) => {
|
|
9696
|
+
var _a;
|
|
9697
|
+
const children = flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
9698
|
+
return children && children.length ? cloneVNode(children[0], {
|
|
9699
|
+
ref: setRef
|
|
9700
|
+
}) : children;
|
|
9701
|
+
};
|
|
9702
|
+
Item.props = {
|
|
9703
|
+
setRef: {
|
|
9704
|
+
type: Function
|
|
9705
|
+
}
|
|
9706
|
+
};
|
|
9707
|
+
function renderChildren(list, startIndex, endIndex, setNodeRef, {
|
|
9708
|
+
getKey
|
|
9709
|
+
}, renderFunc) {
|
|
9710
|
+
if (renderFunc === void 0) {
|
|
9711
|
+
return "";
|
|
9712
|
+
}
|
|
9713
|
+
return list.slice(startIndex, endIndex + 1).map((item, index2) => {
|
|
9714
|
+
const eleIndex = startIndex + index2;
|
|
9715
|
+
const node = renderFunc(item, eleIndex, {});
|
|
9716
|
+
const key = getKey(item);
|
|
9717
|
+
return createVNode(Item, {
|
|
9718
|
+
"key": key,
|
|
9719
|
+
"setRef": (ele) => setNodeRef(item, ele)
|
|
9720
|
+
}, _isSlot$1(node) ? node : {
|
|
9721
|
+
default: () => [node]
|
|
9722
|
+
});
|
|
9723
|
+
});
|
|
9724
|
+
}
|
|
9725
|
+
const ScrollStyle = {
|
|
9726
|
+
overflowY: "auto",
|
|
9727
|
+
overflowAnchor: "none"
|
|
9728
|
+
};
|
|
9729
|
+
const DEFAULT_HEIGHT = 20;
|
|
9730
|
+
var VirtualList = defineComponent({
|
|
9731
|
+
name: "DVirtualList",
|
|
9732
|
+
props: virtualListProps,
|
|
9733
|
+
setup(props, ctx) {
|
|
9734
|
+
const {
|
|
9735
|
+
isVirtual,
|
|
9736
|
+
inVirtual
|
|
9737
|
+
} = useVirtual(props);
|
|
9738
|
+
const state = reactive({
|
|
9739
|
+
scrollTop: 0,
|
|
9740
|
+
scrollMoving: false
|
|
9741
|
+
});
|
|
9742
|
+
const data = computed(() => {
|
|
9743
|
+
return props.data || [];
|
|
9744
|
+
});
|
|
9745
|
+
const mergedData = shallowRef([]);
|
|
9746
|
+
watch(data, () => {
|
|
9747
|
+
mergedData.value = toRaw(data.value).slice();
|
|
9748
|
+
}, {
|
|
9749
|
+
immediate: true
|
|
9750
|
+
});
|
|
9751
|
+
const itemKey = shallowRef(null);
|
|
9752
|
+
watch(() => props.itemKey, (val) => {
|
|
9753
|
+
if (typeof val === "function") {
|
|
9754
|
+
itemKey.value = val;
|
|
9755
|
+
} else {
|
|
9756
|
+
if (val) {
|
|
9757
|
+
itemKey.value = (item) => item == null ? void 0 : item[val];
|
|
9758
|
+
}
|
|
9759
|
+
}
|
|
9760
|
+
}, {
|
|
9761
|
+
immediate: true
|
|
9762
|
+
});
|
|
9763
|
+
const componentRef = ref();
|
|
9764
|
+
const fillerInnerRef = ref();
|
|
9765
|
+
const barRef = ref();
|
|
9766
|
+
const getKey = (item) => {
|
|
9767
|
+
if (!itemKey.value || !props.itemKey) {
|
|
9768
|
+
return;
|
|
9769
|
+
}
|
|
9770
|
+
return itemKey.value(item);
|
|
9771
|
+
};
|
|
9772
|
+
const [setInstance, collectHeight, heights, updatedMark] = useHeights(mergedData, getKey);
|
|
9773
|
+
const calRes = reactive({
|
|
9774
|
+
scrollHeight: void 0,
|
|
9775
|
+
start: 0,
|
|
9776
|
+
end: 0,
|
|
9777
|
+
offset: void 0
|
|
9778
|
+
});
|
|
9779
|
+
const offsetHeight = ref(0);
|
|
9780
|
+
onMounted(() => {
|
|
9781
|
+
nextTick(() => {
|
|
9782
|
+
var _a;
|
|
9783
|
+
offsetHeight.value = ((_a = fillerInnerRef.value) == null ? void 0 : _a.offsetHeight) || 0;
|
|
9784
|
+
});
|
|
9785
|
+
});
|
|
9786
|
+
onUpdated(() => {
|
|
9787
|
+
nextTick(() => {
|
|
9788
|
+
var _a;
|
|
9789
|
+
offsetHeight.value = ((_a = fillerInnerRef.value) == null ? void 0 : _a.offsetHeight) || 0;
|
|
9790
|
+
});
|
|
9791
|
+
});
|
|
9792
|
+
watch([isVirtual, mergedData], () => {
|
|
9793
|
+
if (!isVirtual.value) {
|
|
9794
|
+
Object.assign(calRes, {
|
|
9795
|
+
scrollHeight: void 0,
|
|
9796
|
+
start: 0,
|
|
9797
|
+
end: mergedData.value.length - 1,
|
|
9798
|
+
offset: void 0
|
|
9799
|
+
});
|
|
9800
|
+
}
|
|
9801
|
+
}, {
|
|
9802
|
+
immediate: true
|
|
9803
|
+
});
|
|
9804
|
+
watch([isVirtual, mergedData, offsetHeight, inVirtual], () => {
|
|
9805
|
+
if (isVirtual.value && !inVirtual.value) {
|
|
9806
|
+
Object.assign(calRes, {
|
|
9807
|
+
scrollHeight: offsetHeight.value,
|
|
9808
|
+
start: 0,
|
|
9809
|
+
end: mergedData.value.length - 1,
|
|
9810
|
+
offset: void 0
|
|
9811
|
+
});
|
|
9812
|
+
}
|
|
9813
|
+
}, {
|
|
9814
|
+
immediate: true
|
|
9815
|
+
});
|
|
9816
|
+
watch([inVirtual, isVirtual, () => state.scrollTop, mergedData, updatedMark, () => props.height, offsetHeight], () => {
|
|
9817
|
+
if (!isVirtual.value || !inVirtual.value) {
|
|
9818
|
+
return;
|
|
9819
|
+
}
|
|
9820
|
+
let itemTop = 0;
|
|
9821
|
+
let startIndex;
|
|
9822
|
+
let startOffset;
|
|
9823
|
+
let endIndex;
|
|
9824
|
+
const mergedDataValue = unref(mergedData);
|
|
9825
|
+
const scrollTop = state.scrollTop;
|
|
9826
|
+
const {
|
|
9827
|
+
height
|
|
9828
|
+
} = props;
|
|
9829
|
+
const scrollTopHeight = scrollTop + height;
|
|
9830
|
+
for (let i = 0; i < mergedDataValue.length; i += 1) {
|
|
9831
|
+
const mergedDataItem = mergedDataValue[i];
|
|
9832
|
+
let cacheHeight;
|
|
9833
|
+
if (props.itemKey) {
|
|
9834
|
+
const key = getKey(mergedDataItem);
|
|
9835
|
+
cacheHeight = heights.get(key);
|
|
9836
|
+
}
|
|
9837
|
+
if (cacheHeight === void 0) {
|
|
9838
|
+
cacheHeight = props.itemHeight || DEFAULT_HEIGHT;
|
|
9839
|
+
}
|
|
9840
|
+
const currentItemBottom = itemTop + cacheHeight;
|
|
9841
|
+
if (startIndex === void 0 && currentItemBottom >= scrollTop) {
|
|
9842
|
+
startIndex = i;
|
|
9843
|
+
startOffset = itemTop;
|
|
9844
|
+
}
|
|
9845
|
+
if (endIndex === void 0 && currentItemBottom > scrollTopHeight) {
|
|
9846
|
+
endIndex = i;
|
|
9847
|
+
}
|
|
9848
|
+
itemTop = currentItemBottom;
|
|
9849
|
+
}
|
|
9850
|
+
if (startIndex === void 0) {
|
|
9851
|
+
startIndex = 0;
|
|
9852
|
+
startOffset = 0;
|
|
9853
|
+
}
|
|
9854
|
+
if (endIndex === void 0) {
|
|
9855
|
+
endIndex = mergedDataValue.length - 1;
|
|
9856
|
+
}
|
|
9857
|
+
endIndex = Math.min(endIndex + 1, mergedDataValue.length);
|
|
9858
|
+
Object.assign(calRes, {
|
|
9859
|
+
scrollHeight: itemTop,
|
|
9860
|
+
start: startIndex,
|
|
9861
|
+
end: endIndex,
|
|
9862
|
+
offset: startOffset
|
|
9863
|
+
});
|
|
9864
|
+
}, {
|
|
9865
|
+
immediate: true
|
|
9866
|
+
});
|
|
9867
|
+
const maxScrollHeight = computed(() => (calRes.scrollHeight || 0) - props.height);
|
|
9868
|
+
const keepInRange = (newScrollTop) => {
|
|
9869
|
+
let newTop = newScrollTop;
|
|
9870
|
+
if (!Number.isNaN(maxScrollHeight.value)) {
|
|
9871
|
+
newTop = Math.min(newTop, maxScrollHeight.value);
|
|
9872
|
+
}
|
|
9873
|
+
newTop = Math.max(newTop, 0);
|
|
9874
|
+
return newTop;
|
|
9875
|
+
};
|
|
9876
|
+
const isScrollAtTop = computed(() => state.scrollTop <= 0);
|
|
9877
|
+
const isScrollAtBottom = computed(() => state.scrollTop >= maxScrollHeight.value);
|
|
9878
|
+
const originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
|
|
9879
|
+
const syncScrollTop = (newTop) => {
|
|
9880
|
+
let value;
|
|
9881
|
+
if (typeof newTop === "function") {
|
|
9882
|
+
value = newTop(state.scrollTop);
|
|
9883
|
+
} else {
|
|
9884
|
+
value = newTop;
|
|
9885
|
+
}
|
|
9886
|
+
const alignedTop = keepInRange(value);
|
|
9887
|
+
if (componentRef.value) {
|
|
9888
|
+
componentRef.value.scrollTop = alignedTop;
|
|
9889
|
+
}
|
|
9890
|
+
state.scrollTop = alignedTop;
|
|
9891
|
+
};
|
|
9892
|
+
const onScrollBar = (newScrollTop) => {
|
|
9893
|
+
const newTop = newScrollTop;
|
|
9894
|
+
syncScrollTop(newTop);
|
|
9895
|
+
};
|
|
9896
|
+
const onComponentScroll = (e) => {
|
|
9897
|
+
var _a, _b;
|
|
9898
|
+
const {
|
|
9899
|
+
scrollTop: newScrollTop
|
|
9900
|
+
} = e.currentTarget;
|
|
9901
|
+
if (Math.abs(newScrollTop - state.scrollTop) >= 1) {
|
|
9902
|
+
syncScrollTop(newScrollTop);
|
|
9903
|
+
}
|
|
9904
|
+
(_b = (_a = barRef == null ? void 0 : barRef.value) == null ? void 0 : _a.onShowBar) == null ? void 0 : _b.call(_a);
|
|
9905
|
+
ctx.emit("scroll", e);
|
|
9906
|
+
};
|
|
9907
|
+
const [onRawWheel, onFireFoxScroll] = useFrameWheel(isVirtual, isScrollAtTop, isScrollAtBottom, (offsetY) => {
|
|
9908
|
+
syncScrollTop((top) => {
|
|
9909
|
+
const newTop = top + offsetY;
|
|
9910
|
+
return newTop;
|
|
9911
|
+
});
|
|
9912
|
+
});
|
|
9913
|
+
useMobileTouchMove(isVirtual, componentRef, (deltaY, smoothOffset) => {
|
|
9914
|
+
if (originScroll(deltaY, !!smoothOffset)) {
|
|
9915
|
+
return false;
|
|
9916
|
+
}
|
|
9917
|
+
onRawWheel({
|
|
9918
|
+
deltaY
|
|
9919
|
+
});
|
|
9920
|
+
return true;
|
|
9921
|
+
});
|
|
9922
|
+
const onMozMousePixelScroll = (e) => {
|
|
9923
|
+
if (isVirtual.value) {
|
|
9924
|
+
e.preventDefault();
|
|
9925
|
+
}
|
|
9926
|
+
};
|
|
9927
|
+
const removeEventListener = () => {
|
|
9928
|
+
if (componentRef.value) {
|
|
9929
|
+
componentRef.value.removeEventListener("wheel", onRawWheel, {
|
|
9930
|
+
passive: false
|
|
9931
|
+
});
|
|
9932
|
+
componentRef.value.removeEventListener("DOMMouseScroll", onFireFoxScroll);
|
|
9933
|
+
componentRef.value.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
|
|
9934
|
+
}
|
|
9935
|
+
};
|
|
9936
|
+
watchEffect(() => {
|
|
9937
|
+
nextTick(() => {
|
|
9938
|
+
if (componentRef.value) {
|
|
9939
|
+
removeEventListener();
|
|
9940
|
+
componentRef.value.addEventListener("wheel", onRawWheel, {
|
|
9941
|
+
passive: false
|
|
9942
|
+
});
|
|
9943
|
+
componentRef.value.addEventListener("DOMMouseScroll", onFireFoxScroll);
|
|
9944
|
+
componentRef.value.addEventListener("MozMousePixelScroll", onMozMousePixelScroll);
|
|
9945
|
+
}
|
|
9946
|
+
});
|
|
9947
|
+
});
|
|
9948
|
+
onBeforeUnmount(() => {
|
|
9949
|
+
removeEventListener();
|
|
9950
|
+
});
|
|
9951
|
+
const componentStyle = computed(() => {
|
|
9952
|
+
let cs = null;
|
|
9953
|
+
if (props.height) {
|
|
9954
|
+
cs = __spreadValues({
|
|
9955
|
+
maxHeight: isVirtual.value ? props.height + "px" : void 0
|
|
9956
|
+
}, ScrollStyle);
|
|
9957
|
+
if (isVirtual.value) {
|
|
9958
|
+
cs.overflowY = "hidden";
|
|
9959
|
+
if (state.scrollMoving) {
|
|
9960
|
+
cs.pointerEvents = "none";
|
|
9961
|
+
}
|
|
9962
|
+
}
|
|
9963
|
+
}
|
|
9964
|
+
return cs;
|
|
9965
|
+
});
|
|
9966
|
+
watch([() => calRes.start, () => calRes.end, mergedData], () => {
|
|
9967
|
+
const renderList = mergedData.value.slice(calRes.start, calRes.end + 1);
|
|
9968
|
+
ctx.emit("show-change", renderList, mergedData.value);
|
|
9969
|
+
}, {
|
|
9970
|
+
flush: "post"
|
|
9971
|
+
});
|
|
9972
|
+
ctx.expose({
|
|
9973
|
+
scrollTo(index2) {
|
|
9974
|
+
syncScrollTop(index2 * (props.itemHeight || DEFAULT_HEIGHT));
|
|
9975
|
+
}
|
|
9976
|
+
});
|
|
9977
|
+
return () => {
|
|
9978
|
+
const Component = props.component;
|
|
9979
|
+
return createVNode("div", {
|
|
9980
|
+
"style": {
|
|
9981
|
+
position: "relative"
|
|
9982
|
+
}
|
|
9983
|
+
}, [createVNode(Component, {
|
|
9984
|
+
"style": componentStyle.value,
|
|
9985
|
+
"ref": componentRef,
|
|
9986
|
+
"onScroll": onComponentScroll
|
|
9987
|
+
}, {
|
|
9988
|
+
default: () => [createVNode(ResizeObserverContainer, {
|
|
9989
|
+
"height": calRes.scrollHeight,
|
|
9990
|
+
"offset": calRes.offset,
|
|
9991
|
+
"onInnerResize": collectHeight,
|
|
9992
|
+
"ref": fillerInnerRef
|
|
9993
|
+
}, {
|
|
9994
|
+
default: () => renderChildren(mergedData.value, calRes.start, calRes.end, setInstance, {
|
|
9995
|
+
getKey
|
|
9996
|
+
}, ctx.slots.item)
|
|
9997
|
+
})]
|
|
9998
|
+
}), isVirtual.value && createVNode(ScrollBar, {
|
|
9999
|
+
"ref": barRef,
|
|
10000
|
+
"scrollTop": state.scrollTop,
|
|
10001
|
+
"height": props.height,
|
|
10002
|
+
"scrollHeight": calRes.scrollHeight,
|
|
10003
|
+
"count": mergedData.value.length,
|
|
10004
|
+
"onScroll": onScrollBar,
|
|
10005
|
+
"onStartMove": () => {
|
|
10006
|
+
state.scrollMoving = true;
|
|
10007
|
+
},
|
|
10008
|
+
"onStopMove": () => {
|
|
10009
|
+
state.scrollMoving = false;
|
|
10010
|
+
}
|
|
10011
|
+
}, null)]);
|
|
10012
|
+
};
|
|
10013
|
+
}
|
|
10014
|
+
});
|
|
8896
10015
|
var CalendarPanel = defineComponent({
|
|
8897
10016
|
name: "CalendarPanel",
|
|
8898
10017
|
props: datePickerProPanelProps,
|
|
@@ -8910,7 +10029,6 @@ var CalendarPanel = defineComponent({
|
|
|
8910
10029
|
handlerSelectDate,
|
|
8911
10030
|
handlerYearCollapse,
|
|
8912
10031
|
handlerClickMonth,
|
|
8913
|
-
handleScrollYearList,
|
|
8914
10032
|
handleScrollMonthList,
|
|
8915
10033
|
isDateSelected,
|
|
8916
10034
|
isStartDate,
|
|
@@ -8919,29 +10037,57 @@ var CalendarPanel = defineComponent({
|
|
|
8919
10037
|
isDisabled
|
|
8920
10038
|
} = useCalendarPanel(props, ctx);
|
|
8921
10039
|
return () => {
|
|
10040
|
+
const yearItemSlots = {
|
|
10041
|
+
item: (item) => {
|
|
10042
|
+
return createVNode("div", {
|
|
10043
|
+
"class": [ns2.em("calendar-panel", "year-list-item"), item.active && ns2.e("year-title-active")]
|
|
10044
|
+
}, [!item.isMonth && !isListCollapse.value && createVNode("div", {
|
|
10045
|
+
"class": ns2.e("year-title"),
|
|
10046
|
+
"onClick": () => handlerYearCollapse()
|
|
10047
|
+
}, [item.year]), !item.isMonth && isListCollapse.value && createVNode("div", {
|
|
10048
|
+
"class": ns2.e("year-title"),
|
|
10049
|
+
"onClick": () => {
|
|
10050
|
+
handlerClickMonth(item.year, 0);
|
|
10051
|
+
}
|
|
10052
|
+
}, [item.year]), item.isMonth && createVNode("div", {
|
|
10053
|
+
"class": ns2.e("month-title"),
|
|
10054
|
+
"onClick": () => {
|
|
10055
|
+
handlerClickMonth(item.year, item.month);
|
|
10056
|
+
}
|
|
10057
|
+
}, [t(`month${item.month ? item.month + 1 : 1}`)])]);
|
|
10058
|
+
}
|
|
10059
|
+
};
|
|
10060
|
+
const monthItemSlots = {
|
|
10061
|
+
item: (month) => {
|
|
10062
|
+
return createVNode("div", {
|
|
10063
|
+
"class": ns2.e("table-month")
|
|
10064
|
+
}, [createVNode("div", {
|
|
10065
|
+
"class": ns2.e("table-month-title")
|
|
10066
|
+
}, [t("getYearMonthStr")(month.year, (month.month || 0) + 1)]), createVNode("table", {
|
|
10067
|
+
"class": ns2.e("table-month-content")
|
|
10068
|
+
}, [createVNode("tbody", null, [month.displayWeeks && month.displayWeeks.map((week, weekIndex) => createVNode("tr", {
|
|
10069
|
+
"class": ns2.e("table-week-header"),
|
|
10070
|
+
"key": weekIndex
|
|
10071
|
+
}, [week.map((day, dayIndex) => createVNode("td", {
|
|
10072
|
+
"key": dayIndex,
|
|
10073
|
+
"class": [day.inMonth && ns2.e("table-date"), isDateSelected(day.date) && ns2.e("table-date-selected"), day.isToday && ns2.e("table-date-today"), isStartDate(day.date) && ns2.e("table-date-start"), isInRangeDate(day.date) && ns2.e("table-date-in-range"), isEndDate(day.date) && ns2.e("table-date-end"), isDisabled(day.date) && ns2.e("table-date-disabled")],
|
|
10074
|
+
"onClick": (e) => {
|
|
10075
|
+
e.preventDefault();
|
|
10076
|
+
e.stopPropagation();
|
|
10077
|
+
handlerSelectDate(day);
|
|
10078
|
+
}
|
|
10079
|
+
}, [createVNode("span", null, [day.inMonth ? day.day : ""])]))]))])])]);
|
|
10080
|
+
}
|
|
10081
|
+
};
|
|
8922
10082
|
return createVNode("div", {
|
|
8923
10083
|
"class": ns2.e("calendar-panel")
|
|
8924
|
-
}, [createVNode(
|
|
10084
|
+
}, [createVNode(VirtualList, {
|
|
8925
10085
|
"ref": yearScrollRef,
|
|
8926
10086
|
"class": ns2.em("calendar-panel", "year-list"),
|
|
8927
|
-
"
|
|
8928
|
-
|
|
8929
|
-
"
|
|
8930
|
-
|
|
8931
|
-
}, [!item.isMonth && !isListCollapse.value && createVNode("div", {
|
|
8932
|
-
"class": ns2.e("year-title"),
|
|
8933
|
-
"onClick": () => handlerYearCollapse()
|
|
8934
|
-
}, [item.year]), !item.isMonth && isListCollapse.value && createVNode("div", {
|
|
8935
|
-
"class": ns2.e("year-title"),
|
|
8936
|
-
"onClick": () => {
|
|
8937
|
-
handlerClickMonth(item.year, 0);
|
|
8938
|
-
}
|
|
8939
|
-
}, [item.year]), item.isMonth && createVNode("div", {
|
|
8940
|
-
"class": ns2.e("month-title"),
|
|
8941
|
-
"onClick": () => {
|
|
8942
|
-
handlerClickMonth(item.year, item.month);
|
|
8943
|
-
}
|
|
8944
|
-
}, [t(`month${item.month ? item.month + 1 : 1}`)])]))]), createVNode("div", {
|
|
10087
|
+
"data": yearAndMonthList.value,
|
|
10088
|
+
"height": yearListHeight,
|
|
10089
|
+
"itemHeight": yearItemHeight
|
|
10090
|
+
}, yearItemSlots), createVNode("div", {
|
|
8945
10091
|
"class": ns2.em("calendar-panel", "main")
|
|
8946
10092
|
}, [createVNode("table", {
|
|
8947
10093
|
"class": ns2.e("calendar-table")
|
|
@@ -8949,29 +10095,14 @@ var CalendarPanel = defineComponent({
|
|
|
8949
10095
|
"class": ns2.e("table-week-header")
|
|
8950
10096
|
}, [t("getWeekDays")().map((child) => createVNode("td", null, [child]))])]), createVNode("tbody", null, [createVNode("tr", null, [createVNode("td", {
|
|
8951
10097
|
"colspan": "7"
|
|
8952
|
-
}, [createVNode(
|
|
10098
|
+
}, [createVNode(VirtualList, {
|
|
8953
10099
|
"ref": monthScrollRef,
|
|
8954
10100
|
"class": ns2.e("tbody-wrapper"),
|
|
10101
|
+
"data": allMonthList.value,
|
|
10102
|
+
"height": calendarListHeight,
|
|
10103
|
+
"itemHeight": calendarItemHeight,
|
|
8955
10104
|
"onScroll": handleScrollMonthList
|
|
8956
|
-
},
|
|
8957
|
-
"class": ns2.e("table-month"),
|
|
8958
|
-
"key": monthIndex
|
|
8959
|
-
}, [createVNode("div", {
|
|
8960
|
-
"class": ns2.e("table-month-title")
|
|
8961
|
-
}, [t("getYearMonthStr")(month.year, (month.month || 0) + 1)]), createVNode("table", {
|
|
8962
|
-
"class": ns2.e("table-month-content")
|
|
8963
|
-
}, [createVNode("tbody", null, [month.displayWeeks && month.displayWeeks.map((week, weekIndex) => createVNode("tr", {
|
|
8964
|
-
"class": ns2.e("table-week-header"),
|
|
8965
|
-
"key": weekIndex
|
|
8966
|
-
}, [week.map((day, dayIndex) => createVNode("td", {
|
|
8967
|
-
"key": dayIndex,
|
|
8968
|
-
"class": [day.inMonth && ns2.e("table-date"), isDateSelected(day.date) && ns2.e("table-date-selected"), day.isToday && ns2.e("table-date-today"), isStartDate(day.date) && ns2.e("table-date-start"), isInRangeDate(day.date) && ns2.e("table-date-in-range"), isEndDate(day.date) && ns2.e("table-date-end"), isDisabled(day.date) && ns2.e("table-date-disabled")],
|
|
8969
|
-
"onClick": (e) => {
|
|
8970
|
-
e.preventDefault();
|
|
8971
|
-
e.stopPropagation();
|
|
8972
|
-
handlerSelectDate(day);
|
|
8973
|
-
}
|
|
8974
|
-
}, [createVNode("span", null, [day.inMonth ? day.day : ""])]))]))])])]))])])])])])])]);
|
|
10105
|
+
}, monthItemSlots)])])])])])]);
|
|
8975
10106
|
};
|
|
8976
10107
|
}
|
|
8977
10108
|
});
|
|
@@ -9912,14 +11043,14 @@ function useYearCalendarPanel(props, ctx) {
|
|
|
9912
11043
|
const goToShowYear = (date4) => {
|
|
9913
11044
|
if (date4) {
|
|
9914
11045
|
const index2 = Math.floor((date4.year() - calendarRange.value[0]) / 3);
|
|
9915
|
-
let
|
|
9916
|
-
if (
|
|
9917
|
-
|
|
11046
|
+
let scrollIndex = index2 - 1;
|
|
11047
|
+
if (scrollIndex < 0) {
|
|
11048
|
+
scrollIndex = 0;
|
|
9918
11049
|
}
|
|
9919
11050
|
nextTick(() => {
|
|
9920
11051
|
var _a;
|
|
9921
11052
|
const scrollEl = yarListScrollRef.value;
|
|
9922
|
-
(_a = scrollEl == null ? void 0 : scrollEl.
|
|
11053
|
+
(_a = scrollEl == null ? void 0 : scrollEl.scrollTo) == null ? void 0 : _a.call(scrollEl, scrollIndex);
|
|
9923
11054
|
});
|
|
9924
11055
|
}
|
|
9925
11056
|
};
|
|
@@ -10033,23 +11164,30 @@ var YearCalendarPanel = defineComponent({
|
|
|
10033
11164
|
handlerSelectYear
|
|
10034
11165
|
} = useYearCalendarPanel(props, ctx);
|
|
10035
11166
|
return () => {
|
|
11167
|
+
const yearItemSlots = {
|
|
11168
|
+
item: (years) => {
|
|
11169
|
+
return createVNode("div", {
|
|
11170
|
+
"class": ns2.e("year-list-item")
|
|
11171
|
+
}, [years.map((year) => createVNode("div", {
|
|
11172
|
+
"key": year,
|
|
11173
|
+
"class": getYearItemCls(year),
|
|
11174
|
+
"onClick": (e) => {
|
|
11175
|
+
e.preventDefault();
|
|
11176
|
+
e.stopPropagation();
|
|
11177
|
+
handlerSelectYear(year);
|
|
11178
|
+
}
|
|
11179
|
+
}, [year]))]);
|
|
11180
|
+
}
|
|
11181
|
+
};
|
|
10036
11182
|
return createVNode("div", {
|
|
10037
11183
|
"class": ns2.e("year-calendar-panel")
|
|
10038
|
-
}, [createVNode(
|
|
11184
|
+
}, [createVNode(VirtualList, {
|
|
10039
11185
|
"ref": yarListScrollRef,
|
|
10040
|
-
"class": ns2.e("year-list")
|
|
10041
|
-
|
|
10042
|
-
"
|
|
10043
|
-
"
|
|
10044
|
-
},
|
|
10045
|
-
"key": year,
|
|
10046
|
-
"class": getYearItemCls(year),
|
|
10047
|
-
"onClick": (e) => {
|
|
10048
|
-
e.preventDefault();
|
|
10049
|
-
e.stopPropagation();
|
|
10050
|
-
handlerSelectYear(year);
|
|
10051
|
-
}
|
|
10052
|
-
}, [year]))]))])]);
|
|
11186
|
+
"class": ns2.e("year-list"),
|
|
11187
|
+
"data": yearList.value,
|
|
11188
|
+
"height": yearPickerHeight,
|
|
11189
|
+
"itemHeight": yearCalendarItemHeight
|
|
11190
|
+
}, yearItemSlots)]);
|
|
10053
11191
|
};
|
|
10054
11192
|
}
|
|
10055
11193
|
});
|
|
@@ -10098,25 +11236,25 @@ function useMonthCalendarPanel(props, ctx) {
|
|
|
10098
11236
|
};
|
|
10099
11237
|
const goToYearDate = () => {
|
|
10100
11238
|
updateYearActive();
|
|
10101
|
-
let
|
|
10102
|
-
if (
|
|
10103
|
-
|
|
11239
|
+
let scrollIndex = currentYearIndex.value - 4;
|
|
11240
|
+
if (scrollIndex < 0) {
|
|
11241
|
+
scrollIndex = 0;
|
|
10104
11242
|
}
|
|
10105
11243
|
nextTick(() => {
|
|
10106
11244
|
var _a;
|
|
10107
11245
|
const scrollEl = yearScrollRef.value;
|
|
10108
|
-
(_a = scrollEl == null ? void 0 : scrollEl.
|
|
11246
|
+
(_a = scrollEl == null ? void 0 : scrollEl.scrollTo) == null ? void 0 : _a.call(scrollEl, scrollIndex);
|
|
10109
11247
|
});
|
|
10110
11248
|
};
|
|
10111
11249
|
const goToMonthDate = () => {
|
|
10112
|
-
let
|
|
10113
|
-
if (
|
|
10114
|
-
|
|
11250
|
+
let scrollIndex = currentYearIndex.value;
|
|
11251
|
+
if (scrollIndex < 0) {
|
|
11252
|
+
scrollIndex = 0;
|
|
10115
11253
|
}
|
|
10116
11254
|
nextTick(() => {
|
|
10117
11255
|
var _a;
|
|
10118
11256
|
const scrollEl = monthScrollRef.value;
|
|
10119
|
-
(_a = scrollEl == null ? void 0 : scrollEl.
|
|
11257
|
+
(_a = scrollEl == null ? void 0 : scrollEl.scrollTo) == null ? void 0 : _a.call(scrollEl, scrollIndex);
|
|
10120
11258
|
});
|
|
10121
11259
|
};
|
|
10122
11260
|
const goToShowDate = (date4) => {
|
|
@@ -10127,11 +11265,7 @@ function useMonthCalendarPanel(props, ctx) {
|
|
|
10127
11265
|
};
|
|
10128
11266
|
onBeforeMount(() => {
|
|
10129
11267
|
today.value = new Date();
|
|
10130
|
-
|
|
10131
|
-
calendarRange.value = props.calendarRange;
|
|
10132
|
-
} else {
|
|
10133
|
-
calendarRange.value = [today.value.getFullYear() - 25, today.value.getFullYear() + 25];
|
|
10134
|
-
}
|
|
11268
|
+
calendarRange.value = props.calendarRange;
|
|
10135
11269
|
initYearList();
|
|
10136
11270
|
const toDate = getToDate(props.dateValue);
|
|
10137
11271
|
if (props.visible && toDate) {
|
|
@@ -10139,7 +11273,8 @@ function useMonthCalendarPanel(props, ctx) {
|
|
|
10139
11273
|
}
|
|
10140
11274
|
});
|
|
10141
11275
|
const handlerSelectYear = (year) => {
|
|
10142
|
-
|
|
11276
|
+
const toDate = dayjs(new Date(year, 0, 1)).locale("zh-cn");
|
|
11277
|
+
goToShowDate(toDate);
|
|
10143
11278
|
};
|
|
10144
11279
|
const debounceScrollMonth = lodash.exports.throttle((newScrollTop) => {
|
|
10145
11280
|
currentYearIndex.value = Math.floor(newScrollTop / monthCalendarItemHeight) + (newScrollTop % monthCalendarItemHeight > 100 ? 1 : 0);
|
|
@@ -10258,40 +11393,54 @@ var MonthCalendarPanel = defineComponent({
|
|
|
10258
11393
|
handlerSelectMonth
|
|
10259
11394
|
} = useMonthCalendarPanel(props, ctx);
|
|
10260
11395
|
return () => {
|
|
11396
|
+
const yearItemSlots = {
|
|
11397
|
+
item: (year) => {
|
|
11398
|
+
return createVNode("div", {
|
|
11399
|
+
"class": [ns2.e("year-list-item"), year.active && ns2.e("year-item-active")],
|
|
11400
|
+
"key": year.year,
|
|
11401
|
+
"onClick": () => handlerSelectYear(year.year)
|
|
11402
|
+
}, [year.year]);
|
|
11403
|
+
}
|
|
11404
|
+
};
|
|
11405
|
+
const monthItemSlots = {
|
|
11406
|
+
item: (year) => {
|
|
11407
|
+
return createVNode("div", {
|
|
11408
|
+
"class": ns2.e("table-month")
|
|
11409
|
+
}, [createVNode("div", {
|
|
11410
|
+
"class": ns2.e("table-month-title")
|
|
11411
|
+
}, [year.year + t("year")]), createVNode("table", {
|
|
11412
|
+
"class": ns2.e("table-month-content")
|
|
11413
|
+
}, [createVNode("tbody", null, [monthList.map((season, seasonIndex) => createVNode("tr", {
|
|
11414
|
+
"key": seasonIndex
|
|
11415
|
+
}, [season.map((month) => createVNode("td", {
|
|
11416
|
+
"key": month,
|
|
11417
|
+
"class": getMonthItemCls(year.year, month),
|
|
11418
|
+
"onClick": (e) => {
|
|
11419
|
+
e.preventDefault();
|
|
11420
|
+
e.stopPropagation();
|
|
11421
|
+
handlerSelectMonth(year.year, month);
|
|
11422
|
+
}
|
|
11423
|
+
}, [createVNode("span", null, [t(`month${month}`) || "m"])]))]))])])]);
|
|
11424
|
+
}
|
|
11425
|
+
};
|
|
10261
11426
|
return createVNode("div", {
|
|
10262
11427
|
"class": ns2.e("month-calendar-panel")
|
|
10263
|
-
}, [createVNode(
|
|
11428
|
+
}, [createVNode(VirtualList, {
|
|
10264
11429
|
"ref": yearScrollRef,
|
|
10265
|
-
"class": ns2.e("year-list")
|
|
10266
|
-
|
|
10267
|
-
"
|
|
10268
|
-
"
|
|
10269
|
-
|
|
10270
|
-
}, [year.year]))]), createVNode("div", {
|
|
11430
|
+
"class": ns2.e("year-list"),
|
|
11431
|
+
"data": yearList.value,
|
|
11432
|
+
"height": monthPickerHeight,
|
|
11433
|
+
"itemHeight": yearItemHeight
|
|
11434
|
+
}, yearItemSlots), createVNode("div", {
|
|
10271
11435
|
"class": ns2.e("month-wrapper")
|
|
10272
|
-
}, [createVNode(
|
|
10273
|
-
"class": ns2.e("month-list"),
|
|
11436
|
+
}, [createVNode(VirtualList, {
|
|
10274
11437
|
"ref": monthScrollRef,
|
|
10275
|
-
"
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
"
|
|
10280
|
-
},
|
|
10281
|
-
"class": ns2.e("table-month-title")
|
|
10282
|
-
}, [year.year + t("year")]), createVNode("table", {
|
|
10283
|
-
"class": ns2.e("table-month-content")
|
|
10284
|
-
}, [createVNode("tbody", null, [monthList.map((season, seasonIndex) => createVNode("tr", {
|
|
10285
|
-
"key": seasonIndex
|
|
10286
|
-
}, [season.map((month) => createVNode("td", {
|
|
10287
|
-
"key": month,
|
|
10288
|
-
"class": getMonthItemCls(year.year, month),
|
|
10289
|
-
"onClick": (e) => {
|
|
10290
|
-
e.preventDefault();
|
|
10291
|
-
e.stopPropagation();
|
|
10292
|
-
handlerSelectMonth(year.year, month);
|
|
10293
|
-
}
|
|
10294
|
-
}, [createVNode("span", null, [t(`month${month}`) || ""])]))]))])])]))])])]);
|
|
11438
|
+
"class": ns2.e("month-list"),
|
|
11439
|
+
"data": yearList.value,
|
|
11440
|
+
"height": monthPickerHeight,
|
|
11441
|
+
"itemHeight": monthCalendarItemHeight,
|
|
11442
|
+
"onScroll": handlerMonthScroll
|
|
11443
|
+
}, monthItemSlots)])]);
|
|
10295
11444
|
};
|
|
10296
11445
|
}
|
|
10297
11446
|
});
|