ngx-lite-form 1.3.0 → 1.3.1
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 +44 -1
- package/fesm2022/ngx-lite-form.mjs +48 -27
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -543,6 +543,7 @@ imageField = new FileFieldDto(
|
|
|
543
543
|
**Outputs:**
|
|
544
544
|
- `pageChange: number` - Emitted when user changes page (for paginated tables)
|
|
545
545
|
- `itemsPerPageChange: number` - Emitted when user changes items per page
|
|
546
|
+
- `menuAction: { action: string; row: T }` - Emitted when a row action is selected from a menu-type column
|
|
546
547
|
|
|
547
548
|
**Features:**
|
|
548
549
|
- Flexbox-based responsive layout for modern table design
|
|
@@ -553,6 +554,7 @@ imageField = new FileFieldDto(
|
|
|
553
554
|
- Automatic handling of special data formats (name objects, nested properties)
|
|
554
555
|
- Empty state display when no data is available
|
|
555
556
|
- Sorting indicators (visual styling support)
|
|
557
|
+
- Per-row actions menu via a dedicated `menu`-type column (kebab/tri-dot)
|
|
556
558
|
|
|
557
559
|
**Example:**
|
|
558
560
|
```typescript
|
|
@@ -581,6 +583,45 @@ productTable = new TableFieldDto(columns, productData, false);
|
|
|
581
583
|
<lite-table [table]="productTable"></lite-table>
|
|
582
584
|
```
|
|
583
585
|
|
|
586
|
+
#### Row Actions Menu
|
|
587
|
+
|
|
588
|
+
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.
|
|
589
|
+
|
|
590
|
+
```typescript
|
|
591
|
+
import { TableFieldDto, TableColumn } from 'ngx-lite-form';
|
|
592
|
+
|
|
593
|
+
const columns: TableColumn[] = [
|
|
594
|
+
{ key: 'name', label: 'Name', flex: '1' },
|
|
595
|
+
{ key: 'email', label: 'Email', flex: '1' },
|
|
596
|
+
// Menu column (last column)
|
|
597
|
+
{
|
|
598
|
+
key: 'actions',
|
|
599
|
+
label: '',
|
|
600
|
+
flex: '0 0 44px',
|
|
601
|
+
type: 'menu',
|
|
602
|
+
menuItems: [
|
|
603
|
+
{ label: 'Edit', value: 'edit' },
|
|
604
|
+
{ label: 'Delete', value: 'delete', variant: 'danger' }
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
];
|
|
608
|
+
|
|
609
|
+
table = new TableFieldDto(columns, userData, false);
|
|
610
|
+
|
|
611
|
+
// In your component class
|
|
612
|
+
onRowMenuAction(event: { action: string; row: any }) {
|
|
613
|
+
if (event.action === 'edit') {
|
|
614
|
+
// handle edit
|
|
615
|
+
} else if (event.action === 'delete') {
|
|
616
|
+
// handle delete
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
```html
|
|
622
|
+
<lite-table [table]="table" (menuAction)="onRowMenuAction($event)"></lite-table>
|
|
623
|
+
```
|
|
624
|
+
|
|
584
625
|
### LitePaginator Component
|
|
585
626
|
|
|
586
627
|
**Selector:** `lite-paginator`
|
|
@@ -730,6 +771,8 @@ interface TableColumn {
|
|
|
730
771
|
flex?: string; // CSS flex property (e.g., '0 0 100px', '1')
|
|
731
772
|
sortable?: boolean; // Show sorting indicator
|
|
732
773
|
cellTemplate?: (value: any, row: any) => string; // Custom HTML template
|
|
774
|
+
type?: 'text' | 'menu'; // Optional column type (default: 'text')
|
|
775
|
+
menuItems?: Array<{ label: string; value: string; variant?: 'danger' | 'default' }>; // For 'menu' type columns
|
|
733
776
|
}
|
|
734
777
|
```
|
|
735
778
|
|
|
@@ -808,4 +851,4 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
|
808
851
|
---
|
|
809
852
|
|
|
810
853
|
## Changelog
|
|
811
|
-
- 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.
|
|
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.1` release with `LiteTable` row menu actions and README updates.
|