@uxf/data-grid 11.74.0 → 11.74.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/_api/index.d.ts +8 -0
- package/_api/index.js +11 -0
- package/_components/drawer.d.ts +8 -0
- package/_components/drawer.js +19 -0
- package/_store/reducer.d.ts +8 -0
- package/_store/reducer.js +209 -0
- package/_story-utils/data.d.ts +34 -0
- package/_story-utils/data.js +229 -0
- package/_story-utils/grid-type.d.ts +32 -0
- package/_story-utils/grid-type.js +2 -0
- package/_story-utils/json-renderer.d.ts +7 -0
- package/_story-utils/json-renderer.js +12 -0
- package/_story-utils/loader.d.ts +2 -0
- package/_story-utils/loader.js +33 -0
- package/_story-utils/schema.d.ts +3 -0
- package/_story-utils/schema.js +76 -0
- package/body-cell/body-cell-boolean.d.ts +2 -0
- package/body-cell/body-cell-boolean.js +18 -0
- package/body-cell/body-cell-chip.d.ts +12 -0
- package/body-cell/body-cell-chip.js +21 -0
- package/body-cell/body-cell-date.d.ts +2 -0
- package/body-cell/body-cell-date.js +15 -0
- package/body-cell/body-cell-datetime.d.ts +2 -0
- package/body-cell/body-cell-datetime.js +15 -0
- package/body-cell/body-cell-default.d.ts +2 -0
- package/body-cell/body-cell-default.js +17 -0
- package/body-cell/body-cell-email.d.ts +2 -0
- package/body-cell/body-cell-email.js +16 -0
- package/body-cell/body-cell-money.d.ts +8 -0
- package/body-cell/body-cell-money.js +15 -0
- package/body-cell/body-cell-phone.d.ts +2 -0
- package/body-cell/body-cell-phone.js +16 -0
- package/body-cell/body-cell-to-many.d.ts +2 -0
- package/body-cell/body-cell-to-many.js +17 -0
- package/body-cell/body-cell-to-one.d.ts +2 -0
- package/body-cell/body-cell-to-one.js +14 -0
- package/body-cell/body-cell-url.d.ts +2 -0
- package/body-cell/body-cell-url.js +16 -0
- package/body-cell/index.d.ts +2 -0
- package/body-cell/index.js +33 -0
- package/components.d.ts +97 -0
- package/components.js +124 -0
- package/data-grid-custom-example.stories.d.ts +2 -0
- package/data-grid-custom-example.stories.js +58 -0
- package/data-grid-v2.d.ts +3 -0
- package/data-grid-v2.js +41 -0
- package/data-grid-v2.stories.d.ts +2 -0
- package/data-grid-v2.stories.js +99 -0
- package/data-grid.d.ts +3 -0
- package/data-grid.js +42 -0
- package/data-grid.stories.d.ts +2 -0
- package/data-grid.stories.js +106 -0
- package/export-button/export-button.d.ts +8 -0
- package/export-button/export-button.js +18 -0
- package/export-button/export-button.stories.d.ts +2 -0
- package/export-button/export-button.stories.js +17 -0
- package/export-button/index.d.ts +1 -0
- package/export-button/index.js +17 -0
- package/filter-handler/boolean-select.d.ts +4 -0
- package/filter-handler/boolean-select.js +27 -0
- package/filter-handler/checkbox.d.ts +4 -0
- package/filter-handler/checkbox.js +19 -0
- package/filter-handler/date.d.ts +7 -0
- package/filter-handler/date.js +96 -0
- package/filter-handler/datetime.d.ts +7 -0
- package/filter-handler/datetime.js +34 -0
- package/filter-handler/entity-multi-select.d.ts +5 -0
- package/filter-handler/entity-multi-select.js +27 -0
- package/filter-handler/entity-select.d.ts +5 -0
- package/filter-handler/entity-select.js +23 -0
- package/filter-handler/index.d.ts +4 -0
- package/filter-handler/index.js +41 -0
- package/filter-handler/interval.d.ts +7 -0
- package/filter-handler/interval.js +47 -0
- package/filter-handler/multi-select.d.ts +5 -0
- package/filter-handler/multi-select.js +27 -0
- package/filter-handler/select.d.ts +5 -0
- package/filter-handler/select.js +22 -0
- package/filter-handler/string.d.ts +4 -0
- package/filter-handler/string.js +26 -0
- package/filter-handler/types.d.ts +7 -0
- package/filter-handler/types.js +2 -0
- package/filter-list/filter-list.d.ts +10 -0
- package/filter-list/filter-list.js +31 -0
- package/filter-list/filter-list.stories.d.ts +2 -0
- package/filter-list/filter-list.stories.js +18 -0
- package/filter-list/index.d.ts +1 -0
- package/filter-list/index.js +17 -0
- package/filters/filters.d.ts +9 -0
- package/filters/filters.js +21 -0
- package/filters/filters.stories.d.ts +2 -0
- package/filters/filters.stories.js +18 -0
- package/filters/index.d.ts +1 -0
- package/filters/index.js +17 -0
- package/filters-button/filters-button.d.ts +10 -0
- package/filters-button/filters-button.js +47 -0
- package/filters-button/filters-button.stories.d.ts +2 -0
- package/filters-button/filters-button.stories.js +18 -0
- package/filters-button/index.d.ts +1 -0
- package/filters-button/index.js +17 -0
- package/footer/footer.d.ts +5 -0
- package/footer/footer.js +10 -0
- package/footer/index.d.ts +1 -0
- package/footer/index.js +17 -0
- package/fulltext-input/fulltext-input.d.ts +6 -0
- package/fulltext-input/fulltext-input.js +15 -0
- package/fulltext-input/fulltext-input.stories.d.ts +2 -0
- package/fulltext-input/fulltext-input.stories.js +17 -0
- package/fulltext-input/index.d.ts +1 -0
- package/fulltext-input/index.js +17 -0
- package/hidden-columns/hidden-columns.d.ts +8 -0
- package/hidden-columns/hidden-columns.js +37 -0
- package/hidden-columns/hidden-columns.stories.d.ts +2 -0
- package/hidden-columns/hidden-columns.stories.js +17 -0
- package/hidden-columns/index.d.ts +1 -0
- package/hidden-columns/index.js +17 -0
- package/hidden-columns-button/hidden-columns-button.d.ts +8 -0
- package/hidden-columns-button/hidden-columns-button.js +44 -0
- package/hidden-columns-button/hidden-columns-button.stories.d.ts +2 -0
- package/hidden-columns-button/hidden-columns-button.stories.js +17 -0
- package/hidden-columns-button/index.d.ts +1 -0
- package/hidden-columns-button/index.js +17 -0
- package/hooks/useCallbackRef.d.ts +2 -0
- package/hooks/useCallbackRef.js +6 -0
- package/index.d.ts +5 -0
- package/index.js +25 -0
- package/linear-progress/index.d.ts +1 -0
- package/linear-progress/index.js +17 -0
- package/linear-progress/linear-progress.d.ts +5 -0
- package/linear-progress/linear-progress.js +12 -0
- package/package.json +3 -3
- package/pagination/index.d.ts +1 -0
- package/pagination/index.js +17 -0
- package/pagination/pagination.d.ts +12 -0
- package/pagination/pagination.js +15 -0
- package/pagination/pagination.stories.d.ts +2 -0
- package/pagination/pagination.stories.js +17 -0
- package/root/index.d.ts +1 -0
- package/root/index.js +17 -0
- package/root/root.d.ts +6 -0
- package/root/root.js +11 -0
- package/row-counts/index.d.ts +1 -0
- package/row-counts/index.js +17 -0
- package/row-counts/row-counts.d.ts +8 -0
- package/row-counts/row-counts.js +23 -0
- package/row-counts/row-counts.stories.d.ts +2 -0
- package/row-counts/row-counts.stories.js +14 -0
- package/rows-per-page-select/index.d.ts +1 -0
- package/rows-per-page-select/index.js +17 -0
- package/rows-per-page-select/rows-per-page-select.d.ts +3 -0
- package/rows-per-page-select/rows-per-page-select.js +21 -0
- package/rows-per-page-select/rows-per-page-select.stories.d.ts +2 -0
- package/rows-per-page-select/rows-per-page-select.stories.js +17 -0
- package/selected-rows-toolbar/index.d.ts +1 -0
- package/selected-rows-toolbar/index.js +17 -0
- package/selected-rows-toolbar/selected-rows-toolbar.d.ts +11 -0
- package/selected-rows-toolbar/selected-rows-toolbar.js +33 -0
- package/selected-rows-toolbar/selected-rows-toolbar.stories.d.ts +2 -0
- package/selected-rows-toolbar/selected-rows-toolbar.stories.js +44 -0
- package/table/components/action-cell-wrapper.d.ts +6 -0
- package/table/components/action-cell-wrapper.js +57 -0
- package/table/components/action-cell.d.ts +7 -0
- package/table/components/action-cell.js +13 -0
- package/table/components/select-row-checkbox.d.ts +3 -0
- package/table/components/select-row-checkbox.js +40 -0
- package/table/hooks/use-rdg-visuals.d.ts +16 -0
- package/table/hooks/use-rdg-visuals.js +46 -0
- package/table/hooks/use-react-data-grid-columns.d.ts +4 -0
- package/table/hooks/use-react-data-grid-columns.js +86 -0
- package/table/index.d.ts +3 -0
- package/table/index.js +19 -0
- package/table/no-rows-fallback.d.ts +7 -0
- package/table/no-rows-fallback.js +16 -0
- package/table/table.d.ts +4 -0
- package/table/table.js +91 -0
- package/table/table.stories.d.ts +2 -0
- package/table/table.stories.js +20 -0
- package/table/types.d.ts +19 -0
- package/table/types.js +2 -0
- package/table-v2/components/action-cell-wrapper.d.ts +6 -0
- package/table-v2/components/action-cell-wrapper.js +10 -0
- package/table-v2/components/action-cell.d.ts +8 -0
- package/table-v2/components/action-cell.js +16 -0
- package/table-v2/components/body.d.ts +6 -0
- package/table-v2/components/body.js +10 -0
- package/table-v2/components/cell.d.ts +8 -0
- package/table-v2/components/cell.js +10 -0
- package/table-v2/components/header-action-cell.d.ts +2 -0
- package/table-v2/components/header-action-cell.js +10 -0
- package/table-v2/components/header-cell.d.ts +10 -0
- package/table-v2/components/header-cell.js +47 -0
- package/table-v2/components/header-select-all-rows-checkbox.d.ts +8 -0
- package/table-v2/components/header-select-all-rows-checkbox.js +24 -0
- package/table-v2/components/header.d.ts +6 -0
- package/table-v2/components/header.js +10 -0
- package/table-v2/components/index.d.ts +21 -0
- package/table-v2/components/index.js +26 -0
- package/table-v2/components/root.d.ts +7 -0
- package/table-v2/components/root.js +31 -0
- package/table-v2/components/row.d.ts +7 -0
- package/table-v2/components/row.js +11 -0
- package/table-v2/components/select-row-checkbox.d.ts +7 -0
- package/table-v2/components/select-row-checkbox.js +14 -0
- package/table-v2/hooks/use-resizable-columns.d.ts +9 -0
- package/table-v2/hooks/use-resizable-columns.js +69 -0
- package/table-v2/index.d.ts +1 -0
- package/table-v2/index.js +17 -0
- package/table-v2/no-rows-fallback.d.ts +7 -0
- package/table-v2/no-rows-fallback.js +16 -0
- package/table-v2/table-v2.d.ts +3 -0
- package/table-v2/table-v2.js +91 -0
- package/table-v2/table-v2.stories.d.ts +2 -0
- package/table-v2/table-v2.stories.js +23 -0
- package/table-v2/types.d.ts +23 -0
- package/table-v2/types.js +2 -0
- package/table-v2/utils/get-grid-template-columns.d.ts +9 -0
- package/table-v2/utils/get-grid-template-columns.js +23 -0
- package/table-v2/utils/get-grid-template-rows.d.ts +2 -0
- package/table-v2/utils/get-grid-template-rows.js +14 -0
- package/toolbar/index.d.ts +1 -0
- package/toolbar/index.js +17 -0
- package/toolbar/toolbar.d.ts +5 -0
- package/toolbar/toolbar.js +10 -0
- package/toolbar-control/index.d.ts +1 -0
- package/toolbar-control/index.js +17 -0
- package/toolbar-control/toolbar-control.d.ts +13 -0
- package/toolbar-control/toolbar-control.js +22 -0
- package/toolbar-control/toolbar-control.stories.d.ts +2 -0
- package/toolbar-control/toolbar-control.stories.js +19 -0
- package/toolbar-customs/index.d.ts +1 -0
- package/toolbar-customs/index.js +17 -0
- package/toolbar-customs/toolbar-customs.d.ts +13 -0
- package/toolbar-customs/toolbar-customs.js +20 -0
- package/toolbar-customs/toolbar-customs.stories.d.ts +2 -0
- package/toolbar-customs/toolbar-customs.stories.js +15 -0
- package/toolbar-tabs/index.d.ts +1 -0
- package/toolbar-tabs/index.js +17 -0
- package/toolbar-tabs/toolbar-tabs.d.ts +11 -0
- package/toolbar-tabs/toolbar-tabs.js +41 -0
- package/toolbar-tabs/toolbar-tabs.stories.d.ts +2 -0
- package/toolbar-tabs/toolbar-tabs.stories.js +17 -0
- package/types/api.d.ts +23 -0
- package/types/api.js +2 -0
- package/types/components.d.ts +32 -0
- package/types/components.js +2 -0
- package/types/core.d.ts +20 -0
- package/types/core.js +2 -0
- package/types/data-grid-props.d.ts +34 -0
- package/types/data-grid-props.js +2 -0
- package/types/index.d.ts +6 -0
- package/types/index.js +2 -0
- package/types/schema.d.ts +56 -0
- package/types/schema.js +2 -0
- package/types/state.d.ts +25 -0
- package/types/state.js +2 -0
- package/types/user-config-storage-adapter.d.ts +8 -0
- package/types/user-config-storage-adapter.js +2 -0
- package/use-data-grid-control/action.d.ts +47 -0
- package/use-data-grid-control/action.js +9 -0
- package/use-data-grid-control/actions-factory.d.ts +21 -0
- package/use-data-grid-control/actions-factory.js +21 -0
- package/use-data-grid-control/index.d.ts +1 -0
- package/use-data-grid-control/index.js +17 -0
- package/use-data-grid-control/use-data-grid-control.d.ts +32 -0
- package/use-data-grid-control/use-data-grid-control.js +12 -0
- package/use-data-grid-control/use-middleware-reducer.d.ts +3 -0
- package/use-data-grid-control/use-middleware-reducer.js +19 -0
- package/use-data-grid-fetching/index.d.ts +1 -0
- package/use-data-grid-fetching/index.js +17 -0
- package/use-data-grid-fetching/loader.d.ts +2 -0
- package/use-data-grid-fetching/loader.js +6 -0
- package/use-data-grid-fetching/use-data-grid-fetching.d.ts +24 -0
- package/use-data-grid-fetching/use-data-grid-fetching.js +40 -0
- package/user-config-storage-adapters/local-storage.d.ts +3 -0
- package/user-config-storage-adapters/local-storage.js +32 -0
- package/utils/create-filter-component-props.d.ts +4 -0
- package/utils/create-filter-component-props.js +15 -0
- package/utils/get-config-key.d.ts +2 -0
- package/utils/get-config-key.js +6 -0
- package/utils/merge-schema-with-config.d.ts +3 -0
- package/utils/merge-schema-with-config.js +30 -0
- package/utils/merge-schema-with-config.test.d.ts +1 -0
- package/utils/merge-schema-with-config.test.js +57 -0
- package/utils.d.ts +6 -0
- package/utils.js +37 -0
package/_api/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request, Response } from "../types/api";
|
|
2
|
+
export declare function dataGridGetResult(gridName: string, request: Request): Promise<Response>;
|
|
3
|
+
type Option = {
|
|
4
|
+
id: number | string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function dataGridAutocomplete(name: string, term: string): Promise<Option[]>;
|
|
8
|
+
export {};
|
package/_api/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataGridGetResult = dataGridGetResult;
|
|
4
|
+
exports.dataGridAutocomplete = dataGridAutocomplete;
|
|
5
|
+
const qs_1 = require("qs");
|
|
6
|
+
function dataGridGetResult(gridName, request) {
|
|
7
|
+
return fetch(`/api/cms/datagrid/${gridName}?${(0, qs_1.stringify)(request)}`).then((response) => response.json());
|
|
8
|
+
}
|
|
9
|
+
function dataGridAutocomplete(name, term) {
|
|
10
|
+
return fetch(`/api/cms/autocomplete/${name}?${(0, qs_1.stringify)({ term })}`).then((response) => response.json());
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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.Drawer = Drawer;
|
|
7
|
+
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
8
|
+
const dialog_1 = require("@uxf/ui/dialog");
|
|
9
|
+
const modal_header_1 = require("@uxf/ui/modal-header");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
function Drawer(props) {
|
|
12
|
+
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
13
|
+
if (!isMounted) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (react_1.default.createElement(dialog_1.DialogPanel, { className: "uxf-dg-dialog-panel" },
|
|
17
|
+
react_1.default.createElement(modal_header_1.ModalHeader, { onClose: props.onClose, title: props.title }),
|
|
18
|
+
react_1.default.createElement("div", { className: "uxf-data-grid__drawer-content" }, props.children)));
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Nullish } from "@uxf/core/types";
|
|
2
|
+
import { Reducer } from "react";
|
|
3
|
+
import { Request } from "../types/api";
|
|
4
|
+
import { BaseGridType, Schema } from "../types/schema";
|
|
5
|
+
import { DataGridState, DataGridUserConfig } from "../types/state";
|
|
6
|
+
import { Action } from "../use-data-grid-control/action";
|
|
7
|
+
export declare function getInitialState<GridType extends BaseGridType>(schema: Schema<GridType>, init?: Request | string | Nullish, initialUserConfig?: DataGridUserConfig<GridType> | Nullish): DataGridState<GridType>;
|
|
8
|
+
export declare const reducer: Reducer<DataGridState<any>, Action>;
|
|
@@ -0,0 +1,209 @@
|
|
|
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.reducer = void 0;
|
|
7
|
+
exports.getInitialState = getInitialState;
|
|
8
|
+
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
9
|
+
const empty_object_1 = require("@uxf/core/constants/empty-object");
|
|
10
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
11
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
function getInitialState(schema, init, initialUserConfig) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
15
|
+
const initialState = (0, is_nil_1.isNil)(init) ? {} : typeof init === "string" ? ((_a = (0, utils_1.decodeFilter)(init)) !== null && _a !== void 0 ? _a : {}) : init;
|
|
16
|
+
const initialTabName = (_e = (_b = initialState.tab) !== null && _b !== void 0 ? _b : (_d = (_c = schema.tabs) === null || _c === void 0 ? void 0 : _c.at(0)) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : null;
|
|
17
|
+
const initialTabSort = initialTabName !== null ? (_g = (_f = schema.tabs) === null || _f === void 0 ? void 0 : _f.find((t) => t.name === initialTabName)) === null || _g === void 0 ? void 0 : _g.s : null;
|
|
18
|
+
return {
|
|
19
|
+
request: {
|
|
20
|
+
f: (_h = initialState.f) !== null && _h !== void 0 ? _h : [],
|
|
21
|
+
s: (_k = (_j = initialState.s) !== null && _j !== void 0 ? _j : initialTabSort) !== null && _k !== void 0 ? _k : schema.s,
|
|
22
|
+
page: (_l = initialState.page) !== null && _l !== void 0 ? _l : 0,
|
|
23
|
+
perPage: (_o = (_m = initialState.perPage) !== null && _m !== void 0 ? _m : initialUserConfig === null || initialUserConfig === void 0 ? void 0 : initialUserConfig.perPage) !== null && _o !== void 0 ? _o : schema.perPage,
|
|
24
|
+
tab: initialTabName,
|
|
25
|
+
search: (_p = initialState.search) !== null && _p !== void 0 ? _p : "",
|
|
26
|
+
},
|
|
27
|
+
userConfig: initialUserConfig !== null && initialUserConfig !== void 0 ? initialUserConfig : {},
|
|
28
|
+
tabRequests: {},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line complexity
|
|
32
|
+
const reducer = (state, action) => {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
34
|
+
switch (action.type) {
|
|
35
|
+
case "CHANGE_PAGE":
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
request: {
|
|
39
|
+
...state.request,
|
|
40
|
+
page: action.page,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
case "CHANGE_PER_PAGE":
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
request: {
|
|
47
|
+
...state.request,
|
|
48
|
+
perPage: action.perPage,
|
|
49
|
+
page: 0,
|
|
50
|
+
},
|
|
51
|
+
userConfig: {
|
|
52
|
+
...state.userConfig,
|
|
53
|
+
perPage: action.perPage,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
case "FILTER":
|
|
57
|
+
// eslint-disable-next-line no-case-declarations
|
|
58
|
+
const name = action.name;
|
|
59
|
+
// eslint-disable-next-line no-case-declarations
|
|
60
|
+
const value = action.value;
|
|
61
|
+
// eslint-disable-next-line no-case-declarations
|
|
62
|
+
const op = action.op;
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
request: {
|
|
66
|
+
...state.request,
|
|
67
|
+
page: 0,
|
|
68
|
+
f: state.request.f.find((f) => f.name === name)
|
|
69
|
+
? state.request.f.map((f) => (f.name === name ? { value, name, op } : f))
|
|
70
|
+
: [...state.request.f, { value, name, op }],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
case "FILTER_CLEAR":
|
|
74
|
+
return {
|
|
75
|
+
...state,
|
|
76
|
+
request: {
|
|
77
|
+
...state.request,
|
|
78
|
+
page: 0,
|
|
79
|
+
f: state.request.f.filter((filter) => filter.name !== action.name),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
case "FILTER_CLEAR_ALL":
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
request: {
|
|
86
|
+
...state.request,
|
|
87
|
+
page: 0,
|
|
88
|
+
f: [],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
case "SORT":
|
|
92
|
+
if (((_a = state.request.s) === null || _a === void 0 ? void 0 : _a.name) === action.columnName) {
|
|
93
|
+
return (0, deepmerge_1.default)(state, {
|
|
94
|
+
request: {
|
|
95
|
+
s: {
|
|
96
|
+
dir: ((_b = state.request.s) === null || _b === void 0 ? void 0 : _b.dir) === "asc" ? "desc" : "asc",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return (0, deepmerge_1.default)(state, {
|
|
102
|
+
request: {
|
|
103
|
+
s: { name: action.columnName, dir: (_c = action.direction) !== null && _c !== void 0 ? _c : "asc" },
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
case "SORT_CLEAR":
|
|
107
|
+
return {
|
|
108
|
+
...state,
|
|
109
|
+
request: {
|
|
110
|
+
...state.request,
|
|
111
|
+
s: null,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
case "FULLTEXT":
|
|
115
|
+
return {
|
|
116
|
+
...state,
|
|
117
|
+
request: {
|
|
118
|
+
...state.request,
|
|
119
|
+
search: action.search,
|
|
120
|
+
page: 0,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
case "CHANGE_TAB": {
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
125
|
+
const tabHistory = (_d = state.tabRequests[action.tab.name]) !== null && _d !== void 0 ? _d : empty_object_1.EMPTY_OBJECT;
|
|
126
|
+
return {
|
|
127
|
+
...state,
|
|
128
|
+
request: {
|
|
129
|
+
...state.request,
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
131
|
+
page: (_e = tabHistory.page) !== null && _e !== void 0 ? _e : 0,
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
133
|
+
perPage: (_f = tabHistory.perPage) !== null && _f !== void 0 ? _f : state.request.perPage,
|
|
134
|
+
tab: action.tab.name,
|
|
135
|
+
// when sharedFiltersAndSearchAndSort, f, s and search is in common state.request, i.e. same like
|
|
136
|
+
//...(action.filterBehavior === "sharedFiltersAndSearchAndSort" && {}),
|
|
137
|
+
// sort is handled separately for each tab
|
|
138
|
+
...(action.filterBehavior === "sharedFiltersAndSearch" && {
|
|
139
|
+
s: (_h = (_g = tabHistory.s) !== null && _g !== void 0 ? _g : action.tab.s) !== null && _h !== void 0 ? _h : state.request.s,
|
|
140
|
+
}),
|
|
141
|
+
// filter, search and sort are all handled separately for each tab
|
|
142
|
+
...(action.filterBehavior === "filtersPerTab" && {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
144
|
+
f: (_j = tabHistory.f) !== null && _j !== void 0 ? _j : empty_array_1.EMPTY_ARRAY,
|
|
145
|
+
s: (_l = (_k = tabHistory.s) !== null && _k !== void 0 ? _k : action.tab.s) !== null && _l !== void 0 ? _l : state.request.s,
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
147
|
+
search: (_m = tabHistory.search) !== null && _m !== void 0 ? _m : "",
|
|
148
|
+
}),
|
|
149
|
+
},
|
|
150
|
+
tabRequests: {
|
|
151
|
+
...state.tabRequests,
|
|
152
|
+
[(_o = state.request.tab) !== null && _o !== void 0 ? _o : "__DEFAULT_TAB__"]: state.request,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
case "SET_SELECTED_ROWS":
|
|
157
|
+
return {
|
|
158
|
+
...state,
|
|
159
|
+
selectedRows: action.rows,
|
|
160
|
+
};
|
|
161
|
+
case "HIDE_COLUMN":
|
|
162
|
+
return {
|
|
163
|
+
...state,
|
|
164
|
+
userConfig: {
|
|
165
|
+
...state.userConfig,
|
|
166
|
+
columns: {
|
|
167
|
+
...state.userConfig.columns,
|
|
168
|
+
[action.name]: {
|
|
169
|
+
...(_p = state.userConfig.columns) === null || _p === void 0 ? void 0 : _p[action.name],
|
|
170
|
+
isHidden: true,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
case "SHOW_COLUMN":
|
|
176
|
+
return {
|
|
177
|
+
...state,
|
|
178
|
+
userConfig: {
|
|
179
|
+
...state.userConfig,
|
|
180
|
+
columns: {
|
|
181
|
+
...state.userConfig.columns,
|
|
182
|
+
[action.name]: {
|
|
183
|
+
...(_q = state.userConfig.columns) === null || _q === void 0 ? void 0 : _q[action.name],
|
|
184
|
+
isHidden: false,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
case "UPDATE_USER_CONFIG":
|
|
190
|
+
return {
|
|
191
|
+
...state,
|
|
192
|
+
userConfig: (0, deepmerge_1.default)(state.userConfig, action.userConfig),
|
|
193
|
+
};
|
|
194
|
+
case "REINITIALIZE_USER_CONFIG":
|
|
195
|
+
return {
|
|
196
|
+
...state,
|
|
197
|
+
request: {
|
|
198
|
+
...state.request,
|
|
199
|
+
perPage: (_r = action.userConfig.perPage) !== null && _r !== void 0 ? _r : state.request.perPage,
|
|
200
|
+
},
|
|
201
|
+
userConfig: action.userConfig,
|
|
202
|
+
};
|
|
203
|
+
default:
|
|
204
|
+
// eslint-disable-next-line no-console
|
|
205
|
+
console.warn("Unknown datagrid action.", action);
|
|
206
|
+
return state;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
exports.reducer = reducer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Money } from "@uxf/localize";
|
|
2
|
+
import type { ChipColor } from "@uxf/ui/chip";
|
|
3
|
+
interface Row {
|
|
4
|
+
id: number;
|
|
5
|
+
text: string | null | undefined;
|
|
6
|
+
bool: boolean | null | undefined;
|
|
7
|
+
tel: string | null | undefined;
|
|
8
|
+
mail: string | null | undefined;
|
|
9
|
+
link: string | null | undefined;
|
|
10
|
+
day: string | null | undefined;
|
|
11
|
+
dayAndTime: string | null | undefined;
|
|
12
|
+
uuid: string | null | undefined;
|
|
13
|
+
chip: {
|
|
14
|
+
id: number;
|
|
15
|
+
label: string;
|
|
16
|
+
color?: ChipColor | null;
|
|
17
|
+
} | null | undefined;
|
|
18
|
+
chips: {
|
|
19
|
+
id: number;
|
|
20
|
+
label: string;
|
|
21
|
+
color?: ChipColor | null;
|
|
22
|
+
}[] | null | undefined;
|
|
23
|
+
money: Money | null | undefined;
|
|
24
|
+
toOne: {
|
|
25
|
+
id: number;
|
|
26
|
+
label: string;
|
|
27
|
+
} | null | undefined;
|
|
28
|
+
toMany: {
|
|
29
|
+
id: number;
|
|
30
|
+
label: string;
|
|
31
|
+
}[] | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare const data: Row[];
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.data = void 0;
|
|
4
|
+
exports.data = [
|
|
5
|
+
{
|
|
6
|
+
id: 1,
|
|
7
|
+
text: "Red",
|
|
8
|
+
bool: undefined,
|
|
9
|
+
tel: null,
|
|
10
|
+
mail: "dev@uxf.cz",
|
|
11
|
+
link: null,
|
|
12
|
+
day: "1998-09-15",
|
|
13
|
+
dayAndTime: null,
|
|
14
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
15
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
16
|
+
chips: [
|
|
17
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
18
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
19
|
+
],
|
|
20
|
+
money: { amount: "123456", currency: "CZK" },
|
|
21
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
22
|
+
toMany: [
|
|
23
|
+
{ id: 1, label: "ToMany 1" },
|
|
24
|
+
{ id: 2, label: "ToMany 2" },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 2,
|
|
29
|
+
text: "Blue",
|
|
30
|
+
bool: null,
|
|
31
|
+
tel: undefined,
|
|
32
|
+
mail: "dev@uxf.cz",
|
|
33
|
+
link: undefined,
|
|
34
|
+
day: "2023-01-05",
|
|
35
|
+
dayAndTime: null,
|
|
36
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
37
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
38
|
+
chips: [
|
|
39
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
40
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
41
|
+
],
|
|
42
|
+
money: { amount: "123456", currency: "CZK" },
|
|
43
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
44
|
+
toMany: [
|
|
45
|
+
{ id: 1, label: "ToMany 1" },
|
|
46
|
+
{ id: 2, label: "ToMany 2" },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 3,
|
|
51
|
+
text: "Green",
|
|
52
|
+
bool: true,
|
|
53
|
+
tel: "777888999",
|
|
54
|
+
mail: undefined,
|
|
55
|
+
link: null,
|
|
56
|
+
day: "1998-09-15",
|
|
57
|
+
dayAndTime: undefined,
|
|
58
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
59
|
+
chip: null,
|
|
60
|
+
chips: [{ id: 2, label: "Chip 2", color: "blue" }],
|
|
61
|
+
money: null,
|
|
62
|
+
toOne: null,
|
|
63
|
+
toMany: [{ id: 2, label: "ToMany 2" }],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 4,
|
|
67
|
+
text: "Gray",
|
|
68
|
+
bool: false,
|
|
69
|
+
tel: "555777888",
|
|
70
|
+
mail: "dev@uxf.cz",
|
|
71
|
+
link: "https://www.uxf.cz",
|
|
72
|
+
day: "2023-01-05",
|
|
73
|
+
dayAndTime: undefined,
|
|
74
|
+
uuid: null,
|
|
75
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
76
|
+
chips: null,
|
|
77
|
+
money: { amount: "123456", currency: "CZK" },
|
|
78
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
79
|
+
toMany: null,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 5,
|
|
83
|
+
text: "Pink",
|
|
84
|
+
bool: false,
|
|
85
|
+
tel: "45654412",
|
|
86
|
+
mail: undefined,
|
|
87
|
+
link: undefined,
|
|
88
|
+
day: "2023-01-05",
|
|
89
|
+
dayAndTime: "2000-10-31T01:30:00.000-05:00",
|
|
90
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
91
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
92
|
+
chips: [],
|
|
93
|
+
money: { amount: "123456", currency: "CZK" },
|
|
94
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
95
|
+
toMany: [],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 6,
|
|
99
|
+
text: "Yellow",
|
|
100
|
+
bool: false,
|
|
101
|
+
tel: null,
|
|
102
|
+
mail: "root@uxf.cz",
|
|
103
|
+
link: "https://www.uxf.cz",
|
|
104
|
+
day: undefined,
|
|
105
|
+
dayAndTime: "2000-10-31T01:30:00.000-05:00",
|
|
106
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
107
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
108
|
+
chips: [
|
|
109
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
110
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
111
|
+
],
|
|
112
|
+
money: { amount: "123456", currency: "CZK" },
|
|
113
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
114
|
+
toMany: [
|
|
115
|
+
{ id: 1, label: "ToMany 1" },
|
|
116
|
+
{ id: 2, label: "ToMany 2" },
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 7,
|
|
121
|
+
text: "Black",
|
|
122
|
+
bool: true,
|
|
123
|
+
tel: null,
|
|
124
|
+
mail: "dev@uxf.cz",
|
|
125
|
+
link: null,
|
|
126
|
+
day: "1998-09-15",
|
|
127
|
+
dayAndTime: "2012-08-10T00:00:00.000-13:00",
|
|
128
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
129
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
130
|
+
chips: [
|
|
131
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
132
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
133
|
+
],
|
|
134
|
+
money: { amount: "123456", currency: "CZK" },
|
|
135
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
136
|
+
toMany: [
|
|
137
|
+
{ id: 1, label: "ToMany 1" },
|
|
138
|
+
{ id: 2, label: "ToMany 2" },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: 8,
|
|
143
|
+
text: "White",
|
|
144
|
+
bool: false,
|
|
145
|
+
tel: undefined,
|
|
146
|
+
mail: null,
|
|
147
|
+
link: "https://www.uxf.cz",
|
|
148
|
+
day: undefined,
|
|
149
|
+
dayAndTime: "2000-10-31T01:30:00.000-05:00",
|
|
150
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
151
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
152
|
+
chips: [
|
|
153
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
154
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
155
|
+
],
|
|
156
|
+
money: { amount: "123456", currency: "CZK" },
|
|
157
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
158
|
+
toMany: [
|
|
159
|
+
{ id: 1, label: "ToMany 1" },
|
|
160
|
+
{ id: 2, label: "ToMany 2" },
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 9,
|
|
165
|
+
text: "Liberty",
|
|
166
|
+
bool: false,
|
|
167
|
+
tel: "999888777",
|
|
168
|
+
mail: "dev@uxf.cz",
|
|
169
|
+
link: "https://google.com",
|
|
170
|
+
day: null,
|
|
171
|
+
dayAndTime: "2012-08-10T00:00:00.000-13:00",
|
|
172
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
173
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
174
|
+
chips: [
|
|
175
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
176
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
177
|
+
],
|
|
178
|
+
money: { amount: "123456", currency: "CZK" },
|
|
179
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
180
|
+
toMany: [
|
|
181
|
+
{ id: 1, label: "ToMany 1" },
|
|
182
|
+
{ id: 2, label: "ToMany 2" },
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: 10,
|
|
187
|
+
text: "Blue",
|
|
188
|
+
bool: false,
|
|
189
|
+
tel: "777888999",
|
|
190
|
+
mail: "root@uxf.cz",
|
|
191
|
+
link: "https://google.com",
|
|
192
|
+
day: null,
|
|
193
|
+
dayAndTime: "2012-08-10T00:00:00.000-13:00",
|
|
194
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
195
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
196
|
+
chips: [
|
|
197
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
198
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
199
|
+
],
|
|
200
|
+
money: { amount: "123456", currency: "CZK" },
|
|
201
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
202
|
+
toMany: [
|
|
203
|
+
{ id: 1, label: "ToMany 1" },
|
|
204
|
+
{ id: 2, label: "ToMany 2" },
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 11,
|
|
209
|
+
text: "Purple",
|
|
210
|
+
bool: false,
|
|
211
|
+
tel: "777888999",
|
|
212
|
+
mail: null,
|
|
213
|
+
link: "https://google.com",
|
|
214
|
+
day: null,
|
|
215
|
+
dayAndTime: "2000-12-31T01:00:00.000-07:30",
|
|
216
|
+
uuid: "08ee844c-c27d-4ae3-8f04-9ff449649058",
|
|
217
|
+
chip: { id: 1, label: "Chip 1", color: "red" },
|
|
218
|
+
chips: [
|
|
219
|
+
{ id: 1, label: "Chip 1", color: "red" },
|
|
220
|
+
{ id: 2, label: "Chip 2", color: "blue" },
|
|
221
|
+
],
|
|
222
|
+
money: { amount: "123456", currency: "CZK" },
|
|
223
|
+
toOne: { id: 1, label: "ToOne 1" },
|
|
224
|
+
toMany: [
|
|
225
|
+
{ id: 1, label: "ToMany 1" },
|
|
226
|
+
{ id: 2, label: "ToMany 2" },
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type GridType = {
|
|
2
|
+
columns: {
|
|
3
|
+
id: "id";
|
|
4
|
+
bool: "boolean";
|
|
5
|
+
chip: "chip";
|
|
6
|
+
chips: "chips";
|
|
7
|
+
day: "date";
|
|
8
|
+
dayAndTime: "datetime";
|
|
9
|
+
integer: "integer";
|
|
10
|
+
link: "url";
|
|
11
|
+
mail: "email";
|
|
12
|
+
money: "money";
|
|
13
|
+
tel: "phone";
|
|
14
|
+
text: "string";
|
|
15
|
+
toMany: "toMany";
|
|
16
|
+
toOne: "toOne";
|
|
17
|
+
uuid: "uuid";
|
|
18
|
+
hidden: "hidden";
|
|
19
|
+
};
|
|
20
|
+
filters: {
|
|
21
|
+
text: "text";
|
|
22
|
+
bool: "boolean";
|
|
23
|
+
date: "date";
|
|
24
|
+
ival: "interval";
|
|
25
|
+
tel: "string";
|
|
26
|
+
mail: "string";
|
|
27
|
+
link: "string";
|
|
28
|
+
sele: "select";
|
|
29
|
+
seleBool: "select";
|
|
30
|
+
multiSelect: "multiSelect";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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.JsonRenderer = JsonRenderer;
|
|
7
|
+
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
function JsonRenderer(props) {
|
|
10
|
+
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
11
|
+
return isMounted ? (react_1.default.createElement("pre", { className: "mt-10 bg-slate-100 p-2 text-xs dark:bg-slate-800 dark:text-white" }, JSON.stringify(props.value, null, " "))) : null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loader = void 0;
|
|
4
|
+
const data_1 = require("./data");
|
|
5
|
+
const loader = async (_, request) => {
|
|
6
|
+
const { page = 1, perPage = 10, tab, s, f } = request;
|
|
7
|
+
// eslint-disable-next-line no-console
|
|
8
|
+
console.log("filter", f === null || f === void 0 ? void 0 : f.length);
|
|
9
|
+
const filteredData = data_1.data
|
|
10
|
+
.filter((item) => tab !== "only-odd-ids" || item.id % 2 === 0)
|
|
11
|
+
.filter((item) => { var _a; return (request.search ? (_a = item.text) === null || _a === void 0 ? void 0 : _a.match(new RegExp(request.search, "i")) : true); })
|
|
12
|
+
.sort((a, b) => {
|
|
13
|
+
if (!s) {
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
const first = a[s.name];
|
|
17
|
+
const second = b[s.name];
|
|
18
|
+
if (typeof first === "number") {
|
|
19
|
+
return s.dir === "asc" ? first - second : second - first;
|
|
20
|
+
}
|
|
21
|
+
return s.dir === "asc" ? first.localeCompare(second) : second.localeCompare(first);
|
|
22
|
+
});
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.log("loader", request);
|
|
25
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
26
|
+
return {
|
|
27
|
+
count: filteredData.length,
|
|
28
|
+
totalCount: data_1.data.length,
|
|
29
|
+
tabCounts: { all: 20, "only-odd-ids": 10 },
|
|
30
|
+
result: filteredData.slice(page * perPage, page * perPage + perPage),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.loader = loader;
|