@sankhyalabs/ezui 0.0.0-feat-dev-KB-194977.3 → 0.0.0-feat-dev-KB-194977.4
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/react-components/dist/components/actions/taskbar/EzTaskbar.types.d.ts +15 -0
- package/react-components/dist/components/actions/taskbar/TaskbarItemView.d.ts +3 -1
- package/react-components/dist/components/actions/taskbar/useTaskbarShortcuts.d.ts +4 -0
- package/react-components/dist/components/data/attachments/EzAttachments.d.ts +26 -0
- package/react-components/dist/components/data/attachments/EzAttachments.types.d.ts +185 -0
- package/react-components/dist/components/data/attachments/attachmentUtils.d.ts +16 -0
- package/react-components/dist/components/data/attachments/index.d.ts +3 -0
- package/react-components/dist/components/data/attachments/strings.d.ts +56 -0
- package/react-components/dist/components/data/attachments/styles.d.ts +2 -0
- package/react-components/dist/components/data/data-grid/EzDataGrid.types.d.ts +48 -11
- package/react-components/dist/components/data/grid-config-dialog/EzGridConfigDialog.d.ts +18 -0
- package/react-components/dist/components/data/grid-config-dialog/EzGridConfigDialog.types.d.ts +89 -0
- package/react-components/dist/components/data/grid-config-dialog/gridConfigUtils.d.ts +31 -0
- package/react-components/dist/components/data/grid-config-dialog/index.d.ts +3 -0
- package/react-components/dist/components/data/grid-config-dialog/strings.d.ts +35 -0
- package/react-components/dist/components/data/grid-config-dialog/styles.d.ts +2 -0
- package/react-components/dist/components/data/grid-print/index.d.ts +2 -0
- package/react-components/dist/components/data/grid-print/printGrid.d.ts +112 -0
- package/react-components/dist/components/data/grid-print/strings.d.ts +17 -0
- package/react-components/dist/components/data/index.d.ts +3 -0
- package/react-components/dist/components/data/table/EzTable.types.d.ts +62 -4
- package/react-components/dist/components/feedback/dialog/EzDialog.d.ts +9 -2
- package/react-components/dist/components/feedback/dialog/EzDialog.types.d.ts +80 -1
- package/react-components/dist/components/feedback/dialog/index.d.ts +1 -1
- package/react-components/dist/components/feedback/shared/utils.d.ts +7 -1
- package/react-components/dist/components/feedback/tooltip/EzTooltip.types.d.ts +5 -2
- package/react-components/dist/components/fields/filter/EzFilter.types.d.ts +15 -0
- package/react-components/dist/components/fields/filter/SavedFilters.d.ts +5 -2
- package/react-components/dist/components/fields/filter-button/EzFilterButton.types.d.ts +6 -0
- package/react-components/dist/components/fields/search/EzSearch.d.ts +1 -1
- package/react-components/dist/components/fields/search/EzSearch.types.d.ts +48 -8
- package/react-components/dist/components/fields/search/index.d.ts +1 -1
- package/react-components/dist/components/layout/application/EzApplication.d.ts +1 -1
- package/react-components/dist/components/layout/application/EzApplication.types.d.ts +63 -0
- package/react-components/dist/components/layout/application/index.d.ts +1 -1
- package/react-components/dist/components/layout/split-panel/EzSplitPanel.types.d.ts +13 -1
- package/react-components/dist/engine/colDefBuilder.d.ts +5 -0
- package/react-components/dist/engine/editors/index.d.ts +7 -1
- package/react-components/dist/engine/formatters.d.ts +6 -0
- package/react-components/dist/form/dataunit/EzDataUnitForm.d.ts +68 -4
- package/react-components/dist/form/dataunit/convert.d.ts +28 -4
- package/react-components/dist/form/dataunit/useDataUnitForm.d.ts +16 -0
- package/react-components/dist/form/index.d.ts +2 -2
- package/react-components/dist/index.cjs +37 -19
- package/react-components/dist/index.js +13455 -12019
- package/react-components/dist/types/column.d.ts +64 -7
- package/react-components/dist/types/handle.d.ts +13 -0
- package/react-components/dist/wc/{index-DvCRMYSY.js → index-dVifcgim.js} +47 -47
- package/react-components/dist/wc/index.js +1 -1
- package/react-components/dist/wc/{main.esm-DVys9nqv.js → main.esm-CUiyrJgv.js} +1 -1
package/package.json
CHANGED
|
@@ -227,6 +227,21 @@ export interface EzTaskbarHandle {
|
|
|
227
227
|
getOverflowedIds: () => string[];
|
|
228
228
|
/** Mede de novo os itens e recalcula o que cabe (após mudanças externas de fonte, por exemplo). */
|
|
229
229
|
recalculate: () => void;
|
|
230
|
+
/**
|
|
231
|
+
* Abre o menu de um item `menu` (ou a seta de um `split`), como o clique.
|
|
232
|
+
* Se o item estiver no "Mais opções", abre esse menu já com o submenu do
|
|
233
|
+
* item aberto. Útil para atalhos de teclado próprios da tela.
|
|
234
|
+
* @param id - Id do item (`menu` ou `split`).
|
|
235
|
+
* @returns `true` se o menu foi aberto; `false` se o item não existe, não
|
|
236
|
+
* tem menu, está desabilitado (ou com `menuDisabled`) ou a barra está carregando.
|
|
237
|
+
* @example
|
|
238
|
+
* ```tsx
|
|
239
|
+
* const taskbar = useRef<EzTaskbarHandle>(null);
|
|
240
|
+
* // F7 abre o menu "Exportar"
|
|
241
|
+
* taskbar.current?.openMenu('export');
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
openMenu: (id: string) => boolean;
|
|
230
245
|
/** Elemento `role="toolbar"`. */
|
|
231
246
|
element: HTMLDivElement | null;
|
|
232
247
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EzMenuPassThroughProps } from '..';
|
|
1
|
+
import { EzMenuHandle, EzMenuPassThroughProps } from '..';
|
|
2
2
|
import { EzTaskbarActionBase, EzTaskbarActionEvent, EzTaskbarItem, EzTaskbarPresentation, EzTaskbarRenderContext, EzTaskbarSize } from './EzTaskbar.types';
|
|
3
3
|
import { EzTaskbarStrings } from './strings';
|
|
4
4
|
|
|
@@ -16,6 +16,8 @@ export interface TaskbarItemContext {
|
|
|
16
16
|
shortcutsActive: boolean;
|
|
17
17
|
/** Opções do `EzMenu` de todos os menus da barra. */
|
|
18
18
|
menuProps?: EzMenuPassThroughProps;
|
|
19
|
+
/** Registra o controle do menu de um item (`menu`/`split`) para o `openMenu` do handle. Estável. */
|
|
20
|
+
registerMenu: (id: string, handle: EzMenuHandle | null) => void;
|
|
19
21
|
}
|
|
20
22
|
/** Como o botão aparece: só ícone, só texto ou ícone + texto. */
|
|
21
23
|
export type TaskbarDisplay = 'icon' | 'label' | 'icon-label';
|
|
@@ -38,7 +38,11 @@ export interface UseTaskbarShortcutsOptions {
|
|
|
38
38
|
/** Barra em carregamento (esqueleto): sem atalhos. */
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
onAction: (id: string, event: EzTaskbarActionEvent) => void;
|
|
41
|
+
/** Abre o menu de um item `menu` (o mesmo do `EzTaskbarHandle.openMenu`). */
|
|
42
|
+
openMenu: (id: string) => void;
|
|
41
43
|
}
|
|
44
|
+
/** Contêiner (`data-taskbar-id`) de um item da barra. */
|
|
45
|
+
export declare function slotOf(root: HTMLElement | null, id: string): HTMLElement | null;
|
|
42
46
|
/**
|
|
43
47
|
* Liga os atalhos dos itens da barra (`shortcut`/`shortcutAliases`) conforme o
|
|
44
48
|
* escopo. Um único ouvinte no `document` atende todas as barras; a limpeza é
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactElement, Ref } from 'react';
|
|
2
|
+
import { EzAttachment, EzAttachmentsHandle, EzAttachmentsProps } from './EzAttachments.types';
|
|
3
|
+
|
|
4
|
+
export type { EzAttachment, EzAttachmentsAction, EzAttachmentsErrorContext, EzAttachmentsHandle, EzAttachmentsProps, EzAttachmentUploadContext, } from './EzAttachments.types';
|
|
5
|
+
/**
|
|
6
|
+
* Gerenciador de anexos de um registro: lista (nome, tamanho, data, autor e
|
|
7
|
+
* descrição), anexar (botão ou arrastar e soltar, com progresso e
|
|
8
|
+
* cancelamento), abrir/baixar, substituir o arquivo, editar a descrição e
|
|
9
|
+
* remover com confirmação. Não fala com o servidor: tudo entra por
|
|
10
|
+
* loaders/callbacks (`loadItems`, `upload`, `remove`, `open`...). Funciona
|
|
11
|
+
* solto ou dentro de um `EzModal`/`EzDrawer`.
|
|
12
|
+
*
|
|
13
|
+
* Teclado: Tab percorre as ações; na linha, Delete remove e F2 edita a descrição.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <EzAttachments
|
|
17
|
+
* reloadKey={nunota}
|
|
18
|
+
* loadItems={(signal) => api.listarAnexos(nunota, signal)}
|
|
19
|
+
* upload={(file, { onProgress, signal }) => api.enviarAnexo(nunota, file, { onProgress, signal })}
|
|
20
|
+
* remove={(anexo) => api.removerAnexo(anexo)}
|
|
21
|
+
* open={(anexo) => api.abrirAnexo(anexo)}
|
|
22
|
+
* />
|
|
23
|
+
*/
|
|
24
|
+
export declare const EzAttachments: <T extends EzAttachment = EzAttachment>(props: EzAttachmentsProps<T> & {
|
|
25
|
+
ref?: Ref<EzAttachmentsHandle<T>>;
|
|
26
|
+
}) => ReactElement;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { EzLang } from '../../../i18n';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Anexo de um registro. O componente mostra estes campos; o app pode estender
|
|
6
|
+
* o tipo com o que precisar para falar com o servidor (chaves, tipo do anexo...).
|
|
7
|
+
*/
|
|
8
|
+
export interface EzAttachment {
|
|
9
|
+
/** Identificador único do anexo (chave do app/servidor). */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Nome do arquivo (título da linha). */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Descrição livre (editável com `updateDescription`). */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Tamanho em bytes. */
|
|
16
|
+
size?: number;
|
|
17
|
+
/** Tipo MIME (escolhe o ícone: imagem, PDF ou arquivo). */
|
|
18
|
+
type?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Data da última alteração. `Date` ou texto ISO são formatados no idioma;
|
|
21
|
+
* outro texto (ex.: `"16/11/2026 10:30"` vindo do servidor) aparece como veio.
|
|
22
|
+
*/
|
|
23
|
+
modifiedAt?: Date | string;
|
|
24
|
+
/** Quem anexou/alterou. */
|
|
25
|
+
author?: string;
|
|
26
|
+
/** Endereço para abrir/baixar quando não há `open` (data URL vira download). */
|
|
27
|
+
url?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Contexto do envio: progresso e cancelamento (o mesmo do `EzFileUpload`). */
|
|
30
|
+
export interface EzAttachmentUploadContext {
|
|
31
|
+
/** Informe o progresso (0–100). */
|
|
32
|
+
onProgress: (percent: number) => void;
|
|
33
|
+
/** Cancelado quando o usuário cancela o envio ou o componente sai da tela. */
|
|
34
|
+
signal: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
/** Ação em que um erro aconteceu (segundo argumento do `onError`). */
|
|
37
|
+
export type EzAttachmentsAction = 'load' | 'upload' | 'replace' | 'remove' | 'open' | 'describe' | 'add';
|
|
38
|
+
/** Contexto do erro informado em `onError`. */
|
|
39
|
+
export interface EzAttachmentsErrorContext<T extends EzAttachment = EzAttachment> {
|
|
40
|
+
action: EzAttachmentsAction;
|
|
41
|
+
/** Anexo envolvido (remover, abrir, descrever, substituir). */
|
|
42
|
+
item?: T;
|
|
43
|
+
/** Arquivo envolvido (enviar, substituir). */
|
|
44
|
+
file?: File;
|
|
45
|
+
}
|
|
46
|
+
/** API imperativa (`ref`). */
|
|
47
|
+
export interface EzAttachmentsHandle<T extends EzAttachment = EzAttachment> {
|
|
48
|
+
/** Carrega de novo pela `loadItems` (ex.: depois de uma janela própria de envio). */
|
|
49
|
+
reload(): Promise<void>;
|
|
50
|
+
/** Abre a escolha de arquivos do sistema (como o botão "Anexar"). */
|
|
51
|
+
chooseFiles(): void;
|
|
52
|
+
/** Envia os arquivos pela `upload` (mesma validação do arrastar e soltar). */
|
|
53
|
+
addFiles(files: File[]): Promise<void>;
|
|
54
|
+
/** Anexos mostrados agora. */
|
|
55
|
+
getItems(): T[];
|
|
56
|
+
}
|
|
57
|
+
export interface EzAttachmentsProps<T extends EzAttachment = EzAttachment> {
|
|
58
|
+
/**
|
|
59
|
+
* Anexos (controlado). Use com `onItemsChange`. Sem ela, o componente
|
|
60
|
+
* carrega por `loadItems` e guarda a lista.
|
|
61
|
+
*/
|
|
62
|
+
items?: ReadonlyArray<T>;
|
|
63
|
+
/** Chamado com a lista nova depois de enviar, substituir, remover ou descrever. */
|
|
64
|
+
onItemsChange?: (items: T[]) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Carrega os anexos do registro. Chamado ao montar e quando `reloadKey`
|
|
67
|
+
* muda; o `signal` é cancelado se outra carga começar ou o componente sair.
|
|
68
|
+
* Erros mostram a mensagem com "Tentar de novo".
|
|
69
|
+
* @example
|
|
70
|
+
* loadItems={(signal) => api.anexos(nunota, signal)}
|
|
71
|
+
*/
|
|
72
|
+
loadItems?: (signal: AbortSignal) => Promise<T[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Muda para recarregar (ex.: o id do registro). A função `loadItems` pode
|
|
75
|
+
* ser recriada a cada render: só a troca desta chave dispara nova carga.
|
|
76
|
+
*/
|
|
77
|
+
reloadKey?: unknown;
|
|
78
|
+
/**
|
|
79
|
+
* Envia um arquivo e devolve o anexo criado. Com ela aparecem o botão
|
|
80
|
+
* "Anexar" e a área de arrastar e soltar, com progresso e cancelamento.
|
|
81
|
+
*/
|
|
82
|
+
upload?: (file: File, context: EzAttachmentUploadContext) => Promise<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Anexar por um fluxo próprio do app (janela de envio legada, link,
|
|
85
|
+
* repositório...). Com ela, o botão "Anexar" chama esta função em vez de
|
|
86
|
+
* abrir a escolha de arquivos. Se devolver anexos, eles entram na lista; se
|
|
87
|
+
* não, chame `ref.reload()` quando o fluxo terminar.
|
|
88
|
+
*/
|
|
89
|
+
onAdd?: () => void | T[] | Promise<void | T[]>;
|
|
90
|
+
/** Remove no servidor. Sem ela, não há botão de remover. Se rejeitar, o anexo fica. */
|
|
91
|
+
remove?: (item: T) => Promise<void> | void;
|
|
92
|
+
/**
|
|
93
|
+
* Pede confirmação antes de remover.
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
confirmRemove?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Abre/baixa o anexo (clique no nome, botão de abrir, Enter). Sem ela, usa
|
|
99
|
+
* o `url` do anexo em nova aba (data URL vira download).
|
|
100
|
+
*/
|
|
101
|
+
open?: (item: T) => Promise<void> | void;
|
|
102
|
+
/**
|
|
103
|
+
* Troca o arquivo de um anexo existente (o "Alterar" do `sk-attach`) e
|
|
104
|
+
* devolve o anexo atualizado. Com ela aparece o botão de substituir.
|
|
105
|
+
*/
|
|
106
|
+
replace?: (item: T, file: File, context: EzAttachmentUploadContext) => Promise<T>;
|
|
107
|
+
/**
|
|
108
|
+
* Grava a descrição editada. Com ela, a descrição fica editável (botão de
|
|
109
|
+
* editar ou F2 na linha). Pode devolver o anexo atualizado.
|
|
110
|
+
*/
|
|
111
|
+
updateDescription?: (item: T, description: string) => Promise<T | void> | T | void;
|
|
112
|
+
/** Se o anexo pode ser removido (permissão por item). @default todos */
|
|
113
|
+
canRemove?: (item: T) => boolean;
|
|
114
|
+
/** Se o anexo pode ter o arquivo substituído. @default todos */
|
|
115
|
+
canReplace?: (item: T) => boolean;
|
|
116
|
+
/** Se a descrição do anexo pode ser editada. @default todos */
|
|
117
|
+
canEditDescription?: (item: T) => boolean;
|
|
118
|
+
/** Tipos aceitos, como no `<input type="file">` (`.pdf,image/*`). */
|
|
119
|
+
accept?: string;
|
|
120
|
+
/** Tamanho máximo por arquivo, em bytes. */
|
|
121
|
+
maxFileSize?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Permite escolher vários arquivos de uma vez.
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
multiple?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Caixas de seleção nos anexos (ex.: "visualizar os selecionados").
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
selectable?: boolean;
|
|
132
|
+
/** Ids selecionados (controlado quando a chave existe). */
|
|
133
|
+
selectedIds?: ReadonlyArray<string>;
|
|
134
|
+
/** Chamado quando a seleção muda. */
|
|
135
|
+
onSelectionChange?: (ids: string[], items: T[]) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Somente leitura: lista, abre e seleciona, mas não anexa, remove, substitui
|
|
138
|
+
* nem edita.
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
readOnly?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Desabilitado: nenhuma ação (nem abrir).
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
146
|
+
disabled?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Carregando por conta do app (com `items` controlado). Com `loadItems`, o
|
|
149
|
+
* componente controla sozinho.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
loading?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Erro de carga por conta do app (com `items` controlado). `onRetry` mostra
|
|
155
|
+
* o botão "Tentar de novo".
|
|
156
|
+
*/
|
|
157
|
+
error?: ReactNode;
|
|
158
|
+
/** "Tentar de novo" do `error` controlado. */
|
|
159
|
+
onRetry?: () => void;
|
|
160
|
+
/** Título do cabeçalho. `null` esconde o título. @default "Anexos" */
|
|
161
|
+
title?: ReactNode;
|
|
162
|
+
/**
|
|
163
|
+
* Mostra o cabeçalho (título, total e botão "Anexar").
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
showHeader?: boolean;
|
|
167
|
+
/** Conteúdo extra no cabeçalho, antes do botão "Anexar" (ações do app). */
|
|
168
|
+
headerActions?: ReactNode;
|
|
169
|
+
/** Ações extras em cada anexo, antes das ações padrão. */
|
|
170
|
+
renderItemActions?: (item: T) => ReactNode;
|
|
171
|
+
/** Texto da lista vazia. @default "Nenhum anexo" */
|
|
172
|
+
emptyText?: ReactNode;
|
|
173
|
+
/** Formata a data do anexo (padrão: data e hora curtas no idioma). */
|
|
174
|
+
formatDate?: (value: Date | string, item: T) => string;
|
|
175
|
+
/** Informa erros de qualquer ação (além da mensagem na tela). */
|
|
176
|
+
onError?: (error: unknown, context: EzAttachmentsErrorContext<T>) => void;
|
|
177
|
+
/** Altura máxima da lista (px ou CSS); a lista rola além disso. */
|
|
178
|
+
maxHeight?: number | string;
|
|
179
|
+
/** Idioma dos textos (sem ele, o da aplicação). */
|
|
180
|
+
lang?: EzLang | string;
|
|
181
|
+
/** Identificador para automação (`data-element-id`). */
|
|
182
|
+
elementId?: string;
|
|
183
|
+
className?: string;
|
|
184
|
+
style?: CSSProperties;
|
|
185
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EzAttachment } from './EzAttachments.types';
|
|
2
|
+
|
|
3
|
+
/** Ícone do DS pelo tipo do anexo: imagem, PDF ou arquivo genérico. */
|
|
4
|
+
export declare function attachmentIcon(item: Pick<EzAttachment, 'name' | 'type'>): string;
|
|
5
|
+
/**
|
|
6
|
+
* Data do anexo no idioma (data e hora curtas). `Date` e texto ISO são
|
|
7
|
+
* formatados; outro texto (já formatado pelo servidor) volta como veio.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatAttachmentDate(value: Date | string, locale: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Abre o endereço do anexo: em nova aba, ou baixa com o nome do arquivo quando
|
|
12
|
+
* é data URL (os navegadores bloqueiam abrir data URL em nova aba).
|
|
13
|
+
*/
|
|
14
|
+
export declare function openAttachmentUrl(url: string, name: string): void;
|
|
15
|
+
/** `true` quando o arrastar traz arquivos (e não texto ou itens da página). */
|
|
16
|
+
export declare function dragHasFiles(dataTransfer: DataTransfer | null): boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { EzAttachments } from './EzAttachments';
|
|
2
|
+
export type { EzAttachment, EzAttachmentsAction, EzAttachmentsErrorContext, EzAttachmentsHandle, EzAttachmentsProps, EzAttachmentUploadContext, } from './EzAttachments';
|
|
3
|
+
export { attachmentIcon, formatAttachmentDate } from './attachmentUtils';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Textos do EzAttachments (somados aos comuns de dados). */
|
|
2
|
+
export interface EzAttachmentsStrings {
|
|
3
|
+
title: string;
|
|
4
|
+
attach: string;
|
|
5
|
+
/** Lista de anexos (nome acessível). */
|
|
6
|
+
listLabel: string;
|
|
7
|
+
countOne: string;
|
|
8
|
+
/** `{count}`. */
|
|
9
|
+
countOther: string;
|
|
10
|
+
dropHint: string;
|
|
11
|
+
chooseFiles: string;
|
|
12
|
+
dropActive: string;
|
|
13
|
+
emptyText: string;
|
|
14
|
+
loadError: string;
|
|
15
|
+
retry: string;
|
|
16
|
+
/** `{name}`. */
|
|
17
|
+
open: string;
|
|
18
|
+
/** `{name}`. */
|
|
19
|
+
remove: string;
|
|
20
|
+
/** `{name}`. */
|
|
21
|
+
replace: string;
|
|
22
|
+
/** `{name}`. */
|
|
23
|
+
editDescription: string;
|
|
24
|
+
description: string;
|
|
25
|
+
descriptionPlaceholder: string;
|
|
26
|
+
save: string;
|
|
27
|
+
cancel: string;
|
|
28
|
+
confirmRemoveTitle: string;
|
|
29
|
+
/** `{name}`. */
|
|
30
|
+
confirmRemoveMessage: string;
|
|
31
|
+
removeConfirm: string;
|
|
32
|
+
/** `{name}` e `{percent}`. */
|
|
33
|
+
uploading: string;
|
|
34
|
+
uploadFailed: string;
|
|
35
|
+
/** `{max}`. */
|
|
36
|
+
fileTooLarge: string;
|
|
37
|
+
fileTypeNotAllowed: string;
|
|
38
|
+
/** `{name}`. */
|
|
39
|
+
cancelUpload: string;
|
|
40
|
+
dismiss: string;
|
|
41
|
+
/** `{name}`. */
|
|
42
|
+
actionFailed: string;
|
|
43
|
+
selectAll: string;
|
|
44
|
+
/** `{name}`. */
|
|
45
|
+
select: string;
|
|
46
|
+
/** `{name}`. */
|
|
47
|
+
uploaded: string;
|
|
48
|
+
/** `{name}`. */
|
|
49
|
+
removed: string;
|
|
50
|
+
/** `{name}`. */
|
|
51
|
+
replaced: string;
|
|
52
|
+
/** `{author}`. */
|
|
53
|
+
by: string;
|
|
54
|
+
}
|
|
55
|
+
/** Textos do EzAttachments no idioma resolvido. */
|
|
56
|
+
export declare const useAttachmentsStrings: (lang?: string) => import('../shared/strings').EzDataCommonStrings & EzAttachmentsStrings;
|
|
@@ -55,7 +55,12 @@ export interface EzDataGridHandle<TRow = DataRecord> {
|
|
|
55
55
|
export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
56
56
|
/** Fonte de dados observável do `@sankhyalabs/core`. */
|
|
57
57
|
dataUnit: DataUnit;
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Colunas. Se omitido, derivam dos metadados do DataUnit. O `field` é o nome do
|
|
60
|
+
* campo no registro, lido sem tratar o ponto como caminho: campos de ligação como
|
|
61
|
+
* `Produto.DESCRPROD` funcionam direto (valor, edição, ordenação, filtro e config),
|
|
62
|
+
* sem renomear para `Produto_DESCRPROD`.
|
|
63
|
+
*/
|
|
59
64
|
columns?: EzColumn<TRow>[];
|
|
60
65
|
/**
|
|
61
66
|
* Config de grade (ordem/largura/visibilidade/pin/sort). Se omitida, o grid usa
|
|
@@ -73,12 +78,14 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
73
78
|
paginationMode?: EzPaginationMode;
|
|
74
79
|
pageSize?: number;
|
|
75
80
|
/**
|
|
76
|
-
* Tamanho (densidade) INICIAL da grade
|
|
77
|
-
* - small: compacto (linhas de 20px)
|
|
81
|
+
* Tamanho (densidade) INICIAL da grade, com a mesma semântica do `size` da `EzTable`:
|
|
82
|
+
* - small: compacto (linhas de 20px, cabeçalho de 25px, fonte de 12px)
|
|
78
83
|
* - medium: padrão (linhas de 36px)
|
|
79
84
|
* - large: confortável (linhas de 48px)
|
|
80
|
-
*
|
|
81
|
-
*
|
|
85
|
+
* Vale para as linhas, o rodapé (`footerRows`), o skeleton de carga, a coluna de
|
|
86
|
+
* seleção e o painel do Enterprise. O usuário pode trocar pelo menu da grade
|
|
87
|
+
* (Tamanho); a troca é emitida em `onSizeChange`. Se a prop mudar depois, a grade
|
|
88
|
+
* passa a usar o novo valor. Para telas que abrem compactas, use `size="small"`.
|
|
82
89
|
* @default 'medium'
|
|
83
90
|
*/
|
|
84
91
|
size?: EzGridSize;
|
|
@@ -113,9 +120,16 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
113
120
|
/** Dispara a carga inicial automaticamente. */
|
|
114
121
|
autoLoad?: boolean;
|
|
115
122
|
/**
|
|
116
|
-
* Habilita edição inline
|
|
117
|
-
*
|
|
118
|
-
* `
|
|
123
|
+
* Habilita edição inline. As colunas podem sobrescrever com `EzColumn.editable`,
|
|
124
|
+
* inclusive por linha (`editable: (row) => boolean`). Os editores padrão são os
|
|
125
|
+
* do **Design System** (`ez-*`); customize por coluna com `EzColumn.editor` ou
|
|
126
|
+
* globalmente com `interceptor.resolveEditor`.
|
|
127
|
+
*
|
|
128
|
+
* Como abrir o editor numa célula editável: duplo clique, Enter, F2 ou começar a
|
|
129
|
+
* digitar. Nessas células o duplo clique e o Enter não disparam `onRowActivate`
|
|
130
|
+
* (o `onRowDoubleClick` dispara em qualquer célula). Para "abrir o registro com
|
|
131
|
+
* duplo clique" sem atrapalhar a edição, use `onRowActivate`.
|
|
132
|
+
* @default false
|
|
119
133
|
*/
|
|
120
134
|
editable?: boolean;
|
|
121
135
|
/** Salva no DataUnit a cada edição de célula. @default true */
|
|
@@ -127,6 +141,21 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
127
141
|
* @default 'progress'
|
|
128
142
|
*/
|
|
129
143
|
skeletonAnimation?: EzSkeletonAnimation;
|
|
144
|
+
/**
|
|
145
|
+
* Carregamento controlado pelo app: mostra o skeleton da grade sobre o corpo (no
|
|
146
|
+
* lugar das linhas e do aviso de vazio) enquanto `true`, em qualquer modo de
|
|
147
|
+
* paginação. Use quando a tela busca os registros por fora do `dataLoader` e
|
|
148
|
+
* entrega ao DataUnit (ex.: `dataUnit.records = ...`): nesse fluxo o DataUnit não
|
|
149
|
+
* passa pelo estado de carga e a grade mostraria "vazio" durante a busca.
|
|
150
|
+
*
|
|
151
|
+
* Sem a prop, a grade já mostra o skeleton nas cargas feitas pelo DataUnit
|
|
152
|
+
* (`loadData`/`gotoPage`, inclusive as disparadas pelo app). Para manter as linhas
|
|
153
|
+
* antigas visíveis numa recarga, deixe `false` durante ela.
|
|
154
|
+
* @default false
|
|
155
|
+
* @example loading={buscandoDocumentos}
|
|
156
|
+
*/
|
|
157
|
+
loading?: boolean;
|
|
158
|
+
/** Mensagem quando não há linhas (nunca aparece junto com o skeleton de carga). */
|
|
130
159
|
emptyMessage?: string;
|
|
131
160
|
locale?: string;
|
|
132
161
|
currency?: string;
|
|
@@ -147,7 +176,11 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
147
176
|
/** Emitido na mudança de seleção. `info.allSelected` indica seleção total (virtual). */
|
|
148
177
|
onSelectionChange?: (rows: TRow[], info: EzSelectionChangeInfo) => void;
|
|
149
178
|
onRowClick?: (row: TRow) => void;
|
|
150
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* Duplo clique na linha (qualquer célula, inclusive editável — numa célula
|
|
181
|
+
* editável o duplo clique também abre o editor). Para abrir o registro sem
|
|
182
|
+
* conflitar com a edição, prefira `onRowActivate`.
|
|
183
|
+
*/
|
|
151
184
|
onRowDoubleClick?: (row: TRow) => void;
|
|
152
185
|
/**
|
|
153
186
|
* Linha "ativada" pelo usuário (ex.: abrir o registro): Enter numa célula fora de
|
|
@@ -201,7 +234,9 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
201
234
|
/**
|
|
202
235
|
* Mostra o menu do clique direito na célula — mesmas opções do ez-grid:
|
|
203
236
|
* Copiar (Ctrl+C), Copiar com cabeçalho, Copiar com cabeçalhos de grupo e Colar
|
|
204
|
-
* (desabilitado). Com `false`, o navegador mostra o menu nativo
|
|
237
|
+
* (desabilitado). Com `false`, o navegador mostra o menu nativo (ou o menu
|
|
238
|
+
* próprio da tela, se ela tratar o `contextmenu`). O menu de contexto do AG Grid
|
|
239
|
+
* Enterprise fica sempre desligado: só um menu abre por clique.
|
|
205
240
|
* @default true
|
|
206
241
|
*/
|
|
207
242
|
showContextMenu?: boolean;
|
|
@@ -242,7 +277,9 @@ export interface EzDataGridProps<TRow extends DataRecord = DataRecord> {
|
|
|
242
277
|
* SEARCHPLUS → `ez-search-plus`). Prioridade: `EzColumn.optionLoader` → esta
|
|
243
278
|
* prop → loader registrado no `ApplicationContext` do core
|
|
244
279
|
* (`__EZUI__SEARCH__OPTION__LOADER__` / `__EZUI__SEARCH__PLUS__OPTION__LOADER__`,
|
|
245
|
-
* o mesmo da grade Stencil, chamado com `(argument, field, dataUnit)`).
|
|
280
|
+
* o mesmo da grade Stencil, chamado com `(argument, field, dataUnit, ctxOptions)`).
|
|
281
|
+
* O 3º parâmetro desta prop (e o `ctxOptions` do loader registrado) é o
|
|
282
|
+
* `EzColumn.searchContext` da coluna, resolvido a cada busca.
|
|
246
283
|
*/
|
|
247
284
|
searchOptionLoader?: EzSearchOptionLoader;
|
|
248
285
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { EzGridConfigDialogProps } from './EzGridConfigDialog.types';
|
|
3
|
+
|
|
4
|
+
export type { EzGridConfigColumn, EzGridConfigDialogProps, EzGridConfigDraftColumn, EzGridConfigTarget } from './EzGridConfigDialog.types';
|
|
5
|
+
/**
|
|
6
|
+
* Diálogo de configuração de colunas de grade: mostrar/ocultar, ordem
|
|
7
|
+
* (arrastar, botões ou Alt+↑/↓), fixar à esquerda/direita e largura, com
|
|
8
|
+
* Salvar, Restaurar padrão e Cancelar. Trabalha sobre o `EzGridConfig` que a
|
|
9
|
+
* `EzDataGrid` e a `EzTable` já usam (`getGridConfig`/`setGridConfig`/`config`)
|
|
10
|
+
* e não grava nada: o app persiste no `onSave`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Com o ref da grade: lê colunas e configuração ao abrir e aplica ao salvar.
|
|
14
|
+
* <EzGridConfigDialog open={aberto} onClose={() => setAberto(false)} grid={gridRef} onSave={(cfg) => api.salvarConfig('itens', cfg)} />
|
|
15
|
+
* // Controlado (sem grade): o app passa colunas e configuração.
|
|
16
|
+
* <EzGridConfigDialog open={aberto} onClose={fechar} columns={colunas} value={config} defaultValue={padrao} onSave={setConfig} />
|
|
17
|
+
*/
|
|
18
|
+
export declare function EzGridConfigDialog(props: EzGridConfigDialogProps): ReactElement;
|
package/react-components/dist/components/data/grid-config-dialog/EzGridConfigDialog.types.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { GridApi } from 'ag-grid-community';
|
|
3
|
+
import { EzLang } from '../../../i18n';
|
|
4
|
+
import { EzGridConfig } from '../../../types/config';
|
|
5
|
+
import { EzPinnedPosition } from '../../../types/column';
|
|
6
|
+
|
|
7
|
+
/** Coluna oferecida no diálogo (nome técnico + rótulo para pessoas). */
|
|
8
|
+
export interface EzGridConfigColumn {
|
|
9
|
+
/** Nome/field da coluna (o `name` do `EzColumnConfig`). */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Título mostrado (o `headerName` da coluna). */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Texto menor abaixo do título (ex.: o nome técnico). */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Não pode ser ocultada (ex.: a chave). @default false */
|
|
16
|
+
alwaysVisible?: boolean;
|
|
17
|
+
/** Pode ser fixada à esquerda/direita. @default true */
|
|
18
|
+
pinnable?: boolean;
|
|
19
|
+
/** Largura pode ser informada. @default true */
|
|
20
|
+
resizable?: boolean;
|
|
21
|
+
/** Menor largura aceita (px). */
|
|
22
|
+
minWidth?: number;
|
|
23
|
+
/** Maior largura aceita (px). */
|
|
24
|
+
maxWidth?: number;
|
|
25
|
+
/** Oculta no padrão ("Restaurar padrão" sem `defaultValue`). @default false */
|
|
26
|
+
defaultHidden?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* O que o diálogo precisa de uma grade: o `ref` da `EzDataGrid` ou da
|
|
30
|
+
* `EzTable` (`EzDataGridHandle`/`EzTableHandle`) já atende.
|
|
31
|
+
*/
|
|
32
|
+
export interface EzGridConfigTarget {
|
|
33
|
+
getGridConfig(): EzGridConfig;
|
|
34
|
+
setGridConfig(config: EzGridConfig): void;
|
|
35
|
+
getGridApi(): GridApi | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Linha de trabalho do diálogo (estado antes de salvar). */
|
|
38
|
+
export interface EzGridConfigDraftColumn extends EzGridConfigColumn {
|
|
39
|
+
visible: boolean;
|
|
40
|
+
pinned: EzPinnedPosition;
|
|
41
|
+
width?: number;
|
|
42
|
+
sort?: 'asc' | 'desc' | null;
|
|
43
|
+
sortIndex?: number | null;
|
|
44
|
+
}
|
|
45
|
+
export interface EzGridConfigDialogProps {
|
|
46
|
+
/** Aberto (controlado). */
|
|
47
|
+
open: boolean;
|
|
48
|
+
/** Chamado ao fechar (Cancelar, Esc, X ou depois de salvar). */
|
|
49
|
+
onClose: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Grade a configurar (`ref` da `EzDataGrid`/`EzTable`). Ao abrir, o diálogo
|
|
52
|
+
* lê as colunas e a configuração atual da grade; ao salvar, aplica nela
|
|
53
|
+
* (`setGridConfig`) e chama `onSave` para o app gravar.
|
|
54
|
+
*/
|
|
55
|
+
grid?: RefObject<EzGridConfigTarget | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Colunas com rótulo. Sem ela, vêm da `grid` (títulos do cabeçalho). Use
|
|
58
|
+
* para dar nomes melhores ou restringir as colunas oferecidas.
|
|
59
|
+
*/
|
|
60
|
+
columns?: ReadonlyArray<EzGridConfigColumn>;
|
|
61
|
+
/** Configuração atual. Sem ela, vem da `grid` (`getGridConfig()`). */
|
|
62
|
+
value?: EzGridConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Configuração do botão "Restaurar padrão" (carrega no diálogo; vale ao
|
|
65
|
+
* salvar). Sem ela, o padrão é a ordem de `columns` com todas visíveis
|
|
66
|
+
* (menos as `defaultHidden`), sem fixação e sem largura.
|
|
67
|
+
*/
|
|
68
|
+
defaultValue?: EzGridConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Recebe a configuração salva para o app gravar (por usuário/tela). Pode ser
|
|
71
|
+
* assíncrona: o botão Salvar fica carregando e, se rejeitar, o diálogo fica aberto.
|
|
72
|
+
*/
|
|
73
|
+
onSave?: (config: EzGridConfig) => void | Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Com `grid`, aplica a configuração na grade ao salvar.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
applyToGrid?: boolean;
|
|
79
|
+
/** Mostra o campo de largura de cada coluna. @default true */
|
|
80
|
+
showWidth?: boolean;
|
|
81
|
+
/** Mostra os botões de fixar à esquerda/direita. @default true */
|
|
82
|
+
showPinning?: boolean;
|
|
83
|
+
/** Título do diálogo. @default "Configurar colunas" */
|
|
84
|
+
title?: string;
|
|
85
|
+
/** Idioma dos textos (sem ele, o da aplicação). */
|
|
86
|
+
lang?: EzLang | string;
|
|
87
|
+
/** Identificador para automação (`data-element-id`). */
|
|
88
|
+
elementId?: string;
|
|
89
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GridApi } from 'ag-grid-community';
|
|
2
|
+
import { EzGridConfig } from '../../../types/config';
|
|
3
|
+
import { EzGridConfigColumn, EzGridConfigDraftColumn } from './EzGridConfigDialog.types';
|
|
4
|
+
|
|
5
|
+
/** Colunas técnicas (seleção do AG Grid, status) que não entram na configuração nem na impressão. */
|
|
6
|
+
export declare function isTechnicalColumn(colId: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Colunas de uma grade (AG Grid) com o título do cabeçalho, sem as colunas
|
|
9
|
+
* técnicas. É o que o `EzGridConfigDialog` usa quando recebe só a `grid`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const columns = gridConfigColumnsFromApi(gridRef.current!.getGridApi()!);
|
|
13
|
+
*/
|
|
14
|
+
export declare function gridConfigColumnsFromApi(api: GridApi | undefined): EzGridConfigColumn[];
|
|
15
|
+
/**
|
|
16
|
+
* Junta as colunas oferecidas com a configuração: ordem da configuração
|
|
17
|
+
* (`orderIndex`), as colunas sem configuração no fim, visíveis (ou ocultas com
|
|
18
|
+
* `defaultHidden` quando `useDefaults`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildGridConfigDraft(columns: ReadonlyArray<EzGridConfigColumn>, config: EzGridConfig | undefined, useDefaults?: boolean): EzGridConfigDraftColumn[];
|
|
21
|
+
/** Padrão do "Restaurar padrão": a ordem de `columns`, visíveis (menos `defaultHidden`), sem fixação/largura. */
|
|
22
|
+
export declare function defaultGridConfigDraft(columns: ReadonlyArray<EzGridConfigColumn>): EzGridConfigDraftColumn[];
|
|
23
|
+
/**
|
|
24
|
+
* Linhas do diálogo → `EzGridConfig`. As entradas da configuração original
|
|
25
|
+
* que não estavam no diálogo (`preserve`) são mantidas no fim, sem mudança.
|
|
26
|
+
*/
|
|
27
|
+
export declare function gridConfigFromDraft(draft: ReadonlyArray<EzGridConfigDraftColumn>, preserve?: EzGridConfig): EzGridConfig;
|
|
28
|
+
/** Move o item `from` para a posição `to` (cópia nova). */
|
|
29
|
+
export declare function moveArrayItem<T>(list: ReadonlyArray<T>, from: number, to: number): T[];
|
|
30
|
+
/** Busca sem acento e sem caixa no rótulo, descrição e nome. */
|
|
31
|
+
export declare function matchesColumnSearch(column: EzGridConfigColumn, search: string): boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { EzGridConfigDialog } from './EzGridConfigDialog';
|
|
2
|
+
export type { EzGridConfigColumn, EzGridConfigDialogProps, EzGridConfigDraftColumn, EzGridConfigTarget } from './EzGridConfigDialog';
|
|
3
|
+
export { buildGridConfigDraft, defaultGridConfigDraft, gridConfigColumnsFromApi, gridConfigFromDraft, } from './gridConfigUtils';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Textos do EzGridConfigDialog (somados aos comuns de dados). */
|
|
2
|
+
export interface EzGridConfigDialogStrings {
|
|
3
|
+
title: string;
|
|
4
|
+
save: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
restoreDefault: string;
|
|
7
|
+
searchColumn: string;
|
|
8
|
+
showAll: string;
|
|
9
|
+
/** `{visible}` e `{total}`. */
|
|
10
|
+
visibleCount: string;
|
|
11
|
+
columnsLabel: string;
|
|
12
|
+
/** `{label}`. */
|
|
13
|
+
pinLeft: string;
|
|
14
|
+
/** `{label}`. */
|
|
15
|
+
pinRight: string;
|
|
16
|
+
/** `{label}`. */
|
|
17
|
+
width: string;
|
|
18
|
+
widthAuto: string;
|
|
19
|
+
/** `{label}`. */
|
|
20
|
+
moveUp: string;
|
|
21
|
+
/** `{label}`. */
|
|
22
|
+
moveDown: string;
|
|
23
|
+
noVisible: string;
|
|
24
|
+
alwaysVisible: string;
|
|
25
|
+
pinnedLeft: string;
|
|
26
|
+
pinnedRight: string;
|
|
27
|
+
hint: string;
|
|
28
|
+
filteringNoSort: string;
|
|
29
|
+
/** `{label}`, `{position}`, `{total}`. */
|
|
30
|
+
moved: string;
|
|
31
|
+
defaultRestored: string;
|
|
32
|
+
saveFailed: string;
|
|
33
|
+
}
|
|
34
|
+
/** Textos do EzGridConfigDialog no idioma resolvido. */
|
|
35
|
+
export declare const useGridConfigDialogStrings: (lang?: string) => import('../shared/strings').EzDataCommonStrings & EzGridConfigDialogStrings;
|