@arquimedes.co/eureka-forms 3.0.42-test → 3.0.43-test
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/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -1
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +2 -3
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +4 -3
- package/dist/FormSteps/StepHooks.js +2 -1
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +4 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import ErkSmartSelect from '../../../Shared/ErkSmartSelect/ErkSmartSelect';
|
|
|
6
6
|
import FormContext from '../../../Contexts/FormContext';
|
|
7
7
|
import { useAppSelector } from '../../../hooks';
|
|
8
8
|
import { recursivelyCalcConditionSteps, selectDependencies, useFormStep } from '../../StepHooks';
|
|
9
|
+
import { shallowEqual } from 'react-redux';
|
|
9
10
|
import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
|
|
10
11
|
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
11
12
|
import { calcDefaultValue, evaluateCondition } from '../../StepFunctions';
|
|
@@ -28,7 +29,7 @@ function ClassifierSelectorStep({ step, editable }) {
|
|
|
28
29
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
30
|
}, []);
|
|
30
31
|
const dependencies = useAppSelector((state) => selectDependencies(state, idDependencies));
|
|
31
|
-
const dependenciesValues =
|
|
32
|
+
const dependenciesValues = useAppSelector((state) => idDependencies.map((id) => state.site.dependencies[id]?.value), shallowEqual);
|
|
32
33
|
const { postview, preview } = useAppSelector((state) => state.global);
|
|
33
34
|
const form = useContext(FormContext);
|
|
34
35
|
const classifier = form.classifiers?.[step.idClassifier ?? ''];
|
|
@@ -6,6 +6,7 @@ import ErkSmartSelect from '../../../Shared/ErkSmartSelect/ErkSmartSelect';
|
|
|
6
6
|
import FormContext from '../../../Contexts/FormContext';
|
|
7
7
|
import { useAppSelector } from '../../../hooks';
|
|
8
8
|
import { recursivelyCalcConditionSteps, selectDependencies, useFormStep } from '../../StepHooks';
|
|
9
|
+
import { shallowEqual } from 'react-redux';
|
|
9
10
|
import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
|
|
10
11
|
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
11
12
|
import { calcDefaultValue, evaluateCondition } from '../../StepFunctions';
|
|
@@ -30,6 +31,7 @@ function SelectorStep({ step, editable }) {
|
|
|
30
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
32
|
}, []);
|
|
32
33
|
const dependencies = useAppSelector((state) => selectDependencies(state, idDependencies));
|
|
34
|
+
const dependenciesValues = useAppSelector((state) => idDependencies.map((id) => state.site.dependencies[id]?.value), shallowEqual);
|
|
33
35
|
const mapNestedOption = () => {
|
|
34
36
|
let currentOptionIndex = null;
|
|
35
37
|
let currentOption = null;
|
|
@@ -48,9 +50,6 @@ function SelectorStep({ step, editable }) {
|
|
|
48
50
|
}
|
|
49
51
|
return null;
|
|
50
52
|
};
|
|
51
|
-
const dependenciesValues = useMemo(() => {
|
|
52
|
-
return idDependencies.map((id) => dependencies[id].value);
|
|
53
|
-
}, [dependencies, idDependencies]);
|
|
54
53
|
const filteredOptions = useMemo(() => {
|
|
55
54
|
return step.options.filter((option) => {
|
|
56
55
|
if (!option.condition || evaluateCondition(option.condition, dependencies))
|
|
@@ -7,6 +7,7 @@ import FormContext from '../../../Contexts/FormContext';
|
|
|
7
7
|
import { useAppDispatch, useAppSelector } from '../../../hooks';
|
|
8
8
|
import { focusStep, setEmptyDependency } from '../../../States/SiteSlice';
|
|
9
9
|
import { selectDependencies, selectStepDependencies, useFormStep } from '../../StepHooks';
|
|
10
|
+
import { shallowEqual } from 'react-redux';
|
|
10
11
|
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
11
12
|
import { FormTypes } from '../../../constants/FormStepTypes';
|
|
12
13
|
function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionalDependencies = () => [], getOptionsConditionsIdSteps = () => [], renderNestedSteps, }) {
|
|
@@ -31,11 +32,11 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
|
|
|
31
32
|
const allDeps = useMemo(() => [...(step.dependencies ?? []), ...getOptionalDependencies(step)], [getOptionalDependencies, step]);
|
|
32
33
|
const idDependencies = useMemo(() => getOptionsConditionsIdSteps(step), [getOptionsConditionsIdSteps, step]);
|
|
33
34
|
const dependencies = useAppSelector((state) => selectDependencies(state, allDeps));
|
|
34
|
-
const allDepsValues =
|
|
35
|
+
const allDepsValues = useAppSelector((state) => allDeps.map((dep) => state.site.dependencies[dep]?.value), shallowEqual);
|
|
35
36
|
const deps = useAppSelector((state) => selectDependencies(state, idDependencies));
|
|
36
|
-
const
|
|
37
|
+
const depsValues = useAppSelector((state) => idDependencies.map((id) => state.site.dependencies[id]?.value), shallowEqual);
|
|
37
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
-
const conditionDependencies = useMemo(() => deps, [
|
|
39
|
+
const conditionDependencies = useMemo(() => deps, [depsValues]);
|
|
39
40
|
const { emptyDep, invalids } = useAppSelector((state) => selectStepDependencies(state, step, form));
|
|
40
41
|
const { getValues, setFocus } = useFormContext();
|
|
41
42
|
const isEmpty = useAppSelector((state) => state.site.dependencies[step.id]?.empty);
|
|
@@ -3,6 +3,7 @@ import { useAppSelector, useAppDispatch } from '../hooks';
|
|
|
3
3
|
import { clearDependency, setStepDependency } from '../States/SiteSlice';
|
|
4
4
|
import { createSelector } from '@reduxjs/toolkit';
|
|
5
5
|
import { calcDefaultValue, evaluateCondition } from './StepFunctions';
|
|
6
|
+
import { shallowEqual } from 'react-redux';
|
|
6
7
|
import { useController } from 'react-hook-form';
|
|
7
8
|
import ConditionTypes from '../constants/ConditionTypes';
|
|
8
9
|
import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, } from '../constants/FormStepTypes';
|
|
@@ -127,7 +128,7 @@ export const selectDependencies = createSelector([
|
|
|
127
128
|
export const useCondition = (condition) => {
|
|
128
129
|
const ids = useMemo(() => recursivelyCalcConditionSteps(condition), [condition]);
|
|
129
130
|
const dependencies = useAppSelector((state) => selectDependencies(state, ids));
|
|
130
|
-
const dependenciesValues =
|
|
131
|
+
const dependenciesValues = useAppSelector((state) => ids.map((id) => state.site.dependencies[id]?.value), shallowEqual);
|
|
131
132
|
return useMemo(() => {
|
|
132
133
|
return !condition || evaluateCondition(condition, dependencies);
|
|
133
134
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5,6 +5,7 @@ import { useAppSelector } from '../../../hooks';
|
|
|
5
5
|
import FormContext from '../../../Contexts/FormContext';
|
|
6
6
|
import { useContext, useMemo } from 'react';
|
|
7
7
|
import { selectDependencies, useFormStep } from '../../StepHooks';
|
|
8
|
+
import { shallowEqual } from 'react-redux';
|
|
8
9
|
import { stringToDraft } from '../../../Utils/DraftFunctions';
|
|
9
10
|
import SmartDraftRenderer from '../../../Shared/SmartDraftRenderer/SmartDraftRenderer';
|
|
10
11
|
//**Pendientes a mejorar, esperar antes de enviar, en local (actividades), usar el value envez de el draft en actividades, esperar a que dejen de escribir, optimizar para que use lo que tiene en local y si necesita ahi si pregunte. */
|
|
@@ -21,13 +22,15 @@ function TitleStep({ step }) {
|
|
|
21
22
|
const description = useMemo(() => calcBaseDraft(value?.description ?? step.description), //Usa por defecto lo que venga en el value, pero no escucha cambios
|
|
22
23
|
[step.description, value?.description]);
|
|
23
24
|
const dependencies = useAppSelector((state) => selectDependencies(state, step.dependencies));
|
|
25
|
+
const stableDepsValues = useAppSelector((state) => (step.dependencies ?? []).map((id) => state.site.dependencies[id]?.value), shallowEqual);
|
|
24
26
|
const values = useMemo(() => {
|
|
25
27
|
const values = {};
|
|
26
28
|
for (const { idOriginal, value } of Object.values(dependencies)) {
|
|
27
29
|
values[idOriginal] = value;
|
|
28
30
|
}
|
|
29
31
|
return values;
|
|
30
|
-
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
}, [stableDepsValues]);
|
|
31
34
|
return (_jsxs("div", { className: styles.container, style: {
|
|
32
35
|
color: formStyle.textColor,
|
|
33
36
|
width: widthStats.currentBreakPoint <= size ? '100%' : calcStepWidth(size, form.size),
|
package/package.json
CHANGED