commons-shared-web-ui 0.0.53 → 0.0.54

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.
Files changed (214) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +14823 -0
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
  3. package/index.d.ts +4679 -0
  4. package/package.json +34 -53
  5. package/.claude/settings.local.json +0 -10
  6. package/documentation/alert.md +0 -123
  7. package/documentation/button-dropdown.md +0 -126
  8. package/documentation/button.md +0 -184
  9. package/documentation/cards-usage-guidelines.md +0 -131
  10. package/documentation/configurable-form.md +0 -605
  11. package/documentation/confirmation-modal.md +0 -250
  12. package/documentation/filter-sidebar.md +0 -178
  13. package/documentation/filter-table-selector.md +0 -228
  14. package/documentation/form-builder.md +0 -599
  15. package/documentation/form-components.md +0 -384
  16. package/documentation/form-field-configuration.md +0 -250
  17. package/documentation/nav.md +0 -427
  18. package/documentation/pagination.md +0 -181
  19. package/documentation/side-nav-documentation.md +0 -169
  20. package/documentation/smart-form.md +0 -2532
  21. package/documentation/smart-table.md +0 -1221
  22. package/documentation/snackbar.md +0 -118
  23. package/documentation/style-externalization.md +0 -88
  24. package/documentation/summary-card.md +0 -279
  25. package/documentation/table-column-configuration.md +0 -221
  26. package/ng-package.json +0 -28
  27. package/src/lib/modules/alert/alert.models.ts +0 -6
  28. package/src/lib/modules/alert/alert.module.ts +0 -16
  29. package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
  30. package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
  31. package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
  32. package/src/lib/modules/button/button.models.ts +0 -13
  33. package/src/lib/modules/button/button.module.ts +0 -16
  34. package/src/lib/modules/button/components/button/button.component.html +0 -22
  35. package/src/lib/modules/button/components/button/button.component.scss +0 -88
  36. package/src/lib/modules/button/components/button/button.component.ts +0 -67
  37. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
  38. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
  39. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +0 -87
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
  41. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
  42. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
  44. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
  45. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
  46. package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
  47. package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
  48. package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
  50. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
  51. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
  52. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
  53. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
  54. package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
  55. package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
  56. package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
  57. package/src/lib/modules/filter/filter.models.ts +0 -88
  58. package/src/lib/modules/filter/filter.module.ts +0 -24
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
  61. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
  62. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
  63. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
  66. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
  67. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
  68. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
  74. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
  76. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
  77. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
  79. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
  80. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
  82. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
  83. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
  85. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
  86. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
  88. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
  89. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
  90. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
  91. package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
  92. package/src/lib/modules/form-builder/index.ts +0 -9
  93. package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
  94. package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
  95. package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
  96. package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
  97. package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
  98. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
  99. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
  100. package/src/lib/modules/form-builder/utils/constants.ts +0 -43
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
  103. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
  104. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
  107. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
  108. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
  111. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
  112. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
  113. package/src/lib/modules/form-components/components/input/input.component.html +0 -51
  114. package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
  115. package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
  116. package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
  117. package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
  118. package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
  119. package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
  120. package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
  121. package/src/lib/modules/form-components/components/search/search.component.html +0 -15
  122. package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
  123. package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
  124. package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
  126. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
  127. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
  128. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
  129. package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
  130. package/src/lib/modules/form-components/form-components.module.ts +0 -41
  131. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +0 -89
  132. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +0 -68
  133. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +0 -73
  134. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +0 -34
  135. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +0 -78
  136. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +0 -83
  137. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +0 -94
  138. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +0 -38
  139. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +0 -42
  140. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +0 -92
  141. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +0 -23
  142. package/src/lib/modules/form-field-configuration/index.ts +0 -7
  143. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +0 -62
  144. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +0 -148
  145. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +0 -228
  146. package/src/lib/modules/material/material.module.ts +0 -94
  147. package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
  148. package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
  149. package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
  150. package/src/lib/modules/nav/nav.models.ts +0 -31
  151. package/src/lib/modules/nav/nav.module.ts +0 -17
  152. package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
  153. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
  154. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
  155. package/src/lib/modules/pagination/pagination.module.ts +0 -17
  156. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
  157. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
  158. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
  159. package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
  160. package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
  161. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1196
  162. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2014
  163. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -2782
  164. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
  165. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
  166. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
  167. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
  168. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
  169. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1131
  170. package/src/lib/modules/smart-form/index.ts +0 -10
  171. package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -749
  172. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
  173. package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
  174. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -67
  175. package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
  176. package/src/lib/modules/smart-form/smart-form.module.ts +0 -36
  177. package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
  178. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
  179. package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
  181. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
  182. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
  183. package/src/lib/modules/smart-table/models/table-config.model.ts +0 -213
  184. package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
  185. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
  186. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
  187. package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
  188. package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
  189. package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
  190. package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
  191. package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
  192. package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
  193. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
  194. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
  195. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
  196. package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
  197. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +0 -53
  198. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +0 -47
  199. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +0 -50
  200. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +0 -33
  201. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +0 -30
  202. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +0 -36
  203. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +0 -78
  204. package/src/lib/modules/table-column-configuration/index.ts +0 -5
  205. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +0 -20
  206. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +0 -77
  207. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +0 -21
  208. package/src/lib/shared-ui.module.ts +0 -50
  209. package/src/lib/utils/constants.ts +0 -11
  210. package/src/lib/utils/storage.utils.ts +0 -37
  211. package/src/lib/utils/string.utils.ts +0 -23
  212. package/src/lib/utils/translation.utils.ts +0 -87
  213. package/src/public-api.ts +0 -121
  214. package/tsconfig.lib.json +0 -15
@@ -1,361 +0,0 @@
1
- import {
2
- Component,
3
- Input,
4
- Output,
5
- EventEmitter,
6
- OnInit,
7
- OnChanges,
8
- SimpleChanges,
9
- OnDestroy,
10
- ChangeDetectorRef,
11
- NgZone,
12
- } from '@angular/core';
13
- import { Subject } from 'rxjs';
14
-
15
- import {
16
- FilterTableSelectorConfig,
17
- FilterParamMap,
18
- } from '../../filter-table-selector.models';
19
- import { FilterTableConfig } from '../../filter-table-selector.models';
20
-
21
- @Component({
22
- selector: 'lib-filter-table-selector',
23
- templateUrl: './filter-table-selector.component.html',
24
- styleUrls: ['./filter-table-selector.component.scss'],
25
- standalone: false,
26
- })
27
- export class FilterTableSelectorComponent implements OnInit, OnChanges, OnDestroy {
28
- /** Full config object driven by consuming MFE JSON. */
29
- @Input() config!: FilterTableSelectorConfig;
30
-
31
- /**
32
- * Flat i18n labels map from the consuming MFE.
33
- * Mirrors the pattern used by SmartFormComponent.
34
- */
35
- @Input() labels: Record<string, string> = {};
36
-
37
- /**
38
- * Pre-selected row identifiers.
39
- * When provided, matching rows are pre-checked on first load and
40
- * re-checked after each page navigation.
41
- * Must be an array of row objects (the same shape returned by the API).
42
- */
43
- @Input() preSelectedRows: any[] = [];
44
-
45
- /** Emits the array of currently selected row objects on "Add / Submit". */
46
- @Output() onSubmit = new EventEmitter<any[]>();
47
-
48
- /** Emits void on "Back / Cancel". */
49
- @Output() onCancel = new EventEmitter<void>();
50
-
51
- // ── Internal state ──────────────────────────────────────────────────────────
52
-
53
- /** A deep-copy of tableConfig with the current filter params baked-in. */
54
- resolvedTableConfig!: FilterTableConfig;
55
-
56
- /** Current active filter params (merged from form submission). */
57
- activeFilterParams: Record<string, string> = {};
58
-
59
- /** The base API URL without any filter query params. */
60
- private baseApiUrl: string = '';
61
-
62
- /** All rows selected so far, tracked across pagination pages. */
63
- selectedRows: any[] = [];
64
-
65
- /** Total rows currently loaded in the table (reported by SmartTable rowSelect). */
66
- totalTableItems: number = 0;
67
-
68
- /** Serialised SmartForm JSON (with labels translated + disabled fields applied). */
69
- resolvedFormJson: string = '';
70
-
71
- /**
72
- * Default values to prefill the SmartForm.
73
- * Updated on each initialize() call and reset to config defaults on Clear Filter.
74
- */
75
- resolvedInitialValues: Record<string, any> = {};
76
-
77
- /**
78
- * Version counter — bumping this forces *ngIf to re-create the SmartForm
79
- * component with fresh initial values (used by Clear Filter).
80
- */
81
- formVersion: number = 0;
82
-
83
- /** Whether the filter panel is visible (toggled on mobile, always visible on desktop). */
84
- filterPanelVisible: boolean = true;
85
-
86
- /**
87
- * Tracks the live form values as the user changes fields.
88
- * Updated via SmartForm's (valueChange) output.
89
- * Used when the user clicks the "Apply Filter" button in the component.
90
- */
91
- currentFormValues: Record<string, any> = {};
92
-
93
- private destroy$ = new Subject<void>();
94
-
95
- constructor(private cdr: ChangeDetectorRef, private ngZone: NgZone) { }
96
-
97
- // ── Lifecycle ────────────────────────────────────────────────────────────────
98
-
99
- ngOnInit(): void {
100
- this.initialize();
101
- }
102
-
103
- ngOnChanges(changes: SimpleChanges): void {
104
- if (changes['config'] && !changes['config'].isFirstChange()) {
105
- this.initialize();
106
- }
107
- if (changes['preSelectedRows'] && !changes['preSelectedRows'].isFirstChange()) {
108
- this.syncPreselection();
109
- }
110
- if (changes['labels'] && !changes['labels'].isFirstChange()) {
111
- this.buildFormJson();
112
- this.applyFilterParamsToTable();
113
- }
114
- }
115
-
116
- ngOnDestroy(): void {
117
- this.destroy$.next();
118
- this.destroy$.complete();
119
- }
120
-
121
- // ── Initialisation ───────────────────────────────────────────────────────────
122
-
123
- private initialize(): void {
124
- if (!this.config) return;
125
-
126
- this.baseApiUrl = this.config.tableConfig.apiUrl || '';
127
- this.selectedRows = [...(this.preSelectedRows || [])];
128
-
129
- const defaults = this.config.filterConfig.defaultValues || {};
130
-
131
- // Build default filter params from defaultValues for the initial API call
132
- this.activeFilterParams = this.buildFilterParams(defaults);
133
-
134
- // Synchronize currentFormValues so Apply Filter works even if no changes are made yet
135
- this.currentFormValues = { ...defaults };
136
-
137
- this.buildFormJson();
138
- this.applyFilterParamsToTable();
139
-
140
- // Bump version to force SmartForm re-creation with the new defaultValues
141
- this.formVersion++;
142
- }
143
-
144
- // ── Form JSON construction ───────────────────────────────────────────────────
145
-
146
- /**
147
- * Serialises the SmartForm config JSON.
148
- * Applies disabledFields from filterPanelConfig.
149
- */
150
- private buildFormJson(overrideValues?: Record<string, any>): void {
151
- if (!this.config?.filterConfig?.smartFormConfig) return;
152
-
153
- // Deep-clone to avoid mutating the original config
154
- const schema = JSON.parse(
155
- JSON.stringify(this.config.filterConfig.smartFormConfig)
156
- );
157
-
158
- // Apply disabled fields and TRANSLATE LABELS
159
- const disabled = this.config.filterConfig.disabledFields || [];
160
- if (schema.sectionConfig?.children) {
161
- schema.sectionConfig.children = schema.sectionConfig.children.map(
162
- (field: any) => {
163
- // Translate label and placeholder
164
- if (field.label) field.label = this.translate(field.label);
165
- if (field.placeholder) field.placeholder = this.translate(field.placeholder);
166
-
167
- if (disabled.includes(field.name)) {
168
- return { ...field, disabled: true };
169
- }
170
- return field;
171
- }
172
- );
173
- }
174
-
175
- this.resolvedFormJson = JSON.stringify(schema);
176
-
177
- // Use override (e.g. after clear) or fall back to config defaults
178
- const values = overrideValues !== undefined
179
- ? overrideValues
180
- : { ...(this.config.filterConfig.defaultValues || {}) };
181
- this.resolvedInitialValues = values;
182
- }
183
-
184
- // ── Table URL resolution ─────────────────────────────────────────────────────
185
-
186
- /**
187
- * Rebuilds resolvedTableConfig with the current activeFilterParams appended
188
- * to the base API URL.
189
- */
190
- private applyFilterParamsToTable(): void {
191
- const paramString = Object.entries(this.activeFilterParams)
192
- .filter(([, v]) => v !== null && v !== undefined && v !== '')
193
- .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
194
- .join('&');
195
-
196
- const separator = this.baseApiUrl.includes('?') ? '&' : '?';
197
- const newUrl = paramString
198
- ? `${this.baseApiUrl}${separator}${paramString}`
199
- : this.baseApiUrl;
200
-
201
- // Translate Column Labels
202
- const translatedColumns = (this.config.tableConfig.columns || []).map(col => ({
203
- ...col,
204
- label: this.translate(col.label)
205
- }));
206
-
207
- // Assign a new object reference so SmartTable's ngOnChanges fires
208
- this.resolvedTableConfig = {
209
- ...this.config.tableConfig,
210
- columns: translatedColumns,
211
- apiUrl: newUrl,
212
- selectable: true,
213
- multiSelect: this.config.selectionConfig.multiSelect,
214
- };
215
- }
216
-
217
- // ── Filter param helpers ─────────────────────────────────────────────────────
218
-
219
- /**
220
- * Converts a flat form-value map to API param key/value pairs
221
- * using the configured filterParamMapping.
222
- */
223
- private buildFilterParams(
224
- formValues: Record<string, any>
225
- ): Record<string, string> {
226
- const mapping = this.config.filterConfig.filterParamMapping || [];
227
- const params: Record<string, string> = {};
228
-
229
- mapping.forEach((map: FilterParamMap) => {
230
- const rawVal = formValues[map.formFieldName];
231
- if (rawVal !== null && rawVal !== undefined && rawVal !== '') {
232
- // Support arrays (multiselect) → comma-separated
233
- const val = Array.isArray(rawVal) ? rawVal.join(',') : String(rawVal);
234
- params[map.apiParamKey] = val;
235
- }
236
- });
237
-
238
- return params;
239
- }
240
-
241
- // ── SmartForm event handlers ─────────────────────────────────────────────────
242
-
243
- /**
244
- * Called every time a form field value changes (SmartForm valueChange output).
245
- * We track the current values so the component-level "Apply Filter" button
246
- * can read them without relying on a form submit button inside the JSON config.
247
- */
248
- onFormValueChange(values: Record<string, any>): void {
249
- this.currentFormValues = values || {};
250
- }
251
-
252
- /**
253
- * Called when the user clicks the "Apply Filter" button rendered by the component.
254
- * Builds API params from the tracked form values and reloads the table.
255
- */
256
- applyCurrentFilter(): void {
257
- this.activeFilterParams = this.buildFilterParams(this.currentFormValues);
258
- this.applyFilterParamsToTable();
259
- }
260
-
261
- /**
262
- * Clear Filter: resets form to default values (preserving disabled-field values),
263
- * reloads the table with default params.
264
- * The form is re-created via formVersion bump so SmartForm gets fresh initialValues.
265
- */
266
- onClearFilter(): void {
267
- const defaults = this.config.filterConfig.defaultValues || {};
268
- const disabled = this.config.filterConfig.disabledFields || [];
269
-
270
- // Build reset values: keep default values for disabled fields, clear the rest
271
- const resetValues: Record<string, any> = {};
272
- disabled.forEach(fieldName => {
273
- if (defaults[fieldName] !== undefined) {
274
- resetValues[fieldName] = defaults[fieldName];
275
- }
276
- });
277
-
278
- this.currentFormValues = { ...resetValues };
279
- this.activeFilterParams = this.buildFilterParams(resetValues);
280
-
281
- // Destroy and recreate SmartForm with clean initial values
282
- this.resolvedFormJson = '';
283
- this.formVersion++;
284
-
285
- // Use NgZone + setTimeout to ensure the *ngIf toggles in one tick, then re-renders
286
- this.ngZone.run(() => {
287
- setTimeout(() => {
288
- this.buildFormJson(resetValues);
289
- this.applyFilterParamsToTable();
290
- }, 0);
291
- });
292
- }
293
-
294
- // ── SmartTable event handlers ────────────────────────────────────────────────
295
-
296
- /**
297
- * Called by SmartTable's (rowSelect) output.
298
- * Merges page-level selection with the cross-page tracking set.
299
- */
300
- onRowSelect(globalSelection: any[]): void {
301
- this.selectedRows = globalSelection || [];
302
- }
303
-
304
- /**
305
- * Syncs preSelectedRows into the local selectedRows (called when input changes).
306
- */
307
- private syncPreselection(): void {
308
- this.selectedRows = [...(this.preSelectedRows || [])];
309
- }
310
-
311
- // ── Action handlers ──────────────────────────────────────────────────────────
312
-
313
- handleSubmit(): void {
314
- this.onSubmit.emit([...this.selectedRows]);
315
- }
316
-
317
- handleCancel(): void {
318
- this.onCancel.emit();
319
- }
320
-
321
- // ── Label helpers ─────────────────────────────────────────────────────────────
322
-
323
- translate(key: string): string {
324
- return this.labels[key] || key;
325
- }
326
-
327
- get titleLabel(): string {
328
- return this.translate(this.config?.title || '');
329
- }
330
-
331
- get submitButtonLabel(): string {
332
- return this.translate(this.config?.selectionConfig?.submitButtonLabel || '');
333
- }
334
-
335
- get cancelButtonLabel(): string {
336
- return this.translate(this.config?.selectionConfig?.cancelButtonLabel || '');
337
- }
338
-
339
- get clearFilterButtonLabel(): string {
340
- const key = this.config?.filterConfig?.clearFilterLabel || 'COMMON.FILTER_TABLE.CLEAR_FILTER';
341
- return this.translate(key) || 'Clear Filter';
342
- }
343
-
344
- get applyFilterButtonLabel(): string {
345
- const key = this.config?.filterConfig?.applyFilterLabel || 'COMMON.FILTER_TABLE.APPLY_FILTER';
346
- return this.translate(key) || 'Apply Filter';
347
- }
348
-
349
- get selectionCountText(): string {
350
- if (!this.config?.selectionConfig?.selectionCountLabel) return '';
351
- const raw = this.translate(this.config.selectionConfig.selectionCountLabel);
352
- return raw
353
- .replace('{selected}', String(this.selectedRows.length))
354
- .replace('{total}', String(this.totalTableItems));
355
- }
356
-
357
- get hasActiveFilters(): boolean {
358
- return Object.keys(this.activeFilterParams).length > 0;
359
- }
360
-
361
- }
@@ -1,91 +0,0 @@
1
- import { FormSchema } from '../smart-form/models/form-schema.model';
2
- import { TableConfig } from '../smart-table/models/table-config.model';
3
-
4
- /**
5
- * Maps a SmartForm field name to its corresponding API query-param key.
6
- */
7
- export interface FilterParamMap {
8
- /** Field name as declared in sectionConfig.children (e.g. "country") */
9
- formFieldName: string;
10
- /** Actual query-param key sent to the table API (e.g. "currentCountryCode") */
11
- apiParamKey: string;
12
- }
13
-
14
- /**
15
- * Configuration for the left-hand filter panel (powered by SmartForm).
16
- */
17
- export interface FilterPanelConfig {
18
- /** Full SmartForm JSON schema (entityType, sectionConfig, actionBarConfig, etc.) */
19
- smartFormConfig: FormSchema;
20
- /** Maps each form field to the API query-param that the table expects */
21
- filterParamMapping: FilterParamMap[];
22
- /**
23
- * Optional default values pre-filled when the component opens AND restored on Clear Filter.
24
- * Key = formFieldName, Value = the field value.
25
- * When provided, the initial table load will include these params.
26
- */
27
- defaultValues?: Record<string, any>;
28
- /**
29
- * List of field names that should be rendered as disabled/read-only.
30
- * The values are still used when building API params, but users cannot change them.
31
- * Their values are preserved when Clear Filter is triggered.
32
- */
33
- disabledFields?: string[];
34
- /**
35
- * i18n key or literal text for the "Clear Filter" button.
36
- * Defaults to 'COMMON.FILTER_TABLE.CLEAR_FILTER'.
37
- */
38
- clearFilterLabel?: string;
39
- /**
40
- * i18n key or literal text for the "Apply Filter" button.
41
- * Defaults to 'COMMON.FILTER_TABLE.APPLY_FILTER'.
42
- */
43
- applyFilterLabel?: string;
44
- }
45
-
46
- /**
47
- * Controls selection behaviour and bottom action bar labels.
48
- */
49
- export interface SelectionConfig {
50
- /** Allow selecting multiple rows (true = checkbox per row, false = radio). */
51
- multiSelect: boolean;
52
- /**
53
- * i18n token for the "X of Y users Selected" counter.
54
- * Use placeholders {selected} and {total}.
55
- * Example: "COMMON.FILTER_TABLE.SELECTION_COUNT"
56
- */
57
- selectionCountLabel: string;
58
- /** i18n token (or literal text) for the primary submit button. */
59
- submitButtonLabel: string;
60
- /** i18n token (or literal text) for the secondary cancel/back button. */
61
- cancelButtonLabel: string;
62
- }
63
-
64
- /**
65
- * Top-level configuration object for FilterTableSelectorComponent.
66
- */
67
- export interface FilterTableSelectorConfig {
68
- /** Dialog / modal heading. */
69
- title?: string;
70
- /** Left-panel filter form configuration. */
71
- filterConfig: FilterPanelConfig;
72
- /**
73
- * Right-panel table configuration.
74
- * Extends the standard SmartTable config; `selectable` should be true.
75
- * `multiSelect` is controlled via selectionConfig.multiSelect.
76
- */
77
- tableConfig: FilterTableConfig;
78
- /** Selection behaviour and bottom action bar labels. */
79
- selectionConfig: SelectionConfig;
80
- }
81
-
82
- /**
83
- * Extended TableConfig for FilterTableSelector — adds multiSelect support.
84
- */
85
- export interface FilterTableConfig extends TableConfig {
86
- /**
87
- * When true (and selectable=true), multiple rows can be selected simultaneously.
88
- * When false, only one row can be selected at a time (radio behaviour).
89
- */
90
- multiSelect?: boolean;
91
- }
@@ -1,22 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { FilterTableSelectorComponent } from './components/filter-table-selector/filter-table-selector.component';
4
- import { SmartFormModule } from '../smart-form/smart-form.module';
5
- import { SmartTableModule } from '../smart-table/smart-table.module';
6
- import { ButtonModule } from '../button/button.module';
7
-
8
- @NgModule({
9
- declarations: [
10
- FilterTableSelectorComponent
11
- ],
12
- imports: [
13
- CommonModule,
14
- SmartFormModule,
15
- SmartTableModule,
16
- ButtonModule
17
- ],
18
- exports: [
19
- FilterTableSelectorComponent
20
- ]
21
- })
22
- export class FilterTableSelectorModule { }
@@ -1,63 +0,0 @@
1
- <div class="fb-config-panel">
2
- @if (!selectedField) {
3
- <div class="fb-config-panel__empty">
4
- <div class="fb-config-panel__empty-icon">
5
- <svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor"
6
- stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
7
- <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
8
- <line x1="3" y1="9" x2="21" y2="9"/>
9
- <line x1="9" y1="21" x2="9" y2="9"/>
10
- </svg>
11
- </div>
12
- <p class="fb-config-panel__empty-text">
13
- Select a field from the tree panel to edit its configuration.
14
- </p>
15
- </div>
16
- } @else {
17
- <div class="fb-config-panel__header">
18
- <div class="fb-config-panel__header-left">
19
- <h3 class="fb-config-panel__title">
20
- {{ selectedField.label || selectedField.name || 'Field Settings' }}
21
- </h3>
22
- @if (selectedField.type) {
23
- <span class="fb-config-panel__badge">{{ selectedField.type }}</span>
24
- }
25
- </div>
26
-
27
- <!-- Field Type Switcher: hidden for DROPDOWN / MULTI_SELECT fields -->
28
- @if (!isDropdownType) {
29
- <div class="fb-config-panel__type-switcher">
30
- <label class="fb-config-panel__type-label" for="fb-field-type-select">Field Type</label>
31
- <select
32
- id="fb-field-type-select"
33
- class="fb-config-panel__type-select"
34
- [value]="currentBuilderType"
35
- (change)="onTypeSelectChange($event)"
36
- >
37
- @for (opt of switchableFieldTypes; track opt.value) {
38
- <option [value]="opt.value">{{ opt.label }}</option>
39
- }
40
- </select>
41
- </div>
42
- }
43
- </div>
44
-
45
- <div class="fb-config-panel__form-wrapper">
46
- @if (showConfigForm && configFormJson) {
47
- <div class="fb-config-card">
48
- <lib-smart-form
49
- [formJson]="configFormJson"
50
- [initialValues]="configInitialValues"
51
- (actionClick)="onActionClick($event)"
52
- />
53
- </div>
54
- } @else if (!showConfigForm) {
55
- <!-- intentionally empty — SmartForm is being recycled -->
56
- } @else {
57
- <div class="fb-config-panel__error">
58
- No configuration schema available for this field type.
59
- </div>
60
- }
61
- </div>
62
- }
63
- </div>