import{k as V}from"./chunk-3DT25GZS.js";import{T as D,g as x,l as F,m as M,s as R}from"./chunk-X7VN3ROZ.js";import{c as I,d as b}from"./chunk-I6HXBYFU.js";import{$b as d,Cd as C,Ea as m,Ha as n,Ia as s,Kb as _,Nd as S,Ob as g,Qb as a,Td as w,ad as y,ic as p,jc as c,oc as f,od as v,rc as u,tc as l}from"./chunk-HEIW4SFT.js";w();M();b();v();w();function O(i,h){if(i&1){let e=f();p(0,"paw-datagrid",3),u("rowSelected",function(o){n(e);let r=l(2);return s(r.onRecordSelected(o))})("rowDeselected",function(o){n(e);let r=l(2);return s(r.onRecordDeselected(o))}),c()}if(i&2){let e=h.options,t=l(2);d("records",e)("cols",t.field.columns)("settings",t.gridSettings)("preselection",t.selection)}}function T(i,h){if(i&1){let e=f();p(0,"paw-input-field",2),u("ready",function(o){n(e);let r=l();return s(r.onInputSelectReady(o))}),a(1,O,1,4,"ng-template",null,0,y),c()}if(i&2){let e=l();d("id","input-select-record-"+e.controlId)("field",e.selectField)("formControl",e.formControl)("form",e.formGroup)("model",e.model)("errorDisplayType",e.errorDisplayType)}}var G=(()=>{class i extends F{static{this.suppressOwnErrors=!0}constructor(){super(),this.selectField=null,this.selection=[]}ngOnInit(){super.ngOnInit(),this.syncField(),this.gridSettings={selectByProperty:this.field.selectByProperty,selectableRows:!0,styleClass:"paw-lookup-table",markSelectedRow:!0}}ngOnChanges(e){super.ngOnChanges(e),this.onFieldChange(e.field)}onFieldChange(e){e&&!e.firstChange&&e.currentValue!==e.previousValue&&this.syncField()}onInputSelectReady(e){this.inputSelectApi=e.getInputFieldApi()}onRecordSelected(e){this.selection=[e[this.field.selectByProperty||""]],this.inputSelectApi?.selectOption(e)}onRecordDeselected(e){this.selection=[],this.inputSelectApi?.selectOption(e)}focus(){this.inputSelectApi?.focus()}syncField(){this.selectField={id:this.field.id,component:R,lazyLoad:!0,searchable:this.field.searchable??I.isSet(this.field.apiRequest),options:this.field.options,disabled:this.field.disabled,placeholder:this.field.placeholder,apiRequest:this.field.apiRequest,valueMapper:this.field.valueMapper,labelMapper:this.field.labelMapper,modelValueSetter:this.field.modelValueSetter,modelToOptionMapper:this.field.modelToOptionMapper,onSelected:this.field.onSelected,asyncValidators:this.field.asyncValidators,closeOnSelect:this.field.closeOnSelect??!0,canClear:this.field.canClear??!0,canClearSingle:this.field.canClearSingle??!1,editable:this.field.editable,errors:this.field.errors,feature:this.field.feature,featureId:this.field.featureId,featureParams:this.field.featureParams,hideFeature:this.field.hideFeature,hideFeatureId:this.field.hideFeatureId,convert:this.field.convert,icon:this.field.icon,iconMapper:this.field.iconMapper,matOptions:this.field.matOptions,modifier:this.field.modifier,onBlur:this.field.onBlur,onChange:this.field.onChange,onDebounceChange:this.field.onDebounceChange,onDestroy:this.field.onDestroy,onFocus:this.field.onFocus,onSearch:this.field.onSearch,preventLoadingIndication:this.field.preventLoadingIndication,readonly:this.field.readonly,required:this.field.required,suffix:this.field.suffix,suffixParams:this.field.suffixParams,validators:this.field.validators,modelValueMapper:this.field.modelValueMapper,valueSetter:this.field.valueSetter,type:this.field.type}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=_({type:i,selectors:[["paw-input-select-record"]],features:[g,m],decls:1,vars:1,consts:[["fieldTpl",""],["class","paw-input-select-record-field",3,"id","field","formControl","form","model","errorDisplayType","ready",4,"ngIf"],[1,"paw-input-select-record-field",3,"ready","id","field","formControl","form","model","errorDisplayType"],["type","table",1,"paw-input-select-record-datagrid",3,"rowSelected","rowDeselected","records","cols","settings","preselection"]],template:function(t,o){t&1&&a(0,T,3,6,"paw-input-field",1),t&2&&d("ngIf",o.selectField)},dependencies:[S,C,D,x,V],styles:[".paw-datagrid-table-holder{height:100%;max-height:100%;overflow:hidden}"]})}}return i})();export{G as a};
