@flowerforce/flower-core 4.0.1-beta.8 → 4.0.1-beta.9
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,38 @@
|
|
1
|
+
## 3.5.2 (2025-04-23)
|
2
|
+
|
3
|
+
|
4
|
+
### 🩹 Fixes
|
5
|
+
|
6
|
+
- fix init nodes ([996d8af](https://github.com/flowerforce/flower/commit/996d8af))
|
7
|
+
|
8
|
+
- package lock ([a3bb210](https://github.com/flowerforce/flower/commit/a3bb210))
|
9
|
+
|
10
|
+
## 3.5.1 (2025-04-19)
|
11
|
+
|
12
|
+
|
13
|
+
### 🩹 Fixes
|
14
|
+
|
15
|
+
- remove empty object from init state ([8604346](https://github.com/flowerforce/flower/commit/8604346))
|
16
|
+
|
17
|
+
## 3.5.0 (2025-04-19)
|
18
|
+
|
19
|
+
|
20
|
+
### 🚀 Features
|
21
|
+
|
22
|
+
- remove data blank from init nodes ([#80](https://github.com/flowerforce/flower/pull/80))
|
23
|
+
|
24
|
+
## 3.4.0 (2025-04-19)
|
25
|
+
|
26
|
+
|
27
|
+
### 🚀 Features
|
28
|
+
|
29
|
+
- added remove value on hide element ([#68](https://github.com/flowerforce/flower/pull/68))
|
30
|
+
|
31
|
+
|
32
|
+
### 🩹 Fixes
|
33
|
+
|
34
|
+
- avoid validate hidden field ([#67](https://github.com/flowerforce/flower/pull/67))
|
35
|
+
|
1
36
|
## 3.3.0 (2024-10-08)
|
2
37
|
|
3
38
|
|
package/dist/index.cjs.js
CHANGED
@@ -304,9 +304,6 @@ const flattenRules = (ob) => {
|
|
304
304
|
}
|
305
305
|
return result;
|
306
306
|
};
|
307
|
-
const getRulesExists = (rules) => {
|
308
|
-
return Object.keys(rules).length ? FlowUtils.mapEdge(rules) : undefined;
|
309
|
-
};
|
310
307
|
const FlowUtils = {
|
311
308
|
generateRulesName: (nextRules) => {
|
312
309
|
return nextRules.reduce((acc, inc) => {
|
@@ -363,23 +360,6 @@ const FlowUtils = {
|
|
363
360
|
return res;
|
364
361
|
},
|
365
362
|
makeRules: (rules) => Object.entries(rules).reduce((acc2, [k, v]) => [...acc2, { nodeId: k, rules: v }], []),
|
366
|
-
// TODO: This function is strictly related to React nodes, could make sense to move it in the flower-react folder
|
367
|
-
generateNodesForFlowerJson: (nodes) => nodes
|
368
|
-
.filter((e) => !!_get(e, 'props.id'))
|
369
|
-
.map((e) => {
|
370
|
-
const rules = FlowUtils.makeRules(e.props.to ?? {});
|
371
|
-
const nextRules = getRulesExists(rules);
|
372
|
-
const children = e.props.data?.children;
|
373
|
-
return {
|
374
|
-
nodeId: e.props.id,
|
375
|
-
nodeType: e.type.displayName || e.props.as || 'FlowerNode',
|
376
|
-
nodeTitle: _get(e.props, 'data.title'),
|
377
|
-
children,
|
378
|
-
nextRules,
|
379
|
-
retain: e.props.retain,
|
380
|
-
disabled: e.props.disabled
|
381
|
-
};
|
382
|
-
}),
|
383
363
|
allEqual: (arr, arr2) => arr.length === arr2.length && arr.every((v) => arr2.includes(v)),
|
384
364
|
findValidRule: (nextRules, value, prefix) => find(nextRules, (rule) => {
|
385
365
|
// fix per evitare di entrare in un nodo senza regole, ma con un name,
|
package/dist/index.esm.js
CHANGED
@@ -302,9 +302,6 @@ const flattenRules = (ob) => {
|
|
302
302
|
}
|
303
303
|
return result;
|
304
304
|
};
|
305
|
-
const getRulesExists = (rules) => {
|
306
|
-
return Object.keys(rules).length ? FlowUtils.mapEdge(rules) : undefined;
|
307
|
-
};
|
308
305
|
const FlowUtils = {
|
309
306
|
generateRulesName: (nextRules) => {
|
310
307
|
return nextRules.reduce((acc, inc) => {
|
@@ -361,23 +358,6 @@ const FlowUtils = {
|
|
361
358
|
return res;
|
362
359
|
},
|
363
360
|
makeRules: (rules) => Object.entries(rules).reduce((acc2, [k, v]) => [...acc2, { nodeId: k, rules: v }], []),
|
364
|
-
// TODO: This function is strictly related to React nodes, could make sense to move it in the flower-react folder
|
365
|
-
generateNodesForFlowerJson: (nodes) => nodes
|
366
|
-
.filter((e) => !!_get(e, 'props.id'))
|
367
|
-
.map((e) => {
|
368
|
-
const rules = FlowUtils.makeRules(e.props.to ?? {});
|
369
|
-
const nextRules = getRulesExists(rules);
|
370
|
-
const children = e.props.data?.children;
|
371
|
-
return {
|
372
|
-
nodeId: e.props.id,
|
373
|
-
nodeType: e.type.displayName || e.props.as || 'FlowerNode',
|
374
|
-
nodeTitle: _get(e.props, 'data.title'),
|
375
|
-
children,
|
376
|
-
nextRules,
|
377
|
-
retain: e.props.retain,
|
378
|
-
disabled: e.props.disabled
|
379
|
-
};
|
380
|
-
}),
|
381
361
|
allEqual: (arr, arr2) => arr.length === arr2.length && arr.every((v) => arr2.includes(v)),
|
382
362
|
findValidRule: (nextRules, value, prefix) => find(nextRules, (rule) => {
|
383
363
|
// fix per evitare di entrare in un nodo senza regole, ma con un name,
|
@@ -26,6 +26,15 @@ export type Edge<T = object> = {
|
|
26
26
|
rules: RulesObject<T>;
|
27
27
|
};
|
28
28
|
};
|
29
|
+
export type NodeConfig = {
|
30
|
+
nodeId: string | undefined;
|
31
|
+
nodeType: string;
|
32
|
+
nodeTitle: string;
|
33
|
+
children: Node['children'];
|
34
|
+
nextRules: ReturnType<MapEdge> | undefined;
|
35
|
+
retain: boolean;
|
36
|
+
disabled: boolean;
|
37
|
+
};
|
29
38
|
export type Node = {
|
30
39
|
nodeId: string | undefined;
|
31
40
|
nodeType: string;
|
@@ -93,22 +102,12 @@ export type MapEdge<K = RulesByNodeId<any>, T = K[]> = (nextNode: T) => Array<K>
|
|
93
102
|
export type MakeRules<T extends Record<string, any> = {
|
94
103
|
rules: RulesObject<any> | object;
|
95
104
|
}> = (rules: T) => Array<RulesByNodeId<T>>;
|
96
|
-
export type GetRulesExists = (rules: RulesByNodeId<any>[]) => ReturnType<MapEdge> | undefined;
|
97
|
-
export type GenerateNodesForFlowerJson = (nodes: Node[], edges?: Edge[]) => {
|
98
|
-
nodeId: string | undefined;
|
99
|
-
nodeType: string;
|
100
|
-
nodeTitle: string;
|
101
|
-
children: Node['children'];
|
102
|
-
nextRules: ReturnType<GetRulesExists>;
|
103
|
-
retain: boolean;
|
104
|
-
disabled: boolean;
|
105
|
-
}[];
|
106
105
|
export type HasNode = (state: Record<string, any>, name: string, node: string) => boolean;
|
107
|
-
export type MakeObjectRules = (nodes:
|
106
|
+
export type MakeObjectRules = (nodes: NodeConfig[]) => {
|
108
107
|
[x: string]: Node['nextRules'];
|
109
108
|
};
|
110
|
-
export type GenerateNodes = (nodes:
|
111
|
-
[x: string]:
|
109
|
+
export type GenerateNodes = (nodes: NodeConfig[]) => {
|
110
|
+
[x: string]: Partial<Node>;
|
112
111
|
};
|
113
112
|
export type MapKeysDeepLodash = (obj: Record<string, any>, cb: (...args: any) => any, isRecursive?: boolean) => Record<string, any>;
|
114
113
|
export type GenerateRulesName = (nextRules: RulesWithName[]) => {
|
@@ -176,13 +175,6 @@ export interface FlowUtilitiesFunctions {
|
|
176
175
|
* @returns
|
177
176
|
*/
|
178
177
|
makeRules: MakeRules;
|
179
|
-
/**
|
180
|
-
* Generates nodes for a flower JSON structure, extracting rules and other properties.
|
181
|
-
* @param nodes
|
182
|
-
*
|
183
|
-
* @returns
|
184
|
-
*/
|
185
|
-
generateNodesForFlowerJson: GenerateNodesForFlowerJson;
|
186
178
|
/**
|
187
179
|
* Checks if two arrays are equal in length and have the same elements.
|
188
180
|
* @param arr
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { NodeConfig } from './CoreInterface';
|
2
2
|
import { Flower } from './Store';
|
3
3
|
export type ActionWithPayload<T> = {
|
4
4
|
type: string;
|
@@ -126,7 +126,7 @@ export type CoreReducersFunctions<T extends Record<string, any> = Record<FlowCas
|
|
126
126
|
name: string;
|
127
127
|
startId: string;
|
128
128
|
persist: boolean;
|
129
|
-
nodes:
|
129
|
+
nodes: NodeConfig[];
|
130
130
|
initialState: {
|
131
131
|
startId?: string;
|
132
132
|
current?: string;
|