Merge branch 'bugfix/atomic-vds-titleLockup-model-issue' into 'develop'

TitleLockup Model issue

### Summary
removed duplicate alignment property and updated the confluence to reference the correct textAlignment.

Co-authored-by: Matt Bruce <matt.bruce@verizon.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1194
This commit is contained in:
Pfeil, Scott Robert 2024-09-27 14:40:34 +00:00
commit ce038458dc
3 changed files with 11 additions and 24 deletions

View File

@ -36,18 +36,12 @@ import VDS
updateCheckbox() updateCheckbox()
//primary label //primary label
labelText = viewModel.label.text labelText = viewModel.label?.text
if let attributes = viewModel.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { labelTextAttributes = viewModel.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
labelTextAttributes = attributes
}
//secondary label //secondary label
if let subTitleModel = viewModel.subTitle { childText = viewModel.subTitle?.text
childText = subTitleModel.text childTextAttributes = viewModel.subTitle?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
if let attributes = subTitleModel.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
childTextAttributes = attributes
}
}
} }
private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {

View File

@ -17,14 +17,16 @@ import VDS
public var backgroundColor: Color? public var backgroundColor: Color?
public var checkbox: CheckboxModel public var checkbox: CheckboxModel
public var label: LabelModel public var label: LabelModel?
public var subTitle: LabelModel? public var subTitle: LabelModel?
public var inverted: Bool? = false public var inverted: Bool? = false
public var surface: Surface { inverted ?? false ? .dark : .light } public var surface: Surface { inverted ?? false ? .dark : .light }
public var children: [MoleculeModelProtocol] { public var children: [MoleculeModelProtocol] {
guard let subTitle else { return [checkbox, label] } var values: [MoleculeModelProtocol] = [checkbox]
return [checkbox, label, subTitle] if let label { values.append(label) }
if let subTitle { values.append(subTitle) }
return values
} }
//-------------------------------------------------- //--------------------------------------------------
@ -54,8 +56,8 @@ extension Array where Element == CheckboxLabelModel {
return compactMap({ model in return compactMap({ model in
var item = CheckboxGroup.CheckboxItemModel() var item = CheckboxGroup.CheckboxItemModel()
item.inputId = model.checkbox.fieldKey item.inputId = model.checkbox.fieldKey
item.labelText = model.label.text item.labelText = model.label?.text
if let attributes = model.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) { if let attributes = model.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
item.labelTextAttributes = attributes item.labelTextAttributes = attributes
} }
item.childText = model.subTitle?.text item.childText = model.subTitle?.text

View File

@ -26,8 +26,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
public var titleColor: TitleLockup.TitleTextColor = .primary public var titleColor: TitleLockup.TitleTextColor = .primary
public var subTitle: LabelModel? public var subTitle: LabelModel?
public var subTitleColor: TitleLockup.TextColor = .primary public var subTitleColor: TitleLockup.TextColor = .primary
public var alignment: VDS.TitleLockup.TextAlignment = .left
public var inverted: Bool = false public var inverted: Bool = false
public var backgroundColor: Color? public var backgroundColor: Color?
@ -49,7 +47,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
public func isEqual(to model: any ModelComparisonProtocol) -> Bool { public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false } guard let model = model as? Self else { return false }
return textAlignment == model.textAlignment return textAlignment == model.textAlignment
&& alignment == model.alignment
&& titleColor == model.titleColor && titleColor == model.titleColor
&& subTitleColor == model.subTitleColor && subTitleColor == model.subTitleColor
&& inverted == model.inverted && inverted == model.inverted
@ -83,7 +80,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
case subTitle case subTitle
case subTitleColor case subTitleColor
case inverted case inverted
case alignment
} }
//-------------------------------------------------- //--------------------------------------------------
@ -128,10 +124,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
subTitleColor = .primary subTitleColor = .primary
} }
if let newAlignment = try typeContainer.decodeIfPresent(VDS.TitleLockup.TextAlignment.self, forKey: .alignment) {
alignment = newAlignment
}
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) { if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
self.inverted = inverted self.inverted = inverted
} else { } else {
@ -151,7 +143,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
try container.encode(titleColor, forKey: .titleColor) try container.encode(titleColor, forKey: .titleColor)
try container.encodeIfPresent(subTitle, forKey: .subTitle) try container.encodeIfPresent(subTitle, forKey: .subTitle)
try container.encode(subTitleColor, forKey: .subTitleColor) try container.encode(subTitleColor, forKey: .subTitleColor)
try container.encode(alignment, forKey: .alignment)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)
} }