@streamline-pulse/formkrafter-core 0.32.1 → 0.34.0
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.
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/** A catalog the host offers to select / multi-select fields (shown in the builder). */
|
|
2
|
+
export interface OptionCatalogEntry {
|
|
3
|
+
/** What to put in `optionsRef` (filters may be appended: `towns?region={{data.region}}`). */
|
|
4
|
+
ref: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Query parameters the catalog accepts, for dependent lists. */
|
|
8
|
+
filters?: string[];
|
|
9
|
+
}
|
|
1
10
|
export interface OptionSourceService {
|
|
2
11
|
fetchOptions(ref: string): Promise<unknown>;
|
|
12
|
+
/** Optional: the catalogs available, so the builder can suggest refs. */
|
|
13
|
+
listCatalogs?(): Promise<OptionCatalogEntry[]>;
|
|
3
14
|
}
|
|
4
15
|
export interface FetchOptionSourceDefaults {
|
|
5
16
|
baseUrl?: string;
|
|
17
|
+
/** Where to list the catalogs (default: `baseUrl`). The response is an array, or `{ data: [...] }`, of `{ ref | value, name | label, description?, filters? }`. */
|
|
18
|
+
catalogsUrl?: string;
|
|
6
19
|
headers?: Record<string, string>;
|
|
7
20
|
credentials?: RequestCredentials;
|
|
8
21
|
fetch?: typeof fetch;
|
|
@@ -13,4 +26,6 @@ export declare class FetchOptionSourceService implements OptionSourceService {
|
|
|
13
26
|
constructor(defaults?: FetchOptionSourceDefaults);
|
|
14
27
|
private resolveUrl;
|
|
15
28
|
fetchOptions(ref: string): Promise<unknown>;
|
|
29
|
+
private catalogs?;
|
|
30
|
+
listCatalogs(): Promise<OptionCatalogEntry[]>;
|
|
16
31
|
}
|
|
@@ -5,6 +5,13 @@ import type { Rule } from "../rules/rule.js";
|
|
|
5
5
|
import type { BrickType } from "./brick-type.js";
|
|
6
6
|
import type { BrickBaseConfigs } from "./common-brick-props.js";
|
|
7
7
|
import type { BrickStyles } from "../utils/brick-styles.js";
|
|
8
|
+
/** Where a brick sits in its row: `columns` on a row, `span` on one of its children. */
|
|
9
|
+
export interface BrickLayout {
|
|
10
|
+
/** On a row: the number of equal columns, so a lone field keeps its share instead of the whole width. */
|
|
11
|
+
columns?: number;
|
|
12
|
+
/** On a child of a row: how many of the row's columns it takes (1 by default). */
|
|
13
|
+
span?: number;
|
|
14
|
+
}
|
|
8
15
|
export interface BrickSpec {
|
|
9
16
|
type: BrickType;
|
|
10
17
|
dataType?: JSONSchemaType;
|
|
@@ -20,6 +27,7 @@ export interface BrickSpec {
|
|
|
20
27
|
configsForm?: BrickSpec;
|
|
21
28
|
configs?: BrickBaseConfigs & Record<string, unknown>;
|
|
22
29
|
styles?: BrickStyles<string>;
|
|
30
|
+
layout?: BrickLayout;
|
|
23
31
|
children?: BrickSpec[];
|
|
24
32
|
}
|
|
25
33
|
export declare function iterateBricks(spec?: BrickSpec, path?: string): Generator<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrickSpec } from "./brick-spec.js";
|
|
2
|
-
export type SpecIssueCode = "validations-without-data-type" | "input-without-key" | "duplicate-key" | "collection-without-children";
|
|
2
|
+
export type SpecIssueCode = "validations-without-data-type" | "input-without-key" | "duplicate-key" | "collection-without-children" | "content-in-row";
|
|
3
3
|
export interface SpecIssue {
|
|
4
4
|
code: SpecIssueCode;
|
|
5
5
|
path: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Framework-agnostic core for FormKrafter: form specs, RFC 6902 ops with undo/redo, Ajv validation, sandboxed rules engine and injectable services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -68,6 +68,15 @@
|
|
|
68
68
|
"description": "Style tokens applied to the brick, as CSS-like key/value pairs.",
|
|
69
69
|
"additionalProperties": true
|
|
70
70
|
},
|
|
71
|
+
"layout": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "Placement in a row: \"columns\" on the row itself (equal columns, a lone field keeps its share), \"span\" on one of its children (how many columns it takes). A row still stacks on narrow screens.",
|
|
74
|
+
"properties": {
|
|
75
|
+
"columns": { "type": "integer", "minimum": 1, "maximum": 12 },
|
|
76
|
+
"span": { "type": "integer", "minimum": 1, "maximum": 12 }
|
|
77
|
+
},
|
|
78
|
+
"additionalProperties": false
|
|
79
|
+
},
|
|
71
80
|
"children": {
|
|
72
81
|
"type": "array",
|
|
73
82
|
"items": { "$ref": "#/$defs/brick" },
|