@sumaris-net/ngx-components 0.25.8 → 0.25.12

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 (30) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +210 -121
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/esm2015/public_api.js +3 -1
  6. package/esm2015/src/app/core/core.module.js +4 -1
  7. package/esm2015/src/app/core/form/form-error-translate.pipe.js +19 -0
  8. package/esm2015/src/app/core/form/form-error.adapter.js +64 -0
  9. package/esm2015/src/app/core/install/install-upgrade-card.component.js +58 -43
  10. package/esm2015/src/app/core/services/model/person.model.js +4 -3
  11. package/esm2015/src/app/core/table/table.class.js +13 -32
  12. package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +10 -3
  13. package/esm2015/src/app/shared/material/autocomplete/testing/autocomplete.test.js +2 -2
  14. package/esm2015/src/app/shared/material/datetime/material.datetime.js +12 -7
  15. package/esm2015/src/app/shared/material/datetime/testing/mat-date-time.test.js +5 -3
  16. package/esm2015/src/app/shared/material/latlong/material.latlong.js +12 -17
  17. package/esm2015/src/app/shared/material/latlong/testing/latlong.test.js +2 -2
  18. package/fesm2015/sumaris-net.ngx-components.js +179 -99
  19. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  20. package/package.json +1 -1
  21. package/public_api.d.ts +2 -0
  22. package/src/app/core/form/form-error-translate.pipe.d.ts +8 -0
  23. package/src/app/core/form/form-error.adapter.d.ts +28 -0
  24. package/src/app/core/install/install-upgrade-card.component.d.ts +5 -3
  25. package/src/app/core/table/table.class.d.ts +3 -0
  26. package/src/app/shared/material/datetime/material.datetime.d.ts +4 -3
  27. package/src/app/shared/material/latlong/material.latlong.d.ts +5 -6
  28. package/src/theme/_icons.scss +0 -2
  29. package/src/theme/_ionic.scss +7 -0
  30. package/sumaris-net.ngx-components.metadata.json +1 -1
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": "0.25.8",
4
+ "version": "0.25.12",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -105,6 +105,7 @@ export * from './src/app/core/services/pipes/account.pipes';
105
105
  export * from './src/app/core/services/pipes/department-to-string.pipe';
106
106
  export * from './src/app/core/services/pipes/person-to-string.pipe';
107
107
  export * from './src/app/core/services/pipes/usage-mode.pipes';
108
+ export * from './src/app/core/form/form-error-translate.pipe';
108
109
  export * from './src/app/vendor';
109
110
  export * from './src/app/core/services/platform.service';
110
111
  export * from './src/app/core/services/network.service';
@@ -127,6 +128,7 @@ export * from './src/app/core/form/form.class';
127
128
  export * from './src/app/core/form/form.utils';
128
129
  export * from './src/app/core/form/form-buttons-bar.component';
129
130
  export * from './src/app/core/form/list.form';
131
+ export * from './src/app/core/form/form-error.adapter';
130
132
  export * from './src/app/core/form/properties.form';
131
133
  export * from './src/app/core/table/table.class';
132
134
  export * from './src/app/core/table/table.utils';
@@ -0,0 +1,8 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { FormErrorAdapter, FormErrorAdapterOptions } from './form-error.adapter';
4
+ export declare class FormErrorTranslatePipe implements PipeTransform {
5
+ private adapter;
6
+ constructor(adapter: FormErrorAdapter);
7
+ transform(form: FormGroup, opts?: FormErrorAdapterOptions): string;
8
+ }
@@ -0,0 +1,28 @@
1
+ import { TranslateService } from '@ngx-translate/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ export declare class IFormI18nService {
4
+ /**
5
+ * From a fieldName complete name (e.g. 'startDate', 'taxonGroup', 'measurementValues.1'), should return an i18n key to be used translation
6
+ * @param fieldName the field name to convert
7
+ */
8
+ getI18nFieldName: (fieldName: any) => string;
9
+ /**
10
+ * From a error key (e.g. 'required'), should return an i18n key to be used translation
11
+ * @param errorKey the error key
12
+ * @param errorContent the error content
13
+ */
14
+ getI18nError?: (e: any, c: any) => string;
15
+ }
16
+ export interface FormErrorAdapterOptions {
17
+ i18nPrefix?: string;
18
+ i18nService?: IFormI18nService;
19
+ separator?: string;
20
+ recursive?: boolean;
21
+ }
22
+ export declare class FormErrorAdapter {
23
+ private translate;
24
+ constructor(translate: TranslateService);
25
+ formatError(form: FormGroup, opts?: FormErrorAdapterOptions): string;
26
+ protected getI18nKey(fieldName: string, opts?: FormErrorAdapterOptions): string;
27
+ protected getI18nError(errorKey: string, errorContent?: any, opts?: FormErrorAdapterOptions): string;
28
+ }
@@ -28,6 +28,7 @@ export declare class AppInstallUpgradeCard implements OnInit, OnDestroy {
28
28
  private _subscription;
29
29
  private _showUpdateOfflineFeature;
30
30
  loading: boolean;
31
+ canDownload: boolean;
31
32
  downloading: boolean;
32
33
  waitingNetwork: boolean;
33
34
  installLinks: InstallAppLink[];
@@ -42,7 +43,7 @@ export declare class AppInstallUpgradeCard implements OnInit, OnDestroy {
42
43
  get showUpdateOfflineFeature(): boolean;
43
44
  onUpdateOfflineModeClick: EventEmitter<UIEvent>;
44
45
  constructor(modalCtrl: ModalController, configService: ConfigService, toastController: ToastController, alertController: AlertController, translate: TranslateService, cd: ChangeDetectorRef, platform: PlatformService, network: NetworkService, environment: any);
45
- ngOnInit(): Promise<void>;
46
+ ngOnInit(): void;
46
47
  ngOnDestroy(): void;
47
48
  download(event: UIEvent, link: InstallAppLink): Promise<void>;
48
49
  tryOnline(): Promise<void>;
@@ -53,9 +54,10 @@ export declare class AppInstallUpgradeCard implements OnInit, OnDestroy {
53
54
  private getCompatibleUpgradeLinks;
54
55
  private getLinks;
55
56
  private getFilename;
56
- private markForCheck;
57
- private showToast;
57
+ private listenDownloadJobs;
58
58
  private listenDownloadJob;
59
59
  private showDownloadFailedToast;
60
60
  private showDownloadCompleteDialog;
61
+ private markForCheck;
62
+ private showToast;
61
63
  }
@@ -20,6 +20,7 @@ import { CompletableEvent } from '../../shared/events';
20
20
  import { ShowToastOptions } from '../../shared/toasts';
21
21
  import { CdkColumnDef } from '@angular/cdk/table';
22
22
  import { LoadResult } from '../../shared/services/entity-service.class';
23
+ import { FormErrorAdapter, IFormI18nService } from '../form/form-error.adapter';
23
24
  export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
24
25
  export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
25
26
  export declare const SETTINGS_FILTER = "filter";
@@ -64,10 +65,12 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
64
65
  protected alertCtrl: AlertController;
65
66
  protected toastController: ToastController;
66
67
  protected previouslyEditedRowId: number;
68
+ protected formErrorAdapter: FormErrorAdapter;
67
69
  excludesColumns: string[];
68
70
  displayedColumns: string[];
69
71
  totalRowCount: number | null;
70
72
  visibleRowCount: number;
73
+ i18nService: IFormI18nService;
71
74
  loadingSubject: BehaviorSubject<boolean>;
72
75
  savingSubject: BehaviorSubject<boolean>;
73
76
  dirtySubject: BehaviorSubject<boolean>;
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
1
+ import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { Platform } from '@ionic/angular';
3
3
  import { DateAdapter } from '@angular/material/core';
4
4
  import { FloatLabelType } from '@angular/material/form-field';
@@ -32,8 +32,8 @@ export declare class MatDateTime implements OnInit, OnDestroy, ControlValueAcces
32
32
  protected writing: boolean;
33
33
  protected disabling: boolean;
34
34
  protected _tabindex: number;
35
- protected _onDestroy: EventEmitter<any>;
36
35
  protected waitHideKeyboardDelay: number;
36
+ _readonly: boolean;
37
37
  dateFormControl: FormControl;
38
38
  timeFormControl: FormControl;
39
39
  displayPattern: string;
@@ -46,11 +46,12 @@ export declare class MatDateTime implements OnInit, OnDestroy, ControlValueAcces
46
46
  formControlName: string;
47
47
  placeholder: string;
48
48
  floatLabel: FloatLabelType;
49
- readonly: boolean;
50
49
  required: boolean;
51
50
  compact: boolean;
52
51
  placeholderChar: string;
53
52
  autofocus: boolean;
53
+ set readonly(value: boolean);
54
+ get readonly(): boolean;
54
55
  set tabindex(value: number);
55
56
  get tabindex(): number;
56
57
  get value(): any;
@@ -1,11 +1,11 @@
1
- import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
1
+ import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
2
  import { Platform } from '@ionic/angular';
3
3
  import { FloatLabelType } from '@angular/material/form-field';
4
4
  import { ControlValueAccessor, FormBuilder, FormControl, FormGroupDirective } from '@angular/forms';
5
5
  import { TranslateService } from '@ngx-translate/core';
6
6
  import { LatLongFormatFn, LatLongFormatOptions, LatLongPattern } from './latlong.utils';
7
7
  import { TextMaskConfig } from 'angular2-text-mask';
8
- export declare class MatLatLongField implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor {
8
+ export declare class MatLatLongField implements OnInit, OnDestroy, ControlValueAccessor {
9
9
  private platform;
10
10
  private translate;
11
11
  private formBuilder;
@@ -16,6 +16,7 @@ export declare class MatLatLongField implements OnInit, AfterViewInit, OnDestroy
16
16
  private _subscription;
17
17
  protected disabling: boolean;
18
18
  protected writing: boolean;
19
+ _readonly: boolean;
19
20
  formatFn: LatLongFormatFn;
20
21
  formatFnOptions: LatLongFormatOptions;
21
22
  textMaskConfig: TextMaskConfig;
@@ -36,17 +37,15 @@ export declare class MatLatLongField implements OnInit, AfterViewInit, OnDestroy
36
37
  maxDecimals: number;
37
38
  placeholderChar: string;
38
39
  floatLabel: FloatLabelType;
39
- readonly: boolean;
40
+ set readonly(value: boolean);
41
+ get readonly(): boolean;
40
42
  required: boolean;
41
43
  tabindex: number;
42
44
  onBlur: EventEmitter<FocusEvent>;
43
45
  onFocus: EventEmitter<FocusEvent>;
44
46
  inputElement: ElementRef;
45
- suffixDiv: ElementRef;
46
- suffixInjections: QueryList<ElementRef>;
47
47
  constructor(platform: Platform, translate: TranslateService, formBuilder: FormBuilder, cd: ChangeDetectorRef, formGroupDir: FormGroupDirective);
48
48
  ngOnInit(): void;
49
- ngAfterViewInit(): void;
50
49
  ngOnDestroy(): void;
51
50
  writeValue(obj: any): void;
52
51
  registerOnChange(fn: any): void;
@@ -21,6 +21,4 @@ mat-icon > span {
21
21
  margin-left: -6px;
22
22
  }
23
23
 
24
-
25
-
26
24
  @include set-color-each-ion-colors('mat-icon');
@@ -43,3 +43,10 @@ ion-icon[slot] {
43
43
  width: 24px;
44
44
  height: 24px;
45
45
  }
46
+
47
+ /* hide icon SVG title */
48
+ ion-icon {
49
+ .icon-inner, .ionicon, svg {
50
+ pointer-events: none !important;
51
+ }
52
+ }