@wordpress/dataviews 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/components/dataviews-bulk-actions/index.js +8 -8
- package/build/components/dataviews-bulk-actions/index.js.map +1 -1
- package/build/components/dataviews-filters/add-filter.js +7 -7
- package/build/components/dataviews-filters/add-filter.js.map +1 -1
- package/build/components/dataviews-filters/filter-summary.js +8 -8
- package/build/components/dataviews-filters/filter-summary.js.map +1 -1
- package/build/components/dataviews-filters/index.js +3 -3
- package/build/components/dataviews-filters/index.js.map +1 -1
- package/build/components/dataviews-filters/search-widget.js +1 -1
- package/build/components/dataviews-filters/search-widget.js.map +1 -1
- package/build/components/dataviews-item-actions/index.js +11 -11
- package/build/components/dataviews-item-actions/index.js.map +1 -1
- package/build/components/dataviews-selection-checkbox/index.js +1 -2
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +10 -10
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/dataforms-layouts/panel/index.js +1 -1
- package/build/dataforms-layouts/panel/index.js.map +1 -1
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/list/index.js +74 -81
- package/build/dataviews-layouts/list/index.js.map +1 -1
- package/build/dataviews-layouts/table/column-header-menu.js +18 -18
- package/build/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/components/dataform-combined-edit/index.js +1 -3
- package/build-module/components/dataform-combined-edit/index.js.map +1 -1
- package/build-module/components/dataviews/index.js +1 -2
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-bulk-actions/index.js +9 -10
- package/build-module/components/dataviews-bulk-actions/index.js.map +1 -1
- package/build-module/components/dataviews-filters/add-filter.js +6 -6
- package/build-module/components/dataviews-filters/add-filter.js.map +1 -1
- package/build-module/components/dataviews-filters/filter-summary.js +9 -10
- package/build-module/components/dataviews-filters/filter-summary.js.map +1 -1
- package/build-module/components/dataviews-filters/index.js +6 -7
- package/build-module/components/dataviews-filters/index.js.map +1 -1
- package/build-module/components/dataviews-filters/search-widget.js +2 -3
- package/build-module/components/dataviews-filters/search-widget.js.map +1 -1
- package/build-module/components/dataviews-footer/index.js +1 -2
- package/build-module/components/dataviews-footer/index.js.map +1 -1
- package/build-module/components/dataviews-item-actions/index.js +11 -13
- package/build-module/components/dataviews-item-actions/index.js.map +1 -1
- package/build-module/components/dataviews-pagination/index.js +1 -2
- package/build-module/components/dataviews-pagination/index.js.map +1 -1
- package/build-module/components/dataviews-selection-checkbox/index.js +1 -2
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +11 -13
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/dataform-controls/datetime.js +1 -2
- package/build-module/dataform-controls/datetime.js.map +1 -1
- package/build-module/dataforms-layouts/panel/index.js +3 -5
- package/build-module/dataforms-layouts/panel/index.js.map +1 -1
- package/build-module/dataviews-layouts/grid/index.js +1 -3
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/list/index.js +76 -84
- package/build-module/dataviews-layouts/list/index.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-header-menu.js +19 -20
- package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build-module/dataviews-layouts/table/index.js +1 -3
- 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 +30 -38
- package/build-style/style.css +30 -38
- package/build-types/components/dataviews-filters/add-filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts +2 -2
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/column-header-menu.d.ts.map +1 -1
- package/build-types/types.d.ts +5 -6
- package/build-types/types.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/components/dataviews-bulk-actions/index.tsx +6 -6
- package/src/components/dataviews-filters/add-filter.tsx +8 -10
- package/src/components/dataviews-filters/index.tsx +4 -4
- package/src/components/dataviews-item-actions/index.tsx +15 -15
- package/src/components/dataviews-selection-checkbox/index.tsx +3 -2
- package/src/components/dataviews-view-config/index.tsx +9 -11
- package/src/dataforms-layouts/panel/index.tsx +2 -2
- package/src/dataviews-layouts/list/index.tsx +85 -106
- package/src/dataviews-layouts/list/style.scss +32 -49
- package/src/dataviews-layouts/table/column-header-menu.tsx +31 -35
- package/src/types.ts +6 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -17,16 +17,15 @@ import { unlock } from '../../lock-unlock';
|
|
|
17
17
|
import { sanitizeOperators } from '../../utils';
|
|
18
18
|
import { SORTING_DIRECTIONS, sortArrows, sortLabels } from '../../constants';
|
|
19
19
|
import { getVisibleFieldIds } from '../index';
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
21
|
const {
|
|
23
|
-
|
|
22
|
+
Menu
|
|
24
23
|
} = unlock(componentsPrivateApis);
|
|
25
|
-
function
|
|
24
|
+
function WithMenuSeparators({
|
|
26
25
|
children
|
|
27
26
|
}) {
|
|
28
27
|
return Children.toArray(children).filter(Boolean).map((child, i) => /*#__PURE__*/_jsxs(Fragment, {
|
|
29
|
-
children: [i > 0 && /*#__PURE__*/_jsx(
|
|
28
|
+
children: [i > 0 && /*#__PURE__*/_jsx(Menu.Separator, {}), child]
|
|
30
29
|
}, i));
|
|
31
30
|
}
|
|
32
31
|
const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
@@ -64,7 +63,7 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
64
63
|
} else {
|
|
65
64
|
header = combinedField.header || combinedField.label;
|
|
66
65
|
}
|
|
67
|
-
return /*#__PURE__*/_jsx(
|
|
66
|
+
return /*#__PURE__*/_jsx(Menu, {
|
|
68
67
|
align: "start",
|
|
69
68
|
trigger: /*#__PURE__*/_jsxs(Button, {
|
|
70
69
|
size: "compact",
|
|
@@ -79,12 +78,12 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
79
78
|
style: {
|
|
80
79
|
minWidth: '240px'
|
|
81
80
|
},
|
|
82
|
-
children: /*#__PURE__*/_jsxs(
|
|
83
|
-
children: [isSortable && /*#__PURE__*/_jsx(
|
|
81
|
+
children: /*#__PURE__*/_jsxs(WithMenuSeparators, {
|
|
82
|
+
children: [isSortable && /*#__PURE__*/_jsx(Menu.Group, {
|
|
84
83
|
children: SORTING_DIRECTIONS.map(direction => {
|
|
85
84
|
const isChecked = view.sort && isSorted && view.sort.direction === direction;
|
|
86
85
|
const value = `${fieldId}-${direction}`;
|
|
87
|
-
return /*#__PURE__*/_jsx(
|
|
86
|
+
return /*#__PURE__*/_jsx(Menu.RadioItem, {
|
|
88
87
|
// All sorting radio items share the same name, so that
|
|
89
88
|
// selecting a sorting option automatically deselects the
|
|
90
89
|
// previously selected one, even if it is displayed in
|
|
@@ -102,13 +101,13 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
102
101
|
}
|
|
103
102
|
});
|
|
104
103
|
},
|
|
105
|
-
children: /*#__PURE__*/_jsx(
|
|
104
|
+
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
106
105
|
children: sortLabels[direction]
|
|
107
106
|
})
|
|
108
107
|
}, value);
|
|
109
108
|
})
|
|
110
|
-
}), canAddFilter && /*#__PURE__*/_jsx(
|
|
111
|
-
children: /*#__PURE__*/_jsx(
|
|
109
|
+
}), canAddFilter && /*#__PURE__*/_jsx(Menu.Group, {
|
|
110
|
+
children: /*#__PURE__*/_jsx(Menu.Item, {
|
|
112
111
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
113
112
|
icon: funnel
|
|
114
113
|
}),
|
|
@@ -124,12 +123,12 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
124
123
|
}]
|
|
125
124
|
});
|
|
126
125
|
},
|
|
127
|
-
children: /*#__PURE__*/_jsx(
|
|
126
|
+
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
128
127
|
children: __('Add filter')
|
|
129
128
|
})
|
|
130
129
|
})
|
|
131
|
-
}), /*#__PURE__*/_jsxs(
|
|
132
|
-
children: [/*#__PURE__*/_jsx(
|
|
130
|
+
}), /*#__PURE__*/_jsxs(Menu.Group, {
|
|
131
|
+
children: [/*#__PURE__*/_jsx(Menu.Item, {
|
|
133
132
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
134
133
|
icon: arrowLeft
|
|
135
134
|
}),
|
|
@@ -141,10 +140,10 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
141
140
|
fields: [...((_visibleFieldIds$slic = visibleFieldIds.slice(0, index - 1)) !== null && _visibleFieldIds$slic !== void 0 ? _visibleFieldIds$slic : []), fieldId, visibleFieldIds[index - 1], ...visibleFieldIds.slice(index + 1)]
|
|
142
141
|
});
|
|
143
142
|
},
|
|
144
|
-
children: /*#__PURE__*/_jsx(
|
|
143
|
+
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
145
144
|
children: __('Move left')
|
|
146
145
|
})
|
|
147
|
-
}), /*#__PURE__*/_jsx(
|
|
146
|
+
}), /*#__PURE__*/_jsx(Menu.Item, {
|
|
148
147
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
149
148
|
icon: arrowRight
|
|
150
149
|
}),
|
|
@@ -156,10 +155,10 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
156
155
|
fields: [...((_visibleFieldIds$slic2 = visibleFieldIds.slice(0, index)) !== null && _visibleFieldIds$slic2 !== void 0 ? _visibleFieldIds$slic2 : []), visibleFieldIds[index + 1], fieldId, ...visibleFieldIds.slice(index + 2)]
|
|
157
156
|
});
|
|
158
157
|
},
|
|
159
|
-
children: /*#__PURE__*/_jsx(
|
|
158
|
+
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
160
159
|
children: __('Move right')
|
|
161
160
|
})
|
|
162
|
-
}), isHidable && field && /*#__PURE__*/_jsx(
|
|
161
|
+
}), isHidable && field && /*#__PURE__*/_jsx(Menu.Item, {
|
|
163
162
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
164
163
|
icon: unseen
|
|
165
164
|
}),
|
|
@@ -170,7 +169,7 @@ const _HeaderMenu = forwardRef(function HeaderMenu({
|
|
|
170
169
|
fields: visibleFieldIds.filter(id => id !== fieldId)
|
|
171
170
|
});
|
|
172
171
|
},
|
|
173
|
-
children: /*#__PURE__*/_jsx(
|
|
172
|
+
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
174
173
|
children: __('Hide column')
|
|
175
174
|
})
|
|
176
175
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","arrowLeft","arrowRight","unseen","funnel","Button","Icon","privateApis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","DropdownMenuV2","WithDropDownMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","ref","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","header","operators","combinedField","layout","combinedFields","find","f","id","enableHiding","enableSorting","filters","some","_filter","elements","length","filterBy","isPrimary","label","align","trigger","size","className","variant","direction","style","minWidth","Group","isChecked","value","RadioItem","name","checked","onChange","ItemLabel","Item","prefix","icon","onClick","page","undefined","operator","disabled","_visibleFieldIds$slic","slice","_visibleFieldIds$slic2","ColumnHeaderMenu"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-header-menu.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, Ref, PropsWithoutRef, RefAttributes } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight, unseen, funnel } from '@wordpress/icons';\nimport {\n\tButton,\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef, Children, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { sanitizeOperators } from '../../utils';\nimport { SORTING_DIRECTIONS, sortArrows, sortLabels } from '../../constants';\nimport type {\n\tNormalizedField,\n\tSortDirection,\n\tViewTable as ViewTableType,\n\tOperator,\n} from '../../types';\nimport { getVisibleFieldIds } from '../index';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\ninterface HeaderMenuProps< Item > {\n\tfieldId: string;\n\tview: ViewTableType;\n\tfields: NormalizedField< Item >[];\n\tonChangeView: ( view: ViewTableType ) => void;\n\tonHide: ( field: NormalizedField< Item > ) => void;\n\tsetOpenedFilter: ( fieldId: string ) => void;\n}\n\nfunction WithDropDownMenuSeparators( { children }: { children: ReactNode } ) {\n\treturn Children.toArray( children )\n\t\t.filter( Boolean )\n\t\t.map( ( child, i ) => (\n\t\t\t<Fragment key={ i }>\n\t\t\t\t{ i > 0 && <DropdownMenuV2.Separator /> }\n\t\t\t\t{ child }\n\t\t\t</Fragment>\n\t\t) );\n}\n\nconst _HeaderMenu = forwardRef( function HeaderMenu< Item >(\n\t{\n\t\tfieldId,\n\t\tview,\n\t\tfields,\n\t\tonChangeView,\n\t\tonHide,\n\t\tsetOpenedFilter,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = getVisibleFieldIds( view, fields );\n\tconst index = visibleFieldIds?.indexOf( fieldId ) as number;\n\tconst isSorted = view.sort?.field === fieldId;\n\tlet isHidable = false;\n\tlet isSortable = false;\n\tlet canAddFilter = false;\n\tlet header;\n\tlet operators: Operator[] = [];\n\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === fieldId\n\t);\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! combinedField ) {\n\t\tif ( ! field ) {\n\t\t\t// No combined or regular field found.\n\t\t\treturn null;\n\t\t}\n\n\t\tisHidable = field.enableHiding !== false;\n\t\tisSortable = field.enableSorting !== false;\n\t\theader = field.header;\n\n\t\toperators = sanitizeOperators( field );\n\t\t// Filter can be added:\n\t\t// 1. If the field is not already part of a view's filters.\n\t\t// 2. If the field meets the type and operator requirements.\n\t\t// 3. If it's not primary. If it is, it should be already visible.\n\t\tcanAddFilter =\n\t\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t\t!! field.elements?.length &&\n\t\t\t!! operators.length &&\n\t\t\t! field.filterBy?.isPrimary;\n\t} else {\n\t\theader = combinedField.header || combinedField.label;\n\t}\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\talign=\"start\"\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"dataviews-view-table-header-button\"\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t>\n\t\t\t\t\t{ header }\n\t\t\t\t\t{ view.sort && isSorted && (\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{ sortArrows[ view.sort.direction ] }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tstyle={ { minWidth: '240px' } }\n\t\t>\n\t\t\t<WithDropDownMenuSeparators>\n\t\t\t\t{ isSortable && (\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ SORTING_DIRECTIONS.map(\n\t\t\t\t\t\t\t( direction: SortDirection ) => {\n\t\t\t\t\t\t\t\tconst isChecked =\n\t\t\t\t\t\t\t\t\tview.sort &&\n\t\t\t\t\t\t\t\t\tisSorted &&\n\t\t\t\t\t\t\t\t\tview.sort.direction === direction;\n\n\t\t\t\t\t\t\t\tconst value = `${ fieldId }-${ direction }`;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t// All sorting radio items share the same name, so that\n\t\t\t\t\t\t\t\t\t\t// selecting a sorting option automatically deselects the\n\t\t\t\t\t\t\t\t\t\t// previously selected one, even if it is displayed in\n\t\t\t\t\t\t\t\t\t\t// another submenu. The field and direction are passed via\n\t\t\t\t\t\t\t\t\t\t// the `value` prop.\n\t\t\t\t\t\t\t\t\t\tname=\"view-table-sorting\"\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tchecked={ isChecked }\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\t\tsort: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdirection,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ sortLabels[ direction ] }\n\t\t\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t) }\n\t\t\t\t{ canAddFilter && (\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ funnel } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetOpenedFilter( fieldId );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t...( view.filters || [] ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\tvalue: undefined,\n\t\t\t\t\t\t\t\t\t\t\toperator: operators[ 0 ],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t) }\n\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\tindex - 1\n\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 1 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t{ __( 'Move left' ) }\n\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\tdisabled={ index >= visibleFieldIds.length - 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice( 0, index ) ??\n\t\t\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 2 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t{ __( 'Move right' ) }\n\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t<DropdownMenuV2.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t</DropdownMenuV2.Item>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t</WithDropDownMenuSeparators>\n\t\t</DropdownMenuV2>\n\t);\n} );\n\n// @ts-expect-error Lift the `Item` type argument through the forwardRef.\nconst ColumnHeaderMenu: < Item >(\n\tprops: PropsWithoutRef< HeaderMenuProps< Item > > &\n\t\tRefAttributes< HTMLButtonElement >\n) => ReturnType< typeof _HeaderMenu > = _HeaderMenu;\n\nexport default ColumnHeaderMenu;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACxE,SACCC,MAAM,EACNC,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,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;AAO5E,SAASC,kBAAkB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE9C,MAAM;EAAEC;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C,KAAK,GAAG,CAAC,CAAE,EAC5BR,OAAO,EACP,GAAGO,eAAe,CAACoD,KAAK,CAAEnD,KAAK,GAAG,CAAE,CAAC;YAEvC,CAAE,CAAC;UACJ,CAAG;UAAAlB,QAAA,eAEHL,IAAA,CAACG,cAAc,CAAC6D,SAAS;YAAA3D,QAAA,EACtBxB,EAAE,CAAE,YAAa;UAAC,CACK;QAAC,CACP,CAAC,EACpB+C,SAAS,IAAID,KAAK,iBACnB3B,IAAA,CAACG,cAAc,CAAC8D,IAAI;UACnBC,MAAM,eAAGlE,IAAA,CAACb,IAAI;YAACgF,IAAI,EAAGnF;UAAQ,CAAE,CAAG;UACnCoF,OAAO,EAAGA,CAAA,KAAM;YACfjD,MAAM,CAAEQ,KAAM,CAAC;YACfT,YAAY,CAAE;cACb,GAAGF,IAAI;cACPC,MAAM,EAAEK,eAAe,CAACf,MAAM,CAC3B+B,EAAE,IAAMA,EAAE,KAAKvB,OAClB;YACD,CAAE,CAAC;UACJ,CAAG;UAAAV,QAAA,eAEHL,IAAA,CAACG,cAAc,CAAC6D,SAAS;YAAA3D,QAAA,EACtBxB,EAAE,CAAE,aAAc;UAAC,CACI;QAAC,CACP,CACrB;MAAA,CACoB,CAAC;IAAA,CACI;EAAC,CACd,CAAC;AAEnB,CAAE,CAAC;;AAEH;AACA,MAAM+F,gBAG+B,GAAG/D,WAAW;AAEnD,eAAe+D,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","arrowLeft","arrowRight","unseen","funnel","Button","Icon","privateApis","componentsPrivateApis","forwardRef","Children","Fragment","unlock","sanitizeOperators","SORTING_DIRECTIONS","sortArrows","sortLabels","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","Menu","WithMenuSeparators","children","toArray","filter","Boolean","map","child","i","Separator","_HeaderMenu","HeaderMenu","fieldId","view","fields","onChangeView","onHide","setOpenedFilter","ref","visibleFieldIds","index","indexOf","isSorted","sort","field","isHidable","isSortable","canAddFilter","header","operators","combinedField","layout","combinedFields","find","f","id","enableHiding","enableSorting","filters","some","_filter","elements","length","filterBy","isPrimary","label","align","trigger","size","className","variant","direction","style","minWidth","Group","isChecked","value","RadioItem","name","checked","onChange","ItemLabel","Item","prefix","icon","onClick","page","undefined","operator","disabled","_visibleFieldIds$slic","slice","_visibleFieldIds$slic2","ColumnHeaderMenu"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/column-header-menu.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, Ref, PropsWithoutRef, RefAttributes } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight, unseen, funnel } from '@wordpress/icons';\nimport {\n\tButton,\n\tIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef, Children, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { sanitizeOperators } from '../../utils';\nimport { SORTING_DIRECTIONS, sortArrows, sortLabels } from '../../constants';\nimport type {\n\tNormalizedField,\n\tSortDirection,\n\tViewTable as ViewTableType,\n\tOperator,\n} from '../../types';\nimport { getVisibleFieldIds } from '../index';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\ninterface HeaderMenuProps< Item > {\n\tfieldId: string;\n\tview: ViewTableType;\n\tfields: NormalizedField< Item >[];\n\tonChangeView: ( view: ViewTableType ) => void;\n\tonHide: ( field: NormalizedField< Item > ) => void;\n\tsetOpenedFilter: ( fieldId: string ) => void;\n}\n\nfunction WithMenuSeparators( { children }: { children: ReactNode } ) {\n\treturn Children.toArray( children )\n\t\t.filter( Boolean )\n\t\t.map( ( child, i ) => (\n\t\t\t<Fragment key={ i }>\n\t\t\t\t{ i > 0 && <Menu.Separator /> }\n\t\t\t\t{ child }\n\t\t\t</Fragment>\n\t\t) );\n}\n\nconst _HeaderMenu = forwardRef( function HeaderMenu< Item >(\n\t{\n\t\tfieldId,\n\t\tview,\n\t\tfields,\n\t\tonChangeView,\n\t\tonHide,\n\t\tsetOpenedFilter,\n\t}: HeaderMenuProps< Item >,\n\tref: Ref< HTMLButtonElement >\n) {\n\tconst visibleFieldIds = getVisibleFieldIds( view, fields );\n\tconst index = visibleFieldIds?.indexOf( fieldId ) as number;\n\tconst isSorted = view.sort?.field === fieldId;\n\tlet isHidable = false;\n\tlet isSortable = false;\n\tlet canAddFilter = false;\n\tlet header;\n\tlet operators: Operator[] = [];\n\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === fieldId\n\t);\n\tconst field = fields.find( ( f ) => f.id === fieldId );\n\n\tif ( ! combinedField ) {\n\t\tif ( ! field ) {\n\t\t\t// No combined or regular field found.\n\t\t\treturn null;\n\t\t}\n\n\t\tisHidable = field.enableHiding !== false;\n\t\tisSortable = field.enableSorting !== false;\n\t\theader = field.header;\n\n\t\toperators = sanitizeOperators( field );\n\t\t// Filter can be added:\n\t\t// 1. If the field is not already part of a view's filters.\n\t\t// 2. If the field meets the type and operator requirements.\n\t\t// 3. If it's not primary. If it is, it should be already visible.\n\t\tcanAddFilter =\n\t\t\t! view.filters?.some( ( _filter ) => fieldId === _filter.field ) &&\n\t\t\t!! field.elements?.length &&\n\t\t\t!! operators.length &&\n\t\t\t! field.filterBy?.isPrimary;\n\t} else {\n\t\theader = combinedField.header || combinedField.label;\n\t}\n\n\treturn (\n\t\t<Menu\n\t\t\talign=\"start\"\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tclassName=\"dataviews-view-table-header-button\"\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t>\n\t\t\t\t\t{ header }\n\t\t\t\t\t{ view.sort && isSorted && (\n\t\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t\t{ sortArrows[ view.sort.direction ] }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tstyle={ { minWidth: '240px' } }\n\t\t>\n\t\t\t<WithMenuSeparators>\n\t\t\t\t{ isSortable && (\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ SORTING_DIRECTIONS.map(\n\t\t\t\t\t\t\t( direction: SortDirection ) => {\n\t\t\t\t\t\t\t\tconst isChecked =\n\t\t\t\t\t\t\t\t\tview.sort &&\n\t\t\t\t\t\t\t\t\tisSorted &&\n\t\t\t\t\t\t\t\t\tview.sort.direction === direction;\n\n\t\t\t\t\t\t\t\tconst value = `${ fieldId }-${ direction }`;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t// All sorting radio items share the same name, so that\n\t\t\t\t\t\t\t\t\t\t// selecting a sorting option automatically deselects the\n\t\t\t\t\t\t\t\t\t\t// previously selected one, even if it is displayed in\n\t\t\t\t\t\t\t\t\t\t// another submenu. The field and direction are passed via\n\t\t\t\t\t\t\t\t\t\t// the `value` prop.\n\t\t\t\t\t\t\t\t\t\tname=\"view-table-sorting\"\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\tchecked={ isChecked }\n\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\t\t\tsort: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdirection,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ sortLabels[ direction ] }\n\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t) }\n\t\t\t\t{ canAddFilter && (\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ funnel } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetOpenedFilter( fieldId );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t...( view.filters || [] ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: fieldId,\n\t\t\t\t\t\t\t\t\t\t\tvalue: undefined,\n\t\t\t\t\t\t\t\t\t\t\toperator: operators[ 0 ],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t) }\n\t\t\t\t<Menu.Group>\n\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowLeft } /> }\n\t\t\t\t\t\tdisabled={ index < 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice(\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\tindex - 1\n\t\t\t\t\t\t\t\t\t) ?? [] ),\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index - 1 ],\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 1 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu.ItemLabel>{ __( 'Move left' ) }</Menu.ItemLabel>\n\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\tprefix={ <Icon icon={ arrowRight } /> }\n\t\t\t\t\t\tdisabled={ index >= visibleFieldIds.length - 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t...( visibleFieldIds.slice( 0, index ) ??\n\t\t\t\t\t\t\t\t\t\t[] ),\n\t\t\t\t\t\t\t\t\tvisibleFieldIds[ index + 1 ],\n\t\t\t\t\t\t\t\t\tfieldId,\n\t\t\t\t\t\t\t\t\t...visibleFieldIds.slice( index + 2 ),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu.ItemLabel>{ __( 'Move right' ) }</Menu.ItemLabel>\n\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t{ isHidable && field && (\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tprefix={ <Icon icon={ unseen } /> }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonHide( field );\n\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\tfields: visibleFieldIds.filter(\n\t\t\t\t\t\t\t\t\t\t( id ) => id !== fieldId\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Hide column' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t) }\n\t\t\t\t</Menu.Group>\n\t\t\t</WithMenuSeparators>\n\t\t</Menu>\n\t);\n} );\n\n// @ts-expect-error Lift the `Item` type argument through the forwardRef.\nconst ColumnHeaderMenu: < Item >(\n\tprops: PropsWithoutRef< HeaderMenuProps< Item > > &\n\t\tRefAttributes< HTMLButtonElement >\n) => ReturnType< typeof _HeaderMenu > = _HeaderMenu;\n\nexport default ColumnHeaderMenu;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACxE,SACCC,MAAM,EACNC,IAAI,EACJC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEnE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,kBAAkB,EAAEC,UAAU,EAAEC,UAAU,QAAQ,iBAAiB;AAO5E,SAASC,kBAAkB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9C,MAAM;EAAEC;AAAK,CAAC,GAAGV,MAAM,CAAEJ,qBAAsB,CAAC;AAWhD,SAASe,kBAAkBA,CAAE;EAAEC;AAAkC,CAAC,EAAG;EACpE,OAAOd,QAAQ,CAACe,OAAO,CAAED,QAAS,CAAC,CACjCE,MAAM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,CAAC6D,SAAS;YAAA3D,QAAA,EAAGxB,EAAE,CAAE,YAAa;UAAC,CAAkB;QAAC,CAC7C,CAAC,EACV+C,SAAS,IAAID,KAAK,iBACnB3B,IAAA,CAACG,IAAI,CAAC8D,IAAI;UACTC,MAAM,eAAGlE,IAAA,CAACb,IAAI;YAACgF,IAAI,EAAGnF;UAAQ,CAAE,CAAG;UACnCoF,OAAO,EAAGA,CAAA,KAAM;YACfjD,MAAM,CAAEQ,KAAM,CAAC;YACfT,YAAY,CAAE;cACb,GAAGF,IAAI;cACPC,MAAM,EAAEK,eAAe,CAACf,MAAM,CAC3B+B,EAAE,IAAMA,EAAE,KAAKvB,OAClB;YACD,CAAE,CAAC;UACJ,CAAG;UAAAV,QAAA,eAEHL,IAAA,CAACG,IAAI,CAAC6D,SAAS;YAAA3D,QAAA,EACZxB,EAAE,CAAE,aAAc;UAAC,CACN;QAAC,CACP,CACX;MAAA,CACU,CAAC;IAAA,CACM;EAAC,CAChB,CAAC;AAET,CAAE,CAAC;;AAEH;AACA,MAAM+F,gBAG+B,GAAG/D,WAAW;AAEnD,eAAe+D,gBAAgB","ignoreList":[]}
|
|
@@ -19,9 +19,7 @@ import { sortValues } from '../../constants';
|
|
|
19
19
|
import { useSomeItemHasAPossibleBulkAction, useHasAPossibleBulkAction, BulkSelectionCheckbox } from '../../components/dataviews-bulk-actions';
|
|
20
20
|
import ColumnHeaderMenu from './column-header-menu';
|
|
21
21
|
import { getVisibleFieldIds } from '../index';
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
23
|
function TableColumn({
|
|
26
24
|
column,
|
|
27
25
|
fields,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","Spinner","__experimentalHStack","HStack","__experimentalVStack","VStack","useEffect","useId","useRef","useState","SingleSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumn","column","fields","view","props","field","find","f","id","TableColumnField","combinedField","layout","combinedFields","TableColumnCombined","primaryField","item","className","children","render","map","child","direction","spacing","TableRow","hasBulkActions","actions","selection","getItemId","onChangeSelection","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","_view$layout$styles$c","maxWidth","minWidth","styles","length","e","stopPropagation","ViewTable","data","isLoading","onChangeView","setOpenedFilter","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","undefined","tableNoticeId","onHide","hidden","get","fallback","node","hasData","scope","index","_view$layout$styles$c2","sort","ref","set","delete","fieldId","toString"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tSpinner,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SingleSelectionCheckbox from '../../components/dataviews-selection-checkbox';\nimport ItemActions from '../../components/dataviews-item-actions';\nimport { sortValues } from '../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../components/dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n\tCombinedField,\n} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport { getVisibleFieldIds } from '../index';\n\ninterface TableColumnFieldProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfield: NormalizedField< Item >;\n\titem: Item;\n}\n\ninterface TableColumnCombinedProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\tfield: CombinedField;\n\titem: Item;\n\tview: ViewTableType;\n}\n\ninterface TableColumnProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\titem: Item;\n\tcolumn: string;\n\tview: ViewTableType;\n}\n\ninterface TableRowProps< Item > {\n\thasBulkActions: boolean;\n\titem: Item;\n\tactions: Action< Item >[];\n\tfields: NormalizedField< Item >[];\n\tid: string;\n\tview: ViewTableType;\n\tprimaryField?: NormalizedField< Item >;\n\tselection: string[];\n\tgetItemId: ( item: Item ) => string;\n\tonChangeSelection: SetSelection;\n}\n\nfunction TableColumn< Item >( {\n\tcolumn,\n\tfields,\n\tview,\n\t...props\n}: TableColumnProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\tif ( !! field ) {\n\t\treturn <TableColumnField { ...props } field={ field } />;\n\t}\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === column\n\t);\n\tif ( !! combinedField ) {\n\t\treturn (\n\t\t\t<TableColumnCombined\n\t\t\t\t{ ...props }\n\t\t\t\tfields={ fields }\n\t\t\t\tview={ view }\n\t\t\t\tfield={ combinedField }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction TableColumnField< Item >( {\n\tprimaryField,\n\titem,\n\tfield,\n}: TableColumnFieldProps< Item > ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t\t\t'dataviews-view-table__primary-field':\n\t\t\t\t\tprimaryField?.id === field.id,\n\t\t\t} ) }\n\t\t>\n\t\t\t<field.render { ...{ item } } />\n\t\t</div>\n\t);\n}\n\nfunction TableColumnCombined< Item >( {\n\tfield,\n\t...props\n}: TableColumnCombinedProps< Item > ) {\n\tconst children = field.children.map( ( child ) => (\n\t\t<TableColumn key={ child } { ...props } column={ child } />\n\t) );\n\n\tif ( field.direction === 'horizontal' ) {\n\t\treturn <HStack spacing={ 3 }>{ children }</HStack>;\n\t}\n\treturn <VStack spacing={ 0 }>{ children }</VStack>;\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\tprimaryField,\n\tselection,\n\tgetItemId,\n\tonChangeSelection,\n}: TableRowProps< Item > ) {\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst handleMouseEnter = () => {\n\t\tsetIsHovered( true );\n\t};\n\tconst handleMouseLeave = () => {\n\t\tsetIsHovered( false );\n\t};\n\n\t// Will be set to true if `onTouchStart` fires. This happens before\n\t// `onClick` and can be used to exclude touchscreen devices from certain\n\t// behaviours.\n\tconst isTouchDeviceRef = useRef( false );\n\tconst columns = getVisibleFieldIds( view, fields );\n\n\treturn (\n\t\t<tr\n\t\t\tclassName={ clsx( 'dataviews-view-table__row', {\n\t\t\t\t'is-selected': hasPossibleBulkAction && isSelected,\n\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonMouseEnter={ handleMouseEnter }\n\t\t\tonMouseLeave={ handleMouseLeave }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t! isTouchDeviceRef.current &&\n\t\t\t\t\tdocument.getSelection()?.type !== 'Range'\n\t\t\t\t) {\n\t\t\t\t\tonChangeSelection(\n\t\t\t\t\t\tselection.includes( id )\n\t\t\t\t\t\t\t? selection.filter( ( itemId ) => id !== itemId )\n\t\t\t\t\t\t\t: [ id ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ hasBulkActions && (\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t\t\t\t<SingleSelectionCheckbox\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tdisabled={ ! hasPossibleBulkAction }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t) }\n\t\t\t{ columns.map( ( column: string ) => {\n\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<td key={ column } style={ { width, maxWidth, minWidth } }>\n\t\t\t\t\t\t<TableColumn\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tcolumn={ column }\n\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ !! actions?.length && (\n\t\t\t\t// Disable reason: we are not making the element interactive,\n\t\t\t\t// but preventing any click events from bubbling up to the\n\t\t\t\t// table row. This allows us to add a click handler to the row\n\t\t\t\t// itself (to toggle row selection) without erroneously\n\t\t\t\t// intercepting click events from ItemActions.\n\n\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__actions-column\"\n\t\t\t\t\tonClick={ ( e ) => e.stopPropagation() }\n\t\t\t\t>\n\t\t\t\t\t<ItemActions item={ item } actions={ actions } />\n\t\t\t\t</td>\n\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t) }\n\t\t</tr>\n\t);\n}\n\nfunction ViewTable< Item >( {\n\tactions,\n\tdata,\n\tfields,\n\tgetItemId,\n\tisLoading = false,\n\tonChangeView,\n\tonChangeSelection,\n\tselection,\n\tsetOpenedFilter,\n\tview,\n}: ViewTableProps< Item > ) {\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >();\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\n\n\tuseEffect( () => {\n\t\tif ( headerMenuToFocusRef.current ) {\n\t\t\theaderMenuToFocusRef.current.focus();\n\t\t\theaderMenuToFocusRef.current = undefined;\n\t\t}\n\t} );\n\n\tconst tableNoticeId = useId();\n\n\tif ( nextHeaderMenuToFocus ) {\n\t\t// If we need to force focus, we short-circuit rendering here\n\t\t// to prevent any additional work while we handle that.\n\t\t// Clearing out the focus directive is necessary to make sure\n\t\t// future renders don't cause unexpected focus jumps.\n\t\theaderMenuToFocusRef.current = nextHeaderMenuToFocus;\n\t\tsetNextHeaderMenuToFocus( undefined );\n\t\treturn;\n\t}\n\n\tconst onHide = ( field: NormalizedField< Item > ) => {\n\t\tconst hidden = headerMenuRefs.current.get( field.id );\n\t\tconst fallback = hidden\n\t\t\t? headerMenuRefs.current.get( hidden.fallback )\n\t\t\t: undefined;\n\t\tsetNextHeaderMenuToFocus( fallback?.node );\n\t};\n\n\tconst columns = getVisibleFieldIds( view, fields );\n\tconst hasData = !! data?.length;\n\n\tconst primaryField = fields.find(\n\t\t( field ) => field.id === view.layout?.primaryField\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName=\"dataviews-view-table\"\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"dataviews-view-table__row\">\n\t\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BulkSelectionCheckbox\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ columns.map( ( column, index ) => {\n\t\t\t\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\t\t\t\tstyle={ { width, maxWidth, minWidth } }\n\t\t\t\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t\t\t\tview.sort?.field === column\n\t\t\t\t\t\t\t\t\t\t\t? sortValues[ view.sort.direction ]\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ ( node ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( node ) {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.set(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfallback:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolumns[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex > 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? index - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.delete(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tfieldId={ column }\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t\t<th className=\"dataviews-view-table__actions-column\">\n\t\t\t\t\t\t\t\t<span className=\"dataviews-view-table-header\">\n\t\t\t\t\t\t\t\t\t{ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t/>\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</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Ac;UAC7BY,SAAS,EAAGA,SAAW;UACvBC,SAAS,EAAGA,SAAW;UACvBC,iBAAiB,EAAGA;QAAmB,GAVjCD,SAAS,CAAEZ,IAAK,CAWtB,CACA;MAAC,CACE,CAAC;IAAA,CACF,CAAC,eACRpB,IAAA;MACCqB,SAAS,EAAGzC,IAAI,CAAE;QACjB,mBAAmB,EAAEqF,SAAS;QAC9B,sBAAsB,EAAE,CAAEgB,OAAO,IAAI,CAAEhB;MACxC,CAAE,CAAG;MACLpD,EAAE,EAAG8D,aAAe;MAAArD,QAAA,EAElB,CAAE2D,OAAO,iBACVjF,IAAA;QAAAsB,QAAA,EAAK2C,SAAS,gBAAGjE,IAAA,CAAClB,OAAO,IAAE,CAAC,GAAGD,EAAE,CAAE,YAAa;MAAC,CAAK;IACtD,CACG,CAAC;EAAA,CACL,CAAC;AAEL;AAEA,eAAekF,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","Spinner","__experimentalHStack","HStack","__experimentalVStack","VStack","useEffect","useId","useRef","useState","SingleSelectionCheckbox","ItemActions","sortValues","useSomeItemHasAPossibleBulkAction","useHasAPossibleBulkAction","BulkSelectionCheckbox","ColumnHeaderMenu","getVisibleFieldIds","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableColumn","column","fields","view","props","field","find","f","id","TableColumnField","combinedField","layout","combinedFields","TableColumnCombined","primaryField","item","className","children","render","map","child","direction","spacing","TableRow","hasBulkActions","actions","selection","getItemId","onChangeSelection","hasPossibleBulkAction","isSelected","includes","isHovered","setIsHovered","handleMouseEnter","handleMouseLeave","isTouchDeviceRef","columns","onMouseEnter","onMouseLeave","onTouchStart","current","onClick","document","getSelection","type","filter","itemId","style","width","disabled","_view$layout$styles$c","maxWidth","minWidth","styles","length","e","stopPropagation","ViewTable","data","isLoading","onChangeView","setOpenedFilter","headerMenuRefs","Map","headerMenuToFocusRef","nextHeaderMenuToFocus","setNextHeaderMenuToFocus","focus","undefined","tableNoticeId","onHide","hidden","get","fallback","node","hasData","scope","index","_view$layout$styles$c2","sort","ref","set","delete","fieldId","toString"],"sources":["@wordpress/dataviews/src/dataviews-layouts/table/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tSpinner,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useEffect, useId, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SingleSelectionCheckbox from '../../components/dataviews-selection-checkbox';\nimport ItemActions from '../../components/dataviews-item-actions';\nimport { sortValues } from '../../constants';\nimport {\n\tuseSomeItemHasAPossibleBulkAction,\n\tuseHasAPossibleBulkAction,\n\tBulkSelectionCheckbox,\n} from '../../components/dataviews-bulk-actions';\nimport type {\n\tAction,\n\tNormalizedField,\n\tViewTable as ViewTableType,\n\tViewTableProps,\n\tCombinedField,\n} from '../../types';\nimport type { SetSelection } from '../../private-types';\nimport ColumnHeaderMenu from './column-header-menu';\nimport { getVisibleFieldIds } from '../index';\n\ninterface TableColumnFieldProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfield: NormalizedField< Item >;\n\titem: Item;\n}\n\ninterface TableColumnCombinedProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\tfield: CombinedField;\n\titem: Item;\n\tview: ViewTableType;\n}\n\ninterface TableColumnProps< Item > {\n\tprimaryField?: NormalizedField< Item >;\n\tfields: NormalizedField< Item >[];\n\titem: Item;\n\tcolumn: string;\n\tview: ViewTableType;\n}\n\ninterface TableRowProps< Item > {\n\thasBulkActions: boolean;\n\titem: Item;\n\tactions: Action< Item >[];\n\tfields: NormalizedField< Item >[];\n\tid: string;\n\tview: ViewTableType;\n\tprimaryField?: NormalizedField< Item >;\n\tselection: string[];\n\tgetItemId: ( item: Item ) => string;\n\tonChangeSelection: SetSelection;\n}\n\nfunction TableColumn< Item >( {\n\tcolumn,\n\tfields,\n\tview,\n\t...props\n}: TableColumnProps< Item > ) {\n\tconst field = fields.find( ( f ) => f.id === column );\n\tif ( !! field ) {\n\t\treturn <TableColumnField { ...props } field={ field } />;\n\t}\n\tconst combinedField = view.layout?.combinedFields?.find(\n\t\t( f ) => f.id === column\n\t);\n\tif ( !! combinedField ) {\n\t\treturn (\n\t\t\t<TableColumnCombined\n\t\t\t\t{ ...props }\n\t\t\t\tfields={ fields }\n\t\t\t\tview={ view }\n\t\t\t\tfield={ combinedField }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction TableColumnField< Item >( {\n\tprimaryField,\n\titem,\n\tfield,\n}: TableColumnFieldProps< Item > ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'dataviews-view-table__cell-content-wrapper', {\n\t\t\t\t'dataviews-view-table__primary-field':\n\t\t\t\t\tprimaryField?.id === field.id,\n\t\t\t} ) }\n\t\t>\n\t\t\t<field.render { ...{ item } } />\n\t\t</div>\n\t);\n}\n\nfunction TableColumnCombined< Item >( {\n\tfield,\n\t...props\n}: TableColumnCombinedProps< Item > ) {\n\tconst children = field.children.map( ( child ) => (\n\t\t<TableColumn key={ child } { ...props } column={ child } />\n\t) );\n\n\tif ( field.direction === 'horizontal' ) {\n\t\treturn <HStack spacing={ 3 }>{ children }</HStack>;\n\t}\n\treturn <VStack spacing={ 0 }>{ children }</VStack>;\n}\n\nfunction TableRow< Item >( {\n\thasBulkActions,\n\titem,\n\tactions,\n\tfields,\n\tid,\n\tview,\n\tprimaryField,\n\tselection,\n\tgetItemId,\n\tonChangeSelection,\n}: TableRowProps< Item > ) {\n\tconst hasPossibleBulkAction = useHasAPossibleBulkAction( actions, item );\n\tconst isSelected = hasPossibleBulkAction && selection.includes( id );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst handleMouseEnter = () => {\n\t\tsetIsHovered( true );\n\t};\n\tconst handleMouseLeave = () => {\n\t\tsetIsHovered( false );\n\t};\n\n\t// Will be set to true if `onTouchStart` fires. This happens before\n\t// `onClick` and can be used to exclude touchscreen devices from certain\n\t// behaviours.\n\tconst isTouchDeviceRef = useRef( false );\n\tconst columns = getVisibleFieldIds( view, fields );\n\n\treturn (\n\t\t<tr\n\t\t\tclassName={ clsx( 'dataviews-view-table__row', {\n\t\t\t\t'is-selected': hasPossibleBulkAction && isSelected,\n\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t'has-bulk-actions': hasPossibleBulkAction,\n\t\t\t} ) }\n\t\t\tonMouseEnter={ handleMouseEnter }\n\t\t\tonMouseLeave={ handleMouseLeave }\n\t\t\tonTouchStart={ () => {\n\t\t\t\tisTouchDeviceRef.current = true;\n\t\t\t} }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( ! hasPossibleBulkAction ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t! isTouchDeviceRef.current &&\n\t\t\t\t\tdocument.getSelection()?.type !== 'Range'\n\t\t\t\t) {\n\t\t\t\t\tonChangeSelection(\n\t\t\t\t\t\tselection.includes( id )\n\t\t\t\t\t\t\t? selection.filter( ( itemId ) => id !== itemId )\n\t\t\t\t\t\t\t: [ id ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ hasBulkActions && (\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"dataviews-view-table__cell-content-wrapper\">\n\t\t\t\t\t\t<SingleSelectionCheckbox\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tdisabled={ ! hasPossibleBulkAction }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t) }\n\t\t\t{ columns.map( ( column: string ) => {\n\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\n\t\t\t\treturn (\n\t\t\t\t\t<td key={ column } style={ { width, maxWidth, minWidth } }>\n\t\t\t\t\t\t<TableColumn\n\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tcolumn={ column }\n\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ !! actions?.length && (\n\t\t\t\t// Disable reason: we are not making the element interactive,\n\t\t\t\t// but preventing any click events from bubbling up to the\n\t\t\t\t// table row. This allows us to add a click handler to the row\n\t\t\t\t// itself (to toggle row selection) without erroneously\n\t\t\t\t// intercepting click events from ItemActions.\n\n\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t\t<td\n\t\t\t\t\tclassName=\"dataviews-view-table__actions-column\"\n\t\t\t\t\tonClick={ ( e ) => e.stopPropagation() }\n\t\t\t\t>\n\t\t\t\t\t<ItemActions item={ item } actions={ actions } />\n\t\t\t\t</td>\n\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t\t) }\n\t\t</tr>\n\t);\n}\n\nfunction ViewTable< Item >( {\n\tactions,\n\tdata,\n\tfields,\n\tgetItemId,\n\tisLoading = false,\n\tonChangeView,\n\tonChangeSelection,\n\tselection,\n\tsetOpenedFilter,\n\tview,\n}: ViewTableProps< Item > ) {\n\tconst headerMenuRefs = useRef<\n\t\tMap< string, { node: HTMLButtonElement; fallback: string } >\n\t>( new Map() );\n\tconst headerMenuToFocusRef = useRef< HTMLButtonElement >();\n\tconst [ nextHeaderMenuToFocus, setNextHeaderMenuToFocus ] =\n\t\tuseState< HTMLButtonElement >();\n\tconst hasBulkActions = useSomeItemHasAPossibleBulkAction( actions, data );\n\n\tuseEffect( () => {\n\t\tif ( headerMenuToFocusRef.current ) {\n\t\t\theaderMenuToFocusRef.current.focus();\n\t\t\theaderMenuToFocusRef.current = undefined;\n\t\t}\n\t} );\n\n\tconst tableNoticeId = useId();\n\n\tif ( nextHeaderMenuToFocus ) {\n\t\t// If we need to force focus, we short-circuit rendering here\n\t\t// to prevent any additional work while we handle that.\n\t\t// Clearing out the focus directive is necessary to make sure\n\t\t// future renders don't cause unexpected focus jumps.\n\t\theaderMenuToFocusRef.current = nextHeaderMenuToFocus;\n\t\tsetNextHeaderMenuToFocus( undefined );\n\t\treturn;\n\t}\n\n\tconst onHide = ( field: NormalizedField< Item > ) => {\n\t\tconst hidden = headerMenuRefs.current.get( field.id );\n\t\tconst fallback = hidden\n\t\t\t? headerMenuRefs.current.get( hidden.fallback )\n\t\t\t: undefined;\n\t\tsetNextHeaderMenuToFocus( fallback?.node );\n\t};\n\n\tconst columns = getVisibleFieldIds( view, fields );\n\tconst hasData = !! data?.length;\n\n\tconst primaryField = fields.find(\n\t\t( field ) => field.id === view.layout?.primaryField\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<table\n\t\t\t\tclassName=\"dataviews-view-table\"\n\t\t\t\taria-busy={ isLoading }\n\t\t\t\taria-describedby={ tableNoticeId }\n\t\t\t>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"dataviews-view-table__row\">\n\t\t\t\t\t\t{ hasBulkActions && (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName=\"dataviews-view-table__checkbox-column\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\twidth: '1%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BulkSelectionCheckbox\n\t\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ columns.map( ( column, index ) => {\n\t\t\t\t\t\t\t// Explicits picks the supported styles.\n\t\t\t\t\t\t\tconst { width, maxWidth, minWidth } =\n\t\t\t\t\t\t\t\tview.layout?.styles?.[ column ] ?? {};\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={ column }\n\t\t\t\t\t\t\t\t\tstyle={ { width, maxWidth, minWidth } }\n\t\t\t\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t\t\t\tview.sort?.field === column\n\t\t\t\t\t\t\t\t\t\t\t? sortValues[ view.sort.direction ]\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ColumnHeaderMenu\n\t\t\t\t\t\t\t\t\t\tref={ ( node ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( node ) {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.set(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfallback:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolumns[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex > 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? index - 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\theaderMenuRefs.current.delete(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolumn\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tfieldId={ column }\n\t\t\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t\t\t\tonHide={ onHide }\n\t\t\t\t\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t{ !! actions?.length && (\n\t\t\t\t\t\t\t<th className=\"dataviews-view-table__actions-column\">\n\t\t\t\t\t\t\t\t<span className=\"dataviews-view-table-header\">\n\t\t\t\t\t\t\t\t\t{ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{ hasData &&\n\t\t\t\t\t\tdata.map( ( item, index ) => (\n\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\tkey={ getItemId( item ) }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\thasBulkActions={ hasBulkActions }\n\t\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\tid={ getItemId( item ) || index.toString() }\n\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\tprimaryField={ primaryField }\n\t\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t'dataviews-loading': isLoading,\n\t\t\t\t\t'dataviews-no-results': ! hasData && ! isLoading,\n\t\t\t\t} ) }\n\t\t\t\tid={ tableNoticeId }\n\t\t\t>\n\t\t\t\t{ ! hasData && (\n\t\t\t\t\t<p>{ isLoading ? <Spinner /> : __( 'No results' ) }</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ViewTable;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,OAAO,EACPC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,+CAA+C;AACnF,OAAOC,WAAW,MAAM,yCAAyC;AACjE,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SACCC,iCAAiC,EACjCC,yBAAyB,EACzBC,qBAAqB,QACf,yCAAyC;AAShD,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAA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Content":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\ninterface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type FieldType = 'text' | 'integer' | 'datetime';\n\nexport type ValidationContext = {\n\telements?: Option[];\n};\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< { item: Item } >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\theader?: string | ReactElement;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\nexport interface CombinedFormField< Item > extends CombinedField {\n\trender?: ComponentType< { item: Item } >;\n}\n\nexport interface DataFormCombinedEditProps< Item > {\n\tfield: NormalizedCombinedFormField< Item >;\n\tdata: Item;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n}\n\nexport type NormalizedCombinedFormField< Item > = CombinedFormField< Item > & {\n\tfields: NormalizedField< Item >[];\n\tEdit?: ComponentType< DataFormCombinedEditProps< Item > >;\n};\n\n/**\n * The form configuration.\n */\nexport type Form< Item > = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n\t/**\n\t * The fields to combine.\n\t */\n\tcombinedFields?: CombinedFormField< Item >[];\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\ninterface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type FieldType = 'text' | 'integer' | 'datetime';\n\nexport type ValidationContext = {\n\telements?: Option[];\n};\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\theader?: string | ReactElement;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\nexport interface CombinedFormField< Item > extends CombinedField {\n\trender?: ComponentType< { item: Item } >;\n}\n\nexport interface DataFormCombinedEditProps< Item > {\n\tfield: NormalizedCombinedFormField< Item >;\n\tdata: Item;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n}\n\nexport type NormalizedCombinedFormField< Item > = CombinedFormField< Item > & {\n\tfields: NormalizedField< Item >[];\n\tEdit?: ComponentType< DataFormCombinedEditProps< Item > >;\n};\n\n/**\n * The form configuration.\n */\nexport type Form< Item > = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n\t/**\n\t * The fields to combine.\n\t */\n\tcombinedFields?: CombinedFormField< Item >[];\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -826,44 +826,31 @@ ul.dataviews-view-list {
|
|
|
826
826
|
}
|
|
827
827
|
.dataviews-view-list li {
|
|
828
828
|
margin: 0;
|
|
829
|
-
cursor: pointer;
|
|
830
829
|
border-top: 1px solid #f0f0f0;
|
|
831
830
|
}
|
|
832
831
|
.dataviews-view-list li .dataviews-view-list__item-wrapper {
|
|
833
832
|
position: relative;
|
|
834
|
-
|
|
835
|
-
}
|
|
836
|
-
.dataviews-view-list li .dataviews-view-list__item-wrapper > * {
|
|
837
|
-
width: 100%;
|
|
833
|
+
padding: 16px 24px;
|
|
838
834
|
}
|
|
839
835
|
.dataviews-view-list li .dataviews-view-list__item-actions {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
left: 0;
|
|
836
|
+
flex: 0;
|
|
837
|
+
overflow: hidden;
|
|
843
838
|
}
|
|
844
839
|
.dataviews-view-list li .dataviews-view-list__item-actions > div {
|
|
845
840
|
height: 24px;
|
|
846
841
|
}
|
|
847
842
|
.dataviews-view-list li .dataviews-view-list__item-actions .components-button {
|
|
843
|
+
position: relative;
|
|
844
|
+
z-index: 1;
|
|
848
845
|
opacity: 0;
|
|
849
846
|
}
|
|
850
|
-
.dataviews-view-list li:
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
.dataviews-view-list li.is-selected .dataviews-view-list__item-actions, .dataviews-view-list li.is-hovered .dataviews-view-list__item-actions, .dataviews-view-list li:focus-within .dataviews-view-list__item-actions {
|
|
855
|
-
background: #f8f8f8;
|
|
856
|
-
padding-right: 8px;
|
|
857
|
-
margin-left: 24px;
|
|
858
|
-
box-shadow: 12px 0 8px 0 #f8f8f8;
|
|
847
|
+
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions {
|
|
848
|
+
flex-basis: min-content;
|
|
849
|
+
overflow: unset;
|
|
850
|
+
padding-inline-end: 4px;
|
|
859
851
|
}
|
|
860
|
-
.dataviews-view-list li.is-selected
|
|
852
|
+
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions .components-button {
|
|
861
853
|
opacity: 1;
|
|
862
|
-
position: static;
|
|
863
|
-
}
|
|
864
|
-
.dataviews-view-list li.is-selected .dataviews-view-list__item-actions {
|
|
865
|
-
background-color: #f7f8ff;
|
|
866
|
-
box-shadow: 12px 0 8px 0 #f7f8ff;
|
|
867
854
|
}
|
|
868
855
|
.dataviews-view-list li.is-selected.is-selected {
|
|
869
856
|
border-top: 1px solid rgba(var(--wp-admin-theme-color--rgb), 0.12);
|
|
@@ -896,26 +883,36 @@ ul.dataviews-view-list {
|
|
|
896
883
|
color: var(--wp-admin-theme-color);
|
|
897
884
|
}
|
|
898
885
|
.dataviews-view-list .dataviews-view-list__item {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
886
|
+
position: absolute;
|
|
887
|
+
z-index: 1;
|
|
888
|
+
inset: 0;
|
|
902
889
|
scroll-margin: 8px 0;
|
|
890
|
+
appearance: none;
|
|
891
|
+
border: none;
|
|
892
|
+
background: none;
|
|
893
|
+
padding: 0;
|
|
894
|
+
cursor: pointer;
|
|
895
|
+
}
|
|
896
|
+
.dataviews-view-list .dataviews-view-list__item:focus-visible {
|
|
897
|
+
outline: none;
|
|
903
898
|
}
|
|
904
899
|
.dataviews-view-list .dataviews-view-list__item:focus-visible::before {
|
|
905
900
|
position: absolute;
|
|
906
901
|
content: "";
|
|
907
|
-
|
|
908
|
-
left: var(--wp-admin-border-width-focus);
|
|
909
|
-
bottom: var(--wp-admin-border-width-focus);
|
|
910
|
-
right: var(--wp-admin-border-width-focus);
|
|
902
|
+
inset: var(--wp-admin-border-width-focus);
|
|
911
903
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
912
904
|
border-radius: 2px;
|
|
905
|
+
outline: 2px solid transparent;
|
|
913
906
|
}
|
|
914
|
-
.dataviews-view-list .dataviews-view-
|
|
907
|
+
.dataviews-view-list .dataviews-view-list__primary-field {
|
|
908
|
+
flex: 1;
|
|
915
909
|
min-height: 24px;
|
|
916
910
|
line-height: 24px;
|
|
917
911
|
overflow: hidden;
|
|
918
912
|
}
|
|
913
|
+
.dataviews-view-list .dataviews-view-list__primary-field:has(a, button) {
|
|
914
|
+
z-index: 1;
|
|
915
|
+
}
|
|
919
916
|
.dataviews-view-list .dataviews-view-list__media-wrapper {
|
|
920
917
|
width: 52px;
|
|
921
918
|
height: 52px;
|
|
@@ -940,13 +937,9 @@ ul.dataviews-view-list {
|
|
|
940
937
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
941
938
|
border-radius: 4px;
|
|
942
939
|
}
|
|
943
|
-
.dataviews-view-list .dataviews-view-list__media-placeholder {
|
|
944
|
-
width: 52px;
|
|
945
|
-
height: 52px;
|
|
946
|
-
background-color: #e0e0e0;
|
|
947
|
-
}
|
|
948
940
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
949
941
|
min-height: 52px;
|
|
942
|
+
flex-grow: 1;
|
|
950
943
|
}
|
|
951
944
|
.dataviews-view-list .dataviews-view-list__fields {
|
|
952
945
|
color: #757575;
|
|
@@ -1154,8 +1147,7 @@ ul.dataviews-view-list {
|
|
|
1154
1147
|
align-items: center;
|
|
1155
1148
|
padding: 6px 0;
|
|
1156
1149
|
line-height: 20px;
|
|
1157
|
-
|
|
1158
|
-
hyphens: auto;
|
|
1150
|
+
hyphens: auto;
|
|
1159
1151
|
}
|
|
1160
1152
|
|
|
1161
1153
|
.dataforms-layouts-panel__field-control {
|
package/build-style/style.css
CHANGED
|
@@ -826,44 +826,31 @@ ul.dataviews-view-list {
|
|
|
826
826
|
}
|
|
827
827
|
.dataviews-view-list li {
|
|
828
828
|
margin: 0;
|
|
829
|
-
cursor: pointer;
|
|
830
829
|
border-top: 1px solid #f0f0f0;
|
|
831
830
|
}
|
|
832
831
|
.dataviews-view-list li .dataviews-view-list__item-wrapper {
|
|
833
832
|
position: relative;
|
|
834
|
-
|
|
835
|
-
}
|
|
836
|
-
.dataviews-view-list li .dataviews-view-list__item-wrapper > * {
|
|
837
|
-
width: 100%;
|
|
833
|
+
padding: 16px 24px;
|
|
838
834
|
}
|
|
839
835
|
.dataviews-view-list li .dataviews-view-list__item-actions {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
right: 0;
|
|
836
|
+
flex: 0;
|
|
837
|
+
overflow: hidden;
|
|
843
838
|
}
|
|
844
839
|
.dataviews-view-list li .dataviews-view-list__item-actions > div {
|
|
845
840
|
height: 24px;
|
|
846
841
|
}
|
|
847
842
|
.dataviews-view-list li .dataviews-view-list__item-actions .components-button {
|
|
843
|
+
position: relative;
|
|
844
|
+
z-index: 1;
|
|
848
845
|
opacity: 0;
|
|
849
846
|
}
|
|
850
|
-
.dataviews-view-list li:
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
.dataviews-view-list li.is-selected .dataviews-view-list__item-actions, .dataviews-view-list li.is-hovered .dataviews-view-list__item-actions, .dataviews-view-list li:focus-within .dataviews-view-list__item-actions {
|
|
855
|
-
background: #f8f8f8;
|
|
856
|
-
padding-left: 8px;
|
|
857
|
-
margin-right: 24px;
|
|
858
|
-
box-shadow: -12px 0 8px 0 #f8f8f8;
|
|
847
|
+
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions {
|
|
848
|
+
flex-basis: min-content;
|
|
849
|
+
overflow: unset;
|
|
850
|
+
padding-inline-end: 4px;
|
|
859
851
|
}
|
|
860
|
-
.dataviews-view-list li.is-selected
|
|
852
|
+
.dataviews-view-list li:where(.is-selected, .is-hovered, :focus-within) .dataviews-view-list__item-actions .components-button {
|
|
861
853
|
opacity: 1;
|
|
862
|
-
position: static;
|
|
863
|
-
}
|
|
864
|
-
.dataviews-view-list li.is-selected .dataviews-view-list__item-actions {
|
|
865
|
-
background-color: #f7f8ff;
|
|
866
|
-
box-shadow: -12px 0 8px 0 #f7f8ff;
|
|
867
854
|
}
|
|
868
855
|
.dataviews-view-list li.is-selected.is-selected {
|
|
869
856
|
border-top: 1px solid rgba(var(--wp-admin-theme-color--rgb), 0.12);
|
|
@@ -896,26 +883,36 @@ ul.dataviews-view-list {
|
|
|
896
883
|
color: var(--wp-admin-theme-color);
|
|
897
884
|
}
|
|
898
885
|
.dataviews-view-list .dataviews-view-list__item {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
886
|
+
position: absolute;
|
|
887
|
+
z-index: 1;
|
|
888
|
+
inset: 0;
|
|
902
889
|
scroll-margin: 8px 0;
|
|
890
|
+
appearance: none;
|
|
891
|
+
border: none;
|
|
892
|
+
background: none;
|
|
893
|
+
padding: 0;
|
|
894
|
+
cursor: pointer;
|
|
895
|
+
}
|
|
896
|
+
.dataviews-view-list .dataviews-view-list__item:focus-visible {
|
|
897
|
+
outline: none;
|
|
903
898
|
}
|
|
904
899
|
.dataviews-view-list .dataviews-view-list__item:focus-visible::before {
|
|
905
900
|
position: absolute;
|
|
906
901
|
content: "";
|
|
907
|
-
|
|
908
|
-
right: var(--wp-admin-border-width-focus);
|
|
909
|
-
bottom: var(--wp-admin-border-width-focus);
|
|
910
|
-
left: var(--wp-admin-border-width-focus);
|
|
902
|
+
inset: var(--wp-admin-border-width-focus);
|
|
911
903
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
912
904
|
border-radius: 2px;
|
|
905
|
+
outline: 2px solid transparent;
|
|
913
906
|
}
|
|
914
|
-
.dataviews-view-list .dataviews-view-
|
|
907
|
+
.dataviews-view-list .dataviews-view-list__primary-field {
|
|
908
|
+
flex: 1;
|
|
915
909
|
min-height: 24px;
|
|
916
910
|
line-height: 24px;
|
|
917
911
|
overflow: hidden;
|
|
918
912
|
}
|
|
913
|
+
.dataviews-view-list .dataviews-view-list__primary-field:has(a, button) {
|
|
914
|
+
z-index: 1;
|
|
915
|
+
}
|
|
919
916
|
.dataviews-view-list .dataviews-view-list__media-wrapper {
|
|
920
917
|
width: 52px;
|
|
921
918
|
height: 52px;
|
|
@@ -940,13 +937,9 @@ ul.dataviews-view-list {
|
|
|
940
937
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
941
938
|
border-radius: 4px;
|
|
942
939
|
}
|
|
943
|
-
.dataviews-view-list .dataviews-view-list__media-placeholder {
|
|
944
|
-
width: 52px;
|
|
945
|
-
height: 52px;
|
|
946
|
-
background-color: #e0e0e0;
|
|
947
|
-
}
|
|
948
940
|
.dataviews-view-list .dataviews-view-list__field-wrapper {
|
|
949
941
|
min-height: 52px;
|
|
942
|
+
flex-grow: 1;
|
|
950
943
|
}
|
|
951
944
|
.dataviews-view-list .dataviews-view-list__fields {
|
|
952
945
|
color: #757575;
|
|
@@ -1154,8 +1147,7 @@ ul.dataviews-view-list {
|
|
|
1154
1147
|
align-items: center;
|
|
1155
1148
|
padding: 6px 0;
|
|
1156
1149
|
line-height: 20px;
|
|
1157
|
-
|
|
1158
|
-
hyphens: auto;
|
|
1150
|
+
hyphens: auto;
|
|
1159
1151
|
}
|
|
1160
1152
|
|
|
1161
1153
|
.dataforms-layouts-panel__field-control {
|