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.
- package/commons-shared-web-ui-1.0.0.tgz +0 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +597 -0
- package/documentation/form-components.md +384 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2177 -0
- package/documentation/smart-table.md +1198 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -0
- package/package.json +54 -0
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/alert.theme.scss +85 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/button.theme.scss +121 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +88 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter/filter.theme.scss +92 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +41 -0
- package/src/lib/modules/form-components/form-components.theme.scss +25 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/nav/nav.theme.scss +86 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/pagination/pagination.theme.scss +66 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
- package/src/lib/shared-ui.module.ts +44 -0
- package/src/lib/styles/global.scss +152 -0
- package/src/lib/styles/utilities.scss +250 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +104 -0
- package/tsconfig.lib.json +15 -0
|
@@ -0,0 +1,597 @@
|
|
|
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` |
|