diff --git a/src/Framework/Framework/Controls/KnockoutBindingGroup.cs b/src/Framework/Framework/Controls/KnockoutBindingGroup.cs index aadc0a5c07..d1565bdbdb 100644 --- a/src/Framework/Framework/Controls/KnockoutBindingGroup.cs +++ b/src/Framework/Framework/Controls/KnockoutBindingGroup.cs @@ -85,7 +85,17 @@ protected virtual string GetKnockoutBindingExpression(DotvvmBindableObject obj, public override string ToString() { if (entries.Count == 0) return "{}"; - return "{ " + string.Join(", ", entries) + " }"; + bool multiline = false; + foreach (var entry in entries) + if (entry.Expression.Contains('\n')) + { + multiline = true; + break; + } + if (multiline) + return "{\n" + string.Join(",\n", entries) + "\n}"; + else + return "{ " + string.Join(", ", entries) + " }"; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/src/Tests/ControlTests/testoutputs/AutoUITests.BasicColumn.html b/src/Tests/ControlTests/testoutputs/AutoUITests.BasicColumn.html index 287823dd09..b418550161 100644 --- a/src/Tests/ControlTests/testoutputs/AutoUITests.BasicColumn.html +++ b/src/Tests/ControlTests/testoutputs/AutoUITests.BasicColumn.html @@ -3,7 +3,7 @@ - +
diff --git a/src/Tests/ControlTests/testoutputs/AutoUITests.BasicGrid.html b/src/Tests/ControlTests/testoutputs/AutoUITests.BasicGrid.html index ab33b4c923..117a6f076c 100644 --- a/src/Tests/ControlTests/testoutputs/AutoUITests.BasicGrid.html +++ b/src/Tests/ControlTests/testoutputs/AutoUITests.BasicGrid.html @@ -3,7 +3,7 @@ - +
diff --git a/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html b/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html index 7f541e0b71..0b6f4a1cde 100644 --- a/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html +++ b/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html @@ -1,7 +1,7 @@ -
    +
    • ««
    • diff --git a/src/Tests/ControlTests/testoutputs/GridViewTests.RequiredResourceInEditTemplate.html b/src/Tests/ControlTests/testoutputs/GridViewTests.RequiredResourceInEditTemplate.html index 0e56043937..d164cdd122 100644 --- a/src/Tests/ControlTests/testoutputs/GridViewTests.RequiredResourceInEditTemplate.html +++ b/src/Tests/ControlTests/testoutputs/GridViewTests.RequiredResourceInEditTemplate.html @@ -3,7 +3,7 @@ - +
      diff --git a/src/Tests/ControlTests/testoutputs/MarkupControlTests.MarkupControl_PassingStaticCommand.html b/src/Tests/ControlTests/testoutputs/MarkupControlTests.MarkupControl_PassingStaticCommand.html index 1f82d436d3..43851c8d8c 100644 --- a/src/Tests/ControlTests/testoutputs/MarkupControlTests.MarkupControl_PassingStaticCommand.html +++ b/src/Tests/ControlTests/testoutputs/MarkupControlTests.MarkupControl_PassingStaticCommand.html @@ -3,9 +3,11 @@ -
      (dotvvm.applyPostbackHandlers(async (options) => { await dotvvm.staticCommandPostback("WARNING/NOT/ENCRYPTED+++WyJEb3RWVk0uRnJhbWV3b3JrLlRlc3RzLkJpbmRpbmcuVGVzdFNlcnZpY2UsIERvdFZWTS5GcmFtZXdvcmsuVGVzdHMiLCJTYXZlIixbXSwxLG51bGwsIkFRQT0iXQ==", [$context.$parent.int.state], options); -},$element,[],args,$context)) }"> +},$element,[],args,$context)) +}"> -
      (dotvvm.applyPostbackHandlers(async (options) => { await dotvvm.staticCommandPostback("WARNING/NOT/ENCRYPTED+++WyJEb3RWVk0uRnJhbWV3b3JrLlRlc3RzLkJpbmRpbmcuVGVzdFNlcnZpY2UsIERvdFZWTS5GcmFtZXdvcmsuVGVzdHMiLCJTYXZlIixbXSwxLG51bGwsIkFRQT0iXQ==", [$context.$rawData.state], options); -},$element,[],args,$context)) }"> +},$element,[],args,$context)) +}"> +
      @@ -23,7 +23,7 @@ - +
      diff --git a/src/Tests/Runtime/config-tests/ConfigurationSerializationTests.SerializeDefaultConfig.json b/src/Tests/Runtime/config-tests/ConfigurationSerializationTests.SerializeDefaultConfig.json index 042ab8074d..a8684a57a0 100644 --- a/src/Tests/Runtime/config-tests/ConfigurationSerializationTests.SerializeDefaultConfig.json +++ b/src/Tests/Runtime/config-tests/ConfigurationSerializationTests.SerializeDefaultConfig.json @@ -348,6 +348,35 @@ "isCompileTimeOnly": true } }, + "DotVVM.Framework.Controls.AppendableDataPager": { + "DataSet": { + "type": "DotVVM.Framework.Controls.IPageableGridViewDataSet, DotVVM.Core", + "required": true, + "onlyBindings": true + }, + "EndTemplate": { + "type": "DotVVM.Framework.Controls.ITemplate, DotVVM.Framework", + "mappingMode": "InnerElement", + "onlyHardcoded": true + }, + "LoadData": { + "type": "DotVVM.Framework.Binding.Expressions.ICommandBinding, DotVVM.Framework", + "required": true, + "onlyBindings": true + }, + "LoadTemplate": { + "type": "DotVVM.Framework.Controls.ITemplate, DotVVM.Framework", + "dataContextChange": [ + { + "$type": "DotVVM.Framework.Binding.HelperNamespace.DataPagerApi+AddParameterDataContextChangeAttribute, DotVVM.Framework", + "Name": "_dataPager", + "TypeId": "DotVVM.Framework.Binding.HelperNamespace.DataPagerApi+AddParameterDataContextChangeAttribute, DotVVM.Framework" + } + ], + "mappingMode": "InnerElement", + "onlyHardcoded": true + } + }, "DotVVM.Framework.Controls.AuthenticatedView": { "AuthenticatedTemplate": { "type": "DotVVM.Framework.Controls.ITemplate, DotVVM.Framework", @@ -375,6 +404,10 @@ "type": "DotVVM.Framework.Binding.Expressions.Command, DotVVM.Framework", "isCommand": true }, + "ClickArguments": { + "type": "System.Collections.Generic.List`1[[System.Object, CoreLibrary]]", + "mappingMode": "Exclude" + }, "Enabled": { "type": "System.Boolean", "defaultValue": true @@ -731,6 +764,10 @@ "defaultValue": false, "onlyHardcoded": true }, + "LoadData": { + "type": "DotVVM.Framework.Binding.Expressions.ICommandBinding, DotVVM.Framework", + "onlyBindings": true + }, "RowDecorators": { "type": "System.Collections.Generic.List`1[[DotVVM.Framework.Controls.Decorator, DotVVM.Framework, Version=***, Culture=neutral, PublicKeyToken=23f3607db32275da]]", "dataContextChange": [ @@ -1974,6 +2011,12 @@ "assembly": "DotVVM.Framework", "baseType": "DotVVM.Framework.Controls.DotvvmControl, DotVVM.Framework" }, + "DotVVM.Framework.Controls.AppendableDataPager": { + "assembly": "DotVVM.Framework", + "baseType": "DotVVM.Framework.Controls.HtmlGenericControl, DotVVM.Framework", + "defaultContentProperty": "LoadTemplate", + "withoutContent": true + }, "DotVVM.Framework.Controls.AuthenticatedView": { "assembly": "DotVVM.Framework", "baseType": "DotVVM.Framework.Controls.ConfigurableHtmlControl, DotVVM.Framework", diff --git a/src/Tests/ViewModel/GridViewDataSetTests.cs b/src/Tests/ViewModel/GridViewDataSetTests.cs index e3347cdd4c..e812d8daea 100644 --- a/src/Tests/ViewModel/GridViewDataSetTests.cs +++ b/src/Tests/ViewModel/GridViewDataSetTests.cs @@ -128,7 +128,7 @@ public void GridViewDataSet_DataPagerCommands_StaticCommand() var goToFirstPage = CompileBinding(commands.GoToFirstPage); Console.WriteLine(goToFirstPage); - XAssert.Equal("dotvvm.applyPostbackHandlers(async (options)=>{let vm=options.viewModel;dotvvm.dataSet.translations.PagingOptions.goToFirstPage(vm.PagingOptions);return await dotvvm.dataSet.loadDataSet(vm,options.knockoutContext.$gridViewDataSetHelper.loadDataSet);},this)", goToFirstPage); + XAssert.Equal("dotvvm.applyPostbackHandlers(async (options)=>{let cx=options.knockoutContext;return await dotvvm.dataSet.loadDataSet(options.viewModel,(options)=>dotvvm.dataSet.translations.PagingOptions.goToFirstPage(ko.unwrap(options).PagingOptions),cx.$gridViewDataSetHelper.loadDataSet,cx.$gridViewDataSetHelper.postProcessor);},this)", goToFirstPage); } private string CompileBinding(ICommandBinding staticCommand)