@flowerforce/flower-react 3.1.2-beta.9 → 3.3.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 +40 -0
- package/LICENSE +18 -12
- package/dist/index.cjs.js +14 -3
- package/dist/index.esm.js +14 -3
- package/dist/src/components/types/FlowerHooks.d.ts +7 -3
- package/dist/src/components/useFlowerForm.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1
|
+
## 3.3.0 (2024-08-27)
|
2
|
+
|
3
|
+
|
4
|
+
### 🚀 Features
|
5
|
+
|
6
|
+
- added new utils to retrieve form status ([c1ac7ba](https://github.com/flowerforce/flower/commit/c1ac7ba))
|
7
|
+
|
8
|
+
- added dirty default value ([02a5e28](https://github.com/flowerforce/flower/commit/02a5e28))
|
9
|
+
|
10
|
+
## 3.2.0 (2024-07-23)
|
11
|
+
|
12
|
+
|
13
|
+
### 🚀 Features
|
14
|
+
|
15
|
+
- expose start node id from hook useFlower ([77223f7](https://github.com/flowerforce/flower/commit/77223f7))
|
16
|
+
|
17
|
+
- remove remote key in devtool ([f89abdc](https://github.com/flowerforce/flower/commit/f89abdc))
|
18
|
+
|
19
|
+
- Added the function to reset a form at a specific step or current step ([b17780f](https://github.com/flowerforce/flower/commit/b17780f))
|
20
|
+
|
21
|
+
- added custom errors ([c09a23a](https://github.com/flowerforce/flower/commit/c09a23a))
|
22
|
+
|
23
|
+
- **devtool:** add sourcemap preview ([7882290](https://github.com/flowerforce/flower/commit/7882290))
|
24
|
+
|
25
|
+
- **Form:** add submitted status in form node ([fd2d69f](https://github.com/flowerforce/flower/commit/fd2d69f))
|
26
|
+
|
27
|
+
- **Form:** add setDataField to chag ([935d8a5](https://github.com/flowerforce/flower/commit/935d8a5))
|
28
|
+
|
29
|
+
|
30
|
+
### 🩹 Fixes
|
31
|
+
|
32
|
+
- remove global.window object ([81a10c5](https://github.com/flowerforce/flower/commit/81a10c5))
|
33
|
+
|
34
|
+
- restore documentation comments into d.ts ([d5677d9](https://github.com/flowerforce/flower/commit/d5677d9))
|
35
|
+
|
36
|
+
|
37
|
+
### 🧱 Updated Dependencies
|
38
|
+
|
39
|
+
- Updated flower-core to 3.2.0
|
40
|
+
|
1
41
|
## 3.1.1 (2024-06-11)
|
2
42
|
|
3
43
|
|
package/LICENSE
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
3
|
Copyright (c) 2024 FlowerForce
|
4
4
|
|
5
|
-
Permission
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
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
|
|
@@ -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*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flowerforce/flower-react",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.3.0",
|
4
4
|
"description": "FlowerJS components, hooks and utils for React.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"scripts": {
|
21
21
|
"tsc:noemit": "tsc -p tsconfig.lib.json --noEmit"
|
22
22
|
},
|
23
|
-
"license": "
|
23
|
+
"license": "MIT",
|
24
24
|
"peerDependencies": {
|
25
25
|
"react": ">=18"
|
26
26
|
},
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"typescript": "^5.4.5"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@flowerforce/flower-core": "3.
|
37
|
+
"@flowerforce/flower-core": "3.2.0",
|
38
38
|
"@reduxjs/toolkit": "^2.2.4",
|
39
39
|
"lodash": "^4.17.21",
|
40
40
|
"react-redux": "^9.1.2",
|