@flowerforce/flower-core 3.3.1-beta.1 → 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 -271
- package/dist/index.esm.js +231 -270
- 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 +117 -99
- 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} +2 -2
- 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,215 +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
|
-
focused?: 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
|
-
|
219
|
+
restart: ReducerFunctionSign<T, {
|
220
|
+
name?: string;
|
221
|
+
flowName?: string;
|
222
|
+
}>;
|
223
|
+
/**
|
224
|
+
* @param state
|
225
|
+
* @param action
|
226
|
+
*
|
227
|
+
* Returns back to the first node, resets history and clean all previous data from flow.
|
228
|
+
*
|
229
|
+
* @returns state
|
230
|
+
*/
|
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, {
|
234
264
|
id: string;
|
265
|
+
errors: string[];
|
235
266
|
}>;
|
236
267
|
/**
|
237
268
|
* @param state
|
238
269
|
* @param action
|
239
270
|
*
|
240
|
-
* Adds
|
271
|
+
* Adds errors to a form node in a flow.
|
241
272
|
*
|
242
273
|
* @returns state
|
243
274
|
*/
|
244
|
-
|
245
|
-
|
246
|
-
|
275
|
+
formAddErrors: FormReducerFunctionSign<T, {
|
276
|
+
id: string;
|
277
|
+
errors: {
|
278
|
+
[x: string]: string[];
|
279
|
+
} | string[];
|
247
280
|
}>;
|
248
281
|
/**
|
249
282
|
* @param state
|
250
283
|
* @param action
|
251
284
|
*
|
252
|
-
*
|
285
|
+
* Set dirty form single field
|
253
286
|
*
|
254
287
|
* @returns state
|
255
288
|
*/
|
256
|
-
|
289
|
+
formFieldDirty: FormReducerFunctionSign<T, {
|
257
290
|
id: string;
|
258
|
-
flowName: string;
|
259
|
-
value: T | string;
|
260
291
|
dirty?: boolean;
|
261
292
|
}>;
|
262
293
|
/**
|
263
294
|
* @param state
|
264
295
|
* @param action
|
265
296
|
*
|
266
|
-
*
|
297
|
+
* Set touch form single field
|
267
298
|
*
|
268
299
|
* @returns state
|
269
300
|
*/
|
270
|
-
|
271
|
-
|
272
|
-
|
301
|
+
formFieldTouch: FormReducerFunctionSign<T, {
|
302
|
+
id: string;
|
303
|
+
touched?: boolean;
|
273
304
|
}>;
|
274
305
|
/**
|
275
306
|
* @param state
|
276
307
|
* @param action
|
277
308
|
*
|
278
|
-
*
|
309
|
+
* Set touch form single field
|
279
310
|
*
|
280
311
|
* @returns state
|
281
312
|
*/
|
282
|
-
|
283
|
-
id: string
|
284
|
-
|
313
|
+
formFieldFocus: FormReducerFunctionSign<T, {
|
314
|
+
id: string;
|
315
|
+
focused?: boolean;
|
285
316
|
}>;
|
286
317
|
/**
|
287
318
|
* @param state
|
288
319
|
* @param action
|
289
320
|
*
|
290
|
-
*
|
321
|
+
* Removes errors from a form node in a flow.
|
291
322
|
*
|
292
323
|
* @returns state
|
293
324
|
*/
|
294
|
-
|
295
|
-
|
296
|
-
currentNode: string;
|
297
|
-
isValidating?: boolean;
|
325
|
+
formRemoveErrors: FormReducerFunctionSign<T, {
|
326
|
+
id: string;
|
298
327
|
}>;
|
299
328
|
/**
|
300
329
|
* @param state
|
301
330
|
* @param action
|
302
331
|
*
|
303
|
-
*
|
332
|
+
* Adds data to a flow.
|
304
333
|
*
|
305
334
|
* @returns state
|
306
335
|
*/
|
307
|
-
|
308
|
-
|
309
|
-
flowName?: string;
|
310
|
-
nodeId?: string;
|
311
|
-
node?: string;
|
312
|
-
history: string[];
|
336
|
+
addData: FormReducerFunctionSign<T, {
|
337
|
+
value: T;
|
313
338
|
}>;
|
314
339
|
/**
|
315
340
|
* @param state
|
316
341
|
* @param action
|
317
342
|
*
|
318
|
-
*
|
343
|
+
* Adds data to a flow at a specific path.
|
319
344
|
*
|
320
345
|
* @returns state
|
321
346
|
*/
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
347
|
+
addDataByPath: FormReducerFunctionSign<T, {
|
348
|
+
id: string;
|
349
|
+
value: T | string;
|
350
|
+
dirty?: boolean;
|
326
351
|
}>;
|
327
352
|
/**
|
328
353
|
* @param state
|
329
354
|
* @param action
|
330
355
|
*
|
331
|
-
*
|
356
|
+
* Replaces the data of a flow with new data.
|
332
357
|
*
|
333
358
|
* @returns state
|
334
359
|
*/
|
335
|
-
|
336
|
-
|
337
|
-
flowName?: string;
|
338
|
-
data: T;
|
339
|
-
route?: string;
|
360
|
+
replaceData: FormReducerFunctionSign<T, {
|
361
|
+
value: T;
|
340
362
|
}>;
|
341
363
|
/**
|
342
364
|
* @param state
|
343
365
|
* @param action
|
344
366
|
*
|
345
|
-
*
|
367
|
+
* Unsets data from a flow at a specific path.
|
346
368
|
*
|
347
369
|
* @returns state
|
348
370
|
*/
|
349
|
-
|
350
|
-
|
351
|
-
flowName?: string;
|
371
|
+
unsetData: FormReducerFunctionSign<T, {
|
372
|
+
id: string[] | string;
|
352
373
|
}>;
|
353
374
|
/**
|
354
375
|
* @param state
|
355
376
|
* @param action
|
356
377
|
*
|
357
|
-
*
|
378
|
+
* Sets the "isValidating" state of a form node in a flow.
|
358
379
|
*
|
359
380
|
* @returns state
|
360
381
|
*/
|
361
|
-
|
362
|
-
|
363
|
-
flowName?: string;
|
382
|
+
setFormIsValidating: FormReducerFunctionSign<T, {
|
383
|
+
isValidating?: boolean;
|
364
384
|
}>;
|
365
385
|
/**
|
366
386
|
* @param state
|
367
387
|
* @param action
|
368
388
|
*
|
369
|
-
*
|
389
|
+
* Reset form.
|
370
390
|
*
|
371
391
|
* @returns state
|
372
392
|
*/
|
373
|
-
|
374
|
-
|
375
|
-
flowName?: string;
|
393
|
+
resetForm: FormReducerFunctionSign<T, {
|
394
|
+
formName: string;
|
376
395
|
initialData?: Record<string, any>;
|
377
|
-
}
|
396
|
+
}>;
|
378
397
|
/**
|
379
398
|
* @param state
|
380
399
|
* @param action
|
@@ -383,10 +402,9 @@ export type ReducersFunctions<T extends Record<string, any> = Record<string, Flo
|
|
383
402
|
*
|
384
403
|
* @returns state
|
385
404
|
*/
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
flowName: string;
|
405
|
+
initForm: FormReducerFunctionSign<T, {
|
406
|
+
formName: string;
|
407
|
+
initialData: Record<string, any>;
|
390
408
|
}>;
|
391
409
|
};
|
392
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';
|