From 3dece5ef458978a018f4280abfaa4e39ad92e554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:20:30 +0100 Subject: [PATCH] Documentation: move docs for filters to proper place (#66743) --- packages/dataviews/README.md | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/dataviews/README.md b/packages/dataviews/README.md index 79875542378b3..00ab60ff5d047 100644 --- a/packages/dataviews/README.md +++ b/packages/dataviews/README.md @@ -142,9 +142,22 @@ Each field is an object with the following properties: - `enableHiding`: whether the field can be hidden. True by default. - `enableGlobalSearch`: whether the field is searchable. False by default. - `filterBy`: configuration for the filters enabled by the `elements` property. - - `operators`: the list of [operators](#operators) supported by the field. + - `operators`: the list of operators supported by the field. - `isPrimary`: whether it is a primary filter. A primary filter is always visible and is not listed in the "Add filter" component, except for the list layout where it behaves like a secondary filter. +##### Filter operators + +| Operator | Selection | Description | Example | +| ---------- | -------------- | ----------------------------------------------------------------------- | -------------------------------------------------- | +| `is` | Single item | `EQUAL TO`. The item's field is equal to a single value. | Author is Admin | +| `isNot` | Single item | `NOT EQUAL TO`. The item's field is not equal to a single value. | Author is not Admin | +| `isAny` | Multiple items | `OR`. The item's field is present in a list of values. | Author is any: Admin, Editor | +| `isNone` | Multiple items | `NOT OR`. The item's field is not present in a list of values. | Author is none: Admin, Editor | +| `isAll` | Multiple items | `AND`. The item's field has all of the values in the list. | Category is all: Book, Review, Science Fiction | +| `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 | + +`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. + #### `view`: `object` The view object configures how the dataset is visible to the user. @@ -188,23 +201,6 @@ Properties: - `fields`: the `id` of the fields that are visible in the UI and the specific order in which they are displayed. - `layout`: config that is specific to a particular layout type. -##### Filter operators - -Allowed operators: - -| Operator | Selection | Description | Example | -| ---------- | -------------- | ----------------------------------------------------------------------- | -------------------------------------------------- | -| `is` | Single item | `EQUAL TO`. The item's field is equal to a single value. | Author is Admin | -| `isNot` | Single item | `NOT EQUAL TO`. The item's field is not equal to a single value. | Author is not Admin | -| `isAny` | Multiple items | `OR`. The item's field is present in a list of values. | Author is any: Admin, Editor | -| `isNone` | Multiple items | `NOT OR`. The item's field is not present in a list of values. | Author is none: Admin, Editor | -| `isAll` | Multiple items | `AND`. The item's field has all of the values in the list. | Category is all: Book, Review, Science Fiction | -| `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 | - -`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. - -> 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. - ##### Properties of `layout` | Properties of `layout` | Table | Grid | List |