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