@anzusystems/common-admin 1.47.0-beta.dev-1782073999 → 1.47.0-beta.dev-1782075999

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/labs.d.ts CHANGED
@@ -1180,12 +1180,14 @@ export declare interface ListEditorChanges<TItem> {
1180
1180
  export declare interface ListEditorHandle<TItem extends Record<string, any>> {
1181
1181
  items: ComputedRef<TItem[]>;
1182
1182
  hasUnsaved: ComputedRef<boolean>;
1183
+ /** Count of distinct unconfirmed changes (added/edited/moved rows + deferred-deletion tombstones). */
1184
+ unsavedCount: ComputedRef<number>;
1183
1185
  hasErrors: ComputedRef<boolean>;
1184
1186
  invalidKeys: ComputedRef<Set<ListEditorKey>>;
1185
1187
  /** Amber: is this row added / edited / moved since the last commit? */
1186
1188
  isUnsaved: (key: ListEditorKey) => boolean;
1187
1189
  /** Red rail (gated): 'invalid' only once the row is unsaved or `validateAll()` ran. */
1188
- rowState: (item: TItem, key: ListEditorKey) => ListEditorValidationState;
1190
+ rowState: (item: TItem, key: ListEditorKey, editing?: boolean) => ListEditorValidationState;
1189
1191
  /** Force-show all invalid rows + return whether the list is valid. The save guard. */
1190
1192
  validateAll: () => boolean;
1191
1193
  /** Normalized ordered array for a full-DTO save. */
@@ -1196,9 +1198,14 @@ export declare interface ListEditorHandle<TItem extends Record<string, any>> {
1196
1198
  commit: (savedItems?: TItem[]) => void;
1197
1199
  /** Discard unsaved edits back to the last committed baseline (or given items). */
1198
1200
  reset: (items?: TItem[]) => void;
1199
- addItem: (item?: TItem, hint?: PositionHint) => void;
1201
+ addItem: (item?: TItem, hint?: PositionHint) => ListEditorKey | undefined;
1200
1202
  updateItem: (key: ListEditorKey, next: TItem | Partial<TItem> | ((current: TItem) => TItem)) => void;
1201
- deleteItem: (key: ListEditorKey) => void;
1203
+ /** Remove a row. `trackDeleted: false` (immediate mode) skips the deferred-deletion tombstone. */
1204
+ deleteItem: (key: ListEditorKey, opts?: {
1205
+ trackDeleted?: boolean;
1206
+ }) => void;
1207
+ /** Clear a deferred-deletion tombstone (the caller re-inserts the row, e.g. reorder Cancel). */
1208
+ restoreDeleted: (key: ListEditorKey) => void;
1202
1209
  moveItem: (fromIndex: number, toIndex: number) => void;
1203
1210
  /** Escape hatch: a row form (e.g. vuelidate) reports its own validity instead of `validate`. */
1204
1211
  registerValidity: (key: ListEditorKey, isValid: () => boolean) => () => void;
@@ -1308,12 +1315,14 @@ export declare interface NestedListEditorHandle<TItem extends Record<string, any
1308
1315
  /** Tree view rows (key/index/raw/depth/parent…), as consumed by the renderer. */
1309
1316
  viewItems: ComputedRef<NestedViewItem<TItem>[]>;
1310
1317
  hasUnsaved: ComputedRef<boolean>;
1318
+ /** Count of distinct unconfirmed changes (added/edited/moved/reparented rows + deferred deletions). */
1319
+ unsavedCount: ComputedRef<number>;
1311
1320
  hasErrors: ComputedRef<boolean>;
1312
1321
  invalidKeys: ComputedRef<Set<ListEditorKey>>;
1313
1322
  /** Amber: is this row added / edited / moved / reparented since the last commit? */
1314
1323
  isUnsaved: (key: ListEditorKey) => boolean;
1315
1324
  /** Red rail (gated): 'invalid' only once the row is unsaved or `validateAll()` ran. */
1316
- rowState: (item: TItem, key: ListEditorKey) => ListEditorValidationState;
1325
+ rowState: (item: TItem, key: ListEditorKey, editing?: boolean) => ListEditorValidationState;
1317
1326
  /** Force-show all invalid rows + return whether the tree is valid. The save guard. */
1318
1327
  validateAll: () => boolean;
1319
1328
  /** Flattened ordered array (each row carrying its resolved position + parent key) for a full-DTO save. */
@@ -1328,7 +1337,10 @@ export declare interface NestedListEditorHandle<TItem extends Record<string, any
1328
1337
  addAfter: (afterKey: ListEditorKey, item?: TItem, childrenAllowed?: boolean) => void;
1329
1338
  addChild: (parentKey: ListEditorKey, item?: TItem, childrenAllowed?: boolean) => void;
1330
1339
  updateItem: (key: ListEditorKey, data: TItem, markDirty?: boolean) => void;
1331
- deleteItem: (key: ListEditorKey) => void;
1340
+ deleteItem: (key: ListEditorKey, opts?: {
1341
+ trackDeleted?: boolean;
1342
+ }) => void;
1343
+ restoreDeleted: (key: ListEditorKey) => void;
1332
1344
  moveUp: (key: ListEditorKey) => boolean;
1333
1345
  moveDown: (key: ListEditorKey) => boolean;
1334
1346
  moveTop: (key: ListEditorKey) => boolean;
@@ -1493,6 +1505,13 @@ declare interface Props<TItem extends Record<string, any>> {
1493
1505
  disableUnsaved?: boolean;
1494
1506
  deleteConfirmTitle?: string | null;
1495
1507
  deleteConfirmText?: string | null;
1508
+ /**
1509
+ * How a row delete persists. `deferred` (default): the row disappears but the deletion counts as an
1510
+ * unconfirmed change (`unsavedCount`) until save, and is revertible until then. `immediate`: the
1511
+ * consumer deletes on the backend (`:on-delete`) — the dialog states it is irreversible and the
1512
+ * delete does NOT read as unsaved.
1513
+ */
1514
+ deleteMode?: 'immediate' | 'deferred';
1496
1515
  closeVariant?: 'auto' | 'icon' | 'labeled';
1497
1516
  /**
1498
1517
  * Render every `#item` slot expanded — no edit pencil, inline footer, or row-click
@@ -1573,6 +1592,12 @@ declare interface Props_2<TItem extends Record<string, any>> {
1573
1592
  disableDeleteConfirm?: boolean;
1574
1593
  deleteConfirmTitle?: string | null;
1575
1594
  deleteConfirmText?: string | null;
1595
+ /**
1596
+ * How a row delete persists. `deferred` (default): the row disappears but the deletion counts as an
1597
+ * unconfirmed change until save (revertible until then, incl. via reorder Cancel). `immediate`: the
1598
+ * consumer deletes on the backend — the dialog says it is irreversible and it does NOT read as unsaved.
1599
+ */
1600
+ deleteMode?: 'immediate' | 'deferred';
1576
1601
  closeVariant?: 'auto' | 'icon' | 'labeled';
1577
1602
  loadingKeys?: Set<ListEditorKey> | null;
1578
1603
  showReorderToggle?: boolean;
@@ -1667,6 +1692,12 @@ declare interface Props_3<TItem extends Record<string, any>> {
1667
1692
  disableDeleteConfirm?: boolean;
1668
1693
  deleteConfirmTitle?: string | null;
1669
1694
  deleteConfirmText?: string | null;
1695
+ /**
1696
+ * How a row delete persists. `deferred` (default): the row disappears but the deletion counts as an
1697
+ * unconfirmed change until save (revertible until then, incl. via reorder Cancel). `immediate`: the
1698
+ * consumer deletes on the backend — the dialog says it is irreversible and it does NOT read as unsaved.
1699
+ */
1700
+ deleteMode?: 'immediate' | 'deferred';
1670
1701
  closeVariant?: 'auto' | 'icon' | 'labeled';
1671
1702
  loadingKeys?: Set<ListEditorKey> | null;
1672
1703
  showReorderToggle?: boolean;
@@ -2066,6 +2097,20 @@ export declare function useFilterHelpers<F extends readonly MakeFilterOption<str
2066
2097
  } | null;
2067
2098
  };
2068
2099
 
2100
+ /**
2101
+ * Wrap an entity-delete handler so it bypasses the unsaved-changes leave guard.
2102
+ *
2103
+ * An entity delete destroys the record together with any unsaved edits, so the "you have unsaved
2104
+ * changes — really leave?" prompt that the delete's `router.push` would otherwise trigger is
2105
+ * meaningless: the user already confirmed the delete, and there is nothing left to keep. Without this
2106
+ * the delete runs, then the leave-guard fires on the post-delete navigation and choosing "stay" leaves
2107
+ * the view on an already-deleted entity (system error). This acknowledges the guard right before the
2108
+ * delete so the follow-up navigation proceeds without prompting. (QA 85050 batch 7 — BUG-08)
2109
+ *
2110
+ * Usage: `@delete-record="guardedDelete(() => onDelete(id))"` or wrap the handler once.
2111
+ */
2112
+ export declare function useGuardedDelete<A extends unknown[], R>(guard: Pick<UseUnsavedChangesGuardApi, 'acknowledge'>, onDelete: (...args: A) => R): (...args: A) => R;
2113
+
2069
2114
  export declare function useJobApi<JobType extends JobBase = JobBase>(client: () => AxiosInstance, system: string): {
2070
2115
  useFetchJobList: () => UseApiFetchListReturnType<JobType[]>;
2071
2116
  fetchJob: (id: number) => Promise<JobType>;