From 38d90a5decaafd6a77555f3f6af67e7efd7e8cd6 Mon Sep 17 00:00:00 2001 From: Heiner Walter Date: Mon, 3 Jun 2024 15:10:06 +0200 Subject: [PATCH] added more demo cases --- .../all-inputs-demo.component.html | 19 +++++++++++++++++++ .../all-inputs-demo.component.ts | 6 ++++++ projects/demo/src/app/model/contact.ts | 12 +++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.html b/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.html index 16deb9c..51ef8b0 100644 --- a/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.html +++ b/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.html @@ -215,6 +215,15 @@

Groups

+ + + + + @@ -271,6 +280,16 @@

Groups

+ + + + + diff --git a/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.ts b/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.ts index 53a0132..6d3236b 100644 --- a/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.ts +++ b/projects/demo/src/app/components/all-inputs-demo/all-inputs-demo.component.ts @@ -53,11 +53,17 @@ export class AllInputsDemoComponent { rating: 0 as number | undefined, ratingCustom: 0 as number | undefined, array: ['Line 1', 'Line 2', 'Not line 3'] as any[], + arrayInitiallyEmpty: undefined as unknown as any[], arrayWithInputGroup: [{ name: 'Max', number: 5 }, { name: 'Moritz', number: 3, country: 'Germany' }] as { name: string | undefined, number: number | undefined, country: string | undefined, }[], + arrayWithInputGroupInitiallyEmpty: undefined as unknown as { + name: string | undefined, + number: number | undefined, + country: string | undefined, + }[], inputGroup: { street: undefined as string | undefined, number: undefined as number | undefined, diff --git a/projects/demo/src/app/model/contact.ts b/projects/demo/src/app/model/contact.ts index 2de752f..829722c 100644 --- a/projects/demo/src/app/model/contact.ts +++ b/projects/demo/src/app/model/contact.ts @@ -1,4 +1,4 @@ -import { PropertiesConfiguration, PropertyConfiguration } from 'ngx-property-editor'; +import { PropertiesConfiguration, PropertyConfiguration, PropertyEditorMode } from 'ngx-property-editor'; import { Address } from './address'; type FriendType = { @@ -170,6 +170,16 @@ export class Contact { isArray: true, newArrayItemFunction: () => ({ name: undefined, type: undefined }), editable: true, + hideIfEmpty: true, + hidden: (data: Contact, mode: PropertyEditorMode) => { + switch (mode) { + case 'view': + case 'edit': + return false; + case 'table': + return true; + } + }, group: [[ new PropertyConfiguration({ propertyName: 'name',