wca-designsystem 0.0.67 → 0.0.69
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/organismos/Tabela/Tabela.stories.tsx +4 -3
- package/src/components/organismos/Tabela/body.tsx +20 -17
- package/src/components/organismos/Tabela/header.tsx +3 -1
- package/src/components/organismos/Tabela/pagination.tsx +3 -1
- package/src/components/organismos/Tabela/styles.ts +10 -5
package/package.json
CHANGED
|
@@ -46,8 +46,8 @@ const generateData = () => {
|
|
|
46
46
|
const data = generateData();
|
|
47
47
|
const columns: any = [
|
|
48
48
|
{
|
|
49
|
-
key: '
|
|
50
|
-
header: '
|
|
49
|
+
key: 'select',
|
|
50
|
+
header: 'select',
|
|
51
51
|
},
|
|
52
52
|
{ key: 'id', header: 'ID' },
|
|
53
53
|
{ key: 'name', header: 'Nome' },
|
|
@@ -66,7 +66,8 @@ export const TabelaProps = Template.bind({});
|
|
|
66
66
|
|
|
67
67
|
TabelaProps.args = {
|
|
68
68
|
data: data,
|
|
69
|
-
hasExpand:
|
|
69
|
+
hasExpand: false,
|
|
70
|
+
hasSelect: true,
|
|
70
71
|
acoesChildren: (row: any): JSX.Element => (
|
|
71
72
|
<>
|
|
72
73
|
<Botao onClick={() => console.log(row)} tipo={'table'} children={'▶'} />
|
|
@@ -31,7 +31,6 @@ function BodyTable<T extends { id: string | number; children?: Array<T> }>(
|
|
|
31
31
|
acoesChildren,
|
|
32
32
|
hasSelect,
|
|
33
33
|
rowSelection,
|
|
34
|
-
|
|
35
34
|
hasMoreData,
|
|
36
35
|
hasInfinitScrool,
|
|
37
36
|
setRowSelection,
|
|
@@ -86,22 +85,6 @@ function BodyTable<T extends { id: string | number; children?: Array<T> }>(
|
|
|
86
85
|
|
|
87
86
|
return [
|
|
88
87
|
<tr key={`row-${item.id}`}>
|
|
89
|
-
{hasSelect && (
|
|
90
|
-
<td className="select">
|
|
91
|
-
<Checkbox
|
|
92
|
-
size="md"
|
|
93
|
-
color={color}
|
|
94
|
-
type="checkbox"
|
|
95
|
-
checked={rowSelection?.some(selected => selected.id === item.id)}
|
|
96
|
-
onChange={() => {
|
|
97
|
-
handleRowSelect(
|
|
98
|
-
item,
|
|
99
|
-
rowSelection!.some(selected => selected.id === item.id)
|
|
100
|
-
);
|
|
101
|
-
}}
|
|
102
|
-
/>
|
|
103
|
-
</td>
|
|
104
|
-
)}
|
|
105
88
|
{columns.map((column, colIndex) => {
|
|
106
89
|
if (column.key === 'expand') {
|
|
107
90
|
return (
|
|
@@ -133,6 +116,26 @@ function BodyTable<T extends { id: string | number; children?: Array<T> }>(
|
|
|
133
116
|
);
|
|
134
117
|
}
|
|
135
118
|
|
|
119
|
+
if (column.key === 'select') {
|
|
120
|
+
return (
|
|
121
|
+
<td className="select" key={`select-${colIndex}`}>
|
|
122
|
+
<Checkbox
|
|
123
|
+
size="md"
|
|
124
|
+
color={color}
|
|
125
|
+
type="checkbox"
|
|
126
|
+
checked={rowSelection?.some(
|
|
127
|
+
selected => selected.id === item.id
|
|
128
|
+
)}
|
|
129
|
+
onChange={() => {
|
|
130
|
+
handleRowSelect(
|
|
131
|
+
item,
|
|
132
|
+
rowSelection!.some(selected => selected.id === item.id)
|
|
133
|
+
);
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
</td>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
136
139
|
if (column.key === 'acoes' && acoesChildren) {
|
|
137
140
|
return (
|
|
138
141
|
<td key={`acoes-${colIndex}`} className="acoes">
|
|
@@ -82,8 +82,10 @@ const HeaderTabela = <T,>({
|
|
|
82
82
|
{hasExpand && <></>}
|
|
83
83
|
{hasSelect && <></>}
|
|
84
84
|
{columns.map((header, index) => {
|
|
85
|
-
if (header.key === 'expand'
|
|
85
|
+
if (header.key === 'expand')
|
|
86
86
|
return <th key={index} className="expand"></th>;
|
|
87
|
+
if (header.key === 'select')
|
|
88
|
+
return <th key={index} className="select"></th>;
|
|
87
89
|
if (header.key !== 'acoes') {
|
|
88
90
|
return (
|
|
89
91
|
<th
|
|
@@ -12,6 +12,7 @@ export type PaginacaoProps = {
|
|
|
12
12
|
tamanhoPaginacao?: number;
|
|
13
13
|
color?: string;
|
|
14
14
|
quantidadeRegistros?: number;
|
|
15
|
+
qtdRegistrosPagina?: number;
|
|
15
16
|
setPagination: React.Dispatch<React.SetStateAction<PaginationProps>>;
|
|
16
17
|
tabelaPaginacao: {
|
|
17
18
|
pageIndex: number;
|
|
@@ -25,6 +26,7 @@ const Paginacao = ({
|
|
|
25
26
|
tamanhoPaginacao,
|
|
26
27
|
setPagination,
|
|
27
28
|
quantidadeRegistros,
|
|
29
|
+
qtdRegistrosPagina,
|
|
28
30
|
}: PaginacaoProps) => {
|
|
29
31
|
function nextPage() {
|
|
30
32
|
if (tabelaPaginacao.pageIndex + 1 > tabelaPaginacao.pageSize) {
|
|
@@ -64,7 +66,7 @@ const Paginacao = ({
|
|
|
64
66
|
<S.PaginacaoWrapper color={color}>
|
|
65
67
|
<div className="pagination-header">
|
|
66
68
|
<p>
|
|
67
|
-
Exibindo {
|
|
69
|
+
Exibindo {qtdRegistrosPagina} de {quantidadeRegistros}
|
|
68
70
|
</p>
|
|
69
71
|
<div className="select-wrapper">
|
|
70
72
|
<SelectCustomizado
|
|
@@ -101,14 +101,19 @@ export const TabelaHeader = styled.thead<ColorsProp>`
|
|
|
101
101
|
|
|
102
102
|
export const TabelaBody = styled.tbody<ColorsProp>`
|
|
103
103
|
${({ theme, color }) => css`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
overflow-x: auto;
|
|
105
|
+
overflow-y: auto; /* Habilita o scroll vertical */
|
|
106
|
+
max-height: 500px;
|
|
107
107
|
|
|
108
108
|
.select {
|
|
109
109
|
background-color: ${color};
|
|
110
|
-
position:
|
|
111
|
-
|
|
110
|
+
position: relative;
|
|
111
|
+
width: 50px;
|
|
112
|
+
min-height: 53px;
|
|
113
|
+
background-color: ${color};
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
.expand {
|