@ncds/ui-admin 1.6.3 โ 1.6.4-alpha.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/mcp/bin/server.d.ts +1 -0
- package/mcp/bin/server.js +67 -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/ping.d.ts +11 -0
- package/mcp/bin/tools/ping.js +30 -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 +26 -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,450 +0,0 @@
|
|
|
1
|
-
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import { Tag } from '../tag/Tag';
|
|
11
|
-
import { FILE_INPUT_CLASS_NAMES, getFileInputSizeClassName, getHintTextClassName, getLabelClassName } from './const/classNames';
|
|
12
|
-
var FileInputView = /** @class */function () {
|
|
13
|
-
function FileInputView(options, model) {
|
|
14
|
-
this.tagInstances = [];
|
|
15
|
-
this.renderedFiles = []; // ์ด๋ฏธ ๋ ๋๋ง๋ ํ์ผ๋ค ์ถ์
|
|
16
|
-
this.options = options;
|
|
17
|
-
this.model = model;
|
|
18
|
-
this.element = this.createElement();
|
|
19
|
-
this.fileInputElement = this.element.querySelector('input[type="file"]');
|
|
20
|
-
this.buttonElement = this.element.querySelector('button');
|
|
21
|
-
this.fileTagsContainer = this.element.querySelector(".".concat(FILE_INPUT_CLASS_NAMES.fileTags));
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* ๋ฉ์ธ DOM ์์ ์์ฑ
|
|
25
|
-
*/
|
|
26
|
-
FileInputView.prototype.createElement = function () {
|
|
27
|
-
var container = document.createElement('div');
|
|
28
|
-
var baseClasses = "".concat(FILE_INPUT_CLASS_NAMES.fileInput, " ").concat(getFileInputSizeClassName(this.options.size));
|
|
29
|
-
var customClasses = this.options.className ? " ".concat(this.options.className) : '';
|
|
30
|
-
container.className = baseClasses + customClasses;
|
|
31
|
-
// Hidden file input
|
|
32
|
-
container.appendChild(this.createFileInput());
|
|
33
|
-
// Input container
|
|
34
|
-
container.appendChild(this.createInputContainer());
|
|
35
|
-
// Hint list
|
|
36
|
-
if (this.options.hintItems && this.options.hintItems.length > 0) {
|
|
37
|
-
container.appendChild(this.createHintList());
|
|
38
|
-
}
|
|
39
|
-
// File tags container
|
|
40
|
-
var fileTagsContainer = document.createElement('div');
|
|
41
|
-
fileTagsContainer.className = FILE_INPUT_CLASS_NAMES.fileTags;
|
|
42
|
-
fileTagsContainer.style.display = 'none';
|
|
43
|
-
container.appendChild(fileTagsContainer);
|
|
44
|
-
return container;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Hidden file input ์์ฑ
|
|
48
|
-
*/
|
|
49
|
-
FileInputView.prototype.createFileInput = function () {
|
|
50
|
-
var input = document.createElement('input');
|
|
51
|
-
input.type = 'file';
|
|
52
|
-
input.hidden = true;
|
|
53
|
-
input.tabIndex = -1;
|
|
54
|
-
input.setAttribute('aria-hidden', 'true');
|
|
55
|
-
input.classList.add('no-filestyle');
|
|
56
|
-
if (this.options.accept) {
|
|
57
|
-
input.accept = this.options.accept;
|
|
58
|
-
}
|
|
59
|
-
if (this.options.multiple) {
|
|
60
|
-
input.multiple = true;
|
|
61
|
-
}
|
|
62
|
-
if (this.options.fileInputName) {
|
|
63
|
-
input.name = this.options.fileInputName;
|
|
64
|
-
}
|
|
65
|
-
return input;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Input container ์์ฑ
|
|
69
|
-
*/
|
|
70
|
-
FileInputView.prototype.createInputContainer = function () {
|
|
71
|
-
var container = document.createElement('div');
|
|
72
|
-
container.className = FILE_INPUT_CLASS_NAMES.inputContainer;
|
|
73
|
-
// Label
|
|
74
|
-
if (this.options.label) {
|
|
75
|
-
container.appendChild(this.createLabelContainer());
|
|
76
|
-
}
|
|
77
|
-
// Button
|
|
78
|
-
container.appendChild(this.createButton());
|
|
79
|
-
// Hint text
|
|
80
|
-
if (this.options.hintText) {
|
|
81
|
-
container.appendChild(this.createHintText());
|
|
82
|
-
}
|
|
83
|
-
return container;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Label container ์์ฑ
|
|
87
|
-
*/
|
|
88
|
-
FileInputView.prototype.createLabelContainer = function () {
|
|
89
|
-
var container = document.createElement('div');
|
|
90
|
-
container.className = FILE_INPUT_CLASS_NAMES.label;
|
|
91
|
-
var label = document.createElement('label');
|
|
92
|
-
label.className = getLabelClassName(this.options.isRequired);
|
|
93
|
-
label.textContent = this.options.label;
|
|
94
|
-
container.appendChild(label);
|
|
95
|
-
if (this.options.showHelpIcon) {
|
|
96
|
-
container.appendChild(this.createHelpIcon());
|
|
97
|
-
}
|
|
98
|
-
return container;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Help icon ์์ฑ
|
|
102
|
-
*/
|
|
103
|
-
FileInputView.prototype.createHelpIcon = function () {
|
|
104
|
-
var iconContainer = document.createElement('span');
|
|
105
|
-
iconContainer.className = FILE_INPUT_CLASS_NAMES.helpIcon;
|
|
106
|
-
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
107
|
-
svg.setAttribute('width', '16');
|
|
108
|
-
svg.setAttribute('height', '16');
|
|
109
|
-
svg.setAttribute('viewBox', '0 0 24 24');
|
|
110
|
-
svg.setAttribute('fill', 'none');
|
|
111
|
-
svg.setAttribute('stroke', 'currentColor');
|
|
112
|
-
var circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
113
|
-
circle.setAttribute('cx', '12');
|
|
114
|
-
circle.setAttribute('cy', '12');
|
|
115
|
-
circle.setAttribute('r', '10');
|
|
116
|
-
circle.setAttribute('stroke-width', '2');
|
|
117
|
-
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
118
|
-
path.setAttribute('d', 'M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3');
|
|
119
|
-
path.setAttribute('stroke-width', '2');
|
|
120
|
-
path.setAttribute('stroke-linecap', 'round');
|
|
121
|
-
path.setAttribute('stroke-linejoin', 'round');
|
|
122
|
-
var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
|
123
|
-
line.setAttribute('x1', '12');
|
|
124
|
-
line.setAttribute('y1', '17');
|
|
125
|
-
line.setAttribute('x2', '12.01');
|
|
126
|
-
line.setAttribute('y2', '17');
|
|
127
|
-
line.setAttribute('stroke-width', '2');
|
|
128
|
-
line.setAttribute('stroke-linecap', 'round');
|
|
129
|
-
svg.appendChild(circle);
|
|
130
|
-
svg.appendChild(path);
|
|
131
|
-
svg.appendChild(line);
|
|
132
|
-
iconContainer.appendChild(svg);
|
|
133
|
-
return iconContainer;
|
|
134
|
-
};
|
|
135
|
-
FileInputView.prototype.createButton = function () {
|
|
136
|
-
var button = document.createElement('button');
|
|
137
|
-
button.type = 'button';
|
|
138
|
-
button.className = "ncua-btn ncua-btn--".concat(this.options.size, " ncua-btn--secondary-gray");
|
|
139
|
-
button.disabled = this.options.disabled;
|
|
140
|
-
var iconSvg = this.createShareIcon();
|
|
141
|
-
button.appendChild(iconSvg);
|
|
142
|
-
var label = document.createElement('span');
|
|
143
|
-
label.className = 'ncua-btn__label';
|
|
144
|
-
label.textContent = this.options.buttonLabel;
|
|
145
|
-
button.appendChild(label);
|
|
146
|
-
return button;
|
|
147
|
-
};
|
|
148
|
-
FileInputView.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
|
-
* Hint text ์์ฑ
|
|
168
|
-
*/
|
|
169
|
-
FileInputView.prototype.createHintText = function () {
|
|
170
|
-
var hintText = document.createElement('div');
|
|
171
|
-
hintText.className = getHintTextClassName(this.options.destructive);
|
|
172
|
-
hintText.textContent = this.options.hintText;
|
|
173
|
-
return hintText;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Hint list ์์ฑ
|
|
177
|
-
*/
|
|
178
|
-
FileInputView.prototype.createHintList = function () {
|
|
179
|
-
var _a;
|
|
180
|
-
var ul = document.createElement('ul');
|
|
181
|
-
ul.className = FILE_INPUT_CLASS_NAMES.hintList;
|
|
182
|
-
(_a = this.options.hintItems) === null || _a === void 0 ? void 0 : _a.forEach(function (hint) {
|
|
183
|
-
var li = document.createElement('li');
|
|
184
|
-
li.className = FILE_INPUT_CLASS_NAMES.hintItem;
|
|
185
|
-
li.textContent = hint;
|
|
186
|
-
ul.appendChild(li);
|
|
187
|
-
});
|
|
188
|
-
return ul;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* ํ์ผ ํ๊ทธ ๋ ๋๋ง (์ญ์ ํ์๋ ์ด๊ธฐ ํ์ผ ํฌํจ)
|
|
192
|
-
*/
|
|
193
|
-
FileInputView.prototype.renderFileTags = function (files, onRemove) {
|
|
194
|
-
var _this = this;
|
|
195
|
-
// ์ ์ฒด ํ์ผ ๋ชฉ๋ก (์ญ์ ํ์๋ ์ด๊ธฐ ํ์ผ ํฌํจ)์ ๊ฐ์ ธ์์ ๋ ๋๋ง
|
|
196
|
-
var allFiles = this.getAllFilesIncludingDeleted();
|
|
197
|
-
if (allFiles.length === 0) {
|
|
198
|
-
// ๋ชจ๋ ํ์ผ์ด ์ ๊ฑฐ๋ ๊ฒฝ์ฐ
|
|
199
|
-
this.tagInstances.forEach(function (tag) {
|
|
200
|
-
return tag.destroy();
|
|
201
|
-
});
|
|
202
|
-
this.tagInstances = [];
|
|
203
|
-
this.fileTagsContainer.innerHTML = '';
|
|
204
|
-
this.fileTagsContainer.style.display = 'none';
|
|
205
|
-
this.renderedFiles = [];
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
this.fileTagsContainer.style.display = 'flex';
|
|
209
|
-
// ํ์ฌ ๋ ๋๋ง๋ ํ์ผ๊ณผ ์๋ก์ด ์ ์ฒด ํ์ผ ๋ชฉ๋ก ๋น๊ต
|
|
210
|
-
var renderedFileCount = this.renderedFiles.length;
|
|
211
|
-
var _loop_1 = function (i) {
|
|
212
|
-
var renderedFile = this_1.renderedFiles[i];
|
|
213
|
-
var stillExists = allFiles.some(function (file) {
|
|
214
|
-
return _this.isSameFile(file, renderedFile);
|
|
215
|
-
});
|
|
216
|
-
if (!stillExists) {
|
|
217
|
-
// ํ์ผ์ด ์์ ํ ์ ๊ฑฐ๋จ
|
|
218
|
-
if (this_1.tagInstances[i]) {
|
|
219
|
-
this_1.tagInstances[i].destroy();
|
|
220
|
-
}
|
|
221
|
-
var tagContainer = this_1.fileTagsContainer.children[i];
|
|
222
|
-
if (tagContainer) {
|
|
223
|
-
// ์ด๋ฏธ์ง URL ์ ๋ฆฌ
|
|
224
|
-
var img = tagContainer.querySelector('img');
|
|
225
|
-
if (img && img.src.startsWith('blob:')) {
|
|
226
|
-
URL.revokeObjectURL(img.src);
|
|
227
|
-
}
|
|
228
|
-
tagContainer.remove();
|
|
229
|
-
}
|
|
230
|
-
this_1.tagInstances.splice(i, 1);
|
|
231
|
-
this_1.renderedFiles.splice(i, 1);
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
var this_1 = this;
|
|
235
|
-
// ์ ๊ฑฐ๋ ํ์ผ๋ค ์ฒ๋ฆฌ (๋ค์์๋ถํฐ ์ ๊ฑฐํ์ฌ ์ธ๋ฑ์ค ๋ณํ ๋ฐฉ์ง)
|
|
236
|
-
for (var i = renderedFileCount - 1; i >= 0; i--) {
|
|
237
|
-
_loop_1(i);
|
|
238
|
-
}
|
|
239
|
-
// ์๋ก์ด ํ์ผ๋ค๊ณผ ์ํ ๋ณ๊ฒฝ๋ ํ์ผ๋ค ์ฒ๋ฆฌ
|
|
240
|
-
allFiles.forEach(function (file, index) {
|
|
241
|
-
var isAlreadyRendered = _this.renderedFiles.some(function (renderedFile) {
|
|
242
|
-
return _this.isSameFile(file, renderedFile);
|
|
243
|
-
});
|
|
244
|
-
var isDeletedInitial = _this.model.isDeletedInitialFile(file);
|
|
245
|
-
if (!isAlreadyRendered) {
|
|
246
|
-
// ์๋ก์ด ํ์ผ์ ์ฌ๋ฐ๋ฅธ ์์น์ ์ฝ์
|
|
247
|
-
_this.insertFileTagAtIndex(file, index, onRemove);
|
|
248
|
-
_this.renderedFiles.splice(index, 0, file);
|
|
249
|
-
} else if (isDeletedInitial) {
|
|
250
|
-
// ๊ธฐ์กด ํ์ผ์ด ์ญ์ ํ์๋จ - ํด๋น ์ปจํ
์ด๋๋ฅผ ์จ๊น ์ฒ๋ฆฌํ๊ณ checkbox ์ฒดํฌ
|
|
251
|
-
var existingIndex = _this.renderedFiles.findIndex(function (renderedFile) {
|
|
252
|
-
return _this.isSameFile(file, renderedFile);
|
|
253
|
-
});
|
|
254
|
-
if (existingIndex !== -1) {
|
|
255
|
-
var tagContainer = _this.fileTagsContainer.children[existingIndex];
|
|
256
|
-
if (tagContainer) {
|
|
257
|
-
tagContainer.style.display = 'none';
|
|
258
|
-
// checkbox๋ฅผ ์ฒดํฌ๋ ์ํ๋ก ๋ณ๊ฒฝ
|
|
259
|
-
var checkbox = tagContainer.querySelector('input[type="checkbox"]');
|
|
260
|
-
if (checkbox) {
|
|
261
|
-
checkbox.checked = true;
|
|
262
|
-
}
|
|
263
|
-
// Tag ์ธ์คํด์ค ์ ๊ฑฐ (UI๋ ์จ๊น)
|
|
264
|
-
if (_this.tagInstances[existingIndex]) {
|
|
265
|
-
_this.tagInstances[existingIndex].destroy();
|
|
266
|
-
_this.tagInstances.splice(existingIndex, 1);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
// ์ธ๋ฑ์ค ์
๋ฐ์ดํธ (onRemove ์ฝ๋ฐฑ์ ์ธ๋ฑ์ค๊ฐ ์ ํํ๋๋ก)
|
|
273
|
-
this.updateFileIndices(onRemove);
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* ์ญ์ ํ์๋ ์ด๊ธฐ ํ์ผ์ ํฌํจํ ์ ์ฒด ํ์ผ ๋ชฉ๋ก ๋ฐํ
|
|
277
|
-
*/
|
|
278
|
-
FileInputView.prototype.getAllFilesIncludingDeleted = function () {
|
|
279
|
-
var _this = this;
|
|
280
|
-
var newFiles = this.model.getOptions().value !== undefined ? this.model.getOptions().value : this.model.internalFiles;
|
|
281
|
-
// ๋ชจ๋ ์ด๊ธฐ ํ์ผ์ File ๊ฐ์ฒด๋ก ๋ณํ (์ญ์ ํ์๋ ๊ฒ๋ ํฌํจ)
|
|
282
|
-
var allInitialFiles = this.model.initialFiles.map(function (uploadedFile) {
|
|
283
|
-
var mimeType = _this.model.getMimeTypeFromFileName(uploadedFile.fileName);
|
|
284
|
-
return new File([], uploadedFile.fileName, {
|
|
285
|
-
type: mimeType
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
return __spreadArray(__spreadArray([], allInitialFiles, true), newFiles, true);
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* ๋ ํ์ผ์ด ๊ฐ์ ํ์ผ์ธ์ง ํ์ธ
|
|
292
|
-
*/
|
|
293
|
-
FileInputView.prototype.isSameFile = function (file1, file2) {
|
|
294
|
-
return file1.name === file2.name && file1.size === file2.size && file1.lastModified === file2.lastModified;
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* ํน์ ์ธ๋ฑ์ค์ ํ์ผ ํ๊ทธ ์ฝ์
|
|
298
|
-
*/
|
|
299
|
-
FileInputView.prototype.insertFileTagAtIndex = function (file, index, onRemove) {
|
|
300
|
-
var tagContainer = this.createFileTagContainer(file, index, onRemove);
|
|
301
|
-
// ์ฌ๋ฐ๋ฅธ ์์น์ ์ฝ์
|
|
302
|
-
var existingChildren = this.fileTagsContainer.children;
|
|
303
|
-
if (index >= existingChildren.length) {
|
|
304
|
-
// ๋ง์ง๋ง์ ์ถ๊ฐ
|
|
305
|
-
this.fileTagsContainer.appendChild(tagContainer);
|
|
306
|
-
} else {
|
|
307
|
-
// ํน์ ์์น์ ์ฝ์
|
|
308
|
-
this.fileTagsContainer.insertBefore(tagContainer, existingChildren[index]);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* ํ์ผ ํ๊ทธ ์์ฑ (๋ง์ง๋ง์ ์ถ๊ฐ)
|
|
313
|
-
*/
|
|
314
|
-
FileInputView.prototype.createFileTag = function (file, index, onRemove) {
|
|
315
|
-
var tagContainer = this.createFileTagContainer(file, index, onRemove);
|
|
316
|
-
this.fileTagsContainer.appendChild(tagContainer);
|
|
317
|
-
};
|
|
318
|
-
/**
|
|
319
|
-
* ํ์ผ ํ๊ทธ ์ปจํ
์ด๋ ์์ฑ
|
|
320
|
-
*/
|
|
321
|
-
FileInputView.prototype.createFileTagContainer = function (file, index, onRemove) {
|
|
322
|
-
var tagContainer = document.createElement('div');
|
|
323
|
-
tagContainer.className = FILE_INPUT_CLASS_NAMES.fileTagContainer;
|
|
324
|
-
// ํ์ผ์ด ์ด๊ธฐ ํ์ผ์ธ์ง ์๋ก ์ถ๊ฐ๋ ํ์ผ์ธ์ง ํ์ธ
|
|
325
|
-
var isInitialFile = this.model.isInitialFile(file);
|
|
326
|
-
var isNewlyAdded = this.model.isNewlyAddedFile(file);
|
|
327
|
-
var isDeletedInitial = this.model.isDeletedInitialFile(file);
|
|
328
|
-
// ์ญ์ ํ์๋ ์ด๊ธฐ ํ์ผ์ธ ๊ฒฝ์ฐ ์จ๊น ์ฒ๋ฆฌํ์ง๋ง checkbox๋ ์ ์ง
|
|
329
|
-
if (isDeletedInitial) {
|
|
330
|
-
tagContainer.style.display = 'none';
|
|
331
|
-
// checkbox๋ง ์์ฑ (์ฒดํฌ๋ ์ํ๋ก)
|
|
332
|
-
if (this.options.checkboxName) {
|
|
333
|
-
var checkbox = document.createElement('input');
|
|
334
|
-
checkbox.type = 'checkbox';
|
|
335
|
-
checkbox.name = this.options.checkboxName;
|
|
336
|
-
checkbox.value = file.name;
|
|
337
|
-
checkbox.hidden = true;
|
|
338
|
-
checkbox.checked = true; // ์ญ์ ํ์๋จ
|
|
339
|
-
checkbox.setAttribute('data-file-index', String(index));
|
|
340
|
-
tagContainer.appendChild(checkbox);
|
|
341
|
-
}
|
|
342
|
-
return tagContainer;
|
|
343
|
-
}
|
|
344
|
-
// Tag ์ธ์คํด์ค ์์ฑ (์ญ์ ๋์ง ์์ ํ์ผ๋ง)
|
|
345
|
-
var tagSize = this.options.size === 'xs' ? 'sm' : 'md';
|
|
346
|
-
var tag = new Tag({
|
|
347
|
-
text: file.name,
|
|
348
|
-
size: tagSize,
|
|
349
|
-
close: true,
|
|
350
|
-
onButtonClick: function () {
|
|
351
|
-
return onRemove(index);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
this.tagInstances.splice(index, 0, tag);
|
|
355
|
-
tagContainer.appendChild(tag.getElement());
|
|
356
|
-
// PHP form submission์ ์ํ hidden input ์์ฑ
|
|
357
|
-
if (isInitialFile && this.options.checkboxName) {
|
|
358
|
-
// ๊ธฐ์กด ํ์ผ: checkbox (์ญ์ ํ์์ฉ)
|
|
359
|
-
var checkbox = document.createElement('input');
|
|
360
|
-
checkbox.type = 'checkbox';
|
|
361
|
-
checkbox.name = this.options.checkboxName;
|
|
362
|
-
checkbox.value = file.name;
|
|
363
|
-
checkbox.hidden = true;
|
|
364
|
-
checkbox.checked = false; // ๊ธฐ๋ณธ์ ์ผ๋ก ์ญ์ ์ํจ
|
|
365
|
-
checkbox.setAttribute('data-file-index', String(index));
|
|
366
|
-
tagContainer.appendChild(checkbox);
|
|
367
|
-
} else if (isNewlyAdded && this.options.fileInputName) {
|
|
368
|
-
// ์๋ก ์ถ๊ฐ๋ ํ์ผ: file input (์
๋ก๋์ฉ)
|
|
369
|
-
var hiddenFileInput = document.createElement('input');
|
|
370
|
-
hiddenFileInput.type = 'file';
|
|
371
|
-
hiddenFileInput.name = this.options.fileInputName;
|
|
372
|
-
hiddenFileInput.hidden = true;
|
|
373
|
-
hiddenFileInput.classList.add('no-filestyle');
|
|
374
|
-
hiddenFileInput.setAttribute('data-file-index', String(index));
|
|
375
|
-
// File ๊ฐ์ฒด๋ฅผ DataTransfer๋ฅผ ํตํด ์ค์
|
|
376
|
-
var dataTransfer = new DataTransfer();
|
|
377
|
-
dataTransfer.items.add(file);
|
|
378
|
-
hiddenFileInput.files = dataTransfer.files;
|
|
379
|
-
tagContainer.appendChild(hiddenFileInput);
|
|
380
|
-
}
|
|
381
|
-
if (this.options.showImagePreview && file.type.startsWith('image/')) {
|
|
382
|
-
var img = document.createElement('img');
|
|
383
|
-
img.className = FILE_INPUT_CLASS_NAMES.fileImage;
|
|
384
|
-
img.src = URL.createObjectURL(file);
|
|
385
|
-
img.alt = file.name;
|
|
386
|
-
tagContainer.appendChild(img);
|
|
387
|
-
}
|
|
388
|
-
return tagContainer;
|
|
389
|
-
};
|
|
390
|
-
/**
|
|
391
|
-
* ํ์ผ ์ธ๋ฑ์ค ์
๋ฐ์ดํธ
|
|
392
|
-
*/
|
|
393
|
-
FileInputView.prototype.updateFileIndices = function (onRemove) {
|
|
394
|
-
var _a;
|
|
395
|
-
var tagContainers = this.fileTagsContainer.children;
|
|
396
|
-
var _loop_2 = function (i) {
|
|
397
|
-
var tagContainer = tagContainers[i];
|
|
398
|
-
// data-file-index ์
๋ฐ์ดํธ
|
|
399
|
-
var inputs = tagContainer.querySelectorAll('input[data-file-index]');
|
|
400
|
-
inputs.forEach(function (input) {
|
|
401
|
-
input.setAttribute('data-file-index', String(i));
|
|
402
|
-
});
|
|
403
|
-
// Tag ์ธ์คํด์ค์ onButtonClick ์
๋ฐ์ดํธ
|
|
404
|
-
if (this_2.tagInstances[i]) {
|
|
405
|
-
// Tag ์ธ์คํด์ค์ ์ฝ๋ฐฑ์ ์ง์ ์
๋ฐ์ดํธํ ์ ์์ผ๋ฏ๋ก
|
|
406
|
-
// ๋ฒํผ ์ด๋ฒคํธ ๋ฆฌ์ค๋๋ฅผ ๋ค์ ์ค์
|
|
407
|
-
var closeButton = tagContainer.querySelector('.ncua-tag__close');
|
|
408
|
-
if (closeButton) {
|
|
409
|
-
// ๊ธฐ์กด ์ด๋ฒคํธ ๋ฆฌ์ค๋๋ฅผ ์ ๊ฑฐํ๊ณ ์๋ก์ด ๊ฒ์ผ๋ก ๊ต์ฒด
|
|
410
|
-
var newCloseButton = closeButton.cloneNode(true);
|
|
411
|
-
(_a = closeButton.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newCloseButton, closeButton);
|
|
412
|
-
newCloseButton.addEventListener('click', function () {
|
|
413
|
-
return onRemove(i);
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
var this_2 = this;
|
|
419
|
-
for (var i = 0; i < tagContainers.length; i++) {
|
|
420
|
-
_loop_2(i);
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
FileInputView.prototype.setButtonDisabled = function (disabled) {
|
|
424
|
-
this.buttonElement.disabled = disabled;
|
|
425
|
-
};
|
|
426
|
-
FileInputView.prototype.getElement = function () {
|
|
427
|
-
return this.element;
|
|
428
|
-
};
|
|
429
|
-
FileInputView.prototype.getFileInputElement = function () {
|
|
430
|
-
return this.fileInputElement;
|
|
431
|
-
};
|
|
432
|
-
FileInputView.prototype.getButtonElement = function () {
|
|
433
|
-
return this.buttonElement;
|
|
434
|
-
};
|
|
435
|
-
FileInputView.prototype.destroy = function () {
|
|
436
|
-
this.tagInstances.forEach(function (tag) {
|
|
437
|
-
return tag.destroy();
|
|
438
|
-
});
|
|
439
|
-
this.tagInstances = [];
|
|
440
|
-
this.renderedFiles = [];
|
|
441
|
-
var images = this.fileTagsContainer.querySelectorAll('img');
|
|
442
|
-
images.forEach(function (img) {
|
|
443
|
-
if (img.src.startsWith('blob:')) {
|
|
444
|
-
URL.revokeObjectURL(img.src);
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
return FileInputView;
|
|
449
|
-
}();
|
|
450
|
-
export { FileInputView };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// FileInput ๊ด๋ จ CSS ํด๋์ค๋ช
์์
|
|
2
|
-
export var FILE_INPUT_CLASS_NAMES = {
|
|
3
|
-
fileInput: 'ncua-file-input',
|
|
4
|
-
inputContainer: 'ncua-file-input__input-container',
|
|
5
|
-
label: 'ncua-file-input__label',
|
|
6
|
-
helpIcon: 'ncua-input__help-icon',
|
|
7
|
-
hintText: 'ncua-input__hint-text',
|
|
8
|
-
hintList: 'ncua-file-input__hint-list',
|
|
9
|
-
hintItem: 'ncua-file-input__hint-item',
|
|
10
|
-
fileTags: 'ncua-file-input__file-tags',
|
|
11
|
-
fileTagContainer: 'ncua-file-input__file-tag-container',
|
|
12
|
-
fileImage: 'ncua-file-input__file-image'
|
|
13
|
-
};
|
|
14
|
-
export var getFileInputSizeClassName = function (size) {
|
|
15
|
-
return "ncua-file-input--".concat(size);
|
|
16
|
-
};
|
|
17
|
-
export var getButtonSizeClassName = function (size) {
|
|
18
|
-
return "ncua-button--".concat(size);
|
|
19
|
-
};
|
|
20
|
-
export var getLabelClassName = function (isRequired) {
|
|
21
|
-
return isRequired ? 'ncua-label ncua-label--required' : 'ncua-label';
|
|
22
|
-
};
|
|
23
|
-
export var getHintTextClassName = function (destructive) {
|
|
24
|
-
return destructive ? 'ncua-input__hint-text ncua-input__hint-text--destructive' : 'ncua-input__hint-text';
|
|
25
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// FileInput ๊ด๋ จ ํ์
์ ์ (React FileInput.tsx์ ๋์ผ)
|
|
2
|
-
export var FileInputErrorType;
|
|
3
|
-
(function (FileInputErrorType) {
|
|
4
|
-
FileInputErrorType["ALREADY_UPLOADED"] = "ALREADY_UPLOADED";
|
|
5
|
-
FileInputErrorType["EXCEED_MAX_FILE_SIZE"] = "EXCEED_MAX_FILE_SIZE";
|
|
6
|
-
FileInputErrorType["EXCEED_MAX_FILE_COUNT"] = "EXCEED_MAX_FILE_COUNT";
|
|
7
|
-
})(FileInputErrorType || (FileInputErrorType = {}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FileInput } from './FileInput';
|
|
2
|
-
export * from './const/classNames';
|
|
3
|
-
export * from './const/types';
|
|
4
|
-
export { FileInput } from './FileInput';
|
|
5
|
-
// ์ ์ญ ๋ฑ๋ก (์ถํ index.ts์ ๊ฐ๋ณ๋์ ํ ์ ์๊ฒ๋ ๋๋น)
|
|
6
|
-
if (typeof window !== 'undefined') {
|
|
7
|
-
window.ncua = window.ncua || {};
|
|
8
|
-
window.ncua.FileInput = FileInput;
|
|
9
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { ImageFileInputModel } from './ImageFileInputModel';
|
|
2
|
-
import { ImageFileInputView } from './ImageFileInputView';
|
|
3
|
-
var ImageFileInput = /** @class */function () {
|
|
4
|
-
function ImageFileInput(options) {
|
|
5
|
-
var _this = this;
|
|
6
|
-
/**
|
|
7
|
-
* ํ์ผ ์ ํ ๋ฒํผ ํด๋ฆญ ํธ๋ค๋ฌ
|
|
8
|
-
*/
|
|
9
|
-
this.handleBrowseClick = function () {
|
|
10
|
-
if (!_this.model.isDisabled()) {
|
|
11
|
-
_this.view.getFileInputElement().click();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* ํ์ผ ๋ณ๊ฒฝ ํธ๋ค๋ฌ
|
|
16
|
-
*/
|
|
17
|
-
this.handleFileChange = function (event) {
|
|
18
|
-
var _a, _b, _c;
|
|
19
|
-
var target = event.target;
|
|
20
|
-
var selectedFiles = target.files;
|
|
21
|
-
if (!selectedFiles || selectedFiles.length === 0) return;
|
|
22
|
-
var _d = _this.model.validateFiles(Array.from(selectedFiles)),
|
|
23
|
-
validFiles = _d.validFiles,
|
|
24
|
-
invalidFiles = _d.invalidFiles;
|
|
25
|
-
var options = _this.model.getOptions();
|
|
26
|
-
// ์ ํจํ ํ์ผ์ ๋ํ ์ฝ๋ฐฑ ํธ์ถ
|
|
27
|
-
if (validFiles.length > 0) {
|
|
28
|
-
// ํ์ผ ์ถ๊ฐ (maxFileCount๊ฐ 1์ด๋ฉด ๊ต์ฒด)
|
|
29
|
-
_this.model.addFiles(validFiles);
|
|
30
|
-
// ์ฝ๋ฐฑ์ ํตํด ์ ํ๋ ํ์ผ ์ ๋ณด ์ ๋ฌ
|
|
31
|
-
if (_this.model.isControlled()) {
|
|
32
|
-
(_a = options.onChange) === null || _a === void 0 ? void 0 : _a.call(options, _this.model.getFiles());
|
|
33
|
-
} else {
|
|
34
|
-
(_b = options.onFileSelect) === null || _b === void 0 ? void 0 : _b.call(options, _this.model.getFiles());
|
|
35
|
-
}
|
|
36
|
-
// ์๋ ๋ ๋๋ง (uncontrolled mode)
|
|
37
|
-
if (!_this.model.isControlled()) {
|
|
38
|
-
_this.render();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// ์ ํจํ์ง ์์ ํ์ผ ์ฒ๋ฆฌ
|
|
42
|
-
if (invalidFiles.length > 0) {
|
|
43
|
-
(_c = options.onFail) === null || _c === void 0 ? void 0 : _c.call(options, invalidFiles);
|
|
44
|
-
}
|
|
45
|
-
// Reset input value to allow re-selecting the same file
|
|
46
|
-
target.value = '';
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* ํ์ผ ์ ๊ฑฐ ํธ๋ค๋ฌ
|
|
50
|
-
*/
|
|
51
|
-
this.handleRemoveFile = function (index) {
|
|
52
|
-
_this.model.removeFile(index);
|
|
53
|
-
_this.notifyChange();
|
|
54
|
-
};
|
|
55
|
-
this.model = new ImageFileInputModel(options);
|
|
56
|
-
this.view = new ImageFileInputView(this.model.getOptions(), this.model);
|
|
57
|
-
this.setupEventListeners();
|
|
58
|
-
// ์ด๊ธฐ ๋ ๋๋ง (๋น ์ฌ๋กฏ ๋ฒํผ ์์ฑ)
|
|
59
|
-
this.render();
|
|
60
|
-
// ์ปจํ
์ด๋๊ฐ ์ง์ ๋๋ฉด ์๋์ผ๋ก ์ถ๊ฐ
|
|
61
|
-
if (options.container) {
|
|
62
|
-
this.appendToContainer(options.container);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* ์ปจํ
์ด๋์ ์์ ์ถ๊ฐ
|
|
67
|
-
*/
|
|
68
|
-
ImageFileInput.prototype.appendToContainer = function (container) {
|
|
69
|
-
var containerElement = null;
|
|
70
|
-
if (typeof container === 'string') {
|
|
71
|
-
// ID๋ก ์ฐพ๊ธฐ (# ์์ด)
|
|
72
|
-
containerElement = document.getElementById(container);
|
|
73
|
-
// ID๋ก ๋ชป ์ฐพ์ผ๋ฉด CSS ์
๋ ํฐ๋ก ์ฐพ๊ธฐ
|
|
74
|
-
if (!containerElement) {
|
|
75
|
-
containerElement = document.querySelector(container);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
containerElement = container;
|
|
79
|
-
}
|
|
80
|
-
if (containerElement) {
|
|
81
|
-
containerElement.appendChild(this.getElement());
|
|
82
|
-
} else {
|
|
83
|
-
console.warn("ImageFileInput: Container not found:", container);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* ์ด๋ฒคํธ ๋ฆฌ์ค๋ ์ค์
|
|
88
|
-
*/
|
|
89
|
-
ImageFileInput.prototype.setupEventListeners = function () {
|
|
90
|
-
var fileInput = this.view.getFileInputElement();
|
|
91
|
-
var button = this.view.getButtonElement();
|
|
92
|
-
// ํ์ผ ์ ํ ์ด๋ฒคํธ
|
|
93
|
-
fileInput.addEventListener('change', this.handleFileChange);
|
|
94
|
-
// ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ
|
|
95
|
-
button.addEventListener('click', this.handleBrowseClick);
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* ๋ณ๊ฒฝ ์๋ฆผ (onChange/onFileSelect ํธ์ถ)
|
|
99
|
-
*/
|
|
100
|
-
ImageFileInput.prototype.notifyChange = function () {
|
|
101
|
-
var _a, _b;
|
|
102
|
-
var options = this.model.getOptions();
|
|
103
|
-
var files = this.model.getFiles();
|
|
104
|
-
if (this.model.isControlled()) {
|
|
105
|
-
// Controlled mode: onChange ํธ์ถ
|
|
106
|
-
(_a = options.onChange) === null || _a === void 0 ? void 0 : _a.call(options, files);
|
|
107
|
-
this.render();
|
|
108
|
-
} else {
|
|
109
|
-
// Uncontrolled mode: onFileSelect ํธ์ถ ๋ฐ ๋ ๋๋ง
|
|
110
|
-
(_b = options.onFileSelect) === null || _b === void 0 ? void 0 : _b.call(options, files);
|
|
111
|
-
this.render();
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* ๋ทฐ ๋ ๋๋ง (๋ด๋ถ์ฉ)
|
|
116
|
-
*/
|
|
117
|
-
ImageFileInput.prototype.render = function () {
|
|
118
|
-
var files = this.model.getFiles();
|
|
119
|
-
this.view.renderImagePreviews(files, this.handleRemoveFile, this.handleBrowseClick);
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* ์ด๋ฏธ์ง ํ๋ฆฌ๋ทฐ๋ฅผ ์๋์ผ๋ก ๋ ๋๋ง
|
|
123
|
-
* ์ฌ์ฉ์๊ฐ ์ฝ๋ฐฑ์์ ์ง์ ํธ์ถํ์ฌ ํ๋ฆฌ๋ทฐ๋ฅผ ๋ ๋๋งํ ์ ์์
|
|
124
|
-
*/
|
|
125
|
-
ImageFileInput.prototype.renderImagePreviews = function () {
|
|
126
|
-
this.render();
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* DOM ์์ ๋ฐํ
|
|
130
|
-
*/
|
|
131
|
-
ImageFileInput.prototype.getElement = function () {
|
|
132
|
-
return this.view.getElement();
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* ํ์ฌ ํ์ผ ๋ชฉ๋ก ๋ฐํ
|
|
136
|
-
*/
|
|
137
|
-
ImageFileInput.prototype.getFiles = function () {
|
|
138
|
-
return this.model.getFiles();
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* ์ด๊ธฐ ์
๋ก๋๋ ํ์ผ ๋ชฉ๋ก ์ค์
|
|
142
|
-
*/
|
|
143
|
-
ImageFileInput.prototype.setFiles = function (uploadedFiles) {
|
|
144
|
-
var _a;
|
|
145
|
-
this.model.setFiles(uploadedFiles);
|
|
146
|
-
var options = this.model.getOptions();
|
|
147
|
-
if (this.model.isControlled()) {
|
|
148
|
-
var allFiles = this.model.getFiles();
|
|
149
|
-
(_a = options.onChange) === null || _a === void 0 ? void 0 : _a.call(options, allFiles);
|
|
150
|
-
} else {
|
|
151
|
-
this.render();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* ๋ชจ๋ ํ์ผ ์ ๊ฑฐ
|
|
156
|
-
*/
|
|
157
|
-
ImageFileInput.prototype.clearFiles = function () {
|
|
158
|
-
this.model.clearFiles();
|
|
159
|
-
this.notifyChange();
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* disabled ์ํ ์ค์
|
|
163
|
-
*/
|
|
164
|
-
ImageFileInput.prototype.setDisabled = function (disabled) {
|
|
165
|
-
this.model.setDisabled(disabled);
|
|
166
|
-
this.view.setButtonDisabled(disabled);
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* ๋ฆฌ์์ค ์ ๋ฆฌ
|
|
170
|
-
*/
|
|
171
|
-
ImageFileInput.prototype.destroy = function () {
|
|
172
|
-
// ์ด๋ฒคํธ ๋ฆฌ์ค๋ ์ ๊ฑฐ
|
|
173
|
-
var fileInput = this.view.getFileInputElement();
|
|
174
|
-
var button = this.view.getButtonElement();
|
|
175
|
-
fileInput.removeEventListener('change', this.handleFileChange);
|
|
176
|
-
button.removeEventListener('click', this.handleBrowseClick);
|
|
177
|
-
// View ๋ฆฌ์์ค ์ ๋ฆฌ
|
|
178
|
-
this.view.destroy();
|
|
179
|
-
};
|
|
180
|
-
return ImageFileInput;
|
|
181
|
-
}();
|
|
182
|
-
export { ImageFileInput };
|