Skip to content

Commit

Permalink
feat: 🎸 [BCP: 2280114088] support selected background color (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
shengxu7 authored Jul 1, 2022
1 parent cea77a2 commit 578b684
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Sources/FioriSwiftUICore/DataTable/GridTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,17 @@ struct InternalGridTableView: View {
let y: CGFloat = allItems[rowIndex][0].pos.y * tmpScaleY - offsetY
let allowsToShowTheRow = showTheRow(for: rowIndex, y: y, startPosY: startPosition.y, layoutData: layoutData, size: size)
if allowsToShowTheRow {
// general background color & selection background color for the row
Group {
if self.layoutManager.model.isEditing && self.layoutManager.selectedIndexes.contains(rowIndex - (self.layoutManager.model.hasHeader ? 1 : 0)) {
Color.preferredColor(.informationBackground)
} else {
self.layoutManager.model.backgroundColor
}
}
.frame(width: size.width, height: layoutData.rowHeights[rowIndex] * tmpScaleY)
.position(x: size.width / 2, y: y)

// all visible columns
ForEach(0 ..< indexOfColumns.count, id: \.self) { j in
let columnIndex = indexOfColumns[j]
Expand Down
1 change: 0 additions & 1 deletion Sources/FioriSwiftUICore/DataTable/ItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ struct ItemView: View {
}
.padding(contentInset)
.frame(width: cellWidth, height: cellHeight)
.background(self.layoutManager.model.backgroundColor)
.gesture(tapGesture)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct LeadingAccessoryView: View {
}
.frame(width: layoutData.leadingAccessoryViewWidth * self.layoutManager.scaleX,
height: layoutData.rowHeights[self.rowIndex] * self.layoutManager.scaleY)
.background(self.layoutManager.model.backgroundColor)
}

func makeSectionButton(layoutData: LayoutData) -> some View {
Expand Down

0 comments on commit 578b684

Please sign in to comment.