2234 lines
78 KiB
JavaScript
2234 lines
78 KiB
JavaScript
import {
|
|
ElScrollbar
|
|
} from "./chunk-SY5SN5AU.js";
|
|
import {
|
|
Ee,
|
|
ElTooltip,
|
|
useTooltipContentProps
|
|
} from "./chunk-7F6Y7TML.js";
|
|
import {
|
|
vRepeatClick
|
|
} from "./chunk-SMVFL2UA.js";
|
|
import {
|
|
EVENT_CODE,
|
|
getEventCode
|
|
} from "./chunk-BUVJOKYK.js";
|
|
import {
|
|
ElInput,
|
|
useAttrs as useAttrs2
|
|
} from "./chunk-G7ZFAANB.js";
|
|
import {
|
|
useFocusController
|
|
} from "./chunk-6KKRONM6.js";
|
|
import {
|
|
useEmptyValues,
|
|
useEmptyValuesProps
|
|
} from "./chunk-22HKH5YS.js";
|
|
import {
|
|
useLocale
|
|
} from "./chunk-APPTXKCZ.js";
|
|
import {
|
|
ElIcon,
|
|
getStyle
|
|
} from "./chunk-3DJYPQW6.js";
|
|
import {
|
|
CHANGE_EVENT,
|
|
UPDATE_MODEL_EVENT,
|
|
useAriaProps
|
|
} from "./chunk-6VHTGKN7.js";
|
|
import {
|
|
useFormItem,
|
|
useFormItemInputId
|
|
} from "./chunk-DIGHH22S.js";
|
|
import {
|
|
onClickOutside,
|
|
unrefElement,
|
|
useFormDisabled,
|
|
useFormSize,
|
|
useSizeProp
|
|
} from "./chunk-FYPMSKES.js";
|
|
import {
|
|
debugWarn,
|
|
isEmpty,
|
|
isNumber,
|
|
isUndefined
|
|
} from "./chunk-UFIWN4M6.js";
|
|
import {
|
|
_export_sfc
|
|
} from "./chunk-MUJDDH7P.js";
|
|
import {
|
|
buildProps,
|
|
debounce_default,
|
|
definePropType,
|
|
isEqual_default,
|
|
union_default,
|
|
useNamespace,
|
|
withInstall
|
|
} from "./chunk-R2OGZABH.js";
|
|
import {
|
|
require_dayjs_min
|
|
} from "./chunk-YYGDCKLY.js";
|
|
import {
|
|
arrow_down_default,
|
|
arrow_up_default,
|
|
calendar_default,
|
|
circle_close_default,
|
|
clock_default
|
|
} from "./chunk-3C23FNYW.js";
|
|
import {
|
|
Fragment,
|
|
Transition,
|
|
computed,
|
|
createBaseVNode,
|
|
createBlock,
|
|
createCommentVNode,
|
|
createElementBlock,
|
|
createTextVNode,
|
|
createVNode,
|
|
defineComponent,
|
|
inject,
|
|
mergeProps,
|
|
nextTick,
|
|
onBeforeUnmount,
|
|
onMounted,
|
|
openBlock,
|
|
provide,
|
|
reactive,
|
|
ref,
|
|
renderList,
|
|
renderSlot,
|
|
resolveDynamicComponent,
|
|
unref,
|
|
useAttrs,
|
|
watch,
|
|
withCtx,
|
|
withDirectives,
|
|
withModifiers
|
|
} from "./chunk-AAHVYXXY.js";
|
|
import {
|
|
NOOP,
|
|
init_shared_esm_bundler,
|
|
isArray,
|
|
isDate,
|
|
normalizeClass,
|
|
normalizeStyle,
|
|
toDisplayString
|
|
} from "./chunk-OWZYVOTZ.js";
|
|
import {
|
|
__commonJS,
|
|
__toESM
|
|
} from "./chunk-V4OQ3NZ2.js";
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js
|
|
var require_customParseFormat = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js"(exports, module) {
|
|
!function(e, t) {
|
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
|
|
return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
|
|
};
|
|
var f = function(e2) {
|
|
return function(t2) {
|
|
this[e2] = +t2;
|
|
};
|
|
}, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
|
|
(this.zone || (this.zone = {})).offset = function(e3) {
|
|
if (!e3) return 0;
|
|
if ("Z" === e3) return 0;
|
|
var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
|
|
return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
|
|
}(e2);
|
|
}], u = function(e2) {
|
|
var t2 = s[e2];
|
|
return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
|
|
}, d = function(e2, t2) {
|
|
var n2, r2 = s.meridiem;
|
|
if (r2) {
|
|
for (var i2 = 1; i2 <= 24; i2 += 1) if (e2.indexOf(r2(i2, 0, t2)) > -1) {
|
|
n2 = i2 > 12;
|
|
break;
|
|
}
|
|
} else n2 = e2 === (t2 ? "pm" : "PM");
|
|
return n2;
|
|
}, c = { A: [o, function(e2) {
|
|
this.afternoon = d(e2, false);
|
|
}], a: [o, function(e2) {
|
|
this.afternoon = d(e2, true);
|
|
}], Q: [n, function(e2) {
|
|
this.month = 3 * (e2 - 1) + 1;
|
|
}], S: [n, function(e2) {
|
|
this.milliseconds = 100 * +e2;
|
|
}], SS: [r, function(e2) {
|
|
this.milliseconds = 10 * +e2;
|
|
}], SSS: [/\d{3}/, function(e2) {
|
|
this.milliseconds = +e2;
|
|
}], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
|
|
var t2 = s.ordinal, n2 = e2.match(/\d+/);
|
|
if (this.day = n2[0], t2) for (var r2 = 1; r2 <= 31; r2 += 1) t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
|
|
}], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
|
|
var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
|
|
return e3.slice(0, 3);
|
|
})).indexOf(e2) + 1;
|
|
if (n2 < 1) throw new Error();
|
|
this.month = n2 % 12 || n2;
|
|
}], MMMM: [o, function(e2) {
|
|
var t2 = u("months").indexOf(e2) + 1;
|
|
if (t2 < 1) throw new Error();
|
|
this.month = t2 % 12 || t2;
|
|
}], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
|
|
this.year = a(e2);
|
|
}], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
|
|
function l(n2) {
|
|
var r2, i2;
|
|
r2 = n2, i2 = s && s.formats;
|
|
for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
|
|
var o3 = r3 && r3.toUpperCase();
|
|
return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
|
|
return t3 || n4.slice(1);
|
|
});
|
|
})).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
|
|
var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
|
|
o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
|
|
}
|
|
return function(e2) {
|
|
for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
|
|
var i3 = o2[n3];
|
|
if ("string" == typeof i3) r3 += i3.length;
|
|
else {
|
|
var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
|
|
f3.call(t2, u3), e2 = e2.replace(u3, "");
|
|
}
|
|
}
|
|
return function(e3) {
|
|
var t3 = e3.afternoon;
|
|
if (void 0 !== t3) {
|
|
var n4 = e3.hours;
|
|
t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
|
|
}
|
|
}(t2), t2;
|
|
};
|
|
}
|
|
return function(e2, t2, n2) {
|
|
n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
|
|
var r2 = t2.prototype, i2 = r2.parse;
|
|
r2.parse = function(e3) {
|
|
var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
|
|
this.$u = r3;
|
|
var a2 = o2[1];
|
|
if ("string" == typeof a2) {
|
|
var f2 = true === o2[2], h2 = true === o2[3], u2 = f2 || h2, d2 = o2[2];
|
|
h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
|
|
try {
|
|
if (["x", "X"].indexOf(t4) > -1) return new Date(("X" === t4 ? 1e3 : 1) * e4);
|
|
var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = /* @__PURE__ */ new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
|
|
o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
|
|
var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
|
|
return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
|
|
} catch (e5) {
|
|
return /* @__PURE__ */ new Date("");
|
|
}
|
|
}(t3, a2, r3, n2), this.init(), d2 && true !== d2 && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
|
|
} else if (a2 instanceof Array) for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
|
|
o2[1] = a2[m - 1];
|
|
var M = n2.apply(this, o2);
|
|
if (M.isValid()) {
|
|
this.$d = M.$d, this.$L = M.$L, this.init();
|
|
break;
|
|
}
|
|
m === c2 && (this.$d = /* @__PURE__ */ new Date(""));
|
|
}
|
|
else i2.call(this, e3);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker.mjs
|
|
var import_dayjs4 = __toESM(require_dayjs_min(), 1);
|
|
var import_customParseFormat = __toESM(require_customParseFormat(), 1);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/constants.mjs
|
|
var timeUnits = ["hours", "minutes", "seconds"];
|
|
var PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
|
|
var PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
|
|
var ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
|
|
var DEFAULT_FORMATS_TIME = "HH:mm:ss";
|
|
var DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
|
|
var DEFAULT_FORMATS_DATEPICKER = {
|
|
date: DEFAULT_FORMATS_DATE,
|
|
dates: DEFAULT_FORMATS_DATE,
|
|
week: "gggg[w]ww",
|
|
year: "YYYY",
|
|
years: "YYYY",
|
|
month: "YYYY-MM",
|
|
months: "YYYY-MM",
|
|
datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
|
|
monthrange: "YYYY-MM",
|
|
yearrange: "YYYY",
|
|
daterange: DEFAULT_FORMATS_DATE,
|
|
datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/utils.mjs
|
|
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
init_shared_esm_bundler();
|
|
var buildTimeList = (value, bound) => {
|
|
return [
|
|
value > 0 ? value - 1 : void 0,
|
|
value,
|
|
value < bound ? value + 1 : void 0
|
|
];
|
|
};
|
|
var rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
|
|
var extractDateFormat = (format) => {
|
|
return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
|
|
};
|
|
var extractTimeFormat = (format) => {
|
|
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
|
|
};
|
|
var dateEquals = function(a, b) {
|
|
const aIsDate = isDate(a);
|
|
const bIsDate = isDate(b);
|
|
if (aIsDate && bIsDate) {
|
|
return a.getTime() === b.getTime();
|
|
}
|
|
if (!aIsDate && !bIsDate) {
|
|
return a === b;
|
|
}
|
|
return false;
|
|
};
|
|
var valueEquals = function(a, b) {
|
|
const aIsArray = isArray(a);
|
|
const bIsArray = isArray(b);
|
|
if (aIsArray && bIsArray) {
|
|
if (a.length !== b.length) {
|
|
return false;
|
|
}
|
|
return a.every((item, index) => dateEquals(item, b[index]));
|
|
}
|
|
if (!aIsArray && !bIsArray) {
|
|
return dateEquals(a, b);
|
|
}
|
|
return false;
|
|
};
|
|
var parseDate = function(date, format, lang) {
|
|
const day = isEmpty(format) || format === "x" ? (0, import_dayjs.default)(date).locale(lang) : (0, import_dayjs.default)(date, format).locale(lang);
|
|
return day.isValid() ? day : void 0;
|
|
};
|
|
var formatter = function(date, format, lang) {
|
|
if (isEmpty(format))
|
|
return date;
|
|
if (format === "x")
|
|
return +date;
|
|
return (0, import_dayjs.default)(date).locale(lang).format(format);
|
|
};
|
|
var makeList = (total, method) => {
|
|
var _a;
|
|
const arr = [];
|
|
const disabledArr = method == null ? void 0 : method();
|
|
for (let i = 0; i < total; i++) {
|
|
arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
|
|
}
|
|
return arr;
|
|
};
|
|
var dayOrDaysToDate = (dayOrDays) => {
|
|
return isArray(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/composables/use-common-picker.mjs
|
|
init_shared_esm_bundler();
|
|
var useCommonPicker = (props, emit) => {
|
|
const { lang } = useLocale();
|
|
const pickerVisible = ref(false);
|
|
const pickerActualVisible = ref(false);
|
|
const userInput = ref(null);
|
|
const valueIsEmpty = computed(() => {
|
|
const { modelValue } = props;
|
|
return !modelValue || isArray(modelValue) && !modelValue.filter(Boolean).length;
|
|
});
|
|
const emitInput = (input) => {
|
|
if (!valueEquals(props.modelValue, input)) {
|
|
let formatted;
|
|
if (isArray(input)) {
|
|
formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
|
|
} else if (input) {
|
|
formatted = formatter(input, props.valueFormat, lang.value);
|
|
}
|
|
const emitVal = input ? formatted : input;
|
|
emit(UPDATE_MODEL_EVENT, emitVal, lang.value);
|
|
}
|
|
};
|
|
const parsedValue = computed(() => {
|
|
var _a;
|
|
let dayOrDays;
|
|
if (valueIsEmpty.value) {
|
|
if (pickerOptions.value.getDefaultValue) {
|
|
dayOrDays = pickerOptions.value.getDefaultValue();
|
|
}
|
|
} else {
|
|
if (isArray(props.modelValue)) {
|
|
dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
|
|
} else {
|
|
dayOrDays = parseDate((_a = props.modelValue) != null ? _a : "", props.valueFormat, lang.value);
|
|
}
|
|
}
|
|
if (pickerOptions.value.getRangeAvailableTime) {
|
|
const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
|
|
if (!isEqual_default(availableResult, dayOrDays)) {
|
|
dayOrDays = availableResult;
|
|
if (!valueIsEmpty.value) {
|
|
emitInput(dayOrDaysToDate(dayOrDays));
|
|
}
|
|
}
|
|
}
|
|
if (isArray(dayOrDays) && dayOrDays.some((day) => !day)) {
|
|
dayOrDays = [];
|
|
}
|
|
return dayOrDays;
|
|
});
|
|
const pickerOptions = ref({});
|
|
const onSetPickerOption = (e) => {
|
|
pickerOptions.value[e[0]] = e[1];
|
|
pickerOptions.value.panelReady = true;
|
|
};
|
|
const onCalendarChange = (e) => {
|
|
emit("calendar-change", e);
|
|
};
|
|
const onPanelChange = (value, mode, view) => {
|
|
emit("panel-change", value, mode, view);
|
|
};
|
|
const onPick = (date = "", visible = false) => {
|
|
pickerVisible.value = visible;
|
|
let result;
|
|
if (isArray(date)) {
|
|
result = date.map((_) => _.toDate());
|
|
} else {
|
|
result = date ? date.toDate() : date;
|
|
}
|
|
userInput.value = null;
|
|
emitInput(result);
|
|
};
|
|
return {
|
|
parsedValue,
|
|
pickerActualVisible,
|
|
pickerOptions,
|
|
pickerVisible,
|
|
userInput,
|
|
valueIsEmpty,
|
|
emitInput,
|
|
onCalendarChange,
|
|
onPanelChange,
|
|
onPick,
|
|
onSetPickerOption
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/props/shared.mjs
|
|
var disabledTimeListsProps = buildProps({
|
|
disabledHours: {
|
|
type: definePropType(Function)
|
|
},
|
|
disabledMinutes: {
|
|
type: definePropType(Function)
|
|
},
|
|
disabledSeconds: {
|
|
type: definePropType(Function)
|
|
}
|
|
});
|
|
var timePanelSharedProps = buildProps({
|
|
visible: Boolean,
|
|
actualVisible: {
|
|
type: Boolean,
|
|
default: void 0
|
|
},
|
|
format: {
|
|
type: String,
|
|
default: ""
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/common/props.mjs
|
|
var timePickerDefaultProps = buildProps({
|
|
automaticDropdown: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
id: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
name: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
popperClass: useTooltipContentProps.popperClass,
|
|
popperStyle: useTooltipContentProps.popperStyle,
|
|
format: String,
|
|
valueFormat: String,
|
|
dateFormat: String,
|
|
timeFormat: String,
|
|
type: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
clearable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
clearIcon: {
|
|
type: definePropType([String, Object]),
|
|
default: circle_close_default
|
|
},
|
|
editable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
prefixIcon: {
|
|
type: definePropType([String, Object]),
|
|
default: ""
|
|
},
|
|
size: useSizeProp,
|
|
readonly: Boolean,
|
|
disabled: Boolean,
|
|
placeholder: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
popperOptions: {
|
|
type: definePropType(Object),
|
|
default: () => ({})
|
|
},
|
|
modelValue: {
|
|
type: definePropType([Date, Array, String, Number]),
|
|
default: ""
|
|
},
|
|
rangeSeparator: {
|
|
type: String,
|
|
default: "-"
|
|
},
|
|
startPlaceholder: String,
|
|
endPlaceholder: String,
|
|
defaultValue: {
|
|
type: definePropType([Date, Array])
|
|
},
|
|
defaultTime: {
|
|
type: definePropType([Date, Array])
|
|
},
|
|
isRange: Boolean,
|
|
...disabledTimeListsProps,
|
|
disabledDate: {
|
|
type: Function
|
|
},
|
|
cellClassName: {
|
|
type: Function
|
|
},
|
|
shortcuts: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
arrowControl: Boolean,
|
|
tabindex: {
|
|
type: definePropType([String, Number]),
|
|
default: 0
|
|
},
|
|
validateEvent: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
unlinkPanels: Boolean,
|
|
placement: {
|
|
type: definePropType(String),
|
|
values: Ee,
|
|
default: "bottom"
|
|
},
|
|
fallbackPlacements: {
|
|
type: definePropType(Array),
|
|
default: ["bottom", "top", "right", "left"]
|
|
},
|
|
...useEmptyValuesProps,
|
|
...useAriaProps(["ariaLabel"]),
|
|
showNow: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showConfirm: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showFooter: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showWeekNumber: Boolean
|
|
});
|
|
var timePickerRangeTriggerProps = buildProps({
|
|
id: {
|
|
type: definePropType(Array)
|
|
},
|
|
name: {
|
|
type: definePropType(Array)
|
|
},
|
|
modelValue: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
startPlaceholder: String,
|
|
endPlaceholder: String,
|
|
disabled: Boolean
|
|
});
|
|
var timePickerRngeTriggerProps = timePickerRangeTriggerProps;
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/common/picker-range-trigger.mjs
|
|
var __default__ = defineComponent({
|
|
name: "PickerRangeTrigger",
|
|
inheritAttrs: false
|
|
});
|
|
var _sfc_main = defineComponent({
|
|
...__default__,
|
|
props: timePickerRangeTriggerProps,
|
|
emits: [
|
|
"mouseenter",
|
|
"mouseleave",
|
|
"click",
|
|
"touchstart",
|
|
"focus",
|
|
"blur",
|
|
"startInput",
|
|
"endInput",
|
|
"startChange",
|
|
"endChange"
|
|
],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const { formItem } = useFormItem();
|
|
const { inputId } = useFormItemInputId(reactive({ id: computed(() => {
|
|
var _a;
|
|
return (_a = props.id) == null ? void 0 : _a[0];
|
|
}) }), {
|
|
formItemContext: formItem
|
|
});
|
|
const attrs = useAttrs2();
|
|
const nsDate = useNamespace("date");
|
|
const nsRange = useNamespace("range");
|
|
const inputRef = ref();
|
|
const endInputRef = ref();
|
|
const { wrapperRef, isFocused } = useFocusController(inputRef, {
|
|
disabled: computed(() => props.disabled)
|
|
});
|
|
const handleClick = (evt) => {
|
|
emit("click", evt);
|
|
};
|
|
const handleMouseEnter = (evt) => {
|
|
emit("mouseenter", evt);
|
|
};
|
|
const handleMouseLeave = (evt) => {
|
|
emit("mouseleave", evt);
|
|
};
|
|
const handleTouchStart = (evt) => {
|
|
emit("touchstart", evt);
|
|
};
|
|
const handleStartInput = (evt) => {
|
|
emit("startInput", evt);
|
|
};
|
|
const handleEndInput = (evt) => {
|
|
emit("endInput", evt);
|
|
};
|
|
const handleStartChange = (evt) => {
|
|
emit("startChange", evt);
|
|
};
|
|
const handleEndChange = (evt) => {
|
|
emit("endChange", evt);
|
|
};
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const blur = () => {
|
|
var _a, _b;
|
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
(_b = endInputRef.value) == null ? void 0 : _b.blur();
|
|
};
|
|
expose({
|
|
focus,
|
|
blur
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
ref_key: "wrapperRef",
|
|
ref: wrapperRef,
|
|
class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
onClick: handleClick,
|
|
onMouseenter: handleMouseEnter,
|
|
onMouseleave: handleMouseLeave,
|
|
onTouchstartPassive: handleTouchStart
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prefix"),
|
|
createBaseVNode("input", mergeProps(unref(attrs), {
|
|
id: unref(inputId),
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
name: _ctx.name && _ctx.name[0],
|
|
placeholder: _ctx.startPlaceholder,
|
|
value: _ctx.modelValue && _ctx.modelValue[0],
|
|
class: unref(nsRange).b("input"),
|
|
disabled: _ctx.disabled,
|
|
onInput: handleStartInput,
|
|
onChange: handleStartChange
|
|
}), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
|
|
renderSlot(_ctx.$slots, "range-separator"),
|
|
createBaseVNode("input", mergeProps(unref(attrs), {
|
|
id: _ctx.id && _ctx.id[1],
|
|
ref_key: "endInputRef",
|
|
ref: endInputRef,
|
|
name: _ctx.name && _ctx.name[1],
|
|
placeholder: _ctx.endPlaceholder,
|
|
value: _ctx.modelValue && _ctx.modelValue[1],
|
|
class: unref(nsRange).b("input"),
|
|
disabled: _ctx.disabled,
|
|
onInput: handleEndInput,
|
|
onChange: handleEndChange
|
|
}), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
|
|
renderSlot(_ctx.$slots, "suffix")
|
|
], 38);
|
|
};
|
|
}
|
|
});
|
|
var PickerRangeTrigger = _export_sfc(_sfc_main, [["__file", "picker-range-trigger.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/common/picker.mjs
|
|
init_shared_esm_bundler();
|
|
var __default__2 = defineComponent({
|
|
name: "Picker"
|
|
});
|
|
var _sfc_main2 = defineComponent({
|
|
...__default__2,
|
|
props: timePickerDefaultProps,
|
|
emits: [
|
|
UPDATE_MODEL_EVENT,
|
|
CHANGE_EVENT,
|
|
"focus",
|
|
"blur",
|
|
"clear",
|
|
"calendar-change",
|
|
"panel-change",
|
|
"visible-change",
|
|
"keydown"
|
|
],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const attrs = useAttrs();
|
|
const nsDate = useNamespace("date");
|
|
const nsInput = useNamespace("input");
|
|
const nsRange = useNamespace("range");
|
|
const { formItem } = useFormItem();
|
|
const elPopperOptions = inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
|
|
const emptyValues = useEmptyValues(props, null);
|
|
const refPopper = ref();
|
|
const inputRef = ref();
|
|
const valueOnOpen = ref(null);
|
|
let hasJustTabExitedInput = false;
|
|
const pickerDisabled = useFormDisabled();
|
|
const commonPicker = useCommonPicker(props, emit);
|
|
const {
|
|
parsedValue,
|
|
pickerActualVisible,
|
|
userInput,
|
|
pickerVisible,
|
|
pickerOptions,
|
|
valueIsEmpty,
|
|
emitInput,
|
|
onPick,
|
|
onSetPickerOption,
|
|
onCalendarChange,
|
|
onPanelChange
|
|
} = commonPicker;
|
|
const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
|
|
disabled: pickerDisabled,
|
|
beforeFocus() {
|
|
return props.readonly;
|
|
},
|
|
afterFocus() {
|
|
if (!props.automaticDropdown)
|
|
return;
|
|
pickerVisible.value = true;
|
|
},
|
|
beforeBlur(event) {
|
|
var _a;
|
|
return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
|
|
},
|
|
afterBlur() {
|
|
handleChange();
|
|
pickerVisible.value = false;
|
|
hasJustTabExitedInput = false;
|
|
props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn(err)));
|
|
}
|
|
});
|
|
const hovering = ref(false);
|
|
const rangeInputKls = computed(() => [
|
|
nsDate.b("editor"),
|
|
nsDate.bm("editor", props.type),
|
|
nsInput.e("wrapper"),
|
|
nsDate.is("disabled", pickerDisabled.value),
|
|
nsDate.is("active", pickerVisible.value),
|
|
nsRange.b("editor"),
|
|
pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
|
|
attrs.class
|
|
]);
|
|
const clearIconKls = computed(() => [
|
|
nsInput.e("icon"),
|
|
nsRange.e("close-icon"),
|
|
!showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
|
|
]);
|
|
watch(pickerVisible, (val) => {
|
|
if (!val) {
|
|
userInput.value = null;
|
|
nextTick(() => {
|
|
emitChange(props.modelValue);
|
|
});
|
|
} else {
|
|
nextTick(() => {
|
|
if (val) {
|
|
valueOnOpen.value = props.modelValue;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
const emitChange = (val, isClear) => {
|
|
if (isClear || !valueEquals(val, valueOnOpen.value)) {
|
|
emit(CHANGE_EVENT, val);
|
|
isClear && (valueOnOpen.value = val);
|
|
props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err)));
|
|
}
|
|
};
|
|
const emitKeydown = (e) => {
|
|
emit("keydown", e);
|
|
};
|
|
const refInput = computed(() => {
|
|
if (inputRef.value) {
|
|
return Array.from(inputRef.value.$el.querySelectorAll("input"));
|
|
}
|
|
return [];
|
|
});
|
|
const setSelectionRange = (start, end, pos) => {
|
|
const _inputs = refInput.value;
|
|
if (!_inputs.length)
|
|
return;
|
|
if (!pos || pos === "min") {
|
|
_inputs[0].setSelectionRange(start, end);
|
|
_inputs[0].focus();
|
|
} else if (pos === "max") {
|
|
_inputs[1].setSelectionRange(start, end);
|
|
_inputs[1].focus();
|
|
}
|
|
};
|
|
const onBeforeShow = () => {
|
|
pickerActualVisible.value = true;
|
|
};
|
|
const onShow = () => {
|
|
emit("visible-change", true);
|
|
};
|
|
const onHide = () => {
|
|
pickerActualVisible.value = false;
|
|
pickerVisible.value = false;
|
|
emit("visible-change", false);
|
|
};
|
|
const handleOpen = () => {
|
|
pickerVisible.value = true;
|
|
};
|
|
const handleClose = () => {
|
|
pickerVisible.value = false;
|
|
};
|
|
const displayValue = computed(() => {
|
|
const formattedValue = formatToString(parsedValue.value);
|
|
if (isArray(userInput.value)) {
|
|
return [
|
|
userInput.value[0] || formattedValue && formattedValue[0] || "",
|
|
userInput.value[1] || formattedValue && formattedValue[1] || ""
|
|
];
|
|
} else if (userInput.value !== null) {
|
|
return userInput.value;
|
|
}
|
|
if (!isTimePicker.value && valueIsEmpty.value)
|
|
return "";
|
|
if (!pickerVisible.value && valueIsEmpty.value)
|
|
return "";
|
|
if (formattedValue) {
|
|
return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
|
|
}
|
|
return "";
|
|
});
|
|
const isTimeLikePicker = computed(() => props.type.includes("time"));
|
|
const isTimePicker = computed(() => props.type.startsWith("time"));
|
|
const isDatesPicker = computed(() => props.type === "dates");
|
|
const isMonthsPicker = computed(() => props.type === "months");
|
|
const isYearsPicker = computed(() => props.type === "years");
|
|
const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
|
|
const showClearBtn = computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
|
|
const onClearIconClick = (event) => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (showClearBtn.value) {
|
|
event.stopPropagation();
|
|
if (pickerOptions.value.handleClear) {
|
|
pickerOptions.value.handleClear();
|
|
} else {
|
|
emitInput(emptyValues.valueOnClear.value);
|
|
}
|
|
emitChange(emptyValues.valueOnClear.value, true);
|
|
onHide();
|
|
}
|
|
emit("clear");
|
|
};
|
|
const onMouseDownInput = async (event) => {
|
|
var _a;
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const onMouseEnter = () => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (!valueIsEmpty.value && props.clearable) {
|
|
hovering.value = true;
|
|
}
|
|
};
|
|
const onMouseLeave = () => {
|
|
hovering.value = false;
|
|
};
|
|
const onTouchStartInput = (event) => {
|
|
var _a;
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const isRangeInput = computed(() => {
|
|
return props.type.includes("range");
|
|
});
|
|
const pickerSize = useFormSize();
|
|
const popperEl = computed(() => {
|
|
var _a, _b;
|
|
return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
|
|
});
|
|
const stophandle = onClickOutside(inputRef, (e) => {
|
|
const unrefedPopperEl = unref(popperEl);
|
|
const inputEl = unrefElement(inputRef);
|
|
if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
|
|
return;
|
|
pickerVisible.value = false;
|
|
});
|
|
onBeforeUnmount(() => {
|
|
stophandle == null ? void 0 : stophandle();
|
|
});
|
|
const handleChange = () => {
|
|
if (userInput.value) {
|
|
const value = parseUserInputToDayjs(displayValue.value);
|
|
if (value) {
|
|
if (isValidValue(value)) {
|
|
emitInput(dayOrDaysToDate(value));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
}
|
|
if (userInput.value === "") {
|
|
emitInput(emptyValues.valueOnClear.value);
|
|
emitChange(emptyValues.valueOnClear.value, true);
|
|
userInput.value = null;
|
|
}
|
|
};
|
|
const parseUserInputToDayjs = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return pickerOptions.value.parseUserInput(value);
|
|
};
|
|
const formatToString = (value) => {
|
|
if (!value)
|
|
return null;
|
|
const res = isArray(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
|
|
return res;
|
|
};
|
|
const isValidValue = (value) => {
|
|
return pickerOptions.value.isValidValue(value);
|
|
};
|
|
const handleKeydownInput = async (event) => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
const code = getEventCode(event);
|
|
emitKeydown(event);
|
|
if (code === EVENT_CODE.esc) {
|
|
if (pickerVisible.value === true) {
|
|
pickerVisible.value = false;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
return;
|
|
}
|
|
if (code === EVENT_CODE.down) {
|
|
if (pickerOptions.value.handleFocusPicker) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
if (pickerVisible.value === false) {
|
|
pickerVisible.value = true;
|
|
await nextTick();
|
|
}
|
|
if (pickerOptions.value.handleFocusPicker) {
|
|
pickerOptions.value.handleFocusPicker();
|
|
return;
|
|
}
|
|
}
|
|
if (code === EVENT_CODE.tab) {
|
|
hasJustTabExitedInput = true;
|
|
return;
|
|
}
|
|
if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
|
|
if (!pickerVisible.value) {
|
|
pickerVisible.value = true;
|
|
} else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
|
|
handleChange();
|
|
pickerVisible.value = false;
|
|
}
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
if (userInput.value) {
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
if (pickerOptions.value.handleKeydownInput) {
|
|
pickerOptions.value.handleKeydownInput(event);
|
|
}
|
|
};
|
|
const onUserInput = (e) => {
|
|
userInput.value = e;
|
|
if (!pickerVisible.value) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const handleStartInput = (event) => {
|
|
const target = event.target;
|
|
if (userInput.value) {
|
|
userInput.value = [target.value, userInput.value[1]];
|
|
} else {
|
|
userInput.value = [target.value, null];
|
|
}
|
|
};
|
|
const handleEndInput = (event) => {
|
|
const target = event.target;
|
|
if (userInput.value) {
|
|
userInput.value = [userInput.value[0], target.value];
|
|
} else {
|
|
userInput.value = [null, target.value];
|
|
}
|
|
};
|
|
const handleStartChange = () => {
|
|
var _a;
|
|
const values = userInput.value;
|
|
const value = parseUserInputToDayjs(values && values[0]);
|
|
const parsedVal = unref(parsedValue);
|
|
if (value && value.isValid()) {
|
|
userInput.value = [
|
|
formatToString(value),
|
|
((_a = displayValue.value) == null ? void 0 : _a[1]) || null
|
|
];
|
|
const newValue = [value, parsedVal && (parsedVal[1] || null)];
|
|
if (isValidValue(newValue)) {
|
|
emitInput(dayOrDaysToDate(newValue));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
};
|
|
const handleEndChange = () => {
|
|
var _a;
|
|
const values = unref(userInput);
|
|
const value = parseUserInputToDayjs(values && values[1]);
|
|
const parsedVal = unref(parsedValue);
|
|
if (value && value.isValid()) {
|
|
userInput.value = [
|
|
((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
|
|
formatToString(value)
|
|
];
|
|
const newValue = [parsedVal && parsedVal[0], value];
|
|
if (isValidValue(newValue)) {
|
|
emitInput(dayOrDaysToDate(newValue));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
};
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const blur = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
};
|
|
provide(PICKER_BASE_INJECTION_KEY, {
|
|
props,
|
|
emptyValues
|
|
});
|
|
provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
|
|
expose({
|
|
focus,
|
|
blur,
|
|
handleOpen,
|
|
handleClose,
|
|
onPick
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(unref(ElTooltip), mergeProps({
|
|
ref_key: "refPopper",
|
|
ref: refPopper,
|
|
visible: unref(pickerVisible),
|
|
effect: "light",
|
|
pure: "",
|
|
trigger: "click"
|
|
}, _ctx.$attrs, {
|
|
role: "dialog",
|
|
teleported: "",
|
|
transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
|
|
"popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
|
|
"popper-style": _ctx.popperStyle,
|
|
"popper-options": unref(elPopperOptions),
|
|
"fallback-placements": _ctx.fallbackPlacements,
|
|
"gpu-acceleration": false,
|
|
placement: _ctx.placement,
|
|
"stop-popper-mouse-event": false,
|
|
"hide-after": 0,
|
|
persistent: "",
|
|
onBeforeShow,
|
|
onShow,
|
|
onHide
|
|
}), {
|
|
default: withCtx(() => [
|
|
!unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
|
|
key: 0,
|
|
id: _ctx.id,
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
"container-role": "combobox",
|
|
"model-value": unref(displayValue),
|
|
name: _ctx.name,
|
|
size: unref(pickerSize),
|
|
disabled: unref(pickerDisabled),
|
|
placeholder: _ctx.placeholder,
|
|
class: normalizeClass([
|
|
unref(nsDate).b("editor"),
|
|
unref(nsDate).bm("editor", _ctx.type),
|
|
unref(nsDate).is("focus", unref(pickerVisible)),
|
|
_ctx.$attrs.class
|
|
]),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
|
|
"aria-label": _ctx.ariaLabel,
|
|
tabindex: _ctx.tabindex,
|
|
"validate-event": false,
|
|
onInput: onUserInput,
|
|
onFocus: unref(handleFocus),
|
|
onBlur: unref(handleBlur),
|
|
onKeydown: handleKeydownInput,
|
|
onChange: handleChange,
|
|
onMousedown: onMouseDownInput,
|
|
onMouseenter: onMouseEnter,
|
|
onMouseleave: onMouseLeave,
|
|
onTouchstartPassive: onTouchStartInput,
|
|
onClick: withModifiers(() => {
|
|
}, ["stop"])
|
|
}, {
|
|
prefix: withCtx(() => [
|
|
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(unref(nsInput).e("icon")),
|
|
onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
|
|
onTouchstartPassive: onTouchStartInput
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
suffix: withCtx(() => [
|
|
unref(showClearBtn) && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
|
|
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
|
|
onClick: onClearIconClick
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 1
|
|
}, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
|
|
key: 1,
|
|
id: _ctx.id,
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
"model-value": unref(displayValue),
|
|
name: _ctx.name,
|
|
disabled: unref(pickerDisabled),
|
|
readonly: !_ctx.editable || _ctx.readonly,
|
|
"start-placeholder": _ctx.startPlaceholder,
|
|
"end-placeholder": _ctx.endPlaceholder,
|
|
class: normalizeClass(unref(rangeInputKls)),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
"aria-label": _ctx.ariaLabel,
|
|
tabindex: _ctx.tabindex,
|
|
autocomplete: "off",
|
|
role: "combobox",
|
|
onClick: onMouseDownInput,
|
|
onFocus: unref(handleFocus),
|
|
onBlur: unref(handleBlur),
|
|
onStartInput: handleStartInput,
|
|
onStartChange: handleStartChange,
|
|
onEndInput: handleEndInput,
|
|
onEndChange: handleEndChange,
|
|
onMousedown: onMouseDownInput,
|
|
onMouseenter: onMouseEnter,
|
|
onMouseleave: onMouseLeave,
|
|
onTouchstartPassive: onTouchStartInput,
|
|
onKeydown: handleKeydownInput
|
|
}, {
|
|
prefix: withCtx(() => [
|
|
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
"range-separator": withCtx(() => [
|
|
renderSlot(_ctx.$slots, "range-separator", {}, () => [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(nsRange).b("separator"))
|
|
}, toDisplayString(_ctx.rangeSeparator), 3)
|
|
])
|
|
]),
|
|
suffix: withCtx(() => [
|
|
_ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(unref(clearIconKls)),
|
|
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
|
|
onClick: onClearIconClick
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 3
|
|
}, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
|
|
]),
|
|
content: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "default", {
|
|
visible: unref(pickerVisible),
|
|
actualVisible: unref(pickerActualVisible),
|
|
parsedValue: unref(parsedValue),
|
|
format: _ctx.format,
|
|
dateFormat: _ctx.dateFormat,
|
|
timeFormat: _ctx.timeFormat,
|
|
unlinkPanels: _ctx.unlinkPanels,
|
|
type: _ctx.type,
|
|
defaultValue: _ctx.defaultValue,
|
|
showNow: _ctx.showNow,
|
|
showConfirm: _ctx.showConfirm,
|
|
showFooter: _ctx.showFooter,
|
|
showWeekNumber: _ctx.showWeekNumber,
|
|
onPick: unref(onPick),
|
|
onSelectRange: setSelectionRange,
|
|
onSetPickerOption: unref(onSetPickerOption),
|
|
onCalendarChange: unref(onCalendarChange),
|
|
onPanelChange: unref(onPanelChange),
|
|
onMousedown: withModifiers(() => {
|
|
}, ["stop"])
|
|
})
|
|
]),
|
|
_: 3
|
|
}, 16, ["visible", "transition", "popper-class", "popper-style", "popper-options", "fallback-placements", "placement"]);
|
|
};
|
|
}
|
|
});
|
|
var CommonPicker = _export_sfc(_sfc_main2, [["__file", "picker.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker-com/panel-time-pick.mjs
|
|
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/props/panel-time-picker.mjs
|
|
var panelTimePickerProps = buildProps({
|
|
...timePanelSharedProps,
|
|
datetimeRole: String,
|
|
parsedValue: {
|
|
type: definePropType(Object)
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/composables/use-time-panel.mjs
|
|
var useTimePanel = ({
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
}) => {
|
|
const getAvailableTime = (date, role, first, compareDate) => {
|
|
const availableTimeGetters = {
|
|
hour: getAvailableHours,
|
|
minute: getAvailableMinutes,
|
|
second: getAvailableSeconds
|
|
};
|
|
let result = date;
|
|
["hour", "minute", "second"].forEach((type) => {
|
|
if (availableTimeGetters[type]) {
|
|
let availableTimeSlots;
|
|
const method = availableTimeGetters[type];
|
|
switch (type) {
|
|
case "minute": {
|
|
availableTimeSlots = method(result.hour(), role, compareDate);
|
|
break;
|
|
}
|
|
case "second": {
|
|
availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
|
|
break;
|
|
}
|
|
default: {
|
|
availableTimeSlots = method(role, compareDate);
|
|
break;
|
|
}
|
|
}
|
|
if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
|
|
const pos = first ? 0 : availableTimeSlots.length - 1;
|
|
result = result[type](availableTimeSlots[pos]);
|
|
}
|
|
}
|
|
});
|
|
return result;
|
|
};
|
|
const timePickerOptions = {};
|
|
const onSetOption = ([key, val]) => {
|
|
timePickerOptions[key] = val;
|
|
};
|
|
return {
|
|
timePickerOptions,
|
|
getAvailableTime,
|
|
onSetOption
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/composables/use-time-picker.mjs
|
|
var makeAvailableArr = (disabledList) => {
|
|
const trueOrNumber = (isDisabled, index) => isDisabled || index;
|
|
const getNumber = (predicate) => predicate !== true;
|
|
return disabledList.map(trueOrNumber).filter(getNumber);
|
|
};
|
|
var getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
|
|
const getHoursList = (role, compare) => {
|
|
return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
|
|
};
|
|
const getMinutesList = (hour, role, compare) => {
|
|
return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
|
|
};
|
|
const getSecondsList = (hour, minute, role, compare) => {
|
|
return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
|
|
};
|
|
return {
|
|
getHoursList,
|
|
getMinutesList,
|
|
getSecondsList
|
|
};
|
|
};
|
|
var buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
|
|
const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
|
|
const getAvailableHours = (role, compare) => {
|
|
return makeAvailableArr(getHoursList(role, compare));
|
|
};
|
|
const getAvailableMinutes = (hour, role, compare) => {
|
|
return makeAvailableArr(getMinutesList(hour, role, compare));
|
|
};
|
|
const getAvailableSeconds = (hour, minute, role, compare) => {
|
|
return makeAvailableArr(getSecondsList(hour, minute, role, compare));
|
|
};
|
|
return {
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
};
|
|
};
|
|
var useOldValue = (props) => {
|
|
const oldValue = ref(props.parsedValue);
|
|
watch(() => props.visible, (val) => {
|
|
if (!val) {
|
|
oldValue.value = props.parsedValue;
|
|
}
|
|
});
|
|
return oldValue;
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/props/basic-time-spinner.mjs
|
|
var basicTimeSpinnerProps = buildProps({
|
|
role: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
spinnerDate: {
|
|
type: definePropType(Object),
|
|
required: true
|
|
},
|
|
showSeconds: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
arrowControl: Boolean,
|
|
amPmMode: {
|
|
type: definePropType(String),
|
|
default: ""
|
|
},
|
|
...disabledTimeListsProps
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker-com/basic-time-spinner.mjs
|
|
var _sfc_main3 = defineComponent({
|
|
__name: "basic-time-spinner",
|
|
props: basicTimeSpinnerProps,
|
|
emits: [CHANGE_EVENT, "select-range", "set-option"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const { isRange, format } = pickerBase.props;
|
|
const ns = useNamespace("time");
|
|
const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
|
|
let isScrolling = false;
|
|
const currentScrollbar = ref();
|
|
const listHoursRef = ref();
|
|
const listMinutesRef = ref();
|
|
const listSecondsRef = ref();
|
|
const listRefsMap = {
|
|
hours: listHoursRef,
|
|
minutes: listMinutesRef,
|
|
seconds: listSecondsRef
|
|
};
|
|
const spinnerItems = computed(() => {
|
|
return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
|
|
});
|
|
const timePartials = computed(() => {
|
|
const { spinnerDate } = props;
|
|
const hours = spinnerDate.hour();
|
|
const minutes = spinnerDate.minute();
|
|
const seconds = spinnerDate.second();
|
|
return { hours, minutes, seconds };
|
|
});
|
|
const timeList = computed(() => {
|
|
const { hours, minutes } = unref(timePartials);
|
|
const { role, spinnerDate } = props;
|
|
const compare = !isRange ? spinnerDate : void 0;
|
|
return {
|
|
hours: getHoursList(role, compare),
|
|
minutes: getMinutesList(hours, role, compare),
|
|
seconds: getSecondsList(hours, minutes, role, compare)
|
|
};
|
|
});
|
|
const arrowControlTimeList = computed(() => {
|
|
const { hours, minutes, seconds } = unref(timePartials);
|
|
return {
|
|
hours: buildTimeList(hours, 23),
|
|
minutes: buildTimeList(minutes, 59),
|
|
seconds: buildTimeList(seconds, 59)
|
|
};
|
|
});
|
|
const debouncedResetScroll = debounce_default((type) => {
|
|
isScrolling = false;
|
|
adjustCurrentSpinner(type);
|
|
}, 200);
|
|
const getAmPmFlag = (hour) => {
|
|
const shouldShowAmPm = !!props.amPmMode;
|
|
if (!shouldShowAmPm)
|
|
return "";
|
|
const isCapital = props.amPmMode === "A";
|
|
let content = hour < 12 ? " am" : " pm";
|
|
if (isCapital)
|
|
content = content.toUpperCase();
|
|
return content;
|
|
};
|
|
const emitSelectRange = (type) => {
|
|
let range = [0, 0];
|
|
const actualFormat = format || DEFAULT_FORMATS_TIME;
|
|
const hourIndex = actualFormat.indexOf("HH");
|
|
const minuteIndex = actualFormat.indexOf("mm");
|
|
const secondIndex = actualFormat.indexOf("ss");
|
|
switch (type) {
|
|
case "hours":
|
|
if (hourIndex !== -1) {
|
|
range = [hourIndex, hourIndex + 2];
|
|
}
|
|
break;
|
|
case "minutes":
|
|
if (minuteIndex !== -1) {
|
|
range = [minuteIndex, minuteIndex + 2];
|
|
}
|
|
break;
|
|
case "seconds":
|
|
if (secondIndex !== -1) {
|
|
range = [secondIndex, secondIndex + 2];
|
|
}
|
|
break;
|
|
}
|
|
const [left, right] = range;
|
|
emit("select-range", left, right);
|
|
currentScrollbar.value = type;
|
|
};
|
|
const adjustCurrentSpinner = (type) => {
|
|
adjustSpinner(type, unref(timePartials)[type]);
|
|
};
|
|
const adjustSpinners = () => {
|
|
adjustCurrentSpinner("hours");
|
|
adjustCurrentSpinner("minutes");
|
|
adjustCurrentSpinner("seconds");
|
|
};
|
|
const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
|
|
const adjustSpinner = (type, value) => {
|
|
if (props.arrowControl)
|
|
return;
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
if (scrollbar && scrollbar.$el) {
|
|
getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
|
|
}
|
|
};
|
|
const typeItemHeight = (type) => {
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
|
|
if (listItem) {
|
|
return Number.parseFloat(getStyle(listItem, "height")) || 0;
|
|
}
|
|
return 0;
|
|
};
|
|
const onIncrement = () => {
|
|
scrollDown(1);
|
|
};
|
|
const onDecrement = () => {
|
|
scrollDown(-1);
|
|
};
|
|
const scrollDown = (step) => {
|
|
if (!currentScrollbar.value) {
|
|
emitSelectRange("hours");
|
|
}
|
|
const label = currentScrollbar.value;
|
|
const now = unref(timePartials)[label];
|
|
const total = currentScrollbar.value === "hours" ? 24 : 60;
|
|
const next = findNextUnDisabled(label, now, step, total);
|
|
modifyDateField(label, next);
|
|
adjustSpinner(label, next);
|
|
nextTick(() => emitSelectRange(label));
|
|
};
|
|
const findNextUnDisabled = (type, now, step, total) => {
|
|
let next = (now + step + total) % total;
|
|
const list = unref(timeList)[type];
|
|
while (list[next] && next !== now) {
|
|
next = (next + step + total) % total;
|
|
}
|
|
return next;
|
|
};
|
|
const modifyDateField = (type, value) => {
|
|
const list = unref(timeList)[type];
|
|
const isDisabled = list[value];
|
|
if (isDisabled)
|
|
return;
|
|
const { hours, minutes, seconds } = unref(timePartials);
|
|
let changeTo;
|
|
switch (type) {
|
|
case "hours":
|
|
changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
|
|
break;
|
|
case "minutes":
|
|
changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
|
|
break;
|
|
case "seconds":
|
|
changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
|
|
break;
|
|
}
|
|
emit(CHANGE_EVENT, changeTo);
|
|
};
|
|
const handleClick = (type, { value, disabled }) => {
|
|
if (!disabled) {
|
|
modifyDateField(type, value);
|
|
emitSelectRange(type);
|
|
adjustSpinner(type, value);
|
|
}
|
|
};
|
|
const handleScroll = (type) => {
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
if (!scrollbar)
|
|
return;
|
|
isScrolling = true;
|
|
debouncedResetScroll(type);
|
|
const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
|
|
modifyDateField(type, value);
|
|
};
|
|
const scrollBarHeight = (type) => {
|
|
return unref(listRefsMap[type]).$el.offsetHeight;
|
|
};
|
|
const bindScrollEvent = () => {
|
|
const bindFunction = (type) => {
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
if (scrollbar && scrollbar.$el) {
|
|
getScrollbarElement(scrollbar.$el).onscroll = () => {
|
|
handleScroll(type);
|
|
};
|
|
}
|
|
};
|
|
bindFunction("hours");
|
|
bindFunction("minutes");
|
|
bindFunction("seconds");
|
|
};
|
|
onMounted(() => {
|
|
nextTick(() => {
|
|
!props.arrowControl && bindScrollEvent();
|
|
adjustSpinners();
|
|
if (props.role === "start")
|
|
emitSelectRange("hours");
|
|
});
|
|
});
|
|
const setRef = (scrollbar, type) => {
|
|
listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
|
|
};
|
|
emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
|
|
emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
|
|
watch(() => props.spinnerDate, () => {
|
|
if (isScrolling)
|
|
return;
|
|
adjustSpinners();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
|
|
}, [
|
|
!_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
|
|
return openBlock(), createBlock(unref(ElScrollbar), {
|
|
key: item,
|
|
ref_for: true,
|
|
ref: (scrollbar) => setRef(scrollbar, item),
|
|
class: normalizeClass(unref(ns).be("spinner", "wrapper")),
|
|
"wrap-style": "max-height: inherit;",
|
|
"view-class": unref(ns).be("spinner", "list"),
|
|
noresize: "",
|
|
tag: "ul",
|
|
onMouseenter: ($event) => emitSelectRange(item),
|
|
onMousemove: ($event) => adjustCurrentSpinner(item)
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
|
|
return openBlock(), createElementBlock("li", {
|
|
key,
|
|
class: normalizeClass([
|
|
unref(ns).be("spinner", "item"),
|
|
unref(ns).is("active", key === unref(timePartials)[item]),
|
|
unref(ns).is("disabled", disabled)
|
|
]),
|
|
onClick: ($event) => handleClick(item, { value: key, disabled })
|
|
}, [
|
|
item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
|
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
|
|
], 64))
|
|
], 10, ["onClick"]);
|
|
}), 128))
|
|
]),
|
|
_: 2
|
|
}, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
|
|
}), 128)) : createCommentVNode("v-if", true),
|
|
_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
key: item,
|
|
class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
|
|
onMouseenter: ($event) => emitSelectRange(item)
|
|
}, [
|
|
withDirectives((openBlock(), createBlock(unref(ElIcon), {
|
|
class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_up_default))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])), [
|
|
[unref(vRepeatClick), onDecrement]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(unref(ElIcon), {
|
|
class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_down_default))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])), [
|
|
[unref(vRepeatClick), onIncrement]
|
|
]),
|
|
createBaseVNode("ul", {
|
|
class: normalizeClass(unref(ns).be("spinner", "list"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
|
|
return openBlock(), createElementBlock("li", {
|
|
key,
|
|
class: normalizeClass([
|
|
unref(ns).be("spinner", "item"),
|
|
unref(ns).is("active", time === unref(timePartials)[item]),
|
|
unref(ns).is("disabled", unref(timeList)[item][time])
|
|
])
|
|
}, [
|
|
unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
|
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
|
|
], 64))
|
|
], 64)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
}), 128))
|
|
], 2)
|
|
], 42, ["onMouseenter"]);
|
|
}), 128)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var TimeSpinner = _export_sfc(_sfc_main3, [["__file", "basic-time-spinner.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker-com/panel-time-pick.mjs
|
|
var _sfc_main4 = defineComponent({
|
|
__name: "panel-time-pick",
|
|
props: panelTimePickerProps,
|
|
emits: ["pick", "select-range", "set-picker-option"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const {
|
|
arrowControl,
|
|
disabledHours,
|
|
disabledMinutes,
|
|
disabledSeconds,
|
|
defaultValue
|
|
} = pickerBase.props;
|
|
const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
|
|
const ns = useNamespace("time");
|
|
const { t, lang } = useLocale();
|
|
const selectionRange = ref([0, 2]);
|
|
const oldValue = useOldValue(props);
|
|
const transitionName = computed(() => {
|
|
return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
|
|
});
|
|
const showSeconds = computed(() => {
|
|
return props.format.includes("ss");
|
|
});
|
|
const amPmMode = computed(() => {
|
|
if (props.format.includes("A"))
|
|
return "A";
|
|
if (props.format.includes("a"))
|
|
return "a";
|
|
return "";
|
|
});
|
|
const isValidValue = (_date) => {
|
|
const parsedDate = (0, import_dayjs2.default)(_date).locale(lang.value);
|
|
const result = getRangeAvailableTime(parsedDate);
|
|
return parsedDate.isSame(result);
|
|
};
|
|
const handleCancel = () => {
|
|
const old = oldValue.value;
|
|
emit("pick", old, false);
|
|
nextTick(() => {
|
|
oldValue.value = old;
|
|
});
|
|
};
|
|
const handleConfirm = (visible = false, first = false) => {
|
|
if (first)
|
|
return;
|
|
emit("pick", props.parsedValue, visible);
|
|
};
|
|
const handleChange = (_date) => {
|
|
if (!props.visible) {
|
|
return;
|
|
}
|
|
const result = getRangeAvailableTime(_date).millisecond(0);
|
|
emit("pick", result, true);
|
|
};
|
|
const setSelectionRange = (start, end) => {
|
|
emit("select-range", start, end);
|
|
selectionRange.value = [start, end];
|
|
};
|
|
const changeSelectionRange = (step) => {
|
|
const actualFormat = props.format;
|
|
const hourIndex = actualFormat.indexOf("HH");
|
|
const minuteIndex = actualFormat.indexOf("mm");
|
|
const secondIndex = actualFormat.indexOf("ss");
|
|
const list = [];
|
|
const mapping = [];
|
|
if (hourIndex !== -1) {
|
|
list.push(hourIndex);
|
|
mapping.push("hours");
|
|
}
|
|
if (minuteIndex !== -1) {
|
|
list.push(minuteIndex);
|
|
mapping.push("minutes");
|
|
}
|
|
if (secondIndex !== -1 && showSeconds.value) {
|
|
list.push(secondIndex);
|
|
mapping.push("seconds");
|
|
}
|
|
const index = list.indexOf(selectionRange.value[0]);
|
|
const next = (index + step + list.length) % list.length;
|
|
timePickerOptions["start_emitSelectRange"](mapping[next]);
|
|
};
|
|
const handleKeydown = (event) => {
|
|
const code = getEventCode(event);
|
|
const { left, right, up, down } = EVENT_CODE;
|
|
if ([left, right].includes(code)) {
|
|
const step = code === left ? -1 : 1;
|
|
changeSelectionRange(step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
if ([up, down].includes(code)) {
|
|
const step = code === up ? -1 : 1;
|
|
timePickerOptions["start_scrollDown"](step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
};
|
|
const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
});
|
|
const getRangeAvailableTime = (date) => {
|
|
return getAvailableTime(date, props.datetimeRole || "", true);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return (0, import_dayjs2.default)(value, props.format).locale(lang.value);
|
|
};
|
|
const getDefaultValue = () => {
|
|
return (0, import_dayjs2.default)(defaultValue).locale(lang.value);
|
|
};
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
|
|
emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
|
|
emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
|
|
default: withCtx(() => [
|
|
_ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ns).b("panel"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
|
|
}, [
|
|
createVNode(TimeSpinner, {
|
|
ref: "spinner",
|
|
role: _ctx.datetimeRole || "start",
|
|
"arrow-control": unref(arrowControl),
|
|
"show-seconds": unref(showSeconds),
|
|
"am-pm-mode": unref(amPmMode),
|
|
"spinner-date": _ctx.parsedValue,
|
|
"disabled-hours": unref(disabledHours),
|
|
"disabled-minutes": unref(disabledMinutes),
|
|
"disabled-seconds": unref(disabledSeconds),
|
|
onChange: handleChange,
|
|
onSetOption: unref(onSetOption),
|
|
onSelectRange: setSelectionRange
|
|
}, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ns).be("panel", "footer"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
|
|
onClick: handleCancel
|
|
}, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
|
|
onClick: ($event) => handleConfirm()
|
|
}, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["onClick"])
|
|
], 2)
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 1
|
|
}, 8, ["name"]);
|
|
};
|
|
}
|
|
});
|
|
var TimePickPanel = _export_sfc(_sfc_main4, [["__file", "panel-time-pick.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker-com/panel-time-range.mjs
|
|
var import_dayjs3 = __toESM(require_dayjs_min(), 1);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/props/panel-time-range.mjs
|
|
var panelTimeRangeProps = buildProps({
|
|
...timePanelSharedProps,
|
|
parsedValue: {
|
|
type: definePropType(Array)
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker-com/panel-time-range.mjs
|
|
init_shared_esm_bundler();
|
|
var _sfc_main5 = defineComponent({
|
|
__name: "panel-time-range",
|
|
props: panelTimeRangeProps,
|
|
emits: ["pick", "select-range", "set-picker-option"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const makeSelectRange = (start, end) => {
|
|
const result = [];
|
|
for (let i = start; i <= end; i++) {
|
|
result.push(i);
|
|
}
|
|
return result;
|
|
};
|
|
const { t, lang } = useLocale();
|
|
const nsTime = useNamespace("time");
|
|
const nsPicker = useNamespace("picker");
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const {
|
|
arrowControl,
|
|
disabledHours,
|
|
disabledMinutes,
|
|
disabledSeconds,
|
|
defaultValue
|
|
} = pickerBase.props;
|
|
const startContainerKls = computed(() => [
|
|
nsTime.be("range-picker", "body"),
|
|
nsTime.be("panel", "content"),
|
|
nsTime.is("arrow", arrowControl),
|
|
showSeconds.value ? "has-seconds" : ""
|
|
]);
|
|
const endContainerKls = computed(() => [
|
|
nsTime.be("range-picker", "body"),
|
|
nsTime.be("panel", "content"),
|
|
nsTime.is("arrow", arrowControl),
|
|
showSeconds.value ? "has-seconds" : ""
|
|
]);
|
|
const startTime = computed(() => props.parsedValue[0]);
|
|
const endTime = computed(() => props.parsedValue[1]);
|
|
const oldValue = useOldValue(props);
|
|
const handleCancel = () => {
|
|
const old = oldValue.value;
|
|
emit("pick", old, false);
|
|
nextTick(() => {
|
|
oldValue.value = old;
|
|
});
|
|
};
|
|
const showSeconds = computed(() => {
|
|
return props.format.includes("ss");
|
|
});
|
|
const amPmMode = computed(() => {
|
|
if (props.format.includes("A"))
|
|
return "A";
|
|
if (props.format.includes("a"))
|
|
return "a";
|
|
return "";
|
|
});
|
|
const handleConfirm = (visible = false) => {
|
|
emit("pick", [startTime.value, endTime.value], visible);
|
|
};
|
|
const handleMinChange = (date) => {
|
|
handleChange(date.millisecond(0), endTime.value);
|
|
};
|
|
const handleMaxChange = (date) => {
|
|
handleChange(startTime.value, date.millisecond(0));
|
|
};
|
|
const isValidValue = (_date) => {
|
|
const parsedDate = _date.map((_) => (0, import_dayjs3.default)(_).locale(lang.value));
|
|
const result = getRangeAvailableTime(parsedDate);
|
|
return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
|
|
};
|
|
const handleChange = (start, end) => {
|
|
if (!props.visible) {
|
|
return;
|
|
}
|
|
emit("pick", [start, end], true);
|
|
};
|
|
const btnConfirmDisabled = computed(() => {
|
|
return startTime.value > endTime.value;
|
|
});
|
|
const selectionRange = ref([0, 2]);
|
|
const setMinSelectionRange = (start, end) => {
|
|
emit("select-range", start, end, "min");
|
|
selectionRange.value = [start, end];
|
|
};
|
|
const offset = computed(() => showSeconds.value ? 11 : 8);
|
|
const setMaxSelectionRange = (start, end) => {
|
|
emit("select-range", start, end, "max");
|
|
const _offset = unref(offset);
|
|
selectionRange.value = [start + _offset, end + _offset];
|
|
};
|
|
const changeSelectionRange = (step) => {
|
|
const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
|
|
const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
|
|
const index = list.indexOf(selectionRange.value[0]);
|
|
const next = (index + step + list.length) % list.length;
|
|
const half = list.length / 2;
|
|
if (next < half) {
|
|
timePickerOptions["start_emitSelectRange"](mapping[next]);
|
|
} else {
|
|
timePickerOptions["end_emitSelectRange"](mapping[next - half]);
|
|
}
|
|
};
|
|
const handleKeydown = (event) => {
|
|
const code = getEventCode(event);
|
|
const { left, right, up, down } = EVENT_CODE;
|
|
if ([left, right].includes(code)) {
|
|
const step = code === left ? -1 : 1;
|
|
changeSelectionRange(step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
if ([up, down].includes(code)) {
|
|
const step = code === up ? -1 : 1;
|
|
const role = selectionRange.value[0] < offset.value ? "start" : "end";
|
|
timePickerOptions[`${role}_scrollDown`](step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
};
|
|
const disabledHours_ = (role, compare) => {
|
|
const defaultDisable = disabledHours ? disabledHours(role) : [];
|
|
const isStart = role === "start";
|
|
const compareDate = compare || (isStart ? endTime.value : startTime.value);
|
|
const compareHour = compareDate.hour();
|
|
const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
|
|
return union_default(defaultDisable, nextDisable);
|
|
};
|
|
const disabledMinutes_ = (hour, role, compare) => {
|
|
const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
|
|
const isStart = role === "start";
|
|
const compareDate = compare || (isStart ? endTime.value : startTime.value);
|
|
const compareHour = compareDate.hour();
|
|
if (hour !== compareHour) {
|
|
return defaultDisable;
|
|
}
|
|
const compareMinute = compareDate.minute();
|
|
const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
|
|
return union_default(defaultDisable, nextDisable);
|
|
};
|
|
const disabledSeconds_ = (hour, minute, role, compare) => {
|
|
const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
|
|
const isStart = role === "start";
|
|
const compareDate = compare || (isStart ? endTime.value : startTime.value);
|
|
const compareHour = compareDate.hour();
|
|
const compareMinute = compareDate.minute();
|
|
if (hour !== compareHour || minute !== compareMinute) {
|
|
return defaultDisable;
|
|
}
|
|
const compareSecond = compareDate.second();
|
|
const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
|
|
return union_default(defaultDisable, nextDisable);
|
|
};
|
|
const getRangeAvailableTime = ([start, end]) => {
|
|
return [
|
|
getAvailableTime(start, "start", true, end),
|
|
getAvailableTime(end, "end", false, start)
|
|
];
|
|
};
|
|
const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
|
|
const {
|
|
timePickerOptions,
|
|
getAvailableTime,
|
|
onSetOption
|
|
} = useTimePanel({
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
});
|
|
const parseUserInput = (days) => {
|
|
if (!days)
|
|
return null;
|
|
if (isArray(days)) {
|
|
return days.map((d) => (0, import_dayjs3.default)(d, props.format).locale(lang.value));
|
|
}
|
|
return (0, import_dayjs3.default)(days, props.format).locale(lang.value);
|
|
};
|
|
const getDefaultValue = () => {
|
|
if (isArray(defaultValue)) {
|
|
return defaultValue.map((d) => (0, import_dayjs3.default)(d).locale(lang.value));
|
|
}
|
|
const defaultDay = (0, import_dayjs3.default)(defaultValue).locale(lang.value);
|
|
return [defaultDay, defaultDay.add(60, "m")];
|
|
};
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
|
|
emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
|
|
emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
|
|
return (_ctx, _cache) => {
|
|
return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("range-picker", "content"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("range-picker", "header"))
|
|
}, toDisplayString(unref(t)("el.datepicker.startTime")), 3),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(startContainerKls))
|
|
}, [
|
|
createVNode(TimeSpinner, {
|
|
ref: "minSpinner",
|
|
role: "start",
|
|
"show-seconds": unref(showSeconds),
|
|
"am-pm-mode": unref(amPmMode),
|
|
"arrow-control": unref(arrowControl),
|
|
"spinner-date": unref(startTime),
|
|
"disabled-hours": disabledHours_,
|
|
"disabled-minutes": disabledMinutes_,
|
|
"disabled-seconds": disabledSeconds_,
|
|
onChange: handleMinChange,
|
|
onSetOption: unref(onSetOption),
|
|
onSelectRange: setMinSelectionRange
|
|
}, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
|
|
], 2)
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("range-picker", "header"))
|
|
}, toDisplayString(unref(t)("el.datepicker.endTime")), 3),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(endContainerKls))
|
|
}, [
|
|
createVNode(TimeSpinner, {
|
|
ref: "maxSpinner",
|
|
role: "end",
|
|
"show-seconds": unref(showSeconds),
|
|
"am-pm-mode": unref(amPmMode),
|
|
"arrow-control": unref(arrowControl),
|
|
"spinner-date": unref(endTime),
|
|
"disabled-hours": disabledHours_,
|
|
"disabled-minutes": disabledMinutes_,
|
|
"disabled-seconds": disabledSeconds_,
|
|
onChange: handleMaxChange,
|
|
onSetOption: unref(onSetOption),
|
|
onSelectRange: setMaxSelectionRange
|
|
}, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
|
|
], 2)
|
|
], 2)
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(nsTime).be("panel", "footer"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
|
|
onClick: ($event) => handleCancel()
|
|
}, toDisplayString(unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
|
|
disabled: unref(btnConfirmDisabled),
|
|
onClick: ($event) => handleConfirm()
|
|
}, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
|
|
], 2)
|
|
], 2)) : createCommentVNode("v-if", true);
|
|
};
|
|
}
|
|
});
|
|
var TimeRangePanel = _export_sfc(_sfc_main5, [["__file", "panel-time-range.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/src/time-picker.mjs
|
|
import_dayjs4.default.extend(import_customParseFormat.default);
|
|
var TimePicker = defineComponent({
|
|
name: "ElTimePicker",
|
|
install: null,
|
|
props: {
|
|
...timePickerDefaultProps,
|
|
isRange: Boolean
|
|
},
|
|
emits: [UPDATE_MODEL_EVENT],
|
|
setup(props, ctx) {
|
|
const commonPicker = ref();
|
|
const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
|
|
const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
|
|
provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, props.popperOptions);
|
|
ctx.expose({
|
|
focus: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.focus();
|
|
},
|
|
blur: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.blur();
|
|
},
|
|
handleOpen: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
|
|
},
|
|
handleClose: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.handleClose();
|
|
}
|
|
});
|
|
return () => {
|
|
var _a;
|
|
const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
|
|
return createVNode(CommonPicker, mergeProps(props, {
|
|
"ref": commonPicker,
|
|
"type": type,
|
|
"format": format,
|
|
"onUpdate:modelValue": modelUpdater
|
|
}), {
|
|
default: (props2) => createVNode(Panel, props2, null)
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/time-picker/index.mjs
|
|
var ElTimePicker = withInstall(TimePicker);
|
|
|
|
export {
|
|
buildTimeList,
|
|
rangeArr,
|
|
extractDateFormat,
|
|
extractTimeFormat,
|
|
dateEquals,
|
|
valueEquals,
|
|
parseDate,
|
|
formatter,
|
|
makeList,
|
|
dayOrDaysToDate,
|
|
require_customParseFormat,
|
|
timeUnits,
|
|
PICKER_BASE_INJECTION_KEY,
|
|
PICKER_POPPER_OPTIONS_INJECTION_KEY,
|
|
ROOT_COMMON_PICKER_INJECTION_KEY,
|
|
DEFAULT_FORMATS_TIME,
|
|
DEFAULT_FORMATS_DATE,
|
|
DEFAULT_FORMATS_DATEPICKER,
|
|
useCommonPicker,
|
|
disabledTimeListsProps,
|
|
timePickerDefaultProps,
|
|
timePickerRangeTriggerProps,
|
|
timePickerRngeTriggerProps,
|
|
CommonPicker,
|
|
TimePickPanel,
|
|
ElTimePicker
|
|
};
|
|
//# sourceMappingURL=chunk-FCRAESCL.js.map
|