@ibyar/forms 4.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2025 @ibyar/forms
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Ibyar Forms
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![LICENSE][license-img]][license-url]
6
+ [![lerna][lerna-img]][lerna-url]
7
+ ![GitHub contributors][contributors]
8
+
9
+ [npm-image]: https://img.shields.io/npm/v/@ibyar/forms.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen
10
+ [npm-url]: https://npmjs.org/package/@ibyar/forms
11
+ [downloads-image]: https://img.shields.io/npm/dt/@ibyar/forms
12
+ [downloads-url]: https://npmjs.org/package/@ibyar/forms
13
+ [license-img]: https://img.shields.io/github/license/ibyar/aurora
14
+ [license-url]: https://github.com/ibyar/aurora/blob/master/LICENSE
15
+ [lerna-img]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
16
+ [lerna-url]: https://lerna.js.org/
17
+ [contributors]: https://img.shields.io/github/contributors/ibyar/aurora
18
+
19
+ Ibyar forms contain form group, form builder and native ui form group.
20
+
21
+ ## `Install`
22
+
23
+ ``` bash
24
+ npm i --save @ibyar/forms
25
+ ```
26
+
27
+ ``` bash
28
+ yarn add @ibyar/forms
29
+ ```
30
+
@@ -0,0 +1,12 @@
1
+ import { ArrayControls, FormArray } from '../forms/form-array.js';
2
+ import { FormControl } from '../forms/form-control.js';
3
+ import { FormGroup, GroupeControls } from '../forms/form-group.js';
4
+ import { ControlOptions, ControlValue } from './types.js';
5
+ export declare class FormBuilder {
6
+ control<T>(value?: T | ControlValue<T> | null, options?: ControlOptions): FormControl<T>;
7
+ group<T>(controls: GroupeControls<T>, options?: ControlOptions): FormGroup<T>;
8
+ array<T>(controls: ArrayControls<T>, options?: ControlOptions): FormArray<T>;
9
+ private initValidators;
10
+ private getSafeArrayValue;
11
+ }
12
+ //# sourceMappingURL=form-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-builder.d.ts","sourceRoot":"","sources":["../../../src/forms/builder/form-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAG1E,qBACa,WAAW;IAEhB,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC,CAAC,CAAC;IAOxF,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC;IAM7E,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC;IAMnF,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,iBAAiB;CAMzB"}
@@ -0,0 +1,55 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Injectable } from '@ibyar/core';
3
+ import { FormArray } from '../forms/form-array.js';
4
+ import { FormControl } from '../forms/form-control.js';
5
+ import { FormGroup } from '../forms/form-group.js';
6
+ import { isControlValue } from './types.js';
7
+ let FormBuilder = (() => {
8
+ let _classDecorators = [Injectable({ provideIn: 'root' })];
9
+ let _classDescriptor;
10
+ let _classExtraInitializers = [];
11
+ let _classThis;
12
+ var FormBuilder = class {
13
+ static { _classThis = this; }
14
+ static {
15
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
16
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
17
+ FormBuilder = _classThis = _classDescriptor.value;
18
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
19
+ __runInitializers(_classThis, _classExtraInitializers);
20
+ }
21
+ control(value, options) {
22
+ const { value: controlValue, disabled } = isControlValue(value) ? value : { value, disabled: false };
23
+ const formControl = new FormControl(controlValue, disabled);
24
+ this.initValidators(formControl, options);
25
+ return formControl;
26
+ }
27
+ group(controls, options) {
28
+ const formGroup = new FormGroup(controls);
29
+ this.initValidators(formGroup, options);
30
+ return formGroup;
31
+ }
32
+ array(controls, options) {
33
+ const formArray = new FormArray(controls);
34
+ this.initValidators(formArray, options);
35
+ return formArray;
36
+ }
37
+ initValidators(control, options) {
38
+ if (!options) {
39
+ return;
40
+ }
41
+ const validators = this.getSafeArrayValue(options.validators);
42
+ const asyncValidators = this.getSafeArrayValue(options.asyncValidators);
43
+ validators.forEach(validator => control.addValidator(validator));
44
+ asyncValidators.forEach(validator => control.addAsyncValidator(validator));
45
+ }
46
+ getSafeArrayValue(object) {
47
+ return Array.isArray(object)
48
+ ? object
49
+ : typeof object === 'object' && object !== null ? [object] : [];
50
+ }
51
+ };
52
+ return FormBuilder = _classThis;
53
+ })();
54
+ export { FormBuilder };
55
+ //# sourceMappingURL=form-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-builder.js","sourceRoot":"","sources":["../../../src/forms/builder/form-builder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAiB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAgC,cAAc,EAAE,MAAM,YAAY,CAAC;IAI7D,WAAW;4BADvB,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;;;;;;;;YAClC,6KAqCC;;;YArCY,uDAAW;;QAEhB,OAAO,CAAI,KAAkC,EAAE,OAAwB;YAC7E,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YACrG,MAAM,WAAW,GAAG,IAAI,WAAW,CAAI,YAAY,EAAE,QAAQ,CAAC,CAAC;YAC/D,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,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ArrayControls, FormArray } from '../forms/form-array.js';\nimport { AbstractControl, FormControl } from '../forms/form-control.js';\nimport { FormGroup, GroupeControls } from '../forms/form-group.js';\nimport { ControlOptions, ControlValue, isControlValue } from './types.js';\n\n\n@Injectable({ provideIn: 'root' })\nexport class FormBuilder {\n\n\tpublic control<T>(value?: T | ControlValue<T> | null, options?: ControlOptions): FormControl<T> {\n\t\tconst { value: controlValue, disabled } = isControlValue(value) ? value : { value, disabled: false };\n\t\tconst formControl = new FormControl<T>(controlValue, disabled);\n\t\tthis.initValidators(formControl, options);\n\t\treturn formControl;\n\t}\n\n\tpublic group<T>(controls: GroupeControls<T>, options?: ControlOptions): FormGroup<T> {\n\t\tconst formGroup = new FormGroup<T>(controls);\n\t\tthis.initValidators(formGroup, options);\n\t\treturn formGroup;\n\t}\n\n\tpublic array<T>(controls: ArrayControls<T>, options?: ControlOptions): FormArray<T> {\n\t\tconst formArray = new FormArray<T>(controls);\n\t\tthis.initValidators(formArray, options);\n\t\treturn formArray;\n\t}\n\n\tprivate initValidators(control: AbstractControl<any>, options?: ControlOptions) {\n\t\tif (!options) {\n\t\t\treturn;\n\t\t}\n\t\tconst validators = this.getSafeArrayValue(options.validators);\n\t\tconst asyncValidators = this.getSafeArrayValue(options.asyncValidators);\n\t\tvalidators.forEach(validator => control.addValidator(validator));\n\t\tasyncValidators.forEach(validator => control.addAsyncValidator(validator));\n\t}\n\n\tprivate getSafeArrayValue<T>(object?: T | T[] | null): T[] {\n\t\treturn Array.isArray(object)\n\t\t\t? object\n\t\t\t: typeof object === 'object' && object !== null ? [object] : [];\n\t}\n\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { AsyncValidator, Validator } from '../forms/validators.js';
2
+ export type ControlOptions = {
3
+ validators?: Validator | Validator[];
4
+ asyncValidators?: AsyncValidator | AsyncValidator[];
5
+ };
6
+ export type ControlValue<T = any> = {
7
+ value?: T | null;
8
+ disabled: boolean;
9
+ };
10
+ export declare function isControlValue<T>(ref: any): ref is ControlValue<T>;
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,MAAM,cAAc,GAAG;IAAE,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAAC,eAAe,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAA;CAAE,CAAA;AAE1H,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI;IAAE,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5E,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAElE"}
@@ -0,0 +1,4 @@
1
+ export function isControlValue(ref) {
2
+ return ref?.value || ref?.disabled;
3
+ }
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/forms/builder/types.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,cAAc,CAAI,GAAQ;IACzC,OAAO,GAAG,EAAE,KAAK,IAAI,GAAG,EAAE,QAAQ,CAAC;AACpC,CAAC","sourcesContent":["import { AsyncValidator, Validator } from '../forms/validators.js';\n\nexport type ControlOptions = { validators?: Validator | Validator[], asyncValidators?: AsyncValidator | AsyncValidator[] }\n\nexport type ControlValue<T = any> = { value?: T | null, disabled: boolean };\n\nexport function isControlValue<T>(ref: any): ref is ControlValue<T> {\n\treturn ref?.value || ref?.disabled;\n}\n"]}
@@ -0,0 +1,40 @@
1
+ import { AttributeDirective } from '@ibyar/core';
2
+ import { AbstractControl } from './form-control.js';
3
+ import { AbstractFormGroup } from './form-group.js';
4
+ export type ArrayControlType<T> = T extends {
5
+ [key in keyof T]: any;
6
+ } ? AbstractFormGroup<T> : T extends Array<infer A> ? AbstractFormArray<A> : AbstractControl<T>;
7
+ export type ArrayControls<T> = Array<ArrayControlType<T>>;
8
+ export declare abstract class AbstractFormArray<T> extends AbstractControl<T> {
9
+ protected controls: ArrayControls<T>;
10
+ constructor(controls: ArrayControls<T>);
11
+ abstract at(index: number): ArrayControlType<T> | undefined;
12
+ abstract push(control: ArrayControlType<T>): number;
13
+ }
14
+ export declare class FormArray<T> extends AbstractFormArray<T> {
15
+ get valid(): boolean;
16
+ get invalid(): boolean;
17
+ get pristine(): boolean;
18
+ get dirty(): boolean;
19
+ get touched(): boolean;
20
+ get untouched(): boolean;
21
+ at(index: number): ArrayControlType<T> | undefined;
22
+ push(control: ArrayControlType<T>): number;
23
+ updateValue(value: T | null): void;
24
+ updateValidity(): void;
25
+ }
26
+ export declare class FormArrayDirective extends AttributeDirective {
27
+ }
28
+ export declare class FormArrayNameDirective extends AttributeDirective {
29
+ }
30
+ export type ɵɵ0FormArrayDirective0ɵɵ = {
31
+ selector: "formArray";
32
+ successors: [
33
+ ];
34
+ };
35
+ export type ɵɵ0FormArrayNameDirective0ɵɵ = {
36
+ selector: "formArrayName";
37
+ successors: [
38
+ ];
39
+ };
40
+ //# sourceMappingURL=form-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-array.d.ts","sourceRoot":"","sources":["../../../src/forms/forms/form-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAa,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG;CAAE,GAClE,iBAAiB,CAAC,CAAC,CAAC,GACpB,CAAC,SAAS,K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AC;IAAA,UAAU,EAAC;KAAG,CAAA;CAAC,CAAC;AAAC,MAAM,MAAK,4BACxB,GAAE;IAAE,QAAQ,EAAC,eAAgB,CAAC;IAAA,UAAU,EAAC;KAAG,CAAA;CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { AttributeDirective, Directive } from '@ibyar/core';
3
+ import { AbstractControl } from './form-control.js';
4
+ export class AbstractFormArray extends AbstractControl {
5
+ controls;
6
+ constructor(controls) {
7
+ super();
8
+ this.controls = controls ?? [];
9
+ }
10
+ }
11
+ export class FormArray extends AbstractFormArray {
12
+ get valid() {
13
+ throw new Error('Method not implemented.');
14
+ }
15
+ get invalid() {
16
+ throw new Error('Method not implemented.');
17
+ }
18
+ get pristine() {
19
+ throw new Error('Method not implemented.');
20
+ }
21
+ get dirty() {
22
+ throw new Error('Method not implemented.');
23
+ }
24
+ get touched() {
25
+ throw new Error('Method not implemented.');
26
+ }
27
+ get untouched() {
28
+ throw new Error('Method not implemented.');
29
+ }
30
+ at(index) {
31
+ return this.controls.at(index);
32
+ }
33
+ push(control) {
34
+ return this.controls.push(control);
35
+ }
36
+ updateValue(value) {
37
+ throw new Error('Method not implemented.');
38
+ }
39
+ updateValidity() {
40
+ throw new Error('Method not implemented.');
41
+ }
42
+ }
43
+ let FormArrayDirective = (() => {
44
+ let _classDecorators = [Directive({
45
+ selector: 'formArray'
46
+ })];
47
+ let _classDescriptor;
48
+ let _classExtraInitializers = [];
49
+ let _classThis;
50
+ let _classSuper = AttributeDirective;
51
+ var FormArrayDirective = class extends _classSuper {
52
+ static { _classThis = this; }
53
+ static {
54
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
+ FormArrayDirective = _classThis = _classDescriptor.value;
57
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
+ __runInitializers(_classThis, _classExtraInitializers);
59
+ }
60
+ };
61
+ return FormArrayDirective = _classThis;
62
+ })();
63
+ export { FormArrayDirective };
64
+ let FormArrayNameDirective = (() => {
65
+ let _classDecorators = [Directive({
66
+ selector: 'formArrayName'
67
+ })];
68
+ let _classDescriptor;
69
+ let _classExtraInitializers = [];
70
+ let _classThis;
71
+ let _classSuper = AttributeDirective;
72
+ var FormArrayNameDirective = class extends _classSuper {
73
+ static { _classThis = this; }
74
+ static {
75
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
76
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
77
+ FormArrayNameDirective = _classThis = _classDescriptor.value;
78
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
79
+ __runInitializers(_classThis, _classExtraInitializers);
80
+ }
81
+ };
82
+ return FormArrayNameDirective = _classThis;
83
+ })();
84
+ export { FormArrayNameDirective };
85
+ //# sourceMappingURL=form-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-array.js","sourceRoot":"","sources":["../../../src/forms/forms/form-array.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWpD,MAAM,OAAgB,iBAAqB,SAAQ,eAAkB;IAE1D,QAAQ,CAAmB;IAErC,YAAY,QAA0B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,EAAE,CAAC;IAChC,CAAC;CAID;AAED,MAAM,OAAO,SAAa,SAAQ,iBAAoB;IAErD,IAAI,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,QAAQ;QACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,EAAE,CAAC,KAAa;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC,OAA4B;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IACD,WAAW,CAAC,KAAe;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,cAAc;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD;IAKY,kBAAkB;4BAH9B,SAAS,CAAC;YACV,QAAQ,EAAE,WAAW;SACrB,CAAC;;;;sBACsC,kBAAkB;kCAA1B,SAAQ,WAAkB;;;;YAA1D,6KAEC;;;YAFY,uDAAkB;;;;;SAAlB,kBAAkB;IAOlB,sBAAsB;4BAHlC,SAAS,CAAC;YACV,QAAQ,EAAE,eAAe;SACzB,CAAC;;;;sBAC0C,kBAAkB;sCAA1B,SAAQ,WAAkB;;;;YAA9D,6KAEC;;;YAFY,uDAAsB;;;;;SAAtB,sBAAsB","sourcesContent":["import { AttributeDirective, Directive } from '@ibyar/core';\nimport { AbstractControl } from './form-control.js';\nimport { AbstractFormGroup } from './form-group.js';\n\nexport type ArrayControlType<T> = T extends { [key in keyof T]: any }\n\t? AbstractFormGroup<T>\n\t: T extends Array<infer A>\n\t? AbstractFormArray<A>\n\t: AbstractControl<T>;\n\nexport type ArrayControls<T> = Array<ArrayControlType<T>>;\n\nexport abstract class AbstractFormArray<T> extends AbstractControl<T> {\n\n\tprotected controls: ArrayControls<T>;\n\n\tconstructor(controls: ArrayControls<T>) {\n\t\tsuper();\n\t\tthis.controls = controls ?? [];\n\t}\n\n\tabstract at(index: number): ArrayControlType<T> | undefined;\n\tabstract push(control: ArrayControlType<T>): number;\n}\n\nexport class FormArray<T> extends AbstractFormArray<T> {\n\n\tget valid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget invalid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget pristine(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget dirty(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget touched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget untouched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tat(index: number): ArrayControlType<T> | undefined {\n\t\treturn this.controls.at(index);\n\t}\n\tpush(control: ArrayControlType<T>): number {\n\t\treturn this.controls.push(control);\n\t}\n\tupdateValue(value: T | null): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tupdateValidity(): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\n@Directive({\n\tselector: 'formArray'\n})\nexport class FormArrayDirective extends AttributeDirective {\n\n}\n\n@Directive({\n\tselector: 'formArrayName'\n})\nexport class FormArrayNameDirective extends AttributeDirective {\n\n}\n"]}
@@ -0,0 +1,52 @@
1
+ import { AttributeDirective } from '@ibyar/core';
2
+ import type { AsyncValidator, Validator } from './validators.js';
3
+ export declare abstract class AbstractControl<T> {
4
+ value: T | null | undefined;
5
+ disabled: boolean | null | undefined;
6
+ validators?: Validator[] | null;
7
+ asyncValidators?: AsyncValidator[] | null;
8
+ errors?: {
9
+ [key: string]: any;
10
+ } | null;
11
+ abstract get valid(): boolean;
12
+ abstract get invalid(): boolean;
13
+ abstract get pristine(): boolean;
14
+ abstract get dirty(): boolean;
15
+ abstract get touched(): boolean;
16
+ abstract get untouched(): boolean;
17
+ abstract updateValue(value: T | null): void;
18
+ abstract updateValidity(): void;
19
+ addValidator(validator: Validator): void;
20
+ removeValidator(validator: Validator): void;
21
+ addAsyncValidator(asyncValidator: AsyncValidator): void;
22
+ removeAsyncValidator(asyncValidator: AsyncValidator): void;
23
+ private addValidatorByArray;
24
+ private isFound;
25
+ private removeValidatorByArray;
26
+ }
27
+ export declare class FormControl<T> extends AbstractControl<T> {
28
+ constructor(value?: T | null, disabled?: boolean);
29
+ get valid(): boolean;
30
+ get invalid(): boolean;
31
+ get pristine(): boolean;
32
+ get dirty(): boolean;
33
+ get touched(): boolean;
34
+ get untouched(): boolean;
35
+ updateValue(value: T | null): void;
36
+ updateValidity(): void;
37
+ }
38
+ export declare class FormControlDirective extends AttributeDirective {
39
+ }
40
+ export declare class FormControlNameDirective extends AttributeDirective {
41
+ }
42
+ export type ɵɵ0FormControlDirective0ɵɵ = {
43
+ selector: "formControl";
44
+ successors: [
45
+ ];
46
+ };
47
+ export type ɵɵ0FormControlNameDirective0ɵɵ = {
48
+ selector: "formControlName";
49
+ successors: [
50
+ ];
51
+ };
52
+ //# sourceMappingURL=form-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-control.d.ts","sourceRoot":"","sources":["../../../src/forms/forms/form-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjE,8BAAsB,eAAe,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,OAA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,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,WAAW,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IAGlC,cAAc,IAAI,IAAI;CAGtB;AAGD,qBAGa,oBAAqB,SAAQ,kBAAkB;CAG3D;AAED,qBAGa,wBAAyB,SAAQ,kBAAkB;CAG/D;AAzGD,MAAM,MAAK,0BAA2B,GAAE;IAAE,QAAQ,EAAE,aAAa,CAAC;IAClE,UAAS,EAAC;KAAG,CAAA;CAAC,CAAC;AAAC,MAAM,MAAK,8BAA+B,GAAE;IAAE,QAE3D,EAAC,iBAAkB,CAAC;IAAA,UAAU,EAAC;KAAG,CAAA;CAAC,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { AttributeDirective, Directive } from '@ibyar/core';
3
+ export class AbstractControl {
4
+ value;
5
+ disabled;
6
+ validators;
7
+ asyncValidators;
8
+ errors;
9
+ addValidator(validator) {
10
+ this.addValidatorByArray(validator, this.validators ??= []);
11
+ }
12
+ removeValidator(validator) {
13
+ this.removeValidatorByArray(validator, this.validators);
14
+ }
15
+ addAsyncValidator(asyncValidator) {
16
+ this.addValidatorByArray(asyncValidator, this.asyncValidators ??= []);
17
+ }
18
+ removeAsyncValidator(asyncValidator) {
19
+ this.removeValidatorByArray(asyncValidator, this.asyncValidators);
20
+ }
21
+ addValidatorByArray(validator, list) {
22
+ const found = list.some(this.isFound(validator, validator.constructor));
23
+ if (found) {
24
+ return;
25
+ }
26
+ list.push(validator);
27
+ }
28
+ isFound(validator, classConstructor) {
29
+ if (classConstructor) {
30
+ return (v) => v === validator || v instanceof classConstructor;
31
+ }
32
+ return (v) => v === validator;
33
+ }
34
+ removeValidatorByArray(validator, list) {
35
+ if (!Array.isArray(list)) {
36
+ return;
37
+ }
38
+ const index = list.indexOf(validator);
39
+ if (index === -1) {
40
+ return;
41
+ }
42
+ list.splice(index, 1);
43
+ }
44
+ }
45
+ export class FormControl extends AbstractControl {
46
+ constructor(value, disabled) {
47
+ super();
48
+ this.value = value;
49
+ this.disabled = disabled;
50
+ }
51
+ get valid() {
52
+ throw new Error('Method not implemented.');
53
+ }
54
+ get invalid() {
55
+ throw new Error('Method not implemented.');
56
+ }
57
+ get pristine() {
58
+ throw new Error('Method not implemented.');
59
+ }
60
+ get dirty() {
61
+ throw new Error('Method not implemented.');
62
+ }
63
+ get touched() {
64
+ throw new Error('Method not implemented.');
65
+ }
66
+ get untouched() {
67
+ throw new Error('Method not implemented.');
68
+ }
69
+ updateValue(value) {
70
+ throw new Error('Method not implemented.');
71
+ }
72
+ updateValidity() {
73
+ throw new Error('Method not implemented.');
74
+ }
75
+ }
76
+ let FormControlDirective = (() => {
77
+ let _classDecorators = [Directive({
78
+ selector: 'formControl'
79
+ })];
80
+ let _classDescriptor;
81
+ let _classExtraInitializers = [];
82
+ let _classThis;
83
+ let _classSuper = AttributeDirective;
84
+ var FormControlDirective = class extends _classSuper {
85
+ static { _classThis = this; }
86
+ static {
87
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
88
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
89
+ FormControlDirective = _classThis = _classDescriptor.value;
90
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
91
+ __runInitializers(_classThis, _classExtraInitializers);
92
+ }
93
+ };
94
+ return FormControlDirective = _classThis;
95
+ })();
96
+ export { FormControlDirective };
97
+ let FormControlNameDirective = (() => {
98
+ let _classDecorators = [Directive({
99
+ selector: 'formControlName'
100
+ })];
101
+ let _classDescriptor;
102
+ let _classExtraInitializers = [];
103
+ let _classThis;
104
+ let _classSuper = AttributeDirective;
105
+ var FormControlNameDirective = class extends _classSuper {
106
+ static { _classThis = this; }
107
+ static {
108
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
109
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
110
+ FormControlNameDirective = _classThis = _classDescriptor.value;
111
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
112
+ __runInitializers(_classThis, _classExtraInitializers);
113
+ }
114
+ };
115
+ return FormControlNameDirective = _classThis;
116
+ })();
117
+ export { FormControlNameDirective };
118
+ //# sourceMappingURL=form-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-control.js","sourceRoot":"","sources":["../../../src/forms/forms/form-control.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAQ,MAAM,aAAa,CAAC;AAGlE,MAAM,OAAgB,eAAe;IACpC,KAAK,CAAuB;IAC5B,QAAQ,CAA6B;IACrC,UAAU,CAAsB;IAChC,eAAe,CAA2B;IAC1C,MAAM,CAAiC;IAYvC,YAAY,CAAC,SAAoB;QAChC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,eAAe,CAAC,SAAoB;QACnC,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IACD,iBAAiB,CAAC,cAA8B;QAC/C,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,oBAAoB,CAAC,cAA8B;QAClD,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;IACO,mBAAmB,CAAiC,SAAY,EAAE,IAAS;QAClF,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAA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,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,OAAO;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,WAAW,CAAC,KAAe;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,cAAc;QACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD;IAMY,oBAAoB;4BAHhC,SAAS,CAAC;YACV,QAAQ,EAAE,aAAa;SACvB,CAAC;;;;sBACwC,kBAAkB;oCAA1B,SAAQ,WAAkB;;;;YAA5D,6KAGC;;;YAHY,uDAAoB;;;;;SAApB,oBAAoB;IAQpB,wBAAwB;4BAHpC,SAAS,CAAC;YACV,QAAQ,EAAE,iBAAiB;SAC3B,CAAC;;;;sBAC4C,kBAAkB;wCAA1B,SAAQ,WAAkB;;;;YAAhE,6KAGC;;;YAHY,uDAAwB;;;;;SAAxB,wBAAwB","sourcesContent":["import { AttributeDirective, Directive, Type } from '@ibyar/core';\nimport type { AsyncValidator, Validator } from './validators.js';\n\nexport abstract class AbstractControl<T> {\n\tvalue: T | null | undefined;\n\tdisabled: boolean | null | undefined;\n\tvalidators?: Validator[] | null;\n\tasyncValidators?: AsyncValidator[] | null;\n\terrors?: { [key: string]: any } | null;\n\n\tabstract get valid(): boolean;\n\tabstract get invalid(): boolean;\n\tabstract get pristine(): boolean;\n\tabstract get dirty(): boolean;\n\tabstract get touched(): boolean;\n\tabstract get untouched(): boolean;\n\n\tabstract updateValue(value: T | null): void;\n\tabstract updateValidity(): void;\n\n\taddValidator(validator: Validator): void {\n\t\tthis.addValidatorByArray(validator, this.validators ??= []);\n\t}\n\tremoveValidator(validator: Validator): void {\n\t\tthis.removeValidatorByArray(validator, this.validators);\n\t}\n\taddAsyncValidator(asyncValidator: AsyncValidator): void {\n\t\tthis.addValidatorByArray(asyncValidator, this.asyncValidators ??= []);\n\t}\n\tremoveAsyncValidator(asyncValidator: AsyncValidator): void {\n\t\tthis.removeValidatorByArray(asyncValidator, this.asyncValidators);\n\t}\n\tprivate addValidatorByArray<V = Validator | AsyncValidator>(validator: V, list: V[]): void {\n\t\tconst found = list.some(this.isFound(validator, (validator as any).constructor as Type<V>));\n\t\tif (found) {\n\t\t\treturn;\n\t\t}\n\t\tlist.push(validator);\n\t}\n\tprivate isFound<V = Validator | AsyncValidator>(validator: V, classConstructor?: Type<V>) {\n\t\tif (classConstructor) {\n\t\t\treturn (v: V) => v === validator || v instanceof classConstructor;\n\t\t}\n\t\treturn (v: V) => v === validator;\n\t}\n\tprivate removeValidatorByArray<V = Validator | AsyncValidator>(validator: V, list?: V[] | null): void {\n\t\tif (!Array.isArray(list)) {\n\t\t\treturn;\n\t\t}\n\t\tconst index = list.indexOf(validator);\n\t\tif (index === -1) {\n\t\t\treturn;\n\t\t}\n\t\tlist.splice(index, 1);\n\t}\n}\n\nexport class FormControl<T> extends AbstractControl<T> {\n\n\tconstructor(value?: T | null, disabled?: boolean) {\n\t\tsuper();\n\t\tthis.value = value;\n\t\tthis.disabled = disabled;\n\t}\n\tget valid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget invalid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget pristine(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget dirty(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget touched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget untouched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tupdateValue(value: T | null): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tupdateValidity(): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\n\n@Directive({\n\tselector: 'formControl'\n})\nexport class FormControlDirective extends AttributeDirective {\n\n\n}\n\n@Directive({\n\tselector: 'formControlName'\n})\nexport class FormControlNameDirective extends AttributeDirective {\n\n\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import { AttributeDirective, OnInit } from '@ibyar/core';
2
+ import { AbstractControl } from './form-control.js';
3
+ import { AbstractFormArray } from './form-array.js';
4
+ export type GroupControlType<T, K extends keyof T> = T[K] extends Array<infer A> ? AbstractFormArray<A> : T[K] extends {
5
+ [key in K]: infer G;
6
+ } ? AbstractFormGroup<G> : AbstractControl<T[K]>;
7
+ export type GroupeControls<T> = {
8
+ [K in keyof T]: GroupControlType<T, K>;
9
+ };
10
+ export declare abstract class AbstractFormGroup<T> extends AbstractControl<T> {
11
+ controls: GroupeControls<T>;
12
+ constructor(controls?: GroupeControls<T>);
13
+ abstract get<K extends keyof T>(name: K): GroupControlType<T, K> | undefined;
14
+ abstract addControl<K extends keyof T>(name: K, control: GroupControlType<T, K>): void;
15
+ abstract removeControl<K extends keyof T>(name: K): void;
16
+ }
17
+ export declare class FormGroup<T> extends AbstractFormGroup<T> {
18
+ get valid(): boolean;
19
+ get invalid(): boolean;
20
+ get pristine(): boolean;
21
+ get dirty(): boolean;
22
+ get touched(): boolean;
23
+ get untouched(): boolean;
24
+ get<K extends keyof T>(key: K): GroupControlType<T, K> | undefined;
25
+ addControl<K extends keyof T>(name: K, control: GroupControlType<T, K>): void;
26
+ removeControl<K extends keyof T>(name: K): void;
27
+ updateValue(value: T | null): void;
28
+ updateValidity(): void;
29
+ }
30
+ export declare class FormGroupDirective<T> extends AttributeDirective implements OnInit {
31
+ protected el: HTMLFormElement;
32
+ formGroup: import("@ibyar/core").InputWithoutTransform<FormGroup<T>>;
33
+ onInit(): void;
34
+ onSubmit(event: Event): void;
35
+ get valid(): boolean;
36
+ }
37
+ export type ɵɵ0FormGroupDirective0ɵɵ = {
38
+ selector: "formGroup";
39
+ successors: [
40
+ ];
41
+ inputs: [
42
+ {
43
+ name: "formGroup";
44
+ aliasName: "formGroup";
45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AY,CAAA;SAAC;KAAC,CAAA;CAAC,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { AttributeDirective, Directive, HostBinding, HostListener, input } from '@ibyar/core';
3
+ import { AbstractControl } from './form-control.js';
4
+ export class AbstractFormGroup extends AbstractControl {
5
+ controls;
6
+ constructor(controls) {
7
+ super();
8
+ this.controls = controls ?? {};
9
+ }
10
+ }
11
+ export class FormGroup extends AbstractFormGroup {
12
+ get valid() {
13
+ throw new Error('Method not implemented.');
14
+ }
15
+ get invalid() {
16
+ throw new Error('Method not implemented.');
17
+ }
18
+ get pristine() {
19
+ throw new Error('Method not implemented.');
20
+ }
21
+ get dirty() {
22
+ throw new Error('Method not implemented.');
23
+ }
24
+ get touched() {
25
+ throw new Error('Method not implemented.');
26
+ }
27
+ get untouched() {
28
+ throw new Error('Method not implemented.');
29
+ }
30
+ get(key) {
31
+ return this.controls[key];
32
+ }
33
+ addControl(name, control) {
34
+ this.controls[name] = control;
35
+ }
36
+ removeControl(name) {
37
+ delete this.controls[name];
38
+ }
39
+ updateValue(value) {
40
+ throw new Error('Method not implemented.');
41
+ }
42
+ updateValidity() {
43
+ throw new Error('Method not implemented.');
44
+ }
45
+ }
46
+ let FormGroupDirective = (() => {
47
+ let _classDecorators = [Directive({
48
+ selector: 'formGroup'
49
+ })];
50
+ let _classDescriptor;
51
+ let _classExtraInitializers = [];
52
+ let _classThis;
53
+ let _classSuper = AttributeDirective;
54
+ let _instanceExtraInitializers = [];
55
+ let _onSubmit_decorators;
56
+ let _get_valid_decorators;
57
+ var FormGroupDirective = class extends _classSuper {
58
+ static { _classThis = this; }
59
+ static {
60
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
61
+ _onSubmit_decorators = [HostListener('submit', ['$event'])];
62
+ _get_valid_decorators = [HostBinding('class.valid')];
63
+ __esDecorate(this, null, _onSubmit_decorators, { kind: "method", name: "onSubmit", static: false, private: false, access: { has: obj => "onSubmit" in obj, get: obj => obj.onSubmit }, metadata: _metadata }, null, _instanceExtraInitializers);
64
+ __esDecorate(this, null, _get_valid_decorators, { kind: "getter", name: "valid", static: false, private: false, access: { has: obj => "valid" in obj, get: obj => obj.valid }, metadata: _metadata }, null, _instanceExtraInitializers);
65
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
66
+ FormGroupDirective = _classThis = _classDescriptor.value;
67
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
68
+ __runInitializers(_classThis, _classExtraInitializers);
69
+ }
70
+ formGroup = (__runInitializers(this, _instanceExtraInitializers), input());
71
+ onInit() {
72
+ this.el.noValidate = true;
73
+ console.log('el', this.el);
74
+ console.log('formGroup', this.formGroup.get());
75
+ const elements = this.el.elements;
76
+ const length = elements.length;
77
+ for (let i = 0; i < length; i++) {
78
+ const element = elements.item(i);
79
+ if (element.type === 'submit' || element.type === 'hidden' || !element.name) {
80
+ continue;
81
+ }
82
+ const value = this.formGroup.get().controls[element.name].value;
83
+ if (value) {
84
+ element.value = value;
85
+ }
86
+ }
87
+ }
88
+ onSubmit(event) {
89
+ console.log('directive host listener works');
90
+ console.log('$event', event);
91
+ event.preventDefault();
92
+ const formData = new FormData(event.target);
93
+ const collect = {};
94
+ formData.forEach((value, key) => Reflect.set(collect, key, value));
95
+ console.log('collect', collect);
96
+ }
97
+ get valid() {
98
+ return true;
99
+ }
100
+ };
101
+ return FormGroupDirective = _classThis;
102
+ })();
103
+ export { FormGroupDirective };
104
+ //# sourceMappingURL=form-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-group.js","sourceRoot":"","sources":["../../../src/forms/forms/form-group.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAU,MA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,CAAC;QAGD,QAAQ,CAAC,KAAY;YACpB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC7B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAyB,CAAC,CAAC;YAC/D,MAAM,OAAO,GAAG,EAAE,CAAC;YACnB,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjC,CAAC;QAKD,IAAI,KAAK;YACR,OAAO,IAAI,CAAC;QACb,CAAC;;;;SAzCW,kBAAkB","sourcesContent":["import { AttributeDirective, Directive, HostBinding, HostListener, input, OnInit } from '@ibyar/core';\nimport { AbstractControl } from './form-control.js';\nimport { AbstractFormArray } from './form-array.js';\n\nexport type GroupControlType<T, K extends keyof T> = T[K] extends Array<infer A>\n\t? AbstractFormArray<A>\n\t: T[K] extends { [key in K]: infer G }\n\t? AbstractFormGroup<G>\n\t: AbstractControl<T[K]>\n\t;\n\nexport type GroupeControls<T> = { [K in keyof T]: GroupControlType<T, K> };\n\nexport abstract class AbstractFormGroup<T> extends AbstractControl<T> {\n\tcontrols: GroupeControls<T>;\n\n\tconstructor(controls?: GroupeControls<T>) {\n\t\tsuper();\n\t\tthis.controls = controls ?? {} as GroupeControls<T>;\n\t}\n\tabstract get<K extends keyof T>(name: K): GroupControlType<T, K> | undefined;\n\tabstract addControl<K extends keyof T>(name: K, control: GroupControlType<T, K>): void;\n\tabstract removeControl<K extends keyof T>(name: K): void;\n}\n\nexport class FormGroup<T> extends AbstractFormGroup<T> {\n\tget valid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget invalid(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget pristine(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget dirty(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget touched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget untouched(): boolean {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\n\tget<K extends keyof T>(key: K): GroupControlType<T, K> | undefined {\n\t\treturn this.controls[key];\n\t}\n\n\taddControl<K extends keyof T>(name: K, control: GroupControlType<T, K>): void {\n\t\tthis.controls[name] = control;\n\t}\n\n\tremoveControl<K extends keyof T>(name: K): void {\n\t\tdelete this.controls[name];\n\t}\n\tupdateValue(value: T | null): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tupdateValidity(): void {\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\n\n@Directive({\n\tselector: 'formGroup'\n})\nexport class FormGroupDirective<T> extends AttributeDirective implements OnInit {\n\n\tdeclare protected el: HTMLFormElement;\n\n\n\tformGroup = input<FormGroup<T>>();\n\n\tonInit(): void {\n\t\tthis.el.noValidate = true;\n\t\tconsole.log('el', this.el);\n\t\tconsole.log('formGroup', this.formGroup.get());\n\t\tconst elements = this.el.elements;\n\t\tconst length = elements.length;\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tconst element = elements.item(i) as HTMLInputElement;\n\t\t\tif (element.type === 'submit' || element.type === 'hidden' || !element.name) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst value = this.formGroup.get().controls[element.name as keyof T].value as string | undefined;\n\t\t\tif (value) {\n\t\t\t\telement.value = value;\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener('submit', ['$event'])\n\tonSubmit(event: Event) {\n\t\tconsole.log('directive host listener works');\n\t\tconsole.log('$event', event);\n\t\tevent.preventDefault();\n\t\tconst formData = new FormData(event.target as HTMLFormElement);\n\t\tconst collect = {};\n\t\tformData.forEach((value, key) => Reflect.set(collect, key, value));\n\t\tconsole.log('collect', collect);\n\t}\n\n\n\n\t@HostBinding('class.valid')\n\tget valid(): boolean {\n\t\treturn true;\n\t}\n\n}\n\n"]}
@@ -0,0 +1,18 @@
1
+ export interface Mapper<A, B> {
2
+ convert(input: A): B;
3
+ }
4
+ export declare class InputNumberMapper implements Mapper<string, number> {
5
+ convert(input: string): number;
6
+ }
7
+ export declare class InputDateMapper implements Mapper<string | number, Date> {
8
+ convert(input: string | number): Date;
9
+ }
10
+ export declare class InputDefaultMapper<T = any> implements Mapper<T, T> {
11
+ convert(input: T): T;
12
+ }
13
+ export declare class Mappers {
14
+ static default: InputDefaultMapper<any>;
15
+ static number: InputNumberMapper;
16
+ static date: InputDateMapper;
17
+ }
18
+ //# sourceMappingURL=mappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../src/forms/forms/mappers.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC;IAC3B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;CACrB;AAED,qBAAa,iBAAkB,YAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAC/D,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAG9B;AAED,qBAAa,eAAgB,YAAW,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC;IACpE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAGrC;AAED,qBAAa,kBAAkB,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC;CAGpB;AAED,qBAAa,OAAO;IACnB,MAAM,CAAC,OAAO,0BAA4B;IAC1C,MAAM,CAAC,MAAM,oBAA2B;IACxC,MAAM,CAAC,IAAI,kBAAyB;CACpC"}
@@ -0,0 +1,21 @@
1
+ export class InputNumberMapper {
2
+ convert(input) {
3
+ return +input;
4
+ }
5
+ }
6
+ export class InputDateMapper {
7
+ convert(input) {
8
+ return new Date(input);
9
+ }
10
+ }
11
+ export class InputDefaultMapper {
12
+ convert(input) {
13
+ return input;
14
+ }
15
+ }
16
+ export class Mappers {
17
+ static default = new InputDefaultMapper();
18
+ static number = new InputNumberMapper();
19
+ static date = new InputDateMapper();
20
+ }
21
+ //# sourceMappingURL=mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../src/forms/forms/mappers.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,iBAAiB;IAC7B,OAAO,CAAC,KAAa;QACpB,OAAO,CAAC,KAAK,CAAC;IACf,CAAC;CACD;AAED,MAAM,OAAO,eAAe;IAC3B,OAAO,CAAC,KAAsB;QAC7B,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;CACD;AAED,MAAM,OAAO,kBAAkB;IAC9B,OAAO,CAAC,KAAQ;QACf,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAED,MAAM,OAAO,OAAO;IACnB,MAAM,CAAC,OAAO,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC1C,MAAM,CAAC,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;IACxC,MAAM,CAAC,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["\nexport interface Mapper<A, B> {\n\tconvert(input: A): B;\n}\n\nexport class InputNumberMapper implements Mapper<string, number> {\n\tconvert(input: string): number {\n\t\treturn +input;\n\t}\n}\n\nexport class InputDateMapper implements Mapper<string | number, Date> {\n\tconvert(input: string | number): Date {\n\t\treturn new Date(input);\n\t}\n}\n\nexport class InputDefaultMapper<T = any> implements Mapper<T, T>{\n\tconvert(input: T): T {\n\t\treturn input;\n\t}\n}\n\nexport class Mappers {\n\tstatic default = new InputDefaultMapper();\n\tstatic number = new InputNumberMapper();\n\tstatic date = new InputDateMapper();\n}\n"]}
@@ -0,0 +1,92 @@
1
+ import type { AbstractControl } from './form-control.js';
2
+ /**
3
+ * Defines the map of errors returned from failed validation checks.
4
+ */
5
+ export type ValidationErrors = {
6
+ /**
7
+ * Adds a custom error message to the element;
8
+ * if you set a custom error message, the element is considered to be invalid,
9
+ * and the specified error is displayed.
10
+ * This lets you use JavaScript code to establish a validation failure
11
+ * other than those offered by the standard HTML validation constraints.
12
+ * The message is shown to the user when reporting the problem.
13
+ */
14
+ customValidityMessage?: string | null;
15
+ /**
16
+ * any error name that
17
+ */
18
+ [error: string]: any;
19
+ };
20
+ export interface Validator {
21
+ validate(control: AbstractControl<any>): ValidationErrors | null;
22
+ updateCustomValidityMessage(message?: string | null): void;
23
+ }
24
+ export interface AsyncValidator {
25
+ validate(control: AbstractControl<any>): Promise<ValidationErrors | null>;
26
+ updateCustomValidityMessage(message?: string | null): void;
27
+ }
28
+ export declare class RequiredValidator implements Validator {
29
+ private message?;
30
+ constructor(message?: string | null | undefined);
31
+ validate(control: AbstractControl<any>): ValidationErrors | null;
32
+ updateCustomValidityMessage(message?: string | null): void;
33
+ }
34
+ export declare class RequiredTrueValidator implements Validator {
35
+ private message?;
36
+ constructor(message?: string | null | undefined);
37
+ validate(control: AbstractControl<boolean>): ValidationErrors | null;
38
+ updateCustomValidityMessage(message?: string | null): void;
39
+ }
40
+ export declare class MinimumValidator implements Validator {
41
+ private min;
42
+ private message?;
43
+ constructor(min: number, message?: string | null | undefined);
44
+ validate(control: AbstractControl<string>): ValidationErrors | null;
45
+ updateCustomValidityMessage(message?: string | null): void;
46
+ }
47
+ export declare class MaximumValidator implements Validator {
48
+ private max;
49
+ private message?;
50
+ constructor(max: number, message?: string | null | undefined);
51
+ validate(control: AbstractControl<string>): ValidationErrors | null;
52
+ updateCustomValidityMessage(message?: string | null): void;
53
+ }
54
+ export declare class EmailValidator implements Validator {
55
+ private message?;
56
+ constructor(message?: string | null | undefined);
57
+ validate(control: AbstractControl<string>): ValidationErrors | null;
58
+ updateCustomValidityMessage(message?: string | null): void;
59
+ }
60
+ export declare class MinLengthValidator implements Validator {
61
+ private minLength;
62
+ private message?;
63
+ constructor(minLength: number, message?: string | null | undefined);
64
+ validate(control: AbstractControl<string>): ValidationErrors | null;
65
+ updateCustomValidityMessage(message?: string | null): void;
66
+ }
67
+ export declare class MaxLengthValidator implements Validator {
68
+ private maxLength;
69
+ private message?;
70
+ constructor(maxLength: number, message?: string | null | undefined);
71
+ validate(control: AbstractControl<string>): ValidationErrors | null;
72
+ updateCustomValidityMessage(message?: string | null): void;
73
+ }
74
+ export declare class PatternValidator implements Validator {
75
+ private message?;
76
+ private regex;
77
+ private regexStr;
78
+ constructor(pattern: RegExp | string, message?: string | null | undefined);
79
+ validate(control: AbstractControl<string>): ValidationErrors | null;
80
+ updateCustomValidityMessage(message?: string | null): void;
81
+ }
82
+ export declare class Validators {
83
+ static required(customValidityMessage?: string): RequiredValidator;
84
+ static requiredTrue(customValidityMessage?: string): RequiredTrueValidator;
85
+ static min(min: number, customValidityMessage?: string): MinimumValidator;
86
+ static max(max: number, customValidityMessage?: string): MaximumValidator;
87
+ static email(customValidityMessage?: string): EmailValidator;
88
+ static minLength(minLength: number, customValidityMessage?: string): MinLengthValidator;
89
+ static maxLength(maxLength: number, customValidityMessage?: string): MaxLengthValidator;
90
+ static pattern(pattern: string | RegExp, customValidityMessage?: string): PatternValidator | null;
91
+ }
92
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/forms/forms/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,CAAC,KAAK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
2
+ return value == null ||
3
+ ((typeof value === 'string' || Array.isArray(value)) && value.length === 0);
4
+ }
5
+ function hasValidLength(value) {
6
+ return value != null && typeof value.length === 'number';
7
+ }
8
+ const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
9
+ export class RequiredValidator {
10
+ message;
11
+ constructor(message) {
12
+ this.message = message;
13
+ }
14
+ validate(control) {
15
+ return isEmptyInputValue(control.value)
16
+ ? {
17
+ required: true,
18
+ customValidityMessage: this.message
19
+ }
20
+ : null;
21
+ }
22
+ updateCustomValidityMessage(message) {
23
+ this.message = message;
24
+ }
25
+ }
26
+ export class RequiredTrueValidator {
27
+ message;
28
+ constructor(message) {
29
+ this.message = message;
30
+ }
31
+ validate(control) {
32
+ return control.value === true
33
+ ? null
34
+ : {
35
+ required: true,
36
+ customValidityMessage: this.message
37
+ };
38
+ }
39
+ updateCustomValidityMessage(message) {
40
+ this.message = message;
41
+ }
42
+ }
43
+ export class MinimumValidator {
44
+ min;
45
+ message;
46
+ constructor(min, message) {
47
+ this.min = min;
48
+ this.message = message;
49
+ }
50
+ validate(control) {
51
+ if (isEmptyInputValue(control.value) || isEmptyInputValue(this.min)) {
52
+ return null;
53
+ }
54
+ const value = parseFloat(control.value);
55
+ return !isNaN(value) && value < this.min
56
+ ? {
57
+ min: { min: this.min, actual: control.value },
58
+ customValidityMessage: this.message,
59
+ }
60
+ : null;
61
+ }
62
+ updateCustomValidityMessage(message) {
63
+ this.message = message;
64
+ }
65
+ }
66
+ export class MaximumValidator {
67
+ max;
68
+ message;
69
+ constructor(max, message) {
70
+ this.max = max;
71
+ this.message = message;
72
+ }
73
+ validate(control) {
74
+ if (isEmptyInputValue(control.value) || isEmptyInputValue(this.max)) {
75
+ return null;
76
+ }
77
+ const value = parseFloat(control.value);
78
+ return !isNaN(value) && value > this.max
79
+ ? {
80
+ max: { max: this.max, actual: control.value },
81
+ customValidityMessage: this.message,
82
+ }
83
+ : null;
84
+ }
85
+ updateCustomValidityMessage(message) {
86
+ this.message = message;
87
+ }
88
+ }
89
+ export class EmailValidator {
90
+ message;
91
+ constructor(message) {
92
+ this.message = message;
93
+ }
94
+ validate(control) {
95
+ if (isEmptyInputValue(control.value)) {
96
+ return null;
97
+ }
98
+ return EMAIL_REGEXP.test(control.value)
99
+ ? null
100
+ : {
101
+ email: true,
102
+ customValidityMessage: this.message
103
+ };
104
+ }
105
+ updateCustomValidityMessage(message) {
106
+ this.message = message;
107
+ }
108
+ }
109
+ export class MinLengthValidator {
110
+ minLength;
111
+ message;
112
+ constructor(minLength, message) {
113
+ this.minLength = minLength;
114
+ this.message = message;
115
+ }
116
+ validate(control) {
117
+ if (isEmptyInputValue(control.value) || !hasValidLength(control.value)) {
118
+ return null;
119
+ }
120
+ return control.value.length < this.minLength
121
+ ? {
122
+ minlength: { requiredLength: this.minLength, actualLength: control.value.length },
123
+ customValidityMessage: this.message,
124
+ }
125
+ : null;
126
+ }
127
+ updateCustomValidityMessage(message) {
128
+ this.message = message;
129
+ }
130
+ }
131
+ export class MaxLengthValidator {
132
+ maxLength;
133
+ message;
134
+ constructor(maxLength, message) {
135
+ this.maxLength = maxLength;
136
+ this.message = message;
137
+ }
138
+ validate(control) {
139
+ return hasValidLength(control.value) && (control.value?.length ?? 0) > this.maxLength
140
+ ? {
141
+ maxlength: { requiredLength: this.maxLength, actualLength: control.value?.length ?? 0 },
142
+ customValidityMessage: this.message,
143
+ }
144
+ : null;
145
+ }
146
+ updateCustomValidityMessage(message) {
147
+ this.maxLength = this.maxLength;
148
+ }
149
+ }
150
+ export class PatternValidator {
151
+ message;
152
+ regex;
153
+ regexStr;
154
+ constructor(pattern, message) {
155
+ this.message = message;
156
+ if (typeof pattern === 'string') {
157
+ this.regexStr = '';
158
+ if (pattern.charAt(0) !== '^') {
159
+ this.regexStr += '^';
160
+ }
161
+ this.regexStr += pattern;
162
+ if (pattern.charAt(pattern.length - 1) !== '$') {
163
+ this.regexStr += '$';
164
+ }
165
+ this.regex = new RegExp(this.regexStr);
166
+ }
167
+ else {
168
+ this.regexStr = pattern.toString();
169
+ this.regex = pattern;
170
+ }
171
+ }
172
+ validate(control) {
173
+ if (isEmptyInputValue(control.value)) {
174
+ return null;
175
+ }
176
+ const value = control.value;
177
+ return this.regex.test(value)
178
+ ? null
179
+ : {
180
+ pattern: { requiredPattern: this.regexStr, actualValue: value },
181
+ customValidityMessage: this.message,
182
+ };
183
+ }
184
+ updateCustomValidityMessage(message) {
185
+ this.message = message;
186
+ }
187
+ }
188
+ export class Validators {
189
+ static required(customValidityMessage) {
190
+ return new RequiredValidator(customValidityMessage);
191
+ }
192
+ static requiredTrue(customValidityMessage) {
193
+ return new RequiredTrueValidator(customValidityMessage);
194
+ }
195
+ static min(min, customValidityMessage) {
196
+ return new MinimumValidator(min, customValidityMessage);
197
+ }
198
+ static max(max, customValidityMessage) {
199
+ return new MaximumValidator(max, customValidityMessage);
200
+ }
201
+ static email(customValidityMessage) {
202
+ return new EmailValidator(customValidityMessage);
203
+ }
204
+ static minLength(minLength, customValidityMessage) {
205
+ return new MinLengthValidator(minLength, customValidityMessage);
206
+ }
207
+ static maxLength(maxLength, customValidityMessage) {
208
+ return new MaxLengthValidator(maxLength, customValidityMessage);
209
+ }
210
+ static pattern(pattern, customValidityMessage) {
211
+ if (!pattern) {
212
+ return null;
213
+ }
214
+ return new PatternValidator(pattern, customValidityMessage);
215
+ }
216
+ }
217
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/forms/forms/validators.ts"],"names":[],"mappings":"AAkCA,SAAS,iBAAiB,CAAC,KAAU;IACpC,OAAO,KA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;IAED,MAAM,CAAC,KAAK,CAAC,qBAA8B;QAC1C,OAAO,IAAI,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,SAAiB,EAAE,qBAA8B;QACjE,OAAO,IAAI,kBAAkB,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,SAAiB,EAAE,qBAA8B;QACjE,OAAO,IAAI,kBAAkB,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,OAAwB,EAAE,qBAA8B;QACtE,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAC7D,CAAC;CACD","sourcesContent":["import type { AbstractControl } from './form-control.js';\n\n\n/**\n * Defines the map of errors returned from failed validation checks.\n */\nexport type ValidationErrors = {\n\t/**\n\t * Adds a custom error message to the element;\n\t * if you set a custom error message, the element is considered to be invalid, \n\t * and the specified error is displayed.\n\t * This lets you use JavaScript code to establish a validation failure\n\t * other than those offered by the standard HTML validation constraints.\n\t * The message is shown to the user when reporting the problem.\n\t */\n\tcustomValidityMessage?: string | null;\n\n\t/**\n\t * any error name that\n\t */\n\t[error: string]: any;\n};\n\nexport interface Validator {\n\tvalidate(control: AbstractControl<any>): ValidationErrors | null;\n\tupdateCustomValidityMessage(message?: string | null): void;\n}\n\nexport interface AsyncValidator {\n\tvalidate(control: AbstractControl<any>): Promise<ValidationErrors | null>;\n\tupdateCustomValidityMessage(message?: string | null): void;\n}\n\n\nfunction isEmptyInputValue(value: any): value is null | undefined | '' | [] {\n\treturn value == null ||\n\t\t((typeof value === 'string' || Array.isArray(value)) && value.length === 0);\n}\n\nfunction hasValidLength(value: any) {\n\treturn value != null && typeof value.length === 'number';\n}\n\nconst EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n\nexport class RequiredValidator implements Validator {\n\tconstructor(private message?: string | null) { }\n\tvalidate(control: AbstractControl<any>): ValidationErrors | null {\n\t\treturn isEmptyInputValue(control.value)\n\t\t\t? {\n\t\t\t\trequired: true,\n\t\t\t\tcustomValidityMessage: this.message\n\t\t\t}\n\t\t\t: null;\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\nexport class RequiredTrueValidator implements Validator {\n\tconstructor(private message?: string | null) { }\n\tvalidate(control: AbstractControl<boolean>): ValidationErrors | null {\n\t\treturn control.value === true\n\t\t\t? null\n\t\t\t: {\n\t\t\t\trequired: true,\n\t\t\t\tcustomValidityMessage: this.message\n\t\t\t};\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\nexport class MinimumValidator implements Validator {\n\tconstructor(private min: number, private message?: string | null) { }\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\tif (isEmptyInputValue(control.value) || isEmptyInputValue(this.min)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst value = parseFloat(control.value);\n\t\treturn !isNaN(value) && value < this.min\n\t\t\t? {\n\t\t\t\tmin: { min: this.min, actual: control.value },\n\t\t\t\tcustomValidityMessage: this.message,\n\t\t\t}\n\t\t\t: null;\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\nexport class MaximumValidator implements Validator {\n\tconstructor(private max: number, private message?: string | null) { }\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\tif (isEmptyInputValue(control.value) || isEmptyInputValue(this.max)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst value = parseFloat(control.value);\n\t\treturn !isNaN(value) && value > this.max\n\t\t\t? {\n\t\t\t\tmax: { max: this.max, actual: control.value },\n\t\t\t\tcustomValidityMessage: this.message,\n\t\t\t}\n\t\t\t: null;\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\n\nexport class EmailValidator implements Validator {\n\tconstructor(private message?: string | null) { }\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\tif (isEmptyInputValue(control.value)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn EMAIL_REGEXP.test(control.value)\n\t\t\t? null\n\t\t\t: {\n\t\t\t\temail: true,\n\t\t\t\tcustomValidityMessage: this.message\n\t\t\t};\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\nexport class MinLengthValidator implements Validator {\n\tconstructor(private minLength: number, private message?: string | null) { }\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\tif (isEmptyInputValue(control.value) || !hasValidLength(control.value)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn control.value.length < this.minLength\n\t\t\t? {\n\t\t\t\tminlength: { requiredLength: this.minLength, actualLength: control.value.length },\n\t\t\t\tcustomValidityMessage: this.message,\n\t\t\t}\n\t\t\t: null;\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\nexport class MaxLengthValidator implements Validator {\n\tconstructor(private maxLength: number, private message?: string | null) { }\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\treturn hasValidLength(control.value) && (control.value?.length ?? 0) > this.maxLength\n\t\t\t? {\n\t\t\t\tmaxlength: { requiredLength: this.maxLength, actualLength: control.value?.length ?? 0 },\n\t\t\t\tcustomValidityMessage: this.message,\n\t\t\t}\n\t\t\t: null;\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.maxLength = this.maxLength;\n\t}\n}\n\nexport class PatternValidator implements Validator {\n\n\tprivate regex: RegExp;\n\tprivate regexStr: string;\n\tconstructor(pattern: RegExp | string, private message?: string | null) {\n\t\tif (typeof pattern === 'string') {\n\t\t\tthis.regexStr = '';\n\t\t\tif (pattern.charAt(0) !== '^') {\n\t\t\t\tthis.regexStr += '^';\n\t\t\t}\n\t\t\tthis.regexStr += pattern;\n\t\t\tif (pattern.charAt(pattern.length - 1) !== '$') {\n\t\t\t\tthis.regexStr += '$';\n\t\t\t}\n\t\t\tthis.regex = new RegExp(this.regexStr);\n\t\t}\n\t\telse {\n\t\t\tthis.regexStr = pattern.toString();\n\t\t\tthis.regex = pattern;\n\t\t}\n\t}\n\tvalidate(control: AbstractControl<string>): ValidationErrors | null {\n\t\tif (isEmptyInputValue(control.value)) {\n\t\t\treturn null;\n\t\t}\n\t\tconst value = control.value;\n\t\treturn this.regex.test(value)\n\t\t\t? null\n\t\t\t: {\n\t\t\t\tpattern: { requiredPattern: this.regexStr, actualValue: value },\n\t\t\t\tcustomValidityMessage: this.message,\n\t\t\t};\n\t}\n\tupdateCustomValidityMessage(message?: string | null): void {\n\t\tthis.message = message;\n\t}\n}\n\n\nexport class Validators {\n\n\tstatic required(customValidityMessage?: string): RequiredValidator {\n\t\treturn new RequiredValidator(customValidityMessage);\n\t}\n\n\tstatic requiredTrue(customValidityMessage?: string): RequiredTrueValidator {\n\t\treturn new RequiredTrueValidator(customValidityMessage);\n\t}\n\n\tstatic min(min: number, customValidityMessage?: string): MinimumValidator {\n\t\treturn new MinimumValidator(min, customValidityMessage);\n\t}\n\n\tstatic max(max: number, customValidityMessage?: string): MaximumValidator {\n\t\treturn new MaximumValidator(max, customValidityMessage);\n\t}\n\n\tstatic email(customValidityMessage?: string) {\n\t\treturn new EmailValidator(customValidityMessage);\n\t}\n\n\tstatic minLength(minLength: number, customValidityMessage?: string): MinLengthValidator {\n\t\treturn new MinLengthValidator(minLength, customValidityMessage);\n\t}\n\n\tstatic maxLength(maxLength: number, customValidityMessage?: string): MaxLengthValidator {\n\t\treturn new MaxLengthValidator(maxLength, customValidityMessage);\n\t}\n\n\tstatic pattern(pattern: string | RegExp, customValidityMessage?: string): PatternValidator | null {\n\t\tif (!pattern) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new PatternValidator(pattern, customValidityMessage);\n\t}\n}\n"]}
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './forms/mappers.js';
2
+ export * from './forms/form-control.js';
3
+ export * from './forms/validators.js';
4
+ export * from './forms/form-array.js';
5
+ export * from './forms/form-group.js';
6
+ export * from './builder/form-builder.js';
7
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './forms/mappers.js';
2
+ export * from './forms/form-control.js';
3
+ export * from './forms/validators.js';
4
+ export * from './forms/form-array.js';
5
+ export * from './forms/form-group.js';
6
+ export * from './builder/form-builder.js';
7
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './forms/mappers.js';\nexport * from './forms/form-control.js';\nexport * from './forms/validators.js';\nexport * from './forms/form-array.js';\nexport * from './forms/form-group.js';\nexport * from './builder/form-builder.js';\n"]}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@ibyar/forms",
3
+ "version": "4.0.0",
4
+ "description": "Ibyar forms contain form group, form builder and native ui form group",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/ibyar/aurora/tree/dev/packages/forms",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ibyar/aurora.git",
10
+ "directory": "packages/forms"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ibyar/aurora/issues"
14
+ },
15
+ "author": "The Ibyar Authors (https://github.com/ibyar/aurora/graphs/contributors)",
16
+ "contributors": [
17
+ {
18
+ "name": "Muhammad Salem",
19
+ "email": "salem.ebo@gmail.com",
20
+ "url": "https://github.com/muhammad-salem"
21
+ }
22
+ ],
23
+ "main": "./index.js",
24
+ "module": "./index.js",
25
+ "types": "./index.d.ts",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": "./index.js"
29
+ },
30
+ "files": [
31
+ "*"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "@ibyar/core": "^4.0.0",
38
+ "@ibyar/platform": "^4.0.0",
39
+ "tslib": "^2.8.1"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.8.3"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc --build --verbose",
46
+ "docs": "npx typedoc --tsconfig ../../src/forms/tsconfig.json"
47
+ },
48
+ "keywords": [
49
+ "aurora",
50
+ "ibyar",
51
+ "directives",
52
+ "typescript",
53
+ "front-end"
54
+ ],
55
+ "gitHead": "6671356b7c827061a32d138db5cad660ad0053c5"
56
+ }
package/typedoc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": [
3
+ "../../typedoc.base.json"
4
+ ],
5
+ "entryPoints": [
6
+ "../../src/forms/index.ts"
7
+ ]
8
+ }