@flowerforce/flower-core 3.3.1-beta.2 → 4.0.1-beta.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/dist/index.cjs.js +238 -266
- package/dist/index.esm.js +228 -265
- package/dist/src/constants/index.d.ts +5 -0
- package/dist/src/event-emitter/index.d.ts +1 -0
- package/dist/src/index.d.ts +6 -8
- package/dist/src/interfaces/CoreInterface.d.ts +23 -17
- package/dist/src/interfaces/ReducerInterface.d.ts +109 -109
- package/dist/src/{rules-matcher/interface.d.ts → interfaces/RulesMatcherInterface.d.ts} +1 -1
- package/dist/src/interfaces/SelectorsInterface.d.ts +34 -25
- package/dist/src/interfaces/Store.d.ts +2 -10
- package/dist/src/interfaces/UtilsInterface.d.ts +1 -1
- package/dist/src/interfaces/index.d.ts +3 -0
- package/dist/src/rules-matcher/RulesMatcher.d.ts +2 -0
- package/dist/src/rules-matcher/index.d.ts +2 -0
- package/dist/src/rules-matcher/utils.d.ts +2 -3
- package/dist/src/state-manager/index.d.ts +2 -0
- package/dist/src/state-manager/state-functions/FlowerCoreMergedReducers.d.ts +2 -0
- package/dist/src/state-manager/state-functions/FlowerCoreStateFunctions.d.ts +5 -0
- package/dist/src/state-manager/state-functions/FlowerDataStateFunctions.d.ts +2 -0
- package/dist/src/state-manager/state-functions/index.d.ts +4 -0
- package/dist/src/state-manager/state-selectors/FlowerCoreStateSelectors.d.ts +2 -0
- package/dist/src/state-manager/state-selectors/FlowerDataStateSelectors.d.ts +2 -0
- package/dist/src/state-manager/state-selectors/FlowerSelectorsMerged.d.ts +2 -0
- package/dist/src/state-manager/state-selectors/index.d.ts +4 -0
- package/dist/src/{FlowerCoreStateUtils.d.ts → utils/FlowerCoreStateUtils.d.ts} +2 -2
- package/dist/src/{CoreUtils.d.ts → utils/FlowerCoreUtils.d.ts} +1 -2
- package/dist/src/utils/FlowerDataCoreUtils.d.ts +2 -0
- package/dist/src/utils/FlowerFlowUtils.d.ts +3 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/src/FlowerCoreStateFunctions.d.ts +0 -5
- package/dist/src/FlowerCoreStateSelectors.d.ts +0 -2
- package/dist/src/RulesMatcher.d.ts +0 -5
- package/dist/src/devtoolState.d.ts +0 -2
- /package/dist/src/{Emitter.d.ts → event-emitter/Emitter.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
export * from './Emitter';
|
package/dist/src/index.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
export
|
2
|
-
export
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export { devtoolState } from './devtoolState';
|
8
|
-
export * from './interfaces';
|
1
|
+
export * from './event-emitter';
|
2
|
+
export * from './constants';
|
3
|
+
export * from './utils';
|
4
|
+
export * from './rules-matcher';
|
5
|
+
export * from './state-manager';
|
6
|
+
export type * from './interfaces';
|
@@ -47,6 +47,8 @@ export declare enum RulesModes {
|
|
47
47
|
$or = "$or"
|
48
48
|
}
|
49
49
|
type RulesValuesType<T> = {
|
50
|
+
'$data.isValid'?: boolean;
|
51
|
+
/** @deprecated use $data.isValid instead */
|
50
52
|
'$form.isValid'?: boolean;
|
51
53
|
} & T;
|
52
54
|
type RulesOperatorsInArray<T> = Partial<{
|
@@ -74,7 +76,7 @@ export type RulesObject<T> = RulesValuesType<T> | {
|
|
74
76
|
export type CleanPath = (name: string, char?: string) => string;
|
75
77
|
export type GetPath = (idValue?: string) => {
|
76
78
|
path: string | string[];
|
77
|
-
|
79
|
+
rootName?: string;
|
78
80
|
};
|
79
81
|
export type AllEqual = (...args: Array<number | string | boolean>[]) => boolean;
|
80
82
|
export type FindValidRule<T = Rules<RulesObject<any>>> = (nextRules: {
|
@@ -112,7 +114,7 @@ export type MapKeysDeepLodash = (obj: Record<string, any>, cb: (...args: any) =>
|
|
112
114
|
export type GenerateRulesName = (nextRules: RulesWithName[]) => {
|
113
115
|
[X: string]: string;
|
114
116
|
};
|
115
|
-
export interface
|
117
|
+
export interface FlowUtilitiesFunctions {
|
116
118
|
/**
|
117
119
|
*
|
118
120
|
* Generates rule names from a set of rules.
|
@@ -181,21 +183,6 @@ export interface CoreUtilitiesFunctions {
|
|
181
183
|
* @returns
|
182
184
|
*/
|
183
185
|
generateNodesForFlowerJson: GenerateNodesForFlowerJson;
|
184
|
-
/**
|
185
|
-
* Removes specified characters from the beginning of a string (default char -> '^').
|
186
|
-
* @param name
|
187
|
-
* @param char
|
188
|
-
*
|
189
|
-
* @returns
|
190
|
-
*/
|
191
|
-
cleanPath: CleanPath;
|
192
|
-
/**
|
193
|
-
* Creates a valid path from idValue
|
194
|
-
* @param idValue
|
195
|
-
*
|
196
|
-
* @returns
|
197
|
-
*/
|
198
|
-
getPath: GetPath;
|
199
186
|
/**
|
200
187
|
* Checks if two arrays are equal in length and have the same elements.
|
201
188
|
* @param arr
|
@@ -214,4 +201,23 @@ export interface CoreUtilitiesFunctions {
|
|
214
201
|
*/
|
215
202
|
findValidRule: FindValidRule;
|
216
203
|
}
|
204
|
+
export interface DataUtilitiesFunctions {
|
205
|
+
/**
|
206
|
+
* Removes specified characters from the beginning of a string (default char -> '^').
|
207
|
+
* @param name
|
208
|
+
* @param char
|
209
|
+
*
|
210
|
+
* @returns
|
211
|
+
*/
|
212
|
+
cleanPath: CleanPath;
|
213
|
+
/**
|
214
|
+
* Creates a valid path from idValue
|
215
|
+
* @param idValue
|
216
|
+
*
|
217
|
+
* @returns
|
218
|
+
*/
|
219
|
+
getPath: GetPath;
|
220
|
+
}
|
221
|
+
export interface CoreUtilitiesFunctions extends DataUtilitiesFunctions, FlowUtilitiesFunctions {
|
222
|
+
}
|
217
223
|
export {};
|
@@ -5,11 +5,7 @@ export type ActionWithPayload<T> = {
|
|
5
5
|
payload: T;
|
6
6
|
};
|
7
7
|
type ReducerFunctionSign<T extends object, R> = (state: Record<string, Flower<T>>, action: ActionWithPayload<R>) => Record<string, Flower<T>> | void;
|
8
|
-
export type
|
9
|
-
/**
|
10
|
-
* These functions are Redux reducers used in a Flux architecture for managing state transitions and updates in a Flower application.
|
11
|
-
*/
|
12
|
-
export type ReducersFunctions<T extends Record<string, any> = Record<string, Flower<Record<string, any>>>> = {
|
8
|
+
export type CoreReducersFunctions<T extends Record<string, any> = Record<string, Flower<Record<string, any>>>> = {
|
13
9
|
/**
|
14
10
|
* @param state
|
15
11
|
* @param action
|
@@ -34,18 +30,6 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
34
30
|
name: string;
|
35
31
|
node: string;
|
36
32
|
} | string>;
|
37
|
-
/**
|
38
|
-
* @param state
|
39
|
-
* @param action
|
40
|
-
*
|
41
|
-
* Sets the "touched" state of a form node in a flow.
|
42
|
-
*
|
43
|
-
* @returns state
|
44
|
-
*/
|
45
|
-
setFormTouched: ReducerFunctionSign<T, {
|
46
|
-
flowName: string;
|
47
|
-
currentNode: string;
|
48
|
-
} | string>;
|
49
33
|
/**
|
50
34
|
* @param state
|
51
35
|
* @param action
|
@@ -143,7 +127,6 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
143
127
|
startId: string;
|
144
128
|
persist: boolean;
|
145
129
|
nodes: Node[];
|
146
|
-
initialData: any;
|
147
130
|
initialState: {
|
148
131
|
startId?: string;
|
149
132
|
current?: string;
|
@@ -166,229 +149,247 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
166
149
|
* @param state
|
167
150
|
* @param action
|
168
151
|
*
|
169
|
-
*
|
152
|
+
* Handles node transitions in a flow, updating history and form states accordingly.
|
170
153
|
*
|
171
154
|
* @returns state
|
172
155
|
*/
|
173
|
-
|
156
|
+
node: ReducerFunctionSign<T, {
|
174
157
|
name: string;
|
175
|
-
|
176
|
-
|
177
|
-
|
158
|
+
flowName?: string;
|
159
|
+
nodeId?: string;
|
160
|
+
node?: string;
|
161
|
+
history: string[];
|
178
162
|
}>;
|
179
163
|
/**
|
180
164
|
* @param state
|
181
165
|
* @param action
|
182
166
|
*
|
183
|
-
*
|
167
|
+
* Navigates to a specific node in the history of a flow.
|
184
168
|
*
|
185
169
|
* @returns state
|
186
170
|
*/
|
187
|
-
|
188
|
-
name
|
189
|
-
|
190
|
-
|
191
|
-
errors: {
|
192
|
-
[x: string]: string[];
|
193
|
-
} | string[];
|
171
|
+
prevToNode: ReducerFunctionSign<T, {
|
172
|
+
name?: string;
|
173
|
+
flowName?: string;
|
174
|
+
node: string;
|
194
175
|
}>;
|
195
176
|
/**
|
196
177
|
* @param state
|
197
178
|
* @param action
|
198
179
|
*
|
199
|
-
*
|
180
|
+
* Moves to the next node in a flow based on validation rules and current state.
|
200
181
|
*
|
201
182
|
* @returns state
|
202
183
|
*/
|
203
|
-
|
204
|
-
name
|
205
|
-
|
206
|
-
|
207
|
-
|
184
|
+
next: ReducerFunctionSign<T, {
|
185
|
+
name?: string;
|
186
|
+
flowName?: string;
|
187
|
+
route?: string;
|
188
|
+
data?: Record<string, any>;
|
189
|
+
dataIn?: Record<string, any>;
|
190
|
+
isStart?: boolean;
|
208
191
|
}>;
|
209
192
|
/**
|
210
193
|
* @param state
|
211
194
|
* @param action
|
212
195
|
*
|
213
|
-
*
|
196
|
+
* Moves to the previous node in a flow.
|
214
197
|
*
|
215
198
|
* @returns state
|
216
199
|
*/
|
217
|
-
|
218
|
-
name
|
219
|
-
|
220
|
-
id: string;
|
221
|
-
touched?: boolean;
|
200
|
+
prev: ReducerFunctionSign<T, {
|
201
|
+
name?: string;
|
202
|
+
flowName?: string;
|
222
203
|
}>;
|
223
204
|
/**
|
224
205
|
* @param state
|
225
206
|
* @param action
|
226
207
|
*
|
227
|
-
*
|
208
|
+
* Return back to the first node and resets history.
|
228
209
|
*
|
229
210
|
* @returns state
|
230
211
|
*/
|
231
|
-
|
232
|
-
name
|
233
|
-
|
234
|
-
id: string;
|
235
|
-
focused?: boolean;
|
212
|
+
restart: ReducerFunctionSign<T, {
|
213
|
+
name?: string;
|
214
|
+
flowName?: string;
|
236
215
|
}>;
|
237
216
|
/**
|
238
217
|
* @param state
|
239
218
|
* @param action
|
240
219
|
*
|
241
|
-
*
|
220
|
+
* Returns back to the first node, resets history and clean all previous data from flow.
|
242
221
|
*
|
243
222
|
* @returns state
|
244
223
|
*/
|
245
|
-
|
246
|
-
name
|
247
|
-
|
224
|
+
reset: ReducerFunctionSign<T, {
|
225
|
+
name?: string;
|
226
|
+
flowName?: string;
|
227
|
+
}
|
228
|
+
/**
|
229
|
+
* @param state
|
230
|
+
* @param action
|
231
|
+
*
|
232
|
+
* Reset form.
|
233
|
+
*
|
234
|
+
* @returns state
|
235
|
+
*/
|
236
|
+
>;
|
237
|
+
};
|
238
|
+
type DataReducerFunctionSign<T extends object, R = object> = (state: Record<string, T>, action: ActionWithPayload<{
|
239
|
+
rootName: string;
|
240
|
+
} & R>) => Record<string, T> | void;
|
241
|
+
export type DataReducersFunctions<T extends Record<string, any> = Record<string, Record<string, any>>> = {
|
242
|
+
/**
|
243
|
+
* @param state
|
244
|
+
* @param action
|
245
|
+
*
|
246
|
+
* Sets the "touched" state of a form node in a flow.
|
247
|
+
*
|
248
|
+
* @returns state
|
249
|
+
*/
|
250
|
+
setFormSubmitted: DataReducerFunctionSign<T>;
|
251
|
+
/**
|
252
|
+
* @param state
|
253
|
+
* @param action
|
254
|
+
*
|
255
|
+
* Adds errors to a form node in a flow.
|
256
|
+
*
|
257
|
+
* @returns state
|
258
|
+
*/
|
259
|
+
addCustomDataErrors: DataReducerFunctionSign<T, {
|
248
260
|
id: string;
|
261
|
+
errors: string[];
|
249
262
|
}>;
|
250
263
|
/**
|
251
264
|
* @param state
|
252
265
|
* @param action
|
253
266
|
*
|
254
|
-
* Adds
|
267
|
+
* Adds errors to a form node in a flow.
|
255
268
|
*
|
256
269
|
* @returns state
|
257
270
|
*/
|
258
|
-
|
259
|
-
|
260
|
-
|
271
|
+
addDataErrors: DataReducerFunctionSign<T, {
|
272
|
+
id: string;
|
273
|
+
errors: {
|
274
|
+
[x: string]: string[];
|
275
|
+
} | string[];
|
261
276
|
}>;
|
262
277
|
/**
|
263
278
|
* @param state
|
264
279
|
* @param action
|
265
280
|
*
|
266
|
-
*
|
281
|
+
* Set dirty form single field
|
267
282
|
*
|
268
283
|
* @returns state
|
269
284
|
*/
|
270
|
-
|
285
|
+
fieldDirty: DataReducerFunctionSign<T, {
|
271
286
|
id: string;
|
272
|
-
flowName: string;
|
273
|
-
value: T | string;
|
274
287
|
dirty?: boolean;
|
275
288
|
}>;
|
276
289
|
/**
|
277
290
|
* @param state
|
278
291
|
* @param action
|
279
292
|
*
|
280
|
-
*
|
293
|
+
* Set touch form single field
|
281
294
|
*
|
282
295
|
* @returns state
|
283
296
|
*/
|
284
|
-
|
285
|
-
|
286
|
-
|
297
|
+
fieldTouch: DataReducerFunctionSign<T, {
|
298
|
+
id: string;
|
299
|
+
touched?: boolean;
|
287
300
|
}>;
|
288
301
|
/**
|
289
302
|
* @param state
|
290
303
|
* @param action
|
291
304
|
*
|
292
|
-
*
|
305
|
+
* Set touch form single field
|
293
306
|
*
|
294
307
|
* @returns state
|
295
308
|
*/
|
296
|
-
|
297
|
-
id: string
|
298
|
-
|
309
|
+
fieldFocus: DataReducerFunctionSign<T, {
|
310
|
+
id: string;
|
311
|
+
focused?: boolean;
|
299
312
|
}>;
|
300
313
|
/**
|
301
314
|
* @param state
|
302
315
|
* @param action
|
303
316
|
*
|
304
|
-
*
|
317
|
+
* Removes errors from a form node in a flow.
|
305
318
|
*
|
306
319
|
* @returns state
|
307
320
|
*/
|
308
|
-
|
309
|
-
|
310
|
-
currentNode: string;
|
311
|
-
isValidating?: boolean;
|
321
|
+
removeDataErrors: DataReducerFunctionSign<T, {
|
322
|
+
id: string;
|
312
323
|
}>;
|
313
324
|
/**
|
314
325
|
* @param state
|
315
326
|
* @param action
|
316
327
|
*
|
317
|
-
*
|
328
|
+
* Adds data to a flow.
|
318
329
|
*
|
319
330
|
* @returns state
|
320
331
|
*/
|
321
|
-
|
322
|
-
|
323
|
-
flowName?: string;
|
324
|
-
nodeId?: string;
|
325
|
-
node?: string;
|
326
|
-
history: string[];
|
332
|
+
addData: DataReducerFunctionSign<T, {
|
333
|
+
value: T;
|
327
334
|
}>;
|
328
335
|
/**
|
329
336
|
* @param state
|
330
337
|
* @param action
|
331
338
|
*
|
332
|
-
*
|
339
|
+
* Adds data to a flow at a specific path.
|
333
340
|
*
|
334
341
|
* @returns state
|
335
342
|
*/
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
343
|
+
addDataByPath: DataReducerFunctionSign<T, {
|
344
|
+
id: string;
|
345
|
+
value: T | string;
|
346
|
+
dirty?: boolean;
|
340
347
|
}>;
|
341
348
|
/**
|
342
349
|
* @param state
|
343
350
|
* @param action
|
344
351
|
*
|
345
|
-
*
|
352
|
+
* Replaces the data of a flow with new data.
|
346
353
|
*
|
347
354
|
* @returns state
|
348
355
|
*/
|
349
|
-
|
350
|
-
|
351
|
-
flowName?: string;
|
352
|
-
data: T;
|
353
|
-
route?: string;
|
356
|
+
replaceData: DataReducerFunctionSign<T, {
|
357
|
+
value: T;
|
354
358
|
}>;
|
355
359
|
/**
|
356
360
|
* @param state
|
357
361
|
* @param action
|
358
362
|
*
|
359
|
-
*
|
363
|
+
* Unsets data from a flow at a specific path.
|
360
364
|
*
|
361
365
|
* @returns state
|
362
366
|
*/
|
363
|
-
|
364
|
-
|
365
|
-
flowName?: string;
|
367
|
+
unsetData: DataReducerFunctionSign<T, {
|
368
|
+
id: string[] | string;
|
366
369
|
}>;
|
367
370
|
/**
|
368
371
|
* @param state
|
369
372
|
* @param action
|
370
373
|
*
|
371
|
-
*
|
374
|
+
* Sets the "isValidating" state of a form node in a flow.
|
372
375
|
*
|
373
376
|
* @returns state
|
374
377
|
*/
|
375
|
-
|
376
|
-
|
377
|
-
flowName?: string;
|
378
|
+
setIsDataValidating: DataReducerFunctionSign<T, {
|
379
|
+
isValidating?: boolean;
|
378
380
|
}>;
|
379
381
|
/**
|
380
382
|
* @param state
|
381
383
|
* @param action
|
382
384
|
*
|
383
|
-
*
|
385
|
+
* Reset form.
|
384
386
|
*
|
385
387
|
* @returns state
|
386
388
|
*/
|
387
|
-
|
388
|
-
|
389
|
-
flowName?: string;
|
389
|
+
resetData: DataReducerFunctionSign<T, {
|
390
|
+
rootName: string;
|
390
391
|
initialData?: Record<string, any>;
|
391
|
-
}
|
392
|
+
}>;
|
392
393
|
/**
|
393
394
|
* @param state
|
394
395
|
* @param action
|
@@ -397,10 +398,9 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
397
398
|
*
|
398
399
|
* @returns state
|
399
400
|
*/
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
flowName: string;
|
401
|
+
initData: DataReducerFunctionSign<T, {
|
402
|
+
rootName: string;
|
403
|
+
initialData: Record<string, any>;
|
404
404
|
}>;
|
405
405
|
};
|
406
406
|
export {};
|
@@ -1,12 +1,13 @@
|
|
1
|
+
import { REDUCER_NAME } from '../constants';
|
1
2
|
import { RulesObject } from './CoreInterface';
|
2
|
-
import { Flower,
|
3
|
-
export interface
|
3
|
+
import { Flower, Data, INode } from './Store';
|
4
|
+
export interface IFlowerSelectors {
|
4
5
|
/**
|
5
6
|
* @param state
|
6
7
|
* @returns
|
7
8
|
*/
|
8
9
|
selectGlobal<T extends Record<string, any>>(state: {
|
9
|
-
|
10
|
+
[REDUCER_NAME.FLOWER_FLOW]: {
|
10
11
|
[x: string]: Flower<T>;
|
11
12
|
};
|
12
13
|
}): {
|
@@ -19,11 +20,6 @@ export interface ISelectors {
|
|
19
20
|
selectFlower<T extends Record<string, any>>(name: string): (state: {
|
20
21
|
[x: string]: Flower<T>;
|
21
22
|
}) => Flower<T>;
|
22
|
-
/**
|
23
|
-
* @param id
|
24
|
-
* @returns
|
25
|
-
*/
|
26
|
-
selectFlowerFormNode<T extends Record<string, any>>(id: string): (state: Flower<T>) => Form<T>;
|
27
23
|
/**
|
28
24
|
* @param flower
|
29
25
|
* @returns
|
@@ -60,11 +56,29 @@ export interface ISelectors {
|
|
60
56
|
makeSelectCurrentNodeDisabled<T extends Record<string, any>>(nodes: {
|
61
57
|
[x: string]: Partial<INode>;
|
62
58
|
}, current: Flower<T>['current']): boolean;
|
59
|
+
}
|
60
|
+
export interface IDataSelectors {
|
61
|
+
/**
|
62
|
+
* @param state
|
63
|
+
* @returns
|
64
|
+
*/
|
65
|
+
selectGlobalReducerByName(name: string): (state: Record<string, Record<string, unknown>>) => Record<string, unknown>;
|
66
|
+
/**
|
67
|
+
* @param state
|
68
|
+
* @returns
|
69
|
+
*/
|
70
|
+
selectGlobalData<T extends Record<string, any>>(state: {
|
71
|
+
[REDUCER_NAME.FLOWER_DATA]: {
|
72
|
+
[x: string]: Data<T>;
|
73
|
+
};
|
74
|
+
}): {
|
75
|
+
[x: string]: Data<T>;
|
76
|
+
};
|
63
77
|
/**
|
64
|
-
* @param
|
78
|
+
* @param data
|
65
79
|
* @returns
|
66
80
|
*/
|
67
|
-
makeSelectNodeErrors<T extends Record<string, any>>(
|
81
|
+
makeSelectNodeErrors<T extends Record<string, any>>(data: Data<T> | undefined): {
|
68
82
|
isSubmitted: boolean;
|
69
83
|
isDirty: boolean;
|
70
84
|
hasFocus: string | undefined;
|
@@ -74,35 +88,30 @@ export interface ISelectors {
|
|
74
88
|
isValidating?: boolean;
|
75
89
|
};
|
76
90
|
/**
|
77
|
-
* @param
|
91
|
+
* @param data
|
78
92
|
* @returns
|
79
93
|
*/
|
80
|
-
|
94
|
+
makeSelectNodeDataFieldTouched<T extends Record<string, any>>(id: string): (data: Data<T> | undefined) => boolean | undefined;
|
81
95
|
/**
|
82
|
-
* @param
|
96
|
+
* @param data
|
83
97
|
* @returns
|
84
98
|
*/
|
85
|
-
|
99
|
+
makeSelectNodeDataFieldFocused<T extends Record<string, any>>(id: string): (data: Data<T> | undefined) => string | undefined;
|
86
100
|
/**
|
87
|
-
* @param
|
88
|
-
* @returns
|
89
|
-
*/
|
90
|
-
makeSelectNodeFormFieldDirty<T extends Record<string, any>>(id: string): (form: Form<T> | undefined) => boolean | undefined;
|
91
|
-
/**
|
92
|
-
* @param flower
|
101
|
+
* @param data
|
93
102
|
* @returns
|
94
103
|
*/
|
95
|
-
|
104
|
+
makeSelectNodeDataFieldDirty<T extends Record<string, any>>(id: string): (data: Data<T> | undefined) => boolean | undefined;
|
96
105
|
/**
|
97
106
|
* @param id
|
98
107
|
* @returns
|
99
108
|
*/
|
100
109
|
getDataFromState<T extends Record<string, any>>(id: string | string[]): (data: T) => Partial<T>;
|
101
110
|
/**
|
102
|
-
* @param
|
111
|
+
* @param data
|
103
112
|
* @returns
|
104
113
|
*/
|
105
|
-
|
114
|
+
makeSelectNodeDataSubmitted<T extends Record<string, any>>(data: Data<T>): boolean | undefined;
|
106
115
|
/**
|
107
116
|
* @param name
|
108
117
|
* @param id
|
@@ -112,7 +121,7 @@ export interface ISelectors {
|
|
112
121
|
makeSelectFieldError<T extends Record<string, any>>(name: string, id: string, validate: {
|
113
122
|
rules?: RulesObject<any>;
|
114
123
|
message?: string;
|
115
|
-
}[] | null): (
|
124
|
+
}[] | null): (globalData: T | undefined, data: Data<T>) => Array<string>;
|
116
125
|
/**
|
117
126
|
* @param id
|
118
127
|
* @param rules
|
@@ -121,5 +130,5 @@ export interface ISelectors {
|
|
121
130
|
* @param value
|
122
131
|
* @returns
|
123
132
|
*/
|
124
|
-
selectorRulesDisabled<T extends Record<string, any>>(id: string, rules: any, keys: string[] | null, flowName: string, value: any): (
|
133
|
+
selectorRulesDisabled<T extends Record<string, any>>(id: string, rules: any, keys: string[] | null, flowName: string, value: any): (globalData: T | undefined, data: Data<T>) => boolean;
|
125
134
|
}
|
@@ -1,9 +1,4 @@
|
|
1
1
|
import { RulesByNodeId } from './CoreInterface';
|
2
|
-
export interface StoreRoot<T extends Record<string, any>> {
|
3
|
-
flower: {
|
4
|
-
[x: string]: Flower<T>;
|
5
|
-
};
|
6
|
-
}
|
7
2
|
export interface Flower<T extends Record<string, any>> {
|
8
3
|
persist: boolean;
|
9
4
|
startId: string;
|
@@ -15,10 +10,6 @@ export interface Flower<T extends Record<string, any>> {
|
|
15
10
|
nextRules: {
|
16
11
|
[x: string]: RulesByNodeId<T>[];
|
17
12
|
};
|
18
|
-
data: T;
|
19
|
-
form: {
|
20
|
-
[x: string]: Form<T>;
|
21
|
-
};
|
22
13
|
}
|
23
14
|
export interface INode {
|
24
15
|
nodeId: string;
|
@@ -26,7 +17,7 @@ export interface INode {
|
|
26
17
|
retain?: boolean;
|
27
18
|
disabled?: boolean;
|
28
19
|
}
|
29
|
-
export type
|
20
|
+
export type Data<T extends Record<string, unknown>> = {
|
30
21
|
isSubmitted?: boolean;
|
31
22
|
isDirty?: boolean;
|
32
23
|
hasFocus?: string;
|
@@ -43,4 +34,5 @@ export type Form<T> = {
|
|
43
34
|
touches?: {
|
44
35
|
[K in keyof T]: boolean;
|
45
36
|
};
|
37
|
+
data?: T;
|
46
38
|
};
|
@@ -14,7 +14,7 @@ export interface CoreStateUtils {
|
|
14
14
|
* Selects the form node with a specific ID from a given flow.
|
15
15
|
* It returns a selector function that accepts the state as an argument and retrieves the form node
|
16
16
|
*/
|
17
|
-
|
17
|
+
selectFlowerDataNode<T extends object>(name: string): (state: T) => Record<string, any>;
|
18
18
|
/**
|
19
19
|
*
|
20
20
|
* @param name
|
@@ -1,5 +1,8 @@
|
|
1
1
|
export * from './CoreInterface';
|
2
|
+
export * from './EmitterInterface';
|
3
|
+
export * from './FlatInterface';
|
2
4
|
export * from './ReducerInterface';
|
5
|
+
export * from './RulesMatcherInterface';
|
3
6
|
export * from './SelectorsInterface';
|
4
7
|
export * from './Store';
|
5
8
|
export * from './UtilsInterface';
|