@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/dist/core.css +1 -1
- package/dist/form-flow/FormFlowPlayer.vue.d.ts +3 -1
- package/dist/form-flow/FormFlowPlayer.vue.d.ts.map +1 -1
- package/dist/form-flow/structure.d.ts +5 -0
- package/dist/form-flow/structure.d.ts.map +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.css +1 -1
- package/dist/index.mjs +720 -712
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/form-flow/FormFlowPlayer.vue +9 -1
- package/src/form-flow/structure.ts +6 -0
package/package.json
CHANGED
|
@@ -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: [] }
|