platformcommons-web-lib 1.0.0

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 (208) hide show
  1. package/commons-shared-web-ui-1.0.0.tgz +0 -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 +597 -0
  11. package/documentation/form-components.md +384 -0
  12. package/documentation/nav.md +427 -0
  13. package/documentation/pagination.md +181 -0
  14. package/documentation/side-nav-documentation.md +169 -0
  15. package/documentation/smart-form.md +2177 -0
  16. package/documentation/smart-table.md +1198 -0
  17. package/documentation/snackbar.md +118 -0
  18. package/documentation/style-externalization.md +88 -0
  19. package/documentation/summary-card.md +279 -0
  20. package/ng-package.json +28 -0
  21. package/package.json +54 -0
  22. package/src/lib/modules/alert/alert.models.ts +6 -0
  23. package/src/lib/modules/alert/alert.module.ts +16 -0
  24. package/src/lib/modules/alert/alert.theme.scss +85 -0
  25. package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
  26. package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
  27. package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
  28. package/src/lib/modules/button/button.models.ts +13 -0
  29. package/src/lib/modules/button/button.module.ts +16 -0
  30. package/src/lib/modules/button/button.theme.scss +121 -0
  31. package/src/lib/modules/button/components/button/button.component.html +22 -0
  32. package/src/lib/modules/button/components/button/button.component.scss +88 -0
  33. package/src/lib/modules/button/components/button/button.component.ts +67 -0
  34. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
  35. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
  36. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -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/configurable-form/configurable-form.theme.scss +78 -0
  47. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
  50. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
  52. package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
  53. package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
  54. package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
  55. package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
  56. package/src/lib/modules/filter/filter.models.ts +88 -0
  57. package/src/lib/modules/filter/filter.module.ts +24 -0
  58. package/src/lib/modules/filter/filter.theme.scss +92 -0
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
  61. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
  62. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
  63. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
  64. package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
  66. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
  67. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
  68. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
  69. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
  70. package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
  74. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
  75. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
  76. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
  77. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
  78. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
  79. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
  80. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
  81. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
  82. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
  83. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
  84. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
  85. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
  86. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
  87. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
  88. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
  89. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
  90. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
  91. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
  92. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
  93. package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
  94. package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
  95. package/src/lib/modules/form-builder/index.ts +9 -0
  96. package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
  97. package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
  98. package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
  99. package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
  100. package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
  101. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
  102. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
  103. package/src/lib/modules/form-builder/utils/constants.ts +43 -0
  104. package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
  105. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
  106. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
  107. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
  108. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
  109. package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
  110. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
  111. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
  112. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
  113. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
  114. package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
  115. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
  116. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
  117. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
  118. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
  119. package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
  120. package/src/lib/modules/form-components/components/input/input.component.html +51 -0
  121. package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
  122. package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
  123. package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
  124. package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
  125. package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
  126. package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
  127. package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
  128. package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
  129. package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
  130. package/src/lib/modules/form-components/components/search/search.component.html +15 -0
  131. package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
  132. package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
  133. package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
  134. package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
  135. package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
  136. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
  137. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
  138. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
  139. package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
  140. package/src/lib/modules/form-components/form-components.module.ts +41 -0
  141. package/src/lib/modules/form-components/form-components.theme.scss +25 -0
  142. package/src/lib/modules/material/material.module.ts +94 -0
  143. package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
  144. package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
  145. package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
  146. package/src/lib/modules/nav/nav.models.ts +31 -0
  147. package/src/lib/modules/nav/nav.module.ts +17 -0
  148. package/src/lib/modules/nav/nav.theme.scss +86 -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/pagination/pagination.theme.scss +66 -0
  154. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
  155. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
  156. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
  157. package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
  158. package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
  159. package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
  160. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
  161. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
  162. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
  163. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
  164. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
  165. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
  166. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
  167. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
  168. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
  169. package/src/lib/modules/smart-form/index.ts +10 -0
  170. package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
  171. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
  172. package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
  173. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
  174. package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
  175. package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
  176. package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
  177. package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
  178. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
  179. package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
  180. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
  181. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
  182. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
  183. package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
  184. package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
  185. package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
  186. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
  187. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
  188. package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
  189. package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
  190. package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
  191. package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
  192. package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
  193. package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
  194. package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
  195. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
  196. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
  197. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
  198. package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
  199. package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
  200. package/src/lib/shared-ui.module.ts +44 -0
  201. package/src/lib/styles/global.scss +152 -0
  202. package/src/lib/styles/utilities.scss +250 -0
  203. package/src/lib/utils/constants.ts +11 -0
  204. package/src/lib/utils/storage.utils.ts +37 -0
  205. package/src/lib/utils/string.utils.ts +23 -0
  206. package/src/lib/utils/translation.utils.ts +87 -0
  207. package/src/public-api.ts +104 -0
  208. package/tsconfig.lib.json +15 -0
@@ -0,0 +1,605 @@
1
+ # Configurable Form Component Documentation
2
+
3
+ The `ConfigurableFormComponent` is a powerful, dynamic form builder that supports JSON-based configuration, dependent dropdowns, repeater sections, composite fields, and comprehensive validation.
4
+
5
+ ## Features
6
+
7
+ - **JSON-Based Configuration**: Build complex forms from JSON configuration
8
+ - **Dependent Dropdowns**: Cascading dropdowns with automatic value clearing
9
+ - **Repeater Sections**: Add/remove multiple items dynamically with min/max validation
10
+ - **Composite Fields**: Group related fields (e.g., Age Range: Min - Max)
11
+ - **Rich Field Types**: Text, Number, Email, Tel, Date, Dropdown, Radio, File Upload, Textarea
12
+ - **API Integration**: Load dropdown options from REST APIs with dynamic URL substitution
13
+ - **Comprehensive Validation**: Required, min/max length, pattern matching, custom validators
14
+ - **Mobile Responsive**: Bootstrap-like grid system (col-6, col-md-4, etc.)
15
+ - **File Upload**: Single/multiple file upload with preview and size validation
16
+ - **Character Count**: Real-time character counting for text fields
17
+ - **Help Text**: Contextual help text for fields
18
+ - **Collapsible Sections**: Organize forms with collapsible sections
19
+
20
+ ## Installation
21
+
22
+ To install the latest version of the `commons-shared-web-ui` library, run the following command:
23
+
24
+ ```bash
25
+ npm install commons-shared-web-ui@latest
26
+ ```
27
+
28
+ Import the `ConfigurableFormModule` into your feature module or `SharedModule`.
29
+
30
+ ```typescript
31
+ import { ConfigurableFormModule } from "@campus-cloud/shared-ui";
32
+
33
+ @NgModule({
34
+ imports: [
35
+ ConfigurableFormModule,
36
+ // ...
37
+ ],
38
+ })
39
+ export class MyFeatureModule {}
40
+ ```
41
+
42
+ ## API Reference
43
+
44
+ ### Inputs
45
+
46
+ | Input | Type | Default | Description |
47
+ | ------------ | ---------------- | -------- | ------------------------------------------- |
48
+ | `config` | `FormConfig` | required | Form configuration object (standard format) |
49
+ | `jsonConfig` | `JsonFormConfig` | optional | JSON-based configuration from API |
50
+ | `data` | `any` | `{}` | Initial form data for pre-filling |
51
+ | `baseApiUrl` | `string` | `''` | Base URL for API calls (dropdown options) |
52
+
53
+ ### Outputs
54
+
55
+ | Output | Type | Description |
56
+ | ------------ | -------------------- | ---------------------------------------------- |
57
+ | `formSubmit` | `EventEmitter<any>` | Emitted when form is submitted with valid data |
58
+ | `formCancel` | `EventEmitter<void>` | Emitted when cancel button is clicked |
59
+
60
+ ## Configuration Interfaces
61
+
62
+ ### FormConfig
63
+
64
+ ```typescript
65
+ interface FormConfig {
66
+ sections: FormSection[];
67
+ submitLabel?: string; // Default: 'Submit'
68
+ cancelLabel?: string; // Default: 'Cancel'
69
+ saveDraftLabel?: string; // Default: 'Save Draft'
70
+ isModal?: boolean; // Default: false
71
+ entityType?: string;
72
+ }
73
+ ```
74
+
75
+ ### FormSection
76
+
77
+ ```typescript
78
+ interface FormSection {
79
+ sectionTitle?: string;
80
+ fields: FormField[];
81
+ isRepeater?: boolean; // Enable repeater functionality
82
+ formArrayName?: string; // Name for FormArray (default: 'items')
83
+ repeaterItemLabel?: string; // Label for items (e.g., 'Contact')
84
+ addLabel?: string; // 'Add More' button text
85
+ minItems?: number; // Minimum items (default: 1)
86
+ maxItems?: number; // Maximum items
87
+ collapsible?: boolean; // Can section be collapsed
88
+ collapsed?: boolean; // Initial collapsed state
89
+ noCardLayout?: boolean; // Remove card styling
90
+ }
91
+ ```
92
+
93
+ ### FormField
94
+
95
+ ```typescript
96
+ interface FormField {
97
+ name: string; // Field name (required)
98
+ jsonKey?: string; // JSON key for API mapping
99
+ label: string; // Field label (required)
100
+ type: FieldType; // Field type
101
+ placeholder?: string; // Placeholder text
102
+ required?: boolean; // Is field required
103
+ mandatory?: boolean; // Is field mandatory
104
+ disabled?: boolean; // Is field disabled
105
+ visible?: boolean; // Is field visible
106
+ class?: string; // Grid class (e.g., 'col-6 col-md-4')
107
+ value?: any; // Initial value
108
+
109
+ // Options
110
+ options?: FormOption[]; // Static options array
111
+ optionConfigs?: OptionConfig; // API configuration for options
112
+ loadedOptions?: FormOption[]; // Loaded options from API
113
+
114
+ // Dependencies
115
+ dependsOn?: string; // Parent field name
116
+ dependent?: string[]; // Array of child field names
117
+
118
+ // Validation
119
+ validationRules?: ValidationRules;
120
+
121
+ // Composite Fields
122
+ type?: "composite";
123
+ subFields?: FormField[]; // Sub-fields for composite
124
+ compositeValidationRule?: "minMax" | "percentageTotal";
125
+
126
+ // File Upload
127
+ multiple?: boolean; // Allow multiple files
128
+ uploadedFiles?: any[]; // Uploaded files array
129
+
130
+ // UI Config
131
+ uiConfig?: UIConfig;
132
+ helpText?: string; // Help text below field
133
+
134
+ // Styling
135
+ valueColor?: string;
136
+ headerColor?: string;
137
+ }
138
+ ```
139
+
140
+ ### FieldType
141
+
142
+ ```typescript
143
+ type FieldType =
144
+ | "text"
145
+ | "number"
146
+ | "email"
147
+ | "tel"
148
+ | "password"
149
+ | "url"
150
+ | "textarea"
151
+ | "dropdown"
152
+ | "select"
153
+ | "radio"
154
+ | "date"
155
+ | "file"
156
+ | "composite";
157
+ ```
158
+
159
+ ### ValidationRules
160
+
161
+ ```typescript
162
+ interface ValidationRules {
163
+ isMandatory?: boolean;
164
+ isRequired?: boolean;
165
+ minLength?: number;
166
+ maxLength?: number;
167
+ min?: number;
168
+ max?: number;
169
+ pattern?: string; // Regex pattern
170
+ }
171
+ ```
172
+
173
+ ### OptionConfig (for API-based dropdowns)
174
+
175
+ ```typescript
176
+ interface OptionConfig {
177
+ optionDTO: "OPTION_DTO.STATIC" | "OPTION_DTO.REF_DATA";
178
+ staticOptions?: FormOption[];
179
+ url?: string; // API endpoint
180
+ labelKey?: string; // Key for label in response (default: 'name')
181
+ valueKey?: string; // Key for value in response (default: 'id')
182
+ requestKey?: string; // Key for request parameter (default: 'code')
183
+ }
184
+ ```
185
+
186
+ ## Usage Examples
187
+
188
+ ### Basic Form
189
+
190
+ ```typescript
191
+ import { ConfigurableFormModule } from "shared-ui";
192
+
193
+ formConfig: FormConfig = {
194
+ sections: [
195
+ {
196
+ sectionTitle: "Personal Information",
197
+ fields: [
198
+ {
199
+ name: "firstName",
200
+ label: "First Name",
201
+ type: "text",
202
+ required: true,
203
+ class: "col-6",
204
+ },
205
+ {
206
+ name: "lastName",
207
+ label: "Last Name",
208
+ type: "text",
209
+ required: true,
210
+ class: "col-6",
211
+ },
212
+ {
213
+ name: "email",
214
+ label: "Email",
215
+ type: "email",
216
+ required: true,
217
+ class: "col-12",
218
+ },
219
+ ],
220
+ },
221
+ ],
222
+ };
223
+ ```
224
+
225
+ ```html
226
+ <lib-configurable-form
227
+ [config]="formConfig"
228
+ (formSubmit)="onSubmit($event)"
229
+ (formCancel)="onCancel()"
230
+ >
231
+ </lib-configurable-form>
232
+ ```
233
+
234
+ ### Dependent Dropdowns (Cascading)
235
+
236
+ ```typescript
237
+ formConfig: FormConfig = {
238
+ sections: [
239
+ {
240
+ sectionTitle: "Location",
241
+ fields: [
242
+ {
243
+ name: "state",
244
+ label: "State",
245
+ type: "dropdown",
246
+ required: true,
247
+ dependent: ["district"], // Will clear district when state changes
248
+ optionConfigs: {
249
+ optionDTO: "OPTION_DTO.REF_DATA",
250
+ url: "api/states",
251
+ labelKey: "name",
252
+ valueKey: "code",
253
+ },
254
+ },
255
+ {
256
+ name: "district",
257
+ label: "District",
258
+ type: "dropdown",
259
+ required: true,
260
+ dependsOn: "state",
261
+ dependent: ["taluk"],
262
+ optionConfigs: {
263
+ optionDTO: "OPTION_DTO.REF_DATA",
264
+ url: "api/districts?stateCode={state}", // {state} will be replaced
265
+ labelKey: "name",
266
+ valueKey: "code",
267
+ },
268
+ },
269
+ {
270
+ name: "taluk",
271
+ label: "Taluk",
272
+ type: "dropdown",
273
+ required: true,
274
+ dependsOn: "district",
275
+ optionConfigs: {
276
+ optionDTO: "OPTION_DTO.REF_DATA",
277
+ url: "api/taluks?districtCode={district}",
278
+ labelKey: "name",
279
+ valueKey: "code",
280
+ },
281
+ },
282
+ ],
283
+ },
284
+ ],
285
+ };
286
+ ```
287
+
288
+ ### Repeater Section (Dynamic Add/Remove)
289
+
290
+ ```typescript
291
+ formConfig: FormConfig = {
292
+ sections: [
293
+ {
294
+ sectionTitle: "Contact Information",
295
+ isRepeater: true,
296
+ formArrayName: "contacts",
297
+ repeaterItemLabel: "Contact",
298
+ addLabel: "Add Another Contact",
299
+ minItems: 1,
300
+ maxItems: 5,
301
+ fields: [
302
+ {
303
+ name: "contactName",
304
+ label: "Contact Name",
305
+ type: "text",
306
+ required: true,
307
+ class: "col-6",
308
+ },
309
+ {
310
+ name: "contactPhone",
311
+ label: "Phone Number",
312
+ type: "tel",
313
+ required: true,
314
+ class: "col-6",
315
+ },
316
+ {
317
+ name: "contactEmail",
318
+ label: "Email",
319
+ type: "email",
320
+ class: "col-12",
321
+ },
322
+ ],
323
+ },
324
+ ],
325
+ };
326
+ ```
327
+
328
+ ### Composite Fields (Min-Max, Percentages)
329
+
330
+ ```typescript
331
+ formConfig: FormConfig = {
332
+ sections: [
333
+ {
334
+ sectionTitle: "Target Demographics",
335
+ fields: [
336
+ {
337
+ name: "targetAge",
338
+ label: "Target Age Group",
339
+ type: "composite",
340
+ compositeValidationRule: "minMax",
341
+ required: true,
342
+ subFields: [
343
+ {
344
+ name: "minAge",
345
+ label: "Min Age",
346
+ type: "number",
347
+ class: "col-6",
348
+ },
349
+ {
350
+ name: "maxAge",
351
+ label: "Max Age",
352
+ type: "number",
353
+ class: "col-6",
354
+ },
355
+ ],
356
+ },
357
+ {
358
+ name: "genderSplit",
359
+ label: "Gender Split (%)",
360
+ type: "composite",
361
+ compositeValidationRule: "percentageTotal", // Must add up to 100
362
+ required: true,
363
+ subFields: [
364
+ {
365
+ name: "malePercentage",
366
+ label: "Male %",
367
+ type: "number",
368
+ class: "col-6",
369
+ },
370
+ {
371
+ name: "femalePercentage",
372
+ label: "Female %",
373
+ type: "number",
374
+ class: "col-6",
375
+ },
376
+ ],
377
+ },
378
+ ],
379
+ },
380
+ ],
381
+ };
382
+ ```
383
+
384
+ ### File Upload with Preview
385
+
386
+ ```typescript
387
+ formConfig: FormConfig = {
388
+ sections: [
389
+ {
390
+ sectionTitle: "Documents",
391
+ fields: [
392
+ {
393
+ name: "profilePhoto",
394
+ label: "Profile Photo",
395
+ type: "file",
396
+ required: true,
397
+ multiple: false,
398
+ helpText: "Upload a photo (max 5MB)",
399
+ class: "col-6",
400
+ },
401
+ {
402
+ name: "documents",
403
+ label: "Supporting Documents",
404
+ type: "file",
405
+ multiple: true,
406
+ helpText: "Upload multiple documents (max 5MB each)",
407
+ class: "col-6",
408
+ },
409
+ ],
410
+ },
411
+ ],
412
+ };
413
+ ```
414
+
415
+ ### Static Dropdown Options
416
+
417
+ ```typescript
418
+ formConfig: FormConfig = {
419
+ sections: [
420
+ {
421
+ fields: [
422
+ {
423
+ name: "gender",
424
+ label: "Gender",
425
+ type: "dropdown",
426
+ required: true,
427
+ optionConfigs: {
428
+ optionDTO: "OPTION_DTO.STATIC",
429
+ staticOptions: [
430
+ { label: "Male", value: "M" },
431
+ { label: "Female", value: "F" },
432
+ { label: "Other", value: "O" },
433
+ ],
434
+ },
435
+ },
436
+ ],
437
+ },
438
+ ],
439
+ };
440
+ ```
441
+
442
+ ### With Character Limit and Help Text
443
+
444
+ ```typescript
445
+ formConfig: FormConfig = {
446
+ sections: [
447
+ {
448
+ fields: [
449
+ {
450
+ name: "description",
451
+ label: "Project Description",
452
+ type: "textarea",
453
+ required: true,
454
+ validationRules: {
455
+ maxLength: 500,
456
+ },
457
+ helpText: "Provide a brief description of your project",
458
+ class: "col-12",
459
+ },
460
+ ],
461
+ },
462
+ ],
463
+ };
464
+ ```
465
+
466
+ ### Using JSON Config from API
467
+
468
+ ```typescript
469
+ // When receiving configuration from backend API
470
+ jsonConfig: JsonFormConfig = {
471
+ label: "Village Registration",
472
+ entityType: "VILLAGE",
473
+ jsonConfig: [
474
+ {
475
+ jsonKey: "villageName",
476
+ label: "Village Name",
477
+ sequence: 1,
478
+ keyType: "STRING",
479
+ uiConfig: {
480
+ type: "UI_TYPE.TEXT_BOX",
481
+ subType: "UI_SUBTYPE.SHORT_TEXT",
482
+ },
483
+ validationRules: {
484
+ isMandatory: true,
485
+ maxLength: 100,
486
+ },
487
+ },
488
+ // ... more fields
489
+ ],
490
+ };
491
+ ```
492
+
493
+ ```html
494
+ <lib-configurable-form
495
+ [jsonConfig]="jsonConfig"
496
+ [baseApiUrl]="'https://api.example.com'"
497
+ (formSubmit)="onSubmit($event)"
498
+ >
499
+ </lib-configurable-form>
500
+ ```
501
+
502
+ ## Mobile Responsive Grid Classes
503
+
504
+ The component uses a Bootstrap-like grid system:
505
+
506
+ - `col-1` to `col-12` - Mobile columns (full width by default)
507
+ - `col-md-1` to `col-md-12` - Desktop columns (min-width: 769px)
508
+ - Example: `class: "col-6 col-md-4"` → Half width on mobile, 1/3 on desktop
509
+
510
+ ## Validation Features
511
+
512
+ - **Required fields**: Visual indicators with red asterisk
513
+ - **Real-time validation**: Validates on blur and form submission
514
+ - **Error messages**: Displays validation errors below fields
515
+ - **Scroll to error**: Automatically scrolls to first invalid field on submit
516
+ - **Composite validation**: Special validators for min-max and percentage totals
517
+ - **File size validation**: Enforces 5MB limit per file
518
+
519
+ ## Best Practices
520
+
521
+ 1. **Use JSON Config for API-driven forms**: When form structure comes from backend
522
+ 2. **Use FormConfig for static forms**: When form structure is known at compile time
523
+ 3. **Set baseApiUrl**: Provide base URL for cleaner API endpoint configuration
524
+ 4. **Use grid classes**: Always specify responsive grid classes for proper layout
525
+ 5. **Provide help text**: Add contextual help for complex fields
526
+ 6. **Validate composite fields**: Use built-in validators for min-max and percentages
527
+ 7. **Handle file uploads**: Process uploaded files in the submit handler
528
+ 8. **Pre-fill data**: Use the `data` input to pre-populate forms for editing
529
+
530
+ ## Accessibility
531
+
532
+ - Semantic HTML structure
533
+ - Proper label associations
534
+ - ARIA attributes for validation states
535
+ - Keyboard navigation support
536
+ - Focus management for error states
537
+ - Screen reader friendly error messages
538
+
539
+
540
+ ## Playground Example (With Translation Keys and labelsObject)
541
+
542
+ You can use the following configuration in the UI Playground to test the component with translation keys:
543
+
544
+ ```json
545
+ {
546
+ "config": {
547
+ "sections": [
548
+ {
549
+ "sectionTitle": "UI_PLAYGROUND.CONFIG_FORM.DONOR.SECTION.INFO",
550
+ "fields": [
551
+ {
552
+ "name": "donorLegalName",
553
+ "label": "UI_PLAYGROUND.CONFIG_FORM.DONOR.LEGAL_NAME.LABEL",
554
+ "type": "text",
555
+ "placeholder": "UI_PLAYGROUND.CONFIG_FORM.DONOR.LEGAL_NAME.PH",
556
+ "required": true,
557
+ "class": "col-12"
558
+ },
559
+ {
560
+ "name": "donorType",
561
+ "label": "UI_PLAYGROUND.CONFIG_FORM.DONOR.TYPE.LABEL",
562
+ "type": "dropdown",
563
+ "placeholder": "UI_PLAYGROUND.COMMON.SELECT",
564
+ "required": true,
565
+ "options": [
566
+ {
567
+ "label": "UI_PLAYGROUND.OPTION.INDIVIDUAL",
568
+ "value": "individual"
569
+ },
570
+ {
571
+ "label": "UI_PLAYGROUND.OPTION.CORPORATE",
572
+ "value": "corporate"
573
+ }
574
+ ],
575
+ "class": "col-12"
576
+ }
577
+ ]
578
+ }
579
+ ]
580
+ },
581
+ "labels": {
582
+ "repeaterItemDefaultLabel": "Item",
583
+ "addMoreDefaultLabel": "Add More",
584
+ "selectDefaultPlaceholder": "Select",
585
+ "errorMinValue": "Min value cannot be greater than Max value.",
586
+ "errorPercentageTotal": "Total percentage must be 100%.",
587
+ "uploadDragDropText": "Click to upload File",
588
+ "uploadHint": "PDF, DOCX, JPG, PNG (Max 5MB)",
589
+ "charactersLabel": "Characters",
590
+ "removeFileAriaLabel": "Remove file",
591
+ "errorFileLimitExceeded": "File {0} exceeds 5MB limit",
592
+ "errorMaxItemsAllowed": "Maximum {0} items allowed",
593
+ "closeSnackBar": "Close",
594
+ "labelsObject": {
595
+ "UI_PLAYGROUND.CONFIG_FORM.DONOR.SECTION.INFO": "Donor Information",
596
+ "UI_PLAYGROUND.CONFIG_FORM.DONOR.LEGAL_NAME.LABEL": "Legal Name (Same as PAN)",
597
+ "UI_PLAYGROUND.CONFIG_FORM.DONOR.LEGAL_NAME.PH": "Enter legal name",
598
+ "UI_PLAYGROUND.CONFIG_FORM.DONOR.TYPE.LABEL": "Donor Type",
599
+ "UI_PLAYGROUND.COMMON.SELECT": "Select an option",
600
+ "UI_PLAYGROUND.OPTION.INDIVIDUAL": "Individual",
601
+ "UI_PLAYGROUND.OPTION.CORPORATE": "Corporate"
602
+ }
603
+ }
604
+ }
605
+ ```