commons-shared-web-ui 0.0.58 → 0.0.60
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 +203 -30
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -1
- package/index.d.ts +100 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, OnDestroy, ElementRef, QueryList, PipeTransform,
|
|
2
|
+
import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, AfterViewInit, OnDestroy, ElementRef, QueryList, PipeTransform, NgZone } 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';
|
|
@@ -258,6 +258,14 @@ interface FieldConfig {
|
|
|
258
258
|
subType?: string;
|
|
259
259
|
visible?: boolean;
|
|
260
260
|
visibilityExpression?: string;
|
|
261
|
+
/**
|
|
262
|
+
* A boolean expression string (same syntax as visibilityExpression) evaluated
|
|
263
|
+
* at runtime to dynamically toggle the `required` validator on this control.
|
|
264
|
+
* When omitted, the static `required` boolean governs validation as before —
|
|
265
|
+
* fully backwards-compatible.
|
|
266
|
+
* Example: "[12,15].indexOf(Number(sessionTypeId)) !== -1"
|
|
267
|
+
*/
|
|
268
|
+
requiredExpression?: string;
|
|
261
269
|
isEnabled?: boolean;
|
|
262
270
|
required?: boolean;
|
|
263
271
|
disabled?: boolean;
|
|
@@ -1387,10 +1395,11 @@ interface TimePickerConfig {
|
|
|
1387
1395
|
disabledColor?: string;
|
|
1388
1396
|
}
|
|
1389
1397
|
|
|
1390
|
-
declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
1398
|
+
declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
1391
1399
|
private fb;
|
|
1392
1400
|
private expressionService;
|
|
1393
1401
|
private http;
|
|
1402
|
+
private hostRef;
|
|
1394
1403
|
config: FieldConfig;
|
|
1395
1404
|
controller: SmartFormController;
|
|
1396
1405
|
/**
|
|
@@ -1446,6 +1455,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1446
1455
|
mediaDeviceInput: ElementRef<HTMLInputElement>;
|
|
1447
1456
|
/** Host div for the library picker — always in DOM, moved to body to escape parent transforms */
|
|
1448
1457
|
libraryModalRef: ElementRef<HTMLDivElement>;
|
|
1458
|
+
private portalElement;
|
|
1449
1459
|
showMediaMenu: boolean;
|
|
1450
1460
|
showYoutubeInput: boolean;
|
|
1451
1461
|
youtubeUrlInput: string;
|
|
@@ -1525,7 +1535,9 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1525
1535
|
* Priority: sectionConfig.name > field.name > camelCase(label) > '__group__'
|
|
1526
1536
|
*/
|
|
1527
1537
|
get groupKey(): string;
|
|
1528
|
-
constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient);
|
|
1538
|
+
constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>);
|
|
1539
|
+
/** Portal root, resolved from this component's own node rather than the global document. */
|
|
1540
|
+
private get portalRoot();
|
|
1529
1541
|
ngOnInit(): void;
|
|
1530
1542
|
get addMultiLabel(): string;
|
|
1531
1543
|
/** Getter for Select placeholder label */
|
|
@@ -1588,6 +1600,25 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1588
1600
|
*/
|
|
1589
1601
|
setupMatchValidation(): void;
|
|
1590
1602
|
setupVisibility(): void;
|
|
1603
|
+
/**
|
|
1604
|
+
* When config.requiredExpression is set, dynamically re-evaluates the required
|
|
1605
|
+
* validator whenever any referenced variable changes in the controller.
|
|
1606
|
+
* Fully backwards-compatible: fields without requiredExpression are unaffected.
|
|
1607
|
+
*/
|
|
1608
|
+
setupRequiredExpression(): void;
|
|
1609
|
+
/**
|
|
1610
|
+
* Returns all validators from getValidators() except Validators.required.
|
|
1611
|
+
* Used by setupRequiredExpression() to rebuild the validator list without
|
|
1612
|
+
* duplicating the required validator.
|
|
1613
|
+
*/
|
|
1614
|
+
private getValidatorsWithoutRequired;
|
|
1615
|
+
/**
|
|
1616
|
+
* trackBy function for field *ngFor loops in ROW containers.
|
|
1617
|
+
* Keying by field name (or type as fallback for unnamed containers) prevents
|
|
1618
|
+
* Angular from destroying and recreating FormFieldComponent instances on re-render,
|
|
1619
|
+
* preserving localOptionList cache and avoiding duplicate API calls.
|
|
1620
|
+
*/
|
|
1621
|
+
trackByFieldName(_: number, field: FieldConfig): string;
|
|
1591
1622
|
setupMinDateField(): void;
|
|
1592
1623
|
/**
|
|
1593
1624
|
* Wires up a dynamic minimum for a TIME field from a sibling TIME field
|
|
@@ -1684,7 +1715,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
|
|
|
1684
1715
|
/** Execute client-side or server-side dropdown search. */
|
|
1685
1716
|
private executeDropdownSearch;
|
|
1686
1717
|
/** Resets the dropdown search text and filtered list. */
|
|
1687
|
-
resetDropdownSearch(): void;
|
|
1718
|
+
resetDropdownSearch(forceLoad?: boolean, bypassCache?: boolean): void;
|
|
1688
1719
|
/** Merges option(s) from selectedOptionsData into the local dropdown options list */
|
|
1689
1720
|
mergeSelectedOptionsIntoList(): void;
|
|
1690
1721
|
/**
|
|
@@ -2034,6 +2065,14 @@ declare class FormSectionComponent implements OnInit, OnDestroy {
|
|
|
2034
2065
|
get flatFormGroup(): FormGroup;
|
|
2035
2066
|
/** Flatten a field tree to get all leaf fields (for ROW children etc.) */
|
|
2036
2067
|
getFlatFields(fields: FieldConfig[]): FieldConfig[];
|
|
2068
|
+
/**
|
|
2069
|
+
* trackBy function for field *ngFor loops.
|
|
2070
|
+
* Keying by field name (or type as fallback for unnamed containers) prevents
|
|
2071
|
+
* Angular from destroying and recreating FormFieldComponent instances when the
|
|
2072
|
+
* parent re-renders — preserving localOptionList cache and avoiding duplicate
|
|
2073
|
+
* API calls.
|
|
2074
|
+
*/
|
|
2075
|
+
trackByFieldName(_: number, field: FieldConfig): string;
|
|
2037
2076
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormSectionComponent, never>;
|
|
2038
2077
|
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>;
|
|
2039
2078
|
}
|
|
@@ -3391,7 +3430,39 @@ interface TableFilter {
|
|
|
3391
3430
|
handling?: 'standard' | 'nested_string';
|
|
3392
3431
|
nestedStringConfig?: NestedStringConfig;
|
|
3393
3432
|
}
|
|
3394
|
-
|
|
3433
|
+
/**
|
|
3434
|
+
* A single condition evaluated against a row to decide action visibility.
|
|
3435
|
+
*
|
|
3436
|
+
* `field` is a path into the row (supports nesting + array index, e.g.
|
|
3437
|
+
* 'status.code', 'subStatus.code', 'name[0].text'). When the resolved value is
|
|
3438
|
+
* an object (e.g. `{ code, name, value }`), it is normalized to its `code`
|
|
3439
|
+
* (then `name`, then `value`) so the SAME rule works whether the API returns
|
|
3440
|
+
* `status: { code: 'ACTIVE' }` or `status: 'ACTIVE'`.
|
|
3441
|
+
*
|
|
3442
|
+
* String comparisons are case-insensitive.
|
|
3443
|
+
*/
|
|
3444
|
+
interface VisibilityRule {
|
|
3445
|
+
/** Path into the row, e.g. 'status.code' or just 'status'. */
|
|
3446
|
+
field: string;
|
|
3447
|
+
/** Comparison operator. Default: 'eq'. */
|
|
3448
|
+
operator?: 'eq' | 'neq' | 'in' | 'nin' | 'truthy' | 'falsy';
|
|
3449
|
+
/** Comparison value for 'eq' / 'neq'. */
|
|
3450
|
+
value?: any;
|
|
3451
|
+
/** Comparison list for 'in' / 'nin'. */
|
|
3452
|
+
values?: any[];
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Row-aware visibility config shared by actions and action items.
|
|
3456
|
+
* - `visibleWhen`: ALL rules must pass (AND) for the action to show.
|
|
3457
|
+
* - `hiddenWhen`: if ANY rule passes (OR), the action is hidden.
|
|
3458
|
+
* `hiddenWhen` takes precedence over `visibleWhen`. Either may be a single
|
|
3459
|
+
* rule or an array of rules.
|
|
3460
|
+
*/
|
|
3461
|
+
interface ActionVisibility {
|
|
3462
|
+
visibleWhen?: VisibilityRule | VisibilityRule[];
|
|
3463
|
+
hiddenWhen?: VisibilityRule | VisibilityRule[];
|
|
3464
|
+
}
|
|
3465
|
+
interface TableActionItem extends ActionVisibility {
|
|
3395
3466
|
label: string;
|
|
3396
3467
|
type: 'api' | 'callback' | 'route' | 'delete';
|
|
3397
3468
|
icon?: string;
|
|
@@ -3413,7 +3484,7 @@ interface TableActionItem {
|
|
|
3413
3484
|
cancelLabel?: string;
|
|
3414
3485
|
};
|
|
3415
3486
|
}
|
|
3416
|
-
interface TableAction {
|
|
3487
|
+
interface TableAction extends ActionVisibility {
|
|
3417
3488
|
label: string;
|
|
3418
3489
|
type: 'api' | 'callback' | 'route' | 'edit' | 'dropdown';
|
|
3419
3490
|
icon?: string;
|
|
@@ -4637,10 +4708,30 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
|
|
|
4637
4708
|
private calculateStickyPositions;
|
|
4638
4709
|
private toTitleCase;
|
|
4639
4710
|
get columnCount(): number;
|
|
4640
|
-
/**
|
|
4711
|
+
/**
|
|
4712
|
+
* Filters out actions/action-items that are either explicitly disabled via
|
|
4713
|
+
* `isEnabled: false` or hidden for the given row by their `visibleWhen` /
|
|
4714
|
+
* `hiddenWhen` rules. Pass `row` to enable the row-aware rule evaluation;
|
|
4715
|
+
* omit it (e.g. for header/colspan calculations) to evaluate `isEnabled` only.
|
|
4716
|
+
*/
|
|
4641
4717
|
getVisibleActions<T extends {
|
|
4642
4718
|
isEnabled?: boolean;
|
|
4643
|
-
}>(actions?: T[] | null): T[];
|
|
4719
|
+
} & ActionVisibility>(actions?: T[] | null, row?: any): T[];
|
|
4720
|
+
/**
|
|
4721
|
+
* Evaluates an action's `visibleWhen` / `hiddenWhen` rules against a row.
|
|
4722
|
+
* `hiddenWhen` wins over `visibleWhen`. With no row or no rules, returns true.
|
|
4723
|
+
*/
|
|
4724
|
+
private isActionVisibleForRow;
|
|
4725
|
+
/** Evaluates a single visibility rule against a row. */
|
|
4726
|
+
private evaluateRule;
|
|
4727
|
+
/**
|
|
4728
|
+
* Normalizes a value for comparison. Objects shaped like `{ code, name, value }`
|
|
4729
|
+
* collapse to their `code` (then `name`, then `value`) so a rule targeting
|
|
4730
|
+
* `status` works whether the API returns an object or a plain string.
|
|
4731
|
+
*/
|
|
4732
|
+
private normalizeRuleValue;
|
|
4733
|
+
/** Case-insensitive comparison for strings; strict-ish equality otherwise. */
|
|
4734
|
+
private ruleValuesEqual;
|
|
4644
4735
|
get showPagination(): boolean;
|
|
4645
4736
|
private applyPaginationDefaults;
|
|
4646
4737
|
onColumnClick(row: any, col: TableColumn): void;
|
|
@@ -4928,4 +5019,4 @@ declare class SnackbarModule {
|
|
|
4928
5019
|
}
|
|
4929
5020
|
|
|
4930
5021
|
export { AlertComponent, AlertModule, ButtonComponent, ButtonDropdownComponent, ButtonDropdownModule, ButtonModule, CheckboxComponent, ClickOutsideDirective, ConfigColumnNodeComponent, ConfigFieldNodeComponent, ConfigSchemaTreeService, ConfigSectionNodeComponent, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_SIDE_NAV_TOOLTIP_POSITION, DatepickerComponent, DropdownComponent, ExpressionService, FieldConfigurationService, FieldConfiguratorComponent, FieldSelectionComponent, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FilterTableSelectorComponent, FilterTableSelectorModule, FormBuilderModule, FormComponentsModule, FormFieldConfigurationComponent, FormFieldConfigurationModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SideNavComponent, SideNavModule, SmartFormComponent, SmartFormController, smartForm_examples_d as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, TableColumnConfigurationComponent, TableColumnConfigurationModule, TableColumnConfigurationService, TimePickerComponent, TimePickerModule, TimeWheelPanelComponent, ToggleComponent, ValidationUtils, appendBaseUrlRecursively, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
|
|
4931
|
-
export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfigColumnNode, ConfigFieldNode, ConfigSectionNode, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldEventPayload, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, HierarchyCfg, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SuffixActionIcon, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableColumnSubField, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableRowSaveEvent, TableTheme, TextConfig, TimeMode, TimePickerConfig, TimePickerLabels, TimePickerVariant, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
|
|
5022
|
+
export type { ActionVisibility, AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfigColumnNode, ConfigFieldNode, ConfigSectionNode, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldEventPayload, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, HierarchyCfg, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SuffixActionIcon, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableColumnSubField, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableRowSaveEvent, TableTheme, TextConfig, TimeMode, TimePickerConfig, TimePickerLabels, TimePickerVariant, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules, VisibilityRule };
|