4114 lines
157 KiB
JavaScript
4114 lines
157 KiB
JavaScript
import {
|
|
CommonPicker,
|
|
DEFAULT_FORMATS_DATE,
|
|
DEFAULT_FORMATS_DATEPICKER,
|
|
DEFAULT_FORMATS_TIME,
|
|
PICKER_BASE_INJECTION_KEY,
|
|
PICKER_POPPER_OPTIONS_INJECTION_KEY,
|
|
ROOT_COMMON_PICKER_INJECTION_KEY,
|
|
TimePickPanel,
|
|
disabledTimeListsProps,
|
|
extractDateFormat,
|
|
extractTimeFormat,
|
|
rangeArr,
|
|
require_customParseFormat,
|
|
timePickerDefaultProps,
|
|
useCommonPicker
|
|
} from "./chunk-FCRAESCL.js";
|
|
import {
|
|
ClickOutside
|
|
} from "./chunk-SSCO4CCM.js";
|
|
import {
|
|
castArray,
|
|
extractFirst
|
|
} from "./chunk-7F6Y7TML.js";
|
|
import {
|
|
datePickTypes
|
|
} from "./chunk-RJD6ACU2.js";
|
|
import {
|
|
EVENT_CODE,
|
|
getEventCode
|
|
} from "./chunk-BUVJOKYK.js";
|
|
import {
|
|
ElInput
|
|
} from "./chunk-G7ZFAANB.js";
|
|
import {
|
|
ElButton
|
|
} from "./chunk-DXOVFSWI.js";
|
|
import {
|
|
useLocale
|
|
} from "./chunk-APPTXKCZ.js";
|
|
import {
|
|
ElIcon,
|
|
hasClass
|
|
} from "./chunk-3DJYPQW6.js";
|
|
import {
|
|
UPDATE_MODEL_EVENT
|
|
} from "./chunk-6VHTGKN7.js";
|
|
import {
|
|
isUndefined
|
|
} from "./chunk-UFIWN4M6.js";
|
|
import {
|
|
_export_sfc
|
|
} from "./chunk-MUJDDH7P.js";
|
|
import {
|
|
buildProps,
|
|
definePropType,
|
|
flatten_default,
|
|
isEqual_default,
|
|
useNamespace,
|
|
withInstall
|
|
} from "./chunk-R2OGZABH.js";
|
|
import {
|
|
require_dayjs_min
|
|
} from "./chunk-YYGDCKLY.js";
|
|
import {
|
|
arrow_left_default,
|
|
arrow_right_default,
|
|
d_arrow_left_default,
|
|
d_arrow_right_default
|
|
} from "./chunk-3C23FNYW.js";
|
|
import {
|
|
Fragment,
|
|
computed,
|
|
createBaseVNode,
|
|
createBlock,
|
|
createCommentVNode,
|
|
createElementBlock,
|
|
createTextVNode,
|
|
createVNode,
|
|
defineComponent,
|
|
getCurrentInstance,
|
|
inject,
|
|
isVNode,
|
|
mergeProps,
|
|
nextTick,
|
|
onBeforeUnmount,
|
|
openBlock,
|
|
provide,
|
|
reactive,
|
|
ref,
|
|
renderList,
|
|
renderSlot,
|
|
toRef,
|
|
toRefs,
|
|
unref,
|
|
useAttrs,
|
|
useSlots,
|
|
vShow,
|
|
watch,
|
|
withCtx,
|
|
withDirectives,
|
|
withKeys,
|
|
withModifiers
|
|
} from "./chunk-AAHVYXXY.js";
|
|
import {
|
|
init_shared_esm_bundler,
|
|
isArray,
|
|
isFunction,
|
|
isString,
|
|
normalizeClass,
|
|
toDisplayString
|
|
} from "./chunk-OWZYVOTZ.js";
|
|
import {
|
|
__commonJS,
|
|
__toESM
|
|
} from "./chunk-V4OQ3NZ2.js";
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js
|
|
var require_advancedFormat = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.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_advancedFormat = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(e, t) {
|
|
var r = t.prototype, n = r.format;
|
|
r.format = function(e2) {
|
|
var t2 = this, r2 = this.$locale();
|
|
if (!this.isValid()) return n.bind(this)(e2);
|
|
var s = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
|
|
switch (e3) {
|
|
case "Q":
|
|
return Math.ceil((t2.$M + 1) / 3);
|
|
case "Do":
|
|
return r2.ordinal(t2.$D);
|
|
case "gggg":
|
|
return t2.weekYear();
|
|
case "GGGG":
|
|
return t2.isoWeekYear();
|
|
case "wo":
|
|
return r2.ordinal(t2.week(), "W");
|
|
case "w":
|
|
case "ww":
|
|
return s.s(t2.week(), "w" === e3 ? 1 : 2, "0");
|
|
case "W":
|
|
case "WW":
|
|
return s.s(t2.isoWeek(), "W" === e3 ? 1 : 2, "0");
|
|
case "k":
|
|
case "kk":
|
|
return s.s(String(0 === t2.$H ? 24 : t2.$H), "k" === e3 ? 1 : 2, "0");
|
|
case "X":
|
|
return Math.floor(t2.$d.getTime() / 1e3);
|
|
case "x":
|
|
return t2.$d.getTime();
|
|
case "z":
|
|
return "[" + t2.offsetName() + "]";
|
|
case "zzz":
|
|
return "[" + t2.offsetName("long") + "]";
|
|
default:
|
|
return e3;
|
|
}
|
|
});
|
|
return n.bind(this)(a);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/localeData.js
|
|
var require_localeData = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/localeData.js"(exports, module) {
|
|
!function(n, e) {
|
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (n = "undefined" != typeof globalThis ? globalThis : n || self).dayjs_plugin_localeData = e();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(n, e, t) {
|
|
var r = e.prototype, o = function(n2) {
|
|
return n2 && (n2.indexOf ? n2 : n2.s);
|
|
}, u = function(n2, e2, t2, r2, u2) {
|
|
var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
|
|
return n3.slice(0, r2);
|
|
});
|
|
if (!u2) return f;
|
|
var d = i2.weekStart;
|
|
return f.map(function(n3, e3) {
|
|
return f[(e3 + (d || 0)) % 7];
|
|
});
|
|
}, i = function() {
|
|
return t.Ls[t.locale()];
|
|
}, a = function(n2, e2) {
|
|
return n2.formats[e2] || function(n3) {
|
|
return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
|
|
return e3 || t2.slice(1);
|
|
});
|
|
}(n2.formats[e2.toUpperCase()]);
|
|
}, s = function() {
|
|
var n2 = this;
|
|
return { months: function(e2) {
|
|
return e2 ? e2.format("MMMM") : u(n2, "months");
|
|
}, monthsShort: function(e2) {
|
|
return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
|
|
}, firstDayOfWeek: function() {
|
|
return n2.$locale().weekStart || 0;
|
|
}, weekdays: function(e2) {
|
|
return e2 ? e2.format("dddd") : u(n2, "weekdays");
|
|
}, weekdaysMin: function(e2) {
|
|
return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
|
|
}, weekdaysShort: function(e2) {
|
|
return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
|
|
}, longDateFormat: function(e2) {
|
|
return a(n2.$locale(), e2);
|
|
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
|
|
};
|
|
r.localeData = function() {
|
|
return s.bind(this)();
|
|
}, t.localeData = function() {
|
|
var n2 = i();
|
|
return { firstDayOfWeek: function() {
|
|
return n2.weekStart || 0;
|
|
}, weekdays: function() {
|
|
return t.weekdays();
|
|
}, weekdaysShort: function() {
|
|
return t.weekdaysShort();
|
|
}, weekdaysMin: function() {
|
|
return t.weekdaysMin();
|
|
}, months: function() {
|
|
return t.months();
|
|
}, monthsShort: function() {
|
|
return t.monthsShort();
|
|
}, longDateFormat: function(e2) {
|
|
return a(n2, e2);
|
|
}, meridiem: n2.meridiem, ordinal: n2.ordinal };
|
|
}, t.months = function() {
|
|
return u(i(), "months");
|
|
}, t.monthsShort = function() {
|
|
return u(i(), "monthsShort", "months", 3);
|
|
}, t.weekdays = function(n2) {
|
|
return u(i(), "weekdays", null, null, n2);
|
|
}, t.weekdaysShort = function(n2) {
|
|
return u(i(), "weekdaysShort", "weekdays", 3, n2);
|
|
}, t.weekdaysMin = function(n2) {
|
|
return u(i(), "weekdaysMin", "weekdays", 2, n2);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekOfYear.js
|
|
var require_weekOfYear = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekOfYear.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_weekOfYear = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
var e = "week", t = "year";
|
|
return function(i, n, r) {
|
|
var f = n.prototype;
|
|
f.week = function(i2) {
|
|
if (void 0 === i2 && (i2 = null), null !== i2) return this.add(7 * (i2 - this.week()), "day");
|
|
var n2 = this.$locale().yearStart || 1;
|
|
if (11 === this.month() && this.date() > 25) {
|
|
var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
|
|
if (f2.isBefore(s)) return 1;
|
|
}
|
|
var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
|
|
return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
|
|
}, f.weeks = function(e2) {
|
|
return void 0 === e2 && (e2 = null), this.week(e2);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekYear.js
|
|
var require_weekYear = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekYear.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_weekYear = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(e, t) {
|
|
t.prototype.weekYear = function() {
|
|
var e2 = this.month(), t2 = this.week(), n = this.year();
|
|
return 1 === t2 && 11 === e2 ? n + 1 : 0 === e2 && t2 >= 52 ? n - 1 : n;
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/dayOfYear.js
|
|
var require_dayOfYear = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/dayOfYear.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_dayOfYear = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(e, t, n) {
|
|
t.prototype.dayOfYear = function(e2) {
|
|
var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
|
|
return null == e2 ? t2 : this.add(e2 - t2, "day");
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.js
|
|
var require_isSameOrAfter = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.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_isSameOrAfter = t();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(e, t) {
|
|
t.prototype.isSameOrAfter = function(e2, t2) {
|
|
return this.isSame(e2, t2) || this.isAfter(e2, t2);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrBefore.js
|
|
var require_isSameOrBefore = __commonJS({
|
|
"../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrBefore.js"(exports, module) {
|
|
!function(e, i) {
|
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrBefore = i();
|
|
}(exports, function() {
|
|
"use strict";
|
|
return function(e, i) {
|
|
i.prototype.isSameOrBefore = function(e2, i2) {
|
|
return this.isSame(e2, i2) || this.isBefore(e2, i2);
|
|
};
|
|
};
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-panel.mjs
|
|
var import_dayjs11 = __toESM(require_dayjs_min(), 1);
|
|
var import_customParseFormat = __toESM(require_customParseFormat(), 1);
|
|
var import_advancedFormat = __toESM(require_advancedFormat(), 1);
|
|
var import_localeData = __toESM(require_localeData(), 1);
|
|
var import_weekOfYear = __toESM(require_weekOfYear(), 1);
|
|
var import_weekYear = __toESM(require_weekYear(), 1);
|
|
var import_dayOfYear = __toESM(require_dayOfYear(), 1);
|
|
var import_isSameOrAfter = __toESM(require_isSameOrAfter(), 1);
|
|
var import_isSameOrBefore = __toESM(require_isSameOrBefore(), 1);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/props/date-picker-panel.mjs
|
|
var datePickerPanelProps = buildProps({
|
|
valueFormat: String,
|
|
dateFormat: String,
|
|
timeFormat: String,
|
|
disabled: Boolean,
|
|
modelValue: {
|
|
type: definePropType([Date, Array, String, Number]),
|
|
default: ""
|
|
},
|
|
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,
|
|
unlinkPanels: Boolean,
|
|
showNow: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showConfirm: Boolean,
|
|
showFooter: Boolean,
|
|
showWeekNumber: Boolean,
|
|
type: {
|
|
type: definePropType(String),
|
|
default: "date"
|
|
},
|
|
clearable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
border: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/constants.mjs
|
|
var ROOT_PICKER_INJECTION_KEY = Symbol("rootPickerContextKey");
|
|
var ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = "ElIsDefaultFormat";
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-date-pick.mjs
|
|
var import_dayjs5 = __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/date-picker-panel/src/props/shared.mjs
|
|
init_shared_esm_bundler();
|
|
var selectionModes = [
|
|
"date",
|
|
"dates",
|
|
"year",
|
|
"years",
|
|
"month",
|
|
"months",
|
|
"week",
|
|
"range"
|
|
];
|
|
var datePickerSharedProps = buildProps({
|
|
cellClassName: {
|
|
type: definePropType(Function)
|
|
},
|
|
disabledDate: {
|
|
type: definePropType(Function)
|
|
},
|
|
date: {
|
|
type: definePropType(Object),
|
|
required: true
|
|
},
|
|
minDate: {
|
|
type: definePropType(Object)
|
|
},
|
|
maxDate: {
|
|
type: definePropType(Object)
|
|
},
|
|
parsedValue: {
|
|
type: definePropType([Object, Array])
|
|
},
|
|
rangeState: {
|
|
type: definePropType(Object),
|
|
default: () => ({
|
|
endDate: null,
|
|
selecting: false
|
|
})
|
|
},
|
|
disabled: Boolean
|
|
});
|
|
var panelSharedProps = buildProps({
|
|
type: {
|
|
type: definePropType(String),
|
|
required: true,
|
|
values: datePickTypes
|
|
},
|
|
dateFormat: String,
|
|
timeFormat: String,
|
|
showNow: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showConfirm: Boolean,
|
|
showFooter: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showWeekNumber: Boolean,
|
|
border: Boolean,
|
|
disabled: Boolean
|
|
});
|
|
var panelRangeSharedProps = buildProps({
|
|
unlinkPanels: Boolean,
|
|
visible: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showConfirm: Boolean,
|
|
showFooter: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
border: Boolean,
|
|
disabled: Boolean,
|
|
parsedValue: {
|
|
type: definePropType(Array)
|
|
}
|
|
});
|
|
var selectionModeWithDefault = (mode) => {
|
|
return {
|
|
type: String,
|
|
values: selectionModes,
|
|
default: mode
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/props/panel-date-pick.mjs
|
|
var panelDatePickProps = buildProps({
|
|
...panelSharedProps,
|
|
parsedValue: {
|
|
type: definePropType([Object, Array])
|
|
},
|
|
visible: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
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/date-picker-panel/src/utils.mjs
|
|
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
init_shared_esm_bundler();
|
|
var isValidRange = (range) => {
|
|
if (!isArray(range))
|
|
return false;
|
|
const [left, right] = range;
|
|
return import_dayjs.default.isDayjs(left) && import_dayjs.default.isDayjs(right) && (0, import_dayjs.default)(left).isValid() && (0, import_dayjs.default)(right).isValid() && left.isSameOrBefore(right);
|
|
};
|
|
var getDefaultValue = (defaultValue, { lang, step: step2 = 1, unit: unit4, unlinkPanels }) => {
|
|
let start;
|
|
if (isArray(defaultValue)) {
|
|
let [left, right] = defaultValue.map((d) => (0, import_dayjs.default)(d).locale(lang));
|
|
if (!unlinkPanels) {
|
|
right = left.add(step2, unit4);
|
|
}
|
|
return [left, right];
|
|
} else if (defaultValue) {
|
|
start = (0, import_dayjs.default)(defaultValue);
|
|
} else {
|
|
start = (0, import_dayjs.default)();
|
|
}
|
|
start = start.locale(lang);
|
|
return [start, start.add(step2, unit4)];
|
|
};
|
|
var buildPickerTable = (dimension, rows, {
|
|
columnIndexOffset,
|
|
startDate,
|
|
nextEndDate,
|
|
now,
|
|
unit: unit4,
|
|
relativeDateGetter,
|
|
setCellMetadata,
|
|
setRowMetadata
|
|
}) => {
|
|
for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
|
|
const row = rows[rowIndex];
|
|
for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
|
|
let cell = row[columnIndex + columnIndexOffset];
|
|
if (!cell) {
|
|
cell = {
|
|
row: rowIndex,
|
|
column: columnIndex,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false
|
|
};
|
|
}
|
|
const index = rowIndex * dimension.column + columnIndex;
|
|
const nextStartDate = relativeDateGetter(index);
|
|
cell.dayjs = nextStartDate;
|
|
cell.date = nextStartDate.toDate();
|
|
cell.timestamp = nextStartDate.valueOf();
|
|
cell.type = "normal";
|
|
cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit4) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit4)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit4) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit4));
|
|
if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
|
|
cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit4);
|
|
cell.end = startDate && nextStartDate.isSame(startDate, unit4);
|
|
} else {
|
|
cell.start = !!startDate && nextStartDate.isSame(startDate, unit4);
|
|
cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit4);
|
|
}
|
|
const isToday = nextStartDate.isSame(now, unit4);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
|
|
row[columnIndex + columnIndexOffset] = cell;
|
|
}
|
|
setRowMetadata == null ? void 0 : setRowMetadata(row);
|
|
}
|
|
};
|
|
var datesInMonth = (date, year, month, lang) => {
|
|
const firstDay = (0, import_dayjs.default)().locale(lang).startOf("month").month(month).year(year).hour(date.hour()).minute(date.minute()).second(date.second());
|
|
const numOfDays = firstDay.daysInMonth();
|
|
return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
|
|
};
|
|
var getValidDateOfMonth = (date, year, month, lang, disabledDate) => {
|
|
const _value = (0, import_dayjs.default)().year(year).month(month).startOf("month").hour(date.hour()).minute(date.minute()).second(date.second());
|
|
const _date = datesInMonth(date, year, month, lang).find((date2) => {
|
|
return !(disabledDate == null ? void 0 : disabledDate(date2));
|
|
});
|
|
if (_date) {
|
|
return (0, import_dayjs.default)(_date).locale(lang);
|
|
}
|
|
return _value.locale(lang);
|
|
};
|
|
var getValidDateOfYear = (value, lang, disabledDate) => {
|
|
const year = value.year();
|
|
if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
|
|
return value.locale(lang);
|
|
}
|
|
const month = value.month();
|
|
if (!datesInMonth(value, year, month, lang).every(disabledDate)) {
|
|
return getValidDateOfMonth(value, year, month, lang, disabledDate);
|
|
}
|
|
for (let i = 0; i < 12; i++) {
|
|
if (!datesInMonth(value, year, i, lang).every(disabledDate)) {
|
|
return getValidDateOfMonth(value, year, i, lang, disabledDate);
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
var correctlyParseUserInput = (value, format, lang, defaultFormat) => {
|
|
if (isArray(value)) {
|
|
return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
|
|
}
|
|
if (isString(value)) {
|
|
const dayjsValue = (defaultFormat == null ? void 0 : defaultFormat.value) ? (0, import_dayjs.default)(value) : (0, import_dayjs.default)(value, format);
|
|
if (!dayjsValue.isValid()) {
|
|
return dayjsValue;
|
|
}
|
|
}
|
|
return (0, import_dayjs.default)(value, format).locale(lang);
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/props/basic-date-table.mjs
|
|
var basicDateTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
showWeekNumber: Boolean,
|
|
selectionMode: selectionModeWithDefault("date")
|
|
});
|
|
var basicDateTableEmits = ["changerange", "pick", "select"];
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-basic-date-table.mjs
|
|
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
|
|
init_shared_esm_bundler();
|
|
var isNormalDay = (type = "") => {
|
|
return ["normal", "today"].includes(type);
|
|
};
|
|
var useBasicDateTable = (props, emit) => {
|
|
const { lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const tableRows = ref([[], [], [], [], [], []]);
|
|
let focusWithClick = false;
|
|
const firstDayOfWeek = props.date.$locale().weekStart || 7;
|
|
const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
|
|
const offsetDay = computed(() => {
|
|
return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
|
|
});
|
|
const startDate = computed(() => {
|
|
const startDayOfMonth = props.date.startOf("month");
|
|
return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
|
|
});
|
|
const WEEKS = computed(() => {
|
|
return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
|
|
});
|
|
const hasCurrent = computed(() => {
|
|
return flatten_default(unref(rows)).some((row) => {
|
|
return row.isCurrent;
|
|
});
|
|
});
|
|
const days = computed(() => {
|
|
const startOfMonth = props.date.startOf("month");
|
|
const startOfMonthDay = startOfMonth.day() || 7;
|
|
const dateCountOfMonth = startOfMonth.daysInMonth();
|
|
const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
|
|
return {
|
|
startOfMonthDay,
|
|
dateCountOfMonth,
|
|
dateCountOfLastMonth
|
|
};
|
|
});
|
|
const selectedDate = computed(() => {
|
|
return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
|
|
});
|
|
const setDateText = (cell, { count, rowIndex, columnIndex }) => {
|
|
const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
|
|
const offset = unref(offsetDay);
|
|
if (rowIndex >= 0 && rowIndex <= 1) {
|
|
const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
|
|
if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
|
|
cell.text = count;
|
|
return true;
|
|
} else {
|
|
cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
|
|
cell.type = "prev-month";
|
|
}
|
|
} else {
|
|
if (count <= dateCountOfMonth) {
|
|
cell.text = count;
|
|
} else {
|
|
cell.text = count - dateCountOfMonth;
|
|
cell.type = "next-month";
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
|
|
const { disabledDate, cellClassName } = props;
|
|
const _selectedDate = unref(selectedDate);
|
|
const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
|
|
const cellDate = cell.dayjs.toDate();
|
|
cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
|
|
cell.isSelected = !!cell.selected;
|
|
cell.isCurrent = isCurrent(cell);
|
|
cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
|
|
cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
|
|
return shouldIncrement;
|
|
};
|
|
const setRowMetadata = (row) => {
|
|
if (props.selectionMode === "week") {
|
|
const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
|
|
const isActive = isWeekActive(row[start + 1]);
|
|
row[start].inRange = isActive;
|
|
row[start].start = isActive;
|
|
row[end].inRange = isActive;
|
|
row[end].end = isActive;
|
|
}
|
|
};
|
|
const rows = computed(() => {
|
|
const { minDate, maxDate, rangeState, showWeekNumber } = props;
|
|
const offset = unref(offsetDay);
|
|
const rows_ = unref(tableRows);
|
|
const dateUnit = "day";
|
|
let count = 1;
|
|
buildPickerTable({ row: 6, column: 7 }, rows_, {
|
|
startDate: minDate,
|
|
columnIndexOffset: showWeekNumber ? 1 : 0,
|
|
nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
|
|
now: (0, import_dayjs2.default)().locale(unref(lang)).startOf(dateUnit),
|
|
unit: dateUnit,
|
|
relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
|
|
setCellMetadata: (...args) => {
|
|
if (setCellMetadata(...args, count)) {
|
|
count += 1;
|
|
}
|
|
},
|
|
setRowMetadata
|
|
});
|
|
if (showWeekNumber) {
|
|
for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
|
|
if (rows_[rowIndex][1].dayjs) {
|
|
rows_[rowIndex][0] = {
|
|
type: "week",
|
|
text: rows_[rowIndex][1].dayjs.week()
|
|
};
|
|
}
|
|
}
|
|
}
|
|
return rows_;
|
|
});
|
|
watch(() => props.date, async () => {
|
|
var _a;
|
|
if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
|
|
await nextTick();
|
|
await focus();
|
|
}
|
|
});
|
|
const focus = async () => {
|
|
var _a;
|
|
return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
|
|
};
|
|
const isCurrent = (cell) => {
|
|
return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
|
|
};
|
|
const cellMatchesDate = (cell, date) => {
|
|
if (!date)
|
|
return false;
|
|
return (0, import_dayjs2.default)(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
|
|
};
|
|
const getDateOfCell = (row, column) => {
|
|
const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
|
|
return unref(startDate).add(offsetFromStart, "day");
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
let target = event.target;
|
|
if (target.tagName === "SPAN") {
|
|
target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
|
|
}
|
|
if (target.tagName === "DIV") {
|
|
target = target.parentNode;
|
|
}
|
|
if (target.tagName !== "TD")
|
|
return;
|
|
const row = target.parentNode.rowIndex - 1;
|
|
const column = target.cellIndex;
|
|
if (unref(rows)[row][column].disabled)
|
|
return;
|
|
if (row !== unref(lastRow) || column !== unref(lastColumn)) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: getDateOfCell(row, column)
|
|
});
|
|
}
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
|
|
};
|
|
const handleFocus = (event) => {
|
|
if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
|
|
return;
|
|
handlePickDate(event, true);
|
|
};
|
|
const handleMouseDown = (event) => {
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
focusWithClick = true;
|
|
};
|
|
const handleMouseUp = (event) => {
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
focusWithClick = false;
|
|
};
|
|
const handleRangePick = (newDate) => {
|
|
if (!props.rangeState.selecting || !props.minDate) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
};
|
|
const handleWeekPick = (newDate) => {
|
|
const weekNumber = newDate.week();
|
|
const value = `${newDate.year()}w${weekNumber}`;
|
|
emit("pick", {
|
|
year: newDate.year(),
|
|
week: weekNumber,
|
|
value,
|
|
date: newDate.startOf("week")
|
|
});
|
|
};
|
|
const handleDatesPick = (newDate, selected) => {
|
|
const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
|
|
emit("pick", newValue);
|
|
};
|
|
const handlePickDate = (event, isKeyboardMovement = false) => {
|
|
if (props.disabled)
|
|
return;
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
const row = target.parentNode.rowIndex - 1;
|
|
const column = target.cellIndex;
|
|
const cell = unref(rows)[row][column];
|
|
if (cell.disabled || cell.type === "week")
|
|
return;
|
|
const newDate = getDateOfCell(row, column);
|
|
switch (props.selectionMode) {
|
|
case "range": {
|
|
handleRangePick(newDate);
|
|
break;
|
|
}
|
|
case "date": {
|
|
emit("pick", newDate, isKeyboardMovement);
|
|
break;
|
|
}
|
|
case "week": {
|
|
handleWeekPick(newDate);
|
|
break;
|
|
}
|
|
case "dates": {
|
|
handleDatesPick(newDate, !!cell.selected);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
const isWeekActive = (cell) => {
|
|
if (props.selectionMode !== "week")
|
|
return false;
|
|
let newDate = props.date.startOf("day");
|
|
if (cell.type === "prev-month") {
|
|
newDate = newDate.subtract(1, "month");
|
|
}
|
|
if (cell.type === "next-month") {
|
|
newDate = newDate.add(1, "month");
|
|
}
|
|
newDate = newDate.date(Number.parseInt(cell.text, 10));
|
|
if (props.parsedValue && !isArray(props.parsedValue)) {
|
|
const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
|
|
const weekDate = props.parsedValue.subtract(dayOffset, "day");
|
|
return weekDate.isSame(newDate, "day");
|
|
}
|
|
return false;
|
|
};
|
|
return {
|
|
WEEKS,
|
|
rows,
|
|
tbodyRef,
|
|
currentCellRef,
|
|
focus,
|
|
isCurrent,
|
|
isWeekActive,
|
|
isSelectedCell,
|
|
handlePickDate,
|
|
handleMouseUp,
|
|
handleMouseDown,
|
|
handleMouseMove,
|
|
handleFocus
|
|
};
|
|
};
|
|
var useBasicDateTableDOM = (props, {
|
|
isCurrent,
|
|
isWeekActive
|
|
}) => {
|
|
const ns = useNamespace("date-table");
|
|
const { t } = useLocale();
|
|
const tableKls = computed(() => [
|
|
ns.b(),
|
|
ns.is("week-mode", props.selectionMode === "week" && !props.disabled)
|
|
]);
|
|
const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
|
|
const getCellClasses = (cell) => {
|
|
const classes = [];
|
|
if (isNormalDay(cell.type) && !cell.disabled) {
|
|
classes.push("available");
|
|
if (cell.type === "today") {
|
|
classes.push("today");
|
|
}
|
|
} else {
|
|
classes.push(cell.type);
|
|
}
|
|
if (isCurrent(cell)) {
|
|
classes.push("current");
|
|
}
|
|
if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
|
|
classes.push("in-range");
|
|
if (cell.start) {
|
|
classes.push("start-date");
|
|
}
|
|
if (cell.end) {
|
|
classes.push("end-date");
|
|
}
|
|
}
|
|
if (cell.disabled || props.disabled) {
|
|
classes.push("disabled");
|
|
}
|
|
if (cell.selected) {
|
|
classes.push("selected");
|
|
}
|
|
if (cell.customClass) {
|
|
classes.push(cell.customClass);
|
|
}
|
|
return classes.join(" ");
|
|
};
|
|
const getRowKls = (cell) => [
|
|
ns.e("row"),
|
|
{ current: isWeekActive(cell) }
|
|
];
|
|
return {
|
|
tableKls,
|
|
tableLabel,
|
|
weekHeaderClass: ns.e("week-header"),
|
|
getCellClasses,
|
|
getRowKls,
|
|
t
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/props/basic-cell.mjs
|
|
var basicCellProps = buildProps({
|
|
cell: {
|
|
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/date-picker-panel/src/date-picker-com/basic-cell-render.mjs
|
|
var ElDatePickerCell = defineComponent({
|
|
name: "ElDatePickerCell",
|
|
props: basicCellProps,
|
|
setup(props) {
|
|
const ns = useNamespace("date-table-cell");
|
|
const {
|
|
slots
|
|
} = inject(ROOT_PICKER_INJECTION_KEY);
|
|
return () => {
|
|
const {
|
|
cell
|
|
} = props;
|
|
return renderSlot(slots, "default", {
|
|
...cell
|
|
}, () => {
|
|
var _a;
|
|
return [createVNode("div", {
|
|
"class": ns.b()
|
|
}, [createVNode("span", {
|
|
"class": ns.e("text")
|
|
}, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/basic-date-table.mjs
|
|
var _sfc_main = defineComponent({
|
|
__name: "basic-date-table",
|
|
props: basicDateTableProps,
|
|
emits: basicDateTableEmits,
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const {
|
|
WEEKS,
|
|
rows,
|
|
tbodyRef,
|
|
currentCellRef,
|
|
focus,
|
|
isCurrent,
|
|
isWeekActive,
|
|
isSelectedCell,
|
|
handlePickDate,
|
|
handleMouseUp,
|
|
handleMouseDown,
|
|
handleMouseMove,
|
|
handleFocus
|
|
} = useBasicDateTable(props, emit);
|
|
const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTableDOM(props, {
|
|
isCurrent,
|
|
isWeekActive
|
|
});
|
|
let isUnmounting = false;
|
|
onBeforeUnmount(() => {
|
|
isUnmounting = true;
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
"aria-label": unref(tableLabel),
|
|
class: normalizeClass(unref(tableKls)),
|
|
cellspacing: "0",
|
|
cellpadding: "0",
|
|
role: "grid",
|
|
onClick: unref(handlePickDate),
|
|
onMousemove: unref(handleMouseMove),
|
|
onMousedown: unref(handleMouseDown),
|
|
onMouseup: unref(handleMouseUp)
|
|
}, [
|
|
createBaseVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
createBaseVNode("tr", null, [
|
|
_ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
|
|
key: 0,
|
|
scope: "col",
|
|
class: normalizeClass(unref(weekHeaderClass))
|
|
}, null, 2)) : createCommentVNode("v-if", true),
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
|
|
return openBlock(), createElementBlock("th", {
|
|
key,
|
|
"aria-label": unref(t)("el.datepicker.weeksFull." + week),
|
|
scope: "col"
|
|
}, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
|
|
}), 128))
|
|
]),
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
|
|
return openBlock(), createElementBlock("tr", {
|
|
key: rowKey,
|
|
class: normalizeClass(unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: `${rowKey}.${columnKey}`,
|
|
ref_for: true,
|
|
ref: (el) => !unref(isUnmounting) && unref(isSelectedCell)(cell) && (currentCellRef.value = el),
|
|
class: normalizeClass(unref(getCellClasses)(cell)),
|
|
"aria-current": cell.isCurrent ? "date" : void 0,
|
|
"aria-selected": cell.isCurrent,
|
|
tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
|
|
onFocus: unref(handleFocus)
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
|
|
], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
|
|
}), 128))
|
|
], 2);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
|
|
};
|
|
}
|
|
});
|
|
var DateTable = _export_sfc(_sfc_main, [["__file", "basic-date-table.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/basic-month-table.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/date-picker-panel/src/props/basic-month-table.mjs
|
|
var basicMonthTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
selectionMode: selectionModeWithDefault("month")
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/basic-month-table.mjs
|
|
var _sfc_main2 = defineComponent({
|
|
__name: "basic-month-table",
|
|
props: basicMonthTableProps,
|
|
emits: ["changerange", "pick", "select"],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const ns = useNamespace("month-table");
|
|
const { t, lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
|
|
const tableRows = ref([[], [], []]);
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const rows = computed(() => {
|
|
var _a, _b, _c;
|
|
const rows2 = tableRows.value;
|
|
const now = (0, import_dayjs3.default)().locale(lang.value).startOf("month");
|
|
for (let i = 0; i < 3; i++) {
|
|
const row = rows2[i];
|
|
for (let j = 0; j < 4; j++) {
|
|
const cell = row[j] || (row[j] = {
|
|
row: i,
|
|
column: j,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false,
|
|
text: -1,
|
|
disabled: false,
|
|
isSelected: false,
|
|
customClass: void 0,
|
|
date: void 0,
|
|
dayjs: void 0,
|
|
isCurrent: void 0,
|
|
selected: void 0,
|
|
renderText: void 0,
|
|
timestamp: void 0
|
|
});
|
|
cell.type = "normal";
|
|
const index = i * 4 + j;
|
|
const calTime = props.date.startOf("year").month(index);
|
|
const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
|
|
cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month"));
|
|
if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
|
|
cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
|
|
cell.end = props.minDate && calTime.isSame(props.minDate, "month");
|
|
} else {
|
|
cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
|
|
cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
|
|
}
|
|
const isToday = now.isSame(calTime);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
const cellDate = calTime.toDate();
|
|
cell.text = index;
|
|
cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
|
|
cell.date = cellDate;
|
|
cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
|
|
cell.dayjs = calTime;
|
|
cell.timestamp = calTime.valueOf();
|
|
cell.isSelected = isSelectedCell(cell);
|
|
}
|
|
}
|
|
return rows2;
|
|
});
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = currentCellRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const getCellStyle = (cell) => {
|
|
const style = {};
|
|
const year = props.date.year();
|
|
const today = /* @__PURE__ */ new Date();
|
|
const month = cell.text;
|
|
style.disabled = props.disabled || (props.disabledDate ? datesInMonth(props.date, year, month, lang.value).every(props.disabledDate) : false);
|
|
style.current = castArray(props.parsedValue).some((date) => import_dayjs3.default.isDayjs(date) && date.year() === year && date.month() === month);
|
|
style.today = today.getFullYear() === year && today.getMonth() === month;
|
|
if (cell.customClass) {
|
|
style[cell.customClass] = true;
|
|
}
|
|
if (cell.inRange) {
|
|
style["in-range"] = true;
|
|
if (cell.start) {
|
|
style["start-date"] = true;
|
|
}
|
|
if (cell.end) {
|
|
style["end-date"] = true;
|
|
}
|
|
}
|
|
return style;
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
const year = props.date.year();
|
|
const month = cell.text;
|
|
return castArray(props.date).some((date) => date.year() === year && date.month() === month);
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
let target = event.target;
|
|
if (target.tagName === "SPAN") {
|
|
target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
|
|
}
|
|
if (target.tagName === "DIV") {
|
|
target = target.parentNode;
|
|
}
|
|
if (target.tagName !== "TD")
|
|
return;
|
|
const row = target.parentNode.rowIndex;
|
|
const column = target.cellIndex;
|
|
if (rows.value[row][column].disabled)
|
|
return;
|
|
if (row !== lastRow.value || column !== lastColumn.value) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: props.date.startOf("year").month(row * 4 + column)
|
|
});
|
|
}
|
|
};
|
|
const handleMonthTableClick = (event) => {
|
|
var _a;
|
|
if (props.disabled)
|
|
return;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if ((target == null ? void 0 : target.tagName) !== "TD")
|
|
return;
|
|
if (hasClass(target, "disabled"))
|
|
return;
|
|
const column = target.cellIndex;
|
|
const row = target.parentNode.rowIndex;
|
|
const month = row * 4 + column;
|
|
const newDate = props.date.startOf("year").month(month);
|
|
if (props.selectionMode === "months") {
|
|
if (event.type === "keydown") {
|
|
emit("pick", castArray(props.parsedValue), false);
|
|
return;
|
|
}
|
|
const newMonth = getValidDateOfMonth(props.date, props.date.year(), month, lang.value, props.disabledDate);
|
|
const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== newMonth.year() || (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([(0, import_dayjs3.default)(newMonth)]);
|
|
emit("pick", newValue);
|
|
} else if (props.selectionMode === "range") {
|
|
if (!props.rangeState.selecting) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (props.minDate && newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
} else {
|
|
emit("pick", month);
|
|
}
|
|
};
|
|
watch(() => props.date, async () => {
|
|
var _a, _b;
|
|
if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
|
|
await nextTick();
|
|
(_b = currentCellRef.value) == null ? void 0 : _b.focus();
|
|
}
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
role: "grid",
|
|
"aria-label": unref(t)("el.datepicker.monthTablePrompt"),
|
|
class: normalizeClass(unref(ns).b()),
|
|
onClick: handleMonthTableClick,
|
|
onMousemove: handleMouseMove
|
|
}, [
|
|
createBaseVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
|
|
return openBlock(), createElementBlock("tr", { key }, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: key_,
|
|
ref_for: true,
|
|
ref: (el) => cell.isSelected && (currentCellRef.value = el),
|
|
class: normalizeClass(getCellStyle(cell)),
|
|
"aria-selected": !!cell.isSelected,
|
|
"aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
|
|
tabindex: cell.isSelected ? 0 : -1,
|
|
onKeydown: [
|
|
withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
|
|
withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
|
|
]
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), {
|
|
cell: {
|
|
...cell,
|
|
renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
|
|
}
|
|
}, null, 8, ["cell"])
|
|
], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
|
|
}), 128))
|
|
]);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label"]);
|
|
};
|
|
}
|
|
});
|
|
var MonthTable = _export_sfc(_sfc_main2, [["__file", "basic-month-table.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/basic-year-table.mjs
|
|
var import_dayjs4 = __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/date-picker-panel/src/props/basic-year-table.mjs
|
|
var basicYearTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
selectionMode: selectionModeWithDefault("year")
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/basic-year-table.mjs
|
|
var _sfc_main3 = defineComponent({
|
|
__name: "basic-year-table",
|
|
props: basicYearTableProps,
|
|
emits: ["changerange", "pick", "select"],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const datesInYear = (year, lang2) => {
|
|
const firstDay = (0, import_dayjs4.default)(String(year)).locale(lang2).startOf("year");
|
|
const lastDay = firstDay.endOf("year");
|
|
const numOfDays = lastDay.dayOfYear();
|
|
return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
|
|
};
|
|
const ns = useNamespace("year-table");
|
|
const { t, lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const startYear = computed(() => {
|
|
return Math.floor(props.date.year() / 10) * 10;
|
|
});
|
|
const tableRows = ref([[], [], []]);
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const rows = computed(() => {
|
|
var _a, _b, _c;
|
|
const rows2 = tableRows.value;
|
|
const now = (0, import_dayjs4.default)().locale(lang.value).startOf("year");
|
|
for (let i = 0; i < 3; i++) {
|
|
const row = rows2[i];
|
|
for (let j = 0; j < 4; j++) {
|
|
if (i * 4 + j >= 10) {
|
|
break;
|
|
}
|
|
let cell = row[j];
|
|
if (!cell) {
|
|
cell = {
|
|
row: i,
|
|
column: j,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false,
|
|
text: -1,
|
|
disabled: false,
|
|
isSelected: false,
|
|
customClass: void 0,
|
|
date: void 0,
|
|
dayjs: void 0,
|
|
isCurrent: void 0,
|
|
selected: void 0,
|
|
renderText: void 0,
|
|
timestamp: void 0
|
|
};
|
|
}
|
|
cell.type = "normal";
|
|
const index = i * 4 + j + startYear.value;
|
|
const calTime = (0, import_dayjs4.default)().year(index);
|
|
const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
|
|
cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
|
|
if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
|
|
cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
|
|
cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
|
|
} else {
|
|
cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
|
|
cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
|
|
}
|
|
const isToday = now.isSame(calTime);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
cell.text = index;
|
|
const cellDate = calTime.toDate();
|
|
cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
|
|
cell.date = cellDate;
|
|
cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
|
|
cell.dayjs = calTime;
|
|
cell.timestamp = calTime.valueOf();
|
|
cell.isSelected = isSelectedCell(cell);
|
|
row[j] = cell;
|
|
}
|
|
}
|
|
return rows2;
|
|
});
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = currentCellRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const getCellKls = (cell) => {
|
|
const kls = {};
|
|
const today = (0, import_dayjs4.default)().locale(lang.value);
|
|
const year = cell.text;
|
|
kls.disabled = props.disabled || (props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false);
|
|
kls.today = today.year() === year;
|
|
kls.current = castArray(props.parsedValue).some((d) => d.year() === year);
|
|
if (cell.customClass) {
|
|
kls[cell.customClass] = true;
|
|
}
|
|
if (cell.inRange) {
|
|
kls["in-range"] = true;
|
|
if (cell.start) {
|
|
kls["start-date"] = true;
|
|
}
|
|
if (cell.end) {
|
|
kls["end-date"] = true;
|
|
}
|
|
}
|
|
return kls;
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
const year = cell.text;
|
|
return castArray(props.date).some((date) => date.year() === year);
|
|
};
|
|
const handleYearTableClick = (event) => {
|
|
var _a;
|
|
if (props.disabled)
|
|
return;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if (!target || !target.textContent || hasClass(target, "disabled"))
|
|
return;
|
|
const column = target.cellIndex;
|
|
const row = target.parentNode.rowIndex;
|
|
const selectedYear = row * 4 + column + startYear.value;
|
|
const newDate = (0, import_dayjs4.default)().year(selectedYear);
|
|
if (props.selectionMode === "range") {
|
|
if (!props.rangeState.selecting) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (props.minDate && newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
} else if (props.selectionMode === "years") {
|
|
if (event.type === "keydown") {
|
|
emit("pick", castArray(props.parsedValue), false);
|
|
return;
|
|
}
|
|
const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
|
|
const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
|
|
emit("pick", newValue);
|
|
} else {
|
|
emit("pick", selectedYear);
|
|
}
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if (!target)
|
|
return;
|
|
const row = target.parentNode.rowIndex;
|
|
const column = target.cellIndex;
|
|
if (rows.value[row][column].disabled)
|
|
return;
|
|
if (row !== lastRow.value || column !== lastColumn.value) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: (0, import_dayjs4.default)().year(startYear.value).add(row * 4 + column, "year")
|
|
});
|
|
}
|
|
};
|
|
watch(() => props.date, async () => {
|
|
var _a, _b;
|
|
if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
|
|
await nextTick();
|
|
(_b = currentCellRef.value) == null ? void 0 : _b.focus();
|
|
}
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
role: "grid",
|
|
"aria-label": unref(t)("el.datepicker.yearTablePrompt"),
|
|
class: normalizeClass(unref(ns).b()),
|
|
onClick: handleYearTableClick,
|
|
onMousemove: handleMouseMove
|
|
}, [
|
|
createBaseVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
|
|
return openBlock(), createElementBlock("tr", { key: rowKey }, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: `${rowKey}_${cellKey}`,
|
|
ref_for: true,
|
|
ref: (el) => cell.isSelected && (currentCellRef.value = el),
|
|
class: normalizeClass(["available", getCellKls(cell)]),
|
|
"aria-selected": cell.isSelected,
|
|
"aria-label": String(cell.text),
|
|
tabindex: cell.isSelected ? 0 : -1,
|
|
onKeydown: [
|
|
withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
|
|
withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
|
|
]
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
|
|
], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
|
|
}), 128))
|
|
]);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label"]);
|
|
};
|
|
}
|
|
});
|
|
var YearTable = _export_sfc(_sfc_main3, [["__file", "basic-year-table.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-date-pick.mjs
|
|
init_shared_esm_bundler();
|
|
var _sfc_main4 = defineComponent({
|
|
__name: "panel-date-pick",
|
|
props: panelDatePickProps,
|
|
emits: ["pick", "set-picker-option", "panel-change"],
|
|
setup(__props, { emit: contextEmit }) {
|
|
const props = __props;
|
|
const timeWithinRange = (_, __, ___) => true;
|
|
const ppNs = useNamespace("picker-panel");
|
|
const dpNs = useNamespace("date-picker");
|
|
const attrs = useAttrs();
|
|
const slots = useSlots();
|
|
const { t, lang } = useLocale();
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
|
|
const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const currentViewRef = ref();
|
|
const innerDate = ref((0, import_dayjs5.default)().locale(lang.value));
|
|
const isChangeToNow = ref(false);
|
|
let isShortcut = false;
|
|
const defaultTimeD = computed(() => {
|
|
return (0, import_dayjs5.default)(defaultTime).locale(lang.value);
|
|
});
|
|
const month = computed(() => {
|
|
return innerDate.value.month();
|
|
});
|
|
const year = computed(() => {
|
|
return innerDate.value.year();
|
|
});
|
|
const selectableRange = ref([]);
|
|
const userInputDate = ref(null);
|
|
const userInputTime = ref(null);
|
|
const checkDateWithinRange = (date) => {
|
|
return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
|
|
};
|
|
const formatEmit = (emitDayjs) => {
|
|
if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
|
|
return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
|
|
}
|
|
if (showTime.value)
|
|
return emitDayjs.millisecond(0);
|
|
return emitDayjs.startOf("day");
|
|
};
|
|
const emit = (value, ...args) => {
|
|
if (!value) {
|
|
contextEmit("pick", value, ...args);
|
|
} else if (isArray(value)) {
|
|
const dates = value.map(formatEmit);
|
|
contextEmit("pick", dates, ...args);
|
|
} else {
|
|
contextEmit("pick", formatEmit(value), ...args);
|
|
}
|
|
userInputDate.value = null;
|
|
userInputTime.value = null;
|
|
isChangeToNow.value = false;
|
|
isShortcut = false;
|
|
};
|
|
const handleDatePick = async (value, keepOpen) => {
|
|
if (selectionMode.value === "date" && import_dayjs5.default.isDayjs(value)) {
|
|
const parsedDateValue = extractFirst(props.parsedValue);
|
|
let newDate = parsedDateValue ? parsedDateValue.year(value.year()).month(value.month()).date(value.date()) : value;
|
|
if (!checkDateWithinRange(newDate)) {
|
|
newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
|
|
}
|
|
innerDate.value = newDate;
|
|
emit(newDate, showTime.value || keepOpen);
|
|
} else if (selectionMode.value === "week") {
|
|
emit(value.date);
|
|
} else if (selectionMode.value === "dates") {
|
|
emit(value, true);
|
|
}
|
|
};
|
|
const moveByMonth = (forward) => {
|
|
const action = forward ? "add" : "subtract";
|
|
innerDate.value = innerDate.value[action](1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const moveByYear = (forward) => {
|
|
const currentDate = innerDate.value;
|
|
const action = forward ? "add" : "subtract";
|
|
innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
|
|
handlePanelChange("year");
|
|
};
|
|
const currentView = ref("date");
|
|
const yearLabel = computed(() => {
|
|
const yearTranslation = t("el.datepicker.year");
|
|
if (currentView.value === "year") {
|
|
const startYear = Math.floor(year.value / 10) * 10;
|
|
if (yearTranslation) {
|
|
return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
|
|
}
|
|
return `${startYear} - ${startYear + 9}`;
|
|
}
|
|
return `${year.value} ${yearTranslation}`;
|
|
});
|
|
const handleShortcutClick = (shortcut) => {
|
|
const shortcutValue = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
|
|
if (shortcutValue) {
|
|
isShortcut = true;
|
|
emit((0, import_dayjs5.default)(shortcutValue).locale(lang.value));
|
|
return;
|
|
}
|
|
if (shortcut.onClick) {
|
|
shortcut.onClick({
|
|
attrs,
|
|
slots,
|
|
emit: contextEmit
|
|
});
|
|
}
|
|
};
|
|
const selectionMode = computed(() => {
|
|
const { type } = props;
|
|
if (["week", "month", "months", "year", "years", "dates"].includes(type))
|
|
return type;
|
|
return "date";
|
|
});
|
|
const isMultipleType = computed(() => {
|
|
return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
|
|
});
|
|
const keyboardMode = computed(() => {
|
|
return selectionMode.value === "date" ? currentView.value : selectionMode.value;
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const handleMonthPick = async (month2, keepOpen) => {
|
|
if (selectionMode.value === "month") {
|
|
innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
|
|
emit(innerDate.value, false);
|
|
} else if (selectionMode.value === "months") {
|
|
emit(month2, keepOpen != null ? keepOpen : true);
|
|
} else {
|
|
innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
|
|
currentView.value = "date";
|
|
if (["month", "year", "date", "week"].includes(selectionMode.value)) {
|
|
emit(innerDate.value, true);
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
}
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const handleYearPick = async (year2, keepOpen) => {
|
|
if (selectionMode.value === "year") {
|
|
const data = innerDate.value.startOf("year").year(year2);
|
|
innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
|
|
emit(innerDate.value, false);
|
|
} else if (selectionMode.value === "years") {
|
|
emit(year2, keepOpen != null ? keepOpen : true);
|
|
} else {
|
|
const data = innerDate.value.year(year2);
|
|
innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
|
|
currentView.value = "month";
|
|
if (["month", "year", "date", "week"].includes(selectionMode.value)) {
|
|
emit(innerDate.value, true);
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
}
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const showPicker = async (view) => {
|
|
if (props.disabled)
|
|
return;
|
|
currentView.value = view;
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
};
|
|
const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
|
|
const footerVisible = computed(() => {
|
|
const showDateFooter = showTime.value || selectionMode.value === "dates";
|
|
const showYearFooter = selectionMode.value === "years";
|
|
const showMonthFooter = selectionMode.value === "months";
|
|
const isDateView = currentView.value === "date";
|
|
const isYearView = currentView.value === "year";
|
|
const isMonthView = currentView.value === "month";
|
|
return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
|
|
});
|
|
const footerFilled = computed(() => !isMultipleType.value && props.showNow || props.showConfirm);
|
|
const disabledConfirm = computed(() => {
|
|
if (!disabledDate)
|
|
return false;
|
|
if (!props.parsedValue)
|
|
return true;
|
|
if (isArray(props.parsedValue)) {
|
|
return disabledDate(props.parsedValue[0].toDate());
|
|
}
|
|
return disabledDate(props.parsedValue.toDate());
|
|
});
|
|
const onConfirm = () => {
|
|
if (isMultipleType.value) {
|
|
emit(props.parsedValue);
|
|
} else {
|
|
let result = extractFirst(props.parsedValue);
|
|
if (!result) {
|
|
const defaultTimeD2 = (0, import_dayjs5.default)(defaultTime).locale(lang.value);
|
|
const defaultValueD = getDefaultValue2();
|
|
result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
|
|
}
|
|
innerDate.value = result;
|
|
emit(result);
|
|
}
|
|
};
|
|
const disabledNow = computed(() => {
|
|
if (!disabledDate)
|
|
return false;
|
|
return disabledDate((0, import_dayjs5.default)().locale(lang.value).toDate());
|
|
});
|
|
const changeToNow = () => {
|
|
const now = (0, import_dayjs5.default)().locale(lang.value);
|
|
const nowDate = now.toDate();
|
|
isChangeToNow.value = true;
|
|
if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
|
|
innerDate.value = (0, import_dayjs5.default)().locale(lang.value);
|
|
emit(innerDate.value);
|
|
}
|
|
};
|
|
const timeFormat = computed(() => {
|
|
return props.timeFormat || extractTimeFormat(props.format) || DEFAULT_FORMATS_TIME;
|
|
});
|
|
const dateFormat = computed(() => {
|
|
return props.dateFormat || extractDateFormat(props.format) || DEFAULT_FORMATS_DATE;
|
|
});
|
|
const visibleTime = computed(() => {
|
|
if (userInputTime.value)
|
|
return userInputTime.value;
|
|
if (!props.parsedValue && !defaultValue.value)
|
|
return;
|
|
const dateValue = extractFirst(props.parsedValue) || innerDate.value;
|
|
return dateValue.format(timeFormat.value);
|
|
});
|
|
const visibleDate = computed(() => {
|
|
if (userInputDate.value)
|
|
return userInputDate.value;
|
|
if (!props.parsedValue && !defaultValue.value)
|
|
return;
|
|
const dateValue = extractFirst(props.parsedValue) || innerDate.value;
|
|
return dateValue.format(dateFormat.value);
|
|
});
|
|
const timePickerVisible = ref(false);
|
|
const onTimePickerInputFocus = () => {
|
|
timePickerVisible.value = true;
|
|
};
|
|
const handleTimePickClose = () => {
|
|
timePickerVisible.value = false;
|
|
};
|
|
const getUnits = (date) => {
|
|
return {
|
|
hour: date.hour(),
|
|
minute: date.minute(),
|
|
second: date.second(),
|
|
year: date.year(),
|
|
month: date.month(),
|
|
date: date.date()
|
|
};
|
|
};
|
|
const handleTimePick = (value, visible, first) => {
|
|
const { hour, minute, second } = getUnits(value);
|
|
const parsedDateValue = extractFirst(props.parsedValue);
|
|
const newDate = parsedDateValue ? parsedDateValue.hour(hour).minute(minute).second(second) : value;
|
|
innerDate.value = newDate;
|
|
emit(innerDate.value, true);
|
|
if (!first) {
|
|
timePickerVisible.value = visible;
|
|
}
|
|
};
|
|
const handleVisibleTimeChange = (value) => {
|
|
const newDate = (0, import_dayjs5.default)(value, timeFormat.value).locale(lang.value);
|
|
if (newDate.isValid() && checkDateWithinRange(newDate)) {
|
|
const { year: year2, month: month2, date } = getUnits(innerDate.value);
|
|
innerDate.value = newDate.year(year2).month(month2).date(date);
|
|
userInputTime.value = null;
|
|
timePickerVisible.value = false;
|
|
emit(innerDate.value, true);
|
|
}
|
|
};
|
|
const handleVisibleDateChange = (value) => {
|
|
const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
|
|
if (newDate.isValid()) {
|
|
if (disabledDate && disabledDate(newDate.toDate())) {
|
|
return;
|
|
}
|
|
const { hour, minute, second } = getUnits(innerDate.value);
|
|
innerDate.value = newDate.hour(hour).minute(minute).second(second);
|
|
userInputDate.value = null;
|
|
emit(innerDate.value, true);
|
|
}
|
|
};
|
|
const isValidValue = (date) => {
|
|
return import_dayjs5.default.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
|
|
};
|
|
const getDefaultValue2 = () => {
|
|
const parseDate = (0, import_dayjs5.default)(defaultValue.value).locale(lang.value);
|
|
if (!defaultValue.value) {
|
|
const defaultTimeDValue = defaultTimeD.value;
|
|
return (0, import_dayjs5.default)().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
|
|
}
|
|
return parseDate;
|
|
};
|
|
const handleFocusPicker = () => {
|
|
var _a;
|
|
if (["week", "month", "year", "date"].includes(selectionMode.value)) {
|
|
(_a = currentViewRef.value) == null ? void 0 : _a.focus();
|
|
}
|
|
};
|
|
const _handleFocusPicker = () => {
|
|
handleFocusPicker();
|
|
if (selectionMode.value === "week") {
|
|
handleKeyControl(EVENT_CODE.down);
|
|
}
|
|
};
|
|
const handleKeydownTable = (event) => {
|
|
const code = getEventCode(event);
|
|
const validCode = [
|
|
EVENT_CODE.up,
|
|
EVENT_CODE.down,
|
|
EVENT_CODE.left,
|
|
EVENT_CODE.right,
|
|
EVENT_CODE.home,
|
|
EVENT_CODE.end,
|
|
EVENT_CODE.pageUp,
|
|
EVENT_CODE.pageDown
|
|
];
|
|
if (validCode.includes(code)) {
|
|
handleKeyControl(code);
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
}
|
|
if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
|
|
event.preventDefault();
|
|
emit(innerDate.value, false);
|
|
}
|
|
};
|
|
const handleKeyControl = (code) => {
|
|
var _a;
|
|
const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
|
|
const mapping = {
|
|
year: {
|
|
[up]: -4,
|
|
[down]: 4,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step2) => date.setFullYear(date.getFullYear() + step2)
|
|
},
|
|
month: {
|
|
[up]: -4,
|
|
[down]: 4,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step2) => date.setMonth(date.getMonth() + step2)
|
|
},
|
|
week: {
|
|
[up]: -1,
|
|
[down]: 1,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step2) => date.setDate(date.getDate() + step2 * 7)
|
|
},
|
|
date: {
|
|
[up]: -7,
|
|
[down]: 7,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
[home]: (date) => -date.getDay(),
|
|
[end]: (date) => -date.getDay() + 6,
|
|
[pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
|
|
[pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
|
|
offset: (date, step2) => date.setDate(date.getDate() + step2)
|
|
}
|
|
};
|
|
const newDate = innerDate.value.toDate();
|
|
while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
|
|
const map = mapping[keyboardMode.value];
|
|
if (!map)
|
|
return;
|
|
map.offset(newDate, isFunction(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
|
|
if (disabledDate && disabledDate(newDate)) {
|
|
break;
|
|
}
|
|
const result = (0, import_dayjs5.default)(newDate).locale(lang.value);
|
|
innerDate.value = result;
|
|
contextEmit("pick", result, true);
|
|
break;
|
|
}
|
|
};
|
|
const handlePanelChange = (mode) => {
|
|
contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
|
|
};
|
|
watch(() => selectionMode.value, (val) => {
|
|
if (["month", "year"].includes(val)) {
|
|
currentView.value = val;
|
|
return;
|
|
} else if (val === "years") {
|
|
currentView.value = "year";
|
|
return;
|
|
} else if (val === "months") {
|
|
currentView.value = "month";
|
|
return;
|
|
}
|
|
currentView.value = "date";
|
|
}, { immediate: true });
|
|
watch(() => defaultValue.value, (val) => {
|
|
if (val) {
|
|
innerDate.value = getDefaultValue2();
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => props.parsedValue, (val) => {
|
|
if (val) {
|
|
if (isMultipleType.value)
|
|
return;
|
|
if (isArray(val))
|
|
return;
|
|
innerDate.value = val;
|
|
} else {
|
|
innerDate.value = getDefaultValue2();
|
|
}
|
|
}, { immediate: true });
|
|
contextEmit("set-picker-option", ["isValidValue", isValidValue]);
|
|
contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(dpNs).b(),
|
|
unref(ppNs).is("border", _ctx.border),
|
|
unref(ppNs).is("disabled", _ctx.disabled),
|
|
{
|
|
"has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
|
|
"has-time": unref(showTime)
|
|
}
|
|
])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
disabled: _ctx.disabled,
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => handleShortcutClick(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
unref(showTime) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(dpNs).e("time-header"))
|
|
}, [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("editor-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
placeholder: unref(t)("el.datepicker.selectDate"),
|
|
"model-value": unref(visibleDate),
|
|
size: "small",
|
|
"validate-event": false,
|
|
disabled: _ctx.disabled,
|
|
onInput: (val) => userInputDate.value = val,
|
|
onChange: handleVisibleDateChange
|
|
}, null, 8, ["placeholder", "model-value", "disabled", "onInput"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(dpNs).e("editor-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
placeholder: unref(t)("el.datepicker.selectTime"),
|
|
"model-value": unref(visibleTime),
|
|
size: "small",
|
|
"validate-event": false,
|
|
disabled: _ctx.disabled,
|
|
onFocus: onTimePickerInputFocus,
|
|
onInput: (val) => userInputTime.value = val,
|
|
onChange: handleVisibleTimeChange
|
|
}, null, 8, ["placeholder", "model-value", "disabled", "onInput"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
visible: timePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"parsed-value": innerDate.value,
|
|
onPick: handleTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleTimePickClose]
|
|
])
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
withDirectives(createBaseVNode("div", {
|
|
class: normalizeClass([
|
|
unref(dpNs).e("header"),
|
|
(currentView.value === "year" || currentView.value === "month") && unref(dpNs).em("header", "bordered")
|
|
])
|
|
}, [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("prev-btn"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => moveByYear(false)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled", "onClick"]),
|
|
withDirectives(createBaseVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => moveByMonth(false)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
])
|
|
], 2),
|
|
createBaseVNode("span", {
|
|
role: "button",
|
|
class: normalizeClass(unref(dpNs).e("header-label")),
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
onKeydown: withKeys(($event) => showPicker("year"), ["enter"]),
|
|
onClick: ($event) => showPicker("year")
|
|
}, toDisplayString(unref(yearLabel)), 43, ["onKeydown", "onClick"]),
|
|
withDirectives(createBaseVNode("span", {
|
|
role: "button",
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
class: normalizeClass([
|
|
unref(dpNs).e("header-label"),
|
|
{ active: currentView.value === "month" }
|
|
]),
|
|
onKeydown: withKeys(($event) => showPicker("month"), ["enter"]),
|
|
onClick: ($event) => showPicker("month")
|
|
}, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
]),
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("next-btn"))
|
|
}, [
|
|
withDirectives(createBaseVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => moveByMonth(true)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
]),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => moveByYear(true)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled", "onClick"])
|
|
], 2)
|
|
], 2), [
|
|
[vShow, currentView.value !== "time"]
|
|
]),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("content")),
|
|
onKeydown: handleKeydownTable
|
|
}, [
|
|
currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
|
|
key: 0,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
"show-week-number": _ctx.showWeekNumber,
|
|
onPick: handleDatePick
|
|
}, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name", "show-week-number"])) : createCommentVNode("v-if", true),
|
|
currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
|
|
key: 1,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"cell-class-name": unref(cellClassName),
|
|
onPick: handleYearPick
|
|
}, null, 8, ["selection-mode", "date", "disabled-date", "disabled", "parsed-value", "cell-class-name"])) : createCommentVNode("v-if", true),
|
|
currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
|
|
key: 2,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
onPick: handleMonthPick
|
|
}, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name"])) : createCommentVNode("v-if", true)
|
|
], 34)
|
|
], 2)
|
|
], 2),
|
|
_ctx.showFooter && unref(footerVisible) && unref(footerFilled) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("footer"))
|
|
}, [
|
|
withDirectives(createVNode(unref(ElButton), {
|
|
text: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(disabledNow),
|
|
onClick: changeToNow
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled"]), [
|
|
[vShow, !unref(isMultipleType) && _ctx.showNow]
|
|
]),
|
|
_ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
|
|
key: 0,
|
|
plain: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(disabledConfirm),
|
|
onClick: onConfirm
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var DatePickPanel = _export_sfc(_sfc_main4, [["__file", "panel-date-pick.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-date-range.mjs
|
|
var import_dayjs8 = __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/date-picker-panel/src/props/panel-date-range.mjs
|
|
var panelDateRangeProps = buildProps({
|
|
...panelSharedProps,
|
|
...panelRangeSharedProps
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-range-picker.mjs
|
|
var import_dayjs7 = __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/date-picker-panel/src/composables/use-shortcut.mjs
|
|
var import_dayjs6 = __toESM(require_dayjs_min(), 1);
|
|
init_shared_esm_bundler();
|
|
var useShortcut = (lang) => {
|
|
const { emit } = getCurrentInstance();
|
|
const attrs = useAttrs();
|
|
const slots = useSlots();
|
|
const handleShortcutClick = (shortcut) => {
|
|
const shortcutValues = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
|
|
if (shortcutValues) {
|
|
emit("pick", [
|
|
(0, import_dayjs6.default)(shortcutValues[0]).locale(lang.value),
|
|
(0, import_dayjs6.default)(shortcutValues[1]).locale(lang.value)
|
|
]);
|
|
return;
|
|
}
|
|
if (shortcut.onClick) {
|
|
shortcut.onClick({
|
|
attrs,
|
|
slots,
|
|
emit
|
|
});
|
|
}
|
|
};
|
|
return handleShortcutClick;
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-range-picker.mjs
|
|
init_shared_esm_bundler();
|
|
var useRangePicker = (props, {
|
|
defaultValue,
|
|
defaultTime,
|
|
leftDate,
|
|
rightDate,
|
|
step: step2,
|
|
unit: unit4,
|
|
sortDates
|
|
}) => {
|
|
const { emit } = getCurrentInstance();
|
|
const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
|
|
const drpNs = useNamespace("date-range-picker");
|
|
const { t, lang } = useLocale();
|
|
const handleShortcutClick = useShortcut(lang);
|
|
const minDate = ref();
|
|
const maxDate = ref();
|
|
const rangeState = ref({
|
|
endDate: null,
|
|
selecting: false
|
|
});
|
|
const handleChangeRange = (val) => {
|
|
rangeState.value = val;
|
|
};
|
|
const handleRangeConfirm = (visible = false) => {
|
|
const _minDate = unref(minDate);
|
|
const _maxDate = unref(maxDate);
|
|
if (isValidRange([_minDate, _maxDate])) {
|
|
emit("pick", [_minDate, _maxDate], visible);
|
|
}
|
|
};
|
|
const onSelect = (selecting) => {
|
|
rangeState.value.selecting = selecting;
|
|
if (!selecting) {
|
|
rangeState.value.endDate = null;
|
|
}
|
|
};
|
|
const parseValue = (parsedValue) => {
|
|
if (isArray(parsedValue) && parsedValue.length === 2) {
|
|
const [start, end] = parsedValue;
|
|
minDate.value = start;
|
|
leftDate.value = start;
|
|
maxDate.value = end;
|
|
sortDates(unref(minDate), unref(maxDate));
|
|
} else {
|
|
restoreDefault();
|
|
}
|
|
};
|
|
const restoreDefault = () => {
|
|
let [start, end] = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
step: step2,
|
|
unit: unit4,
|
|
unlinkPanels: props.unlinkPanels
|
|
});
|
|
const getShift = (day) => {
|
|
return day.diff(day.startOf("d"), "ms");
|
|
};
|
|
const maybeTimes = unref(defaultTime);
|
|
if (maybeTimes) {
|
|
let leftShift = 0;
|
|
let rightShift = 0;
|
|
if (isArray(maybeTimes)) {
|
|
const [timeStart, timeEnd] = maybeTimes.map(import_dayjs7.default);
|
|
leftShift = getShift(timeStart);
|
|
rightShift = getShift(timeEnd);
|
|
} else {
|
|
const shift = getShift((0, import_dayjs7.default)(maybeTimes));
|
|
leftShift = shift;
|
|
rightShift = shift;
|
|
}
|
|
start = start.startOf("d").add(leftShift, "ms");
|
|
end = end.startOf("d").add(rightShift, "ms");
|
|
}
|
|
minDate.value = void 0;
|
|
maxDate.value = void 0;
|
|
leftDate.value = start;
|
|
rightDate.value = end;
|
|
};
|
|
watch(defaultValue, (val) => {
|
|
if (val) {
|
|
restoreDefault();
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => props.parsedValue, (parsedValue) => {
|
|
if (!(parsedValue == null ? void 0 : parsedValue.length) || !isEqual_default(parsedValue, [minDate.value, maxDate.value])) {
|
|
parseValue(parsedValue);
|
|
}
|
|
}, {
|
|
immediate: true
|
|
});
|
|
watch(() => props.visible, () => {
|
|
if (props.visible) {
|
|
parseValue(props.parsedValue);
|
|
}
|
|
}, { immediate: true });
|
|
return {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
lang,
|
|
ppNs: pickerNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
parseValue,
|
|
t
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-panel-date-range.mjs
|
|
var usePanelDateRange = (props, emit, leftDate, rightDate) => {
|
|
const leftCurrentView = ref("date");
|
|
const leftCurrentViewRef = ref();
|
|
const rightCurrentView = ref("date");
|
|
const rightCurrentViewRef = ref();
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const { disabledDate } = pickerBase.props;
|
|
const { t, lang } = useLocale();
|
|
const leftYear = computed(() => {
|
|
return leftDate.value.year();
|
|
});
|
|
const leftMonth = computed(() => {
|
|
return leftDate.value.month();
|
|
});
|
|
const rightYear = computed(() => {
|
|
return rightDate.value.year();
|
|
});
|
|
const rightMonth = computed(() => {
|
|
return rightDate.value.month();
|
|
});
|
|
function computedYearLabel(currentView, yearValue) {
|
|
const yearTranslation = t("el.datepicker.year");
|
|
if (currentView.value === "year") {
|
|
const startYear = Math.floor(yearValue.value / 10) * 10;
|
|
return yearTranslation ? `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}` : `${startYear} - ${startYear + 9}`;
|
|
}
|
|
return `${yearValue.value} ${yearTranslation}`;
|
|
}
|
|
function focusPicker(currentViewRef) {
|
|
currentViewRef == null ? void 0 : currentViewRef.focus();
|
|
}
|
|
async function showPicker(pickerType, view) {
|
|
if (props.disabled)
|
|
return;
|
|
const currentView = pickerType === "left" ? leftCurrentView : rightCurrentView;
|
|
const currentViewRef = pickerType === "left" ? leftCurrentViewRef : rightCurrentViewRef;
|
|
currentView.value = view;
|
|
await nextTick();
|
|
focusPicker(currentViewRef.value);
|
|
}
|
|
async function handlePick(mode, pickerType, value) {
|
|
if (props.disabled)
|
|
return;
|
|
const isLeftPicker = pickerType === "left";
|
|
const startDate = isLeftPicker ? leftDate : rightDate;
|
|
const endDate = isLeftPicker ? rightDate : leftDate;
|
|
const currentView = isLeftPicker ? leftCurrentView : rightCurrentView;
|
|
const currentViewRef = isLeftPicker ? leftCurrentViewRef : rightCurrentViewRef;
|
|
if (mode === "year") {
|
|
const data = startDate.value.year(value);
|
|
startDate.value = getValidDateOfYear(data, lang.value, disabledDate);
|
|
}
|
|
if (mode === "month") {
|
|
startDate.value = getValidDateOfMonth(startDate.value, startDate.value.year(), value, lang.value, disabledDate);
|
|
}
|
|
if (!props.unlinkPanels) {
|
|
endDate.value = pickerType === "left" ? startDate.value.add(1, "month") : startDate.value.subtract(1, "month");
|
|
}
|
|
currentView.value = mode === "year" ? "month" : "date";
|
|
await nextTick();
|
|
focusPicker(currentViewRef.value);
|
|
handlePanelChange(mode);
|
|
}
|
|
function handlePanelChange(mode) {
|
|
emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
|
|
}
|
|
function adjustDateByView(currentView, date, forward) {
|
|
const action = forward ? "add" : "subtract";
|
|
return currentView === "year" ? date[action](10, "year") : date[action](1, "year");
|
|
}
|
|
return {
|
|
leftCurrentView,
|
|
rightCurrentView,
|
|
leftCurrentViewRef,
|
|
rightCurrentViewRef,
|
|
leftYear,
|
|
rightYear,
|
|
leftMonth,
|
|
rightMonth,
|
|
leftYearLabel: computed(() => computedYearLabel(leftCurrentView, leftYear)),
|
|
rightYearLabel: computed(() => computedYearLabel(rightCurrentView, rightYear)),
|
|
showLeftPicker: (view) => showPicker("left", view),
|
|
showRightPicker: (view) => showPicker("right", view),
|
|
handleLeftYearPick: (year) => handlePick("year", "left", year),
|
|
handleRightYearPick: (year) => handlePick("year", "right", year),
|
|
handleLeftMonthPick: (month) => handlePick("month", "left", month),
|
|
handleRightMonthPick: (month) => handlePick("month", "right", month),
|
|
handlePanelChange,
|
|
adjustDateByView
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-date-range.mjs
|
|
var unit = "month";
|
|
var _sfc_main5 = defineComponent({
|
|
__name: "panel-date-range",
|
|
props: panelDateRangeProps,
|
|
emits: [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change",
|
|
"panel-change"
|
|
],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
|
|
const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const shortcuts = toRef(pickerBase.props, "shortcuts");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const { lang } = useLocale();
|
|
const leftDate = ref((0, import_dayjs8.default)().locale(lang.value));
|
|
const rightDate = ref((0, import_dayjs8.default)().locale(lang.value).add(1, unit));
|
|
const {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
ppNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
parseValue,
|
|
t
|
|
} = useRangePicker(props, {
|
|
defaultValue,
|
|
defaultTime,
|
|
leftDate,
|
|
rightDate,
|
|
unit,
|
|
sortDates
|
|
});
|
|
watch(() => props.visible, (visible) => {
|
|
if (!visible && rangeState.value.selecting) {
|
|
parseValue(props.parsedValue);
|
|
onSelect(false);
|
|
}
|
|
});
|
|
const dateUserInput = ref({
|
|
min: null,
|
|
max: null
|
|
});
|
|
const timeUserInput = ref({
|
|
min: null,
|
|
max: null
|
|
});
|
|
const {
|
|
leftCurrentView,
|
|
rightCurrentView,
|
|
leftCurrentViewRef,
|
|
rightCurrentViewRef,
|
|
leftYear,
|
|
rightYear,
|
|
leftMonth,
|
|
rightMonth,
|
|
leftYearLabel,
|
|
rightYearLabel,
|
|
showLeftPicker,
|
|
showRightPicker,
|
|
handleLeftYearPick,
|
|
handleRightYearPick,
|
|
handleLeftMonthPick,
|
|
handleRightMonthPick,
|
|
handlePanelChange,
|
|
adjustDateByView
|
|
} = usePanelDateRange(props, emit, leftDate, rightDate);
|
|
const hasShortcuts = computed(() => !!shortcuts.value.length);
|
|
const minVisibleDate = computed(() => {
|
|
if (dateUserInput.value.min !== null)
|
|
return dateUserInput.value.min;
|
|
if (minDate.value)
|
|
return minDate.value.format(dateFormat.value);
|
|
return "";
|
|
});
|
|
const maxVisibleDate = computed(() => {
|
|
if (dateUserInput.value.max !== null)
|
|
return dateUserInput.value.max;
|
|
if (maxDate.value || minDate.value)
|
|
return (maxDate.value || minDate.value).format(dateFormat.value);
|
|
return "";
|
|
});
|
|
const minVisibleTime = computed(() => {
|
|
if (timeUserInput.value.min !== null)
|
|
return timeUserInput.value.min;
|
|
if (minDate.value)
|
|
return minDate.value.format(timeFormat.value);
|
|
return "";
|
|
});
|
|
const maxVisibleTime = computed(() => {
|
|
if (timeUserInput.value.max !== null)
|
|
return timeUserInput.value.max;
|
|
if (maxDate.value || minDate.value)
|
|
return (maxDate.value || minDate.value).format(timeFormat.value);
|
|
return "";
|
|
});
|
|
const timeFormat = computed(() => {
|
|
return props.timeFormat || extractTimeFormat(format.value || "") || DEFAULT_FORMATS_TIME;
|
|
});
|
|
const dateFormat = computed(() => {
|
|
return props.dateFormat || extractDateFormat(format.value || "") || DEFAULT_FORMATS_DATE;
|
|
});
|
|
const isValidValue = (date) => {
|
|
return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
|
|
};
|
|
const leftPrevYear = () => {
|
|
leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, false);
|
|
if (!props.unlinkPanels) {
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const leftPrevMonth = () => {
|
|
leftDate.value = leftDate.value.subtract(1, "month");
|
|
if (!props.unlinkPanels) {
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!props.unlinkPanels) {
|
|
leftDate.value = adjustDateByView(rightCurrentView.value, leftDate.value, true);
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
} else {
|
|
rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, true);
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const rightNextMonth = () => {
|
|
if (!props.unlinkPanels) {
|
|
leftDate.value = leftDate.value.add(1, "month");
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
} else {
|
|
rightDate.value = rightDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, true);
|
|
handlePanelChange("year");
|
|
};
|
|
const leftNextMonth = () => {
|
|
leftDate.value = leftDate.value.add(1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, false);
|
|
handlePanelChange("year");
|
|
};
|
|
const rightPrevMonth = () => {
|
|
rightDate.value = rightDate.value.subtract(1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const enableMonthArrow = computed(() => {
|
|
const nextMonth = (leftMonth.value + 1) % 12;
|
|
const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
|
|
return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
|
|
});
|
|
const btnDisabled = computed(() => {
|
|
return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
|
|
});
|
|
const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
|
|
const formatEmit = (emitDayjs, index) => {
|
|
if (!emitDayjs)
|
|
return;
|
|
if (defaultTime) {
|
|
const defaultTimeD = (0, import_dayjs8.default)(defaultTime[index] || defaultTime).locale(lang.value);
|
|
return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
|
|
}
|
|
return emitDayjs;
|
|
};
|
|
const handleRangePick = (val, close = true) => {
|
|
const min_ = val.minDate;
|
|
const max_ = val.maxDate;
|
|
const minDate_ = formatEmit(min_, 0);
|
|
const maxDate_ = formatEmit(max_, 1);
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!showTime.value && close) {
|
|
close = !minDate_ || !maxDate_;
|
|
}
|
|
handleRangeConfirm(close);
|
|
};
|
|
const minTimePickerVisible = ref(false);
|
|
const maxTimePickerVisible = ref(false);
|
|
const handleMinTimeClose = () => {
|
|
minTimePickerVisible.value = false;
|
|
};
|
|
const handleMaxTimeClose = () => {
|
|
maxTimePickerVisible.value = false;
|
|
};
|
|
const handleDateInput = (value, type) => {
|
|
dateUserInput.value[type] = value;
|
|
const parsedValueD = (0, import_dayjs8.default)(value, dateFormat.value).locale(lang.value);
|
|
if (parsedValueD.isValid()) {
|
|
if (disabledDate && disabledDate(parsedValueD.toDate())) {
|
|
return;
|
|
}
|
|
if (type === "min") {
|
|
leftDate.value = parsedValueD;
|
|
minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
|
|
if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
|
|
rightDate.value = parsedValueD.add(1, "month");
|
|
maxDate.value = minDate.value.add(1, "month");
|
|
}
|
|
} else {
|
|
rightDate.value = parsedValueD;
|
|
maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
|
|
if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
|
|
leftDate.value = parsedValueD.subtract(1, "month");
|
|
minDate.value = maxDate.value.subtract(1, "month");
|
|
}
|
|
}
|
|
sortDates(minDate.value, maxDate.value);
|
|
handleRangeConfirm(true);
|
|
}
|
|
};
|
|
const handleDateChange = (_, type) => {
|
|
dateUserInput.value[type] = null;
|
|
};
|
|
const handleTimeInput = (value, type) => {
|
|
timeUserInput.value[type] = value;
|
|
const parsedValueD = (0, import_dayjs8.default)(value, timeFormat.value).locale(lang.value);
|
|
if (parsedValueD.isValid()) {
|
|
if (type === "min") {
|
|
minTimePickerVisible.value = true;
|
|
minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
|
|
leftDate.value = minDate.value;
|
|
} else {
|
|
maxTimePickerVisible.value = true;
|
|
maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
|
|
rightDate.value = maxDate.value;
|
|
}
|
|
}
|
|
};
|
|
const handleTimeChange = (_value, type) => {
|
|
timeUserInput.value[type] = null;
|
|
if (type === "min") {
|
|
leftDate.value = minDate.value;
|
|
minTimePickerVisible.value = false;
|
|
if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
|
|
maxDate.value = minDate.value;
|
|
}
|
|
} else {
|
|
rightDate.value = maxDate.value;
|
|
maxTimePickerVisible.value = false;
|
|
if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
|
|
minDate.value = maxDate.value;
|
|
}
|
|
}
|
|
handleRangeConfirm(true);
|
|
};
|
|
const handleMinTimePick = (value, visible, first) => {
|
|
if (timeUserInput.value.min)
|
|
return;
|
|
if (value) {
|
|
leftDate.value = value;
|
|
minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
|
|
}
|
|
if (!first) {
|
|
minTimePickerVisible.value = visible;
|
|
}
|
|
if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
|
|
maxDate.value = minDate.value;
|
|
rightDate.value = value;
|
|
nextTick(() => {
|
|
parseValue(props.parsedValue);
|
|
});
|
|
}
|
|
handleRangeConfirm(true);
|
|
};
|
|
const handleMaxTimePick = (value, visible, first) => {
|
|
if (timeUserInput.value.max)
|
|
return;
|
|
if (value) {
|
|
rightDate.value = value;
|
|
maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
|
|
}
|
|
if (!first) {
|
|
maxTimePickerVisible.value = visible;
|
|
}
|
|
if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
|
|
minDate.value = maxDate.value;
|
|
}
|
|
handleRangeConfirm(true);
|
|
};
|
|
const handleClear = () => {
|
|
let valueOnClear = null;
|
|
if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
|
|
valueOnClear = pickerBase.emptyValues.valueOnClear.value;
|
|
}
|
|
leftDate.value = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
unit: "month",
|
|
unlinkPanels: props.unlinkPanels
|
|
})[0];
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
maxDate.value = void 0;
|
|
minDate.value = void 0;
|
|
handleRangeConfirm(true);
|
|
emit("pick", valueOnClear);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return correctlyParseUserInput(value, format.value || "", lang.value, isDefaultFormat);
|
|
};
|
|
function sortDates(minDate2, maxDate2) {
|
|
if (props.unlinkPanels && maxDate2) {
|
|
const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
|
|
const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
|
|
const maxDateYear = maxDate2.year();
|
|
const maxDateMonth = maxDate2.month();
|
|
rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit) : maxDate2;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(1, unit);
|
|
if (maxDate2) {
|
|
rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
|
|
}
|
|
}
|
|
}
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(drpNs).b(),
|
|
unref(ppNs).is("border", _ctx.border),
|
|
unref(ppNs).is("disabled", _ctx.disabled),
|
|
{
|
|
"has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
|
|
"has-time": unref(showTime)
|
|
}
|
|
])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
disabled: _ctx.disabled,
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
unref(showTime) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(drpNs).e("time-header"))
|
|
}, [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("editors-wrap"))
|
|
}, [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
disabled: unref(rangeState).selecting || _ctx.disabled,
|
|
placeholder: unref(t)("el.datepicker.startDate"),
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
"model-value": unref(minVisibleDate),
|
|
"validate-event": false,
|
|
onInput: (val) => handleDateInput(val, "min"),
|
|
onChange: (val) => handleDateChange(val, "min")
|
|
}, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting || _ctx.disabled,
|
|
placeholder: unref(t)("el.datepicker.startTime"),
|
|
"model-value": unref(minVisibleTime),
|
|
"validate-event": false,
|
|
onFocus: ($event) => minTimePickerVisible.value = true,
|
|
onInput: (val) => handleTimeInput(val, "min"),
|
|
onChange: (val) => handleTimeChange(val, "min")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
visible: minTimePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"datetime-role": "start",
|
|
"parsed-value": leftDate.value,
|
|
onPick: handleMinTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleMinTimeClose]
|
|
])
|
|
], 2),
|
|
createBaseVNode("span", null, [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
createBaseVNode("span", {
|
|
class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
|
|
}, [
|
|
createBaseVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting || _ctx.disabled,
|
|
placeholder: unref(t)("el.datepicker.endDate"),
|
|
"model-value": unref(maxVisibleDate),
|
|
readonly: !unref(minDate),
|
|
"validate-event": false,
|
|
onInput: (val) => handleDateInput(val, "max"),
|
|
onChange: (val) => handleDateChange(val, "max")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting || _ctx.disabled,
|
|
placeholder: unref(t)("el.datepicker.endTime"),
|
|
"model-value": unref(maxVisibleTime),
|
|
readonly: !unref(minDate),
|
|
"validate-event": false,
|
|
onFocus: ($event) => unref(minDate) && (maxTimePickerVisible.value = true),
|
|
onInput: (val) => handleTimeInput(val, "max"),
|
|
onChange: (val) => handleTimeChange(val, "max")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
"datetime-role": "end",
|
|
visible: maxTimePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"parsed-value": rightDate.value,
|
|
onPick: handleMaxTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleMaxTimeClose]
|
|
])
|
|
], 2)
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
disabled: _ctx.disabled,
|
|
onClick: leftPrevYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled"]),
|
|
withDirectives(createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
disabled: _ctx.disabled,
|
|
onClick: leftPrevMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled"]), [
|
|
[vShow, unref(leftCurrentView) === "date"]
|
|
]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
unref(ppNs).is("disabled", !unref(enableYearArrow) || _ctx.disabled)
|
|
], "d-arrow-right"]),
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
onClick: leftNextYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
_ctx.unlinkPanels && unref(leftCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
|
|
key: 1,
|
|
type: "button",
|
|
disabled: !unref(enableMonthArrow) || _ctx.disabled,
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
unref(ppNs).is("disabled", !unref(enableMonthArrow) || _ctx.disabled)
|
|
], "arrow-right"]),
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
onClick: leftNextMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", null, [
|
|
createBaseVNode("span", {
|
|
role: "button",
|
|
class: normalizeClass(unref(drpNs).e("header-label")),
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
onKeydown: withKeys(($event) => unref(showLeftPicker)("year"), ["enter"]),
|
|
onClick: ($event) => unref(showLeftPicker)("year")
|
|
}, toDisplayString(unref(leftYearLabel)), 43, ["onKeydown", "onClick"]),
|
|
withDirectives(createBaseVNode("span", {
|
|
role: "button",
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
class: normalizeClass([
|
|
unref(drpNs).e("header-label"),
|
|
{ active: unref(leftCurrentView) === "month" }
|
|
]),
|
|
onKeydown: withKeys(($event) => unref(showLeftPicker)("month"), ["enter"]),
|
|
onClick: ($event) => unref(showLeftPicker)("month")
|
|
}, toDisplayString(unref(t)(`el.datepicker.month${leftDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
|
|
[vShow, unref(leftCurrentView) === "date"]
|
|
])
|
|
])
|
|
], 2),
|
|
unref(leftCurrentView) === "date" ? (openBlock(), createBlock(DateTable, {
|
|
key: 0,
|
|
ref_key: "leftCurrentViewRef",
|
|
ref: leftCurrentViewRef,
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
"cell-class-name": unref(cellClassName),
|
|
"show-week-number": _ctx.showWeekNumber,
|
|
disabled: _ctx.disabled,
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : createCommentVNode("v-if", true),
|
|
unref(leftCurrentView) === "year" ? (openBlock(), createBlock(YearTable, {
|
|
key: 1,
|
|
ref_key: "leftCurrentViewRef",
|
|
ref: leftCurrentViewRef,
|
|
"selection-mode": "year",
|
|
date: leftDate.value,
|
|
"disabled-date": unref(disabledDate),
|
|
"parsed-value": _ctx.parsedValue,
|
|
disabled: _ctx.disabled,
|
|
onPick: unref(handleLeftYearPick)
|
|
}, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : createCommentVNode("v-if", true),
|
|
unref(leftCurrentView) === "month" ? (openBlock(), createBlock(MonthTable, {
|
|
key: 2,
|
|
ref_key: "leftCurrentViewRef",
|
|
ref: leftCurrentViewRef,
|
|
"selection-mode": "month",
|
|
date: leftDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
onPick: unref(handleLeftMonthPick)
|
|
}, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : createCommentVNode("v-if", true)
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([
|
|
unref(drpNs).e("header"),
|
|
unref(ppNs).is("disabled", !unref(enableYearArrow) || _ctx.disabled)
|
|
])
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
onClick: rightPrevYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
_ctx.unlinkPanels && unref(rightCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
|
|
key: 1,
|
|
type: "button",
|
|
disabled: !unref(enableMonthArrow) || _ctx.disabled,
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
onClick: rightPrevMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: rightNextYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "disabled"]),
|
|
withDirectives(createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
|
|
disabled: _ctx.disabled,
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
onClick: rightNextMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"]), [
|
|
[vShow, unref(rightCurrentView) === "date"]
|
|
]),
|
|
createBaseVNode("div", null, [
|
|
createBaseVNode("span", {
|
|
role: "button",
|
|
class: normalizeClass(unref(drpNs).e("header-label")),
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
onKeydown: withKeys(($event) => unref(showRightPicker)("year"), ["enter"]),
|
|
onClick: ($event) => unref(showRightPicker)("year")
|
|
}, toDisplayString(unref(rightYearLabel)), 43, ["onKeydown", "onClick"]),
|
|
withDirectives(createBaseVNode("span", {
|
|
role: "button",
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
class: normalizeClass([
|
|
unref(drpNs).e("header-label"),
|
|
{ active: unref(rightCurrentView) === "month" }
|
|
]),
|
|
onKeydown: withKeys(($event) => unref(showRightPicker)("month"), ["enter"]),
|
|
onClick: ($event) => unref(showRightPicker)("month")
|
|
}, toDisplayString(unref(t)(`el.datepicker.month${rightDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
|
|
[vShow, unref(rightCurrentView) === "date"]
|
|
])
|
|
])
|
|
], 2),
|
|
unref(rightCurrentView) === "date" ? (openBlock(), createBlock(DateTable, {
|
|
key: 0,
|
|
ref_key: "rightCurrentViewRef",
|
|
ref: rightCurrentViewRef,
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
"cell-class-name": unref(cellClassName),
|
|
"show-week-number": _ctx.showWeekNumber,
|
|
disabled: _ctx.disabled,
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : createCommentVNode("v-if", true),
|
|
unref(rightCurrentView) === "year" ? (openBlock(), createBlock(YearTable, {
|
|
key: 1,
|
|
ref_key: "rightCurrentViewRef",
|
|
ref: rightCurrentViewRef,
|
|
"selection-mode": "year",
|
|
date: rightDate.value,
|
|
"disabled-date": unref(disabledDate),
|
|
"parsed-value": _ctx.parsedValue,
|
|
disabled: _ctx.disabled,
|
|
onPick: unref(handleRightYearPick)
|
|
}, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : createCommentVNode("v-if", true),
|
|
unref(rightCurrentView) === "month" ? (openBlock(), createBlock(MonthTable, {
|
|
key: 2,
|
|
ref_key: "rightCurrentViewRef",
|
|
ref: rightCurrentViewRef,
|
|
"selection-mode": "month",
|
|
date: rightDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
onPick: unref(handleRightMonthPick)
|
|
}, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : createCommentVNode("v-if", true)
|
|
], 2)
|
|
], 2)
|
|
], 2),
|
|
_ctx.showFooter && unref(showTime) && (_ctx.showConfirm || unref(clearable)) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("footer"))
|
|
}, [
|
|
unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
|
|
key: 0,
|
|
text: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
onClick: handleClear
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
_ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
|
|
key: 1,
|
|
plain: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(btnDisabled),
|
|
onClick: ($event) => unref(handleRangeConfirm)(false)
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled", "onClick"])) : createCommentVNode("v-if", true)
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var DateRangePickPanel = _export_sfc(_sfc_main5, [["__file", "panel-date-range.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-month-range.mjs
|
|
var import_dayjs9 = __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/date-picker-panel/src/props/panel-month-range.mjs
|
|
var panelMonthRangeProps = buildProps({
|
|
...panelRangeSharedProps
|
|
});
|
|
var panelMonthRangeEmits = [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change"
|
|
];
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-month-range-header.mjs
|
|
var useMonthRangeHeader = ({
|
|
unlinkPanels,
|
|
leftDate,
|
|
rightDate
|
|
}) => {
|
|
const { t } = useLocale();
|
|
const leftPrevYear = () => {
|
|
leftDate.value = leftDate.value.subtract(1, "year");
|
|
if (!unlinkPanels.value) {
|
|
rightDate.value = rightDate.value.subtract(1, "year");
|
|
}
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!unlinkPanels.value) {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
}
|
|
rightDate.value = rightDate.value.add(1, "year");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = rightDate.value.subtract(1, "year");
|
|
};
|
|
const leftLabel = computed(() => {
|
|
return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
|
|
});
|
|
const rightLabel = computed(() => {
|
|
return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
|
|
});
|
|
const leftYear = computed(() => {
|
|
return leftDate.value.year();
|
|
});
|
|
const rightYear = computed(() => {
|
|
return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
|
|
});
|
|
return {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-month-range.mjs
|
|
var unit2 = "year";
|
|
var __default__ = defineComponent({
|
|
name: "DatePickerMonthRange"
|
|
});
|
|
var _sfc_main6 = defineComponent({
|
|
...__default__,
|
|
props: panelMonthRangeProps,
|
|
emits: panelMonthRangeEmits,
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const { lang } = useLocale();
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
|
|
const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const leftDate = ref((0, import_dayjs9.default)().locale(lang.value));
|
|
const rightDate = ref((0, import_dayjs9.default)().locale(lang.value).add(1, unit2));
|
|
const {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
ppNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
parseValue
|
|
} = useRangePicker(props, {
|
|
defaultValue,
|
|
leftDate,
|
|
rightDate,
|
|
unit: unit2,
|
|
sortDates
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
} = useMonthRangeHeader({
|
|
unlinkPanels: toRef(props, "unlinkPanels"),
|
|
leftDate,
|
|
rightDate
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value > leftYear.value + 1;
|
|
});
|
|
const handleRangePick = (val, close = true) => {
|
|
const minDate_ = val.minDate;
|
|
const maxDate_ = val.maxDate;
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!close)
|
|
return;
|
|
handleRangeConfirm();
|
|
};
|
|
const handleClear = () => {
|
|
let valueOnClear = null;
|
|
if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
|
|
valueOnClear = pickerBase.emptyValues.valueOnClear.value;
|
|
}
|
|
leftDate.value = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
unit: "year",
|
|
unlinkPanels: props.unlinkPanels
|
|
})[0];
|
|
rightDate.value = leftDate.value.add(1, "year");
|
|
emit("pick", valueOnClear);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
|
|
};
|
|
function sortDates(minDate2, maxDate2) {
|
|
if (props.unlinkPanels && maxDate2) {
|
|
const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
|
|
const maxDateYear = maxDate2.year();
|
|
rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit2) : maxDate2;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(1, unit2);
|
|
}
|
|
}
|
|
watch(() => props.visible, (visible) => {
|
|
if (!visible && rangeState.value.selecting) {
|
|
parseValue(props.parsedValue);
|
|
onSelect(false);
|
|
}
|
|
});
|
|
emit("set-picker-option", ["isValidValue", isValidRange]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(drpNs).b(),
|
|
unref(ppNs).is("border", _ctx.border),
|
|
unref(ppNs).is("disabled", _ctx.disabled),
|
|
{
|
|
"has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
|
|
}
|
|
])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: unref(leftPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
unref(ppNs).is("disabled", !unref(enableYearArrow))
|
|
], "d-arrow-right"]),
|
|
onClick: unref(leftNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
|
|
], 2),
|
|
createVNode(MonthTable, {
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
unref(ppNs).is("disabled", !unref(enableYearArrow))
|
|
], "d-arrow-left"]),
|
|
onClick: unref(rightPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
disabled: _ctx.disabled,
|
|
onClick: unref(rightNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"]),
|
|
createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
|
|
], 2),
|
|
createVNode(MonthTable, {
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2)
|
|
], 2)
|
|
], 2)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var MonthRangePickPanel = _export_sfc(_sfc_main6, [["__file", "panel-month-range.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-year-range.mjs
|
|
var import_dayjs10 = __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/date-picker-panel/src/props/panel-year-range.mjs
|
|
var panelYearRangeProps = buildProps({
|
|
...panelRangeSharedProps
|
|
});
|
|
var panelYearRangeEmits = [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change"
|
|
];
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/composables/use-year-range-header.mjs
|
|
var useYearRangeHeader = ({
|
|
unlinkPanels,
|
|
leftDate,
|
|
rightDate
|
|
}) => {
|
|
const leftPrevYear = () => {
|
|
leftDate.value = leftDate.value.subtract(10, "year");
|
|
if (!unlinkPanels.value) {
|
|
rightDate.value = rightDate.value.subtract(10, "year");
|
|
}
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!unlinkPanels.value) {
|
|
leftDate.value = leftDate.value.add(10, "year");
|
|
}
|
|
rightDate.value = rightDate.value.add(10, "year");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = leftDate.value.add(10, "year");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = rightDate.value.subtract(10, "year");
|
|
};
|
|
const leftLabel = computed(() => {
|
|
const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
|
|
return `${leftStartDate}-${leftStartDate + 9}`;
|
|
});
|
|
const rightLabel = computed(() => {
|
|
const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
|
|
return `${rightStartDate}-${rightStartDate + 9}`;
|
|
});
|
|
const leftYear = computed(() => {
|
|
const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
|
|
return leftEndDate;
|
|
});
|
|
const rightYear = computed(() => {
|
|
const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
|
|
return rightStartDate;
|
|
});
|
|
return {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
};
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-com/panel-year-range.mjs
|
|
var step = 10;
|
|
var unit3 = "year";
|
|
var __default__2 = defineComponent({
|
|
name: "DatePickerYearRange"
|
|
});
|
|
var _sfc_main7 = defineComponent({
|
|
...__default__2,
|
|
props: panelYearRangeProps,
|
|
emits: panelYearRangeEmits,
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const { lang } = useLocale();
|
|
const leftDate = ref((0, import_dayjs10.default)().locale(lang.value));
|
|
const rightDate = ref((0, import_dayjs10.default)().locale(lang.value).add(step, unit3));
|
|
const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
|
|
const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
|
|
const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
ppNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
parseValue
|
|
} = useRangePicker(props, {
|
|
defaultValue,
|
|
leftDate,
|
|
rightDate,
|
|
step,
|
|
unit: unit3,
|
|
sortDates
|
|
});
|
|
const {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
} = useYearRangeHeader({
|
|
unlinkPanels: toRef(props, "unlinkPanels"),
|
|
leftDate,
|
|
rightDate
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const panelKls = computed(() => [
|
|
ppNs.b(),
|
|
drpNs.b(),
|
|
ppNs.is("border", props.border),
|
|
ppNs.is("disabled", props.disabled),
|
|
{
|
|
"has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value
|
|
}
|
|
]);
|
|
const leftPanelKls = computed(() => {
|
|
return {
|
|
content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
|
|
arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
|
|
arrowRightBtn: [
|
|
ppNs.e("icon-btn"),
|
|
ppNs.is("disabled", !enableYearArrow.value),
|
|
"d-arrow-right"
|
|
]
|
|
};
|
|
});
|
|
const rightPanelKls = computed(() => {
|
|
return {
|
|
content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
|
|
arrowLeftBtn: [
|
|
ppNs.e("icon-btn"),
|
|
ppNs.is("disabled", !enableYearArrow.value),
|
|
"d-arrow-left"
|
|
],
|
|
arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
|
|
};
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value > leftYear.value + 1;
|
|
});
|
|
const handleRangePick = (val, close = true) => {
|
|
const minDate_ = val.minDate;
|
|
const maxDate_ = val.maxDate;
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!close)
|
|
return;
|
|
handleRangeConfirm();
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
|
|
};
|
|
const isValidValue = (date) => {
|
|
return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
|
|
};
|
|
const handleClear = () => {
|
|
let valueOnClear = null;
|
|
if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
|
|
valueOnClear = pickerBase.emptyValues.valueOnClear.value;
|
|
}
|
|
const defaultArr = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
step,
|
|
unit: unit3,
|
|
unlinkPanels: props.unlinkPanels
|
|
});
|
|
leftDate.value = defaultArr[0];
|
|
rightDate.value = defaultArr[1];
|
|
emit("pick", valueOnClear);
|
|
};
|
|
function sortDates(minDate2, maxDate2) {
|
|
if (props.unlinkPanels && maxDate2) {
|
|
const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
|
|
const maxDateYear = maxDate2.year();
|
|
rightDate.value = minDateYear + step > maxDateYear ? maxDate2.add(step, unit3) : maxDate2;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(step, unit3);
|
|
}
|
|
}
|
|
watch(() => props.visible, (visible) => {
|
|
if (!visible && rangeState.value.selecting) {
|
|
parseValue(props.parsedValue);
|
|
onSelect(false);
|
|
}
|
|
});
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass(unref(panelKls))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
disabled: _ctx.disabled,
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(leftPanelKls).content)
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass(unref(leftPanelKls).arrowLeftBtn),
|
|
disabled: _ctx.disabled,
|
|
onClick: unref(leftPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass(unref(leftPanelKls).arrowRightBtn),
|
|
onClick: unref(leftNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
|
|
], 2),
|
|
createVNode(YearTable, {
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2),
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(rightPanelKls).content)
|
|
}, [
|
|
createBaseVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow) || _ctx.disabled,
|
|
class: normalizeClass(unref(rightPanelKls).arrowLeftBtn),
|
|
onClick: unref(rightPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createBaseVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass(unref(rightPanelKls).arrowRightBtn),
|
|
disabled: _ctx.disabled,
|
|
onClick: unref(rightNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"]),
|
|
createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
|
|
], 2),
|
|
createVNode(YearTable, {
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
disabled: _ctx.disabled,
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2)
|
|
], 2)
|
|
], 2)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var YearRangePickPanel = _export_sfc(_sfc_main7, [["__file", "panel-year-range.vue"]]);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/panel-utils.mjs
|
|
var getPanel = function(type) {
|
|
switch (type) {
|
|
case "daterange":
|
|
case "datetimerange": {
|
|
return DateRangePickPanel;
|
|
}
|
|
case "monthrange": {
|
|
return MonthRangePickPanel;
|
|
}
|
|
case "yearrange": {
|
|
return YearRangePickPanel;
|
|
}
|
|
default: {
|
|
return DatePickPanel;
|
|
}
|
|
}
|
|
};
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/src/date-picker-panel.mjs
|
|
function _isSlot(s) {
|
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
}
|
|
import_dayjs11.default.extend(import_localeData.default);
|
|
import_dayjs11.default.extend(import_advancedFormat.default);
|
|
import_dayjs11.default.extend(import_customParseFormat.default);
|
|
import_dayjs11.default.extend(import_weekOfYear.default);
|
|
import_dayjs11.default.extend(import_weekYear.default);
|
|
import_dayjs11.default.extend(import_dayOfYear.default);
|
|
import_dayjs11.default.extend(import_isSameOrAfter.default);
|
|
import_dayjs11.default.extend(import_isSameOrBefore.default);
|
|
var DatePickerPanel = defineComponent({
|
|
name: "ElDatePickerPanel",
|
|
install: null,
|
|
props: datePickerPanelProps,
|
|
emits: [UPDATE_MODEL_EVENT, "calendar-change", "panel-change", "visible-change", "pick"],
|
|
setup(props, {
|
|
slots,
|
|
emit
|
|
}) {
|
|
const ns = useNamespace("picker-panel");
|
|
const pickerInjection = inject(PICKER_BASE_INJECTION_KEY, void 0);
|
|
if (isUndefined(pickerInjection)) {
|
|
const _props = reactive({
|
|
...toRefs(props)
|
|
});
|
|
provide(PICKER_BASE_INJECTION_KEY, {
|
|
props: _props
|
|
});
|
|
}
|
|
provide(ROOT_PICKER_INJECTION_KEY, {
|
|
slots,
|
|
pickerNs: ns
|
|
});
|
|
const {
|
|
parsedValue,
|
|
onCalendarChange,
|
|
onPanelChange,
|
|
onSetPickerOption,
|
|
onPick
|
|
} = inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
|
|
return () => {
|
|
const Component = getPanel(props.type);
|
|
return createVNode(Component, mergeProps(props, {
|
|
"parsedValue": parsedValue.value,
|
|
"onSet-picker-option": onSetPickerOption,
|
|
"onCalendar-change": onCalendarChange,
|
|
"onPanel-change": onPanelChange,
|
|
"onPick": onPick
|
|
}), _isSlot(slots) ? slots : {
|
|
default: () => [slots]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker-panel/index.mjs
|
|
var ElDatePickerPanel = withInstall(DatePickerPanel);
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker/src/props.mjs
|
|
var datePickerProps = buildProps({
|
|
...timePickerDefaultProps,
|
|
type: {
|
|
type: definePropType(String),
|
|
default: "date"
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker/src/date-picker.mjs
|
|
function _isSlot2(s) {
|
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
}
|
|
var DatePicker = defineComponent({
|
|
name: "ElDatePicker",
|
|
install: null,
|
|
props: datePickerProps,
|
|
emits: [UPDATE_MODEL_EVENT],
|
|
setup(props, {
|
|
expose,
|
|
emit,
|
|
slots
|
|
}) {
|
|
const isDefaultFormat = computed(() => {
|
|
return !props.format;
|
|
});
|
|
provide(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, isDefaultFormat);
|
|
provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, reactive(toRef(props, "popperOptions")));
|
|
const commonPicker = ref();
|
|
const refProps = {
|
|
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();
|
|
}
|
|
};
|
|
expose(refProps);
|
|
const onModelValueUpdated = (val) => {
|
|
emit(UPDATE_MODEL_EVENT, val);
|
|
};
|
|
return () => {
|
|
var _a;
|
|
const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
|
|
return createVNode(CommonPicker, mergeProps(props, {
|
|
"format": format,
|
|
"type": props.type,
|
|
"ref": commonPicker,
|
|
"onUpdate:modelValue": onModelValueUpdated
|
|
}), {
|
|
default: (scopedProps) => createVNode(ElDatePickerPanel, mergeProps({
|
|
"border": false
|
|
}, scopedProps), _isSlot2(slots) ? slots : {
|
|
default: () => [slots]
|
|
}),
|
|
"range-separator": slots["range-separator"]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/date-picker/index.mjs
|
|
var ElDatePicker = withInstall(DatePicker);
|
|
|
|
export {
|
|
require_localeData,
|
|
datePickerPanelProps,
|
|
ROOT_PICKER_INJECTION_KEY,
|
|
ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY,
|
|
ElDatePickerPanel,
|
|
datePickerProps,
|
|
ElDatePicker
|
|
};
|
|
//# sourceMappingURL=chunk-I2FLD7DU.js.map
|