Skip to content

Commit

Permalink
fix: 🐛 [BCP: 0] fix bugs in DataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
shengxu7 committed Jun 6, 2023
1 parent d25082e commit 1cb2cfd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/FioriSwiftUICore/DataTable/ItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ struct FocusedEditingView: View {
case .listitem:
if let selectedIndex = dataItem.selectedIndex {
self._listItemSelection = State(initialValue: [selectedIndex])

} else {
let data = self.layoutManager.model.listItemDataAndTitle?(self.rowIndex, self.columnIndex) ?? ([self.editingText], "")
if let index = data.0.firstIndex(of: self.dataItem.text ?? "") {
self._listItemSelection = State(initialValue: [index])
}
}
case .date, .time:
self._editingDate = State(initialValue: self.dataItem.date ?? Date())
Expand Down Expand Up @@ -82,7 +88,7 @@ struct FocusedEditingView: View {
}

// tap again to dismiss .date, .time & .duration popover
if let currentCell = self.layoutManager.currentCell, currentCell == (rowIndex, columnIndex), dataItem.type != .text, dataItem.type != .listitem {
if let currentCell = self.layoutManager.currentCell, currentCell == (rowIndex, columnIndex), dataItem.type != .text, dataItem.type != .listitem, self.showPopover {
self.showPopover = false
self.showSheet = false
self.isInlineEdit = false
Expand Down

0 comments on commit 1cb2cfd

Please sign in to comment.