@ecodev/natural 60.0.2 → 60.1.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 (28) hide show
  1. package/esm2022/lib/classes/abstract-list.mjs +4 -1
  2. package/esm2022/lib/modules/common/directives/background-density.directive.mjs +65 -0
  3. package/esm2022/lib/modules/common/directives/linkable-tab.directive.mjs +3 -1
  4. package/esm2022/lib/modules/common/directives/src-density.directive.mjs +25 -15
  5. package/esm2022/lib/modules/common/public-api.mjs +2 -1
  6. package/esm2022/lib/modules/detail-header/detail-header.component.mjs +3 -3
  7. package/esm2022/lib/modules/file/component/file.component.mjs +16 -16
  8. package/esm2022/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.mjs +3 -3
  9. package/esm2022/lib/modules/relations/relations.component.mjs +4 -1
  10. package/esm2022/lib/modules/search/facet-selector/facet-selector.component.mjs +3 -3
  11. package/esm2022/lib/modules/search/group/group.component.mjs +3 -3
  12. package/esm2022/lib/modules/search/search/search.component.mjs +3 -3
  13. package/esm2022/lib/modules/select/select/select.component.mjs +7 -7
  14. package/esm2022/lib/modules/select/select-enum/select-enum.component.mjs +3 -3
  15. package/esm2022/lib/modules/select/select-hierarchic/select-hierarchic.component.mjs +14 -5
  16. package/fesm2022/ecodev-natural.mjs +137 -48
  17. package/fesm2022/ecodev-natural.mjs.map +1 -1
  18. package/lib/classes/abstract-list.d.ts +3 -0
  19. package/lib/modules/common/directives/background-density.directive.d.ts +39 -0
  20. package/lib/modules/common/directives/linkable-tab.directive.d.ts +2 -0
  21. package/lib/modules/common/directives/src-density.directive.d.ts +2 -1
  22. package/lib/modules/common/public-api.d.ts +1 -0
  23. package/lib/modules/detail-header/detail-header.component.d.ts +2 -2
  24. package/lib/modules/file/component/file.component.d.ts +3 -5
  25. package/lib/modules/relations/relations.component.d.ts +3 -0
  26. package/lib/modules/select/select/select.component.d.ts +4 -4
  27. package/lib/modules/select/select-hierarchic/select-hierarchic.component.d.ts +13 -4
  28. package/package.json +1 -1
@@ -24,7 +24,10 @@ type MaybeNavigable = Literal | NavigableItem<Literal>;
24
24
  * Components inheriting from this class can be used as standalone with input attributes.
25
25
  *
26
26
  * Usage :
27
+ *
28
+ * ```html
27
29
  * <natural-my-listing [forcedVariables]="{filter:...}" [selectedColumns]="['col1']" [persistSearch]="false">
30
+ * ```
28
31
  */
29
32
  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 {
30
33
  readonly service: TService;
@@ -0,0 +1,39 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class NaturalBackgroundDensityDirective {
4
+ private readonly elementRef;
5
+ /**
6
+ * Automatically apply background image selection based on screen density.
7
+ *
8
+ * The given URL **MUST** be the normal density URL. And it **MUST** include
9
+ * the size as last path segment. That size will automatically be changed
10
+ * for other screen densities. That means that the server **MUST** be able to
11
+ * serve an image of the given size.
12
+ *
13
+ * If the given URL starts with `url(`, or is not ending with a number, then
14
+ * it will be set as-is, without any processing. This allows using url data,
15
+ * such as `url(data:image/png;base64,aabbcc)`.
16
+ *
17
+ * Usage:
18
+ *
19
+ * ```html
20
+ * <div naturalBackgroundDensity="/api/image/123/200"></div>
21
+ * <div naturalBackgroundDensity="/non-responsive.jpg"></div>
22
+ * <div naturalBackgroundDensity="url(data:image/png;base64,aabbcc)"></div>
23
+ * ```
24
+ *
25
+ * Will generate something like:
26
+ *
27
+ * ```html
28
+ * <div style="background-image: image-set(url("/api/image/123/200") 1x, url("/api/image/123/300") 1.5x, url("/api/image/123/400") 2x, url("/api/image/123/600") 3x, url("/api/image/123/800") 4x);"></div>
29
+ * <div style="background-image: url("/non-responsive.jpg");"></div>
30
+ * <div style="background-image: url(data:image/png;base64,aabbcc)"></div>
31
+ * ```
32
+ *
33
+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/image/image-set
34
+ */
35
+ set naturalBackgroundDensity(src: string);
36
+ constructor(elementRef: ElementRef<HTMLElement>);
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<NaturalBackgroundDensityDirective, never>;
38
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalBackgroundDensityDirective, "[naturalBackgroundDensity]", never, { "naturalBackgroundDensity": { "alias": "naturalBackgroundDensity"; "required": true; }; }, {}, never, never, true, never>;
39
+ }
@@ -6,11 +6,13 @@ import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Usage :
8
8
  *
9
+ * ```html
9
10
  * <mat-tab-group [naturalLinkableTab]="!isPanel">
10
11
  * <mat-tab label="Tab 1">Tab 1</mat-tab> // First tab doesn't need id. This keeps url clean on default one
11
12
  * <mat-tab label="Tab 2" id="second-tab">Tab 2</mat-tab>
12
13
  * ...
13
14
  * </mat-tab-group>
15
+ * ```
14
16
  */
15
17
  export declare class NaturalLinkableTabDirective extends NaturalAbstractController implements AfterViewInit {
16
18
  private readonly component;
@@ -1,5 +1,6 @@
1
1
  import { ElementRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
+ export declare function densities(src: string, forImageSet: boolean): string;
3
4
  export declare class NaturalSrcDensityDirective {
4
5
  private readonly elementRef;
5
6
  /**
@@ -13,7 +14,7 @@ export declare class NaturalSrcDensityDirective {
13
14
  * Usage:
14
15
  *
15
16
  * ```html
16
- * <img [naturalSrcDensity]="'/api/image/123/200'" />
17
+ * <img naturalSrcDensity="/api/image/123/200" />
17
18
  * ```
18
19
  *
19
20
  * Will generate something like:
@@ -5,5 +5,6 @@ export * from './pipes/enum.pipe';
5
5
  export { NaturalTimeAgoPipe } from './pipes/time-ago.pipe';
6
6
  export * from './services/memory-storage';
7
7
  export { NaturalSrcDensityDirective } from './directives/src-density.directive';
8
+ export { NaturalBackgroundDensityDirective } from './directives/background-density.directive';
8
9
  export { NATURAL_SEO_CONFIG, NaturalSeoConfig, NaturalSeoService, NaturalSeo, NaturalSeoBasic, NaturalSeoResolve, NaturalSeoCallback, NaturalSeoResolveData, } from './services/seo.service';
9
10
  export { provideSeo } from './services/seo.provider';
@@ -1,4 +1,4 @@
1
- import { Literal } from '../../types/types';
1
+ import { Literal, NameOrFullName } from '../../types/types';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class NaturalDetailHeaderComponent {
4
4
  /**
@@ -32,7 +32,7 @@ export declare class NaturalDetailHeaderComponent {
32
32
  */
33
33
  newLabel: string;
34
34
  model: Literal;
35
- breadcrumbs: Literal[];
35
+ breadcrumbs: NameOrFullName[];
36
36
  listRoute: any[];
37
37
  listFragment: string | undefined;
38
38
  link?: (id: string) => any[];
@@ -1,6 +1,5 @@
1
1
  import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { AbstractControl } from '@angular/forms';
3
- import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
4
3
  import { Observable } from 'rxjs';
5
4
  import { NaturalFileService } from '../file.service';
6
5
  import { FileModel } from '../types';
@@ -9,7 +8,6 @@ import * as i0 from "@angular/core";
9
8
  export declare class NaturalFileComponent implements OnInit, OnChanges {
10
9
  private readonly naturalFileService;
11
10
  private readonly alertService;
12
- private readonly sanitizer;
13
11
  private readonly document;
14
12
  height: number;
15
13
  action: 'upload' | 'download' | null;
@@ -29,7 +27,7 @@ export declare class NaturalFileComponent implements OnInit, OnChanges {
29
27
  * cases you **must** `bind()` the callback explicitly, like so:
30
28
  *
31
29
  * ```html
32
- * <natural-file [uploader]="myCallback.bind(this)"></natural-file>
30
+ * <natural-file [uploader]="myCallback.bind(this)" />
33
31
  * ```
34
32
  *
35
33
  * Also, you probably **should** set a `[formCtrl]` so that the form is updated automatically, instead of doing
@@ -47,9 +45,9 @@ export declare class NaturalFileComponent implements OnInit, OnChanges {
47
45
  * human navigates away from the page before the upload is finished. Instead, you should use `[uploader]`.
48
46
  */
49
47
  readonly modelChange: EventEmitter<FileModel>;
50
- imagePreview: SafeStyle | null;
48
+ imagePreview: string;
51
49
  filePreview: string | null;
52
- constructor(naturalFileService: NaturalFileService, alertService: NaturalAlertService, sanitizer: DomSanitizer, document: Document);
50
+ constructor(naturalFileService: NaturalFileService, alertService: NaturalAlertService, document: Document);
53
51
  ngOnChanges(changes: SimpleChanges): void;
54
52
  ngOnInit(): void;
55
53
  upload(file: File): void;
@@ -12,11 +12,14 @@ import { ExtractTallOne, ExtractVall } from '../../types/types';
12
12
  import * as i0 from "@angular/core";
13
13
  /**
14
14
  * Custom template usage :
15
+ *
16
+ * ```html
15
17
  * <natural-relations [main]="owner" [service]="svc" [filter]="{}" placeholder="Select an item">
16
18
  * <ng-template let-item="item">
17
19
  * <span>{{ item.xxx }}</span>
18
20
  * </ng-template>
19
21
  * </natural-relations>
22
+ * ```
20
23
  */
21
24
  export declare class NaturalRelationsComponent<TService extends NaturalAbstractModelService<unknown, any, PaginatedData<LinkableObject>, QueryVariables, unknown, any, unknown, any, unknown, any>> extends NaturalAbstractController implements OnInit, OnChanges {
22
25
  private readonly linkMutationService;
@@ -12,7 +12,7 @@ type V<TService> = string | ExtractTallOne<TService>;
12
12
  /**
13
13
  * Default usage:
14
14
  * ```html
15
- * <natural-select [service]="myServiceInstance" [(model)]="myModel" (modelChange)=myChangeFn($event)></natural-select>
15
+ * <natural-select [service]="myServiceInstance" [(model)]="myModel" (modelChange)=myChangeFn($event) />
16
16
  * ```
17
17
  *
18
18
  * Custom template usage :
@@ -28,17 +28,17 @@ type V<TService> = string | ExtractTallOne<TService>;
28
28
  *
29
29
  * Placeholder :
30
30
  * ```html
31
- * <natural-select placeholder="my placeholder"></natural-select>
31
+ * <natural-select placeholder="my placeholder" />
32
32
  * ```
33
33
  *
34
34
  * Search with like %xxx% on specified field `name` instead of custom filter on whole object
35
35
  * ```html
36
- * <natural-select searchField="name"></natural-select>
36
+ * <natural-select searchField="name" />
37
37
  * ```
38
38
  *
39
39
  * Allows to input free string without selecting an option from autocomplete suggestions
40
40
  * ```html
41
- * <natural-select [optionRequired]="false"></natural-select>
41
+ * <natural-select [optionRequired]="false" />
42
42
  * ```
43
43
  */
44
44
  export declare class NaturalSelectComponent<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>> extends AbstractSelect<V<TService>, V<TService>> implements OnInit, OnDestroy, ControlValueAccessor, AfterViewInit {
@@ -7,13 +7,22 @@ import { AbstractSelect } from '../abstract-select.component';
7
7
  import * as i0 from "@angular/core";
8
8
  /**
9
9
  * Default usage:
10
- * <natural-select [config]="myConfig" [(ngModel)]="amazingModel"
11
- * (ngModelChange)=amazingChangeFn($event)></natural-select>
12
10
  *
13
- * [(ngModel)] and (ngModelChange) are optional
11
+ * ```html
12
+ * <natural-select
13
+ * [config]="myConfig"
14
+ * [(ngModel)]="amazingModel"
15
+ * (ngModelChange)=amazingChangeFn($event)
16
+ * />
17
+ * ```
18
+ *
19
+ * `[(ngModel)]` and `(ngModelChange)` are optional.
14
20
  *
15
21
  * Placeholder :
16
- * <natural-select placeholder="amazing placeholder">
22
+ *
23
+ * ```html
24
+ * <natural-select placeholder="amazing placeholder" />
25
+ * ```
17
26
  */
18
27
  export declare class NaturalSelectHierarchicComponent extends AbstractSelect<Literal, string> implements OnInit, OnDestroy, ControlValueAccessor {
19
28
  private readonly hierarchicSelectorDialogService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodev/natural",
3
- "version": "60.0.2",
3
+ "version": "60.1.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:Ecodev/natural",
6
6
  "sideEffects": false,