@nice2dev/ui-forms 1.4.12 → 1.4.14
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.cjs +7 -7
- package/dist/index.d.ts +159 -1
- package/dist/index.mjs +3046 -2706
- package/dist/studio.cjs +9 -9
- package/dist/studio.d.ts +159 -1
- package/dist/studio.mjs +988 -710
- package/dist/ui-forms.css +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export declare function entitiesToSchemas(entities: readonly Row_2[]): NiceDataS
|
|
|
90
90
|
/** The file name of a path. */
|
|
91
91
|
export declare const fileName: (path: string) => string;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The files that refer to `name` by `rules`, with how many references each holds — what a rename
|
|
95
|
+
* would rewrite.
|
|
96
|
+
*/
|
|
97
|
+
export declare function findStudioReferences(files: readonly NiceStudioTextFile[], rules: readonly NiceStudioReferenceRule[], name: string, options?: NiceStudioRenameOptions): Array<{
|
|
98
|
+
path: string;
|
|
99
|
+
count: number;
|
|
100
|
+
}>;
|
|
101
|
+
|
|
93
102
|
/**
|
|
94
103
|
* A section narrowed to the properties a form can edit in this manifest: a value that does not fit
|
|
95
104
|
* its property's schema ({@link jsonValueFitsSchema}) leaves the section and is edited as JSON
|
|
@@ -243,6 +252,9 @@ export declare function inferStudioScriptKind(raw: Row): NiceStudioScriptKind;
|
|
|
243
252
|
/** Whether a layout holds nothing (its file can go). */
|
|
244
253
|
export declare const isEmptyStudioLayout: (layout: NiceStudioLayout) => boolean;
|
|
245
254
|
|
|
255
|
+
/** Whether folder `id` is `ancestor` or sits, at any depth, inside it. */
|
|
256
|
+
export declare function isStudioFolderWithin(layout: NiceStudioLayout, id: string, ancestor: string): boolean;
|
|
257
|
+
|
|
246
258
|
/** Whether a path is a module's layout file. */
|
|
247
259
|
export declare const isStudioLayoutPath: (path: string) => boolean;
|
|
248
260
|
|
|
@@ -324,6 +336,17 @@ export declare function manifestSectionKeys(sections: readonly NiceManifestSecti
|
|
|
324
336
|
/** The prefix a module's files share (`orders` of `orders.manifest.json`). */
|
|
325
337
|
export declare function modulePrefix(files: readonly NiceStudioFile[]): string;
|
|
326
338
|
|
|
339
|
+
/**
|
|
340
|
+
* The layout with a folder moved (1.4.14): into another folder of its group (its section follows that
|
|
341
|
+
* folder's), into a section, or to its group's top (`{}`). The folders and entries inside it come
|
|
342
|
+
* along into the same section. A move into itself or a folder inside it, or into a folder of another
|
|
343
|
+
* group, leaves the layout as it was.
|
|
344
|
+
*/
|
|
345
|
+
export declare function moveStudioFolder(layout: NiceStudioLayout, folderId: string, target: {
|
|
346
|
+
parent?: string;
|
|
347
|
+
section?: string;
|
|
348
|
+
}): NiceStudioLayout;
|
|
349
|
+
|
|
327
350
|
export declare const nativeDataSourcesKind: NiceStudioFileKind<NiceDataSourceDef[]>;
|
|
328
351
|
|
|
329
352
|
export declare const nativeEntitiesKind: NiceStudioFileKind<Row_3[]>;
|
|
@@ -354,6 +377,17 @@ export declare const nativeScriptsKind: NiceStudioFileKind<NiceStudioScripts>;
|
|
|
354
377
|
/** The studio's own format: manifest, entities, translations, views, workflows, data sources, access, hooks, scripts. */
|
|
355
378
|
export declare const nativeStudioPreset: NiceStudioPreset;
|
|
356
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Where the native files refer to an entity or a data source by name (1.4.15):
|
|
382
|
+
* - entities: a field's `references`, a view's data source `entity` and the standard sources
|
|
383
|
+
* `{name}All` / `{name}ById`, a workflow's `entityType`, a data source's tables (an entity without
|
|
384
|
+
* `tableName`), access resources (`entity:{name}`) and their grants, translation keys, a no-code
|
|
385
|
+
* script's `target`, an integration operation's `source` / `target`;
|
|
386
|
+
* - data source keys: a view's `ref`, a script's `source` / `target`, a union's `sources`, an
|
|
387
|
+
* integration operation's `source`.
|
|
388
|
+
*/
|
|
389
|
+
export declare const nativeStudioReferences: NiceStudioReferenceRules;
|
|
390
|
+
|
|
357
391
|
export declare const nativeViewsKind: NiceStudioFileKind<NiceStudioItem<NiceViewDefinition>[]>;
|
|
358
392
|
|
|
359
393
|
export declare const nativeWorkflowsKind: NiceStudioFileKind<NiceStudioItem<NiceWorkflowDefinition>[]>;
|
|
@@ -814,6 +848,21 @@ export declare interface NiceStudioCodecContext {
|
|
|
814
848
|
locales: readonly string[];
|
|
815
849
|
}
|
|
816
850
|
|
|
851
|
+
/** A module another module depends on (1.4.15 — the tree's Dependencies group, OmniVerk wishlist #1). */
|
|
852
|
+
export declare interface NiceStudioDependency {
|
|
853
|
+
/** The module it names: its id or package name. */
|
|
854
|
+
id: string;
|
|
855
|
+
/** Needed (`true`) or optional (`false`); unknown when absent. */
|
|
856
|
+
required?: boolean;
|
|
857
|
+
/** Why the module needs it. */
|
|
858
|
+
reason?: string;
|
|
859
|
+
minVersion?: string;
|
|
860
|
+
/** Declared in the manifest, or only referred to (a field of an entity of that module). */
|
|
861
|
+
via: 'manifest' | 'reference';
|
|
862
|
+
/** The entities of that module the files refer to. */
|
|
863
|
+
refers?: string[];
|
|
864
|
+
}
|
|
865
|
+
|
|
817
866
|
/** A document of an open module: the files one editor works on. */
|
|
818
867
|
export declare interface NiceStudioDocument<M = unknown> {
|
|
819
868
|
/** Stable within the module: `${kind.id}:${group}`. */
|
|
@@ -1168,6 +1217,13 @@ export declare interface NiceStudioPreset {
|
|
|
1168
1217
|
requiredLocales?: string[];
|
|
1169
1218
|
/** The module's id from its files (e.g. the manifest's `packageName`). */
|
|
1170
1219
|
moduleId?(files: readonly NiceStudioFile[]): string | undefined;
|
|
1220
|
+
/**
|
|
1221
|
+
* Where the module's files refer to an entity or a data source by name (1.4.15): renaming one in
|
|
1222
|
+
* the studio rewrites these places too. Without it, a rename changes only the entity itself.
|
|
1223
|
+
*/
|
|
1224
|
+
references?: NiceStudioReferenceRules;
|
|
1225
|
+
/** The modules a module depends on, for the tree's Dependencies group (1.4.15). */
|
|
1226
|
+
dependencies?(ctx: NiceStudioModuleContext): NiceStudioDependency[];
|
|
1171
1227
|
validateModule?(ctx: NiceStudioModuleContext): NiceStudioIssue[];
|
|
1172
1228
|
generateModule?(spec: NiceStudioModuleSpec, ctx: {
|
|
1173
1229
|
existingIds: ReadonlySet<string>;
|
|
@@ -1249,6 +1305,71 @@ export declare interface NiceStudioProvider {
|
|
|
1249
1305
|
rollback?(key: NiceStudioModuleKey, revisionId: string, path?: string): Promise<void>;
|
|
1250
1306
|
}
|
|
1251
1307
|
|
|
1308
|
+
/** One kind of place a name is referred to in a module's files. */
|
|
1309
|
+
export declare type NiceStudioReferenceRule = {
|
|
1310
|
+
/** A property, at any depth, whose string value (or each string of its array) holds the name. */
|
|
1311
|
+
prop: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* How the value holds it: all of it (default); its first part before a `.` (`Order.Status`,
|
|
1314
|
+
* `Order.Created`); its last part after a `.` or `/` (`Sales.Order`, `Sales/Order` — only with
|
|
1315
|
+
* the module's own qualifiers); or the part before a `?` (`Order?filter=…`).
|
|
1316
|
+
*/
|
|
1317
|
+
part?: 'whole' | 'head' | 'tail' | 'query';
|
|
1318
|
+
/** Text before the name in the value (`entity:`). */
|
|
1319
|
+
prefix?: string;
|
|
1320
|
+
/** Only objects held by this key (an array's or object's key): `tables`, `relations`. */
|
|
1321
|
+
within?: string;
|
|
1322
|
+
/** Refers to the entity's table, which is its name only while it has no `tableName`. */
|
|
1323
|
+
table?: boolean;
|
|
1324
|
+
/** Only files whose path matches. */
|
|
1325
|
+
files?: RegExp;
|
|
1326
|
+
} | {
|
|
1327
|
+
/**
|
|
1328
|
+
* The keys of the object held by this key (at any depth; `a.b` for nested keys) are names:
|
|
1329
|
+
* `seeds`, `demoSeeds`, `grants`.
|
|
1330
|
+
*/
|
|
1331
|
+
keysOf: string;
|
|
1332
|
+
prefix?: string;
|
|
1333
|
+
files?: RegExp;
|
|
1334
|
+
} | {
|
|
1335
|
+
/** A property whose string value is JSON text: the rules apply inside it (`viewJson`). */
|
|
1336
|
+
jsonIn: string;
|
|
1337
|
+
files?: RegExp;
|
|
1338
|
+
} | {
|
|
1339
|
+
/** Object keys built from the name: `{name}` marks it (`entity.{name}.`, `field.{name}.`). */
|
|
1340
|
+
keyPattern: string;
|
|
1341
|
+
files?: RegExp;
|
|
1342
|
+
} | {
|
|
1343
|
+
/** A whole string value, anywhere, built from the name: `{name}All`, `{name}ById`. */
|
|
1344
|
+
value: string;
|
|
1345
|
+
files?: RegExp;
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
/** The rules of a preset, by what is renamed. */
|
|
1349
|
+
export declare interface NiceStudioReferenceRules {
|
|
1350
|
+
entity?: NiceStudioReferenceRule[];
|
|
1351
|
+
dataSource?: NiceStudioReferenceRule[];
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
export declare interface NiceStudioRenameOptions {
|
|
1355
|
+
/**
|
|
1356
|
+
* The module's own names a qualified reference may carry (`Sales` in `Sales.Order`): its id, its
|
|
1357
|
+
* package. Qualified references to other modules are never touched.
|
|
1358
|
+
*/
|
|
1359
|
+
qualifiers?: readonly string[];
|
|
1360
|
+
/** Only qualified references (`Sales.Order`) — for the other modules that refer to this one. */
|
|
1361
|
+
qualifiedOnly?: boolean;
|
|
1362
|
+
/** The renamed entity has its own `tableName`: rules about its table do not apply. */
|
|
1363
|
+
ownTable?: boolean;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
export declare interface NiceStudioRenameResult {
|
|
1367
|
+
/** The files that changed, with their new text. */
|
|
1368
|
+
files: NiceStudioTextFile[];
|
|
1369
|
+
/** How many references were rewritten. */
|
|
1370
|
+
count: number;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1252
1373
|
/** A saved earlier version of a module or one of its files. */
|
|
1253
1374
|
export declare interface NiceStudioRevision {
|
|
1254
1375
|
id: string;
|
|
@@ -1362,6 +1483,12 @@ export declare interface NiceStudioTemplateModule {
|
|
|
1362
1483
|
description?: string;
|
|
1363
1484
|
}
|
|
1364
1485
|
|
|
1486
|
+
/** A file as the studio holds it. */
|
|
1487
|
+
export declare interface NiceStudioTextFile {
|
|
1488
|
+
path: string;
|
|
1489
|
+
text: string;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1365
1492
|
/** Translations of one document: `{ en: { key: text }, pl: { … } }` (the shape of NiceI18nEditor). */
|
|
1366
1493
|
export declare type NiceStudioTranslations = Record<string, Record<string, string>>;
|
|
1367
1494
|
|
|
@@ -1400,6 +1527,12 @@ export declare type NiceStudioWriteResult = {
|
|
|
1400
1527
|
/** A file whose whole content is the model (a manifest, an access model). */
|
|
1401
1528
|
export declare function objectFileKind<T extends object>(o: NiceObjectFileKindOptions): NiceStudioFileKind<T>;
|
|
1402
1529
|
|
|
1530
|
+
/**
|
|
1531
|
+
* The layout with entries put in this order among their siblings (1.4.14 — dragging rows of the
|
|
1532
|
+
* tree): each gets `order` = its index; their section and folder stay.
|
|
1533
|
+
*/
|
|
1534
|
+
export declare function orderStudioEntries(layout: NiceStudioLayout, refs: readonly string[]): NiceStudioLayout;
|
|
1535
|
+
|
|
1403
1536
|
/** Parses JSON text that may start with a BOM, and tells how it is written. */
|
|
1404
1537
|
export declare function parseJsonText(text: string): {
|
|
1405
1538
|
value: unknown;
|
|
@@ -1424,7 +1557,8 @@ export declare function patchJsonTextDetailed(previous: string, next: unknown, o
|
|
|
1424
1557
|
|
|
1425
1558
|
/**
|
|
1426
1559
|
* The layout with an entry put somewhere: into a folder (its section follows the folder's), into a
|
|
1427
|
-
* section (out of any folder), or back to its group (`{}`).
|
|
1560
|
+
* section (out of any folder), or back to its group (`{}`). A folder of another group (1.4.14 — a
|
|
1561
|
+
* drag can aim anywhere) leaves the layout as it was.
|
|
1428
1562
|
*/
|
|
1429
1563
|
export declare function placeStudioEntry(layout: NiceStudioLayout, ref: string, target: {
|
|
1430
1564
|
folder?: string;
|
|
@@ -1452,6 +1586,12 @@ export declare function renameStudioLayoutNode(layout: NiceStudioLayout, node: {
|
|
|
1452
1586
|
id: string;
|
|
1453
1587
|
}, label: string): NiceStudioLayout;
|
|
1454
1588
|
|
|
1589
|
+
/**
|
|
1590
|
+
* The files with every reference to `from` renamed to `to`, by `rules`. Only JSON files are read;
|
|
1591
|
+
* a file that does not parse is left alone. Returns the changed files and the count.
|
|
1592
|
+
*/
|
|
1593
|
+
export declare function renameStudioReferences(files: readonly NiceStudioTextFile[], rules: readonly NiceStudioReferenceRule[], from: string, to: string, options?: NiceStudioRenameOptions): NiceStudioRenameResult;
|
|
1594
|
+
|
|
1455
1595
|
/** The kind a path opens with: the first that matches, else JSON or text. */
|
|
1456
1596
|
export declare function resolveFileKind(kinds: readonly NiceStudioFileKind[], path: string): NiceStudioFileKind;
|
|
1457
1597
|
|
|
@@ -1483,6 +1623,13 @@ export declare function slugifyModuleId(name: string): string;
|
|
|
1483
1623
|
/** Writes `value` in a given format (defaults: two spaces, LF, final newline, no BOM). */
|
|
1484
1624
|
export declare function stringifyJsonText(value: unknown, format?: Partial<NiceJsonTextFormat>): string;
|
|
1485
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* A module's dependencies (1.4.15 — OmniVerk wishlist #1): the declared ones, each with the entities
|
|
1628
|
+
* of it the files refer to, then the modules only referred to (`Other.Entity` in a field) that are
|
|
1629
|
+
* not declared. Qualifiers are matched without regard to `.` / `/` and case.
|
|
1630
|
+
*/
|
|
1631
|
+
export declare function studioDependencies(declared: readonly NiceStudioDependency[], files: readonly NiceStudioTextFile[], rules: readonly NiceStudioReferenceRule[], own?: readonly string[]): NiceStudioDependency[];
|
|
1632
|
+
|
|
1486
1633
|
/** The ref of an entry in a layout: `group:key`. */
|
|
1487
1634
|
export declare const studioEntryRef: (group: string, key: string) => string;
|
|
1488
1635
|
|
|
@@ -1492,6 +1639,17 @@ export declare const studioEntryRef: (group: string, key: string) => string;
|
|
|
1492
1639
|
*/
|
|
1493
1640
|
export declare function studioLayoutPath(files: readonly NiceStudioFile[]): string;
|
|
1494
1641
|
|
|
1642
|
+
/**
|
|
1643
|
+
* The qualified references (`Other.Entity`, `Other/Entity`) in the places `rules` mark with
|
|
1644
|
+
* `part: 'tail'` whose qualifier is not one of `own` — the other modules a module refers to, for its
|
|
1645
|
+
* dependencies.
|
|
1646
|
+
*/
|
|
1647
|
+
export declare function studioQualifiedReferences(files: readonly NiceStudioTextFile[], rules: readonly NiceStudioReferenceRule[], own?: readonly string[]): Array<{
|
|
1648
|
+
qualifier: string;
|
|
1649
|
+
name: string;
|
|
1650
|
+
path: string;
|
|
1651
|
+
}>;
|
|
1652
|
+
|
|
1495
1653
|
/** `"Send invoice"` → `sendInvoice`: a name usable as a function's. */
|
|
1496
1654
|
export declare function studioScriptIdentifier(name: string): string;
|
|
1497
1655
|
|