Skip to content

Commit

Permalink
fix: custom formio components not rendering (#1162)
Browse files Browse the repository at this point in the history
* add formio render custom component fix

* remove comment

* remove required
  • Loading branch information
mbritense authored and ThomasMinkeRitense committed Sep 20, 2024
1 parent 8369ab0 commit 0c54757
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {FormioCustomComponent} from '../../../modules';

@Component({
selector: 'valtimo-dummy',
template: '',
})
export class FormioDummyComponent implements FormioCustomComponent<any> {
@Input() public value: string;
@Input() public disabled = false;
@Input() public required = false;
@Output() public valueChange = new EventEmitter<any>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {Injector} from '@angular/core';
import {FormioCustomComponentInfo, registerCustomFormioComponent} from '../../../modules';
import {FormioDummyComponent} from './dummy.component';

const COMPONENT_OPTIONS: FormioCustomComponentInfo = {
type: 'dummy',
selector: 'valtimo-dummy',
title: 'Dummy',
group: 'none',
icon: 'bank',
schema: {
hidden: true,
label: 'Dummy component',
key: 'dummy',
hideLabel: false,
tableView: true,
},
};

export function enableCustomFormioComponents(injector: Injector) {
registerCustomFormioComponent(COMPONENT_OPTIONS, FormioDummyComponent, injector);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {ConfigService} from '@valtimo/config';
import {FormIoIbanComponent} from './form-io-iban/iban.component';
import {ReactiveFormsModule} from '@angular/forms';
import {FormioValueResolverSelectorComponent} from './formio-value-resolver-selector/formio-value-resolver-selector.component';
import {FormioDummyComponent} from './form-io-dummy/dummy.component';

@NgModule({
imports: [
Expand All @@ -53,13 +54,15 @@ import {FormioValueResolverSelectorComponent} from './formio-value-resolver-sele
FormIoUploaderComponent,
FormIoCurrentUserComponent,
FormIoIbanComponent,
FormioDummyComponent,
],
exports: [
FormioComponent,
FormioBuilderComponent,
FormIoUploaderComponent,
FormIoCurrentUserComponent,
FormIoIbanComponent,
FormioDummyComponent,
],
providers: [
FormIoDomService,
Expand Down
3 changes: 3 additions & 0 deletions projects/valtimo/components/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,6 @@ export * from './lib/components/value-path-selector/value-path-selector.componen
// formio value resoler selector
export * from './lib/components/form-io/formio-value-resolver-selector/formio-value-resolver-selector.formio';
export * from './lib/components/form-io/formio-value-resolver-selector/formio-value-resolver-selector.component';
// formio dummy
export * from './lib/components/form-io/form-io-dummy/dummy.component';
export * from './lib/components/form-io/form-io-dummy/dummy.formio';
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {SecurityModule} from '@valtimo/security';
import {
BpmnJsDiagramModule,
CardModule,
enableCustomFormioComponents,
FormIoModule,
MenuModule,
registerFormioCurrentUserComponent,
Expand Down Expand Up @@ -283,6 +284,7 @@ export function tabsFactory() {
})
export class AppModule {
constructor(injector: Injector) {
enableCustomFormioComponents(injector);
registerFormioCurrentUserComponent(injector);
registerFormioUploadComponent(injector);
registerFormioFileSelectorComponent(injector);
Expand Down

0 comments on commit 0c54757

Please sign in to comment.