Remove limitation on nested content to 1,000 items where max items unset.

This commit is contained in:
Donald Nairn
2022-12-15 23:04:02 +00:00
committed by Kyle Eck
parent 71e7836001
commit 5915c9b29f
2 changed files with 14 additions and 9 deletions

View File

@@ -104,9 +104,6 @@
vm.minItems = model.config.minItems || 0;
vm.maxItems = model.config.maxItems || 0;
if (vm.maxItems === 0)
vm.maxItems = 1000;
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);
@@ -204,9 +201,17 @@
validate();
};
vm.maxItemsExceeded = function () {
return vm.maxItems !== 0 && vm.nodes.length > vm.maxItems;
}
vm.maxItemsReached = function () {
return vm.maxItems !== 0 && vm.nodes.length >= vm.maxItems;
}
vm.openNodeTypePicker = function ($event) {
if (vm.nodes.length >= vm.maxItems) {
if (vm.maxItemsReached()) {
return;
}
@@ -767,7 +772,7 @@
$scope.nestedContentForm.minCount.$setValidity("minCount", true);
}
if (vm.nodes.length > vm.maxItems) {
if (vm.maxItemsExceeded()) {
$scope.nestedContentForm.maxCount.$setValidity("maxCount", false);
}
else {

View File

@@ -1,4 +1,4 @@
<div id="umb-nested-content--{{model.id}}" class="umb-nested-content" ng-class="{'umb-nested-content--narrow':!vm.wideMode, 'umb-nested-content--wide':vm.wideMode}">
<div id="umb-nested-content--{{model.id}}" class="umb-nested-content" ng-class="{'umb-nested-content--narrow':!vm.wideMode, 'umb-nested-content--wide':vm.wideMode}">
<umb-load-indicator class="mt2" ng-if="!vm.inited"></umb-load-indicator>
@@ -60,9 +60,9 @@
<button
type="button"
class="btn-reset umb-nested-content__add-content umb-focus"
ng-class="{ '--disabled': (!vm.scaffolds.length || vm.nodes.length >= vm.maxItems) }"
ng-class="{ '--disabled': (!vm.scaffolds.length || vm.maxItemsReached()) }"
ng-click="vm.openNodeTypePicker($event)"
aria-disabled="{{!vm.scaffolds.length || vm.nodes.length >= vm.maxItems}}"
aria-disabled="{{!vm.scaffolds.length || vm.maxItemsReached()}}"
ng-disabled="!vm.allowAdd">
<localize key="grid_addElement">Add element</localize>
</button>
@@ -78,7 +78,7 @@
<localize key="validation_entriesShort" tokens="[vm.minItems, vm.minItems - vm.nodes.length]" watch-tokens="true">Minimum %0% entries, needs <strong>%1%</strong> more.</localize>
</div>
</div>
<div ng-if="nestedContentForm.minCount.$error === true || vm.nodes.length > vm.maxItems">
<div ng-if="nestedContentForm.minCount.$error === true || vm.maxItemsExceeded()">
<div class="help text-error">
<localize key="validation_entriesExceed" tokens="[vm.maxItems, vm.nodes.length - vm.maxItems]" watch-tokens="true">Maximum %0% entries, <strong>%1%</strong> too many.</localize>
</div>