@uxf/data-grid 11.72.3 → 11.74.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/README.md +4 -4
- package/package.json +3 -3
- package/translations/translations.d.ts +173 -0
- package/translations/translations.js +174 -0
- package/_api/index.d.ts +0 -8
- package/_api/index.js +0 -11
- package/_components/drawer.d.ts +0 -8
- package/_components/drawer.js +0 -19
- package/_store/reducer.d.ts +0 -8
- package/_store/reducer.js +0 -209
- package/_story-utils/data.d.ts +0 -34
- package/_story-utils/data.js +0 -229
- package/_story-utils/grid-type.d.ts +0 -32
- package/_story-utils/grid-type.js +0 -2
- package/_story-utils/json-renderer.d.ts +0 -7
- package/_story-utils/json-renderer.js +0 -12
- package/_story-utils/loader.d.ts +0 -2
- package/_story-utils/loader.js +0 -33
- package/_story-utils/schema.d.ts +0 -3
- package/_story-utils/schema.js +0 -76
- package/body-cell/body-cell-boolean.d.ts +0 -2
- package/body-cell/body-cell-boolean.js +0 -18
- package/body-cell/body-cell-chip.d.ts +0 -12
- package/body-cell/body-cell-chip.js +0 -21
- package/body-cell/body-cell-date.d.ts +0 -2
- package/body-cell/body-cell-date.js +0 -15
- package/body-cell/body-cell-datetime.d.ts +0 -2
- package/body-cell/body-cell-datetime.js +0 -15
- package/body-cell/body-cell-default.d.ts +0 -2
- package/body-cell/body-cell-default.js +0 -17
- package/body-cell/body-cell-email.d.ts +0 -2
- package/body-cell/body-cell-email.js +0 -16
- package/body-cell/body-cell-money.d.ts +0 -8
- package/body-cell/body-cell-money.js +0 -15
- package/body-cell/body-cell-phone.d.ts +0 -2
- package/body-cell/body-cell-phone.js +0 -16
- package/body-cell/body-cell-to-many.d.ts +0 -2
- package/body-cell/body-cell-to-many.js +0 -17
- package/body-cell/body-cell-to-one.d.ts +0 -2
- package/body-cell/body-cell-to-one.js +0 -14
- package/body-cell/body-cell-url.d.ts +0 -2
- package/body-cell/body-cell-url.js +0 -16
- package/body-cell/index.d.ts +0 -2
- package/body-cell/index.js +0 -33
- package/components.d.ts +0 -97
- package/components.js +0 -124
- package/data-grid-custom-example.stories.d.ts +0 -2
- package/data-grid-custom-example.stories.js +0 -58
- package/data-grid-v2.d.ts +0 -3
- package/data-grid-v2.js +0 -41
- package/data-grid-v2.stories.d.ts +0 -2
- package/data-grid-v2.stories.js +0 -99
- package/data-grid.d.ts +0 -3
- package/data-grid.js +0 -42
- package/data-grid.stories.d.ts +0 -2
- package/data-grid.stories.js +0 -106
- package/export-button/export-button.d.ts +0 -8
- package/export-button/export-button.js +0 -16
- package/export-button/export-button.stories.d.ts +0 -2
- package/export-button/export-button.stories.js +0 -17
- package/export-button/index.d.ts +0 -1
- package/export-button/index.js +0 -17
- package/filter-handler/boolean-select.d.ts +0 -4
- package/filter-handler/boolean-select.js +0 -24
- package/filter-handler/checkbox.d.ts +0 -4
- package/filter-handler/checkbox.js +0 -19
- package/filter-handler/date.d.ts +0 -7
- package/filter-handler/date.js +0 -96
- package/filter-handler/datetime.d.ts +0 -7
- package/filter-handler/datetime.js +0 -34
- package/filter-handler/entity-multi-select.d.ts +0 -5
- package/filter-handler/entity-multi-select.js +0 -27
- package/filter-handler/entity-select.d.ts +0 -5
- package/filter-handler/entity-select.js +0 -23
- package/filter-handler/index.d.ts +0 -4
- package/filter-handler/index.js +0 -41
- package/filter-handler/interval.d.ts +0 -7
- package/filter-handler/interval.js +0 -47
- package/filter-handler/multi-select.d.ts +0 -5
- package/filter-handler/multi-select.js +0 -27
- package/filter-handler/select.d.ts +0 -5
- package/filter-handler/select.js +0 -22
- package/filter-handler/string.d.ts +0 -4
- package/filter-handler/string.js +0 -26
- package/filter-handler/types.d.ts +0 -7
- package/filter-handler/types.js +0 -2
- package/filter-list/filter-list.d.ts +0 -10
- package/filter-list/filter-list.js +0 -31
- package/filter-list/filter-list.stories.d.ts +0 -2
- package/filter-list/filter-list.stories.js +0 -18
- package/filter-list/index.d.ts +0 -1
- package/filter-list/index.js +0 -17
- package/filters/filters.d.ts +0 -9
- package/filters/filters.js +0 -21
- package/filters/filters.stories.d.ts +0 -2
- package/filters/filters.stories.js +0 -18
- package/filters/index.d.ts +0 -1
- package/filters/index.js +0 -17
- package/filters-button/filters-button.d.ts +0 -10
- package/filters-button/filters-button.js +0 -45
- package/filters-button/filters-button.stories.d.ts +0 -2
- package/filters-button/filters-button.stories.js +0 -18
- package/filters-button/index.d.ts +0 -1
- package/filters-button/index.js +0 -17
- package/footer/footer.d.ts +0 -5
- package/footer/footer.js +0 -10
- package/footer/index.d.ts +0 -1
- package/footer/index.js +0 -17
- package/fulltext-input/fulltext-input.d.ts +0 -6
- package/fulltext-input/fulltext-input.js +0 -13
- package/fulltext-input/fulltext-input.stories.d.ts +0 -2
- package/fulltext-input/fulltext-input.stories.js +0 -17
- package/fulltext-input/index.d.ts +0 -1
- package/fulltext-input/index.js +0 -17
- package/hidden-columns/hidden-columns.d.ts +0 -8
- package/hidden-columns/hidden-columns.js +0 -35
- package/hidden-columns/hidden-columns.stories.d.ts +0 -2
- package/hidden-columns/hidden-columns.stories.js +0 -17
- package/hidden-columns/index.d.ts +0 -1
- package/hidden-columns/index.js +0 -17
- package/hidden-columns-button/hidden-columns-button.d.ts +0 -8
- package/hidden-columns-button/hidden-columns-button.js +0 -42
- package/hidden-columns-button/hidden-columns-button.stories.d.ts +0 -2
- package/hidden-columns-button/hidden-columns-button.stories.js +0 -17
- package/hidden-columns-button/index.d.ts +0 -1
- package/hidden-columns-button/index.js +0 -17
- package/hooks/useCallbackRef.d.ts +0 -2
- package/hooks/useCallbackRef.js +0 -6
- package/index.d.ts +0 -5
- package/index.js +0 -25
- package/linear-progress/index.d.ts +0 -1
- package/linear-progress/index.js +0 -17
- package/linear-progress/linear-progress.d.ts +0 -5
- package/linear-progress/linear-progress.js +0 -12
- package/pagination/index.d.ts +0 -1
- package/pagination/index.js +0 -17
- package/pagination/pagination.d.ts +0 -12
- package/pagination/pagination.js +0 -15
- package/pagination/pagination.stories.d.ts +0 -2
- package/pagination/pagination.stories.js +0 -17
- package/root/index.d.ts +0 -1
- package/root/index.js +0 -17
- package/root/root.d.ts +0 -6
- package/root/root.js +0 -11
- package/row-counts/index.d.ts +0 -1
- package/row-counts/index.js +0 -17
- package/row-counts/row-counts.d.ts +0 -8
- package/row-counts/row-counts.js +0 -23
- package/row-counts/row-counts.stories.d.ts +0 -2
- package/row-counts/row-counts.stories.js +0 -14
- package/rows-per-page-select/index.d.ts +0 -1
- package/rows-per-page-select/index.js +0 -17
- package/rows-per-page-select/rows-per-page-select.d.ts +0 -3
- package/rows-per-page-select/rows-per-page-select.js +0 -19
- package/rows-per-page-select/rows-per-page-select.stories.d.ts +0 -2
- package/rows-per-page-select/rows-per-page-select.stories.js +0 -17
- package/selected-rows-toolbar/index.d.ts +0 -1
- package/selected-rows-toolbar/index.js +0 -17
- package/selected-rows-toolbar/selected-rows-toolbar.d.ts +0 -11
- package/selected-rows-toolbar/selected-rows-toolbar.js +0 -31
- package/selected-rows-toolbar/selected-rows-toolbar.stories.d.ts +0 -2
- package/selected-rows-toolbar/selected-rows-toolbar.stories.js +0 -44
- package/table/components/action-cell-wrapper.d.ts +0 -6
- package/table/components/action-cell-wrapper.js +0 -57
- package/table/components/action-cell.d.ts +0 -7
- package/table/components/action-cell.js +0 -13
- package/table/components/select-row-checkbox.d.ts +0 -3
- package/table/components/select-row-checkbox.js +0 -40
- package/table/hooks/use-rdg-visuals.d.ts +0 -16
- package/table/hooks/use-rdg-visuals.js +0 -46
- package/table/hooks/use-react-data-grid-columns.d.ts +0 -4
- package/table/hooks/use-react-data-grid-columns.js +0 -86
- package/table/index.d.ts +0 -3
- package/table/index.js +0 -19
- package/table/no-rows-fallback.d.ts +0 -7
- package/table/no-rows-fallback.js +0 -14
- package/table/table.d.ts +0 -4
- package/table/table.js +0 -91
- package/table/table.stories.d.ts +0 -2
- package/table/table.stories.js +0 -20
- package/table/types.d.ts +0 -19
- package/table/types.js +0 -2
- package/table-v2/components/action-cell-wrapper.d.ts +0 -6
- package/table-v2/components/action-cell-wrapper.js +0 -10
- package/table-v2/components/action-cell.d.ts +0 -8
- package/table-v2/components/action-cell.js +0 -16
- package/table-v2/components/body.d.ts +0 -6
- package/table-v2/components/body.js +0 -10
- package/table-v2/components/cell.d.ts +0 -8
- package/table-v2/components/cell.js +0 -10
- package/table-v2/components/header-action-cell.d.ts +0 -2
- package/table-v2/components/header-action-cell.js +0 -10
- package/table-v2/components/header-cell.d.ts +0 -10
- package/table-v2/components/header-cell.js +0 -47
- package/table-v2/components/header-select-all-rows-checkbox.d.ts +0 -8
- package/table-v2/components/header-select-all-rows-checkbox.js +0 -22
- package/table-v2/components/header.d.ts +0 -6
- package/table-v2/components/header.js +0 -10
- package/table-v2/components/index.d.ts +0 -21
- package/table-v2/components/index.js +0 -26
- package/table-v2/components/root.d.ts +0 -7
- package/table-v2/components/root.js +0 -31
- package/table-v2/components/row.d.ts +0 -7
- package/table-v2/components/row.js +0 -11
- package/table-v2/components/select-row-checkbox.d.ts +0 -7
- package/table-v2/components/select-row-checkbox.js +0 -12
- package/table-v2/hooks/use-resizable-columns.d.ts +0 -9
- package/table-v2/hooks/use-resizable-columns.js +0 -69
- package/table-v2/index.d.ts +0 -1
- package/table-v2/index.js +0 -17
- package/table-v2/no-rows-fallback.d.ts +0 -7
- package/table-v2/no-rows-fallback.js +0 -14
- package/table-v2/table-v2.d.ts +0 -3
- package/table-v2/table-v2.js +0 -91
- package/table-v2/table-v2.stories.d.ts +0 -2
- package/table-v2/table-v2.stories.js +0 -23
- package/table-v2/types.d.ts +0 -23
- package/table-v2/types.js +0 -2
- package/table-v2/utils/get-grid-template-columns.d.ts +0 -9
- package/table-v2/utils/get-grid-template-columns.js +0 -23
- package/table-v2/utils/get-grid-template-rows.d.ts +0 -2
- package/table-v2/utils/get-grid-template-rows.js +0 -14
- package/toolbar/index.d.ts +0 -1
- package/toolbar/index.js +0 -17
- package/toolbar/toolbar.d.ts +0 -5
- package/toolbar/toolbar.js +0 -10
- package/toolbar-control/index.d.ts +0 -1
- package/toolbar-control/index.js +0 -17
- package/toolbar-control/toolbar-control.d.ts +0 -13
- package/toolbar-control/toolbar-control.js +0 -22
- package/toolbar-control/toolbar-control.stories.d.ts +0 -2
- package/toolbar-control/toolbar-control.stories.js +0 -19
- package/toolbar-customs/index.d.ts +0 -1
- package/toolbar-customs/index.js +0 -17
- package/toolbar-customs/toolbar-customs.d.ts +0 -13
- package/toolbar-customs/toolbar-customs.js +0 -20
- package/toolbar-customs/toolbar-customs.stories.d.ts +0 -2
- package/toolbar-customs/toolbar-customs.stories.js +0 -15
- package/toolbar-tabs/index.d.ts +0 -1
- package/toolbar-tabs/index.js +0 -17
- package/toolbar-tabs/toolbar-tabs.d.ts +0 -11
- package/toolbar-tabs/toolbar-tabs.js +0 -41
- package/toolbar-tabs/toolbar-tabs.stories.d.ts +0 -2
- package/toolbar-tabs/toolbar-tabs.stories.js +0 -17
- package/types/api.d.ts +0 -23
- package/types/api.js +0 -2
- package/types/components.d.ts +0 -32
- package/types/components.js +0 -2
- package/types/core.d.ts +0 -20
- package/types/core.js +0 -2
- package/types/data-grid-props.d.ts +0 -34
- package/types/data-grid-props.js +0 -2
- package/types/index.d.ts +0 -6
- package/types/index.js +0 -2
- package/types/schema.d.ts +0 -56
- package/types/schema.js +0 -2
- package/types/state.d.ts +0 -25
- package/types/state.js +0 -2
- package/types/user-config-storage-adapter.d.ts +0 -8
- package/types/user-config-storage-adapter.js +0 -2
- package/use-data-grid-control/action.d.ts +0 -47
- package/use-data-grid-control/action.js +0 -9
- package/use-data-grid-control/actions-factory.d.ts +0 -21
- package/use-data-grid-control/actions-factory.js +0 -21
- package/use-data-grid-control/index.d.ts +0 -1
- package/use-data-grid-control/index.js +0 -17
- package/use-data-grid-control/use-data-grid-control.d.ts +0 -32
- package/use-data-grid-control/use-data-grid-control.js +0 -12
- package/use-data-grid-control/use-middleware-reducer.d.ts +0 -3
- package/use-data-grid-control/use-middleware-reducer.js +0 -19
- package/use-data-grid-fetching/index.d.ts +0 -1
- package/use-data-grid-fetching/index.js +0 -17
- package/use-data-grid-fetching/loader.d.ts +0 -2
- package/use-data-grid-fetching/loader.js +0 -6
- package/use-data-grid-fetching/use-data-grid-fetching.d.ts +0 -24
- package/use-data-grid-fetching/use-data-grid-fetching.js +0 -40
- package/user-config-storage-adapters/local-storage.d.ts +0 -3
- package/user-config-storage-adapters/local-storage.js +0 -32
- package/utils/create-filter-component-props.d.ts +0 -4
- package/utils/create-filter-component-props.js +0 -15
- package/utils/get-config-key.d.ts +0 -2
- package/utils/get-config-key.js +0 -6
- package/utils/merge-schema-with-config.d.ts +0 -3
- package/utils/merge-schema-with-config.js +0 -30
- package/utils/merge-schema-with-config.test.d.ts +0 -1
- package/utils/merge-schema-with-config.test.js +0 -57
- package/utils.d.ts +0 -6
- package/utils.js +0 -37
package/toolbar-tabs/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./toolbar-tabs"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ChangeTabFilterBehavior } from "../types";
|
|
4
|
-
import { Schema } from "../types/schema";
|
|
5
|
-
import { DataGridControl } from "../use-data-grid-control";
|
|
6
|
-
export interface DataGridToolbarTabsProps extends DataGridControl {
|
|
7
|
-
changeTabFilterBehavior?: ChangeTabFilterBehavior;
|
|
8
|
-
schema: Schema<any>;
|
|
9
|
-
tabCounts?: Record<string, number> | Nullish;
|
|
10
|
-
}
|
|
11
|
-
export declare function DataGridToolbarTabs(props: DataGridToolbarTabsProps): React.JSX.Element;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DataGridToolbarTabs = DataGridToolbarTabs;
|
|
8
|
-
const show_1 = require("@uxf/core-react/components/show");
|
|
9
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
10
|
-
const button_1 = require("@uxf/ui/button");
|
|
11
|
-
const dialog_1 = require("@uxf/ui/dialog");
|
|
12
|
-
const icon_1 = require("@uxf/ui/icon");
|
|
13
|
-
const modal_service_1 = require("@uxf/ui/modal/modal-service");
|
|
14
|
-
const react_1 = __importDefault(require("react"));
|
|
15
|
-
function Tab(props) {
|
|
16
|
-
return (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-data-grid__toolbar-tab", props.isActive && "is-active"), onClick: props.onClick },
|
|
17
|
-
props.title,
|
|
18
|
-
props.tabCount ? " (" + props.tabCount + ")" : ""));
|
|
19
|
-
}
|
|
20
|
-
function DataGridToolbarTabs(props) {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
22
|
-
return (react_1.default.createElement(show_1.Show, { when: Boolean((_a = props.schema.tabs) === null || _a === void 0 ? void 0 : _a.length) },
|
|
23
|
-
react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-tabs" },
|
|
24
|
-
react_1.default.createElement("nav", { "aria-label": "Tabs", className: "uxf-data-grid__toolbar-tabs-nav uxf-data-grid__toolbar-tabs-nav--desktop" }, (_b = props.schema.tabs) === null || _b === void 0 ? void 0 : _b.map((tab) => (react_1.default.createElement(Tab, { isActive: props.state.request.tab === tab.name, key: tab.name, onClick: () => { var _a; return props.actions.changeTab(tab, (_a = props.changeTabFilterBehavior) !== null && _a !== void 0 ? _a : "filtersPerTab"); }, tabCount: props.tabCounts ? props.tabCounts[tab.name] : undefined, title: tab.label })))),
|
|
25
|
-
react_1.default.createElement("nav", { className: "uxf-data-grid__toolbar-tabs-nav uxf-data-grid__toolbar-tabs-nav--mobile" },
|
|
26
|
-
react_1.default.createElement(button_1.Button, { className: "uxf-data-grid__toolbar-tabs-button", onClick: () => {
|
|
27
|
-
var _a;
|
|
28
|
-
return (0, modal_service_1.openModal)({
|
|
29
|
-
children: (react_1.default.createElement(dialog_1.DialogPanel, null,
|
|
30
|
-
react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-tabs-modal-content" }, (_a = props.schema.tabs) === null || _a === void 0 ? void 0 : _a.map((tab) => (react_1.default.createElement(button_1.Button, { className: "uxf-data-grid__toolbar-tabs-modal-button", key: tab.name, onClick: () => {
|
|
31
|
-
var _a;
|
|
32
|
-
props.actions.changeTab(tab, (_a = props.changeTabFilterBehavior) !== null && _a !== void 0 ? _a : "filtersPerTab");
|
|
33
|
-
(0, modal_service_1.closeModal)();
|
|
34
|
-
}, size: "xl", variant: "text" },
|
|
35
|
-
tab.name === props.state.request.tab && (react_1.default.createElement(icon_1.Icon, { className: "uxf-data-grid__toolbar-tabs-modal-active-tab-icon", name: "check", size: 20 })),
|
|
36
|
-
react_1.default.createElement("span", { className: "uxf-data-grid__toolbar-tabs-modal-button-text" }, tab.label))))))),
|
|
37
|
-
});
|
|
38
|
-
}, size: "sm", variant: "text" },
|
|
39
|
-
react_1.default.createElement("span", { className: "uxf-data-grid__toolbar-tabs-nav-text" }, (_d = (_c = props.schema.tabs) === null || _c === void 0 ? void 0 : _c.find((t) => t.name === props.state.request.tab)) === null || _d === void 0 ? void 0 : _d.label),
|
|
40
|
-
react_1.default.createElement(icon_1.Icon, { className: "uxf-data-grid__toolbar-tabs-button-icon", name: "caretDown", size: 16 }))))));
|
|
41
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Default = Default;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const json_renderer_1 = require("../_story-utils/json-renderer");
|
|
9
|
-
const schema_1 = require("../_story-utils/schema");
|
|
10
|
-
const use_data_grid_control_1 = require("../use-data-grid-control");
|
|
11
|
-
const toolbar_tabs_1 = require("./toolbar-tabs");
|
|
12
|
-
function Default() {
|
|
13
|
-
const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({ schema: schema_1.schema });
|
|
14
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
-
react_1.default.createElement(toolbar_tabs_1.DataGridToolbarTabs, { actions: actions, schema: schema_1.schema, state: state }),
|
|
16
|
-
react_1.default.createElement(json_renderer_1.JsonRenderer, { value: state })));
|
|
17
|
-
}
|
package/types/api.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { DataGridSort } from "./schema";
|
|
3
|
-
export type ResultItem = any;
|
|
4
|
-
export interface RequestFilter<T = any> {
|
|
5
|
-
name: string;
|
|
6
|
-
value: T;
|
|
7
|
-
op?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface Request {
|
|
10
|
-
f?: RequestFilter[];
|
|
11
|
-
s?: DataGridSort;
|
|
12
|
-
page?: number;
|
|
13
|
-
perPage?: number;
|
|
14
|
-
search?: string;
|
|
15
|
-
tab?: string | null;
|
|
16
|
-
withTabCounts?: true | null;
|
|
17
|
-
}
|
|
18
|
-
export interface Response {
|
|
19
|
-
totalCount: number;
|
|
20
|
-
count: number;
|
|
21
|
-
tabCounts: Record<string, number> | Nullish;
|
|
22
|
-
result: ResultItem[];
|
|
23
|
-
}
|
package/types/api.js
DELETED
package/types/components.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ComponentType, FunctionComponent } from "react";
|
|
2
|
-
import { Column, Filter } from "./schema";
|
|
3
|
-
export interface ActionCellProps<R> {
|
|
4
|
-
row: R;
|
|
5
|
-
reload: () => Promise<any>;
|
|
6
|
-
}
|
|
7
|
-
export type ActionCellComponent<R> = FunctionComponent<ActionCellProps<R>>;
|
|
8
|
-
export type DataGridActionCell<Row> = {
|
|
9
|
-
width: number;
|
|
10
|
-
Component: ActionCellComponent<Row>;
|
|
11
|
-
};
|
|
12
|
-
export interface BodyCellProps<Value> {
|
|
13
|
-
value: Value;
|
|
14
|
-
column: Column<any, any>;
|
|
15
|
-
/** @deprecated will be removed */
|
|
16
|
-
row: any;
|
|
17
|
-
reload: () => Promise<any>;
|
|
18
|
-
}
|
|
19
|
-
export type BodyCellComponent<Value> = ComponentType<BodyCellProps<Value>>;
|
|
20
|
-
export type BodyCellComponents = {
|
|
21
|
-
[key: string]: BodyCellComponent<any>;
|
|
22
|
-
default: BodyCellComponent<any>;
|
|
23
|
-
};
|
|
24
|
-
export interface FilterProps<StateValue> {
|
|
25
|
-
gridName?: string;
|
|
26
|
-
filter: Filter;
|
|
27
|
-
value: StateValue;
|
|
28
|
-
op?: string;
|
|
29
|
-
onChange: (value: StateValue | undefined, op?: string) => void;
|
|
30
|
-
onClear: () => void;
|
|
31
|
-
}
|
|
32
|
-
export type ChangeTabFilterBehavior = "sharedFiltersAndSearch" | "sharedFiltersAndSearchAndSort" | "filtersPerTab";
|
package/types/components.js
DELETED
package/types/core.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { Request, Response, ResultItem } from "./api";
|
|
3
|
-
import { BaseGridType } from "./schema";
|
|
4
|
-
export type KeyExtractor = (row: ResultItem) => number;
|
|
5
|
-
export type CsvDownloadGetUrl = (request: Request) => string;
|
|
6
|
-
export type Loader = (gridName: string | undefined, request: Request, encodedRequest: string) => Promise<Response>;
|
|
7
|
-
export type CallbackRef = {
|
|
8
|
-
reload: () => Promise<any>;
|
|
9
|
-
};
|
|
10
|
-
export type RowAccent = "success" | "warning" | "error" | "primary" | "secondary" | Nullish;
|
|
11
|
-
export type Config<C extends BaseGridType["columns"]> = {
|
|
12
|
-
columns: Partial<{
|
|
13
|
-
[columnName in keyof C]: {
|
|
14
|
-
hidden?: boolean;
|
|
15
|
-
maxWidth?: number;
|
|
16
|
-
minWidth?: number;
|
|
17
|
-
width?: number;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
};
|
package/types/core.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { FilterHandlers } from "../filter-handler";
|
|
3
|
-
import { SelectedRowsToolbarActionsComponent } from "../selected-rows-toolbar";
|
|
4
|
-
import { NoRowsFallbackComponent } from "../table/no-rows-fallback";
|
|
5
|
-
import { DataGridTableProps } from "../table/types";
|
|
6
|
-
import { DataGridToolbarCustomsProps } from "../toolbar-customs";
|
|
7
|
-
import { DataGridControl } from "../use-data-grid-control";
|
|
8
|
-
import { DataGridFetchingResult } from "../use-data-grid-fetching";
|
|
9
|
-
import { BodyCellComponents, ChangeTabFilterBehavior } from "./components";
|
|
10
|
-
import { CsvDownloadGetUrl, KeyExtractor, RowAccent } from "./core";
|
|
11
|
-
import { BaseGridType, Schema } from "./schema";
|
|
12
|
-
export type DataGridControlProps = DataGridControl;
|
|
13
|
-
export type DataGridDataProps<Row> = DataGridFetchingResult<Row>;
|
|
14
|
-
export type DataGridBaseProps<GridType extends BaseGridType, Row> = {
|
|
15
|
-
schema: Schema<GridType>;
|
|
16
|
-
gridName?: string;
|
|
17
|
-
keyExtractor?: KeyExtractor;
|
|
18
|
-
getCsvDownloadUrl?: CsvDownloadGetUrl;
|
|
19
|
-
rowHeight?: number | ((row: Row) => number) | "auto";
|
|
20
|
-
headerRowHeight?: number;
|
|
21
|
-
rowAccent?: (row: Row) => RowAccent;
|
|
22
|
-
rowClassName?: (row: Row) => string | Nullish;
|
|
23
|
-
className?: string;
|
|
24
|
-
customActions?: DataGridToolbarCustomsProps["buttons"];
|
|
25
|
-
actionCell?: DataGridTableProps<Row>["actionCell"];
|
|
26
|
-
bodyCells?: BodyCellComponents;
|
|
27
|
-
filterHandlers?: FilterHandlers;
|
|
28
|
-
NoRowsFallback?: NoRowsFallbackComponent;
|
|
29
|
-
SelectedRowsToolbarActions?: SelectedRowsToolbarActionsComponent;
|
|
30
|
-
isRowSelectable?: boolean;
|
|
31
|
-
isDebug?: boolean;
|
|
32
|
-
changeTabFilterBehavior?: ChangeTabFilterBehavior;
|
|
33
|
-
};
|
|
34
|
-
export type DataGridProps<GridType extends BaseGridType, Row> = DataGridBaseProps<GridType, Row> & DataGridDataProps<Row> & DataGridControlProps;
|
package/types/data-grid-props.js
DELETED
package/types/index.d.ts
DELETED
package/types/index.js
DELETED
package/types/schema.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
export interface DataGridSort {
|
|
3
|
-
name: string;
|
|
4
|
-
dir: "asc" | "desc";
|
|
5
|
-
}
|
|
6
|
-
export interface Tab {
|
|
7
|
-
name: string;
|
|
8
|
-
label: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
s?: DataGridSort;
|
|
11
|
-
}
|
|
12
|
-
export type BaseGridType = {
|
|
13
|
-
columns: any;
|
|
14
|
-
filters: any;
|
|
15
|
-
};
|
|
16
|
-
export type ColumnWidthUnit = number | `${number}fr`;
|
|
17
|
-
export type ColumnConfig = {
|
|
18
|
-
isHidden?: boolean;
|
|
19
|
-
width?: ColumnWidthUnit;
|
|
20
|
-
minWidth?: number;
|
|
21
|
-
};
|
|
22
|
-
export type Column<Name, Type> = {
|
|
23
|
-
name: Name;
|
|
24
|
-
label: string | ReactElement;
|
|
25
|
-
type: Type;
|
|
26
|
-
sort?: boolean;
|
|
27
|
-
hidden?: boolean;
|
|
28
|
-
config?: ColumnConfig;
|
|
29
|
-
};
|
|
30
|
-
export type Columns<C extends BaseGridType["columns"]> = {
|
|
31
|
-
[K in keyof C]: Column<K, C[K]>;
|
|
32
|
-
}[keyof C];
|
|
33
|
-
export type FilterConfig = {
|
|
34
|
-
placeholder?: string;
|
|
35
|
-
};
|
|
36
|
-
export interface FilterOption {
|
|
37
|
-
id: string | number;
|
|
38
|
-
label: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Filter {
|
|
41
|
-
name: string;
|
|
42
|
-
label: string;
|
|
43
|
-
type: string;
|
|
44
|
-
options?: FilterOption[];
|
|
45
|
-
autocomplete?: string | null;
|
|
46
|
-
config?: FilterConfig;
|
|
47
|
-
}
|
|
48
|
-
export interface Schema<GridType extends BaseGridType> {
|
|
49
|
-
name: string;
|
|
50
|
-
columns: Columns<GridType["columns"]>[];
|
|
51
|
-
filters: Filter[];
|
|
52
|
-
tabs?: Tab[];
|
|
53
|
-
s: DataGridSort;
|
|
54
|
-
perPage: number;
|
|
55
|
-
fullText?: boolean;
|
|
56
|
-
}
|
package/types/schema.js
DELETED
package/types/state.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { RequestFilter } from "./api";
|
|
2
|
-
import { BaseGridType, ColumnConfig, DataGridSort, FilterConfig } from "./schema";
|
|
3
|
-
export type GridRequest = {
|
|
4
|
-
f: RequestFilter[];
|
|
5
|
-
s: DataGridSort | null;
|
|
6
|
-
page: number;
|
|
7
|
-
perPage: number;
|
|
8
|
-
search: string;
|
|
9
|
-
tab: string | null;
|
|
10
|
-
};
|
|
11
|
-
export interface DataGridUserConfig<GridType extends BaseGridType> {
|
|
12
|
-
columns?: Partial<Record<keyof GridType["columns"], ColumnConfig>>;
|
|
13
|
-
perPage?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface DataGridFrontendConfig<GridType extends BaseGridType> extends DataGridUserConfig<GridType> {
|
|
16
|
-
filters?: Partial<Record<keyof GridType["filters"], FilterConfig>>;
|
|
17
|
-
}
|
|
18
|
-
export interface DataGridState<GridType extends BaseGridType> {
|
|
19
|
-
request: GridRequest;
|
|
20
|
-
selectedRows?: any[];
|
|
21
|
-
userConfig: DataGridUserConfig<GridType>;
|
|
22
|
-
tabRequests: {
|
|
23
|
-
[tab: string]: GridRequest;
|
|
24
|
-
};
|
|
25
|
-
}
|
package/types/state.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DataGridControl } from "../use-data-grid-control";
|
|
2
|
-
import { Action } from "../use-data-grid-control/action";
|
|
3
|
-
import { Middleware } from "../use-data-grid-control/use-middleware-reducer";
|
|
4
|
-
import { DataGridState } from "./state";
|
|
5
|
-
export type UserConfigStorageAdapter = {
|
|
6
|
-
middleware: Middleware<DataGridState<any>, Action>;
|
|
7
|
-
useUserConfig: (actions: DataGridControl["actions"]) => void;
|
|
8
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type ChangeTabFilterBehavior, Tab } from "../types";
|
|
2
|
-
export type Action = {
|
|
3
|
-
type: "CHANGE_PAGE";
|
|
4
|
-
page: number;
|
|
5
|
-
} | {
|
|
6
|
-
type: "CHANGE_PER_PAGE";
|
|
7
|
-
perPage: number;
|
|
8
|
-
} | {
|
|
9
|
-
type: "FILTER";
|
|
10
|
-
name: string;
|
|
11
|
-
value: any;
|
|
12
|
-
op: any;
|
|
13
|
-
} | {
|
|
14
|
-
type: "FILTER_CLEAR";
|
|
15
|
-
name: string;
|
|
16
|
-
} | {
|
|
17
|
-
type: "FILTER_CLEAR_ALL";
|
|
18
|
-
} | {
|
|
19
|
-
type: "SORT";
|
|
20
|
-
columnName?: string;
|
|
21
|
-
direction?: string | null;
|
|
22
|
-
} | {
|
|
23
|
-
type: "SORT_CLEAR";
|
|
24
|
-
} | {
|
|
25
|
-
type: "FULLTEXT";
|
|
26
|
-
search: string;
|
|
27
|
-
} | {
|
|
28
|
-
type: "CHANGE_TAB";
|
|
29
|
-
tab: Tab;
|
|
30
|
-
filterBehavior: ChangeTabFilterBehavior;
|
|
31
|
-
} | {
|
|
32
|
-
type: "SET_SELECTED_ROWS";
|
|
33
|
-
rows: any;
|
|
34
|
-
} | {
|
|
35
|
-
type: "HIDE_COLUMN";
|
|
36
|
-
name: string;
|
|
37
|
-
} | {
|
|
38
|
-
type: "SHOW_COLUMN";
|
|
39
|
-
name: string;
|
|
40
|
-
} | {
|
|
41
|
-
type: "UPDATE_USER_CONFIG";
|
|
42
|
-
userConfig: any;
|
|
43
|
-
} | {
|
|
44
|
-
type: "REINITIALIZE_USER_CONFIG";
|
|
45
|
-
userConfig: any;
|
|
46
|
-
};
|
|
47
|
-
export declare const ACTIONS_CHANGING_USER_CONFIG: Array<Action["type"]>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Dispatch } from "react";
|
|
2
|
-
import type { ChangeTabFilterBehavior } from "../types";
|
|
3
|
-
import { Tab } from "../types/schema";
|
|
4
|
-
import { DataGridUserConfig } from "../types/state";
|
|
5
|
-
import { Action } from "./action";
|
|
6
|
-
export declare function createActions(dispatch: Dispatch<Action>): {
|
|
7
|
-
changePage: (page: number) => void;
|
|
8
|
-
changePerPage: (perPage: number) => void;
|
|
9
|
-
filter: (name: string, value: any, op?: string) => void;
|
|
10
|
-
filterClear: (name: string) => void;
|
|
11
|
-
filterClearAll: () => void;
|
|
12
|
-
sort: (columnName: string, direction?: string | null) => void;
|
|
13
|
-
sortClear: () => void;
|
|
14
|
-
search: (search: string) => void;
|
|
15
|
-
changeTab: (tab: Tab, filterBehavior: ChangeTabFilterBehavior) => void;
|
|
16
|
-
setSelectedRows: (rows: any[]) => void;
|
|
17
|
-
hideColumn: (name: string) => void;
|
|
18
|
-
showColumn: (name: string) => void;
|
|
19
|
-
updateUserConfig: (userConfig: DataGridUserConfig<any>) => void;
|
|
20
|
-
reinitializeUserConfig: (userConfig: DataGridUserConfig<any>) => void;
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createActions = createActions;
|
|
4
|
-
function createActions(dispatch) {
|
|
5
|
-
return {
|
|
6
|
-
changePage: (page) => dispatch({ type: "CHANGE_PAGE", page }),
|
|
7
|
-
changePerPage: (perPage) => dispatch({ type: "CHANGE_PER_PAGE", perPage }),
|
|
8
|
-
filter: (name, value, op) => dispatch({ type: "FILTER", name, value, op }),
|
|
9
|
-
filterClear: (name) => dispatch({ type: "FILTER_CLEAR", name }),
|
|
10
|
-
filterClearAll: () => dispatch({ type: "FILTER_CLEAR_ALL" }),
|
|
11
|
-
sort: (columnName, direction = null) => dispatch({ type: "SORT", columnName, direction }),
|
|
12
|
-
sortClear: () => dispatch({ type: "SORT_CLEAR" }),
|
|
13
|
-
search: (search) => dispatch({ type: "FULLTEXT", search }),
|
|
14
|
-
changeTab: (tab, filterBehavior) => dispatch({ type: "CHANGE_TAB", tab, filterBehavior }),
|
|
15
|
-
setSelectedRows: (rows) => dispatch({ type: "SET_SELECTED_ROWS", rows }),
|
|
16
|
-
hideColumn: (name) => dispatch({ type: "HIDE_COLUMN", name }),
|
|
17
|
-
showColumn: (name) => dispatch({ type: "SHOW_COLUMN", name }),
|
|
18
|
-
updateUserConfig: (userConfig) => dispatch({ type: "UPDATE_USER_CONFIG", userConfig }),
|
|
19
|
-
reinitializeUserConfig: (userConfig) => dispatch({ type: "REINITIALIZE_USER_CONFIG", userConfig }),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./use-data-grid-control";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./use-data-grid-control"), exports);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { Request } from "../types/api";
|
|
3
|
-
import { BaseGridType, Schema } from "../types/schema";
|
|
4
|
-
import { DataGridState, DataGridUserConfig } from "../types/state";
|
|
5
|
-
import { Action } from "./action";
|
|
6
|
-
import { Middleware } from "./use-middleware-reducer";
|
|
7
|
-
export interface UseDataGridControlConfig<GridType extends BaseGridType> {
|
|
8
|
-
schema: Schema<GridType>;
|
|
9
|
-
initialState?: Request | string | Nullish;
|
|
10
|
-
initialUserConfig?: DataGridUserConfig<GridType> | Nullish;
|
|
11
|
-
middleware?: Middleware<DataGridState<any>, Action>;
|
|
12
|
-
}
|
|
13
|
-
export declare function useDataGridControl<T extends BaseGridType>(config: UseDataGridControlConfig<T>): {
|
|
14
|
-
state: DataGridState<T>;
|
|
15
|
-
actions: {
|
|
16
|
-
changePage: (page: number) => void;
|
|
17
|
-
changePerPage: (perPage: number) => void;
|
|
18
|
-
filter: (name: string, value: any, op?: string) => void;
|
|
19
|
-
filterClear: (name: string) => void;
|
|
20
|
-
filterClearAll: () => void;
|
|
21
|
-
sort: (columnName: string, direction?: string | null) => void;
|
|
22
|
-
sortClear: () => void;
|
|
23
|
-
search: (search: string) => void;
|
|
24
|
-
changeTab: (tab: import("../types/schema").Tab, filterBehavior: import("..").ChangeTabFilterBehavior) => void;
|
|
25
|
-
setSelectedRows: (rows: any[]) => void;
|
|
26
|
-
hideColumn: (name: string) => void;
|
|
27
|
-
showColumn: (name: string) => void;
|
|
28
|
-
updateUserConfig: (userConfig: DataGridUserConfig<any>) => void;
|
|
29
|
-
reinitializeUserConfig: (userConfig: DataGridUserConfig<any>) => void;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export type DataGridControl = ReturnType<typeof useDataGridControl>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDataGridControl = useDataGridControl;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const reducer_1 = require("../_store/reducer");
|
|
6
|
-
const actions_factory_1 = require("./actions-factory");
|
|
7
|
-
const use_middleware_reducer_1 = require("./use-middleware-reducer");
|
|
8
|
-
function useDataGridControl(config) {
|
|
9
|
-
const [state, dispatch] = (0, use_middleware_reducer_1.useMiddlewareReducer)(reducer_1.reducer, (0, reducer_1.getInitialState)(config.schema, config.initialState, config.initialUserConfig), config.middleware);
|
|
10
|
-
const actions = (0, react_1.useMemo)(() => (0, actions_factory_1.createActions)(dispatch), [dispatch]);
|
|
11
|
-
return { state, actions };
|
|
12
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Dispatch, Reducer } from "react";
|
|
2
|
-
export type Middleware<State, Action> = (newState: State, action: Action) => void;
|
|
3
|
-
export declare function useMiddlewareReducer<S, A>(reducer: Reducer<S, A>, initialState: S, middleware?: (state: NoInfer<S>, action: NoInfer<A>) => void): [S, Dispatch<A>];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMiddlewareReducer = useMiddlewareReducer;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useMiddlewareReducer(reducer, initialState, middleware) {
|
|
6
|
-
const [state, dispatch] = (0, react_1.useReducer)(reducer, initialState);
|
|
7
|
-
const stateRef = (0, react_1.useRef)(state);
|
|
8
|
-
stateRef.current = state;
|
|
9
|
-
const middlewareRef = (0, react_1.useRef)(middleware);
|
|
10
|
-
middlewareRef.current = middleware;
|
|
11
|
-
const enhancedDispatch = (0, react_1.useCallback)((action) => {
|
|
12
|
-
dispatch(action);
|
|
13
|
-
if (middlewareRef.current) {
|
|
14
|
-
const newState = reducer(stateRef.current, action);
|
|
15
|
-
middlewareRef.current(newState, action);
|
|
16
|
-
}
|
|
17
|
-
}, [reducer]);
|
|
18
|
-
return [state, enhancedDispatch];
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./use-data-grid-fetching";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./use-data-grid-fetching"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataGridLoader = void 0;
|
|
4
|
-
const _api_1 = require("../_api");
|
|
5
|
-
const dataGridLoader = (gridName, request) => (0, _api_1.dataGridGetResult)(gridName !== null && gridName !== void 0 ? gridName : "", request);
|
|
6
|
-
exports.dataGridLoader = dataGridLoader;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { Loader } from "../types/core";
|
|
3
|
-
import { Schema } from "../types/schema";
|
|
4
|
-
import { DataGridControl } from "../use-data-grid-control";
|
|
5
|
-
interface Response<Row> {
|
|
6
|
-
result: Row[];
|
|
7
|
-
count: number;
|
|
8
|
-
tabCounts: Record<string, number> | Nullish;
|
|
9
|
-
totalCount: number;
|
|
10
|
-
}
|
|
11
|
-
export interface DataGridFetchingResult<Row> {
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
error?: any;
|
|
14
|
-
data: Response<Row> | null;
|
|
15
|
-
reload: () => Promise<any>;
|
|
16
|
-
}
|
|
17
|
-
export interface UseDataGridFetchingConfig {
|
|
18
|
-
loader?: Loader;
|
|
19
|
-
schema: Schema<any>;
|
|
20
|
-
state: DataGridControl["state"];
|
|
21
|
-
isWithTabCounts?: true;
|
|
22
|
-
}
|
|
23
|
-
export declare function useDataGridFetching(config: UseDataGridFetchingConfig): DataGridFetchingResult<any>;
|
|
24
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDataGridFetching = useDataGridFetching;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const loader_1 = require("./loader");
|
|
7
|
-
function useDataGridFetching(config) {
|
|
8
|
-
const { state, loader = loader_1.dataGridLoader } = config;
|
|
9
|
-
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
10
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
11
|
-
const [data, setData] = (0, react_1.useState)(null);
|
|
12
|
-
const stringStateRequest = JSON.stringify(state.request);
|
|
13
|
-
const reload = (0, react_1.useCallback)(() => {
|
|
14
|
-
const stateRequest = JSON.parse(stringStateRequest);
|
|
15
|
-
const request = (0, utils_1.createRequest)(stateRequest, { isWithTabCounts: config.isWithTabCounts });
|
|
16
|
-
setIsLoading(true);
|
|
17
|
-
return loader(config.schema.name, request, (0, utils_1.encodeFilter)(request))
|
|
18
|
-
.then((response) => {
|
|
19
|
-
setData(response);
|
|
20
|
-
setError(null);
|
|
21
|
-
setIsLoading(false);
|
|
22
|
-
})
|
|
23
|
-
.catch((e) => {
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
|
-
console.error(e);
|
|
26
|
-
setIsLoading(false);
|
|
27
|
-
setError(e);
|
|
28
|
-
});
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
}, [stringStateRequest, config.schema]);
|
|
31
|
-
(0, react_1.useEffect)(() => {
|
|
32
|
-
reload();
|
|
33
|
-
}, [reload]);
|
|
34
|
-
return {
|
|
35
|
-
data,
|
|
36
|
-
isLoading,
|
|
37
|
-
error,
|
|
38
|
-
reload,
|
|
39
|
-
};
|
|
40
|
-
}
|