@bach.software/vue-dynamic-form 0.5.0 → 0.6.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.
- package/dist/examples.cjs.js +6 -6
- package/dist/examples.cjs.js.map +1 -1
- package/dist/examples.es.js +1643 -280
- package/dist/examples.es.js.map +1 -1
- package/dist/mapEachMetadataItem-Cxfn86Z2.cjs +2 -0
- package/dist/mapEachMetadataItem-Cxfn86Z2.cjs.map +1 -0
- package/dist/mapEachMetadataItem-Dvf3R5jd.js +1159 -0
- package/dist/mapEachMetadataItem-Dvf3R5jd.js.map +1 -0
- package/dist/src/components/DynamicFormItemWizard.vue.d.ts +25 -0
- package/dist/src/components/DynamicFormTemplate.vue.d.ts +97 -4
- package/dist/src/components/__tests__/DynamicFormItem.unmount.logic.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemArray.analytics.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemArray.test-helpers.d.ts +9 -0
- package/dist/src/components/__tests__/DynamicFormItemChoice.analytics.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemChoice.test-helpers.d.ts +100 -0
- package/dist/src/components/__tests__/DynamicFormItemWizard.analytics.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemWizard.logic.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormItemWizard.test-helpers.d.ts +24 -0
- package/dist/src/components/__tests__/DynamicFormItemWizard.validation.test.d.ts +1 -0
- package/dist/src/components/__tests__/DynamicFormTemplate.test.d.ts +1 -0
- package/dist/src/core/validation.d.ts +8 -2
- package/dist/src/examples/KeepValuesOnUnmountTestCase.vue.d.ts +2 -0
- package/dist/src/examples/TestForm.vue.d.ts +1 -0
- package/dist/src/examples/TestFormTemplate.vue.d.ts +48 -13
- package/dist/src/examples/__tests__/TestFormTemplate.testcases.d.ts +2317 -7
- package/dist/src/examples/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/types/DynamicFormItemProps.d.ts +39 -2
- package/dist/src/types/DynamicFormSettings.d.ts +16 -0
- package/dist/src/types/FieldMetadata.d.ts +123 -1
- package/dist/src/utils/__tests__/deepCloneValue.test.d.ts +1 -0
- package/dist/src/utils/__tests__/mapEachMetadataItem.test.d.ts +1 -1
- package/dist/src/utils/deepCloneValue.d.ts +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vue-dynamic-form.cjs.js +1 -1
- package/dist/vue-dynamic-form.es.js +28 -27
- package/package.json +6 -4
- package/dist/mapEachMetadataItem-B4xJvJDj.js +0 -732
- package/dist/mapEachMetadataItem-B4xJvJDj.js.map +0 -1
- package/dist/mapEachMetadataItem-CDDSsb0c.cjs +0 -6
- package/dist/mapEachMetadataItem-CDDSsb0c.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FieldContext as _FieldContext } from 'vee-validate';
|
|
2
2
|
import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
3
3
|
import type { DynamicFormSettings } from '../types/DynamicFormSettings';
|
|
4
|
-
import type { ReadOnlyFieldType } from '../types/FieldMetadata';
|
|
4
|
+
import type { ReadOnlyFieldType, WizardConfig, WizardGotoStepOptions } from '../types/FieldMetadata';
|
|
5
5
|
import type { MetadataConfiguration } from '../types/MetadataConfiguration';
|
|
6
6
|
export interface FieldContext<TValue = unknown> extends _FieldContext<TValue> {
|
|
7
7
|
/**
|
|
@@ -29,7 +29,7 @@ export interface LimitedFieldContext<TValue = unknown> {
|
|
|
29
29
|
* public prop signature of the user-facing DynamicFormTemplate component.
|
|
30
30
|
*/
|
|
31
31
|
export interface Attributes<TMetadataConfiguration extends MetadataConfiguration> {
|
|
32
|
-
type: TMetadataConfiguration['fieldTypes'][number] | 'default' | 'default-array' | 'default-array-item' | 'default-choice';
|
|
32
|
+
type: TMetadataConfiguration['fieldTypes'][number] | 'default' | 'default-array' | 'default-array-item' | 'default-choice' | 'default-choice-array' | 'default-choice-array-item' | 'default-wizard' | 'default-wizard-page';
|
|
33
33
|
/** The metadata you configured for this field. */
|
|
34
34
|
fieldMetadata: ReadOnlyFieldType<TMetadataConfiguration['fieldTypes'][number], TMetadataConfiguration['extendedProperties']>;
|
|
35
35
|
/** Whether the field is required. */
|
|
@@ -72,6 +72,91 @@ export interface ItemAttributes<TMetadataConfiguration extends MetadataConfigura
|
|
|
72
72
|
export interface ArrayChoiceAttributes<TMetadataConfiguration extends MetadataConfiguration> extends Attributes<TMetadataConfiguration> {
|
|
73
73
|
fieldContext: LimitedFieldContext<unknown[]>;
|
|
74
74
|
}
|
|
75
|
+
/** An active branch occurrence, as reported by `activeChoiceOccurrences`. */
|
|
76
|
+
export interface ChoiceOccurrence {
|
|
77
|
+
/** The choice branch's `name` (e.g. 'selfServe', 'apiEndpoint'). */
|
|
78
|
+
branchKey: string;
|
|
79
|
+
/** 0 for maxOccurs:1; the occurrence's index within its branch for maxOccurs > 1. */
|
|
80
|
+
index: number;
|
|
81
|
+
}
|
|
82
|
+
export interface ChoiceAttributes<TMetadataConfiguration extends MetadataConfiguration> extends ArrayChoiceAttributes<TMetadataConfiguration> {
|
|
83
|
+
/** Mark a branch active (maxOccurs:1) or add one occurrence of it (maxOccurs > 1). No-op when canAddChoiceOccurrence is false. */
|
|
84
|
+
addChoiceOccurrence: (branchKey: string) => void;
|
|
85
|
+
/** Remove a previously added occurrence. index is required in maxOccurs > 1; ignored (optional) in maxOccurs:1 where it deselects the active branch. */
|
|
86
|
+
removeChoiceOccurrence: (branchKey: string, index?: number) => void;
|
|
87
|
+
/** Per-branch guard: false when this branch's own maxOccurs or the choice's shared occurrence budget is exhausted, or when the choice is disabled. */
|
|
88
|
+
canAddChoiceOccurrence: (branchKey: string) => boolean;
|
|
89
|
+
/** The currently active occurrences the template iterates for counts/selector state. */
|
|
90
|
+
activeChoiceOccurrences: ChoiceOccurrence[];
|
|
91
|
+
/**
|
|
92
|
+
* Choice slots currently consumed, in choice-occurrence units rather than raw item count.
|
|
93
|
+
* For a repeatable branch (its own `maxOccurs > 1`), every group of up to that many items
|
|
94
|
+
* counts as one slot, the same unit `maxOccurs` on the choice itself is measured in, so a
|
|
95
|
+
* template can show an accurate "N of maxOccurs" without re-deriving the batching math.
|
|
96
|
+
*/
|
|
97
|
+
usedChoiceOccurrences: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Slot props for a single occurrence of a repeatable explicit choice (`maxOccurs > 1`), rendered
|
|
101
|
+
* through the `*-choice-array-item` / `default-choice-array-item` slot. Mirrors `ItemAttributes`
|
|
102
|
+
* (the same shape `*-array-item` receives) plus `branchKey`, the occurrence's branch name (drives
|
|
103
|
+
* a "kind" badge in the template).
|
|
104
|
+
*/
|
|
105
|
+
export interface ChoiceArrayItemAttributes<TMetadataConfiguration extends MetadataConfiguration, FieldType extends string = string> extends ItemAttributes<TMetadataConfiguration, FieldType> {
|
|
106
|
+
/** The choice branch this occurrence belongs to (the child's `name`). Drives the "kind" badge. */
|
|
107
|
+
branchKey: string;
|
|
108
|
+
/**
|
|
109
|
+
* This occurrence's zero-based position across every branch's active occurrences, in the same
|
|
110
|
+
* order `activeChoiceOccurrences` reports them (grouped by branch declaration order, then by
|
|
111
|
+
* index within branch). Renumbers live when an occurrence is removed; never stored.
|
|
112
|
+
*/
|
|
113
|
+
globalIndex: number;
|
|
114
|
+
/**
|
|
115
|
+
* This occurrence's ephemeral, instance-local add-order position (1-based, in add-press order
|
|
116
|
+
* across every branch), set only when it was added via `addChoiceOccurrence` this session.
|
|
117
|
+
* `undefined` for an occurrence that already existed when the form mounted (loaded saved data).
|
|
118
|
+
* Gone on remount; never stored in form values.
|
|
119
|
+
*/
|
|
120
|
+
insertionOrder?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Slot props for the wizard container (`<type>-wizard` / `default-wizard`). `pages` is the
|
|
124
|
+
* engine's resolved page list (the corrected page metadata nodes, in page order): the single
|
|
125
|
+
* source of truth for a stepper, so a template never re-derives `fieldMetadata.children` itself.
|
|
126
|
+
*/
|
|
127
|
+
export interface WizardAttributes<TMetadataConfiguration extends MetadataConfiguration> extends Attributes<TMetadataConfiguration> {
|
|
128
|
+
fieldContext: LimitedFieldContext;
|
|
129
|
+
currentStepIndex: number;
|
|
130
|
+
pages: ReadOnlyFieldType<TMetadataConfiguration['fieldTypes'][number], TMetadataConfiguration['extendedProperties']>[];
|
|
131
|
+
pageCount: number;
|
|
132
|
+
isFirst: boolean;
|
|
133
|
+
isLast: boolean;
|
|
134
|
+
isValidating: boolean;
|
|
135
|
+
/** The wizard's navigation config with defaults applied, so a stepper reflects the resolved mode (e.g. enable forward jumps when `allowForwardJump`) without re-reading `fieldMetadata.wizard` or re-deriving defaults. */
|
|
136
|
+
wizardConfig: Required<WizardConfig>;
|
|
137
|
+
next: () => Promise<void>;
|
|
138
|
+
prev: () => void;
|
|
139
|
+
gotoStep: (index: number, options?: WizardGotoStepOptions) => Promise<void> | void;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Slot props for a single wizard page (`<type>-wizard-page` / `default-wizard-page`). Delivered
|
|
143
|
+
* for every page, not only the current one; the template gates visibility with `isCurrent`
|
|
144
|
+
* (`v-show`, never `v-if`: `v-if` deregisters the page's fields from vee-validate regardless of
|
|
145
|
+
* `keepValuesOnUnmount`, and also clears their values unless that flag is set, so `v-show` stays
|
|
146
|
+
* required for any page with fields).
|
|
147
|
+
*/
|
|
148
|
+
export interface WizardPageAttributes<TMetadataConfiguration extends MetadataConfiguration> extends Attributes<TMetadataConfiguration> {
|
|
149
|
+
isCurrent: boolean;
|
|
150
|
+
pageIndex: number;
|
|
151
|
+
currentStepIndex: number;
|
|
152
|
+
isFirst: boolean;
|
|
153
|
+
isLast: boolean;
|
|
154
|
+
/** The wizard's navigation config with defaults applied (same object as the container slot), so a page can build its own mode-aware controls. */
|
|
155
|
+
wizardConfig: Required<WizardConfig>;
|
|
156
|
+
next: () => Promise<void>;
|
|
157
|
+
prev: () => void;
|
|
158
|
+
gotoStep: (index: number, options?: WizardGotoStepOptions) => Promise<void> | void;
|
|
159
|
+
}
|
|
75
160
|
declare const _default: <TMetadataConfiguration extends MetadataConfiguration>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
76
161
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & DynamicFormConfigurationProps<TMetadataConfiguration> & Partial<{}>> & import("vue").PublicProps;
|
|
77
162
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
@@ -85,8 +170,16 @@ declare const _default: <TMetadataConfiguration extends MetadataConfiguration>(_
|
|
|
85
170
|
} & {
|
|
86
171
|
'default-array-item': (props: ItemAttributes<TMetadataConfiguration, string>) => any;
|
|
87
172
|
} & {
|
|
88
|
-
'default-choice': (props:
|
|
89
|
-
} & {
|
|
173
|
+
'default-choice': (props: ChoiceAttributes<TMetadataConfiguration>) => any;
|
|
174
|
+
} & {
|
|
175
|
+
'default-choice-array': (props: ChoiceAttributes<TMetadataConfiguration>) => any;
|
|
176
|
+
} & {
|
|
177
|
+
'default-choice-array-item': (props: ChoiceArrayItemAttributes<TMetadataConfiguration, string>) => any;
|
|
178
|
+
} & {
|
|
179
|
+
'default-wizard': (props: WizardAttributes<TMetadataConfiguration>) => any;
|
|
180
|
+
} & {
|
|
181
|
+
'default-wizard-page': (props: WizardPageAttributes<TMetadataConfiguration>) => any;
|
|
182
|
+
} & { [K in TMetadataConfiguration["fieldTypes"][number]]: (props: ItemAttributes<TMetadataConfiguration, K>) => any; } & { [K_1 in `${TMetadataConfiguration["fieldTypes"][number]}-input`]: (props: ItemAttributes<TMetadataConfiguration, K_1 extends `${infer FieldType}-input` ? FieldType : never>) => any; } & { [K_2 in `${TMetadataConfiguration["fieldTypes"][number]}-array`]: (props: ArrayChoiceAttributes<TMetadataConfiguration>) => any; } & { [K_3 in `${TMetadataConfiguration["fieldTypes"][number]}-array-item`]: (props: ItemAttributes<TMetadataConfiguration, K_3 extends `${infer FieldType}-input` ? FieldType : never>) => any; } & { [K_4 in `${TMetadataConfiguration["fieldTypes"][number]}-choice`]: (props: ChoiceAttributes<TMetadataConfiguration>) => any; } & { [K_5 in `${TMetadataConfiguration["fieldTypes"][number]}-choice-array`]: (props: ChoiceAttributes<TMetadataConfiguration>) => any; } & { [K_6 in `${TMetadataConfiguration["fieldTypes"][number]}-choice-array-item`]: (props: ChoiceArrayItemAttributes<TMetadataConfiguration, K_6 extends `${infer FieldType}-choice-array-item` ? FieldType : never>) => any; } & { [K_7 in `${TMetadataConfiguration["fieldTypes"][number]}-wizard`]: (props: WizardAttributes<TMetadataConfiguration>) => any; } & { [K_8 in `${TMetadataConfiguration["fieldTypes"][number]}-wizard-page`]: (props: WizardPageAttributes<TMetadataConfiguration>) => any; };
|
|
90
183
|
emit: {};
|
|
91
184
|
}>) => import("vue").VNode & {
|
|
92
185
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { mount } from '@vue/test-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Accesses the internal `<script setup>` state of the DynamicFormItemArray registered at `path`.
|
|
4
|
+
* Mirrors `DynamicFormItem.test-helpers.ts`'s `setupState`, reaching into `vm.$.setupState` for
|
|
5
|
+
* private state not exposed via `defineExpose`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupState(wrapper: ReturnType<typeof mount>, path: string): Record<string, any> | undefined;
|
|
8
|
+
/** Reads how many times the array's `combinedValidation` computed has run. Returns -1 if the array is not found. */
|
|
9
|
+
export declare function arrayConstructValidationCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { mount } from '@vue/test-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Accesses the internal `<script setup>` state of the DynamicFormItemChoice registered at `path`
|
|
4
|
+
* (matched via its `normalizedPath` setup variable). Mirrors `DynamicFormItem.test-helpers.ts`'s
|
|
5
|
+
* `setupState`, reaching into `vm.$.setupState` for private state not exposed via `defineExpose`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupState(wrapper: ReturnType<typeof mount>, path: string): Record<string, any> | undefined;
|
|
8
|
+
/** Finds the DynamicFormItemChoice instance registered at `path` (its `normalizedPath`). */
|
|
9
|
+
export declare function findDynamicFormItemChoiceByPath(wrapper: ReturnType<typeof mount>, path: string): import("@vue/test-utils").VueWrapper<any, any> | undefined;
|
|
10
|
+
/** Reads `activeChoiceOccurrences` for the choice at `path`. Returns undefined if the choice is not found. */
|
|
11
|
+
export declare function activeChoiceOccurrences(wrapper: ReturnType<typeof mount>, path: string): {
|
|
12
|
+
branchKey: string;
|
|
13
|
+
index: number;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
/** Reads `explicitlySelectedBranch` for the choice at `path`. Returns undefined if the choice is not found. */
|
|
16
|
+
export declare function explicitlySelectedBranch(wrapper: ReturnType<typeof mount>, path: string): string | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the ephemeral preserve-on-switch stash for the choice at `path`. Returns
|
|
19
|
+
* undefined if the choice is not found. Best-effort internal-state reader: it names the stash
|
|
20
|
+
* ref directly for tests that want a stronger assertion than the observable restore
|
|
21
|
+
* behaviour alone.
|
|
22
|
+
*/
|
|
23
|
+
export declare function stashedBranchValues(wrapper: ReturnType<typeof mount>, path: string): Record<string, unknown> | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Patches fixture metadata to enable preserve-on-switch on the choice at `branchKey`
|
|
26
|
+
* (the choice's own `name`, e.g. `'pick'`). Centralises the flag surface (the `FieldMetadata`
|
|
27
|
+
* boolean `preserveOnSwitch`) so tests do not hardcode a property name directly.
|
|
28
|
+
*/
|
|
29
|
+
export declare function enablePreserveOnSwitch<T>(metadata: T[], choicePath: string, enabled?: boolean): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Reads the `childValues` entry for `branchKey` at the choice registered at `path`, resolving the
|
|
32
|
+
* branch name to its internal numeric index via the choice's own metadata.
|
|
33
|
+
*/
|
|
34
|
+
export declare function childValuesEntry(wrapper: ReturnType<typeof mount>, path: string, branchKey: string): {
|
|
35
|
+
occurrences: number;
|
|
36
|
+
valuesCount: number;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Reads the `-kind-badge` testid text at `occurrencePath` (e.g. `pick.apiEndpoint[0]`), asserting
|
|
40
|
+
* the `*-choice-array-item`/`default-choice-array-item` slot actually received `branchKey` as a real slot
|
|
41
|
+
* prop, rather than the test inferring it from the path itself.
|
|
42
|
+
*/
|
|
43
|
+
export declare function occurrenceBranchKey(wrapper: ReturnType<typeof mount>, occurrencePath: string): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Reads the `-global-index` testid at `occurrencePath` (e.g. `pick.apiEndpoint[0]`), asserting
|
|
46
|
+
* the `*-choice-array-item`/`default-choice-array-item` slot actually received `globalIndex` as a
|
|
47
|
+
* real slot prop, rather than the test inferring it from the path itself. Mirrors
|
|
48
|
+
* `occurrenceBranchKey`'s rationale.
|
|
49
|
+
*/
|
|
50
|
+
export declare function occurrenceGlobalIndex(wrapper: ReturnType<typeof mount>, occurrencePath: string): number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Reads the fixture's per-branch add-choice button `disabled` attribute for `branchKey` at the
|
|
53
|
+
* choice rendered at `choicePath`, exercising `canAddChoiceOccurrence` through the real public
|
|
54
|
+
* slot-prop contract (the same indirection used elsewhere in this suite), not a `setupState()` reach-in.
|
|
55
|
+
*/
|
|
56
|
+
export declare function canAddChoiceOccurrence(wrapper: ReturnType<typeof mount>, choicePath: string, branchKey: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Reads the `usedChoiceOccurrences` slot prop for the choice rendered at `choicePath`, through
|
|
59
|
+
* the fixture's real public slot-prop contract (the same indirection `canAddChoiceOccurrence`
|
|
60
|
+
* above uses), not a `setupState()` reach-in.
|
|
61
|
+
*/
|
|
62
|
+
export declare function usedChoiceOccurrences(wrapper: ReturnType<typeof mount>, choicePath: string): number | undefined;
|
|
63
|
+
/** Reads the number of rules currently present in `combinedValidation` for the choice at `path`. */
|
|
64
|
+
export declare function combinedValidationCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
65
|
+
/** Reads the `maxOccursTotalBreach` computed (the offending branch's cap, or undefined) for the choice at `path`. */
|
|
66
|
+
export declare function maxOccursTotalBreach(wrapper: ReturnType<typeof mount>, path: string): number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Reads the `-insertion-order` testid at `occurrencePath` (e.g. `pick.apiEndpoint[0]`), asserting
|
|
69
|
+
* the `*-choice-array-item`/`default-choice-array-item` slot actually received `insertionOrder` as
|
|
70
|
+
* a real slot prop. Unlike `occurrenceGlobalIndex`, the testid is conditionally rendered (the
|
|
71
|
+
* fixture's `v-if`), so its absence (an occurrence never added this session) reads back as
|
|
72
|
+
* `undefined` rather than a rendered "undefined" string.
|
|
73
|
+
*/
|
|
74
|
+
export declare function occurrenceInsertionOrder(wrapper: ReturnType<typeof mount>, occurrencePath: string): number | undefined;
|
|
75
|
+
/** Reads the internal `renderedChoiceOccurrences` computed for the choice at `path`. Returns undefined if the choice is not found. */
|
|
76
|
+
export declare function renderedChoiceOccurrences(wrapper: ReturnType<typeof mount>, path: string): {
|
|
77
|
+
branchKey: string;
|
|
78
|
+
index: number;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Reads the ephemeral `insertionOrders` map for the choice at `path`. Returns undefined if the
|
|
82
|
+
* choice is not found. Best-effort internal-state reader, mirroring `stashedBranchValues`'s
|
|
83
|
+
* rationale: it names the store directly so a test can assert it is instance-local (a plain `Map`,
|
|
84
|
+
* never anything reachable through form `values`), a stronger check than the observable slot-prop
|
|
85
|
+
* values alone.
|
|
86
|
+
*/
|
|
87
|
+
export declare function insertionOrdersMap(wrapper: ReturnType<typeof mount>, path: string): Map<string, number> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Patches fixture metadata to set `displayOrder` on the choice at `choicePath` (the choice's own
|
|
90
|
+
* `name`, e.g. `'pick'`). Centralises the flag surface (the `FieldMetadata` property
|
|
91
|
+
* `displayOrder`) so tests do not hardcode the property name, mirroring `enablePreserveOnSwitch`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function enableDisplayOrder<T>(metadata: T[], choicePath: string, mode?: 'grouped' | 'added'): T[];
|
|
94
|
+
/**
|
|
95
|
+
* Patches fixture metadata to enable `preserveOrder` on the choice at `choicePath` (the choice's
|
|
96
|
+
* own `name`, e.g. `'pick'`). Centralises the flag surface (the `FieldMetadata` boolean
|
|
97
|
+
* `preserveOrder`) so tests do not hardcode a property name directly, mirroring
|
|
98
|
+
* `enablePreserveOnSwitch`/`enableDisplayOrder` field-for-field.
|
|
99
|
+
*/
|
|
100
|
+
export declare function enablePreserveOrder<T>(metadata: T[], choicePath: string, enabled?: boolean): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { mount } from '@vue/test-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Accesses the internal `<script setup>` state of the DynamicFormItemWizard registered at `path`
|
|
4
|
+
* (matched via its `normalizedPath` setup variable). Mirrors `DynamicFormItemChoice.test-helpers.ts`'s
|
|
5
|
+
* `setupState`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupState(wrapper: ReturnType<typeof mount>, path: string): Record<string, any> | undefined;
|
|
8
|
+
/** Finds the DynamicFormItemWizard instance registered at `path` (its `normalizedPath`). */
|
|
9
|
+
export declare function findDynamicFormItemWizardByPath(wrapper: ReturnType<typeof mount>, path: string): import("@vue/test-utils").VueWrapper<any, any> | undefined;
|
|
10
|
+
export declare function currentStepIndex(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
11
|
+
export declare function pageCount(wrapper: ReturnType<typeof mount>, path: string): number;
|
|
12
|
+
export declare function isFirst(wrapper: ReturnType<typeof mount>, path: string): boolean;
|
|
13
|
+
export declare function isLast(wrapper: ReturnType<typeof mount>, path: string): boolean;
|
|
14
|
+
export declare function isValidating(wrapper: ReturnType<typeof mount>, path: string): boolean;
|
|
15
|
+
/** Reads the resolved `wizardConfig` slot prop (defaults applied) as surfaced by the test fixture. */
|
|
16
|
+
export declare function wizardConfig(wrapper: ReturnType<typeof mount>, path: string): {
|
|
17
|
+
allowForwardJump: boolean;
|
|
18
|
+
validateOnJump: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function clickNext(wrapper: ReturnType<typeof mount>, path: string): Promise<void>;
|
|
21
|
+
export declare function clickPrev(wrapper: ReturnType<typeof mount>, path: string): Promise<void>;
|
|
22
|
+
export declare function clickGotoStep(wrapper: ReturnType<typeof mount>, path: string, index: number): Promise<void>;
|
|
23
|
+
/** Reads the `v-show`-driven visibility of the page rendered at `pagePath`, through the fixture's `-page` wrapper. */
|
|
24
|
+
export declare function isPageVisible(wrapper: ReturnType<typeof mount>, pagePath: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export { resolveMessage } from '../utils/resolveMessage';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* XSD-derived rule names registered globally via vee-validate's `defineRule`, plus one
|
|
4
|
+
* non-XSD occurrence extension (`vdf_maxOccursTotal`, a per-branch choice cap with no XSD
|
|
5
|
+
* equivalent). Every name is prefixed (`xsd_` or `vdf_`): `defineRule` is a last-write-wins
|
|
6
|
+
* global registry shared with the consuming app, so an unprefixed name could silently
|
|
7
|
+
* collide with a consumer-defined rule.
|
|
8
|
+
*/
|
|
9
|
+
export type ValidationRule = 'xsd_required' | 'xsd_minOccurs' | 'xsd_maxOccurs' | 'xsd_choiceMinOccurs' | 'xsd_choiceMaxOccurs' | 'vdf_maxOccursTotal' | 'xsd_minLength' | 'xsd_maxLength' | 'xsd_pattern' | 'xsd_minInclusive' | 'xsd_maxInclusive' | 'xsd_minExclusive' | 'xsd_maxExclusive' | 'xsd_enumeration' | 'xsd_length' | 'xsd_whiteSpace' | 'xsd_fractionDigits' | 'xsd_totalDigits';
|
|
4
10
|
/**
|
|
5
11
|
* Maps each rule to its semantic parameter name, enabling named placeholder
|
|
6
12
|
* interpolation (e.g. `{length}`, `{min}`) alongside positional `{0}` in messages.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -7,6 +7,7 @@ export interface Props {
|
|
|
7
7
|
initialEdit?: boolean;
|
|
8
8
|
hideFieldsWithoutValue?: boolean;
|
|
9
9
|
initialValues?: GenericObject;
|
|
10
|
+
keepValuesOnUnmount?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
13
|
export default _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { WizardGotoStepOptions } from '../types/FieldMetadata';
|
|
1
2
|
import type { GetDynamicFormSettingsType } from '../types/GetDynamicFormSettingsType';
|
|
2
3
|
import type { GetMetadataType } from '../types/GetMetadataType';
|
|
3
4
|
export type Metadata = GetMetadataType<typeof metadata>;
|
|
4
5
|
export type DynamicFormSettings = GetDynamicFormSettingsType<typeof metadata>;
|
|
5
6
|
declare const metadata: {
|
|
6
|
-
fieldTypes: readonly ("
|
|
7
|
+
fieldTypes: readonly ("text" | "default" | "checkbox" | "select" | "textBoundByVModel" | "selectBoundByVModel" | "checkboxBoundByVModel" | "heading" | "group")[];
|
|
7
8
|
extendedProperties: {
|
|
8
9
|
description?: string;
|
|
9
10
|
options?: {
|
|
@@ -21,9 +22,17 @@ declare const metadata: {
|
|
|
21
22
|
/** Helps identifying that we're below a choice field, so if we're rendering an array we can adjust our layout */
|
|
22
23
|
belowChoiceField?: boolean;
|
|
23
24
|
hidden?: boolean;
|
|
25
|
+
/** Bound by the wizard page wrapper below, so a page's own content can offer "jump to step" affordances */
|
|
26
|
+
gotoStep?: (index: number, options?: WizardGotoStepOptions) => Promise<void> | void;
|
|
24
27
|
};
|
|
25
28
|
extendedSettingsProperties: {
|
|
26
29
|
showOptionalInsteadOfRequired?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Example-only switch for the wizard page wrapper: gate page visibility with `v-if` (unmounts
|
|
32
|
+
* non-current pages) instead of the correct `v-show`. Lets a playground demonstrate the
|
|
33
|
+
* clear-on-unmount data loss `v-show` avoids, and how `keepValuesOnUnmount` changes it.
|
|
34
|
+
*/
|
|
35
|
+
wizardPageUseVIf?: boolean;
|
|
27
36
|
};
|
|
28
37
|
valueTypes: {
|
|
29
38
|
text: string;
|
|
@@ -40,36 +49,62 @@ declare const metadata: {
|
|
|
40
49
|
};
|
|
41
50
|
declare var __VLS_21: {
|
|
42
51
|
level: number;
|
|
43
|
-
},
|
|
52
|
+
}, __VLS_31: {
|
|
53
|
+
hideLabel: boolean;
|
|
54
|
+
level: number;
|
|
55
|
+
}, __VLS_34: {
|
|
44
56
|
level: number;
|
|
45
57
|
belowChoiceField: boolean;
|
|
46
58
|
}, __VLS_37: {
|
|
59
|
+
level: number;
|
|
60
|
+
belowChoiceField: boolean;
|
|
61
|
+
}, __VLS_54: {
|
|
62
|
+
level: number;
|
|
63
|
+
}, __VLS_57: {
|
|
64
|
+
level: number;
|
|
65
|
+
}, __VLS_60: {
|
|
66
|
+
gotoStep: (index: number, options?: WizardGotoStepOptions) => Promise<void> | void;
|
|
67
|
+
level: number | undefined;
|
|
68
|
+
}, __VLS_62: {
|
|
69
|
+
gotoStep: (index: number, options?: WizardGotoStepOptions) => Promise<void> | void;
|
|
70
|
+
level: number | undefined;
|
|
71
|
+
}, __VLS_72: {
|
|
47
72
|
hideLabel: boolean;
|
|
48
|
-
},
|
|
73
|
+
}, __VLS_75: {}, __VLS_84: {}, __VLS_94: {
|
|
49
74
|
level: number;
|
|
50
|
-
},
|
|
75
|
+
}, __VLS_96: {}, __VLS_113: {
|
|
51
76
|
level: number;
|
|
52
|
-
},
|
|
77
|
+
}, __VLS_115: {};
|
|
53
78
|
type __VLS_Slots = {} & {
|
|
54
79
|
default?: (props: typeof __VLS_21) => any;
|
|
55
80
|
} & {
|
|
56
|
-
default?: (props: typeof
|
|
81
|
+
default?: (props: typeof __VLS_31) => any;
|
|
57
82
|
} & {
|
|
58
|
-
default?: (props: typeof
|
|
83
|
+
default?: (props: typeof __VLS_34) => any;
|
|
59
84
|
} & {
|
|
60
85
|
default?: (props: typeof __VLS_37) => any;
|
|
61
86
|
} & {
|
|
62
|
-
default?: (props: typeof
|
|
87
|
+
default?: (props: typeof __VLS_54) => any;
|
|
88
|
+
} & {
|
|
89
|
+
default?: (props: typeof __VLS_57) => any;
|
|
90
|
+
} & {
|
|
91
|
+
default?: (props: typeof __VLS_60) => any;
|
|
92
|
+
} & {
|
|
93
|
+
default?: (props: typeof __VLS_62) => any;
|
|
94
|
+
} & {
|
|
95
|
+
default?: (props: typeof __VLS_72) => any;
|
|
96
|
+
} & {
|
|
97
|
+
default?: (props: typeof __VLS_75) => any;
|
|
63
98
|
} & {
|
|
64
|
-
attributes?: (props: typeof
|
|
99
|
+
attributes?: (props: typeof __VLS_84) => any;
|
|
65
100
|
} & {
|
|
66
|
-
default?: (props: typeof
|
|
101
|
+
default?: (props: typeof __VLS_94) => any;
|
|
67
102
|
} & {
|
|
68
|
-
default?: (props: typeof
|
|
103
|
+
default?: (props: typeof __VLS_96) => any;
|
|
69
104
|
} & {
|
|
70
|
-
default?: (props: typeof
|
|
105
|
+
default?: (props: typeof __VLS_113) => any;
|
|
71
106
|
} & {
|
|
72
|
-
attributes?: (props: typeof
|
|
107
|
+
attributes?: (props: typeof __VLS_115) => any;
|
|
73
108
|
};
|
|
74
109
|
declare const __VLS_component: import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
75
110
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|