@exhaustive-ui/mcp 22.4.0 → 22.6.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/README.md +13 -1
- package/data/cards/accordion.md +91 -0
- package/data/cards/animateonscroll.md +155 -0
- package/data/cards/autocomplete.md +109 -0
- package/data/cards/autofocus.md +36 -0
- package/data/cards/avatar.md +45 -0
- package/data/cards/badge.md +44 -0
- package/data/cards/blockui.md +51 -0
- package/data/cards/breadcrumb.md +56 -0
- package/data/cards/button.md +83 -0
- package/data/cards/card.md +49 -0
- package/data/cards/carousel.md +101 -0
- package/data/cards/cascadeselect.md +77 -0
- package/data/cards/chart.md +105 -0
- package/data/cards/checkbox.md +59 -0
- package/data/cards/chip.md +50 -0
- package/data/cards/classnames.md +91 -0
- package/data/cards/colorpicker.md +52 -0
- package/data/cards/confirmdialog.md +119 -0
- package/data/cards/confirmpopup.md +96 -0
- package/data/cards/contextmenu.md +60 -0
- package/data/cards/dataview.md +134 -0
- package/data/cards/datepicker.md +103 -0
- package/data/cards/dialog.md +89 -0
- package/data/cards/divider.md +55 -0
- package/data/cards/dock.md +106 -0
- package/data/cards/dragdrop.md +106 -0
- package/data/cards/drawer.md +62 -0
- package/data/cards/dynamicdialog.md +103 -0
- package/data/cards/editor.md +55 -0
- package/data/cards/fieldset.md +54 -0
- package/data/cards/fileinput.md +72 -0
- package/data/cards/fileupload.md +88 -0
- package/data/cards/floatlabel.md +41 -0
- package/data/cards/fluid.md +49 -0
- package/data/cards/focustrap.md +64 -0
- package/data/cards/galleria.md +94 -0
- package/data/cards/iconfield.md +45 -0
- package/data/cards/iftalabel.md +38 -0
- package/data/cards/image.md +58 -0
- package/data/cards/imagecompare.md +45 -0
- package/data/cards/inplace.md +56 -0
- package/data/cards/inputgroup.md +77 -0
- package/data/cards/inputmask.md +71 -0
- package/data/cards/inputnumber.md +78 -0
- package/data/cards/inputotp.md +60 -0
- package/data/cards/inputtext.md +41 -0
- package/data/cards/keyfilter.md +49 -0
- package/data/cards/knob.md +55 -0
- package/data/cards/listbox.md +105 -0
- package/data/cards/megamenu.md +96 -0
- package/data/cards/menu.md +64 -0
- package/data/cards/menubar.md +102 -0
- package/data/cards/message.md +51 -0
- package/data/cards/metergroup.md +53 -0
- package/data/cards/multiselect.md +115 -0
- package/data/cards/orderlist.md +96 -0
- package/data/cards/organizationchart.md +84 -0
- package/data/cards/overlay.md +63 -0
- package/data/cards/paginator.md +62 -0
- package/data/cards/panel.md +57 -0
- package/data/cards/panelmenu.md +94 -0
- package/data/cards/password.md +81 -0
- package/data/cards/picklist.md +106 -0
- package/data/cards/popover.md +53 -0
- package/data/cards/progressbar.md +42 -0
- package/data/cards/progressspinner.md +38 -0
- package/data/cards/radiobutton.md +52 -0
- package/data/cards/rating.md +56 -0
- package/data/cards/ripple.md +37 -0
- package/data/cards/scroller.md +32 -0
- package/data/cards/scrollpanel.md +50 -0
- package/data/cards/scrolltop.md +48 -0
- package/data/cards/select.md +108 -0
- package/data/cards/selectbutton.md +64 -0
- package/data/cards/skeleton.md +54 -0
- package/data/cards/slider.md +52 -0
- package/data/cards/speeddial.md +102 -0
- package/data/cards/splitbutton.md +96 -0
- package/data/cards/splitter.md +52 -0
- package/data/cards/stepper.md +125 -0
- package/data/cards/styleclass.md +46 -0
- package/data/cards/table.md +305 -0
- package/data/cards/tabs.md +97 -0
- package/data/cards/tag.md +41 -0
- package/data/cards/terminal.md +76 -0
- package/data/cards/textarea.md +45 -0
- package/data/cards/tieredmenu.md +121 -0
- package/data/cards/timeline.md +58 -0
- package/data/cards/toast.md +58 -0
- package/data/cards/togglebutton.md +59 -0
- package/data/cards/toggleswitch.md +52 -0
- package/data/cards/toolbar.md +74 -0
- package/data/cards/tooltip.md +43 -0
- package/data/cards/tree.md +93 -0
- package/data/cards/treeselect.md +98 -0
- package/data/cards/treetable.md +231 -0
- package/data/components/accordion.md +31 -23
- package/data/components/animateonscroll.md +18 -15
- package/data/components/autocomplete.md +162 -93
- package/data/components/autofocus.md +9 -7
- package/data/components/avatar.md +56 -43
- package/data/components/badge.md +27 -18
- package/data/components/blockui.md +15 -8
- package/data/components/breadcrumb.md +20 -14
- package/data/components/button.md +121 -94
- package/data/components/card.md +12 -10
- package/data/components/carousel.md +75 -53
- package/data/components/cascadeselect.md +271 -238
- package/data/components/chart.md +88 -74
- package/data/components/checkbox.md +107 -97
- package/data/components/chip.md +20 -16
- package/data/components/classnames.md +22 -4
- package/data/components/colorpicker.md +54 -36
- package/data/components/confirmdialog.md +146 -43
- package/data/components/confirmpopup.md +95 -22
- package/data/components/contextmenu.md +110 -39
- package/data/components/dataview.md +176 -83
- package/data/components/datepicker.md +171 -141
- package/data/components/dialog.md +80 -68
- package/data/components/divider.md +17 -12
- package/data/components/dock.md +65 -29
- package/data/components/dragdrop.md +26 -12
- package/data/components/drawer.md +67 -48
- package/data/components/dynamicdialog.md +22 -13
- package/data/components/editor.md +42 -33
- package/data/components/fieldset.md +20 -17
- package/data/components/fileinput.md +92 -35
- package/data/components/fileupload.md +101 -61
- package/data/components/floatlabel.md +20 -11
- package/data/components/fluid.md +11 -9
- package/data/components/focustrap.md +11 -7
- package/data/components/galleria.md +231 -90
- package/data/components/iconfield.md +23 -15
- package/data/components/iftalabel.md +15 -9
- package/data/components/image.md +31 -26
- package/data/components/imagecompare.md +8 -6
- package/data/components/inplace.md +27 -22
- package/data/components/inputgroup.md +53 -29
- package/data/components/inputmask.md +107 -85
- package/data/components/inputnumber.md +128 -90
- package/data/components/inputotp.md +55 -42
- package/data/components/inputtext.md +72 -50
- package/data/components/keyfilter.md +6 -3
- package/data/components/knob.md +70 -58
- package/data/components/listbox.md +171 -141
- package/data/components/llms.md +4 -0
- package/data/components/megamenu.md +24 -23
- package/data/components/menu.md +37 -34
- package/data/components/menubar.md +27 -22
- package/data/components/message.md +44 -32
- package/data/components/metergroup.md +48 -17
- package/data/components/multiselect.md +232 -168
- package/data/components/orderlist.md +55 -48
- package/data/components/organizationchart.md +182 -13
- package/data/components/overlay.md +31 -26
- package/data/components/paginator.md +49 -34
- package/data/components/panel.md +23 -19
- package/data/components/panelmenu.md +51 -25
- package/data/components/password.md +104 -91
- package/data/components/picklist.md +93 -71
- package/data/components/popover.md +68 -46
- package/data/components/progressbar.md +28 -22
- package/data/components/progressspinner.md +13 -11
- package/data/components/radiobutton.md +69 -35
- package/data/components/rating.md +48 -40
- package/data/components/ripple.md +8 -6
- package/data/components/scroller.md +29 -29
- package/data/components/scrollpanel.md +9 -7
- package/data/components/scrolltop.md +20 -18
- package/data/components/select.md +248 -169
- package/data/components/selectbutton.md +118 -56
- package/data/components/skeleton.md +22 -18
- package/data/components/slider.md +73 -49
- package/data/components/speeddial.md +77 -59
- package/data/components/splitbutton.md +354 -329
- package/data/components/splitter.md +22 -18
- package/data/components/stepper.md +38 -21
- package/data/components/styleclass.md +12 -6
- package/data/components/table.md +524 -315
- package/data/components/tabs.md +44 -26
- package/data/components/tag.md +18 -14
- package/data/components/terminal.md +38 -27
- package/data/components/textarea.md +82 -47
- package/data/components/tieredmenu.md +34 -29
- package/data/components/timeline.md +29 -28
- package/data/components/toast.md +115 -57
- package/data/components/togglebutton.md +53 -39
- package/data/components/toggleswitch.md +41 -28
- package/data/components/toolbar.md +19 -18
- package/data/components/tooltip.md +43 -32
- package/data/components/tree.md +114 -81
- package/data/components/treeselect.md +176 -174
- package/data/components/treetable.md +1250 -1045
- package/data/components.json +4134 -4088
- package/data/llms-full.txt +8979 -6437
- package/data/llms.txt +100 -96
- package/data/manifest.json +183 -15
- package/data/pages/llms.md +29 -0
- package/data/pages/tailwind.md +20 -10
- package/data/snapshot.json +2 -2
- package/dist/index.d.mts +37 -2
- package/dist/index.mjs +1395 -1079
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ Fieldset is a grouping component with a content toggle feature.
|
|
|
4
4
|
|
|
5
5
|
## Accessibility
|
|
6
6
|
|
|
7
|
-
Screen Reader Fieldset component uses the semantic fieldset element. When toggleable option is enabled, a clickable element with button role is included inside the legend element, this button has aria-controls to define the id of the content section along with aria-expanded for the visibility state. The
|
|
7
|
+
Screen Reader Fieldset component uses the semantic fieldset element. When toggleable option is enabled, a clickable element with button role is included inside the legend element, this button has aria-controls to define the id of the content section along with aria-expanded for the visibility state. The aria-label of the button is the value of the legend property. The content uses region , defines an id that matches the aria-controls of the content toggle button and aria-labelledby referring to the id of the header. Content Toggle Button Keyboard Support Key Function tab Moves focus to the next the focusable element in the page tab sequence. shift + tab Moves focus to the previous the focusable element in the page tab sequence. enter Toggles the visibility of the content. space Toggles the visibility of the content.
|
|
8
8
|
|
|
9
9
|
## Basic
|
|
10
10
|
|
|
@@ -28,7 +28,8 @@ import { FieldsetModule } from '@exhaustive-ui/core/fieldset';
|
|
|
28
28
|
standalone: true,
|
|
29
29
|
imports: [FieldsetModule]
|
|
30
30
|
})
|
|
31
|
-
export class FieldsetBasicDemo {
|
|
31
|
+
export class FieldsetBasicDemo {
|
|
32
|
+
}
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
## Template
|
|
@@ -37,8 +38,8 @@ Header section can also be defined with custom content instead of primitive valu
|
|
|
37
38
|
|
|
38
39
|
```typescript
|
|
39
40
|
import { Component } from '@angular/core';
|
|
40
|
-
import { AvatarModule } from '@exhaustive-ui/core/avatar';
|
|
41
41
|
import { FieldsetModule } from '@exhaustive-ui/core/fieldset';
|
|
42
|
+
import { AvatarModule } from '@exhaustive-ui/core/avatar';
|
|
42
43
|
|
|
43
44
|
@Component({
|
|
44
45
|
template: `
|
|
@@ -46,7 +47,7 @@ import { FieldsetModule } from '@exhaustive-ui/core/fieldset';
|
|
|
46
47
|
<p-fieldset>
|
|
47
48
|
<ng-template #header>
|
|
48
49
|
<div class="flex items-center gap-2 px-2">
|
|
49
|
-
<p-avatar image="https://exhaustive-ui.com/demo/avatar/amyelsner.png" shape="circle" />
|
|
50
|
+
<p-avatar image="https://exhaustive-ui.com/demo/avatar/amyelsner.png" ariaLabel="Amy Elsner" shape="circle" />
|
|
50
51
|
<span class="font-bold">Amy Elsner</span>
|
|
51
52
|
</div>
|
|
52
53
|
</ng-template>
|
|
@@ -58,9 +59,10 @@ import { FieldsetModule } from '@exhaustive-ui/core/fieldset';
|
|
|
58
59
|
</div>
|
|
59
60
|
`,
|
|
60
61
|
standalone: true,
|
|
61
|
-
imports: [
|
|
62
|
+
imports: [FieldsetModule, AvatarModule]
|
|
62
63
|
})
|
|
63
|
-
export class FieldsetTemplateDemo {
|
|
64
|
+
export class FieldsetTemplateDemo {
|
|
65
|
+
}
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
## Toggleable
|
|
@@ -85,7 +87,8 @@ import { FieldsetModule } from '@exhaustive-ui/core/fieldset';
|
|
|
85
87
|
standalone: true,
|
|
86
88
|
imports: [FieldsetModule]
|
|
87
89
|
})
|
|
88
|
-
export class FieldsetToggleableDemo {
|
|
90
|
+
export class FieldsetToggleableDemo {
|
|
91
|
+
}
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
## Fieldset
|
|
@@ -96,16 +99,16 @@ Fieldset is a grouping component with the optional content toggle feature.
|
|
|
96
99
|
|
|
97
100
|
| Name | Type | Default | Description |
|
|
98
101
|
|------|------|---------|-------------|
|
|
99
|
-
| dt |
|
|
100
|
-
| unstyled |
|
|
101
|
-
| pt |
|
|
102
|
-
| ptOptions |
|
|
103
|
-
| legend |
|
|
104
|
-
| toggleable |
|
|
105
|
-
| style |
|
|
106
|
-
| styleClass |
|
|
107
|
-
| motionOptions |
|
|
108
|
-
| collapsed |
|
|
102
|
+
| dt | Object | undefined | Defines scoped design tokens of the component. |
|
|
103
|
+
| unstyled | boolean | undefined | Indicates whether the component should be rendered without styles. |
|
|
104
|
+
| pt | FieldsetPassThrough | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
105
|
+
| ptOptions | PassThroughOptions | undefined | Used to configure passthrough(pt) options of the component. |
|
|
106
|
+
| legend | string | - | Header text of the fieldset. |
|
|
107
|
+
| toggleable | boolean | false | When specified, content can toggled by clicking the legend. |
|
|
108
|
+
| style | { [klass: string]: any } | - | Inline style of the component. |
|
|
109
|
+
| styleClass | string | - | Style class of the component. |
|
|
110
|
+
| motionOptions | MotionOptions | - | The motion options. |
|
|
111
|
+
| collapsed | boolean | - | Defines the initial state of content, supports one or two-way binding as well. Emits `collapsedChange` with the new value when the collapsed state changes. |
|
|
109
112
|
|
|
110
113
|
### Emits
|
|
111
114
|
|
|
@@ -23,10 +23,11 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
23
23
|
</div>
|
|
24
24
|
`,
|
|
25
25
|
standalone: true,
|
|
26
|
-
imports: [
|
|
26
|
+
imports: [FormsModule, FileInputModule]
|
|
27
27
|
})
|
|
28
28
|
export class FileinputAvatarDemo {
|
|
29
29
|
photo: File | null = null;
|
|
30
|
+
|
|
30
31
|
logo: File | null = null;
|
|
31
32
|
}
|
|
32
33
|
```
|
|
@@ -47,7 +48,7 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
47
48
|
</div>
|
|
48
49
|
`,
|
|
49
50
|
standalone: true,
|
|
50
|
-
imports: [
|
|
51
|
+
imports: [FormsModule, FileInputModule]
|
|
51
52
|
})
|
|
52
53
|
export class FileinputBasicDemo {
|
|
53
54
|
files: File[] = [];
|
|
@@ -71,7 +72,8 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
71
72
|
standalone: true,
|
|
72
73
|
imports: [FileInputModule]
|
|
73
74
|
})
|
|
74
|
-
export class FileinputDisabledDemo {
|
|
75
|
+
export class FileinputDisabledDemo {
|
|
76
|
+
}
|
|
75
77
|
```
|
|
76
78
|
|
|
77
79
|
## Existing Files
|
|
@@ -80,9 +82,9 @@ When a form edits a record, pass the files already stored on the server to exist
|
|
|
80
82
|
|
|
81
83
|
```typescript
|
|
82
84
|
import { Component, inject } from '@angular/core';
|
|
83
|
-
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
84
|
-
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
85
85
|
import { MessageService } from '@exhaustive-ui/core/api';
|
|
86
|
+
import { FileInputExistingFile, FileInputModule, FileInputRemoveExistingEvent } from '@exhaustive-ui/core/fileinput';
|
|
87
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
86
88
|
|
|
87
89
|
@Component({
|
|
88
90
|
template: `
|
|
@@ -92,11 +94,16 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
92
94
|
</div>
|
|
93
95
|
`,
|
|
94
96
|
standalone: true,
|
|
95
|
-
imports: [FileInputModule, ToastModule]
|
|
97
|
+
imports: [FileInputModule, ToastModule],
|
|
98
|
+
providers: [MessageService]
|
|
96
99
|
})
|
|
97
100
|
export class FileinputExistingDemo {
|
|
98
101
|
messageService = inject(MessageService);
|
|
99
|
-
|
|
102
|
+
|
|
103
|
+
attachments: FileInputExistingFile[] = [
|
|
104
|
+
{ id: 1, name: 'signed-contract.pdf', size: 1240000, type: 'application/pdf' },
|
|
105
|
+
{ id: 2, name: 'facade.jpg', size: 312000, type: 'image/jpeg', url: 'https://exhaustive-ui.com/demo/galleria/galleria1.jpg' }
|
|
106
|
+
];
|
|
100
107
|
|
|
101
108
|
onRemoveExisting(event: FileInputRemoveExistingEvent) {
|
|
102
109
|
this.messageService.add({ severity: 'info', summary: 'Delete on the server', detail: event.file.name, life: 3000 });
|
|
@@ -111,7 +118,7 @@ The images variant shows the files as a grid of square thumbnails, for a gallery
|
|
|
111
118
|
```typescript
|
|
112
119
|
import { Component } from '@angular/core';
|
|
113
120
|
import { FormsModule } from '@angular/forms';
|
|
114
|
-
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
121
|
+
import { FileInputModule, FileInputUploadHandler } from '@exhaustive-ui/core/fileinput';
|
|
115
122
|
|
|
116
123
|
@Component({
|
|
117
124
|
template: `
|
|
@@ -120,11 +127,24 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
120
127
|
</div>
|
|
121
128
|
`,
|
|
122
129
|
standalone: true,
|
|
123
|
-
imports: [
|
|
130
|
+
imports: [FormsModule, FileInputModule]
|
|
124
131
|
})
|
|
125
132
|
export class FileinputImagesDemo {
|
|
126
133
|
photos: File[] = [];
|
|
127
|
-
|
|
134
|
+
|
|
135
|
+
upload: FileInputUploadHandler = (file, { signal, progress }) =>
|
|
136
|
+
new Promise((resolve) => {
|
|
137
|
+
let percent = 0;
|
|
138
|
+
const timer = setInterval(() => {
|
|
139
|
+
percent += 8;
|
|
140
|
+
progress(percent);
|
|
141
|
+
if (percent >= 100) {
|
|
142
|
+
clearInterval(timer);
|
|
143
|
+
resolve({ name: file.name });
|
|
144
|
+
}
|
|
145
|
+
}, 120);
|
|
146
|
+
signal.addEventListener('abort', () => clearInterval(timer));
|
|
147
|
+
});
|
|
128
148
|
}
|
|
129
149
|
```
|
|
130
150
|
|
|
@@ -156,7 +176,7 @@ Every text of the component, error messages and screen reader announcements incl
|
|
|
156
176
|
|
|
157
177
|
```typescript
|
|
158
178
|
import { Component } from '@angular/core';
|
|
159
|
-
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
179
|
+
import { FileInputLabels, FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
160
180
|
|
|
161
181
|
@Component({
|
|
162
182
|
template: `
|
|
@@ -168,7 +188,15 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
168
188
|
imports: [FileInputModule]
|
|
169
189
|
})
|
|
170
190
|
export class FileinputLabelsDemo {
|
|
171
|
-
labels: Partial<FileInputLabels
|
|
191
|
+
labels: Partial<FileInputLabels> = {
|
|
192
|
+
dropzone: 'Déposez vos fichiers ici ou',
|
|
193
|
+
browse: 'parcourez',
|
|
194
|
+
remove: 'Retirer',
|
|
195
|
+
maxFileSizeError: 'Trop lourd : {0}, maximum {1}',
|
|
196
|
+
addedMessage: '{0} fichier(s) ajouté(s)',
|
|
197
|
+
removedMessage: '{0} retiré',
|
|
198
|
+
listLabel: 'Fichiers sélectionnés'
|
|
199
|
+
};
|
|
172
200
|
}
|
|
173
201
|
```
|
|
174
202
|
|
|
@@ -178,12 +206,12 @@ FileInput can also be used with reactive forms. In this case, the formControlNam
|
|
|
178
206
|
|
|
179
207
|
```typescript
|
|
180
208
|
import { Component, inject } from '@angular/core';
|
|
181
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
209
|
+
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
210
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
182
211
|
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
183
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
184
212
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
213
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
185
214
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
186
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
187
215
|
|
|
188
216
|
@Component({
|
|
189
217
|
template: `
|
|
@@ -202,17 +230,22 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
202
230
|
</div>
|
|
203
231
|
`,
|
|
204
232
|
standalone: true,
|
|
205
|
-
imports: [
|
|
233
|
+
imports: [ReactiveFormsModule, FileInputModule, ToastModule, MessageModule, ButtonModule],
|
|
234
|
+
providers: [MessageService]
|
|
206
235
|
})
|
|
207
236
|
export class FileinputReactiveformsDemo {
|
|
237
|
+
private fb = inject(FormBuilder);
|
|
238
|
+
|
|
208
239
|
messageService = inject(MessageService);
|
|
240
|
+
|
|
209
241
|
exampleForm: FormGroup;
|
|
242
|
+
|
|
210
243
|
formSubmitted: boolean = false;
|
|
211
244
|
|
|
212
245
|
constructor() {
|
|
213
246
|
this.exampleForm = this.fb.group({
|
|
214
|
-
|
|
215
|
-
|
|
247
|
+
documents: [[], Validators.required]
|
|
248
|
+
});
|
|
216
249
|
}
|
|
217
250
|
|
|
218
251
|
onSubmit() {
|
|
@@ -238,11 +271,11 @@ FileInput can also be used with Angular Signal Forms . The [formField] directive
|
|
|
238
271
|
```typescript
|
|
239
272
|
import { Component, inject, signal } from '@angular/core';
|
|
240
273
|
import { form, FormField, minLength, submit } from '@angular/forms/signals';
|
|
274
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
241
275
|
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
242
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
243
|
-
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
244
276
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
245
|
-
import {
|
|
277
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
278
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
246
279
|
|
|
247
280
|
@Component({
|
|
248
281
|
template: `
|
|
@@ -262,11 +295,14 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
262
295
|
</div>
|
|
263
296
|
`,
|
|
264
297
|
standalone: true,
|
|
265
|
-
imports: [FileInputModule,
|
|
298
|
+
imports: [FormField, FileInputModule, ButtonModule, ToastModule, MessageModule],
|
|
299
|
+
providers: [MessageService]
|
|
266
300
|
})
|
|
267
301
|
export class FileinputSignalformsDemo {
|
|
268
302
|
messageService = inject(MessageService);
|
|
303
|
+
|
|
269
304
|
model = signal<{ photos: File[] }>({ photos: [] });
|
|
305
|
+
|
|
270
306
|
listingForm = form(this.model, (f) => {
|
|
271
307
|
minLength(f.photos, 1);
|
|
272
308
|
});
|
|
@@ -300,7 +336,8 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
300
336
|
standalone: true,
|
|
301
337
|
imports: [FileInputModule]
|
|
302
338
|
})
|
|
303
|
-
export class FileinputSizesDemo {
|
|
339
|
+
export class FileinputSizesDemo {
|
|
340
|
+
}
|
|
304
341
|
```
|
|
305
342
|
|
|
306
343
|
## Template
|
|
@@ -309,8 +346,8 @@ The dropzone template replaces the content of the dropzone and receives an open
|
|
|
309
346
|
|
|
310
347
|
```typescript
|
|
311
348
|
import { Component } from '@angular/core';
|
|
312
|
-
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
313
349
|
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
350
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
314
351
|
|
|
315
352
|
@Component({
|
|
316
353
|
template: `
|
|
@@ -330,9 +367,10 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
330
367
|
</div>
|
|
331
368
|
`,
|
|
332
369
|
standalone: true,
|
|
333
|
-
imports: [
|
|
370
|
+
imports: [FileInputModule, ButtonModule]
|
|
334
371
|
})
|
|
335
|
-
export class FileinputTemplateDemo {
|
|
372
|
+
export class FileinputTemplateDemo {
|
|
373
|
+
}
|
|
336
374
|
```
|
|
337
375
|
|
|
338
376
|
## templatedrivenforms-doc
|
|
@@ -342,11 +380,11 @@ The value is an array of files, empty when nothing is selected, so required work
|
|
|
342
380
|
```typescript
|
|
343
381
|
import { Component, inject } from '@angular/core';
|
|
344
382
|
import { FormsModule } from '@angular/forms';
|
|
383
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
345
384
|
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
346
|
-
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
347
385
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
386
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
348
387
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
349
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
350
388
|
|
|
351
389
|
@Component({
|
|
352
390
|
template: `
|
|
@@ -365,10 +403,12 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
365
403
|
</div>
|
|
366
404
|
`,
|
|
367
405
|
standalone: true,
|
|
368
|
-
imports: [
|
|
406
|
+
imports: [FormsModule, FileInputModule, ToastModule, MessageModule, ButtonModule],
|
|
407
|
+
providers: [MessageService]
|
|
369
408
|
})
|
|
370
409
|
export class FileinputTemplatedrivenformsDemo {
|
|
371
410
|
messageService = inject(MessageService);
|
|
411
|
+
|
|
372
412
|
receipts: File[] = [];
|
|
373
413
|
|
|
374
414
|
onSubmit(form: any) {
|
|
@@ -386,9 +426,9 @@ Each file is uploaded in its own request, with its own progress bar, as soon as
|
|
|
386
426
|
|
|
387
427
|
```typescript
|
|
388
428
|
import { Component, inject } from '@angular/core';
|
|
389
|
-
import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
390
|
-
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
391
429
|
import { MessageService } from '@exhaustive-ui/core/api';
|
|
430
|
+
import { FileInputModule, FileInputUploadEvent, FileInputUploadHandler } from '@exhaustive-ui/core/fileinput';
|
|
431
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
392
432
|
|
|
393
433
|
@Component({
|
|
394
434
|
template: `
|
|
@@ -398,12 +438,28 @@ import { MessageService } from '@exhaustive-ui/core/api';
|
|
|
398
438
|
</div>
|
|
399
439
|
`,
|
|
400
440
|
standalone: true,
|
|
401
|
-
imports: [FileInputModule, ToastModule]
|
|
441
|
+
imports: [FileInputModule, ToastModule],
|
|
442
|
+
providers: [MessageService]
|
|
402
443
|
})
|
|
403
444
|
export class FileinputUploadDemo {
|
|
404
445
|
messageService = inject(MessageService);
|
|
405
|
-
|
|
406
|
-
|
|
446
|
+
|
|
447
|
+
upload: FileInputUploadHandler = (file, { signal, progress }) =>
|
|
448
|
+
new Promise((resolve, reject) => {
|
|
449
|
+
let percent = 0;
|
|
450
|
+
const timer = setInterval(() => {
|
|
451
|
+
percent += 100000 / Math.max(file.size, 200000);
|
|
452
|
+
progress(percent);
|
|
453
|
+
if (file.name.includes('error') && percent > 50) {
|
|
454
|
+
clearInterval(timer);
|
|
455
|
+
reject(new Error('The server answered 500'));
|
|
456
|
+
} else if (percent >= 100) {
|
|
457
|
+
clearInterval(timer);
|
|
458
|
+
resolve({ name: file.name });
|
|
459
|
+
}
|
|
460
|
+
}, 150);
|
|
461
|
+
signal.addEventListener('abort', () => clearInterval(timer));
|
|
462
|
+
});
|
|
407
463
|
|
|
408
464
|
onUpload(event: FileInputUploadEvent) {
|
|
409
465
|
this.messageService.add({ severity: 'success', summary: 'Uploaded', detail: event.item.name, life: 2000 });
|
|
@@ -428,7 +484,8 @@ import { FileInputModule } from '@exhaustive-ui/core/fileinput';
|
|
|
428
484
|
standalone: true,
|
|
429
485
|
imports: [FileInputModule]
|
|
430
486
|
})
|
|
431
|
-
export class FileinputValidationDemo {
|
|
487
|
+
export class FileinputValidationDemo {
|
|
488
|
+
}
|
|
432
489
|
```
|
|
433
490
|
|
|
434
491
|
## Pass Through Options
|