@wordpress/dataviews 4.0.0 → 4.2.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 (285) hide show
  1. package/CHANGELOG.md +33 -5
  2. package/README.md +31 -23
  3. package/build/components/dataform/index.js +10 -61
  4. package/build/components/dataform/index.js.map +1 -1
  5. package/build/components/dataviews/index.js +23 -14
  6. package/build/components/dataviews/index.js.map +1 -1
  7. package/build/components/dataviews-bulk-actions/index.js +3 -0
  8. package/build/components/dataviews-bulk-actions/index.js.map +1 -1
  9. package/build/components/dataviews-filters/add-filter.js +34 -17
  10. package/build/components/dataviews-filters/add-filter.js.map +1 -1
  11. package/build/components/dataviews-filters/index.js +109 -43
  12. package/build/components/dataviews-filters/index.js.map +1 -1
  13. package/build/components/dataviews-filters/search-widget.js +2 -5
  14. package/build/components/dataviews-filters/search-widget.js.map +1 -1
  15. package/build/components/dataviews-layout/index.js +2 -2
  16. package/build/components/dataviews-layout/index.js.map +1 -1
  17. package/build/components/dataviews-pagination/index.js +23 -15
  18. package/build/components/dataviews-pagination/index.js.map +1 -1
  19. package/build/components/dataviews-search/index.js +8 -5
  20. package/build/components/dataviews-search/index.js.map +1 -1
  21. package/build/components/dataviews-view-config/index.js +240 -188
  22. package/build/components/dataviews-view-config/index.js.map +1 -1
  23. package/build/constants.js +6 -1
  24. package/build/constants.js.map +1 -1
  25. package/build/dataform-controls/datetime.js +49 -0
  26. package/build/dataform-controls/datetime.js.map +1 -0
  27. package/build/dataform-controls/index.js +50 -0
  28. package/build/dataform-controls/index.js.map +1 -0
  29. package/build/dataform-controls/integer.js +45 -0
  30. package/build/dataform-controls/integer.js.map +1 -0
  31. package/build/dataform-controls/radio.js +45 -0
  32. package/build/dataform-controls/radio.js.map +1 -0
  33. package/build/dataform-controls/select.js +58 -0
  34. package/build/dataform-controls/select.js.map +1 -0
  35. package/build/dataform-controls/text.js +45 -0
  36. package/build/dataform-controls/text.js.map +1 -0
  37. package/build/dataforms-layouts/index.js +24 -0
  38. package/build/dataforms-layouts/index.js.map +1 -0
  39. package/build/dataforms-layouts/panel/index.js +132 -0
  40. package/build/dataforms-layouts/panel/index.js.map +1 -0
  41. package/build/dataforms-layouts/regular/index.js +42 -0
  42. package/build/dataforms-layouts/regular/index.js.map +1 -0
  43. package/build/dataviews-layouts/grid/density-picker.js +114 -0
  44. package/build/dataviews-layouts/grid/density-picker.js.map +1 -0
  45. package/build/{layouts → dataviews-layouts}/grid/index.js +9 -9
  46. package/build/dataviews-layouts/grid/index.js.map +1 -0
  47. package/build/dataviews-layouts/index.js.map +1 -0
  48. package/build/{layouts → dataviews-layouts}/list/index.js +6 -2
  49. package/build/dataviews-layouts/list/index.js.map +1 -0
  50. package/build/{layouts → dataviews-layouts}/table/column-header-menu.js +3 -6
  51. package/build/dataviews-layouts/table/column-header-menu.js.map +1 -0
  52. package/build/dataviews-layouts/table/index.js.map +1 -0
  53. package/build/field-types/datetime.js +30 -0
  54. package/build/field-types/datetime.js.map +1 -0
  55. package/build/field-types/index.js +50 -0
  56. package/build/field-types/index.js.map +1 -0
  57. package/build/field-types/integer.js +35 -0
  58. package/build/field-types/integer.js.map +1 -0
  59. package/build/field-types/text.js +28 -0
  60. package/build/field-types/text.js.map +1 -0
  61. package/build/filter-and-sort-data-view.js +2 -11
  62. package/build/filter-and-sort-data-view.js.map +1 -1
  63. package/build/index.js +9 -2
  64. package/build/index.js.map +1 -1
  65. package/build/normalize-fields.js +34 -1
  66. package/build/normalize-fields.js.map +1 -1
  67. package/build/types.js.map +1 -1
  68. package/build/validation.js +22 -0
  69. package/build/validation.js.map +1 -0
  70. package/build-module/components/dataform/index.js +10 -61
  71. package/build-module/components/dataform/index.js.map +1 -1
  72. package/build-module/components/dataviews/index.js +21 -14
  73. package/build-module/components/dataviews/index.js.map +1 -1
  74. package/build-module/components/dataviews-bulk-actions/index.js +3 -0
  75. package/build-module/components/dataviews-bulk-actions/index.js.map +1 -1
  76. package/build-module/components/dataviews-filters/add-filter.js +33 -17
  77. package/build-module/components/dataviews-filters/add-filter.js.map +1 -1
  78. package/build-module/components/dataviews-filters/index.js +108 -45
  79. package/build-module/components/dataviews-filters/index.js.map +1 -1
  80. package/build-module/components/dataviews-filters/search-widget.js +2 -5
  81. package/build-module/components/dataviews-filters/search-widget.js.map +1 -1
  82. package/build-module/components/dataviews-layout/index.js +1 -1
  83. package/build-module/components/dataviews-layout/index.js.map +1 -1
  84. package/build-module/components/dataviews-pagination/index.js +23 -15
  85. package/build-module/components/dataviews-pagination/index.js.map +1 -1
  86. package/build-module/components/dataviews-search/index.js +8 -5
  87. package/build-module/components/dataviews-search/index.js.map +1 -1
  88. package/build-module/components/dataviews-view-config/index.js +243 -191
  89. package/build-module/components/dataviews-view-config/index.js.map +1 -1
  90. package/build-module/constants.js +5 -0
  91. package/build-module/constants.js.map +1 -1
  92. package/build-module/dataform-controls/datetime.js +43 -0
  93. package/build-module/dataform-controls/datetime.js.map +1 -0
  94. package/build-module/dataform-controls/index.js +42 -0
  95. package/build-module/dataform-controls/index.js.map +1 -0
  96. package/build-module/dataform-controls/integer.js +38 -0
  97. package/build-module/dataform-controls/integer.js.map +1 -0
  98. package/build-module/dataform-controls/radio.js +38 -0
  99. package/build-module/dataform-controls/radio.js.map +1 -0
  100. package/build-module/dataform-controls/select.js +51 -0
  101. package/build-module/dataform-controls/select.js.map +1 -0
  102. package/build-module/dataform-controls/text.js +38 -0
  103. package/build-module/dataform-controls/text.js.map +1 -0
  104. package/build-module/dataforms-layouts/index.js +16 -0
  105. package/build-module/dataforms-layouts/index.js.map +1 -0
  106. package/build-module/dataforms-layouts/panel/index.js +127 -0
  107. package/build-module/dataforms-layouts/panel/index.js.map +1 -0
  108. package/build-module/dataforms-layouts/regular/index.js +35 -0
  109. package/build-module/dataforms-layouts/regular/index.js.map +1 -0
  110. package/build-module/dataviews-layouts/grid/density-picker.js +107 -0
  111. package/build-module/dataviews-layouts/grid/density-picker.js.map +1 -0
  112. package/build-module/{layouts → dataviews-layouts}/grid/index.js +9 -9
  113. package/build-module/dataviews-layouts/grid/index.js.map +1 -0
  114. package/build-module/dataviews-layouts/index.js.map +1 -0
  115. package/build-module/{layouts → dataviews-layouts}/list/index.js +5 -2
  116. package/build-module/dataviews-layouts/list/index.js.map +1 -0
  117. package/build-module/{layouts → dataviews-layouts}/table/column-header-menu.js +3 -6
  118. package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -0
  119. package/build-module/dataviews-layouts/table/index.js.map +1 -0
  120. package/build-module/field-types/datetime.js +24 -0
  121. package/build-module/field-types/datetime.js.map +1 -0
  122. package/build-module/field-types/index.js +44 -0
  123. package/build-module/field-types/index.js.map +1 -0
  124. package/build-module/field-types/integer.js +29 -0
  125. package/build-module/field-types/integer.js.map +1 -0
  126. package/build-module/field-types/text.js +22 -0
  127. package/build-module/field-types/text.js.map +1 -0
  128. package/build-module/filter-and-sort-data-view.js +2 -11
  129. package/build-module/filter-and-sort-data-view.js.map +1 -1
  130. package/build-module/index.js +2 -1
  131. package/build-module/index.js.map +1 -1
  132. package/build-module/normalize-fields.js +33 -1
  133. package/build-module/normalize-fields.js.map +1 -1
  134. package/build-module/types.js.map +1 -1
  135. package/build-module/validation.js +15 -0
  136. package/build-module/validation.js.map +1 -0
  137. package/build-style/style-rtl.css +186 -20
  138. package/build-style/style.css +186 -20
  139. package/build-types/components/dataform/index.d.ts +2 -13
  140. package/build-types/components/dataform/index.d.ts.map +1 -1
  141. package/build-types/components/dataform/stories/index.story.d.ts +12 -1
  142. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
  143. package/build-types/components/dataviews/index.d.ts.map +1 -1
  144. package/build-types/components/dataviews/stories/fixtures.d.ts +25 -0
  145. package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
  146. package/build-types/components/dataviews/stories/index.story.d.ts +9 -0
  147. package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
  148. package/build-types/components/dataviews-bulk-actions/index.d.ts.map +1 -1
  149. package/build-types/components/dataviews-filters/add-filter.d.ts +3 -0
  150. package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -1
  151. package/build-types/components/dataviews-filters/index.d.ts +11 -1
  152. package/build-types/components/dataviews-filters/index.d.ts.map +1 -1
  153. package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
  154. package/build-types/components/dataviews-pagination/index.d.ts.map +1 -1
  155. package/build-types/components/dataviews-search/index.d.ts.map +1 -1
  156. package/build-types/components/dataviews-view-config/index.d.ts +4 -3
  157. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
  158. package/build-types/constants.d.ts +4 -0
  159. package/build-types/constants.d.ts.map +1 -1
  160. package/build-types/dataform-controls/datetime.d.ts +6 -0
  161. package/build-types/dataform-controls/datetime.d.ts.map +1 -0
  162. package/build-types/dataform-controls/index.d.ts +11 -0
  163. package/build-types/dataform-controls/index.d.ts.map +1 -0
  164. package/build-types/dataform-controls/integer.d.ts +6 -0
  165. package/build-types/dataform-controls/integer.d.ts.map +1 -0
  166. package/build-types/dataform-controls/radio.d.ts +6 -0
  167. package/build-types/dataform-controls/radio.d.ts.map +1 -0
  168. package/build-types/dataform-controls/select.d.ts +6 -0
  169. package/build-types/dataform-controls/select.d.ts.map +1 -0
  170. package/build-types/dataform-controls/text.d.ts +6 -0
  171. package/build-types/dataform-controls/text.d.ts.map +1 -0
  172. package/build-types/dataforms-layouts/index.d.ts +9 -0
  173. package/build-types/dataforms-layouts/index.d.ts.map +1 -0
  174. package/build-types/dataforms-layouts/panel/index.d.ts +3 -0
  175. package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -0
  176. package/build-types/dataforms-layouts/regular/index.d.ts +3 -0
  177. package/build-types/dataforms-layouts/regular/index.d.ts.map +1 -0
  178. package/build-types/dataviews-layouts/grid/density-picker.d.ts.map +1 -0
  179. package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -0
  180. package/build-types/dataviews-layouts/index.d.ts.map +1 -0
  181. package/build-types/dataviews-layouts/list/index.d.ts.map +1 -0
  182. package/build-types/dataviews-layouts/table/column-header-menu.d.ts.map +1 -0
  183. package/build-types/dataviews-layouts/table/index.d.ts.map +1 -0
  184. package/build-types/field-types/datetime.d.ts +13 -0
  185. package/build-types/field-types/datetime.d.ts.map +1 -0
  186. package/build-types/field-types/index.d.ts +20 -0
  187. package/build-types/field-types/index.d.ts.map +1 -0
  188. package/build-types/field-types/integer.d.ts +13 -0
  189. package/build-types/field-types/integer.d.ts.map +1 -0
  190. package/build-types/field-types/text.d.ts +13 -0
  191. package/build-types/field-types/text.d.ts.map +1 -0
  192. package/build-types/filter-and-sort-data-view.d.ts.map +1 -1
  193. package/build-types/index.d.ts +2 -1
  194. package/build-types/index.d.ts.map +1 -1
  195. package/build-types/normalize-fields.d.ts +0 -3
  196. package/build-types/normalize-fields.d.ts.map +1 -1
  197. package/build-types/types.d.ts +73 -18
  198. package/build-types/types.d.ts.map +1 -1
  199. package/build-types/validation.d.ts +3 -0
  200. package/build-types/validation.d.ts.map +1 -0
  201. package/package.json +12 -11
  202. package/src/components/dataform/index.tsx +8 -97
  203. package/src/components/dataform/stories/index.story.tsx +82 -4
  204. package/src/components/dataviews/index.tsx +26 -14
  205. package/src/components/dataviews/stories/fixtures.js +30 -1
  206. package/src/components/dataviews/stories/index.story.js +7 -1
  207. package/src/components/dataviews/style.scss +5 -14
  208. package/src/components/dataviews-bulk-actions/index.tsx +5 -0
  209. package/src/components/dataviews-bulk-actions-toolbar/style.scss +1 -1
  210. package/src/components/dataviews-filters/add-filter.tsx +37 -21
  211. package/src/components/dataviews-filters/index.tsx +152 -61
  212. package/src/components/dataviews-filters/search-widget.tsx +1 -8
  213. package/src/components/dataviews-filters/style.scss +31 -1
  214. package/src/components/dataviews-layout/index.tsx +1 -1
  215. package/src/components/dataviews-pagination/index.tsx +35 -16
  216. package/src/components/dataviews-pagination/style.scss +9 -4
  217. package/src/components/dataviews-search/index.tsx +8 -5
  218. package/src/components/dataviews-view-config/index.tsx +300 -257
  219. package/src/components/dataviews-view-config/style.scss +44 -0
  220. package/src/constants.ts +5 -0
  221. package/src/dataform-controls/datetime.tsx +43 -0
  222. package/src/dataform-controls/index.tsx +61 -0
  223. package/src/dataform-controls/integer.tsx +38 -0
  224. package/src/dataform-controls/radio.tsx +42 -0
  225. package/src/dataform-controls/select.tsx +52 -0
  226. package/src/dataform-controls/style.scss +4 -0
  227. package/src/dataform-controls/text.tsx +40 -0
  228. package/src/dataforms-layouts/index.tsx +20 -0
  229. package/src/dataforms-layouts/panel/index.tsx +168 -0
  230. package/src/dataforms-layouts/panel/style.scss +59 -0
  231. package/src/dataforms-layouts/regular/index.tsx +45 -0
  232. package/src/dataviews-layouts/grid/density-picker.tsx +102 -0
  233. package/src/{layouts → dataviews-layouts}/grid/index.tsx +9 -9
  234. package/src/{layouts → dataviews-layouts}/grid/style.scss +29 -4
  235. package/src/{layouts → dataviews-layouts}/list/index.tsx +6 -2
  236. package/src/{layouts → dataviews-layouts}/list/style.scss +4 -1
  237. package/src/{layouts → dataviews-layouts}/table/column-header-menu.tsx +4 -6
  238. package/src/field-types/datetime.tsx +28 -0
  239. package/src/field-types/index.tsx +50 -0
  240. package/src/field-types/integer.tsx +34 -0
  241. package/src/field-types/text.tsx +27 -0
  242. package/src/filter-and-sort-data-view.ts +1 -15
  243. package/src/index.ts +2 -1
  244. package/src/normalize-fields.ts +43 -4
  245. package/src/style.scss +7 -3
  246. package/src/test/filter-and-sort-data-view.js +74 -3
  247. package/src/test/validation.ts +131 -0
  248. package/src/types.ts +92 -23
  249. package/src/validation.ts +18 -0
  250. package/tsconfig.json +2 -1
  251. package/tsconfig.tsbuildinfo +1 -1
  252. package/build/layouts/grid/density-picker.js +0 -143
  253. package/build/layouts/grid/density-picker.js.map +0 -1
  254. package/build/layouts/grid/index.js.map +0 -1
  255. package/build/layouts/index.js.map +0 -1
  256. package/build/layouts/list/index.js.map +0 -1
  257. package/build/layouts/table/column-header-menu.js.map +0 -1
  258. package/build/layouts/table/index.js.map +0 -1
  259. package/build-module/layouts/grid/density-picker.js +0 -138
  260. package/build-module/layouts/grid/density-picker.js.map +0 -1
  261. package/build-module/layouts/grid/index.js.map +0 -1
  262. package/build-module/layouts/index.js.map +0 -1
  263. package/build-module/layouts/list/index.js.map +0 -1
  264. package/build-module/layouts/table/column-header-menu.js.map +0 -1
  265. package/build-module/layouts/table/index.js.map +0 -1
  266. package/build-types/layouts/grid/density-picker.d.ts.map +0 -1
  267. package/build-types/layouts/grid/index.d.ts.map +0 -1
  268. package/build-types/layouts/index.d.ts.map +0 -1
  269. package/build-types/layouts/list/index.d.ts.map +0 -1
  270. package/build-types/layouts/table/column-header-menu.d.ts.map +0 -1
  271. package/build-types/layouts/table/index.d.ts.map +0 -1
  272. package/src/layouts/grid/density-picker.tsx +0 -136
  273. /package/build/{layouts → dataviews-layouts}/index.js +0 -0
  274. /package/build/{layouts → dataviews-layouts}/table/index.js +0 -0
  275. /package/build-module/{layouts → dataviews-layouts}/index.js +0 -0
  276. /package/build-module/{layouts → dataviews-layouts}/table/index.js +0 -0
  277. /package/build-types/{layouts → dataviews-layouts}/grid/density-picker.d.ts +0 -0
  278. /package/build-types/{layouts → dataviews-layouts}/grid/index.d.ts +0 -0
  279. /package/build-types/{layouts → dataviews-layouts}/index.d.ts +0 -0
  280. /package/build-types/{layouts → dataviews-layouts}/list/index.d.ts +0 -0
  281. /package/build-types/{layouts → dataviews-layouts}/table/column-header-menu.d.ts +0 -0
  282. /package/build-types/{layouts → dataviews-layouts}/table/index.d.ts +0 -0
  283. /package/src/{layouts → dataviews-layouts}/index.ts +0 -0
  284. /package/src/{layouts → dataviews-layouts}/table/index.tsx +0 -0
  285. /package/src/{layouts → dataviews-layouts}/table/style.scss +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeFields","fields","map","field","getValue","item","id","label","render"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Field, NormalizedField, ItemRecord } from './types';\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 getValue =\n\t\t\tfield.getValue ||\n\t\t\t( ( { item }: { item: ItemRecord } ) => item[ field.id ] );\n\n\t\treturn {\n\t\t\t...field,\n\t\t\tlabel: field.label || field.id,\n\t\t\tgetValue,\n\t\t\trender: field.render || getValue,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAC9BC,MAAuB,EACK;EAC5B,OAAOA,MAAM,CAACC,GAAG,CAAIC,KAAK,IAAM;IAC/B,MAAMC,QAAQ,GACbD,KAAK,CAACC,QAAQ,KACZ,CAAE;MAAEC;IAA2B,CAAC,KAAMA,IAAI,CAAEF,KAAK,CAACG,EAAE,CAAE,CAAE;IAE3D,OAAO;MACN,GAAGH,KAAK;MACRI,KAAK,EAAEJ,KAAK,CAACI,KAAK,IAAIJ,KAAK,CAACG,EAAE;MAC9BF,QAAQ;MACRI,MAAM,EAAEL,KAAK,CAACK,MAAM,IAAIJ;IACzB,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["getFieldTypeDefinition","getControl","normalizeFields","fields","map","field","_field$sort","_field$isValid","fieldTypeDefinition","type","getValue","item","id","sort","a","b","direction","isValid","context","Edit","renderFromElements","value","elements","find","element","label","render","header"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type { Field, NormalizedField } from './types';\nimport { getControl } from './dataform-controls';\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( field.type );\n\n\t\tconst getValue =\n\t\t\tfield.getValue || ( ( { item } ) => ( item as any )[ 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\tfield.isValid ??\n\t\t\tfunction isValid( item, context ) {\n\t\t\t\treturn fieldTypeDefinition.isValid(\n\t\t\t\t\tgetValue( { item } ),\n\t\t\t\t\tcontext\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst Edit = getControl( field, fieldTypeDefinition );\n\n\t\tconst renderFromElements = ( { item }: { item: Item } ) => {\n\t\t\tconst value = getValue( { item } );\n\t\t\treturn (\n\t\t\t\tfield?.elements?.find( ( element ) => element.value === value )\n\t\t\t\t\t?.label || getValue( { item } )\n\t\t\t);\n\t\t};\n\n\t\tconst render =\n\t\t\tfield.render || ( field.elements ? renderFromElements : getValue );\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};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAElD,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC9BC,MAAuB,EACK;EAC5B,OAAOA,MAAM,CAACC,GAAG,CAAIC,KAAK,IAAM;IAAA,IAAAC,WAAA,EAAAC,cAAA;IAC/B,MAAMC,mBAAmB,GAAGR,sBAAsB,CAAEK,KAAK,CAACI,IAAK,CAAC;IAEhE,MAAMC,QAAQ,GACbL,KAAK,CAACK,QAAQ,KAAM,CAAE;MAAEC;IAAK,CAAC,KAAQA,IAAI,CAAWN,KAAK,CAACO,EAAE,CAAE,CAAE;IAElE,MAAMC,IAAI,IAAAP,WAAA,GACTD,KAAK,CAACQ,IAAI,cAAAP,WAAA,cAAAA,WAAA,GACV,SAASO,IAAIA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;MAChC,OAAOR,mBAAmB,CAACK,IAAI,CAC9BH,QAAQ,CAAE;QAAEC,IAAI,EAAEG;MAAE,CAAE,CAAC,EACvBJ,QAAQ,CAAE;QAAEC,IAAI,EAAEI;MAAE,CAAE,CAAC,EACvBC,SACD,CAAC;IACF,CAAC;IAEF,MAAMC,OAAO,IAAAV,cAAA,GACZF,KAAK,CAACY,OAAO,cAAAV,cAAA,cAAAA,cAAA,GACb,SAASU,OAAOA,CAAEN,IAAI,EAAEO,OAAO,EAAG;MACjC,OAAOV,mBAAmB,CAACS,OAAO,CACjCP,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC,EACpBO,OACD,CAAC;IACF,CAAC;IAEF,MAAMC,IAAI,GAAGlB,UAAU,CAAEI,KAAK,EAAEG,mBAAoB,CAAC;IAErD,MAAMY,kBAAkB,GAAGA,CAAE;MAAET;IAAqB,CAAC,KAAM;MAC1D,MAAMU,KAAK,GAAGX,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC;MAClC,OACCN,KAAK,EAAEiB,QAAQ,EAAEC,IAAI,CAAIC,OAAO,IAAMA,OAAO,CAACH,KAAK,KAAKA,KAAM,CAAC,EAC5DI,KAAK,IAAIf,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC;IAElC,CAAC;IAED,MAAMe,MAAM,GACXrB,KAAK,CAACqB,MAAM,KAAMrB,KAAK,CAACiB,QAAQ,GAAGF,kBAAkB,GAAGV,QAAQ,CAAE;IAEnE,OAAO;MACN,GAAGL,KAAK;MACRoB,KAAK,EAAEpB,KAAK,CAACoB,KAAK,IAAIpB,KAAK,CAACO,EAAE;MAC9Be,MAAM,EAAEtB,KAAK,CAACsB,MAAM,IAAItB,KAAK,CAACoB,KAAK,IAAIpB,KAAK,CAACO,EAAE;MAC/CF,QAAQ;MACRgB,MAAM;MACNb,IAAI;MACJI,OAAO;MACPE;IACD,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 { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\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\ninterface 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 type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type ItemRecord = Record< string, unknown >;\n\nexport type FieldType = 'text';\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 * 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< { item: Item } >;\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 | undefined;\n} & ( Item extends ItemRecord\n\t? {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue?: ( args: { item: Item } ) => any;\n\t }\n\t: {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue: ( args: { item: Item } ) => any;\n\t } );\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\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\n/**\n * The form configuration.\n */\nexport type Form = {\n\tvisibleFields?: string[];\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\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\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\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\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\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\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\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}: {\n\t\titems: Item[];\n\t\tcloseModal?: () => void;\n\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t} ) => 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\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\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\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"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\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\ninterface 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 type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type FieldType = 'text' | 'integer' | 'datetime';\n\nexport type ValidationContext = {\n\telements?: Option[];\n};\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: ( item: Item, context?: ValidationContext ) => boolean;\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;\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< { item: 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?: ( item: Item, context?: ValidationContext ) => 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 | undefined;\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 > = Field< Item > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => 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\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n};\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\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\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\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\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\theader?: string | ReactElement;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\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\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\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\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\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\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\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { normalizeFields } from './normalize-fields';
5
+ export function isItemValid(item, fields, form) {
6
+ const _fields = normalizeFields(fields.filter(({
7
+ id
8
+ }) => !!form.fields?.includes(id)));
9
+ return _fields.every(field => {
10
+ return field.isValid(item, {
11
+ elements: field.elements
12
+ });
13
+ });
14
+ }
15
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","every","field","isValid","elements"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\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\treturn _fields.every( ( field ) => {\n\t\treturn field.isValid( item, { elements: field.elements } );\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD,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;EACD,OAAOF,OAAO,CAACI,KAAK,CAAIC,KAAK,IAAM;IAClC,OAAOA,KAAK,CAACC,OAAO,CAAET,IAAI,EAAE;MAAEU,QAAQ,EAAEF,KAAK,CAACE;IAAS,CAAE,CAAC;EAC3D,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -34,10 +34,13 @@
34
34
  * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
35
35
  */
36
36
  /**
37
- * Dimensions.
37
+ * Radius scale.
38
+ */
39
+ /**
40
+ * Elevation scale.
38
41
  */
39
42
  /**
40
- * Shadows.
43
+ * Dimensions.
41
44
  */
42
45
  /**
43
46
  * Editor widths.
@@ -115,7 +118,8 @@
115
118
  flex-direction: column;
116
119
  }
117
120
 
118
- .dataviews__view-actions {
121
+ .dataviews__view-actions,
122
+ .dataviews-filters__container {
119
123
  box-sizing: border-box;
120
124
  padding: 16px 48px;
121
125
  flex-shrink: 0;
@@ -124,14 +128,12 @@
124
128
  transition: padding ease-out 0.1s;
125
129
  }
126
130
  @media (prefers-reduced-motion: reduce) {
127
- .dataviews__view-actions {
131
+ .dataviews__view-actions,
132
+ .dataviews-filters__container {
128
133
  transition-duration: 0s;
129
134
  transition-delay: 0s;
130
135
  }
131
136
  }
132
- .dataviews__view-actions .components-search-control .components-base-control__field {
133
- max-width: 240px;
134
- }
135
137
 
136
138
  .dataviews-view-list__primary-field,
137
139
  .dataviews-view-grid__primary-field,
@@ -203,12 +205,10 @@
203
205
 
204
206
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
205
207
  @container (max-width: 430px) {
206
- .dataviews__view-actions {
208
+ .dataviews__view-actions,
209
+ .dataviews-filters__container {
207
210
  padding: 12px 24px;
208
211
  }
209
- .dataviews__view-actions .components-search-control .components-base-control__field {
210
- max-width: 112px;
211
- }
212
212
 
213
213
  .dataviews-view-grid,
214
214
  .dataviews-no-results,
@@ -270,6 +270,10 @@
270
270
  position: relative;
271
271
  }
272
272
 
273
+ .dataviews-filters__container {
274
+ padding-top: 0;
275
+ }
276
+
273
277
  .dataviews-filters__reset-button.dataviews-filters__reset-button[aria-disabled=true], .dataviews-filters__reset-button.dataviews-filters__reset-button[aria-disabled=true]:hover {
274
278
  opacity: 0;
275
279
  }
@@ -503,6 +507,33 @@
503
507
  width: 24px;
504
508
  }
505
509
 
510
+ .dataviews-filters__container-visibility-toggle {
511
+ position: relative;
512
+ flex-shrink: 0;
513
+ }
514
+
515
+ .dataviews-filters-toggle__count {
516
+ position: absolute;
517
+ top: 0;
518
+ left: 0;
519
+ transform: translate(-50%, -50%);
520
+ background: var(--wp-admin-theme-color, #3858e9);
521
+ height: 16px;
522
+ min-width: 16px;
523
+ line-height: 16px;
524
+ padding: 0 4px;
525
+ text-align: center;
526
+ border-radius: 8px;
527
+ font-size: 11px;
528
+ outline: var(--wp-admin-border-width-focus) solid #fff;
529
+ color: #fff;
530
+ }
531
+
532
+ .dataviews-search {
533
+ width: -moz-fit-content;
534
+ width: fit-content;
535
+ }
536
+
506
537
  .dataviews-pagination {
507
538
  position: sticky;
508
539
  bottom: 0;
@@ -510,7 +541,6 @@
510
541
  background-color: #fff;
511
542
  padding: 12px 48px;
512
543
  border-top: 1px solid #f0f0f0;
513
- color: #757575;
514
544
  flex-shrink: 0;
515
545
  transition: padding ease-out 0.1s;
516
546
  }
@@ -521,11 +551,16 @@
521
551
  }
522
552
  }
523
553
 
524
- .dataviews-pagination__page-selection {
554
+ .dataviews-pagination__page-select {
525
555
  font-size: 11px;
526
- text-transform: uppercase;
527
556
  font-weight: 500;
528
- color: #1e1e1e;
557
+ text-transform: uppercase;
558
+ }
559
+ @media (min-width: 600px) {
560
+ .dataviews-pagination__page-select .components-select-control__input {
561
+ font-size: 11px !important;
562
+ font-weight: 500;
563
+ }
529
564
  }
530
565
 
531
566
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
@@ -552,6 +587,50 @@
552
587
  margin: 0;
553
588
  }
554
589
 
590
+ .dataviews-view-config {
591
+ width: 320px;
592
+ /* stylelint-disable-next-line property-no-unknown -- the linter needs to be updated to accepted the container-type property */
593
+ container-type: inline-size;
594
+ padding: 16px;
595
+ }
596
+
597
+ .dataviews-view-config__sort-direction .components-toggle-group-control-option-base {
598
+ text-transform: uppercase;
599
+ }
600
+
601
+ .dataviews-settings-section__title.dataviews-settings-section__title {
602
+ line-height: 24px;
603
+ font-size: 15px;
604
+ }
605
+
606
+ .dataviews-settings-section__sidebar {
607
+ grid-column: span 4;
608
+ }
609
+
610
+ .dataviews-settings-section__content,
611
+ .dataviews-settings-section__content > * {
612
+ grid-column: span 8;
613
+ }
614
+
615
+ .dataviews-settings-section__content .is-divided-in-two {
616
+ display: contents;
617
+ }
618
+ .dataviews-settings-section__content .is-divided-in-two > * {
619
+ grid-column: span 4;
620
+ }
621
+
622
+ /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
623
+ @container (max-width: 500px) {
624
+ .dataviews-settings-section.dataviews-settings-section {
625
+ grid-template-columns: repeat(2, 1fr);
626
+ }
627
+ .dataviews-settings-section.dataviews-settings-section .dataviews-settings-section__sidebar {
628
+ grid-column: span 2;
629
+ }
630
+ .dataviews-settings-section.dataviews-settings-section .dataviews-settings-section__content {
631
+ grid-column: span 2;
632
+ }
633
+ }
555
634
  .dataviews-view-grid {
556
635
  margin-bottom: auto;
557
636
  grid-template-rows: max-content;
@@ -567,6 +646,7 @@
567
646
  .dataviews-view-grid .dataviews-view-grid__card {
568
647
  height: 100%;
569
648
  justify-content: flex-start;
649
+ position: relative;
570
650
  }
571
651
  .dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__title-actions {
572
652
  padding: 8px 0 4px;
@@ -577,6 +657,10 @@
577
657
  .dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__fields .dataviews-view-grid__field .dataviews-view-grid__field-value {
578
658
  color: #1e1e1e;
579
659
  }
660
+ .dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__media::after {
661
+ background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
662
+ box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color);
663
+ }
580
664
  .dataviews-view-grid .dataviews-view-grid__media {
581
665
  width: 100%;
582
666
  min-height: 200px;
@@ -609,10 +693,18 @@
609
693
  .dataviews-view-grid .dataviews-view-grid__fields:not(:empty) {
610
694
  padding: 0 0 12px;
611
695
  }
696
+ .dataviews-view-grid .dataviews-view-grid__fields .dataviews-view-grid__field-value:not(:empty) {
697
+ min-height: 24px;
698
+ line-height: 20px;
699
+ padding-top: 2px;
700
+ }
612
701
  .dataviews-view-grid .dataviews-view-grid__fields .dataviews-view-grid__field {
613
702
  align-items: flex-start;
614
703
  min-height: 24px;
615
704
  }
705
+ .dataviews-view-grid .dataviews-view-grid__fields .dataviews-view-grid__field:not(:has(.dataviews-view-grid__field-value:not(:empty))) {
706
+ display: none;
707
+ }
616
708
  .dataviews-view-grid .dataviews-view-grid__fields .dataviews-view-grid__field:not(.is-column) {
617
709
  align-items: center;
618
710
  }
@@ -670,15 +762,24 @@
670
762
  }
671
763
  }
672
764
 
673
- .dataviews-density-picker__range-control {
674
- width: 200px;
675
- }
676
-
677
765
  .dataviews-view-grid__field-value:empty,
678
766
  .dataviews-view-grid__field:empty {
679
767
  display: none;
680
768
  }
681
769
 
770
+ .dataviews-view-grid__card .dataviews-selection-checkbox {
771
+ position: absolute;
772
+ top: -9999em;
773
+ right: 8px;
774
+ z-index: 1;
775
+ }
776
+
777
+ .dataviews-view-grid__card:hover .dataviews-selection-checkbox,
778
+ .dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
779
+ .dataviews-view-grid__card.is-selected .dataviews-selection-checkbox {
780
+ top: 8px;
781
+ }
782
+
682
783
  .dataviews-view-list {
683
784
  margin: 0 0 auto;
684
785
  }
@@ -819,7 +920,10 @@
819
920
  display: none;
820
921
  }
821
922
  .dataviews-view-list .dataviews-view-list__fields .dataviews-view-list__field-value {
822
- line-height: 24px;
923
+ min-height: 24px;
924
+ line-height: 20px;
925
+ display: flex;
926
+ align-items: center;
823
927
  }
824
928
  .dataviews-view-list + .dataviews-pagination {
825
929
  justify-content: space-between;
@@ -994,4 +1098,66 @@
994
1098
  .dataviews-view-table-selection-checkbox {
995
1099
  --checkbox-input-size: 16px;
996
1100
  }
1101
+ }
1102
+
1103
+ .dataviews-controls__datetime {
1104
+ border: none;
1105
+ padding: 0;
1106
+ }
1107
+
1108
+ .dataforms-layouts-panel__field {
1109
+ width: 100%;
1110
+ min-height: 32px;
1111
+ justify-content: flex-start !important;
1112
+ align-items: flex-start !important;
1113
+ }
1114
+
1115
+ .dataforms-layouts-panel__field-label {
1116
+ width: 38%;
1117
+ flex-shrink: 0;
1118
+ min-height: 32px;
1119
+ display: flex;
1120
+ align-items: center;
1121
+ padding: 6px 0;
1122
+ line-height: 20px;
1123
+ -webkit-hyphens: auto;
1124
+ hyphens: auto;
1125
+ }
1126
+
1127
+ .dataforms-layouts-panel__field-control {
1128
+ flex-grow: 1;
1129
+ min-height: 32px;
1130
+ display: flex;
1131
+ align-items: center;
1132
+ }
1133
+ .dataforms-layouts-panel__field-control .components-button {
1134
+ max-width: 100%;
1135
+ text-align: right;
1136
+ white-space: normal;
1137
+ text-wrap: balance;
1138
+ text-wrap: pretty;
1139
+ min-height: 32px;
1140
+ }
1141
+ .dataforms-layouts-panel__field-control .components-dropdown {
1142
+ max-width: 100%;
1143
+ }
1144
+
1145
+ .dataforms-layouts-panel__field-dropdown .components-popover__content {
1146
+ min-width: 320px;
1147
+ padding: 16px;
1148
+ }
1149
+
1150
+ .dataforms-layouts-panel__dropdown-header {
1151
+ margin-bottom: 16px;
1152
+ }
1153
+
1154
+ [class].dataforms-layouts-panel__dropdown-header-action {
1155
+ height: 24px;
1156
+ }
1157
+ [class].dataforms-layouts-panel__dropdown-header-action.has-icon {
1158
+ min-width: 24px;
1159
+ padding: 0;
1160
+ }
1161
+ [class].dataforms-layouts-panel__dropdown-header-action:not(.has-icon) {
1162
+ text-decoration: underline;
997
1163
  }