"use strict";var e=require("@kdcloudjs/kwc"),a=require("../calendarMonth-C1N1hMTf.js"),t=require("./icon.js"),r=require("./shadowBaseClassPrivate.js"),s=require("../intlFormat-Bs-dlvDH.js");require("../i18n-CP31jeWH.js");var n=require("../ssr-RXknEJpO.js");require("../observable-BXDJFaLN.js");var i=require("./iso8601Utils.js");require("../calendar.kdds-uGLTvjLs.js"),require("../utilsPrivate-DL4VBetH.js"),require("../client-Co_j5m_k.js"),require("../colorValid-BBnkvgd_.js"),require("../empty_html-hFq4zm9t.js"),require("./i18nCldrOptions.js"),require("./i18nService.js"),require("./configProvider.js"),require("../classSet-B5xuJbNb.js"),require("../labelUtils-C2UzbgdZ.js"),require("../label-DdXuOVTE.js"),require("./features.js");var l=[a.stylesheet0,function(e,a,t){var r=e?"["+e+"]":"",s=e?"["+e+"-host]":"";return(a?":host [role='year-title']"+r+",\r:host [role='year-title']:hover":s+" [role='year-title']"+r+","+s+" [role='year-title']:hover")+r+" {color: var(--kdds-c-datepicker-switch-color);pointer-events: none;}"}];const o=e.parseFragment`<div class="kdds-align-middle kdds-middle-text${0}"${2}><span role="year-title"${3}>${"t2"}</span></div>`,d=e.parseFragment`<button class="kdds-button kdds-month-button${0}"${"a0:data-year"}${"a0:aria-selected"}${"a0:aria-current"}${2}>${"t1"}</button>`,c={classMap:{"kdds-datepicker__filter":!0,"kdds-grid":!0},key:0},u={classMap:{"kdds-datepicker__filter_month":!0,"kdds-grid":!0,"kdds-grid_align-spread":!0,"kdds-grow":!0},key:1},h={classMap:{"kdds-align-middle":!0},key:2},p={classMap:{"kdds-align-middle":!0},key:7},g={classMap:{"kdds-datepicker__month-list":!0},key:10};function k(e,a,r,s){const{ncls:n,b:i,c:l,h:k,d:m,sp:Y,st:v,k:y,i:j}=e,{_m0:D,_m1:q,_m2:f,_m3:_}=s;return[k("div",c,[k("div",u,[k("div",h,[k("span",{className:n(a.computePrevYearIconClass),key:3,on:D||(s._m0={click:i(a.goToPreviousYearRange)})},[l("kd-icon",t,{props:{iconName:a.previousYearIconName},key:4})])]),v(o,6,[Y(2,null,m(a.computedYearTitle))]),k("div",p,[k("span",{className:n(a.computeNextYearIconClass),key:8,on:q||(s._m1={click:i(a.goToNextYearRange)})},[l("kd-icon",t,{props:{iconName:a.nextYearIconName},key:9})])])])]),k("div",g,j(a.years,function(e){return v(d,y(12,e.fullName),[Y(0,{on:_||(s._m3={click:i(a.handleYearClick)}),attrs:{"data-year":e.fullName,"aria-selected":e.isSelected,"aria-current":e.isCurrent}},null),Y(1,null,m(e.fullName))])}))]}var m=e.registerTemplate(k);k.stylesheets=[],k.stylesheetToken="kwc-5g8qgb1ol8e",k.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\calendarYear-undefined_calendarYear",l&&k.stylesheets.push.apply(k.stylesheets,l),e.freezeTemplate(k);class Y extends r{constructor(...e){super(...e),this.value=void 0,this.calendarYear=void 0}renderCalendar(e){let a=e.getFullYear();a>1&&(a=Math.max(1,a-14)),a<9999&&(a=Math.min(9999,a+14)),this.calendarYear=a}get computedYearTitle(){const e=this.calendarYear-14,a=this.calendarYear;return`${this.padYear(e)} - ${this.padYear(a)}`}get years(){const e=this.calendarYear-14,a=[];for(let t=0;t<15;t++){const r=e+t;a.push({fullName:this.padYear(r),isCurrent:this.getTodaysDate().getFullYear()===e+t,isSelected:this.value&&e+t===this.getSelectedDate()?.getFullYear(),isDisabled:!1})}return a}get hostDirection(){let e;return n.isCSR&&(e=window.getComputedStyle(this.template.host)),e?e.direction.toLowerCase():"ltr"}get previousYearIconName(){return"ltr"===this.hostDirection?"kdfont-qianfanshuangjiantou":"kdfont-houfanshuangjiantou"}get nextYearIconName(){return"ltr"===this.hostDirection?"kdfont-houfanshuangjiantou ":"kdfont-qianfanshuangjiantou"}get canPrevYear(){return this.calendarYear>15}get canNextYear(){return this.calendarYear<9999}get computePrevYearIconClass(){return this.canPrevYear?"":"disabled"}get computeNextYearIconClass(){return this.canNextYear?"":"disabled"}getTodaysDate(){return this.todayDate?this.parseDate(this.todayDate):new Date}getSelectedDate(){return this.parseDate(this.value)}parseDate(e){return s.parseDateTime(e,i.STANDARD_DATE_FORMAT,!0)}handleYearClick(e){const a=e.target.getAttribute("data-year");this.dispatchEvent(new CustomEvent("privateyearselect",{detail:{value:a}}))}padYear(e){return e.toString().padStart(4,"0")}goToPreviousYearRange(){this.canPrevYear&&(this.calendarYear=Math.max(15,this.calendarYear-15))}goToNextYearRange(){this.canNextYear&&(this.calendarYear=Math.min(9999,this.calendarYear+15))}connectedCallback(){super.connectedCallback(),this._connected=!0,this.todayDate=s.getCurrentDateString();const e=this.getSelectedDate()||this.getTodaysDate();this.renderCalendar(e)}disconnectedCallback(){this._connected=!1}}e.registerDecorators(Y,{publicProps:{value:{config:0}},track:{calendarYear:1}});const v=e.registerComponent(Y,{tmpl:m,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\calendarYear-",apiVersion:63});module.exports=v;
