index-legacy.cc032eeb.js 7.1 KB

1
  1. !function(){function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,u,a=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(c){i=!0,u=c}finally{try{o||null==n.return||n.return()}finally{if(i)throw u}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}System.register(["./index-legacy.b2528a15.js","./utils-legacy.11efe12f.js","./index-legacy.702b8ebf.js"],(function(n){"use strict";var r,u,a,o,i,c,l,f,m,s,v,p,y,d,g,h,D,x,b,M,V,H,k,w,O;return{setters:[function(e){r=e.E,u=e.d,a=e.J,o=e.ab,i=e.U,c=e.W,l=e.V,f=e.X,m=e.a3,s=e.ak,v=e.i,p=e.a8,y=e.aB,d=e.aQ,g=e.as,h=e.a0,D=e.b6,x=e.O},function(e){b=e.s,M=e.t,V=e.p,H=e.a,k=e.g,w=e.b},function(e){O=e.P}],execute:function(){var j=t(r("time-picker"),1)[0],Y=u({name:j,props:a({},b,{minHour:o(0),maxHour:o(23),minMinute:o(0),maxMinute:o(59),modelValue:String}),emits:["confirm","cancel","change","update:modelValue"],setup:function(e,n){var r=n.emit,u=n.slots,a=function(n){var r=e.minHour,u=e.maxHour,a=e.maxMinute,o=e.minMinute;n||(n="".concat(d(r),":").concat(d(o)));var i=t(n.split(":"),2),c=i[0],l=i[1];return c=d(g(+c,+r,+u)),l=d(g(+l,+o,+a)),"".concat(c,":").concat(l)},o=i(),h=i(a(e.modelValue)),D=c((function(){return[{type:"hour",range:[+e.minHour,+e.maxHour]},{type:"minute",range:[+e.minMinute,+e.maxMinute]}]})),x=c((function(){return D.value.map((function(t){var n=t.type,r=t.range,u=M(r[1]-r[0]+1,(function(e){return d(r[0]+e)}));return e.filter&&(u=e.filter(n,u)),{type:n,values:u}}))})),b=c((function(){return x.value.map((function(t){return{values:t.values.map((function(n){return e.formatter(t.type,n)}))}}))})),k=function(){var t=h.value.split(":"),n=[e.formatter("hour",t[0]),e.formatter("minute",t[1])];f((function(){var e;null==(e=o.value)||e.setValues(n)}))},w=function(){var e=t(o.value.getIndexes(),2),n=e[0],r=e[1],u=t(x.value,2),i=u[0],c=u[1],l=i.values[n]||i.values[0],f=c.values[r]||c.values[0];h.value=a("".concat(l,":").concat(f)),k()},j=function(){return r("confirm",h.value)},Y=function(){return r("cancel")},S=function(){w(),f((function(){f((function(){return r("change",h.value)}))}))};return l((function(){k(),f(w)})),m(b,k),m((function(){return[e.filter,e.maxHour,e.minMinute,e.maxMinute]}),w),m((function(){return e.minHour}),(function(){f(w)})),m(h,(function(e){return r("update:modelValue",e)})),m((function(){return e.modelValue}),(function(e){(e=a(e))!==h.value&&(h.value=e,k())})),s({getPicker:function(){return o.value&&V(o.value,w)}}),function(){return v(O,p({ref:o,columns:b.value,onChange:S,onCancel:Y,onConfirm:j},y(e,H)),u)}}}),S=(new Date).getFullYear(),C=t(r("date-picker"),1)[0],A=u({name:C,props:a({},b,{type:h("datetime"),modelValue:Date,minDate:{type:Date,default:function(){return new Date(S-10,0,1)},validator:D},maxDate:{type:Date,default:function(){return new Date(S+10,11,31)},validator:D}}),emits:["confirm","cancel","change","update:modelValue"],setup:function(t,n){var r=n.emit,u=n.slots,a=function(e){if(D(e)){var n=g(e.getTime(),t.minDate.getTime(),t.maxDate.getTime());return new Date(n)}},o=i(),h=i(a(t.modelValue)),x=function(n,r){var u,a=t["".concat(n,"Date")],o=a.getFullYear(),i=1,c=1,l=0,f=0;return"max"===n&&(i=12,c=k(r.getFullYear(),r.getMonth()+1),l=23,f=59),r.getFullYear()===o&&(i=a.getMonth()+1,r.getMonth()+1===i&&(c=a.getDate(),r.getDate()===c&&(l=a.getHours(),r.getHours()===l&&(f=a.getMinutes())))),e(u={},"".concat(n,"Year"),o),e(u,"".concat(n,"Month"),i),e(u,"".concat(n,"Date"),c),e(u,"".concat(n,"Hour"),l),e(u,"".concat(n,"Minute"),f),u},b=c((function(){var e=x("max",h.value||t.minDate),n=e.maxYear,r=e.maxDate,u=e.maxMonth,a=e.maxHour,o=e.maxMinute,i=x("min",h.value||t.minDate),c=i.minYear,l=i.minDate,f=[{type:"year",range:[c,n]},{type:"month",range:[i.minMonth,u]},{type:"day",range:[l,r]},{type:"hour",range:[i.minHour,a]},{type:"minute",range:[i.minMinute,o]}];switch(t.type){case"date":f=f.slice(0,3);break;case"year-month":f=f.slice(0,2);break;case"month-day":f=f.slice(1,3);break;case"datehour":f=f.slice(0,4)}if(t.columnsOrder){var m=t.columnsOrder.concat(f.map((function(e){return e.type})));f.sort((function(e,t){return m.indexOf(e.type)-m.indexOf(t.type)}))}return f})),j=c((function(){return b.value.map((function(e){var n=e.type,r=e.range,u=M(r[1]-r[0]+1,(function(e){return d(r[0]+e)}));return t.filter&&(u=t.filter(n,u)),{type:n,values:u}}))})),Y=c((function(){return j.value.map((function(e){return{values:e.values.map((function(n){return t.formatter(e.type,n)}))}}))})),S=function(){var e=h.value||t.minDate,n=t.formatter,r=j.value.map((function(t){switch(t.type){case"year":return n("year","".concat(e.getFullYear()));case"month":return n("month",d(e.getMonth()+1));case"day":return n("day",d(e.getDate()));case"hour":return n("hour",d(e.getHours()));case"minute":return n("minute",d(e.getMinutes()));default:return""}}));f((function(){var e;null==(e=o.value)||e.setValues(r)}))},C=function(){var e,n,r,u=t.type,i=o.value.getIndexes(),c=function(e){var t=0;j.value.forEach((function(n,r){e===n.type&&(t=r)}));var n=j.value[t].values;return w(n[i[t]])};"month-day"===u?(e=(h.value||t.minDate).getFullYear(),n=c("month"),r=c("day")):(e=c("year"),n=c("month"),r="year-month"===u?1:c("day"));var l=k(e,n);r=r>l?l:r;var f=0,m=0;"datehour"===u&&(f=c("hour")),"datetime"===u&&(f=c("hour"),m=c("minute"));var s=new Date(e,n-1,r,f,m);h.value=a(s)},A=function(){r("update:modelValue",h.value),r("confirm",h.value)},F=function(){return r("cancel")},P=function(){C(),f((function(){f((function(){return r("change",h.value)}))}))};return l((function(){S(),f(C)})),m(Y,S),m(h,(function(e,t){return r("update:modelValue",t?e:null)})),m((function(){return[t.filter,t.maxDate]}),C),m((function(){return t.minDate}),(function(){f(C)})),m((function(){return t.modelValue}),(function(e){var t;(e=a(e))&&e.valueOf()!==(null==(t=h.value)?void 0:t.valueOf())&&(h.value=e)})),s({getPicker:function(){return o.value&&V(o.value,C)}}),function(){return v(O,p({ref:o,columns:Y.value,onChange:P,onCancel:F,onConfirm:A},y(t,H)),u)}}}),F=t(r("datetime-picker"),2),P=F[0],I=F[1],T=Object.keys(Y.props),E=Object.keys(A.props),U=a({},Y.props,A.props,{modelValue:[String,Date]}),B=u({name:P,props:U,setup:function(e,t){var n=t.attrs,r=t.slots,u=i();return s({getPicker:function(){var e;return null==(e=u.value)?void 0:e.getPicker()}}),function(){var t="time"===e.type,a=t?Y:A,o=y(e,t?T:E);return v(a,p({ref:u,class:I()},o,n),r)}}});n("D",x(B))}}}))}();