@flowerforce/flower-react 3.2.0 → 3.3.1
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 +21 -0
- package/dist/index.cjs.js +14 -3
- package/dist/index.esm.js +14 -3
- package/dist/src/components/types/FlowerField.d.ts +1 -1
- package/dist/src/components/types/FlowerHooks.d.ts +7 -3
- package/dist/src/components/types/FlowerRule.d.ts +1 -1
- package/dist/src/components/types/FlowerValue.d.ts +1 -1
- package/dist/src/components/useFlowerForm.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## 3.3.1 (2024-08-27)
|
2
|
+
|
3
|
+
|
4
|
+
### 🩹 Fixes
|
5
|
+
|
6
|
+
- rulesOperators example fixed ([f1def97](https://github.com/flowerforce/flower/commit/f1def97))
|
7
|
+
|
8
|
+
|
9
|
+
### 🧱 Updated Dependencies
|
10
|
+
|
11
|
+
- Updated flower-core to 3.2.1
|
12
|
+
|
13
|
+
## 3.3.0 (2024-08-27)
|
14
|
+
|
15
|
+
|
16
|
+
### 🚀 Features
|
17
|
+
|
18
|
+
- added new utils to retrieve form status ([c1ac7ba](https://github.com/flowerforce/flower/commit/c1ac7ba))
|
19
|
+
|
20
|
+
- added dirty default value ([02a5e28](https://github.com/flowerforce/flower/commit/02a5e28))
|
21
|
+
|
1
22
|
## 3.2.0 (2024-07-23)
|
2
23
|
|
3
24
|
|
package/dist/index.cjs.js
CHANGED
@@ -850,6 +850,7 @@ const component = React.memo(FlowerComponent);
|
|
850
850
|
* - replaceData,
|
851
851
|
* - reset,
|
852
852
|
* - setCustomErrors
|
853
|
+
* - getFormStatus
|
853
854
|
*
|
854
855
|
* @param {string} flowName - first optional parameter
|
855
856
|
*
|
@@ -872,13 +873,22 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
872
873
|
...newpath
|
873
874
|
]);
|
874
875
|
}, [store, flowName]);
|
875
|
-
const
|
876
|
+
const getFormStatus = React.useCallback((path) => {
|
877
|
+
const { flowNameFromPath = flowName, path: newpath } = flowerCore.CoreUtils.getPath(path);
|
878
|
+
return _get(store.getState(), [
|
879
|
+
'flower',
|
880
|
+
flowNameFromPath,
|
881
|
+
'form',
|
882
|
+
...newpath
|
883
|
+
]);
|
884
|
+
}, [store, flowName]);
|
885
|
+
const setDataField = React.useCallback((id, val, dirty = true) => {
|
876
886
|
const { flowNameFromPath = flowName } = flowerCore.CoreUtils.getPath(id);
|
877
887
|
dispatch(actions.addDataByPath({
|
878
888
|
flowName: flowNameFromPath,
|
879
889
|
id,
|
880
890
|
value: val,
|
881
|
-
dirty
|
891
|
+
dirty
|
882
892
|
}));
|
883
893
|
return;
|
884
894
|
}, [flowName, dispatch]);
|
@@ -923,7 +933,8 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
923
933
|
unsetData,
|
924
934
|
replaceData,
|
925
935
|
reset,
|
926
|
-
setCustomErrors
|
936
|
+
setCustomErrors,
|
937
|
+
getFormStatus
|
927
938
|
};
|
928
939
|
};
|
929
940
|
|
package/dist/index.esm.js
CHANGED
@@ -848,6 +848,7 @@ const component = memo(FlowerComponent);
|
|
848
848
|
* - replaceData,
|
849
849
|
* - reset,
|
850
850
|
* - setCustomErrors
|
851
|
+
* - getFormStatus
|
851
852
|
*
|
852
853
|
* @param {string} flowName - first optional parameter
|
853
854
|
*
|
@@ -870,13 +871,22 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
870
871
|
...newpath
|
871
872
|
]);
|
872
873
|
}, [store, flowName]);
|
873
|
-
const
|
874
|
+
const getFormStatus = useCallback((path) => {
|
875
|
+
const { flowNameFromPath = flowName, path: newpath } = CoreUtils.getPath(path);
|
876
|
+
return _get(store.getState(), [
|
877
|
+
'flower',
|
878
|
+
flowNameFromPath,
|
879
|
+
'form',
|
880
|
+
...newpath
|
881
|
+
]);
|
882
|
+
}, [store, flowName]);
|
883
|
+
const setDataField = useCallback((id, val, dirty = true) => {
|
874
884
|
const { flowNameFromPath = flowName } = CoreUtils.getPath(id);
|
875
885
|
dispatch(actions.addDataByPath({
|
876
886
|
flowName: flowNameFromPath,
|
877
887
|
id,
|
878
888
|
value: val,
|
879
|
-
dirty
|
889
|
+
dirty
|
880
890
|
}));
|
881
891
|
return;
|
882
892
|
}, [flowName, dispatch]);
|
@@ -921,7 +931,8 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
921
931
|
unsetData,
|
922
932
|
replaceData,
|
923
933
|
reset,
|
924
|
-
setCustomErrors
|
934
|
+
setCustomErrors,
|
935
|
+
getFormStatus
|
925
936
|
};
|
926
937
|
};
|
927
938
|
|
@@ -85,7 +85,7 @@ export type FlowerFieldProps<T extends Record<string, any> = Record<string, any>
|
|
85
85
|
asyncWaitingError?: string;
|
86
86
|
/** An object containing the display rules of that component. When the conditions are not satisfied, the children is hidden.
|
87
87
|
*
|
88
|
-
* Example: rules={{ $and: [{ name: { $
|
88
|
+
* Example: rules={{ $and: [{ name: { $exists: true } }] }}
|
89
89
|
*/
|
90
90
|
rules?: RulesObject<T> | FunctionRule;
|
91
91
|
/** The name of the flow from which read the data
|
@@ -15,6 +15,8 @@ export type UseFlowerForm = (options?: UseFlowerProps) => {
|
|
15
15
|
isValid: boolean;
|
16
16
|
/** This value is set to true during asynchronous validation.*/
|
17
17
|
isValidating: boolean | undefined;
|
18
|
+
/** Use this function to read status from the flow's form. */
|
19
|
+
getFormStatus: (path?: string) => any;
|
18
20
|
/** Use this function to read values from the flow's data. */
|
19
21
|
getData: (path?: string) => any;
|
20
22
|
/** Use this function to set values in the flow's data. */
|
@@ -22,13 +24,15 @@ export type UseFlowerForm = (options?: UseFlowerProps) => {
|
|
22
24
|
/** The value that you want to set */
|
23
25
|
value: any,
|
24
26
|
/** Specify the target path to set the value*/
|
25
|
-
|
27
|
+
id?: string) => void;
|
26
28
|
/** Use this function to set value in the flow's field data. */
|
27
29
|
setDataField: (
|
28
30
|
/** Specify the target path to set the value*/
|
29
|
-
|
31
|
+
id: string,
|
30
32
|
/** The value that you want to set */
|
31
|
-
value: any
|
33
|
+
value: any,
|
34
|
+
/** Specify default value for dirty status*/
|
35
|
+
dirty?: boolean) => void;
|
32
36
|
/** Use this function to unset values in the flow's data. */
|
33
37
|
unsetData: (
|
34
38
|
/** Specify the target path to the value tha you want to unset*/
|
@@ -11,7 +11,7 @@ export type FlowerRuleProps = {
|
|
11
11
|
value?: any;
|
12
12
|
/** An object or function containing the display rules of that component. When the conditions are not satisfied, the children is hidden.
|
13
13
|
*
|
14
|
-
* Example: rules={{ $and: [{ name: { $
|
14
|
+
* Example: rules={{ $and: [{ name: { $exists: true } }] }}
|
15
15
|
* Example: rules={(state) => state... === true}
|
16
16
|
* if missing it is always visible
|
17
17
|
*/
|
@@ -11,7 +11,7 @@ export type FlowerValueProps = {
|
|
11
11
|
value?: any;
|
12
12
|
/** An object containing the display rules of that component. When the conditions are not satisfied, the children is hidden.
|
13
13
|
*
|
14
|
-
* Example: rules={{ $and: [{ name: { $
|
14
|
+
* Example: rules={{ $and: [{ name: { $exists: true } }] }}
|
15
15
|
*/
|
16
16
|
rules?: RulesObject<any> | FunctionRule;
|
17
17
|
/** The FlowerValue's children */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flowerforce/flower-react",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.3.1",
|
4
4
|
"description": "FlowerJS components, hooks and utils for React.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"typescript": "^5.4.5"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@flowerforce/flower-core": "3.2.
|
37
|
+
"@flowerforce/flower-core": "3.2.1",
|
38
38
|
"@reduxjs/toolkit": "^2.2.4",
|
39
39
|
"lodash": "^4.17.21",
|
40
40
|
"react-redux": "^9.1.2",
|