@wordpress/dataviews 4.8.0 → 4.9.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 (189) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/README.md +206 -17
  3. package/build/components/dataform/index.js +20 -8
  4. package/build/components/dataform/index.js.map +1 -1
  5. package/build/components/dataform-context/index.js +33 -0
  6. package/build/components/dataform-context/index.js.map +1 -0
  7. package/build/components/dataviews/index.js +3 -7
  8. package/build/components/dataviews/index.js.map +1 -1
  9. package/build/components/dataviews-context/index.js +1 -2
  10. package/build/components/dataviews-context/index.js.map +1 -1
  11. package/build/components/dataviews-filters/index.js +49 -31
  12. package/build/components/dataviews-filters/index.js.map +1 -1
  13. package/build/components/dataviews-item-actions/index.js +46 -20
  14. package/build/components/dataviews-item-actions/index.js.map +1 -1
  15. package/build/components/dataviews-layout/index.js +1 -3
  16. package/build/components/dataviews-layout/index.js.map +1 -1
  17. package/build/components/dataviews-view-config/index.js +4 -15
  18. package/build/components/dataviews-view-config/index.js.map +1 -1
  19. package/build/dataforms-layouts/data-form-layout.js +59 -0
  20. package/build/dataforms-layouts/data-form-layout.js.map +1 -0
  21. package/build/dataforms-layouts/index.js +4 -4
  22. package/build/dataforms-layouts/index.js.map +1 -1
  23. package/build/dataforms-layouts/is-combined-field.js +14 -0
  24. package/build/dataforms-layouts/is-combined-field.js.map +1 -0
  25. package/build/dataforms-layouts/panel/index.js +157 -72
  26. package/build/dataforms-layouts/panel/index.js.map +1 -1
  27. package/build/dataforms-layouts/regular/index.js +85 -19
  28. package/build/dataforms-layouts/regular/index.js.map +1 -1
  29. package/build/dataviews-layouts/grid/index.js +9 -9
  30. package/build/dataviews-layouts/grid/index.js.map +1 -1
  31. package/build/dataviews-layouts/grid/{density-picker.js → preview-size-picker.js} +40 -24
  32. package/build/dataviews-layouts/grid/preview-size-picker.js.map +1 -0
  33. package/build/dataviews-layouts/index.js +6 -2
  34. package/build/dataviews-layouts/index.js.map +1 -1
  35. package/build/dataviews-layouts/list/index.js +3 -2
  36. package/build/dataviews-layouts/list/index.js.map +1 -1
  37. package/build/dataviews-layouts/table/density-picker.js +51 -0
  38. package/build/dataviews-layouts/table/density-picker.js.map +1 -0
  39. package/build/dataviews-layouts/table/index.js +4 -1
  40. package/build/dataviews-layouts/table/index.js.map +1 -1
  41. package/build/normalize-fields.js +0 -21
  42. package/build/normalize-fields.js.map +1 -1
  43. package/build/normalize-form-fields.js +36 -0
  44. package/build/normalize-form-fields.js.map +1 -0
  45. package/build/types.js.map +1 -1
  46. package/build/validation.js.map +1 -1
  47. package/build-module/components/dataform/index.js +20 -8
  48. package/build-module/components/dataform/index.js.map +1 -1
  49. package/build-module/components/dataform-context/index.js +25 -0
  50. package/build-module/components/dataform-context/index.js.map +1 -0
  51. package/build-module/components/dataviews/index.js +4 -8
  52. package/build-module/components/dataviews/index.js.map +1 -1
  53. package/build-module/components/dataviews-context/index.js +1 -2
  54. package/build-module/components/dataviews-context/index.js.map +1 -1
  55. package/build-module/components/dataviews-filters/index.js +50 -32
  56. package/build-module/components/dataviews-filters/index.js.map +1 -1
  57. package/build-module/components/dataviews-item-actions/index.js +46 -20
  58. package/build-module/components/dataviews-item-actions/index.js.map +1 -1
  59. package/build-module/components/dataviews-layout/index.js +1 -3
  60. package/build-module/components/dataviews-layout/index.js.map +1 -1
  61. package/build-module/components/dataviews-view-config/index.js +5 -16
  62. package/build-module/components/dataviews-view-config/index.js.map +1 -1
  63. package/build-module/dataforms-layouts/data-form-layout.js +52 -0
  64. package/build-module/dataforms-layouts/data-form-layout.js.map +1 -0
  65. package/build-module/dataforms-layouts/index.js +7 -7
  66. package/build-module/dataforms-layouts/index.js.map +1 -1
  67. package/build-module/dataforms-layouts/is-combined-field.js +8 -0
  68. package/build-module/dataforms-layouts/is-combined-field.js.map +1 -0
  69. package/build-module/dataforms-layouts/panel/index.js +157 -71
  70. package/build-module/dataforms-layouts/panel/index.js.map +1 -1
  71. package/build-module/dataforms-layouts/regular/index.js +87 -20
  72. package/build-module/dataforms-layouts/regular/index.js.map +1 -1
  73. package/build-module/dataviews-layouts/grid/index.js +9 -9
  74. package/build-module/dataviews-layouts/grid/index.js.map +1 -1
  75. package/build-module/dataviews-layouts/grid/{density-picker.js → preview-size-picker.js} +38 -24
  76. package/build-module/dataviews-layouts/grid/preview-size-picker.js.map +1 -0
  77. package/build-module/dataviews-layouts/index.js +6 -2
  78. package/build-module/dataviews-layouts/index.js.map +1 -1
  79. package/build-module/dataviews-layouts/list/index.js +3 -2
  80. package/build-module/dataviews-layouts/list/index.js.map +1 -1
  81. package/build-module/dataviews-layouts/table/density-picker.js +43 -0
  82. package/build-module/dataviews-layouts/table/density-picker.js.map +1 -0
  83. package/build-module/dataviews-layouts/table/index.js +4 -1
  84. package/build-module/dataviews-layouts/table/index.js.map +1 -1
  85. package/build-module/normalize-fields.js +0 -20
  86. package/build-module/normalize-fields.js.map +1 -1
  87. package/build-module/normalize-form-fields.js +30 -0
  88. package/build-module/normalize-form-fields.js.map +1 -0
  89. package/build-module/types.js.map +1 -1
  90. package/build-module/validation.js.map +1 -1
  91. package/build-style/style-rtl.css +54 -13
  92. package/build-style/style.css +54 -13
  93. package/build-types/components/dataform/index.d.ts +1 -1
  94. package/build-types/components/dataform/index.d.ts.map +1 -1
  95. package/build-types/components/dataform/stories/index.story.d.ts +18 -7
  96. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
  97. package/build-types/components/dataform-context/index.d.ts +13 -0
  98. package/build-types/components/dataform-context/index.d.ts.map +1 -0
  99. package/build-types/components/dataviews/index.d.ts.map +1 -1
  100. package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
  101. package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
  102. package/build-types/components/dataviews-context/index.d.ts +0 -1
  103. package/build-types/components/dataviews-context/index.d.ts.map +1 -1
  104. package/build-types/components/dataviews-filters/index.d.ts +1 -1
  105. package/build-types/components/dataviews-filters/index.d.ts.map +1 -1
  106. package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
  107. package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
  108. package/build-types/components/dataviews-view-config/index.d.ts +1 -3
  109. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
  110. package/build-types/dataforms-layouts/data-form-layout.d.ts +16 -0
  111. package/build-types/dataforms-layouts/data-form-layout.d.ts.map +1 -0
  112. package/build-types/dataforms-layouts/index.d.ts +3 -3
  113. package/build-types/dataforms-layouts/index.d.ts.map +1 -1
  114. package/build-types/dataforms-layouts/is-combined-field.d.ts +6 -0
  115. package/build-types/dataforms-layouts/is-combined-field.d.ts.map +1 -0
  116. package/build-types/dataforms-layouts/panel/index.d.ts +5 -2
  117. package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -1
  118. package/build-types/dataforms-layouts/regular/index.d.ts +5 -2
  119. package/build-types/dataforms-layouts/regular/index.d.ts.map +1 -1
  120. package/build-types/dataviews-layouts/grid/index.d.ts +1 -1
  121. package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
  122. package/build-types/dataviews-layouts/grid/preview-size-picker.d.ts +3 -0
  123. package/build-types/dataviews-layouts/grid/preview-size-picker.d.ts.map +1 -0
  124. package/build-types/dataviews-layouts/index.d.ts +5 -0
  125. package/build-types/dataviews-layouts/index.d.ts.map +1 -1
  126. package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
  127. package/build-types/dataviews-layouts/table/density-picker.d.ts +2 -0
  128. package/build-types/dataviews-layouts/table/density-picker.d.ts.map +1 -0
  129. package/build-types/dataviews-layouts/table/index.d.ts.map +1 -1
  130. package/build-types/normalize-fields.d.ts +1 -9
  131. package/build-types/normalize-fields.d.ts.map +1 -1
  132. package/build-types/normalize-form-fields.d.ts +12 -0
  133. package/build-types/normalize-form-fields.d.ts.map +1 -0
  134. package/build-types/types.d.ts +31 -22
  135. package/build-types/types.d.ts.map +1 -1
  136. package/build-types/validation.d.ts +1 -1
  137. package/build-types/validation.d.ts.map +1 -1
  138. package/package.json +2 -2
  139. package/src/components/dataform/index.tsx +22 -5
  140. package/src/components/dataform/stories/index.story.tsx +88 -49
  141. package/src/components/dataform-context/index.tsx +30 -0
  142. package/src/components/dataviews/index.tsx +2 -6
  143. package/src/components/dataviews/stories/fixtures.tsx +1 -0
  144. package/src/components/dataviews/stories/index.story.tsx +16 -3
  145. package/src/components/dataviews-context/index.ts +0 -2
  146. package/src/components/dataviews-filters/index.tsx +73 -38
  147. package/src/components/dataviews-item-actions/index.tsx +73 -25
  148. package/src/components/dataviews-layout/index.tsx +0 -2
  149. package/src/components/dataviews-view-config/index.tsx +7 -23
  150. package/src/dataforms-layouts/data-form-layout.tsx +87 -0
  151. package/src/dataforms-layouts/index.tsx +7 -7
  152. package/src/dataforms-layouts/is-combined-field.ts +10 -0
  153. package/src/dataforms-layouts/panel/index.tsx +192 -101
  154. package/src/dataforms-layouts/panel/style.scss +4 -0
  155. package/src/dataforms-layouts/regular/index.tsx +101 -37
  156. package/src/dataforms-layouts/regular/style.scss +30 -0
  157. package/src/dataviews-layouts/grid/index.tsx +10 -8
  158. package/src/dataviews-layouts/grid/{density-picker.tsx → preview-size-picker.tsx} +39 -26
  159. package/src/dataviews-layouts/grid/style.scss +3 -1
  160. package/src/dataviews-layouts/index.ts +4 -0
  161. package/src/dataviews-layouts/list/index.tsx +31 -27
  162. package/src/dataviews-layouts/table/density-picker.tsx +57 -0
  163. package/src/dataviews-layouts/table/index.tsx +12 -2
  164. package/src/dataviews-layouts/table/style.scss +32 -0
  165. package/src/normalize-fields.ts +1 -33
  166. package/src/normalize-form-fields.ts +42 -0
  167. package/src/style.scss +1 -1
  168. package/src/types.ts +36 -21
  169. package/src/validation.ts +1 -1
  170. package/tsconfig.tsbuildinfo +1 -1
  171. package/build/components/dataform-combined-edit/index.js +0 -73
  172. package/build/components/dataform-combined-edit/index.js.map +0 -1
  173. package/build/dataforms-layouts/get-visible-fields.js +0 -21
  174. package/build/dataforms-layouts/get-visible-fields.js.map +0 -1
  175. package/build/dataviews-layouts/grid/density-picker.js.map +0 -1
  176. package/build-module/components/dataform-combined-edit/index.js +0 -66
  177. package/build-module/components/dataform-combined-edit/index.js.map +0 -1
  178. package/build-module/dataforms-layouts/get-visible-fields.js +0 -14
  179. package/build-module/dataforms-layouts/get-visible-fields.js.map +0 -1
  180. package/build-module/dataviews-layouts/grid/density-picker.js.map +0 -1
  181. package/build-types/components/dataform-combined-edit/index.d.ts +0 -7
  182. package/build-types/components/dataform-combined-edit/index.d.ts.map +0 -1
  183. package/build-types/dataforms-layouts/get-visible-fields.d.ts +0 -3
  184. package/build-types/dataforms-layouts/get-visible-fields.d.ts.map +0 -1
  185. package/build-types/dataviews-layouts/grid/density-picker.d.ts +0 -5
  186. package/build-types/dataviews-layouts/grid/density-picker.d.ts.map +0 -1
  187. package/src/components/dataform-combined-edit/index.tsx +0 -69
  188. package/src/components/dataform-combined-edit/style.scss +0 -16
  189. package/src/dataforms-layouts/get-visible-fields.ts +0 -29
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","Spinner","__experimentalHStack","HStack","__experimentalVStack","VStack","useEffect","useId","useRef","useState","SingleSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","getVisibleFieldIds","getClickableItemProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumn","column","fields","view","props","field","find","f","id","TableColumnField","combinedField","layout","combinedFields","TableColumnCombined","primaryField","item","isItemClickable","onClickItem","isPrimaryField","isItemClickableField","i","clickableProps","className","children","render","map","child","direction","spacing","TableRow","hasBulkActions","actions","selection","getItemId","onChangeSelection","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","_view$layout$styles$c","maxWidth","minWidth","styles","length","e","stopPropagation","ViewTable","data","isLoading","onChangeView","setOpenedFilter","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","undefined","tableNoticeId","onHide","hidden","get","fallback","node","hasData","scope","index","_view$layout$styles$c2","sort","ref","set","delete","fieldId","toString"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tSpinner,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SingleSelectionCheckbox from '../../components/dataviews-selection-checkbox';\nimport ItemActions from '../../components/dataviews-item-actions';\nimport { sortValues } from '../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../components/dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n\tCombinedField,\n} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport { getVisibleFieldIds } from '../index';\nimport getClickableItemProps from '../utils/get-clickable-item-props';\n\ninterface TableColumnFieldProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfield: NormalizedField< Item >;\n\titem: Item;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableColumnCombinedProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\tfield: CombinedField;\n\titem: Item;\n\tview: ViewTableType;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableColumnProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\titem: Item;\n\tcolumn: string;\n\tview: ViewTableType;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableRowProps< Item > {\n\thasBulkActions: boolean;\n\titem: Item;\n\tactions: Action< Item >[];\n\tfields: NormalizedField< Item >[];\n\tid: string;\n\tview: ViewTableType;\n\tprimaryField?: NormalizedField< Item >;\n\tselection: string[];\n\tgetItemId: ( item: Item ) => string;\n\tonChangeSelection: SetSelection;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\nfunction TableColumn< Item >( {\n\tcolumn,\n\tfields,\n\tview,\n\t...props\n}: TableColumnProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\tif ( !! field ) {\n\t\treturn <TableColumnField { ...props } field={ field } />;\n\t}\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === column\n\t);\n\tif ( !! combinedField ) {\n\t\treturn (\n\t\t\t<TableColumnCombined\n\t\t\t\t{ ...props }\n\t\t\t\tfields={ fields }\n\t\t\t\tview={ view }\n\t\t\t\tfield={ combinedField }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction TableColumnField< Item >( {\n\tprimaryField,\n\titem,\n\tfield,\n\tisItemClickable,\n\tonClickItem,\n}: TableColumnFieldProps< Item > ) {\n\tconst isPrimaryField = primaryField?.id === field.id;\n\tconst isItemClickableField = ( i: Item ) =>\n\t\tisItemClickable( i ) && isPrimaryField;\n\n\tconst clickableProps = getClickableItemProps(\n\t\titem,\n\t\tisItemClickableField,\n\t\tonClickItem,\n\t\t'dataviews-view-table__cell-content'\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t\t\t'dataviews-view-table__primary-field': isPrimaryField,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div { ...clickableProps }>\n\t\t\t\t<field.render { ...{ item } } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction TableColumnCombined< Item >( {\n\tfield,\n\t...props\n}: TableColumnCombinedProps< Item > ) {\n\tconst children = field.children.map( ( child ) => (\n\t\t<TableColumn key={ child } { ...props } column={ child } />\n\t) );\n\n\tif ( field.direction === 'horizontal' ) {\n\t\treturn <HStack spacing={ 3 }>{ children }</HStack>;\n\t}\n\treturn <VStack spacing={ 0 }>{ children }</VStack>;\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\tprimaryField,\n\tselection,\n\tgetItemId,\n\tisItemClickable,\n\tonClickItem,\n\tonChangeSelection,\n}: TableRowProps< Item > ) {\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst handleMouseEnter = () => {\n\t\tsetIsHovered( true );\n\t};\n\tconst handleMouseLeave = () => {\n\t\tsetIsHovered( false );\n\t};\n\n\t// Will be set to true if `onTouchStart` fires. This happens before\n\t// `onClick` and can be used to exclude touchscreen devices from certain\n\t// behaviours.\n\tconst isTouchDeviceRef = useRef( false );\n\tconst columns = getVisibleFieldIds( view, fields );\n\n\treturn (\n\t\t<tr\n\t\t\tclassName={ clsx( 'dataviews-view-table__row', {\n\t\t\t\t'is-selected': hasPossibleBulkAction && isSelected,\n\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonMouseEnter={ handleMouseEnter }\n\t\t\tonMouseLeave={ handleMouseLeave }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t! isTouchDeviceRef.current &&\n\t\t\t\t\tdocument.getSelection()?.type !== 'Range'\n\t\t\t\t) {\n\t\t\t\t\tonChangeSelection(\n\t\t\t\t\t\tselection.includes( id )\n\t\t\t\t\t\t\t? selection.filter( ( itemId ) => id !== itemId )\n\t\t\t\t\t\t\t: [ id ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ hasBulkActions && (\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t\t\t\t<SingleSelectionCheckbox\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tdisabled={ ! hasPossibleBulkAction }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t) }\n\t\t\t{ columns.map( ( column: string ) => {\n\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<td key={ column } style={ { width, maxWidth, minWidth } }>\n\t\t\t\t\t\t<TableColumn\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tcolumn={ column }\n\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ !! actions?.length && (\n\t\t\t\t// Disable reason: we are not making the element interactive,\n\t\t\t\t// but preventing any click events from bubbling up to the\n\t\t\t\t// table row. This allows us to add a click handler to the row\n\t\t\t\t// itself (to toggle row selection) without erroneously\n\t\t\t\t// intercepting click events from ItemActions.\n\n\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__actions-column\"\n\t\t\t\t\tonClick={ ( e ) => e.stopPropagation() }\n\t\t\t\t>\n\t\t\t\t\t<ItemActions item={ item } actions={ actions } />\n\t\t\t\t</td>\n\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t) }\n\t\t</tr>\n\t);\n}\n\nfunction ViewTable< Item >( {\n\tactions,\n\tdata,\n\tfields,\n\tgetItemId,\n\tisLoading = false,\n\tonChangeView,\n\tonChangeSelection,\n\tselection,\n\tsetOpenedFilter,\n\tonClickItem,\n\tisItemClickable,\n\tview,\n}: ViewTableProps< Item > ) {\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >();\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\n\n\tuseEffect( () => {\n\t\tif ( headerMenuToFocusRef.current ) {\n\t\t\theaderMenuToFocusRef.current.focus();\n\t\t\theaderMenuToFocusRef.current = undefined;\n\t\t}\n\t} );\n\n\tconst tableNoticeId = useId();\n\n\tif ( nextHeaderMenuToFocus ) {\n\t\t// If we need to force focus, we short-circuit rendering here\n\t\t// to prevent any additional work while we handle that.\n\t\t// Clearing out the focus directive is necessary to make sure\n\t\t// future renders don't cause unexpected focus jumps.\n\t\theaderMenuToFocusRef.current = nextHeaderMenuToFocus;\n\t\tsetNextHeaderMenuToFocus( undefined );\n\t\treturn;\n\t}\n\n\tconst onHide = ( field: NormalizedField< Item > ) => {\n\t\tconst hidden = headerMenuRefs.current.get( field.id );\n\t\tconst fallback = hidden\n\t\t\t? headerMenuRefs.current.get( hidden.fallback )\n\t\t\t: undefined;\n\t\tsetNextHeaderMenuToFocus( fallback?.node );\n\t};\n\n\tconst columns = getVisibleFieldIds( view, fields );\n\tconst hasData = !! data?.length;\n\n\tconst primaryField = fields.find(\n\t\t( field ) => field.id === view.layout?.primaryField\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName=\"dataviews-view-table\"\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"dataviews-view-table__row\">\n\t\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BulkSelectionCheckbox\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ columns.map( ( column, index ) => {\n\t\t\t\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\t\t\t\tstyle={ { width, maxWidth, minWidth } }\n\t\t\t\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t\t\t\tview.sort?.field === column\n\t\t\t\t\t\t\t\t\t\t\t? sortValues[ view.sort.direction ]\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ ( node ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( node ) {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.set(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfallback:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolumns[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex > 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? index - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.delete(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tfieldId={ column }\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t\t<th className=\"dataviews-view-table__actions-column\">\n\t\t\t\t\t\t\t\t<span className=\"dataviews-view-table-header\">\n\t\t\t\t\t\t\t\t\t{ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t'dataviews-loading': isLoading,\n\t\t\t\t\t'dataviews-no-results': ! hasData && ! isLoading,\n\t\t\t\t} ) }\n\t\t\t\tid={ tableNoticeId }\n\t\t\t>\n\t\t\t\t{ ! hasData && (\n\t\t\t\t\t<p>{ isLoading ? <Spinner /> : __( 'No results' ) }</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ViewTable;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,OAAO,EACPC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,+CAA+C;AACnF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SACCC,iCAAiC,EACjCC,yBAAyB,EACzBC,qBAAqB,QACf,yCAAyC;AAShD,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,OAAOC,qBAAqB,MAAM,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AA6CtE,SAASC,WAAWA,CAAU;EAC7BC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJ,GAAGC;AACsB,CAAC,EAAG;EAC7B,MAAMC,KAAK,GAAGH,MAAM,CAACI,IAAI,CAAIC,CAAC,IAAMA,CAAC,CAACC,EAAE,KAAKP,MAAO,CAAC;EACrD,IAAK,CAAC,CAAEI,KAAK,EAAG;IACf,oBAAOV,IAAA,CAACc,gBAAgB;MAAA,GAAML,KAAK;MAAGC,KAAK,EAAGA;IAAO,CAAE,CAAC;EACzD;EACA,MAAMK,aAAa,GAAGP,IAA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[]}
1
+ {"version":3,"names":["clsx","__","Spinner","__experimentalHStack","HStack","__experimentalVStack","VStack","useEffect","useId","useRef","useState","SingleSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","getVisibleFieldIds","getClickableItemProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumn","column","fields","view","props","field","find","f","id","TableColumnField","combinedField","layout","combinedFields","TableColumnCombined","primaryField","item","isItemClickable","onClickItem","isPrimaryField","isItemClickableField","i","clickableProps","className","children","render","map","child","direction","spacing","justify","TableRow","hasBulkActions","actions","selection","getItemId","onChangeSelection","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","_view$layout$styles$c","maxWidth","minWidth","styles","length","e","stopPropagation","ViewTable","data","isLoading","onChangeView","setOpenedFilter","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","undefined","tableNoticeId","onHide","hidden","get","fallback","node","hasData","density","scope","index","_view$layout$styles$c2","sort","ref","set","delete","fieldId","toString"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tSpinner,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SingleSelectionCheckbox from '../../components/dataviews-selection-checkbox';\nimport ItemActions from '../../components/dataviews-item-actions';\nimport { sortValues } from '../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../components/dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n\tCombinedField,\n} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport { getVisibleFieldIds } from '../index';\nimport getClickableItemProps from '../utils/get-clickable-item-props';\n\ninterface TableColumnFieldProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfield: NormalizedField< Item >;\n\titem: Item;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableColumnCombinedProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\tfield: CombinedField;\n\titem: Item;\n\tview: ViewTableType;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableColumnProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\titem: Item;\n\tcolumn: string;\n\tview: ViewTableType;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\ninterface TableRowProps< Item > {\n\thasBulkActions: boolean;\n\titem: Item;\n\tactions: Action< Item >[];\n\tfields: NormalizedField< Item >[];\n\tid: string;\n\tview: ViewTableType;\n\tprimaryField?: NormalizedField< Item >;\n\tselection: string[];\n\tgetItemId: ( item: Item ) => string;\n\tonChangeSelection: SetSelection;\n\tisItemClickable: ( item: Item ) => boolean;\n\tonClickItem: ( item: Item ) => void;\n}\n\nfunction TableColumn< Item >( {\n\tcolumn,\n\tfields,\n\tview,\n\t...props\n}: TableColumnProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\tif ( !! field ) {\n\t\treturn <TableColumnField { ...props } field={ field } />;\n\t}\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === column\n\t);\n\tif ( !! combinedField ) {\n\t\treturn (\n\t\t\t<TableColumnCombined\n\t\t\t\t{ ...props }\n\t\t\t\tfields={ fields }\n\t\t\t\tview={ view }\n\t\t\t\tfield={ combinedField }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction TableColumnField< Item >( {\n\tprimaryField,\n\titem,\n\tfield,\n\tisItemClickable,\n\tonClickItem,\n}: TableColumnFieldProps< Item > ) {\n\tconst isPrimaryField = primaryField?.id === field.id;\n\tconst isItemClickableField = ( i: Item ) =>\n\t\tisItemClickable( i ) && isPrimaryField;\n\n\tconst clickableProps = getClickableItemProps(\n\t\titem,\n\t\tisItemClickableField,\n\t\tonClickItem,\n\t\t'dataviews-view-table__cell-content'\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t\t\t'dataviews-view-table__primary-field': isPrimaryField,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div { ...clickableProps }>\n\t\t\t\t<field.render { ...{ item } } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction TableColumnCombined< Item >( {\n\tfield,\n\t...props\n}: TableColumnCombinedProps< Item > ) {\n\tconst children = field.children.map( ( child ) => (\n\t\t<TableColumn key={ child } { ...props } column={ child } />\n\t) );\n\n\tif ( field.direction === 'horizontal' ) {\n\t\treturn (\n\t\t\t<HStack spacing={ 3 } justify=\"flex-start\">\n\t\t\t\t{ children }\n\t\t\t</HStack>\n\t\t);\n\t}\n\treturn <VStack spacing={ 0 }>{ children }</VStack>;\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\tprimaryField,\n\tselection,\n\tgetItemId,\n\tisItemClickable,\n\tonClickItem,\n\tonChangeSelection,\n}: TableRowProps< Item > ) {\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst handleMouseEnter = () => {\n\t\tsetIsHovered( true );\n\t};\n\tconst handleMouseLeave = () => {\n\t\tsetIsHovered( false );\n\t};\n\n\t// Will be set to true if `onTouchStart` fires. This happens before\n\t// `onClick` and can be used to exclude touchscreen devices from certain\n\t// behaviours.\n\tconst isTouchDeviceRef = useRef( false );\n\tconst columns = getVisibleFieldIds( view, fields );\n\n\treturn (\n\t\t<tr\n\t\t\tclassName={ clsx( 'dataviews-view-table__row', {\n\t\t\t\t'is-selected': hasPossibleBulkAction && isSelected,\n\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonMouseEnter={ handleMouseEnter }\n\t\t\tonMouseLeave={ handleMouseLeave }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t! isTouchDeviceRef.current &&\n\t\t\t\t\tdocument.getSelection()?.type !== 'Range'\n\t\t\t\t) {\n\t\t\t\t\tonChangeSelection(\n\t\t\t\t\t\tselection.includes( id )\n\t\t\t\t\t\t\t? selection.filter( ( itemId ) => id !== itemId )\n\t\t\t\t\t\t\t: [ id ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ hasBulkActions && (\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t\t\t\t<SingleSelectionCheckbox\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tdisabled={ ! hasPossibleBulkAction }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t) }\n\t\t\t{ columns.map( ( column: string ) => {\n\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<td key={ column } style={ { width, maxWidth, minWidth } }>\n\t\t\t\t\t\t<TableColumn\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tcolumn={ column }\n\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ !! actions?.length && (\n\t\t\t\t// Disable reason: we are not making the element interactive,\n\t\t\t\t// but preventing any click events from bubbling up to the\n\t\t\t\t// table row. This allows us to add a click handler to the row\n\t\t\t\t// itself (to toggle row selection) without erroneously\n\t\t\t\t// intercepting click events from ItemActions.\n\n\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__actions-column\"\n\t\t\t\t\tonClick={ ( e ) => e.stopPropagation() }\n\t\t\t\t>\n\t\t\t\t\t<ItemActions item={ item } actions={ actions } />\n\t\t\t\t</td>\n\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t) }\n\t\t</tr>\n\t);\n}\n\nfunction ViewTable< Item >( {\n\tactions,\n\tdata,\n\tfields,\n\tgetItemId,\n\tisLoading = false,\n\tonChangeView,\n\tonChangeSelection,\n\tselection,\n\tsetOpenedFilter,\n\tonClickItem,\n\tisItemClickable,\n\tview,\n}: ViewTableProps< Item > ) {\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >();\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\n\n\tuseEffect( () => {\n\t\tif ( headerMenuToFocusRef.current ) {\n\t\t\theaderMenuToFocusRef.current.focus();\n\t\t\theaderMenuToFocusRef.current = undefined;\n\t\t}\n\t} );\n\n\tconst tableNoticeId = useId();\n\n\tif ( nextHeaderMenuToFocus ) {\n\t\t// If we need to force focus, we short-circuit rendering here\n\t\t// to prevent any additional work while we handle that.\n\t\t// Clearing out the focus directive is necessary to make sure\n\t\t// future renders don't cause unexpected focus jumps.\n\t\theaderMenuToFocusRef.current = nextHeaderMenuToFocus;\n\t\tsetNextHeaderMenuToFocus( undefined );\n\t\treturn;\n\t}\n\n\tconst onHide = ( field: NormalizedField< Item > ) => {\n\t\tconst hidden = headerMenuRefs.current.get( field.id );\n\t\tconst fallback = hidden\n\t\t\t? headerMenuRefs.current.get( hidden.fallback )\n\t\t\t: undefined;\n\t\tsetNextHeaderMenuToFocus( fallback?.node );\n\t};\n\n\tconst columns = getVisibleFieldIds( view, fields );\n\tconst hasData = !! data?.length;\n\n\tconst primaryField = fields.find(\n\t\t( field ) => field.id === view.layout?.primaryField\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName={ clsx( 'dataviews-view-table', {\n\t\t\t\t\t[ `has-${ view.layout?.density }-density` ]:\n\t\t\t\t\t\tview.layout?.density &&\n\t\t\t\t\t\t[ 'compact', 'comfortable' ].includes(\n\t\t\t\t\t\t\tview.layout.density\n\t\t\t\t\t\t),\n\t\t\t\t} ) }\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"dataviews-view-table__row\">\n\t\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BulkSelectionCheckbox\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ columns.map( ( column, index ) => {\n\t\t\t\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\t\t\t\tstyle={ { width, maxWidth, minWidth } }\n\t\t\t\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t\t\t\tview.sort?.field === column\n\t\t\t\t\t\t\t\t\t\t\t? sortValues[ view.sort.direction ]\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ ( node ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( node ) {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.set(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfallback:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolumns[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex > 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? index - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.delete(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tfieldId={ column }\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t\t<th className=\"dataviews-view-table__actions-column\">\n\t\t\t\t\t\t\t\t<span className=\"dataviews-view-table-header\">\n\t\t\t\t\t\t\t\t\t{ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t'dataviews-loading': isLoading,\n\t\t\t\t\t'dataviews-no-results': ! hasData && ! isLoading,\n\t\t\t\t} ) }\n\t\t\t\tid={ tableNoticeId }\n\t\t\t>\n\t\t\t\t{ ! hasData && (\n\t\t\t\t\t<p>{ isLoading ? <Spinner /> : __( 'No results' ) }</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ViewTable;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,OAAO,EACPC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAA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;cAAAC,QAAA,EAC1ChD,EAAE,CAAE,SAAU;YAAC,CACZ;UAAC,CACJ,CACJ;QAAA,CACE;MAAC,CACC,CAAC,eACRoB,IAAA;QAAA4B,QAAA,EACG4D,OAAO,IACRjB,IAAI,CAACzC,GAAG,CAAE,CAAEV,IAAI,EAAEuE,KAAK,kBACtB3F,IAAA,CAACmC,QAAQ;UAERf,IAAI,EAAGA,IAAM;UACbgB,cAAc,EAAGA,cAAgB;UACjCC,OAAO,EAAGA,OAAS;UACnB9B,MAAM,EAAGA,MAAQ;UACjBM,EAAE,EAAG0B,SAAS,CAAEnB,IAAK,CAAC,IAAIuE,KAAK,CAACO,QAAQ,CAAC,CAAG;UAC5C1F,IAAI,EAAGA,IAAM;UACbW,YAAY,EAAGA,YAAc;UAC7BmB,SAAS,EAAGA,SAAW;UACvBC,SAAS,EAAGA,SAAW;UACvBC,iBAAiB,EAAGA,iBAAmB;UACvClB,WAAW,EAAGA,WAAa;UAC3BD,eAAe,EAAGA;QAAiB,GAZ7BkB,SAAS,CAAEnB,IAAK,CAatB,CACA;MAAC,CACE,CAAC;IAAA,CACF,CAAC,eACRpB,IAAA;MACC2B,SAAS,EAAGhD,IAAI,CAAE;QACjB,mBAAmB,EAAE6F,SAAS;QAC9B,sBAAsB,EAAE,CAAEgB,OAAO,IAAI,CAAEhB;MACxC,CAAE,CAAG;MACL3D,EAAE,EAAGqE,aAAe;MAAAtD,QAAA,EAElB,CAAE4D,OAAO,iBACVxF,IAAA;QAAA4B,QAAA,EAAK4C,SAAS,gBAAGxE,IAAA,CAACnB,OAAO,IAAE,CAAC,GAAGD,EAAE,CAAE,YAAa;MAAC,CAAK;IACtD,CACG,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAe0F,SAAS","ignoreList":[]}
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import getFieldTypeDefinition from './field-types';
5
5
  import { getControl } from './dataform-controls';
6
- import DataFormCombinedEdit from './components/dataform-combined-edit';
7
6
  const getValueFromId = id => ({
8
7
  item
9
8
  }) => {
@@ -68,23 +67,4 @@ export function normalizeFields(fields) {
68
67
  };
69
68
  });
70
69
  }
71
-
72
- /**
73
- * Apply default values and normalize the fields config.
74
- *
75
- * @param combinedFields combined field list.
76
- * @param fields Fields config.
77
- * @return Normalized fields config.
78
- */
79
- export function normalizeCombinedFields(combinedFields, fields) {
80
- return combinedFields.map(combinedField => {
81
- return {
82
- ...combinedField,
83
- Edit: DataFormCombinedEdit,
84
- fields: normalizeFields(combinedField.children.map(fieldId => fields.find(({
85
- id
86
- }) => id === fieldId)).filter(field => !!field))
87
- };
88
- });
89
- }
90
70
  //# sourceMappingURL=normalize-fields.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldTypeDefinition","getControl","DataFormCombinedEdit","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","normalizeFields","fields","map","field","_field$sort","_field$isValid","_field$enableHiding","_field$enableSorting","fieldTypeDefinition","type","getValue","sort","a","b","direction","isValid","context","Edit","renderFromElements","elements","find","element","label","render","header","enableHiding","enableSorting","normalizeCombinedFields","combinedFields","combinedField","children","fieldId","filter"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type {\n\tCombinedFormField,\n\tField,\n\tNormalizedField,\n\tNormalizedCombinedFormField,\n} from './types';\nimport { getControl } from './dataform-controls';\nimport DataFormCombinedEdit from './components/dataform-combined-edit';\n\nconst getValueFromId =\n\t( id: string ) =>\n\t( { item }: { item: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tlet value = item;\n\t\tfor ( const segment of path ) {\n\t\t\tif ( value.hasOwnProperty( segment ) ) {\n\t\t\t\tvalue = value[ segment ];\n\t\t\t} else {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n\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 = field.getValue || getValueFromId( field.id );\n\n\t\tconst sort =\n\t\t\tfield.sort ??\n\t\t\tfunction sort( a, b, direction ) {\n\t\t\t\treturn fieldTypeDefinition.sort(\n\t\t\t\t\tgetValue( { item: a } ),\n\t\t\t\t\tgetValue( { item: b } ),\n\t\t\t\t\tdirection\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst isValid =\n\t\t\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\tenableHiding: field.enableHiding ?? true,\n\t\t\tenableSorting: field.enableSorting ?? true,\n\t\t};\n\t} );\n}\n\n/**\n * Apply default values and normalize the fields config.\n *\n * @param combinedFields combined field list.\n * @param fields Fields config.\n * @return Normalized fields config.\n */\nexport function normalizeCombinedFields< Item >(\n\tcombinedFields: CombinedFormField< Item >[],\n\tfields: Field< Item >[]\n): NormalizedCombinedFormField< Item >[] {\n\treturn combinedFields.map( ( combinedField ) => {\n\t\treturn {\n\t\t\t...combinedField,\n\t\t\tEdit: DataFormCombinedEdit,\n\t\t\tfields: normalizeFields(\n\t\t\t\tcombinedField.children\n\t\t\t\t\t.map( ( fieldId ) =>\n\t\t\t\t\t\tfields.find( ( { id } ) => id === fieldId )\n\t\t\t\t\t)\n\t\t\t\t\t.filter( ( field ): field is Field< Item > => !! field )\n\t\t\t),\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAOlD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,OAAOC,oBAAoB,MAAM,qCAAqC;AAEtE,MAAMC,cAAc,GACjBC,EAAU,IACZ,CAAE;EAAEC;AAAoB,CAAC,KAAM;EAC9B,MAAMC,IAAI,GAAGF,EAAE,CAACG,KAAK,CAAE,GAAI,CAAC;EAC5B,IAAIC,KAAK,GAAGH,IAAI;EAChB,KAAM,MAAMI,OAAO,IAAIH,IAAI,EAAG;IAC7B,IAAKE,KAAK,CAACE,cAAc,CAAED,OAAQ,CAAC,EAAG;MACtCD,KAAK,GAAGA,KAAK,CAAEC,OAAO,CAAE;IACzB,CAAC,MAAM;MACND,KAAK,GAAGG,SAAS;IAClB;EACD;EAEA,OAAOH,KAAK;AACb,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAC9BC,MAAuB,EACK;EAC5B,OAAOA,MAAM,CAACC,GAAG,CAAIC,KAAK,IAAM;IAAA,IAAAC,WAAA,EAAAC,cAAA,EAAAC,mBAAA,EAAAC,oBAAA;IAC/B,MAAMC,mBAAmB,GAAGpB,sBAAsB,CAAEe,KAAK,CAACM,IAAK,CAAC;IAEhE,MAAMC,QAAQ,GAAGP,KAAK,CAACO,QAAQ,IAAInB,cAAc,CAAEY,KAAK,CAACX,EAAG,CAAC;IAE7D,MAAMmB,IAAI,IAAAP,WAAA,GACTD,KAAK,CAACQ,IAAI,cAAAP,WAAA,cAAAA,WAAA,GACV,SAASO,IAAIA,CAAEC,CAAC,EAAEC,CA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,GAAEH,KAAK,CAACsB,YAAY,cAAAnB,mBAAA,cAAAA,mBAAA,GAAI,IAAI;MACxCoB,aAAa,GAAAnB,oBAAA,GAAEJ,KAAK,CAACuB,aAAa,cAAAnB,oBAAA,cAAAA,oBAAA,GAAI;IACvC,CAAC;EACF,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoB,uBAAuBA,CACtCC,cAA2C,EAC3C3B,MAAuB,EACiB;EACxC,OAAO2B,cAAc,CAAC1B,GAAG,CAAI2B,aAAa,IAAM;IAC/C,OAAO;MACN,GAAGA,aAAa;MAChBZ,IAAI,EAAE3B,oBAAoB;MAC1BW,MAAM,EAAED,eAAe,CACtB6B,aAAa,CAACC,QAAQ,CACpB5B,GAAG,CAAI6B,OAAO,IACd9B,MAAM,CAACmB,IAAI,CAAE,CAAE;QAAE5B;MAAG,CAAC,KAAMA,EAAE,KAAKuC,OAAQ,CAC3C,CAAC,CACAC,MAAM,CAAI7B,KAAK,IAA8B,CAAC,CAAEA,KAAM,CACzD;IACD,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["getFieldTypeDefinition","getControl","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","normalizeFields","fields","map","field","_field$sort","_field$isValid","_field$enableHiding","_field$enableSorting","fieldTypeDefinition","type","getValue","sort","a","b","direction","isValid","context","Edit","renderFromElements","elements","find","element","label","render","header","enableHiding","enableSorting"],"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\nconst getValueFromId =\n\t( id: string ) =>\n\t( { item }: { item: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tlet value = item;\n\t\tfor ( const segment of path ) {\n\t\t\tif ( value.hasOwnProperty( segment ) ) {\n\t\t\t\tvalue = value[ segment ];\n\t\t\t} else {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n\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 = field.getValue || getValueFromId( field.id );\n\n\t\tconst sort =\n\t\t\tfield.sort ??\n\t\t\tfunction sort( a, b, direction ) {\n\t\t\t\treturn fieldTypeDefinition.sort(\n\t\t\t\t\tgetValue( { item: a } ),\n\t\t\t\t\tgetValue( { item: b } ),\n\t\t\t\t\tdirection\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst isValid =\n\t\t\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\tenableHiding: field.enableHiding ?? true,\n\t\t\tenableSorting: field.enableSorting ?? true,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAElD,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,MAA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mB,CAACO,OAAO,CACjCL,QAAQ,CAAE;QAAEjB;MAAK,CAAE,CAAC,EACpBuB,OACD,CAAC;IACF,CAAC;IAEF,MAAMC,IAAI,GAAG3B,UAAU,CAAEa,KAAK,EAAEK,mBAAoB,CAAC;IAErD,MAAMU,kBAAkB,GAAGA,CAAE;MAAEzB;IAAqB,CAAC,KAAM;MAC1D,MAAMG,KAAK,GAAGc,QAAQ,CAAE;QAAEjB;MAAK,CAAE,CAAC;MAClC,OACCU,KAAK,EAAEgB,QAAQ,EAAEC,IAAI,CAAIC,OAAO,IAAMA,OAAO,CAACzB,KAAK,KAAKA,KAAM,CAAC,EAC5D0B,KAAK,IAAIZ,QAAQ,CAAE;QAAEjB;MAAK,CAAE,CAAC;IAElC,CAAC;IAED,MAAM8B,MAAM,GACXpB,KAAK,CAACoB,MAAM,KAAMpB,KAAK,CAACgB,QAAQ,GAAGD,kBAAkB,GAAGR,QAAQ,CAAE;IAEnE,OAAO;MACN,GAAGP,KAAK;MACRmB,KAAK,EAAEnB,KAAK,CAACmB,KAAK,IAAInB,KAAK,CAACX,EAAE;MAC9BgC,MAAM,EAAErB,KAAK,CAACqB,MAAM,IAAIrB,KAAK,CAACmB,KAAK,IAAInB,KAAK,CAACX,EAAE;MAC/CkB,QAAQ;MACRa,MAAM;MACNZ,IAAI;MACJI,OAAO;MACPE,IAAI;MACJQ,YAAY,GAAAnB,mBAAA,GAAEH,KAAK,CAACsB,YAAY,cAAAnB,mBAAA,cAAAA,mBAAA,GAAI,IAAI;MACxCoB,aAAa,GAAAnB,oBAAA,GAAEJ,KAAK,CAACuB,aAAa,cAAAnB,oBAAA,cAAAA,oBAAA,GAAI;IACvC,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+
5
+ export default function normalizeFormFields(form) {
6
+ var _form$type, _form$labelPosition, _form$fields;
7
+ let layout = 'regular';
8
+ if (['regular', 'panel'].includes((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : '')) {
9
+ layout = form.type;
10
+ }
11
+ const labelPosition = (_form$labelPosition = form.labelPosition) !== null && _form$labelPosition !== void 0 ? _form$labelPosition : layout === 'regular' ? 'top' : 'side';
12
+ return ((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(field => {
13
+ var _field$layout, _field$labelPosition;
14
+ if (typeof field === 'string') {
15
+ return {
16
+ id: field,
17
+ layout,
18
+ labelPosition
19
+ };
20
+ }
21
+ const fieldLayout = (_field$layout = field.layout) !== null && _field$layout !== void 0 ? _field$layout : layout;
22
+ const fieldLabelPosition = (_field$labelPosition = field.labelPosition) !== null && _field$labelPosition !== void 0 ? _field$labelPosition : fieldLayout === 'regular' ? 'top' : 'side';
23
+ return {
24
+ ...field,
25
+ layout: fieldLayout,
26
+ labelPosition: fieldLabelPosition
27
+ };
28
+ });
29
+ }
30
+ //# sourceMappingURL=normalize-form-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeFormFields","form","_form$type","_form$labelPosition","_form$fields","layout","includes","type","labelPosition","fields","map","field","_field$layout","_field$labelPosition","id","fieldLayout","fieldLabelPosition"],"sources":["@wordpress/dataviews/src/normalize-form-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Form } from './types';\n\ninterface NormalizedFormField {\n\tid: string;\n\tlayout: 'regular' | 'panel';\n\tlabelPosition: 'side' | 'top' | 'none';\n}\n\nexport default function normalizeFormFields(\n\tform: Form\n): NormalizedFormField[] {\n\tlet layout: 'regular' | 'panel' = 'regular';\n\tif ( [ 'regular', 'panel' ].includes( form.type ?? '' ) ) {\n\t\tlayout = form.type as 'regular' | 'panel';\n\t}\n\n\tconst labelPosition =\n\t\tform.labelPosition ?? ( layout === 'regular' ? 'top' : 'side' );\n\n\treturn ( form.fields ?? [] ).map( ( field ) => {\n\t\tif ( typeof field === 'string' ) {\n\t\t\treturn {\n\t\t\t\tid: field,\n\t\t\t\tlayout,\n\t\t\t\tlabelPosition,\n\t\t\t};\n\t\t}\n\n\t\tconst fieldLayout = field.layout ?? layout;\n\t\tconst fieldLabelPosition =\n\t\t\tfield.labelPosition ??\n\t\t\t( fieldLayout === 'regular' ? 'top' : 'side' );\n\t\treturn {\n\t\t\t...field,\n\t\t\tlayout: fieldLayout,\n\t\t\tlabelPosition: fieldLabelPosition,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AASA,eAAe,SAASA,mBAAmBA,CAC1CC,IAAU,EACc;EAAA,IAAAC,UAAA,EAAAC,mBAAA,EAAAC,YAAA;EACxB,IAAIC,MAA2B,GAAG,SAAS;EAC3C,IAAK,CAAE,SAAS,EAAE,OAAO,CAAE,CAACC,QAAQ,EAAAJ,UAAA,GAAED,IAAI,CAACM,IAAI,cAAAL,UAAA,cAAAA,UAAA,GAAI,EAAG,CAAC,EAAG;IACzDG,MAAM,GAAGJ,IAAI,CAACM,IAA2B;EAC1C;EAEA,MAAMC,aAAa,IAAAL,mBAAA,GAClBF,IAAI,CAACO,aAAa,cAAAL,mBAAA,cAAAA,mBAAA,GAAME,MAAM,KAAK,SAAS,GAAG,KAAK,GAAG,MAAQ;EAEhE,OAAO,EAAAD,YAAA,GAAEH,IAAI,CAACQ,MAAM,cAAAL,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAGM,GAAG,CAAIC,KAAK,IAAM;IAAA,IAAAC,aAAA,EAAAC,oBAAA;IAC9C,IAAK,OAAOF,KAAK,KAAK,QAAQ,EAAG;MAChC,OAAO;QACNG,EAAE,EAAEH,KAAK;QACTN,MAAM;QACNG;MACD,CAAC;IACF;IAEA,MAAMO,WAAW,IAAAH,aAAA,GAAGD,KAAK,CAACN,MAAM,cAAAO,aAAA,cAAAA,aAAA,GAAIP,MAAM;IAC1C,MAAMW,kBAAkB,IAAAH,oBAAA,GACvBF,KAAK,CAACH,aAAa,cAAAK,oBAAA,cAAAA,oBAAA,GACjBE,WAAW,KAAK,SAAS,GAAG,KAAK,GAAG,MAAQ;IAC/C,OAAO;MACN,GAAGJ,KAAK;MACRN,MAAM,EAAEU,WAAW;MACnBP,aAAa,EAAEQ;IAChB,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 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< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | 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< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\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\tonClickItem: ( item: Item ) => void;\n\tisItemClickable: ( item: Item ) => boolean;\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 CombinedFormField< Item > extends CombinedField {\n\trender?: ComponentType< { item: Item } >;\n}\n\nexport interface DataFormCombinedEditProps< Item > {\n\tfield: NormalizedCombinedFormField< Item >;\n\tdata: Item;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n}\n\nexport type NormalizedCombinedFormField< Item > = CombinedFormField< Item > & {\n\tfields: NormalizedField< Item >[];\n\tEdit?: ComponentType< DataFormCombinedEditProps< Item > >;\n};\n\n/**\n * The form configuration.\n */\nexport type Form< Item > = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n\t/**\n\t * The fields to combine.\n\t */\n\tcombinedFields?: CombinedFormField< Item >[];\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\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< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | 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< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\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 type Density = 'compact' | 'balanced' | 'comfortable';\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\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\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\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\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\tonClickItem: ( item: Item ) => void;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\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 type SimpleFormField = {\n\tid: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: Array< FormField | string >;\n\tlabelPosition?: 'side' | 'top' | 'none';\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +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\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form< Item >\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAkB,EACR;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":[]}
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\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;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":[]}
@@ -659,18 +659,6 @@
659
659
  top: unset;
660
660
  }
661
661
 
662
- .dataforms-layouts-panel__field-dropdown .dataforms-combined-edit {
663
- border: none;
664
- padding: 0;
665
- }
666
-
667
- .dataforms-combined-edit__field {
668
- flex: 1 1 auto;
669
- }
670
- .dataforms-combined-edit p.components-base-control__help:has(.components-checkbox-control__help) {
671
- margin-top: 4px;
672
- }
673
-
674
662
  .dataviews-view-grid {
675
663
  margin-bottom: auto;
676
664
  grid-template-rows: max-content;
@@ -692,7 +680,9 @@
692
680
  padding: 8px 0 4px;
693
681
  }
694
682
  .dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__primary-field {
695
- min-height: 32px;
683
+ min-height: 24px;
684
+ display: flex;
685
+ align-items: center;
696
686
  }
697
687
  .dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__primary-field--clickable {
698
688
  width: -moz-fit-content;
@@ -1119,6 +1109,22 @@ ul.dataviews-view-list {
1119
1109
  .dataviews-view-table:has(tr.is-selected) .components-checkbox-control__input {
1120
1110
  opacity: 1;
1121
1111
  }
1112
+ .dataviews-view-table.has-compact-density thead th:has(.dataviews-view-table-header-button):not(:first-child) {
1113
+ padding-right: 0;
1114
+ }
1115
+ .dataviews-view-table.has-compact-density td,
1116
+ .dataviews-view-table.has-compact-density th {
1117
+ padding: 4px 8px;
1118
+ }
1119
+ .dataviews-view-table.has-comfortable-density td,
1120
+ .dataviews-view-table.has-comfortable-density th {
1121
+ padding: 16px 12px;
1122
+ }
1123
+ .dataviews-view-table.has-compact-density td.dataviews-view-table__checkbox-column,
1124
+ .dataviews-view-table.has-compact-density th.dataviews-view-table__checkbox-column, .dataviews-view-table.has-comfortable-density td.dataviews-view-table__checkbox-column,
1125
+ .dataviews-view-table.has-comfortable-density th.dataviews-view-table__checkbox-column {
1126
+ padding-left: 0;
1127
+ }
1122
1128
 
1123
1129
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
1124
1130
  @container (max-width: 430px) {
@@ -1189,4 +1195,39 @@ ul.dataviews-view-list {
1189
1195
 
1190
1196
  .dataforms-layouts-panel__dropdown-header {
1191
1197
  margin-bottom: 16px;
1198
+ }
1199
+
1200
+ .components-popover.components-dropdown__content.dataforms-layouts-panel__field-dropdown {
1201
+ z-index: 159990;
1202
+ }
1203
+
1204
+ .dataforms-layouts-regular__field {
1205
+ width: 100%;
1206
+ min-height: 32px;
1207
+ justify-content: flex-start !important;
1208
+ align-items: flex-start !important;
1209
+ }
1210
+
1211
+ .dataforms-layouts-regular__field .components-base-control__label {
1212
+ font-size: inherit;
1213
+ font-weight: normal;
1214
+ text-transform: none;
1215
+ }
1216
+
1217
+ .dataforms-layouts-regular__field-label {
1218
+ width: 38%;
1219
+ flex-shrink: 0;
1220
+ min-height: 32px;
1221
+ display: flex;
1222
+ align-items: center;
1223
+ padding: 6px 0;
1224
+ line-height: 20px;
1225
+ hyphens: auto;
1226
+ }
1227
+
1228
+ .dataforms-layouts-regular__field-control {
1229
+ flex-grow: 1;
1230
+ min-height: 32px;
1231
+ display: flex;
1232
+ align-items: center;
1192
1233
  }
@@ -659,18 +659,6 @@
659
659
  top: unset;
660
660
  }
661
661
 
662
- .dataforms-layouts-panel__field-dropdown .dataforms-combined-edit {
663
- border: none;
664
- padding: 0;
665
- }
666
-
667
- .dataforms-combined-edit__field {
668
- flex: 1 1 auto;
669
- }
670
- .dataforms-combined-edit p.components-base-control__help:has(.components-checkbox-control__help) {
671
- margin-top: 4px;
672
- }
673
-
674
662
  .dataviews-view-grid {
675
663
  margin-bottom: auto;
676
664
  grid-template-rows: max-content;
@@ -692,7 +680,9 @@
692
680
  padding: 8px 0 4px;
693
681
  }
694
682
  .dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__primary-field {
695
- min-height: 32px;
683
+ min-height: 24px;
684
+ display: flex;
685
+ align-items: center;
696
686
  }
697
687
  .dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__primary-field--clickable {
698
688
  width: -moz-fit-content;
@@ -1119,6 +1109,22 @@ ul.dataviews-view-list {
1119
1109
  .dataviews-view-table:has(tr.is-selected) .components-checkbox-control__input {
1120
1110
  opacity: 1;
1121
1111
  }
1112
+ .dataviews-view-table.has-compact-density thead th:has(.dataviews-view-table-header-button):not(:first-child) {
1113
+ padding-left: 0;
1114
+ }
1115
+ .dataviews-view-table.has-compact-density td,
1116
+ .dataviews-view-table.has-compact-density th {
1117
+ padding: 4px 8px;
1118
+ }
1119
+ .dataviews-view-table.has-comfortable-density td,
1120
+ .dataviews-view-table.has-comfortable-density th {
1121
+ padding: 16px 12px;
1122
+ }
1123
+ .dataviews-view-table.has-compact-density td.dataviews-view-table__checkbox-column,
1124
+ .dataviews-view-table.has-compact-density th.dataviews-view-table__checkbox-column, .dataviews-view-table.has-comfortable-density td.dataviews-view-table__checkbox-column,
1125
+ .dataviews-view-table.has-comfortable-density th.dataviews-view-table__checkbox-column {
1126
+ padding-right: 0;
1127
+ }
1122
1128
 
1123
1129
  /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
1124
1130
  @container (max-width: 430px) {
@@ -1189,4 +1195,39 @@ ul.dataviews-view-list {
1189
1195
 
1190
1196
  .dataforms-layouts-panel__dropdown-header {
1191
1197
  margin-bottom: 16px;
1198
+ }
1199
+
1200
+ .components-popover.components-dropdown__content.dataforms-layouts-panel__field-dropdown {
1201
+ z-index: 159990;
1202
+ }
1203
+
1204
+ .dataforms-layouts-regular__field {
1205
+ width: 100%;
1206
+ min-height: 32px;
1207
+ justify-content: flex-start !important;
1208
+ align-items: flex-start !important;
1209
+ }
1210
+
1211
+ .dataforms-layouts-regular__field .components-base-control__label {
1212
+ font-size: inherit;
1213
+ font-weight: normal;
1214
+ text-transform: none;
1215
+ }
1216
+
1217
+ .dataforms-layouts-regular__field-label {
1218
+ width: 38%;
1219
+ flex-shrink: 0;
1220
+ min-height: 32px;
1221
+ display: flex;
1222
+ align-items: center;
1223
+ padding: 6px 0;
1224
+ line-height: 20px;
1225
+ hyphens: auto;
1226
+ }
1227
+
1228
+ .dataforms-layouts-regular__field-control {
1229
+ flex-grow: 1;
1230
+ min-height: 32px;
1231
+ display: flex;
1232
+ align-items: center;
1192
1233
  }
@@ -2,5 +2,5 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import type { DataFormProps } from '../../types';
5
- export default function DataForm<Item>({ form, ...props }: DataFormProps<Item>): import("react").JSX.Element | null;
5
+ export default function DataForm<Item>({ data, form, fields, onChange, }: DataFormProps<Item>): import("react").JSX.Element | null;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataform/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAI,EACzC,IAAI,EACJ,GAAG,KAAK,EACR,EAAE,aAAa,CAAE,IAAI,CAAE,sCAOvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataform/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAI,EACzC,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,QAAQ,GACR,EAAE,aAAa,CAAE,IAAI,CAAE,sCAevB"}
@@ -13,27 +13,35 @@ declare const meta: {
13
13
  description: string;
14
14
  options: string[];
15
15
  };
16
+ labelPosition: {
17
+ control: {
18
+ type: string;
19
+ };
20
+ description: string;
21
+ options: string[];
22
+ };
16
23
  };
17
24
  };
18
25
  export default meta;
19
- export declare const Default: ({ type }: {
20
- type: "panel" | "regular";
26
+ export declare const Default: ({ type, labelPosition, }: {
27
+ type: "default" | "regular" | "panel";
28
+ labelPosition: "default" | "top" | "side" | "none";
21
29
  }) => import("react").JSX.Element;
22
30
  export declare const CombinedFields: {
23
31
  title: string;
24
- render: ({ type, combinedFieldDirection, }: {
25
- type: "panel" | "regular";
26
- combinedFieldDirection: "vertical" | "horizontal";
32
+ render: ({ type, labelPosition, }: {
33
+ type: "default" | "regular" | "panel";
34
+ labelPosition: "default" | "top" | "side" | "none";
27
35
  }) => import("react").JSX.Element;
28
36
  argTypes: {
29
- combinedFieldDirection: {
37
+ type: {
30
38
  control: {
31
39
  type: string;
32
40
  };
33
41
  description: string;
34
42
  options: string[];
35
43
  };
36
- type: {
44
+ labelPosition: {
37
45
  control: {
38
46
  type: string;
39
47
  };
@@ -41,5 +49,8 @@ export declare const CombinedFields: {
41
49
  options: string[];
42
50
  };
43
51
  };
52
+ args: {
53
+ type: string;
54
+ };
44
55
  };
45
56
  //# sourceMappingURL=index.story.d.ts.map
@@ -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;AAchC,QAAA,MAAM,IAAI;;;;;;;;;;;;CAWT,CAAC;AACF,eAAe,IAAI,CAAC;AAmEpB,eAAO,MAAM,OAAO,aAAe;IAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,gCAwC/D,CAAC;AA+CF,eAAO,MAAM,cAAc;;gDA1CxB;QACF,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC1B,sBAAsB,EAAE,UAAU,GAAG,YAAY,CAAC;KAClD;;;;;;;;;;;;;;;;;CAmDA,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAchC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAgBT,CAAC;AACF,eAAe,IAAI,CAAC;AAqFpB,eAAO,MAAM,OAAO,6BAGjB;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACnD,gCA+CA,CAAC;AAoDF,eAAO,MAAM,cAAc;;uCA/CxB;QACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;QACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;KACnD;;;;;;;;;;;;;;;;;;;;CAqDA,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { NormalizedField } from '../../types';
5
+ type DataFormContextType<Item> = {
6
+ fields: NormalizedField<Item>[];
7
+ };
8
+ declare const DataFormContext: import("react").Context<DataFormContextType<any>>;
9
+ export declare function DataFormProvider<Item>({ fields, children, }: React.PropsWithChildren<{
10
+ fields: NormalizedField<Item>[];
11
+ }>): import("react").JSX.Element;
12
+ export default DataFormContext;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataform-context/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,mBAAmB,CAAE,IAAI,IAAK;IAClC,MAAM,EAAE,eAAe,CAAE,IAAI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E,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,WAAW,EA+G7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAAK,EA2Y5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAE,KAAK,CAAE,EAoBvC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;CAOxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAE,WAAW,CAAE,EAsC1C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAE,WAAW,CAAE,EAiFxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,SAAS,MAAM,UAAU,CAAC;AAajC,OAAO,aAAa,CAAC;AAErB,QAAA,MAAM,IAAI;;;CAGT,CAAC;AACF,eAAe,IAAI,CAAC;AAoCpB,eAAO,MAAM,OAAO,mCAoBnB,CAAC;AAEF,eAAO,MAAM,KAAK,mCAkBjB,CAAC;AAEF,eAAO,MAAM,yBAAyB,mCA4BrC,CAAC;AAEF,eAAO,MAAM,cAAc,mCAkD1B,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,SAAS,MAAM,UAAU,CAAC;AAajC,OAAO,aAAa,CAAC;AAErB,QAAA,MAAM,IAAI;;;CAGT,CAAC;AACF,eAAe,IAAI,CAAC;AAoCpB,eAAO,MAAM,OAAO,mCAqBnB,CAAC;AAEF,eAAO,MAAM,KAAK,mCAkBjB,CAAC;AAEF,eAAO,MAAM,yBAAyB,mCA4BrC,CAAC;AAEF,eAAO,MAAM,cAAc,mCA8D1B,CAAC"}
@@ -21,7 +21,6 @@ type DataViewsContextType<Item> = {
21
21
  getItemId: (item: Item) => string;
22
22
  onClickItem: (item: Item) => void;
23
23
  isItemClickable: (item: Item) => boolean;
24
- density: number;
25
24
  };
26
25
  declare const DataViewsContext: import("react").Context<DataViewsContextType<any>>;
27
26
  export default DataViewsContext;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-context/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,KAAK,oBAAoB,CAAE,IAAI,IAAK;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC3B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,YAAY,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,CAAE,YAAY,EAAE,MAAM,GAAG,IAAI,KAA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