@flowerforce/flower-react 3.1.1-beta.1 → 3.1.2-beta.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 +7 -0
- package/README.md +85 -10
- package/dist/index.cjs.js +126 -13
- package/dist/index.esm.js +128 -15
- package/dist/src/components/types/DefaultNode.d.ts +17 -0
- package/dist/src/components/types/FlowerComponent.d.ts +2 -0
- package/dist/src/components/types/FlowerField.d.ts +78 -0
- package/dist/src/components/types/FlowerFlow.d.ts +10 -0
- package/dist/src/components/types/FlowerHooks.d.ts +25 -2
- package/dist/src/components/types/FlowerNavigate.d.ts +14 -0
- package/dist/src/components/types/FlowerNode.d.ts +10 -0
- package/dist/src/components/types/FlowerRoute.d.ts +17 -0
- package/dist/src/components/types/FlowerRule.d.ts +23 -0
- package/dist/src/components/types/FlowerServer.d.ts +2 -0
- package/dist/src/components/types/FlowerValue.d.ts +22 -0
- package/dist/src/components/useFlower.d.ts +18 -0
- package/dist/src/components/useFlowerForm.d.ts +17 -0
- package/dist/src/provider.d.ts +7 -5
- package/package.json +2 -2
@@ -1,11 +1,34 @@
|
|
1
1
|
import { FunctionRule, RulesObject } from '@flowerforce/flower-core';
|
2
2
|
export type FlowerRuleProps = {
|
3
|
+
/** The path to the value you want to read from the flow's data
|
4
|
+
*
|
5
|
+
* Example: id="loginForm.name"
|
6
|
+
*
|
7
|
+
* The FlowerRule component reads the value of the key "name" of the loginForm object in the flow's data
|
8
|
+
*/
|
3
9
|
id?: string;
|
10
|
+
/** */
|
4
11
|
value?: any;
|
12
|
+
/** An object or function containing the display rules of that component. When the conditions are not satisfied, the children is hidden.
|
13
|
+
*
|
14
|
+
* Example: rules={{ $and: [{ name: { $exist: true } }] }}
|
15
|
+
* Example: rules={(state) => state... === true}
|
16
|
+
* if missing it is always visible
|
17
|
+
*/
|
5
18
|
rules?: RulesObject<any> | FunctionRule;
|
19
|
+
/** The name of the flow from which read the data
|
20
|
+
*
|
21
|
+
* - note: the default value is the name of the flow where the component is used
|
22
|
+
*/
|
6
23
|
flowName?: string;
|
24
|
+
/** When set to true, the children is shown even if the rules are not satisfied
|
25
|
+
*
|
26
|
+
* The FlowerRule returns the boolean variable "hidden" to notify you if the conditions are satisfied or not
|
27
|
+
*/
|
7
28
|
alwaysDisplay?: boolean;
|
29
|
+
/** The function executed when the value found at the path passed to the "id" prop changes */
|
8
30
|
onUpdate?: (hidden: boolean) => void;
|
31
|
+
/** The children of the FlowerRule*/
|
9
32
|
children?: React.ReactNode | ((props: {
|
10
33
|
hidden?: boolean;
|
11
34
|
}) => React.ReactNode | React.ReactElement | undefined);
|
@@ -1,11 +1,33 @@
|
|
1
1
|
import { FunctionRule, RulesObject } from '@flowerforce/flower-core';
|
2
2
|
export type FlowerValueProps = {
|
3
|
+
/** The path to the value you want to read from the flow's data
|
4
|
+
*
|
5
|
+
* Example: id="loginForm.name"
|
6
|
+
*
|
7
|
+
* The FlowerValue component reads the value of the key "name" of the loginForm object in the flow's data
|
8
|
+
* If missing, I return all values, which is equivalent to setting id='*'
|
9
|
+
*/
|
3
10
|
id?: string;
|
4
11
|
value?: any;
|
12
|
+
/** An object containing the display rules of that component. When the conditions are not satisfied, the children is hidden.
|
13
|
+
*
|
14
|
+
* Example: rules={{ $and: [{ name: { $exist: true } }] }}
|
15
|
+
*/
|
5
16
|
rules?: RulesObject<any> | FunctionRule;
|
17
|
+
/** The FlowerValue's children */
|
6
18
|
children: React.ReactNode | ((props: Record<string, any>) => React.ReactNode | React.ReactElement | undefined);
|
19
|
+
/** Set this value to true to spread the value into separate values in case it is an object. */
|
7
20
|
spreadValue?: boolean;
|
21
|
+
/** The name of the flow from which read the data
|
22
|
+
*
|
23
|
+
* - note: the default value is the name of the flow where the component is used
|
24
|
+
*/
|
8
25
|
flowName?: string;
|
26
|
+
/** When set to true, the children is shown even if the rules are not satisfied
|
27
|
+
*
|
28
|
+
* The FlowerValue returns the boolean variable "hidden" to notify you if the conditions are satisfied or not
|
29
|
+
*/
|
9
30
|
alwaysDisplay?: boolean;
|
31
|
+
/** The function executed when the value found at the path passed to the "id" prop changes */
|
10
32
|
onUpdate?: (value: any) => void;
|
11
33
|
};
|
@@ -1,3 +1,21 @@
|
|
1
1
|
import { UseFlower } from './types/FlowerHooks';
|
2
|
+
/** This hook allows you to read flow informations, such as the flowName and ID of the current node.
|
3
|
+
*
|
4
|
+
* It also exposes all the functions to navigate within the flow:
|
5
|
+
*
|
6
|
+
* - next
|
7
|
+
*
|
8
|
+
* - back
|
9
|
+
*
|
10
|
+
* - jump
|
11
|
+
*
|
12
|
+
* - reset
|
13
|
+
*
|
14
|
+
* - restart
|
15
|
+
*
|
16
|
+
* @param {string} flowName - first optional parameter
|
17
|
+
*
|
18
|
+
* @param {string} name - optional parameter, if flowName exist, name is not used
|
19
|
+
*/
|
2
20
|
declare const useFlower: UseFlower;
|
3
21
|
export default useFlower;
|
@@ -1,3 +1,20 @@
|
|
1
1
|
import { UseFlowerForm } from './types/FlowerHooks';
|
2
|
+
/** This hook allows you to manage and retrieve information about Forms.
|
3
|
+
*
|
4
|
+
* It exposes details regarding the form's state and a set of methods for reading and writing within it:
|
5
|
+
*
|
6
|
+
* - getData
|
7
|
+
*
|
8
|
+
* - setData
|
9
|
+
*
|
10
|
+
* - unSetData
|
11
|
+
*
|
12
|
+
* - replaceData
|
13
|
+
*
|
14
|
+
* @param {string} flowName - first optional parameter
|
15
|
+
*
|
16
|
+
* @param {string} name - optional parameter, if flowName exist, name is not used
|
17
|
+
*
|
18
|
+
*/
|
2
19
|
declare const useFlowerForm: UseFlowerForm;
|
3
20
|
export default useFlowerForm;
|
package/dist/src/provider.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { PropsWithChildren,
|
1
|
+
import React, { PropsWithChildren, PureComponent } from 'react';
|
2
2
|
import { Action } from '@reduxjs/toolkit';
|
3
3
|
import { FlowerProviderProps } from './components/types/FlowerProvider';
|
4
4
|
export declare const useDispatch: import("react-redux").UseDispatch<import("redux").Dispatch<Action>>;
|
@@ -13,11 +13,13 @@ export declare const store: ({ enableDevtool }: {
|
|
13
13
|
flower: Record<string, import("packages/flower-core/dist/src").Flower<Record<string, any>>>;
|
14
14
|
}, undefined, import("redux").UnknownAction>;
|
15
15
|
}>, import("redux").StoreEnhancer]>>;
|
16
|
-
declare class FlowerProvider extends
|
16
|
+
declare class FlowerProvider extends PureComponent<PropsWithChildren<{
|
17
|
+
enableReduxDevtool?: boolean;
|
18
|
+
}>, FlowerProviderProps> {
|
17
19
|
private store;
|
18
|
-
constructor(props: PropsWithChildren
|
19
|
-
|
20
|
-
});
|
20
|
+
constructor(props: PropsWithChildren<{
|
21
|
+
enableReduxDevtool?: boolean;
|
22
|
+
}>);
|
21
23
|
render(): React.JSX.Element;
|
22
24
|
}
|
23
25
|
export default FlowerProvider;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flowerforce/flower-react",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.2-beta.0",
|
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.1.
|
37
|
+
"@flowerforce/flower-core": "3.1.2-beta.0",
|
38
38
|
"@reduxjs/toolkit": "^2.2.4",
|
39
39
|
"lodash": "^4.17.21",
|
40
40
|
"react-redux": "^9.1.2",
|