@uxf/data-grid 5.0.0-beta.8 → 10.0.0-beta.1
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/{DataGrid.d.ts → data-grid.d.ts} +2 -2
- package/data-grid.js +136 -0
- package/data-grid.stories.d.ts +7 -0
- package/data-grid.stories.js +245 -0
- package/hooks/useCallbackRef.js +2 -3
- package/hooks/useColumns.js +35 -54
- package/index.d.ts +1 -1
- package/index.js +1 -2
- package/package.json +5 -36
- package/store/actions.js +29 -30
- package/store/reducer.js +107 -77
- package/tailwindui/body-cell/body-cell-boolean.js +6 -6
- package/tailwindui/body-cell/body-cell-date.js +4 -5
- package/tailwindui/body-cell/body-cell-datetime.js +4 -5
- package/tailwindui/body-cell/body-cell-default.js +2 -3
- package/tailwindui/body-cell/body-cell-email.js +4 -5
- package/tailwindui/body-cell/body-cell-phone.js +4 -5
- package/tailwindui/body-cell/body-cell-to-many.js +4 -5
- package/tailwindui/body-cell/body-cell-to-one.js +3 -4
- package/tailwindui/body-cell/body-cell-url.js +3 -4
- package/tailwindui/body-cell/index.js +9 -10
- package/tailwindui/components/action-cell-base.js +16 -17
- package/tailwindui/components/container.js +4 -5
- package/tailwindui/components/drawer.js +11 -17
- package/tailwindui/components/filter-list.js +10 -9
- package/tailwindui/components/footer.js +3 -4
- package/tailwindui/components/linear-progress.js +4 -6
- package/tailwindui/components/no-rows-fallback.js +6 -7
- package/tailwindui/components/pagination-counts.js +4 -5
- package/tailwindui/components/pagination-rows-per-page-select.js +5 -6
- package/tailwindui/components/select-row-checkbox.js +12 -29
- package/tailwindui/components/selected-rows-toolbar.js +11 -13
- package/tailwindui/components/toolbar-control.js +24 -38
- package/tailwindui/components/toolbar-customs.js +10 -6
- package/tailwindui/components/toolbar-tabs.js +23 -7
- package/tailwindui/components/toolbar.js +4 -6
- package/tailwindui/data-grid.d.ts +6 -0
- package/tailwindui/data-grid.js +36 -0
- package/tailwindui/filter-handler/bool-filter.d.ts +3 -0
- package/tailwindui/filter-handler/bool-filter.js +20 -0
- package/tailwindui/filter-handler/boolean-filter.js +7 -23
- package/tailwindui/filter-handler/index.js +7 -6
- package/tailwindui/filter-handler/interval-filter.js +29 -29
- package/tailwindui/filter-handler/select-filter.js +8 -20
- package/tailwindui/filter-handler/text-filter.js +7 -19
- package/tailwindui/index.d.ts +1 -1
- package/tailwindui/index.js +1 -2
- package/tailwindui/show.js +2 -3
- package/tailwindui/styles.css +212 -44
- package/tailwindui/ui.js +16 -17
- package/types/api.d.ts +1 -1
- package/types/api.js +0 -1
- package/types/components.d.ts +21 -20
- package/types/components.js +0 -1
- package/types/core.d.ts +9 -66
- package/types/core.js +0 -1
- package/types/data-grid-props.d.ts +37 -0
- package/types/data-grid-props.js +2 -0
- package/types/index.d.ts +2 -0
- package/types/index.js +2 -1
- package/types/schema.d.ts +6 -6
- package/types/schema.js +0 -1
- package/types/state.d.ts +1 -1
- package/types/state.js +0 -1
- package/types/ui-components.d.ts +27 -0
- package/types/ui-components.js +2 -0
- package/utils.d.ts +2 -2
- package/utils.js +10 -15
- package/DataGrid.js +0 -205
- package/README.md +0 -175
- package/icons-config/index.js +0 -62
- package/tailwindui/DataGrid.d.ts +0 -6
- package/tailwindui/DataGrid.js +0 -48
package/types/components.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface ActionCellProps<R> {
|
|
|
16
16
|
onRemove?: (row: R) => void;
|
|
17
17
|
reload: () => Promise<void>;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type ActionCellComponent<R> = FC<ActionCellProps<R>>;
|
|
20
20
|
/**
|
|
21
21
|
* Body cell
|
|
22
22
|
*/
|
|
@@ -26,8 +26,8 @@ export interface BodyCellProps<C, R> {
|
|
|
26
26
|
row: R;
|
|
27
27
|
reload: () => Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
30
|
-
export
|
|
29
|
+
export type BodyCellComponent<C extends BaseGridType["columns"], R> = ComponentType<BodyCellProps<Columns<C>, R>>;
|
|
30
|
+
export type BodyCellComponents<C, R> = {
|
|
31
31
|
[key: string]: BodyCellComponent<C, R>;
|
|
32
32
|
default: BodyCellComponent<C, R>;
|
|
33
33
|
};
|
|
@@ -39,7 +39,7 @@ export interface ContainerProps {
|
|
|
39
39
|
children: ReactNode;
|
|
40
40
|
className?: string;
|
|
41
41
|
}
|
|
42
|
-
export
|
|
42
|
+
export type ContainerComponent = FC<ContainerProps>;
|
|
43
43
|
/**
|
|
44
44
|
* Filter list
|
|
45
45
|
*/
|
|
@@ -51,7 +51,7 @@ export interface FilterListProps<F extends Filter<any, any>, T> {
|
|
|
51
51
|
filterHandlers: FilterHandlers;
|
|
52
52
|
noBorder: boolean | null | undefined;
|
|
53
53
|
}
|
|
54
|
-
export
|
|
54
|
+
export type FilterListComponent<F extends BaseGridType["filters"], T = any> = ComponentType<FilterListProps<Filters<F>, T>>;
|
|
55
55
|
/**
|
|
56
56
|
* Filters
|
|
57
57
|
*/
|
|
@@ -62,13 +62,13 @@ export interface FilterProps<F extends Filter<any, any>, T> {
|
|
|
62
62
|
onFilter: (value: RequestFilter<T>) => void;
|
|
63
63
|
onClear: () => void;
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export type FilterComponent<F extends BaseGridType["filters"], T = any> = ComponentType<FilterProps<Filters<F>, T>>;
|
|
66
66
|
export interface FilterHandler {
|
|
67
67
|
input: FilterComponent<any>;
|
|
68
68
|
listItem: FilterComponent<any>;
|
|
69
69
|
}
|
|
70
70
|
export interface FilterHandlers {
|
|
71
|
-
[
|
|
71
|
+
[key: string]: FilterHandler;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Footer
|
|
@@ -77,14 +77,14 @@ export interface FooterProps {
|
|
|
77
77
|
children: ReactNode;
|
|
78
78
|
noBorder?: boolean;
|
|
79
79
|
}
|
|
80
|
-
export
|
|
80
|
+
export type FooterComponent = FC<FooterProps>;
|
|
81
81
|
/**
|
|
82
82
|
* Linear progress
|
|
83
83
|
*/
|
|
84
84
|
export interface LinearProgressProps {
|
|
85
85
|
loading: boolean;
|
|
86
86
|
}
|
|
87
|
-
export
|
|
87
|
+
export type LinearProgressComponent = FC<LinearProgressProps>;
|
|
88
88
|
/**
|
|
89
89
|
* No rows fallback
|
|
90
90
|
*/
|
|
@@ -92,11 +92,11 @@ export interface NoRowsFallbackProps {
|
|
|
92
92
|
error?: any;
|
|
93
93
|
loading: boolean;
|
|
94
94
|
}
|
|
95
|
-
export
|
|
95
|
+
export type NoRowsFallbackComponent = React.FC<NoRowsFallbackProps>;
|
|
96
96
|
/**
|
|
97
97
|
* Pagination
|
|
98
98
|
*/
|
|
99
|
-
export
|
|
99
|
+
export type PaginationComponent = React.FC<PaginationProps>;
|
|
100
100
|
/**
|
|
101
101
|
* Pagination rows per page select
|
|
102
102
|
*/
|
|
@@ -104,7 +104,7 @@ export interface PaginationRowsPerPageSelectProps {
|
|
|
104
104
|
value: number;
|
|
105
105
|
onChange: (value: number) => void;
|
|
106
106
|
}
|
|
107
|
-
export
|
|
107
|
+
export type PaginationRowsPerPageSelectComponent = FC<PaginationRowsPerPageSelectProps>;
|
|
108
108
|
/**
|
|
109
109
|
* Pagination counts
|
|
110
110
|
*/
|
|
@@ -113,7 +113,7 @@ export interface PaginationCountsProps {
|
|
|
113
113
|
perPage: number;
|
|
114
114
|
response?: Response;
|
|
115
115
|
}
|
|
116
|
-
export
|
|
116
|
+
export type PaginationCountsComponent = FC<PaginationCountsProps>;
|
|
117
117
|
/**
|
|
118
118
|
* Selected rows toolbar
|
|
119
119
|
*/
|
|
@@ -123,11 +123,11 @@ export interface SelectedRowsToolbarProps {
|
|
|
123
123
|
Actions?: SelectedRowsToolbarActionsComponent;
|
|
124
124
|
reload: () => Promise<void>;
|
|
125
125
|
}
|
|
126
|
-
export
|
|
126
|
+
export type SelectedRowsToolbarComponent = FC<SelectedRowsToolbarProps>;
|
|
127
127
|
/**
|
|
128
128
|
* Select row checkbox
|
|
129
129
|
*/
|
|
130
|
-
export
|
|
130
|
+
export type SelectRowCheckboxComponent = React.FC<CheckboxFormatterProps>;
|
|
131
131
|
/**
|
|
132
132
|
* Selected rows toolbar actions
|
|
133
133
|
*/
|
|
@@ -136,7 +136,7 @@ export interface SelectedRowsToolbarActionsProps {
|
|
|
136
136
|
onChangeSelectedRows: (rows: Set<number>) => void;
|
|
137
137
|
reload: () => Promise<void>;
|
|
138
138
|
}
|
|
139
|
-
export
|
|
139
|
+
export type SelectedRowsToolbarActionsComponent = FC<SelectedRowsToolbarActionsProps>;
|
|
140
140
|
/**
|
|
141
141
|
* Toolbar
|
|
142
142
|
*/
|
|
@@ -144,7 +144,7 @@ export interface ToolbarProps {
|
|
|
144
144
|
children: ReactNode;
|
|
145
145
|
noBorder?: boolean;
|
|
146
146
|
}
|
|
147
|
-
export
|
|
147
|
+
export type ToolbarComponent = FC<ToolbarProps>;
|
|
148
148
|
/**
|
|
149
149
|
* Toolbar control
|
|
150
150
|
*/
|
|
@@ -159,8 +159,9 @@ export interface ToolbarControlProps {
|
|
|
159
159
|
noBorder: boolean | null | undefined;
|
|
160
160
|
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
161
161
|
hiddenColumns?: string[];
|
|
162
|
+
showFulltext?: boolean;
|
|
162
163
|
}
|
|
163
|
-
export
|
|
164
|
+
export type ToolbarControlComponent = React.FC<ToolbarControlProps>;
|
|
164
165
|
/**
|
|
165
166
|
* Toolbar customs
|
|
166
167
|
*/
|
|
@@ -172,7 +173,7 @@ export interface ToolbarCustomsProps {
|
|
|
172
173
|
variant?: "default" | "outlined" | "text";
|
|
173
174
|
}[];
|
|
174
175
|
}
|
|
175
|
-
export
|
|
176
|
+
export type ToolbarCustomsComponent = React.FC<ToolbarCustomsProps>;
|
|
176
177
|
/**
|
|
177
178
|
* Toolbar tabs
|
|
178
179
|
*/
|
|
@@ -181,4 +182,4 @@ export interface ToolbarTabsProps {
|
|
|
181
182
|
onChange: (tabName: string) => void;
|
|
182
183
|
schema: Schema<any>;
|
|
183
184
|
}
|
|
184
|
-
export
|
|
185
|
+
export type ToolbarTabsComponent = React.FC<ToolbarTabsProps>;
|
package/types/components.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9jb21wb25lbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
package/types/core.d.ts
CHANGED
|
@@ -1,75 +1,18 @@
|
|
|
1
|
-
import { MutableRefObject, ReactNode } from "react";
|
|
2
|
-
import { DataGridProps as RDGProps } from "react-data-grid";
|
|
3
1
|
import { Request, Response, ResultItem } from "./api";
|
|
4
|
-
import { BaseGridType
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export declare type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
10
|
-
export declare type CallbackRef = {
|
|
2
|
+
import { BaseGridType } from "./schema";
|
|
3
|
+
export type KeyExtractor = (row: ResultItem) => number;
|
|
4
|
+
export type ChangeHiddenColumnsHandler = (hiddenColumns: string[]) => void;
|
|
5
|
+
export type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
6
|
+
export type CallbackRef = {
|
|
11
7
|
reload: () => Promise<void>;
|
|
12
8
|
};
|
|
13
|
-
export
|
|
9
|
+
export type Config<C extends BaseGridType["columns"]> = {
|
|
14
10
|
columns: Partial<{
|
|
15
11
|
[columnName in keyof C]: {
|
|
16
|
-
width?: number;
|
|
17
12
|
hidden?: boolean;
|
|
13
|
+
maxWidth?: number;
|
|
14
|
+
minWidth?: number;
|
|
15
|
+
width?: number;
|
|
18
16
|
};
|
|
19
17
|
}>;
|
|
20
18
|
};
|
|
21
|
-
export declare type ActionCellWithRequiredWidth<R> = {
|
|
22
|
-
ActionCell?: ActionCellComponent<R>;
|
|
23
|
-
actionCellWidth: number;
|
|
24
|
-
} | {
|
|
25
|
-
ActionCell?: never;
|
|
26
|
-
actionCellWidth?: never;
|
|
27
|
-
};
|
|
28
|
-
export declare type UIComponents<GridType extends BaseGridType, R> = {
|
|
29
|
-
BodyCells: BodyCellComponents<GridType["columns"], R>;
|
|
30
|
-
Container: ContainerComponent;
|
|
31
|
-
FilterHandlers: FilterHandlers;
|
|
32
|
-
FilterList: FilterListComponent<GridType["filters"], R>;
|
|
33
|
-
LinearProgress: LinearProgressComponent;
|
|
34
|
-
NoRowsFallback: NoRowsFallbackComponent;
|
|
35
|
-
Pagination: PaginationComponent;
|
|
36
|
-
PaginationCounts: PaginationCountsComponent;
|
|
37
|
-
PaginationRowsPerPageSelect: PaginationRowsPerPageSelectComponent;
|
|
38
|
-
SelectRowCheckbox: SelectRowCheckboxComponent;
|
|
39
|
-
SelectedRowsToolbar: SelectedRowsToolbarComponent;
|
|
40
|
-
SelectedRowsToolbarActions?: SelectedRowsToolbarActionsComponent;
|
|
41
|
-
Toolbar: ToolbarComponent;
|
|
42
|
-
ToolbarControl: ToolbarControlComponent;
|
|
43
|
-
ToolbarCustoms: ToolbarCustomsComponent;
|
|
44
|
-
ToolbarTabs: ToolbarTabsComponent;
|
|
45
|
-
} & ActionCellWithRequiredWidth<R>;
|
|
46
|
-
export declare type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
47
|
-
callbackRef?: MutableRefObject<CallbackRef | undefined>;
|
|
48
|
-
schema: Schema<GridType>;
|
|
49
|
-
loader: Loader;
|
|
50
|
-
gridName?: string;
|
|
51
|
-
title?: ReactNode;
|
|
52
|
-
keyExtractor?: KeyExtractor;
|
|
53
|
-
initialState?: Request | string;
|
|
54
|
-
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
55
|
-
hiddenColumns?: string[];
|
|
56
|
-
onCsvDownload?: CsvDownloadHandler;
|
|
57
|
-
onChangeSelectedRows?: (selectedRows: Set<number>) => void;
|
|
58
|
-
selectedRows?: Set<number>;
|
|
59
|
-
onOpen?: (row: R) => void;
|
|
60
|
-
getOpenUrl?: (row: R) => string | null | undefined;
|
|
61
|
-
onEdit?: (row: R) => void;
|
|
62
|
-
getEditUrl?: (row: R) => string | null | undefined;
|
|
63
|
-
onRemove?: (row: R) => void;
|
|
64
|
-
noBorder?: boolean;
|
|
65
|
-
rowHeight?: RDGProps<any>["rowHeight"];
|
|
66
|
-
headerRowHeight?: RDGProps<any>["headerRowHeight"];
|
|
67
|
-
defaultConfig?: Config<GridType["columns"]>;
|
|
68
|
-
rowClass?: (row: R) => "success" | "warning" | "error" | "primary" | "secondary" | string | null | undefined;
|
|
69
|
-
debug?: boolean;
|
|
70
|
-
className?: string;
|
|
71
|
-
customActions?: ToolbarCustomsProps["buttons"];
|
|
72
|
-
};
|
|
73
|
-
export declare type DataGridProps<GridType extends BaseGridType, R> = DataGridBaseProps<GridType, R> & {
|
|
74
|
-
ui: UIComponents<GridType, R>;
|
|
75
|
-
};
|
package/types/core.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9jb3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseGridType, Schema } from "./schema";
|
|
2
|
+
import { MutableRefObject, ReactNode } from "react";
|
|
3
|
+
import { Request } from "./api";
|
|
4
|
+
import { DataGridProps as RDGProps } from "react-data-grid";
|
|
5
|
+
import { ToolbarCustomsProps } from "./components";
|
|
6
|
+
import { UIComponents } from "./ui-components";
|
|
7
|
+
import { CallbackRef, ChangeHiddenColumnsHandler, Config, KeyExtractor, Loader } from "./core";
|
|
8
|
+
export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
9
|
+
callbackRef?: MutableRefObject<CallbackRef | undefined>;
|
|
10
|
+
schema: Schema<GridType>;
|
|
11
|
+
loader: Loader;
|
|
12
|
+
gridName?: string;
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
keyExtractor?: KeyExtractor;
|
|
15
|
+
initialState?: Request | string;
|
|
16
|
+
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
17
|
+
hiddenColumns?: string[];
|
|
18
|
+
onChangeSelectedRows?: (selectedRows: Set<number>) => void;
|
|
19
|
+
selectedRows?: Set<number>;
|
|
20
|
+
onOpen?: (row: R) => void;
|
|
21
|
+
getOpenUrl?: (row: R) => string | null | undefined;
|
|
22
|
+
onEdit?: (row: R) => void;
|
|
23
|
+
getEditUrl?: (row: R) => string | null | undefined;
|
|
24
|
+
onRemove?: (row: R) => void;
|
|
25
|
+
noBorder?: boolean;
|
|
26
|
+
rowHeight?: RDGProps<any>["rowHeight"];
|
|
27
|
+
headerRowHeight?: RDGProps<any>["headerRowHeight"];
|
|
28
|
+
defaultConfig?: Config<GridType["columns"]>;
|
|
29
|
+
rowClass?: (row: R) => "success" | "warning" | "error" | "primary" | "secondary" | string | null | undefined;
|
|
30
|
+
debug?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
customActions?: ToolbarCustomsProps["buttons"];
|
|
33
|
+
mode?: "light" | "dark";
|
|
34
|
+
};
|
|
35
|
+
export type DataGridProps<GridType extends BaseGridType, R> = DataGridBaseProps<GridType, R> & {
|
|
36
|
+
ui: UIComponents<GridType, R>;
|
|
37
|
+
};
|
package/types/index.d.ts
CHANGED
package/types/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./api"), exports);
|
|
|
19
19
|
__exportStar(require("./schema"), exports);
|
|
20
20
|
__exportStar(require("./components"), exports);
|
|
21
21
|
__exportStar(require("./state"), exports);
|
|
22
|
-
|
|
22
|
+
__exportStar(require("./data-grid-props"), exports);
|
|
23
|
+
__exportStar(require("./ui-components"), exports);
|
package/types/schema.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
export
|
|
2
|
+
export type SortDirection = "asc" | "desc";
|
|
3
3
|
export interface Tab {
|
|
4
4
|
name: string;
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type BaseGridType = {
|
|
9
9
|
columns: any;
|
|
10
10
|
filters: any;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Column<Name, Type> = {
|
|
13
13
|
name: Name;
|
|
14
14
|
label: string | ReactElement;
|
|
15
15
|
type: Type;
|
|
@@ -21,7 +21,7 @@ export declare type Column<Name, Type> = {
|
|
|
21
21
|
maxWidth?: number;
|
|
22
22
|
frozen?: boolean;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type Columns<C extends BaseGridType["columns"]> = {
|
|
25
25
|
[K in keyof C]: Column<K, C[K]>;
|
|
26
26
|
}[keyof C];
|
|
27
27
|
export interface FilterOption {
|
|
@@ -34,13 +34,13 @@ export interface Filter<N, T> {
|
|
|
34
34
|
type?: T;
|
|
35
35
|
options?: FilterOption[];
|
|
36
36
|
}
|
|
37
|
-
export
|
|
37
|
+
export type Filters<F extends BaseGridType["filters"]> = {
|
|
38
38
|
[K in keyof F]: Filter<K, F[K]>;
|
|
39
39
|
}[keyof F];
|
|
40
40
|
export interface Schema<GritType extends BaseGridType> {
|
|
41
41
|
columns: Columns<GritType["columns"]>[];
|
|
42
42
|
filters: Filters<GritType["filters"]>[];
|
|
43
|
-
tabs
|
|
43
|
+
tabs?: Tab[];
|
|
44
44
|
sort: string;
|
|
45
45
|
dir: SortDirection;
|
|
46
46
|
perPage: number;
|
package/types/schema.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL3NjaGVtYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|
package/types/state.d.ts
CHANGED
package/types/state.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvc3RhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseGridType } from "./schema";
|
|
2
|
+
import { ActionCellComponent, BodyCellComponents, ContainerComponent, FilterHandlers, FilterListComponent, LinearProgressComponent, NoRowsFallbackComponent, PaginationComponent, PaginationCountsComponent, PaginationRowsPerPageSelectComponent, SelectedRowsToolbarActionsComponent, SelectedRowsToolbarComponent, SelectRowCheckboxComponent, ToolbarComponent, ToolbarControlComponent, ToolbarCustomsComponent, ToolbarTabsComponent } from "./components";
|
|
3
|
+
export type ActionCellWithRequiredWidth<R> = {
|
|
4
|
+
ActionCell?: ActionCellComponent<R>;
|
|
5
|
+
actionCellWidth: number;
|
|
6
|
+
} | {
|
|
7
|
+
ActionCell?: never;
|
|
8
|
+
actionCellWidth?: never;
|
|
9
|
+
};
|
|
10
|
+
export type UIComponents<GridType extends BaseGridType, R> = {
|
|
11
|
+
BodyCells: BodyCellComponents<GridType["columns"], R>;
|
|
12
|
+
Container: ContainerComponent;
|
|
13
|
+
FilterHandlers: FilterHandlers;
|
|
14
|
+
FilterList: FilterListComponent<GridType["filters"], R>;
|
|
15
|
+
LinearProgress: LinearProgressComponent;
|
|
16
|
+
NoRowsFallback: NoRowsFallbackComponent;
|
|
17
|
+
Pagination: PaginationComponent;
|
|
18
|
+
PaginationCounts: PaginationCountsComponent;
|
|
19
|
+
PaginationRowsPerPageSelect: PaginationRowsPerPageSelectComponent;
|
|
20
|
+
SelectRowCheckbox: SelectRowCheckboxComponent;
|
|
21
|
+
SelectedRowsToolbar: SelectedRowsToolbarComponent;
|
|
22
|
+
SelectedRowsToolbarActions?: SelectedRowsToolbarActionsComponent;
|
|
23
|
+
Toolbar: ToolbarComponent;
|
|
24
|
+
ToolbarControl: ToolbarControlComponent;
|
|
25
|
+
ToolbarCustoms: ToolbarCustomsComponent;
|
|
26
|
+
ToolbarTabs: ToolbarTabsComponent;
|
|
27
|
+
} & ActionCellWithRequiredWidth<R>;
|
package/utils.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { DataGridState, Request, SortDirection } from "./types";
|
|
|
2
2
|
export declare function decodeFilter(filterString: string): null | Request;
|
|
3
3
|
export declare function encodeFilter(request: Request): string;
|
|
4
4
|
export declare function createRequest(state: DataGridState, defaultSort: string, defaultDir: SortDirection): Request;
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ClassArray = ClassValue[];
|
|
6
|
+
export type ClassValue = ClassArray | Record<string, any> | string | number | null | boolean | undefined;
|
|
7
7
|
export declare function cx(...classes: ClassValue[]): string;
|
package/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cx = exports.createRequest = exports.encodeFilter = exports.decodeFilter = void 0;
|
|
4
4
|
function decodeFilter(filterString) {
|
|
5
5
|
try {
|
|
6
|
-
|
|
6
|
+
const filter = JSON.parse(decodeURIComponent(escape(atob(filterString))));
|
|
7
7
|
return {
|
|
8
8
|
f: filter.f || [],
|
|
9
9
|
perPage: filter.perPage || 10,
|
|
@@ -28,16 +28,16 @@ function createRequest(state, defaultSort, defaultDir) {
|
|
|
28
28
|
dir: (_b = state.request.dir) !== null && _b !== void 0 ? _b : defaultDir,
|
|
29
29
|
perPage: state.request.perPage,
|
|
30
30
|
page: state.request.page,
|
|
31
|
-
f: state.request.f.filter(
|
|
31
|
+
f: state.request.f.filter((f) => f.value !== undefined && f.value !== null && f.value !== ""),
|
|
32
32
|
search: state.request.search,
|
|
33
33
|
tab: state.request.tab,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
exports.createRequest = createRequest;
|
|
37
37
|
function toVal(mix) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
let k;
|
|
39
|
+
let y;
|
|
40
|
+
let str = "";
|
|
41
41
|
if (typeof mix === "string" || typeof mix === "number") {
|
|
42
42
|
str += mix;
|
|
43
43
|
}
|
|
@@ -67,15 +67,11 @@ function toVal(mix) {
|
|
|
67
67
|
}
|
|
68
68
|
return str;
|
|
69
69
|
}
|
|
70
|
-
function cx() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var i = 0;
|
|
76
|
-
var tmp;
|
|
77
|
-
var x;
|
|
78
|
-
var str = "";
|
|
70
|
+
function cx(...classes) {
|
|
71
|
+
let i = 0;
|
|
72
|
+
let tmp;
|
|
73
|
+
let x;
|
|
74
|
+
let str = "";
|
|
79
75
|
while (i < classes.length) {
|
|
80
76
|
if ((tmp = classes[i++])) {
|
|
81
77
|
if ((x = toVal(tmp))) {
|
|
@@ -89,4 +85,3 @@ function cx() {
|
|
|
89
85
|
return str;
|
|
90
86
|
}
|
|
91
87
|
exports.cx = cx;
|
|
92
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIi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