@nice2dev/ui 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # [1.0.27] — 2026-06-07
2
2
 
3
+ ## 1.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - a96e1c4: Development Studio, round 43 — part 5: folders and sections in the tree.
8
+
9
+ - **A module's layout** (`@nice2dev/ui-forms`): sections that split a module's parts, folders inside
10
+ a group, and where each entity, view, workflow, data source or script sits — kept in a sidecar
11
+ file `{prefix}.studio.json`, so the module's own files stay byte for byte. The tree lays itself
12
+ out by it (module → section → group → folder → entry; empty folders and sections show); a module
13
+ without the file keeps its flat tree. React-free helpers: `parseStudioLayout`,
14
+ `serializeStudioLayout`, `studioLayoutPath`, `addStudioSection`, `addStudioFolder`,
15
+ `placeStudioEntry`, `renameStudioLayoutNode`, `removeStudioLayoutNode`, `renameStudioEntryRef`.
16
+ - **The tree's context menu** (right click, Shift+F10, the Menu key): new section, new folder,
17
+ rename and delete, move an entry to a folder, a section, a new folder or back to its group.
18
+ - **Nested packages**: `NiceStudioPackage.parentId`, and an id with `/` (an OmniVerk category path)
19
+ nests under its parent.
20
+ - **Open editor ids and preset groups**: `NiceStudioEditorId` accepts any string (the built-in ones
21
+ are `NiceStudioBuiltinEditorId`); a preset's `groups` add tree groups, and a file kind's
22
+ `treeGroup` lists its documents in one.
23
+ - **NiceTreeGrid** (`@nice2dev/ui`): `contextMenuItems(row)` — a row's context menu opened by a right
24
+ click, Shift+F10 or the Menu key; arrows move, Enter picks, Escape closes it and returns focus to
25
+ the row. New type `NiceTreeGridMenuItem`.
26
+
27
+ - Updated dependencies [a96e1c4]
28
+ - @nice2dev/i18n@1.4.5
29
+ - @nice2dev/ui-core@1.4.5
30
+
31
+ ## 1.4.4
32
+
33
+ ### Patch Changes
34
+
35
+ - 0dde6f0: Controls, showcase feedback round 43 — part 4.
36
+
37
+ - **NiceThemeGalleryPicker** (new, `@nice2dev/ui`): theme cards with large previews — each card shows
38
+ the theme as a small app in its own layout colours and lights up in the theme's primary when
39
+ hovered or picked. A picker (`value` / `defaultValue` / `onChange(name, item)`), and with `limit`
40
+ one row of cards and a "Show more" button opening every theme full-screen with search and
41
+ categories. Also `NiceThemeGalleryPreview` (the card's preview on its own).
42
+ - **NiceDateRangeBox**: both fields show their date mask (`DD.MM.YYYY`) as the placeholder instead of
43
+ "Start date" / "End date"; with `singleField` both ends can be typed through one mask
44
+ (`DD.MM.YYYY – DD.MM.YYYY`), an end set once its half is a real date.
45
+ - **NiceWiki** works on its own: pages can carry their `content`; the selection, the edit mode and
46
+ saved edits are kept inside unless `selectedPageId`, `editing` or `content` are given (new
47
+ `defaultSelectedPageId`, `defaultEditing`); the tree filters as you search; breadcrumbs; Markdown
48
+ renders; edit mode uses NiceMarkdownEditor or NiceHtmlEditor with Save and Cancel.
49
+ - **NiceDiagramEditor**: the toolbar is a ribbon — Home / Insert / Format / View tabs of captioned
50
+ sections of icon buttons named by their hints; only wired actions show. The property panel hides
51
+ and shows from a toggle at the right of the tabs (new `defaultPropertiesOpen`; `DiagramToolbar`
52
+ gained `defaultTab`, `propertiesOpen`, `onToggleProperties`).
53
+ - **NiceSpatialEditor**: a File / Edit / View / Help menu bar (the plan type moved to View, import
54
+ and export to File); the library is the Toolbox and leaves the wall to the Wall tool; doors and
55
+ windows are placed from the Toolbox only; Layers and Properties fold from their headers
56
+ (`LayerPanel` / `PropertiesPanel` gained `collapsed` / `onToggleCollapsed`).
57
+
58
+ - Updated dependencies [0dde6f0]
59
+ - @nice2dev/i18n@1.4.4
60
+ - @nice2dev/ui-core@1.4.4
61
+
3
62
  ## 1.4.3
4
63
 
5
64
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("react/jsx-runtime"),y=require("@nice2dev/ui-core"),r=require("react"),pn=require("react-dom"),Wi=require("./NiceForm-CT9hEXpc.cjs"),qi=require("./devops-cgRBnZVX.cjs"),Vi=require("./NiceModal-BRVzjuUN.cjs"),Ui=require("./NicePagination-D7XxeNFz.cjs"),ys=require("./NiceSelect-BNPXs6FQ.cjs"),Hi=[],Ji=[{target:".nice-filterbuilder",titleKey:"tutorial.filterBuilder.intro.title",title:"Filter builder",contentKey:"tutorial.filterBuilder.intro.content",content:"Build complex AND/OR filter trees: add conditions and nested groups, choose fields and operators, and save reusable presets.",placement:"auto"}],Xi=[{value:"=",label:"Equals"},{value:"<>",label:"Not Equals"},{value:"<",label:"Less Than"},{value:"<=",label:"Less or Equal"},{value:">",label:"Greater Than"},{value:">=",label:"Greater or Equal"},{value:"contains",label:"Contains"},{value:"notcontains",label:"Not Contains"},{value:"startswith",label:"Starts With"},{value:"endswith",label:"Ends With"},{value:"isblank",label:"Is Blank"},{value:"isnotblank",label:"Is Not Blank"}],Yi=({condition:l,fields:x,onChange:m,onRemove:_})=>{const{t:b}=y.useNiceTranslation(),h=x.find(g=>g.field===l.field),N=l.operator==="isblank"||l.operator==="isnotblank",S=h?.operators||Xi;return t.jsxs("div",{className:"nice-filterbuilder__condition",children:[t.jsx("select",{className:"nice-filterbuilder__select",value:l.field,onChange:g=>m({...l,field:g.target.value,value:""}),children:x.map(g=>t.jsx("option",{value:g.field,children:g.label},g.field))}),t.jsx("select",{className:"nice-filterbuilder__select",value:l.operator,onChange:g=>m({...l,operator:g.target.value}),children:S.map(g=>t.jsx("option",{value:g.value,children:g.label},g.value))}),!N&&(h?.options?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(l.value??""),onChange:g=>m({...l,value:g.target.value}),children:[t.jsx("option",{value:"",children:"--"}),h.options.map(g=>t.jsx("option",{value:g.value,children:g.label},g.value))]}):h?.type==="boolean"?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(l.value??""),onChange:g=>m({...l,value:g.target.value==="true"}),children:[t.jsx("option",{value:"true",children:b("filterBuilder.true","True")}),t.jsx("option",{value:"false",children:b("filterBuilder.false","False")})]}):t.jsx("input",{className:"nice-filterbuilder__input",type:h?.type==="number"?"number":h?.type==="date"?"date":"text",value:String(l.value??""),onChange:g=>m({...l,value:h?.type==="number"?Number(g.target.value):g.target.value})})),t.jsx("button",{"aria-label":b("filterBuilder.close","Close"),className:"nice-filterbuilder__remove",onClick:_,children:t.jsx(y.NiceIcon,{name:"close",size:14})})]})},vs=({group:l,fields:x,onChange:m,onRemove:_,depth:b,maxDepth:h})=>{const{t:N}=y.useNiceTranslation(),[S,g]=r.useState(!1),Z=()=>m({...l,logic:l.logic==="and"?"or":"and"}),K=l.items.filter(C=>C.type==="condition").length,ee=l.items.length-K,de=[K?`${K} condition${K>1?"s":""}`:"",ee?`${ee} group${ee>1?"s":""}`:""].filter(Boolean).join(" · ")||"empty",ue=()=>{const C={type:"condition",field:x[0]?.field||"",operator:"=",value:""};m({...l,items:[...l.items,C]})},fe=()=>{if(b>=h)return;const C={type:"group",logic:"and",items:[]};m({...l,items:[...l.items,C]})},M=(C,R)=>{const k=[...l.items];k[C]=R,m({...l,items:k})},te=C=>{m({...l,items:l.items.filter((R,k)=>k!==C)})};return t.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(b,3)}`,children:[t.jsxs("div",{className:"nice-filterbuilder__group-header",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__collapse",onClick:()=>g(C=>!C),"aria-expanded":!S,title:S?N("filterBuilder.expandGroup","Expand group"):N("filterBuilder.collapseGroup","Collapse group"),children:t.jsx(y.NiceIcon,{name:S?"chevron-right":"chevron-down",size:"sm"})}),t.jsx("button",{className:"nice-filterbuilder__logic",onClick:Z,title:N("filterBuilder.matchClickToSwitch","Match {mode} — click to switch to {other}").replace("{mode}",l.logic==="and"?N("filterBuilder.matchAll","ALL"):N("filterBuilder.matchAny","ANY")).replace("{other}",l.logic==="and"?"OR":"AND"),children:l.logic.toUpperCase()}),S?t.jsx("span",{className:"nice-filterbuilder__summary",children:de}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:ue,children:N("filterBuilder.condition","+ Condition")}),b<h&&t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:fe,children:N("filterBuilder.group","+ Group")})]}),_&&t.jsx("button",{"aria-label":N("filterBuilder.close","Close"),className:"nice-filterbuilder__remove",onClick:_,children:t.jsx(y.NiceIcon,{name:"close",size:14})})]}),!S&&t.jsx("div",{className:"nice-filterbuilder__group-body",children:l.items.map((C,R)=>t.jsx(r.Fragment,{children:C.type==="condition"?t.jsx(Yi,{condition:C,fields:x,onChange:k=>M(R,k),onRemove:()=>te(R)}):t.jsx(vs,{group:C,fields:x,onChange:k=>M(R,k),onRemove:()=>te(R),depth:b+1,maxDepth:h})},R))})]})},xn=({fields:l=Hi,value:x,defaultValue:m,onChange:_,maxDepth:b=3,presets:h,onSavePreset:N,onDeletePreset:S,tutorial:g,className:Z,style:K,"data-testid":ee})=>{const{t:de}=y.useNiceTranslation(),[ue,fe]=y.useControllableState({value:x,defaultValue:m,fallbackValue:{type:"group",logic:"and",items:[]},onChange:_,componentName:"NiceFilterBuilder"}),[M,te]=r.useState(""),C=r.useCallback(k=>{const Qe=h?.find(ze=>ze.name===k);Qe&&fe(structuredClone(Qe.filter))},[h,fe]),R=r.useCallback(()=>{!M.trim()||!N||(N({name:M.trim(),filter:structuredClone(ue)}),te(""))},[M,ue,N]);return t.jsxs("div",{className:`nice-filterbuilder ${Z||""}`,style:{position:"relative",...K},"data-testid":ee,children:[t.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:t.jsx(y.NiceTutorialButton,{steps:y.resolveTutorial(g,Ji)})}),(h?.length||N)&&t.jsxs("div",{className:"nice-filterbuilder__presets",children:[h&&h.length>0&&t.jsx("div",{className:"nice-filterbuilder__preset-list",children:h.map(k=>t.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>C(k.name),children:k.name}),S&&t.jsx("button",{"aria-label":de("filterBuilder.close","Close"),type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>S(k.name),children:t.jsx(y.NiceIcon,{name:"close",size:14})})]},k.name))}),N&&t.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[t.jsx("input",{className:"nice-filterbuilder__input",value:M,onChange:k=>te(k.target.value),placeholder:de("filterBuilder.presetName","Preset name...")}),t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:R,disabled:!M.trim(),children:de("filterBuilder.save","Save")})]})]}),t.jsx(vs,{group:ue,fields:l,onChange:fe,depth:0,maxDepth:b})]})};process.env.NODE_ENV!=="production"&&(xn.displayName="NiceFilterBuilder");const js="nice-datagrid-";function mn(l){if(typeof window>"u")return null;try{const x=window.localStorage.getItem(js+l);return x?JSON.parse(x):null}catch{return null}}function _s(l,x){if(!(typeof window>"u"))try{window.localStorage.setItem(js+l,x)}catch{}}function Ns(l){const x={};return Object.keys(l.columnWidths).length>0&&(x.columnWidths=l.columnWidths),l.columnOrder&&l.columnOrder.length>0&&(x.columnOrder=l.columnOrder),l.hiddenColumns&&l.hiddenColumns.length>0&&(x.hiddenColumns=l.hiddenColumns),l.sortField&&l.sortDirection&&(x.sortField=l.sortField,x.sortDirection=l.sortDirection),l.pageSize!==void 0&&(x.pageSize=l.pageSize),l.expandedGroups.size>0&&(x.expandedGroups=Array.from(l.expandedGroups)),x}function Cs(l,x,m){const _=l.map(b=>b[x]).filter(b=>typeof b=="number");if(_.length===0)return m==="count"?"0":"";switch(m){case"sum":return _.reduce((b,h)=>b+h,0).toLocaleString();case"avg":return(_.reduce((b,h)=>b+h,0)/_.length).toLocaleString(void 0,{maximumFractionDigits:2});case"count":return String(l.length);case"min":return Math.min(..._).toLocaleString();case"max":return Math.max(..._).toLocaleString()}}function Ss(l,x){const m=/^([^#0,.]*)([#0,]+(?:\.[#0]+)?)(.*)$/.exec(x);if(!m)return String(l);const[,_,b,h]=m,[N,S=""]=b.split("."),g=new Intl.NumberFormat(void 0,{useGrouping:N.includes(","),minimumIntegerDigits:Math.min(21,Math.max(1,(N.match(/0/g)??[]).length)),minimumFractionDigits:(S.match(/0/g)??[]).length,maximumFractionDigits:S.length}).format(l);return`${_}${g}${h}`}function gn(l,x,m=40){let _=m;return l.querySelectorAll(`[data-field="${x.replace(/["\\]/g,"\\$&")}"]`).forEach(h=>{let N=h.scrollWidth;const S=typeof document.createRange=="function"?document.createRange():null;if(S&&typeof S.getBoundingClientRect=="function"){S.selectNodeContents(h);const g=S.getBoundingClientRect().width;if(g>0){const Z=window.getComputedStyle(h),K=(parseFloat(Z.paddingLeft)||0)+(parseFloat(Z.paddingRight)||0);N=Math.ceil(g+K)}}_=Math.max(_,N)}),_}function hn(l,x){const m=new Map(l.map(b=>[b.field,b])),_=[];for(const b of x){const h=m.get(b);h&&(_.push(h),m.delete(b))}return[..._,...l.filter(b=>m.has(b.field))]}function ks(l,x){const m=[];for(const _ of l){const b=x.find(N=>N.columns.includes(_))??null,h=m[m.length-1];h&&h.group===b?h.span+=1:m.push({group:b,span:1})}return m}function Ye(l){return l.includes(",")||l.includes('"')||l.includes(`
1
+ "use strict";const t=require("react/jsx-runtime"),y=require("@nice2dev/ui-core"),r=require("react"),pn=require("react-dom"),Wi=require("./NiceForm-O3sv-DNX.cjs"),qi=require("./devops-cgRBnZVX.cjs"),Vi=require("./NiceModal-BRVzjuUN.cjs"),Ui=require("./NicePagination-D7XxeNFz.cjs"),ys=require("./NiceSelect-BNPXs6FQ.cjs"),Hi=[],Ji=[{target:".nice-filterbuilder",titleKey:"tutorial.filterBuilder.intro.title",title:"Filter builder",contentKey:"tutorial.filterBuilder.intro.content",content:"Build complex AND/OR filter trees: add conditions and nested groups, choose fields and operators, and save reusable presets.",placement:"auto"}],Xi=[{value:"=",label:"Equals"},{value:"<>",label:"Not Equals"},{value:"<",label:"Less Than"},{value:"<=",label:"Less or Equal"},{value:">",label:"Greater Than"},{value:">=",label:"Greater or Equal"},{value:"contains",label:"Contains"},{value:"notcontains",label:"Not Contains"},{value:"startswith",label:"Starts With"},{value:"endswith",label:"Ends With"},{value:"isblank",label:"Is Blank"},{value:"isnotblank",label:"Is Not Blank"}],Yi=({condition:l,fields:x,onChange:m,onRemove:_})=>{const{t:b}=y.useNiceTranslation(),h=x.find(g=>g.field===l.field),N=l.operator==="isblank"||l.operator==="isnotblank",S=h?.operators||Xi;return t.jsxs("div",{className:"nice-filterbuilder__condition",children:[t.jsx("select",{className:"nice-filterbuilder__select",value:l.field,onChange:g=>m({...l,field:g.target.value,value:""}),children:x.map(g=>t.jsx("option",{value:g.field,children:g.label},g.field))}),t.jsx("select",{className:"nice-filterbuilder__select",value:l.operator,onChange:g=>m({...l,operator:g.target.value}),children:S.map(g=>t.jsx("option",{value:g.value,children:g.label},g.value))}),!N&&(h?.options?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(l.value??""),onChange:g=>m({...l,value:g.target.value}),children:[t.jsx("option",{value:"",children:"--"}),h.options.map(g=>t.jsx("option",{value:g.value,children:g.label},g.value))]}):h?.type==="boolean"?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(l.value??""),onChange:g=>m({...l,value:g.target.value==="true"}),children:[t.jsx("option",{value:"true",children:b("filterBuilder.true","True")}),t.jsx("option",{value:"false",children:b("filterBuilder.false","False")})]}):t.jsx("input",{className:"nice-filterbuilder__input",type:h?.type==="number"?"number":h?.type==="date"?"date":"text",value:String(l.value??""),onChange:g=>m({...l,value:h?.type==="number"?Number(g.target.value):g.target.value})})),t.jsx("button",{"aria-label":b("filterBuilder.close","Close"),className:"nice-filterbuilder__remove",onClick:_,children:t.jsx(y.NiceIcon,{name:"close",size:14})})]})},vs=({group:l,fields:x,onChange:m,onRemove:_,depth:b,maxDepth:h})=>{const{t:N}=y.useNiceTranslation(),[S,g]=r.useState(!1),Z=()=>m({...l,logic:l.logic==="and"?"or":"and"}),K=l.items.filter(C=>C.type==="condition").length,ee=l.items.length-K,de=[K?`${K} condition${K>1?"s":""}`:"",ee?`${ee} group${ee>1?"s":""}`:""].filter(Boolean).join(" · ")||"empty",ue=()=>{const C={type:"condition",field:x[0]?.field||"",operator:"=",value:""};m({...l,items:[...l.items,C]})},fe=()=>{if(b>=h)return;const C={type:"group",logic:"and",items:[]};m({...l,items:[...l.items,C]})},M=(C,R)=>{const k=[...l.items];k[C]=R,m({...l,items:k})},te=C=>{m({...l,items:l.items.filter((R,k)=>k!==C)})};return t.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(b,3)}`,children:[t.jsxs("div",{className:"nice-filterbuilder__group-header",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__collapse",onClick:()=>g(C=>!C),"aria-expanded":!S,title:S?N("filterBuilder.expandGroup","Expand group"):N("filterBuilder.collapseGroup","Collapse group"),children:t.jsx(y.NiceIcon,{name:S?"chevron-right":"chevron-down",size:"sm"})}),t.jsx("button",{className:"nice-filterbuilder__logic",onClick:Z,title:N("filterBuilder.matchClickToSwitch","Match {mode} — click to switch to {other}").replace("{mode}",l.logic==="and"?N("filterBuilder.matchAll","ALL"):N("filterBuilder.matchAny","ANY")).replace("{other}",l.logic==="and"?"OR":"AND"),children:l.logic.toUpperCase()}),S?t.jsx("span",{className:"nice-filterbuilder__summary",children:de}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:ue,children:N("filterBuilder.condition","+ Condition")}),b<h&&t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:fe,children:N("filterBuilder.group","+ Group")})]}),_&&t.jsx("button",{"aria-label":N("filterBuilder.close","Close"),className:"nice-filterbuilder__remove",onClick:_,children:t.jsx(y.NiceIcon,{name:"close",size:14})})]}),!S&&t.jsx("div",{className:"nice-filterbuilder__group-body",children:l.items.map((C,R)=>t.jsx(r.Fragment,{children:C.type==="condition"?t.jsx(Yi,{condition:C,fields:x,onChange:k=>M(R,k),onRemove:()=>te(R)}):t.jsx(vs,{group:C,fields:x,onChange:k=>M(R,k),onRemove:()=>te(R),depth:b+1,maxDepth:h})},R))})]})},xn=({fields:l=Hi,value:x,defaultValue:m,onChange:_,maxDepth:b=3,presets:h,onSavePreset:N,onDeletePreset:S,tutorial:g,className:Z,style:K,"data-testid":ee})=>{const{t:de}=y.useNiceTranslation(),[ue,fe]=y.useControllableState({value:x,defaultValue:m,fallbackValue:{type:"group",logic:"and",items:[]},onChange:_,componentName:"NiceFilterBuilder"}),[M,te]=r.useState(""),C=r.useCallback(k=>{const Qe=h?.find(ze=>ze.name===k);Qe&&fe(structuredClone(Qe.filter))},[h,fe]),R=r.useCallback(()=>{!M.trim()||!N||(N({name:M.trim(),filter:structuredClone(ue)}),te(""))},[M,ue,N]);return t.jsxs("div",{className:`nice-filterbuilder ${Z||""}`,style:{position:"relative",...K},"data-testid":ee,children:[t.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:t.jsx(y.NiceTutorialButton,{steps:y.resolveTutorial(g,Ji)})}),(h?.length||N)&&t.jsxs("div",{className:"nice-filterbuilder__presets",children:[h&&h.length>0&&t.jsx("div",{className:"nice-filterbuilder__preset-list",children:h.map(k=>t.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>C(k.name),children:k.name}),S&&t.jsx("button",{"aria-label":de("filterBuilder.close","Close"),type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>S(k.name),children:t.jsx(y.NiceIcon,{name:"close",size:14})})]},k.name))}),N&&t.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[t.jsx("input",{className:"nice-filterbuilder__input",value:M,onChange:k=>te(k.target.value),placeholder:de("filterBuilder.presetName","Preset name...")}),t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:R,disabled:!M.trim(),children:de("filterBuilder.save","Save")})]})]}),t.jsx(vs,{group:ue,fields:l,onChange:fe,depth:0,maxDepth:b})]})};process.env.NODE_ENV!=="production"&&(xn.displayName="NiceFilterBuilder");const js="nice-datagrid-";function mn(l){if(typeof window>"u")return null;try{const x=window.localStorage.getItem(js+l);return x?JSON.parse(x):null}catch{return null}}function _s(l,x){if(!(typeof window>"u"))try{window.localStorage.setItem(js+l,x)}catch{}}function Ns(l){const x={};return Object.keys(l.columnWidths).length>0&&(x.columnWidths=l.columnWidths),l.columnOrder&&l.columnOrder.length>0&&(x.columnOrder=l.columnOrder),l.hiddenColumns&&l.hiddenColumns.length>0&&(x.hiddenColumns=l.hiddenColumns),l.sortField&&l.sortDirection&&(x.sortField=l.sortField,x.sortDirection=l.sortDirection),l.pageSize!==void 0&&(x.pageSize=l.pageSize),l.expandedGroups.size>0&&(x.expandedGroups=Array.from(l.expandedGroups)),x}function Cs(l,x,m){const _=l.map(b=>b[x]).filter(b=>typeof b=="number");if(_.length===0)return m==="count"?"0":"";switch(m){case"sum":return _.reduce((b,h)=>b+h,0).toLocaleString();case"avg":return(_.reduce((b,h)=>b+h,0)/_.length).toLocaleString(void 0,{maximumFractionDigits:2});case"count":return String(l.length);case"min":return Math.min(..._).toLocaleString();case"max":return Math.max(..._).toLocaleString()}}function Ss(l,x){const m=/^([^#0,.]*)([#0,]+(?:\.[#0]+)?)(.*)$/.exec(x);if(!m)return String(l);const[,_,b,h]=m,[N,S=""]=b.split("."),g=new Intl.NumberFormat(void 0,{useGrouping:N.includes(","),minimumIntegerDigits:Math.min(21,Math.max(1,(N.match(/0/g)??[]).length)),minimumFractionDigits:(S.match(/0/g)??[]).length,maximumFractionDigits:S.length}).format(l);return`${_}${g}${h}`}function gn(l,x,m=40){let _=m;return l.querySelectorAll(`[data-field="${x.replace(/["\\]/g,"\\$&")}"]`).forEach(h=>{let N=h.scrollWidth;const S=typeof document.createRange=="function"?document.createRange():null;if(S&&typeof S.getBoundingClientRect=="function"){S.selectNodeContents(h);const g=S.getBoundingClientRect().width;if(g>0){const Z=window.getComputedStyle(h),K=(parseFloat(Z.paddingLeft)||0)+(parseFloat(Z.paddingRight)||0);N=Math.ceil(g+K)}}_=Math.max(_,N)}),_}function hn(l,x){const m=new Map(l.map(b=>[b.field,b])),_=[];for(const b of x){const h=m.get(b);h&&(_.push(h),m.delete(b))}return[..._,...l.filter(b=>m.has(b.field))]}function ks(l,x){const m=[];for(const _ of l){const b=x.find(N=>N.columns.includes(_))??null,h=m[m.length-1];h&&h.group===b?h.span+=1:m.push({group:b,span:1})}return m}function Ye(l){return l.includes(",")||l.includes('"')||l.includes(`
2
2
  `)?`"${l.replace(/"/g,'""')}"`:l}const ye={width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Qi=()=>t.jsx("svg",{...ye,children:t.jsx("polyline",{points:"6 15 12 9 18 15"})}),Je=()=>t.jsx("svg",{...ye,children:t.jsx("polyline",{points:"6 9 12 15 18 9"})}),Zi=()=>t.jsxs("svg",{...ye,style:{opacity:.55},children:[t.jsx("polyline",{points:"6 10 12 5 18 10"}),t.jsx("polyline",{points:"6 14 12 19 18 14"})]}),jt=()=>t.jsx("svg",{...ye,children:t.jsx("polyline",{points:"9 6 15 12 9 18"})}),ea=()=>t.jsxs("svg",{...ye,children:[t.jsx("polyline",{points:"3 17 9 11 13 15 21 7"}),t.jsx("polyline",{points:"14 7 21 7 21 14"})]}),ta=()=>t.jsxs("svg",{...ye,children:[t.jsx("polyline",{points:"3 7 9 13 13 9 21 17"}),t.jsx("polyline",{points:"14 17 21 17 21 10"})]}),na=()=>t.jsx("svg",{...ye,children:t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})}),sa=40,Xe=l=>l.stopPropagation(),ia=[];function aa(l){return typeof l=="boolean"?l?t.jsx(y.NiceIcon,{name:"check",size:16,className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--true",title:"true"}):t.jsx(y.NiceIcon,{name:"close",size:16,className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--false",title:"false"}):String(l??"")}function bn({columns:l=ia,data:x,keyField:m="id",dataSource:_,sortable:b=!0,sortField:h,sortDirection:N,onSort:S,showAdvancedFilter:g,advancedFilter:Z,onAdvancedFilterChange:K,filterFields:ee,filterPresets:de,onSaveFilterPreset:ue,onDeleteFilterPreset:fe,selectable:M,selectedKeys:te,onSelectionChange:C,pagination:R,pageSize:k=10,page:Qe,onPageChange:ze,totalRows:yn,autoPagination:ne=!1,stickyHeader:_t=!0,stickyFooter:ws=!0,searchable:vn,searchPlaceholder:Ms,virtualScroll:X,rowHeight:W=40,groupBy:Nt,groupRender:Ze,onCellEdit:$,editMode:Re="inline",formItems:Ds,formColumns:Is=2,editFormTitle:zs,formProps:Rs,onRowEdit:et,onRowAdd:tt,onRowDelete:ve,confirmDelete:nt,bulkActions:Ct,onBulkDelete:St,exportCsv:jn,exportFilename:_n="export",detailRow:q,expandedRowKeys:As,onExpandedRowChange:kt,columnReorder:Es,onColumnReorder:Nn,columnResize:wt,rowDraggable:z,onRowReorder:st,striped:Os,compact:Ts,size:Mt,loading:$s,emptyText:Fs,toolbar:Cn,onRowClick:pe,pinnedTopKeys:Dt,pinnedBottomKeys:It,colSpan:Sn,showStatusBar:Ls,contextMenuItems:it,onContextMenuAction:Ps,printFriendly:Bs,keyboardNavigation:Ae,focusedCell:Gs,onFocusedCellChange:zt,cellRangeSelection:kn,selectedCellRange:Ks,onCellRangeChange:Rt,clipboard:me,clipboardFormat:At="text",onBeforeCopy:wn,onCopy:Mn,onPaste:Et,quickFilters:se,activeQuickFilters:Ws,onQuickFilterChange:Ot,columnGroups:Tt,stateStorageKey:U,initialState:qs,onStateChange:Dn,flashRowKeys:$t,flashDuration:In=500,autoFitColumns:Ft,showColumnStats:Ee,rowIndicator:Oe,frozenRows:Vs,className:Us,style:Hs,accessMode:Js,id:Xs,displayStyle:zn,disabled:Ys,readOnly:Rn,error:Lt}){const Pt=y.useNiceAccessMode(Js,Xs),Qs=Pt==="hidden",je=Ys||Pt==="disabled",Te=Rn||je||Pt==="readOnly",ie=!!ve&&!Te,ge=Math.max(0,Math.floor(Vs??0)),{t:u}=y.useNiceTranslation();y.useComponentDisplayStyle("table",zn),y.useComponentDisplayClass("table",zn);const D=y.useNiceDataSource(_??null,{autoLoad:!!_,defaultPageSize:k}),w=!!_,Bt=r.useMemo(()=>w?D.data:x??[],[w,D.data,x]),at=w?D.loading:$s,[O]=r.useState(()=>qs??(U?mn(U):null)),[An,En]=r.useState(()=>({field:O?.sortField??"",dir:O?.sortDirection??null})),[Zs,ei]=r.useState(1),[ti,Gt]=r.useState(new Set),[rt,ni]=r.useState(""),[si,ii]=r.useState({type:"group",logic:"and",items:[]}),[On,Tn]=r.useState(!1),ae=Z??si,$n=e=>{K?K(e):ii(e)},ai=r.useMemo(()=>ee??l.filter(e=>e.filterable!==!1&&e.field).map(e=>({field:String(e.field),label:String(e.header??e.field)})),[ee,l]),he=ae.items.length,[lt,Fn]=r.useState(O?.pageSize??k),[re,Kt]=r.useState(null),[ot,$e]=r.useState(null),[_e,xe]=r.useState(null),[Wt,Ln]=r.useState(()=>new Set(O?.expandedGroups??[])),[qt,ri]=r.useState(0),ct=r.useRef(null),[li,oi]=r.useState(new Set),dt=As??li,[Fe,Vt]=r.useState(()=>O?.columnWidths??{}),[Ne,Ce]=r.useState(null),[Se,Ut]=r.useState(null),[Ht,Jt]=r.useState(null),[ci,di]=r.useState(null),[ui,fi]=r.useState(null),[pi,mi]=r.useState([]),[ke,Xt]=r.useState(null),Yt=r.useRef(null),[ut,Qt]=r.useState(()=>O?.hiddenColumns??[]),[Le,Pn]=r.useState(()=>O?.columnOrder??null),[Zt,en]=r.useState(null),[Bn,ft]=r.useState(null),tn=r.useRef(null),[gi,Gn]=r.useState(new Set),[Pe,nn]=r.useState(null),Kn=r.useRef(null),[hi,xi]=r.useState({}),le=r.useRef(null),[bi,yi]=r.useState(k);r.useEffect(()=>{if(!ne)return;const e=ct.current;if(!e||typeof ResizeObserver>"u")return;const n=()=>{const i=e.clientHeight;if(i<=0)return;const a=Math.max(1,Math.floor(i/W)-1);yi(o=>o===a?o:a),w&&D.setPageSize(a)};n();const s=new ResizeObserver(n);return s.observe(e),()=>s.disconnect()},[ne,W,w]);const B=Gs??ci,F=Ks??ui,H=Ws??pi,Wn=r.useRef(U);r.useEffect(()=>{if(Wn.current===U)return;Wn.current=U;const e=U?mn(U):null;e&&(Vt(e.columnWidths??{}),Ln(new Set(e.expandedGroups??[])),Qt(e.hiddenColumns??[]),Pn(e.columnOrder??null),En({field:e.sortField??"",dir:e.sortDirection??null}),e.pageSize!==void 0&&Fn(e.pageSize))},[U]),r.useEffect(()=>{!w||!O||(O.sortField&&O.sortDirection&&D.setSortField(O.sortField,O.sortDirection),O.pageSize!==void 0&&!ne&&D.setPageSize(O.pageSize))},[]),r.useEffect(()=>{if(!$t?.size)return;Gn(new Set($t));const e=setTimeout(()=>Gn(new Set),In);return()=>clearTimeout(e)},[$t,In]),r.useEffect(()=>{if(!Se)return;const e=()=>Ut(null);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[Se]);const vi=r.useCallback((e,n)=>{it?.length&&(e.preventDefault(),Ut({x:e.clientX,y:e.clientY,row:n}))},[it]),qn=r.useCallback(e=>{const n=new Set(dt);n.has(e)?n.delete(e):n.add(e),kt?kt(n):oi(n)},[dt,kt]),ji=r.useCallback((e,n)=>{if(!wt)return;n.preventDefault();const s=n.clientX,a=n.target.closest("th")?.offsetWidth??100,o=f=>{const d=Math.max(40,a+f.clientX-s);Vt(j=>({...j,[e]:d}))},c=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",c)},[wt]),J=w?D.sort[0]?.field??"":h??An.field,G=w?D.sort[0]?.direction??null:N??An.dir,we=w?D.page:Qe??Zs,I=te??ti,Y=r.useMemo(()=>Le?hn(l,Le):l,[l,Le]),T=r.useMemo(()=>Y.filter(e=>!e.hidden&&!ut.includes(e.field)),[Y,ut]),sn=r.useMemo(()=>T.filter(e=>e.pinned==="left"),[T]),pt=r.useMemo(()=>T.filter(e=>e.pinned==="right"),[T]),Vn=r.useMemo(()=>T.filter(e=>!e.pinned),[T]),v=r.useMemo(()=>[...sn,...Vn,...pt],[sn,Vn,pt]),_i=r.useMemo(()=>T.some(e=>e.aggregate),[T]),Be=sn.length>0||pt.length>0,an=r.useMemo(()=>{if(!Tt?.length)return null;const e=ks(v.map(n=>n.field),Tt);return e.some(n=>n.group)?e:null},[Tt,v]),Ge=r.useCallback((e,n)=>{w?n?D.setSortField(e,n):D.setSort([]):S?S(e,n):En({field:e,dir:n})},[w,D,S]),Un=r.useCallback(e=>{Ge(e,J===e?G==="asc"?"desc":G==="desc"?null:"asc":"asc")},[J,G,Ge]),L=r.useMemo(()=>{if(w)return Bt;let e=[...Bt];if(rt){const n=rt.toLowerCase();e=e.filter(s=>T.some(i=>String(s[i.field]??"").toLowerCase().includes(n)))}return ae.items.length>0&&(e=e.filter(n=>y.matchesFilterGroup(n,ae))),!S&&J&&G&&e.sort((n,s)=>{const i=n[J]??"",a=s[J]??"",o=typeof i=="number"?i-a:String(i).localeCompare(String(a));return G==="desc"?-o:o}),e},[Bt,rt,ae,T,J,G,S,w]),mt=w?D.totalCount:yn??L.length,oe=ne?bi:w?D.pageSize:lt,rn=Math.max(1,Math.ceil(mt/oe)),V=w?L:R&&!yn?L.slice((we-1)*oe,we*oe):L,Ke=r.useCallback(e=>{w?D.setPage(e):ze?ze(e):ei(e)},[w,D,ze]);y.useIntent(["pagePrev","pageNext"],e=>{const n=we+(e.intent==="pageNext"?1:-1);if(e.source==="keyboard"||n<1||n>rn)return!1;Ke(n)},{ref:le,enabled:!!R}),y.useInputHints(le,[{intent:"pagePrev",label:u("input.intent.pagePrev","Previous page")},{intent:"pageNext",label:u("input.intent.pageNext","Next page")}],{enabled:!!R&&rn>1});const We=JSON.stringify(Ns({columnWidths:Fe,sortField:J,sortDirection:G,pageSize:ne?void 0:oe,expandedGroups:Wt,hiddenColumns:ut,columnOrder:Le??void 0})),Hn=r.useRef(Dn);Hn.current=Dn;const ln=r.useRef(U);ln.current=U;const gt=r.useRef(null),qe=r.useRef(null),ht=r.useCallback(e=>{gt.current=e,qe.current=null,ln.current&&_s(ln.current,e),Hn.current?.(JSON.parse(e))},[]);r.useEffect(()=>{if(gt.current===null){gt.current=We;return}if(We===gt.current){qe.current=null;return}qe.current=We;const e=setTimeout(()=>ht(We),300);return()=>clearTimeout(e)},[We,ht]),r.useEffect(()=>()=>{qe.current!==null&&ht(qe.current)},[ht]);const on=r.useCallback(()=>{Xt(null),Yt.current?.focus()},[]),Q=ys.useAnchoredPopup(ke!==null,Yt,on),Jn=Q.popupRef,Xn=Q.ready;r.useEffect(()=>{ke===null||!Xn||Jn.current?.querySelector('[role="menuitem"]:not(:disabled)')?.focus()},[ke,Xn,Jn]);const Ni=r.useCallback(e=>{const n=le.current;if(!n)return;const s=l.find(a=>a.field===e),i=gn(n,e,s?.minWidth??40);Vt(a=>({...a,[e]:i}))},[l]),Yn=r.useId(),Ci=r.useCallback(()=>nn(null),[]),be=ys.useAnchoredPopup(Pe!==null,Kn,Ci,{anchorKey:Pe}),Qn=(e,n)=>{Kn.current=e.currentTarget,nn(n)},Zn=e=>nn(n=>n===e?null:n),es=r.useCallback((e,n)=>{const s=Y.findIndex(c=>c.field===e),i=Y.findIndex(c=>c.field===n);if(s<0||i<0||s===i||(Y[s].pinned??null)!==(Y[i].pinned??null))return;const a=Y.map(c=>c.field).filter(c=>c!==e),o=a.indexOf(n)+(s<i?1:0);a.splice(o,0,e),Pn(a),Nn?.(hn(l,a))},[Y,l,Nn]);r.useEffect(()=>{const e=tn.current;e&&(tn.current=null,le.current?.querySelector(`thead th[data-field="${e.replace(/["\\]/g,"\\$&")}"]`)?.focus())},[Le]);const Si=e=>{ae.items.some(s=>s.type==="condition"&&s.field===e)||$n({...ae,items:[...ae.items,{type:"condition",field:e,operator:"contains",value:""}]}),Tn(!0)},ki=e=>{e(),on()},wi=e=>{const n=Array.from(e.currentTarget.querySelectorAll('[role="menuitem"]:not(:disabled)'));if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const s=e.key==="ArrowDown"?1:-1,i=n.indexOf(document.activeElement),a=i<0?s>0?0:n.length-1:(i+s+n.length)%n.length;n[a]?.focus()}else e.key==="Tab"&&Xt(null)},Me=r.useMemo(()=>V.map(e=>String(e[m])),[V,m]),De=Me.length>0&&Me.every(e=>I.has(e)),ts=Me.some(e=>I.has(e)),ns=r.useCallback(()=>{const e=new Set(I);De?Me.forEach(n=>e.delete(n)):Me.forEach(n=>e.add(n)),C?C(e):Gt(e)},[De,Me,I,C]),ss=r.useCallback(e=>{const n=new Set(I);n.has(e)?n.delete(e):n.add(e),C?C(n):Gt(n)},[I,C]),Mi=({field:e})=>J!==e||!G?t.jsx("span",{className:"nice-table__sort-icon",children:t.jsx(Zi,{})}):t.jsx("span",{className:"nice-table__sort-icon",children:G==="asc"?t.jsx(Qi,{}):t.jsx(Je,{})}),A=r.useMemo(()=>{if(!Nt)return V.map((s,i)=>({type:"data",row:s,key:String(s[m]??i)}));const e=new Map;V.forEach(s=>{const i=s[Nt];e.has(i)||e.set(i,[]),e.get(i).push(s)});const n=[];return e.forEach((s,i)=>{const a=`__group_${String(i)}`,o=Wt.has(a);n.push({type:"group",value:i,rows:s,expanded:o,key:a}),o&&s.forEach((c,f)=>n.push({type:"data",row:c,key:String(c[m]??`${a}_${f}`)}))}),n},[V,Nt,m,Wt]),{pinnedTopRows:cn,pinnedBottomRows:Di,normalRows:dn}=r.useMemo(()=>{if(!Dt?.size&&!It?.size)return{pinnedTopRows:[],pinnedBottomRows:[],normalRows:A};const e=[],n=[],s=[];for(const i of A){if(i.type==="data"){const a=i.key;if(Dt?.has(a)){e.push(i);continue}if(It?.has(a)){n.push(i);continue}}s.push(i)}return{pinnedTopRows:e,pinnedBottomRows:n,normalRows:s}},[A,Dt,It]),is=r.useCallback(e=>{Ln(n=>{const s=new Set(n);return s.has(e)?s.delete(e):s.add(e),s})},[]),as=r.useMemo(()=>{if(!X)return A;const e=ct.current?.clientHeight??400,n=Math.ceil(e/W),s=Math.max(0,Math.floor(qt/W)-3),i=Math.min(A.length-1,s+n+6),a=A.slice(s,i+1).map((c,f)=>({...c,_vIdx:s+f}));return[...A.slice(0,Math.min(ge,s)).map((c,f)=>({...c,_vIdx:f})),...a]},[X,A,qt,W,ge]),Ve=r.useMemo(()=>ge>0?[...cn,...dn].slice(0,ge).map(e=>e.key):[],[ge,cn,dn]),[Ii,zi]=r.useState([]);r.useLayoutEffect(()=>{if(X||Ve.length===0)return;const e=ct.current?.querySelector("table");if(!e)return;const n=Array.from(e.tBodies[0]?.rows??[]);let s=_t?e.tHead?.offsetHeight??0:0;const i=Ve.map(a=>{const o=s;return s+=n.find(c=>c.dataset.rowKey===a)?.offsetHeight??0,o});zi(a=>a.length===i.length&&a.every((o,c)=>o===i[c])?a:i)},[X,Ve,_t,Fe,v,an]);const rs=e=>{const n=Ve.indexOf(e);return n<0?{className:""}:{className:n===Ve.length-1?"nice-datagrid__row--frozen nice-datagrid__row--frozen-last":"nice-datagrid__row--frozen",style:{position:"sticky",top:Ii[n]??0,zIndex:2}}};r.useLayoutEffect(()=>{const e=le.current;if(!Ft||!e)return;const n={};for(const s of v)s.width===void 0&&Fe[s.field]===void 0&&(n[s.field]=gn(e,s.field,s.minWidth??40));xi(s=>{const i=Object.keys(n);return i.length===Object.keys(s).length&&i.every(o=>Math.abs((s[o]??-1/0)-n[o])<=1)?s:n})},[Ft,v,Fe,as]);const Ie=e=>Fe[e.field]||e.width||(Ft?hi[e.field]:void 0),xt=r.useCallback((e,n,s)=>{!$||Te||(Kt({rowKey:e,field:n}),$e(s))},[$,Te]),ls=r.useCallback(()=>{re&&$&&$(re.rowKey,re.field,ot),Kt(null),$e(null)},[re,ot,$]),Ri=r.useCallback(()=>{Kt(null),$e(null)},[]),Ai=r.useCallback((e,n)=>{!ve||Te||(nt?Jt({key:e,row:n}):ve(e,n))},[ve,Te,nt]),Ei=r.useCallback(()=>{const e=Ht;Jt(null),e&&ve?.(e.key,e.row)},[Ht,ve]),Oi=r.useCallback(()=>Jt(null),[]),Ue=`nice-datagrid__actions-col${pt.length>0?" nice-datagrid__actions-col--sticky":""}`,os=(e,n)=>t.jsx("button",{type:"button",className:"nice-btn nice-btn--xs nice-btn--ghost nice-datagrid__row-delete","aria-label":u("controls.delete","Delete"),title:u("controls.delete","Delete"),onClick:s=>{s.stopPropagation(),Ai(e,n)},onDoubleClick:Xe,onKeyDown:Xe,children:t.jsx(y.NiceIcon,{name:"trash",size:14})}),Ti=r.useCallback(()=>{const e=T,n=e.map(f=>Ye(f.header)).join(","),s=L.map(f=>e.map(d=>Ye(String(f[d.field]??""))).join(",")),i=[n,...s].join(`
3
3
  `),a=new Blob(["\uFEFF"+i],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(a),c=document.createElement("a");c.href=o,c.download=`${_n}.csv`,c.click(),URL.revokeObjectURL(o)},[T,L,_n]),bt=r.useCallback(e=>{zt?zt(e):di(e)},[zt]),yt=r.useCallback(e=>{Rt?Rt(e):fi(e)},[Rt]),P=r.useMemo(()=>A.filter(e=>e.type==="data").map(e=>e.key),[A]),$i=r.useCallback(e=>{if(e.target!==e.currentTarget||!Ae||re||!B)return;const n=P.indexOf(B.rowKey),s=v.findIndex(c=>c.field===B.field);if(n<0||s<0)return;let i=n,a=s;switch(e.key){case"ArrowUp":i=Math.max(0,n-1);break;case"ArrowDown":i=Math.min(P.length-1,n+1);break;case"ArrowLeft":a=Math.max(0,s-1);break;case"ArrowRight":a=Math.min(v.length-1,s+1);break;case"Tab":{const c=s+(e.shiftKey?-1:1);if(c<0||c>=v.length)return;a=c;break}case"Enter":{const c=v[s];if(c.editable&&$){const f=V.find(d=>String(d[m])===B.rowKey);f&&xt(B.rowKey,c.field,f[c.field])}return}case"Escape":bt(null),yt(null);return;case"Home":e.ctrlKey&&(i=0),a=0;break;case"End":e.ctrlKey&&(i=P.length-1),a=v.length-1;break;case"PageUp":i=Math.max(0,n-lt);break;case"PageDown":i=Math.min(P.length-1,n+lt);break;default:return}e.preventDefault();const o={rowKey:P[i],field:v[a].field};if(bt(o),e.shiftKey&&kn){const c=F?.start??B;yt({start:c,end:o})}else yt(null)},[Ae,re,B,P,v,kn,F,bt,yt,$,V,m,xt,lt]),cs=r.useCallback(()=>{let e=[],n=[];if(F){const s=P.indexOf(F.start.rowKey),i=P.indexOf(F.end.rowKey),a=Math.min(s,i),o=Math.max(s,i),c=v.findIndex(p=>p.field===F.start.field),f=v.findIndex(p=>p.field===F.end.field),d=Math.min(c,f),j=Math.max(c,f);n=v.slice(d,j+1).map(p=>p.field),e=V.filter(p=>{const E=P.indexOf(String(p[m]));return E>=a&&E<=o})}else I.size>0&&(e=V.filter(s=>I.has(String(s[m]))),n=v.map(s=>s.field));return{rows:e,fields:n}},[F,P,v,V,m,I]),ds=r.useCallback((e,n,s)=>{const i=v.filter(a=>n.includes(a.field));switch(s){case"json":return JSON.stringify(e.map(a=>Object.fromEntries(n.map(o=>[o,a[o]]))),null,2);case"csv":{const a=i.map(c=>Ye(c.header)).join(","),o=e.map(c=>i.map(f=>Ye(String(c[f.field]??""))).join(",")).join(`
4
4
  `);return a+`