Browse Source

fix(admin-ui): Fix rendering of custom field lists

Michael Bromley 4 years ago
parent
commit
da9e2ce882

+ 1 - 1
packages/admin-ui/src/lib/core/src/shared/components/tabbed-custom-fields/tabbed-custom-fields.component.ts

@@ -33,7 +33,7 @@ export class TabbedCustomFieldsComponent implements OnInit {
     private groupByTabs(customFieldConfigs: CustomFieldConfig[]): GroupedCustomFields {
         const tabMap = new Map<string, CustomFieldConfig[]>();
         for (const field of customFieldConfigs) {
-            const tabName = field.ui.tab ?? this.defaultTabName;
+            const tabName = field.ui?.tab ?? this.defaultTabName;
             if (tabMap.has(tabName)) {
                 tabMap.get(tabName)?.push(field);
             } else {

+ 6 - 4
packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/dynamic-form-input/dynamic-form-input.component.ts

@@ -55,7 +55,8 @@ type InputListItem = {
     ],
 })
 export class DynamicFormInputComponent
-    implements OnInit, OnChanges, AfterViewInit, OnDestroy, ControlValueAccessor {
+    implements OnInit, OnChanges, AfterViewInit, OnDestroy, ControlValueAccessor
+{
     @Input() def: ConfigArgDefinition | CustomFieldConfig;
     @Input() readonly: boolean;
     @Input() control: FormControl;
@@ -148,6 +149,7 @@ export class DynamicFormInputComponent
                                 this.onChange(val);
                                 this.control.patchValue(val, { emitEvent: false });
                             });
+                        setTimeout(() => this.changeDetectorRef.markForCheck());
                     }
                 };
 
@@ -278,9 +280,9 @@ export class DynamicFormInputComponent
         this.changeDetectorRef.markForCheck();
     }
 
-    private getInputComponentConfig(
-        argDef: ConfigArgDefinition | CustomFieldConfig,
-    ): { component: DefaultFormComponentId } {
+    private getInputComponentConfig(argDef: ConfigArgDefinition | CustomFieldConfig): {
+        component: DefaultFormComponentId;
+    } {
         if (this.hasUiConfig(argDef) && argDef.ui.component) {
             return argDef.ui;
         }