ngx-lite-form 1.3.1 → 1.3.3
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 +177 -42
- package/fesm2022/ngx-lite-form.mjs +80 -27
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +41 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
# Lite Form
|
|
1
|
+
# Lite Form: A Lightweight and Powerful Angular Form Library
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
**Lite Form is a comprehensive, open-source library of 13+ standalone components for building modern, reactive forms in Angular (v20+). It provides lightweight, customizable, and fully-typed form controls—from basic inputs to advanced data tables and loading indicators—designed to accelerate development and improve user experience.**
|
|
4
|
+
|
|
5
|
+
This library is built for developers who need a robust, out-of-the-box solution for form-heavy applications without the overhead of heavy-weight dependencies. All components are standalone, tree-shakable, and integrate seamlessly with Angular's Reactive Forms module.
|
|
6
|
+
|
|
7
|
+
## Why Choose Lite Form?
|
|
8
|
+
|
|
9
|
+
- **🚀 Accelerate Development**: Get a complete suite of form controls ready to use, including complex components like date pickers, file uploads, and data tables. Drastically reduce boilerplate code.
|
|
10
|
+
- **💎 Lightweight & Performant**: Built with modern Angular practices. All components are standalone and tree-shakable, ensuring a minimal bundle size.
|
|
11
|
+
- **✅ Fully Typed & Integrated**: Enjoy excellent developer experience with fully-typed APIs for all components and Data Transfer Objects (DTOs), ensuring type safety and easier integration.
|
|
12
|
+
- **🎨 Highly Customizable**: While providing a clean default UI, the library is designed for easy styling. A clear SCSS structure and BEM-style classes allow for deep customization to match your brand.
|
|
13
|
+
- **🔒 Secure & Accessible**: Components are built with security and accessibility (ARIA) in mind, including advanced password strength analysis and accessible form field structures.
|
|
14
|
+
|
|
15
|
+
## Live Demo
|
|
16
|
+
|
|
17
|
+
Experience Lite Form in action with our interactive live demo on StackBlitz. Test out all the components and see how they work in a real Angular application.
|
|
18
|
+
|
|
19
|
+
[**🚀 Launch Live Demo on StackBlitz**](https://stackblitz.com/~/github.com/liangk/lite-form)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Use Cases
|
|
23
|
+
|
|
24
|
+
Lite Form is ideal for a wide range of applications, including but not limited to:
|
|
25
|
+
|
|
26
|
+
- **Enterprise Applications**: Build complex forms for data entry, configuration, and management with robust validation.
|
|
27
|
+
- **Dashboards and Admin Panels**: Quickly create settings pages, user management forms, and data tables.
|
|
28
|
+
- **Customer-Facing Websites**: Implement user-friendly registration, login, and profile forms.
|
|
29
|
+
- **E-commerce**: Develop streamlined checkout processes and product configuration forms.
|
|
30
|
+
- **Internal Tools**: Rapidly prototype and build internal tools for data collection and management.
|
|
5
31
|
|
|
6
32
|
## Features
|
|
7
33
|
- ✅ **Modern Angular 20+** - Built with standalone components, signals, and latest CLI tooling
|
|
@@ -14,6 +40,7 @@ Lite Form is a comprehensive Angular library that provides lightweight, customiz
|
|
|
14
40
|
- ✅ **Panels & Dialogs** - Template-driven modal panels with configurable action buttons
|
|
15
41
|
- ✅ **Data Tables** - Flexible table component with custom columns, sorting, and pagination
|
|
16
42
|
- ✅ **Pagination** - Standalone pagination component with customizable navigation
|
|
43
|
+
- ✅ **Loading Indicators** - Spinner and progress bar components with defined/indeterminate states
|
|
17
44
|
- ✅ **Customizable Styling** - Space-saving SCSS style guide for consistent overrides
|
|
18
45
|
- ✅ **Accessibility** - ARIA-compliant form controls
|
|
19
46
|
- ✅ **Animations** - Smooth transitions and interactions
|
|
@@ -59,6 +86,9 @@ Standalone pagination component with customizable page navigation, items per pag
|
|
|
59
86
|
### 🪟 LitePanel
|
|
60
87
|
Modal-style panel component that renders custom templates, configurable header text, and action buttons via `LitePanelAction` definitions. Supports custom `width`, `height`, `maxWidth`, and `maxHeight` inputs with automatic `px` suffix for numeric values.
|
|
61
88
|
|
|
89
|
+
### ⏳ LiteLoading
|
|
90
|
+
Loading indicator component with view toggle for spinner (loading wheel) or progress bar modes. Supports defined progress percentage (0-100) or indeterminate animation, optional message display, and configurable spinner sizes (small, medium, large).
|
|
91
|
+
|
|
62
92
|
---
|
|
63
93
|
|
|
64
94
|
## Installation
|
|
@@ -85,7 +115,8 @@ import {
|
|
|
85
115
|
LiteFile,
|
|
86
116
|
LiteTable,
|
|
87
117
|
LitePaginator,
|
|
88
|
-
LitePanel
|
|
118
|
+
LitePanel,
|
|
119
|
+
LiteLoading
|
|
89
120
|
} from 'ngx-lite-form';
|
|
90
121
|
import { FormControl, Validators } from '@angular/forms';
|
|
91
122
|
|
|
@@ -115,7 +146,8 @@ import {
|
|
|
115
146
|
LiteDateTime,
|
|
116
147
|
LiteFile,
|
|
117
148
|
LiteTable,
|
|
118
|
-
LitePaginator
|
|
149
|
+
LitePaginator,
|
|
150
|
+
LiteLoading
|
|
119
151
|
],
|
|
120
152
|
templateUrl: './app.component.html',
|
|
121
153
|
styleUrl: './app.component.scss'
|
|
@@ -282,6 +314,27 @@ export class AppComponent {
|
|
|
282
314
|
<p>Panel content can render any Angular template.</p>
|
|
283
315
|
<button type="button" (click)="close('acknowledged')">Acknowledge</button>
|
|
284
316
|
</ng-template>
|
|
317
|
+
|
|
318
|
+
<!-- Loading Indicators -->
|
|
319
|
+
<!-- Spinner (default) -->
|
|
320
|
+
<lite-loading [message]="'Loading data...'"></lite-loading>
|
|
321
|
+
|
|
322
|
+
<!-- Spinner with size -->
|
|
323
|
+
<lite-loading [size]="'large'" [message]="'Processing...'"></lite-loading>
|
|
324
|
+
|
|
325
|
+
<!-- Progress bar with defined percentage -->
|
|
326
|
+
<lite-loading
|
|
327
|
+
[view]="'progress'"
|
|
328
|
+
[progress]="75"
|
|
329
|
+
[message]="'Uploading files...'"></lite-loading>
|
|
330
|
+
|
|
331
|
+
<!-- Indeterminate progress bar -->
|
|
332
|
+
<lite-loading
|
|
333
|
+
[view]="'progress'"
|
|
334
|
+
[message]="'Processing your request...'"></lite-loading>
|
|
335
|
+
|
|
336
|
+
<!-- Controlled visibility -->
|
|
337
|
+
<lite-loading [visible]="isLoading" [message]="'Please wait...'"></lite-loading>
|
|
285
338
|
```
|
|
286
339
|
---
|
|
287
340
|
|
|
@@ -291,9 +344,10 @@ export class AppComponent {
|
|
|
291
344
|
|
|
292
345
|
**Selector:** `lite-input`
|
|
293
346
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
347
|
+
| Input | Type | Default | Description |
|
|
348
|
+
| :------- | :---------- | :------ | :---------------------------------------- |
|
|
349
|
+
| `control`| `FieldDto` | - | Field configuration and form control. |
|
|
350
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
297
351
|
|
|
298
352
|
**Example:**
|
|
299
353
|
```typescript
|
|
@@ -308,11 +362,12 @@ nameField = new FieldDto('Full Name', new FormControl('', [Validators.required])
|
|
|
308
362
|
|
|
309
363
|
**Selector:** `lite-password`
|
|
310
364
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
365
|
+
| Input | Type | Default | Description |
|
|
366
|
+
| :---------------------- | :-------- | :------ | :----------------------------------------------------- |
|
|
367
|
+
| `control` | `FieldDto`| - | Field configuration and form control. |
|
|
368
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
369
|
+
| `showToggle` | `boolean` | `true` | If `true`, shows the password visibility toggle button. |
|
|
370
|
+
| `showStrengthIndicator` | `boolean` | `false` | If `true`, shows the password strength analysis bar. |
|
|
316
371
|
|
|
317
372
|
**Features:**
|
|
318
373
|
- Password visibility toggle with eye/eye-off icons
|
|
@@ -355,9 +410,10 @@ const analysis = FormUtils.analyzePasswordStrength('MyStr0ng@Pass');
|
|
|
355
410
|
|
|
356
411
|
**Selector:** `lite-textarea`
|
|
357
412
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
413
|
+
| Input | Type | Default | Description |
|
|
414
|
+
| :-------- | :--------- | :------ | :------------------------------------------------------------ |
|
|
415
|
+
| `control` | `FieldDto` | - | Field configuration, including `rows` for initial height. |
|
|
416
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
361
417
|
|
|
362
418
|
**Example:**
|
|
363
419
|
```typescript
|
|
@@ -373,9 +429,10 @@ descriptionField = new FieldDto('Description', new FormControl(''), 4);
|
|
|
373
429
|
|
|
374
430
|
**Selector:** `lite-select`
|
|
375
431
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
432
|
+
| Input | Type | Default | Description |
|
|
433
|
+
| :-------- | :------------------ | :------ | :----------------------------------------------- |
|
|
434
|
+
| `control` | `SelectFieldDto<T>` | - | Field configuration, including `options`. |
|
|
435
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
379
436
|
|
|
380
437
|
**Example:**
|
|
381
438
|
```typescript
|
|
@@ -398,9 +455,10 @@ statusField = new SelectFieldDto(
|
|
|
398
455
|
|
|
399
456
|
**Selector:** `lite-multi-select`
|
|
400
457
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
458
|
+
| Input | Type | Default | Description |
|
|
459
|
+
| :-------- | :----------------------- | :------ | :----------------------------------------------- |
|
|
460
|
+
| `control` | `MultiSelectFieldDto<T>` | - | Field configuration, including `options`. |
|
|
461
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
404
462
|
|
|
405
463
|
**Features:**
|
|
406
464
|
- Inline selected items display
|
|
@@ -426,11 +484,12 @@ tagsField = new MultiSelectFieldDto(
|
|
|
426
484
|
|
|
427
485
|
**Selector:** `lite-date`
|
|
428
486
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
487
|
+
| Input | Type | Default | Description |
|
|
488
|
+
| :-------- | :---------------------------- | :------------- | :----------------------------------------------- |
|
|
489
|
+
| `control` | `FieldDto` or `DateRangeFieldDto` | - | Field configuration for single or range date. |
|
|
490
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
491
|
+
| `format` | `string` | `'dd/MM/yyyy'` | Date display format string. |
|
|
492
|
+
| `range` | `boolean` | `false` | If `true`, enables date range selection mode. |
|
|
434
493
|
|
|
435
494
|
**Features:**
|
|
436
495
|
- Single date and date range selection
|
|
@@ -483,9 +542,10 @@ eventDateField: DateRangeFieldDto = {
|
|
|
483
542
|
|
|
484
543
|
**Selector:** `lite-file`
|
|
485
544
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
545
|
+
| Input | Type | Default | Description |
|
|
546
|
+
| :-------- | :------------- | :------ | :----------------------------------------------- |
|
|
547
|
+
| `control` | `FileFieldDto` | - | Field configuration for file uploads. |
|
|
548
|
+
| `inEdit` | `boolean` | `true` | Toggles between edit and read-only mode. |
|
|
489
549
|
|
|
490
550
|
**Features:**
|
|
491
551
|
- File upload via button, drag & drop, or camera capture (on supported devices)
|
|
@@ -537,13 +597,15 @@ imageField = new FileFieldDto(
|
|
|
537
597
|
|
|
538
598
|
**Selector:** `lite-table`
|
|
539
599
|
|
|
540
|
-
|
|
541
|
-
|
|
600
|
+
| Input | Type | Default | Description |
|
|
601
|
+
| :------ | :------------------ | :------ | :----------------------------------------------- |
|
|
602
|
+
| `table` | `TableFieldDto<T>` | - | Table configuration including columns and data. |
|
|
542
603
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
604
|
+
| Output | Type | Description |
|
|
605
|
+
| :------------------- | :------------------------------- | :----------------------------------------------------- |
|
|
606
|
+
| `pageChange` | `number` | Emitted with the new page number on page change. |
|
|
607
|
+
| `itemsPerPageChange` | `number` | Emitted with the new items-per-page count. |
|
|
608
|
+
| `menuAction` | `{ action: string; row: T }` | Emitted when a row action is selected from a menu. |
|
|
547
609
|
|
|
548
610
|
**Features:**
|
|
549
611
|
- Flexbox-based responsive layout for modern table design
|
|
@@ -622,16 +684,89 @@ onRowMenuAction(event: { action: string; row: any }) {
|
|
|
622
684
|
<lite-table [table]="table" (menuAction)="onRowMenuAction($event)"></lite-table>
|
|
623
685
|
```
|
|
624
686
|
|
|
687
|
+
### LiteLoading Component
|
|
688
|
+
|
|
689
|
+
**Selector:** `lite-loading`
|
|
690
|
+
|
|
691
|
+
| Input | Type | Default | Description |
|
|
692
|
+
| :--------- | :------------------------------ | :---------- | :----------------------------------------------------------- |
|
|
693
|
+
| `view` | `'spinner' \| 'progress'` | `'spinner'` | The view type: spinner for loading wheel, progress for bar. |
|
|
694
|
+
| `progress` | `number \| undefined` | `undefined` | Progress percentage (0-100). Undefined shows indeterminate. |
|
|
695
|
+
| `message` | `string \| undefined` | `undefined` | Optional message to display below the indicator. |
|
|
696
|
+
| `size` | `'small' \| 'medium' \| 'large'`| `'medium'` | Size of the spinner (only applies to spinner view). |
|
|
697
|
+
| `visible` | `boolean` | `true` | Whether the loading indicator is visible. |
|
|
698
|
+
|
|
699
|
+
**Features:**
|
|
700
|
+
- View toggle between spinner (loading wheel) and progress bar
|
|
701
|
+
- Defined progress with percentage display (0-100%)
|
|
702
|
+
- Indeterminate progress with animated sliding bar
|
|
703
|
+
- Three spinner sizes: small, medium, large
|
|
704
|
+
- Optional message display below indicator
|
|
705
|
+
- Visibility control for conditional rendering
|
|
706
|
+
- Smooth animations and transitions
|
|
707
|
+
- Accessible with ARIA attributes
|
|
708
|
+
|
|
709
|
+
**Example:**
|
|
710
|
+
```typescript
|
|
711
|
+
// Component
|
|
712
|
+
import { signal } from '@angular/core';
|
|
713
|
+
|
|
714
|
+
isLoading = signal(true);
|
|
715
|
+
uploadProgress = signal(0);
|
|
716
|
+
|
|
717
|
+
// Simulate progress
|
|
718
|
+
startUpload() {
|
|
719
|
+
this.uploadProgress.set(0);
|
|
720
|
+
const interval = setInterval(() => {
|
|
721
|
+
const current = this.uploadProgress();
|
|
722
|
+
if (current >= 100) {
|
|
723
|
+
clearInterval(interval);
|
|
724
|
+
this.isLoading.set(false);
|
|
725
|
+
} else {
|
|
726
|
+
this.uploadProgress.set(current + 10);
|
|
727
|
+
}
|
|
728
|
+
}, 300);
|
|
729
|
+
}
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
```html
|
|
733
|
+
<!-- Basic spinner -->
|
|
734
|
+
<lite-loading></lite-loading>
|
|
735
|
+
|
|
736
|
+
<!-- Spinner with message and size -->
|
|
737
|
+
<lite-loading
|
|
738
|
+
[size]="'large'"
|
|
739
|
+
[message]="'Loading data...'"></lite-loading>
|
|
740
|
+
|
|
741
|
+
<!-- Defined progress bar -->
|
|
742
|
+
<lite-loading
|
|
743
|
+
[view]="'progress'"
|
|
744
|
+
[progress]="uploadProgress()"
|
|
745
|
+
[message]="'Uploading files...'"></lite-loading>
|
|
746
|
+
|
|
747
|
+
<!-- Indeterminate progress bar -->
|
|
748
|
+
<lite-loading
|
|
749
|
+
[view]="'progress'"
|
|
750
|
+
[message]="'Processing your request...'\"></lite-loading>
|
|
751
|
+
|
|
752
|
+
<!-- Controlled visibility -->
|
|
753
|
+
<lite-loading
|
|
754
|
+
[visible]="isLoading()"
|
|
755
|
+
[message]="'Please wait...'"></lite-loading>
|
|
756
|
+
```
|
|
757
|
+
|
|
625
758
|
### LitePaginator Component
|
|
626
759
|
|
|
627
760
|
**Selector:** `lite-paginator`
|
|
628
761
|
|
|
629
|
-
|
|
630
|
-
|
|
762
|
+
| Input | Type | Default | Description |
|
|
763
|
+
| :---------- | :------------------ | :------ | :----------------------------------------------- |
|
|
764
|
+
| `paginator` | `PaginatorFieldDto` | - | Paginator configuration object. |
|
|
631
765
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
766
|
+
| Output | Type | Description |
|
|
767
|
+
| :------------------- | :------- | :----------------------------------------------- |
|
|
768
|
+
| `pageChange` | `number` | Emitted with the new page number on page change. |
|
|
769
|
+
| `itemsPerPageChange` | `number` | Emitted with the new items-per-page count. |
|
|
635
770
|
|
|
636
771
|
**Features:**
|
|
637
772
|
- Previous/Next navigation buttons with disabled states
|
|
@@ -851,4 +986,4 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
|
851
986
|
---
|
|
852
987
|
|
|
853
988
|
## Changelog
|
|
854
|
-
- See [docs/CHANGELOG.md](https://github.com/liangk/lite-form/blob/main/docs/CHANGELOG.md) for the full historical record, including the latest `v1.3.
|
|
989
|
+
- See [docs/CHANGELOG.md](https://github.com/liangk/lite-form/blob/main/docs/CHANGELOG.md) for the full historical record, including the latest `v1.3.3` release adding the `LiteLoading` component with spinner and progress bar views.
|