@masterteam/properties 0.0.31 → 0.0.33
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/assets/i18n/ar.json +99 -77
- package/assets/i18n/en.json +99 -77
- package/assets/properties.css +2 -2
- package/fesm2022/masterteam-properties.mjs +817 -267
- package/fesm2022/masterteam-properties.mjs.map +1 -1
- package/package.json +4 -4
- package/types/masterteam-properties.d.ts +108 -7
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, computed, input, linkedSignal, signal, Component, DestroyRef, effect, forwardRef, ChangeDetectionStrategy, EnvironmentInjector, ViewContainerRef, ViewChild } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, computed, input, linkedSignal, signal, Component, DestroyRef, effect, forwardRef, ChangeDetectionStrategy, viewChild, EnvironmentInjector, ViewContainerRef, ViewChild } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { Table } from '@masterteam/components/table';
|
|
5
5
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
6
6
|
import { HttpClient, HttpContextToken } from '@angular/common/http';
|
|
7
7
|
import { Action, Selector, State, Store, select } from '@ngxs/store';
|
|
8
8
|
import { of, finalize, startWith, map, distinctUntilChanged, Subscription } from 'rxjs';
|
|
9
|
-
import {
|
|
10
|
-
import { CrudStateBase, handleApiRequest, PickListFieldConfig, ValidatorConfig } from '@masterteam/components';
|
|
9
|
+
import { CrudStateBase, handleApiRequest, PickListFieldConfig, ValidatorConfig, ColorPickerFieldConfig, IconFieldConfig } from '@masterteam/components';
|
|
11
10
|
import { Breadcrumb } from '@masterteam/components/breadcrumb';
|
|
12
11
|
import { Card } from '@masterteam/components/card';
|
|
13
12
|
import { Avatar } from '@masterteam/components/avatar';
|
|
14
13
|
import { Divider } from 'primeng/divider';
|
|
15
14
|
import { Button } from '@masterteam/components/button';
|
|
16
|
-
import * as
|
|
15
|
+
import * as i2 from '@jsverse/transloco';
|
|
17
16
|
import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
|
|
18
17
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
19
18
|
import { Page } from '@masterteam/components/page';
|
|
20
19
|
import { DynamicForm } from '@masterteam/forms/dynamic-form';
|
|
21
|
-
import * as i1
|
|
22
|
-
import { FormGroup, FormControl,
|
|
23
|
-
import * as i2 from 'primeng/skeleton';
|
|
20
|
+
import * as i1 from '@angular/forms';
|
|
21
|
+
import { FormGroup, FormControl, Validators, FormArray, ReactiveFormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer, FormGroupDirective } from '@angular/forms';
|
|
22
|
+
import * as i2$1 from 'primeng/skeleton';
|
|
24
23
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
25
24
|
import { FormulaBuilder } from '@masterteam/formula-builder';
|
|
26
25
|
import { SelectField } from '@masterteam/components/select-field';
|
|
27
26
|
import { TextField } from '@masterteam/components/text-field';
|
|
28
27
|
import { ToggleField } from '@masterteam/components/toggle-field';
|
|
28
|
+
import { ModalService } from '@masterteam/components/modal';
|
|
29
|
+
import { ModalRef } from '@masterteam/components/dialog';
|
|
29
30
|
|
|
30
31
|
var PropertiesActionKey;
|
|
31
32
|
(function (PropertiesActionKey) {
|
|
@@ -40,6 +41,11 @@ var PropertiesActionKey;
|
|
|
40
41
|
PropertiesActionKey["GetConfigAsType"] = "getConfigAsType";
|
|
41
42
|
PropertiesActionKey["GetCountries"] = "getCountries";
|
|
42
43
|
PropertiesActionKey["TestApiConfiguration"] = "testApiConfiguration";
|
|
44
|
+
PropertiesActionKey["GetPropertyStatuses"] = "getPropertyStatuses";
|
|
45
|
+
PropertiesActionKey["CreatePropertyStatus"] = "createPropertyStatus";
|
|
46
|
+
PropertiesActionKey["UpdatePropertyStatus"] = "updatePropertyStatus";
|
|
47
|
+
PropertiesActionKey["DeletePropertyStatus"] = "deletePropertyStatus";
|
|
48
|
+
PropertiesActionKey["ReorderPropertyStatuses"] = "reorderPropertyStatuses";
|
|
43
49
|
})(PropertiesActionKey || (PropertiesActionKey = {}));
|
|
44
50
|
|
|
45
51
|
class GetProperties {
|
|
@@ -84,6 +90,52 @@ class TestApiConfiguration {
|
|
|
84
90
|
class ResetApiConfiguration {
|
|
85
91
|
static type = '[Properties] Reset API Configuration';
|
|
86
92
|
}
|
|
93
|
+
class GetPropertyStatuses {
|
|
94
|
+
propertyId;
|
|
95
|
+
static type = '[Properties] Get Property Statuses';
|
|
96
|
+
constructor(propertyId) {
|
|
97
|
+
this.propertyId = propertyId;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class CreatePropertyStatus {
|
|
101
|
+
propertyId;
|
|
102
|
+
payload;
|
|
103
|
+
static type = '[Properties] Create Property Status';
|
|
104
|
+
constructor(propertyId, payload) {
|
|
105
|
+
this.propertyId = propertyId;
|
|
106
|
+
this.payload = payload;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
class UpdatePropertyStatus {
|
|
110
|
+
propertyId;
|
|
111
|
+
statusId;
|
|
112
|
+
payload;
|
|
113
|
+
static type = '[Properties] Update Property Status';
|
|
114
|
+
constructor(propertyId, statusId, payload) {
|
|
115
|
+
this.propertyId = propertyId;
|
|
116
|
+
this.statusId = statusId;
|
|
117
|
+
this.payload = payload;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class DeletePropertyStatus {
|
|
121
|
+
propertyId;
|
|
122
|
+
statusId;
|
|
123
|
+
static type = '[Properties] Delete Property Status';
|
|
124
|
+
constructor(propertyId, statusId) {
|
|
125
|
+
this.propertyId = propertyId;
|
|
126
|
+
this.statusId = statusId;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
class ReorderPropertyStatuses {
|
|
130
|
+
payload;
|
|
131
|
+
static type = '[Properties] Reorder Property Statuses';
|
|
132
|
+
constructor(payload) {
|
|
133
|
+
this.payload = payload;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
class ResetPropertyStatuses {
|
|
137
|
+
static type = '[Properties] Reset Property Statuses';
|
|
138
|
+
}
|
|
87
139
|
class GetPropertiesForConfigType {
|
|
88
140
|
moduleType;
|
|
89
141
|
moduleId;
|
|
@@ -185,6 +237,7 @@ const DEFAULT_STATE = {
|
|
|
185
237
|
countries: [],
|
|
186
238
|
apiSchema: null,
|
|
187
239
|
apiProperties: [],
|
|
240
|
+
propertyStatuses: [],
|
|
188
241
|
breadcrumbItems: [],
|
|
189
242
|
defaultViewType: null,
|
|
190
243
|
};
|
|
@@ -196,7 +249,7 @@ let PropertiesState = class PropertiesState extends CrudStateBase {
|
|
|
196
249
|
groupsUrl = 'identity/Groups';
|
|
197
250
|
countriesUrl = '/assets/countries/countries.json';
|
|
198
251
|
apiTestUrl = 'app/testAPI';
|
|
199
|
-
|
|
252
|
+
propertyStatusOrderUrl = 'Properties/Status/Order';
|
|
200
253
|
// ============================================================================
|
|
201
254
|
// Data Selectors - Individual for fine-grained reactivity
|
|
202
255
|
// ============================================================================
|
|
@@ -233,6 +286,9 @@ let PropertiesState = class PropertiesState extends CrudStateBase {
|
|
|
233
286
|
static apiProperties(state) {
|
|
234
287
|
return state.apiProperties;
|
|
235
288
|
}
|
|
289
|
+
static propertyStatuses(state) {
|
|
290
|
+
return state.propertyStatuses;
|
|
291
|
+
}
|
|
236
292
|
static propertyTypes(state) {
|
|
237
293
|
return state.propertyTypes ?? {};
|
|
238
294
|
}
|
|
@@ -368,31 +424,97 @@ let PropertiesState = class PropertiesState extends CrudStateBase {
|
|
|
368
424
|
apiSchema: null,
|
|
369
425
|
apiProperties: [],
|
|
370
426
|
});
|
|
371
|
-
const req$ = this.http
|
|
372
|
-
.post(this.apiTestUrl, action.payload)
|
|
373
|
-
.pipe(switchMap((testResponse) => {
|
|
374
|
-
const rawData = testResponse?.data;
|
|
375
|
-
if (!rawData) {
|
|
376
|
-
return of(null);
|
|
377
|
-
}
|
|
378
|
-
const formData = new FormData();
|
|
379
|
-
formData.append('jsonData', JSON.stringify(rawData));
|
|
380
|
-
return this.http
|
|
381
|
-
.post(this.apiDetectUrl, formData)
|
|
382
|
-
.pipe(tap((detectResponse) => {
|
|
383
|
-
const schema = detectResponse?.data ?? null;
|
|
384
|
-
const apiProperties = this.mapSchemaToOptions(schema);
|
|
385
|
-
ctx.patchState({
|
|
386
|
-
apiSchema: schema,
|
|
387
|
-
apiProperties,
|
|
388
|
-
});
|
|
389
|
-
}));
|
|
390
|
-
}));
|
|
427
|
+
const req$ = this.http.post(this.apiTestUrl, action.payload);
|
|
391
428
|
return handleApiRequest({
|
|
392
429
|
ctx,
|
|
393
430
|
key: PropertiesActionKey.TestApiConfiguration,
|
|
394
431
|
request$: req$,
|
|
395
|
-
onSuccess: () =>
|
|
432
|
+
onSuccess: (response) => {
|
|
433
|
+
const schema = this.buildSchemaFromRecord(response.data);
|
|
434
|
+
return {
|
|
435
|
+
apiSchema: schema,
|
|
436
|
+
apiProperties: this.mapSchemaToOptions(schema),
|
|
437
|
+
};
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
getPropertyStatuses(ctx, action) {
|
|
442
|
+
const req$ = this.http.get(`${this.baseUrl}/${action.propertyId}/Status`);
|
|
443
|
+
return handleApiRequest({
|
|
444
|
+
ctx,
|
|
445
|
+
key: PropertiesActionKey.GetPropertyStatuses,
|
|
446
|
+
request$: req$,
|
|
447
|
+
onSuccess: (response) => ({
|
|
448
|
+
propertyStatuses: Array.isArray(response.data) ? response.data : [],
|
|
449
|
+
}),
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
createPropertyStatus(ctx, action) {
|
|
453
|
+
const req$ = this.http.post(`${this.baseUrl}/${action.propertyId}/Status`, action.payload);
|
|
454
|
+
return handleApiRequest({
|
|
455
|
+
ctx,
|
|
456
|
+
key: PropertiesActionKey.CreatePropertyStatus,
|
|
457
|
+
request$: req$,
|
|
458
|
+
onSuccess: (response, state) => {
|
|
459
|
+
const created = response.data;
|
|
460
|
+
if (!created) {
|
|
461
|
+
return {};
|
|
462
|
+
}
|
|
463
|
+
return {
|
|
464
|
+
propertyStatuses: [...state.propertyStatuses, created],
|
|
465
|
+
};
|
|
466
|
+
},
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
updatePropertyStatus(ctx, action) {
|
|
470
|
+
const req$ = this.http.put(`${this.baseUrl}/${action.propertyId}/Status/${action.statusId}`, action.payload);
|
|
471
|
+
return handleApiRequest({
|
|
472
|
+
ctx,
|
|
473
|
+
key: PropertiesActionKey.UpdatePropertyStatus,
|
|
474
|
+
request$: req$,
|
|
475
|
+
onSuccess: (response, state) => {
|
|
476
|
+
const updated = response.data;
|
|
477
|
+
if (!updated) {
|
|
478
|
+
return {};
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
propertyStatuses: state.propertyStatuses.map((status) => status.id === updated.id ? updated : status),
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
deletePropertyStatus(ctx, action) {
|
|
487
|
+
const req$ = this.http.delete(`${this.baseUrl}/${action.propertyId}/Status/${action.statusId}`);
|
|
488
|
+
return handleApiRequest({
|
|
489
|
+
ctx,
|
|
490
|
+
key: PropertiesActionKey.DeletePropertyStatus,
|
|
491
|
+
request$: req$,
|
|
492
|
+
onSuccess: (_, state) => ({
|
|
493
|
+
propertyStatuses: state.propertyStatuses.filter((status) => status.id !== Number(action.statusId)),
|
|
494
|
+
}),
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
reorderPropertyStatuses(ctx, action) {
|
|
498
|
+
const req$ = this.http.put(this.propertyStatusOrderUrl, action.payload);
|
|
499
|
+
return handleApiRequest({
|
|
500
|
+
ctx,
|
|
501
|
+
key: PropertiesActionKey.ReorderPropertyStatuses,
|
|
502
|
+
request$: req$,
|
|
503
|
+
onSuccess: (_, state) => {
|
|
504
|
+
const orderMap = new Map(action.payload.orders.map((item) => [item.statusId, item.order]));
|
|
505
|
+
return {
|
|
506
|
+
propertyStatuses: [...state.propertyStatuses]
|
|
507
|
+
.map((status) => ({
|
|
508
|
+
...status,
|
|
509
|
+
order: orderMap.get(status.id) ?? status.order ?? null,
|
|
510
|
+
}))
|
|
511
|
+
.sort((left, right) => {
|
|
512
|
+
const leftOrder = left.order ?? Number.MAX_SAFE_INTEGER;
|
|
513
|
+
const rightOrder = right.order ?? Number.MAX_SAFE_INTEGER;
|
|
514
|
+
return leftOrder - rightOrder || left.id - right.id;
|
|
515
|
+
}),
|
|
516
|
+
};
|
|
517
|
+
},
|
|
396
518
|
});
|
|
397
519
|
}
|
|
398
520
|
getPropertiesForConfigType(ctx, action) {
|
|
@@ -425,6 +547,11 @@ let PropertiesState = class PropertiesState extends CrudStateBase {
|
|
|
425
547
|
apiProperties: [],
|
|
426
548
|
});
|
|
427
549
|
}
|
|
550
|
+
resetPropertyStatuses(ctx) {
|
|
551
|
+
ctx.patchState({
|
|
552
|
+
propertyStatuses: [],
|
|
553
|
+
});
|
|
554
|
+
}
|
|
428
555
|
setModuleInfo(ctx, action) {
|
|
429
556
|
let parentPath = '';
|
|
430
557
|
if (action.parentModuleType && action.parentModuleId) {
|
|
@@ -541,6 +668,34 @@ let PropertiesState = class PropertiesState extends CrudStateBase {
|
|
|
541
668
|
};
|
|
542
669
|
});
|
|
543
670
|
}
|
|
671
|
+
buildSchemaFromRecord(record) {
|
|
672
|
+
if (!record) {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
const properties = Object.entries(record).reduce((acc, [key, value]) => {
|
|
676
|
+
acc[key] = { type: this.inferApiFieldType(value) };
|
|
677
|
+
return acc;
|
|
678
|
+
}, {});
|
|
679
|
+
return Object.keys(properties).length ? { properties } : null;
|
|
680
|
+
}
|
|
681
|
+
inferApiFieldType(value) {
|
|
682
|
+
if (Array.isArray(value)) {
|
|
683
|
+
return 'array';
|
|
684
|
+
}
|
|
685
|
+
if (value === null) {
|
|
686
|
+
return 'null';
|
|
687
|
+
}
|
|
688
|
+
switch (typeof value) {
|
|
689
|
+
case 'string':
|
|
690
|
+
case 'number':
|
|
691
|
+
case 'boolean':
|
|
692
|
+
return typeof value;
|
|
693
|
+
case 'object':
|
|
694
|
+
return 'object';
|
|
695
|
+
default:
|
|
696
|
+
return undefined;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
544
699
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertiesState, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
545
700
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertiesState });
|
|
546
701
|
};
|
|
@@ -565,6 +720,21 @@ __decorate([
|
|
|
565
720
|
__decorate([
|
|
566
721
|
Action(TestApiConfiguration)
|
|
567
722
|
], PropertiesState.prototype, "testApiConfiguration", null);
|
|
723
|
+
__decorate([
|
|
724
|
+
Action(GetPropertyStatuses)
|
|
725
|
+
], PropertiesState.prototype, "getPropertyStatuses", null);
|
|
726
|
+
__decorate([
|
|
727
|
+
Action(CreatePropertyStatus)
|
|
728
|
+
], PropertiesState.prototype, "createPropertyStatus", null);
|
|
729
|
+
__decorate([
|
|
730
|
+
Action(UpdatePropertyStatus)
|
|
731
|
+
], PropertiesState.prototype, "updatePropertyStatus", null);
|
|
732
|
+
__decorate([
|
|
733
|
+
Action(DeletePropertyStatus)
|
|
734
|
+
], PropertiesState.prototype, "deletePropertyStatus", null);
|
|
735
|
+
__decorate([
|
|
736
|
+
Action(ReorderPropertyStatuses)
|
|
737
|
+
], PropertiesState.prototype, "reorderPropertyStatuses", null);
|
|
568
738
|
__decorate([
|
|
569
739
|
Action(GetPropertiesForConfigType)
|
|
570
740
|
], PropertiesState.prototype, "getPropertiesForConfigType", null);
|
|
@@ -580,6 +750,9 @@ __decorate([
|
|
|
580
750
|
__decorate([
|
|
581
751
|
Action(ResetApiConfiguration)
|
|
582
752
|
], PropertiesState.prototype, "resetApiConfiguration", null);
|
|
753
|
+
__decorate([
|
|
754
|
+
Action(ResetPropertyStatuses)
|
|
755
|
+
], PropertiesState.prototype, "resetPropertyStatuses", null);
|
|
583
756
|
__decorate([
|
|
584
757
|
Action(SetPropertiesModuleInfo)
|
|
585
758
|
], PropertiesState.prototype, "setModuleInfo", null);
|
|
@@ -634,6 +807,9 @@ __decorate([
|
|
|
634
807
|
__decorate([
|
|
635
808
|
Selector()
|
|
636
809
|
], PropertiesState, "apiProperties", null);
|
|
810
|
+
__decorate([
|
|
811
|
+
Selector()
|
|
812
|
+
], PropertiesState, "propertyStatuses", null);
|
|
637
813
|
__decorate([
|
|
638
814
|
Selector()
|
|
639
815
|
], PropertiesState, "propertyTypes", null);
|
|
@@ -660,7 +836,7 @@ PropertiesState = __decorate([
|
|
|
660
836
|
], PropertiesState);
|
|
661
837
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertiesState, decorators: [{
|
|
662
838
|
type: Injectable
|
|
663
|
-
}], propDecorators: { getAll: [], getOne: [], getLookups: [], getGroups: [], getConfigAsType: [], getCountries: [], testApiConfiguration: [], getPropertiesForConfigType: [], resetConfigProperties: [], resetConfigScopes: [], resetSelectedProperty: [], resetApiConfiguration: [], setModuleInfo: [], SetPropertyTypes: [], setBreadcrumb: [], setDefaultViewType: [], createProperty: [], updateProperty: [], deleteProperty: [] } });
|
|
839
|
+
}], propDecorators: { getAll: [], getOne: [], getLookups: [], getGroups: [], getConfigAsType: [], getCountries: [], testApiConfiguration: [], getPropertyStatuses: [], createPropertyStatus: [], updatePropertyStatus: [], deletePropertyStatus: [], reorderPropertyStatuses: [], getPropertiesForConfigType: [], resetConfigProperties: [], resetConfigScopes: [], resetSelectedProperty: [], resetApiConfiguration: [], resetPropertyStatuses: [], setModuleInfo: [], SetPropertyTypes: [], setBreadcrumb: [], setDefaultViewType: [], createProperty: [], updateProperty: [], deleteProperty: [] } });
|
|
664
840
|
|
|
665
841
|
class PropertiesFacade {
|
|
666
842
|
store = inject(Store);
|
|
@@ -679,6 +855,7 @@ class PropertiesFacade {
|
|
|
679
855
|
countries = select(PropertiesState.countries);
|
|
680
856
|
apiSchema = select(PropertiesState.apiSchema);
|
|
681
857
|
apiProperties = select(PropertiesState.apiProperties);
|
|
858
|
+
propertyStatuses = select(PropertiesState.propertyStatuses);
|
|
682
859
|
breadcrumbItems = select(PropertiesState.breadcrumbItems);
|
|
683
860
|
defaultViewType = select(PropertiesState.defaultViewType);
|
|
684
861
|
// ============================================================================
|
|
@@ -700,6 +877,11 @@ class PropertiesFacade {
|
|
|
700
877
|
isLoadingConfigAsType = computed(() => this.loadingActive().includes(PropertiesActionKey.GetConfigAsType), ...(ngDevMode ? [{ debugName: "isLoadingConfigAsType" }] : []));
|
|
701
878
|
isLoadingCountries = computed(() => this.loadingActive().includes(PropertiesActionKey.GetCountries), ...(ngDevMode ? [{ debugName: "isLoadingCountries" }] : []));
|
|
702
879
|
isTestingApi = computed(() => this.loadingActive().includes(PropertiesActionKey.TestApiConfiguration), ...(ngDevMode ? [{ debugName: "isTestingApi" }] : []));
|
|
880
|
+
isLoadingPropertyStatuses = computed(() => this.loadingActive().includes(PropertiesActionKey.GetPropertyStatuses), ...(ngDevMode ? [{ debugName: "isLoadingPropertyStatuses" }] : []));
|
|
881
|
+
isCreatingPropertyStatus = computed(() => this.loadingActive().includes(PropertiesActionKey.CreatePropertyStatus), ...(ngDevMode ? [{ debugName: "isCreatingPropertyStatus" }] : []));
|
|
882
|
+
isUpdatingPropertyStatus = computed(() => this.loadingActive().includes(PropertiesActionKey.UpdatePropertyStatus), ...(ngDevMode ? [{ debugName: "isUpdatingPropertyStatus" }] : []));
|
|
883
|
+
isDeletingPropertyStatus = computed(() => this.loadingActive().includes(PropertiesActionKey.DeletePropertyStatus), ...(ngDevMode ? [{ debugName: "isDeletingPropertyStatus" }] : []));
|
|
884
|
+
isReorderingPropertyStatuses = computed(() => this.loadingActive().includes(PropertiesActionKey.ReorderPropertyStatuses), ...(ngDevMode ? [{ debugName: "isReorderingPropertyStatuses" }] : []));
|
|
703
885
|
// ============================================================================
|
|
704
886
|
// Error Signals - Computed from slice (minimal reactivity)
|
|
705
887
|
// ============================================================================
|
|
@@ -714,6 +896,7 @@ class PropertiesFacade {
|
|
|
714
896
|
configAsTypeError = computed(() => this.errors()[PropertiesActionKey.GetConfigAsType] ?? null, ...(ngDevMode ? [{ debugName: "configAsTypeError" }] : []));
|
|
715
897
|
countriesError = computed(() => this.errors()[PropertiesActionKey.GetCountries] ?? null, ...(ngDevMode ? [{ debugName: "countriesError" }] : []));
|
|
716
898
|
apiTestError = computed(() => this.errors()[PropertiesActionKey.TestApiConfiguration] ?? null, ...(ngDevMode ? [{ debugName: "apiTestError" }] : []));
|
|
899
|
+
propertyStatusesError = computed(() => this.errors()[PropertiesActionKey.GetPropertyStatuses] ?? null, ...(ngDevMode ? [{ debugName: "propertyStatusesError" }] : []));
|
|
717
900
|
// ============================================================================
|
|
718
901
|
// Derived Data - Computed from data selectors
|
|
719
902
|
// ============================================================================
|
|
@@ -758,6 +941,24 @@ class PropertiesFacade {
|
|
|
758
941
|
resetApiConfiguration() {
|
|
759
942
|
return this.store.dispatch(new ResetApiConfiguration());
|
|
760
943
|
}
|
|
944
|
+
loadPropertyStatuses(propertyId) {
|
|
945
|
+
return this.store.dispatch(new GetPropertyStatuses(propertyId));
|
|
946
|
+
}
|
|
947
|
+
createPropertyStatus(propertyId, payload) {
|
|
948
|
+
return this.store.dispatch(new CreatePropertyStatus(propertyId, payload));
|
|
949
|
+
}
|
|
950
|
+
updatePropertyStatus(propertyId, statusId, payload) {
|
|
951
|
+
return this.store.dispatch(new UpdatePropertyStatus(propertyId, statusId, payload));
|
|
952
|
+
}
|
|
953
|
+
deletePropertyStatus(propertyId, statusId) {
|
|
954
|
+
return this.store.dispatch(new DeletePropertyStatus(propertyId, statusId));
|
|
955
|
+
}
|
|
956
|
+
reorderPropertyStatuses(payload) {
|
|
957
|
+
return this.store.dispatch(new ReorderPropertyStatuses(payload));
|
|
958
|
+
}
|
|
959
|
+
resetPropertyStatuses() {
|
|
960
|
+
return this.store.dispatch(new ResetPropertyStatuses());
|
|
961
|
+
}
|
|
761
962
|
setPropertyTypes(propertyTypes) {
|
|
762
963
|
return this.store.dispatch(new SetPropertyTypes(propertyTypes));
|
|
763
964
|
}
|
|
@@ -998,7 +1199,7 @@ class PropertiesList {
|
|
|
998
1199
|
});
|
|
999
1200
|
}
|
|
1000
1201
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertiesList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1001
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PropertiesList, isStandalone: true, selector: "mt-properties-list", inputs: { tab: { classPropertyName: "tab", publicName: "tab", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"space-y-3\">\r\n <div class=\"flex items-center justify-between\">\r\n <div class=\"space-y-1\">\r\n <h1 class=\"text-xl font-semibold text-slate-900 tracking-tight\">\r\n {{ \"properties.list.pageTitle\" | transloco }}\r\n </h1>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n [styleClass]=\"'flex justify-center'\"\r\n >\r\n </mt-breadcrumb>\r\n </div>\r\n </div>\r\n <mt-card paddingless>\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n (onTabChange)=\"onTabChange($event)\"\r\n [data]=\"tableData()\"\r\n [actions]=\"tableActions()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div headless class=\"flex-col justify-center items-center w-full p-5\">\r\n <div\r\n class=\"content flex flex-col gap-5 items-center text-center mb-5\"\r\n >\r\n <svg\r\n width=\"152\"\r\n height=\"120\"\r\n viewBox=\"0 0 152 120\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"76\" cy=\"52\" r=\"52\" fill=\"#E9EAEB\" />\r\n <g filter=\"url(#filter0_ddd_2474_28277)\">\r\n <path\r\n d=\"M77.6 16C66.8273 16 57.2978 21.3233 51.4987 29.4829C49.605 29.0363 47.6301 28.8 45.6 28.8C31.4615 28.8 20 40.2615 20 54.4C20 68.5385 31.4615 80 45.6 80L109.6 80C121.971 80 132 69.9712 132 57.6C132 45.2288 121.971 35.2 109.6 35.2C108.721 35.2 107.854 35.2506 107.002 35.349C102.098 23.9677 90.7797 16 77.6 16Z\"\r\n fill=\"#FAFAFA\"\r\n />\r\n <ellipse\r\n cx=\"45.6\"\r\n cy=\"54.3998\"\r\n rx=\"25.6\"\r\n ry=\"25.6\"\r\n fill=\"url(#paint0_linear_2474_28277)\"\r\n />\r\n <circle\r\n cx=\"77.6016\"\r\n cy=\"48\"\r\n r=\"32\"\r\n fill=\"url(#paint1_linear_2474_28277)\"\r\n />\r\n <ellipse\r\n cx=\"109.599\"\r\n cy=\"57.6002\"\r\n rx=\"22.4\"\r\n ry=\"22.4\"\r\n fill=\"url(#paint2_linear_2474_28277)\"\r\n />\r\n </g>\r\n <circle cx=\"21\" cy=\"19\" r=\"5\" fill=\"#F5F5F5\" />\r\n <circle cx=\"18\" cy=\"109\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"145\" cy=\"35\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"134\" cy=\"8\" r=\"4\" fill=\"#F5F5F5\" />\r\n <foreignObject x=\"44\" y=\"54\" width=\"64\" height=\"64\">\r\n <div\r\n xmlns=\"http://www.w3.org/1999/xhtml\"\r\n style=\"\r\n backdrop-filter: blur(4px);\r\n clip-path: url(#bgblur_0_2474_28277_clip_path);\r\n height: 100%;\r\n width: 100%;\r\n \"\r\n ></div>\r\n </foreignObject>\r\n <g data-figma-bg-blur-radius=\"8\">\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n fill=\"#344054\"\r\n fill-opacity=\"0.4\"\r\n />\r\n <path\r\n d=\"M85 95L81.5001 91.5M84 85.5C84 90.1944 80.1944 94 75.5 94C70.8056 94 67 90.1944 67 85.5C67 80.8056 70.8056 77 75.5 77C80.1944 77 84 80.8056 84 85.5Z\"\r\n stroke=\"white\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </g>\r\n <defs>\r\n <filter\r\n id=\"filter0_ddd_2474_28277\"\r\n x=\"0\"\r\n y=\"16\"\r\n width=\"152\"\r\n height=\"104\"\r\n filterUnits=\"userSpaceOnUse\"\r\n color-interpolation-filters=\"sRGB\"\r\n >\r\n <feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\" />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"1.5\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"3\" />\r\n <feGaussianBlur stdDeviation=\"1.5\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.04 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"BackgroundImageFix\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"8\" />\r\n <feGaussianBlur stdDeviation=\"4\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.03 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect1_dropShadow_2474_28277\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"20\" />\r\n <feGaussianBlur stdDeviation=\"12\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.08 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect2_dropShadow_2474_28277\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in=\"SourceGraphic\"\r\n in2=\"effect3_dropShadow_2474_28277\"\r\n result=\"shape\"\r\n />\r\n </filter>\r\n <clipPath\r\n id=\"bgblur_0_2474_28277_clip_path\"\r\n transform=\"translate(-44 -54)\"\r\n >\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n />\r\n </clipPath>\r\n <linearGradient\r\n id=\"paint0_linear_2474_28277\"\r\n x1=\"25.9429\"\r\n y1=\"37.4855\"\r\n x2=\"71.2\"\r\n y2=\"79.9998\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint1_linear_2474_28277\"\r\n x1=\"53.0301\"\r\n y1=\"26.8571\"\r\n x2=\"109.602\"\r\n y2=\"80\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint2_linear_2474_28277\"\r\n x1=\"92.3992\"\r\n y1=\"42.8002\"\r\n x2=\"131.999\"\r\n y2=\"80.0002\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n\r\n <div class=\"flex flex-col gap-1\">\r\n <div class=\"text-md text-surface-600\">\r\n {{ \"properties.list.emptyStateNoData\" | transloco }}\r\n </div>\r\n </div>\r\n <div>\r\n <mt-button\r\n [label]=\"'properties.list.addNewProperty' | transloco\"\r\n icon=\"general.plus\"\r\n (click)=\"createProperty()\"\r\n />\r\n </div>\r\n </div>\r\n <p-divider type=\"solid\">\r\n <div class=\"text-lg text-surface-600\">\r\n {{ \"properties.list.emptyStateTemplate\" | transloco }}\r\n </div>\r\n </p-divider>\r\n <div class=\"flex gap-3 mt-5 justify-center\">\r\n @for (card of propertyTypes(); track card.label) {\r\n <mt-card\r\n headless\r\n class=\"w-25 tailwind-4 cursor-pointer\"\r\n style=\"background-color: #fafafa\"\r\n (click)=\"createPropertyWithType(card.value)\"\r\n >\r\n <div\r\n class=\"content flex flex-col gap-3 items-center text-center\"\r\n >\r\n <mt-avatar\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + card.color + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + card.color + '-600)'\"\r\n [icon]=\"card.icon\"\r\n shape=\"square\"\r\n ></mt-avatar>\r\n <div class=\"flex flex-col gap-1\">\r\n <div class=\"text-xs font-normal\">{{ card.label }}</div>\r\n </div>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n </mt-card>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "generalSearch", "showFilters", "loading", "updating", "lazy", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "exportable", "exportFilename", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "pageSize", "currentPage", "first", "filterTerm"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Divider, selector: "p-divider", inputs: ["styleClass", "layout", "type", "align"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i1.TranslocoPipe, name: "transloco" }] });
|
|
1202
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PropertiesList, isStandalone: true, selector: "mt-properties-list", inputs: { tab: { classPropertyName: "tab", publicName: "tab", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"space-y-3\">\r\n <div class=\"flex items-center justify-between\">\r\n <div class=\"space-y-1\">\r\n <h1 class=\"text-xl font-semibold text-slate-900 tracking-tight\">\r\n {{ \"properties.list.pageTitle\" | transloco }}\r\n </h1>\r\n <mt-breadcrumb\r\n [items]=\"breadcrumbItems()\"\r\n [styleClass]=\"'flex justify-center'\"\r\n >\r\n </mt-breadcrumb>\r\n </div>\r\n </div>\r\n <mt-card paddingless>\r\n <mt-table\r\n [tabs]=\"tabs()\"\r\n [(activeTab)]=\"activeTab\"\r\n (onTabChange)=\"onTabChange($event)\"\r\n [data]=\"tableData()\"\r\n [actions]=\"tableActions()\"\r\n [columns]=\"tableColumns()\"\r\n [rowActions]=\"rowActions()\"\r\n [generalSearch]=\"true\"\r\n [showFilters]=\"true\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div headless class=\"flex-col justify-center items-center w-full p-5\">\r\n <div\r\n class=\"content flex flex-col gap-5 items-center text-center mb-5\"\r\n >\r\n <svg\r\n width=\"152\"\r\n height=\"120\"\r\n viewBox=\"0 0 152 120\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"76\" cy=\"52\" r=\"52\" fill=\"#E9EAEB\" />\r\n <g filter=\"url(#filter0_ddd_2474_28277)\">\r\n <path\r\n d=\"M77.6 16C66.8273 16 57.2978 21.3233 51.4987 29.4829C49.605 29.0363 47.6301 28.8 45.6 28.8C31.4615 28.8 20 40.2615 20 54.4C20 68.5385 31.4615 80 45.6 80L109.6 80C121.971 80 132 69.9712 132 57.6C132 45.2288 121.971 35.2 109.6 35.2C108.721 35.2 107.854 35.2506 107.002 35.349C102.098 23.9677 90.7797 16 77.6 16Z\"\r\n fill=\"#FAFAFA\"\r\n />\r\n <ellipse\r\n cx=\"45.6\"\r\n cy=\"54.3998\"\r\n rx=\"25.6\"\r\n ry=\"25.6\"\r\n fill=\"url(#paint0_linear_2474_28277)\"\r\n />\r\n <circle\r\n cx=\"77.6016\"\r\n cy=\"48\"\r\n r=\"32\"\r\n fill=\"url(#paint1_linear_2474_28277)\"\r\n />\r\n <ellipse\r\n cx=\"109.599\"\r\n cy=\"57.6002\"\r\n rx=\"22.4\"\r\n ry=\"22.4\"\r\n fill=\"url(#paint2_linear_2474_28277)\"\r\n />\r\n </g>\r\n <circle cx=\"21\" cy=\"19\" r=\"5\" fill=\"#F5F5F5\" />\r\n <circle cx=\"18\" cy=\"109\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"145\" cy=\"35\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"134\" cy=\"8\" r=\"4\" fill=\"#F5F5F5\" />\r\n <foreignObject x=\"44\" y=\"54\" width=\"64\" height=\"64\">\r\n <div\r\n xmlns=\"http://www.w3.org/1999/xhtml\"\r\n style=\"\r\n backdrop-filter: blur(4px);\r\n clip-path: url(#bgblur_0_2474_28277_clip_path);\r\n height: 100%;\r\n width: 100%;\r\n \"\r\n ></div>\r\n </foreignObject>\r\n <g data-figma-bg-blur-radius=\"8\">\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n fill=\"#344054\"\r\n fill-opacity=\"0.4\"\r\n />\r\n <path\r\n d=\"M85 95L81.5001 91.5M84 85.5C84 90.1944 80.1944 94 75.5 94C70.8056 94 67 90.1944 67 85.5C67 80.8056 70.8056 77 75.5 77C80.1944 77 84 80.8056 84 85.5Z\"\r\n stroke=\"white\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </g>\r\n <defs>\r\n <filter\r\n id=\"filter0_ddd_2474_28277\"\r\n x=\"0\"\r\n y=\"16\"\r\n width=\"152\"\r\n height=\"104\"\r\n filterUnits=\"userSpaceOnUse\"\r\n color-interpolation-filters=\"sRGB\"\r\n >\r\n <feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\" />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"1.5\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"3\" />\r\n <feGaussianBlur stdDeviation=\"1.5\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.04 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"BackgroundImageFix\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"8\" />\r\n <feGaussianBlur stdDeviation=\"4\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.03 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect1_dropShadow_2474_28277\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"20\" />\r\n <feGaussianBlur stdDeviation=\"12\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.08 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect2_dropShadow_2474_28277\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in=\"SourceGraphic\"\r\n in2=\"effect3_dropShadow_2474_28277\"\r\n result=\"shape\"\r\n />\r\n </filter>\r\n <clipPath\r\n id=\"bgblur_0_2474_28277_clip_path\"\r\n transform=\"translate(-44 -54)\"\r\n >\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n />\r\n </clipPath>\r\n <linearGradient\r\n id=\"paint0_linear_2474_28277\"\r\n x1=\"25.9429\"\r\n y1=\"37.4855\"\r\n x2=\"71.2\"\r\n y2=\"79.9998\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint1_linear_2474_28277\"\r\n x1=\"53.0301\"\r\n y1=\"26.8571\"\r\n x2=\"109.602\"\r\n y2=\"80\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint2_linear_2474_28277\"\r\n x1=\"92.3992\"\r\n y1=\"42.8002\"\r\n x2=\"131.999\"\r\n y2=\"80.0002\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n\r\n <div class=\"flex flex-col gap-1\">\r\n <div class=\"text-md text-surface-600\">\r\n {{ \"properties.list.emptyStateNoData\" | transloco }}\r\n </div>\r\n </div>\r\n <div>\r\n <mt-button\r\n [label]=\"'properties.list.addNewProperty' | transloco\"\r\n icon=\"general.plus\"\r\n (click)=\"createProperty()\"\r\n />\r\n </div>\r\n </div>\r\n <p-divider type=\"solid\">\r\n <div class=\"text-lg text-surface-600\">\r\n {{ \"properties.list.emptyStateTemplate\" | transloco }}\r\n </div>\r\n </p-divider>\r\n <div class=\"flex gap-3 mt-5 justify-center\">\r\n @for (card of propertyTypes(); track card.label) {\r\n <mt-card\r\n headless\r\n class=\"w-25 tailwind-4 cursor-pointer\"\r\n style=\"background-color: #fafafa\"\r\n (click)=\"createPropertyWithType(card.value)\"\r\n >\r\n <div\r\n class=\"content flex flex-col gap-3 items-center text-center\"\r\n >\r\n <mt-avatar\r\n [style.--p-avatar-background]=\"\r\n 'var(--p-' + card.color + '-100)'\r\n \"\r\n [style.--p-avatar-color]=\"'var(--p-' + card.color + '-600)'\"\r\n [icon]=\"card.icon\"\r\n shape=\"square\"\r\n ></mt-avatar>\r\n <div class=\"flex flex-col gap-1\">\r\n <div class=\"text-xs font-normal\">{{ card.label }}</div>\r\n </div>\r\n </div>\r\n </mt-card>\r\n }\r\n </div>\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n </mt-card>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "showFilters", "loading", "updating", "lazy", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "exportable", "exportFilename", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "pageSize", "currentPage", "first", "filterTerm"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange"] }, { kind: "component", type: Breadcrumb, selector: "mt-breadcrumb", inputs: ["items", "styleClass"], outputs: ["onItemClick"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Divider, selector: "p-divider", inputs: ["styleClass", "layout", "type", "align"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
1002
1203
|
}
|
|
1003
1204
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertiesList, decorators: [{
|
|
1004
1205
|
type: Component,
|
|
@@ -1019,23 +1220,38 @@ class ApiConfiguration {
|
|
|
1019
1220
|
destroyRef = inject(DestroyRef);
|
|
1020
1221
|
transloco = inject(TranslocoService);
|
|
1021
1222
|
schema = signal(null, ...(ngDevMode ? [{ debugName: "schema" }] : []));
|
|
1223
|
+
lastLoadedPayloadSignature = null;
|
|
1022
1224
|
isWriting = false;
|
|
1023
1225
|
touched = false;
|
|
1024
1226
|
isTesting = this.facade.isTestingApi;
|
|
1025
1227
|
apiProperties = this.facade.apiProperties;
|
|
1026
|
-
|
|
1228
|
+
resolvedApiProperties = computed(() => {
|
|
1229
|
+
const loadedProperties = this.apiProperties();
|
|
1230
|
+
if (loadedProperties.length) {
|
|
1231
|
+
return loadedProperties;
|
|
1232
|
+
}
|
|
1233
|
+
return this.mapSchemaToOptions(this.schema());
|
|
1234
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedApiProperties" }] : []));
|
|
1235
|
+
hasDetectedSchema = computed(() => this.resolvedApiProperties().length > 0, ...(ngDevMode ? [{ debugName: "hasDetectedSchema" }] : []));
|
|
1027
1236
|
form = new FormGroup({
|
|
1028
1237
|
endpoint: new FormControl('', {
|
|
1029
1238
|
nonNullable: true,
|
|
1030
1239
|
validators: [Validators.required],
|
|
1031
1240
|
}),
|
|
1032
1241
|
headers: new FormArray([]),
|
|
1033
|
-
key: new FormControl(
|
|
1034
|
-
|
|
1242
|
+
key: new FormControl('', {
|
|
1243
|
+
nonNullable: true,
|
|
1244
|
+
validators: [Validators.required],
|
|
1245
|
+
}),
|
|
1246
|
+
value: new FormControl('', {
|
|
1247
|
+
nonNullable: true,
|
|
1248
|
+
validators: [Validators.required],
|
|
1249
|
+
}),
|
|
1035
1250
|
supportMultiSelect: new FormControl(false, { nonNullable: true }),
|
|
1036
1251
|
});
|
|
1037
1252
|
onChange = () => { };
|
|
1038
1253
|
onTouched = () => { };
|
|
1254
|
+
onValidatorChange = () => { };
|
|
1039
1255
|
formChanges = toSignal(this.form.valueChanges, {
|
|
1040
1256
|
initialValue: this.form.getRawValue(),
|
|
1041
1257
|
});
|
|
@@ -1044,6 +1260,7 @@ class ApiConfiguration {
|
|
|
1044
1260
|
effect(() => {
|
|
1045
1261
|
this.formChanges();
|
|
1046
1262
|
this.emitValue();
|
|
1263
|
+
this.onValidatorChange();
|
|
1047
1264
|
});
|
|
1048
1265
|
effect(() => {
|
|
1049
1266
|
const latestSchema = this.facade.apiSchema();
|
|
@@ -1067,11 +1284,13 @@ class ApiConfiguration {
|
|
|
1067
1284
|
if (!value) {
|
|
1068
1285
|
this.form.reset({
|
|
1069
1286
|
endpoint: '',
|
|
1070
|
-
key:
|
|
1071
|
-
value:
|
|
1287
|
+
key: '',
|
|
1288
|
+
value: '',
|
|
1072
1289
|
supportMultiSelect: false,
|
|
1073
1290
|
}, { emitEvent: false });
|
|
1074
1291
|
this.setHeadersFromRecord({});
|
|
1292
|
+
this.lastLoadedPayloadSignature = null;
|
|
1293
|
+
this.facade.resetApiConfiguration().subscribe();
|
|
1075
1294
|
this.schema.set(null);
|
|
1076
1295
|
this.touched = false;
|
|
1077
1296
|
return;
|
|
@@ -1079,16 +1298,18 @@ class ApiConfiguration {
|
|
|
1079
1298
|
this.schema.set(value.schema ?? null);
|
|
1080
1299
|
this.form.patchValue({
|
|
1081
1300
|
endpoint: value.endpoint ?? '',
|
|
1082
|
-
key: value.key ??
|
|
1083
|
-
value: value.value ??
|
|
1301
|
+
key: value.key ?? '',
|
|
1302
|
+
value: value.value ?? '',
|
|
1084
1303
|
supportMultiSelect: !!value.supportMultiSelect,
|
|
1085
1304
|
}, { emitEvent: false });
|
|
1086
1305
|
this.setHeadersFromRecord(value.headers ?? {});
|
|
1087
1306
|
this.touched = false;
|
|
1307
|
+
this.loadApiFields(value.endpoint ?? '', value.headers ?? {});
|
|
1088
1308
|
}
|
|
1089
1309
|
finally {
|
|
1090
1310
|
this.isWriting = false;
|
|
1091
1311
|
this.emitValue(false);
|
|
1312
|
+
this.onValidatorChange();
|
|
1092
1313
|
}
|
|
1093
1314
|
}
|
|
1094
1315
|
registerOnChange(fn) {
|
|
@@ -1097,6 +1318,12 @@ class ApiConfiguration {
|
|
|
1097
1318
|
registerOnTouched(fn) {
|
|
1098
1319
|
this.onTouched = fn;
|
|
1099
1320
|
}
|
|
1321
|
+
validate(_) {
|
|
1322
|
+
return this.form.valid ? null : { apiConfigurationInvalid: true };
|
|
1323
|
+
}
|
|
1324
|
+
registerOnValidatorChange(fn) {
|
|
1325
|
+
this.onValidatorChange = fn;
|
|
1326
|
+
}
|
|
1100
1327
|
setDisabledState(isDisabled) {
|
|
1101
1328
|
if (isDisabled) {
|
|
1102
1329
|
this.form.disable({ emitEvent: false });
|
|
@@ -1118,11 +1345,7 @@ class ApiConfiguration {
|
|
|
1118
1345
|
return;
|
|
1119
1346
|
}
|
|
1120
1347
|
const headers = this.headersToRecord();
|
|
1121
|
-
|
|
1122
|
-
endpoint: this.form.controls.endpoint.value,
|
|
1123
|
-
headers: Object.keys(headers).length ? headers : undefined,
|
|
1124
|
-
};
|
|
1125
|
-
this.facade.testApiConfiguration(payload).subscribe();
|
|
1348
|
+
this.loadApiFields(this.form.controls.endpoint.value, headers, true);
|
|
1126
1349
|
}
|
|
1127
1350
|
emitValue(triggerTouched = true) {
|
|
1128
1351
|
if (this.isWriting) {
|
|
@@ -1132,8 +1355,8 @@ class ApiConfiguration {
|
|
|
1132
1355
|
const value = {
|
|
1133
1356
|
endpoint: this.form.controls.endpoint.value,
|
|
1134
1357
|
headers,
|
|
1135
|
-
key: this.form.controls.key.value
|
|
1136
|
-
value: this.form.controls.value.value
|
|
1358
|
+
key: this.form.controls.key.value,
|
|
1359
|
+
value: this.form.controls.value.value,
|
|
1137
1360
|
supportMultiSelect: this.form.controls.supportMultiSelect.value,
|
|
1138
1361
|
schema: this.schema(),
|
|
1139
1362
|
};
|
|
@@ -1166,6 +1389,35 @@ class ApiConfiguration {
|
|
|
1166
1389
|
return acc;
|
|
1167
1390
|
}, {});
|
|
1168
1391
|
}
|
|
1392
|
+
loadApiFields(endpoint, headers, force = false) {
|
|
1393
|
+
const trimmedEndpoint = endpoint.trim();
|
|
1394
|
+
if (!trimmedEndpoint) {
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
const payload = {
|
|
1398
|
+
endpoint: trimmedEndpoint,
|
|
1399
|
+
headers: Object.keys(headers).length ? headers : undefined,
|
|
1400
|
+
};
|
|
1401
|
+
const payloadSignature = JSON.stringify(payload);
|
|
1402
|
+
if (!force && payloadSignature === this.lastLoadedPayloadSignature) {
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
this.lastLoadedPayloadSignature = payloadSignature;
|
|
1406
|
+
this.facade.testApiConfiguration(payload).subscribe();
|
|
1407
|
+
}
|
|
1408
|
+
mapSchemaToOptions(schema) {
|
|
1409
|
+
if (!schema?.properties) {
|
|
1410
|
+
return [];
|
|
1411
|
+
}
|
|
1412
|
+
return Object.entries(schema.properties).map(([key, definition]) => {
|
|
1413
|
+
const typeLabel = definition?.type ? ` | ${definition.type}` : '';
|
|
1414
|
+
return {
|
|
1415
|
+
key,
|
|
1416
|
+
name: `${key}${typeLabel}`,
|
|
1417
|
+
type: definition?.type,
|
|
1418
|
+
};
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1169
1421
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ApiConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1170
1422
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: ApiConfiguration, isStandalone: true, selector: "mt-api-configuration", providers: [
|
|
1171
1423
|
{
|
|
@@ -1173,7 +1425,12 @@ class ApiConfiguration {
|
|
|
1173
1425
|
useExisting: forwardRef(() => ApiConfiguration),
|
|
1174
1426
|
multi: true,
|
|
1175
1427
|
},
|
|
1176
|
-
|
|
1428
|
+
{
|
|
1429
|
+
provide: NG_VALIDATORS,
|
|
1430
|
+
useExisting: forwardRef(() => ApiConfiguration),
|
|
1431
|
+
multi: true,
|
|
1432
|
+
},
|
|
1433
|
+
], ngImport: i0, template: "<div [formGroup]=\"form\" class=\"space-y-6\">\n <div class=\"space-y-4 rounded-xl bg-content px-6 py-4 shadow-sm\">\n <div class=\"grid items-end gap-3 md:grid-cols-[minmax(0,1fr)_auto]\">\n <mt-text-field\n formControlName=\"endpoint\"\n [label]=\"'properties.form.endpoint' | transloco\"\n [placeholder]=\"'properties.form.endpointPlaceholder' | transloco\"\n />\n <div class=\"flex justify-end gap-2\">\n <mt-button\n type=\"button\"\n [text]=\"true\"\n icon=\"general.plus\"\n [label]=\"'properties.form.addHeader' | transloco\"\n (click)=\"addHeader()\"\n />\n <mt-button\n type=\"button\"\n [label]=\"'properties.form.testApi' | transloco\"\n [loading]=\"isTesting()\"\n (click)=\"testApi()\"\n />\n </div>\n </div>\n\n @if (headers.controls.length) {\n <div class=\"space-y-3\">\n <div class=\"text-sm font-medium text-surface-500\">\n {{ \"properties.form.headers\" | transloco }}\n </div>\n <div class=\"space-y-3\">\n @for (\n headerCtrl of headers.controls;\n track headerCtrl;\n let i = $index\n ) {\n <div\n [formGroup]=\"headerCtrl\"\n class=\"grid items-end gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]\"\n >\n <mt-text-field\n formControlName=\"key\"\n [label]=\"'properties.form.headerKey' | transloco\"\n />\n <mt-text-field\n formControlName=\"value\"\n [label]=\"'properties.form.headerValue' | transloco\"\n />\n <mt-button\n type=\"button\"\n [text]=\"true\"\n icon=\"general.trash-01\"\n (click)=\"removeHeader(i)\"\n />\n </div>\n }\n </div>\n </div>\n } @else {\n <p class=\"text-xs text-surface-400\">\n {{ \"properties.form.noHeadersMessage\" | transloco }}\n </p>\n }\n </div>\n\n <div class=\"space-y-4 rounded-xl bg-content px-6 py-4 shadow-sm\">\n @if (hasDetectedSchema()) {\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n formControlName=\"key\"\n [options]=\"resolvedApiProperties()\"\n [showClear]=\"true\"\n optionLabel=\"name\"\n optionValue=\"key\"\n [label]=\"'properties.form.keyField' | transloco\"\n />\n <mt-select-field\n formControlName=\"value\"\n [options]=\"resolvedApiProperties()\"\n [showClear]=\"true\"\n optionLabel=\"name\"\n optionValue=\"key\"\n [label]=\"'properties.form.valueField' | transloco\"\n />\n </div>\n } @else {\n <p class=\"text-xs text-surface-400\">\n {{ \"properties.form.messageTestApiPrompt\" | transloco }}\n </p>\n }\n\n <div class=\"flex items-center justify-between gap-4\">\n <mt-toggle-field\n formControlName=\"supportMultiSelect\"\n [label]=\"'properties.form.labelSupportMultiSelect' | transloco\"\n />\n @if (isTesting()) {\n <span class=\"text-xs text-surface-400\">\n {{ \"properties.form.messageTesting\" | transloco }}\n </span>\n }\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "icon", "iconPosition"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1177
1434
|
}
|
|
1178
1435
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ApiConfiguration, decorators: [{
|
|
1179
1436
|
type: Component,
|
|
@@ -1191,7 +1448,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
1191
1448
|
useExisting: forwardRef(() => ApiConfiguration),
|
|
1192
1449
|
multi: true,
|
|
1193
1450
|
},
|
|
1194
|
-
|
|
1451
|
+
{
|
|
1452
|
+
provide: NG_VALIDATORS,
|
|
1453
|
+
useExisting: forwardRef(() => ApiConfiguration),
|
|
1454
|
+
multi: true,
|
|
1455
|
+
},
|
|
1456
|
+
], template: "<div [formGroup]=\"form\" class=\"space-y-6\">\n <div class=\"space-y-4 rounded-xl bg-content px-6 py-4 shadow-sm\">\n <div class=\"grid items-end gap-3 md:grid-cols-[minmax(0,1fr)_auto]\">\n <mt-text-field\n formControlName=\"endpoint\"\n [label]=\"'properties.form.endpoint' | transloco\"\n [placeholder]=\"'properties.form.endpointPlaceholder' | transloco\"\n />\n <div class=\"flex justify-end gap-2\">\n <mt-button\n type=\"button\"\n [text]=\"true\"\n icon=\"general.plus\"\n [label]=\"'properties.form.addHeader' | transloco\"\n (click)=\"addHeader()\"\n />\n <mt-button\n type=\"button\"\n [label]=\"'properties.form.testApi' | transloco\"\n [loading]=\"isTesting()\"\n (click)=\"testApi()\"\n />\n </div>\n </div>\n\n @if (headers.controls.length) {\n <div class=\"space-y-3\">\n <div class=\"text-sm font-medium text-surface-500\">\n {{ \"properties.form.headers\" | transloco }}\n </div>\n <div class=\"space-y-3\">\n @for (\n headerCtrl of headers.controls;\n track headerCtrl;\n let i = $index\n ) {\n <div\n [formGroup]=\"headerCtrl\"\n class=\"grid items-end gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]\"\n >\n <mt-text-field\n formControlName=\"key\"\n [label]=\"'properties.form.headerKey' | transloco\"\n />\n <mt-text-field\n formControlName=\"value\"\n [label]=\"'properties.form.headerValue' | transloco\"\n />\n <mt-button\n type=\"button\"\n [text]=\"true\"\n icon=\"general.trash-01\"\n (click)=\"removeHeader(i)\"\n />\n </div>\n }\n </div>\n </div>\n } @else {\n <p class=\"text-xs text-surface-400\">\n {{ \"properties.form.noHeadersMessage\" | transloco }}\n </p>\n }\n </div>\n\n <div class=\"space-y-4 rounded-xl bg-content px-6 py-4 shadow-sm\">\n @if (hasDetectedSchema()) {\n <div class=\"grid gap-4 md:grid-cols-2\">\n <mt-select-field\n formControlName=\"key\"\n [options]=\"resolvedApiProperties()\"\n [showClear]=\"true\"\n optionLabel=\"name\"\n optionValue=\"key\"\n [label]=\"'properties.form.keyField' | transloco\"\n />\n <mt-select-field\n formControlName=\"value\"\n [options]=\"resolvedApiProperties()\"\n [showClear]=\"true\"\n optionLabel=\"name\"\n optionValue=\"key\"\n [label]=\"'properties.form.valueField' | transloco\"\n />\n </div>\n } @else {\n <p class=\"text-xs text-surface-400\">\n {{ \"properties.form.messageTestApiPrompt\" | transloco }}\n </p>\n }\n\n <div class=\"flex items-center justify-between gap-4\">\n <mt-toggle-field\n formControlName=\"supportMultiSelect\"\n [label]=\"'properties.form.labelSupportMultiSelect' | transloco\"\n />\n @if (isTesting()) {\n <span class=\"text-xs text-surface-400\">\n {{ \"properties.form.messageTesting\" | transloco }}\n </span>\n }\n </div>\n </div>\n</div>\n" }]
|
|
1195
1457
|
}], ctorParameters: () => [] });
|
|
1196
1458
|
|
|
1197
1459
|
class CheckListFormConfiguration {
|
|
@@ -1222,7 +1484,7 @@ class CheckListFormConfiguration {
|
|
|
1222
1484
|
key: 'lookup',
|
|
1223
1485
|
type: 'select',
|
|
1224
1486
|
label: this.transloco.translate('properties.form.selectLookup'),
|
|
1225
|
-
optionLabel: 'name',
|
|
1487
|
+
optionLabel: 'name.display',
|
|
1226
1488
|
optionValue: 'id',
|
|
1227
1489
|
filter: true,
|
|
1228
1490
|
options: this.lookups(),
|
|
@@ -1269,7 +1531,7 @@ class CheckListFormConfiguration {
|
|
|
1269
1531
|
this.propertiesFacade.resetConfigProperties();
|
|
1270
1532
|
}
|
|
1271
1533
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: CheckListFormConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1272
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: CheckListFormConfiguration, isStandalone: true, selector: "mt-check-list-form-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
1534
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: CheckListFormConfiguration, isStandalone: true, selector: "mt-check-list-form-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1273
1535
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1274
1536
|
] });
|
|
1275
1537
|
}
|
|
@@ -1280,18 +1542,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
1280
1542
|
], template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n" }]
|
|
1281
1543
|
}], ctorParameters: () => [] });
|
|
1282
1544
|
|
|
1283
|
-
class
|
|
1545
|
+
class EntityListConfiguration {
|
|
1284
1546
|
propertiesFacade = inject(PropertiesFacade);
|
|
1285
1547
|
controlContainer = inject(ControlContainer);
|
|
1286
1548
|
parentGroup = this.controlContainer.control;
|
|
1287
1549
|
transloco = inject(TranslocoService);
|
|
1550
|
+
previousModuleId = signal(null, ...(ngDevMode ? [{ debugName: "previousModuleId" }] : []));
|
|
1551
|
+
configurationControl = this.parentGroup.get('configuration');
|
|
1288
1552
|
configScopes = this.propertiesFacade.configScopes;
|
|
1289
1553
|
configProperties = this.propertiesFacade.configProperties;
|
|
1290
1554
|
configuration = toSignal(this.parentGroup.valueChanges.pipe(startWith(this.parentGroup.value), map((value) => value?.configuration), distinctUntilChanged()), { initialValue: this.parentGroup.value?.configuration });
|
|
1291
|
-
|
|
1555
|
+
moduleItems = computed(() => {
|
|
1292
1556
|
const scope = this.configScopes()[0];
|
|
1293
1557
|
return scope?.items ?? [];
|
|
1294
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1558
|
+
}, ...(ngDevMode ? [{ debugName: "moduleItems" }] : []));
|
|
1559
|
+
accessOptions = [
|
|
1560
|
+
{ label: 'Auto', value: 'Auto' },
|
|
1561
|
+
{ label: 'Read', value: 'Read' },
|
|
1562
|
+
{ label: 'Write', value: 'Write' },
|
|
1563
|
+
{ label: 'ReadWrite', value: 'ReadWrite' },
|
|
1564
|
+
{ label: 'None', value: 'None' },
|
|
1565
|
+
];
|
|
1566
|
+
snapshotModeOptions = [
|
|
1567
|
+
{ label: 'Snapshot', value: 'Snapshot' },
|
|
1568
|
+
{ label: 'Realtime', value: 'Realtime' },
|
|
1569
|
+
];
|
|
1295
1570
|
formConfig = linkedSignal(() => ({
|
|
1296
1571
|
sections: [
|
|
1297
1572
|
{
|
|
@@ -1304,239 +1579,99 @@ class DynamicListConfiguration {
|
|
|
1304
1579
|
bodyClass: 'grid grid-cols-1 md:grid-cols-2 gap-3',
|
|
1305
1580
|
fields: [
|
|
1306
1581
|
{
|
|
1307
|
-
key: '
|
|
1582
|
+
key: 'moduleId',
|
|
1308
1583
|
type: 'select',
|
|
1309
1584
|
label: this.transloco.translate('properties.form.selectScope'),
|
|
1310
1585
|
optionLabel: 'name',
|
|
1311
1586
|
optionValue: 'id',
|
|
1587
|
+
options: this.moduleItems(),
|
|
1312
1588
|
filter: true,
|
|
1313
|
-
options: this.scopeItems(),
|
|
1314
1589
|
},
|
|
1315
|
-
new PickListFieldConfig({
|
|
1316
|
-
key: 'properties',
|
|
1317
|
-
cssClass: 'md:col-span-2',
|
|
1318
|
-
options: this.configProperties(),
|
|
1319
|
-
optionLabel: 'name.display',
|
|
1320
|
-
optionValue: 'key',
|
|
1321
|
-
sourceHeader: this.transloco.translate('properties.form.availableProperties'),
|
|
1322
|
-
targetHeader: this.transloco.translate('properties.form.selectedProperties'),
|
|
1323
|
-
}),
|
|
1324
1590
|
{
|
|
1325
|
-
key: '
|
|
1326
|
-
type: '
|
|
1327
|
-
label:
|
|
1328
|
-
|
|
1591
|
+
key: 'access',
|
|
1592
|
+
type: 'select',
|
|
1593
|
+
label: 'Access',
|
|
1594
|
+
optionLabel: 'label',
|
|
1595
|
+
optionValue: 'value',
|
|
1596
|
+
options: this.accessOptions,
|
|
1329
1597
|
},
|
|
1330
|
-
],
|
|
1331
|
-
},
|
|
1332
|
-
],
|
|
1333
|
-
}), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
1334
|
-
constructor() {
|
|
1335
|
-
effect(() => {
|
|
1336
|
-
const scopeId = this.configuration()?.scopeId;
|
|
1337
|
-
if (scopeId) {
|
|
1338
|
-
const scopeType = this.configScopes()[0]?.scope;
|
|
1339
|
-
if (scopeType) {
|
|
1340
|
-
this.propertiesFacade.loadPropertiesForConfigType(scopeType, scopeId);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
ngOnDestroy() {
|
|
1346
|
-
this.propertiesFacade.resetConfigProperties();
|
|
1347
|
-
}
|
|
1348
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: DynamicListConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1349
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: DynamicListConfiguration, isStandalone: true, selector: "mt-dynamic-list-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1350
|
-
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1351
|
-
] });
|
|
1352
|
-
}
|
|
1353
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: DynamicListConfiguration, decorators: [{
|
|
1354
|
-
type: Component,
|
|
1355
|
-
args: [{ selector: 'mt-dynamic-list-configuration', imports: [DynamicForm, ReactiveFormsModule], viewProviders: [
|
|
1356
|
-
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1357
|
-
], template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n" }]
|
|
1358
|
-
}], ctorParameters: () => [] });
|
|
1359
|
-
|
|
1360
|
-
class EditableListViewConfiguration {
|
|
1361
|
-
propertiesFacade = inject(PropertiesFacade);
|
|
1362
|
-
controlContainer = inject(ControlContainer);
|
|
1363
|
-
parentGroup = this.controlContainer.control;
|
|
1364
|
-
transloco = inject(TranslocoService);
|
|
1365
|
-
configScopes = this.propertiesFacade.configScopes;
|
|
1366
|
-
configProperties = this.propertiesFacade.configProperties;
|
|
1367
|
-
configuration = toSignal(this.parentGroup.valueChanges.pipe(startWith(this.parentGroup.value), map((value) => value?.configuration), distinctUntilChanged()), { initialValue: this.parentGroup.value?.configuration });
|
|
1368
|
-
scopeItems = computed(() => {
|
|
1369
|
-
const scope = this.configScopes()[0];
|
|
1370
|
-
return scope?.items ?? [];
|
|
1371
|
-
}, ...(ngDevMode ? [{ debugName: "scopeItems" }] : []));
|
|
1372
|
-
formConfig = linkedSignal(() => ({
|
|
1373
|
-
sections: [
|
|
1374
|
-
{
|
|
1375
|
-
key: 'configuration',
|
|
1376
|
-
label: this.transloco.translate('properties.form.configurationSection'),
|
|
1377
|
-
cssClass: ' rounded-xl bg-content \
|
|
1378
|
-
shadow-sm \
|
|
1379
|
-
px-6 py-4',
|
|
1380
|
-
type: 'header',
|
|
1381
|
-
bodyClass: 'grid grid-cols-1 md:grid-cols-2 gap-3',
|
|
1382
|
-
fields: [
|
|
1383
1598
|
{
|
|
1384
|
-
key: '
|
|
1599
|
+
key: 'snapshotMode',
|
|
1385
1600
|
type: 'select',
|
|
1386
|
-
label:
|
|
1387
|
-
optionLabel: '
|
|
1388
|
-
optionValue: '
|
|
1389
|
-
options: this.
|
|
1601
|
+
label: 'Snapshot Mode',
|
|
1602
|
+
optionLabel: 'label',
|
|
1603
|
+
optionValue: 'value',
|
|
1604
|
+
options: this.snapshotModeOptions,
|
|
1390
1605
|
},
|
|
1391
1606
|
new PickListFieldConfig({
|
|
1392
|
-
key: '
|
|
1607
|
+
key: 'readFields',
|
|
1393
1608
|
cssClass: 'md:col-span-2',
|
|
1394
1609
|
options: this.configProperties(),
|
|
1395
1610
|
optionLabel: 'name.display',
|
|
1396
1611
|
optionValue: 'key',
|
|
1397
|
-
sourceHeader:
|
|
1398
|
-
targetHeader:
|
|
1612
|
+
sourceHeader: 'Available Read Fields',
|
|
1613
|
+
targetHeader: 'Selected Read Fields',
|
|
1399
1614
|
}),
|
|
1400
|
-
{
|
|
1401
|
-
key: 'isEditable',
|
|
1402
|
-
type: 'toggle',
|
|
1403
|
-
label: this.transloco.translate('properties.form.isEditable'),
|
|
1404
|
-
},
|
|
1405
|
-
{
|
|
1406
|
-
key: 'preserveValue',
|
|
1407
|
-
type: 'toggle',
|
|
1408
|
-
label: this.transloco.translate('properties.form.preserveValue'),
|
|
1409
|
-
},
|
|
1410
|
-
],
|
|
1411
|
-
},
|
|
1412
|
-
],
|
|
1413
|
-
}), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
1414
|
-
constructor() {
|
|
1415
|
-
effect(() => {
|
|
1416
|
-
const scopeId = this.configuration()?.scopeId;
|
|
1417
|
-
if (scopeId) {
|
|
1418
|
-
const scopeType = this.configScopes()[0]?.scope;
|
|
1419
|
-
if (scopeType) {
|
|
1420
|
-
this.propertiesFacade.loadPropertiesForConfigType(scopeType, scopeId);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
ngOnDestroy() {
|
|
1426
|
-
this.propertiesFacade.resetConfigProperties();
|
|
1427
|
-
}
|
|
1428
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EditableListViewConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1429
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: EditableListViewConfiguration, isStandalone: true, selector: "mt-editable-list-view-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1430
|
-
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1431
|
-
] });
|
|
1432
|
-
}
|
|
1433
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EditableListViewConfiguration, decorators: [{
|
|
1434
|
-
type: Component,
|
|
1435
|
-
args: [{ selector: 'mt-editable-list-view-configuration', imports: [DynamicForm, ReactiveFormsModule], viewProviders: [
|
|
1436
|
-
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1437
|
-
], template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n" }]
|
|
1438
|
-
}], ctorParameters: () => [] });
|
|
1439
|
-
|
|
1440
|
-
class InternalModuleConfiguration {
|
|
1441
|
-
// private readonly workspaceStructureFacade = inject(WorkspaceStructureFacade);
|
|
1442
|
-
// = this.workspaceStructureFacade.workspaceNodes;
|
|
1443
|
-
levels;
|
|
1444
|
-
propertiesFacade = inject(PropertiesFacade);
|
|
1445
|
-
cc = inject(ControlContainer);
|
|
1446
|
-
transloco = inject(TranslocoService);
|
|
1447
|
-
parentGroup = this.cc.control;
|
|
1448
|
-
configProperties = this.propertiesFacade.configProperties;
|
|
1449
|
-
configScopes = this.propertiesFacade.configScopes;
|
|
1450
|
-
configuration = toSignal(this.parentGroup.valueChanges.pipe(startWith(this.parentGroup.value), map((v) => v?.configuration), distinctUntilChanged()), { initialValue: this.parentGroup.value?.configuration });
|
|
1451
|
-
PrevModuleId = signal(null, ...(ngDevMode ? [{ debugName: "PrevModuleId" }] : []));
|
|
1452
|
-
scopeItems = computed(() => {
|
|
1453
|
-
const selectedType = this.configuration()?.type;
|
|
1454
|
-
if (!selectedType)
|
|
1455
|
-
return [];
|
|
1456
|
-
const scope = this.configScopes().find((s) => s.scope === selectedType);
|
|
1457
|
-
return scope?.items ?? [];
|
|
1458
|
-
}, ...(ngDevMode ? [{ debugName: "scopeItems" }] : []));
|
|
1459
|
-
formConfig = linkedSignal(() => ({
|
|
1460
|
-
sections: [
|
|
1461
|
-
{
|
|
1462
|
-
key: 'configuration',
|
|
1463
|
-
label: this.transloco.translate('properties.form.configurationSection'),
|
|
1464
|
-
cssClass: ' rounded-xl bg-content \
|
|
1465
|
-
shadow-sm \
|
|
1466
|
-
px-6 py-4',
|
|
1467
|
-
type: 'header',
|
|
1468
|
-
bodyClass: 'grid grid-cols-1 md:grid-cols-2 gap-3 align-items-end ',
|
|
1469
|
-
fields: [
|
|
1470
|
-
{
|
|
1471
|
-
key: 'type',
|
|
1472
|
-
type: 'select',
|
|
1473
|
-
label: this.transloco.translate('properties.form.type'),
|
|
1474
|
-
optionLabel: 'scope',
|
|
1475
|
-
optionValue: 'scope',
|
|
1476
|
-
options: this.configScopes(),
|
|
1477
|
-
},
|
|
1478
|
-
{
|
|
1479
|
-
key: 'scopeId',
|
|
1480
|
-
type: 'select',
|
|
1481
|
-
label: this.transloco.translate('properties.form.selectScope'),
|
|
1482
|
-
optionLabel: 'name',
|
|
1483
|
-
optionValue: 'id',
|
|
1484
|
-
filter: true,
|
|
1485
|
-
options: this.scopeItems(),
|
|
1486
|
-
},
|
|
1487
|
-
{
|
|
1488
|
-
type: 'select',
|
|
1489
|
-
key: 'property',
|
|
1490
|
-
label: this.transloco.translate('properties.form.valueProperty'),
|
|
1491
|
-
optionLabel: 'name.display',
|
|
1492
|
-
optionValue: 'key',
|
|
1493
|
-
options: this.configProperties(),
|
|
1494
|
-
},
|
|
1495
1615
|
new PickListFieldConfig({
|
|
1496
|
-
|
|
1497
|
-
|
|
1616
|
+
key: 'writeFields',
|
|
1617
|
+
cssClass: 'md:col-span-2',
|
|
1498
1618
|
options: this.configProperties(),
|
|
1499
1619
|
optionLabel: 'name.display',
|
|
1500
1620
|
optionValue: 'key',
|
|
1501
|
-
sourceHeader:
|
|
1502
|
-
targetHeader:
|
|
1621
|
+
sourceHeader: 'Available Write Fields',
|
|
1622
|
+
targetHeader: 'Selected Write Fields',
|
|
1623
|
+
relations: [
|
|
1624
|
+
{ action: 'show', key: 'access', value: 'Write' },
|
|
1625
|
+
{ action: 'show', key: 'access', value: 'ReadWrite' },
|
|
1626
|
+
{ action: 'show', key: 'access', value: 'Auto' },
|
|
1627
|
+
],
|
|
1503
1628
|
}),
|
|
1504
|
-
{
|
|
1505
|
-
cssClass: 'md:col-span-2',
|
|
1506
|
-
key: 'preserveValue',
|
|
1507
|
-
type: 'toggle',
|
|
1508
|
-
label: this.transloco.translate('properties.form.labelPreserveValue'),
|
|
1509
|
-
},
|
|
1510
1629
|
],
|
|
1511
1630
|
},
|
|
1512
1631
|
],
|
|
1513
1632
|
}), ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
1514
1633
|
constructor() {
|
|
1634
|
+
this.applyEntityListDefaults();
|
|
1635
|
+
this.loadModuleProperties();
|
|
1636
|
+
}
|
|
1637
|
+
applyEntityListDefaults() {
|
|
1638
|
+
const config = this.configurationControl.value;
|
|
1639
|
+
if (config)
|
|
1640
|
+
return;
|
|
1641
|
+
this.configurationControl.setValue({
|
|
1642
|
+
moduleId: 0,
|
|
1643
|
+
access: 'Auto',
|
|
1644
|
+
snapshotMode: 'Snapshot',
|
|
1645
|
+
readFields: [],
|
|
1646
|
+
writeFields: [],
|
|
1647
|
+
}, { emitEvent: true });
|
|
1648
|
+
}
|
|
1649
|
+
loadModuleProperties() {
|
|
1515
1650
|
effect(() => {
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
return;
|
|
1521
|
-
}
|
|
1522
|
-
if (moduleType && moduleId) {
|
|
1523
|
-
this.PrevModuleId.set(moduleId);
|
|
1524
|
-
this.propertiesFacade.loadPropertiesForConfigType(moduleType, moduleId);
|
|
1525
|
-
}
|
|
1651
|
+
const config = this.configuration();
|
|
1652
|
+
const moduleId = config?.moduleId;
|
|
1653
|
+
if (!moduleId || moduleId === this.previousModuleId()) {
|
|
1654
|
+
return;
|
|
1526
1655
|
}
|
|
1656
|
+
const scopeType = this.configScopes()[0]?.scope;
|
|
1657
|
+
if (!scopeType) {
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
this.previousModuleId.set(moduleId);
|
|
1661
|
+
this.propertiesFacade.loadPropertiesForConfigType(scopeType, moduleId);
|
|
1527
1662
|
});
|
|
1528
1663
|
}
|
|
1529
1664
|
ngOnDestroy() {
|
|
1530
1665
|
this.propertiesFacade.resetConfigProperties();
|
|
1531
1666
|
}
|
|
1532
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type:
|
|
1533
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type:
|
|
1667
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EntityListConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1668
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: EntityListConfiguration, isStandalone: true, selector: "mt-entity-list-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1534
1669
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1535
1670
|
] });
|
|
1536
1671
|
}
|
|
1537
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type:
|
|
1672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EntityListConfiguration, decorators: [{
|
|
1538
1673
|
type: Component,
|
|
1539
|
-
args: [{ selector: 'mt-
|
|
1674
|
+
args: [{ selector: 'mt-entity-list-configuration', imports: [DynamicForm, ReactiveFormsModule], viewProviders: [
|
|
1540
1675
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1541
1676
|
], template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n" }]
|
|
1542
1677
|
}], ctorParameters: () => [] });
|
|
@@ -1577,7 +1712,7 @@ class LocationConfiguration {
|
|
|
1577
1712
|
});
|
|
1578
1713
|
}
|
|
1579
1714
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: LocationConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1580
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: LocationConfiguration, isStandalone: true, selector: "mt-location-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
1715
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: LocationConfiguration, isStandalone: true, selector: "mt-location-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1581
1716
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1582
1717
|
] });
|
|
1583
1718
|
}
|
|
@@ -1624,7 +1759,7 @@ class LookupConfiguration {
|
|
|
1624
1759
|
});
|
|
1625
1760
|
}
|
|
1626
1761
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: LookupConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1627
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: LookupConfiguration, isStandalone: true, selector: "mt-lookup-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
1762
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: LookupConfiguration, isStandalone: true, selector: "mt-lookup-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1628
1763
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1629
1764
|
] });
|
|
1630
1765
|
}
|
|
@@ -1658,7 +1793,7 @@ class PercentageConfiguration {
|
|
|
1658
1793
|
],
|
|
1659
1794
|
}, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
1660
1795
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PercentageConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1661
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: PercentageConfiguration, isStandalone: true, selector: "mt-percentage-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
1796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: PercentageConfiguration, isStandalone: true, selector: "mt-percentage-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1662
1797
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1663
1798
|
] });
|
|
1664
1799
|
}
|
|
@@ -1669,6 +1804,344 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
1669
1804
|
], template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n" }]
|
|
1670
1805
|
}] });
|
|
1671
1806
|
|
|
1807
|
+
class StatusItemForm {
|
|
1808
|
+
modal = inject(ModalService);
|
|
1809
|
+
ref = inject(ModalRef);
|
|
1810
|
+
facade = inject(PropertiesFacade);
|
|
1811
|
+
transloco = inject(TranslocoService);
|
|
1812
|
+
propertyId = input.required(...(ngDevMode ? [{ debugName: "propertyId" }] : []));
|
|
1813
|
+
levelSchemaId = input(undefined, ...(ngDevMode ? [{ debugName: "levelSchemaId" }] : []));
|
|
1814
|
+
statusData = input(null, ...(ngDevMode ? [{ debugName: "statusData" }] : []));
|
|
1815
|
+
editMode = computed(() => !!this.statusData(), ...(ngDevMode ? [{ debugName: "editMode" }] : []));
|
|
1816
|
+
isSubmitting = computed(() => this.editMode()
|
|
1817
|
+
? this.facade.isUpdatingPropertyStatus()
|
|
1818
|
+
: this.facade.isCreatingPropertyStatus(), ...(ngDevMode ? [{ debugName: "isSubmitting" }] : []));
|
|
1819
|
+
buttonLabel = computed(() => this.editMode()
|
|
1820
|
+
? this.transloco.translate('properties.form.statusUpdateButton')
|
|
1821
|
+
: this.transloco.translate('properties.form.statusCreateButton'), ...(ngDevMode ? [{ debugName: "buttonLabel" }] : []));
|
|
1822
|
+
statusFormConfig = linkedSignal(() => ({
|
|
1823
|
+
sections: [
|
|
1824
|
+
{
|
|
1825
|
+
key: 'statusItemForm',
|
|
1826
|
+
type: 'header',
|
|
1827
|
+
columns: 12,
|
|
1828
|
+
fields: [
|
|
1829
|
+
{
|
|
1830
|
+
key: 'display.en',
|
|
1831
|
+
colSpan: 6,
|
|
1832
|
+
label: this.transloco.translate('properties.form.statusEnglishDisplay'),
|
|
1833
|
+
validators: [ValidatorConfig.required()],
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
key: 'display.ar',
|
|
1837
|
+
colSpan: 6,
|
|
1838
|
+
label: this.transloco.translate('properties.form.statusArabicDisplay'),
|
|
1839
|
+
validators: [ValidatorConfig.required()],
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
key: 'description.en',
|
|
1843
|
+
type: 'textarea',
|
|
1844
|
+
colSpan: 6,
|
|
1845
|
+
label: this.transloco.translate('properties.form.statusEnglishDescription'),
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
key: 'description.ar',
|
|
1849
|
+
type: 'textarea',
|
|
1850
|
+
colSpan: 6,
|
|
1851
|
+
label: this.transloco.translate('properties.form.statusArabicDescription'),
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
key: 'type',
|
|
1855
|
+
type: 'select',
|
|
1856
|
+
colSpan: 4,
|
|
1857
|
+
label: this.transloco.translate('properties.form.statusType'),
|
|
1858
|
+
optionLabel: 'label',
|
|
1859
|
+
optionValue: 'value',
|
|
1860
|
+
options: [
|
|
1861
|
+
{ label: 'Performance', value: 'Performance' },
|
|
1862
|
+
{ label: 'NonePerformance', value: 'NonePerformance' },
|
|
1863
|
+
],
|
|
1864
|
+
},
|
|
1865
|
+
new ColorPickerFieldConfig({
|
|
1866
|
+
key: 'color',
|
|
1867
|
+
colSpan: 4,
|
|
1868
|
+
label: this.transloco.translate('properties.form.statusColor'),
|
|
1869
|
+
}),
|
|
1870
|
+
new IconFieldConfig({
|
|
1871
|
+
key: 'icon',
|
|
1872
|
+
colSpan: 4,
|
|
1873
|
+
label: this.transloco.translate('properties.form.statusIcon'),
|
|
1874
|
+
}),
|
|
1875
|
+
],
|
|
1876
|
+
},
|
|
1877
|
+
],
|
|
1878
|
+
}), ...(ngDevMode ? [{ debugName: "statusFormConfig" }] : []));
|
|
1879
|
+
statusFormControl = new FormControl({
|
|
1880
|
+
display: {
|
|
1881
|
+
en: '',
|
|
1882
|
+
ar: '',
|
|
1883
|
+
},
|
|
1884
|
+
description: {
|
|
1885
|
+
en: '',
|
|
1886
|
+
ar: '',
|
|
1887
|
+
},
|
|
1888
|
+
type: 'Performance',
|
|
1889
|
+
color: '#64748b',
|
|
1890
|
+
icon: '',
|
|
1891
|
+
}, { nonNullable: true });
|
|
1892
|
+
formulaControl = new FormControl(null);
|
|
1893
|
+
statusType = toSignal(this.statusFormControl.valueChanges.pipe(startWith(this.statusFormControl.value), map((value) => value?.type ?? 'Performance')), {
|
|
1894
|
+
initialValue: this.statusFormControl.value?.type ?? 'Performance',
|
|
1895
|
+
});
|
|
1896
|
+
showFormula = computed(() => this.statusType() === 'Performance', ...(ngDevMode ? [{ debugName: "showFormula" }] : []));
|
|
1897
|
+
constructor() {
|
|
1898
|
+
effect(() => {
|
|
1899
|
+
if (this.showFormula()) {
|
|
1900
|
+
this.formulaControl.setValidators(Validators.required);
|
|
1901
|
+
}
|
|
1902
|
+
else {
|
|
1903
|
+
this.formulaControl.clearValidators();
|
|
1904
|
+
}
|
|
1905
|
+
this.formulaControl.updateValueAndValidity({ emitEvent: false });
|
|
1906
|
+
});
|
|
1907
|
+
effect(() => {
|
|
1908
|
+
const status = this.statusData();
|
|
1909
|
+
if (!status) {
|
|
1910
|
+
this.statusFormControl.patchValue({
|
|
1911
|
+
display: {
|
|
1912
|
+
en: '',
|
|
1913
|
+
ar: '',
|
|
1914
|
+
},
|
|
1915
|
+
description: {
|
|
1916
|
+
en: '',
|
|
1917
|
+
ar: '',
|
|
1918
|
+
},
|
|
1919
|
+
type: 'Performance',
|
|
1920
|
+
color: '#64748b',
|
|
1921
|
+
icon: '',
|
|
1922
|
+
}, {
|
|
1923
|
+
emitEvent: false,
|
|
1924
|
+
});
|
|
1925
|
+
this.formulaControl.patchValue(null, {
|
|
1926
|
+
emitEvent: false,
|
|
1927
|
+
});
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
this.statusFormControl.patchValue({
|
|
1931
|
+
display: {
|
|
1932
|
+
en: status.display?.['en'] ?? '',
|
|
1933
|
+
ar: status.display?.['ar'] ?? '',
|
|
1934
|
+
},
|
|
1935
|
+
description: {
|
|
1936
|
+
en: status.description?.['en'] ?? '',
|
|
1937
|
+
ar: status.description?.['ar'] ?? '',
|
|
1938
|
+
},
|
|
1939
|
+
type: status.type ?? 'Performance',
|
|
1940
|
+
color: status.color ?? '#64748b',
|
|
1941
|
+
icon: status.icon ?? '',
|
|
1942
|
+
}, { emitEvent: false });
|
|
1943
|
+
this.formulaControl.patchValue(status.formula, {
|
|
1944
|
+
emitEvent: false,
|
|
1945
|
+
});
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
onSubmit() {
|
|
1949
|
+
if (this.statusFormControl.invalid || this.isSubmitting()) {
|
|
1950
|
+
this.statusFormControl.markAllAsTouched();
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
if (this.showFormula() && this.formulaControl.invalid) {
|
|
1954
|
+
this.formulaControl.markAsTouched();
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
const value = this.statusFormControl.value;
|
|
1958
|
+
const payload = {
|
|
1959
|
+
type: value.type,
|
|
1960
|
+
display: value.display,
|
|
1961
|
+
description: value.description,
|
|
1962
|
+
color: value.color,
|
|
1963
|
+
icon: value.icon,
|
|
1964
|
+
formula: this.showFormula() ? this.formulaControl.value : null,
|
|
1965
|
+
};
|
|
1966
|
+
const request$ = this.editMode() && this.statusData()
|
|
1967
|
+
? this.facade.updatePropertyStatus(this.propertyId(), this.statusData().id, payload)
|
|
1968
|
+
: this.facade.createPropertyStatus(this.propertyId(), payload);
|
|
1969
|
+
request$.subscribe(() => {
|
|
1970
|
+
this.ref.close({ success: true });
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: StatusItemForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1974
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: StatusItemForm, isStandalone: true, selector: "mt-status-item-form", inputs: { propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: true, transformFunction: null }, levelSchemaId: { classPropertyName: "levelSchemaId", publicName: "levelSchemaId", isSignal: true, isRequired: false, transformFunction: null }, statusData: { classPropertyName: "statusData", publicName: "statusData", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n [class]=\"\n 'flex max-h-[75vh] flex-col gap-4 overflow-y-auto p-4 my-4 ' +\n modal.contentClass\n \"\n>\n <form class=\"space-y-6\">\n <mt-dynamic-form\n class=\"block\"\n [formConfig]=\"statusFormConfig()\"\n [formControl]=\"statusFormControl\"\n />\n\n @if (showFormula()) {\n <div class=\"rounded-xl border border-surface-200 bg-content px-4 py-4\">\n <div class=\"mb-3 text-sm font-medium text-surface-700\">\n {{ \"properties.form.statusFormula\" | transloco }}\n </div>\n\n <mt-formula-builder\n [formControl]=\"formulaControl\"\n [levelSchemaId]=\"levelSchemaId()\"\n />\n </div>\n }\n </form>\n</div>\n\n<div [class]=\"modal.footerClass\" class=\"mt-7\">\n <mt-button\n [label]=\"buttonLabel()\"\n (click)=\"onSubmit()\"\n [loading]=\"isSubmitting()\"\n [disabled]=\"\n statusFormControl.invalid ||\n (showFormula() && formulaControl.invalid) ||\n isSubmitting()\n \"\n />\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "component", type: FormulaBuilder, selector: "mt-formula-builder", inputs: ["propertiesByPath", "levelSchemaId", "templateId", "placeholder", "hideToolbar", "hideStatusBar"], outputs: ["validationChange", "tokensChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
1975
|
+
}
|
|
1976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: StatusItemForm, decorators: [{
|
|
1977
|
+
type: Component,
|
|
1978
|
+
args: [{ selector: 'mt-status-item-form', standalone: true, imports: [
|
|
1979
|
+
CommonModule,
|
|
1980
|
+
Button,
|
|
1981
|
+
DynamicForm,
|
|
1982
|
+
FormulaBuilder,
|
|
1983
|
+
ReactiveFormsModule,
|
|
1984
|
+
TranslocoModule,
|
|
1985
|
+
], template: "<div\n [class]=\"\n 'flex max-h-[75vh] flex-col gap-4 overflow-y-auto p-4 my-4 ' +\n modal.contentClass\n \"\n>\n <form class=\"space-y-6\">\n <mt-dynamic-form\n class=\"block\"\n [formConfig]=\"statusFormConfig()\"\n [formControl]=\"statusFormControl\"\n />\n\n @if (showFormula()) {\n <div class=\"rounded-xl border border-surface-200 bg-content px-4 py-4\">\n <div class=\"mb-3 text-sm font-medium text-surface-700\">\n {{ \"properties.form.statusFormula\" | transloco }}\n </div>\n\n <mt-formula-builder\n [formControl]=\"formulaControl\"\n [levelSchemaId]=\"levelSchemaId()\"\n />\n </div>\n }\n </form>\n</div>\n\n<div [class]=\"modal.footerClass\" class=\"mt-7\">\n <mt-button\n [label]=\"buttonLabel()\"\n (click)=\"onSubmit()\"\n [loading]=\"isSubmitting()\"\n [disabled]=\"\n statusFormControl.invalid ||\n (showFormula() && formulaControl.invalid) ||\n isSubmitting()\n \"\n />\n</div>\n" }]
|
|
1986
|
+
}], ctorParameters: () => [], propDecorators: { propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: true }] }], levelSchemaId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelSchemaId", required: false }] }], statusData: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusData", required: false }] }] } });
|
|
1987
|
+
|
|
1988
|
+
class StatusConfiguration {
|
|
1989
|
+
facade = inject(PropertiesFacade);
|
|
1990
|
+
modalService = inject(ModalService);
|
|
1991
|
+
transloco = inject(TranslocoService);
|
|
1992
|
+
lastLoadedPropertyId = signal(null, ...(ngDevMode ? [{ debugName: "lastLoadedPropertyId" }] : []));
|
|
1993
|
+
propertyId = input(null, ...(ngDevMode ? [{ debugName: "propertyId" }] : []));
|
|
1994
|
+
levelSchemaId = input(undefined, ...(ngDevMode ? [{ debugName: "levelSchemaId" }] : []));
|
|
1995
|
+
deletingRowIds = signal([], ...(ngDevMode ? [{ debugName: "deletingRowIds" }] : []));
|
|
1996
|
+
statuses = computed(() => [...this.facade.propertyStatuses()].sort((left, right) => {
|
|
1997
|
+
const leftOrder = left.order ?? Number.MAX_SAFE_INTEGER;
|
|
1998
|
+
const rightOrder = right.order ?? Number.MAX_SAFE_INTEGER;
|
|
1999
|
+
if (leftOrder !== rightOrder) {
|
|
2000
|
+
return leftOrder - rightOrder;
|
|
2001
|
+
}
|
|
2002
|
+
return left.id - right.id;
|
|
2003
|
+
}), ...(ngDevMode ? [{ debugName: "statuses" }] : []));
|
|
2004
|
+
loading = this.facade.isLoadingPropertyStatuses;
|
|
2005
|
+
reordering = this.facade.isReorderingPropertyStatuses;
|
|
2006
|
+
resolvedPropertyId = computed(() => this.normalizePropertyId(this.propertyId()), ...(ngDevMode ? [{ debugName: "resolvedPropertyId" }] : []));
|
|
2007
|
+
canManageStatuses = computed(() => !!this.resolvedPropertyId(), ...(ngDevMode ? [{ debugName: "canManageStatuses" }] : []));
|
|
2008
|
+
tableColumns = linkedSignal(() => [
|
|
2009
|
+
{
|
|
2010
|
+
key: 'display.en',
|
|
2011
|
+
label: this.transloco.translate('properties.form.statusColumnDisplay'),
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
key: 'key',
|
|
2015
|
+
label: this.transloco.translate('properties.form.statusColumnKey'),
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
key: 'type',
|
|
2019
|
+
label: this.transloco.translate('properties.form.statusColumnType'),
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
key: 'color',
|
|
2023
|
+
label: this.transloco.translate('properties.form.statusColumnColor'),
|
|
2024
|
+
},
|
|
2025
|
+
{
|
|
2026
|
+
key: 'icon',
|
|
2027
|
+
label: this.transloco.translate('properties.form.statusColumnIcon'),
|
|
2028
|
+
},
|
|
2029
|
+
], ...(ngDevMode ? [{ debugName: "tableColumns" }] : []));
|
|
2030
|
+
tableActions = computed(() => {
|
|
2031
|
+
if (!this.canManageStatuses()) {
|
|
2032
|
+
return [];
|
|
2033
|
+
}
|
|
2034
|
+
return [
|
|
2035
|
+
{
|
|
2036
|
+
icon: 'general.plus',
|
|
2037
|
+
label: this.transloco.translate('properties.form.statusAddAction'),
|
|
2038
|
+
color: 'primary',
|
|
2039
|
+
action: () => this.openStatusDialog(),
|
|
2040
|
+
},
|
|
2041
|
+
];
|
|
2042
|
+
}, ...(ngDevMode ? [{ debugName: "tableActions" }] : []));
|
|
2043
|
+
rowActions = computed(() => {
|
|
2044
|
+
const propertyId = this.resolvedPropertyId();
|
|
2045
|
+
if (!propertyId) {
|
|
2046
|
+
return [];
|
|
2047
|
+
}
|
|
2048
|
+
return [
|
|
2049
|
+
{
|
|
2050
|
+
icon: 'custom.pencil',
|
|
2051
|
+
tooltip: this.transloco.translate('properties.form.statusEditAction'),
|
|
2052
|
+
color: 'primary',
|
|
2053
|
+
action: (row) => this.openStatusDialog(row),
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
icon: 'general.trash-01',
|
|
2057
|
+
tooltip: this.transloco.translate('properties.form.statusDeleteAction'),
|
|
2058
|
+
color: 'danger',
|
|
2059
|
+
variant: 'outlined',
|
|
2060
|
+
action: (row) => this.deleteStatus(row),
|
|
2061
|
+
confirmation: {
|
|
2062
|
+
type: 'popup',
|
|
2063
|
+
confirmationType: 'delete',
|
|
2064
|
+
},
|
|
2065
|
+
loading: (row) => this.deletingRowIds().includes(row.id),
|
|
2066
|
+
},
|
|
2067
|
+
];
|
|
2068
|
+
}, ...(ngDevMode ? [{ debugName: "rowActions" }] : []));
|
|
2069
|
+
constructor() {
|
|
2070
|
+
effect(() => {
|
|
2071
|
+
const propertyId = this.resolvedPropertyId();
|
|
2072
|
+
if (!propertyId) {
|
|
2073
|
+
this.lastLoadedPropertyId.set(null);
|
|
2074
|
+
this.facade.resetPropertyStatuses().subscribe();
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2077
|
+
if (this.lastLoadedPropertyId() === propertyId) {
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
this.lastLoadedPropertyId.set(propertyId);
|
|
2081
|
+
this.facade.resetPropertyStatuses().subscribe();
|
|
2082
|
+
this.facade.loadPropertyStatuses(propertyId).subscribe();
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
ngOnDestroy() {
|
|
2086
|
+
this.facade.resetPropertyStatuses().subscribe();
|
|
2087
|
+
}
|
|
2088
|
+
openStatusDialog(statusData = null) {
|
|
2089
|
+
const propertyId = this.resolvedPropertyId();
|
|
2090
|
+
if (!propertyId) {
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
this.modalService.openModal(StatusItemForm, 'dialog', {
|
|
2094
|
+
header: statusData
|
|
2095
|
+
? this.transloco.translate('properties.form.statusEditTitle')
|
|
2096
|
+
: this.transloco.translate('properties.form.statusCreateTitle'),
|
|
2097
|
+
styleClass: '!w-[72vw] max-w-6xl',
|
|
2098
|
+
appendTo: 'body',
|
|
2099
|
+
dismissableMask: true,
|
|
2100
|
+
inputValues: {
|
|
2101
|
+
propertyId,
|
|
2102
|
+
levelSchemaId: this.levelSchemaId(),
|
|
2103
|
+
statusData,
|
|
2104
|
+
},
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
deleteStatus(status) {
|
|
2108
|
+
const propertyId = this.resolvedPropertyId();
|
|
2109
|
+
if (!propertyId || !status?.id) {
|
|
2110
|
+
return;
|
|
2111
|
+
}
|
|
2112
|
+
this.deletingRowIds.update((ids) => [...ids, status.id]);
|
|
2113
|
+
this.facade
|
|
2114
|
+
.deletePropertyStatus(propertyId, status.id)
|
|
2115
|
+
.pipe(finalize(() => {
|
|
2116
|
+
this.deletingRowIds.update((ids) => ids.filter((id) => id !== status.id));
|
|
2117
|
+
}))
|
|
2118
|
+
.subscribe();
|
|
2119
|
+
}
|
|
2120
|
+
onRowReorder(event) {
|
|
2121
|
+
const reordered = Array.isArray(event.value)
|
|
2122
|
+
? event.value
|
|
2123
|
+
: this.statuses();
|
|
2124
|
+
const orders = reordered.map((status, index) => ({
|
|
2125
|
+
statusId: status.id,
|
|
2126
|
+
order: index + 1,
|
|
2127
|
+
}));
|
|
2128
|
+
this.facade.reorderPropertyStatuses({ orders }).subscribe();
|
|
2129
|
+
}
|
|
2130
|
+
normalizePropertyId(value) {
|
|
2131
|
+
if (value === null || value === undefined || value === '') {
|
|
2132
|
+
return null;
|
|
2133
|
+
}
|
|
2134
|
+
const parsed = typeof value === 'string' ? Number(value) : value;
|
|
2135
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2136
|
+
}
|
|
2137
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: StatusConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2138
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: StatusConfiguration, isStandalone: true, selector: "mt-status-configuration", inputs: { propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null }, levelSchemaId: { classPropertyName: "levelSchemaId", publicName: "levelSchemaId", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-card [title]=\"'properties.form.statusesSection' | transloco\">\n @if (canManageStatuses()) {\n <mt-table\n [data]=\"statuses()\"\n [columns]=\"tableColumns()\"\n [actions]=\"tableActions()\"\n [rowActions]=\"rowActions()\"\n [generalSearch]=\"true\"\n [loading]=\"loading()\"\n [updating]=\"reordering()\"\n [reorderableRows]=\"true\"\n dataKey=\"id\"\n (rowReorder)=\"onRowReorder($event)\"\n />\n } @else {\n <div\n class=\"rounded-xl border border-dashed border-surface-300 bg-surface-50 px-4 py-6 text-sm text-surface-600\"\n >\n {{ \"properties.form.statusesSavePrompt\" | transloco }}\n </div>\n }\n</mt-card>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "showFilters", "loading", "updating", "lazy", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "exportable", "exportFilename", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "pageSize", "currentPage", "first", "filterTerm"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
2139
|
+
}
|
|
2140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: StatusConfiguration, decorators: [{
|
|
2141
|
+
type: Component,
|
|
2142
|
+
args: [{ selector: 'mt-status-configuration', standalone: true, imports: [CommonModule, Card, Table, TranslocoModule], template: "<mt-card [title]=\"'properties.form.statusesSection' | transloco\">\n @if (canManageStatuses()) {\n <mt-table\n [data]=\"statuses()\"\n [columns]=\"tableColumns()\"\n [actions]=\"tableActions()\"\n [rowActions]=\"rowActions()\"\n [generalSearch]=\"true\"\n [loading]=\"loading()\"\n [updating]=\"reordering()\"\n [reorderableRows]=\"true\"\n dataKey=\"id\"\n (rowReorder)=\"onRowReorder($event)\"\n />\n } @else {\n <div\n class=\"rounded-xl border border-dashed border-surface-300 bg-surface-50 px-4 py-6 text-sm text-surface-600\"\n >\n {{ \"properties.form.statusesSavePrompt\" | transloco }}\n </div>\n }\n</mt-card>\n" }]
|
|
2143
|
+
}], ctorParameters: () => [], propDecorators: { propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], levelSchemaId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelSchemaId", required: false }] }] } });
|
|
2144
|
+
|
|
1672
2145
|
class UserConfiguration {
|
|
1673
2146
|
facade = inject(PropertiesFacade);
|
|
1674
2147
|
transloco = inject(TranslocoService);
|
|
@@ -1705,7 +2178,7 @@ class UserConfiguration {
|
|
|
1705
2178
|
});
|
|
1706
2179
|
}
|
|
1707
2180
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: UserConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1708
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: UserConfiguration, isStandalone: true, selector: "mt-user-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
2181
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: UserConfiguration, isStandalone: true, selector: "mt-user-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1709
2182
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1710
2183
|
] });
|
|
1711
2184
|
}
|
|
@@ -1858,7 +2331,7 @@ class AttachmentConfiguration {
|
|
|
1858
2331
|
],
|
|
1859
2332
|
}, ...(ngDevMode ? [{ debugName: "formConfig" }] : []));
|
|
1860
2333
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: AttachmentConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1861
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: AttachmentConfiguration, isStandalone: true, selector: "mt-attachment-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1
|
|
2334
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.3", type: AttachmentConfiguration, isStandalone: true, selector: "mt-attachment-configuration", ngImport: i0, template: "<mt-dynamic-form formControlName=\"configuration\" [formConfig]=\"formConfig()\" />\r\n", styles: [""], dependencies: [{ kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], viewProviders: [
|
|
1862
2335
|
{ provide: ControlContainer, useExisting: FormGroupDirective },
|
|
1863
2336
|
] });
|
|
1864
2337
|
}
|
|
@@ -1876,6 +2349,11 @@ class PropertyForm {
|
|
|
1876
2349
|
transloco = inject(TranslocoService);
|
|
1877
2350
|
propertyId = input('', ...(ngDevMode ? [{ debugName: "propertyId" }] : []));
|
|
1878
2351
|
propertyTypes = this.facade.propertyTypes;
|
|
2352
|
+
legacyReplacedViewTypes = [
|
|
2353
|
+
'DynamicList',
|
|
2354
|
+
'EditableListView',
|
|
2355
|
+
'InternalModule',
|
|
2356
|
+
];
|
|
1879
2357
|
submitLabel = computed(() => this.propertyId()
|
|
1880
2358
|
? this.transloco.translate('properties.form.updateButton')
|
|
1881
2359
|
: this.transloco.translate('properties.form.createButton'), ...(ngDevMode ? [{ debugName: "submitLabel" }] : []));
|
|
@@ -1903,6 +2381,13 @@ class PropertyForm {
|
|
|
1903
2381
|
initialValue: Boolean(this.mainControl.value?.isCalculated),
|
|
1904
2382
|
});
|
|
1905
2383
|
formulaSchemaId = computed(() => this.resolveSchemaId(this.facade.parentModuleId() ?? this.facade.moduleId()), ...(ngDevMode ? [{ debugName: "formulaSchemaId" }] : []));
|
|
2384
|
+
selectedViewType = computed(() => this.propertyType() ??
|
|
2385
|
+
this.facade.selected()?.viewType, ...(ngDevMode ? [{ debugName: "selectedViewType" }] : []));
|
|
2386
|
+
statusPropertyId = computed(() => this.resolveSchemaId(this.facade.selected()?.id ?? this.propertyId()), ...(ngDevMode ? [{ debugName: "statusPropertyId" }] : []));
|
|
2387
|
+
availablePropertyTypes = computed(() => {
|
|
2388
|
+
const allTypes = this.propertyTypes()?.value ?? [];
|
|
2389
|
+
return allTypes.filter((item) => !this.legacyReplacedViewTypes.includes(item?.viewType ?? ''));
|
|
2390
|
+
}, ...(ngDevMode ? [{ debugName: "availablePropertyTypes" }] : []));
|
|
1906
2391
|
selectedPropertyTypeConfiguration = computed(() => {
|
|
1907
2392
|
const propertyTypesSetting = this.propertyTypes();
|
|
1908
2393
|
const selectedViewType = this.propertyType();
|
|
@@ -1913,13 +2398,18 @@ class PropertyForm {
|
|
|
1913
2398
|
}, ...(ngDevMode ? [{ debugName: "selectedPropertyTypeConfiguration" }] : []));
|
|
1914
2399
|
configurationFormConfig = computed(() => this.selectedPropertyTypeConfiguration()?.configurationForm ?? null, ...(ngDevMode ? [{ debugName: "configurationFormConfig" }] : []));
|
|
1915
2400
|
configurationHost;
|
|
2401
|
+
statusConfigurationSection = viewChild('statusConfigurationSection', ...(ngDevMode ? [{ debugName: "statusConfigurationSection" }] : []));
|
|
1916
2402
|
environmentInjector = inject(EnvironmentInjector);
|
|
2403
|
+
routeFragment = toSignal(this.route.fragment, {
|
|
2404
|
+
initialValue: this.route.snapshot.fragment,
|
|
2405
|
+
});
|
|
1917
2406
|
configurationComponentType = signal(null, ...(ngDevMode ? [{ debugName: "configurationComponentType" }] : []));
|
|
1918
2407
|
configurationComponentRef = null;
|
|
1919
2408
|
configurationComponentLoadId = 0;
|
|
1920
2409
|
externalConfigurationForm = signal(null, ...(ngDevMode ? [{ debugName: "externalConfigurationForm" }] : []));
|
|
1921
2410
|
externalConfigurationSubscriptions = null;
|
|
1922
2411
|
externalConfigurationInvalid = signal(false, ...(ngDevMode ? [{ debugName: "externalConfigurationInvalid" }] : []));
|
|
2412
|
+
lastStatusScrollKey = signal(null, ...(ngDevMode ? [{ debugName: "lastStatusScrollKey" }] : []));
|
|
1923
2413
|
configurationComponentExists = computed(() => !!this.configurationComponentType(), ...(ngDevMode ? [{ debugName: "configurationComponentExists" }] : []));
|
|
1924
2414
|
configurationFormInvalid = computed(() => this.externalConfigurationInvalid(), ...(ngDevMode ? [{ debugName: "configurationFormInvalid" }] : []));
|
|
1925
2415
|
submitDisabled = computed(() => this.submitting() || this.configurationFormInvalid(), ...(ngDevMode ? [{ debugName: "submitDisabled" }] : []));
|
|
@@ -1942,7 +2432,7 @@ class PropertyForm {
|
|
|
1942
2432
|
optionLabel: 'label.en',
|
|
1943
2433
|
optionValue: 'viewType',
|
|
1944
2434
|
cssClass: 'w-1/2',
|
|
1945
|
-
options: this.
|
|
2435
|
+
options: this.availablePropertyTypes(),
|
|
1946
2436
|
disabled: this.isEditing(),
|
|
1947
2437
|
filter: true,
|
|
1948
2438
|
hasPlaceholderPrefix: false,
|
|
@@ -2076,12 +2566,7 @@ class PropertyForm {
|
|
|
2076
2566
|
// Reset config scopes before loading new ones
|
|
2077
2567
|
this.facade.resetConfigScopes();
|
|
2078
2568
|
// Load config scopes for specific property types
|
|
2079
|
-
const supportedTypes = [
|
|
2080
|
-
'InternalModule',
|
|
2081
|
-
'DynamicList',
|
|
2082
|
-
'EditableListView',
|
|
2083
|
-
'LookupLog',
|
|
2084
|
-
];
|
|
2569
|
+
const supportedTypes = ['EntityList', 'LookupModuleCheckList'];
|
|
2085
2570
|
if (supportedTypes.includes(currentPropertyType)) {
|
|
2086
2571
|
this.facade.loadConfigAsType(currentPropertyType);
|
|
2087
2572
|
}
|
|
@@ -2096,6 +2581,29 @@ class PropertyForm {
|
|
|
2096
2581
|
effect(() => {
|
|
2097
2582
|
this.renderConfigurationComponent(this.configurationComponentType());
|
|
2098
2583
|
});
|
|
2584
|
+
effect(() => {
|
|
2585
|
+
const fragment = this.routeFragment();
|
|
2586
|
+
const section = this.statusConfigurationSection();
|
|
2587
|
+
const propertyId = this.statusPropertyId();
|
|
2588
|
+
const viewType = this.selectedViewType();
|
|
2589
|
+
if (fragment !== 'status-configuration' ||
|
|
2590
|
+
!section ||
|
|
2591
|
+
!propertyId ||
|
|
2592
|
+
viewType !== 'Status') {
|
|
2593
|
+
return;
|
|
2594
|
+
}
|
|
2595
|
+
const scrollKey = `${propertyId}:${fragment}`;
|
|
2596
|
+
if (this.lastStatusScrollKey() === scrollKey) {
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
this.lastStatusScrollKey.set(scrollKey);
|
|
2600
|
+
setTimeout(() => {
|
|
2601
|
+
section.nativeElement.scrollIntoView({
|
|
2602
|
+
behavior: 'smooth',
|
|
2603
|
+
block: 'start',
|
|
2604
|
+
});
|
|
2605
|
+
});
|
|
2606
|
+
});
|
|
2099
2607
|
}
|
|
2100
2608
|
renderConfigurationComponent(componentType) {
|
|
2101
2609
|
if (!this.configurationHost)
|
|
@@ -2204,7 +2712,13 @@ class PropertyForm {
|
|
|
2204
2712
|
const request$ = this.propertyId()
|
|
2205
2713
|
? this.facade.update(this.propertyId(), payload)
|
|
2206
2714
|
: this.facade.create(payload);
|
|
2207
|
-
request$.subscribe(() =>
|
|
2715
|
+
request$.subscribe(() => {
|
|
2716
|
+
if (mainValue.viewType === 'Status') {
|
|
2717
|
+
this.handleStatusPropertySave();
|
|
2718
|
+
return;
|
|
2719
|
+
}
|
|
2720
|
+
this.goBack();
|
|
2721
|
+
});
|
|
2208
2722
|
}
|
|
2209
2723
|
syncFormWithSelectedProperty(property) {
|
|
2210
2724
|
if (!property)
|
|
@@ -2226,13 +2740,50 @@ class PropertyForm {
|
|
|
2226
2740
|
queryParamsHandling: 'preserve',
|
|
2227
2741
|
});
|
|
2228
2742
|
}
|
|
2743
|
+
handleStatusPropertySave() {
|
|
2744
|
+
const savedId = this.statusPropertyId();
|
|
2745
|
+
if (!savedId) {
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
if (this.propertyId()) {
|
|
2749
|
+
this.facade.loadOne(savedId).subscribe(() => {
|
|
2750
|
+
this.router
|
|
2751
|
+
.navigate([], {
|
|
2752
|
+
relativeTo: this.route,
|
|
2753
|
+
queryParamsHandling: 'preserve',
|
|
2754
|
+
fragment: 'status-configuration',
|
|
2755
|
+
replaceUrl: true,
|
|
2756
|
+
})
|
|
2757
|
+
.then(() => this.scrollToStatusConfiguration());
|
|
2758
|
+
});
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
this.router.navigate([savedId], {
|
|
2762
|
+
relativeTo: this.route,
|
|
2763
|
+
queryParamsHandling: 'preserve',
|
|
2764
|
+
fragment: 'status-configuration',
|
|
2765
|
+
replaceUrl: true,
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
scrollToStatusConfiguration() {
|
|
2769
|
+
const section = this.statusConfigurationSection();
|
|
2770
|
+
if (!section) {
|
|
2771
|
+
return;
|
|
2772
|
+
}
|
|
2773
|
+
setTimeout(() => {
|
|
2774
|
+
section.nativeElement.scrollIntoView({
|
|
2775
|
+
behavior: 'smooth',
|
|
2776
|
+
block: 'start',
|
|
2777
|
+
});
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2229
2780
|
ngOnDestroy() {
|
|
2230
2781
|
this.facade.resetSelectedProperty();
|
|
2231
2782
|
this.facade.setDefaultViewType('');
|
|
2232
2783
|
this.destroyConfigurationComponent();
|
|
2233
2784
|
}
|
|
2234
2785
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertyForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2235
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PropertyForm, isStandalone: true, selector: "mt-property-form", inputs: { propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "configurationHost", first: true, predicate: ["configurationHost"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<mt-page\
|
|
2786
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: PropertyForm, isStandalone: true, selector: "mt-property-form", inputs: { propertyId: { classPropertyName: "propertyId", publicName: "propertyId", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "statusConfigurationSection", first: true, predicate: ["statusConfigurationSection"], descendants: true, isSignal: true }, { propertyName: "configurationHost", first: true, predicate: ["configurationHost"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<mt-page\n [title]=\"\n propertyId()\n ? ('properties.form.editProperty' | transloco)\n : ('properties.form.createNewProperty' | transloco)\n \"\n avatarIcon=\"custom.products-and-services\"\n [avatarStyle]=\"{\n '--p-avatar-background': 'var(--p-sky-50)',\n '--p-avatar-color': 'var(--p-sky-700)',\n }\"\n (backButtonClick)=\"goBack()\"\n backButton\n class=\"h-full\"\n>\n <ng-template #headerEnd>\n <mt-button\n class=\"mx-2\"\n [label]=\"submitLabel()\"\n [icon]=\"isEditing() ? 'custom.pencil' : 'general.plus'\"\n [loading]=\"submitting()\"\n [disabled]=\"submitDisabled() || this.propertyForm.invalid\"\n (click)=\"createOrEditProperty()\"\n />\n </ng-template>\n <div\n [formGroup]=\"propertyForm\"\n class=\"h-full py-4 h-full overflow-y-auto flex justify-center\"\n >\n <div class=\"w-2/3 flex flex-col gap-6\">\n @if (loading()) {\n <!-- Skeleton Loading State -->\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <div class=\"flex justify-between items-center gap-6\">\n <p-skeleton width=\"50%\" height=\"3rem\"></p-skeleton>\n <p-skeleton width=\"8rem\" height=\"2.5rem\"></p-skeleton>\n </div>\n </div>\n\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <p-skeleton\n width=\"12rem\"\n height=\"1.5rem\"\n styleClass=\"mb-4\"\n ></p-skeleton>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"6rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n <p-skeleton height=\"3rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n </div>\n </div>\n\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <p-skeleton\n width=\"10rem\"\n height=\"1.5rem\"\n styleClass=\"mb-4\"\n ></p-skeleton>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"8rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n </div>\n </div>\n } @else {\n <mt-dynamic-form\n [formConfig]=\"dynamicFormConfigMain()\"\n [formControlName]=\"'main'\"\n />\n @if (configurationFormConfig()) {\n <mt-dynamic-form\n formControlName=\"configuration\"\n [formConfig]=\"configurationFormConfig()!\"\n />\n } @else {\n <ng-container #configurationHost></ng-container>\n @if (!configurationComponentExists()) {\n @switch (propertyType()) {\n @case (\"User\") {\n <mt-user-configuration />\n }\n @case (\"Percentage\") {\n <mt-percentage-configuration />\n }\n @case (\"Lookup\") {\n <mt-lookup-configuration />\n }\n @case (\"LookupMultiSelect\") {\n <mt-lookup-configuration />\n }\n @case (\"EntityList\") {\n <mt-entity-list-configuration />\n }\n @case (\"API\") {\n <mt-api-configuration formControlName=\"configuration\" />\n }\n @case (\"Status\") {\n <section #statusConfigurationSection>\n <mt-status-configuration\n [propertyId]=\"statusPropertyId()\"\n [levelSchemaId]=\"formulaSchemaId()\"\n />\n </section>\n }\n <!-- @case('ViewList') { REMOVED FOR NOW\n <mt-view-list-configuration />\n } -->\n @case (\"Attachment\") {\n <mt-attachment-configuration />\n }\n <!-- @case('ReferenceProperty') { REMOVED FOR NOW\n } -->\n @case (\"LookupModuleCheckList\") {\n <mt-check-list-form-configuration />\n }\n <!-- @case('LookupMatrix') { REMOVED FOR NOW\n <mt-lookup-configuration />\n } -->\n @case (\"Location\") {\n <mt-location-configuration />\n }\n }\n }\n }\n @if (isCalculated()) {\n <mt-card title=\"Formula\">\n <mt-formula-builder\n formControlName=\"formula\"\n [levelSchemaId]=\"formulaSchemaId()\"\n />\n </mt-card>\n }\n }\n </div>\n </div>\n</mt-page>\n", styles: [""], dependencies: [{ kind: "component", type: Page, selector: "mt-page", inputs: ["backButton", "backButtonIcon", "avatarIcon", "avatarStyle", "avatarShape", "title", "tabs", "activeTab", "contentClass", "contentId"], outputs: ["backButtonClick", "tabChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FormulaBuilder, selector: "mt-formula-builder", inputs: ["propertiesByPath", "levelSchemaId", "templateId", "placeholder", "hideToolbar", "hideStatusBar"], outputs: ["validationChange", "tokensChange"] }, { kind: "component", type: ApiConfiguration, selector: "mt-api-configuration" }, { kind: "component", type: CheckListFormConfiguration, selector: "mt-check-list-form-configuration" }, { kind: "component", type: EntityListConfiguration, selector: "mt-entity-list-configuration" }, { kind: "component", type: LocationConfiguration, selector: "mt-location-configuration" }, { kind: "component", type: LookupConfiguration, selector: "mt-lookup-configuration" }, { kind: "component", type: PercentageConfiguration, selector: "mt-percentage-configuration" }, { kind: "component", type: StatusConfiguration, selector: "mt-status-configuration", inputs: ["propertyId", "levelSchemaId"] }, { kind: "component", type: UserConfiguration, selector: "mt-user-configuration" }, { kind: "component", type: AttachmentConfiguration, selector: "mt-attachment-configuration" }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }] });
|
|
2236
2787
|
}
|
|
2237
2788
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: PropertyForm, decorators: [{
|
|
2238
2789
|
type: Component,
|
|
@@ -2245,21 +2796,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
2245
2796
|
FormulaBuilder,
|
|
2246
2797
|
ApiConfiguration,
|
|
2247
2798
|
CheckListFormConfiguration,
|
|
2248
|
-
|
|
2249
|
-
EditableListViewConfiguration,
|
|
2250
|
-
InternalModuleConfiguration,
|
|
2799
|
+
EntityListConfiguration,
|
|
2251
2800
|
LocationConfiguration,
|
|
2252
2801
|
LookupConfiguration,
|
|
2253
2802
|
PercentageConfiguration,
|
|
2803
|
+
StatusConfiguration,
|
|
2254
2804
|
UserConfiguration,
|
|
2255
2805
|
AttachmentConfiguration,
|
|
2256
2806
|
SkeletonModule,
|
|
2257
2807
|
TranslocoModule,
|
|
2258
|
-
], template: "<mt-page\
|
|
2808
|
+
], template: "<mt-page\n [title]=\"\n propertyId()\n ? ('properties.form.editProperty' | transloco)\n : ('properties.form.createNewProperty' | transloco)\n \"\n avatarIcon=\"custom.products-and-services\"\n [avatarStyle]=\"{\n '--p-avatar-background': 'var(--p-sky-50)',\n '--p-avatar-color': 'var(--p-sky-700)',\n }\"\n (backButtonClick)=\"goBack()\"\n backButton\n class=\"h-full\"\n>\n <ng-template #headerEnd>\n <mt-button\n class=\"mx-2\"\n [label]=\"submitLabel()\"\n [icon]=\"isEditing() ? 'custom.pencil' : 'general.plus'\"\n [loading]=\"submitting()\"\n [disabled]=\"submitDisabled() || this.propertyForm.invalid\"\n (click)=\"createOrEditProperty()\"\n />\n </ng-template>\n <div\n [formGroup]=\"propertyForm\"\n class=\"h-full py-4 h-full overflow-y-auto flex justify-center\"\n >\n <div class=\"w-2/3 flex flex-col gap-6\">\n @if (loading()) {\n <!-- Skeleton Loading State -->\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <div class=\"flex justify-between items-center gap-6\">\n <p-skeleton width=\"50%\" height=\"3rem\"></p-skeleton>\n <p-skeleton width=\"8rem\" height=\"2.5rem\"></p-skeleton>\n </div>\n </div>\n\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <p-skeleton\n width=\"12rem\"\n height=\"1.5rem\"\n styleClass=\"mb-4\"\n ></p-skeleton>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"6rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n <p-skeleton height=\"3rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n </div>\n </div>\n\n <div class=\"rounded-xl bg-white shadow-sm p-6 space-y-4\">\n <p-skeleton\n width=\"10rem\"\n height=\"1.5rem\"\n styleClass=\"mb-4\"\n ></p-skeleton>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"3rem\"></p-skeleton>\n <p-skeleton height=\"8rem\" styleClass=\"md:col-span-2\"></p-skeleton>\n </div>\n </div>\n } @else {\n <mt-dynamic-form\n [formConfig]=\"dynamicFormConfigMain()\"\n [formControlName]=\"'main'\"\n />\n @if (configurationFormConfig()) {\n <mt-dynamic-form\n formControlName=\"configuration\"\n [formConfig]=\"configurationFormConfig()!\"\n />\n } @else {\n <ng-container #configurationHost></ng-container>\n @if (!configurationComponentExists()) {\n @switch (propertyType()) {\n @case (\"User\") {\n <mt-user-configuration />\n }\n @case (\"Percentage\") {\n <mt-percentage-configuration />\n }\n @case (\"Lookup\") {\n <mt-lookup-configuration />\n }\n @case (\"LookupMultiSelect\") {\n <mt-lookup-configuration />\n }\n @case (\"EntityList\") {\n <mt-entity-list-configuration />\n }\n @case (\"API\") {\n <mt-api-configuration formControlName=\"configuration\" />\n }\n @case (\"Status\") {\n <section #statusConfigurationSection>\n <mt-status-configuration\n [propertyId]=\"statusPropertyId()\"\n [levelSchemaId]=\"formulaSchemaId()\"\n />\n </section>\n }\n <!-- @case('ViewList') { REMOVED FOR NOW\n <mt-view-list-configuration />\n } -->\n @case (\"Attachment\") {\n <mt-attachment-configuration />\n }\n <!-- @case('ReferenceProperty') { REMOVED FOR NOW\n } -->\n @case (\"LookupModuleCheckList\") {\n <mt-check-list-form-configuration />\n }\n <!-- @case('LookupMatrix') { REMOVED FOR NOW\n <mt-lookup-configuration />\n } -->\n @case (\"Location\") {\n <mt-location-configuration />\n }\n }\n }\n }\n @if (isCalculated()) {\n <mt-card title=\"Formula\">\n <mt-formula-builder\n formControlName=\"formula\"\n [levelSchemaId]=\"formulaSchemaId()\"\n />\n </mt-card>\n }\n }\n </div>\n </div>\n</mt-page>\n" }]
|
|
2259
2809
|
}], ctorParameters: () => [], propDecorators: { propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], configurationHost: [{
|
|
2260
2810
|
type: ViewChild,
|
|
2261
2811
|
args: ['configurationHost', { read: ViewContainerRef }]
|
|
2262
|
-
}] } });
|
|
2812
|
+
}], statusConfigurationSection: [{ type: i0.ViewChild, args: ['statusConfigurationSection', { isSignal: true }] }] } });
|
|
2263
2813
|
|
|
2264
2814
|
/*
|
|
2265
2815
|
* Public API Surface of structure-builder
|
|
@@ -2269,5 +2819,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
2269
2819
|
* Generated bundle index. Do not edit.
|
|
2270
2820
|
*/
|
|
2271
2821
|
|
|
2272
|
-
export { CreateProperty, DeleteProperty, GetConfigAsType, GetCountries, GetGroups, GetLookups, GetProperties, GetPropertiesForConfigType, GetProperty, PropertiesActionKey, PropertiesFacade, PropertiesList, PropertiesState, PropertyForm, REQUEST_CONTEXT, ResetApiConfiguration, ResetConfigProperties, ResetConfigScopes, ResetSelectedProperty, SetBreadcrumb, SetDefaultViewType, SetPropertiesModuleInfo, SetPropertyTypes, TestApiConfiguration, UpdateProperty };
|
|
2822
|
+
export { CreateProperty, CreatePropertyStatus, DeleteProperty, DeletePropertyStatus, GetConfigAsType, GetCountries, GetGroups, GetLookups, GetProperties, GetPropertiesForConfigType, GetProperty, GetPropertyStatuses, PropertiesActionKey, PropertiesFacade, PropertiesList, PropertiesState, PropertyForm, REQUEST_CONTEXT, ReorderPropertyStatuses, ResetApiConfiguration, ResetConfigProperties, ResetConfigScopes, ResetPropertyStatuses, ResetSelectedProperty, SetBreadcrumb, SetDefaultViewType, SetPropertiesModuleInfo, SetPropertyTypes, TestApiConfiguration, UpdateProperty, UpdatePropertyStatus };
|
|
2273
2823
|
//# sourceMappingURL=masterteam-properties.mjs.map
|