@sealcode/sealgen 0.18.10 → 0.19.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 (378) hide show
  1. package/.eslintrc.cjs +7 -2
  2. package/.xunit +74 -69
  3. package/@types/add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts +1 -0
  4. package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +10 -0
  5. package/@types/builders/colors-builder.d.ts +1 -1
  6. package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +7 -0
  7. package/@types/builders/fonts-builder.d.ts +1 -1
  8. package/@types/controllers/table-add-button.d.ts +6 -0
  9. package/@types/controllers/table-add-button.stimulus.d.ts +6 -0
  10. package/@types/crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts +1 -0
  11. package/@types/crud-field-snippets.d.ts +1 -3
  12. package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +33 -0
  13. package/@types/forms/controls/array.d.ts +1 -3
  14. package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
  15. package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +22 -0
  16. package/@types/forms/controls/autocomplete.d.ts +1 -1
  17. package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +21 -0
  18. package/@types/forms/controls/checkbox-group.d.ts +3 -3
  19. package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +21 -0
  20. package/@types/forms/controls/checkboxed-list-input.d.ts +3 -3
  21. package/@types/forms/controls/controls.d.ts +2 -2
  22. package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +19 -0
  23. package/@types/forms/controls/derived-frame.d.ts +0 -2
  24. package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +30 -0
  25. package/@types/forms/controls/dropdown.d.ts +1 -1
  26. package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +13 -0
  27. package/@types/forms/controls/file.d.ts +1 -2
  28. package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +19 -0
  29. package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +19 -0
  30. package/@types/forms/controls/form-control.d.ts +7 -4
  31. package/@types/forms/controls/image.d.ts +19 -0
  32. package/@types/forms/controls/image.test.d.ts +1 -0
  33. package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +42 -0
  34. package/@types/forms/controls/multiple-files.d.ts +3 -1
  35. package/@types/forms/controls/multiple-images.d.ts +19 -0
  36. package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +13 -0
  37. package/@types/forms/controls/number.d.ts +1 -1
  38. package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +19 -0
  39. package/@types/forms/controls/photo.d.ts +3 -5
  40. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +33 -0
  41. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +33 -0
  42. package/@types/forms/controls/simple-input.d.ts +5 -4
  43. package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
  44. package/@types/forms/controls/single-reference.d.ts +3 -2
  45. package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +39 -0
  46. package/@types/forms/controls/table.d.ts +8 -3
  47. package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +39 -0
  48. package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +25 -0
  49. package/@types/forms/controls/textarea.d.ts +3 -3
  50. package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +22 -0
  51. package/@types/forms/fields/boolean.d.ts +6 -1
  52. package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +22 -0
  53. package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +23 -0
  54. package/@types/forms/fields/checkboxed-list.d.ts +3 -1
  55. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +22 -0
  56. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +22 -0
  57. package/@types/forms/fields/collection-field.d.ts +8 -1
  58. package/@types/forms/fields/color.d.ts +4 -0
  59. package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +14 -0
  60. package/@types/forms/fields/coordinates.d.ts +14 -0
  61. package/@types/forms/fields/date.d.ts +13 -0
  62. package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +4 -0
  63. package/@types/forms/fields/datetime.d.ts +14 -0
  64. package/@types/forms/fields/deep-reverse-single-reference-list.d.ts +24 -0
  65. package/@types/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
  66. package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +8 -0
  67. package/@types/forms/fields/email.d.ts +3 -0
  68. package/@types/forms/fields/enum-multiple-sealious.d.ts +16 -0
  69. package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +16 -0
  70. package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +70 -0
  71. package/@types/forms/fields/field.d.ts +37 -5
  72. package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +29 -0
  73. package/@types/forms/fields/fields.d.ts +23 -8
  74. package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +23 -0
  75. package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +23 -0
  76. package/@types/forms/fields/file.d.ts +11 -5
  77. package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +23 -0
  78. package/@types/forms/fields/float.d.ts +4 -0
  79. package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +29 -0
  80. package/@types/forms/fields/get-field-for-sealious.d.ts +31 -0
  81. package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +29 -0
  82. package/@types/forms/fields/html.d.ts +6 -0
  83. package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +5 -0
  84. package/@types/forms/fields/image.d.ts +5 -0
  85. package/@types/forms/fields/int.d.ts +6 -0
  86. package/@types/forms/fields/json.d.ts +13 -0
  87. package/@types/forms/fields/markdown.d.ts +6 -0
  88. package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +16 -0
  89. package/@types/forms/fields/multiple-files.d.ts +3 -1
  90. package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +25 -0
  91. package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +25 -0
  92. package/@types/forms/fields/number.d.ts +3 -1
  93. package/@types/forms/fields/password.d.ts +6 -0
  94. package/@types/forms/fields/pick-from-list-sealious.d.ts +11 -0
  95. package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +15 -0
  96. package/@types/forms/fields/pick-from-list.d.ts +4 -3
  97. package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +15 -0
  98. package/@types/forms/fields/proxy-field.d.ts +3 -1
  99. package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +21 -0
  100. package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +21 -0
  101. package/@types/forms/fields/regexp.d.ts +6 -1
  102. package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +21 -0
  103. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +29 -0
  104. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +29 -0
  105. package/@types/forms/fields/simple-form-field.d.ts +23 -3
  106. package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +29 -0
  107. package/@types/forms/fields/single-reference.d.ts +19 -0
  108. package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +10 -0
  109. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +27 -0
  110. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +27 -0
  111. package/@types/forms/fields/structured-array.d.ts +19 -10
  112. package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +27 -0
  113. package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +16 -0
  114. package/@types/forms/fields/table.d.ts +3 -0
  115. package/@types/forms/fields/text.d.ts +6 -0
  116. package/@types/forms/fields/url.d.ts +6 -0
  117. package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +26 -0
  118. package/@types/forms/form-types.d.ts +2 -0
  119. package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +32 -0
  120. package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +32 -0
  121. package/@types/forms/form.d.ts +10 -8
  122. package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +33 -0
  123. package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +6 -0
  124. package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +6 -0
  125. package/@types/forms/form.test.d.ts +2 -2
  126. package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +23 -0
  127. package/@types/forms/multiform.d.ts +1 -2
  128. package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +23 -0
  129. package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +46 -0
  130. package/@types/index.d.ts +2 -2
  131. package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +6 -0
  132. package/@types/mount.d.ts +0 -1
  133. package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +48 -0
  134. package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +48 -0
  135. package/@types/page/list.d.ts +2 -2
  136. package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +48 -0
  137. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +42 -0
  138. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +42 -0
  139. package/@types/page/mountable-with-fields.d.ts +3 -3
  140. package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +42 -0
  141. package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +10 -0
  142. package/@types/page/mountable.d.ts +0 -1
  143. package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +18 -0
  144. package/@types/page/page.d.ts +0 -1
  145. package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +15 -0
  146. package/@types/page/props-parser.d.ts +0 -1
  147. package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +62 -0
  148. package/@types/page/stateful-page.d.ts +0 -1
  149. package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +1 -0
  150. package/@types/templates/shared/shared-crud-form-fields.d.ts +0 -67
  151. package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +26 -0
  152. package/@types/test_utils/test-on-real-app.d.ts +0 -1
  153. package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +18 -0
  154. package/@types/utils/extract-fields-from-collection.d.ts +5 -1
  155. package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +18 -0
  156. package/@types/utils/wrap-attributes.d.ts +3 -0
  157. package/README.md +5 -0
  158. package/assets/file-icon.svg +5 -0
  159. package/lib/add-crud.js +80 -89
  160. package/lib/add-list-route.test.js +1 -1
  161. package/lib/add-route.js +0 -7
  162. package/lib/build.js +3 -1
  163. package/lib/cli.js +2 -5
  164. package/lib/controllers/table-add-button.stimulus.js +35 -0
  165. package/lib/forms/controls/array.js +20 -16
  166. package/lib/forms/controls/big-radio-group.js +2 -2
  167. package/lib/forms/controls/checkbox-group.js +7 -7
  168. package/lib/forms/controls/checkboxed-list-input.js +9 -2
  169. package/lib/forms/controls/controls.js +2 -2
  170. package/lib/forms/controls/derived-frame.js +5 -1
  171. package/lib/forms/controls/derived.js +1 -1
  172. package/lib/forms/controls/dropdown.js +4 -1
  173. package/lib/forms/controls/editable-collection-subset.js +2 -2
  174. package/lib/forms/controls/file.js +26 -2
  175. package/lib/forms/controls/file.test.js +2 -2
  176. package/lib/forms/controls/hidden-input.js +4 -1
  177. package/lib/forms/controls/{photo.js → image.js} +6 -7
  178. package/lib/forms/controls/{photo.test.js → image.test.js} +6 -21
  179. package/lib/forms/controls/multiple-files.js +10 -1
  180. package/lib/forms/controls/{multiple-photos.js → multiple-images.js} +3 -3
  181. package/lib/forms/controls/simple-input.js +13 -12
  182. package/lib/forms/controls/single-reference.js +4 -0
  183. package/lib/forms/controls/table.js +66 -24
  184. package/lib/forms/controls/textarea.js +4 -2
  185. package/lib/forms/controls/tickable.js +13 -5
  186. package/lib/forms/fields/boolean.js +14 -0
  187. package/lib/forms/fields/checkboxed-list.js +4 -0
  188. package/lib/forms/fields/collection-field.js +9 -0
  189. package/lib/forms/fields/color.js +10 -0
  190. package/lib/forms/fields/coordinates.js +49 -0
  191. package/lib/forms/fields/date.js +34 -0
  192. package/lib/forms/fields/datetime.js +46 -0
  193. package/lib/forms/fields/deep-reverse-single-reference-list.js +81 -0
  194. package/lib/forms/fields/deep-reverse-single-reference-table.js +122 -0
  195. package/lib/forms/fields/email.js +7 -0
  196. package/lib/forms/fields/enum-multiple-sealious.js +32 -0
  197. package/lib/forms/fields/field.js +32 -4
  198. package/lib/forms/fields/field.test.js +5 -5
  199. package/lib/forms/fields/fields.js +23 -8
  200. package/lib/forms/fields/file.js +33 -9
  201. package/lib/forms/fields/file.test.js +4 -16
  202. package/lib/forms/fields/float.js +10 -0
  203. package/lib/forms/fields/get-field-for-sealious.js +213 -0
  204. package/lib/forms/fields/html.js +14 -0
  205. package/lib/forms/fields/image.js +13 -0
  206. package/lib/forms/fields/int.js +23 -0
  207. package/lib/forms/fields/json.js +31 -0
  208. package/lib/forms/fields/markdown.js +14 -0
  209. package/lib/forms/fields/multiple-files.js +4 -0
  210. package/lib/forms/fields/number.js +6 -0
  211. package/lib/forms/fields/password.js +13 -0
  212. package/lib/forms/fields/pick-from-list-sealious.js +17 -0
  213. package/lib/forms/fields/pick-from-list.js +6 -2
  214. package/lib/forms/fields/proxy-field.js +3 -0
  215. package/lib/forms/fields/regexp.js +14 -0
  216. package/lib/forms/fields/simple-form-field.js +60 -2
  217. package/lib/forms/fields/single-reference.js +44 -0
  218. package/lib/forms/fields/structured-array.js +63 -12
  219. package/lib/forms/fields/table.js +28 -1
  220. package/lib/forms/fields/text.js +17 -0
  221. package/lib/forms/fields/url.js +17 -0
  222. package/lib/forms/form.js +30 -13
  223. package/lib/forms/form.test.js +3 -4
  224. package/lib/forms/multiform.js +4 -2
  225. package/lib/forms/multiform.test.js +3 -3
  226. package/lib/generate-stimulus.js +1 -0
  227. package/lib/index.js +1 -0
  228. package/lib/make-hidden-inputs.js +1 -1
  229. package/lib/mount.js +11 -0
  230. package/lib/notifier.js +0 -1
  231. package/lib/page/list.js +15 -8
  232. package/lib/page/mountable-with-fields.js +14 -6
  233. package/lib/page/mountable-with-fields.test.js +1 -1
  234. package/lib/templates/form.js +8 -9
  235. package/lib/templates/multiform.js +4 -4
  236. package/lib/templates/page.js +0 -2
  237. package/lib/templates/shared/collection-create-form.js +28 -40
  238. package/lib/templates/shared/collection-edit-form.js +40 -77
  239. package/lib/templates/shared/collection-list.js +12 -20
  240. package/lib/templates/shared/shared-crud-form-fields.js +27 -95
  241. package/lib/test_utils/test-on-real-app.js +3 -3
  242. package/lib/utils/extract-fields-from-collection.js +60 -20
  243. package/lib/utils/make-slug.js +1 -1
  244. package/lib/utils/wrap-attributes.js +20 -0
  245. package/package.json +4 -3
  246. package/src/add-crud.ts +86 -97
  247. package/src/add-list-route.test.ts +1 -1
  248. package/src/add-route.ts +0 -7
  249. package/src/build.ts +3 -1
  250. package/src/cli.ts +3 -5
  251. package/src/controllers/table-add-button.stimulus.ts +35 -0
  252. package/src/forms/controls/array.ts +23 -20
  253. package/src/forms/controls/autocomplete.ts +1 -1
  254. package/src/forms/controls/big-radio-group.ts +2 -2
  255. package/src/forms/controls/checkbox-group.ts +9 -9
  256. package/src/forms/controls/checkboxed-list-input.ts +27 -15
  257. package/src/forms/controls/controls.ts +2 -2
  258. package/src/forms/controls/derived-frame.ts +5 -1
  259. package/src/forms/controls/derived.ts +1 -1
  260. package/src/forms/controls/dropdown.ts +5 -2
  261. package/src/forms/controls/editable-collection-subset.ts +2 -2
  262. package/src/forms/controls/file.test.ts +4 -2
  263. package/src/forms/controls/file.ts +31 -5
  264. package/src/forms/controls/form-control.ts +7 -2
  265. package/src/forms/controls/hidden-input.ts +4 -1
  266. package/src/forms/controls/{photo.test.ts → image.test.ts} +5 -22
  267. package/src/forms/controls/{photo.ts → image.ts} +3 -5
  268. package/src/forms/controls/multiple-files.ts +18 -1
  269. package/src/forms/controls/{multiple-photos.ts → multiple-images.ts} +1 -1
  270. package/src/forms/controls/number.ts +1 -1
  271. package/src/forms/controls/simple-input.ts +18 -34
  272. package/src/forms/controls/single-reference.ts +10 -2
  273. package/src/forms/controls/table.ts +90 -31
  274. package/src/forms/controls/textarea.ts +6 -4
  275. package/src/forms/controls/tickable.ts +13 -5
  276. package/src/forms/fields/boolean.ts +23 -1
  277. package/src/forms/fields/checkboxed-list.ts +11 -2
  278. package/src/forms/fields/collection-field.ts +16 -1
  279. package/src/forms/fields/color.ts +9 -0
  280. package/src/forms/fields/coordinates.ts +66 -0
  281. package/src/forms/fields/date.ts +50 -0
  282. package/src/forms/fields/datetime.ts +66 -0
  283. package/src/forms/fields/deep-reverse-single-reference-list.ts +136 -0
  284. package/src/forms/fields/deep-reverse-single-reference-table.ts +213 -0
  285. package/src/forms/fields/email.ts +9 -0
  286. package/src/forms/fields/enum-multiple-sealious.ts +48 -0
  287. package/src/forms/fields/field.test.ts +5 -5
  288. package/src/forms/fields/field.ts +94 -8
  289. package/src/forms/fields/fields.ts +23 -8
  290. package/src/forms/fields/file.test.ts +4 -16
  291. package/src/forms/fields/file.ts +43 -15
  292. package/src/forms/fields/float.ts +9 -0
  293. package/src/forms/fields/get-field-for-sealious.ts +304 -0
  294. package/src/forms/fields/html.ts +15 -0
  295. package/src/forms/fields/image.ts +12 -0
  296. package/src/forms/fields/int.ts +25 -0
  297. package/src/forms/fields/json.ts +48 -0
  298. package/src/forms/fields/markdown.ts +15 -0
  299. package/src/forms/fields/multiple-files.ts +10 -1
  300. package/src/forms/fields/number.ts +8 -1
  301. package/src/forms/fields/password.ts +17 -0
  302. package/src/forms/fields/pick-from-list-sealious.ts +22 -0
  303. package/src/forms/fields/pick-from-list.ts +7 -3
  304. package/src/forms/fields/proxy-field.ts +6 -1
  305. package/src/forms/fields/regexp.ts +27 -1
  306. package/src/forms/fields/simple-form-field.ts +95 -7
  307. package/src/forms/fields/single-reference.ts +62 -0
  308. package/src/forms/fields/structured-array.ts +115 -18
  309. package/src/forms/fields/table.ts +32 -1
  310. package/src/forms/fields/text.ts +18 -0
  311. package/src/forms/fields/url.ts +20 -0
  312. package/src/forms/form-types.ts +2 -0
  313. package/src/forms/form.test.ts +3 -4
  314. package/src/forms/form.ts +37 -16
  315. package/src/forms/forms.css +0 -85
  316. package/src/forms/multiform.test.ts +3 -3
  317. package/src/forms/multiform.ts +2 -0
  318. package/src/generate-stimulus.ts +1 -0
  319. package/src/index.ts +2 -1
  320. package/src/make-hidden-inputs.ts +1 -1
  321. package/src/mount.ts +14 -0
  322. package/src/notifier.ts +0 -1
  323. package/src/page/list.ts +15 -8
  324. package/src/page/mountable-with-fields.test.ts +1 -1
  325. package/src/page/mountable-with-fields.ts +18 -9
  326. package/src/register-external.ts +1 -1
  327. package/src/templates/form.ts +8 -9
  328. package/src/templates/multiform.ts +4 -4
  329. package/src/templates/page.ts +0 -2
  330. package/src/templates/shared/collection-create-form.ts +30 -66
  331. package/src/templates/shared/collection-edit-form.ts +41 -102
  332. package/src/templates/shared/collection-list.ts +12 -20
  333. package/src/templates/shared/item-delete.ts +0 -1
  334. package/src/templates/shared/shared-crud-form-fields.ts +37 -171
  335. package/src/test_utils/test-on-real-app.ts +4 -3
  336. package/src/utils/extract-fields-from-collection.ts +76 -25
  337. package/src/utils/make-slug.ts +1 -1
  338. package/src/utils/wrap-attributes.ts +17 -0
  339. package/lib/add-verbose-crud.js +0 -119
  340. package/lib/crud-field-snippets.js +0 -52
  341. package/lib/find-css-includes.js +0 -3
  342. package/lib/forms/controls/reverse-single-reference.js +0 -1
  343. package/lib/forms/fields/enum-multiple.js +0 -47
  344. package/lib/forms/fields/enum-multiple.test.js +0 -27
  345. package/lib/forms/fields/enum.js +0 -41
  346. package/lib/forms/fields/enum.test.js +0 -21
  347. package/lib/forms/fields/reverse-single-reference.js +0 -17
  348. package/lib/templates/shared/handlers/boolean.js +0 -14
  349. package/lib/templates/shared/handlers/date.js +0 -8
  350. package/lib/templates/shared/handlers/deep-reverse-single-reference.js +0 -209
  351. package/lib/templates/shared/handlers/default.js +0 -49
  352. package/lib/templates/shared/handlers/enum.js +0 -19
  353. package/lib/templates/shared/handlers/file.js +0 -23
  354. package/lib/templates/shared/handlers/image.js +0 -32
  355. package/lib/templates/shared/handlers/int.js +0 -11
  356. package/lib/templates/shared/handlers/jdd.js +0 -10
  357. package/lib/templates/shared/handlers/single-reference.js +0 -12
  358. package/lib/templates/shared/handlers/structured-array.js +0 -33
  359. package/src/add-verbose-crud.ts +0 -138
  360. package/src/crud-field-snippets.ts +0 -57
  361. package/src/find-css-includes.ts +0 -3
  362. package/src/forms/controls/reverse-single-reference.ts +0 -50
  363. package/src/forms/fields/enum-multiple.test.ts +0 -31
  364. package/src/forms/fields/enum-multiple.ts +0 -62
  365. package/src/forms/fields/enum.test.ts +0 -25
  366. package/src/forms/fields/enum.ts +0 -56
  367. package/src/forms/fields/reverse-single-reference.ts +0 -20
  368. package/src/templates/shared/handlers/boolean.ts +0 -18
  369. package/src/templates/shared/handlers/date.ts +0 -12
  370. package/src/templates/shared/handlers/deep-reverse-single-reference.ts +0 -244
  371. package/src/templates/shared/handlers/default.ts +0 -64
  372. package/src/templates/shared/handlers/enum.ts +0 -23
  373. package/src/templates/shared/handlers/file.ts +0 -27
  374. package/src/templates/shared/handlers/image.ts +0 -45
  375. package/src/templates/shared/handlers/int.ts +0 -15
  376. package/src/templates/shared/handlers/jdd.ts +0 -14
  377. package/src/templates/shared/handlers/single-reference.ts +0 -16
  378. package/src/templates/shared/handlers/structured-array.ts +0 -42
@@ -1,23 +0,0 @@
1
- import { toCamelCase } from "js-convert-case";
2
- const file_handler = async (_, { name, is_required }, importPath, { is_required_expr }) => {
3
- const tempname = toCamelCase("prepared-" + name);
4
- return {
5
- imports: {
6
- shared: `import { TheFileManager } from "${importPath(
7
- "src/back/file-manager.js"
8
- )}";`
9
- },
10
- field: `${name}: new Fields.File(${is_required_expr}, TheFileManager)`,
11
- initial_value_edit: `{old: item.get("${name}")}`,
12
- pre_edit: `const ${tempname} = data.["${name}"]?.new || data.["${name}"]?.old;
13
- if(!${tempname}){
14
- throw new Error("Missing field: ${name}")
15
- }`,
16
- fallback_value_sealious: "null",
17
- ...is_required ? { main_value_sealious: tempname } : {}
18
- };
19
- };
20
- export {
21
- file_handler
22
- };
23
- //# sourceMappingURL=file.js.map
@@ -1,32 +0,0 @@
1
- import { toCamelCase } from "js-convert-case";
2
- const image_handler = async (_, { name, is_required }, importPath, { is_required_expr, fields_var }) => {
3
- const tempname = toCamelCase("prepared-" + name);
4
- return {
5
- imports: {
6
- shared: `import { imageRouter } from "${importPath(
7
- "src/back/image-router.js"
8
- )}";
9
- import { TheFileManager } from "${importPath(
10
- "src/back/file-manager.js"
11
- )}";`
12
- },
13
- field: `${name}: new Fields.File(${is_required_expr}, TheFileManager)`,
14
- controls: `new Controls.Photo(${fields_var}.${name}, imageRouter, {
15
- label: "${name}",
16
- })`,
17
- initial_value_edit: `{old: item.get("${name}")}`,
18
- pre_edit: `const ${tempname} = data.${name}.new || data.${name}.old ` + (is_required ? `; if(!${tempname}){
19
- throw new Error("Missing field: ${name}")
20
- }` : " || undefined;"),
21
- pre_create: `const ${tempname} = data.${name}.new || data.${name}.old;
22
- if(!${tempname}){
23
- throw new Error("Missing field: ${name}")
24
- }`,
25
- fallback_value_sealious: "null",
26
- sealious_value: () => `${name}: ${tempname}`
27
- };
28
- };
29
- export {
30
- image_handler
31
- };
32
- //# sourceMappingURL=image.js.map
@@ -1,11 +0,0 @@
1
- const int_handler = async (_, { name }, __, { is_required_expr, fields_var }) => ({
2
- field: `${name}: new Fields.NumberField(${is_required_expr}, 0)`,
3
- controls: `new Controls.Number(${fields_var}.${name}, { label: "${name}" })`,
4
- initial_value_edit: {
5
- parsed_value: `String(item.get("${name}"))`
6
- }
7
- });
8
- export {
9
- int_handler
10
- };
11
- //# sourceMappingURL=int.js.map
@@ -1,10 +0,0 @@
1
- const jdd_handler = async (_, { name }) => ({
2
- field: ``,
3
- initial_value_edit: "",
4
- controls: "",
5
- sealious_value: () => `${name}: []`
6
- });
7
- export {
8
- jdd_handler
9
- };
10
- //# sourceMappingURL=jdd.js.map
@@ -1,12 +0,0 @@
1
- const single_reference_handler = async (_, { name }, __, { fields_var }) => {
2
- return {
3
- controls: `new Controls.SingleReferenceDropdown(${fields_var}.${name}, {
4
- label: "${name}",
5
- getLabel: (item)=>item.id
6
- })`
7
- };
8
- };
9
- export {
10
- single_reference_handler
11
- };
12
- //# sourceMappingURL=single-reference.js.map
@@ -1,33 +0,0 @@
1
- const structured_array_handler = async (_, { name, subfields }, __, { fields_var }) => ({
2
- field: `${name}: new Fields.Table({
3
- ${subfields.map(
4
- (subfield) => `${subfield.name}: new Fields.SimpleFormField(true)`
5
- ).join(",\n")}
6
- })`,
7
- controls: `new Controls.Table(${fields_var}.${name}, {
8
- label: "${name}",
9
- render_fields: {
10
- ${subfields.map(
11
- ({
12
- name: name2
13
- }) => `"${name2}": (fctx, name, value) => /* HTML */ \`<input
14
- name="\${name}"
15
- value="\${value}"
16
- form="\${fctx.form_id}"
17
- autocomplete="off"
18
- />\``
19
- ).join(",\n")}
20
-
21
- },
22
- allow_adding: true,
23
- allow_removing: true,
24
- make_new_row: async () => ({
25
- ${subfields.map(({ name: name2 }) => `"${name2}": ""`).join(",\n")}
26
- }),
27
- })`,
28
- fallback_value_sealious: `[]`
29
- });
30
- export {
31
- structured_array_handler
32
- };
33
- //# sourceMappingURL=structured-array.js.map
@@ -1,138 +0,0 @@
1
- import _locreq from "locreq";
2
- import { escape_url_params } from "./utils/escape-url-params.js";
3
- import prompts from "prompts";
4
- import { toKebabCase, toPascalCase } from "js-convert-case";
5
- import { listCollections } from "./utils/list-collections.js";
6
- import { collectionListTemplate } from "./templates/shared/collection-list.js";
7
- import { writeFile } from "./utils/write-file.js";
8
- import { curryImportPath, importPath } from "./utils/import-path.js";
9
- import { sharedCrudFormFields } from "./templates/shared/shared-crud-form-fields.js";
10
- import { generateRoutes } from "./generate-routes.js";
11
- import { createItemFormTemplate } from "./templates/shared/collection-create-form.js";
12
- import { editItemFormTemplate } from "./templates/shared/collection-edit-form.js";
13
- import { itemDeleteTemplate } from "./templates/shared/item-delete.js";
14
-
15
- export async function addVerboseCRUD(
16
- params: Partial<{ [key in "collection" | "url"]: string }>,
17
- app_directory: string = process.cwd()
18
- ) {
19
- const target_locreq = _locreq(app_directory);
20
- prompts.override(params);
21
- const response = await prompts([
22
- {
23
- type: "autocomplete",
24
- name: "collection",
25
- message:
26
- "Which sealious collection do you like to add CRUD forms for?",
27
- choices: (
28
- await listCollections()
29
- ).map((collection) => ({
30
- title: collection,
31
- value: collection,
32
- })),
33
- },
34
- {
35
- type: "text",
36
- name: "url",
37
- message:
38
- "Enter a full absolute path for the new route (for example: /admin/users/:id/edit): ",
39
- validate: (s: string) =>
40
- s.trim()[0] == "/" ? true : "Should start with a '/'",
41
- initial: function (_, { collection }: { collection: string }) {
42
- return "/" + toKebabCase(collection);
43
- },
44
- },
45
- ]);
46
-
47
- const collection_name = response.collection as string;
48
- const url = response.url as string;
49
- const list_action_name = toPascalCase(collection_name) + "CRUDList";
50
- const create_action_name = toPascalCase(collection_name) + "CRUDCreate";
51
- const edit_action_name = toPascalCase(collection_name) + "CRUDEdit";
52
- const delete_action_name = toPascalCase(collection_name) + "CRUDDelete";
53
-
54
- /* create the list endpoint */
55
- const list_path = target_locreq.resolve(
56
- `src/back/routes/${escape_url_params(url)}/index.list.tsx`
57
- );
58
- const list_content = await collectionListTemplate(
59
- collection_name,
60
- list_action_name,
61
- list_path,
62
- {
63
- post_import_js: `import { ${create_action_name}URL, ${edit_action_name}URL, ${delete_action_name}URL } from "${importPath(
64
- list_path,
65
- "src/back/routes/urls.ts"
66
- )}";`,
67
- post_header_html: `<a href={${create_action_name}URL}> Create </a>`,
68
- render_item: (
69
- collection_name: string
70
- ) => ` async renderItem(ctx: Context, item: CollectionItem<typeof ${toPascalCase(
71
- collection_name
72
- )}>) {
73
- return <tr>
74
- {displayFields.map(({ field, format }) => {
75
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-explicit-any
76
- const value = item.get(field as any);
77
- return <td>{format ? format(value, item) : value}</td>;
78
- })}
79
- <td><div class="sealious-list__actions">
80
- <a href={${edit_action_name}URL(item.id)}>Edit</a>
81
- <a data-turbo-method="POST" data-turbo-confirm="Delete item?" href={${delete_action_name}URL(item.id)}>Delete</a>
82
- </div>
83
- </td>
84
- </tr>;
85
- }`,
86
- }
87
- );
88
- await writeFile(list_path, list_content);
89
-
90
- /* create the shared fields file */
91
- const fields_path = target_locreq.resolve(
92
- `src/back/routes/${escape_url_params(url)}/shared.ts`
93
- );
94
- const fields_content = await sharedCrudFormFields(
95
- collection_name,
96
- fields_path
97
- );
98
- await writeFile(fields_path, fields_content);
99
-
100
- /* create the create endpoint */
101
- const create_path = target_locreq.resolve(
102
- `src/back/routes/${escape_url_params(url)}/create.form.ts`
103
- );
104
- const create_content = await createItemFormTemplate(
105
- create_action_name,
106
- create_path,
107
- collection_name,
108
- list_action_name
109
- );
110
- await writeFile(create_path, create_content);
111
-
112
- /* create the edit endpoint */
113
- const edit_path = target_locreq.resolve(
114
- `src/back/routes/${escape_url_params(url)}/[id]/edit.form.ts`
115
- );
116
- const edit_content = await editItemFormTemplate(
117
- edit_action_name,
118
- edit_path,
119
- collection_name,
120
- list_action_name
121
- );
122
- await writeFile(edit_path, edit_content);
123
-
124
- /* create the actual delete endpoint */
125
- const delete_path = target_locreq.resolve(
126
- `src/back/routes/${escape_url_params(url)}/[id]/delete.page.tsx`
127
- );
128
- const base_import_path = curryImportPath(delete_path);
129
- const delete_content = await itemDeleteTemplate(
130
- delete_action_name,
131
- collection_name,
132
- list_action_name,
133
- base_import_path
134
- );
135
- await writeFile(delete_path, delete_content);
136
-
137
- await generateRoutes();
138
- }
@@ -1,57 +0,0 @@
1
- import _locreq from "locreq";
2
- import prompts from "prompts";
3
- import { getFieldHandler } from "./templates/shared/shared-crud-form-fields.js";
4
- import extract_fields_from_collection from "./utils/extract-fields-from-collection.js";
5
- import { listCollections } from "./utils/list-collections.js";
6
- import { formatWithPrettier } from "./utils/prettier.js";
7
-
8
- export async function crudFieldSnippets(
9
- params: Partial<{ [key in "collection" | "url"]: string }>,
10
- app_directory: string = process.cwd()
11
- ) {
12
- const target_locreq = _locreq(app_directory);
13
- prompts.override(params);
14
- const { collection_name } = (await prompts([
15
- {
16
- type: "autocomplete",
17
- name: "collection_name",
18
- message:
19
- "Which sealious collection do you like to show a CRUD field config for?",
20
- choices: (
21
- await listCollections()
22
- ).map((collection) => ({
23
- title: collection,
24
- value: collection,
25
- })),
26
- },
27
- ])) as { collection_name: string };
28
- const all_fields = await extract_fields_from_collection(collection_name);
29
- const { field_name } = (await prompts([
30
- {
31
- type: "autocomplete",
32
- name: "field_name",
33
- message: `Which field do you want to show CRUD config for??`,
34
- choices: all_fields.map((field) => ({
35
- title: field.name,
36
- value: field.name,
37
- })),
38
- },
39
- ])) as { field_name: string };
40
-
41
- const handler = await getFieldHandler(
42
- collection_name,
43
- all_fields.find((e) => e.name == field_name)!,
44
- (p) => p
45
- );
46
-
47
- console.log(`
48
-
49
- ### Field in shared.ts
50
-
51
- ${handler.field}
52
-
53
- ### Control in shared.ts
54
-
55
- ${await formatWithPrettier(handler.controls)}
56
- `);
57
- }
@@ -1,3 +0,0 @@
1
- import _locreq from "locreq";
2
-
3
- const target_locreq = _locreq(process.cwd());
@@ -1,50 +0,0 @@
1
- // import { FormControl } from "./form-control";
2
- // import { FormFieldControl } from "./form-field-control";
3
- // import { ReverseSingleReference as ReverseSingleReferenceField } from "../fields/field";
4
- // import { Context } from "koa";
5
- // import { Fields } from "../..";
6
- // import { ArrayControl } from "./array";
7
-
8
- // export class ReverseSingleReference extends ArrayControl {
9
- // //
10
- // //
11
- // // this isn't finished yet
12
- // //
13
- // //
14
-
15
- // constructor(
16
- // public field: ReverseSingleReferenceField,
17
- // public item_controls: Array<FormControl | UnboundControlStorage>
18
- // ) {
19
- // super(field, item_controls);
20
- // }
21
-
22
- // async getItems(ctx: Context) {
23
- // const target_id = await this.getTargetItemID(ctx);
24
- // const { items } = await this.field.sealious_field
25
- // .getReferencingCollection()
26
- // .list(ctx.$context)
27
- // .filter({
28
- // [this.field.sealious_field.referencing_field]: target_id,
29
- // })
30
- // .fetch();
31
- // return items;
32
- // }
33
-
34
- // makeSubfield(fieldname: string) {
35
- // const collection = this.field.sealious_field.getReferencingCollection();
36
- // if (!collection.fields[fieldname]) {
37
- // return null;
38
- // }
39
- // return new Fields.CollectionField(false, collection.fields[fieldname]);
40
- // }
41
-
42
- // async add(ctx: Context): Promise<void> {
43
- // const collection = this.field.sealious_field.getReferencingCollection();
44
- // await collection.create(ctx.$context, {
45
- // [this.field.sealious_field.referencing_field]:
46
- // await this.getTargetItemID(ctx),
47
- // ...(await this.getDefaultItemBody()),
48
- // });
49
- // }
50
- // }
@@ -1,31 +0,0 @@
1
- import assert from "assert";
2
- import { Fields } from "../../index.js";
3
-
4
- describe("enum-multiple field", () => {
5
- const ctx = {} as any;
6
-
7
- it("validation logic", async () => {
8
- const field = new Fields.EnumMultipleField(true, ["sa", "mp", "le"]);
9
-
10
- assert.strictEqual((await field.isValueValid(ctx, ["sa", "le"])).valid, true);
11
- assert.strictEqual((await field.isValueValid(ctx, ["notvalid"])).valid, false);
12
- assert.strictEqual((await field.isValueValid(ctx, [42] as any)).valid, false);
13
- });
14
-
15
- it("parse function", async () => {
16
- const field = new Fields.EnumMultipleField(true, []);
17
- const string_array_response = await field.parse(ctx, ["42"]);
18
- const number_response = await field.parse(ctx, 42);
19
- const string_response = await field.parse(ctx, "sample");
20
- const null_response = await field.parse(ctx, null as any);
21
-
22
- assert.strictEqual(string_array_response.parsable, true);
23
- assert.deepEqual(string_array_response.parsed_value, ["42"]);
24
- assert.strictEqual(number_response.parsable, false);
25
- assert.strictEqual(number_response.error, "Please enter a list of strings");
26
- assert.strictEqual(string_response.parsable, true);
27
- assert.deepEqual(string_response.parsed_value, ["sample"]);
28
- assert.strictEqual(null_response.parsable, true);
29
- assert.deepEqual(null_response.parsed_value, []);
30
- });
31
- });
@@ -1,62 +0,0 @@
1
- import { is, predicates } from "@sealcode/ts-predicates";
2
- import { Context } from "koa";
3
- import { FormDataValue } from "../form-types.js";
4
- import { FieldParseResult, FormField } from "./field.js";
5
-
6
- export class EnumMultipleField<
7
- Options extends readonly string[],
8
- Required extends boolean
9
- > extends FormField<Required, string[]> {
10
- constructor(
11
- required: Required,
12
- public options: Options,
13
- public error_message: (options: Options) => string = (options) =>
14
- options.join(", ")
15
- ) {
16
- super(required);
17
- }
18
-
19
- predicate = predicates.enum<Options>(this.options);
20
-
21
- public async isValueValid(
22
- _: Context,
23
- values: string[]
24
- ): Promise<{ valid: boolean; message: string }> {
25
- for (const value of values) {
26
- if (!is(value, predicates.string)) {
27
- return { valid: false, message: "expected a string" };
28
- }
29
- if (!this.options.includes(value)) {
30
- return { valid: false, message: "invalid value" };
31
- }
32
- }
33
- return { valid: true, message: "" };
34
- }
35
-
36
- async parse(
37
- _: Context,
38
- value: FormDataValue
39
- ): Promise<FieldParseResult<string[]>> {
40
- if (is(value, predicates.string)) {
41
- return { parsable: true, parsed_value: [value], error: null };
42
- } else if (is(value, predicates.array(predicates.string))) {
43
- return {
44
- parsable: true,
45
- parsed_value: value,
46
- error: null,
47
- };
48
- } else if (value == null) {
49
- return { parsable: true, parsed_value: [], error: null };
50
- } else {
51
- return {
52
- parsable: false,
53
- parsed_value: null,
54
- error: "Please enter a list of strings",
55
- };
56
- }
57
- }
58
-
59
- public getEmptyValue(): string[] {
60
- return [];
61
- }
62
- }
@@ -1,25 +0,0 @@
1
- import assert from "assert";
2
- import { Fields } from "../../index.js";
3
-
4
- describe("enum field", () => {
5
- const ctx = {} as any;
6
-
7
- it("validation logic", async () => {
8
- const field = new Fields.EnumField(true, ["sa", "mp", "le"]);
9
-
10
- assert.strictEqual((await field.isValueValid(ctx, 42)).valid, false);
11
- assert.strictEqual((await field.isValueValid(ctx, "mp")).valid, true);
12
- assert.strictEqual((await field.isValueValid(ctx, "notvalid")).valid, false);
13
- });
14
-
15
- it("parse function", async () => {
16
- const field = new Fields.EnumField(true, []);
17
- const string_response = await field.parse(ctx, "42");
18
- const number_response = await field.parse(ctx, 42);
19
-
20
- assert.strictEqual(string_response.parsable, true);
21
- assert.strictEqual(string_response.parsed_value, "42");
22
- assert.strictEqual(number_response.parsable, false);
23
- assert.strictEqual(number_response.error, "Please enter a string");
24
- });
25
- });
@@ -1,56 +0,0 @@
1
- import { is, predicates } from "@sealcode/ts-predicates";
2
- import { Context } from "koa";
3
- import { FormDataValue } from "../form-types.js";
4
- import { FieldParseResult, FormField } from "./field.js";
5
-
6
- export class EnumField<
7
- Options extends readonly string[],
8
- Required extends boolean
9
- > extends FormField<Required, string> {
10
- constructor(
11
- required: Required,
12
- public options: Options,
13
- public error_message: (options: Options) => string = (options) =>
14
- options.join(", ")
15
- ) {
16
- super(required);
17
- }
18
-
19
- predicate = predicates.enum<Options>(this.options);
20
-
21
- public async isValueValid(
22
- _: Context,
23
- value: unknown
24
- ): Promise<{ valid: boolean; message: string }> {
25
- if (!is(value, predicates.string)) {
26
- return { valid: false, message: "expected a string" };
27
- }
28
- if (this.options.includes(value)) {
29
- return { valid: true, message: "" };
30
- }
31
- return { valid: false, message: this.error_message(this.options) };
32
- }
33
-
34
- async parse(
35
- _: Context,
36
- value: FormDataValue
37
- ): Promise<FieldParseResult<string>> {
38
- if (is(value, predicates.string)) {
39
- return {
40
- parsable: true,
41
- parsed_value: value,
42
- error: null,
43
- };
44
- } else {
45
- return {
46
- parsable: false,
47
- parsed_value: null,
48
- error: "Please enter a string",
49
- };
50
- }
51
- }
52
-
53
- public getEmptyValue(): string {
54
- return "";
55
- }
56
- }
@@ -1,20 +0,0 @@
1
- import { FormField } from "./field.js";
2
- import { FieldTypes as SealiousFields } from "sealious";
3
- import { Context } from "koa";
4
-
5
- export class ReverseSingleReference extends FormField {
6
- constructor(
7
- required: boolean,
8
- public sealious_field: SealiousFields.ReverseSingleReference
9
- ) {
10
- super(required);
11
- }
12
-
13
- async parse(ctx: Context, raw_value: unknown) {
14
- return { parsable: <const>true, error: null, parsed_value: raw_value };
15
- }
16
-
17
- getEmptyValue() {
18
- return [];
19
- }
20
- }
@@ -1,18 +0,0 @@
1
- import {
2
- FieldHandler,
3
- FieldHandlerResult,
4
- } from "../shared-crud-form-fields.js";
5
-
6
- export const boolean_handler: FieldHandler<
7
- FieldHandlerResult,
8
- Partial<FieldHandlerResult>
9
- > = async (_, { name }, ___, { is_required_expr, fields_var }) => ({
10
- field: `${name}: new Fields.Boolean(${is_required_expr})`,
11
- controls: `new Controls.Checkbox(${fields_var}.${name}, { label: "${name}" })`,
12
- initial_value_edit: {
13
- fallback_value: `"false"`,
14
- parsed_value: `String(item.get("${name}"))`,
15
- },
16
- main_value_sealious: `!!data.${name}`,
17
- fallback_value_sealious: "false",
18
- });
@@ -1,12 +0,0 @@
1
- import {
2
- FieldHandler,
3
- FieldHandlerResult,
4
- } from "../shared-crud-form-fields.js";
5
-
6
- export const date_handler: FieldHandler<
7
- FieldHandlerResult,
8
- Partial<FieldHandlerResult>
9
- > = async (_, { name }, ___, { fields_var }) => ({
10
- controls: `new Controls.SimpleInput(${fields_var}.${name}, { label: "${name}", type: "date"})`,
11
- fallback_value_sealious: `undefined`,
12
- });