@webilix/ngx-form-m3 0.0.1

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.
Files changed (37) hide show
  1. package/README.md +6 -0
  2. package/fesm2022/webilix-ngx-form-m3.mjs +964 -0
  3. package/fesm2022/webilix-ngx-form-m3.mjs.map +1 -0
  4. package/index.d.ts +5 -0
  5. package/lib/directives/auto-complete.directive.d.ts +6 -0
  6. package/lib/directives/auto-focus.directive.d.ts +10 -0
  7. package/lib/directives/auto-height.directive.d.ts +18 -0
  8. package/lib/directives/form-error.directive.d.ts +12 -0
  9. package/lib/directives/index.d.ts +4 -0
  10. package/lib/inputs/email/input-email.component.d.ts +13 -0
  11. package/lib/inputs/email/input-email.interface.d.ts +10 -0
  12. package/lib/inputs/index.d.ts +17 -0
  13. package/lib/inputs/input.component.d.ts +51 -0
  14. package/lib/inputs/input.info.d.ts +10 -0
  15. package/lib/inputs/input.interface.d.ts +26 -0
  16. package/lib/inputs/mobile/input-mobile.component.d.ts +14 -0
  17. package/lib/inputs/mobile/input-mobile.interface.d.ts +10 -0
  18. package/lib/inputs/name/input-name.component.d.ts +17 -0
  19. package/lib/inputs/name/input-name.interface.d.ts +15 -0
  20. package/lib/inputs/password/input-password.component.d.ts +14 -0
  21. package/lib/inputs/password/input-password.interface.d.ts +15 -0
  22. package/lib/inputs/select/input-select.component.d.ts +14 -0
  23. package/lib/inputs/select/input-select.interface.d.ts +14 -0
  24. package/lib/inputs/text/input-text.component.d.ts +13 -0
  25. package/lib/inputs/text/input-text.interface.d.ts +12 -0
  26. package/lib/inputs/textarea/input-textarea.component.d.ts +13 -0
  27. package/lib/inputs/textarea/input-textarea.interface.d.ts +15 -0
  28. package/lib/ngx-form.component.d.ts +57 -0
  29. package/lib/ngx-form.config.d.ts +10 -0
  30. package/lib/ngx-form.interface.d.ts +42 -0
  31. package/lib/pipes/index.d.ts +2 -0
  32. package/lib/pipes/input-error.pipe.d.ts +8 -0
  33. package/lib/pipes/multi-line.pipe.d.ts +12 -0
  34. package/lib/validators/index.d.ts +1 -0
  35. package/lib/validators/length.validator.d.ts +2 -0
  36. package/package.json +45 -0
  37. package/public-api.d.ts +3 -0
@@ -0,0 +1,13 @@
1
+ import { FormControl } from '@angular/forms';
2
+ import { IInputConfig } from '../input.interface';
3
+ import { IInputTextarea } from './input-textarea.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class InputTextareaComponent {
6
+ readonly formControl: FormControl;
7
+ readonly input: IInputTextarea;
8
+ readonly config: IInputConfig;
9
+ focused: boolean;
10
+ constructor(formControl: FormControl, input: IInputTextarea, config: IInputConfig);
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<InputTextareaComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputTextareaComponent, "ng-component", never, {}, {}, never, never, true, never>;
13
+ }
@@ -0,0 +1,15 @@
1
+ import { ValidatorFn, FormControl } from '@angular/forms';
2
+ import { InputMethods, IInput } from '../input.interface';
3
+ export interface IInputTextarea extends IInput {
4
+ readonly type: 'TEXTAREA';
5
+ readonly title: string;
6
+ readonly height?: number;
7
+ readonly autoHeight?: boolean;
8
+ readonly maxHeight?: number;
9
+ readonly maxLength?: number;
10
+ readonly counter?: boolean;
11
+ }
12
+ export declare class InputTextareaMethods extends InputMethods<IInputTextarea, string | null> {
13
+ control(input: IInputTextarea, validators: ValidatorFn[]): FormControl<string | null>;
14
+ value(value: any, input: IInputTextarea): string | null;
15
+ }
@@ -0,0 +1,57 @@
1
+ import { AfterViewInit, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
+ import { FormGroup, NgForm } from '@angular/forms';
3
+ import { Router } from '@angular/router';
4
+ import { IInputConfig } from './inputs';
5
+ import { INgxFormConfig } from './ngx-form.config';
6
+ import { INgxForm, INgxFormInit, INgxFormValues, NgxFormInputs } from './ngx-form.interface';
7
+ import * as i0 from "@angular/core";
8
+ interface IRow {
9
+ header: string;
10
+ inputs: NgxFormInputs[];
11
+ flex: number[];
12
+ }
13
+ interface IColumn {
14
+ header: string;
15
+ rows: IRow[];
16
+ }
17
+ interface ISection {
18
+ header: string;
19
+ columns: IColumn[];
20
+ flex: number[];
21
+ }
22
+ export declare class NgxFormComponent implements OnInit, OnChanges, AfterViewInit {
23
+ private readonly router;
24
+ private readonly config?;
25
+ ngForm?: NgForm;
26
+ onResize: (event: any) => void;
27
+ ngxForm: INgxForm;
28
+ onInit: EventEmitter<INgxFormInit>;
29
+ onSubmit: EventEmitter<INgxFormValues>;
30
+ onChange: EventEmitter<INgxFormValues>;
31
+ protected formGroup: FormGroup;
32
+ protected sections: ISection[];
33
+ protected hiddenInputs: string[];
34
+ protected lastValues: INgxFormValues;
35
+ protected lastSubmit?: Date;
36
+ protected isMobile: boolean;
37
+ protected headerClass: string;
38
+ protected inputConfig: IInputConfig;
39
+ constructor(router: Router, config?: Partial<INgxFormConfig> | undefined);
40
+ ngOnInit(): void;
41
+ ngOnChanges(changes: SimpleChanges): void;
42
+ ngAfterViewInit(): void;
43
+ getInputs(): NgxFormInputs[];
44
+ getValues(): INgxFormValues;
45
+ setInput(input: NgxFormInputs): void;
46
+ checkInputs(): void;
47
+ checkSubmit(): void;
48
+ setSize(): void;
49
+ showSection(section: ISection): boolean;
50
+ showColumn(column: IColumn): boolean;
51
+ showRow(row: IRow): boolean;
52
+ showInput(input: NgxFormInputs): boolean;
53
+ onClick(action: string[] | (() => void)): void;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxFormComponent, [null, { optional: true; }]>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxFormComponent, "ngx-form", never, { "ngxForm": { "alias": "ngxForm"; "required": true; }; }, { "onInit": "onInit"; "onSubmit": "onSubmit"; "onChange": "onChange"; }, never, never, true, never>;
56
+ }
57
+ export {};
@@ -0,0 +1,10 @@
1
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
+ export interface INgxFormConfig {
3
+ readonly mobileWidth: number;
4
+ readonly submitTimeout: number;
5
+ readonly headerClass: string;
6
+ readonly enClass: string;
7
+ readonly descriptionClass: string;
8
+ }
9
+ export declare const NGX_FORM_CONFIG: InjectionToken<Partial<INgxFormConfig>>;
10
+ export declare const provideNgxFormConfig: (config: Partial<INgxFormConfig>) => EnvironmentProviders;
@@ -0,0 +1,42 @@
1
+ import { FormGroup, NgForm } from '@angular/forms';
2
+ import { MatFormFieldAppearance } from '@angular/material/form-field';
3
+ import { IInputEmail, IInputMobile, IInputName, IInputPassword, IInputSelect, IInputText, IInputTextarea } from './inputs';
4
+ export type NgxFormInputs = IInputEmail | IInputMobile | IInputName | IInputPassword | IInputSelect | IInputText | IInputTextarea;
5
+ type Inputs = NgxFormInputs | {
6
+ readonly header: string;
7
+ readonly input: NgxFormInputs;
8
+ } | {
9
+ readonly header?: string;
10
+ readonly inputs: NgxFormInputs[];
11
+ readonly flex?: number[];
12
+ };
13
+ interface INgxFormColumn {
14
+ readonly header?: string;
15
+ readonly rows: Inputs[];
16
+ }
17
+ export interface INgxForm {
18
+ readonly submit: string;
19
+ readonly inputs: (Inputs | {
20
+ readonly header?: string;
21
+ readonly columns: INgxFormColumn[];
22
+ readonly flex?: number[];
23
+ })[];
24
+ readonly buttons?: INgxFormButton[];
25
+ readonly mobileView?: boolean;
26
+ readonly appearance?: MatFormFieldAppearance;
27
+ updateValues?: (values: INgxFormValues) => {
28
+ [key: string]: any;
29
+ };
30
+ }
31
+ export interface INgxFormInit {
32
+ readonly formGroup?: FormGroup;
33
+ readonly ngForm?: NgForm;
34
+ }
35
+ export interface INgxFormButton {
36
+ readonly title: string;
37
+ readonly action: string[] | (() => void);
38
+ }
39
+ export interface INgxFormValues {
40
+ [key: string]: any;
41
+ }
42
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './input-error.pipe';
2
+ export * from './multi-line.pipe';
@@ -0,0 +1,8 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import { ValidationErrors } from '@angular/forms';
3
+ import * as i0 from "@angular/core";
4
+ export declare class InputErrorPipe implements PipeTransform {
5
+ transform(errors: ValidationErrors | null | undefined, type: string): string;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<InputErrorPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<InputErrorPipe, "InputErrorPipe", true>;
8
+ }
@@ -0,0 +1,12 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+ import * as i0 from "@angular/core";
4
+ export declare class MultiLinePipe implements PipeTransform {
5
+ private readonly sanitizer;
6
+ constructor(sanitizer: DomSanitizer);
7
+ transform(value: string, config?: {
8
+ html?: boolean;
9
+ }): string | SafeHtml;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<MultiLinePipe, never>;
11
+ static ɵpipe: i0.ɵɵPipeDeclaration<MultiLinePipe, "MultiLinePipe", true>;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './length.validator';
@@ -0,0 +1,2 @@
1
+ import { ValidatorFn } from '@angular/forms';
2
+ export declare const LengthValidator: (length: number) => ValidatorFn;
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@webilix/ngx-form-m3",
3
+ "version": "0.0.1",
4
+ "author": "Ali Amirnezhad",
5
+ "description": "Persian form library for Angular and Material 3",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/webilix/ngx-form-m3.git"
9
+ },
10
+ "keywords": [
11
+ "angular",
12
+ "form",
13
+ "persian",
14
+ "farsi",
15
+ "material 3"
16
+ ],
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/webilix/ngx-form-m3/issues"
20
+ },
21
+ "homepage": "https://github.com/webilix/ngx-form-m3#readme",
22
+ "peerDependencies": {
23
+ "@angular/common": ">=19.0.0",
24
+ "@angular/core": ">=19.0.0",
25
+ "@angular/forms": ">=19.0.0",
26
+ "@angular/material": ">=19.0.1",
27
+ "@webilix/helper-library": ">=6.0.2",
28
+ "ngx-mask": ">=19.0.1"
29
+ },
30
+ "dependencies": {
31
+ "tslib": "^2.3.0"
32
+ },
33
+ "sideEffects": false,
34
+ "module": "fesm2022/webilix-ngx-form-m3.mjs",
35
+ "typings": "index.d.ts",
36
+ "exports": {
37
+ "./package.json": {
38
+ "default": "./package.json"
39
+ },
40
+ ".": {
41
+ "types": "./index.d.ts",
42
+ "default": "./fesm2022/webilix-ngx-form-m3.mjs"
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/ngx-form.component';
2
+ export * from './lib/ngx-form.config';
3
+ export * from './lib/ngx-form.interface';