From 997b92490e4127b7710fdbe93167bee99682fec7 Mon Sep 17 00:00:00 2001 From: "Joe Mayo (MSFT)" Date: Fri, 6 Sep 2024 10:08:02 -0700 Subject: [PATCH] PaYamlV3 schema and OM updates (#713) ## Changes - Remove `Groups` from control containers - Add `ControlInstance.Group` name to allow a control to belong to a group for use in Studio - Removed `InstanceCreationParameters` as no longer needed - Add `ControlInstance.Variant` as this will be part of required properties for some 1P controls - Updated v3 yaml schema: - With all updates above - Added top-level `DataSources` property to PaModule files. --- schemas/pa-yaml/v3.0/pa.schema.yaml | 102 ++++++++--------- src/PAModel/packages.lock.json | 12 -- .../Serialization/PaYamlSerializerTests.cs | 21 +++- .../Models/SchemaV3/ComponentDefinition.cs | 2 - .../PaYaml/Models/SchemaV3/ControlGroup.cs | 12 -- .../PaYaml/Models/SchemaV3/ControlInstance.cs | 11 +- .../SchemaV3/IPaControlInstanceContainer.cs | 1 - .../SchemaV3/InstanceCreationParameters.cs | 42 ------- .../PaYaml/Models/SchemaV3/ScreenInstance.cs | 4 - src/Persistence/packages.lock.json | 43 -------- .../Examples/Src/Screens/FormsScreen2.pa.yaml | 48 +++----- .../v3.0/Examples/Src/Screens/Screen1.pa.yaml | 30 ++--- .../Screens-general-controls.pa.yaml | 60 +++------- src/schemas/pa-yaml/v3.0/pa.schema.yaml | 103 ++++++++---------- 14 files changed, 152 insertions(+), 339 deletions(-) delete mode 100644 src/Persistence/PaYaml/Models/SchemaV3/ControlGroup.cs delete mode 100644 src/Persistence/PaYaml/Models/SchemaV3/InstanceCreationParameters.cs diff --git a/schemas/pa-yaml/v3.0/pa.schema.yaml b/schemas/pa-yaml/v3.0/pa.schema.yaml index d3efd365..de5be810 100644 --- a/schemas/pa-yaml/v3.0/pa.schema.yaml +++ b/schemas/pa-yaml/v3.0/pa.schema.yaml @@ -14,6 +14,9 @@ properties: $ref: "#/definitions/Screens-name-instance-map" ComponentDefinitions: $ref: "#/definitions/ComponentDefinitions-name-instance-map" + DataSources: + $ref: "#/definitions/DataSources-name-instance-map" + defaultSnippets: - label: App body: @@ -56,9 +59,7 @@ definitions: type: object additionalProperties: false properties: - CreationParameters: { $ref: "#/definitions/InstanceCreationParameters" } Properties: { $ref: "#/definitions/Properties-formula-map" } - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } Children-Control-instance-sequence: @@ -170,6 +171,7 @@ definitions: required: [Control] properties: Control: { $ref: "#/definitions/ControlTypeId" } + Group: { $ref: "#/definitions/Control-Group-name" } Properties: { $ref: "#/definitions/Properties-formula-map" } if: required: [Control] @@ -187,6 +189,7 @@ definitions: Control: true ComponentLibraryUniqueName: { $ref: "#/definitions/ComponentLibrary-unique-name" } ComponentName: { $ref: "#/definitions/ComponentDefinition-name" } + Group: true Properties: true - if: properties: @@ -197,73 +200,26 @@ definitions: properties: Control: true ComponentName: { $ref: "#/definitions/CodeComponent-name" } + Group: true Properties: true else: additionalProperties: false properties: Control: true - CreationParameters: { $ref: "#/definitions/InstanceCreationParameters" } + Variant: + type: string + minLength: 1 + Group: true Properties: true - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } - InstanceCreationParameters: - description: A set of optional internal creation parameters coming from the Maker. - type: object - additionalProperties: false - properties: - Variant: - type: string - minLength: 1 - Layout: - type: string - minLength: 1 - ParentTemplate: - description: Metadata needed to identify the parent template that originally created this instance. - type: object - additionalProperties: false - properties: - CompositionName: - description: The name of the composition template that originally created this instance. - type: string - minLength: 1 - Variant: - description: The variant of the parent template that originally created this instance. - type: string - minLength: 1 - MetadataId: - type: string - minLength: 1 - StyleName: - type: string - minLength: 1 - - Groups-of-controls: + Control-Group-name: description: |- - A mapping of groups of controls under this container. The keys of this object represent the name of the Group. + The name of the group of controls to associate this control with. Groups do not impact the behavior of an app, but are used in the Studio to organize controls when editing. - type: object - propertyNames: { $ref: "#/definitions/Control-instance-name" } - additionalProperties: - type: object - required: [ControlNames] - additionalProperties: false - properties: - ControlNames: - description: |- - An array of the names of controls that are part of this group. - A group must have at least two (2) controls in it. - type: array - minItems: 2 - items: { $ref: "#/definitions/Control-instance-name" } - defaultSnippets: - - label: Add Group - body: - ${1:Group1}: - ControlNames: - - ${2:ControlName1} - - ${3:ControlName2} + allOf: + - { $ref: "#/definitions/Control-instance-name" } CodeComponent-name: description: |- @@ -306,7 +262,6 @@ definitions: - Height - Width - OnReset - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } ComponentDefinition-name: @@ -436,6 +391,35 @@ definitions: pattern: |- [.\\/:*?"<>|] + + DataSources-name-instance-map: + type: object + propertyNames: { $ref: "#/definitions/DataSource-name" } + additionalProperties: + $ref: "#/definitions/DataSource-instance" + + DataSource-name: + $ref: "#/definitions/entity-name" + + DataSource-Type: + enum: + - DataverseTable + + DataSource-instance: + type: object + required: [Type] + properties: + Type: { $ref: "#/definitions/DataSource-Type" } + oneOf: + - required: [Type] + additionalProperties: false + properties: + Type: + const: DataverseTable + TableLogicalName: + type: string + minLength: 1 + Properties-formula-map: description: >- A map of property names to formulas. diff --git a/src/PAModel/packages.lock.json b/src/PAModel/packages.lock.json index 2479ac3a..7d21cb1c 100644 --- a/src/PAModel/packages.lock.json +++ b/src/PAModel/packages.lock.json @@ -2,12 +2,6 @@ "version": 1, "dependencies": { ".NETStandard,Version=v2.0": { - "Microsoft.Net.Compilers.Toolset.Framework": { - "type": "Direct", - "requested": "[4.10.0-3.24216.12, )", - "resolved": "4.10.0-3.24216.12", - "contentHash": "Y1T1ZN3cHWToRYZHhRs8xby1tMCkF23Jb//zK+Tdf4ourzwbMQ4GiTRVVFAlWvmA10iVNUyCZucAeLt5XeiDqA==" - }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -103,12 +97,6 @@ } }, "net8.0": { - "Microsoft.Net.Compilers.Toolset.Framework": { - "type": "Direct", - "requested": "[4.10.0-3.24216.12, )", - "resolved": "4.10.0-3.24216.12", - "contentHash": "Y1T1ZN3cHWToRYZHhRs8xby1tMCkF23Jb//zK+Tdf4ourzwbMQ4GiTRVVFAlWvmA10iVNUyCZucAeLt5XeiDqA==" - }, "Newtonsoft.Json": { "type": "Direct", "requested": "[13.0.1, )", diff --git a/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs b/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs index b124e124..ad9349b3 100644 --- a/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs +++ b/src/Persistence.Tests/PaYaml/Serialization/PaYamlSerializerTests.cs @@ -86,18 +86,29 @@ public void DeserializeExamplePaYamlScreen(string path, int expectedScreenProper if (expectedScreenChildrenCount == 0) screen.Children.Should().BeNull(); else + { screen.Children.Should().HaveCount(expectedScreenChildrenCount); + GetGroupCount(screen).Should().Be(expectedScreenGroupsCount); + } if (expectedDescendantsCount == 0) screen.Properties.Should().BeNull(); else screen.DescendantControlInstances().Should().HaveCount(expectedDescendantsCount); - if (expectedScreenGroupsCount == 0) - screen.Properties.Should().BeNull(); - else - screen.Groups.Should().HaveCount(expectedScreenGroupsCount); - screen.DescendantControlInstances().SelectMany(nc => nc.Value.Groups ?? []).Should().HaveCount(expectedTotalGroupsCount - expectedScreenGroupsCount); + screen.DescendantControlInstances().Sum(nc => GetGroupCount(nc.Value)).Should().Be(expectedTotalGroupsCount - expectedScreenGroupsCount); + + static int GetGroupCount(IPaControlInstanceContainer container) + { + if (container.Children is null) + return 0; + + return container.Children + .Select(c => c.Value.GroupName) + .Where(g => g != null) + .Distinct() + .Count(); + } } [TestMethod] diff --git a/src/Persistence/PaYaml/Models/SchemaV3/ComponentDefinition.cs b/src/Persistence/PaYaml/Models/SchemaV3/ComponentDefinition.cs index 8e6c7b47..a3df4a0c 100644 --- a/src/Persistence/PaYaml/Models/SchemaV3/ComponentDefinition.cs +++ b/src/Persistence/PaYaml/Models/SchemaV3/ComponentDefinition.cs @@ -26,8 +26,6 @@ public record ComponentDefinition : IPaControlInstanceContainer public NamedObjectMapping? Properties { get; init; } - public NamedObjectMapping? Groups { get; init; } - public NamedObjectSequence? Children { get; init; } } diff --git a/src/Persistence/PaYaml/Models/SchemaV3/ControlGroup.cs b/src/Persistence/PaYaml/Models/SchemaV3/ControlGroup.cs deleted file mode 100644 index 09838a1a..00000000 --- a/src/Persistence/PaYaml/Models/SchemaV3/ControlGroup.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -namespace Microsoft.PowerPlatform.PowerApps.Persistence.PaYaml.Models.SchemaV3; - -/// -/// Represents a group of controls under the same parent. -/// -public record ControlGroup -{ - public string[] ControlNames { get; init; } = []; -} diff --git a/src/Persistence/PaYaml/Models/SchemaV3/ControlInstance.cs b/src/Persistence/PaYaml/Models/SchemaV3/ControlInstance.cs index 77ef5152..5861025e 100644 --- a/src/Persistence/PaYaml/Models/SchemaV3/ControlInstance.cs +++ b/src/Persistence/PaYaml/Models/SchemaV3/ControlInstance.cs @@ -20,15 +20,20 @@ public ControlInstance(string controlTypeId) [property: YamlMember(Alias = "Control")] public required string ControlTypeId { get; init; } + public string? Variant { get; init; } + public string? ComponentName { get; init; } public string? ComponentLibraryUniqueName { get; init; } - public InstanceCreationParameters? CreationParameters { get; init; } + /// + /// The name of the group of controls that this control should be grouped with. + /// This does not impact the visual layout of the control or behavior, but is used to group controls together for organizational purposes from within the Studio. + /// + [property: YamlMember(Alias = "Group")] + public string? GroupName { get; init; } public NamedObjectMapping? Properties { get; init; } - public NamedObjectMapping? Groups { get; init; } - public NamedObjectSequence? Children { get; init; } } diff --git a/src/Persistence/PaYaml/Models/SchemaV3/IPaControlInstanceContainer.cs b/src/Persistence/PaYaml/Models/SchemaV3/IPaControlInstanceContainer.cs index 06b67522..7e9252aa 100644 --- a/src/Persistence/PaYaml/Models/SchemaV3/IPaControlInstanceContainer.cs +++ b/src/Persistence/PaYaml/Models/SchemaV3/IPaControlInstanceContainer.cs @@ -5,6 +5,5 @@ namespace Microsoft.PowerPlatform.PowerApps.Persistence.PaYaml.Models.SchemaV3; public interface IPaControlInstanceContainer { - NamedObjectMapping? Groups { get; } NamedObjectSequence? Children { get; } } diff --git a/src/Persistence/PaYaml/Models/SchemaV3/InstanceCreationParameters.cs b/src/Persistence/PaYaml/Models/SchemaV3/InstanceCreationParameters.cs deleted file mode 100644 index 6d52ac56..00000000 --- a/src/Persistence/PaYaml/Models/SchemaV3/InstanceCreationParameters.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -namespace Microsoft.PowerPlatform.PowerApps.Persistence.PaYaml.Models.SchemaV3; - -/// -/// Optional parameters for creating an instance of a control or screen. -/// This object only contains editor-state parameters which are not generally known to customers/authors, and is not expected to be modified by them. -/// -public record InstanceCreationParameters : ISupportsIsEmpty -{ - public string? Variant { get; init; } - - public string? Layout { get; init; } - - public ParentTemplateCreationParameter? ParentTemplate { get; init; } - - public string? MetadataId { get; init; } - - public string? StyleName { get; init; } - - public bool IsEmpty() - { - return Variant == null - && Layout == null - && (ParentTemplate == null || ParentTemplate.IsEmpty()) - && MetadataId == null - && StyleName == null; - } -} - -public class ParentTemplateCreationParameter : ISupportsIsEmpty -{ - public string? CompositionName { get; init; } - - public string? Variant { get; init; } - - public bool IsEmpty() - { - return CompositionName == null && Variant == null; - } -} diff --git a/src/Persistence/PaYaml/Models/SchemaV3/ScreenInstance.cs b/src/Persistence/PaYaml/Models/SchemaV3/ScreenInstance.cs index 8459ddbe..e67118bc 100644 --- a/src/Persistence/PaYaml/Models/SchemaV3/ScreenInstance.cs +++ b/src/Persistence/PaYaml/Models/SchemaV3/ScreenInstance.cs @@ -7,11 +7,7 @@ namespace Microsoft.PowerPlatform.PowerApps.Persistence.PaYaml.Models.SchemaV3; public record ScreenInstance : IPaControlInstanceContainer { - public InstanceCreationParameters? CreationParameters { get; init; } - public NamedObjectMapping? Properties { get; init; } - public NamedObjectMapping? Groups { get; init; } - public NamedObjectSequence? Children { get; init; } } diff --git a/src/Persistence/packages.lock.json b/src/Persistence/packages.lock.json index 31e5de72..b9b22b6c 100644 --- a/src/Persistence/packages.lock.json +++ b/src/Persistence/packages.lock.json @@ -2,15 +2,6 @@ "version": 1, "dependencies": { "net8.0": { - "JsonSchema.Net": { - "type": "Direct", - "requested": "[7.1.0, )", - "resolved": "7.1.0", - "contentHash": "4DmCZQdVLNolzghMVK1oO49jZpvx7wVCP3OQEzxU5GK/OEhHcg+CAiAR8P/z69PT7STEIlguxb35nkFndZl2WA==", - "dependencies": { - "JsonPointer.Net": "5.0.0" - } - }, "Microsoft.Extensions.Logging": { "type": "Direct", "requested": "[8.0.0, )", @@ -22,12 +13,6 @@ "Microsoft.Extensions.Options": "8.0.0" } }, - "Microsoft.Net.Compilers.Toolset.Framework": { - "type": "Direct", - "requested": "[4.10.0-3.24216.12, )", - "resolved": "4.10.0-3.24216.12", - "contentHash": "Y1T1ZN3cHWToRYZHhRs8xby1tMCkF23Jb//zK+Tdf4ourzwbMQ4GiTRVVFAlWvmA10iVNUyCZucAeLt5XeiDqA==" - }, "Microsoft.PowerFx.Core": { "type": "Direct", "requested": "[1.2.0, )", @@ -39,40 +24,12 @@ "System.Collections.Immutable": "6.0.0" } }, - "Yaml2JsonNode": { - "type": "Direct", - "requested": "[2.1.0, )", - "resolved": "2.1.0", - "contentHash": "7rjrWyPVZGnd/udlNDAZWg24+4LMltQq1CJLKpoGA1Ee8YVVtqoqAWfdB2U0KhkkdBijPd694VIfdACvSLX9/A==", - "dependencies": { - "YamlDotNet": "15.1.2" - } - }, "YamlDotNet": { "type": "Direct", "requested": "[15.1.6, )", "resolved": "15.1.6", "contentHash": "T/cQEK/KHK96Q8kytJ4iUGDXg1/fj2Qtk6rCQeIlHYU1zTeyGVHW0QNZgREQyxZpygGMDMmrXNWt0sj5TsQnjA==" }, - "Humanizer.Core": { - "type": "Transitive", - "resolved": "2.14.1", - "contentHash": "lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==" - }, - "Json.More.Net": { - "type": "Transitive", - "resolved": "2.0.1.2", - "contentHash": "uF3QeiaXEfH92emz0/BWUiNtMSfxIIvgynuB0Bf1vF4s8eWTcZitBx9l+g/FDaJk5XxqBv9buQXizXKQcXFG1w==" - }, - "JsonPointer.Net": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "fm4T5w20AY6C+p5/pJr0vrXRNGgtSfHl34I1LxC9zdPwS9S3j0GiR1Mz/CVPWKDXXGDpCt1APHpCq7kn5adCfA==", - "dependencies": { - "Humanizer.Core": "2.14.1", - "Json.More.Net": "2.0.1.2" - } - }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "6.0.0", diff --git a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/FormsScreen2.pa.yaml b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/FormsScreen2.pa.yaml index 2b894063..5313b8da 100644 --- a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/FormsScreen2.pa.yaml +++ b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/FormsScreen2.pa.yaml @@ -4,8 +4,7 @@ Screens: Children: - ScreenContainer1: Control: GroupContainer - CreationParameters: - Variant: horizontalAutoLayoutContainer + Variant: horizontalAutoLayoutContainer Properties: Fill: =RGBA(245, 245, 245, 1) Height: =Parent.Height @@ -22,8 +21,7 @@ Screens: Children: - LeftContainer1: Control: GroupContainer - CreationParameters: - Variant: verticalAutoLayoutContainer + Variant: verticalAutoLayoutContainer Properties: Fill: =RGBA(255, 255, 255, 1) LayoutDirection: =LayoutDirection.Vertical @@ -47,8 +45,7 @@ Screens: Children: - "First Name_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="firstname" @@ -123,8 +120,7 @@ Screens: - "Last Name_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="lastname" @@ -199,8 +195,7 @@ Screens: - "Company Name_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: blankPolymorphicEditCard + Variant: blankPolymorphicEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="_parentcustomerid_value" @@ -216,8 +211,7 @@ Screens: - "Job Title_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="jobtitle" @@ -292,8 +286,7 @@ Screens: - "Mobile Phone_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="mobilephone" @@ -368,8 +361,7 @@ Screens: - "User Name_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="adx_identity_username" @@ -444,8 +436,7 @@ Screens: - "Address 1_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualViewCard + Variant: textualViewCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="address1_composite" @@ -487,8 +478,7 @@ Screens: - Website_DataCard1: Control: TypedDataCard - CreationParameters: - Variant: urlEditCard + Variant: urlEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="websiteurl" @@ -561,8 +551,7 @@ Screens: - Birthday_DataCard1: Control: TypedDataCard - CreationParameters: - Variant: dateEditCard + Variant: dateEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="birthdate" @@ -634,8 +623,7 @@ Screens: - Description_DataCard1: Control: TypedDataCard - CreationParameters: - Variant: textualMultiLineEditCard + Variant: textualMultiLineEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="description" @@ -710,8 +698,7 @@ Screens: - "Full Name_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualViewCard + Variant: textualViewCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="fullname" @@ -753,8 +740,7 @@ Screens: - Email_DataCard1: Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="emailaddress1" @@ -829,8 +815,7 @@ Screens: - "Business Phone_DataCard1": Control: TypedDataCard - CreationParameters: - Variant: textualEditCard + Variant: textualEditCard Properties: BorderStyle: =BorderStyle.Solid DataField: ="telephone1" @@ -905,8 +890,7 @@ Screens: - RightContainer1: Control: GroupContainer - CreationParameters: - Variant: verticalAutoLayoutContainer + Variant: verticalAutoLayoutContainer Properties: Fill: =RGBA(255, 255, 255, 1) LayoutDirection: =LayoutDirection.Vertical diff --git a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/Screen1.pa.yaml b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/Screen1.pa.yaml index a5a1581c..c14f1354 100644 --- a/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/Screen1.pa.yaml +++ b/src/schemas-tests/pa-yaml/v3.0/Examples/Src/Screens/Screen1.pa.yaml @@ -4,16 +4,6 @@ Screens: Fill: =RGBA(200, 200, 200, 1) OnVisible: |- =Set(var1, "hello world!") - Groups: - Group1: - ControlNames: - - Text Input 1 - - "Control name with special '*&:/\\\" chars" - BasicControlsCopyGroup: - ControlNames: - - Label1_2 - - TextInput1_2 - - Button1_2 Children: - Label1: Control: Label @@ -23,29 +13,25 @@ Screens: Y: =40 - Text Input 1: Control: TextInput + Group: Group1 Properties: Default: ="Default input" X: =40 Y: =80 - "Control name with special '*&:/\\\" chars": Control: Button + Group: Group1 Properties: Text: ="A Button" X: =40 Y: =138 - Gallery1: Control: Gallery - CreationParameters: - Variant: BrowseLayout_Vertical_TwoTextOneImageVariant_ver5.0 + Variant: BrowseLayout_Vertical_TwoTextOneImageVariant_ver5.0 Properties: DelayItemLoading: =true Height: =479 Items: =CustomGallerySample - Groups: - TitleSubTitleGroup: - ControlNames: - - Title1 - - Subtitle1 Children: - Image1: Control: Image @@ -53,9 +39,8 @@ Screens: Height: =61 OnSelect: =Select(Parent) - NextArrow1: - Control: Icon - CreationParameters: - Variant: ChevronRight + Control: Classic/Icon + Variant: ChevronRight Properties: AccessibleLabel: =Self.Tooltip Color: =RGBA(166, 166, 166, 1) @@ -86,6 +71,7 @@ Screens: Width: =4 - Title1: Control: Label + Group: TitleSubTitleGroup Properties: FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal) Height: =25 @@ -101,6 +87,7 @@ Screens: Y: =(Parent.TemplateHeight - (Self.Size * 1.8 + Subtitle1.Size * 1.8)) / 2 - Subtitle1: Control: Label + Group: TitleSubTitleGroup Properties: FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal) Height: =35 @@ -125,6 +112,7 @@ Screens: - Label1_2: Control: Label + Group: BasicControlsCopyGroup Properties: DisplayMode: =DisplayMode.View Fill: =RGBA(232, 244, 217, 1) @@ -135,6 +123,7 @@ Screens: - TextInput1_2: Control: TextInput + Group: BasicControlsCopyGroup Properties: Default: ="Default input" DisplayMode: =DisplayMode.View @@ -145,6 +134,7 @@ Screens: - Button1_2: Control: Button + Group: BasicControlsCopyGroup Properties: DisplayMode: =DisplayMode.View Fill: =RGBA(232, 244, 217, 1) diff --git a/src/schemas-tests/pa-yaml/v3.0/FullSchemaUses/Screens-general-controls.pa.yaml b/src/schemas-tests/pa-yaml/v3.0/FullSchemaUses/Screens-general-controls.pa.yaml index 3dcd16af..8cb3b864 100644 --- a/src/schemas-tests/pa-yaml/v3.0/FullSchemaUses/Screens-general-controls.pa.yaml +++ b/src/schemas-tests/pa-yaml/v3.0/FullSchemaUses/Screens-general-controls.pa.yaml @@ -4,17 +4,11 @@ Screens: Prop2: =screen1Prop2 Prop1: =screen1Prop1 - Groups: - Group1: - ControlNames: - - ctrlB - - ctrlA - Children: - ctrlB: Control: Label - CreationParameters: - Variant: variantB + Variant: variantB + Group: Group1 Properties: Prop2: =ctrlBProp2 Prop1: =ctrlBProp1 @@ -22,62 +16,40 @@ Screens: # Purposely set out of name sorting order to ensure ordering is maintained - ctrlA: Control: Label - CreationParameters: - Variant: variantA + Variant: variantA + Group: Group1 Properties: Prop2: =ctrlAProp2 Prop1: =ctrlAProp1 screenName1: - CreationParameters: - Variant: variant1 - Layout: layout1 - MetadataId: metadataId1 - StyleName: styleName1 - ParentTemplate: - CompositionName: compositionName1 - Variant: compositionTemplateVariant1 Children: - ctrlC: - Control: fooWithChildren - CreationParameters: - Variant: variant2 - Layout: layout2 - MetadataId: metadataId2 - StyleName: styleName2 - ParentTemplate: - CompositionName: compositionName2 - Variant: compositionTemplateVariant2 + Control: FooWithChildren + Variant: variant2 Properties: Prop2: =ctrlAProp2 Prop1: =ctrlAProp1 - Groups: - Group1: - ControlNames: - - ctrlC0 - - ctrlC1 Children: - ctrlC0: - Control: bar - CreationParameters: - Variant: variantC0 + Control: Bar + Variant: variantC0 + Group: Group1 Properties: Prop2: =ctrlC0Prop2 Prop1: =ctrlC0Prop1 Children: - ctrlC00: - Control: car - CreationParameters: - Variant: variantC00 + Control: Car + Variant: variantC00 - ctrlC1: - Control: bar - CreationParameters: - Variant: variantC1 + Control: Bar + Variant: variantC1 + Group: Group1 Properties: Prop2: =ctrlC1Prop2 Prop1: =ctrlC1Prop1 Children: - ctrlC10: - Control: dog - CreationParameters: - Variant: variantC10 + Control: Dog + Variant: variantC10 diff --git a/src/schemas/pa-yaml/v3.0/pa.schema.yaml b/src/schemas/pa-yaml/v3.0/pa.schema.yaml index c3421e19..03b7842f 100644 --- a/src/schemas/pa-yaml/v3.0/pa.schema.yaml +++ b/src/schemas/pa-yaml/v3.0/pa.schema.yaml @@ -19,6 +19,9 @@ properties: $ref: "#/definitions/Screens-name-instance-map" ComponentDefinitions: $ref: "#/definitions/ComponentDefinitions-name-instance-map" + DataSources: + $ref: "#/definitions/DataSources-name-instance-map" + defaultSnippets: - label: App body: @@ -62,9 +65,7 @@ definitions: type: object additionalProperties: false properties: - CreationParameters: { $ref: "#/definitions/InstanceCreationParameters" } Properties: { $ref: "#/definitions/Properties-formula-map" } - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } Children-Control-instance-sequence: @@ -187,6 +188,7 @@ definitions: required: [Control] properties: Control: { $ref: "#/definitions/ControlTypeId" } + Group: { $ref: "#/definitions/Control-Group-name" } Properties: { $ref: "#/definitions/Properties-formula-map" } if: required: [Control] @@ -204,6 +206,7 @@ definitions: Control: true ComponentLibraryUniqueName: { $ref: "#/definitions/ComponentLibrary-unique-name" } ComponentName: { $ref: "#/definitions/ComponentDefinition-name" } + Group: true Properties: true # Note: Component instances do not support Variants or Children. - if: @@ -215,6 +218,7 @@ definitions: properties: Control: true ComponentName: { $ref: "#/definitions/CodeComponent-name" } + Group: true Properties: true # Note: CodeComponent instances do not support Variants or Children. else: @@ -222,69 +226,20 @@ definitions: additionalProperties: false properties: Control: true - CreationParameters: { $ref: "#/definitions/InstanceCreationParameters" } + Variant: + type: string + minLength: 1 + Group: true Properties: true - # Depending on the ControlTypeId, it may or may not actually support Groups - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } - InstanceCreationParameters: - description: A set of optional internal creation parameters coming from the Maker. - type: object - additionalProperties: false - properties: - Variant: - type: string - minLength: 1 - Layout: - type: string - minLength: 1 - ParentTemplate: - description: Metadata needed to identify the parent template that originally created this instance. - type: object - additionalProperties: false - properties: - CompositionName: - description: The name of the composition template that originally created this instance. - type: string - minLength: 1 - Variant: - description: The variant of the parent template that originally created this instance. - type: string - minLength: 1 - MetadataId: - type: string - minLength: 1 - StyleName: - type: string - minLength: 1 - - Groups-of-controls: + Control-Group-name: description: |- - A mapping of groups of controls under this container. The keys of this object represent the name of the Group. + The name of the group of controls to associate this control with. Groups do not impact the behavior of an app, but are used in the Studio to organize controls when editing. - type: object - propertyNames: { $ref: "#/definitions/Control-instance-name" } - additionalProperties: - type: object - required: [ControlNames] - additionalProperties: false - properties: - ControlNames: - description: |- - An array of the names of controls that are part of this group. - A group must have at least two (2) controls in it. - type: array - minItems: 2 - items: { $ref: "#/definitions/Control-instance-name" } - defaultSnippets: - - label: Add Group - body: - ${1:Group1}: - ControlNames: - - ${2:ControlName1} - - ${3:ControlName2} + allOf: + - { $ref: "#/definitions/Control-instance-name" } CodeComponent-name: description: |- @@ -329,7 +284,6 @@ definitions: - Height - Width - OnReset - Groups: { $ref: "#/definitions/Groups-of-controls" } Children: { $ref: "#/definitions/Children-Control-instance-sequence" } ComponentDefinition-name: @@ -471,6 +425,35 @@ definitions: pattern: |- [.\\/:*?"<>|] + + DataSources-name-instance-map: + type: object + propertyNames: { $ref: "#/definitions/DataSource-name" } + additionalProperties: + $ref: "#/definitions/DataSource-instance" + + DataSource-name: + $ref: "#/definitions/entity-name" + + DataSource-Type: + enum: + - DataverseTable + + DataSource-instance: + type: object + required: [Type] + properties: + Type: { $ref: "#/definitions/DataSource-Type" } + oneOf: + - required: [Type] + additionalProperties: false + properties: + Type: + const: DataverseTable + TableLogicalName: + type: string + minLength: 1 + Properties-formula-map: description: >- A map of property names to formulas.