cja-phoenix 1.2.47 → 1.2.49
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/module.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type ComputedRef } from
|
|
2
|
-
import type { StepData } from
|
|
1
|
+
import { type ComputedRef } from "vue";
|
|
2
|
+
import type { StepData } from "../types/JourneyConfig.js";
|
|
3
3
|
export declare const useFunnelConfig: (structure: ComputedRef<Map<string, string[]>>) => {
|
|
4
4
|
steps: ComputedRef<string[]>;
|
|
5
5
|
structure: ComputedRef<Map<string, string[]>>;
|
|
6
6
|
currentStep: ComputedRef<StepData>;
|
|
7
7
|
totalSteps: ComputedRef<number>;
|
|
8
8
|
getStep: (step: string | number | undefined) => StepData | undefined;
|
|
9
|
-
goNextStep: () => Promise<void>;
|
|
10
|
-
goPrevStep: () => Promise<void>;
|
|
9
|
+
goNextStep: (relative?: boolean) => Promise<void>;
|
|
10
|
+
goPrevStep: (relative?: boolean) => Promise<void>;
|
|
11
11
|
};
|
|
@@ -3,7 +3,9 @@ import { computed } from "vue";
|
|
|
3
3
|
export const useFunnelConfig = (structure) => {
|
|
4
4
|
const route = useRouter().currentRoute;
|
|
5
5
|
const steps = computed(() => Array.from(structure.value.keys()));
|
|
6
|
-
const currentStep = computed(
|
|
6
|
+
const currentStep = computed(
|
|
7
|
+
() => getStep(route.value.path.split("/").reverse()[0]) || currentStep.value
|
|
8
|
+
);
|
|
7
9
|
const totalSteps = computed(() => structure.value.size);
|
|
8
10
|
const getStep = (step) => {
|
|
9
11
|
if (step === void 0) return;
|
|
@@ -17,9 +19,18 @@ export const useFunnelConfig = (structure) => {
|
|
|
17
19
|
fields: stepFields
|
|
18
20
|
} : void 0;
|
|
19
21
|
};
|
|
20
|
-
const
|
|
22
|
+
const currentStepStatic = getStep(
|
|
23
|
+
route.value.path.split("/").reverse()[0]
|
|
24
|
+
);
|
|
25
|
+
const goNextStep = async (relative) => {
|
|
21
26
|
if (currentStep.value) {
|
|
22
|
-
const nextStep =
|
|
27
|
+
const nextStep = (() => {
|
|
28
|
+
if (relative) {
|
|
29
|
+
return getStep(currentStep.value.index + 1);
|
|
30
|
+
} else if (currentStepStatic) {
|
|
31
|
+
return getStep(currentStepStatic.index + 1);
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
23
34
|
if (nextStep) {
|
|
24
35
|
await navigateTo({
|
|
25
36
|
path: nextStep.path,
|
|
@@ -28,12 +39,18 @@ export const useFunnelConfig = (structure) => {
|
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
};
|
|
31
|
-
const goPrevStep = async () => {
|
|
42
|
+
const goPrevStep = async (relative) => {
|
|
32
43
|
if (currentStep.value) {
|
|
33
|
-
const
|
|
34
|
-
|
|
44
|
+
const prevStep = (() => {
|
|
45
|
+
if (relative) {
|
|
46
|
+
return getStep(currentStep.value.index - 1);
|
|
47
|
+
} else if (currentStepStatic) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
if (prevStep) {
|
|
35
52
|
await navigateTo({
|
|
36
|
-
path:
|
|
53
|
+
path: prevStep.path,
|
|
37
54
|
query: useRoute().query
|
|
38
55
|
});
|
|
39
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DateFormat, FileModel } from
|
|
2
|
-
import * as yup from
|
|
3
|
-
import type { Ref } from
|
|
1
|
+
import type { DateFormat, FileModel } from "../types/Form.js";
|
|
2
|
+
import * as yup from "yup";
|
|
3
|
+
import type { Ref } from "vue";
|
|
4
4
|
export declare const formValidation: {
|
|
5
5
|
string: (messages: {
|
|
6
6
|
required?: string;
|
|
@@ -90,7 +90,7 @@ const file = (messages, options) => {
|
|
|
90
90
|
validation = validation.test(
|
|
91
91
|
"fileSize",
|
|
92
92
|
messages.size,
|
|
93
|
-
(v) => v?.file && options.size?.collectionType ? v.file?.size < byteSize[options.size?.collectionType] * options.size.value :
|
|
93
|
+
(v) => v?.file && options.size?.collectionType ? v.file?.size < byteSize[options.size?.collectionType] * options.size.value : true
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
return validation;
|