@wordpress/dataviews 3.0.0 → 4.0.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 +8 -1
- package/README.md +19 -4
- package/build/{dataform.js → components/dataform/index.js} +5 -5
- package/build/components/dataform/index.js.map +1 -0
- package/build/components/dataviews/index.js +115 -0
- package/build/components/dataviews/index.js.map +1 -0
- package/build/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -16
- package/build/components/dataviews-bulk-actions/index.js.map +1 -0
- package/build/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +36 -19
- package/build/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
- package/build/components/dataviews-context/index.js +36 -0
- package/build/components/dataviews-context/index.js.map +1 -0
- package/build/{add-filter.js → components/dataviews-filters/add-filter.js} +2 -2
- package/build/components/dataviews-filters/add-filter.js.map +1 -0
- package/build/{filter-summary.js → components/dataviews-filters/filter-summary.js} +9 -9
- package/build/components/dataviews-filters/filter-summary.js.map +1 -0
- package/build/{filters.js → components/dataviews-filters/index.js} +14 -15
- package/build/components/dataviews-filters/index.js.map +1 -0
- package/build/components/dataviews-filters/reset-filters.js.map +1 -0
- package/build/{search-widget.js → components/dataviews-filters/search-widget.js} +13 -13
- package/build/components/dataviews-filters/search-widget.js.map +1 -0
- package/build/{item-actions.js → components/dataviews-item-actions/index.js} +2 -2
- package/build/components/dataviews-item-actions/index.js.map +1 -0
- package/build/components/dataviews-layout/index.js +53 -0
- package/build/components/dataviews-layout/index.js.map +1 -0
- package/build/{pagination.js → components/dataviews-pagination/index.js} +16 -13
- package/build/components/dataviews-pagination/index.js.map +1 -0
- package/build/{search.js → components/dataviews-search/index.js} +10 -6
- package/build/components/dataviews-search/index.js.map +1 -0
- package/build/{single-selection-checkbox.js → components/dataviews-selection-checkbox/index.js} +6 -6
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -0
- package/build/{view-actions.js → components/dataviews-view-config/index.js} +19 -16
- package/build/components/dataviews-view-config/index.js.map +1 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/layouts/grid/density-picker.js +143 -0
- package/build/layouts/grid/density-picker.js.map +1 -0
- package/build/{view-grid.js → layouts/grid/index.js} +34 -35
- package/build/layouts/grid/index.js.map +1 -0
- package/build/layouts/index.js +52 -0
- package/build/layouts/index.js.map +1 -0
- package/build/{view-list.js → layouts/list/index.js} +26 -23
- package/build/layouts/list/index.js.map +1 -0
- package/build/layouts/table/column-header-menu.js +196 -0
- package/build/layouts/table/column-header-menu.js.map +1 -0
- package/build/layouts/table/index.js +350 -0
- package/build/layouts/table/index.js.map +1 -0
- package/build/normalize-fields.js +1 -1
- package/build/normalize-fields.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/{dataform.js → components/dataform/index.js} +5 -5
- package/build-module/components/dataform/index.js.map +1 -0
- package/build-module/components/dataviews/index.js +108 -0
- package/build-module/components/dataviews/index.js.map +1 -0
- package/build-module/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -17
- package/build-module/components/dataviews-bulk-actions/index.js.map +1 -0
- package/build-module/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +35 -19
- package/build-module/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
- package/build-module/components/dataviews-context/index.js +30 -0
- package/build-module/components/dataviews-context/index.js.map +1 -0
- package/build-module/{add-filter.js → components/dataviews-filters/add-filter.js} +2 -2
- package/build-module/components/dataviews-filters/add-filter.js.map +1 -0
- package/build-module/{filter-summary.js → components/dataviews-filters/filter-summary.js} +9 -9
- package/build-module/components/dataviews-filters/filter-summary.js.map +1 -0
- package/build-module/{filters.js → components/dataviews-filters/index.js} +15 -16
- package/build-module/components/dataviews-filters/index.js.map +1 -0
- package/build-module/components/dataviews-filters/reset-filters.js.map +1 -0
- package/build-module/{search-widget.js → components/dataviews-filters/search-widget.js} +13 -13
- package/build-module/components/dataviews-filters/search-widget.js.map +1 -0
- package/build-module/{item-actions.js → components/dataviews-item-actions/index.js} +2 -2
- package/build-module/components/dataviews-item-actions/index.js.map +1 -0
- package/build-module/components/dataviews-layout/index.js +45 -0
- package/build-module/components/dataviews-layout/index.js.map +1 -0
- package/build-module/{pagination.js → components/dataviews-pagination/index.js} +17 -15
- package/build-module/components/dataviews-pagination/index.js.map +1 -0
- package/build-module/{search.js → components/dataviews-search/index.js} +10 -7
- package/build-module/components/dataviews-search/index.js.map +1 -0
- package/build-module/{single-selection-checkbox.js → components/dataviews-selection-checkbox/index.js} +5 -5
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -0
- package/build-module/{view-actions.js → components/dataviews-view-config/index.js} +19 -17
- package/build-module/components/dataviews-view-config/index.js.map +1 -0
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/grid/density-picker.js +138 -0
- package/build-module/layouts/grid/density-picker.js.map +1 -0
- package/build-module/{view-grid.js → layouts/grid/index.js} +31 -32
- package/build-module/layouts/grid/index.js.map +1 -0
- package/build-module/layouts/index.js +43 -0
- package/build-module/layouts/index.js.map +1 -0
- package/build-module/{view-list.js → layouts/list/index.js} +24 -21
- package/build-module/layouts/list/index.js.map +1 -0
- package/build-module/layouts/table/column-header-menu.js +190 -0
- package/build-module/layouts/table/column-header-menu.js.map +1 -0
- package/build-module/layouts/table/index.js +344 -0
- package/build-module/layouts/table/index.js.map +1 -0
- package/build-module/normalize-fields.js +1 -1
- package/build-module/normalize-fields.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/style-rtl.css +607 -545
- package/build-style/style.css +607 -545
- package/build-types/{dataform.d.ts → components/dataform/index.d.ts} +2 -2
- package/build-types/components/dataform/index.d.ts.map +1 -0
- package/build-types/components/dataform/stories/index.story.d.ts +11 -0
- package/build-types/components/dataform/stories/index.story.d.ts.map +1 -0
- package/build-types/{dataviews.d.ts → components/dataviews/index.d.ts} +9 -7
- package/build-types/components/dataviews/index.d.ts.map +1 -0
- package/build-types/{stories → components/dataviews/stories}/fixtures.d.ts +7 -19
- package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -0
- package/build-types/components/dataviews/stories/index.story.d.ts +46 -0
- package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -0
- package/build-types/components/dataviews-bulk-actions/index.d.ts +5 -0
- package/build-types/components/dataviews-bulk-actions/index.d.ts.map +1 -0
- package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts +2 -0
- package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts.map +1 -0
- package/build-types/components/dataviews-context/index.d.ts +26 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -0
- package/build-types/{add-filter.d.ts → components/dataviews-filters/add-filter.d.ts} +1 -2
- package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -0
- package/build-types/{filter-summary.d.ts → components/dataviews-filters/filter-summary.d.ts} +1 -1
- package/build-types/components/dataviews-filters/filter-summary.d.ts.map +1 -0
- package/build-types/components/dataviews-filters/index.d.ts +4 -0
- package/build-types/components/dataviews-filters/index.d.ts.map +1 -0
- package/build-types/{reset-filters.d.ts → components/dataviews-filters/reset-filters.d.ts} +1 -2
- package/build-types/components/dataviews-filters/reset-filters.d.ts.map +1 -0
- package/build-types/{search-widget.d.ts → components/dataviews-filters/search-widget.d.ts} +1 -2
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -0
- package/build-types/{item-actions.d.ts → components/dataviews-item-actions/index.d.ts} +2 -2
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -0
- package/build-types/components/dataviews-layout/index.d.ts +2 -0
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -0
- package/build-types/components/dataviews-pagination/index.d.ts +4 -0
- package/build-types/components/dataviews-pagination/index.d.ts.map +1 -0
- package/build-types/components/dataviews-search/index.d.ts +6 -0
- package/build-types/components/dataviews-search/index.d.ts.map +1 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts +16 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -0
- package/build-types/components/dataviews-view-config/index.d.ts +8 -0
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -0
- package/build-types/index.d.ts +2 -2
- package/build-types/index.d.ts.map +1 -1
- package/build-types/layouts/grid/density-picker.d.ts +5 -0
- package/build-types/layouts/grid/density-picker.d.ts.map +1 -0
- package/build-types/layouts/grid/index.d.ts +3 -0
- package/build-types/layouts/grid/index.d.ts.map +1 -0
- package/build-types/{layouts.d.ts → layouts/index.d.ts} +6 -5
- package/build-types/layouts/index.d.ts.map +1 -0
- package/build-types/layouts/list/index.d.ts +3 -0
- package/build-types/layouts/list/index.d.ts.map +1 -0
- package/build-types/layouts/table/column-header-menu.d.ts +17 -0
- package/build-types/layouts/table/column-header-menu.d.ts.map +1 -0
- package/build-types/layouts/table/index.d.ts +4 -0
- package/build-types/layouts/table/index.d.ts.map +1 -0
- package/build-types/types.d.ts +42 -23
- package/build-types/types.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/{dataform.tsx → components/dataform/index.tsx} +5 -5
- package/src/components/dataform/stories/index.story.tsx +42 -0
- package/src/components/dataviews/index.tsx +149 -0
- package/src/{stories → components/dataviews/stories}/fixtures.js +7 -11
- package/src/{stories → components/dataviews/stories}/index.story.js +17 -3
- package/src/components/dataviews/style.scss +97 -0
- package/src/{bulk-actions.tsx → components/dataviews-bulk-actions/index.tsx} +46 -29
- package/src/components/dataviews-bulk-actions/style.scss +7 -0
- package/src/{bulk-actions-toolbar.tsx → components/dataviews-bulk-actions-toolbar/index.tsx} +42 -30
- package/src/components/dataviews-bulk-actions-toolbar/style.scss +45 -0
- package/src/components/dataviews-context/index.ts +49 -0
- package/src/{add-filter.tsx → components/dataviews-filters/add-filter.tsx} +3 -3
- package/src/{filter-summary.tsx → components/dataviews-filters/filter-summary.tsx} +18 -10
- package/src/{filters.tsx → components/dataviews-filters/index.tsx} +10 -24
- package/src/{reset-filters.tsx → components/dataviews-filters/reset-filters.tsx} +1 -1
- package/src/{search-widget.tsx → components/dataviews-filters/search-widget.tsx} +14 -14
- package/src/components/dataviews-filters/style.scss +252 -0
- package/src/{item-actions.tsx → components/dataviews-item-actions/index.tsx} +2 -2
- package/src/components/dataviews-item-actions/style.scss +3 -0
- package/src/components/dataviews-layout/index.tsx +51 -0
- package/src/{pagination.tsx → components/dataviews-pagination/index.tsx} +13 -21
- package/src/components/dataviews-pagination/style.scss +26 -0
- package/src/{search.tsx → components/dataviews-search/index.tsx} +5 -10
- package/src/{single-selection-checkbox.tsx → components/dataviews-selection-checkbox/index.tsx} +9 -9
- package/src/components/dataviews-selection-checkbox/style.scss +14 -0
- package/src/{view-actions.tsx → components/dataviews-view-config/index.tsx} +16 -22
- package/src/index.ts +2 -2
- package/src/layouts/grid/density-picker.tsx +136 -0
- package/src/{view-grid.tsx → layouts/grid/index.tsx} +28 -29
- package/src/layouts/grid/style.scss +140 -0
- package/src/layouts/index.ts +66 -0
- package/src/{view-list.tsx → layouts/list/index.tsx} +30 -17
- package/src/layouts/list/style.scss +189 -0
- package/src/layouts/table/column-header-menu.tsx +268 -0
- package/src/layouts/table/index.tsx +471 -0
- package/src/layouts/table/style.scss +201 -0
- package/src/normalize-fields.ts +1 -1
- package/src/style.scss +11 -907
- package/src/test/filter-and-sort-data-view.js +1 -1
- package/src/types.ts +48 -24
- package/tsconfig.tsbuildinfo +1 -1
- package/build/add-filter.js.map +0 -1
- package/build/bulk-actions-toolbar.js.map +0 -1
- package/build/bulk-actions.js.map +0 -1
- package/build/dataform.js.map +0 -1
- package/build/dataviews.js +0 -125
- package/build/dataviews.js.map +0 -1
- package/build/filter-summary.js.map +0 -1
- package/build/filters.js.map +0 -1
- package/build/item-actions.js.map +0 -1
- package/build/layouts.js +0 -38
- package/build/layouts.js.map +0 -1
- package/build/pagination.js.map +0 -1
- package/build/reset-filters.js.map +0 -1
- package/build/search-widget.js.map +0 -1
- package/build/search.js.map +0 -1
- package/build/single-selection-checkbox.js.map +0 -1
- package/build/view-actions.js.map +0 -1
- package/build/view-grid.js.map +0 -1
- package/build/view-list.js.map +0 -1
- package/build/view-table.js +0 -400
- package/build/view-table.js.map +0 -1
- package/build-module/add-filter.js.map +0 -1
- package/build-module/bulk-actions-toolbar.js.map +0 -1
- package/build-module/bulk-actions.js.map +0 -1
- package/build-module/dataform.js.map +0 -1
- package/build-module/dataviews.js +0 -116
- package/build-module/dataviews.js.map +0 -1
- package/build-module/filter-summary.js.map +0 -1
- package/build-module/filters.js.map +0 -1
- package/build-module/item-actions.js.map +0 -1
- package/build-module/layouts.js +0 -30
- package/build-module/layouts.js.map +0 -1
- package/build-module/pagination.js.map +0 -1
- package/build-module/reset-filters.js.map +0 -1
- package/build-module/search-widget.js.map +0 -1
- package/build-module/search.js.map +0 -1
- package/build-module/single-selection-checkbox.js.map +0 -1
- package/build-module/view-actions.js.map +0 -1
- package/build-module/view-grid.js.map +0 -1
- package/build-module/view-list.js.map +0 -1
- package/build-module/view-table.js +0 -393
- package/build-module/view-table.js.map +0 -1
- package/build-types/add-filter.d.ts.map +0 -1
- package/build-types/bulk-actions-toolbar.d.ts +0 -13
- package/build-types/bulk-actions-toolbar.d.ts.map +0 -1
- package/build-types/bulk-actions.d.ts +0 -15
- package/build-types/bulk-actions.d.ts.map +0 -1
- package/build-types/dataform.d.ts.map +0 -1
- package/build-types/dataviews.d.ts.map +0 -1
- package/build-types/filter-summary.d.ts.map +0 -1
- package/build-types/filters.d.ts +0 -13
- package/build-types/filters.d.ts.map +0 -1
- package/build-types/item-actions.d.ts.map +0 -1
- package/build-types/layouts.d.ts.map +0 -1
- package/build-types/pagination.d.ts +0 -16
- package/build-types/pagination.d.ts.map +0 -1
- package/build-types/reset-filters.d.ts.map +0 -1
- package/build-types/search-widget.d.ts.map +0 -1
- package/build-types/search.d.ts +0 -13
- package/build-types/search.d.ts.map +0 -1
- package/build-types/single-selection-checkbox.d.ts +0 -17
- package/build-types/single-selection-checkbox.d.ts.map +0 -1
- package/build-types/stories/fixtures.d.ts.map +0 -1
- package/build-types/stories/index.story.d.ts +0 -29
- package/build-types/stories/index.story.d.ts.map +0 -1
- package/build-types/view-actions.d.ts +0 -12
- package/build-types/view-actions.d.ts.map +0 -1
- package/build-types/view-grid.d.ts +0 -4
- package/build-types/view-grid.d.ts.map +0 -1
- package/build-types/view-list.d.ts +0 -4
- package/build-types/view-list.d.ts.map +0 -1
- package/build-types/view-table.d.ts +0 -5
- package/build-types/view-table.d.ts.map +0 -1
- package/src/dataviews.tsx +0 -183
- package/src/layouts.ts +0 -39
- package/src/view-table.tsx +0 -592
- /package/build/{reset-filters.js → components/dataviews-filters/reset-filters.js} +0 -0
- /package/build-module/{reset-filters.js → components/dataviews-filters/reset-filters.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement,
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\ninterface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type ItemRecord = Record< string, unknown >;\n\nexport type FieldType = 'text';\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 * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< { item: Item } >;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n} & ( Item extends ItemRecord\n\t? {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue?: ( args: { item: Item } ) => any;\n\t }\n\t: {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue: ( args: { item: Item } ) => any;\n\t } );\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\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\n/**\n * The form configuration.\n */\nexport type Form = {\n\tvisibleFields?: string[];\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n}\n\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}: {\n\t\titems: Item[];\n\t\tcloseModal?: () => void;\n\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t} ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n"],"mappings":"","ignoreList":[]}
|