ngx-lite-form 1.3.7 → 1.3.9
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 +47 -664
- package/fesm2022/ngx-lite-form.mjs +108 -4
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,47 +47,28 @@ Lite Form is ideal for a wide range of applications, including but not limited t
|
|
|
47
47
|
|
|
48
48
|
## Components
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Password input
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Multi-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
###
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Advanced date picker component with single date and date range selection, custom formatting, and intelligent calendar positioning.
|
|
73
|
-
|
|
74
|
-
### LiteFile
|
|
75
|
-
File upload component with drag & drop, badge, file management panel, and camera capture support.
|
|
76
|
-
|
|
77
|
-
### LiteDateTime
|
|
78
|
-
Date and time picker with timezone-safe handling and consistent formatting utilities.
|
|
79
|
-
|
|
80
|
-
### LiteTable
|
|
81
|
-
Flexible data table component with custom columns, cell templates, nested property access, and integrated pagination.
|
|
82
|
-
|
|
83
|
-
### LitePaginator
|
|
84
|
-
Standalone pagination component with customizable page navigation, items per page selection, and total item display.
|
|
85
|
-
|
|
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).
|
|
50
|
+
Lite Form provides 15+ form and UI components. Click on any component below for detailed documentation:
|
|
51
|
+
|
|
52
|
+
### Form Controls
|
|
53
|
+
- **[LiteInput](docs/lite-input.md)** - Text input with floating labels and validation
|
|
54
|
+
- **[LitePassword](docs/lite-password.md)** - Password input with visibility toggle and strength analysis
|
|
55
|
+
- **[LiteTextarea](docs/lite-textarea.md)** - Multi-line text input with auto-resize
|
|
56
|
+
- **[LiteSelect](docs/lite-select.md)** - Single-selection dropdown with search
|
|
57
|
+
- **[LiteMultiSelect](docs/lite-multi-select.md)** - Multi-selection dropdown with inline display
|
|
58
|
+
- **[LiteRadio](docs/lite-radio.md)** - Radio button group for single selection
|
|
59
|
+
- **[LiteCheckbox](docs/lite-checkbox.md)** - Checkbox for boolean input
|
|
60
|
+
- **[LiteDate](docs/lite-date.md)** - Date picker with single/range selection
|
|
61
|
+
- **[LiteDateTime](docs/lite-datetime.md)** - Combined date and time picker
|
|
62
|
+
- **[LiteFile](docs/lite-file.md)** - File upload with drag & drop and camera capture
|
|
63
|
+
|
|
64
|
+
### Data Display & Navigation
|
|
65
|
+
- **[LiteTable](docs/lite-table.md)** - Flexible data table with pagination and row actions
|
|
66
|
+
- **[LitePaginator](docs/lite-paginator.md)** - Standalone pagination component
|
|
67
|
+
|
|
68
|
+
### UI Components
|
|
69
|
+
- **[LitePanel](docs/lite-panel.md)** - Modal panel for dialogs and forms
|
|
70
|
+
- **[LiteLoading](docs/lite-loading.md)** - Loading spinner and progress bar
|
|
71
|
+
- **[LiteSnackbar](docs/lite-snackbar.md)** - Toast notifications service
|
|
91
72
|
|
|
92
73
|
---
|
|
93
74
|
|
|
@@ -340,629 +321,32 @@ export class AppComponent {
|
|
|
340
321
|
|
|
341
322
|
## Component Documentation
|
|
342
323
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
### LitePassword Component
|
|
362
|
-
|
|
363
|
-
**Selector:** `lite-password`
|
|
364
|
-
|
|
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. |
|
|
371
|
-
|
|
372
|
-
**Features:**
|
|
373
|
-
- Password visibility toggle with eye/eye-off icons
|
|
374
|
-
- Real-time password strength analysis
|
|
375
|
-
- Advanced password validation error messages
|
|
376
|
-
- Support for complex password patterns
|
|
377
|
-
- Accessibility features (ARIA labels)
|
|
378
|
-
|
|
379
|
-
**Example:**
|
|
380
|
-
```typescript
|
|
381
|
-
// Basic password
|
|
382
|
-
passwordField = new FieldDto('Password', new FormControl('', [
|
|
383
|
-
Validators.required,
|
|
384
|
-
Validators.minLength(8)
|
|
385
|
-
]));
|
|
386
|
-
|
|
387
|
-
// Advanced password with pattern validation
|
|
388
|
-
strongPasswordField = new FieldDto('Strong Password', new FormControl('', [
|
|
389
|
-
Validators.required,
|
|
390
|
-
Validators.minLength(8),
|
|
391
|
-
Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/)
|
|
392
|
-
]));
|
|
393
|
-
|
|
394
|
-
// Template
|
|
395
|
-
<lite-password [control]="passwordField"></lite-password>
|
|
396
|
-
<lite-password [control]="strongPasswordField" [showStrengthIndicator]="true"></lite-password>
|
|
397
|
-
<lite-password [control]="confirmPasswordField" [showToggle]="false"></lite-password>
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
**Password Strength Analysis:**
|
|
401
|
-
```typescript
|
|
402
|
-
import { FormUtils } from 'ngx-lite-form';
|
|
403
|
-
|
|
404
|
-
// Analyze password strength programmatically
|
|
405
|
-
const analysis = FormUtils.analyzePasswordStrength('MyStr0ng@Pass');
|
|
406
|
-
// Returns: { score: 6, level: 'Good', feedback: ['Consider using 12+ characters'] }
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### LiteTextarea Component
|
|
410
|
-
|
|
411
|
-
**Selector:** `lite-textarea`
|
|
412
|
-
|
|
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. |
|
|
417
|
-
|
|
418
|
-
**Example:**
|
|
419
|
-
```typescript
|
|
420
|
-
// Component
|
|
421
|
-
// With validation
|
|
422
|
-
descriptionField = new FieldDto('Description', new FormControl(''), 4);
|
|
423
|
-
|
|
424
|
-
// Template
|
|
425
|
-
<lite-textarea [control]="descriptionField"></lite-textarea>
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
### LiteSelect Component
|
|
429
|
-
|
|
430
|
-
**Selector:** `lite-select`
|
|
431
|
-
|
|
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. |
|
|
436
|
-
|
|
437
|
-
**Example:**
|
|
438
|
-
```typescript
|
|
439
|
-
// Component
|
|
440
|
-
statusField = new SelectFieldDto(
|
|
441
|
-
'Status',
|
|
442
|
-
new FormControl(''),
|
|
443
|
-
[
|
|
444
|
-
{ id: 1, name: 'Active' },
|
|
445
|
-
{ id: 2, name: 'Inactive' }
|
|
446
|
-
],
|
|
447
|
-
(option) => option.name
|
|
448
|
-
);
|
|
449
|
-
|
|
450
|
-
// Template
|
|
451
|
-
<lite-select [control]="statusField"></lite-select>
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### LiteMultiSelect Component
|
|
324
|
+
For detailed API documentation, examples, and usage guides for each component, please refer to the individual documentation files in the `/docs` folder:
|
|
325
|
+
|
|
326
|
+
- [LiteInput Documentation](docs/lite-input.md)
|
|
327
|
+
- [LitePassword Documentation](docs/lite-password.md)
|
|
328
|
+
- [LiteTextarea Documentation](docs/lite-textarea.md)
|
|
329
|
+
- [LiteSelect Documentation](docs/lite-select.md)
|
|
330
|
+
- [LiteMultiSelect Documentation](docs/lite-multi-select.md)
|
|
331
|
+
- [LiteRadio Documentation](docs/lite-radio.md)
|
|
332
|
+
- [LiteCheckbox Documentation](docs/lite-checkbox.md)
|
|
333
|
+
- [LiteDate Documentation](docs/lite-date.md)
|
|
334
|
+
- [LiteDateTime Documentation](docs/lite-datetime.md)
|
|
335
|
+
- [LiteFile Documentation](docs/lite-file.md)
|
|
336
|
+
- [LiteTable Documentation](docs/lite-table.md)
|
|
337
|
+
- [LitePaginator Documentation](docs/lite-paginator.md)
|
|
338
|
+
- [LitePanel Documentation](docs/lite-panel.md)
|
|
339
|
+
- [LiteLoading Documentation](docs/lite-loading.md)
|
|
340
|
+
- [LiteSnackbar Documentation](docs/lite-snackbar.md)
|
|
455
341
|
|
|
456
|
-
|
|
457
|
-
|
|
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. |
|
|
462
|
-
|
|
463
|
-
**Features:**
|
|
464
|
-
- Inline selected items display
|
|
465
|
-
- Dynamic height adjustment
|
|
466
|
-
- Filtering/search functionality
|
|
467
|
-
- Individual item removal
|
|
468
|
-
|
|
469
|
-
**Example:**
|
|
470
|
-
```typescript
|
|
471
|
-
// Component
|
|
472
|
-
tagsField = new MultiSelectFieldDto(
|
|
473
|
-
'Tags',
|
|
474
|
-
new FormControl<string[]>([]),
|
|
475
|
-
['Frontend', 'Backend', 'DevOps', 'Testing'],
|
|
476
|
-
(option) => option
|
|
477
|
-
);
|
|
478
|
-
|
|
479
|
-
// Template
|
|
480
|
-
<lite-multi-select [control]="tagsField"></lite-multi-select>
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
### LiteDate Component
|
|
484
|
-
|
|
485
|
-
**Selector:** `lite-date`
|
|
486
|
-
|
|
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. |
|
|
493
|
-
|
|
494
|
-
**Features:**
|
|
495
|
-
- Single date and date range selection
|
|
496
|
-
- Custom date formatting (dd/MM/yyyy, MM/dd/yyyy, yyyy-MM-dd)
|
|
497
|
-
- Intelligent calendar positioning (auto-adjusts based on screen space)
|
|
498
|
-
- Dual calendar display for range selection
|
|
499
|
-
- Visual range highlighting with different styles for start, end, and in-between dates
|
|
500
|
-
- Manual input parsing with format validation
|
|
501
|
-
- Timezone-safe date handling
|
|
502
|
-
- Today's date highlighting with distinctive styling
|
|
503
|
-
- Auto-close calendar after range selection
|
|
504
|
-
|
|
505
|
-
**Single Date Example:**
|
|
506
|
-
```typescript
|
|
507
|
-
// Component
|
|
508
|
-
birthdateField: FieldDto = {
|
|
509
|
-
label: 'Birth Date',
|
|
510
|
-
formControl: new FormControl<string>('', {
|
|
511
|
-
nonNullable: true,
|
|
512
|
-
validators: [Validators.required]
|
|
513
|
-
})
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
// Template
|
|
517
|
-
<lite-date [control]="birthdateField" [format]="'dd/MM/yyyy'"></lite-date>
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
**Date Range Example:**
|
|
521
|
-
```typescript
|
|
522
|
-
// Component
|
|
523
|
-
import { DateRangeFieldDto } from 'ngx-lite-form';
|
|
524
|
-
|
|
525
|
-
eventDateField: DateRangeFieldDto = {
|
|
526
|
-
label: 'Event Date Range',
|
|
527
|
-
formControl: new FormControl<string[]>(['', ''], { nonNullable: true })
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
// Template
|
|
531
|
-
<lite-date [control]="eventDateField" [range]="true" [format]="'dd/MM/yyyy'"></lite-date>
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
**Range Selection Behavior:**
|
|
535
|
-
- First click: Sets start date, clears any existing range
|
|
536
|
-
- Second click: Sets end date, completes range selection
|
|
537
|
-
- Clicking same date twice: Resets to single start date
|
|
538
|
-
- Auto-orders dates (earlier date becomes start, later becomes end)
|
|
539
|
-
- Calendar auto-closes 1 second after completing range selection
|
|
540
|
-
|
|
541
|
-
### LiteFile Component
|
|
542
|
-
|
|
543
|
-
**Selector:** `lite-file`
|
|
544
|
-
|
|
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. |
|
|
549
|
-
|
|
550
|
-
**Features:**
|
|
551
|
-
- File upload via button, drag & drop, or camera capture (on supported devices)
|
|
552
|
-
- Always-visible badge shows file count
|
|
553
|
-
- Management panel lists files, upload area, and action buttons
|
|
554
|
-
- Camera capture on devices with a camera using `<input type="file" accept="image/*" capture="environment">`
|
|
555
|
-
- Validation: max files, max file size, file type restrictions
|
|
556
|
-
- Image preview with thumbnails for image files
|
|
557
|
-
- Progress tracking for file uploads
|
|
558
|
-
- Accessibility: keyboard and screen reader friendly
|
|
559
|
-
|
|
560
|
-
**Example:**
|
|
561
|
-
```typescript
|
|
562
|
-
// Component
|
|
563
|
-
import { FileFieldDto } from 'ngx-lite-form';
|
|
564
|
-
|
|
565
|
-
// Basic file upload
|
|
566
|
-
fileField = new FileFieldDto('Upload Files', new FormControl([]));
|
|
567
|
-
|
|
568
|
-
// Image upload with restrictions
|
|
569
|
-
imageField = new FileFieldDto(
|
|
570
|
-
'Profile Picture',
|
|
571
|
-
new FormControl([]),
|
|
572
|
-
false, // single file only
|
|
573
|
-
'image/*', // images only
|
|
574
|
-
2 * 1024 * 1024, // 2MB limit
|
|
575
|
-
1, // max 1 file
|
|
576
|
-
true // show preview
|
|
577
|
-
);
|
|
578
|
-
|
|
579
|
-
// Template
|
|
580
|
-
<lite-file [control]="fileField"></lite-file>
|
|
581
|
-
<lite-file [control]="imageField"></lite-file>
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
**Camera Capture:**
|
|
585
|
-
- The "Take Picture" button opens the device camera using a hidden file input with `accept="image/*" capture="environment"`
|
|
586
|
-
- Works on mobile devices and laptops with a camera
|
|
587
|
-
- On desktops without a camera, the button will do nothing or fall back to file selection
|
|
588
|
-
- No special permissions required, but the browser may prompt for camera access
|
|
589
|
-
|
|
590
|
-
**File Management Panel:**
|
|
591
|
-
- Click the file icon button to open the management panel
|
|
592
|
-
- Drag & drop files or click the upload area to select files
|
|
593
|
-
- Use action buttons to upload files, take a picture, or close the panel
|
|
594
|
-
- Remove files individually or clear all files
|
|
595
|
-
|
|
596
|
-
### LiteTable Component
|
|
597
|
-
|
|
598
|
-
**Selector:** `lite-table`
|
|
599
|
-
|
|
600
|
-
| Input | Type | Default | Description |
|
|
601
|
-
| :------ | :------------------ | :------ | :----------------------------------------------- |
|
|
602
|
-
| `table` | `TableFieldDto<T>` | - | Table configuration including columns and data. |
|
|
603
|
-
|
|
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. |
|
|
609
|
-
|
|
610
|
-
**Features:**
|
|
611
|
-
- Flexbox-based responsive layout for modern table design
|
|
612
|
-
- Custom column definitions with labels, flex sizing, and cell templates
|
|
613
|
-
- Support for nested object property access (dot notation)
|
|
614
|
-
- Integrated pagination with lite-paginator component
|
|
615
|
-
- Custom cell templates for advanced formatting (images, status indicators, dates)
|
|
616
|
-
- Automatic handling of special data formats (name objects, nested properties)
|
|
617
|
-
- Empty state display when no data is available
|
|
618
|
-
- Sorting indicators (visual styling support)
|
|
619
|
-
- Per-row actions menu via a dedicated `menu`-type column (kebab/tri-dot)
|
|
620
|
-
|
|
621
|
-
**Example:**
|
|
622
|
-
```typescript
|
|
623
|
-
// Component
|
|
624
|
-
import { TableFieldDto, TableColumn } from 'ngx-lite-form';
|
|
625
|
-
|
|
626
|
-
interface Product {
|
|
627
|
-
id: number;
|
|
628
|
-
name: string;
|
|
629
|
-
price: number;
|
|
630
|
-
category: string;
|
|
631
|
-
inStock: boolean;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
const columns: TableColumn[] = [
|
|
635
|
-
{ key: 'id', label: 'ID', flex: '0 0 80px' },
|
|
636
|
-
{ key: 'name', label: 'Product Name', flex: '2' },
|
|
637
|
-
{ key: 'price', label: 'Price', flex: '0 0 100px', cellTemplate: (value) => `$${value?.toFixed(2)}` },
|
|
638
|
-
{ key: 'category', label: 'Category', flex: '1' },
|
|
639
|
-
{ key: 'inStock', label: 'Status', flex: '0 0 100px', cellTemplate: (value) => value ? '✓ In Stock' : '✗ Out of Stock' }
|
|
640
|
-
];
|
|
641
|
-
|
|
642
|
-
productTable = new TableFieldDto(columns, productData, false);
|
|
643
|
-
|
|
644
|
-
// Template
|
|
645
|
-
<lite-table [table]="productTable"></lite-table>
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
#### Row Actions Menu
|
|
649
|
-
|
|
650
|
-
Add a dedicated menu column to show a kebab (tri-dot) button per row. Configure menu items on the column and handle the `(menuAction)` output.
|
|
651
|
-
|
|
652
|
-
```typescript
|
|
653
|
-
import { TableFieldDto, TableColumn } from 'ngx-lite-form';
|
|
654
|
-
|
|
655
|
-
const columns: TableColumn[] = [
|
|
656
|
-
{ key: 'name', label: 'Name', flex: '1' },
|
|
657
|
-
{ key: 'email', label: 'Email', flex: '1' },
|
|
658
|
-
// Menu column (last column)
|
|
659
|
-
{
|
|
660
|
-
key: 'actions',
|
|
661
|
-
label: '',
|
|
662
|
-
flex: '0 0 44px',
|
|
663
|
-
type: 'menu',
|
|
664
|
-
menuItems: [
|
|
665
|
-
{ label: 'Edit', value: 'edit' },
|
|
666
|
-
{ label: 'Delete', value: 'delete', variant: 'danger' }
|
|
667
|
-
]
|
|
668
|
-
}
|
|
669
|
-
];
|
|
670
|
-
|
|
671
|
-
table = new TableFieldDto(columns, userData, false);
|
|
672
|
-
|
|
673
|
-
// In your component class
|
|
674
|
-
onRowMenuAction(event: { action: string; row: any }) {
|
|
675
|
-
if (event.action === 'edit') {
|
|
676
|
-
// handle edit
|
|
677
|
-
} else if (event.action === 'delete') {
|
|
678
|
-
// handle delete
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
```html
|
|
684
|
-
<lite-table [table]="table" (menuAction)="onRowMenuAction($event)"></lite-table>
|
|
685
|
-
```
|
|
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
|
-
|
|
901
|
-
### LitePaginator Component
|
|
902
|
-
|
|
903
|
-
**Selector:** `lite-paginator`
|
|
904
|
-
|
|
905
|
-
| Input | Type | Default | Description |
|
|
906
|
-
| :---------- | :------------------ | :------ | :----------------------------------------------- |
|
|
907
|
-
| `paginator` | `PaginatorFieldDto` | - | Paginator configuration object. |
|
|
908
|
-
|
|
909
|
-
| Output | Type | Description |
|
|
910
|
-
| :------------------- | :------- | :----------------------------------------------- |
|
|
911
|
-
| `pageChange` | `number` | Emitted with the new page number on page change. |
|
|
912
|
-
| `itemsPerPageChange` | `number` | Emitted with the new items-per-page count. |
|
|
913
|
-
|
|
914
|
-
**Features:**
|
|
915
|
-
- Previous/Next navigation buttons with disabled states
|
|
916
|
-
- Numbered page buttons with active state highlighting
|
|
917
|
-
- Items per page dropdown selection
|
|
918
|
-
- Total items display with customizable formatting
|
|
919
|
-
- Keyboard navigation support (arrow keys)
|
|
920
|
-
- Responsive design that adapts to different screen sizes
|
|
921
|
-
- Accessibility features with ARIA labels and screen reader support
|
|
922
|
-
- Configurable page range display and navigation controls
|
|
923
|
-
|
|
924
|
-
**Example:**
|
|
925
|
-
```typescript
|
|
926
|
-
// Component
|
|
927
|
-
import { PaginatorFieldDto } from 'ngx-lite-form';
|
|
928
|
-
|
|
929
|
-
paginator = new PaginatorFieldDto(1, 500, 25); // Page 1, 500 total items, 25 per page
|
|
930
|
-
|
|
931
|
-
// Template
|
|
932
|
-
<lite-paginator
|
|
933
|
-
[paginator]="paginator"
|
|
934
|
-
(pageChange)="onPageChange($event)"
|
|
935
|
-
(itemsPerPageChange)="onItemsPerPageChange($event)">
|
|
936
|
-
</lite-paginator>
|
|
937
|
-
```
|
|
938
|
-
|
|
939
|
-
## Snackbar Service
|
|
940
|
-
|
|
941
|
-
The library provides a simple snackbar notification service for showing messages at the top of the page. No component or template is needed.
|
|
942
|
-
|
|
943
|
-
### Usage
|
|
944
|
-
|
|
945
|
-
Inject the service and call `show()` with your message and type:
|
|
946
|
-
|
|
947
|
-
```typescript
|
|
948
|
-
import { LiteSnackbarService } from 'ngx-lite-form';
|
|
949
|
-
|
|
950
|
-
constructor(private snackbar: LiteSnackbarService) {}
|
|
951
|
-
|
|
952
|
-
// Show a success message
|
|
953
|
-
this.snackbar.show('Operation completed!', 'done');
|
|
954
|
-
|
|
955
|
-
// Show a warning
|
|
956
|
-
this.snackbar.show('Please check your input.', 'warn');
|
|
957
|
-
|
|
958
|
-
// Show an error (with custom duration)
|
|
959
|
-
this.snackbar.show('Something went wrong.', 'error', 5000);
|
|
960
|
-
```
|
|
342
|
+
---
|
|
961
343
|
|
|
962
|
-
|
|
963
|
-
- Duration: Optional, in milliseconds (default: 3000)
|
|
344
|
+
## Additional Resources
|
|
964
345
|
|
|
965
|
-
|
|
346
|
+
- **[Contributing Guide](docs/CONTRIBUTING.md)** - How to contribute to the project
|
|
347
|
+
- **[Style Guide](docs/STYLEGUIDE.md)** - SCSS styling conventions
|
|
348
|
+
- **[Migration Guide](docs/MIGRATION.md)** - Upgrading between versions
|
|
349
|
+
- **[Changelog](docs/CHANGELOG.md)** - Version history and release notes
|
|
966
350
|
|
|
967
351
|
---
|
|
968
352
|
|
|
@@ -1122,11 +506,10 @@ lite-form/
|
|
|
1122
506
|
└── scripts/ # Build and publishing utilities
|
|
1123
507
|
```
|
|
1124
508
|
|
|
1125
|
-
For the full contributor guide and extended structure diagram, see [docs/CONTRIBUTING.md](https://github.com/liangk/lite-form/blob/main/docs/CONTRIBUTING.md).
|
|
1126
509
|
## License
|
|
1127
510
|
This project is licensed under the MIT License - see the [LICENSE](https://github.com/liangk/lite-form/blob/main/LICENSE) file for details.
|
|
1128
511
|
|
|
1129
512
|
---
|
|
1130
|
-
|
|
1131
513
|
## Changelog
|
|
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.
|
|
514
|
+
- 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.9` release with smart form validation-based action disabling for LitePanel.
|
|
515
|
+
-
|