- updated flow edit page;
- fixed issues on application form page;
This commit is contained in:
@@ -8,41 +8,8 @@ import { __ } from '@wordpress/i18n';
|
||||
|
||||
const NodeInitialForm = ({ data: { id, label = '' } }) => {
|
||||
const flowData = storeGet.main.flowData();
|
||||
//const [options, setOptions] = useState([]);
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
/*const onChangeFn = (e) => {
|
||||
const { value } = e.target;
|
||||
const data = {
|
||||
formId: String(id),
|
||||
chosenField: value,
|
||||
chosenValue: ''
|
||||
}
|
||||
setValue(value);
|
||||
storeSet.main.addFlowData(data);
|
||||
}*/
|
||||
|
||||
/*useEffect(() => {
|
||||
const flowForms = storeGet.main.flowForms();
|
||||
const flowData = storeGet.main.flowData();
|
||||
|
||||
if (flowForms.length > 2) {
|
||||
const form = head(flowForms.filter(o => String(o.id) === String(id)))
|
||||
const relevantFields = form
|
||||
? form.content
|
||||
.filter(o => ['radio', 'select'].includes(o.name))
|
||||
.map(o => ({ name: o.id, label: o.label }))
|
||||
: [];
|
||||
setOptions(relevantFields);
|
||||
}
|
||||
|
||||
const flowDataForm = head(flowData.filter(o => String(o.formId) === String(id)));
|
||||
|
||||
if (flowDataForm) {
|
||||
setValue(flowDataForm.chosenField);
|
||||
}
|
||||
}, [id]);*/
|
||||
|
||||
useEffect(() => {
|
||||
const flowForms = storeGet.main.flowForms();
|
||||
const form = head(flowForms.filter(o => String(o.id) === String(id)));
|
||||
|
||||
@@ -8,7 +8,7 @@ import { isEmpty } from 'ramda';
|
||||
import '@xyflow/react/dist/style.css';
|
||||
|
||||
// store
|
||||
import { useStore, storeSet } from '../../store';
|
||||
import { useStore, storeSet, storeGet } from '../../store';
|
||||
|
||||
// nodes
|
||||
import NodeInitialForm from './components/NodeInitialForm';
|
||||
@@ -104,15 +104,6 @@ const FlowBuilder = ({ initialForm = 0, finalForm = 0, mainField = '' }) => {
|
||||
setNodes(initialNodes);
|
||||
setEdges(edges);
|
||||
storeSet.main.flowEdges(edges);
|
||||
|
||||
if (!isEmpty(mainField)) {
|
||||
const data = {
|
||||
formId: String(initialForm),
|
||||
chosenField: mainField,
|
||||
chosenValue: ''
|
||||
}
|
||||
storeSet.main.addFlowData(data);
|
||||
}
|
||||
} else {
|
||||
setNodes([]);
|
||||
setEdges([]);
|
||||
|
||||
@@ -19,7 +19,8 @@ const NumberInput = ({
|
||||
maxFractionDigits = 1,
|
||||
min,
|
||||
max,
|
||||
disabled = false
|
||||
disabled = false,
|
||||
useGrouping = true
|
||||
}) => {
|
||||
const input = <Controller
|
||||
name={fieldName}
|
||||
@@ -34,6 +35,7 @@ const NumberInput = ({
|
||||
min={min}
|
||||
max={max}
|
||||
locale={locale}
|
||||
useGrouping={useGrouping}
|
||||
minFractionDigits={minFractionDigits}
|
||||
className={classNames({ 'p-invalid': fieldState.invalid })}/>
|
||||
)}/>
|
||||
|
||||
Reference in New Issue
Block a user