ngx-lite-form 1.1.7-pr.15.20250819053240

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 ADDED
@@ -0,0 +1,263 @@
1
+ # LiteForm Angular Library
2
+
3
+ A modern, lightweight Angular form components library with TypeScript support, built-in validation, and responsive design.
4
+
5
+
6
+ ## Features
7
+
8
+ - 🎯 **Input Component** - Text input with floating labels
9
+ - 📝 **Textarea Component** - Multi-line text input
10
+ - 📋 **Select Component** - Single-selection dropdown with filtering
11
+ - ☑️ **Multi-Select Component** - Multi-selection with inline display
12
+ - 🔘 **Radio Component** - Radio button groups for single selection
13
+ - ✅ **Checkbox Component** - Boolean input with validation support
14
+ - 📎 **File Upload Component** - Drag & drop, camera capture, file management
15
+ - � **DateTime Picker Component** - Combined date & time selection
16
+ - �🔧 **TypeScript Support** - Fully typed with generics
17
+ - ✅ **Form Validation** - Integrated Angular Reactive Forms validation
18
+ - 🎨 **Customizable Styling** - SCSS-based theming system
19
+ - 📱 **Responsive Design** - Mobile-friendly components
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install lite-form
25
+ ```
26
+
27
+ ## Quick Usage
28
+
29
+ ```typescript
30
+ import { LiteFormModule } from 'lite-form';
31
+ import { FormControl, Validators } from '@angular/forms';
32
+
33
+ import { FieldDto, SelectFieldDto, MultiSelectFieldDto, RadioFieldDto, FileFieldDto } from 'lite-form';
34
+
35
+ @Component({
36
+ standalone: true,
37
+ imports: [LiteFormModule],
38
+ template: `
39
+ <lite-input [control]="nameField"></lite-input>
40
+ <lite-textarea [control]="descriptionField"></lite-textarea>
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>
47
+ `
48
+ })
49
+ export class MyFormComponent {
50
+ nameField = new FieldDto('Name', new FormControl(''));
51
+ descriptionField = new FieldDto('Description', new FormControl(''), 4);
52
+ agreeField = new FieldDto('I agree to terms', new FormControl<boolean>(false, { nonNullable: true }));
53
+
54
+ statusField = new SelectFieldDto(
55
+ 'Status',
56
+ new FormControl(''),
57
+ ['Active', 'Inactive'],
58
+ (option) => option
59
+ );
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.
84
+
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
92
+
93
+ **Example:**
94
+ ```typescript
95
+ import { FieldDto } from 'lite-form';
96
+ datetimeField = new FieldDto('Event Date & Time', new FormControl(''));
97
+ ```
98
+ ```html
99
+ <lite-datetime [control]="datetimeField" format="yyyy-MM-dd HH:mm"></lite-datetime>
100
+ ```
101
+ }
102
+ ### LiteFile
103
+ File upload component with drag & drop, badge, file management panel, and camera capture support.
104
+
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:**
116
+ ```typescript
117
+ import { FileFieldDto } from 'lite-form';
118
+ fileField = new FileFieldDto('Upload Files', new FormControl([]));
119
+ ```
120
+ ```html
121
+ <lite-file [control]="fileField"></lite-file>
122
+ ```
123
+
124
+ ### FileFieldDto
125
+ File field configuration for the LiteFile component.
126
+
127
+ ```typescript
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
+ }
137
+ ```
138
+ ```
139
+
140
+ ## Components
141
+
142
+ ### LiteInput
143
+ Basic text input with floating label animation and validation display.
144
+
145
+ ### LiteTextarea
146
+ Multi-line text input that supports configurable rows.
147
+
148
+ ### LiteSelect
149
+ Single-selection dropdown with:
150
+ - Search/filtering functionality
151
+ - Custom display formatting
152
+ - Keyboard navigation
153
+
154
+ ### LiteMultiSelect
155
+ Multi-selection dropdown with:
156
+ - Inline selected items display
157
+ - Dynamic height adjustment
158
+ - Individual item removal
159
+ - Filtering capabilities
160
+
161
+ ## Data Transfer Objects
162
+
163
+ ### FieldDto
164
+ ```typescript
165
+ class FieldDto {
166
+ label: string;
167
+ formControl: FormControl;
168
+ rows?: number; // For textarea
169
+ }
170
+ ```
171
+
172
+ ### SelectFieldDto<T>
173
+ ```typescript
174
+ class SelectFieldDto<T> {
175
+ label: string;
176
+ formControl: FormControl<T>;
177
+ options: T[];
178
+ displayWith: (option: T) => string;
179
+ }
180
+ ```
181
+
182
+ ### MultiSelectFieldDto<T>
183
+ ```typescript
184
+ class MultiSelectFieldDto<T> {
185
+ label: string;
186
+ formControl: FormControl<T[]>;
187
+ options: T[];
188
+ displayWith: (option: T) => string;
189
+ }
190
+ ```
191
+
192
+ ## Validation
193
+
194
+ All components support Angular Reactive Forms validators:
195
+
196
+ ```typescript
197
+ import { Validators } from '@angular/forms';
198
+
199
+ const emailField = new FieldDto(
200
+ 'Email',
201
+ new FormControl('', [Validators.required, Validators.email])
202
+ );
203
+ ```
204
+
205
+ Error messages are automatically displayed below invalid fields.
206
+
207
+ ## Styling
208
+
209
+ The library includes comprehensive SCSS styling. To customize:
210
+
211
+ ```scss
212
+ // Override default styles
213
+ .lite-input.in-edit input:focus {
214
+ border-color: #your-brand-color;
215
+ box-shadow: 0 0 5px rgba(your-brand-color, 0.5);
216
+ }
217
+ ```
218
+
219
+ ## Development
220
+
221
+ ### Building the Library
222
+ ```bash
223
+ ng build lite-form
224
+ ```
225
+
226
+ ### Publishing
227
+ ```bash
228
+ cd dist/lite-form
229
+ npm publish
230
+ ```
231
+
232
+ ### Running Tests
233
+ ```bash
234
+ ng test lite-form
235
+ ```
236
+
237
+ ## Browser Support
238
+ - Angular 17+
239
+ - Chrome 90+
240
+ - Firefox 88+
241
+ - Safari 14+
242
+ - Edge 90+
243
+
244
+ ## License
245
+ MIT License
246
+
247
+ ---
248
+
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.