import{registerTemplate as e,freezeTemplate as t,registerDecorators as i,registerComponent as n}from"@kdcloudjs/kwc";import o from"./menuItem.js";import s from"./buttonMenu.js";import"../observable-tloG64m6.js";import"../i18n-B98kiI7M.js";import{n as l}from"../normalize-C0Pp7GJL.js";import c from"./shadowBaseClassPrivate.js";import{K as a}from"../label-CY8Q8HAO.js";import"./icon.js";import"./button.js";import"../colorValid-qIPgkqGp.js";import"../classSet-DY6Qvt6E.js";import"./utilsPrivate.js";import"../client-Ddi3i8XR.js";import"../ssr-C2pjZzfv.js";import"./iso8601Utils.js";import"./positionLibrary.js";import"./tooltipLibrary.js";import"./primitiveBubble.js";import"../kddsCommon-CucK_w70.js";import"./ariaObserver.js";import"../empty_html-CjXB8rB4.js";function r(e,t,i,n){const{b:l,k:c,c:a,i:r}=e,{_m0:m}=n;return[a("kd-button-menu",s,{ref:"buttonMenu",props:{iconSize:"x-small",alternativeText:t.buttonAlternateText,menuAlignment:t.computedMenuAlignment,isLoading:t._isLoadingActions,loadingStateAlternativeText:t.spinnerAlternateText,tabIndex:t.internalTabIndex},key:0,on:m||(n._m0={select:l(t.handleActionSelect),open:l(t.handleMenuOpen)})},r(t._actions,function(e){return a("kd-menu-item",o,{props:{value:e,label:e.label,iconName:e.iconName,disabled:e.disabled},key:c(1,e.label)})}))]}var m=e(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",t(r);const u="auto-right",d=["auto-right","auto-left","auto","left","center","right","bottom-left","bottom-center","bottom-right"],{loadingActions:p,showActions:h}=a,b=p,g=h;class A extends c{constructor(...e){super(...e),this.containerRect=void 0,this._actions=[],this._isLoadingActions=void 0,this._menuAlignment=u,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=l(e,{fallbackValue:u,validValues:d})}focus(){this._connected&&this.refs.buttonMenu.focus()}click(){this._connected&&setTimeout(()=>{this.refs.buttonMenu.click()},0)}get computedMenuAlignment(){return this.menuAlignment}get buttonAlternateText(){return`${g}`}get spinnerAlternateText(){return`${b}`}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}}A.delegatesFocus=!0,i(A,{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 f=n(A,{tmpl:m,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\primitiveCellActions-",apiVersion:63});export{f as default};
