@goat-bravos/intern-hub-layout 1.0.3 → 1.0.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/package.json +20 -36
- package/dist/intern-hub-layout/README.md +0 -267
- /package/{dist/intern-hub-layout/fesm2022 → fesm2022}/goat-bravos-intern-hub-layout.mjs +0 -0
- /package/{dist/intern-hub-layout/fesm2022 → fesm2022}/goat-bravos-intern-hub-layout.mjs.map +0 -0
- /package/{dist/intern-hub-layout/types → types}/goat-bravos-intern-hub-layout.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goat-bravos/intern-hub-layout",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Angular library for intern hub layout components",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^21.0.0",
|
|
@@ -13,26 +13,6 @@
|
|
|
13
13
|
"optional": true
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"licenses": [
|
|
17
|
-
{
|
|
18
|
-
"type": "MIT",
|
|
19
|
-
"url": "https://opensource.org/licenses/MIT"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://github.com/FPT-IS-Intern/Intern-Hub-FE-Layout"
|
|
25
|
-
},
|
|
26
|
-
"main": "dist/intern-hub-layout/fesm2022/goat-bravos-intern-hub-layout.mjs",
|
|
27
|
-
"types": "dist/intern-hub-layout/index.d.ts",
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"README.md"
|
|
31
|
-
],
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "ng build --configuration production",
|
|
34
|
-
"prepublishOnly": "npm run build"
|
|
35
|
-
},
|
|
36
16
|
"keywords": [
|
|
37
17
|
"angular",
|
|
38
18
|
"library",
|
|
@@ -41,19 +21,23 @@
|
|
|
41
21
|
],
|
|
42
22
|
"author": "intern-hub",
|
|
43
23
|
"license": "MIT",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/FPT-IS-Intern/Intern-Hub-FE-Layout"
|
|
27
|
+
},
|
|
28
|
+
"module": "fesm2022/goat-bravos-intern-hub-layout.mjs",
|
|
29
|
+
"typings": "types/goat-bravos-intern-hub-layout.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": {
|
|
32
|
+
"default": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./types/goat-bravos-intern-hub-layout.d.ts",
|
|
36
|
+
"default": "./fesm2022/goat-bravos-intern-hub-layout.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": false,
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"tslib": "^2.3.0"
|
|
58
42
|
}
|
|
59
|
-
}
|
|
43
|
+
}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# Intern Hub Layout
|
|
2
|
-
|
|
3
|
-
This library provides a standard layout and shared UI components for Intern Hub applications. It is designed to be highly configurable via Angular Routing.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Run the following command to install the package:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install intern-hub-layout dynamic-ds
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
_(Note: `dynamic-ds` is a required peer dependency for the design system)_
|
|
14
|
-
|
|
15
|
-
## Setup
|
|
16
|
-
|
|
17
|
-
To enable the configurable layout pattern, you must add `withComponentInputBinding()` to your `app.config.ts`. This allows the Router to pass configuration data directly to the Layout component inputs.
|
|
18
|
-
|
|
19
|
-
**`src/app/app.config.ts`**
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { ApplicationConfig } from '@angular/core';
|
|
23
|
-
import { provideRouter, withComponentInputBinding } from '@angular/router'; // Import this
|
|
24
|
-
import { routes } from './app.routes';
|
|
25
|
-
|
|
26
|
-
export const appConfig: ApplicationConfig = {
|
|
27
|
-
providers: [
|
|
28
|
-
provideRouter(routes, withComponentInputBinding()), // Add this function
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
### 1. Main Layout Configuration
|
|
36
|
-
|
|
37
|
-
You can use the `MainLayoutComponent` as a shell for your application. Define the Sidebar items directly in your route configuration using the `data` property.
|
|
38
|
-
|
|
39
|
-
**`src/app/app.routes.ts`**
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import { Routes } from '@angular/router';
|
|
43
|
-
import { MainLayoutComponent } from 'intern-hub-layout'; // Import from library
|
|
44
|
-
|
|
45
|
-
export const routes: Routes = [
|
|
46
|
-
{
|
|
47
|
-
path: '',
|
|
48
|
-
component: MainLayoutComponent,
|
|
49
|
-
// Configure Sidebar Items here
|
|
50
|
-
data: {
|
|
51
|
-
sidebarItems: [
|
|
52
|
-
{ icon: 'dsi-home-01-line', content: 'Home' },
|
|
53
|
-
{ icon: 'dsi-map-01-line', content: 'Roadmap' },
|
|
54
|
-
{ icon: 'dsi-file-01-line', content: 'Documents' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
// Your application pages go here
|
|
58
|
-
children: [
|
|
59
|
-
{
|
|
60
|
-
path: '',
|
|
61
|
-
loadComponent: () => import('./home/home.component').then((m) => m.HomeComponent),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 2. Using Shared Components
|
|
69
|
-
|
|
70
|
-
You can import individual components from the library.
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
import { Component } from '@angular/core';
|
|
74
|
-
import { ButtonContainerComponent, InputTextComponent } from 'intern-hub-layout';
|
|
75
|
-
|
|
76
|
-
@Component({
|
|
77
|
-
selector: 'app-example',
|
|
78
|
-
standalone: true,
|
|
79
|
-
imports: [ButtonContainerComponent, InputTextComponent],
|
|
80
|
-
template: `
|
|
81
|
-
<app-button-container content="Click Me"></app-button-container>
|
|
82
|
-
<app-input-text placeholder="Enter name"></app-input-text>
|
|
83
|
-
`,
|
|
84
|
-
})
|
|
85
|
-
export class ExampleComponent {}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Available Components
|
|
89
|
-
|
|
90
|
-
### Layouts
|
|
91
|
-
|
|
92
|
-
- `MainLayoutComponent`: Full application shell with Sidebar and Header.
|
|
93
|
-
- `SidebarComponent`: Standalone sidebar.
|
|
94
|
-
- `HeaderComponent`: Standalone header.
|
|
95
|
-
|
|
96
|
-
### Shared UI
|
|
97
|
-
|
|
98
|
-
- **Buttons**: `ButtonContainerComponent`, `LabelButtonComponent`
|
|
99
|
-
- **Inputs**: `InputTextComponent`, `InputStepperComponent`, `InputCalendarComponent`
|
|
100
|
-
- **Tables**: `TableHeaderComponent`, `TableBodyComponent`
|
|
101
|
-
- **Other**: `ApprovalListComponent`, `PopUpConfirmComponent`
|
|
102
|
-
|
|
103
|
-
## Author
|
|
104
|
-
|
|
105
|
-
Intern Hub Team
|
|
106
|
-
|
|
107
|
-
## Component API Reference
|
|
108
|
-
|
|
109
|
-
### 1. `MainLayoutComponent`
|
|
110
|
-
|
|
111
|
-
The main application shell.
|
|
112
|
-
|
|
113
|
-
- **Inputs**:
|
|
114
|
-
- `sidebarItems: SidebarItem[]`: List of items to display in the sidebar.
|
|
115
|
-
|
|
116
|
-
#### Interface `SidebarItem`
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
interface SidebarItem {
|
|
120
|
-
icon: string;
|
|
121
|
-
content: string;
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### 2. `ButtonContainerComponent`
|
|
128
|
-
|
|
129
|
-
A container for standard buttons.
|
|
130
|
-
|
|
131
|
-
- **Selector**: `app-button-container`
|
|
132
|
-
- **Inputs**:
|
|
133
|
-
- `size: 'xs' | 'sm' | 'md' | 'lg'`: Size of the button (default: `'md'`).
|
|
134
|
-
- `content: string`: Text content of the button.
|
|
135
|
-
- `leftIcon: string`: CSS class or content for left icon.
|
|
136
|
-
- `rightIcon: string`: CSS class or content for right icon.
|
|
137
|
-
- `color: string`: Text color (default: `var(--brand-100)`).
|
|
138
|
-
- `backgroundColor: string`: Background color (default: `var(--utility-900)`).
|
|
139
|
-
- `borderColor: string`: Border color (default: `var(--brand-100)`).
|
|
140
|
-
- `fontSize: string`: Custom font size.
|
|
141
|
-
- **Outputs**:
|
|
142
|
-
- `buttonClick`: Event emitted when button is clicked.
|
|
143
|
-
|
|
144
|
-
### 3. `LabelButtonComponent`
|
|
145
|
-
|
|
146
|
-
A small button-like label.
|
|
147
|
-
|
|
148
|
-
- **Selector**: `app-label-button`
|
|
149
|
-
- **Inputs**:
|
|
150
|
-
- `label: string`: Text content.
|
|
151
|
-
- `bgColor: string`: Background color.
|
|
152
|
-
- `borderColor: string`: Border color.
|
|
153
|
-
- `textColor: string`: Text color.
|
|
154
|
-
- `width: string`: Width of the component (default: `100%`).
|
|
155
|
-
- `height: string`: Height of the component (default: `28px`).
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### 4. `InputTextComponent`
|
|
160
|
-
|
|
161
|
-
Standard text input field.
|
|
162
|
-
|
|
163
|
-
- **Selector**: `app-input-text`
|
|
164
|
-
- **Inputs**:
|
|
165
|
-
- `headerInput: string`: Label text above the input.
|
|
166
|
-
- `placeholder: string`: Placeholder text.
|
|
167
|
-
- `value: string`: Initial value (supports binding).
|
|
168
|
-
- `readonly: boolean`: If true, input is read-only.
|
|
169
|
-
- `required: boolean`: If true, shows required asterisk.
|
|
170
|
-
- `width: string`: Width of the input container (default: `100%`).
|
|
171
|
-
- `maxLength: number`: Maximum character length.
|
|
172
|
-
- `showLimit: boolean`: Whether to show character count.
|
|
173
|
-
- `icon: string`: Icon class to display inside input.
|
|
174
|
-
- `typeInput: string`: Input type (e.g., `'text'`, `'password'`).
|
|
175
|
-
- **Outputs**:
|
|
176
|
-
- `valueChange`: Emits new value on input.
|
|
177
|
-
- `iconClick`: Emits when the icon is clicked.
|
|
178
|
-
|
|
179
|
-
### 5. `InputStepperComponent`
|
|
180
|
-
|
|
181
|
-
Number input with increment/decrement buttons.
|
|
182
|
-
|
|
183
|
-
- **Selector**: `app-input-stepper`
|
|
184
|
-
- **Inputs**:
|
|
185
|
-
- `headerInput`: Label text.
|
|
186
|
-
- `value: number`: Initial value.
|
|
187
|
-
- `min`: Minimum value (default: 0).
|
|
188
|
-
- `max`: Maximum value (default: 100).
|
|
189
|
-
- `step`: Step value (default: 1).
|
|
190
|
-
- `state`: Visual state (`'default'`, `'negative'`, `'positive'`).
|
|
191
|
-
- `helperText`: Text displayed below the input.
|
|
192
|
-
- `readonly`, `required`, `disabled`, `width`.
|
|
193
|
-
- **Outputs**:
|
|
194
|
-
- `valueChange`: Emits new numeric value.
|
|
195
|
-
|
|
196
|
-
### 6. `InputCalendarComponent`
|
|
197
|
-
|
|
198
|
-
Date picker input.
|
|
199
|
-
|
|
200
|
-
- **Selector**: `app-input-calendar`
|
|
201
|
-
- **Inputs**:
|
|
202
|
-
- `headerInput`: Label text.
|
|
203
|
-
- `value: string`: Date value in ISO format (`yyyy-mm-dd`).
|
|
204
|
-
- `placeholder`: Placeholder text (default: `'dd/mm/yyyy'`).
|
|
205
|
-
- `readonly`, `required`, `width`.
|
|
206
|
-
- **Outputs**:
|
|
207
|
-
- `valueChange`: Emits selected date in ISO format.
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
### 7. `TableHeaderComponent`
|
|
212
|
-
|
|
213
|
-
Renders table headers.
|
|
214
|
-
|
|
215
|
-
- **Selector**: `tr[app-table-header]` (Attribute on `<tr>`)
|
|
216
|
-
- **Inputs**:
|
|
217
|
-
- `columns: ColumnConfig[]`: Array of column configurations.
|
|
218
|
-
- `backgroundColor`: Header background color.
|
|
219
|
-
- `textColor`: Text color (default: white).
|
|
220
|
-
- `headerIconLeft`, `headerIconRight`: Icons for header cells.
|
|
221
|
-
|
|
222
|
-
#### Interface `ColumnConfig`
|
|
223
|
-
|
|
224
|
-
```typescript
|
|
225
|
-
interface ColumnConfig {
|
|
226
|
-
header: string; // Display text
|
|
227
|
-
key: string; // Data key
|
|
228
|
-
width: string; // CSS width
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### 8. `TableBodyComponent`
|
|
233
|
-
|
|
234
|
-
Renders table rows.
|
|
235
|
-
|
|
236
|
-
- **Selector**: `tbody[app-table-body]` (Attribute on `<tbody>`)
|
|
237
|
-
- **Inputs**:
|
|
238
|
-
- `rows: any[]`: Array of data objects.
|
|
239
|
-
- `columns: ColumnConfig[]`: Column configuration to map data.
|
|
240
|
-
- `columnTemplates`: Object mapping column keys to `TemplateRef` for custom cell rendering.
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
### 9. `ApprovalListComponent`
|
|
245
|
-
|
|
246
|
-
A list component showing approval items.
|
|
247
|
-
|
|
248
|
-
- **Selector**: `app-approval-list`
|
|
249
|
-
- **Inputs**:
|
|
250
|
-
- `rows: ApprovalListItemInterface[]`: List of items.
|
|
251
|
-
- `headerContentLeft`: Text for left header.
|
|
252
|
-
- `headerContentRight`: Text for right header.
|
|
253
|
-
- `width`: Component width.
|
|
254
|
-
|
|
255
|
-
### 10. `PopUpConfirmComponent`
|
|
256
|
-
|
|
257
|
-
A confirmation modal.
|
|
258
|
-
|
|
259
|
-
- **Selector**: `app-pop-up-confirm`
|
|
260
|
-
- **Inputs**:
|
|
261
|
-
- `title`: Popup title.
|
|
262
|
-
- `content`: Message body.
|
|
263
|
-
- `imgUrl`: Icon/Image URL.
|
|
264
|
-
- `colorButton`: Color of the confirm button.
|
|
265
|
-
- **Outputs**:
|
|
266
|
-
- `confirmClick`: Emits when confirmed.
|
|
267
|
-
- `cancelClick`: Emits when canceled.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|