contentoh-components-library 21.3.54 → 21.3.55
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/.env.development +0 -2
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- package/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/Status/styles.js +1 -1
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +23 -18
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/organisms/Chat/Chat.stories.js +1 -21
- package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +3 -48
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +0 -27
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/GlobalModal/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +50 -31
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +81 -198
- package/dist/components/pages/ProviderProductEdition/index.js +429 -725
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +139 -86
- package/dist/components/pages/RetailerProductEdition/index.js +279 -268
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- package/dist/index.js +0 -13
- package/package.json +6 -7
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +0 -4
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +22 -18
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +4 -3
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/organisms/Chat/Chat.stories.js +0 -21
- package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
- package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
- package/src/components/organisms/Chat/ContentChat/index.js +6 -81
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +3 -47
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -18
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/GlobalModal/styles.js +0 -10
- package/src/components/organisms/OrderDetail/index.js +0 -1
- package/src/components/organisms/OrderDetail/styles.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +1 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +55 -31
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +88 -214
- package/src/components/pages/ProviderProductEdition/index.js +160 -323
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +146 -89
- package/src/components/pages/RetailerProductEdition/index.js +138 -112
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
- package/src/index.js +0 -1
- package/src/components/organisms/TableResizable/TableResizable.stories.js +0 -17
- package/src/components/organisms/TableResizable/index.js +0 -119
- package/src/components/organisms/TableResizable/styles.js +0 -133
- package/src/components/organisms/TableResizable/utils.js +0 -46
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { fetchPOST } from "../../../global-files/handle_http";
|
|
3
2
|
|
|
4
3
|
export const getAuditVersion = async (articleId, setState, token) => {
|
|
5
4
|
const auditResponse = await axios.get(
|
|
@@ -33,39 +32,3 @@ export const getInputsData = (
|
|
|
33
32
|
setDescriptionState(descriptions);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
export const translateService = (tab) => {
|
|
38
|
-
switch (tab) {
|
|
39
|
-
case "description":
|
|
40
|
-
case "Descripción":
|
|
41
|
-
return "Descripciones";
|
|
42
|
-
case "datasheet":
|
|
43
|
-
case "Ficha técnica":
|
|
44
|
-
return "Fichas técnicas";
|
|
45
|
-
case "images":
|
|
46
|
-
case "Imágenes":
|
|
47
|
-
return "Imágenes";
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const createMessage = (
|
|
52
|
-
retailers,
|
|
53
|
-
idRetailer,
|
|
54
|
-
oldStatus,
|
|
55
|
-
newStatus,
|
|
56
|
-
service
|
|
57
|
-
) => {
|
|
58
|
-
const [retailer] = retailers?.filter((ret) => ret.id === idRetailer) || [];
|
|
59
|
-
return `${translateService(service)} de ${
|
|
60
|
-
retailer.name
|
|
61
|
-
} |${oldStatus}| a |${newStatus}`;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const sendMessage = async (data) => {
|
|
65
|
-
const { paramsBody, paramsHeader } = data;
|
|
66
|
-
return fetchPOST(
|
|
67
|
-
process.env.REACT_APP_CREATE_MESSAGES,
|
|
68
|
-
paramsBody,
|
|
69
|
-
paramsHeader
|
|
70
|
-
);
|
|
71
|
-
};
|
package/src/index.js
CHANGED
|
@@ -78,7 +78,6 @@ export * from "./components/organisms/Chat/index";
|
|
|
78
78
|
export * from "./components/organisms/Modal/index";
|
|
79
79
|
export * from "./components/organisms/OrderDetail/index";
|
|
80
80
|
export * from "./components/organisms/RangeCalendar";
|
|
81
|
-
export * from "./components/organisms/TableResizable";
|
|
82
81
|
|
|
83
82
|
//pages
|
|
84
83
|
export * from "./components/pages/ChangePasswordLogin";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TableResizable } from ".";
|
|
2
|
-
import { data } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/organisms/TableResizable",
|
|
6
|
-
component: TableResizable,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const Template = (args) => <TableResizable {...args} />;
|
|
10
|
-
|
|
11
|
-
export const DefaultTableResizable = Template.bind({});
|
|
12
|
-
DefaultTableResizable.args = {
|
|
13
|
-
headers: ["Col 1", "Col 2", "Col 3", "Col 4", "Col 5"],
|
|
14
|
-
tableContent: data,
|
|
15
|
-
minCellWidth: 120,
|
|
16
|
-
withResetSizeButton: true,
|
|
17
|
-
};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import React, { useState, useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import { RestartAlt } from "@mui/icons-material";
|
|
3
|
-
import { Container } from "./styles.js";
|
|
4
|
-
|
|
5
|
-
const createHeaders = (headers) => {
|
|
6
|
-
return headers.map((item) => ({
|
|
7
|
-
text: item,
|
|
8
|
-
ref: useRef(),
|
|
9
|
-
}));
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Read the blog post here:
|
|
14
|
-
* https://letsbuildui.dev/articles/resizable-tables-with-react-and-css-grid
|
|
15
|
-
*/
|
|
16
|
-
export const TableResizable = (props) => {
|
|
17
|
-
const {
|
|
18
|
-
gridTemplateColumns,
|
|
19
|
-
headers,
|
|
20
|
-
minCellWidth,
|
|
21
|
-
tableContent,
|
|
22
|
-
withResetSizeButton,
|
|
23
|
-
} = props;
|
|
24
|
-
// const [tableHeight, setTableHeight] = useState("auto");
|
|
25
|
-
const [activeIndex, setActiveIndex] = useState(null);
|
|
26
|
-
const tableElement = useRef(null);
|
|
27
|
-
const columns = createHeaders(headers);
|
|
28
|
-
|
|
29
|
-
// useEffect(() => {
|
|
30
|
-
// setTableHeight(tableElement.current.offsetHeight);
|
|
31
|
-
// }, []);
|
|
32
|
-
|
|
33
|
-
const mouseDown = (index) => setActiveIndex(index);
|
|
34
|
-
|
|
35
|
-
const mouseMove = useCallback(
|
|
36
|
-
(e) => {
|
|
37
|
-
const gridColumns = columns.map((col, i) => {
|
|
38
|
-
if (i === activeIndex) {
|
|
39
|
-
const width = e.clientX - col.ref.current.offsetLeft;
|
|
40
|
-
if (width >= minCellWidth) return `${width}px`;
|
|
41
|
-
}
|
|
42
|
-
return `${col.ref.current.offsetWidth}px`;
|
|
43
|
-
});
|
|
44
|
-
const gridTemplateColumns = `${gridColumns.join(" ")}`;
|
|
45
|
-
tableElement.current.style.gridTemplateColumns = gridTemplateColumns;
|
|
46
|
-
},
|
|
47
|
-
[activeIndex, columns, minCellWidth]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const removeListeners = useCallback(() => {
|
|
51
|
-
window.removeEventListener("mousemove", mouseMove);
|
|
52
|
-
window.removeEventListener("mouseup", removeListeners);
|
|
53
|
-
}, [mouseMove]);
|
|
54
|
-
|
|
55
|
-
const mouseUp = useCallback(() => {
|
|
56
|
-
setActiveIndex(null);
|
|
57
|
-
removeListeners();
|
|
58
|
-
}, [setActiveIndex, removeListeners]);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (activeIndex > -1) {
|
|
62
|
-
window.addEventListener("mousemove", mouseMove);
|
|
63
|
-
window.addEventListener("mouseup", mouseUp);
|
|
64
|
-
}
|
|
65
|
-
return () => removeListeners();
|
|
66
|
-
}, [activeIndex, mouseMove, mouseUp, removeListeners]);
|
|
67
|
-
|
|
68
|
-
const resetTableCells = () => {
|
|
69
|
-
tableElement.current.style.gridTemplateColumns = "";
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<Container
|
|
74
|
-
gridTemplateColumns={gridTemplateColumns}
|
|
75
|
-
totalColumns={columns?.length}
|
|
76
|
-
totalRows={tableContent?.length}
|
|
77
|
-
>
|
|
78
|
-
{withResetSizeButton ? (
|
|
79
|
-
<button className="reset-button" onClick={resetTableCells}>
|
|
80
|
-
<RestartAlt sx={{ fontSize: 18 }} />
|
|
81
|
-
</button>
|
|
82
|
-
) : null}
|
|
83
|
-
<div className="table-wrapper">
|
|
84
|
-
<table className="resizeable-table" ref={tableElement}>
|
|
85
|
-
<thead>
|
|
86
|
-
<tr>
|
|
87
|
-
{columns?.map(({ ref, text }, i) => (
|
|
88
|
-
<th ref={ref} key={i}>
|
|
89
|
-
<span>{text}</span>
|
|
90
|
-
<div
|
|
91
|
-
style={{ height: "50px" /* tableHeight */ }}
|
|
92
|
-
onMouseDown={() => mouseDown(i)}
|
|
93
|
-
className={`resize-handle ${
|
|
94
|
-
activeIndex === i ? "active" : "idle"
|
|
95
|
-
}`}
|
|
96
|
-
/>
|
|
97
|
-
</th>
|
|
98
|
-
))}
|
|
99
|
-
</tr>
|
|
100
|
-
</thead>
|
|
101
|
-
<tbody>
|
|
102
|
-
{tableContent.map((row) => (
|
|
103
|
-
<tr key={row.key}>
|
|
104
|
-
{row?.columns?.map((column, indexColumn) => (
|
|
105
|
-
<td
|
|
106
|
-
className={typeof column === "object" ? "noOverflow" : ""}
|
|
107
|
-
key={`${row.key}-${indexColumn}`}
|
|
108
|
-
>
|
|
109
|
-
<span>{column}</span>
|
|
110
|
-
</td>
|
|
111
|
-
))}
|
|
112
|
-
</tr>
|
|
113
|
-
))}
|
|
114
|
-
</tbody>
|
|
115
|
-
</table>
|
|
116
|
-
</div>
|
|
117
|
-
</Container>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
const defaultTemplateColumns = (totalColumns) =>
|
|
4
|
-
`minmax(100px, 1fr) `.repeat(totalColumns);
|
|
5
|
-
|
|
6
|
-
export const Container = styled.div`
|
|
7
|
-
position: absolute;
|
|
8
|
-
overflow: hidden; /* Clips any scrollbars that appear */
|
|
9
|
-
font-family: Avenir Next;
|
|
10
|
-
font-size: 13px;
|
|
11
|
-
width: 90%;
|
|
12
|
-
|
|
13
|
-
.reset-button {
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
border-radius: 50%;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
padding: 3px;
|
|
20
|
-
border: 0;
|
|
21
|
-
background: #f5f5f5;
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 5px;
|
|
24
|
-
left: 5px;
|
|
25
|
-
margin: 0;
|
|
26
|
-
z-index: 10;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.table-wrapper {
|
|
30
|
-
border-radius: 6px;
|
|
31
|
-
background: #fff;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
table {
|
|
35
|
-
width: 100%;
|
|
36
|
-
height: calc(100vh - 250px);
|
|
37
|
-
overflow: auto; /* Allow scrolling within the table */
|
|
38
|
-
display: grid;
|
|
39
|
-
grid-template-columns: ${(props) =>
|
|
40
|
-
props.gridTemplateColumns ?? defaultTemplateColumns(props.totalColumns)};
|
|
41
|
-
grid-template-rows: ${(props) => `repeat(${props.totalRows + 2}, 50px)`};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
table th {
|
|
45
|
-
font-size: 15px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
table th,
|
|
49
|
-
table td {
|
|
50
|
-
text-align: left;
|
|
51
|
-
padding: 5px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
table th span,
|
|
55
|
-
table td span {
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
text-overflow: ellipsis;
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
display: block;
|
|
60
|
-
border-right: 1px solid #ccc;
|
|
61
|
-
text-align: center;
|
|
62
|
-
height: 100%;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
table th:last-child span,
|
|
66
|
-
table td:last-child span {
|
|
67
|
-
border-right: 0px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
table tr td {
|
|
71
|
-
border-bottom: 1px solid #ccc;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
table tr th {
|
|
75
|
-
border-bottom: 1px solid #ccc;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
table thead,
|
|
79
|
-
table tbody,
|
|
80
|
-
table tr {
|
|
81
|
-
display: contents;
|
|
82
|
-
background: red;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
table thead {
|
|
86
|
-
-webkit-user-select: none; /* Safari */
|
|
87
|
-
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
88
|
-
user-select: none; /* Standard syntax */
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
th {
|
|
92
|
-
position: sticky;
|
|
93
|
-
top: 0;
|
|
94
|
-
background-color: #fff;
|
|
95
|
-
line-height: 40px;
|
|
96
|
-
z-index: 8;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
td {
|
|
100
|
-
line-height: 40px;
|
|
101
|
-
height: 50px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.resize-handle {
|
|
105
|
-
display: block;
|
|
106
|
-
position: absolute;
|
|
107
|
-
cursor: col-resize;
|
|
108
|
-
width: 8px;
|
|
109
|
-
right: 0;
|
|
110
|
-
top: 0;
|
|
111
|
-
z-index: 1;
|
|
112
|
-
border-right: 1px solid transparent;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.resize-handle:hover {
|
|
116
|
-
border-color: #ccc;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.resize-handle.active {
|
|
120
|
-
border-color: #517ea5;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.resizeable-table {
|
|
124
|
-
width: 100%;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.noOverflow {
|
|
128
|
-
overflow: inherit;
|
|
129
|
-
span {
|
|
130
|
-
overflow: inherit;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const data = [
|
|
2
|
-
{
|
|
3
|
-
key: 1,
|
|
4
|
-
object: {},
|
|
5
|
-
columns: [
|
|
6
|
-
"Large Detroit Style Pizza",
|
|
7
|
-
3213456785,
|
|
8
|
-
"$31.43",
|
|
9
|
-
"Pending",
|
|
10
|
-
"Dave",
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
key: 2,
|
|
15
|
-
object: {},
|
|
16
|
-
columns: [
|
|
17
|
-
"Large Detroit Style Pizza",
|
|
18
|
-
3213456785,
|
|
19
|
-
"$31.43",
|
|
20
|
-
"Pending",
|
|
21
|
-
"Dave",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
key: 3,
|
|
26
|
-
object: {},
|
|
27
|
-
columns: [
|
|
28
|
-
"Large Detroit Style Pizza",
|
|
29
|
-
3213456785,
|
|
30
|
-
"$31.43",
|
|
31
|
-
"Pending",
|
|
32
|
-
"Dave",
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
key: 4,
|
|
37
|
-
object: {},
|
|
38
|
-
columns: [
|
|
39
|
-
"Large Detroit Style Pizza",
|
|
40
|
-
3213456785,
|
|
41
|
-
"$31.43",
|
|
42
|
-
"Pending",
|
|
43
|
-
"Dave",
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
];
|