import{r as s,h as t}from"./p-2c9d0870.js";import"./p-5d02c032.js";import"./p-b1bf9564.js";import{ApplicationContext as i}from"@sankhyalabs/core";import"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-f076d742.js";import"./p-ff1990ad.js";import{F as a}from"./p-7bbbfd42.js";import"./p-9019a32f.js";import{FormLayout as e}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const o=class{constructor(t){s(this,t),this._formConfigFetcher=new a,this.messagesBuilder=void 0,this.layoutType=e.SIDE_BY_SIDE}async save(){this._LayoutFormConfigSingleton.setConfig(this.layoutType),this._formConfigFetcher.saveLayoutFormConfig("formColCfg."+this._resourceID,{config:this.layoutType,newConfig:!0})}async componentWillLoad(){const s=i.getContextValue("__SNK__APPLICATION__");this._LayoutFormConfigSingleton=await(null==s?void 0:s.getLayoutFormConfig()),this._resourceID=await(null==s?void 0:s.getResourceID()),this.setLayoutInit()}setLayoutInit(){if(!this._LayoutFormConfigSingleton)return;const{config:s}=this._LayoutFormConfigSingleton;if(null==s)return void(this.layoutType=e.SIDE_BY_SIDE);const t=Number(s);this.layoutType=Object.values(e).includes(t)?t:e.SIDE_BY_SIDE}toggleLayout(s){this.layoutType=s}getMessage(s,t){var i;return null===(i=this.messagesBuilder)||void 0===i?void 0:i.getMessage(s,t)}render(){return t("div",{class:"ez-flex ez-flex--column"},t("div",{class:"ez-margin-bottom--small"},t("ez-check",{label:this.getMessage("snkLayoutFormConfig.cascadeLayout.label"),class:"ez-margin-bottom--small",onEzChange:()=>this.toggleLayout(e.CASCADE),value:this.layoutType===e.CASCADE}),t("snk-view-representation",{mode:e.CASCADE}),t("label",{class:"ez-label ez-margin--small ez-flex ez-text--medium"},this.getMessage("snkLayoutFormConfig.cascadeLayout.description"))),t("div",{class:"ez-margin-bottom--small"},t("ez-check",{label:this.getMessage("snkLayoutFormConfig.classicCascadeLayout.label"),class:"ez-margin-bottom--small",onEzChange:()=>this.toggleLayout(e.CLASSIC_CASCADE),value:this.layoutType===e.CLASSIC_CASCADE}),t("snk-view-representation",{mode:e.CLASSIC_CASCADE}),t("label",{class:"ez-label ez-margin--small ez-flex ez-text--medium"},this.getMessage("snkLayoutFormConfig.classicCascadeLayout.description"))),t("div",{class:"ez-margin-bottom--small"},t("ez-check",{label:this.getMessage("snkLayoutFormConfig.sideBySideLayout.label"),class:"ez-margin-bottom--small",onEzChange:()=>this.toggleLayout(e.SIDE_BY_SIDE),value:this.layoutType===e.SIDE_BY_SIDE}),t("snk-view-representation",{mode:e.SIDE_BY_SIDE}),t("label",{class:"ez-label ez-margin--small ez-flex ez-text--medium"},this.getMessage("snkLayoutFormConfig.sideBySideLayout.description"))),t("div",null,t("ez-check",{label:this.getMessage("snkLayoutFormConfig.classicSideBySideLayout.label"),class:"ez-margin-bottom--small",onEzChange:()=>this.toggleLayout(e.CLASSIC_SIDE_BY_SIDE),value:this.layoutType===e.CLASSIC_SIDE_BY_SIDE}),t("snk-view-representation",{mode:e.CLASSIC_SIDE_BY_SIDE}),t("label",{class:"ez-label ez-margin--small ez-flex ez-text--medium"},this.getMessage("snkLayoutFormConfig.classicSideBySideLayout.description"))))}};o.style=".sc-snk-layout-form-config-h{display:block}";export{o as snk_layout_form_config}