Fix for CXTDT-586372, by default the header/row styles will be none when striped is selected.
This commit is contained in:
parent
4c551c22f7
commit
652d5aab22
@ -55,6 +55,17 @@ class TableViewController: BaseViewController<Table> {
|
|||||||
|
|
||||||
striped.onChange = { [weak self] sender in
|
striped.onChange = { [weak self] sender in
|
||||||
self?.component.striped = sender.isOn
|
self?.component.striped = sender.isOn
|
||||||
|
|
||||||
|
let headerStyle = sender.isOn ? nil : Line.Style(rawValue: self?.headerLineStylePicker.text ?? "")
|
||||||
|
let rowStyle = sender.isOn ? nil : Line.Style(rawValue: self?.rowLineStylePicker.text ?? "")
|
||||||
|
|
||||||
|
var headers = self?.component.tableHeader ?? [TableRowModel]()
|
||||||
|
self?.updateBottomLineStyle(items:&headers, style: headerStyle)
|
||||||
|
self?.component.tableHeader = headers
|
||||||
|
|
||||||
|
var rows = self?.component.tableRows ?? [TableRowModel]()
|
||||||
|
self?.updateBottomLineStyle(items:&rows, style: rowStyle)
|
||||||
|
self?.component.tableRows = rows
|
||||||
}
|
}
|
||||||
|
|
||||||
fillContainer.onChange = { [weak self] sender in
|
fillContainer.onChange = { [weak self] sender in
|
||||||
@ -82,28 +93,14 @@ class TableViewController: BaseViewController<Table> {
|
|||||||
|
|
||||||
headerLineStylePicker.onPickerDidSelect = { [weak self] item in
|
headerLineStylePicker.onPickerDidSelect = { [weak self] item in
|
||||||
var headers = self?.component.tableHeader ?? [TableRowModel]()
|
var headers = self?.component.tableHeader ?? [TableRowModel]()
|
||||||
for currentHeaderIndex in 0..<headers.count {
|
self?.updateBottomLineStyle(items:&headers, style: item)
|
||||||
var currentHeader = headers[currentHeaderIndex]
|
|
||||||
for currentHeaderItem in 0..<currentHeader.columnsCount {
|
|
||||||
currentHeader.columns[currentHeaderItem].bottomLine = item
|
|
||||||
}
|
|
||||||
headers[currentHeaderIndex] = currentHeader
|
|
||||||
}
|
|
||||||
self?.component.tableHeader = headers
|
self?.component.tableHeader = headers
|
||||||
}
|
}
|
||||||
|
|
||||||
rowLineStylePicker.onPickerDidSelect = { [weak self] item in
|
rowLineStylePicker.onPickerDidSelect = { [weak self] item in
|
||||||
|
|
||||||
var rows = self?.component.tableRows ?? [TableRowModel]()
|
var rows = self?.component.tableRows ?? [TableRowModel]()
|
||||||
|
self?.updateBottomLineStyle(items:&rows, style: item)
|
||||||
for currentRowIndex in 0..<rows.count {
|
|
||||||
var currentRow = rows[currentRowIndex]
|
|
||||||
for currentRowItem in 0..<currentRow.columnsCount {
|
|
||||||
currentRow.columns[currentRowItem].bottomLine = item
|
|
||||||
}
|
|
||||||
rows[currentRowIndex] = currentRow
|
|
||||||
}
|
|
||||||
|
|
||||||
self?.component.tableRows = rows
|
self?.component.tableRows = rows
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +114,16 @@ class TableViewController: BaseViewController<Table> {
|
|||||||
customColumnWidthSize.backgroundColor = enable ? UIColor.white : VDSColor.paletteGray85
|
customColumnWidthSize.backgroundColor = enable ? UIColor.white : VDSColor.paletteGray85
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateBottomLineStyle(items:inout [TableRowModel], style: Line.Style?) {
|
||||||
|
for currentRowIndex in 0..<items.count {
|
||||||
|
var currentRow = items[currentRowIndex]
|
||||||
|
for currentRowItem in 0..<currentRow.columnsCount {
|
||||||
|
currentRow.columns[currentRowItem].bottomLine = style
|
||||||
|
}
|
||||||
|
items[currentRowIndex] = currentRow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func setupModel() {
|
func setupModel() {
|
||||||
///Header row
|
///Header row
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user