commons-shared-web-ui 0.0.55 → 0.0.56
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.
- package/fesm2022/commons-shared-web-ui.mjs +15897 -0
- package/fesm2022/commons-shared-web-ui.mjs.map +1 -0
- package/index.d.ts +4916 -0
- package/package.json +34 -53
- package/.claude/settings.local.json +0 -10
- package/documentation/alert.md +0 -123
- package/documentation/button-dropdown.md +0 -126
- package/documentation/button.md +0 -184
- package/documentation/cards-usage-guidelines.md +0 -131
- package/documentation/configurable-form.md +0 -605
- package/documentation/confirmation-modal.md +0 -250
- package/documentation/filter-sidebar.md +0 -178
- package/documentation/filter-table-selector.md +0 -228
- package/documentation/form-builder.md +0 -599
- package/documentation/form-components.md +0 -384
- package/documentation/form-field-configuration.md +0 -250
- package/documentation/nav.md +0 -427
- package/documentation/pagination.md +0 -181
- package/documentation/side-nav-documentation.md +0 -169
- package/documentation/smart-form.md +0 -2765
- package/documentation/smart-table.md +0 -1221
- package/documentation/snackbar.md +0 -118
- package/documentation/style-externalization.md +0 -88
- package/documentation/summary-card.md +0 -279
- package/documentation/table-column-configuration.md +0 -221
- package/documentation/time-picker.md +0 -274
- package/ng-package.json +0 -30
- package/src/lib/modules/alert/alert.models.ts +0 -6
- package/src/lib/modules/alert/alert.module.ts +0 -16
- package/src/lib/modules/alert/components/alert/alert.component.html +0 -27
- package/src/lib/modules/alert/components/alert/alert.component.scss +0 -92
- package/src/lib/modules/alert/components/alert/alert.component.ts +0 -81
- package/src/lib/modules/button/button.models.ts +0 -13
- package/src/lib/modules/button/button.module.ts +0 -16
- package/src/lib/modules/button/components/button/button.component.html +0 -22
- package/src/lib/modules/button/components/button/button.component.scss +0 -88
- package/src/lib/modules/button/components/button/button.component.ts +0 -67
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +0 -26
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +0 -22
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +0 -41
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +0 -135
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +0 -160
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +0 -294
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +0 -503
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +0 -628
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +0 -154
- package/src/lib/modules/configurable-form/configurable-form.model.ts +0 -131
- package/src/lib/modules/configurable-form/configurable-form.module.ts +0 -19
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +0 -77
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +0 -395
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +0 -266
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +0 -71
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +0 -20
- package/src/lib/modules/filter/components/filter/filter.component.html +0 -131
- package/src/lib/modules/filter/components/filter/filter.component.scss +0 -245
- package/src/lib/modules/filter/components/filter/filter.component.ts +0 -216
- package/src/lib/modules/filter/filter.models.ts +0 -88
- package/src/lib/modules/filter/filter.module.ts +0 -24
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +0 -112
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +0 -186
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +0 -163
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +0 -95
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +0 -24
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +0 -73
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +0 -321
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +0 -361
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +0 -91
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +0 -22
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +0 -63
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +0 -496
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +0 -445
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +0 -75
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +0 -210
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +0 -55
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +0 -25
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +0 -82
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +0 -95
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +0 -20
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +0 -37
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +0 -94
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +0 -46
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +0 -102
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +0 -50
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +0 -35
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +0 -67
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +0 -34
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +0 -68
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +0 -113
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +0 -74
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +0 -533
- package/src/lib/modules/form-builder/form-builder.module.ts +0 -36
- package/src/lib/modules/form-builder/index.ts +0 -9
- package/src/lib/modules/form-builder/models/builder.models.ts +0 -7
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +0 -38
- package/src/lib/modules/form-builder/models/field-selection.models.ts +0 -51
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +0 -258
- package/src/lib/modules/form-builder/services/field-selection.service.ts +0 -299
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +0 -670
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +0 -10
- package/src/lib/modules/form-builder/utils/constants.ts +0 -43
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +0 -29
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +0 -111
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +0 -207
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +0 -35
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +0 -42
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +0 -115
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +0 -267
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +0 -45
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +0 -74
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +0 -252
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +0 -377
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +0 -53
- package/src/lib/modules/form-components/components/input/input.component.html +0 -51
- package/src/lib/modules/form-components/components/input/input.component.scss +0 -128
- package/src/lib/modules/form-components/components/input/input.component.ts +0 -250
- package/src/lib/modules/form-components/components/input/input.models.ts +0 -55
- package/src/lib/modules/form-components/components/radio/radio.component.html +0 -22
- package/src/lib/modules/form-components/components/radio/radio.component.scss +0 -107
- package/src/lib/modules/form-components/components/radio/radio.component.ts +0 -181
- package/src/lib/modules/form-components/components/radio/radio.models.ts +0 -39
- package/src/lib/modules/form-components/components/search/search.component.html +0 -15
- package/src/lib/modules/form-components/components/search/search.component.scss +0 -87
- package/src/lib/modules/form-components/components/search/search.component.ts +0 -213
- package/src/lib/modules/form-components/components/search/search.models.ts +0 -40
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +0 -15
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +0 -81
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +0 -166
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +0 -27
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +0 -22
- package/src/lib/modules/form-components/form-components.module.ts +0 -42
- package/src/lib/modules/form-field-configuration/components/_ffc-controls.scss +0 -89
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.html +0 -68
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.scss +0 -73
- package/src/lib/modules/form-field-configuration/components/config-field-node/config-field-node.component.ts +0 -34
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.html +0 -78
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.scss +0 -83
- package/src/lib/modules/form-field-configuration/components/config-section-node/config-section-node.component.ts +0 -94
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.html +0 -38
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.scss +0 -42
- package/src/lib/modules/form-field-configuration/components/form-field-configuration/form-field-configuration.component.ts +0 -92
- package/src/lib/modules/form-field-configuration/form-field-configuration.module.ts +0 -23
- package/src/lib/modules/form-field-configuration/index.ts +0 -7
- package/src/lib/modules/form-field-configuration/models/field-configuration.models.ts +0 -62
- package/src/lib/modules/form-field-configuration/services/config-schema-tree.service.ts +0 -159
- package/src/lib/modules/form-field-configuration/services/field-configuration.service.ts +0 -228
- package/src/lib/modules/material/material.module.ts +0 -94
- package/src/lib/modules/nav/components/nav/nav.component.html +0 -34
- package/src/lib/modules/nav/components/nav/nav.component.scss +0 -171
- package/src/lib/modules/nav/components/nav/nav.component.ts +0 -82
- package/src/lib/modules/nav/nav.models.ts +0 -31
- package/src/lib/modules/nav/nav.module.ts +0 -17
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +0 -52
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +0 -155
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +0 -109
- package/src/lib/modules/pagination/pagination.module.ts +0 -17
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +0 -56
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +0 -342
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +0 -135
- package/src/lib/modules/side-nav/side-nav.models.ts +0 -38
- package/src/lib/modules/side-nav/side-nav.module.ts +0 -16
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +0 -1330
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +0 -2112
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +0 -3006
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +0 -65
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +0 -209
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +0 -131
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +0 -253
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +0 -689
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +0 -1131
- package/src/lib/modules/smart-form/index.ts +0 -10
- package/src/lib/modules/smart-form/models/form-schema.model.ts +0 -793
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +0 -21
- package/src/lib/modules/smart-form/services/expression.service.ts +0 -75
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +0 -67
- package/src/lib/modules/smart-form/smart-form.examples.ts +0 -1324
- package/src/lib/modules/smart-form/smart-form.module.ts +0 -38
- package/src/lib/modules/smart-form/utils/translation.utils.ts +0 -82
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +0 -25
- package/src/lib/modules/smart-form/utils/validation.utils.ts +0 -98
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +0 -283
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +0 -685
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +0 -1128
- package/src/lib/modules/smart-table/models/table-config.model.ts +0 -213
- package/src/lib/modules/smart-table/smart-table.module.ts +0 -30
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +0 -28
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +0 -18
- package/src/lib/modules/snackbar/components/snackbar.component.html +0 -41
- package/src/lib/modules/snackbar/components/snackbar.component.scss +0 -99
- package/src/lib/modules/snackbar/components/snackbar.component.ts +0 -18
- package/src/lib/modules/snackbar/models/snackbar.models.ts +0 -10
- package/src/lib/modules/snackbar/services/snackbar.service.ts +0 -40
- package/src/lib/modules/snackbar/snackbar.module.ts +0 -11
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +0 -47
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +0 -199
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +0 -126
- package/src/lib/modules/summary-card/summary-card.module.ts +0 -18
- package/src/lib/modules/table-column-configuration/components/_tcc-controls.scss +0 -53
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.html +0 -47
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.scss +0 -50
- package/src/lib/modules/table-column-configuration/components/config-column-node/config-column-node.component.ts +0 -33
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.html +0 -30
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.scss +0 -36
- package/src/lib/modules/table-column-configuration/components/table-column-configuration/table-column-configuration.component.ts +0 -78
- package/src/lib/modules/table-column-configuration/index.ts +0 -5
- package/src/lib/modules/table-column-configuration/models/table-column-configuration.models.ts +0 -20
- package/src/lib/modules/table-column-configuration/services/table-column-configuration.service.ts +0 -77
- package/src/lib/modules/table-column-configuration/table-column-configuration.module.ts +0 -21
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.html +0 -37
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.scss +0 -102
- package/src/lib/modules/time-picker/components/time-picker/time-picker.component.ts +0 -178
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.html +0 -78
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.scss +0 -226
- package/src/lib/modules/time-picker/components/time-wheel-panel/time-wheel-panel.component.ts +0 -595
- package/src/lib/modules/time-picker/models/time-picker.models.ts +0 -49
- package/src/lib/modules/time-picker/time-picker.module.ts +0 -23
- package/src/lib/shared-ui.module.ts +0 -55
- package/src/lib/utils/constants.ts +0 -11
- package/src/lib/utils/storage.utils.ts +0 -37
- package/src/lib/utils/string.utils.ts +0 -23
- package/src/lib/utils/translation.utils.ts +0 -87
- package/src/public-api.ts +0 -127
- package/tsconfig.lib.json +0 -15
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
# Form Components
|
|
2
|
-
|
|
3
|
-
The `FormComponentsModule` provides a set of customizable, theme-aware form components. All components support `ControlValueAccessor` for seamless integration with Angular Reactive and Template-driven forms.
|
|
4
|
-
|
|
5
|
-
## Module Import
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { FormComponentsModule } from 'commons-shared-web-ui';
|
|
9
|
-
|
|
10
|
-
@NgModule({
|
|
11
|
-
imports: [FormComponentsModule]
|
|
12
|
-
})
|
|
13
|
-
export class YourModule {}
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Input (`lib-input`)
|
|
19
|
-
|
|
20
|
-
A text input field supporting multiple types (text, number, email, password, tel, url, textarea).
|
|
21
|
-
|
|
22
|
-
### Selector
|
|
23
|
-
`<lib-input>`
|
|
24
|
-
|
|
25
|
-
### Inputs
|
|
26
|
-
|
|
27
|
-
| Input | Type | Default | Description |
|
|
28
|
-
|-------|------|---------|-------------|
|
|
29
|
-
| `config` | `InputConfig` | — | Configuration object for all properties |
|
|
30
|
-
| `labels` | `InputLabels` | — | i18n labels |
|
|
31
|
-
| `type` | `InputType` | `'text'` | Input type: `text`, `number`, `email`, `password`, `tel`, `url`, `textarea` |
|
|
32
|
-
| `label` | `string` | `''` | Field label |
|
|
33
|
-
| `placeholder` | `string` | `''` | Placeholder text |
|
|
34
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
35
|
-
| `required` | `boolean` | `false` | Required state |
|
|
36
|
-
| `readonly` | `boolean` | `false` | Read-only state |
|
|
37
|
-
| `maxLength` | `number` | — | Maximum character length |
|
|
38
|
-
| `minLength` | `number` | — | Minimum character length |
|
|
39
|
-
| `min` | `number` | — | Minimum numeric value |
|
|
40
|
-
| `max` | `number` | — | Maximum numeric value |
|
|
41
|
-
| `pattern` | `string` | — | Validation pattern |
|
|
42
|
-
| `errorMessage` | `string` | — | Error message to display |
|
|
43
|
-
| `helperText` | `string` | — | Helper text below the field |
|
|
44
|
-
| `rows` | `number` | — | Rows for textarea type |
|
|
45
|
-
| `prefixIcon` | `string \| IconObject` | — | Icon before input |
|
|
46
|
-
| `suffixIcon` | `string \| IconObject` | — | Icon after input |
|
|
47
|
-
|
|
48
|
-
### Outputs
|
|
49
|
-
|
|
50
|
-
| Output | Type | Description |
|
|
51
|
-
|--------|------|-------------|
|
|
52
|
-
| `valueChange` | `EventEmitter<any>` | Emitted when value changes |
|
|
53
|
-
| `blur` | `EventEmitter<void>` | Emitted on blur |
|
|
54
|
-
| `focus` | `EventEmitter<void>` | Emitted on focus |
|
|
55
|
-
|
|
56
|
-
### Usage
|
|
57
|
-
|
|
58
|
-
```html
|
|
59
|
-
<lib-input
|
|
60
|
-
[config]="{ type: 'text', label: 'Name', placeholder: 'Enter your name', required: true }"
|
|
61
|
-
[labels]="{ label: 'Full Name', placeholder: 'Enter name' }"
|
|
62
|
-
(valueChange)="onNameChange($event)">
|
|
63
|
-
</lib-input>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## Dropdown (`lib-dropdown`)
|
|
69
|
-
|
|
70
|
-
A select/dropdown component with single or multi-select, search, virtual scrolling, and keyboard navigation.
|
|
71
|
-
|
|
72
|
-
### Selector
|
|
73
|
-
`<lib-dropdown>`
|
|
74
|
-
|
|
75
|
-
### Inputs
|
|
76
|
-
|
|
77
|
-
| Input | Type | Default | Description |
|
|
78
|
-
|-------|------|---------|-------------|
|
|
79
|
-
| `config` | `DropdownConfig` | — | Configuration object |
|
|
80
|
-
| `labels` | `DropdownLabels` | — | i18n labels |
|
|
81
|
-
| `options` | `DropdownOption[]` | `[]` | Array of selectable options |
|
|
82
|
-
| `placeholder` | `string` | `''` | Placeholder text |
|
|
83
|
-
| `label` | `string` | `''` | Field label |
|
|
84
|
-
| `multiple` | `boolean` | `false` | Enable multi-select |
|
|
85
|
-
| `searchable` | `boolean` | `false` | Enable search filtering |
|
|
86
|
-
| `clearable` | `boolean` | `false` | Show clear button |
|
|
87
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
88
|
-
| `required` | `boolean` | `false` | Required state |
|
|
89
|
-
|
|
90
|
-
### `DropdownOption` Interface
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
interface DropdownOption {
|
|
94
|
-
value: any;
|
|
95
|
-
label: string;
|
|
96
|
-
disabled?: boolean;
|
|
97
|
-
icon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Outputs
|
|
102
|
-
|
|
103
|
-
| Output | Type | Description |
|
|
104
|
-
|--------|------|-------------|
|
|
105
|
-
| `selectionChange` | `EventEmitter<any>` | Emitted on selection change |
|
|
106
|
-
|
|
107
|
-
### Usage
|
|
108
|
-
|
|
109
|
-
```html
|
|
110
|
-
<lib-dropdown
|
|
111
|
-
[config]="{ options: items, label: 'Country', searchable: true, clearable: true }"
|
|
112
|
-
[labels]="{ placeholder: 'Select a country', searchPlaceholder: 'Search...' }"
|
|
113
|
-
(selectionChange)="onCountryChange($event)">
|
|
114
|
-
</lib-dropdown>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Checkbox (`lib-checkbox`)
|
|
120
|
-
|
|
121
|
-
A checkbox component supporting single and group modes.
|
|
122
|
-
|
|
123
|
-
### Selector
|
|
124
|
-
`<lib-checkbox>`
|
|
125
|
-
|
|
126
|
-
### Inputs
|
|
127
|
-
|
|
128
|
-
| Input | Type | Default | Description |
|
|
129
|
-
|-------|------|---------|-------------|
|
|
130
|
-
| `config` | `CheckboxConfig` | — | Configuration object |
|
|
131
|
-
| `labels` | `CheckboxLabels` | — | i18n labels |
|
|
132
|
-
| `label` | `string` | `''` | Checkbox label |
|
|
133
|
-
| `checked` | `boolean` | `false` | Checked state |
|
|
134
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
135
|
-
| `required` | `boolean` | `false` | Required state |
|
|
136
|
-
| `indeterminate` | `boolean` | `false` | Indeterminate state |
|
|
137
|
-
| `options` | `CheckboxOption[]` | `[]` | Group options |
|
|
138
|
-
| `labelPosition` | `'before' \| 'after'` | `'after'` | Label position |
|
|
139
|
-
| `color` | `'primary' \| 'accent' \| 'warn'` | `'primary'` | Color theme |
|
|
140
|
-
|
|
141
|
-
### Outputs
|
|
142
|
-
|
|
143
|
-
| Output | Type | Description |
|
|
144
|
-
|--------|------|-------------|
|
|
145
|
-
| `change` | `EventEmitter<boolean>` | Emitted when checked state changes |
|
|
146
|
-
| `groupChange` | `EventEmitter<CheckboxOption[]>` | Emitted when group selection changes |
|
|
147
|
-
|
|
148
|
-
### Usage
|
|
149
|
-
|
|
150
|
-
```html
|
|
151
|
-
<!-- Single checkbox -->
|
|
152
|
-
<lib-checkbox
|
|
153
|
-
[config]="{ label: 'Accept Terms', required: true }"
|
|
154
|
-
(change)="onAccept($event)">
|
|
155
|
-
</lib-checkbox>
|
|
156
|
-
|
|
157
|
-
<!-- Checkbox group -->
|
|
158
|
-
<lib-checkbox
|
|
159
|
-
[config]="{ label: 'Select interests', options: interestOptions }"
|
|
160
|
-
(groupChange)="onInterestsChange($event)">
|
|
161
|
-
</lib-checkbox>
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Radio (`lib-radio`)
|
|
167
|
-
|
|
168
|
-
A radio button group component.
|
|
169
|
-
|
|
170
|
-
### Selector
|
|
171
|
-
`<lib-radio>`
|
|
172
|
-
|
|
173
|
-
### Inputs
|
|
174
|
-
|
|
175
|
-
| Input | Type | Default | Description |
|
|
176
|
-
|-------|------|---------|-------------|
|
|
177
|
-
| `config` | `RadioConfig` | — | Configuration object |
|
|
178
|
-
| `labels` | `RadioLabels` | — | i18n labels |
|
|
179
|
-
| `options` | `RadioOption[]` | `[]` | Radio options |
|
|
180
|
-
| `label` | `string` | `''` | Group label |
|
|
181
|
-
| `value` | `any` | — | Selected value |
|
|
182
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
183
|
-
| `required` | `boolean` | `false` | Required state |
|
|
184
|
-
| `labelPosition` | `'before' \| 'after'` | `'after'` | Label position |
|
|
185
|
-
| `color` | `'primary' \| 'warning' \| 'danger' \| 'success' \| 'accent' \| 'warn' \| string` | `'primary'` | Radio theme color |
|
|
186
|
-
| `layout` | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction |
|
|
187
|
-
|
|
188
|
-
### `RadioOption` Interface
|
|
189
|
-
|
|
190
|
-
```typescript
|
|
191
|
-
interface RadioOption {
|
|
192
|
-
value: any;
|
|
193
|
-
label: string;
|
|
194
|
-
disabled?: boolean;
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Outputs
|
|
199
|
-
|
|
200
|
-
| Output | Type | Description |
|
|
201
|
-
|--------|------|-------------|
|
|
202
|
-
| `selectionChange` | `EventEmitter<any>` | Emitted when selection changes |
|
|
203
|
-
|
|
204
|
-
### Usage
|
|
205
|
-
|
|
206
|
-
```html
|
|
207
|
-
<lib-radio
|
|
208
|
-
[config]="{ label: 'Gender', options: genderOptions, layout: 'horizontal' }"
|
|
209
|
-
[labels]="{ label: 'Select Gender' }"
|
|
210
|
-
(selectionChange)="onGenderChange($event)">
|
|
211
|
-
</lib-radio>
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## Toggle (`lib-toggle`)
|
|
217
|
-
|
|
218
|
-
A slide toggle / switch component.
|
|
219
|
-
|
|
220
|
-
### Selector
|
|
221
|
-
`<lib-toggle>`
|
|
222
|
-
|
|
223
|
-
### Inputs
|
|
224
|
-
|
|
225
|
-
| Input | Type | Default | Description |
|
|
226
|
-
|-------|------|---------|-------------|
|
|
227
|
-
| `config` | `ToggleConfig` | — | Configuration object |
|
|
228
|
-
| `labels` | `ToggleLabels` | — | i18n labels |
|
|
229
|
-
| `label` | `string` | `''` | Toggle label |
|
|
230
|
-
| `checked` | `boolean` | `false` | Toggle state |
|
|
231
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
232
|
-
| `required` | `boolean` | `false` | Required state |
|
|
233
|
-
| `labelPosition` | `'before' \| 'after'` | `'after'` | Label position |
|
|
234
|
-
| `color` | `'primary' \| 'warning' \| 'danger' \| 'success' \| string` | `'primary'` | Track checked color |
|
|
235
|
-
| `uncheckedColor` | `string` | — | Unchecked track color |
|
|
236
|
-
| `checkedColor` | `string` | — | Checked track color |
|
|
237
|
-
| `thumbColor` | `string` | — | Thumb color |
|
|
238
|
-
| `toggleWidth` | `string` | — | Toggle width |
|
|
239
|
-
| `toggleHeight` | `string` | — | Toggle height |
|
|
240
|
-
|
|
241
|
-
### Outputs
|
|
242
|
-
|
|
243
|
-
| Output | Type | Description |
|
|
244
|
-
|--------|------|-------------|
|
|
245
|
-
| `change` | `EventEmitter<boolean>` | Emitted when toggled |
|
|
246
|
-
|
|
247
|
-
### Usage
|
|
248
|
-
|
|
249
|
-
```html
|
|
250
|
-
<lib-toggle
|
|
251
|
-
[config]="{ label: 'Dark Mode', checked: isDarkMode }"
|
|
252
|
-
(change)="onToggleDarkMode($event)">
|
|
253
|
-
</lib-toggle>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## Datepicker (`lib-datepicker`)
|
|
259
|
-
|
|
260
|
-
A date picker component supporting single date and date range selection.
|
|
261
|
-
|
|
262
|
-
### Selector
|
|
263
|
-
`<lib-datepicker>`
|
|
264
|
-
|
|
265
|
-
### Inputs
|
|
266
|
-
|
|
267
|
-
| Input | Type | Default | Description |
|
|
268
|
-
|-------|------|---------|-------------|
|
|
269
|
-
| `config` | `DatePickerConfig` | — | Configuration object |
|
|
270
|
-
| `labels` | `DatepickerLabels` | — | i18n labels |
|
|
271
|
-
| `label` | `string` | `''` | Field label |
|
|
272
|
-
| `placeholder` | `string` | `''` | Placeholder text |
|
|
273
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
274
|
-
| `required` | `boolean` | `false` | Required state |
|
|
275
|
-
| `minDate` | `Date` | — | Minimum selectable date |
|
|
276
|
-
| `maxDate` | `Date` | — | Maximum selectable date |
|
|
277
|
-
| `isRange` | `boolean` | `false` | Enable date range mode |
|
|
278
|
-
|
|
279
|
-
### Outputs
|
|
280
|
-
|
|
281
|
-
| Output | Type | Description |
|
|
282
|
-
|--------|------|-------------|
|
|
283
|
-
| `dateChange` | `EventEmitter<Date>` | Emitted on single date change |
|
|
284
|
-
| `rangeChange` | `EventEmitter<{start: Date, end: Date}>` | Emitted on range change |
|
|
285
|
-
|
|
286
|
-
### Usage
|
|
287
|
-
|
|
288
|
-
```html
|
|
289
|
-
<!-- Single date -->
|
|
290
|
-
<lib-datepicker
|
|
291
|
-
[config]="{ label: 'Start Date', placeholder: 'Pick a date', required: true }"
|
|
292
|
-
(dateChange)="onDateChange($event)">
|
|
293
|
-
</lib-datepicker>
|
|
294
|
-
|
|
295
|
-
<!-- Date range -->
|
|
296
|
-
<lib-datepicker
|
|
297
|
-
[config]="{ label: 'Date Range', isRange: true }"
|
|
298
|
-
[labels]="{ startDateLabel: 'From', endDateLabel: 'To' }"
|
|
299
|
-
(rangeChange)="onRangeChange($event)">
|
|
300
|
-
</lib-datepicker>
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Search (`lib-search`)
|
|
306
|
-
|
|
307
|
-
A search input with built-in debounce and clear button support.
|
|
308
|
-
|
|
309
|
-
### Selector
|
|
310
|
-
`<lib-search>`
|
|
311
|
-
|
|
312
|
-
### Inputs
|
|
313
|
-
|
|
314
|
-
| Input | Type | Default | Description |
|
|
315
|
-
|-------|------|---------|-------------|
|
|
316
|
-
| `config` | `FilterSearchConfig` | — | Configuration object |
|
|
317
|
-
| `labels` | `SearchLabels` | — | i18n labels |
|
|
318
|
-
| `placeholder` | `string` | `''` | Placeholder text |
|
|
319
|
-
| `label` | `string` | `''` | Field label |
|
|
320
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
321
|
-
| `debounceMs` | `number` | `300` | Debounce time in milliseconds |
|
|
322
|
-
| `clearable` | `boolean` | `true` | Show clear button |
|
|
323
|
-
|
|
324
|
-
### Outputs
|
|
325
|
-
|
|
326
|
-
| Output | Type | Description |
|
|
327
|
-
|--------|------|-------------|
|
|
328
|
-
| `search` | `EventEmitter<string>` | Emitted on search (debounced) |
|
|
329
|
-
| `clear` | `EventEmitter<void>` | Emitted when search is cleared |
|
|
330
|
-
|
|
331
|
-
### Usage
|
|
332
|
-
|
|
333
|
-
```html
|
|
334
|
-
<lib-search
|
|
335
|
-
[config]="{ placeholder: 'Search users...', debounceTime: 500, clearable: true }"
|
|
336
|
-
(search)="onSearch($event)"
|
|
337
|
-
(clear)="onClear()">
|
|
338
|
-
</lib-search>
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
## Theming
|
|
344
|
-
|
|
345
|
-
All form components support theming via CSS variables and SCSS mixins.
|
|
346
|
-
|
|
347
|
-
### SCSS Mixin Setup
|
|
348
|
-
|
|
349
|
-
Include the theme mixin in your application's global `styles.scss`:
|
|
350
|
-
|
|
351
|
-
```scss
|
|
352
|
-
@use 'commons-shared-web-ui/src/lib/modules/form-components/form-components.theme' as forms;
|
|
353
|
-
|
|
354
|
-
html, body {
|
|
355
|
-
@include forms.form-components-theme();
|
|
356
|
-
}
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Customizing Theme
|
|
360
|
-
|
|
361
|
-
Pass a configuration map to override defaults:
|
|
362
|
-
|
|
363
|
-
```scss
|
|
364
|
-
@include forms.form-components-theme((
|
|
365
|
-
primary-color: #ff0000,
|
|
366
|
-
input-border-radius: 8px
|
|
367
|
-
));
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### Key CSS Variables
|
|
371
|
-
|
|
372
|
-
| Variable | Default | Description |
|
|
373
|
-
|----------|---------|-------------|
|
|
374
|
-
| `--cc-input-bg` | `#FEFEFE` | Input background color |
|
|
375
|
-
| `--cc-input-border-radius` | `0.4375rem` | Input border radius |
|
|
376
|
-
| `--cc-input-border-color` | `#BDC1C6` | Input border color |
|
|
377
|
-
| `--cc-input-focus-border-color` | `#1A73E8` | Focus border color |
|
|
378
|
-
| `--cc-dropdown-bg` | `#FEFEFE` | Dropdown background color |
|
|
379
|
-
| `--cc-dropdown-height` | `2.5rem` | Dropdown trigger height |
|
|
380
|
-
| `--cc-checkbox-checked-color` | `#1A73E8` | Checkbox checked color |
|
|
381
|
-
|
|
382
|
-
### Inline Style Overrides
|
|
383
|
-
|
|
384
|
-
All components accept style customization properties (`width`, `height`, `borderRadius`, `fontSize`, `backgroundColor`, `borderColor`, etc.) via their respective `config` objects. These are applied as inline styles with `!important` for precedence.
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
# Form Field Configuration Module
|
|
2
|
-
|
|
3
|
-
The `FormFieldConfigurationModule` provides a single component, `lib-form-field-configuration`, that lets an **end user** decide — per field and per section — what is **Visible** and what is **Mandatory** in a Smart Form, without touching the underlying schema by hand.
|
|
4
|
-
|
|
5
|
-
It takes a `FormSchema` (the same schema format used by `SmartFormModule`) as input and produces a **modified copy** of that schema on demand. It is designed to be dropped inside a `cc-confirmation-modal` (a "Configure fields" dialog) on any page that creates/edits an entity such as a Beneficiary or Donor.
|
|
6
|
-
|
|
7
|
-
> The component only edits two things: **visibility** (`isEnabled` / `visible`) and **mandatory** (`required`). It never changes labels, validation, options, or layout — that is the job of the richer [`lib-field-configurator`](./form-builder.md).
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Table of Contents
|
|
12
|
-
|
|
13
|
-
- [Installation](#installation)
|
|
14
|
-
- [Quick Start](#quick-start)
|
|
15
|
-
- [How it works](#how-it-works)
|
|
16
|
-
- [API Reference](#api-reference)
|
|
17
|
-
- [Locking fields (non-editable visibility / mandatory)](#locking-fields-non-editable-visibility--mandatory)
|
|
18
|
-
- [Input → Output schema](#input--output-schema)
|
|
19
|
-
- [Behaviour rules](#behaviour-rules)
|
|
20
|
-
- [Translating labels](#translating-labels)
|
|
21
|
-
- [Styling / theming](#styling--theming)
|
|
22
|
-
- [FAQ](#faq)
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
Import `FormFieldConfigurationModule` (and, typically, `ConfirmationModalModule`) into your Angular module:
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import {
|
|
32
|
-
FormFieldConfigurationModule,
|
|
33
|
-
ConfirmationModalModule,
|
|
34
|
-
} from 'commons-shared-web-ui';
|
|
35
|
-
|
|
36
|
-
@NgModule({
|
|
37
|
-
imports: [
|
|
38
|
-
FormFieldConfigurationModule,
|
|
39
|
-
ConfirmationModalModule,
|
|
40
|
-
],
|
|
41
|
-
})
|
|
42
|
-
export class BeneficiaryModule {}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Quick Start
|
|
48
|
-
|
|
49
|
-
Put the component inside your "Configure fields" modal and read the result back on confirm using a template reference and `getUpdatedSchema()`.
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<button (click)="openConfigure = true">Configure fields</button>
|
|
53
|
-
|
|
54
|
-
<cc-confirmation-modal
|
|
55
|
-
[isOpen]="openConfigure"
|
|
56
|
-
[config]="{
|
|
57
|
-
title: 'Configure form fields',
|
|
58
|
-
subtitle: 'KYC Onboarding Form',
|
|
59
|
-
confirmButton: { label: 'Save changes', type: 'primary' },
|
|
60
|
-
size: 'md'
|
|
61
|
-
}"
|
|
62
|
-
(confirm)="onSaveFieldConfig()"
|
|
63
|
-
(cancel)="openConfigure = false"
|
|
64
|
-
(close)="openConfigure = false"
|
|
65
|
-
>
|
|
66
|
-
<lib-form-field-configuration
|
|
67
|
-
#fieldConfig
|
|
68
|
-
[schema]="formSchema"
|
|
69
|
-
[translate]="translateFn"
|
|
70
|
-
/>
|
|
71
|
-
</cc-confirmation-modal>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { ViewChild } from '@angular/core';
|
|
76
|
-
import { FormFieldConfigurationComponent, FormSchema } from 'commons-shared-web-ui';
|
|
77
|
-
|
|
78
|
-
export class BeneficiaryPage {
|
|
79
|
-
openConfigure = false;
|
|
80
|
-
formSchema: FormSchema = /* your master schema */;
|
|
81
|
-
|
|
82
|
-
@ViewChild('fieldConfig') fieldConfig!: FormFieldConfigurationComponent;
|
|
83
|
-
|
|
84
|
-
// Optional: wire your i18n instant() so labels aren't raw keys
|
|
85
|
-
translateFn = (key: string) => this.translate.instant(key);
|
|
86
|
-
|
|
87
|
-
onSaveFieldConfig(): void {
|
|
88
|
-
const updated = this.fieldConfig.getUpdatedSchema();
|
|
89
|
-
if (updated) {
|
|
90
|
-
this.formSchema = updated; // hand back the modified schema
|
|
91
|
-
// persist it / feed it to <lib-smart-form>, etc.
|
|
92
|
-
}
|
|
93
|
-
this.openConfigure = false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
The dialog chrome (title, "Cancel" / "Save changes" buttons, scrolling body) is provided by `cc-confirmation-modal`. `lib-form-field-configuration` renders only the legend and the configurable field tree.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## How it works
|
|
103
|
-
|
|
104
|
-
1. You pass a `FormSchema` via `[schema]`.
|
|
105
|
-
2. The component **deep-clones** the schema internally, so your object is **never mutated**.
|
|
106
|
-
3. It walks the schema and renders a collapsible tree:
|
|
107
|
-
- Every `GROUP` / `SUBFIELDS` / section becomes a **section row** (with a visibility toggle and an `x/y visible` count).
|
|
108
|
-
- Every leaf field (including those wrapped in a `ROW`) becomes a **field row** with a `Mandatory` checkbox and a visibility toggle.
|
|
109
|
-
4. The user toggles visibility / mandatory.
|
|
110
|
-
5. When you call `getUpdatedSchema()`, the current selections are written back onto the clone and a fresh copy is returned.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## API Reference
|
|
115
|
-
|
|
116
|
-
| Input / Output / Method | Type | Default | Description |
|
|
117
|
-
| :--- | :--- | :--- | :--- |
|
|
118
|
-
| `[schema]` | `FormSchema` | — | **Required.** The schema to configure. Deep-cloned internally; never mutated. |
|
|
119
|
-
| `[translate]` | `(key: string) => string` | `undefined` | Optional label translator (e.g. ngx-translate `instant`). Applied to section and field labels at render time. |
|
|
120
|
-
| `[showLegend]` | `boolean` | `true` | Show the "👁 Visible / ✻ Mandatory (only if visible)" legend row. |
|
|
121
|
-
| `getUpdatedSchema()` | `() => FormSchema \| null` | — | **Method.** Returns a fresh, modified copy of the schema with the current visibility/mandatory choices applied. Returns `null` if no schema has been loaded. Call it from your modal's confirm handler. |
|
|
122
|
-
|
|
123
|
-
The component is `OnPush` and self-contained — it does **not** emit a live change event. Read the result on demand via `getUpdatedSchema()`.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Locking fields (non-editable visibility / mandatory)
|
|
128
|
-
|
|
129
|
-
Some fields must always be present — for example, you can't hide **Full Name** on a Beneficiary form. Mark them in the schema with two flags added to `FieldConfig`:
|
|
130
|
-
|
|
131
|
-
| Flag | Effect in the configurator |
|
|
132
|
-
| :--- | :--- |
|
|
133
|
-
| `lockVisibility: true` | The visibility toggle is replaced by a 🔒 lock icon. The field/section is always visible and cannot be turned off (including via a parent section's cascade). |
|
|
134
|
-
| `lockMandatory: true` | The `Mandatory` checkbox is disabled. Whatever `required` value the schema shipped with is preserved. |
|
|
135
|
-
|
|
136
|
-
```jsonc
|
|
137
|
-
{
|
|
138
|
-
"name": "fullName",
|
|
139
|
-
"label": "BENEFICIARY_MANAGEMENT.BENEFICIARY_MASTER.FIELD.FULL_NAME",
|
|
140
|
-
"type": "TEXT_INPUT",
|
|
141
|
-
"required": true,
|
|
142
|
-
"lockVisibility": true, // can never be hidden
|
|
143
|
-
"lockMandatory": true // required can never be unset
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Both flags work on **sections** too (put them on the `GROUP`/`SUBFIELDS` field). `lockVisibility` on a section keeps the whole section visible.
|
|
148
|
-
|
|
149
|
-
> `lockVisibility` / `lockMandatory` are **configurator-only** flags. They are independent of `readonly`, which controls the input's editable state in the actual rendered Smart Form.
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Input → Output schema
|
|
154
|
-
|
|
155
|
-
The component maps its two controls onto standard Smart Form flags, so the output plugs straight back into `<lib-smart-form>`:
|
|
156
|
-
|
|
157
|
-
| UI control | Written to `FieldConfig` |
|
|
158
|
-
| :--- | :--- |
|
|
159
|
-
| Visibility toggle (field) | `isEnabled`, `visible` (both `true`/`false`) |
|
|
160
|
-
| Visibility toggle (section) | `isEnabled`, `visible`, and `disabled` on the section's field |
|
|
161
|
-
| Mandatory checkbox | `required` |
|
|
162
|
-
|
|
163
|
-
Smart Form renders a field only when `isEnabled !== false`, so a hidden field (`isEnabled: false`) disappears for end users.
|
|
164
|
-
|
|
165
|
-
**Example — before:**
|
|
166
|
-
|
|
167
|
-
```jsonc
|
|
168
|
-
{ "name": "middleName", "label": "...MIDDLE_NAME", "type": "TEXT_INPUT" }
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**After the user hides it:**
|
|
172
|
-
|
|
173
|
-
```jsonc
|
|
174
|
-
{ "name": "middleName", "label": "...MIDDLE_NAME", "type": "TEXT_INPUT",
|
|
175
|
-
"isEnabled": false, "visible": false, "required": false }
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## Behaviour rules
|
|
181
|
-
|
|
182
|
-
- **Mandatory only if visible.** When a field is hidden, its `Mandatory` checkbox is disabled and the output `required` is forced to `false`. Re-showing the field leaves it non-mandatory until the user re-checks it.
|
|
183
|
-
- **Section cascade.** Turning a section's visibility off hides every field and sub-section inside it. Turning it back on re-shows every **non-locked** descendant.
|
|
184
|
-
- **Dependent-field cascade.** A field that declares a dependency on another field via `optionConfig.dependencies.parentDataCode` can only be visible while its parent is visible. Hiding the parent **hides the dependent field too, transitively**, and disables the dependent's toggle until the parent is shown again. (Example: `city → state → country`; hiding **Country** hides both **State** and **City**; hiding **State** hides **City**.) Dependents are not force-shown when the parent reappears — the user turns them back on — so the invariant "a dependent is never visible without its parent" always holds. A `lockVisibility` field is never force-hidden this way.
|
|
185
|
-
- **Locks always win.** A locked field/section is never affected by its own toggle or a parent's cascade.
|
|
186
|
-
- **Non-destructive.** The `[schema]` you pass in is deep-cloned; it is never mutated. `getUpdatedSchema()` returns an independent copy and is idempotent (safe to call multiple times).
|
|
187
|
-
- **Structure preserved.** `ROW` wrappers, nested `GROUP`s, `allowMulti` repeaters, `optionConfig`, validation, etc. all pass through untouched — only visibility/mandatory flags change.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Translating labels
|
|
192
|
-
|
|
193
|
-
Schemas usually store i18n **keys** (e.g. `BENEFICIARY_MANAGEMENT.BENEFICIARY_MASTER.FIELD.FULL_NAME`). Pass a `translate` function to render human-readable labels in the tree:
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
translateFn = (key: string) => this.translate.instant(key);
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
```html
|
|
200
|
-
<lib-form-field-configuration [schema]="schema" [translate]="translateFn" />
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
If `translate` is omitted, the raw label (or `name`) is shown. Translation is display-only — the output schema keeps the original keys.
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
## Styling / theming
|
|
208
|
-
|
|
209
|
-
The toggle and checkbox are **self-contained** (drawn in the module's own CSS, not the generic `lib-toggle` / `lib-checkbox`) so they stay compact and aligned in the dense row. Everything ships neutral defaults and is themeable via CSS custom properties — the screenshot's exact colours are **reference only**. Override any of these on a parent element:
|
|
210
|
-
|
|
211
|
-
| Variable | Purpose | Default |
|
|
212
|
-
| :--- | :--- | :--- |
|
|
213
|
-
| `--ffc-toggle-on-bg` | Visibility toggle when ON | `#2f9e6f` (green) |
|
|
214
|
-
| `--ffc-toggle-off-bg` | Visibility toggle when OFF | `#cbd2d9` |
|
|
215
|
-
| `--ffc-toggle-width` / `--ffc-toggle-height` | Toggle pill size | `38px` / `22px` |
|
|
216
|
-
| `--ffc-check-on-bg` | Mandatory checkbox when checked | `#d97757` |
|
|
217
|
-
| `--ffc-check-border` | Mandatory checkbox border (unchecked) | `#c3c9d0` |
|
|
218
|
-
| `--ffc-section-header-bg` | Section header background | `#f6f7f8` |
|
|
219
|
-
| `--ffc-section-label-color` | Section title colour | `#1f2933` |
|
|
220
|
-
| `--ffc-count-color` | `x/y visible` counter colour | `#7b8794` |
|
|
221
|
-
| `--ffc-field-bg` / `--ffc-field-hover-bg` | Field row background / hover | `#ffffff` / `#f8fafc` |
|
|
222
|
-
| `--ffc-field-label-color` | Field label colour | `#1f2933` |
|
|
223
|
-
| `--ffc-eye-color` / `--ffc-eye-off-color` | Visible / hidden eye icon | `#6b7280` / `#b0b6be` |
|
|
224
|
-
| `--ffc-lock-color` | Lock icon colour | `#9aa2ab` |
|
|
225
|
-
| `--ffc-asterisk-color` | Legend mandatory asterisk | `#d97757` |
|
|
226
|
-
|
|
227
|
-
Example — recolour the toggle to your brand:
|
|
228
|
-
|
|
229
|
-
```css
|
|
230
|
-
lib-form-field-configuration {
|
|
231
|
-
--ffc-toggle-on-bg: #1a73e8;
|
|
232
|
-
--ffc-check-on-bg: #1a73e8;
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## FAQ
|
|
239
|
-
|
|
240
|
-
**Does it emit changes live?**
|
|
241
|
-
No. It exposes `getUpdatedSchema()` so you decide when to read the result (typically the modal's `confirm`). This keeps change detection cheap and avoids re-emitting the full schema on every click.
|
|
242
|
-
|
|
243
|
-
**Can I use it with a STEPPER form?**
|
|
244
|
-
Yes. Stepper `GROUP`s are rendered as top-level sections just like `SECTION` forms.
|
|
245
|
-
|
|
246
|
-
**What happens to fields I never touch?**
|
|
247
|
-
They keep whatever `isEnabled` / `visible` / `required` they had in the input schema (fields default to visible when those flags are absent).
|
|
248
|
-
|
|
249
|
-
**How do I mark a field as un-hideable?**
|
|
250
|
-
Add `lockVisibility: true` to it in the schema. Add `lockMandatory: true` to freeze its required state.
|