frontend-plus-react 0.4.2 → 0.6.0

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/index.d.cts CHANGED
@@ -62,7 +62,7 @@ interface CellFeedback {
62
62
  }
63
63
  type CellFeedbackMap = Map<string, CellFeedback>;
64
64
  /** Lo que el manejo de teclas del editor necesita saber de la tecla (sirve para un evento real o uno encolado) */
65
- type TeclaDeEditor = Pick<React.KeyboardEvent, 'key' | 'target'>;
65
+ type TeclaDeEditor = Pick<React.KeyboardEvent, 'key' | 'target'> & Partial<Pick<React.KeyboardEvent, 'shiftKey' | 'ctrlKey' | 'altKey' | 'metaKey'>>;
66
66
  interface InputRendererProps<R extends FilaDeDatos, S> {
67
67
  column: Column<R, S>;
68
68
  row: R;
@@ -70,7 +70,8 @@ interface InputRendererProps<R extends FilaDeDatos, S> {
70
70
  onRowChange: (row: R, commitChanges?: boolean) => void;
71
71
  onClose: (commitChanges?: boolean, shouldFocusCell?: boolean) => void;
72
72
  tableDefinition: TableDefinition;
73
- onKeyPress?: (rowIndex: number, columnKey: string, event: TeclaDeEditor, handleCommit: (currentValue: unknown, closeEditor: boolean, focusNextCell: boolean) => Promise<void>) => void;
73
+ /** Con cada tecla del editor. `valorActual` es el texto que tiene el editor; devuelve true si la tecla la resolvió la grilla (dejó la celda) y hay que cancelar su efecto nativo */
74
+ onKeyPress?: (rowIndex: number, columnKey: string, event: TeclaDeEditor, handleCommit: (currentValue: unknown, closeEditor: boolean, focusNextCell: boolean) => Promise<void>, valorActual: unknown) => boolean;
74
75
  /** El editor se registra para recibir las teclas (F4) que caen en la celda antes de que él tenga el foco; devuelve la baja */
75
76
  registrarEditor?: (procesar: (key: string) => void) => () => void;
76
77
  setTableData: React.Dispatch<React.SetStateAction<FilaDeDatos[]>>;
@@ -93,6 +94,10 @@ interface FixedField {
93
94
  fieldName: string;
94
95
  value: unknown;
95
96
  until?: unknown;
97
+ /** Como en backend-plus (my-tables.js): un fixedField con `range` o `until` no fija el valor de la columna (la deja visible y editable) */
98
+ range?: boolean;
99
+ /** Como en backend-plus: el campo fijo no oculta su columna */
100
+ show?: boolean;
96
101
  }
97
102
  interface ConfirmDialogProps {
98
103
  open: boolean;
@@ -230,9 +235,23 @@ interface DataGridOption {
230
235
  visible?: boolean;
231
236
  }
232
237
 
238
+ /** Una condición de la fila de filtros: `operator` es uno de los de backend-plus (=, ~, !~, >, >=, <, <=, !=, ∅, !=∅, /R/i) */
239
+ interface FiltroInicial {
240
+ column: string;
241
+ operator: string;
242
+ value: unknown;
243
+ }
244
+
233
245
  interface GenericDataGridProps {
234
246
  tableName: string;
235
247
  fixedFields?: FixedField[];
248
+ /** Como en backend-plus (`fc` de la dirección o del menú): la fila de filtros con la que se abre la grilla */
249
+ filterColumns?: FiltroInicial[][];
250
+ /** `td`: lo que se le cambia a la definición de la tabla que manda el servidor */
251
+ tableDef?: Record<string, unknown>;
252
+ /** `pf` y `pick` de backend-plus: viajan con el pedido de datos */
253
+ parameterFunctions?: Record<string, unknown>;
254
+ pick?: string;
236
255
  /** Abre un detalle en otra pestaña (Ctrl+click o botón del medio en el botón del detalle) */
237
256
  onOpenDetail?: (tableName: string, fixedFields: FixedField[], label: string, ancestors: Ancestor[]) => void;
238
257
  gridStyles?: React$1.CSSProperties;
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ interface CellFeedback {
62
62
  }
63
63
  type CellFeedbackMap = Map<string, CellFeedback>;
64
64
  /** Lo que el manejo de teclas del editor necesita saber de la tecla (sirve para un evento real o uno encolado) */
65
- type TeclaDeEditor = Pick<React.KeyboardEvent, 'key' | 'target'>;
65
+ type TeclaDeEditor = Pick<React.KeyboardEvent, 'key' | 'target'> & Partial<Pick<React.KeyboardEvent, 'shiftKey' | 'ctrlKey' | 'altKey' | 'metaKey'>>;
66
66
  interface InputRendererProps<R extends FilaDeDatos, S> {
67
67
  column: Column<R, S>;
68
68
  row: R;
@@ -70,7 +70,8 @@ interface InputRendererProps<R extends FilaDeDatos, S> {
70
70
  onRowChange: (row: R, commitChanges?: boolean) => void;
71
71
  onClose: (commitChanges?: boolean, shouldFocusCell?: boolean) => void;
72
72
  tableDefinition: TableDefinition;
73
- onKeyPress?: (rowIndex: number, columnKey: string, event: TeclaDeEditor, handleCommit: (currentValue: unknown, closeEditor: boolean, focusNextCell: boolean) => Promise<void>) => void;
73
+ /** Con cada tecla del editor. `valorActual` es el texto que tiene el editor; devuelve true si la tecla la resolvió la grilla (dejó la celda) y hay que cancelar su efecto nativo */
74
+ onKeyPress?: (rowIndex: number, columnKey: string, event: TeclaDeEditor, handleCommit: (currentValue: unknown, closeEditor: boolean, focusNextCell: boolean) => Promise<void>, valorActual: unknown) => boolean;
74
75
  /** El editor se registra para recibir las teclas (F4) que caen en la celda antes de que él tenga el foco; devuelve la baja */
75
76
  registrarEditor?: (procesar: (key: string) => void) => () => void;
76
77
  setTableData: React.Dispatch<React.SetStateAction<FilaDeDatos[]>>;
@@ -93,6 +94,10 @@ interface FixedField {
93
94
  fieldName: string;
94
95
  value: unknown;
95
96
  until?: unknown;
97
+ /** Como en backend-plus (my-tables.js): un fixedField con `range` o `until` no fija el valor de la columna (la deja visible y editable) */
98
+ range?: boolean;
99
+ /** Como en backend-plus: el campo fijo no oculta su columna */
100
+ show?: boolean;
96
101
  }
97
102
  interface ConfirmDialogProps {
98
103
  open: boolean;
@@ -230,9 +235,23 @@ interface DataGridOption {
230
235
  visible?: boolean;
231
236
  }
232
237
 
238
+ /** Una condición de la fila de filtros: `operator` es uno de los de backend-plus (=, ~, !~, >, >=, <, <=, !=, ∅, !=∅, /R/i) */
239
+ interface FiltroInicial {
240
+ column: string;
241
+ operator: string;
242
+ value: unknown;
243
+ }
244
+
233
245
  interface GenericDataGridProps {
234
246
  tableName: string;
235
247
  fixedFields?: FixedField[];
248
+ /** Como en backend-plus (`fc` de la dirección o del menú): la fila de filtros con la que se abre la grilla */
249
+ filterColumns?: FiltroInicial[][];
250
+ /** `td`: lo que se le cambia a la definición de la tabla que manda el servidor */
251
+ tableDef?: Record<string, unknown>;
252
+ /** `pf` y `pick` de backend-plus: viajan con el pedido de datos */
253
+ parameterFunctions?: Record<string, unknown>;
254
+ pick?: string;
236
255
  /** Abre un detalle en otra pestaña (Ctrl+click o botón del medio en el botón del detalle) */
237
256
  onOpenDetail?: (tableName: string, fixedFields: FixedField[], label: string, ancestors: Ancestor[]) => void;
238
257
  gridStyles?: React$1.CSSProperties;