@proef/common-ui 2.6.29 → 2.6.30
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/dist/esm/v1/components/layout/SideNav/SideNav.js +1 -1
- package/dist/esm/v1/components/layout/SideNav/SideNav.js.map +1 -1
- package/dist/esm/v1/components/tables/PaginatedTable/PaginatedTable.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/Table.js +277 -67
- package/dist/esm/v1/components/tables/Table/Table.js.map +1 -1
- package/dist/style.components.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/types/v1/components/tables/PaginatedTable/PaginatedTable.d.ts +4 -0
- package/dist/types/v1/components/tables/Table/Table.d.ts +50 -3
- package/dist/types/v1/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,10 @@ export interface PaginatedTableProps<T> extends TableProps<T> {
|
|
|
34
34
|
* páginas dela.
|
|
35
35
|
* - **Todas as linhas de uma vez** (só `data`): a tabela pagina-se a si mesma.
|
|
36
36
|
*
|
|
37
|
+
* Para listas grandes de mais para virem para o browser, `serverSide` passa
|
|
38
|
+
* também a ordenação e os filtros para o servidor: a tabela avisa por
|
|
39
|
+
* `onStateChange` e quem a alimenta vai buscar a página nova. Ver a `Table`.
|
|
40
|
+
*
|
|
37
41
|
* Por omissão ocupa a altura do pai (`fillHeight`), com as barras de scroll
|
|
38
42
|
* por cima das linhas, linhas-esqueleto a carregar e a aresta direita
|
|
39
43
|
* esbatida, e as colunas redimensionáveis. Qualquer uma pode ser desligada.
|
|
@@ -12,9 +12,9 @@ export interface TableColumn<T> {
|
|
|
12
12
|
* ele a coluna não ordena, não filtra e não agrupa.
|
|
13
13
|
*/
|
|
14
14
|
value?: (row: T) => string | number | null | undefined;
|
|
15
|
-
/** Por omissão `true` (quando há `value`). */
|
|
15
|
+
/** Por omissão `true` (quando há `value`). Com `serverSide`, opt-in: só com `true`. */
|
|
16
16
|
sortable?: boolean;
|
|
17
|
-
/** Por omissão `true` (quando há `value`). */
|
|
17
|
+
/** Por omissão `true` (quando há `value`). Com `serverSide`, opt-in: só com `true`. */
|
|
18
18
|
filterable?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* Como se filtra esta coluna:
|
|
@@ -43,6 +43,14 @@ export interface TableColumn<T> {
|
|
|
43
43
|
value: (row: T) => string | number | null | undefined;
|
|
44
44
|
filterType?: 'text' | 'date' | 'number';
|
|
45
45
|
}[];
|
|
46
|
+
/**
|
|
47
|
+
* Os valores do filtro desta coluna, quando é o servidor a filtrar
|
|
48
|
+
* (`serverSide`). Sem o conjunto completo no browser não há de onde os
|
|
49
|
+
* tirar: quem alimenta a tabela vai buscá-los a um endpoint próprio.
|
|
50
|
+
*
|
|
51
|
+
* Ignorado fora do `serverSide` — aí saem dos dados.
|
|
52
|
+
*/
|
|
53
|
+
filterOptions?: string[];
|
|
46
54
|
headerClassName?: string;
|
|
47
55
|
cellClassName?: string;
|
|
48
56
|
/** Conteúdo extra por baixo do título da coluna (ex: um total). Recebe as linhas já filtradas. */
|
|
@@ -71,7 +79,9 @@ export interface TableView<T> {
|
|
|
71
79
|
getState: () => TableState;
|
|
72
80
|
/** Repõe um estado guardado (ex: ao aplicar uma vista que a pessoa guardou). */
|
|
73
81
|
restore: (state: TableState | undefined) => void;
|
|
82
|
+
setFilters: (filters: TableFilters) => void;
|
|
74
83
|
}
|
|
84
|
+
export type TableFilters = Pick<TableState, 'columnFilters' | 'dateFilters' | 'numFilters'>;
|
|
75
85
|
/**
|
|
76
86
|
* O que uma vista guardada leva da tabela. Conjuntos viram arrays para se
|
|
77
87
|
* poder guardar em JSON.
|
|
@@ -125,11 +135,43 @@ export interface TableProps<T> {
|
|
|
125
135
|
onAllDataNeeded?: () => void;
|
|
126
136
|
/** Modo cliente sempre (paginação, ordenação e filtros sobre `allData`), mesmo sem interação. */
|
|
127
137
|
alwaysClient?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Ordenar e filtrar são do SERVIDOR: a tabela não lhes toca.
|
|
140
|
+
*
|
|
141
|
+
* Por omissão ordenar e filtrar são do lado do cliente, sobre o conjunto
|
|
142
|
+
* completo (`allData`), que a tabela pede com `onAllDataNeeded`. Isso resolve
|
|
143
|
+
* bem até às dezenas de milhar de linhas. Acima disso não há conjunto
|
|
144
|
+
* completo que se traga: uma listagem de 127 mil OTs ficava a rodar à espera
|
|
145
|
+
* de dados que ninguém pode entregar.
|
|
146
|
+
*
|
|
147
|
+
* Com `serverSide`, a tabela passa a:
|
|
148
|
+
* - mostrar `data` como vem, sem ordenar nem filtrar;
|
|
149
|
+
* - não pedir `allData`;
|
|
150
|
+
* - avisar por `onStateChange` sempre que a pessoa mexe na ordenação ou nos
|
|
151
|
+
* filtros, para quem a alimenta ir buscar a página nova.
|
|
152
|
+
*
|
|
153
|
+
* Os valores das listas de filtro deixam de sair dos dados — vêm do
|
|
154
|
+
* `filterOptions` de cada coluna.
|
|
155
|
+
*/
|
|
156
|
+
serverSide?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* A ordenação ou os filtros do cabeçalho mudaram.
|
|
159
|
+
*
|
|
160
|
+
* É o par do `onPageChange` para o resto do estado da vista. Sem ele, com
|
|
161
|
+
* `serverSide`, mexer no cabeçalho não faz nada.
|
|
162
|
+
*
|
|
163
|
+
* O estado vem no mesmo formato do `getState()` do `viewRef`, por isso pode
|
|
164
|
+
* ser guardado e reposto tal e qual.
|
|
165
|
+
*/
|
|
166
|
+
onStateChange?: (state: TableState) => void;
|
|
128
167
|
/** Ordenação inicial: a coluna. */
|
|
129
168
|
defaultSortColumn?: string;
|
|
130
169
|
defaultSortDirection?: 'asc' | 'desc';
|
|
131
170
|
/** Recebe o estado da vista (ordenação e filtros) para uso por fora. Ver `TableView`. */
|
|
132
171
|
viewRef?: React.MutableRefObject<TableView<T> | null>;
|
|
172
|
+
filterableColumns?: TableColumn<T>[];
|
|
173
|
+
onFiltersChange?: (filters: TableFilters) => void;
|
|
174
|
+
hideFilterChips?: boolean;
|
|
133
175
|
/**
|
|
134
176
|
* A tabela ocupa a ALTURA TODA que o pai lhe der, em vez de encolher com o
|
|
135
177
|
* número de linhas. O cabeçalho fica fixo e só as linhas rolam.
|
|
@@ -163,7 +205,12 @@ export interface TableProps<T> {
|
|
|
163
205
|
visible: number;
|
|
164
206
|
filtered: boolean;
|
|
165
207
|
selfPaginated: boolean;
|
|
208
|
+
pages: number;
|
|
166
209
|
}) => void;
|
|
210
|
+
clientPage?: {
|
|
211
|
+
page: number;
|
|
212
|
+
onPageChange: (page: number) => void;
|
|
213
|
+
};
|
|
167
214
|
/**
|
|
168
215
|
* Quantas colunas do início ficam congeladas no scroll horizontal. A caixa de
|
|
169
216
|
* seleção, quando existe, vai junto.
|
|
@@ -251,7 +298,7 @@ export interface PaginacaoNoTopo {
|
|
|
251
298
|
onPageSizeChange?: (pageSize: number) => void;
|
|
252
299
|
}
|
|
253
300
|
/** A tabela, com tudo. A `Table` e o `PaginatedTable` são predefinições dela. */
|
|
254
|
-
export declare function TableBase<T>({ paginacaoNoTopo, columns: colunasBase, data, allData, pageSize, rowKey, onRowClick, onRowDoubleClick, loading: isLoading, allDataLoading: isAllDataLoading, loadingLabel, emptyLabel, emptySubLabel, storageKey, selectable, onSelectionChange, clearSelectionTrigger, onAllDataNeeded: onDataNeeded, alwaysClient, defaultSortColumn: defaultSortCol, defaultSortDirection: defaultSortDir, viewRef, fillHeight: preencheAltura, onVisibleChange: onVista, frozenColumns: colunasFixas, onMoveColumn: onMoverColuna, measureAllData: larguraPeloConjunto, overlayScrollbars: barraSobreposta, headerRowClassName: classeCabecalho, scrollbarOnEdge: barraNaBorda, bordered: comCaixa, resizableColumns: redimensionavel, horizontalScrollbarBelow: barraHorizontalFora, skeleton: esqueletoAoCarregar, fadeRight: esbaterDireita, rowClassName, maxHeight, labels, }: TableProps<T> & {
|
|
301
|
+
export declare function TableBase<T>({ paginacaoNoTopo, columns: colunasBase, data, allData, pageSize, rowKey, onRowClick, onRowDoubleClick, loading: isLoading, allDataLoading: isAllDataLoading, loadingLabel, emptyLabel, emptySubLabel, storageKey, selectable, onSelectionChange, clearSelectionTrigger, onAllDataNeeded: onDataNeeded, alwaysClient, serverSide: noServidor, onStateChange: onEstadoMudou, defaultSortColumn: defaultSortCol, defaultSortDirection: defaultSortDir, viewRef, fillHeight: preencheAltura, filterableColumns: colunasFiltraveis, onFiltersChange: onFiltros, hideFilterChips: semFaixaFiltros, clientPage: paginaCliente, onVisibleChange: onVista, frozenColumns: colunasFixas, onMoveColumn: onMoverColuna, measureAllData: larguraPeloConjunto, overlayScrollbars: barraSobreposta, headerRowClassName: classeCabecalho, scrollbarOnEdge: barraNaBorda, bordered: comCaixa, resizableColumns: redimensionavel, horizontalScrollbarBelow: barraHorizontalFora, skeleton: esqueletoAoCarregar, fadeRight: esbaterDireita, rowClassName, maxHeight, labels, }: TableProps<T> & {
|
|
255
302
|
paginacaoNoTopo?: PaginacaoNoTopo;
|
|
256
303
|
}): React.JSX.Element;
|
|
257
304
|
/**
|
package/dist/types/v1/index.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ export { default as Steps, DEFAULT_STEPS_LABELS } from './primitives/navigation/
|
|
|
105
105
|
export type { StepsProps, StepItem, StepsLabels } from './primitives/navigation/Steps/Steps';
|
|
106
106
|
export type { SegmentedControlProps, SegmentedOption } from './primitives/buttons/SegmentedControl/SegmentedControl';
|
|
107
107
|
export { default as Table } from './components/tables/Table/Table';
|
|
108
|
-
export type { TableProps, TableColumn, TableView, TableState } from './components/tables/Table/Table';
|
|
108
|
+
export type { TableProps, TableColumn, TableView, TableState, TableFilters } from './components/tables/Table/Table';
|
|
109
109
|
export { default as PaginatedTable } from './components/tables/PaginatedTable/PaginatedTable';
|
|
110
110
|
export type { PaginatedTableProps } from './components/tables/PaginatedTable/PaginatedTable';
|
|
111
111
|
export { DEFAULT_TABLE_LABELS } from './components/tables/Table/labels';
|