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

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
@@ -1006,6 +1006,29 @@ declare type ExecuteRequestParams<T> = {
1006
1006
  object?: T;
1007
1007
  };
1008
1008
 
1009
+ /**
1010
+ * The shape a CONSUMER sees when it reads a list-editor handle through a template/function ref.
1011
+ * Vue's `expose` proxy unwraps every exposed ref, so the reactive fields (`hasUnsaved`, `hasErrors`,
1012
+ * `unsavedCount`, …) arrive as plain VALUES here, not `Ref`s: read `handle.hasUnsaved` (a boolean),
1013
+ * never `handle.hasUnsaved.value` (that is `undefined`). Type your `useTemplateRef` / collected-ref
1014
+ * maps with this so a stray `.value` is a compile error instead of a silently-dead guard/save-gate.
1015
+ */
1016
+ export declare type ExposedListEditorHandle<TItem extends Record<string, any>> = ShallowUnwrapRef<ListEditorHandle<TItem>>;
1017
+
1018
+ /**
1019
+ * Consumer-facing shape of a nested-list-editor handle read through a template/function ref — Vue's
1020
+ * `expose` proxy unwraps the exposed refs, so read `handle.hasUnsaved` (a boolean), not
1021
+ * `handle.hasUnsaved.value`. See {@link ExposedListEditorHandle}.
1022
+ *
1023
+ * The `ANestedSortableListEditor` component also exposes `hasUnsavedChanges` (a legacy alias of
1024
+ * `hasUnsaved`, likewise a ComputedRef → unwrapped to a boolean here) — included so it can't be
1025
+ * `.value`-read by accident. Its imperative-only extras (addAfterId / resetDirtyBaseline / expand /
1026
+ * reorder / …) are not refs and carry no unwrap hazard; intersect them in the consumer if you call them.
1027
+ */
1028
+ export declare type ExposedNestedListEditorHandle<TItem extends Record<string, any>> = ShallowUnwrapRef<NestedListEditorHandle<TItem>> & {
1029
+ hasUnsavedChanges: boolean;
1030
+ };
1031
+
1009
1032
  declare type FetchByIdsParams = {
1010
1033
  urlTemplate?: string;
1011
1034
  urlParams?: UrlParams;
@@ -1207,19 +1230,14 @@ export declare interface ListEditorHandle<TItem extends Record<string, any>> {
1207
1230
  /** Clear a deferred-deletion tombstone (the caller re-inserts the row, e.g. reorder Cancel). */
1208
1231
  restoreDeleted: (key: ListEditorKey) => void;
1209
1232
  moveItem: (fromIndex: number, toIndex: number) => void;
1233
+ /** Drop the "moved" flag for the given keys (or all) without touching edits/adds — e.g. reorder Cancel. */
1234
+ clearMoved: (keys?: Iterable<ListEditorKey>) => void;
1210
1235
  /** Escape hatch: a row form (e.g. vuelidate) reports its own validity instead of `validate`. */
1211
1236
  registerValidity: (key: ListEditorKey, isValid: () => boolean) => () => void;
1212
1237
  }
1213
1238
 
1214
1239
  export declare type ListEditorKey = DocId | IntegerId | string;
1215
1240
 
1216
- export declare const ListEditorValidationKey: InjectionKey<ListEditorValidationRegistry>;
1217
-
1218
- export declare interface ListEditorValidationRegistry {
1219
- register: (key: ListEditorKey, state: Ref<ListEditorValidationState> | ComputedRef<ListEditorValidationState>) => void;
1220
- unregister: (key: ListEditorKey) => void;
1221
- }
1222
-
1223
1241
  /** Per-row validity. `true` (or `{ valid: true }`) = VALID. Only `valid: false` blocks save. */
1224
1242
  export declare type ListEditorValidationResult = boolean | {
1225
1243
  valid: boolean;
@@ -2107,9 +2125,14 @@ export declare function useFilterHelpers<F extends readonly MakeFilterOption<str
2107
2125
  * the view on an already-deleted entity (system error). This acknowledges the guard right before the
2108
2126
  * delete so the follow-up navigation proceeds without prompting. (QA 85050 batch 7 — BUG-08)
2109
2127
  *
2128
+ * If `onDelete` REJECTS (the delete failed and never navigated), the acknowledgement is undone
2129
+ * immediately (`unacknowledge()`) so a subsequently-dirtied navigation is still guarded (M1) — the
2130
+ * error is re-thrown so the caller's own handling runs. For this to catch failures, `onDelete` must
2131
+ * let its error propagate (don't swallow it in the action's try/catch).
2132
+ *
2110
2133
  * Usage: `@delete-record="guardedDelete(() => onDelete(id))"` or wrap the handler once.
2111
2134
  */
2112
- export declare function useGuardedDelete<A extends unknown[], R>(guard: Pick<UseUnsavedChangesGuardApi, 'acknowledge'>, onDelete: (...args: A) => R): (...args: A) => R;
2135
+ export declare function useGuardedDelete<A extends unknown[], R>(guard: Pick<UseUnsavedChangesGuardApi, 'acknowledge' | 'unacknowledge'>, onDelete: (...args: A) => R): (...args: A) => R | Promise<Awaited<R>>;
2113
2136
 
2114
2137
  export declare function useJobApi<JobType extends JobBase = JobBase>(client: () => AxiosInstance, system: string): {
2115
2138
  useFetchJobList: () => UseApiFetchListReturnType<JobType[]>;
@@ -2168,39 +2191,6 @@ export declare interface UseListEditorControllerOptions<TItem extends Record<str
2168
2191
  normalizeSaved?: (savedItems: TItem[]) => TItem[];
2169
2192
  }
2170
2193
 
2171
- export declare function useListEditorItemValidation(options: UseListEditorItemValidationOptions): void;
2172
-
2173
- declare interface UseListEditorItemValidationOptions {
2174
- /**
2175
- * Stable identity of the row in the editor's v-model. Pass a getter so the
2176
- * composable can re-register if the key ever swaps.
2177
- */
2178
- key: () => ListEditorKey;
2179
- /**
2180
- * Reactive validation state. Common shape: a computed reading vuelidate's
2181
- * `v$.$dirty && v$.$invalid` and returning 'invalid' or null.
2182
- *
2183
- * Prefer `invalid` (+ optional `dirty`) below: it lets the editor surface the
2184
- * error once the row is unsaved without relying on mount-relative `$anyDirty`.
2185
- * `state` is kept for callers that report 'valid'/'warning' or custom logic.
2186
- */
2187
- state?: Ref<ListEditorValidationState> | ComputedRef<ListEditorValidationState> | (() => ListEditorValidationState);
2188
- /**
2189
- * Whether the row's data fails validation right now (e.g. `() => v$.value.$invalid`).
2190
- * When provided, the row is flagged 'invalid' as soon as it is invalid AND the
2191
- * user has had a chance to fix it — i.e. the row is unsaved (added / modified)
2192
- * or `dirty` below is true. Untouched rows on initial load stay clear so a
2193
- * persisted-but-invalid record does not light up red before any interaction.
2194
- */
2195
- invalid?: () => boolean;
2196
- /**
2197
- * Optional extra "has been interacted with" signal OR-ed with the editor's
2198
- * unsaved tracking (e.g. `() => v$.value.$anyDirty`). Useful when unsaved
2199
- * tracking is disabled on the editor.
2200
- */
2201
- dirty?: () => boolean;
2202
- }
2203
-
2204
2194
  export declare interface UseListEditorOptions {
2205
2195
  keyField?: string;
2206
2196
  positionField?: string;
@@ -2208,25 +2198,6 @@ export declare interface UseListEditorOptions {
2208
2198
  updatePosition?: boolean;
2209
2199
  }
2210
2200
 
2211
- /**
2212
- * Registers a row's vuelidate state with the surrounding list editor so the
2213
- * row shows the red invalid rail (invalid + unsaved/dirty) instead of amber.
2214
- *
2215
- * This is the one blessed shape for row validity sentinels — domain sentinels
2216
- * call their validation composable and delegate here:
2217
- *
2218
- * ```ts
2219
- * const item = computed(() => props.modelValue)
2220
- * const { v$ } = useReviewListItemValidation(item)
2221
- * useListEditorVuelidateSentinel(v$, () => item.value.id ?? item.value.position)
2222
- * ```
2223
- *
2224
- * `key` must return the same key the editor resolves for the row
2225
- * (its `key-field`) or the item's own id/position — the editor's validation
2226
- * registry accepts either.
2227
- */
2228
- export declare function useListEditorVuelidateSentinel(v$: Ref<VuelidateSentinelSource>, key: () => ListEditorKey): void;
2229
-
2230
2201
  /**
2231
2202
  * Nested list editor core. Pure data behavior shared by ANestedSortableListEditor.
2232
2203
  * Works on a tree of `{ data, children, meta }` nodes — shape-compatible with the
@@ -2429,8 +2400,19 @@ declare interface UseUnsavedChangesGuardApi {
2429
2400
  * route/dialog/unload attempt proceeds without prompting. Useful right
2430
2401
  * before a programmatic navigation that the consumer has already
2431
2402
  * confirmed.
2403
+ *
2404
+ * The acknowledgement AUTO-EXPIRES after a few seconds if nothing consumes it
2405
+ * (see `ACKNOWLEDGE_TTL_MS`): a delete that acknowledges up-front but then FAILS
2406
+ * (throws, never navigates) must not leave the guard silently disarmed for the
2407
+ * next unrelated navigation. Consuming it (a real leave) clears the timer.
2432
2408
  */
2433
2409
  acknowledge: () => void;
2410
+ /**
2411
+ * Cancel a pending `acknowledge()` (disarm). Call from a delete's failure path
2412
+ * so a failed/aborted delete restores the guard immediately instead of waiting
2413
+ * for the TTL. No-op if nothing is acknowledged.
2414
+ */
2415
+ unacknowledge: () => void;
2434
2416
  }
2435
2417
 
2436
2418
  declare interface UseUnsavedChangesGuardOptions {
@@ -2505,15 +2487,6 @@ declare interface ViewBodySlotProps<TItem extends Record<string, any>> {
2505
2487
  };
2506
2488
  }
2507
2489
 
2508
- /**
2509
- * Minimal surface of a vuelidate instance the sentinel reads — any
2510
- * `useVuelidate()` return value is structurally assignable.
2511
- */
2512
- export declare interface VuelidateSentinelSource {
2513
- $invalid: boolean;
2514
- $anyDirty: boolean;
2515
- }
2516
-
2517
2490
  export { }
2518
2491
 
2519
2492
  declare global {