@atscript/ui 0.1.163 → 0.1.164
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/client-factory.cjs +27 -0
- package/dist/client-factory.d.cts +53 -0
- package/dist/client-factory.d.mts +53 -0
- package/dist/client-factory.mjs +25 -0
- package/dist/form/apply.cjs +38 -0
- package/dist/form/apply.d.cts +36 -0
- package/dist/form/apply.d.mts +36 -0
- package/dist/form/apply.mjs +38 -0
- package/dist/form/clone.cjs +30 -0
- package/dist/form/clone.d.cts +23 -0
- package/dist/form/clone.d.mts +23 -0
- package/dist/form/clone.mjs +30 -0
- package/dist/form/create-form-def.cjs +440 -0
- package/dist/form/create-form-def.d.cts +67 -0
- package/dist/form/create-form-def.d.mts +67 -0
- package/dist/form/create-form-def.mjs +438 -0
- package/dist/form/decimal-format.cjs +324 -0
- package/dist/form/decimal-format.d.cts +86 -0
- package/dist/form/decimal-format.d.mts +86 -0
- package/dist/form/decimal-format.mjs +315 -0
- package/dist/form/diff.cjs +458 -0
- package/dist/form/diff.d.cts +80 -0
- package/dist/form/diff.d.mts +80 -0
- package/dist/form/diff.mjs +457 -0
- package/dist/form/dirty.cjs +65 -0
- package/dist/form/dirty.d.cts +47 -0
- package/dist/form/dirty.d.mts +47 -0
- package/dist/form/dirty.mjs +64 -0
- package/dist/form/error-utils.cjs +97 -0
- package/dist/form/error-utils.d.cts +58 -0
- package/dist/form/error-utils.d.mts +58 -0
- package/dist/form/error-utils.mjs +92 -0
- package/dist/form/form-actions.cjs +30 -0
- package/dist/form/form-actions.d.cts +17 -0
- package/dist/form/form-actions.d.mts +17 -0
- package/dist/form/form-actions.mjs +30 -0
- package/dist/form/grid.cjs +69 -0
- package/dist/form/grid.d.cts +49 -0
- package/dist/form/grid.d.mts +49 -0
- package/dist/form/grid.mjs +64 -0
- package/dist/form/labels.cjs +10 -0
- package/dist/form/labels.d.cts +7 -0
- package/dist/form/labels.d.mts +7 -0
- package/dist/form/labels.mjs +10 -0
- package/dist/form/measurement.cjs +20 -0
- package/dist/form/measurement.d.cts +29 -0
- package/dist/form/measurement.d.mts +29 -0
- package/dist/form/measurement.mjs +20 -0
- package/dist/form/path-utils.cjs +182 -0
- package/dist/form/path-utils.d.cts +47 -0
- package/dist/form/path-utils.d.mts +47 -0
- package/dist/form/path-utils.mjs +175 -0
- package/dist/form/rebase.cjs +89 -0
- package/dist/form/rebase.d.cts +61 -0
- package/dist/form/rebase.d.mts +61 -0
- package/dist/form/rebase.mjs +89 -0
- package/dist/form/skipped-nav.cjs +100 -0
- package/dist/form/skipped-nav.d.cts +13 -0
- package/dist/form/skipped-nav.d.mts +13 -0
- package/dist/form/skipped-nav.mjs +98 -0
- package/dist/form/types.cjs +40 -0
- package/dist/form/types.d.cts +133 -0
- package/dist/form/types.d.mts +133 -0
- package/dist/form/types.mjs +36 -0
- package/dist/form/union-detect.cjs +46 -0
- package/dist/form/union-detect.d.cts +22 -0
- package/dist/form/union-detect.d.mts +22 -0
- package/dist/form/union-detect.mjs +46 -0
- package/dist/form/validate.cjs +150 -0
- package/dist/form/validate.d.cts +50 -0
- package/dist/form/validate.d.mts +50 -0
- package/dist/form/validate.mjs +147 -0
- package/dist/index.cjs +217 -3360
- package/dist/index.d.cts +38 -1693
- package/dist/index.d.mts +38 -1693
- package/dist/index.mjs +35 -3179
- package/dist/nav/model-routes.cjs +59 -0
- package/dist/nav/model-routes.d.cts +33 -0
- package/dist/nav/model-routes.d.mts +33 -0
- package/dist/nav/model-routes.mjs +59 -0
- package/dist/plugin/annotations.cjs +577 -0
- package/dist/plugin/annotations.mjs +577 -0
- package/dist/plugin/primitives.cjs +30 -0
- package/dist/plugin/primitives.mjs +30 -0
- package/dist/plugin/value-help-validation.cjs +419 -0
- package/dist/plugin/value-help-validation.mjs +413 -0
- package/dist/plugin.cjs +4 -1001
- package/dist/plugin.mjs +2 -999
- package/dist/shared/annotation-keys.cjs +189 -0
- package/dist/shared/annotation-keys.d.cts +82 -0
- package/dist/shared/annotation-keys.d.mts +82 -0
- package/dist/shared/annotation-keys.mjs +97 -0
- package/dist/shared/field-resolver.cjs +123 -0
- package/dist/shared/field-resolver.d.cts +77 -0
- package/dist/shared/field-resolver.d.mts +77 -0
- package/dist/shared/field-resolver.mjs +110 -0
- package/dist/shared/meta-cache.cjs +244 -0
- package/dist/shared/meta-cache.d.cts +110 -0
- package/dist/shared/meta-cache.d.mts +110 -0
- package/dist/shared/meta-cache.mjs +237 -0
- package/dist/shared/str.cjs +19 -0
- package/dist/shared/str.d.cts +7 -0
- package/dist/shared/str.d.mts +7 -0
- package/dist/shared/str.mjs +17 -0
- package/dist/table/column-resolver.cjs +17 -0
- package/dist/table/column-resolver.d.cts +11 -0
- package/dist/table/column-resolver.d.mts +11 -0
- package/dist/table/column-resolver.mjs +15 -0
- package/dist/table/create-table-def.cjs +233 -0
- package/dist/table/create-table-def.d.cts +15 -0
- package/dist/table/create-table-def.d.mts +15 -0
- package/dist/table/create-table-def.mjs +233 -0
- package/dist/table/navigate-href.cjs +45 -0
- package/dist/table/navigate-href.d.cts +31 -0
- package/dist/table/navigate-href.d.mts +31 -0
- package/dist/table/navigate-href.mjs +45 -0
- package/dist/table/types.d.cts +287 -0
- package/dist/table/types.d.mts +287 -0
- package/dist/table/value-kind.cjs +20 -0
- package/dist/table/value-kind.d.cts +15 -0
- package/dist/table/value-kind.d.mts +15 -0
- package/dist/table/value-kind.mjs +19 -0
- package/dist/value-help/dict-paths.cjs +17 -0
- package/dist/value-help/dict-paths.d.cts +11 -0
- package/dist/value-help/dict-paths.d.mts +11 -0
- package/dist/value-help/dict-paths.mjs +17 -0
- package/dist/value-help/distinct-client.cjs +51 -0
- package/dist/value-help/distinct-client.d.cts +40 -0
- package/dist/value-help/distinct-client.d.mts +40 -0
- package/dist/value-help/distinct-client.mjs +50 -0
- package/dist/value-help/extract-literals.cjs +76 -0
- package/dist/value-help/extract-literals.d.cts +32 -0
- package/dist/value-help/extract-literals.d.mts +32 -0
- package/dist/value-help/extract-literals.mjs +74 -0
- package/dist/value-help/extract-ref.cjs +100 -0
- package/dist/value-help/extract-ref.d.cts +37 -0
- package/dist/value-help/extract-ref.d.mts +37 -0
- package/dist/value-help/extract-ref.mjs +100 -0
- package/dist/value-help/filter-tree.cjs +45 -0
- package/dist/value-help/filter-tree.mjs +45 -0
- package/dist/value-help/index.d.mts +8 -0
- package/dist/value-help/resolve-options.cjs +64 -0
- package/dist/value-help/resolve-options.d.cts +35 -0
- package/dist/value-help/resolve-options.d.mts +35 -0
- package/dist/value-help/resolve-options.mjs +60 -0
- package/dist/value-help/resolve.cjs +62 -0
- package/dist/value-help/resolve.d.cts +31 -0
- package/dist/value-help/resolve.d.mts +31 -0
- package/dist/value-help/resolve.mjs +61 -0
- package/dist/value-help/types.d.cts +36 -0
- package/dist/value-help/types.d.mts +36 -0
- package/dist/value-help/value-help-client.cjs +136 -0
- package/dist/value-help/value-help-client.d.cts +67 -0
- package/dist/value-help/value-help-client.d.mts +67 -0
- package/dist/value-help/value-help-client.mjs +134 -0
- package/package.json +10 -10
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/form/error-utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic helpers for working with form-error maps keyed by
|
|
4
|
+
* dotted path. Used by AsForm to drive error badges and auto-open
|
|
5
|
+
* collapsed sections; safe to share with React (or any other) bindings.
|
|
6
|
+
*
|
|
7
|
+
* Convention:
|
|
8
|
+
* - Keys are dotted paths (`a.b.c`); empty string and `__form` denote
|
|
9
|
+
* the form-level error.
|
|
10
|
+
* - Values may be `string | undefined`; falsy entries are dropped on
|
|
11
|
+
* merge.
|
|
12
|
+
*/
|
|
13
|
+
/** Error-map key of the form-level error. */
|
|
14
|
+
const FORM_ERROR_KEY = "__form";
|
|
15
|
+
/**
|
|
16
|
+
* Turn a validator's error list into an error map keyed by path. A
|
|
17
|
+
* root-level error (empty path) becomes the form-level error
|
|
18
|
+
* ({@link FORM_ERROR_KEY}). The first error per path wins: a failing
|
|
19
|
+
* container rule is reported before the container's own shape / length
|
|
20
|
+
* checks at the same path.
|
|
21
|
+
*/
|
|
22
|
+
function validatorErrorsToMap(errors) {
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const err of errors) out[err.path || "__form"] ??= err.message;
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Merge any number of partial error maps into a single dense
|
|
29
|
+
* `Record<path, message>`. Falsy values are skipped — later sources do
|
|
30
|
+
* NOT overwrite earlier ones with an empty value.
|
|
31
|
+
*/
|
|
32
|
+
function mergeErrorMaps(...maps) {
|
|
33
|
+
const merged = {};
|
|
34
|
+
for (const m of maps) {
|
|
35
|
+
if (!m) continue;
|
|
36
|
+
for (const k of Object.keys(m)) {
|
|
37
|
+
const v = m[k];
|
|
38
|
+
if (v) merged[k] = v;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return merged;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Return `errors` without the entries whose key is in `paths`.
|
|
45
|
+
*
|
|
46
|
+
* Identity-preserving: when no key matches, the ORIGINAL `errors` object
|
|
47
|
+
* is returned unchanged — callers compare `result !== errors` to detect
|
|
48
|
+
* that something was pruned and skip spurious reactive writes.
|
|
49
|
+
*/
|
|
50
|
+
function omitPaths(errors, paths) {
|
|
51
|
+
let pruned = null;
|
|
52
|
+
for (const key in errors) if (paths.has(key)) {
|
|
53
|
+
pruned ??= { ...errors };
|
|
54
|
+
delete pruned[key];
|
|
55
|
+
}
|
|
56
|
+
return pruned ?? errors;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Yield every ancestor prefix of a dotted path, longest-first
|
|
60
|
+
* (`a.b.c` → `a.b.c`, `a.b`, `a`). Returns the path itself first so
|
|
61
|
+
* callers can include it in the iteration without a special case.
|
|
62
|
+
*
|
|
63
|
+
* Empty paths and the form-level key (`__form`) yield nothing.
|
|
64
|
+
*/
|
|
65
|
+
function* iteratePathAncestors(path) {
|
|
66
|
+
if (!path || path === "__form") return;
|
|
67
|
+
let pos = path.length;
|
|
68
|
+
while (pos > 0) {
|
|
69
|
+
yield path.slice(0, pos);
|
|
70
|
+
const dot = path.lastIndexOf(".", pos - 1);
|
|
71
|
+
if (dot < 0) return;
|
|
72
|
+
pos = dot;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build an indexed `Map<absolutePath, descendantErrorCount>` so each
|
|
77
|
+
* struct in the tree can render an error-count badge in O(1).
|
|
78
|
+
*
|
|
79
|
+
* For every error path, the count is incremented on the path itself
|
|
80
|
+
* AND every dotted-path ancestor — so a struct at `a.b` reports the
|
|
81
|
+
* total of all errors at `a.b` or below.
|
|
82
|
+
*/
|
|
83
|
+
function buildDescendantErrorCounts(errors) {
|
|
84
|
+
const map = /* @__PURE__ */ new Map();
|
|
85
|
+
for (const errPath of Object.keys(errors)) {
|
|
86
|
+
if (!errors[errPath]) continue;
|
|
87
|
+
for (const prefix of iteratePathAncestors(errPath)) map.set(prefix, (map.get(prefix) ?? 0) + 1);
|
|
88
|
+
}
|
|
89
|
+
return map;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.FORM_ERROR_KEY = FORM_ERROR_KEY;
|
|
93
|
+
exports.buildDescendantErrorCounts = buildDescendantErrorCounts;
|
|
94
|
+
exports.iteratePathAncestors = iteratePathAncestors;
|
|
95
|
+
exports.mergeErrorMaps = mergeErrorMaps;
|
|
96
|
+
exports.omitPaths = omitPaths;
|
|
97
|
+
exports.validatorErrorsToMap = validatorErrorsToMap;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/form/error-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic helpers for working with form-error maps keyed by
|
|
4
|
+
* dotted path. Used by AsForm to drive error badges and auto-open
|
|
5
|
+
* collapsed sections; safe to share with React (or any other) bindings.
|
|
6
|
+
*
|
|
7
|
+
* Convention:
|
|
8
|
+
* - Keys are dotted paths (`a.b.c`); empty string and `__form` denote
|
|
9
|
+
* the form-level error.
|
|
10
|
+
* - Values may be `string | undefined`; falsy entries are dropped on
|
|
11
|
+
* merge.
|
|
12
|
+
*/
|
|
13
|
+
/** Error-map key of the form-level error. */
|
|
14
|
+
declare const FORM_ERROR_KEY = "__form";
|
|
15
|
+
/**
|
|
16
|
+
* Turn a validator's error list into an error map keyed by path. A
|
|
17
|
+
* root-level error (empty path) becomes the form-level error
|
|
18
|
+
* ({@link FORM_ERROR_KEY}). The first error per path wins: a failing
|
|
19
|
+
* container rule is reported before the container's own shape / length
|
|
20
|
+
* checks at the same path.
|
|
21
|
+
*/
|
|
22
|
+
declare function validatorErrorsToMap(errors: ReadonlyArray<{
|
|
23
|
+
path: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}>): Record<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Merge any number of partial error maps into a single dense
|
|
28
|
+
* `Record<path, message>`. Falsy values are skipped — later sources do
|
|
29
|
+
* NOT overwrite earlier ones with an empty value.
|
|
30
|
+
*/
|
|
31
|
+
declare function mergeErrorMaps(...maps: Array<Record<string, string | undefined> | undefined>): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Return `errors` without the entries whose key is in `paths`.
|
|
34
|
+
*
|
|
35
|
+
* Identity-preserving: when no key matches, the ORIGINAL `errors` object
|
|
36
|
+
* is returned unchanged — callers compare `result !== errors` to detect
|
|
37
|
+
* that something was pruned and skip spurious reactive writes.
|
|
38
|
+
*/
|
|
39
|
+
declare function omitPaths(errors: Record<string, string>, paths: ReadonlySet<string>): Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Yield every ancestor prefix of a dotted path, longest-first
|
|
42
|
+
* (`a.b.c` → `a.b.c`, `a.b`, `a`). Returns the path itself first so
|
|
43
|
+
* callers can include it in the iteration without a special case.
|
|
44
|
+
*
|
|
45
|
+
* Empty paths and the form-level key (`__form`) yield nothing.
|
|
46
|
+
*/
|
|
47
|
+
declare function iteratePathAncestors(path: string): Generator<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Build an indexed `Map<absolutePath, descendantErrorCount>` so each
|
|
50
|
+
* struct in the tree can render an error-count badge in O(1).
|
|
51
|
+
*
|
|
52
|
+
* For every error path, the count is incremented on the path itself
|
|
53
|
+
* AND every dotted-path ancestor — so a struct at `a.b` reports the
|
|
54
|
+
* total of all errors at `a.b` or below.
|
|
55
|
+
*/
|
|
56
|
+
declare function buildDescendantErrorCounts(errors: Record<string, string | undefined>): Map<string, number>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { FORM_ERROR_KEY, buildDescendantErrorCounts, iteratePathAncestors, mergeErrorMaps, omitPaths, validatorErrorsToMap };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/form/error-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic helpers for working with form-error maps keyed by
|
|
4
|
+
* dotted path. Used by AsForm to drive error badges and auto-open
|
|
5
|
+
* collapsed sections; safe to share with React (or any other) bindings.
|
|
6
|
+
*
|
|
7
|
+
* Convention:
|
|
8
|
+
* - Keys are dotted paths (`a.b.c`); empty string and `__form` denote
|
|
9
|
+
* the form-level error.
|
|
10
|
+
* - Values may be `string | undefined`; falsy entries are dropped on
|
|
11
|
+
* merge.
|
|
12
|
+
*/
|
|
13
|
+
/** Error-map key of the form-level error. */
|
|
14
|
+
declare const FORM_ERROR_KEY = "__form";
|
|
15
|
+
/**
|
|
16
|
+
* Turn a validator's error list into an error map keyed by path. A
|
|
17
|
+
* root-level error (empty path) becomes the form-level error
|
|
18
|
+
* ({@link FORM_ERROR_KEY}). The first error per path wins: a failing
|
|
19
|
+
* container rule is reported before the container's own shape / length
|
|
20
|
+
* checks at the same path.
|
|
21
|
+
*/
|
|
22
|
+
declare function validatorErrorsToMap(errors: ReadonlyArray<{
|
|
23
|
+
path: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}>): Record<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Merge any number of partial error maps into a single dense
|
|
28
|
+
* `Record<path, message>`. Falsy values are skipped — later sources do
|
|
29
|
+
* NOT overwrite earlier ones with an empty value.
|
|
30
|
+
*/
|
|
31
|
+
declare function mergeErrorMaps(...maps: Array<Record<string, string | undefined> | undefined>): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Return `errors` without the entries whose key is in `paths`.
|
|
34
|
+
*
|
|
35
|
+
* Identity-preserving: when no key matches, the ORIGINAL `errors` object
|
|
36
|
+
* is returned unchanged — callers compare `result !== errors` to detect
|
|
37
|
+
* that something was pruned and skip spurious reactive writes.
|
|
38
|
+
*/
|
|
39
|
+
declare function omitPaths(errors: Record<string, string>, paths: ReadonlySet<string>): Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Yield every ancestor prefix of a dotted path, longest-first
|
|
42
|
+
* (`a.b.c` → `a.b.c`, `a.b`, `a`). Returns the path itself first so
|
|
43
|
+
* callers can include it in the iteration without a special case.
|
|
44
|
+
*
|
|
45
|
+
* Empty paths and the form-level key (`__form`) yield nothing.
|
|
46
|
+
*/
|
|
47
|
+
declare function iteratePathAncestors(path: string): Generator<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Build an indexed `Map<absolutePath, descendantErrorCount>` so each
|
|
50
|
+
* struct in the tree can render an error-count badge in O(1).
|
|
51
|
+
*
|
|
52
|
+
* For every error path, the count is incremented on the path itself
|
|
53
|
+
* AND every dotted-path ancestor — so a struct at `a.b` reports the
|
|
54
|
+
* total of all errors at `a.b` or below.
|
|
55
|
+
*/
|
|
56
|
+
declare function buildDescendantErrorCounts(errors: Record<string, string | undefined>): Map<string, number>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { FORM_ERROR_KEY, buildDescendantErrorCounts, iteratePathAncestors, mergeErrorMaps, omitPaths, validatorErrorsToMap };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//#region src/form/error-utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic helpers for working with form-error maps keyed by
|
|
4
|
+
* dotted path. Used by AsForm to drive error badges and auto-open
|
|
5
|
+
* collapsed sections; safe to share with React (or any other) bindings.
|
|
6
|
+
*
|
|
7
|
+
* Convention:
|
|
8
|
+
* - Keys are dotted paths (`a.b.c`); empty string and `__form` denote
|
|
9
|
+
* the form-level error.
|
|
10
|
+
* - Values may be `string | undefined`; falsy entries are dropped on
|
|
11
|
+
* merge.
|
|
12
|
+
*/
|
|
13
|
+
/** Error-map key of the form-level error. */
|
|
14
|
+
const FORM_ERROR_KEY = "__form";
|
|
15
|
+
/**
|
|
16
|
+
* Turn a validator's error list into an error map keyed by path. A
|
|
17
|
+
* root-level error (empty path) becomes the form-level error
|
|
18
|
+
* ({@link FORM_ERROR_KEY}). The first error per path wins: a failing
|
|
19
|
+
* container rule is reported before the container's own shape / length
|
|
20
|
+
* checks at the same path.
|
|
21
|
+
*/
|
|
22
|
+
function validatorErrorsToMap(errors) {
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const err of errors) out[err.path || "__form"] ??= err.message;
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Merge any number of partial error maps into a single dense
|
|
29
|
+
* `Record<path, message>`. Falsy values are skipped — later sources do
|
|
30
|
+
* NOT overwrite earlier ones with an empty value.
|
|
31
|
+
*/
|
|
32
|
+
function mergeErrorMaps(...maps) {
|
|
33
|
+
const merged = {};
|
|
34
|
+
for (const m of maps) {
|
|
35
|
+
if (!m) continue;
|
|
36
|
+
for (const k of Object.keys(m)) {
|
|
37
|
+
const v = m[k];
|
|
38
|
+
if (v) merged[k] = v;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return merged;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Return `errors` without the entries whose key is in `paths`.
|
|
45
|
+
*
|
|
46
|
+
* Identity-preserving: when no key matches, the ORIGINAL `errors` object
|
|
47
|
+
* is returned unchanged — callers compare `result !== errors` to detect
|
|
48
|
+
* that something was pruned and skip spurious reactive writes.
|
|
49
|
+
*/
|
|
50
|
+
function omitPaths(errors, paths) {
|
|
51
|
+
let pruned = null;
|
|
52
|
+
for (const key in errors) if (paths.has(key)) {
|
|
53
|
+
pruned ??= { ...errors };
|
|
54
|
+
delete pruned[key];
|
|
55
|
+
}
|
|
56
|
+
return pruned ?? errors;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Yield every ancestor prefix of a dotted path, longest-first
|
|
60
|
+
* (`a.b.c` → `a.b.c`, `a.b`, `a`). Returns the path itself first so
|
|
61
|
+
* callers can include it in the iteration without a special case.
|
|
62
|
+
*
|
|
63
|
+
* Empty paths and the form-level key (`__form`) yield nothing.
|
|
64
|
+
*/
|
|
65
|
+
function* iteratePathAncestors(path) {
|
|
66
|
+
if (!path || path === "__form") return;
|
|
67
|
+
let pos = path.length;
|
|
68
|
+
while (pos > 0) {
|
|
69
|
+
yield path.slice(0, pos);
|
|
70
|
+
const dot = path.lastIndexOf(".", pos - 1);
|
|
71
|
+
if (dot < 0) return;
|
|
72
|
+
pos = dot;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build an indexed `Map<absolutePath, descendantErrorCount>` so each
|
|
77
|
+
* struct in the tree can render an error-count badge in O(1).
|
|
78
|
+
*
|
|
79
|
+
* For every error path, the count is incremented on the path itself
|
|
80
|
+
* AND every dotted-path ancestor — so a struct at `a.b` reports the
|
|
81
|
+
* total of all errors at `a.b` or below.
|
|
82
|
+
*/
|
|
83
|
+
function buildDescendantErrorCounts(errors) {
|
|
84
|
+
const map = /* @__PURE__ */ new Map();
|
|
85
|
+
for (const errPath of Object.keys(errors)) {
|
|
86
|
+
if (!errors[errPath]) continue;
|
|
87
|
+
for (const prefix of iteratePathAncestors(errPath)) map.set(prefix, (map.get(prefix) ?? 0) + 1);
|
|
88
|
+
}
|
|
89
|
+
return map;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { FORM_ERROR_KEY, buildDescendantErrorCounts, iteratePathAncestors, mergeErrorMaps, omitPaths, validatorErrorsToMap };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_annotation_keys = require("../shared/annotation-keys.cjs");
|
|
2
|
+
const require_field_resolver = require("../shared/field-resolver.cjs");
|
|
3
|
+
//#region src/form/form-actions.ts
|
|
4
|
+
/**
|
|
5
|
+
* Declared actions of a form — the union of `@ui.form.action` ids and
|
|
6
|
+
* `@wf.action.withData` ids across all fields. `withData` distinguishes a
|
|
7
|
+
* data-carrying workflow action (sends the current form payload) from a plain
|
|
8
|
+
* stateless action. Single source of truth for "what actions can a host fire".
|
|
9
|
+
*/
|
|
10
|
+
function getDeclaredFormActions(def) {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const field of def.fields) {
|
|
13
|
+
const withData = require_field_resolver.getFieldMeta(field.prop, require_annotation_keys.WF_ACTION_WITH_DATA);
|
|
14
|
+
if (withData) {
|
|
15
|
+
out.push({
|
|
16
|
+
id: withData,
|
|
17
|
+
withData: true
|
|
18
|
+
});
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const plain = require_field_resolver.getFieldMeta(field.prop, require_annotation_keys.UI_FORM_ACTION);
|
|
22
|
+
if (plain?.id) out.push({
|
|
23
|
+
id: plain.id,
|
|
24
|
+
withData: false
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.getDeclaredFormActions = getDeclaredFormActions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormDef } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/form/form-actions.d.ts
|
|
4
|
+
/** One declared form action: its id and whether it carries form data. */
|
|
5
|
+
interface FormActionInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
withData: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Declared actions of a form — the union of `@ui.form.action` ids and
|
|
11
|
+
* `@wf.action.withData` ids across all fields. `withData` distinguishes a
|
|
12
|
+
* data-carrying workflow action (sends the current form payload) from a plain
|
|
13
|
+
* stateless action. Single source of truth for "what actions can a host fire".
|
|
14
|
+
*/
|
|
15
|
+
declare function getDeclaredFormActions(def: FormDef): FormActionInfo[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FormActionInfo, getDeclaredFormActions };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormDef } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/form/form-actions.d.ts
|
|
4
|
+
/** One declared form action: its id and whether it carries form data. */
|
|
5
|
+
interface FormActionInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
withData: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Declared actions of a form — the union of `@ui.form.action` ids and
|
|
11
|
+
* `@wf.action.withData` ids across all fields. `withData` distinguishes a
|
|
12
|
+
* data-carrying workflow action (sends the current form payload) from a plain
|
|
13
|
+
* stateless action. Single source of truth for "what actions can a host fire".
|
|
14
|
+
*/
|
|
15
|
+
declare function getDeclaredFormActions(def: FormDef): FormActionInfo[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FormActionInfo, getDeclaredFormActions };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UI_FORM_ACTION, WF_ACTION_WITH_DATA } from "../shared/annotation-keys.mjs";
|
|
2
|
+
import { getFieldMeta } from "../shared/field-resolver.mjs";
|
|
3
|
+
//#region src/form/form-actions.ts
|
|
4
|
+
/**
|
|
5
|
+
* Declared actions of a form — the union of `@ui.form.action` ids and
|
|
6
|
+
* `@wf.action.withData` ids across all fields. `withData` distinguishes a
|
|
7
|
+
* data-carrying workflow action (sends the current form payload) from a plain
|
|
8
|
+
* stateless action. Single source of truth for "what actions can a host fire".
|
|
9
|
+
*/
|
|
10
|
+
function getDeclaredFormActions(def) {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const field of def.fields) {
|
|
13
|
+
const withData = getFieldMeta(field.prop, WF_ACTION_WITH_DATA);
|
|
14
|
+
if (withData) {
|
|
15
|
+
out.push({
|
|
16
|
+
id: withData,
|
|
17
|
+
withData: true
|
|
18
|
+
});
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const plain = getFieldMeta(field.prop, UI_FORM_ACTION);
|
|
22
|
+
if (plain?.id) out.push({
|
|
23
|
+
id: plain.id,
|
|
24
|
+
withData: false
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { getDeclaredFormActions };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region src/form/grid.ts
|
|
2
|
+
/** Grid layout parsing for `@ui.form.grid.colSpan` / `@ui.form.grid.rowSpan`. */
|
|
3
|
+
const DEFAULT_COL_SPAN = 12;
|
|
4
|
+
const DEFAULT_ROW_SPAN = 1;
|
|
5
|
+
const COL_SPAN_ALIASES = {
|
|
6
|
+
full: 12,
|
|
7
|
+
half: 6,
|
|
8
|
+
third: 4
|
|
9
|
+
};
|
|
10
|
+
/** Accepts "1"-"12" and the aliases "full" (12), "half" (6), "third" (4). */
|
|
11
|
+
function parseColSpan(raw) {
|
|
12
|
+
if (!raw) return void 0;
|
|
13
|
+
const aliased = COL_SPAN_ALIASES[raw];
|
|
14
|
+
if (aliased !== void 0) return aliased;
|
|
15
|
+
const n = Number.parseInt(raw, 10);
|
|
16
|
+
if (Number.isFinite(n) && n >= 1 && n <= 12 && String(n) === raw) return n;
|
|
17
|
+
}
|
|
18
|
+
/** Accepts numeric strings "1"+; rejects "0", negatives, decimals, aliases. */
|
|
19
|
+
function parseRowSpan(raw) {
|
|
20
|
+
if (!raw) return void 0;
|
|
21
|
+
const n = Number.parseInt(raw, 10);
|
|
22
|
+
if (Number.isFinite(n) && n >= 1 && String(n) === raw) return n;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a field's grid footprint. Narrow defaults to full-width / single-row
|
|
26
|
+
* regardless of the desktop value, so authors can opt into a narrow override
|
|
27
|
+
* via the second annotation arg without it inheriting an unintended desktop span.
|
|
28
|
+
*/
|
|
29
|
+
function resolveGridSpec(colSpan, rowSpan) {
|
|
30
|
+
return {
|
|
31
|
+
col: {
|
|
32
|
+
desktop: parseColSpan(colSpan?.desktop) ?? 12,
|
|
33
|
+
narrow: parseColSpan(colSpan?.narrow) ?? 12
|
|
34
|
+
},
|
|
35
|
+
row: {
|
|
36
|
+
desktop: parseRowSpan(rowSpan?.desktop) ?? 1,
|
|
37
|
+
narrow: parseRowSpan(rowSpan?.narrow) ?? 1
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build the UnoCSS class string for a field's grid footprint.
|
|
43
|
+
*
|
|
44
|
+
* - Skips desktop classes that match the default (`as-grid-item` already
|
|
45
|
+
* covers `col-span-full row-span-1`).
|
|
46
|
+
* - Skips narrow overrides that match the desktop value (no override needed).
|
|
47
|
+
* - The narrow variant uses the custom `as-narrow:` prefix, which the
|
|
48
|
+
* atscript-ui UnoCSS preset rewrites to `@container as-grid (max-width:
|
|
49
|
+
* 480px) { ... }`. The parent grid is registered as
|
|
50
|
+
* `container-name: as-grid` via the `as-form-grid` shortcut, so the
|
|
51
|
+
* rule resolves against the actual grid's inline size — not the viewport.
|
|
52
|
+
*
|
|
53
|
+
* Returned string is space-separated, ready to drop into a Vue class binding.
|
|
54
|
+
*/
|
|
55
|
+
function buildGridClasses(spec) {
|
|
56
|
+
const out = [];
|
|
57
|
+
if (spec.col.desktop !== 12) out.push(`col-span-${spec.col.desktop}`);
|
|
58
|
+
if (spec.row.desktop !== 1) out.push(`row-span-${spec.row.desktop}`);
|
|
59
|
+
if (spec.col.narrow !== spec.col.desktop) out.push(`as-narrow:col-span-${spec.col.narrow}`);
|
|
60
|
+
if (spec.row.narrow !== spec.row.desktop) out.push(`as-narrow:row-span-${spec.row.narrow}`);
|
|
61
|
+
return out.join(" ");
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.DEFAULT_COL_SPAN = DEFAULT_COL_SPAN;
|
|
65
|
+
exports.DEFAULT_ROW_SPAN = DEFAULT_ROW_SPAN;
|
|
66
|
+
exports.buildGridClasses = buildGridClasses;
|
|
67
|
+
exports.parseColSpan = parseColSpan;
|
|
68
|
+
exports.parseRowSpan = parseRowSpan;
|
|
69
|
+
exports.resolveGridSpec = resolveGridSpec;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/form/grid.d.ts
|
|
2
|
+
/** Grid layout parsing for `@ui.form.grid.colSpan` / `@ui.form.grid.rowSpan`. */
|
|
3
|
+
declare const DEFAULT_COL_SPAN = 12;
|
|
4
|
+
declare const DEFAULT_ROW_SPAN = 1;
|
|
5
|
+
/** Accepts "1"-"12" and the aliases "full" (12), "half" (6), "third" (4). */
|
|
6
|
+
declare function parseColSpan(raw: string | undefined): number | undefined;
|
|
7
|
+
/** Accepts numeric strings "1"+; rejects "0", negatives, decimals, aliases. */
|
|
8
|
+
declare function parseRowSpan(raw: string | undefined): number | undefined;
|
|
9
|
+
interface GridSpec {
|
|
10
|
+
col: {
|
|
11
|
+
desktop: number;
|
|
12
|
+
narrow: number;
|
|
13
|
+
};
|
|
14
|
+
row: {
|
|
15
|
+
desktop: number;
|
|
16
|
+
narrow: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Shape returned by `getFieldMeta(prop, UI_FORM_GRID_COL_SPAN | …ROW_SPAN)` —
|
|
21
|
+
* atscript codegen produces a struct from named multi-arg annotation specs.
|
|
22
|
+
*/
|
|
23
|
+
interface GridSpanArgs {
|
|
24
|
+
desktop: string;
|
|
25
|
+
narrow?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a field's grid footprint. Narrow defaults to full-width / single-row
|
|
29
|
+
* regardless of the desktop value, so authors can opt into a narrow override
|
|
30
|
+
* via the second annotation arg without it inheriting an unintended desktop span.
|
|
31
|
+
*/
|
|
32
|
+
declare function resolveGridSpec(colSpan: GridSpanArgs | undefined, rowSpan: GridSpanArgs | undefined): GridSpec;
|
|
33
|
+
/**
|
|
34
|
+
* Build the UnoCSS class string for a field's grid footprint.
|
|
35
|
+
*
|
|
36
|
+
* - Skips desktop classes that match the default (`as-grid-item` already
|
|
37
|
+
* covers `col-span-full row-span-1`).
|
|
38
|
+
* - Skips narrow overrides that match the desktop value (no override needed).
|
|
39
|
+
* - The narrow variant uses the custom `as-narrow:` prefix, which the
|
|
40
|
+
* atscript-ui UnoCSS preset rewrites to `@container as-grid (max-width:
|
|
41
|
+
* 480px) { ... }`. The parent grid is registered as
|
|
42
|
+
* `container-name: as-grid` via the `as-form-grid` shortcut, so the
|
|
43
|
+
* rule resolves against the actual grid's inline size — not the viewport.
|
|
44
|
+
*
|
|
45
|
+
* Returned string is space-separated, ready to drop into a Vue class binding.
|
|
46
|
+
*/
|
|
47
|
+
declare function buildGridClasses(spec: GridSpec): string;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, GridSpanArgs, GridSpec, buildGridClasses, parseColSpan, parseRowSpan, resolveGridSpec };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/form/grid.d.ts
|
|
2
|
+
/** Grid layout parsing for `@ui.form.grid.colSpan` / `@ui.form.grid.rowSpan`. */
|
|
3
|
+
declare const DEFAULT_COL_SPAN = 12;
|
|
4
|
+
declare const DEFAULT_ROW_SPAN = 1;
|
|
5
|
+
/** Accepts "1"-"12" and the aliases "full" (12), "half" (6), "third" (4). */
|
|
6
|
+
declare function parseColSpan(raw: string | undefined): number | undefined;
|
|
7
|
+
/** Accepts numeric strings "1"+; rejects "0", negatives, decimals, aliases. */
|
|
8
|
+
declare function parseRowSpan(raw: string | undefined): number | undefined;
|
|
9
|
+
interface GridSpec {
|
|
10
|
+
col: {
|
|
11
|
+
desktop: number;
|
|
12
|
+
narrow: number;
|
|
13
|
+
};
|
|
14
|
+
row: {
|
|
15
|
+
desktop: number;
|
|
16
|
+
narrow: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Shape returned by `getFieldMeta(prop, UI_FORM_GRID_COL_SPAN | …ROW_SPAN)` —
|
|
21
|
+
* atscript codegen produces a struct from named multi-arg annotation specs.
|
|
22
|
+
*/
|
|
23
|
+
interface GridSpanArgs {
|
|
24
|
+
desktop: string;
|
|
25
|
+
narrow?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a field's grid footprint. Narrow defaults to full-width / single-row
|
|
29
|
+
* regardless of the desktop value, so authors can opt into a narrow override
|
|
30
|
+
* via the second annotation arg without it inheriting an unintended desktop span.
|
|
31
|
+
*/
|
|
32
|
+
declare function resolveGridSpec(colSpan: GridSpanArgs | undefined, rowSpan: GridSpanArgs | undefined): GridSpec;
|
|
33
|
+
/**
|
|
34
|
+
* Build the UnoCSS class string for a field's grid footprint.
|
|
35
|
+
*
|
|
36
|
+
* - Skips desktop classes that match the default (`as-grid-item` already
|
|
37
|
+
* covers `col-span-full row-span-1`).
|
|
38
|
+
* - Skips narrow overrides that match the desktop value (no override needed).
|
|
39
|
+
* - The narrow variant uses the custom `as-narrow:` prefix, which the
|
|
40
|
+
* atscript-ui UnoCSS preset rewrites to `@container as-grid (max-width:
|
|
41
|
+
* 480px) { ... }`. The parent grid is registered as
|
|
42
|
+
* `container-name: as-grid` via the `as-form-grid` shortcut, so the
|
|
43
|
+
* rule resolves against the actual grid's inline size — not the viewport.
|
|
44
|
+
*
|
|
45
|
+
* Returned string is space-separated, ready to drop into a Vue class binding.
|
|
46
|
+
*/
|
|
47
|
+
declare function buildGridClasses(spec: GridSpec): string;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, GridSpanArgs, GridSpec, buildGridClasses, parseColSpan, parseRowSpan, resolveGridSpec };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/form/grid.ts
|
|
2
|
+
/** Grid layout parsing for `@ui.form.grid.colSpan` / `@ui.form.grid.rowSpan`. */
|
|
3
|
+
const DEFAULT_COL_SPAN = 12;
|
|
4
|
+
const DEFAULT_ROW_SPAN = 1;
|
|
5
|
+
const COL_SPAN_ALIASES = {
|
|
6
|
+
full: 12,
|
|
7
|
+
half: 6,
|
|
8
|
+
third: 4
|
|
9
|
+
};
|
|
10
|
+
/** Accepts "1"-"12" and the aliases "full" (12), "half" (6), "third" (4). */
|
|
11
|
+
function parseColSpan(raw) {
|
|
12
|
+
if (!raw) return void 0;
|
|
13
|
+
const aliased = COL_SPAN_ALIASES[raw];
|
|
14
|
+
if (aliased !== void 0) return aliased;
|
|
15
|
+
const n = Number.parseInt(raw, 10);
|
|
16
|
+
if (Number.isFinite(n) && n >= 1 && n <= 12 && String(n) === raw) return n;
|
|
17
|
+
}
|
|
18
|
+
/** Accepts numeric strings "1"+; rejects "0", negatives, decimals, aliases. */
|
|
19
|
+
function parseRowSpan(raw) {
|
|
20
|
+
if (!raw) return void 0;
|
|
21
|
+
const n = Number.parseInt(raw, 10);
|
|
22
|
+
if (Number.isFinite(n) && n >= 1 && String(n) === raw) return n;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a field's grid footprint. Narrow defaults to full-width / single-row
|
|
26
|
+
* regardless of the desktop value, so authors can opt into a narrow override
|
|
27
|
+
* via the second annotation arg without it inheriting an unintended desktop span.
|
|
28
|
+
*/
|
|
29
|
+
function resolveGridSpec(colSpan, rowSpan) {
|
|
30
|
+
return {
|
|
31
|
+
col: {
|
|
32
|
+
desktop: parseColSpan(colSpan?.desktop) ?? 12,
|
|
33
|
+
narrow: parseColSpan(colSpan?.narrow) ?? 12
|
|
34
|
+
},
|
|
35
|
+
row: {
|
|
36
|
+
desktop: parseRowSpan(rowSpan?.desktop) ?? 1,
|
|
37
|
+
narrow: parseRowSpan(rowSpan?.narrow) ?? 1
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build the UnoCSS class string for a field's grid footprint.
|
|
43
|
+
*
|
|
44
|
+
* - Skips desktop classes that match the default (`as-grid-item` already
|
|
45
|
+
* covers `col-span-full row-span-1`).
|
|
46
|
+
* - Skips narrow overrides that match the desktop value (no override needed).
|
|
47
|
+
* - The narrow variant uses the custom `as-narrow:` prefix, which the
|
|
48
|
+
* atscript-ui UnoCSS preset rewrites to `@container as-grid (max-width:
|
|
49
|
+
* 480px) { ... }`. The parent grid is registered as
|
|
50
|
+
* `container-name: as-grid` via the `as-form-grid` shortcut, so the
|
|
51
|
+
* rule resolves against the actual grid's inline size — not the viewport.
|
|
52
|
+
*
|
|
53
|
+
* Returned string is space-separated, ready to drop into a Vue class binding.
|
|
54
|
+
*/
|
|
55
|
+
function buildGridClasses(spec) {
|
|
56
|
+
const out = [];
|
|
57
|
+
if (spec.col.desktop !== 12) out.push(`col-span-${spec.col.desktop}`);
|
|
58
|
+
if (spec.row.desktop !== 1) out.push(`row-span-${spec.row.desktop}`);
|
|
59
|
+
if (spec.col.narrow !== spec.col.desktop) out.push(`as-narrow:col-span-${spec.col.narrow}`);
|
|
60
|
+
if (spec.row.narrow !== spec.row.desktop) out.push(`as-narrow:row-span-${spec.row.narrow}`);
|
|
61
|
+
return out.join(" ");
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, buildGridClasses, parseColSpan, parseRowSpan, resolveGridSpec };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require("../shared/annotation-keys.cjs");
|
|
2
|
+
const require_field_resolver = require("../shared/field-resolver.cjs");
|
|
3
|
+
//#region src/form/labels.ts
|
|
4
|
+
/** Singular label for an array field (used by AsArray for "Add <singular>"). */
|
|
5
|
+
function resolveSingularLabel(meta) {
|
|
6
|
+
if (!meta) return "item";
|
|
7
|
+
return require_field_resolver.getFieldMeta(meta, "ui.form.label.singular") || "item";
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.resolveSingularLabel = resolveSingularLabel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
2
|
+
|
|
3
|
+
//#region src/form/labels.d.ts
|
|
4
|
+
/** Singular label for an array field (used by AsArray for "Add <singular>"). */
|
|
5
|
+
declare function resolveSingularLabel(meta: TAtscriptAnnotatedType | undefined): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { resolveSingularLabel };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
2
|
+
|
|
3
|
+
//#region src/form/labels.d.ts
|
|
4
|
+
/** Singular label for an array field (used by AsArray for "Add <singular>"). */
|
|
5
|
+
declare function resolveSingularLabel(meta: TAtscriptAnnotatedType | undefined): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { resolveSingularLabel };
|