cja-phoenix 1.2.20 → 1.2.21
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 +1 -1
- package/dist/runtime/components/form/SliderInput.d.vue.ts +6 -6
- package/dist/runtime/components/form/SliderInput.vue +5 -14
- package/dist/runtime/components/form/SliderInput.vue.d.ts +6 -6
- package/dist/runtime/composables/useValidateForm.d.ts +2 -4
- package/dist/runtime/composables/useValidateForm.js +13 -15
- package/dist/runtime/utils/updateForm.js +3 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { type InputHTMLAttributes } from
|
|
2
|
-
import type { Lazy, Schema } from
|
|
1
|
+
import { type InputHTMLAttributes } from "vue";
|
|
2
|
+
import type { Lazy, Schema } from "yup";
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
title?: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
tooltip?: string;
|
|
7
|
-
layout?:
|
|
8
|
-
size?:
|
|
9
|
-
disabled?: InputHTMLAttributes[
|
|
7
|
+
layout?: "vertical" | "horizontal";
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
10
10
|
min: number;
|
|
11
11
|
max: number;
|
|
12
12
|
step: number;
|
|
13
13
|
validation?: Schema | Lazy<any>;
|
|
14
|
-
validationMode?:
|
|
14
|
+
validationMode?: "change" | "none";
|
|
15
15
|
errorDisplay?: boolean;
|
|
16
16
|
};
|
|
17
17
|
declare const __VLS_defaultModels: {
|
|
@@ -18,21 +18,12 @@
|
|
|
18
18
|
v-model="model"
|
|
19
19
|
type="range"
|
|
20
20
|
:aria-label="label || title"
|
|
21
|
-
|
|
22
|
-
<div
|
|
23
|
-
v-if="$slots.
|
|
24
|
-
class="label-container"
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
v-if="$slots.min"
|
|
28
|
-
class="min"
|
|
29
|
-
>
|
|
21
|
+
/>
|
|
22
|
+
<div v-if="$slots.max || $slots.min" class="label-container">
|
|
23
|
+
<div v-if="$slots.min" class="min">
|
|
30
24
|
<slot name="min" />
|
|
31
25
|
</div>
|
|
32
|
-
<div
|
|
33
|
-
v-if="$slots.max"
|
|
34
|
-
class="max"
|
|
35
|
-
>
|
|
26
|
+
<div v-if="$slots.max" class="max">
|
|
36
27
|
<slot name="max" />
|
|
37
28
|
</div>
|
|
38
29
|
</div>
|
|
@@ -167,7 +158,7 @@ $sliderProgress: calc(
|
|
|
167
158
|
display: grid;
|
|
168
159
|
grid-template-columns: repeat(2, 1fr);
|
|
169
160
|
gap: 16px;
|
|
170
|
-
margin-top:
|
|
161
|
+
margin-top: 12px;
|
|
171
162
|
font-size: 14px;
|
|
172
163
|
line-height: 18px;
|
|
173
164
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { type InputHTMLAttributes } from
|
|
2
|
-
import type { Lazy, Schema } from
|
|
1
|
+
import { type InputHTMLAttributes } from "vue";
|
|
2
|
+
import type { Lazy, Schema } from "yup";
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
title?: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
tooltip?: string;
|
|
7
|
-
layout?:
|
|
8
|
-
size?:
|
|
9
|
-
disabled?: InputHTMLAttributes[
|
|
7
|
+
layout?: "vertical" | "horizontal";
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
10
10
|
min: number;
|
|
11
11
|
max: number;
|
|
12
12
|
step: number;
|
|
13
13
|
validation?: Schema | Lazy<any>;
|
|
14
|
-
validationMode?:
|
|
14
|
+
validationMode?: "change" | "none";
|
|
15
15
|
errorDisplay?: boolean;
|
|
16
16
|
};
|
|
17
17
|
declare const __VLS_defaultModels: {
|
|
@@ -3,11 +3,9 @@ export declare const useValidateForm: (options: {
|
|
|
3
3
|
fields?: Ref[];
|
|
4
4
|
onSubmit?: () => void | Promise<void>;
|
|
5
5
|
onError?: () => void;
|
|
6
|
-
forceValidation?: boolean;
|
|
7
|
-
submitLock?: boolean;
|
|
8
6
|
}) => {
|
|
9
7
|
validForm: Ref<boolean, boolean>;
|
|
10
|
-
validate: () => void
|
|
11
|
-
submit: () => void
|
|
8
|
+
validate: () => Promise<void>;
|
|
9
|
+
submit: () => Promise<void>;
|
|
12
10
|
submitLock: Ref<boolean, boolean>;
|
|
13
11
|
};
|
|
@@ -2,33 +2,31 @@ import { ref } from "vue";
|
|
|
2
2
|
export const useValidateForm = (options) => {
|
|
3
3
|
const validForm = ref(false);
|
|
4
4
|
const submitLock = ref(false);
|
|
5
|
-
const validate = () => {
|
|
5
|
+
const validate = async () => {
|
|
6
6
|
const fields = options.fields?.filter((f) => f.value);
|
|
7
|
-
|
|
7
|
+
if (fields) {
|
|
8
|
+
for (let i = 0; i < fields.length; i++) {
|
|
9
|
+
const field = fields[i];
|
|
10
|
+
await field.value.validate();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
validForm.value = fields?.every((f) => f.value.meta.valid) ?? true;
|
|
9
14
|
};
|
|
10
|
-
const
|
|
15
|
+
const submit = async () => {
|
|
16
|
+
await validate();
|
|
11
17
|
if (validForm.value) {
|
|
12
|
-
if (
|
|
18
|
+
if (!submitLock.value) {
|
|
19
|
+
console.log("Toggle submitLock");
|
|
13
20
|
submitLock.value = true;
|
|
21
|
+
console.log("Executing callback");
|
|
14
22
|
await options.onSubmit?.();
|
|
23
|
+
console.log("Toggle submitLock");
|
|
15
24
|
submitLock.value = false;
|
|
16
25
|
}
|
|
17
26
|
} else {
|
|
18
27
|
options.onError?.();
|
|
19
28
|
}
|
|
20
29
|
};
|
|
21
|
-
const submit = () => {
|
|
22
|
-
validate();
|
|
23
|
-
if (options.forceValidation) {
|
|
24
|
-
setTimeout(() => {
|
|
25
|
-
validate();
|
|
26
|
-
executeCallback();
|
|
27
|
-
}, 1);
|
|
28
|
-
} else {
|
|
29
|
-
executeCallback();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
30
|
return {
|
|
33
31
|
validForm,
|
|
34
32
|
validate,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useRuntimeConfig } from "#imports";
|
|
1
|
+
import { useRoute, useRuntimeConfig } from "#imports";
|
|
2
2
|
export const updateForm = (options) => {
|
|
3
3
|
const { apiURL } = useRuntimeConfig().public;
|
|
4
|
+
const route = useRoute();
|
|
4
5
|
return fetch(new URL("/core/apis/data/updateForm", apiURL), {
|
|
5
6
|
method: "PUT",
|
|
6
7
|
body: JSON.stringify(
|
|
@@ -14,7 +15,7 @@ export const updateForm = (options) => {
|
|
|
14
15
|
sentToDialer: options.sentToDialer || true,
|
|
15
16
|
lastStepNumber: options.step,
|
|
16
17
|
lastStepType: options.formType,
|
|
17
|
-
lastStepUrl:
|
|
18
|
+
lastStepUrl: route.fullPath,
|
|
18
19
|
data: JSON.stringify({
|
|
19
20
|
...options.payload,
|
|
20
21
|
formType: options.formType
|