commons-shared-web-ui 0.0.24 → 0.0.25

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
@@ -6,7 +6,7 @@ import { FormGroup, FormBuilder, FormArray, FormControl, ValidatorFn, ControlVal
6
6
  import { HttpClient, HttpHeaders } from '@angular/common/http';
7
7
  import * as i3$2 from '@angular/router';
8
8
  import { Router, ActivatedRoute } from '@angular/router';
9
- import { Observable, Subject } from 'rxjs';
9
+ import { BehaviorSubject, Subject, Observable } from 'rxjs';
10
10
  import * as i2 from '@angular/material/snack-bar';
11
11
  import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
12
12
  import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@@ -921,7 +921,10 @@ declare class SmartFormController {
921
921
  labels: any;
922
922
  /** Custom label keys for form actions (Next, Submit, Add, etc.) */
923
923
  actionLabels?: FormLabels;
924
- private fieldSubjects;
924
+ fieldSubjects: Map<string, BehaviorSubject<any>>;
925
+ fileAdded$: Subject<any>;
926
+ fileUploadFinished$: Subject<any>;
927
+ fileRemoved$: Subject<any>;
925
928
  initialize(initialData: {
926
929
  [key: string]: any;
927
930
  }): void;
@@ -1013,6 +1016,9 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1013
1016
  valueChange: EventEmitter<{
1014
1017
  [key: string]: any;
1015
1018
  }>;
1019
+ fileAdded: EventEmitter<any>;
1020
+ fileUploadFinished: EventEmitter<any>;
1021
+ fileRemoved: EventEmitter<any>;
1016
1022
  formSchema: FormSchema;
1017
1023
  formGroup: FormGroup;
1018
1024
  fieldList: FieldConfig[];
@@ -1072,7 +1078,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1072
1078
  private getButtonByActionKind;
1073
1079
  private navigateTo;
1074
1080
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormComponent, never>;
1075
- 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"; "valueChange": "valueChange"; }, never, never, false, never>;
1081
+ 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"; "valueChange": "valueChange"; "fileAdded": "fileAdded"; "fileUploadFinished": "fileUploadFinished"; "fileRemoved": "fileRemoved"; }, never, never, false, never>;
1076
1082
  }
1077
1083
 
1078
1084
  declare class FormSectionComponent implements OnInit, OnDestroy {
@@ -1845,7 +1851,7 @@ interface RadioConfig {
1845
1851
  disabled?: boolean;
1846
1852
  required?: boolean;
1847
1853
  labelPosition?: 'before' | 'after';
1848
- color?: 'primary' | 'accent' | 'warn';
1854
+ color?: 'primary' | 'warning' | 'danger' | 'success' | 'accent' | 'warn' | string;
1849
1855
  layout?: 'vertical' | 'horizontal';
1850
1856
  gap?: string;
1851
1857
  labelColor?: string;
@@ -1872,7 +1878,7 @@ declare class RadioComponent implements ControlValueAccessor, OnInit {
1872
1878
  disabled: boolean;
1873
1879
  required: boolean;
1874
1880
  labelPosition: 'before' | 'after';
1875
- color: 'primary' | 'accent' | 'warn';
1881
+ color: 'primary' | 'warning' | 'danger' | 'success' | 'accent' | 'warn' | string;
1876
1882
  layout: 'vertical' | 'horizontal';
1877
1883
  labels: RadioLabels;
1878
1884
  gap?: string;
@@ -1904,8 +1910,9 @@ declare class RadioComponent implements ControlValueAccessor, OnInit {
1904
1910
  registerOnChange(fn: any): void;
1905
1911
  registerOnTouched(fn: any): void;
1906
1912
  setDisabledState(isDisabled: boolean): void;
1907
- onRadioChange(event: any): void;
1913
+ onRadioChange(option: RadioOption): void;
1908
1914
  private getStyleValue;
1915
+ private getThemeColor;
1909
1916
  get wrapperStyles(): {
1910
1917
  [key: string]: string | undefined;
1911
1918
  };
@@ -1922,7 +1929,7 @@ interface ToggleConfig {
1922
1929
  disabled?: boolean;
1923
1930
  required?: boolean;
1924
1931
  labelPosition?: 'before' | 'after';
1925
- color?: string;
1932
+ color?: 'primary' | 'warning' | 'danger' | 'success' | string;
1926
1933
  uncheckedColor?: string;
1927
1934
  checkedColor?: string;
1928
1935
  thumbColor?: string;
@@ -1976,6 +1983,7 @@ declare class ToggleComponent implements ControlValueAccessor, OnInit, OnChanges
1976
1983
  setDisabledState(isDisabled: boolean): void;
1977
1984
  onToggleChange(event: any): void;
1978
1985
  private getStyleValue;
1986
+ private getThemeColor;
1979
1987
  get wrapperStyles(): {
1980
1988
  [key: string]: string | undefined;
1981
1989
  };
@@ -2339,6 +2347,8 @@ declare class ButtonDropdownComponent {
2339
2347
  declare class ConfirmationModalComponent implements OnInit, OnDestroy {
2340
2348
  config: ConfirmationModalConfig;
2341
2349
  isOpen: boolean;
2350
+ confirmDisabled: boolean;
2351
+ confirmLoading: boolean;
2342
2352
  confirm: EventEmitter<void>;
2343
2353
  cancel: EventEmitter<void>;
2344
2354
  close: EventEmitter<void>;
@@ -2346,6 +2356,7 @@ declare class ConfirmationModalComponent implements OnInit, OnDestroy {
2346
2356
  private defaultConfig;
2347
2357
  mergedConfig: ConfirmationModalConfig;
2348
2358
  private previousActiveElement;
2359
+ private isSubmitting;
2349
2360
  ngOnInit(): void;
2350
2361
  ngOnChanges(): void;
2351
2362
  private updateConfig;
@@ -2364,7 +2375,7 @@ declare class ConfirmationModalComponent implements OnInit, OnDestroy {
2364
2375
  getIconValue(icon: any): string;
2365
2376
  getIconColor(icon: any): string | undefined;
2366
2377
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationModalComponent, never>;
2367
- static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationModalComponent, "cc-confirmation-modal", never, { "config": { "alias": "config"; "required": false; }; "isOpen": { "alias": "isOpen"; "required": false; }; }, { "confirm": "confirm"; "cancel": "cancel"; "close": "close"; "showCodeSnippet": "showCodeSnippet"; }, never, ["*", "[cc-modal-footer]"], false, never>;
2378
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationModalComponent, "cc-confirmation-modal", never, { "config": { "alias": "config"; "required": false; }; "isOpen": { "alias": "isOpen"; "required": false; }; "confirmDisabled": { "alias": "confirmDisabled"; "required": false; }; "confirmLoading": { "alias": "confirmLoading"; "required": false; }; }, { "confirm": "confirm"; "cancel": "cancel"; "close": "close"; "showCodeSnippet": "showCodeSnippet"; }, never, ["*", "[cc-modal-footer]"], false, never>;
2368
2379
  }
2369
2380
 
2370
2381
  declare class ConfirmationModalModule {
@@ -3128,7 +3139,7 @@ interface TableFilter {
3128
3139
  }
3129
3140
  interface TableActionItem {
3130
3141
  label: string;
3131
- type: 'api' | 'callback' | 'route';
3142
+ type: 'api' | 'callback' | 'route' | 'delete';
3132
3143
  icon?: string;
3133
3144
  apiUrl?: string;
3134
3145
  apiMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
@@ -3136,6 +3147,15 @@ interface TableActionItem {
3136
3147
  confirmationNeeded?: boolean;
3137
3148
  confirmationMessage?: string;
3138
3149
  callback?: (row: any) => void;
3150
+ /** Config for native 'delete' action type — drives the built-in confirmation modal */
3151
+ deleteConfig?: {
3152
+ apiUrl: string;
3153
+ idField?: string;
3154
+ modalTitle?: string;
3155
+ modalMessage?: string;
3156
+ confirmLabel?: string;
3157
+ cancelLabel?: string;
3158
+ };
3139
3159
  }
3140
3160
  interface TableAction {
3141
3161
  label: string;
@@ -3182,7 +3202,7 @@ interface QueryParamsConfig {
3182
3202
  }
3183
3203
  interface TableConfig {
3184
3204
  columns: TableColumn[];
3185
- apiUrl: string;
3205
+ apiUrl?: string;
3186
3206
  apiMethod?: 'GET' | 'POST';
3187
3207
  apiPayload?: any;
3188
3208
  dataResponsePath?: string;
@@ -3220,6 +3240,22 @@ interface TableLabels {
3220
3240
  itemsPerPageLabel?: string;
3221
3241
  defaultConfirmationMessage?: string;
3222
3242
  }
3243
+ /**
3244
+ * Emitted by the SmartTableComponent when operating in external-data mode
3245
+ * (i.e. when [tableData] input is provided by the parent).
3246
+ * The parent is responsible for fetching updated data based on this event
3247
+ * and providing it back via [tableData] and [totalItemsCount].
3248
+ */
3249
+ interface TableDataChangeEvent {
3250
+ page: number;
3251
+ pageSize: number;
3252
+ sortBy?: string;
3253
+ orderBy?: 'ASC' | 'DESC';
3254
+ searchTerm?: string;
3255
+ filters?: {
3256
+ [key: string]: any;
3257
+ };
3258
+ }
3223
3259
 
3224
3260
  declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
3225
3261
  private http;
@@ -3227,6 +3263,18 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3227
3263
  private cdr;
3228
3264
  private ngZone;
3229
3265
  config: TableConfig;
3266
+ /**
3267
+ * External data mode: pass table rows directly from the parent.
3268
+ * When this input is provided, the component will NOT make any internal API calls.
3269
+ * Instead, it emits sortChange / pageChange / searchChange / filterChange events
3270
+ * so the parent can fetch and supply updated data.
3271
+ */
3272
+ tableData?: any[];
3273
+ /**
3274
+ * Total number of items — used by the pagination component when operating in
3275
+ * external-data mode. Must be kept in sync by the parent.
3276
+ */
3277
+ totalItemsCount?: number;
3230
3278
  action: EventEmitter<{
3231
3279
  action: TableAction;
3232
3280
  row: any;
@@ -3241,6 +3289,12 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3241
3289
  row: any;
3242
3290
  column: string;
3243
3291
  }>;
3292
+ /** Emitted in external-data mode when the user changes the sort column/direction. */
3293
+ sortChange: EventEmitter<TableDataChangeEvent>;
3294
+ /** Emitted in external-data mode when the user changes the page or page size. */
3295
+ pageChange: EventEmitter<TableDataChangeEvent>;
3296
+ /** Emitted in external-data mode when the user types in the search box. */
3297
+ searchChange: EventEmitter<TableDataChangeEvent>;
3244
3298
  data: any[];
3245
3299
  totalItems: number;
3246
3300
  currentPage: number;
@@ -3260,6 +3314,14 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3260
3314
  };
3261
3315
  hasStickyColumns: boolean;
3262
3316
  openDropdownId: string | null;
3317
+ /** Viewport-relative position used to render the dropdown as position:fixed. */
3318
+ dropdownPosition: {
3319
+ top: number;
3320
+ right: number;
3321
+ };
3322
+ deleteModalOpen: boolean;
3323
+ deleteModalConfig: any;
3324
+ private pendingDeleteAction;
3263
3325
  searchSubject: Subject<string>;
3264
3326
  stickyHeaders: QueryList<ElementRef>;
3265
3327
  private resizeObserver;
@@ -3277,8 +3339,17 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3277
3339
  onSort(col: TableColumn): void;
3278
3340
  onSearch(event: Event): void;
3279
3341
  onFilterChange(key: string, event: Event): void;
3342
+ /**
3343
+ * Assembles the current table state into a `TableDataChangeEvent` object.
3344
+ * Emitted to the parent in external-data mode so it can fetch and supply new data.
3345
+ */
3346
+ private buildChangeEvent;
3280
3347
  onAction(action: TableAction, row: any): void;
3281
3348
  onActionItemClick(item: any, row: any, event: Event): void;
3349
+ private openDeleteConfirmModal;
3350
+ deleteModalMessage: string;
3351
+ onDeleteConfirm(): void;
3352
+ onDeleteCancel(): void;
3282
3353
  onTopAction(action: TableAction): void;
3283
3354
  private executeApiAction;
3284
3355
  onSelectAll(event: Event): void;
@@ -3298,12 +3369,12 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3298
3369
  toggleDropdown(id: string, event: Event): void;
3299
3370
  closeDropdown(): void;
3300
3371
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableComponent, never>;
3301
- static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; "columnClick": "columnClick"; }, never, never, false, never>;
3372
+ static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; "tableData": { "alias": "tableData"; "required": false; }; "totalItemsCount": { "alias": "totalItemsCount"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; "columnClick": "columnClick"; "sortChange": "sortChange"; "pageChange": "pageChange"; "searchChange": "searchChange"; }, never, never, false, never>;
3302
3373
  }
3303
3374
 
3304
3375
  declare class SmartTableModule {
3305
3376
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableModule, never>;
3306
- static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof MaterialModule], [typeof SmartTableComponent]>;
3377
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof MaterialModule, typeof ConfirmationModalModule], [typeof SmartTableComponent]>;
3307
3378
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartTableModule>;
3308
3379
  }
3309
3380
 
@@ -3357,4 +3428,4 @@ declare class SnackbarModule {
3357
3428
  }
3358
3429
 
3359
3430
  export { AlertComponent, AlertModule, ButtonComponent, ButtonDropdownComponent, ButtonDropdownModule, ButtonModule, CheckboxComponent, 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, FieldConfiguratorComponent, FieldSelectionComponent, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FormBuilderModule, FormComponentsModule, 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, ToggleComponent, ValidationUtils, appendBaseUrlRecursively, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
3360
- export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, 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, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableConfig, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
3431
+ export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, 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, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -13,7 +13,7 @@ $default-confirmation-modal-config: (
13
13
  // 24px
14
14
  header-border-bottom: 0.0625rem solid #E5E7EB,
15
15
  // 1px
16
- title-font-size: 1.25rem,
16
+ title-font-size: 0.875rem,
17
17
  // 20px
18
18
  title-font-weight: 600,
19
19
  title-color: #111827,
@@ -1,4 +1,5 @@
1
1
  @use 'sass:map';
2
+ @use '../confirmation-modal/confirmation-modal.theme' as confirmation-modal;
2
3
 
3
4
  // Default Smart Table Theme
4
5
  $smart-table-theme-defaults: (
@@ -215,4 +216,7 @@ $smart-table-theme-defaults: (
215
216
 
216
217
  // --- Misc ---
217
218
  --st-sort-icon-size: #{map.get($theme, sort-icon-size)};
219
+
220
+ // --- Confirmation Modal (bundled so delete modal renders correctly) ---
221
+ @include confirmation-modal.confirmation-modal-theme();
218
222
  }