added option to disable automatic expand of single nc item (#12261)
* added option to disable automatic expand of single nc item * remove max item conditional remove max item 1 conditional to set current node * changed description of slider property removed description of first item conditional * Update NestedContentConfiguration.cs change copy to more accurately describe the feature Co-authored-by: Wilmar <wilmar.de.hoogd@thevalley.nl>
This commit is contained in:
@@ -23,6 +23,9 @@ namespace Umbraco.Cms.Core.PropertyEditors
|
||||
[ConfigurationField("showIcons", "Show Icons", "boolean", Description = "Show the Element Type icons.")]
|
||||
public bool ShowIcons { get; set; } = true;
|
||||
|
||||
[ConfigurationField("expandsOnLoad", "Expands on load", "boolean", Description = "A single item is automatically expanded")]
|
||||
public bool ExpandsOnLoad { get; set; } = true;
|
||||
|
||||
[ConfigurationField("hideLabel", "Hide Label", "boolean", Description = "Hide the property label and let the item list span the full width of the editor window.")]
|
||||
public bool HideLabel { get; set; }
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@
|
||||
if (vm.maxItems === 0)
|
||||
vm.maxItems = 1000;
|
||||
|
||||
vm.singleMode = vm.minItems === 1 && vm.maxItems === 1 && model.config.contentTypes.length === 1;;
|
||||
vm.singleMode = vm.minItems === 1 && vm.maxItems === 1 && model.config.contentTypes.length === 1;
|
||||
vm.expandsOnLoad = Object.toBoolean(model.config.expandsOnLoad)
|
||||
vm.showIcons = Object.toBoolean(model.config.showIcons);
|
||||
vm.wideMode = Object.toBoolean(model.config.hideLabel);
|
||||
vm.hasContentTypes = model.config.contentTypes.length > 0;
|
||||
@@ -617,8 +618,8 @@
|
||||
modelWasChanged = true;
|
||||
}
|
||||
|
||||
// If there is only one item, set it as current node
|
||||
if (vm.singleMode || (vm.nodes.length === 1 && vm.maxItems === 1)) {
|
||||
// If there is only one item and expandsOnLoad property is true, set it as current node
|
||||
if (vm.singleMode || (vm.expandsOnLoad && vm.nodes.length === 1)) {
|
||||
setCurrentNode(vm.nodes[0], false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user