import{a as e,c as t,i as n}from"./preload-helper-B45gAKPr.js";import{pn as r,t as i}from"./iframe-CMLjY6eW.js";import{a,i as o,n as s,o as c,s as l}from"./odataStoryFixtures-Cu0CcqEL.js";import{n as u,t as d}from"./useODataTreeData-Ck4VREaM.js";import{n as f,t as p}from"./TreeMultiSelect-Codlm2j5.js";function m({label:e,description:t,disabled:n,size:r,placeholder:i,query:a,defaultQuery:o,onQuery:s,optionsLayout:c,value:l,onChange:d,odata:f,segments:m,model:g}){let _=u({odata:f,segments:m,model:g});return(0,h.jsx)(p,{label:e,description:t,disabled:n||_.isLoading,size:r,placeholder:i??_.placeholder,nodes:_.nodes,value:l,onChange:d,query:a,defaultQuery:o,onQuery:s,optionsLayout:c,isLoading:_.isLoading,error:_.isError?`Ошибка загрузки`:void 0})}var h,g=n((()=>{d(),f(),h=i(),m.__docgenInfo={description:``,methods:[],displayName:`ODataTreeMultiSelect`,props:{model:{required:!1,tsType:{name:`ODataDependentBaseProps["model"]`,raw:`ODataDependentBaseProps["model"]`},description:``},placeholder:{required:!1,tsType:{name:`string`},description:``},query:{required:!1,tsType:{name:`string`},description:``},defaultQuery:{required:!1,tsType:{name:`string`},description:``},onQuery:{required:!1,tsType:{name:`signature`,type:`function`,raw:`(value: string) => void`,signature:{arguments:[{type:{name:`string`},name:`value`}],return:{name:`void`}}},description:``},optionsLayout:{required:!1,tsType:{name:`union`,raw:`"tree" | "columns"`,elements:[{name:`literal`,value:`"tree"`},{name:`literal`,value:`"columns"`}]},description:`Переключает способ показа загруженного OData-дерева, не меняя формат value и запросов.`}},composes:[`Omit`]}})),_=e({BalancedColumns:()=>T,Basic:()=>S,ErrorState:()=>D,LoadingState:()=>E,MixedSelection:()=>w,ParentCompression:()=>C,__namedExportsOrder:()=>O,default:()=>x});function v({initialValue:e={},odata:t=s,segments:n=c,label:r=`ODataTreeMultiSelect`,description:i,optionsLayout:a=`tree`}){let[o,l]=(0,y.useState)(e);return(0,b.jsxs)(`div`,{style:{display:`grid`,gap:12,maxWidth:520},children:[(0,b.jsx)(m,{label:r,description:i,odata:t,segments:n,value:o,onChange:l,optionsLayout:a}),(0,b.jsxs)(`div`,{style:{fontSize:`var(--font-size-sm)`,color:`var(--content-1)`},children:[`Текущее значение: `,JSON.stringify(o)]})]})}var y,b,x,S,C,w,T,E,D,O,k=n((()=>{y=t(r(),1),o(),g(),b=i(),x={title:`Shared/UI/ODataTreeMultiSelect`,component:m,decorators:[l],parameters:{atomicCanvas:!0,layout:`padded`,odataMockMode:`success`},args:{label:`OData дерево`,description:`Multi-select поверх одной OData-цепочки.`,odata:s,segments:c,value:{},onChange:()=>{}},argTypes:{segments:{control:!1},value:{control:!1},onChange:{control:!1}}},S={render:()=>(0,b.jsx)(v,{initialValue:{OWNER:[a.owner]}})},C={render:()=>(0,b.jsx)(v,{label:`Компрессия subtree`,description:`Пример, когда наружу уходит узел верхнего уровня вместо полного списка потомков.`,initialValue:{REGION:[a.region]}})},w={render:()=>(0,b.jsx)(v,{label:`Смешанный выбор`,description:`Смешанный frontier по соседним уровням в OData-дереве.`,initialValue:{BRANCH:[a.branch],OWNER:[a.ownerAlt]}})},T={render:()=>(0,b.jsx)(v,{label:`OData tree в столбцах`,description:`Все уровни открыты, а popup балансирует ширину и высоту по доступному viewport.`,optionsLayout:`columns`,initialValue:{BRANCH:[a.branch]}})},E={parameters:{odataMockMode:`loading`},render:()=>(0,b.jsx)(v,{description:`Сценарий загрузки дерева.`})},D={parameters:{odataMockMode:`collectionError`},render:()=>(0,b.jsx)(v,{description:`Сценарий ошибки загрузки дерева.`})},S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
  render: () => <StatefulODataTreeMultiSelect initialValue={{
    OWNER: [storyValues.owner]
  }} />
}`,...S.parameters?.docs?.source}}},C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
  render: () => <StatefulODataTreeMultiSelect label="Компрессия subtree" description="Пример, когда наружу уходит узел верхнего уровня вместо полного списка потомков." initialValue={{
    REGION: [storyValues.region]
  }} />
}`,...C.parameters?.docs?.source}}},w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
  render: () => <StatefulODataTreeMultiSelect label="Смешанный выбор" description="Смешанный frontier по соседним уровням в OData-дереве." initialValue={{
    BRANCH: [storyValues.branch],
    OWNER: [storyValues.ownerAlt]
  }} />
}`,...w.parameters?.docs?.source}}},T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
  render: () => <StatefulODataTreeMultiSelect label="OData tree в столбцах" description="Все уровни открыты, а popup балансирует ширину и высоту по доступному viewport." optionsLayout="columns" initialValue={{
    BRANCH: [storyValues.branch]
  }} />
}`,...T.parameters?.docs?.source}}},E.parameters={...E.parameters,docs:{...E.parameters?.docs,source:{originalSource:`{
  parameters: {
    odataMockMode: "loading"
  },
  render: () => <StatefulODataTreeMultiSelect description="Сценарий загрузки дерева." />
}`,...E.parameters?.docs?.source}}},D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`{
  parameters: {
    odataMockMode: "collectionError"
  },
  render: () => <StatefulODataTreeMultiSelect description="Сценарий ошибки загрузки дерева." />
}`,...D.parameters?.docs?.source}}},O=[`Basic`,`ParentCompression`,`MixedSelection`,`BalancedColumns`,`LoadingState`,`ErrorState`]}));k();export{T as BalancedColumns,S as Basic,D as ErrorState,E as LoadingState,w as MixedSelection,C as ParentCompression,O as __namedExportsOrder,x as default,k as n,_ as t};