From 243a0b1fd51b5b236e803859ab3593256ca95fce Mon Sep 17 00:00:00 2001 From: nesalang Date: Tue, 28 Sep 2021 22:24:25 -0700 Subject: [PATCH] [shared] table update --- source/shared/cpp/ObjectModel/TableCell.cpp | 7 +++++++ source/shared/cpp/ObjectModel/TableRow.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/source/shared/cpp/ObjectModel/TableCell.cpp b/source/shared/cpp/ObjectModel/TableCell.cpp index 4c87518638..3f817a853c 100644 --- a/source/shared/cpp/ObjectModel/TableCell.cpp +++ b/source/shared/cpp/ObjectModel/TableCell.cpp @@ -12,9 +12,16 @@ namespace AdaptiveCards std::shared_ptr TableCell::DeserializeTableCell(ParseContext& context, const Json::Value& value) { + const auto& idProperty = ParseUtil::GetString(value, AdaptiveCardSchemaKey::Id); + const InternalId internalId = InternalId::Next(); + + context.PushElement(idProperty, internalId); + auto cell = StyledCollectionElement::Deserialize(context, value); cell->SetRtl(ParseUtil::GetOptionalBool(value, AdaptiveCardSchemaKey::Rtl)); + context.PopElement(); + return cell; } diff --git a/source/shared/cpp/ObjectModel/TableRow.cpp b/source/shared/cpp/ObjectModel/TableRow.cpp index 46cc5f18a9..d5e8e16501 100644 --- a/source/shared/cpp/ObjectModel/TableRow.cpp +++ b/source/shared/cpp/ObjectModel/TableRow.cpp @@ -91,6 +91,11 @@ namespace AdaptiveCards std::shared_ptr TableRow::DeserializeTableRow(ParseContext& context, const Json::Value& json) { + const auto& idProperty = ParseUtil::GetString(json, AdaptiveCardSchemaKey::Id); + const InternalId internalId = InternalId::Next(); + + context.PushElement(idProperty, internalId); + std::shared_ptr tableRow = BaseCardElement::Deserialize(context, json); tableRow->SetHorizontalCellContentAlignment(ParseUtil::GetOptionalEnumValue( @@ -98,10 +103,13 @@ namespace AdaptiveCards tableRow->SetVerticalCellContentAlignment(ParseUtil::GetOptionalEnumValue( json, AdaptiveCardSchemaKey::VerticalCellContentAlignment, VerticalContentAlignmentFromString)); tableRow->SetStyle(ParseUtil::GetEnumValue(json, AdaptiveCardSchemaKey::Style, ContainerStyle::None, ContainerStyleFromString)); + auto cells = ParseUtil::GetElementCollectionOfSingleType( context, json, AdaptiveCardSchemaKey::Cells, &TableCell::DeserializeTableCell, false); tableRow->SetCells(cells); + context.PopElement(); + return tableRow; } }