@atscript/ui 0.1.204 → 0.1.206

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 (61) hide show
  1. package/dist/form/create-form-def.cjs +72 -83
  2. package/dist/form/create-form-def.d.cts +32 -22
  3. package/dist/form/create-form-def.d.mts +32 -22
  4. package/dist/form/create-form-def.mjs +73 -84
  5. package/dist/form/db-column.cjs +37 -0
  6. package/dist/form/db-column.mjs +35 -0
  7. package/dist/form/decimal-format.cjs +9 -11
  8. package/dist/form/decimal-format.mjs +9 -11
  9. package/dist/form/diff.cjs +32 -14
  10. package/dist/form/diff.d.cts +7 -4
  11. package/dist/form/diff.d.mts +7 -4
  12. package/dist/form/diff.mjs +32 -14
  13. package/dist/form/loaded-empty.cjs +56 -0
  14. package/dist/form/loaded-empty.d.cts +25 -0
  15. package/dist/form/loaded-empty.d.mts +25 -0
  16. package/dist/form/loaded-empty.mjs +56 -0
  17. package/dist/form/omit-derived.cjs +38 -0
  18. package/dist/form/omit-derived.d.cts +17 -0
  19. package/dist/form/omit-derived.d.mts +17 -0
  20. package/dist/form/omit-derived.mjs +38 -0
  21. package/dist/form/optional-mode.cjs +85 -0
  22. package/dist/form/optional-mode.d.cts +58 -0
  23. package/dist/form/optional-mode.d.mts +58 -0
  24. package/dist/form/optional-mode.mjs +82 -0
  25. package/dist/form/path-utils.cjs +14 -10
  26. package/dist/form/path-utils.mjs +14 -10
  27. package/dist/form/types.d.cts +16 -16
  28. package/dist/form/types.d.mts +16 -16
  29. package/dist/form/validate.cjs +2 -2
  30. package/dist/form/validate.mjs +2 -2
  31. package/dist/index.cjs +23 -4
  32. package/dist/index.d.cts +7 -3
  33. package/dist/index.d.mts +7 -3
  34. package/dist/index.mjs +10 -6
  35. package/dist/plugin/annotations.cjs +12 -0
  36. package/dist/plugin/annotations.mjs +13 -1
  37. package/dist/plugin/value-help-validation.cjs +25 -1
  38. package/dist/plugin/value-help-validation.mjs +25 -2
  39. package/dist/shared/annotation-keys.cjs +3 -0
  40. package/dist/shared/annotation-keys.d.cts +3 -1
  41. package/dist/shared/annotation-keys.d.mts +3 -1
  42. package/dist/shared/annotation-keys.mjs +3 -1
  43. package/dist/shared/exact-number.cjs +12 -0
  44. package/dist/shared/exact-number.mjs +12 -0
  45. package/dist/shared/meta-cache.cjs +1 -1
  46. package/dist/shared/meta-cache.mjs +1 -1
  47. package/dist/table/create-table-def.cjs +4 -1
  48. package/dist/table/create-table-def.mjs +4 -2
  49. package/dist/table/types.d.cts +23 -16
  50. package/dist/table/types.d.mts +23 -16
  51. package/dist/table/value-kind.cjs +37 -2
  52. package/dist/table/value-kind.d.cts +22 -2
  53. package/dist/table/value-kind.d.mts +22 -2
  54. package/dist/table/value-kind.mjs +36 -3
  55. package/dist/value-help/distinct-client.cjs +5 -4
  56. package/dist/value-help/distinct-client.d.cts +8 -2
  57. package/dist/value-help/distinct-client.d.mts +8 -2
  58. package/dist/value-help/distinct-client.mjs +5 -4
  59. package/dist/value-help/value-help-client.cjs +45 -9
  60. package/dist/value-help/value-help-client.mjs +45 -9
  61. package/package.json +11 -12
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"],
@@ -91,7 +91,7 @@ function leafDesign(def) {
91
91
  switch (def.entity) {
92
92
  case "primitive": {
93
93
  const base = (0, _atscript_db_shared.primitiveBaseType)(def);
94
- if (base === "string" || base === "number" || base === "decimal" || base === "boolean") return base;
94
+ if (base === "string" || base === "number" || base === "decimal" || base === "long" || base === "boolean") return base;
95
95
  if (base === "object") return "object";
96
96
  if (base === "array" || base === "tuple") return "array";
97
97
  return base ? "other" : void 0;
@@ -743,6 +743,29 @@ function validateValueLabel(token, args, doc) {
743
743
  return errors;
744
744
  }
745
745
  /**
746
+ * `@ui.form.optionalMode`: a mode of an optional scalar field. An optional
747
+ * object, array, tuple or union (`T | null` included) always keeps its Add /
748
+ * remove controls, so the annotation would do nothing there. Since 0.1.205.
749
+ */
750
+ function validateOptionalMode(token, args, doc) {
751
+ const field = (0, _atscript_db_shared.annotationTarget)(token, doc);
752
+ if (field && (0, _atscript_core.isProp)(field) && !field.has("optional")) return [{
753
+ message: "@ui.form.optionalMode applies to an optional field (name?: T)",
754
+ severity: ERROR,
755
+ range: token.range
756
+ }];
757
+ const leaves = hostLeaves(token.parentNode, doc);
758
+ if (leaves.includes(null)) return [];
759
+ const design = hostDesign(token, doc);
760
+ const union = leaves.length > 1 && !leaves.every((leaf) => leaf.def.entity === "const");
761
+ if (design !== "object" && design !== "array" && !union) return [];
762
+ return [{
763
+ message: "@ui.form.optionalMode applies to a scalar field — optional objects, arrays, tuples and unions keep their Add / remove controls",
764
+ severity: ERROR,
765
+ range: args[0]?.range ?? token.range
766
+ }];
767
+ }
768
+ /**
746
769
  * `@ui.form.type` / `@ui.type`: the free-entry `tags` renderer edits an array —
747
770
  * on any other field it would mount with a scalar value.
748
771
  */
@@ -764,6 +787,7 @@ exports.validateDistinct = validateDistinct;
764
787
  exports.validateFill = validateFill;
765
788
  exports.validateFormType = validateFormType;
766
789
  exports.validateLiteralLabel = validateLiteralLabel;
790
+ exports.validateOptionalMode = validateOptionalMode;
767
791
  exports.validateValueHelp = validateValueHelp;
768
792
  exports.validateValueLabel = validateValueLabel;
769
793
  exports.valueHelpScopes = valueHelpScopes;
@@ -91,7 +91,7 @@ function leafDesign(def) {
91
91
  switch (def.entity) {
92
92
  case "primitive": {
93
93
  const base = primitiveBaseType(def);
94
- if (base === "string" || base === "number" || base === "decimal" || base === "boolean") return base;
94
+ if (base === "string" || base === "number" || base === "decimal" || base === "long" || base === "boolean") return base;
95
95
  if (base === "object") return "object";
96
96
  if (base === "array" || base === "tuple") return "array";
97
97
  return base ? "other" : void 0;
@@ -743,6 +743,29 @@ function validateValueLabel(token, args, doc) {
743
743
  return errors;
744
744
  }
745
745
  /**
746
+ * `@ui.form.optionalMode`: a mode of an optional scalar field. An optional
747
+ * object, array, tuple or union (`T | null` included) always keeps its Add /
748
+ * remove controls, so the annotation would do nothing there. Since 0.1.205.
749
+ */
750
+ function validateOptionalMode(token, args, doc) {
751
+ const field = annotationTarget(token, doc);
752
+ if (field && isProp(field) && !field.has("optional")) return [{
753
+ message: "@ui.form.optionalMode applies to an optional field (name?: T)",
754
+ severity: ERROR,
755
+ range: token.range
756
+ }];
757
+ const leaves = hostLeaves(token.parentNode, doc);
758
+ if (leaves.includes(null)) return [];
759
+ const design = hostDesign(token, doc);
760
+ const union = leaves.length > 1 && !leaves.every((leaf) => leaf.def.entity === "const");
761
+ if (design !== "object" && design !== "array" && !union) return [];
762
+ return [{
763
+ message: "@ui.form.optionalMode applies to a scalar field — optional objects, arrays, tuples and unions keep their Add / remove controls",
764
+ severity: ERROR,
765
+ range: args[0]?.range ?? token.range
766
+ }];
767
+ }
768
+ /**
746
769
  * `@ui.form.type` / `@ui.type`: the free-entry `tags` renderer edits an array —
747
770
  * on any other field it would mount with a scalar value.
748
771
  */
@@ -757,4 +780,4 @@ function validateFormType(token, args, doc) {
757
780
  }];
758
781
  }
759
782
  //#endregion
760
- export { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields };
783
+ export { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields };
@@ -26,6 +26,8 @@ const UI_FORM_PREFIX_ICON = "ui.form.prefix.icon";
26
26
  const UI_FORM_SUFFIX = "ui.form.suffix";
27
27
  const UI_FORM_SUFFIX_REF = "ui.form.suffix.ref";
28
28
  const UI_FORM_SUFFIX_ICON = "ui.form.suffix.icon";
29
+ /** `@ui.form.optionalMode 'business' | 'technical'` — since 0.1.205. */
30
+ const UI_FORM_OPTIONAL_MODE = "ui.form.optionalMode";
29
31
  const UI_TABLE_WIDTH = "ui.table.width";
30
32
  /** `@ui.table.fill` — the column takes a wide table's spare width; since 0.1.201. */
31
33
  const UI_TABLE_FILL = "ui.table.fill";
@@ -168,6 +170,7 @@ exports.UI_FORM_HIDDEN = UI_FORM_HIDDEN;
168
170
  exports.UI_FORM_HINT = UI_FORM_HINT;
169
171
  exports.UI_FORM_LABEL_SINGULAR = UI_FORM_LABEL_SINGULAR;
170
172
  exports.UI_FORM_NS = UI_FORM_NS;
173
+ exports.UI_FORM_OPTIONAL_MODE = UI_FORM_OPTIONAL_MODE;
171
174
  exports.UI_FORM_OPTIONS = UI_FORM_OPTIONS;
172
175
  exports.UI_FORM_ORDER = UI_FORM_ORDER;
173
176
  exports.UI_FORM_PLACEHOLDER = UI_FORM_PLACEHOLDER;
@@ -23,6 +23,8 @@ declare const UI_FORM_PREFIX_ICON: "ui.form.prefix.icon";
23
23
  declare const UI_FORM_SUFFIX: "ui.form.suffix";
24
24
  declare const UI_FORM_SUFFIX_REF: "ui.form.suffix.ref";
25
25
  declare const UI_FORM_SUFFIX_ICON: "ui.form.suffix.icon";
26
+ /** `@ui.form.optionalMode 'business' | 'technical'` — since 0.1.205. */
27
+ declare const UI_FORM_OPTIONAL_MODE: "ui.form.optionalMode";
26
28
  declare const UI_TABLE_WIDTH: "ui.table.width";
27
29
  /** `@ui.table.fill` — the column takes a wide table's spare width; since 0.1.201. */
28
30
  declare const UI_TABLE_FILL: "ui.table.fill";
@@ -83,4 +85,4 @@ declare const UI_TABLE_FN_CLASSES: "ui.table.fn.classes";
83
85
  declare const UI_TABLE_FN_STYLES: "ui.table.fn.styles";
84
86
  declare const UI_FORM_VALIDATE: "ui.form.validate";
85
87
  //#endregion
86
- export { 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 };
88
+ export { 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 };
@@ -23,6 +23,8 @@ declare const UI_FORM_PREFIX_ICON: "ui.form.prefix.icon";
23
23
  declare const UI_FORM_SUFFIX: "ui.form.suffix";
24
24
  declare const UI_FORM_SUFFIX_REF: "ui.form.suffix.ref";
25
25
  declare const UI_FORM_SUFFIX_ICON: "ui.form.suffix.icon";
26
+ /** `@ui.form.optionalMode 'business' | 'technical'` — since 0.1.205. */
27
+ declare const UI_FORM_OPTIONAL_MODE: "ui.form.optionalMode";
26
28
  declare const UI_TABLE_WIDTH: "ui.table.width";
27
29
  /** `@ui.table.fill` — the column takes a wide table's spare width; since 0.1.201. */
28
30
  declare const UI_TABLE_FILL: "ui.table.fill";
@@ -83,4 +85,4 @@ declare const UI_TABLE_FN_CLASSES: "ui.table.fn.classes";
83
85
  declare const UI_TABLE_FN_STYLES: "ui.table.fn.styles";
84
86
  declare const UI_FORM_VALIDATE: "ui.form.validate";
85
87
  //#endregion
86
- export { 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 };
88
+ export { 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 };
@@ -26,6 +26,8 @@ const UI_FORM_PREFIX_ICON = "ui.form.prefix.icon";
26
26
  const UI_FORM_SUFFIX = "ui.form.suffix";
27
27
  const UI_FORM_SUFFIX_REF = "ui.form.suffix.ref";
28
28
  const UI_FORM_SUFFIX_ICON = "ui.form.suffix.icon";
29
+ /** `@ui.form.optionalMode 'business' | 'technical'` — since 0.1.205. */
30
+ const UI_FORM_OPTIONAL_MODE = "ui.form.optionalMode";
29
31
  const UI_TABLE_WIDTH = "ui.table.width";
30
32
  /** `@ui.table.fill` — the column takes a wide table's spare width; since 0.1.201. */
31
33
  const UI_TABLE_FILL = "ui.table.fill";
@@ -106,4 +108,4 @@ const UI_TABLE_FN_CLASSES = "ui.table.fn.classes";
106
108
  const UI_TABLE_FN_STYLES = "ui.table.fn.styles";
107
109
  const UI_FORM_VALIDATE = "ui.form.validate";
108
110
  //#endregion
109
- export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_DERIVED, DB_COLUMN_PRECISION, DB_COLUMN_VERSION, DB_COLUMN_VERSION_TOKEN, DB_COMPUTE, DB_COMPUTE_HOST, DB_ENCRYPTED, DB_HTTP_PATH, DB_JSON, DB_REL_FK, DB_TABLE, DB_UNIT, DB_UNIT_REF, DB_VIEW, DB_VIEW_FOR, EXPECT_ARRAY_KEY, EXPECT_ARRAY_UNIQUE_ITEMS, EXPECT_MAX_LENGTH, EXPECT_MESSAGE, 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_NS, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_PUSH_DOWN, 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_LITERAL_LABEL, 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_HELP, UI_VALUE_HELP_COLUMN, UI_VALUE_HELP_DISTINCT, UI_VALUE_HELP_FILL, UI_VALUE_LABEL, WF_ACTION_WITH_DATA };
111
+ export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_DERIVED, DB_COLUMN_PRECISION, DB_COLUMN_VERSION, DB_COLUMN_VERSION_TOKEN, DB_COMPUTE, DB_COMPUTE_HOST, DB_ENCRYPTED, DB_HTTP_PATH, DB_JSON, DB_REL_FK, DB_TABLE, DB_UNIT, DB_UNIT_REF, DB_VIEW, DB_VIEW_FOR, EXPECT_ARRAY_KEY, EXPECT_ARRAY_UNIQUE_ITEMS, EXPECT_MAX_LENGTH, EXPECT_MESSAGE, 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_NS, 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_PUSH_DOWN, 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_LITERAL_LABEL, 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_HELP, UI_VALUE_HELP_COLUMN, UI_VALUE_HELP_DISTINCT, UI_VALUE_HELP_FILL, UI_VALUE_LABEL, WF_ACTION_WITH_DATA };
@@ -0,0 +1,12 @@
1
+ //#region src/shared/exact-number.ts
2
+ /**
3
+ * Whether `prop` holds an exact number as text — a `decimal`, or a `long`
4
+ * (64-bit integer; since 0.1.205): its value is a numeric string end to end,
5
+ * never a JS number, which would round it.
6
+ */
7
+ function isExactNumberText(prop) {
8
+ const t = prop?.type;
9
+ return t?.kind === "" && (t.designType === "decimal" || t.designType === "long");
10
+ }
11
+ //#endregion
12
+ exports.isExactNumberText = isExactNumberText;
@@ -0,0 +1,12 @@
1
+ //#region src/shared/exact-number.ts
2
+ /**
3
+ * Whether `prop` holds an exact number as text — a `decimal`, or a `long`
4
+ * (64-bit integer; since 0.1.205): its value is a numeric string end to end,
5
+ * never a JS number, which would round it.
6
+ */
7
+ function isExactNumberText(prop) {
8
+ const t = prop?.type;
9
+ return t?.kind === "" && (t.designType === "decimal" || t.designType === "long");
10
+ }
11
+ //#endregion
12
+ export { isExactNumberText };
@@ -1,8 +1,8 @@
1
1
  const require_model_texts = require("../i18n/model-texts.cjs");
2
2
  const require_ui_texts = require("../i18n/ui-texts.cjs");
3
+ const require_create_table_def = require("../table/create-table-def.cjs");
3
4
  const require_value_help_client = require("../value-help/value-help-client.cjs");
4
5
  const require_client_factory = require("../client-factory.cjs");
5
- const require_create_table_def = require("../table/create-table-def.cjs");
6
6
  let _atscript_db_client = require("@atscript/db-client");
7
7
  //#region src/shared/meta-cache.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import { deserializeServedType } from "../i18n/model-texts.mjs";
2
2
  import { getUiTexts } from "../i18n/ui-texts.mjs";
3
+ import { createTableDef } from "../table/create-table-def.mjs";
3
4
  import { invalidateValueHelpCache } from "../value-help/value-help-client.mjs";
4
5
  import { getDefaultClientFactory } from "../client-factory.mjs";
5
- import { createTableDef } from "../table/create-table-def.mjs";
6
6
  import { clearMetaStore, defaultMetaStore } from "@atscript/db-client";
7
7
  //#region src/shared/meta-cache.ts
8
8
  /**
@@ -3,6 +3,7 @@ const require_model_texts = require("../i18n/model-texts.cjs");
3
3
  const require_field_resolver = require("../shared/field-resolver.cjs");
4
4
  const require_extract_literals = require("../value-help/extract-literals.cjs");
5
5
  const require_extract_ref = require("../value-help/extract-ref.cjs");
6
+ const require_exact_number = require("../shared/exact-number.cjs");
6
7
  const require_str = require("../shared/str.cjs");
7
8
  const require_measurement = require("../form/measurement.cjs");
8
9
  const require_value_label = require("../shared/value-label.cjs");
@@ -176,7 +177,7 @@ function inferDisplayType(prop, literalOpts) {
176
177
  const final = prop.type;
177
178
  const dt = final.designType;
178
179
  if (dt === "number") return final.tags?.has("timestamp") ? "datetime" : "number";
179
- if (dt === "decimal") return "number";
180
+ if (require_exact_number.isExactNumberText(prop)) return "number";
180
181
  if (dt === "boolean") return "boolean";
181
182
  return "text";
182
183
  }
@@ -204,6 +205,7 @@ function scalarValueKind(prop) {
204
205
  if (tags?.has("int") || INTEGER_NUMBER_META.some((k) => prop.metadata.has(k))) return "integer";
205
206
  return "number";
206
207
  case "decimal": return "decimal";
208
+ case "long": return "long";
207
209
  case "boolean": return "boolean";
208
210
  default: return;
209
211
  }
@@ -245,3 +247,4 @@ function inferValueKind(prop) {
245
247
  }
246
248
  //#endregion
247
249
  exports.createTableDef = createTableDef;
250
+ exports.inferValueKind = inferValueKind;
@@ -3,6 +3,7 @@ import { deserializeServedType } from "../i18n/model-texts.mjs";
3
3
  import { getFieldMeta } from "../shared/field-resolver.mjs";
4
4
  import { extractFieldLiteralOptions, isEmptyMember } from "../value-help/extract-literals.mjs";
5
5
  import { extractValueHelp } from "../value-help/extract-ref.mjs";
6
+ import { isExactNumberText } from "../shared/exact-number.mjs";
6
7
  import { humanizePath } from "../shared/str.mjs";
7
8
  import { extractMeasurement } from "../form/measurement.mjs";
8
9
  import { valueLabelOf } from "../shared/value-label.mjs";
@@ -176,7 +177,7 @@ function inferDisplayType(prop, literalOpts) {
176
177
  const final = prop.type;
177
178
  const dt = final.designType;
178
179
  if (dt === "number") return final.tags?.has("timestamp") ? "datetime" : "number";
179
- if (dt === "decimal") return "number";
180
+ if (isExactNumberText(prop)) return "number";
180
181
  if (dt === "boolean") return "boolean";
181
182
  return "text";
182
183
  }
@@ -204,6 +205,7 @@ function scalarValueKind(prop) {
204
205
  if (tags?.has("int") || INTEGER_NUMBER_META.some((k) => prop.metadata.has(k))) return "integer";
205
206
  return "number";
206
207
  case "decimal": return "decimal";
208
+ case "long": return "long";
207
209
  case "boolean": return "boolean";
208
210
  default: return;
209
211
  }
@@ -244,4 +246,4 @@ function inferValueKind(prop) {
244
246
  return [...kinds][0];
245
247
  }
246
248
  //#endregion
247
- export { createTableDef };
249
+ export { createTableDef, inferValueKind };
@@ -52,27 +52,33 @@ interface FieldMeta {
52
52
  */
53
53
  writeOnly?: boolean;
54
54
  /**
55
- * Server-computed (`@db.column.derived`, `@atscript/db` 0.1.141+): filterable
56
- * and sortable like any column, but a value written to it is dropped. Forms
57
- * read the annotation from the type itself (`FormFieldDef.derived`).
58
- * Since 0.1.144.
55
+ * Read, never written, through this endpoint (`@atscript/db` 0.1.209+): the
56
+ * field is not in the model's write model — `derived`, `computed`,
57
+ * `hostComputed`, a `@db.view.writable` view's own field — or a permission
58
+ * overlay marks it. A write carrying it drops the key. `createFormDef`
59
+ * (`CreateFormDefOptions.metaFields`) marks such a field `derived`: rendered
60
+ * read-only, never sent. Since 0.1.205.
61
+ */
62
+ readOnly?: true;
63
+ /**
64
+ * Server-computed (`@db.column.derived`, `@atscript/db` 0.1.141+) — why the
65
+ * field is `readOnly`: filterable and sortable like any column, but a value
66
+ * written to it is dropped. Since 0.1.144.
59
67
  */
60
68
  derived?: boolean;
61
69
  /**
62
- * A computed view column (`@db.compute`, `@atscript/db` 0.1.147+): the
63
- * database evaluates it from other fields of the view. It is a column like
64
- * any other — sorting and filtering follow `sortable` / `filterable` —
65
- * but never writable: `createFormDef` marks it `derived` (from the served
66
- * `db.compute` marker since 0.1.205, else from these fields —
67
- * `CreateFormDefOptions.metaFields`). Since 0.1.147.
70
+ * A computed view column (`@db.compute`, `@atscript/db` 0.1.147+) — why
71
+ * the field is `readOnly`: the database evaluates it from other fields of
72
+ * the view. Sorting and filtering follow `sortable` / `filterable`.
73
+ * Since 0.1.147.
68
74
  */
69
75
  computed?: boolean;
70
76
  /**
71
77
  * A view's host-computed field (`@db.compute.host`, `@atscript/db`
72
- * 0.1.205+): no column — the server's `computeHost` fills it after each
73
- * read. Selectable only: served `sortable: false, filterable: false`, so it
74
- * is a read-only column with no sort or filter, and a form treats it as
75
- * `derived`. Since 0.1.203 (replaces `decoration`).
78
+ * 0.1.205+) — why the field is `readOnly`: no column, the server's
79
+ * `computeHost` fills it after each read. Served `sortable: false,
80
+ * filterable: false`, so it is a column with no sort or filter. Since
81
+ * 0.1.203 (replaces `decoration`).
76
82
  */
77
83
  hostComputed?: boolean;
78
84
  /**
@@ -172,10 +178,11 @@ interface TableDef {
172
178
  /**
173
179
  * Scalar storage kind of a column's value — what the server's filter guard
174
180
  * checks. `string` / `date` / `isoDate` are `string`, `string.date` and
175
- * `string.isoDate`; `timestamp` is `number.timestamp` (epoch ms).
181
+ * `string.isoDate`; `timestamp` is `number.timestamp` (epoch ms); `decimal`
182
+ * and `long` hold exact numbers as text (`long` since 0.1.205).
176
183
  * Since 0.1.148.
177
184
  */
178
- type ColumnValueKind = "string" | "date" | "isoDate" | "number" | "integer" | "decimal" | "timestamp" | "boolean";
185
+ type ColumnValueKind = "string" | "date" | "isoDate" | "number" | "integer" | "decimal" | "long" | "timestamp" | "boolean";
179
186
  /** A single column definition — built from field metadata + annotations. */
180
187
  interface ColumnDef {
181
188
  /** Field path in dot-notation (e.g. 'address.city'). */
@@ -52,27 +52,33 @@ interface FieldMeta {
52
52
  */
53
53
  writeOnly?: boolean;
54
54
  /**
55
- * Server-computed (`@db.column.derived`, `@atscript/db` 0.1.141+): filterable
56
- * and sortable like any column, but a value written to it is dropped. Forms
57
- * read the annotation from the type itself (`FormFieldDef.derived`).
58
- * Since 0.1.144.
55
+ * Read, never written, through this endpoint (`@atscript/db` 0.1.209+): the
56
+ * field is not in the model's write model — `derived`, `computed`,
57
+ * `hostComputed`, a `@db.view.writable` view's own field — or a permission
58
+ * overlay marks it. A write carrying it drops the key. `createFormDef`
59
+ * (`CreateFormDefOptions.metaFields`) marks such a field `derived`: rendered
60
+ * read-only, never sent. Since 0.1.205.
61
+ */
62
+ readOnly?: true;
63
+ /**
64
+ * Server-computed (`@db.column.derived`, `@atscript/db` 0.1.141+) — why the
65
+ * field is `readOnly`: filterable and sortable like any column, but a value
66
+ * written to it is dropped. Since 0.1.144.
59
67
  */
60
68
  derived?: boolean;
61
69
  /**
62
- * A computed view column (`@db.compute`, `@atscript/db` 0.1.147+): the
63
- * database evaluates it from other fields of the view. It is a column like
64
- * any other — sorting and filtering follow `sortable` / `filterable` —
65
- * but never writable: `createFormDef` marks it `derived` (from the served
66
- * `db.compute` marker since 0.1.205, else from these fields —
67
- * `CreateFormDefOptions.metaFields`). Since 0.1.147.
70
+ * A computed view column (`@db.compute`, `@atscript/db` 0.1.147+) — why
71
+ * the field is `readOnly`: the database evaluates it from other fields of
72
+ * the view. Sorting and filtering follow `sortable` / `filterable`.
73
+ * Since 0.1.147.
68
74
  */
69
75
  computed?: boolean;
70
76
  /**
71
77
  * A view's host-computed field (`@db.compute.host`, `@atscript/db`
72
- * 0.1.205+): no column — the server's `computeHost` fills it after each
73
- * read. Selectable only: served `sortable: false, filterable: false`, so it
74
- * is a read-only column with no sort or filter, and a form treats it as
75
- * `derived`. Since 0.1.203 (replaces `decoration`).
78
+ * 0.1.205+) — why the field is `readOnly`: no column, the server's
79
+ * `computeHost` fills it after each read. Served `sortable: false,
80
+ * filterable: false`, so it is a column with no sort or filter. Since
81
+ * 0.1.203 (replaces `decoration`).
76
82
  */
77
83
  hostComputed?: boolean;
78
84
  /**
@@ -172,10 +178,11 @@ interface TableDef {
172
178
  /**
173
179
  * Scalar storage kind of a column's value — what the server's filter guard
174
180
  * checks. `string` / `date` / `isoDate` are `string`, `string.date` and
175
- * `string.isoDate`; `timestamp` is `number.timestamp` (epoch ms).
181
+ * `string.isoDate`; `timestamp` is `number.timestamp` (epoch ms); `decimal`
182
+ * and `long` hold exact numbers as text (`long` since 0.1.205).
176
183
  * Since 0.1.148.
177
184
  */
178
- type ColumnValueKind = "string" | "date" | "isoDate" | "number" | "integer" | "decimal" | "timestamp" | "boolean";
185
+ type ColumnValueKind = "string" | "date" | "isoDate" | "number" | "integer" | "decimal" | "long" | "timestamp" | "boolean";
179
186
  /** A single column definition — built from field metadata + annotations. */
180
187
  interface ColumnDef {
181
188
  /** Field path in dot-notation (e.g. 'address.city'). */
@@ -1,10 +1,43 @@
1
+ let _atscript_db_meta = require("@atscript/db/meta");
1
2
  //#region src/table/value-kind.ts
2
- /** Storage kinds that hold plain numbers (a `timestamp` is epoch ms, but filters treat it as a date). */
3
+ /**
4
+ * Storage kinds that hold numbers (a `timestamp` is epoch ms, but filters treat
5
+ * it as a date). A `decimal` or `long` value is exact numeric text, not a JS
6
+ * number.
7
+ */
3
8
  const NUMERIC_VALUE_KINDS = new Set([
4
9
  "number",
5
10
  "integer",
6
- "decimal"
11
+ "decimal",
12
+ "long"
7
13
  ]);
14
+ const NUMERIC_TEXT = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/;
15
+ /** Whether `raw` is plain decimal-number text (`12`, `-0.5`, `1e3`) — not `Infinity`, `0x1`, or `1_000`. Since 0.1.205. */
16
+ function isNumericText(raw) {
17
+ return NUMERIC_TEXT.test(raw.trim());
18
+ }
19
+ /**
20
+ * The typed value of numeric text — what a filter or a search sends for a
21
+ * field of storage kind `valueKind` — or `undefined` when the text is no such
22
+ * value:
23
+ *
24
+ * - an `integer` takes whole numbers only;
25
+ * - a `decimal` keeps the text as a **string** (a JS number would round it);
26
+ * - a `long` takes integer text within the 64-bit range, as canonical text
27
+ * (`" +007 "` → `"7"`);
28
+ * - any other kind gets a finite number.
29
+ *
30
+ * Since 0.1.205 (`@atscript/ui-table`'s filter coercion before).
31
+ */
32
+ function coerceNumericText(raw, valueKind) {
33
+ if (!isNumericText(raw)) return void 0;
34
+ const text = raw.trim();
35
+ if (valueKind === "decimal") return text;
36
+ if (valueKind === "long") return (0, _atscript_db_meta.canonicalLong)(text);
37
+ const n = Number(text);
38
+ if (!Number.isFinite(n)) return void 0;
39
+ return valueKind === "integer" && !Number.isInteger(n) ? void 0 : n;
40
+ }
8
41
  /**
9
42
  * The typed value of an option — a column's or a form field's — the literal
10
43
  * itself (`true`, `3`, `'a'`), falling back to the string `key` for a hand-built
@@ -17,4 +50,6 @@ function optionValue(option) {
17
50
  }
18
51
  //#endregion
19
52
  exports.NUMERIC_VALUE_KINDS = NUMERIC_VALUE_KINDS;
53
+ exports.coerceNumericText = coerceNumericText;
54
+ exports.isNumericText = isNumericText;
20
55
  exports.optionValue = optionValue;
@@ -2,8 +2,28 @@ import { TFormEntryOptions } from "../value-help/types.cjs";
2
2
  import { ColumnValueKind } from "./types.cjs";
3
3
 
4
4
  //#region src/table/value-kind.d.ts
5
- /** Storage kinds that hold plain numbers (a `timestamp` is epoch ms, but filters treat it as a date). */
5
+ /**
6
+ * Storage kinds that hold numbers (a `timestamp` is epoch ms, but filters treat
7
+ * it as a date). A `decimal` or `long` value is exact numeric text, not a JS
8
+ * number.
9
+ */
6
10
  declare const NUMERIC_VALUE_KINDS: ReadonlySet<ColumnValueKind>;
11
+ /** Whether `raw` is plain decimal-number text (`12`, `-0.5`, `1e3`) — not `Infinity`, `0x1`, or `1_000`. Since 0.1.205. */
12
+ declare function isNumericText(raw: string): boolean;
13
+ /**
14
+ * The typed value of numeric text — what a filter or a search sends for a
15
+ * field of storage kind `valueKind` — or `undefined` when the text is no such
16
+ * value:
17
+ *
18
+ * - an `integer` takes whole numbers only;
19
+ * - a `decimal` keeps the text as a **string** (a JS number would round it);
20
+ * - a `long` takes integer text within the 64-bit range, as canonical text
21
+ * (`" +007 "` → `"7"`);
22
+ * - any other kind gets a finite number.
23
+ *
24
+ * Since 0.1.205 (`@atscript/ui-table`'s filter coercion before).
25
+ */
26
+ declare function coerceNumericText(raw: string, valueKind?: ColumnValueKind): string | number | undefined;
7
27
  /**
8
28
  * The typed value of an option — a column's or a form field's — the literal
9
29
  * itself (`true`, `3`, `'a'`), falling back to the string `key` for a hand-built
@@ -13,4 +33,4 @@ declare const NUMERIC_VALUE_KINDS: ReadonlySet<ColumnValueKind>;
13
33
  */
14
34
  declare function optionValue(option: TFormEntryOptions): string | number | boolean;
15
35
  //#endregion
16
- export { NUMERIC_VALUE_KINDS, optionValue };
36
+ export { NUMERIC_VALUE_KINDS, coerceNumericText, isNumericText, optionValue };