@nice2dev/ui 1.3.16 → 1.3.18
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 +138 -0
- package/README.md +2 -2
- package/dist/{NiceDataGrid-aNPAHsWy.cjs → NiceDataGrid-CFibAGHt.cjs} +1 -1
- package/dist/NiceEventOrchestrator.doc-Dwtq2s_L.cjs +6 -0
- package/dist/NiceForm-ChRj4r3f.cjs +1 -0
- package/dist/{NiceMention-CMqAGvO0.cjs → NiceMention-DNx3d9L7.cjs} +1 -1
- package/dist/NiceModuleLifecyclePanel-D8Q081R6.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-JHrSlHAV.cjs → NiceSavedQueryPanel-BuRAgrBk.cjs} +1 -1
- package/dist/{NiceScheduler-2TwOZq-y.cjs → NiceScheduler-DAoo1eyo.cjs} +1 -1
- package/dist/{core-lazy-Cda-D35m.cjs → core-lazy-DohJQ33c.cjs} +1 -1
- package/dist/data/treeDragSession.mjs +52 -46
- package/dist/data.cjs +1 -1
- package/dist/docs/NiceEventOrchestrator.doc.json.mjs +19 -19
- package/dist/editors/inputs/NiceAutocomplete.mjs +44 -46
- package/dist/editors/pickers/NiceDateTimePicker.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +216 -216
- package/dist/index.d.ts +192 -69
- package/dist/index.mjs +933 -926
- package/dist/navigation/NiceIconRail.mjs +74 -53
- package/dist/navigation/NiceNavShell.mjs +855 -807
- package/dist/navigation/NiceSetupWizard.mjs +287 -278
- package/dist/navigation/NiceSidebarNav.mjs +1487 -1144
- package/dist/navigation/navItemDrag.mjs +42 -0
- package/dist/navigation/navShellPane.mjs +16 -11
- package/dist/navigation/sidebarNavTypes.mjs +1 -0
- package/dist/navigation/sidebarSearch.mjs +28 -0
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +63 -21
- package/dist/style.css +2 -2
- package/dist/tools/NiceThemeDesigner.mjs +1359 -900
- package/dist/tools/NiceThemePreview.mjs +18 -18
- package/dist/tools/themeCatalog.mjs +50 -0
- package/dist/workflow/NiceWorkflowDesigner.mjs +452 -898
- package/package.json +4 -4
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +0 -6
- package/dist/NiceForm-BtRBLffD.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-ugNtHimh.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,143 @@
|
|
|
1
1
|
# [1.0.27] — 2026-06-07
|
|
2
2
|
|
|
3
|
+
## 1.3.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 00b696e: Icons and motion (OmniVerk wishlist §1, §8):
|
|
8
|
+
|
|
9
|
+
- **Reduced motion:** for users who ask for it (`prefers-reduced-motion: reduce`) every `Ntd*` icon holds still on
|
|
10
|
+
its own — no CSS animation class, and its SVG (SMIL) animations jump to their last frame (an entrance shows its
|
|
11
|
+
result, a loop rests on the shape as drawn): the icons' own animations (NtdOmniVerk…), `smilAnimation`, gradient
|
|
12
|
+
animations, the style decorators and `SmilAnimationWrapper`. `reducedMotion="ignore"` plays anyway. The
|
|
13
|
+
stylesheet has a reduced-motion rule for anything animated by hand. `withReducedMotionProps` also clears
|
|
14
|
+
`smilAnimation`; `useReducedMotion` follows the same store.
|
|
15
|
+
- NiceSetupWizard pauses SVG animations in its `loadingIndicator` for reduced motion (CSS animations stopped
|
|
16
|
+
already; SMIL kept going).
|
|
17
|
+
- **`animationMode="single"`** plays a looping `animation` once (the parts an icon animates inside itself
|
|
18
|
+
included): the stylesheet repeats `var(--ntd-anim-iterations, infinite)`. **`playKey`** starts the animations over
|
|
19
|
+
when it changes; **`replayOnClick`** on every click.
|
|
20
|
+
- InteractiveIcon with a `click` trigger plays again on every click; `AnimationController.play()` starts over while
|
|
21
|
+
already playing.
|
|
22
|
+
|
|
23
|
+
- 92418c0: OmniVerk wishlist §3, packaging:
|
|
24
|
+
|
|
25
|
+
- No test declarations in `dist` any more: erp-adapter (16 files), auth (12), ui-communication (8), ui-presentations
|
|
26
|
+
(14), and the test `setup.d.ts` of ui-3d, ui-graphics and game-engine.
|
|
27
|
+
- **One stylesheet per package**: icons, ui-3d and ui-graphics ship theirs in `dist/esm` only — where `exports`
|
|
28
|
+
points; the `dist/cjs` copy was reached from nothing.
|
|
29
|
+
- design-tokens builds its CLI as ES modules only: `bin` and `./cli` point at `dist/cli/index.js`; the CommonJS
|
|
30
|
+
`dist/cli/index.cjs` nothing referred to is gone.
|
|
31
|
+
- ui README: the Tools section and its link say 12 components (the link pointed at `#tools-14-components`).
|
|
32
|
+
|
|
33
|
+
- ef02ccf: OmniVerk wishlist §7: **pages carried to the shortcuts and the favourites**. A row of NiceSidebarNav's tree can be
|
|
34
|
+
dragged (mouse or pen; a press that does not move is still a click, a finger still scrolls): while it is carried a
|
|
35
|
+
bar above the footer offers **Favourites** (the list in view) and, with `shortcutsRail`, **Shortcuts**. The
|
|
36
|
+
Favourites view takes a drop too, and on the shortcuts rail a page lands where it is dropped among the user's
|
|
37
|
+
shortcuts — which can be dragged along it to reorder; the host's stay put. In NiceNavShell a tab of one page dragged
|
|
38
|
+
out of its strip — across it, or off it while reordering — is carried the same way; the sidebar finds its item by
|
|
39
|
+
the route. Escape cancels. The keyboard keeps the item's menu and star.
|
|
40
|
+
- 924eb04: OmniVerk wishlist §2, §4:
|
|
41
|
+
|
|
42
|
+
- **`NiceNavShellPaneHeader`** and `headerSlot` in `NiceNavShellPaneInfo`: in a merged tab a page's own header row
|
|
43
|
+
goes under its pane's header and stays put while the pane scrolls — the mirror of `NiceNavShellPaneFooter`;
|
|
44
|
+
anywhere else the children render where they stand.
|
|
45
|
+
- An inherited **`--nice-field-control-width`** (e.g. `100%` on a filter row) now stretches **NiceSelect**,
|
|
46
|
+
**NiceAutocomplete** and **NiceDateTimePicker** like the text inputs since 1.3.15: the field took the width, the
|
|
47
|
+
select stayed 160px, the autocomplete 220px (an inline style no width could change, not even `controlWidth`)
|
|
48
|
+
and the date input content-sized. Without the variable they look as before.
|
|
49
|
+
|
|
50
|
+
- b3c4b2e: OmniVerk wishlist §6: **NiceSidebarNav `shortcutsRail`** — a last collapse level. Past icons only, the sidebar folds
|
|
51
|
+
to a column of shortcuts (`NiceIconRail`, `railWidth` wide): the host's `predefinedShortcuts` first (fixed), then the
|
|
52
|
+
user's, kept in the new **`shortcuts`** preference. An item's menu and its star's lists gain **Add to shortcuts** /
|
|
53
|
+
**Remove from shortcuts**; a shortcut's own menu (right-click, the menu key) opens it in a new tab, moves it up or
|
|
54
|
+
down, removes it. The footer has a level-down and a level-up button; **`collapseLevel`** /
|
|
55
|
+
`defaultCollapseLevel` / `onCollapseLevelChange` (`'expanded' | 'icons' | 'rail'`) control it, while `collapsed` /
|
|
56
|
+
`onCollapsedChange` keep working (icons and the rail are both collapsed). New helpers `addShortcut`,
|
|
57
|
+
`removeShortcut`, `moveShortcut`. **`allowUserShortcuts={false}`** (an administrator's choice) leaves the rail to the
|
|
58
|
+
predefined ones. `railItems` — the column beside the expanded sidebar — is unchanged.
|
|
59
|
+
|
|
60
|
+
**NiceIconRail**: an item's `menu` (`NiceMenuItem[]`) opens on right-click, the menu key or Shift+F10.
|
|
61
|
+
|
|
62
|
+
- fca336f: OmniVerk wishlist §5: **NiceSidebarNav `inlineSearch`** — a box above the tree that narrows whatever the current
|
|
63
|
+
mode shows (All, groups, Favorites) as you type. A match on a label or tooltip keeps everything under it, the
|
|
64
|
+
branches above a match open for as long as the query lasts and close back to their stored state when it is
|
|
65
|
+
cleared; a source with nothing left hides. Case and diacritics are ignored ("lodz" finds "Łódź"). Filtering is
|
|
66
|
+
view-only — favourites edits still act on the full lists. Controlled through `searchText` / `onSearchChange`
|
|
67
|
+
(or `defaultSearchText`), placeholder via `searchPlaceholder`; Escape clears. With `inlineSearch` the separate
|
|
68
|
+
Search mode icon is left out of the mode strip. The matching helpers are exported as `normalizeSidebarSearch`,
|
|
69
|
+
`sidebarItemMatches` and `filterSidebarItems`.
|
|
70
|
+
- Updated dependencies [bf710b2]
|
|
71
|
+
- @nice2dev/i18n@1.3.18
|
|
72
|
+
- @nice2dev/ui-core@1.3.18
|
|
73
|
+
|
|
74
|
+
## 1.3.17
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- 59a1a84: Icons, showcase feedback round 41:
|
|
79
|
+
|
|
80
|
+
- **Removed** (breaking): NtdGym (use NtdDumbbell), NtdPizzaFood (NtdPizza), NtdDelivery (NtdTruck),
|
|
81
|
+
NtdOmniVerkBadge, NtdOmniVerkLogo, NtdOmniVerkSpinner (`<NtdOmniVerk animation="spin" />` or NiceSpinner) and
|
|
82
|
+
NtdOmniVerkWatermark (NiceLogo).
|
|
83
|
+
- **`animationSpeed`** on every icon, the style decorators and SmilAnimationWrapper — and every animation now runs
|
|
84
|
+
at half its earlier pace by default: CSS animations, `smilAnimation`, gradient animations and the icons' own
|
|
85
|
+
(NtdOmniVerk, NtdOmniVerkAnimated). `animationSpeed={2}` is the old pace; an explicit duration keeps its length.
|
|
86
|
+
createIcon's new `animated` option scales an icon's own SVG animation times.
|
|
87
|
+
- **Redrawn**: NtdNuke, NtdRunning, NtdDumbbell, NtdBeer, NtdCrown, NtdTarget, NtdMolecule, NtdPlate, NtdFood,
|
|
88
|
+
NtdCoffeeFood, NtdTruck, NtdRefresh, NtdLayers, NtdTrash, NtdCoins; NtdPlanet's ring is primary with a thin
|
|
89
|
+
accent rim.
|
|
90
|
+
|
|
91
|
+
- 68db136: NiceThemeDesigner, showcase feedback round 41:
|
|
92
|
+
|
|
93
|
+
- **Opens on a themes tree** (`startScreen`, default `'browser'`): Favorites, My themes and the built-in catalog by
|
|
94
|
+
category, searchable, with a star per theme, New / Duplicate / Edit / Import and **Delete only with `allowDelete`**
|
|
95
|
+
(own themes, behind a confirmation). Own themes and favorites: `themes` / `onThemesChange`,
|
|
96
|
+
`favorites` / `onFavoritesChange`, or kept by the designer in `localStorage` under `storageKey`.
|
|
97
|
+
- **Edit opens the theme in the whole window**: Back, a breadcrumb, **Undo / Redo** (buttons, Ctrl+Z, Ctrl+Shift+Z,
|
|
98
|
+
Ctrl+Y; quick edits of one field make one step), Save for own themes, Save as copy, Discard changes. **Theme Name
|
|
99
|
+
moved into the General section.** `startScreen="edit"` with `theme` opens the editor straight away, as before;
|
|
100
|
+
the New / Clone / Open buttons and the preset picker of the old header are replaced by the tree. `onSave` is new.
|
|
101
|
+
- The catalog is in the library: `NICE_THEME_CATALOG` and `NICE_THEME_CATALOG_ENTRIES` (the showcase reads them).
|
|
102
|
+
- NiceThemePreview: buttons, badges and the active page button take the theme's text-on-fill colours (they used the
|
|
103
|
+
page text colour), the switch thumb the theme's background.
|
|
104
|
+
- NiceThemeProvider: the dark flag (`data-theme`, `color-scheme`) follows a theme set through `setTheme`; a light
|
|
105
|
+
theme applied over a dark prop kept the dark-mode CSS.
|
|
106
|
+
- i18n: 37 `theme.*` keys (the tree, the editor, the catalog categories) in all 12 dictionaries.
|
|
107
|
+
|
|
108
|
+
- 8ae6e97: NiceWorkflowDesigner moves to `@nice2dev/ui-diagrams` (showcase feedback round 41):
|
|
109
|
+
|
|
110
|
+
- **Moved** (breaking for imports): `import { NiceWorkflowDesigner } from '@nice2dev/ui-diagrams'`. The data types
|
|
111
|
+
(`NiceWorkflowDefinition`, `NiceWorkflowState`, `NiceWorkflowTransition`…) stay in `@nice2dev/ui`;
|
|
112
|
+
`NiceWorkflowState.type` also takes ids of your own step kinds.
|
|
113
|
+
- Rebuilt on the diagram canvas: **arrows** between the steps, **automatic layered layout** (left to right, or
|
|
114
|
+
`layoutDirection="TB"`), the whole flow **fitted to the canvas at start**, zoom − / % / + and Fit in the toolbar,
|
|
115
|
+
wheel zoom, pan by dragging the empty canvas.
|
|
116
|
+
- **Step kinds**: `stepTypes` (default start, state, approval, end, error) and `loadStepTypes` (loaded at mount,
|
|
117
|
+
merged by id); "Add step" offers them all.
|
|
118
|
+
- A new step gets a **unique name** and comes **connected from the selected step** (the duplicated "New state"
|
|
119
|
+
dead-end / orphan pair is gone); transitions are drawn from a step's port onto another step or edited in the
|
|
120
|
+
properties panel (name, target, add, delete); a selected transition has its own panel; a problem message selects
|
|
121
|
+
its step.
|
|
122
|
+
- The designer keeps the workflow itself; `onChange` reports every change with the laid-out positions.
|
|
123
|
+
|
|
124
|
+
NiceDiagramEditor, more configurable (backward compatible): `document` (controlled), `nodeTypes` (a palette),
|
|
125
|
+
`autoLayout`, `fitOnMount`, `readOnly`; connections drawn from the ports (`onEdgeCreate` was declared but never
|
|
126
|
+
called); `onChange` fires for every change (only undo / redo reached it — the editor hook memoised on a document the
|
|
127
|
+
model edits in place, which also froze the viewport and the undo state) and no longer during render; `lang` follows
|
|
128
|
+
the app's language by default. DiagramCanvas: `autoFit` / `fitKey` / `refitKey`, `resizable`, `panOnDrag`,
|
|
129
|
+
`onResize`, `ariaLabel`, per-instance arrow markers, curves that leave and enter along their ports' sides, labels on
|
|
130
|
+
the curve's middle. The `dagre` layout is a real layered layout now (cycle breaking, longest-path ranks, barycenter
|
|
131
|
+
ordering, top-left positions, `ranks` in the result); `fitViewport` / `diagramBounds` exported; a layout is one undo
|
|
132
|
+
step.
|
|
133
|
+
|
|
134
|
+
ui-forms: the studio's workflow screen uses the designer from `@nice2dev/ui-diagrams` (new peer dependency).
|
|
135
|
+
|
|
136
|
+
- Updated dependencies [68db136]
|
|
137
|
+
- Updated dependencies [8ae6e97]
|
|
138
|
+
- @nice2dev/ui-core@1.3.17
|
|
139
|
+
- @nice2dev/i18n@1.3.17
|
|
140
|
+
|
|
3
141
|
## 1.3.16
|
|
4
142
|
|
|
5
143
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Quick reference — most common areas:
|
|
|
65
65
|
- [Charts (16)](#charts-16-components)
|
|
66
66
|
- [Overlays & Layout (9)](#overlays--layout-9-components)
|
|
67
67
|
- [Planning (4)](#planning-4-components)
|
|
68
|
-
- [Tools (
|
|
68
|
+
- [Tools (12)](#tools-12-components)
|
|
69
69
|
- [Validation (3 + 1 hook)](#validation-3-components--1-hook)
|
|
70
70
|
- [Core Infrastructure](#core-infrastructure)
|
|
71
71
|
- [Shared Types](#shared-types)
|
|
@@ -332,7 +332,7 @@ Form input components with consistent `NiceFormFieldProps` interface: `label`, `
|
|
|
332
332
|
| `NiceDiagram` | `nodes[]`, `edges[]`, `onNodeClick`, `onEdgeClick` | Node/edge diagram |
|
|
333
333
|
| `NiceStepper` | `steps[]`, `currentStep`, `onStepChange`, `vertical` | Step wizard |
|
|
334
334
|
|
|
335
|
-
### Tools (
|
|
335
|
+
### Tools (12 components)
|
|
336
336
|
|
|
337
337
|
| Component | Key Props | Description |
|
|
338
338
|
| ------------------- | -------------------------------------------------------- | ---------------------------------------- |
|
|
@@ -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-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),y=require("@nice2dev/ui-core"),r=require("react"),pn=require("react-dom"),Wi=require("./NiceForm-ChRj4r3f.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+`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceEventOrchestrator",o="Event-driven workflow orchestrator with triggers, conditions, and actions.",n="no-code",s="1.0.7",i="stable",r=[{name:"flows",type:"EventFlow[]",description:"Initial event flows"},{name:"eventSources",type:"EventSourceDefinition[]",description:"Available event sources"},{name:"eventHandlers",type:"EventHandlerDefinition[]",description:"Available event handlers"},{name:"onFlowsChange",type:"(flows: EventFlow[]) => void",description:"Called with the flows after every change"},{name:"onExport",type:"(code: string) => void",description:"Called with the generated code on export"},{name:"onTest",type:"(flowId: string) => void",description:"Called when a flow is tested"}],c=[{title:"Event Orchestrator",description:"Build event-driven workflows",code:`<NiceEventOrchestrator
|
|
2
|
+
flows={flows}
|
|
3
|
+
eventSources={sources}
|
|
4
|
+
eventHandlers={handlers}
|
|
5
|
+
onFlowsChange={setFlows}
|
|
6
|
+
/>`}],a={role:"application",ariaLabel:"Event workflow orchestrator"},l=["NiceWorkflowDesigner","NiceAPIFlow"],d={$schema:e,name:t,description:o,category:n,since:s,status:i,props:r,examples:c,accessibility:a,seeAlso:l};exports.$schema=e;exports.accessibility=a;exports.category=n;exports.default=d;exports.description=o;exports.examples=c;exports.name=t;exports.props=r;exports.seeAlso=l;exports.since=s;exports.status=i;
|