@goat-bravos/intern-hub-layout 3.0.7 → 3.0.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
CHANGED
|
@@ -20,6 +20,7 @@ A comprehensive Angular library providing reusable layout components and shared
|
|
|
20
20
|
- [Layout Components](#layout-components)
|
|
21
21
|
- [Button Components](#button-components)
|
|
22
22
|
- [Input Components](#input-components)
|
|
23
|
+
- [Date Picker Components](#date-picker-components)
|
|
23
24
|
- [Table Components](#table-components)
|
|
24
25
|
- [Approval Components](#approval-components)
|
|
25
26
|
- [Modal Components](#modal-components)
|
|
@@ -32,6 +33,9 @@ A comprehensive Angular library providing reusable layout components and shared
|
|
|
32
33
|
- [Contributing](#-contributing)
|
|
33
34
|
- [Changelog](#-changelog)
|
|
34
35
|
- [License](#-license)
|
|
36
|
+
- [Links & Resources](#-links--resources)
|
|
37
|
+
- [Support](#-support)
|
|
38
|
+
- [Acknowledgments](#-acknowledgments)
|
|
35
39
|
|
|
36
40
|
---
|
|
37
41
|
|
|
@@ -176,14 +180,15 @@ intern-hub-layout/
|
|
|
176
180
|
│ │ └── components/ # Shared UI components
|
|
177
181
|
│ │ ├── approval/ # Approval list components
|
|
178
182
|
│ │ ├── button/ # Button components
|
|
183
|
+
│ │ ├── date-picker/ # Date picker component
|
|
184
|
+
│ │ ├── avatar-upload-button/ # Avatar upload button
|
|
179
185
|
│ │ ├── file-upload-dropzone/ # Drag & drop file upload
|
|
180
186
|
│ │ ├── functional-label/ # Label with icons
|
|
181
187
|
│ │ ├── icon/ # Icon component
|
|
182
188
|
│ │ ├── input/ # Input components
|
|
183
189
|
│ │ ├── modal/ # Modal dialog
|
|
184
190
|
│ │ ├── pop-up/ # Confirmation dialogs
|
|
185
|
-
│ │
|
|
186
|
-
│ │ └── upload-button/ # File upload button
|
|
191
|
+
│ │ └── table/ # Table components
|
|
187
192
|
│ └── public-api.ts # Public API exports
|
|
188
193
|
├── demo/ # Demo application
|
|
189
194
|
├── dist/ # Build output
|
|
@@ -229,6 +234,7 @@ export class MyComponent {
|
|
|
229
234
|
userIcon: "dsi-user-01-line",
|
|
230
235
|
dropdownIcon: "dsi-arrow-down-solid",
|
|
231
236
|
logo: "assets/logo.png",
|
|
237
|
+
minWidth: "1200px",
|
|
232
238
|
};
|
|
233
239
|
}
|
|
234
240
|
```
|
|
@@ -246,6 +252,7 @@ interface HeaderData {
|
|
|
246
252
|
logo?: string;
|
|
247
253
|
logoWidth?: string;
|
|
248
254
|
logoHeight?: string;
|
|
255
|
+
minWidth?: string;
|
|
249
256
|
}
|
|
250
257
|
|
|
251
258
|
interface HeaderAction {
|
|
@@ -636,6 +643,95 @@ export class MyComponent {
|
|
|
636
643
|
|
|
637
644
|
---
|
|
638
645
|
|
|
646
|
+
### Date Picker Components
|
|
647
|
+
|
|
648
|
+
#### DatePickerComponent
|
|
649
|
+
|
|
650
|
+
A comprehensive date/range picker with ng-zorro-antd integration supporting single selection, range selection, and multiple modes.
|
|
651
|
+
|
|
652
|
+
**Selector:** `app-date-picker`
|
|
653
|
+
|
|
654
|
+
```typescript
|
|
655
|
+
import { DatePickerComponent } from "@goat-bravos/intern-hub-layout";
|
|
656
|
+
|
|
657
|
+
@Component({
|
|
658
|
+
imports: [DatePickerComponent],
|
|
659
|
+
template: `
|
|
660
|
+
<!-- Single date picker -->
|
|
661
|
+
<app-date-picker headerInput="Start Date" mode="date" [(value)]="selectedDate" (dateChange)="onDateChange($event)"></app-date-picker>
|
|
662
|
+
|
|
663
|
+
<!-- Date range picker -->
|
|
664
|
+
<app-date-picker headerInput="Date Range" mode="default" isRange="true" [(value)]="dateRange" (rangeChange)="onRangeChange($event)"></app-date-picker>
|
|
665
|
+
|
|
666
|
+
<!-- Week picker -->
|
|
667
|
+
<app-date-picker headerInput="Select Week" mode="week" [(value)]="weekDate"></app-date-picker>
|
|
668
|
+
|
|
669
|
+
<!-- Month picker -->
|
|
670
|
+
<app-date-picker headerInput="Select Month" mode="month" [(value)]="monthDate"></app-date-picker>
|
|
671
|
+
|
|
672
|
+
<!-- Date and Time picker -->
|
|
673
|
+
<app-date-picker headerInput="Date & Time" mode="date" showTime="true" [(value)]="dateTime"></app-date-picker>
|
|
674
|
+
`,
|
|
675
|
+
})
|
|
676
|
+
export class MyComponent {
|
|
677
|
+
selectedDate: Date | null = null;
|
|
678
|
+
dateRange: [Date, Date] | null = null;
|
|
679
|
+
weekDate: Date | null = null;
|
|
680
|
+
monthDate: Date | null = null;
|
|
681
|
+
dateTime: Date | null = null;
|
|
682
|
+
|
|
683
|
+
onDateChange(date: Date) {
|
|
684
|
+
console.log("Date selected:", date);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
onRangeChange(range: [Date, Date]) {
|
|
688
|
+
console.log("Date range selected:", range);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
**Inputs:**
|
|
694
|
+
|
|
695
|
+
| Input | Type | Default | Description |
|
|
696
|
+
| ---------------------- | -------------------------------------------------- | --------------- | ------------------------------------- |
|
|
697
|
+
| `headerInput` | `string` | `''` | Label text above picker |
|
|
698
|
+
| `value` | `Date \| [Date, Date] \| null` | `null` | Selected date(s) value |
|
|
699
|
+
| `mode` | `'date' \| 'week' \| 'month' \| 'quarter' \| 'year'` | `'date'` | Picker mode |
|
|
700
|
+
| `isRange` | `boolean` | `false` | Enable range selection |
|
|
701
|
+
| `showTime` | `boolean` | `false` | Show time selection |
|
|
702
|
+
| `placeholder` | `string` | `'Select date'` | Placeholder text |
|
|
703
|
+
| `format` | `string` | `'dd/MM/yyyy'` | Date format string |
|
|
704
|
+
| `required` | `boolean` | `false` | Show required indicator |
|
|
705
|
+
| `readonly` | `boolean` | `false` | Read-only state |
|
|
706
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
707
|
+
| `disabledDate` | `(date: Date) => boolean` | - | Function to disable specific dates |
|
|
708
|
+
| `dropdownPlacement` | `'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight'` | `'bottomLeft'` | Dropdown position |
|
|
709
|
+
| `width` | `string` | `'100%'` | Component width |
|
|
710
|
+
|
|
711
|
+
**Outputs:**
|
|
712
|
+
|
|
713
|
+
| Output | Type | Description |
|
|
714
|
+
| -------------- | ------------------------------------- | ------------------------------------ |
|
|
715
|
+
| `dateChange` | `EventEmitter<Date \| null>` | Emits when single date is selected |
|
|
716
|
+
| `rangeChange` | `EventEmitter<[Date, Date] \| null>` | Emits when date range is selected |
|
|
717
|
+
| `openChange` | `EventEmitter<boolean>` | Emits when picker opens/closes |
|
|
718
|
+
| `ok` | `EventEmitter<Date \| [Date, Date]>` | Emits when OK button is clicked |
|
|
719
|
+
| `panelChange` | `EventEmitter<any>` | Emits on panel change events |
|
|
720
|
+
|
|
721
|
+
**Features:**
|
|
722
|
+
|
|
723
|
+
- ✅ **Multiple Modes** - Date, week, month, quarter, year selection
|
|
724
|
+
- ✅ **Range Selection** - Pick date ranges for date range inputs
|
|
725
|
+
- ✅ **Time Support** - Include time selection with dates
|
|
726
|
+
- ✅ **Date Disabling** - Disable specific dates via custom function
|
|
727
|
+
- ✅ **Customizable Format** - Change date format string
|
|
728
|
+
- ✅ **Dropdown Control** - Position popup relative to input
|
|
729
|
+
- ✅ **Form Integration** - ControlValueAccessor for form support
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
### Table Components
|
|
734
|
+
|
|
639
735
|
#### InputCalendarComponent
|
|
640
736
|
|
|
641
737
|
A date picker with auto-formatting (dd/mm/yyyy) and validation.
|
|
@@ -690,8 +786,6 @@ export class MyComponent {
|
|
|
690
786
|
|
|
691
787
|
---
|
|
692
788
|
|
|
693
|
-
### Table Components
|
|
694
|
-
|
|
695
789
|
#### TableHeaderComponent & TableBodyComponent
|
|
696
790
|
|
|
697
791
|
Table components with customizable columns and template support.
|
|
@@ -837,6 +931,37 @@ interface ApprovalListItemInterface {
|
|
|
837
931
|
|
|
838
932
|
---
|
|
839
933
|
|
|
934
|
+
---
|
|
935
|
+
|
|
936
|
+
#### ApprovalListItemComponent
|
|
937
|
+
|
|
938
|
+
A single item component for the approval list, can be used independently.
|
|
939
|
+
|
|
940
|
+
**Selector:** `app-approval-list-item`
|
|
941
|
+
|
|
942
|
+
```typescript
|
|
943
|
+
import { ApprovalListItemComponent } from "@goat-bravos/intern-hub-layout";
|
|
944
|
+
|
|
945
|
+
@Component({
|
|
946
|
+
imports: [ApprovalListItemComponent],
|
|
947
|
+
template: ` <app-approval-list-item name="John Doe - Request #123" [date]="requestDate"></app-approval-list-item> `,
|
|
948
|
+
})
|
|
949
|
+
export class MyComponent {
|
|
950
|
+
requestDate = new Date();
|
|
951
|
+
}
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
**Inputs:**
|
|
955
|
+
|
|
956
|
+
| Input | Type | Description |
|
|
957
|
+
| --------------- | ------------------ | ------------------------------ |
|
|
958
|
+
| `name` | `string` | Main text/name to display |
|
|
959
|
+
| `date` | `Date` | Date object to display |
|
|
960
|
+
| `rightTemplate` | `TemplateRef<any>` | Custom template for right side |
|
|
961
|
+
| `rightContext` | `any` | Context for the right template |
|
|
962
|
+
|
|
963
|
+
---
|
|
964
|
+
|
|
840
965
|
### Modal Components
|
|
841
966
|
|
|
842
967
|
#### ModalComponent
|
|
@@ -857,7 +982,7 @@ import { CommonModule } from "@angular/common";
|
|
|
857
982
|
|
|
858
983
|
<!-- Modal component -->
|
|
859
984
|
@if (isModalOpen) {
|
|
860
|
-
<app-modal [title]="'User Details'" [isOpen]="isModalOpen" [width]="'600px'" [minHeight]="'400px'" [theme]="'default'" (
|
|
985
|
+
<app-modal [title]="'User Details'" [isOpen]="isModalOpen" [width]="'600px'" [minHeight]="'400px'" [theme]="'default'" (closeModal)="onModalClose()">
|
|
861
986
|
<!-- Modal content goes here -->
|
|
862
987
|
<div class="modal-content">
|
|
863
988
|
<p>This is the modal content area.</p>
|
|
@@ -889,16 +1014,16 @@ export class MyComponent {
|
|
|
889
1014
|
|
|
890
1015
|
**Outputs:**
|
|
891
1016
|
|
|
892
|
-
| Output
|
|
893
|
-
|
|
|
894
|
-
| `
|
|
1017
|
+
| Output | Type | Description |
|
|
1018
|
+
| ------------ | -------------------- | --------------------------------- |
|
|
1019
|
+
| `closeModal` | `EventEmitter<void>` | Emits when modal should be closed |
|
|
895
1020
|
|
|
896
1021
|
**Content Projection:**
|
|
897
1022
|
|
|
898
1023
|
The modal supports content projection. Place any HTML content between the opening and closing tags:
|
|
899
1024
|
|
|
900
1025
|
```html
|
|
901
|
-
<app-modal [title]="'Custom Modal'" [isOpen]="true" (
|
|
1026
|
+
<app-modal [title]="'Custom Modal'" [isOpen]="true" (closeModal)="closeModal()">
|
|
902
1027
|
<form>
|
|
903
1028
|
<input type="text" placeholder="Name" />
|
|
904
1029
|
<button type="submit">Submit</button>
|
|
@@ -971,50 +1096,60 @@ export class MyComponent {
|
|
|
971
1096
|
|
|
972
1097
|
### Upload Components
|
|
973
1098
|
|
|
974
|
-
|
|
1099
|
+
---
|
|
1100
|
+
|
|
1101
|
+
#### AvatarUploadButtonComponent
|
|
975
1102
|
|
|
976
|
-
A
|
|
1103
|
+
A dedicated button for uploading avatar images with preview functionality.
|
|
977
1104
|
|
|
978
|
-
**Selector:** `app-upload-button`
|
|
1105
|
+
**Selector:** `app-avatar-upload-button`
|
|
979
1106
|
|
|
980
1107
|
```typescript
|
|
981
|
-
import {
|
|
1108
|
+
import { AvatarUploadButtonComponent, AvatarUploadedFile } from "@goat-bravos/intern-hub-layout";
|
|
982
1109
|
|
|
983
1110
|
@Component({
|
|
984
|
-
imports: [
|
|
985
|
-
template: `
|
|
986
|
-
<!-- Basic upload button -->
|
|
987
|
-
<app-upload-button [label]="'Profile Picture'" [required]="true" [buttonText]="'Upload Image'" [acceptFormats]="'.png,.jpg,.jpeg'" [helperText]="'Max size: 5MB (PNG, JPG, JPEG)'" (fileSelected)="onFileSelected($event)"></app-upload-button>
|
|
988
|
-
|
|
989
|
-
<!-- With tooltip -->
|
|
990
|
-
<app-upload-button [label]="'Document Upload'" [showTooltip]="true" [tooltipText]="'Upload your resume or portfolio'" [acceptFormats]="'.pdf,.doc,.docx'" (fileSelected)="onFileSelected($event)"></app-upload-button>
|
|
991
|
-
`,
|
|
1111
|
+
imports: [AvatarUploadButtonComponent],
|
|
1112
|
+
template: ` <app-avatar-upload-button [label]="'Avatar'" [required]="true" [buttonText]="'Upload Avatar'" (fileChange)="onAvatarChange($event)"></app-avatar-upload-button> `,
|
|
992
1113
|
})
|
|
993
1114
|
export class MyComponent {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1115
|
+
onAvatarChange(file: AvatarUploadedFile | null) {
|
|
1116
|
+
if (file) {
|
|
1117
|
+
console.log("Avatar uploaded:", file.fileName, file.previewUrl);
|
|
1118
|
+
} else {
|
|
1119
|
+
console.log("Avatar removed");
|
|
1120
|
+
}
|
|
997
1121
|
}
|
|
998
1122
|
}
|
|
999
1123
|
```
|
|
1000
1124
|
|
|
1001
1125
|
**Inputs:**
|
|
1002
1126
|
|
|
1003
|
-
| Input | Type | Default | Description
|
|
1004
|
-
| --------------- | --------- | ------------------------------- |
|
|
1005
|
-
| `label` | `string` | `''` | Label text
|
|
1006
|
-
| `required` | `boolean` | `false` |
|
|
1007
|
-
| `showTooltip` | `boolean` | `false` |
|
|
1008
|
-
| `tooltipText` | `string` | `''` | Tooltip content
|
|
1009
|
-
| `buttonText` | `string` | `'Tải
|
|
1010
|
-
| `acceptFormats` | `string` | `'.png,.jpeg,.jpg'` | Accepted
|
|
1011
|
-
| `helperText` | `string` | `'Định dạng .png, .jpeg, .jpg'` | Helper text below
|
|
1127
|
+
| Input | Type | Default | Description |
|
|
1128
|
+
| --------------- | --------- | ------------------------------- | ------------------ |
|
|
1129
|
+
| `label` | `string` | `''` | Label text |
|
|
1130
|
+
| `required` | `boolean` | `false` | Required indicator |
|
|
1131
|
+
| `showTooltip` | `boolean` | `false` | Show info tooltip |
|
|
1132
|
+
| `tooltipText` | `string` | `''` | Tooltip content |
|
|
1133
|
+
| `buttonText` | `string` | `'Tải file lên'` | Button text |
|
|
1134
|
+
| `acceptFormats` | `string` | `'.png,.jpeg,.jpg'` | Accepted formats |
|
|
1135
|
+
| `helperText` | `string` | `'Định dạng .png, .jpeg, .jpg'` | Helper text below |
|
|
1012
1136
|
|
|
1013
1137
|
**Outputs:**
|
|
1014
1138
|
|
|
1015
|
-
| Output
|
|
1016
|
-
|
|
|
1017
|
-
| `
|
|
1139
|
+
| Output | Type | Description |
|
|
1140
|
+
| ------------ | -------------------------------- | ----------- | -------------------------------- |
|
|
1141
|
+
| `fileChange` | `EventEmitter<AvatarUploadedFile | null>` | Emits uploaded file data or null |
|
|
1142
|
+
|
|
1143
|
+
**Interfaces:**
|
|
1144
|
+
|
|
1145
|
+
```typescript
|
|
1146
|
+
interface AvatarUploadedFile {
|
|
1147
|
+
id: string;
|
|
1148
|
+
file: File;
|
|
1149
|
+
fileName: string;
|
|
1150
|
+
previewUrl: string | null;
|
|
1151
|
+
}
|
|
1152
|
+
```
|
|
1018
1153
|
|
|
1019
1154
|
---
|
|
1020
1155
|
|
|
@@ -1399,8 +1534,13 @@ If you encounter issues not covered here:
|
|
|
1399
1534
|
|
|
1400
1535
|
**Added:**
|
|
1401
1536
|
|
|
1537
|
+
- ✨ DatePickerComponent with ng-zorro-antd integration
|
|
1538
|
+
- Support for single date, range, and multiple modes (date, week, month, quarter, year)
|
|
1539
|
+
- Time selection support
|
|
1540
|
+
- Date disabling functionality
|
|
1541
|
+
- Customizable date formatting
|
|
1402
1542
|
- ✨ Modal component with theme support
|
|
1403
|
-
- ✨ File upload components (
|
|
1543
|
+
- ✨ File upload components (AvatarUploadButtonComponent and FileUploadDropzoneComponent)
|
|
1404
1544
|
- ✨ Drag-and-drop file upload functionality
|
|
1405
1545
|
- ✨ Enhanced accessibility features
|
|
1406
1546
|
|
|
@@ -1408,7 +1548,8 @@ If you encounter issues not covered here:
|
|
|
1408
1548
|
|
|
1409
1549
|
- 🔧 Better TypeScript type definitions
|
|
1410
1550
|
- 🔧 Optimized component performance with OnPush
|
|
1411
|
-
- 📚 Comprehensive README documentation
|
|
1551
|
+
- 📚 Comprehensive README documentation with DatePicker examples
|
|
1552
|
+
- 🔧 Updated project structure documentation
|
|
1412
1553
|
|
|
1413
1554
|
**Fixed:**
|
|
1414
1555
|
|