@omnitend/dashboard-for-laravel 0.39.0 → 0.41.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.
@@ -12,16 +12,31 @@ interface Props {
12
12
  minorUnits?: boolean;
13
13
  /** Input step in MAJOR units (default: one minor unit, e.g. 0.01). */
14
14
  step?: string | number;
15
+ /** Trailing affix shown after the input — the unit the amount is per
16
+ * ("Pint", "per case", "each"). Omit for no trailing cell. The `#append`
17
+ * slot overrides it when the affix needs to be more than a string. */
18
+ append?: string;
15
19
  }
16
- declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ declare var __VLS_14: {};
21
+ type __VLS_Slots = {} & {
22
+ append?: (props: typeof __VLS_14) => any;
23
+ };
24
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
25
  "update:modelValue": (value: number | null) => any;
18
26
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
19
27
  "onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
20
28
  }>, {
21
29
  currencySymbol: string;
30
+ append: string;
22
31
  modelValue: number | null;
23
32
  step: string | number;
24
33
  decimals: number;
25
34
  minorUnits: boolean;
26
35
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
27
37
  export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -331,8 +331,35 @@ export interface Props<TItem = any> {
331
331
  * `null`/`undefined` to proceed with the normal confirm + delete. Lets you
332
332
  * short-circuit a doomed delete (e.g. a record with dependents that the
333
333
  * server would reject) with an immediate, specific reason.
334
+ *
335
+ * AWAITED, so it may return a promise — the same shape as `saveGuard`, so
336
+ * an `async` guard behaves the way its author expects. A guard that throws
337
+ * also aborts, surfacing its message.
338
+ */
339
+ deleteGuard?: (item: TItem) => string | null | undefined | Promise<string | null | undefined>;
340
+ /**
341
+ * Guard run when the modal's Save/Create is clicked, before the request.
342
+ * Return a message to abort the save — it is shown immediately (as a toast)
343
+ * and no request is made; return `null`/`undefined` to proceed. Covers both
344
+ * the `editUrl` and `createUrl` paths.
345
+ *
346
+ * AWAITED (as `deleteGuard` is), so it may return a promise: the case it
347
+ * exists for is an async control in an `edit-value` slot — an image
348
+ * upload — that has not finished when Save is clicked. Without the guard the
349
+ * form submits the previous media map, the save SUCCEEDS, the toast says
350
+ * saved and the modal closes: the image is lost with no error anywhere,
351
+ * because every individual step worked. Await the upload here and the save
352
+ * simply waits for it.
353
+ *
354
+ * `item` is the row being edited, `null` in create mode (as in the
355
+ * `edit-value` slot's binding); `data` is the live form data. Aborting
356
+ * leaves the modal open with the user's edits intact. A guard that throws
357
+ * also aborts, surfacing its message.
358
+ *
359
+ * Dismissing the modal while the guard is still pending — by any route —
360
+ * abandons the save; nothing is written for a record the user has closed.
334
361
  */
335
- deleteGuard?: (item: TItem) => string | null | undefined;
362
+ saveGuard?: (item: TItem | null, data: Record<string, any>) => string | null | undefined | Promise<string | null | undefined>;
336
363
  /** API endpoint for creating new items (e.g., "/api/products") — enables "New" button */
337
364
  createUrl?: string;
338
365
  /**
@@ -23,8 +23,10 @@ export interface ResourceEditorProps<T = any> {
23
23
  deleteUrl?: string;
24
24
  /** `POST` endpoint for creating new items, e.g. `/api/products`. */
25
25
  createUrl?: string;
26
- /** Guard run before delete — a message short-circuits with a toast. */
27
- deleteGuard?: (item: T) => string | null | undefined;
26
+ /** Guard run before delete — a message short-circuits with a toast. Awaited. */
27
+ deleteGuard?: (item: T) => string | null | undefined | Promise<string | null | undefined>;
28
+ /** Guard run before save — a message aborts with a toast. Awaited. */
29
+ saveGuard?: (item: T | null, data: Record<string, any>) => string | null | undefined | Promise<string | null | undefined>;
28
30
  }
29
31
  /**
30
32
  * The events the editor emits back through DXTable's `emit`. Declared as the