@masterteam/forms 0.0.69 → 0.0.71
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/forms.css +1 -1
- package/fesm2022/masterteam-forms-client-form.mjs +25 -10
- package/fesm2022/masterteam-forms-client-form.mjs.map +1 -1
- package/fesm2022/masterteam-forms-runtime-action-dialog.mjs +176 -0
- package/fesm2022/masterteam-forms-runtime-action-dialog.mjs.map +1 -0
- package/package.json +6 -2
- package/types/masterteam-forms-client-form.d.ts +5 -1
- package/types/masterteam-forms-runtime-action-dialog.d.ts +28 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, DestroyRef, signal, input, computed, Component } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import { TranslocoService, TranslocoDirective } from '@jsverse/transloco';
|
|
8
|
+
import { ValidatorConfig } from '@masterteam/components';
|
|
9
|
+
import { Button } from '@masterteam/components/button';
|
|
10
|
+
import { ModalRef } from '@masterteam/components/dialog';
|
|
11
|
+
import { ModalService } from '@masterteam/components/modal';
|
|
12
|
+
import { resolveActionLabel, RUNTIME_ACTION_CONFIRM_DIALOG } from '@masterteam/components/runtime-action';
|
|
13
|
+
import { DynamicForm } from '@masterteam/forms/dynamic-form';
|
|
14
|
+
|
|
15
|
+
class RuntimeActionConfirmDialog {
|
|
16
|
+
ref = inject(ModalRef);
|
|
17
|
+
modal = inject(ModalService);
|
|
18
|
+
transloco = inject(TranslocoService);
|
|
19
|
+
destroyRef = inject(DestroyRef);
|
|
20
|
+
activeLang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "activeLang" }] : /* istanbul ignore next */ []));
|
|
21
|
+
action = input.required(...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
|
|
22
|
+
formControl = new FormControl({});
|
|
23
|
+
actionLabel = computed(() => resolveActionLabel(this.action()), ...(ngDevMode ? [{ debugName: "actionLabel" }] : /* istanbul ignore next */ []));
|
|
24
|
+
formConfig = computed(() => {
|
|
25
|
+
this.activeLang();
|
|
26
|
+
return {
|
|
27
|
+
sections: [
|
|
28
|
+
{
|
|
29
|
+
key: 'action-confirmation',
|
|
30
|
+
type: 'none',
|
|
31
|
+
fields: buildActionFields(this.action(), (key) => this.transloco.translate(key)),
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
}, ...(ngDevMode ? [{ debugName: "formConfig" }] : /* istanbul ignore next */ []));
|
|
36
|
+
hasFormFields = computed(() => this.formConfig().sections[0]?.fields.length > 0, ...(ngDevMode ? [{ debugName: "hasFormFields" }] : /* istanbul ignore next */ []));
|
|
37
|
+
constructor() {
|
|
38
|
+
this.transloco.langChanges$
|
|
39
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
40
|
+
.subscribe((lang) => this.activeLang.set(lang));
|
|
41
|
+
}
|
|
42
|
+
onCancel() {
|
|
43
|
+
this.ref.close(null);
|
|
44
|
+
}
|
|
45
|
+
onConfirm() {
|
|
46
|
+
if (this.formControl.invalid) {
|
|
47
|
+
this.formControl.markAllAsTouched();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.ref.close(this.formControl.getRawValue() ?? {});
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
53
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: RuntimeActionConfirmDialog, isStandalone: true, selector: "mt-runtime-action-confirm-dialog", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'runtimeAction'\">\n <div [class]=\"modal.contentClass + ' p-4'\">\n @if (hasFormFields()) {\n <mt-dynamic-form\n [formConfig]=\"formConfig()\"\n [formControl]=\"formControl\"\n />\n } @else {\n <p class=\"text-sm text-surface-500\">\n {{ t(\"modal.confirmAction\", { action: actionLabel() }) }}\n </p>\n }\n </div>\n\n <div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"t('modal.cancel')\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"onCancel()\"\n />\n <mt-button [label]=\"actionLabel()\" (onClick)=\"onConfirm()\" />\n </div>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { 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"] }] });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: RuntimeActionConfirmDialog, decorators: [{
|
|
56
|
+
type: Component,
|
|
57
|
+
args: [{ selector: 'mt-runtime-action-confirm-dialog', standalone: true, imports: [
|
|
58
|
+
CommonModule,
|
|
59
|
+
ReactiveFormsModule,
|
|
60
|
+
TranslocoDirective,
|
|
61
|
+
DynamicForm,
|
|
62
|
+
Button,
|
|
63
|
+
], template: "<ng-container *transloco=\"let t; prefix: 'runtimeAction'\">\n <div [class]=\"modal.contentClass + ' p-4'\">\n @if (hasFormFields()) {\n <mt-dynamic-form\n [formConfig]=\"formConfig()\"\n [formControl]=\"formControl\"\n />\n } @else {\n <p class=\"text-sm text-surface-500\">\n {{ t(\"modal.confirmAction\", { action: actionLabel() }) }}\n </p>\n }\n </div>\n\n <div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"t('modal.cancel')\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"onCancel()\"\n />\n <mt-button [label]=\"actionLabel()\" (onClick)=\"onConfirm()\" />\n </div>\n</ng-container>\n" }]
|
|
64
|
+
}], ctorParameters: () => [], propDecorators: { action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: true }] }] } });
|
|
65
|
+
function buildActionFields(action, t) {
|
|
66
|
+
const requestedKeys = new Set(action.payloadKeys ?? []);
|
|
67
|
+
const requiredKeys = new Set(action.requiredPayloadKeys ?? []);
|
|
68
|
+
const fields = [];
|
|
69
|
+
const progressField = resolveProgressField(action);
|
|
70
|
+
if (progressField) {
|
|
71
|
+
fields.push({
|
|
72
|
+
key: 'progress',
|
|
73
|
+
type: 'slider',
|
|
74
|
+
label: t('runtimeAction.field.progress'),
|
|
75
|
+
min: 0,
|
|
76
|
+
max: 100,
|
|
77
|
+
step: 1,
|
|
78
|
+
unit: '%',
|
|
79
|
+
validators: buildRequiredValidators(requiredKeys.has('fields')),
|
|
80
|
+
defaultValue: progressField.value,
|
|
81
|
+
colSpan: 12,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (requestedKeys.has('delegatedUser')) {
|
|
85
|
+
fields.push({
|
|
86
|
+
key: 'delegatedUser',
|
|
87
|
+
type: 'user-search',
|
|
88
|
+
label: t('runtimeAction.field.delegatedUser'),
|
|
89
|
+
placeholder: t('runtimeAction.field.delegatedUserPlaceholder'),
|
|
90
|
+
apiUrl: 'Identity/users',
|
|
91
|
+
optionLabel: 'displayName',
|
|
92
|
+
optionValue: 'id',
|
|
93
|
+
validators: buildRequiredValidators(requiredKeys.has('delegatedUser')),
|
|
94
|
+
colSpan: 12,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (requestedKeys.has('reason')) {
|
|
98
|
+
fields.push({
|
|
99
|
+
key: 'reason',
|
|
100
|
+
type: 'textarea',
|
|
101
|
+
label: t('runtimeAction.field.reason'),
|
|
102
|
+
placeholder: t('runtimeAction.field.reasonPlaceholder'),
|
|
103
|
+
rows: 4,
|
|
104
|
+
validators: buildRequiredValidators(requiredKeys.has('reason')),
|
|
105
|
+
colSpan: 12,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (requestedKeys.has('note')) {
|
|
109
|
+
fields.push({
|
|
110
|
+
key: 'note',
|
|
111
|
+
type: 'textarea',
|
|
112
|
+
label: t('runtimeAction.field.note'),
|
|
113
|
+
placeholder: t('runtimeAction.field.notePlaceholder'),
|
|
114
|
+
rows: 4,
|
|
115
|
+
validators: buildRequiredValidators(requiredKeys.has('note')),
|
|
116
|
+
colSpan: 12,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (requestedKeys.has('attachments')) {
|
|
120
|
+
fields.push({
|
|
121
|
+
key: 'attachments',
|
|
122
|
+
type: 'upload-file',
|
|
123
|
+
label: t('runtimeAction.field.attachments'),
|
|
124
|
+
endPoint: 'uploader',
|
|
125
|
+
multiple: true,
|
|
126
|
+
title: t('runtimeAction.field.uploadTitle'),
|
|
127
|
+
description: t('runtimeAction.field.uploadDescription'),
|
|
128
|
+
validators: buildRequiredValidators(requiredKeys.has('attachments')),
|
|
129
|
+
colSpan: 12,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return fields;
|
|
133
|
+
}
|
|
134
|
+
function buildRequiredValidators(required) {
|
|
135
|
+
return required ? [ValidatorConfig.required()] : [];
|
|
136
|
+
}
|
|
137
|
+
function resolveProgressField(action) {
|
|
138
|
+
const fields = action.payloadTemplate
|
|
139
|
+
?.fields;
|
|
140
|
+
if (!Array.isArray(fields)) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const progressField = fields.find((field) => !!field &&
|
|
144
|
+
typeof field === 'object' &&
|
|
145
|
+
field.propertyKey === 'Progress');
|
|
146
|
+
if (!progressField) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
value: normalizeProgressValue(progressField.value),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function normalizeProgressValue(value) {
|
|
154
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
if (typeof value !== 'string') {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
const normalized = Number(value.replace('%', '').trim());
|
|
161
|
+
return Number.isFinite(normalized) ? normalized : undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function provideRuntimeActionConfirmDialog() {
|
|
165
|
+
return {
|
|
166
|
+
provide: RUNTIME_ACTION_CONFIRM_DIALOG,
|
|
167
|
+
useValue: RuntimeActionConfirmDialog,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Generated bundle index. Do not edit.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
export { RuntimeActionConfirmDialog, provideRuntimeActionConfirmDialog };
|
|
176
|
+
//# sourceMappingURL=masterteam-forms-runtime-action-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-forms-runtime-action-dialog.mjs","sources":["../../../../packages/masterteam/forms/runtime-action-dialog/runtime-action-confirm-dialog.ts","../../../../packages/masterteam/forms/runtime-action-dialog/runtime-action-confirm-dialog.html","../../../../packages/masterteam/forms/runtime-action-dialog/provide-runtime-action-confirm-dialog.ts","../../../../packages/masterteam/forms/runtime-action-dialog/masterteam-forms-runtime-action-dialog.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { TranslocoDirective, TranslocoService } from '@jsverse/transloco';\nimport {\n DynamicFieldConfig,\n DynamicFormConfig,\n ValidatorConfig,\n} from '@masterteam/components';\nimport { Button } from '@masterteam/components/button';\nimport { ModalRef } from '@masterteam/components/dialog';\nimport { ModalService } from '@masterteam/components/modal';\nimport {\n RuntimeAction,\n resolveActionLabel,\n} from '@masterteam/components/runtime-action';\nimport { DynamicForm } from '@masterteam/forms/dynamic-form';\n\n@Component({\n selector: 'mt-runtime-action-confirm-dialog',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n TranslocoDirective,\n DynamicForm,\n Button,\n ],\n templateUrl: './runtime-action-confirm-dialog.html',\n})\nexport class RuntimeActionConfirmDialog {\n private readonly ref = inject(ModalRef);\n readonly modal = inject(ModalService);\n private readonly transloco = inject(TranslocoService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly activeLang = signal(this.transloco.getActiveLang());\n\n readonly action = input.required<RuntimeAction>();\n\n protected readonly formControl = new FormControl<Record<string, unknown>>({});\n protected readonly actionLabel = computed(() =>\n resolveActionLabel(this.action()),\n );\n protected readonly formConfig = computed<DynamicFormConfig>(() => {\n this.activeLang();\n return {\n sections: [\n {\n key: 'action-confirmation',\n type: 'none',\n fields: buildActionFields(this.action(), (key) =>\n this.transloco.translate<string>(key),\n ),\n },\n ],\n };\n });\n protected readonly hasFormFields = computed(\n () => this.formConfig().sections[0]?.fields.length > 0,\n );\n\n constructor() {\n this.transloco.langChanges$\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((lang) => this.activeLang.set(lang));\n }\n\n protected onCancel(): void {\n this.ref.close(null);\n }\n\n protected onConfirm(): void {\n if (this.formControl.invalid) {\n this.formControl.markAllAsTouched();\n return;\n }\n\n this.ref.close(this.formControl.getRawValue() ?? {});\n }\n}\n\nfunction buildActionFields(\n action: RuntimeAction,\n t: (key: string) => string,\n): DynamicFieldConfig[] {\n const requestedKeys = new Set(action.payloadKeys ?? []);\n const requiredKeys = new Set(action.requiredPayloadKeys ?? []);\n const fields: DynamicFieldConfig[] = [];\n const progressField = resolveProgressField(action);\n\n if (progressField) {\n fields.push({\n key: 'progress',\n type: 'slider',\n label: t('runtimeAction.field.progress'),\n min: 0,\n max: 100,\n step: 1,\n unit: '%',\n validators: buildRequiredValidators(requiredKeys.has('fields')),\n defaultValue: progressField.value,\n colSpan: 12,\n } as DynamicFieldConfig);\n }\n\n if (requestedKeys.has('delegatedUser')) {\n fields.push({\n key: 'delegatedUser',\n type: 'user-search',\n label: t('runtimeAction.field.delegatedUser'),\n placeholder: t('runtimeAction.field.delegatedUserPlaceholder'),\n apiUrl: 'Identity/users',\n optionLabel: 'displayName',\n optionValue: 'id',\n validators: buildRequiredValidators(requiredKeys.has('delegatedUser')),\n colSpan: 12,\n } as DynamicFieldConfig);\n }\n\n if (requestedKeys.has('reason')) {\n fields.push({\n key: 'reason',\n type: 'textarea',\n label: t('runtimeAction.field.reason'),\n placeholder: t('runtimeAction.field.reasonPlaceholder'),\n rows: 4,\n validators: buildRequiredValidators(requiredKeys.has('reason')),\n colSpan: 12,\n } as DynamicFieldConfig);\n }\n\n if (requestedKeys.has('note')) {\n fields.push({\n key: 'note',\n type: 'textarea',\n label: t('runtimeAction.field.note'),\n placeholder: t('runtimeAction.field.notePlaceholder'),\n rows: 4,\n validators: buildRequiredValidators(requiredKeys.has('note')),\n colSpan: 12,\n } as DynamicFieldConfig);\n }\n\n if (requestedKeys.has('attachments')) {\n fields.push({\n key: 'attachments',\n type: 'upload-file',\n label: t('runtimeAction.field.attachments'),\n endPoint: 'uploader',\n multiple: true,\n title: t('runtimeAction.field.uploadTitle'),\n description: t('runtimeAction.field.uploadDescription'),\n validators: buildRequiredValidators(requiredKeys.has('attachments')),\n colSpan: 12,\n } as DynamicFieldConfig);\n }\n\n return fields;\n}\n\nfunction buildRequiredValidators(required: boolean): ValidatorConfig[] {\n return required ? [ValidatorConfig.required()] : [];\n}\n\nfunction resolveProgressField(\n action: RuntimeAction,\n): { value?: number } | null {\n const fields = (action.payloadTemplate as { fields?: unknown } | null)\n ?.fields;\n if (!Array.isArray(fields)) {\n return null;\n }\n\n const progressField = fields.find(\n (field) =>\n !!field &&\n typeof field === 'object' &&\n (field as { propertyKey?: string }).propertyKey === 'Progress',\n ) as { value?: unknown } | undefined;\n\n if (!progressField) {\n return null;\n }\n\n return {\n value: normalizeProgressValue(progressField.value),\n };\n}\n\nfunction normalizeProgressValue(value: unknown): number | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value !== 'string') {\n return undefined;\n }\n\n const normalized = Number(value.replace('%', '').trim());\n return Number.isFinite(normalized) ? normalized : undefined;\n}\n","<ng-container *transloco=\"let t; prefix: 'runtimeAction'\">\n <div [class]=\"modal.contentClass + ' p-4'\">\n @if (hasFormFields()) {\n <mt-dynamic-form\n [formConfig]=\"formConfig()\"\n [formControl]=\"formControl\"\n />\n } @else {\n <p class=\"text-sm text-surface-500\">\n {{ t(\"modal.confirmAction\", { action: actionLabel() }) }}\n </p>\n }\n </div>\n\n <div [class]=\"modal.footerClass\">\n <mt-button\n [label]=\"t('modal.cancel')\"\n severity=\"secondary\"\n variant=\"outlined\"\n (onClick)=\"onCancel()\"\n />\n <mt-button [label]=\"actionLabel()\" (onClick)=\"onConfirm()\" />\n </div>\n</ng-container>\n","import { Provider } from '@angular/core';\nimport { RUNTIME_ACTION_CONFIRM_DIALOG } from '@masterteam/components/runtime-action';\n\nimport { RuntimeActionConfirmDialog } from './runtime-action-confirm-dialog';\n\nexport function provideRuntimeActionConfirmDialog(): Provider {\n return {\n provide: RUNTIME_ACTION_CONFIRM_DIALOG,\n useValue: RuntimeActionConfirmDialog,\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAsCa,0BAA0B,CAAA;AACpB,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC9B,IAAA,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC;AACpB,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACpC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC/B,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,YAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;AAE3D,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAAiB;AAE9B,IAAA,WAAW,GAAG,IAAI,WAAW,CAA0B,EAAE,CAAC;AAC1D,IAAA,WAAW,GAAG,QAAQ,CAAC,MACxC,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,kFAClC;AACkB,IAAA,UAAU,GAAG,QAAQ,CAAoB,MAAK;QAC/D,IAAI,CAAC,UAAU,EAAE;QACjB,OAAO;AACL,YAAA,QAAQ,EAAE;AACR,gBAAA;AACE,oBAAA,GAAG,EAAE,qBAAqB;AAC1B,oBAAA,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,KAC3C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAS,GAAG,CAAC,CACtC;AACF,iBAAA;AACF,aAAA;SACF;AACH,IAAA,CAAC,iFAAC;IACiB,aAAa,GAAG,QAAQ,CACzC,MAAM,IAAI,C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C,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,IAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,SAAS;AAC7D;;SE3MgB,iCAAiC,GAAA;IAC/C,OAAO;AACL,QAAA,OAAO,EAAE,6BAA6B;AACtC,QAAA,QAAQ,EAAE,0BAA0B;KACrC;AACH;;ACVA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterteam/forms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/forms",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"primeng": "21.1.5",
|
|
18
18
|
"@primeuix/themes": "^2.0.3",
|
|
19
19
|
"rxjs": "^7.8.2",
|
|
20
|
-
"@masterteam/components": "^0.0.
|
|
20
|
+
"@masterteam/components": "^0.0.157"
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"exports": {
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"./pipes": {
|
|
47
47
|
"types": "./types/masterteam-forms-pipes.d.ts",
|
|
48
48
|
"default": "./fesm2022/masterteam-forms-pipes.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./runtime-action-dialog": {
|
|
51
|
+
"types": "./types/masterteam-forms-runtime-action-dialog.d.ts",
|
|
52
|
+
"default": "./fesm2022/masterteam-forms-runtime-action-dialog.mjs"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"module": "fesm2022/masterteam-forms.mjs",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _masterteam_components from '@masterteam/components';
|
|
2
2
|
import { FormulaRuntimeMessage, DynamicFormConfig } from '@masterteam/components';
|
|
3
3
|
import * as _masterteam_components_entities from '@masterteam/components/entities';
|
|
4
|
-
import { EntityData } from '@masterteam/components/entities';
|
|
4
|
+
import { PropertyValueComparison, EntityData } from '@masterteam/components/entities';
|
|
5
|
+
export { ComparisonValueSide, EntityComparisonField, EntityComparisonOperation, EntityListComparison, EntityListComparisonRow, PropertyValueComparison, ValueComparison } from '@masterteam/components/entities';
|
|
5
6
|
import * as _angular_core from '@angular/core';
|
|
6
7
|
import { OnDestroy, ElementRef } from '@angular/core';
|
|
7
8
|
import { FormControl } from '@angular/forms';
|
|
@@ -74,6 +75,7 @@ interface ProcessFormSubmitRequest {
|
|
|
74
75
|
recordId?: number | string;
|
|
75
76
|
requestSchemaId?: number;
|
|
76
77
|
returnUrl?: string;
|
|
78
|
+
IsSteps?: boolean;
|
|
77
79
|
fields: ProcessFormSubmitField[];
|
|
78
80
|
}
|
|
79
81
|
interface ProcessFormValidationRuntimeResult {
|
|
@@ -137,6 +139,7 @@ interface ProcessFormValue {
|
|
|
137
139
|
rawValue?: any;
|
|
138
140
|
value: any;
|
|
139
141
|
metadata?: ProcessFormValueMetadata;
|
|
142
|
+
comparison?: PropertyValueComparison;
|
|
140
143
|
}
|
|
141
144
|
interface ProcessFormValueMetadata {
|
|
142
145
|
propertyId: number;
|
|
@@ -476,6 +479,7 @@ declare class ClientForm implements OnDestroy {
|
|
|
476
479
|
private validateAndAdvanceStep;
|
|
477
480
|
private applyStepChange;
|
|
478
481
|
private requiresForwardStepValidation;
|
|
482
|
+
private resolveValidateIsSteps;
|
|
479
483
|
private hasLocalBlockingValidationIssues;
|
|
480
484
|
private handleValidationRequestFailure;
|
|
481
485
|
private createValidationFeedbackMessage;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
import { FormControl } from '@angular/forms';
|
|
4
|
+
import { DynamicFormConfig } from '@masterteam/components';
|
|
5
|
+
import { ModalService } from '@masterteam/components/modal';
|
|
6
|
+
import { RuntimeAction } from '@masterteam/components/runtime-action';
|
|
7
|
+
|
|
8
|
+
declare class RuntimeActionConfirmDialog {
|
|
9
|
+
private readonly ref;
|
|
10
|
+
readonly modal: ModalService;
|
|
11
|
+
private readonly transloco;
|
|
12
|
+
private readonly destroyRef;
|
|
13
|
+
private readonly activeLang;
|
|
14
|
+
readonly action: _angular_core.InputSignal<RuntimeAction>;
|
|
15
|
+
protected readonly formControl: FormControl<Record<string, unknown> | null>;
|
|
16
|
+
protected readonly actionLabel: _angular_core.Signal<string>;
|
|
17
|
+
protected readonly formConfig: _angular_core.Signal<DynamicFormConfig>;
|
|
18
|
+
protected readonly hasFormFields: _angular_core.Signal<boolean>;
|
|
19
|
+
constructor();
|
|
20
|
+
protected onCancel(): void;
|
|
21
|
+
protected onConfirm(): void;
|
|
22
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RuntimeActionConfirmDialog, never>;
|
|
23
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RuntimeActionConfirmDialog, "mt-runtime-action-confirm-dialog", never, { "action": { "alias": "action"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare function provideRuntimeActionConfirmDialog(): Provider;
|
|
27
|
+
|
|
28
|
+
export { RuntimeActionConfirmDialog, provideRuntimeActionConfirmDialog };
|