mn-angular-lib 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/mn-angular-lib.mjs +3318 -76
- package/fesm2022/mn-angular-lib.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/features/mn-modal/components/mn-confirmation-body/mn-confirmation-body.component.css +1 -0
- package/src/lib/features/mn-modal/components/mn-form-body/mn-form-body.component.css +5 -0
- package/src/lib/features/mn-modal/components/mn-modal-shell/mn-modal-shell.component.css +36 -0
- package/src/lib/features/mn-modal/components/mn-wizard-body/mn-wizard-body.component.css +1 -0
- package/src/lib/features/mn-table/mn-table.component.css +1 -0
- package/types/mn-angular-lib.d.ts +2020 -81
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Provider, TemplateRef, OnInit } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider, TemplateRef, OnInit, Type, ComponentRef, AfterViewInit, OnDestroy, ElementRef, QueryList, ChangeDetectorRef, ViewContainerRef, EventEmitter, PipeTransform } from '@angular/core';
|
|
3
|
+
export { TemplateRef, Type } from '@angular/core';
|
|
3
4
|
import * as tailwind_variants from 'tailwind-variants';
|
|
4
5
|
import { VariantProps } from 'tailwind-variants';
|
|
5
6
|
import * as rxjs from 'rxjs';
|
|
6
|
-
import { Observable } from 'rxjs';
|
|
7
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
|
7
8
|
import * as mn_angular_lib from 'mn-angular-lib';
|
|
8
9
|
import * as _angular_forms from '@angular/forms';
|
|
9
|
-
import { ValidationErrors, NgControl, AbstractControl } from '@angular/forms';
|
|
10
|
-
import { HttpClient } from '@angular/common/http';
|
|
10
|
+
import { ValidationErrors, NgControl, AbstractControl, FormGroup, FormBuilder } from '@angular/forms';
|
|
11
|
+
import { HttpClient, HttpStatusCode, HttpHeaders, HttpErrorResponse, HttpResponse, HttpParams } from '@angular/common/http';
|
|
11
12
|
|
|
12
13
|
declare const mnAlertVariants: tailwind_variants.TVReturnType<{
|
|
13
14
|
kind: {
|
|
@@ -363,6 +364,10 @@ interface MnInputBaseProps {
|
|
|
363
364
|
name?: string;
|
|
364
365
|
/** Type of input field (text, email, date, etc.) */
|
|
365
366
|
type: MnInputType;
|
|
367
|
+
/** Label text (overrides uiConfig.label when provided) */
|
|
368
|
+
label?: string;
|
|
369
|
+
/** Placeholder text (overrides uiConfig.placeholder when provided) */
|
|
370
|
+
placeholder?: string;
|
|
366
371
|
/** Size variant of the input field (default: 'md') */
|
|
367
372
|
size?: MnInputVariants['size'];
|
|
368
373
|
/** Border radius variant (default: 'md') */
|
|
@@ -1232,91 +1237,2025 @@ declare class MnTextarea implements OnInit {
|
|
|
1232
1237
|
static ɵcmp: i0.ɵɵComponentDeclaration<MnTextarea, "mn-lib-textarea", never, { "props": { "alias": "props"; "required": true; }; }, {}, never, never, true, never>;
|
|
1233
1238
|
}
|
|
1234
1239
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1240
|
+
declare const mnCheckboxVariants: tailwind_variants.TVReturnType<{
|
|
1241
|
+
size: {
|
|
1242
|
+
sm: string;
|
|
1243
|
+
md: string;
|
|
1244
|
+
lg: string;
|
|
1245
|
+
};
|
|
1246
|
+
borderRadius: {
|
|
1247
|
+
none: string;
|
|
1248
|
+
xs: string;
|
|
1249
|
+
sm: string;
|
|
1250
|
+
md: string;
|
|
1251
|
+
lg: string;
|
|
1252
|
+
};
|
|
1253
|
+
}, undefined, "accent-brand-500 cursor-pointer", {
|
|
1254
|
+
size: {
|
|
1255
|
+
sm: string;
|
|
1256
|
+
md: string;
|
|
1257
|
+
lg: string;
|
|
1258
|
+
};
|
|
1259
|
+
borderRadius: {
|
|
1260
|
+
none: string;
|
|
1261
|
+
xs: string;
|
|
1262
|
+
sm: string;
|
|
1263
|
+
md: string;
|
|
1264
|
+
lg: string;
|
|
1265
|
+
};
|
|
1266
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
1267
|
+
size: {
|
|
1268
|
+
sm: string;
|
|
1269
|
+
md: string;
|
|
1270
|
+
lg: string;
|
|
1271
|
+
};
|
|
1272
|
+
borderRadius: {
|
|
1273
|
+
none: string;
|
|
1274
|
+
xs: string;
|
|
1275
|
+
sm: string;
|
|
1276
|
+
md: string;
|
|
1277
|
+
lg: string;
|
|
1278
|
+
};
|
|
1279
|
+
}, undefined, "accent-brand-500 cursor-pointer", unknown, unknown, undefined>>;
|
|
1280
|
+
type MnCheckboxVariants = VariantProps<typeof mnCheckboxVariants>;
|
|
1250
1281
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
/**
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1282
|
+
type MnCheckboxErrorMessageData = string | ((args: any, errors: ValidationErrors) => string);
|
|
1283
|
+
type MnCheckboxErrorMessagesData = Partial<Record<string, MnCheckboxErrorMessageData>>;
|
|
1284
|
+
interface MnCheckboxProps {
|
|
1285
|
+
/** Unique identifier for the checkbox element (required for accessibility) */
|
|
1286
|
+
id: string;
|
|
1287
|
+
/** Name attribute for the checkbox element (used in form submission) */
|
|
1288
|
+
name?: string;
|
|
1289
|
+
/** Label text displayed next to the checkbox */
|
|
1290
|
+
label?: string;
|
|
1291
|
+
/** Size variant of the checkbox (default: 'md') */
|
|
1292
|
+
size?: MnCheckboxVariants['size'];
|
|
1293
|
+
/** Border radius variant (default: 'sm') */
|
|
1294
|
+
borderRadius?: MnCheckboxVariants['borderRadius'];
|
|
1295
|
+
/** Custom error messages mapped by validator error key */
|
|
1296
|
+
errorMessages?: MnCheckboxErrorMessagesData;
|
|
1297
|
+
/** Fallback error message when no specific message is found for an error */
|
|
1298
|
+
defaultErrorMessage?: string;
|
|
1299
|
+
/** Priority order for displaying errors when multiple validation errors exist */
|
|
1300
|
+
errorPriority?: string[];
|
|
1301
|
+
/** Whether to use built-in default error messages (default: true) */
|
|
1302
|
+
useBuiltInErrorMessages?: boolean;
|
|
1303
|
+
/** Whether to display all validation errors or just the first/priority error (default: false) */
|
|
1304
|
+
showAllErrors?: boolean;
|
|
1305
|
+
}
|
|
1306
|
+
interface MnCheckboxUIConfig {
|
|
1307
|
+
/** Label text displayed next to the checkbox */
|
|
1308
|
+
label?: string;
|
|
1309
|
+
/** ARIA label for screen readers (falls back to label if not provided) */
|
|
1310
|
+
ariaLabel?: string;
|
|
1278
1311
|
}
|
|
1279
1312
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1313
|
+
declare const MN_CHECKBOX_CONFIG: InjectionToken<MnCheckboxUIConfig>;
|
|
1314
|
+
declare class MnCheckbox implements OnInit {
|
|
1315
|
+
ngControl: NgControl;
|
|
1316
|
+
protected uiConfig: MnCheckboxUIConfig;
|
|
1317
|
+
props: MnCheckboxProps;
|
|
1318
|
+
private readonly configService;
|
|
1319
|
+
private readonly sectionPath;
|
|
1320
|
+
private readonly explicitInstanceId;
|
|
1321
|
+
value: boolean;
|
|
1322
|
+
isDisabled: boolean;
|
|
1323
|
+
private onChange;
|
|
1324
|
+
private onTouched;
|
|
1325
|
+
private readonly builtInErrorMessages;
|
|
1326
|
+
constructor(ngControl: NgControl);
|
|
1327
|
+
ngOnInit(): void;
|
|
1328
|
+
private resolveConfig;
|
|
1329
|
+
writeValue(val: unknown): void;
|
|
1330
|
+
registerOnChange(fn: any): void;
|
|
1331
|
+
registerOnTouched(fn: any): void;
|
|
1332
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1333
|
+
handleChange(checked: boolean): void;
|
|
1334
|
+
handleBlur(): void;
|
|
1335
|
+
get control(): _angular_forms.AbstractControl<any, any, any> | null;
|
|
1336
|
+
get showError(): boolean;
|
|
1337
|
+
private pickErrorKey;
|
|
1338
|
+
protected isRequired(): boolean;
|
|
1339
|
+
private resolveErrorMessageForKey;
|
|
1340
|
+
get errorMessages(): string[];
|
|
1341
|
+
get errorMessage(): string | null;
|
|
1342
|
+
get resolvedId(): string;
|
|
1343
|
+
get resolvedName(): string | null;
|
|
1344
|
+
get checkboxClasses(): string;
|
|
1345
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnCheckbox, [{ optional: true; self: true; }]>;
|
|
1346
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnCheckbox, "mn-lib-checkbox", never, { "props": { "alias": "props"; "required": true; }; }, {}, never, never, true, never>;
|
|
1347
|
+
}
|
|
1286
1348
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1349
|
+
declare const mnDatetimeVariants: tailwind_variants.TVReturnType<{
|
|
1350
|
+
shadow: {
|
|
1351
|
+
true: string;
|
|
1352
|
+
};
|
|
1353
|
+
size: {
|
|
1354
|
+
sm: string;
|
|
1355
|
+
md: string;
|
|
1356
|
+
lg: string;
|
|
1357
|
+
};
|
|
1358
|
+
borderRadius: {
|
|
1359
|
+
none: string;
|
|
1360
|
+
xs: string;
|
|
1361
|
+
sm: string;
|
|
1362
|
+
md: string;
|
|
1363
|
+
lg: string;
|
|
1364
|
+
xl: string;
|
|
1365
|
+
two_xl: string;
|
|
1366
|
+
three_xl: string;
|
|
1367
|
+
four_xl: string;
|
|
1368
|
+
};
|
|
1369
|
+
fullWidth: {
|
|
1370
|
+
true: string;
|
|
1371
|
+
};
|
|
1372
|
+
}, undefined, "bg-white border-1 border-gray-500 placeholder-gray-500 text-sm", {
|
|
1373
|
+
shadow: {
|
|
1374
|
+
true: string;
|
|
1375
|
+
};
|
|
1376
|
+
size: {
|
|
1377
|
+
sm: string;
|
|
1378
|
+
md: string;
|
|
1379
|
+
lg: string;
|
|
1380
|
+
};
|
|
1381
|
+
borderRadius: {
|
|
1382
|
+
none: string;
|
|
1383
|
+
xs: string;
|
|
1384
|
+
sm: string;
|
|
1385
|
+
md: string;
|
|
1386
|
+
lg: string;
|
|
1387
|
+
xl: string;
|
|
1388
|
+
two_xl: string;
|
|
1389
|
+
three_xl: string;
|
|
1390
|
+
four_xl: string;
|
|
1391
|
+
};
|
|
1392
|
+
fullWidth: {
|
|
1393
|
+
true: string;
|
|
1394
|
+
};
|
|
1395
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
1396
|
+
shadow: {
|
|
1397
|
+
true: string;
|
|
1398
|
+
};
|
|
1399
|
+
size: {
|
|
1400
|
+
sm: string;
|
|
1401
|
+
md: string;
|
|
1402
|
+
lg: string;
|
|
1403
|
+
};
|
|
1404
|
+
borderRadius: {
|
|
1405
|
+
none: string;
|
|
1406
|
+
xs: string;
|
|
1407
|
+
sm: string;
|
|
1408
|
+
md: string;
|
|
1409
|
+
lg: string;
|
|
1410
|
+
xl: string;
|
|
1411
|
+
two_xl: string;
|
|
1412
|
+
three_xl: string;
|
|
1413
|
+
four_xl: string;
|
|
1414
|
+
};
|
|
1415
|
+
fullWidth: {
|
|
1416
|
+
true: string;
|
|
1417
|
+
};
|
|
1418
|
+
}, undefined, "bg-white border-1 border-gray-500 placeholder-gray-500 text-sm", unknown, unknown, undefined>>;
|
|
1419
|
+
type MnDatetimeVariants = VariantProps<typeof mnDatetimeVariants>;
|
|
1297
1420
|
|
|
1421
|
+
type MnDatetimeErrorMessageData = string | ((args: any, errors: ValidationErrors) => string);
|
|
1422
|
+
type MnDatetimeErrorMessagesData = Partial<Record<string, MnDatetimeErrorMessageData>>;
|
|
1298
1423
|
/**
|
|
1299
|
-
*
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
* Represents the current component instance id provided by [mn-instance].
|
|
1424
|
+
* Supported datetime input modes.
|
|
1425
|
+
* - 'date': Date only (YYYY-MM-DD)
|
|
1426
|
+
* - 'time': Time only (HH:mm)
|
|
1427
|
+
* - 'datetime-local': Date and time combined (YYYY-MM-DDTHH:mm)
|
|
1304
1428
|
*/
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1429
|
+
type MnDatetimeMode = 'date' | 'time' | 'datetime-local';
|
|
1430
|
+
interface MnDatetimeProps {
|
|
1431
|
+
/** Unique identifier for the datetime element (required for accessibility) */
|
|
1432
|
+
id: string;
|
|
1433
|
+
/** Name attribute for the datetime element (used in form submission) */
|
|
1434
|
+
name?: string;
|
|
1435
|
+
/** Label text displayed above the datetime field */
|
|
1436
|
+
label?: string;
|
|
1437
|
+
/** Placeholder text (overrides uiConfig.placeholder when provided) */
|
|
1438
|
+
placeholder?: string;
|
|
1439
|
+
/** Datetime input mode (default: 'datetime-local') */
|
|
1440
|
+
mode?: MnDatetimeMode;
|
|
1441
|
+
/** Minimum allowed date/time value (ISO 8601 format) */
|
|
1442
|
+
min?: string;
|
|
1443
|
+
/** Maximum allowed date/time value (ISO 8601 format) */
|
|
1444
|
+
max?: string;
|
|
1445
|
+
/** Step interval in seconds (e.g., 60 for minute precision, 1 for second precision) */
|
|
1446
|
+
step?: number;
|
|
1447
|
+
/** Size variant of the datetime field (default: 'md') */
|
|
1448
|
+
size?: MnDatetimeVariants['size'];
|
|
1449
|
+
/** Border radius variant (default: 'md') */
|
|
1450
|
+
borderRadius?: MnDatetimeVariants['borderRadius'];
|
|
1451
|
+
/** Shadow variant for the datetime field */
|
|
1452
|
+
shadow?: MnDatetimeVariants['shadow'];
|
|
1453
|
+
/** Whether the datetime field should take full width of its container */
|
|
1454
|
+
fullWidth?: MnDatetimeVariants['fullWidth'];
|
|
1455
|
+
/** Custom error messages mapped by validator error key */
|
|
1456
|
+
errorMessages?: MnDatetimeErrorMessagesData;
|
|
1457
|
+
/** Fallback error message when no specific message is found for an error */
|
|
1458
|
+
defaultErrorMessage?: string;
|
|
1459
|
+
/** Priority order for displaying errors when multiple validation errors exist */
|
|
1460
|
+
errorPriority?: string[];
|
|
1461
|
+
/** Whether to use built-in default error messages (default: true) */
|
|
1462
|
+
useBuiltInErrorMessages?: boolean;
|
|
1463
|
+
/** Whether to display all validation errors or just the first/priority error (default: false) */
|
|
1464
|
+
showAllErrors?: boolean;
|
|
1465
|
+
}
|
|
1466
|
+
interface MnDatetimeUIConfig {
|
|
1467
|
+
/** Label text displayed above the datetime field */
|
|
1468
|
+
label?: string;
|
|
1469
|
+
/** Placeholder text shown inside the datetime field when empty */
|
|
1470
|
+
placeholder?: string;
|
|
1471
|
+
/** ARIA label for screen readers (falls back to label if not provided) */
|
|
1472
|
+
ariaLabel?: string;
|
|
1312
1473
|
}
|
|
1313
1474
|
|
|
1314
|
-
declare
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1475
|
+
declare const MN_DATETIME_CONFIG: InjectionToken<MnDatetimeUIConfig>;
|
|
1476
|
+
declare class MnDatetime implements OnInit {
|
|
1477
|
+
ngControl: NgControl;
|
|
1478
|
+
protected uiConfig: MnDatetimeUIConfig;
|
|
1479
|
+
props: MnDatetimeProps;
|
|
1480
|
+
private readonly configService;
|
|
1481
|
+
private readonly sectionPath;
|
|
1482
|
+
private readonly explicitInstanceId;
|
|
1483
|
+
value: string | null;
|
|
1484
|
+
isDisabled: boolean;
|
|
1485
|
+
private onChange;
|
|
1486
|
+
private onTouched;
|
|
1487
|
+
private readonly builtInErrorMessages;
|
|
1488
|
+
constructor(ngControl: NgControl);
|
|
1489
|
+
ngOnInit(): void;
|
|
1490
|
+
private resolveConfig;
|
|
1491
|
+
writeValue(val: unknown): void;
|
|
1492
|
+
registerOnChange(fn: any): void;
|
|
1493
|
+
registerOnTouched(fn: any): void;
|
|
1494
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1495
|
+
handleInput(raw: string): void;
|
|
1496
|
+
handleBlur(): void;
|
|
1497
|
+
get control(): _angular_forms.AbstractControl<any, any, any> | null;
|
|
1498
|
+
get showError(): boolean;
|
|
1499
|
+
private pickErrorKey;
|
|
1500
|
+
protected isRequired(): boolean;
|
|
1501
|
+
private resolveErrorMessageForKey;
|
|
1502
|
+
get errorMessages(): string[];
|
|
1503
|
+
get errorMessage(): string | null;
|
|
1504
|
+
get resolvedId(): string;
|
|
1505
|
+
get resolvedName(): string | null;
|
|
1506
|
+
get resolvedMode(): MnDatetimeMode;
|
|
1507
|
+
get inputClasses(): string;
|
|
1508
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnDatetime, [{ optional: true; self: true; }]>;
|
|
1509
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnDatetime, "mn-lib-datetime", never, { "props": { "alias": "props"; "required": true; }; }, {}, never, never, true, never>;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
declare const mnMultiSelectVariants: tailwind_variants.TVReturnType<{
|
|
1513
|
+
shadow: {
|
|
1514
|
+
true: string;
|
|
1515
|
+
};
|
|
1516
|
+
size: {
|
|
1517
|
+
sm: string;
|
|
1518
|
+
md: string;
|
|
1519
|
+
lg: string;
|
|
1520
|
+
};
|
|
1521
|
+
borderRadius: {
|
|
1522
|
+
none: string;
|
|
1523
|
+
xs: string;
|
|
1524
|
+
sm: string;
|
|
1525
|
+
md: string;
|
|
1526
|
+
lg: string;
|
|
1527
|
+
xl: string;
|
|
1528
|
+
two_xl: string;
|
|
1529
|
+
three_xl: string;
|
|
1530
|
+
four_xl: string;
|
|
1531
|
+
};
|
|
1532
|
+
fullWidth: {
|
|
1533
|
+
true: string;
|
|
1534
|
+
};
|
|
1535
|
+
}, undefined, "bg-white border-1 border-gray-500 text-sm cursor-pointer", {
|
|
1536
|
+
shadow: {
|
|
1537
|
+
true: string;
|
|
1538
|
+
};
|
|
1539
|
+
size: {
|
|
1540
|
+
sm: string;
|
|
1541
|
+
md: string;
|
|
1542
|
+
lg: string;
|
|
1543
|
+
};
|
|
1544
|
+
borderRadius: {
|
|
1545
|
+
none: string;
|
|
1546
|
+
xs: string;
|
|
1547
|
+
sm: string;
|
|
1548
|
+
md: string;
|
|
1549
|
+
lg: string;
|
|
1550
|
+
xl: string;
|
|
1551
|
+
two_xl: string;
|
|
1552
|
+
three_xl: string;
|
|
1553
|
+
four_xl: string;
|
|
1554
|
+
};
|
|
1555
|
+
fullWidth: {
|
|
1556
|
+
true: string;
|
|
1557
|
+
};
|
|
1558
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
1559
|
+
shadow: {
|
|
1560
|
+
true: string;
|
|
1561
|
+
};
|
|
1562
|
+
size: {
|
|
1563
|
+
sm: string;
|
|
1564
|
+
md: string;
|
|
1565
|
+
lg: string;
|
|
1566
|
+
};
|
|
1567
|
+
borderRadius: {
|
|
1568
|
+
none: string;
|
|
1569
|
+
xs: string;
|
|
1570
|
+
sm: string;
|
|
1571
|
+
md: string;
|
|
1572
|
+
lg: string;
|
|
1573
|
+
xl: string;
|
|
1574
|
+
two_xl: string;
|
|
1575
|
+
three_xl: string;
|
|
1576
|
+
four_xl: string;
|
|
1577
|
+
};
|
|
1578
|
+
fullWidth: {
|
|
1579
|
+
true: string;
|
|
1580
|
+
};
|
|
1581
|
+
}, undefined, "bg-white border-1 border-gray-500 text-sm cursor-pointer", unknown, unknown, undefined>>;
|
|
1582
|
+
type MnMultiSelectVariants = VariantProps<typeof mnMultiSelectVariants>;
|
|
1583
|
+
|
|
1584
|
+
type MnMultiSelectErrorMessageData = string | ((args: any, errors: ValidationErrors) => string);
|
|
1585
|
+
type MnMultiSelectErrorMessagesData = Partial<Record<string, MnMultiSelectErrorMessageData>>;
|
|
1586
|
+
interface MnMultiSelectOption<TValue = unknown> {
|
|
1587
|
+
/** Display label for the option */
|
|
1588
|
+
label: string;
|
|
1589
|
+
/** Value associated with the option */
|
|
1590
|
+
value: TValue;
|
|
1591
|
+
/** Whether the option is disabled */
|
|
1592
|
+
disabled?: boolean;
|
|
1593
|
+
}
|
|
1594
|
+
interface MnMultiSelectProps<TValue = unknown> {
|
|
1595
|
+
/** Unique identifier for the multi-select element (required for accessibility) */
|
|
1596
|
+
id: string;
|
|
1597
|
+
/** Name attribute for the multi-select element (used in form submission) */
|
|
1598
|
+
name?: string;
|
|
1599
|
+
/** Label text displayed above the multi-select */
|
|
1600
|
+
label?: string;
|
|
1601
|
+
/** Placeholder text shown when no options are selected */
|
|
1602
|
+
placeholder?: string;
|
|
1603
|
+
/** Available options to select from */
|
|
1604
|
+
options: MnMultiSelectOption<TValue>[];
|
|
1605
|
+
/** Whether to show a search/filter input (default: false) */
|
|
1606
|
+
searchable?: boolean;
|
|
1607
|
+
/** Placeholder text for the search input */
|
|
1608
|
+
searchPlaceholder?: string;
|
|
1609
|
+
/** Maximum number of items that can be selected (undefined = unlimited) */
|
|
1610
|
+
maxSelections?: number;
|
|
1611
|
+
/** Size variant of the multi-select (default: 'md') */
|
|
1612
|
+
size?: MnMultiSelectVariants['size'];
|
|
1613
|
+
/** Border radius variant (default: 'md') */
|
|
1614
|
+
borderRadius?: MnMultiSelectVariants['borderRadius'];
|
|
1615
|
+
/** Shadow variant for the multi-select */
|
|
1616
|
+
shadow?: MnMultiSelectVariants['shadow'];
|
|
1617
|
+
/** Whether the multi-select should take full width of its container */
|
|
1618
|
+
fullWidth?: MnMultiSelectVariants['fullWidth'];
|
|
1619
|
+
/** Custom error messages mapped by validator error key */
|
|
1620
|
+
errorMessages?: MnMultiSelectErrorMessagesData;
|
|
1621
|
+
/** Fallback error message when no specific message is found for an error */
|
|
1622
|
+
defaultErrorMessage?: string;
|
|
1623
|
+
/** Priority order for displaying errors when multiple validation errors exist */
|
|
1624
|
+
errorPriority?: string[];
|
|
1625
|
+
/** Whether to use built-in default error messages (default: true) */
|
|
1626
|
+
useBuiltInErrorMessages?: boolean;
|
|
1627
|
+
/** Whether to display all validation errors or just the first/priority error (default: false) */
|
|
1628
|
+
showAllErrors?: boolean;
|
|
1629
|
+
}
|
|
1630
|
+
interface MnMultiSelectUIConfig {
|
|
1631
|
+
/** Label text displayed above the multi-select */
|
|
1632
|
+
label?: string;
|
|
1633
|
+
/** Placeholder text shown when no options are selected */
|
|
1634
|
+
placeholder?: string;
|
|
1635
|
+
/** ARIA label for screen readers (falls back to label if not provided) */
|
|
1636
|
+
ariaLabel?: string;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
declare const MN_MULTI_SELECT_CONFIG: InjectionToken<MnMultiSelectUIConfig>;
|
|
1640
|
+
declare class MnMultiSelect implements OnInit {
|
|
1641
|
+
ngControl: NgControl;
|
|
1642
|
+
protected uiConfig: MnMultiSelectUIConfig;
|
|
1643
|
+
props: MnMultiSelectProps;
|
|
1644
|
+
private readonly configService;
|
|
1645
|
+
private readonly sectionPath;
|
|
1646
|
+
private readonly explicitInstanceId;
|
|
1647
|
+
private readonly elRef;
|
|
1648
|
+
/** Currently selected values */
|
|
1649
|
+
selectedValues: unknown[];
|
|
1650
|
+
isOpen: boolean;
|
|
1651
|
+
isDisabled: boolean;
|
|
1652
|
+
searchTerm: string;
|
|
1653
|
+
private onChange;
|
|
1654
|
+
private onTouched;
|
|
1655
|
+
private readonly builtInErrorMessages;
|
|
1656
|
+
constructor(ngControl: NgControl);
|
|
1657
|
+
ngOnInit(): void;
|
|
1658
|
+
private resolveConfig;
|
|
1659
|
+
writeValue(val: unknown): void;
|
|
1660
|
+
registerOnChange(fn: any): void;
|
|
1661
|
+
registerOnTouched(fn: any): void;
|
|
1662
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1663
|
+
toggle(): void;
|
|
1664
|
+
onDocumentClick(event: Event): void;
|
|
1665
|
+
toggleOption(option: MnMultiSelectOption): void;
|
|
1666
|
+
removeOption(option: MnMultiSelectOption, event: Event): void;
|
|
1667
|
+
isSelected(option: MnMultiSelectOption): boolean;
|
|
1668
|
+
isMaxReached(option: MnMultiSelectOption): boolean;
|
|
1669
|
+
onSearch(term: string): void;
|
|
1670
|
+
get filteredOptions(): MnMultiSelectOption[];
|
|
1671
|
+
get selectedOptions(): MnMultiSelectOption[];
|
|
1672
|
+
handleBlur(): void;
|
|
1673
|
+
get control(): _angular_forms.AbstractControl<any, any, any> | null;
|
|
1674
|
+
get showError(): boolean;
|
|
1675
|
+
private pickErrorKey;
|
|
1676
|
+
protected isRequired(): boolean;
|
|
1677
|
+
private resolveErrorMessageForKey;
|
|
1678
|
+
get errorMessages(): string[];
|
|
1679
|
+
get errorMessage(): string | null;
|
|
1680
|
+
get resolvedId(): string;
|
|
1681
|
+
get resolvedName(): string | null;
|
|
1682
|
+
get triggerClasses(): string;
|
|
1683
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnMultiSelect, [{ optional: true; self: true; }]>;
|
|
1684
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnMultiSelect, "mn-lib-multi-select", never, { "props": { "alias": "props"; "required": true; }; }, {}, never, never, true, never>;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
interface PaginationStrategy {
|
|
1688
|
+
hasMoreRows: boolean;
|
|
1689
|
+
loadMore: () => Promise<void>;
|
|
1690
|
+
reset?: () => void;
|
|
1691
|
+
}
|
|
1692
|
+
interface CursorPaginationStrategy extends PaginationStrategy {
|
|
1693
|
+
endCursor?: string;
|
|
1694
|
+
}
|
|
1695
|
+
interface OffsetPaginationStrategy extends PaginationStrategy {
|
|
1696
|
+
currentPage: number;
|
|
1697
|
+
pageSize: number;
|
|
1698
|
+
totalItems?: number;
|
|
1699
|
+
}
|
|
1700
|
+
interface TableRowAction<T> {
|
|
1701
|
+
icon?: string;
|
|
1702
|
+
label?: string;
|
|
1703
|
+
cssClass?: string;
|
|
1704
|
+
onClick: (row: T) => void;
|
|
1705
|
+
isVisible?: (row: T) => boolean;
|
|
1706
|
+
isDisabled?: (row: T) => boolean;
|
|
1707
|
+
}
|
|
1708
|
+
declare enum ColumnSortType {
|
|
1709
|
+
ALPHABETICAL = "ALPHABETICAL",
|
|
1710
|
+
NUMERICAL = "NUMERICAL",
|
|
1711
|
+
DATE = "DATE",
|
|
1712
|
+
NONE = "NONE"
|
|
1713
|
+
}
|
|
1714
|
+
interface SortState {
|
|
1715
|
+
columnKey: string;
|
|
1716
|
+
direction: 'asc' | 'desc';
|
|
1717
|
+
}
|
|
1718
|
+
interface TableAppearance {
|
|
1719
|
+
striped?: boolean;
|
|
1720
|
+
hover?: boolean;
|
|
1721
|
+
compact?: boolean;
|
|
1722
|
+
bordered?: boolean;
|
|
1723
|
+
}
|
|
1724
|
+
interface ColumnDefinition<T> {
|
|
1725
|
+
key: string;
|
|
1726
|
+
header: string | TemplateRef<any>;
|
|
1727
|
+
cell: ((row: T) => string) | TemplateRef<any>;
|
|
1728
|
+
sortType?: ColumnSortType;
|
|
1729
|
+
getRawValueToSort?: (row: T) => any;
|
|
1730
|
+
width?: string;
|
|
1731
|
+
align?: 'left' | 'center' | 'right';
|
|
1732
|
+
hiddenBelow?: 'sm' | 'md' | 'lg';
|
|
1733
|
+
}
|
|
1734
|
+
interface TableDataSource<T> {
|
|
1735
|
+
dataRows: BehaviorSubject<T[]>;
|
|
1736
|
+
columns: ColumnDefinition<T>[];
|
|
1737
|
+
getID: (row: T) => string;
|
|
1738
|
+
emptyMessage: string;
|
|
1739
|
+
emptyTemplate?: TemplateRef<any>;
|
|
1740
|
+
isDataLoading: boolean;
|
|
1741
|
+
canSearch: boolean;
|
|
1742
|
+
searchPlaceholder?: string;
|
|
1743
|
+
isInSearch?: (row: T, searchValue: string) => boolean;
|
|
1744
|
+
searchForAdditionalItems?: (searchValue: string) => Promise<T[]>;
|
|
1745
|
+
paginationMode?: 'none' | 'load-more' | 'paginated' | 'infinite-scroll';
|
|
1746
|
+
paginationStrategy?: PaginationStrategy;
|
|
1747
|
+
loadAdditionalRows?: () => Promise<T[]>;
|
|
1748
|
+
defaultSort?: SortState;
|
|
1749
|
+
selectionMode?: 'none' | 'single' | 'multi';
|
|
1750
|
+
selectedRows?: BehaviorSubject<T[]>;
|
|
1751
|
+
rowActions?: TableRowAction<T>[];
|
|
1752
|
+
onRowClick?: (row: T) => void;
|
|
1753
|
+
appearance?: TableAppearance;
|
|
1754
|
+
toolbarTemplate?: TemplateRef<any>;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
declare enum ModalKind {
|
|
1758
|
+
WIZARD = "wizard",
|
|
1759
|
+
FORM = "form",
|
|
1760
|
+
CONFIRMATION = "confirmation",
|
|
1761
|
+
CUSTOM = "custom"
|
|
1762
|
+
}
|
|
1763
|
+
declare enum ModalSize {
|
|
1764
|
+
SM = "sm",
|
|
1765
|
+
MD = "md",
|
|
1766
|
+
LG = "lg",
|
|
1767
|
+
XL = "xl",
|
|
1768
|
+
FULL = "full"
|
|
1769
|
+
}
|
|
1770
|
+
declare enum CloseMode {
|
|
1771
|
+
ALLOWED = "allowed",
|
|
1772
|
+
GUARDED = "guarded",
|
|
1773
|
+
DISABLED = "disabled"
|
|
1774
|
+
}
|
|
1775
|
+
declare enum BackdropMode {
|
|
1776
|
+
HIDE = "hide",
|
|
1777
|
+
STATIC = "static",
|
|
1778
|
+
CLOSABLE = "closable"
|
|
1779
|
+
}
|
|
1780
|
+
declare enum KeyboardMode {
|
|
1781
|
+
ENABLED = "enabled",
|
|
1782
|
+
DISABLED = "disabled"
|
|
1783
|
+
}
|
|
1784
|
+
declare enum ModalIntent {
|
|
1785
|
+
NEUTRAL = "neutral",
|
|
1786
|
+
INFO = "info",
|
|
1787
|
+
SUCCESS = "success",
|
|
1788
|
+
WARNING = "warning",
|
|
1789
|
+
DANGER = "danger"
|
|
1790
|
+
}
|
|
1791
|
+
declare enum WizardFlowMode {
|
|
1792
|
+
LINEAR = "linear",
|
|
1793
|
+
FREE = "free"
|
|
1794
|
+
}
|
|
1795
|
+
declare enum FormLayoutMode {
|
|
1796
|
+
SINGLE_COLUMN = "single-column",
|
|
1797
|
+
TWO_COLUMN = "two-column",
|
|
1798
|
+
INLINE = "inline"
|
|
1799
|
+
}
|
|
1800
|
+
declare enum SubmitMode {
|
|
1801
|
+
ONCE = "once",
|
|
1802
|
+
RETRYABLE = "retryable"
|
|
1803
|
+
}
|
|
1804
|
+
declare enum ConfirmationTone {
|
|
1805
|
+
DEFAULT = "default",
|
|
1806
|
+
WARNING = "warning",
|
|
1807
|
+
DANGER = "danger"
|
|
1808
|
+
}
|
|
1809
|
+
declare enum FieldKind {
|
|
1810
|
+
TEXT = "text",
|
|
1811
|
+
NUMBER = "number",
|
|
1812
|
+
SELECT = "select",
|
|
1813
|
+
CHECKBOX = "checkbox",
|
|
1814
|
+
DATE = "date",
|
|
1815
|
+
TEXTAREA = "textarea",
|
|
1816
|
+
DATETIME = "datetime",
|
|
1817
|
+
MULTI_SELECT = "multi-select",
|
|
1818
|
+
MULTI_SELECT_TABLE = "multi-select-table",
|
|
1819
|
+
SINGLE_SELECT_TABLE = "single-select-table",
|
|
1820
|
+
PASSWORD = "password",
|
|
1821
|
+
FILE = "file",
|
|
1822
|
+
COLOR = "color",
|
|
1823
|
+
RATING = "rating",
|
|
1824
|
+
SLIDER = "slider",
|
|
1825
|
+
CUSTOM = "custom"
|
|
1826
|
+
}
|
|
1827
|
+
declare enum FieldAppearance {
|
|
1828
|
+
OUTLINE = "outline",
|
|
1829
|
+
FILLED = "filled",
|
|
1830
|
+
GHOST = "ghost"
|
|
1831
|
+
}
|
|
1832
|
+
declare enum SelectionMode {
|
|
1833
|
+
SINGLE = "single",
|
|
1834
|
+
MULTIPLE = "multiple"
|
|
1835
|
+
}
|
|
1836
|
+
declare enum OptionState {
|
|
1837
|
+
ENABLED = "enabled",
|
|
1838
|
+
DISABLED = "disabled"
|
|
1839
|
+
}
|
|
1840
|
+
declare enum ActionStyle {
|
|
1841
|
+
PRIMARY = "primary",
|
|
1842
|
+
SECONDARY = "secondary",
|
|
1843
|
+
DANGER = "danger",
|
|
1844
|
+
GHOST = "ghost"
|
|
1845
|
+
}
|
|
1846
|
+
declare enum StepState {
|
|
1847
|
+
PENDING = "pending",
|
|
1848
|
+
ACTIVE = "active",
|
|
1849
|
+
COMPLETE = "complete",
|
|
1850
|
+
DISABLED = "disabled",
|
|
1851
|
+
HIDDEN = "hidden"
|
|
1852
|
+
}
|
|
1853
|
+
declare enum NavigationDirection {
|
|
1854
|
+
FORWARD = "forward",
|
|
1855
|
+
BACKWARD = "backward",
|
|
1856
|
+
DIRECT = "direct"
|
|
1857
|
+
}
|
|
1858
|
+
declare enum ModalCloseReason {
|
|
1859
|
+
COMPLETED = "completed",
|
|
1860
|
+
CANCELLED = "cancelled",
|
|
1861
|
+
DISMISSED = "dismissed",
|
|
1862
|
+
BACKDROP = "backdrop",
|
|
1863
|
+
ESCAPE = "escape",
|
|
1864
|
+
PROGRAMMATIC = "programmatic",
|
|
1865
|
+
GUARD_REJECTED = "guard_rejected"
|
|
1866
|
+
}
|
|
1867
|
+
declare enum ValidationStatus {
|
|
1868
|
+
VALID = "valid",
|
|
1869
|
+
INVALID = "invalid",
|
|
1870
|
+
PENDING = "pending"
|
|
1871
|
+
}
|
|
1872
|
+
declare enum ValidationCode {
|
|
1873
|
+
REQUIRED = "required",
|
|
1874
|
+
MIN = "min",
|
|
1875
|
+
MAX = "max",
|
|
1876
|
+
PATTERN = "pattern",
|
|
1877
|
+
CUSTOM = "custom"
|
|
1878
|
+
}
|
|
1879
|
+
type ModalStepId = string;
|
|
1880
|
+
type ModalInputMap = Record<string, unknown>;
|
|
1881
|
+
/**
|
|
1882
|
+
* A condition function that receives the current form values and returns
|
|
1883
|
+
* whether the field should be visible.
|
|
1884
|
+
*/
|
|
1885
|
+
type FieldVisibilityCondition<TModel = any> = (formValue: Partial<TModel>) => boolean;
|
|
1886
|
+
/**
|
|
1887
|
+
* A form-level validator that receives the entire form value
|
|
1888
|
+
* and returns an error map or null.
|
|
1889
|
+
*/
|
|
1890
|
+
type FormValidator<TModel = any> = (formValue: Partial<TModel>) => Record<string, string> | null;
|
|
1891
|
+
/**
|
|
1892
|
+
* A data source that asynchronously loads options for select/multi-select fields.
|
|
1893
|
+
* Can optionally depend on other field values to reload.
|
|
1894
|
+
*/
|
|
1895
|
+
interface FieldDataSource<TValue = unknown, TModel = any> {
|
|
1896
|
+
/** Load options, optionally based on current form values */
|
|
1897
|
+
load(formValue?: Partial<TModel>): Promise<SelectOption<TValue>[]> | SelectOption<TValue>[];
|
|
1898
|
+
/** Keys of other fields that trigger a reload when their value changes */
|
|
1899
|
+
dependsOn?: (keyof TModel)[];
|
|
1900
|
+
}
|
|
1901
|
+
interface ValidationResult {
|
|
1902
|
+
status: ValidationStatus;
|
|
1903
|
+
code?: ValidationCode;
|
|
1904
|
+
message?: string;
|
|
1905
|
+
}
|
|
1906
|
+
interface StepValidator {
|
|
1907
|
+
validate(): Promise<ValidationResult> | ValidationResult;
|
|
1908
|
+
}
|
|
1909
|
+
interface FieldValidator {
|
|
1910
|
+
validate(value: unknown): Promise<ValidationResult> | ValidationResult;
|
|
1911
|
+
}
|
|
1912
|
+
interface StepGuard {
|
|
1913
|
+
canEnter(): Promise<boolean> | boolean;
|
|
1914
|
+
canExit(): Promise<boolean> | boolean;
|
|
1915
|
+
}
|
|
1916
|
+
interface ModalCloseEvent<TResult = unknown> {
|
|
1917
|
+
reason: ModalCloseReason;
|
|
1918
|
+
result?: TResult;
|
|
1919
|
+
}
|
|
1920
|
+
interface ModalRef<TResult = unknown> {
|
|
1921
|
+
afterClosed$: Observable<ModalCloseEvent<TResult>>;
|
|
1922
|
+
close(result?: TResult): void;
|
|
1923
|
+
dismiss(reason: ModalCloseReason): void;
|
|
1924
|
+
update(config: Partial<BaseModalConfig<TResult>>): void;
|
|
1925
|
+
}
|
|
1926
|
+
interface ModalResultHandler<TResult = unknown> {
|
|
1927
|
+
handle(result: TResult): Promise<void> | void;
|
|
1928
|
+
}
|
|
1929
|
+
interface WizardStepChangeEvent {
|
|
1930
|
+
previousStepId?: ModalStepId;
|
|
1931
|
+
currentStepId: ModalStepId;
|
|
1932
|
+
direction: NavigationDirection;
|
|
1933
|
+
}
|
|
1934
|
+
interface WizardStepChangeHandler {
|
|
1935
|
+
handle(event: WizardStepChangeEvent): Promise<void> | void;
|
|
1936
|
+
}
|
|
1937
|
+
type StepBodyConfig = Type<unknown> | TemplateRef<unknown> | string;
|
|
1938
|
+
interface WizardStepConfig<TModel = any> {
|
|
1939
|
+
id: ModalStepId;
|
|
1940
|
+
title: string;
|
|
1941
|
+
state?: StepState;
|
|
1942
|
+
body?: StepBodyConfig;
|
|
1943
|
+
fields?: FormFieldConfig<TModel>[];
|
|
1944
|
+
rows?: FormRow<TModel>[];
|
|
1945
|
+
fieldGroups?: FormFieldGroup<TModel>[];
|
|
1946
|
+
formValidators?: FormValidator<TModel>[];
|
|
1947
|
+
groupValidators?: any[];
|
|
1948
|
+
initialValue?: Partial<TModel>;
|
|
1949
|
+
guard?: StepGuard;
|
|
1950
|
+
validators?: StepValidator[];
|
|
1951
|
+
/** Condition to show/hide this entire step based on aggregated wizard data */
|
|
1952
|
+
visible?: (aggregatedData: Record<ModalStepId, Record<string, any>>) => boolean;
|
|
1953
|
+
}
|
|
1954
|
+
interface WizardResult {
|
|
1955
|
+
status: ModalCloseReason;
|
|
1956
|
+
visitedStepIds: ModalStepId[];
|
|
1957
|
+
payload?: Record<ModalStepId, Record<string, any>>;
|
|
1958
|
+
}
|
|
1959
|
+
interface SelectOption<TValue = unknown> {
|
|
1960
|
+
label: string;
|
|
1961
|
+
value: TValue;
|
|
1962
|
+
state?: OptionState;
|
|
1963
|
+
}
|
|
1964
|
+
interface TextFieldConfig<TModel = unknown> {
|
|
1965
|
+
kind: FieldKind.TEXT;
|
|
1966
|
+
key: keyof TModel;
|
|
1967
|
+
label: string;
|
|
1968
|
+
appearance?: FieldAppearance;
|
|
1969
|
+
validators?: any[];
|
|
1970
|
+
asyncValidators?: any[];
|
|
1971
|
+
placeholder?: string;
|
|
1972
|
+
/** Whether this field is read-only (display only) */
|
|
1973
|
+
readOnly?: boolean;
|
|
1974
|
+
/** Whether this field is disabled */
|
|
1975
|
+
disabled?: boolean;
|
|
1976
|
+
/** Condition to show/hide this field based on other field values */
|
|
1977
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
1978
|
+
}
|
|
1979
|
+
interface NumberFieldConfig<TModel = unknown> {
|
|
1980
|
+
kind: FieldKind.NUMBER;
|
|
1981
|
+
key: keyof TModel;
|
|
1982
|
+
label: string;
|
|
1983
|
+
validators?: any[];
|
|
1984
|
+
asyncValidators?: any[];
|
|
1985
|
+
placeholder?: string;
|
|
1986
|
+
min?: number;
|
|
1987
|
+
max?: number;
|
|
1988
|
+
step?: number;
|
|
1989
|
+
readOnly?: boolean;
|
|
1990
|
+
disabled?: boolean;
|
|
1991
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
1992
|
+
}
|
|
1993
|
+
interface SelectFieldConfig<TModel = unknown, TValue = unknown> {
|
|
1994
|
+
kind: FieldKind.SELECT;
|
|
1995
|
+
key: keyof TModel;
|
|
1996
|
+
label: string;
|
|
1997
|
+
options: SelectOption<TValue>[];
|
|
1998
|
+
selectionMode?: SelectionMode;
|
|
1999
|
+
validators?: any[];
|
|
2000
|
+
asyncValidators?: any[];
|
|
2001
|
+
readOnly?: boolean;
|
|
2002
|
+
disabled?: boolean;
|
|
2003
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2004
|
+
/** Async data source for loading options dynamically */
|
|
2005
|
+
dataSource?: FieldDataSource<TValue, TModel>;
|
|
2006
|
+
}
|
|
2007
|
+
interface CheckboxFieldConfig<TModel = unknown> {
|
|
2008
|
+
kind: FieldKind.CHECKBOX;
|
|
2009
|
+
key: keyof TModel;
|
|
2010
|
+
label: string;
|
|
2011
|
+
defaultValue?: boolean;
|
|
2012
|
+
readOnly?: boolean;
|
|
2013
|
+
disabled?: boolean;
|
|
2014
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2015
|
+
}
|
|
2016
|
+
interface DateFieldConfig<TModel = unknown> {
|
|
2017
|
+
kind: FieldKind.DATE;
|
|
2018
|
+
key: keyof TModel;
|
|
2019
|
+
label: string;
|
|
2020
|
+
placeholder?: string;
|
|
2021
|
+
validators?: any[];
|
|
2022
|
+
asyncValidators?: any[];
|
|
2023
|
+
minDate?: string;
|
|
2024
|
+
maxDate?: string;
|
|
2025
|
+
readOnly?: boolean;
|
|
2026
|
+
disabled?: boolean;
|
|
2027
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2028
|
+
}
|
|
2029
|
+
interface TextareaFieldConfig<TModel = unknown> {
|
|
2030
|
+
kind: FieldKind.TEXTAREA;
|
|
2031
|
+
key: keyof TModel;
|
|
2032
|
+
label: string;
|
|
2033
|
+
placeholder?: string;
|
|
2034
|
+
validators?: any[];
|
|
2035
|
+
asyncValidators?: any[];
|
|
2036
|
+
rows?: number;
|
|
2037
|
+
readOnly?: boolean;
|
|
2038
|
+
disabled?: boolean;
|
|
2039
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2040
|
+
}
|
|
2041
|
+
interface DatetimeFieldConfig<TModel = unknown> {
|
|
2042
|
+
kind: FieldKind.DATETIME;
|
|
2043
|
+
key: keyof TModel;
|
|
2044
|
+
label: string;
|
|
2045
|
+
placeholder?: string;
|
|
2046
|
+
validators?: any[];
|
|
2047
|
+
asyncValidators?: any[];
|
|
2048
|
+
mode?: 'date' | 'time' | 'datetime-local';
|
|
2049
|
+
min?: string;
|
|
2050
|
+
max?: string;
|
|
2051
|
+
step?: number;
|
|
2052
|
+
readOnly?: boolean;
|
|
2053
|
+
disabled?: boolean;
|
|
2054
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2055
|
+
}
|
|
2056
|
+
interface MultiSelectFieldConfig<TModel = unknown, TValue = unknown> {
|
|
2057
|
+
kind: FieldKind.MULTI_SELECT;
|
|
2058
|
+
key: keyof TModel;
|
|
2059
|
+
label: string;
|
|
2060
|
+
options: SelectOption<TValue>[];
|
|
2061
|
+
validators?: any[];
|
|
2062
|
+
asyncValidators?: any[];
|
|
2063
|
+
searchable?: boolean;
|
|
2064
|
+
searchPlaceholder?: string;
|
|
2065
|
+
maxSelections?: number;
|
|
2066
|
+
readOnly?: boolean;
|
|
2067
|
+
disabled?: boolean;
|
|
2068
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2069
|
+
/** Async data source for loading options dynamically */
|
|
2070
|
+
dataSource?: FieldDataSource<TValue, TModel>;
|
|
2071
|
+
}
|
|
2072
|
+
interface PasswordFieldConfig<TModel = unknown> {
|
|
2073
|
+
kind: FieldKind.PASSWORD;
|
|
2074
|
+
key: keyof TModel;
|
|
2075
|
+
label: string;
|
|
2076
|
+
placeholder?: string;
|
|
2077
|
+
validators?: any[];
|
|
2078
|
+
asyncValidators?: any[];
|
|
2079
|
+
readOnly?: boolean;
|
|
2080
|
+
disabled?: boolean;
|
|
2081
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2082
|
+
}
|
|
2083
|
+
interface MultiSelectTableFieldConfig<TModel = unknown, TRow = any> {
|
|
2084
|
+
kind: FieldKind.MULTI_SELECT_TABLE;
|
|
2085
|
+
key: keyof TModel;
|
|
2086
|
+
label: string;
|
|
2087
|
+
/** The TableDataSource that powers the mn-table. selectionMode will be forced to 'multi'. */
|
|
2088
|
+
tableDataSource: TableDataSource<TRow>;
|
|
2089
|
+
/** Function to extract the value stored in the form from a selected row (default: getID) */
|
|
2090
|
+
getRowValue?: (row: TRow) => unknown;
|
|
2091
|
+
validators?: any[];
|
|
2092
|
+
asyncValidators?: any[];
|
|
2093
|
+
readOnly?: boolean;
|
|
2094
|
+
disabled?: boolean;
|
|
2095
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2096
|
+
}
|
|
2097
|
+
interface SingleSelectTableFieldConfig<TModel = unknown, TRow = any> {
|
|
2098
|
+
kind: FieldKind.SINGLE_SELECT_TABLE;
|
|
2099
|
+
key: keyof TModel;
|
|
2100
|
+
label: string;
|
|
2101
|
+
/** The TableDataSource that powers the mn-table. selectionMode will be forced to 'single'. */
|
|
2102
|
+
tableDataSource: TableDataSource<TRow>;
|
|
2103
|
+
/** Function to extract the value stored in the form from a selected row (default: getID) */
|
|
2104
|
+
getRowValue?: (row: TRow) => unknown;
|
|
2105
|
+
validators?: any[];
|
|
2106
|
+
asyncValidators?: any[];
|
|
2107
|
+
readOnly?: boolean;
|
|
2108
|
+
disabled?: boolean;
|
|
2109
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2110
|
+
}
|
|
2111
|
+
interface ColorFieldConfig<TModel = unknown> {
|
|
2112
|
+
kind: FieldKind.COLOR;
|
|
2113
|
+
key: keyof TModel;
|
|
2114
|
+
label: string;
|
|
2115
|
+
/** Default color value (hex string, e.g., '#ff0000') */
|
|
2116
|
+
defaultValue?: string;
|
|
2117
|
+
/** Predefined color swatches to show */
|
|
2118
|
+
swatches?: string[];
|
|
2119
|
+
validators?: any[];
|
|
2120
|
+
asyncValidators?: any[];
|
|
2121
|
+
readOnly?: boolean;
|
|
2122
|
+
disabled?: boolean;
|
|
2123
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2124
|
+
}
|
|
2125
|
+
interface RatingFieldConfig<TModel = unknown> {
|
|
2126
|
+
kind: FieldKind.RATING;
|
|
2127
|
+
key: keyof TModel;
|
|
2128
|
+
label: string;
|
|
2129
|
+
/** Maximum rating value (default: 5) */
|
|
2130
|
+
max?: number;
|
|
2131
|
+
/** Icon to use for rating (default: 'star') */
|
|
2132
|
+
icon?: 'star' | 'heart' | 'circle';
|
|
2133
|
+
/** Allow half-star ratings (default: false) */
|
|
2134
|
+
allowHalf?: boolean;
|
|
2135
|
+
validators?: any[];
|
|
2136
|
+
asyncValidators?: any[];
|
|
2137
|
+
readOnly?: boolean;
|
|
2138
|
+
disabled?: boolean;
|
|
2139
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2140
|
+
}
|
|
2141
|
+
interface SliderFieldConfig<TModel = unknown> {
|
|
2142
|
+
kind: FieldKind.SLIDER;
|
|
2143
|
+
key: keyof TModel;
|
|
2144
|
+
label: string;
|
|
2145
|
+
/** Minimum value (default: 0) */
|
|
2146
|
+
min?: number;
|
|
2147
|
+
/** Maximum value (default: 100) */
|
|
2148
|
+
max?: number;
|
|
2149
|
+
/** Step increment (default: 1) */
|
|
2150
|
+
step?: number;
|
|
2151
|
+
/** Whether to show the current value label (default: true) */
|
|
2152
|
+
showValue?: boolean;
|
|
2153
|
+
/** Unit label displayed after the value (e.g., '%', 'px') */
|
|
2154
|
+
unit?: string;
|
|
2155
|
+
validators?: any[];
|
|
2156
|
+
asyncValidators?: any[];
|
|
2157
|
+
readOnly?: boolean;
|
|
2158
|
+
disabled?: boolean;
|
|
2159
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2160
|
+
}
|
|
2161
|
+
interface FileFieldConfig<TModel = unknown> {
|
|
2162
|
+
kind: FieldKind.FILE;
|
|
2163
|
+
key: keyof TModel;
|
|
2164
|
+
label: string;
|
|
2165
|
+
/** Accepted file types (e.g., '.pdf,.jpg,image/*') */
|
|
2166
|
+
accept?: string;
|
|
2167
|
+
/** Allow multiple file selection */
|
|
2168
|
+
multiple?: boolean;
|
|
2169
|
+
/** Maximum file size in bytes */
|
|
2170
|
+
maxSize?: number;
|
|
2171
|
+
/** Maximum number of files (when multiple is true) */
|
|
2172
|
+
maxFiles?: number;
|
|
2173
|
+
validators?: any[];
|
|
2174
|
+
asyncValidators?: any[];
|
|
2175
|
+
readOnly?: boolean;
|
|
2176
|
+
disabled?: boolean;
|
|
2177
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2178
|
+
}
|
|
2179
|
+
interface CustomFieldConfig<TModel = unknown> {
|
|
2180
|
+
kind: FieldKind.CUSTOM;
|
|
2181
|
+
key: keyof TModel;
|
|
2182
|
+
component: Type<unknown>;
|
|
2183
|
+
inputs?: ModalInputMap;
|
|
2184
|
+
label?: string;
|
|
2185
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2186
|
+
}
|
|
2187
|
+
type FormFieldConfig<TModel = unknown> = TextFieldConfig<TModel> | NumberFieldConfig<TModel> | SelectFieldConfig<TModel> | CheckboxFieldConfig<TModel> | DateFieldConfig<TModel> | TextareaFieldConfig<TModel> | DatetimeFieldConfig<TModel> | MultiSelectFieldConfig<TModel> | MultiSelectTableFieldConfig<TModel> | SingleSelectTableFieldConfig<TModel> | PasswordFieldConfig<TModel> | FileFieldConfig<TModel> | ColorFieldConfig<TModel> | RatingFieldConfig<TModel> | SliderFieldConfig<TModel> | CustomFieldConfig<TModel>;
|
|
2188
|
+
interface FormRowField<TModel = unknown> {
|
|
2189
|
+
field: FormFieldConfig<TModel>;
|
|
2190
|
+
span?: number;
|
|
2191
|
+
}
|
|
2192
|
+
interface FormRow<TModel = unknown> {
|
|
2193
|
+
columns?: number;
|
|
2194
|
+
fields: FormRowField<TModel>[];
|
|
2195
|
+
}
|
|
2196
|
+
interface FormFieldGroup<TModel = unknown> {
|
|
2197
|
+
/** Section header title */
|
|
2198
|
+
title: string;
|
|
2199
|
+
/** Optional description below the section header */
|
|
2200
|
+
description?: string;
|
|
2201
|
+
/** Fields in this group */
|
|
2202
|
+
fields: FormFieldConfig<TModel>[];
|
|
2203
|
+
/** Optional rows layout for this group */
|
|
2204
|
+
rows?: FormRow<TModel>[];
|
|
2205
|
+
/** Condition to show/hide this entire group based on form values */
|
|
2206
|
+
visible?: FieldVisibilityCondition<TModel>;
|
|
2207
|
+
}
|
|
2208
|
+
interface ConfirmationActionConfig<TResult = unknown> {
|
|
2209
|
+
label: string;
|
|
2210
|
+
style?: ActionStyle;
|
|
2211
|
+
handler?: ModalResultHandler<TResult>;
|
|
2212
|
+
}
|
|
2213
|
+
interface CancellationActionConfig {
|
|
2214
|
+
label: string;
|
|
2215
|
+
style?: ActionStyle;
|
|
2216
|
+
reason?: ModalCloseReason;
|
|
2217
|
+
}
|
|
2218
|
+
interface ModalFooterAction<TResult = unknown> {
|
|
2219
|
+
label: string;
|
|
2220
|
+
style?: ActionStyle;
|
|
2221
|
+
/** Position in the footer: 'left' or 'right' (default: 'right') */
|
|
2222
|
+
position?: 'left' | 'right';
|
|
2223
|
+
/** Whether this action closes the modal */
|
|
2224
|
+
closesModal?: boolean;
|
|
2225
|
+
/** Close reason when this action closes the modal */
|
|
2226
|
+
closeReason?: ModalCloseReason;
|
|
2227
|
+
/** Handler called when the action is clicked */
|
|
2228
|
+
handler?: (modalRef: ModalRef<TResult>) => Promise<void> | void;
|
|
2229
|
+
/** Whether the button is disabled */
|
|
2230
|
+
disabled?: boolean;
|
|
2231
|
+
}
|
|
2232
|
+
interface ModalPollingConfig<TResult = unknown> {
|
|
2233
|
+
/** Polling interval in milliseconds */
|
|
2234
|
+
interval: number;
|
|
2235
|
+
/** Function called on each poll tick */
|
|
2236
|
+
onPoll: (modalRef: ModalRef<TResult>) => Promise<boolean | void> | boolean | void;
|
|
2237
|
+
/** Whether to start polling immediately (default: true) */
|
|
2238
|
+
autoStart?: boolean;
|
|
2239
|
+
/** Maximum number of poll attempts (undefined = unlimited) */
|
|
2240
|
+
maxAttempts?: number;
|
|
2241
|
+
}
|
|
2242
|
+
interface ModalI18nLabels {
|
|
2243
|
+
/** Submit button label (default: 'Submit') */
|
|
2244
|
+
submit?: string;
|
|
2245
|
+
/** Cancel button label (default: 'Cancel') */
|
|
2246
|
+
cancel?: string;
|
|
2247
|
+
/** Next button label for wizard (default: 'Next') */
|
|
2248
|
+
next?: string;
|
|
2249
|
+
/** Back button label for wizard (default: 'Back') */
|
|
2250
|
+
back?: string;
|
|
2251
|
+
/** Close button label (default: 'Close') */
|
|
2252
|
+
close?: string;
|
|
2253
|
+
/** Complete button label for wizard (default: 'Complete') */
|
|
2254
|
+
complete?: string;
|
|
2255
|
+
/** Submitting state label (default: 'Submitting...') */
|
|
2256
|
+
submitting?: string;
|
|
2257
|
+
/** Completing state label (default: 'Completing...') */
|
|
2258
|
+
completing?: string;
|
|
2259
|
+
/** Loading label (default: 'Loading...') */
|
|
2260
|
+
loading?: string;
|
|
2261
|
+
/** Select placeholder (default: 'Select...') */
|
|
2262
|
+
selectPlaceholder?: string;
|
|
2263
|
+
/** File upload prompt (default: 'Click or drag files here') */
|
|
2264
|
+
fileUploadPrompt?: string;
|
|
2265
|
+
/** Confirm button label (default: 'Confirm') */
|
|
2266
|
+
confirm?: string;
|
|
2267
|
+
}
|
|
2268
|
+
type ModalCancelHandler<TResult = unknown> = (reason: ModalCloseReason) => Promise<void> | void;
|
|
2269
|
+
interface BaseModalConfig<TResult = unknown> {
|
|
2270
|
+
kind: ModalKind;
|
|
2271
|
+
title?: string;
|
|
2272
|
+
subtitle?: string;
|
|
2273
|
+
description?: string;
|
|
2274
|
+
size?: ModalSize;
|
|
2275
|
+
closeMode?: CloseMode;
|
|
2276
|
+
closeGuard?: () => Promise<boolean> | boolean;
|
|
2277
|
+
backdrop?: BackdropMode;
|
|
2278
|
+
keyboard?: KeyboardMode;
|
|
2279
|
+
intent?: ModalIntent;
|
|
2280
|
+
resultType?: TResult;
|
|
2281
|
+
/** Custom footer actions (overrides default footer) */
|
|
2282
|
+
footerActions?: ModalFooterAction<TResult>[];
|
|
2283
|
+
/** Polling configuration for periodic async operations */
|
|
2284
|
+
polling?: ModalPollingConfig<TResult>;
|
|
2285
|
+
/** Handler called when the modal is cancelled or dismissed */
|
|
2286
|
+
onCancel?: ModalCancelHandler<TResult>;
|
|
2287
|
+
/** i18n labels for buttons and UI text */
|
|
2288
|
+
i18n?: ModalI18nLabels;
|
|
2289
|
+
}
|
|
2290
|
+
/** Validator that receives aggregated data from all wizard steps before completion */
|
|
2291
|
+
type WizardBeforeCompleteValidator = (payload: Record<ModalStepId, Record<string, any>>) => Promise<Record<string, string> | null> | Record<string, string> | null;
|
|
2292
|
+
interface WizardModalConfig<TResult = WizardResult> extends BaseModalConfig<TResult> {
|
|
2293
|
+
kind: ModalKind.WIZARD;
|
|
2294
|
+
steps: WizardStepConfig[];
|
|
2295
|
+
startStepId?: ModalStepId;
|
|
2296
|
+
flow?: WizardFlowMode;
|
|
2297
|
+
onStepChange?: WizardStepChangeHandler;
|
|
2298
|
+
onComplete?: ModalResultHandler<TResult>;
|
|
2299
|
+
/** Cross-step validators run before wizard completion */
|
|
2300
|
+
onBeforeComplete?: WizardBeforeCompleteValidator[];
|
|
2301
|
+
}
|
|
2302
|
+
interface FormModalConfig<TModel = unknown, TResult = TModel> extends BaseModalConfig<TResult> {
|
|
2303
|
+
kind: ModalKind.FORM;
|
|
2304
|
+
fields: FormFieldConfig<TModel>[];
|
|
2305
|
+
rows?: FormRow<TModel>[];
|
|
2306
|
+
layout?: FormLayoutMode;
|
|
2307
|
+
initialValue?: Partial<TModel>;
|
|
2308
|
+
submitMode?: SubmitMode;
|
|
2309
|
+
onComplete?: ModalResultHandler<TResult>;
|
|
2310
|
+
/** Form-level validators for cross-field validation */
|
|
2311
|
+
formValidators?: FormValidator<TModel>[];
|
|
2312
|
+
/** Angular FormGroup-level validators (e.g., Validators.required on the group) */
|
|
2313
|
+
groupValidators?: any[];
|
|
2314
|
+
/** Field groups with section headers */
|
|
2315
|
+
fieldGroups?: FormFieldGroup<TModel>[];
|
|
2316
|
+
}
|
|
2317
|
+
interface ConfirmationModalConfig<TResult = boolean> extends BaseModalConfig<TResult> {
|
|
2318
|
+
kind: ModalKind.CONFIRMATION;
|
|
2319
|
+
message: string;
|
|
2320
|
+
tone?: ConfirmationTone;
|
|
2321
|
+
confirm?: ConfirmationActionConfig<TResult>;
|
|
2322
|
+
cancel?: CancellationActionConfig;
|
|
2323
|
+
}
|
|
2324
|
+
interface CustomModalConfig<TResult = unknown> extends BaseModalConfig<TResult> {
|
|
2325
|
+
kind: ModalKind.CUSTOM;
|
|
2326
|
+
component?: Type<unknown>;
|
|
2327
|
+
template?: TemplateRef<unknown>;
|
|
2328
|
+
inputs?: ModalInputMap;
|
|
2329
|
+
onComplete?: ModalResultHandler<TResult>;
|
|
2330
|
+
}
|
|
2331
|
+
type ModalConfig<TResult = any> = WizardModalConfig<TResult> | FormModalConfig<any, TResult> | ConfirmationModalConfig<TResult> | CustomModalConfig<TResult>;
|
|
2332
|
+
|
|
2333
|
+
declare class StepBuilder<TModel = any> {
|
|
2334
|
+
private config;
|
|
2335
|
+
private currentRow;
|
|
2336
|
+
private currentRowColumns;
|
|
2337
|
+
constructor(id: string, title: string);
|
|
2338
|
+
body(body: any): this;
|
|
2339
|
+
state(state: StepState): this;
|
|
2340
|
+
guard(guard: StepGuard): this;
|
|
2341
|
+
validators(validators: StepValidator[]): this;
|
|
2342
|
+
/**
|
|
2343
|
+
* Add a field to this step. This is the single API for all field types.
|
|
2344
|
+
*
|
|
2345
|
+
* @example
|
|
2346
|
+
* s.field({ kind: FieldKind.TEXT, key: 'email', label: 'Email', validators: [Validators.required] })
|
|
2347
|
+
* s.field({ kind: FieldKind.SELECT, key: 'role', label: 'Role', options: [...] })
|
|
2348
|
+
*/
|
|
2349
|
+
field(field: FormFieldConfig<TModel>): this;
|
|
2350
|
+
/**
|
|
2351
|
+
* Start a new row with the specified number of columns.
|
|
2352
|
+
* All subsequent `addToRow()` calls will add fields to this row.
|
|
2353
|
+
*/
|
|
2354
|
+
row(columns?: number): this;
|
|
2355
|
+
/**
|
|
2356
|
+
* Add a field to the current row started by `row()`.
|
|
2357
|
+
*/
|
|
2358
|
+
addToRow(field: FormFieldConfig<TModel>, span?: number): this;
|
|
2359
|
+
private flushCurrentRow;
|
|
2360
|
+
/**
|
|
2361
|
+
* Add a field group with a section header.
|
|
2362
|
+
*/
|
|
2363
|
+
fieldGroup(group: FormFieldGroup<TModel>): this;
|
|
2364
|
+
/**
|
|
2365
|
+
* Add form-level validators for cross-field validation within this step.
|
|
2366
|
+
*/
|
|
2367
|
+
formValidators(validators: FormValidator<TModel>[]): this;
|
|
2368
|
+
/**
|
|
2369
|
+
* Add Angular FormGroup-level validators for this step.
|
|
2370
|
+
*/
|
|
2371
|
+
groupValidators(validators: any[]): this;
|
|
2372
|
+
/**
|
|
2373
|
+
* Set initial values for fields in this step.
|
|
2374
|
+
*/
|
|
2375
|
+
initialValue(value: Partial<TModel>): this;
|
|
2376
|
+
/**
|
|
2377
|
+
* Set a visibility condition for this step based on aggregated wizard data.
|
|
2378
|
+
*/
|
|
2379
|
+
visible(condition: (aggregatedData: Record<ModalStepId, Record<string, any>>) => boolean): this;
|
|
2380
|
+
build(): WizardStepConfig<TModel>;
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
declare abstract class BaseModalBuilder<TConfig extends BaseModalConfig<TResult>, TResult = unknown> {
|
|
2384
|
+
protected config: TConfig;
|
|
2385
|
+
protected constructor(initialConfig: TConfig);
|
|
2386
|
+
title(title: string): this;
|
|
2387
|
+
subtitle(subtitle: string): this;
|
|
2388
|
+
description(description: string): this;
|
|
2389
|
+
closeGuard(guard: () => Promise<boolean> | boolean): this;
|
|
2390
|
+
size(size: ModalSize): this;
|
|
2391
|
+
closeMode(mode: CloseMode): this;
|
|
2392
|
+
backdrop(mode: BackdropMode): this;
|
|
2393
|
+
keyboard(mode: KeyboardMode): this;
|
|
2394
|
+
intent(intent: ModalIntent): this;
|
|
2395
|
+
footerActions(actions: ModalFooterAction<TResult>[]): this;
|
|
2396
|
+
polling(config: ModalPollingConfig<TResult>): this;
|
|
2397
|
+
onCancel(handler: ModalCancelHandler<TResult>): this;
|
|
2398
|
+
i18n(labels: ModalI18nLabels): this;
|
|
2399
|
+
build(): Readonly<TConfig>;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
declare class WizardModalBuilder extends BaseModalBuilder<WizardModalConfig, WizardResult> {
|
|
2403
|
+
constructor();
|
|
2404
|
+
step(step: WizardStepConfig | ((builder: StepBuilder) => void)): this;
|
|
2405
|
+
addStep(title: string, buildFn: (builder: StepBuilder) => void, id?: ModalStepId): this;
|
|
2406
|
+
startAt(stepId: ModalStepId): this;
|
|
2407
|
+
flow(mode: WizardFlowMode): this;
|
|
2408
|
+
onStepChange(handler: WizardStepChangeHandler): this;
|
|
2409
|
+
onComplete(handler: ModalResultHandler<WizardResult>): this;
|
|
2410
|
+
onBeforeComplete(validators: WizardBeforeCompleteValidator[]): this;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
declare class FormModalBuilder<TModel = unknown, TResult = TModel> extends BaseModalBuilder<FormModalConfig<TModel, TResult>, TResult> {
|
|
2414
|
+
private currentRow;
|
|
2415
|
+
private currentRowColumns;
|
|
2416
|
+
constructor();
|
|
2417
|
+
/**
|
|
2418
|
+
* Add a field as a full-width row (single column).
|
|
2419
|
+
* This is the simple API — each field gets its own row.
|
|
2420
|
+
*/
|
|
2421
|
+
field(field: FormFieldConfig<TModel>): this;
|
|
2422
|
+
/**
|
|
2423
|
+
* Start a new row with the specified number of columns.
|
|
2424
|
+
* All subsequent `addToRow()` calls will add fields to this row
|
|
2425
|
+
* until the next `row()` or `field()` call.
|
|
2426
|
+
*
|
|
2427
|
+
* @example
|
|
2428
|
+
* .row(2)
|
|
2429
|
+
* .addToRow({ kind: FieldKind.TEXT, key: 'firstName', label: 'First Name' })
|
|
2430
|
+
* .addToRow({ kind: FieldKind.TEXT, key: 'lastName', label: 'Last Name' })
|
|
2431
|
+
* .row(3)
|
|
2432
|
+
* .addToRow({ kind: FieldKind.TEXT, key: 'city', label: 'City' }, 2)
|
|
2433
|
+
* .addToRow({ kind: FieldKind.TEXT, key: 'zip', label: 'ZIP' })
|
|
2434
|
+
*/
|
|
2435
|
+
row(columns?: number): this;
|
|
2436
|
+
/**
|
|
2437
|
+
* Add a field to the current row started by `row()`.
|
|
2438
|
+
* @param field - The field configuration
|
|
2439
|
+
* @param span - How many columns this field should span (default: 1)
|
|
2440
|
+
*/
|
|
2441
|
+
addToRow(field: FormFieldConfig<TModel>, span?: number): this;
|
|
2442
|
+
private flushCurrentRow;
|
|
2443
|
+
layout(mode: FormLayoutMode): this;
|
|
2444
|
+
initialValue(value: Partial<TModel>): this;
|
|
2445
|
+
submitMode(mode: SubmitMode): this;
|
|
2446
|
+
onComplete(handler: ModalResultHandler<TResult>): this;
|
|
2447
|
+
/**
|
|
2448
|
+
* Add form-level validators for cross-field validation.
|
|
2449
|
+
* These receive the entire form value and return an error map or null.
|
|
2450
|
+
*/
|
|
2451
|
+
formValidators(validators: FormValidator<TModel>[]): this;
|
|
2452
|
+
/**
|
|
2453
|
+
* Add Angular FormGroup-level validators.
|
|
2454
|
+
* These are standard Angular ValidatorFn applied to the FormGroup itself.
|
|
2455
|
+
*/
|
|
2456
|
+
groupValidators(validators: any[]): this;
|
|
2457
|
+
/**
|
|
2458
|
+
* Add a field group with a section header.
|
|
2459
|
+
* Groups visually separate fields with a title and optional description.
|
|
2460
|
+
*/
|
|
2461
|
+
fieldGroup(group: FormFieldGroup<TModel>): this;
|
|
2462
|
+
build(): Readonly<FormModalConfig<TModel, TResult>>;
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
declare class ConfirmationModalBuilder<TResult = boolean> extends BaseModalBuilder<ConfirmationModalConfig<TResult>, TResult> {
|
|
2466
|
+
constructor();
|
|
2467
|
+
message(text: string): this;
|
|
2468
|
+
tone(tone: ConfirmationTone): this;
|
|
2469
|
+
confirmAction(action: ConfirmationActionConfig<TResult>): this;
|
|
2470
|
+
cancelAction(action: CancellationActionConfig): this;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
declare class CustomModalBuilder<TResult = unknown> extends BaseModalBuilder<CustomModalConfig<TResult>, TResult> {
|
|
2474
|
+
constructor();
|
|
2475
|
+
component(component: Type<unknown>): this;
|
|
2476
|
+
template(template: TemplateRef<unknown>): this;
|
|
2477
|
+
inputs(inputs: ModalInputMap): this;
|
|
2478
|
+
onComplete(handler: ModalResultHandler<TResult>): this;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
declare class ModalBuilder {
|
|
2482
|
+
static wizard(): WizardModalBuilder;
|
|
2483
|
+
static form<TModel = unknown, TResult = TModel>(): FormModalBuilder<TModel, TResult>;
|
|
2484
|
+
static confirmation<TResult = boolean>(): ConfirmationModalBuilder<TResult>;
|
|
2485
|
+
static custom<TResult = unknown>(): CustomModalBuilder<TResult>;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
declare class MnModalRef<TResult = any> implements ModalRef<TResult> {
|
|
2489
|
+
private componentRef;
|
|
2490
|
+
private config;
|
|
2491
|
+
private readonly closeSubject;
|
|
2492
|
+
readonly afterClosed$: Observable<ModalCloseEvent<TResult>>;
|
|
2493
|
+
constructor(componentRef: ComponentRef<any>, config: BaseModalConfig<TResult>);
|
|
2494
|
+
close(result?: TResult): void;
|
|
2495
|
+
dismiss(reason: ModalCloseReason): void;
|
|
2496
|
+
private animateAndDestroy;
|
|
2497
|
+
update(config: Partial<BaseModalConfig<TResult>>): void;
|
|
2498
|
+
private destroy;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
declare class MnModalService {
|
|
2502
|
+
private readonly appRef;
|
|
2503
|
+
private readonly injector;
|
|
2504
|
+
open<TResult = any>(config: ModalConfig<TResult>): MnModalRef<TResult>;
|
|
2505
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnModalService, never>;
|
|
2506
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MnModalService>;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
declare class MnModalShellComponent<TResult = any> implements OnInit, AfterViewInit, OnDestroy {
|
|
2510
|
+
private el;
|
|
2511
|
+
config: ModalConfig<TResult>;
|
|
2512
|
+
modalRef: MnModalRef<TResult>;
|
|
2513
|
+
isClosing: boolean;
|
|
2514
|
+
readonly ModalKind: typeof ModalKind;
|
|
2515
|
+
private previouslyFocusedElement;
|
|
2516
|
+
private focusTrapListener;
|
|
2517
|
+
private pollingTimer;
|
|
2518
|
+
private pollAttempts;
|
|
2519
|
+
constructor(el: ElementRef<HTMLElement>);
|
|
2520
|
+
ngOnInit(): void;
|
|
2521
|
+
ngAfterViewInit(): void;
|
|
2522
|
+
ngOnDestroy(): void;
|
|
2523
|
+
private setupFocusTrap;
|
|
2524
|
+
private removeFocusTrap;
|
|
2525
|
+
asWizard(config: any): any;
|
|
2526
|
+
asForm(config: any): any;
|
|
2527
|
+
asConfirmation(config: any): any;
|
|
2528
|
+
asCustom(config: any): any;
|
|
2529
|
+
asAny(val: any): any;
|
|
2530
|
+
get hostClasses(): string;
|
|
2531
|
+
startClosing(): Promise<void>;
|
|
2532
|
+
onEscapeKey(event: any): void;
|
|
2533
|
+
onBackdropClick(): void;
|
|
2534
|
+
onCloseButtonClick(): void;
|
|
2535
|
+
private handleClose;
|
|
2536
|
+
get showBackdrop(): boolean;
|
|
2537
|
+
get containerSizeClass(): string;
|
|
2538
|
+
get showCloseButton(): boolean;
|
|
2539
|
+
get hasCustomFooterActions(): boolean;
|
|
2540
|
+
get leftFooterActions(): ModalFooterAction<TResult>[];
|
|
2541
|
+
get rightFooterActions(): ModalFooterAction<TResult>[];
|
|
2542
|
+
onFooterAction(action: ModalFooterAction<TResult>): Promise<void>;
|
|
2543
|
+
getActionButtonColor(style?: ActionStyle): 'primary' | 'secondary' | 'danger' | 'warning' | 'success';
|
|
2544
|
+
getActionButtonVariant(style?: ActionStyle): 'fill' | 'outline' | 'text';
|
|
2545
|
+
private startPollingIfConfigured;
|
|
2546
|
+
private startPolling;
|
|
2547
|
+
private stopPolling;
|
|
2548
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnModalShellComponent<any>, never>;
|
|
2549
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnModalShellComponent<any>, "mn-modal-shell", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; }, {}, never, never, true, never>;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
declare class MnFormBodyComponent<TModel = any, TResult = TModel> implements OnInit, OnDestroy {
|
|
2553
|
+
private fb;
|
|
2554
|
+
config: FormModalConfig<TModel, TResult>;
|
|
2555
|
+
modalRef: MnModalRef<TResult>;
|
|
2556
|
+
hideFooter: boolean;
|
|
2557
|
+
form: FormGroup;
|
|
2558
|
+
rows: FormRow<TModel>[];
|
|
2559
|
+
fieldGroups: FormFieldGroup<TModel>[];
|
|
2560
|
+
isSubmitting: boolean;
|
|
2561
|
+
readonly FieldKind: typeof FieldKind;
|
|
2562
|
+
readonly ModalCloseReason: typeof ModalCloseReason;
|
|
2563
|
+
/** Cross-field validation errors: { fieldKey: errorMessage } */
|
|
2564
|
+
formErrors: Record<string, string>;
|
|
2565
|
+
/** Track which fields are currently visible (for conditional fields) */
|
|
2566
|
+
fieldVisibility: Record<string, boolean>;
|
|
2567
|
+
/** Track loading state per field for async data sources */
|
|
2568
|
+
fieldLoading: Record<string, boolean>;
|
|
2569
|
+
/** Dynamic options loaded from data sources */
|
|
2570
|
+
fieldOptions: Record<string, SelectOption[]>;
|
|
2571
|
+
private valueChangesSubscription?;
|
|
2572
|
+
constructor(fb: FormBuilder);
|
|
2573
|
+
asField(field: any): any;
|
|
2574
|
+
asKey(key: any): string;
|
|
2575
|
+
asAny(val: any): any;
|
|
2576
|
+
hasRequiredValidator(field: any): boolean;
|
|
2577
|
+
/** Store table data sources keyed by field key for template access */
|
|
2578
|
+
tableDataSources: Record<string, any>;
|
|
2579
|
+
/** Resolved i18n labels with defaults */
|
|
2580
|
+
get labels(): {
|
|
2581
|
+
submit: any;
|
|
2582
|
+
cancel: any;
|
|
2583
|
+
submitting: any;
|
|
2584
|
+
selectPlaceholder: any;
|
|
2585
|
+
loading: any;
|
|
2586
|
+
fileUploadPrompt: any;
|
|
2587
|
+
};
|
|
2588
|
+
ngOnInit(): void;
|
|
2589
|
+
ngOnDestroy(): void;
|
|
2590
|
+
private initializeForm;
|
|
2591
|
+
isFieldReadOnly(field: FormFieldConfig<TModel>): boolean;
|
|
2592
|
+
isFieldDisabled(field: FormFieldConfig<TModel>): boolean;
|
|
2593
|
+
/** Track which field groups are currently visible */
|
|
2594
|
+
groupVisibility: Record<string, boolean>;
|
|
2595
|
+
private buildRows;
|
|
2596
|
+
private initializeGroupVisibility;
|
|
2597
|
+
private updateGroupVisibility;
|
|
2598
|
+
isGroupVisible(group: FormFieldGroup<TModel>): boolean;
|
|
2599
|
+
private initializeVisibility;
|
|
2600
|
+
private updateVisibility;
|
|
2601
|
+
isFieldVisible(field: FormFieldConfig<TModel>): boolean;
|
|
2602
|
+
private runFormValidators;
|
|
2603
|
+
getFieldError(key: string): string | null;
|
|
2604
|
+
get hasFormErrors(): boolean;
|
|
2605
|
+
private initializeDataSources;
|
|
2606
|
+
private loadFieldOptions;
|
|
2607
|
+
/** Get options for a field — uses dataSource options if available, otherwise static options */
|
|
2608
|
+
getFieldOptions(field: FormFieldConfig<TModel>): SelectOption[];
|
|
2609
|
+
isFieldLoading(key: string): boolean;
|
|
2610
|
+
private initializeTableFields;
|
|
2611
|
+
onTableSelectionChange(field: FormFieldConfig<TModel>, selectedRows: any[]): void;
|
|
2612
|
+
getRatingRange(field: FormFieldConfig<TModel>): number[];
|
|
2613
|
+
setRating(field: FormFieldConfig<TModel>, value: number): void;
|
|
2614
|
+
getRatingValue(field: FormFieldConfig<TModel>): number;
|
|
2615
|
+
onSliderChange(field: FormFieldConfig<TModel>, event: Event): void;
|
|
2616
|
+
getSliderValue(field: FormFieldConfig<TModel>): number;
|
|
2617
|
+
onColorChange(field: FormFieldConfig<TModel>, event: Event): void;
|
|
2618
|
+
setColorFromSwatch(field: FormFieldConfig<TModel>, color: string): void;
|
|
2619
|
+
getColorValue(field: FormFieldConfig<TModel>): string;
|
|
2620
|
+
private subscribeToValueChanges;
|
|
2621
|
+
private previousFormValue;
|
|
2622
|
+
private reloadDependentDataSources;
|
|
2623
|
+
getGridColumns(row: FormRow<TModel>): string;
|
|
2624
|
+
getGridSpan(rowField: FormRowField<TModel>): string;
|
|
2625
|
+
/** Store selected files keyed by field key */
|
|
2626
|
+
fileSelections: Record<string, File[]>;
|
|
2627
|
+
onFileChange(field: FormFieldConfig<TModel>, event: Event): void;
|
|
2628
|
+
removeFile(key: string, index: number): void;
|
|
2629
|
+
getSelectedFiles(key: string): File[];
|
|
2630
|
+
formatFileSize(bytes: number): string;
|
|
2631
|
+
getFileError(field: FormFieldConfig<TModel>): string;
|
|
2632
|
+
submit(): Promise<void>;
|
|
2633
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnFormBodyComponent<any, any>, never>;
|
|
2634
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnFormBodyComponent<any, any>, "mn-form-body", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; "hideFooter": { "alias": "hideFooter"; "required": false; }; }, {}, never, never, true, never>;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
declare class MnWizardBodyComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
2638
|
+
private cdr;
|
|
2639
|
+
config: WizardModalConfig;
|
|
2640
|
+
modalRef: MnModalRef<WizardResult>;
|
|
2641
|
+
formBodies: QueryList<MnFormBodyComponent>;
|
|
2642
|
+
currentStepId: ModalStepId;
|
|
2643
|
+
visitedStepIds: ModalStepId[];
|
|
2644
|
+
isCurrentStepValid: boolean;
|
|
2645
|
+
isCompleting: boolean;
|
|
2646
|
+
wizardErrors: Record<string, string>;
|
|
2647
|
+
/** Resolved i18n labels with defaults */
|
|
2648
|
+
get labels(): {
|
|
2649
|
+
next: any;
|
|
2650
|
+
back: any;
|
|
2651
|
+
close: any;
|
|
2652
|
+
complete: any;
|
|
2653
|
+
completing: any;
|
|
2654
|
+
};
|
|
2655
|
+
/** Pre-built form configs keyed by step id — only for steps that have fields */
|
|
2656
|
+
stepFormConfigs: Record<ModalStepId, FormModalConfig<any, any>>;
|
|
2657
|
+
private statusSubscription?;
|
|
2658
|
+
private formBodiesSubscription?;
|
|
2659
|
+
constructor(cdr: ChangeDetectorRef);
|
|
2660
|
+
ngOnInit(): void;
|
|
2661
|
+
ngAfterViewInit(): void;
|
|
2662
|
+
ngOnDestroy(): void;
|
|
2663
|
+
asAny(val: any): any;
|
|
2664
|
+
isTextBody(step: WizardStepConfig): boolean;
|
|
2665
|
+
/** Get visible steps (filtered by visibility condition) */
|
|
2666
|
+
get visibleSteps(): WizardStepConfig[];
|
|
2667
|
+
isStepVisible(step: WizardStepConfig): boolean;
|
|
2668
|
+
get currentStep(): WizardStepConfig<any> | undefined;
|
|
2669
|
+
get currentVisibleIndex(): number;
|
|
2670
|
+
get currentStepIndex(): number;
|
|
2671
|
+
get canGoBack(): boolean;
|
|
2672
|
+
get canGoNext(): boolean;
|
|
2673
|
+
get isLastStep(): boolean;
|
|
2674
|
+
get isFreeFlow(): boolean;
|
|
2675
|
+
canNavigateToStep(step: WizardStepConfig): boolean;
|
|
2676
|
+
goToStep(step: WizardStepConfig): Promise<void>;
|
|
2677
|
+
/** Find the MnFormBodyComponent for the current step */
|
|
2678
|
+
private getCurrentFormBody;
|
|
2679
|
+
private trackCurrentStepValidity;
|
|
2680
|
+
next(): Promise<void>;
|
|
2681
|
+
back(): Promise<void>;
|
|
2682
|
+
complete(): Promise<void>;
|
|
2683
|
+
/** Collect form data from all form-driven steps, namespaced by step ID */
|
|
2684
|
+
private getAggregatedData;
|
|
2685
|
+
private notifyStepChange;
|
|
2686
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnWizardBodyComponent, never>;
|
|
2687
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnWizardBodyComponent, "mn-wizard-body", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; }, {}, never, never, true, never>;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
declare class MnConfirmationBodyComponent<TResult = boolean> {
|
|
2691
|
+
config: ConfirmationModalConfig<TResult>;
|
|
2692
|
+
modalRef: MnModalRef<TResult>;
|
|
2693
|
+
confirm(): Promise<void>;
|
|
2694
|
+
cancel(): void;
|
|
2695
|
+
get confirmLabel(): string;
|
|
2696
|
+
get cancelLabel(): string;
|
|
2697
|
+
get confirmStyle(): ActionStyle;
|
|
2698
|
+
get cancelStyle(): ActionStyle;
|
|
2699
|
+
get toneClass(): string;
|
|
2700
|
+
getButtonColor(style: ActionStyle): 'primary' | 'secondary' | 'danger' | 'warning' | 'success';
|
|
2701
|
+
getButtonVariant(style: ActionStyle): 'fill' | 'outline' | 'text';
|
|
2702
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnConfirmationBodyComponent<any>, never>;
|
|
2703
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnConfirmationBodyComponent<any>, "mn-confirmation-body", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; }, {}, never, never, true, never>;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
declare class MnCustomBodyHostComponent implements OnInit {
|
|
2707
|
+
config: CustomModalConfig;
|
|
2708
|
+
modalRef: MnModalRef<unknown>;
|
|
2709
|
+
container: ViewContainerRef;
|
|
2710
|
+
private componentRef?;
|
|
2711
|
+
ngOnInit(): void;
|
|
2712
|
+
private loadContent;
|
|
2713
|
+
attachComponent(component: any): void;
|
|
2714
|
+
attachTemplate(template: TemplateRef<unknown>): void;
|
|
2715
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnCustomBodyHostComponent, never>;
|
|
2716
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnCustomBodyHostComponent, "mn-custom-body-host", never, { "config": { "alias": "config"; "required": false; }; "modalRef": { "alias": "modalRef"; "required": false; }; }, {}, never, never, true, never>;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
declare class MnTable<T = any> implements OnInit, OnDestroy {
|
|
2720
|
+
dataSource: TableDataSource<T>;
|
|
2721
|
+
sortChange: EventEmitter<SortState | null>;
|
|
2722
|
+
selectionChange: EventEmitter<T[]>;
|
|
2723
|
+
rowClick: EventEmitter<T>;
|
|
2724
|
+
filteredItems: T[];
|
|
2725
|
+
searchValue: string;
|
|
2726
|
+
loadingMoreRows: boolean;
|
|
2727
|
+
currentSort: SortState | null;
|
|
2728
|
+
selectedIds: Set<string>;
|
|
2729
|
+
private dataSubscription?;
|
|
2730
|
+
private searchSubject;
|
|
2731
|
+
private searchSubscription?;
|
|
2732
|
+
ngOnInit(): void;
|
|
2733
|
+
ngOnDestroy(): void;
|
|
2734
|
+
onSearch(searchString: string): void;
|
|
2735
|
+
sort(column: ColumnDefinition<T>): void;
|
|
2736
|
+
getSortIcon(column: ColumnDefinition<T>): string;
|
|
2737
|
+
isSortable(column: ColumnDefinition<T>): boolean;
|
|
2738
|
+
isSelected(row: T): boolean;
|
|
2739
|
+
toggleRow(row: T): void;
|
|
2740
|
+
toggleAll(): void;
|
|
2741
|
+
get allSelected(): boolean;
|
|
2742
|
+
get hasSelection(): boolean;
|
|
2743
|
+
get isMultiSelect(): boolean;
|
|
2744
|
+
onRowClick(row: T): void;
|
|
2745
|
+
loadMoreRows(): void;
|
|
2746
|
+
get showLoadMore(): boolean;
|
|
2747
|
+
isTemplateRef(value: any): value is TemplateRef<any>;
|
|
2748
|
+
getCellValue(column: ColumnDefinition<T>, row: T): string;
|
|
2749
|
+
trackByID: (_index: number, row: T) => string;
|
|
2750
|
+
trackByKey: (_index: number, column: ColumnDefinition<T>) => string;
|
|
2751
|
+
get tableClasses(): string;
|
|
2752
|
+
get hasRowActions(): boolean;
|
|
2753
|
+
getVisibleActions(row: T): mn_angular_lib.TableRowAction<T>[];
|
|
2754
|
+
get totalColumnCount(): number;
|
|
2755
|
+
get skeletonRows(): number[];
|
|
2756
|
+
private applyFilterAndSort;
|
|
2757
|
+
private applySorting;
|
|
2758
|
+
private processLoadedRows;
|
|
2759
|
+
private emitSelection;
|
|
2760
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnTable<any>, never>;
|
|
2761
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnTable<any>, "mn-table", never, { "dataSource": { "alias": "dataSource"; "required": false; }; }, { "sortChange": "sortChange"; "selectionChange": "selectionChange"; "rowClick": "rowClick"; }, never, never, true, never>;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* Types for mn-lib configuration.
|
|
2766
|
+
*/
|
|
2767
|
+
interface MnConfigFile {
|
|
2768
|
+
/**
|
|
2769
|
+
* Base defaults by component name. Each value is a plain object with inputs/options for that component.
|
|
2770
|
+
*/
|
|
2771
|
+
defaults: Record<string, unknown>;
|
|
2772
|
+
/**
|
|
2773
|
+
* Nested object tree keyed by section names. Leaf nodes may contain
|
|
2774
|
+
* component-name keys (component override objects) and keys starting with '#'
|
|
2775
|
+
* representing instance-id overrides.
|
|
2776
|
+
*/
|
|
2777
|
+
overrides: unknown;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
declare class MnConfigService {
|
|
2781
|
+
private readonly http;
|
|
2782
|
+
private _config;
|
|
2783
|
+
private _debugMode;
|
|
2784
|
+
private readonly lang;
|
|
2785
|
+
constructor(http: HttpClient);
|
|
2786
|
+
/**
|
|
2787
|
+
* Load the configuration JSON from the provided URL and cache it in memory.
|
|
2788
|
+
* Consumers should typically call this via the APP_INITIALIZER helper.
|
|
2789
|
+
*/
|
|
2790
|
+
load(url: string, debugMode?: boolean): Promise<void>;
|
|
2791
|
+
/**
|
|
2792
|
+
* Resolve a configuration object for a component, optionally scoped to a section path
|
|
2793
|
+
* and optionally overridden by an instance id.
|
|
2794
|
+
*/
|
|
2795
|
+
resolve<T extends object = any>(componentName: string, sectionPath?: string[], instanceId?: string): T;
|
|
2796
|
+
/**
|
|
2797
|
+
* Walk the overrides nested object using the provided section path and return the leaf node.
|
|
2798
|
+
* If any segment is missing or the current node is not a plain object, returns undefined.
|
|
2799
|
+
*/
|
|
2800
|
+
walkOverrides(overridesRoot: unknown, sectionPath: string[]): unknown | undefined;
|
|
2801
|
+
/**
|
|
2802
|
+
* Recursively walk a resolved config object and replace any `{ $translate: "key" }` markers
|
|
2803
|
+
* with their translated values from MnLanguageService.
|
|
2804
|
+
*/
|
|
2805
|
+
private resolveTranslatables;
|
|
2806
|
+
/**
|
|
2807
|
+
* Deep merge two plain-object trees. Arrays and non-plain values are replaced by the patch.
|
|
2808
|
+
* Does not mutate inputs; returns a new object.
|
|
2809
|
+
*/
|
|
2810
|
+
deepMerge<A extends Record<string, any>, B extends Record<string, any>>(base: A, patch: B): A & B;
|
|
2811
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnConfigService, never>;
|
|
2812
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MnConfigService>;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
/**
|
|
2816
|
+
* Provides an APP_INITIALIZER that loads the mn-lib configuration from the given URL
|
|
2817
|
+
* during application bootstrap. The consuming application is responsible for providing
|
|
2818
|
+
* HttpClient (e.g., via HttpClientModule or provideHttpClient()).
|
|
2819
|
+
*/
|
|
2820
|
+
declare function provideMnConfig(url: string, debugMode?: boolean): Provider[];
|
|
2821
|
+
|
|
2822
|
+
/**
|
|
2823
|
+
* Helper to provide a resolved, typed component config via DI.
|
|
2824
|
+
*
|
|
2825
|
+
* Usage in a component/module providers:
|
|
2826
|
+
* const MY_CFG = new InjectionToken<MyCfg>('MY_CFG');
|
|
2827
|
+
* providers: [ provideMnComponentConfig(MY_CFG, 'my-component') ]
|
|
2828
|
+
* Then in the component:
|
|
2829
|
+
* readonly cfg = inject(MY_CFG)
|
|
2830
|
+
*/
|
|
2831
|
+
declare function provideMnComponentConfig<T extends object>(token: InjectionToken<T>, componentName: string, initial?: Partial<T>): Provider;
|
|
2832
|
+
|
|
2833
|
+
/**
|
|
2834
|
+
* Represents the current section path based on nested mn-section directives.
|
|
2835
|
+
*/
|
|
2836
|
+
declare const MN_SECTION_PATH: InjectionToken<string[]>;
|
|
2837
|
+
/**
|
|
2838
|
+
* Represents the current component instance id provided by [mn-instance].
|
|
2839
|
+
*/
|
|
2840
|
+
declare const MN_INSTANCE_ID: InjectionToken<string | null>;
|
|
2841
|
+
|
|
2842
|
+
declare class MnSectionDirective {
|
|
2843
|
+
/** Section name contributed by this DOM node to the section path */
|
|
2844
|
+
mnSection: string | undefined;
|
|
2845
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnSectionDirective, never>;
|
|
2846
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnSectionDirective, "[mn-section]", never, { "mnSection": { "alias": "mn-section"; "required": false; }; }, {}, never, never, true, never>;
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
declare class MnInstanceDirective {
|
|
2850
|
+
/** Instance id for targeting per-component instance overrides */
|
|
2851
|
+
mnInstance: string | undefined;
|
|
2852
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnInstanceDirective, never>;
|
|
2853
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MnInstanceDirective, "[mn-instance]", never, { "mnInstance": { "alias": "mn-instance"; "required": false; }; }, {}, never, never, true, never>;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* A structured representation of an API error.
|
|
2858
|
+
*
|
|
2859
|
+
* Captures all relevant details — status, message, validation errors,
|
|
2860
|
+
* and retry information — so consumers can log, display, or act on
|
|
2861
|
+
* failures without inspecting the raw HTTP response.
|
|
2862
|
+
*/
|
|
2863
|
+
interface ApiError {
|
|
2864
|
+
status: HttpStatusCode | null;
|
|
2865
|
+
message: string;
|
|
2866
|
+
details?: unknown;
|
|
2867
|
+
backendMessage?: string;
|
|
2868
|
+
validationErrors?: Record<string, string[]>;
|
|
2869
|
+
url?: string | null;
|
|
2870
|
+
headers?: HttpHeaders;
|
|
2871
|
+
original: HttpErrorResponse | Error;
|
|
2872
|
+
retryable: boolean;
|
|
2873
|
+
timestamp: string;
|
|
2874
|
+
}
|
|
2875
|
+
/**
|
|
2876
|
+
* Metadata associated with an API result.
|
|
2877
|
+
*
|
|
2878
|
+
* Attached to both `SuccessResult` and `FailureResult` to provide
|
|
2879
|
+
* transport-level details such as the HTTP status code, response
|
|
2880
|
+
* headers, and the final URL after any redirects.
|
|
2881
|
+
*/
|
|
2882
|
+
interface ResultMeta {
|
|
2883
|
+
statusCode?: number;
|
|
2884
|
+
headers?: HttpHeaders;
|
|
2885
|
+
url?: string;
|
|
2886
|
+
}
|
|
2887
|
+
/**
|
|
2888
|
+
* Represents a successful API result containing the response data.
|
|
2889
|
+
*
|
|
2890
|
+
* Discriminated by `ok: true`. Use `result.ok` to narrow the union
|
|
2891
|
+
* before accessing `data`.
|
|
2892
|
+
*
|
|
2893
|
+
* @template T The type of the response data.
|
|
2894
|
+
*/
|
|
2895
|
+
interface SuccessResult<T> {
|
|
2896
|
+
ok: true;
|
|
2897
|
+
data: T;
|
|
2898
|
+
meta?: ResultMeta;
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Represents a failed API result containing the structured error.
|
|
2902
|
+
*
|
|
2903
|
+
* Discriminated by `ok: false`. Use `result.ok` to narrow the union
|
|
2904
|
+
* before accessing `error`.
|
|
2905
|
+
*/
|
|
2906
|
+
interface FailureResult {
|
|
2907
|
+
ok: false;
|
|
2908
|
+
error: ApiError;
|
|
2909
|
+
meta?: ResultMeta;
|
|
2910
|
+
}
|
|
2911
|
+
/**
|
|
2912
|
+
* A discriminated union representing either a successful or failed API result.
|
|
2913
|
+
*
|
|
2914
|
+
* Discriminated by `ok`. Use `result.ok` to narrow the type
|
|
2915
|
+
* before accessing `data` or `error`.
|
|
2916
|
+
*
|
|
2917
|
+
* @template T The type of the response data on success.
|
|
2918
|
+
*/
|
|
2919
|
+
type Result<T> = SuccessResult<T> | FailureResult;
|
|
2920
|
+
/**
|
|
2921
|
+
* A JavaScript primitive value.
|
|
2922
|
+
*
|
|
2923
|
+
* Used as the building block for query parameter values.
|
|
2924
|
+
*/
|
|
2925
|
+
type Primitive = string | number | boolean | null | undefined;
|
|
2926
|
+
/**
|
|
2927
|
+
* A value that can be used as a query parameter.
|
|
2928
|
+
*
|
|
2929
|
+
* Either a single primitive or an array of primitives.
|
|
2930
|
+
* Array values are appended as multiple entries for the same key.
|
|
2931
|
+
*/
|
|
2932
|
+
type QueryValue = Primitive | Primitive[];
|
|
2933
|
+
/**
|
|
2934
|
+
* A record of query parameter key-value pairs.
|
|
2935
|
+
*
|
|
2936
|
+
* Passed to CRUD service methods and converted to `HttpParams`
|
|
2937
|
+
* before the request is sent. `null` and `undefined` values
|
|
2938
|
+
* are silently skipped during conversion.
|
|
2939
|
+
*/
|
|
2940
|
+
type QueryParams = Record<string, QueryValue>;
|
|
2941
|
+
|
|
2942
|
+
/**
|
|
2943
|
+
* Configuration for a CRUD service endpoint.
|
|
2944
|
+
*
|
|
2945
|
+
* Passed to the `CrudService` constructor to define which API
|
|
2946
|
+
* resource the service operates on.
|
|
2947
|
+
*/
|
|
2948
|
+
interface CrudConfig {
|
|
2949
|
+
endpoint: string;
|
|
2950
|
+
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Abstract base class for CRUD services.
|
|
2953
|
+
* Provides standard HTTP operations with typed `Result<T>` responses.
|
|
2954
|
+
*
|
|
2955
|
+
* @template TEntity The entity type returned by single-item operations.
|
|
2956
|
+
* @template TListResponse The response type for list operations (defaults to `TEntity[]`).
|
|
2957
|
+
* @template TCreatePayload The payload type for create operations (defaults to `Partial<TEntity>`).
|
|
2958
|
+
* @template TUpdatePayload The payload type for update operations (defaults to `Partial<TEntity>`).
|
|
2959
|
+
* @template TId The type of the entity identifier (defaults to `number`).
|
|
2960
|
+
* @template TGetByIdResponse The response type for getById (defaults to `TEntity`).
|
|
2961
|
+
* @template TCreateResponse The response type for create (defaults to `TEntity`).
|
|
2962
|
+
* @template TUpdateResponse The response type for update and patch (defaults to `TEntity`).
|
|
2963
|
+
* @template TDeleteResponse The response type for delete (defaults to `void`).
|
|
2964
|
+
*/
|
|
2965
|
+
declare abstract class CrudService<TEntity, TListResponse = TEntity[], TCreatePayload = Partial<TEntity>, TUpdatePayload = Partial<TEntity>, TId extends string | number = number, TGetByIdResponse = TEntity, TCreateResponse = TEntity, TUpdateResponse = TEntity, TDeleteResponse = void> {
|
|
2966
|
+
protected readonly http: HttpClient;
|
|
2967
|
+
protected readonly baseUrl: string;
|
|
2968
|
+
protected readonly endpoint: string;
|
|
2969
|
+
protected constructor(config: CrudConfig);
|
|
2970
|
+
/**
|
|
2971
|
+
* Retrieves all entities from the configured endpoint.
|
|
2972
|
+
*
|
|
2973
|
+
* Sends a GET request to the base endpoint. Query values are
|
|
2974
|
+
* converted to `HttpParams` before the request is sent.
|
|
2975
|
+
*
|
|
2976
|
+
* @param query Optional query parameters appended to the request URL.
|
|
2977
|
+
* @returns An observable emitting a `Result` with the list response or a structured failure.
|
|
2978
|
+
*/
|
|
2979
|
+
getAll(query?: QueryParams): Observable<Result<TListResponse>>;
|
|
2980
|
+
/**
|
|
2981
|
+
* Retrieves a single entity by its identifier.
|
|
2982
|
+
*
|
|
2983
|
+
* Sends a GET request to `{endpoint}/{id}`.
|
|
2984
|
+
*
|
|
2985
|
+
* @param id The unique identifier of the entity to retrieve.
|
|
2986
|
+
* @returns An observable emitting a `Result` with the entity or a structured failure.
|
|
2987
|
+
*/
|
|
2988
|
+
getById(id: TId): Observable<Result<TGetByIdResponse>>;
|
|
2989
|
+
/**
|
|
2990
|
+
* Creates a new entity at the configured endpoint.
|
|
2991
|
+
*
|
|
2992
|
+
* Sends a POST request with the provided payload as the request body.
|
|
2993
|
+
*
|
|
2994
|
+
* @param payload The data used to create the entity.
|
|
2995
|
+
* @returns An observable emitting a `Result` with the created entity or a structured failure.
|
|
2996
|
+
*/
|
|
2997
|
+
create(payload: TCreatePayload): Observable<Result<TCreateResponse>>;
|
|
2998
|
+
/**
|
|
2999
|
+
* Fully replaces an existing entity.
|
|
3000
|
+
*
|
|
3001
|
+
* Sends a PUT request to `{endpoint}/{id}` with the provided payload,
|
|
3002
|
+
* replacing the entire entity.
|
|
3003
|
+
*
|
|
3004
|
+
* @param id The unique identifier of the entity to update.
|
|
3005
|
+
* @param payload The complete data to replace the existing entity with.
|
|
3006
|
+
* @returns An observable emitting a `Result` with the updated entity or a structured failure.
|
|
3007
|
+
*/
|
|
3008
|
+
update(id: TId, payload: TUpdatePayload): Observable<Result<TUpdateResponse>>;
|
|
3009
|
+
/**
|
|
3010
|
+
* Partially updates an existing entity.
|
|
3011
|
+
*
|
|
3012
|
+
* Sends a PATCH request to `{endpoint}/{id}` with the provided payload,
|
|
3013
|
+
* merging changes into the existing entity.
|
|
3014
|
+
*
|
|
3015
|
+
* @param id The unique identifier of the entity to patch.
|
|
3016
|
+
* @param payload A partial set of fields to update on the existing entity.
|
|
3017
|
+
* @returns An observable emitting a `Result` with the updated entity or a structured failure.
|
|
3018
|
+
*/
|
|
3019
|
+
patch(id: TId, payload: Partial<TUpdatePayload>): Observable<Result<TUpdateResponse>>;
|
|
3020
|
+
/**
|
|
3021
|
+
* Deletes an entity by its identifier.
|
|
3022
|
+
*
|
|
3023
|
+
* Sends a DELETE request to `{endpoint}/{id}`.
|
|
3024
|
+
*
|
|
3025
|
+
* @param id The unique identifier of the entity to delete.
|
|
3026
|
+
* @returns An observable emitting a `Result` with the delete response or a structured failure.
|
|
3027
|
+
*/
|
|
3028
|
+
delete(id: TId): Observable<Result<TDeleteResponse>>;
|
|
3029
|
+
/**
|
|
3030
|
+
* Retrieves all entities with the full `HttpResponse` wrapper.
|
|
3031
|
+
*
|
|
3032
|
+
* Behaves like {@link getAll} but observes the complete HTTP response,
|
|
3033
|
+
* giving access to headers, status code, and URL alongside the body.
|
|
3034
|
+
*
|
|
3035
|
+
* @param query Optional query parameters appended to the request URL.
|
|
3036
|
+
* @returns An observable emitting a `Result` with the full HTTP response or a structured failure.
|
|
3037
|
+
*/
|
|
3038
|
+
getAllResponse(query?: QueryParams): Observable<Result<HttpResponse<TListResponse>>>;
|
|
3039
|
+
/**
|
|
3040
|
+
* Builds the URL for a single entity by appending the identifier to the endpoint.
|
|
3041
|
+
*
|
|
3042
|
+
* @param id The unique identifier to append.
|
|
3043
|
+
* @returns The full URL targeting the specific entity.
|
|
3044
|
+
*/
|
|
3045
|
+
protected itemUrl(id: TId): string;
|
|
3046
|
+
/**
|
|
3047
|
+
* Wraps a value in a `SuccessResult`.
|
|
3048
|
+
*
|
|
3049
|
+
* @template T The type of the response data.
|
|
3050
|
+
* @param data The response data to wrap.
|
|
3051
|
+
* @param meta Optional metadata (status code, headers, URL) to attach.
|
|
3052
|
+
* @returns A `SuccessResult` containing the provided data.
|
|
3053
|
+
*/
|
|
3054
|
+
protected success<T>(data: T, meta?: ResultMeta): SuccessResult<T>;
|
|
3055
|
+
/**
|
|
3056
|
+
* Wraps an error in a `FailureResult`.
|
|
3057
|
+
*
|
|
3058
|
+
* When no explicit metadata is provided, metadata is derived from
|
|
3059
|
+
* the `ApiError` itself (status code, headers, URL).
|
|
3060
|
+
*
|
|
3061
|
+
* @param error The structured API error.
|
|
3062
|
+
* @param meta Optional metadata to override the error-derived values.
|
|
3063
|
+
* @returns A `FailureResult` containing the error and metadata.
|
|
3064
|
+
*/
|
|
3065
|
+
protected failure(error: ApiError, meta?: ResultMeta): FailureResult;
|
|
3066
|
+
/**
|
|
3067
|
+
* Maps an unknown error into a structured `ApiError`.
|
|
3068
|
+
*
|
|
3069
|
+
* Handles both `HttpErrorResponse` instances and unexpected error types.
|
|
3070
|
+
* Extracts backend messages, validation errors, and retry information
|
|
3071
|
+
* so callers receive a consistent error shape.
|
|
3072
|
+
*
|
|
3073
|
+
* @param error The raw error caught from the HTTP pipeline.
|
|
3074
|
+
* @returns A fully populated `ApiError` object.
|
|
3075
|
+
*/
|
|
3076
|
+
protected mapHttpError(error: unknown): ApiError;
|
|
3077
|
+
/**
|
|
3078
|
+
* Extracts a human-readable message from the error response body.
|
|
3079
|
+
*
|
|
3080
|
+
* Checks common keys (`message`, `title`, `detail`, `error`) on the
|
|
3081
|
+
* body object and returns the first non-empty string found.
|
|
3082
|
+
*
|
|
3083
|
+
* @param body The parsed error response body.
|
|
3084
|
+
* @returns The extracted message, or `undefined` if none was found.
|
|
3085
|
+
*/
|
|
3086
|
+
protected extractBackendMessage(body: unknown): string | undefined;
|
|
3087
|
+
/**
|
|
3088
|
+
* Extracts field-level validation errors from the error response body.
|
|
3089
|
+
*
|
|
3090
|
+
* Expects an `errors` property on the body containing a record of
|
|
3091
|
+
* field names to error messages (string or string array).
|
|
3092
|
+
*
|
|
3093
|
+
* @param body The parsed error response body.
|
|
3094
|
+
* @returns A record mapping field names to their error messages, or `undefined` if none were found.
|
|
3095
|
+
*/
|
|
3096
|
+
protected extractValidationErrors(body: unknown): Record<string, string[]> | undefined;
|
|
3097
|
+
/**
|
|
3098
|
+
* Returns a default user-facing message for the given HTTP status code.
|
|
3099
|
+
*
|
|
3100
|
+
* Provides human-readable messages for common HTTP status codes.
|
|
3101
|
+
* Override this method to customise messages.
|
|
3102
|
+
*
|
|
3103
|
+
* @param status The HTTP status code, or `null` when unknown.
|
|
3104
|
+
* @returns A descriptive error message.
|
|
3105
|
+
*/
|
|
3106
|
+
protected defaultMessage(status: HttpStatusCode | null): string;
|
|
3107
|
+
/**
|
|
3108
|
+
* Determines whether a request with the given status can be retried.
|
|
3109
|
+
*
|
|
3110
|
+
* Timeouts, rate-limiting responses, and server errors
|
|
3111
|
+
* (5xx) are considered retryable by default.
|
|
3112
|
+
*
|
|
3113
|
+
* @param status The HTTP status code, or `null` when unknown.
|
|
3114
|
+
* @returns `true` if the request is safe to retry.
|
|
3115
|
+
*/
|
|
3116
|
+
protected isRetryable(status: HttpStatusCode | null): boolean;
|
|
3117
|
+
/**
|
|
3118
|
+
* Normalises a raw HTTP status into an `HttpStatusCode | null` value.
|
|
3119
|
+
*
|
|
3120
|
+
* Converts `undefined`, `NaN`, and `0` (network error) to `null`
|
|
3121
|
+
* so downstream code only needs to handle `HttpStatusCode | null`.
|
|
3122
|
+
*
|
|
3123
|
+
* @param status The raw status value from the HTTP response.
|
|
3124
|
+
* @returns The normalised status code, or `null` when indeterminate.
|
|
3125
|
+
*/
|
|
3126
|
+
protected normalizeStatus(status: number | null | undefined): HttpStatusCode | null;
|
|
3127
|
+
/**
|
|
3128
|
+
* Converts query parameters into Angular `HttpParams`.
|
|
3129
|
+
*
|
|
3130
|
+
* `null` and `undefined` values are silently skipped.
|
|
3131
|
+
* Array values are appended as multiple entries for the same key.
|
|
3132
|
+
*
|
|
3133
|
+
* @param query The query parameter record to convert.
|
|
3134
|
+
* @returns An `HttpParams` instance, or `undefined` when no parameters are provided.
|
|
3135
|
+
*/
|
|
3136
|
+
protected toHttpParams(query?: QueryParams): HttpParams | undefined;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
/**
|
|
3140
|
+
* Injection token for the base URL used by all CRUD service requests.
|
|
3141
|
+
*
|
|
3142
|
+
* Provide this token at the application or module level to configure
|
|
3143
|
+
* the root API URL that `CrudService` prepends to every endpoint.
|
|
3144
|
+
*/
|
|
3145
|
+
declare const API_BASE_URL: InjectionToken<string>;
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* A marker object used in config values to indicate that the value
|
|
3149
|
+
* should be resolved via the MnLanguageService.
|
|
3150
|
+
*
|
|
3151
|
+
* Example in mn-config.json5:
|
|
3152
|
+
* label: { $translate: "form.email.label" }
|
|
3153
|
+
*/
|
|
3154
|
+
interface MnTranslatable {
|
|
3155
|
+
$translate: string;
|
|
3156
|
+
params?: Record<string, string | number>;
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* A config value that is either a plain value or a translatable marker.
|
|
3160
|
+
*/
|
|
3161
|
+
type MnConfigValue<T = string> = T | MnTranslatable;
|
|
3162
|
+
/**
|
|
3163
|
+
* A flat key-value map of translations for a single locale.
|
|
3164
|
+
* Supports nested keys via dot notation: "form.email.label"
|
|
3165
|
+
*/
|
|
3166
|
+
type MnTranslationMap = Record<string, string>;
|
|
3167
|
+
/**
|
|
3168
|
+
* All loaded translations keyed by locale code (e.g. "en", "nl", "de").
|
|
3169
|
+
*/
|
|
3170
|
+
type MnTranslations = Record<string, MnTranslationMap>;
|
|
3171
|
+
/**
|
|
3172
|
+
* Configuration for the language provider.
|
|
3173
|
+
*/
|
|
3174
|
+
interface MnLanguageConfig {
|
|
3175
|
+
/** URL pattern for loading translation files. Use `{locale}` as placeholder. e.g. "assets/i18n/{locale}.json" */
|
|
3176
|
+
urlPattern: string;
|
|
3177
|
+
/** The default/fallback locale. */
|
|
3178
|
+
defaultLocale: string;
|
|
3179
|
+
/** Locales to preload at bootstrap. */
|
|
3180
|
+
preload?: string[];
|
|
3181
|
+
}
|
|
3182
|
+
/**
|
|
3183
|
+
* Type guard: checks whether a value is a translatable marker object.
|
|
3184
|
+
*/
|
|
3185
|
+
declare function isTranslatable(value: unknown): value is MnTranslatable;
|
|
3186
|
+
|
|
3187
|
+
declare class MnLanguageService {
|
|
3188
|
+
private readonly http;
|
|
3189
|
+
private _translations;
|
|
3190
|
+
private _locale$;
|
|
3191
|
+
private _urlPattern;
|
|
3192
|
+
/** Observable of the current active locale. */
|
|
3193
|
+
readonly locale$: Observable<string>;
|
|
3194
|
+
constructor(http: HttpClient);
|
|
3195
|
+
/** Current active locale. */
|
|
3196
|
+
get locale(): string;
|
|
3197
|
+
/**
|
|
3198
|
+
* Configure the URL pattern used to fetch translation files.
|
|
3199
|
+
* Use `{locale}` as placeholder, e.g. `"assets/i18n/{locale}.json"`.
|
|
3200
|
+
*/
|
|
3201
|
+
configure(urlPattern: string): void;
|
|
3202
|
+
/**
|
|
3203
|
+
* Load translations for a locale from the configured URL pattern.
|
|
3204
|
+
* If translations are already loaded for this locale, this is a no-op.
|
|
3205
|
+
*/
|
|
3206
|
+
loadLocale(locale: string): Promise<void>;
|
|
3207
|
+
/**
|
|
3208
|
+
* Switch the active locale. Loads translations if not yet loaded.
|
|
3209
|
+
*/
|
|
3210
|
+
setLocale(locale: string): Promise<void>;
|
|
3211
|
+
/**
|
|
3212
|
+
* Register translations for a locale directly from code (no HTTP needed).
|
|
3213
|
+
*/
|
|
3214
|
+
registerTranslations(locale: string, translations: MnTranslationMap): void;
|
|
3215
|
+
/**
|
|
3216
|
+
* Translate a key using the current locale, with optional parameter interpolation.
|
|
3217
|
+
* Falls back to the key itself if no translation is found.
|
|
3218
|
+
*
|
|
3219
|
+
* Interpolation replaces `{{paramName}}` with the provided value.
|
|
3220
|
+
*/
|
|
3221
|
+
translate(key: string, params?: Record<string, string | number>): string;
|
|
3222
|
+
/**
|
|
3223
|
+
* Shorthand alias for `translate`.
|
|
3224
|
+
*/
|
|
3225
|
+
t(key: string, params?: Record<string, string | number>): string;
|
|
3226
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnLanguageService, never>;
|
|
3227
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MnLanguageService>;
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
/**
|
|
3231
|
+
* Provides an APP_INITIALIZER that configures the MnLanguageService and
|
|
3232
|
+
* preloads the requested locales during application bootstrap.
|
|
3233
|
+
*
|
|
3234
|
+
* Usage in app.config.ts:
|
|
3235
|
+
* ...provideMnLanguage({
|
|
3236
|
+
* urlPattern: 'assets/i18n/{locale}.json',
|
|
3237
|
+
* defaultLocale: 'en',
|
|
3238
|
+
* preload: ['en', 'nl'],
|
|
3239
|
+
* })
|
|
3240
|
+
*/
|
|
3241
|
+
declare function provideMnLanguage(config: MnLanguageConfig): Provider[];
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* Pipe that translates a key via MnLanguageService.
|
|
3245
|
+
*
|
|
3246
|
+
* Usage in templates:
|
|
3247
|
+
* {{ 'form.email.label' | mnTranslate }}
|
|
3248
|
+
* {{ 'greeting' | mnTranslate:{ name: 'World' } }}
|
|
3249
|
+
*
|
|
3250
|
+
* Note: This pipe is impure so it re-evaluates when the locale changes.
|
|
3251
|
+
*/
|
|
3252
|
+
declare class MnTranslatePipe implements PipeTransform {
|
|
3253
|
+
private readonly lang;
|
|
3254
|
+
constructor(lang: MnLanguageService);
|
|
3255
|
+
transform(key: string, params?: Record<string, string | number>): string;
|
|
3256
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnTranslatePipe, never>;
|
|
3257
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<MnTranslatePipe, "mnTranslate", true>;
|
|
1319
3258
|
}
|
|
1320
3259
|
|
|
1321
|
-
export { DEFAULT_MN_ALERT_CONFIG, MN_ALERT_CONFIG, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_SECTION_PATH, MN_TEST_COMPONENT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnButton, MnConfigService, MnDualHorizontalImage, MnInformationCard, MnInputField, MnInstanceDirective, MnSectionDirective, MnTestComponent, MnTextarea, Test, dateTimeAdapter, defaultTextAdapter, mnAlertVariants, mnButtonVariants, mnInformationCardVariants, mnInputFieldVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnComponentConfig, provideMnConfig };
|
|
1322
|
-
export type { MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnButtonTypes, MnButtonVariants, MnConfigFile, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessagesData, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnShowInput, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants };
|
|
3260
|
+
export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_MN_ALERT_CONFIG, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_TEST_COMPONENT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnButton, MnCheckbox, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnTable, MnTestComponent, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, Test, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, isTranslatable, mnAlertVariants, mnButtonVariants, mnCheckboxVariants, mnDatetimeVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnComponentConfig, provideMnConfig, provideMnLanguage };
|
|
3261
|
+
export type { ApiError, BaseModalConfig, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColumnDefinition, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnConfigFile, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessagesData, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnShowInput, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableRowAction, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };
|