@geoit/ui 0.0.2 → 0.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/README.md +148 -12
- package/ai/AGENTS.md +5 -4
- package/ai/README.md +2 -2
- package/ai/catalog.json +3064 -424
- package/ai/components/geo-alert.md +75 -21
- package/ai/components/geo-back-button.md +64 -18
- package/ai/components/geo-breadcrumb.md +71 -12
- package/ai/components/geo-button.md +90 -27
- package/ai/components/geo-checkbox.md +69 -20
- package/ai/components/geo-column-picker.md +91 -18
- package/ai/components/geo-confirm-modal.md +93 -27
- package/ai/components/geo-date-picker.md +103 -29
- package/ai/components/geo-date-range-picker.md +99 -28
- package/ai/components/geo-file-picker.md +97 -26
- package/ai/components/geo-form-modal.md +112 -44
- package/ai/components/geo-icon.md +70 -16
- package/ai/components/geo-input.md +92 -29
- package/ai/components/geo-page-title.md +62 -16
- package/ai/components/geo-pagination.md +79 -24
- package/ai/components/geo-radio.md +108 -27
- package/ai/components/geo-row-actions.md +87 -19
- package/ai/components/geo-select.md +106 -28
- package/ai/components/geo-slider.md +72 -21
- package/ai/components/geo-status-tag.md +67 -15
- package/ai/components/geo-step-form-layout.md +122 -38
- package/ai/components/geo-stepper.md +82 -19
- package/ai/components/geo-table-filter.md +91 -29
- package/ai/components/geo-table-pagination.md +73 -23
- package/ai/components/geo-table-toolbar.md +84 -29
- package/ai/components/geo-table.md +194 -59
- package/ai/components/geo-tabs.md +101 -27
- package/ai/components/geo-textarea.md +82 -23
- package/ai/components/geo-toast.md +138 -27
- package/ai/components/geo-tree.md +96 -22
- package/ai/components/geo-typography.md +70 -19
- package/ai/components/geo-upload.md +110 -39
- package/ai/recipes.md +76 -4
- package/package.json +1 -1
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
# geo-toast
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Complete usage reference for **GeoToastComponent** (`@geoit/ui`)
|
|
4
|
+
>
|
|
5
|
+
> Read this file before using the component. Use **only** the Inputs/Outputs listed here.
|
|
4
6
|
|
|
5
7
|
## Summary
|
|
6
8
|
Toast UI; prefer GeoToastService for app-wide notifications.
|
|
7
9
|
|
|
8
10
|
## Import
|
|
11
|
+
|
|
9
12
|
```ts
|
|
10
|
-
import { GeoToastComponent } from '@geoit/ui';
|
|
13
|
+
import { GeoToastComponent, GeoToastService } from '@geoit/ui';
|
|
14
|
+
// Inject GeoToastService via constructor — providedIn: 'root'
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Add to the consuming standalone component:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
imports: [GeoToastComponent]
|
|
21
|
+
```
|
|
14
22
|
|
|
15
23
|
## Selector
|
|
16
24
|
`geo-toast`
|
|
@@ -24,38 +32,141 @@ Transient success/error after actions.
|
|
|
24
32
|
## Do not use when
|
|
25
33
|
Persistent inline messages — use geo-alert.
|
|
26
34
|
|
|
35
|
+
## How to use
|
|
36
|
+
|
|
37
|
+
Thông báo tạm thời. Ưu tiên inject GeoToastService (success/error/warning/info). Component geo-toast chỉ khi cần render tĩnh.
|
|
38
|
+
|
|
39
|
+
## Binding
|
|
40
|
+
|
|
41
|
+
Standalone presentational / container component — drive via Inputs and Outputs (no `ngModel` unless documented).
|
|
42
|
+
|
|
27
43
|
## Inputs
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
44
|
+
|
|
45
|
+
Every supported Input (do not invent others):
|
|
46
|
+
|
|
47
|
+
| Input | Type | Default | Description |
|
|
48
|
+
|-------|------|---------|-------------|
|
|
49
|
+
| `type` | `'success' \| 'error' \| 'warning' \| 'info'` | `'info'` | — |
|
|
50
|
+
| `title` | `string` | `''` | — |
|
|
51
|
+
| `message` | `string` | `''` | — |
|
|
52
|
+
| `closable` | `boolean` | `true` | — |
|
|
53
|
+
| `showIcon` | `boolean` | `true` | — |
|
|
54
|
+
| `visible` | `boolean` | `true` | — |
|
|
55
|
+
| `icon` | `string` | — | Override Ant Design icon type. |
|
|
37
56
|
|
|
38
57
|
## Outputs
|
|
39
|
-
| Output | Notes |
|
|
40
|
-
|--------|-------|
|
|
41
|
-
| `closed` | EventEmitter |
|
|
42
58
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
| Output | Payload | Description |
|
|
60
|
+
|--------|---------|-------------|
|
|
61
|
+
| `closed` | `EventEmitter<void>` | — |
|
|
62
|
+
|
|
63
|
+
## Related types
|
|
64
|
+
|
|
65
|
+
From `figma/geo-toast/geo-toast.types.ts`:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
export interface GeoToastOptions {
|
|
69
|
+
/** Auto close duration (ms). `0` = không tự đóng. Default `4500`. */
|
|
70
|
+
duration?: number;
|
|
71
|
+
/** Vị trí toast. Default `topRight`. */
|
|
72
|
+
placement?: GeoToastPlacement;
|
|
73
|
+
/** Pause countdown khi hover. Default `true`. */
|
|
74
|
+
pauseOnHover?: boolean;
|
|
75
|
+
/** Animate enter/leave. Default `true`. */
|
|
76
|
+
animate?: boolean;
|
|
77
|
+
/** Unique key — toast cùng key sẽ được thay thế. */
|
|
78
|
+
key?: string;
|
|
79
|
+
/** Hiện icon trạng thái. Default `true`. */
|
|
80
|
+
showIcon?: boolean;
|
|
81
|
+
/** Hiện nút đóng. Default `true`. */
|
|
82
|
+
closable?: boolean;
|
|
83
|
+
/** Custom icon type (Ant Design). */
|
|
84
|
+
icon?: string;
|
|
85
|
+
/** Inline style trên notice. */
|
|
86
|
+
style?: NgStyleInterface;
|
|
87
|
+
/** Extra CSS class. */
|
|
88
|
+
className?: NgClassInterface | string;
|
|
89
|
+
/** Arbitrary data gắn vào notice. */
|
|
90
|
+
data?: unknown;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface GeoToastConfig extends GeoToastOptions {
|
|
94
|
+
type: GeoToastType;
|
|
95
|
+
title?: string;
|
|
96
|
+
message?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface GeoToastGlobalConfig {
|
|
100
|
+
duration?: number;
|
|
101
|
+
placement?: GeoToastPlacement;
|
|
102
|
+
pauseOnHover?: boolean;
|
|
103
|
+
animate?: boolean;
|
|
104
|
+
maxStack?: number;
|
|
105
|
+
top?: number;
|
|
106
|
+
bottom?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type GeoToastType = 'success' | 'error' | 'warning' | 'info';
|
|
47
110
|
|
|
48
|
-
|
|
49
|
-
<geo-toast type="success" title="Thành công!" message="Đã lưu."></geo-toast>
|
|
111
|
+
export type GeoToastPlacement = NzNotificationPlacement;
|
|
50
112
|
```
|
|
51
113
|
|
|
114
|
+
## Examples
|
|
115
|
+
|
|
116
|
+
### Service (preferred)
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { GeoToastService } from '@geoit/ui';
|
|
120
|
+
|
|
121
|
+
constructor(private toast: GeoToastService) {}
|
|
122
|
+
|
|
123
|
+
save(): void {
|
|
124
|
+
this.toast.success('Thành công!', 'Đã lưu hồ sơ.');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
fail(): void {
|
|
128
|
+
this.toast.error('Lỗi!', 'Không thể lưu.', { duration: 0 });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
warn(): void {
|
|
132
|
+
this.toast.warning('Cảnh báo!', 'Dữ liệu chưa đầy đủ.');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
info(): void {
|
|
136
|
+
this.toast.info('Thông báo', 'Hệ thống sẽ bảo trì lúc 22:00.');
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Static template
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<geo-toast
|
|
144
|
+
type="success"
|
|
145
|
+
title="Thành công!"
|
|
146
|
+
message="Đã lưu."
|
|
147
|
+
[closable]="true"
|
|
148
|
+
[showIcon]="true"
|
|
149
|
+
[visible]="true"
|
|
150
|
+
></geo-toast>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Tips
|
|
154
|
+
|
|
155
|
+
- Inline persistent → geo-alert.
|
|
156
|
+
- duration: 0 để toast không tự đóng.
|
|
157
|
+
- Import GeoToastService từ @geoit/ui (providedIn root).
|
|
158
|
+
## Related components
|
|
159
|
+
|
|
160
|
+
- [`geo-alert`](./geo-alert.md)
|
|
161
|
+
- [`geo-confirm-modal`](./geo-confirm-modal.md)
|
|
162
|
+
## Package path
|
|
163
|
+
`node_modules/@geoit/ui/ai/components/geo-toast.md`
|
|
164
|
+
|
|
52
165
|
## Source
|
|
53
166
|
`projects/geo-ui/src/lib/figma/geo-toast/geo-toast.component.ts`
|
|
54
167
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Rules for AI
|
|
59
|
-
- Prefer this component over raw ng-zorro / HTML equivalents for the same UI role.
|
|
168
|
+
## Rules for AI / consumers
|
|
169
|
+
- Prefer this component over raw ng-zorro / HTML for the same UI role.
|
|
60
170
|
- Use design tokens (`var(--geo-*)`) — never hardcode brand colors or radius.
|
|
61
|
-
- Match props to
|
|
171
|
+
- Match props exactly to the Inputs table; do not invent unsupported inputs.
|
|
172
|
+
- Copy examples and adapt labels/bindings only.
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
# geo-tree
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Complete usage reference for **GeoTreeComponent** (`@geoit/ui`)
|
|
4
|
+
>
|
|
5
|
+
> Read this file before using the component. Use **only** the Inputs/Outputs listed here.
|
|
4
6
|
|
|
5
7
|
## Summary
|
|
6
8
|
Tree view with checkable / expandable nodes.
|
|
7
9
|
|
|
8
10
|
## Import
|
|
11
|
+
|
|
9
12
|
```ts
|
|
10
13
|
import { GeoTreeComponent } from '@geoit/ui';
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Add to the consuming standalone component:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
imports: [GeoTreeComponent]
|
|
20
|
+
```
|
|
14
21
|
|
|
15
22
|
## Selector
|
|
16
23
|
`geo-tree`
|
|
@@ -24,35 +31,102 @@ Hierarchy selection (org, folder, category).
|
|
|
24
31
|
## Do not use when
|
|
25
32
|
Flat lists — use geo-table or select.
|
|
26
33
|
|
|
34
|
+
## How to use
|
|
35
|
+
|
|
36
|
+
Cây phân cấp. [nodes] GeoTreeNode[]; bật checkable + [(checkedKeys)]; [(expandedKeys)]; (nodeClick).
|
|
37
|
+
|
|
38
|
+
## Binding
|
|
39
|
+
|
|
40
|
+
Standalone presentational / container component — drive via Inputs and Outputs (no `ngModel` unless documented).
|
|
41
|
+
|
|
27
42
|
## Inputs
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
43
|
+
|
|
44
|
+
Every supported Input (do not invent others):
|
|
45
|
+
|
|
46
|
+
| Input | Type | Default | Description |
|
|
47
|
+
|-------|------|---------|-------------|
|
|
48
|
+
| `nodes` | `GeoTreeNode[]` | `[]` | — |
|
|
49
|
+
| `checkable` | `boolean` | `false` | — |
|
|
50
|
+
| `checkedKeys` | `Array<string \| number>` | `[]` | — |
|
|
51
|
+
| `expandedKeys` | `Array<string \| number>` | `[]` | — |
|
|
52
|
+
| `showLine` | `boolean` | `false` | — |
|
|
53
|
+
| `blockNode` | `boolean` | `false` | — |
|
|
36
54
|
|
|
37
55
|
## Outputs
|
|
38
|
-
| Output | Notes |
|
|
39
|
-
|--------|-------|
|
|
40
|
-
| `checkedKeysChange` | EventEmitter |
|
|
41
|
-
| `expandedKeysChange` | EventEmitter |
|
|
42
|
-
| `nodeClick` | EventEmitter |
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
| Output | Payload | Description |
|
|
58
|
+
|--------|---------|-------------|
|
|
59
|
+
| `checkedKeysChange` | `EventEmitter<Array<string \| number>>` | — |
|
|
60
|
+
| `expandedKeysChange` | `EventEmitter<Array<string \| number>>` | — |
|
|
61
|
+
| `nodeClick` | `EventEmitter<NzFormatEmitEvent>` | — |
|
|
62
|
+
|
|
63
|
+
## Related types
|
|
64
|
+
|
|
65
|
+
From `figma/geo-tree/geo-tree.types.ts`:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
export interface GeoTreeNode {
|
|
69
|
+
key: string;
|
|
70
|
+
title: string;
|
|
71
|
+
expanded?: boolean;
|
|
72
|
+
children?: GeoTreeNode[];
|
|
73
|
+
isLeaf?: boolean;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
disableCheckbox?: boolean;
|
|
76
|
+
/** Payload tùy chọn (domain gắn data nghiệp vụ). */
|
|
77
|
+
data?: unknown;
|
|
78
|
+
[prop: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Examples
|
|
83
|
+
|
|
84
|
+
### Basic
|
|
85
|
+
|
|
45
86
|
```html
|
|
46
87
|
<geo-tree [nodes]="nodes" [checkable]="true" [(checkedKeys)]="checked"></geo-tree>
|
|
47
88
|
```
|
|
48
89
|
|
|
90
|
+
### Full options
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<geo-tree
|
|
94
|
+
[nodes]="[
|
|
95
|
+
{
|
|
96
|
+
title: 'Đơn vị gốc',
|
|
97
|
+
key: 'root',
|
|
98
|
+
children: [
|
|
99
|
+
{ title: 'Phòng A', key: 'a' },
|
|
100
|
+
{ title: 'Phòng B', key: 'b' }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]"
|
|
104
|
+
[checkable]="true"
|
|
105
|
+
[(checkedKeys)]="checkedKeys"
|
|
106
|
+
[(expandedKeys)]="expandedKeys"
|
|
107
|
+
[showLine]="true"
|
|
108
|
+
[blockNode]="true"
|
|
109
|
+
(nodeClick)="onNode($event)"
|
|
110
|
+
></geo-tree>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Tips
|
|
114
|
+
|
|
115
|
+
- nodes: { title, key, children? }[].
|
|
116
|
+
- showLine / blockNode theo design cần thiết.
|
|
117
|
+
- Không dùng thay select đơn giản.
|
|
118
|
+
## Related components
|
|
119
|
+
|
|
120
|
+
- [`geo-checkbox`](./geo-checkbox.md)
|
|
121
|
+
- [`geo-select`](./geo-select.md)
|
|
122
|
+
## Package path
|
|
123
|
+
`node_modules/@geoit/ui/ai/components/geo-tree.md`
|
|
124
|
+
|
|
49
125
|
## Source
|
|
50
126
|
`projects/geo-ui/src/lib/figma/geo-tree/geo-tree.component.ts`
|
|
51
127
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## Rules for AI
|
|
56
|
-
- Prefer this component over raw ng-zorro / HTML equivalents for the same UI role.
|
|
128
|
+
## Rules for AI / consumers
|
|
129
|
+
- Prefer this component over raw ng-zorro / HTML for the same UI role.
|
|
57
130
|
- Use design tokens (`var(--geo-*)`) — never hardcode brand colors or radius.
|
|
58
|
-
- Match props to
|
|
131
|
+
- Match props exactly to the Inputs table; do not invent unsupported inputs.
|
|
132
|
+
- Copy examples and adapt labels/bindings only.
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
# geo-typography
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Complete usage reference for **GeoTypographyComponent** (`@geoit/ui`)
|
|
4
|
+
>
|
|
5
|
+
> Read this file before using the component. Use **only** the Inputs/Outputs listed here.
|
|
4
6
|
|
|
5
7
|
## Summary
|
|
6
8
|
Text with GEO type scale (h1–tiny) and semantic colors.
|
|
7
9
|
|
|
8
10
|
## Import
|
|
11
|
+
|
|
9
12
|
```ts
|
|
10
13
|
import { GeoTypographyComponent } from '@geoit/ui';
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Add to the consuming standalone component:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
imports: [GeoTypographyComponent]
|
|
20
|
+
```
|
|
14
21
|
|
|
15
22
|
## Selector
|
|
16
23
|
`geo-typography`
|
|
@@ -24,34 +31,78 @@ All readable text; prefer over raw h1/p with custom CSS.
|
|
|
24
31
|
## Do not use when
|
|
25
32
|
Do not hardcode font-size/color — use variant/color props.
|
|
26
33
|
|
|
34
|
+
## How to use
|
|
35
|
+
|
|
36
|
+
Text theo type scale GEO. variant h1–h4|subtitle|body|body-small|caption|…; color semantic; strong/underline/mark/code.
|
|
37
|
+
|
|
38
|
+
## Binding
|
|
39
|
+
|
|
40
|
+
Standalone presentational / container component — drive via Inputs and Outputs (no `ngModel` unless documented).
|
|
41
|
+
|
|
27
42
|
## Inputs
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
43
|
+
|
|
44
|
+
Every supported Input (do not invent others):
|
|
45
|
+
|
|
46
|
+
| Input | Type | Default | Description |
|
|
47
|
+
|-------|------|---------|-------------|
|
|
48
|
+
| `variant` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'subtitle' \| 'body' \| 'body-small' \| 'caption' \| 'overline' \| 'tiny'` | `'body'` | Type scale variant from the design system. |
|
|
49
|
+
| `color` | `'default' \| 'secondary' \| 'primary' \| 'success' \| 'warning' \| 'danger' \| 'disabled'` | `'default'` | Semantic text color. |
|
|
50
|
+
| `strong` | `boolean` | `false` | Force bold weight (overrides variant weight when true). |
|
|
51
|
+
| `underline` | `boolean` | `false` | Underline text decoration. |
|
|
52
|
+
| `delete` | `boolean` | `false` | Strikethrough text decoration. |
|
|
53
|
+
| `mark` | `boolean` | `false` | Mark / highlight background. |
|
|
54
|
+
| `code` | `boolean` | `false` | Monospace code appearance. |
|
|
55
|
+
| `disabled` | `boolean` | `false` | Disabled appearance |
|
|
38
56
|
|
|
39
57
|
## Outputs
|
|
58
|
+
|
|
40
59
|
_None_
|
|
41
60
|
|
|
42
|
-
##
|
|
61
|
+
## Related types
|
|
62
|
+
|
|
63
|
+
From `figma/geo-typography/geo-typography.types.ts`:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
export type GeoTypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'subtitle' | 'body' | 'body-small' | 'caption' | 'overline' | 'tiny';
|
|
67
|
+
|
|
68
|
+
export type GeoTypographyColor = 'default' | 'secondary' | 'primary' | 'success' | 'warning' | 'danger' | 'disabled';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
### Basic
|
|
74
|
+
|
|
43
75
|
```html
|
|
44
76
|
<geo-typography variant="h3">Tiêu đề</geo-typography>
|
|
45
77
|
<geo-typography variant="body" color="secondary">Mô tả phụ</geo-typography>
|
|
46
78
|
```
|
|
47
79
|
|
|
80
|
+
### Full options
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<geo-typography variant="h4" [strong]="true">1. Thông tin cá nhân</geo-typography>
|
|
84
|
+
<geo-typography variant="body" color="primary" [underline]="true">Xem chi tiết</geo-typography>
|
|
85
|
+
<geo-typography variant="caption" color="danger">Trường bắt buộc</geo-typography>
|
|
86
|
+
<geo-typography variant="body-small" [code]="true">HS-2024-001</geo-typography>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Tips
|
|
90
|
+
|
|
91
|
+
- Tiêu đề trang có gạch nhấn → geo-page-title.
|
|
92
|
+
- color: default|secondary|primary|success|warning|danger|disabled.
|
|
93
|
+
- Không hardcode font-size — dùng variant.
|
|
94
|
+
## Related components
|
|
95
|
+
|
|
96
|
+
- [`geo-page-title`](./geo-page-title.md)
|
|
97
|
+
- [`geo-status-tag`](./geo-status-tag.md)
|
|
98
|
+
## Package path
|
|
99
|
+
`node_modules/@geoit/ui/ai/components/geo-typography.md`
|
|
100
|
+
|
|
48
101
|
## Source
|
|
49
102
|
`projects/geo-ui/src/lib/figma/geo-typography/geo-typography.component.ts`
|
|
50
103
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Rules for AI
|
|
55
|
-
- Prefer this component over raw ng-zorro / HTML equivalents for the same UI role.
|
|
104
|
+
## Rules for AI / consumers
|
|
105
|
+
- Prefer this component over raw ng-zorro / HTML for the same UI role.
|
|
56
106
|
- Use design tokens (`var(--geo-*)`) — never hardcode brand colors or radius.
|
|
57
|
-
- Match props to
|
|
107
|
+
- Match props exactly to the Inputs table; do not invent unsupported inputs.
|
|
108
|
+
- Copy examples and adapt labels/bindings only.
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
# geo-upload
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Complete usage reference for **GeoUploadComponent** (`@geoit/ui`)
|
|
4
|
+
>
|
|
5
|
+
> Read this file before using the component. Use **only** the Inputs/Outputs listed here.
|
|
4
6
|
|
|
5
7
|
## Summary
|
|
6
8
|
Drag-drop upload zone with progress list.
|
|
7
9
|
|
|
8
10
|
## Import
|
|
11
|
+
|
|
9
12
|
```ts
|
|
10
13
|
import { GeoUploadComponent } from '@geoit/ui';
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Add to the consuming standalone component:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
imports: [GeoUploadComponent]
|
|
20
|
+
```
|
|
14
21
|
|
|
15
22
|
## Selector
|
|
16
23
|
`geo-upload`
|
|
@@ -24,40 +31,70 @@ Multi-file upload with progress UI.
|
|
|
24
31
|
## Do not use when
|
|
25
32
|
Simple one-file form field — use geo-file-picker.
|
|
26
33
|
|
|
34
|
+
## How to use
|
|
35
|
+
|
|
36
|
+
Vùng kéo-thả upload + danh sách tiến độ. accept/maxSize; [(fileList)]; (change)/(remove)/(reject). Form gọn một file → geo-file-picker.
|
|
37
|
+
|
|
38
|
+
## Binding
|
|
39
|
+
|
|
40
|
+
Standalone presentational / container component — drive via Inputs and Outputs (no `ngModel` unless documented).
|
|
41
|
+
|
|
27
42
|
## Inputs
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
43
|
+
|
|
44
|
+
Every supported Input (do not invent others):
|
|
45
|
+
|
|
46
|
+
| Input | Type | Default | Description |
|
|
47
|
+
|-------|------|---------|-------------|
|
|
48
|
+
| `action` | `string \| ((file: NzUploadFile) => string \| Observable<string>)` | `''` | Upload endpoint — bỏ trống nếu dùng `customRequest` / chỉ chọn file local. |
|
|
49
|
+
| `accept` | `string` | `'.png,.jpg,.jpeg,.svg'` | — |
|
|
50
|
+
| `maxSize` | — | `1024 * 1024` | Max size (bytes). Default 1MB. `0` = không giới hạn. |
|
|
51
|
+
| `multiple` | `boolean` | `true` | — |
|
|
52
|
+
| `disabled` | `boolean` | `false` | — |
|
|
53
|
+
| `error` | `boolean` | `false` | — |
|
|
54
|
+
| `errorMessage` | `string` | `''` | — |
|
|
55
|
+
| `hint` | `string` | `'Chỉ cho phép file dạng .png, .jpg, .jpeg, .svg và dung lượng không quá 1Mb'` | — |
|
|
56
|
+
| `titlePrefix` | `string` | `'Kéo thả ảnh hoặc'` | — |
|
|
57
|
+
| `selectText` | `string` | `'Chọn file'` | — |
|
|
58
|
+
| `titleSuffix` | `string` | `'để tải lên'` | — |
|
|
59
|
+
| `listTitle` | `string` | `'Tập tin đính kèm'` | — |
|
|
60
|
+
| `showListTitle` | `boolean` | `true` | — |
|
|
61
|
+
| `fileList` | `GeoUploadFile[]` | `[]` | Controlled file list. |
|
|
62
|
+
| `headers` | `{} \| ((file: NzUploadFile) => {} \| Observable<{}>)` | — | — |
|
|
63
|
+
| `data` | `{} \| ((file: NzUploadFile) => {} \| Observable<{}>)` | — | — |
|
|
64
|
+
| `name` | `string` | `'file'` | — |
|
|
65
|
+
| `withCredentials` | `boolean` | `false` | — |
|
|
66
|
+
| `directory` | `boolean` | `false` | — |
|
|
67
|
+
| `customRequest` | `(item: NzUploadXHRArgs) => Subscription` | — | Custom XHR — mặc định simulate progress khi không có `action`. |
|
|
68
|
+
| `beforeUpload` | `( file: NzUploadFile, fileList: NzUploadFile[] )` | `> boolean \| Observable<boolean>` | — |
|
|
51
69
|
|
|
52
70
|
## Outputs
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
|
|
72
|
+
| Output | Payload | Description |
|
|
73
|
+
|--------|---------|-------------|
|
|
74
|
+
| `fileListChange` | `EventEmitter<GeoUploadFile[]>` | — |
|
|
75
|
+
| `change` | `EventEmitter<NzUploadChangeParam>` | — |
|
|
76
|
+
| `remove` | `EventEmitter<GeoUploadFile>` | — |
|
|
77
|
+
| `reject` | `EventEmitter<{ file: File; reason: 'type' \| 'size' }>` | — |
|
|
78
|
+
|
|
79
|
+
## Related types
|
|
80
|
+
|
|
81
|
+
From `figma/geo-upload/geo-upload.types.ts`:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
export interface GeoUploadFile extends NzUploadFile {
|
|
85
|
+
/** Bytes uploaded so far (for "100Kb / 200Kb"). */
|
|
86
|
+
loaded?: number;
|
|
87
|
+
/** Upload speed in bytes/sec (for "870kb/sec"). */
|
|
88
|
+
speed?: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type GeoUploadCustomRequest = (item: NzUploadXHRArgs) => Subscription;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Examples
|
|
95
|
+
|
|
96
|
+
### Basic
|
|
97
|
+
|
|
61
98
|
```html
|
|
62
99
|
<geo-upload
|
|
63
100
|
accept=".png,.jpg"
|
|
@@ -66,13 +103,47 @@ Simple one-file form field — use geo-file-picker.
|
|
|
66
103
|
></geo-upload>
|
|
67
104
|
```
|
|
68
105
|
|
|
106
|
+
### Full options
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<geo-upload
|
|
110
|
+
action="/api/upload"
|
|
111
|
+
accept=".png,.jpg,.jpeg,.svg,.pdf"
|
|
112
|
+
[maxSize]="2097152"
|
|
113
|
+
[multiple]="true"
|
|
114
|
+
[disabled]="false"
|
|
115
|
+
hint="Chỉ cho phép .png, .jpg, .pdf và dung lượng không quá 2Mb"
|
|
116
|
+
titlePrefix="Kéo thả ảnh hoặc"
|
|
117
|
+
selectText="Chọn file"
|
|
118
|
+
titleSuffix="để tải lên"
|
|
119
|
+
listTitle="Tập tin đính kèm"
|
|
120
|
+
[showListTitle]="true"
|
|
121
|
+
[(fileList)]="files"
|
|
122
|
+
(fileListChange)="onFiles($event)"
|
|
123
|
+
(change)="onUploadChange($event)"
|
|
124
|
+
(remove)="onRemove($event)"
|
|
125
|
+
(reject)="onReject($event)"
|
|
126
|
+
></geo-upload>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Tips
|
|
130
|
+
|
|
131
|
+
- maxSize tính bằng byte (mặc định 1MB).
|
|
132
|
+
- hint/titlePrefix/selectText/titleSuffix tiếng Việt tùy chỉnh.
|
|
133
|
+
- customRequest / beforeUpload khi cần upload tùy biến.
|
|
134
|
+
## Related components
|
|
135
|
+
|
|
136
|
+
- [`geo-file-picker`](./geo-file-picker.md)
|
|
137
|
+
- [`geo-form-modal`](./geo-form-modal.md)
|
|
138
|
+
- [`geo-button`](./geo-button.md)
|
|
139
|
+
## Package path
|
|
140
|
+
`node_modules/@geoit/ui/ai/components/geo-upload.md`
|
|
141
|
+
|
|
69
142
|
## Source
|
|
70
143
|
`projects/geo-ui/src/lib/figma/geo-upload/geo-upload.component.ts`
|
|
71
144
|
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
## Rules for AI
|
|
76
|
-
- Prefer this component over raw ng-zorro / HTML equivalents for the same UI role.
|
|
145
|
+
## Rules for AI / consumers
|
|
146
|
+
- Prefer this component over raw ng-zorro / HTML for the same UI role.
|
|
77
147
|
- Use design tokens (`var(--geo-*)`) — never hardcode brand colors or radius.
|
|
78
|
-
- Match props to
|
|
148
|
+
- Match props exactly to the Inputs table; do not invent unsupported inputs.
|
|
149
|
+
- Copy examples and adapt labels/bindings only.
|