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