@ncds/ui-admin 1.6.3 → 1.6.4-alpha.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/mcp/bin/server.d.ts +1 -0
- package/mcp/bin/server.js +62 -0
- package/mcp/bin/server.mjs +14 -0
- package/mcp/bin/tools/getComponentHtml.d.ts +3 -0
- package/mcp/bin/tools/getComponentHtml.js +30 -0
- package/mcp/bin/tools/getComponentProps.d.ts +3 -0
- package/mcp/bin/tools/getComponentProps.js +16 -0
- package/mcp/bin/tools/listComponents.d.ts +3 -0
- package/mcp/bin/tools/listComponents.js +15 -0
- package/mcp/bin/tools/searchComponent.d.ts +3 -0
- package/mcp/bin/tools/searchComponent.js +20 -0
- package/mcp/bin/tools/validateHtml.d.ts +10 -0
- package/mcp/bin/tools/validateHtml.js +142 -0
- package/mcp/bin/types.d.ts +28 -0
- package/mcp/bin/types.js +5 -0
- package/mcp/bin/utils/dataLoader.d.ts +11 -0
- package/mcp/bin/utils/dataLoader.js +68 -0
- package/mcp/bin/utils/logger.d.ts +18 -0
- package/mcp/bin/utils/logger.js +27 -0
- package/mcp/bin/utils/response.d.ts +23 -0
- package/mcp/bin/utils/response.js +31 -0
- package/mcp/bin/version.d.ts +1 -0
- package/mcp/bin/version.js +4 -0
- package/mcp/data/.gitkeep +0 -0
- package/mcp/data/_meta.json +7 -0
- package/mcp/data/badge-group.json +73 -0
- package/mcp/data/badge.json +86 -0
- package/mcp/data/bread-crumb.json +22 -0
- package/mcp/data/breadcrumb.json +31 -0
- package/mcp/data/button-group.json +65 -0
- package/mcp/data/button.json +114 -0
- package/mcp/data/carousel-arrow.json +59 -0
- package/mcp/data/carousel-number-group.json +57 -0
- package/mcp/data/carousel.json +22 -0
- package/mcp/data/checkbox.json +31 -0
- package/mcp/data/combobox.json +114 -0
- package/mcp/data/date-picker.json +77 -0
- package/mcp/data/divider.json +56 -0
- package/mcp/data/dot.json +55 -0
- package/mcp/data/dropdown.json +81 -0
- package/mcp/data/empty-state.json +34 -0
- package/mcp/data/featured-icon.json +83 -0
- package/mcp/data/file-input.json +76 -0
- package/mcp/data/horizontal-tab.json +71 -0
- package/mcp/data/image-file-input.json +97 -0
- package/mcp/data/input.json +104 -0
- package/mcp/data/modal.json +85 -0
- package/mcp/data/notification.json +116 -0
- package/mcp/data/number-input.json +128 -0
- package/mcp/data/pagination.json +65 -0
- package/mcp/data/password-input.json +47 -0
- package/mcp/data/progress-bar.json +51 -0
- package/mcp/data/progress-circle.json +54 -0
- package/mcp/data/radio.json +31 -0
- package/mcp/data/range-date-picker-with-buttons.json +64 -0
- package/mcp/data/range-date-picker.json +55 -0
- package/mcp/data/select-dropdown.json +32 -0
- package/mcp/data/select.json +64 -0
- package/mcp/data/selectbox.json +129 -0
- package/mcp/data/slider.json +57 -0
- package/mcp/data/spinner.json +54 -0
- package/mcp/data/switch.json +71 -0
- package/mcp/data/tab.json +122 -0
- package/mcp/data/tag.json +66 -0
- package/mcp/data/textarea.json +88 -0
- package/mcp/data/toggle.json +59 -0
- package/mcp/data/tooltip.json +123 -0
- package/mcp/data/vertical-tab.json +64 -0
- package/mcp/templates/.mcp.json.example +8 -0
- package/mcp/templates/README.md +31 -0
- package/package.json +24 -3
- package/dist/cjs/assets/scripts/comboBox.js +0 -280
- package/dist/cjs/assets/scripts/datePicker.js +0 -706
- package/dist/cjs/assets/scripts/featuredIcon.js +0 -95
- package/dist/cjs/assets/scripts/fileInput/FileInput.js +0 -183
- package/dist/cjs/assets/scripts/fileInput/FileInputModel.js +0 -246
- package/dist/cjs/assets/scripts/fileInput/FileInputView.js +0 -455
- package/dist/cjs/assets/scripts/fileInput/const/classNames.js +0 -35
- package/dist/cjs/assets/scripts/fileInput/const/index.js +0 -27
- package/dist/cjs/assets/scripts/fileInput/const/types.js +0 -13
- package/dist/cjs/assets/scripts/fileInput/index.js +0 -44
- package/dist/cjs/assets/scripts/imageFileInput/ImageFileInput.js +0 -187
- package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputModel.js +0 -255
- package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputView.js +0 -354
- package/dist/cjs/assets/scripts/imageFileInput/const/classNames.js +0 -41
- package/dist/cjs/assets/scripts/imageFileInput/const/index.js +0 -27
- package/dist/cjs/assets/scripts/imageFileInput/const/types.js +0 -13
- package/dist/cjs/assets/scripts/imageFileInput/index.js +0 -44
- package/dist/cjs/assets/scripts/index.js +0 -30
- package/dist/cjs/assets/scripts/modal/Modal.js +0 -116
- package/dist/cjs/assets/scripts/modal/ModalActions.js +0 -128
- package/dist/cjs/assets/scripts/modal/ModalContent.js +0 -46
- package/dist/cjs/assets/scripts/modal/ModalHeader.js +0 -115
- package/dist/cjs/assets/scripts/modal/const/classNames.js +0 -41
- package/dist/cjs/assets/scripts/modal/const/index.js +0 -27
- package/dist/cjs/assets/scripts/modal/const/types.js +0 -5
- package/dist/cjs/assets/scripts/modal/index.js +0 -61
- package/dist/cjs/assets/scripts/modal/utils/contentUtils.js +0 -35
- package/dist/cjs/assets/scripts/notification/FloatingNotification.js +0 -180
- package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +0 -120
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +0 -146
- package/dist/cjs/assets/scripts/notification/Notification.js +0 -116
- package/dist/cjs/assets/scripts/notification/const/classNames.js +0 -50
- package/dist/cjs/assets/scripts/notification/const/icons.js +0 -45
- package/dist/cjs/assets/scripts/notification/const/index.js +0 -87
- package/dist/cjs/assets/scripts/notification/const/sizes.js +0 -54
- package/dist/cjs/assets/scripts/notification/const/types.js +0 -14
- package/dist/cjs/assets/scripts/notification/index.js +0 -92
- package/dist/cjs/assets/scripts/notification/utils.js +0 -92
- package/dist/cjs/assets/scripts/progress-bar/ProgressBar.js +0 -272
- package/dist/cjs/assets/scripts/progress-bar/index.js +0 -12
- package/dist/cjs/assets/scripts/selectBox.js +0 -319
- package/dist/cjs/assets/scripts/shared/ButtonCloseX.js +0 -46
- package/dist/cjs/assets/scripts/tab.js +0 -40
- package/dist/cjs/assets/scripts/tag/Tag.js +0 -268
- package/dist/cjs/assets/scripts/tag/const/classNames.js +0 -24
- package/dist/cjs/assets/scripts/tag/const/index.js +0 -38
- package/dist/cjs/assets/scripts/tag/const/sizes.js +0 -13
- package/dist/cjs/assets/scripts/tag/const/types.js +0 -5
- package/dist/cjs/assets/scripts/tag/index.js +0 -44
- package/dist/cjs/assets/scripts/tooltip/Tooltip.js +0 -380
- package/dist/cjs/assets/scripts/tooltip/TooltipLayerManager.js +0 -84
- package/dist/cjs/assets/scripts/tooltip/const/classNames.js +0 -29
- package/dist/cjs/assets/scripts/tooltip/const/constants.js +0 -56
- package/dist/cjs/assets/scripts/tooltip/const/icons.js +0 -15
- package/dist/cjs/assets/scripts/tooltip/const/index.js +0 -123
- package/dist/cjs/assets/scripts/tooltip/const/templates.js +0 -49
- package/dist/cjs/assets/scripts/tooltip/const/types.js +0 -5
- package/dist/cjs/assets/scripts/tooltip/index.js +0 -57
- package/dist/cjs/assets/scripts/tooltip/utils.js +0 -41
- package/dist/cjs/assets/scripts/utils/unifiedBox/DOMRenderer.js +0 -384
- package/dist/cjs/assets/scripts/utils/unifiedBox/DropdownModel.js +0 -368
- package/dist/cjs/assets/scripts/utils/unifiedBox/UnifiedBoxController.js +0 -681
- package/dist/cjs/assets/scripts/utils/unifiedBox/UnifiedBoxManager.js +0 -711
- package/dist/esm/assets/scripts/comboBox.js +0 -275
- package/dist/esm/assets/scripts/datePicker.js +0 -699
- package/dist/esm/assets/scripts/featuredIcon.js +0 -90
- package/dist/esm/assets/scripts/fileInput/FileInput.js +0 -178
- package/dist/esm/assets/scripts/fileInput/FileInputModel.js +0 -241
- package/dist/esm/assets/scripts/fileInput/FileInputView.js +0 -450
- package/dist/esm/assets/scripts/fileInput/const/classNames.js +0 -25
- package/dist/esm/assets/scripts/fileInput/const/index.js +0 -2
- package/dist/esm/assets/scripts/fileInput/const/types.js +0 -7
- package/dist/esm/assets/scripts/fileInput/index.js +0 -9
- package/dist/esm/assets/scripts/imageFileInput/ImageFileInput.js +0 -182
- package/dist/esm/assets/scripts/imageFileInput/ImageFileInputModel.js +0 -250
- package/dist/esm/assets/scripts/imageFileInput/ImageFileInputView.js +0 -349
- package/dist/esm/assets/scripts/imageFileInput/const/classNames.js +0 -30
- package/dist/esm/assets/scripts/imageFileInput/const/index.js +0 -2
- package/dist/esm/assets/scripts/imageFileInput/const/types.js +0 -7
- package/dist/esm/assets/scripts/imageFileInput/index.js +0 -9
- package/dist/esm/assets/scripts/index.js +0 -28
- package/dist/esm/assets/scripts/modal/Modal.js +0 -110
- package/dist/esm/assets/scripts/modal/ModalActions.js +0 -123
- package/dist/esm/assets/scripts/modal/ModalContent.js +0 -41
- package/dist/esm/assets/scripts/modal/ModalHeader.js +0 -110
- package/dist/esm/assets/scripts/modal/const/classNames.js +0 -31
- package/dist/esm/assets/scripts/modal/const/index.js +0 -2
- package/dist/esm/assets/scripts/modal/const/types.js +0 -1
- package/dist/esm/assets/scripts/modal/index.js +0 -15
- package/dist/esm/assets/scripts/modal/utils/contentUtils.js +0 -28
- package/dist/esm/assets/scripts/notification/FloatingNotification.js +0 -176
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +0 -115
- package/dist/esm/assets/scripts/notification/MessageNotification.js +0 -141
- package/dist/esm/assets/scripts/notification/Notification.js +0 -111
- package/dist/esm/assets/scripts/notification/const/classNames.js +0 -44
- package/dist/esm/assets/scripts/notification/const/icons.js +0 -39
- package/dist/esm/assets/scripts/notification/const/index.js +0 -4
- package/dist/esm/assets/scripts/notification/const/sizes.js +0 -48
- package/dist/esm/assets/scripts/notification/const/types.js +0 -8
- package/dist/esm/assets/scripts/notification/index.js +0 -11
- package/dist/esm/assets/scripts/notification/utils.js +0 -79
- package/dist/esm/assets/scripts/progress-bar/ProgressBar.js +0 -267
- package/dist/esm/assets/scripts/progress-bar/index.js +0 -1
- package/dist/esm/assets/scripts/selectBox.js +0 -314
- package/dist/esm/assets/scripts/shared/ButtonCloseX.js +0 -38
- package/dist/esm/assets/scripts/tab.js +0 -35
- package/dist/esm/assets/scripts/tag/Tag.js +0 -263
- package/dist/esm/assets/scripts/tag/const/classNames.js +0 -16
- package/dist/esm/assets/scripts/tag/const/index.js +0 -3
- package/dist/esm/assets/scripts/tag/const/sizes.js +0 -7
- package/dist/esm/assets/scripts/tag/const/types.js +0 -1
- package/dist/esm/assets/scripts/tag/index.js +0 -9
- package/dist/esm/assets/scripts/tooltip/Tooltip.js +0 -375
- package/dist/esm/assets/scripts/tooltip/TooltipLayerManager.js +0 -79
- package/dist/esm/assets/scripts/tooltip/const/classNames.js +0 -23
- package/dist/esm/assets/scripts/tooltip/const/constants.js +0 -50
- package/dist/esm/assets/scripts/tooltip/const/icons.js +0 -9
- package/dist/esm/assets/scripts/tooltip/const/index.js +0 -4
- package/dist/esm/assets/scripts/tooltip/const/templates.js +0 -42
- package/dist/esm/assets/scripts/tooltip/const/types.js +0 -1
- package/dist/esm/assets/scripts/tooltip/index.js +0 -10
- package/dist/esm/assets/scripts/tooltip/utils.js +0 -35
- package/dist/esm/assets/scripts/utils/unifiedBox/DOMRenderer.js +0 -379
- package/dist/esm/assets/scripts/utils/unifiedBox/DropdownModel.js +0 -363
- package/dist/esm/assets/scripts/utils/unifiedBox/UnifiedBoxController.js +0 -676
- package/dist/esm/assets/scripts/utils/unifiedBox/UnifiedBoxManager.js +0 -706
- package/dist/types/assets/scripts/comboBox.d.ts +0 -91
- package/dist/types/assets/scripts/datePicker.d.ts +0 -87
- package/dist/types/assets/scripts/featuredIcon.d.ts +0 -23
- package/dist/types/assets/scripts/fileInput/FileInput.d.ts +0 -67
- package/dist/types/assets/scripts/fileInput/FileInputModel.d.ts +0 -70
- package/dist/types/assets/scripts/fileInput/FileInputView.d.ts +0 -77
- package/dist/types/assets/scripts/fileInput/const/classNames.d.ts +0 -17
- package/dist/types/assets/scripts/fileInput/const/index.d.ts +0 -3
- package/dist/types/assets/scripts/fileInput/const/types.d.ts +0 -132
- package/dist/types/assets/scripts/fileInput/index.d.ts +0 -4
- package/dist/types/assets/scripts/imageFileInput/ImageFileInput.d.ts +0 -64
- package/dist/types/assets/scripts/imageFileInput/ImageFileInputModel.d.ts +0 -74
- package/dist/types/assets/scripts/imageFileInput/ImageFileInputView.d.ts +0 -80
- package/dist/types/assets/scripts/imageFileInput/const/classNames.d.ts +0 -20
- package/dist/types/assets/scripts/imageFileInput/const/index.d.ts +0 -3
- package/dist/types/assets/scripts/imageFileInput/const/types.d.ts +0 -126
- package/dist/types/assets/scripts/imageFileInput/index.d.ts +0 -4
- package/dist/types/assets/scripts/index.d.ts +0 -33
- package/dist/types/assets/scripts/modal/Modal.d.ts +0 -28
- package/dist/types/assets/scripts/modal/ModalActions.d.ts +0 -19
- package/dist/types/assets/scripts/modal/ModalContent.d.ts +0 -14
- package/dist/types/assets/scripts/modal/ModalHeader.d.ts +0 -16
- package/dist/types/assets/scripts/modal/const/classNames.d.ts +0 -23
- package/dist/types/assets/scripts/modal/const/index.d.ts +0 -3
- package/dist/types/assets/scripts/modal/const/types.d.ts +0 -62
- package/dist/types/assets/scripts/modal/index.d.ts +0 -8
- package/dist/types/assets/scripts/modal/utils/contentUtils.d.ts +0 -11
- package/dist/types/assets/scripts/notification/FloatingNotification.d.ts +0 -25
- package/dist/types/assets/scripts/notification/FullWidthNotification.d.ts +0 -22
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +0 -23
- package/dist/types/assets/scripts/notification/Notification.d.ts +0 -22
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +0 -44
- package/dist/types/assets/scripts/notification/const/icons.d.ts +0 -26
- package/dist/types/assets/scripts/notification/const/index.d.ts +0 -6
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +0 -33
- package/dist/types/assets/scripts/notification/const/types.d.ts +0 -20
- package/dist/types/assets/scripts/notification/index.d.ts +0 -8
- package/dist/types/assets/scripts/notification/utils.d.ts +0 -9
- package/dist/types/assets/scripts/progress-bar/ProgressBar.d.ts +0 -68
- package/dist/types/assets/scripts/progress-bar/index.d.ts +0 -2
- package/dist/types/assets/scripts/selectBox.d.ts +0 -77
- package/dist/types/assets/scripts/shared/ButtonCloseX.d.ts +0 -6
- package/dist/types/assets/scripts/tab.d.ts +0 -8
- package/dist/types/assets/scripts/tag/Tag.d.ts +0 -28
- package/dist/types/assets/scripts/tag/const/classNames.d.ts +0 -12
- package/dist/types/assets/scripts/tag/const/index.d.ts +0 -4
- package/dist/types/assets/scripts/tag/const/sizes.d.ts +0 -8
- package/dist/types/assets/scripts/tag/const/types.d.ts +0 -34
- package/dist/types/assets/scripts/tag/index.d.ts +0 -4
- package/dist/types/assets/scripts/tooltip/Tooltip.d.ts +0 -55
- package/dist/types/assets/scripts/tooltip/TooltipLayerManager.d.ts +0 -22
- package/dist/types/assets/scripts/tooltip/const/classNames.d.ts +0 -18
- package/dist/types/assets/scripts/tooltip/const/constants.d.ts +0 -34
- package/dist/types/assets/scripts/tooltip/const/icons.d.ts +0 -5
- package/dist/types/assets/scripts/tooltip/const/index.d.ts +0 -6
- package/dist/types/assets/scripts/tooltip/const/templates.d.ts +0 -17
- package/dist/types/assets/scripts/tooltip/const/types.d.ts +0 -15
- package/dist/types/assets/scripts/tooltip/index.d.ts +0 -7
- package/dist/types/assets/scripts/tooltip/utils.d.ts +0 -3
- package/dist/types/assets/scripts/utils/unifiedBox/DOMRenderer.d.ts +0 -108
- package/dist/types/assets/scripts/utils/unifiedBox/DropdownModel.d.ts +0 -158
- package/dist/types/assets/scripts/utils/unifiedBox/UnifiedBoxController.d.ts +0 -171
- package/dist/types/assets/scripts/utils/unifiedBox/UnifiedBoxManager.d.ts +0 -99
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
var __assign = this && this.__assign || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
return __assign.apply(this, arguments);
|
|
10
|
-
};
|
|
11
|
-
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
12
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
13
|
-
if (ar || !(i in from)) {
|
|
14
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
15
|
-
ar[i] = from[i];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
19
|
-
};
|
|
20
|
-
import { ImageFileInputErrorType } from './const/types';
|
|
21
|
-
var ImageFileInputModel = /** @class */function () {
|
|
22
|
-
function ImageFileInputModel(options) {
|
|
23
|
-
this.internalFiles = [];
|
|
24
|
-
this.initialFiles = []; // 초기 파일 목록 (렌더링 시점의 파일)
|
|
25
|
-
this.newlyAddedFiles = new Set(); // 새로 추가된 파일 추적
|
|
26
|
-
this.deletedInitialFiles = new Set(); // 삭제 표시된 초기 파일들 (파일명으로 추적)
|
|
27
|
-
this.options = __assign({
|
|
28
|
-
size: 'sm',
|
|
29
|
-
multiple: false,
|
|
30
|
-
buttonLabel: '파일 찾기',
|
|
31
|
-
imagePreviewTooltipLabel: '이미지 업로드',
|
|
32
|
-
disabled: false
|
|
33
|
-
}, options);
|
|
34
|
-
// 초기 파일 설정
|
|
35
|
-
if (this.options.value && this.options.value.length > 0) {
|
|
36
|
-
this.internalFiles = __spreadArray([], this.options.value, true);
|
|
37
|
-
// value로 들어온 File[]은 새로 추가된 파일로 처리 (initialFiles는 별도로 setFiles(UploadedFile[])로 설정)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 옵션 반환
|
|
42
|
-
*/
|
|
43
|
-
ImageFileInputModel.prototype.getOptions = function () {
|
|
44
|
-
return this.options;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* 현재 파일 목록 반환 (초기 파일 + 새로 추가된 파일, 삭제 표시된 파일 제외)
|
|
48
|
-
*/
|
|
49
|
-
ImageFileInputModel.prototype.getFiles = function () {
|
|
50
|
-
var _this = this;
|
|
51
|
-
var newFiles = this.options.value !== undefined ? this.options.value : this.internalFiles;
|
|
52
|
-
// UploadedFile을 File 객체로 변환 (삭제 표시되지 않은 것만)
|
|
53
|
-
var initialFilesAsFiles = this.initialFiles.filter(function (uploadedFile) {
|
|
54
|
-
return !_this.deletedInitialFiles.has(uploadedFile.fileName);
|
|
55
|
-
}).map(function (uploadedFile) {
|
|
56
|
-
// UploadedFile을 File 객체로 변환 (빈 데이터지만 이름과 타입 정보 유지)
|
|
57
|
-
var mimeType = _this.getMimeTypeFromFileName(uploadedFile.fileName);
|
|
58
|
-
return new File([], uploadedFile.fileName, {
|
|
59
|
-
type: mimeType
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
// 초기 파일 + 새로 추가된 파일 합치기
|
|
63
|
-
return __spreadArray(__spreadArray([], initialFilesAsFiles, true), newFiles, true);
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* 파일명에서 MIME 타입 추론
|
|
67
|
-
*/
|
|
68
|
-
ImageFileInputModel.prototype.getMimeTypeFromFileName = function (fileName) {
|
|
69
|
-
var _a;
|
|
70
|
-
var extension = (_a = fileName.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
71
|
-
var mimeTypes = {
|
|
72
|
-
jpg: 'image/jpeg',
|
|
73
|
-
jpeg: 'image/jpeg',
|
|
74
|
-
png: 'image/png',
|
|
75
|
-
gif: 'image/gif',
|
|
76
|
-
webp: 'image/webp',
|
|
77
|
-
svg: 'image/svg+xml',
|
|
78
|
-
bmp: 'image/bmp'
|
|
79
|
-
};
|
|
80
|
-
return mimeTypes[extension || ''] || 'application/octet-stream';
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* 초기 업로드된 파일 목록 설정 (UploadedFile[] 타입만 허용)
|
|
84
|
-
*/
|
|
85
|
-
ImageFileInputModel.prototype.setFiles = function (uploadedFiles) {
|
|
86
|
-
this.initialFiles = __spreadArray([], uploadedFiles, true);
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* 파일 추가
|
|
90
|
-
*/
|
|
91
|
-
ImageFileInputModel.prototype.addFiles = function (files) {
|
|
92
|
-
var _this = this;
|
|
93
|
-
// maxFileCount가 1이면 기존 파일 교체
|
|
94
|
-
if (this.options.maxFileCount === 1) {
|
|
95
|
-
// 기존 초기 파일들을 삭제 표시
|
|
96
|
-
this.initialFiles.forEach(function (uploadedFile) {
|
|
97
|
-
_this.deletedInitialFiles.add(uploadedFile.fileName);
|
|
98
|
-
});
|
|
99
|
-
// 새로 추가된 파일로 표시
|
|
100
|
-
files.forEach(function (file) {
|
|
101
|
-
return _this.newlyAddedFiles.add(file);
|
|
102
|
-
});
|
|
103
|
-
var isControlled_1 = this.options.value !== undefined;
|
|
104
|
-
if (isControlled_1) {
|
|
105
|
-
this.options.value = files;
|
|
106
|
-
} else {
|
|
107
|
-
this.internalFiles = files;
|
|
108
|
-
}
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
// getFiles()를 사용하지 않고 새로 추가된 파일만 관리
|
|
112
|
-
var currentNewFiles = this.options.value !== undefined ? this.options.value : this.internalFiles;
|
|
113
|
-
var newFiles = __spreadArray(__spreadArray([], currentNewFiles, true), files, true);
|
|
114
|
-
// 새로 추가된 파일로 표시
|
|
115
|
-
files.forEach(function (file) {
|
|
116
|
-
return _this.newlyAddedFiles.add(file);
|
|
117
|
-
});
|
|
118
|
-
var isControlled = this.options.value !== undefined;
|
|
119
|
-
if (isControlled) {
|
|
120
|
-
this.options.value = newFiles;
|
|
121
|
-
} else {
|
|
122
|
-
this.internalFiles = newFiles;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* 특정 인덱스의 파일 제거
|
|
127
|
-
*/
|
|
128
|
-
ImageFileInputModel.prototype.removeFile = function (index) {
|
|
129
|
-
var visibleFiles = this.getFiles(); // 현재 보이는 파일들
|
|
130
|
-
var fileToRemove = visibleFiles[index];
|
|
131
|
-
if (!fileToRemove) return;
|
|
132
|
-
// 초기 파일인지 확인
|
|
133
|
-
var isInitialFile = this.isInitialFile(fileToRemove);
|
|
134
|
-
if (isInitialFile) {
|
|
135
|
-
// 초기 파일: 삭제 표시만 함 (실제 제거하지 않음)
|
|
136
|
-
this.deletedInitialFiles.add(fileToRemove.name);
|
|
137
|
-
} else {
|
|
138
|
-
// 새로 추가된 파일: 실제 제거
|
|
139
|
-
var currentFiles = this.options.value !== undefined ? this.options.value : this.internalFiles;
|
|
140
|
-
var newFiles = currentFiles.filter(function (file) {
|
|
141
|
-
return file !== fileToRemove;
|
|
142
|
-
});
|
|
143
|
-
// newlyAddedFiles Set에서도 제거
|
|
144
|
-
this.newlyAddedFiles.delete(fileToRemove);
|
|
145
|
-
var isControlled = this.options.value !== undefined;
|
|
146
|
-
if (isControlled) {
|
|
147
|
-
this.options.value = newFiles;
|
|
148
|
-
} else {
|
|
149
|
-
this.internalFiles = newFiles;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* 모든 파일 제거
|
|
155
|
-
*/
|
|
156
|
-
ImageFileInputModel.prototype.clearFiles = function () {
|
|
157
|
-
var _this = this;
|
|
158
|
-
// 초기 파일들은 모두 삭제 표시
|
|
159
|
-
this.initialFiles.forEach(function (uploadedFile) {
|
|
160
|
-
_this.deletedInitialFiles.add(uploadedFile.fileName);
|
|
161
|
-
});
|
|
162
|
-
this.newlyAddedFiles.clear();
|
|
163
|
-
var isControlled = this.options.value !== undefined;
|
|
164
|
-
if (isControlled) {
|
|
165
|
-
this.options.value = [];
|
|
166
|
-
} else {
|
|
167
|
-
this.internalFiles = [];
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* 파일 유효성 검사
|
|
172
|
-
*/
|
|
173
|
-
ImageFileInputModel.prototype.validateFiles = function (fileList) {
|
|
174
|
-
var validFiles = [];
|
|
175
|
-
var invalidFiles = [];
|
|
176
|
-
var currentFiles = this.getFiles();
|
|
177
|
-
for (var _i = 0, fileList_1 = fileList; _i < fileList_1.length; _i++) {
|
|
178
|
-
var file = fileList_1[_i];
|
|
179
|
-
// 파일 크기 체크
|
|
180
|
-
if (this.options.maxFileSize && file.size > this.options.maxFileSize) {
|
|
181
|
-
invalidFiles.push(__assign(__assign({}, file), {
|
|
182
|
-
errorType: ImageFileInputErrorType.EXCEED_MAX_FILE_SIZE
|
|
183
|
-
}));
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
// 파일 개수 체크 (maxFileCount가 1이면 교체 가능하므로 체크하지 않음)
|
|
187
|
-
if (this.options.maxFileCount && this.options.maxFileCount !== 1 && currentFiles.length + validFiles.length >= this.options.maxFileCount) {
|
|
188
|
-
invalidFiles.push(__assign(__assign({}, file), {
|
|
189
|
-
errorType: ImageFileInputErrorType.EXCEED_MAX_FILE_COUNT
|
|
190
|
-
}));
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
validFiles.push(file);
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
validFiles: validFiles,
|
|
197
|
-
invalidFiles: invalidFiles
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* disabled 상태 설정
|
|
202
|
-
*/
|
|
203
|
-
ImageFileInputModel.prototype.setDisabled = function (disabled) {
|
|
204
|
-
this.options.disabled = disabled;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* disabled 상태 반환
|
|
208
|
-
*/
|
|
209
|
-
ImageFileInputModel.prototype.isDisabled = function () {
|
|
210
|
-
return this.options.disabled;
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Controlled mode 여부 확인
|
|
214
|
-
* onChange가 있으면 Controlled mode로 판단
|
|
215
|
-
*/
|
|
216
|
-
ImageFileInputModel.prototype.isControlled = function () {
|
|
217
|
-
return this.options.onChange !== undefined;
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* 파일이 초기 파일인지 확인 (UploadedFile로 설정된 기존 파일)
|
|
221
|
-
*/
|
|
222
|
-
ImageFileInputModel.prototype.isInitialFile = function (file) {
|
|
223
|
-
return this.initialFiles.some(function (uploadedFile) {
|
|
224
|
-
return uploadedFile.fileName === file.name;
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* 파일이 새로 추가된 파일인지 확인
|
|
229
|
-
*/
|
|
230
|
-
ImageFileInputModel.prototype.isNewlyAddedFile = function (file) {
|
|
231
|
-
return this.newlyAddedFiles.has(file);
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* 파일이 삭제 표시된 초기 파일인지 확인
|
|
235
|
-
*/
|
|
236
|
-
ImageFileInputModel.prototype.isDeletedInitialFile = function (file) {
|
|
237
|
-
return this.deletedInitialFiles.has(file.name);
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* 초기 파일의 이미지 URL 반환
|
|
241
|
-
*/
|
|
242
|
-
ImageFileInputModel.prototype.getInitialFileImageUrl = function (file) {
|
|
243
|
-
var uploadedFile = this.initialFiles.find(function (f) {
|
|
244
|
-
return f.fileName === file.name;
|
|
245
|
-
});
|
|
246
|
-
return uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileImageUrl;
|
|
247
|
-
};
|
|
248
|
-
return ImageFileInputModel;
|
|
249
|
-
}();
|
|
250
|
-
export { ImageFileInputModel };
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import { IMAGE_FILE_INPUT_CLASS_NAMES, getImageFileInputSizeClassName, getFileInputSizeClassName, getHintTextClassName, getLabelClassName } from './const/classNames';
|
|
2
|
-
var ImageFileInputView = /** @class */function () {
|
|
3
|
-
function ImageFileInputView(options, model) {
|
|
4
|
-
this.renderedFiles = []; // 이미 렌더링된 파일들 추적
|
|
5
|
-
this.previewUrls = new Map(); // 파일 URL 추적
|
|
6
|
-
this.options = options;
|
|
7
|
-
this.model = model;
|
|
8
|
-
this.element = this.createElement();
|
|
9
|
-
this.previewsContainer = this.element.querySelector(".".concat(IMAGE_FILE_INPUT_CLASS_NAMES.previews));
|
|
10
|
-
this.fileInputElement = this.element.querySelector('input[type="file"]');
|
|
11
|
-
this.buttonElement = this.element.querySelector('button.ncua-btn');
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 메인 DOM 요소 생성
|
|
15
|
-
*/
|
|
16
|
-
ImageFileInputView.prototype.createElement = function () {
|
|
17
|
-
var mainContainer = document.createElement('div');
|
|
18
|
-
var baseClasses = "".concat(IMAGE_FILE_INPUT_CLASS_NAMES.imageFileInput, " ").concat(getImageFileInputSizeClassName(this.options.size));
|
|
19
|
-
var customClasses = this.options.className ? " ".concat(this.options.className) : '';
|
|
20
|
-
mainContainer.className = baseClasses + customClasses;
|
|
21
|
-
// Image previews container
|
|
22
|
-
var previewsContainer = document.createElement('div');
|
|
23
|
-
previewsContainer.className = IMAGE_FILE_INPUT_CLASS_NAMES.previews;
|
|
24
|
-
mainContainer.appendChild(previewsContainer);
|
|
25
|
-
// File input container
|
|
26
|
-
var fileInputContainer = document.createElement('div');
|
|
27
|
-
var fileInputClasses = "".concat(IMAGE_FILE_INPUT_CLASS_NAMES.fileInput, " ").concat(getFileInputSizeClassName(this.options.size));
|
|
28
|
-
fileInputContainer.className = fileInputClasses;
|
|
29
|
-
// Hidden file input
|
|
30
|
-
fileInputContainer.appendChild(this.createFileInput());
|
|
31
|
-
// Input container
|
|
32
|
-
fileInputContainer.appendChild(this.createInputContainer());
|
|
33
|
-
// Hint list
|
|
34
|
-
if (this.options.hintItems && this.options.hintItems.length > 0) {
|
|
35
|
-
fileInputContainer.appendChild(this.createHintList());
|
|
36
|
-
}
|
|
37
|
-
mainContainer.appendChild(fileInputContainer);
|
|
38
|
-
return mainContainer;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Hidden file input 생성
|
|
42
|
-
*/
|
|
43
|
-
ImageFileInputView.prototype.createFileInput = function () {
|
|
44
|
-
var input = document.createElement('input');
|
|
45
|
-
input.type = 'file';
|
|
46
|
-
input.hidden = true;
|
|
47
|
-
input.tabIndex = -1;
|
|
48
|
-
input.setAttribute('aria-hidden', 'true');
|
|
49
|
-
input.classList.add('no-filestyle');
|
|
50
|
-
if (this.options.accept) {
|
|
51
|
-
input.accept = this.options.accept;
|
|
52
|
-
}
|
|
53
|
-
if (this.options.multiple) {
|
|
54
|
-
input.multiple = true;
|
|
55
|
-
}
|
|
56
|
-
if (this.options.fileInputName) {
|
|
57
|
-
input.name = this.options.fileInputName;
|
|
58
|
-
}
|
|
59
|
-
return input;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Input container 생성
|
|
63
|
-
*/
|
|
64
|
-
ImageFileInputView.prototype.createInputContainer = function () {
|
|
65
|
-
var container = document.createElement('div');
|
|
66
|
-
container.className = IMAGE_FILE_INPUT_CLASS_NAMES.inputContainer;
|
|
67
|
-
// Label
|
|
68
|
-
if (this.options.label) {
|
|
69
|
-
container.appendChild(this.createLabelContainer());
|
|
70
|
-
}
|
|
71
|
-
// Button
|
|
72
|
-
container.appendChild(this.createButton());
|
|
73
|
-
// Hint text
|
|
74
|
-
if (this.options.hintText) {
|
|
75
|
-
container.appendChild(this.createHintText());
|
|
76
|
-
}
|
|
77
|
-
return container;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Label container 생성
|
|
81
|
-
*/
|
|
82
|
-
ImageFileInputView.prototype.createLabelContainer = function () {
|
|
83
|
-
var container = document.createElement('div');
|
|
84
|
-
container.className = IMAGE_FILE_INPUT_CLASS_NAMES.label;
|
|
85
|
-
var label = document.createElement('label');
|
|
86
|
-
label.className = getLabelClassName(this.options.isRequired);
|
|
87
|
-
label.textContent = this.options.label;
|
|
88
|
-
container.appendChild(label);
|
|
89
|
-
if (this.options.showHelpIcon) {
|
|
90
|
-
container.appendChild(this.createHelpIcon());
|
|
91
|
-
}
|
|
92
|
-
return container;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Help icon 생성
|
|
96
|
-
*/
|
|
97
|
-
ImageFileInputView.prototype.createHelpIcon = function () {
|
|
98
|
-
var iconContainer = document.createElement('span');
|
|
99
|
-
iconContainer.className = IMAGE_FILE_INPUT_CLASS_NAMES.helpIcon;
|
|
100
|
-
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
101
|
-
svg.setAttribute('width', '16');
|
|
102
|
-
svg.setAttribute('height', '16');
|
|
103
|
-
svg.setAttribute('viewBox', '0 0 24 24');
|
|
104
|
-
svg.setAttribute('fill', 'none');
|
|
105
|
-
svg.setAttribute('stroke', 'currentColor');
|
|
106
|
-
var circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
107
|
-
circle.setAttribute('cx', '12');
|
|
108
|
-
circle.setAttribute('cy', '12');
|
|
109
|
-
circle.setAttribute('r', '10');
|
|
110
|
-
circle.setAttribute('stroke-width', '2');
|
|
111
|
-
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
112
|
-
path.setAttribute('d', 'M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3');
|
|
113
|
-
path.setAttribute('stroke-width', '2');
|
|
114
|
-
path.setAttribute('stroke-linecap', 'round');
|
|
115
|
-
path.setAttribute('stroke-linejoin', 'round');
|
|
116
|
-
var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
|
117
|
-
line.setAttribute('x1', '12');
|
|
118
|
-
line.setAttribute('y1', '17');
|
|
119
|
-
line.setAttribute('x2', '12.01');
|
|
120
|
-
line.setAttribute('y2', '17');
|
|
121
|
-
line.setAttribute('stroke-width', '2');
|
|
122
|
-
line.setAttribute('stroke-linecap', 'round');
|
|
123
|
-
svg.appendChild(circle);
|
|
124
|
-
svg.appendChild(path);
|
|
125
|
-
svg.appendChild(line);
|
|
126
|
-
iconContainer.appendChild(svg);
|
|
127
|
-
return iconContainer;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Button 생성 (파일 찾기)
|
|
131
|
-
*/
|
|
132
|
-
ImageFileInputView.prototype.createButton = function () {
|
|
133
|
-
var button = document.createElement('button');
|
|
134
|
-
button.type = 'button';
|
|
135
|
-
button.className = "ncua-btn ncua-btn--xs ncua-btn--secondary-gray";
|
|
136
|
-
button.disabled = this.options.disabled;
|
|
137
|
-
var iconSvg = this.createShareIcon();
|
|
138
|
-
button.appendChild(iconSvg);
|
|
139
|
-
var label = document.createElement('span');
|
|
140
|
-
label.className = 'ncua-btn__label';
|
|
141
|
-
label.textContent = this.options.buttonLabel;
|
|
142
|
-
button.appendChild(label);
|
|
143
|
-
return button;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Share icon (업로드 아이콘) 생성
|
|
147
|
-
*/
|
|
148
|
-
ImageFileInputView.prototype.createShareIcon = function () {
|
|
149
|
-
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
150
|
-
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
151
|
-
svg.setAttribute('width', '14');
|
|
152
|
-
svg.setAttribute('height', '14');
|
|
153
|
-
svg.setAttribute('viewBox', '0 0 24 24');
|
|
154
|
-
svg.setAttribute('fill', 'none');
|
|
155
|
-
svg.setAttribute('stroke', 'none');
|
|
156
|
-
svg.classList.add('ncua-btn__icon');
|
|
157
|
-
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
158
|
-
path.setAttribute('stroke', 'currentColor');
|
|
159
|
-
path.setAttribute('stroke-linecap', 'round');
|
|
160
|
-
path.setAttribute('stroke-linejoin', 'round');
|
|
161
|
-
path.setAttribute('stroke-width', '2');
|
|
162
|
-
path.setAttribute('d', 'M21 12v4.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V12m13-5-4-4m0 0L8 7m4-4v12');
|
|
163
|
-
svg.appendChild(path);
|
|
164
|
-
return svg;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Trash icon (삭제 아이콘) 생성
|
|
168
|
-
*/
|
|
169
|
-
ImageFileInputView.prototype.createTrashIcon = function () {
|
|
170
|
-
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
171
|
-
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
172
|
-
svg.setAttribute('width', '20');
|
|
173
|
-
svg.setAttribute('height', '20');
|
|
174
|
-
svg.setAttribute('viewBox', '0 0 24 24');
|
|
175
|
-
svg.setAttribute('fill', 'none');
|
|
176
|
-
svg.setAttribute('stroke', 'currentColor');
|
|
177
|
-
svg.classList.add('ncua-btn__icon');
|
|
178
|
-
var path1 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
179
|
-
path1.setAttribute('stroke', 'currentColor');
|
|
180
|
-
path1.setAttribute('stroke-linecap', 'round');
|
|
181
|
-
path1.setAttribute('stroke-linejoin', 'round');
|
|
182
|
-
path1.setAttribute('stroke-width', '2');
|
|
183
|
-
path1.setAttribute('d', 'M16 6v-.8c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C14.48 2 13.92 2 12.8 2h-1.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C8 3.52 8 4.08 8 5.2V6m2 5.5v5m4-5v5M3 6h18m-2 0v11.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C16.72 22 15.88 22 14.2 22H9.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C5 19.72 5 18.88 5 17.2V6');
|
|
184
|
-
svg.appendChild(path1);
|
|
185
|
-
return svg;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Hint text 생성
|
|
189
|
-
*/
|
|
190
|
-
ImageFileInputView.prototype.createHintText = function () {
|
|
191
|
-
var hintText = document.createElement('div');
|
|
192
|
-
hintText.className = getHintTextClassName(this.options.destructive);
|
|
193
|
-
hintText.textContent = this.options.hintText;
|
|
194
|
-
return hintText;
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Hint list 생성
|
|
198
|
-
* Note: 힌트 리스트는 컴포넌트 size와 관계없이 항상 xs 사이즈로 고정됨
|
|
199
|
-
*/
|
|
200
|
-
ImageFileInputView.prototype.createHintList = function () {
|
|
201
|
-
var _a;
|
|
202
|
-
var ul = document.createElement('ul');
|
|
203
|
-
ul.className = IMAGE_FILE_INPUT_CLASS_NAMES.hintList;
|
|
204
|
-
(_a = this.options.hintItems) === null || _a === void 0 ? void 0 : _a.forEach(function (hint) {
|
|
205
|
-
var li = document.createElement('li');
|
|
206
|
-
li.className = IMAGE_FILE_INPUT_CLASS_NAMES.hintItem;
|
|
207
|
-
li.textContent = hint;
|
|
208
|
-
ul.appendChild(li);
|
|
209
|
-
});
|
|
210
|
-
return ul;
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* 이미지 프리뷰 렌더링
|
|
214
|
-
*/
|
|
215
|
-
ImageFileInputView.prototype.renderImagePreviews = function (files, onRemove, onBrowseClick) {
|
|
216
|
-
var _this = this;
|
|
217
|
-
// 기존 프리뷰 정리
|
|
218
|
-
this.cleanupPreviews();
|
|
219
|
-
// 새로운 프리뷰 렌더링
|
|
220
|
-
files.forEach(function (file, index) {
|
|
221
|
-
var previewContainer = _this.createImagePreview(file, index, onRemove);
|
|
222
|
-
_this.previewsContainer.appendChild(previewContainer);
|
|
223
|
-
_this.renderedFiles.push(file);
|
|
224
|
-
});
|
|
225
|
-
// 빈 슬롯 표시 여부 확인
|
|
226
|
-
var showEmptySlot = this.options.maxFileCount ? files.length < this.options.maxFileCount : files.length === 0;
|
|
227
|
-
if (showEmptySlot) {
|
|
228
|
-
var emptySlot = this.createEmptySlot(onBrowseClick);
|
|
229
|
-
this.previewsContainer.appendChild(emptySlot);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* 이미지 프리뷰 생성
|
|
234
|
-
*/
|
|
235
|
-
ImageFileInputView.prototype.createImagePreview = function (file, index, onRemove) {
|
|
236
|
-
var container = document.createElement('div');
|
|
237
|
-
container.className = IMAGE_FILE_INPUT_CLASS_NAMES.previewContainer;
|
|
238
|
-
// 이미지 요소 생성
|
|
239
|
-
var img = document.createElement('img');
|
|
240
|
-
img.className = IMAGE_FILE_INPUT_CLASS_NAMES.previewImage;
|
|
241
|
-
img.alt = file.name;
|
|
242
|
-
// 이미지 URL 생성
|
|
243
|
-
var isInitialFile = this.model.isInitialFile(file);
|
|
244
|
-
if (isInitialFile) {
|
|
245
|
-
// 초기 파일: fileImageUrl 사용
|
|
246
|
-
var imageUrl = this.model.getInitialFileImageUrl(file);
|
|
247
|
-
if (imageUrl) {
|
|
248
|
-
img.src = imageUrl;
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
// 새로 추가된 파일: createObjectURL 사용
|
|
252
|
-
var url = URL.createObjectURL(file);
|
|
253
|
-
img.src = url;
|
|
254
|
-
this.previewUrls.set(file, url);
|
|
255
|
-
}
|
|
256
|
-
container.appendChild(img);
|
|
257
|
-
// 삭제 버튼 생성
|
|
258
|
-
var removeButton = document.createElement('button');
|
|
259
|
-
removeButton.type = 'button';
|
|
260
|
-
removeButton.className = "ncua-btn ncua-btn--sm ncua-btn--text ".concat(IMAGE_FILE_INPUT_CLASS_NAMES.previewRemoveButton);
|
|
261
|
-
removeButton.setAttribute('aria-label', 'Remove image');
|
|
262
|
-
var trashIcon = this.createTrashIcon();
|
|
263
|
-
removeButton.appendChild(trashIcon);
|
|
264
|
-
removeButton.addEventListener('click', function () {
|
|
265
|
-
return onRemove(index);
|
|
266
|
-
});
|
|
267
|
-
container.appendChild(removeButton);
|
|
268
|
-
return container;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* 빈 슬롯 생성 (파일 찾기 버튼)
|
|
272
|
-
*/
|
|
273
|
-
ImageFileInputView.prototype.createEmptySlot = function (onBrowseClick) {
|
|
274
|
-
var _this = this;
|
|
275
|
-
var wrapper = document.createElement('div');
|
|
276
|
-
wrapper.className = 'ncua-image-file-input__empty-slot-wrapper';
|
|
277
|
-
var button = document.createElement('button');
|
|
278
|
-
button.type = 'button';
|
|
279
|
-
button.className = "ncua-btn ncua-btn--".concat(this.options.size, " ncua-btn--secondary-gray ").concat(IMAGE_FILE_INPUT_CLASS_NAMES.previewContainer);
|
|
280
|
-
button.disabled = this.options.disabled;
|
|
281
|
-
button.setAttribute('aria-label', this.options.imagePreviewTooltipLabel);
|
|
282
|
-
button.addEventListener('click', onBrowseClick);
|
|
283
|
-
wrapper.addEventListener('click', onBrowseClick);
|
|
284
|
-
wrapper.appendChild(button);
|
|
285
|
-
// Tooltip 생성 및 추가
|
|
286
|
-
var tooltip = this.createTooltip();
|
|
287
|
-
wrapper.appendChild(tooltip);
|
|
288
|
-
// Hover 이벤트로 tooltip 표시/숨김
|
|
289
|
-
wrapper.addEventListener('mouseenter', function () {
|
|
290
|
-
if (!_this.options.disabled) {
|
|
291
|
-
tooltip.style.display = 'block';
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
wrapper.addEventListener('mouseleave', function () {
|
|
295
|
-
tooltip.style.display = 'none';
|
|
296
|
-
});
|
|
297
|
-
return wrapper;
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* Tooltip 생성
|
|
301
|
-
*/
|
|
302
|
-
ImageFileInputView.prototype.createTooltip = function () {
|
|
303
|
-
var iconSize = this.options.size === 'xs' ? '48' : '80';
|
|
304
|
-
var tooltipHTML = "\n <svg width=\"".concat(iconSize, "\" height=\"").concat(iconSize, "\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" style=\"opacity: 0; cursor: pointer;\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" stroke-width=\"2\"></circle>\n </svg>\n <span class=\"ncua-tooltip__bg ncua-tooltip__bg--black ncua-tooltip__bg--bottom ncua-tooltip__bg--visible\">\n <span class=\"ncua-tooltip__content\">").concat(this.options.imagePreviewTooltipLabel, "</span>\n </span>\n ");
|
|
305
|
-
var tooltip = document.createElement('span');
|
|
306
|
-
tooltip.className = 'ncua-tooltip ncua-tooltip--sm ncua-tooltip--short';
|
|
307
|
-
tooltip.style.display = 'none';
|
|
308
|
-
tooltip.innerHTML = tooltipHTML;
|
|
309
|
-
return tooltip;
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* 기존 프리뷰 정리
|
|
313
|
-
*/
|
|
314
|
-
ImageFileInputView.prototype.cleanupPreviews = function () {
|
|
315
|
-
// Blob URL 정리
|
|
316
|
-
this.previewUrls.forEach(function (url) {
|
|
317
|
-
URL.revokeObjectURL(url);
|
|
318
|
-
});
|
|
319
|
-
this.previewUrls.clear();
|
|
320
|
-
// DOM 정리
|
|
321
|
-
this.previewsContainer.innerHTML = '';
|
|
322
|
-
this.renderedFiles = [];
|
|
323
|
-
};
|
|
324
|
-
ImageFileInputView.prototype.setButtonDisabled = function (disabled) {
|
|
325
|
-
this.buttonElement.disabled = disabled;
|
|
326
|
-
// 빈 슬롯 wrapper 내부의 버튼도 disabled 설정
|
|
327
|
-
var emptySlotWrapper = this.previewsContainer.querySelector('.ncua-image-file-input__empty-slot-wrapper');
|
|
328
|
-
if (emptySlotWrapper) {
|
|
329
|
-
var emptySlotButton = emptySlotWrapper.querySelector(".".concat(IMAGE_FILE_INPUT_CLASS_NAMES.previewContainer, ".ncua-btn"));
|
|
330
|
-
if (emptySlotButton) {
|
|
331
|
-
emptySlotButton.disabled = disabled;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
ImageFileInputView.prototype.getElement = function () {
|
|
336
|
-
return this.element;
|
|
337
|
-
};
|
|
338
|
-
ImageFileInputView.prototype.getFileInputElement = function () {
|
|
339
|
-
return this.fileInputElement;
|
|
340
|
-
};
|
|
341
|
-
ImageFileInputView.prototype.getButtonElement = function () {
|
|
342
|
-
return this.buttonElement;
|
|
343
|
-
};
|
|
344
|
-
ImageFileInputView.prototype.destroy = function () {
|
|
345
|
-
this.cleanupPreviews();
|
|
346
|
-
};
|
|
347
|
-
return ImageFileInputView;
|
|
348
|
-
}();
|
|
349
|
-
export { ImageFileInputView };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// ImageFileInput 관련 CSS 클래스명 상수
|
|
2
|
-
export var IMAGE_FILE_INPUT_CLASS_NAMES = {
|
|
3
|
-
imageFileInput: 'ncua-image-file-input',
|
|
4
|
-
previews: 'ncua-image-file-input__previews',
|
|
5
|
-
previewContainer: 'ncua-image-file-input__preview-container',
|
|
6
|
-
previewImage: 'ncua-image-file-input__preview-image',
|
|
7
|
-
previewRemoveButton: 'ncua-image-file-input__preview-remove-button',
|
|
8
|
-
fileInput: 'ncua-file-input',
|
|
9
|
-
inputContainer: 'ncua-file-input__input-container',
|
|
10
|
-
label: 'ncua-file-input__label',
|
|
11
|
-
helpIcon: 'ncua-input__help-icon',
|
|
12
|
-
hintText: 'ncua-input__hint-text',
|
|
13
|
-
hintList: 'ncua-file-input__hint-list',
|
|
14
|
-
hintItem: 'ncua-file-input__hint-item'
|
|
15
|
-
};
|
|
16
|
-
export var getImageFileInputSizeClassName = function (size) {
|
|
17
|
-
return "ncua-image-file-input--".concat(size);
|
|
18
|
-
};
|
|
19
|
-
export var getFileInputSizeClassName = function (size) {
|
|
20
|
-
return "ncua-file-input--".concat(size);
|
|
21
|
-
};
|
|
22
|
-
export var getButtonSizeClassName = function (size) {
|
|
23
|
-
return "ncua-button--".concat(size);
|
|
24
|
-
};
|
|
25
|
-
export var getLabelClassName = function (isRequired) {
|
|
26
|
-
return isRequired ? 'ncua-label ncua-label--required' : 'ncua-label';
|
|
27
|
-
};
|
|
28
|
-
export var getHintTextClassName = function (destructive) {
|
|
29
|
-
return destructive ? 'ncua-input__hint-text ncua-input__hint-text--destructive' : 'ncua-input__hint-text';
|
|
30
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// ImageFileInput 관련 타입 정의 (React ImageFileInput.tsx와 동일)
|
|
2
|
-
export var ImageFileInputErrorType;
|
|
3
|
-
(function (ImageFileInputErrorType) {
|
|
4
|
-
ImageFileInputErrorType["ALREADY_UPLOADED"] = "ALREADY_UPLOADED";
|
|
5
|
-
ImageFileInputErrorType["EXCEED_MAX_FILE_SIZE"] = "EXCEED_MAX_FILE_SIZE";
|
|
6
|
-
ImageFileInputErrorType["EXCEED_MAX_FILE_COUNT"] = "EXCEED_MAX_FILE_COUNT";
|
|
7
|
-
})(ImageFileInputErrorType || (ImageFileInputErrorType = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ImageFileInput } from './ImageFileInput';
|
|
2
|
-
export * from './const/classNames';
|
|
3
|
-
export * from './const/types';
|
|
4
|
-
export { ImageFileInput } from './ImageFileInput';
|
|
5
|
-
// 전역 등록 (추후 index.ts와 개별동작 할 수 있게끔 대비)
|
|
6
|
-
if (typeof window !== 'undefined') {
|
|
7
|
-
window.ncua = window.ncua || {};
|
|
8
|
-
window.ncua.ImageFileInput = ImageFileInput;
|
|
9
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ComboBox } from './comboBox';
|
|
2
|
-
import { DatePicker } from './datePicker';
|
|
3
|
-
import { FeaturedIcon } from './featuredIcon';
|
|
4
|
-
import { FileInput } from './fileInput';
|
|
5
|
-
import { ImageFileInput } from './imageFileInput';
|
|
6
|
-
import { Modal } from './modal';
|
|
7
|
-
import { Notification } from './notification';
|
|
8
|
-
import { ProgressBar } from './progress-bar';
|
|
9
|
-
import { SelectBox } from './selectBox';
|
|
10
|
-
import { Slider } from './slider';
|
|
11
|
-
import { Tab } from './tab';
|
|
12
|
-
import { Tag } from './tag';
|
|
13
|
-
import { Tooltip } from './tooltip';
|
|
14
|
-
window.ncua = {
|
|
15
|
-
Slider: Slider,
|
|
16
|
-
Tab: Tab,
|
|
17
|
-
Tag: Tag,
|
|
18
|
-
DatePicker: DatePicker,
|
|
19
|
-
SelectBox: SelectBox,
|
|
20
|
-
ComboBox: ComboBox,
|
|
21
|
-
FeaturedIcon: FeaturedIcon,
|
|
22
|
-
FileInput: FileInput,
|
|
23
|
-
Modal: Modal,
|
|
24
|
-
Notification: Notification,
|
|
25
|
-
ProgressBar: ProgressBar,
|
|
26
|
-
Tooltip: Tooltip,
|
|
27
|
-
ImageFileInput: ImageFileInput
|
|
28
|
-
};
|