diff --git a/demo/demo.vue b/demo/demo.vue index c90529b..73523dc 100644 --- a/demo/demo.vue +++ b/demo/demo.vue @@ -13,6 +13,7 @@ @row-click="onClickRow" @move-slider="onMoveSlider" @add-link="onAddLink" + @click-link="onClickLink" > @@ -100,7 +101,7 @@ let id = 0; const ganttData = reactive([]); -for (let i = 0; i < 5; i++) { +for (let i = 0; i < 15; i++) { onAdd(); } @@ -197,6 +198,10 @@ const onAddLink = (data: any) => { console.log('add link', data); }; +const onClickLink = (data: any) => { + console.log('click link', data); +}; + function onMove(data: any) { return true; } diff --git a/src/components/common/GanttBody.vue b/src/components/common/GanttBody.vue index 3d52a8f..9b2f2b3 100644 --- a/src/components/common/GanttBody.vue +++ b/src/components/common/GanttBody.vue @@ -88,6 +88,7 @@ const { ganttBodyRef } = useElement(); height: 100%; position: absolute; z-index: 5; + pointer-events: none; } .xg-gantt-body-date-line { @@ -96,6 +97,7 @@ const { ganttBodyRef } = useElement(); position: absolute; top: 0; opacity: 0.6; + pointer-events: none; } } diff --git a/src/components/common/Row.vue b/src/components/common/Row.vue index 8761893..3b800c3 100644 --- a/src/components/common/Row.vue +++ b/src/components/common/Row.vue @@ -9,7 +9,8 @@ { 'xg-row__select': props.renderStyle && $param.selectItem?.uuid === props.data?.uuid - } + }, + { 'xg-row__only': !props.renderStyle } ]" :style="{ top: `${(props.data?.flatIndex ?? 0) * rowHeight}px`, @@ -18,8 +19,8 @@ backgroundColor: props.renderStyle ? ($styleBox.levelColor[props.data!.level] ?? undefined) : undefined, ...$styleBox.getBorderColor() }" - @pointerenter="onEnter" - @pointerleave="onLeave" + @pointerenter.stop="onEnter" + @pointerleave.stop="onLeave" @click="onClick" @dblclick="onDblClick" > @@ -69,6 +70,10 @@ function onDblClick() { box-sizing: border-box; } +.xg-row__only { + pointer-events: none; +} + .xg-row.xg-row__hover { background-color: #f0f0f0aa !important; } diff --git a/src/components/links/LinkPath.vue b/src/components/links/LinkPath.vue index 4aa5f53..39f180b 100644 --- a/src/components/links/LinkPath.vue +++ b/src/components/links/LinkPath.vue @@ -1,5 +1,9 @@