@ecodev/natural 37.1.0 → 40.0.0

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 (46) hide show
  1. package/bundles/ecodev-natural.umd.js +158 -109
  2. package/bundles/ecodev-natural.umd.js.map +1 -1
  3. package/ecodev-natural.metadata.json +1 -1
  4. package/esm2015/lib/classes/abstract-list.js +20 -22
  5. package/esm2015/lib/classes/abstract-navigable-list.js +32 -23
  6. package/esm2015/lib/classes/rxjs.js +13 -2
  7. package/esm2015/lib/classes/validators.js +15 -1
  8. package/esm2015/lib/modules/alert/confirm.component.js +1 -1
  9. package/esm2015/lib/modules/columns-picker/columns-picker.component.js +26 -8
  10. package/esm2015/lib/modules/detail-header/detail-header.component.js +1 -1
  11. package/esm2015/lib/modules/dropdown-components/type-number/type-number.component.js +1 -1
  12. package/esm2015/lib/modules/dropdown-components/type-text/type-text.component.js +1 -1
  13. package/esm2015/lib/modules/file/component/file.component.js +1 -1
  14. package/esm2015/lib/modules/file/file-drop.directive.js +2 -4
  15. package/esm2015/lib/modules/fixed-button/fixed-button.component.js +1 -1
  16. package/esm2015/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.js +1 -1
  17. package/esm2015/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.component.js +1 -1
  18. package/esm2015/lib/modules/icon/icon.component.js +1 -1
  19. package/esm2015/lib/modules/relations/relations.component.js +1 -1
  20. package/esm2015/lib/modules/search/dropdown-container/dropdown-container.component.js +2 -2
  21. package/esm2015/lib/modules/search/dropdown-container/dropdown-ref.js +1 -1
  22. package/esm2015/lib/modules/search/facet-selector/facet-selector.component.js +1 -1
  23. package/esm2015/lib/modules/search/group/group.component.js +1 -1
  24. package/esm2015/lib/modules/search/input/input.component.js +4 -4
  25. package/esm2015/lib/modules/search/search/search.component.js +1 -1
  26. package/esm2015/lib/modules/select/select/select.component.js +1 -1
  27. package/esm2015/lib/modules/select/select-hierarchic/select-hierarchic.component.js +1 -1
  28. package/esm2015/lib/modules/sidenav/sidenav-container/sidenav-container.component.js +3 -3
  29. package/esm2015/lib/modules/sidenav/sidenav-content/sidenav-content.component.js +1 -1
  30. package/esm2015/lib/modules/table-button/table-button.component.js +1 -1
  31. package/fesm2015/ecodev-natural.js +126 -78
  32. package/fesm2015/ecodev-natural.js.map +1 -1
  33. package/lib/classes/abstract-list.d.ts +7 -10
  34. package/lib/classes/abstract-navigable-list.d.ts +4 -2
  35. package/lib/classes/rxjs.d.ts +6 -1
  36. package/lib/classes/validators.d.ts +7 -0
  37. package/lib/modules/columns-picker/columns-picker.component.d.ts +15 -5
  38. package/lib/modules/search/dropdown-container/dropdown-container.component.d.ts +1 -2
  39. package/lib/modules/sidenav/sidenav-container/sidenav-container.component.d.ts +3 -2
  40. package/package.json +5 -5
  41. package/src/lib/modules/alert/_alert.theme.scss +1 -1
  42. package/src/lib/modules/file/component/_file.theme.scss +1 -1
  43. package/src/lib/modules/icon/_icon.theme.scss +1 -1
  44. package/src/lib/modules/search/dropdown-container/_dropdown-container.theme.scss +1 -1
  45. package/src/lib/modules/sidenav/_sidenav.theme.scss +1 -1
  46. package/src/lib/styles/_table.scss +1 -1
@@ -22,7 +22,7 @@ declare type MaybeNavigable = Literal | NavigableItem<Literal>;
22
22
  * Components inheriting from this class can be used as standalone with input attributes.
23
23
  *
24
24
  * Usage :
25
- * <natural-my-listing [forcedVariables]="{filter:...}" [initialColumns]="['col1']" [persistSearch]="false">
25
+ * <natural-my-listing [forcedVariables]="{filter:...}" [selectedColumns]="['col1']" [persistSearch]="false">
26
26
  */
27
27
  export declare class NaturalAbstractList<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>, Tall extends PaginatedData<MaybeNavigable> = ExtractTall<TService>> extends NaturalAbstractPanel implements OnInit, OnDestroy {
28
28
  readonly service: TService;
@@ -34,17 +34,15 @@ export declare class NaturalAbstractList<TService extends NaturalAbstractModelSe
34
34
  /**
35
35
  * Columns list after interaction with <natural-columns-picker>
36
36
  */
37
- private _selectedColumns;
37
+ columnsForTable: string[];
38
38
  /**
39
39
  * The default column selection that automatically happened after <natural-columns-picker> initialization
40
40
  */
41
41
  private defaultSelectedColumns;
42
42
  /**
43
- * Initial columns on component init
44
- *
45
- * Changing this value after initialization will have no effect at all
43
+ * Visible (checked) columns
46
44
  */
47
- initialColumns?: string[];
45
+ selectedColumns?: string[];
48
46
  /**
49
47
  * Source of the list
50
48
  */
@@ -101,7 +99,7 @@ export declare class NaturalAbstractList<TService extends NaturalAbstractModelSe
101
99
  /**
102
100
  * Persist search and then launch whatever is required to refresh the list
103
101
  */
104
- search(naturalSearchSelections: NaturalSearchSelections, navigationExtras?: NavigationExtras): void;
102
+ search(naturalSearchSelections: NaturalSearchSelections, navigationExtras?: NavigationExtras, resetPagination?: boolean): void;
105
103
  /**
106
104
  * Change sorting variables for query and persist the new value in url and local storage
107
105
  * The default value is not persisted
@@ -158,7 +156,7 @@ export declare class NaturalAbstractList<TService extends NaturalAbstractModelSe
158
156
  * Uses data provided by router such as:
159
157
  *
160
158
  * - `route.data.forcedVariables`
161
- * - `route.data.initialColumns`
159
+ * - `route.data.selectedColumns`
162
160
  */
163
161
  protected initFromRoute(): void;
164
162
  protected getDataObservable(): Observable<Tall>;
@@ -174,7 +172,6 @@ export declare class NaturalAbstractList<TService extends NaturalAbstractModelSe
174
172
  */
175
173
  protected bulkDelete(): Observable<void>;
176
174
  private applyForcedVariables;
177
- get selectedColumns(): string[];
178
- set selectedColumns(columns: string[]);
175
+ selectColumns(columns: string[]): void;
179
176
  }
180
177
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Injector, OnDestroy, OnInit } from '@angular/core';
2
- import { RouterLink } from '@angular/router';
2
+ import { NavigationExtras, RouterLink } from '@angular/router';
3
3
  import { NaturalSearchSelections } from '../modules/search/types/values';
4
4
  import { NaturalAbstractModelService } from '../services/abstract-model.service';
5
5
  import { NaturalAbstractList } from './abstract-list';
@@ -28,12 +28,14 @@ export declare class NaturalAbstractNavigableList<TService extends NaturalAbstra
28
28
  * Name of filter for child items to access ancestor item
29
29
  */
30
30
  ancestorRelationName: string;
31
+ private oldAncertorId;
31
32
  breadcrumbs: BreadcrumbItem[];
32
33
  constructor(service: TService, injector: Injector);
33
34
  ngOnInit(): void;
34
35
  protected getDataObservable(): Observable<PaginatedData<NavigableItem<ExtractTallOne<TService>>>>;
35
36
  protected translateSearchAndRefreshList(naturalSearchSelections: NaturalSearchSelections): void;
36
- clearSearch(): void;
37
+ clearSearch(resetPagination?: boolean): void;
38
+ search(naturalSearchSelections: NaturalSearchSelections, navigationExtras?: NavigationExtras, resetPagination?: boolean): void;
37
39
  /**
38
40
  * Return an array for router link usage
39
41
  */
@@ -1,4 +1,4 @@
1
- import { Observable } from 'rxjs';
1
+ import { MonoTypeOperatorFunction, Observable } from 'rxjs';
2
2
  /**
3
3
  * Behave like setTimeout(), but with a mandatory cancel mechanism.
4
4
  *
@@ -28,3 +28,8 @@ import { Observable } from 'rxjs';
28
28
  * ```
29
29
  */
30
30
  export declare function cancellableTimeout(canceller: Observable<unknown>, milliSeconds?: number): Observable<void>;
31
+ /**
32
+ * For debugging purpose only, will dump in console everything that happen to
33
+ * the observable
34
+ */
35
+ export declare function debug<T>(debugName: string): MonoTypeOperatorFunction<T>;
@@ -5,6 +5,13 @@ import { NaturalAbstractModelService } from '../services/abstract-model.service'
5
5
  * Returns an async validator function that checks that the form control value is unique
6
6
  */
7
7
  export declare function unique<TService extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, any>>(fieldName: string, excludedId: string | null | undefined, modelService: TService): AsyncValidatorFn;
8
+ /**
9
+ * Returns an async validator function that checks that the form control value is available
10
+ *
11
+ * Similar to `unique` validator, but allows to use a custom query for when the client does
12
+ * not have permissions for `modelService.count()`.
13
+ */
14
+ export declare function available(getAvailableQuery: (value: string, excludedId: string | null) => Observable<boolean>, excludedId?: string | null): AsyncValidatorFn;
8
15
  /**
9
16
  * Return all errors recursively for the given Form or control
10
17
  */
@@ -2,17 +2,27 @@ import { AfterViewInit, ChangeDetectorRef, EventEmitter, OnDestroy, QueryList }
2
2
  import { NaturalColumnsPickerColumnDirective } from './columns-picker-column.directive';
3
3
  export declare class NaturalColumnsPickerComponent implements AfterViewInit, OnDestroy {
4
4
  private readonly changeDetectorRef;
5
- set selection(columns: string[]);
5
+ private _selections?;
6
6
  /**
7
- * Emit a list of column keys whenever the selection changes
7
+ * Set the columns that are wanted but might be unavailable.
8
+ *
9
+ * If a column is unavailable it will be ignored silently. To know what columns were actually applied
10
+ * you should use `selectionChange`.
11
+ *
12
+ * It is often set once on component initialization, but it can also be set again later in the lifespan of the component.
13
+ */
14
+ set selections(columns: string[] | undefined);
15
+ /**
16
+ * Emit a list of valid and selected column keys whenever the selection changes
8
17
  */
9
18
  readonly selectionChange: EventEmitter<string[]>;
10
- readonly defaultSelectionChange: EventEmitter<string[]>;
11
19
  /**
12
- * Filter available columns
20
+ * Available columns are defined by options in the template
13
21
  */
14
- initialSelection?: string[];
15
22
  availableColumns: QueryList<NaturalColumnsPickerColumnDirective> | null;
23
+ /**
24
+ * Displayed options in the dropdown menu
25
+ */
16
26
  displayedColumns: NaturalColumnsPickerColumnDirective[];
17
27
  private ngUnsubscribe;
18
28
  constructor(changeDetectorRef: ChangeDetectorRef);
@@ -3,7 +3,6 @@ import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
3
3
  import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
4
4
  import { ComponentRef, ElementRef, EmbeddedViewRef, InjectionToken, OnDestroy, TemplateRef } from '@angular/core';
5
5
  import { Subject } from 'rxjs';
6
- import { DropdownResult } from '../types/values';
7
6
  export declare function throwMatDialogContentAlreadyAttachedError(): void;
8
7
  export interface NaturalDropdownContainerData {
9
8
  showValidateButton: boolean;
@@ -15,7 +14,7 @@ export declare class NaturalDropdownContainerComponent extends BasePortalOutlet
15
14
  data: NaturalDropdownContainerData;
16
15
  portalOutlet: CdkPortalOutlet;
17
16
  templateRef: TemplateRef<any>;
18
- readonly closed: Subject<DropdownResult>;
17
+ readonly closed: Subject<void>;
19
18
  /** Current state of the panel animation. */
20
19
  panelAnimationState: 'void' | 'enter';
21
20
  /** Emits whenever an animation on the menu completes. */
@@ -1,4 +1,5 @@
1
1
  import { ElementRef, OnDestroy, OnInit } from '@angular/core';
2
+ import { MatDrawer } from '@angular/material/sidenav';
2
3
  import { NaturalSidenavService } from '../sidenav.service';
3
4
  export declare class NaturalSidenavContainerComponent implements OnInit, OnDestroy {
4
5
  readonly sidenavService: NaturalSidenavService;
@@ -8,9 +9,9 @@ export declare class NaturalSidenavContainerComponent implements OnInit, OnDestr
8
9
  */
9
10
  name: string;
10
11
  /**
11
- * Unique identifier used for the local storage
12
+ * The side that the drawer is attached to
12
13
  */
13
- position: 'start' | 'end';
14
+ position: MatDrawer['position'];
14
15
  /**
15
16
  * If true listens to route changes to close side nav after a route change if mobile view is active
16
17
  * Actually a navigation to current route does not emit a route change, and the sidenav don't close.
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@ecodev/natural",
3
- "version": "37.1.0",
3
+ "version": "40.0.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:Ecodev/natural",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
- "ts-md5": "^1.2.8",
9
- "tslib": "^2.2.0"
8
+ "ts-md5": "^1.2.9",
9
+ "tslib": "^2.3.1"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "@angular/common": "^12.0.1",
13
13
  "@angular/core": "^12.0.1",
14
14
  "@angular/localize": "^12.0.1",
15
15
  "@angular/material": "^12.0.1",
16
- "apollo-angular": "^2.5.0",
16
+ "apollo-angular": "^2.6.0",
17
17
  "lodash-es": "^4.17.21",
18
- "rxjs": "^6.5.4"
18
+ "rxjs": "^7.4.0"
19
19
  },
20
20
  "main": "bundles/ecodev-natural.umd.js",
21
21
  "module": "fesm2015/ecodev-natural.js",
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @use '~@angular/material' as mat;
3
3
  @mixin natural-alert($theme) {
4
4
  $primary: map.get($theme, primary);
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @use '~@angular/material' as mat;
3
3
  @mixin natural-file($theme) {
4
4
  $primary: map.get($theme, primary);
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @use '~@angular/material' as mat;
3
3
  @mixin natural-icon($theme) {
4
4
  $primary: map.get($theme, primary);
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @use '~@angular/material' as mat;
3
3
  @mixin natural-dropdown-container($theme) {
4
4
  $background: map.get($theme, background);
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @mixin natural-sidenav($theme) {
3
3
  $primary: map.get($theme, primary);
4
4
  $accent: map.get($theme, accent);
@@ -1,4 +1,4 @@
1
- @use "sass:map";
1
+ @use 'sass:map';
2
2
  @use '~@angular/material' as mat;
3
3
  @mixin natural-table($theme) {
4
4
  $primary: map.get($theme, primary);