@sumaris-net/ngx-components 2.2.0 → 2.2.1-rc10

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 (31) hide show
  1. package/doc/changelog.md +5 -0
  2. package/esm2020/src/app/core/form/entity/entity-editor-modal.class.mjs +4 -6
  3. package/esm2020/src/app/core/form/form.class.mjs +3 -3
  4. package/esm2020/src/app/core/form/form.utils.mjs +52 -28
  5. package/esm2020/src/app/core/services/base-entity-service.class.mjs +21 -12
  6. package/esm2020/src/app/core/table/table.class.mjs +2 -2
  7. package/esm2020/src/app/shared/forms.mjs +33 -22
  8. package/esm2020/src/app/shared/image/gallery/image-gallery.component.mjs +6 -4
  9. package/esm2020/src/app/shared/image/gallery/testing/gallery.testing.mjs +1 -1
  10. package/esm2020/src/app/shared/material/autocomplete/material.autocomplete.mjs +7 -8
  11. package/esm2020/src/app/shared/material/chips/material.chips.mjs +31 -24
  12. package/esm2020/src/app/shared/material/chips/testing/chips.test.mjs +10 -3
  13. package/esm2020/src/app/shared/services/entity-service.class.mjs +1 -1
  14. package/esm2020/src/app/shared/shared.module.mjs +2 -2
  15. package/esm2020/src/app/social/user-event/user-event.service.mjs +1 -1
  16. package/fesm2015/sumaris-net.ngx-components.mjs +161 -118
  17. package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
  18. package/fesm2020/sumaris-net.ngx-components.mjs +161 -104
  19. package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
  20. package/package.json +1 -1
  21. package/src/app/core/form/entity/entity-editor-modal.class.d.ts +0 -2
  22. package/src/app/core/form/form.utils.d.ts +2 -2
  23. package/src/app/core/services/base-entity-service.class.d.ts +7 -21
  24. package/src/app/shared/forms.d.ts +2 -2
  25. package/src/app/shared/image/gallery/image-gallery.component.d.ts +3 -1
  26. package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +1 -1
  27. package/src/app/shared/material/chips/material.chips.d.ts +1 -1
  28. package/src/app/shared/material/chips/testing/chips.test.d.ts +1 -1
  29. package/src/app/shared/services/entity-service.class.d.ts +20 -10
  30. package/src/app/social/user-event/user-event.service.d.ts +1 -1
  31. package/src/theme/_ngx-components.scss +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": "2.2.0",
4
+ "version": "2.2.1-rc10",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -7,7 +7,6 @@ import { UsageMode } from '../../services/model/settings.model';
7
7
  import { FormGroup } from '@angular/forms';
8
8
  import { AppTabEditor, AppTabEditorOptions } from './editor.class';
9
9
  import { DateFormatService } from '../../../shared/pipes/date-format.pipe';
10
- import { Environment } from '../../../../environments/environment.class';
11
10
  import { WaitForOptions } from '../../../shared/observables';
12
11
  import { FormErrorTranslator } from '../../../shared/validator/form-error-adapter.class';
13
12
  import { AppErrorWithDetails } from './entity-editor.class';
@@ -34,7 +33,6 @@ export declare abstract class AppEntityEditorModal<T extends Entity<T, ID>, ID =
34
33
  protected readonly cd: ChangeDetectorRef;
35
34
  protected readonly settings: LocalSettingsService;
36
35
  protected readonly modalCtrl: ModalController;
37
- protected readonly environement: Environment;
38
36
  protected errorTranslator: FormErrorTranslator;
39
37
  readonly savingSubject: BehaviorSubject<boolean>;
40
38
  $title: Subject<string>;
@@ -2,7 +2,7 @@ import { AbstractControl, AbstractControlOptions, UntypedFormArray, UntypedFormB
2
2
  import { Entity } from '../services/model/entity.model';
3
3
  import { filterNumberInput, selectInputContent } from '../../shared/inputs';
4
4
  import { WaitForOptions } from '../../shared/observables';
5
- import { clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, addValueInArray, removeValueInArray, resizeArray, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
5
+ import { addValueInArray, clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, removeValueInArray, resizeArray, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
6
6
  export declare type IAppFormGetter = () => IAppForm;
7
7
  export declare interface OnReady {
8
8
  ngOnReady(): any;
@@ -241,7 +241,7 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
241
241
  }
242
242
  export interface AppFormArrayOptions extends AbstractControlOptions {
243
243
  allowEmptyArray: boolean;
244
- resizeStrategy: 'reuse' | 'recreate';
244
+ allowReuseItem?: boolean;
245
245
  }
246
246
  export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
247
247
  private createControl;
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- import { FetchPolicy, InternalRefetchQueriesInclude, MutationUpdaterFn } from '@apollo/client/core';
2
+ import { InternalRefetchQueriesInclude, MutationUpdaterFn } from '@apollo/client/core';
3
3
  import { SortDirection } from '@angular/material/sort';
4
4
  import { BaseGraphqlService } from './base-graphql-service.class';
5
- import { EntitiesServiceWatchOptions, EntityServiceLoadOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
5
+ import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceListenChangesOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
6
6
  import { GraphqlService } from '../graphql/graphql.service';
7
7
  import { PlatformService } from './platform.service';
8
8
  import { Entity, EntityAsObjectOptions } from './model/entity.model';
@@ -45,7 +45,7 @@ export interface EntitySaveOptions {
45
45
  data: any;
46
46
  }>;
47
47
  }
48
- export declare abstract class BaseEntityService<T extends Entity<T, ID>, F extends EntityFilter<F, T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, LO extends EntityServiceLoadOptions = EntityServiceLoadOptions, Q extends BaseEntityGraphqlQueries = BaseEntityGraphqlQueries, M extends BaseEntityGraphqlMutations = BaseEntityGraphqlMutations, S extends BaseEntityGraphqlSubscriptions = BaseEntityGraphqlSubscriptions> extends BaseGraphqlService<T, F, ID> implements IEntitiesService<T, F, WO>, IEntityService<T, ID, LO> {
48
+ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F extends EntityFilter<F, T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, LO extends EntitiesServiceLoadOptions = EntitiesServiceLoadOptions, Q extends BaseEntityGraphqlQueries = BaseEntityGraphqlQueries, M extends BaseEntityGraphqlMutations = BaseEntityGraphqlMutations, S extends BaseEntityGraphqlSubscriptions = BaseEntityGraphqlSubscriptions> extends BaseGraphqlService<T, F, ID> implements IEntitiesService<T, F, WO>, IEntityService<T, ID, LO> {
49
49
  protected graphql: GraphqlService;
50
50
  protected platform: PlatformService;
51
51
  protected dataType: new () => T;
@@ -61,19 +61,11 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
61
61
  protected readonly defaultSortDirection: SortDirection;
62
62
  protected readonly watchQueriesUpdatePolicy: MutableWatchQueriesUpdatePolicy;
63
63
  protected constructor(graphql: GraphqlService, platform: PlatformService, dataType: new () => T, filterType: new () => F, options: BaseEntityServiceOptions<T, ID, Q, M, S>);
64
- watch(id: number, opts?: WO & {
65
- query?: any;
66
- }): Observable<T>;
67
- load(id: ID, opts?: LO & {
68
- query?: any;
69
- }): Promise<T>;
70
- watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: WO & {
71
- query?: any;
72
- }): Observable<LoadResult<T>>;
64
+ watch(id: number, opts?: WO): Observable<T>;
65
+ load(id: ID, opts?: LO): Promise<T>;
66
+ watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: WO): Observable<LoadResult<T>>;
73
67
  loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, opts?: LO & {
74
- query?: any;
75
68
  debug?: boolean;
76
- withTotal?: boolean;
77
69
  }): Promise<LoadResult<T>>;
78
70
  countAll(filter?: Partial<F>, opts?: LO): Promise<number>;
79
71
  canUserWrite(data: T, opts?: any): boolean;
@@ -95,13 +87,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
95
87
  * Delete a referential entity
96
88
  */
97
89
  delete(entity: T, opts?: EntitySaveOptions | any): Promise<any>;
98
- listenChanges(id: ID, opts?: {
99
- query?: any;
100
- variables?: any;
101
- interval?: number;
102
- fetchPolicy?: FetchPolicy;
103
- toEntity?: boolean;
104
- }): Observable<T>;
90
+ listenChanges(id: ID, opts?: EntityServiceListenChangesOptions): Observable<T>;
105
91
  copyIdAndUpdateDate(source: T, target: T): void;
106
92
  fromObject(source: any): T;
107
93
  asFilter(source: any): F;
@@ -41,11 +41,11 @@ export declare function addValueInArray(arrayControl: UntypedFormArray, createCo
41
41
  }): boolean;
42
42
  /**
43
43
  * Set an array using given default values. Each default value will be pass to the 'createControl()' function
44
- * @param formArray
44
+ * @param arrayControl
45
45
  * @param createControl
46
46
  * @param values
47
47
  */
48
- export declare function initArrayControlsFromValues(formArray: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[], options?: {
48
+ export declare function initArrayControlsFromValues(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[], options?: {
49
49
  emitEvent?: boolean;
50
50
  }): boolean;
51
51
  export declare function resizeArray(arrayControl: UntypedFormArray, createControl: () => AbstractControl, length: number, options?: {
@@ -10,6 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
10
10
  import { AppColors } from '../../types';
11
11
  import { FormGroup } from '@angular/forms';
12
12
  import { EventEmitter } from '@angular/core';
13
+ import { PredefinedColors } from '@ionic/core';
13
14
  import * as i0 from "@angular/core";
14
15
  export declare type GalleryMode = 'mosaic' | 'list';
15
16
  export interface ISwiper {
@@ -45,6 +46,7 @@ export declare class AppImageGalleryComponent<T extends Image> implements OnInit
45
46
  zoom: boolean;
46
47
  };
47
48
  viewChange: BehaviorSubject<ListRange>;
49
+ cardColor: string | PredefinedColors;
48
50
  debug: boolean;
49
51
  disabled: boolean;
50
52
  readOnly: boolean;
@@ -95,5 +97,5 @@ export declare class AppImageGalleryComponent<T extends Image> implements OnInit
95
97
  }): Promise<boolean>;
96
98
  protected markForCheck(): void;
97
99
  static ɵfac: i0.ɵɵFactoryDeclaration<AppImageGalleryComponent<any>, [null, null, null, null, null, null, { optional: true; }]>;
98
- static ɵcmp: i0.ɵɵComponentDeclaration<AppImageGalleryComponent<any>, "app-image-gallery", never, { "debug": "debug"; "disabled": "disabled"; "readOnly": "readOnly"; "mobile": "mobile"; "mode": "mode"; "confirmBeforeDelete": "confirmBeforeDelete"; "showToolbar": "showToolbar"; "showFabButton": "showFabButton"; "showTitle": "showTitle"; "showAddCardButton": "showAddCardButton"; "addButtonColor": "addButtonColor"; "dataSource": "dataSource"; }, { "onBeforeDeleteRows": "onBeforeDeleteRows"; "onAfterAddRows": "onAfterAddRows"; }, never, never, false>;
100
+ static ɵcmp: i0.ɵɵComponentDeclaration<AppImageGalleryComponent<any>, "app-image-gallery", never, { "cardColor": "cardColor"; "debug": "debug"; "disabled": "disabled"; "readOnly": "readOnly"; "mobile": "mobile"; "mode": "mode"; "confirmBeforeDelete": "confirmBeforeDelete"; "showToolbar": "showToolbar"; "showFabButton": "showFabButton"; "showTitle": "showTitle"; "showAddCardButton": "showAddCardButton"; "addButtonColor": "addButtonColor"; "dataSource": "dataSource"; }, { "onBeforeDeleteRows": "onBeforeDeleteRows"; "onAfterAddRows": "onAfterAddRows"; }, never, never, false>;
99
101
  }
@@ -119,7 +119,7 @@ export declare class MatAutocompleteField implements OnInit, OnDestroy, InputEle
119
119
  private getAutocompletePanel;
120
120
  private getMatSelectPanel;
121
121
  private markForCheck;
122
- markAsLoading(): void;
122
+ protected markAsLoading(): void;
123
123
  static ɵfac: i0.ɵɵFactoryDeclaration<MatAutocompleteField, [null, { optional: true; }]>;
124
124
  static ɵcmp: i0.ɵɵComponentDeclaration<MatAutocompleteField, "mat-autocomplete-field", never, { "equals": "equals"; "logPrefix": "logPrefix"; "formControl": "formControl"; "formControlName": "formControlName"; "floatLabel": "floatLabel"; "appearance": "appearance"; "placeholder": "placeholder"; "suggestFn": "suggestFn"; "required": "required"; "mobile": "mobile"; "clearable": "clearable"; "debounceTime": "debounceTime"; "displayWith": "displayWith"; "displayAttributes": "displayAttributes"; "displayColumnSizes": "displayColumnSizes"; "displayColumnNames": "displayColumnNames"; "highlightAccent": "highlightAccent"; "showAllOnFocus": "showAllOnFocus"; "showPanelOnFocus": "showPanelOnFocus"; "autofocus": "autofocus"; "config": "config"; "i18nPrefix": "i18nPrefix"; "noResultMessage": "noResultMessage"; "classList": "class"; "panelWidth": "panelWidth"; "matAutocompletePosition": "matAutocompletePosition"; "multiple": "multiple"; "itemSize": "itemSize"; "fetchMoreThreshold": "fetchMoreThreshold"; "suggestLengthThreshold": "suggestLengthThreshold"; "showLoadingSpinner": "showLoadingSpinner"; "debug": "debug"; "showSearchBar": "showSearchBar"; "stickySearchBar": "stickySearchBar"; "filter": "filter"; "readonly": "readonly"; "tabindex": "tabindex"; "items": "items"; }, { "clicked": "click"; "blurred": "blur"; "focused": "focus"; "dropButtonClick": "dropButtonClick"; "keydownEscape": "keydown.escape"; "keyupEnter": "keyup.enter"; }, never, ["[matError]", "[matAfter]", "[matPrefix]", "[matSuffix]"], false>;
125
125
  }
@@ -108,7 +108,7 @@ export declare class MatChipsField implements OnInit, OnDestroy, InputElement, C
108
108
  setDisabledState(isDisabled: boolean): void;
109
109
  focus(): void;
110
110
  filterInputTextFocusEvent(event: FocusEvent): boolean;
111
- filterInputTextBlurEvent(event: FocusEvent): boolean;
111
+ protected filterInputTextBlurEvent(event: FocusEvent): boolean;
112
112
  filterChipsFocusEvent(event: FocusEvent): void;
113
113
  clearValue(event: Event): void;
114
114
  _initAutocompleteInfiniteScroll(threshold?: string): void;
@@ -22,7 +22,7 @@ export declare class ChipsTestPage implements OnInit {
22
22
  loadItems(): Promise<void>;
23
23
  entityToString(item: any): string;
24
24
  suggest(value: any, filter?: any): Promise<LoadResult<EntityTestClass>>;
25
- doSubmit(event: any): void;
25
+ doSubmit(_: any): void;
26
26
  equals(o1: EntityTestClass, o2: EntityTestClass): boolean;
27
27
  stringify(value: any): string;
28
28
  static ɵfac: i0.ɵɵFactoryDeclaration<ChipsTestPage, never>;
@@ -28,6 +28,24 @@ export declare interface EntityServiceLoadOptions {
28
28
  fetchPolicy?: FetchPolicy;
29
29
  trash?: boolean;
30
30
  toEntity?: boolean;
31
+ query?: any;
32
+ variables?: any;
33
+ [key: string]: any;
34
+ }
35
+ export declare interface EntityServiceWatchOptions {
36
+ fetchPolicy?: WatchQueryFetchPolicy;
37
+ trash?: boolean;
38
+ toEntity?: boolean;
39
+ query?: any;
40
+ variables?: any;
41
+ [key: string]: any;
42
+ }
43
+ export declare interface EntityServiceListenChangesOptions {
44
+ interval?: number;
45
+ fetchPolicy?: FetchPolicy;
46
+ toEntity?: boolean;
47
+ query?: any;
48
+ variables?: any;
31
49
  [key: string]: any;
32
50
  }
33
51
  export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptions> {
@@ -37,19 +55,11 @@ export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptio
37
55
  delete(data: T, opts?: any): Promise<any>;
38
56
  listenChanges(id: ID, opts?: any): Observable<T | undefined>;
39
57
  }
40
- export declare interface EntitiesServiceLoadOptions {
41
- fetchPolicy?: FetchPolicy;
42
- trash?: boolean;
58
+ export declare interface EntitiesServiceLoadOptions extends EntityServiceLoadOptions {
43
59
  withTotal?: boolean;
44
- toEntity?: boolean;
45
- [key: string]: any;
46
60
  }
47
- export declare interface EntitiesServiceWatchOptions {
48
- fetchPolicy?: WatchQueryFetchPolicy;
49
- trash?: boolean;
61
+ export declare interface EntitiesServiceWatchOptions extends EntityServiceWatchOptions {
50
62
  withTotal?: boolean;
51
- toEntity?: boolean;
52
- [key: string]: any;
53
63
  }
54
64
  export declare interface IEntitiesService<T, F, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> {
55
65
  watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: O): Observable<LoadResult<T>>;
@@ -64,7 +64,7 @@ export interface IUserEventService<E extends IUserEvent<E, ID>, F extends IUserE
64
64
  registerListener(listener: IUserEventListener<E, ID>): any;
65
65
  resetCount(): any;
66
66
  }
67
- export declare abstract class AbstractUserEventService<E extends IUserEvent<E, ID>, F extends IUserEventFilter<E, ID>, ID = number, WO extends UserEventWatchOptions = UserEventWatchOptions, LO extends UserEventLoadOptions = UserEventLoadOptions, Q extends IUserEventQueries = IUserEventQueries, M extends IUserEventMutations = IUserEventMutations, S extends IUserEventSubscriptions = IUserEventSubscriptions> extends BaseGraphqlService<E, F, ID> implements IUserEventService<E, F, ID, WO, LO>, OnDestroy {
67
+ export declare abstract class AbstractUserEventService<E extends IUserEvent<E, ID, any>, F extends IUserEventFilter<E, ID, any>, ID = number, WO extends UserEventWatchOptions = UserEventWatchOptions, LO extends UserEventLoadOptions = UserEventLoadOptions, Q extends IUserEventQueries = IUserEventQueries, M extends IUserEventMutations = IUserEventMutations, S extends IUserEventSubscriptions = IUserEventSubscriptions> extends BaseGraphqlService<E, F, ID> implements IUserEventService<E, F, ID, WO, LO>, OnDestroy {
68
68
  protected graphql: GraphqlService;
69
69
  protected accountService: AccountService;
70
70
  protected network: NetworkService;
@@ -161,7 +161,7 @@ form.form-container {
161
161
  line-height: 1.125;
162
162
  margin-left: 5px;
163
163
  margin-right: 5px;
164
- height: 0.8em;
164
+ height: 1em;
165
165
  position: relative;
166
166
  bottom: -3px;
167
167
  }