@ssplib/react-components 0.0.123 → 0.0.125
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.
|
@@ -63,7 +63,7 @@ function DatePicker(_a) {
|
|
|
63
63
|
}, [value]);
|
|
64
64
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
65
65
|
react_1.default.createElement(material_1.Grid, Object.assign({ item: true }, { xs, sm, md }),
|
|
66
|
-
title && react_1.default.createElement(material_1.InputLabel,
|
|
66
|
+
title && react_1.default.createElement(material_1.InputLabel, { required: required }, title),
|
|
67
67
|
react_1.default.createElement(x_date_pickers_1.LocalizationProvider, { adapterLocale: pt_br_1.default, dateAdapter: AdapterDayjs_1.AdapterDayjs },
|
|
68
68
|
react_1.default.createElement(x_date_pickers_2.DatePicker, { minDate: (0, dayjs_1.default)(minDt, 'DD/MM/YYYY'), maxDate: (0, dayjs_1.default)(maxDt, 'DD/MM/YYYY'), format: 'DD/MM/YYYY', value: value, onChange: handleChange, disableHighlightToday: true, sx: {
|
|
69
69
|
outline: (0, lodash_get_1.default)(context.errors, name) ? '1px solid #a51c30' : '',
|
|
@@ -4,7 +4,8 @@ interface ColumnData {
|
|
|
4
4
|
keyName: string;
|
|
5
5
|
size?: number;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type FilterTypes = 'a-z' | 'z-a' | 'items' | 'date-interval' | 'data-a-z' | 'data-z-a';
|
|
8
|
+
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, isPublic, statusKeyName, csvExcludeKeys, csvCustomKeyNames, csvExcludeValidate, csvButtonTitle, csvAllButtonTitle, csvShowAllButton, itemCount, filters, filterSeparator, }: {
|
|
8
9
|
columns: ColumnData[];
|
|
9
10
|
tableName: string;
|
|
10
11
|
csvShowAllButton?: boolean;
|
|
@@ -30,9 +31,19 @@ export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableNam
|
|
|
30
31
|
dataPath?: string;
|
|
31
32
|
isPublic?: boolean;
|
|
32
33
|
filters?: {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
[key: string]: {
|
|
35
|
+
type: FilterTypes;
|
|
36
|
+
keyName: string;
|
|
37
|
+
name: string;
|
|
38
|
+
referenceKey?: string;
|
|
39
|
+
options?: {
|
|
40
|
+
name: string;
|
|
41
|
+
color: string;
|
|
42
|
+
key: string;
|
|
43
|
+
}[];
|
|
44
|
+
}[];
|
|
35
45
|
};
|
|
46
|
+
filterSeparator?: string;
|
|
36
47
|
}): JSX.Element;
|
|
37
48
|
declare const _default: React.MemoExoticComponent<typeof Table>;
|
|
38
49
|
export default _default;
|
|
@@ -37,10 +37,15 @@ const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
|
37
37
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const auth_1 = require("../../../context/auth");
|
|
40
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
41
|
+
const FormProvider_1 = __importDefault(require("../../providers/FormProvider"));
|
|
42
|
+
const DatePicker_1 = __importDefault(require("../date/DatePicker"));
|
|
43
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
44
|
+
let startData = [];
|
|
40
45
|
function Table({ columns, fetchFunc, emptyMsg = {
|
|
41
46
|
user: 'Nenhum dado encontrado',
|
|
42
47
|
public: 'Nenhum dado encontrado',
|
|
43
|
-
}, dataPath = '', tableName = 'Dados', csv, columnSize, action, isPublic = false, statusKeyName = '', csvExcludeKeys = [], csvCustomKeyNames = {}, csvExcludeValidate = (key, value) => false, csvButtonTitle = 'Salvar .CSV', csvAllButtonTitle = 'Salvar todos em CSV', csvShowAllButton = false, itemCount = 10, }) {
|
|
48
|
+
}, dataPath = '', tableName = 'Dados', csv, columnSize, action, isPublic = false, statusKeyName = '', csvExcludeKeys = [], csvCustomKeyNames = {}, csvExcludeValidate = (key, value) => false, csvButtonTitle = 'Salvar .CSV', csvAllButtonTitle = 'Salvar todos em CSV', csvShowAllButton = false, itemCount = 10, filters = {}, filterSeparator = '|', }) {
|
|
44
49
|
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
45
50
|
const [error, setError] = (0, react_1.useState)(null);
|
|
46
51
|
const [data, setData] = (0, react_1.useState)(null);
|
|
@@ -51,7 +56,9 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
51
56
|
const [currentPage, setCurrentPage] = (0, react_1.useState)(0);
|
|
52
57
|
const [paginationCount, setPagCount] = (0, react_1.useState)(1);
|
|
53
58
|
const [listPage, setListPage] = (0, react_1.useState)(1);
|
|
54
|
-
|
|
59
|
+
// filters states
|
|
60
|
+
const [filterCollapse, setFilterCollapse] = (0, react_1.useState)(Array(Object.keys(filters).length).fill(false));
|
|
61
|
+
const [filterOpen, setFilterOpen] = (0, react_1.useState)(false);
|
|
55
62
|
const theme = (0, material_1.useTheme)();
|
|
56
63
|
const isSmall = (0, material_1.useMediaQuery)(theme.breakpoints.only('xs'));
|
|
57
64
|
(0, react_1.useEffect)(() => {
|
|
@@ -63,14 +70,18 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
63
70
|
status: 500,
|
|
64
71
|
});
|
|
65
72
|
return res.json().then((j) => {
|
|
66
|
-
if (j.statusCode === 204)
|
|
73
|
+
if (j.statusCode === 204) {
|
|
67
74
|
setData({ body: { data: [] } });
|
|
75
|
+
startData = [];
|
|
76
|
+
}
|
|
68
77
|
else if (j.statusCode === 403)
|
|
69
78
|
setError({
|
|
70
79
|
status: j.statusCode,
|
|
71
80
|
});
|
|
72
|
-
else
|
|
81
|
+
else {
|
|
73
82
|
setData(j);
|
|
83
|
+
startData = JSON.parse(JSON.stringify(j));
|
|
84
|
+
}
|
|
74
85
|
console.log(j.statusCode);
|
|
75
86
|
setIsLoading(false);
|
|
76
87
|
});
|
|
@@ -81,9 +92,6 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
81
92
|
});
|
|
82
93
|
});
|
|
83
94
|
}, [userLoaded]);
|
|
84
|
-
(0, react_1.useEffect)(() => {
|
|
85
|
-
setGridSize(12 / (columns.length + (user ? 1 : 0)));
|
|
86
|
-
}, [user, columns]);
|
|
87
95
|
const getCount = (0, react_1.useCallback)((countData) => {
|
|
88
96
|
if (countData.length <= 0)
|
|
89
97
|
return 1;
|
|
@@ -270,21 +278,193 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
270
278
|
return (react_1.default.createElement(Typography_1.default, { color: '#6366F1', fontWeight: 600, fontFamily: 'Inter' }, "PR\u00C9 APROVADO"));
|
|
271
279
|
}
|
|
272
280
|
}, []);
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
setList(getData(data));
|
|
276
|
-
setPagCount(getCount(getData(data)));
|
|
281
|
+
const toggleDrawer = (open) => (event) => {
|
|
282
|
+
if (event && event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) {
|
|
277
283
|
return;
|
|
278
284
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
285
|
+
};
|
|
286
|
+
const handleFilterOption = (type, keyName, customValue, referencekey) => {
|
|
287
|
+
let filtered = JSON.parse(JSON.stringify(list));
|
|
288
|
+
if (type === 'a-z') {
|
|
289
|
+
filtered.sort((a, b) => {
|
|
290
|
+
const aValue = a[keyName];
|
|
291
|
+
const bValue = b[keyName];
|
|
292
|
+
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
293
|
+
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
294
|
+
if (valueA < valueB) {
|
|
295
|
+
return -1;
|
|
296
|
+
}
|
|
297
|
+
if (valueA > valueB) {
|
|
298
|
+
return 1;
|
|
299
|
+
}
|
|
300
|
+
return 0;
|
|
301
|
+
});
|
|
302
|
+
} //
|
|
303
|
+
else if (type === 'z-a') {
|
|
304
|
+
filtered.sort((a, b) => {
|
|
305
|
+
const aValue = a[keyName];
|
|
306
|
+
const bValue = b[keyName];
|
|
307
|
+
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
308
|
+
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
309
|
+
if (valueA < valueB) {
|
|
310
|
+
return 1;
|
|
311
|
+
}
|
|
312
|
+
if (valueA > valueB) {
|
|
313
|
+
return -1;
|
|
314
|
+
}
|
|
315
|
+
return 0;
|
|
316
|
+
});
|
|
317
|
+
} //
|
|
318
|
+
else if (type === 'items') {
|
|
319
|
+
filtered.sort((a, b) => {
|
|
320
|
+
const aValue = a[keyName];
|
|
321
|
+
const bValue = b[keyName];
|
|
322
|
+
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
323
|
+
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
324
|
+
// const aRKey = a[referencekey ?? '']
|
|
325
|
+
// const bRKey = b[referencekey ?? '']
|
|
326
|
+
// if (valueA === customValue) console.log(valueA, valueB, aRKey, bRKey)
|
|
327
|
+
if (valueA === customValue)
|
|
328
|
+
return -1;
|
|
329
|
+
if (valueB === customValue)
|
|
330
|
+
return 1;
|
|
331
|
+
if (valueA < valueB) {
|
|
332
|
+
return -1;
|
|
333
|
+
}
|
|
334
|
+
if (valueA > valueB) {
|
|
335
|
+
return 1;
|
|
336
|
+
}
|
|
337
|
+
return 0;
|
|
338
|
+
});
|
|
339
|
+
if (referencekey) {
|
|
340
|
+
const data = [];
|
|
341
|
+
let newFiltered = filtered.filter((x) => {
|
|
342
|
+
const item = x[keyName];
|
|
343
|
+
const value = typeof item === 'number' ? item : item.toLowerCase();
|
|
344
|
+
if (value === customValue) {
|
|
345
|
+
data.push(x);
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
});
|
|
350
|
+
data.sort((a, b) => {
|
|
351
|
+
const aValue = a[referencekey];
|
|
352
|
+
const bValue = b[referencekey];
|
|
353
|
+
const valueA = typeof aValue === 'number' ? aValue : aValue.toLowerCase();
|
|
354
|
+
const valueB = typeof bValue === 'number' ? bValue : bValue.toLowerCase();
|
|
355
|
+
if (valueA < valueB) {
|
|
356
|
+
return 1;
|
|
357
|
+
}
|
|
358
|
+
if (valueA > valueB) {
|
|
359
|
+
return -1;
|
|
360
|
+
}
|
|
361
|
+
return 0;
|
|
362
|
+
});
|
|
363
|
+
data.forEach((x) => {
|
|
364
|
+
newFiltered.unshift(x);
|
|
365
|
+
});
|
|
366
|
+
console.log(newFiltered);
|
|
367
|
+
filtered = newFiltered;
|
|
368
|
+
}
|
|
369
|
+
} //
|
|
370
|
+
else if (type === 'data-a-z') {
|
|
371
|
+
filtered.sort((a, b) => {
|
|
372
|
+
const aValue = a[keyName];
|
|
373
|
+
const bValue = b[keyName];
|
|
374
|
+
const separator = filterSeparator;
|
|
375
|
+
const aDt = aValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
376
|
+
const bDt = bValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
377
|
+
if (!aDt && !bDt)
|
|
378
|
+
return 0;
|
|
379
|
+
const valueA = (0, dayjs_1.default)(aDt, 'D/M/YYYY');
|
|
380
|
+
const valueB = (0, dayjs_1.default)(bDt, 'D/M/YYYY');
|
|
381
|
+
if (valueA.isBefore(valueB)) {
|
|
382
|
+
return -1;
|
|
383
|
+
}
|
|
384
|
+
if (valueA.isAfter(valueB)) {
|
|
385
|
+
return 1;
|
|
386
|
+
}
|
|
387
|
+
return 0;
|
|
388
|
+
});
|
|
389
|
+
} //
|
|
390
|
+
else if (type === 'data-z-a') {
|
|
391
|
+
filtered.sort((a, b) => {
|
|
392
|
+
const aValue = a[keyName];
|
|
393
|
+
const bValue = b[keyName];
|
|
394
|
+
const separator = filterSeparator;
|
|
395
|
+
const aDt = aValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
396
|
+
const bDt = bValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
397
|
+
if (!aDt && !bDt)
|
|
398
|
+
return 0;
|
|
399
|
+
const valueA = (0, dayjs_1.default)(aDt, 'D/M/YYYY');
|
|
400
|
+
const valueB = (0, dayjs_1.default)(bDt, 'D/M/YYYY');
|
|
401
|
+
if (valueA.isBefore(valueB)) {
|
|
402
|
+
return 1;
|
|
403
|
+
}
|
|
404
|
+
if (valueA.isAfter(valueB)) {
|
|
405
|
+
return -1;
|
|
406
|
+
}
|
|
407
|
+
return 0;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
setList(filtered);
|
|
411
|
+
setFilterOpen(false);
|
|
412
|
+
};
|
|
413
|
+
const handleFilterReset = () => {
|
|
414
|
+
const value = Array.isArray(startData) ? startData : (0, lodash_get_1.default)(startData, dataPath);
|
|
415
|
+
console.log(value);
|
|
416
|
+
setList(value);
|
|
417
|
+
setFilterOpen(false);
|
|
418
|
+
};
|
|
419
|
+
const handleDateFilter = (from, to, keyName) => {
|
|
420
|
+
const separator = filterSeparator;
|
|
421
|
+
let filtered = JSON.parse(JSON.stringify(list));
|
|
422
|
+
filtered = filtered.filter((x) => {
|
|
423
|
+
const dts = x[keyName].split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; });
|
|
424
|
+
let inside = false;
|
|
425
|
+
dts.forEach((k) => {
|
|
426
|
+
if (inside)
|
|
427
|
+
return;
|
|
428
|
+
const dt = (0, dayjs_1.default)(k, 'D/M/YYYY');
|
|
429
|
+
const dtFrom = (0, dayjs_1.default)(from, 'D/M/YYYY');
|
|
430
|
+
if (to) {
|
|
431
|
+
const dtTo = (0, dayjs_1.default)(to, 'D/M/YYYY');
|
|
432
|
+
if ((dtFrom.isBefore(dt) || dtFrom.isSame(dt)) && (dtTo.isAfter(dt) || dtTo.isSame(dt))) {
|
|
433
|
+
inside = true;
|
|
434
|
+
}
|
|
435
|
+
} //
|
|
436
|
+
else {
|
|
437
|
+
if (dtFrom.isBefore(dt) || dtFrom.isSame(dt)) {
|
|
438
|
+
inside = true;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
return inside;
|
|
284
443
|
});
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
444
|
+
filtered.sort((a, b) => {
|
|
445
|
+
const aValue = a[keyName];
|
|
446
|
+
const bValue = b[keyName];
|
|
447
|
+
const separator = filterSeparator;
|
|
448
|
+
const aDt = aValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
449
|
+
const bDt = bValue.split(separator).map((k) => { var _a; return ((_a = k.match(/[0-9]+\/[0-9]+\/[0-9]+/)) !== null && _a !== void 0 ? _a : [])[0]; })[0];
|
|
450
|
+
if (!aDt && !bDt)
|
|
451
|
+
return 0;
|
|
452
|
+
const valueA = (0, dayjs_1.default)(aDt, 'D/M/YYYY');
|
|
453
|
+
const valueB = (0, dayjs_1.default)(bDt, 'D/M/YYYY');
|
|
454
|
+
if (valueA.isBefore(valueB)) {
|
|
455
|
+
return -1;
|
|
456
|
+
}
|
|
457
|
+
if (valueA.isAfter(valueB)) {
|
|
458
|
+
return 1;
|
|
459
|
+
}
|
|
460
|
+
return 0;
|
|
461
|
+
});
|
|
462
|
+
setList(filtered);
|
|
463
|
+
setPagCount(getCount(filtered));
|
|
464
|
+
setCurrentPage(0);
|
|
465
|
+
setListPage(1);
|
|
466
|
+
setFilterOpen(false);
|
|
467
|
+
};
|
|
288
468
|
if (error)
|
|
289
469
|
return (react_1.default.createElement(material_1.Box, { bgcolor: '#E2E8F0', padding: 2, marginX: 2 },
|
|
290
470
|
react_1.default.createElement(Typography_1.default, { fontSize: 24, textAlign: 'center', fontFamily: 'Inter' },
|
|
@@ -300,10 +480,11 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
300
480
|
return react_1.default.createElement(material_1.LinearProgress, null);
|
|
301
481
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
302
482
|
react_1.default.createElement(material_1.Box, { marginX: isSmall ? 0 : 4 },
|
|
303
|
-
react_1.default.createElement(material_1.Stack, { spacing:
|
|
483
|
+
react_1.default.createElement(material_1.Stack, { spacing: 1, direction: { xs: 'column', md: 'row' }, marginBottom: 2 },
|
|
304
484
|
react_1.default.createElement(TextField_1.default, { InputProps: {
|
|
305
485
|
startAdornment: react_1.default.createElement(Search_1.default, { sx: { marginRight: 1, fill: '#c0c0c0' } }),
|
|
306
|
-
}, size: 'small', onChange: onInputChange, fullWidth: true, placeholder: `Pesquisar ${tableName}` })
|
|
486
|
+
}, size: 'small', onChange: onInputChange, fullWidth: true, placeholder: `Pesquisar ${tableName}` }),
|
|
487
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(icons_material_1.FilterAlt, null), variant: 'contained', onClick: (e) => setFilterOpen(true) }, "Filtrar")),
|
|
307
488
|
react_1.default.createElement(material_1.Stack, { spacing: 0.2 },
|
|
308
489
|
getMaxItems().length <= 0 ? (react_1.default.createElement(material_1.Stack, { sx: { backgroundColor: '#E2E8F0', padding: 2, marginX: { xs: 2, md: 0 } }, justifyContent: 'center', alignItems: 'center' },
|
|
309
490
|
react_1.default.createElement(Typography_1.default, { fontSize: 21, fontFamily: 'Inter', fontWeight: 600, textAlign: 'center' }, user ? emptyMsg.user : emptyMsg.public))) : (getMaxItems().map((x, index) => (react_1.default.createElement(material_1.Paper, { key: index, sx: { padding: 0.5, backgroundColor: index % 2 === 0 ? '#E2E8F0' : '#F8FAFC', paddingY: 2 }, elevation: 0 },
|
|
@@ -337,7 +518,32 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
337
518
|
md: 'row',
|
|
338
519
|
}, justifyContent: 'flex-end', spacing: 1 },
|
|
339
520
|
csvShowAllButton && (react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: downloadCSVAll, sx: { backgroundColor: '#64748B', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, csvAllButtonTitle)),
|
|
340
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: downloadCSV, sx: { backgroundColor: '#22C55E', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, csvButtonTitle))))))
|
|
521
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: downloadCSV, sx: { backgroundColor: '#22C55E', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, csvButtonTitle)))))),
|
|
522
|
+
react_1.default.createElement(material_1.SwipeableDrawer, { anchor: isSmall ? 'bottom' : 'right', open: filterOpen, onClose: (e) => setFilterOpen(false), onOpen: (e) => setFilterOpen(true) },
|
|
523
|
+
react_1.default.createElement(material_1.List, { sx: { minWidth: 300 } }, Object.keys(filters).map((f, fIndex) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
524
|
+
react_1.default.createElement(material_1.ListItemButton, { onClick: (e) => setFilterCollapse((s) => s.map((x, idx) => {
|
|
525
|
+
if (idx === fIndex)
|
|
526
|
+
return !x;
|
|
527
|
+
return x;
|
|
528
|
+
})), sx: {
|
|
529
|
+
backgroundColor: '#ebeef2',
|
|
530
|
+
} },
|
|
531
|
+
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
532
|
+
react_1.default.createElement(icons_material_1.Circle, { transform: 'scale(0.4)' })),
|
|
533
|
+
react_1.default.createElement(material_1.ListItemText, { primary: f }),
|
|
534
|
+
filterCollapse[fIndex] ? react_1.default.createElement(icons_material_1.ExpandLess, null) : react_1.default.createElement(icons_material_1.ExpandMore, null)),
|
|
535
|
+
react_1.default.createElement(material_1.Collapse, { in: filterCollapse[fIndex], timeout: 'auto', unmountOnExit: true },
|
|
536
|
+
react_1.default.createElement(material_1.List, { component: 'div', disablePadding: true, sx: { backgroundColor: 'white' } }, filters[f].map((x) => (react_1.default.createElement(react_1.default.Fragment, null, x.options ? (x.options.map((o) => (react_1.default.createElement(material_1.ListItemButton, { sx: { pl: 4, borderBottom: 1, borderColor: '#ebeef2' } },
|
|
537
|
+
react_1.default.createElement(material_1.ListItemText, { primary: o.name, onClick: (e) => handleFilterOption(x.type, x.keyName, o.key, x.referenceKey), sx: { color: o.color, fontWeight: 600 } }))))) : x.type === 'date-interval' ? (react_1.default.createElement(material_1.Box, { padding: 2 },
|
|
538
|
+
react_1.default.createElement(FormProvider_1.default, { onSubmit: (d) => handleDateFilter(d['filterDtStart'], d['filterDtEnd'], x.keyName) },
|
|
539
|
+
react_1.default.createElement(DatePicker_1.default, { name: 'filterDtStart', title: 'A partir de:', required: true }),
|
|
540
|
+
react_1.default.createElement(material_1.Box, { marginTop: 2 }),
|
|
541
|
+
react_1.default.createElement(DatePicker_1.default, { name: 'filterDtEnd', title: 'At\u00E9 (opcional):' }),
|
|
542
|
+
react_1.default.createElement(material_1.Stack, { marginTop: 2 },
|
|
543
|
+
react_1.default.createElement(material_1.Button, { type: 'submit', variant: 'outlined', startIcon: react_1.default.createElement(icons_material_1.CalendarToday, null) }, "Filtrar por Data"))))) : (react_1.default.createElement(material_1.ListItemButton, { sx: { pl: 4, borderBottom: 1, borderColor: '#ebeef2' } },
|
|
544
|
+
react_1.default.createElement(material_1.ListItemIcon, { sx: { minWidth: '25px' } }, x.type === 'a-z' || x.type === 'data-a-z' ? (react_1.default.createElement(icons_material_1.South, { transform: 'scale(0.5)' })) : x.type === 'z-a' || x.type === 'data-z-a' ? (react_1.default.createElement(icons_material_1.North, { transform: 'scale(0.5)' })) : null),
|
|
545
|
+
react_1.default.createElement(material_1.ListItemText, { primary: x.name, onClick: (e) => handleFilterOption(x.type, x.keyName) })))))))))))),
|
|
546
|
+
react_1.default.createElement(material_1.Button, { variant: 'contained', onClick: handleFilterReset, startIcon: react_1.default.createElement(icons_material_1.RestartAlt, null), sx: { marginX: 2, marginBottom: 2 } }, "Reiniciar"))));
|
|
341
547
|
}
|
|
342
548
|
exports.Table = Table;
|
|
343
549
|
exports.default = react_1.default.memo(Table);
|