@sumaris-net/ngx-components 1.6.2 → 1.6.6

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 (25) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +665 -294
  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/doc/changelog.md +13 -0
  6. package/esm2015/src/app/core/auth/modal/modal-auth.js +21 -9
  7. package/esm2015/src/app/shared/form/field.model.js +1 -1
  8. package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +143 -122
  9. package/esm2015/src/app/shared/material/autocomplete/testing/autocomplete.test.js +6 -6
  10. package/esm2015/src/app/shared/material/chips/material.chips.js +372 -94
  11. package/esm2015/src/app/shared/material/chips/testing/chips.test.js +54 -18
  12. package/esm2015/src/app/shared/material/swipe/material.swipe.js +5 -5
  13. package/esm2015/src/app/shared/material/swipe/testing/swipe.test.js +2 -2
  14. package/fesm2015/sumaris-net.ngx-components.js +616 -272
  15. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/app/core/auth/modal/modal-auth.d.ts +12 -5
  18. package/src/app/shared/form/field.model.d.ts +2 -1
  19. package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +39 -38
  20. package/src/app/shared/material/autocomplete/testing/autocomplete.test.d.ts +4 -5
  21. package/src/app/shared/material/chips/material.chips.d.ts +42 -13
  22. package/src/app/shared/material/chips/testing/chips.test.d.ts +1 -1
  23. package/src/app/shared/material/swipe/material.swipe.d.ts +2 -2
  24. package/src/theme/_ngx-components.scss +3 -1
  25. 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": "1.6.2",
4
+ "version": "1.6.6",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,14 +1,21 @@
1
- import { ChangeDetectorRef } from '@angular/core';
1
+ import { ChangeDetectorRef, OnInit } from '@angular/core';
2
2
  import { ModalController } from '@ionic/angular';
3
3
  import { AccountService } from '../../services/account.service';
4
- export declare class AuthModal {
4
+ export declare class AuthModal implements OnInit {
5
5
  private accountService;
6
6
  private viewCtrl;
7
- private changeDetectorRef;
8
- loading: boolean;
7
+ private cd;
8
+ get loading(): boolean;
9
9
  private form;
10
- constructor(accountService: AccountService, viewCtrl: ModalController, changeDetectorRef: ChangeDetectorRef);
10
+ constructor(accountService: AccountService, viewCtrl: ModalController, cd: ChangeDetectorRef);
11
+ ngOnInit(): void;
11
12
  cancel(): void;
12
13
  doSubmit(): Promise<any>;
13
14
  protected markForCheck(): void;
15
+ protected markAsLoading(opts?: {
16
+ emitEvent?: boolean;
17
+ }): void;
18
+ protected markAsLoaded(opts?: {
19
+ emitEvent?: boolean;
20
+ }): void;
14
21
  }
@@ -2,7 +2,8 @@ import { ObjectMap, Property } from '../types';
2
2
  import { InjectionToken } from '@angular/core';
3
3
  import { MatAutocompleteFieldAddOptions } from '../material/autocomplete/material.autocomplete';
4
4
  export declare type DisplayFn = (obj: any) => string;
5
- export declare type CompareWithFn = (o1: any, o2: any) => boolean;
5
+ export declare type EqualsFn = (o1: any, o2: any) => boolean;
6
+ export declare type CompareFn = (o1: any, o2: any) => number;
6
7
  export declare type FormFieldType = 'integer' | 'double' | 'boolean' | 'string' | 'enum' | 'color' | 'peer' | 'entity' | 'entities' | 'date' | 'dateTime';
7
8
  export declare interface FormFieldDefinition<T = any> {
8
9
  key: string;
@@ -3,7 +3,7 @@ import { ControlValueAccessor, FormControl, FormGroupDirective } from '@angular/
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
4
  import { LoadResult, SuggestFn, SuggestService } from '../../services/entity-service.class';
5
5
  import { InputElement } from '../../inputs';
6
- import { CompareWithFn, DisplayFn } from '../../form/field.model';
6
+ import { DisplayFn, EqualsFn } from '../../form/field.model';
7
7
  import { FloatLabelType } from '@angular/material/form-field';
8
8
  import { MatSelect } from '@angular/material/select';
9
9
  import { MatAutocomplete, MatAutocompleteTrigger } from '@angular/material/autocomplete';
@@ -15,7 +15,7 @@ export declare interface MatAutocompleteFieldConfig<T = any, F = any> {
15
15
  columnSizes?: (number | 'auto' | undefined)[];
16
16
  columnNames?: (string | undefined)[];
17
17
  displayWith?: DisplayFn;
18
- compareWith?: CompareWithFn;
18
+ equals?: EqualsFn;
19
19
  showAllOnFocus?: boolean;
20
20
  showPanelOnFocus?: boolean;
21
21
  class?: string;
@@ -39,31 +39,12 @@ export declare class MatAutocompleteConfigHolder {
39
39
  add<T = any, F = any>(fieldName: string, options?: MatAutocompleteFieldAddOptions<T, F>): MatAutocompleteFieldConfig<T, F>;
40
40
  get<T = any>(fieldName: string): MatAutocompleteFieldConfig<T>;
41
41
  }
42
- export declare class MatAutocompleteField implements OnInit, InputElement, OnDestroy, ControlValueAccessor {
42
+ export declare class MatAutocompleteField implements OnInit, OnDestroy, InputElement, ControlValueAccessor {
43
43
  protected cd: ChangeDetectorRef;
44
44
  private formGroupDir;
45
45
  private _onChangeCallback;
46
46
  private _onTouchedCallback;
47
- private _onFetchMoreCallback;
48
- private _implicitValue;
49
- private _subscription;
50
- private _itemsSubscription;
51
- private _openedSubscription;
52
- private _filter$;
53
- private _itemCount;
54
- private _reload$;
55
- _readonly: boolean;
56
- _tabindex: number;
57
- matSelectItems$: Observable<any[]>;
58
- $inputItems: BehaviorSubject<any[]>;
59
- $filteredItems: BehaviorSubject<any[]>;
60
- searchable: boolean;
61
- displayValue: string;
62
- _moreItemsCount: number;
63
- _fetchMore$: EventEmitter<Event>;
64
- get itemCount(): number;
65
- get canFetchMore(): boolean;
66
- compareWith: (o1: any, o2: any) => boolean;
47
+ equals: EqualsFn;
67
48
  logPrefix: string;
68
49
  formControl: FormControl;
69
50
  formControlName: string;
@@ -93,7 +74,37 @@ export declare class MatAutocompleteField implements OnInit, InputElement, OnDes
93
74
  fetchMoreThreshold: string;
94
75
  suggestLengthThreshold: number;
95
76
  showLoadingSpinner: boolean;
96
- animationsDisabled: boolean;
77
+ debug: boolean;
78
+ clicked: EventEmitter<MouseEvent>;
79
+ blurred: EventEmitter<FocusEvent>;
80
+ focused: EventEmitter<FocusEvent>;
81
+ dropButtonClick: EventEmitter<UIEvent>;
82
+ keydownEscape: EventEmitter<any>;
83
+ keyupEnter: EventEmitter<any>;
84
+ matSelect: MatSelect;
85
+ matInputText: ElementRef;
86
+ autocomplete: MatAutocomplete;
87
+ autocompleteTrigger: MatAutocompleteTrigger;
88
+ _readonly: boolean;
89
+ _tabindex: number;
90
+ matSelectItems$: Observable<any[]>;
91
+ $inputItems: BehaviorSubject<any[]>;
92
+ $filteredItems: BehaviorSubject<any[]>;
93
+ searchable: boolean;
94
+ displayValue: string;
95
+ _moreItemsCount: number;
96
+ _fetchMore$: EventEmitter<Event>;
97
+ private _onFetchMoreCallback;
98
+ private _implicitValue;
99
+ private _subscription;
100
+ private _itemsSubscription;
101
+ private _openedSubscription;
102
+ private _$filter;
103
+ private _itemCount;
104
+ private _reload$;
105
+ constructor(cd: ChangeDetectorRef, formGroupDir: FormGroupDirective);
106
+ get itemCount(): number;
107
+ get canFetchMore(): boolean;
97
108
  set filter(value: any);
98
109
  get filter(): any;
99
110
  set readonly(value: boolean);
@@ -102,20 +113,10 @@ export declare class MatAutocompleteField implements OnInit, InputElement, OnDes
102
113
  get tabindex(): number;
103
114
  set items(value: Observable<any[]> | any[]);
104
115
  get items(): Observable<any[]> | any[];
105
- onClick: EventEmitter<MouseEvent>;
106
- onBlur: EventEmitter<FocusEvent>;
107
- onFocus: EventEmitter<FocusEvent>;
108
- onDropButtonClick: EventEmitter<UIEvent>;
109
- onKeydownEscape: EventEmitter<any>;
110
- onKeyupEnter: EventEmitter<any>;
111
- matSelect: MatSelect;
112
- matInputText: ElementRef;
113
- matAutocomplete: MatAutocomplete;
114
- matAutocompleteTrigger: MatAutocompleteTrigger;
115
116
  get value(): any;
116
- get disabled(): any;
117
- get enabled(): any;
118
- constructor(cd: ChangeDetectorRef, formGroupDir: FormGroupDirective);
117
+ get disabled(): boolean;
118
+ get enabled(): boolean;
119
+ get loading(): boolean;
119
120
  ngOnInit(): void;
120
121
  ngOnDestroy(): void;
121
122
  /**
@@ -127,7 +128,7 @@ export declare class MatAutocompleteField implements OnInit, InputElement, OnDes
127
128
  registerOnTouched(fn: any): void;
128
129
  setDisabledState(isDisabled: boolean): void;
129
130
  focus(): void;
130
- filterInputTextFocusInEvent(event: FocusEvent): boolean;
131
+ filterInputTextFocusEvent(event: FocusEvent): boolean;
131
132
  filterInputTextBlurEvent(event: FocusEvent): boolean;
132
133
  filterMatSelectFocusEvent(event: FocusEvent): void;
133
134
  filterMatSelectBlurEvent(event: FocusEvent): boolean;
@@ -2,7 +2,6 @@
2
2
  import { OnInit } from '@angular/core';
3
3
  import { FormBuilder, FormGroup } from '@angular/forms';
4
4
  import { MatAutocompleteConfigHolder } from '../material.autocomplete';
5
- import { BehaviorSubject } from 'rxjs';
6
5
  import { LoadResult } from '../../../services/entity-service.class';
7
6
  import Timer = NodeJS.Timer;
8
7
  declare class EntityTestClass {
@@ -12,8 +11,8 @@ declare class EntityTestClass {
12
11
  }
13
12
  export declare class AutocompleteTestPage implements OnInit {
14
13
  protected formBuilder: FormBuilder;
15
- _items: EntityTestClass[];
16
- $items: BehaviorSubject<EntityTestClass[]>;
14
+ private _items;
15
+ private _$items;
17
16
  form: FormGroup;
18
17
  autocompleteFields: MatAutocompleteConfigHolder;
19
18
  memoryHide: boolean;
@@ -26,9 +25,9 @@ export declare class AutocompleteTestPage implements OnInit {
26
25
  loadData(): Promise<void>;
27
26
  loadItems(): Promise<void>;
28
27
  entityToString(item: any): string;
29
- suggest(value: any, filter?: any): Promise<LoadResult<any>>;
28
+ suggest(value: any, filter?: any): Promise<LoadResult<EntityTestClass>>;
30
29
  doSubmit(event: any): void;
31
- compareWithFn(o1: EntityTestClass, o2: EntityTestClass): boolean;
30
+ equals(o1: EntityTestClass, o2: EntityTestClass): boolean;
32
31
  toggleMode(value: any): void;
33
32
  startMemoryTimer(): void;
34
33
  stopMemoryTimer(): void;
@@ -2,18 +2,19 @@ import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit } from '
2
2
  import { ControlValueAccessor, FormControl, FormGroupDirective } from '@angular/forms';
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
4
  import { FloatLabelType } from '@angular/material/form-field';
5
- import { MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';
5
+ import { MatAutocomplete, MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';
6
6
  import { InputElement } from '../../inputs';
7
7
  import { SuggestFn } from '../../services/entity-service.class';
8
- import { DisplayFn } from '../../form/field.model';
8
+ import { DisplayFn, EqualsFn } from '../../form/field.model';
9
9
  import { MatAutocompleteFieldConfig } from '../autocomplete/material.autocomplete';
10
- import { getPropertyByPath } from '../../functions';
11
- export declare class MatChipsField implements InputElement, ControlValueAccessor, OnInit, OnDestroy {
10
+ import { PredefinedColors } from '@ionic/core';
11
+ import { ThemePalette } from '@angular/material/core/common-behaviors/color';
12
+ export declare class MatChipsField implements OnInit, OnDestroy, InputElement, ControlValueAccessor {
12
13
  protected cd: ChangeDetectorRef;
13
14
  private formGroupDir;
14
15
  private _onChangeCallback;
15
16
  private _onTouchedCallback;
16
- compareWith: (o1: any, o2: any) => boolean;
17
+ equals: EqualsFn;
17
18
  logPrefix: string;
18
19
  formControl: FormControl;
19
20
  formControlName: string;
@@ -32,37 +33,55 @@ export declare class MatChipsField implements InputElement, ControlValueAccessor
32
33
  highlightAccent: boolean;
33
34
  showAllOnFocus: boolean;
34
35
  showPanelOnFocus: boolean;
35
- appAutofocus: boolean;
36
+ autofocus: boolean;
36
37
  config: MatAutocompleteFieldConfig;
37
38
  i18nPrefix: string;
38
39
  noResultMessage: string;
39
- class: string;
40
+ classList: string;
41
+ panelWidth: string;
42
+ matAutocompletePosition: 'auto' | 'above' | 'below';
43
+ itemSize: string;
44
+ fetchMoreThreshold: string;
45
+ suggestLengthThreshold: number;
46
+ showLoadingSpinner: boolean;
47
+ chipColor: ThemePalette | PredefinedColors;
40
48
  debug: boolean;
41
49
  clicked: EventEmitter<MouseEvent>;
42
50
  blurred: EventEmitter<FocusEvent>;
43
51
  focused: EventEmitter<FocusEvent>;
52
+ dropButtonClick: EventEmitter<UIEvent>;
53
+ keydownEscape: EventEmitter<any>;
54
+ keyupEnter: EventEmitter<any>;
44
55
  matInputText: ElementRef;
56
+ autocomplete: MatAutocomplete;
45
57
  autocompleteTrigger: MatAutocompleteTrigger;
46
58
  _tabindex: number;
47
59
  $inputItems: BehaviorSubject<any[]>;
48
- filteredItems$: Observable<any[]>;
49
- onDropButtonClick: EventEmitter<UIEvent>;
60
+ $filteredItems: BehaviorSubject<any[]>;
50
61
  inputControl: FormControl;
51
- getPropertyByPath: typeof getPropertyByPath;
62
+ _moreItemsCount: number;
63
+ _fetchMore$: EventEmitter<Event>;
64
+ private _onFetchMoreCallback;
65
+ private _implicitValue;
52
66
  private _subscription;
53
67
  private _itemsSubscription;
68
+ private _openedSubscription;
54
69
  private _$filter;
55
70
  private _itemCount;
71
+ private _reload$;
56
72
  constructor(cd: ChangeDetectorRef, formGroupDir: FormGroupDirective);
57
73
  get itemCount(): number;
74
+ get canFetchMore(): boolean;
58
75
  set filter(value: any);
59
76
  get filter(): any;
60
77
  set tabindex(value: number);
61
78
  get tabindex(): number;
62
79
  set items(value: Observable<any[]> | any[]);
80
+ get items(): Observable<any[]> | any[];
63
81
  get value(): any[];
64
- get disabled(): any;
65
- get enabled(): any;
82
+ get disabled(): boolean;
83
+ get enabled(): boolean;
84
+ get loading(): boolean;
66
85
  ngOnInit(): void;
67
86
  ngOnDestroy(): void;
68
87
  /**
@@ -80,14 +99,24 @@ export declare class MatChipsField implements InputElement, ControlValueAccessor
80
99
  /**
81
100
  * Allow to reload content. Useful when filter has been changed but not detected
82
101
  */
83
- reloadItems(): void;
102
+ reloadItems(value?: any): void;
84
103
  writeValue(value: any[]): void;
85
104
  registerOnChange(fn: any): void;
86
105
  registerOnTouched(fn: any): void;
87
106
  setDisabledState(isDisabled: boolean): void;
88
107
  focus(): void;
89
108
  filterInputTextFocusEvent(event: FocusEvent): boolean;
109
+ filterInputTextBlurEvent(event: FocusEvent): boolean;
110
+ filterChipsFocusEvent(event: FocusEvent): void;
90
111
  clearValue(event: UIEvent): void;
112
+ _initAutocompleteInfiniteScroll(threshold?: string): void;
113
+ get isOpen(): boolean;
114
+ closePanel(): void;
91
115
  private suggest;
116
+ private fetchMore;
117
+ private updateImplicitValue;
118
+ private checkIfTouched;
119
+ private getAutocompletePanel;
92
120
  private markForCheck;
121
+ private markAsLoading;
93
122
  }
@@ -20,7 +20,7 @@ export declare class ChipsTestPage implements OnInit {
20
20
  entityToString(item: any): string;
21
21
  suggest(value: any, filter?: any): Promise<LoadResult<EntityTestClass>>;
22
22
  doSubmit(event: any): void;
23
- compareWithFn(o1: EntityTestClass, o2: EntityTestClass): boolean;
23
+ equals(o1: EntityTestClass, o2: EntityTestClass): boolean;
24
24
  stringify(value: any): string;
25
25
  }
26
26
  export {};
@@ -2,7 +2,7 @@ import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit } from '
2
2
  import { ControlValueAccessor, FormControl, FormGroupDirective } from '@angular/forms';
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
4
  import { InputElement, selectInputContent } from '../../inputs';
5
- import { CompareWithFn, DisplayFn } from '../../form/field.model';
5
+ import { EqualsFn, DisplayFn } from '../../form/field.model';
6
6
  import { FloatLabelType } from '@angular/material/form-field';
7
7
  import { IonSlides } from '@ionic/angular';
8
8
  import { MatButton } from '@angular/material/button';
@@ -33,7 +33,7 @@ export declare class MatSwipeField implements OnInit, InputElement, OnDestroy, C
33
33
  required: boolean;
34
34
  mobile: boolean;
35
35
  clearable: boolean;
36
- compareWithFn: CompareWithFn | null;
36
+ equals: EqualsFn | null;
37
37
  displayWith: DisplayFn | null;
38
38
  displayAttributes: string[];
39
39
  appAutofocus: boolean;
@@ -289,6 +289,7 @@ mat-option:not(:last-child) {
289
289
  --max-width: 100%;
290
290
  min-width: var(--min-width) !important;
291
291
  max-width: var(--max-width) !important;
292
+ width: var(--max-width) !important;
292
293
  }
293
294
 
294
295
  .mat-autocomplete-panel-medium-size .mat-autocomplete-panel,
@@ -315,7 +316,8 @@ mat-option:not(:last-child) {
315
316
 
316
317
  .mat-autocomplete-panel-full-size .mat-autocomplete-panel,
317
318
  .mat-autocomplete-panel-full-size.mat-autocomplete-panel {
318
- --min-width: calc(100vw);
319
+ --min-width: calc(100vw - 5px);
320
+ --max-width: calc(100vw - 5px);
319
321
  position: fixed;
320
322
  left: 0;
321
323
  }