|
|
@@ -66,6 +66,7 @@ interface Props {
|
|
|
locGroupKeyword: string
|
|
|
locationIdKeyword: string
|
|
|
showGroupBorder: boolean
|
|
|
+ showZoneBorder: boolean
|
|
|
showTooltip: boolean
|
|
|
}
|
|
|
|
|
|
@@ -293,7 +294,7 @@ const getCellClass = (cell: GridCell | null) => {
|
|
|
if (!isCellMatched(cell)) return ['aisle']
|
|
|
|
|
|
const classNames = [`category-${cell.category.toLowerCase()}`]
|
|
|
- if (props.showGroupBorder && hasSameGroupNeighbor(cell)) {
|
|
|
+ if (hasActiveBorder() && hasSameBorderNeighbor(cell)) {
|
|
|
classNames.push('grouped')
|
|
|
}
|
|
|
return classNames
|
|
|
@@ -361,31 +362,50 @@ const tooltipStyle = computed<CSSProperties>(() => ({
|
|
|
top: `${tooltipPosition.value.y}px`
|
|
|
}))
|
|
|
|
|
|
-const isSameGroupNeighbor = (cell: GridCell, xOffset: number, yOffset: number) => {
|
|
|
+const hasActiveBorder = () => {
|
|
|
+ return props.showGroupBorder || props.showZoneBorder
|
|
|
+}
|
|
|
+
|
|
|
+const getBorderGroupValue = (cell: GridCell) => {
|
|
|
+ if (props.showGroupBorder) {
|
|
|
+ return cell.locGroup1
|
|
|
+ }
|
|
|
+ if (props.showZoneBorder) {
|
|
|
+ return cell.zoneId || ''
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+}
|
|
|
+
|
|
|
+const isSameBorderNeighbor = (cell: GridCell, xOffset: number, yOffset: number) => {
|
|
|
+ const currentGroupValue = getBorderGroupValue(cell)
|
|
|
+ if (!currentGroupValue) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
const neighbor = locationMap.value.get(
|
|
|
`${cell.parsed.gridRow + xOffset}-${cell.parsed.gridCol + yOffset}`
|
|
|
)
|
|
|
- return Boolean(neighbor && neighbor.locGroup1 === cell.locGroup1)
|
|
|
+ return Boolean(neighbor && getBorderGroupValue(neighbor) === currentGroupValue)
|
|
|
}
|
|
|
|
|
|
-const hasSameGroupNeighbor = (cell: GridCell) => {
|
|
|
- return isSameGroupNeighbor(cell, -1, 0)
|
|
|
- || isSameGroupNeighbor(cell, 1, 0)
|
|
|
- || isSameGroupNeighbor(cell, 0, -1)
|
|
|
- || isSameGroupNeighbor(cell, 0, 1)
|
|
|
+const hasSameBorderNeighbor = (cell: GridCell) => {
|
|
|
+ return isSameBorderNeighbor(cell, -1, 0)
|
|
|
+ || isSameBorderNeighbor(cell, 1, 0)
|
|
|
+ || isSameBorderNeighbor(cell, 0, -1)
|
|
|
+ || isSameBorderNeighbor(cell, 0, 1)
|
|
|
}
|
|
|
|
|
|
const getCellStyle = (cell: GridCell | null): CSSProperties => {
|
|
|
- if (!cell || !isCellMatched(cell) || !props.showGroupBorder) return {}
|
|
|
+ if (!cell || !isCellMatched(cell) || !hasActiveBorder() || !hasSameBorderNeighbor(cell)) return {}
|
|
|
|
|
|
const borderWidth = 'var(--group-outline-width, 2px)'
|
|
|
|
|
|
return {
|
|
|
'--group-border-color': '#ffffff',
|
|
|
- '--group-border-top': isSameGroupNeighbor(cell, -1, 0) ? '0px' : borderWidth,
|
|
|
- '--group-border-right': isSameGroupNeighbor(cell, 0, 1) ? '0px' : borderWidth,
|
|
|
- '--group-border-bottom': isSameGroupNeighbor(cell, 1, 0) ? '0px' : borderWidth,
|
|
|
- '--group-border-left': isSameGroupNeighbor(cell, 0, -1) ? '0px' : borderWidth
|
|
|
+ '--group-border-top': isSameBorderNeighbor(cell, -1, 0) ? '0px' : borderWidth,
|
|
|
+ '--group-border-right': isSameBorderNeighbor(cell, 0, 1) ? '0px' : borderWidth,
|
|
|
+ '--group-border-bottom': isSameBorderNeighbor(cell, 1, 0) ? '0px' : borderWidth,
|
|
|
+ '--group-border-left': isSameBorderNeighbor(cell, 0, -1) ? '0px' : borderWidth
|
|
|
}
|
|
|
}
|
|
|
|