commons-shared-web-ui 0.0.18 → 0.0.20
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 +277 -84
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -1
- package/index.d.ts +114 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1469,6 +1469,12 @@ interface FormSchema {
|
|
|
1469
1469
|
sectionConfig?: SectionConfig;
|
|
1470
1470
|
stepperConfig?: StepperConfig;
|
|
1471
1471
|
submitConfig?: SubmitConfig;
|
|
1472
|
+
/**
|
|
1473
|
+
* Configures the action bar shown at the bottom of the form.
|
|
1474
|
+
* Supports Cancel, Save as Draft, and Submit buttons with flexible layout.
|
|
1475
|
+
* If omitted, the default Submit (and stepper Prev/Next) behaviour is unchanged.
|
|
1476
|
+
*/
|
|
1477
|
+
actionBarConfig?: ActionBarConfig;
|
|
1472
1478
|
showActions?: boolean;
|
|
1473
1479
|
/** Full token string passed to all library API calls (e.g. "Bearer eyJ…") */
|
|
1474
1480
|
token?: string;
|
|
@@ -1502,6 +1508,71 @@ interface SubmitConfig {
|
|
|
1502
1508
|
showCloseButton?: boolean;
|
|
1503
1509
|
};
|
|
1504
1510
|
}
|
|
1511
|
+
/**
|
|
1512
|
+
* Describes what happens when an action bar button is clicked.
|
|
1513
|
+
* One ActionConfig shape works for every button.
|
|
1514
|
+
*/
|
|
1515
|
+
interface ActionConfig {
|
|
1516
|
+
/**
|
|
1517
|
+
* Action kind.
|
|
1518
|
+
* 'submit' -> Validates and submits form using submitConfig/editConfig.
|
|
1519
|
+
* 'draft' -> Saves form data without full validation.
|
|
1520
|
+
* 'navigate' -> Navigates to redirectUrl.
|
|
1521
|
+
* 'api' -> Fires an API call then optionally navigates.
|
|
1522
|
+
* 'emit' -> Emits actionClick event for custom handling.
|
|
1523
|
+
* 'next' -> Advances to next step (stepper only).
|
|
1524
|
+
* 'prev' -> Goes back to previous step (stepper only).
|
|
1525
|
+
*/
|
|
1526
|
+
kind: 'submit' | 'draft' | 'navigate' | 'api' | 'emit' | 'next' | 'prev';
|
|
1527
|
+
/** URL for 'navigate' or 'api' callbacks. */
|
|
1528
|
+
redirectUrl?: string;
|
|
1529
|
+
/** API endpoint for 'api' actions. */
|
|
1530
|
+
apiUrl?: string;
|
|
1531
|
+
/** HTTP method for 'api' actions. @default 'POST' */
|
|
1532
|
+
method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1533
|
+
/** Static extra payload merged into 'api' or 'draft' requests. */
|
|
1534
|
+
extraPayload?: {
|
|
1535
|
+
[key: string]: any;
|
|
1536
|
+
};
|
|
1537
|
+
/** Snackbar messages for 'api' or 'submit'/'draft' actions. */
|
|
1538
|
+
successMessage?: string;
|
|
1539
|
+
errorMessage?: string;
|
|
1540
|
+
snackbarConfig?: {
|
|
1541
|
+
duration?: number;
|
|
1542
|
+
horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
|
|
1543
|
+
verticalPosition?: 'top' | 'bottom';
|
|
1544
|
+
showCloseButton?: boolean;
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Button configuration focusing on visuals and layout.
|
|
1549
|
+
* All logic is delegated to the 'action' property.
|
|
1550
|
+
*/
|
|
1551
|
+
interface ActionButtonConfig {
|
|
1552
|
+
/** Unique identifier for the button. */
|
|
1553
|
+
id: string;
|
|
1554
|
+
/** Label (i18n key or text). */
|
|
1555
|
+
label?: string;
|
|
1556
|
+
/** Button style variant. */
|
|
1557
|
+
variant?: ButtonVariant | string;
|
|
1558
|
+
/** Bar alignment. @default 'right' */
|
|
1559
|
+
alignment?: 'left' | 'right';
|
|
1560
|
+
/** Display order (lower = first). */
|
|
1561
|
+
order?: number;
|
|
1562
|
+
/** Visibility. @default false */
|
|
1563
|
+
hidden?: boolean;
|
|
1564
|
+
/** State. @default false */
|
|
1565
|
+
disabled?: boolean;
|
|
1566
|
+
/** Action logic. */
|
|
1567
|
+
action: ActionConfig;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Action bar configuration.
|
|
1571
|
+
*/
|
|
1572
|
+
interface ActionBarConfig {
|
|
1573
|
+
/** Flexibly ordered list of action buttons. */
|
|
1574
|
+
buttons: ActionButtonConfig[];
|
|
1575
|
+
}
|
|
1505
1576
|
interface EditConfig {
|
|
1506
1577
|
loadApiUrl: string;
|
|
1507
1578
|
submitApiUrl: string;
|
|
@@ -1526,6 +1597,7 @@ interface SectionConfig {
|
|
|
1526
1597
|
label?: string;
|
|
1527
1598
|
/** Configuration for the card-based multi-save UI (FAQ style) */
|
|
1528
1599
|
multiSaveConfig?: MultiSaveConfig;
|
|
1600
|
+
isEnabled?: boolean;
|
|
1529
1601
|
}
|
|
1530
1602
|
interface MultiSaveConfig {
|
|
1531
1603
|
/** If TRUE, enable the Save/Cancel card-based flow for this repeater */
|
|
@@ -1558,6 +1630,7 @@ interface FieldConfig {
|
|
|
1558
1630
|
subType?: string;
|
|
1559
1631
|
visible?: boolean;
|
|
1560
1632
|
visibilityExpression?: string;
|
|
1633
|
+
isEnabled?: boolean;
|
|
1561
1634
|
required?: boolean;
|
|
1562
1635
|
disabled?: boolean;
|
|
1563
1636
|
defaultValue?: any;
|
|
@@ -1646,6 +1719,7 @@ interface OptionConfig {
|
|
|
1646
1719
|
};
|
|
1647
1720
|
sortBy?: string;
|
|
1648
1721
|
sortDirection?: 'ASC' | 'DESC';
|
|
1722
|
+
layout?: 'row' | 'column';
|
|
1649
1723
|
optionList?: OptionItem[];
|
|
1650
1724
|
}
|
|
1651
1725
|
interface EmailConfig {
|
|
@@ -1662,6 +1736,8 @@ interface OptionItem {
|
|
|
1662
1736
|
label: string;
|
|
1663
1737
|
code: any;
|
|
1664
1738
|
value?: any;
|
|
1739
|
+
hint?: string;
|
|
1740
|
+
colSpan?: number;
|
|
1665
1741
|
}
|
|
1666
1742
|
interface GeneratedConfig {
|
|
1667
1743
|
formula: string;
|
|
@@ -1884,6 +1960,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
1884
1960
|
private expressionService;
|
|
1885
1961
|
private http;
|
|
1886
1962
|
private snackbarService;
|
|
1963
|
+
private router;
|
|
1887
1964
|
formJson: string;
|
|
1888
1965
|
initialValues?: {
|
|
1889
1966
|
[key: string]: any;
|
|
@@ -1900,13 +1977,25 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
1900
1977
|
[key: string]: any;
|
|
1901
1978
|
}>;
|
|
1902
1979
|
draftSave: EventEmitter<string>;
|
|
1980
|
+
/**
|
|
1981
|
+
* Emitted when a button with a custom `type` (not 'cancel', 'draft', or
|
|
1982
|
+
* 'submit') is clicked. Payload contains the button `id` and the current
|
|
1983
|
+
* form data snapshot.
|
|
1984
|
+
*/
|
|
1985
|
+
actionClick: EventEmitter<{
|
|
1986
|
+
id: string;
|
|
1987
|
+
formData: {
|
|
1988
|
+
[key: string]: any;
|
|
1989
|
+
};
|
|
1990
|
+
}>;
|
|
1903
1991
|
formSchema: FormSchema;
|
|
1904
1992
|
formGroup: FormGroup;
|
|
1905
1993
|
fieldList: FieldConfig[];
|
|
1906
1994
|
isStepper: boolean;
|
|
1907
1995
|
currentStep: number;
|
|
1908
1996
|
isLoading: boolean;
|
|
1909
|
-
|
|
1997
|
+
isDraftLoading: boolean;
|
|
1998
|
+
constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient, snackbarService: SnackbarService, router: Router);
|
|
1910
1999
|
ngOnInit(): void;
|
|
1911
2000
|
loadEditData(): void;
|
|
1912
2001
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -1915,6 +2004,12 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
1915
2004
|
initializeForm(): void;
|
|
1916
2005
|
collectFields(fields: FieldConfig[]): void;
|
|
1917
2006
|
handleSubmit(): void;
|
|
2007
|
+
/**
|
|
2008
|
+
* Universal action handler for any button click.
|
|
2009
|
+
* One handler decides how to process based on action.kind.
|
|
2010
|
+
*/
|
|
2011
|
+
handleButtonClick(btn: ActionButtonConfig): void;
|
|
2012
|
+
private fireActionApiCall;
|
|
1918
2013
|
/**
|
|
1919
2014
|
* Constructs nested payload by checking field properties on form controls.
|
|
1920
2015
|
*/
|
|
@@ -1930,7 +2025,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
1930
2025
|
private extractGroupValue;
|
|
1931
2026
|
validate(): boolean;
|
|
1932
2027
|
scrollToFirstInvalidControl(): void;
|
|
1933
|
-
submitToApi(formData: any): void;
|
|
2028
|
+
submitToApi(formData: any, actionType?: 'submit' | 'draft', btn?: ActionButtonConfig): void;
|
|
1934
2029
|
showAlert(type: 'success' | 'error' | 'warning' | 'info', message: string, customConfig?: any): void;
|
|
1935
2030
|
/** Builds HttpHeaders from the token stored in the controller (sourced from configJSON). */
|
|
1936
2031
|
getHeaders(): HttpHeaders;
|
|
@@ -1942,8 +2037,17 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
1942
2037
|
get nextLabel(): string;
|
|
1943
2038
|
get submitLabel(): string;
|
|
1944
2039
|
get previousLabel(): string;
|
|
2040
|
+
get actionBarConfig(): ActionBarConfig | undefined;
|
|
2041
|
+
/**
|
|
2042
|
+
* Returns buttons for a given alignment, sorted by `order` (stable).
|
|
2043
|
+
*/
|
|
2044
|
+
getButtonsForAlignment(alignment: 'left' | 'right'): ActionButtonConfig[];
|
|
2045
|
+
getButtonLabel(btn: ActionButtonConfig): string;
|
|
2046
|
+
isButtonDisabled(btn: ActionButtonConfig): boolean;
|
|
2047
|
+
private getButtonByActionKind;
|
|
2048
|
+
private navigateTo;
|
|
1945
2049
|
static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormComponent, never>;
|
|
1946
|
-
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; }; }, { "submit": "submit"; "draftSave": "draftSave"; }, never, never, false, never>;
|
|
2050
|
+
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; }; }, { "submit": "submit"; "draftSave": "draftSave"; "actionClick": "actionClick"; }, never, never, false, never>;
|
|
1947
2051
|
}
|
|
1948
2052
|
|
|
1949
2053
|
declare class FormSectionComponent implements OnInit, OnDestroy {
|
|
@@ -2155,6 +2259,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
2155
2259
|
* Otherwise divide 12 equally among all children (floor, min 1).
|
|
2156
2260
|
*/
|
|
2157
2261
|
getChildColSpan(child: FieldConfig): number;
|
|
2262
|
+
getOptionColSpan(option: any): number;
|
|
2158
2263
|
onRatingChange(star: number, event?: MouseEvent): void;
|
|
2159
2264
|
getStarArray(): number[];
|
|
2160
2265
|
isStarHalf(star: number): boolean;
|
|
@@ -2278,6 +2383,10 @@ declare class SideNavComponent implements OnChanges {
|
|
|
2278
2383
|
showTooltips: boolean;
|
|
2279
2384
|
/** Position of the tooltip */
|
|
2280
2385
|
tooltipPosition: TooltipPosition;
|
|
2386
|
+
/** Optional dictionary for label translation */
|
|
2387
|
+
labels?: {
|
|
2388
|
+
[key: string]: string;
|
|
2389
|
+
};
|
|
2281
2390
|
itemClicked: EventEmitter<SideNavItem>;
|
|
2282
2391
|
/** Emits whenever the collapsed state changes (supports two-way binding via [(collapsed)]) */
|
|
2283
2392
|
collapsedChange: EventEmitter<boolean>;
|
|
@@ -2285,14 +2394,14 @@ declare class SideNavComponent implements OnChanges {
|
|
|
2285
2394
|
get isHostCollapsed(): boolean;
|
|
2286
2395
|
filteredSections: SideNavSection[];
|
|
2287
2396
|
ngOnChanges(changes: SimpleChanges): void;
|
|
2288
|
-
private
|
|
2397
|
+
private filterAndMapSections;
|
|
2289
2398
|
onItemClick(item: SideNavItem, event: Event): void;
|
|
2290
2399
|
toggleCollapse(): void;
|
|
2291
2400
|
get customStyles(): {
|
|
2292
2401
|
[key: string]: string;
|
|
2293
2402
|
};
|
|
2294
2403
|
static ɵfac: i0.ɵɵFactoryDeclaration<SideNavComponent, never>;
|
|
2295
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SideNavComponent, "lib-side-nav", never, { "sections": { "alias": "sections"; "required": false; }; "userRoles": { "alias": "userRoles"; "required": false; }; "activeId": { "alias": "activeId"; "required": false; }; "styleConfig": { "alias": "styleConfig"; "required": false; }; "collapsed": { "alias": "collapsed"; "required": false; }; "width": { "alias": "width"; "required": false; }; "collapsedWidth": { "alias": "collapsedWidth"; "required": false; }; "showCollapseToggle": { "alias": "showCollapseToggle"; "required": false; }; "hideIconsWhenExpanded": { "alias": "hideIconsWhenExpanded"; "required": false; }; "showTooltips": { "alias": "showTooltips"; "required": false; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; }; }, { "itemClicked": "itemClicked"; "collapsedChange": "collapsedChange"; }, never, never, false, never>;
|
|
2404
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SideNavComponent, "lib-side-nav", never, { "sections": { "alias": "sections"; "required": false; }; "userRoles": { "alias": "userRoles"; "required": false; }; "activeId": { "alias": "activeId"; "required": false; }; "styleConfig": { "alias": "styleConfig"; "required": false; }; "collapsed": { "alias": "collapsed"; "required": false; }; "width": { "alias": "width"; "required": false; }; "collapsedWidth": { "alias": "collapsedWidth"; "required": false; }; "showCollapseToggle": { "alias": "showCollapseToggle"; "required": false; }; "hideIconsWhenExpanded": { "alias": "hideIconsWhenExpanded"; "required": false; }; "showTooltips": { "alias": "showTooltips"; "required": false; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; }, { "itemClicked": "itemClicked"; "collapsedChange": "collapsedChange"; }, never, never, false, never>;
|
|
2296
2405
|
}
|
|
2297
2406
|
|
|
2298
2407
|
declare class SideNavModule {
|