@bagelink/vue 1.15.447 → 1.15.450

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.15.447",
4
+ "version": "1.15.450",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -23,7 +23,7 @@ import { fromJSONSchema } from './form-flow'
23
23
  import type { JSONSchemaOptionsSourceLoader } from './form-flow'
24
24
  import Btn from '../components/Btn.vue'
25
25
  import FormFlow from './FormFlow.vue'
26
- import type { FormStepEventPayload } from './structure'
26
+ import type { FormStepCompleteEventPayload, FormStepEventPayload } from './structure'
27
27
  import { autoAdvanceFieldKey, entryStepKey, pathProgress, resolveNext, stepAutoAdvances, stepByKey } from './structure'
28
28
 
29
29
  export interface Props {
@@ -83,6 +83,8 @@ const emit = defineEmits<{
83
83
  'progress': [value: number]
84
84
  /** Fired when a step is entered (including the first). */
85
85
  'stepEnter': [payload: FormStepEventPayload]
86
+ /** Fired after approval, immediately before successful forward navigation. */
87
+ 'stepComplete': [payload: FormStepCompleteEventPayload]
86
88
  /** Fired when the form is submitted from a terminal step. */
87
89
  'formComplete': [payload: FormStepEventPayload]
88
90
  /** The form is about to redirect to `url` (fired even if `redirect` is off). */
@@ -227,6 +229,12 @@ async function onPrimary() {
227
229
  // Advance to the resolved next step.
228
230
  const target = nextKey.value
229
231
  if (target && currentKey.value) {
232
+ const destination = stepByKey(props.structure, target)
233
+ emit('stepComplete', {
234
+ ...buildPayload(currentKey.value),
235
+ destinationStepKey: target,
236
+ destinationStepTitle: destination?.title ?? '',
237
+ })
230
238
  slideDir.value = 'next'
231
239
  history.value.push(currentKey.value)
232
240
  currentKey.value = target
@@ -77,6 +77,12 @@ export interface FormStepEventPayload {
77
77
  formData: Record<string, any>
78
78
  }
79
79
 
80
+ /** A validated, approved transition from a completed step to its destination. */
81
+ export interface FormStepCompleteEventPayload extends FormStepEventPayload {
82
+ destinationStepKey: string
83
+ destinationStepTitle: string
84
+ }
85
+
80
86
  /** An empty structure (single-step / not-yet-built). */
81
87
  export function emptyStructure(): FormStructure {
82
88
  return { steps: [], transitions: [] }