@ngstarter-ui/components 21.0.42 → 21.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/ai/component-registry.json +26 -101
- package/fesm2022/ngstarter-ui-components-form-builder.mjs +204 -19
- package/fesm2022/ngstarter-ui-components-form-builder.mjs.map +1 -1
- package/package.json +1 -5
- package/types/ngstarter-ui-components-form-builder.d.ts +41 -5
- package/fesm2022/ngstarter-ui-components-form-renderer-autocomplete-many-field-CGQ3pJaG.mjs +0 -124
- package/fesm2022/ngstarter-ui-components-form-renderer-autocomplete-many-field-CGQ3pJaG.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-checkbox-field-CoyKdvhV.mjs +0 -22
- package/fesm2022/ngstarter-ui-components-form-renderer-checkbox-field-CoyKdvhV.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-datepicker-field-Cf3jfPv7.mjs +0 -44
- package/fesm2022/ngstarter-ui-components-form-renderer-datepicker-field-Cf3jfPv7.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-divider-content-D8Sffofu.mjs +0 -17
- package/fesm2022/ngstarter-ui-components-form-renderer-divider-content-D8Sffofu.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-image-content-ICTwkZPa.mjs +0 -17
- package/fesm2022/ngstarter-ui-components-form-renderer-image-content-ICTwkZPa.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-input-field-tZHU8-_L.mjs +0 -35
- package/fesm2022/ngstarter-ui-components-form-renderer-input-field-tZHU8-_L.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-radio-group-field-DugkPKYU.mjs +0 -38
- package/fesm2022/ngstarter-ui-components-form-renderer-radio-group-field-DugkPKYU.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-select-field-DyBidcIU.mjs +0 -39
- package/fesm2022/ngstarter-ui-components-form-renderer-select-field-DyBidcIU.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-text-content-BjzH_M3-.mjs +0 -24
- package/fesm2022/ngstarter-ui-components-form-renderer-text-content-BjzH_M3-.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-textarea-field-DxbPsw3z.mjs +0 -37
- package/fesm2022/ngstarter-ui-components-form-renderer-textarea-field-DxbPsw3z.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-timezone-field-DAWrM-jS.mjs +0 -35
- package/fesm2022/ngstarter-ui-components-form-renderer-timezone-field-DAWrM-jS.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer-toggle-field-iyqUrWxt.mjs +0 -22
- package/fesm2022/ngstarter-ui-components-form-renderer-toggle-field-iyqUrWxt.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-renderer.mjs +0 -317
- package/fesm2022/ngstarter-ui-components-form-renderer.mjs.map +0 -1
- package/types/ngstarter-ui-components-form-renderer.d.ts +0 -121
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-radio-group-field-DugkPKYU.mjs","sources":["../../../projects/components/form-renderer/src/fields/radio-group-field/radio-group-field.ts","../../../projects/components/form-renderer/src/fields/radio-group-field/radio-group-field.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { ComponentConfig } from '../../models/form-config.model';\nimport { RadioButton, RadioGroup } from '@ngstarter-ui/components/radio';\nimport { Error, Hint } from '@ngstarter-ui/components/form-field';\n\n@Component({\n selector: 'ngs-radio-group-field',\n exportAs: 'ngsRadioGroupField',\n imports: [\n RadioButton,\n RadioGroup,\n ReactiveFormsModule,\n Error,\n Hint,\n ],\n templateUrl: './radio-group-field.html',\n styleUrl: './radio-group-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class RadioGroupField {\n control = input.required<FormControl>();\n config = input.required<ComponentConfig>();\n\n getErrorMessage(): string {\n const errors = this.control().errors;\n if (!errors) {\n return '';\n }\n const errorKey = Object.keys(errors)[0];\n const validator = this.config().validators?.find((v: any) => v.type === errorKey);\n return validator?.message || 'Invalid value';\n }\n\n get options() {\n return this.config().payload?.['options'] || [];\n }\n}\n","@if (control() && config()) {\n <div class=\"radio-group-container\">\n @if (config().label) {\n <div class=\"radio-group-label\">{{ config().label }}</div>\n }\n <ngs-radio-group\n [formControl]=\"control()\"\n [class.inline]=\"config().inline\">\n @for (option of options; track option.value) {\n <ngs-radio-button [value]=\"option.value\">{{ option.label }}</ngs-radio-button>\n }\n </ngs-radio-group>\n @if (config().hint && (control().valid || control().invalid && !control().touched)) {\n <ngs-hint>{{ config().hint }}</ngs-hint>\n }\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </div>\n}\n"],"names":[],"mappings":";;;;;;;MAoBa,eAAe,CAAA;AAC1B,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAe;AACvC,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAmB;IAE1C,eAAe,GAAA;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM;QACpC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE;QACX;QACA,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAM,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjF,QAAA,OAAO,SAAS,EAAE,OAAO,IAAI,eAAe;IAC9C;AAEA,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE;IAC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AA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,oBAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,KAAK,EAAA,QAAA,EAAA,WAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACL,IAAI,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMK,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;+BACE,uBAAuB,EAAA,QAAA,EACvB,oBAAoB,EAAA,OAAA,EACrB;wBACP,WAAW;wBACX,UAAU;wBACV,mBAAmB;wBACnB,KAAK;wBACL,IAAI;qBACL,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,qtBAAA,EAAA,MAAA,EAAA,CAAA,w1BAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/forms';
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import { Error, Hint, Label, FormField } from '@ngstarter-ui/components/form-field';
|
|
6
|
-
import { Option, Select } from '@ngstarter-ui/components/select';
|
|
7
|
-
|
|
8
|
-
class SelectField {
|
|
9
|
-
control = input.required(...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
10
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
11
|
-
getErrorMessage() {
|
|
12
|
-
const errors = this.control().errors;
|
|
13
|
-
if (!errors)
|
|
14
|
-
return '';
|
|
15
|
-
const errorKey = Object.keys(errors)[0];
|
|
16
|
-
const validator = this.config().validators?.find((v) => v.type === errorKey);
|
|
17
|
-
return validator?.message || 'Invalid value';
|
|
18
|
-
}
|
|
19
|
-
get options() {
|
|
20
|
-
return this.config()?.payload?.['options'] || [];
|
|
21
|
-
}
|
|
22
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SelectField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: SelectField, isStandalone: true, selector: "ngs-select-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ngsSelectField"], ngImport: i0, template: "@if (control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-select [formControl]=\"control()\">\n @for (option of options; track option.value) {\n <ngs-option [value]=\"option.value\">{{ option.label }}</ngs-option>\n }\n </ngs-select>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: Error, selector: "ngs-error", exportAs: ["ngsError"] }, { kind: "component", type: Hint, selector: "ngs-hint", inputs: ["align"], exportAs: ["ngsHint"] }, { kind: "component", type: Option, selector: "ngs-option", inputs: ["value", "data", "disabled", "selected"], outputs: ["onSelectionChange"], exportAs: ["ngsOption"] }, { kind: "component", type: Select, selector: "ngs-select", inputs: ["id", "placeholder", "disabled", "required", "multiple", "hideCheckIcon", "clearable", "aria-label", "tabIndex", "aria-describedby", "value"], outputs: ["selectionChange", "opened", "closed", "valueChange"], exportAs: ["ngsSelect"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
24
|
-
}
|
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: SelectField, decorators: [{
|
|
26
|
-
type: Component,
|
|
27
|
-
args: [{ selector: 'ngs-select-field', exportAs: 'ngsSelectField', imports: [
|
|
28
|
-
Error,
|
|
29
|
-
Hint,
|
|
30
|
-
Option,
|
|
31
|
-
Select,
|
|
32
|
-
Label,
|
|
33
|
-
FormField,
|
|
34
|
-
ReactiveFormsModule
|
|
35
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-select [formControl]=\"control()\">\n @for (option of options; track option.value) {\n <ngs-option [value]=\"option.value\">{{ option.label }}</ngs-option>\n }\n </ngs-select>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
36
|
-
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
37
|
-
|
|
38
|
-
export { SelectField };
|
|
39
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer-select-field-DyBidcIU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-select-field-DyBidcIU.mjs","sources":["../../../projects/components/form-renderer/src/fields/select-field/select-field.ts","../../../projects/components/form-renderer/src/fields/select-field/select-field.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { ComponentConfig } from '../../models/form-config.model';\nimport { Error, FormField, Hint, Label } from '@ngstarter-ui/components/form-field';\nimport { Option, Select } from '@ngstarter-ui/components/select';\n\n@Component({\n selector: 'ngs-select-field',\n exportAs: 'ngsSelectField',\n imports: [\n Error,\n Hint,\n Option,\n Select,\n Label,\n FormField,\n ReactiveFormsModule\n ],\n templateUrl: './select-field.html',\n styleUrl: './select-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SelectField {\n control = input.required<FormControl>();\n config = input.required<ComponentConfig>();\n\n getErrorMessage(): string {\n const errors = this.control().errors;\n if (!errors) return '';\n const errorKey = Object.keys(errors)[0];\n const validator = this.config().validators?.find((v: any) => v.type === errorKey);\n return validator?.message || 'Invalid value';\n }\n\n get options() {\n return this.config()?.payload?.['options'] || [];\n }\n}\n","@if (control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-select [formControl]=\"control()\">\n @for (option of options; track option.value) {\n <ngs-option [value]=\"option.value\">{{ option.label }}</ngs-option>\n }\n </ngs-select>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ng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A,IAAA,EAAA,EAAA,CAAA,oBAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMV,WAAW,EAAA,UAAA,EAAA,CAAA;kBAhBvB,SAAS;+BACE,kBAAkB,EAAA,QAAA,EAClB,gBAAgB,EAAA,OAAA,EACjB;wBACP,KAAK;wBACL,IAAI;wBACJ,MAAM;wBACN,MAAM;wBACN,KAAK;wBACL,SAAS;wBACT;qBACD,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,2eAAA,EAAA,MAAA,EAAA,CAAA,qHAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, Component } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/platform-browser';
|
|
4
|
-
|
|
5
|
-
class TextContent {
|
|
6
|
-
sanitizer;
|
|
7
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
8
|
-
sanitizedHtml = '';
|
|
9
|
-
constructor(sanitizer) {
|
|
10
|
-
this.sanitizer = sanitizer;
|
|
11
|
-
}
|
|
12
|
-
ngOnInit() {
|
|
13
|
-
this.sanitizedHtml = this.sanitizer.bypassSecurityTrustHtml(this.config().content?.['htmlContent'] || '');
|
|
14
|
-
}
|
|
15
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextContent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
16
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: TextContent, isStandalone: true, selector: "ngs-text-content", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div [innerHTML]=\"sanitizedHtml\"></div>\n", styles: ["/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] });
|
|
17
|
-
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextContent, decorators: [{
|
|
19
|
-
type: Component,
|
|
20
|
-
args: [{ selector: 'ngs-text-content', imports: [], template: "<div [innerHTML]=\"sanitizedHtml\"></div>\n", styles: ["/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
21
|
-
}], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
22
|
-
|
|
23
|
-
export { TextContent };
|
|
24
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer-text-content-BjzH_M3-.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-text-content-BjzH_M3-.mjs","sources":["../../../projects/components/form-renderer/src/content/text-content/text-content.ts","../../../projects/components/form-renderer/src/content/text-content/text-content.html"],"sourcesContent":["import { Component, input } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ComponentConfig } from '../../models/form-config.model';\n\n@Component({\n selector: 'ngs-text-content',\n imports: [],\n templateUrl: './text-content.html',\n styleUrl: './text-content.scss'\n})\nexport class TextContent {\n config = input.required<ComponentConfig>();\n sanitizedHtml: SafeHtml = '';\n\n constructor(private sanitizer: DomSanitizer) {}\n\n ngOnInit() {\n this.sanitizedHtml = this.sanitizer.bypassSecurityTrustHtml(\n this.config().content?.['htmlContent'] || ''\n );\n }\n}\n","<div [innerHTML]=\"sanitizedHtml\"></div>\n"],"names":[],"mappings":";;;;MAUa,WAAW,CAAA;AAIF,IAAA,SAAA;AAHpB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAmB;IAC1C,aAAa,GAAa,EAAE;AAE5B,IAAA,WAAA,CAAoB,SAAuB,EAAA;QAAvB,IAAA,CAAA,SAAS,GAAT,SAAS;IAAiB;IAE9C,QAAQ,GAAA;QACN,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CACzD,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,CAC7C;IACH;uGAVW,WAAW,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,WAAW,kNCVxB,6CACA,EAAA,MAAA,EAAA,CAAA,qEAAA,CAAA,EAAA,CAAA;;2FDSa,WAAW,EAAA,UAAA,EAAA,CAAA;kBANvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,WACnB,EAAE,EAAA,QAAA,EAAA,6CAAA,EAAA,MAAA,EAAA,CAAA,qEAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/forms';
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import { Error, Hint, Label, FormField } from '@ngstarter-ui/components/form-field';
|
|
6
|
-
import { Input } from '@ngstarter-ui/components/input';
|
|
7
|
-
import { TextareaAutoSize } from '@ngstarter-ui/components/core';
|
|
8
|
-
|
|
9
|
-
class TextareaField {
|
|
10
|
-
control = input.required(...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
11
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
12
|
-
getErrorMessage() {
|
|
13
|
-
const errors = this.control().errors;
|
|
14
|
-
if (!errors)
|
|
15
|
-
return '';
|
|
16
|
-
const errorKey = Object.keys(errors)[0];
|
|
17
|
-
const validator = this.config().validators?.find((v) => v.type === errorKey);
|
|
18
|
-
return validator?.message || 'Invalid value';
|
|
19
|
-
}
|
|
20
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: TextareaField, isStandalone: true, selector: "ngs-textarea-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ngsTextareaField"], ngImport: i0, template: "@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <textarea ngsInput\n [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"\n [readonly]=\"config().readonly\"\n ngsTextareaAutoSize></textarea>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: Error, selector: "ngs-error", exportAs: ["ngsError"] }, { kind: "component", type: Hint, selector: "ngs-hint", inputs: ["align"], exportAs: ["ngsHint"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: TextareaAutoSize, selector: "textarea[ngsTextareaAutoSize]", inputs: ["minRows", "maxRows"], exportAs: ["ngsTextareaAutoSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
22
|
-
}
|
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TextareaField, decorators: [{
|
|
24
|
-
type: Component,
|
|
25
|
-
args: [{ selector: 'ngs-textarea-field', exportAs: 'ngsTextareaField', imports: [
|
|
26
|
-
Error,
|
|
27
|
-
Hint,
|
|
28
|
-
Label,
|
|
29
|
-
FormField,
|
|
30
|
-
Input,
|
|
31
|
-
ReactiveFormsModule,
|
|
32
|
-
TextareaAutoSize
|
|
33
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <textarea ngsInput\n [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"\n [readonly]=\"config().readonly\"\n ngsTextareaAutoSize></textarea>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
34
|
-
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
35
|
-
|
|
36
|
-
export { TextareaField };
|
|
37
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer-textarea-field-DxbPsw3z.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-textarea-field-DxbPsw3z.mjs","sources":["../../../projects/components/form-renderer/src/fields/textarea-field/textarea-field.ts","../../../projects/components/form-renderer/src/fields/textarea-field/textarea-field.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { ComponentConfig } from '../../models/form-config.model';\nimport { Error, FormField, Hint, Label } from '@ngstarter-ui/components/form-field';\nimport { Input } from '@ngstarter-ui/components/input';\nimport { TextareaAutoSize } from '@ngstarter-ui/components/core';\n\n@Component({\n selector: 'ngs-textarea-field',\n exportAs: 'ngsTextareaField',\n imports: [\n Error,\n Hint,\n Label,\n FormField,\n Input,\n ReactiveFormsModule,\n TextareaAutoSize\n ],\n templateUrl: './textarea-field.html',\n styleUrl: './textarea-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TextareaField {\n control = input.required<FormControl>();\n config = input.required<ComponentConfig>();\n\n getErrorMessage(): string {\n const errors = this.control().errors;\n if (!errors) return '';\n const errorKey = Object.keys(errors)[0];\n const validator = this.config().validators?.find((v: any) => v.type === errorKey);\n return validator?.message || 'Invalid value';\n }\n}\n","@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <textarea ngsInput\n [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"\n [readonly]=\"config().readonly\"\n ngsTextareaAutoSize></textarea>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n"],"names":[],"mappings":";;;;;;;;MAuBa,aAAa,CAAA;AACxB,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAe;AACvC,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAmB;IAE1C,eAAe,GAAA;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM;AACpC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,EAAE;QACtB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAM,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjF,QAAA,OAAO,SAAS,EAAE,OAAO,IAAI,eAAe;IAC9C;uGAVW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,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I;wBACJ,KAAK;wBACL,SAAS;wBACT,KAAK;wBACL,mBAAmB;wBACnB;qBACD,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,0fAAA,EAAA,MAAA,EAAA,CAAA,qHAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, Component } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/forms';
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import { TimezoneSelect } from '@ngstarter-ui/components/timezone-select';
|
|
6
|
-
import { Error, FormField, Label, Hint } from '@ngstarter-ui/components/form-field';
|
|
7
|
-
|
|
8
|
-
class TimezoneField {
|
|
9
|
-
control = input.required(...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
10
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
11
|
-
getErrorMessage() {
|
|
12
|
-
const errors = this.control().errors;
|
|
13
|
-
if (!errors)
|
|
14
|
-
return '';
|
|
15
|
-
const errorKey = Object.keys(errors)[0];
|
|
16
|
-
const validator = this.config().validators?.find((v) => v.type === errorKey);
|
|
17
|
-
return validator?.message || 'Invalid value';
|
|
18
|
-
}
|
|
19
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TimezoneField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: TimezoneField, isStandalone: true, selector: "ngs-timezone-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ngsTimezoneField"], ngImport: i0, template: "@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-timezone-select [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"/>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}:host ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: Error, selector: "ngs-error", exportAs: ["ngsError"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "component", type: TimezoneSelect, selector: "ngs-timezone-select", inputs: ["aria-describedby", "locale", "placeholder", "required", "disabled", "value", "searchTerm"], outputs: ["valueChange", "searchTermChange", "opened", "closed"], exportAs: ["ngsTimezoneSelect"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Hint, selector: "ngs-hint", inputs: ["align"], exportAs: ["ngsHint"] }] });
|
|
21
|
-
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: TimezoneField, decorators: [{
|
|
23
|
-
type: Component,
|
|
24
|
-
args: [{ selector: 'ngs-timezone-field', exportAs: 'ngsTimezoneField', imports: [
|
|
25
|
-
Error,
|
|
26
|
-
FormField,
|
|
27
|
-
Label,
|
|
28
|
-
TimezoneSelect,
|
|
29
|
-
ReactiveFormsModule,
|
|
30
|
-
Hint
|
|
31
|
-
], template: "@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-timezone-select [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"/>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n", styles: [":host{display:block}:host ngs-form-field{width:100%}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
32
|
-
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
33
|
-
|
|
34
|
-
export { TimezoneField };
|
|
35
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer-timezone-field-DAWrM-jS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-timezone-field-DAWrM-jS.mjs","sources":["../../../projects/components/form-renderer/src/fields/timezone-field/timezone-field.ts","../../../projects/components/form-renderer/src/fields/timezone-field/timezone-field.html"],"sourcesContent":["import { Component, input } from '@angular/core';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { ComponentConfig } from '../../models/form-config.model';\nimport { TimezoneSelect } from '@ngstarter-ui/components/timezone-select';\nimport { Error, FormField, Hint, Label } from '@ngstarter-ui/components/form-field';\n\n@Component({\n selector: 'ngs-timezone-field',\n exportAs: 'ngsTimezoneField',\n imports: [\n Error,\n FormField,\n Label,\n TimezoneSelect,\n ReactiveFormsModule,\n Hint\n ],\n templateUrl: './timezone-field.html',\n styleUrl: './timezone-field.scss'\n})\nexport class TimezoneField {\n control = input.required<FormControl>();\n config = input.required<ComponentConfig>();\n\n getErrorMessage(): string {\n const errors = this.control().errors;\n if (!errors) return '';\n const errorKey = Object.keys(errors)[0];\n const validator = this.config().validators?.find((v: any) => v.type === errorKey);\n return validator?.message || 'Invalid value';\n }\n}\n","@if(control() && config()) {\n <ngs-form-field>\n <ngs-label>{{ config().label }}</ngs-label>\n <ngs-timezone-select [formControl]=\"control()\"\n [placeholder]=\"config().placeholder || ''\"/>\n <ngs-hint>{{ config().hint }}</ngs-hint>\n @if (control().invalid && control().touched) {\n <ngs-error>{{ getErrorMessage() }}</ngs-error>\n }\n </ngs-form-field>\n}\n"],"names":[],"mappings":";;;;;;;MAoBa,aAAa,CAAA;AACxB,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAe;AACvC,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAmB;IAE1C,eAAe,GAAA;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM;AACpC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,EAAE;QACtB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAM,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjF,QAAA,OAAO,SAAS,EAAE,OAAO,IAAI,eAAe;IAC9C;uGAVW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAA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AAc;wBACd,mBAAmB;wBACnB;AACD,qBAAA,EAAA,QAAA,EAAA,2ZAAA,EAAA,MAAA,EAAA,CAAA,2HAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { SlideToggle } from '@ngstarter-ui/components/slide-toggle';
|
|
4
|
-
import * as i1 from '@angular/forms';
|
|
5
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
class ToggleField {
|
|
8
|
-
control = input.required(...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
9
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
10
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ToggleField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
11
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: ToggleField, isStandalone: true, selector: "ngs-toggle-field", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ngsToggleField"], ngImport: i0, template: "@if(control() && config()) {\n <ngs-slide-toggle [formControl]=\"control()\">\n {{ config().label }}\n </ngs-slide-toggle>\n}\n", styles: [":host{display:block;margin-bottom:calc(var(--spacing, .25rem) * 3)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: SlideToggle, selector: "ngs-slide-toggle", inputs: ["id", "name", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "disabled", "disableRipple", "tabIndex", "hideIcon", "color", "checked"], outputs: ["disabledChange", "checkedChange", "change", "toggleChange"], exportAs: ["ngsSlideToggle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
12
|
-
}
|
|
13
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ToggleField, decorators: [{
|
|
14
|
-
type: Component,
|
|
15
|
-
args: [{ selector: 'ngs-toggle-field', exportAs: 'ngsToggleField', imports: [
|
|
16
|
-
SlideToggle,
|
|
17
|
-
ReactiveFormsModule
|
|
18
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if(control() && config()) {\n <ngs-slide-toggle [formControl]=\"control()\">\n {{ config().label }}\n </ngs-slide-toggle>\n}\n", styles: [":host{display:block;margin-bottom:calc(var(--spacing, .25rem) * 3)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
19
|
-
}], propDecorators: { control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: true }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
20
|
-
|
|
21
|
-
export { ToggleField };
|
|
22
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer-toggle-field-iyqUrWxt.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngstarter-ui-components-form-renderer-toggle-field-iyqUrWxt.mjs","sources":["../../../projects/components/form-renderer/src/fields/toggle-field/toggle-field.ts","../../../projects/components/form-renderer/src/fields/toggle-field/toggle-field.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { SlideToggle } from '@ngstarter-ui/components/slide-toggle';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { ComponentConfig } from '../../models/form-config.model';\n\n@Component({\n selector: 'ngs-toggle-field',\n exportAs: 'ngsToggleField',\n imports: [\n SlideToggle,\n ReactiveFormsModule\n ],\n templateUrl: './toggle-field.html',\n styleUrl: './toggle-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToggleField {\n control = input.required<FormControl>();\n config = input.required<ComponentConfig>();\n}\n","@if(control() && config()) {\n <ngs-slide-toggle [formControl]=\"control()\">\n {{ config().label }}\n </ngs-slide-toggle>\n}\n"],"names":[],"mappings":";;;;;;MAgBa,WAAW,CAAA;AACtB,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAe;AACvC,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAmB;uGAF/B,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,WAAW,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EChBxB,sIAKA,EAAA,MAAA,EAAA,CAAA,0IAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDII,WAAW,qVACX,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,oBAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMV,WAAW,EAAA,UAAA,EAAA,CAAA;kBAXvB,SAAS;+BACE,kBAAkB,EAAA,QAAA,EAClB,gBAAgB,EAAA,OAAA,EACjB;wBACP,WAAW;wBACX;qBACD,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,sIAAA,EAAA,MAAA,EAAA,CAAA,0IAAA,CAAA,EAAA;;;;;"}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, Injectable, input, computed, viewChild, ViewContainerRef, effect, Component, DestroyRef, output, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
-
import * as i3 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i1 from '@angular/forms';
|
|
6
|
-
import { Validators, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import { startWith } from 'rxjs/operators';
|
|
8
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
9
|
-
|
|
10
|
-
const FORM_RENDERER_FIELD_REGISTRY = new InjectionToken('FORM_RENDERER_FIELDS_CONFIG');
|
|
11
|
-
|
|
12
|
-
class ComponentRegistryService {
|
|
13
|
-
globalRegistry = inject(FORM_RENDERER_FIELD_REGISTRY, { optional: true });
|
|
14
|
-
componentMap = new Map();
|
|
15
|
-
constructor() {
|
|
16
|
-
this.registerDefaultComponents();
|
|
17
|
-
}
|
|
18
|
-
registerDefaultComponents() {
|
|
19
|
-
this.componentMap.set('input', () => import('./ngstarter-ui-components-form-renderer-input-field-tZHU8-_L.mjs').then(c => c.InputField));
|
|
20
|
-
this.componentMap.set('textarea', () => import('./ngstarter-ui-components-form-renderer-textarea-field-DxbPsw3z.mjs')
|
|
21
|
-
.then(c => c.TextareaField));
|
|
22
|
-
this.componentMap.set('select', () => import('./ngstarter-ui-components-form-renderer-select-field-DyBidcIU.mjs')
|
|
23
|
-
.then(c => c.SelectField));
|
|
24
|
-
this.componentMap.set('checkbox', () => import('./ngstarter-ui-components-form-renderer-checkbox-field-CoyKdvhV.mjs')
|
|
25
|
-
.then(c => c.CheckboxField));
|
|
26
|
-
this.componentMap.set('datepicker', () => import('./ngstarter-ui-components-form-renderer-datepicker-field-Cf3jfPv7.mjs')
|
|
27
|
-
.then(c => c.DatepickerField));
|
|
28
|
-
this.componentMap.set('toggle', () => import('./ngstarter-ui-components-form-renderer-toggle-field-iyqUrWxt.mjs')
|
|
29
|
-
.then(c => c.ToggleField));
|
|
30
|
-
this.componentMap.set('radioGroup', () => import('./ngstarter-ui-components-form-renderer-radio-group-field-DugkPKYU.mjs')
|
|
31
|
-
.then(c => c.RadioGroupField));
|
|
32
|
-
this.componentMap.set('timezone', () => import('./ngstarter-ui-components-form-renderer-timezone-field-DAWrM-jS.mjs')
|
|
33
|
-
.then(c => c.TimezoneField));
|
|
34
|
-
this.componentMap.set('image', () => import('./ngstarter-ui-components-form-renderer-image-content-ICTwkZPa.mjs')
|
|
35
|
-
.then(c => c.ImageContent));
|
|
36
|
-
this.componentMap.set('text', () => import('./ngstarter-ui-components-form-renderer-text-content-BjzH_M3-.mjs')
|
|
37
|
-
.then(c => c.TextContent));
|
|
38
|
-
this.componentMap.set('divider', () => import('./ngstarter-ui-components-form-renderer-divider-content-D8Sffofu.mjs')
|
|
39
|
-
.then(c => c.DividerContent));
|
|
40
|
-
this.componentMap.set('autocompleteMany', () => import('./ngstarter-ui-components-form-renderer-autocomplete-many-field-CGQ3pJaG.mjs')
|
|
41
|
-
.then(c => c.AutocompleteManyField));
|
|
42
|
-
if (this.globalRegistry) {
|
|
43
|
-
const globalRegistry = this.globalRegistry;
|
|
44
|
-
Object.keys(globalRegistry).forEach(typeName => {
|
|
45
|
-
this.componentMap.set(typeName, globalRegistry[typeName]);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
getImporter(typeName) {
|
|
50
|
-
return this.componentMap.get(typeName);
|
|
51
|
-
}
|
|
52
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ComponentRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
53
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ComponentRegistryService, providedIn: 'root' });
|
|
54
|
-
}
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ComponentRegistryService, decorators: [{
|
|
56
|
-
type: Injectable,
|
|
57
|
-
args: [{
|
|
58
|
-
providedIn: 'root',
|
|
59
|
-
}]
|
|
60
|
-
}], ctorParameters: () => [] });
|
|
61
|
-
|
|
62
|
-
class ComponentLoader {
|
|
63
|
-
registry;
|
|
64
|
-
componentConfig = input.required(...(ngDevMode ? [{ debugName: "componentConfig" }] : /* istanbul ignore next */ []));
|
|
65
|
-
control = input(null, ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
66
|
-
colspan = input(...(ngDevMode ? [undefined, { debugName: "colspan" }] : /* istanbul ignore next */ []));
|
|
67
|
-
gridColumnStyle = computed(() => {
|
|
68
|
-
const span = this.colspan();
|
|
69
|
-
return span ? `span ${span}` : null;
|
|
70
|
-
}, ...(ngDevMode ? [{ debugName: "gridColumnStyle" }] : /* istanbul ignore next */ []));
|
|
71
|
-
anchor = viewChild.required('anchor', { read: ViewContainerRef });
|
|
72
|
-
constructor(registry) {
|
|
73
|
-
this.registry = registry;
|
|
74
|
-
effect(async () => {
|
|
75
|
-
const config = this.componentConfig();
|
|
76
|
-
const control = this.control();
|
|
77
|
-
const vcr = this.anchor();
|
|
78
|
-
vcr.clear();
|
|
79
|
-
const importer = this.registry.getImporter(config.type);
|
|
80
|
-
if (importer) {
|
|
81
|
-
try {
|
|
82
|
-
const componentType = await importer();
|
|
83
|
-
const componentRef = vcr.createComponent(componentType);
|
|
84
|
-
componentRef.setInput('config', config);
|
|
85
|
-
if (control) {
|
|
86
|
-
componentRef.setInput('control', control);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.error(`Error loading component for type "${config.type}":`, error);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ComponentLoader, deps: [{ token: ComponentRegistryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
96
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.4", type: ComponentLoader, isStandalone: true, selector: "ngs-component-loader", inputs: { componentConfig: { classPropertyName: "componentConfig", publicName: "componentConfig", isSignal: true, isRequired: true, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, colspan: { classPropertyName: "colspan", publicName: "colspan", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.grid-column": "gridColumnStyle()" } }, viewQueries: [{ propertyName: "anchor", first: true, predicate: ["anchor"], descendants: true, read: ViewContainerRef, isSignal: true }], exportAs: ["ngsComponentLoader"], ngImport: i0, template: "<ng-container #anchor/>\n" });
|
|
97
|
-
}
|
|
98
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ComponentLoader, decorators: [{
|
|
99
|
-
type: Component,
|
|
100
|
-
args: [{ selector: 'ngs-component-loader', exportAs: 'ngsComponentLoader', host: {
|
|
101
|
-
'[style.grid-column]': 'gridColumnStyle()',
|
|
102
|
-
}, template: "<ng-container #anchor/>\n" }]
|
|
103
|
-
}], ctorParameters: () => [{ type: ComponentRegistryService }], propDecorators: { componentConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentConfig", required: true }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], colspan: [{ type: i0.Input, args: [{ isSignal: true, alias: "colspan", required: false }] }], anchor: [{ type: i0.ViewChild, args: ['anchor', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
104
|
-
|
|
105
|
-
class ValidatorRegistryService {
|
|
106
|
-
validatorMap = new Map();
|
|
107
|
-
constructor() {
|
|
108
|
-
this.registerDefaultValidators();
|
|
109
|
-
}
|
|
110
|
-
registerDefaultValidators() {
|
|
111
|
-
this.registerValidator('required', () => Validators.required);
|
|
112
|
-
this.registerValidator('email', () => Validators.email);
|
|
113
|
-
this.registerValidator('minLength', (config) => Validators.minLength(config.value));
|
|
114
|
-
this.registerValidator('maxLength', (config) => Validators.maxLength(config.value));
|
|
115
|
-
this.registerValidator('pattern', (config) => Validators.pattern(config.value));
|
|
116
|
-
}
|
|
117
|
-
registerValidator(name, factory) {
|
|
118
|
-
this.validatorMap.set(name, factory);
|
|
119
|
-
}
|
|
120
|
-
getValidator(config) {
|
|
121
|
-
const factory = this.validatorMap.get(config.type);
|
|
122
|
-
if (!factory) {
|
|
123
|
-
return Validators.nullValidator;
|
|
124
|
-
}
|
|
125
|
-
return factory(config);
|
|
126
|
-
}
|
|
127
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ValidatorRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
128
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ValidatorRegistryService, providedIn: 'root' });
|
|
129
|
-
}
|
|
130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ValidatorRegistryService, decorators: [{
|
|
131
|
-
type: Injectable,
|
|
132
|
-
args: [{
|
|
133
|
-
providedIn: 'root',
|
|
134
|
-
}]
|
|
135
|
-
}], ctorParameters: () => [] });
|
|
136
|
-
|
|
137
|
-
class FormGeneratorService {
|
|
138
|
-
fb;
|
|
139
|
-
validatorRegistry;
|
|
140
|
-
constructor(fb, validatorRegistry) {
|
|
141
|
-
this.fb = fb;
|
|
142
|
-
this.validatorRegistry = validatorRegistry;
|
|
143
|
-
}
|
|
144
|
-
createFormGroup(config, initialValue) {
|
|
145
|
-
const group = this.fb.group({}, { validators: config.crossValidators });
|
|
146
|
-
for (const elementConfig of config.elements) {
|
|
147
|
-
if (elementConfig.kind === 'field') {
|
|
148
|
-
let finalValue = initialValue?.[elementConfig.name] ?? elementConfig.value ?? null;
|
|
149
|
-
if (finalValue === null && 'defaultValue' in elementConfig) {
|
|
150
|
-
finalValue = elementConfig.defaultValue;
|
|
151
|
-
}
|
|
152
|
-
const validators = this.mapValidators(elementConfig.validators);
|
|
153
|
-
const formState = {
|
|
154
|
-
value: finalValue,
|
|
155
|
-
disabled: elementConfig.disabled ?? false
|
|
156
|
-
};
|
|
157
|
-
const control = new FormControl(formState, validators);
|
|
158
|
-
group.addControl(elementConfig.name, control);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return group;
|
|
162
|
-
}
|
|
163
|
-
mapValidators(validators) {
|
|
164
|
-
if (!validators) {
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
return validators.map(config => this.validatorRegistry.getValidator(config));
|
|
168
|
-
}
|
|
169
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FormGeneratorService, deps: [{ token: i1.FormBuilder }, { token: ValidatorRegistryService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
170
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FormGeneratorService, providedIn: 'root' });
|
|
171
|
-
}
|
|
172
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FormGeneratorService, decorators: [{
|
|
173
|
-
type: Injectable,
|
|
174
|
-
args: [{
|
|
175
|
-
providedIn: 'root',
|
|
176
|
-
}]
|
|
177
|
-
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: ValidatorRegistryService }] });
|
|
178
|
-
|
|
179
|
-
class FormRenderer {
|
|
180
|
-
formGenerator;
|
|
181
|
-
validatorRegistry;
|
|
182
|
-
destroyRef = inject(DestroyRef);
|
|
183
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
184
|
-
initialValue = input(...(ngDevMode ? [undefined, { debugName: "initialValue" }] : /* istanbul ignore next */ []));
|
|
185
|
-
formSubmit = output();
|
|
186
|
-
valueChanges = output();
|
|
187
|
-
initialized = output();
|
|
188
|
-
elementsMap = computed(() => {
|
|
189
|
-
const map = new Map();
|
|
190
|
-
for (const element of this.config().elements) {
|
|
191
|
-
map.set(element.name, element);
|
|
192
|
-
}
|
|
193
|
-
return map;
|
|
194
|
-
}, ...(ngDevMode ? [{ debugName: "elementsMap" }] : /* istanbul ignore next */ []));
|
|
195
|
-
formGroup = computed(() => this.formGenerator.createFormGroup(this.config(), this.initialValue()), ...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
196
|
-
#initialized = false;
|
|
197
|
-
valueChangesSub;
|
|
198
|
-
constructor(formGenerator, validatorRegistry) {
|
|
199
|
-
this.formGenerator = formGenerator;
|
|
200
|
-
this.validatorRegistry = validatorRegistry;
|
|
201
|
-
effect(() => {
|
|
202
|
-
this.valueChangesSub?.unsubscribe();
|
|
203
|
-
const form = this.formGroup();
|
|
204
|
-
this.valueChangesSub = form.valueChanges
|
|
205
|
-
.pipe(startWith(form.value), takeUntilDestroyed(this.destroyRef))
|
|
206
|
-
.subscribe(() => {
|
|
207
|
-
for (const elementConfig of this.config().elements) {
|
|
208
|
-
if (elementConfig.kind === 'field') {
|
|
209
|
-
const control = form.get(elementConfig.name);
|
|
210
|
-
if (!control) {
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
const isVisible = elementConfig.visibleWhen ? elementConfig.visibleWhen(form) : true;
|
|
214
|
-
const shouldBeEnabled = !(elementConfig.disabled ?? false) && isVisible;
|
|
215
|
-
if (shouldBeEnabled && control.disabled) {
|
|
216
|
-
control.enable({ emitEvent: false });
|
|
217
|
-
const validators = this.mapValidators(elementConfig.validators);
|
|
218
|
-
control.setValidators(validators);
|
|
219
|
-
}
|
|
220
|
-
else if (!shouldBeEnabled && control.enabled) {
|
|
221
|
-
control.disable({ emitEvent: false });
|
|
222
|
-
control.clearValidators();
|
|
223
|
-
}
|
|
224
|
-
control.updateValueAndValidity({ emitEvent: false });
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (!this.#initialized) {
|
|
228
|
-
this.#initialized = true;
|
|
229
|
-
this.initialized.emit();
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
ngOnInit() {
|
|
235
|
-
const form = this.formGroup();
|
|
236
|
-
form
|
|
237
|
-
.valueChanges
|
|
238
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
239
|
-
.subscribe(() => {
|
|
240
|
-
if (!this.#initialized) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
this.valueChanges.emit(form.value);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
ngOnDestroy() {
|
|
247
|
-
this.valueChangesSub?.unsubscribe();
|
|
248
|
-
}
|
|
249
|
-
submit() {
|
|
250
|
-
const form = this.formGroup();
|
|
251
|
-
if (form.valid) {
|
|
252
|
-
this.formSubmit.emit(form.getRawValue());
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
form.markAllAsTouched();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
get form() {
|
|
259
|
-
return this.formGroup();
|
|
260
|
-
}
|
|
261
|
-
get value() {
|
|
262
|
-
return this.formGroup().value;
|
|
263
|
-
}
|
|
264
|
-
get isValid() {
|
|
265
|
-
return this.form.valid;
|
|
266
|
-
}
|
|
267
|
-
get isInvalid() {
|
|
268
|
-
return this.form.invalid;
|
|
269
|
-
}
|
|
270
|
-
isFieldVisible(name) {
|
|
271
|
-
const componentConfig = this.elementsMap().get(name);
|
|
272
|
-
if (!componentConfig) {
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
if (componentConfig.kind === 'field' && componentConfig.visibleWhen) {
|
|
276
|
-
return componentConfig.visibleWhen(this.formGroup());
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
getComponentConfig(name) {
|
|
281
|
-
return this.elementsMap().get(name);
|
|
282
|
-
}
|
|
283
|
-
getControl(name) {
|
|
284
|
-
return this.formGroup().get(name);
|
|
285
|
-
}
|
|
286
|
-
isGridNode(node) {
|
|
287
|
-
return 'children' in node;
|
|
288
|
-
}
|
|
289
|
-
onSubmit() {
|
|
290
|
-
this.submit();
|
|
291
|
-
}
|
|
292
|
-
mapValidators(validators) {
|
|
293
|
-
if (!validators) {
|
|
294
|
-
return [];
|
|
295
|
-
}
|
|
296
|
-
return validators.map(config => this.validatorRegistry.getValidator(config));
|
|
297
|
-
}
|
|
298
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FormRenderer, deps: [{ token: FormGeneratorService }, { token: ValidatorRegistryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
299
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: FormRenderer, isStandalone: true, selector: "ngs-form-renderer", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSubmit: "formSubmit", valueChanges: "valueChanges", initialized: "initialized" }, host: { classAttribute: "ngs-form-renderer" }, exportAs: ["ngsFormRenderer"], ngImport: i0, template: "@if (config(); as cfg) {\n <form [formGroup]=\"formGroup()\" (ngSubmit)=\"onSubmit()\">\n <ng-container *ngTemplateOutlet=\"renderNode; context: {$implicit: cfg.layout}\" />\n <ng-content/>\n </form>\n}\n\n<ng-template #renderNode let-node>\n @if (isGridNode(node)) {\n <div\n class=\"grid-layout\"\n [style.grid-template-columns]=\"'repeat(' + node.columns + ', 1fr)'\"\n [style.gap]=\"node.gap\">\n @for (childNode of node.children; track childNode) {\n <ng-container *ngTemplateOutlet=\"renderNode; context: {$implicit: childNode}\" />\n }\n </div>\n } @else {\n @if(isFieldVisible(node.name)) {\n <ngs-component-loader [componentConfig]=\"getComponentConfig(node.name)!\"\n [control]=\"getControl(node.name)\"\n [colspan]=\"node.colspan\" />\n }\n }\n</ng-template>\n", styles: [":host{display:block}:host .grid-layout{display:grid;width:100%;gap:calc(var(--spacing, .25rem) * 4) calc(var(--spacing, .25rem) * 7)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: ComponentLoader, selector: "ngs-component-loader", inputs: ["componentConfig", "control", "colspan"], exportAs: ["ngsComponentLoader"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
300
|
-
}
|
|
301
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: FormRenderer, decorators: [{
|
|
302
|
-
type: Component,
|
|
303
|
-
args: [{ selector: 'ngs-form-renderer', exportAs: 'ngsFormRenderer', imports: [
|
|
304
|
-
CommonModule,
|
|
305
|
-
ReactiveFormsModule,
|
|
306
|
-
ComponentLoader,
|
|
307
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
308
|
-
'class': 'ngs-form-renderer',
|
|
309
|
-
}, template: "@if (config(); as cfg) {\n <form [formGroup]=\"formGroup()\" (ngSubmit)=\"onSubmit()\">\n <ng-container *ngTemplateOutlet=\"renderNode; context: {$implicit: cfg.layout}\" />\n <ng-content/>\n </form>\n}\n\n<ng-template #renderNode let-node>\n @if (isGridNode(node)) {\n <div\n class=\"grid-layout\"\n [style.grid-template-columns]=\"'repeat(' + node.columns + ', 1fr)'\"\n [style.gap]=\"node.gap\">\n @for (childNode of node.children; track childNode) {\n <ng-container *ngTemplateOutlet=\"renderNode; context: {$implicit: childNode}\" />\n }\n </div>\n } @else {\n @if(isFieldVisible(node.name)) {\n <ngs-component-loader [componentConfig]=\"getComponentConfig(node.name)!\"\n [control]=\"getControl(node.name)\"\n [colspan]=\"node.colspan\" />\n }\n }\n</ng-template>\n", styles: [":host{display:block}:host .grid-layout{display:grid;width:100%;gap:calc(var(--spacing, .25rem) * 4) calc(var(--spacing, .25rem) * 7)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
310
|
-
}], ctorParameters: () => [{ type: FormGeneratorService }, { type: ValidatorRegistryService }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], initialValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialValue", required: false }] }], formSubmit: [{ type: i0.Output, args: ["formSubmit"] }], valueChanges: [{ type: i0.Output, args: ["valueChanges"] }], initialized: [{ type: i0.Output, args: ["initialized"] }] } });
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Generated bundle index. Do not edit.
|
|
314
|
-
*/
|
|
315
|
-
|
|
316
|
-
export { ComponentRegistryService, FORM_RENDERER_FIELD_REGISTRY, FormRenderer, ValidatorRegistryService };
|
|
317
|
-
//# sourceMappingURL=ngstarter-ui-components-form-renderer.mjs.map
|