angular icon indicating copy to clipboard operation
angular copied to clipboard

[BUG] The CustomTagsService is not exported.

Open smshafa opened this issue 2 years ago • 2 comments

Environment

  • Hosting type
    • [x] Local deployment
  • Version:
    • Formio.js version: ^4.13.8.
    • Frontend framework: Angular ~12.2.16.
    • Browsers: Edge, Chrome, and Firefox.
    • Browser versions: The last versions.

Steps to Reproduce

  1. Create a new component based on the FormBuilderComponent.
import { FormioAppConfig, FormioComponent } from '@formio/angular';
@Component({
  selector: 'app-form-builder',
  templateUrl: './form-builder.component.html',
  styleUrls: ['./form-builder.component.scss']
})
export class FormBuilderComponent extends FormioComponent {

  constructor(
    public ngZone: NgZone,
    @Optional() public config: FormioAppConfig,
    @Optional() public customTags?: CustomTagsService,
    ) {
    super(ngZone, config, customTags);
  }
  1. Try to import CustomTagsService reference in the import section. It can be added to the component.
  2. In angular 12, and angular-formio 5.2.2, the compiler throws errors that the CustomTagsService can't be resolved.
  3. If you create a fake service like CustomTagsService and inject it, custom components are not shown anymore!

Expected behavior

I expect that the custom components will be displayed on my pages, but they won't.

Observed behavior

The custom components work correctly on the form builder page (form-builder tag), but they don't work correctly for form viewer (formio tag).

Suggested solution:

I cloned the source code and added custom-tags.service.ts reference to the index.ts file, then I published a new NPM package and used this package for my own project and everything worked correctly.

export * from './core';
export * from './elements.common';
export * from './custom-component/custom-tags.service';                  // Add this line.
export * from './custom-component/create-custom-component';
export * from './custom-component/register-custom-component';
export { default as FormioSubmission } from './types/formio-submission';

Relative path in the angular-formio project: angular\projects\angular-formio\src\index.ts

Import section in my own project: import { CustomTagsService, FormioAppConfig, FormioComponent } from 'my-own-formbuilder';

smshafa avatar Apr 14 '22 08:04 smshafa

If you please provide a pull request with your suggested fix, I will be sure to include it in the next build. Thanks.

travist avatar Apr 27 '22 20:04 travist

If you please provide a pull request with your suggested fix, I will be sure to include it in the next build. Thanks.

I created a pull request for this issue:

#879

FYI: @travist

smshafa avatar May 22 '22 12:05 smshafa

@travist when will the next npm version will be released ? waiting for some of the bug fixes and features.

sudheerReddy9047 avatar Dec 24 '22 18:12 sudheerReddy9047

We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.

If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.

lane-formio avatar Feb 07 '24 14:02 lane-formio