@wfrog/vc
Version:
vue3 组件库 vc
1,136 lines (1,110 loc) • 217 kB
JavaScript
import { i as isArray, a as isEmpty, b as isDate, c as buildProps, d as definePropType, u as useNamespace, e as debugWarn, N as NOOP, f as isNumber, g as isUndefined, h as isString, j as isFunction } from '../../chunk/E_WRn0OP.mjs';
import { E as ElInput } from '../../chunk/D19ZZ4OA.mjs';
import { E as ElScrollbar } from '../../chunk/CJQcPuNK.mjs';
import { E as ElButton } from '../../chunk/BT7IBuxS.mjs';
import { E as Ee, u as useTooltipContentProps, a as ElTooltip, c as castArray, e as extractFirst } from '../../chunk/DUd8IaU9.mjs';
import { ref, computed, defineComponent, reactive, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot, createElementVNode, mergeProps, useAttrs as useAttrs$1, inject, watch, nextTick, onBeforeUnmount, provide, createBlock, withCtx, withModifiers, createCommentVNode, resolveDynamicComponent, toDisplayString, onMounted, Fragment, renderList, createTextVNode, withDirectives, createVNode, Transition, withKeys, useSlots, toRef, vShow, getCurrentInstance, toRefs, isVNode, isRef } from 'vue';
import { u as useVModel } from '../../chunk/eQT9aAiW.mjs';
import { g as getDefaultExportFromCjs } from '../../chunk/BAGoDD49.mjs';
import { E as ElIcon } from '../../chunk/m2vp1CCf.mjs';
import { CircleClose, Clock, Calendar, ArrowUp, ArrowDown, DArrowLeft, ArrowLeft, ArrowRight, DArrowRight } from '@element-plus/icons-vue';
import { u as useLocale } from '../../chunk/-m34CPRn.mjs';
import { u as useAriaProps, f as flatten } from '../../chunk/C2LgraHx.mjs';
import { _ as _export_sfc, w as withInstall } from '../../chunk/D389hx_T.mjs';
import { g as getStyle, h as hasClass } from '../../chunk/CD1S5tP1.mjs';
import { v as vRepeatClick } from '../../chunk/su2Zrql0.mjs';
import { U as UPDATE_MODEL_EVENT, C as CHANGE_EVENT } from '../../chunk/Ct6q2FXg.mjs';
import { d as debounce } from '../../chunk/ViP2SEY4.mjs';
import { g as getEventCode, E as EVENT_CODE } from '../../chunk/BJS5Pdfp.mjs';
import { C as ClickOutside } from '../../chunk/HSv8BL8o.mjs';
import { i as isEqual } from '../../chunk/-EkpfdcW.mjs';
import { u as useSizeProp } from '../../chunk/CS4VKsqy.mjs';
import { u as useEmptyValuesProps, a as useEmptyValues } from '../../chunk/C5hWsUfD.mjs';
import { o as onClickOutside, u as unrefElement } from '../../chunk/CEClY-_T.mjs';
import { u as useFormItem, a as useFormItemInputId, b as useFormDisabled, c as useFormSize } from '../../chunk/BOAz6rgm.mjs';
import { u as useAttrs } from '../../chunk/De_EXLIy.mjs';
import { u as useFocusController } from '../../chunk/JCIyOUEY.mjs';
var dayjs_min$1 = {exports: {}};
var dayjs_min = dayjs_min$1.exports;
var hasRequiredDayjs_min;
function requireDayjs_min () {
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
hasRequiredDayjs_min = 1;
(function (module, exports$1) {
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
} (dayjs_min$1));
return dayjs_min$1.exports;
}
var dayjs_minExports = requireDayjs_min();
const dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
const buildTimeList = (value, bound) => {
return [
value > 0 ? value - 1 : void 0,
value,
value < bound ? value + 1 : void 0
];
};
const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
const extractDateFormat = (format) => {
return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
};
const extractTimeFormat = (format) => {
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
};
const dateEquals = function(a, b) {
const aIsDate = isDate(a);
const bIsDate = isDate(b);
if (aIsDate && bIsDate) {
return a.getTime() === b.getTime();
}
if (!aIsDate && !bIsDate) {
return a === b;
}
return false;
};
const valueEquals = function(a, b) {
const aIsArray = isArray(a);
const bIsArray = isArray(b);
if (aIsArray && bIsArray) {
if (a.length !== b.length) {
return false;
}
return a.every((item, index) => dateEquals(item, b[index]));
}
if (!aIsArray && !bIsArray) {
return dateEquals(a, b);
}
return false;
};
const parseDate = function(date, format, lang) {
const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
return day.isValid() ? day : void 0;
};
const formatter = function(date, format, lang) {
if (isEmpty(format))
return date;
if (format === "x")
return +date;
return dayjs(date).locale(lang).format(format);
};
const makeList = (total, method) => {
var _a;
const arr = [];
const disabledArr = method == null ? void 0 : method();
for (let i = 0; i < total; i++) {
arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
}
return arr;
};
const dayOrDaysToDate = (dayOrDays) => {
return isArray(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
};
var localeData$2 = {exports: {}};
var localeData$1 = localeData$2.exports;
var hasRequiredLocaleData;
function requireLocaleData () {
if (hasRequiredLocaleData) return localeData$2.exports;
hasRequiredLocaleData = 1;
(function (module, exports$1) {
!function(n,e){module.exports=e();}(localeData$1,(function(){return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.slice(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return {months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return {firstDayOfWeek:function(){return n.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(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)};}}));
} (localeData$2));
return localeData$2.exports;
}
var localeDataExports = requireLocaleData();
const localeData = /*@__PURE__*/getDefaultExportFromCjs(localeDataExports);
const datePickTypes = [
"year",
"years",
"month",
"months",
"date",
"dates",
"week",
"datetime",
"datetimerange",
"daterange",
"monthrange",
"yearrange"
];
var customParseFormat$2 = {exports: {}};
var customParseFormat$1 = customParseFormat$2.exports;
var hasRequiredCustomParseFormat;
function requireCustomParseFormat () {
if (hasRequiredCustomParseFormat) return customParseFormat$2.exports;
hasRequiredCustomParseFormat = 1;
(function (module, exports$1) {
!function(e,t){module.exports=t();}(customParseFormat$1,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return (e=+e)+(e>68?1900:2e3)};var f=function(e){return function(t){this[e]=+t;}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},c={A:[o,function(e){this.afternoon=d(e,false);}],a:[o,function(e){this.afternoon=d(e,true);}],Q:[n,function(e){this.month=3*(e-1)+1;}],S:[n,function(e){this.milliseconds=100*+e;}],SS:[r,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e){var t=u("months"),n=(u("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e){this.year=a(e);}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n){var r,i;r=n,i=s&&s.formats;for(var o=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=o.length,f=0;f<a;f+=1){var h=o[f],u=c[h],d=u&&u[0],l=u&&u[1];o[f]=l?{regex:d,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=o[n];if("string"==typeof i)r+=i.length;else {var s=i.regex,f=i.parser,h=e.slice(r),u=s.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=true,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,o=e.args;this.$u=r;var a=o[1];if("string"==typeof a){var f=true===o[2],h=true===o[3],u=f||h,d=o[2];h&&(d=o[2]),s=this.$locale(),!f&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var i=l(t)(e),o=i.year,s=i.month,a=i.day,f=i.hours,h=i.minutes,u=i.seconds,d=i.milliseconds,c=i.zone,m=i.week,M=new Date,Y=a||(o||s?1:M.getDate()),p=o||M.getFullYear(),v=0;o&&!s||(v=s>0?s-1:M.getMonth());var D,w=f||0,g=h||0,y=u||0,L=d||0;return c?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c.offset*1e3)):n?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m&&(D=r(D).week(m).toDate()),D)}catch(e){return new Date("")}}(t,a,r,n),this.init(),d&&true!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={};}else if(a instanceof Array)for(var c=a.length,m=1;m<=c;m+=1){o[1]=a[m-1];var M=n.apply(this,o);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===c&&(this.$d=new Date(""));}else i.call(this,e);};}}));
} (customParseFormat$2));
return customParseFormat$2.exports;
}
var customParseFormatExports = requireCustomParseFormat();
const customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
const timeUnits = ["hours", "minutes", "seconds"];
const PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
const PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
const ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
const DEFAULT_FORMATS_TIME = "HH:mm:ss";
const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
const DEFAULT_FORMATS_DATEPICKER = {
date: DEFAULT_FORMATS_DATE,
dates: DEFAULT_FORMATS_DATE,
week: "gggg[w]ww",
year: "YYYY",
years: "YYYY",
month: "YYYY-MM",
months: "YYYY-MM",
datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
monthrange: "YYYY-MM",
yearrange: "YYYY",
daterange: DEFAULT_FORMATS_DATE,
datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
};
const useCommonPicker = (props, emit) => {
const { lang } = useLocale();
const pickerVisible = ref(false);
const pickerActualVisible = ref(false);
const userInput = ref(null);
const valueIsEmpty = computed(() => {
const { modelValue } = props;
return !modelValue || isArray(modelValue) && !modelValue.filter(Boolean).length;
});
const emitInput = (input) => {
if (!valueEquals(props.modelValue, input)) {
let formatted;
if (isArray(input)) {
formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
} else if (input) {
formatted = formatter(input, props.valueFormat, lang.value);
}
const emitVal = input ? formatted : input;
emit(UPDATE_MODEL_EVENT, emitVal, lang.value);
}
};
const parsedValue = computed(() => {
var _a;
let dayOrDays;
if (valueIsEmpty.value) {
if (pickerOptions.value.getDefaultValue) {
dayOrDays = pickerOptions.value.getDefaultValue();
}
} else {
if (isArray(props.modelValue)) {
dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
} else {
dayOrDays = parseDate((_a = props.modelValue) != null ? _a : "", props.valueFormat, lang.value);
}
}
if (pickerOptions.value.getRangeAvailableTime) {
const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
if (!isEqual(availableResult, dayOrDays)) {
dayOrDays = availableResult;
if (!valueIsEmpty.value) {
emitInput(dayOrDaysToDate(dayOrDays));
}
}
}
if (isArray(dayOrDays) && dayOrDays.some((day) => !day)) {
dayOrDays = [];
}
return dayOrDays;
});
const pickerOptions = ref({});
const onSetPickerOption = (e) => {
pickerOptions.value[e[0]] = e[1];
pickerOptions.value.panelReady = true;
};
const onCalendarChange = (e) => {
emit("calendar-change", e);
};
const onPanelChange = (value, mode, view) => {
emit("panel-change", value, mode, view);
};
const onPick = (date = "", visible = false) => {
pickerVisible.value = visible;
let result;
if (isArray(date)) {
result = date.map((_) => _.toDate());
} else {
result = date ? date.toDate() : date;
}
userInput.value = null;
emitInput(result);
};
return {
parsedValue,
pickerActualVisible,
pickerOptions,
pickerVisible,
userInput,
valueIsEmpty,
emitInput,
onCalendarChange,
onPanelChange,
onPick,
onSetPickerOption
};
};
const disabledTimeListsProps = buildProps({
disabledHours: {
type: definePropType(Function)
},
disabledMinutes: {
type: definePropType(Function)
},
disabledSeconds: {
type: definePropType(Function)
}
});
const timePanelSharedProps = buildProps({
visible: Boolean,
actualVisible: {
type: Boolean,
default: void 0
},
format: {
type: String,
default: ""
}
});
const timePickerDefaultProps = buildProps({
automaticDropdown: {
type: Boolean,
default: true
},
id: {
type: definePropType([Array, String])
},
name: {
type: definePropType([Array, String])
},
popperClass: useTooltipContentProps.popperClass,
popperStyle: useTooltipContentProps.popperStyle,
format: String,
valueFormat: String,
dateFormat: String,
timeFormat: String,
type: {
type: String,
default: ""
},
clearable: {
type: Boolean,
default: true
},
clearIcon: {
type: definePropType([String, Object]),
default: CircleClose
},
editable: {
type: Boolean,
default: true
},
prefixIcon: {
type: definePropType([String, Object]),
default: ""
},
size: useSizeProp,
readonly: Boolean,
disabled: Boolean,
placeholder: {
type: String,
default: ""
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
modelValue: {
type: definePropType([Date, Array, String, Number]),
default: ""
},
rangeSeparator: {
type: String,
default: "-"
},
startPlaceholder: String,
endPlaceholder: String,
defaultValue: {
type: definePropType([Date, Array])
},
defaultTime: {
type: definePropType([Date, Array])
},
isRange: Boolean,
...disabledTimeListsProps,
disabledDate: {
type: Function
},
cellClassName: {
type: Function
},
shortcuts: {
type: Array,
default: () => []
},
arrowControl: Boolean,
tabindex: {
type: definePropType([String, Number]),
default: 0
},
validateEvent: {
type: Boolean,
default: true
},
unlinkPanels: Boolean,
placement: {
type: definePropType(String),
values: Ee,
default: "bottom"
},
fallbackPlacements: {
type: definePropType(Array),
default: ["bottom", "top", "right", "left"]
},
...useEmptyValuesProps,
...useAriaProps(["ariaLabel"]),
showNow: {
type: Boolean,
default: true
},
showConfirm: {
type: Boolean,
default: true
},
showFooter: {
type: Boolean,
default: true
},
showWeekNumber: Boolean
});
const timePickerRangeTriggerProps = buildProps({
id: {
type: definePropType(Array)
},
name: {
type: definePropType(Array)
},
modelValue: {
type: definePropType([Array, String])
},
startPlaceholder: String,
endPlaceholder: String,
disabled: Boolean
});
const __default__$3 = defineComponent({
name: "PickerRangeTrigger",
inheritAttrs: false
});
const _sfc_main$b = /* @__PURE__ */ defineComponent({
...__default__$3,
props: timePickerRangeTriggerProps,
emits: [
"mouseenter",
"mouseleave",
"click",
"touchstart",
"focus",
"blur",
"startInput",
"endInput",
"startChange",
"endChange"
],
setup(__props, { expose, emit }) {
const props = __props;
const { formItem } = useFormItem();
const { inputId } = useFormItemInputId(reactive({ id: computed(() => {
var _a;
return (_a = props.id) == null ? void 0 : _a[0];
}) }), {
formItemContext: formItem
});
const attrs = useAttrs();
const nsDate = useNamespace("date");
const nsRange = useNamespace("range");
const inputRef = ref();
const endInputRef = ref();
const { wrapperRef, isFocused } = useFocusController(inputRef, {
disabled: computed(() => props.disabled)
});
const handleClick = (evt) => {
emit("click", evt);
};
const handleMouseEnter = (evt) => {
emit("mouseenter", evt);
};
const handleMouseLeave = (evt) => {
emit("mouseleave", evt);
};
const handleTouchStart = (evt) => {
emit("touchstart", evt);
};
const handleStartInput = (evt) => {
emit("startInput", evt);
};
const handleEndInput = (evt) => {
emit("endInput", evt);
};
const handleStartChange = (evt) => {
emit("startChange", evt);
};
const handleEndChange = (evt) => {
emit("endChange", evt);
};
const focus = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.focus();
};
const blur = () => {
var _a, _b;
(_a = inputRef.value) == null ? void 0 : _a.blur();
(_b = endInputRef.value) == null ? void 0 : _b.blur();
};
expose({
focus,
blur
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "wrapperRef",
ref: wrapperRef,
class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
style: normalizeStyle(_ctx.$attrs.style),
onClick: handleClick,
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave,
onTouchstartPassive: handleTouchStart
}, [
renderSlot(_ctx.$slots, "prefix"),
createElementVNode("input", mergeProps(unref(attrs), {
id: unref(inputId),
ref_key: "inputRef",
ref: inputRef,
name: _ctx.name && _ctx.name[0],
placeholder: _ctx.startPlaceholder,
value: _ctx.modelValue && _ctx.modelValue[0],
class: unref(nsRange).b("input"),
disabled: _ctx.disabled,
onInput: handleStartInput,
onChange: handleStartChange
}), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
renderSlot(_ctx.$slots, "range-separator"),
createElementVNode("input", mergeProps(unref(attrs), {
id: _ctx.id && _ctx.id[1],
ref_key: "endInputRef",
ref: endInputRef,
name: _ctx.name && _ctx.name[1],
placeholder: _ctx.endPlaceholder,
value: _ctx.modelValue && _ctx.modelValue[1],
class: unref(nsRange).b("input"),
disabled: _ctx.disabled,
onInput: handleEndInput,
onChange: handleEndChange
}), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
renderSlot(_ctx.$slots, "suffix")
], 38);
};
}
});
var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "picker-range-trigger.vue"]]);
const __default__$2 = defineComponent({
name: "Picker"
});
const _sfc_main$a = /* @__PURE__ */ defineComponent({
...__default__$2,
props: timePickerDefaultProps,
emits: [
UPDATE_MODEL_EVENT,
CHANGE_EVENT,
"focus",
"blur",
"clear",
"calendar-change",
"panel-change",
"visible-change",
"keydown"
],
setup(__props, { expose, emit }) {
const props = __props;
const attrs = useAttrs$1();
const nsDate = useNamespace("date");
const nsInput = useNamespace("input");
const nsRange = useNamespace("range");
const { formItem } = useFormItem();
const elPopperOptions = inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
const emptyValues = useEmptyValues(props, null);
const refPopper = ref();
const inputRef = ref();
const valueOnOpen = ref(null);
let hasJustTabExitedInput = false;
const pickerDisabled = useFormDisabled();
const commonPicker = useCommonPicker(props, emit);
const {
parsedValue,
pickerActualVisible,
userInput,
pickerVisible,
pickerOptions,
valueIsEmpty,
emitInput,
onPick,
onSetPickerOption,
onCalendarChange,
onPanelChange
} = commonPicker;
const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
disabled: pickerDisabled,
beforeFocus() {
return props.readonly;
},
afterFocus() {
if (!props.automaticDropdown)
return;
pickerVisible.value = true;
},
beforeBlur(event) {
var _a;
return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
},
afterBlur() {
handleChange();
pickerVisible.value = false;
hasJustTabExitedInput = false;
props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn(err)));
}
});
const hovering = ref(false);
const rangeInputKls = computed(() => [
nsDate.b("editor"),
nsDate.bm("editor", props.type),
nsInput.e("wrapper"),
nsDate.is("disabled", pickerDisabled.value),
nsDate.is("active", pickerVisible.value),
nsRange.b("editor"),
pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
attrs.class
]);
const clearIconKls = computed(() => [
nsInput.e("icon"),
nsRange.e("close-icon"),
!showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
]);
watch(pickerVisible, (val) => {
if (!val) {
userInput.value = null;
nextTick(() => {
emitChange(props.modelValue);
});
} else {
nextTick(() => {
if (val) {
valueOnOpen.value = props.modelValue;
}
});
}
});
const emitChange = (val, isClear) => {
if (isClear || !valueEquals(val, valueOnOpen.value)) {
emit(CHANGE_EVENT, val);
isClear && (valueOnOpen.value = val);
props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err)));
}
};
const emitKeydown = (e) => {
emit("keydown", e);
};
const refInput = computed(() => {
if (inputRef.value) {
return Array.from(inputRef.value.$el.querySelectorAll("input"));
}
return [];
});
const setSelectionRange = (start, end, pos) => {
const _inputs = refInput.value;
if (!_inputs.length)
return;
if (!pos || pos === "min") {
_inputs[0].setSelectionRange(start, end);
_inputs[0].focus();
} else if (pos === "max") {
_inputs[1].setSelectionRange(start, end);
_inputs[1].focus();
}
};
const onBeforeShow = () => {
pickerActualVisible.value = true;
};
const onShow = () => {
emit("visible-change", true);
};
const onHide = () => {
pickerActualVisible.value = false;
pickerVisible.value = false;
emit("visible-change", false);
};
const handleOpen = () => {
pickerVisible.value = true;
};
const handleClose = () => {
pickerVisible.value = false;
};
const displayValue = computed(() => {
const formattedValue = formatToString(parsedValue.value);
if (isArray(userInput.value)) {
return [
userInput.value[0] || formattedValue && formattedValue[0] || "",
userInput.value[1] || formattedValue && formattedValue[1] || ""
];
} else if (userInput.value !== null) {
return userInput.value;
}
if (!isTimePicker.value && valueIsEmpty.value)
return "";
if (!pickerVisible.value && valueIsEmpty.value)
return "";
if (formattedValue) {
return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
}
return "";
});
const isTimeLikePicker = computed(() => props.type.includes("time"));
const isTimePicker = computed(() => props.type.startsWith("time"));
const isDatesPicker = computed(() => props.type === "dates");
const isMonthsPicker = computed(() => props.type === "months");
const isYearsPicker = computed(() => props.type === "years");
const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? Clock : Calendar));
const showClearBtn = computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
const onClearIconClick = (event) => {
if (props.readonly || pickerDisabled.value)
return;
if (showClearBtn.value) {
event.stopPropagation();
if (pickerOptions.value.handleClear) {
pickerOptions.value.handleClear();
} else {
emitInput(emptyValues.valueOnClear.value);
}
emitChange(emptyValues.valueOnClear.value, true);
onHide();
}
emit("clear");
};
const onMouseDownInput = async (event) => {
var _a;
if (props.readonly || pickerDisabled.value)
return;
if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
pickerVisible.value = true;
}
};
const onMouseEnter = () => {
if (props.readonly || pickerDisabled.value)
return;
if (!valueIsEmpty.value && props.clearable) {
hovering.value = true;
}
};
const onMouseLeave = () => {
hovering.value = false;
};
const onTouchStartInput = (event) => {
var _a;
if (props.readonly || pickerDisabled.value)
return;
if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
pickerVisible.value = true;
}
};
const isRangeInput = computed(() => {
return props.type.includes("range");
});
const pickerSize = useFormSize();
const popperEl = computed(() => {
var _a, _b;
return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
});
const stophandle = onClickOutside(inputRef, (e) => {
const unrefedPopperEl = unref(popperEl);
const inputEl = unrefElement(inputRef);
if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
return;
pickerVisible.value = false;
});
onBeforeUnmount(() => {
stophandle == null ? void 0 : stophandle();
});
const handleChange = () => {
if (userInput.value) {
const value = parseUserInputToDayjs(displayValue.value);
if (value) {
if (isValidValue(value)) {
emitInput(dayOrDaysToDate(value));
userInput.value = null;
}
}
}
if (userInput.value === "") {
emitInput(emptyValues.valueOnClear.value);
emitChange(emptyValues.valueOnClear.value, true);
userInput.value = null;
}
};
const parseUserInputToDayjs = (value) => {
if (!value)
return null;
return pickerOptions.value.parseUserInput(value);
};
const formatToString = (value) => {
if (!value)
return null;
const res = isArray(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
return res;
};
const isValidValue = (value) => {
return pickerOptions.value.isValidValue(value);
};
const handleKeydownInput = async (event) => {
if (props.readonly || pickerDisabled.value)
return;
const code = getEventCode(event);
emitKeydown(event);
if (code === EVENT_CODE.esc) {
if (pickerVisible.value === true) {
pickerVisible.value = false;
event.preventDefault();
event.stopPropagation();
}
return;
}
if (code === EVENT_CODE.down) {
if (pickerOptions.value.handleFocusPicker) {
event.preventDefault();
event.stopPropagation();
}
if (pickerVisible.value === false) {
pickerVisible.value = true;
await nextTick();
}
if (pickerOptions.value.handleFocusPicker) {
pickerOptions.value.handleFocusPicker();
return;
}
}
if (code === EVENT_CODE.tab) {
hasJustTabExitedInput = true;
return;
}
if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
if (!pickerVisible.value) {
pickerVisible.value = true;
} else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
handleChange();
pickerVisible.value = false;
}
event.preventDefault();
event.stopPropagation();
return;
}
if (userInput.value) {
event.stopPropagation();
return;
}
if (pickerOptions.value.handleKeydownInput) {
pickerOptions.value.handleKeydownInput(event);
}
};
const onUserInput = (e) => {
userInput.value = e;
if (!pickerVisible.value) {
pickerVisible.value = true;
}
};
const handleStartInput = (event) => {
const target = event.target;
if (userInput.value) {
userInput.value = [target.value, userInput.value[1]];
} else {
userInput.value = [target.value, null];
}
};
const handleEndInput = (event) => {
const target = event.target;
if (userInput.value) {
userInput.value = [userInput.value[0], target.value];
} else {
userInput.value = [null, target.value];
}
};
const handleStartChange = () => {
var _a;
const values = userInput.value;
const value = parseUserInputToDayjs(values && values[0]);
const parsedVal = unref(parsedValue);
if (value && value.isValid()) {
userInput.value = [
formatToString(value),
((_a = displayValue.value) == null ? void 0 : _a[1]) || null
];
const newValue = [value, parsedVal && (parsedVal[1] || null)];
if (isValidValue(newValue)) {
emitInput(dayOrDaysToDate(newValue));
userInput.value = null;
}
}
};
const handleEndChange = () => {
var _a;
const values = unref(userInput);
const value = parseUserInputToDayjs(values && values[1]);
const parsedVal = unref(parsedValue);
if (value && value.isValid()) {
userInput.value = [
((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
formatToString(value)
];
const newValue = [parsedVal && parsedVal[0], value];
if (isValidValue(newValue)) {
emitInput(dayOrDaysToDate(newValue));
userInput.value = null;
}
}
};
const focus = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = inputRef.value) == null ? void 0 : _a.blur();
};
provide(PICKER_BASE_INJECTION_KEY, {
props,
emptyValues
});
provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
expose({
focus,
blur,
handleOpen,
handleClose,
onPick
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTooltip), mergeProps({
ref_key: "refPopper",
ref: refPopper,
visible: unref(pickerVisible),
effect: "light",
pure: "",
trigger: "click"
}, _ctx.$attrs, {
role: "dialog",
teleported: "",
transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
"popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
"popper-style": _ctx.popperStyle,
"popper-options": unref(elPopperOptions),
"fallback-placements": _ctx.fallbackPlacements,
"gpu-acceleration": false,
placement: _ctx.placement,
"stop-popper-mouse-event": false,
"hide-after": 0,
persistent: "",
onBeforeShow,
onShow,
onHide
}), {
default: withCtx(() => [
!unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
key: 0,
id: _ctx.id,
ref_key: "inputRef",
ref: inputRef,
"container-role": "combobox",
"model-value": unref(displayValue),
name: _ctx.name,
size: unref(pickerSize),
disabled: unref(pickerDisabled),
placeholder: _ctx.placeholder,
class: normalizeClass([
unref(nsDate).b("editor"),
unref(nsDate).bm("editor", _ctx.type),
unref(nsDate).is("focus", unref(pickerVisible)),
_ctx.$attrs.class
]),
style: normalizeStyle(_ctx.$attrs.style),
readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
"aria-label": _ctx.ariaLabel,
tabindex: _ctx.tabindex,
"validate-event": false,
onInput: onUserInput,
onFocus: unref(handleFocus),
onBlur: unref(handleBlur),
onKeydown: handleKeydownInput,
onChange: handleChange,
onMousedown: onMouseDownInput,
onMouseenter: onMouseEnter,
onMouseleave: onMouseLeave,
onTouchstartPassive: onTouchStartInput,
onClick: withModifiers(() => {
}, ["stop"])
}, {
prefix: withCtx(() => [
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(nsInput).e("icon")),
onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
onTouchstartPassive: onTouchStartInput
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
]),
_: 1
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
]),
suffix: withCtx(() => [
unref(showClearBtn) && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
onClick: onClearIconClick
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
]),
_: 1
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
]),
_: 1
}, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
key: 1,
id: _ctx.id,
ref_key: "inputRef",
ref: inputRef,
"model-value": unref(displayValue),
name: _ctx.name,
disabled: unref(pickerDisabled),
readonly: !_ctx.editable || _ctx.readonly,
"start-placeholder": _ctx.startPlaceholder,
"end-placeholder": _ctx.endPlaceholder,
class: normalizeClass(unref(rangeInputKls)),
style: normalizeStyle(_ctx.$attrs.style),
"aria-label": _ctx.ariaLabel,
tabindex: _ctx.tabindex,
autocomplete: "off",
role: "combobox",
onClick: onMouseDownInput,
onFocus: unref(handleFocus),
onBlur: unref(handleBlur),
onStartInput: handleStartInput,
onStartChange: handleStartChange,
onEndInput: handleEndInput,
onEndChange: handleEndChange,
onMousedown: onMouseDownInput,
onMouseenter: onMouseEnter,
onMouseleave: onMouseLeave,
onTouchstartPassive: onTouchStartInput,
onKeydown: handleKeydownInput
}, {
prefix: withCtx(() => [
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
]),
"range-separator": withCtx(() => [
renderSlot(_ctx.$slots, "range-separator", {}, () => [
createElementVNode("span", {
class: normalizeClass(unref(nsRange).b("separator"))
}, toDisplayString(_ctx.rangeSeparator), 3)
])
]),
suffix: withCtx(() => [
_ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(clearIconKls)),
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
onClick: onClearIconClick
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
]),
_: 1
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
]),
content: withCtx(() => [
renderSlot(_ctx.$slots, "default", {
visible: unref(pickerVisible),
actualVisible: unref(pickerActualVisible),
parsedValue: unref(parsedValue),
format: _ctx.format,
dateFormat: _ctx.dateFormat,
timeFormat: _ctx.timeFormat,
unlinkPanels: _ctx.unlinkPanels,
type: _ctx.type,
defaultValue: _ctx.defaultValue,
showNow: _ctx.showNow,
showConfirm: _ctx.showConfirm,
showFooter: _ctx.showFooter,
showWeekNumber: _ctx.showWeekNumber,
onPick: unref(onPick),
onSelectRange: setSelectionRange,
onSetPickerOption: unref(onSetPickerOption),
onCalendarChange: unref(onCalendarChange),
onPanelChange: unref(onPanelChange),
onMousedown: withModifiers(() => {
}, ["stop"])
})
]),
_: 3
}, 16, ["visible", "transition", "popper-class", "popper-style", "popper-options", "fallback-placements", "placement"]);
};
}
});
var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "picker.vue"]]);
const panelTimePickerProps = buildProps({
...timePanelSharedProps,
datetimeRole: String,
parsedValue: {
type: definePropType(Object)
}
});
const useTimePanel = ({
getAvailableHours,
getAvailableMinutes,
getAvailableSeconds
}) => {
const getAvailableTime = (date, role, first, compareDate) => {
const availableTimeGetters = {
hour: getAvailableHours,
minute: getAvailableMinutes,
second: getAvailableSeconds
};
let result = date;
["hour", "minute", "second"].forEach((type) => {
if (availableTimeGetters[type]) {
let availableTimeSlots;
const method = availableTimeGetters[type];
switch (type) {
case "minute": {
availableTimeSlots = method(result.hour(), role, compareDate);
break;
}
case "second": {
availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
break;
}
default: {
availableTimeSlots = method(role, compareDate);
break;
}
}
if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {