public override IDictionary <string, object> ToValueEditor(object configuration)
        {
            var config = base.ToValueEditor(configuration);

            if (config.TryGetValue(Items, out var items) && items is JArray array && array.Count > 0)
            {
                var types = new List <Type>();

                foreach (var item in array)
                {
                    var type = TypeFinder.GetTypeByName(item.Value <string>());
                    if (type != null)
                    {
                        types.Add(type);
                    }
                }

                config[Items]   = _service.GetConfigurationEditors <IConfigurationEditorItem>(types);
                config[OrderBy] = string.Empty; // Set to empty, so to preserve the selected order.
            }

            if (config.ContainsKey(OverlayView) == false)
            {
                config.Add(OverlayView, IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorOverlayViewPath));
            }

            return(config);
        }
        public ConfigurationEditorConfigurationEditor()
            : base()
        {
            _service = new ConfigurationEditorService();

            var items = _service
                        .GetConfigurationEditors <IConfigurationEditorItem>(onlyPublic: true, ignoreFields: true)
                        .Select(x => new DataListItem
            {
                Icon        = x.Icon,
                Name        = x.Name,
                Description = x.Description,
                Value       = x.Type
            });

            Fields.Add(
                Items,
                nameof(Items),
                "Select the configuration editors to use.",
                IOHelper.ResolveUrl(ItemPickerDataEditor.DataEditorViewPath),
                new Dictionary <string, object>
            {
                { AllowDuplicatesConfigurationField.AllowDuplicates, Constants.Values.False },
                { ItemPickerConfigurationEditor.Items, items },
                { ItemPickerTypeConfigurationField.ListType, ItemPickerTypeConfigurationField.List },
                { ItemPickerConfigurationEditor.OverlayView, IOHelper.ResolveUrl(ItemPickerDataEditor.DataEditorOverlayViewPath) },
                { EnableDevModeConfigurationField.EnableDevMode, Constants.Values.False },
            });

            Fields.Add(new EnableFilterConfigurationField());
            Fields.Add(new OverlaySizeConfigurationField());
            Fields.Add(new MaxItemsConfigurationField());
            Fields.Add(new DisableSortingConfigurationField());
        }
        public DataListConfigurationEditor()
            : base()
        {
            var configEditorViewPath      = IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorViewPath);
            var defaultConfigEditorConfig = new Dictionary <string, object>
            {
                { MaxItemsConfigurationField.MaxItems, 1 },
                { DisableSortingConfigurationField.DisableSorting, Constants.Values.True },
                { OverlaySizeConfigurationField.OverlaySize, OverlaySizeConfigurationField.Small },
                { ConfigurationEditorConfigurationEditor.OverlayView, IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorOverlayViewPath) },
                { EnableDevModeConfigurationField.EnableDevMode, Constants.Values.False },
            };

            var service     = new ConfigurationEditorService();
            var dataSources = service.GetConfigurationEditors <IDataListSource>();
            var listEditors = service.GetConfigurationEditors <IDataListEditor>();

            Fields.Add(
                DataSource,
                "Data source",
                "Select and configure the data source.",
                configEditorViewPath,
                new Dictionary <string, object>(defaultConfigEditorConfig)
            {
                { ConfigurationEditorConfigurationEditor.Items, dataSources }
            });

            Fields.Add(
                ListEditor,
                "List editor",
                "Select and configure the type of editor for the data list.",
                configEditorViewPath,
                new Dictionary <string, object>(defaultConfigEditorConfig)
            {
                { ConfigurationEditorConfigurationEditor.Items, listEditors }
            });
        }
        public TextInputConfigurationEditor()
            : base()
        {
            Fields.Add(
                PlaceholderText,
                "Placeholder text",
                "Add placeholder text for the text input. This is to be used as instructional information, not as a default value.",
                "textstring");

            Fields.Add(
                "autocomplete",
                "Enable autocomplete?",
                "Select to enable autocomplete functionality on the text input.",
                "boolean");

            Fields.Add(
                "maxChars",
                "Maximum allowed characters",
                "Enter the maximum number of characters allowed for the text input.<br>The default is a 500 character limit.",
                "number");

            //Fields.Add(
            //    "prepend",
            //    "Prepend Icon",
            //    "[Add friendly description]",
            //    IOHelper.ResolveUrl(IconPickerDataEditor.DataEditorViewPath),
            //    new Dictionary<string, object>
            //    {
            //        { DefaultIconConfigurationField.DefaultIcon, string.Empty },
            //        { IconPickerSizeConfigurationField.Size, IconPickerSizeConfigurationField.Large }
            //    });

            //Fields.Add(
            //    "append",
            //    "Append Icon",
            //    "[Add friendly description]",
            //    IOHelper.ResolveUrl(IconPickerDataEditor.DataEditorViewPath),
            //    new Dictionary<string, object>
            //    {
            //        { DefaultIconConfigurationField.DefaultIcon, string.Empty },
            //        { IconPickerSizeConfigurationField.Size, IconPickerSizeConfigurationField.Large }
            //    });

            var service     = new ConfigurationEditorService();
            var dataSources = service.GetConfigurationEditors <IDataListSource>();

            Fields.Add(
                Items,
                "Data list",
                "<em>(optional)</em> Select and configure the data source to provide a HTML5 &lt;datalist&gt; for this text input.",
                IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorViewPath),
                new Dictionary <string, object>()
            {
                { OverlaySizeConfigurationField.OverlaySize, OverlaySizeConfigurationField.Small },
                { ConfigurationEditorConfigurationEditor.OverlayView, IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorOverlayViewPath) },
                { ConfigurationEditorConfigurationEditor.Items, dataSources },
                { EnableDevModeConfigurationField.EnableDevMode, Constants.Values.False },
                { DisableSortingConfigurationField.DisableSorting, Constants.Values.True },
                { MaxItemsConfigurationField.MaxItems, 1 },
            });
        }