@wordpress/dataviews 4.6.0 → 4.7.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.
- package/CHANGELOG.md +2 -0
- package/build/components/dataviews-bulk-actions/index.js +6 -6
- package/build/components/dataviews-bulk-actions/index.js.map +1 -1
- package/build/components/dataviews-filters/add-filter.js +7 -7
- package/build/components/dataviews-filters/add-filter.js.map +1 -1
- package/build/components/dataviews-filters/index.js +2 -2
- package/build/components/dataviews-filters/index.js.map +1 -1
- package/build/components/dataviews-item-actions/index.js +11 -11
- package/build/components/dataviews-item-actions/index.js.map +1 -1
- package/build/components/dataviews-selection-checkbox/index.js +1 -2
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +6 -6
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/dataforms-layouts/panel/index.js +1 -1
- package/build/dataforms-layouts/panel/index.js.map +1 -1
- package/build/dataviews-layouts/list/index.js +10 -12
- package/build/dataviews-layouts/list/index.js.map +1 -1
- package/build/dataviews-layouts/table/column-header-menu.js +18 -18
- package/build/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/components/dataviews-bulk-actions/index.js +6 -6
- package/build-module/components/dataviews-bulk-actions/index.js.map +1 -1
- package/build-module/components/dataviews-filters/add-filter.js +6 -6
- package/build-module/components/dataviews-filters/add-filter.js.map +1 -1
- package/build-module/components/dataviews-filters/index.js +4 -4
- package/build-module/components/dataviews-filters/index.js.map +1 -1
- package/build-module/components/dataviews-item-actions/index.js +10 -10
- package/build-module/components/dataviews-item-actions/index.js.map +1 -1
- package/build-module/components/dataviews-selection-checkbox/index.js +1 -2
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +6 -6
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/dataforms-layouts/panel/index.js +2 -2
- package/build-module/dataforms-layouts/panel/index.js.map +1 -1
- package/build-module/dataviews-layouts/list/index.js +11 -13
- package/build-module/dataviews-layouts/list/index.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-header-menu.js +18 -18
- package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/style-rtl.css +1 -6
- package/build-style/style.css +1 -6
- package/build-types/components/dataviews-filters/add-filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts +2 -2
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/column-header-menu.d.ts.map +1 -1
- package/build-types/types.d.ts +5 -6
- package/build-types/types.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/components/dataviews-bulk-actions/index.tsx +6 -6
- package/src/components/dataviews-filters/add-filter.tsx +8 -10
- package/src/components/dataviews-filters/index.tsx +4 -4
- package/src/components/dataviews-item-actions/index.tsx +15 -15
- package/src/components/dataviews-selection-checkbox/index.tsx +3 -2
- package/src/components/dataviews-view-config/index.tsx +8 -10
- package/src/dataforms-layouts/panel/index.tsx +2 -2
- package/src/dataviews-layouts/list/index.tsx +10 -12
- package/src/dataviews-layouts/list/style.scss +1 -7
- package/src/dataviews-layouts/table/column-header-menu.tsx +31 -35
- package/src/types.ts +6 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","arrowLeft","arrowRight","unseen","funnel","Button","Icon","privateApis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","DropdownMenuV2","WithDropDownMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","ref","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","header","operators","combinedField","layout","combinedFields","find","f","id","enableHiding","enableSorting","filters","some","_filter","elements","length","filterBy","isPrimary","label","align","trigger","size","className","variant","direction","style","minWidth","Group","isChecked","value","RadioItem","name","checked","onChange","ItemLabel","Item","prefix","icon","onClick","page","undefined","operator","disabled","_visibleFieldIds$slic","slice","_visibleFieldIds$slic2","ColumnHeaderMenu"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-header-menu.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, Ref, PropsWithoutRef, RefAttributes } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight, unseen, funnel } from '@wordpress/icons';\nimport {\n\tButton,\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef, Children, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { sanitizeOperators } from '../../utils';\nimport { SORTING_DIRECTIONS, sortArrows, sortLabels } from '../../constants';\nimport type {\n\tNormalizedField,\n\tSortDirection,\n\tViewTable as ViewTableType,\n\tOperator,\n} from '../../types';\nimport { getVisibleFieldIds } from '../index';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\ninterface HeaderMenuProps< Item > {\n\tfieldId: string;\n\tview: ViewTableType;\n\tfields: NormalizedField< Item >[];\n\tonChangeView: ( view: ViewTableType ) => void;\n\tonHide: ( field: NormalizedField< Item > ) => void;\n\tsetOpenedFilter: ( fieldId: string ) => void;\n}\n\nfunction WithDropDownMenuSeparators( { children }: { children: ReactNode } ) {\n\treturn Children.toArray( children )\n\t\t.filter( Boolean )\n\t\t.map( ( child, i ) => (\n\t\t\t<Fragment key={ i }>\n\t\t\t\t{ i > 0 && <DropdownMenuV2.Separator /> }\n\t\t\t\t{ child }\n\t\t\t</Fragment>\n\t\t) );\n}\n\nconst _HeaderMenu = forwardRef( function HeaderMenu< Item >(\n\t{\n\t\tfieldId,\n\t\tview,\n\t\tfields,\n\t\tonChangeView,\n\t\tonHide,\n\t\tsetOpenedFilter,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = getVisibleFieldIds( view, fields );\n\tconst index = visibleFieldIds?.indexOf( fieldId ) as number;\n\tconst isSorted = view.sort?.field === fieldId;\n\tlet isHidable = false;\n\tlet isSortable = false;\n\tlet canAddFilter = false;\n\tlet header;\n\tlet operators: Operator[] = [];\n\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === fieldId\n\t);\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! combinedField ) {\n\t\tif ( ! field ) {\n\t\t\t// No combined or regular field found.\n\t\t\treturn null;\n\t\t}\n\n\t\tisHidable = field.enableHiding !== false;\n\t\tisSortable = field.enableSorting !== false;\n\t\theader = field.header;\n\n\t\toperators = sanitizeOperators( field );\n\t\t// Filter can be added:\n\t\t// 1. If the field is not already part of a view's filters.\n\t\t// 2. If the field meets the type and operator requirements.\n\t\t// 3. If it's not primary. If it is, it should be already visible.\n\t\tcanAddFilter =\n\t\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t\t!! field.elements?.length &&\n\t\t\t!! operators.length &&\n\t\t\t! field.filterBy?.isPrimary;\n\t} else {\n\t\theader = combinedField.header || combinedField.label;\n\t}\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\talign=\"start\"\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"dataviews-view-table-header-button\"\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t>\n\t\t\t\t\t{ header }\n\t\t\t\t\t{ view.sort && isSorted && (\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{ sortArrows[ view.sort.direction ] }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tstyle={ { minWidth: '240px' } }\n\t\t>\n\t\t\t<WithDropDownMenuSeparators>\n\t\t\t\t{ isSortable && (\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ SORTING_DIRECTIONS.map(\n\t\t\t\t\t\t\t( direction: SortDirection ) => {\n\t\t\t\t\t\t\t\tconst isChecked =\n\t\t\t\t\t\t\t\t\tview.sort &&\n\t\t\t\t\t\t\t\t\tisSorted &&\n\t\t\t\t\t\t\t\t\tview.sort.direction === direction;\n\n\t\t\t\t\t\t\t\tconst value = `${ fieldId }-${ direction }`;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t// All sorting radio items share the same name, so that\n\t\t\t\t\t\t\t\t\t\t// selecting a sorting option automatically deselects the\n\t\t\t\t\t\t\t\t\t\t// previously selected one, even if it is displayed in\n\t\t\t\t\t\t\t\t\t\t// another submenu. The field and direction are passed via\n\t\t\t\t\t\t\t\t\t\t// the `value` prop.\n\t\t\t\t\t\t\t\t\t\tname=\"view-table-sorting\"\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tchecked={ isChecked }\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\t\tsort: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdirection,\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>\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ sortLabels[ direction ] }\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t) }\n\t\t\t\t{ canAddFilter && (\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ funnel } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetOpenedFilter( fieldId );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t...( view.filters || [] ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\tvalue: undefined,\n\t\t\t\t\t\t\t\t\t\t\toperator: operators[ 0 ],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t) }\n\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\tindex - 1\n\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 1 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t{ __( 'Move left' ) }\n\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\tdisabled={ index >= visibleFieldIds.length - 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice( 0, index ) ??\n\t\t\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 2 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t{ __( 'Move right' ) }\n\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t</WithDropDownMenuSeparators>\n\t\t</DropdownMenuV2>\n\t);\n} );\n\n// @ts-expect-error Lift the `Item` type argument through the forwardRef.\nconst ColumnHeaderMenu: < Item >(\n\tprops: PropsWithoutRef< HeaderMenuProps< Item > > &\n\t\tRefAttributes< HTMLButtonElement >\n) => ReturnType< typeof _HeaderMenu > = _HeaderMenu;\n\nexport default ColumnHeaderMenu;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACxE,SACCC,MAAM,EACNC,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,QAA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Apis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","Menu","WithMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","ref","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","header","operators","combinedField","layout","combinedFields","find","f","id","enableHiding","enableSorting","filters","some","_filter","elements","length","filterBy","isPrimary","label","align","trigger","size","className","variant","direction","style","minWidth","Group","isChecked","value","RadioItem","name","checked","onChange","ItemLabel","Item","prefix","icon","onClick","page","undefined","operator","disabled","_visibleFieldIds$slic","slice","_visibleFieldIds$slic2","ColumnHeaderMenu"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-header-menu.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, Ref, PropsWithoutRef, RefAttributes } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight, unseen, funnel } from '@wordpress/icons';\nimport {\n\tButton,\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef, Children, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { sanitizeOperators } from '../../utils';\nimport { SORTING_DIRECTIONS, sortArrows, sortLabels } from '../../constants';\nimport type {\n\tNormalizedField,\n\tSortDirection,\n\tViewTable as ViewTableType,\n\tOperator,\n} from '../../types';\nimport { getVisibleFieldIds } from '../index';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\ninterface HeaderMenuProps< Item > {\n\tfieldId: string;\n\tview: ViewTableType;\n\tfields: NormalizedField< Item >[];\n\tonChangeView: ( view: ViewTableType ) => void;\n\tonHide: ( field: NormalizedField< Item > ) => void;\n\tsetOpenedFilter: ( fieldId: string ) => void;\n}\n\nfunction WithMenuSeparators( { children }: { children: ReactNode } ) {\n\treturn Children.toArray( children )\n\t\t.filter( Boolean )\n\t\t.map( ( child, i ) => (\n\t\t\t<Fragment key={ i }>\n\t\t\t\t{ i > 0 && <Menu.Separator /> }\n\t\t\t\t{ child }\n\t\t\t</Fragment>\n\t\t) );\n}\n\nconst _HeaderMenu = forwardRef( function HeaderMenu< Item >(\n\t{\n\t\tfieldId,\n\t\tview,\n\t\tfields,\n\t\tonChangeView,\n\t\tonHide,\n\t\tsetOpenedFilter,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = getVisibleFieldIds( view, fields );\n\tconst index = visibleFieldIds?.indexOf( fieldId ) as number;\n\tconst isSorted = view.sort?.field === fieldId;\n\tlet isHidable = false;\n\tlet isSortable = false;\n\tlet canAddFilter = false;\n\tlet header;\n\tlet operators: Operator[] = [];\n\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === fieldId\n\t);\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! combinedField ) {\n\t\tif ( ! field ) {\n\t\t\t// No combined or regular field found.\n\t\t\treturn null;\n\t\t}\n\n\t\tisHidable = field.enableHiding !== false;\n\t\tisSortable = field.enableSorting !== false;\n\t\theader = field.header;\n\n\t\toperators = sanitizeOperators( field );\n\t\t// Filter can be added:\n\t\t// 1. If the field is not already part of a view's filters.\n\t\t// 2. If the field meets the type and operator requirements.\n\t\t// 3. If it's not primary. If it is, it should be already visible.\n\t\tcanAddFilter =\n\t\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t\t!! field.elements?.length &&\n\t\t\t!! operators.length &&\n\t\t\t! field.filterBy?.isPrimary;\n\t} else {\n\t\theader = combinedField.header || combinedField.label;\n\t}\n\n\treturn (\n\t\t<Menu\n\t\t\talign=\"start\"\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"dataviews-view-table-header-button\"\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t>\n\t\t\t\t\t{ header }\n\t\t\t\t\t{ view.sort && isSorted && (\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{ sortArrows[ view.sort.direction ] }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tstyle={ { minWidth: '240px' } }\n\t\t>\n\t\t\t<WithMenuSeparators>\n\t\t\t\t{ isSortable && (\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ SORTING_DIRECTIONS.map(\n\t\t\t\t\t\t\t( direction: SortDirection ) => {\n\t\t\t\t\t\t\t\tconst isChecked =\n\t\t\t\t\t\t\t\t\tview.sort &&\n\t\t\t\t\t\t\t\t\tisSorted &&\n\t\t\t\t\t\t\t\t\tview.sort.direction === direction;\n\n\t\t\t\t\t\t\t\tconst value = `${ fieldId }-${ direction }`;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t// All sorting radio items share the same name, so that\n\t\t\t\t\t\t\t\t\t\t// selecting a sorting option automatically deselects the\n\t\t\t\t\t\t\t\t\t\t// previously selected one, even if it is displayed in\n\t\t\t\t\t\t\t\t\t\t// another submenu. The field and direction are passed via\n\t\t\t\t\t\t\t\t\t\t// the `value` prop.\n\t\t\t\t\t\t\t\t\t\tname=\"view-table-sorting\"\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tchecked={ isChecked }\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\t\tsort: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdirection,\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>\n\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ sortLabels[ direction ] }\n\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t) }\n\t\t\t\t{ canAddFilter && (\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ funnel } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetOpenedFilter( fieldId );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t...( view.filters || [] ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\tvalue: undefined,\n\t\t\t\t\t\t\t\t\t\t\toperator: operators[ 0 ],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t) }\n\t\t\t\t<Menu.Group>\n\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\tindex - 1\n\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 1 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu.ItemLabel>{ __( 'Move left' ) }</Menu.ItemLabel>\n\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\tdisabled={ index >= visibleFieldIds.length - 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice( 0, index ) ??\n\t\t\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 2 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu.ItemLabel>{ __( 'Move right' ) }</Menu.ItemLabel>\n\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t) }\n\t\t\t\t</Menu.Group>\n\t\t\t</WithMenuSeparators>\n\t\t</Menu>\n\t);\n} );\n\n// @ts-expect-error Lift the `Item` type argument through the forwardRef.\nconst ColumnHeaderMenu: < Item >(\n\tprops: PropsWithoutRef< HeaderMenuProps< Item > > &\n\t\tRefAttributes< HTMLButtonElement >\n) => ReturnType< typeof _HeaderMenu > = _HeaderMenu;\n\nexport default ColumnHeaderMenu;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACxE,SACCC,MAAM,EACNC,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEnE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,kBAAkB,EAAEC,UAAU,EAAEC,UAAU,QAAQ,iBAAi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oD,KAAK,CAAE,CAAC,EAAEnD,KAAM,CAAC,cAAAoD,sBAAA,cAAAA,sBAAA,GACrC,EAAE,CAAE,EACLrD,eAAe,CAAEC,KAAK,GAAG,CAAC,CAAE,EAC5BR,OAAO,EACP,GAAGO,eAAe,CAACoD,KAAK,CAAEnD,KAAK,GAAG,CAAE,CAAC;YAEvC,CAAE,CAAC;UACJ,CAAG;UAAAlB,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC6D,SAAS;YAAA3D,QAAA,EAAGxB,EAAE,CAAE,YAAa;UAAC,CAAkB;QAAC,CAC7C,CAAC,EACV+C,SAAS,IAAID,KAAK,iBACnB3B,IAAA,CAACG,IAAI,CAAC8D,IAAI;UACTC,MAAM,eAAGlE,IAAA,CAACb,IAAI;YAACgF,IAAI,EAAGnF;UAAQ,CAAE,CAAG;UACnCoF,OAAO,EAAGA,CAAA,KAAM;YACfjD,MAAM,CAAEQ,KAAM,CAAC;YACfT,YAAY,CAAE;cACb,GAAGF,IAAI;cACPC,MAAM,EAAEK,eAAe,CAACf,MAAM,CAC3B+B,EAAE,IAAMA,EAAE,KAAKvB,OAClB;YACD,CAAE,CAAC;UACJ,CAAG;UAAAV,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC6D,SAAS;YAAA3D,QAAA,EACZxB,EAAE,CAAE,aAAc;UAAC,CACN;QAAC,CACP,CACX;MAAA,CACU,CAAC;IAAA,CACM;EAAC,CAChB,CAAC;AAET,CAAE,CAAC;;AAEH;AACA,MAAM+F,gBAG+B,GAAG/D,WAAW;AAEnD,eAAe+D,gBAAgB","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< { item: Item } >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\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\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\theader?: string | ReactElement;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\nexport interface 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 * 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\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":[]}
|
|
@@ -847,7 +847,7 @@ ul.dataviews-view-list {
|
|
|
847
847
|
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions {
|
|
848
848
|
flex-basis: min-content;
|
|
849
849
|
overflow: unset;
|
|
850
|
-
|
|
850
|
+
padding-inline-end: 4px;
|
|
851
851
|
}
|
|
852
852
|
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions .components-button {
|
|
853
853
|
opacity: 1;
|
|
@@ -937,11 +937,6 @@ ul.dataviews-view-list {
|
|
|
937
937
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
938
938
|
border-radius: 4px;
|
|
939
939
|
}
|
|
940
|
-
.dataviews-view-list .dataviews-view-list__media-placeholder {
|
|
941
|
-
width: 52px;
|
|
942
|
-
height: 52px;
|
|
943
|
-
background-color: #e0e0e0;
|
|
944
|
-
}
|
|
945
940
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
946
941
|
min-height: 52px;
|
|
947
942
|
flex-grow: 1;
|
package/build-style/style.css
CHANGED
|
@@ -847,7 +847,7 @@ ul.dataviews-view-list {
|
|
|
847
847
|
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions {
|
|
848
848
|
flex-basis: min-content;
|
|
849
849
|
overflow: unset;
|
|
850
|
-
|
|
850
|
+
padding-inline-end: 4px;
|
|
851
851
|
}
|
|
852
852
|
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions .components-button {
|
|
853
853
|
opacity: 1;
|
|
@@ -937,11 +937,6 @@ ul.dataviews-view-list {
|
|
|
937
937
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
938
938
|
border-radius: 4px;
|
|
939
939
|
}
|
|
940
|
-
.dataviews-view-list .dataviews-view-list__media-placeholder {
|
|
941
|
-
width: 52px;
|
|
942
|
-
height: 52px;
|
|
943
|
-
background-color: #e0e0e0;
|
|
944
|
-
}
|
|
945
940
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
946
941
|
min-height: 52px;
|
|
947
942
|
flex-grow: 1;
|
|
@@ -5,7 +5,7 @@ interface AddFilterProps {
|
|
|
5
5
|
onChangeView: (view: View) => void;
|
|
6
6
|
setOpenedFilter: (filter: string | null) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function AddFilterMenu({ filters, view, onChangeView, setOpenedFilter, trigger, }: AddFilterProps & {
|
|
9
9
|
trigger: React.ReactNode;
|
|
10
10
|
}): import("react").JSX.Element;
|
|
11
11
|
declare const _default: import("react").ForwardRefExoticComponent<AddFilterProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-filter.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-filters/add-filter.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAI1D,UAAU,cAAc;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,eAAe,EAAE,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,KAAM,IAAI,CAAC;CACnD;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"add-filter.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-filters/add-filter.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAI1D,UAAU,cAAc;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,eAAe,EAAE,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,KAAM,IAAI,CAAC;CACnD;AAED,wBAAgB,aAAa,CAAE,EAC9B,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,OAAO,GACP,EAAE,cAAc,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,+BA8BA;;AA6BD,wBAAuC"}
|
|
@@ -18,7 +18,7 @@ interface ActionWithModalProps<Item> extends ActionModalProps<Item> {
|
|
|
18
18
|
ActionTrigger: (props: ActionTriggerProps<Item>) => ReactElement;
|
|
19
19
|
isBusy?: boolean;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
21
|
+
interface ActionsMenuGroupProps<Item> {
|
|
22
22
|
actions: Action<Item>[];
|
|
23
23
|
item: Item;
|
|
24
24
|
}
|
|
@@ -29,7 +29,7 @@ interface ItemActionsProps<Item> {
|
|
|
29
29
|
}
|
|
30
30
|
export declare function ActionModal<Item>({ action, items, closeModal, }: ActionModalProps<Item>): import("react").JSX.Element;
|
|
31
31
|
export declare function ActionWithModal<Item>({ action, items, ActionTrigger, isBusy, }: ActionWithModalProps<Item>): import("react").JSX.Element;
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function ActionsMenuGroup<Item>({ actions, item, }: ActionsMenuGroupProps<Item>): import("react").JSX.Element;
|
|
33
33
|
export default function ItemActions<Item>({ item, actions, isCompact, }: ItemActionsProps<Item>): import("react").JSX.Element;
|
|
34
34
|
export {};
|
|
35
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-item-actions/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAoB7D,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,aAAa,CAAC;AAI1E,MAAM,WAAW,kBAAkB,CAAE,IAAI;IACxC,MAAM,EAAE,MAAM,CAAE,IAAI,CAAE,CAAC;IACvB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EA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;AAED,UAAU,qBAAqB,CAAE,IAAI;IACpC,OAAO,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC1B,IAAI,EAAE,IAAI,CAAC;CACX;AAED,UAAU,gBAAgB,CAAE,IAAI;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AA0CD,wBAAgB,WAAW,CAAE,IAAI,EAAI,EACpC,MAAM,EACN,KAAK,EACL,UAAU,GACV,EAAE,gBAAgB,CAAE,IAAI,CAAE,+BAiB1B;AAED,wBAAgB,eAAe,CAAE,IAAI,EAAI,EACxC,MAAM,EACN,KAAK,EACL,aAAa,EACb,MAAM,GACN,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAsB9B;AAED,wBAAgB,gBAAgB,CAAE,IAAI,EAAI,EACzC,OAAO,EACP,IAAI,GACJ,EAAE,qBAAqB,CAAE,IAAI,CAAE,+BA4B/B;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,IAAI,EAAI,EAC5C,IAAI,EACJ,OAAO,EACP,SAAS,GACT,EAAE,gBAAgB,CAAE,IAAI,CAAE,+BAuD1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-selection-checkbox/index.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,UAAU,+BAA+B,CAAE,IAAI;IAC9C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,YAAY,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAE,IAAI,CAAE,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAE,IAAI,EAAI,EAC3D,SAAS,EACT,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,GACR,EAAE,+BAA+B,CAAE,IAAI,CAAE,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-selection-checkbox/index.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,UAAU,+BAA+B,CAAE,IAAI;IAC9C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,EAAE,YAAY,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAE,IAAI,CAAE,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAE,IAAI,EAAI,EAC3D,SAAS,EACT,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,GACR,EAAE,+BAA+B,CAAE,IAAI,CAAE,+BAqCzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-view-config/index.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-view-config/index.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,aAAa,CAAC;AA2gBjE,iBAAS,oBAAoB,CAAE,EAC9B,OAAO,EACP,UAAU,EACV,cAAkD,GAClD,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAE,KAAK,CAAC,cAAc,CAAE,MAAM,CAAE,CAAE,CAAC;IAC7D,cAAc,CAAC,EAAE,gBAAgB,CAAC;CAClC,+BAUA;AAED,QAAA,MAAM,mBAAmB,kEAA+B,CAAC;AAEzD,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dataviews-layouts/list/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAA2B,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dataviews-layouts/list/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAA2B,aAAa,EAAE,MAAM,aAAa,CAAC;AA+P1E,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAI,KAAK,EAAE,aAAa,CAAE,IAAI,CAAE,+BAyLrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-header-menu.d.ts","sourceRoot":"","sources":["../../../src/dataviews-layouts/table/column-header-menu.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAkB,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAoB5E,OAAO,KAAK,EACX,eAAe,EAEf,SAAS,IAAI,aAAa,EAE1B,MAAM,aAAa,CAAC;AAKrB,UAAU,eAAe,CAAE,IAAI;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,YAAY,EAAE,CAAE,IAAI,EAAE,aAAa,KAAM,IAAI,CAAC;IAC9C,MAAM,EAAE,CAAE,KAAK,EAAE,eAAe,CAAE,IAAI,CAAE,KAAM,IAAI,CAAC;IACnD,eAAe,EAAE,CAAE,OAAO,EAAE,MAAM,KAAM,IAAI,CAAC;CAC7C;AAaD,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"column-header-menu.d.ts","sourceRoot":"","sources":["../../../src/dataviews-layouts/table/column-header-menu.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAkB,eAAe,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAoB5E,OAAO,KAAK,EACX,eAAe,EAEf,SAAS,IAAI,aAAa,EAE1B,MAAM,aAAa,CAAC;AAKrB,UAAU,eAAe,CAAE,IAAI;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,YAAY,EAAE,CAAE,IAAI,EAAE,aAAa,KAAM,IAAI,CAAC;IAC9C,MAAM,EAAE,CAAE,KAAK,EAAE,eAAe,CAAE,IAAI,CAAE,KAAM,IAAI,CAAC;IACnD,eAAe,EAAE,CAAE,OAAO,EAAE,MAAM,KAAM,IAAI,CAAC;CAC7C;AAaD,QAAA,MAAM,WAAW,wGAsMd,CAAC;AAGJ,QAAA,MAAM,gBAAgB,EAAE,CAAE,IAAI,EAC7B,KAAK,EAAE,eAAe,CAAE,eAAe,CAAE,IAAI,CAAE,CAAE,GAChD,aAAa,CAAE,iBAAiB,CAAE,KAC/B,UAAU,CAAE,OAAO,WAAW,CAAgB,CAAC;AAEpD,eAAe,gBAAgB,CAAC"}
|
package/build-types/types.d.ts
CHANGED
|
@@ -82,9 +82,7 @@ export type Field<Item> = {
|
|
|
82
82
|
/**
|
|
83
83
|
* Callback used to render the field. Defaults to `field.getValue`.
|
|
84
84
|
*/
|
|
85
|
-
render?: ComponentType<
|
|
86
|
-
item: Item;
|
|
87
|
-
}>;
|
|
85
|
+
render?: ComponentType<DataViewRenderFieldProps<Item>>;
|
|
88
86
|
/**
|
|
89
87
|
* Callback used to render an edit control for the field.
|
|
90
88
|
*/
|
|
@@ -131,9 +129,7 @@ export type NormalizedField<Item> = Field<Item> & {
|
|
|
131
129
|
getValue: (args: {
|
|
132
130
|
item: Item;
|
|
133
131
|
}) => any;
|
|
134
|
-
render: ComponentType<
|
|
135
|
-
item: Item;
|
|
136
|
-
}>;
|
|
132
|
+
render: ComponentType<DataViewRenderFieldProps<Item>>;
|
|
137
133
|
Edit: ComponentType<DataFormControlProps<Item>>;
|
|
138
134
|
sort: (a: Item, b: Item, direction: SortDirection) => number;
|
|
139
135
|
isValid: (item: Item, context?: ValidationContext) => boolean;
|
|
@@ -151,6 +147,9 @@ export type DataFormControlProps<Item> = {
|
|
|
151
147
|
onChange: (value: Record<string, any>) => void;
|
|
152
148
|
hideLabelFromVision?: boolean;
|
|
153
149
|
};
|
|
150
|
+
export type DataViewRenderFieldProps<Item> = {
|
|
151
|
+
item: Item;
|
|
152
|
+
};
|
|
154
153
|
/**
|
|
155
154
|
* The filters applied to the dataset.
|
|
156
155
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEzD;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,MAAM,CAAE,KAAK,SAAS,GAAG,GAAG,GAAG;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,cAAc;IACvB;;OAEG;IACH,SAAS,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E,IAAI;IAC/C,KAAK,EAAE,2BAA2B,CAAE,IAAI,CAAE,CAAC;IAC3C,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,CAAE,MAAM,EAAE,GAAG,CAAE,KAAM,IAAI,CAAC;IACnD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,2BAA2B,CAAE,IAAI,IAAK,iBAAiB,CAAE,IAAI,CAAE,GAAG;IAC7E,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,aAAa,CAAE,yBAAyB,CAAE,IAAI,CAAE,CAAE,CAAC;CAC1D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,IAAI,CAAE,IAAI,IAAK;IAC1B,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAE,IAAI,CAAE,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,WAAW,aAAa,CAAE,IAAI;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,KAAK,CAAE,IAAI,CAAE,EAAE,CAAC;IACxB,IAAI,EAAE,IAAI,CAAE,IAAI,CAAE,CAAC;IACnB,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,CAAE,MAAM,EAAE,GAAG,CAAE,KAAM,IAAI,CAAC;CACnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dataviews",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@ariakit/react": "^0.4.10",
|
|
32
32
|
"@babel/runtime": "7.25.7",
|
|
33
|
-
"@wordpress/components": "
|
|
34
|
-
"@wordpress/compose": "
|
|
35
|
-
"@wordpress/data": "
|
|
36
|
-
"@wordpress/element": "
|
|
37
|
-
"@wordpress/i18n": "
|
|
38
|
-
"@wordpress/icons": "
|
|
39
|
-
"@wordpress/primitives": "
|
|
40
|
-
"@wordpress/private-apis": "
|
|
41
|
-
"@wordpress/warning": "
|
|
33
|
+
"@wordpress/components": "*",
|
|
34
|
+
"@wordpress/compose": "*",
|
|
35
|
+
"@wordpress/data": "*",
|
|
36
|
+
"@wordpress/element": "*",
|
|
37
|
+
"@wordpress/i18n": "*",
|
|
38
|
+
"@wordpress/icons": "*",
|
|
39
|
+
"@wordpress/primitives": "*",
|
|
40
|
+
"@wordpress/private-apis": "*",
|
|
41
|
+
"@wordpress/warning": "*",
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"remove-accents": "^0.5.0"
|
|
44
44
|
},
|
|
@@ -48,5 +48,6 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"wpScript": true,
|
|
52
|
+
"gitHead": "dcf4613b33b0eda14e203ac30f700ed0db70347f"
|
|
52
53
|
}
|
|
@@ -269,7 +269,7 @@ function FooterContent< Item >( {
|
|
|
269
269
|
const [ actionInProgress, setActionInProgress ] = useState< string | null >(
|
|
270
270
|
null
|
|
271
271
|
);
|
|
272
|
-
const
|
|
272
|
+
const footerContentRef = useRef< JSX.Element | null >( null );
|
|
273
273
|
|
|
274
274
|
const bulkActions = useMemo(
|
|
275
275
|
() => actions.filter( ( action ) => action.supportsBulk ),
|
|
@@ -306,8 +306,8 @@ function FooterContent< Item >( {
|
|
|
306
306
|
[ actions, selectedItems ]
|
|
307
307
|
);
|
|
308
308
|
if ( ! actionInProgress ) {
|
|
309
|
-
if (
|
|
310
|
-
|
|
309
|
+
if ( footerContentRef.current ) {
|
|
310
|
+
footerContentRef.current = null;
|
|
311
311
|
}
|
|
312
312
|
return renderFooterContent(
|
|
313
313
|
data,
|
|
@@ -320,8 +320,8 @@ function FooterContent< Item >( {
|
|
|
320
320
|
setActionInProgress,
|
|
321
321
|
onChangeSelection
|
|
322
322
|
);
|
|
323
|
-
} else if ( !
|
|
324
|
-
|
|
323
|
+
} else if ( ! footerContentRef.current ) {
|
|
324
|
+
footerContentRef.current = renderFooterContent(
|
|
325
325
|
data,
|
|
326
326
|
actions,
|
|
327
327
|
getItemId,
|
|
@@ -333,7 +333,7 @@ function FooterContent< Item >( {
|
|
|
333
333
|
onChangeSelection
|
|
334
334
|
);
|
|
335
335
|
}
|
|
336
|
-
return
|
|
336
|
+
return footerContentRef.current;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
export function BulkActionsFooter() {
|
|
@@ -19,7 +19,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
19
19
|
import { unlock } from '../../lock-unlock';
|
|
20
20
|
import type { NormalizedFilter, View } from '../../types';
|
|
21
21
|
|
|
22
|
-
const {
|
|
22
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
23
23
|
|
|
24
24
|
interface AddFilterProps {
|
|
25
25
|
filters: NormalizedFilter[];
|
|
@@ -28,7 +28,7 @@ interface AddFilterProps {
|
|
|
28
28
|
setOpenedFilter: ( filter: string | null ) => void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export function
|
|
31
|
+
export function AddFilterMenu( {
|
|
32
32
|
filters,
|
|
33
33
|
view,
|
|
34
34
|
onChangeView,
|
|
@@ -39,10 +39,10 @@ export function AddFilterDropdownMenu( {
|
|
|
39
39
|
} ) {
|
|
40
40
|
const inactiveFilters = filters.filter( ( filter ) => ! filter.isVisible );
|
|
41
41
|
return (
|
|
42
|
-
<
|
|
42
|
+
<Menu trigger={ trigger }>
|
|
43
43
|
{ inactiveFilters.map( ( filter ) => {
|
|
44
44
|
return (
|
|
45
|
-
<
|
|
45
|
+
<Menu.Item
|
|
46
46
|
key={ filter.field }
|
|
47
47
|
onClick={ () => {
|
|
48
48
|
setOpenedFilter( filter.field );
|
|
@@ -60,13 +60,11 @@ export function AddFilterDropdownMenu( {
|
|
|
60
60
|
} );
|
|
61
61
|
} }
|
|
62
62
|
>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
</DropdownMenuV2.ItemLabel>
|
|
66
|
-
</DropdownMenuV2.Item>
|
|
63
|
+
<Menu.ItemLabel>{ filter.name }</Menu.ItemLabel>
|
|
64
|
+
</Menu.Item>
|
|
67
65
|
);
|
|
68
66
|
} ) }
|
|
69
|
-
</
|
|
67
|
+
</Menu>
|
|
70
68
|
);
|
|
71
69
|
}
|
|
72
70
|
|
|
@@ -79,7 +77,7 @@ function AddFilter(
|
|
|
79
77
|
}
|
|
80
78
|
const inactiveFilters = filters.filter( ( filter ) => ! filter.isVisible );
|
|
81
79
|
return (
|
|
82
|
-
<
|
|
80
|
+
<AddFilterMenu
|
|
83
81
|
trigger={
|
|
84
82
|
<Button
|
|
85
83
|
accessibleWhenDisabled
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from '@wordpress/element';
|
|
11
11
|
import { __experimentalHStack as HStack, Button } from '@wordpress/components';
|
|
12
12
|
import { funnel } from '@wordpress/icons';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { __, _x } from '@wordpress/i18n';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import FilterSummary from './filter-summary';
|
|
19
|
-
import { default as AddFilter,
|
|
19
|
+
import { default as AddFilter, AddFilterMenu } from './add-filter';
|
|
20
20
|
import ResetFilters from './reset-filters';
|
|
21
21
|
import DataViewsContext from '../dataviews-context';
|
|
22
22
|
import { sanitizeOperators } from '../../utils';
|
|
@@ -100,7 +100,7 @@ export function FilterVisibilityToggle( {
|
|
|
100
100
|
}
|
|
101
101
|
if ( ! hasVisibleFilters ) {
|
|
102
102
|
return (
|
|
103
|
-
<
|
|
103
|
+
<AddFilterMenu
|
|
104
104
|
filters={ filters }
|
|
105
105
|
view={ view }
|
|
106
106
|
onChangeView={ onChangeViewWithFilterVisibility }
|
|
@@ -124,7 +124,7 @@ export function FilterVisibilityToggle( {
|
|
|
124
124
|
className="dataviews-filters__visibility-toggle"
|
|
125
125
|
size="compact"
|
|
126
126
|
icon={ funnel }
|
|
127
|
-
label={
|
|
127
|
+
label={ _x( 'Filter', 'verb' ) }
|
|
128
128
|
onClick={ () => {
|
|
129
129
|
if ( ! isShowingFilter ) {
|
|
130
130
|
setOpenedFilter( null );
|
|
@@ -23,7 +23,7 @@ import { useRegistry } from '@wordpress/data';
|
|
|
23
23
|
import { unlock } from '../../lock-unlock';
|
|
24
24
|
import type { Action, ActionModal as ActionModalType } from '../../types';
|
|
25
25
|
|
|
26
|
-
const {
|
|
26
|
+
const { Menu, kebabCase } = unlock( componentsPrivateApis );
|
|
27
27
|
|
|
28
28
|
export interface ActionTriggerProps< Item > {
|
|
29
29
|
action: Action< Item >;
|
|
@@ -43,7 +43,7 @@ interface ActionWithModalProps< Item > extends ActionModalProps< Item > {
|
|
|
43
43
|
isBusy?: boolean;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
interface
|
|
46
|
+
interface ActionsMenuGroupProps< Item > {
|
|
47
47
|
actions: Action< Item >[];
|
|
48
48
|
item: Item;
|
|
49
49
|
}
|
|
@@ -77,7 +77,7 @@ function ButtonTrigger< Item >( {
|
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function
|
|
80
|
+
function MenuItemTrigger< Item >( {
|
|
81
81
|
action,
|
|
82
82
|
onClick,
|
|
83
83
|
items,
|
|
@@ -85,12 +85,12 @@ function DropdownMenuItemTrigger< Item >( {
|
|
|
85
85
|
const label =
|
|
86
86
|
typeof action.label === 'string' ? action.label : action.label( items );
|
|
87
87
|
return (
|
|
88
|
-
<
|
|
88
|
+
<Menu.Item
|
|
89
89
|
onClick={ onClick }
|
|
90
90
|
hideOnClick={ ! ( 'RenderModal' in action ) }
|
|
91
91
|
>
|
|
92
|
-
<
|
|
93
|
-
</
|
|
92
|
+
<Menu.ItemLabel>{ label }</Menu.ItemLabel>
|
|
93
|
+
</Menu.Item>
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -146,13 +146,13 @@ export function ActionWithModal< Item >( {
|
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export function
|
|
149
|
+
export function ActionsMenuGroup< Item >( {
|
|
150
150
|
actions,
|
|
151
151
|
item,
|
|
152
|
-
}:
|
|
152
|
+
}: ActionsMenuGroupProps< Item > ) {
|
|
153
153
|
const registry = useRegistry();
|
|
154
154
|
return (
|
|
155
|
-
<
|
|
155
|
+
<Menu.Group>
|
|
156
156
|
{ actions.map( ( action ) => {
|
|
157
157
|
if ( 'RenderModal' in action ) {
|
|
158
158
|
return (
|
|
@@ -160,12 +160,12 @@ export function ActionsDropdownMenuGroup< Item >( {
|
|
|
160
160
|
key={ action.id }
|
|
161
161
|
action={ action }
|
|
162
162
|
items={ [ item ] }
|
|
163
|
-
ActionTrigger={
|
|
163
|
+
ActionTrigger={ MenuItemTrigger }
|
|
164
164
|
/>
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
return (
|
|
168
|
-
<
|
|
168
|
+
<MenuItemTrigger
|
|
169
169
|
key={ action.id }
|
|
170
170
|
action={ action }
|
|
171
171
|
onClick={ () => {
|
|
@@ -175,7 +175,7 @@ export function ActionsDropdownMenuGroup< Item >( {
|
|
|
175
175
|
/>
|
|
176
176
|
);
|
|
177
177
|
} ) }
|
|
178
|
-
</
|
|
178
|
+
</Menu.Group>
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -245,7 +245,7 @@ function CompactItemActions< Item >( {
|
|
|
245
245
|
actions,
|
|
246
246
|
}: CompactItemActionsProps< Item > ) {
|
|
247
247
|
return (
|
|
248
|
-
<
|
|
248
|
+
<Menu
|
|
249
249
|
trigger={
|
|
250
250
|
<Button
|
|
251
251
|
size="compact"
|
|
@@ -258,7 +258,7 @@ function CompactItemActions< Item >( {
|
|
|
258
258
|
}
|
|
259
259
|
placement="bottom-end"
|
|
260
260
|
>
|
|
261
|
-
<
|
|
262
|
-
</
|
|
261
|
+
<ActionsMenuGroup actions={ actions } item={ item } />
|
|
262
|
+
</Menu>
|
|
263
263
|
);
|
|
264
264
|
}
|
|
@@ -33,8 +33,9 @@ export default function DataViewsSelectionCheckbox< Item >( {
|
|
|
33
33
|
if ( primaryField?.getValue && item ) {
|
|
34
34
|
// eslint-disable-next-line @wordpress/valid-sprintf
|
|
35
35
|
selectionLabel = sprintf(
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
checked
|
|
37
|
+
? /* translators: %s: item title. */ __( 'Deselect item: %s' )
|
|
38
|
+
: /* translators: %s: item title. */ __( 'Select item: %s' ),
|
|
38
39
|
primaryField.getValue( { item } )
|
|
39
40
|
);
|
|
40
41
|
} else {
|