@masterteam/components 0.0.156 → 0.0.158
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/common.css +1 -1
- package/fesm2022/masterteam-components-business-fields.mjs +165 -2
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-drawer.mjs +75 -5
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +159 -19
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-runtime-action.mjs +363 -0
- package/fesm2022/masterteam-components-runtime-action.mjs.map +1 -0
- package/fesm2022/masterteam-components-table.mjs +2 -2
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +17 -1
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/masterteam-components-business-fields.d.ts +63 -2
- package/types/masterteam-components-drawer.d.ts +11 -1
- package/types/masterteam-components-dynamic-drawer.d.ts +28 -0
- package/types/masterteam-components-runtime-action.d.ts +102 -0
- package/types/masterteam-components.d.ts +27 -3
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, Injectable, InjectionToken, inject } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
5
|
+
import { ModalService } from '@masterteam/components/modal';
|
|
6
|
+
import { ToastService } from '@masterteam/components/toast';
|
|
7
|
+
import { firstValueFrom, map } from 'rxjs';
|
|
8
|
+
|
|
9
|
+
function resolveActionLabel(action) {
|
|
10
|
+
const name = action.actionName;
|
|
11
|
+
if (typeof name === 'string') {
|
|
12
|
+
return name || action.actionKey;
|
|
13
|
+
}
|
|
14
|
+
return name?.display || action.actionKey;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function buildActionPayload(action, formValue, externalResolvers = {}) {
|
|
18
|
+
const templatePayload = buildTemplatePayload(action, formValue, externalResolvers);
|
|
19
|
+
if (templatePayload) {
|
|
20
|
+
return templatePayload;
|
|
21
|
+
}
|
|
22
|
+
const payloadKeys = action.payloadKeys ?? [];
|
|
23
|
+
if (!payloadKeys.length) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const payload = {};
|
|
27
|
+
for (const key of payloadKeys) {
|
|
28
|
+
const formFieldValue = formValue?.[key];
|
|
29
|
+
if (formFieldValue !== undefined) {
|
|
30
|
+
payload[key] = normalizePayloadValue(key, formFieldValue);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const externalValue = resolveExternalPayloadValue(key, action, externalResolvers);
|
|
34
|
+
if (externalValue !== undefined) {
|
|
35
|
+
payload[key] = externalValue;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const defaultValue = resolveDefaultPayloadValue(key);
|
|
39
|
+
if (defaultValue !== undefined) {
|
|
40
|
+
payload[key] = defaultValue;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Object.keys(payload).length ? payload : undefined;
|
|
44
|
+
}
|
|
45
|
+
function buildTemplatePayload(action, formValue, externalResolvers) {
|
|
46
|
+
const template = action.payloadTemplate;
|
|
47
|
+
if (!template || typeof template !== 'object') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const payload = {};
|
|
51
|
+
const payloadKeys = action.payloadKeys ?? Object.keys(template);
|
|
52
|
+
for (const key of payloadKeys) {
|
|
53
|
+
if (key === 'fields') {
|
|
54
|
+
payload[key] = resolveTemplateFieldsValue(action, template, formValue);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const formFieldValue = formValue?.[key];
|
|
58
|
+
if (formFieldValue !== undefined) {
|
|
59
|
+
payload[key] = normalizePayloadValue(key, formFieldValue);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const externalValue = resolveExternalPayloadValue(key, action, externalResolvers);
|
|
63
|
+
if (externalValue !== undefined) {
|
|
64
|
+
payload[key] = externalValue;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (template[key] !== undefined) {
|
|
68
|
+
payload[key] = template[key];
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const defaultValue = resolveDefaultPayloadValue(key);
|
|
72
|
+
if (defaultValue !== undefined) {
|
|
73
|
+
payload[key] = defaultValue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return Object.keys(payload).length ? payload : null;
|
|
77
|
+
}
|
|
78
|
+
function resolveExternalPayloadValue(key, action, externalResolvers) {
|
|
79
|
+
const resolver = externalResolvers[key];
|
|
80
|
+
if (resolver) {
|
|
81
|
+
return resolver();
|
|
82
|
+
}
|
|
83
|
+
if (key === 'stepId') {
|
|
84
|
+
return action.stepIds?.[0];
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
function normalizePayloadValue(key, value) {
|
|
89
|
+
if (key === 'attachments') {
|
|
90
|
+
if (value == null) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
return Array.isArray(value) ? value : [value];
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
function resolveDefaultPayloadValue(key) {
|
|
98
|
+
switch (key) {
|
|
99
|
+
case 'attachments':
|
|
100
|
+
return [];
|
|
101
|
+
case 'delegatedUser':
|
|
102
|
+
case 'note':
|
|
103
|
+
case 'reason':
|
|
104
|
+
return null;
|
|
105
|
+
case 'values':
|
|
106
|
+
return [];
|
|
107
|
+
default:
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getMissingRequiredPayloadKeys(action, payload) {
|
|
112
|
+
return (action.requiredPayloadKeys ?? []).filter((key) => isMissingPayloadValue(payload?.[key]));
|
|
113
|
+
}
|
|
114
|
+
function isMissingPayloadValue(value) {
|
|
115
|
+
if (value == null) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
if (typeof value === 'string') {
|
|
119
|
+
return value.trim().length === 0;
|
|
120
|
+
}
|
|
121
|
+
if (Array.isArray(value)) {
|
|
122
|
+
return value.length === 0;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
function normalizeHttpMethod(value) {
|
|
127
|
+
if (!value || typeof value !== 'string') {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const method = value.trim().toUpperCase();
|
|
131
|
+
return method.length ? method : null;
|
|
132
|
+
}
|
|
133
|
+
function methodSupportsBody(method) {
|
|
134
|
+
return ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
|
|
135
|
+
}
|
|
136
|
+
function buildRequestOptions(method, payload) {
|
|
137
|
+
if (!payload || !methodSupportsBody(method)) {
|
|
138
|
+
return { observe: 'body' };
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
body: payload,
|
|
142
|
+
observe: 'body',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function hasActionFormFields(action) {
|
|
146
|
+
return ((action.payloadKeys ?? []).some((key) => ['delegatedUser', 'reason', 'note', 'attachments'].includes(key)) || hasProgressTemplateField(action));
|
|
147
|
+
}
|
|
148
|
+
function hasProgressTemplateField(action) {
|
|
149
|
+
const fields = action.payloadTemplate
|
|
150
|
+
?.fields;
|
|
151
|
+
return (Array.isArray(fields) &&
|
|
152
|
+
fields.some((field) => !!field &&
|
|
153
|
+
typeof field === 'object' &&
|
|
154
|
+
field.propertyKey === 'Progress'));
|
|
155
|
+
}
|
|
156
|
+
function resolveTemplateFieldsValue(action, template, formValue) {
|
|
157
|
+
const templateFields = template['fields'];
|
|
158
|
+
if (!Array.isArray(templateFields)) {
|
|
159
|
+
return formValue?.['fields'] ?? templateFields;
|
|
160
|
+
}
|
|
161
|
+
if (!hasProgressTemplateField(action)) {
|
|
162
|
+
return formValue?.['fields'] ?? templateFields;
|
|
163
|
+
}
|
|
164
|
+
return templateFields.map((field) => {
|
|
165
|
+
if (!field ||
|
|
166
|
+
typeof field !== 'object' ||
|
|
167
|
+
field.propertyKey !== 'Progress') {
|
|
168
|
+
return field;
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
...field,
|
|
172
|
+
value: formValue?.['progress'] ?? field.value,
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
class RuntimeActionContextStore {
|
|
178
|
+
formSource = signal(null, ...(ngDevMode ? [{ debugName: "formSource" }] : /* istanbul ignore next */ []));
|
|
179
|
+
setFormSource(source) {
|
|
180
|
+
this.formSource.set(source);
|
|
181
|
+
}
|
|
182
|
+
resolveFormValues() {
|
|
183
|
+
const values = this.formSource()?.getSubmitValues();
|
|
184
|
+
return Array.isArray(values)
|
|
185
|
+
? values.map((value) => ({
|
|
186
|
+
requestPropertyId: value.requestPropertyId,
|
|
187
|
+
propertyKey: value.propertyKey,
|
|
188
|
+
value: value.value,
|
|
189
|
+
}))
|
|
190
|
+
: [];
|
|
191
|
+
}
|
|
192
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionContextStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
193
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionContextStore });
|
|
194
|
+
}
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionContextStore, decorators: [{
|
|
196
|
+
type: Injectable
|
|
197
|
+
}] });
|
|
198
|
+
|
|
199
|
+
const RUNTIME_ACTION_CONFIRM_DIALOG = new InjectionToken('RUNTIME_ACTION_CONFIRM_DIALOG');
|
|
200
|
+
class RuntimeActionRunner {
|
|
201
|
+
http = inject(HttpClient);
|
|
202
|
+
confirmation = inject(ConfirmationService);
|
|
203
|
+
modal = inject(ModalService);
|
|
204
|
+
toast = inject(ToastService);
|
|
205
|
+
confirmDialogClass = inject(RUNTIME_ACTION_CONFIRM_DIALOG, {
|
|
206
|
+
optional: true,
|
|
207
|
+
});
|
|
208
|
+
async execute(action, options = {}) {
|
|
209
|
+
const method = normalizeHttpMethod(action.httpMethod);
|
|
210
|
+
const url = action.url?.trim();
|
|
211
|
+
if (!method || !url || action.isAvailable === false) {
|
|
212
|
+
return cancelledOrError(action, 'error', new Error(notExecutableMessage(action)));
|
|
213
|
+
}
|
|
214
|
+
let formValue;
|
|
215
|
+
if (action.needConfirmation) {
|
|
216
|
+
const dialogResult = await this.confirm(action);
|
|
217
|
+
if (dialogResult === 'cancelled') {
|
|
218
|
+
return {
|
|
219
|
+
status: 'cancelled',
|
|
220
|
+
actionKey: action.actionKey,
|
|
221
|
+
afterSuccess: null,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
formValue = dialogResult ?? undefined;
|
|
225
|
+
}
|
|
226
|
+
let payload = buildActionPayload(action, formValue, options.externalPayloadResolvers ?? {});
|
|
227
|
+
if (options.transformPayload) {
|
|
228
|
+
payload = options.transformPayload(payload, action);
|
|
229
|
+
}
|
|
230
|
+
const missing = getMissingRequiredPayloadKeys(action, payload);
|
|
231
|
+
if (missing.length) {
|
|
232
|
+
const message = `Cannot execute ${resolveActionLabel(action)}. Missing: ${missing.join(', ')}.`;
|
|
233
|
+
if (!options.silent) {
|
|
234
|
+
this.toast.error(message);
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
status: 'error',
|
|
238
|
+
actionKey: action.actionKey,
|
|
239
|
+
afterSuccess: null,
|
|
240
|
+
error: new Error(message),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return this.run(action, method, url, payload, options);
|
|
244
|
+
}
|
|
245
|
+
async confirm(action) {
|
|
246
|
+
if (hasActionFormFields(action) && this.confirmDialogClass) {
|
|
247
|
+
const ref = this.modal.openModal(this.confirmDialogClass, 'dialog', {
|
|
248
|
+
header: resolveActionLabel(action),
|
|
249
|
+
width: '40rem',
|
|
250
|
+
dismissableMask: true,
|
|
251
|
+
inputValues: { action },
|
|
252
|
+
});
|
|
253
|
+
const value = await firstValueFrom(ref.onClose);
|
|
254
|
+
const formValue = value;
|
|
255
|
+
if (formValue == null) {
|
|
256
|
+
return 'cancelled';
|
|
257
|
+
}
|
|
258
|
+
return formValue;
|
|
259
|
+
}
|
|
260
|
+
return new Promise((resolve) => {
|
|
261
|
+
const label = resolveActionLabel(action);
|
|
262
|
+
this.confirmation.confirm({
|
|
263
|
+
type: 'dialog',
|
|
264
|
+
header: label,
|
|
265
|
+
message: `Confirm ${label} for this item.`,
|
|
266
|
+
acceptLabel: label,
|
|
267
|
+
icon: 'alert.alert-triangle',
|
|
268
|
+
accept: () => resolve(null),
|
|
269
|
+
reject: () => resolve('cancelled'),
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
async run(action, method, url, payload, options) {
|
|
274
|
+
const fallbackErrorMessage = `Failed to execute ${resolveActionLabel(action)}.`;
|
|
275
|
+
try {
|
|
276
|
+
const response = await firstValueFrom(this.http
|
|
277
|
+
.request(method, url, buildRequestOptions(method, payload))
|
|
278
|
+
.pipe(map((res) => ensureSuccessfulEnvelope(res, fallbackErrorMessage))));
|
|
279
|
+
if (options.successMessage && !options.silent) {
|
|
280
|
+
this.toast.success(options.successMessage(response, action));
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
status: 'success',
|
|
284
|
+
actionKey: action.actionKey,
|
|
285
|
+
afterSuccess: resolveAfterSuccess(action, options.defaultAfterSuccess),
|
|
286
|
+
response,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
const message = options.errorMessage?.(error, action) ??
|
|
291
|
+
resolveHttpErrorMessage(error, fallbackErrorMessage);
|
|
292
|
+
if (!options.silent) {
|
|
293
|
+
this.toast.error(message);
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
status: 'error',
|
|
297
|
+
actionKey: action.actionKey,
|
|
298
|
+
afterSuccess: null,
|
|
299
|
+
error,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionRunner, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
304
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionRunner, providedIn: 'root' });
|
|
305
|
+
}
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionRunner, decorators: [{
|
|
307
|
+
type: Injectable,
|
|
308
|
+
args: [{ providedIn: 'root' }]
|
|
309
|
+
}] });
|
|
310
|
+
function notExecutableMessage(action) {
|
|
311
|
+
if (action.isAvailable === false) {
|
|
312
|
+
return `Action ${action.actionKey} is not available.`;
|
|
313
|
+
}
|
|
314
|
+
if (!action.url) {
|
|
315
|
+
return `Action ${action.actionKey} has no url.`;
|
|
316
|
+
}
|
|
317
|
+
return `Action ${action.actionKey} has no http method.`;
|
|
318
|
+
}
|
|
319
|
+
function cancelledOrError(action, status, error) {
|
|
320
|
+
return {
|
|
321
|
+
status,
|
|
322
|
+
actionKey: action.actionKey,
|
|
323
|
+
afterSuccess: null,
|
|
324
|
+
error,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function resolveAfterSuccess(action, fallback) {
|
|
328
|
+
if (action.afterSuccess === 'close' || action.afterSuccess === 'refresh') {
|
|
329
|
+
return action.afterSuccess;
|
|
330
|
+
}
|
|
331
|
+
return fallback ?? 'refresh';
|
|
332
|
+
}
|
|
333
|
+
function ensureSuccessfulEnvelope(response, fallback) {
|
|
334
|
+
if (!response || typeof response !== 'object') {
|
|
335
|
+
return response;
|
|
336
|
+
}
|
|
337
|
+
const envelope = response;
|
|
338
|
+
if (typeof envelope.code === 'number' && envelope.code !== 1) {
|
|
339
|
+
throw new Error(resolveEnvelopeErrorMessage(response, fallback));
|
|
340
|
+
}
|
|
341
|
+
return response;
|
|
342
|
+
}
|
|
343
|
+
function resolveEnvelopeErrorMessage(response, fallback) {
|
|
344
|
+
if (!response || typeof response !== 'object') {
|
|
345
|
+
return fallback;
|
|
346
|
+
}
|
|
347
|
+
const envelope = response;
|
|
348
|
+
return envelope.errors?.message ?? envelope.message ?? fallback;
|
|
349
|
+
}
|
|
350
|
+
function resolveHttpErrorMessage(error, fallback) {
|
|
351
|
+
if (!error || typeof error !== 'object') {
|
|
352
|
+
return fallback;
|
|
353
|
+
}
|
|
354
|
+
const httpError = error;
|
|
355
|
+
return httpError.error?.message ?? httpError.message ?? fallback;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Generated bundle index. Do not edit.
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
export { RUNTIME_ACTION_CONFIRM_DIALOG, RuntimeActionContextStore, RuntimeActionRunner, buildActionPayload, buildRequestOptions, getMissingRequiredPayloadKeys, hasActionFormFields, hasProgressTemplateField, isMissingPayloadValue, methodSupportsBody, normalizeHttpMethod, normalizePayloadValue, resolveActionLabel, resolveDefaultPayloadValue };
|
|
363
|
+
//# sourceMappingURL=masterteam-components-runtime-action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-runtime-action.mjs","sources":["../../../../packages/masterteam/components/runtime-action/runtime-action.types.ts","../../../../packages/masterteam/components/runtime-action/payload-builder.ts","../../../../packages/masterteam/components/runtime-action/runtime-action-context.store.ts","../../../../packages/masterteam/components/runtime-action/runtime-action.runner.ts","../../../../packages/masterteam/components/runtime-action/masterteam-components-runtime-action.ts"],"sourcesContent":["export interface RuntimeActionTranslatable {\n display?: string;\n en?: string;\n ar?: string;\n}\n\nexport type RuntimeActionAfterSuccess = 'refresh' | 'close';\n\nexport interface RuntimeActionReason {\n source?: string;\n code?: string;\n message?: string;\n blocking?: boolean;\n details?: string | null;\n ruleKey?: string | null;\n requestId?: number | null;\n requestStatus?: string | null;\n requestSchemaId?: number | null;\n relatedRequestIds?: number[];\n}\n\nexport interface RuntimeAction {\n actionKey: string;\n actionName?: RuntimeActionTranslatable | string | null;\n httpMethod?: string | null;\n url?: string | null;\n isAvailable?: boolean;\n afterSuccess?: RuntimeActionAfterSuccess | null;\n stepIds?: Array<number | string>;\n needConfirmation?: boolean;\n payloadKeys?: string[];\n requiredPayloadKeys?: string[];\n payloadTemplate?: Record<string, unknown> | null;\n formId?: string | number | null;\n\n targetType?: string;\n targetId?: number;\n moduleKey?: string;\n operationKey?: string;\n primaryReasonCode?: string | null;\n reasons?: RuntimeActionReason[];\n}\n\nexport type RuntimeActionStatus = 'success' | 'error' | 'cancelled';\n\nexport interface RuntimeActionResult {\n status: RuntimeActionStatus;\n actionKey: string;\n afterSuccess: RuntimeActionAfterSuccess | null;\n response?: unknown;\n error?: unknown;\n}\n\nexport interface RuntimeActionExecuteOptions {\n externalPayloadResolvers?: Record<string, () => unknown>;\n defaultAfterSuccess?: RuntimeActionAfterSuccess;\n successMessage?: (response: unknown, action: RuntimeAction) => string;\n errorMessage?: (error: unknown, action: RuntimeAction) => string;\n transformPayload?: (\n payload: Record<string, unknown> | undefined,\n action: RuntimeAction,\n ) => Record<string, unknown> | undefined;\n silent?: boolean;\n}\n\nexport interface RuntimeActionFormValue {\n requestPropertyId?: number;\n propertyKey: string;\n value: unknown;\n}\n\nexport interface RuntimeActionFormSource {\n getSubmitValues(): RuntimeActionFormValue[] | undefined;\n}\n\nexport function resolveActionLabel(action: RuntimeAction): string {\n const name = action.actionName;\n if (typeof name === 'string') {\n return name || action.actionKey;\n }\n return name?.display || action.actionKey;\n}\n","import { RuntimeAction } from './runtime-action.types';\n\nexport function buildActionPayload(\n action: RuntimeAction,\n formValue: Record<string, unknown> | undefined,\n externalResolvers: Record<string, () => unknown> = {},\n): Record<string, unknown> | undefined {\n const templatePayload = buildTemplatePayload(\n action,\n formValue,\n externalResolvers,\n );\n if (templatePayload) {\n return templatePayload;\n }\n\n const payloadKeys = action.payloadKeys ?? [];\n if (!payloadKeys.length) {\n return undefined;\n }\n\n const payload: Record<string, unknown> = {};\n\n for (const key of payloadKeys) {\n const formFieldValue = formValue?.[key];\n if (formFieldValue !== undefined) {\n payload[key] = normalizePayloadValue(key, formFieldValue);\n continue;\n }\n\n const externalValue = resolveExternalPayloadValue(\n key,\n action,\n externalResolvers,\n );\n if (externalValue !== undefined) {\n payload[key] = externalValue;\n continue;\n }\n\n const defaultValue = resolveDefaultPayloadValue(key);\n if (defaultValue !== undefined) {\n payload[key] = defaultValue;\n }\n }\n\n return Object.keys(payload).length ? payload : undefined;\n}\n\nfunction buildTemplatePayload(\n action: RuntimeAction,\n formValue: Record<string, unknown> | undefined,\n externalResolvers: Record<string, () => unknown>,\n): Record<string, unknown> | null {\n const template = action.payloadTemplate as Record<string, unknown> | null;\n if (!template || typeof template !== 'object') {\n return null;\n }\n\n const payload: Record<string, unknown> = {};\n const payloadKeys = action.payloadKeys ?? Object.keys(template);\n\n for (const key of payloadKeys) {\n if (key === 'fields') {\n payload[key] = resolveTemplateFieldsValue(action, template, formValue);\n continue;\n }\n\n const formFieldValue = formValue?.[key];\n if (formFieldValue !== undefined) {\n payload[key] = normalizePayloadValue(key, formFieldValue);\n continue;\n }\n\n const externalValue = resolveExternalPayloadValue(\n key,\n action,\n externalResolvers,\n );\n if (externalValue !== undefined) {\n payload[key] = externalValue;\n continue;\n }\n\n if (template[key] !== undefined) {\n payload[key] = template[key];\n continue;\n }\n\n const defaultValue = resolveDefaultPayloadValue(key);\n if (defaultValue !== undefined) {\n payload[key] = defaultValue;\n }\n }\n\n return Object.keys(payload).length ? payload : null;\n}\n\nfunction resolveExternalPayloadValue(\n key: string,\n action: RuntimeAction,\n externalResolvers: Record<string, () => unknown>,\n): unknown {\n const resolver = externalResolvers[key];\n if (resolver) {\n return resolver();\n }\n\n if (key === 'stepId') {\n return action.stepIds?.[0];\n }\n\n return undefined;\n}\n\nexport function normalizePayloadValue(key: string, value: unknown): unknown {\n if (key === 'attachments') {\n if (value == null) {\n return [];\n }\n return Array.isArray(value) ? value : [value];\n }\n\n return value;\n}\n\nexport function resolveDefaultPayloadValue(key: string): unknown {\n switch (key) {\n case 'attachments':\n return [];\n case 'delegatedUser':\n case 'note':\n case 'reason':\n return null;\n case 'values':\n return [];\n default:\n return undefined;\n }\n}\n\nexport function getMissingRequiredPayloadKeys(\n action: RuntimeAction,\n payload: Record<string, unknown> | undefined,\n): string[] {\n return (action.requiredPayloadKeys ?? []).filter((key) =>\n isMissingPayloadValue(payload?.[key]),\n );\n}\n\nexport function isMissingPayloadValue(value: unknown): boolean {\n if (value == null) {\n return true;\n }\n\n if (typeof value === 'string') {\n return value.trim().length === 0;\n }\n\n if (Array.isArray(value)) {\n return value.length === 0;\n }\n\n return false;\n}\n\nexport function normalizeHttpMethod(\n value: string | null | undefined,\n): string | null {\n if (!value || typeof value !== 'string') {\n return null;\n }\n\n const method = value.trim().toUpperCase();\n return method.length ? method : null;\n}\n\nexport function methodSupportsBody(method: string): boolean {\n return ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);\n}\n\nexport function buildRequestOptions(\n method: string,\n payload: Record<string, unknown> | undefined,\n): Record<string, unknown> {\n if (!payload || !methodSupportsBody(method)) {\n return { observe: 'body' };\n }\n\n return {\n body: payload,\n observe: 'body',\n };\n}\n\nexport function hasActionFormFields(action: RuntimeAction): boolean {\n return (\n (action.payloadKeys ?? []).some((key) =>\n ['delegatedUser', 'reason', 'note', 'attachments'].includes(key),\n ) || hasProgressTemplateField(action)\n );\n}\n\nexport function hasProgressTemplateField(action: RuntimeAction): boolean {\n const fields = (action.payloadTemplate as { fields?: unknown } | null)\n ?.fields;\n return (\n Array.isArray(fields) &&\n fields.some(\n (field) =>\n !!field &&\n typeof field === 'object' &&\n (field as { propertyKey?: string }).propertyKey === 'Progress',\n )\n );\n}\n\nfunction resolveTemplateFieldsValue(\n action: RuntimeAction,\n template: Record<string, unknown>,\n formValue: Record<string, unknown> | undefined,\n): unknown {\n const templateFields = template['fields'];\n if (!Array.isArray(templateFields)) {\n return formValue?.['fields'] ?? templateFields;\n }\n\n if (!hasProgressTemplateField(action)) {\n return formValue?.['fields'] ?? templateFields;\n }\n\n return templateFields.map((field) => {\n if (\n !field ||\n typeof field !== 'object' ||\n (field as { propertyKey?: string }).propertyKey !== 'Progress'\n ) {\n return field;\n }\n\n return {\n ...(field as Record<string, unknown>),\n value: formValue?.['progress'] ?? (field as { value?: unknown }).value,\n };\n });\n}\n","import { Injectable, signal } from '@angular/core';\n\nimport {\n RuntimeActionFormSource,\n RuntimeActionFormValue,\n} from './runtime-action.types';\n\n@Injectable()\nexport class RuntimeActionContextStore {\n private readonly formSource = signal<RuntimeActionFormSource | null>(null);\n\n setFormSource(source: RuntimeActionFormSource | null): void {\n this.formSource.set(source);\n }\n\n resolveFormValues(): RuntimeActionFormValue[] {\n const values = this.formSource()?.getSubmitValues();\n return Array.isArray(values)\n ? values.map((value) => ({\n requestPropertyId: value.requestPropertyId,\n propertyKey: value.propertyKey,\n value: value.value,\n }))\n : [];\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, InjectionToken, Type, inject } from '@angular/core';\nimport { ConfirmationService } from '@masterteam/components/confirmation';\nimport { ModalService } from '@masterteam/components/modal';\nimport { ToastService } from '@masterteam/components/toast';\nimport { firstValueFrom, map } from 'rxjs';\n\nimport {\n buildActionPayload,\n buildRequestOptions,\n getMissingRequiredPayloadKeys,\n hasActionFormFields,\n normalizeHttpMethod,\n} from './payload-builder';\nimport {\n RuntimeAction,\n RuntimeActionAfterSuccess,\n RuntimeActionExecuteOptions,\n RuntimeActionResult,\n resolveActionLabel,\n} from './runtime-action.types';\n\nexport const RUNTIME_ACTION_CONFIRM_DIALOG = new InjectionToken<Type<unknown>>(\n 'RUNTIME_ACTION_CONFIRM_DIALOG',\n);\n\n@Injectable({ providedIn: 'root' })\nexport class RuntimeActionRunner {\n private readonly http = inject(HttpClient);\n private readonly confirmation = inject(ConfirmationService);\n private readonly modal = inject(ModalService);\n private readonly toast = inject(ToastService);\n private readonly confirmDialogClass = inject(RUNTIME_ACTION_CONFIRM_DIALOG, {\n optional: true,\n });\n\n async execute(\n action: RuntimeAction,\n options: RuntimeActionExecuteOptions = {},\n ): Promise<RuntimeActionResult> {\n const method = normalizeHttpMethod(action.httpMethod);\n const url = action.url?.trim();\n\n if (!method || !url || action.isAvailable === false) {\n return cancelledOrError(\n action,\n 'error',\n new Error(notExecutableMessage(action)),\n );\n }\n\n let formValue: Record<string, unknown> | undefined;\n\n if (action.needConfirmation) {\n const dialogResult = await this.confirm(action);\n if (dialogResult === 'cancelled') {\n return {\n status: 'cancelled',\n actionKey: action.actionKey,\n afterSuccess: null,\n };\n }\n formValue = dialogResult ?? undefined;\n }\n\n let payload = buildActionPayload(\n action,\n formValue,\n options.externalPayloadResolvers ?? {},\n );\n\n if (options.transformPayload) {\n payload = options.transformPayload(payload, action);\n }\n\n const missing = getMissingRequiredPayloadKeys(action, payload);\n if (missing.length) {\n const message = `Cannot execute ${resolveActionLabel(action)}. Missing: ${missing.join(', ')}.`;\n if (!options.silent) {\n this.toast.error(message);\n }\n return {\n status: 'error',\n actionKey: action.actionKey,\n afterSuccess: null,\n error: new Error(message),\n };\n }\n\n return this.run(action, method, url, payload, options);\n }\n\n private async confirm(\n action: RuntimeAction,\n ): Promise<'cancelled' | Record<string, unknown> | null> {\n if (hasActionFormFields(action) && this.confirmDialogClass) {\n const ref = this.modal.openModal(this.confirmDialogClass, 'dialog', {\n header: resolveActionLabel(action),\n width: '40rem',\n dismissableMask: true,\n inputValues: { action },\n });\n\n const value = await firstValueFrom(ref.onClose);\n const formValue = value as Record<string, unknown> | null | undefined;\n if (formValue == null) {\n return 'cancelled';\n }\n return formValue;\n }\n\n return new Promise((resolve) => {\n const label = resolveActionLabel(action);\n this.confirmation.confirm({\n type: 'dialog',\n header: label,\n message: `Confirm ${label} for this item.`,\n acceptLabel: label,\n icon: 'alert.alert-triangle',\n accept: () => resolve(null),\n reject: () => resolve('cancelled'),\n });\n });\n }\n\n private async run(\n action: RuntimeAction,\n method: string,\n url: string,\n payload: Record<string, unknown> | undefined,\n options: RuntimeActionExecuteOptions,\n ): Promise<RuntimeActionResult> {\n const fallbackErrorMessage = `Failed to execute ${resolveActionLabel(action)}.`;\n\n try {\n const response = await firstValueFrom(\n this.http\n .request<unknown>(method, url, buildRequestOptions(method, payload))\n .pipe(\n map((res) => ensureSuccessfulEnvelope(res, fallbackErrorMessage)),\n ),\n );\n\n if (options.successMessage && !options.silent) {\n this.toast.success(options.successMessage(response, action));\n }\n\n return {\n status: 'success',\n actionKey: action.actionKey,\n afterSuccess: resolveAfterSuccess(action, options.defaultAfterSuccess),\n response,\n };\n } catch (error) {\n const message =\n options.errorMessage?.(error, action) ??\n resolveHttpErrorMessage(error, fallbackErrorMessage);\n\n if (!options.silent) {\n this.toast.error(message);\n }\n\n return {\n status: 'error',\n actionKey: action.actionKey,\n afterSuccess: null,\n error,\n };\n }\n }\n}\n\nfunction notExecutableMessage(action: RuntimeAction): string {\n if (action.isAvailable === false) {\n return `Action ${action.actionKey} is not available.`;\n }\n if (!action.url) {\n return `Action ${action.actionKey} has no url.`;\n }\n return `Action ${action.actionKey} has no http method.`;\n}\n\nfunction cancelledOrError(\n action: RuntimeAction,\n status: 'error' | 'cancelled',\n error?: unknown,\n): RuntimeActionResult {\n return {\n status,\n actionKey: action.actionKey,\n afterSuccess: null,\n error,\n };\n}\n\nfunction resolveAfterSuccess(\n action: RuntimeAction,\n fallback: RuntimeActionAfterSuccess | undefined,\n): RuntimeActionAfterSuccess {\n if (action.afterSuccess === 'close' || action.afterSuccess === 'refresh') {\n return action.afterSuccess;\n }\n return fallback ?? 'refresh';\n}\n\nfunction ensureSuccessfulEnvelope(\n response: unknown,\n fallback: string,\n): unknown {\n if (!response || typeof response !== 'object') {\n return response;\n }\n\n const envelope = response as { code?: number };\n if (typeof envelope.code === 'number' && envelope.code !== 1) {\n throw new Error(resolveEnvelopeErrorMessage(response, fallback));\n }\n return response;\n}\n\nfunction resolveEnvelopeErrorMessage(\n response: unknown,\n fallback: string,\n): string {\n if (!response || typeof response !== 'object') {\n return fallback;\n }\n const envelope = response as {\n message?: string | null;\n errors?: { message?: string } | null;\n };\n return envelope.errors?.message ?? envelope.message ?? fallback;\n}\n\nfunction resolveHttpErrorMessage(error: unknown, fallback: string): string {\n if (!error || typeof error !== 'object') {\n return fallback;\n }\n const httpError = error as {\n message?: string;\n error?: { message?: string | null } | null;\n };\n return httpError.error?.message ?? httpError.message ?? fallback;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AA2EM,SAAU,kBAAkB,CAAC,MAAqB,EAAA;AACtD,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU;AAC9B,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC5B,QAAA,OAAO,IAAI,IAAI,MAAM,CAAC,SAAS;IACjC;AACA,IAAA,OAAO,IAAI,EAAE,OAAO,IAAI,MAAM,CAAC,SAAS;AAC1C;;AC/EM,SAAU,kBAAkB,CAChC,MAAqB,EACrB,SAA8C,EAC9C,oBAAmD,EAAE,EAAA;IAErD,MAAM,eAAe,GAAG,oBAAoB,CAC1C,MAAM,EACN,SAAS,EACT,iBAAiB,CAClB;IACD,IAAI,eAAe,EAAE;AACnB,QAAA,OAAO,eAAe;IACxB;AAEA,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE;AAC5C,IAAA,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;AACvB,QAAA,OAAO,SAAS;IAClB;IAEA,MAAM,OAAO,GAA4B,EAAE;AAE3C,IAAA,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S,CAAC,OAAO,IAAI,QAAQ;AAClE;;ACnPA;;AAEG;;;;"}
|
|
@@ -785,7 +785,7 @@ class TableCaption {
|
|
|
785
785
|
this.onTabChange.emit(tab);
|
|
786
786
|
}
|
|
787
787
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableCaption, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
788
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableCaption, isStandalone: true, selector: "mt-table-caption", inputs: { generalSearch: { classPropertyName: "generalSearch", publicName: "generalSearch", isSignal: true, isRequired: false, transformFunction: null }, showFilters: { classPropertyName: "showFilters", publicName: "showFilters", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, printable: { classPropertyName: "printable", publicName: "printable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, groupColumns: { classPropertyName: "groupColumns", publicName: "groupColumns", isSignal: true, isRequired: false, transformFunction: null }, tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionLabel: { classPropertyName: "tabsOptionLabel", publicName: "tabsOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionValue: { classPropertyName: "tabsOptionValue", publicName: "tabsOptionValue", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, captionStart: { classPropertyName: "captionStart", publicName: "captionStart", isSignal: true, isRequired: false, transformFunction: null }, captionEnd: { classPropertyName: "captionEnd", publicName: "captionEnd", isSignal: true, isRequired: false, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "activeTab", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, filterTerm: { classPropertyName: "filterTerm", publicName: "filterTerm", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeTab: "activeTabChange", filters: "filtersChange", filterTerm: "filterTermChange", groupBy: "groupByChange", exportRequested: "exportRequested", printRequested: "printRequested", onTabChange: "onTabChange", searchChange: "searchChange", filterApplied: "filterApplied", filterReset: "filterReset" }, ngImport: i0, template: "@if (showsAnything()) {\n <div class=\"mt-table-caption\">\n <div\n class=\"flex relative items-center gap-2 pb-4\"\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\n >\n <div class=\"flex items-center gap-2\">\n @if (captionStart(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\n }\n @if (tabs()) {\n <mt-tabs\n [(active)]=\"activeTab\"\n [options]=\"tabs()\"\n [optionLabel]=\"tabsOptionLabel()\"\n [optionValue]=\"tabsOptionValue()\"\n (onChange)=\"tabChanged($event)\"\n size=\"large\"\n ></mt-tabs>\n }\n @if (generalSearch()) {\n <mt-text-field\n [ngModel]=\"filterTerm()\"\n (ngModelChange)=\"onSearch($event)\"\n icon=\"general.search-lg\"\n [placeholder]=\"'components.table.search' | transloco\"\n ></mt-text-field>\n }\n </div>\n <div class=\"flex items-center gap-2\">\n @if (showFilters() && filterMode() === \"popover\") {\n <mt-table-filter\n [columns]=\"columns()\"\n [data]=\"data()\"\n [ngModel]=\"filters()\"\n (filterApplied)=\"onFilterApplied($event)\"\n (filterReset)=\"onFilterReset()\"\n />\n }\n @if (exportable() || printable() || groupable()) {\n <mt-table-actions-menu\n [exportable]=\"exportable()\"\n [printable]=\"printable()\"\n [groupable]=\"groupable()\"\n [groupColumns]=\"groupColumns()\"\n [activeGroup]=\"groupBy()\"\n (exportRequested)=\"exportRequested.emit()\"\n (printRequested)=\"printRequested.emit()\"\n (groupChange)=\"onGroupChange($event)\"\n />\n }\n @if (actions().length > 0) {\n <div class=\"flex items-center space-x-2\">\n @for (action of actions(); track action.label) {\n <mt-button\n [icon]=\"action.icon\"\n [severity]=\"action.color\"\n [variant]=\"action.variant\"\n [size]=\"$any(action).size\"\n (click)=\"action.action(null)\"\n [label]=\"action.label\"\n [tooltip]=\"action.tooltip\"\n ></mt-button>\n }\n </div>\n }\n @if (captionEnd(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\n }\n </div>\n </div>\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslocoModule }, { 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: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "icon", "iconPosition"] }, { kind: "component", type: TableFilter, selector: "mt-table-filter", inputs: ["columns", "data"], outputs: ["filterApplied", "filterReset"] }, { kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
788
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableCaption, isStandalone: true, selector: "mt-table-caption", inputs: { generalSearch: { classPropertyName: "generalSearch", publicName: "generalSearch", isSignal: true, isRequired: false, transformFunction: null }, showFilters: { classPropertyName: "showFilters", publicName: "showFilters", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, printable: { classPropertyName: "printable", publicName: "printable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, groupColumns: { classPropertyName: "groupColumns", publicName: "groupColumns", isSignal: true, isRequired: false, transformFunction: null }, tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionLabel: { classPropertyName: "tabsOptionLabel", publicName: "tabsOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionValue: { classPropertyName: "tabsOptionValue", publicName: "tabsOptionValue", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, captionStart: { classPropertyName: "captionStart", publicName: "captionStart", isSignal: true, isRequired: false, transformFunction: null }, captionEnd: { classPropertyName: "captionEnd", publicName: "captionEnd", isSignal: true, isRequired: false, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "activeTab", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, filterTerm: { classPropertyName: "filterTerm", publicName: "filterTerm", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeTab: "activeTabChange", filters: "filtersChange", filterTerm: "filterTermChange", groupBy: "groupByChange", exportRequested: "exportRequested", printRequested: "printRequested", onTabChange: "onTabChange", searchChange: "searchChange", filterApplied: "filterApplied", filterReset: "filterReset" }, ngImport: i0, template: "@if (showsAnything()) {\r\n <div class=\"mt-table-caption\">\r\n <div\r\n class=\"flex relative items-center gap-2 pb-4\"\r\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n @if (captionStart(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n @if (tabs()) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabs()\"\r\n [optionLabel]=\"tabsOptionLabel()\"\r\n [optionValue]=\"tabsOptionValue()\"\r\n (onChange)=\"tabChanged($event)\"\r\n size=\"large\"\r\n ></mt-tabs>\r\n }\r\n @if (generalSearch()) {\r\n <mt-text-field\r\n [ngModel]=\"filterTerm()\"\r\n (ngModelChange)=\"onSearch($event)\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"'components.table.search' | transloco\"\r\n ></mt-text-field>\r\n }\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (showFilters() && filterMode() === \"popover\") {\r\n <mt-table-filter\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [ngModel]=\"filters()\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n }\r\n @if (exportable() || printable() || groupable()) {\r\n <mt-table-actions-menu\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [groupColumns]=\"groupColumns()\"\r\n [activeGroup]=\"groupBy()\"\r\n (exportRequested)=\"exportRequested.emit()\"\r\n (printRequested)=\"printRequested.emit()\"\r\n (groupChange)=\"onGroupChange($event)\"\r\n />\r\n }\r\n @if (actions().length > 0) {\r\n <div class=\"flex items-center space-x-2\">\r\n @for (action of actions(); track action.label) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"$any(action).size || 'small'\"\r\n (click)=\"action.action(null)\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n ></mt-button>\r\n }\r\n </div>\r\n }\r\n @if (captionEnd(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslocoModule }, { 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: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "icon", "iconPosition"] }, { kind: "component", type: TableFilter, selector: "mt-table-filter", inputs: ["columns", "data"], outputs: ["filterApplied", "filterReset"] }, { kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
789
789
|
}
|
|
790
790
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableCaption, decorators: [{
|
|
791
791
|
type: Component,
|
|
@@ -798,7 +798,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
798
798
|
TextField,
|
|
799
799
|
TableFilter,
|
|
800
800
|
TableActionsMenu,
|
|
801
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showsAnything()) {\n <div class=\"mt-table-caption\">\n <div\n class=\"flex relative items-center gap-2 pb-4\"\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\n >\n <div class=\"flex items-center gap-2\">\n @if (captionStart(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\n }\n @if (tabs()) {\n <mt-tabs\n [(active)]=\"activeTab\"\n [options]=\"tabs()\"\n [optionLabel]=\"tabsOptionLabel()\"\n [optionValue]=\"tabsOptionValue()\"\n (onChange)=\"tabChanged($event)\"\n size=\"large\"\n ></mt-tabs>\n }\n @if (generalSearch()) {\n <mt-text-field\n [ngModel]=\"filterTerm()\"\n (ngModelChange)=\"onSearch($event)\"\n icon=\"general.search-lg\"\n [placeholder]=\"'components.table.search' | transloco\"\n ></mt-text-field>\n }\n </div>\n <div class=\"flex items-center gap-2\">\n @if (showFilters() && filterMode() === \"popover\") {\n <mt-table-filter\n [columns]=\"columns()\"\n [data]=\"data()\"\n [ngModel]=\"filters()\"\n (filterApplied)=\"onFilterApplied($event)\"\n (filterReset)=\"onFilterReset()\"\n />\n }\n @if (exportable() || printable() || groupable()) {\n <mt-table-actions-menu\n [exportable]=\"exportable()\"\n [printable]=\"printable()\"\n [groupable]=\"groupable()\"\n [groupColumns]=\"groupColumns()\"\n [activeGroup]=\"groupBy()\"\n (exportRequested)=\"exportRequested.emit()\"\n (printRequested)=\"printRequested.emit()\"\n (groupChange)=\"onGroupChange($event)\"\n />\n }\n @if (actions().length > 0) {\n <div class=\"flex items-center space-x-2\">\n @for (action of actions(); track action.label) {\n <mt-button\n [icon]=\"action.icon\"\n [severity]=\"action.color\"\n [variant]=\"action.variant\"\n [size]=\"$any(action).size\"\n (click)=\"action.action(null)\"\n [label]=\"action.label\"\n [tooltip]=\"action.tooltip\"\n ></mt-button>\n }\n </div>\n }\n @if (captionEnd(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\n }\n </div>\n </div>\n </div>\n}\n" }]
|
|
801
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showsAnything()) {\r\n <div class=\"mt-table-caption\">\r\n <div\r\n class=\"flex relative items-center gap-2 pb-4\"\r\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n @if (captionStart(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n @if (tabs()) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabs()\"\r\n [optionLabel]=\"tabsOptionLabel()\"\r\n [optionValue]=\"tabsOptionValue()\"\r\n (onChange)=\"tabChanged($event)\"\r\n size=\"large\"\r\n ></mt-tabs>\r\n }\r\n @if (generalSearch()) {\r\n <mt-text-field\r\n [ngModel]=\"filterTerm()\"\r\n (ngModelChange)=\"onSearch($event)\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"'components.table.search' | transloco\"\r\n ></mt-text-field>\r\n }\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (showFilters() && filterMode() === \"popover\") {\r\n <mt-table-filter\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [ngModel]=\"filters()\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n }\r\n @if (exportable() || printable() || groupable()) {\r\n <mt-table-actions-menu\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [groupColumns]=\"groupColumns()\"\r\n [activeGroup]=\"groupBy()\"\r\n (exportRequested)=\"exportRequested.emit()\"\r\n (printRequested)=\"printRequested.emit()\"\r\n (groupChange)=\"onGroupChange($event)\"\r\n />\r\n }\r\n @if (actions().length > 0) {\r\n <div class=\"flex items-center space-x-2\">\r\n @for (action of actions(); track action.label) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"$any(action).size || 'small'\"\r\n (click)=\"action.action(null)\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n ></mt-button>\r\n }\r\n </div>\r\n }\r\n @if (captionEnd(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n}\r\n" }]
|
|
802
802
|
}], propDecorators: { generalSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "generalSearch", required: false }] }], showFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFilters", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], printable: [{ type: i0.Input, args: [{ isSignal: true, alias: "printable", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], groupColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupColumns", required: false }] }], tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }], tabsOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionLabel", required: false }] }], tabsOptionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionValue", required: false }] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], captionStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionStart", required: false }] }], captionEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionEnd", required: false }] }], activeTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTab", required: false }] }, { type: i0.Output, args: ["activeTabChange"] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }, { type: i0.Output, args: ["filtersChange"] }], filterTerm: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterTerm", required: false }] }, { type: i0.Output, args: ["filterTermChange"] }], groupBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupBy", required: false }] }, { type: i0.Output, args: ["groupByChange"] }], exportRequested: [{ type: i0.Output, args: ["exportRequested"] }], printRequested: [{ type: i0.Output, args: ["printRequested"] }], onTabChange: [{ type: i0.Output, args: ["onTabChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], filterApplied: [{ type: i0.Output, args: ["filterApplied"] }], filterReset: [{ type: i0.Output, args: ["filterReset"] }] } });
|
|
803
803
|
|
|
804
804
|
/**
|