@sumaris-net/ngx-components 18.2.28 → 18.2.30

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "18.2.28",
4
+ "version": "18.2.30",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -23,7 +23,6 @@ export { MatDateShort } from './src/app/shared/material/datetime/material.datesh
23
23
  export { MatDateTime } from './src/app/shared/material/datetime/material.datetime';
24
24
  export { MatDate } from './src/app/shared/material/datetime/material.date';
25
25
  export { MatLatLongField } from './src/app/shared/material/latlong/material.latlong';
26
- export { MatLatLongField2 } from './src/app/shared/material/latlong/material.latlong2';
27
26
  export * from './src/app/shared/material/latlong/material.latlong.module';
28
27
  export * from './src/app/shared/material/duration/duration.module';
29
28
  export { MatDuration } from './src/app/shared/material/duration/material.duration';
@@ -1,73 +1,147 @@
1
1
  import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
- import { ControlValueAccessor, FormGroupDirective, UntypedFormBuilder, UntypedFormControl } from '@angular/forms';
3
- import { LatLongFormatOptions, LatLongPattern, LatLongType } from './latlong.utils';
4
- import { MatFormFieldAppearance, MatFormFieldDefaultOptions, SubscriptSizing } from '@angular/material/form-field';
2
+ import { ControlValueAccessor, FormControl, FormGroupDirective, UntypedFormControl } from '@angular/forms';
3
+ import { MatFormField, MatFormFieldAppearance, MatFormFieldDefaultOptions, SubscriptSizing } from '@angular/material/form-field';
5
4
  import { AppFloatLabelType } from '../../form/field.model';
6
- import { TranslateService } from '@ngx-translate/core';
5
+ import { LatLongPattern, LatLongType } from './latlong.utils';
6
+ import { MatSelect } from '@angular/material/select';
7
+ import { MaskitoOptions } from '@maskito/core';
7
8
  import * as i0 from "@angular/core";
9
+ declare type LatLongSign = 1 | -1;
10
+ interface ILatLongData {
11
+ degrees: number;
12
+ minutes: number;
13
+ seconds: number;
14
+ sign: LatLongSign;
15
+ }
8
16
  export declare class MatLatLongField implements OnInit, OnDestroy, ControlValueAccessor {
9
- private formBuilder;
10
17
  private cd;
11
- private translate;
12
18
  private formGroupDir;
13
19
  private _onChangeCallback;
14
20
  private _onTouchedCallback;
15
21
  private _subscription;
16
- private _formatOptions;
17
22
  private _disabling;
18
23
  private _writing;
19
24
  private _appearance;
20
25
  private _subscriptSizing;
26
+ private _readonly;
27
+ private _tabindex;
21
28
  private readonly _defaultAppearance;
22
29
  private readonly _defaultSubscriptSizing;
23
- protected _readonly: boolean;
24
- protected textFormControl: UntypedFormControl;
25
- protected signFormControl: UntypedFormControl;
26
- protected mask: (string | RegExp)[];
27
- protected inputPlaceHolderI18nKey: string;
30
+ protected _focused: boolean;
31
+ protected _touched: boolean;
32
+ protected degreesControl: FormControl<string>;
33
+ protected minutesControl: FormControl<string>;
34
+ protected secondsControl: FormControl<string>;
35
+ protected signControl: FormControl<LatLongSign>;
36
+ protected showMinutes: boolean;
37
+ protected showSeconds: boolean;
28
38
  protected showSignControl: boolean;
29
- protected maskitoPlaceholder: string;
30
- protected hasFocus: boolean;
31
- get disabled(): any;
39
+ protected degreesPlaceholder: string;
40
+ protected minutesPlaceholder: string;
41
+ protected secondsPlaceholder: string;
42
+ protected degreesMask: MaskitoOptions;
43
+ protected minutesMask: MaskitoOptions;
44
+ protected secondsMask: MaskitoOptions;
45
+ protected patternMaxDecimals: number;
46
+ protected i18nErrorKeys: {
47
+ required: string;
48
+ min: string;
49
+ max: string;
50
+ minlength: string;
51
+ maxlength: string;
52
+ pubkey: string;
53
+ validDate: string;
54
+ dateIsAfter: string;
55
+ dateIsBefore: string;
56
+ dateRange: string;
57
+ dateMinDuration: string;
58
+ dateMaxDuration: string;
59
+ maxDecimals: string;
60
+ decimal: string;
61
+ integer: string;
62
+ precision: string;
63
+ email: string;
64
+ latitude: string;
65
+ longitude: string;
66
+ pattern: string;
67
+ unique: string;
68
+ entity: string;
69
+ invalid: string;
70
+ inconsistent: string;
71
+ equals: string;
72
+ };
32
73
  formControl: UntypedFormControl;
33
74
  formControlName: string;
34
75
  type: LatLongType;
35
76
  pattern: LatLongPattern;
77
+ maxDecimals: number;
36
78
  required: boolean;
37
79
  floatLabel: AppFloatLabelType;
38
80
  placeholder: string;
39
- tabindex: number;
40
81
  defaultSign: '-' | '+';
41
- maxDecimals: number;
42
- placeholderChar: string;
43
82
  autofocus: boolean;
44
83
  mobile: boolean;
84
+ degreesSymbolUnit: string;
85
+ minutesSymbolUnit: string;
86
+ secondsSymbolUnit: string;
87
+ clearable: boolean;
88
+ classList: string;
89
+ set tabindex(value: number);
90
+ get tabindex(): number;
45
91
  set appearance(value: MatFormFieldAppearance);
46
92
  get appearance(): MatFormFieldAppearance;
47
93
  set readonly(value: boolean);
48
94
  get readonly(): boolean;
49
95
  set subscriptSizing(value: SubscriptSizing);
50
96
  get subscriptSizing(): SubscriptSizing;
51
- onBlur: EventEmitter<FocusEvent>;
52
- onFocus: EventEmitter<FocusEvent>;
53
- inputElement: ElementRef;
54
- constructor(formBuilder: UntypedFormBuilder, cd: ChangeDetectorRef, translate: TranslateService, formGroupDir: FormGroupDirective, defaultOptions?: MatFormFieldDefaultOptions);
97
+ get showFields(): boolean;
98
+ get disabled(): any;
99
+ keyupEnter: EventEmitter<any>;
100
+ blurred: EventEmitter<FocusEvent>;
101
+ focused: EventEmitter<FocusEvent>;
102
+ formField: MatFormField;
103
+ fakeInput: ElementRef;
104
+ inputDegrees: ElementRef;
105
+ inputMinutes: ElementRef;
106
+ inputSeconds: ElementRef;
107
+ inputSign: ElementRef;
108
+ inputSignSelect: MatSelect;
109
+ constructor(cd: ChangeDetectorRef, formGroupDir: FormGroupDirective, defaultOptions?: MatFormFieldDefaultOptions);
55
110
  ngOnInit(): void;
56
111
  ngOnDestroy(): void;
57
- writeValue(obj: any): void;
58
112
  registerOnChange(fn: any): void;
59
113
  registerOnTouched(fn: any): void;
114
+ writeValue(value: number | string): void;
60
115
  setDisabledState(isDisabled: boolean): void;
61
- _onFocus(event: FocusEvent): boolean;
62
- _onBlur(event: FocusEvent): void;
63
- protected _format(value: number, opts?: Partial<LatLongFormatOptions>): string;
64
- protected _checkIfTouched(): void;
116
+ clearValue(event?: Event): void;
117
+ protected get internalElements(): HTMLElement[];
118
+ protected onFocusFakeInput(event: FocusEvent): void;
119
+ protected onBlurFakeInput(event: FocusEvent): void;
120
+ protected _onFocusInput(event: FocusEvent): void;
121
+ protected _onBlurInput(event: FocusEvent): void;
122
+ protected _onClickInput(event: UIEvent): void;
123
+ protected focus(target?: any): boolean;
124
+ protected format(rawValue: number): string;
125
+ protected computeDecimalPart(value: number, nbOfDecimals: number): number;
126
+ protected computeLatLongFormGroupValue(rawValue: number | string): ILatLongData;
127
+ protected markAsTouched(): void;
128
+ private patchValue;
65
129
  private onFormChange;
66
130
  private emitChange;
67
- private updateTranslations;
68
- private parseValue;
131
+ private _checkIfTouched;
69
132
  private markForCheck;
70
- static ɵfac: i0.ɵɵFactoryDeclaration<MatLatLongField, [null, null, null, { optional: true; }, null]>;
71
- static ɵcmp: i0.ɵɵComponentDeclaration<MatLatLongField, "mat-latlong-field-old", never, { "formControl": { "alias": "formControl"; "required": false; }; "formControlName": { "alias": "formControlName"; "required": false; }; "type": { "alias": "type"; "required": false; }; "pattern": { "alias": "latLongPattern"; "required": false; }; "required": { "alias": "required"; "required": false; }; "floatLabel": { "alias": "floatLabel"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "defaultSign": { "alias": "defaultSign"; "required": false; }; "maxDecimals": { "alias": "maxDecimals"; "required": false; }; "placeholderChar": { "alias": "placeholderChar"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "mobile": { "alias": "mobile"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; }; }, { "onBlur": "onBlur"; "onFocus": "onFocus"; }, never, ["[matPrefix]", "[matSuffix]", "mat-error,[matError]", "mat-hint:not([align='end']),[matHint]", "mat-hint[align='end']"], false, never>;
133
+ /**
134
+ * Show/Hide the fake input
135
+ */
136
+ private updateFakeInput;
137
+ /**
138
+ * This is a special case, because, this component has a temporary component displayed before the first focus event
139
+ */
140
+ private updateTabIndex;
141
+ static ɵfac: i0.ɵɵFactoryDeclaration<MatLatLongField, [null, { optional: true; }, null]>;
142
+ static ɵcmp: i0.ɵɵComponentDeclaration<MatLatLongField, "mat-latlong-field", never, { "formControl": { "alias": "formControl"; "required": false; }; "formControlName": { "alias": "formControlName"; "required": false; }; "type": { "alias": "type"; "required": false; }; "pattern": { "alias": "latLongPattern"; "required": false; }; "maxDecimals": { "alias": "maxDecimals"; "required": false; }; "required": { "alias": "required"; "required": false; }; "floatLabel": { "alias": "floatLabel"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "defaultSign": { "alias": "defaultSign"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "mobile": { "alias": "mobile"; "required": false; }; "degreesSymbolUnit": { "alias": "degreesSymbolUnit"; "required": false; }; "minutesSymbolUnit": { "alias": "minutesSymbolUnit"; "required": false; }; "secondsSymbolUnit": { "alias": "secondsSymbolUnit"; "required": false; }; "clearable": { "alias": "clearable"; "required": false; }; "classList": { "alias": "class"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; }; }, { "keyupEnter": "keyup.enter"; "blurred": "blur"; "focused": "focus"; }, never, ["[matPrefix]", "[matSuffix]", "mat-error,[matError]", "mat-hint:not([align='end']),[matHint]", "mat-hint[align='end']"], false, never>;
72
143
  static ngAcceptInputType_mobile: unknown;
144
+ static ngAcceptInputType_clearable: unknown;
145
+ static ngAcceptInputType_tabindex: unknown;
73
146
  }
147
+ export {};
@@ -1,21 +1,20 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./material.latlong";
3
- import * as i2 from "./material.latlong2";
4
- import * as i3 from "@angular/common";
5
- import * as i4 from "@ionic/angular";
6
- import * as i5 from "@angular/forms";
7
- import * as i6 from "../../directives/directives.module";
8
- import * as i7 from "../../pipes/pipes.module";
9
- import * as i8 from "@angular/material/core";
10
- import * as i9 from "@angular/material/form-field";
11
- import * as i10 from "@angular/material/input";
12
- import * as i11 from "@angular/material/button";
13
- import * as i12 from "@maskito/angular";
14
- import * as i13 from "@angular/material/icon";
15
- import * as i14 from "@angular/material/select";
16
- import * as i15 from "@ngx-translate/core";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@ionic/angular";
5
+ import * as i4 from "@angular/forms";
6
+ import * as i5 from "../../directives/directives.module";
7
+ import * as i6 from "../../pipes/pipes.module";
8
+ import * as i7 from "@angular/material/core";
9
+ import * as i8 from "@angular/material/form-field";
10
+ import * as i9 from "@angular/material/input";
11
+ import * as i10 from "@angular/material/button";
12
+ import * as i11 from "@maskito/angular";
13
+ import * as i12 from "@angular/material/icon";
14
+ import * as i13 from "@angular/material/select";
15
+ import * as i14 from "@ngx-translate/core";
17
16
  export declare class SharedMatLatLongModule {
18
17
  static ɵfac: i0.ɵɵFactoryDeclaration<SharedMatLatLongModule, never>;
19
- static ɵmod: i0.ɵɵNgModuleDeclaration<SharedMatLatLongModule, [typeof i1.MatLatLongField, typeof i2.MatLatLongField2], [typeof i3.CommonModule, typeof i4.IonicModule, typeof i5.ReactiveFormsModule, typeof i6.SharedDirectivesModule, typeof i7.SharedPipesModule, typeof i8.MatCommonModule, typeof i9.MatFormFieldModule, typeof i10.MatInputModule, typeof i11.MatButtonModule, typeof i12.MaskitoDirective, typeof i13.MatIconModule, typeof i14.MatSelectModule, typeof i15.TranslateModule], [typeof i1.MatLatLongField, typeof i2.MatLatLongField2]>;
18
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SharedMatLatLongModule, [typeof i1.MatLatLongField], [typeof i2.CommonModule, typeof i3.IonicModule, typeof i4.ReactiveFormsModule, typeof i5.SharedDirectivesModule, typeof i6.SharedPipesModule, typeof i7.MatCommonModule, typeof i8.MatFormFieldModule, typeof i9.MatInputModule, typeof i10.MatButtonModule, typeof i11.MaskitoDirective, typeof i12.MatIconModule, typeof i13.MatSelectModule, typeof i14.TranslateModule], [typeof i1.MatLatLongField]>;
20
19
  static ɵinj: i0.ɵɵInjectorDeclaration<SharedMatLatLongModule>;
21
20
  }
@@ -62,7 +62,9 @@ export declare class SharedFormGroupValidators {
62
62
  fieldOnly?: boolean;
63
63
  skipIfNoTime?: boolean;
64
64
  } | string): ValidatorFn;
65
- static dateMaxDuration(startDateField: string, endDateField: string, maxDuration: number, durationUnit?: moment.unitOfTime.Diff): ValidatorFn;
65
+ static dateMaxDuration(startDateField: string, endDateField: string, maxDuration: number, durationUnit?: moment.unitOfTime.Diff, opts?: {
66
+ skipIfNoTime?: boolean;
67
+ }): ValidatorFn;
66
68
  static dateMinDuration(startDateField: string, endDateField: string, minDuration: number, durationUnit?: moment.unitOfTime.Diff): ValidatorFn;
67
69
  static requiredIf(fieldName: string, anotherFieldToCheck: string | AbstractControl, opts?: {
68
70
  fieldOnly?: boolean;
@@ -2,7 +2,7 @@
2
2
  "name": "ngx-sumaris-components",
3
3
  "short_name": "ngx-sumaris-components",
4
4
  "manifest_version": 1,
5
- "version": "18.2.28",
5
+ "version": "18.2.30",
6
6
  "default_locale": "fr",
7
7
  "description": "Angular components for building beautiful and responsive Apps",
8
8
  "icons": [{
@@ -196,13 +196,13 @@ mat-icon[slot] {
196
196
  }
197
197
 
198
198
  // Latitude/Longitude component
199
- .mat-latlong-form-field {
199
+ .mat-latlong-field {
200
200
 
201
201
  .mat-mdc-form-field-infix {
202
202
  display: inline-flex;
203
203
 
204
204
  .mat-mdc-select.sign {
205
- max-width: 2em;
205
+ max-width: 1.7em;
206
206
 
207
207
  .mat-mdc-select-trigger {
208
208
  align-items: baseline;
@@ -430,6 +430,7 @@
430
430
 
431
431
  // Specific behavior for select
432
432
  &.mat-mdc-form-field-type-mat-select {
433
+ --mat-select-arrow-transform: translateY(0px);
433
434
  .mdc-text-field {
434
435
  padding-right: 8px;
435
436
  }
@@ -476,13 +477,11 @@
476
477
  }
477
478
 
478
479
  mat-latlong-field {
480
+ --mat-select-arrow-transform: translateY(-3px);
479
481
  height: calc(var(--mat-row-height) - 2px);
480
- ion-col.text {
481
- min-width: unset !important; // make sure column is resizable
482
- }
483
- ion-col.sign {
484
- --min-width: 35px !important;
485
- --max-width: 45px !important;
482
+
483
+ .mat-mdc-form-field-infix {
484
+ height: calc(var(--mat-row-height) - 14px) !important;
486
485
  }
487
486
  }
488
487