@haloduck/util 1.0.0

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 ADDED
@@ -0,0 +1,127 @@
1
+ # @haloduck/util
2
+
3
+ HaloDuck Util Library는 Angular 기반 애플리케이션을 위한 유틸리티 함수 및 서비스 라이브러리입니다.
4
+
5
+ ## 설치
6
+
7
+ ```bash
8
+ npm install @haloduck/util
9
+ ```
10
+
11
+ ## 주요 기능
12
+
13
+ ### 파일 유틸리티
14
+ - **download**: 파일 다운로드 함수
15
+
16
+ ### 폼 유틸리티
17
+ - **hasRequired**: 필수 필드 검증 확인
18
+ - **hasError**: 폼 에러 상태 확인
19
+ - **getDirtyValues**: 변경된 폼 값만 추출
20
+ - **englishAndNumberOnlyValidator**: 영문과 숫자만 허용하는 검증기
21
+
22
+ ### 서비스
23
+ - **UtilService**: 파일 아이콘 URL 제공 서비스
24
+ - **provideHaloduckUtilIconSet**: 파일 아이콘 설정 제공자
25
+
26
+ ## 사용법
27
+
28
+ ### 기본 설정
29
+
30
+ ```typescript
31
+ import { NgModule } from '@angular/core';
32
+ import { UtilModule } from '@haloduck/util';
33
+
34
+ @NgModule({
35
+ imports: [
36
+ UtilModule
37
+ ]
38
+ })
39
+ export class AppModule { }
40
+ ```
41
+
42
+ ### 파일 다운로드
43
+
44
+ ```typescript
45
+ import { download } from '@haloduck/util';
46
+
47
+ // 파일 다운로드
48
+ download('https://example.com/file.pdf');
49
+ ```
50
+
51
+ ### 폼 유틸리티 사용
52
+
53
+ ```typescript
54
+ import {
55
+ hasRequired,
56
+ hasError,
57
+ getDirtyValues,
58
+ englishAndNumberOnlyValidator
59
+ } from '@haloduck/util';
60
+
61
+ @Component({...})
62
+ export class MyComponent {
63
+ form = new FormGroup({
64
+ name: new FormControl('', [englishAndNumberOnlyValidator]),
65
+ email: new FormControl('', [Validators.required, Validators.email])
66
+ });
67
+
68
+ checkField() {
69
+ const nameControl = this.form.get('name');
70
+
71
+ // 필수 필드인지 확인
72
+ console.log(hasRequired(nameControl));
73
+
74
+ // 에러가 있는지 확인
75
+ console.log(hasError(nameControl, 'pattern'));
76
+ }
77
+
78
+ submitForm() {
79
+ // 변경된 값만 추출
80
+ const dirtyValues = getDirtyValues(this.form);
81
+ console.log(dirtyValues);
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### 파일 아이콘 서비스
87
+
88
+ ```typescript
89
+ import {
90
+ UtilService,
91
+ provideHaloduckUtilIconSet
92
+ } from '@haloduck/util';
93
+
94
+ // 앱 설정에서 아이콘 설정 제공
95
+ export const appConfig: ApplicationConfig = {
96
+ providers: [
97
+ provideHaloduckUtilIconSet({
98
+ default: '/app/images/default-file-preview.svg',
99
+ stl: '/app/images/default-stl-preview.svg',
100
+ pdf: '/app/images/default-pdf-preview.svg',
101
+ }),
102
+ ],
103
+ };
104
+
105
+ // 컴포넌트에서 사용
106
+ @Component({...})
107
+ export class FileComponent {
108
+ constructor(private utilService: UtilService) {}
109
+
110
+ getFileIcon(filename: string) {
111
+ return this.utilService.getFileIconUrl(filename);
112
+ }
113
+ }
114
+ ```
115
+
116
+ ## 의존성
117
+
118
+ - Angular 19.2.0+
119
+ - Angular Forms 19.2.0+
120
+
121
+ ## 라이선스
122
+
123
+ MIT License
124
+
125
+ ## 지원
126
+
127
+ 이슈나 질문이 있으시면 [GitHub Issues](https://github.com/haloduck/haloduck-frontend/issues)에 등록해 주세요.
Binary file
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@haloduck/util",
3
+ "version": "1.0.0",
4
+ "description": "HaloDuck Util Library - Angular 기반 유틸리티 함수 및 서비스 라이브러리",
5
+ "keywords": ["angular", "haloduck", "util", "utility", "typescript", "forms", "file"],
6
+ "author": "HaloDuck",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/haloduck/haloduck-frontend.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/haloduck/haloduck-frontend/issues"
14
+ },
15
+ "homepage": "https://github.com/haloduck/haloduck-frontend#readme",
16
+ "main": "bundles/haloduck-util.umd.js",
17
+ "module": "fesm2022/haloduck-util.mjs",
18
+ "es2022": "fesm2022/haloduck-util.mjs",
19
+ "esm2022": "fesm2022/haloduck-util.mjs",
20
+ "fesm2022": "fesm2022/haloduck-util.mjs",
21
+ "typings": "index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "import": "./fesm2022/haloduck-util.mjs",
25
+ "require": "./bundles/haloduck-util.umd.js"
26
+ }
27
+ },
28
+ "scripts": {
29
+ "build": "ng build @haloduck/util",
30
+ "build:prod": "ng build @haloduck/util --configuration production",
31
+ "test": "ng test @haloduck/util",
32
+ "lint": "ng lint @haloduck/util",
33
+ "prepublishOnly": "npm run build:prod"
34
+ },
35
+ "peerDependencies": {
36
+ "@angular/common": "^19.2.0",
37
+ "@angular/core": "^19.2.0",
38
+ "@angular/forms": "^19.2.0"
39
+ },
40
+ "dependencies": {
41
+ "tslib": "^2.3.0"
42
+ },
43
+ "sideEffects": false,
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }