commons-shared-web-ui 0.0.58 → 0.0.59

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/index.d.ts CHANGED
@@ -3391,7 +3391,39 @@ interface TableFilter {
3391
3391
  handling?: 'standard' | 'nested_string';
3392
3392
  nestedStringConfig?: NestedStringConfig;
3393
3393
  }
3394
- interface TableActionItem {
3394
+ /**
3395
+ * A single condition evaluated against a row to decide action visibility.
3396
+ *
3397
+ * `field` is a path into the row (supports nesting + array index, e.g.
3398
+ * 'status.code', 'subStatus.code', 'name[0].text'). When the resolved value is
3399
+ * an object (e.g. `{ code, name, value }`), it is normalized to its `code`
3400
+ * (then `name`, then `value`) so the SAME rule works whether the API returns
3401
+ * `status: { code: 'ACTIVE' }` or `status: 'ACTIVE'`.
3402
+ *
3403
+ * String comparisons are case-insensitive.
3404
+ */
3405
+ interface VisibilityRule {
3406
+ /** Path into the row, e.g. 'status.code' or just 'status'. */
3407
+ field: string;
3408
+ /** Comparison operator. Default: 'eq'. */
3409
+ operator?: 'eq' | 'neq' | 'in' | 'nin' | 'truthy' | 'falsy';
3410
+ /** Comparison value for 'eq' / 'neq'. */
3411
+ value?: any;
3412
+ /** Comparison list for 'in' / 'nin'. */
3413
+ values?: any[];
3414
+ }
3415
+ /**
3416
+ * Row-aware visibility config shared by actions and action items.
3417
+ * - `visibleWhen`: ALL rules must pass (AND) for the action to show.
3418
+ * - `hiddenWhen`: if ANY rule passes (OR), the action is hidden.
3419
+ * `hiddenWhen` takes precedence over `visibleWhen`. Either may be a single
3420
+ * rule or an array of rules.
3421
+ */
3422
+ interface ActionVisibility {
3423
+ visibleWhen?: VisibilityRule | VisibilityRule[];
3424
+ hiddenWhen?: VisibilityRule | VisibilityRule[];
3425
+ }
3426
+ interface TableActionItem extends ActionVisibility {
3395
3427
  label: string;
3396
3428
  type: 'api' | 'callback' | 'route' | 'delete';
3397
3429
  icon?: string;
@@ -3413,7 +3445,7 @@ interface TableActionItem {
3413
3445
  cancelLabel?: string;
3414
3446
  };
3415
3447
  }
3416
- interface TableAction {
3448
+ interface TableAction extends ActionVisibility {
3417
3449
  label: string;
3418
3450
  type: 'api' | 'callback' | 'route' | 'edit' | 'dropdown';
3419
3451
  icon?: string;
@@ -4637,10 +4669,30 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
4637
4669
  private calculateStickyPositions;
4638
4670
  private toTitleCase;
4639
4671
  get columnCount(): number;
4640
- /** Filters out actions/action-items explicitly disabled via `isEnabled: false`. */
4672
+ /**
4673
+ * Filters out actions/action-items that are either explicitly disabled via
4674
+ * `isEnabled: false` or hidden for the given row by their `visibleWhen` /
4675
+ * `hiddenWhen` rules. Pass `row` to enable the row-aware rule evaluation;
4676
+ * omit it (e.g. for header/colspan calculations) to evaluate `isEnabled` only.
4677
+ */
4641
4678
  getVisibleActions<T extends {
4642
4679
  isEnabled?: boolean;
4643
- }>(actions?: T[] | null): T[];
4680
+ } & ActionVisibility>(actions?: T[] | null, row?: any): T[];
4681
+ /**
4682
+ * Evaluates an action's `visibleWhen` / `hiddenWhen` rules against a row.
4683
+ * `hiddenWhen` wins over `visibleWhen`. With no row or no rules, returns true.
4684
+ */
4685
+ private isActionVisibleForRow;
4686
+ /** Evaluates a single visibility rule against a row. */
4687
+ private evaluateRule;
4688
+ /**
4689
+ * Normalizes a value for comparison. Objects shaped like `{ code, name, value }`
4690
+ * collapse to their `code` (then `name`, then `value`) so a rule targeting
4691
+ * `status` works whether the API returns an object or a plain string.
4692
+ */
4693
+ private normalizeRuleValue;
4694
+ /** Case-insensitive comparison for strings; strict-ish equality otherwise. */
4695
+ private ruleValuesEqual;
4644
4696
  get showPagination(): boolean;
4645
4697
  private applyPaginationDefaults;
4646
4698
  onColumnClick(row: any, col: TableColumn): void;
@@ -4928,4 +4980,4 @@ declare class SnackbarModule {
4928
4980
  }
4929
4981
 
4930
4982
  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 };
4983
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",