commons-shared-web-ui 0.0.50 → 0.0.52

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 (187) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +14557 -0
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
  3. package/index.d.ts +4534 -0
  4. package/package.json +34 -53
  5. package/src/lib/styles/utilities.scss +1 -0
  6. package/.claude/settings.local.json +0 -10
  7. package/documentation/alert.md +0 -123
  8. package/documentation/button-dropdown.md +0 -126
  9. package/documentation/button.md +0 -184
  10. package/documentation/cards-usage-guidelines.md +0 -131
  11. package/documentation/configurable-form.md +0 -605
  12. package/documentation/confirmation-modal.md +0 -250
  13. package/documentation/filter-sidebar.md +0 -178
  14. package/documentation/filter-table-selector.md +0 -228
  15. package/documentation/form-builder.md +0 -597
  16. package/documentation/form-components.md +0 -384
  17. package/documentation/nav.md +0 -427
  18. package/documentation/pagination.md +0 -181
  19. package/documentation/side-nav-documentation.md +0 -169
  20. package/documentation/smart-form.md +0 -2405
  21. package/documentation/smart-table.md +0 -1221
  22. package/documentation/snackbar.md +0 -118
  23. package/documentation/style-externalization.md +0 -88
  24. package/documentation/summary-card.md +0 -279
  25. package/ng-package.json +0 -28
  26. package/src/lib/modules/alert/alert.models.ts +0 -6
  27. package/src/lib/modules/alert/alert.module.ts +0 -16
  28. package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
  29. package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
  30. package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
  31. package/src/lib/modules/button/button.models.ts +0 -13
  32. package/src/lib/modules/button/button.module.ts +0 -16
  33. package/src/lib/modules/button/components/button/button.component.html +0 -22
  34. package/src/lib/modules/button/components/button/button.component.scss +0 -88
  35. package/src/lib/modules/button/components/button/button.component.ts +0 -67
  36. package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
  37. package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
  38. package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +0 -87
  39. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
  40. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
  41. package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
  42. package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
  43. package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
  44. package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
  45. package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
  46. package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
  47. package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
  48. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
  49. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
  50. package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
  51. package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
  52. package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
  53. package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
  54. package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
  55. package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
  56. package/src/lib/modules/filter/filter.models.ts +0 -88
  57. package/src/lib/modules/filter/filter.module.ts +0 -24
  58. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
  59. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
  60. package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
  61. package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
  62. package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
  63. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
  64. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
  65. package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
  66. package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
  67. package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
  68. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
  69. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
  70. package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
  71. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
  72. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
  73. package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
  74. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
  75. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
  76. package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
  77. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
  78. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
  79. package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
  80. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
  81. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
  82. package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
  83. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
  84. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
  85. package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
  86. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
  87. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
  88. package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
  89. package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
  90. package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
  91. package/src/lib/modules/form-builder/index.ts +0 -9
  92. package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
  93. package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
  94. package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
  95. package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
  96. package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
  97. package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
  98. package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
  99. package/src/lib/modules/form-builder/utils/constants.ts +0 -43
  100. package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
  101. package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
  102. package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
  103. package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
  104. package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
  105. package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
  106. package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
  107. package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
  108. package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
  109. package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
  110. package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
  111. package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
  112. package/src/lib/modules/form-components/components/input/input.component.html +0 -51
  113. package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
  114. package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
  115. package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
  116. package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
  117. package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
  118. package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
  119. package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
  120. package/src/lib/modules/form-components/components/search/search.component.html +0 -15
  121. package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
  122. package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
  123. package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
  124. package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
  125. package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
  126. package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
  127. package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
  128. package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
  129. package/src/lib/modules/form-components/form-components.module.ts +0 -41
  130. package/src/lib/modules/material/material.module.ts +0 -94
  131. package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
  132. package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
  133. package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
  134. package/src/lib/modules/nav/nav.models.ts +0 -31
  135. package/src/lib/modules/nav/nav.module.ts +0 -17
  136. package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
  137. package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
  138. package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
  139. package/src/lib/modules/pagination/pagination.module.ts +0 -17
  140. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
  141. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
  142. package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
  143. package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
  144. package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
  145. package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1196
  146. package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2014
  147. package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -2525
  148. package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
  149. package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
  150. package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
  151. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
  152. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
  153. package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1124
  154. package/src/lib/modules/smart-form/index.ts +0 -10
  155. package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -733
  156. package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
  157. package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
  158. package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -65
  159. package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
  160. package/src/lib/modules/smart-form/smart-form.module.ts +0 -36
  161. package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
  162. package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
  163. package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
  164. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
  165. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
  166. package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
  167. package/src/lib/modules/smart-table/models/table-config.model.ts +0 -207
  168. package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
  169. package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
  170. package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
  171. package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
  172. package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
  173. package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
  174. package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
  175. package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
  176. package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
  177. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
  178. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
  179. package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
  180. package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
  181. package/src/lib/shared-ui.module.ts +0 -44
  182. package/src/lib/utils/constants.ts +0 -11
  183. package/src/lib/utils/storage.utils.ts +0 -37
  184. package/src/lib/utils/string.utils.ts +0 -23
  185. package/src/lib/utils/translation.utils.ts +0 -87
  186. package/src/public-api.ts +0 -104
  187. package/tsconfig.lib.json +0 -15
@@ -1,597 +0,0 @@
1
- # Form Builder Module
2
-
3
- The `FormBuilderModule` provides a set of components designed to allow developers and business users to create, select, and configure dynamic forms. It works closely with the `SmartFormModule`, using its schema format as both input and output.
4
-
5
- The Form Builder typically follows a two-step process:
6
-
7
- 1. **Field Selection** (`lib-field-selection`): Choosing which fields and sections from a "master" or "template" schema should be active in the final form.
8
- 2. **Field Configuration** (`lib-field-configurator`): Fine-tuning the properties of the selected fields, such as labels, validation rules, and layout (colSpan).
9
-
10
- A third optional step is **Form Preview** — rendering the final configured schema using `<lib-smart-form [readOnly]="true">` so the user can see what the form will look like without being able to edit values.
11
-
12
- ---
13
-
14
- ## Table of Contents
15
-
16
- - [Installation](#installation)
17
- - [1. Field Selection (`lib-field-selection`)](#1-field-selection-lib-field-selection)
18
- - [2. Field Configurator (`lib-field-configurator`)](#2-field-configurator-lib-field-configurator)
19
- - [3. Smart Form Preview (`lib-smart-form` in readOnly mode)](#3-smart-form-preview-lib-smart-form-in-readonly-mode)
20
- - [4. End-to-End Workflow](#4-end-to-end-workflow)
21
- - [5. Advanced Customization](#5-advanced-customization)
22
- - [6. Field Type Support](#6-field-type-support)
23
- - [7. Developer vs. Business-User Mode (recommended patterns)](#7-developer-vs-business-user-mode-recommended-patterns)
24
-
25
- ---
26
-
27
- ## Installation
28
-
29
- Import `FormBuilderModule` and `SmartFormModule` in your Angular module:
30
-
31
- ```typescript
32
- import { FormBuilderModule, SmartFormModule } from 'commons-shared-web-ui';
33
-
34
- @NgModule({
35
- imports: [
36
- FormBuilderModule,
37
- SmartFormModule,
38
- ]
39
- })
40
- export class YourModule {}
41
- ```
42
-
43
- ---
44
-
45
- ## 1. Field Selection (`lib-field-selection`)
46
-
47
- ### Overview
48
-
49
- Renders a hierarchical tree of **groups → sections → fields**. Each item has a toggle that controls whether it appears in the output schema.
50
-
51
- **Key Features:**
52
- - **Cascading Toggles**: Disabling a group or section automatically disables all of its nested children.
53
- - **Locked Fields**: Fields with `readonly: true` in the schema show a padlock icon and cannot be deselected.
54
- - **Option-Type Toggle Hiding**: DROPDOWN, RADIO, and other option-driven fields can be marked as non-toggleable via `[hideToggleForOptionTypes]="true"`.
55
-
56
- ### API Reference
57
-
58
- | Input / Output | Type | Default | Description |
59
- | :--- | :--- | :--- | :--- |
60
- | `[schema]` | `FormSchema` | — | **Required.** The master schema containing all possible fields. |
61
- | `(schemaChange)` | `EventEmitter<FormSchema>` | — | Emitted whenever a toggle changes. Returns the updated schema with `isEnabled` / `visible` flags updated. |
62
- | `[hideToggleForOptionTypes]` | `boolean` | `false` | When `true`, hides the enable/disable checkbox for option-driven field types (DROPDOWN, MULTI_SELECT, RADIO, AUTOCOMPLETE, CHECKBOX, MULTI_CHECKBOX, CHIP). A pre-configured badge indicator is shown instead. |
63
-
64
- ### Basic Usage
65
-
66
- ```html
67
- <lib-field-selection
68
- [schema]="masterSchema"
69
- (schemaChange)="onSelectionChange($event)">
70
- </lib-field-selection>
71
- ```
72
-
73
- ```typescript
74
- onSelectionChange(updated: FormSchema) {
75
- this.activeSchema = updated;
76
- }
77
- ```
78
-
79
- ### Business-User Mode — Hiding Toggle for Option Types
80
-
81
- When a form schema contains dropdown fields (e.g., Gender, Country, Department) whose `optionConfig` is **pre-filled by the developer**, the business user should not be able to toggle those fields on/off — they should always be included.
82
-
83
- Set `[hideToggleForOptionTypes]="true"` to suppress the checkbox for DROPDOWN, RADIO, MULTI_SELECT, AUTOCOMPLETE, CHECKBOX, MULTI_CHECKBOX, and CHIP fields:
84
-
85
- ```html
86
- <!-- Business-user configurator: hide toggle for pre-configured dropdowns -->
87
- <lib-field-selection
88
- [schema]="masterSchema"
89
- [hideToggleForOptionTypes]="true"
90
- (schemaChange)="onSelectionChange($event)">
91
- </lib-field-selection>
92
- ```
93
-
94
- #### What it looks like
95
-
96
- | Field Type | `hideToggleForOptionTypes="false"` (default) | `hideToggleForOptionTypes="true"` |
97
- | :--- | :--- | :--- |
98
- | `TEXT_INPUT` | ✅ Checkbox shown | ✅ Checkbox shown |
99
- | `DROPDOWN` | ✅ Checkbox shown | 🔒 Clock icon shown — no toggle |
100
- | `RADIO` | ✅ Checkbox shown | 🔒 Clock icon shown — no toggle |
101
- | `AUTOCOMPLETE` | ✅ Checkbox shown | 🔒 Clock icon shown — no toggle |
102
-
103
- > **Note**: Fields with `readonly: true` in the schema are always locked (padlock icon), regardless of this setting.
104
-
105
- ### Full Example Component
106
-
107
- ```typescript
108
- import { Component } from '@angular/core';
109
- import { FormSchema } from 'commons-shared-web-ui';
110
-
111
- @Component({
112
- selector: 'app-form-selector',
113
- template: `
114
- <div class="selection-container">
115
- <h3>Configure Form Fields</h3>
116
-
117
- <!-- For business users: hide toggle on pre-filled option types -->
118
- <lib-field-selection
119
- [schema]="masterSchema"
120
- [hideToggleForOptionTypes]="isBusinessUserMode"
121
- (schemaChange)="onSelectionChange($event)">
122
- </lib-field-selection>
123
- </div>
124
- `
125
- })
126
- export class SelectionExampleComponent {
127
- // Developer sets this true for business-user-facing configurators
128
- isBusinessUserMode = true;
129
-
130
- masterSchema: FormSchema = {
131
- entityType: 'REGISTRATION',
132
- label: 'Master Registration Form',
133
- formType: 'SECTION',
134
- sectionConfig: {
135
- children: [
136
- {
137
- type: 'GROUP',
138
- label: 'Personal Info',
139
- name: 'personal',
140
- sectionConfig: {
141
- children: [
142
- { name: 'firstName', type: 'TEXT_INPUT', label: 'First Name' },
143
- { name: 'lastName', type: 'TEXT_INPUT', label: 'Last Name' },
144
- {
145
- // Gender: developer pre-fills optionConfig → business user
146
- // should not toggle this on/off, just keep it always shown
147
- name: 'gender',
148
- type: 'DROPDOWN',
149
- label: 'Gender',
150
- optionConfig: {
151
- optionList: [
152
- { label: 'Male', code: 'M' },
153
- { label: 'Female', code: 'F' },
154
- { label: 'Other', code: 'O' },
155
- ]
156
- }
157
- }
158
- ]
159
- }
160
- }
161
- ]
162
- }
163
- };
164
-
165
- onSelectionChange(updated: FormSchema): void {
166
- console.log('Schema updated:', updated);
167
- this.masterSchema = updated;
168
- }
169
- }
170
- ```
171
-
172
- ---
173
-
174
- ## 2. Field Configurator (`lib-field-configurator`)
175
-
176
- ### Overview
177
-
178
- A split-view tool for editing field details:
179
- - **Left Panel**: Tree view showing all fields from the schema.
180
- - **Right Panel**: A dynamically generated `SmartForm` for the currently selected field's configuration.
181
-
182
- **Key Features:**
183
- - **Field-Type Specific UI**: Selecting a `TEXT_INPUT` shows length and pattern constraints; a `DROPDOWN` shows API URL and static list settings.
184
- - **Type Switching**: Change a field type (e.g., from `shortText` to `email`) while preserving common metadata.
185
- - **Immutability**: Emits a fresh schema copy on every configuration change.
186
- - **`showOptionConfig`**: Hide the `optionConfig` section (API URL, data path, etc.) from business users.
187
-
188
- ### API Reference
189
-
190
- | Input / Output | Type | Default | Description |
191
- | :--- | :--- | :--- | :--- |
192
- | `[schema]` | `FormSchema` | — | **Required.** The schema to be configured. |
193
- | `(schemaChange)` | `EventEmitter<FormSchema>` | — | Emitted whenever any field property is changed and "Apply" is clicked. |
194
- | `[showOptionConfig]` | `boolean` | `true` | When `false`, all `optionConfig.*` settings (API URL, data/label/value paths, etc.) are hidden from the configuration panel. |
195
-
196
- ### Basic Usage
197
-
198
- ```html
199
- <lib-field-configurator
200
- [schema]="selectedSchema"
201
- (schemaChange)="onConfigApplied($event)">
202
- </lib-field-configurator>
203
- ```
204
-
205
- ### Hiding optionConfig for Business Users
206
-
207
- When a DROPDOWN or RADIO field's `optionConfig` (e.g., `apiUrl`, `dataPath`, `labelPath`) is pre-filled by a developer in the master schema, a business user configuring the form should never see — or be able to break — those API URL settings.
208
-
209
- Set `[showOptionConfig]="false"` to strip the entire option configuration panel from the configurator:
210
-
211
- ```html
212
- <!-- Developer mode (default): full optionConfig is visible -->
213
- <lib-field-configurator
214
- [schema]="schema"
215
- [showOptionConfig]="true"
216
- (schemaChange)="onConfigApplied($event)">
217
- </lib-field-configurator>
218
-
219
- <!-- Business-user mode: optionConfig API fields are hidden -->
220
- <lib-field-configurator
221
- [schema]="schema"
222
- [showOptionConfig]="false"
223
- (schemaChange)="onConfigApplied($event)">
224
- </lib-field-configurator>
225
- ```
226
-
227
- #### What `showOptionConfig="false"` removes
228
-
229
- The following fields are hidden from the dropdown/radio/autocomplete/chip/multiSelect configuration panels:
230
-
231
- | Hidden Field | Config Key |
232
- | :--- | :--- |
233
- | Options API URL | `optionConfig.apiUrl` |
234
- | Data Path | `optionConfig.dataPath` |
235
- | Label Path | `optionConfig.labelPath` |
236
- | Value Path | `optionConfig.valuePath` |
237
- | Sort By | `optionConfig.sortBy` |
238
- | Response Path | `optionConfig.responsePath` |
239
- | Options Layout | `optionConfig.layout` |
240
-
241
- > The static **Options List (JSON)** (`optionConfig.optionList`) is **also** part of `optionConfig` and will be hidden when `showOptionConfig="false"`. If you want to allow editing the static list but not the API URL, use the `BUILDER_FIELD_TYPE_SCHEMA_MAP` token to provide a custom schema.
242
-
243
- ### Full Example Component
244
-
245
- ```typescript
246
- import { Component } from '@angular/core';
247
- import { FormSchema } from 'commons-shared-web-ui';
248
-
249
- @Component({
250
- selector: 'app-form-configurator',
251
- template: `
252
- <div class="configurator-layout">
253
- <lib-field-configurator
254
- [schema]="configuredSchema"
255
- [showOptionConfig]="isDeveloperMode"
256
- (schemaChange)="onConfigApplied($event)">
257
- </lib-field-configurator>
258
- </div>
259
- `
260
- })
261
- export class ConfiguratorComponent {
262
- // false = business user, true = developer
263
- isDeveloperMode = false;
264
-
265
- configuredSchema: FormSchema = { /* ... schema from selection step ... */ };
266
-
267
- onConfigApplied(newSchema: FormSchema): void {
268
- this.configuredSchema = newSchema;
269
- // Persist to backend or state management
270
- }
271
- }
272
- ```
273
-
274
- ---
275
-
276
- ## 3. Smart Form Preview (`lib-smart-form` in readOnly mode)
277
-
278
- ### Overview
279
-
280
- Once the business user finishes configuring the form, you can show them a **read-only preview** of exactly how the form will look to end users. The `lib-smart-form` component now accepts a `[readOnly]` input for this purpose.
281
-
282
- ### `readOnly` Input — `lib-smart-form`
283
-
284
- | Input | Type | Default | Description |
285
- | :--- | :--- | :--- | :--- |
286
- | `[readOnly]` | `boolean` | `false` | When `true`, all form controls are disabled (rendered as non-editable) and the action bar (submit/apply buttons) is completely hidden. |
287
-
288
- ### Usage
289
-
290
- ```html
291
- <!-- Normal (editable) mode — end user fills the form -->
292
- <lib-smart-form
293
- [formJson]="formJson">
294
- </lib-smart-form>
295
-
296
- <!-- Read-only preview mode — shows the form structure without allowing input -->
297
- <lib-smart-form
298
- [formJson]="formJson"
299
- [readOnly]="true">
300
- </lib-smart-form>
301
- ```
302
-
303
- ### Preview within a Form Builder wizard
304
-
305
- ```typescript
306
- import { Component } from '@angular/core';
307
- import { FormSchema } from 'commons-shared-web-ui';
308
-
309
- @Component({
310
- selector: 'app-form-wizard',
311
- template: `
312
- <div class="wizard-steps">
313
-
314
- <!-- Step 1: Field Selection -->
315
- <ng-container *ngIf="currentStep === 'select'">
316
- <lib-field-selection
317
- [schema]="masterSchema"
318
- [hideToggleForOptionTypes]="true"
319
- (schemaChange)="activeSchema = $event">
320
- </lib-field-selection>
321
- <button (click)="currentStep = 'configure'">Next →</button>
322
- </ng-container>
323
-
324
- <!-- Step 2: Field Configuration -->
325
- <ng-container *ngIf="currentStep === 'configure'">
326
- <lib-field-configurator
327
- [schema]="activeSchema"
328
- [showOptionConfig]="false"
329
- (schemaChange)="activeSchema = $event">
330
- </lib-field-configurator>
331
- <button (click)="currentStep = 'select'">← Back</button>
332
- <button (click)="currentStep = 'preview'">Preview →</button>
333
- </ng-container>
334
-
335
- <!-- Step 3: Read-Only Preview -->
336
- <ng-container *ngIf="currentStep === 'preview'">
337
- <div class="preview-banner">
338
- 👁 Preview — This is how users will see the form
339
- </div>
340
- <lib-smart-form
341
- [formJson]="previewFormJson"
342
- [readOnly]="true">
343
- </lib-smart-form>
344
- <button (click)="currentStep = 'configure'">← Back</button>
345
- <button (click)="onSave()">Save Form</button>
346
- </ng-container>
347
-
348
- </div>
349
- `
350
- })
351
- export class FormWizardComponent {
352
- currentStep: 'select' | 'configure' | 'preview' = 'select';
353
-
354
- masterSchema: FormSchema = { /* developer-authored master schema */ };
355
- activeSchema: FormSchema = this.masterSchema;
356
-
357
- get previewFormJson(): string {
358
- return JSON.stringify(this.activeSchema);
359
- }
360
-
361
- onSave(): void {
362
- // Persist activeSchema to backend
363
- console.log('Saving schema:', this.activeSchema);
364
- }
365
- }
366
- ```
367
-
368
- ---
369
-
370
- ## 4. End-to-End Workflow
371
-
372
- The recommended three-phase workflow for a **business-user-facing smart form configurator**:
373
-
374
- ```
375
- ┌─────────────────────────────────────────────────────────────────────┐
376
- │ DEVELOPER: Authors master JSON schema with all fields, │
377
- │ including pre-filled optionConfig for dropdowns/radios │
378
- │ e.g. { name: 'gender', type: 'DROPDOWN', │
379
- │ optionConfig: { optionList: [...] } } │
380
- └─────────────────────────────────────────────────────────────────────┘
381
- │
382
- ▼
383
- ┌──────────────────────────────────────────────────────────────────────┐
384
- │ PHASE 1 — Field Selection (lib-field-selection) │
385
- │ │
386
- │ Business user selects which fields appear in the live form. │
387
- │ ✅ Text/number/date fields: show enable/disable toggle │
388
- │ 🔒 Dropdown/Radio fields: toggle hidden (hideToggleForOptionTypes) │
389
- └──────────────────────────────────────────────────────────────────────┘
390
- │ schemaChange ↓
391
- ▼
392
- ┌──────────────────────────────────────────────────────────────────────┐
393
- │ PHASE 2 — Field Configuration (lib-field-configurator) │
394
- │ │
395
- │ Business user sets label, placeholder, required flag, colSpan, etc. │
396
- │ API URL / option paths hidden (showOptionConfig="false") │
397
- │ Cannot accidentally break pre-configured dropdown sources │
398
- └──────────────────────────────────────────────────────────────────────┘
399
- │ schemaChange ↓
400
- ▼
401
- ┌──────────────────────────────────────────────────────────────────────┐
402
- │ PHASE 3 — Read-Only Preview (lib-smart-form [readOnly]="true") │
403
- │ │
404
- │ Business user sees exactly how the form looks to end users. │
405
- │ All controls are disabled. Action bar (Submit button) is hidden. │
406
- └──────────────────────────────────────────────────────────────────────┘
407
- │ onSave()
408
- ▼
409
- Persist to backend
410
- ```
411
-
412
- ### Minimal Three-Phase Example
413
-
414
- ```html
415
- <!-- Phase 1: Select fields -->
416
- <lib-field-selection
417
- [schema]="masterSchema"
418
- [hideToggleForOptionTypes]="true"
419
- (schemaChange)="activeSchema = $event">
420
- </lib-field-selection>
421
-
422
- <!-- Phase 2: Configure field details (no optionConfig editing) -->
423
- <lib-field-configurator
424
- [schema]="activeSchema"
425
- [showOptionConfig]="false"
426
- (schemaChange)="activeSchema = $event">
427
- </lib-field-configurator>
428
-
429
- <!-- Phase 3: Preview in read-only mode -->
430
- <lib-smart-form
431
- [formJson]="activeSchemaJson"
432
- [readOnly]="true">
433
- </lib-smart-form>
434
- ```
435
-
436
- ```typescript
437
- get activeSchemaJson(): string {
438
- return JSON.stringify(this.activeSchema);
439
- }
440
- ```
441
-
442
- ---
443
-
444
- ## 5. Advanced Customization
445
-
446
- ### The `BUILDER_FIELD_TYPE_SCHEMA_MAP` Token
447
-
448
- You can override or extend the default configuration forms for specific field types by providing the `BUILDER_FIELD_TYPE_SCHEMA_MAP` token. This lets you control *exactly* which settings are editable per field type.
449
-
450
- **Use case:** Show only `label` and `required` in the configurator for all text fields — hide everything else.
451
-
452
- ```typescript
453
- import { BUILDER_FIELD_TYPE_SCHEMA_MAP } from 'commons-shared-web-ui';
454
-
455
- const restrictedSchemaMap = {
456
- shortText: {
457
- entityType: 'FIELD_CONFIG',
458
- label: 'Field Configuration',
459
- formType: 'SECTION',
460
- sectionConfig: {
461
- children: [
462
- { name: 'label', type: 'TEXT_INPUT', label: 'Field Label', required: true, colSpan: 12 },
463
- { name: 'required', type: 'SWITCH', label: 'Required', colSpan: 6 },
464
- ]
465
- },
466
- actionBarConfig: {
467
- buttons: [{
468
- id: 'apply', label: 'Apply Changes', variant: 'primary',
469
- alignment: 'right', action: { kind: 'emit' }
470
- }]
471
- }
472
- },
473
- // ... other types
474
- };
475
-
476
- @NgModule({
477
- providers: [
478
- {
479
- provide: BUILDER_FIELD_TYPE_SCHEMA_MAP,
480
- useValue: restrictedSchemaMap
481
- }
482
- ]
483
- })
484
- export class MyFormBuilderModule {}
485
- ```
486
-
487
- > **Tip:** You only need to override the types you want to customize. Other types will continue to use the built-in defaults.
488
-
489
- ### Combining `showOptionConfig` with `BUILDER_FIELD_TYPE_SCHEMA_MAP`
490
-
491
- If you want to **allow editing the static option list but hide the API URL** for dropdowns, provide a custom map entry for `dropdown`:
492
-
493
- ```typescript
494
- const customDropdownSchema = {
495
- dropdown: {
496
- formType: 'SECTION',
497
- sectionConfig: {
498
- children: [
499
- // Basic Settings
500
- { name: 'label', type: 'TEXT_INPUT', label: 'Label', colSpan: 12 },
501
- { name: 'required', type: 'SWITCH', label: 'Required', colSpan: 6 },
502
- // Allow editing static list only — no apiUrl
503
- {
504
- type: 'GROUP', label: 'Dropdown Options',
505
- sectionConfig: {
506
- children: [
507
- {
508
- name: 'optionConfig.optionList',
509
- type: 'TEXT_INPUT', subType: 'LONG',
510
- label: 'Static Options (JSON)',
511
- placeholder: '[{"label": "Yes", "code": "Y"}]',
512
- colSpan: 12
513
- }
514
- ]
515
- }
516
- }
517
- ]
518
- },
519
- actionBarConfig: {
520
- buttons: [{ id: 'apply', label: 'Apply', variant: 'primary',
521
- alignment: 'right', action: { kind: 'emit' } }]
522
- }
523
- }
524
- };
525
-
526
- // Then in providers:
527
- { provide: BUILDER_FIELD_TYPE_SCHEMA_MAP, useValue: customDropdownSchema }
528
- ```
529
-
530
- In this case, use `[showOptionConfig]="true"` (default) since the custom map already contains only what you want to expose.
531
-
532
- ---
533
-
534
- ## 6. Field Type Support
535
-
536
- The Form Builder supports configuring all core SmartForm types:
537
-
538
- | Category | Types |
539
- | :--- | :--- |
540
- | **Text Inputs** | Short Text, Long Text, Email, Phone, Password |
541
- | **Numbers** | Integer, Decimal |
542
- | **Choice Fields** | Dropdown, Multi-Select, Radio, Checkbox, Multi-Checkbox, Chips, Autocomplete |
543
- | **Date / Time** | Date, Time, DateTime |
544
- | **Advanced** | Rich Text, File Upload, Rating (Stars), Location, Formula (Generated) |
545
- | **Structural** | Group, Section |
546
-
547
- ---
548
-
549
- ## 7. Developer vs. Business-User Mode (recommended patterns)
550
-
551
- The form builder supports two distinct usage personas. Use the inputs below consistently across your app:
552
-
553
- ### Developer Mode (authoring the master schema)
554
-
555
- The developer configures everything — including API URLs for dropdowns.
556
-
557
- ```html
558
- <lib-field-selection
559
- [schema]="masterSchema"
560
- [hideToggleForOptionTypes]="false"> <!-- show all toggles -->
561
- </lib-field-selection>
562
-
563
- <lib-field-configurator
564
- [schema]="activeSchema"
565
- [showOptionConfig]="true"> <!-- show optionConfig (API URL etc.) -->
566
- </lib-field-configurator>
567
- ```
568
-
569
- ### Business-User Mode (configuring a form instance)
570
-
571
- The business user only sees field-level settings (label, placeholder, required). Option API configuration is invisible and cannot be accidentally broken.
572
-
573
- ```html
574
- <lib-field-selection
575
- [schema]="masterSchema"
576
- [hideToggleForOptionTypes]="true"> <!-- hide toggle for DROPDOWN, RADIO etc. -->
577
- </lib-field-selection>
578
-
579
- <lib-field-configurator
580
- [schema]="activeSchema"
581
- [showOptionConfig]="false"> <!-- hide optionConfig API fields -->
582
- </lib-field-configurator>
583
-
584
- <!-- Preview the form before saving -->
585
- <lib-smart-form
586
- [formJson]="previewJson"
587
- [readOnly]="true"> <!-- read-only preview — no Submit button -->
588
- </lib-smart-form>
589
- ```
590
-
591
- ### Summary Table
592
-
593
- | Feature | Input | Developer | Business User |
594
- | :--- | :--- | :---: | :---: |
595
- | Show toggle for DROPDOWN in field-selection | `[hideToggleForOptionTypes]` | `false` | `true` |
596
- | Show optionConfig (API URL, paths) in configurator | `[showOptionConfig]` | `true` | `false` |
597
- | Make the SmartForm preview read-only | `[readOnly]` | `false` | `true` |