@azure-net/kit 0.9.1 → 0.9.2
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/delivery/index.d.ts +1 -0
- package/dist/core/delivery/index.js +1 -0
- package/dist/core/delivery/schema/Schema.d.ts +2 -2
- package/dist/core/delivery/schema/Schema.js +1 -0
- package/dist/core/delivery/serverAction/CreateServerAction.d.ts +2 -3
- package/dist/core/svelte/ActiveForm/ActiveForm.svelte.d.ts +4 -5
- package/dist/core/svelte/ActiveForm/ActiveForm.svelte.js +2 -4
- package/package.json +1 -1
|
@@ -37,8 +37,8 @@ interface SchemaInstance<TransformResult> {
|
|
|
37
37
|
validated(): boolean;
|
|
38
38
|
}
|
|
39
39
|
type Schema<SchemaData, TransformResult, CustomMethods> = CustomMethods & {
|
|
40
|
-
from(data: Partial<SchemaData>): SchemaInstance<TransformResult>;
|
|
41
|
-
getSchemaError(e: unknown): RequestErrors<SchemaData
|
|
40
|
+
from(data: Partial<SchemaData> | FormData): SchemaInstance<TransformResult>;
|
|
41
|
+
getSchemaError(e: unknown): RequestErrors<SchemaData> | undefined;
|
|
42
42
|
};
|
|
43
43
|
export declare const createSchemaFactory: <Rules extends Record<string, unknown>>(rules: Rules) => <SchemaData>() => SchemaBuilder<SchemaData, Rules>;
|
|
44
44
|
export declare const schema: <SchemaData>() => SchemaBuilder<SchemaData>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { error, fail, redirect } from '@sveltejs/kit';
|
|
1
|
+
import { error, fail, redirect, type RequestEvent } from '@sveltejs/kit';
|
|
3
2
|
type Deps = {
|
|
4
|
-
context:
|
|
3
|
+
context: RequestEvent;
|
|
5
4
|
utils: {
|
|
6
5
|
fail: typeof fail;
|
|
7
6
|
redirect: typeof redirect;
|
|
@@ -8,13 +8,12 @@ export interface FormConfig<T> {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ActiveForm<T> {
|
|
10
10
|
data: Partial<T>;
|
|
11
|
-
|
|
11
|
+
submit: () => Promise<void>;
|
|
12
|
+
reset: () => void;
|
|
12
13
|
pending: boolean;
|
|
13
14
|
dirty: boolean;
|
|
14
|
-
valid: boolean;
|
|
15
|
-
submit: () => Promise<void>;
|
|
16
15
|
validate: (field?: keyof T) => void;
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
valid: boolean;
|
|
17
|
+
touched: Partial<Record<keyof T, boolean>>;
|
|
19
18
|
touchField: (field: keyof T) => void;
|
|
20
19
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
//import { ObjectUtil } from 'azure-net-tools';
|
|
1
2
|
export {};
|
|
2
3
|
// export function createActiveForm<T extends object>(config: FormConfig<T>): ActiveForm<T> {
|
|
3
4
|
// const initial: Partial<T> = config.initialData ?? {};
|
|
4
|
-
// let data = $state<Partial<T>>(
|
|
5
|
+
// let data = $state<Partial<T>>(ObjectUtil.deepClone(initial));
|
|
5
6
|
// let errors = $state<RequestErrors<T>>({});
|
|
6
7
|
// let touched = $state<Partial<Record<keyof T, boolean>>>({});
|
|
7
8
|
// let pending = $state(false);
|
|
@@ -158,6 +159,3 @@ export {};
|
|
|
158
159
|
// };
|
|
159
160
|
// }
|
|
160
161
|
//
|
|
161
|
-
// function structuredClone<T>(obj: T): T {
|
|
162
|
-
// return JSON.parse(JSON.stringify(obj));
|
|
163
|
-
// }
|