@wordpress/dataviews 8.0.1-next.e256d081a.0 → 9.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 (415) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/README.md +203 -13
  3. package/build/components/dataform-context/index.js +1 -0
  4. package/build/components/dataform-context/index.js.map +1 -1
  5. package/build/components/dataviews/index.js +11 -1
  6. package/build/components/dataviews/index.js.map +1 -1
  7. package/build/components/dataviews-context/index.js +1 -0
  8. package/build/components/dataviews-context/index.js.map +1 -1
  9. package/build/components/dataviews-filters/input-widget.js +48 -4
  10. package/build/components/dataviews-filters/input-widget.js.map +1 -1
  11. package/build/components/dataviews-layout/index.js +5 -2
  12. package/build/components/dataviews-layout/index.js.map +1 -1
  13. package/build/components/dataviews-picker/footer.js +145 -0
  14. package/build/components/dataviews-picker/footer.js.map +1 -0
  15. package/build/components/dataviews-picker/index.js +201 -0
  16. package/build/components/dataviews-picker/index.js.map +1 -0
  17. package/build/components/dataviews-selection-checkbox/index.js +4 -2
  18. package/build/components/dataviews-selection-checkbox/index.js.map +1 -1
  19. package/build/components/dataviews-view-config/index.js +1 -0
  20. package/build/components/dataviews-view-config/index.js.map +1 -1
  21. package/build/constants.js +4 -1
  22. package/build/constants.js.map +1 -1
  23. package/build/dataform-controls/array.js +9 -7
  24. package/build/dataform-controls/array.js.map +1 -1
  25. package/build/dataform-controls/checkbox.js +40 -8
  26. package/build/dataform-controls/checkbox.js.map +1 -1
  27. package/build/dataform-controls/color.js +133 -0
  28. package/build/dataform-controls/color.js.map +1 -0
  29. package/build/dataform-controls/date.js +32 -24
  30. package/build/dataform-controls/date.js.map +1 -1
  31. package/build/dataform-controls/datetime.js +133 -19
  32. package/build/dataform-controls/datetime.js.map +1 -1
  33. package/build/dataform-controls/email.js +15 -44
  34. package/build/dataform-controls/email.js.map +1 -1
  35. package/build/dataform-controls/index.js +35 -2
  36. package/build/dataform-controls/index.js.map +1 -1
  37. package/build/dataform-controls/integer.js +47 -34
  38. package/build/dataform-controls/integer.js.map +1 -1
  39. package/build/dataform-controls/password.js +47 -0
  40. package/build/dataform-controls/password.js.map +1 -0
  41. package/build/dataform-controls/radio.js +42 -9
  42. package/build/dataform-controls/radio.js.map +1 -1
  43. package/build/dataform-controls/relative-date-control.js +6 -10
  44. package/build/dataform-controls/relative-date-control.js.map +1 -1
  45. package/build/dataform-controls/select.js +41 -10
  46. package/build/dataform-controls/select.js.map +1 -1
  47. package/build/dataform-controls/telephone.js +40 -0
  48. package/build/dataform-controls/telephone.js.map +1 -0
  49. package/build/dataform-controls/text.js +14 -43
  50. package/build/dataform-controls/text.js.map +1 -1
  51. package/build/dataform-controls/textarea.js +81 -0
  52. package/build/dataform-controls/textarea.js.map +1 -0
  53. package/build/dataform-controls/toggle-group.js +36 -6
  54. package/build/dataform-controls/toggle-group.js.map +1 -1
  55. package/build/dataform-controls/toggle.js +77 -0
  56. package/build/dataform-controls/toggle.js.map +1 -0
  57. package/build/dataform-controls/url.js +40 -0
  58. package/build/dataform-controls/url.js.map +1 -0
  59. package/build/dataform-controls/utils/validated-input.js +83 -0
  60. package/build/dataform-controls/utils/validated-input.js.map +1 -0
  61. package/build/dataforms-layouts/card/index.js +6 -7
  62. package/build/dataforms-layouts/card/index.js.map +1 -1
  63. package/build/dataforms-layouts/data-form-layout.js +16 -4
  64. package/build/dataforms-layouts/data-form-layout.js.map +1 -1
  65. package/build/dataforms-layouts/index.js +31 -1
  66. package/build/dataforms-layouts/index.js.map +1 -1
  67. package/build/dataforms-layouts/panel/dropdown.js +10 -14
  68. package/build/dataforms-layouts/panel/dropdown.js.map +1 -1
  69. package/build/dataforms-layouts/panel/index.js +24 -11
  70. package/build/dataforms-layouts/panel/index.js.map +1 -1
  71. package/build/dataforms-layouts/panel/modal.js +22 -27
  72. package/build/dataforms-layouts/panel/modal.js.map +1 -1
  73. package/build/dataforms-layouts/panel/summary-button.js +67 -0
  74. package/build/dataforms-layouts/panel/summary-button.js.map +1 -0
  75. package/build/dataforms-layouts/regular/index.js +7 -9
  76. package/build/dataforms-layouts/regular/index.js.map +1 -1
  77. package/build/dataforms-layouts/row/index.js +113 -0
  78. package/build/dataforms-layouts/row/index.js.map +1 -0
  79. package/build/dataviews-layouts/grid/index.js +21 -26
  80. package/build/dataviews-layouts/grid/index.js.map +1 -1
  81. package/build/dataviews-layouts/index.js +9 -1
  82. package/build/dataviews-layouts/index.js.map +1 -1
  83. package/build/dataviews-layouts/list/index.js +47 -2
  84. package/build/dataviews-layouts/list/index.js.map +1 -1
  85. package/build/dataviews-layouts/picker-grid/index.js +347 -0
  86. package/build/dataviews-layouts/picker-grid/index.js.map +1 -0
  87. package/build/dataviews-layouts/table/index.js +5 -17
  88. package/build/dataviews-layouts/table/index.js.map +1 -1
  89. package/build/dataviews-layouts/utils/get-data-by-group.js +23 -0
  90. package/build/dataviews-layouts/utils/get-data-by-group.js.map +1 -0
  91. package/build/dataviews-layouts/utils/grid-items.js +37 -0
  92. package/build/dataviews-layouts/utils/grid-items.js.map +1 -0
  93. package/build/dataviews-layouts/utils/preview-size-picker.js +81 -0
  94. package/build/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
  95. package/build/field-types/boolean.js +1 -1
  96. package/build/field-types/boolean.js.map +1 -1
  97. package/build/field-types/color.js +113 -0
  98. package/build/field-types/color.js.map +1 -0
  99. package/build/field-types/index.js +16 -0
  100. package/build/field-types/index.js.map +1 -1
  101. package/build/field-types/password.js +51 -0
  102. package/build/field-types/password.js.map +1 -0
  103. package/build/field-types/telephone.js +57 -0
  104. package/build/field-types/telephone.js.map +1 -0
  105. package/build/field-types/url.js +57 -0
  106. package/build/field-types/url.js.map +1 -0
  107. package/build/normalize-fields.js +17 -0
  108. package/build/normalize-fields.js.map +1 -1
  109. package/build/normalize-form-fields.js +6 -0
  110. package/build/normalize-form-fields.js.map +1 -1
  111. package/build/types.js.map +1 -1
  112. package/build/validation.js +1 -1
  113. package/build/validation.js.map +1 -1
  114. package/build-module/components/dataform-context/index.js +1 -0
  115. package/build-module/components/dataform-context/index.js.map +1 -1
  116. package/build-module/components/dataviews/index.js +11 -1
  117. package/build-module/components/dataviews/index.js.map +1 -1
  118. package/build-module/components/dataviews-context/index.js +1 -0
  119. package/build-module/components/dataviews-context/index.js.map +1 -1
  120. package/build-module/components/dataviews-filters/input-widget.js +48 -4
  121. package/build-module/components/dataviews-filters/input-widget.js.map +1 -1
  122. package/build-module/components/dataviews-layout/index.js +5 -2
  123. package/build-module/components/dataviews-layout/index.js.map +1 -1
  124. package/build-module/components/dataviews-picker/footer.js +136 -0
  125. package/build-module/components/dataviews-picker/footer.js.map +1 -0
  126. package/build-module/components/dataviews-picker/index.js +191 -0
  127. package/build-module/components/dataviews-picker/index.js.map +1 -0
  128. package/build-module/components/dataviews-selection-checkbox/index.js +4 -2
  129. package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -1
  130. package/build-module/components/dataviews-view-config/index.js +1 -0
  131. package/build-module/components/dataviews-view-config/index.js.map +1 -1
  132. package/build-module/constants.js +3 -0
  133. package/build-module/constants.js.map +1 -1
  134. package/build-module/dataform-controls/array.js +9 -7
  135. package/build-module/dataform-controls/array.js.map +1 -1
  136. package/build-module/dataform-controls/checkbox.js +41 -9
  137. package/build-module/dataform-controls/checkbox.js.map +1 -1
  138. package/build-module/dataform-controls/color.js +126 -0
  139. package/build-module/dataform-controls/color.js.map +1 -0
  140. package/build-module/dataform-controls/date.js +32 -24
  141. package/build-module/dataform-controls/date.js.map +1 -1
  142. package/build-module/dataform-controls/datetime.js +135 -21
  143. package/build-module/dataform-controls/datetime.js.map +1 -1
  144. package/build-module/dataform-controls/email.js +15 -45
  145. package/build-module/dataform-controls/email.js.map +1 -1
  146. package/build-module/dataform-controls/index.js +35 -2
  147. package/build-module/dataform-controls/index.js.map +1 -1
  148. package/build-module/dataform-controls/integer.js +46 -34
  149. package/build-module/dataform-controls/integer.js.map +1 -1
  150. package/build-module/dataform-controls/password.js +38 -0
  151. package/build-module/dataform-controls/password.js.map +1 -0
  152. package/build-module/dataform-controls/radio.js +44 -11
  153. package/build-module/dataform-controls/radio.js.map +1 -1
  154. package/build-module/dataform-controls/relative-date-control.js +6 -10
  155. package/build-module/dataform-controls/relative-date-control.js.map +1 -1
  156. package/build-module/dataform-controls/select.js +43 -12
  157. package/build-module/dataform-controls/select.js.map +1 -1
  158. package/build-module/dataform-controls/telephone.js +33 -0
  159. package/build-module/dataform-controls/telephone.js.map +1 -0
  160. package/build-module/dataform-controls/text.js +14 -44
  161. package/build-module/dataform-controls/text.js.map +1 -1
  162. package/build-module/dataform-controls/textarea.js +74 -0
  163. package/build-module/dataform-controls/textarea.js.map +1 -0
  164. package/build-module/dataform-controls/toggle-group.js +38 -8
  165. package/build-module/dataform-controls/toggle-group.js.map +1 -1
  166. package/build-module/dataform-controls/toggle.js +70 -0
  167. package/build-module/dataform-controls/toggle.js.map +1 -0
  168. package/build-module/dataform-controls/url.js +33 -0
  169. package/build-module/dataform-controls/url.js.map +1 -0
  170. package/build-module/dataform-controls/utils/validated-input.js +76 -0
  171. package/build-module/dataform-controls/utils/validated-input.js.map +1 -0
  172. package/build-module/dataforms-layouts/card/index.js +6 -7
  173. package/build-module/dataforms-layouts/card/index.js.map +1 -1
  174. package/build-module/dataforms-layouts/data-form-layout.js +14 -4
  175. package/build-module/dataforms-layouts/data-form-layout.js.map +1 -1
  176. package/build-module/dataforms-layouts/index.js +32 -1
  177. package/build-module/dataforms-layouts/index.js.map +1 -1
  178. package/build-module/dataforms-layouts/panel/dropdown.js +10 -15
  179. package/build-module/dataforms-layouts/panel/dropdown.js.map +1 -1
  180. package/build-module/dataforms-layouts/panel/index.js +24 -11
  181. package/build-module/dataforms-layouts/panel/index.js.map +1 -1
  182. package/build-module/dataforms-layouts/panel/modal.js +22 -28
  183. package/build-module/dataforms-layouts/panel/modal.js.map +1 -1
  184. package/build-module/dataforms-layouts/panel/summary-button.js +60 -0
  185. package/build-module/dataforms-layouts/panel/summary-button.js.map +1 -0
  186. package/build-module/dataforms-layouts/regular/index.js +8 -10
  187. package/build-module/dataforms-layouts/regular/index.js.map +1 -1
  188. package/build-module/dataforms-layouts/row/index.js +106 -0
  189. package/build-module/dataforms-layouts/row/index.js.map +1 -0
  190. package/build-module/dataviews-layouts/grid/index.js +22 -27
  191. package/build-module/dataviews-layouts/grid/index.js.map +1 -1
  192. package/build-module/dataviews-layouts/index.js +10 -2
  193. package/build-module/dataviews-layouts/index.js.map +1 -1
  194. package/build-module/dataviews-layouts/list/index.js +48 -3
  195. package/build-module/dataviews-layouts/list/index.js.map +1 -1
  196. package/build-module/dataviews-layouts/picker-grid/index.js +338 -0
  197. package/build-module/dataviews-layouts/picker-grid/index.js.map +1 -0
  198. package/build-module/dataviews-layouts/table/index.js +5 -17
  199. package/build-module/dataviews-layouts/table/index.js.map +1 -1
  200. package/build-module/dataviews-layouts/utils/get-data-by-group.js +17 -0
  201. package/build-module/dataviews-layouts/utils/get-data-by-group.js.map +1 -0
  202. package/build-module/dataviews-layouts/utils/grid-items.js +29 -0
  203. package/build-module/dataviews-layouts/utils/grid-items.js.map +1 -0
  204. package/build-module/dataviews-layouts/utils/preview-size-picker.js +73 -0
  205. package/build-module/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
  206. package/build-module/field-types/boolean.js +1 -1
  207. package/build-module/field-types/boolean.js.map +1 -1
  208. package/build-module/field-types/color.js +107 -0
  209. package/build-module/field-types/color.js.map +1 -0
  210. package/build-module/field-types/index.js +16 -0
  211. package/build-module/field-types/index.js.map +1 -1
  212. package/build-module/field-types/password.js +46 -0
  213. package/build-module/field-types/password.js.map +1 -0
  214. package/build-module/field-types/telephone.js +51 -0
  215. package/build-module/field-types/telephone.js.map +1 -0
  216. package/build-module/field-types/url.js +51 -0
  217. package/build-module/field-types/url.js.map +1 -0
  218. package/build-module/normalize-fields.js +15 -0
  219. package/build-module/normalize-fields.js.map +1 -1
  220. package/build-module/normalize-form-fields.js +6 -0
  221. package/build-module/normalize-form-fields.js.map +1 -1
  222. package/build-module/types.js.map +1 -1
  223. package/build-module/validation.js +1 -1
  224. package/build-module/validation.js.map +1 -1
  225. package/build-style/style-rtl.css +261 -18
  226. package/build-style/style.css +261 -18
  227. package/build-types/components/dataform/stories/index.story.d.ts +21 -17
  228. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
  229. package/build-types/components/dataform-context/index.d.ts.map +1 -1
  230. package/build-types/components/dataviews/index.d.ts +1 -1
  231. package/build-types/components/dataviews/index.d.ts.map +1 -1
  232. package/build-types/components/dataviews/stories/fixtures.d.ts +4 -2
  233. package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
  234. package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
  235. package/build-types/components/dataviews-context/index.d.ts +1 -0
  236. package/build-types/components/dataviews-context/index.d.ts.map +1 -1
  237. package/build-types/components/dataviews-filters/input-widget.d.ts.map +1 -1
  238. package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
  239. package/build-types/components/dataviews-picker/footer.d.ts +4 -0
  240. package/build-types/components/dataviews-picker/footer.d.ts.map +1 -0
  241. package/build-types/components/dataviews-picker/index.d.ts +55 -0
  242. package/build-types/components/dataviews-picker/index.d.ts.map +1 -0
  243. package/build-types/components/dataviews-picker/stories/index.story.d.ts +42 -0
  244. package/build-types/components/dataviews-picker/stories/index.story.d.ts.map +1 -0
  245. package/build-types/components/dataviews-selection-checkbox/index.d.ts +2 -1
  246. package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -1
  247. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
  248. package/build-types/constants.d.ts +1 -0
  249. package/build-types/constants.d.ts.map +1 -1
  250. package/build-types/dataform-controls/array.d.ts.map +1 -1
  251. package/build-types/dataform-controls/checkbox.d.ts.map +1 -1
  252. package/build-types/dataform-controls/color.d.ts +6 -0
  253. package/build-types/dataform-controls/color.d.ts.map +1 -0
  254. package/build-types/dataform-controls/date.d.ts.map +1 -1
  255. package/build-types/dataform-controls/datetime.d.ts.map +1 -1
  256. package/build-types/dataform-controls/email.d.ts.map +1 -1
  257. package/build-types/dataform-controls/index.d.ts +1 -1
  258. package/build-types/dataform-controls/index.d.ts.map +1 -1
  259. package/build-types/dataform-controls/integer.d.ts.map +1 -1
  260. package/build-types/dataform-controls/password.d.ts +3 -0
  261. package/build-types/dataform-controls/password.d.ts.map +1 -0
  262. package/build-types/dataform-controls/radio.d.ts.map +1 -1
  263. package/build-types/dataform-controls/relative-date-control.d.ts +6 -5
  264. package/build-types/dataform-controls/relative-date-control.d.ts.map +1 -1
  265. package/build-types/dataform-controls/select.d.ts.map +1 -1
  266. package/build-types/dataform-controls/telephone.d.ts +6 -0
  267. package/build-types/dataform-controls/telephone.d.ts.map +1 -0
  268. package/build-types/dataform-controls/text.d.ts +1 -1
  269. package/build-types/dataform-controls/text.d.ts.map +1 -1
  270. package/build-types/dataform-controls/textarea.d.ts +6 -0
  271. package/build-types/dataform-controls/textarea.d.ts.map +1 -0
  272. package/build-types/dataform-controls/toggle-group.d.ts.map +1 -1
  273. package/build-types/dataform-controls/toggle.d.ts +6 -0
  274. package/build-types/dataform-controls/toggle.d.ts.map +1 -0
  275. package/build-types/dataform-controls/url.d.ts +6 -0
  276. package/build-types/dataform-controls/url.d.ts.map +1 -0
  277. package/build-types/dataform-controls/utils/validated-input.d.ts +20 -0
  278. package/build-types/dataform-controls/utils/validated-input.d.ts.map +1 -0
  279. package/build-types/dataforms-layouts/card/index.d.ts +0 -3
  280. package/build-types/dataforms-layouts/card/index.d.ts.map +1 -1
  281. package/build-types/dataforms-layouts/data-form-layout.d.ts +4 -1
  282. package/build-types/dataforms-layouts/data-form-layout.d.ts.map +1 -1
  283. package/build-types/dataforms-layouts/index.d.ts +10 -0
  284. package/build-types/dataforms-layouts/index.d.ts.map +1 -1
  285. package/build-types/dataforms-layouts/panel/dropdown.d.ts +2 -1
  286. package/build-types/dataforms-layouts/panel/dropdown.d.ts.map +1 -1
  287. package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -1
  288. package/build-types/dataforms-layouts/panel/modal.d.ts +2 -1
  289. package/build-types/dataforms-layouts/panel/modal.d.ts.map +1 -1
  290. package/build-types/dataforms-layouts/panel/summary-button.d.ts +15 -0
  291. package/build-types/dataforms-layouts/panel/summary-button.d.ts.map +1 -0
  292. package/build-types/dataforms-layouts/regular/index.d.ts.map +1 -1
  293. package/build-types/dataforms-layouts/row/index.d.ts +6 -0
  294. package/build-types/dataforms-layouts/row/index.d.ts.map +1 -0
  295. package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
  296. package/build-types/dataviews-layouts/index.d.ts +12 -1
  297. package/build-types/dataviews-layouts/index.d.ts.map +1 -1
  298. package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
  299. package/build-types/dataviews-layouts/picker-grid/index.d.ts +4 -0
  300. package/build-types/dataviews-layouts/picker-grid/index.d.ts.map +1 -0
  301. package/build-types/dataviews-layouts/table/index.d.ts.map +1 -1
  302. package/build-types/dataviews-layouts/utils/get-data-by-group.d.ts +6 -0
  303. package/build-types/dataviews-layouts/utils/get-data-by-group.d.ts.map +1 -0
  304. package/build-types/dataviews-layouts/utils/grid-items.d.ts +5 -0
  305. package/build-types/dataviews-layouts/utils/grid-items.d.ts.map +1 -0
  306. package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts +2 -0
  307. package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts.map +1 -0
  308. package/build-types/field-types/color.d.ts +20 -0
  309. package/build-types/field-types/color.d.ts.map +1 -0
  310. package/build-types/field-types/index.d.ts.map +1 -1
  311. package/build-types/field-types/password.d.ts +17 -0
  312. package/build-types/field-types/password.d.ts.map +1 -0
  313. package/build-types/field-types/stories/index.story.d.ts +85 -0
  314. package/build-types/field-types/stories/index.story.d.ts.map +1 -0
  315. package/build-types/field-types/telephone.d.ts +20 -0
  316. package/build-types/field-types/telephone.d.ts.map +1 -0
  317. package/build-types/field-types/url.d.ts +20 -0
  318. package/build-types/field-types/url.d.ts.map +1 -0
  319. package/build-types/normalize-fields.d.ts +3 -0
  320. package/build-types/normalize-fields.d.ts.map +1 -1
  321. package/build-types/normalize-form-fields.d.ts.map +1 -1
  322. package/build-types/test/dataviews-picker.d.ts +2 -0
  323. package/build-types/test/dataviews-picker.d.ts.map +1 -0
  324. package/build-types/types.d.ts +102 -8
  325. package/build-types/types.d.ts.map +1 -1
  326. package/build-types/validation.d.ts.map +1 -1
  327. package/build-wp/index.js +6380 -5012
  328. package/package.json +17 -15
  329. package/src/components/dataform/stories/index.story.tsx +822 -28
  330. package/src/components/dataform-context/index.tsx +1 -0
  331. package/src/components/dataviews/index.tsx +25 -1
  332. package/src/components/dataviews/stories/fixtures.tsx +100 -42
  333. package/src/components/dataviews/stories/index.story.tsx +16 -2
  334. package/src/components/dataviews/style.scss +4 -2
  335. package/src/components/dataviews-context/index.ts +3 -0
  336. package/src/components/dataviews-filters/input-widget.tsx +44 -5
  337. package/src/components/dataviews-layout/index.tsx +5 -3
  338. package/src/components/dataviews-picker/footer.tsx +207 -0
  339. package/src/components/dataviews-picker/index.tsx +284 -0
  340. package/src/components/dataviews-picker/stories/index.story.tsx +251 -0
  341. package/src/components/dataviews-picker/style.scss +10 -0
  342. package/src/components/dataviews-selection-checkbox/index.tsx +3 -0
  343. package/src/components/dataviews-view-config/index.tsx +1 -0
  344. package/src/constants.ts +3 -0
  345. package/src/dataform-controls/array.tsx +4 -6
  346. package/src/dataform-controls/checkbox.tsx +54 -7
  347. package/src/dataform-controls/color.tsx +148 -0
  348. package/src/dataform-controls/date.tsx +47 -21
  349. package/src/dataform-controls/datetime.tsx +171 -23
  350. package/src/dataform-controls/email.tsx +18 -52
  351. package/src/dataform-controls/index.tsx +38 -2
  352. package/src/dataform-controls/integer.tsx +82 -49
  353. package/src/dataform-controls/password.tsx +50 -0
  354. package/src/dataform-controls/radio.tsx +53 -11
  355. package/src/dataform-controls/relative-date-control.tsx +11 -10
  356. package/src/dataform-controls/select.tsx +53 -10
  357. package/src/dataform-controls/telephone.tsx +38 -0
  358. package/src/dataform-controls/text.tsx +12 -50
  359. package/src/dataform-controls/textarea.tsx +85 -0
  360. package/src/dataform-controls/toggle-group.tsx +50 -10
  361. package/src/dataform-controls/toggle.tsx +79 -0
  362. package/src/dataform-controls/url.tsx +38 -0
  363. package/src/dataform-controls/utils/validated-input.tsx +109 -0
  364. package/src/dataforms-layouts/card/index.tsx +5 -4
  365. package/src/dataforms-layouts/card/style.scss +7 -0
  366. package/src/dataforms-layouts/data-form-layout.tsx +15 -3
  367. package/src/dataforms-layouts/index.tsx +35 -0
  368. package/src/dataforms-layouts/panel/dropdown.tsx +12 -23
  369. package/src/dataforms-layouts/panel/index.tsx +39 -16
  370. package/src/dataforms-layouts/panel/modal.tsx +24 -30
  371. package/src/dataforms-layouts/panel/summary-button.tsx +92 -0
  372. package/src/dataforms-layouts/regular/index.tsx +9 -7
  373. package/src/dataforms-layouts/regular/style.scss +0 -6
  374. package/src/dataforms-layouts/row/index.tsx +115 -0
  375. package/src/dataforms-layouts/row/style.scss +3 -0
  376. package/src/dataviews-layouts/grid/index.tsx +47 -47
  377. package/src/dataviews-layouts/grid/style.scss +43 -20
  378. package/src/dataviews-layouts/index.ts +16 -2
  379. package/src/dataviews-layouts/list/index.tsx +74 -2
  380. package/src/dataviews-layouts/list/style.scss +8 -0
  381. package/src/dataviews-layouts/picker-grid/index.tsx +486 -0
  382. package/src/dataviews-layouts/picker-grid/style.scss +171 -0
  383. package/src/dataviews-layouts/table/index.tsx +10 -14
  384. package/src/dataviews-layouts/utils/get-data-by-group.ts +18 -0
  385. package/src/dataviews-layouts/utils/grid-items.scss +21 -0
  386. package/src/dataviews-layouts/utils/grid-items.tsx +35 -0
  387. package/src/dataviews-layouts/utils/preview-size-picker.tsx +87 -0
  388. package/src/field-types/boolean.tsx +1 -1
  389. package/src/field-types/color.tsx +115 -0
  390. package/src/field-types/index.tsx +20 -0
  391. package/src/field-types/password.tsx +46 -0
  392. package/src/field-types/stories/index.story.tsx +856 -0
  393. package/src/field-types/telephone.tsx +71 -0
  394. package/src/field-types/url.tsx +71 -0
  395. package/src/normalize-fields.ts +18 -0
  396. package/src/normalize-form-fields.ts +6 -0
  397. package/src/style.scss +4 -0
  398. package/src/test/dataform.tsx +2 -2
  399. package/src/test/dataviews-picker.tsx +478 -0
  400. package/src/test/dataviews.tsx +86 -0
  401. package/src/test/filter-and-sort-data-view.js +148 -138
  402. package/src/test/normalize-fields.ts +114 -0
  403. package/src/types.ts +130 -7
  404. package/src/validation.ts +5 -0
  405. package/tsconfig.tsbuildinfo +1 -1
  406. package/build/dataform-controls/boolean.js +0 -64
  407. package/build/dataform-controls/boolean.js.map +0 -1
  408. package/build-module/dataform-controls/boolean.js +0 -58
  409. package/build-module/dataform-controls/boolean.js.map +0 -1
  410. package/build-types/components/stories/index.story.d.ts +0 -63
  411. package/build-types/components/stories/index.story.d.ts.map +0 -1
  412. package/build-types/dataform-controls/boolean.d.ts +0 -6
  413. package/build-types/dataform-controls/boolean.d.ts.map +0 -1
  414. package/src/components/stories/index.story.tsx +0 -372
  415. package/src/dataform-controls/boolean.tsx +0 -61
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import { renderFromElements } from '../utils';
11
+ import { OPERATOR_IS, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL, OPERATOR_IS_ANY, OPERATOR_IS_NONE, OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH } from '../constants';
12
+ function sort(valueA, valueB, direction) {
13
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
14
+ }
15
+ export default {
16
+ sort,
17
+ isValid: {
18
+ custom: (item, field) => {
19
+ const value = field.getValue({
20
+ item
21
+ });
22
+ if (field?.elements) {
23
+ const validValues = field.elements.map(f => f.value);
24
+ if (!validValues.includes(value)) {
25
+ return __('Value must be one of the elements.');
26
+ }
27
+ }
28
+ return null;
29
+ }
30
+ },
31
+ Edit: 'telephone',
32
+ render: ({
33
+ item,
34
+ field
35
+ }) => {
36
+ return field.elements ? renderFromElements({
37
+ item,
38
+ field
39
+ }) : field.getValue({
40
+ item
41
+ });
42
+ },
43
+ enableSorting: true,
44
+ filterBy: {
45
+ defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
46
+ validOperators: [OPERATOR_IS, OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH,
47
+ // Multiple selection
48
+ OPERATOR_IS_ANY, OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL]
49
+ }
50
+ };
51
+ //# sourceMappingURL=telephone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","renderFromElements","OPERATOR_IS","OPERATOR_IS_ALL","OPERATOR_IS_NOT_ALL","OPERATOR_IS_ANY","OPERATOR_IS_NONE","OPERATOR_IS_NOT","OPERATOR_CONTAINS","OPERATOR_NOT_CONTAINS","OPERATOR_STARTS_WITH","sort","valueA","valueB","direction","localeCompare","isValid","custom","item","field","value","getValue","elements","validValues","map","f","includes","Edit","render","enableSorting","filterBy","defaultOperators","validOperators"],"sources":["@wordpress/dataviews/src/field-types/telephone.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tDataViewRenderFieldProps,\n\tSortDirection,\n\tNormalizedField,\n\tFieldTypeDefinition,\n} from '../types';\nimport { renderFromElements } from '../utils';\nimport {\n\tOPERATOR_IS,\n\tOPERATOR_IS_ALL,\n\tOPERATOR_IS_NOT_ALL,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tOPERATOR_IS_NOT,\n\tOPERATOR_CONTAINS,\n\tOPERATOR_NOT_CONTAINS,\n\tOPERATOR_STARTS_WITH,\n} from '../constants';\n\nfunction sort( valueA: any, valueB: any, direction: SortDirection ) {\n\treturn direction === 'asc'\n\t\t? valueA.localeCompare( valueB )\n\t\t: valueB.localeCompare( valueA );\n}\n\nexport default {\n\tsort,\n\tisValid: {\n\t\tcustom: ( item: any, field: NormalizedField< any > ) => {\n\t\t\tconst value = field.getValue( { item } );\n\t\t\tif ( field?.elements ) {\n\t\t\t\tconst validValues = field.elements.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn __( 'Value must be one of the elements.' );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t},\n\t},\n\tEdit: 'telephone',\n\trender: ( { item, field }: DataViewRenderFieldProps< any > ) => {\n\t\treturn field.elements\n\t\t\t? renderFromElements( { item, field } )\n\t\t\t: field.getValue( { item } );\n\t},\n\tenableSorting: true,\n\tfilterBy: {\n\t\tdefaultOperators: [ OPERATOR_IS_ANY, OPERATOR_IS_NONE ],\n\t\tvalidOperators: [\n\t\t\tOPERATOR_IS,\n\t\t\tOPERATOR_IS_NOT,\n\t\t\tOPERATOR_CONTAINS,\n\t\t\tOPERATOR_NOT_CONTAINS,\n\t\t\tOPERATOR_STARTS_WITH,\n\t\t\t// Multiple selection\n\t\t\tOPERATOR_IS_ANY,\n\t\t\tOPERATOR_IS_NONE,\n\t\t\tOPERATOR_IS_ALL,\n\t\t\tOPERATOR_IS_NOT_ALL,\n\t\t],\n\t},\n} satisfies FieldTypeDefinition< any >;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAOA,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SACCC,WAAW,EACXC,eAAe,EACfC,mBAAmB,EACnBC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,QACd,cAAc;AAErB,SAASC,IAAIA,CAA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+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import { renderFromElements } from '../utils';
11
+ import { OPERATOR_IS, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL, OPERATOR_IS_ANY, OPERATOR_IS_NONE, OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH } from '../constants';
12
+ function sort(valueA, valueB, direction) {
13
+ return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
14
+ }
15
+ export default {
16
+ sort,
17
+ isValid: {
18
+ custom: (item, field) => {
19
+ const value = field.getValue({
20
+ item
21
+ });
22
+ if (field?.elements) {
23
+ const validValues = field.elements.map(f => f.value);
24
+ if (!validValues.includes(value)) {
25
+ return __('Value must be one of the elements.');
26
+ }
27
+ }
28
+ return null;
29
+ }
30
+ },
31
+ Edit: 'url',
32
+ render: ({
33
+ item,
34
+ field
35
+ }) => {
36
+ return field.elements ? renderFromElements({
37
+ item,
38
+ field
39
+ }) : field.getValue({
40
+ item
41
+ });
42
+ },
43
+ enableSorting: true,
44
+ filterBy: {
45
+ defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
46
+ validOperators: [OPERATOR_IS, OPERATOR_IS_NOT, OPERATOR_CONTAINS, OPERATOR_NOT_CONTAINS, OPERATOR_STARTS_WITH,
47
+ // Multiple selection
48
+ OPERATOR_IS_ANY, OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL]
49
+ }
50
+ };
51
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","renderFromElements","OPERATOR_IS","OPERATOR_IS_ALL","OPERATOR_IS_NOT_ALL","OPERATOR_IS_ANY","OPERATOR_IS_NONE","OPERATOR_IS_NOT","OPERATOR_CONTAINS","OPERATOR_NOT_CONTAINS","OPERATOR_STARTS_WITH","sort","valueA","valueB","direction","localeCompare","isValid","custom","item","field","value","getValue","elements","validValues","map","f","includes","Edit","render","enableSorting","filterBy","defaultOperators","validOperators"],"sources":["@wordpress/dataviews/src/field-types/url.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tDataViewRenderFieldProps,\n\tSortDirection,\n\tNormalizedField,\n\tFieldTypeDefinition,\n} from '../types';\nimport { renderFromElements } from '../utils';\nimport {\n\tOPERATOR_IS,\n\tOPERATOR_IS_ALL,\n\tOPERATOR_IS_NOT_ALL,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tOPERATOR_IS_NOT,\n\tOPERATOR_CONTAINS,\n\tOPERATOR_NOT_CONTAINS,\n\tOPERATOR_STARTS_WITH,\n} from '../constants';\n\nfunction sort( valueA: any, valueB: any, direction: SortDirection ) {\n\treturn direction === 'asc'\n\t\t? valueA.localeCompare( valueB )\n\t\t: valueB.localeCompare( valueA );\n}\n\nexport default {\n\tsort,\n\tisValid: {\n\t\tcustom: ( item: any, field: NormalizedField< any > ) => {\n\t\t\tconst value = field.getValue( { item } );\n\t\t\tif ( field?.elements ) {\n\t\t\t\tconst validValues = field.elements.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn __( 'Value must be one of the elements.' );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null;\n\t\t},\n\t},\n\tEdit: 'url',\n\trender: ( { item, field }: DataViewRenderFieldProps< any > ) => {\n\t\treturn field.elements\n\t\t\t? renderFromElements( { item, field } )\n\t\t\t: field.getValue( { item } );\n\t},\n\tenableSorting: true,\n\tfilterBy: {\n\t\tdefaultOperators: [ OPERATOR_IS_ANY, OPERATOR_IS_NONE ],\n\t\tvalidOperators: [\n\t\t\tOPERATOR_IS,\n\t\t\tOPERATOR_IS_NOT,\n\t\t\tOPERATOR_CONTAINS,\n\t\t\tOPERATOR_NOT_CONTAINS,\n\t\t\tO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rB,kBAAkB,CAAE;MAAEiB,IAAI;MAAEC;IAAM,CAAE,CAAC,GACrCA,KAAK,CAACE,QAAQ,CAAE;MAAEH;IAAK,CAAE,CAAC;EAC9B,CAAC;EACDW,aAAa,EAAE,IAAI;EACnBC,QAAQ,EAAE;IACTC,gBAAgB,EAAE,CAAE1B,eAAe,EAAEC,gBAAgB,CAAE;IACvD0B,cAAc,EAAE,CACf9B,WAAW,EACXK,eAAe,EACfC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB;IACpB;IACAL,eAAe,EACfC,gBAAgB,EAChBH,eAAe,EACfC,mBAAmB;EAErB;AACD,CAAC","ignoreList":[]}
@@ -22,6 +22,19 @@ const getValueFromId = id => ({
22
22
  }
23
23
  return value;
24
24
  };
25
+ export const setValueFromId = id => ({
26
+ value
27
+ }) => {
28
+ const path = id.split('.');
29
+ const result = {};
30
+ let current = result;
31
+ for (const segment of path.slice(0, -1)) {
32
+ current[segment] = {};
33
+ current = current[segment];
34
+ }
35
+ current[path.at(-1)] = value;
36
+ return result;
37
+ };
25
38
  function getFilterBy(field, fieldTypeDefinition) {
26
39
  if (field.filterBy === false) {
27
40
  return false;
@@ -89,6 +102,7 @@ export function normalizeFields(fields) {
89
102
  var _field$sort, _field$render, _field$enableHiding, _ref, _field$enableSorting, _ref2, _field$readOnly;
90
103
  const fieldTypeDefinition = getFieldTypeDefinition(field.type);
91
104
  const getValue = field.getValue || getValueFromId(field.id);
105
+ const setValue = field.setValue || setValueFromId(field.id);
92
106
  const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) {
93
107
  return fieldTypeDefinition.sort(getValue({
94
108
  item: a
@@ -116,6 +130,7 @@ export function normalizeFields(fields) {
116
130
  label: field.label || field.id,
117
131
  header: field.header || field.label || field.id,
118
132
  getValue,
133
+ setValue,
119
134
  render,
120
135
  sort,
121
136
  isValid,
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldTypeDefinition","getControl","ALL_OPERATORS","OPERATOR_BETWEEN","SINGLE_SELECTION_OPERATORS","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","getFilterBy","field","fieldTypeDefinition","filterBy","operators","Array","isArray","defaultOperators","validOperators","filter","operator","includes","elements","hasSingleSelectionOperator","some","length","isPrimary","normalizeFields","fields","map","_field$sort","_field$render","_field$enableHiding","_ref","_field$enableSorting","_ref2","_field$readOnly","type","getValue","sort","a","b","direction","isValid","Edit","render","renderedField","label","header","enableHiding","enableSorting","readOnly"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { FunctionComponent } from 'react';\n\n/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type {\n\tDataViewRenderFieldProps,\n\tField,\n\tFieldTypeDefinition,\n\tNormalizedFilterByConfig,\n\tNormalizedField,\n} from './types';\nimport { getControl } from './dataform-controls';\nimport {\n\tALL_OPERATORS,\n\tOPERATOR_BETWEEN,\n\tSINGLE_SELECTION_OPERATORS,\n} from './constants';\n\nconst getValueFromId =\n\t( id: string ) =>\n\t( { item }: { item: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tlet value = item;\n\t\tfor ( const segment of path ) {\n\t\t\tif ( value.hasOwnProperty( segment ) ) {\n\t\t\t\tvalue = value[ segment ];\n\t\t\t} else {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n\nfunction getFilterBy< Item >(\n\tfield: Field< Item >,\n\tfieldTypeDefinition: FieldTypeDefinition< Item >\n): NormalizedFilterByConfig | false {\n\tif ( field.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof field.filterBy === 'object' ) {\n\t\tlet operators = field.filterBy.operators;\n\n\t\t// Assign default values if no operator was provided.\n\t\tif ( ! operators || ! Array.isArray( operators ) ) {\n\t\t\toperators = !! fieldTypeDefinition.filterBy\n\t\t\t\t? fieldTypeDefinition.filterBy.defaultOperators\n\t\t\t\t: [];\n\t\t}\n\n\t\t// Make sure only valid operators are included.\n\t\tlet validOperators = ALL_OPERATORS;\n\t\tif ( typeof fieldTypeDefinition.filterBy === 'object' ) {\n\t\t\tvalidOperators = fieldTypeDefinition.filterBy.validOperators;\n\t\t}\n\t\toperators = operators.filter( ( operator ) =>\n\t\t\tvalidOperators.includes( operator )\n\t\t);\n\n\t\t// The `between` operator is not supported when elements are provided.\n\t\tif ( field.elements && operators.includes( OPERATOR_BETWEEN ) ) {\n\t\t\toperators = operators.filter(\n\t\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t\t);\n\t\t}\n\n\t\t// Do not allow mixing single & multiselection operators.\n\t\t// Remove multiselection operators if any of the single selection ones is present.\n\t\tconst hasSingleSelectionOperator = operators.some( ( operator ) =>\n\t\t\tSINGLE_SELECTION_OPERATORS.includes( operator )\n\t\t);\n\t\tif ( hasSingleSelectionOperator ) {\n\t\t\toperators = operators.filter( ( operator ) =>\n\t\t\t\t// The 'Between' operator is unique as it can be combined with single selection operators.\n\t\t\t\t[ ...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN ].includes(\n\t\t\t\t\toperator\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t// If no operators are left at this point,\n\t\t// the filters should be disabled.\n\t\tif ( operators.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tisPrimary: !! field.filterBy.isPrimary,\n\t\t\toperators,\n\t\t};\n\t}\n\n\tif ( fieldTypeDefinition.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tlet defaultOperators = fieldTypeDefinition.filterBy.defaultOperators;\n\t// The `between` operator is not supported when elements are provided.\n\tif ( field.elements && defaultOperators.includes( OPERATOR_BETWEEN ) ) {\n\t\tdefaultOperators = defaultOperators.filter(\n\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t);\n\t}\n\n\treturn {\n\t\toperators: defaultOperators,\n\t};\n}\n\n/**\n * Apply default values and normalize the fields config.\n *\n * @param fields Fields config.\n * @return Normalized fields config.\n */\nexport function normalizeFields< Item >(\n\tfields: Field< Item >[]\n): NormalizedField< Item >[] {\n\treturn fields.map( ( field ) => {\n\t\tconst fieldTypeDefinition = getFieldTypeDefinition< Item >(\n\t\t\tfield.type\n\t\t);\n\t\tconst getValue = field.getValue || getValueFromId( field.id );\n\n\t\tconst sort =\n\t\t\tfield.sort ??\n\t\t\tfunction sort( a, b, direction ) {\n\t\t\t\treturn fieldTypeDefinition.sort(\n\t\t\t\t\tgetValue( { item: a } ),\n\t\t\t\t\tgetValue( { item: b } ),\n\t\t\t\t\tdirection\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst isValid = {\n\t\t\t...fieldTypeDefinition.isValid,\n\t\t\t...field.isValid,\n\t\t};\n\n\t\tconst Edit = getControl( field, fieldTypeDefinition );\n\n\t\tconst render =\n\t\t\tfield.render ??\n\t\t\tfunction render( {\n\t\t\t\titem,\n\t\t\t\tfield: renderedField,\n\t\t\t}: DataViewRenderFieldProps< Item > ) {\n\t\t\t\treturn (\n\t\t\t\t\tfieldTypeDefinition.render as FunctionComponent<\n\t\t\t\t\t\tDataViewRenderFieldProps< Item >\n\t\t\t\t\t>\n\t\t\t\t )( { item, field: renderedField } );\n\t\t\t};\n\n\t\tconst filterBy = getFilterBy( field, fieldTypeDefinition );\n\n\t\treturn {\n\t\t\t...field,\n\t\t\tlabel: field.label || field.id,\n\t\t\theader: field.header || field.label || field.id,\n\t\t\tgetValue,\n\t\t\trender,\n\t\t\tsort,\n\t\t\tisValid,\n\t\t\tEdit,\n\t\t\tenableHiding: field.enableHiding ?? true,\n\t\t\tenableSorting:\n\t\t\t\tfield.enableSorting ??\n\t\t\t\tfieldTypeDefinition.enableSorting ??\n\t\t\t\ttrue,\n\t\t\tfilterBy,\n\t\t\treadOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO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IrC,KAAK,CAACoC,KAAK,IAAIpC,KAAK,CAACT,EAAE;MAC/CoC,QAAQ;MACRO,MAAM;MACNN,IAAI;MACJI,OAAO;MACPC,IAAI;MACJK,YAAY,GAAAjB,mBAAA,GAAErB,KAAK,CAACsC,YAAY,cAAAjB,mBAAA,cAAAA,mBAAA,GAAI,IAAI;MACxCkB,aAAa,GAAAjB,IAAA,IAAAC,oBAAA,GACZvB,KAAK,CAACuC,aAAa,cAAAhB,oBAAA,cAAAA,oBAAA,GACnBtB,mBAAmB,CAACsC,aAAa,cAAAjB,IAAA,cAAAA,IAAA,GACjC,IAAI;MACLpB,QAAQ;MACRsC,QAAQ,GAAAhB,KAAA,IAAAC,eAAA,GAAEzB,KAAK,CAACwC,QAAQ,cAAAf,eAAA,cAAAA,eAAA,GAAIxB,mBAAmB,CAACuC,QAAQ,cAAAhB,KAAA,cAAAA,KAAA,GAAI;IAC7D,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["getFieldTypeDefinition","getControl","ALL_OPERATORS","OPERATOR_BETWEEN","SINGLE_SELECTION_OPERATORS","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","setValueFromId","result","current","slice","at","getFilterBy","field","fieldTypeDefinition","filterBy","operators","Array","isArray","defaultOperators","validOperators","filter","operator","includes","elements","hasSingleSelectionOperator","some","length","isPrimary","normalizeFields","fields","map","_field$sort","_field$render","_field$enableHiding","_ref","_field$enableSorting","_ref2","_field$readOnly","type","getValue","setValue","sort","a","b","direction","isValid","Edit","render","renderedField","label","header","enableHiding","enableSorting","readOnly"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { FunctionComponent } from 'react';\n\n/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type {\n\tDataViewRenderFieldProps,\n\tField,\n\tFieldTypeDefinition,\n\tNormalizedFilterByConfig,\n\tNormalizedField,\n} from './types';\nimport { getControl } from './dataform-controls';\nimport {\n\tALL_OPERATORS,\n\tOPERATOR_BETWEEN,\n\tSINGLE_SELECTION_OPERATORS,\n} from './constants';\n\nconst getValueFromId =\n\t( id: string ) =>\n\t( { item }: { item: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tlet value = item;\n\t\tfor ( const segment of path ) {\n\t\t\tif ( value.hasOwnProperty( segment ) ) {\n\t\t\t\tvalue = value[ segment ];\n\t\t\t} else {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n\nexport const setValueFromId =\n\t( id: string ) =>\n\t( { value }: { value: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tconst result: any = {};\n\t\tlet current = result;\n\n\t\tfor ( const segment of path.slice( 0, -1 ) ) {\n\t\t\tcurrent[ segment ] = {};\n\t\t\tcurrent = current[ segment ];\n\t\t}\n\n\t\tcurrent[ path.at( -1 )! ] = value;\n\t\treturn result;\n\t};\n\nfunction getFilterBy< Item >(\n\tfield: Field< Item >,\n\tfieldTypeDefinition: FieldTypeDefinition< Item >\n): NormalizedFilterByConfig | false {\n\tif ( field.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof field.filterBy === 'object' ) {\n\t\tlet operators = field.filterBy.operators;\n\n\t\t// Assign default values if no operator was provided.\n\t\tif ( ! operators || ! Array.isArray( operators ) ) {\n\t\t\toperators = !! fieldTypeDefinition.filterBy\n\t\t\t\t? fieldTypeDefinition.filterBy.defaultOperators\n\t\t\t\t: [];\n\t\t}\n\n\t\t// Make sure only valid operators are included.\n\t\tlet validOperators = ALL_OPERATORS;\n\t\tif ( typeof fieldTypeDefinition.filterBy === 'object' ) {\n\t\t\tvalidOperators = fieldTypeDefinition.filterBy.validOperators;\n\t\t}\n\t\toperators = operators.filter( ( operator ) =>\n\t\t\tvalidOperators.includes( operator )\n\t\t);\n\n\t\t// The `between` operator is not supported when elements are provided.\n\t\tif ( field.elements && operators.includes( OPERATOR_BETWEEN ) ) {\n\t\t\toperators = operators.filter(\n\t\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t\t);\n\t\t}\n\n\t\t// Do not allow mixing single & multiselection operators.\n\t\t// Remove multiselection operators if any of the single selection ones is present.\n\t\tconst hasSingleSelectionOperator = operators.some( ( operator ) =>\n\t\t\tSINGLE_SELECTION_OPERATORS.includes( operator )\n\t\t);\n\t\tif ( hasSingleSelectionOperator ) {\n\t\t\toperators = operators.filter( ( operator ) =>\n\t\t\t\t// The 'Between' operator is unique as it can be combined with single selection operators.\n\t\t\t\t[ ...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN ].includes(\n\t\t\t\t\toperator\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t// If no operators are left at this point,\n\t\t// the filters should be disabled.\n\t\tif ( operators.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tisPrimary: !! field.filterBy.isPrimary,\n\t\t\toperators,\n\t\t};\n\t}\n\n\tif ( fieldTypeDefinition.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tlet defaultOperators = fieldTypeDefinition.filterBy.defaultOperators;\n\t// The `between` operator is not supported when elements are provided.\n\tif ( field.elements && defaultOperators.includes( OPERATOR_BETWEEN ) ) {\n\t\tdefaultOperators = defaultOperators.filter(\n\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t);\n\t}\n\n\treturn {\n\t\toperators: defaultOperators,\n\t};\n}\n\n/**\n * Apply default values and normalize the fields config.\n *\n * @param fields Fields config.\n * @return Normalized fields config.\n */\nexport function normalizeFields< Item >(\n\tfields: Field< Item >[]\n): NormalizedField< Item >[] {\n\treturn fields.map( ( field ) => {\n\t\tconst fieldTypeDefinition = getFieldTypeDefinition< Item >(\n\t\t\tfield.type\n\t\t);\n\t\tconst getValue = field.getValue || getValueFromId( field.id );\n\t\tconst setValue = field.setValue || setValueFromId( field.id );\n\n\t\tconst sort =\n\t\t\tfield.sort ??\n\t\t\tfunction sort( a, b, direction ) {\n\t\t\t\treturn fieldTypeDefinition.sort(\n\t\t\t\t\tgetValue( { item: a } ),\n\t\t\t\t\tgetValue( { item: b } ),\n\t\t\t\t\tdirection\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst isValid = {\n\t\t\t...fieldTypeDefinition.isValid,\n\t\t\t...field.isValid,\n\t\t};\n\n\t\tconst Edit = getControl( field, fieldTypeDefinition );\n\n\t\tconst render =\n\t\t\tfield.render ??\n\t\t\tfunction render( {\n\t\t\t\titem,\n\t\t\t\tfield: renderedField,\n\t\t\t}: DataViewRenderFieldProps< Item > ) {\n\t\t\t\treturn (\n\t\t\t\t\tfieldTypeDefinition.render as FunctionComponent<\n\t\t\t\t\t\tDataViewRenderFieldProps< Item >\n\t\t\t\t\t>\n\t\t\t\t )( { item, field: renderedField } );\n\t\t\t};\n\n\t\tconst filterBy = getFilterBy( field, fieldTypeDefinition );\n\n\t\treturn {\n\t\t\t...field,\n\t\t\tlabel: field.label || field.id,\n\t\t\theader: field.header || field.label || field.id,\n\t\t\tgetValue,\n\t\t\tsetValue,\n\t\t\trender,\n\t\t\tsort,\n\t\t\tisValid,\n\t\t\tEdit,\n\t\t\tenableHiding: field.enableHiding ?? true,\n\t\t\tenableSorting:\n\t\t\t\tfield.enableSorting ??\n\t\t\t\tfieldTypeDefinition.enableSorting ??\n\t\t\t\ttrue,\n\t\t\tfilterBy,\n\t\t\treadOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAQlD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SACCC,aAAa,EACbC,gBAAgB,EAChBC,0BAA0B,QACpB,aAAa;AAEpB,MAAMC,cAAc,GACjBC,EAAU,IACZ,CAAE;EAAEC;AAAoB,CAAC,KAAM;EAC9B,MAAMC,IAAI,GAAGF,EAAE,CAACG,KAAK,CAAE,GAAI,CAAC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hD,IAAI;MACJa,KAAK,EAAEoC;IAC0B,CAAC,EAAG;MACrC,OACCnC,mBAAmB,CAACkC,MAAM,CAGvB;QAAEhD,IAAI;QAAEa,KAAK,EAAEoC;MAAc,CAAE,CAAC;IACrC,CAAC;IAEF,MAAMlC,QAAQ,GAAGH,WAAW,CAAEC,KAAK,EAAEC,mBAAoB,CAAC;IAE1D,OAAO;MACN,GAAGD,KAAK;MACRqC,KAAK,EAAErC,KAAK,CAACqC,KAAK,IAAIrC,KAAK,CAACd,EAAE;MAC9BoD,MAAM,EAAEtC,KAAK,CAACsC,MAAM,IAAItC,KAAK,CAACqC,KAAK,IAAIrC,KAAK,CAACd,EAAE;MAC/CyC,QAAQ;MACRC,QAAQ;MACRO,MAAM;MACNN,IAAI;MACJI,OAAO;MACPC,IAAI;MACJK,YAAY,GAAAlB,mBAAA,GAAErB,KAAK,CAACuC,YAAY,cAAAlB,mBAAA,cAAAA,mBAAA,GAAI,IAAI;MACxCmB,aAAa,GAAAlB,IAAA,IAAAC,oBAAA,GACZvB,KAAK,CAACwC,aAAa,cAAAjB,oBAAA,cAAAA,oBAAA,GACnBtB,mBAAmB,CAACuC,aAAa,cAAAlB,IAAA,cAAAA,IAAA,GACjC,IAAI;MACLpB,QAAQ;MACRuC,QAAQ,GAAAjB,KAAA,IAAAC,eAAA,GAAEzB,KAAK,CAACyC,QAAQ,cAAAhB,eAAA,cAAAA,eAAA,GAAIxB,mBAAmB,CAACwC,QAAQ,cAAAjB,KAAA,cAAAA,KAAA,GAAI;IAC7D,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -44,6 +44,12 @@ export function normalizeLayout(layout) {
44
44
  isOpened: typeof layout.isOpened === 'boolean' ? layout.isOpened : true
45
45
  };
46
46
  }
47
+ } else if (layout?.type === 'row') {
48
+ var _layout$alignment;
49
+ normalizedLayout = {
50
+ type: 'row',
51
+ alignment: (_layout$alignment = layout?.alignment) !== null && _layout$alignment !== void 0 ? _layout$alignment : 'center'
52
+ };
47
53
  }
48
54
  return normalizedLayout;
49
55
  }
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_LAYOUT","type","labelPosition","normalizeLayout","layout","normalizedLayout","_layout$labelPosition","_layout$labelPosition2","_layout$openAs","openAs","withHeader","isOpened","normalizeFormFields","form","_form$fields","formLayout","fields","map","field","id","fieldLayout"],"sources":["@wordpress/dataviews/src/normalize-form-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tForm,\n\tLayout,\n\tNormalizedLayout,\n\tNormalizedRegularLayout,\n\tNormalizedPanelLayout,\n\tNormalizedCardLayout,\n} from './types';\n\ninterface NormalizedFormField {\n\tid: string;\n\tlayout: Layout;\n}\n\nexport const DEFAULT_LAYOUT: NormalizedLayout = {\n\ttype: 'regular',\n\tlabelPosition: 'top',\n};\n\n/**\n * Normalizes a layout configuration based on its type.\n *\n * @param layout The layout object to normalize.\n * @return The normalized layout object.\n */\nexport function normalizeLayout( layout?: Layout ): NormalizedLayout {\n\tlet normalizedLayout = DEFAULT_LAYOUT;\n\n\tif ( layout?.type === 'regular' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'regular',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'top',\n\t\t} satisfies NormalizedRegularLayout;\n\t} else if ( layout?.type === 'panel' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'panel',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'side',\n\t\t\topenAs: layout?.openAs ?? 'dropdown',\n\t\t} satisfies NormalizedPanelLayout;\n\t} else if ( layout?.type === 'card' ) {\n\t\tif ( layout.withHeader === false ) {\n\t\t\t// Don't let isOpened be false if withHeader is false.\n\t\t\t// Otherwise, the card will not be visible.\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: false,\n\t\t\t\tisOpened: true,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t} else {\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: true,\n\t\t\t\tisOpened:\n\t\t\t\t\ttypeof layout.isOpened === 'boolean'\n\t\t\t\t\t\t? layout.isOpened\n\t\t\t\t\t\t: true,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t}\n\t}\n\n\treturn normalizedLayout;\n}\n\nexport default function normalizeFormFields(\n\tform: Form\n): NormalizedFormField[] {\n\tconst formLayout = normalizeLayout( form?.layout );\n\n\treturn ( form.fields ?? [] ).map( ( field ) => {\n\t\tif ( typeof field === 'string' ) {\n\t\t\treturn {\n\t\t\t\tid: field,\n\t\t\t\tlayout: formLayout,\n\t\t\t};\n\t\t}\n\n\t\tconst fieldLayout = field.layout\n\t\t\t? normalizeLayout( field.layout )\n\t\t\t: formLayout;\n\t\treturn {\n\t\t\t...field,\n\t\t\tlayout: fieldLayout,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAeA,OAAO,MAAMA,cAAgC,GAAG;EAC/CC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAEC,MAAe,EAAqB;EACpE,IAAIC,gBAAgB,GAAGL,cAAc;EAErC,IAAKI,MAAM,EAAEH,IAAI,KAAK,SAAS,EAAG;IAAA,IAAAK,qBAAA;IACjCD,gBAAgB,GAAG;MAClBJ,IAAI,EAAE,SAAS;MACfC,aAAa,GAAAI,qBAAA,GAAEF,MAAM,EAAEF,aAAa,cAAAI,qBAAA,cAAAA,qBAAA,GAAI;IACzC,CAAmC;EACpC,CAAC,MAAM,IAAKF,MAAM,EAAEH,IAAI,KAAK,OAAO,EAAG;IAAA,IAAAM,sBAAA,EAAAC,cAAA;IACtCH,gBAAgB,GAAG;MAClBJ,IAAI,EAAE,OAAO;MACbC,aAAa,GAAAK,sBAAA,GAAEH,MAAM,EAAEF,aAAa,cAAAK,sBAAA,cAAAA,sBAAA,GAAI,MAAM;MAC9CE,MAAM,GAAAD,cAAA,GAAEJ,MAAM,EAAEK,MAAM,cAAAD,cAAA,cAAAA,cAAA,GAAI;IAC3B,CAAiC;EAClC,CAAC,MAAM,IAAKJ,MAAM,EAAEH,IAAI,KAAK,MAAM,EAAG;IACrC,IAAKG,MAAM,CAACM,UAAU,KAAK,KAAK,EAAG;MAClC;MACA;MACAL,gBAAgB,GAAG;QAClBJ,IAAI,EAAE,MAAM;QACZS,UAAU,EAAE,KAAK;QACjBC,QAAQ,EAAE;MACX,CAAgC;IACjC,CAAC,MAAM;MACNN,gBAAgB,GAAG;QAClBJ,IAAI,EAAE,MAAM;QACZS,UAAU,EAAE,IAAI;QAChBC,QAAQ,EACP,OAAOP,MAAM,CAACO,QAAQ,KAAK,SAAS,GACjCP,MAAM,CAACO,QAAQ,GACf;MACL,CAAgC;IACjC;EACD;EAEA,OAAON,gBAAgB;AACxB;AAEA,eAAe,SAASO,mBAAmBA,CAC1CC,IAAU,EACc;EAAA,IAAAC,YAAA;EACxB,MAAMC,UAAU,GAAGZ,eAAe,CAAEU,IAAI,EAAET,MAAO,CAAC;EAElD,OAAO,EAAAU,YAAA,GAAED,IAAI,CAACG,MAAM,cAAAF,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAGG,GAAG,CAAIC,KAAK,IAAM;IAC9C,IAAK,OAAOA,KAAK,KAAK,QAAQ,EAAG;MAChC,OAAO;QACNC,EAAE,EAAED,KAAK;QACTd,MAAM,EAAEW;MACT,CAAC;IACF;IAEA,MAAMK,WAAW,GAAGF,KAAK,CAACd,MAAM,GAC7BD,eAAe,CAAEe,KAAK,CAACd,MAAO,CAAC,GAC/BW,UAAU;IACb,OAAO;MACN,GAAGG,KAAK;MACRd,MAAM,EAAEgB;IACT,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["DEFAULT_LAYOUT","type","labelPosition","normalizeLayout","layout","normalizedLayout","_layout$labelPosition","_layout$labelPosition2","_layout$openAs","openAs","withHeader","isOpened","_layout$alignment","alignment","normalizeFormFields","form","_form$fields","formLayout","fields","map","field","id","fieldLayout"],"sources":["@wordpress/dataviews/src/normalize-form-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tForm,\n\tLayout,\n\tNormalizedLayout,\n\tNormalizedRegularLayout,\n\tNormalizedPanelLayout,\n\tNormalizedCardLayout,\n\tNormalizedRowLayout,\n} from './types';\n\ninterface NormalizedFormField {\n\tid: string;\n\tlayout: Layout;\n}\n\nexport const DEFAULT_LAYOUT: NormalizedLayout = {\n\ttype: 'regular',\n\tlabelPosition: 'top',\n};\n\n/**\n * Normalizes a layout configuration based on its type.\n *\n * @param layout The layout object to normalize.\n * @return The normalized layout object.\n */\nexport function normalizeLayout( layout?: Layout ): NormalizedLayout {\n\tlet normalizedLayout = DEFAULT_LAYOUT;\n\n\tif ( layout?.type === 'regular' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'regular',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'top',\n\t\t} satisfies NormalizedRegularLayout;\n\t} else if ( layout?.type === 'panel' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'panel',\n\t\t\tlabelPosition: layout?.labelPosition ?? 'side',\n\t\t\topenAs: layout?.openAs ?? 'dropdown',\n\t\t} satisfies NormalizedPanelLayout;\n\t} else if ( layout?.type === 'card' ) {\n\t\tif ( layout.withHeader === false ) {\n\t\t\t// Don't let isOpened be false if withHeader is false.\n\t\t\t// Otherwise, the card will not be visible.\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: false,\n\t\t\t\tisOpened: true,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t} else {\n\t\t\tnormalizedLayout = {\n\t\t\t\ttype: 'card',\n\t\t\t\twithHeader: true,\n\t\t\t\tisOpened:\n\t\t\t\t\ttypeof layout.isOpened === 'boolean'\n\t\t\t\t\t\t? layout.isOpened\n\t\t\t\t\t\t: true,\n\t\t\t} satisfies NormalizedCardLayout;\n\t\t}\n\t} else if ( layout?.type === 'row' ) {\n\t\tnormalizedLayout = {\n\t\t\ttype: 'row',\n\t\t\talignment: layout?.alignment ?? 'center',\n\t\t} satisfies NormalizedRowLayout;\n\t}\n\n\treturn normalizedLayout;\n}\n\nexport default function normalizeFormFields(\n\tform: Form\n): NormalizedFormField[] {\n\tconst formLayout = normalizeLayout( form?.layout );\n\n\treturn ( form.fields ?? [] ).map( ( field ) => {\n\t\tif ( typeof field === 'string' ) {\n\t\t\treturn {\n\t\t\t\tid: field,\n\t\t\t\tlayout: formLayout,\n\t\t\t};\n\t\t}\n\n\t\tconst fieldLayout = field.layout\n\t\t\t? normalizeLayout( field.layout )\n\t\t\t: formLayout;\n\t\treturn {\n\t\t\t...field,\n\t\t\tlayout: fieldLayout,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAgBA,OAAO,MAAMA,cAAgC,GAAG;EAC/CC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAEC,MAAe,EAAqB;EACpE,IAAIC,gBAAgB,GAAGL,cAAc;EAErC,IAAKI,MAAM,EAAEH,IAAI,KAAK,SAAS,EAAG;IAAA,IAAAK,qBAAA;IACjCD,gBAAgB,GAAG;MAClBJ,IAAI,EAAE,SAAS;MACfC,aAAa,GAAAI,qBAAA,GAAEF,MAAM,EAAEF,aAAa,cAAAI,qBAAA,cAAAA,qBAAA,GAAI;IACzC,CAAmC;EACpC,CAAC,MAAM,IAAKF,MAAM,EAAEH,IAAI,KAAK,OAAO,EAAG;IAAA,IAAAM,sBAAA,EAAAC,cAAA;IACtCH,gBAAgB,GAAG;MAClBJ,IAAI,EAAE,OAAO;MACbC,aAAa,GAAAK,sBAAA,GAAEH,MAAM,EAAEF,aAAa,cAAAK,sBAAA,cAAAA,sBAAA,GAAI,MAAM;MAC9CE,MAAM,GAAAD,cAAA,GAAEJ,MAA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AAO;MACN,GAAGG,KAAK;MACRhB,MAAM,EAAEkB;IACT,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tReactNode,\n\tComponentType,\n\tComponentProps,\n} from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport interface NormalizedFilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'array';\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: Rules< Item >;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string | null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\n};\n\nexport type Rules< Item > = {\n\trequired?: boolean;\n\tcustom?: ( item: Item, field: NormalizedField< Item > ) => null | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: Rules< Item >;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: Rules< Item >;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\n\tconfig?: {\n\t\tsizes: string;\n\t};\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked?: boolean;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n\n\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\n\n\t/**\n\t * Whether infinite scroll is enabled.\n\t */\n\tinfiniteScrollEnabled?: boolean;\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n\n\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\n\t\t/**\n\t\t * Whether the view allows column moving.\n\t\t */\n\t\tenableMoving?: boolean;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n\n\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\n\tempty: ReactNode;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\n/**\n * DataForm layouts.\n */\nexport type LayoutType = 'regular' | 'panel' | 'card';\nexport type LabelPosition = 'top' | 'side' | 'none';\n\nexport type RegularLayout = {\n\ttype: 'regular';\n\tlabelPosition?: LabelPosition;\n};\nexport type NormalizedRegularLayout = {\n\ttype: 'regular';\n\tlabelPosition: LabelPosition;\n};\n\nexport type PanelLayout = {\n\ttype: 'panel';\n\tlabelPosition?: LabelPosition;\n\topenAs?: 'dropdown' | 'modal';\n};\nexport type NormalizedPanelLayout = {\n\ttype: 'panel';\n\tlabelPosition: LabelPosition;\n\topenAs: 'dropdown' | 'modal';\n};\n\nexport type CardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened?: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader?: true | undefined;\n\t\t\tisOpened?: boolean;\n\t };\nexport type NormalizedCardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: true;\n\t\t\tisOpened: boolean;\n\t };\n\nexport type Layout = RegularLayout | PanelLayout | CardLayout;\nexport type NormalizedLayout =\n\t| NormalizedRegularLayout\n\t| NormalizedPanelLayout\n\t| NormalizedCardLayout;\n\nexport type SimpleFormField = {\n\tid: string;\n\tlayout?: Layout;\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tlayout?: Layout;\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\tlayout?: Layout;\n\tfields?: Array< FormField | string >;\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tReactNode,\n\tComponentType,\n\tComponentProps,\n} from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\n\n/**\n * Utility type that makes all properties of T optional recursively.\n * Used by field setValue functions to allow partial item updates.\n */\nexport type DeepPartial< T > = {\n\t[ P in keyof T ]?: T[ P ] extends object ? DeepPartial< T[ P ] > : T[ P ];\n};\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport interface NormalizedFilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'password'\n\t| 'telephone'\n\t| 'color'\n\t| 'url'\n\t| 'array';\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: Rules< Item >;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit:\n\t\t| ComponentType< DataFormControlProps< Item > >\n\t\t| string\n\t\t| EditConfig\n\t\t| null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\n};\n\nexport type Rules< Item > = {\n\trequired?: boolean;\n\tcustom?: ( item: Item, field: NormalizedField< Item > ) => null | string;\n};\n\n/**\n * Edit configuration for textarea controls.\n */\nexport type EditConfigTextarea = {\n\tcontrol: 'textarea';\n\t/**\n\t * Number of rows for the textarea.\n\t */\n\trows?: number;\n};\n\n/**\n * Edit configuration for text controls.\n */\nexport type EditConfigText = {\n\tcontrol: 'text';\n\t/**\n\t * Prefix component to display before the input.\n\t */\n\tprefix?: React.ComponentType;\n\t/**\n\t * Suffix component to display after the input.\n\t */\n\tsuffix?: React.ComponentType;\n};\n\n/**\n * Edit configuration for other control types (excluding 'text' and 'textarea').\n */\nexport type EditConfigGeneric = {\n\tcontrol: Exclude< FieldType, 'text' | 'textarea' >;\n};\n\n/**\n * Edit configuration object with type-safe control options.\n * Each control type has its own specific configuration properties.\n */\nexport type EditConfig =\n\t| EditConfigTextarea\n\t| EditConfigText\n\t| EditConfigGeneric;\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string | EditConfig;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: Rules< Item >;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n\n\t/**\n\t * Callback used to set the value of the field on the item.\n\t * Used for editing operations to update field values.\n\t */\n\tsetValue?: ( args: { item: Item; value: any } ) => DeepPartial< Item >;\n};\n\nexport type NormalizedField< Item > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\tsetValue: ( args: { item: Item; value: any } ) => DeepPartial< Item >;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: Rules< Item >;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: DeepPartial< Item > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n\t/**\n\t * Configuration object for the control.\n\t */\n\tconfig?: {\n\t\tprefix?: React.ComponentType;\n\t\tsuffix?: React.ComponentType;\n\t\trows?: number;\n\t};\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\n\tconfig?: {\n\t\tsizes: string;\n\t};\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked?: boolean;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n\n\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\n\n\t/**\n\t * Whether infinite scroll is enabled.\n\t */\n\tinfiniteScrollEnabled?: boolean;\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n\n\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\n\t\t/**\n\t\t * Whether the view allows column moving.\n\t\t */\n\t\tenableMoving?: boolean;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport interface ViewPickerGrid extends ViewBase {\n\ttype: 'pickerGrid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable | ViewPickerGrid;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n\n\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\n\tempty: ReactNode;\n}\n\nexport type ViewPickerBaseProps< Item > = Omit<\n\tViewBaseProps< Item >,\n\t| 'view'\n\t| 'onChangeView'\n\t// The following props are not supported for pickers.\n\t| 'isItemClickable'\n\t| 'onClickItem'\n\t| 'renderItemLink'\n\t| 'getItemLevel'\n> & {\n\tview: View;\n\tonChangeView: ( view: View ) => void;\n};\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport interface ViewPickerGridProps< Item >\n\textends Omit< ViewPickerBaseProps< Item >, 'view' > {\n\tview: ViewPickerGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport type ViewPickerProps< Item > = ViewPickerGridProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n\tpickerGrid?: Omit< ViewPickerGrid, 'type' >;\n}\n\n/**\n * DataForm layouts.\n */\nexport type LayoutType = 'regular' | 'panel' | 'card' | 'row';\nexport type LabelPosition = 'top' | 'side' | 'none';\n\nexport type RegularLayout = {\n\ttype: 'regular';\n\tlabelPosition?: LabelPosition;\n};\nexport type NormalizedRegularLayout = {\n\ttype: 'regular';\n\tlabelPosition: LabelPosition;\n};\n\nexport type PanelLayout = {\n\ttype: 'panel';\n\tlabelPosition?: LabelPosition;\n\topenAs?: 'dropdown' | 'modal';\n};\nexport type NormalizedPanelLayout = {\n\ttype: 'panel';\n\tlabelPosition: LabelPosition;\n\topenAs: 'dropdown' | 'modal';\n};\n\nexport type CardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened?: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader?: true | undefined;\n\t\t\tisOpened?: boolean;\n\t };\nexport type NormalizedCardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: true;\n\t\t\tisOpened: boolean;\n\t };\n\nexport type RowLayout = {\n\ttype: 'row';\n\talignment?: 'start' | 'center' | 'end';\n};\nexport type NormalizedRowLayout = {\n\ttype: 'row';\n\talignment: 'start' | 'center' | 'end';\n};\n\nexport type Layout = RegularLayout | PanelLayout | CardLayout | RowLayout;\nexport type NormalizedLayout =\n\t| NormalizedRegularLayout\n\t| NormalizedPanelLayout\n\t| NormalizedCardLayout\n\t| NormalizedRowLayout;\n\nexport type SimpleFormField = {\n\tid: string;\n\tlayout?: Layout;\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tdescription?: string;\n\tlayout?: Layout;\n\tchildren: Array< FormField | string >;\n\tsummary?: string | string[];\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\tlayout?: Layout;\n\tfields?: Array< FormField | string >;\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -21,7 +21,7 @@ export function isItemValid(item, fields, form) {
21
21
  item
22
22
  });
23
23
  if (field.isValid.required) {
24
- if (field.type === 'text' && isEmptyNullOrUndefined(value) || field.type === 'email' && isEmptyNullOrUndefined(value) || field.type === 'integer' && isEmptyNullOrUndefined(value) || field.type === undefined && isEmptyNullOrUndefined(value)) {
24
+ if (field.type === 'text' && isEmptyNullOrUndefined(value) || field.type === 'email' && isEmptyNullOrUndefined(value) || field.type === 'url' && isEmptyNullOrUndefined(value) || field.type === 'telephone' && isEmptyNullOrUndefined(value) || field.type === 'password' && isEmptyNullOrUndefined(value) || field.type === 'integer' && isEmptyNullOrUndefined(value) || field.type === undefined && isEmptyNullOrUndefined(value)) {
25
25
  return false;
26
26
  }
27
27
  if (field.type === 'boolean' && value !== true) {
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","isEmptyNullOrUndefined","value","undefined","every","field","getValue","isValid","required","type","custom"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\n\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\n\tconst isEmptyNullOrUndefined = ( value: any ) =>\n\t\t[ undefined, '', null ].includes( value );\n\n\treturn _fields.every( ( field ) => {\n\t\tconst value = field.getValue( { item } );\n\n\t\tif ( field.isValid.required ) {\n\t\t\tif (\n\t\t\t\t( field.type === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'integer' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === undefined && isEmptyNullOrUndefined( value ) )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( field.type === 'boolean' && value !== true ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\ttypeof field.isValid.custom === 'function' &&\n\t\t\tfield.isValid.custom( item, field ) !== null\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;EAED,MAAME,sBAAsB,GAAKC,KAAU,IAC1C,CAAEC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAE,CAACH,QAAQ,CAAEE,KAAM,CAAC;EAE1C,OAAOL,OAAO,CAACO,KAAK,CAAIC,KAAK,IAAM;IAClC,MAAMH,KAAK,GAAGG,KAAK,CAACC,QAAQ,CAAE;MAAEZ;IAAK,CAAE,CAAC;IAExC,IAAKW,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAG;MAC7B,IACGH,KAAK,CAACI,IAAI,KAAK,MAAM,IAAIR,sBAAsB,CAAEC,KAAM,CAAC,IACxDG,KAAK,CAACI,IAAI,KAAK,OAAO,IAAIR,sBAAsB,CAAEC,KAAM,CAAG,IAC3DG,KAAK,CAACI,IAAI,KAAK,SAAS,IACzBR,sBAAsB,CAAEC,KAAM,CAAG,IAChCG,KAAK,CAACI,IAAI,KAAKN,SAAS,IAAIF,sBAAsB,CAAEC,KAAM,CAAG,EAC9D;QACD,OAAO,KAAK;MACb;MAEA,IAAKG,KAAK,CAACI,IAAI,KAAK,SAAS,IAAIP,KAAK,KAAK,IAAI,EAAG;QACjD,OAAO,KAAK;MACb;IACD;IAEA,IACC,OAAOG,KAAK,CAACE,OAAO,CAACG,MAAM,KAAK,UAAU,IAC1CL,KAAK,CAACE,OAAO,CAACG,MAAM,CAAEhB,IAAI,EAAEW,KAAM,CAAC,KAAK,IAAI,EAC3C;MACD,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","isEmptyNullOrUndefined","value","undefined","every","field","getValue","isValid","required","type","custom"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\n\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\n\tconst isEmptyNullOrUndefined = ( value: any ) =>\n\t\t[ undefined, '', null ].includes( value );\n\n\treturn _fields.every( ( field ) => {\n\t\tconst value = field.getValue( { item } );\n\n\t\tif ( field.isValid.required ) {\n\t\t\tif (\n\t\t\t\t( field.type === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'url' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'telephone' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'password' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'integer' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === undefined && isEmptyNullOrUndefined( value ) )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( field.type === 'boolean' && value !== true ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\ttypeof field.isValid.custom === 'function' &&\n\t\t\tfield.isValid.custom( item, field ) !== null\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;EAED,MAAME,sBAAsB,GAAKC,KAAU,IAC1C,CAAEC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAE,CAACH,QAAQ,CAAEE,KAAM,CAAC;EAE1C,OAAOL,OAAO,CAACO,KAAK,CAAIC,KAAK,IAAM;IAClC,MAAMH,KAAK,GAAGG,KAAK,CAACC,QAAQ,CAAE;MAAEZ;IAAK,CAAE,CAAC;IAExC,IAAKW,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAG;MAC7B,IACGH,KAAK,CAACI,IAAI,KAAK,MAAM,I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