commons-shared-web-ui 0.0.60 → 0.0.62

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 (223) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/documentation/alert.md +123 -0
  3. package/documentation/button-dropdown.md +126 -0
  4. package/documentation/button.md +184 -0
  5. package/documentation/cards-usage-guidelines.md +131 -0
  6. package/documentation/configurable-form.md +605 -0
  7. package/documentation/confirmation-modal.md +250 -0
  8. package/documentation/filter-sidebar.md +178 -0
  9. package/documentation/filter-table-selector.md +228 -0
  10. package/documentation/form-builder.md +599 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/form-field-configuration.md +250 -0
  13. package/documentation/nav.md +427 -0
  14. package/documentation/pagination.md +181 -0
  15. package/documentation/side-nav-documentation.md +169 -0
  16. package/documentation/smart-form.md +2819 -0
  17. package/documentation/smart-table.md +1297 -0
  18. package/documentation/snackbar.md +118 -0
  19. package/documentation/style-externalization.md +88 -0
  20. package/documentation/summary-card.md +279 -0
  21. package/documentation/table-column-configuration.md +221 -0
  22. package/documentation/time-picker.md +274 -0
  23. package/ng-package.json +30 -0
  24. package/package.json +53 -34
  25. package/src/lib/modules/alert/alert.models.ts +6 -0
  26. package/src/lib/modules/alert/alert.module.ts +16 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  28. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  29. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  30. package/src/lib/modules/button/button.models.ts +13 -0
  31. package/src/lib/modules/button/button.module.ts +16 -0
  32. package/src/lib/modules/button/components/button/button.component.html +22 -0
  33. package/src/lib/modules/button/components/button/button.component.scss +92 -0
  34. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  35. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  36. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  37. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
  38. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
  40. package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
  41. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
  43. package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
  44. package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
  45. package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
  46. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  49. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  51. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  52. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  54. package/src/lib/modules/filter/filter.models.ts +88 -0
  55. package/src/lib/modules/filter/filter.module.ts +24 -0
  56. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  57. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  59. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  60. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  61. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  62. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  64. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  65. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  66. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  67. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  75. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  76. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  78. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  79. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  81. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  82. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  84. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  85. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  87. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  88. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  89. package/src/lib/modules/form-builder/index.ts +9 -0
  90. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  91. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  92. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  93. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  94. package/src/lib/modules/form-builder/services/field-selection.service.ts +299 -0
  95. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +670 -0
  96. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  97. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  98. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  99. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  102. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  103. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  106. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  107. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  110. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  111. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  112. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  113. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  114. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  115. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  116. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  117. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  118. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  119. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  120. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  121. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  122. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  123. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  125. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  126. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  127. package/src/lib/modules/form-components/form-components.module.ts +42 -0
  128. package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +89 -0
  129. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +68 -0
  130. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +73 -0
  131. package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +34 -0
  132. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +78 -0
  133. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +83 -0
  134. package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +94 -0
  135. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +38 -0
  136. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +42 -0
  137. package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +92 -0
  138. package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +23 -0
  139. package/src/lib/modules/form-field-configuration/index.ts +7 -0
  140. package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +62 -0
  141. package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +159 -0
  142. package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +228 -0
  143. package/src/lib/modules/material/material.module.ts +94 -0
  144. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  146. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  147. package/src/lib/modules/nav/nav.models.ts +31 -0
  148. package/src/lib/modules/nav/nav.module.ts +17 -0
  149. package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
  150. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
  151. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
  152. package/src/lib/modules/pagination/pagination.module.ts +17 -0
  153. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
  154. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  155. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  156. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  157. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  158. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1379 -0
  159. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +2255 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +3174 -0
  161. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +67 -0
  162. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +142 -0
  164. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  165. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1134 -0
  167. package/src/lib/modules/smart-form/index.ts +10 -0
  168. package/src/lib/modules/smart-form/models/form-schema.model.ts +803 -0
  169. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +22 -0
  170. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  171. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +67 -0
  172. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  173. package/src/lib/modules/smart-form/smart-form.module.ts +40 -0
  174. package/src/lib/modules/smart-form/smart-form.theme.scss +1 -0
  175. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  176. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  177. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  178. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  179. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1219 -0
  181. package/src/lib/modules/smart-table/models/table-config.model.ts +247 -0
  182. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  183. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +28 -0
  184. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  185. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  186. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  187. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  188. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  189. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  190. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  191. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  192. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  193. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  194. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  195. package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +53 -0
  196. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +47 -0
  197. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +50 -0
  198. package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +33 -0
  199. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +30 -0
  200. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +36 -0
  201. package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +78 -0
  202. package/src/lib/modules/table-column-configuration/index.ts +5 -0
  203. package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +20 -0
  204. package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +77 -0
  205. package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +21 -0
  206. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +37 -0
  207. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +102 -0
  208. package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +178 -0
  209. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +78 -0
  210. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +226 -0
  211. package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +595 -0
  212. package/src/lib/modules/time-picker/models/time-picker.models.ts +49 -0
  213. package/src/lib/modules/time-picker/time-picker.module.ts +23 -0
  214. package/src/lib/shared-ui.module.ts +55 -0
  215. package/src/lib/utils/constants.ts +11 -0
  216. package/src/lib/utils/storage.utils.ts +37 -0
  217. package/src/lib/utils/string.utils.ts +23 -0
  218. package/src/lib/utils/translation.utils.ts +87 -0
  219. package/src/public-api.ts +127 -0
  220. package/tsconfig.lib.json +15 -0
  221. package/fesm2022/commons-shared-web-ui.mjs +0 -16097
  222. package/fesm2022/commons-shared-web-ui.mjs.map +0 -1
  223. package/index.d.ts +0 -5022
@@ -0,0 +1,40 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ReactiveFormsModule, FormsModule } from '@angular/forms';
4
+ import { OverlayModule } from '@angular/cdk/overlay';
5
+ import { MaterialModule } from '../material/material.module';
6
+ import { SmartFormComponent } from './components/smart-form/smart-form.component';
7
+ import { FormSectionComponent } from './components/form-section/form-section.component';
8
+ import { FormFieldComponent } from './components/form-field/form-field.component';
9
+ import { ExpressionService } from './services/expression.service';
10
+ import { ButtonModule } from '../button/button.module';
11
+ import { AlertModule } from '../alert/alert.module';
12
+ import { QuillModule } from 'ngx-quill';
13
+ import { TrustedUrlPipe } from './utils/trusted-url.pipe';
14
+ import { TimePickerModule } from '../time-picker/time-picker.module';
15
+ @NgModule({
16
+ declarations: [
17
+ SmartFormComponent,
18
+ FormSectionComponent,
19
+ FormFieldComponent,
20
+ TrustedUrlPipe
21
+ ],
22
+ imports: [
23
+ CommonModule,
24
+ ReactiveFormsModule,
25
+ FormsModule,
26
+ MaterialModule,
27
+ OverlayModule,
28
+ ButtonModule,
29
+ AlertModule,
30
+ QuillModule.forRoot(),
31
+ TimePickerModule
32
+ ],
33
+ exports: [
34
+ SmartFormComponent
35
+ ],
36
+ providers: [
37
+ ExpressionService
38
+ ]
39
+ })
40
+ export class SmartFormModule { }
@@ -623,6 +623,7 @@ $type1-config: map.merge($default-smart-form-config, (
623
623
  --cc-sf-label-weight: #{map.get($config, label-weight)};
624
624
  --cc-sf-label-color: #{map.get($config, label-color)};
625
625
  --cc-sf-label-required-color: #{map.get($config, label-required-color)};
626
+ --cc-sf-label-mb: 0px;
626
627
 
627
628
  // Input
628
629
  --cc-sf-input-bg: #{map.get($config, input-bg)};
@@ -0,0 +1,82 @@
1
+ import { FieldConfig, FormSchema } from '../models/form-schema.model';
2
+
3
+ /**
4
+ * Utility class for translating Smart Form schemas.
5
+ */
6
+ export class SmartFormTranslationUtils {
7
+
8
+ /**
9
+ * Recursively walks the schema and replaces i18n keys with values from labels map.
10
+ * @param schema The FormSchema to translate.
11
+ * @param labels The labels map (can be flat or contain labelsObject property).
12
+ */
13
+ static translateSchema(schema: FormSchema, labels: any): void {
14
+ if (!schema || !labels) return;
15
+
16
+ // Support both flat labels map and the pattern used in ConfigurableForm which passes { labelsObject: ... }
17
+ const labelsMap = labels.labelsObject || labels;
18
+ const translate = (key: string) => labelsMap[key] || key;
19
+
20
+ // Root properties
21
+ if (schema.label) schema.label = translate(schema.label);
22
+ if (schema.description) schema.description = translate(schema.description);
23
+
24
+ // Submit config
25
+ if (schema.submitConfig) {
26
+ if (schema.submitConfig.successMessage) schema.submitConfig.successMessage = translate(schema.submitConfig.successMessage);
27
+ if (schema.submitConfig.errorMessage) schema.submitConfig.errorMessage = translate(schema.submitConfig.errorMessage);
28
+ }
29
+
30
+ // Section config
31
+ if (schema.sectionConfig) {
32
+ this.translateSection(schema.sectionConfig, translate);
33
+ }
34
+
35
+ // Stepper config
36
+ if (schema.stepperConfig?.children) {
37
+ schema.stepperConfig.children.forEach(field => this.translateField(field, translate));
38
+ }
39
+ }
40
+
41
+ private static translateSection(section: any, translate: (key: string) => string): void {
42
+ if (section.label) section.label = translate(section.label);
43
+ if (section.children) {
44
+ section.children.forEach((field: FieldConfig) => this.translateField(field, translate));
45
+ }
46
+ }
47
+
48
+ private static translateField(field: FieldConfig, translate: (key: string) => string): void {
49
+ if (field.label) field.label = translate(field.label);
50
+ if (field.placeholder) field.placeholder = translate(field.placeholder);
51
+ if (field.hint) field.hint = translate(field.hint);
52
+
53
+ if (field.richTextConfig?.placeholder) {
54
+ field.richTextConfig.placeholder = translate(field.richTextConfig.placeholder);
55
+ }
56
+
57
+ if (field.textConfig?.patternMessage) {
58
+ field.textConfig.patternMessage = translate(field.textConfig.patternMessage);
59
+ }
60
+
61
+ if (field.attachmentConfig?.acceptLabel) {
62
+ field.attachmentConfig.acceptLabel = translate(field.attachmentConfig.acceptLabel);
63
+ }
64
+
65
+ if (field.optionConfig?.optionList) {
66
+ field.optionConfig.optionList.forEach(opt => {
67
+ if (opt.label) opt.label = translate(opt.label);
68
+ if (opt.hint) opt.hint = translate(opt.hint);
69
+ });
70
+ }
71
+
72
+ // Recurse into children (ROW or GROUP)
73
+ if (field.children) {
74
+ field.children.forEach(child => this.translateField(child, translate));
75
+ }
76
+
77
+ // Recurse into nested section config
78
+ if (field.sectionConfig) {
79
+ this.translateSection(field.sectionConfig, translate);
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,25 @@
1
+ import { Pipe, PipeTransform, SecurityContext } from '@angular/core';
2
+ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3
+
4
+ /**
5
+ * Bypasses Angular's DomSanitizer for resource URLs (e.g. YouTube embed iframes).
6
+ * Used only for trusted URLs such as YouTube embed links derived from user-provided video IDs.
7
+ */
8
+ @Pipe({
9
+ name: 'trustedUrl',
10
+ standalone: false
11
+ })
12
+ export class TrustedUrlPipe implements PipeTransform {
13
+ constructor(private sanitizer: DomSanitizer) { }
14
+
15
+ transform(url: string): SafeResourceUrl | null {
16
+ if (!url) {
17
+ return null;
18
+ }
19
+ const cleaned = this.sanitizer.sanitize(SecurityContext.URL, url);
20
+ if (!cleaned) {
21
+ return null;
22
+ }
23
+ return this.sanitizer.bypassSecurityTrustResourceUrl(cleaned);
24
+ }
25
+ }
@@ -0,0 +1,98 @@
1
+ import { AbstractControl, FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms';
2
+
3
+ export class ValidationUtils {
4
+
5
+
6
+
7
+ static email(): ValidatorFn {
8
+ return (control: AbstractControl): ValidationErrors | null => {
9
+ if (!control.value) return null;
10
+ const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
11
+ return emailRegex.test(control.value) ? null : { email: true };
12
+ };
13
+ }
14
+
15
+ static phone(): ValidatorFn {
16
+ return (control: AbstractControl): ValidationErrors | null => {
17
+ if (!control.value) return null;
18
+ const phoneRegex = /^\+?[\d\s\-\(\)]{10,}$/;
19
+ return phoneRegex.test(control.value) ? null : { phone: true };
20
+ };
21
+ }
22
+
23
+ static url(): ValidatorFn {
24
+ return (control: AbstractControl): ValidationErrors | null => {
25
+ if (!control.value) return null;
26
+ const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;
27
+ return urlRegex.test(control.value) ? null : { url: true };
28
+ };
29
+ }
30
+
31
+ static minLength(min: number): ValidatorFn {
32
+ return (control: AbstractControl): ValidationErrors | null => {
33
+ if (!control.value) return null;
34
+ return control.value.length >= min ? null : { minLength: { min, actual: control.value.length } };
35
+ };
36
+ }
37
+
38
+ static maxLength(max: number): ValidatorFn {
39
+ return (control: AbstractControl): ValidationErrors | null => {
40
+ if (!control.value) return null;
41
+ return control.value.length <= max ? null : { maxLength: { max, actual: control.value.length } };
42
+ };
43
+ }
44
+
45
+ static pattern(pattern: string, message?: string): ValidatorFn {
46
+ return (control: AbstractControl): ValidationErrors | null => {
47
+ if (!control.value) return null;
48
+ const regex = new RegExp(pattern);
49
+ return regex.test(control.value) ? null : { pattern: { message: message || 'Invalid format' } };
50
+ };
51
+ }
52
+
53
+ static numberRange(min?: number, max?: number): ValidatorFn {
54
+ return (control: AbstractControl): ValidationErrors | null => {
55
+ if (!control.value && control.value !== 0) return null;
56
+ const value = Number(control.value);
57
+ if (min !== undefined && value < min) {
58
+ return { min: { min, actual: value } };
59
+ }
60
+ if (max !== undefined && value > max) {
61
+ return { max: { max, actual: value } };
62
+ }
63
+ return null;
64
+ };
65
+ }
66
+
67
+ static dateRange(minDate?: string, maxDate?: string): ValidatorFn {
68
+ return (control: AbstractControl): ValidationErrors | null => {
69
+ if (!control.value) return null;
70
+ const date = new Date(control.value);
71
+ if (minDate && date < new Date(minDate)) {
72
+ return { minDate: { minDate } };
73
+ }
74
+ if (maxDate && date > new Date(maxDate)) {
75
+ return { maxDate: { maxDate } };
76
+ }
77
+ return null;
78
+ };
79
+ }
80
+
81
+ static getErrorMessage(errors: ValidationErrors | null): string {
82
+ if (!errors) return '';
83
+
84
+ if (errors['required']) return 'This field is required';
85
+ if (errors['email']) return 'Please enter a valid email address';
86
+ if (errors['phone']) return 'Please enter a valid phone number';
87
+ if (errors['url']) return 'Please enter a valid URL';
88
+ if (errors['minLength']) return `Minimum length is ${errors['minLength'].min} characters`;
89
+ if (errors['maxLength']) return `Maximum length is ${errors['maxLength'].max} characters`;
90
+ if (errors['min']) return `Minimum value is ${errors['min'].min}`;
91
+ if (errors['max']) return `Maximum value is ${errors['max'].max}`;
92
+ if (errors['minDate']) return `Date must be after ${errors['minDate'].minDate}`;
93
+ if (errors['maxDate']) return `Date must be before ${errors['maxDate'].maxDate}`;
94
+ if (errors['pattern']) return errors['pattern'].message || 'Invalid format';
95
+
96
+ return 'Invalid value';
97
+ }
98
+ }
@@ -0,0 +1,283 @@
1
+ <div class="smart-table-outer">
2
+ <!-- Table Card -->
3
+ <div class="smart-table-wrapper">
4
+ <!-- Top Toolbar -->
5
+ <div class="st-toolbar" *ngIf="config.searchConfig?.enabled || (config.filters && config.filters.length > 0) || (config.topBarButtons && config.topBarButtons.length > 0)">
6
+
7
+ <!-- Search -->
8
+ <div class="st-search" *ngIf="config.searchConfig?.enabled">
9
+ <i class="fa fa-search"></i>
10
+ <input type="text" [placeholder]="config.labels?.searchPlaceholder || 'Search'" (input)="onSearch($event)">
11
+ </div>
12
+
13
+ <!-- Filters -->
14
+ <div class="st-filters" *ngIf="config.filters">
15
+ <div class="st-filter-item" *ngFor="let filter of config.filters">
16
+ <!-- Trigger -->
17
+ <div class="st-filter-trigger"
18
+ [class.active]="openFilterKey === filter.key"
19
+ [class.has-value]="isFilterActive(filter)"
20
+ (click)="toggleFilter(filter.key, $event)">
21
+ <span class="st-filter-trigger-label">{{ getFilterDisplay(filter) }}</span>
22
+ <svg class="st-filter-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
23
+ <path d="M2.5 4.5L6 8L9.5 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
24
+ </svg>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <!-- Top Bar Buttons -->
30
+ <div class="st-actions" *ngIf="config.topBarButtons">
31
+ <lib-button *ngFor="let btn of getVisibleActions(config.topBarButtons)"
32
+ [variant]="btn.btnVariant || 'primary'"
33
+ [icon]="btn.icon || ''"
34
+ (click)="onTopAction(btn)">
35
+ {{ btn.label }}
36
+ </lib-button>
37
+ </div>
38
+ </div>
39
+
40
+ <!-- Selection count strip — visible whenever selectable is enabled -->
41
+ <div class="st-selection-strip" *ngIf="config.selectable">
42
+ <span class="st-selection-count">{{ selectedRows.length }} of {{ totalItems > 0 ? totalItems : data.length }} selected</span>
43
+ </div>
44
+
45
+ <!-- Table Container -->
46
+ <div class="st-table-container">
47
+ <div class="st-check-loader" *ngIf="loading">
48
+ <div class="spinner"></div>
49
+ </div>
50
+ <table class="st-table" [class.loading-data]="loading" [class.is-selectable]="config.selectable">
51
+ <thead>
52
+ <tr>
53
+ <th *ngIf="config.selectable" class="st-checkbox-col">
54
+ <input type="checkbox" (change)="onSelectAll($event)">
55
+ </th>
56
+ <th *ngFor="let col of config.columns; let colIndex = index"
57
+ #stickyHeader
58
+ [class.sortable]="col.sortable"
59
+ [class.sticky-col]="col.sticky"
60
+ [class.first-data-col]="colIndex === 0"
61
+ [ngStyle]="stickyColumnStyles[col.key]"
62
+ (click)="onSort(col)">
63
+ {{ col.label }}
64
+ <span *ngIf="col.sortable" class="sort-icon-wrap">
65
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
66
+ <!-- Down arrow — RIGHT side, prominent when DESC -->
67
+ <path d="M11.258 15.8153L14.5913 13.2699C14.7483 13.15 14.8364 12.9875 14.8364 12.818C14.8364 12.6486 14.7483 12.4861 14.5913 12.3662C14.4344 12.2464 14.2216 12.1791 13.9997 12.1791C13.7778 12.1791 13.5649 12.2464 13.408 12.3662L11.4997 13.8299V2.63636C11.4997 2.46758 11.4119 2.30572 11.2556 2.18638C11.0993 2.06704 10.8874 2 10.6663 2C10.4453 2 10.2334 2.06704 10.0771 2.18638C9.92081 2.30572 9.83301 2.46758 9.83301 2.63636V15.3635C9.83383 15.4891 9.88333 15.6117 9.97528 15.7159C10.0672 15.8201 10.1975 15.9012 10.3497 15.9489C10.4486 15.9845 10.557 16.002 10.6663 15.9998C10.776 16.0003 10.8847 15.9843 10.9863 15.9526C11.0878 15.9209 11.1801 15.8743 11.258 15.8153Z"
68
+ fill="black" [attr.fill-opacity]="getDescOpacity(col.key)"/>
69
+ <!-- Up arrow — LEFT side, prominent when ASC -->
70
+ <path d="M7.33316 16C7.11215 16 6.90019 15.933 6.74391 15.8136C6.58763 15.6942 6.49983 15.5324 6.49983 15.3636V4.16902L4.5915 5.63278C4.43458 5.75262 4.22175 5.81995 3.99983 5.81995C3.77791 5.81995 3.56508 5.75262 3.40816 5.63278C3.25124 5.51294 3.16309 5.3504 3.16309 5.18093C3.16309 5.01145 3.25124 4.84891 3.40816 4.72907L6.7415 2.18341C6.85868 2.0951 7.00749 2.03528 7.16915 2.01149C7.33081 1.98771 7.49807 2.00102 7.64983 2.04976C7.80201 2.0975 7.93228 2.17858 8.02423 2.28278C8.11617 2.38697 8.16567 2.50962 8.1665 2.63526V15.3636C8.1665 15.5324 8.0787 15.6942 7.92242 15.8136C7.76614 15.933 7.55418 16 7.33316 16Z"
71
+ fill="black" [attr.fill-opacity]="getAscOpacity(col.key)"/>
72
+ </svg>
73
+ </span>
74
+ </th>
75
+ <th *ngIf="getVisibleActions(config.actions).length > 0" class="st-actions-col">
76
+ {{ config.labels?.actionColumnHeader || 'Actions' }}
77
+ </th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr *ngFor="let row of data; let rowIndex = index" [class.editing-row]="row.isEditing" [ngClass]="row.isEditing && config.editingRowClass ? config.editingRowClass : ''">
82
+ <td *ngIf="config.selectable" class="st-checkbox-col">
83
+ <input type="checkbox" [(ngModel)]="row.selected" (change)="onRowSelect(row)">
84
+ </td>
85
+ <td *ngFor="let col of config.columns; let colIndex = index"
86
+ [class.sticky-col]="col.sticky"
87
+ [class.first-data-col]="colIndex === 0"
88
+ [ngStyle]="stickyColumnStyles[col.key]"
89
+ [class.clickable-cell]="col.clickAction"
90
+ (click)="onColumnClick(row, col)">
91
+ <!-- READ MODE -->
92
+ <ng-container *ngIf="!row.isEditing">
93
+ <!-- Text/Number/Date -->
94
+ <span *ngIf="col.type !== 'custom' && col.type !== 'html' && col.type !== 'badge'">
95
+ {{ getCellValue(row, col) }}
96
+ </span>
97
+ <!-- HTML -->
98
+ <div *ngIf="col.type === 'html'" [innerHTML]="getCellValue(row, col) | safeHtml"></div>
99
+ <!-- Badge -->
100
+ <span *ngIf="col.type === 'badge'" class="st-badge" [ngClass]="getBadgeClass(row, col)">
101
+ {{ getCellValue(row, col) }}
102
+ </span>
103
+ </ng-container>
104
+
105
+ <!-- EDIT/ADD MODE -->
106
+ <ng-container *ngIf="row.isEditing">
107
+ <!-- Multi-field cell (stacked inputs) -->
108
+ <div *ngIf="col.subFields" class="st-stacked-inputs">
109
+ <ng-container *ngFor="let sub of col.subFields">
110
+ <select *ngIf="sub.dataType === 'select'"
111
+ [(ngModel)]="row[sub.key]"
112
+ [disabled]="sub.editable === false || col.editConfig?.disabled"
113
+ class="st-cell-select">
114
+ <option *ngFor="let opt of sub.options" [value]="opt.value">{{ opt.label }}</option>
115
+ </select>
116
+ <!-- Date picker -->
117
+ <div *ngIf="sub.dataType === 'date'" class="st-date-cell">
118
+ <input matInput [matDatepicker]="subPicker"
119
+ [(ngModel)]="row[sub.key]"
120
+ [disabled]="sub.editable === false || col.editConfig?.disabled"
121
+ [placeholder]="sub.placeholder || ''"
122
+ class="st-cell-input"
123
+ (click)="subPicker.open()">
124
+ <mat-datepicker-toggle [for]="subPicker"></mat-datepicker-toggle>
125
+ <mat-datepicker #subPicker></mat-datepicker>
126
+ </div>
127
+ <input *ngIf="sub.dataType !== 'select' && sub.dataType !== 'date'"
128
+ [type]="sub.dataType"
129
+ [(ngModel)]="row[sub.key]"
130
+ [disabled]="sub.editable === false || col.editConfig?.disabled"
131
+ [placeholder]="sub.placeholder || ''"
132
+ class="st-cell-input">
133
+ </ng-container>
134
+ </div>
135
+
136
+ <!-- Single field cell input -->
137
+ <div *ngIf="!col.subFields">
138
+ <select *ngIf="col.dataType === 'select'"
139
+ [(ngModel)]="row[col.key]"
140
+ [disabled]="col.editable === false || col.editConfig?.disabled"
141
+ class="st-cell-select">
142
+ <option *ngFor="let opt of col.options" [value]="opt.value">{{ opt.label }}</option>
143
+ </select>
144
+ <!-- Date picker -->
145
+ <div *ngIf="col.dataType === 'date'" class="st-date-cell">
146
+ <input matInput [matDatepicker]="colPicker"
147
+ [(ngModel)]="row[col.key]"
148
+ [disabled]="col.editable === false || col.editConfig?.disabled"
149
+ class="st-cell-input"
150
+ (click)="colPicker.open()">
151
+ <mat-datepicker-toggle [for]="colPicker"></mat-datepicker-toggle>
152
+ <mat-datepicker #colPicker></mat-datepicker>
153
+ </div>
154
+ <input *ngIf="col.dataType !== 'select' && col.dataType !== 'date'"
155
+ [type]="col.dataType || 'text'"
156
+ [(ngModel)]="row[col.key]"
157
+ [disabled]="col.editable === false || col.editConfig?.disabled"
158
+ class="st-cell-input">
159
+ </div>
160
+ </ng-container>
161
+ </td>
162
+
163
+ <!-- Row Actions -->
164
+ <td *ngIf="getVisibleActions(config.actions).length > 0" class="st-row-actions st-actions-col">
165
+ <div class="action-buttons">
166
+ <!-- EDIT MODE ACTIONS -->
167
+ <ng-container *ngIf="row.isEditing">
168
+ <div class="edit-mode-actions">
169
+ <lib-button variant="outline" (click)="onCancelRow(row, rowIndex); $event.stopPropagation()">
170
+ {{ config.labels?.cancelLabel || 'Cancel' }}
171
+ </lib-button>
172
+ <lib-button [variant]="row.isNew ? (config.labels?.addButtonVariant || 'danger') : (config.labels?.saveButtonVariant || 'primary')" (click)="onSaveRow(row); $event.stopPropagation()">
173
+ {{ row.isNew ? (config.labels?.addLabel || 'Add') : (config.labels?.saveLabel || 'Save') }}
174
+ </lib-button>
175
+ </div>
176
+ </ng-container>
177
+
178
+ <!-- READ MODE ACTIONS -->
179
+ <ng-container *ngIf="!row.isEditing">
180
+ <ng-container *ngFor="let action of getVisibleActions(config.actions, row); let i = index">
181
+ <ng-container *ngIf="action.type === 'dropdown'">
182
+ <div class="st-dropdown-container" (click)="$event.stopPropagation()">
183
+ <button class="st-dropdown-btn"
184
+ [class.active]="openDropdownId === (rowIndex + '-' + i)"
185
+ (click)="toggleDropdown(rowIndex + '-' + i, $event, getVisibleActions(action.items, row), row)">
186
+ <span class="action-circle">
187
+ <i class="fa fa-ellipsis-h"></i>
188
+ </span>
189
+ </button>
190
+ </div>
191
+ </ng-container>
192
+ <ng-container *ngIf="action.type !== 'dropdown'">
193
+ <lib-button
194
+ [variant]="action.btnVariant || 'secondary'"
195
+ [icon]="action.icon || ''"
196
+ (click)="onAction(action, row)">
197
+ {{ action.label }}
198
+ </lib-button>
199
+ </ng-container>
200
+ </ng-container>
201
+ </ng-container>
202
+ </div>
203
+ </td>
204
+ </tr>
205
+ <tr *ngIf="data.length === 0 && !loading">
206
+ <td [attr.colspan]="columnCount + (config.selectable ? 1 : 0) + (getVisibleActions(config.actions).length > 0 ? 1 : 0)" class="no-data">
207
+ {{ config.labels?.noDataMessage || 'No data available' }}
208
+ </td>
209
+ </tr>
210
+ </tbody>
211
+ </table>
212
+ </div>
213
+
214
+ <!-- Pagination — inside the card, sticks to the bottom -->
215
+ <div class="st-pagination" *ngIf="showPagination">
216
+ <lib-pagination
217
+ [totalItems]="totalItems"
218
+ [itemsPerPage]="config.pagination!.pageSize"
219
+ [currentPage]="currentPage"
220
+ [pageSizeOptions]="config.pagination!.pageSizeOptions"
221
+ (pageChange)="onPageChange($event)"
222
+ (itemsPerPageChange)="onPageSizeChange($event)">
223
+ </lib-pagination>
224
+ </div>
225
+
226
+ <!-- Built-in Delete Confirmation Modal -->
227
+ <cc-confirmation-modal
228
+ [isOpen]="deleteModalOpen"
229
+ [config]="deleteModalConfig"
230
+ (confirm)="onDeleteConfirm()"
231
+ (cancel)="onDeleteCancel()"
232
+ (close)="onDeleteCancel()">
233
+ <p>{{ deleteModalMessage }}</p>
234
+ </cc-confirmation-modal>
235
+ </div>
236
+ </div>
237
+
238
+ <!--
239
+ Filter panel portal — position:fixed keeps it above all overflow/sticky containers.
240
+ -->
241
+ <div class="st-filter-panel"
242
+ *ngIf="openFilterKey !== null && activeFilterData"
243
+ [ngStyle]="{
244
+ position: 'fixed',
245
+ top: filterPosition.top + 'px',
246
+ left: filterPosition.left + 'px',
247
+ 'z-index': '99999'
248
+ }"
249
+ (click)="$event.stopPropagation()">
250
+ <div class="st-filter-option"
251
+ [class.selected]="!isFilterActive(activeFilterData)"
252
+ (click)="selectFilterOption(activeFilterData, null)">
253
+ All {{ activeFilterData.label }}
254
+ </div>
255
+ <div class="st-filter-option"
256
+ *ngFor="let opt of getValidFilterOptions(activeFilterData)"
257
+ [class.selected]="activeFilters[activeFilterData.key] === opt.value"
258
+ (click)="selectFilterOption(activeFilterData, opt)">
259
+ {{ opt.label }}
260
+ </div>
261
+ </div>
262
+
263
+ <!--
264
+ Dropdown portal — rendered OUTSIDE every scroll/sticky container.
265
+ position:fixed + z-index:99999 here is unconditionally above all sticky table cells.
266
+ -->
267
+ <div class="st-dropdown-menu st-dropdown-portal"
268
+ *ngIf="openDropdownId !== null && activeDropdownItems"
269
+ [ngStyle]="{
270
+ position: 'fixed',
271
+ top: dropdownPosition.top + 'px',
272
+ right: dropdownPosition.right + 'px',
273
+ left: 'auto',
274
+ 'z-index': '99999'
275
+ }"
276
+ (click)="$event.stopPropagation()">
277
+ <button class="st-dropdown-item"
278
+ *ngFor="let item of activeDropdownItems"
279
+ (click)="onActionItemClick(item, activeDropdownRow, $event); closeDropdown()">
280
+ <i *ngIf="item.icon" [class]="item.icon + ' st-action-icon'"></i>
281
+ <span>{{ item.label }}</span>
282
+ </button>
283
+ </div>