@uxf/data-grid 11.40.0 → 11.41.4
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/_story-utils/data.d.ts +22 -0
- package/_story-utils/data.js +114 -0
- package/_story-utils/grid-type.d.ts +12 -5
- package/_story-utils/schema.js +8 -2
- package/body-cell/body-cell-chip.d.ts +12 -0
- package/body-cell/body-cell-chip.js +21 -0
- package/body-cell/body-cell-money.d.ts +8 -0
- package/body-cell/body-cell-money.js +15 -0
- package/body-cell/index.js +11 -1
- package/data-grid.stories.js +13 -4
- package/filter-handler/index.js +1 -6
- package/filter-handler/interval.d.ts +5 -1
- package/filter-handler/interval.js +29 -9
- package/package.json +1 -1
- package/styles.css +11 -1
package/_story-utils/data.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Money } from "@uxf/localize";
|
|
2
|
+
import type { ChipColor } from "@uxf/ui/chip";
|
|
1
3
|
interface Row {
|
|
2
4
|
id: number;
|
|
3
5
|
text: string | null | undefined;
|
|
@@ -7,6 +9,26 @@ interface Row {
|
|
|
7
9
|
link: string | null | undefined;
|
|
8
10
|
day: string | null | undefined;
|
|
9
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;
|
|
10
32
|
}
|
|
11
33
|
export declare const data: Row[];
|
|
12
34
|
export {};
|
package/_story-utils/data.js
CHANGED
|
@@ -11,6 +11,18 @@ exports.data = [
|
|
|
11
11
|
link: null,
|
|
12
12
|
day: "1998-09-15",
|
|
13
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
|
+
],
|
|
14
26
|
},
|
|
15
27
|
{
|
|
16
28
|
id: 2,
|
|
@@ -21,6 +33,18 @@ exports.data = [
|
|
|
21
33
|
link: undefined,
|
|
22
34
|
day: "2023-01-05",
|
|
23
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
|
+
],
|
|
24
48
|
},
|
|
25
49
|
{
|
|
26
50
|
id: 3,
|
|
@@ -31,6 +55,12 @@ exports.data = [
|
|
|
31
55
|
link: null,
|
|
32
56
|
day: "1998-09-15",
|
|
33
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" }],
|
|
34
64
|
},
|
|
35
65
|
{
|
|
36
66
|
id: 4,
|
|
@@ -41,6 +71,12 @@ exports.data = [
|
|
|
41
71
|
link: "https://www.uxf.cz",
|
|
42
72
|
day: "2023-01-05",
|
|
43
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,
|
|
44
80
|
},
|
|
45
81
|
{
|
|
46
82
|
id: 5,
|
|
@@ -51,6 +87,12 @@ exports.data = [
|
|
|
51
87
|
link: undefined,
|
|
52
88
|
day: "2023-01-05",
|
|
53
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: [],
|
|
54
96
|
},
|
|
55
97
|
{
|
|
56
98
|
id: 6,
|
|
@@ -61,6 +103,18 @@ exports.data = [
|
|
|
61
103
|
link: "https://www.uxf.cz",
|
|
62
104
|
day: undefined,
|
|
63
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
|
+
],
|
|
64
118
|
},
|
|
65
119
|
{
|
|
66
120
|
id: 7,
|
|
@@ -71,6 +125,18 @@ exports.data = [
|
|
|
71
125
|
link: null,
|
|
72
126
|
day: "1998-09-15",
|
|
73
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
|
+
],
|
|
74
140
|
},
|
|
75
141
|
{
|
|
76
142
|
id: 8,
|
|
@@ -81,6 +147,18 @@ exports.data = [
|
|
|
81
147
|
link: "https://www.uxf.cz",
|
|
82
148
|
day: undefined,
|
|
83
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
|
+
],
|
|
84
162
|
},
|
|
85
163
|
{
|
|
86
164
|
id: 9,
|
|
@@ -91,6 +169,18 @@ exports.data = [
|
|
|
91
169
|
link: "https://google.com",
|
|
92
170
|
day: null,
|
|
93
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
|
+
],
|
|
94
184
|
},
|
|
95
185
|
{
|
|
96
186
|
id: 10,
|
|
@@ -101,6 +191,18 @@ exports.data = [
|
|
|
101
191
|
link: "https://google.com",
|
|
102
192
|
day: null,
|
|
103
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
|
+
],
|
|
104
206
|
},
|
|
105
207
|
{
|
|
106
208
|
id: 11,
|
|
@@ -111,5 +213,17 @@ exports.data = [
|
|
|
111
213
|
link: "https://google.com",
|
|
112
214
|
day: null,
|
|
113
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
|
+
],
|
|
114
228
|
},
|
|
115
229
|
];
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
export type GridType = {
|
|
2
2
|
columns: {
|
|
3
|
-
id: "
|
|
4
|
-
text: "string";
|
|
3
|
+
id: "id";
|
|
5
4
|
bool: "boolean";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
link: "url";
|
|
5
|
+
chip: "chip";
|
|
6
|
+
chips: "chips";
|
|
9
7
|
day: "date";
|
|
10
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";
|
|
11
18
|
hidden: "hidden";
|
|
12
19
|
};
|
|
13
20
|
filters: {
|
package/_story-utils/schema.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.schema = void 0;
|
|
4
4
|
exports.schema = {
|
|
5
5
|
columns: [
|
|
6
|
-
{ name: "id", type: "
|
|
6
|
+
{ name: "id", type: "id", label: "Id", sort: true, config: { width: 50, isHidden: true } },
|
|
7
7
|
{ name: "text", type: "string", label: "Text", sort: true },
|
|
8
8
|
{ name: "bool", type: "boolean", label: "Boolean" },
|
|
9
9
|
{ name: "mail", type: "email", label: "E-mail" },
|
|
@@ -11,12 +11,18 @@ exports.schema = {
|
|
|
11
11
|
{ name: "link", type: "url", label: "Link" },
|
|
12
12
|
{ name: "day", type: "date", label: "Date" },
|
|
13
13
|
{ name: "dayAndTime", type: "datetime", label: "Datetime" },
|
|
14
|
+
{ name: "uuid", type: "uuid", label: "UUID" },
|
|
15
|
+
{ name: "chip", type: "chip", label: "Chip" },
|
|
16
|
+
{ name: "chips", type: "chips", label: "Chips" },
|
|
17
|
+
{ name: "money", type: "money", label: "Money" },
|
|
18
|
+
{ name: "toOne", type: "toOne", label: "To one" },
|
|
19
|
+
{ name: "toMany", type: "toMany", label: "To many" },
|
|
14
20
|
{ name: "hidden", type: "hidden", label: "Hidden", hidden: true },
|
|
15
21
|
],
|
|
16
22
|
filters: [
|
|
17
23
|
{ name: "text", type: "text", label: "Text" },
|
|
18
24
|
{ name: "bool", type: "boolean", label: "Boolean" },
|
|
19
|
-
{ name: "interval", type: "interval", label: "
|
|
25
|
+
{ name: "interval", type: "interval", label: "Number interval" },
|
|
20
26
|
{ name: "mail", type: "string", label: "E-mail" },
|
|
21
27
|
{ name: "date", type: "date", label: "Date" },
|
|
22
28
|
{ name: "datetime", type: "datetime", label: "Datetime" },
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChipColors } from "@uxf/ui/chip/theme";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type Item = {
|
|
4
|
+
id: number;
|
|
5
|
+
label: string;
|
|
6
|
+
color?: keyof ChipColors | null;
|
|
7
|
+
};
|
|
8
|
+
interface Props {
|
|
9
|
+
value: Item | Item[] | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function BodyCellChip(props: Props): React.JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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.BodyCellChip = BodyCellChip;
|
|
7
|
+
const chip_1 = require("@uxf/ui/chip");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
function BodyCellChip(props) {
|
|
10
|
+
var _a;
|
|
11
|
+
if (typeof props.value !== "object" || props.value === null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(props.value)) {
|
|
15
|
+
return (react_1.default.createElement("div", { className: "uxf-data-grid__body-cell--chips" }, props.value.map((item) => {
|
|
16
|
+
var _a;
|
|
17
|
+
return (react_1.default.createElement(chip_1.Chip, { color: (_a = item.color) !== null && _a !== void 0 ? _a : "default", key: item.id }, item.label));
|
|
18
|
+
})));
|
|
19
|
+
}
|
|
20
|
+
return (react_1.default.createElement(chip_1.Chip, { color: (_a = props.value.color) !== null && _a !== void 0 ? _a : "default", key: props.value.id }, props.value.label));
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BodyCellProps } from "@uxf/data-grid";
|
|
2
|
+
import type { Money } from "@uxf/localize";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface Props extends BodyCellProps<any, any> {
|
|
5
|
+
value: Money | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function BodyCellMoney(props: Props): React.JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
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.BodyCellMoney = BodyCellMoney;
|
|
7
|
+
const cs_1 = __importDefault(require("@uxf/localize/locale/cs"));
|
|
8
|
+
const format_money_1 = require("@uxf/localize/src/format-money/format-money");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
function BodyCellMoney(props) {
|
|
11
|
+
if (typeof props.value !== "object" || props.value === null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return react_1.default.createElement("span", null, (0, format_money_1.createFormatMoney)({ cs: cs_1.default })("cs", props.value));
|
|
15
|
+
}
|
package/body-cell/index.js
CHANGED
|
@@ -2,22 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BodyCells = void 0;
|
|
4
4
|
const body_cell_boolean_1 = require("./body-cell-boolean");
|
|
5
|
+
const body_cell_chip_1 = require("./body-cell-chip");
|
|
5
6
|
const body_cell_date_1 = require("./body-cell-date");
|
|
6
7
|
const body_cell_datetime_1 = require("./body-cell-datetime");
|
|
7
8
|
const body_cell_default_1 = require("./body-cell-default");
|
|
8
9
|
const body_cell_email_1 = require("./body-cell-email");
|
|
10
|
+
const body_cell_money_1 = require("./body-cell-money");
|
|
9
11
|
const body_cell_phone_1 = require("./body-cell-phone");
|
|
10
12
|
const body_cell_to_many_1 = require("./body-cell-to-many");
|
|
11
13
|
const body_cell_to_one_1 = require("./body-cell-to-one");
|
|
12
14
|
const body_cell_url_1 = require("./body-cell-url");
|
|
13
15
|
exports.BodyCells = {
|
|
14
16
|
boolean: body_cell_boolean_1.BodyCellBoolean,
|
|
17
|
+
chip: body_cell_chip_1.BodyCellChip,
|
|
18
|
+
chips: body_cell_chip_1.BodyCellChip,
|
|
15
19
|
date: body_cell_date_1.BodyCellDate,
|
|
16
20
|
datetime: body_cell_datetime_1.BodyCellDateTime,
|
|
17
21
|
email: body_cell_email_1.BodyCellEmail,
|
|
22
|
+
id: body_cell_default_1.BodyCellDefault,
|
|
23
|
+
integer: body_cell_default_1.BodyCellDefault,
|
|
24
|
+
money: body_cell_money_1.BodyCellMoney,
|
|
18
25
|
phone: body_cell_phone_1.BodyCellPhone,
|
|
19
|
-
|
|
26
|
+
string: body_cell_default_1.BodyCellDefault,
|
|
20
27
|
toMany: body_cell_to_many_1.BodyCellToMany,
|
|
28
|
+
toOne: body_cell_to_one_1.BodyCellToOne,
|
|
21
29
|
url: body_cell_url_1.BodyCellUrl,
|
|
30
|
+
uuid: body_cell_default_1.BodyCellDefault,
|
|
31
|
+
// default
|
|
22
32
|
default: body_cell_default_1.BodyCellDefault,
|
|
23
33
|
};
|
package/data-grid.stories.js
CHANGED
|
@@ -78,10 +78,19 @@ function Default() {
|
|
|
78
78
|
schema: schema_1.schema,
|
|
79
79
|
initialUserConfig: {
|
|
80
80
|
columns: {
|
|
81
|
-
id: { width:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
id: { width: 60 },
|
|
82
|
+
link: { width: 200 },
|
|
83
|
+
day: { width: 150 },
|
|
84
|
+
dayAndTime: { width: 200 },
|
|
85
|
+
text: { minWidth: 150 },
|
|
86
|
+
mail: { minWidth: 150 },
|
|
87
|
+
tel: { minWidth: 150 },
|
|
88
|
+
uuid: { minWidth: 300 },
|
|
89
|
+
chip: { minWidth: 100 },
|
|
90
|
+
chips: { minWidth: 200 },
|
|
91
|
+
money: { minWidth: 100 },
|
|
92
|
+
toOne: { minWidth: 150 },
|
|
93
|
+
toMany: { minWidth: 200 },
|
|
85
94
|
},
|
|
86
95
|
},
|
|
87
96
|
});
|
package/filter-handler/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.defaultFilterHandlers = void 0;
|
|
21
|
-
const boolean_select_1 = __importDefault(require("./boolean-select"));
|
|
22
21
|
const checkbox_1 = __importDefault(require("./checkbox"));
|
|
23
22
|
const date_1 = __importDefault(require("./date"));
|
|
24
23
|
const datetime_1 = __importDefault(require("./datetime"));
|
|
@@ -30,11 +29,7 @@ const select_1 = __importDefault(require("./select"));
|
|
|
30
29
|
const string_1 = __importDefault(require("./string"));
|
|
31
30
|
__exportStar(require("./types"), exports);
|
|
32
31
|
exports.defaultFilterHandlers = {
|
|
33
|
-
|
|
34
|
-
boolean: checkbox_1.default, // TODO smazat
|
|
35
|
-
text: string_1.default, // TODO smazat
|
|
36
|
-
date: // TODO smazat
|
|
37
|
-
date_1.default,
|
|
32
|
+
date: date_1.default,
|
|
38
33
|
datetime: datetime_1.default,
|
|
39
34
|
entityMultiSelect: entity_multi_select_1.default,
|
|
40
35
|
entitySelect: entity_select_1.default,
|
|
@@ -3,23 +3,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const filter_nullish_1 = require("@uxf/core/utils/filter-nullish");
|
|
6
7
|
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
7
8
|
const chip_1 = require("@uxf/ui/chip");
|
|
8
|
-
const
|
|
9
|
+
const text_input_1 = require("@uxf/ui/text-input");
|
|
9
10
|
const react_1 = __importDefault(require("react"));
|
|
10
11
|
const filterHandler = {
|
|
11
12
|
Input(props) {
|
|
12
|
-
var _a;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
+
const onChangeFrom = (value) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return (0, is_nil_1.isNil)(value) && (0, is_nil_1.isNil)((_a = props.value) === null || _a === void 0 ? void 0 : _a.to)
|
|
17
|
+
? props.onChange(undefined)
|
|
18
|
+
: props.onChange({ ...props.value, from: value });
|
|
19
|
+
};
|
|
20
|
+
const onChangeTo = (value) => {
|
|
21
|
+
var _a;
|
|
22
|
+
return (0, is_nil_1.isNil)(value) && (0, is_nil_1.isNil)((_a = props.value) === null || _a === void 0 ? void 0 : _a.from)
|
|
23
|
+
? props.onChange(undefined)
|
|
24
|
+
: props.onChange({ ...props.value, to: value });
|
|
25
|
+
};
|
|
26
|
+
return (react_1.default.createElement("div", { className: "uxf-data-grid__filter uxf-data-grid__filter--interval" },
|
|
27
|
+
react_1.default.createElement(text_input_1.TextInput, { label: `${props.filter.label} (od)`, max: (_a = props.value) === null || _a === void 0 ? void 0 : _a.to, name: `${props.filter.name}.from`, onChange: onChangeFrom, placeholder: (_b = props.filter.config) === null || _b === void 0 ? void 0 : _b.placeholder, type: "number", value: (_d = (_c = props.value) === null || _c === void 0 ? void 0 : _c.from) !== null && _d !== void 0 ? _d : "" }),
|
|
28
|
+
react_1.default.createElement(text_input_1.TextInput, { label: `${props.filter.label} (do)`, min: (_e = props.value) === null || _e === void 0 ? void 0 : _e.from, name: `${props.filter.name}.to`, onChange: onChangeTo, placeholder: (_f = props.filter.config) === null || _f === void 0 ? void 0 : _f.placeholder, type: "number", value: (_h = (_g = props.value) === null || _g === void 0 ? void 0 : _g.to) !== null && _h !== void 0 ? _h : "" })));
|
|
17
29
|
},
|
|
18
|
-
ListItem(props) {
|
|
19
|
-
|
|
30
|
+
ListItem: function (props) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if ((0, is_nil_1.isNil)((_a = props.value) === null || _a === void 0 ? void 0 : _a.from) && (0, is_nil_1.isNil)((_b = props.value) === null || _b === void 0 ? void 0 : _b.to)) {
|
|
20
33
|
return null;
|
|
21
34
|
}
|
|
22
|
-
|
|
35
|
+
const interval = [
|
|
36
|
+
props.value.from ? "od " + props.value.from : null,
|
|
37
|
+
props.value.to ? "do " + props.value.to : null,
|
|
38
|
+
];
|
|
39
|
+
return (react_1.default.createElement(chip_1.Chip, { onClose: props.onClear },
|
|
40
|
+
props.filter.label,
|
|
41
|
+
": ",
|
|
42
|
+
(0, filter_nullish_1.filterNullish)(interval).join(" ")));
|
|
23
43
|
},
|
|
24
44
|
};
|
|
25
45
|
exports.default = filterHandler;
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -67,6 +67,15 @@
|
|
|
67
67
|
height: 100%;
|
|
68
68
|
width: 100%;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
&--chips {
|
|
72
|
+
align-items: center;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-wrap: wrap;
|
|
75
|
+
gap: theme("spacing.1") theme("spacing.2");
|
|
76
|
+
height: 100%;
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
&__drawer {
|
|
@@ -136,7 +145,8 @@
|
|
|
136
145
|
|
|
137
146
|
&__filter {
|
|
138
147
|
&--date,
|
|
139
|
-
&--datetime
|
|
148
|
+
&--datetime,
|
|
149
|
+
&--interval {
|
|
140
150
|
display: grid;
|
|
141
151
|
gap: theme("spacing.4");
|
|
142
152
|
grid-template-columns: repeat(2, 1fr);
|