"use strict";var e=require("@kdcloudjs/kwc"),t=require("./menuItem.js"),i=require("./buttonMenu.js");require("../observable-BXDJFaLN.js"),require("../i18n-CP31jeWH.js");var n=require("../normalize-DKPi18vK.js"),s=require("./shadowBaseClassPrivate.js"),o=require("../label-DdXuOVTE.js");function r(e,n,s,o){const{b:r,k:l,c:c,i:a}=e,{_m0:u}=o;return[c("kd-button-menu",i,{ref:"buttonMenu",props:{iconSize:"x-small",alternativeText:n.buttonAlternateText,menuAlignment:n.computedMenuAlignment,isLoading:n._isLoadingActions,loadingStateAlternativeText:n.spinnerAlternateText,tabIndex:n.internalTabIndex},key:0,on:u||(o._m0={select:r(n.handleActionSelect),open:r(n.handleMenuOpen)})},a(n._actions,function(e){return c("kd-menu-item",t,{props:{value:e,label:e.label,iconName:e.iconName,disabled:e.disabled},key:l(1,e.label)})}))]}require("./icon.js"),require("./button.js"),require("../colorValid-BBnkvgd_.js"),require("../classSet-B5xuJbNb.js"),require("./utilsPrivate.js"),require("../client-Co_j5m_k.js"),require("../ssr-RXknEJpO.js"),require("./iso8601Utils.js"),require("./positionLibrary.js"),require("./tooltipLibrary.js"),require("./primitiveBubble.js"),require("../kddsCommon-CICoPypw.js"),require("./ariaObserver.js"),require("../empty_html-hFq4zm9t.js");var l=e.registerTemplate(r);r.hasRefs=!0,r.stylesheets=[],r.stylesheetToken="kwc-3sdh1vm18en",r.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellActions-undefined_primitiveCellActions",e.freezeTemplate(r);const c="auto-right",a=["auto-right","auto-left","auto","left","center","right","bottom-left","bottom-center","bottom-right"],{loadingActions:u,showActions:d}=o.KingdeePrimitiveCellActions,m=u,h=d;class b extends s{constructor(...e){super(...e),this.containerRect=void 0,this._actions=[],this._isLoadingActions=void 0,this._menuAlignment=c,this.rowKeyValue=void 0,this.colKeyValue=void 0,this.rowActions=void 0,this.internalTabIndex=void 0}get menuAlignment(){return this._menuAlignment}set menuAlignment(e){this._menuAlignment=n.normalizeString(e,{fallbackValue:c,validValues:a})}focus(){this._connected&&this.refs.buttonMenu.focus()}click(){this._connected&&setTimeout(()=>{this.refs.buttonMenu.click()},0)}get computedMenuAlignment(){return this.menuAlignment}get buttonAlternateText(){return`${h}`}get spinnerAlternateText(){return`${m}`}handleActionSelect(e){this.dispatchEvent(new CustomEvent("privatecellactiontriggered",{composed:!0,bubbles:!0,cancelable:!0,detail:{rowKeyValue:this.rowKeyValue,colKeyValue:this.colKeyValue,action:e.detail.value}}))}handleMenuOpen(){this.elementRect=this.refs.buttonMenu.getBoundingClientRect();const e={rowKeyValue:this.rowKeyValue,colKeyValue:this.colKeyValue,doneCallback:this.finishLoadingActions.bind(this),saveContainerPosition:e=>{this.containerRect=e}};"function"==typeof this.rowActions?(this._isLoadingActions=!0,this._actions=[],e.actionsProviderFunction=this.rowActions,Promise.resolve().then(()=>{this.dispatchEvent(new CustomEvent("privatecellactionmenuopening",{composed:!0,bubbles:!0,cancelable:!0,detail:e}))})):this._actions=this.rowActions}connectedCallback(){super.connectedCallback(),this._connected=!0}disconnectedCallback(){this._connected=!1}finishLoadingActions(e){this._isLoadingActions=!1,this._actions=e}}b.delegatesFocus=!0,e.registerDecorators(b,{publicProps:{rowKeyValue:{config:0},colKeyValue:{config:0},rowActions:{config:0},internalTabIndex:{config:0},menuAlignment:{config:3}},publicMethods:["focus","click"],track:{containerRect:1,_actions:1},fields:["_isLoadingActions","_menuAlignment"]});const g=e.registerComponent(b,{tmpl:l,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellActions-",apiVersion:63});module.exports=g;
