@omnitend/dashboard-for-laravel 0.47.0 → 0.47.2

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.
@@ -41,6 +41,20 @@ interface Props {
41
41
  hideLabel?: boolean;
42
42
  }
43
43
  declare function setValue(value: any): void;
44
+ /**
45
+ * `update` for the `span` and `value` slots (and so DXTable's `edit-span` /
46
+ * `edit-value`). Like a plain set, it clears the field's own error. When the
47
+ * value is an array whose rows changed (added, removed, replaced or
48
+ * reordered, compared by identity with the rows as last seen), it also
49
+ * clears every error under `<key>.` (`lines.3.price`), as the repeater's add
50
+ * and remove do: a per-row error would otherwise stay under whichever row
51
+ * now sits at its index. An update that keeps the same rows in the same
52
+ * order (a row editor writing the array back on each keystroke), or a
53
+ * value that is not an array (an `address` object), keeps the nested
54
+ * errors: they still name the right place. They come back on the next
55
+ * submit either way.
56
+ */
57
+ declare function setValueFromSlot(value: any): void;
44
58
  /**
45
59
  * The `password-actions` slot's handle on the reveal state: the same state
46
60
  * the eye toggles, so the two never disagree. Refused on a `revealable: false`
@@ -51,7 +65,7 @@ declare var __VLS_1: {
51
65
  field: FieldDefinition;
52
66
  model: any;
53
67
  value: any;
54
- update: typeof setValue;
68
+ update: typeof setValueFromSlot;
55
69
  }, __VLS_6: {
56
70
  field: FieldDefinition;
57
71
  model: any;
@@ -62,12 +76,12 @@ declare var __VLS_1: {
62
76
  field: FieldDefinition;
63
77
  model: any;
64
78
  value: any;
65
- update: typeof setValue;
79
+ update: typeof setValueFromSlot;
66
80
  }, __VLS_12: {
67
81
  field: FieldDefinition;
68
82
  model: any;
69
83
  value: any;
70
- update: typeof setValue;
84
+ update: typeof setValueFromSlot;
71
85
  }, __VLS_54: {
72
86
  option: FieldOption;
73
87
  on: boolean;
@@ -146,7 +146,11 @@ declare function goToErrorTab(): void;
146
146
  * its key whenever its element leaves the DOM (a re-render replacing it),
147
147
  * and a moment with none at all is waited out. When no marker renders
148
148
  * within the field's render frames, or nothing in it takes focus, focus
149
- * moves to the selected tab's button. Exposed so a summary rendered OUTSIDE
149
+ * moves to the selected tab's button. When the row the error named is gone
150
+ * (`focusKey` is the field's key while `errorKey` names something under it:
151
+ * the row was removed, replaced or soft-deleted), the field's container
152
+ * takes focus instead of a control, since every control in it belongs to
153
+ * another row (`focusFieldContainer`). Exposed so a summary rendered OUTSIDE
150
154
  * the form (DXTable's modal footer) can drive it.
151
155
  */
152
156
  declare function focusErrorTarget(target: ErrorSummarySelection): Promise<void>;
@@ -10,6 +10,16 @@ export interface ErrorSummarySelection {
10
10
  tabKey: string | null;
11
11
  /** The error key as the server sent it. */
12
12
  errorKey: string;
13
+ /**
14
+ * Where to take the user: the error key at the failed row's current
15
+ * index, or the field's key when that row is gone (see
16
+ * `ErrorTarget.focusKey`), when DXForm's `focusErrorTarget` focuses the
17
+ * field's container rather than any row's control. Equal to `errorKey`
18
+ * for everything else.
19
+ * Always emitted; optional so a selection built by hand for DXForm's
20
+ * exposed `focusErrorTarget` still types (it then uses `errorKey`).
21
+ */
22
+ focusKey?: string;
13
23
  }
14
24
  interface Props {
15
25
  /** The form: a `useForm` return or a `defineForm` return. */
@@ -15,6 +15,36 @@ export interface SubmitFailure {
15
15
  message: string;
16
16
  /** The validation errors the submit returned (`{}` when none). */
17
17
  errors: ValidationErrors;
18
+ /**
19
+ * The rows the errors named, keyed by row path: the path up to the
20
+ * key's FIRST numeric segment (`lines.2` for `lines.2.price` and for
21
+ * `lines.2.options.0.name`; a row nested inside a row is not recorded,
22
+ * since the summary follows the outer row). Absent when no error key
23
+ * names a row that exists in the form data. The error summary uses it
24
+ * to keep naming and finding the row that failed after rows are removed
25
+ * or reordered.
26
+ *
27
+ * The rows are read from the form data when the failure response
28
+ * ARRIVES, not when the request was sent. Rows added, removed or
29
+ * reordered while the request was in flight, or a submit `transform`
30
+ * that drops or reorders rows, can attach an error to the wrong row
31
+ * here, exactly as a bare index key always could.
32
+ */
33
+ failedRows?: Record<string, FailedRow>;
34
+ }
35
+ /** One row a failed submit's errors named (see `SubmitFailure.failedRows`). */
36
+ export interface FailedRow {
37
+ /**
38
+ * The row object itself (raw, not a reactive proxy), so its current
39
+ * index can be found by identity. A row array replaced wholesale (a
40
+ * reload) holds new objects, and the row then counts as gone.
41
+ */
42
+ row: object;
43
+ /**
44
+ * A copy of the row taken when the submit failed, for labels: a row's
45
+ * name (`rowLabel`) reads it, so later edits do not rename the error.
46
+ */
47
+ snapshot: Record<string, any>;
18
48
  }
19
49
  export interface FormSubmitOptions<TPayload = unknown, TResponse = unknown> {
20
50
  onSuccess?: (data: TResponse) => void;