@flowerforce/flower-core 3.3.1-beta.2 → 4.0.1-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/dist/index.cjs.js +241 -257
- package/dist/index.esm.js +231 -256
- 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 -105
- package/dist/src/{rules-matcher/interface.d.ts → interfaces/RulesMatcherInterface.d.ts} +1 -1
- package/dist/src/interfaces/SelectorsInterface.d.ts +21 -12
- 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 +13 -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/FlowerFormStateSelectors.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} +1 -1
- package/dist/src/{CoreUtils.d.ts → utils/FlowerCoreUtils.d.ts} +1 -2
- package/dist/src/utils/FlowerFlowUtils.d.ts +3 -0
- package/dist/src/utils/FlowerFormCoreUtils.d.ts +2 -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
|
+
formName?: 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 FormUtilitiesFunctions {
|
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 FormUtilitiesFunctions, FlowUtilitiesFunctions {
|
222
|
+
}
|
217
223
|
export {};
|
@@ -5,11 +5,14 @@ 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
|
+
type FormReducerFunctionSign<T extends object, R = object> = (state: Record<string, T>, action: ActionWithPayload<{
|
9
|
+
formName: string;
|
10
|
+
} & R>) => Record<string, T> | void;
|
8
11
|
export type ActionsTypes = 'historyAdd' | 'historyPrevToNode' | 'setFormTouched' | 'forceAddHistory' | 'historyPop' | 'restoreHistory' | 'replaceNode' | 'initializeFromNode' | 'forceResetHistory' | 'destroy' | 'initNodes' | 'setCurrentNode' | 'formAddErrors' | 'formRemoveErrors' | 'addData' | 'addDataByPath' | 'replaceData' | 'unsetData' | 'setFormIsValidating' | 'resetForm' | 'formFieldTouch' | 'formFieldFocus' | 'node' | 'prevToNode' | 'next' | 'prev' | 'reset';
|
9
12
|
/**
|
10
13
|
* These functions are Redux reducers used in a Flux architecture for managing state transitions and updates in a Flower application.
|
11
14
|
*/
|
12
|
-
export type
|
15
|
+
export type CoreReducersFunctions<T extends Record<string, any> = Record<string, Flower<Record<string, any>>>> = {
|
13
16
|
/**
|
14
17
|
* @param state
|
15
18
|
* @param action
|
@@ -34,18 +37,6 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
34
37
|
name: string;
|
35
38
|
node: string;
|
36
39
|
} | 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
40
|
/**
|
50
41
|
* @param state
|
51
42
|
* @param action
|
@@ -143,7 +134,6 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
143
134
|
startId: string;
|
144
135
|
persist: boolean;
|
145
136
|
nodes: Node[];
|
146
|
-
initialData: any;
|
147
137
|
initialState: {
|
148
138
|
startId?: string;
|
149
139
|
current?: string;
|
@@ -166,229 +156,244 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
166
156
|
* @param state
|
167
157
|
* @param action
|
168
158
|
*
|
169
|
-
*
|
159
|
+
* Handles node transitions in a flow, updating history and form states accordingly.
|
170
160
|
*
|
171
161
|
* @returns state
|
172
162
|
*/
|
173
|
-
|
163
|
+
node: ReducerFunctionSign<T, {
|
174
164
|
name: string;
|
175
|
-
|
176
|
-
|
177
|
-
|
165
|
+
flowName?: string;
|
166
|
+
nodeId?: string;
|
167
|
+
node?: string;
|
168
|
+
history: string[];
|
178
169
|
}>;
|
179
170
|
/**
|
180
171
|
* @param state
|
181
172
|
* @param action
|
182
173
|
*
|
183
|
-
*
|
174
|
+
* Navigates to a specific node in the history of a flow.
|
184
175
|
*
|
185
176
|
* @returns state
|
186
177
|
*/
|
187
|
-
|
188
|
-
name
|
189
|
-
|
190
|
-
|
191
|
-
errors: {
|
192
|
-
[x: string]: string[];
|
193
|
-
} | string[];
|
178
|
+
prevToNode: ReducerFunctionSign<T, {
|
179
|
+
name?: string;
|
180
|
+
flowName?: string;
|
181
|
+
node: string;
|
194
182
|
}>;
|
195
183
|
/**
|
196
184
|
* @param state
|
197
185
|
* @param action
|
198
186
|
*
|
199
|
-
*
|
187
|
+
* Moves to the next node in a flow based on validation rules and current state.
|
200
188
|
*
|
201
189
|
* @returns state
|
202
190
|
*/
|
203
|
-
|
204
|
-
name
|
205
|
-
|
206
|
-
|
207
|
-
|
191
|
+
next: ReducerFunctionSign<T, {
|
192
|
+
name?: string;
|
193
|
+
flowName?: string;
|
194
|
+
route?: string;
|
195
|
+
data?: Record<string, any>;
|
196
|
+
dataIn?: Record<string, any>;
|
197
|
+
isStart?: boolean;
|
208
198
|
}>;
|
209
199
|
/**
|
210
200
|
* @param state
|
211
201
|
* @param action
|
212
202
|
*
|
213
|
-
*
|
203
|
+
* Moves to the previous node in a flow.
|
214
204
|
*
|
215
205
|
* @returns state
|
216
206
|
*/
|
217
|
-
|
218
|
-
name
|
219
|
-
|
220
|
-
id: string;
|
221
|
-
touched?: boolean;
|
207
|
+
prev: ReducerFunctionSign<T, {
|
208
|
+
name?: string;
|
209
|
+
flowName?: string;
|
222
210
|
}>;
|
223
211
|
/**
|
224
212
|
* @param state
|
225
213
|
* @param action
|
226
214
|
*
|
227
|
-
*
|
215
|
+
* Return back to the first node and resets history.
|
228
216
|
*
|
229
217
|
* @returns state
|
230
218
|
*/
|
231
|
-
|
232
|
-
name
|
233
|
-
|
234
|
-
id: string;
|
235
|
-
focused?: boolean;
|
219
|
+
restart: ReducerFunctionSign<T, {
|
220
|
+
name?: string;
|
221
|
+
flowName?: string;
|
236
222
|
}>;
|
237
223
|
/**
|
238
224
|
* @param state
|
239
225
|
* @param action
|
240
226
|
*
|
241
|
-
*
|
227
|
+
* Returns back to the first node, resets history and clean all previous data from flow.
|
242
228
|
*
|
243
229
|
* @returns state
|
244
230
|
*/
|
245
|
-
|
246
|
-
name
|
247
|
-
|
231
|
+
reset: ReducerFunctionSign<T, {
|
232
|
+
name?: string;
|
233
|
+
flowName?: string;
|
234
|
+
}
|
235
|
+
/**
|
236
|
+
* @param state
|
237
|
+
* @param action
|
238
|
+
*
|
239
|
+
* Reset form.
|
240
|
+
*
|
241
|
+
* @returns state
|
242
|
+
*/
|
243
|
+
>;
|
244
|
+
};
|
245
|
+
export type FormReducersFunctions<T extends Record<string, any> = Record<string, Record<string, any>>> = {
|
246
|
+
/**
|
247
|
+
* @param state
|
248
|
+
* @param action
|
249
|
+
*
|
250
|
+
* Sets the "touched" state of a form node in a flow.
|
251
|
+
*
|
252
|
+
* @returns state
|
253
|
+
*/
|
254
|
+
setFormTouched: FormReducerFunctionSign<T>;
|
255
|
+
/**
|
256
|
+
* @param state
|
257
|
+
* @param action
|
258
|
+
*
|
259
|
+
* Adds errors to a form node in a flow.
|
260
|
+
*
|
261
|
+
* @returns state
|
262
|
+
*/
|
263
|
+
formAddCustomErrors: FormReducerFunctionSign<T, {
|
248
264
|
id: string;
|
265
|
+
errors: string[];
|
249
266
|
}>;
|
250
267
|
/**
|
251
268
|
* @param state
|
252
269
|
* @param action
|
253
270
|
*
|
254
|
-
* Adds
|
271
|
+
* Adds errors to a form node in a flow.
|
255
272
|
*
|
256
273
|
* @returns state
|
257
274
|
*/
|
258
|
-
|
259
|
-
|
260
|
-
|
275
|
+
formAddErrors: FormReducerFunctionSign<T, {
|
276
|
+
id: string;
|
277
|
+
errors: {
|
278
|
+
[x: string]: string[];
|
279
|
+
} | string[];
|
261
280
|
}>;
|
262
281
|
/**
|
263
282
|
* @param state
|
264
283
|
* @param action
|
265
284
|
*
|
266
|
-
*
|
285
|
+
* Set dirty form single field
|
267
286
|
*
|
268
287
|
* @returns state
|
269
288
|
*/
|
270
|
-
|
289
|
+
formFieldDirty: FormReducerFunctionSign<T, {
|
271
290
|
id: string;
|
272
|
-
flowName: string;
|
273
|
-
value: T | string;
|
274
291
|
dirty?: boolean;
|
275
292
|
}>;
|
276
293
|
/**
|
277
294
|
* @param state
|
278
295
|
* @param action
|
279
296
|
*
|
280
|
-
*
|
297
|
+
* Set touch form single field
|
281
298
|
*
|
282
299
|
* @returns state
|
283
300
|
*/
|
284
|
-
|
285
|
-
|
286
|
-
|
301
|
+
formFieldTouch: FormReducerFunctionSign<T, {
|
302
|
+
id: string;
|
303
|
+
touched?: boolean;
|
287
304
|
}>;
|
288
305
|
/**
|
289
306
|
* @param state
|
290
307
|
* @param action
|
291
308
|
*
|
292
|
-
*
|
309
|
+
* Set touch form single field
|
293
310
|
*
|
294
311
|
* @returns state
|
295
312
|
*/
|
296
|
-
|
297
|
-
id: string
|
298
|
-
|
313
|
+
formFieldFocus: FormReducerFunctionSign<T, {
|
314
|
+
id: string;
|
315
|
+
focused?: boolean;
|
299
316
|
}>;
|
300
317
|
/**
|
301
318
|
* @param state
|
302
319
|
* @param action
|
303
320
|
*
|
304
|
-
*
|
321
|
+
* Removes errors from a form node in a flow.
|
305
322
|
*
|
306
323
|
* @returns state
|
307
324
|
*/
|
308
|
-
|
309
|
-
|
310
|
-
currentNode: string;
|
311
|
-
isValidating?: boolean;
|
325
|
+
formRemoveErrors: FormReducerFunctionSign<T, {
|
326
|
+
id: string;
|
312
327
|
}>;
|
313
328
|
/**
|
314
329
|
* @param state
|
315
330
|
* @param action
|
316
331
|
*
|
317
|
-
*
|
332
|
+
* Adds data to a flow.
|
318
333
|
*
|
319
334
|
* @returns state
|
320
335
|
*/
|
321
|
-
|
322
|
-
|
323
|
-
flowName?: string;
|
324
|
-
nodeId?: string;
|
325
|
-
node?: string;
|
326
|
-
history: string[];
|
336
|
+
addData: FormReducerFunctionSign<T, {
|
337
|
+
value: T;
|
327
338
|
}>;
|
328
339
|
/**
|
329
340
|
* @param state
|
330
341
|
* @param action
|
331
342
|
*
|
332
|
-
*
|
343
|
+
* Adds data to a flow at a specific path.
|
333
344
|
*
|
334
345
|
* @returns state
|
335
346
|
*/
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
347
|
+
addDataByPath: FormReducerFunctionSign<T, {
|
348
|
+
id: string;
|
349
|
+
value: T | string;
|
350
|
+
dirty?: boolean;
|
340
351
|
}>;
|
341
352
|
/**
|
342
353
|
* @param state
|
343
354
|
* @param action
|
344
355
|
*
|
345
|
-
*
|
356
|
+
* Replaces the data of a flow with new data.
|
346
357
|
*
|
347
358
|
* @returns state
|
348
359
|
*/
|
349
|
-
|
350
|
-
|
351
|
-
flowName?: string;
|
352
|
-
data: T;
|
353
|
-
route?: string;
|
360
|
+
replaceData: FormReducerFunctionSign<T, {
|
361
|
+
value: T;
|
354
362
|
}>;
|
355
363
|
/**
|
356
364
|
* @param state
|
357
365
|
* @param action
|
358
366
|
*
|
359
|
-
*
|
367
|
+
* Unsets data from a flow at a specific path.
|
360
368
|
*
|
361
369
|
* @returns state
|
362
370
|
*/
|
363
|
-
|
364
|
-
|
365
|
-
flowName?: string;
|
371
|
+
unsetData: FormReducerFunctionSign<T, {
|
372
|
+
id: string[] | string;
|
366
373
|
}>;
|
367
374
|
/**
|
368
375
|
* @param state
|
369
376
|
* @param action
|
370
377
|
*
|
371
|
-
*
|
378
|
+
* Sets the "isValidating" state of a form node in a flow.
|
372
379
|
*
|
373
380
|
* @returns state
|
374
381
|
*/
|
375
|
-
|
376
|
-
|
377
|
-
flowName?: string;
|
382
|
+
setFormIsValidating: FormReducerFunctionSign<T, {
|
383
|
+
isValidating?: boolean;
|
378
384
|
}>;
|
379
385
|
/**
|
380
386
|
* @param state
|
381
387
|
* @param action
|
382
388
|
*
|
383
|
-
*
|
389
|
+
* Reset form.
|
384
390
|
*
|
385
391
|
* @returns state
|
386
392
|
*/
|
387
|
-
|
388
|
-
|
389
|
-
flowName?: string;
|
393
|
+
resetForm: FormReducerFunctionSign<T, {
|
394
|
+
formName: string;
|
390
395
|
initialData?: Record<string, any>;
|
391
|
-
}
|
396
|
+
}>;
|
392
397
|
/**
|
393
398
|
* @param state
|
394
399
|
* @param action
|
@@ -397,10 +402,9 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
397
402
|
*
|
398
403
|
* @returns state
|
399
404
|
*/
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
flowName: string;
|
405
|
+
initForm: FormReducerFunctionSign<T, {
|
406
|
+
formName: string;
|
407
|
+
initialData: Record<string, any>;
|
404
408
|
}>;
|
405
409
|
};
|
406
410
|
export {};
|
@@ -1,12 +1,13 @@
|
|
1
|
+
import { REDUCER_NAME } from '../constants';
|
1
2
|
import { RulesObject } from './CoreInterface';
|
2
3
|
import { Flower, Form, INode } from './Store';
|
3
|
-
export interface
|
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,6 +56,24 @@ 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 IFormSelectors {
|
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
|
+
selectGlobalForm<T extends Record<string, any>>(state: {
|
71
|
+
[REDUCER_NAME.FLOWER_DATA]: {
|
72
|
+
[x: string]: Form<T>;
|
73
|
+
};
|
74
|
+
}): {
|
75
|
+
[x: string]: Form<T>;
|
76
|
+
};
|
63
77
|
/**
|
64
78
|
* @param form
|
65
79
|
* @returns
|
@@ -88,11 +102,6 @@ export interface ISelectors {
|
|
88
102
|
* @returns
|
89
103
|
*/
|
90
104
|
makeSelectNodeFormFieldDirty<T extends Record<string, any>>(id: string): (form: Form<T> | undefined) => boolean | undefined;
|
91
|
-
/**
|
92
|
-
* @param flower
|
93
|
-
* @returns
|
94
|
-
*/
|
95
|
-
getDataByFlow<T extends Record<string, any>>(flower: Flower<T>): T;
|
96
105
|
/**
|
97
106
|
* @param id
|
98
107
|
* @returns
|
@@ -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 Form<T
|
20
|
+
export type Form<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
|
-
selectFlowerFormNode<T extends object>(name: string
|
17
|
+
selectFlowerFormNode<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';
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { RulesMatcherUtils } from '
|
1
|
+
import { RulesMatcherUtils } from '../interfaces';
|
2
2
|
/**
|
3
3
|
* Defines a utility object named rulesMatcherUtils, which contains various helper functions used for processing rules and data in a rule-matching context.
|
4
4
|
*/
|
5
|
-
declare const rulesMatcherUtils: RulesMatcherUtils;
|
6
|
-
export default rulesMatcherUtils;
|
5
|
+
export declare const rulesMatcherUtils: RulesMatcherUtils;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { CoreReducersFunctions } from '../../interfaces/ReducerInterface';
|
2
|
+
/**
|
3
|
+
* These functions are Redux reducers used in a Flux architecture for managing state transitions and updates in a Flower application.
|
4
|
+
*/
|
5
|
+
export declare const FlowerCoreBaseReducers: CoreReducersFunctions;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { FormReducersFunctions } from '../../interfaces/ReducerInterface';
|
2
|
+
/**
|
3
|
+
* formName => FlowerForm
|
4
|
+
* initialData => FlowerForm
|
5
|
+
* fieldName => FlowerField
|
6
|
+
* fieldValue => FlowerField
|
7
|
+
* errors => FlowerField
|
8
|
+
* customErrors => FlowerField
|
9
|
+
* fieldTouched => FlowerField
|
10
|
+
* fieldDirty => FlowerField
|
11
|
+
* fieldHasFocus => FlowerField
|
12
|
+
*/
|
13
|
+
export declare const FlowerCoreDataReducers: FormReducersFunctions;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export type { CoreReducersFunctions, FormReducersFunctions } from '../../interfaces';
|
2
|
+
export { FlowerCoreBaseReducers } from './FlowerCoreStateFunctions';
|
3
|
+
export { FlowerCoreDataReducers } from './FlowerDataStateFunctions';
|
4
|
+
export { FlowerCoreReducers } from './FlowerCoreMergedReducers';
|