@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.1
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/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
# Angular InputMask Component
|
|
2
|
+
|
|
3
|
+
InputMask component is used to enter input in a certain format such as numeric, date, currency and phone.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader InputMask directive is used with a native input element that implicitly includes any passed attribute. Value to describe the component can either be provided via label tag combined with id attribute or using aria-labelledby , aria-label attributes.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
InputMask is used as a controlled input with ngModel properties.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component } from '@angular/core';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
17
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
template: `
|
|
21
|
+
<div class="card flex justify-center">
|
|
22
|
+
<input pInputText pInputMask="99-999999" [(ngModel)]="value" placeholder="99-999999" />
|
|
23
|
+
</div>
|
|
24
|
+
`,
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
27
|
+
})
|
|
28
|
+
export class InputmaskBasicDemo {
|
|
29
|
+
value: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## clearicon-doc
|
|
34
|
+
|
|
35
|
+
When showClear is enabled, a clear icon is displayed to clear the value.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Component } from '@angular/core';
|
|
39
|
+
import { FormsModule } from '@angular/forms';
|
|
40
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
template: `
|
|
44
|
+
<div class="card flex justify-center">
|
|
45
|
+
<p-inputmask mask="99-999999" [(ngModel)]="value" placeholder="99-999999" [showClear]="true" />
|
|
46
|
+
</div>
|
|
47
|
+
`,
|
|
48
|
+
standalone: true,
|
|
49
|
+
imports: [InputMaskModule, FormsModule]
|
|
50
|
+
})
|
|
51
|
+
export class InputmaskCleariconDemo {
|
|
52
|
+
value: string | undefined;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Disabled
|
|
57
|
+
|
|
58
|
+
When disabled is present, the element cannot be edited and focused.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { Component } from '@angular/core';
|
|
62
|
+
import { FormsModule } from '@angular/forms';
|
|
63
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
64
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
65
|
+
|
|
66
|
+
@Component({
|
|
67
|
+
template: `
|
|
68
|
+
<div class="card flex justify-center">
|
|
69
|
+
<input pInputText pInputMask="999-99-9999" [(ngModel)]="value" disabled />
|
|
70
|
+
</div>
|
|
71
|
+
`,
|
|
72
|
+
standalone: true,
|
|
73
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
74
|
+
})
|
|
75
|
+
export class InputmaskDisabledDemo {
|
|
76
|
+
value: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Filled
|
|
81
|
+
|
|
82
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { Component } from '@angular/core';
|
|
86
|
+
import { FormsModule } from '@angular/forms';
|
|
87
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
88
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
89
|
+
|
|
90
|
+
@Component({
|
|
91
|
+
template: `
|
|
92
|
+
<div class="card flex justify-center">
|
|
93
|
+
<input pInputText pInputMask="99-999999" [(ngModel)]="value" variant="filled" placeholder="99-999999" />
|
|
94
|
+
</div>
|
|
95
|
+
`,
|
|
96
|
+
standalone: true,
|
|
97
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
98
|
+
})
|
|
99
|
+
export class InputmaskFilledDemo {
|
|
100
|
+
value: string | undefined;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Float Label
|
|
105
|
+
|
|
106
|
+
FloatLabel visually integrates a label with its form element. Visit FloatLabel documentation for more information.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Component } from '@angular/core';
|
|
110
|
+
import { FormsModule } from '@angular/forms';
|
|
111
|
+
import { FloatLabelModule } from '@exhaustive-ui/core/floatlabel';
|
|
112
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
113
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
114
|
+
|
|
115
|
+
@Component({
|
|
116
|
+
template: `
|
|
117
|
+
<div class="card flex flex-wrap justify-center items-end gap-4">
|
|
118
|
+
<p-floatlabel>
|
|
119
|
+
<input pInputText id="over_label" [(ngModel)]="value1" pInputMask="999-99-9999" />
|
|
120
|
+
<label for="over_label">Over Label</label>
|
|
121
|
+
</p-floatlabel>
|
|
122
|
+
<p-floatlabel variant="in">
|
|
123
|
+
<input pInputText id="in_label" [(ngModel)]="value2" pInputMask="999-99-9999" />
|
|
124
|
+
<label for="in_label">In Label</label>
|
|
125
|
+
</p-floatlabel>
|
|
126
|
+
<p-floatlabel variant="on">
|
|
127
|
+
<input pInputText id="on_label" [(ngModel)]="value3" pInputMask="999-99-9999" />
|
|
128
|
+
<label for="on_label">On Label</label>
|
|
129
|
+
</p-floatlabel>
|
|
130
|
+
</div>
|
|
131
|
+
`,
|
|
132
|
+
standalone: true,
|
|
133
|
+
imports: [FloatLabelModule, InputTextModule, InputMaskModule, FormsModule]
|
|
134
|
+
})
|
|
135
|
+
export class InputmaskFloatlabelDemo {
|
|
136
|
+
value1: string | undefined;
|
|
137
|
+
value2: string | undefined;
|
|
138
|
+
value3: string | undefined;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Fluid
|
|
143
|
+
|
|
144
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { Component } from '@angular/core';
|
|
148
|
+
import { FormsModule } from '@angular/forms';
|
|
149
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
150
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
151
|
+
|
|
152
|
+
@Component({
|
|
153
|
+
template: `
|
|
154
|
+
<div class="card">
|
|
155
|
+
<input pInputText pInputMask="99-999999" [(ngModel)]="value" placeholder="99-999999" fluid />
|
|
156
|
+
</div>
|
|
157
|
+
`,
|
|
158
|
+
standalone: true,
|
|
159
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
160
|
+
})
|
|
161
|
+
export class InputmaskFluidDemo {
|
|
162
|
+
value: string | undefined;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Ifta Label
|
|
167
|
+
|
|
168
|
+
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { Component } from '@angular/core';
|
|
172
|
+
import { FormsModule } from '@angular/forms';
|
|
173
|
+
import { IftaLabelModule } from '@exhaustive-ui/core/iftalabel';
|
|
174
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
175
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
176
|
+
|
|
177
|
+
@Component({
|
|
178
|
+
template: `
|
|
179
|
+
<div class="card flex justify-center">
|
|
180
|
+
<p-iftalabel>
|
|
181
|
+
<input pInputText id="ssn" [(ngModel)]="value" pInputMask="999-99-9999" autocomplete="off" />
|
|
182
|
+
<label for="ssn">SSN</label>
|
|
183
|
+
</p-iftalabel>
|
|
184
|
+
</div>
|
|
185
|
+
`,
|
|
186
|
+
standalone: true,
|
|
187
|
+
imports: [IftaLabelModule, InputTextModule, InputMaskModule, FormsModule]
|
|
188
|
+
})
|
|
189
|
+
export class InputmaskIftalabelDemo {
|
|
190
|
+
value: string | undefined;
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Invalid
|
|
195
|
+
|
|
196
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with Angular Forms.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { Component } from '@angular/core';
|
|
200
|
+
import { FormsModule } from '@angular/forms';
|
|
201
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
202
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
203
|
+
|
|
204
|
+
@Component({
|
|
205
|
+
template: `
|
|
206
|
+
<div class="card flex flex-wrap justify-center gap-4">
|
|
207
|
+
<input pInputText [(ngModel)]="value1" pInputMask="99-999999" placeholder="Serial Key" [invalid]="!value1" />
|
|
208
|
+
<input pInputText [(ngModel)]="value2" pInputMask="99-999999" placeholder="Serial Key" [invalid]="!value2" variant="filled" />
|
|
209
|
+
</div>
|
|
210
|
+
`,
|
|
211
|
+
standalone: true,
|
|
212
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
213
|
+
})
|
|
214
|
+
export class InputmaskInvalidDemo {
|
|
215
|
+
value1: string | undefined;
|
|
216
|
+
value2: string | undefined;
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Mask
|
|
221
|
+
|
|
222
|
+
Mask format can be a combination of the following definitions; a for alphabetic characters, 9 for numeric characters and * for alphanumberic characters. In addition, formatting characters like ( , ) , - are also accepted.
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import { Component } from '@angular/core';
|
|
226
|
+
import { FormsModule } from '@angular/forms';
|
|
227
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
228
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
229
|
+
|
|
230
|
+
@Component({
|
|
231
|
+
template: `
|
|
232
|
+
<p-fluid class="card flex flex-wrap gap-4">
|
|
233
|
+
<div class="flex-auto">
|
|
234
|
+
<span class="font-bold block mb-2">SSN</span>
|
|
235
|
+
<input pInputText pInputMask="999-99-9999" [(ngModel)]="value1" placeholder="999-99-9999" />
|
|
236
|
+
</div>
|
|
237
|
+
<div class="flex-auto">
|
|
238
|
+
<span class="font-bold block mb-2">Phone</span>
|
|
239
|
+
<input pInputText pInputMask="(999) 999-9999" [(ngModel)]="value2" placeholder="(999) 999-9999" />
|
|
240
|
+
</div>
|
|
241
|
+
<div class="flex-auto">
|
|
242
|
+
<span class="font-bold block mb-2">Serial Number</span>
|
|
243
|
+
<input pInputText pInputMask="a*-999-a999" [(ngModel)]="value3" placeholder="a*-999-a999" />
|
|
244
|
+
</div>
|
|
245
|
+
</p-fluid>
|
|
246
|
+
`,
|
|
247
|
+
standalone: true,
|
|
248
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
249
|
+
})
|
|
250
|
+
export class InputmaskMaskDemo {
|
|
251
|
+
value1: string | undefined;
|
|
252
|
+
value2: string | undefined;
|
|
253
|
+
value3: string | undefined;
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Optional
|
|
258
|
+
|
|
259
|
+
When the input does not complete the mask definition, it is cleared by default. Use autoClear property to control this behavior. In addition, ? is used to mark anything after the question mark optional.
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { Component } from '@angular/core';
|
|
263
|
+
import { FormsModule } from '@angular/forms';
|
|
264
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
265
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
266
|
+
|
|
267
|
+
@Component({
|
|
268
|
+
template: `
|
|
269
|
+
<div class="card flex justify-center">
|
|
270
|
+
<input pInputText pInputMask="(999) 999-9999? x99999" [(ngModel)]="value" placeholder="(999) 999-9999? x99999" />
|
|
271
|
+
</div>
|
|
272
|
+
`,
|
|
273
|
+
standalone: true,
|
|
274
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
275
|
+
})
|
|
276
|
+
export class InputmaskOptionalDemo {
|
|
277
|
+
value: string | undefined;
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## reactiveforms-doc
|
|
282
|
+
|
|
283
|
+
InputMask can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
import { Component, inject } from '@angular/core';
|
|
287
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
288
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
289
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
290
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
291
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
292
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
293
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
294
|
+
|
|
295
|
+
@Component({
|
|
296
|
+
template: `
|
|
297
|
+
<p-toast />
|
|
298
|
+
<div class="card flex justify-center">
|
|
299
|
+
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 sm:w-56">
|
|
300
|
+
<div class="flex flex-col gap-1">
|
|
301
|
+
<input pInputText pInputMask="99-999999" formControlName="value" placeholder="99-999999" [invalid]="isInvalid('value')" fluid />
|
|
302
|
+
@if (isInvalid('value')) {
|
|
303
|
+
<p-message severity="error" size="small" variant="simple">Serial number is required.</p-message>
|
|
304
|
+
}
|
|
305
|
+
</div>
|
|
306
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
307
|
+
</form>
|
|
308
|
+
</div>
|
|
309
|
+
`,
|
|
310
|
+
standalone: true,
|
|
311
|
+
imports: [MessageModule, ToastModule, ButtonModule, InputTextModule, InputMaskModule, ReactiveFormsModule]
|
|
312
|
+
})
|
|
313
|
+
export class InputmaskReactiveformsDemo {
|
|
314
|
+
messageService = inject(MessageService);
|
|
315
|
+
items: any[] | undefined;
|
|
316
|
+
exampleForm: FormGroup | undefined;
|
|
317
|
+
formSubmitted: boolean = false;
|
|
318
|
+
|
|
319
|
+
constructor() {
|
|
320
|
+
this.exampleForm = this.fb.group({
|
|
321
|
+
value: ['', Validators.required]
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
onSubmit() {
|
|
326
|
+
this.formSubmitted = true;
|
|
327
|
+
if (this.exampleForm.valid) {
|
|
328
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form is submitted', life: 3000 });
|
|
329
|
+
this.exampleForm.reset();
|
|
330
|
+
this.formSubmitted = false;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
isInvalid(controlName: string) {
|
|
335
|
+
const control = this.exampleForm.get(controlName);
|
|
336
|
+
return control?.invalid && (control.touched || this.formSubmitted);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Sizes
|
|
342
|
+
|
|
343
|
+
InputMask provides small and large sizes as alternatives to the base.
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
import { Component } from '@angular/core';
|
|
347
|
+
import { FormsModule } from '@angular/forms';
|
|
348
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
349
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
350
|
+
|
|
351
|
+
@Component({
|
|
352
|
+
template: `
|
|
353
|
+
<div class="card flex flex-col items-center gap-4">
|
|
354
|
+
<input pInputText [(ngModel)]="value1" placeholder="Small" pSize="small" pInputMask="99-999999" />
|
|
355
|
+
<input pInputText [(ngModel)]="value2" placeholder="Normal" pInputMask="99-999999" />
|
|
356
|
+
<input pInputText [(ngModel)]="value3" placeholder="Large" pSize="large" pInputMask="99-999999" />
|
|
357
|
+
</div>
|
|
358
|
+
`,
|
|
359
|
+
standalone: true,
|
|
360
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
361
|
+
})
|
|
362
|
+
export class InputmaskSizesDemo {
|
|
363
|
+
value1: string | undefined;
|
|
364
|
+
value2: string | undefined;
|
|
365
|
+
value3: string | undefined;
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## SlotChar
|
|
370
|
+
|
|
371
|
+
Default placeholder for a mask is underscore that can be customized using slotChar property.
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
import { Component } from '@angular/core';
|
|
375
|
+
import { FormsModule } from '@angular/forms';
|
|
376
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
377
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
378
|
+
|
|
379
|
+
@Component({
|
|
380
|
+
template: `
|
|
381
|
+
<div class="card flex justify-center">
|
|
382
|
+
<input pInputText [(ngModel)]="value" pInputMask="99/99/9999" placeholder="99/99/9999" slotChar="mm/dd/yyyy" />
|
|
383
|
+
</div>
|
|
384
|
+
`,
|
|
385
|
+
standalone: true,
|
|
386
|
+
imports: [InputTextModule, InputMaskModule, FormsModule]
|
|
387
|
+
})
|
|
388
|
+
export class InputmaskSlotcharDemo {
|
|
389
|
+
value: string | undefined;
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## templatedrivenforms-doc
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
import { Component, inject } from '@angular/core';
|
|
397
|
+
import { FormsModule } from '@angular/forms';
|
|
398
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
399
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
400
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
401
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
402
|
+
import { InputMaskModule } from '@exhaustive-ui/core/inputmask';
|
|
403
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
404
|
+
|
|
405
|
+
@Component({
|
|
406
|
+
template: `
|
|
407
|
+
<p-toast />
|
|
408
|
+
<div class="card flex justify-center">
|
|
409
|
+
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex justify-center flex-col gap-4 md:w-56">
|
|
410
|
+
<div class="flex flex-col gap-1">
|
|
411
|
+
<input pInputText name="serial" pInputMask="99-999999" #serialNumber="ngModel" [(ngModel)]="value" placeholder="99-999999" [invalid]="serialNumber.invalid && (serialNumber.touched || exampleForm.submitted)" required fluid />
|
|
412
|
+
@if (serialNumber.invalid && (serialNumber.touched || exampleForm.submitted)) {
|
|
413
|
+
<p-message severity="error" size="small" variant="simple">Serial number is required.</p-message>
|
|
414
|
+
}
|
|
415
|
+
</div>
|
|
416
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
417
|
+
</form>
|
|
418
|
+
</div>
|
|
419
|
+
`,
|
|
420
|
+
standalone: true,
|
|
421
|
+
imports: [MessageModule, ToastModule, ButtonModule, InputTextModule, InputMaskModule, FormsModule]
|
|
422
|
+
})
|
|
423
|
+
export class InputmaskTemplatedrivenformsDemo {
|
|
424
|
+
messageService = inject(MessageService);
|
|
425
|
+
items: any[] = [];
|
|
426
|
+
value: any;
|
|
427
|
+
|
|
428
|
+
onSubmit(form: any) {
|
|
429
|
+
if (form.valid) {
|
|
430
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
431
|
+
form.resetForm();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## Input Mask
|
|
438
|
+
|
|
439
|
+
InputMask component is used to enter input in a certain format such as numeric, date, currency, email and phone.
|
|
440
|
+
|
|
441
|
+
### Props
|
|
442
|
+
|
|
443
|
+
| Name | Type | Default | Description |
|
|
444
|
+
|------|------|---------|-------------|
|
|
445
|
+
| dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
|
|
446
|
+
| unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
447
|
+
| pt | InputSignal<InputMaskPassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
448
|
+
| ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
|
|
449
|
+
| required | InputSignalWithTransform<boolean, unknown> | false | There must be a value (if set). |
|
|
450
|
+
| invalid | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have invalid state style. |
|
|
451
|
+
| disabled | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have disabled state style. |
|
|
452
|
+
| name | InputSignal<string> | undefined | When present, it specifies that the name of the input. |
|
|
453
|
+
| fluid | InputSignalWithTransform<boolean, unknown> | false | Spans 100% width of the container when enabled. |
|
|
454
|
+
| variant | InputSignal<"outlined" \| "filled"> | 'outlined' | Specifies the input variant of the component. |
|
|
455
|
+
| size | InputSignal<"small" \| "large"> | undefined | Specifies the size of the component. |
|
|
456
|
+
| inputSize | InputSignal<number> | undefined | Specifies the visible width of the input element in characters. |
|
|
457
|
+
| pattern | InputSignal<string> | undefined | Specifies the value must match the pattern. |
|
|
458
|
+
| min | InputSignal<number> | undefined | The value must be greater than or equal to the value. |
|
|
459
|
+
| max | InputSignal<number> | undefined | The value must be less than or equal to the value. |
|
|
460
|
+
| step | InputSignal<number> | undefined | Unless the step is set to the any literal, the value must be min + an integral multiple of the step. |
|
|
461
|
+
| minlength | InputSignal<number> | undefined | The number of characters (code points) must not be less than the value of the attribute, if non-empty. |
|
|
462
|
+
| maxlength | InputSignal<number> | undefined | The number of characters (code points) must not exceed the value of the attribute. |
|
|
463
|
+
| type | InputSignal<string> | ... | HTML5 input type. |
|
|
464
|
+
| slotChar | InputSignal<string> | ... | Placeholder character in mask, default is underscore. |
|
|
465
|
+
| autoClear | InputSignalWithTransform<boolean, unknown> | ... | Clears the incomplete value on blur. |
|
|
466
|
+
| showClear | InputSignalWithTransform<boolean, unknown> | ... | When enabled, a clear icon is displayed to clear the value. |
|
|
467
|
+
| style | InputSignal<{ [klass: string]: any }> | ... | Inline style of the input field. |
|
|
468
|
+
| inputId | InputSignal<string> | ... | Identifier of the focus input to match a label defined for the component. |
|
|
469
|
+
| styleClass | InputSignal<string> | ... | Style class of the input field. |
|
|
470
|
+
| placeholder | InputSignal<string> | ... | Advisory information to display on input. |
|
|
471
|
+
| tabindex | InputSignal<string> | ... | Specifies tab order of the element. |
|
|
472
|
+
| title | InputSignal<string> | ... | Title text of the input text. |
|
|
473
|
+
| ariaLabel | InputSignal<string> | ... | Used to define a string that labels the input element. |
|
|
474
|
+
| ariaLabelledBy | InputSignal<string> | ... | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
|
|
475
|
+
| ariaRequired | InputSignalWithTransform<boolean, unknown> | ... | Used to indicate that user input is required on an element before a form can be submitted. |
|
|
476
|
+
| readonly | InputSignalWithTransform<boolean, unknown> | ... | When present, it specifies that an input field is read-only. |
|
|
477
|
+
| unmask | InputSignalWithTransform<boolean, unknown> | ... | Defines if ngModel sets the raw unmasked value to bound value or the formatted mask value. |
|
|
478
|
+
| characterPattern | InputSignal<string> | ... | Regex pattern for alpha characters |
|
|
479
|
+
| autofocus | InputSignalWithTransform<boolean, unknown> | ... | When present, the input gets a focus automatically on load. |
|
|
480
|
+
| autocomplete | InputSignal<string> | ... | Used to define a string that autocomplete attribute the current element. |
|
|
481
|
+
| keepBuffer | InputSignalWithTransform<boolean, unknown> | ... | When present, it specifies that whether to clean buffer value from model. |
|
|
482
|
+
| mask | InputSignal<string> | ... | Mask pattern. |
|
|
483
|
+
|
|
484
|
+
### Emits
|
|
485
|
+
|
|
486
|
+
| Name | Parameters | Description |
|
|
487
|
+
|------|------------|-------------|
|
|
488
|
+
| onComplete | value: void | Callback to invoke when the mask is completed. |
|
|
489
|
+
| onFocus | event: Event | Callback to invoke when the component receives focus. |
|
|
490
|
+
| onBlur | event: Event | Callback to invoke when the component loses focus. |
|
|
491
|
+
| onInput | event: Event | Callback to invoke on input. |
|
|
492
|
+
| onKeydown | event: Event | Callback to invoke on input key press. |
|
|
493
|
+
| onClear | value: void | Callback to invoke when input field is cleared. |
|
|
494
|
+
|
|
495
|
+
### Templates
|
|
496
|
+
|
|
497
|
+
| Name | Type | Description |
|
|
498
|
+
|------|------|-------------|
|
|
499
|
+
| clearicon | TemplateRef<void> | Custom clear icon template. |
|
|
500
|
+
|
|
501
|
+
## Pass Through Options
|
|
502
|
+
|
|
503
|
+
| Name | Type | Description |
|
|
504
|
+
|------|------|-------------|
|
|
505
|
+
| host | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the host's DOM element. |
|
|
506
|
+
| root | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the root's DOM element. |
|
|
507
|
+
| pcInputText | InputTextPassThrough | Used to pass attributes to the InputText component. |
|
|
508
|
+
| clearIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the clear icon's DOM element. |
|
|
509
|
+
|
|
510
|
+
## Theming
|
|
511
|
+
|
|
512
|
+
### CSS Classes
|
|
513
|
+
|
|
514
|
+
| Class | Description |
|
|
515
|
+
|-------|-------------|
|
|
516
|
+
| p-inputmask | Class name of the root element |
|
|
517
|
+
| p-inputmask-clear-icon | Class name of the clear icon element |
|
|
518
|
+
|