Skip to content

Commit

Permalink
fix: fix chart visible (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
laojun authored Jul 29, 2021
1 parent f3321fe commit ea9ff7e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
9 changes: 4 additions & 5 deletions shell/app/config-page/components/action-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const ActionForm = (props: IProps) => {

useUpdateEffect(() => {
if (state && has(state, 'formData')) {
updater.formData({ ...(state || {}) });
updater.formData({ ...(state.formData || {}) });
}
}, [state, updater]);

Expand All @@ -105,13 +105,12 @@ export const ActionForm = (props: IProps) => {
];
}
const curKeyOperation = get(operations, ['change', item.key]);
const curKey = item.key;
if (curKeyOperation) {
curItem.componentProps = {
...curItem.componentProps,
onChange: (e: any) => {
const val = curItem.component === 'input' ? e.target.value : e;
execOperation({ key: 'change', ...curKeyOperation }, { [curKey]: val });
onChange: () => {
const validFormData = formRef.current.getData();
execOperation({ key: 'change', ...curKeyOperation }, { formData: validFormData });
},
};
}
Expand Down
6 changes: 3 additions & 3 deletions shell/app/yml-chart/chart/yml-chart-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ const renderNodes = (nodeData: any[][], chart: any, chartConfig: IChartConfig, e
if (isEdit) {
const addEle = document.getElementById(`${chartId}-_yml-node-add-${index}_`);
if (addEle) {
addEle.classList.add('show');
addEle.classList.replace('invisible', 'visible');
}
}
})
.mouseout(() => {
if (isEdit) {
const addEle = document.getElementById(`${chartId}-_yml-node-add-${index}_`);
if (addEle) {
addEle.classList.remove('show');
addEle.classList.replace('visible', 'invisible');
}
}
});
Expand Down Expand Up @@ -186,7 +186,7 @@ const renderNodes = (nodeData: any[][], chart: any, chartConfig: IChartConfig, e
const add_xPos = x + width / 2 + MARGIN.X;
const add_yPos = y - height / 2;
const addNodeId = `${chartId}-_yml-node-add-${index}_`;
const addFobjectSVG = `<foreignObject id="${addNodeId}" class="svg-model-node-carrier hidden" x="${add_xPos}" y="${add_yPos}" width="${width}" height="${height}"></foreignObject>`;
const addFobjectSVG = `<foreignObject id="${addNodeId}" class="svg-model-node-carrier invisible" x="${add_xPos}" y="${add_yPos}" width="${width}" height="${height}"></foreignObject>`;
// g标签上加id,用于设置opcity属性(兼容safari)
const addG = chart.g().attr({ id: `${chartId}-${nodeId}-g` });
const addF = Snap.parse(addFobjectSVG);
Expand Down
8 changes: 0 additions & 8 deletions shell/app/yml-chart/chart/yml-chart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,5 @@

.svg-model-node-carrier {
overflow: visible;

&.hidden {
visibility: hidden;
}

&.show {
visibility: visible;
}
}
}

0 comments on commit ea9ff7e

Please # to comment.