"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@kdcloudjs/kwc"),t=require("../kddsCommon-CICoPypw.js"),s=require("../ssr-RXknEJpO.js");require("../observable-BXDJFaLN.js"),require("../i18n-CP31jeWH.js");var i=require("../utilsPrivate-DL4VBetH.js"),a=require("./routingService.js"),r=require("./shadowBaseClassPrivate.js");require("../empty_html-hFq4zm9t.js"),require("../client-Co_j5m_k.js"),require("./iso8601Utils.js"),require("../colorValid-BBnkvgd_.js");var o=[[t.stylesheet0]];const d=e.parseFragment`<a${"a0:href"}${"a0:tabindex"}${3}>${"t1"}</a>`;function n(e,t,s,i){const{ti:a,b:r,d:o,sp:n,st:c,t:l}=e,{_m0:h,_m1:u}=i;return[t.isNavigable?c(d,1,[n(0,{on:u||(i._m1={click:r(t.handleClick)}),attrs:{href:t.state.url,tabindex:a(t.tabIndex)}},null),n(1,null,o(t.displayValue))]):null,t.isNavigable?null:l(o(t.displayValue))]}var c=e.registerTemplate(n);n.stylesheets=[],n.stylesheetToken="kwc-5357u26cao",n.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedLookup-undefined_formattedLookup",o&&n.stylesheets.push.apply(n.stylesheets,o),e.freezeTemplate(n);class l extends CustomEvent{constructor(e){super(l.NAME,{composed:!0,cancelable:!0,bubbles:!0,detail:Object.assign({},e)})}}l.NAME="privatelookupitempicked";const h={PrivateLookupItemPickedEvent:l};class u extends r{set recordId(e){this.state.recordId=e,this.updateLinkData()}get recordId(){return this.state.recordId}get disabled(){return this.state.disabled}set disabled(e){this.state.disabled=i.normalizeBoolean(e),this.isNavigable=!this.disabled&&!!this.dispatcher&&!!this.state.url}constructor(){super(),this.displayValue=void 0,this.tabIndex=void 0,this._connected=void 0,this._dataNavigation=void 0,this.dispatcher=void 0,this.state={disabled:!1,recordId:null,url:null,isNavigable:!1},this._connected=!1,this.dispatcher=null}connectedCallback(){super.connectedCallback(),this._connected=!0,this.updateLinkData(),"enable"===this.getAttribute("data-navigation")&&(this._dataNavigation=!0,this.removeAttribute("data-navigation"))}disconnectedCallback(){this._connected=!1}focus(){this.anchor&&this.anchor.focus()}blur(){this.anchor&&this.anchor.blur()}click(){this.anchor&&this.anchor.click()}get anchor(){if(s.isCSR&&this._connected&&this.isNavigable)return this.template.querySelector("a")}get isNavigable(){return this.state.isNavigable}set isNavigable(e){const t=i.normalizeBoolean(e);this.state.isNavigable=t,this._connected&&this._dataNavigation&&(t?this.setAttribute("data-navigation","enable"):this.removeAttribute("data-navigation"))}updateLinkData(){s.isCSR&&this._connected&&this.state.recordId&&a.getLinkInfo(this,{stateType:"standard__recordPage",attributes:{recordId:this.state.recordId,actionName:"view"}}).then(e=>{this.state.url=e.url,this.dispatcher=e.dispatcher,this.isNavigable=!this.disabled&&!!this.dispatcher&&!!this.state.url})}handleClick(e){this.dispatchEvent(new l({recordId:this.recordId})),this.dispatcher(e)}}e.registerDecorators(u,{publicProps:{displayValue:{config:0},tabIndex:{config:0},recordId:{config:3},disabled:{config:3}},publicMethods:["focus","blur","click"],track:{state:1},fields:["_connected","_dataNavigation","dispatcher"]});const p=e.registerComponent(u,{tmpl:c,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedLookup-",apiVersion:63});exports.EVENTS=h,exports.default=p;
