fix: OwnTextField
This commit is contained in:
parent
96c58dfd18
commit
7ac8aef451
@ -19,7 +19,7 @@ type SettingTextFieldProps = {
|
||||
|
||||
type Answer = {
|
||||
name: string;
|
||||
value: string;
|
||||
value: "single" | "multi" | "number";
|
||||
};
|
||||
|
||||
const ANSWER_TYPES: Answer[] = [
|
||||
@ -43,11 +43,17 @@ export default function SettingTextField({
|
||||
aria-labelledby="demo-controlled-radio-buttons-group"
|
||||
name="controlled-radio-buttons-group"
|
||||
value={ANSWER_TYPES.findIndex(
|
||||
({ value }) => value === listQuestions[totalIndex].content.type
|
||||
({ value }) => listQuestions[totalIndex].content[value]
|
||||
)}
|
||||
onChange={({ target }: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const clonContent = listQuestions[totalIndex].content;
|
||||
clonContent.type = ANSWER_TYPES[Number(target.value)].value;
|
||||
const clonContent = {
|
||||
...listQuestions[totalIndex].content,
|
||||
single: false,
|
||||
multi: false,
|
||||
number: false,
|
||||
[ANSWER_TYPES[Number(target.value)].value]: true,
|
||||
};
|
||||
|
||||
updateQuestionsList(totalIndex, { content: clonContent });
|
||||
}}
|
||||
>
|
||||
|
||||
@ -35,6 +35,7 @@ export interface Question {
|
||||
variants: Variants[];
|
||||
hint: Hint;
|
||||
rule: Rule;
|
||||
images: string[];
|
||||
large: boolean;
|
||||
multi: boolean;
|
||||
own: boolean;
|
||||
@ -44,6 +45,8 @@ export interface Question {
|
||||
type: string;
|
||||
autofill: boolean;
|
||||
default: string;
|
||||
single: boolean;
|
||||
number: boolean;
|
||||
};
|
||||
version: number;
|
||||
parent_ids: number[];
|
||||
@ -107,9 +110,12 @@ export const createQuestion = (id: number) => {
|
||||
innerName: "",
|
||||
back: "",
|
||||
placeholder: "",
|
||||
type: "single",
|
||||
type: "all",
|
||||
autofill: true,
|
||||
default: "",
|
||||
images: [],
|
||||
number: false,
|
||||
single: false,
|
||||
variants: [
|
||||
{
|
||||
answer: "",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user