@mosaicoo/form-core 0.1.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.
- package/README.md +37 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/interop/importer.d.ts +38 -0
- package/dist/interop/importer.d.ts.map +1 -0
- package/dist/interop/importer.js +29 -0
- package/dist/interop/importer.js.map +1 -0
- package/dist/interop/legacy/legacy-exporter.d.ts +14 -0
- package/dist/interop/legacy/legacy-exporter.d.ts.map +1 -0
- package/dist/interop/legacy/legacy-exporter.js +234 -0
- package/dist/interop/legacy/legacy-exporter.js.map +1 -0
- package/dist/interop/legacy/legacy-importer.d.ts +25 -0
- package/dist/interop/legacy/legacy-importer.d.ts.map +1 -0
- package/dist/interop/legacy/legacy-importer.js +382 -0
- package/dist/interop/legacy/legacy-importer.js.map +1 -0
- package/dist/schema/types.d.ts +181 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +9 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/walk.d.ts +27 -0
- package/dist/schema/walk.d.ts.map +1 -0
- package/dist/schema/walk.js +56 -0
- package/dist/schema/walk.js.map +1 -0
- package/dist/state/engine.d.ts +93 -0
- package/dist/state/engine.d.ts.map +1 -0
- package/dist/state/engine.js +358 -0
- package/dist/state/engine.js.map +1 -0
- package/dist/util/clone.d.ts +6 -0
- package/dist/util/clone.d.ts.map +1 -0
- package/dist/util/clone.js +18 -0
- package/dist/util/clone.js.map +1 -0
- package/dist/validation/validate.d.ts +35 -0
- package/dist/validation/validate.d.ts.map +1 -0
- package/dist/validation/validate.js +113 -0
- package/dist/validation/validate.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @mosaicoo/form-core
|
|
2
|
+
|
|
3
|
+
Headless form engine, pure TypeScript, zero dependencies. Models a form as a
|
|
4
|
+
serializable schema and runs it: values, touched/dirty state, conditional
|
|
5
|
+
visibility, validation, repeatable rows and submission — with no DOM and no
|
|
6
|
+
framework, so any rendering layer can project it.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { createFormEngine, createLegacyImporter, importForm } from '@mosaicoo/form-core';
|
|
10
|
+
|
|
11
|
+
const { schema, warnings } = importForm(definition, [createLegacyImporter()]);
|
|
12
|
+
const engine = createFormEngine(schema, { initialData: { name: 'Ada' } });
|
|
13
|
+
|
|
14
|
+
engine.setValue('email', 'ada@lovelace.dev');
|
|
15
|
+
engine.isVisible('proCode'); // conditional visibility from data
|
|
16
|
+
engine.addRow('phones'); // repeatable rows (array containers)
|
|
17
|
+
const result = engine.submit(); // { ok, data, errors }
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What's inside
|
|
21
|
+
|
|
22
|
+
- **Schema v1** — `input` / `container` / `static` nodes; layout containers,
|
|
23
|
+
nested data groups, array containers (row templates), column layout, tabs.
|
|
24
|
+
- **Engine** — dot-path data access, defaults, touched/dirty, conditional
|
|
25
|
+
visibility chained through ancestors, per-field / per-container / full
|
|
26
|
+
validation, `clearOnHide`, event subscription for renderers.
|
|
27
|
+
- **Validation** — declarative rules (required, length, pattern, bounds,
|
|
28
|
+
email) plus a registry for host-defined custom validators; every message
|
|
29
|
+
resolves through a replaceable `MessageResolver` (localization hook).
|
|
30
|
+
- **Dynamic options without scripts** — `optionsSource` declares where choice
|
|
31
|
+
lists come from (`remote` URL or a host-registered named `provider`,
|
|
32
|
+
with `refreshOn` reactivity). Stored code is never evaluated.
|
|
33
|
+
- **Importers/exporters** — pluggable `FormImporter` contract; ships with a
|
|
34
|
+
`legacy` importer for the components-tree dialect and a matching exporter
|
|
35
|
+
with idempotent round-trip.
|
|
36
|
+
|
|
37
|
+
Rendering layers: [`@mosaicoo/form-angular`](https://www.npmjs.com/package/@mosaicoo/form-angular).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { BaseField, Condition, ContainerField, FieldDataType, FieldKind, FieldNode, FieldOption, FormSchema, FormSettings, InputField, OptionsProviderFn, OptionsProviderRegistry, OptionsRequest, OptionsSource, StaticField, ValidatorSpec, } from './schema/types.js';
|
|
2
|
+
export { collectInputs, findByPath, walkSchema, type WalkEntry } from './schema/walk.js';
|
|
3
|
+
export { createFormEngine, evaluateCondition, FormEngine, type EngineEvent, type EngineOptions, type SubmitResult, } from './state/engine.js';
|
|
4
|
+
export { defaultMessageResolver, isEmptyValue, validateFieldValue, type CustomValidatorFn, type FieldError, type MessageResolver, type ValidatorRegistry, } from './validation/validate.js';
|
|
5
|
+
export { ImportError, importForm, isFormSchema, type FormImporter, type ImportResult, type ImportWarning, } from './interop/importer.js';
|
|
6
|
+
export { createLegacyImporter, LegacyImporter } from './interop/legacy/legacy-importer.js';
|
|
7
|
+
export { exportLegacyForm, exportLegacyFormJson } from './interop/legacy/legacy-exporter.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { collectInputs, findByPath, walkSchema } from './schema/walk.js';
|
|
2
|
+
// Engine
|
|
3
|
+
export { createFormEngine, evaluateCondition, FormEngine, } from './state/engine.js';
|
|
4
|
+
// Validation
|
|
5
|
+
export { defaultMessageResolver, isEmptyValue, validateFieldValue, } from './validation/validate.js';
|
|
6
|
+
// Interop
|
|
7
|
+
export { ImportError, importForm, isFormSchema, } from './interop/importer.js';
|
|
8
|
+
export { createLegacyImporter, LegacyImporter } from './interop/legacy/legacy-importer.js';
|
|
9
|
+
export { exportLegacyForm, exportLegacyFormJson } from './interop/legacy/legacy-exporter.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAEzF,SAAS;AACT,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GAIX,MAAM,mBAAmB,CAAC;AAE3B,aAAa;AACb,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,GAKnB,MAAM,0BAA0B,CAAC;AAElC,UAAU;AACV,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,GAIb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FormSchema } from '../schema/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Importers convert form definitions from other ecosystems into the
|
|
4
|
+
* Mosaicoo Form schema. They are pluggable: the engine only depends on this
|
|
5
|
+
* contract, and each source format ships as its own importer.
|
|
6
|
+
*/
|
|
7
|
+
export interface ImportWarning {
|
|
8
|
+
/** Machine-readable code, e.g. `unknown-type`, `unsupported-feature`. */
|
|
9
|
+
code: string;
|
|
10
|
+
/** Human-readable explanation. */
|
|
11
|
+
message: string;
|
|
12
|
+
/** Source-side locator (key/path of the offending definition), if any. */
|
|
13
|
+
source?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ImportResult {
|
|
16
|
+
schema: FormSchema;
|
|
17
|
+
/** Non-fatal degradations applied during conversion. */
|
|
18
|
+
warnings: ImportWarning[];
|
|
19
|
+
}
|
|
20
|
+
export interface FormImporter {
|
|
21
|
+
/** Unique importer id, e.g. `legacy`. */
|
|
22
|
+
readonly id: string;
|
|
23
|
+
/** Cheap structural sniff — used to auto-select an importer. */
|
|
24
|
+
canImport(input: unknown): boolean;
|
|
25
|
+
/** Converts the input. Throws `ImportError` only on unusable input. */
|
|
26
|
+
import(input: unknown): ImportResult;
|
|
27
|
+
}
|
|
28
|
+
export declare class ImportError extends Error {
|
|
29
|
+
readonly importerId?: string | undefined;
|
|
30
|
+
constructor(message: string, importerId?: string | undefined);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Runs the first importer whose `canImport` accepts the input.
|
|
34
|
+
* Inputs that already look like a Mosaicoo Form schema pass through as-is.
|
|
35
|
+
*/
|
|
36
|
+
export declare function importForm(input: unknown, importers: FormImporter[]): ImportResult;
|
|
37
|
+
export declare function isFormSchema(input: unknown): input is FormSchema;
|
|
38
|
+
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../src/interop/importer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,wDAAwD;IACxD,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IACnC,uEAAuE;IACvE,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAAC;CACtC;AAED,qBAAa,WAAY,SAAQ,KAAK;IAGlC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM;gBAD5B,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,EAAE,MAAM,YAAA;CAK/B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,YAAY,EAAE,GACxB,YAAY,CAQd;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOhE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class ImportError extends Error {
|
|
2
|
+
importerId;
|
|
3
|
+
constructor(message, importerId) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.importerId = importerId;
|
|
6
|
+
this.name = 'ImportError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Runs the first importer whose `canImport` accepts the input.
|
|
11
|
+
* Inputs that already look like a Mosaicoo Form schema pass through as-is.
|
|
12
|
+
*/
|
|
13
|
+
export function importForm(input, importers) {
|
|
14
|
+
if (isFormSchema(input)) {
|
|
15
|
+
return { schema: input, warnings: [] };
|
|
16
|
+
}
|
|
17
|
+
for (const importer of importers) {
|
|
18
|
+
if (importer.canImport(input))
|
|
19
|
+
return importer.import(input);
|
|
20
|
+
}
|
|
21
|
+
throw new ImportError('No importer recognized the given form definition.');
|
|
22
|
+
}
|
|
23
|
+
export function isFormSchema(input) {
|
|
24
|
+
return (typeof input === 'object' &&
|
|
25
|
+
input !== null &&
|
|
26
|
+
input.version === 1 &&
|
|
27
|
+
Array.isArray(input.fields));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.js","sourceRoot":"","sources":["../../src/interop/importer.ts"],"names":[],"mappings":"AAgCA,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGzB;IAFX,YACE,OAAe,EACN,UAAmB;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,eAAU,GAAV,UAAU,CAAS;QAG5B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,KAAc,EACd,SAAyB;IAEzB,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;YAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,IAAI,WAAW,CAAC,mDAAmD,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAoB,CAAC,OAAO,KAAK,CAAC;QACnC,KAAK,CAAC,OAAO,CAAE,KAAoB,CAAC,MAAM,CAAC,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FormSchema } from '../../schema/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Exports a Mosaicoo Form schema back to the legacy components-tree dialect,
|
|
4
|
+
* so definitions edited here remain consumable by the previous rendering
|
|
5
|
+
* stack during the transition. The export covers everything the schema
|
|
6
|
+
* models; source details outside the schema (kept only in importer warnings)
|
|
7
|
+
* are not resurrected.
|
|
8
|
+
*/
|
|
9
|
+
type LegacyObject = Record<string, unknown>;
|
|
10
|
+
export declare function exportLegacyForm(schema: FormSchema): LegacyObject;
|
|
11
|
+
/** Convenience: JSON string form, ready to persist. */
|
|
12
|
+
export declare function exportLegacyFormJson(schema: FormSchema): string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=legacy-exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-exporter.d.ts","sourceRoot":"","sources":["../../../src/interop/legacy/legacy-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,UAAU,EAIX,MAAM,uBAAuB,CAAC;AAE/B;;;;;;GAMG;AAEH,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwB5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,CAOjE;AAED,uDAAuD;AACvD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAE/D"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/** Inverse of the importer's input type map. */
|
|
2
|
+
const TYPE_MAP = {
|
|
3
|
+
text: 'textfield',
|
|
4
|
+
textarea: 'textarea',
|
|
5
|
+
number: 'number',
|
|
6
|
+
password: 'password',
|
|
7
|
+
email: 'email',
|
|
8
|
+
phone: 'phoneNumber',
|
|
9
|
+
url: 'url',
|
|
10
|
+
currency: 'currency',
|
|
11
|
+
checkbox: 'checkbox',
|
|
12
|
+
'checkbox-group': 'selectboxes',
|
|
13
|
+
select: 'select',
|
|
14
|
+
radio: 'radio',
|
|
15
|
+
datetime: 'datetime',
|
|
16
|
+
day: 'day',
|
|
17
|
+
time: 'time',
|
|
18
|
+
hidden: 'hidden',
|
|
19
|
+
tags: 'tags',
|
|
20
|
+
file: 'file',
|
|
21
|
+
};
|
|
22
|
+
export function exportLegacyForm(schema) {
|
|
23
|
+
return {
|
|
24
|
+
display: schema.settings?.display ?? 'form',
|
|
25
|
+
...(schema.name ? { name: schema.name } : {}),
|
|
26
|
+
...(schema.title ? { title: schema.title } : {}),
|
|
27
|
+
components: schema.fields.map(exportNode),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Convenience: JSON string form, ready to persist. */
|
|
31
|
+
export function exportLegacyFormJson(schema) {
|
|
32
|
+
return JSON.stringify(exportLegacyForm(schema));
|
|
33
|
+
}
|
|
34
|
+
function exportNode(node) {
|
|
35
|
+
if (node.kind === 'static')
|
|
36
|
+
return exportStatic(node);
|
|
37
|
+
if (node.kind === 'container')
|
|
38
|
+
return exportContainer(node);
|
|
39
|
+
return exportInput(node);
|
|
40
|
+
}
|
|
41
|
+
function common(node) {
|
|
42
|
+
return {
|
|
43
|
+
key: node.key,
|
|
44
|
+
...(node.label ? { label: node.label } : {}),
|
|
45
|
+
...(node.description ? { description: node.description } : {}),
|
|
46
|
+
...(node.tooltip ? { tooltip: node.tooltip } : {}),
|
|
47
|
+
...(node.hidden ? { hidden: true } : {}),
|
|
48
|
+
...(node.disabled ? { disabled: true } : {}),
|
|
49
|
+
...(node.conditional ? { conditional: exportCondition(node.conditional) } : {}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function exportCondition(condition) {
|
|
53
|
+
// The legacy dialect only expresses `eq`; `neq` inverts through `show`.
|
|
54
|
+
return {
|
|
55
|
+
show: condition.op === 'neq' ? !condition.show : condition.show,
|
|
56
|
+
when: condition.field,
|
|
57
|
+
eq: condition.value,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function exportStatic(node) {
|
|
61
|
+
if (node.type === 'button') {
|
|
62
|
+
return {
|
|
63
|
+
type: 'button',
|
|
64
|
+
...common(node),
|
|
65
|
+
action: String(node.props?.['action'] ?? 'submit'),
|
|
66
|
+
input: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
type: 'htmlelement',
|
|
71
|
+
...common(node),
|
|
72
|
+
html: node.content ?? '',
|
|
73
|
+
input: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function exportContainer(node) {
|
|
77
|
+
const base = common(node);
|
|
78
|
+
delete base['label'];
|
|
79
|
+
if (node.type === 'columns' && node.columns?.length) {
|
|
80
|
+
return {
|
|
81
|
+
type: 'columns',
|
|
82
|
+
...base,
|
|
83
|
+
columns: node.columns.map((column) => ({
|
|
84
|
+
width: column.width,
|
|
85
|
+
components: column.children
|
|
86
|
+
.map((index) => node.children[index])
|
|
87
|
+
.filter((child) => child !== undefined)
|
|
88
|
+
.map(exportNode),
|
|
89
|
+
})),
|
|
90
|
+
input: false,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (node.type === 'tabs') {
|
|
94
|
+
return {
|
|
95
|
+
type: 'tabs',
|
|
96
|
+
...base,
|
|
97
|
+
components: node.children.map((tab) => ({
|
|
98
|
+
key: tab.key,
|
|
99
|
+
...(tab.label ? { label: tab.label } : {}),
|
|
100
|
+
components: tab.kind === 'container' ? tab.children.map(exportNode) : [exportNode(tab)],
|
|
101
|
+
})),
|
|
102
|
+
input: false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (node.dataScope === 'array') {
|
|
106
|
+
return {
|
|
107
|
+
type: 'datagrid',
|
|
108
|
+
...base,
|
|
109
|
+
...(node.label ? { label: node.label } : {}),
|
|
110
|
+
...(node.defaultRows ? { defaultValue: node.defaultRows } : {}),
|
|
111
|
+
components: node.children.map(exportNode),
|
|
112
|
+
input: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (node.dataScope === 'nested') {
|
|
116
|
+
return {
|
|
117
|
+
type: 'container',
|
|
118
|
+
...base,
|
|
119
|
+
...(node.label ? { label: node.label } : {}),
|
|
120
|
+
components: node.children.map(exportNode),
|
|
121
|
+
input: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// Layout containers: panel keeps its label as `title`, fieldset as `legend`.
|
|
125
|
+
return {
|
|
126
|
+
type: node.type === 'fieldset' ? 'fieldset' : 'panel',
|
|
127
|
+
...base,
|
|
128
|
+
...(node.label
|
|
129
|
+
? node.type === 'fieldset'
|
|
130
|
+
? { legend: node.label }
|
|
131
|
+
: { title: node.label }
|
|
132
|
+
: {}),
|
|
133
|
+
components: node.children.map(exportNode),
|
|
134
|
+
input: false,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function exportInput(node) {
|
|
138
|
+
const out = {
|
|
139
|
+
type: TYPE_MAP[node.type] ?? String(node.props?.['sourceType'] ?? 'textfield'),
|
|
140
|
+
...common(node),
|
|
141
|
+
input: true,
|
|
142
|
+
};
|
|
143
|
+
if (node.placeholder)
|
|
144
|
+
out['placeholder'] = node.placeholder;
|
|
145
|
+
if (node.defaultValue !== undefined)
|
|
146
|
+
out['defaultValue'] = node.defaultValue;
|
|
147
|
+
if (node.multiple)
|
|
148
|
+
out['multiple'] = true;
|
|
149
|
+
const validate = exportValidators(node.validators ?? [], node.type);
|
|
150
|
+
if (Object.keys(validate).length > 0)
|
|
151
|
+
out['validate'] = validate;
|
|
152
|
+
const props = node.props ?? {};
|
|
153
|
+
if (props['prefix'])
|
|
154
|
+
out['prefix'] = props['prefix'];
|
|
155
|
+
if (props['suffix'])
|
|
156
|
+
out['suffix'] = props['suffix'];
|
|
157
|
+
if (typeof props['rows'] === 'number')
|
|
158
|
+
out['rows'] = props['rows'];
|
|
159
|
+
if (typeof props['valueScript'] === 'string') {
|
|
160
|
+
out['customDefaultValue'] = props['valueScript'];
|
|
161
|
+
}
|
|
162
|
+
exportOptions(node, out);
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
function exportValidators(specs, fieldType) {
|
|
166
|
+
const validate = {};
|
|
167
|
+
for (const spec of specs) {
|
|
168
|
+
switch (spec.type) {
|
|
169
|
+
case 'required':
|
|
170
|
+
validate['required'] = true;
|
|
171
|
+
break;
|
|
172
|
+
case 'minLength':
|
|
173
|
+
validate['minLength'] = spec.value;
|
|
174
|
+
break;
|
|
175
|
+
case 'maxLength':
|
|
176
|
+
validate['maxLength'] = spec.value;
|
|
177
|
+
break;
|
|
178
|
+
case 'pattern':
|
|
179
|
+
validate['pattern'] = spec.value;
|
|
180
|
+
break;
|
|
181
|
+
case 'min':
|
|
182
|
+
validate['min'] = spec.value;
|
|
183
|
+
break;
|
|
184
|
+
case 'max':
|
|
185
|
+
validate['max'] = spec.value;
|
|
186
|
+
break;
|
|
187
|
+
case 'email':
|
|
188
|
+
// Implicit in the legacy `email` type; nothing to emit there.
|
|
189
|
+
if (fieldType !== 'email')
|
|
190
|
+
validate['pattern'] = '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$';
|
|
191
|
+
break;
|
|
192
|
+
case 'custom':
|
|
193
|
+
break; // host-registered validators have no legacy equivalent
|
|
194
|
+
}
|
|
195
|
+
if ('message' in spec && spec.message)
|
|
196
|
+
validate['customMessage'] = spec.message;
|
|
197
|
+
}
|
|
198
|
+
return validate;
|
|
199
|
+
}
|
|
200
|
+
function exportOptions(node, out) {
|
|
201
|
+
const source = node.optionsSource;
|
|
202
|
+
if (source?.type === 'provider') {
|
|
203
|
+
out['dataSrc'] = 'custom';
|
|
204
|
+
const script = node.props?.['optionsScript'];
|
|
205
|
+
out['data'] = {
|
|
206
|
+
custom: typeof script === 'string'
|
|
207
|
+
? script
|
|
208
|
+
: `/* options served by host provider "${source.name}" */ values = [];`,
|
|
209
|
+
};
|
|
210
|
+
if (source.refreshOn)
|
|
211
|
+
out['refreshOn'] = source.refreshOn;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (source?.type === 'remote') {
|
|
215
|
+
out['dataSrc'] = 'url';
|
|
216
|
+
out['data'] = { url: source.url };
|
|
217
|
+
if (source.valueKey)
|
|
218
|
+
out['valueProperty'] = source.valueKey;
|
|
219
|
+
if (source.refreshOn)
|
|
220
|
+
out['refreshOn'] = source.refreshOn;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (!node.options || node.options.length === 0)
|
|
224
|
+
return;
|
|
225
|
+
const values = node.options.map((option) => ({ label: option.label, value: option.value }));
|
|
226
|
+
if (node.type === 'select') {
|
|
227
|
+
out['dataSrc'] = 'values';
|
|
228
|
+
out['data'] = { values };
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
out['values'] = values;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=legacy-exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-exporter.js","sourceRoot":"","sources":["../../../src/interop/legacy/legacy-exporter.ts"],"names":[],"mappings":"AAoBA,gDAAgD;AAChD,MAAM,QAAQ,GAA2B;IACvC,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,aAAa;IACpB,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;IACpB,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IAAI,MAAM,CAAC,SAAS;YAAE,GAAG,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;QAC1D,OAAO;IACT,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5F,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,GAAG,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;QAC1B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FormImporter, ImportResult } from '../importer.js';
|
|
2
|
+
export declare class LegacyImporter implements FormImporter {
|
|
3
|
+
readonly id = "legacy";
|
|
4
|
+
canImport(input: unknown): boolean;
|
|
5
|
+
import(input: unknown): ImportResult;
|
|
6
|
+
/** Accepts either the raw definition object or its JSON string. */
|
|
7
|
+
private unwrap;
|
|
8
|
+
private convertList;
|
|
9
|
+
private convert;
|
|
10
|
+
/** Shared members: label, description, hidden/disabled, condition, props. */
|
|
11
|
+
private withCommon;
|
|
12
|
+
private convertCondition;
|
|
13
|
+
private convertValidators;
|
|
14
|
+
private convertOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Maps dynamic option sources. Stored scripts are never executed: they
|
|
17
|
+
* become a named provider contract the host fulfills, with the original
|
|
18
|
+
* script preserved (props.optionsScript) for reference during migration.
|
|
19
|
+
*/
|
|
20
|
+
private applyOptionsSource;
|
|
21
|
+
private keyCounter;
|
|
22
|
+
private resolveKey;
|
|
23
|
+
}
|
|
24
|
+
export declare function createLegacyImporter(): FormImporter;
|
|
25
|
+
//# sourceMappingURL=legacy-importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-importer.d.ts","sourceRoot":"","sources":["../../../src/interop/legacy/legacy-importer.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AA4FhF,qBAAa,cAAe,YAAW,YAAY;IACjD,QAAQ,CAAC,EAAE,YAAY;IAEvB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IASlC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY;IAwBpC,mEAAmE;IACnE,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,OAAO;IAwLf,6EAA6E;IAC7E,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IAStB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,UAAU,CAAK;IAEvB,OAAO,CAAC,UAAU;CAoBnB;AAED,wBAAgB,oBAAoB,IAAI,YAAY,CAEnD"}
|