norma-library 0.5.135 → 0.5.137
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/dist/esm/components/UncontrolledTable/components/header/styles.js +1 -1
- package/dist/esm/components/UncontrolledTable/components/header/styles.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/components/tbody/index.d.ts +1 -1
- package/dist/esm/components/UncontrolledTable/components/tbody/index.js +5 -5
- package/dist/esm/components/UncontrolledTable/components/tbody/index.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/components/tbody/styles.d.ts +2 -0
- package/dist/esm/components/UncontrolledTable/components/tbody/styles.js +4 -3
- package/dist/esm/components/UncontrolledTable/components/tbody/styles.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/index.js +49 -50
- package/dist/esm/components/UncontrolledTable/index.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/interface.d.ts +1 -1
- package/dist/esm/components/UncontrolledTable/styles.d.ts +4 -3
- package/dist/esm/components/UncontrolledTable/styles.js +12 -11
- package/dist/esm/components/UncontrolledTable/styles.js.map +1 -1
- package/dist/esm/hooks/useClickOutside.d.ts +2 -0
- package/dist/esm/hooks/useClickOutside.js +16 -0
- package/dist/esm/hooks/useClickOutside.js.map +1 -0
- package/package.json +1 -1
- package/src/components/UncontrolledTable/components/header/styles.tsx +2 -1
- package/src/components/UncontrolledTable/components/tbody/index.tsx +27 -25
- package/src/components/UncontrolledTable/components/tbody/styles.tsx +25 -3
- package/src/components/UncontrolledTable/index.tsx +128 -134
- package/src/components/UncontrolledTable/interface.ts +1 -1
- package/src/components/UncontrolledTable/styles.tsx +35 -47
- package/src/hooks/useClickOutside.tsx +18 -0
- package/src/stories/UncontrolledTable.stories.tsx +5 -38
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
export var Header = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
3
|
+
export var Header = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n width: calc(100% - 32px);\n margin: 0 auto;\n"], ["\n display: flex;\n justify-content: space-between;\n width: calc(100% - 32px);\n margin: 0 auto;\n"])));
|
|
4
4
|
export var Results = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 8px;\n"])));
|
|
5
5
|
export var Tools = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
|
|
6
6
|
export var TextResult = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: #666666;\n font-size: 16px;\n"], ["\n color: #666666;\n font-size: 16px;\n"])));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/header/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,MAAM,GAAG,MAAM,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/header/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,MAAM,GAAG,MAAM,CAAC,GAAG,4KAAK,yGAKpC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,GAAG,iIAAA,8DAIhC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,qEAAA,EAAE,IAAA,CAAC;AAElC,MAAM,CAAC,IAAM,UAAU,GAAG,MAAM,CAAC,GAAG,8GAAA,2CAGnC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,wFAAA,qBAE/C,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,eAAe,GAAG,MAAM,CAAC,CAAC,mMAAA,gIAQtC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,4HAAA,yDAIlC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,+YAAA,4UAiBlC,IAAA,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { flexRender } from '@tanstack/react-table';
|
|
3
|
-
import * as S from
|
|
3
|
+
import * as S from './styles';
|
|
4
4
|
var TBody = function (_a) {
|
|
5
5
|
var table = _a.table, onClick = _a.onClick, onMouseOver = _a.onMouseOver, onMouseOut = _a.onMouseOut;
|
|
6
6
|
return (React.createElement("tbody", null, table.getRowModel().rows.map(function (row, index) {
|
|
7
|
-
return React.createElement(S.Tr, { key: index, "$hasAction": !!onClick || !!onMouseOver || !!onMouseOut, onClick: function () { return onClick ? onClick(row.original) : null; }, onMouseOver: function () { return onMouseOver ? onMouseOver(row.original) : null; }, onMouseOut: function () { return onMouseOut ? onMouseOut(row.original) : null; } }, row.getVisibleCells().map(function (cell, index) {
|
|
8
|
-
return (React.createElement(
|
|
7
|
+
return (React.createElement(S.Tr, { key: index, "$hasAction": !!onClick || !!onMouseOver || !!onMouseOut, onClick: function () { return (onClick ? onClick(row.original) : null); }, onMouseOver: function () { return (onMouseOver ? onMouseOver(row.original) : null); }, onMouseOut: function () { return (onMouseOut ? onMouseOut(row.original) : null); } }, row.getVisibleCells().map(function (cell, index) {
|
|
8
|
+
return (React.createElement(S.Td, { key: index }, cell.column.columnDef.type == 'action'
|
|
9
9
|
? cell.getValue()
|
|
10
10
|
: flexRender(cell.column.columnDef.cell, cell.getContext())));
|
|
11
|
-
}));
|
|
11
|
+
})));
|
|
12
12
|
})));
|
|
13
13
|
};
|
|
14
14
|
export default TBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,IAAM,KAAK,GAAkB,UAAC,EAA2C;QAAzC,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,WAAW,iBAAA,EAAE,UAAU,gBAAA;IACrE,OAAO,CACL,mCACG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,GAAQ,EAAE,KAAa;QACpD,OAAO,CACL,oBAAC,CAAC,CAAC,EAAE,IACH,GAAG,EAAE,KAAK,gBACE,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,UAAU,EACtD,OAAO,EAAE,cAAM,OAAA,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAxC,CAAwC,EACvD,WAAW,EAAE,cAAM,OAAA,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAhD,CAAgD,EACnE,UAAU,EAAE,cAAM,OAAA,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAA9C,CAA8C,IAE/D,GAAG,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,UAAC,IAAS,EAAE,KAAa;YAClD,OAAO,CACL,oBAAC,CAAC,CAAC,EAAE,IAAC,GAAG,EAAE,KAAK,IACb,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,QAAQ;gBACrC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACjB,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CACxD,CACR,CAAC;QACJ,CAAC,CAAC,CACG,CACR,CAAC;IACJ,CAAC,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const Tr: import("styled-components").IStyledComponent<"web", any>;
|
|
3
|
+
export declare const Td: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, never>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import styled from
|
|
3
|
-
export var Tr = styled.tr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
4
|
-
var
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export var Tr = styled.tr(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n &:nth-of-type(even) {\n background-color: #fafafa;\n }\n"], ["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n &:nth-of-type(even) {\n background-color: #fafafa;\n }\n"])));
|
|
4
|
+
export var Td = styled.td(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: rgba(0, 0, 0, 0.87);\n color: #666666;\n font-size: 0.875rem;\n font-weight: 700;\n"], ["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: rgba(0, 0, 0, 0.87);\n color: #666666;\n font-size: 0.875rem;\n font-weight: 700;\n"])));
|
|
5
|
+
var templateObject_1, templateObject_2;
|
|
5
6
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../src/components/UncontrolledTable/components/tbody/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,yNAAK,sJAQ/B,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,wZAAA,qVAc1B,IAAA,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import React, { useState, useMemo } from 'react';
|
|
2
|
+
import React, { useState, useMemo, useRef } from 'react';
|
|
3
3
|
import * as S from './styles';
|
|
4
4
|
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
5
5
|
import { Pagination, Header, TBody } from './components';
|
|
6
|
+
import useClickOutside from '../../hooks/useClickOutside';
|
|
6
7
|
var UncontrolledTable = function (props) {
|
|
7
8
|
var data = props.data, columns = props.columns, onClick = props.onClick, onMouseOver = props.onMouseOver, onMouseOut = props.onMouseOut, showTotalResults = props.showTotalResults, showSettings = props.showSettings, onChangePage = props.onChangePage, pagination = props.pagination, totalPages = props.totalPages, showClearFields = props.showClearFields, onClearFieldsClick = props.onClearFieldsClick, onFilterClick = props.onFilterClick, onSortClick = props.onSortClick, customTotalResults = props.customTotalResults, labels = props.labels, tableClassName = props.tableClassName;
|
|
8
9
|
var _a = useState(''), openFilterDialog = _a[0], setOpenFilterDialog = _a[1];
|
|
@@ -30,58 +31,56 @@ var UncontrolledTable = function (props) {
|
|
|
30
31
|
return config;
|
|
31
32
|
}, [data, sorting, filterByColumn, columns, pagination]);
|
|
32
33
|
var table = useReactTable(reactTableConfig);
|
|
34
|
+
var filterRef = useRef(null);
|
|
35
|
+
useClickOutside(filterRef, function () { return setOpenFilterDialog(''); });
|
|
33
36
|
return (React.createElement(S.Container, null,
|
|
34
37
|
React.createElement(Header, { table: table, globalFilters: globalFilters, orderSmallest: orderSmallest, orderLargest: orderLargest, showTotalResults: showTotalResults, showSettings: showSettings, setGlobalFilters: setGlobalFilters, setOrderLargest: setOrderLargest, setOrderSmallest: setOrderSmallest, showClearFiels: showClearFields, customTotalResults: customTotalResults, clearLabel: labels === null || labels === void 0 ? void 0 : labels.clearFilter, onClearFieldsClick: function () { return onClearFieldsClick && onClearFieldsClick(); } }),
|
|
35
|
-
React.createElement(S.
|
|
36
|
-
React.createElement(S.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
React.createElement(S.Table, { className: tableClassName || '' },
|
|
39
|
+
React.createElement(S.Thead, null, table.getHeaderGroups().map(function (headerGroup) { return (React.createElement(S.TableRow, { key: headerGroup.id }, headerGroup.headers.map(function (header) {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
return (React.createElement(S.Th, { key: header.id },
|
|
42
|
+
React.createElement(S.ColumnContent, { onClick: function () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (!((_b = (_a = header === null || header === void 0 ? void 0 : header.column) === null || _a === void 0 ? void 0 : _a.columnDef) === null || _b === void 0 ? void 0 : _b.disableMenu))
|
|
45
|
+
setOpenFilterDialog(header.column.columnDef.accessorKey);
|
|
46
|
+
} },
|
|
47
|
+
React.createElement(S.TextColumn, null, !header.isPlaceholder && flexRender(header.column.columnDef.header, header.getContext())),
|
|
48
|
+
!((_b = (_a = header === null || header === void 0 ? void 0 : header.column) === null || _a === void 0 ? void 0 : _a.columnDef) === null || _b === void 0 ? void 0 : _b.disableMenu) && (React.createElement(S.IconFilterDialog, null,
|
|
49
|
+
React.createElement("svg", { fill: "#666", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24" },
|
|
50
|
+
React.createElement("path", { d: "m7 10 5 5 5-5z" }))))),
|
|
51
|
+
openFilterDialog === header.column.columnDef.accessorKey && (React.createElement(S.FilterDialog, { ref: filterRef },
|
|
52
|
+
React.createElement(S.ListFilterDialog, null,
|
|
53
|
+
React.createElement(S.OptionFilterDialog, { style: {
|
|
54
|
+
background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
55
|
+
}, onClick: function () {
|
|
56
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'asc');
|
|
57
|
+
setOpenFilterDialog('');
|
|
45
58
|
} },
|
|
46
|
-
React.createElement(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
React.createElement("svg", { fill: "#666", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", width: "20", height: "20" },
|
|
72
|
-
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75" }))),
|
|
73
|
-
React.createElement("p", null, (labels === null || labels === void 0 ? void 0 : labels.orderDesc) || 'Maior primeiro')),
|
|
74
|
-
!((_f = (_e = header === null || header === void 0 ? void 0 : header.column) === null || _e === void 0 ? void 0 : _e.columnDef) === null || _f === void 0 ? void 0 : _f.nofilter) && (React.createElement(S.OptionFilterDialog, { onClick: function () {
|
|
75
|
-
onFilterClick && onFilterClick(header.column.columnDef.accessorKey);
|
|
76
|
-
setOpenFilterDialog('');
|
|
77
|
-
} },
|
|
78
|
-
React.createElement("div", { className: "icon" },
|
|
79
|
-
React.createElement("svg", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", width: "16", height: "16" },
|
|
80
|
-
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" }))),
|
|
81
|
-
React.createElement("p", null, (labels === null || labels === void 0 ? void 0 : labels.filter) || 'Filtrar por'))))))))));
|
|
82
|
-
}))); })),
|
|
83
|
-
React.createElement(TBody, { table: table, onClick: onClick, onMouseOver: onMouseOver, onMouseOut: onMouseOut }))),
|
|
84
|
-
React.createElement(Pagination, { pagination: pagination, count: totalPages, onChangePage: function (page) { return onChangePage(__assign(__assign({}, pagination), { pageIndex: page })); } })));
|
|
59
|
+
React.createElement("div", { className: "icon" },
|
|
60
|
+
React.createElement("svg", { fill: "#666", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", width: "20", height: "20" },
|
|
61
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75" }))),
|
|
62
|
+
React.createElement("p", null, (labels === null || labels === void 0 ? void 0 : labels.orderAsc) || 'Menor primeiro')),
|
|
63
|
+
React.createElement(S.OptionFilterDialog, { style: {
|
|
64
|
+
background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
65
|
+
}, onClick: function () {
|
|
66
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'desc');
|
|
67
|
+
setOpenFilterDialog('');
|
|
68
|
+
} },
|
|
69
|
+
React.createElement("div", { className: "icon rotate" },
|
|
70
|
+
React.createElement("svg", { fill: "#666", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", width: "20", height: "20" },
|
|
71
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75" }))),
|
|
72
|
+
React.createElement("p", null, (labels === null || labels === void 0 ? void 0 : labels.orderDesc) || 'Maior primeiro')),
|
|
73
|
+
!((_d = (_c = header === null || header === void 0 ? void 0 : header.column) === null || _c === void 0 ? void 0 : _c.columnDef) === null || _d === void 0 ? void 0 : _d.nofilter) && (React.createElement(S.OptionFilterDialog, { onClick: function () {
|
|
74
|
+
onFilterClick && onFilterClick(header.column.columnDef.accessorKey);
|
|
75
|
+
setOpenFilterDialog('');
|
|
76
|
+
} },
|
|
77
|
+
React.createElement("div", { className: "icon" },
|
|
78
|
+
React.createElement("svg", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", width: "16", height: "16" },
|
|
79
|
+
React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" }))),
|
|
80
|
+
React.createElement("p", null, (labels === null || labels === void 0 ? void 0 : labels.filter) || 'Filtrar por'))))))));
|
|
81
|
+
}))); })),
|
|
82
|
+
React.createElement(TBody, { table: table, onClick: onClick, onMouseOver: onMouseOver, onMouseOut: onMouseOut })),
|
|
83
|
+
pagination && (React.createElement(Pagination, { pagination: pagination, count: totalPages, onChangePage: function (page) { return onChangePage(__assign(__assign({}, pagination), { pageIndex: page })); } }))));
|
|
85
84
|
};
|
|
86
85
|
export default UncontrolledTable;
|
|
87
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/UncontrolledTable/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/UncontrolledTable/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EACL,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,GAGd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE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EF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Container: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
3
|
-
export declare const Content: import("styled-components").IStyledComponent<"web", any>;
|
|
4
3
|
export declare const Table: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>>;
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const Thead: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, never>>;
|
|
5
|
+
export declare const TableRow: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, never>>;
|
|
6
|
+
export declare const Th: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, never>>;
|
|
6
7
|
export declare const ColumnContent: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
8
|
+
export declare const TextColumn: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>;
|
|
7
9
|
export declare const IconFilterDialog: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
8
|
-
export declare const backgroundDialog: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
9
10
|
export declare const FilterDialog: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
10
11
|
export declare const ListFilterDialog: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
11
12
|
export declare const OptionFilterDialog: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
4
|
-
export var
|
|
5
|
-
export var
|
|
6
|
-
export var
|
|
7
|
-
export var
|
|
8
|
-
export var
|
|
9
|
-
export var
|
|
10
|
-
export var
|
|
11
|
-
export var
|
|
12
|
-
export var
|
|
13
|
-
var
|
|
3
|
+
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: #fff;\n"], ["\n background-color: #fff;\n"])));
|
|
4
|
+
export var Table = styled.table(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: table;\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n min-width: 650px;\n border: none;\n"], ["\n display: table;\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n min-width: 650px;\n border: none;\n"])));
|
|
5
|
+
export var Thead = styled.thead(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: table-header-group;\n"], ["\n display: table-header-group;\n"])));
|
|
6
|
+
export var TableRow = styled.tr(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n"], ["\n color: inherit;\n display: table-row;\n vertical-align: middle;\n outline: 0;\n"])));
|
|
7
|
+
export var Th = styled.th(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: rgba(0, 0, 0, 0.87);\n color: #666666;\n font-size: 0.875rem;\n font-weight: 700;\n"], ["\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.5rem;\n letter-spacing: 0.01071em;\n display: table-cell;\n vertical-align: inherit;\n border-bottom: 1px solid rgba(224, 224, 224, 1);\n text-align: left;\n padding: 16px;\n color: rgba(0, 0, 0, 0.87);\n color: #666666;\n font-size: 0.875rem;\n font-weight: 700;\n"])));
|
|
8
|
+
export var ColumnContent = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 5px;\n"], ["\n display: flex;\n align-items: center;\n gap: 5px;\n"])));
|
|
9
|
+
export var TextColumn = styled.span(templateObject_7 || (templateObject_7 = __makeTemplateObject([""], [""])));
|
|
10
|
+
export var IconFilterDialog = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n height: 20px;\n width: 20px;\n"], ["\n height: 20px;\n width: 20px;\n"])));
|
|
11
|
+
export var FilterDialog = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n padding: 10px 0;\n margin: 6px 0px 0 0;\n width: max-content;\n background: #fff;\n box-shadow: 0px 3px 6px #00000029;\n border: 1px solid #e0e0e0;\n z-index: 99;\n"], ["\n position: absolute;\n padding: 10px 0;\n margin: 6px 0px 0 0;\n width: max-content;\n background: #fff;\n box-shadow: 0px 3px 6px #00000029;\n border: 1px solid #e0e0e0;\n z-index: 99;\n"])));
|
|
12
|
+
export var ListFilterDialog = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n .label {\n margin: 0 0 8px 0;\n color: #666666;\n font-size: 14px;\n font-weight: 400;\n text-align: left;\n }\n .select {\n border: 1px solid #e0e0e0;\n padding: 8px 12px;\n }\n"], ["\n display: flex;\n flex-direction: column;\n .label {\n margin: 0 0 8px 0;\n color: #666666;\n font-size: 14px;\n font-weight: 400;\n text-align: left;\n }\n .select {\n border: 1px solid #e0e0e0;\n padding: 8px 12px;\n }\n"])));
|
|
13
|
+
export var OptionFilterDialog = styled.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n gap: 16px;\n align-items: center;\n padding: 6px 15px;\n cursor: pointer;\n &:hover {\n background: rgba(0, 0, 0, 0.04);\n }\n .icon {\n color: #666;\n }\n .rotate {\n rotate: 180deg;\n }\n div {\n width: 20px;\n height: 20px;\n }\n p {\n margin: 0;\n color: #666666;\n font-size: 16px;\n font-weight: 400;\n }\n"], ["\n display: flex;\n gap: 16px;\n align-items: center;\n padding: 6px 15px;\n cursor: pointer;\n &:hover {\n background: rgba(0, 0, 0, 0.04);\n }\n .icon {\n color: #666;\n }\n .rotate {\n rotate: 180deg;\n }\n div {\n width: 20px;\n height: 20px;\n }\n p {\n margin: 0;\n color: #666666;\n font-size: 16px;\n font-weight: 400;\n }\n"])));
|
|
14
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
14
15
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/UncontrolledTable/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/UncontrolledTable/styles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,kGAAA,+BAElC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,oMAAA,iIAOhC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,uGAAA,oCAEhC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,2JAAA,wFAKhC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,EAAE,GAAG,MAAM,CAAC,EAAE,wZAAA,qVAc1B,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,aAAa,GAAG,MAAM,CAAC,GAAG,8HAAA,2DAItC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,qEAAA,EAAE,IAAA,CAAC;AAExC,MAAM,CAAC,IAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,wGAAA,qCAGzC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,YAAY,GAAG,MAAM,CAAC,GAAG,0QAAA,uMASrC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,kUAAA,6PAczC,IAAA,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,6bAAA,wXAyB3C,IAAA,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
var useClickOutside = function (ref, callback) {
|
|
3
|
+
var handleClickOutside = function (event) {
|
|
4
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
5
|
+
callback();
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
10
|
+
return function () {
|
|
11
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
12
|
+
};
|
|
13
|
+
}, [ref, callback]);
|
|
14
|
+
};
|
|
15
|
+
export default useClickOutside;
|
|
16
|
+
//# sourceMappingURL=useClickOutside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClickOutside.js","sourceRoot":"","sources":["../../../src/hooks/useClickOutside.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,IAAM,eAAe,GAAG,UAAC,GAAiC,EAAE,QAAoB;IAC9E,IAAM,kBAAkB,GAAG,UAAC,KAAiB;QAC3C,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE,CAAC;YAC/D,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,SAAS,CAAC;QACR,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.137",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
|
|
6
6
|
"scripts": {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const Header = styled.div<any>`
|
|
4
|
-
margin: ${props => (props.$showResults ? '0 24px 10px 24px;' : '0 16px;')};
|
|
5
4
|
display: flex;
|
|
6
5
|
justify-content: space-between;
|
|
6
|
+
width: calc(100% - 32px);
|
|
7
|
+
margin: 0 auto;
|
|
7
8
|
`;
|
|
8
9
|
|
|
9
10
|
export const Results = styled.div`
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { flexRender } from '@tanstack/react-table'
|
|
3
|
-
import * as S from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
3
|
+
import * as S from './styles';
|
|
4
4
|
|
|
5
|
-
const TBody:React.FC<any> = ({ table, onClick, onMouseOver, onMouseOut }) => {
|
|
5
|
+
const TBody: React.FC<any> = ({ table, onClick, onMouseOver, onMouseOut }) => {
|
|
6
6
|
return (
|
|
7
7
|
<tbody>
|
|
8
|
-
{
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
{table.getRowModel().rows.map((row: any, index: number) => {
|
|
9
|
+
return (
|
|
10
|
+
<S.Tr
|
|
11
|
+
key={index}
|
|
12
|
+
$hasAction={!!onClick || !!onMouseOver || !!onMouseOut}
|
|
13
|
+
onClick={() => (onClick ? onClick(row.original) : null)}
|
|
14
|
+
onMouseOver={() => (onMouseOver ? onMouseOver(row.original) : null)}
|
|
15
|
+
onMouseOut={() => (onMouseOut ? onMouseOut(row.original) : null)}
|
|
16
|
+
>
|
|
17
|
+
{row.getVisibleCells().map((cell: any, index: number) => {
|
|
18
|
+
return (
|
|
19
|
+
<S.Td key={index}>
|
|
20
|
+
{cell.column.columnDef.type == 'action'
|
|
19
21
|
? cell.getValue()
|
|
20
|
-
: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
22
|
+
: flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
23
|
+
</S.Td>
|
|
24
|
+
);
|
|
25
|
+
})}
|
|
26
|
+
</S.Tr>
|
|
27
|
+
);
|
|
28
|
+
})}
|
|
27
29
|
</tbody>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
30
32
|
|
|
31
|
-
export default TBody
|
|
33
|
+
export default TBody;
|
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
import styled from
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const Tr = styled.tr<any>`
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
color: inherit;
|
|
5
|
+
display: table-row;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
outline: 0;
|
|
8
|
+
&:nth-of-type(even) {
|
|
9
|
+
background-color: #fafafa;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const Td = styled.td`
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-size: 0.875rem;
|
|
16
|
+
line-height: 1.5rem;
|
|
17
|
+
letter-spacing: 0.01071em;
|
|
18
|
+
display: table-cell;
|
|
19
|
+
vertical-align: inherit;
|
|
20
|
+
border-bottom: 1px solid rgba(224, 224, 224, 1);
|
|
21
|
+
text-align: left;
|
|
22
|
+
padding: 16px;
|
|
23
|
+
color: rgba(0, 0, 0, 0.87);
|
|
24
|
+
color: #666666;
|
|
25
|
+
font-size: 0.875rem;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { useState, useMemo } from 'react';
|
|
1
|
+
import React, { useState, useMemo, useRef } from 'react';
|
|
2
2
|
import * as S from './styles';
|
|
3
|
+
|
|
3
4
|
import {
|
|
4
5
|
flexRender,
|
|
5
6
|
getCoreRowModel,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
|
|
12
13
|
import { Pagination, Header, TBody } from './components';
|
|
13
14
|
import { UncontrolledTableProps } from './interface';
|
|
15
|
+
import useClickOutside from '../../hooks/useClickOutside';
|
|
14
16
|
|
|
15
17
|
const UncontrolledTable = (props: UncontrolledTableProps) => {
|
|
16
18
|
const {
|
|
@@ -61,6 +63,9 @@ const UncontrolledTable = (props: UncontrolledTableProps) => {
|
|
|
61
63
|
}, [data, sorting, filterByColumn, columns, pagination]);
|
|
62
64
|
|
|
63
65
|
const table = useReactTable(reactTableConfig);
|
|
66
|
+
const filterRef = useRef<HTMLDivElement>(null);
|
|
67
|
+
|
|
68
|
+
useClickOutside(filterRef, () => setOpenFilterDialog(''));
|
|
64
69
|
|
|
65
70
|
return (
|
|
66
71
|
<S.Container>
|
|
@@ -79,146 +84,135 @@ const UncontrolledTable = (props: UncontrolledTableProps) => {
|
|
|
79
84
|
clearLabel={labels?.clearFilter}
|
|
80
85
|
onClearFieldsClick={() => onClearFieldsClick && onClearFieldsClick()}
|
|
81
86
|
/>
|
|
82
|
-
<S.
|
|
83
|
-
<S.
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
87
|
+
<S.Table className={tableClassName || ''}>
|
|
88
|
+
<S.Thead>
|
|
89
|
+
{table.getHeaderGroups().map((headerGroup: any) => (
|
|
90
|
+
<S.TableRow key={headerGroup.id}>
|
|
91
|
+
{headerGroup.headers.map((header: any) => (
|
|
92
|
+
<S.Th key={header.id}>
|
|
93
|
+
<S.ColumnContent
|
|
94
|
+
onClick={() => {
|
|
95
|
+
if (!header?.column?.columnDef?.disableMenu)
|
|
96
|
+
setOpenFilterDialog(header.column.columnDef.accessorKey);
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<S.TextColumn>
|
|
100
|
+
{!header.isPlaceholder && flexRender(header.column.columnDef.header, header.getContext())}
|
|
101
|
+
</S.TextColumn>
|
|
102
|
+
{!header?.column?.columnDef?.disableMenu && (
|
|
103
|
+
<S.IconFilterDialog>
|
|
104
|
+
<svg fill="#666" focusable="false" aria-hidden="true" viewBox="0 0 24 24">
|
|
105
|
+
<path d="m7 10 5 5 5-5z" />
|
|
106
|
+
</svg>
|
|
107
|
+
</S.IconFilterDialog>
|
|
108
|
+
)}
|
|
109
|
+
</S.ColumnContent>
|
|
110
|
+
{openFilterDialog === header.column.columnDef.accessorKey && (
|
|
111
|
+
<S.FilterDialog ref={filterRef}>
|
|
112
|
+
<S.ListFilterDialog>
|
|
113
|
+
<S.OptionFilterDialog
|
|
114
|
+
style={{
|
|
115
|
+
background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
116
|
+
}}
|
|
117
|
+
onClick={() => {
|
|
118
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'asc');
|
|
119
|
+
setOpenFilterDialog('');
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
<div className="icon">
|
|
101
123
|
<svg
|
|
102
124
|
fill="#666"
|
|
103
|
-
|
|
125
|
+
stroke="currentColor"
|
|
126
|
+
strokeWidth="1.5"
|
|
127
|
+
viewBox="0 0 24 24"
|
|
128
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
104
129
|
aria-hidden="true"
|
|
130
|
+
width="20"
|
|
131
|
+
height="20"
|
|
132
|
+
>
|
|
133
|
+
<path
|
|
134
|
+
strokeLinecap="round"
|
|
135
|
+
strokeLinejoin="round"
|
|
136
|
+
d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"
|
|
137
|
+
/>
|
|
138
|
+
</svg>
|
|
139
|
+
</div>
|
|
140
|
+
<p>{labels?.orderAsc || 'Menor primeiro'}</p>
|
|
141
|
+
</S.OptionFilterDialog>
|
|
142
|
+
<S.OptionFilterDialog
|
|
143
|
+
style={{
|
|
144
|
+
background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
145
|
+
}}
|
|
146
|
+
onClick={() => {
|
|
147
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'desc');
|
|
148
|
+
setOpenFilterDialog('');
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
<div className="icon rotate">
|
|
152
|
+
<svg
|
|
153
|
+
fill="#666"
|
|
154
|
+
stroke="currentColor"
|
|
155
|
+
strokeWidth="1.5"
|
|
105
156
|
viewBox="0 0 24 24"
|
|
106
|
-
|
|
157
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
158
|
+
aria-hidden="true"
|
|
159
|
+
width="20"
|
|
160
|
+
height="20"
|
|
107
161
|
>
|
|
108
|
-
<path
|
|
162
|
+
<path
|
|
163
|
+
strokeLinecap="round"
|
|
164
|
+
strokeLinejoin="round"
|
|
165
|
+
d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"
|
|
166
|
+
></path>
|
|
109
167
|
</svg>
|
|
110
|
-
</
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
168
|
+
</div>
|
|
169
|
+
<p>{labels?.orderDesc || 'Maior primeiro'}</p>
|
|
170
|
+
</S.OptionFilterDialog>
|
|
171
|
+
{!header?.column?.columnDef?.nofilter && (
|
|
172
|
+
<S.OptionFilterDialog
|
|
173
|
+
onClick={() => {
|
|
174
|
+
onFilterClick && onFilterClick(header.column.columnDef.accessorKey);
|
|
175
|
+
setOpenFilterDialog('');
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
<div className="icon">
|
|
179
|
+
<svg
|
|
180
|
+
fill="none"
|
|
181
|
+
stroke="currentColor"
|
|
182
|
+
strokeWidth="1.5"
|
|
183
|
+
viewBox="0 0 24 24"
|
|
184
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
185
|
+
aria-hidden="true"
|
|
186
|
+
width="16"
|
|
187
|
+
height="16"
|
|
126
188
|
>
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}}
|
|
155
|
-
>
|
|
156
|
-
<div className="icon rotate">
|
|
157
|
-
<svg
|
|
158
|
-
fill="#666"
|
|
159
|
-
stroke="currentColor"
|
|
160
|
-
strokeWidth="1.5"
|
|
161
|
-
viewBox="0 0 24 24"
|
|
162
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
163
|
-
aria-hidden="true"
|
|
164
|
-
width="20"
|
|
165
|
-
height="20"
|
|
166
|
-
>
|
|
167
|
-
<path
|
|
168
|
-
strokeLinecap="round"
|
|
169
|
-
strokeLinejoin="round"
|
|
170
|
-
d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"
|
|
171
|
-
></path>
|
|
172
|
-
</svg>
|
|
173
|
-
</div>
|
|
174
|
-
<p>{labels?.orderDesc || 'Maior primeiro'}</p>
|
|
175
|
-
</S.OptionFilterDialog>
|
|
176
|
-
{!header?.column?.columnDef?.nofilter && (
|
|
177
|
-
<S.OptionFilterDialog
|
|
178
|
-
onClick={() => {
|
|
179
|
-
onFilterClick && onFilterClick(header.column.columnDef.accessorKey);
|
|
180
|
-
setOpenFilterDialog('');
|
|
181
|
-
}}
|
|
182
|
-
>
|
|
183
|
-
<div className="icon">
|
|
184
|
-
<svg
|
|
185
|
-
fill="none"
|
|
186
|
-
stroke="currentColor"
|
|
187
|
-
strokeWidth="1.5"
|
|
188
|
-
viewBox="0 0 24 24"
|
|
189
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
190
|
-
aria-hidden="true"
|
|
191
|
-
width="16"
|
|
192
|
-
height="16"
|
|
193
|
-
>
|
|
194
|
-
<path
|
|
195
|
-
strokeLinecap="round"
|
|
196
|
-
strokeLinejoin="round"
|
|
197
|
-
d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"
|
|
198
|
-
></path>
|
|
199
|
-
</svg>
|
|
200
|
-
</div>
|
|
201
|
-
<p>{labels?.filter || 'Filtrar por'}</p>
|
|
202
|
-
</S.OptionFilterDialog>
|
|
203
|
-
)}
|
|
204
|
-
</S.ListFilterDialog>
|
|
205
|
-
</S.FilterDialog>
|
|
206
|
-
</>
|
|
207
|
-
)}
|
|
208
|
-
</div>
|
|
209
|
-
</th>
|
|
210
|
-
))}
|
|
211
|
-
</tr>
|
|
212
|
-
))}
|
|
213
|
-
</thead>
|
|
214
|
-
<TBody table={table} onClick={onClick} onMouseOver={onMouseOver} onMouseOut={onMouseOut} />
|
|
215
|
-
</S.Table>
|
|
216
|
-
</S.Content>
|
|
217
|
-
<Pagination
|
|
218
|
-
pagination={pagination}
|
|
219
|
-
count={totalPages}
|
|
220
|
-
onChangePage={(page: number) => onChangePage({ ...pagination, pageIndex: page })}
|
|
221
|
-
/>
|
|
189
|
+
<path
|
|
190
|
+
strokeLinecap="round"
|
|
191
|
+
strokeLinejoin="round"
|
|
192
|
+
d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"
|
|
193
|
+
></path>
|
|
194
|
+
</svg>
|
|
195
|
+
</div>
|
|
196
|
+
<p>{labels?.filter || 'Filtrar por'}</p>
|
|
197
|
+
</S.OptionFilterDialog>
|
|
198
|
+
)}
|
|
199
|
+
</S.ListFilterDialog>
|
|
200
|
+
</S.FilterDialog>
|
|
201
|
+
)}
|
|
202
|
+
</S.Th>
|
|
203
|
+
))}
|
|
204
|
+
</S.TableRow>
|
|
205
|
+
))}
|
|
206
|
+
</S.Thead>
|
|
207
|
+
<TBody table={table} onClick={onClick} onMouseOver={onMouseOver} onMouseOut={onMouseOut} />
|
|
208
|
+
</S.Table>
|
|
209
|
+
{pagination && (
|
|
210
|
+
<Pagination
|
|
211
|
+
pagination={pagination}
|
|
212
|
+
count={totalPages}
|
|
213
|
+
onChangePage={(page: number) => onChangePage({ ...pagination, pageIndex: page })}
|
|
214
|
+
/>
|
|
215
|
+
)}
|
|
222
216
|
</S.Container>
|
|
223
217
|
);
|
|
224
218
|
};
|
|
@@ -1,74 +1,62 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const Container = styled.div`
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const Table = styled.table`
|
|
8
|
+
display: table;
|
|
4
9
|
width: 100%;
|
|
5
|
-
|
|
10
|
+
border-collapse: collapse;
|
|
11
|
+
border-spacing: 0;
|
|
12
|
+
min-width: 650px;
|
|
13
|
+
border: none;
|
|
6
14
|
`;
|
|
7
15
|
|
|
8
|
-
export const
|
|
9
|
-
|
|
16
|
+
export const Thead = styled.thead`
|
|
17
|
+
display: table-header-group;
|
|
10
18
|
`;
|
|
11
19
|
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
border-bottom: 1px solid #e0e0e0;
|
|
18
|
-
th {
|
|
19
|
-
padding: 12px 24px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
tbody {
|
|
24
|
-
tr {
|
|
25
|
-
td {
|
|
26
|
-
padding: 16px 24px;
|
|
27
|
-
color: #666666;
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
tr:nth-child(even) {
|
|
32
|
-
background: #fafafa;
|
|
33
|
-
border-bottom: 1px solid #f1f1f1;
|
|
34
|
-
border-top: 1px solid #f1f1f1;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
20
|
+
export const TableRow = styled.tr`
|
|
21
|
+
color: inherit;
|
|
22
|
+
display: table-row;
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
outline: 0;
|
|
37
25
|
`;
|
|
38
26
|
|
|
39
|
-
export const
|
|
27
|
+
export const Th = styled.th`
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
font-size: 0.875rem;
|
|
30
|
+
line-height: 1.5rem;
|
|
31
|
+
letter-spacing: 0.01071em;
|
|
32
|
+
display: table-cell;
|
|
33
|
+
vertical-align: inherit;
|
|
34
|
+
border-bottom: 1px solid rgba(224, 224, 224, 1);
|
|
35
|
+
text-align: left;
|
|
36
|
+
padding: 16px;
|
|
37
|
+
color: rgba(0, 0, 0, 0.87);
|
|
40
38
|
color: #666666;
|
|
41
|
-
font-size:
|
|
42
|
-
|
|
43
|
-
text-align: ${props => (props.$alone ? 'center' : 'initial')};
|
|
39
|
+
font-size: 0.875rem;
|
|
40
|
+
font-weight: 700;
|
|
44
41
|
`;
|
|
45
42
|
|
|
46
43
|
export const ColumnContent = styled.div`
|
|
47
|
-
gap: 2px;
|
|
48
|
-
align-items: center;
|
|
49
44
|
display: flex;
|
|
50
|
-
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 5px;
|
|
51
47
|
`;
|
|
52
48
|
|
|
49
|
+
export const TextColumn = styled.span``;
|
|
50
|
+
|
|
53
51
|
export const IconFilterDialog = styled.div`
|
|
54
|
-
width: 20px;
|
|
55
52
|
height: 20px;
|
|
56
|
-
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
export const backgroundDialog = styled.div`
|
|
60
|
-
width: 100%;
|
|
61
|
-
position: absolute;
|
|
62
|
-
height: 100vh;
|
|
63
|
-
background: transparent;
|
|
64
|
-
top: 0;
|
|
65
|
-
left: 0;
|
|
53
|
+
width: 20px;
|
|
66
54
|
`;
|
|
67
55
|
|
|
68
56
|
export const FilterDialog = styled.div`
|
|
57
|
+
position: absolute;
|
|
69
58
|
padding: 10px 0;
|
|
70
59
|
margin: 6px 0px 0 0;
|
|
71
|
-
position: absolute;
|
|
72
60
|
width: max-content;
|
|
73
61
|
background: #fff;
|
|
74
62
|
box-shadow: 0px 3px 6px #00000029;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useClickOutside = (ref: React.RefObject<HTMLElement>, callback: () => void) => {
|
|
4
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
5
|
+
if (ref.current && !ref.current.contains(event.target as Node)) {
|
|
6
|
+
callback();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
12
|
+
return () => {
|
|
13
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
14
|
+
};
|
|
15
|
+
}, [ref, callback]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default useClickOutside;
|
|
@@ -258,34 +258,6 @@ const columns = [
|
|
|
258
258
|
enableColumnFilter: true,
|
|
259
259
|
filterFn: 'customFilterText',
|
|
260
260
|
},
|
|
261
|
-
{
|
|
262
|
-
header: 'agent',
|
|
263
|
-
accessorKey: 'agent',
|
|
264
|
-
type: 'string',
|
|
265
|
-
enableColumnFilter: true,
|
|
266
|
-
filterFn: 'customFilterText',
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
header: 'disposition',
|
|
270
|
-
accessorKey: 'disposition',
|
|
271
|
-
type: 'string',
|
|
272
|
-
enableColumnFilter: true,
|
|
273
|
-
filterFn: 'customFilterText',
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
header: 'origin',
|
|
277
|
-
accessorKey: 'origin',
|
|
278
|
-
type: 'string',
|
|
279
|
-
enableColumnFilter: true,
|
|
280
|
-
filterFn: 'customFilterText',
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
header: 'ID',
|
|
284
|
-
accessorKey: 'id',
|
|
285
|
-
type: 'string',
|
|
286
|
-
enableColumnFilter: true,
|
|
287
|
-
filterFn: 'customFilterText',
|
|
288
|
-
},
|
|
289
261
|
{
|
|
290
262
|
header: 'action',
|
|
291
263
|
accessorKey: 'action',
|
|
@@ -297,16 +269,8 @@ const columns = [
|
|
|
297
269
|
];
|
|
298
270
|
|
|
299
271
|
export const Default = args => {
|
|
300
|
-
const [pagination, setPagination] = useState({
|
|
301
|
-
pageIndex: 1,
|
|
302
|
-
pageSize: 10,
|
|
303
|
-
});
|
|
304
272
|
return (
|
|
305
273
|
<>
|
|
306
|
-
<div className="Buttons" style={{marginBottom: '10px'}}>
|
|
307
|
-
<button onClick={() => setPagination({ ...pagination, pageIndex: 1 })}>Page 1</button>
|
|
308
|
-
<button onClick={() => setPagination({ ...pagination, pageIndex: 10 })}>Page 10</button>
|
|
309
|
-
</div>
|
|
310
274
|
<UncontrolledTable
|
|
311
275
|
data={data}
|
|
312
276
|
columns={columns}
|
|
@@ -317,9 +281,12 @@ export const Default = args => {
|
|
|
317
281
|
onMouseOut={value => console.log('onMouseOut line:', value)}
|
|
318
282
|
onClearFieldsClick={() => console.log('onClearFieldsClick')}
|
|
319
283
|
onFilterClick={column => console.log('onFilterClick', column)}
|
|
320
|
-
onChangePage={pagination =>
|
|
284
|
+
onChangePage={pagination => console.log('onChangePage', pagination)}
|
|
321
285
|
onSortClick={(column, direction) => console.log('onSortClick', column, direction)}
|
|
322
|
-
pagination={
|
|
286
|
+
pagination={{
|
|
287
|
+
pageIndex: 1,
|
|
288
|
+
pageSize: 10,
|
|
289
|
+
}}
|
|
323
290
|
totalPages={10}
|
|
324
291
|
showClearFields
|
|
325
292
|
labels={{
|