@uxf/data-grid 10.0.0-beta.8 → 10.0.0-beta.81
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/data-grid.js +16 -24
- package/data-grid.stories.js +10 -9
- package/hooks/use-rdg-visuals.d.ts +18 -0
- package/hooks/use-rdg-visuals.js +47 -0
- package/hooks/useColumns.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +12 -10
- package/store/actions.d.ts +3 -3
- package/store/reducer.d.ts +1 -1
- package/tailwindui/body-cell/body-cell-boolean.js +1 -1
- package/tailwindui/body-cell/body-cell-date.js +1 -1
- package/tailwindui/body-cell/body-cell-datetime.js +1 -1
- package/tailwindui/body-cell/body-cell-email.js +1 -1
- package/tailwindui/body-cell/body-cell-phone.js +1 -1
- package/tailwindui/body-cell/body-cell-url.js +1 -1
- package/tailwindui/body-cell/index.js +3 -3
- package/tailwindui/components/action-cell-base.js +5 -3
- package/tailwindui/components/drawer.js +17 -10
- package/tailwindui/components/no-rows-fallback.js +1 -1
- package/tailwindui/components/pagination-rows-per-page-select.js +1 -1
- package/tailwindui/components/select-row-checkbox.js +5 -6
- package/tailwindui/components/selected-rows-toolbar.js +1 -1
- package/tailwindui/components/toolbar-control.js +27 -9
- package/tailwindui/components/toolbar-customs.js +1 -1
- package/tailwindui/components/toolbar-tabs.js +3 -3
- package/tailwindui/data-grid.d.ts +1 -1
- package/tailwindui/data-grid.js +1 -1
- package/tailwindui/filter-handler/bool-filter.js +1 -1
- package/tailwindui/filter-handler/boolean-filter.js +3 -3
- package/tailwindui/filter-handler/index.js +2 -1
- package/tailwindui/filter-handler/interval-filter.js +1 -1
- package/tailwindui/filter-handler/select-filter.js +1 -1
- package/tailwindui/filter-handler/text-filter.js +1 -1
- package/tailwindui/index.d.ts +1 -1
- package/tailwindui/index.js +1 -1
- package/tailwindui/styles.css +371 -131
- package/tailwindui/ui.js +9 -9
- package/types/api.d.ts +2 -2
- package/types/components.d.ts +9 -8
- package/types/core.d.ts +1 -0
- package/types/data-grid-props.d.ts +5 -4
- package/types/index.d.ts +3 -3
- package/types/index.js +3 -3
- package/types/schema.d.ts +5 -2
- package/types/schema.js +6 -0
- package/types/state.d.ts +2 -2
- package/types/ui-components.d.ts +1 -1
- package/utils.d.ts +2 -2
package/tailwindui/ui.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UI = void 0;
|
|
4
|
+
const pagination_1 = require("@uxf/ui/pagination/pagination");
|
|
5
|
+
const body_cell_1 = require("./body-cell");
|
|
4
6
|
const action_cell_base_1 = require("./components/action-cell-base");
|
|
5
|
-
const no_rows_fallback_1 = require("./components/no-rows-fallback");
|
|
6
|
-
const linear_progress_1 = require("./components/linear-progress");
|
|
7
|
-
const toolbar_1 = require("./components/toolbar");
|
|
8
7
|
const container_1 = require("./components/container");
|
|
9
8
|
const filter_list_1 = require("./components/filter-list");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const linear_progress_1 = require("./components/linear-progress");
|
|
10
|
+
const no_rows_fallback_1 = require("./components/no-rows-fallback");
|
|
12
11
|
const pagination_counts_1 = require("./components/pagination-counts");
|
|
13
12
|
const pagination_rows_per_page_select_1 = require("./components/pagination-rows-per-page-select");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
13
|
+
const select_row_checkbox_1 = require("./components/select-row-checkbox");
|
|
14
|
+
const selected_rows_toolbar_1 = require("./components/selected-rows-toolbar");
|
|
15
|
+
const toolbar_1 = require("./components/toolbar");
|
|
17
16
|
const toolbar_control_1 = require("./components/toolbar-control");
|
|
18
17
|
const toolbar_customs_1 = require("./components/toolbar-customs");
|
|
19
|
-
const
|
|
18
|
+
const toolbar_tabs_1 = require("./components/toolbar-tabs");
|
|
19
|
+
const filter_handler_1 = require("./filter-handler");
|
|
20
20
|
exports.UI = {
|
|
21
21
|
ActionCell: action_cell_base_1.ActionCellBase,
|
|
22
22
|
actionCellWidth: 128,
|
package/types/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataGridSortDir } from "./schema";
|
|
2
2
|
export type ResultItem = any;
|
|
3
3
|
export interface RequestFilter<T = any> {
|
|
4
4
|
name: string;
|
|
@@ -9,7 +9,7 @@ export interface RequestFilter<T = any> {
|
|
|
9
9
|
export interface Request {
|
|
10
10
|
f?: RequestFilter[];
|
|
11
11
|
sort?: string;
|
|
12
|
-
dir?:
|
|
12
|
+
dir?: DataGridSortDir;
|
|
13
13
|
page?: number;
|
|
14
14
|
perPage?: number;
|
|
15
15
|
search?: string;
|
package/types/components.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { PaginationProps } from "@uxf/ui/pagination/pagination";
|
|
1
2
|
import React, { ComponentType, FC, ReactElement, ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
+
import { RenderCheckboxProps } from "react-data-grid";
|
|
3
4
|
import { RequestFilter, Response } from "./api";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ChangeHiddenColumnsHandler, CsvDownloadHandler } from "./core";
|
|
6
|
+
import { BaseGridType, Columns, Filter, Filters, Schema } from "./schema";
|
|
7
|
+
import { DataGridState } from "./state";
|
|
7
8
|
/**
|
|
8
9
|
* Action cell
|
|
9
10
|
*/
|
|
@@ -13,7 +14,7 @@ export interface ActionCellProps<R> {
|
|
|
13
14
|
getOpenUrl?: (row: R) => string | null | undefined;
|
|
14
15
|
onEdit?: (row: R) => void;
|
|
15
16
|
getEditUrl?: (row: R) => string | null | undefined;
|
|
16
|
-
onRemove?: (row: R) => void;
|
|
17
|
+
onRemove?: (row: R, reload: () => void) => void;
|
|
17
18
|
reload: () => Promise<void>;
|
|
18
19
|
}
|
|
19
20
|
export type ActionCellComponent<R> = FC<ActionCellProps<R>>;
|
|
@@ -127,7 +128,7 @@ export type SelectedRowsToolbarComponent = FC<SelectedRowsToolbarProps>;
|
|
|
127
128
|
/**
|
|
128
129
|
* Select row checkbox
|
|
129
130
|
*/
|
|
130
|
-
export type SelectRowCheckboxComponent = React.FC<
|
|
131
|
+
export type SelectRowCheckboxComponent = React.FC<RenderCheckboxProps>;
|
|
131
132
|
/**
|
|
132
133
|
* Selected rows toolbar actions
|
|
133
134
|
*/
|
|
@@ -152,14 +153,14 @@ export interface ToolbarControlProps {
|
|
|
152
153
|
gridName: string | undefined;
|
|
153
154
|
schema: Schema<any>;
|
|
154
155
|
dispatch: (action: any) => void;
|
|
155
|
-
filtersData: RequestFilter[];
|
|
156
156
|
filterHandlers: FilterHandlers;
|
|
157
|
-
fulltextValue: string;
|
|
158
157
|
onFulltextChange: (value: string) => void;
|
|
159
158
|
noBorder: boolean | null | undefined;
|
|
160
159
|
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
160
|
+
onCsvDownload?: CsvDownloadHandler;
|
|
161
161
|
hiddenColumns?: string[];
|
|
162
162
|
showFulltext?: boolean;
|
|
163
|
+
state: DataGridState;
|
|
163
164
|
}
|
|
164
165
|
export type ToolbarControlComponent = React.FC<ToolbarControlProps>;
|
|
165
166
|
/**
|
package/types/core.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Request, Response, ResultItem } from "./api";
|
|
|
2
2
|
import { BaseGridType } from "./schema";
|
|
3
3
|
export type KeyExtractor = (row: ResultItem) => number;
|
|
4
4
|
export type ChangeHiddenColumnsHandler = (hiddenColumns: string[]) => void;
|
|
5
|
+
export type CsvDownloadHandler = (request: Request) => void;
|
|
5
6
|
export type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
6
7
|
export type CallbackRef = {
|
|
7
8
|
reload: () => Promise<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BaseGridType, Schema } from "./schema";
|
|
2
1
|
import { MutableRefObject, ReactNode } from "react";
|
|
3
|
-
import { Request } from "./api";
|
|
4
2
|
import { DataGridProps as RDGProps } from "react-data-grid";
|
|
3
|
+
import { Request } from "./api";
|
|
5
4
|
import { ToolbarCustomsProps } from "./components";
|
|
5
|
+
import { CallbackRef, ChangeHiddenColumnsHandler, Config, CsvDownloadHandler, KeyExtractor, Loader } from "./core";
|
|
6
|
+
import { BaseGridType, Schema } from "./schema";
|
|
6
7
|
import { UIComponents } from "./ui-components";
|
|
7
|
-
import { CallbackRef, ChangeHiddenColumnsHandler, Config, KeyExtractor, Loader } from "./core";
|
|
8
8
|
export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
9
9
|
callbackRef?: MutableRefObject<CallbackRef | undefined>;
|
|
10
10
|
schema: Schema<GridType>;
|
|
@@ -14,6 +14,7 @@ export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
|
14
14
|
keyExtractor?: KeyExtractor;
|
|
15
15
|
initialState?: Request | string;
|
|
16
16
|
onChangeHiddenColumns?: ChangeHiddenColumnsHandler;
|
|
17
|
+
onCsvDownload?: CsvDownloadHandler;
|
|
17
18
|
hiddenColumns?: string[];
|
|
18
19
|
onChangeSelectedRows?: (selectedRows: Set<number>) => void;
|
|
19
20
|
selectedRows?: Set<number>;
|
|
@@ -21,7 +22,7 @@ export type DataGridBaseProps<GridType extends BaseGridType, R> = {
|
|
|
21
22
|
getOpenUrl?: (row: R) => string | null | undefined;
|
|
22
23
|
onEdit?: (row: R) => void;
|
|
23
24
|
getEditUrl?: (row: R) => string | null | undefined;
|
|
24
|
-
onRemove?: (row: R) => void;
|
|
25
|
+
onRemove?: (row: R, reload: () => void) => void;
|
|
25
26
|
noBorder?: boolean;
|
|
26
27
|
rowHeight?: RDGProps<any>["rowHeight"];
|
|
27
28
|
headerRowHeight?: RDGProps<any>["headerRowHeight"];
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./core";
|
|
2
1
|
export * from "./api";
|
|
3
|
-
export * from "./schema";
|
|
4
2
|
export * from "./components";
|
|
5
|
-
export * from "./
|
|
3
|
+
export * from "./core";
|
|
6
4
|
export * from "./data-grid-props";
|
|
5
|
+
export * from "./schema";
|
|
6
|
+
export * from "./state";
|
|
7
7
|
export * from "./ui-components";
|
package/types/index.js
CHANGED
|
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./core"), exports);
|
|
18
17
|
__exportStar(require("./api"), exports);
|
|
19
|
-
__exportStar(require("./schema"), exports);
|
|
20
18
|
__exportStar(require("./components"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./core"), exports);
|
|
22
20
|
__exportStar(require("./data-grid-props"), exports);
|
|
21
|
+
__exportStar(require("./schema"), exports);
|
|
22
|
+
__exportStar(require("./state"), exports);
|
|
23
23
|
__exportStar(require("./ui-components"), exports);
|
package/types/schema.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
export
|
|
2
|
+
export declare enum DataGridSortDir {
|
|
3
|
+
Asc = "asc",
|
|
4
|
+
Desc = "desc"
|
|
5
|
+
}
|
|
3
6
|
export interface Tab {
|
|
4
7
|
name: string;
|
|
5
8
|
label: string;
|
|
@@ -42,7 +45,7 @@ export interface Schema<GritType extends BaseGridType> {
|
|
|
42
45
|
filters: Filters<GritType["filters"]>[];
|
|
43
46
|
tabs?: Tab[];
|
|
44
47
|
sort: string;
|
|
45
|
-
dir:
|
|
48
|
+
dir: DataGridSortDir;
|
|
46
49
|
perPage: number;
|
|
47
50
|
fullText?: boolean;
|
|
48
51
|
}
|
package/types/schema.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridSortDir = void 0;
|
|
4
|
+
var DataGridSortDir;
|
|
5
|
+
(function (DataGridSortDir) {
|
|
6
|
+
DataGridSortDir["Asc"] = "asc";
|
|
7
|
+
DataGridSortDir["Desc"] = "desc";
|
|
8
|
+
})(DataGridSortDir || (exports.DataGridSortDir = DataGridSortDir = {}));
|
package/types/state.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RequestFilter, Response } from "./api";
|
|
2
|
-
import {
|
|
2
|
+
import { DataGridSortDir } from "./schema";
|
|
3
3
|
type GridRequest = {
|
|
4
4
|
f: RequestFilter[];
|
|
5
5
|
sort: string | null;
|
|
6
|
-
dir:
|
|
6
|
+
dir: DataGridSortDir | null;
|
|
7
7
|
page: number;
|
|
8
8
|
perPage: number;
|
|
9
9
|
search: string;
|
package/types/ui-components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGridType } from "./schema";
|
|
2
1
|
import { ActionCellComponent, BodyCellComponents, ContainerComponent, FilterHandlers, FilterListComponent, LinearProgressComponent, NoRowsFallbackComponent, PaginationComponent, PaginationCountsComponent, PaginationRowsPerPageSelectComponent, SelectedRowsToolbarActionsComponent, SelectedRowsToolbarComponent, SelectRowCheckboxComponent, ToolbarComponent, ToolbarControlComponent, ToolbarCustomsComponent, ToolbarTabsComponent } from "./components";
|
|
2
|
+
import { BaseGridType } from "./schema";
|
|
3
3
|
export type ActionCellWithRequiredWidth<R> = {
|
|
4
4
|
ActionCell?: ActionCellComponent<R>;
|
|
5
5
|
actionCellWidth: number;
|
package/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DataGridState, Request
|
|
1
|
+
import { DataGridSortDir, DataGridState, Request } from "./types";
|
|
2
2
|
export declare function decodeFilter(filterString: string): null | Request;
|
|
3
3
|
export declare function encodeFilter(request: Request): string;
|
|
4
|
-
export declare function createRequest(state: DataGridState, defaultSort: string, defaultDir:
|
|
4
|
+
export declare function createRequest(state: DataGridState, defaultSort: string, defaultDir: DataGridSortDir): Request;
|
|
5
5
|
export type ClassArray = ClassValue[];
|
|
6
6
|
export type ClassValue = ClassArray | Record<string, any> | string | number | null | boolean | undefined;
|
|
7
7
|
export declare function cx(...classes: ClassValue[]): string;
|