@atscript/ui 0.1.206 → 0.1.208

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 (127) hide show
  1. package/dist/form/create-form-def.cjs +16 -18
  2. package/dist/form/create-form-def.mjs +15 -17
  3. package/dist/form/decimal-format.cjs +8 -3
  4. package/dist/form/decimal-format.d.cts +8 -2
  5. package/dist/form/decimal-format.d.mts +8 -2
  6. package/dist/form/decimal-format.mjs +8 -3
  7. package/dist/form/form-actions.cjs +9 -0
  8. package/dist/form/form-actions.d.cts +7 -1
  9. package/dist/form/form-actions.d.mts +7 -1
  10. package/dist/form/form-actions.mjs +9 -1
  11. package/dist/form/measurement.cjs +58 -0
  12. package/dist/form/measurement.d.cts +36 -1
  13. package/dist/form/measurement.d.mts +36 -1
  14. package/dist/form/measurement.mjs +57 -2
  15. package/dist/form/omit-derived.cjs +11 -0
  16. package/dist/form/omit-derived.d.cts +8 -1
  17. package/dist/form/omit-derived.d.mts +8 -1
  18. package/dist/form/omit-derived.mjs +11 -1
  19. package/dist/form/optional-mode.cjs +7 -7
  20. package/dist/form/optional-mode.d.cts +2 -1
  21. package/dist/form/optional-mode.d.mts +2 -1
  22. package/dist/form/optional-mode.mjs +8 -8
  23. package/dist/form/path-utils.cjs +10 -0
  24. package/dist/form/path-utils.d.cts +8 -1
  25. package/dist/form/path-utils.d.mts +8 -1
  26. package/dist/form/path-utils.mjs +10 -1
  27. package/dist/form/types.cjs +5 -0
  28. package/dist/form/types.d.cts +14 -0
  29. package/dist/form/types.d.mts +14 -0
  30. package/dist/form/types.mjs +5 -1
  31. package/dist/form/validate.cjs +56 -5
  32. package/dist/form/validate.d.cts +30 -2
  33. package/dist/form/validate.d.mts +30 -2
  34. package/dist/form/validate.mjs +56 -6
  35. package/dist/index.cjs +42 -6
  36. package/dist/index.d.cts +20 -12
  37. package/dist/index.d.mts +20 -12
  38. package/dist/index.mjs +23 -15
  39. package/dist/plugin/annotations.cjs +33 -14
  40. package/dist/plugin/annotations.mjs +34 -15
  41. package/dist/plugin/value-help-validation.cjs +26 -6
  42. package/dist/plugin/value-help-validation.mjs +26 -7
  43. package/dist/shared/annotation-keys.cjs +3 -0
  44. package/dist/shared/annotation-keys.d.cts +2 -1
  45. package/dist/shared/annotation-keys.d.mts +2 -1
  46. package/dist/shared/annotation-keys.mjs +3 -1
  47. package/dist/shared/dev.cjs +22 -0
  48. package/dist/shared/dev.d.cts +4 -0
  49. package/dist/shared/dev.d.mts +4 -0
  50. package/dist/shared/dev.mjs +22 -0
  51. package/dist/shared/field-resolver.cjs +21 -1
  52. package/dist/shared/field-resolver.d.cts +15 -1
  53. package/dist/shared/field-resolver.d.mts +15 -1
  54. package/dist/shared/field-resolver.mjs +20 -2
  55. package/dist/shared/merge-filters.cjs +28 -0
  56. package/dist/shared/merge-filters.d.cts +13 -0
  57. package/dist/shared/merge-filters.d.mts +13 -0
  58. package/dist/shared/merge-filters.mjs +28 -0
  59. package/dist/shared/meta-cache.cjs +5 -4
  60. package/dist/shared/meta-cache.d.cts +3 -2
  61. package/dist/shared/meta-cache.d.mts +3 -2
  62. package/dist/shared/meta-cache.mjs +5 -4
  63. package/dist/shared/resolve-component.cjs +27 -0
  64. package/dist/shared/resolve-component.d.cts +22 -0
  65. package/dist/shared/resolve-component.d.mts +22 -0
  66. package/dist/shared/resolve-component.mjs +27 -0
  67. package/dist/shared/stable-key.cjs +28 -0
  68. package/dist/shared/stable-key.d.cts +13 -0
  69. package/dist/shared/stable-key.d.mts +13 -0
  70. package/dist/shared/stable-key.mjs +28 -0
  71. package/dist/shared/to-date.cjs +65 -0
  72. package/dist/shared/to-date.d.cts +35 -0
  73. package/dist/shared/to-date.d.mts +35 -0
  74. package/dist/shared/to-date.mjs +64 -0
  75. package/dist/shared/value-label.cjs +14 -2
  76. package/dist/shared/value-label.d.cts +23 -6
  77. package/dist/shared/value-label.d.mts +23 -6
  78. package/dist/shared/value-label.mjs +14 -3
  79. package/dist/table/create-table-def.cjs +53 -13
  80. package/dist/table/create-table-def.mjs +53 -15
  81. package/dist/table/types.d.cts +15 -13
  82. package/dist/table/types.d.mts +15 -13
  83. package/dist/value-help/client-store.cjs +43 -0
  84. package/dist/value-help/client-store.d.mts +1 -0
  85. package/dist/value-help/client-store.mjs +40 -0
  86. package/dist/value-help/display-value.cjs +30 -0
  87. package/dist/value-help/display-value.d.cts +45 -0
  88. package/dist/value-help/display-value.d.mts +45 -0
  89. package/dist/value-help/display-value.mjs +30 -0
  90. package/dist/value-help/distinct-client.cjs +80 -7
  91. package/dist/value-help/distinct-client.d.cts +31 -36
  92. package/dist/value-help/distinct-client.d.mts +31 -36
  93. package/dist/value-help/distinct-client.mjs +80 -7
  94. package/dist/value-help/extract-ref.cjs +15 -4
  95. package/dist/value-help/extract-ref.d.cts +6 -1
  96. package/dist/value-help/extract-ref.d.mts +6 -1
  97. package/dist/value-help/extract-ref.mjs +16 -6
  98. package/dist/value-help/index.d.mts +6 -3
  99. package/dist/value-help/options.cjs +70 -8
  100. package/dist/value-help/options.d.cts +57 -4
  101. package/dist/value-help/options.d.mts +57 -4
  102. package/dist/value-help/options.mjs +67 -9
  103. package/dist/value-help/resolve-options.cjs +9 -7
  104. package/dist/value-help/resolve-options.d.cts +8 -9
  105. package/dist/value-help/resolve-options.d.mts +8 -9
  106. package/dist/value-help/resolve-options.mjs +9 -7
  107. package/dist/value-help/resolve.cjs +29 -8
  108. package/dist/value-help/resolve.d.cts +22 -5
  109. package/dist/value-help/resolve.d.mts +22 -5
  110. package/dist/value-help/resolve.mjs +29 -8
  111. package/dist/value-help/scope.cjs +3 -7
  112. package/dist/value-help/scope.mjs +3 -7
  113. package/dist/value-help/source.cjs +72 -0
  114. package/dist/value-help/source.d.cts +55 -0
  115. package/dist/value-help/source.d.mts +55 -0
  116. package/dist/value-help/source.mjs +71 -0
  117. package/dist/value-help/texts.cjs +318 -0
  118. package/dist/value-help/texts.d.cts +53 -0
  119. package/dist/value-help/texts.d.mts +53 -0
  120. package/dist/value-help/texts.mjs +313 -0
  121. package/dist/value-help/types.d.cts +10 -0
  122. package/dist/value-help/types.d.mts +10 -0
  123. package/dist/value-help/value-help-client.cjs +24 -20
  124. package/dist/value-help/value-help-client.d.cts +10 -5
  125. package/dist/value-help/value-help-client.d.mts +10 -5
  126. package/dist/value-help/value-help-client.mjs +22 -18
  127. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields } from "./value-help-validation.mjs";
1
+ import { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueHelpLabel, 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 = [
@@ -18,6 +18,23 @@ const BUILTIN_TYPES = [
18
18
  "paragraph",
19
19
  "action"
20
20
  ];
21
+ /**
22
+ * The optional `arrangement` of `@ui.valueLabel`, `@ui.dict.label` and
23
+ * `@ui.valueHelp.label`: how a code shows with its text.
24
+ */
25
+ function arrangementArg(defaultNote) {
26
+ return {
27
+ optional: true,
28
+ name: "arrangement",
29
+ type: "string",
30
+ description: "How the code and its text are shown: `textKey` — `Berlin (BER)`; `keyText` — `BER (Berlin)`; `text` — `Berlin`. An empty text shows the code alone. " + defaultNote,
31
+ values: [
32
+ "textKey",
33
+ "keyText",
34
+ "text"
35
+ ]
36
+ };
37
+ }
21
38
  const COL_SPAN_VALUES = [
22
39
  "1",
23
40
  "2",
@@ -529,6 +546,17 @@ const uiAnnotations = { ui: {
529
546
  },
530
547
  validate: validateColumn
531
548
  }),
549
+ label: new AnnotationSpec({
550
+ description: "The text of this binding's codes: a string field of the dictionary, instead of its `@ui.dict.label`. A code shows with the text of its dictionary row in table cells, export, filter chips, read-only form fields and the reference field while it is not focused; the pickers show it as each row's text. Sorting and filtering stay on the code. An `@ui.valueLabel` of the field wins where the row holds its text.\n\n**Example:**\n```atscript\n@db.rel.FK\n@ui.valueHelp.label 'fullName', 'text'\nassigneeId?: User.id\n```\n",
551
+ nodeType: ["prop"],
552
+ argument: [{
553
+ name: "field",
554
+ type: "string",
555
+ description: "A string field of the dictionary holding the text of the codes.",
556
+ fieldScope: valueHelpScopes.bindingField
557
+ }, arrangementArg("Default: the dictionary's (`@ui.dict.label`), else `textKey`.")],
558
+ validate: validateValueHelpLabel
559
+ }),
532
560
  distinct: new AnnotationSpec({
533
561
  description: "Offers a **distinct-values picker** for this column in table filters: the values already stored, read from the table's own controller via `$groupBy`. Shown only when the server reports the field filterable and groupable, and the field has no dictionary binding, FK help or literal options. Not offered in forms.\n\n**Example:**\n```atscript\n@ui.valueHelp.distinct\ncity?: string\n```\n",
534
562
  nodeType: ["prop", "type"],
@@ -554,7 +582,7 @@ const uiAnnotations = { ui: {
554
582
  validate: validateLiteralLabel
555
583
  }),
556
584
  valueLabel: new AnnotationSpec({
557
- description: "Shows this field's value — a code — together with its text, read from a string field of the same interface: in table cells, export, read-only form fields and the reference field while it is not focused. Sorting and filtering stay on the code, and filter chips show the code. On a field with a value-help binding, let the pick fill the text (`@ui.valueHelp.fill`), or it goes stale after a pick. Not passed through references.\n\n**Example:**\n```atscript\n@ui.valueHelp City, 'code'\n@ui.valueHelp.fill 'cityName', 'name'\n@ui.valueLabel 'cityName'\ncity?: string\ncityName?: string\n```\n",
585
+ description: "Shows this field's value — a code — together with its text, read from a string field of the same interface: in table cells, export, read-only form fields and the reference field while it is not focused. Wins over a dictionary label (`@ui.dict.label`, `@ui.valueHelp.label`) wherever the row is at hand; filter chips show the dictionary's. Sorting and filtering stay on the code. On a field with a value-help binding, let the pick fill the text (`@ui.valueHelp.fill`), or it goes stale after a pick. Not passed through references.\n\n**Example:**\n```atscript\n@ui.valueHelp City, 'code'\n@ui.valueHelp.fill 'cityName', 'name'\n@ui.valueLabel 'cityName'\ncity?: string\ncityName?: string\n```\n",
558
586
  nodeType: ["prop"],
559
587
  passedWhenReferred: false,
560
588
  argument: [{
@@ -562,24 +590,15 @@ const uiAnnotations = { ui: {
562
590
  type: "string",
563
591
  description: "A string field of this interface holding the text of this field's value — not this field.",
564
592
  valueScope: valueLabelFields
565
- }, {
566
- optional: true,
567
- name: "arrangement",
568
- type: "string",
569
- description: "How the code and its text are shown: `textKey` (default) — `Berlin (BER)`; `keyText` — `BER (Berlin)`; `text` — `Berlin`. An empty text shows the code alone.",
570
- values: [
571
- "textKey",
572
- "keyText",
573
- "text"
574
- ]
575
- }],
593
+ }, arrangementArg("Default: `textKey`.")],
576
594
  validate: validateValueLabel
577
595
  }),
578
596
  dict: {
579
597
  label: new AnnotationSpec({
580
- description: "Marks this field as the primary display label when the table is used as a value-help dictionary",
598
+ description: "The label of this dictionary's records: every code bound to it (`@db.rel.FK` or `@ui.valueHelp`) shows with this field's text — in table cells, export, filter chips, read-only form fields and the reference field while it is not focused — and the pickers show it as each row's text; a table of these records names a row an action runs on by it in the action dialog. A binding may name another field (`@ui.valueHelp.label`). Without it, codes show alone.\n\n**Example:**\n```atscript\n@ui.dict.label 'keyText'\nname: string\n```\n",
581
599
  nodeType: ["prop"],
582
- passedWhenReferred: false
600
+ passedWhenReferred: false,
601
+ argument: arrangementArg("Default: `textKey`.")
583
602
  }),
584
603
  descr: new AnnotationSpec({
585
604
  description: "Marks this field as the secondary description in value-help display",
@@ -3,10 +3,11 @@ let _atscript_db_shared = require("@atscript/db/shared");
3
3
  //#region src/plugin/value-help-validation.ts
4
4
  /**
5
5
  * Editor scopes + validators of `@ui.valueHelp`, `@ui.valueHelp.distinct` and
6
- * `@ui.literalLabel` (since 0.1.148), and of `@ui.valueHelp.fill`,
6
+ * `@ui.literalLabel` (since 0.1.148), of `@ui.valueHelp.fill`,
7
7
  * `@ui.valueHelp.column`, host references in a binding filter and
8
- * `@ui.valueLabel` (since 0.1.190). Scopes and validators share one source,
9
- * so a diagnostic and what the editor completes never diverge.
8
+ * `@ui.valueLabel` (since 0.1.190), and of `@ui.valueHelp.label` (since
9
+ * 0.1.207). Scopes and validators share one source, so a diagnostic and what
10
+ * the editor completes never diverge.
10
11
  */
11
12
  const WARNING = 2;
12
13
  const ERROR = 1;
@@ -601,23 +602,41 @@ function validateFill(token, args, doc) {
601
602
  }
602
603
  return errors;
603
604
  }
604
- function validateColumn(token, args, doc) {
605
+ /**
606
+ * A field of the target of the field's own binding, named by `args[0]` —
607
+ * `@ui.valueHelp.column` (CL1/CL2) and `@ui.valueHelp.label` (LB1/LB2): the
608
+ * binding must be there (`@ui.valueHelp` or `@db.rel.FK`) and hold the field;
609
+ * `check` adds the annotation's own rule.
610
+ */
611
+ function bindingFieldMessages(token, args, doc, annotation, check) {
605
612
  const field = (0, _atscript_db_shared.annotationTarget)(token, doc);
606
613
  if (!field) return [];
607
614
  const binding = bindingOf(field, doc);
608
615
  if (!binding) return [{
609
- message: "@ui.valueHelp.column needs a binding of this field's own (@ui.valueHelp or @db.rel.FK)",
616
+ message: `${annotation} needs a binding of this field's own (@ui.valueHelp or @db.rel.FK)`,
610
617
  severity: ERROR,
611
618
  range: token.range
612
619
  }];
613
620
  const name = args[0]?.text;
614
- const problem = name === void 0 ? void 0 : targetFieldProblem(binding, name);
621
+ if (name === void 0) return [];
622
+ const problem = targetFieldProblem(binding, name) ?? check?.(binding, name);
615
623
  return problem ? [{
616
624
  message: problem,
617
625
  severity: ERROR,
618
626
  range: args[0].range
619
627
  }] : [];
620
628
  }
629
+ function validateColumn(token, args, doc) {
630
+ return bindingFieldMessages(token, args, doc, "@ui.valueHelp.column");
631
+ }
632
+ function validateValueHelpLabel(token, args, doc) {
633
+ return bindingFieldMessages(token, args, doc, "@ui.valueHelp.label", (binding, name) => {
634
+ const target = binding.target;
635
+ const prop = target?.props.get(name);
636
+ const design = prop && target && designOf(prop.getDefinition(), target.doc);
637
+ return design && design !== "string" ? `'${binding.name}.${name}' must be a string field (the text of the codes)` : void 0;
638
+ });
639
+ }
621
640
  function validateDistinct(token, _args, doc) {
622
641
  const errors = [];
623
642
  const host = token.parentNode;
@@ -789,6 +808,7 @@ exports.validateFormType = validateFormType;
789
808
  exports.validateLiteralLabel = validateLiteralLabel;
790
809
  exports.validateOptionalMode = validateOptionalMode;
791
810
  exports.validateValueHelp = validateValueHelp;
811
+ exports.validateValueHelpLabel = validateValueHelpLabel;
792
812
  exports.validateValueLabel = validateValueLabel;
793
813
  exports.valueHelpScopes = valueHelpScopes;
794
814
  exports.valueLabelFields = valueLabelFields;
@@ -3,10 +3,11 @@ import { NOT_DIMENSION_REASON, annotationTarget, effectiveAnnotationNames, fkCha
3
3
  //#region src/plugin/value-help-validation.ts
4
4
  /**
5
5
  * Editor scopes + validators of `@ui.valueHelp`, `@ui.valueHelp.distinct` and
6
- * `@ui.literalLabel` (since 0.1.148), and of `@ui.valueHelp.fill`,
6
+ * `@ui.literalLabel` (since 0.1.148), of `@ui.valueHelp.fill`,
7
7
  * `@ui.valueHelp.column`, host references in a binding filter and
8
- * `@ui.valueLabel` (since 0.1.190). Scopes and validators share one source,
9
- * so a diagnostic and what the editor completes never diverge.
8
+ * `@ui.valueLabel` (since 0.1.190), and of `@ui.valueHelp.label` (since
9
+ * 0.1.207). Scopes and validators share one source, so a diagnostic and what
10
+ * the editor completes never diverge.
10
11
  */
11
12
  const WARNING = 2;
12
13
  const ERROR = 1;
@@ -601,23 +602,41 @@ function validateFill(token, args, doc) {
601
602
  }
602
603
  return errors;
603
604
  }
604
- function validateColumn(token, args, doc) {
605
+ /**
606
+ * A field of the target of the field's own binding, named by `args[0]` —
607
+ * `@ui.valueHelp.column` (CL1/CL2) and `@ui.valueHelp.label` (LB1/LB2): the
608
+ * binding must be there (`@ui.valueHelp` or `@db.rel.FK`) and hold the field;
609
+ * `check` adds the annotation's own rule.
610
+ */
611
+ function bindingFieldMessages(token, args, doc, annotation, check) {
605
612
  const field = annotationTarget(token, doc);
606
613
  if (!field) return [];
607
614
  const binding = bindingOf(field, doc);
608
615
  if (!binding) return [{
609
- message: "@ui.valueHelp.column needs a binding of this field's own (@ui.valueHelp or @db.rel.FK)",
616
+ message: `${annotation} needs a binding of this field's own (@ui.valueHelp or @db.rel.FK)`,
610
617
  severity: ERROR,
611
618
  range: token.range
612
619
  }];
613
620
  const name = args[0]?.text;
614
- const problem = name === void 0 ? void 0 : targetFieldProblem(binding, name);
621
+ if (name === void 0) return [];
622
+ const problem = targetFieldProblem(binding, name) ?? check?.(binding, name);
615
623
  return problem ? [{
616
624
  message: problem,
617
625
  severity: ERROR,
618
626
  range: args[0].range
619
627
  }] : [];
620
628
  }
629
+ function validateColumn(token, args, doc) {
630
+ return bindingFieldMessages(token, args, doc, "@ui.valueHelp.column");
631
+ }
632
+ function validateValueHelpLabel(token, args, doc) {
633
+ return bindingFieldMessages(token, args, doc, "@ui.valueHelp.label", (binding, name) => {
634
+ const target = binding.target;
635
+ const prop = target?.props.get(name);
636
+ const design = prop && target && designOf(prop.getDefinition(), target.doc);
637
+ return design && design !== "string" ? `'${binding.name}.${name}' must be a string field (the text of the codes)` : void 0;
638
+ });
639
+ }
621
640
  function validateDistinct(token, _args, doc) {
622
641
  const errors = [];
623
642
  const host = token.parentNode;
@@ -780,4 +799,4 @@ function validateFormType(token, args, doc) {
780
799
  }];
781
800
  }
782
801
  //#endregion
783
- export { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueLabel, valueHelpScopes, valueLabelFields };
802
+ export { isValueHelpTarget, literalLabelValues, validateColumn, validateDistinct, validateFill, validateFormType, validateLiteralLabel, validateOptionalMode, validateValueHelp, validateValueHelpLabel, validateValueLabel, valueHelpScopes, valueLabelFields };
@@ -51,6 +51,8 @@ const UI_VALUE_HELP_DISTINCT = "ui.valueHelp.distinct";
51
51
  const UI_VALUE_HELP_FILL = "ui.valueHelp.fill";
52
52
  /** `@ui.valueHelp.column 'field'` — since 0.1.190. */
53
53
  const UI_VALUE_HELP_COLUMN = "ui.valueHelp.column";
54
+ /** `@ui.valueHelp.label 'field', 'arrangement'?` — since 0.1.207. */
55
+ const UI_VALUE_HELP_LABEL = "ui.valueHelp.label";
54
56
  const UI_LITERAL_LABEL = "ui.literalLabel";
55
57
  /** `@ui.valueLabel 'field', 'arrangement'?` — a code shown with its text; since 0.1.190. */
56
58
  const UI_VALUE_LABEL = "ui.valueLabel";
@@ -208,5 +210,6 @@ exports.UI_VALUE_HELP = UI_VALUE_HELP;
208
210
  exports.UI_VALUE_HELP_COLUMN = UI_VALUE_HELP_COLUMN;
209
211
  exports.UI_VALUE_HELP_DISTINCT = UI_VALUE_HELP_DISTINCT;
210
212
  exports.UI_VALUE_HELP_FILL = UI_VALUE_HELP_FILL;
213
+ exports.UI_VALUE_HELP_LABEL = UI_VALUE_HELP_LABEL;
211
214
  exports.UI_VALUE_LABEL = UI_VALUE_LABEL;
212
215
  exports.WF_ACTION_WITH_DATA = WF_ACTION_WITH_DATA;
@@ -63,6 +63,7 @@ declare const META_REQUIRED: "meta.required";
63
63
  declare const META_DEFAULT: "meta.default";
64
64
  declare const META_SENSITIVE: "meta.sensitive";
65
65
  declare const EXPECT_MAX_LENGTH: "expect.maxLength";
66
+ declare const EXPECT_ARRAY_UNIQUE_ITEMS: "expect.array.uniqueItems";
66
67
  declare const UI_FORM_FN_PREFIX: "ui.form.fn.";
67
68
  declare const UI_FORM_FN_LABEL: "ui.form.fn.label";
68
69
  declare const UI_FORM_FN_PLACEHOLDER: "ui.form.fn.placeholder";
@@ -85,4 +86,4 @@ declare const UI_TABLE_FN_CLASSES: "ui.table.fn.classes";
85
86
  declare const UI_TABLE_FN_STYLES: "ui.table.fn.styles";
86
87
  declare const UI_FORM_VALIDATE: "ui.form.validate";
87
88
  //#endregion
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 };
89
+ export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_ARRAY_UNIQUE_ITEMS, 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 };
@@ -63,6 +63,7 @@ declare const META_REQUIRED: "meta.required";
63
63
  declare const META_DEFAULT: "meta.default";
64
64
  declare const META_SENSITIVE: "meta.sensitive";
65
65
  declare const EXPECT_MAX_LENGTH: "expect.maxLength";
66
+ declare const EXPECT_ARRAY_UNIQUE_ITEMS: "expect.array.uniqueItems";
66
67
  declare const UI_FORM_FN_PREFIX: "ui.form.fn.";
67
68
  declare const UI_FORM_FN_LABEL: "ui.form.fn.label";
68
69
  declare const UI_FORM_FN_PLACEHOLDER: "ui.form.fn.placeholder";
@@ -85,4 +86,4 @@ declare const UI_TABLE_FN_CLASSES: "ui.table.fn.classes";
85
86
  declare const UI_TABLE_FN_STYLES: "ui.table.fn.styles";
86
87
  declare const UI_FORM_VALIDATE: "ui.form.validate";
87
88
  //#endregion
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 };
89
+ export { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_ARRAY_UNIQUE_ITEMS, 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 };
@@ -51,6 +51,8 @@ const UI_VALUE_HELP_DISTINCT = "ui.valueHelp.distinct";
51
51
  const UI_VALUE_HELP_FILL = "ui.valueHelp.fill";
52
52
  /** `@ui.valueHelp.column 'field'` — since 0.1.190. */
53
53
  const UI_VALUE_HELP_COLUMN = "ui.valueHelp.column";
54
+ /** `@ui.valueHelp.label 'field', 'arrangement'?` — since 0.1.207. */
55
+ const UI_VALUE_HELP_LABEL = "ui.valueHelp.label";
54
56
  const UI_LITERAL_LABEL = "ui.literalLabel";
55
57
  /** `@ui.valueLabel 'field', 'arrangement'?` — a code shown with its text; since 0.1.190. */
56
58
  const UI_VALUE_LABEL = "ui.valueLabel";
@@ -108,4 +110,4 @@ const UI_TABLE_FN_CLASSES = "ui.table.fn.classes";
108
110
  const UI_TABLE_FN_STYLES = "ui.table.fn.styles";
109
111
  const UI_FORM_VALIDATE = "ui.form.validate";
110
112
  //#endregion
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 };
113
+ 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_HELP_LABEL, UI_VALUE_LABEL, WF_ACTION_WITH_DATA };
@@ -0,0 +1,22 @@
1
+ //#region src/shared/dev.ts
2
+ /**
3
+ * `true` outside a production build — the gate for authoring-time warnings, so
4
+ * their strings and checks cost a shipped app nothing. In `@atscript/ui` since
5
+ * 0.1.208 (`@atscript/ui-table` re-exports it).
6
+ *
7
+ * Read from `process.env.NODE_ENV` rather than `import.meta.env`: bundlers
8
+ * replace this expression with a literal in both the ESM and the CJS output,
9
+ * while `import.meta` only exists in the former. Where neither a bundler nor a
10
+ * `process` shim is present the read throws — warnings stay on, which is the
11
+ * safe side of the trade.
12
+ */
13
+ function detectDev() {
14
+ try {
15
+ return process.env.NODE_ENV !== "production";
16
+ } catch {
17
+ return true;
18
+ }
19
+ }
20
+ const DEV = detectDev();
21
+ //#endregion
22
+ exports.DEV = DEV;
@@ -0,0 +1,4 @@
1
+ //#region src/shared/dev.d.ts
2
+ declare const DEV: boolean;
3
+ //#endregion
4
+ export { DEV };
@@ -0,0 +1,4 @@
1
+ //#region src/shared/dev.d.ts
2
+ declare const DEV: boolean;
3
+ //#endregion
4
+ export { DEV };
@@ -0,0 +1,22 @@
1
+ //#region src/shared/dev.ts
2
+ /**
3
+ * `true` outside a production build — the gate for authoring-time warnings, so
4
+ * their strings and checks cost a shipped app nothing. In `@atscript/ui` since
5
+ * 0.1.208 (`@atscript/ui-table` re-exports it).
6
+ *
7
+ * Read from `process.env.NODE_ENV` rather than `import.meta.env`: bundlers
8
+ * replace this expression with a literal in both the ESM and the CJS output,
9
+ * while `import.meta` only exists in the former. Where neither a bundler nor a
10
+ * `process` shim is present the read throws — warnings stay on, which is the
11
+ * safe side of the trade.
12
+ */
13
+ function detectDev() {
14
+ try {
15
+ return process.env.NODE_ENV !== "production";
16
+ } catch {
17
+ return true;
18
+ }
19
+ }
20
+ const DEV = detectDev();
21
+ //#endregion
22
+ export { DEV };
@@ -46,13 +46,31 @@ function resolveFormProp(type, fnKey, staticKey, scope, opts) {
46
46
  function hasComputedAnnotations(prop) {
47
47
  return activeResolver.hasComputedAnnotations(prop);
48
48
  }
49
+ const BOOL = { staticAsBoolean: true };
49
50
  /**
50
51
  * SSOT for field hidden resolution — resolves `@ui.form.fn.hidden`
51
52
  * (dynamic, via the active resolver) with static `@ui.form.hidden`
52
53
  * presence as the fallback. Absent both → `false` (visible).
53
54
  */
54
55
  function isFieldHidden(prop, scope) {
55
- return resolveFieldProp(prop, "ui.form.fn.hidden", "ui.form.hidden", scope, { staticAsBoolean: true }) ?? false;
56
+ return resolveFieldProp(prop, "ui.form.fn.hidden", "ui.form.hidden", scope, BOOL) ?? false;
57
+ }
58
+ /**
59
+ * A field's own disabled state — `@ui.form.fn.disabled` (dynamic, via the
60
+ * active resolver), else `@ui.form.disabled`; `false` without both. Not an
61
+ * enclosing field's lock. Since 0.1.208.
62
+ */
63
+ function isFieldDisabled(prop, scope) {
64
+ return resolveFieldProp(prop, "ui.form.fn.disabled", "ui.form.disabled", scope, BOOL) ?? false;
65
+ }
66
+ /**
67
+ * A field's own read-only state — always for a field the server owns
68
+ * (`FormFieldDef.derived`), else `@ui.form.fn.readonly` (dynamic, via the
69
+ * active resolver), else `@meta.readonly`; `false` without them. Not an
70
+ * enclosing field's lock. Since 0.1.208.
71
+ */
72
+ function isFieldReadonly(field, scope) {
73
+ return field.derived === true || (resolveFieldProp(field.prop, "ui.form.fn.readonly", "meta.readonly", scope, BOOL) ?? false);
56
74
  }
57
75
  function getFieldMeta(prop, key) {
58
76
  return prop.metadata.get(key);
@@ -115,7 +133,9 @@ exports.getFieldMeta = getFieldMeta;
115
133
  exports.getResolver = getResolver;
116
134
  exports.hasComputedAnnotations = hasComputedAnnotations;
117
135
  exports.hasFieldMeta = hasFieldMeta;
136
+ exports.isFieldDisabled = isFieldDisabled;
118
137
  exports.isFieldHidden = isFieldHidden;
138
+ exports.isFieldReadonly = isFieldReadonly;
119
139
  exports.parseStaticAttrs = parseStaticAttrs;
120
140
  exports.resolveAttrs = resolveAttrs;
121
141
  exports.resolveFieldProp = resolveFieldProp;
@@ -1,3 +1,4 @@
1
+ import { FormFieldDef } from "../form/types.cjs";
1
2
  import { UserTextT } from "../i18n/model-texts.cjs";
2
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
4
 
@@ -53,6 +54,19 @@ declare function hasComputedAnnotations(prop: TAtscriptAnnotatedType): boolean;
53
54
  * presence as the fallback. Absent both → `false` (visible).
54
55
  */
55
56
  declare function isFieldHidden(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>): boolean;
57
+ /**
58
+ * A field's own disabled state — `@ui.form.fn.disabled` (dynamic, via the
59
+ * active resolver), else `@ui.form.disabled`; `false` without both. Not an
60
+ * enclosing field's lock. Since 0.1.208.
61
+ */
62
+ declare function isFieldDisabled(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>): boolean;
63
+ /**
64
+ * A field's own read-only state — always for a field the server owns
65
+ * (`FormFieldDef.derived`), else `@ui.form.fn.readonly` (dynamic, via the
66
+ * active resolver), else `@meta.readonly`; `false` without them. Not an
67
+ * enclosing field's lock. Since 0.1.208.
68
+ */
69
+ declare function isFieldReadonly(field: FormFieldDef, scope: Record<string, unknown>): boolean;
56
70
  /**
57
71
  * Reads a static metadata value from an ATScript prop.
58
72
  * Typed overload for known AtscriptMetadata keys; falls back to `unknown` for other keys.
@@ -80,4 +94,4 @@ interface TResolveAttrsKeys {
80
94
  */
81
95
  declare function resolveAttrs(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>, keys?: TResolveAttrsKeys): Record<string, unknown> | undefined;
82
96
  //#endregion
83
- export { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
97
+ export { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
@@ -1,3 +1,4 @@
1
+ import { FormFieldDef } from "../form/types.mjs";
1
2
  import { UserTextT } from "../i18n/model-texts.mjs";
2
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
4
 
@@ -53,6 +54,19 @@ declare function hasComputedAnnotations(prop: TAtscriptAnnotatedType): boolean;
53
54
  * presence as the fallback. Absent both → `false` (visible).
54
55
  */
55
56
  declare function isFieldHidden(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>): boolean;
57
+ /**
58
+ * A field's own disabled state — `@ui.form.fn.disabled` (dynamic, via the
59
+ * active resolver), else `@ui.form.disabled`; `false` without both. Not an
60
+ * enclosing field's lock. Since 0.1.208.
61
+ */
62
+ declare function isFieldDisabled(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>): boolean;
63
+ /**
64
+ * A field's own read-only state — always for a field the server owns
65
+ * (`FormFieldDef.derived`), else `@ui.form.fn.readonly` (dynamic, via the
66
+ * active resolver), else `@meta.readonly`; `false` without them. Not an
67
+ * enclosing field's lock. Since 0.1.208.
68
+ */
69
+ declare function isFieldReadonly(field: FormFieldDef, scope: Record<string, unknown>): boolean;
56
70
  /**
57
71
  * Reads a static metadata value from an ATScript prop.
58
72
  * Typed overload for known AtscriptMetadata keys; falls back to `unknown` for other keys.
@@ -80,4 +94,4 @@ interface TResolveAttrsKeys {
80
94
  */
81
95
  declare function resolveAttrs(prop: TAtscriptAnnotatedType, scope: Record<string, unknown>, keys?: TResolveAttrsKeys): Record<string, unknown> | undefined;
82
96
  //#endregion
83
- export { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
97
+ export { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
@@ -46,13 +46,31 @@ function resolveFormProp(type, fnKey, staticKey, scope, opts) {
46
46
  function hasComputedAnnotations(prop) {
47
47
  return activeResolver.hasComputedAnnotations(prop);
48
48
  }
49
+ const BOOL = { staticAsBoolean: true };
49
50
  /**
50
51
  * SSOT for field hidden resolution — resolves `@ui.form.fn.hidden`
51
52
  * (dynamic, via the active resolver) with static `@ui.form.hidden`
52
53
  * presence as the fallback. Absent both → `false` (visible).
53
54
  */
54
55
  function isFieldHidden(prop, scope) {
55
- return resolveFieldProp(prop, "ui.form.fn.hidden", "ui.form.hidden", scope, { staticAsBoolean: true }) ?? false;
56
+ return resolveFieldProp(prop, "ui.form.fn.hidden", "ui.form.hidden", scope, BOOL) ?? false;
57
+ }
58
+ /**
59
+ * A field's own disabled state — `@ui.form.fn.disabled` (dynamic, via the
60
+ * active resolver), else `@ui.form.disabled`; `false` without both. Not an
61
+ * enclosing field's lock. Since 0.1.208.
62
+ */
63
+ function isFieldDisabled(prop, scope) {
64
+ return resolveFieldProp(prop, "ui.form.fn.disabled", "ui.form.disabled", scope, BOOL) ?? false;
65
+ }
66
+ /**
67
+ * A field's own read-only state — always for a field the server owns
68
+ * (`FormFieldDef.derived`), else `@ui.form.fn.readonly` (dynamic, via the
69
+ * active resolver), else `@meta.readonly`; `false` without them. Not an
70
+ * enclosing field's lock. Since 0.1.208.
71
+ */
72
+ function isFieldReadonly(field, scope) {
73
+ return field.derived === true || (resolveFieldProp(field.prop, "ui.form.fn.readonly", "meta.readonly", scope, BOOL) ?? false);
56
74
  }
57
75
  function getFieldMeta(prop, key) {
58
76
  return prop.metadata.get(key);
@@ -108,4 +126,4 @@ function resolveAttrs(prop, scope, keys = {}) {
108
126
  return hasAttrs ? result : void 0;
109
127
  }
110
128
  //#endregion
111
- export { StaticFieldResolver, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
129
+ export { StaticFieldResolver, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldDisabled, isFieldHidden, isFieldReadonly, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver };
@@ -0,0 +1,28 @@
1
+ //#region src/shared/merge-filters.ts
2
+ /**
3
+ * AND-merge filter expressions (`undefined` ones skipped) — how the UI ANDs
4
+ * every filter it sends. A nested `$and` is flattened into the one, the
5
+ * fields next to it kept; a single expression is returned as is. Variadic
6
+ * since 0.1.140. In `@atscript/ui` since 0.1.208 (`@atscript/ui-table`
7
+ * re-exports it).
8
+ */
9
+ function mergeFilters(...exprs) {
10
+ const list = exprs.filter((e) => !!e);
11
+ return list.length <= 1 ? list[0] : { $and: flattenAnd(list) };
12
+ }
13
+ /** The AND-ed clauses of `exprs`: each nested `$and` spread in, the keys next to it kept as one clause. */
14
+ function flattenAnd(exprs) {
15
+ const out = [];
16
+ for (const expr of exprs) {
17
+ const { $and, ...rest } = expr;
18
+ if (!Array.isArray($and)) {
19
+ out.push(expr);
20
+ continue;
21
+ }
22
+ out.push(...flattenAnd($and));
23
+ if (Object.keys(rest).length > 0) out.push(rest);
24
+ }
25
+ return out;
26
+ }
27
+ //#endregion
28
+ exports.mergeFilters = mergeFilters;
@@ -0,0 +1,13 @@
1
+ import { FilterExpr } from "@atscript/db-client";
2
+
3
+ //#region src/shared/merge-filters.d.ts
4
+ /**
5
+ * AND-merge filter expressions (`undefined` ones skipped) — how the UI ANDs
6
+ * every filter it sends. A nested `$and` is flattened into the one, the
7
+ * fields next to it kept; a single expression is returned as is. Variadic
8
+ * since 0.1.140. In `@atscript/ui` since 0.1.208 (`@atscript/ui-table`
9
+ * re-exports it).
10
+ */
11
+ declare function mergeFilters(...exprs: (FilterExpr | undefined)[]): FilterExpr | undefined;
12
+ //#endregion
13
+ export { mergeFilters };
@@ -0,0 +1,13 @@
1
+ import { FilterExpr } from "@atscript/db-client";
2
+
3
+ //#region src/shared/merge-filters.d.ts
4
+ /**
5
+ * AND-merge filter expressions (`undefined` ones skipped) — how the UI ANDs
6
+ * every filter it sends. A nested `$and` is flattened into the one, the
7
+ * fields next to it kept; a single expression is returned as is. Variadic
8
+ * since 0.1.140. In `@atscript/ui` since 0.1.208 (`@atscript/ui-table`
9
+ * re-exports it).
10
+ */
11
+ declare function mergeFilters(...exprs: (FilterExpr | undefined)[]): FilterExpr | undefined;
12
+ //#endregion
13
+ export { mergeFilters };
@@ -0,0 +1,28 @@
1
+ //#region src/shared/merge-filters.ts
2
+ /**
3
+ * AND-merge filter expressions (`undefined` ones skipped) — how the UI ANDs
4
+ * every filter it sends. A nested `$and` is flattened into the one, the
5
+ * fields next to it kept; a single expression is returned as is. Variadic
6
+ * since 0.1.140. In `@atscript/ui` since 0.1.208 (`@atscript/ui-table`
7
+ * re-exports it).
8
+ */
9
+ function mergeFilters(...exprs) {
10
+ const list = exprs.filter((e) => !!e);
11
+ return list.length <= 1 ? list[0] : { $and: flattenAnd(list) };
12
+ }
13
+ /** The AND-ed clauses of `exprs`: each nested `$and` spread in, the keys next to it kept as one clause. */
14
+ function flattenAnd(exprs) {
15
+ const out = [];
16
+ for (const expr of exprs) {
17
+ const { $and, ...rest } = expr;
18
+ if (!Array.isArray($and)) {
19
+ out.push(expr);
20
+ continue;
21
+ }
22
+ out.push(...flattenAnd($and));
23
+ if (Object.keys(rest).length > 0) out.push(rest);
24
+ }
25
+ return out;
26
+ }
27
+ //#endregion
28
+ export { mergeFilters };
@@ -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
3
  const require_create_table_def = require("../table/create-table-def.cjs");
4
- const require_value_help_client = require("../value-help/value-help-client.cjs");
5
4
  const require_client_factory = require("../client-factory.cjs");
5
+ const require_texts = require("../value-help/texts.cjs");
6
6
  let _atscript_db_client = require("@atscript/db-client");
7
7
  //#region src/shared/meta-cache.ts
8
8
  /**
@@ -231,8 +231,9 @@ function customStoreOf(client) {
231
231
  * Drop every cached `/meta` — including the copy each cached `Client`
232
232
  * memoizes and the `@atscript/db-client` meta stores used to revalidate it
233
233
  * (the shared default one and any custom one a factory supplied) — the
234
- * value-help searches shared under them, and everything registered through
235
- * {@link onMetaCacheReset} (e.g. the table-presets cache). Entries already
234
+ * value-help searches shared under them, the texts of codes read from the
235
+ * dictionaries and the labels resolved for their bindings, and everything
236
+ * registered through {@link onMetaCacheReset} (e.g. the table-presets cache). Entries already
236
237
  * handed out keep working; the next `getMetaEntry` refetches.
237
238
  */
238
239
  function resetMetaCache() {
@@ -243,7 +244,7 @@ function resetMetaCache() {
243
244
  (0, _atscript_db_client.clearMetaStore)();
244
245
  for (const store of customStores.keys()) store.clear();
245
246
  customStores.clear();
246
- require_value_help_client.invalidateValueHelpCache();
247
+ require_texts.resetValueHelpTexts();
247
248
  for (const listener of resetListeners) listener();
248
249
  }
249
250
  /**
@@ -106,8 +106,9 @@ declare function getMetaTableDef(entry: MetaCacheEntry, texts?: Pick<UiTexts, "l
106
106
  * Drop every cached `/meta` — including the copy each cached `Client`
107
107
  * memoizes and the `@atscript/db-client` meta stores used to revalidate it
108
108
  * (the shared default one and any custom one a factory supplied) — the
109
- * value-help searches shared under them, and everything registered through
110
- * {@link onMetaCacheReset} (e.g. the table-presets cache). Entries already
109
+ * value-help searches shared under them, the texts of codes read from the
110
+ * dictionaries and the labels resolved for their bindings, and everything
111
+ * registered through {@link onMetaCacheReset} (e.g. the table-presets cache). Entries already
111
112
  * handed out keep working; the next `getMetaEntry` refetches.
112
113
  */
113
114
  declare function resetMetaCache(): void;