diff --git a/docs/Enums/FormComponents.md b/docs/Enums/FormComponents.md index 31c8c60..68f795c 100644 --- a/docs/Enums/FormComponents.md +++ b/docs/Enums/FormComponents.md @@ -85,7 +85,7 @@ |`TFormComponentValue`||`ObjectSelectorBase`|`TProperties`|**abstract**| |`TFormComponentValue`||`SingleObjectSelectorBase`|`TProperties`|**abstract**| |`Kentico.Xperience.Admin.Base.Forms.TileSelectorItem`|`Kentico.Administration.TileSelector`|`TileSelectorComponent`|`TileSelectorProperties`|| -|`TValue`||`DateInputComponentBase`|`TProperties`|**abstract**| +|`TValue`||`DateTimeInputComponentBase`|`TProperties`|**abstract**| |`TValue`||`FormComponent`|`FormComponentProperties`|**abstract**| |`TValue`||`FormComponentWithNestedComponents`|`TProperties`|**abstract**| diff --git a/docs/Model/ContentItemCommonDataModel.md b/docs/Model/ContentItemCommonDataModel.md index 38db9a2..c91fd54 100644 --- a/docs/Model/ContentItemCommonDataModel.md +++ b/docs/Model/ContentItemCommonDataModel.md @@ -28,7 +28,8 @@ This sample describes how to create content item data inside XbyK "ArticleText": "This article is only example of creation UMT model for en-US language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` @@ -44,7 +45,8 @@ This sample describes how to create content item data inside XbyK "ArticleText": "This article is only example of creation UMT model for en-GB language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` diff --git a/docs/Model/ContentItemDataModel.md b/docs/Model/ContentItemDataModel.md index 9c4b11d..3fc5b7c 100644 --- a/docs/Model/ContentItemDataModel.md +++ b/docs/Model/ContentItemDataModel.md @@ -26,7 +26,8 @@ This sample describes how to create content item data inside XbyK "ArticleText": "This article is only example of creation UMT model for en-US language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` @@ -42,7 +43,8 @@ This sample describes how to create content item data inside XbyK "ArticleText": "This article is only example of creation UMT model for en-GB language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` @@ -83,7 +85,8 @@ This sample describes how to create content item data inside XbyK "ArticleTitle": "en-US UMT model creation", "ArticleText": "This article is only example of creation UMT model for en-US language", "RelatedArticles": "[{\u0022WebPageGuid\u0022:\u00226e995319-77e7-475e-9ebb-607bdbf5af9a\u0022}]", - "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]" + "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` @@ -98,6 +101,7 @@ This sample describes how to create content item data inside XbyK "ArticleTitle": "en-GB UMT model creation", "ArticleText": "This article is only example of creation UMT model for en-GB language", "RelatedArticles": "[{\u0022WebPageGuid\u0022:\u00226e995319-77e7-475e-9ebb-607bdbf5af9a\u0022}]", - "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]" + "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 } ``` diff --git a/docs/Model/DataClassModel.md b/docs/Model/DataClassModel.md index f4ebd15..ff2ac5a 100644 --- a/docs/Model/DataClassModel.md +++ b/docs/Model/DataClassModel.md @@ -58,6 +58,22 @@ This sample describes how to create class inside XbyK to hold Article data "ControlName": "Kentico.Administration.TextInput" } }, + { + "AllowEmpty": true, + "Column": "ArticleDecimalNumberSample", + "ColumnSize": 15, + "ColumnType": "decimal", + "Enabled": true, + "Guid": "8e749651-773b-47b9-a888-c541c3c3e1b7", + "Visible": true, + "Properties": { + "FieldCaption": "Article decimal number sample" + }, + "Settings": { + "ControlName": "Kentico.Administration.DecimalNumberInput" + }, + "Precision": 5 + }, { "AllowEmpty": true, "Column": "ArticleText", @@ -275,6 +291,7 @@ Represents information about custom data field |Visible|Field visibility in administration form|bool|| |Properties|[definition](#FormFieldProperties)|Kentico.Xperience.UMT.Model.FormFieldProperties|| |Settings|[definition](#FormFieldSettings)|Kentico.Xperience.UMT.Model.FormFieldSettings|| +|Precision|Specifies precision, relevant for fields with ColumnType "decimal"|int?||

*) value is required

diff --git a/docs/Model/UMT.schema.json b/docs/Model/UMT.schema.json index 94d8985..1d6e5e8 100644 --- a/docs/Model/UMT.schema.json +++ b/docs/Model/UMT.schema.json @@ -16,12 +16,6 @@ "type": "null" } ] - }, - "properties": { - "CustomProperties": { - "type": "object", - "additionalProperties": {} - } } }, "ChannelModel": { @@ -630,6 +624,14 @@ }, "Settings": { "$ref": "#/definitions/FormFieldSettings" + }, + "Precision": { + "type": [ + "integer", + "null" + ], + "description": "Specifies precision, relevant for fields with ColumnType \"decimal\" ", + "format": "int32" } } }, @@ -651,10 +653,6 @@ "string" ], "description": "Friendly name displayed in form" - }, - "CustomProperties": { - "type": "object", - "additionalProperties": {} } } }, @@ -676,10 +674,6 @@ "string" ], "description": "Admin UI Component used for field data editing" - }, - "CustomProperties": { - "type": "object", - "additionalProperties": {} } } }, diff --git a/docs/Samples/basic.json b/docs/Samples/basic.json index 2a0966c..63b22e5 100644 --- a/docs/Samples/basic.json +++ b/docs/Samples/basic.json @@ -196,7 +196,24 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextInput" - } + }, + "Precision": null + }, + { + "AllowEmpty": true, + "Column": "ArticleDecimalNumberSample", + "ColumnSize": 15, + "ColumnType": "decimal", + "Enabled": true, + "Guid": "8e749651-773b-47b9-a888-c541c3c3e1b7", + "Visible": true, + "Properties": { + "FieldCaption": "Article decimal number sample" + }, + "Settings": { + "ControlName": "Kentico.Administration.DecimalNumberInput" + }, + "Precision": 5 }, { "AllowEmpty": true, @@ -211,7 +228,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextArea" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -231,7 +249,8 @@ "MaximumPages": 5, "Sortable": "False", "TreePath": "/Articles" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -249,7 +268,8 @@ "Settings": { "ControlName": "Kentico.Administration.ContentItemSelector", "AllowedContentItemTypeIdentifiers": "[\u00227ed6604e-613b-4ce0-8c21-acfb372c416a\u0022]" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -267,7 +287,8 @@ "Settings": { "ControlName": "Kentico.Administration.TagSelector", "TaxonomyGroup": "[\u0022bd88fd9b-8d36-4d02-a4a6-9a2b26c48488\u0022]" - } + }, + "Precision": null } ] }, @@ -309,7 +330,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextInput" - } + }, + "Precision": null }, { "AllowEmpty": false, @@ -324,7 +346,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextInput" - } + }, + "Precision": null } ] }, @@ -361,7 +384,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextInput" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -376,7 +400,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.TextArea" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -391,7 +416,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.DateTimeInput" - } + }, + "Precision": null }, { "AllowEmpty": true, @@ -406,7 +432,8 @@ }, "Settings": { "ControlName": "Kentico.Administration.Checkbox" - } + }, + "Precision": null } ] }, @@ -595,7 +622,8 @@ "ArticleText": "This article is only example of creation UMT model for en-US language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 }, { "$type": "ContentItemData", @@ -606,7 +634,8 @@ "ArticleText": "This article is only example of creation UMT model for en-GB language", "RelatedArticles": null, "RelatedFaq": null, - "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]" + "CoffeaTaxonomy": "[{\u0022Identifier\u0022:\u0022ffe48372-2bac-4a14-ad8c-c86f3f54c7c5\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 }, { "$type": "ContentItemLanguageMetadata", @@ -704,7 +733,8 @@ "ArticleTitle": "en-US UMT model creation", "ArticleText": "This article is only example of creation UMT model for en-US language", "RelatedArticles": "[{\u0022WebPageGuid\u0022:\u00226e995319-77e7-475e-9ebb-607bdbf5af9a\u0022}]", - "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]" + "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 }, { "$type": "ContentItemReference", @@ -721,7 +751,8 @@ "ArticleTitle": "en-GB UMT model creation", "ArticleText": "This article is only example of creation UMT model for en-GB language", "RelatedArticles": "[{\u0022WebPageGuid\u0022:\u00226e995319-77e7-475e-9ebb-607bdbf5af9a\u0022}]", - "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]" + "RelatedFaq": "[{\u0022Identifier\u0022:\u0022b64b3e3e-f5a9-4d02-8cdb-6d81805c0fee\u0022}]", + "ArticleDecimalNumberSample": 123456.12345 }, { "$type": "ContentItemReference", diff --git a/examples/Kentico.Xperience.UMT.Examples/Samples/ContentItemSamples.cs b/examples/Kentico.Xperience.UMT.Examples/Samples/ContentItemSamples.cs index 4e31390..1029d5f 100644 --- a/examples/Kentico.Xperience.UMT.Examples/Samples/ContentItemSamples.cs +++ b/examples/Kentico.Xperience.UMT.Examples/Samples/ContentItemSamples.cs @@ -66,11 +66,11 @@ public static class ContentItemSamples ["CoffeaTaxonomy"] = System.Text.Json.JsonSerializer.Serialize(new List { new {Identifier = TaxonomySamples.SampleTagCoffeaArabicaGuid}, - }) + }), + ["ArticleDecimalNumberSample"] = 123456.12345M } }; - [Sample("contentitemlanguagemetadata.sample.article.enus", "This sample describes how to create class inside XbyK to hold Content Item Language Metadata", "ContentItemLanguageMetadata Sample")] public static ContentItemLanguageMetadataModel SampleArticleContentItemLanguageMetadataEnUs => new() { @@ -129,7 +129,8 @@ public static class ContentItemSamples ["CoffeaTaxonomy"] = System.Text.Json.JsonSerializer.Serialize(new List { new {Identifier = TaxonomySamples.SampleTagCoffeaArabicaGuid}, - }) + }), + ["ArticleDecimalNumberSample"] = 123456.12345M } }; @@ -221,7 +222,8 @@ public static class ContentItemSamples ["RelatedArticles"] = $$"""[{"WebPageGuid":"{{SampleArticleWebPageItem.WebPageItemGUID}}"}]""", ["RelatedFaq"] = $$""" [{"Identifier":"{{SampleFaqContentItemGuid}}"}] - """ + """, + ["ArticleDecimalNumberSample"] = 123456.12345M } }; @@ -291,7 +293,8 @@ public static class ContentItemSamples ["RelatedArticles"] = $$"""[{"WebPageGuid":"{{SampleArticleWebPageItem.WebPageItemGUID}}"}]""", ["RelatedFaq"] = $$""" [{"Identifier":"{{SampleFaqContentItemGuid}}"}] - """ + """, + ["ArticleDecimalNumberSample"] = 123456.12345M } }; diff --git a/examples/Kentico.Xperience.UMT.Examples/Samples/DataClassSamples.cs b/examples/Kentico.Xperience.UMT.Examples/Samples/DataClassSamples.cs index c42e257..43d6e18 100644 --- a/examples/Kentico.Xperience.UMT.Examples/Samples/DataClassSamples.cs +++ b/examples/Kentico.Xperience.UMT.Examples/Samples/DataClassSamples.cs @@ -39,6 +39,20 @@ public static class DataClassSamples Properties = new FormFieldProperties { FieldCaption = "Article title", }, Settings = new FormFieldSettings { ControlName = "Kentico.Administration.TextInput" } }, + + new() + { + Column = "ArticleDecimalNumberSample", + ColumnType = "decimal", + ColumnSize = 15, + Precision = 5, + AllowEmpty = true, + Visible = true, + Enabled = true, + Guid = new Guid("8E749651-773B-47B9-A888-C541C3C3E1B7"), + Properties = new FormFieldProperties { FieldCaption = "Article decimal number sample", }, + Settings = new FormFieldSettings { ControlName = "Kentico.Administration.DecimalNumberInput" } + }, new() { diff --git a/src/Kentico.Xperience.UMT/InfoAdapter/DataClassAdapter.cs b/src/Kentico.Xperience.UMT/InfoAdapter/DataClassAdapter.cs index 8d69dc5..86d8188 100644 --- a/src/Kentico.Xperience.UMT/InfoAdapter/DataClassAdapter.cs +++ b/src/Kentico.Xperience.UMT/InfoAdapter/DataClassAdapter.cs @@ -63,8 +63,12 @@ public override DataClassInfo Adapt(IUmtModel input) DataType = field.ColumnType, Enabled = field.Enabled, Visible = field.Visible, - Size = field.ColumnSize + Size = field.ColumnSize, }; + if (field.Precision is { } precision) + { + nfi.Precision = precision; + } nfi.Caption = field.Properties.FieldCaption; nfi.Settings[CONTROL_NAME] = field.Settings.ControlName; diff --git a/src/Kentico.Xperience.UMT/Model/DataClassModel.cs b/src/Kentico.Xperience.UMT/Model/DataClassModel.cs index da45309..9b4367d 100644 --- a/src/Kentico.Xperience.UMT/Model/DataClassModel.cs +++ b/src/Kentico.Xperience.UMT/Model/DataClassModel.cs @@ -164,6 +164,11 @@ public class FormField /// /// definition public FormFieldSettings Settings { get; set; } = new(); + + /// + /// Specifies precision, relevant for fields with ColumnType "decimal" + /// + public int? Precision { get; set; } } ///