@haloduck/util 2.0.0 → 2.0.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 +19 -93
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
# @haloduck/util
|
|
2
2
|
|
|
3
|
-
HaloDuck Util Library
|
|
3
|
+
HaloDuck Util Library is a utility functions and services library for Angular-based applications.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @haloduck/util
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Key Features
|
|
12
12
|
|
|
13
|
-
###
|
|
14
|
-
- **download**:
|
|
13
|
+
### File Utilities
|
|
14
|
+
- **download**: File download function
|
|
15
15
|
|
|
16
|
-
###
|
|
17
|
-
- **hasRequired**:
|
|
18
|
-
- **hasError**:
|
|
19
|
-
- **getDirtyValues**:
|
|
20
|
-
- **englishAndNumberOnlyValidator**:
|
|
16
|
+
### Form Utilities
|
|
17
|
+
- **hasRequired**: Check required field validation
|
|
18
|
+
- **hasError**: Check form error status
|
|
19
|
+
- **getDirtyValues**: Extract only changed form values
|
|
20
|
+
- **englishAndNumberOnlyValidator**: Validator that allows only English and numbers
|
|
21
21
|
|
|
22
|
-
###
|
|
23
|
-
- **UtilService**:
|
|
24
|
-
- **provideHaloduckUtilIconSet**:
|
|
22
|
+
### Services
|
|
23
|
+
- **UtilService**: File icon URL provider service
|
|
24
|
+
- **provideHaloduckUtilIconSet**: File icon configuration provider
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Usage
|
|
27
27
|
|
|
28
|
-
###
|
|
28
|
+
### Basic Configuration
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
31
|
export const appConfig: ApplicationConfig = {
|
|
@@ -41,89 +41,15 @@ export const appConfig: ApplicationConfig = {
|
|
|
41
41
|
};
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { download } from '@haloduck/util';
|
|
48
|
-
|
|
49
|
-
// 파일 다운로드
|
|
50
|
-
download('https://example.com/file.pdf');
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 폼 유틸리티 사용
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import {
|
|
57
|
-
hasRequired,
|
|
58
|
-
hasError,
|
|
59
|
-
getDirtyValues,
|
|
60
|
-
englishAndNumberOnlyValidator
|
|
61
|
-
} from '@haloduck/util';
|
|
62
|
-
|
|
63
|
-
@Component({...})
|
|
64
|
-
export class MyComponent {
|
|
65
|
-
form = new FormGroup({
|
|
66
|
-
name: new FormControl('', [englishAndNumberOnlyValidator]),
|
|
67
|
-
email: new FormControl('', [Validators.required, Validators.email])
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
checkField() {
|
|
71
|
-
const nameControl = this.form.get('name');
|
|
72
|
-
|
|
73
|
-
// 필수 필드인지 확인
|
|
74
|
-
console.log(hasRequired(nameControl));
|
|
75
|
-
|
|
76
|
-
// 에러가 있는지 확인
|
|
77
|
-
console.log(hasError(nameControl, 'pattern'));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
submitForm() {
|
|
81
|
-
// 변경된 값만 추출
|
|
82
|
-
const dirtyValues = getDirtyValues(this.form);
|
|
83
|
-
console.log(dirtyValues);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 파일 아이콘 서비스
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
import {
|
|
92
|
-
UtilService,
|
|
93
|
-
provideHaloduckUtilIconSet
|
|
94
|
-
} from '@haloduck/util';
|
|
95
|
-
|
|
96
|
-
// 앱 설정에서 아이콘 설정 제공
|
|
97
|
-
export const appConfig: ApplicationConfig = {
|
|
98
|
-
providers: [
|
|
99
|
-
provideHaloduckUtilIconSet({
|
|
100
|
-
default: '/app/images/default-file-preview.svg',
|
|
101
|
-
stl: '/app/images/default-stl-preview.svg',
|
|
102
|
-
pdf: '/app/images/default-pdf-preview.svg',
|
|
103
|
-
}),
|
|
104
|
-
],
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// 컴포넌트에서 사용
|
|
108
|
-
@Component({...})
|
|
109
|
-
export class FileComponent {
|
|
110
|
-
constructor(private utilService: UtilService) {}
|
|
111
|
-
|
|
112
|
-
getFileIcon(filename: string) {
|
|
113
|
-
return this.utilService.getFileIconUrl(filename);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## 의존성
|
|
44
|
+
## Dependencies
|
|
119
45
|
|
|
120
46
|
- Angular 19.2.0+
|
|
121
47
|
- Angular Forms 19.2.0+
|
|
122
48
|
|
|
123
|
-
##
|
|
49
|
+
## License
|
|
124
50
|
|
|
125
51
|
MIT License
|
|
126
52
|
|
|
127
|
-
##
|
|
53
|
+
## Support
|
|
128
54
|
|
|
129
|
-
|
|
55
|
+
If you have any issues or questions, please register
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haloduck/util",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "HaloDuck Util Library - Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"prepublishOnly": "npm run build:prod"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@angular/common": "^
|
|
45
|
-
"@angular/core": "^
|
|
46
|
-
"@angular/forms": "^
|
|
44
|
+
"@angular/common": "^20.0.0",
|
|
45
|
+
"@angular/core": "^20.0.0",
|
|
46
|
+
"@angular/forms": "^20.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"tslib": "^2.3.0"
|