wca-designsystem 1.0.62 → 1.0.63
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/package.json +1 -1
- package/src/components/molecules/CardInicial/index.tsx +3 -2
- package/src/components/molecules/CardInicial/styles.ts +24 -29
- package/src/components/molecules/TabelaHeader/styles.ts +1 -0
- package/src/components/organismos/Tabela/index.tsx +61 -40
- package/src/components/organismos/Tabela/styles.ts +34 -24
package/package.json
CHANGED
|
@@ -32,6 +32,7 @@ const CardInicial = ({
|
|
|
32
32
|
avisoInfo,
|
|
33
33
|
aviso = false,
|
|
34
34
|
}: CardInicialProps) => {
|
|
35
|
+
|
|
35
36
|
return (
|
|
36
37
|
<S.CardInicialWrapper >
|
|
37
38
|
<S.CardInicialHeader
|
|
@@ -41,8 +42,8 @@ const CardInicial = ({
|
|
|
41
42
|
}}
|
|
42
43
|
>
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
{/* <Icone width={45} height={45} svg={icone} fill={theme.colors.white} /> */}
|
|
46
|
+
<Icone svg={icone} fill={theme.colors.white} className="icone" />
|
|
46
47
|
|
|
47
48
|
</S.CardInicialHeader>
|
|
48
49
|
|
|
@@ -3,19 +3,20 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
export const CardInicialWrapper = styled.div`
|
|
4
4
|
${({ theme }) => css`
|
|
5
5
|
position: relative;
|
|
6
|
-
width:
|
|
7
|
-
|
|
6
|
+
width: 250px;
|
|
7
|
+
height: 100%;
|
|
8
8
|
height: 230px;
|
|
9
9
|
border-radius: 8px;
|
|
10
10
|
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
11
11
|
background-color: ${theme.colors.white};
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
12
14
|
`}
|
|
13
15
|
`;
|
|
14
16
|
|
|
15
17
|
export const CardInicialHeader = styled.div`
|
|
16
18
|
${() => css`
|
|
17
|
-
width:
|
|
18
|
-
max-width: 320px;
|
|
19
|
+
width: 100%;
|
|
19
20
|
padding: 10px 0;
|
|
20
21
|
border-radius: 8px 8px 0 0;
|
|
21
22
|
display: flex;
|
|
@@ -23,29 +24,24 @@ export const CardInicialHeader = styled.div`
|
|
|
23
24
|
justify-content: center;
|
|
24
25
|
|
|
25
26
|
.icone {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
min-width: 40px;
|
|
28
|
+
min-height: 40px;
|
|
29
|
+
max-width: 80px;
|
|
30
|
+
max-height: 80px;
|
|
31
|
+
object-fit: contain;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
33
|
`}
|
|
34
|
-
|
|
35
34
|
`;
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
36
|
export const CardInicialBody = styled.div`
|
|
40
37
|
${({ theme }) => css`
|
|
41
|
-
|
|
38
|
+
padding: 10px 12px;
|
|
42
39
|
display: flex;
|
|
43
40
|
flex-direction: column;
|
|
41
|
+
flex-grow: 1;
|
|
44
42
|
gap: 8px;
|
|
45
43
|
text-align: center;
|
|
46
|
-
|
|
47
|
-
padding: 0 12px;
|
|
48
|
-
|
|
44
|
+
|
|
49
45
|
h2 {
|
|
50
46
|
font-size: ${theme.sizes.large};
|
|
51
47
|
font-weight: 700;
|
|
@@ -57,6 +53,12 @@ export const CardInicialBody = styled.div`
|
|
|
57
53
|
font-weight: 300;
|
|
58
54
|
color: ${theme.colors.blackSti};
|
|
59
55
|
margin: 0;
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
display: -webkit-box;
|
|
60
|
+
-webkit-line-clamp: 3;
|
|
61
|
+
-webkit-box-orient: vertical;
|
|
60
62
|
}
|
|
61
63
|
`}
|
|
62
64
|
`;
|
|
@@ -64,9 +66,8 @@ export const CardInicialBody = styled.div`
|
|
|
64
66
|
export const CardInicialFooter = styled.div`
|
|
65
67
|
${({ theme }) => css`
|
|
66
68
|
text-align: center;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
margin-top: 28px;
|
|
69
|
+
padding: 12px 0;
|
|
70
|
+
margin-top: auto;
|
|
70
71
|
|
|
71
72
|
button {
|
|
72
73
|
width: 160px;
|
|
@@ -76,23 +77,17 @@ export const CardInicialFooter = styled.div`
|
|
|
76
77
|
|
|
77
78
|
export const CardInicialWarning = styled.div`
|
|
78
79
|
${() => css`
|
|
79
|
-
position: absolute;
|
|
80
|
-
bottom: 0;
|
|
81
|
-
left: 0;
|
|
82
80
|
width: 100%;
|
|
83
81
|
display: flex;
|
|
84
82
|
flex-direction: column;
|
|
85
83
|
align-items: center;
|
|
86
84
|
justify-content: center;
|
|
87
|
-
padding: 0px;
|
|
88
|
-
margin-top: auto;
|
|
89
85
|
padding: 4px 0;
|
|
90
86
|
|
|
91
|
-
.iconeAviso{
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
.iconeAviso {
|
|
88
|
+
width: 10px;
|
|
89
|
+
height: 10px;
|
|
94
90
|
}
|
|
95
|
-
|
|
96
91
|
`}
|
|
97
92
|
`;
|
|
98
93
|
|
|
@@ -110,8 +110,10 @@ const Tabela = <
|
|
|
110
110
|
setSelectAllChecked,
|
|
111
111
|
tdMinWidth = '260px',
|
|
112
112
|
}: CustomTableProps<T>) => {
|
|
113
|
-
|
|
114
|
-
const
|
|
113
|
+
|
|
114
|
+
const dualScrollWrapperRef = useRef<HTMLDivElement>(null);
|
|
115
|
+
const topScrollRef = useRef<HTMLDivElement>(null);
|
|
116
|
+
const tableRef = useRef<HTMLDivElement>(null);
|
|
115
117
|
|
|
116
118
|
const [toogleFiltros, setToogleFiltros] = useState(false)
|
|
117
119
|
const [formatedColumns, setFormatedColumns] = useState(
|
|
@@ -125,37 +127,50 @@ const Tabela = <
|
|
|
125
127
|
(column) => column.active === true
|
|
126
128
|
)
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
const table = tableRef.current;
|
|
132
|
+
const topScroll = topScrollRef.current;
|
|
133
|
+
const dualWrapper = dualScrollWrapperRef.current;
|
|
134
|
+
|
|
135
|
+
if (!table || !topScroll || !dualWrapper) return;
|
|
136
|
+
|
|
137
|
+
const checkScrollNeeded = () => {
|
|
138
|
+
const needsScroll = table.scrollWidth > table.clientWidth;
|
|
139
|
+
dualWrapper.classList.toggle('has-scroll', needsScroll);
|
|
140
|
+
topScroll.style.display = needsScroll ? 'block' : 'none';
|
|
141
|
+
|
|
142
|
+
if (table.firstChild && table.firstChild instanceof HTMLElement) {
|
|
143
|
+
const tableWidth = table.firstChild.scrollWidth;
|
|
144
|
+
topScroll.style.setProperty('--table-width', `${tableWidth}px`);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
132
147
|
|
|
133
|
-
|
|
148
|
+
const syncScroll = (source: HTMLElement, target: HTMLElement) => {
|
|
149
|
+
if (source.scrollLeft !== target.scrollLeft) {
|
|
150
|
+
target.scrollLeft = source.scrollLeft;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
134
153
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// target.scrollLeft = source.scrollLeft
|
|
138
|
-
// }
|
|
139
|
-
// }
|
|
154
|
+
const handleTableScroll = () => syncScroll(table, topScroll);
|
|
155
|
+
const handleTopScroll = () => syncScroll(topScroll, table);
|
|
140
156
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
const resizeObserver = new ResizeObserver(checkScrollNeeded);
|
|
158
|
+
resizeObserver.observe(table);
|
|
159
|
+
if (table.firstChild) {
|
|
160
|
+
resizeObserver.observe(table.firstChild as HTMLElement);
|
|
161
|
+
}
|
|
145
162
|
|
|
146
|
-
|
|
147
|
-
// topScroll.addEventListener('scroll', handleTopScroll)
|
|
163
|
+
checkScrollNeeded();
|
|
148
164
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// topScroll.style.setProperty('--table-width', `${tableWidth}px`)
|
|
152
|
-
// }
|
|
165
|
+
table.addEventListener('scroll', handleTableScroll);
|
|
166
|
+
topScroll.addEventListener('scroll', handleTopScroll);
|
|
153
167
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
return () => {
|
|
169
|
+
resizeObserver.disconnect();
|
|
170
|
+
table.removeEventListener('scroll', handleTableScroll);
|
|
171
|
+
topScroll.removeEventListener('scroll', handleTopScroll);
|
|
172
|
+
};
|
|
173
|
+
}, [data]);
|
|
159
174
|
|
|
160
175
|
return (
|
|
161
176
|
<S.TableWrapper>
|
|
@@ -175,9 +190,12 @@ const Tabela = <
|
|
|
175
190
|
setOrdenarPor={setOrdenarPor}
|
|
176
191
|
/>
|
|
177
192
|
|
|
178
|
-
|
|
179
|
-
<S.TopScroll
|
|
180
|
-
|
|
193
|
+
<S.DualScrollWrapper ref={dualScrollWrapperRef}>
|
|
194
|
+
<S.TopScroll
|
|
195
|
+
ref={topScrollRef}
|
|
196
|
+
id="table-top-scroll"
|
|
197
|
+
/>
|
|
198
|
+
</S.DualScrollWrapper>
|
|
181
199
|
|
|
182
200
|
<S.TableContainer ref={tableRef} id="table-container">
|
|
183
201
|
<S.StyledTable>
|
|
@@ -245,16 +263,19 @@ const Tabela = <
|
|
|
245
263
|
</S.StyledTable>
|
|
246
264
|
</S.TableContainer>
|
|
247
265
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
266
|
+
<S.ContentWrapper>
|
|
267
|
+
{data.length > 0 && !hasInfinitScrool && (
|
|
268
|
+
<Paginacao
|
|
269
|
+
color={color}
|
|
270
|
+
setPagination={setPagination}
|
|
271
|
+
tabelaPaginacao={tabelaPaginacao}
|
|
272
|
+
quantidadeRegistros={quantidadeRegistros}
|
|
273
|
+
tamanhoPaginacao={tamanhoPaginacao}
|
|
274
|
+
qtdRegistrosPagina={qtdRegistrosPagina}
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
277
|
+
</S.ContentWrapper>
|
|
278
|
+
|
|
258
279
|
</S.TableWrapper>
|
|
259
280
|
)
|
|
260
281
|
}
|
|
@@ -13,50 +13,60 @@ export const TableWrapper = styled.div`
|
|
|
13
13
|
overflow-x: hidden;
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
|
-
gap:
|
|
16
|
+
/* gap: 10px; */
|
|
17
17
|
`}
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
20
|
export const DualScrollWrapper = styled.div`
|
|
21
|
+
overflow-x: hidden;
|
|
22
|
+
overflow-y: hidden;
|
|
23
|
+
height: 0px;
|
|
21
24
|
max-width: 1500px;
|
|
22
25
|
width: 100%;
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
transition: height 0.2s ease;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
&.has-scroll {
|
|
30
|
+
height: 20px;
|
|
31
|
+
overflow-x: auto;
|
|
32
|
+
padding-bottom: 6px;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const ContentWrapper = styled.div`
|
|
37
|
+
margin-top:1rem;
|
|
25
38
|
`;
|
|
26
39
|
|
|
27
40
|
export const TopScroll = styled.div`
|
|
41
|
+
display: none;
|
|
28
42
|
overflow-x: auto;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
max-width: 1500px;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: auto;
|
|
46
|
+
background: transparent;
|
|
33
47
|
|
|
34
|
-
scrollbar-width:
|
|
35
|
-
scrollbar-color:rgb(160, 160, 160) #f1f1f1;
|
|
48
|
+
scrollbar-width: auto;
|
|
49
|
+
scrollbar-color: rgb(160, 160, 160) #f1f1f1;
|
|
50
|
+
|
|
51
|
+
&::after {
|
|
52
|
+
content: '';
|
|
53
|
+
display: block;
|
|
54
|
+
width: var(--table-width, 100%);
|
|
55
|
+
height: 1px;
|
|
56
|
+
}
|
|
36
57
|
|
|
37
58
|
&::-webkit-scrollbar {
|
|
38
|
-
height:
|
|
39
|
-
display: none;
|
|
59
|
+
height: 18px;
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
&::-webkit-scrollbar-track {
|
|
43
63
|
background: #f1f1f1;
|
|
44
|
-
border-radius:
|
|
64
|
+
border-radius: 6px;
|
|
45
65
|
}
|
|
46
66
|
|
|
47
67
|
&::-webkit-scrollbar-thumb {
|
|
48
|
-
background:
|
|
49
|
-
border-radius:
|
|
50
|
-
&:hover {
|
|
51
|
-
background: #555;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&::after {
|
|
56
|
-
content: '';
|
|
57
|
-
display: block;
|
|
58
|
-
width: var(--table-width, 100%);
|
|
59
|
-
height: 1px;
|
|
68
|
+
background-color: rgb(160, 160, 160);
|
|
69
|
+
border-radius: 6px;
|
|
60
70
|
}
|
|
61
71
|
`;
|
|
62
72
|
|