@webitel/ui-datalist 1.1.64 → 1.1.65
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
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { getDefaultsFromZodSchema } from '@webitel/api-services/utils';
|
|
7
7
|
import type { ApiModule } from '@webitel/ui-sdk/src/api/types/ApiModule';
|
|
8
8
|
import { defineStore } from 'pinia';
|
|
9
|
-
import { ref, toRaw, watch } from 'vue';
|
|
9
|
+
import { effectScope, ref, toRaw, watch } from 'vue';
|
|
10
10
|
import type { z } from 'zod/v4';
|
|
11
11
|
|
|
12
12
|
import type { CardItemId, CardParentId } from '../types/CardStore.types';
|
|
@@ -68,14 +68,26 @@ export const createCardStore = <
|
|
|
68
68
|
const isSaving = ref(false);
|
|
69
69
|
const error = ref<unknown>(null); // if needed
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
// @regle/core auto-binds to whatever effect scope is active on first
|
|
72
|
+
// useRegleSchema() call — here, the opening card component's. It then
|
|
73
|
+
// tears r$ down when THAT unmounts, even though this store outlives it.
|
|
74
|
+
// A detached scope keeps regle alive for the store's lifetime
|
|
75
|
+
let validationScope: ReturnType<typeof effectScope>;
|
|
76
|
+
const createValidationSchema = () => {
|
|
77
|
+
validationScope?.stop();
|
|
78
|
+
validationScope = effectScope(true);
|
|
79
|
+
validationScope.run(() => {
|
|
80
|
+
validationSchema.value = useRegleSchema(
|
|
81
|
+
draftItemInstance,
|
|
82
|
+
standardValidationSchema,
|
|
83
|
+
{
|
|
84
|
+
...defaultRegleValidationOptions,
|
|
85
|
+
...validationSchemaOptions,
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
createValidationSchema();
|
|
79
91
|
|
|
80
92
|
const loadItem = async () => {
|
|
81
93
|
isLoading.value = true;
|
|
@@ -175,11 +187,10 @@ export const createCardStore = <
|
|
|
175
187
|
const $reset = () => {
|
|
176
188
|
itemId.value = null;
|
|
177
189
|
parentId.value = null;
|
|
190
|
+
createValidationSchema();
|
|
178
191
|
|
|
179
192
|
originalItemInstance.value = {} as Entity;
|
|
180
193
|
|
|
181
|
-
validationSchema.value.r$.$reset();
|
|
182
|
-
|
|
183
194
|
isLoading.value = false;
|
|
184
195
|
isSaving.value = false;
|
|
185
196
|
error.value = null;
|