@kinetis/vector-ui 0.14.0 → 0.15.0

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 (236) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/app/components/Vx/Cell/BooleanGroup.vue +20 -0
  3. package/app/components/Vx/Cell/Country.vue +13 -0
  4. package/app/components/Vx/Cell/Json.vue +2 -8
  5. package/app/components/Vx/Cell/Repeater.vue +64 -0
  6. package/app/components/Vx/Cell/Select.vue +26 -0
  7. package/app/components/Vx/Cell/Tag.vue +15 -0
  8. package/app/components/Vx/CommandPalette.vue +5 -2
  9. package/app/components/Vx/Import/Dialog.vue +2 -1
  10. package/app/components/Vx/Input/BooleanGroup.vue +39 -0
  11. package/app/components/Vx/Input/Country.vue +14 -0
  12. package/app/components/Vx/Input/Json.vue +63 -0
  13. package/app/components/Vx/Input/Repeater.vue +142 -35
  14. package/app/components/Vx/Input/Select.vue +31 -0
  15. package/app/components/Vx/Input/Tag.vue +47 -0
  16. package/app/components/Vx/Input/Textarea.vue +0 -1
  17. package/app/components/Vx/Layout.vue +1 -1
  18. package/app/components/Vx/List/BulkEdit.vue +2 -1
  19. package/app/components/Vx/List/FilterBar.vue +25 -5
  20. package/app/components/Vx/Resource/Audit.vue +2 -1
  21. package/app/components/Vx/Resource/Form.vue +13 -10
  22. package/app/composables/useVectorCountryNames.ts +38 -0
  23. package/app/composables/useVectorFields.ts +5 -1
  24. package/app/composables/useVectorForm.ts +27 -3
  25. package/app/composables/useVectorInputs.ts +7 -5
  26. package/app/i18n/ar/fields.ts +15 -0
  27. package/app/i18n/ar/list.ts +2 -0
  28. package/app/i18n/de/fields.ts +15 -0
  29. package/app/i18n/de/list.ts +2 -0
  30. package/app/i18n/en/fields.ts +15 -0
  31. package/app/i18n/en/list.ts +2 -0
  32. package/app/i18n/es/fields.ts +15 -0
  33. package/app/i18n/es/list.ts +2 -0
  34. package/app/i18n/fr/fields.ts +15 -0
  35. package/app/i18n/fr/list.ts +2 -0
  36. package/app/i18n/he/fields.ts +15 -0
  37. package/app/i18n/he/list.ts +2 -0
  38. package/app/i18n/it/fields.ts +15 -0
  39. package/app/i18n/it/list.ts +2 -0
  40. package/app/i18n/ja/fields.ts +15 -0
  41. package/app/i18n/ja/list.ts +2 -0
  42. package/app/i18n/ko/fields.ts +15 -0
  43. package/app/i18n/ko/list.ts +2 -0
  44. package/app/i18n/nl/fields.ts +15 -0
  45. package/app/i18n/nl/list.ts +2 -0
  46. package/app/i18n/pl/fields.ts +15 -0
  47. package/app/i18n/pl/list.ts +2 -0
  48. package/app/i18n/pt/fields.ts +15 -0
  49. package/app/i18n/pt/list.ts +2 -0
  50. package/app/i18n/pt-BR/fields.ts +15 -0
  51. package/app/i18n/pt-BR/list.ts +2 -0
  52. package/app/i18n/ru/fields.ts +15 -0
  53. package/app/i18n/ru/list.ts +2 -0
  54. package/app/i18n/tr/fields.ts +15 -0
  55. package/app/i18n/tr/list.ts +2 -0
  56. package/app/i18n/uk/fields.ts +15 -0
  57. package/app/i18n/uk/list.ts +2 -0
  58. package/app/i18n/zh-Hans/fields.ts +15 -0
  59. package/app/i18n/zh-Hans/list.ts +2 -0
  60. package/app/types/vector.ts +47 -8
  61. package/app/utils/countries/ar.ts +252 -0
  62. package/app/utils/countries/de.ts +252 -0
  63. package/app/utils/countries/en.ts +252 -0
  64. package/app/utils/countries/es.ts +252 -0
  65. package/app/utils/countries/fr.ts +252 -0
  66. package/app/utils/countries/he.ts +252 -0
  67. package/app/utils/countries/index.ts +44 -0
  68. package/app/utils/countries/it.ts +252 -0
  69. package/app/utils/countries/ja.ts +252 -0
  70. package/app/utils/countries/ko.ts +252 -0
  71. package/app/utils/countries/nl.ts +252 -0
  72. package/app/utils/countries/pl.ts +252 -0
  73. package/app/utils/countries/pt-BR.ts +252 -0
  74. package/app/utils/countries/pt.ts +252 -0
  75. package/app/utils/countries/ru.ts +252 -0
  76. package/app/utils/countries/tr.ts +252 -0
  77. package/app/utils/countries/uk.ts +252 -0
  78. package/app/utils/countries/zh-Hans.ts +252 -0
  79. package/app/utils/internal/repeater.ts +26 -0
  80. package/app/utils/rules.ts +7 -4
  81. package/dist/static/200.html +1 -1
  82. package/dist/static/404.html +1 -1
  83. package/dist/static/_nuxt/{CVGEoUmj.js → 1608Z87P.js} +1 -1
  84. package/dist/static/_nuxt/26EG815s.js +1 -0
  85. package/dist/static/_nuxt/{y5gvPoD3.js → 5DQbzGzQ.js} +1 -1
  86. package/dist/static/_nuxt/6LnFMZ9h.js +1 -0
  87. package/dist/static/_nuxt/{B65UlNtP.js → 81b_JWVP.js} +1 -1
  88. package/dist/static/_nuxt/951AFxTF.js +1 -0
  89. package/dist/static/_nuxt/{DDsQjoa8.js → B-3DkDEW.js} +1 -1
  90. package/dist/static/_nuxt/{BSj4WTjT.js → B-OK38pz.js} +1 -1
  91. package/dist/static/_nuxt/B4lOfJ_0.js +1 -0
  92. package/dist/static/_nuxt/{DwpSsR4l.js → B5Jt7Eqg.js} +1 -1
  93. package/dist/static/_nuxt/{CWfptrnU.js → B9JchbmS.js} +1 -1
  94. package/dist/static/_nuxt/{Dao3p0cp.js → BAH3b61H.js} +1 -1
  95. package/dist/static/_nuxt/BAkfhUIC.js +1 -0
  96. package/dist/static/_nuxt/BAz8wQLD.js +1 -0
  97. package/dist/static/_nuxt/BDoRuUKE.js +1 -0
  98. package/dist/static/_nuxt/{DOEj9Txc.js → BHK5j1Wx.js} +1 -1
  99. package/dist/static/_nuxt/{B-b861aP.js → BJ0_qGcm.js} +1 -1
  100. package/dist/static/_nuxt/BLF1JZGX.js +1 -0
  101. package/dist/static/_nuxt/BLZaIPT-.js +1 -0
  102. package/dist/static/_nuxt/BPF07eww.js +1 -0
  103. package/dist/static/_nuxt/{DGQrzV9s.js → BPXec4rF.js} +1 -1
  104. package/dist/static/_nuxt/BRKbRioI.js +1 -0
  105. package/dist/static/_nuxt/{B2rZ5lwu.js → BRRBOyND.js} +1 -1
  106. package/dist/static/_nuxt/{DHNZ4ANp.js → BTJZEoE6.js} +1 -1
  107. package/dist/static/_nuxt/{XnbMqODk.js → BU7J96HZ.js} +1 -1
  108. package/dist/static/_nuxt/{CE5HzlKJ.js → BUzE9uBK.js} +1 -1
  109. package/dist/static/_nuxt/BV8jrBHa.js +1 -0
  110. package/dist/static/_nuxt/BVtNJY11.js +1 -0
  111. package/dist/static/_nuxt/BW2cAI58.js +1 -0
  112. package/dist/static/_nuxt/{B9s6vEby.js → BXXQNvGc.js} +1 -1
  113. package/dist/static/_nuxt/{DdYMnBKs.js → B_CsPjDm.js} +1 -1
  114. package/dist/static/_nuxt/{CLJSzUt5.js → B_VpcKtj.js} +1 -1
  115. package/dist/static/_nuxt/BaztYiAl.js +1 -0
  116. package/dist/static/_nuxt/{DYPYEI74.js → BfkrLuli.js} +1 -1
  117. package/dist/static/_nuxt/{BQitPbA5.js → Bg7Wm7qC.js} +1 -1
  118. package/dist/static/_nuxt/{B8JL5gwX.js → Bk8atvdO.js} +1 -1
  119. package/dist/static/_nuxt/BklrzIIE.js +1 -0
  120. package/dist/static/_nuxt/Bl60DsIN.js +1 -0
  121. package/dist/static/_nuxt/{Clx69IQe.js → BoceWX8_.js} +1 -1
  122. package/dist/static/_nuxt/BooleanGroup.Ctn8QJv3.css +1 -0
  123. package/dist/static/_nuxt/BqdQqPGG.js +1 -0
  124. package/dist/static/_nuxt/{CFuvN8kq.js → BsHddetz.js} +1 -1
  125. package/dist/static/_nuxt/BtBn_mmM.js +1 -0
  126. package/dist/static/_nuxt/BtWvh8h-.js +1 -0
  127. package/dist/static/_nuxt/ByM6U2Qe.js +1 -0
  128. package/dist/static/_nuxt/C2ZWScju.js +1 -0
  129. package/dist/static/_nuxt/C6doA815.js +1 -0
  130. package/dist/static/_nuxt/CALBeSnc.js +1 -0
  131. package/dist/static/_nuxt/CB2gkR4K.js +1 -0
  132. package/dist/static/_nuxt/CCXHWF63.js +1 -0
  133. package/dist/static/_nuxt/CCnG_04Y.js +1 -0
  134. package/dist/static/_nuxt/CDzeC03e.js +1 -0
  135. package/dist/static/_nuxt/{BJxaGigr.js → CFgMeWCA.js} +1 -1
  136. package/dist/static/_nuxt/CG1HFqc_.js +1 -0
  137. package/dist/static/_nuxt/CGdWq8l5.js +1 -0
  138. package/dist/static/_nuxt/{CSgLLbCN.js → CJCWDpGq.js} +1 -1
  139. package/dist/static/_nuxt/{DcC5rHQt.js → CKfr82y9.js} +1 -1
  140. package/dist/static/_nuxt/CMc4sXE8.js +1 -0
  141. package/dist/static/_nuxt/CMqJrosi.js +1 -0
  142. package/dist/static/_nuxt/{CF_C4t63.js → CRKTuX5e.js} +1 -1
  143. package/dist/static/_nuxt/{tv5vSe5Y.js → CS--aGS9.js} +1 -1
  144. package/dist/static/_nuxt/{BJh6qVAK.js → CVQf7G1i.js} +1 -1
  145. package/dist/static/_nuxt/CVnTGJCS.js +1 -0
  146. package/dist/static/_nuxt/{vbxP0T99.js → CXfD1O41.js} +11 -11
  147. package/dist/static/_nuxt/{DAXm0JlI.js → CZJzNdT8.js} +1 -1
  148. package/dist/static/_nuxt/Cdge5zAy.js +1 -0
  149. package/dist/static/_nuxt/CghQmIiQ.js +2 -0
  150. package/dist/static/_nuxt/{2u7wMpR1.js → Ci8knhX0.js} +1 -1
  151. package/dist/static/_nuxt/CjX9KrPv.js +1 -0
  152. package/dist/static/_nuxt/{Bw6FrC2B.js → CkYhLHis.js} +1 -1
  153. package/dist/static/_nuxt/{Dw7WalTb.js → CrHibPfx.js} +1 -1
  154. package/dist/static/_nuxt/CrVTXZp1.js +2 -0
  155. package/dist/static/_nuxt/CuOAA5sP.js +1 -0
  156. package/dist/static/_nuxt/{Bl4F_9Di.js → CuW09Pf9.js} +1 -1
  157. package/dist/static/_nuxt/D4MxxnmM.js +1 -0
  158. package/dist/static/_nuxt/D52PLnR1.js +1 -0
  159. package/dist/static/_nuxt/DFM4TY5F.js +1 -0
  160. package/dist/static/_nuxt/DG9iSq1o.js +1 -0
  161. package/dist/static/_nuxt/{CRAHgjs4.js → DK-FyJq0.js} +1 -1
  162. package/dist/static/_nuxt/{AbcTnLPe.js → DL-Y-SrR.js} +1 -1
  163. package/dist/static/_nuxt/DMsb54_5.js +2 -0
  164. package/dist/static/_nuxt/{CD5zJmlk.js → DPDKc2ix.js} +1 -1
  165. package/dist/static/_nuxt/DSzAMcFx.js +1 -0
  166. package/dist/static/_nuxt/DTacXreK.js +1 -0
  167. package/dist/static/_nuxt/DXCyzcMc.js +2 -0
  168. package/dist/static/_nuxt/DaThP9To.js +1 -0
  169. package/dist/static/_nuxt/{DryMzf1V.js → DoBDwz9i.js} +1 -1
  170. package/dist/static/_nuxt/{CIcNJyjb.js → Doofu92H.js} +1 -1
  171. package/dist/static/_nuxt/{SacKuioS.js → DvUd-qQE.js} +1 -1
  172. package/dist/static/_nuxt/ETG88Leh.js +1 -0
  173. package/dist/static/_nuxt/{WAarVmAq.js → IeIjl2of.js} +1 -1
  174. package/dist/static/_nuxt/MCKoiB3E.js +1 -0
  175. package/dist/static/_nuxt/{CjYmnU-l.js → NWmnUlHT.js} +1 -1
  176. package/dist/static/_nuxt/QPvezGDN.js +1 -0
  177. package/dist/static/_nuxt/QfM1ukFT.js +1 -0
  178. package/dist/static/_nuxt/RHss5Znh.js +1 -0
  179. package/dist/static/_nuxt/Repeater.Dt7fQjxv.css +1 -0
  180. package/dist/static/_nuxt/Rvt5jKoB.js +1 -0
  181. package/dist/static/_nuxt/{BowgCQje.js → UOMH3sKh.js} +1 -1
  182. package/dist/static/_nuxt/VCombobox.xsOJFBr8.css +1 -0
  183. package/dist/static/_nuxt/Yxj3clqu.js +1 -0
  184. package/dist/static/_nuxt/ZgjlRAd9.js +1 -0
  185. package/dist/static/_nuxt/{_resource_.Q2lVCG-n.css → _resource_.DiGLdv9u.css} +1 -1
  186. package/dist/static/_nuxt/builds/latest.json +1 -1
  187. package/dist/static/_nuxt/builds/meta/691bfc1d-4be7-4e21-9e24-735eb94ef678.json +1 -0
  188. package/dist/static/_nuxt/{CHIGMs2v.js → jFK8N1q6.js} +1 -1
  189. package/dist/static/_nuxt/{DOq2YmIE.js → k4v9WOKm.js} +1 -1
  190. package/dist/static/_nuxt/{yIw8BzU6.js → lSAJcvgX.js} +1 -1
  191. package/dist/static/_nuxt/{B8wNbnS0.js → nJa3B-VU.js} +1 -1
  192. package/dist/static/_nuxt/{Cpel4vlt.js → sjOc3hy9.js} +1 -1
  193. package/dist/static/_nuxt/wFK8Gpv4.js +1 -0
  194. package/dist/static/_nuxt/{HdAGfEVj.js → xCL8Cexv.js} +1 -1
  195. package/dist/static/_nuxt/yks44VUO.js +1 -0
  196. package/dist/static/_nuxt/ypCgn3lo.js +1 -0
  197. package/dist/static/_nuxt/zY76lC6C.js +1 -0
  198. package/dist/static/index.html +1 -1
  199. package/dist/static/jobs/index.html +1 -1
  200. package/dist/static/login/index.html +1 -1
  201. package/dist/static/queues/index.html +1 -1
  202. package/dist/static/settings/index.html +1 -1
  203. package/dist/static/vector-bundle.json +124 -91
  204. package/package.json +1 -1
  205. package/app/components/Vx/Cell/Enum.vue +0 -14
  206. package/app/components/Vx/Input/Enum.vue +0 -21
  207. package/dist/static/_nuxt/-ksGenLl.js +0 -1
  208. package/dist/static/_nuxt/0Q9tQaGZ.js +0 -1
  209. package/dist/static/_nuxt/7hLwEPpo.js +0 -1
  210. package/dist/static/_nuxt/B4hfz7cN.js +0 -1
  211. package/dist/static/_nuxt/BE6e_jlD.js +0 -1
  212. package/dist/static/_nuxt/BFZfZyte.js +0 -1
  213. package/dist/static/_nuxt/BW9qBvMR.js +0 -1
  214. package/dist/static/_nuxt/BWscDCZb.js +0 -1
  215. package/dist/static/_nuxt/BXnWvqRw.js +0 -1
  216. package/dist/static/_nuxt/BcSEGymu.js +0 -2
  217. package/dist/static/_nuxt/Bj-QksVr.js +0 -2
  218. package/dist/static/_nuxt/BuTE4a2w.js +0 -1
  219. package/dist/static/_nuxt/C1y0neXX.js +0 -1
  220. package/dist/static/_nuxt/C52FYB-5.js +0 -1
  221. package/dist/static/_nuxt/CAXk9Oc1.js +0 -1
  222. package/dist/static/_nuxt/CQvUQgZO.js +0 -2
  223. package/dist/static/_nuxt/CXSf4TOH.js +0 -1
  224. package/dist/static/_nuxt/Cf2NM87n.js +0 -1
  225. package/dist/static/_nuxt/D3cIKCPa.js +0 -1
  226. package/dist/static/_nuxt/D3jC5ZAK.js +0 -1
  227. package/dist/static/_nuxt/D3xofh1k.js +0 -1
  228. package/dist/static/_nuxt/DOxWca9k.js +0 -1
  229. package/dist/static/_nuxt/DllQuWrz.js +0 -1
  230. package/dist/static/_nuxt/DvEvjhbF.js +0 -1
  231. package/dist/static/_nuxt/FfebEZGy.js +0 -1
  232. package/dist/static/_nuxt/PqTF-5Vs.js +0 -1
  233. package/dist/static/_nuxt/Repeater.CLIPcHKX.css +0 -1
  234. package/dist/static/_nuxt/bNqxxQg2.js +0 -1
  235. package/dist/static/_nuxt/builds/meta/febd0fe3-67f9-4afd-94c3-97178a3ef2b1.json +0 -1
  236. package/dist/static/_nuxt/rYfJ_RlJ.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,85 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.15.0] - 2026-11-25
11
+
12
+ ### Added
13
+
14
+ - `Vx/Cell/BooleanGroup.vue` and `Vx/Input/BooleanGroup.vue` for
15
+ kinetis/vector's flag group: the labels of the flags that are on as
16
+ chips, and one group of checkboxes whose value is every option key to
17
+ true or false. A new record's group starts with every flag off, or
18
+ as its default turns them on, so a form with no box ticked still
19
+ sends the group; a nullable JSON-mode group without a default starts
20
+ as null.
21
+ - `Vx/Cell/Country.vue` and `Vx/Input/Country.vue`: the Select ones with
22
+ each code named in the UI's language from `utils/countries`, through
23
+ `useVectorCountryNames()`, falling back to the server's English name.
24
+ The filter bar and the command palette name countries the same way,
25
+ and the filter bar offers a flag group's keys and searches a
26
+ searchable field's choices.
27
+ - `Vx/Cell/Select.vue` and `Vx/Input/Select.vue` for kinetis/vector's
28
+ `select` field: a multiple select edits as chips and shows its labels,
29
+ a searchable one (`autocomplete`) is a `v-autocomplete`, and a badge
30
+ (`badge`) or an option with a colour shows as coloured chips.
31
+ - `Vx/Input/Json.vue`: a JSON field's document edited as text, sent as
32
+ the document when it is a valid JSON object or array and flagged
33
+ (`fields.json.invalid`) otherwise.
34
+ - The filter bar offers a multiple select's `any` and `all` operators
35
+ (`list.filter.operators.any`, `list.filter.operators.all`) with a
36
+ choice of its options. The new strings are in every shipped locale.
37
+ - `Vx/Input/Repeater.vue` edits kinetis/vector's `repeater` field in
38
+ both modes: a JSON repeater's rows of its own row fields, or a
39
+ relationship repeater's child rows. Rows are added and removed within
40
+ `min` and `max`, and a `sortable` repeater's rows move by dragging
41
+ their handle or with the arrow keys on it. A row's server errors stay
42
+ on the row. `Vx/Cell/Repeater.vue` counts the rows in a list and
43
+ shows them as a table on a record.
44
+ - `Vx/Cell/Tag.vue` and `Vx/Input/Tag.vue` for the `tag` field: chips,
45
+ and a chips input with the field's suggestions that normalizes as the
46
+ server stores tags. The filter bar takes tags for `any` and `all`.
47
+ New strings (`fields.rows.*`, `fields.tags.*`) are in every shipped
48
+ locale.
49
+
50
+ ### Changed
51
+
52
+ - `VectorFieldType` adds `booleanGroup` and `country`; `VectorField`
53
+ publishes a flag group's `storage` and `flagsSortable`.
54
+ - **Breaking:** the `enum` field type is `select` (`VectorFieldType`,
55
+ the field and input registries, `VectorComputedAs`), and
56
+ `VectorEnumOption` is `VectorSelectOption`. A select without `badge`
57
+ and without colours shows its label as text rather than a chip. An
58
+ app override registered under `enum` in `app.config.vector.fields` or
59
+ `inputs` registers under `select`.
60
+ - **Breaking:** a `json` field's value is the document (an object or an
61
+ array), not JSON text: `Vx/Cell/Json.vue` prints it, and the input is
62
+ `Vx/Input/Json.vue` instead of `Vx/Input/Textarea.vue`.
63
+ - `VectorField` publishes `multiple`, `autocomplete` and `badge`, a
64
+ `json` value type, and the `any` and `all` operators.
65
+ - A form condition's `null` and `nnull` treat an empty list as empty and
66
+ a list holding a value as not, as the server does.
67
+ - `VectorField` publishes `repeater` as `VectorRepeater` (`mode`,
68
+ `sortable`, `orderBy`, `rowFields`) and `tags` as `VectorTags`;
69
+ `VectorFieldType` adds `repeater` and `tag`.
70
+
71
+ ### Removed
72
+
73
+ - **Breaking:** `Vx/Cell/Enum.vue` and `Vx/Input/Enum.vue`; use the
74
+ Select components.
75
+ - **Breaking:** the `hasMany` entry of the input registry. A has-many
76
+ edited in the form is a `repeater` field; an app override registered
77
+ under `hasMany` in `app.config.vector.inputs` registers under
78
+ `repeater`.
79
+
80
+ ### Fixed
81
+
82
+ - With kinetis/vector loading every child into the rows endpoint, a
83
+ relationship repeater's form holds every stored row, past `max()`
84
+ too, so a save can no longer delete the rows past it: the server
85
+ refuses that save instead.
86
+ - A collapsible form section opens again after it was collapsed: the
87
+ form recorded every click on its title as a close.
88
+
10
89
  ## [0.14.0] - 2026-11-23
11
90
 
12
91
  ### Added
@@ -0,0 +1,20 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+
4
+ // A flag group: the labels of the options that are on, as chips.
5
+ const props = defineProps<{ field: VectorField, value: unknown }>()
6
+ const { t } = useVectorT()
7
+
8
+ const on = computed(() => {
9
+ const flags = props.value !== null && typeof props.value === 'object' && !Array.isArray(props.value) ? props.value as Record<string, unknown> : {}
10
+
11
+ return (props.field.options ?? []).filter(option => flags[String(option.value)] === true)
12
+ })
13
+ </script>
14
+
15
+ <template>
16
+ <span v-if="on.length === 0" class="text-disabled">{{ t('common.none') }}</span>
17
+ <span v-else class="d-inline-flex flex-wrap align-center ga-1">
18
+ <v-chip v-for="option in on" :key="String(option.value)" size="small" variant="tonal" label>{{ option.label }}</v-chip>
19
+ </span>
20
+ </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+ import SelectCell from '#vector/app/components/Vx/Cell/Select.vue'
4
+
5
+ // A country, or several, shown as a select is, named in the UI's language.
6
+ const props = defineProps<{ field: VectorField, value: unknown }>()
7
+ const names = useVectorCountryNames()
8
+ const named = computed(() => withCountryNames(props.field, names.value))
9
+ </script>
10
+
11
+ <template>
12
+ <SelectCell :field="named" :value="value" />
13
+ </template>
@@ -1,13 +1,7 @@
1
1
  <script setup lang="ts">
2
+ // A JSON column's document: indented on a record, on one line in a list.
2
3
  const props = defineProps<{ value: unknown, context: 'index' | 'show' }>()
3
- const pretty = computed(() => {
4
- if (typeof props.value !== 'string' || props.value === '') return ''
5
- try {
6
- return JSON.stringify(JSON.parse(props.value), null, props.context === 'show' ? 2 : 0)
7
- } catch {
8
- return props.value
9
- }
10
- })
4
+ const pretty = computed(() => (props.value === null || props.value === undefined ? '' : JSON.stringify(props.value, null, props.context === 'show' ? 2 : 0)))
11
5
  const { t } = useVectorT()
12
6
  </script>
13
7
 
@@ -0,0 +1,64 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField, VectorRecord, VectorResource } from '#vector/app/types/vector'
3
+
4
+ // A repeater's rows. In a list, how many there are. On a record, a
5
+ // compact table: a JSON repeater's rows are the value itself; a
6
+ // relationship repeater's are child records, loaded from their endpoint
7
+ // in the order the repeater keeps them.
8
+ const props = defineProps<{ field: VectorField, value: unknown, record: Record<string, unknown>, resource: VectorResource, context: 'index' | 'show' }>()
9
+
10
+ const { t } = useVectorT()
11
+ const { resource: resourceOf } = useVectorSchema()
12
+
13
+ const json = computed(() => props.field.repeater?.mode !== 'relationship')
14
+ const child = computed(() => !json.value && props.field.relation ? resourceOf(props.field.relation.resource) : undefined)
15
+ const columns = computed<VectorField[]>(() => json.value
16
+ ? props.field.repeater?.rowFields ?? []
17
+ : (props.field.repeater?.fields ?? [])
18
+ .map(name => child.value?.fields.find(f => f.name === name))
19
+ .filter((f): f is VectorField => f !== undefined))
20
+
21
+ const count = computed<number | null>(() => {
22
+ if (Array.isArray(props.value)) return props.value.length
23
+ return props.value && typeof props.value === 'object' && 'count' in props.value ? Number((props.value as { count: unknown }).count) : null
24
+ })
25
+
26
+ const client = useVectorResource(() => props.resource.slug)
27
+ const loaded = ref<VectorRecord[] | null>(null)
28
+ const failed = ref(false)
29
+ const rows = computed<Record<string, unknown>[]>(() => json.value ? (Array.isArray(props.value) ? props.value as Record<string, unknown>[] : []) : loaded.value ?? [])
30
+
31
+ onMounted(async () => {
32
+ if (props.context !== 'show' || json.value || !child.value || props.record.id === undefined || count.value === 0) return
33
+
34
+ try {
35
+ loaded.value = (await client.rows(props.record.id as string | number, props.field.name)).data
36
+ } catch {
37
+ failed.value = true
38
+ }
39
+ })
40
+ </script>
41
+
42
+ <template>
43
+ <template v-if="context === 'index'">
44
+ <v-chip v-if="count !== null" size="small" variant="tonal" :color="count > 0 ? 'primary' : undefined">{{ count }}</v-chip>
45
+ <span v-else class="text-disabled">{{ t('common.none') }}</span>
46
+ </template>
47
+ <span v-else-if="count === 0 || count === null" class="text-disabled">{{ t('fields.rows.none') }}</span>
48
+ <span v-else-if="failed || (!json && !child)" class="text-medium-emphasis">{{ t('fields.repeater.unavailable') }}</span>
49
+ <v-progress-linear v-else-if="!json && loaded === null" indeterminate :aria-label="t('fields.cell.loading', { label: field.label })" />
50
+ <v-table v-else density="compact" class="vx-repeater-table">
51
+ <thead>
52
+ <tr>
53
+ <th v-for="column in columns" :key="column.name" scope="col">{{ column.label }}</th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr v-for="(row, index) in rows" :key="index">
58
+ <td v-for="column in columns" :key="column.name">
59
+ <VxCell :field="column" :value="row[column.name]" :record="row" :resource="child ?? resource" context="index" />
60
+ </td>
61
+ </tr>
62
+ </tbody>
63
+ </v-table>
64
+ </template>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField, VectorSelectOption } from '#vector/app/types/vector'
3
+
4
+ // A select's value, or a multiple one's values, by their labels: as
5
+ // chips when the field is a badge (or an option has a colour), as text
6
+ // otherwise.
7
+ const props = defineProps<{ field: VectorField, value: unknown }>()
8
+ const { t } = useVectorT()
9
+
10
+ const chosen = computed<VectorSelectOption[]>(() => {
11
+ const values = Array.isArray(props.value) ? props.value : props.value === null || props.value === undefined ? [] : [props.value]
12
+
13
+ return values.map(value => props.field.options?.find(o => String(o.value) === String(value)) ?? { value: String(value), label: String(value), color: null })
14
+ })
15
+ const chips = computed(() => props.field.badge === true || chosen.value.some(o => o.color !== null))
16
+ </script>
17
+
18
+ <template>
19
+ <span v-if="chosen.length === 0" class="text-disabled">{{ t('common.none') }}</span>
20
+ <span v-else-if="chips" class="d-inline-flex flex-wrap align-center ga-1">
21
+ <v-chip v-for="option in chosen" :key="String(option.value)" size="small" :color="option.color ?? undefined" variant="tonal" label>
22
+ {{ option.label }}
23
+ </v-chip>
24
+ </span>
25
+ <span v-else>{{ chosen.map(o => o.label).join(', ') }}</span>
26
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+
4
+ // Free-text tags, as chips in the order they are stored.
5
+ const props = defineProps<{ field: VectorField, value: unknown }>()
6
+ const { t } = useVectorT()
7
+ const tags = computed(() => (Array.isArray(props.value) ? props.value.filter((v): v is string => typeof v === 'string') : []))
8
+ </script>
9
+
10
+ <template>
11
+ <span v-if="tags.length === 0" class="text-disabled">{{ t('common.none') }}</span>
12
+ <span v-else class="d-inline-flex flex-wrap align-center ga-1">
13
+ <v-chip v-for="tag in tags" :key="tag" size="small" variant="tonal" label>{{ tag }}</v-chip>
14
+ </span>
15
+ </template>
@@ -36,12 +36,15 @@ watch(open, (o) => { if (!o) { query.value = ''; results.value = [] } })
36
36
 
37
37
  const keyOf = (r: VectorSearchResult) => `${r.resource}-${r.id}`
38
38
 
39
- /** The subtitle as its field shows it (an enum by its label) then the resource. */
39
+ const countryNames = useVectorCountryNames()
40
+
41
+ /** The subtitle as its field shows it (a select by its label, a country by its name) then the resource. */
40
42
  function subtitleOf(r: VectorSearchResult): string {
41
43
  const resource = resourceOf(r.resource)
42
44
  const field = resource?.fields.find(f => f.name === resource.searchResult?.subtitle)
43
45
  let text = r.subtitle ?? null
44
- if (text !== null && field?.type === 'enum') text = field.options?.find(o => String(o.value) === text)?.label ?? text
46
+ if (text !== null && field?.type === 'country') text = countryNames.value[text] ?? field.options?.find(o => String(o.value) === text)?.label ?? text
47
+ else if (text !== null && field?.type === 'select') text = field.options?.find(o => String(o.value) === text)?.label ?? text
45
48
  else if (text !== null && field?.type === 'number' && text !== '' && !Number.isNaN(Number(text))) {
46
49
  const decimals = fieldProps(field).decimals
47
50
  text = formatNumber(Number(text), typeof decimals === 'number' ? decimals : undefined)
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { childRepeater } from '#vector/app/utils/internal/repeater'
2
3
  import type { VectorImportMode, VectorImportPreview, VectorResource } from '#vector/app/types/vector'
3
4
 
4
5
  // CSV import in two steps: upload for a preview and a suggested
@@ -38,7 +39,7 @@ const modeViews: Record<VectorImportMode, string[]> = { create: ['create'], upda
38
39
  // what the mode writes; an update also maps the column it matches rows by
39
40
  const fields = computed(() => {
40
41
  const views = modeViews[mode.value]
41
- const writable = props.resource.fields.filter(f => !f.readonly && f.views.some(v => views.includes(v)) && !['id', 'hasOne', 'hasMany', 'computed'].includes(f.type))
42
+ const writable = props.resource.fields.filter(f => !f.readonly && f.views.some(v => views.includes(v)) && !['id', 'hasOne', 'hasMany', 'computed'].includes(f.type) && !childRepeater(f))
42
43
  const keys = mode.value === 'create' ? [] : keyFields.value.filter(f => !writable.includes(f))
43
44
 
44
45
  return [...keys, ...writable].map(f => ({ title: f.label, value: f.name }))
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+
4
+ // A flag group edited as one group of checkboxes: the value is an object
5
+ // of every option key to true or false.
6
+ const props = withDefaults(defineProps<{ field: VectorField, rules: ((v: unknown) => true | string)[], errorMessages: string[], record?: Record<string, unknown>, resource?: string, disabled?: boolean }>(), { record: undefined, resource: undefined, disabled: undefined })
7
+ const model = defineModel<Record<string, boolean> | null>()
8
+
9
+ const flags = computed<Record<string, boolean>>(() => Object.fromEntries((props.field.options ?? []).map(option => [String(option.value), model.value?.[String(option.value)] === true])))
10
+
11
+ function toggle(key: string, on: boolean | null) {
12
+ model.value = { ...flags.value, [key]: on === true }
13
+ }
14
+ </script>
15
+
16
+ <template>
17
+ <v-input :error-messages="errorMessages" :hint="field.help ?? undefined" :persistent-hint="!!field.help" :disabled="props.disabled">
18
+ <fieldset class="vx-fieldset" :data-flag-group="field.name">
19
+ <legend class="text-body-2 text-medium-emphasis">{{ field.label }}</legend>
20
+ <div class="d-flex flex-wrap column-gap-4">
21
+ <v-checkbox
22
+ v-for="option in field.options ?? []"
23
+ :key="String(option.value)"
24
+ :label="option.label"
25
+ :model-value="flags[String(option.value)]"
26
+ :disabled="props.disabled"
27
+ density="compact"
28
+ hide-details
29
+ @update:model-value="(on: boolean | null) => toggle(String(option.value), on)"
30
+ />
31
+ </div>
32
+ </fieldset>
33
+ </v-input>
34
+ </template>
35
+
36
+ <style scoped>
37
+ /* a fieldset that groups without a fieldset's own border, padding and margin */
38
+ .vx-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
39
+ </style>
@@ -0,0 +1,14 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+ import SelectInput from '#vector/app/components/Vx/Input/Select.vue'
4
+
5
+ // A select over country codes, each named in the UI's language.
6
+ const props = defineProps<{ field: VectorField, rules: ((v: unknown) => true | string)[], errorMessages: string[], record?: Record<string, unknown>, resource?: string }>()
7
+ const model = defineModel<string | number | (string | number)[] | null>()
8
+ const names = useVectorCountryNames()
9
+ const named = computed(() => withCountryNames(props.field, names.value))
10
+ </script>
11
+
12
+ <template>
13
+ <SelectInput v-model="model" :field="named" :rules="rules" :error-messages="errorMessages" :record="record" :resource="resource" />
14
+ </template>
@@ -0,0 +1,63 @@
1
+ <script setup lang="ts">
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+
4
+ // A JSON column's document edited as text. Valid JSON holding an object
5
+ // or an array is sent as that document; anything else is sent as the
6
+ // text it is, which the server refuses, and is flagged here meanwhile.
7
+ const props = withDefaults(defineProps<{ field: VectorField, rules: ((v: unknown) => true | string)[], errorMessages: string[], record?: Record<string, unknown>, resource?: string, disabled?: boolean }>(), { record: undefined, resource: undefined, disabled: undefined })
8
+ const model = defineModel<unknown>()
9
+ const { t } = useVectorT()
10
+
11
+ const format = (value: unknown): string => (value === null || value === undefined ? '' : typeof value === 'string' ? value : JSON.stringify(value, null, 2))
12
+ const text = ref(format(model.value))
13
+ const invalid = ref(false)
14
+ // the value this input last set, so its own update leaves the text as typed
15
+ let emitted: unknown = model.value
16
+
17
+ watch(model, (value) => {
18
+ // a value set from outside (a reset, a loaded record) replaces the text
19
+ if (value === emitted) return
20
+ emitted = value
21
+ text.value = format(value)
22
+ invalid.value = false
23
+ })
24
+
25
+ function parsed(raw: string): unknown {
26
+ if (raw.trim() === '') return null
27
+
28
+ try {
29
+ const value: unknown = JSON.parse(raw)
30
+
31
+ return value !== null && typeof value === 'object' ? value : raw
32
+ } catch {
33
+ return raw
34
+ }
35
+ }
36
+
37
+ function edit(raw: string) {
38
+ text.value = raw
39
+ const value = parsed(raw)
40
+ invalid.value = typeof value === 'string'
41
+ emitted = value
42
+ model.value = value
43
+ }
44
+
45
+ const messages = computed(() => [...(invalid.value ? [t('fields.json.invalid')] : []), ...props.errorMessages])
46
+ </script>
47
+
48
+ <template>
49
+ <v-textarea
50
+ :model-value="text"
51
+ :label="field.label"
52
+ :rules="rules"
53
+ :error-messages="messages"
54
+ :hint="field.help ?? undefined"
55
+ :persistent-hint="!!field.help"
56
+ :disabled="props.disabled"
57
+ class="font-monospace"
58
+ auto-grow
59
+ rows="3"
60
+ spellcheck="false"
61
+ @update:model-value="edit"
62
+ />
63
+ </template>