@wordpress/dataviews 4.10.0 → 4.11.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 +19 -9
- package/LICENSE.md +1 -1
- package/README.md +309 -175
- package/build/components/dataviews/index.js +12 -1
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews-context/index.js +2 -1
- package/build/components/dataviews-context/index.js.map +1 -1
- package/build/components/dataviews-filters/add-filter.js +35 -30
- package/build/components/dataviews-filters/add-filter.js.map +1 -1
- package/build/components/dataviews-filters/index.js +3 -1
- package/build/components/dataviews-filters/index.js.map +1 -1
- package/build/components/dataviews-item-actions/index.js +24 -19
- package/build/components/dataviews-item-actions/index.js.map +1 -1
- package/build/components/dataviews-layout/index.js +2 -0
- package/build/components/dataviews-layout/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +48 -43
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/dataviews-layouts/grid/index.js +12 -5
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/grid/preview-size-picker.js +22 -25
- package/build/dataviews-layouts/grid/preview-size-picker.js.map +1 -1
- package/build/dataviews-layouts/list/index.js +27 -20
- package/build/dataviews-layouts/list/index.js.map +1 -1
- package/build/dataviews-layouts/table/column-header-menu.js +102 -99
- package/build/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build/dataviews-layouts/table/column-primary.js +7 -3
- package/build/dataviews-layouts/table/column-primary.js.map +1 -1
- package/build/dataviews-layouts/table/index.js +4 -0
- package/build/dataviews-layouts/table/index.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/components/dataviews/index.js +12 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-context/index.js +2 -1
- package/build-module/components/dataviews-context/index.js.map +1 -1
- package/build-module/components/dataviews-filters/add-filter.js +36 -31
- package/build-module/components/dataviews-filters/add-filter.js.map +1 -1
- package/build-module/components/dataviews-filters/index.js +3 -1
- package/build-module/components/dataviews-filters/index.js.map +1 -1
- package/build-module/components/dataviews-item-actions/index.js +24 -19
- package/build-module/components/dataviews-item-actions/index.js.map +1 -1
- package/build-module/components/dataviews-layout/index.js +2 -0
- package/build-module/components/dataviews-layout/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +49 -44
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/dataviews-layouts/grid/index.js +14 -7
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/grid/preview-size-picker.js +22 -25
- package/build-module/dataviews-layouts/grid/preview-size-picker.js.map +1 -1
- package/build-module/dataviews-layouts/list/index.js +27 -20
- package/build-module/dataviews-layouts/list/index.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-header-menu.js +102 -99
- package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-primary.js +7 -3
- package/build-module/dataviews-layouts/table/column-primary.js.map +1 -1
- package/build-module/dataviews-layouts/table/index.js +4 -0
- package/build-module/dataviews-layouts/table/index.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/style-rtl.css +45 -55
- package/build-style/style.css +45 -55
- package/build-types/components/dataviews/index.d.ts +2 -1
- package/build-types/components/dataviews/index.d.ts.map +1 -1
- package/build-types/components/dataviews-context/index.d.ts +2 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/add-filter.d.ts +3 -2
- package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/grid/preview-size-picker.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/dataviews-layouts/table/column-primary.d.ts +2 -1
- package/build-types/dataviews-layouts/table/column-primary.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/index.d.ts +1 -1
- package/build-types/dataviews-layouts/table/index.d.ts.map +1 -1
- package/build-types/test/dataform.d.ts +2 -0
- package/build-types/test/dataform.d.ts.map +1 -0
- package/build-types/test/dataviews.d.ts +2 -0
- package/build-types/test/dataviews.d.ts.map +1 -0
- package/build-types/test/normalize-fields.d.ts +2 -0
- package/build-types/test/normalize-fields.d.ts.map +1 -0
- package/build-types/test/validation.d.ts +2 -0
- package/build-types/test/validation.d.ts.map +1 -0
- package/build-types/types.d.ts +5 -0
- package/build-types/types.d.ts.map +1 -1
- package/build-wp/index.js +1209 -999
- package/package.json +13 -12
- package/src/components/dataviews/index.tsx +15 -1
- package/src/components/dataviews/style.scss +0 -1
- package/src/components/dataviews-context/index.ts +3 -0
- package/src/components/dataviews-filters/add-filter.tsx +43 -39
- package/src/components/dataviews-filters/index.tsx +1 -1
- package/src/components/dataviews-footer/style.scss +0 -3
- package/src/components/dataviews-item-actions/index.tsx +25 -27
- package/src/components/dataviews-layout/index.tsx +2 -0
- package/src/components/dataviews-view-config/index.tsx +52 -43
- package/src/components/dataviews-view-config/style.scss +0 -1
- package/src/dataviews-layouts/grid/index.tsx +17 -5
- package/src/dataviews-layouts/grid/preview-size-picker.tsx +25 -30
- package/src/dataviews-layouts/grid/style.scss +24 -33
- package/src/dataviews-layouts/list/index.tsx +35 -27
- package/src/dataviews-layouts/list/style.scss +5 -5
- package/src/dataviews-layouts/table/column-header-menu.tsx +152 -148
- package/src/dataviews-layouts/table/column-primary.tsx +7 -0
- package/src/dataviews-layouts/table/index.tsx +10 -0
- package/src/dataviews-layouts/table/style.scss +0 -1
- package/src/test/dataform.tsx +348 -0
- package/src/test/dataviews.tsx +380 -0
- package/src/types.ts +6 -0
- package/tsconfig.json +14 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/form-field-visibility/index.js +0 -32
- package/build/components/form-field-visibility/index.js.map +0 -1
- package/build-module/components/form-field-visibility/index.js +0 -26
- package/build-module/components/form-field-visibility/index.js.map +0 -1
- package/build-types/components/form-field-visibility/index.d.ts +0 -11
- package/build-types/components/form-field-visibility/index.d.ts.map +0 -1
- package/src/components/form-field-visibility/index.tsx +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","arrowLeft","arrowRight","unseen","funnel","Button","Icon","privateApis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","jsx","_jsx","jsxs","_jsxs","Menu","WithMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","canMove","ref","_view$fields","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","operators","find","f","id","enableHiding","enableSorting","header","filters","some","_filter","elements","length","filterBy","isPrimary","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';\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\tcanMove?: boolean;\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\tcanMove = true,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = 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 operators: Operator[] = [];\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! field ) {\n\t\t// No combined or regular field found.\n\t\treturn null;\n\t}\n\n\tisHidable = field.enableHiding !== false;\n\tisSortable = field.enableSorting !== false;\n\tconst header = field.header;\n\n\toperators = sanitizeOperators( field );\n\t// Filter can be added:\n\t// 1. If the field is not already part of a view's filters.\n\t// 2. If the field meets the type and operator requirements.\n\t// 3. If it's not primary. If it is, it should be already visible.\n\tcanAddFilter =\n\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t!! field.elements?.length &&\n\t\t!! operators.length &&\n\t\t! field.filterBy?.isPrimary;\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{ ( canMove || isHidable ) && field && (\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ canMove && (\n\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t\tindex - 1\n\t\t\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\tindex + 1\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} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'Move left' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ canMove && (\n\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\t\t\tdisabled={ index >= visibleFieldIds.length - 1 }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\tindex + 2\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} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'Move right' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\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\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t) }\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,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQ7E,MAAM;EAAEC;AAAK,CAAC,GAAGT,MAAM,CAAEJ,qBAAsB,CAAC;AAYhD,SAASc,kBAAkBA,CAAE;EAAEC;AAAkC,CAAC,EAAG;EACpE,OAAOb,QAAQ,CAACc,OAAO,CAAED,QAAS,CAAC,CACjCE,MAAM,CAAEC,OAAQ,CAAC,CACjBC,GAAG,CAAE,CAAEC,KAAK,EAAEC,CAAC,kBACfT,KAAA,CAACT,QAAQ;IAAAY,QAAA,GACNM,CAAC,GAAG,CAAC,iBAAIX,IAAA,CAACG,IAAI,CAACS,SAAS,IAAE,CAAC,EAC3BF,KAAK;EAAA,GAFQC,CAGN,CACT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EAAEO,eAAe,CAACjB,MAAM,CAC3B6B,EAAE,IAAMA,EAAE,KAAKrB,OAClB;YACD,CAAE,CAAC;UACJ,CAAG;UAAAV,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC2D,SAAS;YAAAzD,QAAA,EACZvB,EAAE,CAAE,aAAc;UAAC,CACN;QAAC,CACP,CACX;MAAA,CACU,CACZ;IAAA,CACkB;EAAC,CAChB,CAAC;AAET,CAAE,CAAC;;AAEH;AACA,MAAM4F,gBAG+B,GAAG7D,WAAW;AAEnD,eAAe6D,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","arrowLeft","arrowRight","unseen","funnel","Button","Icon","privateApis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","jsx","_jsx","jsxs","_jsxs","Menu","WithMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","canMove","ref","_view$fields","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","operators","find","f","id","enableHiding","enableSorting","header","filters","some","_filter","elements","length","filterBy","isPrimary","TriggerButton","render","size","className","variant","direction","Popover","style","minWidth","Group","isChecked","value","RadioItem","name","checked","onChange","showLevels","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';\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\tcanMove?: boolean;\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\tcanMove = true,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = 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 operators: Operator[] = [];\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! field ) {\n\t\t// No combined or regular field found.\n\t\treturn null;\n\t}\n\n\tisHidable = field.enableHiding !== false;\n\tisSortable = field.enableSorting !== false;\n\tconst header = field.header;\n\n\toperators = sanitizeOperators( field );\n\t// Filter can be added:\n\t// 1. If the field is not already part of a view's filters.\n\t// 2. If the field meets the type and operator requirements.\n\t// 3. If it's not primary. If it is, it should be already visible.\n\tcanAddFilter =\n\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t!! field.elements?.length &&\n\t\t!! operators.length &&\n\t\t! field.filterBy?.isPrimary;\n\n\treturn (\n\t\t<Menu>\n\t\t\t<Menu.TriggerButton\n\t\t\t\trender={\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tclassName=\"dataviews-view-table-header-button\"\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ header }\n\t\t\t\t{ view.sort && isSorted && (\n\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t{ sortArrows[ view.sort.direction ] }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</Menu.TriggerButton>\n\t\t\t<Menu.Popover style={ { minWidth: '240px' } }>\n\t\t\t\t<WithMenuSeparators>\n\t\t\t\t\t{ isSortable && (\n\t\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t\t{ SORTING_DIRECTIONS.map(\n\t\t\t\t\t\t\t\t( direction: SortDirection ) => {\n\t\t\t\t\t\t\t\t\tconst isChecked =\n\t\t\t\t\t\t\t\t\t\tview.sort &&\n\t\t\t\t\t\t\t\t\t\tisSorted &&\n\t\t\t\t\t\t\t\t\t\tview.sort.direction === direction;\n\n\t\t\t\t\t\t\t\t\tconst value = `${ fieldId }-${ direction }`;\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\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\t// selecting a sorting option automatically deselects the\n\t\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\t// another submenu. The field and direction are passed via\n\t\t\t\t\t\t\t\t\t\t\t// the `value` prop.\n\t\t\t\t\t\t\t\t\t\t\tname=\"view-table-sorting\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ isChecked }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\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\t\tsort: {\n\t\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\t\tdirection,\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\tshowLevels: false,\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\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{ sortLabels[ direction ] }\n\t\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t</Menu.RadioItem>\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</Menu.Group>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canAddFilter && (\n\t\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\tprefix={ <Icon icon={ funnel } /> }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetOpenedFilter( fieldId );\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t\t...( view.filters || [] ),\n\t\t\t\t\t\t\t\t\t\t\t{\n\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\tvalue: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\toperator: operators[ 0 ],\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} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t</Menu.Group>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( canMove || isHidable ) && field && (\n\t\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t\t{ canMove && (\n\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex - 1\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\tfieldId,\n\t\t\t\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex + 1\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>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Move left' ) }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ canMove && (\n\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\tindex >= visibleFieldIds.length - 1\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex\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\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex + 2\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>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Move right' ) }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\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>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Menu.Group>\n\t\t\t\t\t) }\n\t\t\t\t</WithMenuSeparators>\n\t\t\t</Menu.Popover>\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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zD,YAAY,CAAE;gBACb,GAAGF,IAAI;gBACPC,MAAM,EAAE,CACP,KAAA0D,sBAAA,GAAKnD,eAAe,CAACkD,KAAK,CACzB,CAAC,EACDjD,KACD,CAAC,cAAAkD,sBAAA,cAAAA,sBAAA,GAAI,EAAE,CAAE,EACTnD,eAAe,CAAEC,KAAK,GAAG,CAAC,CAAE,EAC5BV,OAAO,EACP,GAAGS,eAAe,CAACkD,KAAK,CACvBjD,KAAK,GAAG,CACT,CAAC;cAEH,CAAE,CAAC;YACJ,CAAG;YAAApB,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC6D,SAAS;cAAA3D,QAAA,EACZvB,EAAE,CAAE,YAAa;YAAC,CACL;UAAC,CACP,CACX,EACCgD,SAAS,IAAID,KAAK,iBACnB7B,IAAA,CAACG,IAAI,CAAC8D,IAAI;YACTC,MAAM,eAAGlE,IAAA,CAACZ,IAAI;cAAC+E,IAAI,EAAGlF;YAAQ,CAAE,CAAG;YACnCmF,OAAO,EAAGA,CAAA,KAAM;cACfjD,MAAM,CAAEU,KAAM,CAAC;cACfX,YAAY,CAAE;gBACb,GAAGF,IAAI;gBACPC,MAAM,EAAEO,eAAe,CAACjB,MAAM,CAC3B6B,EAAE,IAAMA,EAAE,KAAKrB,OAClB;cACD,CAAE,CAAC;YACJ,CAAG;YAAAV,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC6D,SAAS;cAAA3D,QAAA,EACZvB,EAAE,CAAE,aAAc;YAAC,CACN;UAAC,CACP,CACX;QAAA,CACU,CACZ;MAAA,CACkB;IAAC,CACR,CAAC;EAAA,CACV,CAAC;AAET,CAAE,CAAC;;AAEH;AACA,MAAM8F,gBAG+B,GAAG/D,WAAW;AAEnD,eAAe+D,gBAAgB","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ import getClickableItemProps from '../utils/get-clickable-item-props';
|
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
function ColumnPrimary({
|
|
13
13
|
item,
|
|
14
|
+
level,
|
|
14
15
|
titleField,
|
|
15
16
|
mediaField,
|
|
16
17
|
descriptionField,
|
|
@@ -33,11 +34,14 @@ function ColumnPrimary({
|
|
|
33
34
|
})
|
|
34
35
|
}), /*#__PURE__*/_jsxs(VStack, {
|
|
35
36
|
spacing: 0,
|
|
36
|
-
children: [titleField && /*#__PURE__*/
|
|
37
|
+
children: [titleField && /*#__PURE__*/_jsxs("div", {
|
|
37
38
|
...clickableProps,
|
|
38
|
-
children: /*#__PURE__*/
|
|
39
|
+
children: [level !== undefined && /*#__PURE__*/_jsxs("span", {
|
|
40
|
+
className: "dataviews-view-table__level",
|
|
41
|
+
children: ['—'.repeat(level), "\xA0"]
|
|
42
|
+
}), /*#__PURE__*/_jsx(titleField.render, {
|
|
39
43
|
item: item
|
|
40
|
-
})
|
|
44
|
+
})]
|
|
41
45
|
}), descriptionField && /*#__PURE__*/_jsx(descriptionField.render, {
|
|
42
46
|
item: item
|
|
43
47
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","getClickableItemProps","jsx","_jsx","jsxs","_jsxs","ColumnPrimary","item","titleField","mediaField","descriptionField","onClickItem","isItemClickable","clickableProps","className","spacing","justify","children","render"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-primary.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { NormalizedField } from '../../types';\nimport getClickableItemProps from '../utils/get-clickable-item-props';\n\nfunction ColumnPrimary< Item >( {\n\titem,\n\ttitleField,\n\tmediaField,\n\tdescriptionField,\n\tonClickItem,\n\tisItemClickable,\n}: {\n\titem: Item;\n\ttitleField?: NormalizedField< Item >;\n\tmediaField?: NormalizedField< Item >;\n\tdescriptionField?: NormalizedField< Item >;\n\tonClickItem?: ( item: Item ) => void;\n\tisItemClickable: ( item: Item ) => boolean;\n} ) {\n\tconst clickableProps = getClickableItemProps( {\n\t\titem,\n\t\tisItemClickable,\n\t\tonClickItem,\n\t\tclassName:\n\t\t\t'dataviews-view-table__cell-content-wrapper dataviews-title-field',\n\t} );\n\treturn (\n\t\t<HStack spacing={ 3 } justify=\"flex-start\">\n\t\t\t{ mediaField && (\n\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media\">\n\t\t\t\t\t<mediaField.render item={ item } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t{ titleField && (\n\t\t\t\t\t<div { ...clickableProps }>\n\t\t\t\t\t\t<titleField.render item={ item } />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ descriptionField && (\n\t\t\t\t\t<descriptionField.render item={ item } />\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</HStack>\n\t);\n}\n\nexport default ColumnPrimary;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;;AAEA,OAAOC,qBAAqB,MAAM,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtE,SAASC,aAAaA,CAAU;EAC/BC,IAAI;EACJC,UAAU;EACVC,UAAU;EACVC,gBAAgB;EAChBC,WAAW;EACXC;
|
|
1
|
+
{"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","getClickableItemProps","jsx","_jsx","jsxs","_jsxs","ColumnPrimary","item","level","titleField","mediaField","descriptionField","onClickItem","isItemClickable","clickableProps","className","spacing","justify","children","render","undefined","repeat"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-primary.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { NormalizedField } from '../../types';\nimport getClickableItemProps from '../utils/get-clickable-item-props';\n\nfunction ColumnPrimary< Item >( {\n\titem,\n\tlevel,\n\ttitleField,\n\tmediaField,\n\tdescriptionField,\n\tonClickItem,\n\tisItemClickable,\n}: {\n\titem: Item;\n\tlevel?: number;\n\ttitleField?: NormalizedField< Item >;\n\tmediaField?: NormalizedField< Item >;\n\tdescriptionField?: NormalizedField< Item >;\n\tonClickItem?: ( item: Item ) => void;\n\tisItemClickable: ( item: Item ) => boolean;\n} ) {\n\tconst clickableProps = getClickableItemProps( {\n\t\titem,\n\t\tisItemClickable,\n\t\tonClickItem,\n\t\tclassName:\n\t\t\t'dataviews-view-table__cell-content-wrapper dataviews-title-field',\n\t} );\n\treturn (\n\t\t<HStack spacing={ 3 } justify=\"flex-start\">\n\t\t\t{ mediaField && (\n\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media\">\n\t\t\t\t\t<mediaField.render item={ item } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t{ titleField && (\n\t\t\t\t\t<div { ...clickableProps }>\n\t\t\t\t\t\t{ level !== undefined && (\n\t\t\t\t\t\t\t<span className=\"dataviews-view-table__level\">\n\t\t\t\t\t\t\t\t{ '—'.repeat( level ) } \n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<titleField.render item={ item } />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ descriptionField && (\n\t\t\t\t\t<descriptionField.render item={ item } />\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</HStack>\n\t);\n}\n\nexport default ColumnPrimary;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;;AAEA,OAAOC,qBAAqB,MAAM,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtE,SAASC,aAAaA,CAAU;EAC/BC,IAAI;EACJC,KAAK;EACLC,UAAU;EACVC,UAAU;EACVC,gBAAgB;EAChBC,WAAW;EACXC;AASD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAGb,qBAAqB,CAAE;IAC7CM,IAAI;IACJM,eAAe;IACfD,WAAW;IACXG,SAAS,EACR;EACF,CAAE,CAAC;EACH,oBACCV,KAAA,CAACP,MAAM;IAACkB,OAAO,EAAG,CAAG;IAACC,OAAO,EAAC,YAAY;IAAAC,QAAA,GACvCR,UAAU,iBACXP,IAAA;MAAKY,SAAS,EAAC,4EAA4E;MAAAG,QAAA,eAC1Ff,IAAA,CAACO,UAAU,CAACS,MAAM;QAACZ,IAAI,EAAGA;MAAM,CAAE;IAAC,CAC/B,CACL,eACDF,KAAA,CAACL,MAAM;MAACgB,OAAO,EAAG,CAAG;MAAAE,QAAA,GAClBT,UAAU,iBACXJ,KAAA;QAAA,GAAUS,cAAc;QAAAI,QAAA,GACrBV,KAAK,KAAKY,SAAS,iBACpBf,KAAA;UAAMU,SAAS,EAAC,6BAA6B;UAAAG,QAAA,GAC1C,GAAG,CAACG,MAAM,CAAEb,KAAM,CAAC,EAAE,MACxB;QAAA,CAAM,CACN,eACDL,IAAA,CAACM,UAAU,CAACU,MAAM;UAACZ,IAAI,EAAGA;QAAM,CAAE,CAAC;MAAA,CAC/B,CACL,EACCI,gBAAgB,iBACjBR,IAAA,CAACQ,gBAAgB,CAACQ,MAAM;QAACZ,IAAI,EAAGA;MAAM,CAAE,CACxC;IAAA,CACM,CAAC;EAAA,CACF,CAAC;AAEX;AAEA,eAAeD,aAAa","ignoreList":[]}
|
|
@@ -40,6 +40,7 @@ function TableColumnField({
|
|
|
40
40
|
function TableRow({
|
|
41
41
|
hasBulkActions,
|
|
42
42
|
item,
|
|
43
|
+
level,
|
|
43
44
|
actions,
|
|
44
45
|
fields,
|
|
45
46
|
id,
|
|
@@ -113,6 +114,7 @@ function TableRow({
|
|
|
113
114
|
}), hasPrimaryColumn && /*#__PURE__*/_jsx("td", {
|
|
114
115
|
children: /*#__PURE__*/_jsx(ColumnPrimary, {
|
|
115
116
|
item: item,
|
|
117
|
+
level: level,
|
|
116
118
|
titleField: showTitle ? titleField : undefined,
|
|
117
119
|
mediaField: showMedia ? mediaField : undefined,
|
|
118
120
|
descriptionField: showDescription ? descriptionField : undefined,
|
|
@@ -163,6 +165,7 @@ function ViewTable({
|
|
|
163
165
|
data,
|
|
164
166
|
fields,
|
|
165
167
|
getItemId,
|
|
168
|
+
getItemLevel,
|
|
166
169
|
isLoading = false,
|
|
167
170
|
onChangeView,
|
|
168
171
|
onChangeSelection,
|
|
@@ -294,6 +297,7 @@ function ViewTable({
|
|
|
294
297
|
}), /*#__PURE__*/_jsx("tbody", {
|
|
295
298
|
children: hasData && data.map((item, index) => /*#__PURE__*/_jsx(TableRow, {
|
|
296
299
|
item: item,
|
|
300
|
+
level: view.showLevels && typeof getItemLevel === 'function' ? getItemLevel(item) : undefined,
|
|
297
301
|
hasBulkActions: hasBulkActions,
|
|
298
302
|
actions: actions,
|
|
299
303
|
fields: fields,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","Spinner","useEffect","useId","useRef","useState","DataViewsSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","ColumnPrimary","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumnField","item","fields","column","field","find","f","id","className","children","render","TableRow","hasBulkActions","actions","view","titleField","mediaField","descriptionField","selection","getItemId","isItemClickable","onClickItem","onChangeSelection","_view$fields","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","showTitle","showMedia","showDescription","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","hasPrimaryColumn","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","undefined","map","_view$layout$styles$c","maxWidth","minWidth","layout","styles","length","e","stopPropagation","ViewTable","data","isLoading","onChangeView","setOpenedFilter","_view$fields2","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","tableNoticeId","onHide","hidden","get","fallback","node","hasData","headerMenuRef","index","set","delete","density","scope","ref","fieldId","canMove","_view$layout$styles$c2","sort","direction","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 { Spinner } from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DataViewsSelectionCheckbox 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} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport ColumnPrimary from './column-primary';\n\ninterface TableColumnFieldProps< Item > {\n\tfields: NormalizedField< Item >[];\n\tcolumn: string;\n\titem: Item;\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\ttitleField?: NormalizedField< Item >;\n\tmediaField?: NormalizedField< Item >;\n\tdescriptionField?: 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 TableColumnField< Item >( {\n\titem,\n\tfields,\n\tcolumn,\n}: TableColumnFieldProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\n\tif ( ! field ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t<field.render { ...{ item } } />\n\t\t</div>\n\t);\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\ttitleField,\n\tmediaField,\n\tdescriptionField,\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\tconst { showTitle = true, showMedia = true, showDescription = true } = view;\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 = view.fields ?? [];\n\tconst hasPrimaryColumn =\n\t\t( titleField && showTitle ) ||\n\t\t( mediaField && showMedia ) ||\n\t\t( descriptionField && showDescription );\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<DataViewsSelectionCheckbox\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\ttitleField={ titleField }\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{ hasPrimaryColumn && (\n\t\t\t\t<td>\n\t\t\t\t\t<ColumnPrimary\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\ttitleField={ showTitle ? titleField : undefined }\n\t\t\t\t\t\tmediaField={ showMedia ? mediaField : undefined }\n\t\t\t\t\t\tdescriptionField={\n\t\t\t\t\t\t\tshowDescription ? descriptionField : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t/>\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<TableColumnField\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/>\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 hasData = !! data?.length;\n\n\tconst titleField = fields.find( ( field ) => field.id === view.titleField );\n\tconst mediaField = fields.find( ( field ) => field.id === view.mediaField );\n\tconst descriptionField = fields.find(\n\t\t( field ) => field.id === view.descriptionField\n\t);\n\tconst { showTitle = true, showMedia = true, showDescription = true } = view;\n\tconst hasPrimaryColumn =\n\t\t( titleField && showTitle ) ||\n\t\t( mediaField && showMedia ) ||\n\t\t( descriptionField && showDescription );\n\tconst columns = view.fields ?? [];\n\tconst headerMenuRef =\n\t\t( column: string, index: number ) => ( node: HTMLButtonElement ) => {\n\t\t\tif ( node ) {\n\t\t\t\theaderMenuRefs.current.set( column, {\n\t\t\t\t\tnode,\n\t\t\t\t\tfallback: columns[ index > 0 ? index - 1 : 1 ],\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\theaderMenuRefs.current.delete( column );\n\t\t\t}\n\t\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{ hasPrimaryColumn && (\n\t\t\t\t\t\t\t<th scope=\"col\">\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{ titleField && (\n\t\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\t\tref={ headerMenuRef(\n\t\t\t\t\t\t\t\t\t\t\t\ttitleField.id,\n\t\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tfieldId={ titleField.id }\n\t\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t\t\tcanMove={ false }\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</span>\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?.direction &&\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={ headerMenuRef( column, index ) }\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\ttitleField={ titleField }\n\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\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 ? <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ACxC,CAAE,CAAG;MACLvD,EAAE,EAAGiE,aAAe;MAAA/D,QAAA,EAElB,CAAEqE,OAAO,iBACVnF,IAAA;QAAAc,QAAA,EAAKqD,SAAS,gBAAGnE,IAAA,CAACd,OAAO,IAAE,CAAC,GAAGD,EAAE,CAAE,YAAa;MAAC,CAAK;IACtD,CACG,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAegF,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","Spinner","useEffect","useId","useRef","useState","DataViewsSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","ColumnPrimary","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumnField","item","fields","column","field","find","f","id","className","children","render","TableRow","hasBulkActions","level","actions","view","titleField","mediaField","descriptionField","selection","getItemId","isItemClickable","onClickItem","onChangeSelection","_view$fields","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","showTitle","showMedia","showDescription","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","hasPrimaryColumn","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","undefined","map","_view$layout$styles$c","maxWidth","minWidth","layout","styles","length","e","stopPropagation","ViewTable","data","getItemLevel","isLoading","onChangeView","setOpenedFilter","_view$fields2","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","tableNoticeId","onHide","hidden","get","fallback","node","hasData","headerMenuRef","index","set","delete","density","scope","ref","fieldId","canMove","_view$layout$styles$c2","sort","direction","showLevels","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 { Spinner } from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DataViewsSelectionCheckbox 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} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport ColumnPrimary from './column-primary';\n\ninterface TableColumnFieldProps< Item > {\n\tfields: NormalizedField< Item >[];\n\tcolumn: string;\n\titem: Item;\n}\n\ninterface TableRowProps< Item > {\n\thasBulkActions: boolean;\n\titem: Item;\n\tlevel?: number;\n\tactions: Action< Item >[];\n\tfields: NormalizedField< Item >[];\n\tid: string;\n\tview: ViewTableType;\n\ttitleField?: NormalizedField< Item >;\n\tmediaField?: NormalizedField< Item >;\n\tdescriptionField?: 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 TableColumnField< Item >( {\n\titem,\n\tfields,\n\tcolumn,\n}: TableColumnFieldProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\n\tif ( ! field ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t<field.render { ...{ item } } />\n\t\t</div>\n\t);\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tlevel,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\ttitleField,\n\tmediaField,\n\tdescriptionField,\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\tconst { showTitle = true, showMedia = true, showDescription = true } = view;\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 = view.fields ?? [];\n\tconst hasPrimaryColumn =\n\t\t( titleField && showTitle ) ||\n\t\t( mediaField && showMedia ) ||\n\t\t( descriptionField && showDescription );\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<DataViewsSelectionCheckbox\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\ttitleField={ titleField }\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{ hasPrimaryColumn && (\n\t\t\t\t<td>\n\t\t\t\t\t<ColumnPrimary\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\ttitleField={ showTitle ? titleField : undefined }\n\t\t\t\t\t\tmediaField={ showMedia ? mediaField : undefined }\n\t\t\t\t\t\tdescriptionField={\n\t\t\t\t\t\t\tshowDescription ? descriptionField : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t/>\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<TableColumnField\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/>\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\tgetItemLevel,\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 hasData = !! data?.length;\n\n\tconst titleField = fields.find( ( field ) => field.id === view.titleField );\n\tconst mediaField = fields.find( ( field ) => field.id === view.mediaField );\n\tconst descriptionField = fields.find(\n\t\t( field ) => field.id === view.descriptionField\n\t);\n\tconst { showTitle = true, showMedia = true, showDescription = true } = view;\n\tconst hasPrimaryColumn =\n\t\t( titleField && showTitle ) ||\n\t\t( mediaField && showMedia ) ||\n\t\t( descriptionField && showDescription );\n\tconst columns = view.fields ?? [];\n\tconst headerMenuRef =\n\t\t( column: string, index: number ) => ( node: HTMLButtonElement ) => {\n\t\t\tif ( node ) {\n\t\t\t\theaderMenuRefs.current.set( column, {\n\t\t\t\t\tnode,\n\t\t\t\t\tfallback: columns[ index > 0 ? index - 1 : 1 ],\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\theaderMenuRefs.current.delete( column );\n\t\t\t}\n\t\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{ hasPrimaryColumn && (\n\t\t\t\t\t\t\t<th scope=\"col\">\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{ titleField && (\n\t\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\t\tref={ headerMenuRef(\n\t\t\t\t\t\t\t\t\t\t\t\ttitleField.id,\n\t\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tfieldId={ titleField.id }\n\t\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t\t\tcanMove={ false }\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</span>\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?.direction &&\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={ headerMenuRef( column, index ) }\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\tlevel={\n\t\t\t\t\t\t\t\t\tview.showLevels &&\n\t\t\t\t\t\t\t\t\ttypeof getItemLevel === 'function'\n\t\t\t\t\t\t\t\t\t\t? getItemLevel( item )\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\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\ttitleField={ titleField }\n\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\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,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,SAAS,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EuE,OAAO,iBACVrF,IAAA;QAAAc,QAAA,EAAKuD,SAAS,gBAAGrE,IAAA,CAACd,OAAO,IAAE,CAAC,GAAGD,EAAE,CAAE,YAAa;MAAC,CAAK;IACtD,CACG,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAeiF,SAAS","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\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n}\n\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 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\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\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
|
+
{"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\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n}\n\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 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\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\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\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\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":[]}
|
|
@@ -163,13 +163,11 @@
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
167
166
|
@container (max-width: 430px) {
|
|
168
167
|
.dataviews__view-actions,
|
|
169
168
|
.dataviews-filters__container {
|
|
170
169
|
padding: 12px 24px;
|
|
171
170
|
}
|
|
172
|
-
|
|
173
171
|
.dataviews-no-results,
|
|
174
172
|
.dataviews-loading {
|
|
175
173
|
padding-right: 24px;
|
|
@@ -511,7 +509,6 @@
|
|
|
511
509
|
}
|
|
512
510
|
|
|
513
511
|
.dataviews-search {
|
|
514
|
-
width: -moz-fit-content;
|
|
515
512
|
width: fit-content;
|
|
516
513
|
}
|
|
517
514
|
|
|
@@ -533,13 +530,11 @@
|
|
|
533
530
|
}
|
|
534
531
|
}
|
|
535
532
|
|
|
536
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
537
533
|
@container (max-width: 430px) {
|
|
538
534
|
.dataviews-footer {
|
|
539
535
|
padding: 12px 24px;
|
|
540
536
|
}
|
|
541
537
|
}
|
|
542
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
543
538
|
@container (max-width: 560px) {
|
|
544
539
|
.dataviews-footer {
|
|
545
540
|
flex-direction: column !important;
|
|
@@ -630,7 +625,6 @@
|
|
|
630
625
|
display: none;
|
|
631
626
|
}
|
|
632
627
|
|
|
633
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
634
628
|
@container (max-width: 500px) {
|
|
635
629
|
.dataviews-settings-section.dataviews-settings-section {
|
|
636
630
|
grid-template-columns: repeat(2, 1fr);
|
|
@@ -675,6 +669,7 @@
|
|
|
675
669
|
grid-template-rows: max-content;
|
|
676
670
|
padding: 0 48px 24px;
|
|
677
671
|
transition: padding ease-out 0.1s;
|
|
672
|
+
container-type: inline-size;
|
|
678
673
|
}
|
|
679
674
|
@media (prefers-reduced-motion: reduce) {
|
|
680
675
|
.dataviews-view-grid {
|
|
@@ -696,16 +691,21 @@
|
|
|
696
691
|
align-items: center;
|
|
697
692
|
}
|
|
698
693
|
.dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__title-field--clickable {
|
|
699
|
-
width: -moz-fit-content;
|
|
700
694
|
width: fit-content;
|
|
701
695
|
}
|
|
702
696
|
.dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__fields .dataviews-view-grid__field .dataviews-view-grid__field-value {
|
|
703
697
|
color: #1e1e1e;
|
|
704
698
|
}
|
|
705
|
-
.dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__media::after
|
|
699
|
+
.dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__media::after,
|
|
700
|
+
.dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__media:focus::after {
|
|
706
701
|
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
|
|
702
|
+
}
|
|
703
|
+
.dataviews-view-grid .dataviews-view-grid__card.is-selected .dataviews-view-grid__media::after {
|
|
707
704
|
box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color);
|
|
708
705
|
}
|
|
706
|
+
.dataviews-view-grid .dataviews-view-grid__card .dataviews-view-grid__media:focus::after {
|
|
707
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
708
|
+
}
|
|
709
709
|
.dataviews-view-grid .dataviews-view-grid__media {
|
|
710
710
|
width: 100%;
|
|
711
711
|
min-height: 200px;
|
|
@@ -763,37 +763,36 @@
|
|
|
763
763
|
.dataviews-view-grid .dataviews-view-grid__badge-fields:not(:empty) {
|
|
764
764
|
padding-bottom: 12px;
|
|
765
765
|
}
|
|
766
|
-
.dataviews-view-grid .dataviews-view-grid__badge-fields .dataviews-view-grid__field-value {
|
|
767
|
-
width: -moz-fit-content;
|
|
768
|
-
width: fit-content;
|
|
769
|
-
background: #f0f0f0;
|
|
770
|
-
padding: 0 8px;
|
|
771
|
-
min-height: 24px;
|
|
772
|
-
border-radius: 2px;
|
|
773
|
-
display: flex;
|
|
774
|
-
align-items: center;
|
|
775
|
-
font-size: 12px;
|
|
776
|
-
}
|
|
777
766
|
|
|
778
767
|
.dataviews-view-grid.dataviews-view-grid {
|
|
779
|
-
|
|
768
|
+
/**
|
|
769
|
+
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
770
|
+
* the sidebar width. This was done to match the existing styles we had.
|
|
771
|
+
*/
|
|
780
772
|
}
|
|
781
|
-
@
|
|
773
|
+
@container (max-width: 480px) {
|
|
774
|
+
.dataviews-view-grid.dataviews-view-grid {
|
|
775
|
+
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
776
|
+
padding-right: 24px;
|
|
777
|
+
padding-left: 24px;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
@container (min-width: 480px) {
|
|
782
781
|
.dataviews-view-grid.dataviews-view-grid {
|
|
783
782
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
784
783
|
}
|
|
785
784
|
}
|
|
786
|
-
@
|
|
785
|
+
@container (min-width: 780px) {
|
|
787
786
|
.dataviews-view-grid.dataviews-view-grid {
|
|
788
787
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
789
788
|
}
|
|
790
789
|
}
|
|
791
|
-
@
|
|
790
|
+
@container (min-width: 1140px) {
|
|
792
791
|
.dataviews-view-grid.dataviews-view-grid {
|
|
793
792
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
794
793
|
}
|
|
795
794
|
}
|
|
796
|
-
@
|
|
795
|
+
@container (min-width: 1520px) {
|
|
797
796
|
.dataviews-view-grid.dataviews-view-grid {
|
|
798
797
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
799
798
|
}
|
|
@@ -817,81 +816,74 @@
|
|
|
817
816
|
top: 8px;
|
|
818
817
|
}
|
|
819
818
|
|
|
820
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
821
|
-
@container (max-width: 430px) {
|
|
822
|
-
.dataviews-view-grid {
|
|
823
|
-
padding-right: 24px;
|
|
824
|
-
padding-left: 24px;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
819
|
.dataviews-view-grid__media--clickable {
|
|
828
820
|
cursor: pointer;
|
|
829
821
|
}
|
|
830
822
|
|
|
831
|
-
|
|
823
|
+
div.dataviews-view-list {
|
|
832
824
|
list-style-type: none;
|
|
833
825
|
}
|
|
834
826
|
|
|
835
827
|
.dataviews-view-list {
|
|
836
828
|
margin: 0 0 auto;
|
|
837
829
|
}
|
|
838
|
-
.dataviews-view-list
|
|
830
|
+
.dataviews-view-list div[role=row] {
|
|
839
831
|
margin: 0;
|
|
840
832
|
border-top: 1px solid #f0f0f0;
|
|
841
833
|
}
|
|
842
|
-
.dataviews-view-list
|
|
834
|
+
.dataviews-view-list div[role=row] .dataviews-view-list__item-wrapper {
|
|
843
835
|
position: relative;
|
|
844
836
|
padding: 16px 24px;
|
|
845
837
|
box-sizing: border-box;
|
|
846
838
|
}
|
|
847
|
-
.dataviews-view-list
|
|
839
|
+
.dataviews-view-list div[role=row] .dataviews-view-list__item-actions {
|
|
848
840
|
flex: 0;
|
|
849
841
|
overflow: hidden;
|
|
850
842
|
}
|
|
851
|
-
.dataviews-view-list
|
|
843
|
+
.dataviews-view-list div[role=row] .dataviews-view-list__item-actions > div {
|
|
852
844
|
height: 24px;
|
|
853
845
|
}
|
|
854
|
-
.dataviews-view-list
|
|
846
|
+
.dataviews-view-list div[role=row] .dataviews-view-list__item-actions .components-button {
|
|
855
847
|
position: relative;
|
|
856
848
|
z-index: 1;
|
|
857
849
|
opacity: 0;
|
|
858
850
|
}
|
|
859
|
-
.dataviews-view-list
|
|
851
|
+
.dataviews-view-list div[role=row]:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions {
|
|
860
852
|
flex-basis: min-content;
|
|
861
853
|
overflow: unset;
|
|
862
854
|
padding-inline-end: 4px;
|
|
863
855
|
}
|
|
864
|
-
.dataviews-view-list
|
|
856
|
+
.dataviews-view-list div[role=row]:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions .components-button {
|
|
865
857
|
opacity: 1;
|
|
866
858
|
}
|
|
867
|
-
.dataviews-view-list
|
|
859
|
+
.dataviews-view-list div[role=row].is-selected.is-selected {
|
|
868
860
|
border-top: 1px solid rgba(var(--wp-admin-theme-color--rgb), 0.12);
|
|
869
861
|
}
|
|
870
|
-
.dataviews-view-list
|
|
862
|
+
.dataviews-view-list div[role=row].is-selected.is-selected + div[role=row] {
|
|
871
863
|
border-top: 1px solid rgba(var(--wp-admin-theme-color--rgb), 0.12);
|
|
872
864
|
}
|
|
873
|
-
.dataviews-view-list
|
|
865
|
+
.dataviews-view-list div[role=row]:not(.is-selected) .dataviews-view-list__title-field {
|
|
874
866
|
color: #1e1e1e;
|
|
875
867
|
}
|
|
876
|
-
.dataviews-view-list
|
|
868
|
+
.dataviews-view-list div[role=row]:not(.is-selected):hover, .dataviews-view-list div[role=row]:not(.is-selected).is-hovered, .dataviews-view-list div[role=row]:not(.is-selected):focus-within {
|
|
877
869
|
color: var(--wp-admin-theme-color);
|
|
878
870
|
background-color: #f8f8f8;
|
|
879
871
|
}
|
|
880
|
-
.dataviews-view-list
|
|
881
|
-
.dataviews-view-list
|
|
882
|
-
.dataviews-view-list
|
|
883
|
-
.dataviews-view-list
|
|
872
|
+
.dataviews-view-list div[role=row]:not(.is-selected):hover .dataviews-view-list__title-field,
|
|
873
|
+
.dataviews-view-list div[role=row]:not(.is-selected):hover .dataviews-view-list__fields, .dataviews-view-list div[role=row]:not(.is-selected).is-hovered .dataviews-view-list__title-field,
|
|
874
|
+
.dataviews-view-list div[role=row]:not(.is-selected).is-hovered .dataviews-view-list__fields, .dataviews-view-list div[role=row]:not(.is-selected):focus-within .dataviews-view-list__title-field,
|
|
875
|
+
.dataviews-view-list div[role=row]:not(.is-selected):focus-within .dataviews-view-list__fields {
|
|
884
876
|
color: var(--wp-admin-theme-color);
|
|
885
877
|
}
|
|
886
|
-
.dataviews-view-list
|
|
887
|
-
.dataviews-view-list
|
|
878
|
+
.dataviews-view-list div[role=row].is-selected .dataviews-view-list__item-wrapper,
|
|
879
|
+
.dataviews-view-list div[role=row].is-selected:focus-within .dataviews-view-list__item-wrapper {
|
|
888
880
|
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.04);
|
|
889
881
|
color: #1e1e1e;
|
|
890
882
|
}
|
|
891
|
-
.dataviews-view-list
|
|
892
|
-
.dataviews-view-list
|
|
893
|
-
.dataviews-view-list
|
|
894
|
-
.dataviews-view-list
|
|
883
|
+
.dataviews-view-list div[role=row].is-selected .dataviews-view-list__item-wrapper .dataviews-view-list__title-field,
|
|
884
|
+
.dataviews-view-list div[role=row].is-selected .dataviews-view-list__item-wrapper .dataviews-view-list__fields,
|
|
885
|
+
.dataviews-view-list div[role=row].is-selected:focus-within .dataviews-view-list__item-wrapper .dataviews-view-list__title-field,
|
|
886
|
+
.dataviews-view-list div[role=row].is-selected:focus-within .dataviews-view-list__item-wrapper .dataviews-view-list__fields {
|
|
895
887
|
color: var(--wp-admin-theme-color);
|
|
896
888
|
}
|
|
897
889
|
.dataviews-view-list .dataviews-view-list__item {
|
|
@@ -1134,13 +1126,11 @@ ul.dataviews-view-list {
|
|
|
1134
1126
|
padding-left: 0;
|
|
1135
1127
|
}
|
|
1136
1128
|
|
|
1137
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
1138
1129
|
@container (max-width: 430px) {
|
|
1139
1130
|
.dataviews-view-table tr td:first-child,
|
|
1140
1131
|
.dataviews-view-table tr th:first-child {
|
|
1141
1132
|
padding-right: 24px;
|
|
1142
1133
|
}
|
|
1143
|
-
|
|
1144
1134
|
.dataviews-view-table tr td:last-child,
|
|
1145
1135
|
.dataviews-view-table tr th:last-child {
|
|
1146
1136
|
padding-left: 24px;
|