@wordpress/dataviews 4.1.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 (170) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +31 -23
  3. package/build/components/dataviews/index.js +9 -11
  4. package/build/components/dataviews/index.js.map +1 -1
  5. package/build/components/dataviews-filters/index.js +3 -0
  6. package/build/components/dataviews-filters/index.js.map +1 -1
  7. package/build/components/dataviews-filters/search-widget.js +2 -5
  8. package/build/components/dataviews-filters/search-widget.js.map +1 -1
  9. package/build/components/dataviews-pagination/index.js +23 -15
  10. package/build/components/dataviews-pagination/index.js.map +1 -1
  11. package/build/components/dataviews-view-config/index.js +26 -9
  12. package/build/components/dataviews-view-config/index.js.map +1 -1
  13. package/build/dataform-controls/datetime.js +49 -0
  14. package/build/dataform-controls/datetime.js.map +1 -0
  15. package/build/dataform-controls/index.js +50 -0
  16. package/build/dataform-controls/index.js.map +1 -0
  17. package/build/dataform-controls/integer.js +45 -0
  18. package/build/dataform-controls/integer.js.map +1 -0
  19. package/build/dataform-controls/radio.js +45 -0
  20. package/build/dataform-controls/radio.js.map +1 -0
  21. package/build/dataform-controls/select.js +58 -0
  22. package/build/dataform-controls/select.js.map +1 -0
  23. package/build/dataform-controls/text.js +45 -0
  24. package/build/dataform-controls/text.js.map +1 -0
  25. package/build/dataforms-layouts/panel/index.js +6 -3
  26. package/build/dataforms-layouts/panel/index.js.map +1 -1
  27. package/build/dataforms-layouts/regular/index.js +6 -3
  28. package/build/dataforms-layouts/regular/index.js.map +1 -1
  29. package/build/dataviews-layouts/grid/density-picker.js +23 -52
  30. package/build/dataviews-layouts/grid/density-picker.js.map +1 -1
  31. package/build/dataviews-layouts/grid/index.js +1 -1
  32. package/build/dataviews-layouts/grid/index.js.map +1 -1
  33. package/build/dataviews-layouts/list/index.js +6 -2
  34. package/build/dataviews-layouts/list/index.js.map +1 -1
  35. package/build/dataviews-layouts/table/column-header-menu.js +2 -5
  36. package/build/dataviews-layouts/table/column-header-menu.js.map +1 -1
  37. package/build/field-types/datetime.js +30 -0
  38. package/build/field-types/datetime.js.map +1 -0
  39. package/build/field-types/index.js +4 -0
  40. package/build/field-types/index.js.map +1 -1
  41. package/build/field-types/integer.js +1 -60
  42. package/build/field-types/integer.js.map +1 -1
  43. package/build/field-types/text.js +1 -60
  44. package/build/field-types/text.js.map +1 -1
  45. package/build/normalize-fields.js +6 -7
  46. package/build/normalize-fields.js.map +1 -1
  47. package/build/types.js.map +1 -1
  48. package/build-module/components/dataviews/index.js +9 -11
  49. package/build-module/components/dataviews/index.js.map +1 -1
  50. package/build-module/components/dataviews-filters/index.js +3 -0
  51. package/build-module/components/dataviews-filters/index.js.map +1 -1
  52. package/build-module/components/dataviews-filters/search-widget.js +2 -5
  53. package/build-module/components/dataviews-filters/search-widget.js.map +1 -1
  54. package/build-module/components/dataviews-pagination/index.js +23 -15
  55. package/build-module/components/dataviews-pagination/index.js.map +1 -1
  56. package/build-module/components/dataviews-view-config/index.js +27 -10
  57. package/build-module/components/dataviews-view-config/index.js.map +1 -1
  58. package/build-module/dataform-controls/datetime.js +43 -0
  59. package/build-module/dataform-controls/datetime.js.map +1 -0
  60. package/build-module/dataform-controls/index.js +42 -0
  61. package/build-module/dataform-controls/index.js.map +1 -0
  62. package/build-module/dataform-controls/integer.js +38 -0
  63. package/build-module/dataform-controls/integer.js.map +1 -0
  64. package/build-module/dataform-controls/radio.js +38 -0
  65. package/build-module/dataform-controls/radio.js.map +1 -0
  66. package/build-module/dataform-controls/select.js +51 -0
  67. package/build-module/dataform-controls/select.js.map +1 -0
  68. package/build-module/dataform-controls/text.js +38 -0
  69. package/build-module/dataform-controls/text.js.map +1 -0
  70. package/build-module/dataforms-layouts/panel/index.js +6 -3
  71. package/build-module/dataforms-layouts/panel/index.js.map +1 -1
  72. package/build-module/dataforms-layouts/regular/index.js +6 -3
  73. package/build-module/dataforms-layouts/regular/index.js.map +1 -1
  74. package/build-module/dataviews-layouts/grid/density-picker.js +25 -56
  75. package/build-module/dataviews-layouts/grid/density-picker.js.map +1 -1
  76. package/build-module/dataviews-layouts/grid/index.js +1 -1
  77. package/build-module/dataviews-layouts/grid/index.js.map +1 -1
  78. package/build-module/dataviews-layouts/list/index.js +5 -2
  79. package/build-module/dataviews-layouts/list/index.js.map +1 -1
  80. package/build-module/dataviews-layouts/table/column-header-menu.js +2 -5
  81. package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -1
  82. package/build-module/field-types/datetime.js +24 -0
  83. package/build-module/field-types/datetime.js.map +1 -0
  84. package/build-module/field-types/index.js +4 -0
  85. package/build-module/field-types/index.js.map +1 -1
  86. package/build-module/field-types/integer.js +2 -60
  87. package/build-module/field-types/integer.js.map +1 -1
  88. package/build-module/field-types/text.js +2 -60
  89. package/build-module/field-types/text.js.map +1 -1
  90. package/build-module/normalize-fields.js +7 -7
  91. package/build-module/normalize-fields.js.map +1 -1
  92. package/build-module/types.js.map +1 -1
  93. package/build-style/style-rtl.css +15 -18
  94. package/build-style/style.css +15 -18
  95. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
  96. package/build-types/components/dataviews/index.d.ts.map +1 -1
  97. package/build-types/components/dataviews/stories/fixtures.d.ts +22 -3
  98. package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
  99. package/build-types/components/dataviews/stories/index.story.d.ts +9 -0
  100. package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
  101. package/build-types/components/dataviews-filters/index.d.ts +1 -1
  102. package/build-types/components/dataviews-filters/index.d.ts.map +1 -1
  103. package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
  104. package/build-types/components/dataviews-pagination/index.d.ts.map +1 -1
  105. package/build-types/components/dataviews-view-config/index.d.ts +4 -3
  106. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
  107. package/build-types/dataform-controls/datetime.d.ts +6 -0
  108. package/build-types/dataform-controls/datetime.d.ts.map +1 -0
  109. package/build-types/dataform-controls/index.d.ts +11 -0
  110. package/build-types/dataform-controls/index.d.ts.map +1 -0
  111. package/build-types/dataform-controls/integer.d.ts +6 -0
  112. package/build-types/dataform-controls/integer.d.ts.map +1 -0
  113. package/build-types/dataform-controls/radio.d.ts +6 -0
  114. package/build-types/dataform-controls/radio.d.ts.map +1 -0
  115. package/build-types/dataform-controls/select.d.ts +6 -0
  116. package/build-types/dataform-controls/select.d.ts.map +1 -0
  117. package/build-types/dataform-controls/text.d.ts +6 -0
  118. package/build-types/dataform-controls/text.d.ts.map +1 -0
  119. package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -1
  120. package/build-types/dataforms-layouts/regular/index.d.ts.map +1 -1
  121. package/build-types/dataviews-layouts/grid/density-picker.d.ts.map +1 -1
  122. package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
  123. package/build-types/dataviews-layouts/table/column-header-menu.d.ts.map +1 -1
  124. package/build-types/field-types/datetime.d.ts +13 -0
  125. package/build-types/field-types/datetime.d.ts.map +1 -0
  126. package/build-types/field-types/index.d.ts +1 -1
  127. package/build-types/field-types/index.d.ts.map +1 -1
  128. package/build-types/field-types/integer.d.ts +2 -3
  129. package/build-types/field-types/integer.d.ts.map +1 -1
  130. package/build-types/field-types/text.d.ts +2 -3
  131. package/build-types/field-types/text.d.ts.map +1 -1
  132. package/build-types/normalize-fields.d.ts.map +1 -1
  133. package/build-types/types.d.ts +41 -21
  134. package/build-types/types.d.ts.map +1 -1
  135. package/package.json +12 -12
  136. package/src/components/dataform/stories/index.story.tsx +43 -2
  137. package/src/components/dataviews/index.tsx +13 -13
  138. package/src/components/dataviews/stories/fixtures.js +29 -1
  139. package/src/components/dataviews/stories/index.story.js +7 -1
  140. package/src/components/dataviews/style.scss +0 -12
  141. package/src/components/dataviews-bulk-actions-toolbar/style.scss +1 -1
  142. package/src/components/dataviews-filters/index.tsx +3 -0
  143. package/src/components/dataviews-filters/search-widget.tsx +1 -8
  144. package/src/components/dataviews-filters/style.scss +1 -1
  145. package/src/components/dataviews-pagination/index.tsx +35 -16
  146. package/src/components/dataviews-pagination/style.scss +9 -4
  147. package/src/components/dataviews-view-config/index.tsx +45 -16
  148. package/src/dataform-controls/datetime.tsx +43 -0
  149. package/src/dataform-controls/index.tsx +61 -0
  150. package/src/dataform-controls/integer.tsx +38 -0
  151. package/src/dataform-controls/radio.tsx +42 -0
  152. package/src/dataform-controls/select.tsx +52 -0
  153. package/src/dataform-controls/style.scss +4 -0
  154. package/src/dataform-controls/text.tsx +40 -0
  155. package/src/dataforms-layouts/panel/index.tsx +6 -2
  156. package/src/dataforms-layouts/regular/index.tsx +6 -2
  157. package/src/dataviews-layouts/grid/density-picker.tsx +33 -67
  158. package/src/dataviews-layouts/grid/index.tsx +1 -1
  159. package/src/dataviews-layouts/grid/style.scss +0 -4
  160. package/src/dataviews-layouts/list/index.tsx +6 -2
  161. package/src/dataviews-layouts/table/column-header-menu.tsx +3 -5
  162. package/src/field-types/datetime.tsx +28 -0
  163. package/src/field-types/index.tsx +5 -0
  164. package/src/field-types/integer.tsx +2 -71
  165. package/src/field-types/text.tsx +2 -70
  166. package/src/normalize-fields.ts +8 -10
  167. package/src/style.scss +1 -0
  168. package/src/test/filter-and-sort-data-view.js +28 -0
  169. package/src/types.ts +54 -32
  170. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+
5
+ function sort(a, b, direction) {
6
+ const timeA = new Date(a).getTime();
7
+ const timeB = new Date(b).getTime();
8
+ return direction === 'asc' ? timeA - timeB : timeB - timeA;
9
+ }
10
+ function isValid(value, context) {
11
+ if (context?.elements) {
12
+ const validValues = context?.elements.map(f => f.value);
13
+ if (!validValues.includes(value)) {
14
+ return false;
15
+ }
16
+ }
17
+ return true;
18
+ }
19
+ export default {
20
+ sort,
21
+ isValid,
22
+ Edit: 'datetime'
23
+ };
24
+ //# sourceMappingURL=datetime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sort","a","b","direction","timeA","Date","getTime","timeB","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/datetime.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\n\nfunction sort( a: any, b: any, direction: SortDirection ) {\n\tconst timeA = new Date( a ).getTime();\n\tconst timeB = new Date( b ).getTime();\n\n\treturn direction === 'asc' ? timeA - timeB : timeB - timeA;\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'datetime',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,EAAG;EACzD,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAAEJ,CAAE,CAAC,CAACK,OAAO,CAAC,CAAC;EACrC,MAAMC,KAAK,GAAG,IAAIF,IAAI,CAAEH,CAAE,CAAC,CAACI,OAAO,CAAC,CAAC;EAErC,OAAOH,SAAS,KAAK,KAAK,GAAGC,KAAK,GAAGG,KAAK,GAAGA,KAAK,GAAGH,KAAK;AAC3D;AAEA,SAASI,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D,IAAKA,OAAO,EAAEC,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,CAACE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;IAC7D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;MACtC,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdT,IAAI;EACJQ,OAAO;EACPQ,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { default as integer } from './integer';
6
6
  import { default as text } from './text';
7
+ import { default as datetime } from './datetime';
7
8
 
8
9
  /**
9
10
  *
@@ -18,6 +19,9 @@ export default function getFieldTypeDefinition(type) {
18
19
  if ('text' === type) {
19
20
  return text;
20
21
  }
22
+ if ('datetime' === type) {
23
+ return datetime;
24
+ }
21
25
  return {
22
26
  sort: (a, b, direction) => {
23
27
  if (typeof a === 'number' && typeof b === 'number') {
@@ -1 +1 @@
1
- {"version":3,"names":["default","integer","text","getFieldTypeDefinition","type","sort","a","b","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { FieldType, SortDirection, ValidationContext } from '../types';\nimport { default as integer } from './integer';\nimport { default as text } from './text';\n\n/**\n *\n * @param {FieldType} type The field type definition to get.\n *\n * @return A field type definition.\n */\nexport default function getFieldTypeDefinition( type?: FieldType ) {\n\tif ( 'integer' === type ) {\n\t\treturn integer;\n\t}\n\n\tif ( 'text' === type ) {\n\t\treturn text;\n\t}\n\n\treturn {\n\t\tsort: ( a: any, b: any, direction: SortDirection ) => {\n\t\t\tif ( typeof a === 'number' && typeof b === 'number' ) {\n\t\t\t\treturn direction === 'asc' ? a - b : b - a;\n\t\t\t}\n\n\t\t\treturn direction === 'asc'\n\t\t\t\t? a.localeCompare( b )\n\t\t\t\t: b.localeCompare( a );\n\t\t},\n\t\tisValid: ( value: any, context?: ValidationContext ) => {\n\t\t\tif ( context?.elements ) {\n\t\t\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\tEdit: () => null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,IAAI,QAAQ,QAAQ;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,sBAAsBA,CAAEC,IAAgB,EAAG;EAClE,IAAK,SAAS,KAAKA,IAAI,EAAG;IACzB,OAAOH,OAAO;EACf;EAEA,IAAK,MAAM,KAAKG,IAAI,EAAG;IACtB,OAAOF,IAAI;EACZ;EAEA,OAAO;IACNG,IAAI,EAAEA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,KAAM;MACrD,IAAK,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAG;QACrD,OAAOC,SAAS,KAAK,KAAK,GAAGF,CAAC,GAAGC,CAAC,GAAGA,CAAC,GAAGD,CAAC;MAC3C;MAEA,OAAOE,SAAS,KAAK,KAAK,GACvBF,CAAC,CAACG,aAAa,CAAEF,CAAE,CAAC,GACpBA,CAAC,CAACE,aAAa,CAAEH,CAAE,CAAC;IACxB,CAAC;IACDI,OAAO,EAAEA,CAAEC,KAAU,EAAEC,OAA2B,KAAM;MACvD,IAAKA,OAAO,EAAEC,QAAQ,EAAG;QACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,EAAEE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;QAC9D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;UACtC,OAAO,KAAK;QACb;MACD;MAEA,OAAO,IAAI;IACZ,CAAC;IACDO,IAAI,EAAEA,CAAA,KAAM;EACb,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["default","integer","text","datetime","getFieldTypeDefinition","type","sort","a","b","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { FieldType, SortDirection, ValidationContext } from '../types';\nimport { default as integer } from './integer';\nimport { default as text } from './text';\nimport { default as datetime } from './datetime';\n\n/**\n *\n * @param {FieldType} type The field type definition to get.\n *\n * @return A field type definition.\n */\nexport default function getFieldTypeDefinition( type?: FieldType ) {\n\tif ( 'integer' === type ) {\n\t\treturn integer;\n\t}\n\n\tif ( 'text' === type ) {\n\t\treturn text;\n\t}\n\n\tif ( 'datetime' === type ) {\n\t\treturn datetime;\n\t}\n\n\treturn {\n\t\tsort: ( a: any, b: any, direction: SortDirection ) => {\n\t\t\tif ( typeof a === 'number' && typeof b === 'number' ) {\n\t\t\t\treturn direction === 'asc' ? a - b : b - a;\n\t\t\t}\n\n\t\t\treturn direction === 'asc'\n\t\t\t\t? a.localeCompare( b )\n\t\t\t\t: b.localeCompare( a );\n\t\t},\n\t\tisValid: ( value: any, context?: ValidationContext ) => {\n\t\t\tif ( context?.elements ) {\n\t\t\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\tEdit: () => null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,IAAI,QAAQ,QAAQ;AACxC,SAASF,OAAO,IAAIG,QAAQ,QAAQ,YAAY;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,sBAAsBA,CAAEC,IAAgB,EAAG;EAClE,IAAK,SAAS,KAAKA,IAAI,EAAG;IACzB,OAAOJ,OAAO;EACf;EAEA,IAAK,MAAM,KAAKI,IAAI,EAAG;IACtB,OAAOH,IAAI;EACZ;EAEA,IAAK,UAAU,KAAKG,IAAI,EAAG;IAC1B,OAAOF,QAAQ;EAChB;EAEA,OAAO;IACNG,IAAI,EAAEA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,KAAM;MACrD,IAAK,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAG;QACrD,OAAOC,SAAS,KAAK,KAAK,GAAGF,CAAC,GAAGC,CAAC,GAAGA,CAAC,GAAGD,CAAC;MAC3C;MAEA,OAAOE,SAAS,KAAK,KAAK,GACvBF,CAAC,CAACG,aAAa,CAAEF,CAAE,CAAC,GACpBA,CAAC,CAACE,aAAa,CAAEH,CAAE,CAAC;IACxB,CAAC;IACDI,OAAO,EAAEA,CAAEC,KAAU,EAAEC,OAA2B,KAAM;MACvD,IAAKA,OAAO,EAAEC,QAAQ,EAAG;QACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,EAAEE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;QAC9D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;UACtC,OAAO,KAAK;QACb;MACD;MAEA,OAAO,IAAI;IACZ,CAAC;IACDO,IAAI,EAAEA,CAAA,KAAM;EACb,CAAC;AACF","ignoreList":[]}
@@ -1,14 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __experimentalNumberControl as NumberControl, SelectControl } from '@wordpress/components';
5
- import { useCallback } from '@wordpress/element';
6
- import { __ } from '@wordpress/i18n';
7
-
8
1
  /**
9
2
  * Internal dependencies
10
3
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
4
+
12
5
  function sort(a, b, direction) {
13
6
  return direction === 'asc' ? a - b : b - a;
14
7
  }
@@ -28,60 +21,9 @@ function isValid(value, context) {
28
21
  }
29
22
  return true;
30
23
  }
31
- function Edit({
32
- data,
33
- field,
34
- onChange,
35
- hideLabelFromVision
36
- }) {
37
- var _field$getValue;
38
- const {
39
- id,
40
- label,
41
- description
42
- } = field;
43
- const value = (_field$getValue = field.getValue({
44
- item: data
45
- })) !== null && _field$getValue !== void 0 ? _field$getValue : '';
46
- const onChangeControl = useCallback(newValue => onChange(prevItem => ({
47
- ...prevItem,
48
- [id]: newValue
49
- })), [id, onChange]);
50
- if (field.elements) {
51
- const elements = [
52
- /*
53
- * Value can be undefined when:
54
- *
55
- * - the field is not required
56
- * - in bulk editing
57
- *
58
- */
59
- {
60
- label: __('Select item'),
61
- value: ''
62
- }, ...field.elements];
63
- return /*#__PURE__*/_jsx(SelectControl, {
64
- label: label,
65
- value: value,
66
- options: elements,
67
- onChange: onChangeControl,
68
- __next40pxDefaultSize: true,
69
- __nextHasNoMarginBottom: true,
70
- hideLabelFromVision: hideLabelFromVision
71
- });
72
- }
73
- return /*#__PURE__*/_jsx(NumberControl, {
74
- label: label,
75
- help: description,
76
- value: value,
77
- onChange: onChangeControl,
78
- __next40pxDefaultSize: true,
79
- hideLabelFromVision: hideLabelFromVision
80
- });
81
- }
82
24
  export default {
83
25
  sort,
84
26
  isValid,
85
- Edit
27
+ Edit: 'integer'
86
28
  };
87
29
  //# sourceMappingURL=integer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalNumberControl","NumberControl","SelectControl","useCallback","__","jsx","_jsx","sort","a","b","direction","isValid","value","context","Number","isInteger","elements","validValues","map","f","includes","Edit","data","field","onChange","hideLabelFromVision","_field$getValue","id","label","description","getValue","item","onChangeControl","newValue","prevItem","options","__next40pxDefaultSize","__nextHasNoMarginBottom","help"],"sources":["@wordpress/dataviews/src/field-types/integer.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNumberControl as NumberControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tSortDirection,\n\tValidationContext,\n\tDataFormControlProps,\n} from '../types';\n\nfunction sort( a: any, b: any, direction: SortDirection ) {\n\treturn direction === 'asc' ? a - b : b - a;\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\t// TODO: this implicitely means the value is required.\n\tif ( value === '' ) {\n\t\treturn false;\n\t}\n\n\tif ( ! Number.isInteger( Number( value ) ) ) {\n\t\treturn false;\n\t}\n\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( Number( value ) ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction Edit< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n}: DataFormControlProps< Item > ) {\n\tconst { id, label, description } = field;\n\tconst value = field.getValue( { item: data } ) ?? '';\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string | undefined ) =>\n\t\t\tonChange( ( prevItem: Item ) => ( {\n\t\t\t\t...prevItem,\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ) ),\n\t\t[ id, onChange ]\n\t);\n\n\tif ( field.elements ) {\n\t\tconst elements = [\n\t\t\t/*\n\t\t\t * Value can be undefined when:\n\t\t\t *\n\t\t\t * - the field is not required\n\t\t\t * - in bulk editing\n\t\t\t *\n\t\t\t */\n\t\t\t{ label: __( 'Select item' ), value: '' },\n\t\t\t...field.elements,\n\t\t];\n\n\t\treturn (\n\t\t\t<SelectControl\n\t\t\t\tlabel={ label }\n\t\t\t\tvalue={ value }\n\t\t\t\toptions={ elements }\n\t\t\t\tonChange={ onChangeControl }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<NumberControl\n\t\t\tlabel={ label }\n\t\t\thelp={ description }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChangeControl }\n\t\t\t__next40pxDefaultSize\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,2BAA2B,IAAIC,aAAa,EAC5CC,aAAa,QACP,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,oB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AEN,EAAE,EAAEH,QAAQ,CACf,CAAC;EAED,IAAKD,KAAK,CAACP,QAAQ,EAAG;IACrB,MAAMA,QAAQ,GAAG;IAChB;AACH;AACA;AACA;AACA;AACA;AACA;IACG;MAAEY,KAAK,EAAExB,EAAE,CAAE,aAAc,CAAC;MAAEQ,KAAK,EAAE;IAAG,CAAC,EACzC,GAAGW,KAAK,CAACP,QAAQ,CACjB;IAED,oBACCV,IAAA,CAACJ,aAAa;MACb0B,KAAK,EAAGA,KAAO;MACfhB,KAAK,EAAGA,KAAO;MACfuB,OAAO,EAAGnB,QAAU;MACpBQ,QAAQ,EAAGQ,eAAiB;MAC5BI,qBAAqB;MACrBC,uBAAuB;MACvBZ,mBAAmB,EAAGA;IAAqB,CAC3C,CAAC;EAEJ;EAEA,oBACCnB,IAAA,CAACL,aAAa;IACb2B,KAAK,EAAGA,KAAO;IACfU,IAAI,EAAGT,WAAa;IACpBjB,KAAK,EAAGA,KAAO;IACfY,QAAQ,EAAGQ,eAAiB;IAC5BI,qBAAqB;IACrBX,mBAAmB,EAAGA;EAAqB,CAC3C,CAAC;AAEJ;AAEA,eAAe;EACdlB,IAAI;EACJI,OAAO;EACPU;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["sort","a","b","direction","isValid","value","context","Number","isInteger","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/integer.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\n\nfunction sort( a: any, b: any, direction: SortDirection ) {\n\treturn direction === 'asc' ? a - b : b - a;\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\t// TODO: this implicitely means the value is required.\n\tif ( value === '' ) {\n\t\treturn false;\n\t}\n\n\tif ( ! Number.isInteger( Number( value ) ) ) {\n\t\treturn false;\n\t}\n\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( Number( value ) ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'integer',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,EAAG;EACzD,OAAOA,SAAS,KAAK,KAAK,GAAGF,CAAC,GAAGC,CAAC,GAAGA,CAAC,GAAGD,CAAC;AAC3C;AAEA,SAASG,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D;EACA,IAAKD,KAAK,KAAK,EAAE,EAAG;IACnB,OAAO,KAAK;EACb;EAEA,IAAK,CAAEE,MAAM,CAACC,SAAS,CAAED,MAAM,CAAEF,KAAM,CAAE,CAAC,EAAG;IAC5C,OAAO,KAAK;EACb;EAEA,IAAKC,OAAO,EAAEG,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGJ,OAAO,EAAEG,QAAQ,CAACE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACP,KAAM,CAAC;IAC7D,IAAK,CAAEK,WAAW,CAACG,QAAQ,CAAEN,MAAM,CAAEF,KAAM,CAAE,CAAC,EAAG;MAChD,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdL,IAAI;EACJI,OAAO;EACPU,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
@@ -1,14 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { SelectControl, TextControl } from '@wordpress/components';
5
- import { useCallback } from '@wordpress/element';
6
- import { __ } from '@wordpress/i18n';
7
-
8
1
  /**
9
2
  * Internal dependencies
10
3
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
4
+
12
5
  function sort(valueA, valueB, direction) {
13
6
  return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
14
7
  }
@@ -21,60 +14,9 @@ function isValid(value, context) {
21
14
  }
22
15
  return true;
23
16
  }
24
- function Edit({
25
- data,
26
- field,
27
- onChange,
28
- hideLabelFromVision
29
- }) {
30
- const {
31
- id,
32
- label,
33
- placeholder
34
- } = field;
35
- const value = field.getValue({
36
- item: data
37
- });
38
- const onChangeControl = useCallback(newValue => onChange(prevItem => ({
39
- ...prevItem,
40
- [id]: newValue
41
- })), [id, onChange]);
42
- if (field.elements) {
43
- const elements = [
44
- /*
45
- * Value can be undefined when:
46
- *
47
- * - the field is not required
48
- * - in bulk editing
49
- *
50
- */
51
- {
52
- label: __('Select item'),
53
- value: ''
54
- }, ...field.elements];
55
- return /*#__PURE__*/_jsx(SelectControl, {
56
- label: label,
57
- value: value,
58
- options: elements,
59
- onChange: onChangeControl,
60
- __next40pxDefaultSize: true,
61
- __nextHasNoMarginBottom: true,
62
- hideLabelFromVision: hideLabelFromVision
63
- });
64
- }
65
- return /*#__PURE__*/_jsx(TextControl, {
66
- label: label,
67
- placeholder: placeholder,
68
- value: value !== null && value !== void 0 ? value : '',
69
- onChange: onChangeControl,
70
- __next40pxDefaultSize: true,
71
- __nextHasNoMarginBottom: true,
72
- hideLabelFromVision: hideLabelFromVision
73
- });
74
- }
75
17
  export default {
76
18
  sort,
77
19
  isValid,
78
- Edit
20
+ Edit: 'text'
79
21
  };
80
22
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SelectControl","TextControl","useCallback","__","jsx","_jsx","sort","valueA","valueB","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit","data","field","onChange","hideLabelFromVision","id","label","placeholder","getValue","item","onChangeControl","newValue","prevItem","options","__next40pxDefaultSize","__nextHasNoMarginBottom"],"sources":["@wordpress/dataviews/src/field-types/text.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tSortDirection,\n\tValidationContext,\n\tDataFormControlProps,\n} from '../types';\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\nfunction isValid( value: any, context?: ValidationContext ) {\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction Edit< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n}: DataFormControlProps< Item > ) {\n\tconst { id, label, placeholder } = field;\n\tconst value = field.getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( ( prevItem: Item ) => ( {\n\t\t\t\t...prevItem,\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ) ),\n\t\t[ id, onChange ]\n\t);\n\n\tif ( field.elements ) {\n\t\tconst elements = [\n\t\t\t/*\n\t\t\t * Value can be undefined when:\n\t\t\t *\n\t\t\t * - the field is not required\n\t\t\t * - in bulk editing\n\t\t\t *\n\t\t\t */\n\t\t\t{ label: __( 'Select item' ), value: '' },\n\t\t\t...field.elements,\n\t\t];\n\n\t\treturn (\n\t\t\t<SelectControl\n\t\t\t\tlabel={ label }\n\t\t\t\tvalue={ value }\n\t\t\t\toptions={ elements }\n\t\t\t\tonChange={ onChangeControl }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ label }\n\t\t\tplaceholder={ placeholder }\n\t\t\tvalue={ value ?? '' }\n\t\t\tonChange={ onChangeControl }\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit,\n};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A;AACA;AACA;IACG;MAAEW,KAAK,EAAEtB,EAAE,CAAE,aAAc,CAAC;MAAES,KAAK,EAAE;IAAG,CAAC,EACzC,GAAGS,KAAK,CAACP,QAAQ,CACjB;IAED,oBACCT,IAAA,CAACL,aAAa;MACbyB,KAAK,EAAGA,KAAO;MACfb,KAAK,EAAGA,KAAO;MACfoB,OAAO,EAAGlB,QAAU;MACpBQ,QAAQ,EAAGO,eAAiB;MAC5BI,qBAAqB;MACrBC,uBAAuB;MACvBX,mBAAmB,EAAGA;IAAqB,CAC3C,CAAC;EAEJ;EAEA,oBACClB,IAAA,CAACJ,WAAW;IACXwB,KAAK,EAAGA,KAAO;IACfC,WAAW,EAAGA,WAAa;IAC3Bd,KAAK,EAAGA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAI;IACrBU,QAAQ,EAAGO,eAAiB;IAC5BI,qBAAqB;IACrBC,uBAAuB;IACvBX,mBAAmB,EAAGA;EAAqB,CAC3C,CAAC;AAEJ;AAEA,eAAe;EACdjB,IAAI;EACJK,OAAO;EACPQ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["sort","valueA","valueB","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/text.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\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\nfunction isValid( value: any, context?: ValidationContext ) {\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'text',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,MAAW,EAAEC,MAAW,EAAEC,SAAwB,EAAG;EACnE,OAAOA,SAAS,KAAK,KAAK,GACvBF,MAAM,CAACG,aAAa,CAAEF,MAAO,CAAC,GAC9BA,MAAM,CAACE,aAAa,CAAEH,MAAO,CAAC;AAClC;AAEA,SAASI,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D,IAAKA,OAAO,EAAEC,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,EAAEE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;IAC9D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;MACtC,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdN,IAAI;EACJK,OAAO;EACPQ,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
@@ -2,6 +2,8 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import getFieldTypeDefinition from './field-types';
5
+ import { getControl } from './dataform-controls';
6
+
5
7
  /**
6
8
  * Apply default values and normalize the fields config.
7
9
  *
@@ -27,24 +29,22 @@ export function normalizeFields(fields) {
27
29
  item
28
30
  }), context);
29
31
  };
30
- const Edit = field.Edit || fieldTypeDefinition.Edit;
32
+ const Edit = getControl(field, fieldTypeDefinition);
31
33
  const renderFromElements = ({
32
34
  item
33
35
  }) => {
34
36
  const value = getValue({
35
37
  item
36
38
  });
37
- const label = field?.elements?.find(element => {
38
- // Intentionally using == here to allow for type coercion.
39
- // eslint-disable-next-line eqeqeq
40
- return element.value == value;
41
- })?.label;
42
- return label || value;
39
+ return field?.elements?.find(element => element.value === value)?.label || getValue({
40
+ item
41
+ });
43
42
  };
44
43
  const render = field.render || (field.elements ? renderFromElements : getValue);
45
44
  return {
46
45
  ...field,
47
46
  label: field.label || field.id,
47
+ header: field.header || field.label || field.id,
48
48
  getValue,
49
49
  render,
50
50
  sort,
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldTypeDefinition","normalizeFields","fields","map","field","_field$sort","_field$isValid","fieldTypeDefinition","type","getValue","item","id","sort","a","b","direction","isValid","context","Edit","renderFromElements","value","label","elements","find","element","render"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type { Field, NormalizedField } 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 fieldTypeDefinition = getFieldTypeDefinition( field.type );\n\n\t\tconst getValue =\n\t\t\tfield.getValue ||\n\t\t\t( ( { item }: { item: Item } ) => item[ field.id as keyof Item ] );\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 = field.Edit || fieldTypeDefinition.Edit;\n\n\t\tconst renderFromElements = ( { item }: { item: Item } ) => {\n\t\t\tconst value = getValue( { item } );\n\t\t\tconst label = field?.elements?.find( ( element ) => {\n\t\t\t\t// Intentionally using == here to allow for type coercion.\n\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\treturn element.value == value;\n\t\t\t} )?.label;\n\n\t\t\treturn label || value;\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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MU,KAAK,GAAGX,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC;MAClC,MAAMW,KAAK,GAAGjB,KAAK,EAAEkB,QAAQ,EAAEC,IAAI,CAAIC,OAAO,IAAM;QACnD;QACA;QACA,OAAOA,OAAO,CAACJ,KAAK,IAAIA,KAAK;MAC9B,CAAE,CAAC,EAAEC,KAAK;MAEV,OAAOA,KAAK,IAAID,KAAK;IACtB,CAAC;IAED,MAAMK,MAAM,GACXrB,KAAK,CAACqB,MAAM,KAAMrB,KAAK,CAACkB,QAAQ,GAAGH,kBAAkB,GAAGV,QAAQ,CAAE;IAEnE,OAAO;MACN,GAAGL,KAAK;MACRiB,KAAK,EAAEjB,KAAK,CAACiB,KAAK,IAAIjB,KAAK,CAACO,EAAE;MAC9BF,QAAQ;MACRgB,MAAM;MACNb,IAAI;MACJI,OAAO;MACPE;IACD,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,CA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1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tComponentType,\n\tDispatch,\n\tSetStateAction,\n} 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' | 'integer';\n\nexport type ValidationContext = {\n\telements?: Option[];\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 * 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 > >;\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} & ( 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\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: Dispatch< SetStateAction< Item > >;\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\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\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: Dispatch< SetStateAction< Item > >;\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":[]}
@@ -37,10 +37,10 @@
37
37
  * Radius scale.
38
38
  */
39
39
  /**
40
- * Dimensions.
40
+ * Elevation scale.
41
41
  */
42
42
  /**
43
- * Shadows.
43
+ * Dimensions.
44
44
  */
45
45
  /**
46
46
  * Editor widths.
@@ -134,10 +134,6 @@
134
134
  transition-delay: 0s;
135
135
  }
136
136
  }
137
- .dataviews__view-actions .components-search-control .components-base-control__field,
138
- .dataviews-filters__container .components-search-control .components-base-control__field {
139
- max-width: 240px;
140
- }
141
137
 
142
138
  .dataviews-view-list__primary-field,
143
139
  .dataviews-view-grid__primary-field,
@@ -213,10 +209,6 @@
213
209
  .dataviews-filters__container {
214
210
  padding: 12px 24px;
215
211
  }
216
- .dataviews__view-actions .components-search-control .components-base-control__field,
217
- .dataviews-filters__container .components-search-control .components-base-control__field {
218
- max-width: 112px;
219
- }
220
212
 
221
213
  .dataviews-view-grid,
222
214
  .dataviews-no-results,
@@ -549,7 +541,6 @@
549
541
  background-color: #fff;
550
542
  padding: 12px 48px;
551
543
  border-top: 1px solid #f0f0f0;
552
- color: #757575;
553
544
  flex-shrink: 0;
554
545
  transition: padding ease-out 0.1s;
555
546
  }
@@ -560,11 +551,16 @@
560
551
  }
561
552
  }
562
553
 
563
- .dataviews-pagination__page-selection {
554
+ .dataviews-pagination__page-select {
564
555
  font-size: 11px;
565
- text-transform: uppercase;
566
556
  font-weight: 500;
567
- 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
+ }
568
564
  }
569
565
 
570
566
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
@@ -766,10 +762,6 @@
766
762
  }
767
763
  }
768
764
 
769
- .dataviews-density-picker__range-control {
770
- width: 200px;
771
- }
772
-
773
765
  .dataviews-view-grid__field-value:empty,
774
766
  .dataviews-view-grid__field:empty {
775
767
  display: none;
@@ -1108,6 +1100,11 @@
1108
1100
  }
1109
1101
  }
1110
1102
 
1103
+ .dataviews-controls__datetime {
1104
+ border: none;
1105
+ padding: 0;
1106
+ }
1107
+
1111
1108
  .dataforms-layouts-panel__field {
1112
1109
  width: 100%;
1113
1110
  min-height: 32px;
@@ -37,10 +37,10 @@
37
37
  * Radius scale.
38
38
  */
39
39
  /**
40
- * Dimensions.
40
+ * Elevation scale.
41
41
  */
42
42
  /**
43
- * Shadows.
43
+ * Dimensions.
44
44
  */
45
45
  /**
46
46
  * Editor widths.
@@ -134,10 +134,6 @@
134
134
  transition-delay: 0s;
135
135
  }
136
136
  }
137
- .dataviews__view-actions .components-search-control .components-base-control__field,
138
- .dataviews-filters__container .components-search-control .components-base-control__field {
139
- max-width: 240px;
140
- }
141
137
 
142
138
  .dataviews-view-list__primary-field,
143
139
  .dataviews-view-grid__primary-field,
@@ -213,10 +209,6 @@
213
209
  .dataviews-filters__container {
214
210
  padding: 12px 24px;
215
211
  }
216
- .dataviews__view-actions .components-search-control .components-base-control__field,
217
- .dataviews-filters__container .components-search-control .components-base-control__field {
218
- max-width: 112px;
219
- }
220
212
 
221
213
  .dataviews-view-grid,
222
214
  .dataviews-no-results,
@@ -549,7 +541,6 @@
549
541
  background-color: #fff;
550
542
  padding: 12px 48px;
551
543
  border-top: 1px solid #f0f0f0;
552
- color: #757575;
553
544
  flex-shrink: 0;
554
545
  transition: padding ease-out 0.1s;
555
546
  }
@@ -560,11 +551,16 @@
560
551
  }
561
552
  }
562
553
 
563
- .dataviews-pagination__page-selection {
554
+ .dataviews-pagination__page-select {
564
555
  font-size: 11px;
565
- text-transform: uppercase;
566
556
  font-weight: 500;
567
- 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
+ }
568
564
  }
569
565
 
570
566
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
@@ -766,10 +762,6 @@
766
762
  }
767
763
  }
768
764
 
769
- .dataviews-density-picker__range-control {
770
- width: 200px;
771
- }
772
-
773
765
  .dataviews-view-grid__field-value:empty,
774
766
  .dataviews-view-grid__field:empty {
775
767
  display: none;
@@ -1108,6 +1100,11 @@
1108
1100
  }
1109
1101
  }
1110
1102
 
1103
+ .dataviews-controls__datetime {
1104
+ border: none;
1105
+ padding: 0;
1106
+ }
1107
+
1111
1108
  .dataforms-layouts-panel__field {
1112
1109
  width: 100%;
1113
1110
  min-height: 32px;
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;;;;;;CAWT,CAAC;AACF,eAAe,IAAI,CAAC;AAiCpB,eAAO,MAAM,OAAO,aAAe;IAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,gCAuB/D,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;;;;;;CAWT,CAAC;AACF,eAAe,IAAI,CAAC;AA0DpB,eAAO,MAAM,OAAO,aAAe;IAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,gCAuC/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews/index.tsx"],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;CAAE,GACxC;IAAE,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAA;CAAE,CAAE,CAAC;AAI7C,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAAI,EAC1C,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,MAAa,EACb,WAAuB,EACvB,OAAY,EACZ,IAAI,EACJ,SAA4B,EAC5B,SAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,EAAE,iBAAiB,EAC5B,iBAAiB,EACjB,MAAM,GACN,EAAE,cAAc,CAAE,IAAI,CAAE,+BA0FxB"}
@@ -6,6 +6,7 @@ export const data: {
6
6
  type: string;
7
7
  categories: string[];
8
8
  satellites: number;
9
+ date: string;
9
10
  }[];
10
11
  export namespace DEFAULT_VIEW {
11
12
  export { LAYOUT_TABLE as type };
@@ -39,14 +40,15 @@ export const actions: ({
39
40
  export const fields: ({
40
41
  label: string;
41
42
  id: string;
43
+ header: import("react").JSX.Element;
42
44
  render: ({ item }: {
43
45
  item: any;
44
46
  }) => import("react").JSX.Element;
45
47
  enableSorting: boolean;
46
48
  enableHiding?: undefined;
47
49
  enableGlobalSearch?: undefined;
48
- elements?: undefined;
49
50
  type?: undefined;
51
+ elements?: undefined;
50
52
  filterBy?: undefined;
51
53
  getValue?: undefined;
52
54
  } | {
@@ -54,10 +56,23 @@ export const fields: ({
54
56
  id: string;
55
57
  enableHiding: boolean;
56
58
  enableGlobalSearch: boolean;
59
+ header?: undefined;
57
60
  render?: undefined;
58
61
  enableSorting?: undefined;
59
- elements?: undefined;
60
62
  type?: undefined;
63
+ elements?: undefined;
64
+ filterBy?: undefined;
65
+ getValue?: undefined;
66
+ } | {
67
+ id: string;
68
+ label: string;
69
+ type: string;
70
+ header?: undefined;
71
+ render?: undefined;
72
+ enableSorting?: undefined;
73
+ enableHiding?: undefined;
74
+ enableGlobalSearch?: undefined;
75
+ elements?: undefined;
61
76
  filterBy?: undefined;
62
77
  getValue?: undefined;
63
78
  } | {
@@ -68,6 +83,7 @@ export const fields: ({
68
83
  value: string;
69
84
  label: string;
70
85
  }[];
86
+ header?: undefined;
71
87
  render?: undefined;
72
88
  enableSorting?: undefined;
73
89
  enableGlobalSearch?: undefined;
@@ -79,6 +95,7 @@ export const fields: ({
79
95
  id: string;
80
96
  type: string;
81
97
  enableSorting: boolean;
98
+ header?: undefined;
82
99
  render?: undefined;
83
100
  enableHiding?: undefined;
84
101
  enableGlobalSearch?: undefined;
@@ -90,15 +107,17 @@ export const fields: ({
90
107
  id: string;
91
108
  enableSorting: boolean;
92
109
  enableGlobalSearch: boolean;
110
+ header?: undefined;
93
111
  render?: undefined;
94
112
  enableHiding?: undefined;
95
- elements?: undefined;
96
113
  type?: undefined;
114
+ elements?: undefined;
97
115
  filterBy?: undefined;
98
116
  getValue?: undefined;
99
117
  } | {
100
118
  label: string;
101
119
  id: string;
120
+ header: import("react").JSX.Element;
102
121
  elements: {
103
122
  value: string;
104
123
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/fixtures.js"],"names":[],"mappings":"AAgBA;;;;;;;;IAoGE;;;;;;;;;;AAYF;;;;;;;;;;;;;;;;;;;KA8BE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6DE;6BA/M2B,oBAAoB"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/fixtures.js"],"names":[],"mappings":"AAgBA;;;;;;;;;IA+GE;;;;;;;;;;AAYF;;;;;;;;;;;;;;;;;;;KA8BE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8EE;6BA3O2B,oBAAoB"}