@mittwald/flow-react-components 0.1.0-alpha.173 → 0.1.0-alpha.175
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/dist/List/ListLoaderAsyncResource.js +3 -4
- package/dist/List.js +275 -273
- package/dist/styles.css +1 -1
- package/dist/types/components/List/components/Header/FilterPicker/FilterPicker.d.ts +1 -2
- package/dist/types/components/List/components/Header/ListFilter.d.ts +6 -3
- package/dist/types/components/List/components/Header/ListSorting.d.ts +4 -4
- package/dist/types/components/List/components/Header/SortingPickerItem/SortingPickerItem.d.ts +1 -2
- package/dist/types/components/List/components/Items/ListItem/FallbackRenderer.d.ts +1 -2
- package/dist/types/components/List/components/Items/ListItemView.d.ts +6 -4
- package/dist/types/components/List/components/ListLoaderAsync.d.ts +5 -3
- package/dist/types/components/List/components/ListLoaderAsyncResource.d.ts +5 -3
- package/dist/types/components/List/components/ListStaticData.d.ts +6 -3
- package/dist/types/components/List/hooks/useList.d.ts +1 -1
- package/dist/types/components/List/index.d.ts +1 -0
- package/dist/types/components/List/listContext.d.ts +1 -2
- package/dist/types/components/List/model/List.d.ts +3 -3
- package/dist/types/components/List/model/ReactTable.d.ts +1 -1
- package/dist/types/components/List/model/filter/Filter.d.ts +4 -4
- package/dist/types/components/List/model/filter/types.d.ts +8 -6
- package/dist/types/components/List/model/item/Item.d.ts +1 -3
- package/dist/types/components/List/model/item/types.d.ts +3 -5
- package/dist/types/components/List/model/sorting/Sorting.d.ts +2 -1
- package/dist/types/components/List/model/sorting/types.d.ts +1 -1
- package/dist/types/components/List/model/types.d.ts +5 -2
- package/dist/types/components/List/typedList.d.ts +25 -0
- package/dist/types/lib/types/array.d.ts +1 -0
- package/package.json +4 -4
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Filter } from '../../../model/filter/Filter';
|
|
3
|
-
import { AnyData } from '../../../model/item/types';
|
|
4
3
|
|
|
5
4
|
interface Props {
|
|
6
|
-
filter: Filter<
|
|
5
|
+
filter: Filter<never, never, never>;
|
|
7
6
|
}
|
|
8
7
|
export declare const FilterPicker: FC<Props>;
|
|
9
8
|
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { FilterShape } from '../../model/filter/types';
|
|
1
|
+
import { FilterShape, FilterValue } from '../../model/filter/types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { PropertyName } from '../../model/types';
|
|
2
4
|
|
|
3
|
-
type Props<T> = Omit<FilterShape<T>, "type">;
|
|
4
|
-
export declare
|
|
5
|
+
type Props<T, TProp extends PropertyName<T>, TMatcherValue> = Omit<FilterShape<T, TProp, TMatcherValue>, "type">;
|
|
6
|
+
export declare const ListFilter: <T, const TProp extends PropertyName<T> = PropertyName<T>, TMatcherValue = FilterValue<T, TProp>>(ignoredProps: Props<T, TProp, TMatcherValue>) => null;
|
|
7
|
+
export declare const TypedListFilter: <T>() => <const TProp extends PropertyName<T>, TMatcherValue = FilterValue<T, TProp>>(props: Props<T, TProp, TMatcherValue>) => ReactNode;
|
|
5
8
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SortingShape } from '../../model/sorting/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function ListSorting<T = never>(ignoredProps: Props<T>): null;
|
|
4
|
+
type Props<T> = SortingShape<T>;
|
|
5
|
+
export declare const ListSorting: <T>(ignoredProps: Props<T>) => null;
|
|
6
|
+
export declare const TypedListSorting: <T>() => ComponentType<Props<T>>;
|
|
7
7
|
export {};
|
package/dist/types/components/List/components/Header/SortingPickerItem/SortingPickerItem.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { AnyData } from '../../../model/item/types';
|
|
3
2
|
import { Sorting } from '../../../model/sorting/Sorting';
|
|
4
3
|
|
|
5
4
|
interface Props {
|
|
6
|
-
sorting: Sorting<
|
|
5
|
+
sorting: Sorting<never>;
|
|
7
6
|
}
|
|
8
7
|
export declare const SortingPickerItem: FC<Props>;
|
|
9
8
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { RenderItemFn } from '../../model/item/types';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = {} & {
|
|
4
5
|
children: RenderItemFn<T>;
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListItemView: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListItemView: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AsyncDataLoaderShape } from '../model/loading/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = Omit<AsyncDataLoaderShape<T>, "asyncLoader"> & {
|
|
4
5
|
children: AsyncDataLoaderShape<T>["asyncLoader"];
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListLoaderAsync: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListLoaderAsync: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AsyncResourceFactoryDataLoaderShape } from '../model/loading/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = Omit<AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
|
|
4
5
|
children: AsyncResourceFactoryDataLoaderShape<T>["asyncResourceFactory"];
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListLoaderAsyncResource: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListLoaderAsyncResource: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
type Props<T> = {} & {
|
|
2
4
|
data: T[];
|
|
3
|
-
}
|
|
4
|
-
export declare
|
|
5
|
+
};
|
|
6
|
+
export declare const ListStaticData: <T>(ignoredProps: Props<T>) => null;
|
|
7
|
+
export declare const TypedListStaticData: <T>() => ComponentType<Props<T>>;
|
|
5
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useList: () => import('../model/List').List<
|
|
1
|
+
export declare const useList: () => import('../model/List').List<never>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ItemCollection } from './item/ItemCollection';
|
|
2
2
|
import { BatchesController } from './pagination/BatchesController';
|
|
3
|
-
import { PropertyName, RenderItemFn } from './item/Item';
|
|
4
3
|
import { Filter } from './filter/Filter';
|
|
5
4
|
import { Sorting } from './sorting/Sorting';
|
|
6
5
|
import { default as ReactTable } from './ReactTable';
|
|
7
6
|
import { ListShape } from './types';
|
|
8
7
|
import { IncrementalLoader } from './loading/IncrementalLoader';
|
|
8
|
+
import { RenderItemFn } from './item/types';
|
|
9
9
|
|
|
10
10
|
export declare class List<T> {
|
|
11
|
-
readonly filters: Filter<T>[];
|
|
11
|
+
readonly filters: Filter<T, never, never>[];
|
|
12
12
|
readonly sorting: Sorting<T>[];
|
|
13
13
|
readonly items: ItemCollection<T>;
|
|
14
14
|
readonly render?: RenderItemFn<T>;
|
|
@@ -18,7 +18,7 @@ export declare class List<T> {
|
|
|
18
18
|
private constructor();
|
|
19
19
|
static useNew<T>(shape: ListShape<T>): List<T>;
|
|
20
20
|
isFiltered(): boolean;
|
|
21
|
-
getSorting(
|
|
21
|
+
getSorting(id: string): Sorting<T>;
|
|
22
22
|
clearSorting(): void;
|
|
23
23
|
clearFilters(): void;
|
|
24
24
|
useIsEmpty(): boolean;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Column, ColumnDef, ColumnFilter } from '@tanstack/react-table';
|
|
2
2
|
import { default as List } from '../List';
|
|
3
|
-
import { PropertyName } from '../item/Item';
|
|
4
3
|
import { FilterMatcher, FilterMode, FilterShape } from './types';
|
|
4
|
+
import { PropertyName } from '../types';
|
|
5
5
|
|
|
6
|
-
export declare class Filter<T> {
|
|
6
|
+
export declare class Filter<T, TProp extends PropertyName<T>, TMatchValue> {
|
|
7
7
|
private readonly _values?;
|
|
8
8
|
readonly list: List<T>;
|
|
9
9
|
readonly property: PropertyName<T>;
|
|
10
10
|
readonly mode: FilterMode;
|
|
11
|
-
readonly matcher: FilterMatcher
|
|
11
|
+
readonly matcher: FilterMatcher<T, never, never>;
|
|
12
12
|
readonly name?: string;
|
|
13
13
|
private onFilterUpdateCallbacks;
|
|
14
|
-
constructor(list: List<T>, shape: FilterShape<T>);
|
|
14
|
+
constructor(list: List<T>, shape: FilterShape<T, TProp, TMatchValue>);
|
|
15
15
|
updateTableColumnDef(def: ColumnDef<T>): void;
|
|
16
16
|
private getReactTableFilterFn;
|
|
17
17
|
private checkFilterMatches;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ItemType } from '../../../../lib/types/array';
|
|
2
|
+
import { PropertyName, PropertyValue } from '../types';
|
|
2
3
|
|
|
3
4
|
export type FilterMode = "all" | "some" | "one";
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export type FilterValue<T, P> = ItemType<NonNullable<PropertyValue<T, P>>>;
|
|
6
|
+
export type FilterMatcher<T, P, TMatcherValue> = (filterBy: FilterValue<T, P>, filterFrom: TMatcherValue[]) => boolean;
|
|
7
|
+
export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> {
|
|
8
|
+
property: TProp;
|
|
7
9
|
mode?: FilterMode;
|
|
8
|
-
matcher?: FilterMatcher
|
|
9
|
-
values?:
|
|
10
|
+
matcher?: FilterMatcher<T, TProp, TMatcherValue>;
|
|
11
|
+
values?: TMatcherValue[];
|
|
10
12
|
name?: string;
|
|
11
13
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ItemCollection } from './ItemCollection';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Row } from '@tanstack/react-table';
|
|
4
4
|
|
|
5
|
-
export type PropertyName<T> = DeepKeys<T>;
|
|
6
|
-
export type RenderItemFn<T> = (data: T) => ReactNode;
|
|
7
5
|
export declare class Item<T> {
|
|
8
6
|
readonly id: string;
|
|
9
7
|
readonly data: T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Column, ColumnDef, SortDirection } from '@tanstack/react-table';
|
|
2
2
|
import { default as List } from '../List';
|
|
3
|
-
import { PropertyName } from '../item/Item';
|
|
4
3
|
import { SortingShape } from './types';
|
|
4
|
+
import { PropertyName } from '../types';
|
|
5
5
|
|
|
6
6
|
export declare class Sorting<T> {
|
|
7
7
|
readonly list: List<T>;
|
|
@@ -15,4 +15,5 @@ export declare class Sorting<T> {
|
|
|
15
15
|
getTableColumn(): Column<T>;
|
|
16
16
|
enable(): void;
|
|
17
17
|
clear(): void;
|
|
18
|
+
get id(): string;
|
|
18
19
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeepKeys, DeepValue } from '@tanstack/react-table';
|
|
2
2
|
import { SortingShape } from './sorting/types';
|
|
3
3
|
import { BatchesControllerShape } from './pagination/types';
|
|
4
4
|
import { FilterShape } from './filter/types';
|
|
5
5
|
import { IncrementalLoaderShape } from './loading/types';
|
|
6
|
+
import { RenderItemFn } from './item/types';
|
|
6
7
|
|
|
8
|
+
export type PropertyName<T> = never extends T ? string : DeepKeys<T>;
|
|
9
|
+
export type PropertyValue<T, TProp> = DeepValue<T, TProp>;
|
|
7
10
|
export interface ListShape<T> {
|
|
8
11
|
loader?: IncrementalLoaderShape<T>;
|
|
9
12
|
render?: RenderItemFn<T>;
|
|
10
|
-
filters?: FilterShape<T>[];
|
|
13
|
+
filters?: FilterShape<T, never, never>[];
|
|
11
14
|
sorting?: SortingShape<T>[];
|
|
12
15
|
batchesController?: BatchesControllerShape;
|
|
13
16
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as List } from './List';
|
|
2
|
+
|
|
3
|
+
export declare const typedList: <T>() => {
|
|
4
|
+
List: typeof List;
|
|
5
|
+
Filter: <const TProp extends import('./model/types').PropertyName<T>, TMatcherValue = import('../../lib/types/array').ItemType<NonNullable<import('@tanstack/table-core').DeepValue<T, TProp>>>>(props: {
|
|
6
|
+
name?: string;
|
|
7
|
+
property: TProp;
|
|
8
|
+
mode?: import('./model/filter/types').FilterMode;
|
|
9
|
+
values?: TMatcherValue[] | undefined;
|
|
10
|
+
matcher?: import('./model/filter/types').FilterMatcher<T, TProp, TMatcherValue> | undefined;
|
|
11
|
+
}) => import('react').ReactNode;
|
|
12
|
+
Sorting: import('react').ComponentType<import('./model/sorting/types').SortingShape<T>>;
|
|
13
|
+
ItemView: import('react').ComponentType<{
|
|
14
|
+
children: import('./model/item/types').RenderItemFn<T>;
|
|
15
|
+
}>;
|
|
16
|
+
StaticData: import('react').ComponentType<{
|
|
17
|
+
data: T[];
|
|
18
|
+
}>;
|
|
19
|
+
LoaderAsync: import('react').ComponentType<Omit<import('./model/loading/types').AsyncDataLoaderShape<T>, "asyncLoader"> & {
|
|
20
|
+
children: import('./model/loading/types').AsyncDataLoader<T>;
|
|
21
|
+
}>;
|
|
22
|
+
LoaderAsyncResource: import('react').ComponentType<Omit<import('./model/loading/types').AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
|
|
23
|
+
children: (options?: import('./model/loading/types').DataLoaderOptions<T> | undefined) => import('@mittwald/react-use-promise').AsyncResource<import('./model/loading/types').DataLoaderResult<T>>;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ItemType<T> = T extends (infer TItem)[] ? TItem : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.175",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
"dependencies": {
|
|
281
281
|
"@chakra-ui/live-region": "^2.1.0",
|
|
282
282
|
"@internationalized/string-compiler": "^3.2.4",
|
|
283
|
-
"@mittwald/react-tunnel": "^0.1.0-alpha.
|
|
283
|
+
"@mittwald/react-tunnel": "^0.1.0-alpha.175",
|
|
284
284
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
285
285
|
"@react-aria/utils": "^3.24.1",
|
|
286
286
|
"@react-types/shared": "^3.23.1",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
},
|
|
308
308
|
"devDependencies": {
|
|
309
309
|
"@faker-js/faker": "^8.4.1",
|
|
310
|
-
"@mittwald/flow-design-tokens": "^0.1.0-alpha.
|
|
310
|
+
"@mittwald/flow-design-tokens": "^0.1.0-alpha.175",
|
|
311
311
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
312
312
|
"@nx/storybook": "^19.4.0",
|
|
313
313
|
"@storybook/addon-a11y": "^8.1.11",
|
|
@@ -383,5 +383,5 @@
|
|
|
383
383
|
"optional": true
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
|
-
"gitHead": "
|
|
386
|
+
"gitHead": "d574568700b63fa336578f7ac2454fdd3add2720"
|
|
387
387
|
}
|