@nice2dev/ui 1.4.6 → 1.4.8

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/dist/index.d.ts CHANGED
@@ -862,6 +862,12 @@ export declare function addMenuGroup(menu: readonly NiceMenuBuilderItem[], label
862
862
  id: string;
863
863
  };
864
864
 
865
+ /**
866
+ * The query with a related table added and joined: many-to-one comes in as one nested object,
867
+ * one-to-many as a nested list — the shape a print of a record with its lines needs.
868
+ */
869
+ export declare function addRelatedTable(model: NiceQueryModel, related: NiceRelatedTable): NiceQueryModel;
870
+
865
871
  /** Address field definition within a NiceAddressInput. */
866
872
  export declare interface AddressValue {
867
873
  street?: string;
@@ -873,6 +879,24 @@ export declare interface AddressValue {
873
879
  country?: string;
874
880
  }
875
881
 
882
+ /**
883
+ * The query with a table added — a table already in it comes again under a new alias (Customer,
884
+ * Customer2…), so the same table can be joined twice (billing and shipping address). Placed right
885
+ * of the others unless a position is given.
886
+ */
887
+ export declare function addTableInstance(model: NiceQueryModel, table: NiceDataSourceSchemaTable, options?: {
888
+ position?: {
889
+ x: number;
890
+ y: number;
891
+ };
892
+ select?: 'all' | 'none' | string[];
893
+ /** The name it goes by (made unique); default: its own, numbered when taken. */
894
+ alias?: string;
895
+ }): {
896
+ model: NiceQueryModel;
897
+ tableId: string;
898
+ };
899
+
876
900
  declare interface AgentMetrics {
877
901
  agentId: string;
878
902
  openTickets: number;
@@ -1226,6 +1250,12 @@ export declare interface AspectRatioPreset {
1226
1250
  ratio?: number;
1227
1251
  }
1228
1252
 
1253
+ /**
1254
+ * The rows of a plan put together: `rowsOf(list)` gives the rows a list's query returned (for the
1255
+ * parent keys of the rows above it). Helper columns (`__key1`, `__parent`) do not stay.
1256
+ */
1257
+ export declare function assembleQueryRows(plan: Pick<NiceQueryPlan, 'lists'>, mainRows: readonly Row[], rowsOf: (list: NiceQueryListPlan) => readonly Row[]): Row[];
1258
+
1229
1259
  declare interface Assertion {
1230
1260
  matcher: AssertionMatcher;
1231
1261
  expected?: unknown;
@@ -2969,6 +2999,9 @@ declare interface ComputedField {
2969
2999
 
2970
3000
  declare type ConditionOperator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'LIKE' | 'NOT LIKE' | 'IN' | 'NOT IN' | 'IS NULL' | 'IS NOT NULL' | 'BETWEEN';
2971
3001
 
3002
+ /** The legacy flat conditions as a filter group (AND / OR as typed between them). */
3003
+ export declare function conditionsToFilter(conditions: readonly QueryCondition[]): NiceQueryFilterGroup;
3004
+
2972
3005
  /**
2973
3006
  * Confidence band configuration.
2974
3007
  */
@@ -3503,6 +3536,9 @@ export declare type DataType = 'string' | 'number' | 'boolean' | 'date' | 'datet
3503
3536
 
3504
3537
  declare type DataType_2 = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'any';
3505
3538
 
3539
+ /** A date cut down to its year, quarter, month or day (for grouping). */
3540
+ export declare function datePartSql(expr: string, part: NiceDatePart, d: NiceSqlDialect): string;
3541
+
3506
3542
  export declare interface DecisionTable {
3507
3543
  id: string;
3508
3544
  name: string;
@@ -3630,6 +3666,15 @@ export { deserializeTheme }
3630
3666
 
3631
3667
  export declare function deserializeView(json: string): NiceViewDefinition;
3632
3668
 
3669
+ /** The width and row height of a table card on the canvas (the join lines are drawn from them). */
3670
+ export declare const DESIGN_CARD: {
3671
+ readonly width: 220;
3672
+ readonly header: 34;
3673
+ readonly row: 24;
3674
+ readonly gapX: 60;
3675
+ readonly gapY: 40;
3676
+ };
3677
+
3633
3678
  declare interface DesignState {
3634
3679
  components: ComponentInstance[];
3635
3680
  layout: LayoutConfig;
@@ -4347,6 +4392,12 @@ export declare const EMOJI_DATA: Emoji[];
4347
4392
 
4348
4393
  export declare type EmojiCategory = 'recent' | 'smileys' | 'people' | 'animals' | 'food' | 'travel' | 'activities' | 'objects' | 'symbols' | 'flags';
4349
4394
 
4395
+ /** An empty filter group. */
4396
+ export declare const emptyFilterGroup: (logic?: "AND" | "OR") => NiceQueryFilterGroup;
4397
+
4398
+ /** An empty query. */
4399
+ export declare function emptyQueryDesign(): NiceQueryModel;
4400
+
4350
4401
  /** Encoding preset (speed vs quality) */
4351
4402
  export declare type EncodingPreset = 'ultrafast' | 'superfast' | 'veryfast' | 'faster' | 'fast' | 'medium' | 'slow' | 'slower' | 'veryslow' | 'placebo';
4352
4403
 
@@ -5448,6 +5499,9 @@ export declare interface FreehandAnnotation extends AnnotationBase {
5448
5499
  }[];
5449
5500
  }
5450
5501
 
5502
+ /** A function of a computed column, written for the database. */
5503
+ export declare function functionSql(fn: string, args: string[], d: NiceSqlDialect): string;
5504
+
5451
5505
  export declare interface FuzzyMatch {
5452
5506
  score: number;
5453
5507
  indices: number[];
@@ -5550,6 +5604,9 @@ export declare function generateMermaidSyntax(schema: DiagramSchema): string;
5550
5604
 
5551
5605
  export { generatePaletteFromColor }
5552
5606
 
5607
+ /** The main query's SQL (what a data source keeps in `sql`). */
5608
+ export declare function generateQuerySql(model: NiceQueryModel, options?: NiceQuerySqlOptions): string;
5609
+
5553
5610
  /** Generate Dart RBAC constants from RBAC policy. */
5554
5611
  export declare function generateRbacDart(policy: NiceRbacPolicy): NiceGeneratedFile;
5555
5612
 
@@ -6255,6 +6312,12 @@ export declare interface InvoiceTotals {
6255
6312
  /** Check if a user can perform an action on a resource. Deny overrides allow. */
6256
6313
  export declare function isAllowed(resolved: NiceResolvedPermissions, resource: string, action: RbacAction): boolean;
6257
6314
 
6315
+ /**
6316
+ * Whether a stored value is a data source the editor can keep as it is: a key, a known kind and
6317
+ * that kind's fields in their types. Anything else stays raw.
6318
+ */
6319
+ export declare function isModuleDataSource(v: unknown): v is NiceModuleDataSource;
6320
+
6258
6321
  export { isRecordValid }
6259
6322
 
6260
6323
  /** Whether the node with `id` is somewhere below the node with `ancestorId` (not itself). */
@@ -7171,6 +7234,24 @@ declare interface ModuleContextMenuItem<T = any> {
7171
7234
  onClick?: (row: T) => void;
7172
7235
  }
7173
7236
 
7237
+ /**
7238
+ * The columns a source gives: a query's columns (outputColumns), the SQL's declared columns, the
7239
+ * first source of a union, the static columns (or the keys of the rows).
7240
+ */
7241
+ export declare function moduleDataSourceColumns(def: NiceModuleDataSource, ctx?: NiceDataSourceColumnContext, seen?: ReadonlySet<string>): NiceDataSourceColumn[];
7242
+
7243
+ /** The keys a source reads from (a union's sources; a query's tables of schema `source`). */
7244
+ export declare function moduleDataSourceDependencies(def: NiceModuleDataSource): string[];
7245
+
7246
+ /**
7247
+ * The parameters a source takes: declared ones, plus those its query uses or `@name` / `{{name}}`
7248
+ * in its SQL.
7249
+ */
7250
+ export declare function moduleDataSourceParameters(def: NiceModuleDataSource): NiceDataSourceParameter[];
7251
+
7252
+ /** A source as a table another source's query can pick and join (its schema: `source`). */
7253
+ export declare function moduleDataSourceTable(def: NiceModuleDataSource, ctx?: NiceDataSourceColumnContext): NiceDataSourceSchemaTable;
7254
+
7174
7255
  /** Empty state configuration. */
7175
7256
  declare interface ModuleEmptyState {
7176
7257
  icon?: React.ReactNode;
@@ -7357,10 +7438,22 @@ export declare interface NavbarBreadcrumb {
7357
7438
  onClick?: () => void;
7358
7439
  }
7359
7440
 
7441
+ /**
7442
+ * Where a table's columns land in the result: `[]` — the row itself; `['Customer']` — the nested
7443
+ * object or list a join puts it in (the path goes down through joins nested in nested ones).
7444
+ */
7445
+ export declare function nestPathOf(model: NiceQueryModel, tableId: string): string[];
7446
+
7360
7447
  export declare type NetworkNodeCategory = 'router' | 'switch' | 'access-point' | 'server' | 'workstation' | 'printer' | 'camera' | 'iot' | 'unknown';
7361
7448
 
7362
7449
  export declare type NetworkNodeStatus = 'online' | 'offline' | 'warning';
7363
7450
 
7451
+ /** A new, empty source of a kind (its key and label kept when switching an existing one). */
7452
+ export declare function newModuleDataSource(kind: NiceModuleDataSourceKind, key: string, base?: {
7453
+ label?: string;
7454
+ description?: string;
7455
+ }): NiceModuleDataSource;
7456
+
7364
7457
  /** A new step of a type, with empty settings. */
7365
7458
  export declare function newNoCodeStep(type: StepType): NiceNoCodeStep;
7366
7459
 
@@ -7387,9 +7480,18 @@ export { NICE_INTENT_EVENT }
7387
7480
 
7388
7481
  export { NICE_INTENTS }
7389
7482
 
7483
+ /** The kinds, in the order the editor offers them. */
7484
+ export declare const NICE_MODULE_DATA_SOURCE_KINDS: readonly NiceModuleDataSourceKind[];
7485
+
7390
7486
  /** The kinds of step, in the order the editor offers them. */
7391
7487
  export declare const NICE_NO_CODE_STEP_TYPES: readonly ["read", "filter", "map", "aggregate", "set", "if", "forEach", "write", "callScript", "return"];
7392
7488
 
7489
+ export declare const NICE_QUERY_OPERATORS: readonly NiceQueryOperatorDef[];
7490
+
7491
+ export declare const NICE_SQL_DIALECTS: readonly NiceSqlDialect[];
7492
+
7493
+ export declare const NICE_SQL_FUNCTIONS: readonly NiceSqlFunctionDef[];
7494
+
7393
7495
  export { NICE_THEME_ARCHIVE }
7394
7496
 
7395
7497
  /** The archived themes in categories, as the catalog had them before 1.4.0. */
@@ -10388,6 +10490,12 @@ export declare interface NiceColumnChooserProps {
10388
10490
  'data-testid'?: string;
10389
10491
  }
10390
10492
 
10493
+ /** Which columns a bulk pick takes. */
10494
+ export declare type NiceColumnPick = 'all' | 'none' | 'invert' | 'keys' | NiceValueType | {
10495
+ names: string[];
10496
+ selected: boolean;
10497
+ };
10498
+
10391
10499
  export declare interface NiceColumnState {
10392
10500
  field: string;
10393
10501
  visible: boolean;
@@ -11936,6 +12044,21 @@ export declare interface NiceDataSourceBuilderProps extends NiceBaseProps {
11936
12044
  tutorial?: NiceComponentTutorial;
11937
12045
  }
11938
12046
 
12047
+ /** A column a source gives. */
12048
+ export declare interface NiceDataSourceColumn {
12049
+ name: string;
12050
+ /** `string`, `number`, `decimal`, `date`, `boolean`, `guid`… */
12051
+ dataType?: string;
12052
+ }
12053
+
12054
+ /** What a source's columns depend on: the entities it reads and the other sources. */
12055
+ export declare interface NiceDataSourceColumnContext {
12056
+ /** Entity tables (this module's and the modules' it depends on). */
12057
+ schemas?: readonly NiceDataSourceSchemaTable[];
12058
+ /** The module's other sources, by key. */
12059
+ sources?: ReadonlyArray<NiceModuleDataSource>;
12060
+ }
12061
+
11939
12062
  export { NiceDataSourceConfig }
11940
12063
 
11941
12064
  /** A reusable, serializable data source (maps to a view-standard `query` source). */
@@ -11946,27 +12069,94 @@ export declare interface NiceDataSourceDef {
11946
12069
  query: NiceQueryModel;
11947
12070
  /** Generated SQL view (read-only artifact derived from `query`). */
11948
12071
  sql: string;
12072
+ description?: string;
12073
+ /**
12074
+ * What it returns (1.4.7): rows of plain columns (`flat`), records with their nested parts
12075
+ * (`list`, default) or one record (`object`, e.g. WHERE Id = @id).
12076
+ */
12077
+ shape?: NiceDataSourceShape;
12078
+ /** The database `sql` is written for (1.4.7; default PostgreSQL). */
12079
+ dialect?: NiceSqlDialect;
12080
+ /** Values the caller gives (`@id`, `@from`) — 1.4.7. */
12081
+ parameters?: NiceDataSourceParameter[];
12082
+ }
12083
+
12084
+ /**
12085
+ * The editor of one module data source, switched by its kind; the rows it gives on Preview.
12086
+ */
12087
+ export declare function NiceDataSourceEditor({ value, defaultValue, onChange, schemas, extraSchemas, sources, kinds, dialects, onPreview, readOnly, height, className, style, id, 'data-testid': dataTestId, }: NiceDataSourceEditorProps): default_2.ReactElement;
12088
+
12089
+ /** Props for the {@link NiceDataSourceEditor} component. */
12090
+ export declare interface NiceDataSourceEditorProps extends NiceBaseProps {
12091
+ /** The data source — **controlled**. Omit it to let the editor keep its own copy. */
12092
+ value?: NiceModuleDataSource;
12093
+ /** The data source at first in the uncontrolled mode. Default: an empty query. */
12094
+ defaultValue?: NiceModuleDataSource;
12095
+ onChange?: (def: NiceModuleDataSource) => void;
12096
+ /** This module's entity tables. */
12097
+ schemas?: NiceDataSourceSchemaTable[];
12098
+ /**
12099
+ * Entity tables of the modules this one depends on (their `schema`: the module) — a query joins
12100
+ * them like its own.
12101
+ */
12102
+ extraSchemas?: NiceDataSourceSchemaTable[];
12103
+ /** The module's other sources: tables of a query, members of a union. */
12104
+ sources?: NiceModuleDataSource[];
12105
+ /** The kinds offered. Default: all four. */
12106
+ kinds?: NiceModuleDataSourceKind[];
12107
+ /** SQL dialects offered for SQL text. Default: portable, PostgreSQL, SQL Server, MySQL, SQLite, Oracle. */
12108
+ dialects?: string[];
12109
+ /** Runs the source with parameter values: with it, Preview shows its first rows. */
12110
+ onPreview?: (def: NiceModuleDataSource, params: Record<string, string>) => Promise<ReadonlyArray<Record<string, unknown>>>;
12111
+ readOnly?: boolean;
12112
+ /** Height of the query designer. Default `640`. */
12113
+ height?: number | string;
11949
12114
  }
11950
12115
 
11951
12116
  export { NiceDataSourceEventMap }
11952
12117
 
12118
+ /** A parameter of a source (`@status`, `{{status}}`). */
12119
+ export declare interface NiceDataSourceParameter {
12120
+ name: string;
12121
+ dataType?: string;
12122
+ /** Its value when the caller gives none (text, as typed). */
12123
+ defaultValue?: string;
12124
+ required?: boolean;
12125
+ }
12126
+
11953
12127
  /** A table the host exposes from a connected database schema. */
11954
12128
  export declare interface NiceDataSourceSchemaTable {
11955
12129
  name: string;
11956
12130
  schema?: string;
12131
+ /** The entity the table stores, when its name is not the table's (1.4.7: entity data sources). */
12132
+ entity?: string;
11957
12133
  columns: Array<{
11958
12134
  name: string;
11959
12135
  dataType: string;
11960
12136
  isPrimaryKey?: boolean;
11961
12137
  isForeignKey?: boolean;
12138
+ /** The table and column a foreign key points at (1.4.7: the designer offers the join). */
12139
+ references?: {
12140
+ table: string;
12141
+ column: string;
12142
+ schema?: string;
12143
+ };
11962
12144
  }>;
12145
+ /** What the table is for, shown in the designer's browser (1.4.7). */
12146
+ description?: string;
11963
12147
  }
11964
12148
 
12149
+ /** What a data source returns: plain rows, records with nested parts, or one record. */
12150
+ export declare type NiceDataSourceShape = 'flat' | 'list' | 'object';
12151
+
11965
12152
  export { NiceDataSourceState }
11966
12153
 
11967
12154
  /** Predefined date-format presets. */
11968
12155
  declare type NiceDateFormatPreset = 'date-local' | 'date-utc' | 'datetime-local' | 'datetime-utc' | 'month-local' | 'month-utc' | 'week' | 'time';
11969
12156
 
12157
+ /** A date grouped by part of it. */
12158
+ export declare type NiceDatePart = 'year' | 'quarter' | 'month' | 'day';
12159
+
11970
12160
  export declare const NiceDateRangeBox: default_2.FC<NiceDateRangeBoxProps>;
11971
12161
 
11972
12162
  /** Props for the {@link NiceDateRangeBox} component — a pair of date pickers for selecting a date range. */
@@ -15252,6 +15442,16 @@ export declare interface NiceInvoiceLineEditorProps extends NiceFormFieldProps {
15252
15442
  tutorial?: NiceComponentTutorial;
15253
15443
  }
15254
15444
 
15445
+ /** How a joined table appears in the result. */
15446
+ export declare type NiceJoinNesting = 'flat' | 'object' | 'list';
15447
+
15448
+ /** A join the designer can offer: a foreign key between two tables of the query. */
15449
+ export declare interface NiceJoinSuggestion {
15450
+ join: Omit<QueryJoin, 'id'>;
15451
+ /** `Order.CustomerId = Customer.Id`. */
15452
+ label: string;
15453
+ }
15454
+
15255
15455
  declare interface NiceJSONOptions extends NiceExportOptions {
15256
15456
  /** Pretty print JSON */
15257
15457
  pretty?: boolean;
@@ -17131,6 +17331,19 @@ export declare interface NiceModeSelectorProps extends NiceBaseProps {
17131
17331
 
17132
17332
  export declare type NiceModuleAction = 'activate' | 'deactivate' | 'install' | 'uninstall' | 'update';
17133
17333
 
17334
+ /** A data source of a module. A plain `NiceDataSourceDef` (a visual query) is one. */
17335
+ export declare type NiceModuleDataSource = NiceDataSourceDef | NiceSqlDataSourceDef | NiceUnionDataSourceDef | NiceStaticDataSourceDef;
17336
+
17337
+ /** What every kind carries. */
17338
+ declare interface NiceModuleDataSourceBase {
17339
+ key: string;
17340
+ label?: string;
17341
+ description?: string;
17342
+ }
17343
+
17344
+ /** The kinds of a module data source. */
17345
+ export declare type NiceModuleDataSourceKind = 'query' | 'sql' | 'union' | 'static';
17346
+
17134
17347
  /** Dependency on another module. */
17135
17348
  export declare interface NiceModuleDependency {
17136
17349
  /** Module id of the dependency. */
@@ -18720,6 +18933,22 @@ export declare interface NiceOTPInputProps extends Omit<NiceStandardProps, 'erro
18720
18933
 
18721
18934
  export declare type NiceOTPInputType = 'number' | 'text';
18722
18935
 
18936
+ /** A column of the result. */
18937
+ export declare interface NiceOutputColumn {
18938
+ /** `t:<tableId>:<column>` or `c:<computedId>`. */
18939
+ key: string;
18940
+ tableId?: string;
18941
+ column?: string;
18942
+ computedId?: string;
18943
+ /** Its name in the result (unique within its nested part). */
18944
+ name: string;
18945
+ dataType?: string;
18946
+ aggregate?: AggregateFunction_2;
18947
+ /** The nested part it is in (see {@link nestPathOf}). */
18948
+ path: string[];
18949
+ order: number;
18950
+ }
18951
+
18723
18952
  /**
18724
18953
  * NicePageBuilder - Drag-drop page builder with responsive layouts
18725
18954
  *
@@ -19766,6 +19995,80 @@ export declare interface NiceQRCodeProps extends NiceStandardProps {
19766
19995
  /** Reed-Solomon error correction level for QR codes. */
19767
19996
  export declare type NiceQRErrorCorrection = 'L' | 'M' | 'Q' | 'H';
19768
19997
 
19998
+ /** A column worked out with a function. */
19999
+ export declare interface NiceQueryComputed {
20000
+ id: string;
20001
+ alias: string;
20002
+ fn: NiceSqlFunctionId;
20003
+ args: NiceQueryOperand[];
20004
+ selected: boolean;
20005
+ aggregate?: AggregateFunction_2;
20006
+ order?: number;
20007
+ }
20008
+
20009
+ /**
20010
+ * The data source designer: browse, pick, join, filter, total and shape — the SQL is written for
20011
+ * you, for the database you choose.
20012
+ */
20013
+ export declare function NiceQueryDesigner({ value, defaultValue, onChange, schemas, extraSchemas, sources, dialects, onPreview, readOnly, height, className, style, id, 'data-testid': dataTestId, }: NiceQueryDesignerProps): default_2.ReactElement;
20014
+
20015
+ /** Props for the {@link NiceQueryDesigner} component. */
20016
+ export declare interface NiceQueryDesignerProps extends NiceBaseProps {
20017
+ /** The data source — **controlled**. Omit it to let the designer keep its own copy. */
20018
+ value?: NiceDataSourceDef;
20019
+ /** The data source at first in the uncontrolled mode. Default: an empty query. */
20020
+ defaultValue?: NiceDataSourceDef;
20021
+ /** Called on every change, with the SQL written again for its database. */
20022
+ onChange?: (def: NiceDataSourceDef) => void;
20023
+ /** The tables of the module (or of the connected database). */
20024
+ schemas?: NiceDataSourceSchemaTable[];
20025
+ /** Tables of the modules this one depends on — `schema`: the module; joined like its own. */
20026
+ extraSchemas?: NiceDataSourceSchemaTable[];
20027
+ /** The module's other data sources: tables a query can read and join. */
20028
+ sources?: NiceModuleDataSource[];
20029
+ /** The databases offered. Default: all five. */
20030
+ dialects?: NiceSqlDialect[];
20031
+ /** Runs the source with parameter values: with it, the Preview tab shows its rows. */
20032
+ onPreview?: (def: NiceDataSourceDef, params: Record<string, string>) => Promise<ReadonlyArray<Record<string, unknown>>>;
20033
+ readOnly?: boolean;
20034
+ /** Height of the designer. Default `640`. */
20035
+ height?: number | string;
20036
+ }
20037
+
20038
+ /** Rules and groups joined by AND or OR — `not` turns the group round. */
20039
+ export declare interface NiceQueryFilterGroup {
20040
+ kind: 'group';
20041
+ id: string;
20042
+ logic: 'AND' | 'OR';
20043
+ not?: boolean;
20044
+ items: NiceQueryFilterNode[];
20045
+ }
20046
+
20047
+ export declare type NiceQueryFilterNode = NiceQueryFilterRule | NiceQueryFilterGroup;
20048
+
20049
+ /** One comparison of a filter. */
20050
+ export declare interface NiceQueryFilterRule {
20051
+ kind: 'rule';
20052
+ id: string;
20053
+ left: NiceQueryOperand;
20054
+ operator: NiceQueryOperator;
20055
+ right?: NiceQueryOperand;
20056
+ /** The upper bound of `between`. */
20057
+ right2?: NiceQueryOperand;
20058
+ }
20059
+
20060
+ /** The query of one nested list of a plan. */
20061
+ export declare interface NiceQueryListPlan {
20062
+ /** Where the list goes in its parent's row (`['Lines']`, `['Customer', 'Addresses']`). */
20063
+ path: string[];
20064
+ /** The column of the parent's row its key is in. */
20065
+ parentKey: string;
20066
+ /** Reads the children of the keys given as `parentKeys`; their parent's key is in `__parent`. */
20067
+ sql: string;
20068
+ columns: NiceOutputColumn[];
20069
+ lists: NiceQueryListPlan[];
20070
+ }
20071
+
19769
20072
  /** The visual query model owned by the builder. */
19770
20073
  export declare interface NiceQueryModel {
19771
20074
  tables: QueryTable[];
@@ -19776,6 +20079,62 @@ export declare interface NiceQueryModel {
19776
20079
  distinct: boolean;
19777
20080
  limit?: number;
19778
20081
  offset?: number;
20082
+ /** The WHERE as a tree of groups and rules (1.4.7); when present it replaces `conditions`. */
20083
+ filter?: NiceQueryFilterGroup;
20084
+ /** Conditions on the totals of a grouped query — HAVING (1.4.7). */
20085
+ having?: NiceQueryFilterGroup;
20086
+ /** Columns worked out with a function (1.4.7). */
20087
+ computed?: NiceQueryComputed[];
20088
+ }
20089
+
20090
+ /** A side of a rule, an argument of a function. */
20091
+ export declare type NiceQueryOperand = {
20092
+ kind: 'column';
20093
+ tableId: string;
20094
+ column: string;
20095
+ aggregate?: AggregateFunction_2;
20096
+ } | {
20097
+ kind: 'computed';
20098
+ id: string;
20099
+ } | {
20100
+ kind: 'value';
20101
+ value: string;
20102
+ } | {
20103
+ kind: 'values';
20104
+ values: string[];
20105
+ } | {
20106
+ kind: 'parameter';
20107
+ name: string;
20108
+ };
20109
+
20110
+ /** A comparison, in words a layman picks ("contains", "in the last … days"). */
20111
+ export declare type NiceQueryOperator = 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'in' | 'notIn' | 'between' | 'isEmpty' | 'isNotEmpty' | 'isTrue' | 'isFalse' | 'today' | 'lastDays' | 'nextDays' | 'thisMonth' | 'thisYear';
20112
+
20113
+ /** What an operator needs on its right, and the values it fits. */
20114
+ export declare interface NiceQueryOperatorDef {
20115
+ id: NiceQueryOperator;
20116
+ /** `none`, one value, two (between), a list, a number of days. */
20117
+ takes: 'none' | 'one' | 'two' | 'list' | 'days';
20118
+ fits: readonly NiceValueType[];
20119
+ }
20120
+
20121
+ /** A query as SQL: the main query and the queries of its nested lists. */
20122
+ export declare interface NiceQueryPlan {
20123
+ sql: string;
20124
+ /** The parameters the SQL takes (`parentKeys` of the lists aside). */
20125
+ parameters: string[];
20126
+ columns: NiceOutputColumn[];
20127
+ lists: NiceQueryListPlan[];
20128
+ }
20129
+
20130
+ /** How to write the SQL. */
20131
+ export declare interface NiceQuerySqlOptions {
20132
+ /** Default `postgresql`. */
20133
+ dialect?: NiceSqlDialect;
20134
+ /** `object` reads one record; `flat` puts every joined table in the row. Default `list`. */
20135
+ shape?: NiceDataSourceShape;
20136
+ /** The SQL of the module's other sources, by key: a table of schema `source` reads it. */
20137
+ sources?: Readonly<Record<string, string>>;
19779
20138
  }
19780
20139
 
19781
20140
  /**
@@ -20406,6 +20765,17 @@ export declare interface NiceRegistryEntry {
20406
20765
  icon?: string;
20407
20766
  }
20408
20767
 
20768
+ /** A table related to one of the query's tables, by a foreign key either way. */
20769
+ export declare interface NiceRelatedTable {
20770
+ fromTableId: string;
20771
+ table: NiceDataSourceSchemaTable;
20772
+ /** The join that brings it in (its right table: the related one, added). */
20773
+ fromColumn: string;
20774
+ toColumn: string;
20775
+ /** `out`: the query's table points at it (many-to-one); `in`: it points at the query's table. */
20776
+ direction: 'out' | 'in';
20777
+ }
20778
+
20409
20779
  export declare const NiceReportBuilder: default_2.FC<ReportBuilderProps>;
20410
20780
 
20411
20781
  export { NiceRequestDeduplicator }
@@ -22676,6 +23046,33 @@ export declare interface NiceSpreadsheetSheet {
22676
23046
  columnFilters?: Record<number, string>;
22677
23047
  }
22678
23048
 
23049
+ /** SQL text run in the module's database (a view the installer creates, or a query). */
23050
+ export declare interface NiceSqlDataSourceDef extends NiceModuleDataSourceBase {
23051
+ kind: 'sql';
23052
+ /** `postgresql`, `sqlserver`, `mysql`, `sqlite` — or none for portable SQL. */
23053
+ dialect?: string;
23054
+ sql: string;
23055
+ parameters?: NiceDataSourceParameter[];
23056
+ /** The columns the SQL returns (so views and other sources can bind to them before a run). */
23057
+ columns?: NiceDataSourceColumn[];
23058
+ }
23059
+
23060
+ /** The databases the designer writes SQL for. */
23061
+ export declare type NiceSqlDialect = 'postgresql' | 'sqlserver' | 'mysql' | 'sqlite' | 'oracle';
23062
+
23063
+ export declare interface NiceSqlFunctionDef {
23064
+ id: NiceSqlFunctionId;
23065
+ group: 'text' | 'number' | 'date' | 'other';
23066
+ /** The arguments, by what they hold. */
23067
+ args: readonly NiceValueType[];
23068
+ /** More arguments of the last type may follow (concat, coalesce). */
23069
+ variadic?: boolean;
23070
+ result: NiceValueType;
23071
+ }
23072
+
23073
+ /** The functions a computed column offers, in groups a layman finds them in. */
23074
+ export declare type NiceSqlFunctionId = 'upper' | 'lower' | 'trim' | 'concat' | 'left' | 'length' | 'replace' | 'round' | 'abs' | 'floor' | 'ceil' | 'add' | 'subtract' | 'multiply' | 'divide' | 'year' | 'month' | 'day' | 'date' | 'daysBetween' | 'now' | 'coalesce';
23075
+
22679
23076
  export { NiceSqlWhere }
22680
23077
 
22681
23078
  export { NiceSSEConfig }
@@ -22761,6 +23158,13 @@ export { NiceStateIO }
22761
23158
 
22762
23159
  export { NiceStateSnapshot }
22763
23160
 
23161
+ /** Fixed rows kept in the module (choices, a lookup table). */
23162
+ export declare interface NiceStaticDataSourceDef extends NiceModuleDataSourceBase {
23163
+ kind: 'static';
23164
+ columns?: NiceDataSourceColumn[];
23165
+ rows: Array<Record<string, unknown>>;
23166
+ }
23167
+
22764
23168
  /**
22765
23169
  * Renders a single KPI tile: title, big value with optional pre/suffix,
22766
23170
  * and an arrow-coloured trend chip. Locale-aware number formatting via
@@ -25212,6 +25616,15 @@ export declare interface NiceUndoProviderProps<T = unknown> {
25212
25616
  maxHistory?: number;
25213
25617
  }
25214
25618
 
25619
+ /** The rows of other sources, one after another. */
25620
+ export declare interface NiceUnionDataSourceDef extends NiceModuleDataSourceBase {
25621
+ kind: 'union';
25622
+ /** The keys of the sources, in order. */
25623
+ sources: string[];
25624
+ /** Drop rows that repeat (SQL `UNION` rather than `UNION ALL`). */
25625
+ distinct?: boolean;
25626
+ }
25627
+
25215
25628
  export declare const NiceUpdatePrompt: default_2.ForwardRefExoticComponent<NiceUpdatePromptProps & default_2.RefAttributes<HTMLDivElement>> & {
25216
25629
  displayName: string;
25217
25630
  };
@@ -25476,6 +25889,9 @@ export declare interface NiceValidatorProps extends NiceBaseProps {
25476
25889
  validateOnChange?: boolean;
25477
25890
  }
25478
25891
 
25892
+ /** What a value is, for the operators and functions that fit it. */
25893
+ export declare type NiceValueType = 'text' | 'number' | 'date' | 'boolean' | 'any';
25894
+
25479
25895
  export { NiceVariant }
25480
25896
 
25481
25897
  export declare const NiceVectorMap: default_2.FC<NiceVectorMapProps>;
@@ -26762,9 +27178,18 @@ export declare interface OpenAPISpec {
26762
27178
  };
26763
27179
  }
26764
27180
 
27181
+ /** The operators that fit a value. */
27182
+ export declare function operatorsFor(type: NiceValueType): NiceQueryOperatorDef[];
27183
+
26765
27184
  /** Moves the node with `id` out of its parent, right after it; a root stays. */
26766
27185
  export declare function outdentTreeNode<T>(tree: readonly T[], id: string, options?: TreeEditOptions): T[];
26767
27186
 
27187
+ /**
27188
+ * The columns of the result, in order: picked table columns and computed ones. A name taken twice
27189
+ * in the same part gets its table's handle in front (`Customer_Name`).
27190
+ */
27191
+ export declare function outputColumns(model: NiceQueryModel): NiceOutputColumn[];
27192
+
26768
27193
  /** Overlay position */
26769
27194
  export declare type OverlayPosition = 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
26770
27195
 
@@ -26857,6 +27282,12 @@ declare interface ParamDefinition {
26857
27282
  validation?: ValidationRule_2[];
26858
27283
  }
26859
27284
 
27285
+ /** The column a list's rows carry their parent's key in. */
27286
+ export declare const PARENT_KEY_COLUMN = "__parent";
27287
+
27288
+ /** The name of the parameter a list's query reads its parent keys from. */
27289
+ export declare const PARENT_KEYS_PARAMETER = "parentKeys";
27290
+
26860
27291
  /** Parse CLI argv for adapter generation */
26861
27292
  export declare function parseAdapterCLIArgs(argv: string[]): AdapterCLIArgs;
26862
27293
 
@@ -26980,6 +27411,9 @@ export declare interface Person {
26980
27411
  metadata?: Record<string, any>;
26981
27412
  }
26982
27413
 
27414
+ /** The query with columns picked in bulk — of one table, or of every table when none is given. */
27415
+ export declare function pickColumns(model: NiceQueryModel, pick: NiceColumnPick, tableId?: string): NiceQueryModel;
27416
+
26983
27417
  export { PinchGesture }
26984
27418
 
26985
27419
  declare interface Pipeline {
@@ -27141,6 +27575,12 @@ declare interface PlacedComponent {
27141
27575
  props: Record<string, unknown>;
27142
27576
  }
27143
27577
 
27578
+ /** A query as SQL: the main query and one query per nested list. */
27579
+ export declare function planQuerySql(model: NiceQueryModel, options?: NiceQuerySqlOptions): NiceQueryPlan;
27580
+
27581
+ /** A plan's SQL in one text: the main query, then each list's under a comment naming it. */
27582
+ export declare function planSqlText(plan: NiceQueryPlan): string;
27583
+
27144
27584
  /** Platform connection config */
27145
27585
  export declare interface PlatformConnection {
27146
27586
  id: string;
@@ -27380,6 +27820,8 @@ declare interface QueryColumn {
27380
27820
  selected: boolean;
27381
27821
  alias?: string;
27382
27822
  aggregate?: AggregateFunction_2;
27823
+ /** Its place among the output columns (1.4.7; default: table by table, as listed). */
27824
+ order?: number;
27383
27825
  }
27384
27826
 
27385
27827
  declare interface QueryCondition {
@@ -27396,6 +27838,8 @@ declare interface QueryCondition {
27396
27838
  declare interface QueryGroupBy {
27397
27839
  tableId: string;
27398
27840
  column: string;
27841
+ /** Group a date by its year, quarter, month or day (1.4.7). */
27842
+ datePart?: 'year' | 'quarter' | 'month' | 'day';
27399
27843
  }
27400
27844
 
27401
27845
  declare interface QueryJoin {
@@ -27405,8 +27849,23 @@ declare interface QueryJoin {
27405
27849
  leftColumn: string;
27406
27850
  rightTableId: string;
27407
27851
  rightColumn: string;
27852
+ /** More column pairs the rows match on (1.4.7, the data source designer). */
27853
+ pairs?: Array<{
27854
+ leftColumn: string;
27855
+ rightColumn: string;
27856
+ }>;
27857
+ /**
27858
+ * How the right table appears in the result (1.4.7): its columns in the row (`flat`, default),
27859
+ * one nested object (`object` — many-to-one), or a nested list (`list` — one-to-many).
27860
+ */
27861
+ nest?: 'flat' | 'object' | 'list';
27862
+ /** The property a nested table is put under (default: its alias or name). */
27863
+ as?: string;
27408
27864
  }
27409
27865
 
27866
+ /** The parameters a query uses: in its filter, its HAVING and its computed columns. */
27867
+ export declare function queryParameterNames(model: NiceQueryModel): string[];
27868
+
27410
27869
  declare interface QuerySort {
27411
27870
  id: string;
27412
27871
  tableId: string;
@@ -27448,6 +27907,12 @@ declare interface QuickFilter<T = any> {
27448
27907
  color?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary';
27449
27908
  }
27450
27909
 
27910
+ /**
27911
+ * A name as the database writes it — always quoted: PostgreSQL folds an unquoted `AgroWindow` to
27912
+ * `agrowindow` (OmniVerk creates its tables quoted), and `Order`, `User`, `Group` are reserved.
27913
+ */
27914
+ export declare function quoteSqlName(name: string, dialect?: NiceSqlDialect): string;
27915
+
27451
27916
  export { RADIUS_VALUES }
27452
27917
 
27453
27918
  export { RadiusVariant }
@@ -27732,6 +28197,9 @@ declare interface ReferenceLine {
27732
28197
  dashArray?: string;
27733
28198
  }
27734
28199
 
28200
+ /** Tables a foreign key relates to a table of the query — what "Add related" offers. */
28201
+ export declare function relatedTables(model: NiceQueryModel, tableId: string, schemas: readonly NiceDataSourceSchemaTable[]): NiceRelatedTable[];
28202
+
27735
28203
  /**
27736
28204
  * Takes out the pages `pageIds` (also ones the catalog no longer has). A page with items below it
27737
28205
  * stays as their group; groups recreated from the catalog that are left empty go too.
@@ -27744,6 +28212,9 @@ export declare function removeRole(roles: readonly NiceRoleDef[], users: readonl
27744
28212
  users: NiceRoleUser[];
27745
28213
  };
27746
28214
 
28215
+ /** The query without a table, its joins, its sorts, groups and the rules that read it. */
28216
+ export declare function removeTable(model: NiceQueryModel, tableId: string): NiceQueryModel;
28217
+
27747
28218
  export { removeTheme }
27748
28219
 
27749
28220
  /** Removes the node with `id` and its subtree. */
@@ -27974,8 +28445,13 @@ export declare function roleInheritanceCycles(roles: readonly NiceRoleDef[]): st
27974
28445
 
27975
28446
  export declare type RoomGridLayout = 'grid' | 'list';
27976
28447
 
28448
+ /** The table a query starts FROM: the first one no join brings in. */
28449
+ export declare function rootTableId(model: NiceQueryModel): string | undefined;
28450
+
27977
28451
  export { RovingFocusControls }
27978
28452
 
28453
+ declare type Row = Record<string, unknown>;
28454
+
27979
28455
  /**
27980
28456
  * Row render context.
27981
28457
  */
@@ -29304,6 +29780,15 @@ export declare interface SpriteSheetSettings {
29304
29780
  quality: number;
29305
29781
  }
29306
29782
 
29783
+ /**
29784
+ * The data sources every table has without anyone writing them (1.4.7): all its rows
29785
+ * (`{Entity}All`, every column) and one row by its key (`{Entity}ById`, WHERE Id = @id, one
29786
+ * record). Shown beside a module's own sources, not edited — duplicated to start one.
29787
+ */
29788
+ export declare function standardDataSources(tables: readonly NiceDataSourceSchemaTable[], options?: {
29789
+ dialect?: NiceSqlDialect;
29790
+ }): NiceDataSourceDef[];
29791
+
29307
29792
  export declare interface StandardEntity {
29308
29793
  id: string;
29309
29794
  name: string;
@@ -29575,6 +30060,12 @@ declare interface SuggestionFactor {
29575
30060
  entryValue?: string;
29576
30061
  }
29577
30062
 
30063
+ /**
30064
+ * Joins the query lacks between its tables: a column whose foreign key points at another table of
30065
+ * the query, or named after it (`CustomerId` and `Customer.Id`). Each pair once.
30066
+ */
30067
+ export declare function suggestJoins(model: NiceQueryModel, schemas: readonly NiceDataSourceSchemaTable[]): NiceJoinSuggestion[];
30068
+
29578
30069
  /** Swap event types. */
29579
30070
  export declare type SwapEventType = 'swap-start' | 'swap-success' | 'swap-error' | 'swap-rollback';
29580
30071
 
@@ -30705,6 +31196,9 @@ export declare interface UndoEntry<T = unknown> {
30705
31196
  groupId?: string;
30706
31197
  }
30707
31198
 
31199
+ /** The node of a filter tree with an id, its group, and the tree with a node replaced. */
31200
+ export declare function updateFilterNode(group: NiceQueryFilterGroup, id: string, fn: (node: NiceQueryFilterNode) => NiceQueryFilterNode | null): NiceQueryFilterGroup;
31201
+
30708
31202
  /** Update operation types */
30709
31203
  export declare type UpdateOperation = 'insert' | 'update' | 'delete' | 'upsert';
30710
31204
 
@@ -31718,6 +32212,9 @@ export { ValidationSeverity }
31718
32212
 
31719
32213
  declare type ValidationType = 'required' | 'type' | 'min' | 'max' | 'pattern' | 'enum' | 'custom';
31720
32214
 
32215
+ /** What a column's data type holds. */
32216
+ export declare function valueTypeOf(dataType: string | undefined): NiceValueType;
32217
+
31721
32218
  export { VARIANT_PRESETS }
31722
32219
 
31723
32220
  /** Author/User information */