@sumaris-net/ngx-components 1.6.0 → 1.6.4

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 +572 -218
  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 +8 -0
  6. package/esm2015/src/app/core/auth/modal/modal-auth.js +21 -9
  7. package/esm2015/src/app/core/table/entities-table-datasource.class.js +35 -1
  8. package/esm2015/src/app/shared/form/field.model.js +1 -1
  9. package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +103 -102
  10. package/esm2015/src/app/shared/material/autocomplete/testing/autocomplete.test.js +2 -2
  11. package/esm2015/src/app/shared/material/chips/material.chips.js +354 -81
  12. package/esm2015/src/app/shared/material/chips/testing/chips.test.js +13 -6
  13. package/esm2015/src/app/shared/material/swipe/material.swipe.js +5 -5
  14. package/esm2015/src/app/shared/material/swipe/testing/swipe.test.js +2 -2
  15. package/fesm2015/sumaris-net.ngx-components.js +521 -196
  16. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/app/core/auth/modal/modal-auth.d.ts +12 -5
  19. package/src/app/core/table/entities-table-datasource.class.d.ts +6 -1
  20. package/src/app/shared/form/field.model.d.ts +2 -1
  21. package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +35 -35
  22. package/src/app/shared/material/chips/material.chips.d.ts +38 -10
  23. package/src/app/shared/material/chips/testing/chips.test.d.ts +1 -1
  24. package/src/app/shared/material/swipe/material.swipe.d.ts +2 -2
  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.0",
4
+ "version": "1.6.4",
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
  }
@@ -5,7 +5,7 @@ import { OnDestroy } from '@angular/core';
5
5
  import { SortDirection } from '@angular/material/sort';
6
6
  import { CollectionViewer } from '@angular/cdk/collections';
7
7
  import { TableDataSourceOptions } from '@e-is/ngx-material-table/src/app/ngx-material-table/table-data-source';
8
- import { EntitiesServiceWatchOptions, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
8
+ import { EntitiesServiceWatchOptions, FetchMoreFn, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
9
9
  export declare interface AppTableDataServiceOptions<O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> extends EntitiesServiceWatchOptions {
10
10
  [key: string]: any;
11
11
  saveOnlyDirtyRows?: boolean;
@@ -30,6 +30,7 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
30
30
  protected _useValidator: boolean;
31
31
  protected _stopWatching$: Subject<any>;
32
32
  protected _editingRowCount: number;
33
+ protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
33
34
  loadingSubject: BehaviorSubject<boolean>;
34
35
  get serviceOptions(): AppTableDataServiceOptions<O>;
35
36
  set serviceOptions(value: AppTableDataServiceOptions<O>);
@@ -66,6 +67,10 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
66
67
  deleteAll(rows: TableElement<T>[]): Promise<any>;
67
68
  getRows(): Promise<TableElement<T>[]>;
68
69
  asyncCreateNew(insertAt?: number): Promise<void>;
70
+ getData(): Promise<T[]>;
71
+ fetchMore(opts?: {
72
+ emitEvent: boolean;
73
+ }): Promise<boolean>;
69
74
  markAsLoading(): void;
70
75
  markAsLoaded(): void;
71
76
  }
@@ -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;
77
+ clicked: EventEmitter<MouseEvent>;
78
+ blurred: EventEmitter<FocusEvent>;
79
+ focused: EventEmitter<FocusEvent>;
80
+ dropButtonClick: EventEmitter<UIEvent>;
81
+ keydownEscape: EventEmitter<any>;
82
+ keyupEnter: EventEmitter<any>;
83
+ matSelect: MatSelect;
84
+ matInputText: ElementRef;
85
+ autocomplete: MatAutocomplete;
86
+ autocompleteTrigger: MatAutocompleteTrigger;
96
87
  animationsDisabled: boolean;
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,9 @@ 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
117
  get disabled(): any;
117
118
  get enabled(): any;
118
- constructor(cd: ChangeDetectorRef, formGroupDir: FormGroupDirective);
119
119
  ngOnInit(): void;
120
120
  ngOnDestroy(): void;
121
121
  /**
@@ -127,7 +127,7 @@ export declare class MatAutocompleteField implements OnInit, InputElement, OnDes
127
127
  registerOnTouched(fn: any): void;
128
128
  setDisabledState(isDisabled: boolean): void;
129
129
  focus(): void;
130
- filterInputTextFocusInEvent(event: FocusEvent): boolean;
130
+ filterInputTextFocusEvent(event: FocusEvent): boolean;
131
131
  filterInputTextBlurEvent(event: FocusEvent): boolean;
132
132
  filterMatSelectFocusEvent(event: FocusEvent): void;
133
133
  filterMatSelectBlurEvent(event: FocusEvent): boolean;
@@ -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';
10
+ import { PredefinedColors } from '@ionic/core';
11
+ import { ThemePalette } from '@angular/material/core/common-behaviors/color';
11
12
  export declare class MatChipsField implements InputElement, ControlValueAccessor, OnInit, OnDestroy {
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,34 +33,51 @@ 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';
40
43
  debug: boolean;
44
+ itemSize: string;
45
+ fetchMoreThreshold: string;
46
+ suggestLengthThreshold: number;
47
+ showLoadingSpinner: boolean;
48
+ chipColor: ThemePalette | PredefinedColors;
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
82
  get disabled(): any;
65
83
  get enabled(): any;
@@ -80,14 +98,24 @@ export declare class MatChipsField implements InputElement, ControlValueAccessor
80
98
  /**
81
99
  * Allow to reload content. Useful when filter has been changed but not detected
82
100
  */
83
- reloadItems(): void;
101
+ reloadItems(value?: any): void;
84
102
  writeValue(value: any[]): void;
85
103
  registerOnChange(fn: any): void;
86
104
  registerOnTouched(fn: any): void;
87
105
  setDisabledState(isDisabled: boolean): void;
88
106
  focus(): void;
89
107
  filterInputTextFocusEvent(event: FocusEvent): boolean;
108
+ filterInputTextBlurEvent(event: FocusEvent): boolean;
109
+ filterChipsFocusEvent(event: FocusEvent): void;
90
110
  clearValue(event: UIEvent): void;
111
+ _initAutocompleteInfiniteScroll(threshold?: string): void;
112
+ get isOpen(): boolean;
113
+ closePanel(): void;
91
114
  private suggest;
115
+ private fetchMore;
116
+ private updateImplicitValue;
117
+ private getAutocompletePanel;
118
+ private checkIfTouched;
92
119
  private markForCheck;
120
+ private markAsLoading;
93
121
  }
@@ -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;