ngx-lite-form 1.2.2-pr.28.20250923104029 → 1.2.2
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 +112 -139
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A modern, lightweight Angular form components library with TypeScript support, built-in validation, and responsive design.
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
## Features
|
|
6
7
|
|
|
7
8
|
- 🎯 **Input Component** - Text input with floating labels
|
|
@@ -10,14 +11,12 @@ A modern, lightweight Angular form components library with TypeScript support, b
|
|
|
10
11
|
- ☑️ **Multi-Select Component** - Multi-selection with inline display
|
|
11
12
|
- 🔘 **Radio Component** - Radio button groups for single selection
|
|
12
13
|
- ✅ **Checkbox Component** - Boolean input with validation support
|
|
13
|
-
- 📅 **Date Picker Component** - Advanced date selection with custom formatting
|
|
14
14
|
- 📎 **File Upload Component** - Drag & drop, camera capture, file management
|
|
15
|
-
-
|
|
16
|
-
-
|
|
15
|
+
- � **DateTime Picker Component** - Combined date & time selection
|
|
16
|
+
- �🔧 **TypeScript Support** - Fully typed with generics
|
|
17
17
|
- ✅ **Form Validation** - Integrated Angular Reactive Forms validation
|
|
18
18
|
- 🎨 **Customizable Styling** - SCSS-based theming system
|
|
19
19
|
- 📱 **Responsive Design** - Mobile-friendly components
|
|
20
|
-
- 🏗️ **Standalone Components** - Modern Angular architecture
|
|
21
20
|
|
|
22
21
|
## Installation
|
|
23
22
|
|
|
@@ -28,153 +27,136 @@ npm install ngx-lite-form
|
|
|
28
27
|
## Quick Usage
|
|
29
28
|
|
|
30
29
|
```typescript
|
|
31
|
-
import {
|
|
30
|
+
import { LiteFormModule } from 'ngx-lite-form';
|
|
32
31
|
import { FormControl, Validators } from '@angular/forms';
|
|
33
32
|
|
|
34
|
-
import { FieldDto, SelectFieldDto } from 'ngx-lite-form';
|
|
33
|
+
import { FieldDto, SelectFieldDto, MultiSelectFieldDto, RadioFieldDto, FileFieldDto } from 'ngx-lite-form';
|
|
35
34
|
|
|
36
35
|
@Component({
|
|
37
36
|
standalone: true,
|
|
38
|
-
imports: [
|
|
37
|
+
imports: [LiteFormModule],
|
|
39
38
|
template: `
|
|
40
39
|
<lite-input [control]="nameField"></lite-input>
|
|
41
|
-
<lite-
|
|
40
|
+
<lite-textarea [control]="descriptionField"></lite-textarea>
|
|
42
41
|
<lite-checkbox [control]="agreeField"></lite-checkbox>
|
|
42
|
+
<lite-select [control]="statusField"></lite-select>
|
|
43
|
+
<lite-multi-select [control]="skillsField"></lite-multi-select>
|
|
44
|
+
<lite-radio [control]="priorityField"></lite-radio>
|
|
45
|
+
<lite-file [control]="fileField"></lite-file>
|
|
46
|
+
<lite-datetime [control]="datetimeField"></lite-datetime>
|
|
43
47
|
`
|
|
44
48
|
})
|
|
45
49
|
export class MyFormComponent {
|
|
46
|
-
nameField = new FieldDto('Name', new FormControl(''
|
|
50
|
+
nameField = new FieldDto('Name', new FormControl(''));
|
|
51
|
+
descriptionField = new FieldDto('Description', new FormControl(''), 4);
|
|
47
52
|
agreeField = new FieldDto('I agree to terms', new FormControl<boolean>(false, { nonNullable: true }));
|
|
48
|
-
|
|
53
|
+
|
|
49
54
|
statusField = new SelectFieldDto(
|
|
50
55
|
'Status',
|
|
51
56
|
new FormControl(''),
|
|
52
57
|
['Active', 'Inactive'],
|
|
53
58
|
(option) => option
|
|
54
59
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
|
|
61
|
+
priorityField = new RadioFieldDto(
|
|
62
|
+
'Priority',
|
|
63
|
+
new FormControl('', [Validators.required]),
|
|
64
|
+
['Low', 'Medium', 'High'],
|
|
65
|
+
(option) => option
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
skillsField = new MultiSelectFieldDto(
|
|
69
|
+
'Skills',
|
|
70
|
+
new FormControl<string[]>([]),
|
|
71
|
+
['JavaScript', 'TypeScript', 'Angular'],
|
|
72
|
+
(option) => option
|
|
73
|
+
);
|
|
74
|
+
fileField = new FileFieldDto('Attachments', new FormControl([]), {
|
|
75
|
+
multiple: true,
|
|
76
|
+
accept: 'image/*,application/pdf',
|
|
77
|
+
maxFileSize: 5 * 1024 * 1024,
|
|
78
|
+
maxFiles: 5,
|
|
79
|
+
showPreview: true
|
|
80
|
+
});
|
|
81
|
+
datetimeField = new FieldDto('Event Date & Time', new FormControl(''));
|
|
82
|
+
### LiteDateTime
|
|
83
|
+
Date & time picker component for selecting both date and time, with custom formatting and time granularity.
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
**Features:**
|
|
86
|
+
- Combined date and time selection in a single popup
|
|
87
|
+
- Customizable date/time format (e.g., 'yyyy-MM-dd HH:mm')
|
|
88
|
+
- Keyboard and mouse navigation
|
|
89
|
+
- Time selection with hour and minute granularity
|
|
90
|
+
- Validation and error display
|
|
91
|
+
- Responsive and accessible
|
|
80
92
|
|
|
93
|
+
**Example:**
|
|
81
94
|
```typescript
|
|
82
|
-
import {
|
|
83
|
-
|
|
84
|
-
passwordField = new FieldDto('Password', new FormControl('', [
|
|
85
|
-
Validators.required,
|
|
86
|
-
Validators.minLength(8)
|
|
87
|
-
]));
|
|
95
|
+
import { FieldDto } from 'ngx-lite-form';
|
|
96
|
+
datetimeField = new FieldDto('Event Date & Time', new FormControl(''));
|
|
88
97
|
```
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Single-selection dropdown with search/filtering functionality.
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
import { LiteSelect, SelectFieldDto } from 'ngx-lite-form';
|
|
95
|
-
|
|
96
|
-
statusField = new SelectFieldDto(
|
|
97
|
-
'Status',
|
|
98
|
-
new FormControl(''),
|
|
99
|
-
['Active', 'Inactive', 'Pending'],
|
|
100
|
-
(option) => option
|
|
101
|
-
);
|
|
98
|
+
```html
|
|
99
|
+
<lite-datetime [control]="datetimeField" format="yyyy-MM-dd HH:mm"></lite-datetime>
|
|
102
100
|
```
|
|
101
|
+
}
|
|
102
|
+
### LiteFile
|
|
103
|
+
File upload component with drag & drop, badge, file management panel, and camera capture support.
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
**Features:**
|
|
106
|
+
- File upload via button, drag & drop, or camera capture (on supported devices)
|
|
107
|
+
- Badge shows file count
|
|
108
|
+
- File management panel with upload area and action buttons
|
|
109
|
+
- Camera capture on devices with a camera
|
|
110
|
+
- Validation: max files, max file size, file type restrictions
|
|
111
|
+
- Image preview for image files
|
|
112
|
+
- Progress tracking for uploads
|
|
113
|
+
- Accessibility: keyboard and screen reader friendly
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
107
116
|
```typescript
|
|
108
|
-
import {
|
|
109
|
-
|
|
110
|
-
skillsField = new MultiSelectFieldDto(
|
|
111
|
-
'Skills',
|
|
112
|
-
new FormControl<string[]>([]),
|
|
113
|
-
['JavaScript', 'TypeScript', 'Angular'],
|
|
114
|
-
(option) => option
|
|
115
|
-
);
|
|
117
|
+
import { FileFieldDto } from 'ngx-lite-form';
|
|
118
|
+
fileField = new FileFieldDto('Upload Files', new FormControl([]));
|
|
116
119
|
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Radio button group component for single selection from multiple options.
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
import { LiteRadio, RadioFieldDto } from 'ngx-lite-form';
|
|
123
|
-
|
|
124
|
-
priorityField = new RadioFieldDto(
|
|
125
|
-
'Priority',
|
|
126
|
-
new FormControl('', [Validators.required]),
|
|
127
|
-
['Low', 'Medium', 'High'],
|
|
128
|
-
(option) => option
|
|
129
|
-
);
|
|
120
|
+
```html
|
|
121
|
+
<lite-file [control]="fileField"></lite-file>
|
|
130
122
|
```
|
|
131
123
|
|
|
132
|
-
###
|
|
133
|
-
|
|
124
|
+
### FileFieldDto
|
|
125
|
+
File field configuration for the LiteFile component.
|
|
134
126
|
|
|
135
127
|
```typescript
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
class FileFieldDto {
|
|
129
|
+
label: string;
|
|
130
|
+
formControl: FormControl;
|
|
131
|
+
multiple?: boolean; // Allow multiple file selection (default: true)
|
|
132
|
+
accept?: string; // Accepted file types (default: '*/*')
|
|
133
|
+
maxFileSize?: number; // Maximum file size in bytes (default: 10MB)
|
|
134
|
+
maxFiles?: number; // Maximum number of files allowed (default: 10)
|
|
135
|
+
showPreview?: boolean; // Show image previews (default: true)
|
|
136
|
+
}
|
|
142
137
|
```
|
|
143
|
-
|
|
144
|
-
### LiteDate
|
|
145
|
-
Advanced date picker component with single date and date range selection, custom formatting, and intelligent calendar positioning.
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
import { LiteDate, FieldDto } from 'ngx-lite-form';
|
|
149
|
-
|
|
150
|
-
birthDateField = new FieldDto('Birth Date', new FormControl(''));
|
|
151
138
|
```
|
|
152
139
|
|
|
153
|
-
|
|
154
|
-
Date & time picker component for selecting both date and time, with custom formatting and time granularity.
|
|
140
|
+
## Components
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
### LiteInput
|
|
143
|
+
Basic text input with floating label animation and validation display.
|
|
158
144
|
|
|
159
|
-
|
|
160
|
-
|
|
145
|
+
### LiteTextarea
|
|
146
|
+
Multi-line text input that supports configurable rows.
|
|
161
147
|
|
|
162
|
-
###
|
|
163
|
-
|
|
148
|
+
### LiteSelect
|
|
149
|
+
Single-selection dropdown with:
|
|
150
|
+
- Search/filtering functionality
|
|
151
|
+
- Custom display formatting
|
|
152
|
+
- Keyboard navigation
|
|
164
153
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
true, // multiple
|
|
172
|
-
'image/*,application/pdf', // accept
|
|
173
|
-
5 * 1024 * 1024, // maxFileSize (5MB)
|
|
174
|
-
5, // maxFiles
|
|
175
|
-
true // showPreview
|
|
176
|
-
);
|
|
177
|
-
```
|
|
154
|
+
### LiteMultiSelect
|
|
155
|
+
Multi-selection dropdown with:
|
|
156
|
+
- Inline selected items display
|
|
157
|
+
- Dynamic height adjustment
|
|
158
|
+
- Individual item removal
|
|
159
|
+
- Filtering capabilities
|
|
178
160
|
|
|
179
161
|
## Data Transfer Objects
|
|
180
162
|
|
|
@@ -207,29 +189,6 @@ class MultiSelectFieldDto<T> {
|
|
|
207
189
|
}
|
|
208
190
|
```
|
|
209
191
|
|
|
210
|
-
### RadioFieldDto<T>
|
|
211
|
-
```typescript
|
|
212
|
-
class RadioFieldDto<T> {
|
|
213
|
-
label: string;
|
|
214
|
-
formControl: FormControl<T>;
|
|
215
|
-
options: T[];
|
|
216
|
-
displayWith: (option: T) => string;
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### FileFieldDto
|
|
221
|
-
```typescript
|
|
222
|
-
class FileFieldDto {
|
|
223
|
-
label: string;
|
|
224
|
-
formControl: FormControl;
|
|
225
|
-
multiple?: boolean;
|
|
226
|
-
accept?: string;
|
|
227
|
-
maxFileSize?: number;
|
|
228
|
-
maxFiles?: number;
|
|
229
|
-
showPreview?: boolean;
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
192
|
## Validation
|
|
234
193
|
|
|
235
194
|
All components support Angular Reactive Forms validators:
|
|
@@ -261,7 +220,7 @@ The library includes comprehensive SCSS styling. To customize:
|
|
|
261
220
|
|
|
262
221
|
### Building the Library
|
|
263
222
|
```bash
|
|
264
|
-
ng build lite-form
|
|
223
|
+
ng build ngx-lite-form
|
|
265
224
|
```
|
|
266
225
|
|
|
267
226
|
### Publishing
|
|
@@ -272,7 +231,7 @@ npm publish
|
|
|
272
231
|
|
|
273
232
|
### Running Tests
|
|
274
233
|
```bash
|
|
275
|
-
ng test
|
|
234
|
+
ng test ngx-lite-form
|
|
276
235
|
```
|
|
277
236
|
|
|
278
237
|
## Browser Support
|
|
@@ -288,3 +247,17 @@ MIT License
|
|
|
288
247
|
---
|
|
289
248
|
|
|
290
249
|
For complete documentation and examples, visit the [main repository](https://github.com/liangk/lite-form).
|
|
250
|
+
|
|
251
|
+
## Running end-to-end tests
|
|
252
|
+
|
|
253
|
+
For end-to-end (e2e) testing, run:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
ng e2e
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
260
|
+
|
|
261
|
+
## Additional Resources
|
|
262
|
+
|
|
263
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-lite-form",
|
|
3
|
-
"version": "1.2.2
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "A lightweight Angular form library with reusable input, textarea, select, multi-select, radio, checkbox, date picker and password components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|