コード例 #1
0
 public static ContentPartDefinitionBuilder WithTextFieldPredefinedList(this ContentPartDefinitionBuilder p, string name, string displayName, string position, string hint, TextFieldPredefinedListEditorSettings settings)
 {
     return(p.WithField(name, f => f
                        .OfType(nameof(TextField))
                        .WithDisplayName(displayName)
                        .WithEditor("PredefinedList")
                        .WithPosition(position)
                        .WithSettings(new TextFieldSettings()
     {
         Hint = hint
     })
                        .WithSettings(settings)
                        ));
 }
コード例 #2
0
ファイル: Grid.cs プロジェクト: StatCan/StatCan.OrchardCore
        private void VCol()
        {
            _contentDefinitionManager.AlterTypeDefinition("VCol", type => type
                                                          .DisplayedAs("VCol")
                                                          .Stereotype("Widget")
                                                          .WithPart("VCol", part => part
                                                                    .WithPosition("0")
                                                                    )
                                                          .WithFlow("1")
                                                          );

            var colsSettings = new TextFieldPredefinedListEditorSettings()
            {
                Editor       = EditorOption.Dropdown,
                DefaultValue = "None",
                Options      = new ListValueOption[] {
                    new ListValueOption()
                    {
                        Name = "None", Value = ""
                    },
                    new ListValueOption()
                    {
                        Name = "Auto", Value = "auto"
                    },
                    new ListValueOption()
                    {
                        Name = "1", Value = "1"
                    },
                    new ListValueOption()
                    {
                        Name = "2", Value = "2"
                    },
                    new ListValueOption()
                    {
                        Name = "3", Value = "3"
                    },
                    new ListValueOption()
                    {
                        Name = "4", Value = "4"
                    },
                    new ListValueOption()
                    {
                        Name = "5", Value = "5"
                    },
                    new ListValueOption()
                    {
                        Name = "6", Value = "6"
                    },
                    new ListValueOption()
                    {
                        Name = "7", Value = "7"
                    },
                    new ListValueOption()
                    {
                        Name = "8", Value = "8"
                    },
                    new ListValueOption()
                    {
                        Name = "9", Value = "9"
                    },
                    new ListValueOption()
                    {
                        Name = "10", Value = "10"
                    },
                    new ListValueOption()
                    {
                        Name = "11", Value = "11"
                    },
                    new ListValueOption()
                    {
                        Name = "12", Value = "12"
                    },
                }
            };

            var offsetSettings = new TextFieldPredefinedListEditorSettings()
            {
                Editor       = EditorOption.Dropdown,
                DefaultValue = "",
                Options      = new ListValueOption[] {
                    new ListValueOption()
                    {
                        Name = "None", Value = ""
                    },
                    new ListValueOption()
                    {
                        Name = "1", Value = "1"
                    },
                    new ListValueOption()
                    {
                        Name = "2", Value = "2"
                    },
                    new ListValueOption()
                    {
                        Name = "3", Value = "3"
                    },
                    new ListValueOption()
                    {
                        Name = "4", Value = "4"
                    },
                    new ListValueOption()
                    {
                        Name = "5", Value = "5"
                    },
                    new ListValueOption()
                    {
                        Name = "6", Value = "6"
                    },
                    new ListValueOption()
                    {
                        Name = "7", Value = "7"
                    },
                    new ListValueOption()
                    {
                        Name = "8", Value = "8"
                    },
                    new ListValueOption()
                    {
                        Name = "9", Value = "9"
                    },
                    new ListValueOption()
                    {
                        Name = "10", Value = "10"
                    },
                    new ListValueOption()
                    {
                        Name = "11", Value = "11"
                    },
                    new ListValueOption()
                    {
                        Name = "12", Value = "12"
                    },
                }
            };

            _contentDefinitionManager.AlterPartDefinition("VCol", part => part
                                                          .WithTextFieldPredefinedList("AlignSelf", "Align Self", "0", new TextFieldPredefinedListEditorSettings()
            {
                Editor       = EditorOption.Dropdown,
                DefaultValue = "",
                Options      = new ListValueOption[] {
                    new ListValueOption()
                    {
                        Name = "None", Value = ""
                    },
                    new ListValueOption()
                    {
                        Name = "Start", Value = "start"
                    },
                    new ListValueOption()
                    {
                        Name = "Center", Value = "center"
                    },
                    new ListValueOption()
                    {
                        Name = "End", Value = "end"
                    },
                    new ListValueOption()
                    {
                        Name = "Auto", Value = "auto"
                    },
                    new ListValueOption()
                    {
                        Name = "Baseline", Value = "baseline"
                    },
                    new ListValueOption()
                    {
                        Name = "Stretch", Value = "stretch"
                    }
                }
            }
                                                                                       )
                                                          .WithTextFieldPredefinedList("Cols", "Cols Xs", "1", colsSettings)
                                                          .WithTextFieldPredefinedList("ColsSm", "Cols Sm", "2", colsSettings)
                                                          .WithTextFieldPredefinedList("ColsMd", "Cols Md", "3", colsSettings)
                                                          .WithTextFieldPredefinedList("ColsLg", "Cols Lg", "4", colsSettings)
                                                          .WithTextFieldPredefinedList("ColsXl", "Cols Xl", "5", colsSettings)
                                                          .WithTextFieldPredefinedList("Offset", "Offset Xs", "6", offsetSettings)
                                                          .WithTextFieldPredefinedList("OffsetSm", "Offset Sm", "7", offsetSettings)
                                                          .WithTextFieldPredefinedList("OffsetMd", "Offset Md", "8", offsetSettings)
                                                          .WithTextFieldPredefinedList("OffsetLg", "Offset Lg", "9", offsetSettings)
                                                          .WithTextFieldPredefinedList("OffsetXl", "Offset Xl", "10", offsetSettings)
                                                          .WithNumericField("Order", "Order Xs", "11")
                                                          .WithNumericField("OrderSm", "Order Sm", "12")
                                                          .WithNumericField("OrderMd", "Order Md", "13")
                                                          .WithNumericField("OrderLg", "Order Lg", "14")
                                                          .WithNumericField("OrderXl", "Order Xl", "15")
                                                          );
        }