@acvl/frontend-components 0.0.114 → 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
@@ -2561,6 +2561,12 @@ interface SharedFiltersConfig {
2561
2561
  key: string;
2562
2562
  /** Filter keys that stay with each grid — the tab's own `estado`, in an estado list. */
2563
2563
  exclude?: string[];
2564
+ /**
2565
+ * Where the group starts when the session has none yet — "my own records" for a CSR. Unlike
2566
+ * `initialState.filters`, which every grid re-applies on mount, these apply **once**: clear
2567
+ * them on one tab and the next tab doesn't put them back.
2568
+ */
2569
+ defaults?: MyGridFilterModel["items"];
2564
2570
  }
2565
2571
  interface ResolveInitialStateInput {
2566
2572
  storageKey: string;
@@ -2587,7 +2593,8 @@ interface ResolveInitialStateInput {
2587
2593
  * A grid in a shared-filters group takes its filters and search from the **group** instead of
2588
2594
  * its own saved state — that is what carries a filter picked on one tab over to the next. Only
2589
2595
  * the excluded keys still come from its own state, and the declared filters still win. Until
2590
- * the group has written anything (the first grid of the session), the grid's own state stands.
2596
+ * the group has written anything (the first grid of the session), it starts from its
2597
+ * `defaults` — or, without them, the grid's own state stands.
2591
2598
  */
2592
2599
  declare function resolveInitialState({ storageKey, disabled, initialState, columns, sharedFilters, }: ResolveInitialStateInput): ResolvedGridState;
2593
2600
 
@@ -4059,6 +4066,16 @@ interface DeleteGridColumnsProps {
4059
4066
  */
4060
4067
  declare const deleteColumn: (props: DeleteGridColumnsProps) => GridColDefPropsOverrides[];
4061
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
+
4062
4079
  interface DetailFormDrawerNavigation {
4063
4080
  /** Open the previous record of the list the drawer is walking. */
4064
4081
  onPrev: () => void;
@@ -4153,6 +4170,13 @@ interface DetailFormDrawerProps {
4153
4170
  * —ver `variant`—.
4154
4171
  */
4155
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;
4156
4180
  /**
4157
4181
  * Footer record navigator: prev/next arrows (Alt+↑ / Alt+↓) that step through a list of
4158
4182
  * sibling records — e.g. the rows of the grid the drawer was opened from — without
@@ -4256,7 +4280,14 @@ interface DetailFormDrawerProps {
4256
4280
  * deja el registro en pantalla y editando — para formularios que se capturan de a poco o que
4257
4281
  * llevan una grilla adentro.
4258
4282
  */
4259
- 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);
4260
4291
 
4261
4292
  interface DrawerGridDrawerConfig {
4262
4293
  /** Shared field layout, used by every mode. Same shape as `DetailPage_v2`'s `form`/`sections`. */
@@ -4333,6 +4364,14 @@ interface DrawerGridDrawerConfig {
4333
4364
  delete?: {
4334
4365
  mutation: any;
4335
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;
4336
4375
  };
4337
4376
  /**
4338
4377
  * Acciones propias del registro —las mismas que su página completa recibe en
@@ -4350,11 +4389,14 @@ interface DrawerGridDrawerConfig {
4350
4389
  * La ruta sale sola de la del registro, la misma que abre "ver en página completa" — que es
4351
4390
  * de donde la saca también la página, del `pathname`. En una grilla con
4352
4391
  * `showOpenFullPage: false` no hay ruta de la que sacarla, así que ahí hay que darla a mano
4353
- * 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}\``.
4354
4394
  *
4355
4395
  * @see DetailFormDrawerProps.historial
4356
4396
  */
4357
- historial?: DetailFormDrawerProps["historial"];
4397
+ historial?: Omit<NonNullable<DetailFormDrawerProps["historial"]>, "endpoint"> & {
4398
+ endpoint?: HistorialEndpoint;
4399
+ };
4358
4400
  /**
4359
4401
  * El estado del registro, junto al título de la cabecera del cajón —igual que en su página
4360
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.114",
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",