norma-library 0.5.77 → 0.5.79
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/ChatMessageBalloon/ChatMessageBalloon.js +11 -3
- package/dist/esm/components/ChatMessageBalloon/ChatMessageBalloon.js.map +1 -1
- package/dist/esm/components/ChatMessageBalloon/ChatMessageBalloon.style.js +1 -1
- package/dist/esm/components/ChatMessageBalloon/ChatMessageBalloon.style.js.map +1 -1
- package/dist/esm/components/DataGrid/index.js +21 -11
- package/dist/esm/components/DataGrid/index.js.map +1 -1
- package/dist/esm/interfaces/ChatMessageBalloon.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.style.ts +4 -0
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.tsx +23 -3
- package/src/components/DataGrid/index.tsx +22 -11
- package/src/interfaces/ChatMessageBalloon.ts +1 -0
- package/src/sample-data-2.json +178 -0
- package/src/stories/DataGrid.stories.tsx +6 -3
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { Typography } from '@mui/material';
|
|
4
4
|
import * as S from './ChatMessageBalloon.style';
|
|
5
5
|
export var ChatMessageBalloon = function (_a) {
|
|
6
|
-
var label = _a.label, description = _a.description, date = _a.date, direction = _a.direction, children = _a.children, className = _a.className, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onRowMouseEnter = _a.onRowMouseEnter, onRowMouseLeave = _a.onRowMouseLeave, rest = __rest(_a, ["label", "description", "date", "direction", "children", "className", "onMouseEnter", "onMouseLeave", "onRowMouseEnter", "onRowMouseLeave"]);
|
|
6
|
+
var label = _a.label, description = _a.description, date = _a.date, direction = _a.direction, children = _a.children, className = _a.className, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onRowMouseEnter = _a.onRowMouseEnter, onRowMouseLeave = _a.onRowMouseLeave, highlight = _a.highlight, rest = __rest(_a, ["label", "description", "date", "direction", "children", "className", "onMouseEnter", "onMouseLeave", "onRowMouseEnter", "onRowMouseLeave", "highlight"]);
|
|
7
|
+
var ballonClassNames = useMemo(function () {
|
|
8
|
+
var classNames = [];
|
|
9
|
+
if (!!onMouseEnter)
|
|
10
|
+
classNames.push('is-interactive');
|
|
11
|
+
if (!!highlight)
|
|
12
|
+
classNames.push('is-highlight');
|
|
13
|
+
return classNames.join(" ");
|
|
14
|
+
}, [highlight, onMouseEnter]);
|
|
7
15
|
return (React.createElement(S.ChatMessageBalloonContainerStyle, __assign({ className: className }, rest),
|
|
8
16
|
React.createElement(S.ChatMessageBalloonRowStyle, { direction: direction, onMouseLeave: onRowMouseLeave, onMouseEnter: onRowMouseEnter },
|
|
9
|
-
React.createElement(S.ChatMessageBalloonStyle, { onMouseLeave: onMouseLeave, onMouseEnter: onMouseEnter, direction: direction, className:
|
|
17
|
+
React.createElement(S.ChatMessageBalloonStyle, { onMouseLeave: onMouseLeave, onMouseEnter: onMouseEnter, direction: direction, className: ballonClassNames },
|
|
10
18
|
React.createElement(Typography, { variant: "subtitle2", style: {
|
|
11
19
|
fontSize: "1rem",
|
|
12
20
|
fontWeight: "600",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageBalloon.js","sourceRoot":"","sources":["../../../../src/components/ChatMessageBalloon/ChatMessageBalloon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatMessageBalloon.js","sourceRoot":"","sources":["../../../../src/components/ChatMessageBalloon/ChatMessageBalloon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,CAAC,MAAM,4BAA4B,CA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/B,oBAAC,CAAC,CAAC,0BAA0B,IAAC,SAAS,EAAE,SAAS;YAChD,oBAAC,CAAC,CAAC,oBAAoB,IAAC,QAAQ,EAAE,QAAQ,IAAG,IAAI,CAA0B,CAC9C,CACI,CACtC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ export var ChatMessageBalloonContainerStyle = styled(Box)({
|
|
|
6
6
|
flexDirection: "column",
|
|
7
7
|
});
|
|
8
8
|
export var ChatMessageBalloonRowStyle = styled('div')(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n margin-bottom: 8px;\n flex-direction: ", ";\n\n &:last-child {\n margin-bottom: 0px;\n }\n"], ["\n display: flex;\n margin-bottom: 8px;\n flex-direction: ", ";\n\n &:last-child {\n margin-bottom: 0px;\n }\n"])), function (props) { return (props.direction === "I") ? "row-reverse" : "row"; });
|
|
9
|
-
export var ChatMessageBalloonStyle = styled('div')(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid transparent;\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n flex-direction: column;\n padding: 12px 24px;\n width: 60%;\n transition: border 0.6s cubic-bezier(0.16, 1, 0.3, 1);\n\n &.is-interactive {\n cursor: pointer;\n\n &:hover {\n border: 1px solid #000;\n }\n }\n"], ["\n background-color: ", ";\n border: 1px solid transparent;\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n flex-direction: column;\n padding: 12px 24px;\n width: 60%;\n transition: border 0.6s cubic-bezier(0.16, 1, 0.3, 1);\n\n &.is-interactive {\n cursor: pointer;\n\n &:hover {\n border: 1px solid #000;\n }\n }\n"])), function (props) { return (props.direction === "I") ? "#FFF" : "#E18B50"; }, function (props) { return (props.direction === "I") ? "20px 20px 0px 20px" : "20px 20px 20px 0px"; }, function (props) { return (props.direction === "I") ? "#4D4F5B" : "#FFF"; });
|
|
9
|
+
export var ChatMessageBalloonStyle = styled('div')(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid transparent;\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n flex-direction: column;\n padding: 12px 24px;\n width: 60%;\n transition: border 0.6s cubic-bezier(0.16, 1, 0.3, 1);\n\n &.is-highlight {\n border: 1px solid #000;\n }\n\n &.is-interactive {\n cursor: pointer;\n\n &:hover {\n border: 1px solid #000;\n }\n }\n"], ["\n background-color: ", ";\n border: 1px solid transparent;\n border-radius: ", ";\n box-sizing: border-box;\n color: ", ";\n display: flex;\n flex-direction: column;\n padding: 12px 24px;\n width: 60%;\n transition: border 0.6s cubic-bezier(0.16, 1, 0.3, 1);\n\n &.is-highlight {\n border: 1px solid #000;\n }\n\n &.is-interactive {\n cursor: pointer;\n\n &:hover {\n border: 1px solid #000;\n }\n }\n"])), function (props) { return (props.direction === "I") ? "#FFF" : "#E18B50"; }, function (props) { return (props.direction === "I") ? "20px 20px 0px 20px" : "20px 20px 20px 0px"; }, function (props) { return (props.direction === "I") ? "#4D4F5B" : "#FFF"; });
|
|
10
10
|
export var ChatMessageDateStyle = styled(Typography)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: #43425D;\n opacity: .5;\n"], ["\n color: #43425D;\n opacity: .5;\n"])));
|
|
11
11
|
export var ChatMessageChildrenStyle = styled('div')(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n flex: 1;\n justify-content: ", ";\n padding: 8px;\n"], ["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n flex: 1;\n justify-content: ", ";\n padding: 8px;\n"])), function (props) { return (props.direction === "I") ? "end" : "start"; });
|
|
12
12
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageBalloon.style.js","sourceRoot":"","sources":["../../../../src/components/ChatMessageBalloon/ChatMessageBalloon.style.ts"],"names":[],"mappings":";AAA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EAAyD,wDAE5D,EAAkF,yCAE1F,EAAyD,oTAkBnE,KAtBqB,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAA9C,CAA8C,EAE5D,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EAAvE,CAAuE,EAE1F,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAA9C,CAA8C,CAkBnE,CAAA;AAED,MAAM,CAAC,IAAM,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC,0GAAA,uCAGrD,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,wBAAwB,GAAG,MAAM,CAAC,KAAK,CAAC,mMAAuB,wGAKvD,EAAsD,sBAE1E,KAFoB,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAA3C,CAA2C,CAE1E,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
3
3
|
import { Box, Stack, Paper } from '@mui/material';
|
|
4
4
|
import Table from '@mui/material/Table';
|
|
5
5
|
import TableBody from '@mui/material/TableBody';
|
|
@@ -25,17 +25,21 @@ export function Cog6ToothIcon(props) {
|
|
|
25
25
|
export var DataGrid = function (_a) {
|
|
26
26
|
var _b = _a.data, data = _b === void 0 ? [] : _b, onRowClick = _a.onRowClick;
|
|
27
27
|
var pageSize = 10;
|
|
28
|
-
var columns =
|
|
29
|
-
|
|
28
|
+
var columns = useMemo(function () {
|
|
29
|
+
return data[0].columns;
|
|
30
|
+
}, [data]);
|
|
31
|
+
var dataSource = useMemo(function () {
|
|
32
|
+
return data[0].dataSource;
|
|
33
|
+
}, [data]);
|
|
30
34
|
var _c = useState([]), selectedItems = _c[0], setSelectedItems = _c[1];
|
|
31
35
|
var _d = useState('down'), sorting = _d[0], setSorting = _d[1];
|
|
32
36
|
var _e = useState(false), selectAll = _e[0], setSelectAll = _e[1];
|
|
33
37
|
var _f = useState('id'), currentActiveSorting = _f[0], setCurrentActiveSorting = _f[1];
|
|
34
38
|
var _g = useState(null), currentDropDownActive = _g[0], setCurrentDropDownActive = _g[1];
|
|
35
|
-
var _h = useState(
|
|
36
|
-
var _j = useState(
|
|
37
|
-
var _k = useState(
|
|
38
|
-
var _l = useState(
|
|
39
|
+
var _h = useState([]), originalDataSource = _h[0], setOriginalDataSource = _h[1];
|
|
40
|
+
var _j = useState([]), newDataSource = _j[0], setDataSource = _j[1];
|
|
41
|
+
var _k = useState(0), totalRecords = _k[0], setTotalRecords = _k[1];
|
|
42
|
+
var _l = useState(0), totalPages = _l[0], setTotalPages = _l[1];
|
|
39
43
|
var _m = useState(1), currentPage = _m[0], setCurrentPage = _m[1];
|
|
40
44
|
var startIndex = (currentPage - 1) * pageSize;
|
|
41
45
|
var endIndex = Math.min(startIndex + pageSize, totalRecords);
|
|
@@ -79,7 +83,7 @@ export var DataGrid = function (_a) {
|
|
|
79
83
|
setDataSource(sortedData.slice(startIndex, endIndex));
|
|
80
84
|
}
|
|
81
85
|
else {
|
|
82
|
-
var sortedData = sortDataSourceByColumn(
|
|
86
|
+
var sortedData = sortDataSourceByColumn(newDataSource, currentActiveSorting, sorting);
|
|
83
87
|
setTotalRecords(sortedData.length);
|
|
84
88
|
setTotalPages(Math.ceil(sortedData.length / pageSize));
|
|
85
89
|
setCurrentPage(1);
|
|
@@ -95,13 +99,19 @@ export var DataGrid = function (_a) {
|
|
|
95
99
|
};
|
|
96
100
|
useEffect(function () {
|
|
97
101
|
if (selectedItems.length <= 0) {
|
|
98
|
-
var sortedData = sortDataSourceByColumn(
|
|
102
|
+
var sortedData = sortDataSourceByColumn(newDataSource, currentActiveSorting, sorting);
|
|
99
103
|
setDataSource(sortedData.slice(startIndex, endIndex));
|
|
100
104
|
setTotalRecords(sortedData.length);
|
|
101
105
|
setTotalPages(Math.ceil(sortedData.length / pageSize));
|
|
102
106
|
setCurrentPage(1);
|
|
103
107
|
}
|
|
104
|
-
}, [selectedItems]);
|
|
108
|
+
}, [selectedItems, dataSource]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
setOriginalDataSource(dataSource);
|
|
111
|
+
setDataSource(dataSource);
|
|
112
|
+
setTotalRecords(dataSource.length);
|
|
113
|
+
setTotalPages(Math.ceil(dataSource.length / pageSize));
|
|
114
|
+
}, [dataSource]);
|
|
105
115
|
return (React.createElement(Box, { sx: { width: '100%', minHeight: 480 } },
|
|
106
116
|
React.createElement(DataGridHeaderStyled, null,
|
|
107
117
|
React.createElement(TotalRecordsStyled, null,
|
|
@@ -118,7 +128,7 @@ export var DataGrid = function (_a) {
|
|
|
118
128
|
React.createElement(ButtonStyled, { variant: "text", size: "small", color: currentActiveSorting === item.field ? 'primary' : 'inherit', endIcon: currentActiveSorting === item.field && sorting === 'up' ? (React.createElement(ArrowDropUpIcon, null)) : (React.createElement(ArrowDropDownIcon, null)), onClick: function () {
|
|
119
129
|
handleDropDown(item.field);
|
|
120
130
|
} }, item.headerText),
|
|
121
|
-
currentDropDownActive && currentDropDownActive === item.field && (React.createElement(DropdownFilter, { format: item.format, onOrder: handleSorting, onFilter: handleFilter, onSelected: handleItemSelected, itemsSelected: selectedItems, onFilterSelected: handleFilterSelected, onChecketAll: setSelectAll, onSelectAll: selectAll, data: groupByDataSource(
|
|
131
|
+
currentDropDownActive && currentDropDownActive === item.field && (React.createElement(DropdownFilter, { format: item.format, onOrder: handleSorting, onFilter: handleFilter, onSelected: handleItemSelected, itemsSelected: selectedItems, onFilterSelected: handleFilterSelected, onChecketAll: setSelectAll, onSelectAll: selectAll, data: groupByDataSource(newDataSource, item.field) }))))); }))),
|
|
122
132
|
React.createElement(TableBody, null, newDataSource &&
|
|
123
133
|
newDataSource.map(function (item, key) { return (React.createElement(TableRowStyled, { key: key, sx: { '&:last-child td, &:last-child th': { border: 0 } } }, Object.keys(item).map(function (columnKey) {
|
|
124
134
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DataGrid/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DataGrid/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAIlE,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf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I,CAAC,EAAtB,CAAsB,GAClD,CACI,CACO,CACb,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -8,6 +8,7 @@ export interface ChatMessageBalloonProps {
|
|
|
8
8
|
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
9
9
|
onRowMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
10
10
|
onRowMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
11
|
+
highlight?: boolean;
|
|
11
12
|
attachments?: string[];
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
className?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.79",
|
|
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,14 +1,34 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Typography } from '@mui/material';
|
|
3
3
|
import { ChatMessageBalloonProps } from '../../interfaces';
|
|
4
4
|
import * as S from './ChatMessageBalloon.style'
|
|
5
5
|
|
|
6
|
+
export const ChatMessageBalloon: React.FC<ChatMessageBalloonProps> = ({
|
|
7
|
+
label,
|
|
8
|
+
description,
|
|
9
|
+
date,
|
|
10
|
+
direction,
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
onMouseEnter,
|
|
14
|
+
onMouseLeave,
|
|
15
|
+
onRowMouseEnter,
|
|
16
|
+
onRowMouseLeave,
|
|
17
|
+
highlight,
|
|
18
|
+
...rest
|
|
19
|
+
}) => {
|
|
20
|
+
|
|
21
|
+
const ballonClassNames = useMemo(() => {
|
|
22
|
+
const classNames = []
|
|
23
|
+
if(!!onMouseEnter) classNames.push('is-interactive')
|
|
24
|
+
if(!!highlight) classNames.push('is-highlight')
|
|
25
|
+
return classNames.join(" ")
|
|
26
|
+
}, [highlight, onMouseEnter])
|
|
6
27
|
|
|
7
|
-
export const ChatMessageBalloon: React.FC<ChatMessageBalloonProps> = ({ label, description, date, direction, children, className, onMouseEnter, onMouseLeave, onRowMouseEnter, onRowMouseLeave, ...rest }) => {
|
|
8
28
|
return (
|
|
9
29
|
<S.ChatMessageBalloonContainerStyle className={className} {...rest}>
|
|
10
30
|
<S.ChatMessageBalloonRowStyle direction={direction} onMouseLeave={onRowMouseLeave} onMouseEnter={onRowMouseEnter}>
|
|
11
|
-
<S.ChatMessageBalloonStyle onMouseLeave={onMouseLeave} onMouseEnter={onMouseEnter} direction={direction} className={
|
|
31
|
+
<S.ChatMessageBalloonStyle onMouseLeave={onMouseLeave} onMouseEnter={onMouseEnter} direction={direction} className={ballonClassNames}>
|
|
12
32
|
<Typography
|
|
13
33
|
variant="subtitle2"
|
|
14
34
|
style={{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Box, Stack, Paper } from '@mui/material';
|
|
4
4
|
|
|
@@ -65,8 +65,12 @@ export function Cog6ToothIcon(props: any) {
|
|
|
65
65
|
|
|
66
66
|
export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [], onRowClick }) => {
|
|
67
67
|
const pageSize = 10;
|
|
68
|
-
const columns =
|
|
69
|
-
|
|
68
|
+
const columns = useMemo(() => {
|
|
69
|
+
return data[0].columns;
|
|
70
|
+
}, [data]);
|
|
71
|
+
const dataSource = useMemo(() => {
|
|
72
|
+
return data[0].dataSource;
|
|
73
|
+
}, [data]);
|
|
70
74
|
|
|
71
75
|
const [selectedItems, setSelectedItems] = useState<(string | number)[]>([]);
|
|
72
76
|
|
|
@@ -77,10 +81,10 @@ export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [], onRowClick })
|
|
|
77
81
|
|
|
78
82
|
const [currentDropDownActive, setCurrentDropDownActive] = useState<string | null>(null);
|
|
79
83
|
|
|
80
|
-
const [originalDataSource, setOriginalDataSource] = useState<DataSourceItem[]>(
|
|
81
|
-
const [newDataSource, setDataSource] = useState<DataSourceItem[]>(
|
|
82
|
-
const [totalRecords, setTotalRecords] = useState(
|
|
83
|
-
const [totalPages, setTotalPages] = useState(
|
|
84
|
+
const [originalDataSource, setOriginalDataSource] = useState<DataSourceItem[]>([]);
|
|
85
|
+
const [newDataSource, setDataSource] = useState<DataSourceItem[]>([]);
|
|
86
|
+
const [totalRecords, setTotalRecords] = useState(0);
|
|
87
|
+
const [totalPages, setTotalPages] = useState(0);
|
|
84
88
|
|
|
85
89
|
const [currentPage, setCurrentPage] = useState(1);
|
|
86
90
|
const startIndex = (currentPage - 1) * pageSize;
|
|
@@ -131,7 +135,7 @@ export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [], onRowClick })
|
|
|
131
135
|
setCurrentPage(1);
|
|
132
136
|
setDataSource(sortedData.slice(startIndex, endIndex));
|
|
133
137
|
} else {
|
|
134
|
-
const sortedData = sortDataSourceByColumn(
|
|
138
|
+
const sortedData = sortDataSourceByColumn(newDataSource, currentActiveSorting, sorting);
|
|
135
139
|
setTotalRecords(sortedData.length);
|
|
136
140
|
setTotalPages(Math.ceil(sortedData.length / pageSize));
|
|
137
141
|
setCurrentPage(1);
|
|
@@ -149,13 +153,20 @@ export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [], onRowClick })
|
|
|
149
153
|
|
|
150
154
|
useEffect(() => {
|
|
151
155
|
if (selectedItems.length <= 0) {
|
|
152
|
-
const sortedData = sortDataSourceByColumn(
|
|
156
|
+
const sortedData = sortDataSourceByColumn(newDataSource, currentActiveSorting, sorting);
|
|
153
157
|
setDataSource(sortedData.slice(startIndex, endIndex));
|
|
154
158
|
setTotalRecords(sortedData.length);
|
|
155
159
|
setTotalPages(Math.ceil(sortedData.length / pageSize));
|
|
156
160
|
setCurrentPage(1);
|
|
157
161
|
}
|
|
158
|
-
}, [selectedItems]);
|
|
162
|
+
}, [selectedItems, dataSource]);
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
setOriginalDataSource(dataSource)
|
|
166
|
+
setDataSource(dataSource)
|
|
167
|
+
setTotalRecords(dataSource.length)
|
|
168
|
+
setTotalPages(Math.ceil(dataSource.length / pageSize))
|
|
169
|
+
}, [dataSource])
|
|
159
170
|
|
|
160
171
|
return (
|
|
161
172
|
<Box sx={{ width: '100%', minHeight: 480 }}>
|
|
@@ -203,7 +214,7 @@ export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [], onRowClick })
|
|
|
203
214
|
onFilterSelected={handleFilterSelected}
|
|
204
215
|
onChecketAll={setSelectAll}
|
|
205
216
|
onSelectAll={selectAll}
|
|
206
|
-
data={groupByDataSource(
|
|
217
|
+
data={groupByDataSource(newDataSource, item.field)}
|
|
207
218
|
/>
|
|
208
219
|
)}
|
|
209
220
|
</Stack>
|
|
@@ -9,6 +9,7 @@ export interface ChatMessageBalloonProps {
|
|
|
9
9
|
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
10
10
|
onRowMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
11
11
|
onRowMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
12
|
+
highlight?: boolean;
|
|
12
13
|
attachments?: string[];
|
|
13
14
|
children?:ReactNode;
|
|
14
15
|
className?:string;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"columns": [
|
|
4
|
+
{
|
|
5
|
+
"allowFiltering": true,
|
|
6
|
+
"allowFiltering": true,
|
|
7
|
+
"allowSorting": true,
|
|
8
|
+
"field": "data",
|
|
9
|
+
"format": "date",
|
|
10
|
+
"headerText": "Data",
|
|
11
|
+
"textAlign": "left",
|
|
12
|
+
"width": "100%"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"allowFiltering": true,
|
|
16
|
+
"allowSorting": true,
|
|
17
|
+
"field": "duration",
|
|
18
|
+
"format": "time",
|
|
19
|
+
"headerText": "Duração",
|
|
20
|
+
"textAlign": "left",
|
|
21
|
+
"width": "100%"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"allowFiltering": true,
|
|
25
|
+
"allowSorting": true,
|
|
26
|
+
"field": "campanha",
|
|
27
|
+
"format": "string",
|
|
28
|
+
"headerText": "Campanha",
|
|
29
|
+
"textAlign": "left",
|
|
30
|
+
"width": "100%"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"allowFiltering": true,
|
|
34
|
+
"allowSorting": true,
|
|
35
|
+
"field": "agente",
|
|
36
|
+
"format": "string",
|
|
37
|
+
"headerText": "Agente",
|
|
38
|
+
"textAlign": "center",
|
|
39
|
+
"width": "100%"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"allowFiltering": true,
|
|
43
|
+
"allowSorting": true,
|
|
44
|
+
"field": "ani",
|
|
45
|
+
"format": "number",
|
|
46
|
+
"headerText": "ANI",
|
|
47
|
+
"textAlign": "left",
|
|
48
|
+
"width": "100%"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"allowFiltering": true,
|
|
52
|
+
"allowSorting": true,
|
|
53
|
+
"field": "dnis",
|
|
54
|
+
"format": "number",
|
|
55
|
+
"headerText": "DNIS",
|
|
56
|
+
"textAlign": "left",
|
|
57
|
+
"width": "100%"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"allowFiltering": true,
|
|
61
|
+
"allowSorting": true,
|
|
62
|
+
"field": "disposition",
|
|
63
|
+
"format": "string",
|
|
64
|
+
"headerText": "Tabulação",
|
|
65
|
+
"textAlign": "left",
|
|
66
|
+
"width": "100%"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"allowFiltering": true,
|
|
70
|
+
"allowSorting": true,
|
|
71
|
+
"field": "origem",
|
|
72
|
+
"format": "number",
|
|
73
|
+
"headerText": "Origem",
|
|
74
|
+
"textAlign": "left",
|
|
75
|
+
"width": "100%"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"allowFiltering": true,
|
|
79
|
+
"allowSorting": true,
|
|
80
|
+
"field": "id",
|
|
81
|
+
"format": "number",
|
|
82
|
+
"headerText": "ID",
|
|
83
|
+
"textAlign": "left",
|
|
84
|
+
"width": "100%"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"dataSource": [
|
|
88
|
+
{
|
|
89
|
+
"data": "01/05/2022",
|
|
90
|
+
"duration": "08:18",
|
|
91
|
+
"campanha": "Campanha 1",
|
|
92
|
+
"agente": 16321,
|
|
93
|
+
"ani": 50364908,
|
|
94
|
+
"dnis": 123456,
|
|
95
|
+
"disposition": "Tabulação 1",
|
|
96
|
+
"origin": 12723,
|
|
97
|
+
"id": 10
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"data": "01/05/2022",
|
|
101
|
+
"duration": "00:18",
|
|
102
|
+
"campanha": "Campanha 2",
|
|
103
|
+
"agente": "16322",
|
|
104
|
+
"ani": "50364909",
|
|
105
|
+
"dnis": "123457",
|
|
106
|
+
"disposition": "Tabulação 2",
|
|
107
|
+
"origin": "12721",
|
|
108
|
+
"id": 20
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"data": "03/05/2022",
|
|
112
|
+
"duration": "03:13",
|
|
113
|
+
"campanha": "Campanha 1",
|
|
114
|
+
"agente": "16321",
|
|
115
|
+
"ani": "50364908",
|
|
116
|
+
"dnis": "123456",
|
|
117
|
+
"disposition": "Tabulação 1",
|
|
118
|
+
"origin": "12723",
|
|
119
|
+
"id": 30
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"data": "01/05/2022",
|
|
123
|
+
"duration": "09:19",
|
|
124
|
+
"campanha": "Campanha 1",
|
|
125
|
+
"agente": "16321",
|
|
126
|
+
"ani": "50364908",
|
|
127
|
+
"dnis": "123456",
|
|
128
|
+
"disposition": "Tabulação 1",
|
|
129
|
+
"origin": "12723",
|
|
130
|
+
"id": 40
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"data": "02/05/2022",
|
|
134
|
+
"duration": "02:59",
|
|
135
|
+
"campanha": "Campanha 1",
|
|
136
|
+
"agente": "16321",
|
|
137
|
+
"ani": "50364908",
|
|
138
|
+
"dnis": "123456",
|
|
139
|
+
"disposition": "Tabulação 1",
|
|
140
|
+
"origin": "12723",
|
|
141
|
+
"id": 50
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"data": "04/05/2022",
|
|
145
|
+
"duration": "05:02",
|
|
146
|
+
"campanha": "Campanha 1",
|
|
147
|
+
"agente": "16321",
|
|
148
|
+
"ani": "50364908",
|
|
149
|
+
"dnis": "123456",
|
|
150
|
+
"disposition": "Tabulação 1",
|
|
151
|
+
"origin": "12723",
|
|
152
|
+
"id": 60
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"data": "21/05/2022",
|
|
156
|
+
"duration": "06:02",
|
|
157
|
+
"campanha": "Campanha 7",
|
|
158
|
+
"agente": "16315",
|
|
159
|
+
"ani": "50364909",
|
|
160
|
+
"dnis": "123456",
|
|
161
|
+
"disposition": "Tabulação 7",
|
|
162
|
+
"origin": "12754",
|
|
163
|
+
"id": 70
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"data": "23/05/2022",
|
|
167
|
+
"duration": "04:04",
|
|
168
|
+
"campanha": "Campanha 8",
|
|
169
|
+
"agente": "16321",
|
|
170
|
+
"ani": "50364908",
|
|
171
|
+
"dnis": "123456",
|
|
172
|
+
"disposition": "Tabulação 8",
|
|
173
|
+
"origin": "12752",
|
|
174
|
+
"id": 80
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
2
|
|
|
3
3
|
import type { Meta } from '@storybook/react';
|
|
4
|
-
import { DataGrid } from '../components';
|
|
4
|
+
import { Button, DataGrid } from '../components';
|
|
5
5
|
import dataSource from '../components/DataGrid/allData.json';
|
|
6
6
|
import data from '../sample-data.json';
|
|
7
|
+
import data2 from '../sample-data-2.json';
|
|
7
8
|
|
|
8
9
|
const meta = {
|
|
9
10
|
title: 'Display/DataGrid',
|
|
@@ -18,9 +19,11 @@ const meta = {
|
|
|
18
19
|
export default meta;
|
|
19
20
|
|
|
20
21
|
export const DataGridBasic = () => {
|
|
22
|
+
const [currentMock, setCurrentMock] = useState(0)
|
|
21
23
|
return (
|
|
22
24
|
<>
|
|
23
|
-
<
|
|
25
|
+
{/* <Button label='change mock' onClick={() => { currentMock === 0 ? setCurrentMock(1) : setCurrentMock(0) }}/> */}
|
|
26
|
+
<DataGrid data={!!currentMock ? data : data2} onRowClick={() => console.log("onRowClick")} />
|
|
24
27
|
</>
|
|
25
28
|
);
|
|
26
29
|
};
|