@wordpress/dataviews 12.1.1-next.v.202602271551.0 → 13.0.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 +13 -1
- package/build/components/dataform-layouts/card/index.cjs +12 -7
- package/build/components/dataform-layouts/card/index.cjs.map +2 -2
- package/build/components/dataviews-filters/toggle.cjs +6 -2
- package/build/components/dataviews-filters/toggle.cjs.map +2 -2
- package/build/components/dataviews-layouts/list/index.cjs +4 -2
- package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/index.cjs +20 -2
- package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
- package/build-module/components/dataform-layouts/card/index.mjs +12 -7
- package/build-module/components/dataform-layouts/card/index.mjs.map +2 -2
- package/build-module/components/dataviews-filters/toggle.mjs +6 -2
- package/build-module/components/dataviews-filters/toggle.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/list/index.mjs +4 -2
- package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/index.mjs +20 -2
- package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
- package/build-style/style-rtl.css +2 -7
- package/build-style/style.css +2 -7
- package/build-types/components/dataform-layouts/card/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/toggle.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/table/index.d.ts.map +1 -1
- package/build-types/dataform/stories/layout-panel.d.ts.map +1 -1
- package/build-types/dataviews/stories/empty.d.ts.map +1 -1
- package/build-types/dataviews/stories/free-composition.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-table.d.ts.map +1 -1
- package/build-types/dataviews/stories/minimal-ui.d.ts.map +1 -1
- package/build-types/dataviews/stories/with-card.d.ts.map +1 -1
- package/build-wp/index.js +44 -17
- package/package.json +16 -19
- package/src/components/dataform-layouts/card/index.tsx +8 -9
- package/src/components/dataform-layouts/panel/style.scss +1 -0
- package/src/components/dataviews-filters/toggle.tsx +9 -2
- package/src/components/dataviews-layouts/list/index.tsx +6 -2
- package/src/components/dataviews-layouts/list/style.scss +0 -9
- package/src/components/dataviews-layouts/table/index.tsx +24 -2
- package/src/components/dataviews-layouts/table/style.scss +1 -0
- package/src/dataform/stories/layout-panel.tsx +5 -1
- package/src/dataviews/stories/empty.tsx +1 -7
- package/src/dataviews/stories/free-composition.tsx +0 -5
- package/src/dataviews/stories/layout-table.tsx +1 -7
- package/src/dataviews/stories/minimal-ui.tsx +0 -5
- package/src/dataviews/stories/with-card.tsx +1 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/dataviews-layouts/table/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ComponentProps, ReactElement } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { Spinner, Popover } from '@wordpress/components';\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport DataViewsContext from '../../dataviews-context';\nimport DataViewsSelectionCheckbox from '../../dataviews-selection-checkbox';\nimport ItemActions from '../../dataviews-item-actions';\nimport { sortValues } from '../../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n} from '../../../types';\nimport type { SetSelection } from '../../../types/private';\nimport ColumnHeaderMenu from './column-header-menu';\nimport ColumnPrimary from './column-primary';\nimport { useIsHorizontalScrollEnd } from './use-is-horizontal-scroll-end';\nimport getDataByGroup from '../utils/get-data-by-group';\nimport { PropertiesSection } from '../../dataviews-view-config/properties-section';\nimport { useDelayedLoading } from '../../../hooks/use-delayed-loading';\n\ninterface TableColumnFieldProps< Item > {\n\tfields: NormalizedField< Item >[];\n\tcolumn: string;\n\titem: Item;\n\talign?: 'start' | 'center' | 'end';\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\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisActionsColumnSticky?: boolean;\n\tposinset?: number;\n}\n\nfunction TableColumnField< Item >( {\n\titem,\n\tfields,\n\tcolumn,\n\talign,\n}: TableColumnFieldProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\n\tif ( ! field ) {\n\t\treturn null;\n\t}\n\n\tconst className = clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t'dataviews-view-table__cell-align-end': align === 'end',\n\t\t'dataviews-view-table__cell-align-center': align === 'center',\n\t} );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<field.render item={ item } field={ field } />\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\trenderItemLink,\n\tonChangeSelection,\n\tisActionsColumnSticky,\n\tposinset,\n}: TableRowProps< Item > ) {\n\tconst { paginationInfo } = useContext( DataViewsContext );\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst {\n\t\tshowTitle = true,\n\t\tshowMedia = true,\n\t\tshowDescription = true,\n\t\tinfiniteScrollEnabled,\n\t} = view;\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'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\taria-setsize={\n\t\t\t\tinfiniteScrollEnabled ? paginationInfo.totalItems : undefined\n\t\t\t}\n\t\t\taria-posinset={ posinset }\n\t\t\trole={ infiniteScrollEnabled ? 'article' : undefined }\n\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t// Firefox has a unique feature where ctrl/cmd + click selects a\n\t\t\t\t// table cell. This interferes with the bulk selection behavior,\n\t\t\t\t// so this code prevents it.\n\t\t\t\tconst isMetaClick = isAppleOS() ? event.metaKey : event.ctrlKey;\n\t\t\t\tif (\n\t\t\t\t\tevent.button === 0 &&\n\t\t\t\t\tisMetaClick &&\n\t\t\t\t\twindow.navigator.userAgent\n\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t.includes( 'firefox' )\n\t\t\t\t) {\n\t\t\t\t\tevent?.preventDefault();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle Ctrl/Cmd+Click for multi-selection\n\t\t\t\tconst isModifierKeyPressed = isAppleOS()\n\t\t\t\t\t? event.metaKey\n\t\t\t\t\t: event.ctrlKey;\n\n\t\t\t\tif (\n\t\t\t\t\tisModifierKeyPressed &&\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\t// Handle non-consecutive selection with Ctrl/Cmd+Click\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: [ ...selection, 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 className=\"dataviews-view-table__checkbox-column\">\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\trenderItemLink={ renderItemLink }\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// Explicit picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth, align } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<td\n\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\t\tminWidth,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\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\talign={ align }\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={ clsx( 'dataviews-view-table__actions-column', {\n\t\t\t\t\t\t'dataviews-view-table__actions-column--sticky': true,\n\t\t\t\t\t\t'dataviews-view-table__actions-column--stuck':\n\t\t\t\t\t\t\tisActionsColumnSticky,\n\t\t\t\t\t} ) }\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\trenderItemLink,\n\tview,\n\tclassName,\n\tempty,\n}: ViewTableProps< Item > ) {\n\tconst { containerRef } = useContext( DataViewsContext );\n\tconst isDelayedLoading = useDelayedLoading( isLoading );\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >( undefined );\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst [ contextMenuAnchor, setContextMenuAnchor ] = useState< {\n\t\tgetBoundingClientRect: () => DOMRect;\n\t} | null >( null );\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\tconst isHorizontalScrollEnd = useIsHorizontalScrollEnd( {\n\t\tscrollContainerRef: containerRef,\n\t\tenabled: !! actions?.length,\n\t} );\n\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\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 handleHeaderContextMenu = ( event: React.MouseEvent ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tconst virtualAnchor = {\n\t\t\tgetBoundingClientRect: () => ( {\n\t\t\t\tx: event.clientX,\n\t\t\t\ty: event.clientY,\n\t\t\t\ttop: event.clientY,\n\t\t\t\tleft: event.clientX,\n\t\t\t\tright: event.clientX,\n\t\t\t\tbottom: event.clientY,\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0,\n\t\t\t\ttoJSON: () => ( {} ),\n\t\t\t} ),\n\t\t};\n\t\twindow.requestAnimationFrame( () => {\n\t\t\tsetContextMenuAnchor( virtualAnchor );\n\t\t} );\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\n\tconst groupField = view.groupBy?.field\n\t\t? fields.find( ( f ) => f.id === view.groupBy?.field )\n\t\t: null;\n\tconst dataByGroup = groupField ? getDataByGroup( data, groupField ) : null;\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\tconst isInfiniteScroll = view.infiniteScrollEnabled && ! dataByGroup;\n\tconst isRtl = isRTL();\n\tif ( ! hasData ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'dataviews-no-results', {\n\t\t\t\t\t'is-refreshing': isDelayedLoading,\n\t\t\t\t} ) }\n\t\t\t\tid={ tableNoticeId }\n\t\t\t>\n\t\t\t\t{ empty }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName={ clsx( 'dataviews-view-table', className, {\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\t'has-bulk-actions': hasBulkActions,\n\t\t\t\t\t'is-refreshing': ! isInfiniteScroll && isDelayedLoading,\n\t\t\t\t} ) }\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t\trole={ isInfiniteScroll ? 'feed' : undefined }\n\t\t\t\t// @ts-ignore Reason: inert is a recent HTML attribute\n\t\t\t\tinert={ ! isInfiniteScroll && isLoading ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t<colgroup>\n\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-checkbox\" />\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasPrimaryColumn && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-first-data\" />\n\t\t\t\t\t) }\n\t\t\t\t\t{ columns.map( ( column, index ) => (\n\t\t\t\t\t\t<col\n\t\t\t\t\t\t\tkey={ `col-${ column }` }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t`dataviews-view-table__col-${ column }`,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'dataviews-view-table__col-first-expand':\n\t\t\t\t\t\t\t\t\t\t! hasPrimaryColumn &&\n\t\t\t\t\t\t\t\t\t\tindex === columns.length - 1,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-actions\" />\n\t\t\t\t\t) }\n\t\t\t\t</colgroup>\n\t\t\t\t{ contextMenuAnchor && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tanchor={ contextMenuAnchor }\n\t\t\t\t\t\tonClose={ () => setContextMenuAnchor( null ) }\n\t\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<PropertiesSection showLabel={ false } />\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t\t<thead onContextMenu={ handleHeaderContextMenu }>\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\tscope=\"col\"\n\t\t\t\t\t\t\t\tonContextMenu={ handleHeaderContextMenu }\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{ titleField && (\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ headerMenuRef(\n\t\t\t\t\t\t\t\t\t\t\ttitleField.id,\n\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tfieldId={ titleField.id }\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\tcanMove={ false }\n\t\t\t\t\t\t\t\t\t\tcanInsertLeft={\n\t\t\t\t\t\t\t\t\t\t\tisRtl\n\t\t\t\t\t\t\t\t\t\t\t\t? view.layout?.enableMoving ??\n\t\t\t\t\t\t\t\t\t\t\t\t true\n\t\t\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcanInsertRight={\n\t\t\t\t\t\t\t\t\t\t\tisRtl\n\t\t\t\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t\t\t\t: view.layout?.enableMoving ??\n\t\t\t\t\t\t\t\t\t\t\t\t true\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</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// Explicit picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth, align } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\tconst canInsertOrMove =\n\t\t\t\t\t\t\t\tview.layout?.enableMoving ?? true;\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={ {\n\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\t\t\t\t\tminWidth,\n\t\t\t\t\t\t\t\t\t\ttextAlign: align,\n\t\t\t\t\t\t\t\t\t} }\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\tcanMove={ canInsertOrMove }\n\t\t\t\t\t\t\t\t\t\tcanInsertLeft={ canInsertOrMove }\n\t\t\t\t\t\t\t\t\t\tcanInsertRight={ canInsertOrMove }\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\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column--sticky':\n\t\t\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column--stuck':\n\t\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd,\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<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{ /* Render grouped data if groupBy is specified */ }\n\t\t\t\t{ hasData && groupField && dataByGroup ? (\n\t\t\t\t\tArray.from( dataByGroup.entries() ).map(\n\t\t\t\t\t\t( [ groupName, groupItems ] ) => (\n\t\t\t\t\t\t\t<tbody key={ `group-${ groupName }` }>\n\t\t\t\t\t\t\t\t<tr className=\"dataviews-view-table__group-header-row\">\n\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\tcolSpan={\n\t\t\t\t\t\t\t\t\t\t\tcolumns.length +\n\t\t\t\t\t\t\t\t\t\t\t( hasPrimaryColumn ? 1 : 0 ) +\n\t\t\t\t\t\t\t\t\t\t\t( hasBulkActions ? 1 : 0 ) +\n\t\t\t\t\t\t\t\t\t\t\t( actions?.length ? 1 : 0 )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__group-header-cell\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ view.groupBy?.showLabel === false\n\t\t\t\t\t\t\t\t\t\t\t? groupName\n\t\t\t\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: 1: The label of the field e.g. \"Date\". 2: The value of the field, e.g.: \"May 2022\".\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroupField.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroupName\n\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t{ groupItems.map( ( item, index ) => (\n\t\t\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\t\tlevel={\n\t\t\t\t\t\t\t\t\t\t\tview.showLevels &&\n\t\t\t\t\t\t\t\t\t\t\ttypeof getItemLevel === 'function'\n\t\t\t\t\t\t\t\t\t\t\t\t? getItemLevel( item )\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tid={\n\t\t\t\t\t\t\t\t\t\t\tgetItemId( item ) ||\n\t\t\t\t\t\t\t\t\t\t\tindex.toString()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\ttitleField={ titleField }\n\t\t\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\n\t\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\t\t\trenderItemLink={ renderItemLink }\n\t\t\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t\t\t\tisActionsColumnSticky={\n\t\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd\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</tbody>\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tlevel={\n\t\t\t\t\t\t\t\t\t\tview.showLevels &&\n\t\t\t\t\t\t\t\t\t\ttypeof getItemLevel === 'function'\n\t\t\t\t\t\t\t\t\t\t\t? getItemLevel( item )\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\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\ttitleField={ titleField }\n\t\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\t\trenderItemLink={ renderItemLink }\n\t\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t\t\tisActionsColumnSticky={\n\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tposinset={\n\t\t\t\t\t\t\t\t\t\tisInfiniteScroll ? index + 1 : undefined\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</tbody>\n\t\t\t\t) }\n\t\t\t</table>\n\t\t\t{ isInfiniteScroll && isLoading && (\n\t\t\t\t<div className=\"dataviews-loading\" id={ tableNoticeId }>\n\t\t\t\t\t<p className=\"dataviews-loading-more\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ViewTable;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAMjB,SAAS,IAAI,SAAS,aAAa;AACnC,SAAS,SAAS,eAAe;AACjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,iBAAiB;AAK1B,OAAO,sBAAsB;AAC7B,OAAO,gCAAgC;AACvC,OAAO,iBAAiB;AACxB,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAQP,OAAO,sBAAsB;AAC7B,OAAO,mBAAmB;AAC1B,SAAS,gCAAgC;AACzC,OAAO,oBAAoB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ComponentProps, ReactElement } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { Spinner, Popover } from '@wordpress/components';\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport DataViewsContext from '../../dataviews-context';\nimport DataViewsSelectionCheckbox from '../../dataviews-selection-checkbox';\nimport ItemActions from '../../dataviews-item-actions';\nimport { sortValues } from '../../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n} from '../../../types';\nimport type { SetSelection } from '../../../types/private';\nimport ColumnHeaderMenu from './column-header-menu';\nimport ColumnPrimary from './column-primary';\nimport { useIsHorizontalScrollEnd } from './use-is-horizontal-scroll-end';\nimport getDataByGroup from '../utils/get-data-by-group';\nimport { PropertiesSection } from '../../dataviews-view-config/properties-section';\nimport { useDelayedLoading } from '../../../hooks/use-delayed-loading';\n\nfunction getEffectiveAlign(\n\texplicitAlign: 'start' | 'center' | 'end' | undefined,\n\tfieldType: string | undefined\n): 'start' | 'center' | 'end' | undefined {\n\tif ( explicitAlign ) {\n\t\treturn explicitAlign;\n\t}\n\tif ( fieldType === 'integer' || fieldType === 'number' ) {\n\t\treturn 'end';\n\t}\n\treturn undefined;\n}\n\ninterface TableColumnFieldProps< Item > {\n\tfields: NormalizedField< Item >[];\n\tcolumn: string;\n\titem: Item;\n\talign?: 'start' | 'center' | 'end';\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\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisActionsColumnSticky?: boolean;\n\tposinset?: number;\n}\n\nfunction TableColumnField< Item >( {\n\titem,\n\tfields,\n\tcolumn,\n\talign,\n}: TableColumnFieldProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\n\tif ( ! field ) {\n\t\treturn null;\n\t}\n\n\tconst className = clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t'dataviews-view-table__cell-align-end': align === 'end',\n\t\t'dataviews-view-table__cell-align-center': align === 'center',\n\t} );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<field.render item={ item } field={ field } />\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\trenderItemLink,\n\tonChangeSelection,\n\tisActionsColumnSticky,\n\tposinset,\n}: TableRowProps< Item > ) {\n\tconst { paginationInfo } = useContext( DataViewsContext );\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst {\n\t\tshowTitle = true,\n\t\tshowMedia = true,\n\t\tshowDescription = true,\n\t\tinfiniteScrollEnabled,\n\t} = view;\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'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\taria-setsize={\n\t\t\t\tinfiniteScrollEnabled ? paginationInfo.totalItems : undefined\n\t\t\t}\n\t\t\taria-posinset={ posinset }\n\t\t\trole={ infiniteScrollEnabled ? 'article' : undefined }\n\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t// Firefox has a unique feature where ctrl/cmd + click selects a\n\t\t\t\t// table cell. This interferes with the bulk selection behavior,\n\t\t\t\t// so this code prevents it.\n\t\t\t\tconst isMetaClick = isAppleOS() ? event.metaKey : event.ctrlKey;\n\t\t\t\tif (\n\t\t\t\t\tevent.button === 0 &&\n\t\t\t\t\tisMetaClick &&\n\t\t\t\t\twindow.navigator.userAgent\n\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t.includes( 'firefox' )\n\t\t\t\t) {\n\t\t\t\t\tevent?.preventDefault();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle Ctrl/Cmd+Click for multi-selection\n\t\t\t\tconst isModifierKeyPressed = isAppleOS()\n\t\t\t\t\t? event.metaKey\n\t\t\t\t\t: event.ctrlKey;\n\n\t\t\t\tif (\n\t\t\t\t\tisModifierKeyPressed &&\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\t// Handle non-consecutive selection with Ctrl/Cmd+Click\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: [ ...selection, 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 className=\"dataviews-view-table__checkbox-column\">\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\trenderItemLink={ renderItemLink }\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// Explicit picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth, align } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\tconst field = fields.find( ( f ) => f.id === column );\n\t\t\t\tconst effectiveAlign = getEffectiveAlign( align, field?.type );\n\n\t\t\t\treturn (\n\t\t\t\t\t<td\n\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\t\tminWidth,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\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\talign={ effectiveAlign }\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={ clsx( 'dataviews-view-table__actions-column', {\n\t\t\t\t\t\t'dataviews-view-table__actions-column--sticky': true,\n\t\t\t\t\t\t'dataviews-view-table__actions-column--stuck':\n\t\t\t\t\t\t\tisActionsColumnSticky,\n\t\t\t\t\t} ) }\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\trenderItemLink,\n\tview,\n\tclassName,\n\tempty,\n}: ViewTableProps< Item > ) {\n\tconst { containerRef } = useContext( DataViewsContext );\n\tconst isDelayedLoading = useDelayedLoading( isLoading );\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >( undefined );\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst [ contextMenuAnchor, setContextMenuAnchor ] = useState< {\n\t\tgetBoundingClientRect: () => DOMRect;\n\t} | null >( null );\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\tconst isHorizontalScrollEnd = useIsHorizontalScrollEnd( {\n\t\tscrollContainerRef: containerRef,\n\t\tenabled: !! actions?.length,\n\t} );\n\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\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 handleHeaderContextMenu = ( event: React.MouseEvent ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tconst virtualAnchor = {\n\t\t\tgetBoundingClientRect: () => ( {\n\t\t\t\tx: event.clientX,\n\t\t\t\ty: event.clientY,\n\t\t\t\ttop: event.clientY,\n\t\t\t\tleft: event.clientX,\n\t\t\t\tright: event.clientX,\n\t\t\t\tbottom: event.clientY,\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0,\n\t\t\t\ttoJSON: () => ( {} ),\n\t\t\t} ),\n\t\t};\n\t\twindow.requestAnimationFrame( () => {\n\t\t\tsetContextMenuAnchor( virtualAnchor );\n\t\t} );\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\n\tconst groupField = view.groupBy?.field\n\t\t? fields.find( ( f ) => f.id === view.groupBy?.field )\n\t\t: null;\n\tconst dataByGroup = groupField ? getDataByGroup( data, groupField ) : null;\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\tconst isInfiniteScroll = view.infiniteScrollEnabled && ! dataByGroup;\n\tconst isRtl = isRTL();\n\tif ( ! hasData ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'dataviews-no-results', {\n\t\t\t\t\t'is-refreshing': isDelayedLoading,\n\t\t\t\t} ) }\n\t\t\t\tid={ tableNoticeId }\n\t\t\t>\n\t\t\t\t{ empty }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName={ clsx( 'dataviews-view-table', className, {\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\t'has-bulk-actions': hasBulkActions,\n\t\t\t\t\t'is-refreshing': ! isInfiniteScroll && isDelayedLoading,\n\t\t\t\t} ) }\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t\trole={ isInfiniteScroll ? 'feed' : undefined }\n\t\t\t\t// @ts-ignore Reason: inert is a recent HTML attribute\n\t\t\t\tinert={ ! isInfiniteScroll && isLoading ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t<colgroup>\n\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-checkbox\" />\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasPrimaryColumn && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-first-data\" />\n\t\t\t\t\t) }\n\t\t\t\t\t{ columns.map( ( column, index ) => (\n\t\t\t\t\t\t<col\n\t\t\t\t\t\t\tkey={ `col-${ column }` }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t`dataviews-view-table__col-${ column }`,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'dataviews-view-table__col-first-expand':\n\t\t\t\t\t\t\t\t\t\t! hasPrimaryColumn &&\n\t\t\t\t\t\t\t\t\t\tindex === columns.length - 1,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t<col className=\"dataviews-view-table__col-actions\" />\n\t\t\t\t\t) }\n\t\t\t\t</colgroup>\n\t\t\t\t{ contextMenuAnchor && (\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tanchor={ contextMenuAnchor }\n\t\t\t\t\t\tonClose={ () => setContextMenuAnchor( null ) }\n\t\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<PropertiesSection showLabel={ false } />\n\t\t\t\t\t</Popover>\n\t\t\t\t) }\n\t\t\t\t<thead onContextMenu={ handleHeaderContextMenu }>\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\tscope=\"col\"\n\t\t\t\t\t\t\t\tonContextMenu={ handleHeaderContextMenu }\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{ titleField && (\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ headerMenuRef(\n\t\t\t\t\t\t\t\t\t\t\ttitleField.id,\n\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tfieldId={ titleField.id }\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\tcanMove={ false }\n\t\t\t\t\t\t\t\t\t\tcanInsertLeft={\n\t\t\t\t\t\t\t\t\t\t\tisRtl\n\t\t\t\t\t\t\t\t\t\t\t\t? view.layout?.enableMoving ??\n\t\t\t\t\t\t\t\t\t\t\t\t true\n\t\t\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcanInsertRight={\n\t\t\t\t\t\t\t\t\t\t\tisRtl\n\t\t\t\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t\t\t\t: view.layout?.enableMoving ??\n\t\t\t\t\t\t\t\t\t\t\t\t true\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</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// Explicit picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth, align } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\tconst field = fields.find(\n\t\t\t\t\t\t\t\t( f ) => f.id === column\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst effectiveAlign = getEffectiveAlign(\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\tfield?.type\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst canInsertOrMove =\n\t\t\t\t\t\t\t\tview.layout?.enableMoving ?? true;\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={ {\n\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\t\t\t\t\tminWidth,\n\t\t\t\t\t\t\t\t\t\ttextAlign: effectiveAlign,\n\t\t\t\t\t\t\t\t\t} }\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\tcanMove={ canInsertOrMove }\n\t\t\t\t\t\t\t\t\t\tcanInsertLeft={ canInsertOrMove }\n\t\t\t\t\t\t\t\t\t\tcanInsertRight={ canInsertOrMove }\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\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column--sticky':\n\t\t\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\t\t'dataviews-view-table__actions-column--stuck':\n\t\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd,\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<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{ /* Render grouped data if groupBy is specified */ }\n\t\t\t\t{ hasData && groupField && dataByGroup ? (\n\t\t\t\t\tArray.from( dataByGroup.entries() ).map(\n\t\t\t\t\t\t( [ groupName, groupItems ] ) => (\n\t\t\t\t\t\t\t<tbody key={ `group-${ groupName }` }>\n\t\t\t\t\t\t\t\t<tr className=\"dataviews-view-table__group-header-row\">\n\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\tcolSpan={\n\t\t\t\t\t\t\t\t\t\t\tcolumns.length +\n\t\t\t\t\t\t\t\t\t\t\t( hasPrimaryColumn ? 1 : 0 ) +\n\t\t\t\t\t\t\t\t\t\t\t( hasBulkActions ? 1 : 0 ) +\n\t\t\t\t\t\t\t\t\t\t\t( actions?.length ? 1 : 0 )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__group-header-cell\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ view.groupBy?.showLabel === false\n\t\t\t\t\t\t\t\t\t\t\t? groupName\n\t\t\t\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: 1: The label of the field e.g. \"Date\". 2: The value of the field, e.g.: \"May 2022\".\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroupField.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tgroupName\n\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t{ groupItems.map( ( item, index ) => (\n\t\t\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\t\tlevel={\n\t\t\t\t\t\t\t\t\t\t\tview.showLevels &&\n\t\t\t\t\t\t\t\t\t\t\ttypeof getItemLevel === 'function'\n\t\t\t\t\t\t\t\t\t\t\t\t? getItemLevel( item )\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tid={\n\t\t\t\t\t\t\t\t\t\t\tgetItemId( item ) ||\n\t\t\t\t\t\t\t\t\t\t\tindex.toString()\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\ttitleField={ titleField }\n\t\t\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\n\t\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\t\t\trenderItemLink={ renderItemLink }\n\t\t\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t\t\t\tisActionsColumnSticky={\n\t\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd\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</tbody>\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tlevel={\n\t\t\t\t\t\t\t\t\t\tview.showLevels &&\n\t\t\t\t\t\t\t\t\t\ttypeof getItemLevel === 'function'\n\t\t\t\t\t\t\t\t\t\t\t? getItemLevel( item )\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\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\ttitleField={ titleField }\n\t\t\t\t\t\t\t\t\tmediaField={ mediaField }\n\t\t\t\t\t\t\t\t\tdescriptionField={ descriptionField }\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tonClickItem={ onClickItem }\n\t\t\t\t\t\t\t\t\trenderItemLink={ renderItemLink }\n\t\t\t\t\t\t\t\t\tisItemClickable={ isItemClickable }\n\t\t\t\t\t\t\t\t\tisActionsColumnSticky={\n\t\t\t\t\t\t\t\t\t\t! isHorizontalScrollEnd\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tposinset={\n\t\t\t\t\t\t\t\t\t\tisInfiniteScroll ? index + 1 : undefined\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</tbody>\n\t\t\t\t) }\n\t\t\t</table>\n\t\t\t{ isInfiniteScroll && isLoading && (\n\t\t\t\t<div className=\"dataviews-loading\" id={ tableNoticeId }>\n\t\t\t\t\t<p className=\"dataviews-loading-more\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ViewTable;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAMj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AW,IAAK,KAAK,MAAM,SAAS;AAAA,cACzC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,uBACC,CAAE;AAAA,cAEH,UACC,mBAAmB,QAAQ,IAAI;AAAA;AAAA,YA1B1B,UAAW,IAAK;AAAA,UA4BvB,CACC,GACJ;AAAA;AAAA;AAAA,IAEF;AAAA,IACE,oBAAoB,aACrB,oBAAC,SAAI,WAAU,qBAAoB,IAAK,eACvC,8BAAC,OAAE,WAAU,0BACZ,8BAAC,WAAQ,GACV,GACD;AAAA,KAEF;AAEF;AAEA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1300,7 +1300,6 @@ div.dataviews-view-list {
|
|
|
1300
1300
|
border-radius: 4px;
|
|
1301
1301
|
}
|
|
1302
1302
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
1303
|
-
min-height: 52px;
|
|
1304
1303
|
flex-grow: 1;
|
|
1305
1304
|
min-width: 0;
|
|
1306
1305
|
}
|
|
@@ -1340,9 +1339,6 @@ div.dataviews-view-list {
|
|
|
1340
1339
|
width: 32px;
|
|
1341
1340
|
height: 32px;
|
|
1342
1341
|
}
|
|
1343
|
-
.dataviews-view-list.has-compact-density div[role=row] .dataviews-view-list__field-wrapper {
|
|
1344
|
-
min-height: 32px;
|
|
1345
|
-
}
|
|
1346
1342
|
.dataviews-view-list.has-compact-density div[role=row] .dataviews-view-list__fields {
|
|
1347
1343
|
gap: 8px;
|
|
1348
1344
|
row-gap: 4px;
|
|
@@ -1362,9 +1358,6 @@ div.dataviews-view-list {
|
|
|
1362
1358
|
width: 64px;
|
|
1363
1359
|
height: 64px;
|
|
1364
1360
|
}
|
|
1365
|
-
.dataviews-view-list.has-comfortable-density div[role=row] .dataviews-view-list__field-wrapper {
|
|
1366
|
-
min-height: 64px;
|
|
1367
|
-
}
|
|
1368
1361
|
.dataviews-view-list.has-comfortable-density div[role=row] .dataviews-view-list__fields {
|
|
1369
1362
|
gap: 16px;
|
|
1370
1363
|
row-gap: 8px;
|
|
@@ -1525,6 +1518,7 @@ div.dataviews-view-list {
|
|
|
1525
1518
|
}
|
|
1526
1519
|
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-view-table__cell-align-end {
|
|
1527
1520
|
justify-content: flex-end;
|
|
1521
|
+
font-variant-numeric: tabular-nums;
|
|
1528
1522
|
}
|
|
1529
1523
|
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-view-table__cell-align-center {
|
|
1530
1524
|
justify-content: center;
|
|
@@ -2125,6 +2119,7 @@ div.dataviews-view-list {
|
|
|
2125
2119
|
display: flex;
|
|
2126
2120
|
align-items: center;
|
|
2127
2121
|
overflow: hidden;
|
|
2122
|
+
word-break: break-word;
|
|
2128
2123
|
font-weight: var(--wpds-font-weight-medium, 499);
|
|
2129
2124
|
}
|
|
2130
2125
|
.dataforms-layouts-panel__field-control > * {
|
package/build-style/style.css
CHANGED
|
@@ -1300,7 +1300,6 @@ div.dataviews-view-list {
|
|
|
1300
1300
|
border-radius: 4px;
|
|
1301
1301
|
}
|
|
1302
1302
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
1303
|
-
min-height: 52px;
|
|
1304
1303
|
flex-grow: 1;
|
|
1305
1304
|
min-width: 0;
|
|
1306
1305
|
}
|
|
@@ -1340,9 +1339,6 @@ div.dataviews-view-list {
|
|
|
1340
1339
|
width: 32px;
|
|
1341
1340
|
height: 32px;
|
|
1342
1341
|
}
|
|
1343
|
-
.dataviews-view-list.has-compact-density div[role=row] .dataviews-view-list__field-wrapper {
|
|
1344
|
-
min-height: 32px;
|
|
1345
|
-
}
|
|
1346
1342
|
.dataviews-view-list.has-compact-density div[role=row] .dataviews-view-list__fields {
|
|
1347
1343
|
gap: 8px;
|
|
1348
1344
|
row-gap: 4px;
|
|
@@ -1362,9 +1358,6 @@ div.dataviews-view-list {
|
|
|
1362
1358
|
width: 64px;
|
|
1363
1359
|
height: 64px;
|
|
1364
1360
|
}
|
|
1365
|
-
.dataviews-view-list.has-comfortable-density div[role=row] .dataviews-view-list__field-wrapper {
|
|
1366
|
-
min-height: 64px;
|
|
1367
|
-
}
|
|
1368
1361
|
.dataviews-view-list.has-comfortable-density div[role=row] .dataviews-view-list__fields {
|
|
1369
1362
|
gap: 16px;
|
|
1370
1363
|
row-gap: 8px;
|
|
@@ -1525,6 +1518,7 @@ div.dataviews-view-list {
|
|
|
1525
1518
|
}
|
|
1526
1519
|
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-view-table__cell-align-end {
|
|
1527
1520
|
justify-content: flex-end;
|
|
1521
|
+
font-variant-numeric: tabular-nums;
|
|
1528
1522
|
}
|
|
1529
1523
|
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-view-table__cell-align-center {
|
|
1530
1524
|
justify-content: center;
|
|
@@ -2125,6 +2119,7 @@ div.dataviews-view-list {
|
|
|
2125
2119
|
display: flex;
|
|
2126
2120
|
align-items: center;
|
|
2127
2121
|
overflow: hidden;
|
|
2122
|
+
word-break: break-word;
|
|
2128
2123
|
font-weight: var(--wpds-font-weight-medium, 499);
|
|
2129
2124
|
}
|
|
2130
2125
|
.dataforms-layouts-panel__field-control > * {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform-layouts/card/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform-layouts/card/index.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACX,gBAAgB,EAKhB,MAAM,gBAAgB,CAAC;AA0DxB,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,IAAI,EAAI,EAC9C,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,GACR,EAAE,gBAAgB,CAAE,IAAI,CAAE,sCAiM1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-filters/toggle.tsx"],"names":[],"mappings":"AAeA,iBAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-filters/toggle.tsx"],"names":[],"mappings":"AAeA,iBAAS,aAAa,uCA+ErB;AA8BD,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews-layouts/list/index.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAIX,aAAa,EAEb,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews-layouts/list/index.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAIX,aAAa,EAEb,MAAM,gBAAgB,CAAC;AAoVxB,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAI,KAAK,EAAE,aAAa,CAAE,IAAI,CAAE,+BAmSrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews-layouts/table/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAIX,cAAc,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews-layouts/table/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAIX,cAAc,EACd,MAAM,gBAAgB,CAAC;AAyPxB,iBAAS,SAAS,CAAE,IAAI,EAAI,EAC3B,OAAO,EACP,IAAI,EACJ,MAAM,EACN,SAAS,EACT,YAAY,EACZ,SAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,WAAW,EACX,eAAe,EACf,cAAc,EACd,IAAI,EACJ,SAAS,EACT,KAAK,GACL,EAAE,cAAc,CAAE,IAAI,CAAE,2CA8XxB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-panel.d.ts","sourceRoot":"","sources":["../../../src/dataform/stories/layout-panel.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAKX,cAAc,EACd,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-panel.d.ts","sourceRoot":"","sources":["../../../src/dataform/stories/layout-panel.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAKX,cAAc,EACd,MAAM,aAAa,CAAC;AAgSrB,QAAA,MAAM,oBAAoB,GAAK,4CAI5B;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/C,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACnD,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IACzC,cAAc,EAAE,SAAS,GAAG,cAAc,CAAC;CAC3C,gCAiGA,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/empty.tsx"],"names":[],"mappings":"AA+CA,QAAA,MAAM,cAAc,GAAK,8CAItB;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/empty.tsx"],"names":[],"mappings":"AA+CA,QAAA,MAAM,cAAc,GAAK,8CAItB;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,gCAsCA,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"free-composition.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/free-composition.tsx"],"names":[],"mappings":"AA+GA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"free-composition.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/free-composition.tsx"],"names":[],"mappings":"AA+GA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,mCA0DpC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-table.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/layout-table.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,oBAAoB,GAAK,yFAOnC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"layout-table.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/layout-table.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,oBAAoB,GAAK,yFAOnC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,gCA6EA,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimal-ui.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/minimal-ui.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,kBAAkB,GAAK,aAE1B;IACF,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC,
|
|
1
|
+
{"version":3,"file":"minimal-ui.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/minimal-ui.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,kBAAkB,GAAK,aAE1B;IACF,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC,gCA4CA,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-card.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/with-card.tsx"],"names":[],"mappings":"AAoBA,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"with-card.d.ts","sourceRoot":"","sources":["../../../src/dataviews/stories/with-card.tsx"],"names":[],"mappings":"AAoBA,QAAA,MAAM,iBAAiB,mCAwCtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/build-wp/index.js
CHANGED
|
@@ -14682,6 +14682,15 @@ function useDelayedLoading(isLoading, options2 = { delay: 400 }) {
|
|
|
14682
14682
|
|
|
14683
14683
|
// src/components/dataviews-layouts/table/index.tsx
|
|
14684
14684
|
import { Fragment as Fragment4, jsx as jsx45, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
14685
|
+
function getEffectiveAlign(explicitAlign, fieldType) {
|
|
14686
|
+
if (explicitAlign) {
|
|
14687
|
+
return explicitAlign;
|
|
14688
|
+
}
|
|
14689
|
+
if (fieldType === "integer" || fieldType === "number") {
|
|
14690
|
+
return "end";
|
|
14691
|
+
}
|
|
14692
|
+
return void 0;
|
|
14693
|
+
}
|
|
14685
14694
|
function TableColumnField({
|
|
14686
14695
|
item: item2,
|
|
14687
14696
|
fields,
|
|
@@ -14787,6 +14796,8 @@ function TableRow({
|
|
|
14787
14796
|
) }),
|
|
14788
14797
|
columns.map((column) => {
|
|
14789
14798
|
const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
|
|
14799
|
+
const field = fields.find((f) => f.id === column);
|
|
14800
|
+
const effectiveAlign = getEffectiveAlign(align, field?.type);
|
|
14790
14801
|
return /* @__PURE__ */ jsx45(
|
|
14791
14802
|
"td",
|
|
14792
14803
|
{
|
|
@@ -14801,7 +14812,7 @@ function TableRow({
|
|
|
14801
14812
|
fields,
|
|
14802
14813
|
item: item2,
|
|
14803
14814
|
column,
|
|
14804
|
-
align
|
|
14815
|
+
align: effectiveAlign
|
|
14805
14816
|
}
|
|
14806
14817
|
)
|
|
14807
14818
|
},
|
|
@@ -15011,6 +15022,13 @@ function ViewTable({
|
|
|
15011
15022
|
) }),
|
|
15012
15023
|
columns.map((column, index) => {
|
|
15013
15024
|
const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
|
|
15025
|
+
const field = fields.find(
|
|
15026
|
+
(f) => f.id === column
|
|
15027
|
+
);
|
|
15028
|
+
const effectiveAlign = getEffectiveAlign(
|
|
15029
|
+
align,
|
|
15030
|
+
field?.type
|
|
15031
|
+
);
|
|
15014
15032
|
const canInsertOrMove = view.layout?.enableMoving ?? true;
|
|
15015
15033
|
return /* @__PURE__ */ jsx45(
|
|
15016
15034
|
"th",
|
|
@@ -15019,7 +15037,7 @@ function ViewTable({
|
|
|
15019
15037
|
width,
|
|
15020
15038
|
maxWidth,
|
|
15021
15039
|
minWidth,
|
|
15022
|
-
textAlign:
|
|
15040
|
+
textAlign: effectiveAlign
|
|
15023
15041
|
},
|
|
15024
15042
|
"aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
|
|
15025
15043
|
scope: "col",
|
|
@@ -15733,6 +15751,8 @@ function ListItem({
|
|
|
15733
15751
|
}
|
|
15734
15752
|
) }) : null;
|
|
15735
15753
|
const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ jsx49(titleField.render, { item: item2, field: titleField }) : null;
|
|
15754
|
+
const renderDescription = showDescription && descriptionField?.render;
|
|
15755
|
+
const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length;
|
|
15736
15756
|
const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ jsxs9(
|
|
15737
15757
|
Stack,
|
|
15738
15758
|
{
|
|
@@ -15840,7 +15860,7 @@ function ListItem({
|
|
|
15840
15860
|
direction: "row",
|
|
15841
15861
|
gap: "md",
|
|
15842
15862
|
justify: "start",
|
|
15843
|
-
align: "flex-start",
|
|
15863
|
+
align: hasOnlyMediaAndTitle ? "center" : "flex-start",
|
|
15844
15864
|
style: { flex: 1, minWidth: 0 },
|
|
15845
15865
|
children: [
|
|
15846
15866
|
renderedMediaField,
|
|
@@ -15862,7 +15882,7 @@ function ListItem({
|
|
|
15862
15882
|
),
|
|
15863
15883
|
usedActions
|
|
15864
15884
|
] }),
|
|
15865
|
-
|
|
15885
|
+
renderDescription && /* @__PURE__ */ jsx49("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ jsx49(
|
|
15866
15886
|
descriptionField.render,
|
|
15867
15887
|
{
|
|
15868
15888
|
item: item2,
|
|
@@ -19176,11 +19196,10 @@ function FiltersToggle() {
|
|
|
19176
19196
|
},
|
|
19177
19197
|
[onChangeView, setIsShowingFilter]
|
|
19178
19198
|
);
|
|
19179
|
-
const visibleFilters = filters.filter((filter) => filter.isVisible);
|
|
19180
|
-
const hasVisibleFilters = !!visibleFilters.length;
|
|
19181
19199
|
if (filters.length === 0) {
|
|
19182
19200
|
return null;
|
|
19183
19201
|
}
|
|
19202
|
+
const hasVisibleFilters = filters.some((filter) => filter.isVisible);
|
|
19184
19203
|
const addFilterButtonProps = {
|
|
19185
19204
|
label: __41("Add filter"),
|
|
19186
19205
|
"aria-expanded": false,
|
|
@@ -19197,6 +19216,9 @@ function FiltersToggle() {
|
|
|
19197
19216
|
setIsShowingFilter(!isShowingFilter);
|
|
19198
19217
|
}
|
|
19199
19218
|
};
|
|
19219
|
+
const hasPrimaryOrLockedFilters = filters.some(
|
|
19220
|
+
(filter) => filter.isPrimary || filter.isLocked
|
|
19221
|
+
);
|
|
19200
19222
|
const buttonComponent = /* @__PURE__ */ jsx67(
|
|
19201
19223
|
button_default,
|
|
19202
19224
|
{
|
|
@@ -19204,6 +19226,8 @@ function FiltersToggle() {
|
|
|
19204
19226
|
className: "dataviews-filters__visibility-toggle",
|
|
19205
19227
|
size: "compact",
|
|
19206
19228
|
icon: funnel_default,
|
|
19229
|
+
disabled: hasPrimaryOrLockedFilters,
|
|
19230
|
+
accessibleWhenDisabled: true,
|
|
19207
19231
|
...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
|
|
19208
19232
|
}
|
|
19209
19233
|
);
|
|
@@ -24315,9 +24339,6 @@ function FormPanelField({
|
|
|
24315
24339
|
);
|
|
24316
24340
|
}
|
|
24317
24341
|
|
|
24318
|
-
// src/components/dataform-layouts/card/index.tsx
|
|
24319
|
-
import { __ as __61 } from "@wordpress/i18n";
|
|
24320
|
-
|
|
24321
24342
|
// src/components/dataform-layouts/validation-badge.tsx
|
|
24322
24343
|
import { sprintf as sprintf18, _n as _n4 } from "@wordpress/i18n";
|
|
24323
24344
|
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
@@ -24398,10 +24419,9 @@ function FormCardField({
|
|
|
24398
24419
|
const { fields } = useContext(dataform_context_default);
|
|
24399
24420
|
const layout = field.layout;
|
|
24400
24421
|
const cardBodyRef = useRef(null);
|
|
24401
|
-
const
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
);
|
|
24422
|
+
const instanceId = use_instance_id_default(FormCardField);
|
|
24423
|
+
const bodyId = `dataforms-layouts-card-card-body-${instanceId}`;
|
|
24424
|
+
const titleId = `dataforms-layouts-card-card-title-${instanceId}`;
|
|
24405
24425
|
const form = useMemo(
|
|
24406
24426
|
() => ({
|
|
24407
24427
|
layout: DEFAULT_LAYOUT,
|
|
@@ -24511,7 +24531,14 @@ function FormCardField({
|
|
|
24511
24531
|
alignItems: "center"
|
|
24512
24532
|
},
|
|
24513
24533
|
children: [
|
|
24514
|
-
/* @__PURE__ */ jsx109(
|
|
24534
|
+
/* @__PURE__ */ jsx109(
|
|
24535
|
+
"span",
|
|
24536
|
+
{
|
|
24537
|
+
id: titleId,
|
|
24538
|
+
className: "dataforms-layouts-card__field-header-label",
|
|
24539
|
+
children: label
|
|
24540
|
+
}
|
|
24541
|
+
),
|
|
24515
24542
|
validationBadge,
|
|
24516
24543
|
visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ jsx109("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
|
|
24517
24544
|
(summaryField) => /* @__PURE__ */ jsx109(
|
|
@@ -24534,7 +24561,7 @@ function FormCardField({
|
|
|
24534
24561
|
icon: isOpen ? chevron_up_default : chevron_down_default,
|
|
24535
24562
|
"aria-expanded": isOpen,
|
|
24536
24563
|
"aria-controls": bodyId,
|
|
24537
|
-
"aria-
|
|
24564
|
+
"aria-labelledby": titleId
|
|
24538
24565
|
}
|
|
24539
24566
|
)
|
|
24540
24567
|
]
|
|
@@ -24634,7 +24661,7 @@ function FormRowField({
|
|
|
24634
24661
|
}
|
|
24635
24662
|
|
|
24636
24663
|
// src/components/dataform-layouts/details/index.tsx
|
|
24637
|
-
import { __ as
|
|
24664
|
+
import { __ as __61 } from "@wordpress/i18n";
|
|
24638
24665
|
import { jsx as jsx111, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
24639
24666
|
function FormDetailsField({
|
|
24640
24667
|
data,
|
|
@@ -24684,7 +24711,7 @@ function FormDetailsField({
|
|
|
24684
24711
|
if (summaryField && summaryField.render) {
|
|
24685
24712
|
summaryContent = /* @__PURE__ */ jsx111(summaryField.render, { item: data, field: summaryField });
|
|
24686
24713
|
} else {
|
|
24687
|
-
summaryContent = field.label ||
|
|
24714
|
+
summaryContent = field.label || __61("More details");
|
|
24688
24715
|
}
|
|
24689
24716
|
return /* @__PURE__ */ jsxs38(
|
|
24690
24717
|
"details",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dataviews",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -53,23 +53,20 @@
|
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@ariakit/react": "^0.4.21",
|
|
56
|
-
"@wordpress/base-styles": "^6.
|
|
57
|
-
"@wordpress/components": "^32.3.
|
|
58
|
-
"@wordpress/compose": "^7.
|
|
59
|
-
"@wordpress/data": "^10.
|
|
60
|
-
"@wordpress/date": "^5.
|
|
61
|
-
"@wordpress/deprecated": "^4.
|
|
62
|
-
"@wordpress/
|
|
63
|
-
"@wordpress/
|
|
64
|
-
"@wordpress/
|
|
65
|
-
"@wordpress/
|
|
66
|
-
"@wordpress/
|
|
67
|
-
"@wordpress/
|
|
68
|
-
"@wordpress/
|
|
69
|
-
"@wordpress/
|
|
70
|
-
"@wordpress/ui": "^0.8.1-next.v.202602271551.0+464abe399",
|
|
71
|
-
"@wordpress/url": "^4.40.1-next.v.202602271551.0+464abe399",
|
|
72
|
-
"@wordpress/warning": "^3.40.1-next.v.202602271551.0+464abe399",
|
|
56
|
+
"@wordpress/base-styles": "^6.17.0",
|
|
57
|
+
"@wordpress/components": "^32.3.0",
|
|
58
|
+
"@wordpress/compose": "^7.41.0",
|
|
59
|
+
"@wordpress/data": "^10.41.0",
|
|
60
|
+
"@wordpress/date": "^5.41.0",
|
|
61
|
+
"@wordpress/deprecated": "^4.41.0",
|
|
62
|
+
"@wordpress/element": "^6.41.0",
|
|
63
|
+
"@wordpress/i18n": "^6.14.0",
|
|
64
|
+
"@wordpress/icons": "^11.8.0",
|
|
65
|
+
"@wordpress/keycodes": "^4.41.0",
|
|
66
|
+
"@wordpress/primitives": "^4.41.0",
|
|
67
|
+
"@wordpress/private-apis": "^1.41.0",
|
|
68
|
+
"@wordpress/ui": "^0.8.0",
|
|
69
|
+
"@wordpress/warning": "^3.41.0",
|
|
73
70
|
"clsx": "^2.1.1",
|
|
74
71
|
"colord": "^2.7.0",
|
|
75
72
|
"date-fns": "^4.1.0",
|
|
@@ -95,5 +92,5 @@
|
|
|
95
92
|
"scripts": {
|
|
96
93
|
"build:wp": "node build.cjs"
|
|
97
94
|
},
|
|
98
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "8bfc179b9aed74c0a6dd6e8edf7a49e40e4f87cc"
|
|
99
96
|
}
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
useRef,
|
|
17
17
|
useState,
|
|
18
18
|
} from '@wordpress/element';
|
|
19
|
-
import { __ } from '@wordpress/i18n';
|
|
20
19
|
import { chevronDown, chevronUp } from '@wordpress/icons';
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -99,10 +98,9 @@ export default function FormCardField< Item >( {
|
|
|
99
98
|
const { fields } = useContext( DataFormContext );
|
|
100
99
|
const layout = field.layout as NormalizedCardLayout;
|
|
101
100
|
const cardBodyRef = useRef< HTMLDivElement >( null );
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
101
|
+
const instanceId = useInstanceId( FormCardField );
|
|
102
|
+
const bodyId = `dataforms-layouts-card-card-body-${ instanceId }`;
|
|
103
|
+
const titleId = `dataforms-layouts-card-card-title-${ instanceId }`;
|
|
106
104
|
|
|
107
105
|
const form: NormalizedForm = useMemo(
|
|
108
106
|
() => ( {
|
|
@@ -240,7 +238,10 @@ export default function FormCardField< Item >( {
|
|
|
240
238
|
alignItems: 'center',
|
|
241
239
|
} }
|
|
242
240
|
>
|
|
243
|
-
<span
|
|
241
|
+
<span
|
|
242
|
+
id={ titleId }
|
|
243
|
+
className="dataforms-layouts-card__field-header-label"
|
|
244
|
+
>
|
|
244
245
|
{ label }
|
|
245
246
|
</span>
|
|
246
247
|
{ validationBadge }
|
|
@@ -266,9 +267,7 @@ export default function FormCardField< Item >( {
|
|
|
266
267
|
icon={ isOpen ? chevronUp : chevronDown }
|
|
267
268
|
aria-expanded={ isOpen }
|
|
268
269
|
aria-controls={ bodyId }
|
|
269
|
-
aria-
|
|
270
|
-
isOpen ? __( 'Collapse' ) : __( 'Expand' )
|
|
271
|
-
}
|
|
270
|
+
aria-labelledby={ titleId }
|
|
272
271
|
/>
|
|
273
272
|
) }
|
|
274
273
|
</OriginalCardHeader>
|
|
@@ -31,13 +31,13 @@ function FiltersToggle() {
|
|
|
31
31
|
},
|
|
32
32
|
[ onChangeView, setIsShowingFilter ]
|
|
33
33
|
);
|
|
34
|
-
const visibleFilters = filters.filter( ( filter ) => filter.isVisible );
|
|
35
34
|
|
|
36
|
-
const hasVisibleFilters = !! visibleFilters.length;
|
|
37
35
|
if ( filters.length === 0 ) {
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
40
38
|
|
|
39
|
+
const hasVisibleFilters = filters.some( ( filter ) => filter.isVisible );
|
|
40
|
+
|
|
41
41
|
const addFilterButtonProps = {
|
|
42
42
|
label: __( 'Add filter' ),
|
|
43
43
|
'aria-expanded': false,
|
|
@@ -54,12 +54,19 @@ function FiltersToggle() {
|
|
|
54
54
|
setIsShowingFilter( ! isShowingFilter );
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
+
// When there are primary or locked filters, the filter bar is always
|
|
58
|
+
// visible and cannot be hidden, so the toggle button should be disabled.
|
|
59
|
+
const hasPrimaryOrLockedFilters = filters.some(
|
|
60
|
+
( filter ) => filter.isPrimary || filter.isLocked
|
|
61
|
+
);
|
|
57
62
|
const buttonComponent = (
|
|
58
63
|
<Button
|
|
59
64
|
ref={ buttonRef }
|
|
60
65
|
className="dataviews-filters__visibility-toggle"
|
|
61
66
|
size="compact"
|
|
62
67
|
icon={ funnel }
|
|
68
|
+
disabled={ hasPrimaryOrLockedFilters }
|
|
69
|
+
accessibleWhenDisabled
|
|
63
70
|
{ ...( hasVisibleFilters
|
|
64
71
|
? toggleFiltersButtonProps
|
|
65
72
|
: addFilterButtonProps ) }
|