myrta-ui 1.1.20 → 1.1.22

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 (44) hide show
  1. package/esm2020/lib/components/form/formula-editor/enums/error-messages.enum.mjs +16 -0
  2. package/esm2020/lib/components/form/formula-editor/formula-editor.component.mjs +301 -0
  3. package/esm2020/lib/components/form/formula-editor/formula-editor.module.mjs +50 -0
  4. package/esm2020/lib/components/form/formula-editor/helpers/check-errors.helper.mjs +73 -0
  5. package/esm2020/lib/components/form/formula-editor/helpers/create-tags.helper.mjs +17 -0
  6. package/esm2020/lib/components/form/formula-editor/models/check-error-result.model.mjs +2 -0
  7. package/esm2020/lib/components/form/formula-editor/models/formula-editor.model.mjs +2 -0
  8. package/esm2020/lib/components/form/formula-editor/models/index.mjs +4 -0
  9. package/esm2020/lib/components/form/formula-editor/models/white-list-item.model.mjs +2 -0
  10. package/esm2020/lib/helpers/is-number.helper.mjs +7 -0
  11. package/esm2020/lib/services/mrx-form-validator/mrx-form-validator.mjs +7 -2
  12. package/esm2020/lib/services/mrx-form-validator/validations/callback.validation.mjs +2 -2
  13. package/esm2020/lib/services/mrx-form-validator/validations/email.validation.mjs +2 -2
  14. package/esm2020/lib/services/mrx-form-validator/validations/max-length.validation.mjs +2 -2
  15. package/esm2020/lib/services/mrx-form-validator/validations/max-value.validation.mjs +2 -2
  16. package/esm2020/lib/services/mrx-form-validator/validations/min-length.validation.mjs +2 -2
  17. package/esm2020/lib/services/mrx-form-validator/validations/min-value.validation.mjs +2 -2
  18. package/esm2020/lib/services/mrx-form-validator/validations/pattern.validation.mjs +2 -2
  19. package/esm2020/lib/services/mrx-form-validator/validations/required.validation.mjs +2 -2
  20. package/esm2020/public-api.mjs +4 -1
  21. package/fesm2015/myrta-ui.mjs +464 -17
  22. package/fesm2015/myrta-ui.mjs.map +1 -1
  23. package/fesm2020/myrta-ui.mjs +462 -17
  24. package/fesm2020/myrta-ui.mjs.map +1 -1
  25. package/lib/components/form/formula-editor/enums/error-messages.enum.d.ts +8 -0
  26. package/lib/components/form/formula-editor/formula-editor.component.d.ts +67 -0
  27. package/lib/components/form/formula-editor/formula-editor.module.d.ts +14 -0
  28. package/lib/components/form/formula-editor/helpers/check-errors.helper.d.ts +6 -0
  29. package/lib/components/form/formula-editor/helpers/create-tags.helper.d.ts +5 -0
  30. package/lib/components/form/formula-editor/models/check-error-result.model.d.ts +5 -0
  31. package/lib/components/form/formula-editor/models/formula-editor.model.d.ts +5 -0
  32. package/lib/components/form/formula-editor/models/index.d.ts +3 -0
  33. package/lib/components/form/formula-editor/models/white-list-item.model.d.ts +4 -0
  34. package/lib/helpers/is-number.helper.d.ts +1 -0
  35. package/lib/services/mrx-form-validator/validations/callback.validation.d.ts +1 -1
  36. package/lib/services/mrx-form-validator/validations/email.validation.d.ts +1 -1
  37. package/lib/services/mrx-form-validator/validations/max-length.validation.d.ts +1 -1
  38. package/lib/services/mrx-form-validator/validations/max-value.validation.d.ts +1 -1
  39. package/lib/services/mrx-form-validator/validations/min-length.validation.d.ts +1 -1
  40. package/lib/services/mrx-form-validator/validations/min-value.validation.d.ts +1 -1
  41. package/lib/services/mrx-form-validator/validations/pattern.validation.d.ts +1 -1
  42. package/lib/services/mrx-form-validator/validations/required.validation.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/public-api.d.ts +3 -0
@@ -0,0 +1,8 @@
1
+ export declare enum ErrorTypeEnum {
2
+ Default = "default",
3
+ Interpretation = "interpretation",
4
+ Sequence = "sequence",
5
+ Divider = "divider",
6
+ Bracket = "bracket"
7
+ }
8
+ export declare const ErrorMessagesEnum: Record<ErrorTypeEnum, string>;
@@ -0,0 +1,67 @@
1
+ import { ChangeDetectorRef, ElementRef, EventEmitter } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import { Field } from '../../../services';
4
+ import { WhiteListItemModel } from './models/white-list-item.model';
5
+ import { CheckErrorResultModel } from './models/check-error-result.model';
6
+ import { FormulaEditorValueTypes, FormulaEditorValueWithId } from './models';
7
+ import * as i0 from "@angular/core";
8
+ export declare class FormulaEditorComponent implements ControlValueAccessor {
9
+ private document;
10
+ private _detector;
11
+ private eRef;
12
+ private _range;
13
+ private _selection;
14
+ private _cursorPosition;
15
+ private searchText;
16
+ private operatorList;
17
+ private bracketList;
18
+ value: string;
19
+ visibleValue: string;
20
+ isFocused: boolean;
21
+ errorModel: CheckErrorResultModel;
22
+ uuid: string;
23
+ fields: Field[];
24
+ whiteList: WhiteListItemModel[];
25
+ disabled: boolean;
26
+ readonly: boolean;
27
+ placeholder: string;
28
+ customClasses: string;
29
+ invalid: boolean;
30
+ invalidMessage: string | string[];
31
+ checkInvalid: true | false | null;
32
+ inputElement: ElementRef<HTMLInputElement>;
33
+ changed: EventEmitter<FormulaEditorValueTypes>;
34
+ blurred: EventEmitter<FormulaEditorValueWithId>;
35
+ modelChange: EventEmitter<FormulaEditorValueWithId>;
36
+ constructor(document: Document, _detector: ChangeDetectorRef, eRef: ElementRef);
37
+ get getErrorMessage(): string | string[];
38
+ get filteredList(): WhiteListItemModel[];
39
+ get getInvalid(): boolean;
40
+ get readonlyClass(): string;
41
+ get checkValidClasses(): string;
42
+ get getClasses(): string;
43
+ private get _inputValue();
44
+ writeValue(outsideValue: FormulaEditorValueTypes): void;
45
+ onInput(event: Event): void;
46
+ onBlur(event: Event): void;
47
+ onFocus(event: Event): void;
48
+ insertTag(whiteListItem: WhiteListItemModel): void;
49
+ updateVisibleValue(insideValue: string): void;
50
+ updateValue(insideValue: string): void;
51
+ private _modifiedValue;
52
+ private _transformValue;
53
+ private _checkErrors;
54
+ private _toggleError;
55
+ private _disableError;
56
+ private _insertPositionText;
57
+ private _storeCursorPosition;
58
+ private _restoreCursorPosition;
59
+ private _placeCaretAtEnd;
60
+ clickOut(event: Event): void;
61
+ registerOnChange(fn: any): void;
62
+ registerOnTouched(fn: () => {}): void;
63
+ private onChange;
64
+ private onTouched;
65
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormulaEditorComponent, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormulaEditorComponent, "mrx-formula-editor", never, { "fields": "fields"; "whiteList": "whiteList"; "disabled": "disabled"; "readonly": "readonly"; "placeholder": "placeholder"; "customClasses": "customClasses"; "invalid": "invalid"; "invalidMessage": "invalidMessage"; "checkInvalid": "checkInvalid"; }, { "changed": "changed"; "blurred": "blurred"; "modelChange": "modelChange"; }, never, never>;
67
+ }
@@ -0,0 +1,14 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./formula-editor.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "../../chars-left/chars-left.module";
5
+ import * as i4 from "../../error-message/error-message.module";
6
+ import * as i5 from "@angular/forms";
7
+ import * as i6 from "ngx-mask";
8
+ import * as i7 from "../../save-state/save-state.module";
9
+ import * as i8 from "../../../pipes/safe/safe.module";
10
+ export declare class FormulaEditorModule {
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormulaEditorModule, never>;
12
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormulaEditorModule, [typeof i1.FormulaEditorComponent], [typeof i2.CommonModule, typeof i3.CharsLeftModule, typeof i4.ErrorMessageModule, typeof i5.FormsModule, typeof i6.NgxMaskModule, typeof i7.SaveStateModule, typeof i8.SafeModule], [typeof i1.FormulaEditorComponent]>;
13
+ static ɵinj: i0.ɵɵInjectorDeclaration<FormulaEditorModule>;
14
+ }
@@ -0,0 +1,6 @@
1
+ import { CheckErrorResultModel } from '../models/check-error-result.model';
2
+ import { WhiteListItemModel } from '../models/white-list-item.model';
3
+ export declare const checkInterpretationErrors: (error: boolean) => CheckErrorResultModel;
4
+ export declare const checkBracketErrors: (array: string[]) => CheckErrorResultModel;
5
+ export declare const checkSequenceErrors: (array: string[], operatorList: string[], bracketList: string[]) => CheckErrorResultModel;
6
+ export declare const checkDividerErrors: (array: string[], list: WhiteListItemModel[]) => CheckErrorResultModel;
@@ -0,0 +1,5 @@
1
+ export declare const createTag: (content: string) => string;
2
+ export declare const createOperator: (content: string) => string;
3
+ export declare const createNumber: (content: string) => string;
4
+ export declare const createBracket: (content: string) => string;
5
+ export declare const createTagOutside: (content: string) => string;
@@ -0,0 +1,5 @@
1
+ import { ErrorTypeEnum } from '../enums/error-messages.enum';
2
+ export interface CheckErrorResultModel {
3
+ isError: boolean;
4
+ errorType: ErrorTypeEnum;
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare type FormulaEditorValueTypes = string;
2
+ export interface FormulaEditorValueWithId {
3
+ value: FormulaEditorValueTypes;
4
+ id: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ export * from './formula-editor.model';
2
+ export * from './check-error-result.model';
3
+ export * from './white-list-item.model';
@@ -0,0 +1,4 @@
1
+ export interface WhiteListItemModel {
2
+ sysName: string;
3
+ label: string;
4
+ }
@@ -0,0 +1 @@
1
+ export declare const isAn: (value: any) => boolean;
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const callbackValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const emailValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const maxLengthValidation: (value: string | string[], validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const maxValueValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const minLengthValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const minValueValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { ValidationTypesEnum } from '../models/validations-types.model';
2
2
  import { IMessages, ValidationsType } from '../models/validations-options.model';
3
3
  export declare const patternValidation: (value: string, validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
@@ -2,5 +2,5 @@ import { IMessages, ValidationsType } from '../models/validations-options.model'
2
2
  import { ValidationTypesEnum } from '../models/validations-types.model';
3
3
  export declare const requiredValidation: (value: string | string[], validations: ValidationsType, key: ValidationTypesEnum, invalidMessages: IMessages) => {
4
4
  isValid: boolean;
5
- message: string;
5
+ message: string | null;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrta-ui",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.3.0",
6
6
  "@angular/core": "^13.3.0",
package/public-api.d.ts CHANGED
@@ -178,3 +178,6 @@ export * from './lib/components/form/input-tel/enums/input-phone.enum';
178
178
  export * from './lib/components/form/input-tel/data/all-countries';
179
179
  export * from './lib/components/form/input-tel/data/country-iso.enum';
180
180
  export * from './lib/components/form/input-tel/data/countries-rus-label.enum';
181
+ export * from './lib/components/form/formula-editor/formula-editor.module';
182
+ export * from './lib/components/form/formula-editor/formula-editor.component';
183
+ export * from './lib/components/form/formula-editor/models';