|
@@ -24,6 +24,8 @@ class KMBatchProcessingTableView: NSView {
|
|
|
self.reloadData()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ var isDrag = false
|
|
|
/**
|
|
|
@abstract 外部传入数据
|
|
|
@param inputData 文件路劲
|
|
@@ -234,7 +236,7 @@ extension KMBatchProcessingTableView: NSTableViewDelegate {
|
|
|
}
|
|
|
|
|
|
tableRowView.mouseDownCallback = { [unowned self] (mouseEntered, mouseBox) in
|
|
|
- if data != nil {
|
|
|
+ if data != nil && !self.isDrag {
|
|
|
for i in 0...self.data!.count - 1 {
|
|
|
let model = self.data![i]
|
|
|
if model.select == true {
|
|
@@ -298,7 +300,7 @@ extension KMBatchProcessingTableView: NSTableViewDelegate {
|
|
|
}
|
|
|
|
|
|
func didSelectItem(shouldSelectRow row: Int) {
|
|
|
- if self.data != nil {
|
|
|
+ if self.data != nil && !self.isDrag {
|
|
|
for item in self.data! {
|
|
|
item.select = false
|
|
|
}
|
|
@@ -312,6 +314,19 @@ extension KMBatchProcessingTableView: NSTableViewDelegate {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ func cancelAllSelect() {
|
|
|
+ for i in 0...self.data!.count - 1 {
|
|
|
+ let model = self.data![i]
|
|
|
+ model.select = false
|
|
|
+ let columnIndex = self.tableView.column(withIdentifier: NSUserInterfaceItemIdentifier(KMBatchProcessingTableViewOptions.delete.rawValue.description))
|
|
|
+ self.tableView.reloadData(forRowIndexes: IndexSet(integer: i), columnIndexes: IndexSet(integer: columnIndex))
|
|
|
+ if self.tableView.rowView(atRow: i, makeIfNecessary: false) is KMBatchProcessingTableRowView {
|
|
|
+ let rowView: KMBatchProcessingTableRowView = self.tableView.rowView(atRow: i, makeIfNecessary: false) as! KMBatchProcessingTableRowView
|
|
|
+ rowView.reloadData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension KMBatchProcessingTableView: NSTableViewDataSource {
|
|
@@ -339,6 +354,9 @@ extension KMBatchProcessingTableView: NSTableViewDataSource {
|
|
|
guard dropOperation == .above else {
|
|
|
return []
|
|
|
}
|
|
|
+
|
|
|
+ self.isDrag = true
|
|
|
+ self.cancelAllSelect()
|
|
|
if let source = info.draggingSource as? NSTableView, source === tableView {
|
|
|
tableView.draggingDestinationFeedbackStyle = .gap
|
|
|
} else {
|
|
@@ -417,6 +435,9 @@ extension KMBatchProcessingTableView: NSTableViewDataSource {
|
|
|
// }
|
|
|
// tableView.removeRows(at: IndexSet(indexes), withAnimation: .slideUp)
|
|
|
// }
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ self.isDrag = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|