commons-shared-web-ui 0.0.45 → 0.0.47
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/commons-shared-web-ui.mjs +287 -113
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -1
- package/index.d.ts +264 -208
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, OnDestroy, ElementRef, PipeTransform, NgZone, AfterViewInit
|
|
2
|
+
import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, OnDestroy, ElementRef, QueryList, PipeTransform, NgZone, AfterViewInit } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/material/snack-bar';
|
|
4
4
|
import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
|
|
5
5
|
import * as i2$1 from '@angular/common';
|
|
6
6
|
import * as i3$1 from '@angular/forms';
|
|
7
|
-
import { FormGroup,
|
|
7
|
+
import { FormGroup, FormControl, FormArray, FormBuilder, ValidatorFn, ControlValueAccessor, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
8
8
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
9
9
|
import * as i3$2 from '@angular/router';
|
|
10
10
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
@@ -360,6 +360,22 @@ interface TimeConfig {
|
|
|
360
360
|
*/
|
|
361
361
|
minTimeField?: string;
|
|
362
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Configuration for enabling search functionality inside DROPDOWN fields.
|
|
365
|
+
* Supports both client-side (local) and server-side (remote GET) filtering.
|
|
366
|
+
*/
|
|
367
|
+
interface DropdownSearchConfig {
|
|
368
|
+
/** Whether to display a search input inside the dropdown panel. */
|
|
369
|
+
enabled: boolean;
|
|
370
|
+
/** Filtering mode. 'local' filters client-side (default). 'server' queries the API on typing via GET. */
|
|
371
|
+
mode?: 'local' | 'server';
|
|
372
|
+
/** Query parameter key for the search term sent to the API (default: 'search'). Only used in 'server' mode. */
|
|
373
|
+
searchKey?: string;
|
|
374
|
+
/** Minimum characters required before triggering a server-side search (default: 3). Only used in 'server' mode. */
|
|
375
|
+
minSearchLength?: number;
|
|
376
|
+
/** Debounce delay in milliseconds before firing search (default: 300). */
|
|
377
|
+
debounceTime?: number;
|
|
378
|
+
}
|
|
363
379
|
interface OptionConfig$1 {
|
|
364
380
|
optionClass?: string;
|
|
365
381
|
optionUrl?: string;
|
|
@@ -375,6 +391,10 @@ interface OptionConfig$1 {
|
|
|
375
391
|
sortDirection?: 'ASC' | 'DESC';
|
|
376
392
|
layout?: 'row' | 'column';
|
|
377
393
|
optionList?: OptionItem[];
|
|
394
|
+
/** Configuration for enabling search functionality inside the dropdown panel. */
|
|
395
|
+
searchConfig?: DropdownSearchConfig;
|
|
396
|
+
/** When true, renders a 'Select All' checkbox at the top of a MULTIPLE select dropdown. */
|
|
397
|
+
showSelectAll?: boolean;
|
|
378
398
|
}
|
|
379
399
|
interface AutocompleteDisplayField {
|
|
380
400
|
/** Dot-notation path to the value in the API response item (e.g. 'login', 'contact.phone'). */
|
|
@@ -1195,212 +1215,6 @@ declare class ExpressionService {
|
|
|
1195
1215
|
static ɵprov: i0.ɵɵInjectableDeclaration<ExpressionService>;
|
|
1196
1216
|
}
|
|
1197
1217
|
|
|
1198
|
-
declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
1199
|
-
private fb;
|
|
1200
|
-
controller: SmartFormController;
|
|
1201
|
-
private expressionService;
|
|
1202
|
-
private http;
|
|
1203
|
-
private snackbarService;
|
|
1204
|
-
private router;
|
|
1205
|
-
private cdr;
|
|
1206
|
-
private destroy$;
|
|
1207
|
-
formJson: string;
|
|
1208
|
-
initialValues?: {
|
|
1209
|
-
[key: string]: any;
|
|
1210
|
-
};
|
|
1211
|
-
enableDraftAutoSave: boolean;
|
|
1212
|
-
/** Flat i18n labels map passed by the consuming app.
|
|
1213
|
-
* After JSON parse the schema is walked and every string value that
|
|
1214
|
-
* matches a key in this map is replaced with the translated value.
|
|
1215
|
-
* Mirrors the pattern used by ConfigurableFormComponent + translateConfig.
|
|
1216
|
-
*/
|
|
1217
|
-
labels: any;
|
|
1218
|
-
mode: 'CREATE' | 'EDIT';
|
|
1219
|
-
/** When true, all form fields are disabled and the action bar is hidden (preview/read-only mode). */
|
|
1220
|
-
readOnly: boolean;
|
|
1221
|
-
submit: EventEmitter<{
|
|
1222
|
-
[key: string]: any;
|
|
1223
|
-
}>;
|
|
1224
|
-
draftSave: EventEmitter<string>;
|
|
1225
|
-
/**
|
|
1226
|
-
* Emitted when a button with a custom `type` (not 'cancel', 'draft', or
|
|
1227
|
-
* 'submit') is clicked. Payload contains the button `id` and the current
|
|
1228
|
-
* form data snapshot.
|
|
1229
|
-
*/
|
|
1230
|
-
actionClick: EventEmitter<{
|
|
1231
|
-
id: string;
|
|
1232
|
-
formData: {
|
|
1233
|
-
[key: string]: any;
|
|
1234
|
-
};
|
|
1235
|
-
}>;
|
|
1236
|
-
valueChange: EventEmitter<{
|
|
1237
|
-
[key: string]: any;
|
|
1238
|
-
}>;
|
|
1239
|
-
fileAdded: EventEmitter<any>;
|
|
1240
|
-
fileUploadFinished: EventEmitter<any>;
|
|
1241
|
-
fileRemoved: EventEmitter<any>;
|
|
1242
|
-
/** Emitted when a suffixActionIcon is clicked. Payload: { fieldName, actionId } */
|
|
1243
|
-
suffixActionClick: EventEmitter<{
|
|
1244
|
-
fieldName: string;
|
|
1245
|
-
actionId: string;
|
|
1246
|
-
}>;
|
|
1247
|
-
/** Emitted whenever the active section step changes. Carries current state so the
|
|
1248
|
-
* host can show/hide Previous/Next/Submit buttons in its own footer. */
|
|
1249
|
-
stepChange: EventEmitter<{
|
|
1250
|
-
currentStep: number;
|
|
1251
|
-
totalSteps: number;
|
|
1252
|
-
isFirst: boolean;
|
|
1253
|
-
isLast: boolean;
|
|
1254
|
-
stepLabel: string;
|
|
1255
|
-
}>;
|
|
1256
|
-
formSchema: FormSchema;
|
|
1257
|
-
formGroup: FormGroup;
|
|
1258
|
-
fieldList: FieldConfig[];
|
|
1259
|
-
isStepper: boolean;
|
|
1260
|
-
currentStep: number;
|
|
1261
|
-
isLoading: boolean;
|
|
1262
|
-
isDraftLoading: boolean;
|
|
1263
|
-
/** True when sectionStepper mode is active (SECTION form with top-level GROUPs as steps). */
|
|
1264
|
-
isSectionStepper: boolean;
|
|
1265
|
-
/** Index of the currently visible section step. */
|
|
1266
|
-
currentSectionStep: number;
|
|
1267
|
-
/** Flat list of top-level GROUP FieldConfigs that become the stepper steps. */
|
|
1268
|
-
sectionSteps: FieldConfig[];
|
|
1269
|
-
/** Validation state per section step — drives badge colour/icon. */
|
|
1270
|
-
stepValidationStates: ('untouched' | 'valid' | 'warning')[];
|
|
1271
|
-
/** Flat field-name lists per step used for targeted validation. */
|
|
1272
|
-
private stepFieldNames;
|
|
1273
|
-
/** Controls skeleton visibility. Stays false until schema is parsed AND
|
|
1274
|
-
* any EDIT-mode data fetch completes, but always shows for at least
|
|
1275
|
-
* SKELETON_MIN_MS so the animation is visible even on fast loads. */
|
|
1276
|
-
isFormReady: boolean;
|
|
1277
|
-
private readonly SKELETON_MIN_MS;
|
|
1278
|
-
private _skeletonStart;
|
|
1279
|
-
constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient, snackbarService: SnackbarService, router: Router, cdr: ChangeDetectorRef);
|
|
1280
|
-
ngOnInit(): void;
|
|
1281
|
-
loadEditData(): void;
|
|
1282
|
-
/** Flips isFormReady=true after the skeleton has been visible for at least SKELETON_MIN_MS. */
|
|
1283
|
-
private _markReady;
|
|
1284
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
1285
|
-
ngOnDestroy(): void;
|
|
1286
|
-
/** Public backward-compatible entry point — delegates to _startForm. */
|
|
1287
|
-
parseFormJson(): void;
|
|
1288
|
-
private _startForm;
|
|
1289
|
-
private _applySchema;
|
|
1290
|
-
initializeForm(): void;
|
|
1291
|
-
collectFields(fields: FieldConfig[]): void;
|
|
1292
|
-
handleSubmit(): void;
|
|
1293
|
-
/**
|
|
1294
|
-
* Universal action handler for any button click.
|
|
1295
|
-
* One handler decides how to process based on action.kind.
|
|
1296
|
-
*/
|
|
1297
|
-
handleButtonClick(btn: ActionButtonConfig): void;
|
|
1298
|
-
private fireActionApiCall;
|
|
1299
|
-
/**
|
|
1300
|
-
* Constructs nested payload by checking field properties on form controls.
|
|
1301
|
-
*/
|
|
1302
|
-
collectFormData(): {
|
|
1303
|
-
[key: string]: any;
|
|
1304
|
-
};
|
|
1305
|
-
/**
|
|
1306
|
-
* Deep merges the source object (e.g. extraPayload) into the target object (e.g. form payload).
|
|
1307
|
-
*/
|
|
1308
|
-
private deepMerge;
|
|
1309
|
-
private buildNestedPayload;
|
|
1310
|
-
private setNestedValue;
|
|
1311
|
-
private extractGroupValue;
|
|
1312
|
-
validate(): boolean;
|
|
1313
|
-
scrollToFirstInvalidControl(): void;
|
|
1314
|
-
submitToApi(formData: any, actionType?: 'submit' | 'draft', btn?: ActionButtonConfig): void;
|
|
1315
|
-
showAlert(type: 'success' | 'error' | 'warning' | 'info', message: string, customConfig?: any): void;
|
|
1316
|
-
/** Builds HttpHeaders from the token stored in the controller (sourced from configJSON). */
|
|
1317
|
-
getHeaders(): HttpHeaders;
|
|
1318
|
-
nextStep(): void;
|
|
1319
|
-
previousStep(): void;
|
|
1320
|
-
get canGoNext(): boolean;
|
|
1321
|
-
get canGoPrevious(): boolean;
|
|
1322
|
-
get currentStepConfig(): FieldConfig | undefined;
|
|
1323
|
-
/** Advance to the next section step. Called by the host footer "Next" button.
|
|
1324
|
-
* Validates the current step first — marks it valid (green) or warning (orange). */
|
|
1325
|
-
navigateToNext(): void;
|
|
1326
|
-
/** Go back to the previous section step. Called by the host footer "Previous" button. */
|
|
1327
|
-
navigateToPrevious(): void;
|
|
1328
|
-
/** Jump directly to a specific section step by index.
|
|
1329
|
-
* Validates the step being left so the badge state updates correctly. */
|
|
1330
|
-
goToSectionStep(index: number): void;
|
|
1331
|
-
get isSectionStepFirst(): boolean;
|
|
1332
|
-
get isSectionStepLast(): boolean;
|
|
1333
|
-
/** Returns the SectionConfig for a given step — passed to lib-form-section.
|
|
1334
|
-
* The outer label is intentionally omitted because the stepper nav already
|
|
1335
|
-
* displays it; showing it again inside the content would be redundant. */
|
|
1336
|
-
getSectionStepConfig(step: FieldConfig): any;
|
|
1337
|
-
private _emitStepChange;
|
|
1338
|
-
/** Marks all controls in the given step as touched and records valid/warning state. */
|
|
1339
|
-
private _validateStep;
|
|
1340
|
-
/** Recursively collects all leaf field names from a set of FieldConfigs. */
|
|
1341
|
-
private _collectFieldNames;
|
|
1342
|
-
get nextLabel(): string;
|
|
1343
|
-
get submitLabel(): string;
|
|
1344
|
-
get previousLabel(): string;
|
|
1345
|
-
get actionBarConfig(): ActionBarConfig | undefined;
|
|
1346
|
-
/**
|
|
1347
|
-
* Returns buttons for a given alignment, sorted by `order` (stable).
|
|
1348
|
-
*/
|
|
1349
|
-
getButtonsForAlignment(alignment: 'left' | 'right'): ActionButtonConfig[];
|
|
1350
|
-
getButtonLabel(btn: ActionButtonConfig): string;
|
|
1351
|
-
isButtonDisabled(btn: ActionButtonConfig): boolean;
|
|
1352
|
-
private getButtonByActionKind;
|
|
1353
|
-
private navigateTo;
|
|
1354
|
-
private _hasHierarchyDynamic;
|
|
1355
|
-
private _expandHierarchyNodes;
|
|
1356
|
-
private _expandNodeRecursive;
|
|
1357
|
-
private _expandSingleNode;
|
|
1358
|
-
private _normalizeHierarchyCfg;
|
|
1359
|
-
private _fetchHierarchyTemplate;
|
|
1360
|
-
private _buildHierarchyFields;
|
|
1361
|
-
private _getPathValue;
|
|
1362
|
-
private _codeToFieldName;
|
|
1363
|
-
private _codeToLabel;
|
|
1364
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormComponent, never>;
|
|
1365
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SmartFormComponent, "lib-smart-form", never, { "formJson": { "alias": "formJson"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "enableDraftAutoSave": { "alias": "enableDraftAutoSave"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; }, { "submit": "submit"; "draftSave": "draftSave"; "actionClick": "actionClick"; "valueChange": "valueChange"; "fileAdded": "fileAdded"; "fileUploadFinished": "fileUploadFinished"; "fileRemoved": "fileRemoved"; "suffixActionClick": "suffixActionClick"; "stepChange": "stepChange"; }, never, never, false, never>;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
declare class FormSectionComponent implements OnInit, OnDestroy {
|
|
1369
|
-
private fb;
|
|
1370
|
-
config: SectionConfig;
|
|
1371
|
-
controller: SmartFormController;
|
|
1372
|
-
formGroup: FormGroup;
|
|
1373
|
-
/**
|
|
1374
|
-
* For allowMulti sections: the FormArray registered on the root formGroup.
|
|
1375
|
-
* Each element is a FormGroup representing one repeater instance.
|
|
1376
|
-
*/
|
|
1377
|
-
repeaterFormArray: FormArray;
|
|
1378
|
-
/** Tracks which accordion panels are open (by index). New instances start expanded. */
|
|
1379
|
-
expandedInstances: Set<number>;
|
|
1380
|
-
/**
|
|
1381
|
-
* The key under which the FormArray is registered in the root formGroup.
|
|
1382
|
-
* Falls back to config.name or a generated key.
|
|
1383
|
-
*/
|
|
1384
|
-
get arrayKey(): string;
|
|
1385
|
-
constructor(fb: FormBuilder);
|
|
1386
|
-
ngOnInit(): void;
|
|
1387
|
-
ngOnDestroy(): void;
|
|
1388
|
-
/** Creates a fresh FormGroup for one repeater instance */
|
|
1389
|
-
private createInstanceGroup;
|
|
1390
|
-
addInstance(): void;
|
|
1391
|
-
removeInstance(index: number): void;
|
|
1392
|
-
toggleInstance(index: number): void;
|
|
1393
|
-
isExpanded(index: number): boolean;
|
|
1394
|
-
getInstanceGroup(index: number): FormGroup;
|
|
1395
|
-
get instanceGroups(): FormGroup[];
|
|
1396
|
-
/** For non-allowMulti sections we simply pass the root formGroup down */
|
|
1397
|
-
get flatFormGroup(): FormGroup;
|
|
1398
|
-
/** Flatten a field tree to get all leaf fields (for ROW children etc.) */
|
|
1399
|
-
getFlatFields(fields: FieldConfig[]): FieldConfig[];
|
|
1400
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FormSectionComponent, never>;
|
|
1401
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormSectionComponent, "lib-form-section", never, { "config": { "alias": "config"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; }, {}, never, never, false, never>;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
1218
|
interface ConfirmationModalConfig {
|
|
1405
1219
|
title: string;
|
|
1406
1220
|
headerTheme?: 'light' | 'dark';
|
|
@@ -1494,6 +1308,10 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1494
1308
|
/** Effective maximum time for the time input (explicit maxTime only). */
|
|
1495
1309
|
get effectiveMaxTime(): string | null;
|
|
1496
1310
|
isMultiDropdownOpen: boolean;
|
|
1311
|
+
isSingleDropdownOpen: boolean;
|
|
1312
|
+
searchText: string;
|
|
1313
|
+
filteredOptionList: any[];
|
|
1314
|
+
dropdownSearch$: Subject<string>;
|
|
1497
1315
|
isDragOver: boolean;
|
|
1498
1316
|
fileUploadError: string;
|
|
1499
1317
|
multiSaveError: string;
|
|
@@ -1585,6 +1403,16 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1585
1403
|
get expandLessLabel(): string;
|
|
1586
1404
|
/** Getter for expand more icon name */
|
|
1587
1405
|
get expandMoreLabel(): string;
|
|
1406
|
+
/** Getter for dropdown search placeholder label */
|
|
1407
|
+
get searchPlaceholderLabel(): string;
|
|
1408
|
+
/** Getter for Select All label */
|
|
1409
|
+
get selectAllLabel(): string;
|
|
1410
|
+
/** Getter for No matching options label */
|
|
1411
|
+
get noMatchingOptionsLabel(): string;
|
|
1412
|
+
/** Returns the label of the currently selected option for single-select custom dropdowns */
|
|
1413
|
+
get singleSelectedLabel(): string;
|
|
1414
|
+
/** Whether the dropdown search feature is enabled for this field */
|
|
1415
|
+
get isSearchableDropdown(): boolean;
|
|
1588
1416
|
private initGroupField;
|
|
1589
1417
|
/**
|
|
1590
1418
|
* Sets up cross-field validation based on the `onValidate` formula.
|
|
@@ -1594,6 +1422,13 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1594
1422
|
private setupFormulaValidation;
|
|
1595
1423
|
addGroupInstance(initialData?: any): void;
|
|
1596
1424
|
saveGroupInstance(index: number): void;
|
|
1425
|
+
/**
|
|
1426
|
+
* Re-opens any repeater instance (multiSave card or standard accordion panel)
|
|
1427
|
+
* whose nested FormGroup is invalid, so errors hidden by a collapsed card/panel
|
|
1428
|
+
* become visible. Called by the root form when a submit attempt is blocked.
|
|
1429
|
+
* Returns true if at least one invalid instance was revealed.
|
|
1430
|
+
*/
|
|
1431
|
+
revealInvalidInstances(): boolean;
|
|
1597
1432
|
cancelGroupInstance(index: number): void;
|
|
1598
1433
|
editGroupInstance(index: number): void;
|
|
1599
1434
|
toggleExpandGroupInstance(index: number): void;
|
|
@@ -1660,9 +1495,23 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1660
1495
|
get showCharCount(): boolean;
|
|
1661
1496
|
get remainingCharacters(): number | null;
|
|
1662
1497
|
toggleMultiDropdown(event: MouseEvent): void;
|
|
1498
|
+
toggleSingleDropdown(event: MouseEvent): void;
|
|
1499
|
+
selectSingleOption(option: any): void;
|
|
1663
1500
|
onDocumentClick(): void;
|
|
1664
1501
|
onEscapeKey(): void;
|
|
1665
1502
|
get multiSelectedCount(): number;
|
|
1503
|
+
/** Initialise the RxJS search stream for dropdown filtering. */
|
|
1504
|
+
private initDropdownSearch;
|
|
1505
|
+
/** Execute client-side or server-side dropdown search. */
|
|
1506
|
+
private executeDropdownSearch;
|
|
1507
|
+
/** Resets the dropdown search text and filtered list. */
|
|
1508
|
+
resetDropdownSearch(): void;
|
|
1509
|
+
/** Returns true if every option in the current filtered list is selected. */
|
|
1510
|
+
isAllSelected(): boolean;
|
|
1511
|
+
/** Returns true if some (but not all) filtered options are selected — for indeterminate state. */
|
|
1512
|
+
isSomeSelected(): boolean;
|
|
1513
|
+
/** Toggles selection of all filtered options. */
|
|
1514
|
+
toggleSelectAll(checked: boolean): void;
|
|
1666
1515
|
get isTextField(): boolean;
|
|
1667
1516
|
get isNumberField(): boolean;
|
|
1668
1517
|
get isDateField(): boolean;
|
|
@@ -1770,6 +1619,213 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1770
1619
|
static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldComponent, "lib-form-field", never, { "config": { "alias": "config"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "allowMulti": { "alias": "allowMulti"; "required": false; }; }, {}, never, never, false, never>;
|
|
1771
1620
|
}
|
|
1772
1621
|
|
|
1622
|
+
declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
1623
|
+
private fb;
|
|
1624
|
+
controller: SmartFormController;
|
|
1625
|
+
private expressionService;
|
|
1626
|
+
private http;
|
|
1627
|
+
private snackbarService;
|
|
1628
|
+
private router;
|
|
1629
|
+
private cdr;
|
|
1630
|
+
formFieldComponents: QueryList<FormFieldComponent>;
|
|
1631
|
+
private destroy$;
|
|
1632
|
+
formJson: string;
|
|
1633
|
+
initialValues?: {
|
|
1634
|
+
[key: string]: any;
|
|
1635
|
+
};
|
|
1636
|
+
enableDraftAutoSave: boolean;
|
|
1637
|
+
/** Flat i18n labels map passed by the consuming app.
|
|
1638
|
+
* After JSON parse the schema is walked and every string value that
|
|
1639
|
+
* matches a key in this map is replaced with the translated value.
|
|
1640
|
+
* Mirrors the pattern used by ConfigurableFormComponent + translateConfig.
|
|
1641
|
+
*/
|
|
1642
|
+
labels: any;
|
|
1643
|
+
mode: 'CREATE' | 'EDIT';
|
|
1644
|
+
/** When true, all form fields are disabled and the action bar is hidden (preview/read-only mode). */
|
|
1645
|
+
readOnly: boolean;
|
|
1646
|
+
submit: EventEmitter<{
|
|
1647
|
+
[key: string]: any;
|
|
1648
|
+
}>;
|
|
1649
|
+
draftSave: EventEmitter<string>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Emitted when a button with a custom `type` (not 'cancel', 'draft', or
|
|
1652
|
+
* 'submit') is clicked. Payload contains the button `id` and the current
|
|
1653
|
+
* form data snapshot.
|
|
1654
|
+
*/
|
|
1655
|
+
actionClick: EventEmitter<{
|
|
1656
|
+
id: string;
|
|
1657
|
+
formData: {
|
|
1658
|
+
[key: string]: any;
|
|
1659
|
+
};
|
|
1660
|
+
}>;
|
|
1661
|
+
valueChange: EventEmitter<{
|
|
1662
|
+
[key: string]: any;
|
|
1663
|
+
}>;
|
|
1664
|
+
fileAdded: EventEmitter<any>;
|
|
1665
|
+
fileUploadFinished: EventEmitter<any>;
|
|
1666
|
+
fileRemoved: EventEmitter<any>;
|
|
1667
|
+
/** Emitted when a suffixActionIcon is clicked. Payload: { fieldName, actionId } */
|
|
1668
|
+
suffixActionClick: EventEmitter<{
|
|
1669
|
+
fieldName: string;
|
|
1670
|
+
actionId: string;
|
|
1671
|
+
}>;
|
|
1672
|
+
/** Emitted whenever the active section step changes. Carries current state so the
|
|
1673
|
+
* host can show/hide Previous/Next/Submit buttons in its own footer. */
|
|
1674
|
+
stepChange: EventEmitter<{
|
|
1675
|
+
currentStep: number;
|
|
1676
|
+
totalSteps: number;
|
|
1677
|
+
isFirst: boolean;
|
|
1678
|
+
isLast: boolean;
|
|
1679
|
+
stepLabel: string;
|
|
1680
|
+
}>;
|
|
1681
|
+
formSchema: FormSchema;
|
|
1682
|
+
formGroup: FormGroup;
|
|
1683
|
+
fieldList: FieldConfig[];
|
|
1684
|
+
isStepper: boolean;
|
|
1685
|
+
currentStep: number;
|
|
1686
|
+
isLoading: boolean;
|
|
1687
|
+
isDraftLoading: boolean;
|
|
1688
|
+
/** True when sectionStepper mode is active (SECTION form with top-level GROUPs as steps). */
|
|
1689
|
+
isSectionStepper: boolean;
|
|
1690
|
+
/** Index of the currently visible section step. */
|
|
1691
|
+
currentSectionStep: number;
|
|
1692
|
+
/** Flat list of top-level GROUP FieldConfigs that become the stepper steps. */
|
|
1693
|
+
sectionSteps: FieldConfig[];
|
|
1694
|
+
/** Validation state per section step — drives badge colour/icon. */
|
|
1695
|
+
stepValidationStates: ('untouched' | 'valid' | 'warning')[];
|
|
1696
|
+
/** Flat field-name lists per step used for targeted validation. */
|
|
1697
|
+
private stepFieldNames;
|
|
1698
|
+
/** Controls skeleton visibility. Stays false until schema is parsed AND
|
|
1699
|
+
* any EDIT-mode data fetch completes, but always shows for at least
|
|
1700
|
+
* SKELETON_MIN_MS so the animation is visible even on fast loads. */
|
|
1701
|
+
isFormReady: boolean;
|
|
1702
|
+
private readonly SKELETON_MIN_MS;
|
|
1703
|
+
private _skeletonStart;
|
|
1704
|
+
constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient, snackbarService: SnackbarService, router: Router, cdr: ChangeDetectorRef);
|
|
1705
|
+
ngOnInit(): void;
|
|
1706
|
+
loadEditData(): void;
|
|
1707
|
+
/** Flips isFormReady=true after the skeleton has been visible for at least SKELETON_MIN_MS. */
|
|
1708
|
+
private _markReady;
|
|
1709
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
1710
|
+
ngOnDestroy(): void;
|
|
1711
|
+
/** Public backward-compatible entry point — delegates to _startForm. */
|
|
1712
|
+
parseFormJson(): void;
|
|
1713
|
+
private _startForm;
|
|
1714
|
+
private _applySchema;
|
|
1715
|
+
initializeForm(): void;
|
|
1716
|
+
collectFields(fields: FieldConfig[]): void;
|
|
1717
|
+
handleSubmit(): void;
|
|
1718
|
+
/**
|
|
1719
|
+
* Universal action handler for any button click.
|
|
1720
|
+
* One handler decides how to process based on action.kind.
|
|
1721
|
+
*/
|
|
1722
|
+
handleButtonClick(btn: ActionButtonConfig): void;
|
|
1723
|
+
private fireActionApiCall;
|
|
1724
|
+
/**
|
|
1725
|
+
* Constructs nested payload by checking field properties on form controls.
|
|
1726
|
+
*/
|
|
1727
|
+
collectFormData(): {
|
|
1728
|
+
[key: string]: any;
|
|
1729
|
+
};
|
|
1730
|
+
/**
|
|
1731
|
+
* Deep merges the source object (e.g. extraPayload) into the target object (e.g. form payload).
|
|
1732
|
+
*/
|
|
1733
|
+
private deepMerge;
|
|
1734
|
+
private buildNestedPayload;
|
|
1735
|
+
private setNestedValue;
|
|
1736
|
+
private extractGroupValue;
|
|
1737
|
+
validate(): boolean;
|
|
1738
|
+
scrollToFirstInvalidControl(): void;
|
|
1739
|
+
submitToApi(formData: any, actionType?: 'submit' | 'draft', btn?: ActionButtonConfig): void;
|
|
1740
|
+
showAlert(type: 'success' | 'error' | 'warning' | 'info', message: string, customConfig?: any): void;
|
|
1741
|
+
/** Builds HttpHeaders from the token stored in the controller (sourced from configJSON). */
|
|
1742
|
+
getHeaders(): HttpHeaders;
|
|
1743
|
+
nextStep(): void;
|
|
1744
|
+
previousStep(): void;
|
|
1745
|
+
get canGoNext(): boolean;
|
|
1746
|
+
get canGoPrevious(): boolean;
|
|
1747
|
+
get currentStepConfig(): FieldConfig | undefined;
|
|
1748
|
+
/** Advance to the next section step. Called by the host footer "Next" button.
|
|
1749
|
+
* Validates the current step first — marks it valid (green) or warning (orange). */
|
|
1750
|
+
navigateToNext(): void;
|
|
1751
|
+
/** Go back to the previous section step. Called by the host footer "Previous" button. */
|
|
1752
|
+
navigateToPrevious(): void;
|
|
1753
|
+
/** Jump directly to a specific section step by index.
|
|
1754
|
+
* Validates the step being left so the badge state updates correctly. */
|
|
1755
|
+
goToSectionStep(index: number): void;
|
|
1756
|
+
get isSectionStepFirst(): boolean;
|
|
1757
|
+
get isSectionStepLast(): boolean;
|
|
1758
|
+
/** Returns the SectionConfig for a given step — passed to lib-form-section.
|
|
1759
|
+
* The outer label is intentionally omitted because the stepper nav already
|
|
1760
|
+
* displays it; showing it again inside the content would be redundant. */
|
|
1761
|
+
getSectionStepConfig(step: FieldConfig): any;
|
|
1762
|
+
private _emitStepChange;
|
|
1763
|
+
/** Marks all controls in the given step as touched and records valid/warning state. */
|
|
1764
|
+
private _validateStep;
|
|
1765
|
+
/** Recursively collects all leaf field names from a set of FieldConfigs. */
|
|
1766
|
+
private _collectFieldNames;
|
|
1767
|
+
get nextLabel(): string;
|
|
1768
|
+
get submitLabel(): string;
|
|
1769
|
+
get previousLabel(): string;
|
|
1770
|
+
get actionBarConfig(): ActionBarConfig | undefined;
|
|
1771
|
+
/**
|
|
1772
|
+
* Returns buttons for a given alignment, sorted by `order` (stable).
|
|
1773
|
+
*/
|
|
1774
|
+
getButtonsForAlignment(alignment: 'left' | 'right'): ActionButtonConfig[];
|
|
1775
|
+
getButtonLabel(btn: ActionButtonConfig): string;
|
|
1776
|
+
isButtonDisabled(btn: ActionButtonConfig): boolean;
|
|
1777
|
+
private getButtonByActionKind;
|
|
1778
|
+
private navigateTo;
|
|
1779
|
+
private _hasHierarchyDynamic;
|
|
1780
|
+
private _expandHierarchyNodes;
|
|
1781
|
+
private _expandNodeRecursive;
|
|
1782
|
+
private _expandSingleNode;
|
|
1783
|
+
private _normalizeHierarchyCfg;
|
|
1784
|
+
private _fetchHierarchyTemplate;
|
|
1785
|
+
private _buildHierarchyFields;
|
|
1786
|
+
private _getPathValue;
|
|
1787
|
+
private _codeToFieldName;
|
|
1788
|
+
private _codeToLabel;
|
|
1789
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormComponent, never>;
|
|
1790
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SmartFormComponent, "lib-smart-form", never, { "formJson": { "alias": "formJson"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "enableDraftAutoSave": { "alias": "enableDraftAutoSave"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; }, { "submit": "submit"; "draftSave": "draftSave"; "actionClick": "actionClick"; "valueChange": "valueChange"; "fileAdded": "fileAdded"; "fileUploadFinished": "fileUploadFinished"; "fileRemoved": "fileRemoved"; "suffixActionClick": "suffixActionClick"; "stepChange": "stepChange"; }, never, never, false, never>;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
declare class FormSectionComponent implements OnInit, OnDestroy {
|
|
1794
|
+
private fb;
|
|
1795
|
+
config: SectionConfig;
|
|
1796
|
+
controller: SmartFormController;
|
|
1797
|
+
formGroup: FormGroup;
|
|
1798
|
+
/**
|
|
1799
|
+
* For allowMulti sections: the FormArray registered on the root formGroup.
|
|
1800
|
+
* Each element is a FormGroup representing one repeater instance.
|
|
1801
|
+
*/
|
|
1802
|
+
repeaterFormArray: FormArray;
|
|
1803
|
+
/** Tracks which accordion panels are open (by index). New instances start expanded. */
|
|
1804
|
+
expandedInstances: Set<number>;
|
|
1805
|
+
/**
|
|
1806
|
+
* The key under which the FormArray is registered in the root formGroup.
|
|
1807
|
+
* Falls back to config.name or a generated key.
|
|
1808
|
+
*/
|
|
1809
|
+
get arrayKey(): string;
|
|
1810
|
+
constructor(fb: FormBuilder);
|
|
1811
|
+
ngOnInit(): void;
|
|
1812
|
+
ngOnDestroy(): void;
|
|
1813
|
+
/** Creates a fresh FormGroup for one repeater instance */
|
|
1814
|
+
private createInstanceGroup;
|
|
1815
|
+
addInstance(): void;
|
|
1816
|
+
removeInstance(index: number): void;
|
|
1817
|
+
toggleInstance(index: number): void;
|
|
1818
|
+
isExpanded(index: number): boolean;
|
|
1819
|
+
getInstanceGroup(index: number): FormGroup;
|
|
1820
|
+
get instanceGroups(): FormGroup[];
|
|
1821
|
+
/** For non-allowMulti sections we simply pass the root formGroup down */
|
|
1822
|
+
get flatFormGroup(): FormGroup;
|
|
1823
|
+
/** Flatten a field tree to get all leaf fields (for ROW children etc.) */
|
|
1824
|
+
getFlatFields(fields: FieldConfig[]): FieldConfig[];
|
|
1825
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormSectionComponent, never>;
|
|
1826
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormSectionComponent, "lib-form-section", never, { "config": { "alias": "config"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; }, {}, never, never, false, never>;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1773
1829
|
/**
|
|
1774
1830
|
* Bypasses Angular's DomSanitizer for resource URLs (e.g. YouTube embed iframes).
|
|
1775
1831
|
* Used only for trusted URLs such as YouTube embed links derived from user-provided video IDs.
|