JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 434
  • Score
    100M100P100Q130303F
  • License MIT

Distributable web component build for form submission (bundle.js, bundle.css, fonts, icons)

Package Exports

  • @piserve-tech/octa-form-submission-webcomponent
  • @piserve-tech/octa-form-submission-webcomponent/dist/bundle.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@piserve-tech/octa-form-submission-webcomponent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🧩 Octa Form Submission Web Component

The Octa Form Submission Web Component is a fully framework-independent, reusable UI component that enables developers to dynamically create, edit, and manage forms. It can be used seamlessly in Angular, React, Vue, or pure HTML/JavaScript environments.


πŸš€ Installation

Step 1: Install the package

npm i @piserve-tech/octa-form-submission-webcomponent

βš™οΈ Setup Guide

Step 2: Copy Required Assets

Run the following command to copy the assets (bundle.js and bundle.css) into your project’s assets folder.

node .\node_modules\@piserve-tech\octa-form-submission-webcomponent\copy-assets.js

This script will copy files into:

/src/assets/octa-form-submission-webcomponent/

Step 3: Add Component in HTML

Use the web component directly in your HTML file or within any framework template:

<octa-form-submission-webcomponent
  formData='{"apiurl":"http://192.168.2.189:8080","modulename":"b673ddd3-066e-4261-aa32-41ccfe6e1864","headers":{"contentType":"application/json","auth-user":"John","acceptedLanguage":"en"},"skipMargin":false}'
  submissionid="4a76519a-78aa-4d2c-8abf-52e1bb081ab5"
  [edit]="edit"
  (submitForm) = "submitForm($event)"
  (apiCalled)="getFormApiCalled($event)"
></octa-form-submission-webcomponent>

Step 4: Load JS & CSS (Optional for Frameworks)

If your environment doesn’t automatically include the assets, load them dynamically in your code.

Example (JavaScript or Angular):

loadScript(src: string): Promise<void> {
  return new Promise((resolve, reject) => {
    if (document.querySelector(`script[src="${src}"]`)) {
      resolve();
      return;
    }
    const script = document.createElement('script');
    script.src = src;
    script.onload = () => resolve();
    script.onerror = () => reject();
    document.body.appendChild(script);
  });
}

loadStyle(href: string): Promise<void> {
  return new Promise((resolve, reject) => {
    if (document.querySelector(`link[href="${href}"]`)) {
      resolve();
      return;
    }
    const link = document.createElement('link');
    link.rel = 'stylesheet';
    link.href = href;
    link.onload = () => resolve();
    link.onerror = () => reject();
    document.head.appendChild(link);
  });
}

async ngAfterViewInit() {
  await this.loadStyle('./assets/octa-form-submission-webcomponent/bundle.css');
  await this.loadScript('./assets/octa-form-submission-webcomponent/bundle.js');
  const el = document.querySelector('octa-form-submission-webcomponent') as any;
  if (el) {
    el.formId = this.id;
    el.edit = true;
    el.showModifyInfo = false;
    el.formData = this.formData;
    el.top = '0';
    el.createDuplicate = false;
    el.formElements = this.formElements;
  }
}

Step 5 (Angular Only): Add CUSTOM_ELEMENTS_SCHEMA

If you are using Angular, include CUSTOM_ELEMENTS_SCHEMA in your module file (e.g. app.module.ts).

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA] // πŸ‘ˆ Important for Web Components
})
export class AppModule {}

Step 6 (Optional): Add Bundle in angular.json

If you prefer referencing the bundle directly via Angular CLI build options, include the following line:

"scripts": [
  "node_modules/@piserve-tech/octa-form-submission-webcomponent/dist/bundle.js"
]

πŸ› οΈ Tech Stack

  • Web Components (Custom Elements API)
  • Angular 16+ Compatible
  • TypeScript
  • Node.js (for asset copy script)

πŸ“„ License

Β© 2025 Piserve Technologies Pvt Ltd
Licensed under the MIT License.