@atscript/vue-form 0.1.206 → 0.1.207

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 (209) hide show
  1. package/dist/{as-action-rT6WXLph.cjs → as-action-BGIbuTxh.cjs} +3 -3
  2. package/dist/{as-action-kBskX68v.mjs → as-action-CPQ64nNi.mjs} +3 -3
  3. package/dist/as-action.cjs +1 -1
  4. package/dist/as-action.d.cts +1 -1
  5. package/dist/as-action.d.mts +1 -1
  6. package/dist/as-action.mjs +1 -1
  7. package/dist/{as-action.vue-B7RrjGhF.d.cts → as-action.vue-BjGc3z94.d.mts} +1 -1
  8. package/dist/{as-action.vue-Dtez-EWu.d.mts → as-action.vue-wGCmd-ww.d.cts} +1 -1
  9. package/dist/{as-array-C5lqDDLN.cjs → as-array-BCmGCZul.cjs} +10 -10
  10. package/dist/{as-array-Tt_4kl5r.mjs → as-array-CHVronOS.mjs} +10 -10
  11. package/dist/{as-array-clear-btn-Dk88CYmS.cjs → as-array-clear-btn-BolX7Wpe.cjs} +1 -1
  12. package/dist/{as-array-clear-btn-DGUQY_7_.mjs → as-array-clear-btn-DOBKhLCy.mjs} +1 -1
  13. package/dist/as-array.cjs +1 -1
  14. package/dist/as-array.d.cts +1 -1
  15. package/dist/as-array.d.mts +1 -1
  16. package/dist/as-array.mjs +1 -1
  17. package/dist/{as-array.vue-Ca_xan2n.d.mts → as-array.vue-BB22gE0u.d.cts} +1 -1
  18. package/dist/{as-array.vue-Dp_zd3ZM.d.cts → as-array.vue-CgYp_DSb.d.mts} +1 -1
  19. package/dist/{as-checkbox-D7NywgIa.cjs → as-checkbox-BKWtScvS.cjs} +7 -17
  20. package/dist/{as-checkbox-CCX9E19U.mjs → as-checkbox-BX5N5GHR.mjs} +7 -17
  21. package/dist/as-checkbox.cjs +1 -1
  22. package/dist/as-checkbox.d.cts +1 -1
  23. package/dist/as-checkbox.d.mts +1 -1
  24. package/dist/as-checkbox.mjs +1 -1
  25. package/dist/{as-checkbox.vue-BClSBx1g.d.mts → as-checkbox.vue-CQzeu4IP.d.mts} +1 -1
  26. package/dist/{as-checkbox.vue-Bf3qqcKu.d.cts → as-checkbox.vue-RTW5hwvE.d.cts} +1 -1
  27. package/dist/as-collapsible.cjs +1 -1
  28. package/dist/as-collapsible.d.cts +1 -1
  29. package/dist/as-collapsible.d.mts +1 -1
  30. package/dist/as-collapsible.mjs +1 -1
  31. package/dist/{as-collapsible.vue-BXdpM7_K.d.cts → as-collapsible.vue-BKN4DmSy.d.mts} +1 -1
  32. package/dist/{as-collapsible.vue-CUhn1EVX.d.mts → as-collapsible.vue-CPmozkkf.d.cts} +1 -1
  33. package/dist/{as-date-3haOaiAG.mjs → as-date-Bkrp2GY4.mjs} +6 -6
  34. package/dist/{as-date-Ubw_1-Ai.cjs → as-date-C6tT9FPz.cjs} +6 -6
  35. package/dist/as-date.cjs +1 -1
  36. package/dist/as-date.d.cts +1 -1
  37. package/dist/as-date.d.mts +1 -1
  38. package/dist/as-date.mjs +1 -1
  39. package/dist/{as-date.vue-B5NWZ5ON.d.cts → as-date.vue-BpfWumrA.d.cts} +1 -1
  40. package/dist/{as-date.vue-CJQOrfj3.d.mts → as-date.vue-DJ125nVS.d.mts} +1 -1
  41. package/dist/{as-datetime--7bl-yGW.cjs → as-datetime-DWLW4W7O.cjs} +6 -6
  42. package/dist/{as-datetime-BTekpasP.mjs → as-datetime-Dt_AWrCG.mjs} +6 -6
  43. package/dist/as-datetime.cjs +1 -1
  44. package/dist/as-datetime.d.cts +1 -1
  45. package/dist/as-datetime.d.mts +1 -1
  46. package/dist/as-datetime.mjs +1 -1
  47. package/dist/{as-datetime.vue-BvmFdGxe.d.cts → as-datetime.vue-DO3tkof1.d.cts} +1 -1
  48. package/dist/{as-datetime.vue-CzMz_RUy.d.mts → as-datetime.vue-DfFAaVdS.d.mts} +1 -1
  49. package/dist/{as-decimal-7CIE6UKX.mjs → as-decimal-BUr24VTI.mjs} +5 -5
  50. package/dist/{as-decimal-DWPRXsYY.cjs → as-decimal-DuWZDjbg.cjs} +5 -5
  51. package/dist/as-decimal.cjs +1 -1
  52. package/dist/as-decimal.d.cts +1 -1
  53. package/dist/as-decimal.d.mts +1 -1
  54. package/dist/as-decimal.mjs +1 -1
  55. package/dist/{as-decimal.vue-DdVqHtMT.d.cts → as-decimal.vue-BODauGXK.d.mts} +1 -1
  56. package/dist/{as-decimal.vue-DyDt1ds0.d.mts → as-decimal.vue-C42_-oK9.d.cts} +1 -1
  57. package/dist/{as-field-jh5AWref.mjs → as-field-iQ2H3VGd.mjs} +30 -42
  58. package/dist/{as-field-DAClnYiP.cjs → as-field-lMMfms8d.cjs} +29 -41
  59. package/dist/{as-field-shell-Cu8jxZYj.cjs → as-field-shell-BPesuJKa.cjs} +6 -6
  60. package/dist/{as-field-shell-DPzfvPo0.mjs → as-field-shell-QMsYyJ8r.mjs} +6 -6
  61. package/dist/as-field-shell.cjs +1 -1
  62. package/dist/as-field-shell.d.cts +1 -1
  63. package/dist/as-field-shell.d.mts +1 -1
  64. package/dist/as-field-shell.mjs +1 -1
  65. package/dist/{as-field-shell.vue-CPy2uA-b.d.mts → as-field-shell.vue-CQqwykWy.d.cts} +1 -1
  66. package/dist/{as-field-shell.vue-D-8AWUGW.d.cts → as-field-shell.vue-o7T2u4aw.d.mts} +1 -1
  67. package/dist/as-field.cjs +1 -1
  68. package/dist/as-field.d.mts +1 -1
  69. package/dist/as-field.mjs +1 -1
  70. package/dist/{as-form-B8d1MVTB.mjs → as-form-CuMRP5aZ.mjs} +26 -9
  71. package/dist/{as-form-r5pkXt5U.cjs → as-form-DE3TVGV-.cjs} +25 -8
  72. package/dist/as-form.cjs +1 -1
  73. package/dist/as-form.d.cts +1 -1
  74. package/dist/as-form.d.mts +1 -1
  75. package/dist/as-form.mjs +1 -1
  76. package/dist/{as-form.vue-BvRHy6mu.d.cts → as-form.vue-B9MZrw7V.d.cts} +16 -38
  77. package/dist/{as-form.vue-D1AS3Xf6.d.mts → as-form.vue-DwqofFJa.d.mts} +16 -38
  78. package/dist/{as-input-tKw19JnF.mjs → as-input-BEP6nX82.mjs} +6 -6
  79. package/dist/{as-input-BTbu0eF-.cjs → as-input-BrgRxZag.cjs} +6 -6
  80. package/dist/{as-input-control-1igViaqC.mjs → as-input-control-CINIJm-h.mjs} +13 -5
  81. package/dist/{as-input-control-uJpmle-G.cjs → as-input-control-DXJBrgih.cjs} +13 -5
  82. package/dist/as-input.cjs +1 -1
  83. package/dist/as-input.d.cts +1 -1
  84. package/dist/as-input.d.mts +1 -1
  85. package/dist/as-input.mjs +1 -1
  86. package/dist/{as-input.vue-CuC3DYeR.d.cts → as-input.vue-Cl8DTJqr.d.cts} +1 -1
  87. package/dist/{as-input.vue-DawR7pA-.d.mts → as-input.vue-CqV91VOb.d.mts} +1 -1
  88. package/dist/{as-iterator-B1o83rKV.mjs → as-iterator-DbCm61j1.mjs} +1 -1
  89. package/dist/{as-iterator-q_w9HBHt.cjs → as-iterator-DeLt7-BO.cjs} +1 -1
  90. package/dist/as-iterator.cjs +1 -1
  91. package/dist/as-iterator.d.mts +1 -1
  92. package/dist/as-iterator.mjs +1 -1
  93. package/dist/{as-multi-select-DPQ9_Qf1.cjs → as-multi-select-CJ3iRsiL.cjs} +4 -4
  94. package/dist/{as-multi-select-DhOlsgdq.mjs → as-multi-select-Ca2ULklw.mjs} +4 -4
  95. package/dist/as-multi-select.cjs +1 -1
  96. package/dist/as-multi-select.d.cts +1 -1
  97. package/dist/as-multi-select.d.mts +1 -1
  98. package/dist/as-multi-select.mjs +1 -1
  99. package/dist/{as-multi-select.vue-CbVBJq8N.d.mts → as-multi-select.vue-B6M_f7u-.d.cts} +1 -1
  100. package/dist/{as-multi-select.vue-CXC47PBk.d.cts → as-multi-select.vue-Cvvy1kMm.d.mts} +1 -1
  101. package/dist/{as-number-CJmX5rb1.cjs → as-number-CHXaKqtg.cjs} +5 -5
  102. package/dist/{as-number-CVjNUjiS.mjs → as-number-CgHRTx6P.mjs} +5 -5
  103. package/dist/as-number.cjs +1 -1
  104. package/dist/as-number.d.cts +1 -1
  105. package/dist/as-number.d.mts +1 -1
  106. package/dist/as-number.mjs +1 -1
  107. package/dist/{as-number.vue-BdNvLZca.d.mts → as-number.vue-5U6oFVJC.d.cts} +1 -1
  108. package/dist/{as-number.vue-hJuiJJ70.d.cts → as-number.vue-BN6_1oQf.d.mts} +1 -1
  109. package/dist/{as-object-DY5IEc94.mjs → as-object-BCeBkKCo.mjs} +7 -7
  110. package/dist/{as-object-Dq5CPM3i.cjs → as-object-Babu0BIk.cjs} +7 -7
  111. package/dist/as-object.cjs +1 -1
  112. package/dist/as-object.d.cts +1 -1
  113. package/dist/as-object.d.mts +1 -1
  114. package/dist/as-object.mjs +1 -1
  115. package/dist/{as-object.vue-DHFGLetx.d.cts → as-object.vue-BNCOIwjS.d.mts} +1 -1
  116. package/dist/{as-object.vue-DVK_BKOL.d.mts → as-object.vue-BnUdIcLW.d.cts} +1 -1
  117. package/dist/{as-paragraph-CaytophZ.cjs → as-paragraph-DHtc4LrM.cjs} +3 -3
  118. package/dist/{as-paragraph-ChOqmJe2.mjs → as-paragraph-ScTsCm_J.mjs} +3 -3
  119. package/dist/as-paragraph.cjs +1 -1
  120. package/dist/as-paragraph.d.cts +1 -1
  121. package/dist/as-paragraph.d.mts +1 -1
  122. package/dist/as-paragraph.mjs +1 -1
  123. package/dist/{as-paragraph.vue-6mBonWFb.d.mts → as-paragraph.vue-80Q1bZMd.d.cts} +1 -1
  124. package/dist/{as-paragraph.vue-B_aPmK-B.d.cts → as-paragraph.vue-Dhy9ke_Z.d.mts} +1 -1
  125. package/dist/{as-radio-C6PnEdjD.cjs → as-radio-BFM_CPvW.cjs} +4 -4
  126. package/dist/{as-radio-BW9K8h6V.mjs → as-radio-CL6Np-X5.mjs} +4 -4
  127. package/dist/as-radio.cjs +1 -1
  128. package/dist/as-radio.d.cts +1 -1
  129. package/dist/as-radio.d.mts +1 -1
  130. package/dist/as-radio.mjs +1 -1
  131. package/dist/{as-radio.vue-BFxeAHfl.d.mts → as-radio.vue-ByorW-nk.d.cts} +1 -1
  132. package/dist/{as-radio.vue-B_tDoVl1.d.cts → as-radio.vue-CLdvEAmZ.d.mts} +1 -1
  133. package/dist/{as-ref-DTsWT_zU.cjs → as-ref-CEj1RBnH.cjs} +14 -14
  134. package/dist/{as-ref-CXtYo-UZ.mjs → as-ref-D14yC6np.mjs} +14 -14
  135. package/dist/as-ref.cjs +1 -1
  136. package/dist/as-ref.d.cts +1 -1
  137. package/dist/as-ref.d.mts +1 -1
  138. package/dist/as-ref.mjs +1 -1
  139. package/dist/{as-ref.vue-CqFDKTYk.d.mts → as-ref.vue--ISeV6VM.d.cts} +1 -1
  140. package/dist/{as-ref.vue-gCsaCDQx.d.cts → as-ref.vue-DW7vsBE6.d.mts} +1 -1
  141. package/dist/{as-select-DOvo86Oc.cjs → as-select-B-ZeOCu5.cjs} +7 -16
  142. package/dist/{as-select-CbZNupL6.mjs → as-select-BME-vti2.mjs} +8 -17
  143. package/dist/as-select.cjs +1 -1
  144. package/dist/as-select.d.cts +1 -1
  145. package/dist/as-select.d.mts +1 -1
  146. package/dist/as-select.mjs +1 -1
  147. package/dist/{as-select.vue-BN3zvSGs.d.mts → as-select.vue-BEfTkycX.d.cts} +1 -1
  148. package/dist/{as-select.vue-Bh7ppdg9.d.cts → as-select.vue-C45NS5Rq.d.mts} +1 -1
  149. package/dist/{as-time-CfnhY3Pf.cjs → as-time-CnuojSkh.cjs} +6 -6
  150. package/dist/{as-time-BDpnkjy8.mjs → as-time-HRZh7pdx.mjs} +6 -6
  151. package/dist/as-time.cjs +1 -1
  152. package/dist/as-time.d.cts +1 -1
  153. package/dist/as-time.d.mts +1 -1
  154. package/dist/as-time.mjs +1 -1
  155. package/dist/{as-time.vue-C-ruJhmX.d.mts → as-time.vue--Qmcr-O0.d.cts} +1 -1
  156. package/dist/{as-time.vue-C_0z-HOS.d.cts → as-time.vue-0M0m0DXe.d.mts} +1 -1
  157. package/dist/{as-tuple-C5_dcvsH.cjs → as-tuple-XpcKK1LK.cjs} +8 -8
  158. package/dist/{as-tuple--wL64cCu.mjs → as-tuple-qHmf6fwJ.mjs} +8 -8
  159. package/dist/as-tuple.cjs +1 -1
  160. package/dist/as-tuple.d.cts +1 -1
  161. package/dist/as-tuple.d.mts +1 -1
  162. package/dist/as-tuple.mjs +1 -1
  163. package/dist/{as-tuple.vue-BDiSN-np.d.cts → as-tuple.vue-CKbx_YFz.d.mts} +1 -1
  164. package/dist/{as-tuple.vue-CGWun6Iw.d.mts → as-tuple.vue-Di5D2HD4.d.cts} +1 -1
  165. package/dist/{as-union-DAnpGBeK.mjs → as-union-Ca5o9xw2.mjs} +7 -7
  166. package/dist/{as-union-D3NoKN1H.cjs → as-union-CwB0ACpI.cjs} +7 -7
  167. package/dist/as-union.cjs +1 -1
  168. package/dist/as-union.d.cts +1 -1
  169. package/dist/as-union.d.mts +1 -1
  170. package/dist/as-union.mjs +1 -1
  171. package/dist/{as-union.vue-BpcREl7L.d.mts → as-union.vue-UnG0zG81.d.cts} +1 -1
  172. package/dist/{as-union.vue-DuUeLY1X.d.cts → as-union.vue-eGlHN_hp.d.mts} +1 -1
  173. package/dist/{as-variant-picker-CihlFH-c.mjs → as-variant-picker-CKSLKefM.mjs} +2 -2
  174. package/dist/{as-variant-picker-CpCxKFtT.cjs → as-variant-picker-CceIhZUk.cjs} +2 -2
  175. package/dist/index.cjs +29 -27
  176. package/dist/index.d.cts +23 -23
  177. package/dist/index.d.mts +25 -25
  178. package/dist/index.mjs +29 -28
  179. package/dist/locale.cjs +2 -0
  180. package/dist/locale.d.cts +2 -2
  181. package/dist/locale.d.mts +2 -2
  182. package/dist/locale.mjs +2 -1
  183. package/dist/{types-271BUWyf.d.mts → types-C5Gx4ZuF.d.mts} +86 -8
  184. package/dist/{types-DbjorSCn.d.cts → types-D23g9Vs-.d.cts} +86 -8
  185. package/dist/{use-as-date-iSu5NS79.mjs → use-as-date-B2hKWXAl.mjs} +3 -3
  186. package/dist/{use-as-date-BigwPKEs.cjs → use-as-date-BWJbi_j2.cjs} +3 -3
  187. package/dist/{use-as-value-help-DE8KCbqo.mjs → use-as-value-help-B5yNO1tE.mjs} +45 -28
  188. package/dist/{use-as-value-help-CQMUkP1r.cjs → use-as-value-help-ZR_BvS0L.cjs} +48 -25
  189. package/dist/{use-as-locale-D4NDG8Vg.d.mts → use-value-help-texts-BL1qfGA2.d.cts} +26 -2
  190. package/dist/use-value-help-texts-LySFdZya.mjs +52 -0
  191. package/dist/{use-as-locale-CtvT6oO5.d.cts → use-value-help-texts-fzgKU4NG.d.mts} +26 -2
  192. package/dist/use-value-help-texts-ikiPKy-U.cjs +57 -0
  193. package/package.json +9 -9
  194. /package/dist/{_editing-hold-D2uqwszu.cjs → _editing-hold-DbM25sc_.cjs} +0 -0
  195. /package/dist/{_editing-hold-D_X5gXHh.mjs → _editing-hold-s65mkJu2.mjs} +0 -0
  196. /package/dist/{_shape-A661ZxnJ.mjs → _shape-CnW2sBRs.mjs} +0 -0
  197. /package/dist/{_shape-7OdPsQao.cjs → _shape-DPDZTV_T.cjs} +0 -0
  198. /package/dist/{as-adornment-shell-CBaksXGT.mjs → as-adornment-shell-C_z_q-mz.mjs} +0 -0
  199. /package/dist/{as-adornment-shell-CmS9BOFm.cjs → as-adornment-shell-CgwCACXA.cjs} +0 -0
  200. /package/dist/{as-collapsible-CvBoWb0D.mjs → as-collapsible-B9KPgJyo.mjs} +0 -0
  201. /package/dist/{as-collapsible-CTOLQ3IK.cjs → as-collapsible-C37-3_Rp.cjs} +0 -0
  202. /package/dist/{as-field.vue-BWaTLJd6.d.mts → as-field.vue-BMg2Ep8h.d.mts} +0 -0
  203. /package/dist/{as-iterator.vue-BUCohjxw.d.mts → as-iterator.vue-BdUxcovH.d.mts} +0 -0
  204. /package/dist/{use-as-model-texts-C3V56UDt.cjs → use-as-model-texts-BSFCEwAa.cjs} +0 -0
  205. /package/dist/{use-as-model-texts-Cpx5bHJQ.mjs → use-as-model-texts-BXSEzUWJ.mjs} +0 -0
  206. /package/dist/{use-as-optional-add-flow-DMDd4Ms0.cjs → use-as-optional-add-flow-CsUjhfkc.cjs} +0 -0
  207. /package/dist/{use-as-optional-add-flow-C1Ol6KO2.mjs → use-as-optional-add-flow-WA-R6yXz.mjs} +0 -0
  208. /package/dist/{variant-label-_GLezszT.cjs → variant-label-CSzBE4T6.cjs} +0 -0
  209. /package/dist/{variant-label-CmzTQC2B.mjs → variant-label-Drm3s-28.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { Component, ComputedRef, Ref } from "vue";
2
- import { ClientFactory, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
2
+ import { ClientFactory, DisplayValueOptions, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
3
3
 
4
4
  //#region src/composables/use-as-form-patch.d.ts
5
5
  /**
@@ -162,7 +162,77 @@ interface TFormState {
162
162
  freshFields: Set<symbol>;
163
163
  register: (id: symbol, registration: TFormFieldRegistration) => void;
164
164
  unregister: (id: symbol) => void;
165
+ /**
166
+ * The text `value` of `field` shows as where a field shows it as text — a
167
+ * read-only field, the reference field while not focused (since 0.1.207):
168
+ * `displayValue` with the field's own options (`opts.options`), its
169
+ * `@ui.valueLabel` sibling's text (`opts.siblingText`) and, on a field bound
170
+ * to a dictionary (`field.valueHelpInfo`: `@db.rel.FK` or `@ui.valueHelp`)
171
+ * whose binding declares a label, the dictionary row's text — read by key
172
+ * through the form's client factory, the code alone until it arrives; else
173
+ * the value as text, `""` for none. Reactive. Call it where the text shows:
174
+ * the dictionary is read only then. `useAsData().displayText` — also the
175
+ * `<AsForm>` slot's and `useAsForm`'s — reads the sibling for you; `AsField`
176
+ * hands its result to every control as `displayText`.
177
+ */
178
+ displayText: (field: {
179
+ valueHelpInfo?: ValueHelpInfo;
180
+ }, value: unknown, opts?: TFormDisplayTextOptions) => string;
165
181
  }
182
+ /** What `TFormState.displayText` reads besides the field and the value. Since 0.1.207. */
183
+ interface TFormDisplayTextOptions {
184
+ /**
185
+ * The field's own options (`@ui.form.options`, `@ui.form.fn.options`, a
186
+ * literal union's) — not the dictionary rows a dropdown lists: a code shows
187
+ * with its dictionary text, as in a table.
188
+ */
189
+ options?: readonly TFormEntryOptions[];
190
+ /** The field's `@ui.valueLabel` sibling: its text and arrangement. */
191
+ siblingText?: DisplayValueOptions["siblingText"];
192
+ }
193
+ //#endregion
194
+ //#region src/composables/use-as-data.d.ts
195
+ interface UseAsDataReturn {
196
+ /** Domain data (the unwrapped inner value of the form's `{ value }` container). */
197
+ rootData: ComputedRef<unknown>;
198
+ /** Read the value at an absolute dotted path inside the form. */
199
+ getValueAt: (path: string) => ComputedRef<unknown>;
200
+ /** Read a sibling field's value relative to the current `useAsPath()` prefix. */
201
+ siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
202
+ /**
203
+ * Write the value at an absolute dotted path inside the form (missing
204
+ * containers are created: an array where the next segment is an index,
205
+ * else an object; an empty form root too). The write is a committed edit:
206
+ * change tracking sees it, the field at that path re-validates like one the
207
+ * user changed, and `AsForm` emits `change` with type `"update"`. Outside a
208
+ * form, a no-op.
209
+ */
210
+ setValueAt: (path: string, value: unknown) => void;
211
+ /**
212
+ * Write a sibling field's value, relative to the current `useAsPath()`
213
+ * prefix — e.g. a custom picker filling the fields next to it. Same rules
214
+ * as `setValueAt`.
215
+ */
216
+ setSibling: (name: string, value: unknown) => void;
217
+ /**
218
+ * The text `value` of `field` shows as (`TFormState.displayText`, since
219
+ * 0.1.207), with the field's own `options` and its `@ui.valueLabel` sibling
220
+ * read next to it — what `AsField` hands a control as `displayText`, for a
221
+ * custom control; the `<AsForm>` slot's and `useAsForm`'s are the same.
222
+ * Call it where the text shows: a dictionary text is read only then.
223
+ * Outside a form, `""`.
224
+ */
225
+ displayText: (field: Pick<FormFieldDef, "path" | "prop" | "valueHelpInfo">, value: unknown, options?: readonly TFormEntryOptions[]) => string;
226
+ }
227
+ /**
228
+ * Reactive access to form data at any point in the `<AsForm>` tree: readers
229
+ * plus `setValueAt` / `setSibling` writers. Outside a form, all readers
230
+ * return `undefined` and the writers do nothing.
231
+ *
232
+ * Call sites get a `ComputedRef` so they can compose it directly with
233
+ * other reactive primitives without an extra `computed()` wrapper.
234
+ */
235
+ declare function useAsData(): UseAsDataReturn;
166
236
  //#endregion
167
237
  //#region src/composables/use-as-form.d.ts
168
238
  /**
@@ -354,6 +424,11 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
354
424
  getPatch: (opts?: FormDiffOptions) => Record<string, unknown>; /** Build the per-field change list on demand (`[]` when tracking is off). */
355
425
  getChanges: () => FormFieldChange[]; /** Per-field dirty predicate (`false` for every path when tracking is off). */
356
426
  isDirtyPath: (path: string) => boolean;
427
+ /**
428
+ * The text a field's value shows as, its `@ui.valueLabel` sibling read
429
+ * from the form's data — `useAsData().displayText`. Since 0.1.207.
430
+ */
431
+ displayText: UseAsDataReturn["displayText"];
357
432
  }>;
358
433
  /**
359
434
  * Change-tracking handle — present ONLY when `trackChanges` is enabled.
@@ -495,13 +570,16 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
495
570
  /** Resolved value-help descriptor for FK ref fields (`@db.rel.FK` → `@db.http.path`). */
496
571
  valueHelp?: ValueHelpInfo;
497
572
  /**
498
- * The value as `@ui.valueLabel` shows it: the code with the text of the
499
- * sibling field the annotation names, arranged (`Berlin (BER)`). Shown by
500
- * read-only text fields and by the reference field while it is not focused;
501
- * an edited field shows the code. `undefined` without the annotation or
502
- * while the value is empty. Since 0.1.190.
573
+ * The field's value as text, as a read-only field shows it
574
+ * (`TFormState.displayText`, since 0.1.207; it replaces `valueLabel`): its
575
+ * option's label, `Yes` / `No`, a code with its text, arranged
576
+ * (`Berlin (BER)`) — its `@ui.valueLabel` sibling's, else its dictionary
577
+ * row's (the code alone until it arrives) — else the value as text; `""`
578
+ * for none. Call it where the text shows — a read-only field, the
579
+ * reference field while it is not focused: the dictionary is read only
580
+ * then, never while the field is edited. Reactive.
503
581
  */
504
- valueLabel?: string;
582
+ displayText: () => string;
505
583
  /** Singular label for array fields (`@ui.form.label.singular`) — used in "Add <singular>" affordances. */
506
584
  singularLabel?: string;
507
585
  /** Stable input element id, suitable for `<label :for>`. Co-resolved with `errorId` / `descId` so a11y wiring is consistent. Always populated by AsField. */
@@ -779,4 +857,4 @@ interface AsFormExposed<TFormData = any> extends Pick<AsFormPatchHandle, "getPat
779
857
  readonly changes: readonly FormFieldChange[];
780
858
  }
781
859
  //#endregion
782
- export { useAsFormPatch as C, RebaseOntoResult as S, TFormFieldCallbacks as _, TAsCollapsibleSlots as a, TFormState as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, TAsFormError as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TFormFieldRegistration as v, AsFormPatchHandle as x, TFormRule as y };
860
+ export { TFormState as C, useAsFormPatch as E, TFormRule as S, RebaseOntoResult as T, useAsData as _, TAsCollapsibleSlots as a, TFormFieldCallbacks as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, UseAsDataReturn as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TAsFormError as v, AsFormPatchHandle as w, TFormFieldRegistration as x, TFormDisplayTextOptions as y };
@@ -1,5 +1,5 @@
1
1
  import { Component, ComputedRef, Ref } from "vue";
2
- import { ClientFactory, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
2
+ import { ClientFactory, DisplayValueOptions, FormDef, FormDiffOptions, FormFieldChange, FormFieldDef, FormRebaseOptions, FormUnionVariant, TFormAction, TFormEntryOptions, TOptionalMode, ValueHelpInfo, ValueHelpScope } from "@atscript/ui";
3
3
 
4
4
  //#region src/composables/use-as-form-patch.d.ts
5
5
  /**
@@ -162,7 +162,77 @@ interface TFormState {
162
162
  freshFields: Set<symbol>;
163
163
  register: (id: symbol, registration: TFormFieldRegistration) => void;
164
164
  unregister: (id: symbol) => void;
165
+ /**
166
+ * The text `value` of `field` shows as where a field shows it as text — a
167
+ * read-only field, the reference field while not focused (since 0.1.207):
168
+ * `displayValue` with the field's own options (`opts.options`), its
169
+ * `@ui.valueLabel` sibling's text (`opts.siblingText`) and, on a field bound
170
+ * to a dictionary (`field.valueHelpInfo`: `@db.rel.FK` or `@ui.valueHelp`)
171
+ * whose binding declares a label, the dictionary row's text — read by key
172
+ * through the form's client factory, the code alone until it arrives; else
173
+ * the value as text, `""` for none. Reactive. Call it where the text shows:
174
+ * the dictionary is read only then. `useAsData().displayText` — also the
175
+ * `<AsForm>` slot's and `useAsForm`'s — reads the sibling for you; `AsField`
176
+ * hands its result to every control as `displayText`.
177
+ */
178
+ displayText: (field: {
179
+ valueHelpInfo?: ValueHelpInfo;
180
+ }, value: unknown, opts?: TFormDisplayTextOptions) => string;
165
181
  }
182
+ /** What `TFormState.displayText` reads besides the field and the value. Since 0.1.207. */
183
+ interface TFormDisplayTextOptions {
184
+ /**
185
+ * The field's own options (`@ui.form.options`, `@ui.form.fn.options`, a
186
+ * literal union's) — not the dictionary rows a dropdown lists: a code shows
187
+ * with its dictionary text, as in a table.
188
+ */
189
+ options?: readonly TFormEntryOptions[];
190
+ /** The field's `@ui.valueLabel` sibling: its text and arrangement. */
191
+ siblingText?: DisplayValueOptions["siblingText"];
192
+ }
193
+ //#endregion
194
+ //#region src/composables/use-as-data.d.ts
195
+ interface UseAsDataReturn {
196
+ /** Domain data (the unwrapped inner value of the form's `{ value }` container). */
197
+ rootData: ComputedRef<unknown>;
198
+ /** Read the value at an absolute dotted path inside the form. */
199
+ getValueAt: (path: string) => ComputedRef<unknown>;
200
+ /** Read a sibling field's value relative to the current `useAsPath()` prefix. */
201
+ siblingValue: <T = unknown>(name: string) => ComputedRef<T | undefined>;
202
+ /**
203
+ * Write the value at an absolute dotted path inside the form (missing
204
+ * containers are created: an array where the next segment is an index,
205
+ * else an object; an empty form root too). The write is a committed edit:
206
+ * change tracking sees it, the field at that path re-validates like one the
207
+ * user changed, and `AsForm` emits `change` with type `"update"`. Outside a
208
+ * form, a no-op.
209
+ */
210
+ setValueAt: (path: string, value: unknown) => void;
211
+ /**
212
+ * Write a sibling field's value, relative to the current `useAsPath()`
213
+ * prefix — e.g. a custom picker filling the fields next to it. Same rules
214
+ * as `setValueAt`.
215
+ */
216
+ setSibling: (name: string, value: unknown) => void;
217
+ /**
218
+ * The text `value` of `field` shows as (`TFormState.displayText`, since
219
+ * 0.1.207), with the field's own `options` and its `@ui.valueLabel` sibling
220
+ * read next to it — what `AsField` hands a control as `displayText`, for a
221
+ * custom control; the `<AsForm>` slot's and `useAsForm`'s are the same.
222
+ * Call it where the text shows: a dictionary text is read only then.
223
+ * Outside a form, `""`.
224
+ */
225
+ displayText: (field: Pick<FormFieldDef, "path" | "prop" | "valueHelpInfo">, value: unknown, options?: readonly TFormEntryOptions[]) => string;
226
+ }
227
+ /**
228
+ * Reactive access to form data at any point in the `<AsForm>` tree: readers
229
+ * plus `setValueAt` / `setSibling` writers. Outside a form, all readers
230
+ * return `undefined` and the writers do nothing.
231
+ *
232
+ * Call sites get a `ComputedRef` so they can compose it directly with
233
+ * other reactive primitives without an extra `computed()` wrapper.
234
+ */
235
+ declare function useAsData(): UseAsDataReturn;
166
236
  //#endregion
167
237
  //#region src/composables/use-as-form.d.ts
168
238
  /**
@@ -354,6 +424,11 @@ interface UseAsFormReturn<TFormData = unknown, TFormContext = unknown> {
354
424
  getPatch: (opts?: FormDiffOptions) => Record<string, unknown>; /** Build the per-field change list on demand (`[]` when tracking is off). */
355
425
  getChanges: () => FormFieldChange[]; /** Per-field dirty predicate (`false` for every path when tracking is off). */
356
426
  isDirtyPath: (path: string) => boolean;
427
+ /**
428
+ * The text a field's value shows as, its `@ui.valueLabel` sibling read
429
+ * from the form's data — `useAsData().displayText`. Since 0.1.207.
430
+ */
431
+ displayText: UseAsDataReturn["displayText"];
357
432
  }>;
358
433
  /**
359
434
  * Change-tracking handle — present ONLY when `trackChanges` is enabled.
@@ -495,13 +570,16 @@ interface TAsComponentProps<V = unknown> extends TAsBaseComponentProps {
495
570
  /** Resolved value-help descriptor for FK ref fields (`@db.rel.FK` → `@db.http.path`). */
496
571
  valueHelp?: ValueHelpInfo;
497
572
  /**
498
- * The value as `@ui.valueLabel` shows it: the code with the text of the
499
- * sibling field the annotation names, arranged (`Berlin (BER)`). Shown by
500
- * read-only text fields and by the reference field while it is not focused;
501
- * an edited field shows the code. `undefined` without the annotation or
502
- * while the value is empty. Since 0.1.190.
573
+ * The field's value as text, as a read-only field shows it
574
+ * (`TFormState.displayText`, since 0.1.207; it replaces `valueLabel`): its
575
+ * option's label, `Yes` / `No`, a code with its text, arranged
576
+ * (`Berlin (BER)`) — its `@ui.valueLabel` sibling's, else its dictionary
577
+ * row's (the code alone until it arrives) — else the value as text; `""`
578
+ * for none. Call it where the text shows — a read-only field, the
579
+ * reference field while it is not focused: the dictionary is read only
580
+ * then, never while the field is edited. Reactive.
503
581
  */
504
- valueLabel?: string;
582
+ displayText: () => string;
505
583
  /** Singular label for array fields (`@ui.form.label.singular`) — used in "Add <singular>" affordances. */
506
584
  singularLabel?: string;
507
585
  /** Stable input element id, suitable for `<label :for>`. Co-resolved with `errorId` / `descId` so a11y wiring is consistent. Always populated by AsField. */
@@ -779,4 +857,4 @@ interface AsFormExposed<TFormData = any> extends Pick<AsFormPatchHandle, "getPat
779
857
  readonly changes: readonly FormFieldChange[];
780
858
  }
781
859
  //#endregion
782
- export { useAsFormPatch as C, RebaseOntoResult as S, TFormFieldCallbacks as _, TAsCollapsibleSlots as a, TFormState as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, TAsFormError as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TFormFieldRegistration as v, AsFormPatchHandle as x, TFormRule as y };
860
+ export { TFormState as C, useAsFormPatch as E, TFormRule as S, RebaseOntoResult as T, useAsData as _, TAsCollapsibleSlots as a, TFormFieldCallbacks as b, TAsRefSlotProps as c, TAsFormSubmitResult as d, TAsFormValue as f, UseAsDataReturn as g, useAsForm as h, TAsCollapsibleProps as i, TAsTypeComponents as l, UseAsFormReturn as m, TAsBaseComponentProps as n, TAsComponentEmits as o, UseAsFormOptions as p, TAsChangeType as r, TAsComponentProps as s, AsFormExposed as t, TAsUnionContext as u, TAsFormError as v, AsFormPatchHandle as w, TFormFieldRegistration as x, TFormDisplayTextOptions as y };
@@ -153,9 +153,9 @@ var as_date_control_default = /* @__PURE__ */ defineComponent({
153
153
  type: Object,
154
154
  required: false
155
155
  },
156
- valueLabel: {
157
- type: String,
158
- required: false
156
+ displayText: {
157
+ type: Function,
158
+ required: true
159
159
  },
160
160
  singularLabel: {
161
161
  type: String,
@@ -153,9 +153,9 @@ var as_date_control_default = /* @__PURE__ */ (0, vue.defineComponent)({
153
153
  type: Object,
154
154
  required: false
155
155
  },
156
- valueLabel: {
157
- type: String,
158
- required: false
156
+ displayText: {
157
+ type: Function,
158
+ required: true
159
159
  },
160
160
  singularLabel: {
161
161
  type: String,
@@ -1,8 +1,27 @@
1
- import { a as CHANGE_HANDLER_KEY, b as ROOT_DATA_KEY, f as FORM_OPTIONAL_KEY, y as PATH_PREFIX_KEY } from "./use-form-context-0FtVVTvf.mjs";
1
+ import { a as CHANGE_HANDLER_KEY, b as ROOT_DATA_KEY, f as FORM_OPTIONAL_KEY, m as FORM_STATE_KEY, y as PATH_PREFIX_KEY } from "./use-form-context-0FtVVTvf.mjs";
2
2
  import { o as useAsTexts, s as useUiLocaleKey } from "./use-as-locale-CznDr-7i.mjs";
3
3
  import { computed, getCurrentScope, inject, onMounted, onScopeDispose, onUnmounted, ref, shallowRef, watch } from "vue";
4
- import { ValueHelpClient, getByPath, getMetaEntry, joinPath, resolveValueHelp, retainMetaEntry, setByPath, valueHelpFills, valueHelpScope } from "@atscript/ui";
4
+ import { getByPath, joinPath, parentPrefix, retainMetaEntry, setByPath, valueHelpFills, valueHelpScope, valueHelpSource, valueLabelOf } from "@atscript/ui";
5
5
  //#region src/composables/use-as-data.ts
6
+ /**
7
+ * {@link UseAsDataReturn.displayText} over `formState`: the field's
8
+ * `@ui.valueLabel` sibling is read through `read` (a data path below where the
9
+ * field's def is rendered) — the one sibling read of `useAsData` and the form's
10
+ * slot (`useAsForm`).
11
+ */
12
+ function fieldDisplayText(formState, read) {
13
+ return (field, value, options) => {
14
+ const label = valueLabelOf(field.prop);
15
+ const siblingText = label && {
16
+ text: read(parentPrefix(field.path) + label.field),
17
+ arrangement: label.arrangement
18
+ };
19
+ return formState.displayText(field, value, {
20
+ options,
21
+ siblingText
22
+ });
23
+ };
24
+ }
6
25
  const EMPTY_PATH = computed(() => "");
7
26
  const EMPTY_DATA = computed(() => void 0);
8
27
  /**
@@ -15,6 +34,7 @@ const EMPTY_DATA = computed(() => void 0);
15
34
  */
16
35
  function useAsData() {
17
36
  const wrapped = inject(ROOT_DATA_KEY, EMPTY_DATA);
37
+ const formState = inject(FORM_STATE_KEY, void 0);
18
38
  const pathPrefix = inject(PATH_PREFIX_KEY, EMPTY_PATH);
19
39
  const handleChange = inject(CHANGE_HANDLER_KEY, void 0);
20
40
  const rootData = computed(() => {
@@ -27,12 +47,13 @@ function useAsData() {
27
47
  return getByPath(w, path);
28
48
  });
29
49
  }
50
+ /** The value of the field `name` below this position. */
51
+ function readSibling(name) {
52
+ const w = wrapped.value;
53
+ return w ? getByPath(w, joinPath(pathPrefix.value, name)) : void 0;
54
+ }
30
55
  function siblingValue(name) {
31
- return computed(() => {
32
- const w = wrapped.value;
33
- if (!w) return void 0;
34
- return getByPath(w, joinPath(pathPrefix.value, name));
35
- });
56
+ return computed(() => readSibling(name));
36
57
  }
37
58
  function setValueAt(path, value) {
38
59
  const w = wrapped.value;
@@ -48,7 +69,8 @@ function useAsData() {
48
69
  getValueAt,
49
70
  siblingValue,
50
71
  setValueAt,
51
- setSibling
72
+ setSibling,
73
+ displayText: formState ? fieldDisplayText(formState, readSibling) : () => ""
52
74
  };
53
75
  }
54
76
  //#endregion
@@ -78,17 +100,17 @@ function useAsValueHelp(options) {
78
100
  const scoped = !!getCurrentScope();
79
101
  const browser = typeof window !== "undefined";
80
102
  let release;
81
- let vhClient;
82
- /**
83
- * Binds the entry of the app's current locale — held while mounted, so
84
- * `kickoff`'s `resolveValueHelp` finds it (and its client).
85
- */
103
+ let source;
104
+ /** Binds the dictionary in the app's current locale — its entry held while mounted. */
86
105
  function bindEntry() {
87
- const entry = getMetaEntry(info.url, injectedFactory, { texts });
106
+ const next = valueHelpSource(info, {
107
+ texts,
108
+ clientFactory: injectedFactory
109
+ });
88
110
  const previous = release;
89
- release = scoped ? retainMetaEntry(entry) : void 0;
111
+ release = scoped ? retainMetaEntry(next.entry) : void 0;
90
112
  previous?.();
91
- vhClient = new ValueHelpClient(entry.client);
113
+ source = next;
92
114
  }
93
115
  if (browser) bindEntry();
94
116
  if (scoped) onScopeDispose(() => release?.());
@@ -97,7 +119,6 @@ function useAsValueHelp(options) {
97
119
  const searchText = ref("");
98
120
  const results = shallowRef([]);
99
121
  const searching = ref(false);
100
- const labelIsFkValue = computed(() => !!resolved.value && info.targetField === resolved.value.labelField);
101
122
  let debounceTimer;
102
123
  let kickoffPromise;
103
124
  /** Bumped per kickoff: a superseded one (a previous locale's) never lands. */
@@ -111,10 +132,8 @@ function useAsValueHelp(options) {
111
132
  async function kickoff() {
112
133
  if (kickoffPromise) return kickoffPromise;
113
134
  const mine = ++kickoffSeq;
114
- kickoffPromise = resolveValueHelp(info.url, {
115
- texts,
116
- clientFactory: injectedFactory
117
- }).then((r) => {
135
+ if (!source) bindEntry();
136
+ kickoffPromise = source.resolve().then((r) => {
118
137
  if (mine !== kickoffSeq) return;
119
138
  resolved.value = r;
120
139
  status.value = "ready";
@@ -140,19 +159,18 @@ function useAsValueHelp(options) {
140
159
  }, DEBOUNCE_MS);
141
160
  }
142
161
  async function doSearch(text) {
143
- const r = resolved.value;
144
- if (!r || !vhClient) return;
162
+ const s = source;
163
+ if (!resolved.value || !s) return;
145
164
  if (text === lastSearchedText) return;
146
165
  lastSearchedText = text;
147
166
  const mine = ++searchSeq;
148
167
  searching.value = true;
149
168
  try {
150
- const result = await vhClient.search(r, {
169
+ const result = await s.search({
151
170
  text: text || void 0,
152
171
  mode: "form",
153
172
  limit,
154
- filter: scope.value.filter,
155
- info
173
+ filter: scope.value.filter
156
174
  });
157
175
  if (mine === searchSeq) results.value = result.items;
158
176
  } catch {
@@ -202,7 +220,6 @@ function useAsValueHelp(options) {
202
220
  searchText,
203
221
  results,
204
222
  searching,
205
- labelIsFkValue,
206
223
  kickoff,
207
224
  selectItem,
208
225
  clear,
@@ -211,4 +228,4 @@ function useAsValueHelp(options) {
211
228
  };
212
229
  }
213
230
  //#endregion
214
- export { useAsValueHelp as n, useAsData as r, CLIENT_FACTORY_KEY as t };
231
+ export { useAsData as i, useAsValueHelp as n, fieldDisplayText as r, CLIENT_FACTORY_KEY as t };
@@ -3,6 +3,25 @@ const require_use_as_locale = require("./use-as-locale-eo7FyfaZ.cjs");
3
3
  let vue = require("vue");
4
4
  let _atscript_ui = require("@atscript/ui");
5
5
  //#region src/composables/use-as-data.ts
6
+ /**
7
+ * {@link UseAsDataReturn.displayText} over `formState`: the field's
8
+ * `@ui.valueLabel` sibling is read through `read` (a data path below where the
9
+ * field's def is rendered) — the one sibling read of `useAsData` and the form's
10
+ * slot (`useAsForm`).
11
+ */
12
+ function fieldDisplayText(formState, read) {
13
+ return (field, value, options) => {
14
+ const label = (0, _atscript_ui.valueLabelOf)(field.prop);
15
+ const siblingText = label && {
16
+ text: read((0, _atscript_ui.parentPrefix)(field.path) + label.field),
17
+ arrangement: label.arrangement
18
+ };
19
+ return formState.displayText(field, value, {
20
+ options,
21
+ siblingText
22
+ });
23
+ };
24
+ }
6
25
  const EMPTY_PATH = (0, vue.computed)(() => "");
7
26
  const EMPTY_DATA = (0, vue.computed)(() => void 0);
8
27
  /**
@@ -15,6 +34,7 @@ const EMPTY_DATA = (0, vue.computed)(() => void 0);
15
34
  */
16
35
  function useAsData() {
17
36
  const wrapped = (0, vue.inject)(require_use_form_context.ROOT_DATA_KEY, EMPTY_DATA);
37
+ const formState = (0, vue.inject)(require_use_form_context.FORM_STATE_KEY, void 0);
18
38
  const pathPrefix = (0, vue.inject)(require_use_form_context.PATH_PREFIX_KEY, EMPTY_PATH);
19
39
  const handleChange = (0, vue.inject)(require_use_form_context.CHANGE_HANDLER_KEY, void 0);
20
40
  const rootData = (0, vue.computed)(() => {
@@ -27,12 +47,13 @@ function useAsData() {
27
47
  return (0, _atscript_ui.getByPath)(w, path);
28
48
  });
29
49
  }
50
+ /** The value of the field `name` below this position. */
51
+ function readSibling(name) {
52
+ const w = wrapped.value;
53
+ return w ? (0, _atscript_ui.getByPath)(w, (0, _atscript_ui.joinPath)(pathPrefix.value, name)) : void 0;
54
+ }
30
55
  function siblingValue(name) {
31
- return (0, vue.computed)(() => {
32
- const w = wrapped.value;
33
- if (!w) return void 0;
34
- return (0, _atscript_ui.getByPath)(w, (0, _atscript_ui.joinPath)(pathPrefix.value, name));
35
- });
56
+ return (0, vue.computed)(() => readSibling(name));
36
57
  }
37
58
  function setValueAt(path, value) {
38
59
  const w = wrapped.value;
@@ -48,7 +69,8 @@ function useAsData() {
48
69
  getValueAt,
49
70
  siblingValue,
50
71
  setValueAt,
51
- setSibling
72
+ setSibling,
73
+ displayText: formState ? fieldDisplayText(formState, readSibling) : () => ""
52
74
  };
53
75
  }
54
76
  //#endregion
@@ -78,17 +100,17 @@ function useAsValueHelp(options) {
78
100
  const scoped = !!(0, vue.getCurrentScope)();
79
101
  const browser = typeof window !== "undefined";
80
102
  let release;
81
- let vhClient;
82
- /**
83
- * Binds the entry of the app's current locale — held while mounted, so
84
- * `kickoff`'s `resolveValueHelp` finds it (and its client).
85
- */
103
+ let source;
104
+ /** Binds the dictionary in the app's current locale — its entry held while mounted. */
86
105
  function bindEntry() {
87
- const entry = (0, _atscript_ui.getMetaEntry)(info.url, injectedFactory, { texts });
106
+ const next = (0, _atscript_ui.valueHelpSource)(info, {
107
+ texts,
108
+ clientFactory: injectedFactory
109
+ });
88
110
  const previous = release;
89
- release = scoped ? (0, _atscript_ui.retainMetaEntry)(entry) : void 0;
111
+ release = scoped ? (0, _atscript_ui.retainMetaEntry)(next.entry) : void 0;
90
112
  previous?.();
91
- vhClient = new _atscript_ui.ValueHelpClient(entry.client);
113
+ source = next;
92
114
  }
93
115
  if (browser) bindEntry();
94
116
  if (scoped) (0, vue.onScopeDispose)(() => release?.());
@@ -97,7 +119,6 @@ function useAsValueHelp(options) {
97
119
  const searchText = (0, vue.ref)("");
98
120
  const results = (0, vue.shallowRef)([]);
99
121
  const searching = (0, vue.ref)(false);
100
- const labelIsFkValue = (0, vue.computed)(() => !!resolved.value && info.targetField === resolved.value.labelField);
101
122
  let debounceTimer;
102
123
  let kickoffPromise;
103
124
  /** Bumped per kickoff: a superseded one (a previous locale's) never lands. */
@@ -111,10 +132,8 @@ function useAsValueHelp(options) {
111
132
  async function kickoff() {
112
133
  if (kickoffPromise) return kickoffPromise;
113
134
  const mine = ++kickoffSeq;
114
- kickoffPromise = (0, _atscript_ui.resolveValueHelp)(info.url, {
115
- texts,
116
- clientFactory: injectedFactory
117
- }).then((r) => {
135
+ if (!source) bindEntry();
136
+ kickoffPromise = source.resolve().then((r) => {
118
137
  if (mine !== kickoffSeq) return;
119
138
  resolved.value = r;
120
139
  status.value = "ready";
@@ -140,19 +159,18 @@ function useAsValueHelp(options) {
140
159
  }, DEBOUNCE_MS);
141
160
  }
142
161
  async function doSearch(text) {
143
- const r = resolved.value;
144
- if (!r || !vhClient) return;
162
+ const s = source;
163
+ if (!resolved.value || !s) return;
145
164
  if (text === lastSearchedText) return;
146
165
  lastSearchedText = text;
147
166
  const mine = ++searchSeq;
148
167
  searching.value = true;
149
168
  try {
150
- const result = await vhClient.search(r, {
169
+ const result = await s.search({
151
170
  text: text || void 0,
152
171
  mode: "form",
153
172
  limit,
154
- filter: scope.value.filter,
155
- info
173
+ filter: scope.value.filter
156
174
  });
157
175
  if (mine === searchSeq) results.value = result.items;
158
176
  } catch {
@@ -202,7 +220,6 @@ function useAsValueHelp(options) {
202
220
  searchText,
203
221
  results,
204
222
  searching,
205
- labelIsFkValue,
206
223
  kickoff,
207
224
  selectItem,
208
225
  clear,
@@ -217,6 +234,12 @@ Object.defineProperty(exports, "CLIENT_FACTORY_KEY", {
217
234
  return CLIENT_FACTORY_KEY;
218
235
  }
219
236
  });
237
+ Object.defineProperty(exports, "fieldDisplayText", {
238
+ enumerable: true,
239
+ get: function() {
240
+ return fieldDisplayText;
241
+ }
242
+ });
220
243
  Object.defineProperty(exports, "useAsData", {
221
244
  enumerable: true,
222
245
  get: function() {
@@ -1,5 +1,5 @@
1
1
  import { App, ComputedRef, ShallowRef } from "vue";
2
- import { UiT, UiTexts, UiTranslate } from "@atscript/ui";
2
+ import { ClientFactory, UiT, UiTexts, UiTranslate, ValueHelpInfo, ValueHelpTextOptions, ValueText } from "@atscript/ui";
3
3
 
4
4
  //#region src/composables/use-as-locale.d.ts
5
5
  /**
@@ -83,4 +83,28 @@ declare function useAsLocale(): UseAsLocaleReturn;
83
83
  */
84
84
  declare function useUiLocaleKey(texts: Pick<UiTexts, "locale">): ShallowRef<string | undefined>;
85
85
  //#endregion
86
- export { provideAsLocale as a, useAsTexts as c, injectAsTexts as i, useUiLocaleKey as l, UseAsLocaleReturn as n, provideAsServedTexts as o, getAsServedTexts as r, useAsLocale as s, AsServedTexts as t };
86
+ //#region src/composables/use-value-help-texts.d.ts
87
+ interface UseValueHelpTextsReturn {
88
+ /**
89
+ * The dictionary text of a code in `field` — a column or a form field bound
90
+ * by `valueHelpInfo` (`valueHelpText`) — read in the app's UI locale through
91
+ * the host's client factory; `undefined` for an unbound one. Reactive: a
92
+ * computed or a render that calls it runs again when the binding's texts
93
+ * arrive. `opts.peek`: only a text already read, asking nothing (a value
94
+ * still being typed).
95
+ */
96
+ text: (field: {
97
+ valueHelpInfo?: ValueHelpInfo;
98
+ }, value: unknown, opts?: Pick<ValueHelpTextOptions, "peek">) => ValueText | undefined;
99
+ /** Loads the texts of `values` in one batched read (`loadValueHelpTexts`); never rejects. */
100
+ load: (info: ValueHelpInfo, values: Iterable<unknown>) => Promise<void>;
101
+ }
102
+ /**
103
+ * The texts of codes bound to a dictionary, for a Vue host — a table's or a
104
+ * form's root wires them once and hands them to its parts (since 0.1.207).
105
+ * `clientFactory`: the host's (a table's or a form's), so texts are read the
106
+ * way its pickers search. Call in `setup` (it reads the app's UI texts).
107
+ */
108
+ declare function useValueHelpTexts(clientFactory?: ClientFactory): UseValueHelpTextsReturn;
109
+ //#endregion
110
+ export { getAsServedTexts as a, provideAsServedTexts as c, useUiLocaleKey as d, UseAsLocaleReturn as i, useAsLocale as l, useValueHelpTexts as n, injectAsTexts as o, AsServedTexts as r, provideAsLocale as s, UseValueHelpTextsReturn as t, useAsTexts as u };