@flowerforce/flower-react 3.1.2-beta.4 → 3.1.2-beta.5
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 +54 -45
- package/dist/index.esm.js +55 -46
- package/dist/src/components/types/FlowerField.d.ts +5 -1
- package/dist/src/selectors.d.ts +88 -5
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
@@ -8,6 +8,7 @@ var toolkit = require('@reduxjs/toolkit');
|
|
8
8
|
var reselect = require('reselect');
|
9
9
|
var reactRedux = require('react-redux');
|
10
10
|
var debounce = require('lodash/debounce');
|
11
|
+
var isEqual = require('lodash/isEqual');
|
11
12
|
|
12
13
|
const _context = React.createContext({});
|
13
14
|
const context = _context;
|
@@ -46,6 +47,7 @@ const getDataByFlow = (name) => reselect.createSelector(selectFlower(name), flow
|
|
46
47
|
const getDataFromState = (name, id) => reselect.createSelector(getDataByFlow(name), flowerCore.Selectors.getDataFromState(id));
|
47
48
|
const makeSelectNodeErrors = (name, currentNodeId) => reselect.createSelector(selectFlowerFormNode(name, currentNodeId), flowerCore.Selectors.makeSelectNodeErrors);
|
48
49
|
const makeSelectNodeFieldTouched = (name, currentNodeId, fieldId) => reselect.createSelector(selectFlowerFormNode(name, currentNodeId), flowerCore.Selectors.makeSelectNodeFormFieldTouched(fieldId));
|
50
|
+
const makeSelectNodeFieldDirty = (name, currentNodeId, fieldId) => reselect.createSelector(selectFlowerFormNode(name, currentNodeId), flowerCore.Selectors.makeSelectNodeFormFieldDirty(fieldId));
|
49
51
|
const makeSelectNodeFormTouched = (name, currentNodeId) => reselect.createSelector(selectFlowerFormNode(name, currentNodeId), flowerCore.Selectors.makeSelectNodeFormTouched);
|
50
52
|
const getAllData = reselect.createSelector(selectGlobal, mapData);
|
51
53
|
const selectFlowerFormCurrentNode = (name) => reselect.createSelector(selectFlower(name), makeSelectCurrentNodeId(name), (data, current) => {
|
@@ -255,11 +257,14 @@ const FlowerClient = ({ children, name, destroyOnUnmount = true, startId = null,
|
|
255
257
|
initialData,
|
256
258
|
currentNode: current
|
257
259
|
}), [flowName, initialData, current]);
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
260
|
+
const prevContextValues = React.useMemo(() => ({
|
261
|
+
flowName,
|
262
|
+
initialData,
|
263
|
+
currentNode: prevFlowerNodeId
|
264
|
+
}), [flowName, initialData, prevFlowerNodeId]);
|
265
|
+
return isInitialized ? (React.createElement(React.Fragment, null,
|
266
|
+
prevFlowerNodeId !== current && typeof prevFlowerNodeId === 'string' && (React.createElement(Provider, { value: prevContextValues }, nodeById[prevFlowerNodeId])),
|
267
|
+
React.createElement(Provider, { value: contextValues }, !isDisabled && nodeById[current]))) : null;
|
263
268
|
};
|
264
269
|
const component$c = React.memo(FlowerClient);
|
265
270
|
|
@@ -403,14 +408,16 @@ function isIntrinsicElement$1(x) {
|
|
403
408
|
//TODO make types for wrapper function props
|
404
409
|
function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDebounce = 0, asyncValidate, asyncInitialError, asyncWaitingError, destroyValue, onBlur = (val) => null, hidden, onUpdate, defaultValue, ...props }) {
|
405
410
|
const dispatch = useDispatch();
|
406
|
-
const [
|
411
|
+
const [customAsyncErrors, setCustomAsyncErrors] = React.useState(asyncValidate && [asyncInitialError]);
|
407
412
|
const [isValidating, setIsValidating] = React.useState(undefined);
|
408
413
|
const { flowNameFromPath = flowName, path } = React.useMemo(() => flowerCore.CoreUtils.getPath(id), [id]);
|
409
414
|
const value = useSelector(getDataFromState(flowNameFromPath, path));
|
410
415
|
const errors = useSelector(makeSelectFieldError(flowName, id, validate), flowerCore.CoreUtils.allEqual);
|
416
|
+
const dirty = useSelector(makeSelectNodeFieldDirty(flowName, currentNode, id));
|
411
417
|
const touched = useSelector(makeSelectNodeFieldTouched(flowName, currentNode, id));
|
412
418
|
const refValue = React.useRef();
|
413
|
-
const
|
419
|
+
const touchedForm = useSelector(makeSelectNodeFormTouched(flowName, currentNode));
|
420
|
+
const allErrors = React.useMemo(() => [...errors, ...(customAsyncErrors || []).filter(Boolean)], [errors, customAsyncErrors]);
|
414
421
|
const setTouched = React.useCallback((touched) => {
|
415
422
|
dispatch({
|
416
423
|
type: 'flower/formFieldTouch',
|
@@ -424,17 +431,32 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
424
431
|
}, [dispatch, flowName, currentNode, id]);
|
425
432
|
const validateFn = React.useCallback(async (value) => {
|
426
433
|
if (asyncWaitingError) {
|
427
|
-
|
434
|
+
setCustomAsyncErrors([asyncWaitingError]);
|
428
435
|
}
|
429
436
|
setIsValidating(true);
|
430
437
|
const state = flowerCore.FlowerStateUtils.getAllData(store);
|
431
438
|
const res = await asyncValidate(value, state, errors);
|
432
439
|
setIsValidating(false);
|
433
|
-
|
440
|
+
setCustomAsyncErrors(res);
|
434
441
|
}, [asyncWaitingError, errors]);
|
435
442
|
const debouncedValidation = React.useCallback(debounce(validateFn, asyncDebounce), [
|
436
443
|
validateFn
|
437
444
|
]);
|
445
|
+
const onChange = React.useCallback((val) => {
|
446
|
+
dispatch({
|
447
|
+
type: `flower/addDataByPath`,
|
448
|
+
payload: {
|
449
|
+
flowName: flowNameFromPath,
|
450
|
+
id,
|
451
|
+
value: val,
|
452
|
+
dirty: defaultValue ? !isEqual(val, defaultValue) : true
|
453
|
+
}
|
454
|
+
});
|
455
|
+
}, [flowNameFromPath, id, onBlur, dispatch]);
|
456
|
+
const onBlurInternal = React.useCallback((e) => {
|
457
|
+
setTouched(true);
|
458
|
+
onBlur && onBlur(e);
|
459
|
+
}, [onBlur, setTouched]);
|
438
460
|
React.useEffect(() => {
|
439
461
|
if (asyncValidate) {
|
440
462
|
if (refValue.current === value)
|
@@ -442,36 +464,20 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
442
464
|
refValue.current = value;
|
443
465
|
const hasValue = !flowerCore.MatchRules.utils.isEmpty(value);
|
444
466
|
if (!hasValue) {
|
445
|
-
|
467
|
+
setCustomAsyncErrors([asyncInitialError]);
|
446
468
|
setIsValidating(false);
|
447
469
|
return;
|
448
470
|
}
|
449
471
|
setTouched(true);
|
450
472
|
debouncedValidation(value);
|
451
473
|
}
|
452
|
-
}, [asyncValidate, asyncInitialError, value, debouncedValidation]);
|
453
|
-
const touchedForm = useSelector(makeSelectNodeFormTouched(flowName, currentNode));
|
454
|
-
const allErrors = React.useMemo(() => [...errors, ...(customErrors || []).filter(Boolean)], [errors, customErrors]);
|
474
|
+
}, [asyncValidate, asyncInitialError, value, debouncedValidation, setTouched]);
|
455
475
|
React.useEffect(() => {
|
456
476
|
if (onUpdate) {
|
457
477
|
onUpdate(value);
|
458
478
|
}
|
459
479
|
}, [value, onUpdate]);
|
460
|
-
|
461
|
-
dispatch({
|
462
|
-
type: `flower/addDataByPath`,
|
463
|
-
payload: {
|
464
|
-
flowName: flowNameFromPath,
|
465
|
-
id: path,
|
466
|
-
value: val
|
467
|
-
}
|
468
|
-
});
|
469
|
-
}, [flowNameFromPath, path, onBlur, dispatch]);
|
470
|
-
const onBlurInternal = React.useCallback((e) => {
|
471
|
-
setTouched(true);
|
472
|
-
onBlur && onBlur(e);
|
473
|
-
}, [onBlur]);
|
474
|
-
React.useLayoutEffect(() => {
|
480
|
+
React.useEffect(() => {
|
475
481
|
dispatch({
|
476
482
|
type: 'flower/formAddErrors',
|
477
483
|
payload: {
|
@@ -492,7 +498,7 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
492
498
|
}
|
493
499
|
});
|
494
500
|
}, [flowName, currentNode, isValidating]);
|
495
|
-
React.
|
501
|
+
React.useEffect(() => {
|
496
502
|
// destroy
|
497
503
|
return () => {
|
498
504
|
if (destroyValue) {
|
@@ -510,35 +516,37 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
510
516
|
}
|
511
517
|
});
|
512
518
|
};
|
513
|
-
}, [destroyValue]);
|
519
|
+
}, [destroyValue, id, flowNameFromPath, path, currentNode]);
|
514
520
|
React.useEffect(() => {
|
515
|
-
if (defaultValue && !
|
516
|
-
one.current = true;
|
521
|
+
if (defaultValue && !dirty && !isEqual(value, defaultValue)) {
|
517
522
|
onChange(defaultValue);
|
518
523
|
}
|
519
|
-
}, [defaultValue, onChange]);
|
520
|
-
const isTouched = touched || touchedForm;
|
524
|
+
}, [defaultValue, value, dirty, onChange]);
|
521
525
|
const newProps = React.useMemo(() => ({
|
522
526
|
...props,
|
523
527
|
id,
|
524
528
|
value,
|
525
|
-
errors:
|
526
|
-
hasError:
|
529
|
+
errors: allErrors,
|
530
|
+
hasError: !!allErrors.length,
|
527
531
|
onChange,
|
528
532
|
onBlur: onBlurInternal,
|
529
|
-
|
533
|
+
touched,
|
534
|
+
dirty,
|
530
535
|
hidden,
|
531
|
-
isValidating
|
536
|
+
isValidating,
|
537
|
+
touchedForm
|
532
538
|
}), [
|
533
539
|
props,
|
534
540
|
id,
|
535
541
|
value,
|
536
542
|
allErrors,
|
537
|
-
|
543
|
+
touched,
|
544
|
+
dirty,
|
538
545
|
onChange,
|
539
546
|
onBlurInternal,
|
540
547
|
hidden,
|
541
|
-
isValidating
|
548
|
+
isValidating,
|
549
|
+
touchedForm
|
542
550
|
]);
|
543
551
|
if (typeof Component === 'function') {
|
544
552
|
return Component(newProps);
|
@@ -861,13 +869,14 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
861
869
|
...newpath
|
862
870
|
]);
|
863
871
|
}, [store, flowName]);
|
864
|
-
const setData = React.useCallback((val,
|
865
|
-
if (
|
866
|
-
const { flowNameFromPath = flowName
|
872
|
+
const setData = React.useCallback((val, id) => {
|
873
|
+
if (id) {
|
874
|
+
const { flowNameFromPath = flowName } = flowerCore.CoreUtils.getPath(id);
|
867
875
|
dispatch(actions.addDataByPath({
|
868
876
|
flowName: flowNameFromPath,
|
869
|
-
id
|
870
|
-
value: val
|
877
|
+
id,
|
878
|
+
value: val,
|
879
|
+
dirty: true
|
871
880
|
}));
|
872
881
|
return;
|
873
882
|
}
|
package/dist/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { createContext, PureComponent, memo, useRef, useState, useMemo, Children, useEffect, useContext, useCallback
|
1
|
+
import React, { createContext, PureComponent, memo, useRef, useState, useMemo, Children, useEffect, useContext, useCallback } from 'react';
|
2
2
|
import _keyBy from 'lodash/keyBy';
|
3
3
|
import { CoreUtils, FlowerCoreReducers, FlowerStateUtils, Selectors, devtoolState, Emitter, MatchRules } from '@flowerforce/flower-core';
|
4
4
|
import _get from 'lodash/get';
|
@@ -6,6 +6,7 @@ import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
6
6
|
import { createSelector } from 'reselect';
|
7
7
|
import { createDispatchHook, createSelectorHook, createStoreHook, Provider as Provider$1 } from 'react-redux';
|
8
8
|
import debounce from 'lodash/debounce';
|
9
|
+
import isEqual from 'lodash/isEqual';
|
9
10
|
|
10
11
|
const _context = createContext({});
|
11
12
|
const context = _context;
|
@@ -44,6 +45,7 @@ const getDataByFlow = (name) => createSelector(selectFlower(name), Selectors.get
|
|
44
45
|
const getDataFromState = (name, id) => createSelector(getDataByFlow(name), Selectors.getDataFromState(id));
|
45
46
|
const makeSelectNodeErrors = (name, currentNodeId) => createSelector(selectFlowerFormNode(name, currentNodeId), Selectors.makeSelectNodeErrors);
|
46
47
|
const makeSelectNodeFieldTouched = (name, currentNodeId, fieldId) => createSelector(selectFlowerFormNode(name, currentNodeId), Selectors.makeSelectNodeFormFieldTouched(fieldId));
|
48
|
+
const makeSelectNodeFieldDirty = (name, currentNodeId, fieldId) => createSelector(selectFlowerFormNode(name, currentNodeId), Selectors.makeSelectNodeFormFieldDirty(fieldId));
|
47
49
|
const makeSelectNodeFormTouched = (name, currentNodeId) => createSelector(selectFlowerFormNode(name, currentNodeId), Selectors.makeSelectNodeFormTouched);
|
48
50
|
const getAllData = createSelector(selectGlobal, mapData);
|
49
51
|
const selectFlowerFormCurrentNode = (name) => createSelector(selectFlower(name), makeSelectCurrentNodeId(name), (data, current) => {
|
@@ -253,11 +255,14 @@ const FlowerClient = ({ children, name, destroyOnUnmount = true, startId = null,
|
|
253
255
|
initialData,
|
254
256
|
currentNode: current
|
255
257
|
}), [flowName, initialData, current]);
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
258
|
+
const prevContextValues = useMemo(() => ({
|
259
|
+
flowName,
|
260
|
+
initialData,
|
261
|
+
currentNode: prevFlowerNodeId
|
262
|
+
}), [flowName, initialData, prevFlowerNodeId]);
|
263
|
+
return isInitialized ? (React.createElement(React.Fragment, null,
|
264
|
+
prevFlowerNodeId !== current && typeof prevFlowerNodeId === 'string' && (React.createElement(Provider, { value: prevContextValues }, nodeById[prevFlowerNodeId])),
|
265
|
+
React.createElement(Provider, { value: contextValues }, !isDisabled && nodeById[current]))) : null;
|
261
266
|
};
|
262
267
|
const component$c = memo(FlowerClient);
|
263
268
|
|
@@ -401,14 +406,16 @@ function isIntrinsicElement$1(x) {
|
|
401
406
|
//TODO make types for wrapper function props
|
402
407
|
function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDebounce = 0, asyncValidate, asyncInitialError, asyncWaitingError, destroyValue, onBlur = (val) => null, hidden, onUpdate, defaultValue, ...props }) {
|
403
408
|
const dispatch = useDispatch();
|
404
|
-
const [
|
409
|
+
const [customAsyncErrors, setCustomAsyncErrors] = useState(asyncValidate && [asyncInitialError]);
|
405
410
|
const [isValidating, setIsValidating] = useState(undefined);
|
406
411
|
const { flowNameFromPath = flowName, path } = useMemo(() => CoreUtils.getPath(id), [id]);
|
407
412
|
const value = useSelector(getDataFromState(flowNameFromPath, path));
|
408
413
|
const errors = useSelector(makeSelectFieldError(flowName, id, validate), CoreUtils.allEqual);
|
414
|
+
const dirty = useSelector(makeSelectNodeFieldDirty(flowName, currentNode, id));
|
409
415
|
const touched = useSelector(makeSelectNodeFieldTouched(flowName, currentNode, id));
|
410
416
|
const refValue = useRef();
|
411
|
-
const
|
417
|
+
const touchedForm = useSelector(makeSelectNodeFormTouched(flowName, currentNode));
|
418
|
+
const allErrors = useMemo(() => [...errors, ...(customAsyncErrors || []).filter(Boolean)], [errors, customAsyncErrors]);
|
412
419
|
const setTouched = useCallback((touched) => {
|
413
420
|
dispatch({
|
414
421
|
type: 'flower/formFieldTouch',
|
@@ -422,17 +429,32 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
422
429
|
}, [dispatch, flowName, currentNode, id]);
|
423
430
|
const validateFn = useCallback(async (value) => {
|
424
431
|
if (asyncWaitingError) {
|
425
|
-
|
432
|
+
setCustomAsyncErrors([asyncWaitingError]);
|
426
433
|
}
|
427
434
|
setIsValidating(true);
|
428
435
|
const state = FlowerStateUtils.getAllData(store);
|
429
436
|
const res = await asyncValidate(value, state, errors);
|
430
437
|
setIsValidating(false);
|
431
|
-
|
438
|
+
setCustomAsyncErrors(res);
|
432
439
|
}, [asyncWaitingError, errors]);
|
433
440
|
const debouncedValidation = useCallback(debounce(validateFn, asyncDebounce), [
|
434
441
|
validateFn
|
435
442
|
]);
|
443
|
+
const onChange = useCallback((val) => {
|
444
|
+
dispatch({
|
445
|
+
type: `flower/addDataByPath`,
|
446
|
+
payload: {
|
447
|
+
flowName: flowNameFromPath,
|
448
|
+
id,
|
449
|
+
value: val,
|
450
|
+
dirty: defaultValue ? !isEqual(val, defaultValue) : true
|
451
|
+
}
|
452
|
+
});
|
453
|
+
}, [flowNameFromPath, id, onBlur, dispatch]);
|
454
|
+
const onBlurInternal = useCallback((e) => {
|
455
|
+
setTouched(true);
|
456
|
+
onBlur && onBlur(e);
|
457
|
+
}, [onBlur, setTouched]);
|
436
458
|
useEffect(() => {
|
437
459
|
if (asyncValidate) {
|
438
460
|
if (refValue.current === value)
|
@@ -440,36 +462,20 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
440
462
|
refValue.current = value;
|
441
463
|
const hasValue = !MatchRules.utils.isEmpty(value);
|
442
464
|
if (!hasValue) {
|
443
|
-
|
465
|
+
setCustomAsyncErrors([asyncInitialError]);
|
444
466
|
setIsValidating(false);
|
445
467
|
return;
|
446
468
|
}
|
447
469
|
setTouched(true);
|
448
470
|
debouncedValidation(value);
|
449
471
|
}
|
450
|
-
}, [asyncValidate, asyncInitialError, value, debouncedValidation]);
|
451
|
-
const touchedForm = useSelector(makeSelectNodeFormTouched(flowName, currentNode));
|
452
|
-
const allErrors = useMemo(() => [...errors, ...(customErrors || []).filter(Boolean)], [errors, customErrors]);
|
472
|
+
}, [asyncValidate, asyncInitialError, value, debouncedValidation, setTouched]);
|
453
473
|
useEffect(() => {
|
454
474
|
if (onUpdate) {
|
455
475
|
onUpdate(value);
|
456
476
|
}
|
457
477
|
}, [value, onUpdate]);
|
458
|
-
|
459
|
-
dispatch({
|
460
|
-
type: `flower/addDataByPath`,
|
461
|
-
payload: {
|
462
|
-
flowName: flowNameFromPath,
|
463
|
-
id: path,
|
464
|
-
value: val
|
465
|
-
}
|
466
|
-
});
|
467
|
-
}, [flowNameFromPath, path, onBlur, dispatch]);
|
468
|
-
const onBlurInternal = useCallback((e) => {
|
469
|
-
setTouched(true);
|
470
|
-
onBlur && onBlur(e);
|
471
|
-
}, [onBlur]);
|
472
|
-
useLayoutEffect(() => {
|
478
|
+
useEffect(() => {
|
473
479
|
dispatch({
|
474
480
|
type: 'flower/formAddErrors',
|
475
481
|
payload: {
|
@@ -490,7 +496,7 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
490
496
|
}
|
491
497
|
});
|
492
498
|
}, [flowName, currentNode, isValidating]);
|
493
|
-
|
499
|
+
useEffect(() => {
|
494
500
|
// destroy
|
495
501
|
return () => {
|
496
502
|
if (destroyValue) {
|
@@ -508,35 +514,37 @@ function Wrapper$1({ Component, id, flowName, currentNode, validate, asyncDeboun
|
|
508
514
|
}
|
509
515
|
});
|
510
516
|
};
|
511
|
-
}, [destroyValue]);
|
517
|
+
}, [destroyValue, id, flowNameFromPath, path, currentNode]);
|
512
518
|
useEffect(() => {
|
513
|
-
if (defaultValue && !
|
514
|
-
one.current = true;
|
519
|
+
if (defaultValue && !dirty && !isEqual(value, defaultValue)) {
|
515
520
|
onChange(defaultValue);
|
516
521
|
}
|
517
|
-
}, [defaultValue, onChange]);
|
518
|
-
const isTouched = touched || touchedForm;
|
522
|
+
}, [defaultValue, value, dirty, onChange]);
|
519
523
|
const newProps = useMemo(() => ({
|
520
524
|
...props,
|
521
525
|
id,
|
522
526
|
value,
|
523
|
-
errors:
|
524
|
-
hasError:
|
527
|
+
errors: allErrors,
|
528
|
+
hasError: !!allErrors.length,
|
525
529
|
onChange,
|
526
530
|
onBlur: onBlurInternal,
|
527
|
-
|
531
|
+
touched,
|
532
|
+
dirty,
|
528
533
|
hidden,
|
529
|
-
isValidating
|
534
|
+
isValidating,
|
535
|
+
touchedForm
|
530
536
|
}), [
|
531
537
|
props,
|
532
538
|
id,
|
533
539
|
value,
|
534
540
|
allErrors,
|
535
|
-
|
541
|
+
touched,
|
542
|
+
dirty,
|
536
543
|
onChange,
|
537
544
|
onBlurInternal,
|
538
545
|
hidden,
|
539
|
-
isValidating
|
546
|
+
isValidating,
|
547
|
+
touchedForm
|
540
548
|
]);
|
541
549
|
if (typeof Component === 'function') {
|
542
550
|
return Component(newProps);
|
@@ -859,13 +867,14 @@ const useFlowerForm = ({ flowName: customFlowName, name } = {}) => {
|
|
859
867
|
...newpath
|
860
868
|
]);
|
861
869
|
}, [store, flowName]);
|
862
|
-
const setData = useCallback((val,
|
863
|
-
if (
|
864
|
-
const { flowNameFromPath = flowName
|
870
|
+
const setData = useCallback((val, id) => {
|
871
|
+
if (id) {
|
872
|
+
const { flowNameFromPath = flowName } = CoreUtils.getPath(id);
|
865
873
|
dispatch(actions.addDataByPath({
|
866
874
|
flowName: flowNameFromPath,
|
867
|
-
id
|
868
|
-
value: val
|
875
|
+
id,
|
876
|
+
value: val,
|
877
|
+
dirty: true
|
869
878
|
}));
|
870
879
|
return;
|
871
880
|
}
|
@@ -32,7 +32,11 @@ export type FlowerFieldProps<T extends Record<string, any> = Record<string, any>
|
|
32
32
|
/** The function executed to test all the validation rules*/
|
33
33
|
onBlur: () => void;
|
34
34
|
/** This parameter will notify you whether the form field has been touched */
|
35
|
-
|
35
|
+
touchedForm: boolean;
|
36
|
+
/** This parameter will notify you whether the form field has been touched */
|
37
|
+
touched: boolean;
|
38
|
+
/** This parameter will notify you whether the form field has been touched */
|
39
|
+
dirty: boolean;
|
36
40
|
/** true when some of the display rules are not satisfied, and you have passed true to the "alwaysDisplay" FlowerField's prop*/
|
37
41
|
hidden: boolean;
|
38
42
|
/** true when you have an async validation in progress */
|
package/dist/src/selectors.d.ts
CHANGED
@@ -305,22 +305,22 @@ declare const makeSelectPrevNodeRetain: (name: string) => ((state: {
|
|
305
305
|
flower: {
|
306
306
|
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
307
307
|
};
|
308
|
-
}) => string |
|
308
|
+
}) => string | undefined) & {
|
309
309
|
clearCache: () => void;
|
310
310
|
resultsCount: () => number;
|
311
311
|
resetResultsCount: () => void;
|
312
312
|
} & {
|
313
313
|
resultFunc: (resultFuncArgs_0: {
|
314
314
|
[x: string]: import("@flowerforce/flower-core").INode;
|
315
|
-
}, resultFuncArgs_1: string[], resultFuncArgs_2: string) => string |
|
315
|
+
}, resultFuncArgs_1: string[], resultFuncArgs_2: string) => string | undefined;
|
316
316
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
317
317
|
[x: string]: import("@flowerforce/flower-core").INode;
|
318
|
-
}, resultFuncArgs_1: string[], resultFuncArgs_2: string) => string |
|
318
|
+
}, resultFuncArgs_1: string[], resultFuncArgs_2: string) => string | undefined) & {
|
319
319
|
clearCache: () => void;
|
320
320
|
resultsCount: () => number;
|
321
321
|
resetResultsCount: () => void;
|
322
322
|
};
|
323
|
-
lastResult: () => string |
|
323
|
+
lastResult: () => string | undefined;
|
324
324
|
dependencies: [((state: {
|
325
325
|
flower: {
|
326
326
|
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
@@ -1113,6 +1113,89 @@ declare const makeSelectNodeFieldTouched: (name: string, currentNodeId: string,
|
|
1113
1113
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
1114
1114
|
memoize: typeof import("reselect").weakMapMemoize;
|
1115
1115
|
};
|
1116
|
+
declare const makeSelectNodeFieldDirty: (name: string, currentNodeId: string, fieldId: string) => ((state: {
|
1117
|
+
flower: {
|
1118
|
+
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1119
|
+
};
|
1120
|
+
}) => boolean | undefined) & {
|
1121
|
+
clearCache: () => void;
|
1122
|
+
resultsCount: () => number;
|
1123
|
+
resetResultsCount: () => void;
|
1124
|
+
} & {
|
1125
|
+
resultFunc: (resultFuncArgs_0: import("@flowerforce/flower-core").Form<Record<string, any>>) => boolean | undefined;
|
1126
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@flowerforce/flower-core").Form<Record<string, any>>) => boolean | undefined) & {
|
1127
|
+
clearCache: () => void;
|
1128
|
+
resultsCount: () => number;
|
1129
|
+
resetResultsCount: () => void;
|
1130
|
+
};
|
1131
|
+
lastResult: () => boolean | undefined;
|
1132
|
+
dependencies: [((state: {
|
1133
|
+
flower: {
|
1134
|
+
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1135
|
+
};
|
1136
|
+
}) => import("@flowerforce/flower-core").Form<Record<string, any>>) & {
|
1137
|
+
clearCache: () => void;
|
1138
|
+
resultsCount: () => number;
|
1139
|
+
resetResultsCount: () => void;
|
1140
|
+
} & {
|
1141
|
+
resultFunc: (resultFuncArgs_0: import("@flowerforce/flower-core").Flower<Record<string, any>>) => import("@flowerforce/flower-core").Form<Record<string, any>>;
|
1142
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@flowerforce/flower-core").Flower<Record<string, any>>) => import("@flowerforce/flower-core").Form<Record<string, any>>) & {
|
1143
|
+
clearCache: () => void;
|
1144
|
+
resultsCount: () => number;
|
1145
|
+
resetResultsCount: () => void;
|
1146
|
+
};
|
1147
|
+
lastResult: () => import("@flowerforce/flower-core").Form<Record<string, any>>;
|
1148
|
+
dependencies: [((state: {
|
1149
|
+
flower: {
|
1150
|
+
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1151
|
+
};
|
1152
|
+
}) => import("@flowerforce/flower-core").Flower<Record<string, any>>) & {
|
1153
|
+
clearCache: () => void;
|
1154
|
+
resultsCount: () => number;
|
1155
|
+
resetResultsCount: () => void;
|
1156
|
+
} & {
|
1157
|
+
resultFunc: (resultFuncArgs_0: {
|
1158
|
+
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1159
|
+
}) => import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1160
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
1161
|
+
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1162
|
+
}) => import("@flowerforce/flower-core").Flower<Record<string, any>>) & {
|
1163
|
+
clearCache: () => void;
|
1164
|
+
resultsCount: () => number;
|
1165
|
+
resetResultsCount: () => void;
|
1166
|
+
};
|
1167
|
+
lastResult: () => import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
1168
|
+
dependencies: [<T extends Record<string, any>>(state: {
|
1169
|
+
flower: {
|
1170
|
+
[x: string]: import("@flowerforce/flower-core").Flower<T>;
|
1171
|
+
};
|
1172
|
+
}) => {
|
1173
|
+
[x: string]: import("@flowerforce/flower-core").Flower<T>;
|
1174
|
+
}];
|
1175
|
+
recomputations: () => number;
|
1176
|
+
resetRecomputations: () => void;
|
1177
|
+
dependencyRecomputations: () => number;
|
1178
|
+
resetDependencyRecomputations: () => void;
|
1179
|
+
} & {
|
1180
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
1181
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
1182
|
+
}];
|
1183
|
+
recomputations: () => number;
|
1184
|
+
resetRecomputations: () => void;
|
1185
|
+
dependencyRecomputations: () => number;
|
1186
|
+
resetDependencyRecomputations: () => void;
|
1187
|
+
} & {
|
1188
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
1189
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
1190
|
+
}];
|
1191
|
+
recomputations: () => number;
|
1192
|
+
resetRecomputations: () => void;
|
1193
|
+
dependencyRecomputations: () => number;
|
1194
|
+
resetDependencyRecomputations: () => void;
|
1195
|
+
} & {
|
1196
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
1197
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
1198
|
+
};
|
1116
1199
|
declare const makeSelectNodeFormTouched: (name: string, currentNodeId: string) => ((state: {
|
1117
1200
|
flower: {
|
1118
1201
|
[x: string]: import("@flowerforce/flower-core").Flower<Record<string, any>>;
|
@@ -1641,4 +1724,4 @@ export declare const selectorRulesDisabled: (id: string, rules: RulesObject<any>
|
|
1641
1724
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
1642
1725
|
memoize: typeof import("reselect").weakMapMemoize;
|
1643
1726
|
};
|
1644
|
-
export { selectFlowerHistory, makeSelectNodesIds, makeSelectCurrentNodeId, makeSelectStartNodeId, makeSelectCurrentNodeDisabled, getAllData, getDataByFlow, getDataFromState, makeSelectNodeErrors, makeSelectNodeFieldTouched, makeSelectFieldError, makeSelectNodeFormTouched, makeSelectPrevNodeRetain };
|
1727
|
+
export { selectFlowerHistory, makeSelectNodesIds, makeSelectCurrentNodeId, makeSelectStartNodeId, makeSelectCurrentNodeDisabled, getAllData, getDataByFlow, getDataFromState, makeSelectNodeErrors, makeSelectNodeFieldTouched, makeSelectNodeFieldDirty, makeSelectFieldError, makeSelectNodeFormTouched, makeSelectPrevNodeRetain };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flowerforce/flower-react",
|
3
|
-
"version": "3.1.2-beta.
|
3
|
+
"version": "3.1.2-beta.5",
|
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.1.2-beta.
|
37
|
+
"@flowerforce/flower-core": "3.1.2-beta.5",
|
38
38
|
"@reduxjs/toolkit": "^2.2.4",
|
39
39
|
"lodash": "^4.17.21",
|
40
40
|
"react-redux": "^9.1.2",
|