ngx-lite-form 1.3.2 → 1.3.4
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 +278 -37
- package/fesm2022/ngx-lite-form.mjs +91 -4
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +52 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
# Lite Form: A Lightweight and Powerful Angular Form Library
|
|
2
2
|
|
|
3
|
-
**Lite Form is a comprehensive, open-source library of
|
|
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
4
|
|
|
5
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
6
|
|
|
7
7
|
## Why Choose Lite Form?
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
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
14
|
|
|
15
15
|
## Live Demo
|
|
16
16
|
|
|
17
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
18
|
|
|
19
|
-
[
|
|
19
|
+
[**Launch Live Demo on StackBlitz**](https://stackblitz.com/~/github.com/liangk/lite-form)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
## Use Cases
|
|
@@ -30,60 +30,64 @@ Lite Form is ideal for a wide range of applications, including but not limited t
|
|
|
30
30
|
- **Internal Tools**: Rapidly prototype and build internal tools for data collection and management.
|
|
31
31
|
|
|
32
32
|
## Features
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
33
|
+
- **Modern Angular 20+** - Built with standalone components, signals, and latest CLI tooling
|
|
34
|
+
- **TypeScript Support** - Fully typed with generic support and DTO helpers
|
|
35
|
+
- **Reactive Forms** - Integrated with Angular Reactive Forms
|
|
36
|
+
- **Built-in Validation** - Form validation with error messages and utilities
|
|
37
|
+
- **Password Security** - Advanced password validation and strength analysis
|
|
38
|
+
- **Date Handling** - Single date and date range selection with custom formatting
|
|
39
|
+
- **File Upload** - Drag & drop file upload with camera capture and file management
|
|
40
|
+
- **Panels & Dialogs** - Modal panels supporting string, template, or component content with configurable action buttons
|
|
41
|
+
- **Data Tables** - Flexible table component with custom columns, sorting, and pagination
|
|
42
|
+
- **Pagination** - Standalone pagination component with customizable navigation
|
|
43
|
+
- **Loading Indicators** - Spinner and progress bar components with defined/indeterminate states
|
|
44
|
+
- **Customizable Styling** - Space-saving SCSS style guide for consistent overrides
|
|
45
|
+
- **Accessibility** - ARIA-compliant form controls
|
|
46
|
+
- **Animations** - Smooth transitions and interactions
|
|
46
47
|
|
|
47
48
|
## Components
|
|
48
49
|
|
|
49
|
-
###
|
|
50
|
+
### LiteInput
|
|
50
51
|
Basic text input component with floating labels and validation.
|
|
51
52
|
|
|
52
|
-
###
|
|
53
|
+
### LitePassword
|
|
53
54
|
Password input component with toggle visibility, strength indicator, and advanced validation features.
|
|
54
55
|
|
|
55
|
-
###
|
|
56
|
+
### LiteTextarea
|
|
56
57
|
Multi-line text input with auto-resize capabilities.
|
|
57
58
|
|
|
58
|
-
###
|
|
59
|
+
### LiteSelect
|
|
59
60
|
Single-selection dropdown with search and filtering.
|
|
60
61
|
|
|
61
|
-
###
|
|
62
|
+
### LiteMultiSelect
|
|
62
63
|
Multi-selection dropdown with inline selected items display and dynamic height adjustment.
|
|
63
64
|
|
|
64
|
-
###
|
|
65
|
+
### LiteRadio
|
|
65
66
|
Radio button group component for single selection from multiple options.
|
|
66
67
|
|
|
67
|
-
###
|
|
68
|
+
### LiteCheckbox
|
|
68
69
|
Checkbox component for boolean input with validation support.
|
|
69
70
|
|
|
70
|
-
###
|
|
71
|
+
### LiteDate
|
|
71
72
|
Advanced date picker component with single date and date range selection, custom formatting, and intelligent calendar positioning.
|
|
72
73
|
|
|
73
|
-
###
|
|
74
|
+
### LiteFile
|
|
74
75
|
File upload component with drag & drop, badge, file management panel, and camera capture support.
|
|
75
76
|
|
|
76
|
-
###
|
|
77
|
+
### LiteDateTime
|
|
77
78
|
Date and time picker with timezone-safe handling and consistent formatting utilities.
|
|
78
79
|
|
|
79
|
-
###
|
|
80
|
+
### LiteTable
|
|
80
81
|
Flexible data table component with custom columns, cell templates, nested property access, and integrated pagination.
|
|
81
82
|
|
|
82
|
-
###
|
|
83
|
+
### LitePaginator
|
|
83
84
|
Standalone pagination component with customizable page navigation, items per page selection, and total item display.
|
|
84
85
|
|
|
85
|
-
###
|
|
86
|
-
Modal-style panel component that renders
|
|
86
|
+
### LitePanel
|
|
87
|
+
Modal-style panel component that renders string content, Angular templates, or dynamic components. Supports configurable header text and action buttons via `LitePanelAction` definitions. Accepts custom `width`, `height`, `maxWidth`, and `maxHeight` inputs with automatic `px` suffix for numeric values.
|
|
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).
|
|
87
91
|
|
|
88
92
|
---
|
|
89
93
|
|
|
@@ -111,7 +115,8 @@ import {
|
|
|
111
115
|
LiteFile,
|
|
112
116
|
LiteTable,
|
|
113
117
|
LitePaginator,
|
|
114
|
-
LitePanel
|
|
118
|
+
LitePanel,
|
|
119
|
+
LiteLoading
|
|
115
120
|
} from 'ngx-lite-form';
|
|
116
121
|
import { FormControl, Validators } from '@angular/forms';
|
|
117
122
|
|
|
@@ -141,7 +146,8 @@ import {
|
|
|
141
146
|
LiteDateTime,
|
|
142
147
|
LiteFile,
|
|
143
148
|
LiteTable,
|
|
144
|
-
LitePaginator
|
|
149
|
+
LitePaginator,
|
|
150
|
+
LiteLoading
|
|
145
151
|
],
|
|
146
152
|
templateUrl: './app.component.html',
|
|
147
153
|
styleUrl: './app.component.scss'
|
|
@@ -308,6 +314,27 @@ export class AppComponent {
|
|
|
308
314
|
<p>Panel content can render any Angular template.</p>
|
|
309
315
|
<button type="button" (click)="close('acknowledged')">Acknowledge</button>
|
|
310
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>
|
|
311
338
|
```
|
|
312
339
|
---
|
|
313
340
|
|
|
@@ -657,6 +684,220 @@ onRowMenuAction(event: { action: string; row: any }) {
|
|
|
657
684
|
<lite-table [table]="table" (menuAction)="onRowMenuAction($event)"></lite-table>
|
|
658
685
|
```
|
|
659
686
|
|
|
687
|
+
### LitePanel Component
|
|
688
|
+
|
|
689
|
+
**Selector:** `lite-panel`
|
|
690
|
+
|
|
691
|
+
| Input | Type | Default | Description |
|
|
692
|
+
| :---- | :--- | :------ | :---------- |
|
|
693
|
+
| `title` | `string \| null` | `null` | Panel header title text |
|
|
694
|
+
| `content` | `string \| TemplateRef \| Type<any> \| null` | `null` | Content to display: string, template, or component |
|
|
695
|
+
| `contentInputs` | `Record<string, any> \| null` | `null` | Inputs to pass to dynamic component content |
|
|
696
|
+
| `actions` | `LitePanelAction[] \| null` | `null` | Action buttons (defaults to single OK button) |
|
|
697
|
+
| `closeOnOverlayClick` | `boolean` | `true` | Whether clicking backdrop closes the panel |
|
|
698
|
+
| `width` | `string \| number \| null` | `null` | Panel width (numeric values get px suffix) |
|
|
699
|
+
| `height` | `string \| number \| null` | `null` | Panel height (numeric values get px suffix) |
|
|
700
|
+
| `maxWidth` | `string \| number \| null` | `null` | Maximum panel width |
|
|
701
|
+
| `maxHeight` | `string \| number \| null` | `null` | Maximum panel height |
|
|
702
|
+
|
|
703
|
+
| Output | Type | Description |
|
|
704
|
+
| :----- | :--- | :---------- |
|
|
705
|
+
| `closed` | `unknown \| null` | Emitted when panel closes with action value or null |
|
|
706
|
+
|
|
707
|
+
**Features:**
|
|
708
|
+
- Three content types: string, Angular template, or dynamic component
|
|
709
|
+
- Configurable action buttons with variants (primary, secondary, danger)
|
|
710
|
+
- Customizable dimensions with automatic px suffix for numbers
|
|
711
|
+
- Backdrop click to close (configurable)
|
|
712
|
+
- Close button in header
|
|
713
|
+
- Component content with input binding support
|
|
714
|
+
- Accessible with ARIA attributes
|
|
715
|
+
|
|
716
|
+
**String Content Example:**
|
|
717
|
+
```typescript
|
|
718
|
+
panelOpen = signal(false);
|
|
719
|
+
|
|
720
|
+
openPanel() {
|
|
721
|
+
this.panelOpen.set(true);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
onPanelClosed(result: unknown | null) {
|
|
725
|
+
this.panelOpen.set(false);
|
|
726
|
+
}
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
```html
|
|
730
|
+
@if (panelOpen()) {
|
|
731
|
+
<lite-panel
|
|
732
|
+
[title]="'Information'"
|
|
733
|
+
[content]="'This is simple text content.'"
|
|
734
|
+
(closed)="onPanelClosed($event)">
|
|
735
|
+
</lite-panel>
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
**Template Content Example:**
|
|
740
|
+
```typescript
|
|
741
|
+
panelActions: LitePanelAction[] = [
|
|
742
|
+
{ label: 'Confirm', value: 'confirm', variant: 'primary' },
|
|
743
|
+
{ label: 'Cancel', value: null, variant: 'secondary' }
|
|
744
|
+
];
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
```html
|
|
748
|
+
@if (panelOpen()) {
|
|
749
|
+
<lite-panel
|
|
750
|
+
[title]="'Confirmation'"
|
|
751
|
+
[content]="confirmTemplate"
|
|
752
|
+
[actions]="panelActions"
|
|
753
|
+
width="500px"
|
|
754
|
+
(closed)="onPanelClosed($event)">
|
|
755
|
+
</lite-panel>
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
<ng-template #confirmTemplate let-close="close">
|
|
759
|
+
<p>Are you sure you want to proceed?</p>
|
|
760
|
+
<button (click)="close('custom-value')">Custom Action</button>
|
|
761
|
+
</ng-template>
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
**Component Content Example:**
|
|
765
|
+
```typescript
|
|
766
|
+
import { Component, Type } from '@angular/core';
|
|
767
|
+
import { FormControl, Validators } from '@angular/forms';
|
|
768
|
+
import { LiteInput, FieldDto } from 'ngx-lite-form';
|
|
769
|
+
|
|
770
|
+
// Create a standalone component for panel content
|
|
771
|
+
@Component({
|
|
772
|
+
selector: 'user-form',
|
|
773
|
+
standalone: true,
|
|
774
|
+
imports: [LiteInput],
|
|
775
|
+
template: `
|
|
776
|
+
<div class="form-content">
|
|
777
|
+
<p>Fill out the form below:</p>
|
|
778
|
+
<lite-input [control]="nameField"></lite-input>
|
|
779
|
+
<lite-input [control]="emailField"></lite-input>
|
|
780
|
+
</div>
|
|
781
|
+
`
|
|
782
|
+
})
|
|
783
|
+
export class UserFormComponent {
|
|
784
|
+
nameField = new FieldDto('Name', new FormControl('', [Validators.required]));
|
|
785
|
+
emailField = new FieldDto('Email', new FormControl('', [Validators.required, Validators.email]));
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// In your main component
|
|
789
|
+
userFormComponent: Type<any> = UserFormComponent;
|
|
790
|
+
panelActions: LitePanelAction[] = [
|
|
791
|
+
{ label: 'Submit', value: 'submit', variant: 'primary' },
|
|
792
|
+
{ label: 'Cancel', value: null, variant: 'secondary' }
|
|
793
|
+
];
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
```html
|
|
797
|
+
@if (panelOpen()) {
|
|
798
|
+
<lite-panel
|
|
799
|
+
[title]="'User Registration'"
|
|
800
|
+
[content]="userFormComponent"
|
|
801
|
+
[actions]="panelActions"
|
|
802
|
+
width="600px"
|
|
803
|
+
maxHeight="80vh"
|
|
804
|
+
(closed)="onPanelClosed($event)">
|
|
805
|
+
</lite-panel>
|
|
806
|
+
}
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
**Passing Inputs to Component Content:**
|
|
810
|
+
```typescript
|
|
811
|
+
// Component with inputs
|
|
812
|
+
@Component({...})
|
|
813
|
+
export class DataViewComponent {
|
|
814
|
+
@Input() userId!: number;
|
|
815
|
+
@Input() mode!: string;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Usage
|
|
819
|
+
componentInputs = { userId: 123, mode: 'edit' };
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
```html
|
|
823
|
+
<lite-panel
|
|
824
|
+
[content]="dataViewComponent"
|
|
825
|
+
[contentInputs]="componentInputs"
|
|
826
|
+
(closed)="onPanelClosed($event)">
|
|
827
|
+
</lite-panel>
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
### LiteLoading Component
|
|
831
|
+
|
|
832
|
+
**Selector:** `lite-loading`
|
|
833
|
+
|
|
834
|
+
| Input | Type | Default | Description |
|
|
835
|
+
| :--------- | :------------------------------ | :---------- | :----------------------------------------------------------- |
|
|
836
|
+
| `view` | `'spinner' \| 'progress'` | `'spinner'` | The view type: spinner for loading wheel, progress for bar. |
|
|
837
|
+
| `progress` | `number \| undefined` | `undefined` | Progress percentage (0-100). Undefined shows indeterminate. |
|
|
838
|
+
| `message` | `string \| undefined` | `undefined` | Optional message to display below the indicator. |
|
|
839
|
+
| `size` | `'small' \| 'medium' \| 'large'`| `'medium'` | Size of the spinner (only applies to spinner view). |
|
|
840
|
+
| `visible` | `boolean` | `true` | Whether the loading indicator is visible. |
|
|
841
|
+
|
|
842
|
+
**Features:**
|
|
843
|
+
- View toggle between spinner (loading wheel) and progress bar
|
|
844
|
+
- Defined progress with percentage display (0-100%)
|
|
845
|
+
- Indeterminate progress with animated sliding bar
|
|
846
|
+
- Three spinner sizes: small, medium, large
|
|
847
|
+
- Optional message display below indicator
|
|
848
|
+
- Visibility control for conditional rendering
|
|
849
|
+
- Smooth animations and transitions
|
|
850
|
+
- Accessible with ARIA attributes
|
|
851
|
+
|
|
852
|
+
**Example:**
|
|
853
|
+
```typescript
|
|
854
|
+
// Component
|
|
855
|
+
import { signal } from '@angular/core';
|
|
856
|
+
|
|
857
|
+
isLoading = signal(true);
|
|
858
|
+
uploadProgress = signal(0);
|
|
859
|
+
|
|
860
|
+
// Simulate progress
|
|
861
|
+
startUpload() {
|
|
862
|
+
this.uploadProgress.set(0);
|
|
863
|
+
const interval = setInterval(() => {
|
|
864
|
+
const current = this.uploadProgress();
|
|
865
|
+
if (current >= 100) {
|
|
866
|
+
clearInterval(interval);
|
|
867
|
+
this.isLoading.set(false);
|
|
868
|
+
} else {
|
|
869
|
+
this.uploadProgress.set(current + 10);
|
|
870
|
+
}
|
|
871
|
+
}, 300);
|
|
872
|
+
}
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
```html
|
|
876
|
+
<!-- Basic spinner -->
|
|
877
|
+
<lite-loading></lite-loading>
|
|
878
|
+
|
|
879
|
+
<!-- Spinner with message and size -->
|
|
880
|
+
<lite-loading
|
|
881
|
+
[size]="'large'"
|
|
882
|
+
[message]="'Loading data...'"></lite-loading>
|
|
883
|
+
|
|
884
|
+
<!-- Defined progress bar -->
|
|
885
|
+
<lite-loading
|
|
886
|
+
[view]="'progress'"
|
|
887
|
+
[progress]="uploadProgress()"
|
|
888
|
+
[message]="'Uploading files...'"></lite-loading>
|
|
889
|
+
|
|
890
|
+
<!-- Indeterminate progress bar -->
|
|
891
|
+
<lite-loading
|
|
892
|
+
[view]="'progress'"
|
|
893
|
+
[message]="'Processing your request...'\"></lite-loading>
|
|
894
|
+
|
|
895
|
+
<!-- Controlled visibility -->
|
|
896
|
+
<lite-loading
|
|
897
|
+
[visible]="isLoading()"
|
|
898
|
+
[message]="'Please wait...'"></lite-loading>
|
|
899
|
+
```
|
|
900
|
+
|
|
660
901
|
### LitePaginator Component
|
|
661
902
|
|
|
662
903
|
**Selector:** `lite-paginator`
|
|
@@ -888,4 +1129,4 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
|
888
1129
|
---
|
|
889
1130
|
|
|
890
1131
|
## Changelog
|
|
891
|
-
- 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.
|
|
1132
|
+
- 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.
|