wca-designsystem 1.0.91 → 1.0.97

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.91",
2
+ "version": "1.0.97",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -26,6 +26,7 @@ export type TabelaHeaderProps<
26
26
  setOrdenarPor?: React.Dispatch<React.SetStateAction<SelectDataProps>>
27
27
  handleAdicionar?: () => void
28
28
  ordenarPor?: SelectDataProps
29
+ ordenarOpcoes?: Array<{ value: string; label: string }>;
29
30
  hasFiltersButtons?: boolean
30
31
  columns: Column<T>[]
31
32
  setFormatedColumns: React.Dispatch<React.SetStateAction<Column<T>[]>>
@@ -41,6 +42,7 @@ const TabelaHeader = <T extends { id: string | number; children?: Array<T> }>({
41
42
  hasFiltersButtons,
42
43
  handleAdicionar,
43
44
  ordenarPor,
45
+ ordenarOpcoes,
44
46
  setOrdenarPor,
45
47
  setFormatedColumns,
46
48
  hasOrder,
@@ -54,20 +56,9 @@ const TabelaHeader = <T extends { id: string | number; children?: Array<T> }>({
54
56
  })
55
57
  setFormatedColumns(columnsFormated)
56
58
  }, [])
57
-
58
- const defaultOrderData = [
59
- { value: 'Maior', label: 'Ordenar por: Decrescente' },
60
- { value: 'Menor', label: 'Ordenar por: Crescente' },
61
- ];
62
-
63
- const orderData = useMemo(() => {
64
- if (!ordenarPor) return defaultOrderData;
65
- return defaultOrderData.map((opt) =>
66
- opt.value === ordenarPor.value ? { ...opt, label: ordenarPor.label } : opt
67
- );
68
- }, [ordenarPor]);
69
59
 
70
60
  const columnsToHide = ['expand', 'select', 'acoes']
61
+
71
62
  return (
72
63
  <S.HeaderTableContent className="header-table-content">
73
64
  <InputDeTexto
@@ -82,7 +73,10 @@ const TabelaHeader = <T extends { id: string | number; children?: Array<T> }>({
82
73
  {hasOrder && (
83
74
  <SelectCustomizado
84
75
  tipo="table"
85
- data={orderData}
76
+ data={ordenarOpcoes ?? [
77
+ { value: 'Maior', label: 'Ordenar por: Decrescente' },
78
+ { value: 'Menor', label: 'Ordenar por: Crescente' },
79
+ ]}
86
80
  onChange={(_value, option) => setOrdenarPor!(option)}
87
81
  allowDeselect={false}
88
82
  value={ordenarPor ? ordenarPor.value : 'Maior'}
@@ -52,6 +52,7 @@ export type CustomTableProps<
52
52
  hasFiltersButtons?: boolean
53
53
  hasInfinitScrool?: boolean
54
54
  setOrdenarPor?: React.Dispatch<React.SetStateAction<SelectDataProps>>
55
+ ordenarOpcoes?: Array<{ value: string; label: string }>
55
56
  ordenarPor?: SelectDataProps
56
57
  filtrosPor: {
57
58
  value: string
@@ -85,6 +86,7 @@ const Tabela = <
85
86
  isLoading,
86
87
  hasSelect,
87
88
  hasExpand,
89
+ ordenarOpcoes,
88
90
  ordenarPor,
89
91
  setSimples,
90
92
  selectedLine,
@@ -187,6 +189,7 @@ const Tabela = <
187
189
  hasFiltersButtons={hasFiltersButtons}
188
190
  hasOrder={hasOrder}
189
191
  ordenarPor={ordenarPor}
192
+ ordenarOpcoes={ordenarOpcoes}
190
193
  setOrdenarPor={setOrdenarPor}
191
194
  />
192
195