@raintonic/formaui 0.2.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/CHANGELOG.md +7 -0
- package/README.md +145 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs +806 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs +86 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs +1757 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs +287 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs +217 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs +161 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs +726 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs +92 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs +107 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs +68 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs +55 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button.mjs +241 -0
- package/fesm2022/raintonic-formaui-components-button.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-card.mjs +270 -0
- package/fesm2022/raintonic-formaui-components-card.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs +295 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs +631 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs +1331 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs +41 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs +190 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs +266 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs +33 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs +246 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs +482 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs +117 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-input.mjs +327 -0
- package/fesm2022/raintonic-formaui-components-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-list.mjs +149 -0
- package/fesm2022/raintonic-formaui-components-list.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs +896 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs +345 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs +139 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs +306 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs +451 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs +148 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs +260 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-select.mjs +1011 -0
- package/fesm2022/raintonic-formaui-components-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs +150 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs +257 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs +50 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs +347 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs +63 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs +317 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs +197 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs +78 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs +644 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs +171 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs +140 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs +555 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs +314 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs +430 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-core.mjs +62 -0
- package/fesm2022/raintonic-formaui-core.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs +798 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs +391 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs +248 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs +66 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs.map +1 -0
- package/fesm2022/raintonic-formaui.mjs +15 -0
- package/fesm2022/raintonic-formaui.mjs.map +1 -0
- package/llms-full.txt +1627 -0
- package/llms.txt +60 -0
- package/package.json +251 -0
- package/styles/_fonts-entry.scss +3 -0
- package/styles/fonts/dm-mono-400-latin.woff2 +0 -0
- package/styles/fonts/inter-tight-latin-italic.woff2 +0 -0
- package/styles/fonts/inter-tight-latin.woff2 +0 -0
- package/styles/index.scss +127 -0
- package/styles/partials/_constants.scss +29 -0
- package/styles/partials/_fonts.scss +36 -0
- package/styles/partials/_grid.scss +171 -0
- package/styles/partials/_mixins.scss +145 -0
- package/styles/partials/_motion.scss +252 -0
- package/styles/partials/_theme.scss +275 -0
- package/styles/partials/_typography.scss +112 -0
- package/styles/partials/_utilities.scss +480 -0
- package/styles/partials/themes/_dark.scss +254 -0
- package/styles/partials/themes/_light.scss +254 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts +196 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts +62 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts +843 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts +112 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts.map +1 -0
- package/types/raintonic-formaui-components-accordion.d.ts +124 -0
- package/types/raintonic-formaui-components-accordion.d.ts.map +1 -0
- package/types/raintonic-formaui-components-alert.d.ts +143 -0
- package/types/raintonic-formaui-components-alert.d.ts.map +1 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts +193 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts.map +1 -0
- package/types/raintonic-formaui-components-avatar.d.ts +52 -0
- package/types/raintonic-formaui-components-avatar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-badge.d.ts +47 -0
- package/types/raintonic-formaui-components-badge.d.ts.map +1 -0
- package/types/raintonic-formaui-components-big-menu.d.ts +62 -0
- package/types/raintonic-formaui-components-big-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts +26 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button-group.d.ts +61 -0
- package/types/raintonic-formaui-components-button-group.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button.d.ts +116 -0
- package/types/raintonic-formaui-components-button.d.ts.map +1 -0
- package/types/raintonic-formaui-components-card.d.ts +191 -0
- package/types/raintonic-formaui-components-card.d.ts.map +1 -0
- package/types/raintonic-formaui-components-checkbox.d.ts +132 -0
- package/types/raintonic-formaui-components-checkbox.d.ts.map +1 -0
- package/types/raintonic-formaui-components-data-table.d.ts +368 -0
- package/types/raintonic-formaui-components-data-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-date-picker.d.ts +341 -0
- package/types/raintonic-formaui-components-date-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-divider.d.ts +21 -0
- package/types/raintonic-formaui-components-divider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-drawer.d.ts +48 -0
- package/types/raintonic-formaui-components-drawer.d.ts.map +1 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts +412 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts.map +1 -0
- package/types/raintonic-formaui-components-empty-state.d.ts +14 -0
- package/types/raintonic-formaui-components-empty-state.d.ts.map +1 -0
- package/types/raintonic-formaui-components-file-upload.d.ts +77 -0
- package/types/raintonic-formaui-components-file-upload.d.ts.map +1 -0
- package/types/raintonic-formaui-components-form-field.d.ts +271 -0
- package/types/raintonic-formaui-components-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-components-icon.d.ts +61 -0
- package/types/raintonic-formaui-components-icon.d.ts.map +1 -0
- package/types/raintonic-formaui-components-input.d.ts +149 -0
- package/types/raintonic-formaui-components-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-list.d.ts +48 -0
- package/types/raintonic-formaui-components-list.d.ts.map +1 -0
- package/types/raintonic-formaui-components-menu.d.ts +403 -0
- package/types/raintonic-formaui-components-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-number-input.d.ts +127 -0
- package/types/raintonic-formaui-components-number-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-paginator.d.ts +37 -0
- package/types/raintonic-formaui-components-paginator.d.ts.map +1 -0
- package/types/raintonic-formaui-components-password-input.d.ts +111 -0
- package/types/raintonic-formaui-components-password-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-popover.d.ts +131 -0
- package/types/raintonic-formaui-components-popover.d.ts.map +1 -0
- package/types/raintonic-formaui-components-progressbar.d.ts +111 -0
- package/types/raintonic-formaui-components-progressbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-radio.d.ts +95 -0
- package/types/raintonic-formaui-components-radio.d.ts.map +1 -0
- package/types/raintonic-formaui-components-select.d.ts +307 -0
- package/types/raintonic-formaui-components-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-side-panel.d.ts +51 -0
- package/types/raintonic-formaui-components-side-panel.d.ts.map +1 -0
- package/types/raintonic-formaui-components-sidebar.d.ts +174 -0
- package/types/raintonic-formaui-components-sidebar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-skeleton.d.ts +20 -0
- package/types/raintonic-formaui-components-skeleton.d.ts.map +1 -0
- package/types/raintonic-formaui-components-slider.d.ts +108 -0
- package/types/raintonic-formaui-components-slider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-spinner.d.ts +42 -0
- package/types/raintonic-formaui-components-spinner.d.ts.map +1 -0
- package/types/raintonic-formaui-components-stepper.d.ts +126 -0
- package/types/raintonic-formaui-components-stepper.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tab.d.ts +96 -0
- package/types/raintonic-formaui-components-tab.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tag.d.ts +34 -0
- package/types/raintonic-formaui-components-tag.d.ts.map +1 -0
- package/types/raintonic-formaui-components-time-picker.d.ts +172 -0
- package/types/raintonic-formaui-components-time-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toggle.d.ts +70 -0
- package/types/raintonic-formaui-components-toggle.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toolbar.d.ts +128 -0
- package/types/raintonic-formaui-components-toolbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tooltip.d.ts +268 -0
- package/types/raintonic-formaui-components-tooltip.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-select.d.ts +80 -0
- package/types/raintonic-formaui-components-tree-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-table.d.ts +90 -0
- package/types/raintonic-formaui-components-tree-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree.d.ts +104 -0
- package/types/raintonic-formaui-components-tree.d.ts.map +1 -0
- package/types/raintonic-formaui-core.d.ts +115 -0
- package/types/raintonic-formaui-core.d.ts.map +1 -0
- package/types/raintonic-formaui-services-dialog.d.ts +451 -0
- package/types/raintonic-formaui-services-dialog.d.ts.map +1 -0
- package/types/raintonic-formaui-services-notification.d.ts +221 -0
- package/types/raintonic-formaui-services-notification.d.ts.map +1 -0
- package/types/raintonic-formaui-services-theme.d.ts +126 -0
- package/types/raintonic-formaui-services-theme.d.ts.map +1 -0
- package/types/raintonic-formaui-test-utils.d.ts +24 -0
- package/types/raintonic-formaui-test-utils.d.ts.map +1 -0
- package/types/raintonic-formaui.d.ts +4 -0
- package/types/raintonic-formaui.d.ts.map +1 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import { FuiFormFieldComponent, FuiLabelComponent, FuiErrorComponent, FuiHintComponent, FuiPrefixDirective, FuiSuffixDirective } from '@raintonic/formaui/components/form-field';
|
|
8
|
+
import { FuiInputDirective } from '@raintonic/formaui/components/input';
|
|
9
|
+
import { FuiSelectComponent, FuiOptionComponent } from '@raintonic/formaui/components/select';
|
|
10
|
+
import { FuiAutocompleteComponent } from '@raintonic/formaui/components/autocomplete';
|
|
11
|
+
import { FuiCheckboxComponent } from '@raintonic/formaui/components/checkbox';
|
|
12
|
+
import { FuiIconComponent } from '@raintonic/formaui/components/icon';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* # DynamicFormRenderer Component
|
|
16
|
+
*
|
|
17
|
+
* A component that automatically renders forms based on a JSON configuration.
|
|
18
|
+
* It takes a FormGroup and a configuration object that specifies the form structure.
|
|
19
|
+
*
|
|
20
|
+
* ## Features
|
|
21
|
+
* - Supports multiple field types: input, select, autocomplete, textarea, file, checkbox
|
|
22
|
+
* - Flexible row-based layout with configurable column spans
|
|
23
|
+
* - Section grouping with customizable titles
|
|
24
|
+
* - Empty area/spacer support for layout control
|
|
25
|
+
* - Full integration with Angular reactive forms
|
|
26
|
+
* - Responsive design with mobile-first approach
|
|
27
|
+
*
|
|
28
|
+
* ## Usage
|
|
29
|
+
*
|
|
30
|
+
* ### Basic Form
|
|
31
|
+
* ```typescript
|
|
32
|
+
* @Component({
|
|
33
|
+
* template: `
|
|
34
|
+
* <fui-dynamic-form-renderer
|
|
35
|
+
* [formGroup]="myForm"
|
|
36
|
+
* [config]="formConfig"
|
|
37
|
+
* ></fui-dynamic-form-renderer>
|
|
38
|
+
* `
|
|
39
|
+
* })
|
|
40
|
+
* export class MyComponent {
|
|
41
|
+
* myForm = new FormGroup({
|
|
42
|
+
* firstName: new FormControl(''),
|
|
43
|
+
* lastName: new FormControl(''),
|
|
44
|
+
* email: new FormControl(''),
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* formConfig: DynamicFormConfig = {
|
|
48
|
+
* sections: [{
|
|
49
|
+
* title: { text: 'Personal Information', importance: 'h3' },
|
|
50
|
+
* rows: [
|
|
51
|
+
* {
|
|
52
|
+
* fields: [
|
|
53
|
+
* { key: 'firstName', type: 'input', label: 'First Name', colSpan: 6 },
|
|
54
|
+
* { key: 'lastName', type: 'input', label: 'Last Name', colSpan: 6 },
|
|
55
|
+
* ]
|
|
56
|
+
* },
|
|
57
|
+
* {
|
|
58
|
+
* fields: [
|
|
59
|
+
* { key: 'email', type: 'input', inputType: 'email', label: 'Email', colSpan: 12 },
|
|
60
|
+
* ]
|
|
61
|
+
* }
|
|
62
|
+
* ]
|
|
63
|
+
* }]
|
|
64
|
+
* };
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ### With Validation Errors
|
|
69
|
+
* ```typescript
|
|
70
|
+
* formConfig: DynamicFormConfig = {
|
|
71
|
+
* sections: [{
|
|
72
|
+
* rows: [{
|
|
73
|
+
* fields: [{
|
|
74
|
+
* key: 'email',
|
|
75
|
+
* type: 'input',
|
|
76
|
+
* inputType: 'email',
|
|
77
|
+
* label: 'Email',
|
|
78
|
+
* errors: {
|
|
79
|
+
* required: 'Email is required',
|
|
80
|
+
* email: 'Please enter a valid email'
|
|
81
|
+
* }
|
|
82
|
+
* }]
|
|
83
|
+
* }]
|
|
84
|
+
* }]
|
|
85
|
+
* };
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* ### With Select and Autocomplete
|
|
89
|
+
* ```typescript
|
|
90
|
+
* formConfig: DynamicFormConfig = {
|
|
91
|
+
* sections: [{
|
|
92
|
+
* rows: [{
|
|
93
|
+
* fields: [
|
|
94
|
+
* {
|
|
95
|
+
* key: 'country',
|
|
96
|
+
* type: 'select',
|
|
97
|
+
* label: 'Country',
|
|
98
|
+
* options: [
|
|
99
|
+
* { value: 'us', label: 'United States' },
|
|
100
|
+
* { value: 'ca', label: 'Canada' },
|
|
101
|
+
* ],
|
|
102
|
+
* colSpan: 6
|
|
103
|
+
* },
|
|
104
|
+
* {
|
|
105
|
+
* key: 'city',
|
|
106
|
+
* type: 'autocomplete',
|
|
107
|
+
* label: 'City',
|
|
108
|
+
* options: [
|
|
109
|
+
* { value: 'nyc', label: 'New York' },
|
|
110
|
+
* { value: 'la', label: 'Los Angeles' },
|
|
111
|
+
* ],
|
|
112
|
+
* showAddButton: true,
|
|
113
|
+
* colSpan: 6
|
|
114
|
+
* }
|
|
115
|
+
* ]
|
|
116
|
+
* }]
|
|
117
|
+
* }]
|
|
118
|
+
* };
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
class FuiDynamicFormRendererComponent {
|
|
122
|
+
/**
|
|
123
|
+
* The FormGroup instance to bind the form to
|
|
124
|
+
*/
|
|
125
|
+
formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
126
|
+
/**
|
|
127
|
+
* The configuration object that defines the form structure
|
|
128
|
+
*/
|
|
129
|
+
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
130
|
+
/**
|
|
131
|
+
* Emitted when an autocomplete action (add/refresh) is triggered
|
|
132
|
+
*/
|
|
133
|
+
autocompleteAction = output();
|
|
134
|
+
/**
|
|
135
|
+
* Emitted when a file input changes
|
|
136
|
+
*/
|
|
137
|
+
fileChange = output();
|
|
138
|
+
/**
|
|
139
|
+
* Default comparison function for select components
|
|
140
|
+
*/
|
|
141
|
+
defaultCompareWith = (o1, o2) => o1 === o2;
|
|
142
|
+
/**
|
|
143
|
+
* Gets a FormControl from the FormGroup by key
|
|
144
|
+
* @param key The control name/key
|
|
145
|
+
* @returns The FormControl instance
|
|
146
|
+
*/
|
|
147
|
+
getControl(key) {
|
|
148
|
+
const control = this.formGroup().get(key);
|
|
149
|
+
if (!control) {
|
|
150
|
+
// Control not found - return empty control to prevent errors
|
|
151
|
+
return new FormControl(); // Return empty control to prevent errors
|
|
152
|
+
}
|
|
153
|
+
return control;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Converts error object entries to array for iteration
|
|
157
|
+
* @param errors The errors object from field config
|
|
158
|
+
* @returns Array of key-value pairs
|
|
159
|
+
*/
|
|
160
|
+
getErrorEntries(errors) {
|
|
161
|
+
return Object.entries(errors).map(([key, value]) => ({ key, value }));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Gets CSS align-items value from row align setting
|
|
165
|
+
* @param align The row alignment setting
|
|
166
|
+
* @returns CSS align-items value
|
|
167
|
+
*/
|
|
168
|
+
getAlignItems(align) {
|
|
169
|
+
switch (align) {
|
|
170
|
+
case 'start':
|
|
171
|
+
return 'flex-start';
|
|
172
|
+
case 'center':
|
|
173
|
+
return 'center';
|
|
174
|
+
case 'end':
|
|
175
|
+
return 'flex-end';
|
|
176
|
+
case 'stretch':
|
|
177
|
+
return 'stretch';
|
|
178
|
+
default:
|
|
179
|
+
return 'flex-start';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets CSS justify-content value from row justify setting
|
|
184
|
+
* @param justify The row justification setting
|
|
185
|
+
* @returns CSS justify-content value
|
|
186
|
+
*/
|
|
187
|
+
getJustifyContent(justify) {
|
|
188
|
+
switch (justify) {
|
|
189
|
+
case 'start':
|
|
190
|
+
return 'flex-start';
|
|
191
|
+
case 'center':
|
|
192
|
+
return 'center';
|
|
193
|
+
case 'end':
|
|
194
|
+
return 'flex-end';
|
|
195
|
+
case 'between':
|
|
196
|
+
return 'space-between';
|
|
197
|
+
case 'around':
|
|
198
|
+
return 'space-around';
|
|
199
|
+
case 'evenly':
|
|
200
|
+
return 'space-evenly';
|
|
201
|
+
default:
|
|
202
|
+
return 'flex-start';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Handles autocomplete add/refresh button clicks
|
|
207
|
+
* @param fieldKey The field key that triggered the action
|
|
208
|
+
* @param action The action type ('add' or 'refresh')
|
|
209
|
+
*/
|
|
210
|
+
onAutocompleteAction(fieldKey, action) {
|
|
211
|
+
this.autocompleteAction.emit({ fieldKey, action });
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Handles file input changes
|
|
215
|
+
* @param event The input change event
|
|
216
|
+
* @param fieldKey The field key
|
|
217
|
+
*/
|
|
218
|
+
onFileChange(event, fieldKey) {
|
|
219
|
+
const input = event.target;
|
|
220
|
+
this.fileChange.emit({ fieldKey, files: input.files });
|
|
221
|
+
// Also update the form control if it exists
|
|
222
|
+
const control = this.formGroup().get(fieldKey);
|
|
223
|
+
if (control) {
|
|
224
|
+
control.setValue(input.files);
|
|
225
|
+
control.markAsTouched();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Type guard to check if a field is not a spacer
|
|
230
|
+
* @param field The field configuration
|
|
231
|
+
* @returns Whether the field has a key
|
|
232
|
+
*/
|
|
233
|
+
isFieldWithKey(field) {
|
|
234
|
+
return field.type !== 'spacer' || !!field.key;
|
|
235
|
+
}
|
|
236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiDynamicFormRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
237
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuiDynamicFormRendererComponent, isStandalone: true, selector: "fui-dynamic-form-renderer", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { autocompleteAction: "autocompleteAction", fileChange: "fileChange" }, host: { classAttribute: "fui-dynamic-form-renderer" }, ngImport: i0, template: "<div class=\"fui-dynamic-form\" [class]=\"config().className\">\r\n @for (section of config().sections; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__section\"\r\n [class]=\"section.className\"\r\n [style.--section-row-gap]=\"section.rowGap ? 'var(--fui-spacing-' + section.rowGap + ')' : null\"\r\n >\r\n @if (section.title) {\r\n <div class=\"fui-dynamic-form__title-wrapper\" [class]=\"section.title.className\">\r\n @switch (section.title.importance) {\r\n @case ('h1') {\r\n <h1 class=\"fui-dynamic-form__title fui-display-xl fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h1>\r\n }\r\n @case ('h2') {\r\n <h2 class=\"fui-dynamic-form__title fui-display-lg fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h2>\r\n }\r\n @case ('h3') {\r\n <h3 class=\"fui-dynamic-form__title fui-display-md fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h3>\r\n }\r\n @case ('h4') {\r\n <h4 class=\"fui-dynamic-form__title fui-display-sm fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h4>\r\n }\r\n @case ('h5') {\r\n <h5 class=\"fui-dynamic-form__title fui-display-xs fui-font-medium\">\r\n {{ section.title.text }}\r\n </h5>\r\n }\r\n @case ('h6') {\r\n <h6 class=\"fui-dynamic-form__title fui-text-xl fui-font-medium\">{{ section.title.text }}</h6>\r\n }\r\n }\r\n @if (section.title.description) {\r\n <p class=\"fui-dynamic-form__description fui-text-md\">{{ section.title.description }}</p>\r\n }\r\n </div>\r\n }\r\n\r\n @for (row of section.rows; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__row\"\r\n [class]=\"row.className\"\r\n [style.--row-gap]=\"row.gap ? 'var(--fui-spacing-' + row.gap + ')' : null\"\r\n [style.align-items]=\"getAlignItems(row.align)\"\r\n [style.justify-content]=\"getJustifyContent(row.justify)\"\r\n >\r\n @for (field of row.fields; track field.key ?? $index) {\r\n <div class=\"fui-dynamic-form__field\" [class]=\"field.className\" [style.--field-col-span]=\"field.colSpan\">\r\n @switch (field.type) {\r\n @case ('input') {\r\n <ng-container *ngTemplateOutlet=\"inputTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('textarea') {\r\n <ng-container *ngTemplateOutlet=\"textareaTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('select') {\r\n <ng-container *ngTemplateOutlet=\"selectTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('autocomplete') {\r\n <ng-container *ngTemplateOutlet=\"autocompleteTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('checkbox') {\r\n <ng-container *ngTemplateOutlet=\"checkboxTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('file') {\r\n <ng-container *ngTemplateOutlet=\"fileTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('spacer') {\r\n <div class=\"fui-dynamic-form__spacer\"></div>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<!-- Input Template -->\r\n<ng-template #inputTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <input\r\n fuiInput\r\n [type]=\"field.inputType || 'text'\"\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n [pattern]=\"field.pattern\"\r\n [min]=\"field.min\"\r\n [max]=\"field.max\"\r\n [step]=\"field.step\"\r\n />\r\n @if (field.suffixIcon) {\r\n <fui-icon fuiSuffix [name]=\"field.suffixIcon\"></fui-icon>\r\n }\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Textarea Template -->\r\n<ng-template #textareaTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <textarea\r\n fuiInput\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [rows]=\"field.rows || 3\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n ></textarea>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Select Template -->\r\n<ng-template #selectTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <fui-select\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [multiple]=\"field.multiple || false\"\r\n [compareWith]=\"field.compareWith || defaultCompareWith\"\r\n >\r\n @for (option of field.options; track option.value) {\r\n <fui-option [value]=\"option.value\" [disabled]=\"option.disabled || false\">\r\n {{ option.label }}\r\n </fui-option>\r\n }\r\n </fui-select>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Autocomplete Template -->\r\n<ng-template #autocompleteTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <fui-autocomplete\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [showAddButton]=\"field.showAddButton || false\"\r\n [showRefreshButton]=\"field.showRefreshButton || false\"\r\n [addButtonLabel]=\"field.addButtonLabel || 'Add New'\"\r\n [refreshButtonLabel]=\"field.refreshButtonLabel || 'Refresh'\"\r\n [noOptionsText]=\"field.noOptionsText || 'No options found'\"\r\n [searchPlaceholder]=\"field.searchPlaceholder || 'Search...'\"\r\n (addNew)=\"onAutocompleteAction(field.key, 'add')\"\r\n (refresh)=\"onAutocompleteAction(field.key, 'refresh')\"\r\n ></fui-autocomplete>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Checkbox Template -->\r\n<ng-template #checkboxTemplate let-field>\r\n <div class=\"fui-dynamic-form__checkbox-wrapper\">\r\n <fui-checkbox [formControl]=\"getControl(field.key)\" [labelPosition]=\"field.labelPosition || 'after'\">\r\n {{ field.label }}\r\n </fui-checkbox>\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__checkbox-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- File Template -->\r\n<ng-template #fileTemplate let-field>\r\n <div class=\"fui-dynamic-form__file-field\">\r\n @if (field.label && !field.hideLabel) {\r\n <label class=\"fui-dynamic-form__file-label fui-text-sm\">{{ field.label }}</label>\r\n }\r\n <input\r\n type=\"file\"\r\n class=\"fui-dynamic-form__file-input\"\r\n [accept]=\"field.fileConfig?.accept\"\r\n [multiple]=\"field.fileConfig?.multiple || false\"\r\n [disabled]=\"field.disabled || false\"\r\n (change)=\"onFileChange($event, field.key)\"\r\n />\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__file-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- Errors Template -->\r\n<ng-template #errorsTemplate let-field>\r\n @if (field.errors && getControl(field.key)) {\r\n @for (errorEntry of getErrorEntries(field.errors); track errorEntry.key) {\r\n @if (getControl(field.key).hasError(errorEntry.key)) {\r\n <fui-error>{{ errorEntry.value }}</fui-error>\r\n }\r\n }\r\n }\r\n</ng-template>\r\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-dynamic-form{display:flex;flex-direction:column;gap:var(--fui-spacing-07);width:100%}.fui-dynamic-form__section{display:flex;flex-direction:column;gap:var(--section-row-gap, var(--fui-spacing-05))}.fui-dynamic-form__title-wrapper{display:flex;flex-direction:column;gap:var(--fui-spacing-02);margin-bottom:var(--fui-spacing-03)}.fui-dynamic-form__title{margin:0;padding:0;color:var(--fui-text-primary)}.fui-dynamic-form__description{margin:0;padding:0;color:var(--fui-text-secondary)}.fui-dynamic-form__row{display:flex;flex-wrap:wrap;gap:var(--row-gap, var(--fui-spacing-05));width:100%}.fui-dynamic-form__field{flex:1 1 auto;min-width:0}.fui-dynamic-form__field[style*=\"--field-col-span: 1\"]{flex:0 0 calc(1 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(1 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 2\"]{flex:0 0 calc(2 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(2 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 3\"]{flex:0 0 calc(3 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(3 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 4\"]{flex:0 0 calc(4 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(4 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 5\"]{flex:0 0 calc(5 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(5 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 6\"]{flex:0 0 calc(6 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(6 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 7\"]{flex:0 0 calc(7 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(7 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 8\"]{flex:0 0 calc(8 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(8 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 9\"]{flex:0 0 calc(9 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(9 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 10\"]{flex:0 0 calc(10 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(10 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 11\"]{flex:0 0 calc(11 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(11 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 12\"]{flex:0 0 calc(12 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(12 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 12\"]{flex:0 0 100%;max-width:100%}.fui-dynamic-form__spacer{width:100%;height:1px;visibility:hidden}.fui-dynamic-form__checkbox-wrapper{display:flex;flex-direction:column;gap:var(--fui-spacing-02);padding-top:var(--fui-spacing-06)}.fui-dynamic-form__checkbox-hint{color:var(--fui-text-secondary);margin-left:calc(1.125rem + var(--fui-spacing-03))}.fui-dynamic-form__file-field{display:flex;flex-direction:column;gap:var(--fui-spacing-02)}.fui-dynamic-form__file-label{color:var(--fui-text-primary);font-weight:var(--fui-font-weight-medium)}.fui-dynamic-form__file-input{padding:var(--fui-spacing-03);border:1px solid var(--fui-border-color);border-radius:var(--fui-border-radius-sm);background-color:var(--fui-surface-00);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02)}.fui-dynamic-form__file-input:focus{outline:none;border-color:var(--fui-primary);box-shadow:0 0 0 4px var(--fui-primary-20)}.fui-dynamic-form__file-input:disabled{opacity:.5;cursor:not-allowed}.fui-dynamic-form__file-input::file-selector-button{padding:var(--fui-spacing-02) var(--fui-spacing-04);margin-right:var(--fui-spacing-03);border:1px solid var(--fui-border-color);border-radius:var(--fui-border-radius-sm);background-color:var(--fui-surface-01);color:var(--fui-text-primary);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);cursor:pointer;transition:background-color,border-color var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-dynamic-form__file-input::file-selector-button:hover{background-color:var(--fui-surface-02)}.fui-dynamic-form__file-hint{color:var(--fui-text-secondary)}@media(max-width:768px){.fui-dynamic-form__row{flex-direction:column}.fui-dynamic-form__field{flex:0 0 100%!important;max-width:100%!important}.fui-dynamic-form__checkbox-wrapper{padding-top:0}}:host{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FuiFormFieldComponent, selector: "fui-form-field", inputs: ["readOnly", "appearance", "hideRequiredMarker", "hideSubscript"] }, { kind: "component", type: FuiLabelComponent, selector: "fui-label" }, { kind: "component", type: FuiErrorComponent, selector: "fui-error", inputs: ["key"] }, { kind: "component", type: FuiHintComponent, selector: "fui-hint" }, { kind: "directive", type: FuiPrefixDirective, selector: "[fuiPrefix]" }, { kind: "directive", type: FuiSuffixDirective, selector: "[fuiSuffix]" }, { kind: "directive", type: FuiInputDirective, selector: "input[fuiInput], textarea[fuiInput], select[fuiInput]", inputs: ["type", "placeholder", "readonly", "maxlength", "minlength", "pattern", "errorStateMatcher", "disabledInput"], outputs: ["valueChange"] }, { kind: "component", type: FuiSelectComponent, selector: "fui-select", inputs: ["placeholder", "disabled", "readonly", "multiple", "errorStateMatcher", "compareWith"], outputs: ["valueChange", "selectionChange", "openedChange"] }, { kind: "component", type: FuiOptionComponent, selector: "fui-option", inputs: ["value", "disabled"], outputs: ["selectionChange"] }, { kind: "component", type: FuiAutocompleteComponent, selector: "fui-autocomplete", inputs: ["placeholder", "disabled", "readonly", "showAddButton", "showRefreshButton", "addButtonLabel", "refreshButtonLabel", "noOptionsText", "searchPlaceholder", "errorStateMatcher", "compareWith"], outputs: ["valueChange", "selectionChange", "openedChange", "addNew", "refresh", "searchChange"] }, { kind: "component", type: FuiCheckboxComponent, selector: "fui-checkbox", inputs: ["readonly", "checked", "disabled", "indeterminate", "required", "labelPosition", "name", "value", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "errorStateMatcher"], outputs: ["change", "indeterminateChange"] }, { kind: "component", type: FuiIconComponent, selector: "fui-icon", inputs: ["name", "size", "weight", "color", "ariaLabel", "spin", "pulse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
238
|
+
}
|
|
239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiDynamicFormRendererComponent, decorators: [{
|
|
240
|
+
type: Component,
|
|
241
|
+
args: [{ selector: 'fui-dynamic-form-renderer', standalone: true, imports: [
|
|
242
|
+
CommonModule,
|
|
243
|
+
ReactiveFormsModule,
|
|
244
|
+
FuiFormFieldComponent,
|
|
245
|
+
FuiLabelComponent,
|
|
246
|
+
FuiErrorComponent,
|
|
247
|
+
FuiHintComponent,
|
|
248
|
+
FuiPrefixDirective,
|
|
249
|
+
FuiSuffixDirective,
|
|
250
|
+
FuiInputDirective,
|
|
251
|
+
FuiSelectComponent,
|
|
252
|
+
FuiOptionComponent,
|
|
253
|
+
FuiAutocompleteComponent,
|
|
254
|
+
FuiCheckboxComponent,
|
|
255
|
+
FuiIconComponent,
|
|
256
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
257
|
+
class: 'fui-dynamic-form-renderer',
|
|
258
|
+
}, template: "<div class=\"fui-dynamic-form\" [class]=\"config().className\">\r\n @for (section of config().sections; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__section\"\r\n [class]=\"section.className\"\r\n [style.--section-row-gap]=\"section.rowGap ? 'var(--fui-spacing-' + section.rowGap + ')' : null\"\r\n >\r\n @if (section.title) {\r\n <div class=\"fui-dynamic-form__title-wrapper\" [class]=\"section.title.className\">\r\n @switch (section.title.importance) {\r\n @case ('h1') {\r\n <h1 class=\"fui-dynamic-form__title fui-display-xl fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h1>\r\n }\r\n @case ('h2') {\r\n <h2 class=\"fui-dynamic-form__title fui-display-lg fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h2>\r\n }\r\n @case ('h3') {\r\n <h3 class=\"fui-dynamic-form__title fui-display-md fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h3>\r\n }\r\n @case ('h4') {\r\n <h4 class=\"fui-dynamic-form__title fui-display-sm fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h4>\r\n }\r\n @case ('h5') {\r\n <h5 class=\"fui-dynamic-form__title fui-display-xs fui-font-medium\">\r\n {{ section.title.text }}\r\n </h5>\r\n }\r\n @case ('h6') {\r\n <h6 class=\"fui-dynamic-form__title fui-text-xl fui-font-medium\">{{ section.title.text }}</h6>\r\n }\r\n }\r\n @if (section.title.description) {\r\n <p class=\"fui-dynamic-form__description fui-text-md\">{{ section.title.description }}</p>\r\n }\r\n </div>\r\n }\r\n\r\n @for (row of section.rows; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__row\"\r\n [class]=\"row.className\"\r\n [style.--row-gap]=\"row.gap ? 'var(--fui-spacing-' + row.gap + ')' : null\"\r\n [style.align-items]=\"getAlignItems(row.align)\"\r\n [style.justify-content]=\"getJustifyContent(row.justify)\"\r\n >\r\n @for (field of row.fields; track field.key ?? $index) {\r\n <div class=\"fui-dynamic-form__field\" [class]=\"field.className\" [style.--field-col-span]=\"field.colSpan\">\r\n @switch (field.type) {\r\n @case ('input') {\r\n <ng-container *ngTemplateOutlet=\"inputTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('textarea') {\r\n <ng-container *ngTemplateOutlet=\"textareaTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('select') {\r\n <ng-container *ngTemplateOutlet=\"selectTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('autocomplete') {\r\n <ng-container *ngTemplateOutlet=\"autocompleteTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('checkbox') {\r\n <ng-container *ngTemplateOutlet=\"checkboxTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('file') {\r\n <ng-container *ngTemplateOutlet=\"fileTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('spacer') {\r\n <div class=\"fui-dynamic-form__spacer\"></div>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<!-- Input Template -->\r\n<ng-template #inputTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <input\r\n fuiInput\r\n [type]=\"field.inputType || 'text'\"\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n [pattern]=\"field.pattern\"\r\n [min]=\"field.min\"\r\n [max]=\"field.max\"\r\n [step]=\"field.step\"\r\n />\r\n @if (field.suffixIcon) {\r\n <fui-icon fuiSuffix [name]=\"field.suffixIcon\"></fui-icon>\r\n }\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Textarea Template -->\r\n<ng-template #textareaTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <textarea\r\n fuiInput\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [rows]=\"field.rows || 3\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n ></textarea>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Select Template -->\r\n<ng-template #selectTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <fui-select\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [multiple]=\"field.multiple || false\"\r\n [compareWith]=\"field.compareWith || defaultCompareWith\"\r\n >\r\n @for (option of field.options; track option.value) {\r\n <fui-option [value]=\"option.value\" [disabled]=\"option.disabled || false\">\r\n {{ option.label }}\r\n </fui-option>\r\n }\r\n </fui-select>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Autocomplete Template -->\r\n<ng-template #autocompleteTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <fui-autocomplete\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [showAddButton]=\"field.showAddButton || false\"\r\n [showRefreshButton]=\"field.showRefreshButton || false\"\r\n [addButtonLabel]=\"field.addButtonLabel || 'Add New'\"\r\n [refreshButtonLabel]=\"field.refreshButtonLabel || 'Refresh'\"\r\n [noOptionsText]=\"field.noOptionsText || 'No options found'\"\r\n [searchPlaceholder]=\"field.searchPlaceholder || 'Search...'\"\r\n (addNew)=\"onAutocompleteAction(field.key, 'add')\"\r\n (refresh)=\"onAutocompleteAction(field.key, 'refresh')\"\r\n ></fui-autocomplete>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Checkbox Template -->\r\n<ng-template #checkboxTemplate let-field>\r\n <div class=\"fui-dynamic-form__checkbox-wrapper\">\r\n <fui-checkbox [formControl]=\"getControl(field.key)\" [labelPosition]=\"field.labelPosition || 'after'\">\r\n {{ field.label }}\r\n </fui-checkbox>\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__checkbox-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- File Template -->\r\n<ng-template #fileTemplate let-field>\r\n <div class=\"fui-dynamic-form__file-field\">\r\n @if (field.label && !field.hideLabel) {\r\n <label class=\"fui-dynamic-form__file-label fui-text-sm\">{{ field.label }}</label>\r\n }\r\n <input\r\n type=\"file\"\r\n class=\"fui-dynamic-form__file-input\"\r\n [accept]=\"field.fileConfig?.accept\"\r\n [multiple]=\"field.fileConfig?.multiple || false\"\r\n [disabled]=\"field.disabled || false\"\r\n (change)=\"onFileChange($event, field.key)\"\r\n />\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__file-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- Errors Template -->\r\n<ng-template #errorsTemplate let-field>\r\n @if (field.errors && getControl(field.key)) {\r\n @for (errorEntry of getErrorEntries(field.errors); track errorEntry.key) {\r\n @if (getControl(field.key).hasError(errorEntry.key)) {\r\n <fui-error>{{ errorEntry.value }}</fui-error>\r\n }\r\n }\r\n }\r\n</ng-template>\r\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-dynamic-form{display:flex;flex-direction:column;gap:var(--fui-spacing-07);width:100%}.fui-dynamic-form__section{display:flex;flex-direction:column;gap:var(--section-row-gap, var(--fui-spacing-05))}.fui-dynamic-form__title-wrapper{display:flex;flex-direction:column;gap:var(--fui-spacing-02);margin-bottom:var(--fui-spacing-03)}.fui-dynamic-form__title{margin:0;padding:0;color:var(--fui-text-primary)}.fui-dynamic-form__description{margin:0;padding:0;color:var(--fui-text-secondary)}.fui-dynamic-form__row{display:flex;flex-wrap:wrap;gap:var(--row-gap, var(--fui-spacing-05));width:100%}.fui-dynamic-form__field{flex:1 1 auto;min-width:0}.fui-dynamic-form__field[style*=\"--field-col-span: 1\"]{flex:0 0 calc(1 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(1 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 2\"]{flex:0 0 calc(2 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(2 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 3\"]{flex:0 0 calc(3 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(3 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 4\"]{flex:0 0 calc(4 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(4 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 5\"]{flex:0 0 calc(5 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(5 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 6\"]{flex:0 0 calc(6 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(6 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 7\"]{flex:0 0 calc(7 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(7 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 8\"]{flex:0 0 calc(8 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(8 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 9\"]{flex:0 0 calc(9 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(9 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 10\"]{flex:0 0 calc(10 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(10 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 11\"]{flex:0 0 calc(11 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(11 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 12\"]{flex:0 0 calc(12 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)));max-width:calc(12 / 12 * 100% - var(--row-gap, var(--fui-spacing-05)))}.fui-dynamic-form__field[style*=\"--field-col-span: 12\"]{flex:0 0 100%;max-width:100%}.fui-dynamic-form__spacer{width:100%;height:1px;visibility:hidden}.fui-dynamic-form__checkbox-wrapper{display:flex;flex-direction:column;gap:var(--fui-spacing-02);padding-top:var(--fui-spacing-06)}.fui-dynamic-form__checkbox-hint{color:var(--fui-text-secondary);margin-left:calc(1.125rem + var(--fui-spacing-03))}.fui-dynamic-form__file-field{display:flex;flex-direction:column;gap:var(--fui-spacing-02)}.fui-dynamic-form__file-label{color:var(--fui-text-primary);font-weight:var(--fui-font-weight-medium)}.fui-dynamic-form__file-input{padding:var(--fui-spacing-03);border:1px solid var(--fui-border-color);border-radius:var(--fui-border-radius-sm);background-color:var(--fui-surface-00);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02)}.fui-dynamic-form__file-input:focus{outline:none;border-color:var(--fui-primary);box-shadow:0 0 0 4px var(--fui-primary-20)}.fui-dynamic-form__file-input:disabled{opacity:.5;cursor:not-allowed}.fui-dynamic-form__file-input::file-selector-button{padding:var(--fui-spacing-02) var(--fui-spacing-04);margin-right:var(--fui-spacing-03);border:1px solid var(--fui-border-color);border-radius:var(--fui-border-radius-sm);background-color:var(--fui-surface-01);color:var(--fui-text-primary);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);cursor:pointer;transition:background-color,border-color var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-dynamic-form__file-input::file-selector-button:hover{background-color:var(--fui-surface-02)}.fui-dynamic-form__file-hint{color:var(--fui-text-secondary)}@media(max-width:768px){.fui-dynamic-form__row{flex-direction:column}.fui-dynamic-form__field{flex:0 0 100%!important;max-width:100%!important}.fui-dynamic-form__checkbox-wrapper{padding-top:0}}:host{display:block;width:100%}\n"] }]
|
|
259
|
+
}], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], autocompleteAction: [{ type: i0.Output, args: ["autocompleteAction"] }], fileChange: [{ type: i0.Output, args: ["fileChange"] }] } });
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Generated bundle index. Do not edit.
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
export { FuiDynamicFormRendererComponent };
|
|
266
|
+
//# sourceMappingURL=raintonic-formaui-components-dynamic-form.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raintonic-formaui-components-dynamic-form.mjs","sources":["../../../lib/components/dynamic-form/dynamic-form-renderer.component.ts","../../../lib/components/dynamic-form/dynamic-form-renderer.component.html","../../../lib/components/dynamic-form/raintonic-formaui-components-dynamic-form.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n input,\n InputSignal,\n output,\n OutputEmitterRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\n\nimport {\n FuiFormFieldComponent,\n FuiLabelComponent,\n FuiErrorComponent,\n FuiHintComponent,\n FuiPrefixDirective,\n FuiSuffixDirective,\n} from '@raintonic/formaui/components/form-field';\nimport { FuiInputDirective } from '@raintonic/formaui/components/input';\nimport { FuiSelectComponent, FuiOptionComponent } from '@raintonic/formaui/components/select';\nimport { FuiAutocompleteComponent } from '@raintonic/formaui/components/autocomplete';\nimport { FuiCheckboxComponent } from '@raintonic/formaui/components/checkbox';\nimport { FuiIconComponent } from '@raintonic/formaui/components/icon';\n\nimport {\n DynamicFormConfig,\n DynamicFormField,\n DynamicFormRow,\n DynamicFormAutocompleteEvent,\n DynamicFormFileEvent,\n} from './dynamic-form.types';\n\n/**\n * # DynamicFormRenderer Component\n *\n * A component that automatically renders forms based on a JSON configuration.\n * It takes a FormGroup and a configuration object that specifies the form structure.\n *\n * ## Features\n * - Supports multiple field types: input, select, autocomplete, textarea, file, checkbox\n * - Flexible row-based layout with configurable column spans\n * - Section grouping with customizable titles\n * - Empty area/spacer support for layout control\n * - Full integration with Angular reactive forms\n * - Responsive design with mobile-first approach\n *\n * ## Usage\n *\n * ### Basic Form\n * ```typescript\n * @Component({\n * template: `\n * <fui-dynamic-form-renderer\n * [formGroup]=\"myForm\"\n * [config]=\"formConfig\"\n * ></fui-dynamic-form-renderer>\n * `\n * })\n * export class MyComponent {\n * myForm = new FormGroup({\n * firstName: new FormControl(''),\n * lastName: new FormControl(''),\n * email: new FormControl(''),\n * });\n *\n * formConfig: DynamicFormConfig = {\n * sections: [{\n * title: { text: 'Personal Information', importance: 'h3' },\n * rows: [\n * {\n * fields: [\n * { key: 'firstName', type: 'input', label: 'First Name', colSpan: 6 },\n * { key: 'lastName', type: 'input', label: 'Last Name', colSpan: 6 },\n * ]\n * },\n * {\n * fields: [\n * { key: 'email', type: 'input', inputType: 'email', label: 'Email', colSpan: 12 },\n * ]\n * }\n * ]\n * }]\n * };\n * }\n * ```\n *\n * ### With Validation Errors\n * ```typescript\n * formConfig: DynamicFormConfig = {\n * sections: [{\n * rows: [{\n * fields: [{\n * key: 'email',\n * type: 'input',\n * inputType: 'email',\n * label: 'Email',\n * errors: {\n * required: 'Email is required',\n * email: 'Please enter a valid email'\n * }\n * }]\n * }]\n * }]\n * };\n * ```\n *\n * ### With Select and Autocomplete\n * ```typescript\n * formConfig: DynamicFormConfig = {\n * sections: [{\n * rows: [{\n * fields: [\n * {\n * key: 'country',\n * type: 'select',\n * label: 'Country',\n * options: [\n * { value: 'us', label: 'United States' },\n * { value: 'ca', label: 'Canada' },\n * ],\n * colSpan: 6\n * },\n * {\n * key: 'city',\n * type: 'autocomplete',\n * label: 'City',\n * options: [\n * { value: 'nyc', label: 'New York' },\n * { value: 'la', label: 'Los Angeles' },\n * ],\n * showAddButton: true,\n * colSpan: 6\n * }\n * ]\n * }]\n * }]\n * };\n * ```\n */\n@Component({\n selector: 'fui-dynamic-form-renderer',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FuiFormFieldComponent,\n FuiLabelComponent,\n FuiErrorComponent,\n FuiHintComponent,\n FuiPrefixDirective,\n FuiSuffixDirective,\n FuiInputDirective,\n FuiSelectComponent,\n FuiOptionComponent,\n FuiAutocompleteComponent,\n FuiCheckboxComponent,\n FuiIconComponent,\n ],\n templateUrl: './dynamic-form-renderer.component.html',\n styleUrls: ['./dynamic-form-renderer.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'fui-dynamic-form-renderer',\n },\n})\nexport class FuiDynamicFormRendererComponent {\n /**\n * The FormGroup instance to bind the form to\n */\n readonly formGroup: InputSignal<FormGroup> = input.required<FormGroup>();\n\n /**\n * The configuration object that defines the form structure\n */\n readonly config: InputSignal<DynamicFormConfig> = input.required<DynamicFormConfig>();\n\n /**\n * Emitted when an autocomplete action (add/refresh) is triggered\n */\n readonly autocompleteAction: OutputEmitterRef<DynamicFormAutocompleteEvent> = output<DynamicFormAutocompleteEvent>();\n\n /**\n * Emitted when a file input changes\n */\n readonly fileChange: OutputEmitterRef<DynamicFormFileEvent> = output<DynamicFormFileEvent>();\n\n /**\n * Default comparison function for select components\n */\n readonly defaultCompareWith = (o1: unknown, o2: unknown): boolean => o1 === o2;\n\n /**\n * Gets a FormControl from the FormGroup by key\n * @param key The control name/key\n * @returns The FormControl instance\n */\n getControl(key: string): FormControl {\n const control = this.formGroup().get(key);\n if (!control) {\n // Control not found - return empty control to prevent errors\n return new FormControl(); // Return empty control to prevent errors\n }\n return control as FormControl;\n }\n\n /**\n * Converts error object entries to array for iteration\n * @param errors The errors object from field config\n * @returns Array of key-value pairs\n */\n getErrorEntries(errors: Record<string, string>): { key: string; value: string }[] {\n return Object.entries(errors).map(([key, value]) => ({ key, value }));\n }\n\n /**\n * Gets CSS align-items value from row align setting\n * @param align The row alignment setting\n * @returns CSS align-items value\n */\n getAlignItems(align?: DynamicFormRow['align']): string {\n switch (align) {\n case 'start':\n return 'flex-start';\n case 'center':\n return 'center';\n case 'end':\n return 'flex-end';\n case 'stretch':\n return 'stretch';\n default:\n return 'flex-start';\n }\n }\n\n /**\n * Gets CSS justify-content value from row justify setting\n * @param justify The row justification setting\n * @returns CSS justify-content value\n */\n getJustifyContent(justify?: DynamicFormRow['justify']): string {\n switch (justify) {\n case 'start':\n return 'flex-start';\n case 'center':\n return 'center';\n case 'end':\n return 'flex-end';\n case 'between':\n return 'space-between';\n case 'around':\n return 'space-around';\n case 'evenly':\n return 'space-evenly';\n default:\n return 'flex-start';\n }\n }\n\n /**\n * Handles autocomplete add/refresh button clicks\n * @param fieldKey The field key that triggered the action\n * @param action The action type ('add' or 'refresh')\n */\n onAutocompleteAction(fieldKey: string, action: 'add' | 'refresh'): void {\n this.autocompleteAction.emit({ fieldKey, action });\n }\n\n /**\n * Handles file input changes\n * @param event The input change event\n * @param fieldKey The field key\n */\n onFileChange(event: Event, fieldKey: string): void {\n const input = event.target as HTMLInputElement;\n this.fileChange.emit({ fieldKey, files: input.files });\n\n // Also update the form control if it exists\n const control = this.formGroup().get(fieldKey);\n if (control) {\n control.setValue(input.files);\n control.markAsTouched();\n }\n }\n\n /**\n * Type guard to check if a field is not a spacer\n * @param field The field configuration\n * @returns Whether the field has a key\n */\n isFieldWithKey(field: DynamicFormField): field is Exclude<DynamicFormField, { type: 'spacer' }> {\n return field.type !== 'spacer' || !!field.key;\n }\n}\n","<div class=\"fui-dynamic-form\" [class]=\"config().className\">\r\n @for (section of config().sections; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__section\"\r\n [class]=\"section.className\"\r\n [style.--section-row-gap]=\"section.rowGap ? 'var(--fui-spacing-' + section.rowGap + ')' : null\"\r\n >\r\n @if (section.title) {\r\n <div class=\"fui-dynamic-form__title-wrapper\" [class]=\"section.title.className\">\r\n @switch (section.title.importance) {\r\n @case ('h1') {\r\n <h1 class=\"fui-dynamic-form__title fui-display-xl fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h1>\r\n }\r\n @case ('h2') {\r\n <h2 class=\"fui-dynamic-form__title fui-display-lg fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h2>\r\n }\r\n @case ('h3') {\r\n <h3 class=\"fui-dynamic-form__title fui-display-md fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h3>\r\n }\r\n @case ('h4') {\r\n <h4 class=\"fui-dynamic-form__title fui-display-sm fui-font-semibold\">\r\n {{ section.title.text }}\r\n </h4>\r\n }\r\n @case ('h5') {\r\n <h5 class=\"fui-dynamic-form__title fui-display-xs fui-font-medium\">\r\n {{ section.title.text }}\r\n </h5>\r\n }\r\n @case ('h6') {\r\n <h6 class=\"fui-dynamic-form__title fui-text-xl fui-font-medium\">{{ section.title.text }}</h6>\r\n }\r\n }\r\n @if (section.title.description) {\r\n <p class=\"fui-dynamic-form__description fui-text-md\">{{ section.title.description }}</p>\r\n }\r\n </div>\r\n }\r\n\r\n @for (row of section.rows; track $index) {\r\n <div\r\n class=\"fui-dynamic-form__row\"\r\n [class]=\"row.className\"\r\n [style.--row-gap]=\"row.gap ? 'var(--fui-spacing-' + row.gap + ')' : null\"\r\n [style.align-items]=\"getAlignItems(row.align)\"\r\n [style.justify-content]=\"getJustifyContent(row.justify)\"\r\n >\r\n @for (field of row.fields; track field.key ?? $index) {\r\n <div class=\"fui-dynamic-form__field\" [class]=\"field.className\" [style.--field-col-span]=\"field.colSpan\">\r\n @switch (field.type) {\r\n @case ('input') {\r\n <ng-container *ngTemplateOutlet=\"inputTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('textarea') {\r\n <ng-container *ngTemplateOutlet=\"textareaTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('select') {\r\n <ng-container *ngTemplateOutlet=\"selectTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('autocomplete') {\r\n <ng-container *ngTemplateOutlet=\"autocompleteTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('checkbox') {\r\n <ng-container *ngTemplateOutlet=\"checkboxTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('file') {\r\n <ng-container *ngTemplateOutlet=\"fileTemplate; context: { $implicit: field }\"></ng-container>\r\n }\r\n @case ('spacer') {\r\n <div class=\"fui-dynamic-form__spacer\"></div>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<!-- Input Template -->\r\n<ng-template #inputTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <input\r\n fuiInput\r\n [type]=\"field.inputType || 'text'\"\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n [pattern]=\"field.pattern\"\r\n [min]=\"field.min\"\r\n [max]=\"field.max\"\r\n [step]=\"field.step\"\r\n />\r\n @if (field.suffixIcon) {\r\n <fui-icon fuiSuffix [name]=\"field.suffixIcon\"></fui-icon>\r\n }\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Textarea Template -->\r\n<ng-template #textareaTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <textarea\r\n fuiInput\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [readonly]=\"field.readonly || false\"\r\n [rows]=\"field.rows || 3\"\r\n [maxlength]=\"field.maxLength\"\r\n [minlength]=\"field.minLength\"\r\n ></textarea>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Select Template -->\r\n<ng-template #selectTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n @if (field.prefixIcon) {\r\n <fui-icon fuiPrefix [name]=\"field.prefixIcon\"></fui-icon>\r\n }\r\n <fui-select\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [multiple]=\"field.multiple || false\"\r\n [compareWith]=\"field.compareWith || defaultCompareWith\"\r\n >\r\n @for (option of field.options; track option.value) {\r\n <fui-option [value]=\"option.value\" [disabled]=\"option.disabled || false\">\r\n {{ option.label }}\r\n </fui-option>\r\n }\r\n </fui-select>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Autocomplete Template -->\r\n<ng-template #autocompleteTemplate let-field>\r\n <fui-form-field>\r\n @if (field.label && !field.hideLabel) {\r\n <fui-label>{{ field.label }}</fui-label>\r\n }\r\n <fui-autocomplete\r\n [formControl]=\"getControl(field.key)\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [showAddButton]=\"field.showAddButton || false\"\r\n [showRefreshButton]=\"field.showRefreshButton || false\"\r\n [addButtonLabel]=\"field.addButtonLabel || 'Add New'\"\r\n [refreshButtonLabel]=\"field.refreshButtonLabel || 'Refresh'\"\r\n [noOptionsText]=\"field.noOptionsText || 'No options found'\"\r\n [searchPlaceholder]=\"field.searchPlaceholder || 'Search...'\"\r\n (addNew)=\"onAutocompleteAction(field.key, 'add')\"\r\n (refresh)=\"onAutocompleteAction(field.key, 'refresh')\"\r\n ></fui-autocomplete>\r\n @if (field.hint) {\r\n <fui-hint>{{ field.hint }}</fui-hint>\r\n }\r\n <ng-container *ngTemplateOutlet=\"errorsTemplate; context: { $implicit: field }\"></ng-container>\r\n </fui-form-field>\r\n</ng-template>\r\n\r\n<!-- Checkbox Template -->\r\n<ng-template #checkboxTemplate let-field>\r\n <div class=\"fui-dynamic-form__checkbox-wrapper\">\r\n <fui-checkbox [formControl]=\"getControl(field.key)\" [labelPosition]=\"field.labelPosition || 'after'\">\r\n {{ field.label }}\r\n </fui-checkbox>\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__checkbox-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- File Template -->\r\n<ng-template #fileTemplate let-field>\r\n <div class=\"fui-dynamic-form__file-field\">\r\n @if (field.label && !field.hideLabel) {\r\n <label class=\"fui-dynamic-form__file-label fui-text-sm\">{{ field.label }}</label>\r\n }\r\n <input\r\n type=\"file\"\r\n class=\"fui-dynamic-form__file-input\"\r\n [accept]=\"field.fileConfig?.accept\"\r\n [multiple]=\"field.fileConfig?.multiple || false\"\r\n [disabled]=\"field.disabled || false\"\r\n (change)=\"onFileChange($event, field.key)\"\r\n />\r\n @if (field.hint) {\r\n <div class=\"fui-dynamic-form__file-hint fui-text-sm\">{{ field.hint }}</div>\r\n }\r\n </div>\r\n</ng-template>\r\n\r\n<!-- Errors Template -->\r\n<ng-template #errorsTemplate let-field>\r\n @if (field.errors && getControl(field.key)) {\r\n @for (errorEntry of getErrorEntries(field.errors); track errorEntry.key) {\r\n @if (getControl(field.key).hasError(errorEntry.key)) {\r\n <fui-error>{{ errorEntry.value }}</fui-error>\r\n }\r\n }\r\n }\r\n</ng-template>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GG;MA4BU,+BAA+B,CAAA;AAC1C;;AAEG;AACM,IAAA,SAAS,GAA2B,KAAK,CAAC,QAAQ,+EAAa;AAExE;;AAEG;AACM,IAAA,MAAM,GAAmC,KAAK,CAAC,QAAQ,4EAAqB;AAErF;;AAEG;IACM,kBAAkB,GAAmD,MAAM,EAAgC;AAEpH;;AAEG;IACM,UAAU,GAA2C,MAAM,EAAwB;AAE5F;;AAEG;IACM,kBAAkB,GAAG,CAAC,EAAW,EAAE,EAAW,KAAc,EAAE,KAAK,EAAE;AAE9E;;;;AAIG;AACH,IAAA,UAAU,CAAC,GAAW,E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AAC,IAAI,EAAA,IAAA,EAC/B;AACJ,wBAAA,KAAK,EAAE,2BAA2B;AACnC,qBAAA,EAAA,QAAA,EAAA,4rSAAA,EAAA,MAAA,EAAA,CAAA,u2MAAA,CAAA,EAAA;;;AEtKH;;AAEG;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { FuiIconComponent } from '@raintonic/formaui/components/icon';
|
|
4
|
+
|
|
5
|
+
class FuiEmptyStateComponent {
|
|
6
|
+
icon = input(null, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
7
|
+
title = input(null, ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
8
|
+
description = input(null, ...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
|
|
9
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
10
|
+
iconSize = computed(() => {
|
|
11
|
+
const s = this.size();
|
|
12
|
+
return s === 'sm' ? 'md' : 'lg';
|
|
13
|
+
}, ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiEmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuiEmptyStateComponent, isStandalone: true, selector: "fui-empty-state", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class.fui-empty-state--sm": "size() === \"sm\"", "class.fui-empty-state--md": "size() === \"md\"", "class.fui-empty-state--lg": "size() === \"lg\"" }, classAttribute: "fui-empty-state" }, ngImport: i0, template: "<div class=\"fui-empty-state__content\">\n @if (icon()) {\n <div class=\"fui-empty-state__icon\" aria-hidden=\"true\">\n <fui-icon [name]=\"icon()!\" [size]=\"iconSize()\" weight=\"light\" />\n </div>\n }\n @if (title()) {\n <h3 class=\"fui-empty-state__title\">{{ title() }}</h3>\n }\n @if (description()) {\n <p class=\"fui-empty-state__description\">{{ description() }}</p>\n }\n <div class=\"fui-empty-state__actions\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".fui-empty-state{display:flex;align-items:center;justify-content:center;padding:var(--fui-padding-48, 3rem);text-align:center}.fui-empty-state__content{display:flex;flex-direction:column;align-items:center;gap:var(--fui-gap-12, .75rem);max-width:24rem}.fui-empty-state__icon{color:var(--fui-text-disabled);margin-bottom:var(--fui-gap-8, .5rem)}.fui-empty-state__title{font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-04);font-weight:var(--fui-font-weight-semibold, 600);color:var(--fui-text-primary);margin:0}.fui-empty-state__description{font-size:var(--fui-font-size-02);color:var(--fui-text-secondary);margin:0;line-height:1.5}.fui-empty-state__actions{margin-top:var(--fui-gap-16, 1rem);display:flex;gap:var(--fui-gap-8, .5rem)}.fui-empty-state--sm{padding:var(--fui-padding-24, 1.5rem)}.fui-empty-state--sm .fui-empty-state__title{font-size:var(--fui-font-size-03)}.fui-empty-state--lg{padding:4.5rem}.fui-empty-state--lg .fui-empty-state__title{font-size:var(--fui-font-size-05)}\n"], dependencies: [{ kind: "component", type: FuiIconComponent, selector: "fui-icon", inputs: ["name", "size", "weight", "color", "ariaLabel", "spin", "pulse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiEmptyStateComponent, decorators: [{
|
|
18
|
+
type: Component,
|
|
19
|
+
args: [{ selector: 'fui-empty-state', standalone: true, imports: [FuiIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
20
|
+
class: 'fui-empty-state',
|
|
21
|
+
'[class.fui-empty-state--sm]': 'size() === "sm"',
|
|
22
|
+
'[class.fui-empty-state--md]': 'size() === "md"',
|
|
23
|
+
'[class.fui-empty-state--lg]': 'size() === "lg"',
|
|
24
|
+
role: 'status',
|
|
25
|
+
}, template: "<div class=\"fui-empty-state__content\">\n @if (icon()) {\n <div class=\"fui-empty-state__icon\" aria-hidden=\"true\">\n <fui-icon [name]=\"icon()!\" [size]=\"iconSize()\" weight=\"light\" />\n </div>\n }\n @if (title()) {\n <h3 class=\"fui-empty-state__title\">{{ title() }}</h3>\n }\n @if (description()) {\n <p class=\"fui-empty-state__description\">{{ description() }}</p>\n }\n <div class=\"fui-empty-state__actions\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".fui-empty-state{display:flex;align-items:center;justify-content:center;padding:var(--fui-padding-48, 3rem);text-align:center}.fui-empty-state__content{display:flex;flex-direction:column;align-items:center;gap:var(--fui-gap-12, .75rem);max-width:24rem}.fui-empty-state__icon{color:var(--fui-text-disabled);margin-bottom:var(--fui-gap-8, .5rem)}.fui-empty-state__title{font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-04);font-weight:var(--fui-font-weight-semibold, 600);color:var(--fui-text-primary);margin:0}.fui-empty-state__description{font-size:var(--fui-font-size-02);color:var(--fui-text-secondary);margin:0;line-height:1.5}.fui-empty-state__actions{margin-top:var(--fui-gap-16, 1rem);display:flex;gap:var(--fui-gap-8, .5rem)}.fui-empty-state--sm{padding:var(--fui-padding-24, 1.5rem)}.fui-empty-state--sm .fui-empty-state__title{font-size:var(--fui-font-size-03)}.fui-empty-state--lg{padding:4.5rem}.fui-empty-state--lg .fui-empty-state__title{font-size:var(--fui-font-size-05)}\n"] }]
|
|
26
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generated bundle index. Do not edit.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export { FuiEmptyStateComponent };
|
|
33
|
+
//# sourceMappingURL=raintonic-formaui-components-empty-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raintonic-formaui-components-empty-state.mjs","sources":["../../../lib/components/empty-state/empty-state.component.ts","../../../lib/components/empty-state/empty-state.component.html","../../../lib/components/empty-state/raintonic-formaui-components-empty-state.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, input } from '@angular/core';\nimport { FuiIconComponent } from '@raintonic/formaui/components/icon';\n\n@Component({\n selector: 'fui-empty-state',\n standalone: true,\n imports: [FuiIconComponent],\n templateUrl: './empty-state.component.html',\n styleUrls: ['./empty-state.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'fui-empty-state',\n '[class.fui-empty-state--sm]': 'size() === \"sm\"',\n '[class.fui-empty-state--md]': 'size() === \"md\"',\n '[class.fui-empty-state--lg]': 'size() === \"lg\"',\n role: 'status',\n },\n})\nexport class FuiEmptyStateComponent {\n readonly icon = input<string | null>(null);\n readonly title = input<string | null>(null);\n readonly description = input<string | null>(null);\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n\n readonly iconSize = computed(() => {\n const s = this.size();\n return s === 'sm' ? 'md' : 'lg';\n });\n}\n","<div class=\"fui-empty-state__content\">\n @if (icon()) {\n <div class=\"fui-empty-state__icon\" aria-hidden=\"true\">\n <fui-icon [name]=\"icon()!\" [size]=\"iconSize()\" weight=\"light\" />\n </div>\n }\n @if (title()) {\n <h3 class=\"fui-empty-state__title\">{{ title() }}</h3>\n }\n @if (description()) {\n <p class=\"fui-empty-state__description\">{{ description() }}</p>\n }\n <div class=\"fui-empty-state__actions\">\n <ng-content></ng-content>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAmBa,sBAAsB,CAAA;AACxB,IAAA,IAAI,GAAG,KAAK,CAAgB,IAAI,2EAAC;AACjC,IAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,4EAAC;AAClC,IAAA,WAAW,GAAG,KAAK,CAAgB,IAAI,kFAAC;AACxC,IAAA,IAAI,GAAG,KAAK,CAAqB,IAAI,2EAAC;AAEtC,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAK;AAChC,QAAA,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE;QACrB,OAAO,CAAC,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI;AACjC,IAAA,CAAC,+EAAC;uGATS,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,WAAA,EAAA,EAAA,i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