@uxf/data-grid 11.12.1 → 11.15.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 +12 -0
- package/_api/index.d.ts +8 -0
- package/_api/index.js +12 -0
- package/_generator/cli.js +3 -2
- package/_generator/index.js +38 -10
- package/_store/reducer.js +26 -6
- package/_story-utils/schema.js +13 -11
- package/components.d.ts +5 -0
- package/components.js +5 -0
- package/filter-handler/boolean-select.d.ts +4 -0
- package/filter-handler/boolean-select.js +23 -0
- package/filter-handler/checkbox.d.ts +4 -0
- package/filter-handler/checkbox.js +19 -0
- package/filter-handler/date.d.ts +6 -2
- package/filter-handler/date.js +25 -22
- 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 +22 -0
- package/filter-handler/entity-select.d.ts +5 -0
- package/filter-handler/entity-select.js +22 -0
- package/filter-handler/index.d.ts +1 -1
- package/filter-handler/index.js +20 -13
- package/filter-handler/interval.d.ts +7 -0
- package/filter-handler/interval.js +45 -0
- package/filter-handler/multi-select.d.ts +4 -2
- package/filter-handler/multi-select.js +13 -16
- package/filter-handler/select.d.ts +5 -0
- package/filter-handler/{select-filter.js → select.js} +6 -6
- package/filter-handler/string.d.ts +4 -0
- package/filter-handler/{text-filter.js → string.js} +9 -7
- package/filter-handler/types.d.ts +5 -6
- package/filter-list/filter-list.js +6 -9
- package/filters/filters.js +4 -7
- package/package.json +4 -2
- package/styles.css +3 -1
- package/table-v2/hooks/use-resizable-columns.d.ts +9 -0
- package/table-v2/hooks/use-resizable-columns.js +68 -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 +15 -0
- package/table-v2/styles.css +62 -0
- package/table-v2/table-v2.d.ts +3 -0
- package/table-v2/table-v2.js +46 -0
- package/table-v2/table-v2.stories.d.ts +2 -0
- package/table-v2/table-v2.stories.js +22 -0
- package/table-v2/types.d.ts +24 -0
- package/table-v2/types.js +2 -0
- package/table-v2/utils/get-grid-template-rows.d.ts +2 -0
- package/table-v2/utils/get-grid-template-rows.js +15 -0
- package/types/api.d.ts +0 -1
- package/types/components.d.ts +5 -5
- package/types/schema.d.ts +5 -7
- package/use-data-grid-control/actions-factory.d.ts +4 -2
- package/use-data-grid-control/actions-factory.js +3 -1
- package/use-data-grid-control/use-data-grid-control.d.ts +3 -1
- package/use-data-grid-fetching/loader.js +2 -4
- package/utils/create-filter-component-props.d.ts +4 -0
- package/utils/create-filter-component-props.js +16 -0
- package/_store/actions.d.ts +0 -45
- package/_store/actions.js +0 -47
- package/filter-handler/bool-filter.d.ts +0 -3
- package/filter-handler/bool-filter.js +0 -20
- package/filter-handler/boolean-filter.d.ts +0 -3
- package/filter-handler/boolean-filter.js +0 -16
- package/filter-handler/interval-filter.d.ts +0 -3
- package/filter-handler/interval-filter.js +0 -50
- package/filter-handler/select-filter.d.ts +0 -3
- package/filter-handler/text-filter.d.ts +0 -3
|
@@ -5,7 +5,8 @@ function createActions(dispatch) {
|
|
|
5
5
|
return {
|
|
6
6
|
changePage: (page) => dispatch({ type: "CHANGE_PAGE", page }),
|
|
7
7
|
changePerPage: (perPage) => dispatch({ type: "CHANGE_PER_PAGE", perPage }),
|
|
8
|
-
filter: (
|
|
8
|
+
filter: (name, value, op) => dispatch({ type: "FILTER", name, value, op }),
|
|
9
|
+
filterClear: (name) => dispatch({ type: "FILTER_CLEAR", name }),
|
|
9
10
|
sort: (columnName, direction) => dispatch({ type: "SORT", columnName, direction }),
|
|
10
11
|
sortClear: () => dispatch({ type: "SORT_CLEAR" }),
|
|
11
12
|
search: (search) => dispatch({ type: "FULLTEXT", search }),
|
|
@@ -13,6 +14,7 @@ function createActions(dispatch) {
|
|
|
13
14
|
setSelectedRows: (rows) => dispatch({ type: "SET_SELECTED_ROWS", rows }),
|
|
14
15
|
hideColumn: (name) => dispatch({ type: "HIDE_COLUMN", name }),
|
|
15
16
|
showColumn: (name) => dispatch({ type: "SHOW_COLUMN", name }),
|
|
17
|
+
updateUserConfig: (userConfig) => dispatch({ type: "UPDATE_USER_CONFIG", userConfig }),
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
exports.createActions = createActions;
|
|
@@ -13,7 +13,8 @@ export declare function useDataGridControl<T extends BaseGridType>(config: UseDa
|
|
|
13
13
|
actions: {
|
|
14
14
|
changePage: (page: number) => void;
|
|
15
15
|
changePerPage: (perPage: number) => void;
|
|
16
|
-
filter: (
|
|
16
|
+
filter: (name: string, value: any, op?: string | undefined) => void;
|
|
17
|
+
filterClear: (name: string) => void;
|
|
17
18
|
sort: (columnName: string, direction: string) => void;
|
|
18
19
|
sortClear: () => void;
|
|
19
20
|
search: (search: string) => void;
|
|
@@ -21,6 +22,7 @@ export declare function useDataGridControl<T extends BaseGridType>(config: UseDa
|
|
|
21
22
|
setSelectedRows: (rows: any[]) => void;
|
|
22
23
|
hideColumn: (name: string) => void;
|
|
23
24
|
showColumn: (name: string) => void;
|
|
25
|
+
updateUserConfig: (userConfig: DataGridUserConfig<any>) => void;
|
|
24
26
|
};
|
|
25
27
|
};
|
|
26
28
|
export type DataGridControl = ReturnType<typeof useDataGridControl>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dataGridLoader = void 0;
|
|
4
|
-
const
|
|
5
|
-
const dataGridLoader = (gridName, request) =>
|
|
6
|
-
return fetch(`/api/cms/datagrid/${gridName}?${(0, qs_1.stringify)(request)}`).then((response) => response.json());
|
|
7
|
-
};
|
|
4
|
+
const _api_1 = require("../_api");
|
|
5
|
+
const dataGridLoader = (gridName, request) => (0, _api_1.dataGridGetResult)(gridName !== null && gridName !== void 0 ? gridName : "", request);
|
|
8
6
|
exports.dataGridLoader = dataGridLoader;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FilterProps } from "../types/components";
|
|
2
|
+
import { Filter } from "../types/schema";
|
|
3
|
+
import { DataGridControl } from "../use-data-grid-control";
|
|
4
|
+
export declare function createFilterComponentProps(gridName: string | undefined, filter: Filter, state: DataGridControl["state"], actions: DataGridControl["actions"]): FilterProps<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFilterComponentProps = void 0;
|
|
4
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
5
|
+
function createFilterComponentProps(gridName, filter, state, actions) {
|
|
6
|
+
const requestFilter = state.request.f.find((f) => f.name === filter.name);
|
|
7
|
+
return {
|
|
8
|
+
filter,
|
|
9
|
+
value: requestFilter === null || requestFilter === void 0 ? void 0 : requestFilter.value,
|
|
10
|
+
op: requestFilter === null || requestFilter === void 0 ? void 0 : requestFilter.op,
|
|
11
|
+
gridName,
|
|
12
|
+
onChange: (value, op) => (0, is_nil_1.isNil)(value) ? actions.filterClear(filter.name) : actions.filter(filter.name, value, op),
|
|
13
|
+
onClear: () => actions.filterClear(filter.name),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.createFilterComponentProps = createFilterComponentProps;
|
package/_store/actions.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { DataGridSortDir, RequestFilter, Response, Tab } from "../types";
|
|
2
|
-
export declare const dataGridActions: {
|
|
3
|
-
filter: (filterValue: RequestFilter) => {
|
|
4
|
-
type: string;
|
|
5
|
-
filterValue: RequestFilter<any>;
|
|
6
|
-
};
|
|
7
|
-
filterReset: () => {
|
|
8
|
-
type: string;
|
|
9
|
-
};
|
|
10
|
-
changePage: (page: number) => {
|
|
11
|
-
type: string;
|
|
12
|
-
page: number;
|
|
13
|
-
};
|
|
14
|
-
changePerPage: (perPage: number) => {
|
|
15
|
-
type: string;
|
|
16
|
-
perPage: number;
|
|
17
|
-
};
|
|
18
|
-
changeTab: (tab: Tab) => {
|
|
19
|
-
type: string;
|
|
20
|
-
tab: Tab;
|
|
21
|
-
};
|
|
22
|
-
reload: () => {
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
reloadDone: (response: Response) => {
|
|
26
|
-
type: string;
|
|
27
|
-
response: Response;
|
|
28
|
-
};
|
|
29
|
-
reloadFailed: (error: any) => {
|
|
30
|
-
type: string;
|
|
31
|
-
error: any;
|
|
32
|
-
};
|
|
33
|
-
search: (term: string) => {
|
|
34
|
-
type: string;
|
|
35
|
-
search: string;
|
|
36
|
-
};
|
|
37
|
-
sort: (columnName: string, direction: DataGridSortDir) => {
|
|
38
|
-
type: string;
|
|
39
|
-
columnName: string;
|
|
40
|
-
direction: DataGridSortDir;
|
|
41
|
-
};
|
|
42
|
-
sortClear: () => {
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
package/_store/actions.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataGridActions = void 0;
|
|
4
|
-
exports.dataGridActions = {
|
|
5
|
-
filter: (filterValue) => ({
|
|
6
|
-
type: "FILTER",
|
|
7
|
-
filterValue,
|
|
8
|
-
}),
|
|
9
|
-
filterReset: () => ({
|
|
10
|
-
type: "FILTER_RESET",
|
|
11
|
-
}),
|
|
12
|
-
changePage: (page) => ({
|
|
13
|
-
type: "CHANGE_PAGE",
|
|
14
|
-
page,
|
|
15
|
-
}),
|
|
16
|
-
changePerPage: (perPage) => ({
|
|
17
|
-
type: "CHANGE_PER_PAGE",
|
|
18
|
-
perPage,
|
|
19
|
-
}),
|
|
20
|
-
changeTab: (tab) => ({
|
|
21
|
-
type: "CHANGE_TAB",
|
|
22
|
-
tab,
|
|
23
|
-
}),
|
|
24
|
-
reload: () => ({
|
|
25
|
-
type: "RELOAD",
|
|
26
|
-
}),
|
|
27
|
-
reloadDone: (response) => ({
|
|
28
|
-
type: "RELOAD_DONE",
|
|
29
|
-
response,
|
|
30
|
-
}),
|
|
31
|
-
reloadFailed: (error) => ({
|
|
32
|
-
type: "RELOAD_FAILED",
|
|
33
|
-
error,
|
|
34
|
-
}),
|
|
35
|
-
search: (term) => ({
|
|
36
|
-
type: "FULLTEXT",
|
|
37
|
-
search: term,
|
|
38
|
-
}),
|
|
39
|
-
sort: (columnName, direction) => ({
|
|
40
|
-
type: "SORT",
|
|
41
|
-
columnName,
|
|
42
|
-
direction,
|
|
43
|
-
}),
|
|
44
|
-
sortClear: () => ({
|
|
45
|
-
type: "SORT_CLEAR",
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
@@ -1,20 +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
|
-
const chip_1 = require("@uxf/ui/chip");
|
|
7
|
-
const select_1 = require("@uxf/ui/select");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const BoolFilterHandler = {
|
|
10
|
-
input: (props) => (react_1.default.createElement(select_1.Select, { options: [
|
|
11
|
-
{ id: "", label: "Nerozhoduje" },
|
|
12
|
-
{ id: 1, label: "Ano" },
|
|
13
|
-
{ id: 0, label: "Ne" },
|
|
14
|
-
], label: props.filter.label, value: props.value.value, onChange: (value) => props.onFilter({ ...props.value, value }), isClearable: true, name: props.filter.name })),
|
|
15
|
-
listItem: (props) => (react_1.default.createElement(chip_1.Chip, { onClose: props.onClear },
|
|
16
|
-
props.filter.label,
|
|
17
|
-
":\u00A0",
|
|
18
|
-
props.value.value ? "Ano" : "Ne")),
|
|
19
|
-
};
|
|
20
|
-
exports.default = BoolFilterHandler;
|
|
@@ -1,16 +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
|
-
const checkbox_input_1 = require("@uxf/ui/checkbox-input");
|
|
7
|
-
const chip_1 = require("@uxf/ui/chip");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const BooleanFilterHandler = {
|
|
10
|
-
input: (props) => (react_1.default.createElement(checkbox_input_1.CheckboxInput, { label: props.filter.label, value: props.value.value, onChange: (value) => props.onFilter({ ...props.value, value: value === true ? value : undefined }), name: props.filter.name })),
|
|
11
|
-
listItem: (props) => (react_1.default.createElement(chip_1.Chip, { onClose: props.onClear },
|
|
12
|
-
props.filter.label,
|
|
13
|
-
":\u00A0",
|
|
14
|
-
props.value.value ? "Ano" : "Ne")),
|
|
15
|
-
};
|
|
16
|
-
exports.default = BooleanFilterHandler;
|
|
@@ -1,50 +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
|
-
const chip_1 = require("@uxf/ui/chip");
|
|
7
|
-
const text_input_1 = require("@uxf/ui/text-input");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const IntervalFilterHandler = {
|
|
10
|
-
input: (props) => {
|
|
11
|
-
const initializedValue = props.value.value &&
|
|
12
|
-
typeof props.value.value.from !== "undefined" &&
|
|
13
|
-
typeof props.value.value.to !== "undefined"
|
|
14
|
-
? props.value
|
|
15
|
-
: { name: props.filter.name, value: { from: null, to: null } };
|
|
16
|
-
return (react_1.default.createElement("div", { key: props.filter.name },
|
|
17
|
-
react_1.default.createElement("div", { className: "uxf-data-grid__filter uxf-data-grid__filter--interval" },
|
|
18
|
-
react_1.default.createElement(text_input_1.TextInput, { label: `${props.filter.label} od:`, value: props.value.value ? props.value.value.from : "", onChange: (val) => {
|
|
19
|
-
return props.onFilter({
|
|
20
|
-
...initializedValue,
|
|
21
|
-
value: {
|
|
22
|
-
...initializedValue.value,
|
|
23
|
-
from: val ? parseInt(val, 10) : null,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}, name: props.filter.name }),
|
|
27
|
-
react_1.default.createElement("div", { className: "uxf-data-grid__filter-gap" }, "\u2013"),
|
|
28
|
-
react_1.default.createElement(text_input_1.TextInput, { label: `${props.filter.label} do:`, value: props.value.value ? props.value.value.to : "", onChange: (val) => {
|
|
29
|
-
return props.onFilter({
|
|
30
|
-
...initializedValue,
|
|
31
|
-
value: {
|
|
32
|
-
...initializedValue.value,
|
|
33
|
-
to: val ? parseInt(val, 10) : null,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}, name: props.filter.name }))));
|
|
37
|
-
},
|
|
38
|
-
listItem: (props) => {
|
|
39
|
-
if (!props.value.value) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const { from, to } = props.value.value;
|
|
43
|
-
const formatInterval = [from ? "od " + from : "", to ? "do " + to : ""];
|
|
44
|
-
return from || to ? (react_1.default.createElement(chip_1.Chip, { onClose: () => props.onFilter({ ...props.value, value: undefined }) },
|
|
45
|
-
props.filter.label,
|
|
46
|
-
" ",
|
|
47
|
-
formatInterval.filter((i) => !!i).join(" "))) : null;
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
exports.default = IntervalFilterHandler;
|