@masterteam/form-builder 0.0.10 → 0.0.11
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.
|
@@ -27,7 +27,7 @@ import { CrudStateBase, handleApiRequest, RadioCardsFieldConfig } from '@mastert
|
|
|
27
27
|
import { DynamicForm } from '@masterteam/forms/dynamic-form';
|
|
28
28
|
import { ToggleField } from '@masterteam/components/toggle-field';
|
|
29
29
|
import { ModalRef } from '@masterteam/components/dialog';
|
|
30
|
-
import { FormulaToolbar, FormulaEditor, serializeTokens } from '@masterteam/components/formula';
|
|
30
|
+
import { CONDITION_FUNCTION_CATEGORIES, CONDITION_OPERATORS, FormulaToolbar, FormulaEditor, VALIDATION_FUNCTION_CATEGORIES, VALIDATION_OPERATORS, serializeTokens } from '@masterteam/components/formula';
|
|
31
31
|
import { Tooltip } from '@masterteam/components/tooltip';
|
|
32
32
|
import { ClientForm } from '@masterteam/forms/client-form';
|
|
33
33
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -1060,262 +1060,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
1060
1060
|
args: [{ providedIn: 'root' }]
|
|
1061
1061
|
}] });
|
|
1062
1062
|
|
|
1063
|
-
/**
|
|
1064
|
-
* Condition Formula Constants
|
|
1065
|
-
* Static functions and operators for condition formulas (Show/Hide/Enable/Disable)
|
|
1066
|
-
*/
|
|
1067
|
-
/**
|
|
1068
|
-
* Functions for field conditions
|
|
1069
|
-
*/
|
|
1070
|
-
const CONDITION_FUNCTION_CATEGORIES = [
|
|
1071
|
-
{
|
|
1072
|
-
name: 'Logic',
|
|
1073
|
-
displayName: 'Field Visibility',
|
|
1074
|
-
functions: [
|
|
1075
|
-
{
|
|
1076
|
-
name: 'SHOW_IF',
|
|
1077
|
-
category: 'Logic',
|
|
1078
|
-
description: 'Show this field when condition is true',
|
|
1079
|
-
signature: 'SHOW_IF(condition)',
|
|
1080
|
-
parameters: [
|
|
1081
|
-
{
|
|
1082
|
-
name: 'condition',
|
|
1083
|
-
type: 'boolean',
|
|
1084
|
-
description: 'When true, field is visible',
|
|
1085
|
-
required: true,
|
|
1086
|
-
},
|
|
1087
|
-
],
|
|
1088
|
-
returnType: 'boolean',
|
|
1089
|
-
examples: [
|
|
1090
|
-
'SHOW_IF(@Status == "Active")',
|
|
1091
|
-
'SHOW_IF(@Type == "Custom")',
|
|
1092
|
-
],
|
|
1093
|
-
},
|
|
1094
|
-
{
|
|
1095
|
-
name: 'HIDE_IF',
|
|
1096
|
-
category: 'Logic',
|
|
1097
|
-
description: 'Hide this field when condition is true',
|
|
1098
|
-
signature: 'HIDE_IF(condition)',
|
|
1099
|
-
parameters: [
|
|
1100
|
-
{
|
|
1101
|
-
name: 'condition',
|
|
1102
|
-
type: 'boolean',
|
|
1103
|
-
description: 'When true, field is hidden',
|
|
1104
|
-
required: true,
|
|
1105
|
-
},
|
|
1106
|
-
],
|
|
1107
|
-
returnType: 'boolean',
|
|
1108
|
-
examples: ['HIDE_IF(@Status == "Closed")', 'HIDE_IF(ISNULL(@Parent))'],
|
|
1109
|
-
},
|
|
1110
|
-
{
|
|
1111
|
-
name: 'DISABLE_IF',
|
|
1112
|
-
category: 'Logic',
|
|
1113
|
-
description: 'Disable this field when condition is true',
|
|
1114
|
-
signature: 'DISABLE_IF(condition)',
|
|
1115
|
-
parameters: [
|
|
1116
|
-
{
|
|
1117
|
-
name: 'condition',
|
|
1118
|
-
type: 'boolean',
|
|
1119
|
-
description: 'When true, field is disabled',
|
|
1120
|
-
required: true,
|
|
1121
|
-
},
|
|
1122
|
-
],
|
|
1123
|
-
returnType: 'boolean',
|
|
1124
|
-
examples: [
|
|
1125
|
-
'DISABLE_IF(@IsLocked == true)',
|
|
1126
|
-
'DISABLE_IF(@Status == "Approved")',
|
|
1127
|
-
],
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
name: 'ENABLE_IF',
|
|
1131
|
-
category: 'Logic',
|
|
1132
|
-
description: 'Enable this field when condition is true',
|
|
1133
|
-
signature: 'ENABLE_IF(condition)',
|
|
1134
|
-
parameters: [
|
|
1135
|
-
{
|
|
1136
|
-
name: 'condition',
|
|
1137
|
-
type: 'boolean',
|
|
1138
|
-
description: 'When true, field is enabled',
|
|
1139
|
-
required: true,
|
|
1140
|
-
},
|
|
1141
|
-
],
|
|
1142
|
-
returnType: 'boolean',
|
|
1143
|
-
examples: [
|
|
1144
|
-
'ENABLE_IF(@Status == "Draft")',
|
|
1145
|
-
'ENABLE_IF(@CanEdit == true)',
|
|
1146
|
-
],
|
|
1147
|
-
},
|
|
1148
|
-
],
|
|
1149
|
-
},
|
|
1150
|
-
{
|
|
1151
|
-
name: 'Aggregation',
|
|
1152
|
-
displayName: 'Logic Helpers',
|
|
1153
|
-
functions: [
|
|
1154
|
-
{
|
|
1155
|
-
name: 'AND',
|
|
1156
|
-
category: 'Aggregation',
|
|
1157
|
-
description: 'Returns true if all conditions are true',
|
|
1158
|
-
signature: 'AND(condition1, condition2)',
|
|
1159
|
-
parameters: [
|
|
1160
|
-
{
|
|
1161
|
-
name: 'condition1',
|
|
1162
|
-
type: 'boolean',
|
|
1163
|
-
description: 'First condition',
|
|
1164
|
-
required: true,
|
|
1165
|
-
},
|
|
1166
|
-
{
|
|
1167
|
-
name: 'condition2',
|
|
1168
|
-
type: 'boolean',
|
|
1169
|
-
description: 'Second condition',
|
|
1170
|
-
required: true,
|
|
1171
|
-
},
|
|
1172
|
-
],
|
|
1173
|
-
returnType: 'boolean',
|
|
1174
|
-
examples: ['AND(@Status == "Active", @Priority > 0)'],
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
name: 'OR',
|
|
1178
|
-
category: 'Aggregation',
|
|
1179
|
-
description: 'Returns true if any condition is true',
|
|
1180
|
-
signature: 'OR(condition1, condition2)',
|
|
1181
|
-
parameters: [
|
|
1182
|
-
{
|
|
1183
|
-
name: 'condition1',
|
|
1184
|
-
type: 'boolean',
|
|
1185
|
-
description: 'First condition',
|
|
1186
|
-
required: true,
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
name: 'condition2',
|
|
1190
|
-
type: 'boolean',
|
|
1191
|
-
description: 'Second condition',
|
|
1192
|
-
required: true,
|
|
1193
|
-
},
|
|
1194
|
-
],
|
|
1195
|
-
returnType: 'boolean',
|
|
1196
|
-
examples: ['OR(@Status == "Active", @Status == "Pending")'],
|
|
1197
|
-
},
|
|
1198
|
-
{
|
|
1199
|
-
name: 'NOT',
|
|
1200
|
-
category: 'Aggregation',
|
|
1201
|
-
description: 'Returns the opposite of the condition',
|
|
1202
|
-
signature: 'NOT(condition)',
|
|
1203
|
-
parameters: [
|
|
1204
|
-
{
|
|
1205
|
-
name: 'condition',
|
|
1206
|
-
type: 'boolean',
|
|
1207
|
-
description: 'The condition to negate',
|
|
1208
|
-
required: true,
|
|
1209
|
-
},
|
|
1210
|
-
],
|
|
1211
|
-
returnType: 'boolean',
|
|
1212
|
-
examples: ['NOT(@IsCompleted)'],
|
|
1213
|
-
},
|
|
1214
|
-
{
|
|
1215
|
-
name: 'ISNULL',
|
|
1216
|
-
category: 'Aggregation',
|
|
1217
|
-
description: 'Returns true if value is null or empty',
|
|
1218
|
-
signature: 'ISNULL(value)',
|
|
1219
|
-
parameters: [
|
|
1220
|
-
{
|
|
1221
|
-
name: 'value',
|
|
1222
|
-
type: 'any',
|
|
1223
|
-
description: 'The value to check',
|
|
1224
|
-
required: true,
|
|
1225
|
-
},
|
|
1226
|
-
],
|
|
1227
|
-
returnType: 'boolean',
|
|
1228
|
-
examples: ['ISNULL(@Description)'],
|
|
1229
|
-
},
|
|
1230
|
-
{
|
|
1231
|
-
name: 'CONTAINS',
|
|
1232
|
-
category: 'Aggregation',
|
|
1233
|
-
description: 'Returns true if text contains the search string',
|
|
1234
|
-
signature: 'CONTAINS(text, search)',
|
|
1235
|
-
parameters: [
|
|
1236
|
-
{
|
|
1237
|
-
name: 'text',
|
|
1238
|
-
type: 'string',
|
|
1239
|
-
description: 'The text to search in',
|
|
1240
|
-
required: true,
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
name: 'search',
|
|
1244
|
-
type: 'string',
|
|
1245
|
-
description: 'The string to search for',
|
|
1246
|
-
required: true,
|
|
1247
|
-
},
|
|
1248
|
-
],
|
|
1249
|
-
returnType: 'boolean',
|
|
1250
|
-
examples: ['CONTAINS(@Name, "Project")'],
|
|
1251
|
-
},
|
|
1252
|
-
],
|
|
1253
|
-
},
|
|
1254
|
-
];
|
|
1255
|
-
/**
|
|
1256
|
-
* Operators for conditions
|
|
1257
|
-
*/
|
|
1258
|
-
const CONDITION_OPERATORS = [
|
|
1259
|
-
// Comparison
|
|
1260
|
-
{
|
|
1261
|
-
symbol: '==',
|
|
1262
|
-
name: 'Equal',
|
|
1263
|
-
type: 'comparison',
|
|
1264
|
-
description: 'Equal to',
|
|
1265
|
-
precedence: 3,
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
symbol: '!=',
|
|
1269
|
-
name: 'Not Equal',
|
|
1270
|
-
type: 'comparison',
|
|
1271
|
-
description: 'Not equal to',
|
|
1272
|
-
precedence: 3,
|
|
1273
|
-
},
|
|
1274
|
-
{
|
|
1275
|
-
symbol: '>',
|
|
1276
|
-
name: 'Greater Than',
|
|
1277
|
-
type: 'comparison',
|
|
1278
|
-
description: 'Greater than',
|
|
1279
|
-
precedence: 4,
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
symbol: '<',
|
|
1283
|
-
name: 'Less Than',
|
|
1284
|
-
type: 'comparison',
|
|
1285
|
-
description: 'Less than',
|
|
1286
|
-
precedence: 4,
|
|
1287
|
-
},
|
|
1288
|
-
{
|
|
1289
|
-
symbol: '>=',
|
|
1290
|
-
name: 'Greater or Equal',
|
|
1291
|
-
type: 'comparison',
|
|
1292
|
-
description: 'Greater than or equal',
|
|
1293
|
-
precedence: 4,
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
symbol: '<=',
|
|
1297
|
-
name: 'Less or Equal',
|
|
1298
|
-
type: 'comparison',
|
|
1299
|
-
description: 'Less than or equal',
|
|
1300
|
-
precedence: 4,
|
|
1301
|
-
},
|
|
1302
|
-
// Logical
|
|
1303
|
-
{
|
|
1304
|
-
symbol: '&&',
|
|
1305
|
-
name: 'And',
|
|
1306
|
-
type: 'logical',
|
|
1307
|
-
description: 'Logical AND',
|
|
1308
|
-
precedence: 2,
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
symbol: '||',
|
|
1312
|
-
name: 'Or',
|
|
1313
|
-
type: 'logical',
|
|
1314
|
-
description: 'Logical OR',
|
|
1315
|
-
precedence: 1,
|
|
1316
|
-
},
|
|
1317
|
-
];
|
|
1318
|
-
|
|
1319
1063
|
/**
|
|
1320
1064
|
* Field Conditions Dialog
|
|
1321
1065
|
*
|
|
@@ -1623,7 +1367,7 @@ class FBFieldForm {
|
|
|
1623
1367
|
});
|
|
1624
1368
|
}
|
|
1625
1369
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: FBFieldForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1626
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: FBFieldForm, isStandalone: true, selector: "mt-fb-field-form", inputs: { sectionId: { classPropertyName: "sectionId", publicName: "sectionId", isSignal: true, isRequired: false, transformFunction: null }, initialData: { classPropertyName: "initialData", publicName: "initialData", isSignal: true, isRequired: false, transformFunction: null }, allSections: { classPropertyName: "allSections", publicName: "allSections", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'formBuilder'\">\r\n <div [class]=\"[modalService.contentClass, 'p-4', 'overflow-y-hidden!']\">\r\n <div class=\"mt-2 h-full overflow-y-auto pb-10 flex flex-col gap-4\">\r\n <mt-dynamic-form\r\n [formConfig]=\"activeFormConfig()\"\r\n [formControl]=\"formControl\"\r\n >\r\n </mt-dynamic-form>\r\n\r\n @if (isManageProperties()) {\r\n <!-- isRead Toggle -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('is-read')\"\r\n [descriptionCard]=\"t('is-read-description')\"\r\n icon=\"general.eye\"\r\n [formControl]=\"isReadControl\"\r\n ></mt-toggle-field>\r\n\r\n <!-- isWrite Toggle -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('is-write')\"\r\n [descriptionCard]=\"t('is-write-description')\"\r\n icon=\"general.edit-02\"\r\n [formControl]=\"isWriteControl\"\r\n ></mt-toggle-field>\r\n } @else {\r\n <!-- Show/Hide Toggle with Set Conditions -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('show-hide')\"\r\n [descriptionCard]=\"t('show-hide-description')\"\r\n icon=\"general.eye\"\r\n [formControl]=\"showHideControl\"\r\n class=\"mt-3\"\r\n >\r\n <ng-template #toggleCardBottom>\r\n @if (showHideControl.value) {\r\n <div class=\"mt-3\">\r\n <mt-button\r\n [label]=\"t('set-conditions')\"\r\n size=\"small\"\r\n (onClick)=\"onSetConditions()\"\r\n ></mt-button>\r\n </div>\r\n }\r\n </ng-template>\r\n </mt-toggle-field>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div [class]=\"modalService.footerClass\">\r\n @if (initialData() && !isManageProperties()) {\r\n <mt-button\r\n [tooltip]=\"t('delete')\"\r\n severity=\"danger\"\r\n [variant]=\"'outlined'\"\r\n icon=\"general.trash-01\"\r\n [loading]=\"deleting()\"\r\n [disabled]=\"submitting()\"\r\n (onClick)=\"onDelete($event)\"\r\n class=\"me-auto\"\r\n ></mt-button>\r\n }\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n severity=\"secondary\"\r\n [disabled]=\"submitting() || deleting()\"\r\n (onClick)=\"onCancel()\"\r\n >\r\n </mt-button>\r\n <mt-button\r\n [disabled]=\"!formControl.valid || deleting()\"\r\n [label]=\"t('save')\"\r\n severity=\"primary\"\r\n [loading]=\"submitting()\"\r\n (onClick)=\"onSave()\"\r\n >\r\n </mt-button>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { 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: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }] });
|
|
1370
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: FBFieldForm, isStandalone: true, selector: "mt-fb-field-form", inputs: { sectionId: { classPropertyName: "sectionId", publicName: "sectionId", isSignal: true, isRequired: false, transformFunction: null }, initialData: { classPropertyName: "initialData", publicName: "initialData", isSignal: true, isRequired: false, transformFunction: null }, allSections: { classPropertyName: "allSections", publicName: "allSections", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'formBuilder'\">\r\n <div [class]=\"[modalService.contentClass, 'p-4', 'overflow-y-hidden!']\">\r\n <div class=\"mt-2 h-full overflow-y-auto pb-10 flex flex-col gap-4\">\r\n <mt-dynamic-form\r\n [formConfig]=\"activeFormConfig()\"\r\n [formControl]=\"formControl\"\r\n >\r\n </mt-dynamic-form>\r\n\r\n @if (isManageProperties()) {\r\n <!-- isRead Toggle -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('is-read')\"\r\n [descriptionCard]=\"t('is-read-description')\"\r\n icon=\"general.eye\"\r\n [formControl]=\"isReadControl\"\r\n ></mt-toggle-field>\r\n\r\n <!-- isWrite Toggle -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('is-write')\"\r\n [descriptionCard]=\"t('is-write-description')\"\r\n icon=\"general.edit-02\"\r\n [formControl]=\"isWriteControl\"\r\n ></mt-toggle-field>\r\n } @else {\r\n <!-- Show/Hide Toggle with Set Conditions -->\r\n <mt-toggle-field\r\n toggleShape=\"card\"\r\n [label]=\"t('show-hide')\"\r\n [descriptionCard]=\"t('show-hide-description')\"\r\n icon=\"general.eye\"\r\n [formControl]=\"showHideControl\"\r\n class=\"mt-3\"\r\n >\r\n <ng-template #toggleCardBottom>\r\n @if (showHideControl.value) {\r\n <div class=\"mt-3\">\r\n <mt-button\r\n [label]=\"t('set-conditions')\"\r\n size=\"small\"\r\n (onClick)=\"onSetConditions()\"\r\n ></mt-button>\r\n </div>\r\n }\r\n </ng-template>\r\n </mt-toggle-field>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div [class]=\"modalService.footerClass\">\r\n @if (initialData() && !isManageProperties()) {\r\n <mt-button\r\n [tooltip]=\"t('delete')\"\r\n severity=\"danger\"\r\n [variant]=\"'outlined'\"\r\n icon=\"general.trash-01\"\r\n [loading]=\"deleting()\"\r\n [disabled]=\"submitting()\"\r\n (onClick)=\"onDelete($event)\"\r\n class=\"me-auto\"\r\n ></mt-button>\r\n }\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n severity=\"secondary\"\r\n [disabled]=\"submitting() || deleting()\"\r\n (onClick)=\"onCancel()\"\r\n >\r\n </mt-button>\r\n <mt-button\r\n [disabled]=\"!formControl.valid || deleting()\"\r\n [label]=\"t('save')\"\r\n severity=\"primary\"\r\n [loading]=\"submitting()\"\r\n (onClick)=\"onSave()\"\r\n >\r\n </mt-button>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"], 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"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }] });
|
|
1627
1371
|
}
|
|
1628
1372
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: FBFieldForm, decorators: [{
|
|
1629
1373
|
type: Component,
|
|
@@ -1739,7 +1483,7 @@ class FBSectionForm {
|
|
|
1739
1483
|
});
|
|
1740
1484
|
}
|
|
1741
1485
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: FBSectionForm, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1742
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: FBSectionForm, isStandalone: true, selector: "mt-fb-section-form", inputs: { sectionId: { classPropertyName: "sectionId", publicName: "sectionId", isSignal: true, isRequired: false, transformFunction: null }, initialData: { classPropertyName: "initialData", publicName: "initialData", isSignal: true, isRequired: false, transformFunction: null }, sectionsCount: { classPropertyName: "sectionsCount", publicName: "sectionsCount", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'formBuilder'\">\r\n <div [class]=\"[modalService.contentClass, 'p-4', 'overflow-y-hidden!']\">\r\n <div class=\"mt-4 h-full overflow-y-auto pb-10\">\r\n <mt-dynamic-form [formConfig]=\"formConfig\" [formControl]=\"formControl\">\r\n </mt-dynamic-form>\r\n </div>\r\n </div>\r\n\r\n <div [class]=\"modalService.footerClass\">\r\n @if (sectionId()) {\r\n <mt-button\r\n [tooltip]=\"t('delete')\"\r\n severity=\"danger\"\r\n outlined\r\n icon=\"general.trash-01\"\r\n [loading]=\"deleting()\"\r\n [disabled]=\"submitting()\"\r\n (onClick)=\"onDelete($event)\"\r\n class=\"me-auto\"\r\n ></mt-button>\r\n }\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n severity=\"secondary\"\r\n [disabled]=\"submitting() || deleting()\"\r\n (onClick)=\"onCancel()\"\r\n >\r\n </mt-button>\r\n <mt-button\r\n [disabled]=\"!formControl.valid || deleting()\"\r\n [label]=\"t('save')\"\r\n severity=\"primary\"\r\n [loading]=\"submitting()\"\r\n (onClick)=\"onSave()\"\r\n >\r\n </mt-button>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"] }, { 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"] }] });
|
|
1486
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: FBSectionForm, isStandalone: true, selector: "mt-fb-section-form", inputs: { sectionId: { classPropertyName: "sectionId", publicName: "sectionId", isSignal: true, isRequired: false, transformFunction: null }, initialData: { classPropertyName: "initialData", publicName: "initialData", isSignal: true, isRequired: false, transformFunction: null }, sectionsCount: { classPropertyName: "sectionsCount", publicName: "sectionsCount", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'formBuilder'\">\r\n <div [class]=\"[modalService.contentClass, 'p-4', 'overflow-y-hidden!']\">\r\n <div class=\"mt-4 h-full overflow-y-auto pb-10\">\r\n <mt-dynamic-form [formConfig]=\"formConfig\" [formControl]=\"formControl\">\r\n </mt-dynamic-form>\r\n </div>\r\n </div>\r\n\r\n <div [class]=\"modalService.footerClass\">\r\n @if (sectionId()) {\r\n <mt-button\r\n [tooltip]=\"t('delete')\"\r\n severity=\"danger\"\r\n outlined\r\n icon=\"general.trash-01\"\r\n [loading]=\"deleting()\"\r\n [disabled]=\"submitting()\"\r\n (onClick)=\"onDelete($event)\"\r\n class=\"me-auto\"\r\n ></mt-button>\r\n }\r\n <mt-button\r\n [label]=\"t('cancel')\"\r\n severity=\"secondary\"\r\n [disabled]=\"submitting() || deleting()\"\r\n (onClick)=\"onCancel()\"\r\n >\r\n </mt-button>\r\n <mt-button\r\n [disabled]=\"!formControl.valid || deleting()\"\r\n [label]=\"t('save')\"\r\n severity=\"primary\"\r\n [loading]=\"submitting()\"\r\n (onClick)=\"onSave()\"\r\n >\r\n </mt-button>\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { 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: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig"], 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"] }] });
|
|
1743
1487
|
}
|
|
1744
1488
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: FBSectionForm, decorators: [{
|
|
1745
1489
|
type: Component,
|
|
@@ -1949,316 +1693,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
|
|
|
1949
1693
|
args: [{ selector: 'mt-fb-preview-form', standalone: true, imports: [TranslocoDirective, ClientForm], template: "<ng-container *transloco=\"let t; prefix: 'formBuilder'\">\r\n <div [class]=\"[modalService.contentClass, 'p-4', 'overflow-y-hidden!']\">\r\n <div class=\"h-full overflow-y-auto px-3 pb-10\">\r\n @if (moduleKey() && operationKey()) {\r\n <mt-client-form\r\n [moduleKey]=\"moduleKey()\"\r\n [operationKey]=\"operationKey()\"\r\n [moduleId]=\"previewInfo()?.moduleId\"\r\n [levelId]=\"previewInfo()?.levelId\"\r\n [levelDataId]=\"previewInfo()?.levelDataId\"\r\n [moduleDataId]=\"previewInfo()?.moduleDataId\"\r\n [requestSchemaId]=\"previewInfo()?.requestSchemaId\"\r\n [autoLoad]=\"true\"\r\n [preview]=\"true\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex justify-center items-center h-64 text-muted-color text-lg\"\r\n >\r\n {{ t(\"no-fields-visible\") }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n</ng-container>\r\n" }]
|
|
1950
1694
|
}] });
|
|
1951
1695
|
|
|
1952
|
-
/**
|
|
1953
|
-
* Validation Formula Constants
|
|
1954
|
-
* Functions and operators for validation formulas
|
|
1955
|
-
*/
|
|
1956
|
-
const VALIDATION_FUNCTION_CATEGORIES = [
|
|
1957
|
-
{
|
|
1958
|
-
name: 'Validation',
|
|
1959
|
-
displayName: 'Validation',
|
|
1960
|
-
functions: [
|
|
1961
|
-
{
|
|
1962
|
-
name: 'REQUIRED',
|
|
1963
|
-
category: 'Validation',
|
|
1964
|
-
description: 'Returns true when value is not empty',
|
|
1965
|
-
signature: 'REQUIRED(value)',
|
|
1966
|
-
parameters: [
|
|
1967
|
-
{
|
|
1968
|
-
name: 'value',
|
|
1969
|
-
type: 'any',
|
|
1970
|
-
description: 'Value to check',
|
|
1971
|
-
required: true,
|
|
1972
|
-
},
|
|
1973
|
-
],
|
|
1974
|
-
returnType: 'boolean',
|
|
1975
|
-
examples: ['REQUIRED(@Email)'],
|
|
1976
|
-
},
|
|
1977
|
-
{
|
|
1978
|
-
name: 'ISNULL',
|
|
1979
|
-
category: 'Validation',
|
|
1980
|
-
description: 'Returns true if value is null or empty',
|
|
1981
|
-
signature: 'ISNULL(value)',
|
|
1982
|
-
parameters: [
|
|
1983
|
-
{
|
|
1984
|
-
name: 'value',
|
|
1985
|
-
type: 'any',
|
|
1986
|
-
description: 'Value to check',
|
|
1987
|
-
required: true,
|
|
1988
|
-
},
|
|
1989
|
-
],
|
|
1990
|
-
returnType: 'boolean',
|
|
1991
|
-
examples: ['ISNULL(@Phone)'],
|
|
1992
|
-
},
|
|
1993
|
-
{
|
|
1994
|
-
name: 'MIN_LENGTH',
|
|
1995
|
-
category: 'Validation',
|
|
1996
|
-
description: 'Returns true if value length is at least min',
|
|
1997
|
-
signature: 'MIN_LENGTH(value, min)',
|
|
1998
|
-
parameters: [
|
|
1999
|
-
{
|
|
2000
|
-
name: 'value',
|
|
2001
|
-
type: 'string',
|
|
2002
|
-
description: 'Value to check',
|
|
2003
|
-
required: true,
|
|
2004
|
-
},
|
|
2005
|
-
{
|
|
2006
|
-
name: 'min',
|
|
2007
|
-
type: 'number',
|
|
2008
|
-
description: 'Minimum length',
|
|
2009
|
-
required: true,
|
|
2010
|
-
},
|
|
2011
|
-
],
|
|
2012
|
-
returnType: 'boolean',
|
|
2013
|
-
examples: ['MIN_LENGTH(@Password, 8)'],
|
|
2014
|
-
},
|
|
2015
|
-
{
|
|
2016
|
-
name: 'MAX_LENGTH',
|
|
2017
|
-
category: 'Validation',
|
|
2018
|
-
description: 'Returns true if value length is at most max',
|
|
2019
|
-
signature: 'MAX_LENGTH(value, max)',
|
|
2020
|
-
parameters: [
|
|
2021
|
-
{
|
|
2022
|
-
name: 'value',
|
|
2023
|
-
type: 'string',
|
|
2024
|
-
description: 'Value to check',
|
|
2025
|
-
required: true,
|
|
2026
|
-
},
|
|
2027
|
-
{
|
|
2028
|
-
name: 'max',
|
|
2029
|
-
type: 'number',
|
|
2030
|
-
description: 'Maximum length',
|
|
2031
|
-
required: true,
|
|
2032
|
-
},
|
|
2033
|
-
],
|
|
2034
|
-
returnType: 'boolean',
|
|
2035
|
-
examples: ['MAX_LENGTH(@Title, 120)'],
|
|
2036
|
-
},
|
|
2037
|
-
{
|
|
2038
|
-
name: 'REGEX',
|
|
2039
|
-
category: 'Validation',
|
|
2040
|
-
description: 'Returns true if value matches regex pattern',
|
|
2041
|
-
signature: 'REGEX(value, pattern)',
|
|
2042
|
-
parameters: [
|
|
2043
|
-
{
|
|
2044
|
-
name: 'value',
|
|
2045
|
-
type: 'string',
|
|
2046
|
-
description: 'Value to check',
|
|
2047
|
-
required: true,
|
|
2048
|
-
},
|
|
2049
|
-
{
|
|
2050
|
-
name: 'pattern',
|
|
2051
|
-
type: 'string',
|
|
2052
|
-
description: 'Regex pattern',
|
|
2053
|
-
required: true,
|
|
2054
|
-
},
|
|
2055
|
-
],
|
|
2056
|
-
returnType: 'boolean',
|
|
2057
|
-
examples: ['REGEX(@Email, "^[^@]+@[^@]+\\.[^@]+$")'],
|
|
2058
|
-
},
|
|
2059
|
-
{
|
|
2060
|
-
name: 'BEFORE',
|
|
2061
|
-
category: 'Validation',
|
|
2062
|
-
description: 'Returns true if date is before reference date',
|
|
2063
|
-
signature: 'BEFORE(date, reference)',
|
|
2064
|
-
parameters: [
|
|
2065
|
-
{
|
|
2066
|
-
name: 'date',
|
|
2067
|
-
type: 'date',
|
|
2068
|
-
description: 'Date to check',
|
|
2069
|
-
required: true,
|
|
2070
|
-
},
|
|
2071
|
-
{
|
|
2072
|
-
name: 'reference',
|
|
2073
|
-
type: 'date',
|
|
2074
|
-
description: 'Reference date',
|
|
2075
|
-
required: true,
|
|
2076
|
-
},
|
|
2077
|
-
],
|
|
2078
|
-
returnType: 'boolean',
|
|
2079
|
-
examples: ['BEFORE(@EndDate, @StartDate)'],
|
|
2080
|
-
},
|
|
2081
|
-
{
|
|
2082
|
-
name: 'AFTER',
|
|
2083
|
-
category: 'Validation',
|
|
2084
|
-
description: 'Returns true if date is after reference date',
|
|
2085
|
-
signature: 'AFTER(date, reference)',
|
|
2086
|
-
parameters: [
|
|
2087
|
-
{
|
|
2088
|
-
name: 'date',
|
|
2089
|
-
type: 'date',
|
|
2090
|
-
description: 'Date to check',
|
|
2091
|
-
required: true,
|
|
2092
|
-
},
|
|
2093
|
-
{
|
|
2094
|
-
name: 'reference',
|
|
2095
|
-
type: 'date',
|
|
2096
|
-
description: 'Reference date',
|
|
2097
|
-
required: true,
|
|
2098
|
-
},
|
|
2099
|
-
],
|
|
2100
|
-
returnType: 'boolean',
|
|
2101
|
-
examples: ['AFTER(@StartDate, @EndDate)'],
|
|
2102
|
-
},
|
|
2103
|
-
],
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
name: 'Logic',
|
|
2107
|
-
displayName: 'Logic Helpers',
|
|
2108
|
-
functions: [
|
|
2109
|
-
{
|
|
2110
|
-
name: 'AND',
|
|
2111
|
-
category: 'Logic',
|
|
2112
|
-
description: 'Returns true if all conditions are true',
|
|
2113
|
-
signature: 'AND(condition1, condition2)',
|
|
2114
|
-
parameters: [
|
|
2115
|
-
{
|
|
2116
|
-
name: 'condition1',
|
|
2117
|
-
type: 'boolean',
|
|
2118
|
-
description: 'First condition',
|
|
2119
|
-
required: true,
|
|
2120
|
-
},
|
|
2121
|
-
{
|
|
2122
|
-
name: 'condition2',
|
|
2123
|
-
type: 'boolean',
|
|
2124
|
-
description: 'Second condition',
|
|
2125
|
-
required: true,
|
|
2126
|
-
},
|
|
2127
|
-
],
|
|
2128
|
-
returnType: 'boolean',
|
|
2129
|
-
examples: ['AND(REQUIRED(@Email), REGEX(@Email, "^.+@.+$"))'],
|
|
2130
|
-
},
|
|
2131
|
-
{
|
|
2132
|
-
name: 'OR',
|
|
2133
|
-
category: 'Logic',
|
|
2134
|
-
description: 'Returns true if any condition is true',
|
|
2135
|
-
signature: 'OR(condition1, condition2)',
|
|
2136
|
-
parameters: [
|
|
2137
|
-
{
|
|
2138
|
-
name: 'condition1',
|
|
2139
|
-
type: 'boolean',
|
|
2140
|
-
description: 'First condition',
|
|
2141
|
-
required: true,
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
name: 'condition2',
|
|
2145
|
-
type: 'boolean',
|
|
2146
|
-
description: 'Second condition',
|
|
2147
|
-
required: true,
|
|
2148
|
-
},
|
|
2149
|
-
],
|
|
2150
|
-
returnType: 'boolean',
|
|
2151
|
-
examples: ['OR(ISNULL(@Phone), REGEX(@Phone, "^\\+?[0-9]+$"))'],
|
|
2152
|
-
},
|
|
2153
|
-
{
|
|
2154
|
-
name: 'NOT',
|
|
2155
|
-
category: 'Logic',
|
|
2156
|
-
description: 'Returns the opposite of a condition',
|
|
2157
|
-
signature: 'NOT(condition)',
|
|
2158
|
-
parameters: [
|
|
2159
|
-
{
|
|
2160
|
-
name: 'condition',
|
|
2161
|
-
type: 'boolean',
|
|
2162
|
-
description: 'Condition to negate',
|
|
2163
|
-
required: true,
|
|
2164
|
-
},
|
|
2165
|
-
],
|
|
2166
|
-
returnType: 'boolean',
|
|
2167
|
-
examples: ['NOT(ISNULL(@Password))'],
|
|
2168
|
-
},
|
|
2169
|
-
],
|
|
2170
|
-
},
|
|
2171
|
-
];
|
|
2172
|
-
const VALIDATION_OPERATORS = [
|
|
2173
|
-
// Arithmetic
|
|
2174
|
-
{
|
|
2175
|
-
symbol: '+',
|
|
2176
|
-
name: 'Add',
|
|
2177
|
-
type: 'arithmetic',
|
|
2178
|
-
description: 'Addition',
|
|
2179
|
-
precedence: 4,
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
symbol: '-',
|
|
2183
|
-
name: 'Subtract',
|
|
2184
|
-
type: 'arithmetic',
|
|
2185
|
-
description: 'Subtraction',
|
|
2186
|
-
precedence: 4,
|
|
2187
|
-
},
|
|
2188
|
-
{
|
|
2189
|
-
symbol: '*',
|
|
2190
|
-
name: 'Multiply',
|
|
2191
|
-
type: 'arithmetic',
|
|
2192
|
-
description: 'Multiplication',
|
|
2193
|
-
precedence: 5,
|
|
2194
|
-
},
|
|
2195
|
-
{
|
|
2196
|
-
symbol: '/',
|
|
2197
|
-
name: 'Divide',
|
|
2198
|
-
type: 'arithmetic',
|
|
2199
|
-
description: 'Division',
|
|
2200
|
-
precedence: 5,
|
|
2201
|
-
},
|
|
2202
|
-
// Comparison
|
|
2203
|
-
{
|
|
2204
|
-
symbol: '==',
|
|
2205
|
-
name: 'Equal',
|
|
2206
|
-
type: 'comparison',
|
|
2207
|
-
description: 'Equal to',
|
|
2208
|
-
precedence: 3,
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
symbol: '!=',
|
|
2212
|
-
name: 'Not Equal',
|
|
2213
|
-
type: 'comparison',
|
|
2214
|
-
description: 'Not equal to',
|
|
2215
|
-
precedence: 3,
|
|
2216
|
-
},
|
|
2217
|
-
{
|
|
2218
|
-
symbol: '>',
|
|
2219
|
-
name: 'Greater Than',
|
|
2220
|
-
type: 'comparison',
|
|
2221
|
-
description: 'Greater than',
|
|
2222
|
-
precedence: 3,
|
|
2223
|
-
},
|
|
2224
|
-
{
|
|
2225
|
-
symbol: '<',
|
|
2226
|
-
name: 'Less Than',
|
|
2227
|
-
type: 'comparison',
|
|
2228
|
-
description: 'Less than',
|
|
2229
|
-
precedence: 3,
|
|
2230
|
-
},
|
|
2231
|
-
{
|
|
2232
|
-
symbol: '>=',
|
|
2233
|
-
name: 'Greater or Equal',
|
|
2234
|
-
type: 'comparison',
|
|
2235
|
-
description: 'Greater than or equal',
|
|
2236
|
-
precedence: 3,
|
|
2237
|
-
},
|
|
2238
|
-
{
|
|
2239
|
-
symbol: '<=',
|
|
2240
|
-
name: 'Less or Equal',
|
|
2241
|
-
type: 'comparison',
|
|
2242
|
-
description: 'Less than or equal',
|
|
2243
|
-
precedence: 3,
|
|
2244
|
-
},
|
|
2245
|
-
// Logical
|
|
2246
|
-
{
|
|
2247
|
-
symbol: '&&',
|
|
2248
|
-
name: 'And',
|
|
2249
|
-
type: 'logical',
|
|
2250
|
-
description: 'Logical AND',
|
|
2251
|
-
precedence: 2,
|
|
2252
|
-
},
|
|
2253
|
-
{
|
|
2254
|
-
symbol: '||',
|
|
2255
|
-
name: 'Or',
|
|
2256
|
-
type: 'logical',
|
|
2257
|
-
description: 'Logical OR',
|
|
2258
|
-
precedence: 1,
|
|
2259
|
-
},
|
|
2260
|
-
];
|
|
2261
|
-
|
|
2262
1696
|
class FBValidationRuleForm {
|
|
2263
1697
|
modalService = inject(ModalService);
|
|
2264
1698
|
ref = inject(ModalRef);
|