@nice2dev/ui 1.4.4 → 1.4.6

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{NiceDataGrid-mrnaLHQk.cjs → NiceDataGrid-D3qRQSjy.cjs} +1 -1
  3. package/dist/NiceForm-BWb4LTQJ.cjs +1 -0
  4. package/dist/{NiceHtmlEditor-C1OVtLQ6.cjs → NiceHtmlEditor-BzECmDO3.cjs} +1 -1
  5. package/dist/{NiceMention-tgJKS8PH.cjs → NiceMention-CYRqPKGU.cjs} +19 -19
  6. package/dist/NiceModuleLifecyclePanel-CiYbPcHV.cjs +1 -0
  7. package/dist/{NicePagination-D7XxeNFz.cjs → NicePagination-BAxwqeEd.cjs} +1 -1
  8. package/dist/{NicePivotGrid-Cnkr9WkC.cjs → NicePivotGrid-Cxu5PECg.cjs} +1 -1
  9. package/dist/NiceSavedQueryPanel-BSZhE-_l.cjs +587 -0
  10. package/dist/{NiceScheduler-Boo-D1S-.cjs → NiceScheduler-BqYiHPvz.cjs} +1 -1
  11. package/dist/{core-lazy-C_qnVGxE.cjs → core-lazy-BQexApr7.cjs} +1 -1
  12. package/dist/data/NiceTreeGrid.mjs +519 -458
  13. package/dist/data.cjs +1 -1
  14. package/dist/data.d.ts +20 -1
  15. package/dist/editors.cjs +1 -1
  16. package/dist/index.cjs +98 -98
  17. package/dist/index.d.ts +197 -1
  18. package/dist/index.mjs +303 -293
  19. package/dist/lazy.cjs +1 -1
  20. package/dist/navigation.cjs +1 -1
  21. package/dist/no-code/NiceNoCodeScriptEditor.mjs +584 -0
  22. package/dist/no-code/noCodeScript.mjs +326 -0
  23. package/dist/no-code-B1jzfUF5.cjs +331 -0
  24. package/dist/no-code.cjs +1 -1
  25. package/dist/no-code.d.ts +177 -0
  26. package/dist/no-code.mjs +26 -16
  27. package/dist/style.css +2 -2
  28. package/package.json +4 -4
  29. package/dist/NiceForm-O3sv-DNX.cjs +0 -1
  30. package/dist/NiceModuleLifecyclePanel-DKlqKPy2.cjs +0 -1
  31. package/dist/NiceSavedQueryPanel-BPGpKWN2.cjs +0 -587
  32. package/dist/NiceSelect-BNPXs6FQ.cjs +0 -1
  33. package/dist/no-code-B3BHeyG-.cjs +0 -331
package/dist/index.d.ts CHANGED
@@ -4793,6 +4793,12 @@ declare interface ESLintRuleContext {
4793
4793
  };
4794
4794
  }
4795
4795
 
4796
+ /**
4797
+ * The value of an expression in a scope. Throws on a syntax error. A text template — an expression
4798
+ * that is a single string with `{{path}}` in it — fills each `{{…}}` with that path's value.
4799
+ */
4800
+ export declare function evaluateNoCodeExpression(source: string, scope: Record<string, unknown>): unknown;
4801
+
4796
4802
  export { evaluateValidation }
4797
4803
 
4798
4804
  export { evaluateValidationRule }
@@ -7355,6 +7361,9 @@ export declare type NetworkNodeCategory = 'router' | 'switch' | 'access-point' |
7355
7361
 
7356
7362
  export declare type NetworkNodeStatus = 'online' | 'offline' | 'warning';
7357
7363
 
7364
+ /** A new step of a type, with empty settings. */
7365
+ export declare function newNoCodeStep(type: StepType): NiceNoCodeStep;
7366
+
7358
7367
  /** Tiny non-cryptographic id generator suitable for UI-only records. */
7359
7368
  export declare function newRecipeId(prefix?: string): string;
7360
7369
 
@@ -7378,6 +7387,9 @@ export { NICE_INTENT_EVENT }
7378
7387
 
7379
7388
  export { NICE_INTENTS }
7380
7389
 
7390
+ /** The kinds of step, in the order the editor offers them. */
7391
+ export declare const NICE_NO_CODE_STEP_TYPES: readonly ["read", "filter", "map", "aggregate", "set", "if", "forEach", "write", "callScript", "return"];
7392
+
7381
7393
  export { NICE_THEME_ARCHIVE }
7382
7394
 
7383
7395
  /** The archived themes in categories, as the catalog had them before 1.4.0. */
@@ -18136,6 +18148,152 @@ declare interface NiceNetworkNodePort {
18136
18148
  state: string;
18137
18149
  }
18138
18150
 
18151
+ /**
18152
+ * No-code scripts (1.4.6, R43 — documentation/PLAN.md §2: "skrypty… przede wszystkim no code operujące
18153
+ * na źródłach danych"): a script is a list of steps — read rows from a data source, filter, map,
18154
+ * aggregate, set variables, branch, loop, write rows, call another script, return a value — run by
18155
+ * {@link runNoCodeScript} against the host's data through a small I/O adapter. React-free.
18156
+ *
18157
+ * Values in steps are expressions of a tiny, safe language (no `eval`): numbers, `'strings'`,
18158
+ * `true` / `false` / `null`, variable paths (`order.total`, `rows.length`; inside a row step the
18159
+ * row's fields by name), `+ - * /`, comparisons, `&& || !`, parentheses — and text templates
18160
+ * (`'Hello {{customer.name}}'`).
18161
+ */
18162
+ /** A condition on a value: `field op value` (all conditions of a list must hold). */
18163
+ export declare interface NiceNoCodeCondition {
18164
+ /** A path into the row (or, outside a row step, into the variables). */
18165
+ field: string;
18166
+ op: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'empty' | 'notEmpty';
18167
+ /** An expression. Not used by `empty` / `notEmpty`. */
18168
+ value?: string;
18169
+ }
18170
+
18171
+ /** How a script reaches the host's data. */
18172
+ export declare interface NiceNoCodeIo {
18173
+ read(source: string): Promise<ReadonlyArray<Record<string, unknown>>>;
18174
+ write?(target: string, rows: ReadonlyArray<Record<string, unknown>>, mode: 'insert' | 'update' | 'upsert' | 'delete'): Promise<void>;
18175
+ callScript?(name: string, args: Record<string, unknown>): Promise<unknown>;
18176
+ }
18177
+
18178
+ /** A problem found in a script. */
18179
+ export declare interface NiceNoCodeIssue {
18180
+ stepId?: string;
18181
+ message: string;
18182
+ }
18183
+
18184
+ /** What a run gives back: the returned value, the variables at the end, the steps it went through. */
18185
+ export declare interface NiceNoCodeRunResult {
18186
+ value: unknown;
18187
+ variables: Record<string, unknown>;
18188
+ /** Step ids in the order they ran (a loop's steps once per row). */
18189
+ trace: string[];
18190
+ }
18191
+
18192
+ /** A no-code script: its parameters and its steps. */
18193
+ export declare interface NiceNoCodeScript {
18194
+ parameters?: Array<{
18195
+ name: string;
18196
+ type?: string;
18197
+ description?: string;
18198
+ }>;
18199
+ steps: NiceNoCodeStep[];
18200
+ }
18201
+
18202
+ /**
18203
+ * {@link NiceNoCodeScriptEditor} — the steps of a no-code script, nested, with the picked step's
18204
+ * settings beside them and the script's problems marked.
18205
+ */
18206
+ export declare const NiceNoCodeScriptEditor: default_2.FC<NiceNoCodeScriptEditorProps>;
18207
+
18208
+ /** Props for the {@link NiceNoCodeScriptEditor} component. */
18209
+ export declare interface NiceNoCodeScriptEditorProps extends NiceBaseProps {
18210
+ /** The script — **controlled**. Omit it to let the editor keep its own copy. */
18211
+ value?: NiceNoCodeScript;
18212
+ /** The script at first in the uncontrolled mode. Default: no steps. */
18213
+ defaultValue?: NiceNoCodeScript;
18214
+ onChange?: (script: NiceNoCodeScript) => void;
18215
+ /** Data source keys offered by `read` and `write` steps. */
18216
+ dataSources?: string[];
18217
+ /** Script names offered by `callScript` steps. */
18218
+ scripts?: string[];
18219
+ /** The host's data: with it a Run button runs the script and shows its result. */
18220
+ io?: NiceNoCodeIo;
18221
+ readOnly?: boolean;
18222
+ }
18223
+
18224
+ /** One step of a no-code script. Each has an `id`, unique in the script. */
18225
+ export declare type NiceNoCodeStep = {
18226
+ id: string;
18227
+ type: 'read';
18228
+ /** The data source's key. */
18229
+ source: string;
18230
+ where?: NiceNoCodeCondition[];
18231
+ /** The variable the rows go to. */
18232
+ into: string;
18233
+ } | {
18234
+ id: string;
18235
+ type: 'filter';
18236
+ from: string;
18237
+ where: NiceNoCodeCondition[];
18238
+ into: string;
18239
+ } | {
18240
+ id: string;
18241
+ type: 'map';
18242
+ from: string;
18243
+ /** Each target field and its expression over the row. */
18244
+ fields: Array<{
18245
+ target: string;
18246
+ expression: string;
18247
+ }>;
18248
+ into: string;
18249
+ } | {
18250
+ id: string;
18251
+ type: 'aggregate';
18252
+ from: string;
18253
+ groupBy?: string[];
18254
+ measures: Array<{
18255
+ name: string;
18256
+ op: 'count' | 'sum' | 'avg' | 'min' | 'max';
18257
+ field?: string;
18258
+ }>;
18259
+ into: string;
18260
+ } | {
18261
+ id: string;
18262
+ type: 'set';
18263
+ variable: string;
18264
+ expression: string;
18265
+ } | {
18266
+ id: string;
18267
+ type: 'if';
18268
+ when: NiceNoCodeCondition[];
18269
+ then: NiceNoCodeStep[];
18270
+ else?: NiceNoCodeStep[];
18271
+ } | {
18272
+ id: string;
18273
+ type: 'forEach';
18274
+ from: string;
18275
+ as: string;
18276
+ steps: NiceNoCodeStep[];
18277
+ } | {
18278
+ id: string;
18279
+ type: 'write';
18280
+ /** The data source or entity written to. */
18281
+ target: string;
18282
+ from: string;
18283
+ mode?: 'insert' | 'update' | 'upsert' | 'delete';
18284
+ } | {
18285
+ id: string;
18286
+ type: 'callScript';
18287
+ script: string;
18288
+ /** Argument name → expression. */
18289
+ args?: Record<string, string>;
18290
+ into?: string;
18291
+ } | {
18292
+ id: string;
18293
+ type: 'return';
18294
+ expression: string;
18295
+ };
18296
+
18139
18297
  export declare interface NiceNotificationCategory {
18140
18298
  id: string;
18141
18299
  name: string;
@@ -24344,7 +24502,7 @@ export declare interface NiceTreeContextMenuItem {
24344
24502
  disabled?: boolean;
24345
24503
  }
24346
24504
 
24347
- export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
24505
+ export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, contextMenuItems, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
24348
24506
 
24349
24507
  /** What a `checkedSummary` function of {@link NiceTreeGrid} gets. */
24350
24508
  export declare interface NiceTreeGridCheckedSummaryInfo<T = NiceTreeGridNode> {
@@ -24373,6 +24531,19 @@ export declare interface NiceTreeGridCheckInfo<T = NiceTreeGridNode> {
24373
24531
  halfCheckedKeys: string[];
24374
24532
  }
24375
24533
 
24534
+ /** An entry of a {@link NiceTreeGridProps.contextMenuItems} menu (1.4.5). */
24535
+ export declare interface NiceTreeGridMenuItem {
24536
+ id: string;
24537
+ label?: default_2.ReactNode;
24538
+ /** NiceIcon name. */
24539
+ icon?: string;
24540
+ disabled?: boolean;
24541
+ danger?: boolean;
24542
+ /** A line between entries instead of an entry. */
24543
+ divider?: boolean;
24544
+ onSelect?: () => void;
24545
+ }
24546
+
24376
24547
  /** A row node in the {@link NiceTreeGrid} (supports index-signature for dynamic fields). */
24377
24548
  export declare interface NiceTreeGridNode {
24378
24549
  [field: string]: unknown;
@@ -24540,6 +24711,12 @@ export declare interface NiceTreeGridProps<T extends NiceTreeGridNode = NiceTree
24540
24711
  toolbar?: default_2.ReactNode;
24541
24712
  /** Called when a row is clicked. */
24542
24713
  onRowClick?: (row: T) => void;
24714
+ /**
24715
+ * A row's context menu (1.4.5): opened by a right click, Shift+F10 or the Menu key on the row;
24716
+ * the arrows move in it, Enter picks, Escape closes it and gives focus back to the row. No items,
24717
+ * no menu.
24718
+ */
24719
+ contextMenuItems?: (row: T) => NiceTreeGridMenuItem[] | undefined;
24543
24720
  }
24544
24721
 
24545
24722
  /** A built-in button in the rows of {@link NiceTreeGrid}. */
@@ -26423,6 +26600,12 @@ declare interface NiceXLSXOptions extends NiceExportOptions {
26423
26600
  }>;
26424
26601
  }
26425
26602
 
26603
+ /** Whether every condition holds for `row` (its fields), with `scope` for the values' expressions. */
26604
+ export declare function noCodeConditionsHold(conditions: readonly NiceNoCodeCondition[] | undefined, row: Record<string, unknown>, scope: Record<string, unknown>): boolean;
26605
+
26606
+ /** The value at a dotted path (`order.lines.length`), or undefined. */
26607
+ export declare function noCodePath(scope: Record<string, unknown>, path: string): unknown;
26608
+
26426
26609
  /**
26427
26610
  * Node shape types
26428
26611
  */
@@ -27946,6 +28129,14 @@ export declare function runCLI(argv: string[]): Promise<string>;
27946
28129
  */
27947
28130
  export declare function runContractTests(contracts: NiceApiContract[], config: NiceContractTestConfig): Promise<NiceContractReport>;
27948
28131
 
28132
+ /**
28133
+ * Runs a script: its steps in order over `variables` (the arguments), reading and writing through
28134
+ * `io`. Stops at a `return` step (its value is the result) or after `maxSteps` (a loop gone wrong).
28135
+ */
28136
+ export declare function runNoCodeScript(script: NiceNoCodeScript, io: NiceNoCodeIo, args?: Record<string, unknown>, options?: {
28137
+ maxSteps?: number;
28138
+ }): Promise<NiceNoCodeRunResult>;
28139
+
27949
28140
  declare type RunStatus = 'queued' | 'in_progress' | 'completed' | 'failed' | 'cancelled' | 'waiting' | 'skipped';
27950
28141
 
27951
28142
  export { SafeAreaInsets }
@@ -29170,6 +29361,8 @@ declare interface StateSlice {
29170
29361
  computed?: ComputedField[];
29171
29362
  }
29172
29363
 
29364
+ declare type StepType = NiceNoCodeStep['type'];
29365
+
29173
29366
  export { StorageAdapter }
29174
29367
 
29175
29368
  export { StorageAuditResult }
@@ -31476,6 +31669,9 @@ export declare function validateDoc(doc: unknown): string[];
31476
31669
  /** Validate a module manifest and return error messages. */
31477
31670
  export declare function validateModuleManifest(m: NiceModuleManifest): string[];
31478
31671
 
31672
+ /** The script's problems: missing names, duplicate ids, expressions that do not parse. */
31673
+ export declare function validateNoCodeScript(script: NiceNoCodeScript): NiceNoCodeIssue[];
31674
+
31479
31675
  /** Validate an RBAC policy for structural issues. */
31480
31676
  export declare function validateRbacPolicy(policy: NiceRbacPolicy): string[];
31481
31677