"use strict";var e=require("@kdcloudjs/kwc"),t=require("./button.js"),i=require("../ssr-RXknEJpO.js");require("../observable-BXDJFaLN.js"),require("../i18n-CP31jeWH.js");var s=require("../normalize-DKPi18vK.js"),n=require("./shadowBaseClassPrivate.js");function o(e,i,s,n){const{ncls:o,b:l,c:a}=e,{_m0:c,_m1:r}=n;return[i.isButtonIconType?a("kd-button",t,{className:o(i.buttonClass),ref:"buttonIcon",props:{variant:i.variant,alternativeText:i.alternativeText,iconName:i.iconName,iconClass:i.iconClass,disabled:i.disabled,name:i.buttonName,title:i.computedTitle},key:0,on:c||(n._m0={click:l(i.handleButtonClick)})}):null,i.isButtonIconType?null:a("kd-button",t,{className:o(i.buttonClass),ref:"button",props:{variant:i.variant,label:i.label,iconName:i.iconName,iconPosition:i.iconPosition,disabled:i.disabled,name:i.buttonName,title:i.computedTitle},key:1,on:r||(n._m1={click:l(i.handleButtonClick)})})]}require("./icon.js"),require("../colorValid-BBnkvgd_.js"),require("../empty_html-hFq4zm9t.js"),require("./utilsPrivate.js"),require("../client-Co_j5m_k.js"),require("./iso8601Utils.js");var l=e.registerTemplate(o);o.hasRefs=!0,o.stylesheets=[],o.stylesheetToken="kwc-43g4jc4gf7r",o.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellButton-undefined_primitiveCellButton",e.freezeTemplate(o);class a extends n{constructor(...e){super(...e),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(e){const t=s.normalizeBoolean(e);!1===this._disabled&&!0===t&&this.buttonHasFocus&&i.isCSR&&this.fireCellFalseBlurred(),this._disabled=t}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:e}=this;e.addEventListener("focus",this.handleButtonFocused.bind(this)),e.addEventListener("blur",this.handleButtonBlurred.bind(this))}focus(){this.buttonCustomElement&&this.buttonCustomElement.focus()}click(){this.buttonCustomElement&&this.buttonCustomElement.click()}handleButtonFocused(e){e.target.localName.indexOf("button")>-1&&(this.buttonHasFocus=!0)}handleButtonBlurred(e){e.target.localName.indexOf("button")>-1&&(this.buttonHasFocus=!1)}fireCellFalseBlurred(){const{rowKeyValue:e,colKeyValue:t}=this;this.dispatchEvent(new CustomEvent("privatecellfalseblurred",{composed:!0,bubbles:!0,cancelable:!0,detail:{rowKeyValue:e,colKeyValue:t}}))}handleButtonClick(){const{rowKeyValue:e,colKeyValue:t}=this;setTimeout(()=>{this.dispatchEvent(new CustomEvent("privatecellbuttonclicked",{composed:!0,bubbles:!0,cancelable:!0,detail:{rowKeyValue:e,colKeyValue:t}}))},0)}}a.delegatesFocus=!0,e.registerDecorators(a,{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 c=e.registerComponent(a,{tmpl:l,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellButton-",apiVersion:63});module.exports=c;
