Сделал предустановку значений из процесса
This commit is contained in:
parent
af0c3bcd98
commit
2cd4d87d0a
@ -13,7 +13,7 @@ export interface ArgumentInterface {
|
||||
|
||||
export default function Argument(argument: ArgumentInterface) {
|
||||
let {argumentList, setArgumentList} = useContext<ContextInterface>(Context)
|
||||
let [value, setValue] = useState('')
|
||||
let [value, setValue] = useState(argumentList[argument.name] || '')
|
||||
|
||||
useEffect(() => {
|
||||
let temp = {
|
||||
|
@ -11,8 +11,7 @@ interface OptionsInterface {
|
||||
export default function Options({optionList}: OptionsInterface) {
|
||||
let {optionList: ol, setOptionList} = useContext<ContextInterface>(Context)
|
||||
let [selectedOptions, setSelectedOptions] = useState<OptionInterface[]>([]);
|
||||
let [values, setValues] = useState<OptionInterface[]>([]);
|
||||
let [selectedValues, setSelectedValues] = useState<string[]>([]);
|
||||
let [selectedValues, setSelectedValues] = useState<string[]>(Object.keys(ol) || []);
|
||||
|
||||
useEffect(() => {
|
||||
let result: OptionInterface[] = [];
|
||||
@ -25,7 +24,7 @@ export default function Options({optionList}: OptionsInterface) {
|
||||
let temp: any = {}
|
||||
optionList.forEach((value, index, array) => {
|
||||
let check = selectedValues.find(item => item === value.name)
|
||||
check && (temp[value.name] = value.acceptValue ? '' : null)
|
||||
check && (temp[value.name] = value.acceptValue ? '' : true)
|
||||
})
|
||||
setOptionList(temp)
|
||||
}, [selectedValues]);
|
||||
|
Loading…
Reference in New Issue
Block a user