commons-shared-web-ui 0.0.2 → 0.0.3

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
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges, AfterViewInit, QueryList, ElementRef, ChangeDetectorRef, NgZone } from '@angular/core';
3
3
  import * as i2$1 from '@angular/common';
4
4
  import * as i1 from '@angular/material/card';
5
5
  import * as i2 from '@angular/material/snack-bar';
@@ -34,8 +34,8 @@ import * as i29 from '@angular/cdk/accordion';
34
34
  import * as i3$1 from '@angular/forms';
35
35
  import { ControlValueAccessor, FormGroup, FormBuilder, AbstractControl, FormControl, FormArray } from '@angular/forms';
36
36
  import { Router, ActivatedRoute } from '@angular/router';
37
- import * as i3$2 from '@angular/common/http';
38
37
  import { HttpClient } from '@angular/common/http';
38
+ import { Subject } from 'rxjs';
39
39
 
40
40
  declare class MaterialModule {
41
41
  static ɵfac: i0.ɵɵFactoryDeclaration<MaterialModule, never>;
@@ -595,7 +595,7 @@ declare class ConfigurableFormComponent implements OnInit, OnChanges {
595
595
 
596
596
  declare class ConfigurableFormModule {
597
597
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurableFormModule, never>;
598
- static ɵmod: i0.ɵɵNgModuleDeclaration<ConfigurableFormModule, never, [typeof i2$1.CommonModule, typeof i3$1.ReactiveFormsModule, typeof i3$2.HttpClientModule, typeof MaterialModule, typeof ConfigurableFormComponent], [typeof ConfigurableFormComponent]>;
598
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ConfigurableFormModule, never, [typeof i2$1.CommonModule, typeof i3$1.ReactiveFormsModule, typeof MaterialModule, typeof ConfigurableFormComponent], [typeof ConfigurableFormComponent]>;
599
599
  static ɵinj: i0.ɵɵInjectorDeclaration<ConfigurableFormModule>;
600
600
  }
601
601
 
@@ -737,5 +737,193 @@ declare const PAGINATION_THEME_DARK = "theme-2";
737
737
  declare const NAV_VARIANT_DEFAULT: 'filled' | 'underline' | 'pills';
738
738
  declare const NAV_ORIENTATION_DEFAULT: 'horizontal' | 'vertical';
739
739
 
740
- export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CardType1Component, CardType2Component, CardsModule, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, FilterSidebarComponent, FilterSidebarModule, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, SharedUiModule, SummaryCardComponent, SummaryCardModule, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem };
741
- export type { AlertVariant, ButtonVariant, CardType1Config, CardType2Config, ConfirmationModalConfig, FieldType, FilterChangeEvent, FilterConfig, FilterOutput, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOption, FilterSidebarOutput, FilterSidebarSection, FilterSidebarTab, FormConfig, FormField, FormOption, FormSection, IconInput, JsonFieldConfig, JsonFormConfig, KeyType, NavItem, NavStyleConfig, OptionConfig, OptionDTO, PaginationLabels, SummaryCardConfig, SummaryCardMeta, UIConfig, UISubType, UIType, UploadedFile, ValidationRules };
740
+ interface TableOption {
741
+ label: string;
742
+ value: any;
743
+ }
744
+ interface TableColumn {
745
+ key: string;
746
+ label: string;
747
+ type: 'text' | 'number' | 'date' | 'custom' | 'html' | 'badge';
748
+ sortable?: boolean;
749
+ editable?: boolean;
750
+ dataType?: 'text' | 'number' | 'date' | 'email' | 'select';
751
+ options?: TableOption[];
752
+ badgeConfig?: {
753
+ [key: string]: 'success' | 'warning' | 'danger' | 'info' | 'neutral';
754
+ };
755
+ width?: string;
756
+ cellClass?: string;
757
+ headerClass?: string;
758
+ sticky?: boolean;
759
+ labelPath?: string;
760
+ dateFormat?: string;
761
+ }
762
+ interface TableFilter {
763
+ key: string;
764
+ label: string;
765
+ type: 'select' | 'text' | 'date';
766
+ options?: TableOption[];
767
+ apiUrl?: string;
768
+ labelKey?: string;
769
+ valueKey?: string;
770
+ labelPath?: string;
771
+ valuePath?: string;
772
+ requestKey?: string;
773
+ dataPath?: string;
774
+ }
775
+ interface TableAction {
776
+ label: string;
777
+ type: 'api' | 'callback' | 'route' | 'edit';
778
+ icon?: string;
779
+ btnVariant?: 'primary' | 'secondary' | 'outline' | 'danger' | 'warning' | 'success' | 'danger-outline';
780
+ apiUrl?: string;
781
+ apiMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
782
+ route?: string;
783
+ confirmationNeeded?: boolean;
784
+ confirmationMessage?: string;
785
+ callback?: (row: any) => void;
786
+ }
787
+ interface PaginationConfig {
788
+ enabled: boolean;
789
+ pageSize: number;
790
+ pageSizeOptions: number[];
791
+ totalCountConfig?: {
792
+ source: 'same' | 'separate';
793
+ apiUrl?: string;
794
+ responsePath?: string;
795
+ };
796
+ }
797
+ interface TableTheme {
798
+ primaryColor?: string;
799
+ headerBg?: string;
800
+ headerColor?: string;
801
+ rowHoverBg?: string;
802
+ borderColor?: string;
803
+ }
804
+ interface NestedStringConfig {
805
+ paramName: string;
806
+ baseValue?: string;
807
+ separator: string;
808
+ assignment: string;
809
+ }
810
+ interface QueryParamsConfig {
811
+ pageKey?: string;
812
+ sizeKey?: string;
813
+ pageIndexOffset?: number;
814
+ filterHandling?: 'standard' | 'nested_string';
815
+ nestedStringConfig?: NestedStringConfig;
816
+ }
817
+ interface TableConfig {
818
+ columns: TableColumn[];
819
+ apiUrl: string;
820
+ dataResponsePath?: string;
821
+ filters?: TableFilter[];
822
+ filterData?: {
823
+ [key: string]: any[];
824
+ };
825
+ pagination?: PaginationConfig;
826
+ actions?: TableAction[];
827
+ topBarButtons?: TableAction[];
828
+ sortBy?: string;
829
+ orderBy?: 'ASC' | 'DESC';
830
+ theme?: TableTheme;
831
+ requestParams?: Function;
832
+ selectable?: boolean;
833
+ queryParamsConfig?: QueryParamsConfig;
834
+ labels?: TableLabels;
835
+ searchConfig?: SearchConfig;
836
+ maxHeight?: string;
837
+ stickyHeader?: boolean;
838
+ stickyColumnCount?: number;
839
+ }
840
+ interface SearchConfig {
841
+ enabled: boolean;
842
+ searchKey?: string;
843
+ debounceTime?: number;
844
+ handling?: 'standard' | 'nested_string';
845
+ }
846
+ interface TableLabels {
847
+ searchPlaceholder?: string;
848
+ actionColumnHeader?: string;
849
+ noDataMessage?: string;
850
+ itemsPerPageLabel?: string;
851
+ defaultConfirmationMessage?: string;
852
+ }
853
+
854
+ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
855
+ private http;
856
+ private router;
857
+ private cdr;
858
+ private ngZone;
859
+ config: TableConfig;
860
+ action: EventEmitter<{
861
+ action: TableAction;
862
+ row: any;
863
+ }>;
864
+ topAction: EventEmitter<TableAction>;
865
+ filterChange: EventEmitter<{
866
+ key: string;
867
+ value: any;
868
+ }>;
869
+ rowSelect: EventEmitter<any[]>;
870
+ data: any[];
871
+ totalItems: number;
872
+ currentPage: number;
873
+ loading: boolean;
874
+ activeSort: {
875
+ key: string;
876
+ direction: 'ASC' | 'DESC';
877
+ };
878
+ activeFilters: {
879
+ [key: string]: any;
880
+ };
881
+ searchTerm: string;
882
+ selectedRows: any[];
883
+ stickyColumnStyles: {
884
+ [key: string]: any;
885
+ };
886
+ hasStickyColumns: boolean;
887
+ searchSubject: Subject<string>;
888
+ stickyHeaders: QueryList<ElementRef>;
889
+ private resizeObserver;
890
+ private locale;
891
+ constructor(http: HttpClient, router: Router, cdr: ChangeDetectorRef, ngZone: NgZone);
892
+ ngOnInit(): void;
893
+ ngOnChanges(changes: SimpleChanges): void;
894
+ ngAfterViewInit(): void;
895
+ ngOnDestroy(): void;
896
+ private setupResizeObserver;
897
+ private observeHeaders;
898
+ loadData(): void;
899
+ onPageChange(page: number): void;
900
+ onPageSizeChange(size: number): void;
901
+ onSort(col: TableColumn): void;
902
+ onSearch(event: Event): void;
903
+ onFilterChange(key: string, event: Event): void;
904
+ onAction(action: TableAction, row: any): void;
905
+ onTopAction(action: TableAction): void;
906
+ onSelectAll(event: Event): void;
907
+ onRowSelect(row: any): void;
908
+ updateSelectedRows(): void;
909
+ getCellValue(row: any, col: TableColumn): any;
910
+ getBadgeClass(row: any, col: TableColumn): string;
911
+ getSortIcon(key: string): string;
912
+ private replaceParams;
913
+ private loadFilterOptions;
914
+ private getValueByPath;
915
+ private calculateStickyPositions;
916
+ private toTitleCase;
917
+ get columnCount(): number;
918
+ static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableComponent, never>;
919
+ static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; }, never, never, false, never>;
920
+ }
921
+
922
+ declare class SmartTableModule {
923
+ static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableModule, never>;
924
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule], [typeof SmartTableComponent]>;
925
+ static ɵinj: i0.ɵɵInjectorDeclaration<SmartTableModule>;
926
+ }
927
+
928
+ export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CardType1Component, CardType2Component, CardsModule, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, FilterSidebarComponent, FilterSidebarModule, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, SharedUiModule, SmartTableComponent, SmartTableModule, SummaryCardComponent, SummaryCardModule, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem };
929
+ export type { AlertVariant, ButtonVariant, CardType1Config, CardType2Config, ConfirmationModalConfig, FieldType, FilterChangeEvent, FilterConfig, FilterOutput, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOption, FilterSidebarOutput, FilterSidebarSection, FilterSidebarTab, FormConfig, FormField, FormOption, FormSection, IconInput, JsonFieldConfig, JsonFormConfig, KeyType, NavItem, NavStyleConfig, NestedStringConfig, OptionConfig, OptionDTO, PaginationConfig, PaginationLabels, QueryParamsConfig, SearchConfig, SummaryCardConfig, SummaryCardMeta, TableAction, TableColumn, TableConfig, TableFilter, TableLabels, TableOption, TableTheme, UIConfig, UISubType, UIType, UploadedFile, ValidationRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -0,0 +1,214 @@
1
+ @use 'sass:map';
2
+
3
+ // Default Smart Table Theme
4
+ $smart-table-theme-defaults: (
5
+ // Font & General
6
+ font-family: ('Roboto', sans-serif),
7
+ font-size: 14px,
8
+ text-color: #333333,
9
+ border-radius: 8px,
10
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05),
11
+
12
+ // Table Structure
13
+ table-bg: #ffffff,
14
+ table-padding: 1rem,
15
+ cell-padding: 1rem,
16
+
17
+ // Borders
18
+ table-border: 1px solid #e0e0e0,
19
+ row-border: 1px solid #f0f0f0,
20
+ header-border: 1px solid #e0e0e0,
21
+
22
+ // Row Colors
23
+ row-bg: #ffffff,
24
+ row-hover-bg: #f9f9f9,
25
+ row-selected-bg: #f3e5f5,
26
+
27
+ // Header Styling
28
+ header-bg: #f5f5f5,
29
+ header-color: #333333,
30
+ header-font-weight: 500,
31
+ header-font-size: 14px,
32
+ header-transform: none, // uppercase, capitalize, etc.
33
+
34
+ // Toolbar
35
+ toolbar-bg: #ffffff,
36
+ toolbar-padding: 1rem,
37
+ toolbar-border-bottom: 1px solid #e0e0e0,
38
+ toolbar-gap: 1rem,
39
+
40
+ // Search Input
41
+ search-bg: #ffffff,
42
+ search-border: 1px solid #e0e0e0,
43
+ search-radius: 4px,
44
+ search-padding: 0.5rem 0.5rem 0.5rem 2rem,
45
+ search-width: 250px,
46
+ search-icon-color: #999,
47
+
48
+ // Filter Dropdowns
49
+ filter-bg: #ffffff,
50
+ filter-border: 1px solid #e0e0e0,
51
+ filter-radius: 4px,
52
+ filter-padding: 0.5rem,
53
+ filter-font-size: 14px,
54
+ filter-color: #333,
55
+
56
+ // Checkbox
57
+ checkbox-color: #6200EE,
58
+ checkbox-size: 18px,
59
+
60
+ // Badges (Status)
61
+ badge-radius: 12px,
62
+ badge-padding: 4px 12px,
63
+ badge-font-size: 12px,
64
+ badge-font-weight: 500,
65
+
66
+ // Badge Variants (Backgrounds)
67
+ badge-success-bg: #e8f5e9,
68
+ badge-success-color: #2e7d32,
69
+ badge-warning-bg: #fff3e0,
70
+ badge-warning-color: #ef6c00,
71
+ badge-danger-bg: #ffebee,
72
+ badge-danger-color: #c62828,
73
+ badge-info-bg: #e3f2fd,
74
+ badge-info-color: #1565c0,
75
+ badge-neutral-bg: #f5f5f5,
76
+ badge-neutral-color: #616161,
77
+
78
+ // Pagination Container
79
+ pagination-padding: 1rem,
80
+ pagination-border-top: none,
81
+
82
+ // Action Menu (Kebab - optional implementation detail)
83
+ action-menu-bg: #ffffff,
84
+ action-menu-shadow: 0 4px 6px rgba(0,0,0,0.1),
85
+
86
+ // Loader
87
+ loader-color: #6200EE,
88
+ // Scrollbar
89
+ scrollbar-width: 8px,
90
+ scrollbar-height: 8px,
91
+ scrollbar-track-bg: #f1f1f1,
92
+ scrollbar-track-radius: 4px,
93
+ scrollbar-thumb-bg: #c1c1c1,
94
+ scrollbar-thumb-radius: 4px,
95
+ scrollbar-thumb-hover-bg: #a8a8a8,
96
+
97
+ // Sticky Columns
98
+ sticky-shadow: 2px 0 5px -2px rgba(0,0,0,0.1),
99
+ sticky-border-right: 1px solid rgba(0,0,0,0.05),
100
+
101
+ // Spinner
102
+ spinner-border-color: rgba(0, 0, 0, 0.1),
103
+
104
+ // No Data
105
+ no-data-color: #888888,
106
+
107
+ // Sort Icon
108
+ sort-icon-size: 0.8em
109
+ );
110
+
111
+ @mixin smart-table-theme($theme: ()) {
112
+ $theme: map.merge($smart-table-theme-defaults, $theme);
113
+
114
+ // --- General ---
115
+ --st-font-family: #{map.get($theme, font-family)};
116
+ --st-font-size: #{map.get($theme, font-size)};
117
+ --st-text-color: #{map.get($theme, text-color)};
118
+ --st-border-radius: #{map.get($theme, border-radius)};
119
+ --st-box-shadow: #{map.get($theme, box-shadow)};
120
+
121
+ // --- Table Layout ---
122
+ --st-table-bg: #{map.get($theme, table-bg)};
123
+ --st-table-padding: #{map.get($theme, table-padding)};
124
+ --st-cell-padding: #{map.get($theme, cell-padding)};
125
+
126
+ // --- Borders ---
127
+ --st-table-border: #{map.get($theme, table-border)};
128
+ --st-row-border: #{map.get($theme, row-border)};
129
+
130
+ // --- Rows ---
131
+ --st-row-bg: #{map.get($theme, row-bg)};
132
+ --st-row-hover-bg: #{map.get($theme, row-hover-bg)};
133
+ --st-row-selected-bg: #{map.get($theme, row-selected-bg)};
134
+
135
+ // --- Header ---
136
+ --st-header-bg: #{map.get($theme, header-bg)};
137
+ --st-header-color: #{map.get($theme, header-color)};
138
+ --st-header-weight: #{map.get($theme, header-font-weight)};
139
+ --st-header-size: #{map.get($theme, header-font-size)};
140
+ --st-header-transform: #{map.get($theme, header-transform)};
141
+ --st-header-border: #{map.get($theme, header-border)};
142
+
143
+ // --- Toolbar ---
144
+ --st-toolbar-bg: #{map.get($theme, toolbar-bg)};
145
+ --st-toolbar-padding: #{map.get($theme, toolbar-padding)};
146
+ --st-toolbar-border-bottom: #{map.get($theme, toolbar-border-bottom)};
147
+ --st-toolbar-gap: #{map.get($theme, toolbar-gap)};
148
+
149
+ // --- Search ---
150
+ --st-search-bg: #{map.get($theme, search-bg)};
151
+ --st-search-border: #{map.get($theme, search-border)};
152
+ --st-search-radius: #{map.get($theme, search-radius)};
153
+ --st-search-padding: #{map.get($theme, search-padding)};
154
+ --st-search-width: #{map.get($theme, search-width)};
155
+ --st-search-icon-color: #{map.get($theme, search-icon-color)};
156
+
157
+ // --- Filter ---
158
+ --st-filter-bg: #{map.get($theme, filter-bg)};
159
+ --st-filter-border: #{map.get($theme, filter-border)};
160
+ --st-filter-radius: #{map.get($theme, filter-radius)};
161
+ --st-filter-padding: #{map.get($theme, filter-padding)};
162
+ --st-filter-font-size: #{map.get($theme, filter-font-size)};
163
+ --st-filter-color: #{map.get($theme, filter-color)};
164
+
165
+ // --- Checkbox ---
166
+ --st-checkbox-color: #{map.get($theme, checkbox-color)};
167
+ --st-checkbox-size: #{map.get($theme, checkbox-size)};
168
+
169
+ // --- Badges ---
170
+ --st-badge-radius: #{map.get($theme, badge-radius)};
171
+ --st-badge-padding: #{map.get($theme, badge-padding)};
172
+ --st-badge-font-size: #{map.get($theme, badge-font-size)};
173
+ --st-badge-font-weight: #{map.get($theme, badge-font-weight)};
174
+
175
+ --st-badge-success-bg: #{map.get($theme, badge-success-bg)};
176
+ --st-badge-success-color: #{map.get($theme, badge-success-color)};
177
+ --st-badge-warning-bg: #{map.get($theme, badge-warning-bg)};
178
+ --st-badge-warning-color: #{map.get($theme, badge-warning-color)};
179
+ --st-badge-danger-bg: #{map.get($theme, badge-danger-bg)};
180
+ --st-badge-danger-color: #{map.get($theme, badge-danger-color)};
181
+ --st-badge-info-bg: #{map.get($theme, badge-info-bg)};
182
+ --st-badge-info-color: #{map.get($theme, badge-info-color)};
183
+ --st-badge-neutral-bg: #{map.get($theme, badge-neutral-bg)};
184
+ --st-badge-neutral-color: #{map.get($theme, badge-neutral-color)};
185
+
186
+ // --- Pagination ---
187
+ --st-pagination-padding: #{map.get($theme, pagination-padding)};
188
+ --st-pagination-border-top: #{map.get($theme, pagination-border-top)};
189
+
190
+ // --- Loader ---
191
+ --st-loader-color: #{map.get($theme, loader-color)};
192
+
193
+ // --- Scrollbar ---
194
+ --st-scrollbar-width: #{map.get($theme, scrollbar-width)};
195
+ --st-scrollbar-height: #{map.get($theme, scrollbar-height)};
196
+ --st-scrollbar-track-bg: #{map.get($theme, scrollbar-track-bg)};
197
+ --st-scrollbar-track-radius: #{map.get($theme, scrollbar-track-radius)};
198
+ --st-scrollbar-thumb-bg: #{map.get($theme, scrollbar-thumb-bg)};
199
+ --st-scrollbar-thumb-radius: #{map.get($theme, scrollbar-thumb-radius)};
200
+ --st-scrollbar-thumb-hover-bg: #{map.get($theme, scrollbar-thumb-hover-bg)};
201
+
202
+ // --- Sticky Columns ---
203
+ --st-sticky-shadow: #{map.get($theme, sticky-shadow)};
204
+ --st-sticky-border-right: #{map.get($theme, sticky-border-right)};
205
+
206
+ // --- Spinner ---
207
+ --st-spinner-border-color: #{map.get($theme, spinner-border-color)};
208
+
209
+ // --- No Data ---
210
+ --st-no-data-color: #{map.get($theme, no-data-color)};
211
+
212
+ // --- Misc ---
213
+ --st-sort-icon-size: #{map.get($theme, sort-icon-size)};
214
+ }