From 7e15e6a556a2d7c847f98433a05d78f2c3c49a52 Mon Sep 17 00:00:00 2001 From: Ludeck Date: Tue, 22 Apr 2025 03:31:08 +0000 Subject: [PATCH 1/2] Correctly support array schemas with noAdd AND a customFooter --- src/client/js/directives/form.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/js/directives/form.ts b/src/client/js/directives/form.ts index 405930e6..bae9520c 100644 --- a/src/client/js/directives/form.ts +++ b/src/client/js/directives/form.ts @@ -586,7 +586,8 @@ module fng.directives { /* Array footer */ if (info.noAdd !== true || typeof info.customFooter == 'string' || info.noneIndicator) { let footer: string = ''; - if (typeof info.customFooter == 'string') { + const hasCustomFooter = typeof info.customFooter == 'string'; + if (hasCustomFooter) { footer = info.customFooter; } let hideCond = ''; @@ -605,8 +606,8 @@ module fng.directives { } if (info.noneIndicator) { footer += `None`; - // hideCond for the schema-foot is if there's no add button and no indicator - hideCond = `${model}.length > 0`; + // hideCond for the schema-foot is if there's no add button, no custom footer and no indicator + hideCond = hasCustomFooter ? "" : `${model}.length > 0`; if (info.noAdd === true) { hideCond = `ng-hide="${hideCond}"`; } else { From e72845882786d346a36c544f65007f0df507cc82 Mon Sep 17 00:00:00 2001 From: Ludeck Date: Tue, 22 Apr 2025 09:16:06 +0000 Subject: [PATCH 2/2] do it properly this time --- src/client/js/directives/form.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/js/directives/form.ts b/src/client/js/directives/form.ts index bae9520c..532aa078 100644 --- a/src/client/js/directives/form.ts +++ b/src/client/js/directives/form.ts @@ -607,11 +607,13 @@ module fng.directives { if (info.noneIndicator) { footer += `None`; // hideCond for the schema-foot is if there's no add button, no custom footer and no indicator - hideCond = hasCustomFooter ? "" : `${model}.length > 0`; - if (info.noAdd === true) { - hideCond = `ng-hide="${hideCond}"`; - } else { - hideCond = info.noAdd ? `ng-hide="${info.noAdd} && ${hideCond}"` : ''; + if (!hasCustomFooter) { + hideCond = `${model}.length > 0`; + if (info.noAdd === true) { + hideCond = `ng-hide="${hideCond}"`; + } else { + hideCond = info.noAdd ? `ng-hide="${info.noAdd} && ${hideCond}"` : ''; + } } } if (footer !== '') {