nuxt-ui-tools 1.0.0 → 1.1.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 (290) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +37 -0
  4. package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
  5. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
  6. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
  7. package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
  8. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
  9. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
  10. package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
  11. package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
  12. package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
  13. package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
  14. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
  15. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
  16. package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
  17. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +312 -0
  18. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
  19. package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
  20. package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
  21. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
  22. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
  23. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
  24. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
  25. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
  26. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
  27. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
  28. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
  29. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
  30. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
  31. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
  32. package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
  33. package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
  34. package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
  35. package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
  36. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
  37. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
  38. package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
  39. package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
  40. package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
  41. package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
  42. package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
  43. package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
  44. package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
  45. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
  46. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
  47. package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
  48. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
  49. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
  50. package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
  51. package/dist/runtime/dashboard/components/dashboard-feed.vue +238 -0
  52. package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
  53. package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
  54. package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
  55. package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
  56. package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
  57. package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
  58. package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
  59. package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
  60. package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
  61. package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
  62. package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
  63. package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
  64. package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
  65. package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
  66. package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
  67. package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
  68. package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
  69. package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
  70. package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
  71. package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
  72. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
  73. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
  74. package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
  75. package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
  76. package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
  77. package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
  78. package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
  79. package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
  80. package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
  81. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
  82. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
  83. package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
  84. package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
  85. package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
  86. package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
  87. package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
  88. package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
  89. package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
  90. package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
  91. package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
  92. package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
  93. package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
  94. package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
  95. package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
  96. package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
  97. package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
  98. package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
  99. package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
  100. package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
  101. package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
  102. package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
  103. package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
  104. package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
  105. package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
  106. package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
  107. package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
  108. package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
  109. package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
  110. package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
  111. package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
  112. package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
  113. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
  114. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
  115. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
  116. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
  117. package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
  118. package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
  119. package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
  120. package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
  121. package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
  122. package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
  123. package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
  124. package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
  125. package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
  126. package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
  127. package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
  128. package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
  129. package/dist/runtime/dashboard/constants/query.d.ts +16 -0
  130. package/dist/runtime/dashboard/constants/query.js +15 -0
  131. package/dist/runtime/dashboard/index.d.ts +4 -0
  132. package/dist/runtime/dashboard/index.js +3 -0
  133. package/dist/runtime/dashboard/schema/index.d.ts +57 -0
  134. package/dist/runtime/dashboard/schema/index.js +3 -0
  135. package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
  136. package/dist/runtime/dashboard/types/blocks.js +0 -0
  137. package/dist/runtime/dashboard/types/charts.d.ts +60 -0
  138. package/dist/runtime/dashboard/types/charts.js +0 -0
  139. package/dist/runtime/dashboard/types/index.d.ts +7 -0
  140. package/dist/runtime/dashboard/types/index.js +0 -0
  141. package/dist/runtime/dashboard/types/options.d.ts +46 -0
  142. package/dist/runtime/dashboard/types/options.js +0 -0
  143. package/dist/runtime/dashboard/types/params.d.ts +115 -0
  144. package/dist/runtime/dashboard/types/params.js +0 -0
  145. package/dist/runtime/dashboard/types/resource.d.ts +106 -0
  146. package/dist/runtime/dashboard/types/resource.js +0 -0
  147. package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
  148. package/dist/runtime/dashboard/types/runtime.js +0 -0
  149. package/dist/runtime/dashboard/types/schema.d.ts +171 -0
  150. package/dist/runtime/dashboard/types/schema.js +0 -0
  151. package/dist/runtime/dashboard/types/ui.d.ts +201 -0
  152. package/dist/runtime/dashboard/types/ui.js +0 -0
  153. package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
  154. package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
  155. package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
  156. package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
  157. package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
  158. package/dist/runtime/dashboard/utils/charts.js +142 -0
  159. package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
  160. package/dist/runtime/dashboard/utils/comparison.js +19 -0
  161. package/dist/runtime/dashboard/utils/export.d.ts +13 -0
  162. package/dist/runtime/dashboard/utils/export.js +45 -0
  163. package/dist/runtime/dashboard/utils/options.d.ts +12 -0
  164. package/dist/runtime/dashboard/utils/options.js +23 -0
  165. package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
  166. package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
  167. package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
  168. package/dist/runtime/dashboard/utils/resource.js +39 -0
  169. package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
  170. package/dist/runtime/dashboard/utils/schema.js +31 -0
  171. package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
  172. package/dist/runtime/dashboard/utils/sparkline.js +53 -0
  173. package/dist/runtime/dashboard/utils/state.d.ts +28 -0
  174. package/dist/runtime/dashboard/utils/state.js +32 -0
  175. package/dist/runtime/dashboard/utils/time.d.ts +17 -0
  176. package/dist/runtime/dashboard/utils/time.js +60 -0
  177. package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
  178. package/dist/runtime/dashboard/utils/tracker.js +31 -0
  179. package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
  180. package/dist/runtime/dashboard/utils/ui.js +24 -0
  181. package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
  182. package/dist/runtime/dashboard/utils/visibility.js +25 -0
  183. package/dist/runtime/form/components/root/form.vue +1 -1
  184. package/dist/runtime/form/composables/use-form-validation.d.ts +2 -3
  185. package/dist/runtime/form/composables/use-form-validation.js +24 -112
  186. package/dist/runtime/form/composables/use-form.js +1 -1
  187. package/dist/runtime/form/fields/password/component.vue +132 -28
  188. package/dist/runtime/form/fields/password/types.d.ts +6 -0
  189. package/dist/runtime/form/fields/text/component.vue +7 -2
  190. package/dist/runtime/form/types/field.d.ts +1 -1
  191. package/dist/runtime/form/types/options.d.ts +15 -36
  192. package/dist/runtime/form/types/validation.d.ts +3 -20
  193. package/dist/runtime/form/utils/state.d.ts +1 -14
  194. package/dist/runtime/form/utils/state.js +0 -199
  195. package/dist/runtime/i18n/locales/en.js +63 -0
  196. package/dist/runtime/i18n/locales/fr.js +63 -0
  197. package/dist/runtime/i18n/types.d.ts +68 -0
  198. package/dist/runtime/shared/index.d.ts +2 -0
  199. package/dist/runtime/shared/styles/tokens.css +1 -1
  200. package/dist/runtime/shared/types/query.d.ts +10 -0
  201. package/dist/runtime/shared/types/query.js +0 -0
  202. package/dist/runtime/shared/types/remote-options.d.ts +37 -0
  203. package/dist/runtime/shared/types/remote-options.js +0 -0
  204. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
  205. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
  206. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  207. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  208. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  209. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  210. package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +20 -18
  211. package/dist/runtime/table/components/data-list/data-list-content.vue +14 -87
  212. package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +20 -18
  213. package/dist/runtime/table/components/data-list/data-list-default.d.vue.ts +1 -4
  214. package/dist/runtime/table/components/data-list/data-list-default.vue.d.ts +1 -4
  215. package/dist/runtime/table/components/data-list/data-list-error-state.d.vue.ts +13 -0
  216. package/dist/runtime/table/components/data-list/data-list-error-state.vue +91 -0
  217. package/dist/runtime/table/components/data-list/data-list-error-state.vue.d.ts +13 -0
  218. package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
  219. package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
  220. package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
  221. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue +1 -1
  222. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
  223. package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
  224. package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
  225. package/dist/runtime/table/components/data-list/data-list-refresh.vue +42 -4
  226. package/dist/runtime/table/components/data-list/data-list-root.d.vue.ts +1 -9
  227. package/dist/runtime/table/components/data-list/data-list-root.vue.d.ts +1 -9
  228. package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
  229. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue +11 -5
  230. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
  231. package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
  232. package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
  233. package/dist/runtime/table/components/data-list.d.vue.ts +2 -13
  234. package/dist/runtime/table/components/data-list.vue.d.ts +2 -13
  235. package/dist/runtime/table/components/drawers/column-panel.vue +7 -2
  236. package/dist/runtime/table/components/filters/panel/filter-panel-chips.vue +2 -5
  237. package/dist/runtime/table/components/filters/panel/option-filter-panel-field.vue +1 -1
  238. package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.d.vue.ts +2 -2
  239. package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.vue +103 -101
  240. package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.vue.d.ts +2 -2
  241. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
  242. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
  243. package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +2 -2
  244. package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +3 -3
  245. package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
  246. package/dist/runtime/table/components/filters/shared/filter-popover-shell.d.vue.ts +3 -3
  247. package/dist/runtime/table/components/filters/shared/filter-popover-shell.vue +17 -15
  248. package/dist/runtime/table/components/filters/shared/filter-popover-shell.vue.d.ts +3 -3
  249. package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +10 -2
  250. package/dist/runtime/table/components/filters/sheet/filter-sheet.vue +4 -3
  251. package/dist/runtime/table/components/filters/tags/filter-tags-bar.vue +1 -1
  252. package/dist/runtime/table/components/grid/grid-renderer.vue +2 -4
  253. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
  254. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
  255. package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
  256. package/dist/runtime/table/components/table/table-renderer.d.vue.ts +8 -2
  257. package/dist/runtime/table/components/table/table-renderer.vue +24 -6
  258. package/dist/runtime/table/components/table/table-renderer.vue.d.ts +8 -2
  259. package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +1 -0
  260. package/dist/runtime/table/composables/use-option-filter-editor-state.js +2 -2
  261. package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
  262. package/dist/runtime/table/composables/use-table-actions.js +10 -5
  263. package/dist/runtime/table/composables/use-table-api.js +4 -1
  264. package/dist/runtime/table/composables/use-table-columns.d.ts +9 -5
  265. package/dist/runtime/table/composables/use-table-data.d.ts +2 -1
  266. package/dist/runtime/table/composables/use-table-data.js +19 -2
  267. package/dist/runtime/table/composables/use-table-filter-options.d.ts +1 -0
  268. package/dist/runtime/table/composables/use-table-filter-options.js +2 -1
  269. package/dist/runtime/table/composables/use-table-internals.d.ts +45 -33
  270. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  271. package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
  272. package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
  273. package/dist/runtime/table/types/actions.d.ts +3 -2
  274. package/dist/runtime/table/types/data-list.d.ts +8 -0
  275. package/dist/runtime/table/types/source.d.ts +14 -6
  276. package/dist/runtime/table/utils/builders/table-source.d.ts +14 -15
  277. package/dist/runtime/table/utils/client-query.d.ts +1 -1
  278. package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
  279. package/dist/runtime/table/utils/columns/render.d.ts +13 -5
  280. package/dist/runtime/table/utils/columns/render.js +3 -2
  281. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  282. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  283. package/dist/runtime/table/utils/filters/editor-size.js +9 -9
  284. package/dist/runtime/table/utils/filters/options.js +6 -1
  285. package/dist/runtime/table/utils/index.d.ts +1 -0
  286. package/dist/runtime/table/utils/index.js +1 -0
  287. package/dist/runtime/table/utils/prefetch.js +5 -1
  288. package/dist/runtime/table/utils/source-request.d.ts +2 -0
  289. package/dist/runtime/table/utils/source-request.js +9 -0
  290. package/package.json +28 -1
@@ -1,6 +1,9 @@
1
1
  <script setup>
2
2
  import UButton from "@nuxt/ui/components/Button.vue";
3
+ import UIcon from "@nuxt/ui/components/Icon.vue";
3
4
  import UInput from "@nuxt/ui/components/Input.vue";
5
+ import UPopover from "@nuxt/ui/components/Popover.vue";
6
+ import UProgress from "@nuxt/ui/components/Progress.vue";
4
7
  import { computed, ref } from "vue";
5
8
  import { useUiToolsLocale } from "../../../i18n/use-locale";
6
9
  import FormFieldShell from "../../components/renderer/form-field-shell.vue";
@@ -16,14 +19,29 @@ const { t } = useUiToolsLocale();
16
19
  const { fieldProps, form, controlProps, controlSize, disabled, handleBlur, placeholder } = useFieldControl(
17
20
  () => props.field,
18
21
  () => props.path,
19
- { omit: ["visibilityToggle"] }
22
+ { omit: ["requirements", "visibilityToggle"] }
20
23
  );
21
24
  const visible = ref(false);
25
+ const requirementsOpen = ref(false);
22
26
  const visibilityToggleEnabled = computed(() => fieldProps.value.visibilityToggle !== false);
23
27
  const visibilityToggleConfig = computed(
24
28
  () => isPasswordVisibilityConfig(fieldProps.value.visibilityToggle) ? fieldProps.value.visibilityToggle : void 0
25
29
  );
26
30
  const inputType = computed(() => visible.value ? "text" : "password");
31
+ const requirements = computed(
32
+ () => Array.isArray(fieldProps.value.requirements) ? fieldProps.value.requirements : []
33
+ );
34
+ const requirementResults = computed(() => {
35
+ const value = model.value ?? "";
36
+ return requirements.value.map((requirement) => ({
37
+ key: requirement.key,
38
+ label: resolveFormText(requirement.label) ?? requirement.key,
39
+ passed: requirement.validate(value)
40
+ }));
41
+ });
42
+ const passedRequirementCount = computed(
43
+ () => requirementResults.value.filter((requirement) => requirement.passed).length
44
+ );
27
45
  const visibilityLabel = computed(() => {
28
46
  const configured = visible.value ? visibilityToggleConfig.value?.hideLabel : visibilityToggleConfig.value?.showLabel;
29
47
  return resolveFormText(configured) ?? t(visible.value ? "form.fields.password.hide" : "form.fields.password.show");
@@ -34,6 +52,10 @@ const visibilityIcon = computed(
34
52
  function isPasswordVisibilityConfig(value) {
35
53
  return isObject(value);
36
54
  }
55
+ function handleInputBlur(event) {
56
+ requirementsOpen.value = false;
57
+ handleBlur(event);
58
+ }
37
59
  const model = computed({
38
60
  get: () => {
39
61
  const value = form.getValue(props.path);
@@ -44,34 +66,12 @@ const model = computed({
44
66
  </script>
45
67
 
46
68
  <template>
47
- <UInput
69
+ <UPopover
48
70
  v-if="bare"
49
- v-model="model"
50
- v-bind="controlProps"
51
- class="w-full"
52
- :type="inputType"
53
- :placeholder="placeholder"
54
- :disabled="disabled"
55
- @blur="handleBlur"
71
+ :open="requirementsOpen && requirements.length > 0"
72
+ :content="{ align: 'start', side: 'bottom', sideOffset: 8 }"
73
+ :ui="{ content: 'w-[min(22rem,calc(100vw-2rem))] p-3.5' }"
56
74
  >
57
- <template v-if="visibilityToggleEnabled" #trailing>
58
- <UButton
59
- type="button"
60
- color="neutral"
61
- variant="link"
62
- :size="controlSize"
63
- :icon="visibilityIcon"
64
- :aria-label="visibilityLabel"
65
- :title="visibilityLabel"
66
- :aria-pressed="visible"
67
- :disabled="disabled"
68
- :ui="{ base: 'p-0' }"
69
- @mousedown.prevent
70
- @click="visible = !visible"
71
- />
72
- </template>
73
- </UInput>
74
- <FormFieldShell v-else :field="field" :path="path">
75
75
  <UInput
76
76
  v-model="model"
77
77
  v-bind="controlProps"
@@ -79,7 +79,8 @@ const model = computed({
79
79
  :type="inputType"
80
80
  :placeholder="placeholder"
81
81
  :disabled="disabled"
82
- @blur="handleBlur"
82
+ @focus="requirementsOpen = true"
83
+ @blur="handleInputBlur"
83
84
  >
84
85
  <template v-if="visibilityToggleEnabled" #trailing>
85
86
  <UButton
@@ -98,5 +99,108 @@ const model = computed({
98
99
  />
99
100
  </template>
100
101
  </UInput>
102
+
103
+ <template #content>
104
+ <div class="space-y-3" data-form-password-requirements="">
105
+ <div class="flex items-center justify-between gap-3 text-xs font-medium text-toned">
106
+ <span>{{ t("form.fields.password.requirements") }}</span>
107
+ <span class="tabular-nums">
108
+ {{ passedRequirementCount }}/{{ requirementResults.length }}
109
+ </span>
110
+ </div>
111
+ <UProgress
112
+ :model-value="passedRequirementCount"
113
+ :max="requirementResults.length"
114
+ size="sm"
115
+ color="success"
116
+ data-form-password-progress=""
117
+ :data-value="passedRequirementCount"
118
+ :data-max="requirementResults.length"
119
+ />
120
+ <ul class="space-y-1.5">
121
+ <li
122
+ v-for="requirement in requirementResults"
123
+ :key="requirement.key"
124
+ class="flex items-start gap-2 text-xs"
125
+ :class="requirement.passed ? 'text-success' : 'text-muted'"
126
+ >
127
+ <UIcon
128
+ :name="requirement.passed ? 'i-lucide-check' : 'i-lucide-x'"
129
+ class="mt-0.5 size-3.5 shrink-0"
130
+ />
131
+ <span>{{ requirement.label }}</span>
132
+ </li>
133
+ </ul>
134
+ </div>
135
+ </template>
136
+ </UPopover>
137
+ <FormFieldShell v-else :field="field" :path="path">
138
+ <UPopover
139
+ :open="requirementsOpen && requirements.length > 0"
140
+ :content="{ align: 'start', side: 'bottom', sideOffset: 8 }"
141
+ :ui="{ content: 'w-[min(22rem,calc(100vw-2rem))] p-3.5' }"
142
+ >
143
+ <UInput
144
+ v-model="model"
145
+ v-bind="controlProps"
146
+ class="w-full"
147
+ :type="inputType"
148
+ :placeholder="placeholder"
149
+ :disabled="disabled"
150
+ @focus="requirementsOpen = true"
151
+ @blur="handleInputBlur"
152
+ >
153
+ <template v-if="visibilityToggleEnabled" #trailing>
154
+ <UButton
155
+ type="button"
156
+ color="neutral"
157
+ variant="link"
158
+ :size="controlSize"
159
+ :icon="visibilityIcon"
160
+ :aria-label="visibilityLabel"
161
+ :title="visibilityLabel"
162
+ :aria-pressed="visible"
163
+ :disabled="disabled"
164
+ :ui="{ base: 'p-0' }"
165
+ @mousedown.prevent
166
+ @click="visible = !visible"
167
+ />
168
+ </template>
169
+ </UInput>
170
+
171
+ <template #content>
172
+ <div class="space-y-3" data-form-password-requirements="">
173
+ <div class="flex items-center justify-between gap-3 text-xs font-medium text-toned">
174
+ <span>{{ t("form.fields.password.requirements") }}</span>
175
+ <span class="tabular-nums">
176
+ {{ passedRequirementCount }}/{{ requirementResults.length }}
177
+ </span>
178
+ </div>
179
+ <UProgress
180
+ :model-value="passedRequirementCount"
181
+ :max="requirementResults.length"
182
+ size="sm"
183
+ color="success"
184
+ data-form-password-progress=""
185
+ :data-value="passedRequirementCount"
186
+ :data-max="requirementResults.length"
187
+ />
188
+ <ul class="space-y-1.5">
189
+ <li
190
+ v-for="requirement in requirementResults"
191
+ :key="requirement.key"
192
+ class="flex items-start gap-2 text-xs"
193
+ :class="requirement.passed ? 'text-success' : 'text-muted'"
194
+ >
195
+ <UIcon
196
+ :name="requirement.passed ? 'i-lucide-check' : 'i-lucide-x'"
197
+ class="mt-0.5 size-3.5 shrink-0"
198
+ />
199
+ <span>{{ requirement.label }}</span>
200
+ </li>
201
+ </ul>
202
+ </div>
203
+ </template>
204
+ </UPopover>
101
205
  </FormFieldShell>
102
206
  </template>
@@ -7,7 +7,13 @@ export interface FormPasswordVisibilityToggle {
7
7
  showLabel?: FormText;
8
8
  hideLabel?: FormText;
9
9
  }
10
+ export interface FormPasswordRequirement {
11
+ key: string;
12
+ label: FormText;
13
+ validate: (value: string) => boolean;
14
+ }
10
15
  export interface FormPasswordProps {
16
+ requirements?: readonly FormPasswordRequirement[];
11
17
  visibilityToggle?: boolean | FormPasswordVisibilityToggle;
12
18
  }
13
19
  export type FormPasswordField<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>> = FormStatefulFieldBase<'password', string | null, TContext, TDeps, FormPasswordProps>;
@@ -26,6 +26,11 @@ const model = computed({
26
26
  set: (value) => form.setValue(props.path, normalize(value))
27
27
  });
28
28
  const maskOptions = computed(() => maskDirectiveOptions(fieldProps.value.mask));
29
+ const vOptionalMaska = (element, binding, vnode, previousVnode) => {
30
+ if (binding.value !== void 0 && typeof vMaska === "function") {
31
+ vMaska(element, binding, vnode, previousVnode);
32
+ }
33
+ };
29
34
  const prefix = computed(() => resolveFormText(fieldProps.value.prefix));
30
35
  const suffix = computed(() => resolveFormText(fieldProps.value.suffix));
31
36
  const showClear = computed(
@@ -66,7 +71,7 @@ function clear() {
66
71
  <UInput
67
72
  v-if="bare"
68
73
  v-model="model"
69
- v-maska="maskOptions"
74
+ v-optional-maska="maskOptions"
70
75
  v-bind="controlProps"
71
76
  :class="controlClass"
72
77
  :type="fieldProps.inputType ?? 'text'"
@@ -100,7 +105,7 @@ function clear() {
100
105
  <FormFieldShell v-else :field="field" :path="path">
101
106
  <UInput
102
107
  v-model="model"
103
- v-maska="maskOptions"
108
+ v-optional-maska="maskOptions"
104
109
  v-bind="controlProps"
105
110
  :class="controlClass"
106
111
  :type="fieldProps.inputType ?? 'text'"
@@ -72,7 +72,7 @@ export type { FormMatrixField, FormMatrixRow } from '../fields/matrix/types.js';
72
72
  export type { FormNumberField } from '../fields/number/types.js';
73
73
  export type { FormOneTimeCodeField } from '../fields/one-time-code/types.js';
74
74
  export type { FormObjectField } from '../fields/object/types.js';
75
- export type { FormPasswordField } from '../fields/password/types.js';
75
+ export type * from '../fields/password/types';
76
76
  export type { FormPhoneNumberField } from '../fields/phone-number/types.js';
77
77
  export type { FormRadioCardField } from '../fields/radio-card/types.js';
78
78
  export type { FormRadioField } from '../fields/radio/types.js';
@@ -1,3 +1,4 @@
1
+ import type { RemoteCursorOptionsPage, RemoteOptionsPage, RemoteOptionsPageRequest, RemoteOptionsPagination, RemoteOptionsResult, RemoteOptionsSearch } from '../../shared/types/remote-options.js';
1
2
  import type { FormValue } from './/index.js';
2
3
  import type { FormFieldCallback, FormFieldCallbackParams } from './callbacks.js';
3
4
  import type { FormQueryOptions } from './context.js';
@@ -67,30 +68,17 @@ export interface FormOptionConfig<TOption, TContext = NonNullable<unknown>, TDep
67
68
  /** Disable the field while its option source has no usable data yet. */
68
69
  disableOnLoading?: boolean;
69
70
  }
70
- /**
71
- * Page envelope returned by an index-paginated remote option source.
72
- */
73
- export interface FormRemoteOptionsPage<TOption> {
74
- options: readonly TOption[];
75
- hasMore: boolean;
76
- }
77
- /**
78
- * Page envelope returned by a cursor-paginated remote option source.
79
- */
80
- export interface FormRemoteCursorOptionsPage<TOption> {
81
- options: readonly TOption[];
82
- nextCursor: string | null;
83
- }
84
- export type FormRemoteOptionsResult<TOption> = FormRemoteOptionsPage<TOption> | FormRemoteCursorOptionsPage<TOption>;
71
+ /** @deprecated Use `RemoteOptionsPage` from `#ui-tools/shared`. Kept for public type compatibility. */
72
+ export type FormRemoteOptionsPage<TOption> = RemoteOptionsPage<TOption>;
73
+ /** @deprecated Use `RemoteCursorOptionsPage` from `#ui-tools/shared`. Kept for public type compatibility. */
74
+ export type FormRemoteCursorOptionsPage<TOption> = RemoteCursorOptionsPage<TOption>;
75
+ /** @deprecated Use `RemoteOptionsResult` from `#ui-tools/shared`. Kept for public type compatibility. */
76
+ export type FormRemoteOptionsResult<TOption> = RemoteOptionsResult<TOption>;
85
77
  export interface FormRemoteOptionsRequest<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
86
78
  /** Current debounced search term. Empty when the menu lists unfiltered options. */
87
79
  search: string;
88
80
  /** Requested page. `cursor` is set for cursor pagination and `index` for page pagination. */
89
- page: {
90
- index: number;
91
- cursor: string | null;
92
- size: number;
93
- };
81
+ page: RemoteOptionsPageRequest;
94
82
  /** Parent option whose direct children are requested. Undefined for root pages. */
95
83
  parent?: NoInfer<TOption>;
96
84
  }
@@ -99,30 +87,21 @@ export interface FormRemoteSelectedRequest<TContext = NonNullable<unknown>, TDep
99
87
  values: readonly FormOptionValue[];
100
88
  }
101
89
  export type FormRemoteSource<TResult> = FormQueryOptions<TResult> | Promise<TResult>;
102
- export interface FormRemotePagination {
103
- type: 'page' | 'cursor';
104
- /** Page size forwarded to the source. */
105
- size: number;
106
- /** Distance from the list end that triggers the next page: pixels, or `'viewport'` for three viewport heights. Defaults to `'viewport'`. */
107
- prefetchDistance?: number | 'viewport';
108
- }
109
- export interface FormRemoteSearch {
110
- /** Debounce applied to typed search terms, in milliseconds. Defaults to 250. */
111
- debounce?: number;
112
- /** Minimum term length before a search request runs. Defaults to 0. */
113
- minLength?: number;
114
- }
90
+ /** @deprecated Use `RemoteOptionsPagination` from `#ui-tools/shared`. Kept for public type compatibility. */
91
+ export type FormRemotePagination = RemoteOptionsPagination;
92
+ /** @deprecated Use `RemoteOptionsSearch` from `#ui-tools/shared`. Kept for public type compatibility. */
93
+ export type FormRemoteSearch = RemoteOptionsSearch;
115
94
  /**
116
95
  * Remote option configuration: server-side search, pagination, and selected-value hydration.
117
96
  */
118
97
  export interface FormRemoteOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> {
119
98
  mode: 'remote';
120
99
  /** Loads one page of options for the current search, page, and optional parent. */
121
- source: (request: FormRemoteOptionsRequest<TContext, TDeps, TValue, TOption>) => FormRemoteSource<FormRemoteOptionsResult<TOption>>;
100
+ source: (request: FormRemoteOptionsRequest<TContext, TDeps, TValue, TOption>) => FormRemoteSource<RemoteOptionsResult<TOption>>;
122
101
  /** Hydrates selected values that the loaded pages do not contain. */
123
102
  resolveSelected?: (request: FormRemoteSelectedRequest<TContext, TDeps, TValue, TOption>) => FormRemoteSource<readonly TOption[]>;
124
- pagination: FormRemotePagination;
125
- search?: FormRemoteSearch;
103
+ pagination: RemoteOptionsPagination;
104
+ search?: RemoteOptionsSearch;
126
105
  /** Dependency aliases whose changes reset the loaded pages and re-run selected hydration. */
127
106
  refreshOn?: readonly string[];
128
107
  /** Clears selected values the latest successful selected hydration did not return. Defaults to `false`. */
@@ -1,22 +1,7 @@
1
1
  import type { RegleRuleRaw } from '@regle/core';
2
2
  import type { FormValue } from './/index.js';
3
3
  import type { FormFieldCallback } from './callbacks.js';
4
- import type { FormMaybePromise, FormObject, FormText } from './utils.js';
5
- /**
6
- * Result returned by a form validation rule.
7
- */
8
- export type FormValidationResult = boolean | string | null | undefined;
9
- /**
10
- * A single validation rule.
11
- */
12
- export interface FormValidationRule<TValue = FormValue, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>> {
13
- /** Stable rule name used for debugging, i18n, and external error mapping. */
14
- name: string;
15
- /** Returns true for valid values, false/string for invalid values. */
16
- validate: FormFieldCallback<FormMaybePromise<FormValidationResult>, TContext, TDeps, TValue>;
17
- /** Default message used when `validate` returns false. */
18
- message?: FormText;
19
- }
4
+ import type { FormObject, FormText } from './utils.js';
20
5
  /**
21
6
  * Controls when a field starts running validation while the user edits it.
22
7
  *
@@ -26,8 +11,8 @@ export interface FormValidationRule<TValue = FormValue, TContext = NonNullable<u
26
11
  * - `submit`: only validates through explicit form/step submit validation.
27
12
  */
28
13
  export type FormValidationTrigger = 'blur' | 'input' | 'submit';
29
- /** Selects which authored validation layers are evaluated. */
30
- export type FormValidationMode = boolean | 'required' | 'rules';
14
+ /** Selects which native Regle validation layers are evaluated. */
15
+ export type FormValidationMode = boolean | 'required' | 'validators';
31
16
  /**
32
17
  * Concrete validation error stored by the form runtime.
33
18
  */
@@ -63,8 +48,6 @@ export interface FormValidationConfig<TValue = FormValue, TContext = NonNullable
63
48
  required?: boolean | FormFieldCallback<boolean, TContext, TDeps, TValue>;
64
49
  /** Message used by the default required rule. */
65
50
  requiredMessage?: FormText;
66
- /** Additional field rules. */
67
- rules?: readonly FormValidationRule<TValue, TContext, TDeps>[];
68
51
  }
69
52
  /** Native Regle rules keyed by their validation name. */
70
53
  export type FormValidators = Record<string, RegleRuleRaw>;
@@ -1,8 +1,4 @@
1
- import type { FormValue, FormContextData, FormField, FormFieldApi, FormFieldCallbackParams, FormLayoutConfig, FormObject, FormText, FormValidationMode } from '../types/index.js';
2
- export interface FormSubmitError {
3
- path: string;
4
- message: string;
5
- }
1
+ import type { FormValue, FormContextData, FormField, FormFieldApi, FormFieldCallbackParams, FormLayoutConfig, FormObject, FormText } from '../types/index.js';
6
2
  export interface RuntimeFormStep {
7
3
  key?: string;
8
4
  title?: FormText;
@@ -18,17 +14,8 @@ export type InitialStateApiFactory = (state: FormObject, initial: FormObject) =>
18
14
  export declare function buildInitialFormState(schema: FormValue, ctx: FormContextData, input?: FormObject, createApiFactory?: InitialStateApiFactory): import("../../shared/index.js").GenericObject;
19
15
  export declare function buildInitialFormFieldsState(fields: readonly FormField[], ctx: FormContextData): import("../../shared/index.js").GenericObject;
20
16
  export declare function buildFormOutput(schema: FormValue, state: FormObject, ctx: FormContextData, apiFactory: FormFieldApiFactory): import("../../shared/index.js").GenericObject;
21
- export declare function validateFormState(schema: FormValue, state: FormObject, ctx: FormContextData, apiFactory: FormFieldApiFactory, mode?: FormValidationMode): Promise<FormSubmitError[]>;
22
17
  export declare function collectFormFieldPaths(schema: FormValue): readonly string[];
23
18
  export declare function collectFormFieldsPaths(fields: readonly FormField[], parentPath: readonly string[]): readonly string[];
24
- export declare function validateFormFields(params: {
25
- fields: readonly FormField[];
26
- state: FormObject;
27
- ctx: FormContextData;
28
- apiFactory: FormFieldApiFactory;
29
- parentPath: readonly string[];
30
- mode?: FormValidationMode;
31
- }): Promise<FormSubmitError[]>;
32
19
  export type FormFieldApiFactory = (path: readonly string[], field?: FormField) => FormFieldApi;
33
20
  export declare function fieldPath(parentPath: readonly string[], field: FormField): string[];
34
21
  export declare function childParentPath(parentPath: readonly string[], field: FormField): readonly string[];
@@ -149,28 +149,6 @@ export function buildFormOutput(schema, state, ctx, apiFactory) {
149
149
  }
150
150
  return buildFieldsOutput(getSchemaFields(schema), state, ctx, apiFactory, []);
151
151
  }
152
- export async function validateFormState(schema, state, ctx, apiFactory, mode = true) {
153
- if (mode === false) {
154
- return [];
155
- }
156
- const errors = [];
157
- if (isSteppedSchema(schema)) {
158
- for (const step of getSchemaSteps(schema)) {
159
- errors.push(
160
- ...await validateFields(
161
- step.fields,
162
- state,
163
- ctx,
164
- apiFactory,
165
- step.root ? [step.root] : [],
166
- mode
167
- )
168
- );
169
- }
170
- return errors;
171
- }
172
- return validateFields(getSchemaFields(schema), state, ctx, apiFactory, [], mode);
173
- }
174
152
  export function collectFormFieldPaths(schema) {
175
153
  if (isSteppedSchema(schema)) {
176
154
  return getSchemaSteps(schema).flatMap(
@@ -182,19 +160,6 @@ export function collectFormFieldPaths(schema) {
182
160
  export function collectFormFieldsPaths(fields, parentPath) {
183
161
  return collectFieldPaths(fields, parentPath);
184
162
  }
185
- export async function validateFormFields(params) {
186
- if (params.mode === false) {
187
- return [];
188
- }
189
- return await validateFields(
190
- params.fields,
191
- params.state,
192
- params.ctx,
193
- params.apiFactory,
194
- params.parentPath,
195
- params.mode ?? true
196
- );
197
- }
198
163
  export function fieldPath(parentPath, field) {
199
164
  return [...parentPath, field.key];
200
165
  }
@@ -357,100 +322,6 @@ function buildFieldsOutput(fields, state, ctx, apiFactory, parentPath) {
357
322
  }
358
323
  return output;
359
324
  }
360
- async function validateFields(fields, state, ctx, apiFactory, parentPath, mode) {
361
- const errors = [];
362
- for (const field of fields) {
363
- if (field.ignore === true) {
364
- continue;
365
- }
366
- const fieldInstance = createFormFieldInstance(field);
367
- if (fieldInstance.state.is("stateless")) {
368
- continue;
369
- }
370
- if (isFlatPassthroughField(field)) {
371
- errors.push(
372
- ...await validateFields(getChildFields(field), state, ctx, apiFactory, parentPath, mode)
373
- );
374
- continue;
375
- }
376
- const path = fieldPath(parentPath, field);
377
- const api = apiFactory(path, field);
378
- const params = callbackParams({
379
- api,
380
- ctx,
381
- field,
382
- parentPath,
383
- state
384
- });
385
- if (!shouldRenderField(field, params)) {
386
- continue;
387
- }
388
- if (isObjectContainerField(field)) {
389
- errors.push(
390
- ...await validateFields(getChildFields(field), state, ctx, apiFactory, path, mode)
391
- );
392
- continue;
393
- }
394
- if (isPrimitiveArrayField(field)) {
395
- errors.push(
396
- ...await validatePrimitiveArrayItems(
397
- field,
398
- getPathValue(state, path),
399
- state,
400
- ctx,
401
- apiFactory,
402
- path,
403
- mode
404
- )
405
- );
406
- }
407
- if (isArrayField(field)) {
408
- const value2 = getPathValue(state, path);
409
- if (Array.isArray(value2)) {
410
- for (const index of value2.keys()) {
411
- errors.push(
412
- ...await validateFields(
413
- getArrayItemFields(field, isRecord(value2[index]) ? value2[index] : {}),
414
- state,
415
- ctx,
416
- apiFactory,
417
- [...path, String(index)],
418
- mode
419
- )
420
- );
421
- }
422
- }
423
- continue;
424
- }
425
- if (fieldInstance.type.is("matrix")) {
426
- for (const row of getMatrixRows(field)) {
427
- errors.push(
428
- ...await validateFields(
429
- getChildFields(field),
430
- state,
431
- ctx,
432
- apiFactory,
433
- [...path, row],
434
- mode
435
- )
436
- );
437
- }
438
- continue;
439
- }
440
- const value = getPathValue(state, path);
441
- const required = mode !== "rules" && resolveRequired(field, params);
442
- if (required && isEmptyValue(value)) {
443
- errors.push({
444
- message: resolveRequiredMessage(field),
445
- path: path.join(".")
446
- });
447
- }
448
- if (mode !== "required") {
449
- errors.push(...await validateFieldRules(field, value, params, path));
450
- }
451
- }
452
- return errors;
453
- }
454
325
  function collectFieldPaths(fields, parentPath) {
455
326
  return fields.flatMap((field) => {
456
327
  if (field.ignore === true) {
@@ -533,33 +404,6 @@ function buildPrimitiveArrayOutput(field, value, state, ctx, apiFactory, path) {
533
404
  return [applyOutputTransform(itemField, item, itemParams)];
534
405
  });
535
406
  }
536
- async function validatePrimitiveArrayItems(field, value, state, ctx, apiFactory, path, mode) {
537
- const errors = [];
538
- if (!Array.isArray(value)) {
539
- return errors;
540
- }
541
- for (const [index, item] of value.entries()) {
542
- const itemField = getPrimitiveArrayItemField(field, index);
543
- if (!itemField) {
544
- continue;
545
- }
546
- const itemPath = [...path, String(index)];
547
- const itemParams = callbackParams({
548
- api: apiFactory(itemPath, itemField),
549
- ctx,
550
- field: itemField,
551
- parentPath: path,
552
- state
553
- });
554
- if (mode !== "rules" && resolveRequired(itemField, itemParams) && isEmptyValue(item)) {
555
- errors.push({ message: resolveRequiredMessage(itemField), path: itemPath.join(".") });
556
- }
557
- if (mode !== "required") {
558
- errors.push(...await validateFieldRules(itemField, item, itemParams, itemPath));
559
- }
560
- }
561
- return errors;
562
- }
563
407
  export function readStaticFieldProp(field, name) {
564
408
  const props = Object.getOwnPropertyDescriptor(field, "props")?.value;
565
409
  if (!isRecord(props)) {
@@ -689,49 +533,6 @@ export function resolveRequiredMessage(field, fallback = "This field is required
689
533
  }
690
534
  return fallback;
691
535
  }
692
- async function validateFieldRules(field, value, params, path) {
693
- const validation = Object.getOwnPropertyDescriptor(field, "validation")?.value;
694
- if (!isRecord(validation)) {
695
- return [];
696
- }
697
- const rules = Object.getOwnPropertyDescriptor(validation, "rules")?.value;
698
- if (!Array.isArray(rules)) {
699
- return [];
700
- }
701
- const errors = [];
702
- for (const rule of rules) {
703
- if (!isRecord(rule)) {
704
- continue;
705
- }
706
- const validate = Object.getOwnPropertyDescriptor(rule, "validate")?.value;
707
- if (!isFunction(validate)) {
708
- continue;
709
- }
710
- const result = await validate({
711
- ...params,
712
- api: params.api
713
- });
714
- if (result === true || result === null || isUndefined(result)) {
715
- continue;
716
- }
717
- errors.push({
718
- message: isString(result) ? result : resolveRuleMessage(rule, value),
719
- path: path.join(".")
720
- });
721
- }
722
- return errors;
723
- }
724
- function resolveRuleMessage(rule, _value) {
725
- const message = Object.getOwnPropertyDescriptor(rule, "message")?.value;
726
- if (isFunction(message)) {
727
- return String(message());
728
- }
729
- if (isString(message) || isNumber(message)) {
730
- return String(message);
731
- }
732
- const name = Object.getOwnPropertyDescriptor(rule, "name")?.value;
733
- return isString(name) ? `Invalid value for ${name}.` : "Invalid value.";
734
- }
735
536
  export function isEmptyValue(value) {
736
537
  if (value === null || isUndefined(value)) {
737
538
  return true;