diff --git a/package-lock.json b/package-lock.json index da6bd4c..1c8ef23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@angular/router": "~12.1.2", "query-selector-shadow-dom": "^1.0.1", "rxjs": "~6.6.0", - "stenciljs-components": "^1.0.13", + "stenciljs-components": "^2.0.1", "tslib": "^2.2.0", "zone.js": "~0.11.4" }, @@ -16679,9 +16679,9 @@ } }, "node_modules/stenciljs-components": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/stenciljs-components/-/stenciljs-components-1.0.13.tgz", - "integrity": "sha512-dk2I1CnXNXWtkWw2Dk7cUGhoOaSAFlDRVssuRuhJA51BM1+RGV8XIGxBINUt8uSYgvERH3/z5YsXXVpNeeiDvw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stenciljs-components/-/stenciljs-components-2.0.1.tgz", + "integrity": "sha512-9H47i//LmPzDWFYtur+Frfwwv0DbYpeB6tiUmFwvVdzQlVEEK/5XDKi0U8GLJiiTmURdAPFMQthSlHewQkREcw==", "license": "MIT", "dependencies": { "@ionic/core": "^8.3.2", diff --git a/package.json b/package.json index 4452281..ff98001 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@angular/router": "~12.1.2", "query-selector-shadow-dom": "^1.0.1", "rxjs": "~6.6.0", - "stenciljs-components": "^1.0.13", + "stenciljs-components": "^2.0.1", "tslib": "^2.2.0", "zone.js": "~0.11.4" }, diff --git a/src/app/library-components/form-schema.ts b/src/app/library-components/form-schema.ts new file mode 100644 index 0000000..d92b8cd --- /dev/null +++ b/src/app/library-components/form-schema.ts @@ -0,0 +1,56 @@ +export const formSchema = { + "fields":[ + { "type": "text", "name": "username", "label": "Username", "placeholder": "Enter username", "required": true }, + { "type": "date", "name": "dob", "label": "Date of Birth", "required": true }, + { "type": "checkbox", "name": "subscribe", "label": "Subscribe", "required": false }, + { "type": "radio", "name": "gender", "label": "Gender", "options": [{ "label": "Male", "value": "male" }, { "label": "Female", "value": "female" }], "required": true }, + { "type": "select", "name": "country", "label": "Country", "options": [{ "label": "USA", "value": "usa" }, { "label": "India", "value": "india" }], "required": true }, + { + "type": "array", + "name": "experiences", + "label": "Work Experiences", + "required": false, + "items": [ + { + "type": "text", + "name": "companyName", + "label": "Company Name", + "required": true + }, + { + "type": "date", + "name": "startDate", + "label": "Start Date", + "required": true + }, + { + "type": "date", + "name": "endDate", + "label": "End Date", + "required": true + }, + { + "type": "select", + "name": "role", + "label": "Role", + "options": [ + { "label": "Developer", "value": "developer" }, + { "label": "Designer", "value": "designer" }, + { "label": "Manager", "value": "manager" } + ], + "required": true + } + ] + }, + { + "type": "date", + "name": "Proposaldate", + "label": "Proposal Date", + "required": true + }, + { "type": "radio", "name": "insurance", "label": "Global insurance companies", "options": [{ "label": "Liberty Mutual", "value": "Liberty Mutual" }, { "label": "All States", "value": "All States" },{ "label": "Farmers", "value": "Farmers" }], "required": true }, + + { "type": "textarea", "name": "comments", "label": "Comments", "placeholder": "Write your comments here...","maxLength": 200, "minLength": 0, "errorMessage": "Comments must be between 0 and 200 characters.", "conditionalOn": { "field": "gender", "value": "female" } }, + { "type": "combo-box", "name": "favoriteFruit", "label": "Favorite Fruit", "placeholder": "Type or select a fruit...", "required": true, "options": [ { "label": "Apple", "value": "apple" }, { "label": "Banana", "value": "banana" }, { "label": "Cherry", "value": "cherry" } ]}, + { "type": "my-rich-text-editor", "name": "bio", "label": "Bio", "placeholder": "Write your biography..."} + ]} \ No newline at end of file diff --git a/src/app/library-components/library-components.component.html b/src/app/library-components/library-components.component.html index 129fa11..cdbb7cd 100644 --- a/src/app/library-components/library-components.component.html +++ b/src/app/library-components/library-components.component.html @@ -1,16 +1,6 @@

library-components works!

from 'stenciljs-components' npm package

- + - - -Click me! -Number: - - - - - -
Hello World
\ No newline at end of file diff --git a/src/app/library-components/library-components.component.ts b/src/app/library-components/library-components.component.ts index d39ff70..8391ac4 100644 --- a/src/app/library-components/library-components.component.ts +++ b/src/app/library-components/library-components.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { formSchema } from './form-schema'; // Import schema @Component({ selector: 'app-library-components', @@ -6,6 +7,12 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./library-components.component.scss'] }) export class LibraryComponentsComponent implements OnInit { + formSchema = formSchema; // Assign the imported schema to a local variable +//first option used in html file with Angular's json pipe +//option 2: schemaString = JSON.stringify(formSchema); // Convert schema to JSON string +//and then in html file +// +// constructor() { } diff --git a/src/styles.scss b/src/styles.scss index 9260991..6973717 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -2,7 +2,7 @@ body { // background-color: #303030; // color: #FAFAFA; font-family: 'Trebuchet MS', sans-serif; - font-size: 2rem; + //font-size: 2rem; padding: 30px; text-align: center; }