не открывается модалка для особенных, не рисуется иконка настройки условий для особенных
This commit is contained in:
parent
248ffe406b
commit
1a9c26ccf7
@ -48,7 +48,6 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
|
|||||||
(acc, node) => ((acc[node.data.id] = {}), acc),
|
(acc, node) => ((acc[node.data.id] = {}), acc),
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -81,18 +80,19 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
|
|||||||
cleardragQuestionContentId();
|
cleardragQuestionContentId();
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
!csElement.data.isRoot && (
|
(!csElement.data.isRoot && !isQuestionProhibited(csElement.data.qtype)) && (
|
||||||
<CsSettingsButton
|
<CsSettingsButton
|
||||||
key={`settings-${csElement.data.id}`}
|
key={`settings-${csElement.data.id}`}
|
||||||
ref={(r) => {
|
ref={(r) => {
|
||||||
const buttonData = buttonRefsById.current[csElement.data.id];
|
const buttonData = buttonRefsById.current[csElement.data.id];
|
||||||
if (buttonData) buttonData.settings = r;
|
if (buttonData) buttonData.settings = r;
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
updateOpenedModalSettingsId(csElement.data.id);
|
updateOpenedModalSettingsId(csElement.data.id,);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
//оболочка узла
|
||||||
<CsSelectButton
|
<CsSelectButton
|
||||||
key={`select-${csElement.data.id}`}
|
key={`select-${csElement.data.id}`}
|
||||||
ref={(r) => {
|
ref={(r) => {
|
||||||
@ -101,7 +101,8 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
|
|||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setModalQuestionParentContentId(csElement.data.id);
|
setModalQuestionParentContentId(csElement.data.id);
|
||||||
setOpenedModalQuestions(true);
|
console.log("csElement ", csElement)
|
||||||
|
setOpenedModalQuestions(!(isQuestionProhibited(csElement.data.type) && csElement.data.children > 0));
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
])}
|
])}
|
||||||
|
@ -23,8 +23,10 @@ export interface Node {
|
|||||||
isRoot: boolean;
|
isRoot: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
qtype: QuestionType;
|
qtype: string;
|
||||||
|
type: string;
|
||||||
parent?: string;
|
parent?: string;
|
||||||
|
children: number;
|
||||||
};
|
};
|
||||||
classes: string;
|
classes: string;
|
||||||
}
|
}
|
||||||
@ -57,6 +59,9 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
|
|||||||
const edges: Edge[] = [];
|
const edges: Edge[] = [];
|
||||||
questions.forEach((question) => {
|
questions.forEach((question) => {
|
||||||
if (question.content.rule.parentId) {
|
if (question.content.rule.parentId) {
|
||||||
|
const parentQuestion = {
|
||||||
|
...getQuestionByContentId(question.content.rule.parentId),
|
||||||
|
} as AnyTypedQuizQuestion;
|
||||||
let label =
|
let label =
|
||||||
question.title === "" || question.title === " "
|
question.title === "" || question.title === " "
|
||||||
? "noname"
|
? "noname"
|
||||||
@ -68,7 +73,9 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
|
|||||||
isRoot: question.content.rule.parentId === "root",
|
isRoot: question.content.rule.parentId === "root",
|
||||||
id: question.content.id,
|
id: question.content.id,
|
||||||
label,
|
label,
|
||||||
qtype: question.type
|
qtype: question.content.rule.parentId === "root" ? "root" : parentQuestion.type,
|
||||||
|
type: question.type,
|
||||||
|
children: question.content.rule.children.length
|
||||||
},
|
},
|
||||||
classes: "multiline-auto",
|
classes: "multiline-auto",
|
||||||
});
|
});
|
||||||
@ -360,7 +367,7 @@ export const addNode = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isQuestionProhibited = (parentQType: QuestionType) => (
|
export const isQuestionProhibited = (parentQType: string) => (
|
||||||
parentQType === "text" ||
|
parentQType === "text" ||
|
||||||
parentQType === "date" ||
|
parentQType === "date" ||
|
||||||
parentQType === "number" ||
|
parentQType === "number" ||
|
||||||
|
Loading…
Reference in New Issue
Block a user