@ansible/ansible-ui-framework 2.4.396 → 2.4.397

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.
@@ -0,0 +1,21 @@
1
+ import { ITableColumn, IToolbarFilter, ISelected } from '../../../framework';
2
+ import { IView, ViewExtendedOptions } from '../../useView';
3
+ type BaseView<T extends object> = IView & ISelected<T> & {
4
+ itemCount: number | undefined;
5
+ pageItems: T[] | undefined;
6
+ refresh: () => Promise<void>;
7
+ };
8
+ export type AsyncSelectFilterBuilderProps<T extends object> = {
9
+ title: string;
10
+ tableColumns: ITableColumn<T>[];
11
+ toolbarFilters?: IToolbarFilter[];
12
+ viewParams: ViewExtendedOptions<T>;
13
+ useView: (viewParams: ViewExtendedOptions<T>) => BaseView<T>;
14
+ };
15
+ export declare function useAsyncSingleSelectFilterBuilder<T extends object>(props: AsyncSelectFilterBuilderProps<T>): {
16
+ onBrowse: (onSelect: (value: T) => void, defaultSelection?: T) => void;
17
+ };
18
+ export declare function useAsyncMultiSelectFilterBuilder<T extends object>(props: AsyncSelectFilterBuilderProps<T>): {
19
+ onBrowse: (onSelect: (value: T[]) => void, defaultSelection?: T[]) => void;
20
+ };
21
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { IFilterState } from './PageToolbar/PageToolbarFilter';
3
+ import { ITableColumn, IToolbarFilter } from '../framework';
3
4
  export interface IView {
4
5
  page: number;
5
6
  setPage: (page: number) => void;
@@ -13,9 +14,23 @@ export interface IView {
13
14
  setFilterState: Dispatch<SetStateAction<IFilterState>>;
14
15
  clearAllFilters: () => void;
15
16
  }
16
- export declare function useView(options: {
17
+ export interface ViewOptions {
17
18
  defaultValues?: Partial<Pick<IView, 'filterState' | 'sort' | 'sortDirection'>> | undefined;
18
19
  disableQueryString?: boolean;
19
20
  ignoreQueryStringKeys?: string[];
20
21
  filterQueryStringKeys?: string[];
21
- }): IView;
22
+ }
23
+ export type QueryParams = {
24
+ [key: string]: string;
25
+ };
26
+ export interface ViewExtendedOptions<T extends object> extends ViewOptions {
27
+ url: string;
28
+ keyFn: (item: T) => string | number;
29
+ toolbarFilters?: IToolbarFilter[];
30
+ tableColumns?: ITableColumn<T>[];
31
+ disableQueryString?: boolean;
32
+ queryParams?: QueryParams;
33
+ sortKey?: string;
34
+ defaultFilters?: Record<string, string[]>;
35
+ }
36
+ export declare function useView(options: ViewOptions): IView;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "2.4.396",
4
+ "version": "2.4.397",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",