@ecodev/natural 58.0.3 → 58.0.5
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/classes/abstract-detail.mjs +12 -20
- package/esm2022/lib/classes/cumulative-changes.mjs +15 -13
- package/esm2022/lib/modules/common/directives/linkable-tab.directive.mjs +5 -6
- package/esm2022/lib/modules/detail-header/detail-header.component.mjs +3 -3
- package/esm2022/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.mjs +3 -3
- package/esm2022/lib/modules/relations/relations.component.mjs +6 -7
- package/esm2022/lib/modules/sidenav/sidenav.service.mjs +9 -10
- package/esm2022/lib/services/abstract-model.service.mjs +9 -10
- package/fesm2022/ecodev-natural.mjs +54 -64
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/lib/classes/abstract-detail.d.ts +8 -0
- package/lib/classes/cumulative-changes.d.ts +2 -1
- package/lib/modules/common/directives/linkable-tab.directive.d.ts +1 -1
- package/lib/modules/relations/relations.component.d.ts +1 -1
- package/lib/modules/sidenav/sidenav.service.d.ts +1 -1
- package/lib/services/abstract-model.service.d.ts +5 -4
- package/package.json +1 -1
|
@@ -2302,14 +2302,16 @@ function money(control) {
|
|
|
2302
2302
|
* Cumulate all changes made to an object over time
|
|
2303
2303
|
*/
|
|
2304
2304
|
class CumulativeChanges {
|
|
2305
|
-
|
|
2306
|
-
|
|
2305
|
+
constructor() {
|
|
2306
|
+
this.original = {};
|
|
2307
|
+
this.diff = {};
|
|
2308
|
+
}
|
|
2307
2309
|
/**
|
|
2308
2310
|
* Initialize the original values, should be called exactly one time per instance
|
|
2309
2311
|
*/
|
|
2310
2312
|
initialize(originalValues) {
|
|
2311
|
-
this
|
|
2312
|
-
this
|
|
2313
|
+
this.original = cloneDeep(originalValues);
|
|
2314
|
+
this.diff = {};
|
|
2313
2315
|
}
|
|
2314
2316
|
/**
|
|
2315
2317
|
* Returns a literal that contains only the keys whose values have been changed by this call or any previous calls.
|
|
@@ -2323,25 +2325,25 @@ class CumulativeChanges {
|
|
|
2323
2325
|
*/
|
|
2324
2326
|
differences(newValues) {
|
|
2325
2327
|
Object.keys(newValues).forEach(key => {
|
|
2326
|
-
if (key in this
|
|
2328
|
+
if (key in this.diff ||
|
|
2327
2329
|
(newValues[key] !== undefined &&
|
|
2328
|
-
(!(key in this
|
|
2329
|
-
this
|
|
2330
|
+
(!(key in this.original) || !isEqual(this.original[key], newValues[key])))) {
|
|
2331
|
+
this.diff[key] = newValues[key];
|
|
2330
2332
|
}
|
|
2331
2333
|
});
|
|
2332
|
-
return Object.keys(this
|
|
2334
|
+
return Object.keys(this.diff).length ? this.diff : null;
|
|
2333
2335
|
}
|
|
2334
2336
|
/**
|
|
2335
2337
|
* Commit the given new values, so they are not treated as differences anymore.
|
|
2336
2338
|
*/
|
|
2337
2339
|
commit(newValues) {
|
|
2338
|
-
this
|
|
2339
|
-
...this
|
|
2340
|
+
this.original = {
|
|
2341
|
+
...this.original,
|
|
2340
2342
|
...cloneDeep(newValues),
|
|
2341
2343
|
};
|
|
2342
2344
|
Object.keys(newValues).forEach(key => {
|
|
2343
|
-
if (key in this
|
|
2344
|
-
delete this
|
|
2345
|
+
if (key in this.diff && isEqual(this.diff[key], newValues[key])) {
|
|
2346
|
+
delete this.diff[key];
|
|
2345
2347
|
}
|
|
2346
2348
|
});
|
|
2347
2349
|
}
|
|
@@ -2355,14 +2357,6 @@ function isNaturalDialogTriggerProvidedData(dialogData) {
|
|
|
2355
2357
|
}
|
|
2356
2358
|
// @dynamic
|
|
2357
2359
|
class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
2358
|
-
#dialogData;
|
|
2359
|
-
/**
|
|
2360
|
-
* Once set, this must not change anymore, especially not right after the creation mutation,
|
|
2361
|
-
* so the form does not switch from creation mode to update mode without an actual reload of
|
|
2362
|
-
* model from DB (by navigating to update page).
|
|
2363
|
-
*/
|
|
2364
|
-
#isUpdatePage;
|
|
2365
|
-
#changes;
|
|
2366
2360
|
constructor(key, service) {
|
|
2367
2361
|
super();
|
|
2368
2362
|
this.key = key;
|
|
@@ -2401,14 +2395,14 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
|
2401
2395
|
* Injected service
|
|
2402
2396
|
*/
|
|
2403
2397
|
this.route = inject(ActivatedRoute);
|
|
2404
|
-
this
|
|
2398
|
+
this._dialogData = inject(MAT_DIALOG_DATA, { optional: true });
|
|
2405
2399
|
/**
|
|
2406
2400
|
* Once set, this must not change anymore, especially not right after the creation mutation,
|
|
2407
2401
|
* so the form does not switch from creation mode to update mode without an actual reload of
|
|
2408
2402
|
* model from DB (by navigating to update page).
|
|
2409
2403
|
*/
|
|
2410
|
-
this
|
|
2411
|
-
this
|
|
2404
|
+
this._isUpdatePage = false;
|
|
2405
|
+
this.changes = new CumulativeChanges();
|
|
2412
2406
|
}
|
|
2413
2407
|
/**
|
|
2414
2408
|
* You probably should not override this method. Instead, consider overriding `initForm()`.
|
|
@@ -2418,8 +2412,8 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
|
2418
2412
|
this.initForm();
|
|
2419
2413
|
}
|
|
2420
2414
|
else {
|
|
2421
|
-
const route = isNaturalDialogTriggerProvidedData(this
|
|
2422
|
-
? this
|
|
2415
|
+
const route = isNaturalDialogTriggerProvidedData(this._dialogData)
|
|
2416
|
+
? this._dialogData.activatedRoute
|
|
2423
2417
|
: this.route;
|
|
2424
2418
|
this.#subscribeToModelFromResolvedData(route);
|
|
2425
2419
|
}
|
|
@@ -2455,7 +2449,7 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
|
2455
2449
|
* This should be used instead of checking `data.model.id` directly, in order to type guard and get proper typing
|
|
2456
2450
|
*/
|
|
2457
2451
|
isUpdatePage() {
|
|
2458
|
-
return this
|
|
2452
|
+
return this._isUpdatePage;
|
|
2459
2453
|
}
|
|
2460
2454
|
/**
|
|
2461
2455
|
* Update the object on the server with the values from the form fields that were modified since
|
|
@@ -2471,15 +2465,15 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
|
2471
2465
|
ifValid(this.form).subscribe(() => {
|
|
2472
2466
|
const newValues = this.form.getRawValue();
|
|
2473
2467
|
if (submitAllFields) {
|
|
2474
|
-
this
|
|
2468
|
+
this.changes.initialize({});
|
|
2475
2469
|
}
|
|
2476
2470
|
const toSubmit = {
|
|
2477
2471
|
id: this.data.model.id,
|
|
2478
|
-
...this
|
|
2472
|
+
...this.changes.differences(newValues),
|
|
2479
2473
|
};
|
|
2480
2474
|
const update = now ? this.service.updateNow(toSubmit) : this.service.update(toSubmit);
|
|
2481
2475
|
update.subscribe(model => {
|
|
2482
|
-
this
|
|
2476
|
+
this.changes.commit(newValues);
|
|
2483
2477
|
this.alertService.info($localize `Mis à jour`);
|
|
2484
2478
|
this.postUpdate(model);
|
|
2485
2479
|
});
|
|
@@ -2565,9 +2559,9 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
|
|
|
2565
2559
|
* will incorrectly be called exactly 1 time per component instance, even if the object changes via route navigation.
|
|
2566
2560
|
*/
|
|
2567
2561
|
initForm() {
|
|
2568
|
-
this
|
|
2562
|
+
this._isUpdatePage = !!this.data.model.id;
|
|
2569
2563
|
this.form = this.service.getFormGroup(this.data.model);
|
|
2570
|
-
this
|
|
2564
|
+
this.changes.initialize(this.form.getRawValue());
|
|
2571
2565
|
}
|
|
2572
2566
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalAbstractDetail, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2573
2567
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.5", type: NaturalAbstractDetail, usesInheritance: true, ngImport: i0 }); }
|
|
@@ -4538,7 +4532,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
|
|
|
4538
4532
|
}] });
|
|
4539
4533
|
|
|
4540
4534
|
class NaturalAbstractModelService {
|
|
4541
|
-
#plural;
|
|
4542
4535
|
/**
|
|
4543
4536
|
*
|
|
4544
4537
|
* @param name service and single object query name (eg. userForFront or user).
|
|
@@ -4568,7 +4561,7 @@ class NaturalAbstractModelService {
|
|
|
4568
4561
|
this.creatingCache = new Map();
|
|
4569
4562
|
this.apollo = inject(Apollo);
|
|
4570
4563
|
this.naturalDebounceService = inject(NaturalDebounceService);
|
|
4571
|
-
this
|
|
4564
|
+
this.plural = plural ?? makePlural(this.name);
|
|
4572
4565
|
}
|
|
4573
4566
|
/**
|
|
4574
4567
|
* List of individual fields validators
|
|
@@ -4664,7 +4657,7 @@ class NaturalAbstractModelService {
|
|
|
4664
4657
|
* You must subscribe to start getting results (and fetch from network).
|
|
4665
4658
|
*/
|
|
4666
4659
|
getOne(id) {
|
|
4667
|
-
return this
|
|
4660
|
+
return this.prepareOneQuery(id, 'cache-and-network').pipe(takeWhile(result => result.networkStatus !== NetworkStatus.ready, true), map(result => result.data[this.name]));
|
|
4668
4661
|
}
|
|
4669
4662
|
/**
|
|
4670
4663
|
* Watch a single object
|
|
@@ -4677,9 +4670,9 @@ class NaturalAbstractModelService {
|
|
|
4677
4670
|
* You **MUST** unsubscribe.
|
|
4678
4671
|
*/
|
|
4679
4672
|
watchOne(id, fetchPolicy = 'cache-and-network') {
|
|
4680
|
-
return this
|
|
4673
|
+
return this.prepareOneQuery(id, fetchPolicy).pipe(map(result => result.data[this.name]));
|
|
4681
4674
|
}
|
|
4682
|
-
|
|
4675
|
+
prepareOneQuery(id, fetchPolicy) {
|
|
4683
4676
|
this.throwIfObservable(id);
|
|
4684
4677
|
this.throwIfNotQuery(this.oneQuery);
|
|
4685
4678
|
return this.getVariablesForOne(id).pipe(switchMap(variables => {
|
|
@@ -4906,11 +4899,11 @@ class NaturalAbstractModelService {
|
|
|
4906
4899
|
* This is used for the unique validator
|
|
4907
4900
|
*/
|
|
4908
4901
|
count(queryVariablesManager) {
|
|
4909
|
-
const queryName = 'Count' + upperCaseFirstLetter(this
|
|
4902
|
+
const queryName = 'Count' + upperCaseFirstLetter(this.plural);
|
|
4910
4903
|
const filterType = upperCaseFirstLetter(this.name) + 'Filter';
|
|
4911
4904
|
const query = gql `
|
|
4912
4905
|
query ${queryName} ($filter: ${filterType}) {
|
|
4913
|
-
count: ${this
|
|
4906
|
+
count: ${this.plural} (filter: $filter, pagination: {pageSize: 0, pageIndex: 0}) {
|
|
4914
4907
|
length
|
|
4915
4908
|
}
|
|
4916
4909
|
}`;
|
|
@@ -4953,7 +4946,7 @@ class NaturalAbstractModelService {
|
|
|
4953
4946
|
* This is used to extract only the array of fetched objects out of the entire fetched data
|
|
4954
4947
|
*/
|
|
4955
4948
|
mapAll() {
|
|
4956
|
-
return map(result => result.data[this
|
|
4949
|
+
return map(result => result.data[this.plural]); // See https://github.com/apollographql/apollo-client/issues/5662
|
|
4957
4950
|
}
|
|
4958
4951
|
/**
|
|
4959
4952
|
* This is used to extract only the created object out of the entire fetched data
|
|
@@ -4973,7 +4966,7 @@ class NaturalAbstractModelService {
|
|
|
4973
4966
|
* This is used to extract only flag when deleting an object
|
|
4974
4967
|
*/
|
|
4975
4968
|
mapDelete(result) {
|
|
4976
|
-
const name = this.deleteName ?? 'delete' + upperCaseFirstLetter(this
|
|
4969
|
+
const name = this.deleteName ?? 'delete' + upperCaseFirstLetter(this.plural);
|
|
4977
4970
|
return result.data[name]; // See https://github.com/apollographql/apollo-client/issues/5662
|
|
4978
4971
|
}
|
|
4979
4972
|
/**
|
|
@@ -5550,7 +5543,6 @@ function getTabId(tab) {
|
|
|
5550
5543
|
* </mat-tab-group>
|
|
5551
5544
|
*/
|
|
5552
5545
|
class NaturalLinkableTabDirective extends NaturalAbstractController {
|
|
5553
|
-
#isLoadingRouteConfig;
|
|
5554
5546
|
constructor(component, route, router) {
|
|
5555
5547
|
super();
|
|
5556
5548
|
this.component = component;
|
|
@@ -5560,13 +5552,13 @@ class NaturalLinkableTabDirective extends NaturalAbstractController {
|
|
|
5560
5552
|
* If false, disables the persistent navigation
|
|
5561
5553
|
*/
|
|
5562
5554
|
this.naturalLinkableTab = true;
|
|
5563
|
-
this
|
|
5555
|
+
this.isLoadingRouteConfig = false;
|
|
5564
5556
|
router.events.pipe(takeUntilDestroyed()).subscribe(event => {
|
|
5565
5557
|
if (event instanceof RouteConfigLoadStart) {
|
|
5566
|
-
this
|
|
5558
|
+
this.isLoadingRouteConfig = true;
|
|
5567
5559
|
}
|
|
5568
5560
|
else if (event instanceof RouteConfigLoadEnd) {
|
|
5569
|
-
this
|
|
5561
|
+
this.isLoadingRouteConfig = false;
|
|
5570
5562
|
}
|
|
5571
5563
|
});
|
|
5572
5564
|
}
|
|
@@ -5586,7 +5578,7 @@ class NaturalLinkableTabDirective extends NaturalAbstractController {
|
|
|
5586
5578
|
});
|
|
5587
5579
|
// When mat-tab-groups selected tab change, update url
|
|
5588
5580
|
this.component.selectedTabChange.pipe(takeUntil$1(this.ngUnsubscribe)).subscribe(event => {
|
|
5589
|
-
if (this
|
|
5581
|
+
if (this.isLoadingRouteConfig) {
|
|
5590
5582
|
return;
|
|
5591
5583
|
}
|
|
5592
5584
|
const activatedTabName = getTabId(event.tab);
|
|
@@ -6262,11 +6254,11 @@ class NaturalDetailHeaderComponent {
|
|
|
6262
6254
|
return this.getRootLink().concat([id]);
|
|
6263
6255
|
}
|
|
6264
6256
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalDetailHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6265
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: NaturalDetailHeaderComponent, isStandalone: true, selector: "natural-detail-header", inputs: { currentBaseUrl: "currentBaseUrl", isPanel: "isPanel", icon: "icon", label: "label", rootLabel: "rootLabel", newLabel: "newLabel", model: "model", breadcrumbs: "breadcrumbs", listRoute: "listRoute", listFragment: "listFragment", link: "link" }, ngImport: i0, template: "<div class=\"breadcrumb\">\n @if (rootLabel || label) {\n <a [routerLink]=\"isPanel ? [] : getRootLink()\" [fragment]=\"listFragment\" color=\"primary\" mat-button>{{\n rootLabel || label\n }}</a>\n }\n @for (parent of breadcrumbs; track parent) {\n /\n <a [routerLink]=\"isPanel ? [] : getLink(parent.id)\" color=\"primary\" mat-button>\n {{ parent?.fullName || parent?.name }}</a\n >\n }\n</div>\n\n<div class=\"body\">\n @if (icon) {\n <div style=\"width: 30px\">\n <mat-icon [naturalIcon]=\"icon\" />\n </div>\n }\n @if (!model.id) {\n <div class=\"mat-headline-5 no-margin newLabel\">{{ newLabel }}</div>\n }\n @if (model.id) {\n <div class=\"mat-headline-5 no-margin label\">{{ model.name || model.fullName || label }}</div>\n }\n <div>\n <ng-content />\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host .breadcrumb,:host .body{display:flex;flex-direction:row;align-items:center}:host .breadcrumb{position:relative;top:5px}:host .body{min-height:40px}:host .body>*:not(:last-child){margin-right:5px}:host .body .label,:host .body .newLabel{flex:1}@media screen and (max-width: 600px){:host .body{flex-direction:column;align-items:flex-start}:host .body>*:not(:last-child){margin-bottom:10px!important}:host .body mat-icon{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { 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"] }] }); }
|
|
6257
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: NaturalDetailHeaderComponent, isStandalone: true, selector: "natural-detail-header", inputs: { currentBaseUrl: "currentBaseUrl", isPanel: "isPanel", icon: "icon", label: "label", rootLabel: "rootLabel", newLabel: "newLabel", model: "model", breadcrumbs: "breadcrumbs", listRoute: "listRoute", listFragment: "listFragment", link: "link" }, ngImport: i0, template: "<div class=\"breadcrumb\">\n @if (rootLabel || label) {\n <a [routerLink]=\"isPanel ? [] : getRootLink()\" [fragment]=\"listFragment\" color=\"primary\" mat-button>{{\n rootLabel || label\n }}</a>\n }\n @for (parent of breadcrumbs; track parent) {\n /\n <a [routerLink]=\"isPanel ? [] : getLink(parent.id)\" color=\"primary\" mat-button>\n {{ parent?.fullName || parent?.name }}</a\n >\n }\n</div>\n\n<div class=\"body\">\n @if (icon) {\n <div style=\"width: 30px\">\n <mat-icon [naturalIcon]=\"icon\" />\n </div>\n }\n @if (!model.id) {\n <div class=\"mat-headline-5 nat-no-margin newLabel\">{{ newLabel }}</div>\n }\n @if (model.id) {\n <div class=\"mat-headline-5 nat-no-margin label\">{{ model.name || model.fullName || label }}</div>\n }\n <div>\n <ng-content />\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host .breadcrumb,:host .body{display:flex;flex-direction:row;align-items:center}:host .breadcrumb{position:relative;top:5px}:host .body{min-height:40px}:host .body>*:not(:last-child){margin-right:5px}:host .body .label,:host .body .newLabel{flex:1}@media screen and (max-width: 600px){:host .body{flex-direction:column;align-items:flex-start}:host .body>*:not(:last-child){margin-bottom:10px!important}:host .body mat-icon{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { 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"] }] }); }
|
|
6266
6258
|
}
|
|
6267
6259
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalDetailHeaderComponent, decorators: [{
|
|
6268
6260
|
type: Component,
|
|
6269
|
-
args: [{ selector: 'natural-detail-header', standalone: true, imports: [MatButtonModule, RouterLink, MatIconModule, NaturalIconDirective], template: "<div class=\"breadcrumb\">\n @if (rootLabel || label) {\n <a [routerLink]=\"isPanel ? [] : getRootLink()\" [fragment]=\"listFragment\" color=\"primary\" mat-button>{{\n rootLabel || label\n }}</a>\n }\n @for (parent of breadcrumbs; track parent) {\n /\n <a [routerLink]=\"isPanel ? [] : getLink(parent.id)\" color=\"primary\" mat-button>\n {{ parent?.fullName || parent?.name }}</a\n >\n }\n</div>\n\n<div class=\"body\">\n @if (icon) {\n <div style=\"width: 30px\">\n <mat-icon [naturalIcon]=\"icon\" />\n </div>\n }\n @if (!model.id) {\n <div class=\"mat-headline-5 no-margin newLabel\">{{ newLabel }}</div>\n }\n @if (model.id) {\n <div class=\"mat-headline-5 no-margin label\">{{ model.name || model.fullName || label }}</div>\n }\n <div>\n <ng-content />\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host .breadcrumb,:host .body{display:flex;flex-direction:row;align-items:center}:host .breadcrumb{position:relative;top:5px}:host .body{min-height:40px}:host .body>*:not(:last-child){margin-right:5px}:host .body .label,:host .body .newLabel{flex:1}@media screen and (max-width: 600px){:host .body{flex-direction:column;align-items:flex-start}:host .body>*:not(:last-child){margin-bottom:10px!important}:host .body mat-icon{display:none}}\n"] }]
|
|
6261
|
+
args: [{ selector: 'natural-detail-header', standalone: true, imports: [MatButtonModule, RouterLink, MatIconModule, NaturalIconDirective], template: "<div class=\"breadcrumb\">\n @if (rootLabel || label) {\n <a [routerLink]=\"isPanel ? [] : getRootLink()\" [fragment]=\"listFragment\" color=\"primary\" mat-button>{{\n rootLabel || label\n }}</a>\n }\n @for (parent of breadcrumbs; track parent) {\n /\n <a [routerLink]=\"isPanel ? [] : getLink(parent.id)\" color=\"primary\" mat-button>\n {{ parent?.fullName || parent?.name }}</a\n >\n }\n</div>\n\n<div class=\"body\">\n @if (icon) {\n <div style=\"width: 30px\">\n <mat-icon [naturalIcon]=\"icon\" />\n </div>\n }\n @if (!model.id) {\n <div class=\"mat-headline-5 nat-no-margin newLabel\">{{ newLabel }}</div>\n }\n @if (model.id) {\n <div class=\"mat-headline-5 nat-no-margin label\">{{ model.name || model.fullName || label }}</div>\n }\n <div>\n <ng-content />\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column}:host .breadcrumb,:host .body{display:flex;flex-direction:row;align-items:center}:host .breadcrumb{position:relative;top:5px}:host .body{min-height:40px}:host .body>*:not(:last-child){margin-right:5px}:host .body .label,:host .body .newLabel{flex:1}@media screen and (max-width: 600px){:host .body{flex-direction:column;align-items:flex-start}:host .body>*:not(:last-child){margin-bottom:10px!important}:host .body mat-icon{display:none}}\n"] }]
|
|
6270
6262
|
}], propDecorators: { currentBaseUrl: [{
|
|
6271
6263
|
type: Input
|
|
6272
6264
|
}], isPanel: [{
|
|
@@ -8292,7 +8284,7 @@ class NaturalHierarchicSelectorComponent extends NaturalAbstractController {
|
|
|
8292
8284
|
return model.__typename + '-' + model.id;
|
|
8293
8285
|
}
|
|
8294
8286
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalHierarchicSelectorComponent, deps: [{ token: NaturalHierarchicSelectorService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8295
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: NaturalHierarchicSelectorComponent, isStandalone: true, selector: "natural-hierarchic-selector", inputs: { displayWith: "displayWith", config: "config", multiple: "multiple", selected: "selected", allowUnselect: "allowUnselect", filters: "filters", searchFacets: "searchFacets", searchSelections: "searchSelections" }, outputs: { searchSelectionChange: "searchSelectionChange", selectionChange: "selectionChange" }, providers: [NaturalHierarchicSelectorService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div [style.margin-bottom.px]=\"20\">\n <natural-search (selectionChange)=\"search($event)\" [facets]=\"searchFacets\" [selections]=\"searchSelections\" />\n</div>\n\n<div class=\"body\">\n @if (loading) {\n <mat-progress-spinner [diameter]=\"36\" mode=\"indeterminate\" style=\"margin: 10px\" />\n }\n\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" [ngClass]=\"{leaf: !node.expandable}\" matTreeNodePadding>\n @if (node.expandable) {\n <button\n (click)=\"loadChildren(node)\"\n [attr.aria-label]=\"'toggle ' + node.name\"\n mat-icon-button\n matTreeNodeToggle\n >\n @if (node.loading) {\n <mat-progress-spinner [diameter]=\"24\" [strokeWidth]=\"5\" mode=\"indeterminate\" />\n }\n @if (!node.loading) {\n <mat-icon [naturalIcon]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\" />\n }\n </button>\n }\n\n <mat-checkbox\n (change)=\"toggleFlatNode(node)\"\n [checked]=\"flatNodesSelection.isSelected(node)\"\n [disabled]=\"!isNodeTogglable(node)\"\n style=\"margin-right: 10px\"\n >\n @if (node.node.config.icon) {\n <mat-icon [naturalIcon]=\"node.node.config.icon\" style=\"margin-right: 10px\" />\n }\n <span>{{ node.name }}</span>\n </mat-checkbox>\n </mat-tree-node>\n </mat-tree>\n\n <mat-chip-listbox aria-orientation=\"vertical\" class=\"mat-mdc-chip-set-stacked\">\n @for (node of selectedNodes; track node) {\n <mat-chip-option (removed)=\"unselectModelNode(node)\" [removable]=\"true\" [selectable]=\"false\">\n @if (node.config.icon) {\n <mat-icon [naturalIcon]=\"node.config.icon\" />\n }\n <div class=\"mat-body chip-label\">{{ node.model.name || node.model.fullName }}</div>\n <button matChipRemove>\n <mat-icon naturalIcon=\"cancel\" />\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n</div>\n\n@if (!loading && !dataSource.data.length) {\n <div
|
|
8287
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: NaturalHierarchicSelectorComponent, isStandalone: true, selector: "natural-hierarchic-selector", inputs: { displayWith: "displayWith", config: "config", multiple: "multiple", selected: "selected", allowUnselect: "allowUnselect", filters: "filters", searchFacets: "searchFacets", searchSelections: "searchSelections" }, outputs: { searchSelectionChange: "searchSelectionChange", selectionChange: "selectionChange" }, providers: [NaturalHierarchicSelectorService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div [style.margin-bottom.px]=\"20\">\n <natural-search (selectionChange)=\"search($event)\" [facets]=\"searchFacets\" [selections]=\"searchSelections\" />\n</div>\n\n<div class=\"body\">\n @if (loading) {\n <mat-progress-spinner [diameter]=\"36\" mode=\"indeterminate\" style=\"margin: 10px\" />\n }\n\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" [ngClass]=\"{leaf: !node.expandable}\" matTreeNodePadding>\n @if (node.expandable) {\n <button\n (click)=\"loadChildren(node)\"\n [attr.aria-label]=\"'toggle ' + node.name\"\n mat-icon-button\n matTreeNodeToggle\n >\n @if (node.loading) {\n <mat-progress-spinner [diameter]=\"24\" [strokeWidth]=\"5\" mode=\"indeterminate\" />\n }\n @if (!node.loading) {\n <mat-icon [naturalIcon]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\" />\n }\n </button>\n }\n\n <mat-checkbox\n (change)=\"toggleFlatNode(node)\"\n [checked]=\"flatNodesSelection.isSelected(node)\"\n [disabled]=\"!isNodeTogglable(node)\"\n style=\"margin-right: 10px\"\n >\n @if (node.node.config.icon) {\n <mat-icon [naturalIcon]=\"node.node.config.icon\" style=\"margin-right: 10px\" />\n }\n <span>{{ node.name }}</span>\n </mat-checkbox>\n </mat-tree-node>\n </mat-tree>\n\n <mat-chip-listbox aria-orientation=\"vertical\" class=\"mat-mdc-chip-set-stacked\">\n @for (node of selectedNodes; track node) {\n <mat-chip-option (removed)=\"unselectModelNode(node)\" [removable]=\"true\" [selectable]=\"false\">\n @if (node.config.icon) {\n <mat-icon [naturalIcon]=\"node.config.icon\" />\n }\n <div class=\"mat-body chip-label\">{{ node.model.name || node.model.fullName }}</div>\n <button matChipRemove>\n <mat-icon naturalIcon=\"cancel\" />\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n</div>\n\n@if (!loading && !dataSource.data.length) {\n <div i18n>Aucun r\u00E9sultat</div>\n}\n", styles: [":host{display:block}:host ul,:host li{-webkit-margin-before:0;-webkit-margin-after:0;list-style-type:none}:host mat-icon{width:18px;height:18px;font-size:18px}:host .mat-tree-node.leaf{margin-left:48px}:host .body{display:flex;flex-direction:row;justify-content:space-between}:host .body mat-tree{flex:66}:host .body mat-chip-listbox{flex:33}:host mat-tree{flex-shrink:0}:host mat-chip-listbox{margin-left:10px}\n"], dependencies: [{ kind: "component", type: NaturalSearchComponent, selector: "natural-search", inputs: ["placeholder", "facets", "multipleGroups", "dropdownTitle", "selections"], outputs: ["selectionChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i4$2.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "directive", type: i4$2.MatTreeNodePadding, selector: "[matTreeNodePadding]", inputs: ["matTreeNodePadding", "matTreeNodePaddingIndent"] }, { kind: "directive", type: i4$2.MatTreeNodeToggle, selector: "[matTreeNodeToggle]", inputs: ["matTreeNodeToggleRecursive"] }, { kind: "component", type: i4$2.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i4$2.MatTreeNode, selector: "mat-tree-node", inputs: ["disabled", "tabIndex"], exportAs: ["matTreeNode"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { 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: MatCheckboxModule }, { kind: "component", type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i8$1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i8$1.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i8$1.MatChipRemove, selector: "[matChipRemove]" }] }); }
|
|
8296
8288
|
}
|
|
8297
8289
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalHierarchicSelectorComponent, decorators: [{
|
|
8298
8290
|
type: Component,
|
|
@@ -8306,7 +8298,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
|
|
|
8306
8298
|
NaturalIconDirective,
|
|
8307
8299
|
MatCheckboxModule,
|
|
8308
8300
|
MatChipsModule,
|
|
8309
|
-
], template: "<div [style.margin-bottom.px]=\"20\">\n <natural-search (selectionChange)=\"search($event)\" [facets]=\"searchFacets\" [selections]=\"searchSelections\" />\n</div>\n\n<div class=\"body\">\n @if (loading) {\n <mat-progress-spinner [diameter]=\"36\" mode=\"indeterminate\" style=\"margin: 10px\" />\n }\n\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" [ngClass]=\"{leaf: !node.expandable}\" matTreeNodePadding>\n @if (node.expandable) {\n <button\n (click)=\"loadChildren(node)\"\n [attr.aria-label]=\"'toggle ' + node.name\"\n mat-icon-button\n matTreeNodeToggle\n >\n @if (node.loading) {\n <mat-progress-spinner [diameter]=\"24\" [strokeWidth]=\"5\" mode=\"indeterminate\" />\n }\n @if (!node.loading) {\n <mat-icon [naturalIcon]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\" />\n }\n </button>\n }\n\n <mat-checkbox\n (change)=\"toggleFlatNode(node)\"\n [checked]=\"flatNodesSelection.isSelected(node)\"\n [disabled]=\"!isNodeTogglable(node)\"\n style=\"margin-right: 10px\"\n >\n @if (node.node.config.icon) {\n <mat-icon [naturalIcon]=\"node.node.config.icon\" style=\"margin-right: 10px\" />\n }\n <span>{{ node.name }}</span>\n </mat-checkbox>\n </mat-tree-node>\n </mat-tree>\n\n <mat-chip-listbox aria-orientation=\"vertical\" class=\"mat-mdc-chip-set-stacked\">\n @for (node of selectedNodes; track node) {\n <mat-chip-option (removed)=\"unselectModelNode(node)\" [removable]=\"true\" [selectable]=\"false\">\n @if (node.config.icon) {\n <mat-icon [naturalIcon]=\"node.config.icon\" />\n }\n <div class=\"mat-body chip-label\">{{ node.model.name || node.model.fullName }}</div>\n <button matChipRemove>\n <mat-icon naturalIcon=\"cancel\" />\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n</div>\n\n@if (!loading && !dataSource.data.length) {\n <div
|
|
8301
|
+
], template: "<div [style.margin-bottom.px]=\"20\">\n <natural-search (selectionChange)=\"search($event)\" [facets]=\"searchFacets\" [selections]=\"searchSelections\" />\n</div>\n\n<div class=\"body\">\n @if (loading) {\n <mat-progress-spinner [diameter]=\"36\" mode=\"indeterminate\" style=\"margin: 10px\" />\n }\n\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\">\n <mat-tree-node *matTreeNodeDef=\"let node\" [ngClass]=\"{leaf: !node.expandable}\" matTreeNodePadding>\n @if (node.expandable) {\n <button\n (click)=\"loadChildren(node)\"\n [attr.aria-label]=\"'toggle ' + node.name\"\n mat-icon-button\n matTreeNodeToggle\n >\n @if (node.loading) {\n <mat-progress-spinner [diameter]=\"24\" [strokeWidth]=\"5\" mode=\"indeterminate\" />\n }\n @if (!node.loading) {\n <mat-icon [naturalIcon]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\" />\n }\n </button>\n }\n\n <mat-checkbox\n (change)=\"toggleFlatNode(node)\"\n [checked]=\"flatNodesSelection.isSelected(node)\"\n [disabled]=\"!isNodeTogglable(node)\"\n style=\"margin-right: 10px\"\n >\n @if (node.node.config.icon) {\n <mat-icon [naturalIcon]=\"node.node.config.icon\" style=\"margin-right: 10px\" />\n }\n <span>{{ node.name }}</span>\n </mat-checkbox>\n </mat-tree-node>\n </mat-tree>\n\n <mat-chip-listbox aria-orientation=\"vertical\" class=\"mat-mdc-chip-set-stacked\">\n @for (node of selectedNodes; track node) {\n <mat-chip-option (removed)=\"unselectModelNode(node)\" [removable]=\"true\" [selectable]=\"false\">\n @if (node.config.icon) {\n <mat-icon [naturalIcon]=\"node.config.icon\" />\n }\n <div class=\"mat-body chip-label\">{{ node.model.name || node.model.fullName }}</div>\n <button matChipRemove>\n <mat-icon naturalIcon=\"cancel\" />\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n</div>\n\n@if (!loading && !dataSource.data.length) {\n <div i18n>Aucun r\u00E9sultat</div>\n}\n", styles: [":host{display:block}:host ul,:host li{-webkit-margin-before:0;-webkit-margin-after:0;list-style-type:none}:host mat-icon{width:18px;height:18px;font-size:18px}:host .mat-tree-node.leaf{margin-left:48px}:host .body{display:flex;flex-direction:row;justify-content:space-between}:host .body mat-tree{flex:66}:host .body mat-chip-listbox{flex:33}:host mat-tree{flex-shrink:0}:host mat-chip-listbox{margin-left:10px}\n"] }]
|
|
8310
8302
|
}], ctorParameters: () => [{ type: NaturalHierarchicSelectorService }], propDecorators: { displayWith: [{
|
|
8311
8303
|
type: Input
|
|
8312
8304
|
}], config: [{
|
|
@@ -9885,14 +9877,13 @@ const fallbackIfNoOpenedPanels = (segments) => {
|
|
|
9885
9877
|
* </natural-relations>
|
|
9886
9878
|
*/
|
|
9887
9879
|
class NaturalRelationsComponent extends NaturalAbstractController {
|
|
9888
|
-
#service;
|
|
9889
9880
|
get service() {
|
|
9890
|
-
return this
|
|
9881
|
+
return this._service;
|
|
9891
9882
|
}
|
|
9892
9883
|
set service(service) {
|
|
9893
|
-
this
|
|
9884
|
+
this._service = service;
|
|
9894
9885
|
this.loading = true;
|
|
9895
|
-
const items$ = this
|
|
9886
|
+
const items$ = this._service.watchAll(this.variablesManager).pipe(takeUntil(this.ngUnsubscribe), tap({
|
|
9896
9887
|
next: () => (this.loading = false),
|
|
9897
9888
|
complete: () => (this.loading = false),
|
|
9898
9889
|
error: () => (this.loading = false),
|
|
@@ -10028,7 +10019,7 @@ class NaturalRelationsComponent extends NaturalAbstractController {
|
|
|
10028
10019
|
return this.hierarchicSelectorConfig.filter(c => !!c.selectableAtKey)[0].selectableAtKey;
|
|
10029
10020
|
}
|
|
10030
10021
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalRelationsComponent, deps: [{ token: NaturalLinkMutationService }, { token: NaturalHierarchicSelectorDialogService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10031
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", 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 <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 @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-
|
|
10022
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", 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 <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 @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=\"nat-margin-vertical 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 (!disabled) {\n @if (hierarchicSelectorConfig) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n } @else {\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", 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: ["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"] }] }); }
|
|
10032
10023
|
}
|
|
10033
10024
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: NaturalRelationsComponent, decorators: [{
|
|
10034
10025
|
type: Component,
|
|
@@ -10042,7 +10033,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
|
|
|
10042
10033
|
MatPaginatorModule,
|
|
10043
10034
|
MatProgressSpinnerModule,
|
|
10044
10035
|
NaturalSelectComponent,
|
|
10045
|
-
], template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\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 @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-
|
|
10036
|
+
], template: "<div class=\"body\">\n <ng-template #defaultNameCell let-item=\"item\">\n {{ getDisplayFn()(item) }}\n </ng-template>\n\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 @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=\"nat-margin-vertical 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 (!disabled) {\n @if (hierarchicSelectorConfig) {\n <div>\n <button (click)=\"openNaturalHierarchicSelector()\" color=\"primary\" mat-flat-button>{{ placeholder }}</button>\n </div>\n } @else {\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", 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"] }]
|
|
10046
10037
|
}], ctorParameters: () => [{ type: NaturalLinkMutationService }, { type: NaturalHierarchicSelectorDialogService }], propDecorators: { select: [{
|
|
10047
10038
|
type: ViewChild,
|
|
10048
10039
|
args: [NaturalSelectComponent]
|
|
@@ -10319,7 +10310,6 @@ function assert(value) {
|
|
|
10319
10310
|
* Maybe the better is to wait next release
|
|
10320
10311
|
*/
|
|
10321
10312
|
class NaturalSidenavService extends NaturalAbstractController {
|
|
10322
|
-
#isMobileView;
|
|
10323
10313
|
constructor(breakpointObserver, router, sessionStorage, naturalSidenavStackService) {
|
|
10324
10314
|
super();
|
|
10325
10315
|
this.breakpointObserver = breakpointObserver;
|
|
@@ -10359,7 +10349,7 @@ class NaturalSidenavService extends NaturalAbstractController {
|
|
|
10359
10349
|
this.openedStorageKey = 'menu-opened';
|
|
10360
10350
|
this.minimizedStorageKeyWithName = null;
|
|
10361
10351
|
this.openedStorageKeyWithName = null;
|
|
10362
|
-
this
|
|
10352
|
+
this._isMobileView = false;
|
|
10363
10353
|
}
|
|
10364
10354
|
get activeMode() {
|
|
10365
10355
|
return this.mode;
|
|
@@ -10389,8 +10379,8 @@ class NaturalSidenavService extends NaturalAbstractController {
|
|
|
10389
10379
|
.observe([Breakpoints.XSmall, Breakpoints.Small])
|
|
10390
10380
|
.pipe(takeUntil$1(this.ngUnsubscribe))
|
|
10391
10381
|
.subscribe(r => {
|
|
10392
|
-
this
|
|
10393
|
-
const isBig = !this
|
|
10382
|
+
this._isMobileView = r.matches;
|
|
10383
|
+
const isBig = !this._isMobileView;
|
|
10394
10384
|
this.mode = isBig ? this.modes[0] : this.modes[1];
|
|
10395
10385
|
if (oldIsBig === null || isBig !== oldIsBig) {
|
|
10396
10386
|
oldIsBig = isBig;
|
|
@@ -10415,13 +10405,13 @@ class NaturalSidenavService extends NaturalAbstractController {
|
|
|
10415
10405
|
}
|
|
10416
10406
|
}
|
|
10417
10407
|
isMobileView() {
|
|
10418
|
-
return this
|
|
10408
|
+
return this._isMobileView;
|
|
10419
10409
|
}
|
|
10420
10410
|
/**
|
|
10421
10411
|
* Close nav on mobile view after a click
|
|
10422
10412
|
*/
|
|
10423
10413
|
navItemClicked() {
|
|
10424
|
-
if (this
|
|
10414
|
+
if (this._isMobileView) {
|
|
10425
10415
|
this.close();
|
|
10426
10416
|
}
|
|
10427
10417
|
}
|
|
@@ -10458,7 +10448,7 @@ class NaturalSidenavService extends NaturalAbstractController {
|
|
|
10458
10448
|
assert(this.openedStorageKeyWithName);
|
|
10459
10449
|
const value = this.sessionStorage.getItem(this.openedStorageKeyWithName);
|
|
10460
10450
|
if (value === null) {
|
|
10461
|
-
return !this
|
|
10451
|
+
return !this._isMobileView;
|
|
10462
10452
|
}
|
|
10463
10453
|
else {
|
|
10464
10454
|
return value === 'true';
|
|
@@ -10479,10 +10469,10 @@ class NaturalSidenavService extends NaturalAbstractController {
|
|
|
10479
10469
|
}
|
|
10480
10470
|
setOpened(value) {
|
|
10481
10471
|
this.opened = value;
|
|
10482
|
-
if (this.opened && this
|
|
10472
|
+
if (this.opened && this._isMobileView) {
|
|
10483
10473
|
this.minimized = false;
|
|
10484
10474
|
}
|
|
10485
|
-
else if (!this
|
|
10475
|
+
else if (!this._isMobileView) {
|
|
10486
10476
|
assert(this.openedStorageKeyWithName);
|
|
10487
10477
|
this.sessionStorage.setItem(this.openedStorageKeyWithName, this.opened ? 'true' : 'false');
|
|
10488
10478
|
}
|