notform 1.0.6 → 1.0.7
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/index.d.ts +8 -8
- package/dist/index.js +10 -3
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
import { ComputedRef, MaybeRefOrGetter, Ref, VNodeChild, useAttrs } from "vue";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
import { PartialDeep, Paths as Paths$1 } from "type-fest";
|
|
@@ -286,14 +286,14 @@ type NotMessageSlots = {
|
|
|
286
286
|
//#endregion
|
|
287
287
|
//#region src/components/not-form.vue.d.ts
|
|
288
288
|
declare const __VLS_export$3: <TSchema extends ObjectSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
289
|
-
props:
|
|
289
|
+
props: vue0.PublicProps & __VLS_PrettifyLocal$2<NotFormProps<TSchema>> & (typeof globalThis extends {
|
|
290
290
|
__VLS_PROPS_FALLBACK: infer P;
|
|
291
291
|
} ? P : {});
|
|
292
292
|
expose: (exposed: {}) => void;
|
|
293
293
|
attrs: any;
|
|
294
294
|
slots: NotFormSlots<TSchema>;
|
|
295
295
|
emit: {};
|
|
296
|
-
}>) =>
|
|
296
|
+
}>) => vue0.VNode & {
|
|
297
297
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
298
298
|
};
|
|
299
299
|
declare const _default$2: typeof __VLS_export$3;
|
|
@@ -304,7 +304,7 @@ type __VLS_PrettifyLocal$2<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K
|
|
|
304
304
|
* Slots provided by the NotField component.
|
|
305
305
|
*/
|
|
306
306
|
type __VLS_Slots = NotFieldSlots;
|
|
307
|
-
declare const __VLS_base:
|
|
307
|
+
declare const __VLS_base: vue0.DefineComponent<NotFieldProps, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<NotFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
|
|
308
308
|
declare const __VLS_export$2: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
309
309
|
declare const _default$1: typeof __VLS_export$2;
|
|
310
310
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -315,14 +315,14 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/components/not-message.vue.d.ts
|
|
317
317
|
declare const __VLS_export$1: <TSchema extends ObjectSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
318
|
-
props:
|
|
318
|
+
props: vue0.PublicProps & __VLS_PrettifyLocal$1<NotMessageProps> & (typeof globalThis extends {
|
|
319
319
|
__VLS_PROPS_FALLBACK: infer P;
|
|
320
320
|
} ? P : {});
|
|
321
321
|
expose: (exposed: {}) => void;
|
|
322
322
|
attrs: any;
|
|
323
323
|
slots: NotMessageSlots;
|
|
324
324
|
emit: {};
|
|
325
|
-
}>) =>
|
|
325
|
+
}>) => vue0.VNode & {
|
|
326
326
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
327
327
|
};
|
|
328
328
|
declare const _default$3: typeof __VLS_export$1;
|
|
@@ -397,14 +397,14 @@ type NotArrayFieldSlots<TSchema extends ArraySchema> = {
|
|
|
397
397
|
//#endregion
|
|
398
398
|
//#region src/components/not-array-field.vue.d.ts
|
|
399
399
|
declare const __VLS_export: <TArraySchema extends ArraySchema, TObjectSchema extends ObjectSchema = ObjectSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
400
|
-
props:
|
|
400
|
+
props: vue0.PublicProps & __VLS_PrettifyLocal<NotArrayFieldProps<TArraySchema>> & (typeof globalThis extends {
|
|
401
401
|
__VLS_PROPS_FALLBACK: infer P;
|
|
402
402
|
} ? P : {});
|
|
403
403
|
expose: (exposed: {}) => void;
|
|
404
404
|
attrs: any;
|
|
405
405
|
slots: NotArrayFieldSlots<TArraySchema>;
|
|
406
406
|
emit: {};
|
|
407
|
-
}>) =>
|
|
407
|
+
}>) => vue0.VNode & {
|
|
408
408
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
409
409
|
};
|
|
410
410
|
declare const _default: typeof __VLS_export;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, createBlock, createTextVNode, defineComponent, guardReactiveProps, inject, mergeProps, nextTick, normalizeProps, onMounted, openBlock, provide, reactive, ref, renderSlot, resolveDynamicComponent, toDisplayString, toValue, unref, useAttrs, useId, vShow, withCtx, withDirectives } from "vue";
|
|
2
2
|
import { getProperty, parsePath, setProperty } from "dot-prop";
|
|
3
|
+
import { isEqual } from "es-toolkit/predicate";
|
|
3
4
|
|
|
4
5
|
//#region src/utils/not-form-context.ts
|
|
5
6
|
/** Internal registry mapping form IDs to their injection keys */
|
|
@@ -496,8 +497,9 @@ function useNotForm(options) {
|
|
|
496
497
|
..._state
|
|
497
498
|
};
|
|
498
499
|
getObjectPaths(_state).forEach((path) => {
|
|
499
|
-
context.dirtyFields.value.add(path);
|
|
500
500
|
context.touchedFields.value.add(path);
|
|
501
|
+
if (!isEqual(getProperty(context.state.value, path), getProperty(onResetState.value ?? initialState, path))) context.dirtyFields.value.add(path);
|
|
502
|
+
else context.dirtyFields.value.delete(path);
|
|
501
503
|
if (_validate) context.validateField(path);
|
|
502
504
|
});
|
|
503
505
|
},
|
|
@@ -519,11 +521,16 @@ function useNotForm(options) {
|
|
|
519
521
|
context.touchedFields.value = new Set(paths);
|
|
520
522
|
},
|
|
521
523
|
dirtyField(field) {
|
|
522
|
-
context.dirtyFields.value.add(field);
|
|
524
|
+
if (!isEqual(getProperty(context.state.value, field), getProperty(onResetState.value ?? initialState, field))) context.dirtyFields.value.add(field);
|
|
525
|
+
else context.dirtyFields.value.delete(field);
|
|
523
526
|
},
|
|
524
527
|
dirtyAllFields() {
|
|
525
528
|
const paths = getObjectPaths(context.state.value);
|
|
526
|
-
|
|
529
|
+
const newDirty = /* @__PURE__ */ new Set();
|
|
530
|
+
paths.forEach((path) => {
|
|
531
|
+
if (!isEqual(getProperty(context.state.value, path), getProperty(onResetState.value ?? initialState, path))) newDirty.add(path);
|
|
532
|
+
});
|
|
533
|
+
context.dirtyFields.value = newDirty;
|
|
527
534
|
},
|
|
528
535
|
async submit(event) {
|
|
529
536
|
context.isSubmitting.value = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@standard-schema/spec": "^1.1.0",
|
|
58
|
-
"dot-prop": "^10.1.0"
|
|
58
|
+
"dot-prop": "^10.1.0",
|
|
59
|
+
"es-toolkit": "^1.45.1"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
61
62
|
"node": ">=24.0.0"
|