wca-designsystem 1.0.66 → 1.0.67

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.66",
2
+ "version": "1.0.67",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -10,6 +10,7 @@ import UsuarioNotifications, {
10
10
 
11
11
  export interface CabecalhoProps {
12
12
  notificacoes: NotificationsProps
13
+ removeTooltip?: boolean;
13
14
  temNotificacoes?: boolean
14
15
  color?: string
15
16
  icone: string
@@ -20,6 +21,7 @@ export interface CabecalhoProps {
20
21
 
21
22
  const Cabecalho = ({
22
23
  notificacoes,
24
+ removeTooltip,
23
25
  temNotificacoes,
24
26
  icone,
25
27
  info,
@@ -38,14 +40,19 @@ const Cabecalho = ({
38
40
  <p>{subTitulo}</p>
39
41
  </div>
40
42
 
41
- <HoverPopUp texto={info} className="ajuda-wrapper">
42
- <Icone
43
- width={16}
44
- height={16}
45
- fill={theme.colors.gray['700']}
46
- svg={ajuda}
47
- />
48
- </HoverPopUp>
43
+ {
44
+ !removeTooltip && (
45
+ <HoverPopUp texto={info} className="ajuda-wrapper">
46
+ <Icone
47
+ width={16}
48
+ height={16}
49
+ fill={theme.colors.gray['700']}
50
+ svg={ajuda}
51
+ />
52
+ </HoverPopUp>
53
+ )
54
+ }
55
+
49
56
  </S.CabecalhoInfoWrapper>
50
57
 
51
58
  {temNotificacoes && <UsuarioNotifications notificacoes={notificacoes} />}
@@ -9,6 +9,7 @@ import { theme } from '../../../styles/theme'
9
9
 
10
10
  type ConchaAplicacaolType = {
11
11
  children: React.ReactNode
12
+ removeTooltip?:boolean;
12
13
  notificacoes: NotificationsProps
13
14
  links?: LinksProps[]
14
15
  modulo: string
@@ -28,6 +29,7 @@ type ConchaAplicacaolType = {
28
29
  }
29
30
  export function ConchaAplicacao({
30
31
  children,
32
+ removeTooltip,
31
33
  modulo,
32
34
  temNotificacoes,
33
35
  temChatBot,
@@ -69,6 +71,7 @@ export function ConchaAplicacao({
69
71
  onTrocarModulos={onTrocarModulos!}
70
72
  />
71
73
  </S.NavbarWrapper>
74
+
72
75
  <S.ConchaAplicacaoMainWrapper>
73
76
  <Container size={1500}>
74
77
  <Cabecalho
@@ -79,6 +82,7 @@ export function ConchaAplicacao({
79
82
  color={color}
80
83
  temNotificacoes={temNotificacoes}
81
84
  notificacoes={notificacoes}
85
+ removeTooltip={removeTooltip}
82
86
  />
83
87
  {children}
84
88
  </Container>
@@ -12,6 +12,7 @@ export interface BodyTableProps<
12
12
  data: Array<T>;
13
13
  columns: Column<T>[];
14
14
  selectAllChecked?: boolean;
15
+ setSelectAllChecked?: React.Dispatch<React.SetStateAction<boolean>>
15
16
  fixedPosition?: string[] | undefined;
16
17
  color?: string;
17
18
  acoesChildren?: (row: T) => JSX.Element;
@@ -35,6 +36,7 @@ function BodyTable<
35
36
  selectedLine,
36
37
  setSelectedLine,
37
38
  selectAllChecked,
39
+ setSelectAllChecked,
38
40
  setRowSelection,
39
41
  color,
40
42
  } = props;
@@ -43,6 +45,7 @@ function BodyTable<
43
45
  const [expandedRows, setExpandedRows] = useState<Set<number | string>>(
44
46
  new Set()
45
47
  );
48
+
46
49
  const handleRowSelect = useCallback(
47
50
  (item: T, checked: boolean) => {
48
51
  // if (selectAllChecked) return;
@@ -99,8 +102,8 @@ function BodyTable<
99
102
  selectedLine?.id === item.id
100
103
  ? theme.colors.gray['500']
101
104
  : isSelected
102
- ? theme.colors.gray['500']
103
- : '',
105
+ ? theme.colors.gray['500']
106
+ : '',
104
107
  }}
105
108
  >
106
109
  {columns.map((column, colIndex) => {
@@ -125,8 +128,8 @@ function BodyTable<
125
128
  transform: expandedRows.has(item.id)
126
129
  ? 'rotate(-180deg)'
127
130
  : hasChildren
128
- ? 'rotate(0deg)'
129
- : 'rotate(-90deg)',
131
+ ? 'rotate(0deg)'
132
+ : 'rotate(-90deg)',
130
133
  color: color,
131
134
  transition: 'ease-in 0.2s',
132
135
  }}
@@ -143,14 +146,19 @@ function BodyTable<
143
146
  color={color}
144
147
  type="checkbox"
145
148
  disabled={item.disabled}
146
- checked={rowSelection?.some(
147
- selected => selected.id === item.id
148
- )}
149
+ checked={
150
+ selectAllChecked || rowSelection?.some(
151
+ selected => selected.id === item.id
152
+ )
153
+ }
149
154
  onChange={() => {
150
- handleRowSelect(
151
- item,
152
- rowSelection!.some(selected => selected.id === item.id)
153
- );
155
+ const isSelected = rowSelection!.some(selected => selected.id === item.id);
156
+
157
+ if (selectAllChecked && isSelected && setSelectAllChecked) {
158
+ setSelectAllChecked(false);
159
+ }
160
+
161
+ handleRowSelect(item, isSelected);
154
162
  }}
155
163
  />
156
164
  </td>
@@ -195,18 +203,18 @@ function BodyTable<
195
203
  </tr>,
196
204
  ...(expandedRows.has(item.id)
197
205
  ? item?.children!.flatMap(child =>
198
- renderRows(
199
- child,
200
- columns,
201
- expandedRows,
202
- toggleExpandRow,
203
- acoesChildren,
204
- rowSelection,
205
- setRowSelection,
206
- color,
207
- nivel + 1
208
- )
206
+ renderRows(
207
+ child,
208
+ columns,
209
+ expandedRows,
210
+ toggleExpandRow,
211
+ acoesChildren,
212
+ rowSelection,
213
+ setRowSelection,
214
+ color,
215
+ nivel + 1
209
216
  )
217
+ )
210
218
  : []),
211
219
  ];
212
220
  }
@@ -101,30 +101,29 @@ const Tabela = <
101
101
  headerSelection,
102
102
  tabelaPaginacao,
103
103
  setSelectedLine,
104
- tamanhoPaginacao,
104
+ tamanhoPaginacao = 34,
105
105
  hasInfinitScrool,
106
106
  selectAllChecked,
107
107
  hasFiltersButtons,
108
- qtdRegistrosPagina,
109
- quantidadeRegistros,
108
+ qtdRegistrosPagina = 5,
109
+ quantidadeRegistros = 170,
110
110
  setSelectAllChecked,
111
111
  tdMinWidth = '260px',
112
112
  }: CustomTableProps<T>) => {
113
-
114
113
  const dualScrollWrapperRef = useRef<HTMLDivElement>(null);
115
114
  const topScrollRef = useRef<HTMLDivElement>(null);
116
115
  const tableRef = useRef<HTMLDivElement>(null);
117
116
 
118
117
  const [toogleFiltros, setToogleFiltros] = useState(false)
119
118
  const [formatedColumns, setFormatedColumns] = useState(
120
- columns.map((column) => ({
119
+ columns.map((column: any) => ({
121
120
  ...column,
122
121
  active: true,
123
122
  }))
124
123
  )
125
124
 
126
125
  const columnsToShow = formatedColumns.filter(
127
- (column) => column.active === true
126
+ (column: any) => column.active === true
128
127
  )
129
128
 
130
129
  useEffect(() => {
@@ -241,6 +240,7 @@ const Tabela = <
241
240
  hasSelect={hasSelect}
242
241
  rowSelection={rowSelection}
243
242
  selectAllChecked={selectAllChecked}
243
+ setSelectAllChecked={setSelectAllChecked}
244
244
  setRowSelection={setRowSelection}
245
245
  selectedLine={selectedLine}
246
246
  setSelectedLine={setSelectedLine}