@questpie/admin 1.1.1 → 2.0.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 (965) hide show
  1. package/README.md +245 -474
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/augmentation.d.mts +315 -0
  4. package/dist/augmentation.d.mts.map +1 -0
  5. package/dist/client/blocks/block-registry.d.mts +199 -0
  6. package/dist/client/blocks/block-registry.d.mts.map +1 -0
  7. package/dist/client/blocks/block-registry.mjs +88 -0
  8. package/dist/client/blocks/block-registry.mjs.map +1 -0
  9. package/dist/client/blocks/block-renderer.d.mts +52 -0
  10. package/dist/client/blocks/block-renderer.d.mts.map +1 -0
  11. package/dist/client/blocks/block-renderer.mjs +71 -0
  12. package/dist/client/blocks/block-renderer.mjs.map +1 -0
  13. package/dist/client/blocks/index.d.mts +4 -0
  14. package/dist/client/blocks/prefetch.d.mts +45 -0
  15. package/dist/client/blocks/prefetch.d.mts.map +1 -0
  16. package/dist/client/blocks/prefetch.mjs +26 -0
  17. package/dist/client/blocks/prefetch.mjs.map +1 -0
  18. package/dist/client/blocks/types.d.mts +69 -0
  19. package/dist/client/blocks/types.d.mts.map +1 -0
  20. package/dist/client/blocks/types.mjs +20 -0
  21. package/dist/client/blocks/types.mjs.map +1 -0
  22. package/dist/client/builder/admin-builder.d.mts +112 -0
  23. package/dist/client/builder/admin-builder.d.mts.map +1 -0
  24. package/dist/client/builder/admin-builder.mjs +185 -0
  25. package/dist/client/builder/admin-builder.mjs.map +1 -0
  26. package/dist/client/builder/admin-types.d.mts +73 -0
  27. package/dist/client/builder/admin-types.d.mts.map +1 -0
  28. package/dist/client/builder/admin.d.mts +121 -0
  29. package/dist/client/builder/admin.d.mts.map +1 -0
  30. package/dist/client/builder/admin.mjs +160 -0
  31. package/dist/client/builder/admin.mjs.map +1 -0
  32. package/dist/client/builder/defaults/components.mjs +20 -0
  33. package/dist/client/builder/defaults/components.mjs.map +1 -0
  34. package/dist/client/builder/defaults/core.d.mts +354 -0
  35. package/dist/client/builder/defaults/core.d.mts.map +1 -0
  36. package/dist/client/builder/defaults/core.mjs +49 -0
  37. package/dist/client/builder/defaults/core.mjs.map +1 -0
  38. package/dist/client/builder/defaults/fields.mjs +328 -0
  39. package/dist/client/builder/defaults/fields.mjs.map +1 -0
  40. package/dist/client/builder/defaults/pages.mjs +58 -0
  41. package/dist/client/builder/defaults/pages.mjs.map +1 -0
  42. package/dist/client/builder/defaults/starter.d.mts +351 -0
  43. package/dist/client/builder/defaults/starter.d.mts.map +1 -0
  44. package/dist/client/builder/defaults/starter.mjs +28 -0
  45. package/dist/client/builder/defaults/starter.mjs.map +1 -0
  46. package/dist/client/builder/defaults/views.mjs +27 -0
  47. package/dist/client/builder/defaults/views.mjs.map +1 -0
  48. package/dist/client/builder/defaults/widgets.mjs +31 -0
  49. package/dist/client/builder/defaults/widgets.mjs.map +1 -0
  50. package/dist/client/builder/field/field.d.mts +229 -0
  51. package/dist/client/builder/field/field.d.mts.map +1 -0
  52. package/dist/client/builder/field/field.mjs +83 -0
  53. package/dist/client/builder/field/field.mjs.map +1 -0
  54. package/dist/client/builder/index.d.mts +36 -0
  55. package/dist/client/builder/index.d.mts.map +1 -0
  56. package/dist/client/builder/page/page.d.mts +36 -0
  57. package/dist/client/builder/page/page.d.mts.map +1 -0
  58. package/dist/client/builder/page/page.mjs +27 -0
  59. package/dist/client/builder/page/page.mjs.map +1 -0
  60. package/dist/client/builder/proxies.d.mts +2 -0
  61. package/dist/client/builder/proxies.mjs +24 -0
  62. package/dist/client/builder/proxies.mjs.map +1 -0
  63. package/dist/client/builder/qa.d.mts +50 -0
  64. package/dist/client/builder/qa.d.mts.map +1 -0
  65. package/dist/client/builder/qa.mjs +42 -0
  66. package/dist/client/builder/qa.mjs.map +1 -0
  67. package/dist/client/builder/registry.d.mts +70 -0
  68. package/dist/client/builder/registry.d.mts.map +1 -0
  69. package/dist/client/builder/types/action-registry.d.mts +2 -0
  70. package/dist/client/builder/types/action-registry.mjs +142 -0
  71. package/dist/client/builder/types/action-registry.mjs.map +1 -0
  72. package/dist/client/builder/types/action-types.d.mts +253 -0
  73. package/dist/client/builder/types/action-types.d.mts.map +1 -0
  74. package/dist/client/builder/types/collection-types.d.mts +199 -0
  75. package/dist/client/builder/types/collection-types.d.mts.map +1 -0
  76. package/dist/client/builder/types/collection-types.mjs +11 -0
  77. package/dist/client/builder/types/collection-types.mjs.map +1 -0
  78. package/dist/client/builder/types/common.d.mts +60 -0
  79. package/dist/client/builder/types/common.d.mts.map +1 -0
  80. package/dist/client/builder/types/field-types.d.mts +593 -0
  81. package/dist/client/builder/types/field-types.d.mts.map +1 -0
  82. package/dist/client/builder/types/field-types.mjs +19 -0
  83. package/dist/client/builder/types/field-types.mjs.map +1 -0
  84. package/dist/client/builder/types/global-types.d.mts +22 -0
  85. package/dist/client/builder/types/global-types.d.mts.map +1 -0
  86. package/dist/client/builder/types/ui-config.d.mts +160 -0
  87. package/dist/client/builder/types/ui-config.d.mts.map +1 -0
  88. package/dist/client/builder/types/views.d.mts +89 -0
  89. package/dist/client/builder/types/views.d.mts.map +1 -0
  90. package/dist/client/builder/types/widget-types.d.mts +563 -0
  91. package/dist/client/builder/types/widget-types.d.mts.map +1 -0
  92. package/dist/client/builder/validation.d.mts +3 -0
  93. package/dist/client/builder/validation.mjs +208 -0
  94. package/dist/client/builder/validation.mjs.map +1 -0
  95. package/dist/client/builder/view/view.d.mts +129 -0
  96. package/dist/client/builder/view/view.d.mts.map +1 -0
  97. package/dist/client/builder/view/view.mjs +109 -0
  98. package/dist/client/builder/view/view.mjs.map +1 -0
  99. package/dist/client/builder/widget/widget.d.mts +33 -0
  100. package/dist/client/builder/widget/widget.d.mts.map +1 -0
  101. package/dist/client/builder/widget/widget.mjs +26 -0
  102. package/dist/client/builder/widget/widget.mjs.map +1 -0
  103. package/dist/client/components/actions/action-button.d.mts +2 -0
  104. package/dist/client/components/actions/action-button.mjs +135 -0
  105. package/dist/client/components/actions/action-button.mjs.map +1 -0
  106. package/dist/client/components/actions/action-dialog.d.mts +2 -0
  107. package/dist/client/components/actions/action-dialog.mjs +264 -0
  108. package/dist/client/components/actions/action-dialog.mjs.map +1 -0
  109. package/dist/client/components/actions/confirmation-dialog.d.mts +2 -0
  110. package/dist/client/components/actions/confirmation-dialog.mjs +82 -0
  111. package/dist/client/components/actions/confirmation-dialog.mjs.map +1 -0
  112. package/dist/client/components/actions/header-actions.d.mts +2 -0
  113. package/dist/client/components/actions/header-actions.mjs +117 -0
  114. package/dist/client/components/actions/header-actions.mjs.map +1 -0
  115. package/dist/client/components/actions/index.d.mts +4 -0
  116. package/dist/client/components/admin-link.d.mts +67 -0
  117. package/dist/client/components/admin-link.d.mts.map +1 -0
  118. package/dist/client/components/admin-link.mjs +92 -0
  119. package/dist/client/components/admin-link.mjs.map +1 -0
  120. package/dist/client/components/auth/auth-guard.d.mts +51 -0
  121. package/dist/client/components/auth/auth-guard.d.mts.map +1 -0
  122. package/dist/client/components/auth/auth-guard.mjs +60 -0
  123. package/dist/client/components/auth/auth-guard.mjs.map +1 -0
  124. package/dist/client/components/auth/auth-loading.d.mts +36 -0
  125. package/dist/client/components/auth/auth-loading.d.mts.map +1 -0
  126. package/dist/client/components/auth/auth-loading.mjs +27 -0
  127. package/dist/client/components/auth/auth-loading.mjs.map +1 -0
  128. package/dist/client/components/auth/index.d.mts +2 -0
  129. package/dist/client/components/blocks/block-canvas.mjs +90 -0
  130. package/dist/client/components/blocks/block-canvas.mjs.map +1 -0
  131. package/dist/client/components/blocks/block-editor-context.mjs +58 -0
  132. package/dist/client/components/blocks/block-editor-context.mjs.map +1 -0
  133. package/dist/client/components/blocks/block-editor-layout.mjs +82 -0
  134. package/dist/client/components/blocks/block-editor-layout.mjs.map +1 -0
  135. package/dist/client/components/blocks/block-editor-provider.mjs +155 -0
  136. package/dist/client/components/blocks/block-editor-provider.mjs.map +1 -0
  137. package/dist/client/components/blocks/block-fields-renderer.mjs +70 -0
  138. package/dist/client/components/blocks/block-fields-renderer.mjs.map +1 -0
  139. package/dist/client/components/blocks/block-insert-button.mjs +72 -0
  140. package/dist/client/components/blocks/block-insert-button.mjs.map +1 -0
  141. package/dist/client/components/blocks/block-item-menu.mjs +161 -0
  142. package/dist/client/components/blocks/block-item-menu.mjs.map +1 -0
  143. package/dist/client/components/blocks/block-item.mjs +187 -0
  144. package/dist/client/components/blocks/block-item.mjs.map +1 -0
  145. package/dist/client/components/blocks/block-library-sidebar.mjs +190 -0
  146. package/dist/client/components/blocks/block-library-sidebar.mjs.map +1 -0
  147. package/dist/client/components/blocks/block-tree.mjs +45 -0
  148. package/dist/client/components/blocks/block-tree.mjs.map +1 -0
  149. package/dist/client/components/blocks/block-type-icon.mjs +50 -0
  150. package/dist/client/components/blocks/block-type-icon.mjs.map +1 -0
  151. package/dist/client/components/blocks/utils/tree-utils.mjs +186 -0
  152. package/dist/client/components/blocks/utils/tree-utils.mjs.map +1 -0
  153. package/dist/client/components/component-renderer.d.mts +125 -0
  154. package/dist/client/components/component-renderer.d.mts.map +1 -0
  155. package/dist/client/components/component-renderer.mjs +145 -0
  156. package/dist/client/components/component-renderer.mjs.map +1 -0
  157. package/dist/client/components/error-boundary.mjs +92 -0
  158. package/dist/client/components/error-boundary.mjs.map +1 -0
  159. package/dist/client/components/fields/array-field.d.mts +44 -0
  160. package/dist/client/components/fields/array-field.d.mts.map +1 -0
  161. package/dist/client/components/fields/array-field.mjs +231 -0
  162. package/dist/client/components/fields/array-field.mjs.map +1 -0
  163. package/dist/client/components/fields/asset-preview-field.d.mts +52 -0
  164. package/dist/client/components/fields/asset-preview-field.d.mts.map +1 -0
  165. package/dist/client/components/fields/asset-preview-field.mjs +60 -0
  166. package/dist/client/components/fields/asset-preview-field.mjs.map +1 -0
  167. package/dist/client/components/fields/blocks-field/blocks-field.d.mts +41 -0
  168. package/dist/client/components/fields/blocks-field/blocks-field.d.mts.map +1 -0
  169. package/dist/client/components/fields/blocks-field/blocks-field.mjs +101 -0
  170. package/dist/client/components/fields/blocks-field/blocks-field.mjs.map +1 -0
  171. package/dist/client/components/fields/blocks-field/index.d.mts +1 -0
  172. package/dist/client/components/fields/boolean-field.d.mts +30 -0
  173. package/dist/client/components/fields/boolean-field.d.mts.map +1 -0
  174. package/dist/client/components/fields/boolean-field.mjs +47 -0
  175. package/dist/client/components/fields/boolean-field.mjs.map +1 -0
  176. package/dist/client/components/fields/custom-field.d.mts +3 -0
  177. package/dist/client/components/fields/date-field.d.mts +22 -0
  178. package/dist/client/components/fields/date-field.d.mts.map +1 -0
  179. package/dist/client/components/fields/date-field.mjs +42 -0
  180. package/dist/client/components/fields/date-field.mjs.map +1 -0
  181. package/dist/client/components/fields/datetime-field.d.mts +23 -0
  182. package/dist/client/components/fields/datetime-field.d.mts.map +1 -0
  183. package/dist/client/components/fields/datetime-field.mjs +43 -0
  184. package/dist/client/components/fields/datetime-field.mjs.map +1 -0
  185. package/dist/client/components/fields/email-field.d.mts +19 -0
  186. package/dist/client/components/fields/email-field.d.mts.map +1 -0
  187. package/dist/client/components/fields/email-field.mjs +38 -0
  188. package/dist/client/components/fields/email-field.mjs.map +1 -0
  189. package/dist/client/components/fields/embedded-collection.d.mts +3 -0
  190. package/dist/client/components/fields/field-types.d.mts +571 -0
  191. package/dist/client/components/fields/field-types.d.mts.map +1 -0
  192. package/dist/client/components/fields/field-utils.d.mts +1 -0
  193. package/dist/client/components/fields/field-utils.mjs +65 -0
  194. package/dist/client/components/fields/field-utils.mjs.map +1 -0
  195. package/dist/client/components/fields/field-wrapper.d.mts +3 -0
  196. package/dist/client/components/fields/field-wrapper.mjs +49 -0
  197. package/dist/client/components/fields/field-wrapper.mjs.map +1 -0
  198. package/dist/client/components/fields/index.d.mts +33 -0
  199. package/dist/client/components/fields/json-field.d.mts +84 -0
  200. package/dist/client/components/fields/json-field.d.mts.map +1 -0
  201. package/dist/client/components/fields/json-field.mjs +248 -0
  202. package/dist/client/components/fields/json-field.mjs.map +1 -0
  203. package/dist/client/components/fields/locale-badge.d.mts +1 -0
  204. package/dist/client/components/fields/locale-badge.mjs +17 -0
  205. package/dist/client/components/fields/locale-badge.mjs.map +1 -0
  206. package/dist/client/components/fields/number-field.d.mts +23 -0
  207. package/dist/client/components/fields/number-field.d.mts.map +1 -0
  208. package/dist/client/components/fields/number-field.mjs +40 -0
  209. package/dist/client/components/fields/number-field.mjs.map +1 -0
  210. package/dist/client/components/fields/object-array-field.d.mts +2 -0
  211. package/dist/client/components/fields/object-array-field.mjs +313 -0
  212. package/dist/client/components/fields/object-array-field.mjs.map +1 -0
  213. package/dist/client/components/fields/object-field.d.mts +32 -0
  214. package/dist/client/components/fields/object-field.d.mts.map +1 -0
  215. package/dist/client/components/fields/object-field.mjs +128 -0
  216. package/dist/client/components/fields/object-field.mjs.map +1 -0
  217. package/dist/client/components/fields/relation/displays/cards-display.d.mts +2 -0
  218. package/dist/client/components/fields/relation/displays/cards-display.mjs +140 -0
  219. package/dist/client/components/fields/relation/displays/cards-display.mjs.map +1 -0
  220. package/dist/client/components/fields/relation/displays/chips-display.d.mts +2 -0
  221. package/dist/client/components/fields/relation/displays/chips-display.mjs +100 -0
  222. package/dist/client/components/fields/relation/displays/chips-display.mjs.map +1 -0
  223. package/dist/client/components/fields/relation/displays/grid-display.d.mts +2 -0
  224. package/dist/client/components/fields/relation/displays/grid-display.mjs +114 -0
  225. package/dist/client/components/fields/relation/displays/grid-display.mjs.map +1 -0
  226. package/dist/client/components/fields/relation/displays/index.d.mts +6 -0
  227. package/dist/client/components/fields/relation/displays/list-display.d.mts +2 -0
  228. package/dist/client/components/fields/relation/displays/list-display.mjs +128 -0
  229. package/dist/client/components/fields/relation/displays/list-display.mjs.map +1 -0
  230. package/dist/client/components/fields/relation/displays/table-display.d.mts +2 -0
  231. package/dist/client/components/fields/relation/displays/table-display.mjs +134 -0
  232. package/dist/client/components/fields/relation/displays/table-display.mjs.map +1 -0
  233. package/dist/client/components/fields/relation/displays/types.d.mts +22 -0
  234. package/dist/client/components/fields/relation/displays/types.d.mts.map +1 -0
  235. package/dist/client/components/fields/relation/displays/types.mjs +73 -0
  236. package/dist/client/components/fields/relation/displays/types.mjs.map +1 -0
  237. package/dist/client/components/fields/relation/index.d.mts +3 -0
  238. package/dist/client/components/fields/relation/relation-items-display.d.mts +5 -0
  239. package/dist/client/components/fields/relation/relation-items-display.mjs +47 -0
  240. package/dist/client/components/fields/relation/relation-items-display.mjs.map +1 -0
  241. package/dist/client/components/fields/relation-field.d.mts +134 -0
  242. package/dist/client/components/fields/relation-field.d.mts.map +1 -0
  243. package/dist/client/components/fields/relation-field.mjs +106 -0
  244. package/dist/client/components/fields/relation-field.mjs.map +1 -0
  245. package/dist/client/components/fields/relation-picker.d.mts +4 -0
  246. package/dist/client/components/fields/relation-picker.mjs +301 -0
  247. package/dist/client/components/fields/relation-picker.mjs.map +1 -0
  248. package/dist/client/components/fields/relation-select.d.mts +3 -0
  249. package/dist/client/components/fields/relation-select.mjs +219 -0
  250. package/dist/client/components/fields/relation-select.mjs.map +1 -0
  251. package/dist/client/components/fields/reverse-relation-field.d.mts +2 -0
  252. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +56 -0
  253. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs.map +1 -0
  254. package/dist/client/components/fields/rich-text-editor/extensions.mjs +118 -0
  255. package/dist/client/components/fields/rich-text-editor/extensions.mjs.map +1 -0
  256. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +196 -0
  257. package/dist/client/components/fields/rich-text-editor/image-popover.mjs.map +1 -0
  258. package/dist/client/components/fields/rich-text-editor/index.d.mts +4 -0
  259. package/dist/client/components/fields/rich-text-editor/index.mjs +187 -0
  260. package/dist/client/components/fields/rich-text-editor/index.mjs.map +1 -0
  261. package/dist/client/components/fields/rich-text-editor/link-popover.mjs +86 -0
  262. package/dist/client/components/fields/rich-text-editor/link-popover.mjs.map +1 -0
  263. package/dist/client/components/fields/rich-text-editor/presets.d.mts +11 -0
  264. package/dist/client/components/fields/rich-text-editor/presets.d.mts.map +1 -0
  265. package/dist/client/components/fields/rich-text-editor/presets.mjs +124 -0
  266. package/dist/client/components/fields/rich-text-editor/presets.mjs.map +1 -0
  267. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +145 -0
  268. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs.map +1 -0
  269. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +124 -0
  270. package/dist/client/components/fields/rich-text-editor/table-controls.mjs.map +1 -0
  271. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +280 -0
  272. package/dist/client/components/fields/rich-text-editor/toolbar.mjs.map +1 -0
  273. package/dist/client/components/fields/rich-text-editor/types.d.mts +78 -0
  274. package/dist/client/components/fields/rich-text-editor/types.d.mts.map +1 -0
  275. package/dist/client/components/fields/rich-text-editor/types.mjs +31 -0
  276. package/dist/client/components/fields/rich-text-editor/types.mjs.map +1 -0
  277. package/dist/client/components/fields/rich-text-editor/utils.mjs +51 -0
  278. package/dist/client/components/fields/rich-text-editor/utils.mjs.map +1 -0
  279. package/dist/client/components/fields/rich-text-editor/variants.d.mts +2 -0
  280. package/dist/client/components/fields/rich-text-field.d.mts +14 -0
  281. package/dist/client/components/fields/rich-text-field.d.mts.map +1 -0
  282. package/dist/client/components/fields/rich-text-field.mjs +26 -0
  283. package/dist/client/components/fields/rich-text-field.mjs.map +1 -0
  284. package/dist/client/components/fields/select-field.d.mts +25 -0
  285. package/dist/client/components/fields/select-field.d.mts.map +1 -0
  286. package/dist/client/components/fields/select-field.mjs +53 -0
  287. package/dist/client/components/fields/select-field.mjs.map +1 -0
  288. package/dist/client/components/fields/status-field.d.mts +2 -0
  289. package/dist/client/components/fields/text-field.d.mts +22 -0
  290. package/dist/client/components/fields/text-field.d.mts.map +1 -0
  291. package/dist/client/components/fields/text-field.mjs +39 -0
  292. package/dist/client/components/fields/text-field.mjs.map +1 -0
  293. package/dist/client/components/fields/textarea-field.d.mts +22 -0
  294. package/dist/client/components/fields/textarea-field.d.mts.map +1 -0
  295. package/dist/client/components/fields/textarea-field.mjs +39 -0
  296. package/dist/client/components/fields/textarea-field.mjs.map +1 -0
  297. package/dist/client/components/fields/time-field.d.mts +20 -0
  298. package/dist/client/components/fields/time-field.d.mts.map +1 -0
  299. package/dist/client/components/fields/time-field.mjs +39 -0
  300. package/dist/client/components/fields/time-field.mjs.map +1 -0
  301. package/dist/client/components/fields/upload-field.d.mts +97 -0
  302. package/dist/client/components/fields/upload-field.d.mts.map +1 -0
  303. package/dist/client/components/fields/upload-field.mjs +497 -0
  304. package/dist/client/components/fields/upload-field.mjs.map +1 -0
  305. package/dist/client/components/filter-builder/columns-tab.d.mts +1 -0
  306. package/dist/client/components/filter-builder/columns-tab.mjs +131 -0
  307. package/dist/client/components/filter-builder/columns-tab.mjs.map +1 -0
  308. package/dist/client/components/filter-builder/filter-builder-sheet.d.mts +1 -0
  309. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +157 -0
  310. package/dist/client/components/filter-builder/filter-builder-sheet.mjs.map +1 -0
  311. package/dist/client/components/filter-builder/filters-tab.d.mts +1 -0
  312. package/dist/client/components/filter-builder/filters-tab.mjs +380 -0
  313. package/dist/client/components/filter-builder/filters-tab.mjs.map +1 -0
  314. package/dist/client/components/filter-builder/index.d.mts +5 -0
  315. package/dist/client/components/filter-builder/saved-views-tab.d.mts +1 -0
  316. package/dist/client/components/filter-builder/saved-views-tab.mjs +125 -0
  317. package/dist/client/components/filter-builder/saved-views-tab.mjs.map +1 -0
  318. package/dist/client/components/index.d.mts +80 -0
  319. package/dist/client/components/locale-switcher.d.mts +2 -0
  320. package/dist/client/components/locale-switcher.mjs +128 -0
  321. package/dist/client/components/locale-switcher.mjs.map +1 -0
  322. package/dist/client/components/media/media-grid.mjs +139 -0
  323. package/dist/client/components/media/media-grid.mjs.map +1 -0
  324. package/dist/client/components/media/media-picker-dialog.mjs +255 -0
  325. package/dist/client/components/media/media-picker-dialog.mjs.map +1 -0
  326. package/dist/client/components/preview/live-preview-mode.mjs +211 -0
  327. package/dist/client/components/preview/live-preview-mode.mjs.map +1 -0
  328. package/dist/client/components/preview/preview-pane.mjs +179 -0
  329. package/dist/client/components/preview/preview-pane.mjs.map +1 -0
  330. package/dist/client/components/primitives/asset-preview.mjs +363 -0
  331. package/dist/client/components/primitives/asset-preview.mjs.map +1 -0
  332. package/dist/client/components/primitives/checkbox-input.mjs +33 -0
  333. package/dist/client/components/primitives/checkbox-input.mjs.map +1 -0
  334. package/dist/client/components/primitives/date-input.mjs +218 -0
  335. package/dist/client/components/primitives/date-input.mjs.map +1 -0
  336. package/dist/client/components/primitives/dropzone.mjs +239 -0
  337. package/dist/client/components/primitives/dropzone.mjs.map +1 -0
  338. package/dist/client/components/primitives/number-input.mjs +113 -0
  339. package/dist/client/components/primitives/number-input.mjs.map +1 -0
  340. package/dist/client/components/primitives/select-multi.mjs +256 -0
  341. package/dist/client/components/primitives/select-multi.mjs.map +1 -0
  342. package/dist/client/components/primitives/select-single.mjs +183 -0
  343. package/dist/client/components/primitives/select-single.mjs.map +1 -0
  344. package/dist/client/components/primitives/text-input.mjs +40 -0
  345. package/dist/client/components/primitives/text-input.mjs.map +1 -0
  346. package/dist/client/components/primitives/textarea-input.mjs +38 -0
  347. package/dist/client/components/primitives/textarea-input.mjs.map +1 -0
  348. package/dist/client/components/primitives/time-input.mjs +72 -0
  349. package/dist/client/components/primitives/time-input.mjs.map +1 -0
  350. package/dist/client/components/primitives/toggle-input.mjs +31 -0
  351. package/dist/client/components/primitives/toggle-input.mjs.map +1 -0
  352. package/dist/client/components/primitives/types.d.mts +14 -0
  353. package/dist/client/components/primitives/types.d.mts.map +1 -0
  354. package/dist/client/components/primitives/types.mjs +13 -0
  355. package/dist/client/components/primitives/types.mjs.map +1 -0
  356. package/dist/client/components/sheets/index.d.mts +1 -0
  357. package/dist/client/components/sheets/resource-sheet.d.mts +1 -0
  358. package/dist/client/components/sheets/resource-sheet.mjs +78 -0
  359. package/dist/client/components/sheets/resource-sheet.mjs.map +1 -0
  360. package/dist/client/components/ui/accordion.d.mts +2 -0
  361. package/dist/client/components/ui/accordion.mjs +50 -0
  362. package/dist/client/components/ui/accordion.mjs.map +1 -0
  363. package/dist/client/components/ui/alert.mjs +32 -0
  364. package/dist/client/components/ui/alert.mjs.map +1 -0
  365. package/dist/client/components/ui/avatar.d.mts +3 -0
  366. package/dist/client/components/ui/badge.d.mts +3 -0
  367. package/dist/client/components/ui/badge.mjs +35 -0
  368. package/dist/client/components/ui/badge.mjs.map +1 -0
  369. package/dist/client/components/ui/button.d.mts +3 -0
  370. package/dist/client/components/ui/button.mjs +49 -0
  371. package/dist/client/components/ui/button.mjs.map +1 -0
  372. package/dist/client/components/ui/card.d.mts +2 -0
  373. package/dist/{card-BKHjBQfw.mjs → client/components/ui/card.mjs} +3 -10
  374. package/dist/{card-BKHjBQfw.mjs.map → client/components/ui/card.mjs.map} +1 -1
  375. package/dist/client/components/ui/checkbox.d.mts +2 -0
  376. package/dist/client/components/ui/checkbox.mjs +27 -0
  377. package/dist/client/components/ui/checkbox.mjs.map +1 -0
  378. package/dist/client/components/ui/combobox.d.mts +3 -0
  379. package/dist/client/components/ui/command.mjs +69 -0
  380. package/dist/client/components/ui/command.mjs.map +1 -0
  381. package/dist/client/components/ui/dialog.d.mts +3 -0
  382. package/dist/client/components/ui/dialog.mjs +83 -0
  383. package/dist/client/components/ui/dialog.mjs.map +1 -0
  384. package/dist/client/components/ui/drawer.mjs +75 -0
  385. package/dist/client/components/ui/drawer.mjs.map +1 -0
  386. package/dist/client/components/ui/dropdown-menu.d.mts +3 -0
  387. package/dist/client/components/ui/dropdown-menu.mjs +89 -0
  388. package/dist/client/components/ui/dropdown-menu.mjs.map +1 -0
  389. package/dist/client/components/ui/empty-state.mjs +53 -0
  390. package/dist/client/components/ui/empty-state.mjs.map +1 -0
  391. package/dist/client/components/ui/field.d.mts +3 -0
  392. package/dist/client/components/ui/field.mjs +78 -0
  393. package/dist/client/components/ui/field.mjs.map +1 -0
  394. package/dist/client/components/ui/input-group.d.mts +4 -0
  395. package/dist/client/components/ui/input-group.mjs +68 -0
  396. package/dist/client/components/ui/input-group.mjs.map +1 -0
  397. package/dist/client/components/ui/input.d.mts +2 -0
  398. package/dist/client/components/ui/input.mjs +17 -0
  399. package/dist/client/components/ui/input.mjs.map +1 -0
  400. package/dist/client/components/ui/kbd.mjs +24 -0
  401. package/dist/client/components/ui/kbd.mjs.map +1 -0
  402. package/dist/client/components/ui/label.d.mts +2 -0
  403. package/dist/client/components/ui/label.mjs +15 -0
  404. package/dist/client/components/ui/label.mjs.map +1 -0
  405. package/dist/client/components/ui/popover.d.mts +3 -0
  406. package/dist/client/components/ui/popover.mjs +49 -0
  407. package/dist/client/components/ui/popover.mjs.map +1 -0
  408. package/dist/client/components/ui/responsive-dialog.mjs +102 -0
  409. package/dist/client/components/ui/responsive-dialog.mjs.map +1 -0
  410. package/dist/client/components/ui/scroll-area.d.mts +2 -0
  411. package/dist/client/components/ui/search-input.mjs +74 -0
  412. package/dist/client/components/ui/search-input.mjs.map +1 -0
  413. package/dist/client/components/ui/select.d.mts +3 -0
  414. package/dist/client/components/ui/select.mjs +85 -0
  415. package/dist/client/components/ui/select.mjs.map +1 -0
  416. package/dist/client/components/ui/separator.d.mts +2 -0
  417. package/dist/client/components/ui/separator.mjs +17 -0
  418. package/dist/client/components/ui/separator.mjs.map +1 -0
  419. package/dist/client/components/ui/sheet.d.mts +3 -0
  420. package/dist/client/components/ui/sheet.mjs +78 -0
  421. package/dist/client/components/ui/sheet.mjs.map +1 -0
  422. package/dist/client/components/ui/sidebar.d.mts +8 -0
  423. package/dist/client/components/ui/sidebar.mjs +256 -0
  424. package/dist/client/components/ui/sidebar.mjs.map +1 -0
  425. package/dist/client/components/ui/skeleton.d.mts +1 -0
  426. package/dist/client/components/ui/skeleton.mjs +15 -0
  427. package/dist/client/components/ui/skeleton.mjs.map +1 -0
  428. package/dist/client/components/ui/sonner.d.mts +14 -0
  429. package/dist/client/components/ui/sonner.d.mts.map +1 -0
  430. package/dist/client/components/ui/sonner.mjs +55 -0
  431. package/dist/client/components/ui/sonner.mjs.map +1 -0
  432. package/dist/client/components/ui/spinner.d.mts +1 -0
  433. package/dist/client/components/ui/spinner.mjs +18 -0
  434. package/dist/client/components/ui/spinner.mjs.map +1 -0
  435. package/dist/client/components/ui/switch.d.mts +2 -0
  436. package/dist/client/components/ui/switch.mjs +23 -0
  437. package/dist/client/components/ui/switch.mjs.map +1 -0
  438. package/dist/client/components/ui/table.d.mts +2 -0
  439. package/dist/client/components/ui/table.mjs +66 -0
  440. package/dist/client/components/ui/table.mjs.map +1 -0
  441. package/dist/client/components/ui/tabs.d.mts +3 -0
  442. package/dist/client/components/ui/tabs.mjs +49 -0
  443. package/dist/client/components/ui/tabs.mjs.map +1 -0
  444. package/dist/client/components/ui/textarea.d.mts +2 -0
  445. package/dist/client/components/ui/textarea.mjs +15 -0
  446. package/dist/client/components/ui/textarea.mjs.map +1 -0
  447. package/dist/client/components/ui/toolbar.mjs +54 -0
  448. package/dist/client/components/ui/toolbar.mjs.map +1 -0
  449. package/dist/client/components/ui/tooltip.d.mts +2 -0
  450. package/dist/client/components/ui/tooltip.mjs +45 -0
  451. package/dist/client/components/ui/tooltip.mjs.map +1 -0
  452. package/dist/client/components/widgets/chart-widget.d.mts +57 -0
  453. package/dist/client/components/widgets/chart-widget.d.mts.map +1 -0
  454. package/dist/client/components/widgets/chart-widget.mjs +282 -0
  455. package/dist/client/components/widgets/chart-widget.mjs.map +1 -0
  456. package/dist/client/components/widgets/progress-widget.d.mts +41 -0
  457. package/dist/client/components/widgets/progress-widget.d.mts.map +1 -0
  458. package/dist/client/components/widgets/progress-widget.mjs +110 -0
  459. package/dist/client/components/widgets/progress-widget.mjs.map +1 -0
  460. package/dist/client/components/widgets/quick-actions-widget.d.mts +29 -0
  461. package/dist/client/components/widgets/quick-actions-widget.d.mts.map +1 -0
  462. package/dist/client/components/widgets/quick-actions-widget.mjs +121 -0
  463. package/dist/client/components/widgets/quick-actions-widget.mjs.map +1 -0
  464. package/dist/client/components/widgets/recent-items-widget.d.mts +51 -0
  465. package/dist/client/components/widgets/recent-items-widget.d.mts.map +1 -0
  466. package/dist/client/components/widgets/recent-items-widget.mjs +101 -0
  467. package/dist/client/components/widgets/recent-items-widget.mjs.map +1 -0
  468. package/dist/client/components/widgets/stats-widget.d.mts +55 -0
  469. package/dist/client/components/widgets/stats-widget.d.mts.map +1 -0
  470. package/dist/client/components/widgets/stats-widget.mjs +150 -0
  471. package/dist/client/components/widgets/stats-widget.mjs.map +1 -0
  472. package/dist/client/components/widgets/table-widget.d.mts +31 -0
  473. package/dist/client/components/widgets/table-widget.d.mts.map +1 -0
  474. package/dist/client/components/widgets/table-widget.mjs +139 -0
  475. package/dist/client/components/widgets/table-widget.mjs.map +1 -0
  476. package/dist/client/components/widgets/timeline-widget.d.mts +51 -0
  477. package/dist/client/components/widgets/timeline-widget.d.mts.map +1 -0
  478. package/dist/client/components/widgets/timeline-widget.mjs +168 -0
  479. package/dist/client/components/widgets/timeline-widget.mjs.map +1 -0
  480. package/dist/client/components/widgets/value-widget.d.mts +39 -0
  481. package/dist/client/components/widgets/value-widget.d.mts.map +1 -0
  482. package/dist/client/components/widgets/value-widget.mjs +111 -0
  483. package/dist/client/components/widgets/value-widget.mjs.map +1 -0
  484. package/dist/client/components/widgets/widget-skeletons.mjs +145 -0
  485. package/dist/client/components/widgets/widget-skeletons.mjs.map +1 -0
  486. package/dist/client/context/focus-context.d.mts +88 -0
  487. package/dist/client/context/focus-context.d.mts.map +1 -0
  488. package/dist/client/context/focus-context.mjs +178 -0
  489. package/dist/client/context/focus-context.mjs.map +1 -0
  490. package/dist/client/contexts/breadcrumb-context.mjs +32 -0
  491. package/dist/client/contexts/breadcrumb-context.mjs.map +1 -0
  492. package/dist/client/hooks/typed-hooks.d.mts +84 -0
  493. package/dist/client/hooks/typed-hooks.d.mts.map +1 -0
  494. package/dist/client/hooks/typed-hooks.mjs +272 -0
  495. package/dist/client/hooks/typed-hooks.mjs.map +1 -0
  496. package/dist/client/hooks/use-action.mjs +201 -0
  497. package/dist/client/hooks/use-action.mjs.map +1 -0
  498. package/dist/client/hooks/use-admin-config.mjs +40 -0
  499. package/dist/client/hooks/use-admin-config.mjs.map +1 -0
  500. package/dist/client/hooks/use-admin-preferences.mjs +68 -0
  501. package/dist/client/hooks/use-admin-preferences.mjs.map +1 -0
  502. package/dist/client/hooks/use-admin-routes.mjs +97 -0
  503. package/dist/client/hooks/use-admin-routes.mjs.map +1 -0
  504. package/dist/client/hooks/use-auth.d.mts +98 -0
  505. package/dist/client/hooks/use-auth.d.mts.map +1 -0
  506. package/dist/{use-auth-BoLmWtmU.mjs → client/hooks/use-auth.mjs} +3 -3
  507. package/dist/client/hooks/use-auth.mjs.map +1 -0
  508. package/dist/client/hooks/use-collection-fields.mjs +32 -0
  509. package/dist/client/hooks/use-collection-fields.mjs.map +1 -0
  510. package/dist/client/hooks/use-collection-meta.mjs +121 -0
  511. package/dist/client/hooks/use-collection-meta.mjs.map +1 -0
  512. package/dist/client/hooks/use-collection-schema.mjs +67 -0
  513. package/dist/client/hooks/use-collection-schema.mjs.map +1 -0
  514. package/dist/client/hooks/use-collection-validation.mjs +74 -0
  515. package/dist/client/hooks/use-collection-validation.mjs.map +1 -0
  516. package/dist/client/hooks/use-collection.d.mts +86 -0
  517. package/dist/client/hooks/use-collection.d.mts.map +1 -0
  518. package/dist/client/hooks/use-collection.mjs +214 -0
  519. package/dist/client/hooks/use-collection.mjs.map +1 -0
  520. package/dist/client/hooks/use-current-user.d.mts +57 -0
  521. package/dist/client/hooks/use-current-user.d.mts.map +1 -0
  522. package/dist/client/hooks/use-current-user.mjs +79 -0
  523. package/dist/client/hooks/use-current-user.mjs.map +1 -0
  524. package/dist/client/hooks/use-field-hooks.mjs +191 -0
  525. package/dist/client/hooks/use-field-hooks.mjs.map +1 -0
  526. package/dist/client/hooks/use-field-options.d.mts +90 -0
  527. package/dist/client/hooks/use-field-options.d.mts.map +1 -0
  528. package/dist/client/hooks/use-field-options.mjs +184 -0
  529. package/dist/client/hooks/use-field-options.mjs.map +1 -0
  530. package/dist/client/hooks/use-global-fields.mjs +27 -0
  531. package/dist/client/hooks/use-global-fields.mjs.map +1 -0
  532. package/dist/client/hooks/use-global-meta.mjs +59 -0
  533. package/dist/client/hooks/use-global-meta.mjs.map +1 -0
  534. package/dist/client/hooks/use-global-schema.mjs +33 -0
  535. package/dist/client/hooks/use-global-schema.mjs.map +1 -0
  536. package/dist/client/hooks/use-global.d.mts +40 -0
  537. package/dist/client/hooks/use-global.d.mts.map +1 -0
  538. package/dist/client/hooks/use-global.mjs +74 -0
  539. package/dist/client/hooks/use-global.mjs.map +1 -0
  540. package/dist/client/hooks/use-locks.mjs +245 -0
  541. package/dist/client/hooks/use-locks.mjs.map +1 -0
  542. package/dist/client/hooks/use-media-query.d.mts +23 -0
  543. package/dist/client/hooks/use-media-query.d.mts.map +1 -0
  544. package/dist/client/hooks/use-media-query.mjs +62 -0
  545. package/dist/client/hooks/use-media-query.mjs.map +1 -0
  546. package/dist/client/hooks/use-prefill-params.mjs +47 -0
  547. package/dist/client/hooks/use-prefill-params.mjs.map +1 -0
  548. package/dist/client/hooks/use-questpie-query-options.mjs +28 -0
  549. package/dist/client/hooks/use-questpie-query-options.mjs.map +1 -0
  550. package/dist/client/hooks/use-reactive-fields.d.mts +75 -0
  551. package/dist/client/hooks/use-reactive-fields.d.mts.map +1 -0
  552. package/dist/client/hooks/use-reactive-fields.mjs +164 -0
  553. package/dist/client/hooks/use-reactive-fields.mjs.map +1 -0
  554. package/dist/client/hooks/use-realtime-highlight.mjs +96 -0
  555. package/dist/client/hooks/use-realtime-highlight.mjs.map +1 -0
  556. package/dist/client/hooks/use-saved-views.mjs +65 -0
  557. package/dist/client/hooks/use-saved-views.mjs.map +1 -0
  558. package/dist/client/hooks/use-search.mjs +147 -0
  559. package/dist/client/hooks/use-search.mjs.map +1 -0
  560. package/dist/client/hooks/use-server-validation.mjs +199 -0
  561. package/dist/client/hooks/use-server-validation.mjs.map +1 -0
  562. package/dist/client/hooks/use-server-widget-data.d.mts +26 -0
  563. package/dist/client/hooks/use-server-widget-data.d.mts.map +1 -0
  564. package/dist/client/hooks/use-server-widget-data.mjs +40 -0
  565. package/dist/client/hooks/use-server-widget-data.mjs.map +1 -0
  566. package/dist/client/hooks/use-setup-status.d.mts +39 -0
  567. package/dist/client/hooks/use-setup-status.d.mts.map +1 -0
  568. package/dist/client/hooks/use-setup-status.mjs +50 -0
  569. package/dist/client/hooks/use-setup-status.mjs.map +1 -0
  570. package/dist/client/hooks/use-upload-collection.mjs +32 -0
  571. package/dist/client/hooks/use-upload-collection.mjs.map +1 -0
  572. package/dist/client/hooks/use-upload.d.mts +23 -0
  573. package/dist/client/hooks/use-upload.d.mts.map +1 -0
  574. package/dist/client/hooks/use-upload.mjs +145 -0
  575. package/dist/client/hooks/use-upload.mjs.map +1 -0
  576. package/dist/client/hooks/use-validation-error-map.mjs +53 -0
  577. package/dist/client/hooks/use-validation-error-map.mjs.map +1 -0
  578. package/dist/client/hooks/use-view-state.mjs +261 -0
  579. package/dist/client/hooks/use-view-state.mjs.map +1 -0
  580. package/dist/client/i18n/hooks.mjs +160 -0
  581. package/dist/client/i18n/hooks.mjs.map +1 -0
  582. package/dist/client/i18n/intl-cache.mjs +65 -0
  583. package/dist/client/i18n/intl-cache.mjs.map +1 -0
  584. package/dist/client/i18n/messages.mjs +7 -0
  585. package/dist/client/i18n/messages.mjs.map +1 -0
  586. package/dist/client/i18n/simple.d.mts +22 -0
  587. package/dist/client/i18n/simple.d.mts.map +1 -0
  588. package/dist/client/i18n/simple.mjs +157 -0
  589. package/dist/client/i18n/simple.mjs.map +1 -0
  590. package/dist/client/i18n/types.d.mts +110 -0
  591. package/dist/client/i18n/types.d.mts.map +1 -0
  592. package/dist/client/lib/utils.d.mts +1 -0
  593. package/dist/client/lib/utils.mjs +28 -0
  594. package/dist/client/lib/utils.mjs.map +1 -0
  595. package/dist/client/preview/block-scope-context.d.mts +74 -0
  596. package/dist/client/preview/block-scope-context.d.mts.map +1 -0
  597. package/dist/client/preview/block-scope-context.mjs +93 -0
  598. package/dist/client/preview/block-scope-context.mjs.map +1 -0
  599. package/dist/client/preview/index.d.mts +5 -0
  600. package/dist/client/preview/preview-banner.d.mts +46 -0
  601. package/dist/client/preview/preview-banner.d.mts.map +1 -0
  602. package/dist/client/preview/preview-banner.mjs +95 -0
  603. package/dist/client/preview/preview-banner.mjs.map +1 -0
  604. package/dist/client/preview/preview-field.d.mts +108 -0
  605. package/dist/client/preview/preview-field.d.mts.map +1 -0
  606. package/dist/client/preview/preview-field.mjs +125 -0
  607. package/dist/client/preview/preview-field.mjs.map +1 -0
  608. package/dist/client/preview/types.d.mts +115 -0
  609. package/dist/client/preview/types.d.mts.map +1 -0
  610. package/dist/client/preview/types.mjs +21 -0
  611. package/dist/client/preview/types.mjs.map +1 -0
  612. package/dist/client/preview/use-collection-preview.d.mts +71 -0
  613. package/dist/client/preview/use-collection-preview.d.mts.map +1 -0
  614. package/dist/client/preview/use-collection-preview.mjs +114 -0
  615. package/dist/client/preview/use-collection-preview.mjs.map +1 -0
  616. package/dist/client/runtime/content-locales-provider.d.mts +1 -0
  617. package/dist/client/runtime/content-locales-provider.mjs +85 -0
  618. package/dist/client/runtime/content-locales-provider.mjs.map +1 -0
  619. package/dist/client/runtime/index.d.mts +7 -0
  620. package/dist/client/runtime/index.mjs +8 -0
  621. package/dist/client/runtime/locale-scope.d.mts +2 -0
  622. package/dist/{runtime-6VZM878K.mjs → client/runtime/locale-scope.mjs} +3 -4
  623. package/dist/client/runtime/locale-scope.mjs.map +1 -0
  624. package/dist/client/runtime/provider.d.mts +10107 -0
  625. package/dist/client/runtime/provider.d.mts.map +1 -0
  626. package/dist/client/runtime/provider.mjs +229 -0
  627. package/dist/client/runtime/provider.mjs.map +1 -0
  628. package/dist/client/runtime/routes.d.mts +49 -0
  629. package/dist/client/runtime/routes.d.mts.map +1 -0
  630. package/dist/client/runtime/routes.mjs +107 -0
  631. package/dist/client/runtime/routes.mjs.map +1 -0
  632. package/dist/client/runtime/translations-provider.d.mts +2 -0
  633. package/dist/client/runtime/translations-provider.mjs +181 -0
  634. package/dist/client/runtime/translations-provider.mjs.map +1 -0
  635. package/dist/client/scope/index.d.mts +3 -0
  636. package/dist/client/scope/picker.d.mts +54 -0
  637. package/dist/client/scope/picker.d.mts.map +1 -0
  638. package/dist/client/scope/picker.mjs +161 -0
  639. package/dist/client/scope/picker.mjs.map +1 -0
  640. package/dist/client/scope/provider.d.mts +104 -0
  641. package/dist/client/scope/provider.d.mts.map +1 -0
  642. package/dist/client/scope/provider.mjs +159 -0
  643. package/dist/client/scope/provider.mjs.map +1 -0
  644. package/dist/client/scope/types.d.mts +112 -0
  645. package/dist/client/scope/types.d.mts.map +1 -0
  646. package/dist/client/styles/index.css +80 -0
  647. package/dist/client/utils/auto-expand-fields.mjs +65 -0
  648. package/dist/client/utils/auto-expand-fields.mjs.map +1 -0
  649. package/dist/client/utils/build-field-definitions-from-schema.mjs +256 -0
  650. package/dist/client/utils/build-field-definitions-from-schema.mjs.map +1 -0
  651. package/dist/client/utils/detect-relations.mjs +46 -0
  652. package/dist/client/utils/detect-relations.mjs.map +1 -0
  653. package/dist/client/utils/locale-to-flag.d.mts +118 -0
  654. package/dist/client/utils/locale-to-flag.d.mts.map +1 -0
  655. package/dist/client/utils/locale-to-flag.mjs +130 -0
  656. package/dist/client/utils/locale-to-flag.mjs.map +1 -0
  657. package/dist/client/utils/routes.mjs +196 -0
  658. package/dist/client/utils/routes.mjs.map +1 -0
  659. package/dist/client/views/auth/accept-invite-form.d.mts +73 -0
  660. package/dist/client/views/auth/accept-invite-form.d.mts.map +1 -0
  661. package/dist/client/views/auth/accept-invite-form.mjs +180 -0
  662. package/dist/client/views/auth/accept-invite-form.mjs.map +1 -0
  663. package/dist/client/views/auth/auth-layout.d.mts +44 -0
  664. package/dist/client/views/auth/auth-layout.d.mts.map +1 -0
  665. package/dist/client/views/auth/auth-layout.mjs +53 -0
  666. package/dist/client/views/auth/auth-layout.mjs.map +1 -0
  667. package/dist/client/views/auth/forgot-password-form.d.mts +59 -0
  668. package/dist/client/views/auth/forgot-password-form.d.mts.map +1 -0
  669. package/dist/{forgot-password-page-Bcp-An4Y.mjs → client/views/auth/forgot-password-form.mjs} +22 -89
  670. package/dist/client/views/auth/forgot-password-form.mjs.map +1 -0
  671. package/dist/client/views/auth/index.d.mts +7 -0
  672. package/dist/client/views/auth/invite-form.d.mts +1 -0
  673. package/dist/client/views/auth/invite-form.mjs +155 -0
  674. package/dist/client/views/auth/invite-form.mjs.map +1 -0
  675. package/dist/client/views/auth/login-form.d.mts +76 -0
  676. package/dist/client/views/auth/login-form.d.mts.map +1 -0
  677. package/dist/client/views/auth/login-form.mjs +167 -0
  678. package/dist/client/views/auth/login-form.mjs.map +1 -0
  679. package/dist/client/views/auth/reset-password-form.d.mts +66 -0
  680. package/dist/client/views/auth/reset-password-form.d.mts.map +1 -0
  681. package/dist/client/views/auth/reset-password-form.mjs +188 -0
  682. package/dist/client/views/auth/reset-password-form.mjs.map +1 -0
  683. package/dist/client/views/auth/setup-form.d.mts +61 -0
  684. package/dist/client/views/auth/setup-form.d.mts.map +1 -0
  685. package/dist/{setup-page-YAP_fzqh.mjs → client/views/auth/setup-form.mjs} +46 -124
  686. package/dist/client/views/auth/setup-form.mjs.map +1 -0
  687. package/dist/client/views/collection/auto-form-fields.d.mts +4 -0
  688. package/dist/client/views/collection/auto-form-fields.mjs +453 -0
  689. package/dist/client/views/collection/auto-form-fields.mjs.map +1 -0
  690. package/dist/client/views/collection/bulk-action-toolbar.mjs +291 -0
  691. package/dist/client/views/collection/bulk-action-toolbar.mjs.map +1 -0
  692. package/dist/client/views/collection/cells/complex-cells.d.mts +46 -0
  693. package/dist/client/views/collection/cells/complex-cells.d.mts.map +1 -0
  694. package/dist/client/views/collection/cells/complex-cells.mjs +327 -0
  695. package/dist/client/views/collection/cells/complex-cells.mjs.map +1 -0
  696. package/dist/client/views/collection/cells/index.d.mts +7 -0
  697. package/dist/client/views/collection/cells/primitive-cells.d.mts +76 -0
  698. package/dist/client/views/collection/cells/primitive-cells.d.mts.map +1 -0
  699. package/dist/client/views/collection/cells/primitive-cells.mjs +165 -0
  700. package/dist/client/views/collection/cells/primitive-cells.mjs.map +1 -0
  701. package/dist/client/views/collection/cells/relation-cells.d.mts +21 -0
  702. package/dist/client/views/collection/cells/relation-cells.d.mts.map +1 -0
  703. package/dist/client/views/collection/cells/relation-cells.mjs +105 -0
  704. package/dist/client/views/collection/cells/relation-cells.mjs.map +1 -0
  705. package/dist/client/views/collection/cells/shared/asset-thumbnail.d.mts +1 -0
  706. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +189 -0
  707. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs.map +1 -0
  708. package/dist/client/views/collection/cells/shared/cell-helpers.d.mts +2 -0
  709. package/dist/client/views/collection/cells/shared/cell-helpers.mjs +78 -0
  710. package/dist/client/views/collection/cells/shared/cell-helpers.mjs.map +1 -0
  711. package/dist/client/views/collection/cells/shared/relation-chip.d.mts +1 -0
  712. package/dist/client/views/collection/cells/shared/relation-chip.mjs +37 -0
  713. package/dist/client/views/collection/cells/shared/relation-chip.mjs.map +1 -0
  714. package/dist/client/views/collection/cells/upload-cells.d.mts +25 -0
  715. package/dist/client/views/collection/cells/upload-cells.d.mts.map +1 -0
  716. package/dist/client/views/collection/cells/upload-cells.mjs +20 -0
  717. package/dist/client/views/collection/cells/upload-cells.mjs.map +1 -0
  718. package/dist/client/views/collection/columns/build-columns.d.mts +2 -0
  719. package/dist/client/views/collection/columns/build-columns.mjs +156 -0
  720. package/dist/client/views/collection/columns/build-columns.mjs.map +1 -0
  721. package/dist/client/views/collection/columns/column-defaults.d.mts +2 -0
  722. package/dist/client/views/collection/columns/column-defaults.mjs +108 -0
  723. package/dist/client/views/collection/columns/column-defaults.mjs.map +1 -0
  724. package/dist/client/views/collection/columns/index.d.mts +3 -0
  725. package/dist/client/views/collection/columns/types.d.mts +2 -0
  726. package/dist/client/views/collection/field-context.mjs +127 -0
  727. package/dist/client/views/collection/field-context.mjs.map +1 -0
  728. package/dist/client/views/collection/field-renderer.mjs +171 -0
  729. package/dist/client/views/collection/field-renderer.mjs.map +1 -0
  730. package/dist/client/views/collection/form-view.d.mts +112 -0
  731. package/dist/client/views/collection/form-view.d.mts.map +1 -0
  732. package/dist/client/views/collection/form-view.mjs +903 -0
  733. package/dist/client/views/collection/form-view.mjs.map +1 -0
  734. package/dist/client/views/collection/index.d.mts +9 -0
  735. package/dist/client/views/collection/table-view.d.mts +102 -0
  736. package/dist/client/views/collection/table-view.d.mts.map +1 -0
  737. package/dist/client/views/collection/table-view.mjs +695 -0
  738. package/dist/client/views/collection/table-view.mjs.map +1 -0
  739. package/dist/client/views/collection/view-skeletons.mjs +121 -0
  740. package/dist/client/views/collection/view-skeletons.mjs.map +1 -0
  741. package/dist/client/views/common/global-search.d.mts +1 -0
  742. package/dist/client/views/common/global-search.mjs +376 -0
  743. package/dist/client/views/common/global-search.mjs.map +1 -0
  744. package/dist/client/views/common/index.d.mts +1 -0
  745. package/dist/client/views/dashboard/dashboard-grid.mjs +385 -0
  746. package/dist/client/views/dashboard/dashboard-grid.mjs.map +1 -0
  747. package/dist/client/views/dashboard/dashboard-widget.mjs +178 -0
  748. package/dist/client/views/dashboard/dashboard-widget.mjs.map +1 -0
  749. package/dist/client/views/dashboard/widget-card.mjs +159 -0
  750. package/dist/client/views/dashboard/widget-card.mjs.map +1 -0
  751. package/dist/client/views/globals/global-form-view.d.mts +74 -0
  752. package/dist/client/views/globals/global-form-view.d.mts.map +1 -0
  753. package/dist/client/views/globals/global-form-view.mjs +181 -0
  754. package/dist/client/views/globals/global-form-view.mjs.map +1 -0
  755. package/dist/client/views/index.d.mts +28 -0
  756. package/dist/client/views/layout/admin-layout-provider.d.mts +140 -0
  757. package/dist/client/views/layout/admin-layout-provider.d.mts.map +1 -0
  758. package/dist/client/views/layout/admin-layout-provider.mjs +90 -0
  759. package/dist/client/views/layout/admin-layout-provider.mjs.map +1 -0
  760. package/dist/client/views/layout/admin-layout.d.mts +151 -0
  761. package/dist/client/views/layout/admin-layout.d.mts.map +1 -0
  762. package/dist/client/views/layout/admin-layout.mjs +144 -0
  763. package/dist/client/views/layout/admin-layout.mjs.map +1 -0
  764. package/dist/client/views/layout/admin-root.d.mts +7 -0
  765. package/dist/client/views/layout/admin-router.d.mts +125 -0
  766. package/dist/client/views/layout/admin-router.d.mts.map +1 -0
  767. package/dist/client/views/layout/admin-router.mjs +594 -0
  768. package/dist/client/views/layout/admin-router.mjs.map +1 -0
  769. package/dist/client/views/layout/admin-sidebar.d.mts +105 -0
  770. package/dist/client/views/layout/admin-sidebar.d.mts.map +1 -0
  771. package/dist/client/views/layout/admin-sidebar.mjs +550 -0
  772. package/dist/client/views/layout/admin-sidebar.mjs.map +1 -0
  773. package/dist/client/views/layout/admin-topbar.mjs +128 -0
  774. package/dist/client/views/layout/admin-topbar.mjs.map +1 -0
  775. package/dist/client/views/layout/index.d.mts +5 -0
  776. package/dist/client/views/pages/accept-invite-page.d.mts +67 -0
  777. package/dist/client/views/pages/accept-invite-page.d.mts.map +1 -0
  778. package/dist/client/views/pages/accept-invite-page.mjs +143 -0
  779. package/dist/client/views/pages/accept-invite-page.mjs.map +1 -0
  780. package/dist/client/views/pages/dashboard-page.d.mts +52 -0
  781. package/dist/client/views/pages/dashboard-page.d.mts.map +1 -0
  782. package/dist/client/views/pages/dashboard-page.mjs +45 -0
  783. package/dist/client/views/pages/dashboard-page.mjs.map +1 -0
  784. package/dist/client/views/pages/forgot-password-page.d.mts +59 -0
  785. package/dist/client/views/pages/forgot-password-page.d.mts.map +1 -0
  786. package/dist/client/views/pages/forgot-password-page.mjs +80 -0
  787. package/dist/client/views/pages/forgot-password-page.mjs.map +1 -0
  788. package/dist/client/views/pages/index.d.mts +7 -0
  789. package/dist/client/views/pages/invite-page.d.mts +71 -0
  790. package/dist/client/views/pages/invite-page.d.mts.map +1 -0
  791. package/dist/client/views/pages/invite-page.mjs +86 -0
  792. package/dist/client/views/pages/invite-page.mjs.map +1 -0
  793. package/dist/client/views/pages/login-page.d.mts +76 -0
  794. package/dist/client/views/pages/login-page.d.mts.map +1 -0
  795. package/dist/client/views/pages/login-page.mjs +98 -0
  796. package/dist/client/views/pages/login-page.mjs.map +1 -0
  797. package/dist/client/views/pages/reset-password-page.d.mts +66 -0
  798. package/dist/client/views/pages/reset-password-page.d.mts.map +1 -0
  799. package/dist/client/views/pages/reset-password-page.mjs +105 -0
  800. package/dist/client/views/pages/reset-password-page.mjs.map +1 -0
  801. package/dist/client/views/pages/setup-page.d.mts +64 -0
  802. package/dist/client/views/pages/setup-page.d.mts.map +1 -0
  803. package/dist/client/views/pages/setup-page.mjs +91 -0
  804. package/dist/client/views/pages/setup-page.mjs.map +1 -0
  805. package/dist/client.d.mts +92 -3
  806. package/dist/client.d.mts.map +1 -0
  807. package/dist/client.mjs +54 -12
  808. package/dist/components/rich-text/index.d.mts +1 -0
  809. package/dist/components/rich-text/rich-text-renderer.d.mts +104 -0
  810. package/dist/components/rich-text/rich-text-renderer.d.mts.map +1 -0
  811. package/dist/components/rich-text/rich-text-renderer.mjs +210 -0
  812. package/dist/components/rich-text/rich-text-renderer.mjs.map +1 -0
  813. package/dist/index.d.mts +62 -3
  814. package/dist/index.mjs +54 -12
  815. package/dist/server/adapters/nextjs.d.mts +121 -0
  816. package/dist/server/adapters/nextjs.d.mts.map +1 -0
  817. package/dist/server/adapters/nextjs.mjs +111 -0
  818. package/dist/server/adapters/nextjs.mjs.map +1 -0
  819. package/dist/server/adapters/tanstack.d.mts +133 -0
  820. package/dist/server/adapters/tanstack.d.mts.map +1 -0
  821. package/dist/server/adapters/tanstack.mjs +90 -0
  822. package/dist/server/adapters/tanstack.mjs.map +1 -0
  823. package/dist/server/augmentation.d.mts +1523 -0
  824. package/dist/server/augmentation.d.mts.map +1 -0
  825. package/dist/server/auth-helpers.d.mts +143 -0
  826. package/dist/server/auth-helpers.d.mts.map +1 -0
  827. package/dist/server/auth-helpers.mjs +108 -0
  828. package/dist/server/auth-helpers.mjs.map +1 -0
  829. package/dist/server/block/block-builder.d.mts +319 -0
  830. package/dist/server/block/block-builder.d.mts.map +1 -0
  831. package/dist/server/block/block-builder.mjs +217 -0
  832. package/dist/server/block/block-builder.mjs.map +1 -0
  833. package/dist/server/block/index.d.mts +3 -0
  834. package/dist/server/block/introspection.d.mts +84 -0
  835. package/dist/server/block/introspection.d.mts.map +1 -0
  836. package/dist/server/block/introspection.mjs +89 -0
  837. package/dist/server/block/introspection.mjs.map +1 -0
  838. package/dist/server/block/prefetch.d.mts +78 -0
  839. package/dist/server/block/prefetch.d.mts.map +1 -0
  840. package/dist/server/block/prefetch.mjs +240 -0
  841. package/dist/server/block/prefetch.mjs.map +1 -0
  842. package/dist/server/fields/blocks.d.mts +139 -0
  843. package/dist/server/fields/blocks.d.mts.map +1 -0
  844. package/dist/server/fields/blocks.mjs +192 -0
  845. package/dist/server/fields/blocks.mjs.map +1 -0
  846. package/dist/server/fields/index.d.mts +48 -0
  847. package/dist/server/fields/index.d.mts.map +1 -0
  848. package/dist/server/fields/index.mjs +16 -0
  849. package/dist/server/fields/index.mjs.map +1 -0
  850. package/dist/server/fields/rich-text.d.mts +135 -0
  851. package/dist/server/fields/rich-text.d.mts.map +1 -0
  852. package/dist/server/fields/rich-text.mjs +188 -0
  853. package/dist/server/fields/rich-text.mjs.map +1 -0
  854. package/dist/server/i18n/index.d.mts +16 -0
  855. package/dist/server/i18n/index.d.mts.map +1 -0
  856. package/dist/server/i18n/index.mjs +44 -0
  857. package/dist/server/i18n/index.mjs.map +1 -0
  858. package/dist/server/i18n/messages/cs.mjs +461 -0
  859. package/dist/server/i18n/messages/cs.mjs.map +1 -0
  860. package/dist/server/i18n/messages/de.mjs +461 -0
  861. package/dist/server/i18n/messages/de.mjs.map +1 -0
  862. package/dist/server/i18n/messages/en.mjs +493 -0
  863. package/dist/server/i18n/messages/en.mjs.map +1 -0
  864. package/dist/server/i18n/messages/es.mjs +461 -0
  865. package/dist/server/i18n/messages/es.mjs.map +1 -0
  866. package/dist/server/i18n/messages/fr.mjs +461 -0
  867. package/dist/server/i18n/messages/fr.mjs.map +1 -0
  868. package/dist/server/i18n/messages/index.mjs +24 -0
  869. package/dist/server/i18n/messages/index.mjs.map +1 -0
  870. package/dist/server/i18n/messages/pl.mjs +461 -0
  871. package/dist/server/i18n/messages/pl.mjs.map +1 -0
  872. package/dist/server/i18n/messages/pt.mjs +464 -0
  873. package/dist/server/i18n/messages/pt.mjs.map +1 -0
  874. package/dist/server/i18n/messages/sk.mjs +490 -0
  875. package/dist/server/i18n/messages/sk.mjs.map +1 -0
  876. package/dist/server/index.d.mts +20 -0
  877. package/dist/server/modules/admin/functions/admin-config.mjs +348 -0
  878. package/dist/server/modules/admin/functions/admin-config.mjs.map +1 -0
  879. package/dist/server/modules/admin/functions/execute-action.d.mts +107 -0
  880. package/dist/server/modules/admin/functions/execute-action.d.mts.map +1 -0
  881. package/dist/server/modules/admin/functions/execute-action.mjs +331 -0
  882. package/dist/server/modules/admin/functions/execute-action.mjs.map +1 -0
  883. package/dist/server/modules/admin/functions/locales.mjs +80 -0
  884. package/dist/server/modules/admin/functions/locales.mjs.map +1 -0
  885. package/dist/server/modules/admin/functions/preview.d.mts +70 -0
  886. package/dist/server/modules/admin/functions/preview.d.mts.map +1 -0
  887. package/dist/server/modules/admin/functions/preview.mjs +243 -0
  888. package/dist/server/modules/admin/functions/preview.mjs.map +1 -0
  889. package/dist/server/modules/admin/functions/reactive.d.mts +99 -0
  890. package/dist/server/modules/admin/functions/reactive.d.mts.map +1 -0
  891. package/dist/server/modules/admin/functions/reactive.mjs +378 -0
  892. package/dist/server/modules/admin/functions/reactive.mjs.map +1 -0
  893. package/dist/server/modules/admin/functions/setup.d.mts +84 -0
  894. package/dist/server/modules/admin/functions/setup.d.mts.map +1 -0
  895. package/dist/server/modules/admin/functions/setup.mjs +131 -0
  896. package/dist/server/modules/admin/functions/setup.mjs.map +1 -0
  897. package/dist/server/modules/admin/functions/translations.mjs +125 -0
  898. package/dist/server/modules/admin/functions/translations.mjs.map +1 -0
  899. package/dist/server/modules/admin/functions/widget-data.d.mts +33 -0
  900. package/dist/server/modules/admin/functions/widget-data.d.mts.map +1 -0
  901. package/dist/server/modules/admin/functions/widget-data.mjs +70 -0
  902. package/dist/server/modules/admin/functions/widget-data.mjs.map +1 -0
  903. package/dist/server/modules/admin/index.d.mts +16879 -0
  904. package/dist/server/modules/admin/index.d.mts.map +1 -0
  905. package/dist/server/modules/admin/index.mjs +249 -0
  906. package/dist/server/modules/admin/index.mjs.map +1 -0
  907. package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.d.mts +3 -0
  908. package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs +48 -0
  909. package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs.map +1 -0
  910. package/dist/server/modules/admin-preferences/collections/locks.collection.d.mts +3 -0
  911. package/dist/server/modules/admin-preferences/collections/locks.collection.mjs +79 -0
  912. package/dist/server/modules/admin-preferences/collections/locks.collection.mjs.map +1 -0
  913. package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts +1490 -0
  914. package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts.map +1 -0
  915. package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs +57 -0
  916. package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs.map +1 -0
  917. package/dist/server/patch.d.mts +100 -0
  918. package/dist/server/patch.d.mts.map +1 -0
  919. package/dist/server/patch.mjs +1062 -0
  920. package/dist/server/patch.mjs.map +1 -0
  921. package/dist/server.d.mts +21 -250
  922. package/dist/server.mjs +19 -832
  923. package/dist/shared/preview-utils.d.mts +54 -0
  924. package/dist/shared/preview-utils.d.mts.map +1 -0
  925. package/dist/{preview-utils-BKQ9-TMa.mjs → shared/preview-utils.mjs} +2 -2
  926. package/dist/shared/preview-utils.mjs.map +1 -0
  927. package/dist/{saved-views.types-BMsz5mCy.d.mts → shared/types/saved-views.types.d.mts} +7 -2
  928. package/dist/shared/types/saved-views.types.d.mts.map +1 -0
  929. package/dist/shared.d.mts +3 -57
  930. package/dist/shared.mjs +1 -1
  931. package/package.json +12 -17
  932. package/dist/auth-layout-M8K8_q5R.mjs +0 -181
  933. package/dist/auth-layout-M8K8_q5R.mjs.map +0 -1
  934. package/dist/bulk-upload-dialog-D7w7W1Hl.mjs +0 -273
  935. package/dist/bulk-upload-dialog-D7w7W1Hl.mjs.map +0 -1
  936. package/dist/client-D1DqawtP.d.mts +0 -13403
  937. package/dist/client-D1DqawtP.d.mts.map +0 -1
  938. package/dist/client-njX1rZmi.mjs +0 -22612
  939. package/dist/client-njX1rZmi.mjs.map +0 -1
  940. package/dist/content-locales-provider-BXvuIgfg.mjs +0 -1650
  941. package/dist/content-locales-provider-BXvuIgfg.mjs.map +0 -1
  942. package/dist/dashboard-page-B4PGEdc2.mjs +0 -2500
  943. package/dist/dashboard-page-B4PGEdc2.mjs.map +0 -1
  944. package/dist/dashboard-page-mCY0pgZv.mjs +0 -3
  945. package/dist/dropzone-Do3awXKd.mjs +0 -634
  946. package/dist/dropzone-Do3awXKd.mjs.map +0 -1
  947. package/dist/forgot-password-page-Bcp-An4Y.mjs.map +0 -1
  948. package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
  949. package/dist/index-B4H3amCD.d.mts +0 -2753
  950. package/dist/index-B4H3amCD.d.mts.map +0 -1
  951. package/dist/login-page-BUnpCbCa.mjs +0 -3
  952. package/dist/login-page-CP4gA-dl.mjs +0 -298
  953. package/dist/login-page-CP4gA-dl.mjs.map +0 -1
  954. package/dist/preview-utils-BKQ9-TMa.mjs.map +0 -1
  955. package/dist/reset-password-page-BqfDmLxA.mjs +0 -281
  956. package/dist/reset-password-page-BqfDmLxA.mjs.map +0 -1
  957. package/dist/reset-password-page-CufHz3h3.mjs +0 -3
  958. package/dist/runtime-6VZM878K.mjs.map +0 -1
  959. package/dist/saved-views.types-BMsz5mCy.d.mts.map +0 -1
  960. package/dist/server.d.mts.map +0 -1
  961. package/dist/server.mjs.map +0 -1
  962. package/dist/setup-page-BNNzt_Z6.mjs +0 -3
  963. package/dist/setup-page-YAP_fzqh.mjs.map +0 -1
  964. package/dist/shared.d.mts.map +0 -1
  965. package/dist/use-auth-BoLmWtmU.mjs.map +0 -1
@@ -0,0 +1,156 @@
1
+ import { useResolveText } from "../../../i18n/hooks.mjs";
2
+ import { useSafeContentLocales } from "../../../runtime/content-locales-provider.mjs";
3
+ import { useScopedLocale } from "../../../runtime/locale-scope.mjs";
4
+ import { LocaleSwitcher } from "../../../components/locale-switcher.mjs";
5
+ import { normalizeColumnConfig } from "../../../builder/types/collection-types.mjs";
6
+ import { DefaultCell, TextCell } from "../cells/primitive-cells.mjs";
7
+ import { computeDefaultColumns, formatHeader } from "./column-defaults.mjs";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/client/views/collection/columns/build-columns.tsx
11
+ /**
12
+ * Column header component that resolves I18nText labels
13
+ */
14
+ function ColumnHeader({ label, fallback, localized }) {
15
+ const resolveText = useResolveText();
16
+ const contentLocales = useSafeContentLocales();
17
+ const { locale: contentLocale, setLocale: setContentLocale } = useScopedLocale();
18
+ const resolvedLocale = contentLocale ?? contentLocales?.defaultLocale ?? contentLocales?.locales[0]?.code;
19
+ const localeOptions = contentLocales?.locales?.length ? contentLocales.locales : resolvedLocale ? [{ code: resolvedLocale }] : [];
20
+ const showLocaleSwitcher = localized && localeOptions.length > 0;
21
+ return /* @__PURE__ */ jsxs("span", {
22
+ className: "inline-flex items-center gap-1.5",
23
+ children: [/* @__PURE__ */ jsx("span", { children: resolveText(label, fallback) }), showLocaleSwitcher && /* @__PURE__ */ jsx(LocaleSwitcher, {
24
+ locales: localeOptions,
25
+ value: resolvedLocale,
26
+ onChange: setContentLocale,
27
+ labelMode: "code"
28
+ })]
29
+ });
30
+ }
31
+ /**
32
+ * Field types that need fieldDef passed to their cell component
33
+ * (for nested field definitions, labels, etc.)
34
+ */
35
+ const FIELD_TYPES_NEEDING_FIELD_DEF = new Set([
36
+ "object",
37
+ "array",
38
+ "relation",
39
+ "reverseRelation"
40
+ ]);
41
+ /**
42
+ * Build column definitions from collection config
43
+ *
44
+ * Simplified cell resolution:
45
+ * 1. Custom from .list() config
46
+ * 2. From field registry (.cell)
47
+ * 3. Ultra-simple DefaultCell fallback
48
+ *
49
+ * NO getCellForFieldType() switch statement needed!
50
+ *
51
+ * @param options - Build options with config and fallbacks
52
+ * @returns Array of TanStack Table column definitions
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * const columns = buildColumns({
57
+ * config: collectionsConfig.posts,
58
+ * fallbackColumns: ['id', 'title', 'createdAt'],
59
+ * meta: collectionMeta,
60
+ * });
61
+ *
62
+ * <CollectionList collection="posts" columns={columns} />
63
+ * ```
64
+ */
65
+ function buildColumns(options) {
66
+ const { config, fallbackColumns = ["id"], buildAllColumns = false, meta } = options;
67
+ const fields = config?.fields ?? {};
68
+ const listConfig = config?.list;
69
+ const isLocalizedField = (field, definition) => {
70
+ const fieldOptions = definition?.["~options"] ?? {};
71
+ return fieldOptions.localized !== void 0 ? !!fieldOptions.localized : meta?.localizedFields?.includes(field) ?? false;
72
+ };
73
+ const titleFieldName = meta?.title?.fieldName;
74
+ const titleType = meta?.title?.type;
75
+ const titleColumn = titleType === "field" && titleFieldName ? titleFieldName : "_title";
76
+ let columnConfigs;
77
+ if (buildAllColumns) {
78
+ const allFields = Object.keys(fields);
79
+ columnConfigs = [titleColumn, ...titleColumn === "_title" ? allFields : allFields.filter((f) => f !== titleColumn)];
80
+ } else if (listConfig?.columns && listConfig.columns.length > 0) columnConfigs = listConfig.columns;
81
+ else if (Object.keys(fields).length > 0) columnConfigs = computeDefaultColumns(fields, { meta });
82
+ else columnConfigs = [titleColumn, ...fallbackColumns.filter((c) => c !== titleColumn && c !== "_title")];
83
+ return columnConfigs.map((colConfig) => {
84
+ const normalized = normalizeColumnConfig(colConfig);
85
+ const fieldName = normalized.field;
86
+ const fieldDef = fields[fieldName];
87
+ if (fieldName === "_title") {
88
+ titleFieldName && isLocalizedField(titleFieldName, fields[titleFieldName]);
89
+ let titleLabel = "Title";
90
+ let titleFallback = "Title";
91
+ if (titleType === "virtual" && titleFieldName && fields[titleFieldName]) {
92
+ titleLabel = (fields[titleFieldName]?.["~options"] ?? {}).label;
93
+ titleFallback = formatHeader(titleFieldName);
94
+ }
95
+ return {
96
+ accessorKey: "_title",
97
+ header: normalized.header ? () => /* @__PURE__ */ jsx(ColumnHeader, {
98
+ label: normalized.header,
99
+ fallback: "Title"
100
+ }) : () => /* @__PURE__ */ jsx(ColumnHeader, {
101
+ label: titleLabel,
102
+ fallback: titleFallback
103
+ }),
104
+ cell: ({ row }) => {
105
+ return /* @__PURE__ */ jsx(TextCell, { value: row.getValue("_title") });
106
+ },
107
+ enableSorting: false
108
+ };
109
+ }
110
+ const fieldType = fieldDef?.name ?? "text";
111
+ const fieldOptions = fieldDef?.["~options"] ?? {};
112
+ isLocalizedField(fieldName, fieldDef);
113
+ let CellComponent;
114
+ if (normalized.cell) CellComponent = normalized.cell;
115
+ else if (fieldDef?.cell?.component) CellComponent = fieldDef.cell.component;
116
+ else CellComponent = DefaultCell;
117
+ const needsFieldDef = FIELD_TYPES_NEEDING_FIELD_DEF.has(fieldType);
118
+ const accessorKey = fieldType === "relation" && fieldOptions.relationName ? fieldOptions.relationName : fieldName;
119
+ const headerLabel = normalized.header ?? fieldOptions.label;
120
+ const headerFallback = formatHeader(fieldName);
121
+ const computeFn = fieldOptions.compute;
122
+ const isComputed = typeof computeFn === "function";
123
+ const columnDef = {
124
+ id: fieldName,
125
+ accessorKey: isComputed ? void 0 : accessorKey,
126
+ header: () => /* @__PURE__ */ jsx(ColumnHeader, {
127
+ label: headerLabel,
128
+ fallback: headerFallback
129
+ }),
130
+ cell: ({ row, getValue }) => {
131
+ const value = isComputed ? computeFn(row.original) : getValue();
132
+ return needsFieldDef ? /* @__PURE__ */ jsx(CellComponent, {
133
+ value,
134
+ row,
135
+ fieldDef
136
+ }) : /* @__PURE__ */ jsx(CellComponent, {
137
+ value,
138
+ row
139
+ });
140
+ },
141
+ enableSorting: isComputed ? false : normalized.sortable !== false
142
+ };
143
+ if (normalized.width) columnDef.size = typeof normalized.width === "number" ? normalized.width : Number.parseInt(normalized.width, 10) || void 0;
144
+ if (normalized.minWidth) columnDef.minSize = typeof normalized.minWidth === "number" ? normalized.minWidth : Number.parseInt(normalized.minWidth, 10) || void 0;
145
+ if (normalized.maxWidth) columnDef.maxSize = typeof normalized.maxWidth === "number" ? normalized.maxWidth : Number.parseInt(normalized.maxWidth, 10) || void 0;
146
+ if (normalized.align || normalized.className) columnDef.meta = {
147
+ align: normalized.align,
148
+ className: normalized.className
149
+ };
150
+ return columnDef;
151
+ });
152
+ }
153
+
154
+ //#endregion
155
+ export { buildColumns };
156
+ //# sourceMappingURL=build-columns.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-columns.mjs","names":["columnConfigs: ColumnConfig<string>[]","titleLabel: I18nText","CellComponent: React.ComponentType<{\n value: unknown;\n row?: unknown;\n fieldDef?: FieldDefinition;\n }>","accessorKey: string","columnDef: ColumnDef<TData>"],"sources":["../../../../../src/client/views/collection/columns/build-columns.tsx"],"sourcesContent":["/**\n * Column Builder\n *\n * Generates TanStack Table column definitions from collection config.\n * Simplified version - uses field registry or DefaultCell fallback.\n */\n\nimport type { ColumnDef } from \"@tanstack/react-table\";\nimport type * as React from \"react\";\nimport {\n type ColumnConfig,\n normalizeColumnConfig,\n} from \"../../../builder/types/collection-types\";\nimport type { FieldDefinition } from \"../../../builder/field/field\";\nimport { LocaleSwitcher } from \"../../../components/locale-switcher\";\nimport { useResolveText } from \"../../../i18n/hooks\";\nimport type { I18nText } from \"../../../i18n/types\";\nimport { useSafeContentLocales, useScopedLocale } from \"../../../runtime\";\nimport { DefaultCell, TextCell } from \"../cells\";\nimport { computeDefaultColumns, formatHeader } from \"./column-defaults\";\nimport type { BuildColumnsOptions } from \"./types\";\n\n// ============================================================================\n// Header Component with I18nText Resolution\n// ============================================================================\n\n/**\n * Column header component that resolves I18nText labels\n */\nfunction ColumnHeader({\n label,\n fallback,\n localized,\n}: {\n label: I18nText | undefined;\n fallback: string;\n localized?: boolean;\n}) {\n const resolveText = useResolveText();\n const contentLocales = useSafeContentLocales();\n // Use scoped locale (from LocaleScopeProvider in ResourceSheet) or global locale\n const { locale: contentLocale, setLocale: setContentLocale } =\n useScopedLocale();\n const resolvedLocale =\n contentLocale ??\n contentLocales?.defaultLocale ??\n contentLocales?.locales[0]?.code;\n const localeOptions = contentLocales?.locales?.length\n ? contentLocales.locales\n : resolvedLocale\n ? [{ code: resolvedLocale }]\n : [];\n const showLocaleSwitcher = localized && localeOptions.length > 0;\n\n return (\n <span className=\"inline-flex items-center gap-1.5\">\n <span>{resolveText(label, fallback)}</span>\n {showLocaleSwitcher && (\n <LocaleSwitcher\n locales={localeOptions}\n value={resolvedLocale}\n onChange={setContentLocale}\n labelMode=\"code\"\n />\n )}\n </span>\n );\n}\n\n// ============================================================================\n// Field Types Needing fieldDef\n// ============================================================================\n\n/**\n * Field types that need fieldDef passed to their cell component\n * (for nested field definitions, labels, etc.)\n */\nconst FIELD_TYPES_NEEDING_FIELD_DEF = new Set([\n \"object\",\n \"array\",\n \"relation\",\n \"reverseRelation\",\n]);\n\n// ============================================================================\n// Column Builder\n// ============================================================================\n\n/**\n * Build column definitions from collection config\n *\n * Simplified cell resolution:\n * 1. Custom from .list() config\n * 2. From field registry (.cell)\n * 3. Ultra-simple DefaultCell fallback\n *\n * NO getCellForFieldType() switch statement needed!\n *\n * @param options - Build options with config and fallbacks\n * @returns Array of TanStack Table column definitions\n *\n * @example\n * ```tsx\n * const columns = buildColumns({\n * config: collectionsConfig.posts,\n * fallbackColumns: ['id', 'title', 'createdAt'],\n * meta: collectionMeta,\n * });\n *\n * <CollectionList collection=\"posts\" columns={columns} />\n * ```\n */\nexport function buildColumns<TData extends Record<string, unknown>>(\n options: BuildColumnsOptions,\n): ColumnDef<TData>[] {\n const {\n config,\n fallbackColumns = [\"id\"],\n buildAllColumns = false,\n meta,\n } = options;\n const fields = config?.fields ?? {};\n const listConfig = config?.list;\n\n const isLocalizedField = (\n field: string,\n definition?: FieldDefinition,\n ): boolean => {\n const fieldOptions = definition?.[\"~options\"] ?? {};\n return fieldOptions.localized !== undefined\n ? !!fieldOptions.localized\n : (meta?.localizedFields?.includes(field) ?? false);\n };\n\n // Determine title column based on meta\n // If meta says title is a real \"field\", use that field instead of _title\n const titleFieldName = meta?.title?.fieldName;\n const titleType = meta?.title?.type;\n const titleColumn =\n titleType === \"field\" && titleFieldName ? titleFieldName : \"_title\";\n\n // Determine which columns to build\n let columnConfigs: ColumnConfig<string>[];\n\n if (buildAllColumns) {\n // Build ALL columns for all fields (used when user can toggle visibility)\n // Include title column (real field or _title) first, then all other fields\n const allFields = Object.keys(fields);\n // If title is a real field, don't duplicate it\n const otherFields =\n titleColumn === \"_title\"\n ? allFields\n : allFields.filter((f) => f !== titleColumn);\n columnConfigs = [titleColumn, ...otherFields];\n } else if (listConfig?.columns && listConfig.columns.length > 0) {\n // Use explicitly defined columns\n columnConfigs = listConfig.columns;\n } else if (Object.keys(fields).length > 0) {\n // Use sane defaults - limited content fields + createdAt\n columnConfigs = computeDefaultColumns(fields, { meta });\n } else {\n // Use fallback - include title column first\n columnConfigs = [\n titleColumn,\n ...fallbackColumns.filter((c) => c !== titleColumn && c !== \"_title\"),\n ];\n }\n\n // Build column definitions\n return columnConfigs.map((colConfig) => {\n const normalized = normalizeColumnConfig(colConfig);\n const fieldName = normalized.field;\n const fieldDef = fields[fieldName];\n\n // Special handling for _title virtual field (computed by backend)\n if (fieldName === \"_title\") {\n const titleIsLocalized = titleFieldName\n ? isLocalizedField(titleFieldName, fields[titleFieldName])\n : false;\n // Determine the label for _title column\n // For virtual titles, use the virtual field's label instead of generic \"Title\"\n let titleLabel: I18nText = \"Title\";\n let titleFallback = \"Title\";\n if (titleType === \"virtual\" && titleFieldName && fields[titleFieldName]) {\n const virtualFieldDef = fields[titleFieldName];\n const virtualFieldOptions = virtualFieldDef?.[\"~options\"] ?? {};\n titleLabel = virtualFieldOptions.label;\n titleFallback = formatHeader(titleFieldName);\n }\n\n const columnDef: ColumnDef<TData> = {\n accessorKey: \"_title\",\n header: normalized.header\n ? () => <ColumnHeader label={normalized.header} fallback=\"Title\" />\n : () => <ColumnHeader label={titleLabel} fallback={titleFallback} />,\n cell: ({ row }) => {\n const value = row.getValue(\"_title\");\n return <TextCell value={value} />;\n },\n enableSorting: false, // _title is virtual, can't sort on it directly\n };\n return columnDef;\n }\n\n const fieldType = fieldDef?.name ?? \"text\";\n const fieldOptions = fieldDef?.[\"~options\"] ?? {};\n const isLocalized = isLocalizedField(fieldName, fieldDef);\n\n // ========== SIMPLIFIED CELL RESOLUTION ==========\n // Priority chain - just 3 lines!\n let CellComponent: React.ComponentType<{\n value: unknown;\n row?: unknown;\n fieldDef?: FieldDefinition;\n }>;\n\n if (normalized.cell) {\n // 1. Custom cell from .list() config\n CellComponent = normalized.cell as React.ComponentType<{\n value: unknown;\n row?: unknown;\n fieldDef?: FieldDefinition;\n }>;\n } else if (fieldDef?.cell?.component) {\n // 2. Cell from field registry (most common)\n CellComponent = fieldDef.cell.component as React.ComponentType<{\n value: unknown;\n row?: unknown;\n fieldDef?: FieldDefinition;\n }>;\n } else {\n // 3. Ultra-simple DefaultCell fallback\n CellComponent = DefaultCell;\n }\n\n // Check if this field type needs fieldDef passed to the cell\n const needsFieldDef = FIELD_TYPES_NEEDING_FIELD_DEF.has(fieldType);\n\n // For relation fields, use relationName as accessor if specified\n // This allows fetching expanded relation data (e.g., row.customer) instead of FK (row.customerId)\n // If relationName is not specified, we use the field name (which shows the raw FK value)\n const accessorKey: string =\n fieldType === \"relation\" && fieldOptions.relationName\n ? fieldOptions.relationName\n : fieldName;\n\n // Build column def\n // Use fieldName as id (for lookup in visibleColumns) and accessorKey for data access\n const headerLabel = normalized.header ?? fieldOptions.label;\n const headerFallback = formatHeader(fieldName);\n // Check if field is computed\n const computeFn = fieldOptions.compute as\n | ((values: Record<string, any>) => any)\n | undefined;\n const isComputed = typeof computeFn === \"function\";\n\n const columnDef: ColumnDef<TData> = {\n id: fieldName, // Always use field name as id for consistent lookup\n accessorKey: isComputed ? undefined : accessorKey, // Computed fields don't have accessor\n header: () => (\n <ColumnHeader label={headerLabel} fallback={headerFallback} />\n ),\n cell: ({ row, getValue }) => {\n // For computed fields, compute value from row data\n const value = isComputed\n ? computeFn(row.original as Record<string, any>)\n : getValue();\n // Pass fieldDef for object/array/relation types to enable advanced rendering\n return needsFieldDef ? (\n <CellComponent value={value} row={row} fieldDef={fieldDef} />\n ) : (\n <CellComponent value={value} row={row} />\n );\n },\n // Computed fields are not sortable (no DB column)\n enableSorting: isComputed ? false : normalized.sortable !== false,\n };\n\n // Add size config if specified\n if (normalized.width) {\n (columnDef as any).size =\n typeof normalized.width === \"number\"\n ? normalized.width\n : Number.parseInt(normalized.width, 10) || undefined;\n }\n if (normalized.minWidth) {\n (columnDef as any).minSize =\n typeof normalized.minWidth === \"number\"\n ? normalized.minWidth\n : Number.parseInt(normalized.minWidth, 10) || undefined;\n }\n if (normalized.maxWidth) {\n (columnDef as any).maxSize =\n typeof normalized.maxWidth === \"number\"\n ? normalized.maxWidth\n : Number.parseInt(normalized.maxWidth, 10) || undefined;\n }\n\n // Add meta for alignment/className\n if (normalized.align || normalized.className) {\n (columnDef as any).meta = {\n align: normalized.align,\n className: normalized.className,\n };\n }\n\n return columnDef;\n });\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAS,aAAa,EACpB,OACA,UACA,aAKC;CACD,MAAM,cAAc,gBAAgB;CACpC,MAAM,iBAAiB,uBAAuB;CAE9C,MAAM,EAAE,QAAQ,eAAe,WAAW,qBACxC,iBAAiB;CACnB,MAAM,iBACJ,iBACA,gBAAgB,iBAChB,gBAAgB,QAAQ,IAAI;CAC9B,MAAM,gBAAgB,gBAAgB,SAAS,SAC3C,eAAe,UACf,iBACE,CAAC,EAAE,MAAM,gBAAgB,CAAC,GAC1B,EAAE;CACR,MAAM,qBAAqB,aAAa,cAAc,SAAS;AAE/D,QACE,qBAAC;EAAK,WAAU;aACd,oBAAC,oBAAM,YAAY,OAAO,SAAS,GAAQ,EAC1C,sBACC,oBAAC;GACC,SAAS;GACT,OAAO;GACP,UAAU;GACV,WAAU;IACV;GAEC;;;;;;AAYX,MAAM,gCAAgC,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA8BF,SAAgB,aACd,SACoB;CACpB,MAAM,EACJ,QACA,kBAAkB,CAAC,KAAK,EACxB,kBAAkB,OAClB,SACE;CACJ,MAAM,SAAS,QAAQ,UAAU,EAAE;CACnC,MAAM,aAAa,QAAQ;CAE3B,MAAM,oBACJ,OACA,eACY;EACZ,MAAM,eAAe,aAAa,eAAe,EAAE;AACnD,SAAO,aAAa,cAAc,SAC9B,CAAC,CAAC,aAAa,YACd,MAAM,iBAAiB,SAAS,MAAM,IAAI;;CAKjD,MAAM,iBAAiB,MAAM,OAAO;CACpC,MAAM,YAAY,MAAM,OAAO;CAC/B,MAAM,cACJ,cAAc,WAAW,iBAAiB,iBAAiB;CAG7D,IAAIA;AAEJ,KAAI,iBAAiB;EAGnB,MAAM,YAAY,OAAO,KAAK,OAAO;AAMrC,kBAAgB,CAAC,aAAa,GAH5B,gBAAgB,WACZ,YACA,UAAU,QAAQ,MAAM,MAAM,YAAY,CACH;YACpC,YAAY,WAAW,WAAW,QAAQ,SAAS,EAE5D,iBAAgB,WAAW;UAClB,OAAO,KAAK,OAAO,CAAC,SAAS,EAEtC,iBAAgB,sBAAsB,QAAQ,EAAE,MAAM,CAAC;KAGvD,iBAAgB,CACd,aACA,GAAG,gBAAgB,QAAQ,MAAM,MAAM,eAAe,MAAM,SAAS,CACtE;AAIH,QAAO,cAAc,KAAK,cAAc;EACtC,MAAM,aAAa,sBAAsB,UAAU;EACnD,MAAM,YAAY,WAAW;EAC7B,MAAM,WAAW,OAAO;AAGxB,MAAI,cAAc,UAAU;AACD,qBACrB,iBAAiB,gBAAgB,OAAO,gBAAgB;GAI5D,IAAIC,aAAuB;GAC3B,IAAI,gBAAgB;AACpB,OAAI,cAAc,aAAa,kBAAkB,OAAO,iBAAiB;AAGvE,kBAFwB,OAAO,kBACe,eAAe,EAAE,EAC9B;AACjC,oBAAgB,aAAa,eAAe;;AAc9C,UAXoC;IAClC,aAAa;IACb,QAAQ,WAAW,eACT,oBAAC;KAAa,OAAO,WAAW;KAAQ,UAAS;MAAU,SAC3D,oBAAC;KAAa,OAAO;KAAY,UAAU;MAAiB;IACtE,OAAO,EAAE,UAAU;AAEjB,YAAO,oBAAC,YAAS,OADH,IAAI,SAAS,SAAS,GACH;;IAEnC,eAAe;IAChB;;EAIH,MAAM,YAAY,UAAU,QAAQ;EACpC,MAAM,eAAe,WAAW,eAAe,EAAE;AAC7B,mBAAiB,WAAW,SAAS;EAIzD,IAAIC;AAMJ,MAAI,WAAW,KAEb,iBAAgB,WAAW;WAKlB,UAAU,MAAM,UAEzB,iBAAgB,SAAS,KAAK;MAO9B,iBAAgB;EAIlB,MAAM,gBAAgB,8BAA8B,IAAI,UAAU;EAKlE,MAAMC,cACJ,cAAc,cAAc,aAAa,eACrC,aAAa,eACb;EAIN,MAAM,cAAc,WAAW,UAAU,aAAa;EACtD,MAAM,iBAAiB,aAAa,UAAU;EAE9C,MAAM,YAAY,aAAa;EAG/B,MAAM,aAAa,OAAO,cAAc;EAExC,MAAMC,YAA8B;GAClC,IAAI;GACJ,aAAa,aAAa,SAAY;GACtC,cACE,oBAAC;IAAa,OAAO;IAAa,UAAU;KAAkB;GAEhE,OAAO,EAAE,KAAK,eAAe;IAE3B,MAAM,QAAQ,aACV,UAAU,IAAI,SAAgC,GAC9C,UAAU;AAEd,WAAO,gBACL,oBAAC;KAAqB;KAAY;KAAe;MAAY,GAE7D,oBAAC;KAAqB;KAAY;MAAO;;GAI7C,eAAe,aAAa,QAAQ,WAAW,aAAa;GAC7D;AAGD,MAAI,WAAW,MACb,CAAC,UAAkB,OACjB,OAAO,WAAW,UAAU,WACxB,WAAW,QACX,OAAO,SAAS,WAAW,OAAO,GAAG,IAAI;AAEjD,MAAI,WAAW,SACb,CAAC,UAAkB,UACjB,OAAO,WAAW,aAAa,WAC3B,WAAW,WACX,OAAO,SAAS,WAAW,UAAU,GAAG,IAAI;AAEpD,MAAI,WAAW,SACb,CAAC,UAAkB,UACjB,OAAO,WAAW,aAAa,WAC3B,WAAW,WACX,OAAO,SAAS,WAAW,UAAU,GAAG,IAAI;AAIpD,MAAI,WAAW,SAAS,WAAW,UACjC,CAAC,UAAkB,OAAO;GACxB,OAAO,WAAW;GAClB,WAAW,WAAW;GACvB;AAGH,SAAO;GACP"}
@@ -0,0 +1,2 @@
1
+ import "../../../builder/field/field.mjs";
2
+ import "./types.mjs";
@@ -0,0 +1,108 @@
1
+ import { formatFieldLabel } from "../cells/shared/cell-helpers.mjs";
2
+
3
+ //#region src/client/views/collection/columns/column-defaults.ts
4
+ /**
5
+ * System fields that are typically auto-generated and not user-editable
6
+ */
7
+ const SYSTEM_FIELDS = new Set([
8
+ "id",
9
+ "createdAt",
10
+ "updatedAt",
11
+ "deletedAt",
12
+ "createdBy",
13
+ "updatedBy"
14
+ ]);
15
+ /**
16
+ * Compute sane default visible columns for a collection
17
+ *
18
+ * Default columns are selected with the following logic:
19
+ * 1. If configuredColumns is provided (from .list()), use those + title
20
+ * 2. Otherwise, auto-detect:
21
+ * - Title field first
22
+ * - Up to 4 content fields (non-system, non-relation, non-upload)
23
+ * - `createdAt` at the end (if timestamps enabled)
24
+ *
25
+ * @param fields - Field definitions from collection config
26
+ * @param options - Optional metadata and configured columns
27
+ * @returns Array of field names for default visible columns
28
+ */
29
+ function computeDefaultColumns(fields, options) {
30
+ const titleFieldName = options?.meta?.title?.fieldName;
31
+ const useTitleField = options?.meta?.title?.type === "field" && titleFieldName;
32
+ const titleColumn = useTitleField ? titleFieldName : "_title";
33
+ if (options?.configuredColumns && options.configuredColumns.length > 0) {
34
+ const configuredNames = options.configuredColumns.map((col) => typeof col === "string" ? col : col.field);
35
+ const defaultCols$1 = [titleColumn];
36
+ for (const colName of configuredNames) if (colName !== titleColumn) defaultCols$1.push(colName);
37
+ return defaultCols$1;
38
+ }
39
+ const defaultCols = [titleColumn];
40
+ if (!fields || Object.keys(fields).length === 0) return defaultCols;
41
+ const contentFields = [];
42
+ const systemFields = [];
43
+ for (const [key, fieldDef] of Object.entries(fields)) {
44
+ if (useTitleField && key === titleFieldName) continue;
45
+ if (SYSTEM_FIELDS.has(key)) systemFields.push(key);
46
+ else contentFields.push(key);
47
+ }
48
+ defaultCols.push(...contentFields);
49
+ if ((options?.meta?.timestamps ?? !!fields.createdAt) && fields.createdAt && !defaultCols.includes("createdAt")) defaultCols.push("createdAt");
50
+ return defaultCols;
51
+ }
52
+ /**
53
+ * Get all available fields for the column picker
54
+ *
55
+ * Includes all fields (both content and system fields) so users can
56
+ * choose to display any field in their view.
57
+ *
58
+ * @param fields - Field definitions from collection config
59
+ * @param options - Optional metadata from backend
60
+ * @returns Array of available field info for the column picker
61
+ */
62
+ function getAllAvailableFields(fields, options) {
63
+ const availableFields = [];
64
+ const titleFieldName = options?.meta?.title?.fieldName;
65
+ const titleType = options?.meta?.title?.type;
66
+ if (!(titleType === "field" && titleFieldName)) if (titleType === "virtual" && titleFieldName && fields?.[titleFieldName]) {
67
+ const titleLabel = (fields[titleFieldName]?.["~options"] ?? {}).label ?? formatFieldLabel(titleFieldName);
68
+ availableFields.push({
69
+ name: "_title",
70
+ label: titleLabel,
71
+ type: "text",
72
+ isSystem: false,
73
+ options: void 0
74
+ });
75
+ } else availableFields.push({
76
+ name: "_title",
77
+ label: "Title",
78
+ type: "text",
79
+ isSystem: false,
80
+ options: void 0
81
+ });
82
+ if (!fields) return availableFields;
83
+ for (const [key, fieldDef] of Object.entries(fields)) {
84
+ if (titleType === "virtual" && key === titleFieldName) continue;
85
+ const fieldType = fieldDef?.name ?? "text";
86
+ const fieldOptions = fieldDef?.["~options"] ?? {};
87
+ const label = fieldOptions.label ?? formatFieldLabel(key);
88
+ const isSystem = SYSTEM_FIELDS.has(key);
89
+ availableFields.push({
90
+ name: key,
91
+ label,
92
+ type: fieldType,
93
+ isSystem,
94
+ options: fieldOptions
95
+ });
96
+ }
97
+ return availableFields;
98
+ }
99
+ /**
100
+ * Format field name as header (camelCase to Title Case)
101
+ */
102
+ function formatHeader(fieldName) {
103
+ return formatFieldLabel(fieldName);
104
+ }
105
+
106
+ //#endregion
107
+ export { computeDefaultColumns, formatHeader, getAllAvailableFields };
108
+ //# sourceMappingURL=column-defaults.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-defaults.mjs","names":["defaultCols: string[]","defaultCols","contentFields: string[]","systemFields: string[]","availableFields: ColumnField[]"],"sources":["../../../../../src/client/views/collection/columns/column-defaults.ts"],"sourcesContent":["/**\n * Column Defaults Computation\n *\n * Functions for computing default visible columns and available fields\n * Extracted from build-columns.tsx\n */\n\nimport type { FieldDefinition } from \"../../../builder/field/field\";\nimport { formatFieldLabel } from \"../cells/shared/cell-helpers\";\nimport type { ColumnField, ComputeDefaultColumnsOptions } from \"./types\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/**\n * System fields that are typically auto-generated and not user-editable\n */\nexport const SYSTEM_FIELDS = new Set([\n\t\"id\",\n\t\"createdAt\",\n\t\"updatedAt\",\n\t\"deletedAt\",\n\t\"createdBy\",\n\t\"updatedBy\",\n]);\n\n/**\n * Field types that are typically not shown by default in list view\n * (too complex or take up too much space)\n */\nexport const EXCLUDED_DEFAULT_FIELD_TYPES = new Set([\n\t\"relation\",\n\t\"reverseRelation\",\n\t\"upload\",\n\t\"uploadMany\",\n\t\"json\",\n\t\"object\",\n\t\"richText\",\n\t\"textarea\",\n]);\n\n/**\n * Maximum number of content fields to show by default\n */\nexport const MAX_DEFAULT_CONTENT_FIELDS = 4;\n\n// ============================================================================\n// Default Column Computation\n// ============================================================================\n\n/**\n * Compute sane default visible columns for a collection\n *\n * Default columns are selected with the following logic:\n * 1. If configuredColumns is provided (from .list()), use those + title\n * 2. Otherwise, auto-detect:\n * - Title field first\n * - Up to 4 content fields (non-system, non-relation, non-upload)\n * - `createdAt` at the end (if timestamps enabled)\n *\n * @param fields - Field definitions from collection config\n * @param options - Optional metadata and configured columns\n * @returns Array of field names for default visible columns\n */\nexport function computeDefaultColumns(\n\tfields?: Record<string, FieldDefinition>,\n\toptions?: ComputeDefaultColumnsOptions,\n): string[] {\n\t// Determine the title column to use\n\tconst titleFieldName = options?.meta?.title?.fieldName;\n\tconst titleType = options?.meta?.title?.type;\n\tconst useTitleField = titleType === \"field\" && titleFieldName;\n\tconst titleColumn = useTitleField ? titleFieldName : \"_title\";\n\n\t// If columns are explicitly configured in .list(), use those\n\tif (options?.configuredColumns && options.configuredColumns.length > 0) {\n\t\tconst configuredNames = options.configuredColumns.map((col) =>\n\t\t\ttypeof col === \"string\" ? col : col.field,\n\t\t);\n\n\t\t// Always include title column first, then configured columns (excluding title to avoid dupe)\n\t\tconst defaultCols: string[] = [titleColumn];\n\t\tfor (const colName of configuredNames) {\n\t\t\tif (colName !== titleColumn) {\n\t\t\t\tdefaultCols.push(colName);\n\t\t\t}\n\t\t}\n\t\treturn defaultCols;\n\t}\n\n\t// No configured columns - show ALL fields by default\n\t// This ensures users see everything when no explicit column config is provided\n\tconst defaultCols: string[] = [titleColumn];\n\n\tif (!fields || Object.keys(fields).length === 0) {\n\t\treturn defaultCols;\n\t}\n\n\t// Add all content fields (non-system fields first, then system fields)\n\tconst contentFields: string[] = [];\n\tconst systemFields: string[] = [];\n\n\tfor (const [key, fieldDef] of Object.entries(fields)) {\n\t\t// Skip the title field if we're already showing it\n\t\tif (useTitleField && key === titleFieldName) continue;\n\n\t\tif (SYSTEM_FIELDS.has(key)) {\n\t\t\tsystemFields.push(key);\n\t\t} else {\n\t\t\tcontentFields.push(key);\n\t\t}\n\t}\n\n\t// Add all content fields\n\tdefaultCols.push(...contentFields);\n\n\t// Add createdAt at the end if timestamps enabled (from meta or field existence)\n\tconst hasTimestamps = options?.meta?.timestamps ?? !!fields.createdAt;\n\tif (hasTimestamps && fields.createdAt && !defaultCols.includes(\"createdAt\")) {\n\t\tdefaultCols.push(\"createdAt\");\n\t}\n\n\treturn defaultCols;\n}\n\n// ============================================================================\n// Available Fields\n// ============================================================================\n\n/**\n * Get all available fields for the column picker\n *\n * Includes all fields (both content and system fields) so users can\n * choose to display any field in their view.\n *\n * @param fields - Field definitions from collection config\n * @param options - Optional metadata from backend\n * @returns Array of available field info for the column picker\n */\nexport function getAllAvailableFields(\n\tfields?: Record<string, FieldDefinition>,\n\toptions?: ComputeDefaultColumnsOptions,\n): ColumnField[] {\n\tconst availableFields: ColumnField[] = [];\n\n\t// Determine title field from meta\n\tconst titleFieldName = options?.meta?.title?.fieldName;\n\tconst titleType = options?.meta?.title?.type;\n\tconst useTitleField = titleType === \"field\" && titleFieldName;\n\n\t// Only add _title as an option if title is NOT a real field\n\t// (i.e., title is virtual/computed, so _title is the way to access it)\n\tif (!useTitleField) {\n\t\t// For virtual titles, show the virtual field's label instead of generic \"Title\"\n\t\tif (titleType === \"virtual\" && titleFieldName && fields?.[titleFieldName]) {\n\t\t\tconst titleFieldDef = fields[titleFieldName];\n\t\t\tconst titleFieldOptions = titleFieldDef?.[\"~options\"] ?? {};\n\t\t\tconst titleLabel =\n\t\t\t\ttitleFieldOptions.label ?? formatFieldLabel(titleFieldName);\n\t\t\tavailableFields.push({\n\t\t\t\tname: \"_title\",\n\t\t\t\tlabel: titleLabel,\n\t\t\t\ttype: \"text\",\n\t\t\t\tisSystem: false,\n\t\t\t\toptions: undefined,\n\t\t\t});\n\t\t} else {\n\t\t\t// Fallback to generic \"Title\" when no title defined or field not found\n\t\t\tavailableFields.push({\n\t\t\t\tname: \"_title\",\n\t\t\t\tlabel: \"Title\",\n\t\t\t\ttype: \"text\",\n\t\t\t\tisSystem: false,\n\t\t\t\toptions: undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\tif (!fields) return availableFields;\n\n\t// Add all fields from config (except virtual title field to avoid duplication)\n\tfor (const [key, fieldDef] of Object.entries(fields)) {\n\t\t// Skip the virtual title field since we already added _title for it\n\t\tif (titleType === \"virtual\" && key === titleFieldName) continue;\n\n\t\tconst fieldType = fieldDef?.name ?? \"text\";\n\t\tconst fieldOptions = fieldDef?.[\"~options\"] ?? {};\n\t\tconst label = fieldOptions.label ?? formatFieldLabel(key);\n\t\tconst isSystem = SYSTEM_FIELDS.has(key);\n\n\t\tavailableFields.push({\n\t\t\tname: key,\n\t\t\tlabel,\n\t\t\ttype: fieldType,\n\t\t\tisSystem,\n\t\t\toptions: fieldOptions,\n\t\t});\n\t}\n\n\treturn availableFields;\n}\n\n/**\n * Format field name as header (camelCase to Title Case)\n */\nexport function formatHeader(fieldName: string): string {\n\treturn formatFieldLabel(fieldName);\n}\n"],"mappings":";;;;;;AAkBA,MAAa,gBAAgB,IAAI,IAAI;CACpC;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;;;;;;;;;;;;;;;AAwCF,SAAgB,sBACf,QACA,SACW;CAEX,MAAM,iBAAiB,SAAS,MAAM,OAAO;CAE7C,MAAM,gBADY,SAAS,MAAM,OAAO,SACJ,WAAW;CAC/C,MAAM,cAAc,gBAAgB,iBAAiB;AAGrD,KAAI,SAAS,qBAAqB,QAAQ,kBAAkB,SAAS,GAAG;EACvE,MAAM,kBAAkB,QAAQ,kBAAkB,KAAK,QACtD,OAAO,QAAQ,WAAW,MAAM,IAAI,MACpC;EAGD,MAAMA,gBAAwB,CAAC,YAAY;AAC3C,OAAK,MAAM,WAAW,gBACrB,KAAI,YAAY,YACf,eAAY,KAAK,QAAQ;AAG3B,SAAOC;;CAKR,MAAMD,cAAwB,CAAC,YAAY;AAE3C,KAAI,CAAC,UAAU,OAAO,KAAK,OAAO,CAAC,WAAW,EAC7C,QAAO;CAIR,MAAME,gBAA0B,EAAE;CAClC,MAAMC,eAAyB,EAAE;AAEjC,MAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,OAAO,EAAE;AAErD,MAAI,iBAAiB,QAAQ,eAAgB;AAE7C,MAAI,cAAc,IAAI,IAAI,CACzB,cAAa,KAAK,IAAI;MAEtB,eAAc,KAAK,IAAI;;AAKzB,aAAY,KAAK,GAAG,cAAc;AAIlC,MADsB,SAAS,MAAM,cAAc,CAAC,CAAC,OAAO,cACvC,OAAO,aAAa,CAAC,YAAY,SAAS,YAAY,CAC1E,aAAY,KAAK,YAAY;AAG9B,QAAO;;;;;;;;;;;;AAiBR,SAAgB,sBACf,QACA,SACgB;CAChB,MAAMC,kBAAiC,EAAE;CAGzC,MAAM,iBAAiB,SAAS,MAAM,OAAO;CAC7C,MAAM,YAAY,SAAS,MAAM,OAAO;AAKxC,KAAI,EAJkB,cAAc,WAAW,gBAM9C,KAAI,cAAc,aAAa,kBAAkB,SAAS,iBAAiB;EAG1E,MAAM,cAFgB,OAAO,kBACa,eAAe,EAAE,EAExC,SAAS,iBAAiB,eAAe;AAC5D,kBAAgB,KAAK;GACpB,MAAM;GACN,OAAO;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACT,CAAC;OAGF,iBAAgB,KAAK;EACpB,MAAM;EACN,OAAO;EACP,MAAM;EACN,UAAU;EACV,SAAS;EACT,CAAC;AAIJ,KAAI,CAAC,OAAQ,QAAO;AAGpB,MAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QAAQ,OAAO,EAAE;AAErD,MAAI,cAAc,aAAa,QAAQ,eAAgB;EAEvD,MAAM,YAAY,UAAU,QAAQ;EACpC,MAAM,eAAe,WAAW,eAAe,EAAE;EACjD,MAAM,QAAQ,aAAa,SAAS,iBAAiB,IAAI;EACzD,MAAM,WAAW,cAAc,IAAI,IAAI;AAEvC,kBAAgB,KAAK;GACpB,MAAM;GACN;GACA,MAAM;GACN;GACA,SAAS;GACT,CAAC;;AAGH,QAAO;;;;;AAMR,SAAgB,aAAa,WAA2B;AACvD,QAAO,iBAAiB,UAAU"}
@@ -0,0 +1,3 @@
1
+ import "./types.mjs";
2
+ import "./build-columns.mjs";
3
+ import "./column-defaults.mjs";
@@ -0,0 +1,2 @@
1
+ import "../../../builder/field/field.mjs";
2
+ import "../../../builder/types/collection-types.mjs";
@@ -0,0 +1,127 @@
1
+ //#region src/client/views/collection/field-context.ts
2
+ /**
3
+ * Get field type from FieldDefinition
4
+ * FieldDefinition.name contains the type name (e.g., "text", "relation")
5
+ */
6
+ function getFieldType(fieldDef) {
7
+ if (!fieldDef) return void 0;
8
+ return fieldDef.name;
9
+ }
10
+ /**
11
+ * Get field options from FieldDefinition
12
+ * Options are stored in "~options" property
13
+ */
14
+ function getFieldOptions(fieldDef) {
15
+ if (!fieldDef) return {};
16
+ return fieldDef["~options"] || {};
17
+ }
18
+ /**
19
+ * Get field component from FieldDefinition
20
+ * Component is stored in field.component
21
+ */
22
+ function getFieldComponent(fieldDef) {
23
+ if (!fieldDef?.field?.component) return void 0;
24
+ return fieldDef.field.component;
25
+ }
26
+ function resolveValue(value, formValues, defaultValue) {
27
+ if (value === void 0) return defaultValue;
28
+ if (typeof value === "function") return value(formValues);
29
+ return value;
30
+ }
31
+ /**
32
+ * Get form values for conditional field logic.
33
+ *
34
+ * @deprecated This is a legacy fallback. All callers should now use useWatch()
35
+ * hook in their component and pass the watched values to getFieldContext via
36
+ * the `formValues` parameter. This function uses form.watch() which doesn't
37
+ * properly integrate with React's render cycle.
38
+ *
39
+ * Best practice pattern:
40
+ * ```tsx
41
+ * const watchedValues = useWatch({ control: form.control });
42
+ * const context = getFieldContext({ ..., formValues: watchedValues });
43
+ * ```
44
+ */
45
+ function getFormValues(form, fieldPrefix) {
46
+ if (!form?.watch) return {};
47
+ return (fieldPrefix ? form.watch(fieldPrefix) : form.watch()) ?? {};
48
+ }
49
+ function getFullFieldName(fieldName, fieldPrefix) {
50
+ return fieldPrefix ? `${fieldPrefix}.${fieldName}` : fieldName;
51
+ }
52
+ /**
53
+ * Create a FieldContext object from field definition and form context.
54
+ * Contains all information needed to render a field component.
55
+ */
56
+ function getFieldContext({ fieldName, fieldDef, collection, form, fieldPrefix, locale, formValues: formValuesProp, entityMeta }) {
57
+ const formValues = formValuesProp ?? getFormValues(form, fieldPrefix);
58
+ const fullFieldName = getFullFieldName(fieldName, fieldPrefix);
59
+ const fieldError = (form?.getFieldState ? form.getFieldState(fullFieldName) : void 0)?.error?.message;
60
+ const fieldValue = formValues[fieldName];
61
+ const options = getFieldOptions(fieldDef);
62
+ const type = getFieldType(fieldDef);
63
+ const component = getFieldComponent(fieldDef);
64
+ const label = options.label;
65
+ const description = options.description;
66
+ const placeholder = options.placeholder;
67
+ const isHidden = resolveValue(options.hidden, formValues, false);
68
+ const isComputed = typeof options.compute === "function";
69
+ const isReadOnly = isComputed || resolveValue(options.readOnly, formValues, false);
70
+ const isDisabled = resolveValue(options.disabled, formValues, false);
71
+ const isRequired = resolveValue(options.required, formValues, false);
72
+ const isLocalized = options.localized !== void 0 ? !!options.localized : entityMeta?.localizedFields?.includes(fieldName) ?? false;
73
+ const selectOptions = options.options ? typeof options.options === "function" ? options.options(formValues) : options.options : void 0;
74
+ const updateValue = (nextValue) => {
75
+ if (form?.setValue) form.setValue(fullFieldName, nextValue, {
76
+ shouldDirty: true,
77
+ shouldTouch: true
78
+ });
79
+ };
80
+ return {
81
+ fieldName,
82
+ fullFieldName,
83
+ collection,
84
+ fieldDef,
85
+ fieldValue,
86
+ label,
87
+ description,
88
+ placeholder,
89
+ options: selectOptions,
90
+ isHidden,
91
+ isReadOnly,
92
+ isDisabled,
93
+ isRequired,
94
+ isLocalized,
95
+ isComputed,
96
+ locale,
97
+ fieldError,
98
+ updateValue,
99
+ type,
100
+ component,
101
+ compute: options.compute
102
+ };
103
+ }
104
+ /**
105
+ * Build props for a FieldDefinition component (field.component).
106
+ * Returns raw props with I18nText - resolve before passing to component.
107
+ */
108
+ function buildComponentProps(context) {
109
+ return {
110
+ name: context.fullFieldName,
111
+ value: context.fieldValue,
112
+ onChange: context.updateValue,
113
+ label: context.label,
114
+ description: context.description,
115
+ placeholder: context.placeholder,
116
+ required: context.isRequired,
117
+ disabled: context.isDisabled,
118
+ readOnly: context.isReadOnly,
119
+ error: context.fieldError,
120
+ localized: context.isLocalized,
121
+ locale: context.locale
122
+ };
123
+ }
124
+
125
+ //#endregion
126
+ export { buildComponentProps, getFieldContext, getFieldOptions, getFullFieldName, resolveValue };
127
+ //# sourceMappingURL=field-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-context.mjs","names":[],"sources":["../../../../src/client/views/collection/field-context.ts"],"sourcesContent":["/**\n * Field Context\n *\n * Provides context and utilities for rendering form fields.\n * Extracted from auto-form-fields.tsx for better modularity.\n */\n\nimport type React from \"react\";\nimport type { FieldDefinition } from \"../../builder/field/field\";\nimport type { DynamicI18nText } from \"../../builder/types/common\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Context object containing all information needed to render a field.\n * Note: label, description, placeholder can be I18nText - resolve them before passing to components.\n */\nexport type FieldContext = {\n\tfieldName: string;\n\tfullFieldName: string;\n\tcollection: string;\n\tfieldDef?: FieldDefinition;\n\tfieldValue: any;\n\t/** Can be I18nText - must be resolved before passing to component */\n\tlabel?: DynamicI18nText;\n\t/** Can be I18nText - must be resolved before passing to component */\n\tdescription?: DynamicI18nText;\n\t/** Can be I18nText - must be resolved before passing to component */\n\tplaceholder?: DynamicI18nText;\n\toptions?: Array<{ label: string; value: any }>;\n\t/** Whether field is hidden (not rendered). Default false. */\n\tisHidden: boolean;\n\t/** Whether field is read-only (normal look, not editable). Computed fields are always readonly. */\n\tisReadOnly: boolean;\n\t/** Whether field is disabled (grayed out). */\n\tisDisabled: boolean;\n\tisRequired: boolean;\n\tisLocalized: boolean;\n\t/** Whether field has a compute function */\n\tisComputed: boolean;\n\tlocale?: string;\n\tfieldError?: string;\n\tupdateValue: (nextValue: any) => void;\n\ttype?: string;\n\tcomponent?: React.ComponentType<any>;\n\t/** Compute function if field is computed */\n\tcompute?: (values: Record<string, any>) => any;\n};\n\n// ============================================================================\n// Helper Functions - Field Definition Access\n// ============================================================================\n\n/**\n * Get field type from FieldDefinition\n * FieldDefinition.name contains the type name (e.g., \"text\", \"relation\")\n */\nexport function getFieldType(\n\tfieldDef: FieldDefinition | undefined,\n): string | undefined {\n\tif (!fieldDef) return undefined;\n\t// FieldDefinition stores the field type in 'name' property\n\t// This comes from field(\"text\", ...) where \"text\" is the type\n\treturn fieldDef.name;\n}\n\n/**\n * Get field options from FieldDefinition\n * Options are stored in \"~options\" property\n */\nexport function getFieldOptions(\n\tfieldDef: FieldDefinition | undefined,\n): Record<string, any> {\n\tif (!fieldDef) return {};\n\treturn (fieldDef as any)[\"~options\"] || {};\n}\n\n/**\n * Get field component from FieldDefinition\n * Component is stored in field.component\n */\nexport function getFieldComponent(\n\tfieldDef: FieldDefinition | undefined,\n): React.ComponentType<any> | undefined {\n\tif (!fieldDef?.field?.component) return undefined;\n\treturn fieldDef.field.component as React.ComponentType<any>;\n}\n\n// ============================================================================\n// Helper Functions - Value Resolution\n// ============================================================================\n\ntype ValueResolver<T> = T | ((values: any) => T);\n\nexport function resolveValue<T>(\n\tvalue: ValueResolver<T> | undefined,\n\tformValues: any,\n\tdefaultValue: T,\n): T {\n\tif (value === undefined) return defaultValue;\n\tif (typeof value === \"function\") {\n\t\treturn (value as (values: any) => T)(formValues);\n\t}\n\treturn value;\n}\n\n/**\n * Get form values for conditional field logic.\n *\n * @deprecated This is a legacy fallback. All callers should now use useWatch()\n * hook in their component and pass the watched values to getFieldContext via\n * the `formValues` parameter. This function uses form.watch() which doesn't\n * properly integrate with React's render cycle.\n *\n * Best practice pattern:\n * ```tsx\n * const watchedValues = useWatch({ control: form.control });\n * const context = getFieldContext({ ..., formValues: watchedValues });\n * ```\n */\nexport function getFormValues(form: any, fieldPrefix?: string) {\n\tif (!form?.watch) return {};\n\tconst values = fieldPrefix ? form.watch(fieldPrefix) : form.watch();\n\treturn values ?? {};\n}\n\nexport function getFullFieldName(fieldName: string, fieldPrefix?: string) {\n\treturn fieldPrefix ? `${fieldPrefix}.${fieldName}` : fieldName;\n}\n\n// ============================================================================\n// Field Context Factory\n// ============================================================================\n\nexport interface GetFieldContextParams {\n\tfieldName: string;\n\tfieldDef?: FieldDefinition;\n\tcollection: string;\n\tform: any;\n\tfieldPrefix?: string;\n\tlocale?: string;\n\t/** Entity metadata from backend (for inferring localized fields) */\n\tentityMeta?: { localizedFields?: string[] };\n\t/**\n\t * Pre-watched form values from useWatch hook.\n\t * If provided, avoids calling form.watch() internally.\n\t * This is the preferred pattern for better React integration.\n\t */\n\tformValues?: Record<string, any>;\n}\n\n/**\n * Create a FieldContext object from field definition and form context.\n * Contains all information needed to render a field component.\n */\nexport function getFieldContext({\n\tfieldName,\n\tfieldDef,\n\tcollection,\n\tform,\n\tfieldPrefix,\n\tlocale,\n\tformValues: formValuesProp,\n\tentityMeta,\n}: GetFieldContextParams): FieldContext {\n\t// Use pre-watched values if provided (preferred), otherwise fall back to form.watch()\n\tconst formValues = formValuesProp ?? getFormValues(form, fieldPrefix);\n\tconst fullFieldName = getFullFieldName(fieldName, fieldPrefix);\n\tconst fieldState = form?.getFieldState\n\t\t? form.getFieldState(fullFieldName)\n\t\t: undefined;\n\tconst fieldError = fieldState?.error?.message;\n\tconst fieldValue = formValues[fieldName];\n\n\t// Get options from FieldDefinition\n\tconst options = getFieldOptions(fieldDef);\n\tconst type = getFieldType(fieldDef);\n\tconst component = getFieldComponent(fieldDef);\n\n\tconst label = options.label;\n\tconst description = options.description;\n\tconst placeholder = options.placeholder;\n\n\t// hidden: false/undefined = visible, true = hidden\n\tconst isHidden = resolveValue(options.hidden, formValues, false);\n\t// compute implies readonly\n\tconst isComputed = typeof options.compute === \"function\";\n\tconst isReadOnly =\n\t\tisComputed || resolveValue(options.readOnly, formValues, false);\n\tconst isDisabled = resolveValue(options.disabled, formValues, false);\n\tconst isRequired = resolveValue(options.required, formValues, false);\n\n\t// Check if field is localized: explicit config takes priority, fallback to BE metadata\n\tconst isLocalized =\n\t\toptions.localized !== undefined\n\t\t\t? !!options.localized\n\t\t\t: (entityMeta?.localizedFields?.includes(fieldName) ?? false);\n\n\t// Resolve dynamic options for select fields\n\tconst selectOptions = options.options\n\t\t? typeof options.options === \"function\"\n\t\t\t? options.options(formValues)\n\t\t\t: options.options\n\t\t: undefined;\n\n\tconst updateValue = (nextValue: any) => {\n\t\tif (form?.setValue) {\n\t\t\tform.setValue(fullFieldName, nextValue, {\n\t\t\t\tshouldDirty: true,\n\t\t\t\tshouldTouch: true,\n\t\t\t});\n\t\t}\n\t};\n\n\treturn {\n\t\tfieldName,\n\t\tfullFieldName,\n\t\tcollection,\n\t\tfieldDef,\n\t\tfieldValue,\n\t\tlabel,\n\t\tdescription,\n\t\tplaceholder,\n\t\toptions: selectOptions,\n\t\tisHidden,\n\t\tisReadOnly,\n\t\tisDisabled,\n\t\tisRequired,\n\t\tisLocalized,\n\t\tisComputed,\n\t\tlocale,\n\t\tfieldError,\n\t\tupdateValue,\n\t\ttype,\n\t\tcomponent,\n\t\tcompute: options.compute,\n\t};\n}\n\n// ============================================================================\n// Component Props Builders\n// ============================================================================\n\n/**\n * Raw component props with I18nText (needs resolution before passing to components)\n */\nexport type RawComponentProps = {\n\tname: string;\n\tvalue: any;\n\tonChange: (value: any) => void;\n\tlabel?: DynamicI18nText;\n\tdescription?: DynamicI18nText;\n\tplaceholder?: DynamicI18nText;\n\trequired: boolean;\n\tdisabled: boolean;\n\treadOnly: boolean;\n\terror?: string;\n\tlocalized: boolean;\n\tlocale?: string;\n};\n\n/**\n * Build props for a FieldDefinition component (field.component).\n * Returns raw props with I18nText - resolve before passing to component.\n */\nexport function buildComponentProps(context: FieldContext): RawComponentProps {\n\treturn {\n\t\tname: context.fullFieldName,\n\t\tvalue: context.fieldValue,\n\t\tonChange: context.updateValue,\n\t\tlabel: context.label,\n\t\tdescription: context.description,\n\t\tplaceholder: context.placeholder,\n\t\trequired: context.isRequired,\n\t\tdisabled: context.isDisabled,\n\t\treadOnly: context.isReadOnly,\n\t\terror: context.fieldError,\n\t\tlocalized: context.isLocalized,\n\t\tlocale: context.locale,\n\t};\n}\n"],"mappings":";;;;;AA2DA,SAAgB,aACf,UACqB;AACrB,KAAI,CAAC,SAAU,QAAO;AAGtB,QAAO,SAAS;;;;;;AAOjB,SAAgB,gBACf,UACsB;AACtB,KAAI,CAAC,SAAU,QAAO,EAAE;AACxB,QAAQ,SAAiB,eAAe,EAAE;;;;;;AAO3C,SAAgB,kBACf,UACuC;AACvC,KAAI,CAAC,UAAU,OAAO,UAAW,QAAO;AACxC,QAAO,SAAS,MAAM;;AASvB,SAAgB,aACf,OACA,YACA,cACI;AACJ,KAAI,UAAU,OAAW,QAAO;AAChC,KAAI,OAAO,UAAU,WACpB,QAAQ,MAA6B,WAAW;AAEjD,QAAO;;;;;;;;;;;;;;;;AAiBR,SAAgB,cAAc,MAAW,aAAsB;AAC9D,KAAI,CAAC,MAAM,MAAO,QAAO,EAAE;AAE3B,SADe,cAAc,KAAK,MAAM,YAAY,GAAG,KAAK,OAAO,KAClD,EAAE;;AAGpB,SAAgB,iBAAiB,WAAmB,aAAsB;AACzE,QAAO,cAAc,GAAG,YAAY,GAAG,cAAc;;;;;;AA4BtD,SAAgB,gBAAgB,EAC/B,WACA,UACA,YACA,MACA,aACA,QACA,YAAY,gBACZ,cACuC;CAEvC,MAAM,aAAa,kBAAkB,cAAc,MAAM,YAAY;CACrE,MAAM,gBAAgB,iBAAiB,WAAW,YAAY;CAI9D,MAAM,cAHa,MAAM,gBACtB,KAAK,cAAc,cAAc,GACjC,SAC4B,OAAO;CACtC,MAAM,aAAa,WAAW;CAG9B,MAAM,UAAU,gBAAgB,SAAS;CACzC,MAAM,OAAO,aAAa,SAAS;CACnC,MAAM,YAAY,kBAAkB,SAAS;CAE7C,MAAM,QAAQ,QAAQ;CACtB,MAAM,cAAc,QAAQ;CAC5B,MAAM,cAAc,QAAQ;CAG5B,MAAM,WAAW,aAAa,QAAQ,QAAQ,YAAY,MAAM;CAEhE,MAAM,aAAa,OAAO,QAAQ,YAAY;CAC9C,MAAM,aACL,cAAc,aAAa,QAAQ,UAAU,YAAY,MAAM;CAChE,MAAM,aAAa,aAAa,QAAQ,UAAU,YAAY,MAAM;CACpE,MAAM,aAAa,aAAa,QAAQ,UAAU,YAAY,MAAM;CAGpE,MAAM,cACL,QAAQ,cAAc,SACnB,CAAC,CAAC,QAAQ,YACT,YAAY,iBAAiB,SAAS,UAAU,IAAI;CAGzD,MAAM,gBAAgB,QAAQ,UAC3B,OAAO,QAAQ,YAAY,aAC1B,QAAQ,QAAQ,WAAW,GAC3B,QAAQ,UACT;CAEH,MAAM,eAAe,cAAmB;AACvC,MAAI,MAAM,SACT,MAAK,SAAS,eAAe,WAAW;GACvC,aAAa;GACb,aAAa;GACb,CAAC;;AAIJ,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,QAAQ;EACjB;;;;;;AA6BF,SAAgB,oBAAoB,SAA0C;AAC7E,QAAO;EACN,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,OAAO,QAAQ;EACf,aAAa,QAAQ;EACrB,aAAa,QAAQ;EACrB,UAAU,QAAQ;EAClB,UAAU,QAAQ;EAClB,UAAU,QAAQ;EAClB,OAAO,QAAQ;EACf,WAAW,QAAQ;EACnB,QAAQ,QAAQ;EAChB"}
@@ -0,0 +1,171 @@
1
+ import { useResolveText } from "../../i18n/hooks.mjs";
2
+ import { useScopedLocale } from "../../runtime/locale-scope.mjs";
3
+ import { buildComponentProps, getFieldContext, getFieldOptions, getFullFieldName } from "./field-context.mjs";
4
+ import { useAdminConfig } from "../../hooks/use-admin-config.mjs";
5
+ import { useCollectionMeta } from "../../hooks/use-collection-meta.mjs";
6
+ import { useFieldHooks } from "../../hooks/use-field-hooks.mjs";
7
+ import { useGlobalMeta } from "../../hooks/use-global-meta.mjs";
8
+ import * as React$1 from "react";
9
+ import { useFormContext, useWatch } from "react-hook-form";
10
+ import { Fragment, jsx } from "react/jsx-runtime";
11
+
12
+ //#region src/client/views/collection/field-renderer.tsx
13
+ /**
14
+ * FieldRenderer Component
15
+ *
16
+ * Renders a single form field using FieldDefinition.
17
+ * Shared between AutoFormFields and BlockEditor.
18
+ */
19
+ function renderConfigError(message) {
20
+ return /* @__PURE__ */ jsx("div", {
21
+ className: "border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive rounded",
22
+ children: message
23
+ });
24
+ }
25
+ function stripFieldUiOptions(options) {
26
+ const { label, description, placeholder, required, disabled, readOnly, visible, localized, locale, ...rest } = options;
27
+ return rest;
28
+ }
29
+ /**
30
+ * Render field using FieldDefinition.field.component
31
+ *
32
+ * This is the primary rendering method. Field components receive:
33
+ * - Base props (name, value, onChange, label, etc.) from componentProps
34
+ * - Field-specific options from FieldDefinition["~options"]
35
+ */
36
+ function renderDefinitionComponent({ context, componentProps, blocks }) {
37
+ const Component = context.component;
38
+ if (!Component) return null;
39
+ const options = stripFieldUiOptions(getFieldOptions(context.fieldDef));
40
+ if (context.type === "blocks" && blocks) return /* @__PURE__ */ jsx(Component, {
41
+ ...componentProps,
42
+ ...options,
43
+ blocks
44
+ });
45
+ return /* @__PURE__ */ jsx(Component, {
46
+ ...componentProps,
47
+ ...options
48
+ });
49
+ }
50
+ /**
51
+ * Render embedded collection field
52
+ *
53
+ * Embedded fields need special handling because they require:
54
+ * 1. Access to allCollectionsConfig for the embedded collection's config
55
+ * 2. A renderFields callback that recursively renders AutoFormFields
56
+ */
57
+ function renderEmbeddedField({ context, registry, allCollectionsConfig, componentProps, renderEmbeddedFields }) {
58
+ if (context.type !== "embedded") return null;
59
+ const options = stripFieldUiOptions(getFieldOptions(context.fieldDef));
60
+ const embeddedCollection = options.collection;
61
+ if (!embeddedCollection) return renderConfigError(`Missing collection for embedded field "${context.fieldName}".`);
62
+ const embeddedCollectionConfig = allCollectionsConfig?.[embeddedCollection];
63
+ const EmbeddedComponent = context.component || registry?.fields?.embedded;
64
+ if (!EmbeddedComponent) return renderConfigError(`No component found for embedded field "${context.fieldName}".`);
65
+ return /* @__PURE__ */ jsx(EmbeddedComponent, {
66
+ ...componentProps,
67
+ ...options,
68
+ value: context.fieldValue || [],
69
+ collection: embeddedCollection,
70
+ renderFields: (index) => renderEmbeddedFields?.({
71
+ embeddedCollection,
72
+ embeddedCollectionConfig,
73
+ fullFieldName: context.fullFieldName,
74
+ index
75
+ })
76
+ });
77
+ }
78
+ /**
79
+ * Render a single field with conditional logic
80
+ *
81
+ * Rendering priority:
82
+ * 1. Embedded fields (need special handling for recursive AutoFormFields)
83
+ * 2. FieldDefinition.field.component (registry-first approach)
84
+ * 3. Error message if no component registered
85
+ */
86
+ function FieldRenderer({ fieldName, fieldDef, collection, mode = "collection", registry, fieldPrefix, allCollectionsConfig, renderEmbeddedFields, className, entityMeta: entityMetaProp }) {
87
+ const form = useFormContext();
88
+ const { locale } = useScopedLocale();
89
+ const resolveText = useResolveText();
90
+ const { data: adminConfig } = useAdminConfig();
91
+ const watchedValues = useWatch({ control: form.control });
92
+ const fullFieldName = getFullFieldName(fieldName, fieldPrefix);
93
+ const watchedFieldValue = useWatch({
94
+ control: form.control,
95
+ name: fullFieldName
96
+ });
97
+ const formValues = React$1.useMemo(() => {
98
+ if (!watchedValues) return {};
99
+ if (!fieldPrefix) return watchedValues;
100
+ const parts = fieldPrefix.split(".");
101
+ let result = watchedValues;
102
+ for (const part of parts) {
103
+ result = result?.[part];
104
+ if (result === void 0) return {};
105
+ }
106
+ return result ?? {};
107
+ }, [watchedValues, fieldPrefix]);
108
+ const { data: fetchedCollectionMeta } = useCollectionMeta(collection, { enabled: !entityMetaProp && mode === "collection" });
109
+ const { data: fetchedGlobalMeta } = useGlobalMeta(collection, { enabled: !entityMetaProp && mode === "global" });
110
+ const context = getFieldContext({
111
+ fieldName,
112
+ fieldDef,
113
+ collection,
114
+ form,
115
+ fieldPrefix,
116
+ locale,
117
+ entityMeta: entityMetaProp ?? (mode === "global" ? fetchedGlobalMeta : fetchedCollectionMeta),
118
+ formValues
119
+ });
120
+ const fieldOptions = getFieldOptions(fieldDef);
121
+ const clientSideCompute = typeof fieldOptions.compute === "function" ? fieldOptions.compute : void 0;
122
+ const { handleChange, computedValue, isComputed, options: hookOptions, optionsLoading } = useFieldHooks({
123
+ fieldName,
124
+ fullFieldName: context.fullFieldName,
125
+ locale,
126
+ compute: clientSideCompute,
127
+ onChange: fieldOptions.onChange,
128
+ defaultValue: fieldOptions.defaultValue,
129
+ loadOptions: fieldOptions.loadOptions,
130
+ staticOptions: context.options
131
+ });
132
+ if (context.isHidden) return null;
133
+ if (!fieldDef) return renderConfigError(`Field "${fieldName}" not found in ${mode === "global" ? "global" : "collection"} "${collection}" config.`);
134
+ const resolvedOptions = hookOptions ?? context.options;
135
+ const rawComponentProps = buildComponentProps(context);
136
+ const fieldValue = isComputed ? computedValue : watchedFieldValue === void 0 ? rawComponentProps.value : watchedFieldValue;
137
+ const componentProps = {
138
+ ...rawComponentProps,
139
+ value: fieldValue,
140
+ onChange: handleChange,
141
+ options: resolvedOptions,
142
+ optionsLoading,
143
+ readOnly: rawComponentProps.readOnly || isComputed,
144
+ label: resolveText(rawComponentProps.label, "", formValues),
145
+ description: resolveText(rawComponentProps.description, "", formValues),
146
+ placeholder: resolveText(rawComponentProps.placeholder, "", formValues)
147
+ };
148
+ let content = null;
149
+ if (context.type === "embedded") content = renderEmbeddedField({
150
+ context,
151
+ registry,
152
+ allCollectionsConfig,
153
+ componentProps,
154
+ renderEmbeddedFields
155
+ });
156
+ if (!content && context.component) content = renderDefinitionComponent({
157
+ context,
158
+ componentProps,
159
+ blocks: adminConfig?.blocks
160
+ });
161
+ if (!content) content = renderConfigError(`No component registered for field type "${context.type}" (field: "${context.fieldName}").`);
162
+ if (className) return /* @__PURE__ */ jsx("div", {
163
+ className,
164
+ children: content
165
+ });
166
+ return /* @__PURE__ */ jsx(Fragment, { children: content });
167
+ }
168
+
169
+ //#endregion
170
+ export { FieldRenderer };
171
+ //# sourceMappingURL=field-renderer.mjs.map