@flowerforce/flower-core 3.3.1-beta.0 → 3.3.1-beta.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/index.cjs.js
CHANGED
@@ -441,7 +441,7 @@ const createFormData = (form) => {
|
|
441
441
|
const allErrors = Object.values(validationErrors || {});
|
442
442
|
return {
|
443
443
|
isSubmitted: form?.isSubmitted || false,
|
444
|
-
isDirty: form?.
|
444
|
+
isDirty: Object.values(form?.dirty || {}).some(Boolean) || false,
|
445
445
|
hasFocus: form?.hasFocus,
|
446
446
|
errors: form?.errors,
|
447
447
|
customErrors: form?.customErrors,
|
@@ -635,6 +635,9 @@ const FlowerCoreReducers = {
|
|
635
635
|
formFieldTouch: (state, { payload }) => {
|
636
636
|
_set(state, [payload.name, 'form', payload.currentNode, 'touches', payload.id], payload.touched);
|
637
637
|
},
|
638
|
+
formFieldDirty: (state, { payload }) => {
|
639
|
+
_set(state, [payload.name, 'form', payload.currentNode, 'dirty', payload.id], payload.dirty);
|
640
|
+
},
|
638
641
|
formFieldFocus: (state, { payload }) => {
|
639
642
|
if (!payload.focused) {
|
640
643
|
_unset(state, [payload.name, 'form', payload.currentNode, 'hasFocus']);
|
@@ -653,7 +656,6 @@ const FlowerCoreReducers = {
|
|
653
656
|
_set(state, [payload.flowName, 'data', ...newpath], payload.value);
|
654
657
|
if (payload && payload.dirty) {
|
655
658
|
_set(state, [payload.flowName, 'form', currentNode, 'dirty', payload.id], payload.dirty);
|
656
|
-
_set(state, [payload.flowName, 'form', currentNode, 'isDirty'], true);
|
657
659
|
}
|
658
660
|
}
|
659
661
|
},
|
@@ -676,7 +678,6 @@ const FlowerCoreReducers = {
|
|
676
678
|
});
|
677
679
|
_unset(state, [payload.flowName, 'form', payload.id, 'touches']);
|
678
680
|
_unset(state, [payload.flowName, 'form', payload.id, 'dirty']);
|
679
|
-
_unset(state, [payload.flowName, 'form', payload.id, 'isDirty']);
|
680
681
|
_unset(state, [payload.flowName, 'form', payload.id, 'isSubmitted']);
|
681
682
|
},
|
682
683
|
node: (state, { payload }) => {
|
package/dist/index.esm.js
CHANGED
@@ -439,7 +439,7 @@ const createFormData = (form) => {
|
|
439
439
|
const allErrors = Object.values(validationErrors || {});
|
440
440
|
return {
|
441
441
|
isSubmitted: form?.isSubmitted || false,
|
442
|
-
isDirty: form?.
|
442
|
+
isDirty: Object.values(form?.dirty || {}).some(Boolean) || false,
|
443
443
|
hasFocus: form?.hasFocus,
|
444
444
|
errors: form?.errors,
|
445
445
|
customErrors: form?.customErrors,
|
@@ -633,6 +633,9 @@ const FlowerCoreReducers = {
|
|
633
633
|
formFieldTouch: (state, { payload }) => {
|
634
634
|
_set(state, [payload.name, 'form', payload.currentNode, 'touches', payload.id], payload.touched);
|
635
635
|
},
|
636
|
+
formFieldDirty: (state, { payload }) => {
|
637
|
+
_set(state, [payload.name, 'form', payload.currentNode, 'dirty', payload.id], payload.dirty);
|
638
|
+
},
|
636
639
|
formFieldFocus: (state, { payload }) => {
|
637
640
|
if (!payload.focused) {
|
638
641
|
_unset(state, [payload.name, 'form', payload.currentNode, 'hasFocus']);
|
@@ -651,7 +654,6 @@ const FlowerCoreReducers = {
|
|
651
654
|
_set(state, [payload.flowName, 'data', ...newpath], payload.value);
|
652
655
|
if (payload && payload.dirty) {
|
653
656
|
_set(state, [payload.flowName, 'form', currentNode, 'dirty', payload.id], payload.dirty);
|
654
|
-
_set(state, [payload.flowName, 'form', currentNode, 'isDirty'], true);
|
655
657
|
}
|
656
658
|
}
|
657
659
|
},
|
@@ -674,7 +676,6 @@ const FlowerCoreReducers = {
|
|
674
676
|
});
|
675
677
|
_unset(state, [payload.flowName, 'form', payload.id, 'touches']);
|
676
678
|
_unset(state, [payload.flowName, 'form', payload.id, 'dirty']);
|
677
|
-
_unset(state, [payload.flowName, 'form', payload.id, 'isDirty']);
|
678
679
|
_unset(state, [payload.flowName, 'form', payload.id, 'isSubmitted']);
|
679
680
|
},
|
680
681
|
node: (state, { payload }) => {
|
@@ -2,7 +2,7 @@ import { CoreStateUtils } from './interfaces/UtilsInterface';
|
|
2
2
|
export declare const FlowerStateUtils: CoreStateUtils;
|
3
3
|
export declare const createFormData: (form: Record<string, any>) => {
|
4
4
|
isSubmitted: any;
|
5
|
-
isDirty:
|
5
|
+
isDirty: boolean;
|
6
6
|
hasFocus: any;
|
7
7
|
errors: any;
|
8
8
|
customErrors: any;
|
@@ -192,6 +192,20 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
192
192
|
[x: string]: string[];
|
193
193
|
} | string[];
|
194
194
|
}>;
|
195
|
+
/**
|
196
|
+
* @param state
|
197
|
+
* @param action
|
198
|
+
*
|
199
|
+
* Set dirty form single field
|
200
|
+
*
|
201
|
+
* @returns state
|
202
|
+
*/
|
203
|
+
formFieldDirty: ReducerFunctionSign<T, {
|
204
|
+
name: string;
|
205
|
+
currentNode: string;
|
206
|
+
id: string;
|
207
|
+
dirty?: boolean;
|
208
|
+
}>;
|
195
209
|
/**
|
196
210
|
* @param state
|
197
211
|
* @param action
|