@flowerforce/flower-core 3.3.1-beta.1 → 3.4.0
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/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 3.4.0 (2025-04-19)
|
2
|
+
|
3
|
+
|
4
|
+
### 🚀 Features
|
5
|
+
|
6
|
+
- added remove value on hide element ([#68](https://github.com/flowerforce/flower/pull/68))
|
7
|
+
|
8
|
+
|
9
|
+
### 🩹 Fixes
|
10
|
+
|
11
|
+
- avoid validate hidden field ([#67](https://github.com/flowerforce/flower/pull/67))
|
12
|
+
|
1
13
|
## 3.3.0 (2024-10-08)
|
2
14
|
|
3
15
|
|
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
|
},
|
@@ -663,21 +665,6 @@ const FlowerCoreReducers = {
|
|
663
665
|
_set(state, [payload.flowName, 'data'], payload.value);
|
664
666
|
},
|
665
667
|
unsetData: (state, { payload }) => {
|
666
|
-
const currentNode = FlowerStateUtils.makeSelectCurrentNodeId(payload.flowName)(state);
|
667
|
-
_unset(state, [
|
668
|
-
payload.flowName,
|
669
|
-
'form',
|
670
|
-
currentNode,
|
671
|
-
'dirty',
|
672
|
-
...payload.id
|
673
|
-
]);
|
674
|
-
_unset(state, [
|
675
|
-
payload.flowName,
|
676
|
-
'form',
|
677
|
-
currentNode,
|
678
|
-
'touches',
|
679
|
-
...payload.id
|
680
|
-
]);
|
681
668
|
_unset(state, [payload.flowName, 'data', ...payload.id]);
|
682
669
|
},
|
683
670
|
setFormIsValidating: (state, { payload }) => {
|
@@ -691,7 +678,6 @@ const FlowerCoreReducers = {
|
|
691
678
|
});
|
692
679
|
_unset(state, [payload.flowName, 'form', payload.id, 'touches']);
|
693
680
|
_unset(state, [payload.flowName, 'form', payload.id, 'dirty']);
|
694
|
-
_unset(state, [payload.flowName, 'form', payload.id, 'isDirty']);
|
695
681
|
_unset(state, [payload.flowName, 'form', payload.id, 'isSubmitted']);
|
696
682
|
},
|
697
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
|
},
|
@@ -661,21 +663,6 @@ const FlowerCoreReducers = {
|
|
661
663
|
_set(state, [payload.flowName, 'data'], payload.value);
|
662
664
|
},
|
663
665
|
unsetData: (state, { payload }) => {
|
664
|
-
const currentNode = FlowerStateUtils.makeSelectCurrentNodeId(payload.flowName)(state);
|
665
|
-
_unset(state, [
|
666
|
-
payload.flowName,
|
667
|
-
'form',
|
668
|
-
currentNode,
|
669
|
-
'dirty',
|
670
|
-
...payload.id
|
671
|
-
]);
|
672
|
-
_unset(state, [
|
673
|
-
payload.flowName,
|
674
|
-
'form',
|
675
|
-
currentNode,
|
676
|
-
'touches',
|
677
|
-
...payload.id
|
678
|
-
]);
|
679
666
|
_unset(state, [payload.flowName, 'data', ...payload.id]);
|
680
667
|
},
|
681
668
|
setFormIsValidating: (state, { payload }) => {
|
@@ -689,7 +676,6 @@ const FlowerCoreReducers = {
|
|
689
676
|
});
|
690
677
|
_unset(state, [payload.flowName, 'form', payload.id, 'touches']);
|
691
678
|
_unset(state, [payload.flowName, 'form', payload.id, 'dirty']);
|
692
|
-
_unset(state, [payload.flowName, 'form', payload.id, 'isDirty']);
|
693
679
|
_unset(state, [payload.flowName, 'form', payload.id, 'isSubmitted']);
|
694
680
|
},
|
695
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
|