Compare commits

..

No commits in common. "develop" and "test" have entirely different histories.

154 changed files with 413 additions and 2193 deletions

View File

@ -307,9 +307,6 @@
AFA4932229E5EF2E001A9663 /* NotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */; }; AFA4932229E5EF2E001A9663 /* NotificationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */; };
AFA4933F29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */; }; AFA4933F29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */; };
AFA4935729EE3DCC001A9663 /* AlertDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4935629EE3DCC001A9663 /* AlertDelegateProtocol.swift */; }; AFA4935729EE3DCC001A9663 /* AlertDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA4935629EE3DCC001A9663 /* AlertDelegateProtocol.swift */; };
AFB6336E2C65166E00791221 /* GoneableProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFB6336D2C65166E00791221 /* GoneableProtocol.swift */; };
AFB633702C65175800791221 /* ActionUpdateVisibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFB6336F2C65175800791221 /* ActionUpdateVisibility.swift */; };
AFB633722C653C0900791221 /* ActionUpdateVisibilityModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFB633712C653C0900791221 /* ActionUpdateVisibilityModel.swift */; };
AFE4A1D627DFBB6F00C458D0 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */; }; AFE4A1D627DFBB6F00C458D0 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */; };
B4CC8FBD29DF34680005D28B /* Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4CC8FBC29DF34680005D28B /* Badge.swift */; }; B4CC8FBD29DF34680005D28B /* Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4CC8FBC29DF34680005D28B /* Badge.swift */; };
B4CC8FBF29DF34730005D28B /* BadgeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4CC8FBE29DF34730005D28B /* BadgeModel.swift */; }; B4CC8FBF29DF34730005D28B /* BadgeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4CC8FBE29DF34730005D28B /* BadgeModel.swift */; };
@ -594,18 +591,6 @@
EA6642932BCDA97D00D81DC4 /* TileContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6642922BCDA97D00D81DC4 /* TileContainerModel.swift */; }; EA6642932BCDA97D00D81DC4 /* TileContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6642922BCDA97D00D81DC4 /* TileContainerModel.swift */; };
EA6E8B952B504A43000139B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6E8B942B504A43000139B4 /* ButtonGroup.swift */; }; EA6E8B952B504A43000139B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6E8B942B504A43000139B4 /* ButtonGroup.swift */; };
EA6E8B972B504A4D000139B4 /* ButtonGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6E8B962B504A4D000139B4 /* ButtonGroupModel.swift */; }; EA6E8B972B504A4D000139B4 /* ButtonGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA6E8B962B504A4D000139B4 /* ButtonGroupModel.swift */; };
EA7AE5472C73C01A00107C74 /* CheckboxesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5462C73C01A00107C74 /* CheckboxesModel.swift */; };
EA7AE5492C7403DC00107C74 /* Checkboxes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5482C7403DC00107C74 /* Checkboxes.swift */; };
EA7AE54B2C74CACA00107C74 /* RadioButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE54A2C74CACA00107C74 /* RadioButtons.swift */; };
EA7AE54D2C74CAD700107C74 /* RadioButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE54C2C74CAD700107C74 /* RadioButtonsModel.swift */; };
EA7AE54F2C74EB3700107C74 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE54E2C74EB3700107C74 /* CalendarView.swift */; };
EA7AE5512C74EB4500107C74 /* CalendarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */; };
EA7AE5532C74F1F600107C74 /* DatePickerEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */; };
EA7AE5552C74F20600107C74 /* DatePickerEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */; };
EA7AE55C2C7D18A100107C74 /* BreadcrumbsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */; };
EA7AE55E2C7D234500107C74 /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */; };
EA7AE5602C7E554700107C74 /* PaginationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE55F2C7E554700107C74 /* PaginationModel.swift */; };
EA7AE5622C7E555D00107C74 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7AE5612C7E555D00107C74 /* Pagination.swift */; };
EA7D81602B2B6E6800D29F9E /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D815F2B2B6E6800D29F9E /* Icon.swift */; }; EA7D81602B2B6E6800D29F9E /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D815F2B2B6E6800D29F9E /* Icon.swift */; };
EA7D81622B2B6E7F00D29F9E /* IconModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81612B2B6E7F00D29F9E /* IconModel.swift */; }; EA7D81622B2B6E7F00D29F9E /* IconModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81612B2B6E7F00D29F9E /* IconModel.swift */; };
EA7D81642B2BABCB00D29F9E /* TooltipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */; }; EA7D81642B2BABCB00D29F9E /* TooltipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */; };
@ -946,9 +931,6 @@
AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHandler.swift; sourceTree = "<group>"; }; AFA4932129E5EF2E001A9663 /* NotificationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHandler.swift; sourceTree = "<group>"; };
AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingDelegateProtocol.swift; sourceTree = "<group>"; }; AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingDelegateProtocol.swift; sourceTree = "<group>"; };
AFA4935629EE3DCC001A9663 /* AlertDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDelegateProtocol.swift; sourceTree = "<group>"; }; AFA4935629EE3DCC001A9663 /* AlertDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDelegateProtocol.swift; sourceTree = "<group>"; };
AFB6336D2C65166E00791221 /* GoneableProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoneableProtocol.swift; sourceTree = "<group>"; };
AFB6336F2C65175800791221 /* ActionUpdateVisibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionUpdateVisibility.swift; sourceTree = "<group>"; };
AFB633712C653C0900791221 /* ActionUpdateVisibilityModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionUpdateVisibilityModel.swift; sourceTree = "<group>"; };
AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = "<group>"; }; AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = "<group>"; };
B4CC8FBC29DF34680005D28B /* Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Badge.swift; sourceTree = "<group>"; }; B4CC8FBC29DF34680005D28B /* Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Badge.swift; sourceTree = "<group>"; };
B4CC8FBE29DF34730005D28B /* BadgeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeModel.swift; sourceTree = "<group>"; }; B4CC8FBE29DF34730005D28B /* BadgeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeModel.swift; sourceTree = "<group>"; };
@ -1235,18 +1217,6 @@
EA6642922BCDA97D00D81DC4 /* TileContainerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainerModel.swift; sourceTree = "<group>"; }; EA6642922BCDA97D00D81DC4 /* TileContainerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainerModel.swift; sourceTree = "<group>"; };
EA6E8B942B504A43000139B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; }; EA6E8B942B504A43000139B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; };
EA6E8B962B504A4D000139B4 /* ButtonGroupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroupModel.swift; sourceTree = "<group>"; }; EA6E8B962B504A4D000139B4 /* ButtonGroupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroupModel.swift; sourceTree = "<group>"; };
EA7AE5462C73C01A00107C74 /* CheckboxesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxesModel.swift; sourceTree = "<group>"; };
EA7AE5482C7403DC00107C74 /* Checkboxes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkboxes.swift; sourceTree = "<group>"; };
EA7AE54A2C74CACA00107C74 /* RadioButtons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtons.swift; sourceTree = "<group>"; };
EA7AE54C2C74CAD700107C74 /* RadioButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonsModel.swift; sourceTree = "<group>"; };
EA7AE54E2C74EB3700107C74 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewModel.swift; sourceTree = "<group>"; };
EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryField.swift; sourceTree = "<group>"; };
EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePickerEntryFieldModel.swift; sourceTree = "<group>"; };
EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsModel.swift; sourceTree = "<group>"; };
EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = "<group>"; };
EA7AE55F2C7E554700107C74 /* PaginationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationModel.swift; sourceTree = "<group>"; };
EA7AE5612C7E555D00107C74 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
EA7D815F2B2B6E6800D29F9E /* Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; }; EA7D815F2B2B6E6800D29F9E /* Icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; };
EA7D81612B2B6E7F00D29F9E /* IconModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconModel.swift; sourceTree = "<group>"; }; EA7D81612B2B6E7F00D29F9E /* IconModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconModel.swift; sourceTree = "<group>"; };
EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipModel.swift; sourceTree = "<group>"; }; EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipModel.swift; sourceTree = "<group>"; };
@ -1317,7 +1287,6 @@
27F6B08B26052AFF008529AA /* ParentMoleculeModelProtocol.swift */, 27F6B08B26052AFF008529AA /* ParentMoleculeModelProtocol.swift */,
27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */, 27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */,
58E7561C2BE04C320088BB5D /* MoleculeComparisonProtocol.swift */, 58E7561C2BE04C320088BB5D /* MoleculeComparisonProtocol.swift */,
AFB6336D2C65166E00791221 /* GoneableProtocol.swift */,
); );
path = ModelProtocols; path = ModelProtocols;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1629,8 +1598,6 @@
AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */, AF1C33722885D481006B1001 /* MVMCoreUIActionOpenPageHandler.swift */,
AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */, AF60A7F52892D2E300919EEB /* ActionDismissNotificationModel.swift */,
AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */, AF60A7F72892D34D00919EEB /* ActionDismissNotificationHandler.swift */,
AFB633712C653C0900791221 /* ActionUpdateVisibilityModel.swift */,
AFB6336F2C65175800791221 /* ActionUpdateVisibility.swift */,
); );
path = Actions; path = Actions;
sourceTree = "<group>"; sourceTree = "<group>";
@ -2055,12 +2022,8 @@
BBAA4F00243D8E3B005AAD5F /* RadioBoxModel.swift */, BBAA4F00243D8E3B005AAD5F /* RadioBoxModel.swift */,
D264FAA6243FE13B00D98315 /* RadioBox.swift */, D264FAA6243FE13B00D98315 /* RadioBox.swift */,
0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */, 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */,
EA7AE54C2C74CAD700107C74 /* RadioButtonsModel.swift */,
EA7AE54A2C74CACA00107C74 /* RadioButtons.swift */,
011D95AE2407266E000E3791 /* RadioButtonModel.swift */, 011D95AE2407266E000E3791 /* RadioButtonModel.swift */,
01004F2F22721C3800991ECC /* RadioButton.swift */, 01004F2F22721C3800991ECC /* RadioButton.swift */,
EA7AE5462C73C01A00107C74 /* CheckboxesModel.swift */,
EA7AE5482C7403DC00107C74 /* Checkboxes.swift */,
31BE15CA23D8924C00452370 /* CheckboxModel.swift */, 31BE15CA23D8924C00452370 /* CheckboxModel.swift */,
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */, 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */,
AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */, AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */,
@ -2211,7 +2174,6 @@
D29DF10E21E67A77003B2FB9 /* Molecules */ = { D29DF10E21E67A77003B2FB9 /* Molecules */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EA7AE55A2C7D188900107C74 /* Breadcrumbs */,
D2EC7BD22527A1E400F540AF /* HeadersAndFooters */, D2EC7BD22527A1E400F540AF /* HeadersAndFooters */,
D2CAC7C9251104CB00C75681 /* TopNotification */, D2CAC7C9251104CB00C75681 /* TopNotification */,
D2509ED42472EE0B001BFB9D /* NavigationBar */, D2509ED42472EE0B001BFB9D /* NavigationBar */,
@ -2373,8 +2335,6 @@
D20492A524329CE200A5EED6 /* LoadImageView.swift */, D20492A524329CE200A5EED6 /* LoadImageView.swift */,
0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */, 0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */,
0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */, 0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */,
EA7AE55F2C7E554700107C74 /* PaginationModel.swift */,
EA7AE5612C7E555D00107C74 /* Pagination.swift */,
AA37CBD2251907200027344C /* StarsModel.swift */, AA37CBD2251907200027344C /* StarsModel.swift */,
AA37CBD42519072F0027344C /* Stars.swift */, AA37CBD42519072F0027344C /* Stars.swift */,
AA07EA902510A442009A2AE3 /* StarModel.swift */, AA07EA902510A442009A2AE3 /* StarModel.swift */,
@ -2393,8 +2353,6 @@
EA7D815F2B2B6E6800D29F9E /* Icon.swift */, EA7D815F2B2B6E6800D29F9E /* Icon.swift */,
EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */, EA7D81632B2BABCB00D29F9E /* TooltipModel.swift */,
EA7D81652B2BABD200D29F9E /* Tooltip.swift */, EA7D81652B2BABD200D29F9E /* Tooltip.swift */,
EA7AE5502C74EB4500107C74 /* CalendarViewModel.swift */,
EA7AE54E2C74EB3700107C74 /* CalendarView.swift */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
@ -2546,8 +2504,6 @@
D2BEFEF5248A954C00FAB3A9 /* FormFields */ = { D2BEFEF5248A954C00FAB3A9 /* FormFields */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EA7AE5542C74F20600107C74 /* DatePickerEntryFieldModel.swift */,
EA7AE5522C74F1F600107C74 /* DatePickerEntryField.swift */,
EA5DBDAA2C35B6C500290DF8 /* FormFieldModel.swift */, EA5DBDAA2C35B6C500290DF8 /* FormFieldModel.swift */,
D2BEFEF6248A957A00FAB3A9 /* Tags */, D2BEFEF6248A957A00FAB3A9 /* Tags */,
D29DF22B21E6A0FA003B2FB9 /* TextFields */, D29DF22B21E6A0FA003B2FB9 /* TextFields */,
@ -2652,15 +2608,6 @@
path = Alerts; path = Alerts;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
EA7AE55A2C7D188900107C74 /* Breadcrumbs */ = {
isa = PBXGroup;
children = (
EA7AE55B2C7D18A100107C74 /* BreadcrumbsModel.swift */,
EA7AE55D2C7D234500107C74 /* Breadcrumbs.swift */,
);
path = Breadcrumbs;
sourceTree = "<group>";
};
EAA0CFAD275E7D5A00D65EB0 /* FormFieldEffect */ = { EAA0CFAD275E7D5A00D65EB0 /* FormFieldEffect */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -2892,13 +2839,11 @@
AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */, AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */,
EAA482CE2B45F2F300978105 /* MFLoadingSpinner+VDS.swift in Sources */, EAA482CE2B45F2F300978105 /* MFLoadingSpinner+VDS.swift in Sources */,
D272F5F92473163100BD1A8F /* BarButtonItem.swift in Sources */, D272F5F92473163100BD1A8F /* BarButtonItem.swift in Sources */,
EA7AE54D2C74CAD700107C74 /* RadioButtonsModel.swift in Sources */,
D2D2FCF3252B72CF0033EAAA /* MoleculeSectionFooter.swift in Sources */, D2D2FCF3252B72CF0033EAAA /* MoleculeSectionFooter.swift in Sources */,
0A9D09202433796500D2E6C0 /* BarsIndicatorView.swift in Sources */, 0A9D09202433796500D2E6C0 /* BarsIndicatorView.swift in Sources */,
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */,
01004F3022721C3800991ECC /* RadioButton.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */,
D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */,
AFB633702C65175800791221 /* ActionUpdateVisibility.swift in Sources */,
D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */, D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */,
AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */, AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */,
D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */,
@ -2907,7 +2852,6 @@
EAB14BC127D935F00012AB2C /* RuleCompareModelProtocol.swift in Sources */, EAB14BC127D935F00012AB2C /* RuleCompareModelProtocol.swift in Sources */,
011D95A924057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift in Sources */, 011D95A924057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift in Sources */,
EA1B02DE2C41BFD200F0758B /* RuleVDSModel.swift in Sources */, EA1B02DE2C41BFD200F0758B /* RuleVDSModel.swift in Sources */,
EA7AE5532C74F1F600107C74 /* DatePickerEntryField.swift in Sources */,
EA985C892981AB7100F2FF2E /* VDS-TextStyle.swift in Sources */, EA985C892981AB7100F2FF2E /* VDS-TextStyle.swift in Sources */,
BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */, BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */,
D20C700B250BFDE40095B21C /* NotificationContainerView.swift in Sources */, D20C700B250BFDE40095B21C /* NotificationContainerView.swift in Sources */,
@ -2949,7 +2893,6 @@
D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */, D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */,
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */, 01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */, D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */,
AFB633722C653C0900791221 /* ActionUpdateVisibilityModel.swift in Sources */,
EA985C3E2970938F00F2FF2E /* Tilelet.swift in Sources */, EA985C3E2970938F00F2FF2E /* Tilelet.swift in Sources */,
D23A90002612347A007E14CE /* PageBehaviorContainerModelProtocol.swift in Sources */, D23A90002612347A007E14CE /* PageBehaviorContainerModelProtocol.swift in Sources */,
EAA78020290081320057DFDF /* VDSMoleculeViewProtocol.swift in Sources */, EAA78020290081320057DFDF /* VDSMoleculeViewProtocol.swift in Sources */,
@ -2963,7 +2906,6 @@
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */, D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */, D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */,
D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */, D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */,
EA7AE5602C7E554700107C74 /* PaginationModel.swift in Sources */,
608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */, 608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */,
014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */, 014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */,
0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */, 0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */,
@ -2989,10 +2931,8 @@
525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */, 525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */, D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */, D202AFE6242A6A9C00E5BEDF /* UICollectionViewScrollPosition+Extension.swift in Sources */,
EA7AE55C2C7D18A100107C74 /* BreadcrumbsModel.swift in Sources */,
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */, D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */,
AA37CBD3251907200027344C /* StarsModel.swift in Sources */, AA37CBD3251907200027344C /* StarsModel.swift in Sources */,
EA7AE5622C7E555D00107C74 /* Pagination.swift in Sources */,
8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */, 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */,
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */, D2CAC7CB251104E100C75681 /* NotificationXButtonModel.swift in Sources */,
@ -3019,7 +2959,6 @@
AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */, AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */,
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */, 944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
EA7AE55E2C7D234500107C74 /* Breadcrumbs.swift in Sources */,
D213347723843825008E41B3 /* Line.swift in Sources */, D213347723843825008E41B3 /* Line.swift in Sources */,
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */, D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */,
BB3BC1302550094500297977 /* ListLeftVariableIconWithRightCaretAllTextLinksModel.swift in Sources */, BB3BC1302550094500297977 /* ListLeftVariableIconWithRightCaretAllTextLinksModel.swift in Sources */,
@ -3158,9 +3097,7 @@
AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */, AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */,
AFA4935729EE3DCC001A9663 /* AlertDelegateProtocol.swift in Sources */, AFA4935729EE3DCC001A9663 /* AlertDelegateProtocol.swift in Sources */,
58A9DD7D2AC2103300F5E0B0 /* ReplaceableMoleculeBehaviorModel.swift in Sources */, 58A9DD7D2AC2103300F5E0B0 /* ReplaceableMoleculeBehaviorModel.swift in Sources */,
EA7AE54B2C74CACA00107C74 /* RadioButtons.swift in Sources */,
D264FAA3243E632F00D98315 /* ProgrammaticCollectionViewController.swift in Sources */, D264FAA3243E632F00D98315 /* ProgrammaticCollectionViewController.swift in Sources */,
EA7AE5552C74F20600107C74 /* DatePickerEntryFieldModel.swift in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
27F9736A246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift in Sources */, 27F9736A246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift in Sources */,
EA6E8B972B504A4D000139B4 /* ButtonGroupModel.swift in Sources */, EA6E8B972B504A4D000139B4 /* ButtonGroupModel.swift in Sources */,
@ -3239,7 +3176,6 @@
D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */,
0AE14F64238315D2005417F8 /* TextField.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */,
0A51F3E22475CB73002E08B6 /* LoadingSpinnerModel.swift in Sources */, 0A51F3E22475CB73002E08B6 /* LoadingSpinnerModel.swift in Sources */,
AFB6336E2C65166E00791221 /* GoneableProtocol.swift in Sources */,
D2169303251E53D9002A6324 /* SectionListTemplateModel.swift in Sources */, D2169303251E53D9002A6324 /* SectionListTemplateModel.swift in Sources */,
EA6642932BCDA97D00D81DC4 /* TileContainerModel.swift in Sources */, EA6642932BCDA97D00D81DC4 /* TileContainerModel.swift in Sources */,
AF7E509929E477C1009DC2AD /* AlertController.swift in Sources */, AF7E509929E477C1009DC2AD /* AlertController.swift in Sources */,
@ -3317,7 +3253,6 @@
01F2C20327C81F9700DC3D36 /* SubNavManagerNavigationController.swift in Sources */, 01F2C20327C81F9700DC3D36 /* SubNavManagerNavigationController.swift in Sources */,
EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */, EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */,
AA997252247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift in Sources */, AA997252247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift in Sources */,
EA7AE5492C7403DC00107C74 /* Checkboxes.swift in Sources */,
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */, D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */,
D23EA7FB2475F09800D60C34 /* CarouselItemProtocol.swift in Sources */, D23EA7FB2475F09800D60C34 /* CarouselItemProtocol.swift in Sources */,
D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */, D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */,
@ -3348,7 +3283,6 @@
BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */, BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */,
0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */, 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */,
D21B7F73243BAC6800051ABF /* CollectionItemModelProtocol.swift in Sources */, D21B7F73243BAC6800051ABF /* CollectionItemModelProtocol.swift in Sources */,
EA7AE5512C74EB4500107C74 /* CalendarViewModel.swift in Sources */,
AA104B1A24474A66004D2810 /* HeadersH2Buttons.swift in Sources */, AA104B1A24474A66004D2810 /* HeadersH2Buttons.swift in Sources */,
C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */, C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */,
D2D2FCF0252B72AF0033EAAA /* MoleculeSectionFooterModel.swift in Sources */, D2D2FCF0252B72AF0033EAAA /* MoleculeSectionFooterModel.swift in Sources */,
@ -3369,7 +3303,6 @@
D2D3957D252FDBCD00047B11 /* ModalSectionListTemplateModel.swift in Sources */, D2D3957D252FDBCD00047B11 /* ModalSectionListTemplateModel.swift in Sources */,
D2B9D0E4265EEE9D0084735C /* MoleculeListProtocol.swift in Sources */, D2B9D0E4265EEE9D0084735C /* MoleculeListProtocol.swift in Sources */,
D29C559625C099630082E7D6 /* VideoDataManager.swift in Sources */, D29C559625C099630082E7D6 /* VideoDataManager.swift in Sources */,
EA7AE5472C73C01A00107C74 /* CheckboxesModel.swift in Sources */,
8D4687E2242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift in Sources */, 8D4687E2242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift in Sources */,
D29E28DD23D7404C00ACEA85 /* ContainerHelper.swift in Sources */, D29E28DD23D7404C00ACEA85 /* ContainerHelper.swift in Sources */,
EA6642912BCDA97300D81DC4 /* TileContainer.swift in Sources */, EA6642912BCDA97300D81DC4 /* TileContainer.swift in Sources */,
@ -3410,7 +3343,6 @@
D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */, D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */,
0A6682AA2435125F00AD3CA1 /* Styler.swift in Sources */, 0A6682AA2435125F00AD3CA1 /* Styler.swift in Sources */,
D264FAA7243FE13B00D98315 /* RadioBox.swift in Sources */, D264FAA7243FE13B00D98315 /* RadioBox.swift in Sources */,
EA7AE54F2C74EB3700107C74 /* CalendarView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -3625,7 +3557,7 @@
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks"; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks";
INFOPLIST_FILE = MVMCoreUI/Info.plist; INFOPLIST_FILE = MVMCoreUI/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 15.0; IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@ -3655,7 +3587,7 @@
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks"; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../SharedFrameworks";
INFOPLIST_FILE = MVMCoreUI/Info.plist; INFOPLIST_FILE = MVMCoreUI/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 15.0; IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",

View File

@ -1,47 +0,0 @@
//
// ActionToggleGone.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 8/8/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import MVMCore
public struct ActionUpdateVisibility: MVMCoreActionHandlerProtocol {
public init() {}
public func execute(with model: any MVMCore.ActionModelProtocol, delegateObject: MVMCore.DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
guard let model = model as? ActionUpdateVisibilityModel,
let delegate = (delegateObject as? MVMCoreUIDelegateObject)?.moleculeDelegate else { return }
let stateMap = model.targets.reduce(into: [String: ActionUpdateVisibilityModel.VisibilityTarget.VisibilityState]()) {
$0[$1.id] = $1.state
}
let updatedModels: [MoleculeModelProtocol] = delegate.getRootMolecules().reduceDepthFirstTraverse(options: .parentFirst, depth: 0, initialResult: [], nextPartialResult: { accumulator, model, depth in
guard var model = model as? (GoneableProtocol & MoleculeModelProtocol),
let state = stateMap[model.id] else { return accumulator }
model.updateVisibility(state)
return accumulator + [model]
})
guard updatedModels.count > 0 else { return }
await delegate.updateUI(for: updatedModels)
}
}
extension GoneableProtocol {
mutating func updateVisibility(_ state: ActionUpdateVisibilityModel.VisibilityTarget.VisibilityState) {
switch state {
case .true:
gone = false
case .false:
gone = true
case .inverted:
gone = !gone
}
}
}

View File

@ -1,42 +0,0 @@
//
// ActionToggleGoneModel.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 8/8/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import MVMCore
public struct ActionUpdateVisibilityModel: ActionModelProtocol {
public static var identifier: String = "updateVisibility"
public var actionType: String = ActionUpdateVisibilityModel.identifier
public var extraParameters: JSONValueDictionary?
public var analyticsData: JSONValueDictionary?
public var targets: [VisibilityTarget]
public struct VisibilityTarget: Codable {
public enum VisibilityState: String, Codable {
case `true`
case `false`
case inverted
}
public var id: String
public var state: VisibilityState
public init(id: String, state: VisibilityState) {
self.id = id
self.state = state
}
}
public init(targets: [VisibilityTarget], extraParameters: JSONValueDictionary? = nil, analyticsData: JSONValueDictionary? = nil) {
self.targets = targets
self.extraParameters = extraParameters
self.analyticsData = analyticsData
}
}

View File

@ -39,9 +39,6 @@ open class ButtonGroup: VDS.ButtonGroup, VDSMoleculeViewProtocol {
} }
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
isEnabled = viewModel.enabled isEnabled = viewModel.enabled
alignment = viewModel.alignment alignment = viewModel.alignment

View File

@ -7,7 +7,6 @@
// //
import Foundation import Foundation
import MVMCore
import VDS import VDS
public class ButtonGroupModel: ParentMoleculeModelProtocol { public class ButtonGroupModel: ParentMoleculeModelProtocol {
@ -18,7 +17,6 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
public static var identifier: String = "buttonGroup" public static var identifier: String = "buttonGroup"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var children: [MoleculeModelProtocol] { buttons } public var children: [MoleculeModelProtocol] { buttons }
@ -40,7 +38,6 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case moleculeName case moleculeName
case accessibilityIdentifier
case backgroundColor case backgroundColor
case buttons case buttons
case alignment case alignment
@ -59,7 +56,6 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
surface = try typeContainer.decodeIfPresent(Surface.self, forKey: .surface) ?? .light surface = try typeContainer.decodeIfPresent(Surface.self, forKey: .surface) ?? .light
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
buttons = try typeContainer.decodeModels(codingKey: .buttons) buttons = try typeContainer.decodeModels(codingKey: .buttons)
@ -74,7 +70,6 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(surface, forKey: .surface) try container.encode(surface, forKey: .surface)
try container.encode(enabled, forKey: .enabled) try container.encode(enabled, forKey: .enabled)
try container.encodeModels(buttons, forKey: .buttons) try container.encodeModels(buttons, forKey: .buttons)

View File

@ -15,7 +15,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
public static var identifier: String = "imageButton" public static var identifier: String = "imageButton"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var image: ImageViewModel? public var image: ImageViewModel?
@ -46,7 +45,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case moleculeName case moleculeName
case accessibilityIdentifier
case image case image
case backgroundColor case backgroundColor
case accessibilityText case accessibilityText
@ -66,7 +64,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
@ -94,7 +91,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(image, forKey: .image) try container.encodeIfPresent(image, forKey: .image)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)

View File

@ -1,51 +0,0 @@
//
// DatePickerEntryField.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class DatePickerEntryField: VDS.DatePicker, VDSMoleculeViewProtocol {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var viewModel: DatePickerEntryFieldModel!
public var delegateObject: MVMCoreUIDelegateObject?
public var additionalData: [AnyHashable : Any]?
//--------------------------------------------------
// MARK: - Public Methods
//--------------------------------------------------
open override func setup() {
super.setup()
//turn off internal required rule
useRequiredRule = false
publisher(for: .valueChanged)
.sink { [weak self] control in
guard let self, let viewModel, isEnabled else { return }
viewModel.selectedDate = control.selectedDate
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
}.store(in: &subscribers)
}
public func viewModelDidUpdate() {
surface = viewModel.surface
labelText = viewModel.title
helperText = viewModel.feedback
helperTextPlacement = viewModel.feedbackTextPlacement
tooltipModel = viewModel.tooltip?.convertToVDSTooltipModel()
transparentBackground = viewModel.transparentBackground
width = viewModel.width
selectedDate = viewModel.selectedDate
calendarModel = viewModel.calendar.convertToVDSCalendarModel()
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
}
public func updateView(_ size: CGFloat) {}
}

View File

@ -1,121 +0,0 @@
//
// DatePickerEntryFieldModel.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class DatePickerEntryFieldModel: FormFieldModel {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public override static var identifier: String { "datePicker" }
public var dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeZone = NSTimeZone.system
formatter.locale = .current
formatter.formatterBehavior = .default
return formatter
}()
/// Update the property value to alter the format of how the date is presented.
public var dateFormat: String = "MMM d, y" {
didSet { dateFormatter.dateFormat = dateFormat }
}
public var selectedDate: Date?
public var calendar: CalendarViewModel = .init()
public var title: String?
public var feedback: String?
public var feedbackTextPlacement: VDS.DatePicker.HelperTextPlacement = .bottom
public var tooltip: TooltipModel?
public var transparentBackground: Bool = false
public var width: CGFloat?
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case dateFormat
case selectedDate
case calendar
case title
case feedback
case feedbackTextPlacement
case tooltip
case transparentBackground
case width
}
//--------------------------------------------------
// MARK: - Form Validation
//--------------------------------------------------
/// Returns the fieldValue of the selectedDate.
public override func formFieldValue() -> AnyHashable? {
guard let selectedDate, enabled else { return nil }
return dateFormatter.string(from: selectedDate)
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
if let dateFormat = try container.decodeIfPresent(String.self, forKey: .dateFormat) {
self.dateFormat = dateFormat
dateFormatter.dateFormat = dateFormat
}
if let date = try container.decodeIfPresent(String.self, forKey: .selectedDate) {
selectedDate = calendar.dateFormatter.date(from: date)
}
if let calendar = try container.decodeIfPresent(CalendarViewModel.self, forKey: .calendar) {
self.calendar = calendar
}
title = try container.decodeIfPresent(String.self, forKey: .title)
feedback = try container.decodeIfPresent(String.self, forKey: .feedback)
feedbackTextPlacement = try container.decodeIfPresent(VDS.EntryFieldBase.HelperTextPlacement.self, forKey: .feedbackTextPlacement) ?? .bottom
tooltip = try container.decodeIfPresent(TooltipModel.self, forKey: .tooltip)
transparentBackground = try container.decodeIfPresent(Bool.self, forKey: .transparentBackground) ?? false
width = try container.decodeIfPresent(CGFloat.self, forKey: .width)
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(selectedDate, forKey: .selectedDate)
try container.encode(calendar, forKey: .calendar)
try container.encodeIfPresent(title, forKey: .title)
try container.encodeIfPresent(feedback, forKey: .feedback)
try container.encode(feedbackTextPlacement, forKey: .feedbackTextPlacement)
try container.encodeIfPresent(tooltip, forKey: .tooltip)
try container.encode(transparentBackground, forKey: .transparentBackground)
try container.encodeIfPresent(width, forKey: .width)
}
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return dateFormat == model.dateFormat
&& selectedDate == model.selectedDate
&& calendar == model.calendar
&& title == model.title
&& feedback == model.feedback
&& feedbackTextPlacement == model.feedbackTextPlacement
&& tooltip == model.tooltip
&& transparentBackground == model.transparentBackground
&& width == model.width
}
}

View File

@ -15,8 +15,6 @@ import VDS
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public class var identifier: String { "" } public class var identifier: String { "" }
public var moleculeName: String { Self.identifier }
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var backgroundColor: Color? public var backgroundColor: Color?
@ -25,7 +23,7 @@ import VDS
public var enabled: Bool = true public var enabled: Bool = true
public var required: Bool = true public var required: Bool = true
public var readOnly: Bool = false public var readOnly: Bool = false
public var showError: Bool = false public var showError: Bool?
public var errorMessage: String? public var errorMessage: String?
public var initialErrorMessage: String? public var initialErrorMessage: String?
@ -68,7 +66,6 @@ import VDS
case moleculeName case moleculeName
case accessibilityIdentifier case accessibilityIdentifier
case errorMessage case errorMessage
case showError
case enabled case enabled
case readOnly case readOnly
case required case required
@ -110,7 +107,6 @@ import VDS
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier) accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage) errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage)
initialErrorMessage = errorMessage initialErrorMessage = errorMessage
showError = try typeContainer.decodeIfPresent(Bool.self, forKey: .showError) ?? false
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required) ?? true required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required) ?? true
readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false
@ -130,30 +126,9 @@ import VDS
try container.encodeIfPresent(errorMessage, forKey: .errorMessage) try container.encodeIfPresent(errorMessage, forKey: .errorMessage)
try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(groupName, forKey: .groupName)
try container.encode(showError, forKey: .showError)
try container.encode(readOnly, forKey: .readOnly) try container.encode(readOnly, forKey: .readOnly)
try container.encode(enabled, forKey: .enabled) try container.encode(enabled, forKey: .enabled)
try container.encode(required, forKey: .required) try container.encode(required, forKey: .required)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)
} }
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return moleculeName == model.moleculeName
&& enabled == model.enabled
&& showError == model.showError
&& errorMessage == model.errorMessage
&& readOnly == model.readOnly
&& required == model.required
&& inverted == model.inverted
&& fieldKey == model.fieldKey
&& groupName == model.groupName
&& accessibilityText == model.accessibilityText
&& accessibilityIdentifier == model.accessibilityIdentifier
&& accessibilityTraits == model.accessibilityTraits
}
}
extension FormFieldModel {
public var isEnabled: Bool { enabled && !readOnly }
} }

View File

@ -12,7 +12,6 @@ import MVMCore
@objcMembers public class TagModel: MoleculeModelProtocol { @objcMembers public class TagModel: MoleculeModelProtocol {
public static var identifier: String = "tag" public static var identifier: String = "tag"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var label: LabelModel public var label: LabelModel
public var action: ActionModelProtocol? public var action: ActionModelProtocol?
@ -20,7 +19,6 @@ import MVMCore
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case label case label
case action case action
@ -44,7 +42,6 @@ import MVMCore
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
label = try typeContainer.decode(LabelModel.self, forKey: .label) label = try typeContainer.decode(LabelModel.self, forKey: .label)
action = try typeContainer.decodeModelIfPresent(codingKey: .action) action = try typeContainer.decodeModelIfPresent(codingKey: .action)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
@ -53,7 +50,6 @@ import MVMCore
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(label, forKey: .label) try container.encode(label, forKey: .label)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)

View File

@ -12,14 +12,12 @@ import MVMCore
@objcMembers public class TagsModel: MoleculeModelProtocol { @objcMembers public class TagsModel: MoleculeModelProtocol {
public static var identifier: String = "tags" public static var identifier: String = "tags"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var tags: [TagModel] public var tags: [TagModel]
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case tags case tags
@ -36,7 +34,6 @@ import MVMCore
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
tags = try typeContainer.decode([TagModel].self, forKey: .tags) tags = try typeContainer.decode([TagModel].self, forKey: .tags)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
} }
@ -44,7 +41,6 @@ import MVMCore
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(tags, forKey: .tags) try container.encode(tags, forKey: .tags)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)

View File

@ -110,7 +110,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
publisher(for: .valueChanged) publisher(for: .valueChanged)
.sink { [weak self] control in .sink { [weak self] control in
guard let self, let selectedItem, let viewModel else { return } guard let self, let selectedItem else { return }
viewModel.selectedIndex = control.selectId viewModel.selectedIndex = control.selectId
observeDropdownSelection?(selectedItem.text) observeDropdownSelection?(selectedItem.text)
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
@ -130,7 +130,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
guard let self else { return } guard let self else { return }
isEditting = false isEditting = false
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
if let viewModel, let valid = viewModel.isValid { if let valid = viewModel.isValid {
updateValidation(valid) updateValidation(valid)
} }
performDropdownAction() performDropdownAction()
@ -146,7 +146,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
isEnabled = viewModel.enabled isEnabled = viewModel.enabled
isReadOnly = viewModel.readOnly isReadOnly = viewModel.readOnly
isRequired = viewModel.required isRequired = viewModel.required
tooltipModel = viewModel.tooltip?.convertToVDSTooltipModel() tooltipModel = viewModel.tooltip?.toVDSTooltipModel()
width = viewModel.width width = viewModel.width
transparentBackground = viewModel.transparentBackground transparentBackground = viewModel.transparentBackground
@ -207,7 +207,7 @@ open class ItemDropdownEntryField: VDS.DropdownSelect, VDSMoleculeViewProtocol,
if setInitialValueInTextField { if setInitialValueInTextField {
let pickerIndex = optionsPicker.selectedRow(inComponent: 0) let pickerIndex = optionsPicker.selectedRow(inComponent: 0)
viewModel?.selectedIndex = pickerIndex viewModel.selectedIndex = pickerIndex
selectId = pickerIndex selectId = pickerIndex
} }
} }

View File

@ -78,13 +78,4 @@ import VDS
try container.encode(feedbackTextPlacement, forKey: .feedbackTextPlacement) try container.encode(feedbackTextPlacement, forKey: .feedbackTextPlacement)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return options == model.options
&& selectedIndex == model.selectedIndex
&& showInlineLabel == model.showInlineLabel
&& feedbackTextPlacement == model.feedbackTextPlacement
&& action.isEqual(to: model.action)
}
} }

View File

@ -34,6 +34,7 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case backgroundColor
case title case title
case feedback case feedback
case errorTextColor case errorTextColor
@ -85,6 +86,7 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
try super.init(from: decoder) try super.init(from: decoder)
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title) title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback) feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
errorTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .errorTextColor) errorTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .errorTextColor)
@ -104,6 +106,7 @@ import Foundation
open override func encode(to encoder: Encoder) throws { open override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(title, forKey: .title) try container.encodeIfPresent(title, forKey: .title)
try container.encodeIfPresent(feedback, forKey: .feedback) try container.encodeIfPresent(feedback, forKey: .feedback)
try container.encodeIfPresent(text, forKey: .text) try container.encodeIfPresent(text, forKey: .text)
@ -113,16 +116,4 @@ import Foundation
try container.encode(hideBorders, forKey: .hideBorders) try container.encode(hideBorders, forKey: .hideBorders)
try container.encode(shouldMaskRecordedView, forKey: .shouldMaskRecordedView) try container.encode(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return selected == model.selected
&& title == model.title
&& feedback == model.feedback
&& errorTextColor == model.errorTextColor
&& locked == model.locked
&& hideBorders == model.hideBorders
&& text == model.text
&& shouldMaskRecordedView == model.shouldMaskRecordedView
}
} }

View File

@ -33,7 +33,7 @@ import VDS
private var isEditting: Bool = false { private var isEditting: Bool = false {
didSet { didSet {
viewModel?.selected = isEditting viewModel.selected = isEditting
} }
} }
@ -47,7 +47,7 @@ import VDS
open var validateWhenDoneEditing: Bool = true open var validateWhenDoneEditing: Bool = true
open var shouldMaskWhileRecording: Bool { open var shouldMaskWhileRecording: Bool {
return viewModel?.shouldMaskRecordedView ?? false return viewModel.shouldMaskRecordedView ?? false
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Computed Properties // MARK: - Computed Properties
@ -99,7 +99,7 @@ import VDS
publisher(for: .valueChanged) publisher(for: .valueChanged)
.sink { [weak self] control in .sink { [weak self] control in
guard let self, let viewModel else { return } guard let self else { return }
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
if (viewModel.type == .email) { if (viewModel.type == .email) {
// remove spaces (either user entered Or auto-correct suggestion) for the email field // remove spaces (either user entered Or auto-correct suggestion) for the email field
@ -112,7 +112,7 @@ import VDS
.sink { [weak self] textView in .sink { [weak self] textView in
guard let self else { return } guard let self else { return }
isEditting = true isEditting = true
if let viewModel, viewModel.clearTextOnTap { if viewModel.clearTextOnTap {
text = "" text = ""
} }
}.store(in: &subscribers) }.store(in: &subscribers)
@ -122,7 +122,7 @@ import VDS
.sink { [weak self] textView in .sink { [weak self] textView in
guard let self else { return } guard let self else { return }
isEditting = false isEditting = false
if let viewModel, validateWhenDoneEditing, let valid = viewModel.isValid { if validateWhenDoneEditing, let valid = viewModel.isValid {
updateValidation(valid) updateValidation(valid)
} }
regexTextFieldOutputIfAvailable() regexTextFieldOutputIfAvailable()
@ -173,7 +173,7 @@ import VDS
isEnabled = viewModel.enabled isEnabled = viewModel.enabled
isReadOnly = viewModel.readOnly isReadOnly = viewModel.readOnly
isRequired = viewModel.required isRequired = viewModel.required
tooltipModel = viewModel.tooltip?.convertToVDSTooltipModel() tooltipModel = viewModel.tooltip?.toVDSTooltipModel()
width = viewModel.width width = viewModel.width
transparentBackground = viewModel.transparentBackground transparentBackground = viewModel.transparentBackground

View File

@ -218,21 +218,4 @@ import VDS
try container.encode(transparentBackground, forKey: .transparentBackground) try container.encode(transparentBackground, forKey: .transparentBackground)
try container.encodeIfPresent(width, forKey: .width) try container.encodeIfPresent(width, forKey: .width)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return placeholder == model.placeholder
&& textAlignment == model.textAlignment
&& enabledTextColor == model.enabledTextColor
&& disabledTextColor == model.disabledTextColor
&& keyboardOverride == model.keyboardOverride
&& type == model.type
&& clearTextOnTap == model.clearTextOnTap
&& displayFormat == model.displayFormat
&& displayMask == model.displayMask
&& enableClipboardActions == model.enableClipboardActions
&& tooltip == model.tooltip
&& transparentBackground == model.transparentBackground
&& width == model.width
}
} }

View File

@ -29,7 +29,7 @@ open class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingT
private var isEditting: Bool = false { private var isEditting: Bool = false {
didSet { didSet {
viewModel?.selected = isEditting viewModel.selected = isEditting
} }
} }
@ -37,7 +37,7 @@ open class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingT
// MARK: - Computed Properties // MARK: - Computed Properties
//-------------------------------------------------- //--------------------------------------------------
open var shouldMaskWhileRecording: Bool { open var shouldMaskWhileRecording: Bool {
return viewModel?.shouldMaskRecordedView ?? false return viewModel.shouldMaskRecordedView ?? false
} }
/// Placeholder access for the textView. /// Placeholder access for the textView.
@ -91,7 +91,7 @@ open class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingT
publisher(for: .valueChanged) publisher(for: .valueChanged)
.sink { [weak self] control in .sink { [weak self] control in
guard let self, let viewModel else { return } guard let self else { return }
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
}.store(in: &subscribers) }.store(in: &subscribers)
@ -108,7 +108,7 @@ open class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingT
.sink { [weak self] textView in .sink { [weak self] textView in
guard let self else { return } guard let self else { return }
isEditting = false isEditting = false
if let viewModel, let valid = viewModel.isValid { if let valid = viewModel.isValid {
updateValidation(valid) updateValidation(valid)
} }
@ -126,7 +126,7 @@ open class TextViewEntryField: VDS.TextArea, VDSMoleculeViewProtocol, ObservingT
isEnabled = viewModel.enabled isEnabled = viewModel.enabled
isReadOnly = viewModel.readOnly isReadOnly = viewModel.readOnly
isRequired = viewModel.required isRequired = viewModel.required
tooltipModel = viewModel.tooltip?.convertToVDSTooltipModel() tooltipModel = viewModel.tooltip?.toVDSTooltipModel()
width = viewModel.width width = viewModel.width
transparentBackground = viewModel.transparentBackground transparentBackground = viewModel.transparentBackground

View File

@ -55,13 +55,4 @@ public class TextViewEntryFieldModel: TextEntryFieldModel {
try container.encode(minHeight, forKey: .minHeight) try container.encode(minHeight, forKey: .minHeight)
try container.encodeIfPresent(maxLength, forKey: .maxLength) try container.encodeIfPresent(maxLength, forKey: .maxLength)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return accessibilityText == model.accessibilityText
&& editable == model.editable
&& minHeight == model.minHeight
&& maxLength == model.maxLength
}
} }

View File

@ -123,9 +123,6 @@ import VDS
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
//forms //forms
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate) FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
groupName = viewModel.groupName groupName = viewModel.groupName
@ -134,7 +131,7 @@ import VDS
} }
//properties //properties
isEnabled = viewModel.isEnabled isEnabled = viewModel.enabled && !viewModel.readOnly
isAnimated = viewModel.animated isAnimated = viewModel.animated
//call super here to go around the didSet //call super here to go around the didSet
@ -145,7 +142,7 @@ import VDS
viewModel.updateUI = { viewModel.updateUI = {
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
guard let self = self else { return } guard let self = self else { return }
//let isValid = viewModel.isValid ?? true let isValid = viewModel.isValid ?? true
//TODO: Fix issue with default state //TODO: Fix issue with default state
//showError = !isValid //showError = !isValid
isEnabled = viewModel.enabled isEnabled = viewModel.enabled

View File

@ -94,12 +94,4 @@ import VDS
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeModelIfPresent(offAction, forKey: .offAction) try container.encodeModelIfPresent(offAction, forKey: .offAction)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return selected == model.selected
&& animated == model.animated
&& offAction.isEqual(to: model.offAction)
&& action.isEqual(to: model.action)
}
} }

View File

@ -1,58 +0,0 @@
//
// Checkboxes.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/19/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class Checkboxes: VDS.CheckboxGroup, VDSMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
open var viewModel: CheckboxesModel!
open var delegateObject: MVMCoreUIDelegateObject?
open var additionalData: [AnyHashable : Any]?
// Form Validation
var fieldKey: String?
var fieldValue: JSONValue?
var groupName: String?
/// The models for the molecules.
public var checkboxes: [CheckboxLabelModel]?
// MARK: - MoleculeViewProtocol
public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface
showError = viewModel.showError
isEnabled = viewModel.enabled && !viewModel.readOnly
checkboxes = viewModel.checkboxes
checkboxes?.forEach {
FormValidator.setupValidation(for: $0.checkbox, delegate: delegateObject?.formHolderDelegate)
}
selectorModels = viewModel.checkboxes.convertToVDSCheckboxItemModel(surface: surface,
delegateObject: delegateObject,
additionalData: additionalData)
}
open func updateView(_ size: CGFloat) {}
open override func didSelect(_ selectedControl: CheckboxItem) {
super.didSelect(selectedControl)
// since the checkboxes has the state being tracked, we need to update the values here.
if let index = items.firstIndex(where: {$0 === selectedControl}), let selected = checkboxes?[index] {
selected.checkbox.selected = true
}
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
}
}

View File

@ -1,101 +0,0 @@
//
// CheckboxesModel.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/19/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import MVMCore
import VDS
public class CheckboxesModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String { "checkboxes" }
public var id: String = UUID().uuidString
public var backgroundColor: Color?
public var accessibilityIdentifier: String?
public var enabled: Bool = true
public var required: Bool = true
public var readOnly: Bool = false
public var showError: Bool = false
public var inverted: Bool = false
public var surface: Surface { inverted ? .dark : .light }
public var checkboxes: [CheckboxLabelModel]
public var children: [any MoleculeModelProtocol] { checkboxes }
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case id
case moleculeName
case accessibilityIdentifier
case inverted
case enabled
case readOnly
case showError
case checkboxes
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(with checkboxes: [CheckboxLabelModel]){
self.checkboxes = checkboxes
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
showError = try typeContainer.decodeIfPresent(Bool.self, forKey: .showError) ?? false
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
self.inverted = inverted
}
checkboxes = try typeContainer.decode([CheckboxLabelModel].self, forKey: .checkboxes)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(readOnly, forKey: .readOnly)
try container.encode(enabled, forKey: .enabled)
try container.encode(inverted, forKey: .inverted)
try container.encode(checkboxes, forKey: .checkboxes)
}
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return moleculeName == model.moleculeName
&& enabled == model.enabled
&& showError == model.showError
&& readOnly == model.readOnly
&& required == model.required
&& inverted == model.inverted
&& accessibilityText == model.accessibilityText
&& accessibilityIdentifier == model.accessibilityIdentifier
&& accessibilityTraits == model.accessibilityTraits
}
}

View File

@ -28,9 +28,7 @@ import VDS
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
text = viewModel.text text = viewModel.text
subText = viewModel.subText subText = viewModel.subText
subTextRight = viewModel.subTextRight subTextRight = viewModel.subTextRight

View File

@ -8,33 +8,47 @@
import MVMCore import MVMCore
import VDS import VDS
public class RadioBoxModel: FormFieldModel { @objcMembers public class RadioBoxModel: MoleculeModelProtocol, EnableableModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public override static var identifier: String { "radioBox" } public static var identifier: String = "radioBox"
public var id: String = UUID().uuidString
public var text: String public var text: String
public var subText: String? public var subText: String?
public var subTextRight: String? public var subTextRight: String?
public var backgroundColor: Color?
public var accessibilityIdentifier: String?
public var selected: Bool = false public var selected: Bool = false
public var enabled: Bool = true
public var readOnly: Bool = false
public var strikethrough: Bool = false public var strikethrough: Bool = false
public var action: ActionModelProtocol?
public var fieldValue: String? public var fieldValue: String?
public var action: ActionModelProtocol?
public var inverted: Bool = false
public var surface: Surface { inverted ? .dark : .light }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id
case moleculeName
case text case text
case subText case subText
case subTextRight case subTextRight
case backgroundColor
case accessibilityIdentifier
case selected case selected
case enabled
case strikethrough case strikethrough
case action
case fieldValue case fieldValue
case action
case readOnly
case inverted
} }
//-------------------------------------------------- //--------------------------------------------------
@ -43,17 +57,6 @@ public class RadioBoxModel: FormFieldModel {
public init(text: String) { public init(text: String) {
self.text = text self.text = text
super.init()
}
//--------------------------------------------------
// MARK: - Form Validation
//--------------------------------------------------
/// Returns the fieldValue of the selected box, otherwise the text of the selected box.
public override func formFieldValue() -> AnyHashable? {
guard enabled else { return nil }
return fieldValue
} }
//-------------------------------------------------- //--------------------------------------------------
@ -63,42 +66,45 @@ public class RadioBoxModel: FormFieldModel {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
text = try typeContainer.decode(String.self, forKey: .text) text = try typeContainer.decode(String.self, forKey: .text)
subText = try typeContainer.decodeIfPresent(String.self, forKey: .subText) subText = try typeContainer.decodeIfPresent(String.self, forKey: .subText)
subTextRight = try typeContainer.decodeIfPresent(String.self, forKey: .subTextRight) subTextRight = try typeContainer.decodeIfPresent(String.self, forKey: .subTextRight)
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let isSelected = try typeContainer.decodeIfPresent(Bool.self, forKey: .selected) { if let isSelected = try typeContainer.decodeIfPresent(Bool.self, forKey: .selected) {
selected = isSelected selected = isSelected
} }
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false
if let isStrikeTrough = try typeContainer.decodeIfPresent(Bool.self, forKey: .strikethrough) { if let isStrikeTrough = try typeContainer.decodeIfPresent(Bool.self, forKey: .strikethrough) {
strikethrough = isStrikeTrough strikethrough = isStrikeTrough
} }
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
self.inverted = inverted
}
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue) fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
action = try typeContainer.decodeModelIfPresent(codingKey: .action) action = try typeContainer.decodeModelIfPresent(codingKey: .action)
try super.init(from: decoder)
} }
public override func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(text, forKey: .text) try container.encode(text, forKey: .text)
try container.encodeIfPresent(subText, forKey: .subText) try container.encodeIfPresent(subText, forKey: .subText)
try container.encodeIfPresent(subTextRight, forKey: .subTextRight) try container.encodeIfPresent(subTextRight, forKey: .subTextRight)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(selected, forKey: .selected) try container.encode(selected, forKey: .selected)
try container.encode(enabled, forKey: .enabled)
try container.encode(readOnly, forKey: .readOnly)
try container.encode(strikethrough, forKey: .strikethrough) try container.encode(strikethrough, forKey: .strikethrough)
try container.encodeIfPresent(fieldValue, forKey: .fieldValue)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
} try container.encode(inverted, forKey: .inverted)
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return text == model.text
&& subText == model.subText
&& subTextRight == model.subTextRight
&& selected == model.selected
&& strikethrough == model.strikethrough
&& fieldValue == model.fieldValue
&& action.isEqual(to: model.action)
} }
} }

View File

@ -9,6 +9,10 @@
import Foundation import Foundation
import VDS import VDS
public protocol RadioBoxSelectionDelegate: AnyObject {
func selected(radioBox: RadioBoxModel)
}
open class RadioBoxes: VDS.RadioBoxGroup, VDSMoleculeViewProtocol { open class RadioBoxes: VDS.RadioBoxGroup, VDSMoleculeViewProtocol {
//------------------------------------------------------ //------------------------------------------------------
@ -25,15 +29,13 @@ open class RadioBoxes: VDS.RadioBoxGroup, VDSMoleculeViewProtocol {
/// The models for the molecules. /// The models for the molecules.
public var boxes: [RadioBoxModel]? public var boxes: [RadioBoxModel]?
public weak var radioDelegate: RadioBoxSelectionDelegate?
// MARK: - MoleculeViewProtocol // MARK: - MoleculeViewProtocol
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
boxes = viewModel.boxes boxes = viewModel.boxes
surface = viewModel.surface surface = viewModel.surface
selectorModels = viewModel.boxes.convertToVDSRadioBoxModel(surface: surface) selectorModels = viewModel.selectorModels
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate) FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
} }
@ -48,8 +50,7 @@ open class RadioBoxes: VDS.RadioBoxGroup, VDSMoleculeViewProtocol {
boxes?.forEach { $0.selected = false } boxes?.forEach { $0.selected = false }
selectedBox.selected = true selectedBox.selected = true
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
radioDelegate?.selected(radioBox: selectedBox)
} }
} }
} }

View File

@ -8,8 +8,7 @@
import MVMCore import MVMCore
import VDS import VDS
public class RadioBoxesModel: FormFieldModel, ParentMoleculeModelProtocol { @objcMembers public class RadioBoxesModel: FormFieldModel {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
@ -18,8 +17,19 @@ public class RadioBoxesModel: FormFieldModel, ParentMoleculeModelProtocol {
public var boxes: [RadioBoxModel] public var boxes: [RadioBoxModel]
public var children: [any MoleculeModelProtocol] { boxes } public var selectorModels: [VDS.RadioBoxGroup.RadioBoxItemModel] {
boxes.compactMap({ item in
var radioBox = RadioBoxGroup.RadioBoxItemModel()
radioBox.text = item.text
radioBox.subText = item.subText
radioBox.subTextRight = item.subTextRight
radioBox.surface = surface
radioBox.selected = item.selected
radioBox.strikethrough = item.strikethrough
radioBox.disabled = !(item.enabled && !item.readOnly)
return radioBox
})
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Form Validation // MARK: - Form Validation
//-------------------------------------------------- //--------------------------------------------------
@ -30,7 +40,7 @@ public class RadioBoxesModel: FormFieldModel, ParentMoleculeModelProtocol {
let selectedBox = boxes.first { (box) -> Bool in let selectedBox = boxes.first { (box) -> Bool in
return box.selected return box.selected
} }
return selectedBox?.formFieldValue() ?? selectedBox?.text return selectedBox?.fieldValue ?? selectedBox?.text
} }
//-------------------------------------------------- //--------------------------------------------------
@ -73,19 +83,3 @@ public class RadioBoxesModel: FormFieldModel, ParentMoleculeModelProtocol {
try container.encode(boxes, forKey: .boxes) try container.encode(boxes, forKey: .boxes)
} }
} }
extension Array where Element == RadioBoxModel {
internal func convertToVDSRadioBoxModel(surface: Surface) -> [RadioBoxGroup.RadioBoxItemModel] {
compactMap({ item in
var radioBox = RadioBoxGroup.RadioBoxItemModel()
radioBox.text = item.text
radioBox.subText = item.subText
radioBox.subTextRight = item.subTextRight
radioBox.surface = surface
radioBox.selected = item.selected
radioBox.strikethrough = item.strikethrough
radioBox.enabled = item.isEnabled
return radioBox
})
}
}

View File

@ -79,11 +79,6 @@ import VDS
//-------------------------------------------------- //--------------------------------------------------
open override func setup() { open override func setup() {
super.setup() super.setup()
// Radio button should never be smaller that its content size.
setContentCompressionResistancePriority(.required, for: .vertical)
setContentCompressionResistancePriority(.required, for: .horizontal)
publisher(for: .valueChanged) publisher(for: .valueChanged)
.sink { [weak self] control in .sink { [weak self] control in
guard let self, isEnabled else { return } guard let self, isEnabled else { return }
@ -93,9 +88,7 @@ import VDS
} }
open func viewModelDidUpdate() { open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
//events //events
viewModel.updateUI = { viewModel.updateUI = {
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
@ -108,7 +101,7 @@ import VDS
} }
isSelected = viewModel.state isSelected = viewModel.state
isEnabled = viewModel.isEnabled isEnabled = viewModel.enabled && !viewModel.readOnly
RadioButtonSelectionHelper.setupForRadioButtonGroup(viewModel, self, delegateObject: delegateObject) RadioButtonSelectionHelper.setupForRadioButtonGroup(viewModel, self, delegateObject: delegateObject)
} }

View File

@ -83,11 +83,4 @@ open class RadioButtonModel: FormFieldModel {
try container.encodeIfPresent(fieldValue, forKey: .fieldValue) try container.encodeIfPresent(fieldValue, forKey: .fieldValue)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return state == model.state
&& fieldValue == model.fieldValue
&& action.isEqual(to: model.action)
}
} }

View File

@ -1,57 +0,0 @@
//
// RadioButtons.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class RadioButtons: VDS.RadioButtonGroup, VDSMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
open var viewModel: RadioButtonsModel!
open var delegateObject: MVMCoreUIDelegateObject?
open var additionalData: [AnyHashable : Any]?
// Form Validation
var fieldKey: String?
var fieldValue: JSONValue?
var groupName: String?
/// The models for the molecules.
public var radioButtons: [RadioButtonLabelModel]?
// MARK: - MoleculeViewProtocol
public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
showError = viewModel.showError
isEnabled = viewModel.isEnabled
surface = viewModel.surface
radioButtons = viewModel.radioButtons
selectorModels = viewModel.radioButtons.convertToVDSRadioButtonItemModel(surface: surface,
delegateObject: delegateObject,
additionalData: additionalData)
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
}
open func updateView(_ size: CGFloat) {}
open override func didSelect(_ selectedControl: RadioButtonItem) {
super.didSelect(selectedControl)
// since the radiobutton has the state being tracked, we need to update the values here.
if let index = items.firstIndex(where: {$0 === selectedControl}), let selected = radioButtons?[index] {
radioButtons?.forEach { $0.radioButton.state = false }
selected.radioButton.state = true
}
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
}
}

View File

@ -1,74 +0,0 @@
//
// RadioButtonsModel.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import MVMCore
import VDS
public class RadioButtonsModel: FormFieldModel, ParentMoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public override static var identifier: String { "radioButtons" }
public var radioButtons: [RadioButtonLabelModel]
public var children: [any MoleculeModelProtocol] { radioButtons }
//--------------------------------------------------
// MARK: - Form Validation
//--------------------------------------------------
/// Returns the fieldValue of the selected RadioButton.
public override func formFieldValue() -> AnyHashable? {
guard enabled else { return nil }
let selected = radioButtons.first { $0.radioButton.state }
return selected?.radioButton.formFieldValue()
}
//--------------------------------------------------
// MARK: - Server Value
//--------------------------------------------------
open override func formFieldServerValue() -> AnyHashable? {
return formFieldValue()
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case radioButtons
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(with radioButtons: [RadioButtonLabelModel]){
self.radioButtons = radioButtons
super.init()
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
radioButtons = try typeContainer.decode([RadioButtonLabelModel].self, forKey: .radioButtons)
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(radioButtons, forKey: .radioButtons)
}
}

View File

@ -103,15 +103,12 @@ public typealias ActionBlockConfirmation = () -> (Bool)
} }
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate) FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
isOn = viewModel.selected isOn = viewModel.selected
surface = viewModel.surface surface = viewModel.surface
isAnimated = viewModel.animated isAnimated = viewModel.animated
isEnabled = viewModel.isEnabled isEnabled = viewModel.enabled && !viewModel.readOnly
showText = viewModel.showText showText = viewModel.showText
if let onText = viewModel.onText { if let onText = viewModel.onText {
self.onText = onText self.onText = onText

View File

@ -7,18 +7,26 @@
// //
import VDS import VDS
public class ToggleModel: FormFieldModel { public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public override static var identifier: String { "toggle" } public static var identifier: String = "toggle"
public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color?
public var selected: Bool = false public var selected: Bool = false
public var animated: Bool = true public var animated: Bool = true
public var enabled: Bool = true
public var readOnly: Bool = false
public var action: ActionModelProtocol? public var action: ActionModelProtocol?
public var alternateAction: ActionModelProtocol? public var alternateAction: ActionModelProtocol?
public var accessibilityText: String? public var accessibilityText: String?
public var surface: Surface { inverted ? .dark : .light }
public var inverted: Bool = false
public var showText: Bool = false public var showText: Bool = false
public var onText: String? public var onText: String?
public var offText: String? public var offText: String?
@ -26,41 +34,61 @@ public class ToggleModel: FormFieldModel {
public var textWeight: VDS.Toggle.TextWeight = .regular public var textWeight: VDS.Toggle.TextWeight = .regular
public var textPosition: VDS.Toggle.TextPosition = .left public var textPosition: VDS.Toggle.TextPosition = .left
public var fieldKey: String?
public var groupName: String = FormValidator.defaultGroupName
public var baseValue: AnyHashable?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id
case moleculeName
case state case state
case animated case animated
case enabled
case readOnly
case action case action
case backgroundColor
case accessibilityIdentifier
case alternateAction case alternateAction
case accessibilityText case accessibilityText
case inverted
case showText case showText
case onText case onText
case offText case offText
case textSize case textSize
case textWeight case textWeight
case textPosition case textPosition
case fieldKey
case groupName
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Form Valdiation // MARK: - Form Valdiation
//-------------------------------------------------- //--------------------------------------------------
public override func formFieldValue() -> AnyHashable? { public func formFieldValue() -> AnyHashable? {
guard enabled else { return nil } guard enabled else { return nil }
return selected return selected
} }
//--------------------------------------------------
// MARK: - Server Value
//--------------------------------------------------
open func formFieldServerValue() -> AnyHashable? {
return formFieldValue()
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializer // MARK: - Initializer
//-------------------------------------------------- //--------------------------------------------------
public init(_ state: Bool, id: String = UUID().uuidString) { public init(_ state: Bool, id: String = UUID().uuidString) {
selected = state self.selected = state
super.init()
baseValue = state baseValue = state
self.id = id self.id = id
} }
@ -72,6 +100,8 @@ public class ToggleModel: FormFieldModel {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) { if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
self.selected = state self.selected = state
} }
@ -82,28 +112,44 @@ public class ToggleModel: FormFieldModel {
action = try typeContainer.decodeModelIfPresent(codingKey: .action) action = try typeContainer.decodeModelIfPresent(codingKey: .action)
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction) alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction)
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
baseValue = selected
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) {
self.groupName = groupName
}
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
readOnly = try typeContainer.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false
inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
showText = try typeContainer.decodeIfPresent(Bool.self, forKey: .showText) ?? false showText = try typeContainer.decodeIfPresent(Bool.self, forKey: .showText) ?? false
onText = try typeContainer.decodeIfPresent(String.self, forKey: .onText) onText = try typeContainer.decodeIfPresent(String.self, forKey: .onText)
offText = try typeContainer.decodeIfPresent(String.self, forKey: .offText) offText = try typeContainer.decodeIfPresent(String.self, forKey: .offText)
textSize = try typeContainer.decodeIfPresent(VDS.Toggle.TextSize.self, forKey: .textSize) ?? .small textSize = try typeContainer.decodeIfPresent(VDS.Toggle.TextSize.self, forKey: .textSize) ?? .small
textWeight = try typeContainer.decodeIfPresent(VDS.Toggle.TextWeight.self, forKey: .textWeight) ?? .regular textWeight = try typeContainer.decodeIfPresent(VDS.Toggle.TextWeight.self, forKey: .textWeight) ?? .regular
textPosition = try typeContainer.decodeIfPresent(VDS.Toggle.TextPosition.self, forKey: .textPosition) ?? .left textPosition = try typeContainer.decodeIfPresent(VDS.Toggle.TextPosition.self, forKey: .textPosition) ?? .left
try super.init(from: decoder)
baseValue = selected
} }
public override func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction) try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(selected, forKey: .state) try container.encode(selected, forKey: .state)
try container.encode(animated, forKey: .animated) try container.encode(animated, forKey: .animated)
try container.encode(enabled, forKey: .enabled)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
try container.encodeIfPresent(groupName, forKey: .groupName)
try container.encode(readOnly, forKey: .readOnly)
try container.encode(inverted, forKey: .inverted)
try container.encode(showText, forKey: .showText) try container.encode(showText, forKey: .showText)
try container.encodeIfPresent(onText, forKey: .onText) try container.encodeIfPresent(onText, forKey: .onText)
try container.encodeIfPresent(offText, forKey: .offText) try container.encodeIfPresent(offText, forKey: .offText)
@ -111,19 +157,4 @@ public class ToggleModel: FormFieldModel {
try container.encode(textWeight, forKey: .textWeight) try container.encode(textWeight, forKey: .textWeight)
try container.encode(textPosition, forKey: .textPosition) try container.encode(textPosition, forKey: .textPosition)
} }
open override func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard super.isEqual(to: model), let model = model as? Self else { return false }
return selected == model.selected
&& animated == model.animated
&& action.isEqual(to: model.action)
&& alternateAction.isEqual(to: model.alternateAction)
&& accessibilityText == model.accessibilityText
&& showText == model.showText
&& onText == model.onText
&& offText == model.offText
&& textSize == model.textSize
&& textWeight == model.textWeight
&& textPosition == model.textPosition
}
} }

View File

@ -19,7 +19,6 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
} }
public var moleculeName: String? public var moleculeName: String?
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3) public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
@ -60,7 +59,6 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case disabledColor case disabledColor
@ -81,7 +79,6 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) { if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
self.disabledColor = disabledColor self.disabledColor = disabledColor
@ -119,7 +116,6 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(disabledColor, forKey: .disabledColor) try container.encode(disabledColor, forKey: .disabledColor)

View File

@ -27,14 +27,10 @@ open class Badge: VDS.Badge, VDSMoleculeViewProtocol {
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
text = viewModel.text text = viewModel.text
textColor = viewModel.textColorStyle
maxWidth = viewModel.maxWidth maxWidth = viewModel.maxWidth
numberOfLines = viewModel.numberOfLines numberOfLines = viewModel.numberOfLines
fillColor = viewModel.fillColorStyle fillColor = viewModel.fillColor
surface = viewModel.surface surface = viewModel.surface
} }

View File

@ -25,9 +25,6 @@ open class BadgeIndicator: VDS.BadgeIndicator, VDSMoleculeViewProtocol {
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
number = viewModel.number number = viewModel.number
fillColor = viewModel.fillColor fillColor = viewModel.fillColor

View File

@ -17,7 +17,6 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
public static var identifier: String { "badgeIndicator" } public static var identifier: String { "badgeIndicator" }
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var backgroundColor: Color? public var backgroundColor: Color?
public var accessibilityIdentifier: String?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - VDS Properties // MARK: - VDS Properties
@ -44,7 +43,6 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case inverted case inverted
case accessibilityText case accessibilityText
case number case number
@ -69,7 +67,6 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
self.init() self.init()
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
number = try container.decodeIfPresent(Int.self, forKey: .number) number = try container.decodeIfPresent(Int.self, forKey: .number)
@ -94,7 +91,6 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
try container.encodeIfPresent(number, forKey: .number) try container.encodeIfPresent(number, forKey: .number)
try container.encodeIfPresent(fillColor, forKey: .fillColor) try container.encodeIfPresent(fillColor, forKey: .fillColor)

View File

@ -16,46 +16,28 @@ open class BadgeModel: MoleculeModelProtocol {
public static var identifier: String = "badge" public static var identifier: String = "badge"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var backgroundColor: Color? public var backgroundColor: Color?
public var accessibilityIdentifier: String?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - VDS Properties // MARK: - VDS Properties
//-------------------------------------------------- //--------------------------------------------------
public var text: String = "" public var text: String = ""
public var textColorStyle: Badge.TextColor? = nil
public var accessibilityText: String? public var accessibilityText: String?
public var maxWidth: CGFloat? public var maxWidth: CGFloat?
public var numberOfLines: Int = 1 public var numberOfLines: Int = 1
public var fillColorStyle = Badge.FillColor.red public var fillColor = Badge.FillColor.red
public var surface: Surface = .light public var surface: Surface = .light
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id, accessibilityIdentifier, accessibilityText case id, text, accessibilityText, fillColor, surface, numberOfLines, maxWidth
case surface, numberOfLines, maxWidth
case text, textColor
case fillColor, fillColorStyle
} }
required public convenience init(from decoder: Decoder) throws { required public convenience init(from decoder: Decoder) throws {
self.init() self.init()
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
text = try container.decode(String.self, forKey: .text) text = try container.decode(String.self, forKey: .text)
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
fillColor = try container.decodeIfPresent(Badge.FillColor.self, forKey: .fillColor) ?? .red
//look for a textColor
if let textColor = try container.decodeIfPresent(Color.self, forKey: .textColor) {
textColorStyle = .custom(textColor.uiColor)
}
//look for a style
fillColorStyle = try container.decodeIfPresent(Badge.FillColor.self, forKey: .fillColorStyle) ?? .red
//look for a color and set the style
if let fillColor = try container.decodeIfPresent(Color.self, forKey: .fillColor) {
fillColorStyle = .custom(fillColor.uiColor)
}
surface = try container.decodeIfPresent(Surface.self, forKey: .surface) ?? .light surface = try container.decodeIfPresent(Surface.self, forKey: .surface) ?? .light
numberOfLines = try container.decodeIfPresent(Int.self, forKey: .numberOfLines) ?? 1 numberOfLines = try container.decodeIfPresent(Int.self, forKey: .numberOfLines) ?? 1
maxWidth = try container.decodeIfPresent(CGFloat.self, forKey: .maxWidth) maxWidth = try container.decodeIfPresent(CGFloat.self, forKey: .maxWidth)
@ -66,24 +48,16 @@ open class BadgeModel: MoleculeModelProtocol {
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(text, forKey: .text) try container.encode(text, forKey: .text)
try container.encode(accessibilityText, forKey: .accessibilityText) try container.encode(accessibilityText, forKey: .accessibilityText)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier) try container.encode(fillColor, forKey: .fillColor)
try container.encode(surface, forKey: .surface) try container.encode(surface, forKey: .surface)
try container.encode(numberOfLines, forKey: .numberOfLines) try container.encode(numberOfLines, forKey: .numberOfLines)
try container.encodeIfPresent(maxWidth, forKey: .maxWidth) try container.encodeIfPresent(maxWidth, forKey: .maxWidth)
try container.encode(fillColorStyle, forKey: .fillColorStyle)
switch textColorStyle {
case .custom(let color):
try container.encode(Color(uiColor: color), forKey: .textColor)
default:
break
}
} }
public func isEqual(to model: any ModelComparisonProtocol) -> Bool { public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? BadgeModel else { return false } guard let model = model as? BadgeModel else { return false }
return self.backgroundColor == model.backgroundColor return self.backgroundColor == model.backgroundColor
&& self.fillColorStyle == model.fillColorStyle && self.fillColor == model.fillColor
&& self.textColorStyle == model.textColorStyle
&& self.numberOfLines == model.numberOfLines && self.numberOfLines == model.numberOfLines
&& self.text == model.text && self.text == model.text
&& self.surface == model.surface && self.surface == model.surface

View File

@ -25,9 +25,6 @@ open class ButtonIcon: VDS.ButtonIcon, VDSMoleculeViewProtocol {
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
onClick = { [weak self] control in onClick = { [weak self] control in

View File

@ -16,7 +16,6 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
public static var identifier: String = "buttonIcon" public static var identifier: String = "buttonIcon"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var backgroundColor: Color? public var backgroundColor: Color?
public var accessibilityIdentifier: String?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - VDS Properties // MARK: - VDS Properties
@ -78,7 +77,6 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case inverted case inverted
case accessibilityText case accessibilityText
case action case action
@ -107,7 +105,6 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
action = try container.decodeModel(codingKey: .action) action = try container.decodeModel(codingKey: .action)
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
badgeIndicator = try container.decodeIfPresent(BadgeIndicatorModel.self, forKey: .badgeIndicator) badgeIndicator = try container.decodeIfPresent(BadgeIndicatorModel.self, forKey: .badgeIndicator)
@ -131,7 +128,6 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
try container.encodeIfPresent(badgeIndicator, forKey: .badgeIndicator) try container.encodeIfPresent(badgeIndicator, forKey: .badgeIndicator)

View File

@ -1,12 +0,0 @@
//
// Calendar.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class CalendarView: VDS.CalendarBase, VDSMoleculeViewProtocol

View File

@ -1,65 +0,0 @@
//
// Calendar.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class CalendarView: VDS.CalendarBase, VDSMoleculeViewProtocol {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var viewModel: CalendarViewModel!
public var delegateObject: MVMCoreUIDelegateObject?
public var additionalData: [AnyHashable : Any]?
//--------------------------------------------------
// MARK: - Public Methods
//--------------------------------------------------
public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
if let _selectedDate = viewModel.selectedDate {
selectedDate = _selectedDate
}
if let _activeDates = viewModel.activeDates {
activeDates = _activeDates
}
if let _hideContainerBorder = viewModel.hideContainerBorder {
hideContainerBorder = _hideContainerBorder
}
if let _hideCurrentDateIndicator = viewModel.hideCurrentDateIndicator {
hideCurrentDateIndicator = _hideCurrentDateIndicator
}
if let _inactiveDates = viewModel.inactiveDates {
inactiveDates = _inactiveDates
}
if let _indicators = viewModel.indicators {
indicators = _indicators
}
if let _maxDate = viewModel.maxDate {
maxDate = _maxDate
}
if let _minDate = viewModel.minDate {
minDate = _minDate
}
surface = viewModel.surface
}
public func updateView(_ size: CGFloat) {}
}

View File

@ -1,159 +0,0 @@
//
// CalendarModel.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/20/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
open class CalendarViewModel: MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "calendar"
public var id: String = UUID().uuidString
public var backgroundColor: Color?
public var accessibilityIdentifier: String?
public var dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeZone = NSTimeZone.system
formatter.locale = .current
formatter.formatterBehavior = .default
return formatter
}()
/// Update the property value to alter the format of how the date is presented.
public var dateFormat: String = "MMM d, y" {
didSet { dateFormatter.dateFormat = dateFormat }
}
public var hideContainerBorder: Bool?
public var hideCurrentDateIndicator: Bool?
public var activeDates: [Date]?
public var inactiveDates: [Date]?
public var selectedDate: Date?
public var minDate: Date?
public var maxDate: Date?
public var indicators: [CalendarBase.CalendarIndicatorModel]?
//--------------------------------------------------
// MARK: - VDS Properties
//--------------------------------------------------
public var surface: Surface { inverted ? .dark : .light }
public var inverted: Bool = false
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case id
case accessibilityIdentifier
case moleculeName
case inverted
case dateFormat
case hideContainerBorder
case hideCurrentDateIndicator
case activeDates
case inactiveDates
case selectedDate
case minDate
case maxDate
case indicators
}
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public init() {}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
hideContainerBorder = try container.decodeIfPresent(Bool.self, forKey: .hideContainerBorder)
hideCurrentDateIndicator = try container.decodeIfPresent(Bool.self, forKey: .hideCurrentDateIndicator)
if let dateFormat = try container.decodeIfPresent(String.self, forKey: .dateFormat) {
self.dateFormat = dateFormat
dateFormatter.dateFormat = dateFormat
}
if let dates = try container.decodeIfPresent([String].self, forKey: .activeDates) {
activeDates = dates.compactMap { dateFormatter.date(from: $0) }
}
if let dates = try container.decodeIfPresent([String].self, forKey: .inactiveDates) {
inactiveDates = dates.compactMap { dateFormatter.date(from: $0) }
}
if let date = try container.decodeIfPresent(String.self, forKey: .selectedDate) {
selectedDate = dateFormatter.date(from: date)
}
if let date = try container.decodeIfPresent(String.self, forKey: .minDate) {
minDate = dateFormatter.date(from: date)
}
if let date = try container.decodeIfPresent(String.self, forKey: .maxDate) {
maxDate = dateFormatter.date(from: date)
}
indicators = try container.decodeIfPresent([CalendarBase.CalendarIndicatorModel].self, forKey: .indicators)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(inverted, forKey: .inverted)
try container.encode(dateFormat, forKey: .dateFormat)
try container.encode(hideContainerBorder, forKey: .hideContainerBorder)
try container.encode(hideCurrentDateIndicator, forKey: .hideCurrentDateIndicator)
try container.encode(activeDates, forKey: .activeDates)
try container.encode(selectedDate, forKey: .selectedDate)
try container.encode(minDate, forKey: .minDate)
try container.encode(maxDate, forKey: .maxDate)
try container.encode(indicators, forKey: .indicators)
}
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return inverted == model.inverted
&& dateFormat == model.dateFormat
&& hideContainerBorder == model.hideContainerBorder
&& hideCurrentDateIndicator == model.hideCurrentDateIndicator
&& activeDates == model.activeDates
&& inactiveDates == model.inactiveDates
&& selectedDate == model.selectedDate
&& minDate == model.minDate
&& maxDate == model.maxDate
&& indicators == model.indicators
}
}
extension CalendarViewModel {
public func convertToVDSCalendarModel() -> DatePicker.CalendarModel {
let defaults = DatePicker.CalendarModel()
return .init(hideContainerBorder: hideContainerBorder ?? defaults.hideContainerBorder ,
hideCurrentDateIndicator: hideCurrentDateIndicator ?? defaults.hideCurrentDateIndicator,
activeDates: activeDates ?? defaults.activeDates,
inactiveDates: inactiveDates ?? defaults.inactiveDates,
selectedDate: selectedDate ?? defaults.selectedDate,
minDate: minDate ?? defaults.minDate,
maxDate: maxDate ?? defaults.maxDate,
indicators: indicators ?? defaults.indicators)
}
}

View File

@ -16,7 +16,6 @@ import MVMCore
public static var identifier: String = "caretView" public static var identifier: String = "caretView"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var strokeColor: Color = Color(uiColor: .mvmBlack) public var strokeColor: Color = Color(uiColor: .mvmBlack)
public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite) public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite)
@ -31,7 +30,6 @@ import MVMCore
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case strokeColor case strokeColor
@ -56,7 +54,6 @@ import MVMCore
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) { if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) {
self.strokeColor = strokeColor self.strokeColor = strokeColor
@ -87,7 +84,6 @@ import MVMCore
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(strokeColor, forKey: .strokeColor) try container.encode(strokeColor, forKey: .strokeColor)
try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted) try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)

View File

@ -19,7 +19,6 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
} }
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String? public var moleculeName: String?
@ -49,7 +48,6 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case currentIndex case currentIndex
@ -72,7 +70,6 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
@ -121,7 +118,6 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(currentIndex, forKey: .currentIndex) try container.encode(currentIndex, forKey: .currentIndex)
try container.encode(alwaysSendAction, forKey: .alwaysSendAction) try container.encode(alwaysSendAction, forKey: .alwaysSendAction)

View File

@ -31,20 +31,23 @@ import VDS
// MARK: - Atomic // MARK: - Atomic
//-------------------------------------------------- //--------------------------------------------------
open func viewModelDidUpdate() { open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
updateCheckbox() updateCheckbox()
//primary label //primary label
labelText = viewModel.label?.text labelText = viewModel.label.text
labelTextAttributes = viewModel.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) if let attributes = viewModel.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
labelTextAttributes = attributes
}
//secondary label //secondary label
childText = viewModel.subTitle?.text if let subTitleModel = viewModel.subTitle {
childTextAttributes = viewModel.subTitle?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) childText = subTitleModel.text
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]?) {
@ -61,7 +64,7 @@ import VDS
//properties //properties
isAnimated = viewModel.checkbox.animated isAnimated = viewModel.checkbox.animated
isEnabled = viewModel.checkbox.isEnabled isEnabled = viewModel.checkbox.enabled && !viewModel.checkbox.readOnly
//call super here to go around the didSet //call super here to go around the didSet
//in this class //in this class
@ -71,11 +74,11 @@ import VDS
viewModel.checkbox.updateUI = { viewModel.checkbox.updateUI = {
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
guard let self = self else { return } guard let self = self else { return }
//let isValid = viewModel.checkbox.isValid ?? true let isValid = viewModel.checkbox.isValid ?? true
//TODO: Fix issue with default state //TODO: Fix issue with default state
//showError = !isValid //showError = !isValid
errorText = viewModel.checkbox.errorMessage errorText = viewModel.checkbox.errorMessage
isEnabled = viewModel.checkbox.isEnabled isEnabled = viewModel.checkbox.enabled
}) })
} }

View File

@ -14,20 +14,17 @@ import VDS
open class var identifier: String { "checkboxLabel" } open class var identifier: String { "checkboxLabel" }
public var moleculeName: String = CheckboxLabelModel.identifier public var moleculeName: String = CheckboxLabelModel.identifier
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
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] {
var values: [MoleculeModelProtocol] = [checkbox] guard let subTitle else { return [checkbox, label] }
if let label { values.append(label) } return [checkbox, label, subTitle]
if let subTitle { values.append(subTitle) }
return values
} }
//-------------------------------------------------- //--------------------------------------------------
@ -40,35 +37,4 @@ import VDS
self.subTitle = subTitle self.subTitle = subTitle
} }
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return moleculeName == model.moleculeName
&& inverted == model.inverted
&& accessibilityText == model.accessibilityText
&& accessibilityIdentifier == model.accessibilityIdentifier
&& accessibilityTraits == model.accessibilityTraits
}
}
extension Array where Element == CheckboxLabelModel {
internal func convertToVDSCheckboxItemModel(surface: Surface,
delegateObject: MVMCoreUIDelegateObject?,
additionalData: [AnyHashable: Any]?) -> [CheckboxGroup.CheckboxItemModel] {
return compactMap({ model in
var item = CheckboxGroup.CheckboxItemModel()
item.inputId = model.checkbox.fieldKey
item.labelText = model.label?.text
if let attributes = model.label?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
item.labelTextAttributes = attributes
}
item.childText = model.subTitle?.text
if let attributes = model.subTitle?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
item.childTextAttributes = attributes
}
item.surface = surface
item.selected = model.checkbox.selected
item.enabled = model.checkbox.isEnabled
return item
})
}
} }

View File

@ -107,15 +107,15 @@ import UIKit
// configure attributed string for progress percentage. // configure attributed string for progress percentage.
let attributedString = NSMutableAttributedString(string: String(percent) + "%") let attributedString = NSMutableAttributedString(string: String(percent) + "%")
// percent value // percent value
attributedString.setAttributes([NSAttributedString.Key.font: Styler.Font.BoldTitleXLarge], range: NSMakeRange(0, percentLen)) attributedString.setAttributes([NSAttributedString.Key.font: MFStyler.fontBoldTitleLarge()], range: NSMakeRange(0, percentLen))
// % symbol // % symbol
attributedString.setAttributes([NSAttributedString.Key.font: Styler.Font.RegularMicro], range: NSMakeRange(percentLen, 1)) attributedString.setAttributes([NSAttributedString.Key.font: MFStyler.fontBoldBodyLarge()], range: NSMakeRange(percentLen, 1))
// show progress percentage in a text layer // show progress percentage in a text layer
let width = viewWidth let width = viewWidth
let height = width let height = width
labelLayer.string = attributedString labelLayer.string = attributedString
labelLayer.frame = CGRectMake((width - CGFloat(percentLen * 20))/2, (height - 40)/2, 80, 40) labelLayer.frame = CGRectMake((width - CGFloat(percentLen * 20))/2, (height - 30)/2, 60, 30)
self.layer.addSublayer(labelLayer) self.layer.addSublayer(labelLayer)
} }

View File

@ -14,7 +14,6 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
public static var identifier: String = "circularProgress" public static var identifier: String = "circularProgress"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var percent: Int = 0 public var percent: Int = 0
public var diameter: CGFloat? = 64 public var diameter: CGFloat? = 64
@ -32,7 +31,6 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case percent case percent
case size case size
@ -50,7 +48,6 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
super.init() super.init()
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
percent = try typeContainer.decode(Int.self, forKey: .percent) percent = try typeContainer.decode(Int.self, forKey: .percent)
@ -92,7 +89,6 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(percent, forKey: .percent) try container.encode(percent, forKey: .percent)
try container.encodeIfPresent(size, forKey: .size) try container.encodeIfPresent(size, forKey: .size)
try container.encodeIfPresent(diameter, forKey: .diameter) try container.encodeIfPresent(diameter, forKey: .diameter)

View File

@ -31,15 +31,11 @@ open class Icon: VDS.Icon, VDSMoleculeViewProtocol{
// MARK: - Public // MARK: - Public
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
color = viewModel.color.uiColor color = viewModel.color.uiColor
size = viewModel.size size = viewModel.size
customSize = viewModel.customSize customSize = viewModel.customSize
name = viewModel.name name = viewModel.name
isAccessibilityElement = viewModel.isAccessibilityElement ?? true
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -21,8 +21,6 @@ open class IconModel: MoleculeModelProtocol {
public var backgroundColor: Color? public var backgroundColor: Color?
public var accessibilityIdentifier: String?
/// A representation that will be used to render the icon with corresponding name. /// A representation that will be used to render the icon with corresponding name.
public var name: Icon.Name public var name: Icon.Name
@ -37,6 +35,4 @@ open class IconModel: MoleculeModelProtocol {
/// A custom size of the icon. /// A custom size of the icon.
public var customSize: Int? public var customSize: Int?
public var isAccessibilityElement: Bool?
} }

View File

@ -18,7 +18,6 @@
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String = ImageViewModel.identifier public var moleculeName: String = ImageViewModel.identifier
public var image: String public var image: String
public var accessibilityIdentifier: String?
public var accessibilityText: String? public var accessibilityText: String?
public var fallbackImage: String? public var fallbackImage: String?
public var imageFormat: String? public var imageFormat: String?
@ -48,7 +47,6 @@
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case image case image

View File

@ -16,15 +16,13 @@ public class FormLabel: Label {
//public properties //public properties
public override var isEnabled: Bool { public override var isEnabled: Bool {
didSet{ didSet{
guard let formModel else { return } self.formModel.enabled = isEnabled
formModel.enabled = isEnabled
self.set(with: isRequired ? formModel.model : formModel.requiredModel, delegateObject, additionalData) self.set(with: isRequired ? formModel.model : formModel.requiredModel, delegateObject, additionalData)
} }
} }
public var isRequired: Bool = true { public var isRequired: Bool = true {
didSet{ didSet{
guard let formModel else { return }
self.set(with: isRequired ? formModel.model : formModel.requiredModel, delegateObject, additionalData) self.set(with: isRequired ? formModel.model : formModel.requiredModel, delegateObject, additionalData)
} }
} }
@ -52,7 +50,6 @@ public class FormLabel: Label {
/// Text change that will update both enabledModel and disabledModel text values /// Text change that will update both enabledModel and disabledModel text values
/// - Parameter text: text you want to see /// - Parameter text: text you want to see
public func set(text: String?){ public func set(text: String?){
guard let formModel else { return } self.formModel.set(text: text ?? "")
formModel.set(text: text ?? "")
} }
} }

View File

@ -182,9 +182,6 @@ public typealias ActionBlock = () -> ()
} }
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false
text = viewModel.text text = viewModel.text
hero = viewModel.hero hero = viewModel.hero

View File

@ -14,7 +14,6 @@ import VDS
open class var identifier: String { "label" } open class var identifier: String { "label" }
public var id: String public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var text: String public var text: String
@ -39,7 +38,6 @@ import VDS
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case text case text
case accessibilityText case accessibilityText
@ -90,7 +88,6 @@ import VDS
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
text = try typeContainer.decode(String.self, forKey: .text) text = try typeContainer.decode(String.self, forKey: .text)
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
textColor = try typeContainer.decodeIfPresent(Color.self, forKey: .textColor) textColor = try typeContainer.decodeIfPresent(Color.self, forKey: .textColor)
@ -118,7 +115,6 @@ import VDS
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(text, forKey: .text) try container.encode(text, forKey: .text)
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
try container.encodeIfPresent(textColor, forKey: .textColor) try container.encodeIfPresent(textColor, forKey: .textColor)

View File

@ -16,7 +16,6 @@ import UIKit
public static var identifier: String = "leftRightLabelView" public static var identifier: String = "leftRightLabelView"
public var moleculeName: String = LeftRightLabelModel.identifier public var moleculeName: String = LeftRightLabelModel.identifier
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var leftText: LabelModel public var leftText: LabelModel

View File

@ -66,7 +66,7 @@ import VDS
} }
open func setStyle(_ style: LineModel.Style) { open func setStyle(_ style: LineModel.Style) {
viewModel?.type = style viewModel.type = style
update(viewModel: viewModel) update(viewModel: viewModel)
} }
@ -85,7 +85,7 @@ import VDS
} }
open override func draw(_ rect: CGRect) { open override func draw(_ rect: CGRect) {
guard let viewModel, viewModel.type != .none else { return } guard viewModel.type != .none else { return }
super.draw(rect) super.draw(rect)
} }
@ -93,9 +93,6 @@ import VDS
// MARK: - VDSMoleculeViewProtocol // MARK: - VDSMoleculeViewProtocol
//-------------------------------------------------- //--------------------------------------------------
open func viewModelDidUpdate() { open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary
orientation = viewModel.orientation orientation = viewModel.orientation

View File

@ -55,7 +55,6 @@ public class LineModel: MoleculeModelProtocol, Invertable {
public static var identifier: String = "line" public static var identifier: String = "line"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var type: Style = .secondary public var type: Style = .secondary
@ -84,7 +83,6 @@ public class LineModel: MoleculeModelProtocol, Invertable {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case type case type
case frequency case frequency
@ -101,7 +99,6 @@ public class LineModel: MoleculeModelProtocol, Invertable {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) { if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) {
self.type = type self.type = type
@ -127,7 +124,6 @@ public class LineModel: MoleculeModelProtocol, Invertable {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(type, forKey: .type) try container.encode(type, forKey: .type)
try container.encode(inverted, forKey: .inverted) try container.encode(inverted, forKey: .inverted)
try container.encodeIfPresent(frequency, forKey: .frequency) try container.encodeIfPresent(frequency, forKey: .frequency)

View File

@ -22,9 +22,6 @@ open class LoadingSpinner: VDS.Loader, VDSMoleculeViewProtocol {
// MARK: - Public Functions // MARK: - Public Functions
//-------------------------------------------------- //--------------------------------------------------
open func viewModelDidUpdate() { open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
size = Int(viewModel.diameter) size = Int(viewModel.diameter)
surface = viewModel.surface surface = viewModel.surface
} }

View File

@ -16,7 +16,6 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "loadingSpinner" public static var identifier: String = "loadingSpinner"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var inverted: Bool = false public var inverted: Bool = false
@ -28,7 +27,6 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case strokeColor case strokeColor
case diameter case diameter
@ -49,7 +47,6 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) { if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) {
self.diameter = diameter self.diameter = diameter
@ -68,7 +65,6 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(diameter, forKey: .diameter) try container.encodeIfPresent(diameter, forKey: .diameter)
try container.encodeIfPresent(inverted, forKey: .inverted) try container.encodeIfPresent(inverted, forKey: .inverted)
} }

View File

@ -22,7 +22,6 @@ import Foundation
public static var identifier: String = "multiProgressBar" public static var identifier: String = "multiProgressBar"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var progressList: [SingleProgressBarModel] public var progressList: [SingleProgressBarModel]
public var backgroundColor: Color? public var backgroundColor: Color?
@ -31,7 +30,6 @@ import Foundation
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case progressList case progressList
case thickness case thickness
@ -46,7 +44,6 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList) progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness) thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
@ -57,7 +54,6 @@ import Foundation
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(progressList, forKey: .progressList) try container.encode(progressList, forKey: .progressList)
try container.encodeIfPresent(thickness, forKey: .thickness) try container.encodeIfPresent(thickness, forKey: .thickness)
try container.encodeIfPresent(roundedCorners, forKey: .roundedCorners) try container.encodeIfPresent(roundedCorners, forKey: .roundedCorners)

View File

@ -1,60 +0,0 @@
//
// Pagination.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/27/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
@objcMembers open class Pagination: VDS.Pagination, VDSMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
open var viewModel: PaginationModel!
open var delegateObject: MVMCoreUIDelegateObject?
open var additionalData: [AnyHashable : Any]?
// Form Validation
open var fieldKey: String?
open var fieldValue: JSONValue?
open var groupName: String?
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public convenience required init() {
self.init(frame:.zero)
}
open override func setup() {
super.setup()
pageChangedPublisher
.sink { [weak self] control in
guard let self else { return }
viewModel?.selectedPage = control.selectedPage
}.store(in: &subscribers)
}
open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
isEnabled = viewModel.enabled
surface = viewModel.surface
total = viewModel.totalPages
selectedPage = viewModel.selectedPage
}
//--------------------------------------------------
// MARK: - Actions
//--------------------------------------------------
//--------------------------------------------------
// MARK: - MoleculeViewProtocol
//--------------------------------------------------
public func updateView(_ size: CGFloat) {}
}

View File

@ -1,76 +0,0 @@
//
// PaginationModel.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/27/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
import MVMCore
open class PaginationModel: MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
open class var identifier: String { "pagination" }
open var moleculeName: String { Self.identifier }
open var backgroundColor: Color?
open var id: String = UUID().uuidString
open var accessibilityIdentifier: String?
open var totalPages: Int = 0
open var selectedPage: Int = 0
open var enabled: Bool = true
open var inverted: Bool = false
open var surface: Surface { inverted ? .dark : .light }
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case id
case moleculeName
case accessibilityIdentifier
case totalPages
case selectedPage
case enabled
case inverted
}
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decode(String.self, forKey: .id)
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
totalPages = try container.decode(Int.self, forKey: .totalPages)
selectedPage = try container.decodeIfPresent(Int.self, forKey: .selectedPage) ?? 0
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(totalPages, forKey: .totalPages)
try container.encode(selectedPage, forKey: .selectedPage)
try container.encode(enabled, forKey: .enabled)
try container.encode(inverted, forKey: .inverted)
}
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return inverted == model.inverted
&& enabled == model.enabled
&& totalPages == model.totalPages
&& selectedPage == model.selectedPage
}
}

View File

@ -75,9 +75,6 @@ import Foundation
guard let progressBarModel = model as? ProgressBarModel else { return } guard let progressBarModel = model as? ProgressBarModel else { return }
self.progressBarModel = progressBarModel self.progressBarModel = progressBarModel
if let accessibilityIdentifier = model.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
thickness = progressBarModel.thickness ?? 8 thickness = progressBarModel.thickness ?? 8
progress = Float((progressBarModel.percent) / 100.0) progress = Float((progressBarModel.percent) / 100.0)
progressTintColor = progressBarModel.color.uiColor progressTintColor = progressBarModel.color.uiColor

View File

@ -11,7 +11,6 @@ import Foundation
@objcMembers open class ProgressBarModel: MoleculeModelProtocol { @objcMembers open class ProgressBarModel: MoleculeModelProtocol {
open class var identifier: String { "progressBar" } open class var identifier: String { "progressBar" }
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
@Percent public var percent: CGFloat @Percent public var percent: CGFloat
public var color: Color = Color(uiColor: .mfCerulean()) public var color: Color = Color(uiColor: .mfCerulean())
@ -21,7 +20,6 @@ import Foundation
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case roundedCorners case roundedCorners
case thickness case thickness
@ -37,7 +35,6 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
percent = try typeContainer.decode(CGFloat.self, forKey: .percent) percent = try typeContainer.decode(CGFloat.self, forKey: .percent)
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) { if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
self.color = color self.color = color
@ -53,7 +50,6 @@ import Foundation
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(percent, forKey: .percent) try container.encode(percent, forKey: .percent)
try container.encode(color, forKey: .color) try container.encode(color, forKey: .color)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)

View File

@ -14,7 +14,6 @@ open class StarModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "star" public static var identifier: String = "star"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
@Percent public var percent: CGFloat = 0 @Percent public var percent: CGFloat = 0
@ -27,7 +26,6 @@ open class StarModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case percent case percent
@ -49,7 +47,6 @@ open class StarModel: MoleculeModelProtocol {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) { if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) {
self.percent = percent self.percent = percent
} }
@ -66,7 +63,6 @@ open class StarModel: MoleculeModelProtocol {
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(percent, forKey: .percent) try container.encode(percent, forKey: .percent)
try container.encodeIfPresent(borderColor, forKey: .borderColor) try container.encodeIfPresent(borderColor, forKey: .borderColor)
try container.encodeIfPresent(fillColor, forKey: .fillColor) try container.encodeIfPresent(fillColor, forKey: .fillColor)

View File

@ -14,7 +14,6 @@ import MVMCore
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "stars" public static var identifier: String = "stars"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var starBackgroundColor: Color? public var starBackgroundColor: Color?
@ -29,7 +28,6 @@ import MVMCore
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case starBackgroundColor case starBackgroundColor
@ -55,7 +53,6 @@ import MVMCore
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
stars = try typeContainer.decode([StarModel].self, forKey: .stars) stars = try typeContainer.decode([StarModel].self, forKey: .stars)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor) starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor)
@ -73,7 +70,6 @@ import MVMCore
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(stars, forKey: .stars) try container.encode(stars, forKey: .stars)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(starBackgroundColor, forKey: .starBackgroundColor) try container.encodeIfPresent(starBackgroundColor, forKey: .starBackgroundColor)

View File

@ -40,9 +40,7 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{
// MARK: - Public // MARK: - Public
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
if let moleculeModel = viewModel.molecule { if let moleculeModel = viewModel.molecule {
if let molecule, if let molecule,
moleculeModel.moleculeName == molecule.model?.moleculeName { moleculeModel.moleculeName == molecule.model?.moleculeName {
@ -101,9 +99,7 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{
//-------------------------------------------------- //--------------------------------------------------
// MARK: - MVMCoreViewProtocol // MARK: - MVMCoreViewProtocol
//-------------------------------------------------- //--------------------------------------------------
open func updateView(_ size: CGFloat) { open func updateView(_ size: CGFloat) {}
(molecule as? MVMCoreViewProtocol)?.updateView(size)
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - MoleculeViewProtocol // MARK: - MoleculeViewProtocol

View File

@ -70,10 +70,8 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
public var aspectRatio: TileContainerType.AspectRatio = .none public var aspectRatio: TileContainerType.AspectRatio = .none
public var backgroundEffect: TileContainerType.BackgroundEffect = .none public var backgroundEffect: TileContainerType.BackgroundEffect = .none
public var surface: Surface { inverted ? .dark : .light } public var surface: Surface { inverted ? .dark : .light }
public var accessibilityIdentifier: String?
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case accessibilityIdentifier
case inverted case inverted
case backgroundImage case backgroundImage
case action case action
@ -90,7 +88,6 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
backgroundImage = try container.decodeIfPresent(String.self, forKey: .backgroundImage) backgroundImage = try container.decodeIfPresent(String.self, forKey: .backgroundImage)
action = try container.decodeModelIfPresent(codingKey: .action) action = try container.decodeModelIfPresent(codingKey: .action)
@ -107,7 +104,6 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundImage, forKey: .backgroundImage) try container.encodeIfPresent(backgroundImage, forKey: .backgroundImage)
try container.encodeModelIfPresent(action, forKey: .action) try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeIfPresent(imageFallbackColor, forKey: .imageFallbackColor) try container.encodeIfPresent(imageFallbackColor, forKey: .imageFallbackColor)

View File

@ -39,9 +39,6 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
// MARK: - Public // MARK: - Public
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
//tilelet specific properties //tilelet specific properties
if let value = viewModel.textWidth { if let value = viewModel.textWidth {
textWidth = .value(value) textWidth = .value(value)
@ -51,7 +48,7 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData) eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)
titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData) titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData)
subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData) subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData)
badgeModel = viewModel.badgeModel() badgeModel = viewModel.badge
descriptiveIconModel = viewModel.descriptiveIcon descriptiveIconModel = viewModel.descriptiveIcon
directionalIconModel = viewModel.directionalIcon directionalIconModel = viewModel.directionalIcon
//setup action //setup action

View File

@ -18,7 +18,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var backgroundColor: Color? public var backgroundColor: Color?
public var badge: BadgeModel? public var badge: Tilelet.BadgeModel?
public var eyebrow: LabelModel? public var eyebrow: LabelModel?
public var eyebrowColor: TitleLockup.TextColor = .primary public var eyebrowColor: TitleLockup.TextColor = .primary
public var title: LabelModel? public var title: LabelModel?
@ -49,7 +49,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
badge = try container.decodeIfPresent(BadgeModel.self, forKey: .badge) badge = try container.decodeIfPresent(Tilelet.BadgeModel.self, forKey: .badge)
eyebrow = try container.decodeIfPresent(LabelModel.self, forKey: .eyebrow) eyebrow = try container.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
title = try container.decodeIfPresent(LabelModel.self, forKey: .title) title = try container.decodeIfPresent(LabelModel.self, forKey: .title)
subTitle = try container.decodeIfPresent(LabelModel.self, forKey: .subTitle) subTitle = try container.decodeIfPresent(LabelModel.self, forKey: .subTitle)
@ -91,48 +91,32 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
try super.init(from: decoder) try super.init(from: decoder)
} }
public func badgeModel() -> Tilelet.BadgeModel? {
guard let badge else { return nil }
return .init(text: badge.text,
textColor: badge.textColorStyle,
fillColor: badge.fillColorStyle,
surface: badge.surface,
numberOfLines: badge.numberOfLines,
maxWidth: badge.maxWidth
)
}
public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? { public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? {
guard let eyebrow else { return nil } guard let eyebrow else { return nil }
let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
var isBold: Bool = true
do { do {
if let style = eyebrow.fontStyle { if let style = eyebrow.fontStyle {
isBold = style.isBold()
return .init(text: eyebrow.text, return .init(text: eyebrow.text,
textColor: eyebrowColor, textColor: eyebrowColor,
textAttributes: attrs, textAttributes: attrs, isBold: style.isBold(),
isBold: isBold,
standardStyle: try style.vdsSubsetStyle()) standardStyle: try style.vdsSubsetStyle())
} }
} catch MVMCoreError.errorObject(let object) { } catch MVMCoreError.errorObject(let object) {
MVMCoreLoggingHandler.shared()?.addError(toLog: object) MVMCoreLoggingHandler.shared()?.addError(toLog: object)
} catch { } } catch { }
return .init(text: eyebrow.text, textColor: eyebrowColor, textAttributes: attrs, isBold: isBold) return .init(text: eyebrow.text, textColor: eyebrowColor, textAttributes: attrs)
} }
public func titleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.TitleModel? { public func titleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.TitleModel? {
guard let title else { return nil } guard let title else { return nil }
let attrs = title.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) let attrs = title.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
var isBold: Bool = true
do { do {
if let style = title.fontStyle { if let style = title.fontStyle {
isBold = style.isBold()
return .init(text: title.text, return .init(text: title.text,
textColor: titleColor, textColor: titleColor,
textAttributes: attrs, textAttributes: attrs,
isBold: isBold,
standardStyle: try style.vdsSubsetStyle()) standardStyle: try style.vdsSubsetStyle())
} }
@ -140,7 +124,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
MVMCoreLoggingHandler.shared()?.addError(toLog: object) MVMCoreLoggingHandler.shared()?.addError(toLog: object)
} catch { } } catch { }
return .init(text: title.text, textColor: titleColor, textAttributes: attrs, isBold: isBold) return .init(text: title.text, textColor: titleColor, textAttributes: attrs)
} }
public func subTitleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.SubTitleModel? { public func subTitleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.SubTitleModel? {

View File

@ -28,9 +28,6 @@ open class Tooltip: VDS.Tooltip, VDSMoleculeViewProtocol{
// MARK: - Public // MARK: - Public
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
fillColor = viewModel.fillColor fillColor = viewModel.fillColor
size = viewModel.size size = viewModel.size

View File

@ -22,8 +22,6 @@ open class TooltipModel: MoleculeModelProtocol {
public var backgroundColor: Color? public var backgroundColor: Color?
public var accessibilityIdentifier: String?
public var size: VDS.Tooltip.Size = .medium public var size: VDS.Tooltip.Size = .medium
public var fillColor: VDS.Tooltip.FillColor = .primary public var fillColor: VDS.Tooltip.FillColor = .primary
@ -41,7 +39,6 @@ open class TooltipModel: MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case closeButtonText case closeButtonText
@ -55,14 +52,13 @@ open class TooltipModel: MoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString self.id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor) self.backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
title = try container.decodeIfPresent(String.self, forKey: .title) self.title = try container.decodeIfPresent(String.self, forKey: .title)
content = try container.decodeIfPresent(String.self, forKey: .content) self.content = try container.decodeIfPresent(String.self, forKey: .content)
molecule = try container.decodeModelIfPresent(codingKey: .contentView) self.molecule = try container.decodeModelIfPresent(codingKey: .contentView)
if let closeButtonText = try container.decodeIfPresent(String.self, forKey: .closeButtonText) { if let closeButtonText = try container.decodeIfPresent(String.self, forKey: .closeButtonText) {
self.closeButtonText = closeButtonText self.closeButtonText = closeButtonText
@ -85,7 +81,6 @@ open class TooltipModel: MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(surface, forKey: .surface) try container.encode(surface, forKey: .surface)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
@ -103,7 +98,7 @@ open class TooltipModel: MoleculeModelProtocol {
} }
extension TooltipModel { extension TooltipModel {
public func convertToVDSTooltipModel() -> Tooltip.TooltipModel { public func toVDSTooltipModel() -> Tooltip.TooltipModel {
var moleculeView: MoleculeViewProtocol? var moleculeView: MoleculeViewProtocol?
if let molecule, let view = ModelRegistry.createMolecule(molecule) { if let molecule, let view = ModelRegistry.createMolecule(molecule) {
moleculeView = view moleculeView = view

View File

@ -11,7 +11,6 @@ import Foundation
open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer { open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
public static var identifier = "video" public static var identifier = "video"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var video: String public var video: String
public var showControls = false public var showControls = false
@ -46,7 +45,6 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case video case video
case showControls case showControls
@ -62,7 +60,6 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
video = try typeContainer.decode(String.self, forKey:.video) video = try typeContainer.decode(String.self, forKey:.video)
if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) { if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) {
self.showControls = showControls self.showControls = showControls
@ -79,7 +76,6 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
open func encode(to encoder: Encoder) throws { open func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(video, forKey: .video) try container.encode(video, forKey: .video)
try container.encode(showControls, forKey: .showControls) try container.encode(showControls, forKey: .showControls)

View File

@ -13,7 +13,6 @@ import MVMCore
public static var identifier: String = "webview" public static var identifier: String = "webview"
public var moleculeName: String = WebViewModel.identifier public var moleculeName: String = WebViewModel.identifier
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var url: URL? public var url: URL?
@ -27,7 +26,6 @@ import MVMCore
private enum CodingKeys: String, CodingKey{ private enum CodingKeys: String, CodingKey{
case id case id
case accessibilityIdentifier
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case url case url
@ -45,7 +43,6 @@ import MVMCore
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url) url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString) htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
@ -60,7 +57,6 @@ import MVMCore
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeIfPresent(url, forKey: .url) try container.encodeIfPresent(url, forKey: .url)
try container.encodeIfPresent(htmlString, forKey: .htmlString) try container.encodeIfPresent(htmlString, forKey: .htmlString)

View File

@ -16,7 +16,6 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
public static var identifier: String = "wheel" public static var identifier: String = "wheel"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var style: GraphStyle = .unlimited { public var style: GraphStyle = .unlimited {
didSet { didSet {
@ -39,7 +38,6 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case accessibilityIdentifier
case style case style
case size case size
case diameter case diameter
@ -55,7 +53,6 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
super.init() super.init()
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) { if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) {
self.style = style self.style = style
@ -87,7 +84,6 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(style, forKey: .style) try container.encode(style, forKey: .style)
try container.encode(size, forKey: .size) try container.encode(size, forKey: .size)
try container.encode(diameter, forKey: .diameter) try container.encode(diameter, forKey: .diameter)

View File

@ -9,13 +9,13 @@
import Foundation import Foundation
import VDS import VDS
import VDSCoreTokens import VDSCoreTokens
import MVMCore
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Codable Extensions // MARK: - Codable Extensions
//-------------------------------------------------- //--------------------------------------------------
extension VDS.Surface: Codable {} extension VDS.Surface: Codable {}
extension VDS.Badge.FillColor: Codable {}
extension VDS.BadgeIndicator.FillColor: Codable {} extension VDS.BadgeIndicator.FillColor: Codable {}
extension VDS.BadgeIndicator.Kind: Codable {} extension VDS.BadgeIndicator.Kind: Codable {}
extension VDS.BadgeIndicator.MaximumDigits: Codable {} extension VDS.BadgeIndicator.MaximumDigits: Codable {}
@ -57,52 +57,6 @@ extension VDS.Button.Size: RawRepresentableCodable {
public static var defaultValue: VDS.Button.Size? { nil } public static var defaultValue: VDS.Button.Size? { nil }
} }
extension VDS.CalendarBase.CalendarIndicatorModel: Codable, ModelComparisonProtocol, MoleculeModelComparisonProtocol {
enum CodingKeys: String, CodingKey {
case label
case date
case dateFormat
}
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let label = try container.decode(String.self, forKey: .label)
let formatter = Self.formatter()
formatter.dateFormat = try container.decodeIfPresent(String.self, forKey: .dateFormat) ?? "MMM d, y"
let foundDate = try container.decode(String.self, forKey: .date)
let date = formatter.date(from: foundDate)!
self = .init(label: label, date: date)
}
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(label, forKey: .label)
try container.encode(Self.formatter().string(from: date), forKey: .date)
}
static func formatter() -> DateFormatter {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeZone = NSTimeZone.system
formatter.locale = .current
formatter.formatterBehavior = .default
return formatter
}
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return label == model.label
&& date == model.date
}
public func isVisuallyEquivalent(to model: any MoleculeModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return label == model.label
&& date == model.date
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Decodable Defaults // MARK: - Decodable Defaults
//-------------------------------------------------- //--------------------------------------------------
@ -293,45 +247,6 @@ extension VDS.TitleLockup.TextColor: Codable {
} }
} }
extension VDS.Badge.FillColor: Codable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let type = try container.decode(String.self)
switch type {
case "red":
self = .red
case "yellow":
self = .yellow
case "green":
self = .green
case "orange":
self = .orange
case "blue":
self = .blue
case "black":
self = .black
case "white":
self = .white
default:
if let color = try? Color(from: decoder) {
self = .custom(color.uiColor)
} else {
self = .custom(UIColor(hexString: type))
}
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case .custom(let value):
try container.encode(Color(uiColor: value))
default:
try container.encode(String(reflecting: self))
}
}
}
extension VDS.TitleLockup.TitleTextColor: Codable { extension VDS.TitleLockup.TitleTextColor: Codable {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {

View File

@ -16,7 +16,7 @@ extension Array where Element: MVMCoreUI.LabelAttributeModel {
var attributes: [any VDS.LabelAttributeModel] = [] var attributes: [any VDS.LabelAttributeModel] = []
forEach { atomicLabelAttribute in forEach { atomicLabelAttribute in
if let attr = atomicLabelAttribute as? (any VDSLabelAttributeConvertable), if let attr = atomicLabelAttribute as? (any VDSLabelAttributeConvertable),
let vds = attr.convertToVDSLabelAttribute(delegateObject: delegateObject, let vds = attr.convertToVDSLabelAttirbute(delegateObject: delegateObject,
additionalData: additionalData){ additionalData: additionalData){
attributes.append(vds) attributes.append(vds)
} }
@ -28,12 +28,12 @@ extension Array where Element: MVMCoreUI.LabelAttributeModel {
//VDS Convertable Protocol and Extensions //VDS Convertable Protocol and Extensions
public protocol VDSLabelAttributeConvertable<LabelAttributeType> { public protocol VDSLabelAttributeConvertable<LabelAttributeType> {
associatedtype LabelAttributeType: VDS.LabelAttributeModel associatedtype LabelAttributeType: VDS.LabelAttributeModel
func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> LabelAttributeType? func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> LabelAttributeType?
} }
extension LabelAttributeUnderlineModel: VDSLabelAttributeConvertable { extension LabelAttributeUnderlineModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> UnderlineLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> UnderlineLabelAttribute? {
guard let style = UnderlineLabelAttribute.Style(rawValue: style.rawValue) else { return nil } guard let style = UnderlineLabelAttribute.Style(rawValue: style.rawValue) else { return nil }
var pattern: UnderlineLabelAttribute.Pattern? var pattern: UnderlineLabelAttribute.Pattern?
@ -50,7 +50,7 @@ extension LabelAttributeUnderlineModel: VDSLabelAttributeConvertable {
} }
extension LabelAttributeActionModel: VDSLabelAttributeConvertable { extension LabelAttributeActionModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> ActionLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> ActionLabelAttribute? {
var vdsAttribute = VDS.ActionLabelAttribute(location: location, length: length) var vdsAttribute = VDS.ActionLabelAttribute(location: location, length: length)
vdsAttribute.subscriber = vdsAttribute.action.sink { [weak self] in vdsAttribute.subscriber = vdsAttribute.action.sink { [weak self] in
guard let self else { return } guard let self else { return }
@ -64,13 +64,11 @@ extension LabelAttributeActionModel: VDSLabelAttributeConvertable {
} }
extension LabelAttributeFontModel: VDSLabelAttributeConvertable { extension LabelAttributeFontModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> TextStyleLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> TextStyleLabelAttribute? {
var textStyle: TextStyle? var textStyle: TextStyle?
if let found = style?.vdsTextStyle() { if let found = style?.vdsTextStyle() {
textStyle = found textStyle = found
} else if let name, let size, let font = UIFont(name: name, size: size) {
textStyle = TextStyle.convert(font: font)
} else if let name, let found = TextStyle(rawValue: name) { } else if let name, let found = TextStyle(rawValue: name) {
textStyle = found textStyle = found
} }
@ -84,7 +82,7 @@ extension LabelAttributeFontModel: VDSLabelAttributeConvertable {
} }
extension LabelAttributeColorModel: VDSLabelAttributeConvertable { extension LabelAttributeColorModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> ColorLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> ColorLabelAttribute? {
guard let textColor else { return nil } guard let textColor else { return nil }
return ColorLabelAttribute(location: location, return ColorLabelAttribute(location: location,
length: length, length: length,
@ -93,14 +91,14 @@ extension LabelAttributeColorModel: VDSLabelAttributeConvertable {
} }
extension LabelAttributeStrikeThroughModel: VDSLabelAttributeConvertable { extension LabelAttributeStrikeThroughModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> StrikeThroughLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> StrikeThroughLabelAttribute? {
return StrikeThroughLabelAttribute(location: location, return StrikeThroughLabelAttribute(location: location,
length: length) length: length)
} }
} }
extension LabelAttributeImageModel: VDSLabelAttributeConvertable { extension LabelAttributeImageModel: VDSLabelAttributeConvertable {
public func convertToVDSLabelAttribute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> AtomicImageLabelAttribute? { public func convertToVDSLabelAttirbute(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> AtomicImageLabelAttribute? {
var frame: CGRect? var frame: CGRect?
if let size { if let size {
frame = CGRect(x: 0, y: 0, width: size, height: size) frame = CGRect(x: 0, y: 0, width: size, height: size)

View File

@ -1,59 +0,0 @@
//
// Breadcrumbs.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/26/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
@objcMembers open class Breadcrumbs: VDS.Breadcrumbs, VDSMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
open var viewModel: BreadcrumbsModel!
open var delegateObject: MVMCoreUIDelegateObject?
open var additionalData: [AnyHashable : Any]?
// Form Validation
open var fieldKey: String?
open var fieldValue: JSONValue?
open var groupName: String?
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public convenience required init() {
self.init(frame:.zero)
}
open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
isEnabled = viewModel.enabled
surface = viewModel.surface
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
return .init(text: breadcrumb.text,
selected: breadcrumb.selected,
onClick: { _ in
MVMCoreUIActionHandler.performActionUnstructured(with: breadcrumb.action,
sourceModel: breadcrumb,
additionalData: self.additionalData,
delegateObject: self.delegateObject)
})
}
}
//--------------------------------------------------
// MARK: - Actions
//--------------------------------------------------
//--------------------------------------------------
// MARK: - MoleculeViewProtocol
//--------------------------------------------------
public func updateView(_ size: CGFloat) {}
}

View File

@ -1,124 +0,0 @@
//
// BreadCrumbs.swift
// MVMCoreUI
//
// Created by Matt Bruce on 8/26/24.
// Copyright © 2024 Verizon Wireless. All rights reserved.
//
import Foundation
import VDS
import MVMCore
open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
open class var identifier: String { "breadcrumbs" }
open var moleculeName: String { Self.identifier }
open var backgroundColor: Color?
open var id: String = UUID().uuidString
open var accessibilityIdentifier: String?
open var children: [any MoleculeModelProtocol] { breadcrumbs }
open var breadcrumbs: [BreadcrumbModel] = []
open var enabled: Bool = true
open var inverted: Bool = false
open var surface: Surface { inverted ? .dark : .light }
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case accessibilityIdentifier
case moleculeName
case breadcrumbs
case enabled
case inverted
}
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
breadcrumbs = try container.decode([BreadcrumbModel].self, forKey: .breadcrumbs)
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(breadcrumbs, forKey: .breadcrumbs)
try container.encode(enabled, forKey: .enabled)
try container.encode(inverted, forKey: .inverted)
}
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return inverted == model.inverted
&& enabled == model.enabled
}
}
open class BreadcrumbModel: MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
open class var identifier: String { "breadcrumb" }
open var moleculeName: String { Self.identifier }
open var backgroundColor: Color?
open var id: String = UUID().uuidString
open var accessibilityIdentifier: String?
open var text: String = ""
open var selected: Bool = false
open var action: ActionModelProtocol
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case accessibilityIdentifier
case text
case selected
case action
}
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
text = try container.decode(String.self, forKey: .text)
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
action = try container.decodeModel(codingKey: .action)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(text, forKey: .text)
try container.encode(selected, forKey: .selected)
try container.encodeModelIfPresent(action, forKey: .action)
}
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return text == model.text
&& selected == model.selected
&& action.isEqual(to: model.action)
}
}

View File

@ -52,9 +52,6 @@ public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol, ParentMol
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -31,9 +31,6 @@ public class HeadersH1NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -47,15 +47,18 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol, ParentMo
//-------------------------------------------------- //--------------------------------------------------
public override func setDefaults() { public override func setDefaults() {
if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if titleLockup.title.fontStyle == nil { if titleLockup.title.fontStyle == nil {
titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge
} }
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -42,15 +42,18 @@ public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol, Parent
// MARK: - Methods // MARK: - Methods
//-------------------------------------------------- //--------------------------------------------------
public override func setDefaults() { public override func setDefaults() {
if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if titleLockup.title.fontStyle == nil { if titleLockup.title.fontStyle == nil {
titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge
} }
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -46,15 +46,18 @@ public class HeadersH2LinkModel: HeaderModel, ParentMoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
public override func setDefaults() { public override func setDefaults() {
if titleLockup.title.fontStyle == nil { if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if titleLockup.title.fontStyle == nil {
titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge
} }
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -36,15 +36,18 @@ public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol
} }
public override func setDefaults() { public override func setDefaults() {
if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if titleLockup.title.fontStyle == nil { if titleLockup.title.fontStyle == nil {
titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge
} }
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -57,6 +57,12 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol, P
// MARK: - Methods // MARK: - Methods
//-------------------------------------------------- //--------------------------------------------------
public override func setDefaults() { public override func setDefaults() {
if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if headline.accessibilityTraits == nil { if headline.accessibilityTraits == nil {
headline.accessibilityTraits = .header headline.accessibilityTraits = .header
} }

View File

@ -47,15 +47,18 @@ public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol, Paren
//-------------------------------------------------- //--------------------------------------------------
public override func setDefaults() { public override func setDefaults() {
if topPadding == nil {
topPadding = Padding.Component.VerticalMarginSpacing
}
if bottomPadding == nil {
bottomPadding = Padding.Component.VerticalMarginSpacing
}
if titleLockup.title.fontStyle == nil { if titleLockup.title.fontStyle == nil {
titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge titleLockup.title.fontStyle = Styler.Font.RegularTitleXLarge
} }
if titleLockup.subTitle?.fontStyle == nil { if titleLockup.subTitle?.fontStyle == nil {
titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium titleLockup.subTitle?.fontStyle = Styler.Font.RegularTitleMedium
} }
if titleLockup.title.accessibilityTraits == nil {
titleLockup.title.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
button.style = .secondary button.style = .secondary
button.size = .small button.size = .small

View File

@ -14,7 +14,6 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "planNamesLockup" public static var identifier: String = "planNamesLockup"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var headline: LabelModel public var headline: LabelModel
@ -36,7 +35,6 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case moleculeName case moleculeName
case accessibilityIdentifier
case backgroundColor case backgroundColor
case headline case headline
case subHeadline case subHeadline
@ -49,7 +47,6 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
headline = try typeContainer.decode(LabelModel.self, forKey: .headline) headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline) subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
@ -60,7 +57,6 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(headline, forKey: .headline) try container.encode(headline, forKey: .headline)
try container.encode(subHeadline, forKey: .subHeadline) try container.encode(subHeadline, forKey: .subHeadline)

View File

@ -15,7 +15,6 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
public static var identifier: String = "planLockup" public static var identifier: String = "planLockup"
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var planLabel : LabelModel public var planLabel : LabelModel
@ -48,7 +47,6 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case moleculeName case moleculeName
case accessibilityIdentifier
case backgroundColor case backgroundColor
case planLabel case planLabel
case headline case headline
@ -63,7 +61,6 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel) planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel)
headline = try typeContainer.decode(LabelModel.self, forKey: .headline) headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
@ -76,7 +73,6 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(planLabel, forKey: .planLabel) try container.encode(planLabel, forKey: .planLabel)
try container.encode(headline, forKey: .headline) try container.encode(headline, forKey: .headline)

View File

@ -20,9 +20,6 @@ import VDS
// MARK: - Public Functions // MARK: - Public Functions
//-------------------------------------------------- //--------------------------------------------------
open func viewModelDidUpdate() { open func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
textAlignment = viewModel.textAlignment textAlignment = viewModel.textAlignment
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData) eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)

View File

@ -18,7 +18,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
public static var identifier: String = "titleLockup" public static var identifier: String = "titleLockup"
public var moleculeName: String = TitleLockupModel.identifier public var moleculeName: String = TitleLockupModel.identifier
public var id: String = UUID().uuidString public var id: String = UUID().uuidString
public var accessibilityIdentifier: String?
public var textAlignment: TitleLockup.TextAlignment = .left public var textAlignment: TitleLockup.TextAlignment = .left
public var eyebrow: LabelModel? public var eyebrow: LabelModel?
@ -27,6 +26,8 @@ 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?
@ -48,6 +49,7 @@ 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
@ -73,7 +75,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id case id
case moleculeName case moleculeName
case accessibilityIdentifier
case textAlignment case textAlignment
case eyebrow case eyebrow
case eyebrowColor case eyebrowColor
@ -82,6 +83,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
case subTitle case subTitle
case subTitleColor case subTitleColor
case inverted case inverted
case alignment
} }
//-------------------------------------------------- //--------------------------------------------------
@ -91,7 +93,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
textAlignment = try typeContainer.decodeIfPresent(TitleLockup.TextAlignment.self, forKey: .textAlignment) ?? .left textAlignment = try typeContainer.decodeIfPresent(TitleLockup.TextAlignment.self, forKey: .textAlignment) ?? .left
title = try typeContainer.decodeMolecule(codingKey: .title) title = try typeContainer.decodeMolecule(codingKey: .title)
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
@ -127,6 +128,10 @@ 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 {
@ -139,7 +144,6 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .id) try container.encode(id, forKey: .id)
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
try container.encode(textAlignment, forKey: .textAlignment) try container.encode(textAlignment, forKey: .textAlignment)
try container.encodeIfPresent(eyebrow, forKey: .eyebrow) try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
try container.encode(eyebrowColor, forKey: .eyebrowColor) try container.encode(eyebrowColor, forKey: .eyebrowColor)
@ -147,6 +151,7 @@ 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)
} }

View File

@ -15,7 +15,7 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
public let headline = Label(fontStyle: .BoldTitleLarge) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label(fontStyle: .RegularBodySmall) public let body = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
@ -24,7 +24,7 @@ import Foundation
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)), stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)),
(view: body, model: StackItemModel(spacing: 8, horizontalAlignment: .leading))], (view: body, model: StackItemModel(spacing: 0, horizontalAlignment: .leading))],
axis: .vertical) axis: .vertical)
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
} }
@ -63,7 +63,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
headline.setFontStyle(.BoldTitleLarge) headline.setFontStyle(.BoldTitleMedium)
body.setFontStyle(.RegularBodySmall) body.setFontStyle(.RegularBodySmall)
} }

View File

@ -47,9 +47,6 @@ public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, Mo
override public func setDefaults() { override public func setDefaults() {
style = .shortDivider style = .shortDivider
if headline.accessibilityTraits == nil {
headline.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -15,7 +15,7 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
public let headline = Label(fontStyle: .BoldTitleLarge) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label(fontStyle: .RegularBodySmall) public let body = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
@ -24,7 +24,7 @@ import Foundation
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)), stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)),
(view: body, model: StackItemModel(spacing: 8, horizontalAlignment: .leading))], (view: body, model: StackItemModel(spacing: 0, horizontalAlignment: .leading))],
axis: .vertical) axis: .vertical)
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
} }
@ -62,7 +62,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
headline.setFontStyle(.BoldTitleLarge) headline.setFontStyle(.BoldTitleMedium)
body.setFontStyle(.RegularBodySmall) body.setFontStyle(.RegularBodySmall)
accessibilityLabel = nil accessibilityLabel = nil
} }

View File

@ -47,9 +47,6 @@ public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, Mol
override public func setDefaults() { override public func setDefaults() {
style = .tallDivider style = .tallDivider
if headline.accessibilityTraits == nil {
headline.accessibilityTraits = [.header]
}
super.setDefaults() super.setDefaults()
} }

View File

@ -17,7 +17,6 @@ import Foundation
public static var identifier: String = "doughnutChartItem" public static var identifier: String = "doughnutChartItem"
public var moleculeName: String = DoughnutChartItemModel.identifier public var moleculeName: String = DoughnutChartItemModel.identifier
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var label: LabelModel public var label: LabelModel
@ -29,8 +28,6 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case id
case accessibilityIdentifier
case backgroundColor case backgroundColor
case label case label
case percent case percent

View File

@ -17,7 +17,6 @@ import Foundation
public static var identifier: String = "doughnutChart" public static var identifier: String = "doughnutChart"
public var moleculeName: String = DoughnutChartModel.identifier public var moleculeName: String = DoughnutChartModel.identifier
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var title: LabelModel? public var title: LabelModel?

View File

@ -16,7 +16,6 @@ public class ImageHeadlineBodyModel: MoleculeModelProtocol {
public static var identifier: String = "imageHeadlineBody" public static var identifier: String = "imageHeadlineBody"
public var moleculeName: String = ImageHeadlineBodyModel.identifier public var moleculeName: String = ImageHeadlineBodyModel.identifier
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var image: ImageViewModel public var image: ImageViewModel

View File

@ -80,10 +80,6 @@ import VDS
// MARK: - Atomic // MARK: - Atomic
//-------------------------------------------------- //--------------------------------------------------
public func viewModelDidUpdate() { public func viewModelDidUpdate() {
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
self.accessibilityIdentifier = accessibilityIdentifier
}
surface = viewModel.surface surface = viewModel.surface
updateRadioButton() updateRadioButton()
@ -110,7 +106,7 @@ import VDS
} }
//properties //properties
isEnabled = viewModel.radioButton.isEnabled isEnabled = viewModel.radioButton.enabled && !viewModel.radioButton.readOnly
isSelected = viewModel.radioButton.state isSelected = viewModel.radioButton.state
//forms //forms

View File

@ -10,14 +10,13 @@ import Foundation
import MVMCore import MVMCore
import VDS import VDS
public class RadioButtonLabelModel: MoleculeModelProtocol, ParentMoleculeModelProtocol { @objcMembers public class RadioButtonLabelModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public static var identifier: String = "radioButtonLabel" public static var identifier: String = "radioButtonLabel"
@DecodableDefault.UUIDString public var id: String @DecodableDefault.UUIDString public var id: String
public var accessibilityIdentifier: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String = RadioButtonLabelModel.identifier public var moleculeName: String = RadioButtonLabelModel.identifier
@ -42,35 +41,4 @@ public class RadioButtonLabelModel: MoleculeModelProtocol, ParentMoleculeModelPr
self.subTitle = subTitle self.subTitle = subTitle
} }
open func isEqual(to model: any ModelComparisonProtocol) -> Bool {
guard let model = model as? Self else { return false }
return moleculeName == model.moleculeName
&& inverted == model.inverted
&& accessibilityText == model.accessibilityText
&& accessibilityIdentifier == model.accessibilityIdentifier
&& accessibilityTraits == model.accessibilityTraits
}
}
extension Array where Element == RadioButtonLabelModel {
internal func convertToVDSRadioButtonItemModel(surface: Surface,
delegateObject: MVMCoreUIDelegateObject?,
additionalData: [AnyHashable: Any]?) -> [RadioButtonGroup.RadioButtonItemModel] {
return compactMap({ model in
var item = RadioButtonGroup.RadioButtonItemModel()
item.inputId = model.radioButton.fieldKey
item.labelText = model.label.text
if let attributes = model.label.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
item.labelTextAttributes = attributes
}
item.childText = model.subTitle?.text
if let attributes = model.subTitle?.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) {
item.childTextAttributes = attributes
}
item.surface = surface
item.selected = model.radioButton.state
item.enabled = model.radioButton.isEnabled
return item
})
}
} }

Some files were not shown because too many files have changed in this diff Show More