(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ant-design-vue"),require("@ant-design/icons-vue"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","vue","ant-design-vue","@ant-design/icons-vue","dayjs"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.index={},o.Vue,o.antDesignVue,o.iconsVue,o.dayjs))})(this,function(o,e,p,m,b){"use strict";const _="G",y=e.defineComponent({name:`${_}SeasonPicker`,components:{CalendarOutlined:m.CalendarOutlined,DoubleLeftOutlined:m.DoubleLeftOutlined,DoubleRightOutlined:m.DoubleRightOutlined,Popover:p.Popover,Button:p.Button,Input:p.Input},props:{valueArr:{default:()=>["01-03","04-06","07-09","10-12"],type:Array},value:{default:""},valueFormat:{default:"YYYY-MM",type:String,validator:t=>["YYYY-MM","YYYYQ","YYYY-MM-DD"].includes(t)},getValue:{default:()=>{},type:Function},disabled:{type:Boolean,default:!1}},setup(t,{emit:n}){const i=e.ref(""),c=e.ref(0),r=e.ref(!1),a=e.ref(new Date().getFullYear()),v=s=>{r.value=s},f=()=>{a.value=a.value*1-1},C=()=>{a.value=a.value*1+1},h=s=>{c.value=s+1;const l=t.valueArr[s].split("-");t.getValue(a.value+l[0]+"-"+a.value+l[1]),r.value=!1,i.value=`${a.value}年${c.value}季度`;let d="";t.valueFormat==="YYYY-MM"&&(d=`${a.value}-${l[1]}`),t.valueFormat==="YYYYQ"&&(d=`${a.value}Q${s+1}`),t.valueFormat==="YYYY-MM-DD"&&(d=b(`${a.value}-${Number(l[1])+1}-01`).subtract(1,"day").format(t.valueFormat)),n("input",d),n("change",d),n("update:value",d)},Y=()=>{n("input",""),n("change",""),n("update:value","")};return e.watch(()=>t.value,()=>{if(t.value){const s=t.value.split("-");a.value=s[0].slice(0,4);let l=null;t.valueFormat==="YYYYQ"?(l=s[0].slice(4,5),this.showValue=`${a.value}年${l}季度`):(l=s[1],t.valueArr.forEach((d,D)=>{d.indexOf(l)>-1&&(i.value=`${a.value}年${D+1}季度`)}))}},{immediate:!0}),{year:a,showValue:i,showSeason:r,disabled:e.computed(()=>t.disabled),handleClickChange:v,inputChange:Y,prev:f,next:C,selectSeason:h}}}),M="",g=(t,n)=>{const i=t.__vccOpts||t;for(const[c,r]of n)i[c]=r;return i},V={class:"ant-calendar-date-panel"},E={class:"ant-calendar-header"},$={class:"btn-year"},N={role:"button",class:"ant-calendar-ym-select"},k={class:"ant-calendar-body"},B={class:"season"},O={class:"season"};function S(t,n,i,c,r,a){const v=e.resolveComponent("DoubleLeftOutlined"),f=e.resolveComponent("Button"),C=e.resolveComponent("DoubleRightOutlined"),h=e.resolveComponent("CalendarOutlined"),Y=e.resolveComponent("Input"),s=e.resolveComponent("Popover");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(s,{placement:"bottom",trigger:"click",visible:t.showSeason,onVisibleChange:t.handleClickChange},{content:e.withCtx(()=>[e.createElementVNode("div",V,[e.createElementVNode("div",E,[e.createElementVNode("div",$,[e.createVNode(f,{type:"text",class:"ant-calendar-prev-year-btn",onClick:t.prev},{default:e.withCtx(()=>[e.createVNode(v)]),_:1},8,["onClick"]),e.createElementVNode("span",N,e.toDisplayString(t.year)+"年",1),e.createVNode(f,{type:"text",onClick:t.next,class:"ant-calendar-prev-year-btn"},{default:e.withCtx(()=>[e.createVNode(C)]),_:1},8,["onClick"])])]),e.createElementVNode("div",k,[e.createElementVNode("div",B,[e.createElementVNode("b",{class:"cell",onClick:n[0]||(n[0]=l=>t.selectSeason(0))},"第一季度"),e.createElementVNode("b",{class:"cell",onClick:n[1]||(n[1]=l=>t.selectSeason(1))},"第二季度")]),e.createElementVNode("div",O,[e.createElementVNode("b",{class:"cell",onClick:n[2]||(n[2]=l=>t.selectSeason(2))},"第三季度"),e.createElementVNode("b",{class:"cell",onClick:n[3]||(n[3]=l=>t.selectSeason(3))},"第四季度")])])])]),default:e.withCtx(()=>[e.createVNode(Y,{placeholder:"请选择季度",allowClear:"",value:t.showValue,"onUpdate:value":n[4]||(n[4]=l=>t.showValue=l),disabled:t.disabled,onChange:t.inputChange},{suffix:e.withCtx(()=>[e.createVNode(h,{style:{color:"rgba(0, 0, 0, 0.45)"}})]),_:1},8,["value","disabled","onChange"])]),_:1},8,["visible","onVisibleChange"])])}const u=g(y,[["render",S],["__scopeId","data-v-068f36ec"]]);u.install=function(t,n){t.component(n||u.name,u)};const w={title:"SeasonPicker 季度选择器",parts:"UI组件",category:"数据描述",status:"100%",install(t){t.component(u.name,u)}};o.SeasonPicker=u,o.default=w,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
