@wordpress/dataviews 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE.md +788 -0
  3. package/README.md +224 -0
  4. package/build/add-filter.js +90 -0
  5. package/build/add-filter.js.map +1 -0
  6. package/build/constants.js +55 -0
  7. package/build/constants.js.map +1 -0
  8. package/build/dataviews.js +93 -0
  9. package/build/dataviews.js.map +1 -0
  10. package/build/filter-summary.js +137 -0
  11. package/build/filter-summary.js.map +1 -0
  12. package/build/filters.js +75 -0
  13. package/build/filters.js.map +1 -0
  14. package/build/index.js +21 -0
  15. package/build/index.js.map +1 -0
  16. package/build/item-actions.js +185 -0
  17. package/build/item-actions.js.map +1 -0
  18. package/build/lock-unlock.js +18 -0
  19. package/build/lock-unlock.js.map +1 -0
  20. package/build/pagination.js +123 -0
  21. package/build/pagination.js.map +1 -0
  22. package/build/reset-filters.js +33 -0
  23. package/build/reset-filters.js.map +1 -0
  24. package/build/search.js +46 -0
  25. package/build/search.js.map +1 -0
  26. package/build/view-actions.js +223 -0
  27. package/build/view-actions.js.map +1 -0
  28. package/build/view-grid.js +80 -0
  29. package/build/view-grid.js.map +1 -0
  30. package/build/view-list.js +83 -0
  31. package/build/view-list.js.map +1 -0
  32. package/build/view-table.js +286 -0
  33. package/build/view-table.js.map +1 -0
  34. package/build-module/add-filter.js +83 -0
  35. package/build-module/add-filter.js.map +1 -0
  36. package/build-module/constants.js +41 -0
  37. package/build-module/constants.js.map +1 -0
  38. package/build-module/dataviews.js +85 -0
  39. package/build-module/dataviews.js.map +1 -0
  40. package/build-module/filter-summary.js +130 -0
  41. package/build-module/filter-summary.js.map +1 -0
  42. package/build-module/filters.js +67 -0
  43. package/build-module/filters.js.map +1 -0
  44. package/build-module/index.js +3 -0
  45. package/build-module/index.js.map +1 -0
  46. package/build-module/item-actions.js +178 -0
  47. package/build-module/item-actions.js.map +1 -0
  48. package/build-module/lock-unlock.js +9 -0
  49. package/build-module/lock-unlock.js.map +1 -0
  50. package/build-module/pagination.js +115 -0
  51. package/build-module/pagination.js.map +1 -0
  52. package/build-module/reset-filters.js +26 -0
  53. package/build-module/reset-filters.js.map +1 -0
  54. package/build-module/search.js +39 -0
  55. package/build-module/search.js.map +1 -0
  56. package/build-module/view-actions.js +216 -0
  57. package/build-module/view-actions.js.map +1 -0
  58. package/build-module/view-grid.js +72 -0
  59. package/build-module/view-grid.js.map +1 -0
  60. package/build-module/view-list.js +75 -0
  61. package/build-module/view-list.js.map +1 -0
  62. package/build-module/view-table.js +277 -0
  63. package/build-module/view-table.js.map +1 -0
  64. package/build-style/style-rtl.css +325 -0
  65. package/build-style/style.css +325 -0
  66. package/package.json +49 -0
  67. package/src/add-filter.js +106 -0
  68. package/src/constants.js +50 -0
  69. package/src/dataviews.js +99 -0
  70. package/src/filter-summary.js +221 -0
  71. package/src/filters.js +84 -0
  72. package/src/index.js +2 -0
  73. package/src/item-actions.js +211 -0
  74. package/src/lock-unlock.js +10 -0
  75. package/src/pagination.js +144 -0
  76. package/src/reset-filters.js +26 -0
  77. package/src/search.js +38 -0
  78. package/src/stories/fixtures.js +126 -0
  79. package/src/stories/index.story.js +137 -0
  80. package/src/style.scss +245 -0
  81. package/src/view-actions.js +298 -0
  82. package/src/view-grid.js +100 -0
  83. package/src/view-list.js +99 -0
  84. package/src/view-table.js +425 -0
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # DataViews
2
+
3
+ DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).
4
+
5
+ ## Installation
6
+
7
+ Install the module
8
+
9
+ ```bash
10
+ npm install @wordpress/dataviews --save
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ <DataViews
17
+ data={ pages }
18
+ getItemId={ ( item ) => item.id }
19
+ isLoading={ isLoadingPages }
20
+ view={ view }
21
+ onChangeView={ onChangeView }
22
+ fields={ fields }
23
+ actions={ [ trashPostAction ] }
24
+ paginationInfo={ { totalItems, totalPages } }
25
+ onSelectionChange={ ( items ) => { /* ... */ } }
26
+ />
27
+ ```
28
+
29
+ ## Data
30
+
31
+ The dataset to work with, represented as a one-dimensional array.
32
+
33
+ Example:
34
+
35
+ ```js
36
+ [
37
+ { id: 1, title: "Title", ... },
38
+ { ... }
39
+ ]
40
+ ```
41
+
42
+ ## View
43
+
44
+ The view object configures how the dataset is visible to the user.
45
+
46
+ Example:
47
+
48
+ ```js
49
+ {
50
+ type: 'table',
51
+ perPage: 5,
52
+ page: 1,
53
+ sort: {
54
+ field: 'date',
55
+ direction: 'desc',
56
+ },
57
+ search: '',
58
+ filters: [
59
+ { field: 'author', operator: 'in', value: 2 },
60
+ { field: 'status', operator: 'in', value: 'publish,draft' }
61
+ ],
62
+ hiddenFields: [ 'date', 'featured-image' ],
63
+ layout: {},
64
+ }
65
+ ```
66
+
67
+ - `type`: view type, one of `table`, `grid`, `list`. See "View types".
68
+ - `perPage`: number of records to show per page.
69
+ - `page`: the page that is visible.
70
+ - `sort.field`: field used for sorting the dataset.
71
+ - `sort.direction`: the direction to use for sorting, one of `asc` or `desc`.
72
+ - `search`: the text search applied to the dataset.
73
+ - `filters`: the filters applied to the dataset. Each item describes:
74
+ - `field`: which field this filter is bound to.
75
+ - `operator`: which type of filter it is. One of `in`, `notIn`. See "Operator types".
76
+ - `value`: the actual value selected by the user.
77
+ - `hiddenFields`: the `id` of the fields that are hidden in the UI.
78
+ - `layout`: config that is specific to a particular layout type.
79
+ - `mediaField`: used by the `grid` and `list` layouts. The `id` of the field to be used for rendering each card's media.
80
+ - `primaryField`: used by the `grid` and `list` layouts. The `id` of the field to be highlighted in each card/list item.
81
+
82
+ ### View <=> data
83
+
84
+ The view is a representation of the visible state of the dataset. Note, however, that it's the consumer's responsibility to work with the data provider to make sure the user options defined through the view's config (sort, pagination, filters, etc.) are respected.
85
+
86
+ The following example shows how a view object is used to query the WordPress REST API via the entities abstraction. The same can be done with any other data provider.
87
+
88
+ ```js
89
+ function MyCustomPageTable() {
90
+ const [ view, setView ] = useState( {
91
+ type: 'table',
92
+ perPage: 5,
93
+ page: 1,
94
+ sort: {
95
+ field: 'date',
96
+ direction: 'desc',
97
+ },
98
+ search: '',
99
+ filters: [
100
+ { field: 'author', operator: 'in', value: 2 },
101
+ { field: 'status', operator: 'in', value: 'publish,draft' }
102
+ ],
103
+ hiddenFields: [ 'date', 'featured-image' ],
104
+ layout: {},
105
+ } );
106
+
107
+ const queryArgs = useMemo( () => {
108
+ const filters = {};
109
+ view.filters.forEach( ( filter ) => {
110
+ if ( filter.field === 'status' && filter.operator === 'in' ) {
111
+ filters.status = filter.value;
112
+ }
113
+ if ( filter.field === 'author' && filter.operator === 'in' ) {
114
+ filters.author = filter.value;
115
+ }
116
+ } );
117
+ return {
118
+ per_page: view.perPage,
119
+ page: view.page,
120
+ _embed: 'author',
121
+ order: view.sort?.direction,
122
+ orderby: view.sort?.field,
123
+ search: view.search,
124
+ ...filters,
125
+ };
126
+ }, [ view ] );
127
+
128
+ const {
129
+ records
130
+ } = useEntityRecords( 'postType', 'page', queryArgs );
131
+
132
+ return (
133
+ <DataViews
134
+ data={ records }
135
+ view={ view }
136
+ onChangeView={ setView }
137
+ "..."
138
+ />
139
+ );
140
+ }
141
+ ```
142
+
143
+ ## Fields
144
+
145
+ The fields describe the visible items for each record in the dataset.
146
+
147
+ Example:
148
+
149
+ ```js
150
+ [
151
+ {
152
+ id: 'date',
153
+ header: __( 'Date' ),
154
+ getValue: ( { item } ) => item.date,
155
+ render: ( { item } ) => {
156
+ return (
157
+ <time>{ getFormattedDate( item.date ) }</time>
158
+ );
159
+ },
160
+ enableHiding: false
161
+ },
162
+ {
163
+ id: 'author',
164
+ header: __( 'Author' ),
165
+ getValue: ( { item } ) => item.author,
166
+ render: ( { item } ) => {
167
+ return (
168
+ <a href="...">{ item.author }</a>
169
+ );
170
+ },
171
+ type: 'enumeration',
172
+ elements: [
173
+ { value: 1, label: 'Admin' }
174
+ { value: 2, label: 'User' }
175
+ ]
176
+ enableSorting: false
177
+ }
178
+ ]
179
+ ```
180
+
181
+ - `id`: identifier for the field. Unique.
182
+ - `header`: the field's name to be shown in the UI.
183
+ - `getValue`: function that returns the value of the field.
184
+ - `render`: function that renders the field.
185
+ - `elements`: the set of valid values for the field's value.
186
+ - `type`: the type of the field. Used to generate the proper filters. Only `enumeration` available at the moment. See "Field types".
187
+ - `enableSorting`: whether the data can be sorted by the given field. True by default.
188
+ - `enableHiding`: whether the field can be hidden. True by default.
189
+ - `filterBy`: configuration for the filters.
190
+ - `operators`: the list of operators supported by the field.
191
+
192
+ ## Actions
193
+
194
+ Array of operations that can be performed upon each record. Each action is an object with the following properties:
195
+
196
+ - `id`: string, required. Unique identifier of the action. For example, `move-to-trash`.
197
+ - `label`: string, required. User facing description of the action. For example, `Move to Trash`.
198
+ - `isPrimary`: boolean, optional. Whether the action should be listed inline (primary) or in hidden in the more actions menu (secondary).
199
+ - `icon`: icon to show for primary actions. It's required for a primary action, otherwise the action would be considered secondary.
200
+ - `isEligible`: function, optional. Whether the action can be performed for a given record. If not present, the action is considered to be eligible for all items. It takes the given record as input.
201
+ - `isDestructive`: boolean, optional. Whether the action can delete data, in which case the UI would communicate it via red color.
202
+ - `callback`: function, required unless `RenderModal` is provided. Callback function that takes the record as input and performs the required action.
203
+ - `RenderModal`: ReactElement, optional. If an action requires that some UI be rendered in a modal, it can provide a component which takes as props the record as `item` and a `closeModal` function. When this prop is provided, the `callback` property is ignored.
204
+ - `hideModalHeader`: boolean, optional. This property is used in combination with `RenderModal` and controls the visibility of the modal's header. If the action renders a modal and doesn't hide the header, the action's label is going to be used in the modal's header.
205
+
206
+ ## Types
207
+
208
+ - Layout types:
209
+ - `table`: the view uses a table layout.
210
+ - `grid`: the view uses a grid layout.
211
+ - `list`: the view uses a list layout.
212
+ - Field types:
213
+ - `enumeration`: the field value should be taken and can be filtered from a closed list of elements.
214
+ - Operator types:
215
+ - `in`: operator to be used in filters for fields of type `enumeration`.
216
+ - `notIn`: operator to be used in filters for fields of type `enumeration`.
217
+
218
+ ## Contributing to this package
219
+
220
+ This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
221
+
222
+ To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
223
+
224
+ <br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = AddFilter;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ var _icons = require("@wordpress/icons");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _lockUnlock = require("./lock-unlock");
12
+ var _constants = require("./constants");
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ const {
22
+ DropdownMenuV2: DropdownMenu,
23
+ DropdownSubMenuV2: DropdownSubMenu,
24
+ DropdownSubMenuTriggerV2: DropdownSubMenuTrigger,
25
+ DropdownMenuItemV2: DropdownMenuItem
26
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
27
+ function AddFilter({
28
+ fields,
29
+ view,
30
+ onChangeView
31
+ }) {
32
+ const filters = [];
33
+ fields.forEach(field => {
34
+ if (!field.type) {
35
+ return;
36
+ }
37
+ switch (field.type) {
38
+ case _constants.ENUMERATION_TYPE:
39
+ filters.push({
40
+ field: field.id,
41
+ name: field.header,
42
+ elements: field.elements || [],
43
+ isVisible: view.filters.some(f => f.field === field.id)
44
+ });
45
+ }
46
+ });
47
+ if (filters.length === 0) {
48
+ return null;
49
+ }
50
+ return (0, _react.createElement)(DropdownMenu, {
51
+ label: (0, _i18n.__)('Add filter'),
52
+ trigger: (0, _react.createElement)(_components.Button, {
53
+ disabled: filters.length === view.filters?.length,
54
+ __experimentalIsFocusable: true,
55
+ variant: "tertiary",
56
+ size: "compact"
57
+ }, (0, _react.createElement)(_components.Icon, {
58
+ icon: _icons.plus,
59
+ style: {
60
+ flexShrink: 0
61
+ }
62
+ }), (0, _i18n.__)('Add filter'))
63
+ }, filters.map(filter => {
64
+ if (filter.isVisible) {
65
+ return null;
66
+ }
67
+ return (0, _react.createElement)(DropdownSubMenu, {
68
+ key: filter.field,
69
+ trigger: (0, _react.createElement)(DropdownSubMenuTrigger, {
70
+ suffix: (0, _react.createElement)(_components.Icon, {
71
+ icon: _icons.chevronRightSmall
72
+ })
73
+ }, filter.name)
74
+ }, filter.elements.map(element => (0, _react.createElement)(DropdownMenuItem, {
75
+ key: element.value,
76
+ onSelect: () => {
77
+ onChangeView(currentView => ({
78
+ ...currentView,
79
+ page: 1,
80
+ filters: [...currentView.filters, {
81
+ field: filter.field,
82
+ operator: _constants.OPERATOR_IN,
83
+ value: element.value
84
+ }]
85
+ }));
86
+ }
87
+ }, element.label)));
88
+ }));
89
+ }
90
+ //# sourceMappingURL=add-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_icons","_i18n","_lockUnlock","_constants","DropdownMenuV2","DropdownMenu","DropdownSubMenuV2","DropdownSubMenu","DropdownSubMenuTriggerV2","DropdownSubMenuTrigger","DropdownMenuItemV2","DropdownMenuItem","unlock","componentsPrivateApis","AddFilter","fields","view","onChangeView","filters","forEach","field","type","ENUMERATION_TYPE","push","id","name","header","elements","isVisible","some","f","length","_react","createElement","label","__","trigger","Button","disabled","__experimentalIsFocusable","variant","size","Icon","icon","plus","style","flexShrink","map","filter","key","suffix","chevronRightSmall","element","value","onSelect","currentView","page","operator","OPERATOR_IN"],"sources":["@wordpress/dataviews/src/add-filter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tIcon,\n} from '@wordpress/components';\nimport { chevronRightSmall, plus } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nimport { ENUMERATION_TYPE, OPERATOR_IN } from './constants';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownSubMenuV2: DropdownSubMenu,\n\tDropdownSubMenuTriggerV2: DropdownSubMenuTrigger,\n\tDropdownMenuItemV2: DropdownMenuItem,\n} = unlock( componentsPrivateApis );\n\nexport default function AddFilter( { fields, view, onChangeView } ) {\n\tconst filters = [];\n\tfields.forEach( ( field ) => {\n\t\tif ( ! field.type ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( field.type ) {\n\t\t\tcase ENUMERATION_TYPE:\n\t\t\t\tfilters.push( {\n\t\t\t\t\tfield: field.id,\n\t\t\t\t\tname: field.header,\n\t\t\t\t\telements: field.elements || [],\n\t\t\t\t\tisVisible: view.filters.some(\n\t\t\t\t\t\t( f ) => f.field === field.id\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t}\n\t} );\n\n\tif ( filters.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tlabel={ __( 'Add filter' ) }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tdisabled={ filters.length === view.filters?.length }\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ plus } style={ { flexShrink: 0 } } />\n\t\t\t\t\t{ __( 'Add filter' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t>\n\t\t\t{ filters.map( ( filter ) => {\n\t\t\t\tif ( filter.isVisible ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownSubMenu\n\t\t\t\t\t\tkey={ filter.field }\n\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t<DropdownSubMenuTrigger\n\t\t\t\t\t\t\t\tsuffix={ <Icon icon={ chevronRightSmall } /> }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ filter.name }\n\t\t\t\t\t\t\t</DropdownSubMenuTrigger>\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ filter.elements.map( ( element ) => (\n\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\tkey={ element.value }\n\t\t\t\t\t\t\t\tonSelect={ () => {\n\t\t\t\t\t\t\t\t\tonChangeView( ( currentView ) => ( {\n\t\t\t\t\t\t\t\t\t\t...currentView,\n\t\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t\t...currentView.filters,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\t\t\toperator: OPERATOR_IN,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: element.value,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t} ) );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ element.label }\n\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownSubMenu>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIA,MA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C,KAAK,EAAG;QAAEC,UAAU,EAAE;MAAE;IAAG,CAAE,CAAC,EAChD,IAAAX,QAAE,EAAE,YAAa,CACZ;EACR,GAECjB,OAAO,CAAC6B,GAAG,CAAIC,MAAM,IAAM;IAC5B,IAAKA,MAAM,CAACpB,SAAS,EAAG;MACvB,OAAO,IAAI;IACZ;IAEA,OACC,IAAAI,MAAA,CAAAC,aAAA,EAAC1B,eAAe;MACf0C,GAAG,EAAGD,MAAM,CAAC5B,KAAO;MACpBgB,OAAO,EACN,IAAAJ,MAAA,CAAAC,aAAA,EAACxB,sBAAsB;QACtByC,MAAM,EAAG,IAAAlB,MAAA,CAAAC,aAAA,EAACnC,WAAA,CAAA4C,IAAI;UAACC,IAAI,EAAGQ;QAAmB,CAAE;MAAG,GAE5CH,MAAM,CAACvB,IACc;IACxB,GAECuB,MAAM,CAACrB,QAAQ,CAACoB,GAAG,CAAIK,OAAO,IAC/B,IAAApB,MAAA,CAAAC,aAAA,EAACtB,gBAAgB;MAChBsC,GAAG,EAAGG,OAAO,CAACC,KAAO;MACrBC,QAAQ,EAAGA,CAAA,KAAM;QAChBrC,YAAY,CAAIsC,WAAW,KAAQ;UAClC,GAAGA,WAAW;UACdC,IAAI,EAAE,CAAC;UACPtC,OAAO,EAAE,CACR,GAAGqC,WAAW,CAACrC,OAAO,EACtB;YACCE,KAAK,EAAE4B,MAAM,CAAC5B,KAAK;YACnBqC,QAAQ,EAAEC,sBAAW;YACrBL,KAAK,EAAED,OAAO,CAACC;UAChB,CAAC;QAEH,CAAC,CAAG,CAAC;MACN;IAAG,GAEDD,OAAO,CAAClB,KACO,CACjB,CACc,CAAC;EAEpB,CAAE,CACW,CAAC;AAEjB"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.VIEW_LAYOUTS = exports.OPERATOR_NOT_IN = exports.OPERATOR_IN = exports.LAYOUT_TABLE = exports.LAYOUT_LIST = exports.LAYOUT_GRID = exports.ENUMERATION_TYPE = void 0;
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _icons = require("@wordpress/icons");
10
+ var _viewTable = _interopRequireDefault(require("./view-table"));
11
+ var _viewGrid = _interopRequireDefault(require("./view-grid"));
12
+ var _viewList = _interopRequireDefault(require("./view-list"));
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ // Field types.
22
+ const ENUMERATION_TYPE = 'enumeration';
23
+
24
+ // Filter operators.
25
+ exports.ENUMERATION_TYPE = ENUMERATION_TYPE;
26
+ const OPERATOR_IN = 'in';
27
+ exports.OPERATOR_IN = OPERATOR_IN;
28
+ const OPERATOR_NOT_IN = 'notIn';
29
+
30
+ // View layouts.
31
+ exports.OPERATOR_NOT_IN = OPERATOR_NOT_IN;
32
+ const LAYOUT_TABLE = 'table';
33
+ exports.LAYOUT_TABLE = LAYOUT_TABLE;
34
+ const LAYOUT_GRID = 'grid';
35
+ exports.LAYOUT_GRID = LAYOUT_GRID;
36
+ const LAYOUT_LIST = 'list';
37
+ exports.LAYOUT_LIST = LAYOUT_LIST;
38
+ const VIEW_LAYOUTS = [{
39
+ type: LAYOUT_TABLE,
40
+ label: (0, _i18n.__)('Table'),
41
+ component: _viewTable.default,
42
+ icon: _icons.blockTable
43
+ }, {
44
+ type: LAYOUT_GRID,
45
+ label: (0, _i18n.__)('Grid'),
46
+ component: _viewGrid.default,
47
+ icon: _icons.category
48
+ }, {
49
+ type: LAYOUT_LIST,
50
+ label: (0, _i18n.__)('List'),
51
+ component: _viewList.default,
52
+ icon: (0, _i18n.isRTL)() ? _icons.formatListBulletsRTL : _icons.formatListBullets
53
+ }];
54
+ exports.VIEW_LAYOUTS = VIEW_LAYOUTS;
55
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_icons","_viewTable","_interopRequireDefault","_viewGrid","_viewList","ENUMERATION_TYPE","exports","OPERATOR_IN","OPERATOR_NOT_IN","LAYOUT_TABLE","LAYOUT_GRID","LAYOUT_LIST","VIEW_LAYOUTS","type","label","__","component","ViewTable","icon","blockTable","ViewGrid","category","ViewList","isRTL","formatListBulletsRTL","formatListBullets"],"sources":["@wordpress/dataviews/src/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tblockTable,\n\tcategory,\n\tformatListBullets,\n\tformatListBulletsRTL,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ViewTable from './view-table';\nimport ViewGrid from './view-grid';\nimport ViewList from './view-list';\n\n// Field types.\nexport const ENUMERATION_TYPE = 'enumeration';\n\n// Filter operators.\nexport const OPERATOR_IN = 'in';\nexport const OPERATOR_NOT_IN = 'notIn';\n\n// View layouts.\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_LIST = 'list';\n\nexport const VIEW_LAYOUTS = [\n\t{\n\t\ttype: LAYOUT_TABLE,\n\t\tlabel: __( 'Table' ),\n\t\tcomponent: ViewTable,\n\t\ticon: blockTable,\n\t},\n\t{\n\t\ttype: LAYOUT_GRID,\n\t\tlabel: __( 'Grid' ),\n\t\tcomponent: ViewGrid,\n\t\ticon: category,\n\t},\n\t{\n\t\ttype: LAYOUT_LIST,\n\t\tlabel: __( 'List' ),\n\t\tcomponent: ViewList,\n\t\ticon: isRTL() ? formatListBulletsRTL : formatListBullets,\n\t},\n];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAUA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,SAAA,GAAAF,sBAAA,CAAAH,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACO,MAAMM,gBAAgB,GAAG,aAAa;;AAE7C;AAAAC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AACO,MAAME,WAAW,GAAG,IAAI;AAACD,OAAA,CAAAC,WAAA,GAAAA,WAAA;AACzB,MAAMC,eAAe,GAAG,OAAO;;AAEtC;AAAAF,OAAA,CAAAE,eAAA,GAAAA,eAAA;AACO,MAAMC,YAAY,GAAG,OAAO;AAACH,OAAA,CAAAG,YAAA,GAAAA,YAAA;AAC7B,MAAMC,WAAW,GAAG,MAAM;AAACJ,OAAA,CAAAI,WAAA,GAAAA,WAAA;AAC3B,MAAMC,WAAW,GAAG,MAAM;AAACL,OAAA,CAAAK,WAAA,GAAAA,WAAA;AAE3B,MAAMC,YAAY,GAAG,CAC3B;EACCC,IAAI,EAAEJ,YAAY;EAClBK,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBC,SAAS,EAAEC,kBAAS;EACpBC,IAAI,EAAEC;AACP,CAAC,EACD;EACCN,IAAI,EAAEH,WAAW;EACjBI,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBC,SAAS,EAAEI,iBAAQ;EACnBF,IAAI,EAAEG;AACP,CAAC,EACD;EACCR,IAAI,EAAEF,WAAW;EACjBG,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBC,SAAS,EAAEM,iBAAQ;EACnBJ,IAAI,EAAE,IAAAK,WAAK,EAAC,CAAC,GAAGC,2BAAoB,GAAGC;AACxC,CAAC,CACD;AAACnB,OAAA,CAAAM,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = DataViews;
8
+ var _react = require("react");
9
+ var _components = require("@wordpress/components");
10
+ var _element = require("@wordpress/element");
11
+ var _pagination = _interopRequireDefault(require("./pagination"));
12
+ var _viewActions = _interopRequireDefault(require("./view-actions"));
13
+ var _filters = _interopRequireDefault(require("./filters"));
14
+ var _search = _interopRequireDefault(require("./search"));
15
+ var _constants = require("./constants");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ function DataViews({
25
+ view,
26
+ onChangeView,
27
+ fields,
28
+ search = true,
29
+ searchLabel = undefined,
30
+ actions,
31
+ data,
32
+ getItemId,
33
+ isLoading = false,
34
+ paginationInfo,
35
+ supportedLayouts,
36
+ onSelectionChange,
37
+ deferredRendering
38
+ }) {
39
+ const [selection, setSelection] = (0, _element.useState)([]);
40
+ const onSetSelection = items => {
41
+ setSelection(items.map(item => item.id));
42
+ onSelectionChange(items);
43
+ };
44
+ const ViewComponent = _constants.VIEW_LAYOUTS.find(v => v.type === view.type).component;
45
+ const _fields = (0, _element.useMemo)(() => {
46
+ return fields.map(field => ({
47
+ ...field,
48
+ render: field.render || field.getValue
49
+ }));
50
+ }, [fields]);
51
+ return (0, _react.createElement)("div", {
52
+ className: "dataviews-wrapper"
53
+ }, (0, _react.createElement)(_components.__experimentalVStack, {
54
+ spacing: 0,
55
+ justify: "flex-start"
56
+ }, (0, _react.createElement)(_components.__experimentalHStack, {
57
+ alignment: "flex-start",
58
+ className: "dataviews__filters-view-actions"
59
+ }, (0, _react.createElement)(_components.__experimentalHStack, {
60
+ justify: "start",
61
+ wrap: true
62
+ }, search && (0, _react.createElement)(_search.default, {
63
+ label: searchLabel,
64
+ view: view,
65
+ onChangeView: onChangeView
66
+ }), (0, _react.createElement)(_filters.default, {
67
+ fields: fields,
68
+ view: view,
69
+ onChangeView: onChangeView
70
+ })), (0, _react.createElement)(_viewActions.default, {
71
+ fields: fields,
72
+ view: view,
73
+ onChangeView: onChangeView,
74
+ supportedLayouts: supportedLayouts
75
+ })), (0, _react.createElement)(ViewComponent, {
76
+ fields: _fields,
77
+ view: view,
78
+ onChangeView: onChangeView,
79
+ paginationInfo: paginationInfo,
80
+ actions: actions,
81
+ data: data,
82
+ getItemId: getItemId,
83
+ isLoading: isLoading,
84
+ onSelectionChange: onSetSelection,
85
+ selection: selection,
86
+ deferredRendering: deferredRendering
87
+ }), (0, _react.createElement)(_pagination.default, {
88
+ view: view,
89
+ onChangeView: onChangeView,
90
+ paginationInfo: paginationInfo
91
+ })));
92
+ }
93
+ //# sourceMappingURL=dataviews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_element","_pagination","_interopRequireDefault","_viewActions","_filters","_search","_constants","DataViews","view","onChangeView","fields","search","searchLabel","undefined","actions","data","getItemId","isLoading","paginationInfo","supportedLayouts","onSelectionChange","deferredRendering","selection","setSelection","useState","onSetSelection","items","map","item","id","ViewComponent","VIEW_LAYOUTS","find","v","type","component","_fields","useMemo","field","render","getValue","_react","createElement","className","__experimentalVStack","spacing","justify","__experimentalHStack","alignment","wrap","default","label"],"sources":["@wordpress/dataviews/src/dataviews.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Pagination from './pagination';\nimport ViewActions from './view-actions';\nimport Filters from './filters';\nimport Search from './search';\nimport { VIEW_LAYOUTS } from './constants';\n\nexport default function DataViews( {\n\tview,\n\tonChangeView,\n\tfields,\n\tsearch = true,\n\tsearchLabel = undefined,\n\tactions,\n\tdata,\n\tgetItemId,\n\tisLoading = false,\n\tpaginationInfo,\n\tsupportedLayouts,\n\tonSelectionChange,\n\tdeferredRendering,\n} ) {\n\tconst [ selection, setSelection ] = useState( [] );\n\n\tconst onSetSelection = ( items ) => {\n\t\tsetSelection( items.map( ( item ) => item.id ) );\n\t\tonSelectionChange( items );\n\t};\n\n\tconst ViewComponent = VIEW_LAYOUTS.find(\n\t\t( v ) => v.type === view.type\n\t).component;\n\tconst _fields = useMemo( () => {\n\t\treturn fields.map( ( field ) => ( {\n\t\t\t...field,\n\t\t\trender: field.render || field.getValue,\n\t\t} ) );\n\t}, [ fields ] );\n\treturn (\n\t\t<div className=\"dataviews-wrapper\">\n\t\t\t<VStack spacing={ 0 } justify=\"flex-start\">\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"flex-start\"\n\t\t\t\t\tclassName=\"dataviews__filters-view-actions\"\n\t\t\t\t>\n\t\t\t\t\t<HStack justify=\"start\" wrap>\n\t\t\t\t\t\t{ search && (\n\t\t\t\t\t\t\t<Search\n\t\t\t\t\t\t\t\tlabel={ searchLabel }\n\t\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Filters\n\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<ViewActions\n\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\tview={ view }\n\t\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\t\tsupportedLayouts={ supportedLayouts }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t<ViewComponent\n\t\t\t\t\tfields={ _fields }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\tisLoading={ isLoading }\n\t\t\t\t\tonSelectionChange={ onSetSelection }\n\t\t\t\t\tselection={ selection }\n\t\t\t\t\tdeferredRendering={ deferredRendering }\n\t\t\t\t/>\n\t\t\t\t<Pagination\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\tpaginationInfo={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AgB;IACpCH,SAAS,EAAGA,SAAW;IACvBD,iBAAiB,EAAGA;EAAmB,CACvC,CAAC,EACF,IAAAoB,MAAA,CAAAC,aAAA,EAACzC,WAAA,CAAAiD,OAAU;IACV1C,IAAI,EAAGA,IAAM;IACbC,YAAY,EAAGA,YAAc;IAC7BS,cAAc,EAAGA;EAAgB,CACjC,CACM,CACJ,CAAC;AAER"}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = FilterSummary;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ var _icons = require("@wordpress/icons");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _element = require("@wordpress/element");
12
+ var _constants = require("./constants");
13
+ var _lockUnlock = require("./lock-unlock");
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
22
+ const {
23
+ DropdownMenuV2: DropdownMenu,
24
+ DropdownMenuGroupV2: DropdownMenuGroup,
25
+ DropdownMenuItemV2: DropdownMenuItem,
26
+ DropdownMenuSeparatorV2: DropdownMenuSeparator,
27
+ DropdownSubMenuV2: DropdownSubMenu,
28
+ DropdownSubMenuTriggerV2: DropdownSubMenuTrigger
29
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
30
+ const FilterText = ({
31
+ activeElement,
32
+ filterInView,
33
+ filter
34
+ }) => {
35
+ if (activeElement === undefined) {
36
+ return filter.name;
37
+ }
38
+ if (activeElement !== undefined && filterInView?.operator === _constants.OPERATOR_IN) {
39
+ return (0, _i18n.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is Admin". */
40
+ (0, _i18n.__)('%1$s is %2$s'), filter.name, activeElement.label);
41
+ }
42
+ if (activeElement !== undefined && filterInView?.operator === _constants.OPERATOR_NOT_IN) {
43
+ return (0, _i18n.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not Admin". */
44
+ (0, _i18n.__)('%1$s is not %2$s'), filter.name, activeElement.label);
45
+ }
46
+ return (0, _i18n.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */
47
+ (0, _i18n.__)('Unknown status for %1$s'), filter.name);
48
+ };
49
+ function WithSeparators({
50
+ children
51
+ }) {
52
+ return _element.Children.toArray(children).filter(Boolean).map((child, i) => (0, _react.createElement)(_element.Fragment, {
53
+ key: i
54
+ }, i > 0 && (0, _react.createElement)(DropdownMenuSeparator, null), child));
55
+ }
56
+ function FilterSummary({
57
+ filter,
58
+ view,
59
+ onChangeView
60
+ }) {
61
+ const filterInView = view.filters.find(f => f.field === filter.field);
62
+ const activeElement = filter.elements.find(element => element.value === filterInView?.value);
63
+ return (0, _react.createElement)(DropdownMenu, {
64
+ key: filter.field,
65
+ trigger: (0, _react.createElement)(_components.Button, {
66
+ variant: "tertiary",
67
+ size: "compact",
68
+ label: filter.name
69
+ }, (0, _react.createElement)(FilterText, {
70
+ activeElement: activeElement,
71
+ filterInView: filterInView,
72
+ filter: filter
73
+ }), (0, _react.createElement)(_components.Icon, {
74
+ icon: _icons.chevronDown,
75
+ style: {
76
+ flexShrink: 0
77
+ }
78
+ }))
79
+ }, (0, _react.createElement)(WithSeparators, null, (0, _react.createElement)(DropdownMenuGroup, null, filter.elements.map(element => {
80
+ return (0, _react.createElement)(DropdownMenuItem, {
81
+ key: element.value,
82
+ role: "menuitemradio",
83
+ "aria-checked": activeElement?.value === element.value,
84
+ prefix: activeElement?.value === element.value && (0, _react.createElement)(_components.Icon, {
85
+ icon: _icons.check
86
+ }),
87
+ onSelect: () => onChangeView(currentView => ({
88
+ ...currentView,
89
+ page: 1,
90
+ filters: [...view.filters.filter(f => f.field !== filter.field), {
91
+ field: filter.field,
92
+ operator: filterInView?.operator || filter.operators[0],
93
+ value: activeElement?.value === element.value ? undefined : element.value
94
+ }]
95
+ }))
96
+ }, element.label);
97
+ })), filter.operators.length > 1 && (0, _react.createElement)(DropdownSubMenu, {
98
+ trigger: (0, _react.createElement)(DropdownSubMenuTrigger, {
99
+ suffix: (0, _react.createElement)(_element.Fragment, null, filterInView.operator === _constants.OPERATOR_IN ? (0, _i18n.__)('Is') : (0, _i18n.__)('Is not'), (0, _react.createElement)(_components.Icon, {
100
+ icon: _icons.chevronRightSmall
101
+ }), ' ')
102
+ }, (0, _i18n.__)('Conditions'))
103
+ }, (0, _react.createElement)(DropdownMenuItem, {
104
+ key: "in-filter",
105
+ role: "menuitemradio",
106
+ "aria-checked": filterInView?.operator === _constants.OPERATOR_IN,
107
+ prefix: filterInView?.operator === _constants.OPERATOR_IN && (0, _react.createElement)(_components.Icon, {
108
+ icon: _icons.check
109
+ }),
110
+ onSelect: () => onChangeView(currentView => ({
111
+ ...currentView,
112
+ page: 1,
113
+ filters: [...view.filters.filter(f => f.field !== filter.field), {
114
+ field: filter.field,
115
+ operator: _constants.OPERATOR_IN,
116
+ value: filterInView?.value
117
+ }]
118
+ }))
119
+ }, (0, _i18n.__)('Is')), (0, _react.createElement)(DropdownMenuItem, {
120
+ key: "not-in-filter",
121
+ role: "menuitemradio",
122
+ "aria-checked": filterInView?.operator === _constants.OPERATOR_NOT_IN,
123
+ prefix: filterInView?.operator === _constants.OPERATOR_NOT_IN && (0, _react.createElement)(_components.Icon, {
124
+ icon: _icons.check
125
+ }),
126
+ onSelect: () => onChangeView(currentView => ({
127
+ ...currentView,
128
+ page: 1,
129
+ filters: [...view.filters.filter(f => f.field !== filter.field), {
130
+ field: filter.field,
131
+ operator: _constants.OPERATOR_NOT_IN,
132
+ value: filterInView?.value
133
+ }]
134
+ }))
135
+ }, (0, _i18n.__)('Is not')))));
136
+ }
137
+ //# sourceMappingURL=filter-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_icons","_i18n","_element","_constants","_lockUnlock","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuSeparatorV2","DropdownMenuSeparator","DropdownSubMenuV2","DropdownSubMenu","DropdownSubMenuTriggerV2","DropdownSubMenuTrigger","unlock","componentsPrivateApis","FilterText","activeElement","filterInView","filter","undefined","name","operator","OPERATOR_IN","sprintf","__","label","OPERATOR_NOT_IN","WithSeparators","children","Children","toArray","Boolean","map","child","i","_react","createElement","Fragment","key","FilterSummary","view","onChangeView","filters","find","f","field","elements","element","value","trigger","Button","variant","size","Icon","icon","chevronDown","style","flexShrink","role","prefix","check","onSelect","currentView","page","operators","length","suffix","chevronRightSmall"],"sources":["@wordpress/dataviews/src/filter-summary.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\tIcon,\n} from '@wordpress/components';\nimport { chevronDown, chevronRightSmall, check } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Children, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IN, OPERATOR_NOT_IN } from './constants';\nimport { unlock } from './lock-unlock';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuSeparatorV2: DropdownMenuSeparator,\n\tDropdownSubMenuV2: DropdownSubMenu,\n\tDropdownSubMenuTriggerV2: DropdownSubMenuTrigger,\n} = unlock( componentsPrivateApis );\n\nconst FilterText = ( { activeElement, filterInView, filter } ) => {\n\tif ( activeElement === undefined ) {\n\t\treturn filter.name;\n\t}\n\n\tif (\n\t\tactiveElement !== undefined &&\n\t\tfilterInView?.operator === OPERATOR_IN\n\t) {\n\t\treturn sprintf(\n\t\t\t/* translators: 1: Filter name. 2: Filter value. e.g.: \"Author is Admin\". */\n\t\t\t__( '%1$s is %2$s' ),\n\t\t\tfilter.name,\n\t\t\tactiveElement.label\n\t\t);\n\t}\n\n\tif (\n\t\tactiveElement !== undefined &&\n\t\tfilterInView?.operator === OPERATOR_NOT_IN\n\t) {\n\t\treturn sprintf(\n\t\t\t/* translators: 1: Filter name. 2: Filter value. e.g.: \"Author is not Admin\". */\n\t\t\t__( '%1$s is not %2$s' ),\n\t\t\tfilter.name,\n\t\t\tactiveElement.label\n\t\t);\n\t}\n\n\treturn sprintf(\n\t\t/* translators: 1: Filter name e.g.: \"Unknown status for Author\". */\n\t\t__( 'Unknown status for %1$s' ),\n\t\tfilter.name\n\t);\n};\n\nfunction WithSeparators( { children } ) {\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 && <DropdownMenuSeparator /> }\n\t\t\t\t{ child }\n\t\t\t</Fragment>\n\t\t) );\n}\n\nexport default function FilterSummary( { filter, view, onChangeView } ) {\n\tconst filterInView = view.filters.find( ( f ) => f.field === filter.field );\n\tconst activeElement = filter.elements.find(\n\t\t( element ) => element.value === filterInView?.value\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tkey={ filter.field }\n\t\t\ttrigger={\n\t\t\t\t<Button variant=\"tertiary\" size=\"compact\" label={ filter.name }>\n\t\t\t\t\t<FilterText\n\t\t\t\t\t\tactiveElement={ activeElement }\n\t\t\t\t\t\tfilterInView={ filterInView }\n\t\t\t\t\t\tfilter={ filter }\n\t\t\t\t\t/>\n\t\t\t\t\t<Icon icon={ chevronDown } style={ { flexShrink: 0 } } />\n\t\t\t\t</Button>\n\t\t\t}\n\t\t>\n\t\t\t<WithSeparators>\n\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t{ filter.elements.map( ( element ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\tkey={ element.value }\n\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\t\tactiveElement?.value === element.value\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\tactiveElement?.value === element.value && (\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\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\tonSelect={ () =>\n\t\t\t\t\t\t\t\t\tonChangeView( ( currentView ) => ( {\n\t\t\t\t\t\t\t\t\t\t...currentView,\n\t\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\t\tfilters: [\n\t\t\t\t\t\t\t\t\t\t\t...view.filters.filter(\n\t\t\t\t\t\t\t\t\t\t\t\t( f ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tf.field !== filter.field\n\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\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\t\t\toperator:\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilterInView?.operator ||\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilter.operators[ 0 ],\n\t\t\t\t\t\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\t\t\t\t\t\tactiveElement?.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\telement.value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: element.value,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ element.label }\n\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t{ filter.operators.length > 1 && (\n\t\t\t\t\t<DropdownSubMenu\n\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t<DropdownSubMenuTrigger\n\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ filterInView.operator === OPERATOR_IN\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Is' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Is not' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ chevronRightSmall } />{ ' ' }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Conditions' ) }\n\t\t\t\t\t\t\t</DropdownSubMenuTrigger>\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\tkey=\"in-filter\"\n\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\tfilterInView?.operator === OPERATOR_IN\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\tfilterInView?.operator === OPERATOR_IN && (\n\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\t\t\tonChangeView( ( currentView ) => ( {\n\t\t\t\t\t\t\t\t\t...currentView,\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.filter(\n\t\t\t\t\t\t\t\t\t\t\t( f ) => f.field !== filter.field\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\t\toperator: OPERATOR_IN,\n\t\t\t\t\t\t\t\t\t\t\tvalue: filterInView?.value,\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{ __( 'Is' ) }\n\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\tkey=\"not-in-filter\"\n\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\taria-checked={\n\t\t\t\t\t\t\t\tfilterInView?.operator === OPERATOR_NOT_IN\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\tfilterInView?.operator === OPERATOR_NOT_IN && (\n\t\t\t\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\t\t\tonChangeView( ( currentView ) => ( {\n\t\t\t\t\t\t\t\t\t...currentView,\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.filter(\n\t\t\t\t\t\t\t\t\t\t\t( f ) => f.field !== filter.field\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\t\toperator: OPERATOR_NOT_IN,\n\t\t\t\t\t\t\t\t\t\t\tvalue: filterInView?.value,\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{ __( 'Is not' ) }\n\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t</DropdownSubMenu>\n\t\t\t\t) }\n\t\t\t</WithSeparators>\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;A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