@atscript/ui 0.1.203 → 0.1.205

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.
Files changed (59) hide show
  1. package/dist/form/create-form-def.cjs +52 -21
  2. package/dist/form/create-form-def.d.cts +23 -18
  3. package/dist/form/create-form-def.d.mts +23 -18
  4. package/dist/form/create-form-def.mjs +52 -21
  5. package/dist/form/decimal-format.cjs +9 -11
  6. package/dist/form/decimal-format.mjs +9 -11
  7. package/dist/form/diff.cjs +32 -14
  8. package/dist/form/diff.d.cts +7 -4
  9. package/dist/form/diff.d.mts +7 -4
  10. package/dist/form/diff.mjs +32 -14
  11. package/dist/form/loaded-empty.cjs +56 -0
  12. package/dist/form/loaded-empty.d.cts +25 -0
  13. package/dist/form/loaded-empty.d.mts +25 -0
  14. package/dist/form/loaded-empty.mjs +56 -0
  15. package/dist/form/omit-derived.cjs +38 -0
  16. package/dist/form/omit-derived.d.cts +17 -0
  17. package/dist/form/omit-derived.d.mts +17 -0
  18. package/dist/form/omit-derived.mjs +38 -0
  19. package/dist/form/optional-mode.cjs +85 -0
  20. package/dist/form/optional-mode.d.cts +58 -0
  21. package/dist/form/optional-mode.d.mts +58 -0
  22. package/dist/form/optional-mode.mjs +82 -0
  23. package/dist/form/path-utils.cjs +4 -5
  24. package/dist/form/path-utils.mjs +4 -5
  25. package/dist/form/types.d.cts +15 -14
  26. package/dist/form/types.d.mts +15 -14
  27. package/dist/form/validate.cjs +2 -2
  28. package/dist/form/validate.mjs +2 -2
  29. package/dist/index.cjs +23 -4
  30. package/dist/index.d.cts +7 -3
  31. package/dist/index.d.mts +7 -3
  32. package/dist/index.mjs +10 -6
  33. package/dist/plugin/annotations.cjs +12 -0
  34. package/dist/plugin/annotations.mjs +13 -1
  35. package/dist/plugin/value-help-validation.cjs +25 -1
  36. package/dist/plugin/value-help-validation.mjs +25 -2
  37. package/dist/shared/annotation-keys.cjs +3 -0
  38. package/dist/shared/annotation-keys.d.cts +3 -1
  39. package/dist/shared/annotation-keys.d.mts +3 -1
  40. package/dist/shared/annotation-keys.mjs +3 -1
  41. package/dist/shared/exact-number.cjs +12 -0
  42. package/dist/shared/exact-number.mjs +12 -0
  43. package/dist/shared/meta-cache.cjs +1 -1
  44. package/dist/shared/meta-cache.mjs +1 -1
  45. package/dist/table/create-table-def.cjs +4 -1
  46. package/dist/table/create-table-def.mjs +4 -2
  47. package/dist/table/types.d.cts +23 -16
  48. package/dist/table/types.d.mts +23 -16
  49. package/dist/table/value-kind.cjs +37 -2
  50. package/dist/table/value-kind.d.cts +22 -2
  51. package/dist/table/value-kind.d.mts +22 -2
  52. package/dist/table/value-kind.mjs +36 -3
  53. package/dist/value-help/distinct-client.cjs +5 -4
  54. package/dist/value-help/distinct-client.d.cts +8 -2
  55. package/dist/value-help/distinct-client.d.mts +8 -2
  56. package/dist/value-help/distinct-client.mjs +5 -4
  57. package/dist/value-help/value-help-client.cjs +45 -9
  58. package/dist/value-help/value-help-client.mjs +45 -9
  59. package/package.json +11 -12
@@ -0,0 +1,82 @@
1
+ import { UI_FORM_OPTIONAL_MODE } from "../shared/annotation-keys.mjs";
2
+ import { isArrayField, isObjectField, isTupleField, isUnionField } from "./types.mjs";
3
+ import { getFieldMeta } from "../shared/field-resolver.mjs";
4
+ import { isForeignKey } from "../value-help/extract-ref.mjs";
5
+ import { isExactNumberText } from "../shared/exact-number.mjs";
6
+ //#region src/form/optional-mode.ts
7
+ let defaultOptionalMode = "business";
8
+ /**
9
+ * Set the app-wide {@link TOptionalMode} — call it once at startup, next to
10
+ * `createDefaultTypes()`. A form's `optional-mode` prop and a field's
11
+ * `@ui.form.optionalMode` take precedence. Since 0.1.205.
12
+ */
13
+ function setDefaultOptionalMode(mode) {
14
+ defaultOptionalMode = mode;
15
+ }
16
+ /** The app-wide {@link TOptionalMode}: `"business"` unless {@link setDefaultOptionalMode} set another. Since 0.1.205. */
17
+ function getDefaultOptionalMode() {
18
+ return defaultOptionalMode;
19
+ }
20
+ /**
21
+ * The {@link TOptionalMode} of an optional field: its own
22
+ * `@ui.form.optionalMode` ▸ `formMode` (the form's `optional-mode`) ▸ the
23
+ * app-wide default ▸ `"business"`. An object, array (multiselect and tags
24
+ * included), tuple or union field is always `"technical"`. Since 0.1.205.
25
+ */
26
+ function resolveOptionalMode(field, formMode) {
27
+ if (isObjectField(field) || isArrayField(field) || isTupleField(field) || isUnionField(field)) return "technical";
28
+ const own = getFieldMeta(field.prop, UI_FORM_OPTIONAL_MODE);
29
+ if (own === "business" || own === "technical") return own;
30
+ return formMode ?? defaultOptionalMode;
31
+ }
32
+ /** Field types the default text control renders: an emptied one holds `""`. */
33
+ const TEXT = new Set([
34
+ "text",
35
+ "textarea",
36
+ "password"
37
+ ]);
38
+ const takesEmptyTextCache = /* @__PURE__ */ new WeakMap();
39
+ /** Whether `""` is a valid value of `prop` (no pattern, e-mail, minimum length, `@meta.required`). */
40
+ function takesEmptyText(prop) {
41
+ let takes = takesEmptyTextCache.get(prop);
42
+ if (takes === void 0) {
43
+ takes = prop.validator().validate("", true);
44
+ takesEmptyTextCache.set(prop, takes);
45
+ }
46
+ return takes;
47
+ }
48
+ /**
49
+ * The value an input of `field` writes when the user empties it. `mode` is the
50
+ * field's {@link resolveOptionalMode} (`"business"` when left out); `edit`
51
+ * whether the form edits a stored record (`createFormDef(type, { mode: "edit" })`,
52
+ * `FormDef.edit`; `false` when left out). Both matter for an optional field
53
+ * only. Since 0.1.205.
54
+ *
55
+ * An optional field:
56
+ * - `"technical"`, or a create form: `undefined` — the field is unset again and
57
+ * a create leaves it out, so column defaults apply;
58
+ * - `"business"` on an edit form: its empty value, so a whole-record update
59
+ * clears it too — `false` for a boolean, `""` for text whose type accepts
60
+ * `""`, else `null` (a number, a date, a selection, a reference or foreign
61
+ * key, and text whose type rejects `""`: a pattern, an e-mail, a minimum
62
+ * length, `@meta.required`);
63
+ * - a set-only field (`@db.writeOnly`): always `undefined` — an empty input
64
+ * keeps the stored secret.
65
+ *
66
+ * A required field: `""` for text and a string key, else `null`.
67
+ */
68
+ function emptiedValue(field, opts) {
69
+ const prop = field.prop;
70
+ const dt = prop.type.kind === "" ? prop.type.designType : void 0;
71
+ const key = !!field.valueHelpInfo || field.type === "ref" || isForeignKey(prop);
72
+ const text = TEXT.has(field.type) && !key && !isExactNumberText(prop);
73
+ if (prop.optional) {
74
+ if (opts?.mode === "technical" || !opts?.edit || prop.metadata.has("db.writeOnly")) return;
75
+ if (dt === "boolean") return false;
76
+ return text && takesEmptyText(prop) ? "" : null;
77
+ }
78
+ if (key) return dt === "string" ? "" : null;
79
+ return text ? "" : null;
80
+ }
81
+ //#endregion
82
+ export { emptiedValue, getDefaultOptionalMode, resolveOptionalMode, setDefaultOptionalMode };
@@ -1,6 +1,7 @@
1
1
  const require_annotation_keys = require("../shared/annotation-keys.cjs");
2
2
  const require_field_resolver = require("../shared/field-resolver.cjs");
3
3
  const require_extract_ref = require("../value-help/extract-ref.cjs");
4
+ const require_exact_number = require("../shared/exact-number.cjs");
4
5
  let _atscript_typescript_utils = require("@atscript/typescript/utils");
5
6
  //#region src/form/path-utils.ts
6
7
  /**
@@ -90,6 +91,7 @@ function deleteByPath(obj, path) {
90
91
  function parseStaticDefault(raw, prop) {
91
92
  if (typeof raw !== "string") return raw;
92
93
  if (prop.type.kind === "" && prop.type.designType === "string") return raw;
94
+ if (require_exact_number.isExactNumberText(prop)) return raw;
93
95
  try {
94
96
  return JSON.parse(raw);
95
97
  } catch {
@@ -124,13 +126,10 @@ function createFormValueResolver(data = {}, context = {}) {
124
126
  * canonical zero is the only init that survives a submit-without-edit.
125
127
  * `useAsDecimal` pads the display to the field's effective scale, so the
126
128
  * user sees `0.00` / `0.000` per the `@db.column.precision` annotation.
129
+ * `long → "0"` likewise (its value is integer text; since 0.1.205).
127
130
  */
128
131
  function primitiveInitFallback(prop) {
129
- if (prop.type.kind !== "") return void 0;
130
- switch (prop.type.designType) {
131
- case "decimal": return "0";
132
- default: return;
133
- }
132
+ return require_exact_number.isExactNumberText(prop) ? "0" : void 0;
134
133
  }
135
134
  function createFormData(type, resolver) {
136
135
  const resolve = resolver ?? defaultValueResolver;
@@ -1,6 +1,7 @@
1
1
  import { META_DEFAULT, UI_FORM_FN_VALUE } from "../shared/annotation-keys.mjs";
2
2
  import { resolveFieldProp } from "../shared/field-resolver.mjs";
3
3
  import { isValueHelpPicker } from "../value-help/extract-ref.mjs";
4
+ import { isExactNumberText } from "../shared/exact-number.mjs";
4
5
  import { createDataFromAnnotatedType, detectDiscriminator } from "@atscript/typescript/utils";
5
6
  //#region src/form/path-utils.ts
6
7
  /**
@@ -90,6 +91,7 @@ function deleteByPath(obj, path) {
90
91
  function parseStaticDefault(raw, prop) {
91
92
  if (typeof raw !== "string") return raw;
92
93
  if (prop.type.kind === "" && prop.type.designType === "string") return raw;
94
+ if (isExactNumberText(prop)) return raw;
93
95
  try {
94
96
  return JSON.parse(raw);
95
97
  } catch {
@@ -124,13 +126,10 @@ function createFormValueResolver(data = {}, context = {}) {
124
126
  * canonical zero is the only init that survives a submit-without-edit.
125
127
  * `useAsDecimal` pads the display to the field's effective scale, so the
126
128
  * user sees `0.00` / `0.000` per the `@db.column.precision` annotation.
129
+ * `long → "0"` likewise (its value is integer text; since 0.1.205).
127
130
  */
128
131
  function primitiveInitFallback(prop) {
129
- if (prop.type.kind !== "") return void 0;
130
- switch (prop.type.designType) {
131
- case "decimal": return "0";
132
- default: return;
133
- }
132
+ return isExactNumberText(prop) ? "0" : void 0;
134
133
  }
135
134
  function createFormData(type, resolver) {
136
135
  const resolve = resolver ?? defaultValueResolver;
@@ -68,22 +68,16 @@ interface FormFieldDef {
68
68
  /**
69
69
  * Server-owned field: a server-computed one read from the type metadata
70
70
  * (`@db.column.derived`, `@db.compute`, `@db.compute.host`), a served field
71
- * `CreateFormDefOptions.metaFields` marks (a computed column, a
72
- * `@meta.readonly` field the form never writes) or, in an edit
73
- * form, an update-stamped one (see `CreateFormDefOptions.mode`). Rendered
74
- * read-only, never required, exempt from form validation and never sent by
75
- * `buildFormDiff` (the server drops or overwrites a written value anyway) —
76
- * unless `servedReadonly`. Since 0.1.144.
71
+ * `/meta` marks `readOnly` (`CreateFormDefOptions.metaFields`; since 0.1.205),
72
+ * a field a compiled `@db.view.writable` view declares itself (a join column;
73
+ * since 0.1.204) or, in an edit form, an update-stamped one (see
74
+ * `CreateFormDefOptions.mode`) — unless the form writes it itself (a pick's
75
+ * fill target, `@ui.form.fn.value`, `@ui.form.fn.readonly`). Rendered
76
+ * read-only, never required, exempt from form validation, never sent and
77
+ * never a change (the server drops or overwrites a written value anyway).
78
+ * Since 0.1.144.
77
79
  */
78
80
  derived?: true;
79
- /**
80
- * Set with `derived` on a field `CreateFormDefOptions.metaFields` marks only
81
- * for its served `@meta.readonly`: `buildFormDiff` still sends a changed
82
- * value. The client can't tell a writable view's own field (the server drops
83
- * it from a write) from a table's read-only one that app code may set.
84
- * Since 0.1.203.
85
- */
86
- servedReadonly?: true;
87
81
  /**
88
82
  * The enclosing prop whose `@ui.literalLabel` labels also apply to this
89
83
  * field's values: the array prop of an item field (`flags: boolean[]`) or the
@@ -117,6 +111,13 @@ interface FormDef {
117
111
  * Present on the form's own def only.
118
112
  */
119
113
  served?: true;
114
+ /**
115
+ * Set when the def was built with `createFormDef(type, { mode: "edit" })`:
116
+ * the form edits a stored record. An emptied optional field then holds its
117
+ * empty value (business mode, see `emptiedValue`). Present on the form's
118
+ * own def only. Since 0.1.205.
119
+ */
120
+ edit?: true;
120
121
  }
121
122
  /** One branch of a union type — used by union fields and union array items. */
122
123
  interface FormUnionVariant {
@@ -68,22 +68,16 @@ interface FormFieldDef {
68
68
  /**
69
69
  * Server-owned field: a server-computed one read from the type metadata
70
70
  * (`@db.column.derived`, `@db.compute`, `@db.compute.host`), a served field
71
- * `CreateFormDefOptions.metaFields` marks (a computed column, a
72
- * `@meta.readonly` field the form never writes) or, in an edit
73
- * form, an update-stamped one (see `CreateFormDefOptions.mode`). Rendered
74
- * read-only, never required, exempt from form validation and never sent by
75
- * `buildFormDiff` (the server drops or overwrites a written value anyway) —
76
- * unless `servedReadonly`. Since 0.1.144.
71
+ * `/meta` marks `readOnly` (`CreateFormDefOptions.metaFields`; since 0.1.205),
72
+ * a field a compiled `@db.view.writable` view declares itself (a join column;
73
+ * since 0.1.204) or, in an edit form, an update-stamped one (see
74
+ * `CreateFormDefOptions.mode`) — unless the form writes it itself (a pick's
75
+ * fill target, `@ui.form.fn.value`, `@ui.form.fn.readonly`). Rendered
76
+ * read-only, never required, exempt from form validation, never sent and
77
+ * never a change (the server drops or overwrites a written value anyway).
78
+ * Since 0.1.144.
77
79
  */
78
80
  derived?: true;
79
- /**
80
- * Set with `derived` on a field `CreateFormDefOptions.metaFields` marks only
81
- * for its served `@meta.readonly`: `buildFormDiff` still sends a changed
82
- * value. The client can't tell a writable view's own field (the server drops
83
- * it from a write) from a table's read-only one that app code may set.
84
- * Since 0.1.203.
85
- */
86
- servedReadonly?: true;
87
81
  /**
88
82
  * The enclosing prop whose `@ui.literalLabel` labels also apply to this
89
83
  * field's values: the array prop of an item field (`flags: boolean[]`) or the
@@ -117,6 +111,13 @@ interface FormDef {
117
111
  * Present on the form's own def only.
118
112
  */
119
113
  served?: true;
114
+ /**
115
+ * Set when the def was built with `createFormDef(type, { mode: "edit" })`:
116
+ * the form edits a stored record. An emptied optional field then holds its
117
+ * empty value (business mode, see `emptiedValue`). Present on the form's
118
+ * own def only. Since 0.1.205.
119
+ */
120
+ edit?: true;
120
121
  }
121
122
  /** One branch of a union type — used by union fields and union array items. */
122
123
  interface FormUnionVariant {
@@ -103,8 +103,8 @@ function withoutFk(def) {
103
103
  }
104
104
  /**
105
105
  * The props of the fields `createFormDef` marked `derived`, at any depth — a
106
- * served field the server owns (`metaFields`: a computed column, a
107
- * `@meta.readonly` one the form never writes) or an edit form's
106
+ * served field `/meta` marks `readOnly` (`metaFields`) that the form never
107
+ * writes, a writable view's own field, or an edit form's
108
108
  * update-stamped field (see `CreateFormDefOptions.mode`) carries no annotation
109
109
  * the plugin above could read. The validator matches by prop, so a prop that is also used where
110
110
  * it is not derived (an interface's stamp below a union of several types, too)
@@ -103,8 +103,8 @@ function withoutFk(def) {
103
103
  }
104
104
  /**
105
105
  * The props of the fields `createFormDef` marked `derived`, at any depth — a
106
- * served field the server owns (`metaFields`: a computed column, a
107
- * `@meta.readonly` one the form never writes) or an edit form's
106
+ * served field `/meta` marks `readOnly` (`metaFields`) that the form never
107
+ * writes, a writable view's own field, or an edit form's
108
108
  * update-stamped field (see `CreateFormDefOptions.mode`) carries no annotation
109
109
  * the plugin above could read. The validator matches by prop, so a prop that is also used where
110
110
  * it is not derived (an interface's stamp below a union of several types, too)
package/dist/index.cjs CHANGED
@@ -10,23 +10,27 @@ const require_clone = require("./form/clone.cjs");
10
10
  const require_path_utils = require("./form/path-utils.cjs");
11
11
  const require_skipped_nav = require("./form/skipped-nav.cjs");
12
12
  const require_create_form_def = require("./form/create-form-def.cjs");
13
+ const require_optional_mode = require("./form/optional-mode.cjs");
14
+ const require_loaded_empty = require("./form/loaded-empty.cjs");
13
15
  const require_form_actions = require("./form/form-actions.cjs");
14
16
  const require_dict_paths = require("./value-help/dict-paths.cjs");
15
17
  const require_resolve_options = require("./value-help/resolve-options.cjs");
16
18
  const require_str = require("./shared/str.cjs");
19
+ const require_measurement = require("./form/measurement.cjs");
20
+ const require_value_label = require("./shared/value-label.cjs");
21
+ const require_create_table_def = require("./table/create-table-def.cjs");
22
+ const require_value_kind = require("./table/value-kind.cjs");
17
23
  const require_value_help_client = require("./value-help/value-help-client.cjs");
18
24
  const require_scope = require("./value-help/scope.cjs");
19
25
  const require_options = require("./value-help/options.cjs");
20
26
  const require_distinct_client = require("./value-help/distinct-client.cjs");
21
27
  const require_client_factory = require("./client-factory.cjs");
22
- const require_measurement = require("./form/measurement.cjs");
23
- const require_value_label = require("./shared/value-label.cjs");
24
- const require_create_table_def = require("./table/create-table-def.cjs");
25
28
  const require_meta_cache = require("./shared/meta-cache.cjs");
26
29
  const require_resolve = require("./value-help/resolve.cjs");
27
30
  const require_error_utils = require("./form/error-utils.cjs");
28
31
  const require_validate = require("./form/validate.cjs");
29
32
  const require_diff = require("./form/diff.cjs");
33
+ const require_omit_derived = require("./form/omit-derived.cjs");
30
34
  const require_dirty = require("./form/dirty.cjs");
31
35
  const require_apply = require("./form/apply.cjs");
32
36
  const require_rebase = require("./form/rebase.cjs");
@@ -34,10 +38,10 @@ const require_union_detect = require("./form/union-detect.cjs");
34
38
  const require_grid = require("./form/grid.cjs");
35
39
  const require_labels = require("./form/labels.cjs");
36
40
  const require_decimal_format = require("./form/decimal-format.cjs");
37
- const require_value_kind = require("./table/value-kind.cjs");
38
41
  const require_column_resolver = require("./table/column-resolver.cjs");
39
42
  const require_navigate_href = require("./table/navigate-href.cjs");
40
43
  const require_model_routes = require("./nav/model-routes.cjs");
44
+ let _atscript_db_meta = require("@atscript/db/meta");
41
45
  exports.DB_AMOUNT_CURRENCY = require_annotation_keys.DB_AMOUNT_CURRENCY;
42
46
  exports.DB_AMOUNT_CURRENCY_REF = require_annotation_keys.DB_AMOUNT_CURRENCY_REF;
43
47
  exports.DB_COLUMN_PRECISION = require_annotation_keys.DB_COLUMN_PRECISION;
@@ -92,6 +96,7 @@ exports.UI_FORM_GRID_ROW_SPAN = require_annotation_keys.UI_FORM_GRID_ROW_SPAN;
92
96
  exports.UI_FORM_HIDDEN = require_annotation_keys.UI_FORM_HIDDEN;
93
97
  exports.UI_FORM_HINT = require_annotation_keys.UI_FORM_HINT;
94
98
  exports.UI_FORM_LABEL_SINGULAR = require_annotation_keys.UI_FORM_LABEL_SINGULAR;
99
+ exports.UI_FORM_OPTIONAL_MODE = require_annotation_keys.UI_FORM_OPTIONAL_MODE;
95
100
  exports.UI_FORM_OPTIONS = require_annotation_keys.UI_FORM_OPTIONS;
96
101
  exports.UI_FORM_ORDER = require_annotation_keys.UI_FORM_ORDER;
97
102
  exports.UI_FORM_PLACEHOLDER = require_annotation_keys.UI_FORM_PLACEHOLDER;
@@ -138,7 +143,14 @@ exports.buildFormRebase = require_rebase.buildFormRebase;
138
143
  exports.buildGridClasses = require_grid.buildGridClasses;
139
144
  exports.buildModelRoutes = require_model_routes.buildModelRoutes;
140
145
  exports.buildUnionVariants = require_create_form_def.buildUnionVariants;
146
+ exports.coerceNumericText = require_value_kind.coerceNumericText;
141
147
  exports.collectDirtyPaths = require_dirty.collectDirtyPaths;
148
+ Object.defineProperty(exports, "compareExact", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return _atscript_db_meta.compareExact;
152
+ }
153
+ });
142
154
  exports.createFieldValidator = require_validate.createFieldValidator;
143
155
  exports.createFormData = require_path_utils.createFormData;
144
156
  exports.createFormDef = require_create_form_def.createFormDef;
@@ -152,6 +164,7 @@ exports.defaultResolver = require_field_resolver.defaultResolver;
152
164
  exports.deleteByPath = require_path_utils.deleteByPath;
153
165
  exports.deserializeServedType = require_model_texts.deserializeServedType;
154
166
  exports.detectUnionVariant = require_path_utils.detectUnionVariant;
167
+ exports.emptiedValue = require_optional_mode.emptiedValue;
155
168
  exports.enforceScale = require_decimal_format.enforceScale;
156
169
  exports.escapeRegex = require_str.escapeRegex;
157
170
  exports.extractFieldLiteralOptions = require_extract_literals.extractFieldLiteralOptions;
@@ -168,6 +181,7 @@ exports.getCurrencyDisplayParts = require_decimal_format.getCurrencyDisplayParts
168
181
  exports.getDecimalSeparator = require_decimal_format.getDecimalSeparator;
169
182
  exports.getDeclaredFormActions = require_form_actions.getDeclaredFormActions;
170
183
  exports.getDefaultClientFactory = require_client_factory.getDefaultClientFactory;
184
+ exports.getDefaultOptionalMode = require_optional_mode.getDefaultOptionalMode;
171
185
  exports.getDefaultValidatorPlugins = require_validate.getDefaultValidatorPlugins;
172
186
  exports.getFieldMeta = require_field_resolver.getFieldMeta;
173
187
  exports.getFilterableColumns = require_column_resolver.getFilterableColumns;
@@ -186,6 +200,7 @@ exports.invalidateValueHelpCache = require_value_help_client.invalidateValueHelp
186
200
  exports.isArrayField = require_types.isArrayField;
187
201
  exports.isContainerKind = require_validate.isContainerKind;
188
202
  exports.isFieldHidden = require_field_resolver.isFieldHidden;
203
+ exports.isNumericText = require_value_kind.isNumericText;
189
204
  exports.isObjectField = require_types.isObjectField;
190
205
  exports.isPathDirty = require_dirty.isPathDirty;
191
206
  exports.isPickerDeclined = require_distinct_client.isPickerDeclined;
@@ -199,6 +214,8 @@ exports.joinPath = require_path_utils.joinPath;
199
214
  exports.markServedType = require_model_texts.markServedType;
200
215
  exports.mergeErrorMaps = require_error_utils.mergeErrorMaps;
201
216
  exports.navigateHrefFor = require_navigate_href.navigateHrefFor;
217
+ exports.normalizeLoadedEmpty = require_loaded_empty.normalizeLoadedEmpty;
218
+ exports.omitDerivedFields = require_omit_derived.omitDerivedFields;
202
219
  exports.omitPaths = require_error_utils.omitPaths;
203
220
  exports.omitSkippedNavFields = require_skipped_nav.omitSkippedNavFields;
204
221
  exports.onMetaCacheReset = require_meta_cache.onMetaCacheReset;
@@ -219,6 +236,7 @@ exports.resolveAttrs = require_field_resolver.resolveAttrs;
219
236
  exports.resolveFieldProp = require_field_resolver.resolveFieldProp;
220
237
  exports.resolveFormProp = require_field_resolver.resolveFormProp;
221
238
  exports.resolveGridSpec = require_grid.resolveGridSpec;
239
+ exports.resolveOptionalMode = require_optional_mode.resolveOptionalMode;
222
240
  exports.resolveOptions = require_resolve_options.resolveOptions;
223
241
  exports.resolveSingularLabel = require_labels.resolveSingularLabel;
224
242
  exports.resolveStatic = require_field_resolver.resolveStatic;
@@ -226,6 +244,7 @@ exports.resolveValueHelp = require_resolve.resolveValueHelp;
226
244
  exports.retainMetaEntry = require_meta_cache.retainMetaEntry;
227
245
  exports.setByPath = require_path_utils.setByPath;
228
246
  exports.setDefaultClientFactory = require_client_factory.setDefaultClientFactory;
247
+ exports.setDefaultOptionalMode = require_optional_mode.setDefaultOptionalMode;
229
248
  exports.setDefaultValidatorPlugins = require_validate.setDefaultValidatorPlugins;
230
249
  exports.setMetaCacheIdentity = require_meta_cache.setMetaCacheIdentity;
231
250
  exports.setMetaCacheMaxEntries = require_meta_cache.setMetaCacheMaxEntries;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,9 @@
1
- import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.cjs";
1
+ import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.cjs";
2
2
  import { TFormEntryOptions, ValueHelpInfo } from "./value-help/types.cjs";
3
3
  import { FormArrayFieldDef, FormDef, FormFieldDef, FormObjectFieldDef, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, TFormAction, isArrayField, isObjectField, isTupleField, isUnionField } from "./form/types.cjs";
4
4
  import { CreateFormDefOptions, buildUnionVariants, createFormDef } from "./form/create-form-def.cjs";
5
+ import { TOptionalMode, emptiedValue, getDefaultOptionalMode, resolveOptionalMode, setDefaultOptionalMode } from "./form/optional-mode.cjs";
6
+ import { normalizeLoadedEmpty } from "./form/loaded-empty.cjs";
5
7
  import { FormActionInfo, getDeclaredFormActions } from "./form/form-actions.cjs";
6
8
  import { UserTextT, deserializeServedType, fieldText, isServedType, markServedType, userText } from "./i18n/model-texts.cjs";
7
9
  import { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.cjs";
@@ -24,6 +26,7 @@ import { CloneUnwrap, deepClone } from "./form/clone.cjs";
24
26
  import { FormValidator, TFieldValidatorOptions, TFormValidatorCallOptions, UI_FORM_VALIDATE_ERROR_CODE, createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.cjs";
25
27
  import { FormDiffOptions, FormDiffResult, FormFieldChange, buildFormDiff, deepEqual } from "./form/diff.cjs";
26
28
  import { omitSkippedNavFields } from "./form/skipped-nav.cjs";
29
+ import { omitDerivedFields } from "./form/omit-derived.cjs";
27
30
  import { collectDirtyPaths, isPathDirty } from "./form/dirty.cjs";
28
31
  import { applyFormChanges } from "./form/apply.cjs";
29
32
  import { FormRebaseOptions, FormRebaseResult, buildFormRebase } from "./form/rebase.cjs";
@@ -34,10 +37,11 @@ import { resolveSingularLabel } from "./form/labels.cjs";
34
37
  import { MeasurementInfo, extractMeasurement } from "./form/measurement.cjs";
35
38
  import { CurrencyDisplay, DecimalParts, FormatDecimalOptions, enforceScale, formatDecimalForDisplay, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "./form/decimal-format.cjs";
36
39
  import { createTableDef } from "./table/create-table-def.cjs";
37
- import { NUMERIC_VALUE_KINDS, optionValue } from "./table/value-kind.cjs";
40
+ import { NUMERIC_VALUE_KINDS, coerceNumericText, isNumericText, optionValue } from "./table/value-kind.cjs";
38
41
  import { escapeRegex, str } from "./shared/str.cjs";
39
42
  import { getColumn, getFilterableColumns, getSortableColumns } from "./table/column-resolver.cjs";
40
43
  import { navigateHrefFor } from "./table/navigate-href.cjs";
41
44
  import { TModelRoute, buildModelRoutes } from "./nav/model-routes.cjs";
42
45
  import { ClientLike, TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor } from "@atscript/db-client";
43
- export { type ClientFactory, type ClientFactoryOptions, type ClientLike, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormValidator, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, type UiT, type UiTextParams, type UiTexts, type UiTranslate, type UserTextT, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, type ValueHelpFillWrite, type ValueHelpInfo, type ValueHelpResult, type ValueHelpScope, type ValueHelpSearchOptions, type ValueLabel, type ValueLabelArrangement, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
46
+ import { compareExact } from "@atscript/db/meta";
47
+ export { type ClientFactory, type ClientFactoryOptions, type ClientLike, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormValidator, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TOptionalMode, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, type UiT, type UiTextParams, type UiTexts, type UiTranslate, type UserTextT, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, type ValueHelpFillWrite, type ValueHelpInfo, type ValueHelpResult, type ValueHelpScope, type ValueHelpSearchOptions, type ValueLabel, type ValueLabelArrangement, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, coerceNumericText, collectDirtyPaths, compareExact, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, emptiedValue, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultOptionalMode, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isNumericText, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, normalizeLoadedEmpty, omitDerivedFields, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptionalMode, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultOptionalMode, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,9 @@
1
- import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.mjs";
1
+ import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.mjs";
2
2
  import { TFormEntryOptions, ValueHelpInfo } from "./value-help/types.mjs";
3
3
  import { FormArrayFieldDef, FormDef, FormFieldDef, FormObjectFieldDef, FormTupleFieldDef, FormUnionFieldDef, FormUnionVariant, TFormAction, isArrayField, isObjectField, isTupleField, isUnionField } from "./form/types.mjs";
4
4
  import { CreateFormDefOptions, buildUnionVariants, createFormDef } from "./form/create-form-def.mjs";
5
+ import { TOptionalMode, emptiedValue, getDefaultOptionalMode, resolveOptionalMode, setDefaultOptionalMode } from "./form/optional-mode.mjs";
6
+ import { normalizeLoadedEmpty } from "./form/loaded-empty.mjs";
5
7
  import { FormActionInfo, getDeclaredFormActions } from "./form/form-actions.mjs";
6
8
  import { UserTextT, deserializeServedType, fieldText, isServedType, markServedType, userText } from "./i18n/model-texts.mjs";
7
9
  import { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.mjs";
@@ -24,6 +26,7 @@ import { CloneUnwrap, deepClone } from "./form/clone.mjs";
24
26
  import { FormValidator, TFieldValidatorOptions, TFormValidatorCallOptions, UI_FORM_VALIDATE_ERROR_CODE, createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.mjs";
25
27
  import { FormDiffOptions, FormDiffResult, FormFieldChange, buildFormDiff, deepEqual } from "./form/diff.mjs";
26
28
  import { omitSkippedNavFields } from "./form/skipped-nav.mjs";
29
+ import { omitDerivedFields } from "./form/omit-derived.mjs";
27
30
  import { collectDirtyPaths, isPathDirty } from "./form/dirty.mjs";
28
31
  import { applyFormChanges } from "./form/apply.mjs";
29
32
  import { FormRebaseOptions, FormRebaseResult, buildFormRebase } from "./form/rebase.mjs";
@@ -34,10 +37,11 @@ import { resolveSingularLabel } from "./form/labels.mjs";
34
37
  import { MeasurementInfo, extractMeasurement } from "./form/measurement.mjs";
35
38
  import { CurrencyDisplay, DecimalParts, FormatDecimalOptions, enforceScale, formatDecimalForDisplay, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "./form/decimal-format.mjs";
36
39
  import { createTableDef } from "./table/create-table-def.mjs";
37
- import { NUMERIC_VALUE_KINDS, optionValue } from "./table/value-kind.mjs";
40
+ import { NUMERIC_VALUE_KINDS, coerceNumericText, isNumericText, optionValue } from "./table/value-kind.mjs";
38
41
  import { escapeRegex, str } from "./shared/str.mjs";
39
42
  import { getColumn, getFilterableColumns, getSortableColumns } from "./table/column-resolver.mjs";
40
43
  import { navigateHrefFor } from "./table/navigate-href.mjs";
41
44
  import { TModelRoute, buildModelRoutes } from "./nav/model-routes.mjs";
45
+ import { compareExact } from "@atscript/db/meta";
42
46
  import { ClientLike, TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor } from "@atscript/db-client";
43
- export { type ClientFactory, type ClientFactoryOptions, type ClientLike, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormValidator, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, type UiT, type UiTextParams, type UiTexts, type UiTranslate, type UserTextT, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, type ValueHelpFillWrite, type ValueHelpInfo, type ValueHelpResult, type ValueHelpScope, type ValueHelpSearchOptions, type ValueLabel, type ValueLabelArrangement, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
47
+ export { type ClientFactory, type ClientFactoryOptions, type ClientLike, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormValidator, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TOptionalMode, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, type UiT, type UiTextParams, type UiTexts, type UiTranslate, type UserTextT, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, type ValueHelpFillWrite, type ValueHelpInfo, type ValueHelpResult, type ValueHelpScope, type ValueHelpSearchOptions, type ValueLabel, type ValueLabelArrangement, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, coerceNumericText, collectDirtyPaths, compareExact, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, emptiedValue, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultOptionalMode, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isNumericText, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, normalizeLoadedEmpty, omitDerivedFields, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptionalMode, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultOptionalMode, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.mjs";
1
+ import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.mjs";
2
2
  import { isArrayField, isObjectField, isTupleField, isUnionField } from "./form/types.mjs";
3
3
  import { deserializeServedType, fieldText, isServedType, markServedType, userText } from "./i18n/model-texts.mjs";
4
4
  import { StaticFieldResolver, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.mjs";
@@ -9,23 +9,27 @@ import { deepClone } from "./form/clone.mjs";
9
9
  import { createFormData, createFormValueResolver, deleteByPath, detectUnionVariant, getByPath, joinPath, setByPath } from "./form/path-utils.mjs";
10
10
  import { omitSkippedNavFields } from "./form/skipped-nav.mjs";
11
11
  import { buildUnionVariants, createFormDef } from "./form/create-form-def.mjs";
12
+ import { emptiedValue, getDefaultOptionalMode, resolveOptionalMode, setDefaultOptionalMode } from "./form/optional-mode.mjs";
13
+ import { normalizeLoadedEmpty } from "./form/loaded-empty.mjs";
12
14
  import { getDeclaredFormActions } from "./form/form-actions.mjs";
13
15
  import { valueHelpDictPaths } from "./value-help/dict-paths.mjs";
14
16
  import { optKey, optLabel, optionLabel, parseStaticOptions, resolveOptions } from "./value-help/resolve-options.mjs";
15
17
  import { escapeRegex, str } from "./shared/str.mjs";
18
+ import { extractMeasurement } from "./form/measurement.mjs";
19
+ import { arrangeText, valueLabelOf } from "./shared/value-label.mjs";
20
+ import { createTableDef } from "./table/create-table-def.mjs";
21
+ import { NUMERIC_VALUE_KINDS, coerceNumericText, isNumericText, optionValue } from "./table/value-kind.mjs";
16
22
  import { ValueHelpClient, invalidateValueHelpCache, setValueHelpCacheTtl, valueHelpSelect } from "./value-help/value-help-client.mjs";
17
23
  import { valueHelpFills, valueHelpScope } from "./value-help/scope.mjs";
18
24
  import { VALUE_HELP_OPTIONS_CAP, valueHelpOptions } from "./value-help/options.mjs";
19
25
  import { fetchDistinctValues, isPickerDeclined } from "./value-help/distinct-client.mjs";
20
26
  import { getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.mjs";
21
- import { extractMeasurement } from "./form/measurement.mjs";
22
- import { arrangeText, valueLabelOf } from "./shared/value-label.mjs";
23
- import { createTableDef } from "./table/create-table-def.mjs";
24
27
  import { createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.mjs";
25
28
  import { resetValueHelpCache, resolveValueHelp } from "./value-help/resolve.mjs";
26
29
  import { FORM_ERROR_KEY, buildDescendantErrorCounts, iteratePathAncestors, mergeErrorMaps, omitPaths, validatorErrorsToMap } from "./form/error-utils.mjs";
27
30
  import { UI_FORM_VALIDATE_ERROR_CODE, createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.mjs";
28
31
  import { buildFormDiff, deepEqual } from "./form/diff.mjs";
32
+ import { omitDerivedFields } from "./form/omit-derived.mjs";
29
33
  import { collectDirtyPaths, isPathDirty } from "./form/dirty.mjs";
30
34
  import { applyFormChanges } from "./form/apply.mjs";
31
35
  import { buildFormRebase } from "./form/rebase.mjs";
@@ -33,8 +37,8 @@ import { unionVariantChanged } from "./form/union-detect.mjs";
33
37
  import { DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, buildGridClasses, parseColSpan, parseRowSpan, resolveGridSpec } from "./form/grid.mjs";
34
38
  import { resolveSingularLabel } from "./form/labels.mjs";
35
39
  import { enforceScale, formatDecimalForDisplay, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "./form/decimal-format.mjs";
36
- import { NUMERIC_VALUE_KINDS, optionValue } from "./table/value-kind.mjs";
37
40
  import { getColumn, getFilterableColumns, getSortableColumns } from "./table/column-resolver.mjs";
38
41
  import { navigateHrefFor } from "./table/navigate-href.mjs";
39
42
  import { buildModelRoutes } from "./nav/model-routes.mjs";
40
- export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, NUMERIC_VALUE_KINDS, StaticFieldResolver, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
43
+ import { compareExact } from "@atscript/db/meta";
44
+ export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, NUMERIC_VALUE_KINDS, StaticFieldResolver, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONAL_MODE, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FILL, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, UI_VALUE_LABEL, VALUE_HELP_OPTIONS_CAP, ValueHelpClient, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, arrangeText, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, coerceNumericText, collectDirtyPaths, compareExact, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, deserializeServedType, detectUnionVariant, emptiedValue, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, fieldText, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultOptionalMode, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isNumericText, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isServedType, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, markServedType, mergeErrorMaps, navigateHrefFor, normalizeLoadedEmpty, omitDerivedFields, omitPaths, omitSkippedNavFields, onMetaCacheReset, onUiLocaleChange, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptionalMode, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultOptionalMode, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, userText, validatorErrorsToMap, valueHelpDictPaths, valueHelpFills, valueHelpOptions, valueHelpScope, valueHelpSelect, valueLabelOf };
@@ -192,6 +192,18 @@ const uiAnnotations = { ui: {
192
192
  nodeType: ["prop", "type"],
193
193
  passedWhenReferred: false
194
194
  }),
195
+ optionalMode: new _atscript_core.AnnotationSpec({
196
+ description: "How the form offers this optional field (`name?: T`), whatever the form's own mode (`<AsForm optional-mode>`, `setDefaultOptionalMode`).\n\n- `'business'` (the default): a plain input, as for a required field — no unset ×, no \"Not set\" placeholder. Left untouched the field stays unset; emptied on an edit form it holds its empty value (`''`, `null` or `false`).\n- `'technical'`: the tri-state — \"Not set\" until the user switches the field on, an unset × while it holds a value.\n\nOptional objects, arrays, tuples and unions always keep their Add / remove controls.\n\n**Example:**\n```atscript\n@ui.form.optionalMode 'technical'\ndiscount?: number\n```",
197
+ nodeType: ["prop"],
198
+ passedWhenReferred: false,
199
+ argument: {
200
+ name: "mode",
201
+ type: "string",
202
+ values: ["business", "technical"],
203
+ description: "`'business'` — a plain input; `'technical'` — the tri-state with \"Not set\" and an unset ×."
204
+ },
205
+ validate: require_value_help_validation.validateOptionalMode
206
+ }),
195
207
  attr: new _atscript_core.AnnotationSpec({
196
208
  description: "Custom attribute or component prop applied to the form input. Repeat for each attr. Passed via v-bind.",
197
209
  nodeType: ["prop", "type"],
@@ -1,4 +1,4 @@
1
- import { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields } from "./value-help-validation.mjs";
1
+ import { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields } from "./value-help-validation.mjs";
2
2
  import { AnnotationSpec } from "@atscript/core";
3
3
  //#region src/plugin/annotations.ts
4
4
  const BUILTIN_TYPES = [
@@ -192,6 +192,18 @@ const uiAnnotations = { ui: {
192
192
  nodeType: ["prop", "type"],
193
193
  passedWhenReferred: false
194
194
  }),
195
+ optionalMode: new AnnotationSpec({
196
+ description: "How the form offers this optional field (`name?: T`), whatever the form's own mode (`<AsForm optional-mode>`, `setDefaultOptionalMode`).\n\n- `'business'` (the default): a plain input, as for a required field — no unset ×, no \"Not set\" placeholder. Left untouched the field stays unset; emptied on an edit form it holds its empty value (`''`, `null` or `false`).\n- `'technical'`: the tri-state — \"Not set\" until the user switches the field on, an unset × while it holds a value.\n\nOptional objects, arrays, tuples and unions always keep their Add / remove controls.\n\n**Example:**\n```atscript\n@ui.form.optionalMode 'technical'\ndiscount?: number\n```",
197
+ nodeType: ["prop"],
198
+ passedWhenReferred: false,
199
+ argument: {
200
+ name: "mode",
201
+ type: "string",
202
+ values: ["business", "technical"],
203
+ description: "`'business'` — a plain input; `'technical'` — the tri-state with \"Not set\" and an unset ×."
204
+ },
205
+ validate: validateOptionalMode
206
+ }),
195
207
  attr: new AnnotationSpec({
196
208
  description: "Custom attribute or component prop applied to the form input. Repeat for each attr. Passed via v-bind.",
197
209
  nodeType: ["prop", "type"],