@acvl/frontend-components 0.0.115 → 0.0.116

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.ts CHANGED
@@ -4066,6 +4066,16 @@ interface DeleteGridColumnsProps {
4066
4066
  */
4067
4067
  declare const deleteColumn: (props: DeleteGridColumnsProps) => GridColDefPropsOverrides[];
4068
4068
 
4069
+ /**
4070
+ * Una condición sobre el registro ya cargado, encima del permiso: lo que el registro mismo dice que
4071
+ * admite. La forma de `DetailExtraButton.display`, sin el contexto.
4072
+ *
4073
+ * Existe porque el permiso (`obj_permissions.edit` / `.delete`) no siempre basta: un superusuario
4074
+ * lo trae en todo, y hay registros que nadie corrige ni borra —un cobro automático de un viaje, que
4075
+ * lo escribe el sistema—. El servidor los rechaza igual; esto evita ofrecer el botón.
4076
+ */
4077
+ type RecordRule = (record: any) => boolean;
4078
+
4069
4079
  interface DetailFormDrawerNavigation {
4070
4080
  /** Open the previous record of the list the drawer is walking. */
4071
4081
  onPrev: () => void;
@@ -4160,6 +4170,13 @@ interface DetailFormDrawerProps {
4160
4170
  * —ver `variant`—.
4161
4171
  */
4162
4172
  historial?: DetailActionsProps["historial"];
4173
+ /**
4174
+ * Condición sobre el registro cargado para ofrecer **Editar** —el botón y el arranque en
4175
+ * edición (`startInEdit`)—, encima de su `obj_permissions.edit`. Sin ella, decide el permiso.
4176
+ */
4177
+ canEditRecord?: RecordRule;
4178
+ /** Lo mismo para **Eliminar**, encima de `obj_permissions.delete`. */
4179
+ canDeleteRecord?: RecordRule;
4163
4180
  /**
4164
4181
  * Footer record navigator: prev/next arrows (Alt+↑ / Alt+↓) that step through a list of
4165
4182
  * sibling records — e.g. the rows of the grid the drawer was opened from — without
@@ -4263,7 +4280,14 @@ interface DetailFormDrawerProps {
4263
4280
  * deja el registro en pantalla y editando — para formularios que se capturan de a poco o que
4264
4281
  * llevan una grilla adentro.
4265
4282
  */
4266
- declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, initialTab, permissionsPath, onSuccess, keepOpenOnSave, extraButtons, historial, navigation, width, anchor, variant, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, responsiveTo, containerBreakpoints, storageScope, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
4283
+ declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, initialTab, permissionsPath, onSuccess, keepOpenOnSave, extraButtons, historial, canEditRecord, canDeleteRecord, navigation, width, anchor, variant, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, responsiveTo, containerBreakpoints, storageScope, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
4284
+
4285
+ /**
4286
+ * La ruta del historial de un registro: fija, o armada con su id. La armada es para las grillas sin
4287
+ * página completa (`showOpenFullPage: false`), donde no hay ruta del registro de la que sacarla —un
4288
+ * cobro de un viaje, que vive dentro del viaje—: `(id) => \`/viajes/cobros/${id}\``.
4289
+ */
4290
+ type HistorialEndpoint = string | ((id: GridRowId) => string);
4267
4291
 
4268
4292
  interface DrawerGridDrawerConfig {
4269
4293
  /** Shared field layout, used by every mode. Same shape as `DetailPage_v2`'s `form`/`sections`. */
@@ -4340,6 +4364,14 @@ interface DrawerGridDrawerConfig {
4340
4364
  delete?: {
4341
4365
  mutation: any;
4342
4366
  };
4367
+ /**
4368
+ * Condición sobre el registro cargado para ofrecer **Editar**, encima de su
4369
+ * `obj_permissions.edit`. Sin ella, decide el permiso, como siempre. Para registros
4370
+ * que el permiso deja tocar pero que nadie corrige —lo que escribe el sistema—.
4371
+ */
4372
+ canEdit?: RecordRule;
4373
+ /** Lo mismo para **Eliminar**, encima de `obj_permissions.delete`. */
4374
+ canDelete?: RecordRule;
4343
4375
  };
4344
4376
  /**
4345
4377
  * Acciones propias del registro —las mismas que su página completa recibe en
@@ -4357,11 +4389,14 @@ interface DrawerGridDrawerConfig {
4357
4389
  * La ruta sale sola de la del registro, la misma que abre "ver en página completa" — que es
4358
4390
  * de donde la saca también la página, del `pathname`. En una grilla con
4359
4391
  * `showOpenFullPage: false` no hay ruta de la que sacarla, así que ahí hay que darla a mano
4360
- * o el historial no se ofrece.
4392
+ * o el historial no se ofrece: fija, o **armada con el id** del registro abierto,
4393
+ * `(id) => \`/viajes/cobros/${id}\``.
4361
4394
  *
4362
4395
  * @see DetailFormDrawerProps.historial
4363
4396
  */
4364
- historial?: DetailFormDrawerProps["historial"];
4397
+ historial?: Omit<NonNullable<DetailFormDrawerProps["historial"]>, "endpoint"> & {
4398
+ endpoint?: HistorialEndpoint;
4399
+ };
4365
4400
  /**
4366
4401
  * El estado del registro, junto al título de la cabecera del cajón —igual que en su página
4367
4402
  * completa—. `path` es la ruta al campo dentro del dato, que el backend manda como
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acvl/frontend-components",
3
- "version": "0.0.115",
3
+ "version": "0.0.116",
4
4
  "description": "Component library for ACV frontend projects.",
5
5
  "homepage": "https://github.com/ACV-Logistics/acv-frontend-components#readme",
6
6
  "access": "public",