@masterteam/client-components 0.0.6 → 0.0.7
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/fesm2022/masterteam-client-components-client-module-preview.mjs +351 -0
- package/fesm2022/masterteam-client-components-client-module-preview.mjs.map +1 -0
- package/fesm2022/masterteam-client-components-escalation-runtime.mjs +1 -1
- package/fesm2022/masterteam-client-components-escalation-runtime.mjs.map +1 -1
- package/package.json +9 -5
- package/types/masterteam-client-components-client-module-preview.d.ts +35 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, input, output, signal, computed, effect, untracked, Component } from '@angular/core';
|
|
3
|
+
import { EntitiesPreview } from '@masterteam/components/entities';
|
|
4
|
+
import { ClientFormApiService } from '@masterteam/forms/client-form';
|
|
5
|
+
|
|
6
|
+
const WIDTH_TO_ENTITY_SIZE = {
|
|
7
|
+
'25': 6,
|
|
8
|
+
'50': 12,
|
|
9
|
+
'100': 24,
|
|
10
|
+
};
|
|
11
|
+
class ClientModulePreview {
|
|
12
|
+
api = inject(ClientFormApiService);
|
|
13
|
+
loadSub;
|
|
14
|
+
moduleKey = input.required(...(ngDevMode ? [{ debugName: "moduleKey" }] : []));
|
|
15
|
+
operationKey = input.required(...(ngDevMode ? [{ debugName: "operationKey" }] : []));
|
|
16
|
+
moduleId = input(...(ngDevMode ? [undefined, { debugName: "moduleId" }] : []));
|
|
17
|
+
levelId = input(...(ngDevMode ? [undefined, { debugName: "levelId" }] : []));
|
|
18
|
+
levelDataId = input(...(ngDevMode ? [undefined, { debugName: "levelDataId" }] : []));
|
|
19
|
+
moduleDataId = input(...(ngDevMode ? [undefined, { debugName: "moduleDataId" }] : []));
|
|
20
|
+
requestSchemaId = input(...(ngDevMode ? [undefined, { debugName: "requestSchemaId" }] : []));
|
|
21
|
+
draftProcessId = input(...(ngDevMode ? [undefined, { debugName: "draftProcessId" }] : []));
|
|
22
|
+
preview = input(false, ...(ngDevMode ? [{ debugName: "preview" }] : []));
|
|
23
|
+
autoLoad = input(true, ...(ngDevMode ? [{ debugName: "autoLoad" }] : []));
|
|
24
|
+
lang = input('en', ...(ngDevMode ? [{ debugName: "lang" }] : []));
|
|
25
|
+
formMode = input('create', ...(ngDevMode ? [{ debugName: "formMode" }] : []));
|
|
26
|
+
loaded = output();
|
|
27
|
+
errored = output();
|
|
28
|
+
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
29
|
+
error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : []));
|
|
30
|
+
response = signal(null, ...(ngDevMode ? [{ debugName: "response" }] : []));
|
|
31
|
+
entities = computed(() => mapResponseToEntities(this.response(), this.lang(), this.formMode()), ...(ngDevMode ? [{ debugName: "entities" }] : []));
|
|
32
|
+
constructor() {
|
|
33
|
+
effect(() => {
|
|
34
|
+
const autoLoad = this.autoLoad();
|
|
35
|
+
const moduleKey = this.moduleKey();
|
|
36
|
+
const operationKey = this.operationKey();
|
|
37
|
+
this.moduleId();
|
|
38
|
+
this.levelId();
|
|
39
|
+
this.levelDataId();
|
|
40
|
+
this.moduleDataId();
|
|
41
|
+
this.requestSchemaId();
|
|
42
|
+
this.draftProcessId();
|
|
43
|
+
this.preview();
|
|
44
|
+
if (autoLoad && moduleKey && operationKey) {
|
|
45
|
+
untracked(() => this.load());
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
load() {
|
|
50
|
+
if (this.loading())
|
|
51
|
+
return;
|
|
52
|
+
this.loadSub?.unsubscribe();
|
|
53
|
+
this.loading.set(true);
|
|
54
|
+
this.error.set(null);
|
|
55
|
+
this.loadSub = this.api.load(this.buildLoadRequest()).subscribe({
|
|
56
|
+
next: (response) => {
|
|
57
|
+
this.loading.set(false);
|
|
58
|
+
if (response.code === 1 && response.data) {
|
|
59
|
+
this.response.set(response.data);
|
|
60
|
+
this.loaded.emit(response.data);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const message = response.message ?? 'Failed to load module preview';
|
|
64
|
+
this.response.set(null);
|
|
65
|
+
this.error.set(message);
|
|
66
|
+
this.errored.emit(message);
|
|
67
|
+
},
|
|
68
|
+
error: (error) => {
|
|
69
|
+
this.loading.set(false);
|
|
70
|
+
this.response.set(null);
|
|
71
|
+
const message = error?.error?.message ??
|
|
72
|
+
error?.message ??
|
|
73
|
+
'Failed to load module preview';
|
|
74
|
+
this.error.set(message);
|
|
75
|
+
this.errored.emit(message);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
ngOnDestroy() {
|
|
80
|
+
this.loadSub?.unsubscribe();
|
|
81
|
+
}
|
|
82
|
+
buildLoadRequest() {
|
|
83
|
+
return {
|
|
84
|
+
moduleKey: this.moduleKey(),
|
|
85
|
+
operationKey: this.operationKey(),
|
|
86
|
+
moduleId: this.moduleId(),
|
|
87
|
+
levelId: this.levelId(),
|
|
88
|
+
levelDataId: this.levelDataId(),
|
|
89
|
+
moduleDataId: this.moduleDataId(),
|
|
90
|
+
requestSchemaId: this.requestSchemaId(),
|
|
91
|
+
draftProcessId: this.draftProcessId(),
|
|
92
|
+
preview: this.preview(),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientModulePreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
96
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: ClientModulePreview, isStandalone: true, selector: "mt-client-module-preview", inputs: { moduleKey: { classPropertyName: "moduleKey", publicName: "moduleKey", isSignal: true, isRequired: true, transformFunction: null }, operationKey: { classPropertyName: "operationKey", publicName: "operationKey", isSignal: true, isRequired: true, transformFunction: null }, moduleId: { classPropertyName: "moduleId", publicName: "moduleId", isSignal: true, isRequired: false, transformFunction: null }, levelId: { classPropertyName: "levelId", publicName: "levelId", isSignal: true, isRequired: false, transformFunction: null }, levelDataId: { classPropertyName: "levelDataId", publicName: "levelDataId", isSignal: true, isRequired: false, transformFunction: null }, moduleDataId: { classPropertyName: "moduleDataId", publicName: "moduleDataId", isSignal: true, isRequired: false, transformFunction: null }, requestSchemaId: { classPropertyName: "requestSchemaId", publicName: "requestSchemaId", isSignal: true, isRequired: false, transformFunction: null }, draftProcessId: { classPropertyName: "draftProcessId", publicName: "draftProcessId", isSignal: true, isRequired: false, transformFunction: null }, preview: { classPropertyName: "preview", publicName: "preview", isSignal: true, isRequired: false, transformFunction: null }, autoLoad: { classPropertyName: "autoLoad", publicName: "autoLoad", isSignal: true, isRequired: false, transformFunction: null }, lang: { classPropertyName: "lang", publicName: "lang", isSignal: true, isRequired: false, transformFunction: null }, formMode: { classPropertyName: "formMode", publicName: "formMode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loaded: "loaded", errored: "errored" }, ngImport: i0, template: "@if (loading()) {\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\n @for (item of [1, 2, 3, 4]; track item) {\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\n </div>\n }\n </div>\n} @else if (error()) {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n {{ error() }}\n </p>\n </div>\n} @else if (entities().length) {\n <mt-entities-preview [entities]=\"entities()\" />\n} @else {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n No preview data is available for this context.\n </p>\n </div>\n}\n", dependencies: [{ kind: "component", type: EntitiesPreview, selector: "mt-entities-preview", inputs: ["entities"] }] });
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ClientModulePreview, decorators: [{
|
|
99
|
+
type: Component,
|
|
100
|
+
args: [{ selector: 'mt-client-module-preview', standalone: true, imports: [EntitiesPreview], template: "@if (loading()) {\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\n @for (item of [1, 2, 3, 4]; track item) {\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\n </div>\n }\n </div>\n} @else if (error()) {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n {{ error() }}\n </p>\n </div>\n} @else if (entities().length) {\n <mt-entities-preview [entities]=\"entities()\" />\n} @else {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n No preview data is available for this context.\n </p>\n </div>\n}\n" }]
|
|
101
|
+
}], ctorParameters: () => [], propDecorators: { moduleKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "moduleKey", required: true }] }], operationKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "operationKey", required: true }] }], moduleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "moduleId", required: false }] }], levelId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelId", required: false }] }], levelDataId: [{ type: i0.Input, args: [{ isSignal: true, alias: "levelDataId", required: false }] }], moduleDataId: [{ type: i0.Input, args: [{ isSignal: true, alias: "moduleDataId", required: false }] }], requestSchemaId: [{ type: i0.Input, args: [{ isSignal: true, alias: "requestSchemaId", required: false }] }], draftProcessId: [{ type: i0.Input, args: [{ isSignal: true, alias: "draftProcessId", required: false }] }], preview: [{ type: i0.Input, args: [{ isSignal: true, alias: "preview", required: false }] }], autoLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoLoad", required: false }] }], lang: [{ type: i0.Input, args: [{ isSignal: true, alias: "lang", required: false }] }], formMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "formMode", required: false }] }], loaded: [{ type: i0.Output, args: ["loaded"] }], errored: [{ type: i0.Output, args: ["errored"] }] } });
|
|
102
|
+
function mapResponseToEntities(response, lang, formMode) {
|
|
103
|
+
if (!response?.formConfiguration?.sections?.length) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
const valueByKey = new Map();
|
|
107
|
+
for (const value of response.values ?? []) {
|
|
108
|
+
valueByKey.set(value.propertyKey, value);
|
|
109
|
+
}
|
|
110
|
+
const entities = [];
|
|
111
|
+
const sections = [...response.formConfiguration.sections].sort((a, b) => a.order - b.order);
|
|
112
|
+
const seen = new Set();
|
|
113
|
+
let order = 0;
|
|
114
|
+
for (const section of sections) {
|
|
115
|
+
const fields = [...(section.fields ?? [])]
|
|
116
|
+
.filter((field) => isVisibleField(field, formMode))
|
|
117
|
+
.sort((a, b) => a.order - b.order);
|
|
118
|
+
for (const field of fields) {
|
|
119
|
+
if (!field.propertyKey || seen.has(field.propertyKey)) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const property = field.propertyMetadata ?? field.property;
|
|
123
|
+
if (!property) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
seen.add(field.propertyKey);
|
|
127
|
+
const viewType = toEntityViewType(property.viewType);
|
|
128
|
+
const entityValue = mapEntityValue(valueByKey.get(field.propertyKey)?.value, viewType);
|
|
129
|
+
entities.push({
|
|
130
|
+
id: resolveNumber(property.propertyId),
|
|
131
|
+
propertyId: resolveNumber(property.propertyId),
|
|
132
|
+
key: property.key ?? field.propertyKey,
|
|
133
|
+
normalizedKey: readString(property, 'normalizedKey'),
|
|
134
|
+
name: resolvePropertyName(property, lang) || field.propertyKey,
|
|
135
|
+
value: entityValue.value,
|
|
136
|
+
rawValue: entityValue.rawValue,
|
|
137
|
+
viewType,
|
|
138
|
+
order: order++,
|
|
139
|
+
configuration: {
|
|
140
|
+
size: WIDTH_TO_ENTITY_SIZE[field.width] ?? 24,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return entities;
|
|
146
|
+
}
|
|
147
|
+
function isVisibleField(field, formMode) {
|
|
148
|
+
if (field.isRead === false) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
return formMode === 'create'
|
|
152
|
+
? !field.hiddenInCreation
|
|
153
|
+
: !field.hiddenInEditForm;
|
|
154
|
+
}
|
|
155
|
+
function resolvePropertyName(property, lang) {
|
|
156
|
+
if (typeof property.name === 'string') {
|
|
157
|
+
return property.name;
|
|
158
|
+
}
|
|
159
|
+
const name = property.name;
|
|
160
|
+
if (!name || typeof name !== 'object') {
|
|
161
|
+
return property.key;
|
|
162
|
+
}
|
|
163
|
+
return (readString(name, 'display') ??
|
|
164
|
+
readString(name, lang) ??
|
|
165
|
+
readString(name, lang === 'en' ? 'ar' : 'en') ??
|
|
166
|
+
property.key);
|
|
167
|
+
}
|
|
168
|
+
function toEntityViewType(viewType) {
|
|
169
|
+
switch (viewType) {
|
|
170
|
+
case 'LongText':
|
|
171
|
+
case 'Date':
|
|
172
|
+
case 'DateTime':
|
|
173
|
+
case 'Percentage':
|
|
174
|
+
case 'Status':
|
|
175
|
+
case 'Currency':
|
|
176
|
+
case 'Checkbox':
|
|
177
|
+
case 'User':
|
|
178
|
+
case 'Lookup':
|
|
179
|
+
return viewType;
|
|
180
|
+
default:
|
|
181
|
+
return 'Text';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function mapEntityValue(value, viewType) {
|
|
185
|
+
switch (viewType) {
|
|
186
|
+
case 'User': {
|
|
187
|
+
const userValue = mapUserValue(value);
|
|
188
|
+
return {
|
|
189
|
+
value: userValue,
|
|
190
|
+
rawValue: userValue.displayName ?? userValue.userName ?? '',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
case 'Status':
|
|
194
|
+
return mapStatusLikeValue(value);
|
|
195
|
+
case 'Lookup':
|
|
196
|
+
return mapLookupValue(value);
|
|
197
|
+
case 'Percentage':
|
|
198
|
+
return mapPercentageValue(value);
|
|
199
|
+
case 'Checkbox':
|
|
200
|
+
return mapCheckboxValue(value);
|
|
201
|
+
default: {
|
|
202
|
+
const displayValue = resolveDisplayValue(value);
|
|
203
|
+
return {
|
|
204
|
+
value: displayValue,
|
|
205
|
+
rawValue: resolveRawValue(value) ?? displayValue,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function mapUserValue(value) {
|
|
211
|
+
if (!value || typeof value !== 'object') {
|
|
212
|
+
const displayName = resolveDisplayValue(value);
|
|
213
|
+
return {
|
|
214
|
+
displayName,
|
|
215
|
+
userName: displayName,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
id: readString(value, 'id'),
|
|
220
|
+
userName: readString(value, 'userName'),
|
|
221
|
+
displayName: readString(value, 'displayName') ??
|
|
222
|
+
readString(value, 'fullName') ??
|
|
223
|
+
readNestedDisplay(value, 'name') ??
|
|
224
|
+
readString(value, 'userName') ??
|
|
225
|
+
'',
|
|
226
|
+
photoUrl: readString(value, 'photoUrl'),
|
|
227
|
+
phoneNumber: readString(value, 'phoneNumber') ?? readString(value, 'mobileNumber'),
|
|
228
|
+
email: readString(value, 'email') ?? readString(value, 'emailAddress'),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function mapStatusLikeValue(value) {
|
|
232
|
+
const display = readNestedDisplay(value, 'name') ??
|
|
233
|
+
readString(value, 'display') ??
|
|
234
|
+
resolveDisplayValue(value);
|
|
235
|
+
const statusValue = {
|
|
236
|
+
key: readString(value, 'key') ?? display,
|
|
237
|
+
display,
|
|
238
|
+
color: readString(value, 'color') ?? '#64748b',
|
|
239
|
+
description: readNestedDisplay(value, 'description') ?? undefined,
|
|
240
|
+
};
|
|
241
|
+
return {
|
|
242
|
+
value: statusValue,
|
|
243
|
+
rawValue: display,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function mapLookupValue(value) {
|
|
247
|
+
const display = readNestedDisplay(value, 'name') ??
|
|
248
|
+
readString(value, 'display') ??
|
|
249
|
+
resolveDisplayValue(value);
|
|
250
|
+
const lookupValue = {
|
|
251
|
+
key: readString(value, 'key') ?? display,
|
|
252
|
+
display,
|
|
253
|
+
color: readString(value, 'color') ?? '#64748b',
|
|
254
|
+
description: readNestedDisplay(value, 'description') ?? undefined,
|
|
255
|
+
};
|
|
256
|
+
return {
|
|
257
|
+
value: lookupValue,
|
|
258
|
+
rawValue: display,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function mapPercentageValue(value) {
|
|
262
|
+
const rawValue = resolveRawValue(value) ?? '';
|
|
263
|
+
const displayValue = resolveDisplayValue(value);
|
|
264
|
+
if (!rawValue && !displayValue) {
|
|
265
|
+
return { value: '', rawValue: '' };
|
|
266
|
+
}
|
|
267
|
+
const normalizedRaw = rawValue.replace(/%/g, '').trim();
|
|
268
|
+
const normalizedDisplay = displayValue.includes('%') || !displayValue.length
|
|
269
|
+
? displayValue
|
|
270
|
+
: `${displayValue}%`;
|
|
271
|
+
return {
|
|
272
|
+
value: normalizedDisplay || `${normalizedRaw}%`,
|
|
273
|
+
rawValue: normalizedRaw || rawValue,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function mapCheckboxValue(value) {
|
|
277
|
+
const rawValue = resolveBooleanString(value);
|
|
278
|
+
return {
|
|
279
|
+
value: rawValue,
|
|
280
|
+
rawValue,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function resolveBooleanString(value) {
|
|
284
|
+
if (typeof value === 'boolean') {
|
|
285
|
+
return String(value);
|
|
286
|
+
}
|
|
287
|
+
const displayValue = resolveDisplayValue(value).trim().toLowerCase();
|
|
288
|
+
if (displayValue === 'true' || displayValue === 'false') {
|
|
289
|
+
return displayValue;
|
|
290
|
+
}
|
|
291
|
+
return '';
|
|
292
|
+
}
|
|
293
|
+
function resolveDisplayValue(value) {
|
|
294
|
+
if (typeof value === 'string') {
|
|
295
|
+
return value;
|
|
296
|
+
}
|
|
297
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
298
|
+
return String(value);
|
|
299
|
+
}
|
|
300
|
+
if (!value || typeof value !== 'object') {
|
|
301
|
+
return '';
|
|
302
|
+
}
|
|
303
|
+
return (readString(value, 'display') ??
|
|
304
|
+
readString(value, 'displayValue') ??
|
|
305
|
+
readString(value, 'actualValue') ??
|
|
306
|
+
readString(value, 'displayName') ??
|
|
307
|
+
readString(value, 'fullName') ??
|
|
308
|
+
readString(value, 'userName') ??
|
|
309
|
+
readNestedDisplay(value, 'name') ??
|
|
310
|
+
readString(value, 'key') ??
|
|
311
|
+
'');
|
|
312
|
+
}
|
|
313
|
+
function resolveRawValue(value) {
|
|
314
|
+
if (!value || typeof value !== 'object') {
|
|
315
|
+
return value === null || value === undefined ? undefined : String(value);
|
|
316
|
+
}
|
|
317
|
+
return (readString(value, 'actualValue') ??
|
|
318
|
+
readString(value, 'value') ??
|
|
319
|
+
readString(value, 'displayValue') ??
|
|
320
|
+
undefined);
|
|
321
|
+
}
|
|
322
|
+
function readNestedDisplay(value, key) {
|
|
323
|
+
if (!value || typeof value !== 'object') {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
const nested = value[key];
|
|
327
|
+
if (!nested || typeof nested !== 'object') {
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
return (readString(nested, 'display') ??
|
|
331
|
+
readString(nested, 'en') ??
|
|
332
|
+
readString(nested, 'ar') ??
|
|
333
|
+
undefined);
|
|
334
|
+
}
|
|
335
|
+
function readString(value, key) {
|
|
336
|
+
if (!value || typeof value !== 'object') {
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
339
|
+
const result = value[key];
|
|
340
|
+
return typeof result === 'string' && result.length ? result : undefined;
|
|
341
|
+
}
|
|
342
|
+
function resolveNumber(value) {
|
|
343
|
+
return typeof value === 'number' ? value : undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Generated bundle index. Do not edit.
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
export { ClientModulePreview };
|
|
351
|
+
//# sourceMappingURL=masterteam-client-components-client-module-preview.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-client-components-client-module-preview.mjs","sources":["../../../../packages/masterteam/client-components/client-module-preview/client-module-preview.ts","../../../../packages/masterteam/client-components/client-module-preview/client-module-preview.html","../../../../packages/masterteam/client-components/client-module-preview/masterteam-client-components-client-module-preview.ts"],"sourcesContent":["import {\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n OnDestroy,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\n\nimport {\n EntitiesPreview,\n EntityData,\n EntityLookupValue,\n EntitySize,\n EntityStatusValue,\n EntityUserValue,\n EntityViewType,\n} from '@masterteam/components/entities';\nimport {\n ClientFormApiService,\n type ClientFormField,\n type ClientPropertyItem,\n type ProcessFormLoadRequest,\n type ProcessFormLoadResponse,\n type ProcessFormValue,\n} from '@masterteam/forms/client-form';\n\nconst WIDTH_TO_ENTITY_SIZE: Record<string, EntitySize> = {\n '25': 6,\n '50': 12,\n '100': 24,\n};\n\n@Component({\n selector: 'mt-client-module-preview',\n standalone: true,\n imports: [EntitiesPreview],\n templateUrl: './client-module-preview.html',\n})\nexport class ClientModulePreview implements OnDestroy {\n private readonly api = inject(ClientFormApiService);\n private loadSub?: Subscription;\n\n readonly moduleKey = input.required<string>();\n readonly operationKey = input.required<string>();\n readonly moduleId = input<number>();\n readonly levelId = input<number>();\n readonly levelDataId = input<number>();\n readonly moduleDataId = input<number>();\n readonly requestSchemaId = input<number>();\n readonly draftProcessId = input<number>();\n readonly preview = input(false);\n\n readonly autoLoad = input(true);\n readonly lang = input<'en' | 'ar'>('en');\n readonly formMode = input<'create' | 'edit'>('create');\n\n readonly loaded = output<ProcessFormLoadResponse>();\n readonly errored = output<string>();\n\n readonly loading = signal(false);\n readonly error = signal<string | null>(null);\n readonly response = signal<ProcessFormLoadResponse | null>(null);\n\n readonly entities = computed(() =>\n mapResponseToEntities(this.response(), this.lang(), this.formMode()),\n );\n\n constructor() {\n effect(() => {\n const autoLoad = this.autoLoad();\n const moduleKey = this.moduleKey();\n const operationKey = this.operationKey();\n\n this.moduleId();\n this.levelId();\n this.levelDataId();\n this.moduleDataId();\n this.requestSchemaId();\n this.draftProcessId();\n this.preview();\n\n if (autoLoad && moduleKey && operationKey) {\n untracked(() => this.load());\n }\n });\n }\n\n load(): void {\n if (this.loading()) return;\n\n this.loadSub?.unsubscribe();\n this.loading.set(true);\n this.error.set(null);\n\n this.loadSub = this.api.load(this.buildLoadRequest()).subscribe({\n next: (response) => {\n this.loading.set(false);\n\n if (response.code === 1 && response.data) {\n this.response.set(response.data);\n this.loaded.emit(response.data);\n return;\n }\n\n const message = response.message ?? 'Failed to load module preview';\n this.response.set(null);\n this.error.set(message);\n this.errored.emit(message);\n },\n error: (error) => {\n this.loading.set(false);\n this.response.set(null);\n const message =\n error?.error?.message ??\n error?.message ??\n 'Failed to load module preview';\n this.error.set(message);\n this.errored.emit(message);\n },\n });\n }\n\n ngOnDestroy(): void {\n this.loadSub?.unsubscribe();\n }\n\n private buildLoadRequest(): ProcessFormLoadRequest {\n return {\n moduleKey: this.moduleKey(),\n operationKey: this.operationKey(),\n moduleId: this.moduleId(),\n levelId: this.levelId(),\n levelDataId: this.levelDataId(),\n moduleDataId: this.moduleDataId(),\n requestSchemaId: this.requestSchemaId(),\n draftProcessId: this.draftProcessId(),\n preview: this.preview(),\n };\n }\n}\n\nfunction mapResponseToEntities(\n response: ProcessFormLoadResponse | null,\n lang: 'en' | 'ar',\n formMode: 'create' | 'edit',\n): EntityData[] {\n if (!response?.formConfiguration?.sections?.length) {\n return [];\n }\n\n const valueByKey = new Map<string, ProcessFormValue>();\n for (const value of response.values ?? []) {\n valueByKey.set(value.propertyKey, value);\n }\n\n const entities: EntityData[] = [];\n const sections = [...response.formConfiguration.sections].sort(\n (a, b) => a.order - b.order,\n );\n const seen = new Set<string>();\n let order = 0;\n\n for (const section of sections) {\n const fields = [...(section.fields ?? [])]\n .filter((field) => isVisibleField(field, formMode))\n .sort((a, b) => a.order - b.order);\n\n for (const field of fields) {\n if (!field.propertyKey || seen.has(field.propertyKey)) {\n continue;\n }\n\n const property = field.propertyMetadata ?? field.property;\n if (!property) {\n continue;\n }\n\n seen.add(field.propertyKey);\n const viewType = toEntityViewType(property.viewType);\n const entityValue = mapEntityValue(\n valueByKey.get(field.propertyKey)?.value,\n viewType,\n );\n\n entities.push({\n id: resolveNumber(property.propertyId),\n propertyId: resolveNumber(property.propertyId),\n key: property.key ?? field.propertyKey,\n normalizedKey: readString(property, 'normalizedKey'),\n name: resolvePropertyName(property, lang) || field.propertyKey,\n value: entityValue.value,\n rawValue: entityValue.rawValue,\n viewType,\n order: order++,\n configuration: {\n size: WIDTH_TO_ENTITY_SIZE[field.width] ?? 24,\n },\n });\n }\n }\n\n return entities;\n}\n\nfunction isVisibleField(\n field: ClientFormField,\n formMode: 'create' | 'edit',\n): boolean {\n if (field.isRead === false) {\n return false;\n }\n\n return formMode === 'create'\n ? !field.hiddenInCreation\n : !field.hiddenInEditForm;\n}\n\nfunction resolvePropertyName(\n property: ClientPropertyItem,\n lang: 'en' | 'ar',\n): string {\n if (typeof property.name === 'string') {\n return property.name;\n }\n\n const name = property.name;\n if (!name || typeof name !== 'object') {\n return property.key;\n }\n\n return (\n readString(name, 'display') ??\n readString(name, lang) ??\n readString(name, lang === 'en' ? 'ar' : 'en') ??\n property.key\n );\n}\n\nfunction toEntityViewType(viewType?: string): EntityViewType {\n switch (viewType) {\n case 'LongText':\n case 'Date':\n case 'DateTime':\n case 'Percentage':\n case 'Status':\n case 'Currency':\n case 'Checkbox':\n case 'User':\n case 'Lookup':\n return viewType;\n default:\n return 'Text';\n }\n}\n\nfunction mapEntityValue(\n value: unknown,\n viewType: EntityViewType,\n): Pick<EntityData, 'value' | 'rawValue'> {\n switch (viewType) {\n case 'User': {\n const userValue = mapUserValue(value);\n return {\n value: userValue,\n rawValue: userValue.displayName ?? userValue.userName ?? '',\n };\n }\n case 'Status':\n return mapStatusLikeValue(value);\n case 'Lookup':\n return mapLookupValue(value);\n case 'Percentage':\n return mapPercentageValue(value);\n case 'Checkbox':\n return mapCheckboxValue(value);\n default: {\n const displayValue = resolveDisplayValue(value);\n return {\n value: displayValue,\n rawValue: resolveRawValue(value) ?? displayValue,\n };\n }\n }\n}\n\nfunction mapUserValue(value: unknown): EntityUserValue {\n if (!value || typeof value !== 'object') {\n const displayName = resolveDisplayValue(value);\n return {\n displayName,\n userName: displayName,\n };\n }\n\n return {\n id: readString(value, 'id'),\n userName: readString(value, 'userName'),\n displayName:\n readString(value, 'displayName') ??\n readString(value, 'fullName') ??\n readNestedDisplay(value, 'name') ??\n readString(value, 'userName') ??\n '',\n photoUrl: readString(value, 'photoUrl'),\n phoneNumber:\n readString(value, 'phoneNumber') ?? readString(value, 'mobileNumber'),\n email: readString(value, 'email') ?? readString(value, 'emailAddress'),\n };\n}\n\nfunction mapStatusLikeValue(\n value: unknown,\n): Pick<EntityData, 'value' | 'rawValue'> {\n const display =\n readNestedDisplay(value, 'name') ??\n readString(value, 'display') ??\n resolveDisplayValue(value);\n\n const statusValue: EntityStatusValue = {\n key: readString(value, 'key') ?? display,\n display,\n color: readString(value, 'color') ?? '#64748b',\n description: readNestedDisplay(value, 'description') ?? undefined,\n };\n\n return {\n value: statusValue,\n rawValue: display,\n };\n}\n\nfunction mapLookupValue(\n value: unknown,\n): Pick<EntityData, 'value' | 'rawValue'> {\n const display =\n readNestedDisplay(value, 'name') ??\n readString(value, 'display') ??\n resolveDisplayValue(value);\n\n const lookupValue: EntityLookupValue = {\n key: readString(value, 'key') ?? display,\n display,\n color: readString(value, 'color') ?? '#64748b',\n description: readNestedDisplay(value, 'description') ?? undefined,\n };\n\n return {\n value: lookupValue,\n rawValue: display,\n };\n}\n\nfunction mapPercentageValue(\n value: unknown,\n): Pick<EntityData, 'value' | 'rawValue'> {\n const rawValue = resolveRawValue(value) ?? '';\n const displayValue = resolveDisplayValue(value);\n\n if (!rawValue && !displayValue) {\n return { value: '', rawValue: '' };\n }\n\n const normalizedRaw = rawValue.replace(/%/g, '').trim();\n const normalizedDisplay =\n displayValue.includes('%') || !displayValue.length\n ? displayValue\n : `${displayValue}%`;\n\n return {\n value: normalizedDisplay || `${normalizedRaw}%`,\n rawValue: normalizedRaw || rawValue,\n };\n}\n\nfunction mapCheckboxValue(\n value: unknown,\n): Pick<EntityData, 'value' | 'rawValue'> {\n const rawValue = resolveBooleanString(value);\n return {\n value: rawValue,\n rawValue,\n };\n}\n\nfunction resolveBooleanString(value: unknown): string {\n if (typeof value === 'boolean') {\n return String(value);\n }\n\n const displayValue = resolveDisplayValue(value).trim().toLowerCase();\n if (displayValue === 'true' || displayValue === 'false') {\n return displayValue;\n }\n\n return '';\n}\n\nfunction resolveDisplayValue(value: unknown): string {\n if (typeof value === 'string') {\n return value;\n }\n\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n\n if (!value || typeof value !== 'object') {\n return '';\n }\n\n return (\n readString(value, 'display') ??\n readString(value, 'displayValue') ??\n readString(value, 'actualValue') ??\n readString(value, 'displayName') ??\n readString(value, 'fullName') ??\n readString(value, 'userName') ??\n readNestedDisplay(value, 'name') ??\n readString(value, 'key') ??\n ''\n );\n}\n\nfunction resolveRawValue(value: unknown): string | undefined {\n if (!value || typeof value !== 'object') {\n return value === null || value === undefined ? undefined : String(value);\n }\n\n return (\n readString(value, 'actualValue') ??\n readString(value, 'value') ??\n readString(value, 'displayValue') ??\n undefined\n );\n}\n\nfunction readNestedDisplay(value: unknown, key: string): string | undefined {\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n\n const nested = (value as Record<string, unknown>)[key];\n if (!nested || typeof nested !== 'object') {\n return undefined;\n }\n\n return (\n readString(nested, 'display') ??\n readString(nested, 'en') ??\n readString(nested, 'ar') ??\n undefined\n );\n}\n\nfunction readString(value: unknown, key: string): string | undefined {\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n\n const result = (value as Record<string, unknown>)[key];\n return typeof result === 'string' && result.length ? result : undefined;\n}\n\nfunction resolveNumber(value: unknown): number | undefined {\n return typeof value === 'number' ? value : undefined;\n}\n","@if (loading()) {\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\n @for (item of [1, 2, 3, 4]; track item) {\n <div class=\"rounded-2xl border border-surface-200 bg-surface-50 p-4\">\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\n </div>\n }\n </div>\n} @else if (error()) {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n {{ error() }}\n </p>\n </div>\n} @else if (entities().length) {\n <mt-entities-preview [entities]=\"entities()\" />\n} @else {\n <div\n class=\"flex min-h-[22rem] items-center justify-center rounded-2xl border border-dashed border-surface-300 bg-surface-50 p-6\"\n >\n <p class=\"max-w-md text-center text-sm text-surface-500\">\n No preview data is available for this context.\n </p>\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AA+BA,MAAM,oBAAoB,GAA+B;AACvD,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,KAAK,EAAE,EAAE;CACV;MAQY,mBAAmB,CAAA;AACb,IAAA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AAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACvC,QAAA,OAAO,SAAS;IAClB;AAEA,IAAA,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC;IACtD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACzC,QAAA,OAAO,SAAS;IAClB;AAEA,IAAA,QACE,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC;AAC7B,QAAA,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;AACxB,QAAA,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;AACxB,QAAA,SAAS;AAEb;AAEA,SAAS,UAAU,CAAC,KAAc,EAAE,GAAW,EAAA;IAC7C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACvC,QAAA,OAAO,SAAS;IAClB;AAEA,IAAA,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC;AACtD,IAAA,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS;AACzE;AAEA,SAAS,aAAa,CAAC,KAAc,EAAA;AACnC,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,SAAS;AACtD;;AEtdA;;AAEG;;;;"}
|
|
@@ -149,7 +149,7 @@ class EscalationAddDialog {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EscalationAddDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: EscalationAddDialog, isStandalone: true, selector: "mt-escalation-add-dialog", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, currentUserDisplayName: { classPropertyName: "currentUserDisplayName", publicName: "currentUserDisplayName", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [class]=\"modal.contentClass + ' p-4 flex flex-col gap-4'\">\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"dynamicFormConfig()\"\r\n [formControl]=\"escalationFormControl\"\r\n />\r\n </form>\r\n\r\n @if (submitError(); as errorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n {{ errorMessage }}\r\n </div>\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass + ' flex items-center justify-end gap-2'\">\r\n <mt-button\r\n label=\"Cancel\"\r\n severity=\"secondary\"\r\n [disabled]=\"isSubmitting()\"\r\n (onClick)=\"close()\"\r\n />\r\n\r\n <mt-button\r\n label=\"Escalation Up\"\r\n [loading]=\"isSubmitting()\"\r\n [disabled]=\"isSubmitting() || !escalationFormControl.valid\"\r\n (onClick)=\"createEscalation()\"\r\n />\r\n</div>\r\n", dependencies: [{ 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"], outputs: ["runtimeMessagesChange"] }, { 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"] }] });
|
|
152
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: EscalationAddDialog, isStandalone: true, selector: "mt-escalation-add-dialog", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, currentUserDisplayName: { classPropertyName: "currentUserDisplayName", publicName: "currentUserDisplayName", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [class]=\"modal.contentClass + ' p-4 flex flex-col gap-4'\">\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"dynamicFormConfig()\"\r\n [formControl]=\"escalationFormControl\"\r\n />\r\n </form>\r\n\r\n @if (submitError(); as errorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n {{ errorMessage }}\r\n </div>\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass + ' flex items-center justify-end gap-2'\">\r\n <mt-button\r\n label=\"Cancel\"\r\n severity=\"secondary\"\r\n [disabled]=\"isSubmitting()\"\r\n (onClick)=\"close()\"\r\n />\r\n\r\n <mt-button\r\n label=\"Escalation Up\"\r\n [loading]=\"isSubmitting()\"\r\n [disabled]=\"isSubmitting() || !escalationFormControl.valid\"\r\n (onClick)=\"createEscalation()\"\r\n />\r\n</div>\r\n", dependencies: [{ 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: "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"] }] });
|
|
153
153
|
}
|
|
154
154
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: EscalationAddDialog, decorators: [{
|
|
155
155
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-client-components-escalation-runtime.mjs","sources":["../../../../packages/masterteam/client-components/escalation-runtime/escalation-runtime.service.ts","../../../../packages/masterteam/client-components/escalation-runtime/escalation-add-dialog.ts","../../../../packages/masterteam/client-components/escalation-runtime/escalation-add-dialog.html","../../../../packages/masterteam/client-components/escalation-runtime/masterteam-client-components-escalation-runtime.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { map } from 'rxjs';\r\nimport {\r\n CreateEscalationPayload,\r\n CreateEscalationResponseData,\r\n EscalationRuntimeContext,\r\n Response,\r\n} from './escalation-runtime.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class EscalationRuntimeService {\r\n private readonly http = inject(HttpClient);\r\n\r\n createEscalation(\r\n context: EscalationRuntimeContext,\r\n payload: CreateEscalationPayload,\r\n ) {\r\n return this.http\r\n .post<\r\n Response<CreateEscalationResponseData>\r\n >(`levels/${context.levelId}/${context.levelDataId}/escalations`, payload)\r\n .pipe(map((response) => response.data));\r\n }\r\n}\r\n","import {\r\n Component,\r\n DestroyRef,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\r\nimport {\r\n DateFieldConfig,\r\n DynamicFormConfig,\r\n TextFieldConfig,\r\n TextareaFieldConfig,\r\n UploadFileFieldConfig,\r\n ValidatorConfig,\r\n} from '@masterteam/components';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { ModalRef } from '@masterteam/components/dialog';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { DynamicForm } from '@masterteam/forms/dynamic-form';\r\nimport { finalize } from 'rxjs';\r\nimport { EscalationRuntimeService } from './escalation-runtime.service';\r\nimport {\r\n CreateEscalationPayload,\r\n EscalationCreateResult,\r\n EscalationRuntimeContext,\r\n} from './escalation-runtime.model';\r\n\r\ninterface EscalationAddFormValue {\r\n startDate: Date;\r\n escalatedBy: string;\r\n reason: string;\r\n attachments: EscalationAttachmentValue | null;\r\n}\r\n\r\ninterface EscalationAttachmentValue {\r\n fileName?: string | null;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-escalation-add-dialog',\r\n standalone: true,\r\n imports: [Button, DynamicForm, ReactiveFormsModule],\r\n templateUrl: './escalation-add-dialog.html',\r\n})\r\nexport default class EscalationAddDialog {\r\n readonly modal = inject(ModalService);\r\n readonly ref = inject(ModalRef);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly escalationRuntimeService = inject(EscalationRuntimeService);\r\n private readonly startedAt = new Date();\r\n\r\n readonly context = input.required<EscalationRuntimeContext>();\r\n readonly currentUserDisplayName = input('Current User');\r\n readonly escalationFormControl = new FormControl<EscalationAddFormValue>(\r\n {\r\n startDate: this.startedAt,\r\n escalatedBy: '',\r\n reason: '',\r\n attachments: null,\r\n },\r\n { nonNullable: true },\r\n );\r\n\r\n readonly resolvedCurrentUserDisplayName = computed(\r\n () => this.currentUserDisplayName().trim() || 'Current User',\r\n );\r\n readonly isSubmitting = signal(false);\r\n readonly submitError = signal<string | null>(null);\r\n readonly dynamicFormConfig = computed<DynamicFormConfig>(() => ({\r\n sections: [\r\n {\r\n key: 'escalation-runtime',\r\n type: 'header',\r\n label: '',\r\n fields: [\r\n new TextFieldConfig({\r\n key: 'escalatedBy',\r\n label: 'Escalated By',\r\n disabled: true,\r\n colSpan: 12,\r\n order: 1,\r\n }),\r\n new DateFieldConfig({\r\n key: 'startDate',\r\n label: 'Start Date',\r\n disabled: true,\r\n showIcon: true,\r\n colSpan: 6,\r\n order: 2,\r\n }),\r\n new TextareaFieldConfig({\r\n key: 'reason',\r\n label: 'Reason',\r\n placeholder: 'Describe the escalation reason',\r\n validators: [ValidatorConfig.required()],\r\n rows: 3,\r\n autoResize: true,\r\n colSpan: 12,\r\n order: 3,\r\n }),\r\n new UploadFileFieldConfig({\r\n key: 'attachments',\r\n label: 'Attachments',\r\n title: 'Attachments',\r\n description: 'Upload supporting files',\r\n shape: 'card',\r\n colSpan: 12,\r\n order: 4,\r\n }),\r\n ],\r\n },\r\n ],\r\n }));\r\n\r\n constructor() {\r\n effect(() => {\r\n this.escalationFormControl.setValue(\r\n {\r\n ...this.escalationFormControl.getRawValue(),\r\n startDate: this.startedAt,\r\n escalatedBy: this.resolvedCurrentUserDisplayName(),\r\n },\r\n { emitEvent: false },\r\n );\r\n });\r\n }\r\n\r\n createEscalation(): void {\r\n if (this.isSubmitting()) {\r\n return;\r\n }\r\n\r\n this.submitError.set(null);\r\n\r\n if (this.escalationFormControl.invalid) {\r\n this.escalationFormControl.markAllAsTouched();\r\n return;\r\n }\r\n\r\n const payload = this.buildPayload();\r\n if (!payload.reason) {\r\n this.submitError.set('Reason is required.');\r\n this.escalationFormControl.markAllAsTouched();\r\n return;\r\n }\r\n\r\n this.isSubmitting.set(true);\r\n\r\n this.escalationRuntimeService\r\n .createEscalation(this.context(), payload)\r\n .pipe(\r\n finalize(() => this.isSubmitting.set(false)),\r\n takeUntilDestroyed(this.destroyRef),\r\n )\r\n .subscribe({\r\n next: (response) => {\r\n const result: EscalationCreateResult = {\r\n instanceId: response.instanceId,\r\n moduleDataId: payload.moduleDataId,\r\n };\r\n this.ref.close(result);\r\n },\r\n error: (error) => {\r\n this.submitError.set(\r\n error?.error?.message ?? 'Failed to create escalation.',\r\n );\r\n },\r\n });\r\n }\r\n\r\n close(): void {\r\n if (this.isSubmitting()) {\r\n return;\r\n }\r\n\r\n this.ref.close();\r\n }\r\n\r\n private buildPayload(): CreateEscalationPayload {\r\n const formValue = this.escalationFormControl.getRawValue();\r\n\r\n return {\r\n moduleDataId: this.context().moduleDataId,\r\n reason: formValue.reason.trim(),\r\n notes: '',\r\n attachments: formValue.attachments?.fileName\r\n ? [formValue.attachments.fileName]\r\n : [],\r\n };\r\n }\r\n}\r\n","<div [class]=\"modal.contentClass + ' p-4 flex flex-col gap-4'\">\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"dynamicFormConfig()\"\r\n [formControl]=\"escalationFormControl\"\r\n />\r\n </form>\r\n\r\n @if (submitError(); as errorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n {{ errorMessage }}\r\n </div>\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass + ' flex items-center justify-end gap-2'\">\r\n <mt-button\r\n label=\"Cancel\"\r\n severity=\"secondary\"\r\n [disabled]=\"isSubmitting()\"\r\n (onClick)=\"close()\"\r\n />\r\n\r\n <mt-button\r\n label=\"Escalation Up\"\r\n [loading]=\"isSubmitting()\"\r\n [disabled]=\"isSubmitting() || !escalationFormControl.valid\"\r\n (onClick)=\"createEscalation()\"\r\n />\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAaa,wBAAwB,CAAA;AAClB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IAE1C,gBAAgB,CACd,OA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A,CAAA;kBANvC,SAAS;+BACE,0BAA0B,EAAA,UAAA,EACxB,IAAI,EAAA,OAAA,EACP,CAAC,MAAM,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAA,QAAA,EAAA,+5BAAA,EAAA;;;AE7CrD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"masterteam-client-components-escalation-runtime.mjs","sources":["../../../../packages/masterteam/client-components/escalation-runtime/escalation-runtime.service.ts","../../../../packages/masterteam/client-components/escalation-runtime/escalation-add-dialog.ts","../../../../packages/masterteam/client-components/escalation-runtime/escalation-add-dialog.html","../../../../packages/masterteam/client-components/escalation-runtime/masterteam-client-components-escalation-runtime.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { map } from 'rxjs';\r\nimport {\r\n CreateEscalationPayload,\r\n CreateEscalationResponseData,\r\n EscalationRuntimeContext,\r\n Response,\r\n} from './escalation-runtime.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class EscalationRuntimeService {\r\n private readonly http = inject(HttpClient);\r\n\r\n createEscalation(\r\n context: EscalationRuntimeContext,\r\n payload: CreateEscalationPayload,\r\n ) {\r\n return this.http\r\n .post<\r\n Response<CreateEscalationResponseData>\r\n >(`levels/${context.levelId}/${context.levelDataId}/escalations`, payload)\r\n .pipe(map((response) => response.data));\r\n }\r\n}\r\n","import {\r\n Component,\r\n DestroyRef,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\r\nimport {\r\n DateFieldConfig,\r\n DynamicFormConfig,\r\n TextFieldConfig,\r\n TextareaFieldConfig,\r\n UploadFileFieldConfig,\r\n ValidatorConfig,\r\n} from '@masterteam/components';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { ModalRef } from '@masterteam/components/dialog';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { DynamicForm } from '@masterteam/forms/dynamic-form';\r\nimport { finalize } from 'rxjs';\r\nimport { EscalationRuntimeService } from './escalation-runtime.service';\r\nimport {\r\n CreateEscalationPayload,\r\n EscalationCreateResult,\r\n EscalationRuntimeContext,\r\n} from './escalation-runtime.model';\r\n\r\ninterface EscalationAddFormValue {\r\n startDate: Date;\r\n escalatedBy: string;\r\n reason: string;\r\n attachments: EscalationAttachmentValue | null;\r\n}\r\n\r\ninterface EscalationAttachmentValue {\r\n fileName?: string | null;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-escalation-add-dialog',\r\n standalone: true,\r\n imports: [Button, DynamicForm, ReactiveFormsModule],\r\n templateUrl: './escalation-add-dialog.html',\r\n})\r\nexport default class EscalationAddDialog {\r\n readonly modal = inject(ModalService);\r\n readonly ref = inject(ModalRef);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly escalationRuntimeService = inject(EscalationRuntimeService);\r\n private readonly startedAt = new Date();\r\n\r\n readonly context = input.required<EscalationRuntimeContext>();\r\n readonly currentUserDisplayName = input('Current User');\r\n readonly escalationFormControl = new FormControl<EscalationAddFormValue>(\r\n {\r\n startDate: this.startedAt,\r\n escalatedBy: '',\r\n reason: '',\r\n attachments: null,\r\n },\r\n { nonNullable: true },\r\n );\r\n\r\n readonly resolvedCurrentUserDisplayName = computed(\r\n () => this.currentUserDisplayName().trim() || 'Current User',\r\n );\r\n readonly isSubmitting = signal(false);\r\n readonly submitError = signal<string | null>(null);\r\n readonly dynamicFormConfig = computed<DynamicFormConfig>(() => ({\r\n sections: [\r\n {\r\n key: 'escalation-runtime',\r\n type: 'header',\r\n label: '',\r\n fields: [\r\n new TextFieldConfig({\r\n key: 'escalatedBy',\r\n label: 'Escalated By',\r\n disabled: true,\r\n colSpan: 12,\r\n order: 1,\r\n }),\r\n new DateFieldConfig({\r\n key: 'startDate',\r\n label: 'Start Date',\r\n disabled: true,\r\n showIcon: true,\r\n colSpan: 6,\r\n order: 2,\r\n }),\r\n new TextareaFieldConfig({\r\n key: 'reason',\r\n label: 'Reason',\r\n placeholder: 'Describe the escalation reason',\r\n validators: [ValidatorConfig.required()],\r\n rows: 3,\r\n autoResize: true,\r\n colSpan: 12,\r\n order: 3,\r\n }),\r\n new UploadFileFieldConfig({\r\n key: 'attachments',\r\n label: 'Attachments',\r\n title: 'Attachments',\r\n description: 'Upload supporting files',\r\n shape: 'card',\r\n colSpan: 12,\r\n order: 4,\r\n }),\r\n ],\r\n },\r\n ],\r\n }));\r\n\r\n constructor() {\r\n effect(() => {\r\n this.escalationFormControl.setValue(\r\n {\r\n ...this.escalationFormControl.getRawValue(),\r\n startDate: this.startedAt,\r\n escalatedBy: this.resolvedCurrentUserDisplayName(),\r\n },\r\n { emitEvent: false },\r\n );\r\n });\r\n }\r\n\r\n createEscalation(): void {\r\n if (this.isSubmitting()) {\r\n return;\r\n }\r\n\r\n this.submitError.set(null);\r\n\r\n if (this.escalationFormControl.invalid) {\r\n this.escalationFormControl.markAllAsTouched();\r\n return;\r\n }\r\n\r\n const payload = this.buildPayload();\r\n if (!payload.reason) {\r\n this.submitError.set('Reason is required.');\r\n this.escalationFormControl.markAllAsTouched();\r\n return;\r\n }\r\n\r\n this.isSubmitting.set(true);\r\n\r\n this.escalationRuntimeService\r\n .createEscalation(this.context(), payload)\r\n .pipe(\r\n finalize(() => this.isSubmitting.set(false)),\r\n takeUntilDestroyed(this.destroyRef),\r\n )\r\n .subscribe({\r\n next: (response) => {\r\n const result: EscalationCreateResult = {\r\n instanceId: response.instanceId,\r\n moduleDataId: payload.moduleDataId,\r\n };\r\n this.ref.close(result);\r\n },\r\n error: (error) => {\r\n this.submitError.set(\r\n error?.error?.message ?? 'Failed to create escalation.',\r\n );\r\n },\r\n });\r\n }\r\n\r\n close(): void {\r\n if (this.isSubmitting()) {\r\n return;\r\n }\r\n\r\n this.ref.close();\r\n }\r\n\r\n private buildPayload(): CreateEscalationPayload {\r\n const formValue = this.escalationFormControl.getRawValue();\r\n\r\n return {\r\n moduleDataId: this.context().moduleDataId,\r\n reason: formValue.reason.trim(),\r\n notes: '',\r\n attachments: formValue.attachments?.fileName\r\n ? [formValue.attachments.fileName]\r\n : [],\r\n };\r\n }\r\n}\r\n","<div [class]=\"modal.contentClass + ' p-4 flex flex-col gap-4'\">\r\n <form class=\"col-span-1\">\r\n <mt-dynamic-form\r\n [formConfig]=\"dynamicFormConfig()\"\r\n [formControl]=\"escalationFormControl\"\r\n />\r\n </form>\r\n\r\n @if (submitError(); as errorMessage) {\r\n <div\r\n class=\"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700\"\r\n role=\"alert\"\r\n >\r\n {{ errorMessage }}\r\n </div>\r\n }\r\n</div>\r\n\r\n<div [class]=\"modal.footerClass + ' flex items-center justify-end gap-2'\">\r\n <mt-button\r\n label=\"Cancel\"\r\n severity=\"secondary\"\r\n [disabled]=\"isSubmitting()\"\r\n (onClick)=\"close()\"\r\n />\r\n\r\n <mt-button\r\n label=\"Escalation Up\"\r\n [loading]=\"isSubmitting()\"\r\n [disabled]=\"isSubmitting() || !escalationFormControl.valid\"\r\n (onClick)=\"createEscalation()\"\r\n />\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAaa,wBAAwB,CAAA;AAClB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IAE1C,gBAAgB,CACd,OAAiC,EACjC,OAAgC,EAAA;QAEhC,OAAO,IAAI,CAAC;AACT,aAAA,IAAI,CAEH,CAAA,OAAA,EAAU,OAAO,CAAC,OAAO,CAAA,CAAA,EAAI,OAAO,CAAC,WAAW,CAAA,YAAA,CAAc,EAAE,OAAO;AACxE,aAAA,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3C;uGAZW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA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"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/client-components",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"@angular/common": "^21.0.3",
|
|
11
11
|
"@angular/core": "^21.0.3",
|
|
12
12
|
"@angular/forms": "^21.0.3",
|
|
13
|
-
"@masterteam/forms": "^0.0.43",
|
|
14
13
|
"@tailwindcss/postcss": "^4.1.17",
|
|
15
14
|
"postcss": "^8.5.6",
|
|
16
15
|
"primeng": "21.0.1",
|
|
17
16
|
"rxjs": "^7.8.2",
|
|
18
17
|
"tailwindcss": "^4.1.17",
|
|
19
18
|
"tailwindcss-primeui": "^0.6.1",
|
|
20
|
-
"@masterteam/
|
|
21
|
-
"@masterteam/dashboard-builder": "^0.0.
|
|
19
|
+
"@masterteam/forms": "^0.0.45",
|
|
20
|
+
"@masterteam/dashboard-builder": "^0.0.4",
|
|
21
|
+
"@masterteam/components": "^0.0.98"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"tslib": "^2.8.1"
|
|
@@ -38,9 +38,13 @@
|
|
|
38
38
|
"types": "./types/masterteam-client-components-client-list.d.ts",
|
|
39
39
|
"default": "./fesm2022/masterteam-client-components-client-list.mjs"
|
|
40
40
|
},
|
|
41
|
+
"./client-module-preview": {
|
|
42
|
+
"types": "./types/masterteam-client-components-client-module-preview.d.ts",
|
|
43
|
+
"default": "./fesm2022/masterteam-client-components-client-module-preview.mjs"
|
|
44
|
+
},
|
|
41
45
|
"./escalation-runtime": {
|
|
42
46
|
"types": "./types/masterteam-client-components-escalation-runtime.d.ts",
|
|
43
47
|
"default": "./fesm2022/masterteam-client-components-escalation-runtime.mjs"
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
3
|
+
import { EntityData } from '@masterteam/components/entities';
|
|
4
|
+
import { ProcessFormLoadResponse } from '@masterteam/forms/client-form';
|
|
5
|
+
|
|
6
|
+
declare class ClientModulePreview implements OnDestroy {
|
|
7
|
+
private readonly api;
|
|
8
|
+
private loadSub?;
|
|
9
|
+
readonly moduleKey: _angular_core.InputSignal<string>;
|
|
10
|
+
readonly operationKey: _angular_core.InputSignal<string>;
|
|
11
|
+
readonly moduleId: _angular_core.InputSignal<number | undefined>;
|
|
12
|
+
readonly levelId: _angular_core.InputSignal<number | undefined>;
|
|
13
|
+
readonly levelDataId: _angular_core.InputSignal<number | undefined>;
|
|
14
|
+
readonly moduleDataId: _angular_core.InputSignal<number | undefined>;
|
|
15
|
+
readonly requestSchemaId: _angular_core.InputSignal<number | undefined>;
|
|
16
|
+
readonly draftProcessId: _angular_core.InputSignal<number | undefined>;
|
|
17
|
+
readonly preview: _angular_core.InputSignal<boolean>;
|
|
18
|
+
readonly autoLoad: _angular_core.InputSignal<boolean>;
|
|
19
|
+
readonly lang: _angular_core.InputSignal<"en" | "ar">;
|
|
20
|
+
readonly formMode: _angular_core.InputSignal<"create" | "edit">;
|
|
21
|
+
readonly loaded: _angular_core.OutputEmitterRef<ProcessFormLoadResponse>;
|
|
22
|
+
readonly errored: _angular_core.OutputEmitterRef<string>;
|
|
23
|
+
readonly loading: _angular_core.WritableSignal<boolean>;
|
|
24
|
+
readonly error: _angular_core.WritableSignal<string | null>;
|
|
25
|
+
readonly response: _angular_core.WritableSignal<ProcessFormLoadResponse | null>;
|
|
26
|
+
readonly entities: _angular_core.Signal<EntityData[]>;
|
|
27
|
+
constructor();
|
|
28
|
+
load(): void;
|
|
29
|
+
ngOnDestroy(): void;
|
|
30
|
+
private buildLoadRequest;
|
|
31
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientModulePreview, never>;
|
|
32
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClientModulePreview, "mt-client-module-preview", never, { "moduleKey": { "alias": "moduleKey"; "required": true; "isSignal": true; }; "operationKey": { "alias": "operationKey"; "required": true; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "levelId": { "alias": "levelId"; "required": false; "isSignal": true; }; "levelDataId": { "alias": "levelDataId"; "required": false; "isSignal": true; }; "moduleDataId": { "alias": "moduleDataId"; "required": false; "isSignal": true; }; "requestSchemaId": { "alias": "requestSchemaId"; "required": false; "isSignal": true; }; "draftProcessId": { "alias": "draftProcessId"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "lang": { "alias": "lang"; "required": false; "isSignal": true; }; "formMode": { "alias": "formMode"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "errored": "errored"; }, never, never, true, never>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { ClientModulePreview };
|