@wordpress/dataviews 0.7.0 → 0.8.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 +7 -0
- package/README.md +48 -15
- package/build/constants.js +28 -7
- package/build/constants.js.map +1 -1
- package/build/dataviews.js +11 -5
- package/build/dataviews.js.map +1 -1
- package/build/filter-summary.js +33 -12
- package/build/filter-summary.js.map +1 -1
- package/build/filters.js +2 -1
- package/build/filters.js.map +1 -1
- package/build/item-actions.js +20 -39
- package/build/item-actions.js.map +1 -1
- package/build/pagination.js +2 -2
- package/build/pagination.js.map +1 -1
- package/build/search-widget.js +34 -10
- package/build/search-widget.js.map +1 -1
- package/build/utils.js +24 -2
- package/build/utils.js.map +1 -1
- package/build/view-grid.js +4 -1
- package/build/view-grid.js.map +1 -1
- package/build/view-table.js +35 -4
- package/build/view-table.js.map +1 -1
- package/build-module/constants.js +27 -6
- package/build-module/constants.js.map +1 -1
- package/build-module/dataviews.js +11 -5
- package/build-module/dataviews.js.map +1 -1
- package/build-module/filter-summary.js +34 -13
- package/build-module/filter-summary.js.map +1 -1
- package/build-module/filters.js +3 -2
- package/build-module/filters.js.map +1 -1
- package/build-module/item-actions.js +20 -39
- package/build-module/item-actions.js.map +1 -1
- package/build-module/pagination.js +2 -2
- package/build-module/pagination.js.map +1 -1
- package/build-module/search-widget.js +35 -11
- package/build-module/search-widget.js.map +1 -1
- package/build-module/utils.js +25 -3
- package/build-module/utils.js.map +1 -1
- package/build-module/view-grid.js +4 -1
- package/build-module/view-grid.js.map +1 -1
- package/build-module/view-table.js +36 -5
- package/build-module/view-table.js.map +1 -1
- package/build-style/style-rtl.css +9 -3
- package/build-style/style.css +9 -3
- package/package.json +11 -11
- package/src/constants.js +35 -6
- package/src/dataviews.js +11 -5
- package/src/filter-summary.js +76 -23
- package/src/filters.js +10 -4
- package/src/item-actions.js +19 -55
- package/src/pagination.js +2 -2
- package/src/search-widget.js +63 -21
- package/src/stories/fixtures.js +12 -1
- package/src/stories/index.story.js +43 -4
- package/src/style.scss +9 -3
- package/src/utils.js +38 -4
- package/src/view-grid.js +4 -1
- package/src/view-table.js +50 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.8.0 (2024-03-21)
|
|
6
|
+
|
|
7
|
+
### Enhancement
|
|
8
|
+
|
|
9
|
+
- Two new operators have been added: `isAll` and `isNotAll`. These are meant to represent `AND` operations. For example, `Category is all: Book, Review, Science Fiction` would represent all items that have all three categories selected.
|
|
10
|
+
- DataViews now supports multi-selection. A new set of filter operators has been introduced: `is`, `isNot`, `isAny`, `isNone`. Single-selection operators are `is` and `isNot`, and multi-selection operators are `isAny` and `isNone`. If no operators are declared for a filter, it will support multi-selection. Additionally, the old filter operators `in` and `notIn` operators have been deprecated and will work as `is` and `isNot` respectively. Please, migrate to the new operators as they'll be removed soon.
|
|
11
|
+
|
|
5
12
|
## 0.7.0 (2024-03-06)
|
|
6
13
|
|
|
7
14
|
## 0.6.0 (2024-02-21)
|
package/README.md
CHANGED
|
@@ -59,17 +59,23 @@ The fields describe the visible items for each record in the dataset.
|
|
|
59
59
|
Example:
|
|
60
60
|
|
|
61
61
|
```js
|
|
62
|
+
const STATUSES = [
|
|
63
|
+
{ value: 'draft', label: __( 'Draft' ) },
|
|
64
|
+
{ value: 'future', label: __( 'Scheduled' ) },
|
|
65
|
+
{ value: 'pending', label: __( 'Pending Review' ) },
|
|
66
|
+
{ value: 'private', label: __( 'Private' ) },
|
|
67
|
+
{ value: 'publish', label: __( 'Published' ) },
|
|
68
|
+
{ value: 'trash', label: __( 'Trash' ) },
|
|
69
|
+
];
|
|
62
70
|
const fields = [
|
|
63
71
|
{
|
|
64
72
|
id: 'title',
|
|
65
73
|
header: 'Title',
|
|
66
|
-
getValue: ({ item }) => item.title,
|
|
67
74
|
enableHiding: false,
|
|
68
75
|
},
|
|
69
76
|
{
|
|
70
77
|
id: 'date',
|
|
71
78
|
header: 'Date',
|
|
72
|
-
getValue: ( { item } ) => item.date,
|
|
73
79
|
render: ( { item } ) => {
|
|
74
80
|
return (
|
|
75
81
|
<time>{ getFormattedDate( item.date ) }</time>
|
|
@@ -79,7 +85,6 @@ const fields = [
|
|
|
79
85
|
{
|
|
80
86
|
id: 'author',
|
|
81
87
|
header: __( 'Author' ),
|
|
82
|
-
getValue: ( { item } ) => item.author,
|
|
83
88
|
render: ( { item } ) => {
|
|
84
89
|
return (
|
|
85
90
|
<a href="...">{ item.author }</a>
|
|
@@ -89,9 +94,25 @@ const fields = [
|
|
|
89
94
|
elements: [
|
|
90
95
|
{ value: 1, label: 'Admin' }
|
|
91
96
|
{ value: 2, label: 'User' }
|
|
92
|
-
]
|
|
97
|
+
],
|
|
98
|
+
filterBy: {
|
|
99
|
+
operators: [ 'is', 'isNot' ]
|
|
100
|
+
},
|
|
93
101
|
enableSorting: false
|
|
94
|
-
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
header: __( 'Status' ),
|
|
105
|
+
id: 'status',
|
|
106
|
+
getValue: ( { item } ) =>
|
|
107
|
+
STATUSES.find( ( { value } ) => value === item.status )
|
|
108
|
+
?.label ?? item.status,
|
|
109
|
+
type: 'enumeration',
|
|
110
|
+
elements: STATUSES,
|
|
111
|
+
filterBy: {
|
|
112
|
+
operators: [ 'isAny' ],
|
|
113
|
+
},
|
|
114
|
+
enableSorting: false,
|
|
115
|
+
},
|
|
95
116
|
]
|
|
96
117
|
```
|
|
97
118
|
|
|
@@ -99,7 +120,7 @@ Each field is an object with the following properties:
|
|
|
99
120
|
|
|
100
121
|
- `id`: identifier for the field. Unique.
|
|
101
122
|
- `header`: the field's name to be shown in the UI.
|
|
102
|
-
- `getValue`: function that returns the value of the field
|
|
123
|
+
- `getValue`: function that returns the value of the field, defaults to `field[id]`.
|
|
103
124
|
- `render`: function that renders the field. Optional, `getValue` will be used if `render` is not defined.
|
|
104
125
|
- `elements`: the set of valid values for the field's value.
|
|
105
126
|
- `type`: the type of the field. Used to generate the proper filters. Only `enumeration` available at the moment. See "Field types".
|
|
@@ -120,8 +141,8 @@ const view = {
|
|
|
120
141
|
type: 'table',
|
|
121
142
|
search: '',
|
|
122
143
|
filters: [
|
|
123
|
-
{ field: 'author', operator: '
|
|
124
|
-
{ field: 'status', operator: '
|
|
144
|
+
{ field: 'author', operator: 'is', value: 2 },
|
|
145
|
+
{ field: 'status', operator: 'isAny', value: [ 'publish', 'draft'] }
|
|
125
146
|
],
|
|
126
147
|
page: 1,
|
|
127
148
|
perPage: 5,
|
|
@@ -140,7 +161,7 @@ Properties:
|
|
|
140
161
|
- `search`: the text search applied to the dataset.
|
|
141
162
|
- `filters`: the filters applied to the dataset. Each item describes:
|
|
142
163
|
- `field`: which field this filter is bound to.
|
|
143
|
-
- `operator`: which type of filter it is.
|
|
164
|
+
- `operator`: which type of filter it is. See "Operator types".
|
|
144
165
|
- `value`: the actual value selected by the user.
|
|
145
166
|
- `perPage`: number of records to show per page.
|
|
146
167
|
- `page`: the page that is visible.
|
|
@@ -172,8 +193,8 @@ function MyCustomPageTable() {
|
|
|
172
193
|
},
|
|
173
194
|
search: '',
|
|
174
195
|
filters: [
|
|
175
|
-
{ field: 'author', operator: '
|
|
176
|
-
{ field: 'status', operator: '
|
|
196
|
+
{ field: 'author', operator: 'is', value: 2 },
|
|
197
|
+
{ field: 'status', operator: 'isAny', value: [ 'publish', 'draft' ] }
|
|
177
198
|
],
|
|
178
199
|
hiddenFields: [ 'date', 'featured-image' ],
|
|
179
200
|
layout: {},
|
|
@@ -182,10 +203,10 @@ function MyCustomPageTable() {
|
|
|
182
203
|
const queryArgs = useMemo( () => {
|
|
183
204
|
const filters = {};
|
|
184
205
|
view.filters.forEach( ( filter ) => {
|
|
185
|
-
if ( filter.field === 'status' && filter.operator === '
|
|
206
|
+
if ( filter.field === 'status' && filter.operator === 'isAny' ) {
|
|
186
207
|
filters.status = filter.value;
|
|
187
208
|
}
|
|
188
|
-
if ( filter.field === 'author' && filter.operator === '
|
|
209
|
+
if ( filter.field === 'author' && filter.operator === 'is' ) {
|
|
189
210
|
filters.author = filter.value;
|
|
190
211
|
}
|
|
191
212
|
} );
|
|
@@ -282,8 +303,20 @@ Callback that signals the user triggered the details for one of more items, and
|
|
|
282
303
|
|
|
283
304
|
### Operators
|
|
284
305
|
|
|
285
|
-
|
|
286
|
-
|
|
306
|
+
Allowed operators for fields of type `enumeration`:
|
|
307
|
+
|
|
308
|
+
| Operator | Selection | Description | Example |
|
|
309
|
+
| --- | --- | --- | --- |
|
|
310
|
+
| `is` | Single item | `EQUAL TO`. The item's field is equal to a single value. | Author is Admin |
|
|
311
|
+
| `isNot` | Single item | `NOT EQUAL TO`. The item's field is not equal to a single value. | Author is not Admin |
|
|
312
|
+
| `isAny` | Multiple items | `OR`. The item's field is present in a list of values. | Author is any: Admin, Editor |
|
|
313
|
+
| `isNone` | Multiple items | `NOT OR`. The item's field is not present in a list of values. | Author is none: Admin, Editor |
|
|
314
|
+
| `isAll` | Multiple items | `AND`. The item's field has all of the values in the list. | Category is all: Book, Review, Science Fiction |
|
|
315
|
+
| `isNotAll` | Multiple items | `NOT AND`. The item's field doesn't have all of the values in the list. | Category is not all: Book, Review, Science Fiction |
|
|
316
|
+
|
|
317
|
+
`is` and `isNot` are single-selection operators, while `isAny`, `isNone`, `isAll`, and `isNotALl` are multi-selection. By default, a filter with no operators declared will support the `isAny` and `isNone` multi-selection operators. A filter cannot mix single-selection & multi-selection operators; if a single-selection operator is present in the list of valid operators, the multi-selection ones will be discarded and the filter won't allow selecting more than one item.
|
|
318
|
+
|
|
319
|
+
> The legacy operators `in` and `notIn` have been deprecated and will be removed soon. In the meantime, they work as `is` and `isNot` operators, respectively.
|
|
287
320
|
|
|
288
321
|
## Contributing to this package
|
|
289
322
|
|
package/build/constants.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.VIEW_LAYOUTS = exports.SORTING_DIRECTIONS = exports.
|
|
7
|
+
exports.VIEW_LAYOUTS = exports.SORTING_DIRECTIONS = exports.OPERATOR_IS_NOT_ALL = exports.OPERATOR_IS_NOT = exports.OPERATOR_IS_NONE = exports.OPERATOR_IS_ANY = exports.OPERATOR_IS_ALL = exports.OPERATOR_IS = exports.OPERATORS = exports.LAYOUT_TABLE = exports.LAYOUT_LIST = exports.LAYOUT_GRID = exports.ENUMERATION_TYPE = exports.ALL_OPERATORS = void 0;
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _icons = require("@wordpress/icons");
|
|
10
10
|
var _viewTable = _interopRequireDefault(require("./view-table"));
|
|
@@ -22,16 +22,37 @@ var _viewList = _interopRequireDefault(require("./view-list"));
|
|
|
22
22
|
const ENUMERATION_TYPE = exports.ENUMERATION_TYPE = 'enumeration';
|
|
23
23
|
|
|
24
24
|
// Filter operators.
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const OPERATOR_IS = exports.OPERATOR_IS = 'is';
|
|
26
|
+
const OPERATOR_IS_NOT = exports.OPERATOR_IS_NOT = 'isNot';
|
|
27
|
+
const OPERATOR_IS_ANY = exports.OPERATOR_IS_ANY = 'isAny';
|
|
28
|
+
const OPERATOR_IS_NONE = exports.OPERATOR_IS_NONE = 'isNone';
|
|
29
|
+
const OPERATOR_IS_ALL = exports.OPERATOR_IS_ALL = 'isAll';
|
|
30
|
+
const OPERATOR_IS_NOT_ALL = exports.OPERATOR_IS_NOT_ALL = 'isNotAll';
|
|
31
|
+
const ALL_OPERATORS = exports.ALL_OPERATORS = [OPERATOR_IS, OPERATOR_IS_NOT, OPERATOR_IS_ANY, OPERATOR_IS_NONE, OPERATOR_IS_ALL, OPERATOR_IS_NOT_ALL];
|
|
27
32
|
const OPERATORS = exports.OPERATORS = {
|
|
28
|
-
[
|
|
29
|
-
key: '
|
|
33
|
+
[OPERATOR_IS]: {
|
|
34
|
+
key: 'is-filter',
|
|
30
35
|
label: (0, _i18n.__)('Is')
|
|
31
36
|
},
|
|
32
|
-
[
|
|
33
|
-
key: 'not-
|
|
37
|
+
[OPERATOR_IS_NOT]: {
|
|
38
|
+
key: 'is-not-filter',
|
|
34
39
|
label: (0, _i18n.__)('Is not')
|
|
40
|
+
},
|
|
41
|
+
[OPERATOR_IS_ANY]: {
|
|
42
|
+
key: 'is-any-filter',
|
|
43
|
+
label: (0, _i18n.__)('Is any')
|
|
44
|
+
},
|
|
45
|
+
[OPERATOR_IS_NONE]: {
|
|
46
|
+
key: 'is-none-filter',
|
|
47
|
+
label: (0, _i18n.__)('Is none')
|
|
48
|
+
},
|
|
49
|
+
[OPERATOR_IS_ALL]: {
|
|
50
|
+
key: 'is-all-filter',
|
|
51
|
+
label: (0, _i18n.__)('Is all')
|
|
52
|
+
},
|
|
53
|
+
[OPERATOR_IS_NOT_ALL]: {
|
|
54
|
+
key: 'is-not-all-filter',
|
|
55
|
+
label: (0, _i18n.__)('Is not all')
|
|
35
56
|
}
|
|
36
57
|
};
|
|
37
58
|
|
package/build/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_viewTable","_interopRequireDefault","_viewGrid","_viewList","ENUMERATION_TYPE","exports","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_viewTable","_interopRequireDefault","_viewGrid","_viewList","ENUMERATION_TYPE","exports","OPERATOR_IS","OPERATOR_IS_NOT","OPERATOR_IS_ANY","OPERATOR_IS_NONE","OPERATOR_IS_ALL","OPERATOR_IS_NOT_ALL","ALL_OPERATORS","OPERATORS","key","label","__","SORTING_DIRECTIONS","asc","desc","LAYOUT_TABLE","LAYOUT_GRID","LAYOUT_LIST","VIEW_LAYOUTS","type","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_IS = 'is';\nexport const OPERATOR_IS_NOT = 'isNot';\nexport const OPERATOR_IS_ANY = 'isAny';\nexport const OPERATOR_IS_NONE = 'isNone';\nexport const OPERATOR_IS_ALL = 'isAll';\nexport const OPERATOR_IS_NOT_ALL = 'isNotAll';\n\nexport const ALL_OPERATORS = [\n\tOPERATOR_IS,\n\tOPERATOR_IS_NOT,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tOPERATOR_IS_ALL,\n\tOPERATOR_IS_NOT_ALL,\n];\nexport const OPERATORS = {\n\t[ OPERATOR_IS ]: {\n\t\tkey: 'is-filter',\n\t\tlabel: __( 'Is' ),\n\t},\n\t[ OPERATOR_IS_NOT ]: {\n\t\tkey: 'is-not-filter',\n\t\tlabel: __( 'Is not' ),\n\t},\n\t[ OPERATOR_IS_ANY ]: {\n\t\tkey: 'is-any-filter',\n\t\tlabel: __( 'Is any' ),\n\t},\n\t[ OPERATOR_IS_NONE ]: {\n\t\tkey: 'is-none-filter',\n\t\tlabel: __( 'Is none' ),\n\t},\n\t[ OPERATOR_IS_ALL ]: {\n\t\tkey: 'is-all-filter',\n\t\tlabel: __( 'Is all' ),\n\t},\n\t[ OPERATOR_IS_NOT_ALL ]: {\n\t\tkey: 'is-not-all-filter',\n\t\tlabel: __( 'Is not all' ),\n\t},\n};\n\n// Sorting\nexport const SORTING_DIRECTIONS = {\n\tasc: { label: __( 'Sort ascending' ) },\n\tdesc: { label: __( 'Sort descending' ) },\n};\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,GAAAC,OAAA,CAAAD,gBAAA,GAAG,aAAa;;AAE7C;AACO,MAAME,WAAW,GAAAD,OAAA,CAAAC,WAAA,GAAG,IAAI;AACxB,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,OAAO;AAC/B,MAAMC,eAAe,GAAAH,OAAA,CAAAG,eAAA,GAAG,OAAO;AAC/B,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAG,QAAQ;AACjC,MAAMC,eAAe,GAAAL,OAAA,CAAAK,eAAA,GAAG,OAAO;AAC/B,MAAMC,mBAAmB,GAAAN,OAAA,CAAAM,mBAAA,GAAG,UAAU;AAEtC,MAAMC,aAAa,GAAAP,OAAA,CAAAO,aAAA,GAAG,CAC5BN,WAAW,EACXC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,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,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBS,SAAS,EAAEC,kBAAS;EACpBC,IAAI,EAAEC;AACP,CAAC,EACD;EACCJ,IAAI,EAAEH,WAAW;EACjBN,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBS,SAAS,EAAEI,iBAAQ;EACnBF,IAAI,EAAEG;AACP,CAAC,EACD;EACCN,IAAI,EAAEF,WAAW;EACjBP,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBS,SAAS,EAAEM,iBAAQ;EACnBJ,IAAI,EAAE,IAAAK,WAAK,EAAC,CAAC,GAAGC,2BAAoB,GAAGC;AACxC,CAAC,CACD"}
|
package/build/dataviews.js
CHANGED
|
@@ -39,7 +39,7 @@ function DataViews({
|
|
|
39
39
|
fields,
|
|
40
40
|
search = true,
|
|
41
41
|
searchLabel = undefined,
|
|
42
|
-
actions,
|
|
42
|
+
actions = [],
|
|
43
43
|
data,
|
|
44
44
|
getItemId = defaultGetItemId,
|
|
45
45
|
isLoading = false,
|
|
@@ -64,10 +64,16 @@ function DataViews({
|
|
|
64
64
|
}, [setSelection, getItemId, onSelectionChange]);
|
|
65
65
|
const ViewComponent = _constants.VIEW_LAYOUTS.find(v => v.type === view.type).component;
|
|
66
66
|
const _fields = (0, _element.useMemo)(() => {
|
|
67
|
-
return fields.map(field =>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
return fields.map(field => {
|
|
68
|
+
const getValue = field.getValue || (({
|
|
69
|
+
item
|
|
70
|
+
}) => item[field.id]);
|
|
71
|
+
return {
|
|
72
|
+
...field,
|
|
73
|
+
getValue,
|
|
74
|
+
render: field.render || getValue
|
|
75
|
+
};
|
|
76
|
+
});
|
|
71
77
|
}, [fields]);
|
|
72
78
|
const hasPossibleBulkAction = useSomeItemHasAPossibleBulkAction(actions, data);
|
|
73
79
|
return (0, _react.createElement)("div", {
|
package/build/dataviews.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_pagination","_interopRequireDefault","_viewActions","_filters","_search","_constants","_bulkActions","defaultGetItemId","item","id","defaultOnSelectionChange","useSomeItemHasAPossibleBulkAction","actions","data","useMemo","some","action","supportsBulk","isEligible","DataViews","view","onChangeView","fields","search","searchLabel","undefined","getItemId","isLoading","paginationInfo","supportedLayouts","onSelectionChange","onDetailsChange","deferredRendering","selection","setSelection","useState","openedFilter","setOpenedFilter","useEffect","length","newSelection","filter","includes","onSetSelection","useCallback","items","map","ViewComponent","VIEW_LAYOUTS","find","v","type","component","_fields","field","
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_pagination","_interopRequireDefault","_viewActions","_filters","_search","_constants","_bulkActions","defaultGetItemId","item","id","defaultOnSelectionChange","useSomeItemHasAPossibleBulkAction","actions","data","useMemo","some","action","supportsBulk","isEligible","DataViews","view","onChangeView","fields","search","searchLabel","undefined","getItemId","isLoading","paginationInfo","supportedLayouts","onSelectionChange","onDetailsChange","deferredRendering","selection","setSelection","useState","openedFilter","setOpenedFilter","useEffect","length","newSelection","filter","includes","onSetSelection","useCallback","items","map","ViewComponent","VIEW_LAYOUTS","find","v","type","component","_fields","field","getValue","render","hasPossibleBulkAction","_react","createElement","className","__experimentalHStack","alignment","justify","wrap","default","label","LAYOUT_TABLE","LAYOUT_GRID"],"sources":["@wordpress/dataviews/src/dataviews.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { useMemo, useState, useCallback, useEffect } 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, LAYOUT_TABLE, LAYOUT_GRID } from './constants';\nimport BulkActions from './bulk-actions';\n\nconst defaultGetItemId = ( item ) => item.id;\nconst defaultOnSelectionChange = () => {};\n\nfunction useSomeItemHasAPossibleBulkAction( actions, data ) {\n\treturn useMemo( () => {\n\t\treturn data.some( ( item ) => {\n\t\t\treturn actions.some( ( action ) => {\n\t\t\t\treturn action.supportsBulk && action.isEligible( item );\n\t\t\t} );\n\t\t} );\n\t}, [ actions, data ] );\n}\n\nexport default function DataViews( {\n\tview,\n\tonChangeView,\n\tfields,\n\tsearch = true,\n\tsearchLabel = undefined,\n\tactions = [],\n\tdata,\n\tgetItemId = defaultGetItemId,\n\tisLoading = false,\n\tpaginationInfo,\n\tsupportedLayouts,\n\tonSelectionChange = defaultOnSelectionChange,\n\tonDetailsChange = null,\n\tdeferredRendering = false,\n} ) {\n\tconst [ selection, setSelection ] = useState( [] );\n\tconst [ openedFilter, setOpenedFilter ] = useState( null );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tselection.length > 0 &&\n\t\t\tselection.some(\n\t\t\t\t( id ) => ! data.some( ( item ) => getItemId( item ) === id )\n\t\t\t)\n\t\t) {\n\t\t\tconst newSelection = selection.filter( ( id ) =>\n\t\t\t\tdata.some( ( item ) => getItemId( item ) === id )\n\t\t\t);\n\t\t\tsetSelection( newSelection );\n\t\t\tonSelectionChange(\n\t\t\t\tdata.filter( ( item ) =>\n\t\t\t\t\tnewSelection.includes( getItemId( item ) )\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}, [ selection, data, getItemId, onSelectionChange ] );\n\n\tconst onSetSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items.map( ( item ) => getItemId( item ) ) );\n\t\t\tonSelectionChange( items );\n\t\t},\n\t\t[ setSelection, getItemId, onSelectionChange ]\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\tconst getValue =\n\t\t\t\tfield.getValue || ( ( { item } ) => item[ field.id ] );\n\n\t\t\treturn {\n\t\t\t\t...field,\n\t\t\t\tgetValue,\n\t\t\t\trender: field.render || getValue,\n\t\t\t};\n\t\t} );\n\t}, [ fields ] );\n\n\tconst hasPossibleBulkAction = useSomeItemHasAPossibleBulkAction(\n\t\tactions,\n\t\tdata\n\t);\n\treturn (\n\t\t<div className=\"dataviews-wrapper\">\n\t\t\t<HStack\n\t\t\t\talignment=\"top\"\n\t\t\t\tjustify=\"start\"\n\t\t\t\tclassName=\"dataviews-filters__view-actions\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"start\"\n\t\t\t\t\tclassName=\"dataviews-filters__container\"\n\t\t\t\t\twrap\n\t\t\t\t>\n\t\t\t\t\t{ search && (\n\t\t\t\t\t\t<Search\n\t\t\t\t\t\t\tlabel={ searchLabel }\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) }\n\t\t\t\t\t<Filters\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\topenedFilter={ openedFilter }\n\t\t\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t{ [ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) &&\n\t\t\t\t\thasPossibleBulkAction && (\n\t\t\t\t\t\t<BulkActions\n\t\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\tonSelectionChange={ onSetSelection }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tgetItemId={ getItemId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t<ViewActions\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\tsupportedLayouts={ supportedLayouts }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t<ViewComponent\n\t\t\t\tfields={ _fields }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tisLoading={ isLoading }\n\t\t\t\tonSelectionChange={ onSetSelection }\n\t\t\t\tonDetailsChange={ onDetailsChange }\n\t\t\t\tselection={ selection }\n\t\t\t\tdeferredRendering={ deferredRendering }\n\t\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\t/>\n\t\t\t<Pagination\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,QAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAL,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;;AAIA;AACA;AACA;;AAQA,MAAMS,gBAAgB,GAAKC,IAAI,IAAMA,IAAI,CAACC,EAAE;AAC5C,MAAMC,wBAAwB,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEzC,SAASC,iCAAiCA,CAAEC,OAAO,EAAEC,IAAI,EAAG;EAC3D,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,OAAOD,IAAI,CAACE,IAAI,CAAIP,IAAI,IAAM;MAC7B,OAAOI,OAAO,CAACG,IAAI,CAAIC,MAAM,IAAM;QAClC,OAAOA,MAAM,CAACC,YAAY,IAAID,MAAM,CAACE,UAAU,CAAEV,IAAK,CAAC;MACxD,CAAE,CAAC;IACJ,CAAE,CAAC;EACJ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AAA,CAAAC,aAAA,EAAC3D,WAAA,CAAAiE,OAAU;IACV7C,IAAI,EAAGA,IAAM;IACbC,YAAY,EAAGA,YAAc;IAC7BO,cAAc,EAAGA;EAAgB,CACjC,CACG,CAAC;AAER"}
|
package/build/filter-summary.js
CHANGED
|
@@ -27,28 +27,44 @@ var _constants = require("./constants");
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const FilterText = ({
|
|
30
|
-
|
|
30
|
+
activeElements,
|
|
31
31
|
filterInView,
|
|
32
32
|
filter
|
|
33
33
|
}) => {
|
|
34
|
-
if (
|
|
34
|
+
if (activeElements === undefined || activeElements.length === 0) {
|
|
35
35
|
return filter.name;
|
|
36
36
|
}
|
|
37
37
|
const filterTextWrappers = {
|
|
38
|
-
|
|
38
|
+
Name: (0, _react.createElement)("span", {
|
|
39
39
|
className: "dataviews-filter-summary__filter-text-name"
|
|
40
40
|
}),
|
|
41
|
-
|
|
41
|
+
Value: (0, _react.createElement)("span", {
|
|
42
42
|
className: "dataviews-filter-summary__filter-text-value"
|
|
43
43
|
})
|
|
44
44
|
};
|
|
45
|
-
if (
|
|
46
|
-
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name.
|
|
47
|
-
(0, _i18n.__)('<
|
|
45
|
+
if (filterInView?.operator === _constants.OPERATOR_IS_ANY) {
|
|
46
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is any: Admin, Editor". */
|
|
47
|
+
(0, _i18n.__)('<Name>%1$s is any: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
|
|
48
48
|
}
|
|
49
|
-
if (
|
|
50
|
-
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name.
|
|
51
|
-
(0, _i18n.__)('<
|
|
49
|
+
if (filterInView?.operator === _constants.OPERATOR_IS_NONE) {
|
|
50
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is none: Admin, Editor". */
|
|
51
|
+
(0, _i18n.__)('<Name>%1$s is none: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
|
|
52
|
+
}
|
|
53
|
+
if (filterInView?.operator === _constants.OPERATOR_IS_ALL) {
|
|
54
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is all: Admin, Editor". */
|
|
55
|
+
(0, _i18n.__)('<Name>%1$s is all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
|
|
56
|
+
}
|
|
57
|
+
if (filterInView?.operator === _constants.OPERATOR_IS_NOT_ALL) {
|
|
58
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not all: Admin, Editor". */
|
|
59
|
+
(0, _i18n.__)('<Name>%1$s is not all: </Name><Value>%2$s</Value>'), filter.name, activeElements.map(element => element.label).join(', ')), filterTextWrappers);
|
|
60
|
+
}
|
|
61
|
+
if (filterInView?.operator === _constants.OPERATOR_IS) {
|
|
62
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is: Admin". */
|
|
63
|
+
(0, _i18n.__)('<Name>%1$s is: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers);
|
|
64
|
+
}
|
|
65
|
+
if (filterInView?.operator === _constants.OPERATOR_IS_NOT) {
|
|
66
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Filter name. 3: Filter value. e.g.: "Author is not: Admin". */
|
|
67
|
+
(0, _i18n.__)('<Name>%1$s is not: </Name><Value>%2$s</Value>'), filter.name, activeElements[0].label), filterTextWrappers);
|
|
52
68
|
}
|
|
53
69
|
return (0, _i18n.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */
|
|
54
70
|
(0, _i18n.__)('Unknown status for %1$s'), filter.name);
|
|
@@ -110,7 +126,12 @@ function FilterSummary({
|
|
|
110
126
|
onChangeView
|
|
111
127
|
} = commonProps;
|
|
112
128
|
const filterInView = view.filters.find(f => f.field === filter.field);
|
|
113
|
-
const
|
|
129
|
+
const activeElements = filter.elements.filter(element => {
|
|
130
|
+
if (filter.singleSelection) {
|
|
131
|
+
return element.value === filterInView?.value;
|
|
132
|
+
}
|
|
133
|
+
return filterInView?.value?.includes(element.value);
|
|
134
|
+
});
|
|
114
135
|
const isPrimary = filter.isPrimary;
|
|
115
136
|
const hasValues = filterInView?.value !== undefined;
|
|
116
137
|
const canResetOrRemove = !isPrimary || hasValues;
|
|
@@ -151,7 +172,7 @@ function FilterSummary({
|
|
|
151
172
|
"aria-expanded": isOpen,
|
|
152
173
|
ref: toggleRef
|
|
153
174
|
}, (0, _react.createElement)(FilterText, {
|
|
154
|
-
|
|
175
|
+
activeElements: activeElements,
|
|
155
176
|
filterInView: filterInView,
|
|
156
177
|
filter: filter
|
|
157
178
|
}))), canResetOrRemove && (0, _react.createElement)(_components.Tooltip, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_icons","_keycodes","_searchWidget","_constants","FilterText","activeElement","filterInView","filter","undefined","name","filterTextWrappers","Span1","_react","createElement","className","Span2","operator","OPERATOR_IN","createInterpolateElement","sprintf","__","label","OPERATOR_NOT_IN","OperatorSelector","view","onChangeView","operatorOptions","operators","map","value","OPERATORS","currentFilter","filters","find","_filter","field","length","__experimentalHStack","spacing","justify","FlexItem","SelectControl","options","onChange","newValue","newFilters","page","size","__nextHasNoMarginBottom","hideLabelFromVision","FilterSummary","addFilterRef","openedFilter","commonProps","toggleRef","useRef","f","elements","element","isPrimary","hasValues","canResetOrRemove","Dropdown","defaultOpen","contentClassName","popoverProps","placement","role","onClose","current","focus","renderToggle","isOpen","onToggle","Tooltip","text","toLowerCase","classnames","tabIndex","onClick","onKeyDown","event","ENTER","SPACE","includes","keyCode","preventDefault","ref","Icon","icon","closeSmall","renderContent","__experimentalVStack","default"],"sources":["@wordpress/dataviews/src/filter-summary.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n\tSelectControl,\n\tTooltip,\n\tIcon,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, createInterpolateElement } from '@wordpress/element';\nimport { closeSmall } from '@wordpress/icons';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport SearchWidget from './search-widget';\nimport { OPERATOR_IN, OPERATOR_NOT_IN, OPERATORS } from './constants';\n\nconst FilterText = ( { activeElement, filterInView, filter } ) => {\n\tif ( activeElement === undefined ) {\n\t\treturn filter.name;\n\t}\n\n\tconst filterTextWrappers = {\n\t\tSpan1: <span className=\"dataviews-filter-summary__filter-text-name\" />,\n\t\tSpan2: <span className=\"dataviews-filter-summary__filter-text-value\" />,\n\t};\n\n\tif (\n\t\tactiveElement !== undefined &&\n\t\tfilterInView?.operator === OPERATOR_IN\n\t) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 2: Filter value. e.g.: \"Author is Admin\". */\n\t\t\t\t__( '<Span1>%1$s </Span1><Span2>is %2$s</Span2>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElement.label\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif (\n\t\tactiveElement !== undefined &&\n\t\tfilterInView?.operator === OPERATOR_NOT_IN\n\t) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 2: Filter value. e.g.: \"Author is not Admin\". */\n\t\t\t\t__( '<Span1>%1$s </Span1><Span2>is not %2$s</Span2>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElement.label\n\t\t\t),\n\t\t\tfilterTextWrappers\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 OperatorSelector( { filter, view, onChangeView } ) {\n\tconst operatorOptions = filter.operators?.map( ( operator ) => ( {\n\t\tvalue: operator,\n\t\tlabel: OPERATORS[ operator ]?.label,\n\t} ) );\n\tconst currentFilter = view.filters.find(\n\t\t( _filter ) => _filter.field === filter.field\n\t);\n\tconst value = currentFilter?.operator || filter.operators[ 0 ];\n\treturn (\n\t\toperatorOptions.length > 1 && (\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"dataviews-filter-summary__operators-container\"\n\t\t\t>\n\t\t\t\t<FlexItem className=\"dataviews-filter-summary__operators-filter-name\">\n\t\t\t\t\t{ filter.name }\n\t\t\t\t</FlexItem>\n\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Conditions' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\toptions={ operatorOptions }\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\tconst newFilters = currentFilter\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...view.filters.map( ( _filter ) => {\n\t\t\t\t\t\t\t\t\t\tif ( _filter.field === filter.field ) {\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t..._filter,\n\t\t\t\t\t\t\t\t\t\t\t\toperator: newValue,\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\treturn _filter;\n\t\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t...view.filters,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\toperator: newValue,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ];\n\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\tfilters: newFilters,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t)\n\t);\n}\n\nexport default function FilterSummary( {\n\taddFilterRef,\n\topenedFilter,\n\t...commonProps\n} ) {\n\tconst toggleRef = useRef();\n\tconst { filter, view, onChangeView } = commonProps;\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\tconst isPrimary = filter.isPrimary;\n\tconst hasValues = filterInView?.value !== undefined;\n\tconst canResetOrRemove = ! isPrimary || hasValues;\n\treturn (\n\t\t<Dropdown\n\t\t\tdefaultOpen={ openedFilter === filter.field }\n\t\t\tcontentClassName=\"dataviews-filter-summary__popover\"\n\t\t\tpopoverProps={ { placement: 'bottom-start', role: 'dialog' } }\n\t\t\tonClose={ () => {\n\t\t\t\ttoggleRef.current?.focus();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<div className=\"dataviews-filter-summary__chip-container\">\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\ttext={ sprintf(\n\t\t\t\t\t\t\t/* translators: 1: Filter name. */\n\t\t\t\t\t\t\t__( 'Filter by: %1$s' ),\n\t\t\t\t\t\t\tfilter.name.toLowerCase()\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'dataviews-filter-summary__chip',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-reset': canResetOrRemove,\n\t\t\t\t\t\t\t\t\t'has-values': hasValues,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t[ ENTER, SPACE ].includes( event.keyCode )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-pressed={ isOpen }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FilterText\n\t\t\t\t\t\t\t\tactiveElement={ activeElement }\n\t\t\t\t\t\t\t\tfilterInView={ filterInView }\n\t\t\t\t\t\t\t\tfilter={ filter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t{ canResetOrRemove && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\ttext={ isPrimary ? __( 'Reset' ) : __( 'Remove' ) }\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'dataviews-filter-summary__chip-remove',\n\t\t\t\t\t\t\t\t\t{ 'has-values': hasValues }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\t\tfilters: view.filters.filter(\n\t\t\t\t\t\t\t\t\t\t\t( _filter ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t_filter.field !== filter.field\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// If the filter is not primary and can be removed, it will be added\n\t\t\t\t\t\t\t\t\t// back to the available filters from `Add filter` component.\n\t\t\t\t\t\t\t\t\tif ( ! isPrimary ) {\n\t\t\t\t\t\t\t\t\t\taddFilterRef.current?.focus();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// If is primary, focus the toggle button.\n\t\t\t\t\t\t\t\t\t\ttoggleRef.current?.focus();\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<Icon icon={ closeSmall } />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\trenderContent={ () => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 0 } justify=\"flex-start\">\n\t\t\t\t\t\t<OperatorSelector { ...commonProps } />\n\t\t\t\t\t\t<SearchWidget { ...commonProps } />\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAA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AAG,IAAA+D,mBAAU,EACrB,uCAAuC,EACvC;QAAE,YAAY,EAAEjB;MAAU,CAC3B,CAAG;MACHmB,OAAO,EAAGA,CAAA,KAAM;QACftD,YAAY,CAAE;UACb,GAAGD,IAAI;UACPsB,IAAI,EAAE,CAAC;UACPd,OAAO,EAAER,IAAI,CAACQ,OAAO,CAACzB,MAAM,CACzB2B,OAAO,IACRA,OAAO,CAACC,KAAK,KAAK5B,MAAM,CAAC4B,KAC3B;QACD,CAAE,CAAC;QACH;QACA;QACA,IAAK,CAAEwB,SAAS,EAAG;UAClBR,YAAY,CAACkB,OAAO,EAAEC,KAAK,CAAC,CAAC;QAC9B,CAAC,MAAM;UACN;UACAhB,SAAS,CAACe,OAAO,EAAEC,KAAK,CAAC,CAAC;QAC3B;MACD;IAAG,GAEH,IAAA1D,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAA2F,IAAI;MAACC,IAAI,EAAGC;IAAY,CAAE,CACpB,CACA,CAEN,CACH;IACHC,aAAa,EAAGA,CAAA,KAAM;MACrB,OACC,IAAA/E,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAA+F,oBAAM;QAACtD,OAAO,EAAG,CAAG;QAACC,OAAO,EAAC;MAAY,GACzC,IAAA3B,MAAA,CAAAC,aAAA,EAACU,gBAAgB;QAAA,GAAM8B;MAAW,CAAI,CAAC,EACvC,IAAAzC,MAAA,CAAAC,aAAA,EAACX,aAAA,CAAA2F,OAAY;QAAA,GAAMxC;MAAW,CAAI,CAC3B,CAAC;IAEX;EAAG,CACH,CAAC;AAEJ"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_icons","_keycodes","_searchWidget","_constants","FilterText","activeElements","filterInView","filter","undefined","length","name","filterTextWrappers","Name","_react","createElement","className","Value","operator","OPERATOR_IS_ANY","createInterpolateElement","sprintf","__","map","element","label","join","OPERATOR_IS_NONE","OPERATOR_IS_ALL","OPERATOR_IS_NOT_ALL","OPERATOR_IS","OPERATOR_IS_NOT","OperatorSelector","view","onChangeView","operatorOptions","operators","value","OPERATORS","currentFilter","filters","find","_filter","field","__experimentalHStack","spacing","justify","FlexItem","SelectControl","options","onChange","newValue","newFilters","page","size","__nextHasNoMarginBottom","hideLabelFromVision","FilterSummary","addFilterRef","openedFilter","commonProps","toggleRef","useRef","f","elements","singleSelection","includes","isPrimary","hasValues","canResetOrRemove","Dropdown","defaultOpen","contentClassName","popoverProps","placement","role","onClose","current","focus","renderToggle","isOpen","onToggle","Tooltip","text","toLowerCase","classnames","tabIndex","onClick","onKeyDown","event","ENTER","SPACE","keyCode","preventDefault","ref","Icon","icon","closeSmall","renderContent","__experimentalVStack","default"],"sources":["@wordpress/dataviews/src/filter-summary.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n\tSelectControl,\n\tTooltip,\n\tIcon,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, createInterpolateElement } from '@wordpress/element';\nimport { closeSmall } from '@wordpress/icons';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport SearchWidget from './search-widget';\nimport {\n\tOPERATORS,\n\tOPERATOR_IS,\n\tOPERATOR_IS_NOT,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tOPERATOR_IS_ALL,\n\tOPERATOR_IS_NOT_ALL,\n} from './constants';\n\nconst FilterText = ( { activeElements, filterInView, filter } ) => {\n\tif ( activeElements === undefined || activeElements.length === 0 ) {\n\t\treturn filter.name;\n\t}\n\n\tconst filterTextWrappers = {\n\t\tName: <span className=\"dataviews-filter-summary__filter-text-name\" />,\n\t\tValue: <span className=\"dataviews-filter-summary__filter-text-value\" />,\n\t};\n\n\tif ( filterInView?.operator === OPERATOR_IS_ANY ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is any: Admin, Editor\". */\n\t\t\t\t__( '<Name>%1$s is any: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements.map( ( element ) => element.label ).join( ', ' )\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif ( filterInView?.operator === OPERATOR_IS_NONE ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is none: Admin, Editor\". */\n\t\t\t\t__( '<Name>%1$s is none: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements.map( ( element ) => element.label ).join( ', ' )\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif ( filterInView?.operator === OPERATOR_IS_ALL ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is all: Admin, Editor\". */\n\t\t\t\t__( '<Name>%1$s is all: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements.map( ( element ) => element.label ).join( ', ' )\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif ( filterInView?.operator === OPERATOR_IS_NOT_ALL ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is not all: Admin, Editor\". */\n\t\t\t\t__( '<Name>%1$s is not all: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements.map( ( element ) => element.label ).join( ', ' )\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif ( filterInView?.operator === OPERATOR_IS ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is: Admin\". */\n\t\t\t\t__( '<Name>%1$s is: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements[ 0 ].label\n\t\t\t),\n\t\t\tfilterTextWrappers\n\t\t);\n\t}\n\n\tif ( filterInView?.operator === OPERATOR_IS_NOT ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: 1: Filter name. 3: Filter value. e.g.: \"Author is not: Admin\". */\n\t\t\t\t__( '<Name>%1$s is not: </Name><Value>%2$s</Value>' ),\n\t\t\t\tfilter.name,\n\t\t\t\tactiveElements[ 0 ].label\n\t\t\t),\n\t\t\tfilterTextWrappers\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 OperatorSelector( { filter, view, onChangeView } ) {\n\tconst operatorOptions = filter.operators?.map( ( operator ) => ( {\n\t\tvalue: operator,\n\t\tlabel: OPERATORS[ operator ]?.label,\n\t} ) );\n\tconst currentFilter = view.filters.find(\n\t\t( _filter ) => _filter.field === filter.field\n\t);\n\tconst value = currentFilter?.operator || filter.operators[ 0 ];\n\treturn (\n\t\toperatorOptions.length > 1 && (\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"dataviews-filter-summary__operators-container\"\n\t\t\t>\n\t\t\t\t<FlexItem className=\"dataviews-filter-summary__operators-filter-name\">\n\t\t\t\t\t{ filter.name }\n\t\t\t\t</FlexItem>\n\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Conditions' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\toptions={ operatorOptions }\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\tconst newFilters = currentFilter\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t...view.filters.map( ( _filter ) => {\n\t\t\t\t\t\t\t\t\t\tif ( _filter.field === filter.field ) {\n\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t..._filter,\n\t\t\t\t\t\t\t\t\t\t\t\toperator: newValue,\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\treturn _filter;\n\t\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t...view.filters,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfield: filter.field,\n\t\t\t\t\t\t\t\t\t\toperator: newValue,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ];\n\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\tfilters: newFilters,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t)\n\t);\n}\n\nexport default function FilterSummary( {\n\taddFilterRef,\n\topenedFilter,\n\t...commonProps\n} ) {\n\tconst toggleRef = useRef();\n\tconst { filter, view, onChangeView } = commonProps;\n\tconst filterInView = view.filters.find( ( f ) => f.field === filter.field );\n\tconst activeElements = filter.elements.filter( ( element ) => {\n\t\tif ( filter.singleSelection ) {\n\t\t\treturn element.value === filterInView?.value;\n\t\t}\n\t\treturn filterInView?.value?.includes( element.value );\n\t} );\n\tconst isPrimary = filter.isPrimary;\n\tconst hasValues = filterInView?.value !== undefined;\n\tconst canResetOrRemove = ! isPrimary || hasValues;\n\treturn (\n\t\t<Dropdown\n\t\t\tdefaultOpen={ openedFilter === filter.field }\n\t\t\tcontentClassName=\"dataviews-filter-summary__popover\"\n\t\t\tpopoverProps={ { placement: 'bottom-start', role: 'dialog' } }\n\t\t\tonClose={ () => {\n\t\t\t\ttoggleRef.current?.focus();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<div className=\"dataviews-filter-summary__chip-container\">\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\ttext={ sprintf(\n\t\t\t\t\t\t\t/* translators: 1: Filter name. */\n\t\t\t\t\t\t\t__( 'Filter by: %1$s' ),\n\t\t\t\t\t\t\tfilter.name.toLowerCase()\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'dataviews-filter-summary__chip',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-reset': canResetOrRemove,\n\t\t\t\t\t\t\t\t\t'has-values': hasValues,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t[ ENTER, SPACE ].includes( event.keyCode )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-pressed={ isOpen }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FilterText\n\t\t\t\t\t\t\t\tactiveElements={ activeElements }\n\t\t\t\t\t\t\t\tfilterInView={ filterInView }\n\t\t\t\t\t\t\t\tfilter={ filter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t{ canResetOrRemove && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\ttext={ isPrimary ? __( 'Reset' ) : __( 'Remove' ) }\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'dataviews-filter-summary__chip-remove',\n\t\t\t\t\t\t\t\t\t{ 'has-values': hasValues }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonChangeView( {\n\t\t\t\t\t\t\t\t\t\t...view,\n\t\t\t\t\t\t\t\t\t\tpage: 1,\n\t\t\t\t\t\t\t\t\t\tfilters: view.filters.filter(\n\t\t\t\t\t\t\t\t\t\t\t( _filter ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t_filter.field !== filter.field\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// If the filter is not primary and can be removed, it will be added\n\t\t\t\t\t\t\t\t\t// back to the available filters from `Add filter` component.\n\t\t\t\t\t\t\t\t\tif ( ! isPrimary ) {\n\t\t\t\t\t\t\t\t\t\taddFilterRef.current?.focus();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// If is primary, focus the toggle button.\n\t\t\t\t\t\t\t\t\t\ttoggleRef.current?.focus();\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<Icon icon={ closeSmall } />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\trenderContent={ () => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 0 } justify=\"flex-start\">\n\t\t\t\t\t\t<OperatorSelector { ...commonProps } />\n\t\t\t\t\t\t<SearchWidget { ...commonProps } />\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;;AAYA,MAAMQ,UAAU,GAAGA,CAAE;EAAEC,cAAc;EAAEC,YAAY;EAAEC;AAAO,CAAC,KAAM;EAClE,IAAKF,cAAc,KAAKG,SAAS,IAAIH,cAAc,CAACI,MAAM,KAAK,CAAC,EAAG;IAClE,OAAOF,MAAM,CAACG,IAAI;EACnB;EAEA,MAAMC,kBAAkB,GAAG;IAC1BC,IAAI,EAAE,IAAAC,MAAA,CAAAC,aAAA;MAAMC,SAAS,EAAC;IAA4C,CAAE,CAAC;IACrEC,KAAK,EAAE,IAAAH,MAAA,CAAAC,aAAA;MAAMC,SAAS,EAAC;IAA6C,CAAE;EACvE,CAAC;EAED,IAAKT,YAAY,EAAEW,QAAQ,KAAKC,0BAAe,EAAG;IACjD,OAAO,IAAAC,iCAAwB,EAC9B,IAAAC,aAAO,GACN;IACA,IAAAC,QAAE,EAAE,+CAAgD,CAAC,EACrDd,MAAM,CAACG,IAAI,EACXL,cAAc,CAACiB,GAAG,CAAIC,OAAO,IAAMA,OAAO,CAACC,KAAM,CAAC,CAACC,IAAI,CAAE,IAAK,CAC/D,CAAC,EACDd,kBACD,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AA,CAAAqG,oBAAM;QAACtD,OAAO,EAAG,CAAG;QAACC,OAAO,EAAC;MAAY,GACzC,IAAAhC,MAAA,CAAAC,aAAA,EAACiB,gBAAgB;QAAA,GAAM4B;MAAW,CAAI,CAAC,EACvC,IAAA9C,MAAA,CAAAC,aAAA,EAACZ,aAAA,CAAAiG,OAAY;QAAA,GAAMxC;MAAW,CAAI,CAC3B,CAAC;IAEX;EAAG,CACH,CAAC;AAEJ"}
|
package/build/filters.js
CHANGED
|
@@ -48,8 +48,9 @@ const Filters = (0, _element.memo)(function Filters({
|
|
|
48
48
|
field: field.id,
|
|
49
49
|
name: field.header,
|
|
50
50
|
elements: field.elements,
|
|
51
|
+
singleSelection: operators.some(op => [_constants.OPERATOR_IS, _constants.OPERATOR_IS_NOT].includes(op)),
|
|
51
52
|
operators,
|
|
52
|
-
isVisible: isPrimary || view.filters.some(f => f.field === field.id &&
|
|
53
|
+
isVisible: isPrimary || view.filters.some(f => f.field === field.id && _constants.ALL_OPERATORS.includes(f.operator)),
|
|
53
54
|
isPrimary
|
|
54
55
|
});
|
|
55
56
|
}
|
package/build/filters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_filterSummary","_interopRequireDefault","_addFilter","_resetFilters","_utils","_constants","_components","Filters","memo","fields","view","onChangeView","openedFilter","setOpenedFilter","addFilterRef","useRef","filters","forEach","field","type","operators","sanitizeOperators","length","ENUMERATION_TYPE","elements","isPrimary","filterBy","push","id","name","header","
|
|
1
|
+
{"version":3,"names":["_element","require","_filterSummary","_interopRequireDefault","_addFilter","_resetFilters","_utils","_constants","_components","Filters","memo","fields","view","onChangeView","openedFilter","setOpenedFilter","addFilterRef","useRef","filters","forEach","field","type","operators","sanitizeOperators","length","ENUMERATION_TYPE","elements","isPrimary","filterBy","push","id","name","header","singleSelection","some","op","OPERATOR_IS","OPERATOR_IS_NOT","includes","isVisible","f","ALL_OPERATORS","operator","sort","a","b","localeCompare","addFilter","_react","createElement","default","key","ref","filterComponents","map","filter","__experimentalHStack","justify","style","width","wrap","_default","exports"],"sources":["@wordpress/dataviews/src/filters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FilterSummary from './filter-summary';\nimport AddFilter from './add-filter';\nimport ResetFilters from './reset-filters';\nimport { sanitizeOperators } from './utils';\nimport {\n\tENUMERATION_TYPE,\n\tALL_OPERATORS,\n\tOPERATOR_IS,\n\tOPERATOR_IS_NOT,\n} from './constants';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\nconst Filters = memo( function Filters( {\n\tfields,\n\tview,\n\tonChangeView,\n\topenedFilter,\n\tsetOpenedFilter,\n} ) {\n\tconst addFilterRef = useRef();\n\tconst filters = [];\n\tfields.forEach( ( field ) => {\n\t\tif ( ! field.type ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst operators = sanitizeOperators( field );\n\t\tif ( operators.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( field.type ) {\n\t\t\tcase ENUMERATION_TYPE:\n\t\t\t\tif ( ! field.elements?.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst isPrimary = !! field.filterBy?.isPrimary;\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\tsingleSelection: operators.some( ( op ) =>\n\t\t\t\t\t\t[ OPERATOR_IS, OPERATOR_IS_NOT ].includes( op )\n\t\t\t\t\t),\n\t\t\t\t\toperators,\n\t\t\t\t\tisVisible:\n\t\t\t\t\t\tisPrimary ||\n\t\t\t\t\t\tview.filters.some(\n\t\t\t\t\t\t\t( f ) =>\n\t\t\t\t\t\t\t\tf.field === field.id &&\n\t\t\t\t\t\t\t\tALL_OPERATORS.includes( f.operator )\n\t\t\t\t\t\t),\n\t\t\t\t\tisPrimary,\n\t\t\t\t} );\n\t\t}\n\t} );\n\t// Sort filters by primary property. We need the primary filters to be first.\n\t// Then we sort by name.\n\tfilters.sort( ( a, b ) => {\n\t\tif ( a.isPrimary && ! b.isPrimary ) {\n\t\t\treturn -1;\n\t\t}\n\t\tif ( ! a.isPrimary && b.isPrimary ) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn a.name.localeCompare( b.name );\n\t} );\n\tconst addFilter = (\n\t\t<AddFilter\n\t\t\tkey=\"add-filter\"\n\t\t\tfilters={ filters }\n\t\t\tview={ view }\n\t\t\tonChangeView={ onChangeView }\n\t\t\tref={ addFilterRef }\n\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t/>\n\t);\n\tconst filterComponents = [\n\t\t...filters.map( ( filter ) => {\n\t\t\tif ( ! filter.isVisible ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<FilterSummary\n\t\t\t\t\tkey={ filter.field }\n\t\t\t\t\tfilter={ filter }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\t\taddFilterRef={ addFilterRef }\n\t\t\t\t\topenedFilter={ openedFilter }\n\t\t\t\t/>\n\t\t\t);\n\t\t} ),\n\t\taddFilter,\n\t];\n\n\tif ( filterComponents.length > 1 ) {\n\t\tfilterComponents.push(\n\t\t\t<ResetFilters\n\t\t\t\tkey=\"reset-filters\"\n\t\t\t\tfilters={ filters }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<HStack justify=\"flex-start\" style={ { width: 'fit-content' } } wrap>\n\t\t\t{ filterComponents }\n\t\t</HStack>\n\t);\n} );\n\nexport default Filters;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,G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,IAAAmB,MAAA,CAAAC,aAAA,EAAC5C,aAAA,CAAA6C,OAAY;MACZC,GAAG,EAAC,eAAe;MACnBjC,OAAO,EAAGA,OAAS;MACnBN,IAAI,EAAGA,IAAM;MACbC,YAAY,EAAGA;IAAc,CAC7B,CACF,CAAC;EACF;EAEA,OACC,IAAAmC,MAAA,CAAAC,aAAA,EAACzC,WAAA,CAAAgD,oBAAM;IAACC,OAAO,EAAC,YAAY;IAACC,KAAK,EAAG;MAAEC,KAAK,EAAE;IAAc,CAAG;IAACC,IAAI;EAAA,GACjEP,gBACK,CAAC;AAEX,CAAE,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEWzC,OAAO"}
|
package/build/item-actions.js
CHANGED
|
@@ -101,35 +101,27 @@ function ItemActions({
|
|
|
101
101
|
}) {
|
|
102
102
|
const {
|
|
103
103
|
primaryActions,
|
|
104
|
-
|
|
104
|
+
eligibleActions
|
|
105
105
|
} = (0, _element.useMemo)(() => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} else {
|
|
115
|
-
accumulator.secondaryActions.push(action);
|
|
116
|
-
}
|
|
117
|
-
return accumulator;
|
|
118
|
-
}, {
|
|
119
|
-
primaryActions: [],
|
|
120
|
-
secondaryActions: []
|
|
121
|
-
});
|
|
106
|
+
// If an action is eligible for all items, doesn't need
|
|
107
|
+
// to provide the `isEligible` function.
|
|
108
|
+
const _eligibleActions = actions.filter(action => !action.isEligible || action.isEligible(item));
|
|
109
|
+
const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon);
|
|
110
|
+
return {
|
|
111
|
+
primaryActions: _primaryActions,
|
|
112
|
+
eligibleActions: _eligibleActions
|
|
113
|
+
};
|
|
122
114
|
}, [actions, item]);
|
|
123
115
|
if (isCompact) {
|
|
124
116
|
return (0, _react.createElement)(CompactItemActions, {
|
|
125
117
|
item: item,
|
|
126
|
-
|
|
127
|
-
secondaryActions: secondaryActions
|
|
118
|
+
actions: eligibleActions
|
|
128
119
|
});
|
|
129
120
|
}
|
|
130
121
|
return (0, _react.createElement)(_components.__experimentalHStack, {
|
|
131
122
|
spacing: 1,
|
|
132
123
|
justify: "flex-end",
|
|
124
|
+
className: "dataviews-item-actions",
|
|
133
125
|
style: {
|
|
134
126
|
flexShrink: '0',
|
|
135
127
|
width: 'auto'
|
|
@@ -148,37 +140,26 @@ function ItemActions({
|
|
|
148
140
|
action: action,
|
|
149
141
|
onClick: () => action.callback([item])
|
|
150
142
|
});
|
|
151
|
-
}), (0, _react.createElement)(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
label: (0, _i18n.__)('Actions'),
|
|
156
|
-
disabled: !secondaryActions.length
|
|
157
|
-
}),
|
|
158
|
-
placement: "bottom-end"
|
|
159
|
-
}, (0, _react.createElement)(ActionsDropdownMenuGroup, {
|
|
160
|
-
actions: secondaryActions,
|
|
161
|
-
item: item
|
|
162
|
-
})));
|
|
143
|
+
}), (0, _react.createElement)(CompactItemActions, {
|
|
144
|
+
item: item,
|
|
145
|
+
actions: eligibleActions
|
|
146
|
+
}));
|
|
163
147
|
}
|
|
164
148
|
function CompactItemActions({
|
|
165
149
|
item,
|
|
166
|
-
|
|
167
|
-
secondaryActions
|
|
150
|
+
actions
|
|
168
151
|
}) {
|
|
169
152
|
return (0, _react.createElement)(DropdownMenu, {
|
|
170
153
|
trigger: (0, _react.createElement)(_components.Button, {
|
|
171
154
|
size: "compact",
|
|
172
155
|
icon: _icons.moreVertical,
|
|
173
156
|
label: (0, _i18n.__)('Actions'),
|
|
174
|
-
disabled: !
|
|
157
|
+
disabled: !actions.length,
|
|
158
|
+
className: "dataviews-all-actions-button"
|
|
175
159
|
}),
|
|
176
160
|
placement: "bottom-end"
|
|
177
|
-
},
|
|
178
|
-
actions:
|
|
179
|
-
item: item
|
|
180
|
-
}), !!secondaryActions.length && (0, _react.createElement)(ActionsDropdownMenuGroup, {
|
|
181
|
-
actions: secondaryActions,
|
|
161
|
+
}, (0, _react.createElement)(ActionsDropdownMenuGroup, {
|
|
162
|
+
actions: actions,
|
|
182
163
|
item: item
|
|
183
164
|
}));
|
|
184
165
|
}
|