@ecodev/natural 56.0.1 → 56.0.3
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.
- package/esm2022/lib/modules/avatar/component/avatar.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-date/type-date.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-date-range/type-date-range.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-hierarchic-selector/type-hierarchic-selector.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-natural-select/type-natural-select.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-number/type-number.component.mjs +1 -1
- package/esm2022/lib/modules/dropdown-components/type-text/type-text.component.mjs +1 -1
- package/esm2022/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.service.mjs +1 -1
- package/esm2022/lib/modules/relations/relations.component.mjs +3 -3
- package/esm2022/lib/modules/search/input/input.component.mjs +1 -1
- package/esm2022/lib/modules/select/select-hierarchic/select-hierarchic.component.mjs +1 -1
- package/esm2022/lib/services/abstract-model.service.mjs +8 -6
- package/esm2022/lib/services/debounce.service.mjs +26 -7
- package/esm2022/lib/services/enum.service.mjs +1 -1
- package/esm2022/lib/services/link-mutation.service.mjs +1 -1
- package/fesm2022/ecodev-natural.mjs +34 -13
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/lib/services/abstract-model.service.d.ts +2 -2
- package/lib/services/debounce.service.d.ts +10 -2
- package/package.json +1 -1
|
@@ -4407,7 +4407,7 @@ class NaturalAbstractModelService {
|
|
|
4407
4407
|
* If available it will emit object from cache immediately, then it
|
|
4408
4408
|
* will **always** fetch from network and then the observable will be completed
|
|
4409
4409
|
*/
|
|
4410
|
-
getOne(id) {
|
|
4410
|
+
getOne(id, fetchPolicy = 'cache-and-network') {
|
|
4411
4411
|
this.throwIfObservable(id);
|
|
4412
4412
|
this.throwIfNotQuery(this.oneQuery);
|
|
4413
4413
|
return this.getVariablesForOne(id).pipe(switchMap(variables => {
|
|
@@ -4415,7 +4415,7 @@ class NaturalAbstractModelService {
|
|
|
4415
4415
|
return this.apollo.watchQuery({
|
|
4416
4416
|
query: this.oneQuery,
|
|
4417
4417
|
variables: variables,
|
|
4418
|
-
fetchPolicy:
|
|
4418
|
+
fetchPolicy: fetchPolicy,
|
|
4419
4419
|
nextFetchPolicy: 'cache-only',
|
|
4420
4420
|
}).valueChanges;
|
|
4421
4421
|
}), filter(result => !!result.data), takeWhile(result => result.networkStatus !== NetworkStatus.ready, true), map(result => result.data[this.name]));
|
|
@@ -4595,7 +4595,7 @@ class NaturalAbstractModelService {
|
|
|
4595
4595
|
this.throwIfNotQuery(this.deleteMutation);
|
|
4596
4596
|
const ids = objects.map(o => {
|
|
4597
4597
|
// Cancel pending update
|
|
4598
|
-
this.naturalDebounceService.
|
|
4598
|
+
this.naturalDebounceService.cancelOne(this, o.id);
|
|
4599
4599
|
return o.id;
|
|
4600
4600
|
});
|
|
4601
4601
|
const variables = merge({
|
|
@@ -4614,13 +4614,15 @@ class NaturalAbstractModelService {
|
|
|
4614
4614
|
}));
|
|
4615
4615
|
}
|
|
4616
4616
|
/**
|
|
4617
|
-
* Resolve model and items related to the model, if the id is provided, in order to show a form
|
|
4617
|
+
* Resolve model from server (never from cache) and items related to the model, if the id is provided, in order to show a form
|
|
4618
4618
|
*/
|
|
4619
4619
|
resolve(id) {
|
|
4620
4620
|
// Load model if id is given
|
|
4621
4621
|
let observable;
|
|
4622
4622
|
if (id) {
|
|
4623
|
-
observable = this.
|
|
4623
|
+
observable = this.naturalDebounceService
|
|
4624
|
+
.flushOne(this, id)
|
|
4625
|
+
.pipe(switchMap(() => this.getOne(id, 'network-only')));
|
|
4624
4626
|
}
|
|
4625
4627
|
else {
|
|
4626
4628
|
observable = of(this.getDefaultForServer());
|
|
@@ -4800,7 +4802,6 @@ class NaturalAbstractModelService {
|
|
|
4800
4802
|
*/
|
|
4801
4803
|
class NaturalDebounceService {
|
|
4802
4804
|
constructor() {
|
|
4803
|
-
this.flusher = new Subject();
|
|
4804
4805
|
/**
|
|
4805
4806
|
* Stores the debounced update function
|
|
4806
4807
|
*/
|
|
@@ -4829,12 +4830,14 @@ class NaturalDebounceService {
|
|
|
4829
4830
|
canceller.complete();
|
|
4830
4831
|
this.delete(key, id);
|
|
4831
4832
|
});
|
|
4833
|
+
const flusher = new Subject();
|
|
4832
4834
|
debounced = {
|
|
4833
4835
|
debouncer,
|
|
4834
4836
|
canceller,
|
|
4837
|
+
flusher,
|
|
4835
4838
|
source,
|
|
4836
4839
|
result: debouncer.pipe(debounceTime$1(2000), // Wait 2 seconds...
|
|
4837
|
-
raceWith(
|
|
4840
|
+
raceWith(flusher), // ...unless flusher is triggered
|
|
4838
4841
|
take$1(1), mergeMap(() => {
|
|
4839
4842
|
this.delete(key, id);
|
|
4840
4843
|
if (wasCancelled || !debounced) {
|
|
@@ -4850,10 +4853,21 @@ class NaturalDebounceService {
|
|
|
4850
4853
|
// Return and observable that is updated when mutation is done
|
|
4851
4854
|
return debounced.result;
|
|
4852
4855
|
}
|
|
4853
|
-
|
|
4856
|
+
cancelOne(key, id) {
|
|
4854
4857
|
const debounced = this.allDebouncedUpdateCache.get(key)?.get(id);
|
|
4855
4858
|
debounced?.canceller.next();
|
|
4856
4859
|
}
|
|
4860
|
+
/**
|
|
4861
|
+
* Immediately execute the pending update, if any.
|
|
4862
|
+
*
|
|
4863
|
+
* It should typically be called before resolving the object, to mutate it before re-fetching it from server.
|
|
4864
|
+
*
|
|
4865
|
+
* The returned observable will complete when the update completes, even if it errors.
|
|
4866
|
+
*/
|
|
4867
|
+
flushOne(key, id) {
|
|
4868
|
+
const debounced = this.allDebouncedUpdateCache.get(key)?.get(id);
|
|
4869
|
+
return this.internalFlush(debounced ? [debounced] : []);
|
|
4870
|
+
}
|
|
4857
4871
|
/**
|
|
4858
4872
|
* Immediately execute all pending updates.
|
|
4859
4873
|
*
|
|
@@ -4863,9 +4877,16 @@ class NaturalDebounceService {
|
|
|
4863
4877
|
*/
|
|
4864
4878
|
flush() {
|
|
4865
4879
|
const all = [];
|
|
4866
|
-
this.allDebouncedUpdateCache.forEach(map => map.forEach(debounced =>
|
|
4880
|
+
this.allDebouncedUpdateCache.forEach(map => map.forEach(debounced => all.push(debounced)));
|
|
4881
|
+
return this.internalFlush(all);
|
|
4882
|
+
}
|
|
4883
|
+
internalFlush(debounceds) {
|
|
4884
|
+
const all = [];
|
|
4885
|
+
const allFlusher = [];
|
|
4886
|
+
debounceds.forEach(debounced => {
|
|
4867
4887
|
all.push(debounced.result.pipe(catchError(() => of(undefined))));
|
|
4868
|
-
|
|
4888
|
+
allFlusher.push(debounced.flusher);
|
|
4889
|
+
});
|
|
4869
4890
|
if (!all.length) {
|
|
4870
4891
|
all.push(of(undefined));
|
|
4871
4892
|
}
|
|
@@ -4874,7 +4895,7 @@ class NaturalDebounceService {
|
|
|
4874
4895
|
.pipe(map$1(() => undefined))
|
|
4875
4896
|
.subscribe(subscriber);
|
|
4876
4897
|
// Flush only after subscription process is finished
|
|
4877
|
-
|
|
4898
|
+
allFlusher.forEach(flusher => flusher.next());
|
|
4878
4899
|
return subscription;
|
|
4879
4900
|
});
|
|
4880
4901
|
}
|
|
@@ -9885,7 +9906,7 @@ class NaturalRelationsComponent extends NaturalAbstractController {
|
|
|
9885
9906
|
return this.hierarchicSelectorConfig.filter(c => !!c.selectableAtKey)[0].selectableAtKey;
|
|
9886
9907
|
}
|
|
9887
9908
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: NaturalRelationsComponent, deps: [{ token: NaturalLinkMutationService }, { token: NaturalHierarchicSelectorDialogService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9888
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.2", type: NaturalRelationsComponent, isStandalone: true, selector: "natural-relations", inputs: { service: "service", placeholder: "placeholder", autocompleteSelectorFilter: "autocompleteSelectorFilter", displayWith: "displayWith", disabled: "disabled", main: "main", hierarchicSelectorFilters: "hierarchicSelectorFilters", hierarchicSelectorConfig: "hierarchicSelectorConfig", otherName: "otherName", filter: "filter" }, outputs: { selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "select", first: true, predicate: NaturalSelectComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n @if (dataSource) {\n <table [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n />\n </td>\n </ng-container>\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n @if (!disabled) {\n <button\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <mat-icon naturalIcon=\"link_off\" />\n </button>\n }\n </td>\n </ng-container>\n </table>\n }\n\n @if (dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)) {\n <mat-paginator\n (page)=\"pagination($event)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n />\n }\n\n @if (!loading && dataSource?.data?.length === 0) {\n <div class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n }\n\n @if (loading) {\n <mat-progress-spinner [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\" />\n }\n</div>\n\n@if (!hierarchicSelectorConfig && service && !disabled) {\n <natural-select\n (selectionChange)=\"addRelations([$event])\"\n [displayWith]=\"$any(getDisplayFn())\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n />\n}\n\n@if (hierarchicSelectorConfig && !disabled) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i4$3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i4$3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4$3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i4$3.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i4$3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4$3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i4$3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4$3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i4$3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i4$3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i7$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NaturalIconDirective, selector: "mat-icon[naturalIcon]", inputs: ["naturalIcon", "size"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i8$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "searchOperator", "filter", "disabled"] }] }); }
|
|
9909
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.2.2", type: NaturalRelationsComponent, isStandalone: true, selector: "natural-relations", inputs: { service: "service", placeholder: "placeholder", autocompleteSelectorFilter: "autocompleteSelectorFilter", displayWith: "displayWith", disabled: "disabled", main: "main", hierarchicSelectorFilters: "hierarchicSelectorFilters", hierarchicSelectorConfig: "hierarchicSelectorConfig", otherName: "otherName", filter: "filter" }, outputs: { selectionChange: "selectionChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "select", first: true, predicate: NaturalSelectComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n @if (dataSource) {\n <table [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n />\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n @if (!disabled) {\n <button\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <mat-icon naturalIcon=\"link_off\" />\n </button>\n }\n </td>\n </ng-container>\n </table>\n }\n\n @if (dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)) {\n <mat-paginator\n (page)=\"pagination($event)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n />\n }\n\n @if (!loading && dataSource?.data?.length === 0) {\n <div class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n }\n\n @if (loading) {\n <mat-progress-spinner [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\" />\n }\n</div>\n\n@if (!hierarchicSelectorConfig && service && !disabled) {\n <natural-select\n (selectionChange)=\"addRelations([$event])\"\n [displayWith]=\"$any(getDisplayFn())\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n />\n}\n\n@if (hierarchicSelectorConfig && !disabled) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i4$3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i4$3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4$3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i4$3.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i4$3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4$3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i4$3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4$3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i4$3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i4$3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i7$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NaturalIconDirective, selector: "mat-icon[naturalIcon]", inputs: ["naturalIcon", "size"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i8$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: NaturalSelectComponent, selector: "natural-select", inputs: ["service", "optionRequired", "searchField", "searchOperator", "filter", "disabled"] }] }); }
|
|
9889
9910
|
}
|
|
9890
9911
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: NaturalRelationsComponent, decorators: [{
|
|
9891
9912
|
type: Component,
|
|
@@ -9899,7 +9920,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImpor
|
|
|
9899
9920
|
MatPaginatorModule,
|
|
9900
9921
|
MatProgressSpinnerModule,
|
|
9901
9922
|
NaturalSelectComponent,
|
|
9902
|
-
], template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n @if (dataSource) {\n <table [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n />\n </td>\n </ng-container>\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n @if (!disabled) {\n <button\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <mat-icon naturalIcon=\"link_off\" />\n </button>\n }\n </td>\n </ng-container>\n </table>\n }\n\n @if (dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)) {\n <mat-paginator\n (page)=\"pagination($event)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n />\n }\n\n @if (!loading && dataSource?.data?.length === 0) {\n <div class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n }\n\n @if (loading) {\n <mat-progress-spinner [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\" />\n }\n</div>\n\n@if (!hierarchicSelectorConfig && service && !disabled) {\n <natural-select\n (selectionChange)=\"addRelations([$event])\"\n [displayWith]=\"$any(getDisplayFn())\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n />\n}\n\n@if (hierarchicSelectorConfig && !disabled) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"] }]
|
|
9923
|
+
], template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\n @if (dataSource) {\n <table [dataSource]=\"dataSource\" class=\"natural-row-click\" mat-table>\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row style=\"display: none\"></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns\" mat-row></tr>\n\n <ng-container matColumnDef=\"name\">\n <th *matHeaderCellDef i18n mat-header-cell>Titre</th>\n <td *matCellDef=\"let item\" mat-cell>\n <ng-template\n [ngTemplateOutletContext]=\"{item: item}\"\n [ngTemplateOutlet]=\"itemTemplate ? itemTemplate : defaultNameCell\"\n />\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"unlink\">\n <th *matHeaderCellDef mat-header-cell></th>\n <td *matCellDef=\"let element\" mat-cell>\n @if (!disabled) {\n <button\n (click)=\"removeRelation(element)\"\n [disabled]=\"removing.has(element)\"\n color=\"warn\"\n mat-icon-button\n i18n-matTooltip\n matTooltip=\"Dissocier\"\n >\n <mat-icon naturalIcon=\"link_off\" />\n </button>\n }\n </td>\n </ng-container>\n </table>\n }\n\n @if (dataSource?.data && (dataSource?.data?.length || 0) > (dataSource?.data?.pageSize || 0)) {\n <mat-paginator\n (page)=\"pagination($event)\"\n [length]=\"dataSource?.data?.length || 0\"\n [pageIndex]=\"dataSource?.data?.pageIndex || 0\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageSize]=\"dataSource?.data?.pageSize || 0\"\n />\n }\n\n @if (!loading && dataSource?.data?.length === 0) {\n <div class=\"margin-v mat-body\">\n <span i18n>Aucun r\u00E9sultat</span>\n </div>\n }\n\n @if (loading) {\n <mat-progress-spinner [diameter]=\"40\" class=\"loading\" mode=\"indeterminate\" />\n }\n</div>\n\n@if (!hierarchicSelectorConfig && service && !disabled) {\n <natural-select\n (selectionChange)=\"addRelations([$event])\"\n [displayWith]=\"$any(getDisplayFn())\"\n [filter]=\"autocompleteSelectorFilter\"\n [placeholder]=\"placeholder\"\n [service]=\"service\"\n [showIcon]=\"false\"\n />\n}\n\n@if (hierarchicSelectorConfig && !disabled) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:column}:host>*:not(:last-child){margin-bottom:20px}:host .body{display:flex;flex-direction:column}:host .loading{margin:20px auto}:host .mat-column-unlink{width:2.5em}\n"] }]
|
|
9903
9924
|
}], ctorParameters: () => [{ type: NaturalLinkMutationService }, { type: NaturalHierarchicSelectorDialogService }], propDecorators: { select: [{
|
|
9904
9925
|
type: ViewChild,
|
|
9905
9926
|
args: [NaturalSelectComponent]
|