@wordpress/dataviews 8.0.1-next.e256d081a.0 → 9.0.1-next.6870dfe5b.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 +24 -1
- package/README.md +96 -1
- package/build/components/dataform-context/index.js +1 -0
- package/build/components/dataform-context/index.js.map +1 -1
- package/build/components/dataviews/index.js +11 -1
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews-context/index.js +1 -0
- package/build/components/dataviews-context/index.js.map +1 -1
- package/build/components/dataviews-layout/index.js +2 -1
- package/build/components/dataviews-layout/index.js.map +1 -1
- package/build/components/dataviews-picker/footer.js +145 -0
- package/build/components/dataviews-picker/footer.js.map +1 -0
- package/build/components/dataviews-picker/index.js +201 -0
- package/build/components/dataviews-picker/index.js.map +1 -0
- package/build/components/dataviews-selection-checkbox/index.js +4 -2
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +1 -0
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/constants.js +4 -1
- package/build/constants.js.map +1 -1
- package/build/dataform-controls/checkbox.js +23 -2
- package/build/dataform-controls/checkbox.js.map +1 -1
- package/build/dataform-controls/color.js +128 -0
- package/build/dataform-controls/color.js.map +1 -0
- package/build/dataform-controls/email.js +10 -45
- package/build/dataform-controls/email.js.map +1 -1
- package/build/dataform-controls/index.js +8 -2
- package/build/dataform-controls/index.js.map +1 -1
- package/build/dataform-controls/telephone.js +34 -0
- package/build/dataform-controls/telephone.js.map +1 -0
- package/build/dataform-controls/text.js +7 -48
- package/build/dataform-controls/text.js.map +1 -1
- package/build/dataform-controls/{boolean.js → toggle.js} +6 -4
- package/build/dataform-controls/toggle.js.map +1 -0
- package/build/dataform-controls/url.js +34 -0
- package/build/dataform-controls/url.js.map +1 -0
- package/build/dataform-controls/utils/validated-text.js +76 -0
- package/build/dataform-controls/utils/validated-text.js.map +1 -0
- package/build/dataforms-layouts/card/index.js +6 -7
- package/build/dataforms-layouts/card/index.js.map +1 -1
- package/build/dataforms-layouts/data-form-layout.js +16 -4
- package/build/dataforms-layouts/data-form-layout.js.map +1 -1
- package/build/dataforms-layouts/index.js +31 -1
- package/build/dataforms-layouts/index.js.map +1 -1
- package/build/dataforms-layouts/row/index.js +113 -0
- package/build/dataforms-layouts/row/index.js.map +1 -0
- package/build/dataviews-layouts/grid/index.js +16 -11
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/index.js +9 -1
- package/build/dataviews-layouts/index.js.map +1 -1
- package/build/dataviews-layouts/picker-grid/index.js +357 -0
- package/build/dataviews-layouts/picker-grid/index.js.map +1 -0
- package/build/dataviews-layouts/utils/grid-items.js +37 -0
- package/build/dataviews-layouts/utils/grid-items.js.map +1 -0
- package/build/dataviews-layouts/utils/preview-size-picker.js +81 -0
- package/build/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
- package/build/field-types/boolean.js +1 -1
- package/build/field-types/boolean.js.map +1 -1
- package/build/field-types/color.js +113 -0
- package/build/field-types/color.js.map +1 -0
- package/build/field-types/index.js +12 -0
- package/build/field-types/index.js.map +1 -1
- package/build/field-types/telephone.js +57 -0
- package/build/field-types/telephone.js.map +1 -0
- package/build/field-types/url.js +57 -0
- package/build/field-types/url.js.map +1 -0
- package/build/normalize-form-fields.js +6 -0
- package/build/normalize-form-fields.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build/validation.js +1 -1
- package/build/validation.js.map +1 -1
- package/build-module/components/dataform-context/index.js +1 -0
- package/build-module/components/dataform-context/index.js.map +1 -1
- package/build-module/components/dataviews/index.js +11 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-context/index.js +1 -0
- package/build-module/components/dataviews-context/index.js.map +1 -1
- package/build-module/components/dataviews-layout/index.js +2 -1
- package/build-module/components/dataviews-layout/index.js.map +1 -1
- package/build-module/components/dataviews-picker/footer.js +136 -0
- package/build-module/components/dataviews-picker/footer.js.map +1 -0
- package/build-module/components/dataviews-picker/index.js +191 -0
- package/build-module/components/dataviews-picker/index.js.map +1 -0
- package/build-module/components/dataviews-selection-checkbox/index.js +4 -2
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +1 -0
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/constants.js +3 -0
- package/build-module/constants.js.map +1 -1
- package/build-module/dataform-controls/checkbox.js +25 -3
- package/build-module/dataform-controls/checkbox.js.map +1 -1
- package/build-module/dataform-controls/color.js +122 -0
- package/build-module/dataform-controls/color.js.map +1 -0
- package/build-module/dataform-controls/email.js +9 -45
- package/build-module/dataform-controls/email.js.map +1 -1
- package/build-module/dataform-controls/index.js +8 -2
- package/build-module/dataform-controls/index.js.map +1 -1
- package/build-module/dataform-controls/telephone.js +27 -0
- package/build-module/dataform-controls/telephone.js.map +1 -0
- package/build-module/dataform-controls/text.js +6 -48
- package/build-module/dataform-controls/text.js.map +1 -1
- package/build-module/dataform-controls/{boolean.js → toggle.js} +5 -3
- package/build-module/dataform-controls/toggle.js.map +1 -0
- package/build-module/dataform-controls/url.js +27 -0
- package/build-module/dataform-controls/url.js.map +1 -0
- package/build-module/dataform-controls/utils/validated-text.js +70 -0
- package/build-module/dataform-controls/utils/validated-text.js.map +1 -0
- package/build-module/dataforms-layouts/card/index.js +6 -7
- package/build-module/dataforms-layouts/card/index.js.map +1 -1
- package/build-module/dataforms-layouts/data-form-layout.js +14 -4
- package/build-module/dataforms-layouts/data-form-layout.js.map +1 -1
- package/build-module/dataforms-layouts/index.js +32 -1
- package/build-module/dataforms-layouts/index.js.map +1 -1
- package/build-module/dataforms-layouts/row/index.js +106 -0
- package/build-module/dataforms-layouts/row/index.js.map +1 -0
- package/build-module/dataviews-layouts/grid/index.js +16 -11
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/index.js +10 -2
- package/build-module/dataviews-layouts/index.js.map +1 -1
- package/build-module/dataviews-layouts/picker-grid/index.js +348 -0
- package/build-module/dataviews-layouts/picker-grid/index.js.map +1 -0
- package/build-module/dataviews-layouts/utils/grid-items.js +29 -0
- package/build-module/dataviews-layouts/utils/grid-items.js.map +1 -0
- package/build-module/dataviews-layouts/utils/preview-size-picker.js +73 -0
- package/build-module/dataviews-layouts/utils/preview-size-picker.js.map +1 -0
- package/build-module/field-types/boolean.js +1 -1
- package/build-module/field-types/boolean.js.map +1 -1
- package/build-module/field-types/color.js +107 -0
- package/build-module/field-types/color.js.map +1 -0
- package/build-module/field-types/index.js +12 -0
- package/build-module/field-types/index.js.map +1 -1
- package/build-module/field-types/telephone.js +51 -0
- package/build-module/field-types/telephone.js.map +1 -0
- package/build-module/field-types/url.js +51 -0
- package/build-module/field-types/url.js.map +1 -0
- package/build-module/normalize-form-fields.js +6 -0
- package/build-module/normalize-form-fields.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-module/validation.js +1 -1
- package/build-module/validation.js.map +1 -1
- package/build-style/style-rtl.css +252 -12
- package/build-style/style.css +252 -12
- package/build-types/components/dataform/stories/index.story.d.ts +19 -4
- package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/components/dataform-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews/index.d.ts +1 -1
- package/build-types/components/dataviews/index.d.ts.map +1 -1
- package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
- package/build-types/components/dataviews-context/index.d.ts +1 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-picker/footer.d.ts +4 -0
- package/build-types/components/dataviews-picker/footer.d.ts.map +1 -0
- package/build-types/components/dataviews-picker/index.d.ts +55 -0
- package/build-types/components/dataviews-picker/index.d.ts.map +1 -0
- package/build-types/components/dataviews-picker/stories/index.story.d.ts +42 -0
- package/build-types/components/dataviews-picker/stories/index.story.d.ts.map +1 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts +2 -1
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/constants.d.ts +1 -0
- package/build-types/constants.d.ts.map +1 -1
- package/build-types/dataform-controls/checkbox.d.ts.map +1 -1
- package/build-types/dataform-controls/color.d.ts +6 -0
- package/build-types/dataform-controls/color.d.ts.map +1 -0
- package/build-types/dataform-controls/email.d.ts.map +1 -1
- package/build-types/dataform-controls/index.d.ts.map +1 -1
- package/build-types/dataform-controls/telephone.d.ts +6 -0
- package/build-types/dataform-controls/telephone.d.ts.map +1 -0
- package/build-types/dataform-controls/text.d.ts.map +1 -1
- package/build-types/dataform-controls/toggle.d.ts +6 -0
- package/build-types/dataform-controls/toggle.d.ts.map +1 -0
- package/build-types/dataform-controls/url.d.ts +6 -0
- package/build-types/dataform-controls/url.d.ts.map +1 -0
- package/build-types/dataform-controls/utils/validated-text.d.ts +16 -0
- package/build-types/dataform-controls/utils/validated-text.d.ts.map +1 -0
- package/build-types/dataforms-layouts/card/index.d.ts +0 -3
- package/build-types/dataforms-layouts/card/index.d.ts.map +1 -1
- package/build-types/dataforms-layouts/data-form-layout.d.ts +4 -1
- package/build-types/dataforms-layouts/data-form-layout.d.ts.map +1 -1
- package/build-types/dataforms-layouts/index.d.ts +10 -0
- package/build-types/dataforms-layouts/index.d.ts.map +1 -1
- package/build-types/dataforms-layouts/row/index.d.ts +6 -0
- package/build-types/dataforms-layouts/row/index.d.ts.map +1 -0
- package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/index.d.ts +12 -1
- package/build-types/dataviews-layouts/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/picker-grid/index.d.ts +4 -0
- package/build-types/dataviews-layouts/picker-grid/index.d.ts.map +1 -0
- package/build-types/dataviews-layouts/utils/grid-items.d.ts +5 -0
- package/build-types/dataviews-layouts/utils/grid-items.d.ts.map +1 -0
- package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts +2 -0
- package/build-types/dataviews-layouts/utils/preview-size-picker.d.ts.map +1 -0
- package/build-types/field-types/color.d.ts +20 -0
- package/build-types/field-types/color.d.ts.map +1 -0
- package/build-types/field-types/index.d.ts.map +1 -1
- package/build-types/field-types/stories/index.story.d.ts +81 -0
- package/build-types/field-types/stories/index.story.d.ts.map +1 -0
- package/build-types/field-types/telephone.d.ts +20 -0
- package/build-types/field-types/telephone.d.ts.map +1 -0
- package/build-types/field-types/url.d.ts +20 -0
- package/build-types/field-types/url.d.ts.map +1 -0
- package/build-types/normalize-form-fields.d.ts.map +1 -1
- package/build-types/test/dataviews-picker.d.ts +2 -0
- package/build-types/test/dataviews-picker.d.ts.map +1 -0
- package/build-types/types.d.ts +36 -5
- package/build-types/types.d.ts.map +1 -1
- package/build-types/validation.d.ts.map +1 -1
- package/build-wp/index.js +5061 -4013
- package/package.json +16 -15
- package/src/components/dataform/stories/index.story.tsx +333 -11
- package/src/components/dataform-context/index.tsx +1 -0
- package/src/components/dataviews/index.tsx +25 -1
- package/src/components/dataviews/stories/fixtures.tsx +1 -1
- package/src/components/dataviews/stories/index.story.tsx +14 -0
- package/src/components/dataviews/style.scss +4 -2
- package/src/components/dataviews-context/index.ts +3 -0
- package/src/components/dataviews-layout/index.tsx +4 -2
- package/src/components/dataviews-picker/footer.tsx +207 -0
- package/src/components/dataviews-picker/index.tsx +284 -0
- package/src/components/dataviews-picker/stories/index.story.tsx +251 -0
- package/src/components/dataviews-picker/style.scss +10 -0
- package/src/components/dataviews-selection-checkbox/index.tsx +3 -0
- package/src/components/dataviews-view-config/index.tsx +1 -0
- package/src/constants.ts +3 -0
- package/src/dataform-controls/checkbox.tsx +33 -3
- package/src/dataform-controls/color.tsx +139 -0
- package/src/dataform-controls/email.tsx +10 -52
- package/src/dataform-controls/index.tsx +8 -2
- package/src/dataform-controls/telephone.tsx +30 -0
- package/src/dataform-controls/text.tsx +2 -57
- package/src/dataform-controls/{boolean.tsx → toggle.tsx} +3 -2
- package/src/dataform-controls/url.tsx +30 -0
- package/src/dataform-controls/utils/validated-text.tsx +96 -0
- package/src/dataforms-layouts/card/index.tsx +5 -4
- package/src/dataforms-layouts/card/style.scss +7 -0
- package/src/dataforms-layouts/data-form-layout.tsx +15 -3
- package/src/dataforms-layouts/index.tsx +35 -0
- package/src/dataforms-layouts/row/index.tsx +115 -0
- package/src/dataforms-layouts/row/style.scss +3 -0
- package/src/dataviews-layouts/grid/index.tsx +38 -33
- package/src/dataviews-layouts/grid/style.scss +42 -20
- package/src/dataviews-layouts/index.ts +16 -2
- package/src/dataviews-layouts/picker-grid/index.tsx +490 -0
- package/src/dataviews-layouts/picker-grid/style.scss +171 -0
- package/src/dataviews-layouts/utils/grid-items.scss +21 -0
- package/src/dataviews-layouts/utils/grid-items.tsx +35 -0
- package/src/dataviews-layouts/utils/preview-size-picker.tsx +87 -0
- package/src/field-types/boolean.tsx +1 -1
- package/src/field-types/color.tsx +115 -0
- package/src/field-types/index.tsx +15 -0
- package/src/field-types/stories/index.story.tsx +719 -0
- package/src/field-types/telephone.tsx +71 -0
- package/src/field-types/url.tsx +71 -0
- package/src/normalize-form-fields.ts +6 -0
- package/src/style.scss +4 -0
- package/src/test/dataform.tsx +2 -2
- package/src/test/dataviews-picker.tsx +478 -0
- package/src/test/dataviews.tsx +86 -0
- package/src/types.ts +56 -4
- package/src/validation.ts +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataform-controls/boolean.js.map +0 -1
- package/build-module/dataform-controls/boolean.js.map +0 -1
- package/build-types/components/stories/index.story.d.ts +0 -63
- package/build-types/components/stories/index.story.d.ts.map +0 -1
- package/build-types/dataform-controls/boolean.d.ts +0 -6
- package/build-types/dataform-controls/boolean.d.ts.map +0 -1
- package/src/components/stories/index.story.tsx +0 -372
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tReactNode,\n\tComponentType,\n\tComponentProps,\n} from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport interface NormalizedFilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'array';\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: Rules< Item >;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string | null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\n};\n\nexport type Rules< Item > = {\n\trequired?: boolean;\n\tcustom?: ( item: Item, field: NormalizedField< Item > ) => null | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: Rules< Item >;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: Rules< Item >;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\n\tconfig?: {\n\t\tsizes: string;\n\t};\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked?: boolean;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n\n\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\n\n\t/**\n\t * Whether infinite scroll is enabled.\n\t */\n\tinfiniteScrollEnabled?: boolean;\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n\n\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\n\t\t/**\n\t\t * Whether the view allows column moving.\n\t\t */\n\t\tenableMoving?: boolean;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n\n\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\n\tempty: ReactNode;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\n/**\n * DataForm layouts.\n */\nexport type LayoutType = 'regular' | 'panel' | 'card';\nexport type LabelPosition = 'top' | 'side' | 'none';\n\nexport type RegularLayout = {\n\ttype: 'regular';\n\tlabelPosition?: LabelPosition;\n};\nexport type NormalizedRegularLayout = {\n\ttype: 'regular';\n\tlabelPosition: LabelPosition;\n};\n\nexport type PanelLayout = {\n\ttype: 'panel';\n\tlabelPosition?: LabelPosition;\n\topenAs?: 'dropdown' | 'modal';\n};\nexport type NormalizedPanelLayout = {\n\ttype: 'panel';\n\tlabelPosition: LabelPosition;\n\topenAs: 'dropdown' | 'modal';\n};\n\nexport type CardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened?: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader?: true | undefined;\n\t\t\tisOpened?: boolean;\n\t };\nexport type NormalizedCardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: true;\n\t\t\tisOpened: boolean;\n\t };\n\nexport type Layout = RegularLayout | PanelLayout | CardLayout;\nexport type NormalizedLayout =\n\t| NormalizedRegularLayout\n\t| NormalizedPanelLayout\n\t| NormalizedCardLayout;\n\nexport type SimpleFormField = {\n\tid: string;\n\tlayout?: Layout;\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tlayout?: Layout;\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\tlayout?: Layout;\n\tfields?: Array< FormField | string >;\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tReactNode,\n\tComponentType,\n\tComponentProps,\n} from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\nexport interface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport interface NormalizedFilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'telephone'\n\t| 'color'\n\t| 'url'\n\t| 'array';\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: Rules< Item >;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string | null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\n};\n\nexport type Rules< Item > = {\n\trequired?: boolean;\n\tcustom?: ( item: Item, field: NormalizedField< Item > ) => null | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: Rules< Item >;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: Rules< Item >;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\n\tconfig?: {\n\t\tsizes: string;\n\t};\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked?: boolean;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n\n\t/**\n\t * Whether the filter can be edited by the user.\n\t */\n\tisLocked: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n\n\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\n\n\t/**\n\t * Whether infinite scroll is enabled.\n\t */\n\tinfiniteScrollEnabled?: boolean;\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n\n\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\n\t\t/**\n\t\t * Whether the view allows column moving.\n\t\t */\n\t\tenableMoving?: boolean;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport interface ViewPickerGrid extends ViewBase {\n\ttype: 'pickerGrid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable | ViewPickerGrid;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n\n\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\n\tempty: ReactNode;\n}\n\nexport type ViewPickerBaseProps< Item > = Omit<\n\tViewBaseProps< Item >,\n\t| 'view'\n\t| 'onChangeView'\n\t// The following props are not supported for pickers.\n\t| 'isItemClickable'\n\t| 'onClickItem'\n\t| 'renderItemLink'\n\t| 'getItemLevel'\n> & {\n\tview: View;\n\tonChangeView: ( view: View ) => void;\n};\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport interface ViewPickerGridProps< Item >\n\textends Omit< ViewPickerBaseProps< Item >, 'view' > {\n\tview: ViewPickerGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport type ViewPickerProps< Item > = ViewPickerGridProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n\tpickerGrid?: Omit< ViewPickerGrid, 'type' >;\n}\n\n/**\n * DataForm layouts.\n */\nexport type LayoutType = 'regular' | 'panel' | 'card' | 'row';\nexport type LabelPosition = 'top' | 'side' | 'none';\n\nexport type RegularLayout = {\n\ttype: 'regular';\n\tlabelPosition?: LabelPosition;\n};\nexport type NormalizedRegularLayout = {\n\ttype: 'regular';\n\tlabelPosition: LabelPosition;\n};\n\nexport type PanelLayout = {\n\ttype: 'panel';\n\tlabelPosition?: LabelPosition;\n\topenAs?: 'dropdown' | 'modal';\n};\nexport type NormalizedPanelLayout = {\n\ttype: 'panel';\n\tlabelPosition: LabelPosition;\n\topenAs: 'dropdown' | 'modal';\n};\n\nexport type CardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened?: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader?: true | undefined;\n\t\t\tisOpened?: boolean;\n\t };\nexport type NormalizedCardLayout =\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: false;\n\t\t\t// isOpened cannot be false if withHeader is false as well.\n\t\t\t// Otherwise, the card would not be visible.\n\t\t\tisOpened: true;\n\t }\n\t| {\n\t\t\ttype: 'card';\n\t\t\twithHeader: true;\n\t\t\tisOpened: boolean;\n\t };\n\nexport type RowLayout = {\n\ttype: 'row';\n\talignment?: 'start' | 'center' | 'end';\n};\nexport type NormalizedRowLayout = {\n\ttype: 'row';\n\talignment: 'start' | 'center' | 'end';\n};\n\nexport type Layout = RegularLayout | PanelLayout | CardLayout | RowLayout;\nexport type NormalizedLayout =\n\t| NormalizedRegularLayout\n\t| NormalizedPanelLayout\n\t| NormalizedCardLayout\n\t| NormalizedRowLayout;\n\nexport type SimpleFormField = {\n\tid: string;\n\tlayout?: Layout;\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tdescription?: string;\n\tlayout?: Layout;\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\tlayout?: Layout;\n\tfields?: Array< FormField | string >;\n};\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ export function isItemValid(item, fields, form) {
|
|
|
21
21
|
item
|
|
22
22
|
});
|
|
23
23
|
if (field.isValid.required) {
|
|
24
|
-
if (field.type === 'text' && isEmptyNullOrUndefined(value) || field.type === 'email' && isEmptyNullOrUndefined(value) || field.type === 'integer' && isEmptyNullOrUndefined(value) || field.type === undefined && isEmptyNullOrUndefined(value)) {
|
|
24
|
+
if (field.type === 'text' && isEmptyNullOrUndefined(value) || field.type === 'email' && isEmptyNullOrUndefined(value) || field.type === 'url' && isEmptyNullOrUndefined(value) || field.type === 'telephone' && isEmptyNullOrUndefined(value) || field.type === 'integer' && isEmptyNullOrUndefined(value) || field.type === undefined && isEmptyNullOrUndefined(value)) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
if (field.type === 'boolean' && value !== true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","isEmptyNullOrUndefined","value","undefined","every","field","getValue","isValid","required","type","custom"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\n\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\n\tconst isEmptyNullOrUndefined = ( value: any ) =>\n\t\t[ undefined, '', null ].includes( value );\n\n\treturn _fields.every( ( field ) => {\n\t\tconst value = field.getValue( { item } );\n\n\t\tif ( field.isValid.required ) {\n\t\t\tif (\n\t\t\t\t( field.type === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'integer' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === undefined && isEmptyNullOrUndefined( value ) )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( field.type === 'boolean' && value !== true ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\ttypeof field.isValid.custom === 'function' &&\n\t\t\tfield.isValid.custom( item, field ) !== null\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;EAED,MAAME,sBAAsB,GAAKC,KAAU,IAC1C,CAAEC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAE,CAACH,QAAQ,CAAEE,KAAM,CAAC;EAE1C,OAAOL,OAAO,CAACO,KAAK,CAAIC,KAAK,IAAM;IAClC,MAAMH,KAAK,GAAGG,KAAK,CAACC,QAAQ,CAAE;MAAEZ;IAAK,CAAE,CAAC;IAExC,IAAKW,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAG;MAC7B,IACGH,KAAK,CAACI,IAAI,KAAK,MAAM,IAAIR,sBAAsB,CAAEC,KAAM,CAAC,IACxDG,KAAK,CAACI,IAAI,KAAK,OAAO,IAAIR,sBAAsB,CAAEC,KAAM,CAAG,IAC3DG,KAAK,CAACI,IAAI,KAAK,SAAS,IACzBR,sBAAsB,CAAEC,KAAM,CAAG,IAChCG,KAAK,CAACI,IAAI,KAAKN,SAAS,IAAIF,sBAAsB,CAAEC,KAAM,CAAG,EAC9D;QACD,OAAO,KAAK;MACb;MAEA,IAAKG,KAAK,CAACI,IAAI,KAAK,SAAS,IAAIP,KAAK,KAAK,IAAI,EAAG;QACjD,OAAO,KAAK;MACb;IACD;IAEA,IACC,OAAOG,KAAK,CAACE,OAAO,CAACG,MAAM,KAAK,UAAU,IAC1CL,KAAK,CAACE,OAAO,CAACG,MAAM,CAAEhB,IAAI,EAAEW,KAAM,CAAC,KAAK,IAAI,EAC3C;MACD,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","isEmptyNullOrUndefined","value","undefined","every","field","getValue","isValid","required","type","custom"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\n\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\n\tconst isEmptyNullOrUndefined = ( value: any ) =>\n\t\t[ undefined, '', null ].includes( value );\n\n\treturn _fields.every( ( field ) => {\n\t\tconst value = field.getValue( { item } );\n\n\t\tif ( field.isValid.required ) {\n\t\t\tif (\n\t\t\t\t( field.type === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'url' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'telephone' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'integer' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === undefined && isEmptyNullOrUndefined( value ) )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( field.type === 'boolean' && value !== true ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\ttypeof field.isValid.custom === 'function' &&\n\t\t\tfield.isValid.custom( item, field ) !== null\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;EAED,MAAME,sBAAsB,GAAKC,KAAU,IAC1C,CAAEC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAE,CAACH,QAAQ,CAAEE,KAAM,CAAC;EAE1C,OAAOL,OAAO,CAACO,KAAK,CAAIC,KAAK,IAAM;IAClC,MAAMH,KAAK,GAAGG,KAAK,CAACC,QAAQ,CAAE;MAAEZ;IAAK,CAAE,CAAC;IAExC,IAAKW,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAG;MAC7B,IACGH,KAAK,CAACI,IAAI,KAAK,MAAM,IAAIR,sBAAsB,CAAEC,KAAM,CAAC,IACxDG,KAAK,CAACI,IAAI,KAAK,OAAO,IAAIR,sBAAsB,CAAEC,KAAM,CAAG,IAC3DG,KAAK,CAACI,IAAI,KAAK,KAAK,IAAIR,sBAAsB,CAAEC,KAAM,CAAG,IACzDG,KAAK,CAACI,IAAI,KAAK,WAAW,IAC3BR,sBAAsB,CAAEC,KAAM,CAAG,IAChCG,KAAK,CAACI,IAAI,KAAK,SAAS,IACzBR,sBAAsB,CAAEC,KAAM,CAAG,IAChCG,KAAK,CAACI,IAAI,KAAKN,SAAS,IAAIF,sBAAsB,CAAEC,KAAM,CAAG,EAC9D;QACD,OAAO,KAAK;MACb;MAEA,IAAKG,KAAK,CAACI,IAAI,KAAK,SAAS,IAAIP,KAAK,KAAK,IAAI,EAAG;QACjD,OAAO,KAAK;MACb;IACD;IAEA,IACC,OAAOG,KAAK,CAACE,OAAO,CAACG,MAAM,KAAK,UAAU,IAC1CL,KAAK,CAACE,OAAO,CAACG,MAAM,CAAEhB,IAAI,EAAEW,KAAM,CAAC,KAAK,IAAI,EAC3C;MACD,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -237,7 +237,8 @@
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
.dataviews-wrapper
|
|
240
|
+
.dataviews-wrapper,
|
|
241
|
+
.dataviews-picker-wrapper {
|
|
241
242
|
height: 100%;
|
|
242
243
|
overflow: auto;
|
|
243
244
|
box-sizing: border-box;
|
|
@@ -350,7 +351,8 @@
|
|
|
350
351
|
/**
|
|
351
352
|
* Applying a consistent 24px padding when DataViews are placed within cards.
|
|
352
353
|
*/
|
|
353
|
-
.components-card__body:has(> .dataviews-wrapper)
|
|
354
|
+
.components-card__body:has(> .dataviews-wrapper),
|
|
355
|
+
.components-card__body:has(> .dataviews-picker-wrapper) {
|
|
354
356
|
padding: 8px 0 0;
|
|
355
357
|
overflow: hidden;
|
|
356
358
|
}
|
|
@@ -359,15 +361,25 @@
|
|
|
359
361
|
.components-card__body:has(> .dataviews-wrapper) .dataviews-footer,
|
|
360
362
|
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-grid,
|
|
361
363
|
.components-card__body:has(> .dataviews-wrapper) .dataviews-loading,
|
|
362
|
-
.components-card__body:has(> .dataviews-wrapper) .dataviews-no-results
|
|
364
|
+
.components-card__body:has(> .dataviews-wrapper) .dataviews-no-results,
|
|
365
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews__view-actions,
|
|
366
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-filters__container,
|
|
367
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-footer,
|
|
368
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-view-grid,
|
|
369
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-loading,
|
|
370
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-no-results {
|
|
363
371
|
padding-inline: 24px;
|
|
364
372
|
}
|
|
365
373
|
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr td:first-child,
|
|
366
|
-
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr th:first-child
|
|
374
|
+
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr th:first-child,
|
|
375
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-view-table tr td:first-child,
|
|
376
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-view-table tr th:first-child {
|
|
367
377
|
padding-inline-start: 24px;
|
|
368
378
|
}
|
|
369
379
|
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr td:last-child,
|
|
370
|
-
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr th:last-child
|
|
380
|
+
.components-card__body:has(> .dataviews-wrapper) .dataviews-view-table tr th:last-child,
|
|
381
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-view-table tr td:last-child,
|
|
382
|
+
.components-card__body:has(> .dataviews-picker-wrapper) .dataviews-view-table tr th:last-child {
|
|
371
383
|
padding-inline-end: 24px;
|
|
372
384
|
}
|
|
373
385
|
|
|
@@ -940,6 +952,15 @@
|
|
|
940
952
|
z-index: 1000001;
|
|
941
953
|
}
|
|
942
954
|
|
|
955
|
+
.dataviews-picker-footer__bulk-selection {
|
|
956
|
+
align-self: flex-start;
|
|
957
|
+
height: 32px;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
.dataviews-picker-footer__actions {
|
|
961
|
+
align-self: flex-end;
|
|
962
|
+
}
|
|
963
|
+
|
|
943
964
|
.dataviews-selection-checkbox {
|
|
944
965
|
--checkbox-input-size: 24px;
|
|
945
966
|
line-height: 0;
|
|
@@ -1051,7 +1072,7 @@
|
|
|
1051
1072
|
color: #757575;
|
|
1052
1073
|
}
|
|
1053
1074
|
|
|
1054
|
-
.dataviews-view-grid {
|
|
1075
|
+
.dataviews-view-grid-items {
|
|
1055
1076
|
margin-bottom: auto;
|
|
1056
1077
|
display: grid;
|
|
1057
1078
|
gap: 32px;
|
|
@@ -1060,21 +1081,22 @@
|
|
|
1060
1081
|
padding: 0 48px 24px;
|
|
1061
1082
|
container-type: inline-size;
|
|
1062
1083
|
/**
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1084
|
+
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1085
|
+
* the sidebar width. This was done to match the existing styles we had.
|
|
1086
|
+
*/
|
|
1066
1087
|
}
|
|
1067
|
-
@container (max-width:
|
|
1068
|
-
.dataviews-view-grid {
|
|
1088
|
+
@container (max-width: 430px) {
|
|
1089
|
+
.dataviews-view-grid-items {
|
|
1069
1090
|
padding-right: 24px;
|
|
1070
1091
|
padding-left: 24px;
|
|
1071
1092
|
}
|
|
1072
1093
|
}
|
|
1073
1094
|
@media not (prefers-reduced-motion) {
|
|
1074
|
-
.dataviews-view-grid {
|
|
1095
|
+
.dataviews-view-grid-items {
|
|
1075
1096
|
transition: padding ease-out 0.1s;
|
|
1076
1097
|
}
|
|
1077
1098
|
}
|
|
1099
|
+
|
|
1078
1100
|
.dataviews-view-grid .dataviews-view-grid__card {
|
|
1079
1101
|
height: 100%;
|
|
1080
1102
|
justify-content: flex-start;
|
|
@@ -1174,9 +1196,16 @@
|
|
|
1174
1196
|
top: -9999em;
|
|
1175
1197
|
right: 8px;
|
|
1176
1198
|
z-index: 1;
|
|
1199
|
+
opacity: 0;
|
|
1200
|
+
}
|
|
1201
|
+
@media not (prefers-reduced-motion) {
|
|
1202
|
+
.dataviews-view-grid__card .dataviews-selection-checkbox {
|
|
1203
|
+
transition: opacity 0.1s linear;
|
|
1204
|
+
}
|
|
1177
1205
|
}
|
|
1178
1206
|
@media (hover: none) {
|
|
1179
1207
|
.dataviews-view-grid__card .dataviews-selection-checkbox {
|
|
1208
|
+
opacity: 1;
|
|
1180
1209
|
top: 8px;
|
|
1181
1210
|
}
|
|
1182
1211
|
}
|
|
@@ -1184,9 +1213,37 @@
|
|
|
1184
1213
|
.dataviews-view-grid__card:hover .dataviews-selection-checkbox,
|
|
1185
1214
|
.dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
|
|
1186
1215
|
.dataviews-view-grid__card.is-selected .dataviews-selection-checkbox {
|
|
1216
|
+
opacity: 1;
|
|
1187
1217
|
top: 8px;
|
|
1188
1218
|
}
|
|
1189
1219
|
|
|
1220
|
+
.dataviews-view-grid__card .dataviews-view-grid__media-actions {
|
|
1221
|
+
position: absolute;
|
|
1222
|
+
top: 4px;
|
|
1223
|
+
opacity: 0;
|
|
1224
|
+
left: 4px;
|
|
1225
|
+
}
|
|
1226
|
+
.dataviews-view-grid__card .dataviews-view-grid__media-actions .dataviews-all-actions-button {
|
|
1227
|
+
background-color: #fff;
|
|
1228
|
+
}
|
|
1229
|
+
@media not (prefers-reduced-motion) {
|
|
1230
|
+
.dataviews-view-grid__card .dataviews-view-grid__media-actions {
|
|
1231
|
+
transition: opacity 0.1s linear;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
@media (hover: none) {
|
|
1235
|
+
.dataviews-view-grid__card .dataviews-view-grid__media-actions {
|
|
1236
|
+
opacity: 1;
|
|
1237
|
+
top: 4px;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
.dataviews-view-grid__card:hover .dataviews-view-grid__media-actions,
|
|
1242
|
+
.dataviews-view-grid__card:focus-within .dataviews-view-grid__media-actions,
|
|
1243
|
+
.dataviews-view-grid__card .dataviews-view-grid__media-actions:has(.dataviews-all-actions-button[aria-expanded=true]) {
|
|
1244
|
+
opacity: 1;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1190
1247
|
.dataviews-view-grid__media--clickable {
|
|
1191
1248
|
cursor: pointer;
|
|
1192
1249
|
}
|
|
@@ -1197,6 +1254,13 @@
|
|
|
1197
1254
|
color: #1e1e1e;
|
|
1198
1255
|
margin: 0 0 8px 0;
|
|
1199
1256
|
padding: 0 48px;
|
|
1257
|
+
container-type: inline-size;
|
|
1258
|
+
}
|
|
1259
|
+
@container (max-width: 430px) {
|
|
1260
|
+
.dataviews-view-grid__group-header {
|
|
1261
|
+
padding-right: 24px;
|
|
1262
|
+
padding-left: 24px;
|
|
1263
|
+
}
|
|
1200
1264
|
}
|
|
1201
1265
|
|
|
1202
1266
|
div.dataviews-view-list {
|
|
@@ -1631,6 +1695,167 @@ div.dataviews-view-list {
|
|
|
1631
1695
|
color: #1e1e1e;
|
|
1632
1696
|
}
|
|
1633
1697
|
|
|
1698
|
+
.dataviews-view-grid-items {
|
|
1699
|
+
margin-bottom: auto;
|
|
1700
|
+
display: grid;
|
|
1701
|
+
gap: 32px;
|
|
1702
|
+
grid-template-rows: max-content;
|
|
1703
|
+
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
1704
|
+
padding: 0 48px 24px;
|
|
1705
|
+
container-type: inline-size;
|
|
1706
|
+
/**
|
|
1707
|
+
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1708
|
+
* the sidebar width. This was done to match the existing styles we had.
|
|
1709
|
+
*/
|
|
1710
|
+
}
|
|
1711
|
+
@container (max-width: 430px) {
|
|
1712
|
+
.dataviews-view-grid-items {
|
|
1713
|
+
padding-right: 24px;
|
|
1714
|
+
padding-left: 24px;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
@media not (prefers-reduced-motion) {
|
|
1718
|
+
.dataviews-view-grid-items {
|
|
1719
|
+
transition: padding ease-out 0.1s;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card {
|
|
1724
|
+
height: 100%;
|
|
1725
|
+
justify-content: flex-start;
|
|
1726
|
+
position: relative;
|
|
1727
|
+
}
|
|
1728
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card .dataviews-view-picker-grid__title-actions {
|
|
1729
|
+
padding: 8px 0 4px;
|
|
1730
|
+
}
|
|
1731
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card .dataviews-view-picker-grid__title-field {
|
|
1732
|
+
min-height: 24px;
|
|
1733
|
+
display: flex;
|
|
1734
|
+
align-items: center;
|
|
1735
|
+
}
|
|
1736
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card .dataviews-view-picker-grid__title-field--clickable {
|
|
1737
|
+
width: fit-content;
|
|
1738
|
+
}
|
|
1739
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card.is-selected .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field .dataviews-view-picker-grid__field-value {
|
|
1740
|
+
color: #1e1e1e;
|
|
1741
|
+
}
|
|
1742
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card.is-selected .dataviews-view-picker-grid__media::after,
|
|
1743
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card .dataviews-view-picker-grid__media:focus::after {
|
|
1744
|
+
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
|
|
1745
|
+
}
|
|
1746
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card.is-selected .dataviews-view-picker-grid__media::after {
|
|
1747
|
+
box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color);
|
|
1748
|
+
}
|
|
1749
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__card .dataviews-view-picker-grid__media:focus::after {
|
|
1750
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1751
|
+
}
|
|
1752
|
+
.dataviews-view-picker-grid:focus-visible[aria-activedescendant] {
|
|
1753
|
+
outline: none;
|
|
1754
|
+
}
|
|
1755
|
+
.dataviews-view-picker-grid:focus-visible [data-active-item=true] {
|
|
1756
|
+
outline: 2px solid var(--wp-admin-theme-color);
|
|
1757
|
+
}
|
|
1758
|
+
.dataviews-view-picker-grid .dataviews-selection-checkbox {
|
|
1759
|
+
top: 8px !important;
|
|
1760
|
+
}
|
|
1761
|
+
.dataviews-view-picker-grid .dataviews-selection-checkbox input {
|
|
1762
|
+
pointer-events: none;
|
|
1763
|
+
}
|
|
1764
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__media {
|
|
1765
|
+
width: 100%;
|
|
1766
|
+
aspect-ratio: 1/1;
|
|
1767
|
+
background-color: #fff;
|
|
1768
|
+
border-radius: 4px;
|
|
1769
|
+
position: relative;
|
|
1770
|
+
}
|
|
1771
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__media img {
|
|
1772
|
+
object-fit: cover;
|
|
1773
|
+
width: 100%;
|
|
1774
|
+
height: 100%;
|
|
1775
|
+
}
|
|
1776
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__media::after {
|
|
1777
|
+
content: "";
|
|
1778
|
+
position: absolute;
|
|
1779
|
+
top: 0;
|
|
1780
|
+
right: 0;
|
|
1781
|
+
width: 100%;
|
|
1782
|
+
height: 100%;
|
|
1783
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
1784
|
+
border-radius: 4px;
|
|
1785
|
+
pointer-events: none;
|
|
1786
|
+
}
|
|
1787
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields {
|
|
1788
|
+
position: relative;
|
|
1789
|
+
font-size: 12px;
|
|
1790
|
+
line-height: 16px;
|
|
1791
|
+
}
|
|
1792
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields:not(:empty) {
|
|
1793
|
+
padding: 0 0 12px;
|
|
1794
|
+
}
|
|
1795
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field-value:not(:empty) {
|
|
1796
|
+
min-height: 24px;
|
|
1797
|
+
line-height: 20px;
|
|
1798
|
+
padding-top: 2px;
|
|
1799
|
+
}
|
|
1800
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field {
|
|
1801
|
+
min-height: 24px;
|
|
1802
|
+
align-items: center;
|
|
1803
|
+
}
|
|
1804
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field .dataviews-view-picker-grid__field-name {
|
|
1805
|
+
width: 35%;
|
|
1806
|
+
color: #757575;
|
|
1807
|
+
overflow: hidden;
|
|
1808
|
+
text-overflow: ellipsis;
|
|
1809
|
+
white-space: nowrap;
|
|
1810
|
+
}
|
|
1811
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field .dataviews-view-picker-grid__field-value {
|
|
1812
|
+
width: 65%;
|
|
1813
|
+
overflow: hidden;
|
|
1814
|
+
text-overflow: ellipsis;
|
|
1815
|
+
white-space: nowrap;
|
|
1816
|
+
}
|
|
1817
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__fields .dataviews-view-picker-grid__field:not(:has(.dataviews-view-picker-grid__field-value:not(:empty))) {
|
|
1818
|
+
display: none;
|
|
1819
|
+
}
|
|
1820
|
+
.dataviews-view-picker-grid .dataviews-view-picker-grid__badge-fields:not(:empty) {
|
|
1821
|
+
padding-bottom: 12px;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
.dataviews-view-picker-grid__field-value:empty,
|
|
1825
|
+
.dataviews-view-picker-grid__field:empty {
|
|
1826
|
+
display: none;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
.dataviews-view-picker-grid__card .dataviews-selection-checkbox {
|
|
1830
|
+
position: absolute;
|
|
1831
|
+
top: -9999em;
|
|
1832
|
+
right: 8px;
|
|
1833
|
+
z-index: 1;
|
|
1834
|
+
}
|
|
1835
|
+
@media (hover: none) {
|
|
1836
|
+
.dataviews-view-picker-grid__card .dataviews-selection-checkbox {
|
|
1837
|
+
top: 8px;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.dataviews-view-picker-grid__card:hover .dataviews-selection-checkbox,
|
|
1842
|
+
.dataviews-view-picker-grid__card:focus-within .dataviews-selection-checkbox,
|
|
1843
|
+
.dataviews-view-picker-grid__card.is-selected .dataviews-selection-checkbox {
|
|
1844
|
+
top: 8px;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
.dataviews-view-picker-grid__media--clickable {
|
|
1848
|
+
cursor: pointer;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
.dataviews-view-picker-grid-group__header {
|
|
1852
|
+
font-size: 15px;
|
|
1853
|
+
font-weight: 500;
|
|
1854
|
+
color: #1e1e1e;
|
|
1855
|
+
margin: 0 0 8px 0;
|
|
1856
|
+
padding: 0 48px;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1634
1859
|
.dataviews-controls__datetime {
|
|
1635
1860
|
border: none;
|
|
1636
1861
|
padding: 0;
|
|
@@ -1743,4 +1968,19 @@ div.dataviews-view-list {
|
|
|
1743
1968
|
min-height: 32px;
|
|
1744
1969
|
display: flex;
|
|
1745
1970
|
align-items: center;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
.dataforms-layouts-card__field {
|
|
1974
|
+
width: 100%;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
.dataforms-layouts-card__field-description {
|
|
1978
|
+
color: #757575;
|
|
1979
|
+
display: block;
|
|
1980
|
+
font-size: 13px;
|
|
1981
|
+
margin-bottom: 16px;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
.dataforms-layouts-row__field-control {
|
|
1985
|
+
width: 100%;
|
|
1746
1986
|
}
|