@flowerforce/flower-react 3.5.1-beta.1 β 3.6.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 +17 -0
- package/README.md +13 -13
- package/dist/index.cjs.js +32 -18
- package/dist/index.esm.js +32 -18
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## 3.6.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
|
+
|
13
|
+
|
14
|
+
### 𧱠Updated Dependencies
|
15
|
+
|
16
|
+
- Updated flower-core to 3.4.0
|
17
|
+
|
1
18
|
## 3.5.0 (2024-10-08)
|
2
19
|
|
3
20
|
|
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<a alt="Flower logo" href="https://flowerjs.it/" target="_blank" rel="noreferrer"><img src="https://flowerjs.it/_next/static/media/flower-logo.bb32f863.svg" width="50"></a>
|
4
4
|
|
5
|
-
Flower React is a front-end development library built on top of Flower Core, specifically designed for React applications. It seamlessly integrates Flower's powerful capabilities into React projects, providing a user-friendly interface
|
5
|
+
Flower React is a front-end development library built on top of Flower Core, specifically designed for React applications. It seamlessly integrates Flower's powerful capabilities into React projects, providing a user-friendly interface to create, modify, and monitor workflows.
|
6
6
|
|
7
7
|
For more info [flowerjs.it/](https://flowerjs.it/)
|
8
8
|
|
@@ -10,7 +10,7 @@ For more info [flowerjs.it/](https://flowerjs.it/)
|
|
10
10
|
|
11
11
|
## Features
|
12
12
|
|
13
|
-
- **Workflow Management**: Comprehensive API
|
13
|
+
- **Workflow Management**: Comprehensive API to create, update, and manage workflows programmatically.
|
14
14
|
- **Node and Connection Handling**: Functions to manage nodes and connections, including adding, removing, and editing.
|
15
15
|
- **State Management**: Built-in state management to keep track of workflow changes and updates.
|
16
16
|
- **Event System**: Customizable event handling to respond to user interactions and changes within the workflow.
|
@@ -45,7 +45,7 @@ yarn add @flowerforce/flower-react
|
|
45
45
|
|
46
46
|
## Configuration
|
47
47
|
|
48
|
-
The **FlowerProvider** component wraps the entire application, providing a global context
|
48
|
+
The **FlowerProvider** component wraps the entire application, providing a global context to manage the application flow.
|
49
49
|
|
50
50
|
```jsx
|
51
51
|
import React from 'react'
|
@@ -65,7 +65,7 @@ function Root() {
|
|
65
65
|
|
66
66
|
### Simple Example
|
67
67
|
|
68
|
-
The **Flower** component defines an application flow with a specific name, which serves as a unique identifier for the flow. It is the main component
|
68
|
+
The **Flower** component defines an application flow with a specific name, which serves as a unique identifier for the flow. It is the main component to define the application flow, accepting a required "name" property and an initialData field to prepopulate values.
|
69
69
|
|
70
70
|
The **FlowerNode** component represents a UI state or a step within the application flow. Transitions between nodes can be specified using the **to** object.
|
71
71
|
|
@@ -106,7 +106,7 @@ export const Page = () => {
|
|
106
106
|
Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-9wsjv7)
|
107
107
|
|
108
108
|
|
109
|
-
> In addition you can pass the prop ***initialState*** to the `<Flower>` component
|
109
|
+
> In addition you can pass the prop ***initialState*** to the `<Flower>` component
|
110
110
|
|
111
111
|
This prop allows you to configure the following fields:
|
112
112
|
|
@@ -133,7 +133,7 @@ export const Page = () => {
|
|
133
133
|
return (
|
134
134
|
<Flower name="demo">
|
135
135
|
{/* autonext */}
|
136
|
-
<FlowerRoute id="start" to={{ step1: null }} />
|
136
|
+
<FlowerRoute id="start" to={{ step1: null }} />
|
137
137
|
<FlowerNode
|
138
138
|
id="step1"
|
139
139
|
to={{
|
@@ -221,7 +221,7 @@ Here's an example of how it works:
|
|
221
221
|
|
222
222
|
```jsx
|
223
223
|
import React from 'react'
|
224
|
-
import {
|
224
|
+
import {
|
225
225
|
Flower,
|
226
226
|
FlowerRoute,
|
227
227
|
FlowerNavigate,
|
@@ -461,9 +461,9 @@ Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-f
|
|
461
461
|
|
462
462
|
### Utils Callback onEnter - onExit
|
463
463
|
|
464
|
-
onEnter (function): A callback function that is executed when entering the node state. It's useful
|
464
|
+
onEnter (function): A callback function that is executed when entering the node state. It's useful to perform specific operations when the user transitions to this state.
|
465
465
|
|
466
|
-
onExit (function): A callback function that is executed when exiting the node state. It's useful
|
466
|
+
onExit (function): A callback function that is executed when exiting the node state. It's useful to perform specific operations when the user leaves this state.
|
467
467
|
|
468
468
|
```jsx
|
469
469
|
import React from 'react'
|
@@ -503,7 +503,7 @@ export const Page = () => {
|
|
503
503
|
|
504
504
|
Flower enables the quick creation of forms.
|
505
505
|
|
506
|
-
It keeps track of the form's validity status.
|
506
|
+
It keeps track of the form's validity status. Not only does this status facilitate displaying error messages to the user, but it can also be leveraged to implement flow rules.
|
507
507
|
|
508
508
|
### Basic Usage
|
509
509
|
|
@@ -658,7 +658,7 @@ Edit on [codesandbox/](https://codesandbox.io/p/sandbox/flower-react-example-1-f
|
|
658
658
|
|
659
659
|
## Operators Rules
|
660
660
|
|
661
|
-
The "rules" in Flower are used to define conditions and conditional behaviors within the workflow. These rules allow
|
661
|
+
The "rules" in Flower are used to define conditions and conditional behaviors within the workflow. These rules allow to dynamically change the display or behavior of certain fields or components based on specific conditions.
|
662
662
|
|
663
663
|
The rules schema follows the MongoDB style, below is the list of available operators:
|
664
664
|
|
@@ -875,7 +875,7 @@ First, create the JSON file at the same level as the component file.
|
|
875
875
|
|
876
876
|
```
|
877
877
|
src
|
878
|
-
β
|
878
|
+
β
|
879
879
|
β
|
880
880
|
ββββcomponents
|
881
881
|
β β
|
@@ -904,7 +904,7 @@ The keys in the JSON file have the following purposes:
|
|
904
904
|
- `type`: indicates what is being described with this JSON file, in this case, a component
|
905
905
|
- `name`: the name of the component being configured
|
906
906
|
- `category`: components are grouped into categories in Flower's graphical interface, so you can choose a category to which the component belongs
|
907
|
-
- `description`: a brief description of the component that will be displayed in the graphical interface. This is particularly useful
|
907
|
+
- `description`: a brief description of the component that will be displayed in the graphical interface. This is particularly useful to understand the functionality of a specific component without reading the code
|
908
908
|
- `editing`: in this key, we will insert the options that will allow us to configure the component's behavior directly from the graphical interface
|
909
909
|
|
910
910
|
Once you have completed these two steps, you will be able to use your `Text component` through the graphical interface.
|
package/dist/index.cjs.js
CHANGED
@@ -522,6 +522,34 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
522
522
|
}
|
523
523
|
});
|
524
524
|
}, [flowName, currentNode, isValidating]);
|
525
|
+
const resetField = React.useCallback(() => {
|
526
|
+
dispatch({
|
527
|
+
type: 'flower/formFieldTouch',
|
528
|
+
payload: {
|
529
|
+
name: flowName,
|
530
|
+
id,
|
531
|
+
currentNode,
|
532
|
+
touched: false
|
533
|
+
}
|
534
|
+
});
|
535
|
+
dispatch({
|
536
|
+
type: 'flower/formFieldDirty',
|
537
|
+
payload: {
|
538
|
+
name: flowName,
|
539
|
+
id,
|
540
|
+
currentNode,
|
541
|
+
dirty: false
|
542
|
+
}
|
543
|
+
});
|
544
|
+
dispatch({
|
545
|
+
type: 'flower/formRemoveErrors',
|
546
|
+
payload: {
|
547
|
+
name: flowName,
|
548
|
+
id,
|
549
|
+
currentNode
|
550
|
+
}
|
551
|
+
});
|
552
|
+
}, [currentNode, id, flowName]);
|
525
553
|
React.useEffect(() => {
|
526
554
|
// destroy
|
527
555
|
return () => {
|
@@ -531,16 +559,9 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
531
559
|
payload: { flowName: flowNameFromPath, id: path }
|
532
560
|
});
|
533
561
|
}
|
534
|
-
|
535
|
-
type: 'flower/formRemoveErrors',
|
536
|
-
payload: {
|
537
|
-
name: flowName,
|
538
|
-
id,
|
539
|
-
currentNode
|
540
|
-
}
|
541
|
-
});
|
562
|
+
resetField();
|
542
563
|
};
|
543
|
-
}, [destroyValue, id, flowNameFromPath, path,
|
564
|
+
}, [destroyValue, id, flowNameFromPath, path, resetField]);
|
544
565
|
React.useEffect(() => {
|
545
566
|
if (hidden) {
|
546
567
|
if (destroyOnHide) {
|
@@ -548,17 +569,10 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
548
569
|
type: `flower/unsetData`,
|
549
570
|
payload: { flowName: flowNameFromPath, id: path }
|
550
571
|
});
|
572
|
+
resetField();
|
551
573
|
}
|
552
|
-
dispatch({
|
553
|
-
type: 'flower/formRemoveErrors',
|
554
|
-
payload: {
|
555
|
-
name: flowName,
|
556
|
-
id,
|
557
|
-
currentNode
|
558
|
-
}
|
559
|
-
});
|
560
574
|
}
|
561
|
-
}, [destroyOnHide, hidden,
|
575
|
+
}, [destroyOnHide, hidden, flowNameFromPath, path, resetField]);
|
562
576
|
React.useEffect(() => {
|
563
577
|
if (defaultValue && !dirty && !isEqual(value, defaultValue)) {
|
564
578
|
onChange(defaultValue);
|
package/dist/index.esm.js
CHANGED
@@ -520,6 +520,34 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
520
520
|
}
|
521
521
|
});
|
522
522
|
}, [flowName, currentNode, isValidating]);
|
523
|
+
const resetField = useCallback(() => {
|
524
|
+
dispatch({
|
525
|
+
type: 'flower/formFieldTouch',
|
526
|
+
payload: {
|
527
|
+
name: flowName,
|
528
|
+
id,
|
529
|
+
currentNode,
|
530
|
+
touched: false
|
531
|
+
}
|
532
|
+
});
|
533
|
+
dispatch({
|
534
|
+
type: 'flower/formFieldDirty',
|
535
|
+
payload: {
|
536
|
+
name: flowName,
|
537
|
+
id,
|
538
|
+
currentNode,
|
539
|
+
dirty: false
|
540
|
+
}
|
541
|
+
});
|
542
|
+
dispatch({
|
543
|
+
type: 'flower/formRemoveErrors',
|
544
|
+
payload: {
|
545
|
+
name: flowName,
|
546
|
+
id,
|
547
|
+
currentNode
|
548
|
+
}
|
549
|
+
});
|
550
|
+
}, [currentNode, id, flowName]);
|
523
551
|
useEffect(() => {
|
524
552
|
// destroy
|
525
553
|
return () => {
|
@@ -529,16 +557,9 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
529
557
|
payload: { flowName: flowNameFromPath, id: path }
|
530
558
|
});
|
531
559
|
}
|
532
|
-
|
533
|
-
type: 'flower/formRemoveErrors',
|
534
|
-
payload: {
|
535
|
-
name: flowName,
|
536
|
-
id,
|
537
|
-
currentNode
|
538
|
-
}
|
539
|
-
});
|
560
|
+
resetField();
|
540
561
|
};
|
541
|
-
}, [destroyValue, id, flowNameFromPath, path,
|
562
|
+
}, [destroyValue, id, flowNameFromPath, path, resetField]);
|
542
563
|
useEffect(() => {
|
543
564
|
if (hidden) {
|
544
565
|
if (destroyOnHide) {
|
@@ -546,17 +567,10 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
546
567
|
type: `flower/unsetData`,
|
547
568
|
payload: { flowName: flowNameFromPath, id: path }
|
548
569
|
});
|
570
|
+
resetField();
|
549
571
|
}
|
550
|
-
dispatch({
|
551
|
-
type: 'flower/formRemoveErrors',
|
552
|
-
payload: {
|
553
|
-
name: flowName,
|
554
|
-
id,
|
555
|
-
currentNode
|
556
|
-
}
|
557
|
-
});
|
558
572
|
}
|
559
|
-
}, [destroyOnHide, hidden,
|
573
|
+
}, [destroyOnHide, hidden, flowNameFromPath, path, resetField]);
|
560
574
|
useEffect(() => {
|
561
575
|
if (defaultValue && !dirty && !isEqual(value, defaultValue)) {
|
562
576
|
onChange(defaultValue);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flowerforce/flower-react",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.6.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.
|
37
|
+
"@flowerforce/flower-core": "3.4.0",
|
38
38
|
"@reduxjs/toolkit": "^2.2.4",
|
39
39
|
"lodash": "^4.17.21",
|
40
40
|
"react-redux": "^9.1.2",
|