import{registerTemplate as t,freezeTemplate as e,registerDecorators as i,registerComponent as o}from"@kdcloudjs/kwc";import s from"./button.js";import{i as n}from"../ssr-C2pjZzfv.js";import"../observable-tloG64m6.js";import"../i18n-B98kiI7M.js";import{d as l}from"../utilsPrivate-CI3EeA5x.js";import a from"./shadowBaseClassPrivate.js";import"./icon.js";import"../colorValid-qIPgkqGp.js";import"../empty_html-CjXB8rB4.js";import"../client-Ddi3i8XR.js";import"./iso8601Utils.js";function c(t,e,i,o){const{ncls:n,b:l,c:a}=t,{_m0:c,_m1:d}=o;return[e.isButtonIconType?a("kd-button",s,{className:n(e.buttonClass),ref:"buttonIcon",props:{variant:e.variant,alternativeText:e.alternativeText,iconName:e.iconName,iconClass:e.iconClass,disabled:e.disabled,name:e.buttonName,title:e.computedTitle},key:0,on:c||(o._m0={click:l(e.handleButtonClick)})}):null,e.isButtonIconType?null:a("kd-button",s,{className:n(e.buttonClass),ref:"button",props:{variant:e.variant,label:e.label,iconName:e.iconName,iconPosition:e.iconPosition,disabled:e.disabled,name:e.buttonName,title:e.computedTitle},key:1,on:d||(o._m1={click:l(e.handleButtonClick)})})]}var d=t(c);c.hasRefs=!0,c.stylesheets=[],c.stylesheetToken="kwc-43g4jc4gf7r",c.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellButton-undefined_primitiveCellButton",e(c);class u extends a{constructor(...t){super(...t),this.rowKeyValue=void 0,this.colKeyValue=void 0,this.variant=void 0,this.label=void 0,this.iconName=void 0,this.iconPosition=void 0,this.buttonName=void 0,this.buttonClass=void 0,this.buttonTitle=void 0,this.internalTabIndex=void 0,this.type=void 0,this.alternativeText=void 0,this.iconClass=void 0,this.initialRender=!0,this.buttonHasFocus=!1,this._connected=!1,this._disabled=!1}get computedTitle(){return this.buttonTitle||this.label}get disabled(){return this._disabled}set disabled(t){const e=l(t);!1===this._disabled&&!0===e&&this.buttonHasFocus&&n&&this.fireCellFalseBlurred(),this._disabled=e}get isButtonIconType(){return"button-icon"===this.type}renderedCallback(){this.initialRender&&this.addListeners(),this.initialRender=!1}connectedCallback(){super.connectedCallback(),this._connected=!0}disconnectedCallback(){this._connected=!1}get buttonCustomElement(){if(this._connected)return this.isButtonIconType?this.refs.buttonIcon:this.refs.button}addListeners(){const{buttonCustomElement:t}=this;t.addEventListener("focus",this.handleButtonFocused.bind(this)),t.addEventListener("blur",this.handleButtonBlurred.bind(this))}focus(){this.buttonCustomElement&&this.buttonCustomElement.focus()}click(){this.buttonCustomElement&&this.buttonCustomElement.click()}handleButtonFocused(t){t.target.localName.indexOf("button")>-1&&(this.buttonHasFocus=!0)}handleButtonBlurred(t){t.target.localName.indexOf("button")>-1&&(this.buttonHasFocus=!1)}fireCellFalseBlurred(){const{rowKeyValue:t,colKeyValue:e}=this;this.dispatchEvent(new CustomEvent("privatecellfalseblurred",{composed:!0,bubbles:!0,cancelable:!0,detail:{rowKeyValue:t,colKeyValue:e}}))}handleButtonClick(){const{rowKeyValue:t,colKeyValue:e}=this;setTimeout(()=>{this.dispatchEvent(new CustomEvent("privatecellbuttonclicked",{composed:!0,bubbles:!0,cancelable:!0,detail:{rowKeyValue:t,colKeyValue:e}}))},0)}}u.delegatesFocus=!0,i(u,{publicProps:{rowKeyValue:{config:0},colKeyValue:{config:0},variant:{config:0},label:{config:0},iconName:{config:0},iconPosition:{config:0},buttonName:{config:0},buttonClass:{config:0},buttonTitle:{config:0},internalTabIndex:{config:0},type:{config:0},alternativeText:{config:0},iconClass:{config:0},disabled:{config:3}},publicMethods:["focus","click"],fields:["initialRender","buttonHasFocus","_connected","_disabled"]});const r=o(u,{tmpl:d,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellButton-",apiVersion:63});export{r as default};
