commons-shared-web-ui 0.0.50 → 0.0.51

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 (186) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +13828 -0
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
  3. package/index.d.ts +4258 -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 -597
  15. package/documentation/form-components.md +0 -384
  16. package/documentation/nav.md +0 -427
  17. package/documentation/pagination.md +0 -181
  18. package/documentation/side-nav-documentation.md +0 -169
  19. package/documentation/smart-form.md +0 -2405
  20. package/documentation/smart-table.md +0 -1221
  21. package/documentation/snackbar.md +0 -118
  22. package/documentation/style-externalization.md +0 -88
  23. package/documentation/summary-card.md +0 -279
  24. package/ng-package.json +0 -28
  25. package/src/lib/modules/alert/alert.models.ts +0 -6
  26. package/src/lib/modules/alert/alert.module.ts +0 -16
  27. package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
  28. package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
  29. package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
  30. package/src/lib/modules/button/button.models.ts +0 -13
  31. package/src/lib/modules/button/button.module.ts +0 -16
  32. package/src/lib/modules/button/components/button/button.component.html +0 -22
  33. package/src/lib/modules/button/components/button/button.component.scss +0 -88
  34. package/src/lib/modules/button/components/button/button.component.ts +0 -67
  35. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
  36. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
  37. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +0 -87
  38. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
  41. package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
  44. package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
  45. package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
  46. package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
  52. package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
  53. package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
  54. package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
  55. package/src/lib/modules/filter/filter.models.ts +0 -88
  56. package/src/lib/modules/filter/filter.module.ts +0 -24
  57. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
  60. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
  61. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
  62. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
  65. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
  66. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
  73. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
  76. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
  79. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
  82. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
  85. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
  88. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
  89. package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
  90. package/src/lib/modules/form-builder/index.ts +0 -9
  91. package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
  92. package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
  93. package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
  94. package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
  95. package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
  96. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
  97. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
  98. package/src/lib/modules/form-builder/utils/constants.ts +0 -43
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
  111. package/src/lib/modules/form-components/components/input/input.component.html +0 -51
  112. package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
  113. package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
  114. package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
  115. package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
  116. package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
  117. package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
  118. package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
  119. package/src/lib/modules/form-components/components/search/search.component.html +0 -15
  120. package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
  121. package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
  122. package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
  123. package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
  126. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
  127. package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
  128. package/src/lib/modules/form-components/form-components.module.ts +0 -41
  129. package/src/lib/modules/material/material.module.ts +0 -94
  130. package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
  131. package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
  132. package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
  133. package/src/lib/modules/nav/nav.models.ts +0 -31
  134. package/src/lib/modules/nav/nav.module.ts +0 -17
  135. package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
  136. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
  137. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
  138. package/src/lib/modules/pagination/pagination.module.ts +0 -17
  139. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
  140. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
  141. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
  142. package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
  143. package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
  144. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1196
  145. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2014
  146. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -2525
  147. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
  148. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
  149. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
  150. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
  151. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
  152. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1124
  153. package/src/lib/modules/smart-form/index.ts +0 -10
  154. package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -733
  155. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
  156. package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
  157. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -65
  158. package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
  159. package/src/lib/modules/smart-form/smart-form.module.ts +0 -36
  160. package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
  161. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
  162. package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
  163. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
  164. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
  165. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
  166. package/src/lib/modules/smart-table/models/table-config.model.ts +0 -207
  167. package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
  168. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
  169. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
  170. package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
  171. package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
  172. package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
  173. package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
  174. package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
  175. package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
  176. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
  177. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
  178. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
  179. package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
  180. package/src/lib/shared-ui.module.ts +0 -44
  181. package/src/lib/utils/constants.ts +0 -11
  182. package/src/lib/utils/storage.utils.ts +0 -37
  183. package/src/lib/utils/string.utils.ts +0 -23
  184. package/src/lib/utils/translation.utils.ts +0 -87
  185. package/src/public-api.ts +0 -104
  186. package/tsconfig.lib.json +0 -15
@@ -1,250 +0,0 @@
1
- # Confirmation Modal Component
2
-
3
- The `ConfirmationModalComponent` is a flexible dialog component used for confirming actions, displaying alerts, or presenting custom content with a consistent design.
4
-
5
- ## Installation
6
-
7
- To install the latest version of the `commons-shared-web-ui` library, run the following command:
8
-
9
- ```bash
10
- npm install commons-shared-web-ui@latest
11
- ```
12
-
13
- 1. Import `ConfirmationModalModule` in your feature module:
14
-
15
- ```typescript
16
- import { ConfirmationModalModule } from "commons-shared-web-ui";
17
-
18
- @NgModule({
19
- imports: [ConfirmationModalModule],
20
- })
21
- export class FeatureModule {}
22
- ```
23
-
24
- 2. Include the theme mixin in your global styles:
25
-
26
- ```scss
27
- @use "commons-shared-web-ui/lib/modules/confirmation-modal/confirmation-modal.theme"
28
- as modal;
29
-
30
- :root {
31
- @include modal.confirmation-modal-theme();
32
- }
33
- ```
34
-
35
- ## Usage
36
-
37
- Use the component in your template and control its visibility via the `isOpen` input.
38
-
39
- ```html
40
- <cc-confirmation-modal
41
- [isOpen]="isModalOpen"
42
- [config]="modalConfig"
43
- (confirm)="onConfirm()"
44
- (cancel)="onCancel()"
45
- (close)="onClose()"
46
- >
47
- <!-- Optional: Project custom content here -->
48
- <p>This action cannot be undone.</p>
49
- </cc-confirmation-modal>
50
- ```
51
-
52
- ### Configuration (`ConfirmationModalConfig`)
53
-
54
- The appearance and behavior are controlled via the `config` input.
55
-
56
- ```typescript
57
- import { ConfirmationModalConfig } from "commons-shared-web-ui";
58
-
59
- modalConfig: ConfirmationModalConfig = {
60
- title: "Delete Item?",
61
- headerTheme: "dark", // 'light' | 'dark'
62
- confirmButton: {
63
- label: "Delete",
64
- type: "danger",
65
- },
66
- cancelButton: {
67
- label: "Cancel",
68
- show: true,
69
- },
70
- };
71
- ```
72
-
73
- ## API Reference
74
-
75
- ### Inputs
76
-
77
- | `isOpen` | `boolean` | `false` | Controls the visibility of the modal. |
78
- | `config` | `ConfirmationModalConfig` | - | Configuration object for the modal. |
79
- | `confirmDisabled` | `boolean` | `false` | Direct override to disable the confirm button (useful for file uploads). |
80
- | `confirmLoading` | `boolean` | `false` | Direct override to show loading on the confirm button (shows a spinner). |
81
-
82
- ### Outputs
83
-
84
- | Output | Type | Description |
85
- | --------- | -------------------- | ----------------------------------------------------------------------------- |
86
- | `confirm` | `EventEmitter<void>` | Emitted when the confirm button is clicked. |
87
- | `cancel` | `EventEmitter<void>` | Emitted when the cancel button is clicked. |
88
- | `close` | `EventEmitter<void>` | Emitted when the modal is closed (via backdrop, escape key, or close button). |
89
- | `showCodeSnippet` | `EventEmitter<void>` | Emitted when the code snippet button is clicked. |
90
-
91
- ### ConfirmationModalConfig Interface
92
-
93
- ```typescript
94
- export interface ConfirmationModalConfig {
95
- // Header
96
- title: string;
97
- headerTheme?: "light" | "dark";
98
- icon?: string | {
99
- type: "material" | "custom";
100
- value: string;
101
- color?: string;
102
- };
103
-
104
- // Modal appearance
105
- width?: string;
106
- size?: "sm" | "md" | "lg" | "xl"; // sm: 400px, md: 560px, lg: 720px, xl: 1200px
107
- customClass?: string;
108
- type?: "modal" | "side-panel";
109
- panelPosition?: "left" | "right" | "top" | "bottom";
110
- panelSpacing?: string;
111
- panelWidth?: string;
112
- panelHeight?: string;
113
-
114
- // Style Overrides (Direct inputs)
115
- backgroundColor?: string;
116
- borderRadius?: string;
117
- borderTopLeftRadius?: string;
118
- borderTopRightRadius?: string;
119
- borderBottomLeftRadius?: string;
120
- borderBottomRightRadius?: string;
121
- padding?: string;
122
- headerBackgroundColor?: string;
123
- headerTextColor?: string;
124
- headerBorderBottom?: string;
125
- bodyTextColor?: string;
126
- footerBackgroundColor?: string;
127
- footerBorderTop?: string;
128
-
129
- // Buttons
130
- confirmButton: {
131
- label: string;
132
- type: "primary" | "danger" | "warning";
133
- disabled?: boolean;
134
- loading?: boolean;
135
- };
136
- cancelButton?: {
137
- label?: string;
138
- show?: boolean;
139
- };
140
-
141
- // Custom Footer
142
- customFooter?: boolean; // Set to true to replace default buttons with custom footer content
143
-
144
- // Body layout
145
- formMode?: boolean; // Set to true when projecting a lib-smart-form — removes body padding and enforces 360px min-height with skeleton spinner
146
-
147
- // Behavior
148
- closeOnBackdrop?: boolean;
149
- closeOnEsc?: boolean;
150
- showCloseButton?: boolean;
151
- showCodeSnippetButton?: boolean;
152
-
153
- // Accessibility
154
- ariaLabel?: string;
155
- ariaDescribedBy?: string;
156
-
157
- // i18n Labels
158
- labels?: {
159
- closeAriaLabel?: string;
160
- codeSnippetAriaLabel?: string;
161
- codeSnippetTitle?: string;
162
- iconAltText?: string;
163
- };
164
- }
165
- ```
166
-
167
- ### Configuration Key Reference
168
-
169
- The `confirmation-modal-theme` mixin accepts a map with the following optional keys.
170
-
171
- | Key | Default | Description |
172
- | ------------------- | ----------------------------- | ------------------------------- |
173
- | **bg** | `#FFFFFF` | Background color of the modal. |
174
- | **radius** | `0.75rem` | Border radius (12px). |
175
- | **shadow** | `0 4px 24px rgba(0,0,0,0.15)` | Box shadow of the modal. |
176
- | **title-font-size** | `1.25rem` | Font size of the title (20px). |
177
- | **title-color** | `#111827` | Text color of the title. |
178
- | **body-padding** | `1.5rem` | Padding for the body (24px). |
179
- | **footer-bg** | `#F9FAFB` | Background color of the footer. |
180
- | **footer-padding** | `1rem 1.5rem` | Padding for the footer. |
181
- | **body-padding** | `1.5rem` | Body padding when `formMode` is not set. |
182
-
183
- ---
184
-
185
- ## Usage & Examples
186
-
187
- ### 1. Basic Confirmation
188
-
189
- ```typescript
190
- modalConfig: ConfirmationModalConfig = {
191
- title: "Delete User?",
192
- confirmButton: { label: "Delete", type: "danger" },
193
- cancelButton: { label: "Cancel", show: true },
194
- };
195
- ```
196
-
197
- ### 2. Smart Form in Modal (`formMode`)
198
-
199
- When projecting a `lib-smart-form`, set `formMode: true` in the config. This applies zero body padding and a 360 px minimum height so the modal stays stable while the form skeleton loads.
200
-
201
- ```typescript
202
- formModalConfig: ConfirmationModalConfig = {
203
- title: "Edit Student",
204
- formMode: true,
205
- confirmButton: { label: "Save", type: "primary" },
206
- cancelButton: { label: "Cancel", show: true },
207
- };
208
- ```
209
-
210
- ```html
211
- <cc-confirmation-modal [isOpen]="isFormOpen" [config]="formModalConfig">
212
- <lib-smart-form [formId]="formId" (formSubmit)="onSubmit($event)" />
213
- </cc-confirmation-modal>
214
- ```
215
-
216
- > **Note:** Without `formMode: true`, the modal body uses the default `1.5rem` padding and natural content height — correct for plain text confirmations. Only set `formMode: true` when a `lib-smart-form` is projected.
217
-
218
- ### 3. Dark Header (Premium Design)
219
-
220
- ```typescript
221
- modalConfig: ConfirmationModalConfig = {
222
- title: "Create Project",
223
- headerTheme: "dark", // Native support for dark header
224
- confirmButton: { label: "Continue", type: "primary" },
225
- };
226
- ```
227
-
228
- ### 4. Side Panel Mode
229
-
230
- The component can also act as a sliding side panel. You can configure its position and spacing from the viewport edges.
231
-
232
- ```typescript
233
- sidePanelConfig: ConfirmationModalConfig = {
234
- title: "Filters",
235
- type: "side-panel",
236
- panelPosition: "right",
237
- panelSpacing: "16px",
238
- panelWidth: "400px",
239
- confirmButton: { label: "Apply Filters", type: "primary" },
240
- cancelButton: { label: "Reset", show: true }
241
- };
242
- ```
243
-
244
- ```html
245
- <cc-confirmation-modal [isOpen]="isPanelOpen" [config]="sidePanelConfig">
246
- <div class="panel-content">
247
- <!-- Panel specific content -->
248
- </div>
249
- </cc-confirmation-modal>
250
- ```
@@ -1,178 +0,0 @@
1
- # Filter Sidebar Component
2
-
3
- A configuration-driven sidebar component for filtering lists and tables. It supports advanced configuration, form integration via `ControlValueAccessor`, and granular event handling.
4
-
5
- ## Features
6
-
7
- - **Dynamic Configuration**: Fully driven by a JSON configuration object.
8
- - **Form Integration**: Implements `ControlValueAccessor` for usage with `[(ngModel)]` or `[formControl]`.
9
- - **Multiple Input Types**: Supports `select`, `accordion` (multi-select checkboxes), `checkbox-group`, and `radio-group`.
10
- - **Tabs Support**: Configurable top-level tabs for switching contexts.
11
- - **Granular Events**: Emits changes per filter, on apply, and on clear.
12
-
13
- ## Installation
14
-
15
- To install the latest version of the `commons-shared-web-ui` library, run the following command:
16
-
17
- ```bash
18
- npm install commons-shared-web-ui@latest
19
- ```
20
-
21
- 1. Import `FilterSidebarModule` in your feature module:
22
-
23
- ```typescript
24
- import { FilterSidebarModule } from "commons-shared-web-ui";
25
-
26
- @NgModule({
27
- imports: [FilterSidebarModule],
28
- })
29
- export class FeatureModule {}
30
- ```
31
-
32
- ## Usage
33
-
34
- ### Basic Usage
35
-
36
- ```html
37
- <lib-filter-sidebar
38
- [config]="filterConfig"
39
- [(ngModel)]="currentFilters"
40
- (filterApply)="onApply($event)"
41
- >
42
- </lib-filter-sidebar>
43
- ```
44
-
45
- ### Configuration Example
46
-
47
- ```typescript
48
- import { FilterConfig } from "commons-shared-web-ui";
49
-
50
- const filterConfig: FilterConfig = {
51
- tabs: {
52
- items: [
53
- {
54
- id: "existing",
55
- label: "Invite Existing User",
56
- icon: "fa-regular fa-user",
57
- },
58
- { id: "new", label: "Invite New User", icon: "fa-solid fa-user-plus" },
59
- ],
60
- defaultActive: "existing",
61
- },
62
- sections: [
63
- {
64
- type: "select",
65
- key: "beneficiaryType",
66
- title: "Beneficiary Type",
67
- placeholder: "Select Type",
68
- options: [
69
- { label: "Parents", value: "parents" },
70
- { label: "Students", value: "students" },
71
- ],
72
- },
73
- {
74
- type: "accordion",
75
- key: "gender",
76
- title: "Gender",
77
- multi: true, // Checkboxes inside accordion
78
- options: [
79
- { label: "Male", value: "male" },
80
- { label: "Female", value: "female" },
81
- ],
82
- },
83
- ],
84
- actions: {
85
- apply: { label: "Apply Filter" },
86
- clear: { label: "Clear Filter" },
87
- },
88
- };
89
- ```
90
-
91
- ### Configuration Key Reference
92
-
93
- The `filter-sidebar-theme` mixin accepts a map with the following optional keys.
94
-
95
- | Key | Default | Description |
96
- | ------------------------- | --------- | -------------------------------- |
97
- | **bg-color** | `#ffffff` | Sidebar background color. |
98
- | **border-color** | `#E5E7EB` | Sidebar border color. |
99
- | **width** | `300px` | Sidebar width. |
100
- | **tab-active-bg** | `#FEF2F2` | Background of active tab. |
101
- | **tab-active-color** | `#EF4444` | Text color of active tab. |
102
- | **section-title-color** | `#374151` | Default section title color. |
103
- | **accordion-title-color** | `#111827` | Accordion header text color. |
104
- | **footer-bg** | `#ffffff` | Actions footer background color. |
105
-
106
- ---
107
-
108
- ## Usage & Examples
109
-
110
- ### 1. Complex Sections Example
111
-
112
- ```typescript
113
- sections: [
114
- {
115
- type: "select",
116
- key: "category",
117
- title: "Project Category",
118
- options: [
119
- { label: "Web", value: "web" },
120
- { label: "Mobile", value: "mobile" },
121
- ],
122
- },
123
- {
124
- type: "accordion",
125
- key: "tags",
126
- title: "Popular Tags",
127
- multi: true,
128
- options: [
129
- { label: "Angular", value: "angular" },
130
- { label: "Sass", value: "sass" },
131
- ],
132
- },
133
- {
134
- type: "radio-group",
135
- key: "status",
136
- title: "Project Status",
137
- options: [
138
- { label: "Active", value: "active" },
139
- { label: "Archived", value: "archived" },
140
- ],
141
- },
142
- ];
143
- ```
144
-
145
- ### 2. Tabs Integration
146
-
147
- ```typescript
148
- tabs: {
149
- items: [
150
- { id: 'filters', label: 'Filters', icon: 'fa-solid fa-filter' },
151
- { id: 'presets', label: 'Saved Presets', icon: 'fa-regular fa-star' }
152
- ],
153
- defaultActive: 'filters'
154
- }
155
- ```
156
-
157
- ## API Reference
158
-
159
- ### Inputs
160
-
161
- | Input | Type | Description |
162
- | ---------------- | -------------- | --------------------- |
163
- | `config` | `FilterConfig` | Structure definition. |
164
- | `initialFilters` | `FilterOutput` | Initial values. |
165
-
166
- ### FilterConfig Interface
167
-
168
- ```typescript
169
- export interface FilterConfig {
170
- tabs?: { items: FilterTab[]; defaultActive?: string };
171
- sections: FilterSection[];
172
- actions?: {
173
- apply?: { label?: string; visible?: boolean };
174
- clear?: { label?: string; visible?: boolean };
175
- };
176
- settings?: { collapsible?: boolean };
177
- }
178
- ```
@@ -1,228 +0,0 @@
1
- # Filter Table Selector Component Documentation
2
-
3
- The `FilterTableSelectorComponent` is a composite, configuration-driven component designed for complex selection workflows. It combines a powerful left-hand filter panel (powered by `SmartForm`) with a right-hand data table (powered by `SmartTable`).
4
-
5
- It is ideal for scenarios like "Add Beneficiaries", "Select Staff", or "Assign Assets" where users need to search and filter through large datasets before making one or more selections.
6
-
7
- ## Features
8
-
9
- - **Split-Pane Layout**: Side-by-side filter form and data table for an efficient selection experience.
10
- - **Dynamic Filtering**: Filters are defined via standard `SmartForm` JSON schemas, supporting dropdowns, multi-selects, and dependencies.
11
- - **Cross-Page Selection**: Tracks selected items across multiple pages of pagination.
12
- - **Configurable Selection**: Supports both Single Select (Radio) and Multi Select (Checkbox) modes.
13
- - **i18n Ready**: All labels, placeholders, and headers are resolved via provided translation maps.
14
- - **Pre-selection Support**: Automatically checks rows that were previously selected.
15
- - **Responsive**: Adapts to mobile views with a toggleable filter panel.
16
-
17
- ## Installation
18
-
19
- The component is part of the `FilterTableSelectorModule`.
20
-
21
- ```typescript
22
- import { FilterTableSelectorModule } from "@campus-cloud/shared-ui";
23
-
24
- @NgModule({
25
- imports: [
26
- FilterTableSelectorModule,
27
- // ...
28
- ],
29
- })
30
- export class MyFeatureModule {}
31
- ```
32
-
33
- ## Basic Usage
34
-
35
- 1. **Define Configuration**: Create a `FilterTableSelectorConfig` object.
36
- 2. **Provide Labels**: Pass a flat i18n map for translating all keys in the config.
37
- 3. **Handle Events**: Listen to `onSubmit` to get the array of selected row objects.
38
-
39
- ### Template
40
- ```html
41
- <lib-filter-table-selector
42
- [config]="selectorConfig"
43
- [labels]="labels"
44
- [preSelectedRows]="alreadySelectedItems"
45
- (onSubmit)="handleSelection($event)"
46
- (onCancel)="closeModal()"
47
- >
48
- </lib-filter-table-selector>
49
- ```
50
-
51
- ### Component
52
- ```typescript
53
- import { FilterTableSelectorConfig } from "@campus-cloud/shared-ui";
54
-
55
- export class MyComponent {
56
- labels = {
57
- 'MY_MODULE.TITLE': 'Select Participants',
58
- 'MY_MODULE.APPLY': 'Apply Filters',
59
- 'MY_MODULE.COLUMN.NAME': 'Full Name',
60
- // ...
61
- };
62
-
63
- selectorConfig: FilterTableSelectorConfig = {
64
- title: 'MY_MODULE.TITLE',
65
- filterConfig: {
66
- smartFormConfig: { /* SmartForm JSON Schema */ },
67
- filterParamMapping: [
68
- { formFieldName: 'gender', apiParamKey: 'genderCode' }
69
- ],
70
- applyFilterLabel: 'MY_MODULE.APPLY'
71
- },
72
- tableConfig: {
73
- apiUrl: 'gateway/my-service/api/v1/items',
74
- columns: [
75
- { key: 'fullName', label: 'MY_MODULE.COLUMN.NAME', type: 'text' }
76
- ],
77
- pagination: { enabled: true }
78
- },
79
- selectionConfig: {
80
- multiSelect: true,
81
- selectionCountLabel: 'SELECTED: {selected} of {total}',
82
- submitButtonLabel: 'Add Selected',
83
- cancelButtonLabel: 'Cancel'
84
- }
85
- };
86
-
87
- handleSelection(selectedRows: any[]) {
88
- console.log('Selected items:', selectedRows);
89
- }
90
- }
91
- ```
92
-
93
- ## Configuration Reference
94
-
95
- ### FilterTableSelectorConfig
96
-
97
- | Property | Type | Description |
98
- | :--- | :--- | :--- |
99
- | `title` | `string` | i18n key for the component header. |
100
- | `filterConfig` | `FilterPanelConfig` | Configuration for the left-hand filter panel. |
101
- | `tableConfig` | `FilterTableConfig` | Configuration for the right-hand table. |
102
- | `selectionConfig` | `SelectionConfig` | Labels and behavior for selection and buttons. |
103
-
104
- ### FilterPanelConfig
105
-
106
- | Property | Type | Description |
107
- | :--- | :--- | :--- |
108
- | `smartFormConfig` | `FormSchema` | Full `SmartForm` JSON schema. |
109
- | `filterParamMapping` | `FilterParamMap[]` | Maps form field names to API query parameters. |
110
- | `defaultValues` | `Record<string, any>` | (Optional) Values pre-filled in the form and applied to the initial table load. |
111
- | `disabledFields` | `string[]` | (Optional) Fields to render as read-only. Their values are preserved on Clear Filter. |
112
- | `applyFilterLabel` | `string` | i18n key for the "Apply" button. |
113
- | `clearFilterLabel` | `string` | i18n key for the "Clear" button. |
114
-
115
- ### FilterParamMap
116
-
117
- | Property | Type | Description |
118
- | :--- | :--- | :--- |
119
- | `formFieldName` | `string` | Field name in the SmartForm schema. |
120
- | `apiParamKey` | `string` | Query parameter key to append to the Table API URL. |
121
-
122
- ### SelectionConfig
123
-
124
- | Property | Type | Description |
125
- | :--- | :--- | :--- |
126
- | `multiSelect` | `boolean` | Enable checkbox (true) or radio (false) selection. |
127
- | `selectionCountLabel`| `string` | i18n key for the counter text. Supports `{selected}` and `{total}` placeholders. |
128
- | `submitButtonLabel` | `string` | i18n key for the primary action button. |
129
- | `cancelButtonLabel` | `string` | i18n key for the secondary action button. |
130
-
131
- ## Inputs & Outputs
132
-
133
- ### Inputs
134
-
135
- | Input | Type | Description |
136
- | :--- | :--- | : :--- |
137
- | `[config]` | `FilterTableSelectorConfig` | (Required) The main configuration object. |
138
- | `[labels]` | `Record<string, string>` | (Required) Translation map for all i18n keys used in the config. |
139
- | `[preSelectedRows]`| `any[]` | (Optional) Array of row objects to be pre-checked on load. |
140
-
141
- ### Outputs
142
-
143
- | Output | Description | Payload |
144
- | :--- | :--- | :--- |
145
- | `(onSubmit)` | Emitted when the primary button is clicked. | `any[]` (Array of selected row objects) |
146
- | `(onCancel)` | Emitted when the secondary button is clicked. | `void` |
147
-
148
- ## Filtering Logic
149
-
150
- 1. When the component initializes, it builds query parameters from `filterConfig.defaultValues`.
151
- 2. The Table API URL is updated: `baseUrl?param1=val1&param2=val2...`.
152
- 3. When the user clicks "Apply Filter", the component reads the current `SmartForm` values and maps them using `filterParamMapping`.
153
- 4. If a field contains an array (e.g., from a multi-select dropdown), it is automatically converted to a comma-separated string for the API.
154
- 5. The table is reloaded with the new URL.
155
-
156
- ## Examples
157
-
158
- ### 1. Invite Participants Selector
159
-
160
- This example demonstrates a typical setup for a selection modal with geographic filters.
161
-
162
- ```typescript
163
- this.config = {
164
- title: 'EVENT.ADD_CANDIDATES',
165
- filterConfig: {
166
- smartFormConfig: {
167
- entityType: 'FILTER',
168
- sectionConfig: {
169
- children: [
170
- {
171
- name: 'gender',
172
- label: 'COMMON.GENDER',
173
- type: 'DROPDOWN',
174
- subType: 'MULTI',
175
- optionConfig: {
176
- apiUrl: 'gateway/mdm/genders',
177
- labelPath: 'name',
178
- valuePath: 'code',
179
- dataPath: 'data'
180
- }
181
- }
182
- ]
183
- }
184
- },
185
- filterParamMapping: [
186
- { formFieldName: 'gender', apiParamKey: 'genderCodes' }
187
- ],
188
- applyFilterLabel: 'COMMON.APPLY',
189
- clearFilterLabel: 'COMMON.CLEAR'
190
- },
191
- tableConfig: {
192
- apiUrl: 'gateway/search/users',
193
- columns: [
194
- { key: 'fullName', label: 'COMMON.NAME', type: 'text' },
195
- { key: 'email', label: 'COMMON.EMAIL', type: 'text' }
196
- ],
197
- pagination: { enabled: true }
198
- },
199
- selectionConfig: {
200
- multiSelect: true,
201
- selectionCountLabel: 'COMMON.SELECTED_COUNT', // e.g. "{selected} selected"
202
- submitButtonLabel: 'COMMON.ADD',
203
- cancelButtonLabel: 'COMMON.CANCEL'
204
- }
205
- };
206
- ```
207
-
208
- ## Clear Filter Behavior
209
-
210
- The "Clear Filter" button performs the following actions:
211
- 1. Resets all form fields to their values defined in `filterConfig.defaultValues`.
212
- 2. If a field is listed in `filterConfig.disabledFields`, its current value is preserved.
213
- 3. The `SmartForm` component is destroyed and re-initialized to ensure a clean state.
214
- 4. The table is automatically reloaded with the default parameters.
215
-
216
- ## Theming
217
-
218
- The component uses standard CSS variables. It primarily inherits styles from the `SmartForm` and `SmartTable` components. You can customize the layout gaps and panel widths using the following variables in your `variables.scss`:
219
-
220
- ```scss
221
- // Layout spacing
222
- --fts-gap: 1.5rem;
223
- --fts-filter-panel-width: 320px;
224
- --fts-footer-padding: 1rem 1.5rem;
225
-
226
- // Mobile specific
227
- --fts-mobile-breakpoint: 768px;
228
- ```