@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.
Files changed (260) hide show
  1. package/mcp/bin/server.d.ts +1 -0
  2. package/mcp/bin/server.js +62 -0
  3. package/mcp/bin/server.mjs +14 -0
  4. package/mcp/bin/tools/getComponentHtml.d.ts +3 -0
  5. package/mcp/bin/tools/getComponentHtml.js +30 -0
  6. package/mcp/bin/tools/getComponentProps.d.ts +3 -0
  7. package/mcp/bin/tools/getComponentProps.js +16 -0
  8. package/mcp/bin/tools/listComponents.d.ts +3 -0
  9. package/mcp/bin/tools/listComponents.js +15 -0
  10. package/mcp/bin/tools/searchComponent.d.ts +3 -0
  11. package/mcp/bin/tools/searchComponent.js +20 -0
  12. package/mcp/bin/tools/validateHtml.d.ts +10 -0
  13. package/mcp/bin/tools/validateHtml.js +142 -0
  14. package/mcp/bin/types.d.ts +28 -0
  15. package/mcp/bin/types.js +5 -0
  16. package/mcp/bin/utils/dataLoader.d.ts +11 -0
  17. package/mcp/bin/utils/dataLoader.js +68 -0
  18. package/mcp/bin/utils/logger.d.ts +18 -0
  19. package/mcp/bin/utils/logger.js +27 -0
  20. package/mcp/bin/utils/response.d.ts +23 -0
  21. package/mcp/bin/utils/response.js +31 -0
  22. package/mcp/bin/version.d.ts +1 -0
  23. package/mcp/bin/version.js +4 -0
  24. package/mcp/data/.gitkeep +0 -0
  25. package/mcp/data/_meta.json +7 -0
  26. package/mcp/data/badge-group.json +73 -0
  27. package/mcp/data/badge.json +86 -0
  28. package/mcp/data/bread-crumb.json +22 -0
  29. package/mcp/data/breadcrumb.json +31 -0
  30. package/mcp/data/button-group.json +65 -0
  31. package/mcp/data/button.json +114 -0
  32. package/mcp/data/carousel-arrow.json +59 -0
  33. package/mcp/data/carousel-number-group.json +57 -0
  34. package/mcp/data/carousel.json +22 -0
  35. package/mcp/data/checkbox.json +31 -0
  36. package/mcp/data/combobox.json +114 -0
  37. package/mcp/data/date-picker.json +77 -0
  38. package/mcp/data/divider.json +56 -0
  39. package/mcp/data/dot.json +55 -0
  40. package/mcp/data/dropdown.json +81 -0
  41. package/mcp/data/empty-state.json +34 -0
  42. package/mcp/data/featured-icon.json +83 -0
  43. package/mcp/data/file-input.json +76 -0
  44. package/mcp/data/horizontal-tab.json +71 -0
  45. package/mcp/data/image-file-input.json +97 -0
  46. package/mcp/data/input.json +104 -0
  47. package/mcp/data/modal.json +85 -0
  48. package/mcp/data/notification.json +116 -0
  49. package/mcp/data/number-input.json +128 -0
  50. package/mcp/data/pagination.json +65 -0
  51. package/mcp/data/password-input.json +47 -0
  52. package/mcp/data/progress-bar.json +51 -0
  53. package/mcp/data/progress-circle.json +54 -0
  54. package/mcp/data/radio.json +31 -0
  55. package/mcp/data/range-date-picker-with-buttons.json +64 -0
  56. package/mcp/data/range-date-picker.json +55 -0
  57. package/mcp/data/select-dropdown.json +32 -0
  58. package/mcp/data/select.json +64 -0
  59. package/mcp/data/selectbox.json +129 -0
  60. package/mcp/data/slider.json +57 -0
  61. package/mcp/data/spinner.json +54 -0
  62. package/mcp/data/switch.json +71 -0
  63. package/mcp/data/tab.json +122 -0
  64. package/mcp/data/tag.json +66 -0
  65. package/mcp/data/textarea.json +88 -0
  66. package/mcp/data/toggle.json +59 -0
  67. package/mcp/data/tooltip.json +123 -0
  68. package/mcp/data/vertical-tab.json +64 -0
  69. package/mcp/templates/.mcp.json.example +8 -0
  70. package/mcp/templates/README.md +31 -0
  71. package/package.json +24 -3
  72. package/dist/cjs/assets/scripts/comboBox.js +0 -280
  73. package/dist/cjs/assets/scripts/datePicker.js +0 -706
  74. package/dist/cjs/assets/scripts/featuredIcon.js +0 -95
  75. package/dist/cjs/assets/scripts/fileInput/FileInput.js +0 -183
  76. package/dist/cjs/assets/scripts/fileInput/FileInputModel.js +0 -246
  77. package/dist/cjs/assets/scripts/fileInput/FileInputView.js +0 -455
  78. package/dist/cjs/assets/scripts/fileInput/const/classNames.js +0 -35
  79. package/dist/cjs/assets/scripts/fileInput/const/index.js +0 -27
  80. package/dist/cjs/assets/scripts/fileInput/const/types.js +0 -13
  81. package/dist/cjs/assets/scripts/fileInput/index.js +0 -44
  82. package/dist/cjs/assets/scripts/imageFileInput/ImageFileInput.js +0 -187
  83. package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputModel.js +0 -255
  84. package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputView.js +0 -354
  85. package/dist/cjs/assets/scripts/imageFileInput/const/classNames.js +0 -41
  86. package/dist/cjs/assets/scripts/imageFileInput/const/index.js +0 -27
  87. package/dist/cjs/assets/scripts/imageFileInput/const/types.js +0 -13
  88. package/dist/cjs/assets/scripts/imageFileInput/index.js +0 -44
  89. package/dist/cjs/assets/scripts/index.js +0 -30
  90. package/dist/cjs/assets/scripts/modal/Modal.js +0 -116
  91. package/dist/cjs/assets/scripts/modal/ModalActions.js +0 -128
  92. package/dist/cjs/assets/scripts/modal/ModalContent.js +0 -46
  93. package/dist/cjs/assets/scripts/modal/ModalHeader.js +0 -115
  94. package/dist/cjs/assets/scripts/modal/const/classNames.js +0 -41
  95. package/dist/cjs/assets/scripts/modal/const/index.js +0 -27
  96. package/dist/cjs/assets/scripts/modal/const/types.js +0 -5
  97. package/dist/cjs/assets/scripts/modal/index.js +0 -61
  98. package/dist/cjs/assets/scripts/modal/utils/contentUtils.js +0 -35
  99. package/dist/cjs/assets/scripts/notification/FloatingNotification.js +0 -180
  100. package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +0 -120
  101. package/dist/cjs/assets/scripts/notification/MessageNotification.js +0 -146
  102. package/dist/cjs/assets/scripts/notification/Notification.js +0 -116
  103. package/dist/cjs/assets/scripts/notification/const/classNames.js +0 -50
  104. package/dist/cjs/assets/scripts/notification/const/icons.js +0 -45
  105. package/dist/cjs/assets/scripts/notification/const/index.js +0 -87
  106. package/dist/cjs/assets/scripts/notification/const/sizes.js +0 -54
  107. package/dist/cjs/assets/scripts/notification/const/types.js +0 -14
  108. package/dist/cjs/assets/scripts/notification/index.js +0 -92
  109. package/dist/cjs/assets/scripts/notification/utils.js +0 -92
  110. package/dist/cjs/assets/scripts/progress-bar/ProgressBar.js +0 -272
  111. package/dist/cjs/assets/scripts/progress-bar/index.js +0 -12
  112. package/dist/cjs/assets/scripts/selectBox.js +0 -319
  113. package/dist/cjs/assets/scripts/shared/ButtonCloseX.js +0 -46
  114. package/dist/cjs/assets/scripts/tab.js +0 -40
  115. package/dist/cjs/assets/scripts/tag/Tag.js +0 -268
  116. package/dist/cjs/assets/scripts/tag/const/classNames.js +0 -24
  117. package/dist/cjs/assets/scripts/tag/const/index.js +0 -38
  118. package/dist/cjs/assets/scripts/tag/const/sizes.js +0 -13
  119. package/dist/cjs/assets/scripts/tag/const/types.js +0 -5
  120. package/dist/cjs/assets/scripts/tag/index.js +0 -44
  121. package/dist/cjs/assets/scripts/tooltip/Tooltip.js +0 -380
  122. package/dist/cjs/assets/scripts/tooltip/TooltipLayerManager.js +0 -84
  123. package/dist/cjs/assets/scripts/tooltip/const/classNames.js +0 -29
  124. package/dist/cjs/assets/scripts/tooltip/const/constants.js +0 -56
  125. package/dist/cjs/assets/scripts/tooltip/const/icons.js +0 -15
  126. package/dist/cjs/assets/scripts/tooltip/const/index.js +0 -123
  127. package/dist/cjs/assets/scripts/tooltip/const/templates.js +0 -49
  128. package/dist/cjs/assets/scripts/tooltip/const/types.js +0 -5
  129. package/dist/cjs/assets/scripts/tooltip/index.js +0 -57
  130. package/dist/cjs/assets/scripts/tooltip/utils.js +0 -41
  131. package/dist/cjs/assets/scripts/utils/unifiedBox/DOMRenderer.js +0 -384
  132. package/dist/cjs/assets/scripts/utils/unifiedBox/DropdownModel.js +0 -368
  133. package/dist/cjs/assets/scripts/utils/unifiedBox/UnifiedBoxController.js +0 -681
  134. package/dist/cjs/assets/scripts/utils/unifiedBox/UnifiedBoxManager.js +0 -711
  135. package/dist/esm/assets/scripts/comboBox.js +0 -275
  136. package/dist/esm/assets/scripts/datePicker.js +0 -699
  137. package/dist/esm/assets/scripts/featuredIcon.js +0 -90
  138. package/dist/esm/assets/scripts/fileInput/FileInput.js +0 -178
  139. package/dist/esm/assets/scripts/fileInput/FileInputModel.js +0 -241
  140. package/dist/esm/assets/scripts/fileInput/FileInputView.js +0 -450
  141. package/dist/esm/assets/scripts/fileInput/const/classNames.js +0 -25
  142. package/dist/esm/assets/scripts/fileInput/const/index.js +0 -2
  143. package/dist/esm/assets/scripts/fileInput/const/types.js +0 -7
  144. package/dist/esm/assets/scripts/fileInput/index.js +0 -9
  145. package/dist/esm/assets/scripts/imageFileInput/ImageFileInput.js +0 -182
  146. package/dist/esm/assets/scripts/imageFileInput/ImageFileInputModel.js +0 -250
  147. package/dist/esm/assets/scripts/imageFileInput/ImageFileInputView.js +0 -349
  148. package/dist/esm/assets/scripts/imageFileInput/const/classNames.js +0 -30
  149. package/dist/esm/assets/scripts/imageFileInput/const/index.js +0 -2
  150. package/dist/esm/assets/scripts/imageFileInput/const/types.js +0 -7
  151. package/dist/esm/assets/scripts/imageFileInput/index.js +0 -9
  152. package/dist/esm/assets/scripts/index.js +0 -28
  153. package/dist/esm/assets/scripts/modal/Modal.js +0 -110
  154. package/dist/esm/assets/scripts/modal/ModalActions.js +0 -123
  155. package/dist/esm/assets/scripts/modal/ModalContent.js +0 -41
  156. package/dist/esm/assets/scripts/modal/ModalHeader.js +0 -110
  157. package/dist/esm/assets/scripts/modal/const/classNames.js +0 -31
  158. package/dist/esm/assets/scripts/modal/const/index.js +0 -2
  159. package/dist/esm/assets/scripts/modal/const/types.js +0 -1
  160. package/dist/esm/assets/scripts/modal/index.js +0 -15
  161. package/dist/esm/assets/scripts/modal/utils/contentUtils.js +0 -28
  162. package/dist/esm/assets/scripts/notification/FloatingNotification.js +0 -176
  163. package/dist/esm/assets/scripts/notification/FullWidthNotification.js +0 -115
  164. package/dist/esm/assets/scripts/notification/MessageNotification.js +0 -141
  165. package/dist/esm/assets/scripts/notification/Notification.js +0 -111
  166. package/dist/esm/assets/scripts/notification/const/classNames.js +0 -44
  167. package/dist/esm/assets/scripts/notification/const/icons.js +0 -39
  168. package/dist/esm/assets/scripts/notification/const/index.js +0 -4
  169. package/dist/esm/assets/scripts/notification/const/sizes.js +0 -48
  170. package/dist/esm/assets/scripts/notification/const/types.js +0 -8
  171. package/dist/esm/assets/scripts/notification/index.js +0 -11
  172. package/dist/esm/assets/scripts/notification/utils.js +0 -79
  173. package/dist/esm/assets/scripts/progress-bar/ProgressBar.js +0 -267
  174. package/dist/esm/assets/scripts/progress-bar/index.js +0 -1
  175. package/dist/esm/assets/scripts/selectBox.js +0 -314
  176. package/dist/esm/assets/scripts/shared/ButtonCloseX.js +0 -38
  177. package/dist/esm/assets/scripts/tab.js +0 -35
  178. package/dist/esm/assets/scripts/tag/Tag.js +0 -263
  179. package/dist/esm/assets/scripts/tag/const/classNames.js +0 -16
  180. package/dist/esm/assets/scripts/tag/const/index.js +0 -3
  181. package/dist/esm/assets/scripts/tag/const/sizes.js +0 -7
  182. package/dist/esm/assets/scripts/tag/const/types.js +0 -1
  183. package/dist/esm/assets/scripts/tag/index.js +0 -9
  184. package/dist/esm/assets/scripts/tooltip/Tooltip.js +0 -375
  185. package/dist/esm/assets/scripts/tooltip/TooltipLayerManager.js +0 -79
  186. package/dist/esm/assets/scripts/tooltip/const/classNames.js +0 -23
  187. package/dist/esm/assets/scripts/tooltip/const/constants.js +0 -50
  188. package/dist/esm/assets/scripts/tooltip/const/icons.js +0 -9
  189. package/dist/esm/assets/scripts/tooltip/const/index.js +0 -4
  190. package/dist/esm/assets/scripts/tooltip/const/templates.js +0 -42
  191. package/dist/esm/assets/scripts/tooltip/const/types.js +0 -1
  192. package/dist/esm/assets/scripts/tooltip/index.js +0 -10
  193. package/dist/esm/assets/scripts/tooltip/utils.js +0 -35
  194. package/dist/esm/assets/scripts/utils/unifiedBox/DOMRenderer.js +0 -379
  195. package/dist/esm/assets/scripts/utils/unifiedBox/DropdownModel.js +0 -363
  196. package/dist/esm/assets/scripts/utils/unifiedBox/UnifiedBoxController.js +0 -676
  197. package/dist/esm/assets/scripts/utils/unifiedBox/UnifiedBoxManager.js +0 -706
  198. package/dist/types/assets/scripts/comboBox.d.ts +0 -91
  199. package/dist/types/assets/scripts/datePicker.d.ts +0 -87
  200. package/dist/types/assets/scripts/featuredIcon.d.ts +0 -23
  201. package/dist/types/assets/scripts/fileInput/FileInput.d.ts +0 -67
  202. package/dist/types/assets/scripts/fileInput/FileInputModel.d.ts +0 -70
  203. package/dist/types/assets/scripts/fileInput/FileInputView.d.ts +0 -77
  204. package/dist/types/assets/scripts/fileInput/const/classNames.d.ts +0 -17
  205. package/dist/types/assets/scripts/fileInput/const/index.d.ts +0 -3
  206. package/dist/types/assets/scripts/fileInput/const/types.d.ts +0 -132
  207. package/dist/types/assets/scripts/fileInput/index.d.ts +0 -4
  208. package/dist/types/assets/scripts/imageFileInput/ImageFileInput.d.ts +0 -64
  209. package/dist/types/assets/scripts/imageFileInput/ImageFileInputModel.d.ts +0 -74
  210. package/dist/types/assets/scripts/imageFileInput/ImageFileInputView.d.ts +0 -80
  211. package/dist/types/assets/scripts/imageFileInput/const/classNames.d.ts +0 -20
  212. package/dist/types/assets/scripts/imageFileInput/const/index.d.ts +0 -3
  213. package/dist/types/assets/scripts/imageFileInput/const/types.d.ts +0 -126
  214. package/dist/types/assets/scripts/imageFileInput/index.d.ts +0 -4
  215. package/dist/types/assets/scripts/index.d.ts +0 -33
  216. package/dist/types/assets/scripts/modal/Modal.d.ts +0 -28
  217. package/dist/types/assets/scripts/modal/ModalActions.d.ts +0 -19
  218. package/dist/types/assets/scripts/modal/ModalContent.d.ts +0 -14
  219. package/dist/types/assets/scripts/modal/ModalHeader.d.ts +0 -16
  220. package/dist/types/assets/scripts/modal/const/classNames.d.ts +0 -23
  221. package/dist/types/assets/scripts/modal/const/index.d.ts +0 -3
  222. package/dist/types/assets/scripts/modal/const/types.d.ts +0 -62
  223. package/dist/types/assets/scripts/modal/index.d.ts +0 -8
  224. package/dist/types/assets/scripts/modal/utils/contentUtils.d.ts +0 -11
  225. package/dist/types/assets/scripts/notification/FloatingNotification.d.ts +0 -25
  226. package/dist/types/assets/scripts/notification/FullWidthNotification.d.ts +0 -22
  227. package/dist/types/assets/scripts/notification/MessageNotification.d.ts +0 -23
  228. package/dist/types/assets/scripts/notification/Notification.d.ts +0 -22
  229. package/dist/types/assets/scripts/notification/const/classNames.d.ts +0 -44
  230. package/dist/types/assets/scripts/notification/const/icons.d.ts +0 -26
  231. package/dist/types/assets/scripts/notification/const/index.d.ts +0 -6
  232. package/dist/types/assets/scripts/notification/const/sizes.d.ts +0 -33
  233. package/dist/types/assets/scripts/notification/const/types.d.ts +0 -20
  234. package/dist/types/assets/scripts/notification/index.d.ts +0 -8
  235. package/dist/types/assets/scripts/notification/utils.d.ts +0 -9
  236. package/dist/types/assets/scripts/progress-bar/ProgressBar.d.ts +0 -68
  237. package/dist/types/assets/scripts/progress-bar/index.d.ts +0 -2
  238. package/dist/types/assets/scripts/selectBox.d.ts +0 -77
  239. package/dist/types/assets/scripts/shared/ButtonCloseX.d.ts +0 -6
  240. package/dist/types/assets/scripts/tab.d.ts +0 -8
  241. package/dist/types/assets/scripts/tag/Tag.d.ts +0 -28
  242. package/dist/types/assets/scripts/tag/const/classNames.d.ts +0 -12
  243. package/dist/types/assets/scripts/tag/const/index.d.ts +0 -4
  244. package/dist/types/assets/scripts/tag/const/sizes.d.ts +0 -8
  245. package/dist/types/assets/scripts/tag/const/types.d.ts +0 -34
  246. package/dist/types/assets/scripts/tag/index.d.ts +0 -4
  247. package/dist/types/assets/scripts/tooltip/Tooltip.d.ts +0 -55
  248. package/dist/types/assets/scripts/tooltip/TooltipLayerManager.d.ts +0 -22
  249. package/dist/types/assets/scripts/tooltip/const/classNames.d.ts +0 -18
  250. package/dist/types/assets/scripts/tooltip/const/constants.d.ts +0 -34
  251. package/dist/types/assets/scripts/tooltip/const/icons.d.ts +0 -5
  252. package/dist/types/assets/scripts/tooltip/const/index.d.ts +0 -6
  253. package/dist/types/assets/scripts/tooltip/const/templates.d.ts +0 -17
  254. package/dist/types/assets/scripts/tooltip/const/types.d.ts +0 -15
  255. package/dist/types/assets/scripts/tooltip/index.d.ts +0 -7
  256. package/dist/types/assets/scripts/tooltip/utils.d.ts +0 -3
  257. package/dist/types/assets/scripts/utils/unifiedBox/DOMRenderer.d.ts +0 -108
  258. package/dist/types/assets/scripts/utils/unifiedBox/DropdownModel.d.ts +0 -158
  259. package/dist/types/assets/scripts/utils/unifiedBox/UnifiedBoxController.d.ts +0 -171
  260. package/dist/types/assets/scripts/utils/unifiedBox/UnifiedBoxManager.d.ts +0 -99
@@ -1,319 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SelectBox = void 0;
7
- var _UnifiedBoxManager = require("./utils/unifiedBox/UnifiedBoxManager");
8
- var __assign = void 0 && (void 0).__assign || function () {
9
- __assign = Object.assign || function (t) {
10
- for (var s, i = 1, n = arguments.length; i < n; i++) {
11
- s = arguments[i];
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
13
- }
14
- return t;
15
- };
16
- return __assign.apply(this, arguments);
17
- };
18
- var SelectBox = exports.SelectBox = /** @class */function () {
19
- function SelectBox(element, config) {
20
- if (config === void 0) {
21
- config = {};
22
- }
23
- var _this = this;
24
- var _a, _b, _c, _d, _e, _f;
25
- this.targetSelect = null;
26
- this.isInitializing = true;
27
- this.lastValue = '';
28
- this.element = element;
29
- // 타겟 select 요소 찾기
30
- this.targetSelect = this.findTargetSelect(element);
31
- // HTML에서 옵션 파싱 (config.options가 없을 경우)
32
- var htmlOptions = this.parseOptionsFromHTML();
33
- // JavaScript 옵션을 DropdownOption 형식으로 변환
34
- var normalizedOptions = config.options ? this.normalizeOptions(config.options) : htmlOptions;
35
- var finalOptions = normalizedOptions;
36
- // HTML에서 속성 파싱
37
- var htmlAttributes = this.parseAttributesFromHTML();
38
- // 기존 API를 새 API로 변환
39
- var unifiedConfig = __assign(__assign({}, config), {
40
- type: 'selectbox',
41
- multiple: (_a = config.multiple) !== null && _a !== void 0 ? _a : false,
42
- showFooterButtons: (_b = config.showFooterButtons) !== null && _b !== void 0 ? _b : false,
43
- onEdit: config.onEdit,
44
- onSelectAll: config.onSelectAll,
45
- onComplete: config.onComplete,
46
- options: finalOptions,
47
- placeholder: config.placeholder || htmlAttributes.placeholder || '선택하세요',
48
- value: (_d = (_c = config.value) !== null && _c !== void 0 ? _c : htmlAttributes.value) !== null && _d !== void 0 ? _d : config.multiple ? [] : '',
49
- disabled: (_f = (_e = config.disabled) !== null && _e !== void 0 ? _e : htmlAttributes.disabled) !== null && _f !== void 0 ? _f : false,
50
- size: config.size || htmlAttributes.size || 'md',
51
- onChange: function (value) {
52
- var _a;
53
- // 초기화 중에는 동기화하지 않음 (무한 루프 방지)
54
- if (_this.isInitializing) {
55
- _this.lastValue = value; // 초기값 저장
56
- return;
57
- }
58
- // 값이 실제로 변경되지 않았으면 동기화 생략 (무한 루프 방지)
59
- if (JSON.stringify(_this.lastValue) === JSON.stringify(value)) {
60
- return;
61
- }
62
- _this.lastValue = value; // 새 값 저장
63
- // 타겟 select와 동기화
64
- if (config.multiple) {
65
- _this.syncWithTargetSelectMultiple(value);
66
- } else {
67
- _this.syncWithTargetSelect(value);
68
- }
69
- // onChange 콜백에는 실제 value를 전달
70
- var realValue = config.multiple ? value.map(function (v) {
71
- return _this.getRealValueFromId(v);
72
- }) : _this.getRealValueFromId(value);
73
- (_a = config.onChange) === null || _a === void 0 ? void 0 : _a.call(config, realValue);
74
- }
75
- });
76
- this.unifiedSelectBox = new _UnifiedBoxManager.UnifiedBoxManager(element, unifiedConfig);
77
- // 초기화 완료 (다음 이벤트 루프에서 실행)
78
- setTimeout(function () {
79
- _this.isInitializing = false;
80
- }, 0);
81
- }
82
- /**
83
- * JavaScript 옵션을 DropdownOption 형식으로 변환
84
- */
85
- SelectBox.prototype.normalizeOptions = function (options) {
86
- return options.map(function (option) {
87
- // 이미 DropdownOption 형식인 경우
88
- if ('label' in option) {
89
- return option;
90
- }
91
- // SelectBoxOptionType 형식인 경우 (text -> label 변환)
92
- var selectBoxOption = option;
93
- return {
94
- id: selectBoxOption.id,
95
- label: selectBoxOption.text,
96
- disabled: selectBoxOption.disabled
97
- };
98
- });
99
- };
100
- /**
101
- * 타겟 select 요소 찾기
102
- */
103
- SelectBox.prototype.findTargetSelect = function (element) {
104
- // 1. 직접 select 태그인 경우
105
- if (element.tagName === 'SELECT') {
106
- return element;
107
- }
108
- // 2. 자식으로 select 태그가 있는 경우
109
- var selectChild = element.querySelector('select');
110
- if (selectChild) {
111
- return selectChild;
112
- }
113
- // 3. data-target 속성으로 지정된 경우
114
- var targetId = element.getAttribute('data-target');
115
- if (targetId) {
116
- var targetElement = document.getElementById(targetId);
117
- if (targetElement && targetElement.tagName === 'SELECT') {
118
- return targetElement;
119
- }
120
- }
121
- return null;
122
- };
123
- /**
124
- * HTML select에서 옵션 파싱
125
- */
126
- SelectBox.prototype.parseOptionsFromHTML = function () {
127
- if (!this.targetSelect) return [];
128
- var options = [];
129
- var optionElements = this.targetSelect.querySelectorAll('option');
130
- // 빈 값 옵션 개수 확인 (최적화를 위해)
131
- var emptyValueCount = Array.from(optionElements).filter(function (opt) {
132
- return opt.value === '';
133
- }).length;
134
- optionElements.forEach(function (optionElement, index) {
135
- var optionValue = optionElement.value;
136
- // 빈 값 옵션이 1개뿐이면 단순 처리, 여러 개면 고유 ID 생성
137
- var optionId;
138
- if (optionValue !== '') {
139
- optionId = optionValue;
140
- } else if (emptyValueCount === 1) {
141
- // 빈 값 옵션이 하나뿐이면 그냥 빈 문자열 사용 (단순화)
142
- optionId = '';
143
- } else {
144
- // 빈 값 옵션이 여러 개면 고유 ID 생성 (구분 필요)
145
- optionId = "__empty_option_".concat(index);
146
- }
147
- options.push({
148
- id: optionId,
149
- label: optionElement.textContent || optionElement.value || '선택하세요',
150
- disabled: optionElement.disabled,
151
- // 원본 value 저장 (동기화를 위해)
152
- originalValue: optionValue
153
- });
154
- });
155
- return options;
156
- };
157
- /**
158
- * HTML에서 속성 파싱
159
- */
160
- SelectBox.prototype.parseAttributesFromHTML = function () {
161
- var attributes = {};
162
- if (this.targetSelect) {
163
- // select 요소의 속성들
164
- if (this.targetSelect.disabled) attributes.disabled = true;
165
- if (this.targetSelect.value) attributes.value = this.targetSelect.value;
166
- // placeholder는 첫 번째 빈 option에서 가져오기
167
- var firstOption = this.targetSelect.querySelector('option[value=""], option:not([value])');
168
- if (firstOption) {
169
- attributes.placeholder = firstOption.textContent || '선택하세요';
170
- }
171
- }
172
- // 컨테이너 요소의 data 속성들
173
- var containerAttributes = this.element.dataset;
174
- if (containerAttributes.placeholder) attributes.placeholder = containerAttributes.placeholder;
175
- if (containerAttributes.size) attributes.size = containerAttributes.size;
176
- if (containerAttributes.disabled === 'true') attributes.disabled = true;
177
- return attributes;
178
- };
179
- /**
180
- * ID로부터 실제 HTML select의 value 값을 가져오기
181
- */
182
- SelectBox.prototype.getRealValueFromId = function (id) {
183
- var options = this.unifiedSelectBox.getOptions();
184
- var option = options.find(function (opt) {
185
- return opt.id === id;
186
- });
187
- // originalValue가 있으면 그것을 사용, 없으면 id를 문자열로 변환
188
- return (option === null || option === void 0 ? void 0 : option.originalValue) !== undefined ? option.originalValue : String(id);
189
- };
190
- /**
191
- * 실제 HTML select의 value 값으로부터 내부 ID를 가져오기
192
- */
193
- SelectBox.prototype.getIdFromRealValue = function (value) {
194
- var options = this.unifiedSelectBox.getOptions();
195
- var option = options.find(function (opt) {
196
- return opt.originalValue === String(value);
197
- });
198
- // originalValue가 일치하는 옵션을 찾으면 그 ID를 반환, 없으면 value 그대로 반환
199
- return option ? option.id : value;
200
- };
201
- /**
202
- * 타겟 select와 동기화 (Single 모드)
203
- */
204
- SelectBox.prototype.syncWithTargetSelect = function (value) {
205
- if (this.targetSelect) {
206
- // originalValue가 있는 옵션을 찾아서 실제 value로 변환
207
- var realValue = this.getRealValueFromId(value);
208
- this.targetSelect.value = realValue;
209
- // select 요소의 change 이벤트 발생
210
- var event_1 = new Event('change', {
211
- bubbles: true
212
- });
213
- this.targetSelect.dispatchEvent(event_1);
214
- }
215
- };
216
- /**
217
- * 타겟 select와 동기화 (Multiple 모드)
218
- */
219
- SelectBox.prototype.syncWithTargetSelectMultiple = function (values) {
220
- var _this = this;
221
- if (this.targetSelect && this.targetSelect.multiple) {
222
- // 모든 옵션 선택 해제
223
- Array.from(this.targetSelect.options).forEach(function (option) {
224
- option.selected = false;
225
- });
226
- // 선택된 값들에 해당하는 옵션들 선택
227
- values.forEach(function (value) {
228
- var realValue = _this.getRealValueFromId(value);
229
- var option = _this.targetSelect.querySelector("option[value=\"".concat(realValue, "\"]"));
230
- if (option) {
231
- option.selected = true;
232
- }
233
- });
234
- // select 요소의 change 이벤트 발생
235
- var event_2 = new Event('change', {
236
- bubbles: true
237
- });
238
- this.targetSelect.dispatchEvent(event_2);
239
- }
240
- };
241
- // 기존 API 호환성 메서드들
242
- SelectBox.prototype.getValues = function () {
243
- var _this = this;
244
- var internalValue = this.unifiedSelectBox.getValues();
245
- return internalValue.map(function (option) {
246
- return __assign(__assign({}, option), {
247
- id: _this.getRealValueFromId(option.id)
248
- });
249
- });
250
- };
251
- SelectBox.prototype.setValues = function (value) {
252
- var _this = this;
253
- var internalValue = value.map(function (v) {
254
- return _this.getIdFromRealValue(v.id);
255
- });
256
- if (JSON.stringify(this.lastValue) === JSON.stringify(internalValue)) {
257
- return;
258
- }
259
- this.lastValue = internalValue;
260
- // id 배열을 옵션 객체 배열로 변환
261
- var allOptions = this.unifiedSelectBox.getOptions();
262
- var optionArray = internalValue.map(function (id) {
263
- return allOptions.find(function (opt) {
264
- return opt.id === id;
265
- });
266
- }).filter(function (opt) {
267
- return opt !== undefined;
268
- });
269
- this.unifiedSelectBox.setValues(optionArray);
270
- // setValues 호출 시에도 타겟 select와 동기화
271
- if (this.targetSelect) {
272
- if (this.unifiedSelectBox.isMultiple()) {
273
- this.syncWithTargetSelectMultiple(internalValue);
274
- } else {
275
- // 단일 선택 모드인 경우 첫 번째 값만 사용
276
- this.syncWithTargetSelect(internalValue[0] || '');
277
- }
278
- }
279
- };
280
- SelectBox.prototype.getOptions = function () {
281
- return this.unifiedSelectBox.getOptions();
282
- };
283
- SelectBox.prototype.updateOptions = function (newOptions) {
284
- this.unifiedSelectBox.updateOptions(newOptions);
285
- };
286
- SelectBox.prototype.setDisabled = function (disabled) {
287
- this.unifiedSelectBox.setDisabled(disabled);
288
- };
289
- SelectBox.prototype.open = function () {
290
- this.unifiedSelectBox.open();
291
- };
292
- SelectBox.prototype.close = function () {
293
- this.unifiedSelectBox.close();
294
- };
295
- SelectBox.prototype.focus = function () {
296
- this.unifiedSelectBox.focus();
297
- };
298
- SelectBox.prototype.destroy = function () {
299
- this.unifiedSelectBox.destroy();
300
- };
301
- // Multiple 모드 전용 메서드들
302
- SelectBox.prototype.selectAll = function () {
303
- this.unifiedSelectBox.selectAll();
304
- };
305
- SelectBox.prototype.deselectAll = function () {
306
- this.unifiedSelectBox.deselectAll();
307
- };
308
- SelectBox.prototype.getSelectedCount = function () {
309
- var values = this.getValues();
310
- return values.length;
311
- };
312
- SelectBox.prototype.isMultiple = function () {
313
- return this.unifiedSelectBox.isMultiple();
314
- };
315
- SelectBox.prototype.toggleSelectAll = function () {
316
- this.unifiedSelectBox.toggleSelectAll();
317
- };
318
- return SelectBox;
319
- }();
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ButtonCloseX = ButtonCloseX;
7
- exports.X_CLOSE_SVG = exports.SVG_SIZE = void 0;
8
- // 공통 X버튼 로직 (React ButtonCloseX 컴포넌트와 동일한 구조)
9
- // React ButtonCloseX와 동일한 SVG 사이즈 매핑
10
- var SVG_SIZE = exports.SVG_SIZE = {
11
- xs: 16,
12
- sm: 20,
13
- md: 20,
14
- lg: 24
15
- };
16
- // X버튼 SVG 아이콘
17
- var X_CLOSE_SVG = function (size) {
18
- return "<svg width=\"".concat(size, "\" height=\"").concat(size, "\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>");
19
- };
20
- // X버튼 렌더링 유틸리티 (React ButtonCloseX와 동일한 인터페이스)
21
- exports.X_CLOSE_SVG = X_CLOSE_SVG;
22
- function ButtonCloseX(size, theme, additionalClasses, ariaLabel, onClick) {
23
- if (theme === void 0) {
24
- theme = 'light';
25
- }
26
- if (additionalClasses === void 0) {
27
- additionalClasses = '';
28
- }
29
- if (ariaLabel === void 0) {
30
- ariaLabel = '닫기';
31
- }
32
- var svgSize = SVG_SIZE[size];
33
- var buttonId = "close-btn-".concat(Math.random().toString(36).substr(2, 9));
34
- var buttonHTML = "\n <button type=\"button\" id=\"".concat(buttonId, "\" class=\"ncua-button-close-x ncua-button-close-x--").concat(size, " ncua-button-close-x--").concat(theme, " ").concat(additionalClasses, "\" aria-label=\"").concat(ariaLabel, "\">\n ").concat(X_CLOSE_SVG(svgSize.toString()), "\n </button>\n ");
35
- // onClick이 제공된 경우 이벤트 바인딩
36
- if (onClick) {
37
- // DOM에 추가된 후 이벤트 바인딩을 위해 setTimeout 사용
38
- setTimeout(function () {
39
- var button = document.getElementById(buttonId);
40
- if (button) {
41
- button.addEventListener('click', onClick);
42
- }
43
- }, 0);
44
- }
45
- return buttonHTML;
46
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Tab = void 0;
7
- var _swiper = require("swiper");
8
- var Tab = exports.Tab = /** @class */function () {
9
- function Tab(element) {
10
- this.swiper = null;
11
- if (!element) {
12
- throw new Error('Tab element is required');
13
- }
14
- if (!(element instanceof HTMLElement)) {
15
- throw new Error('Invalid element type provided to Tab');
16
- }
17
- this.element = element;
18
- this.init();
19
- }
20
- Tab.prototype.init = function () {
21
- this.swiper = new _swiper.Swiper(this.element, {
22
- slidesPerView: 'auto',
23
- spaceBetween: 8,
24
- grabCursor: true,
25
- loop: false,
26
- freeMode: {
27
- enabled: true,
28
- sticky: false
29
- },
30
- mousewheel: true
31
- });
32
- };
33
- Tab.prototype.destroy = function () {
34
- if (this.swiper) {
35
- this.swiper.destroy();
36
- this.swiper = null;
37
- }
38
- };
39
- return Tab;
40
- }();
@@ -1,268 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Tag = void 0;
7
- var _classNames = require("./const/classNames");
8
- var _sizes = require("./const/sizes");
9
- var __assign = void 0 && (void 0).__assign || function () {
10
- __assign = Object.assign || function (t) {
11
- for (var s, i = 1, n = arguments.length; i < n; i++) {
12
- s = arguments[i];
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
14
- }
15
- return t;
16
- };
17
- return __assign.apply(this, arguments);
18
- };
19
- // CSS 변수 값을 가져오는 유틸리티 함수
20
- var getCSSVariable = function (variableName, fallback) {
21
- if (fallback === void 0) {
22
- fallback = '';
23
- }
24
- return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim() || fallback;
25
- };
26
- // 위치 계산 로직
27
- var calculateOptimalPosition = function (triggerElement, tooltipElement) {
28
- var triggerRect = triggerElement.getBoundingClientRect();
29
- var tooltipRect = tooltipElement.getBoundingClientRect();
30
- var viewportWidth = window.innerWidth,
31
- viewportHeight = window.innerHeight;
32
- var tooltipWidth = tooltipRect.width || _sizes.DEFAULT_TOOLTIP_WIDTH;
33
- var tooltipHeight = tooltipRect.height || _sizes.DEFAULT_TOOLTIP_HEIGHT;
34
- var spaces = {
35
- top: triggerRect.top,
36
- bottom: viewportHeight - triggerRect.bottom,
37
- left: triggerRect.left,
38
- right: viewportWidth - triggerRect.right
39
- };
40
- // 위/아래 공간을 먼저 확인하고 우선순위 결정
41
- var hasTopSpace = spaces.top >= tooltipHeight + _sizes.MARGIN;
42
- // 위쪽 공간이 있으면 top 우선, 없으면 bottom 우선
43
- var positions = hasTopSpace ? ['top-right', 'top-left', 'bottom-right', 'bottom-left'] : ['bottom-right', 'bottom-left', 'top-right', 'top-left'];
44
- for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
45
- var position = positions_1[_i];
46
- var isTop = position.includes('top');
47
- var isRight = position.includes('right');
48
- var hasVerticalSpace = isTop ? spaces.top >= tooltipHeight + _sizes.MARGIN : spaces.bottom >= tooltipHeight + _sizes.MARGIN;
49
- var hasHorizontalSpace = isRight ? spaces.right >= tooltipWidth + _sizes.MARGIN // right 정렬: 툴팁이 오른쪽으로 펼쳐짐
50
- : spaces.left >= tooltipWidth + _sizes.MARGIN; // left 정렬: 툴팁이 왼쪽으로 펼쳐짐
51
- if (hasVerticalSpace && hasHorizontalSpace) {
52
- return position;
53
- }
54
- }
55
- // 모든 조건이 맞지 않으면 공간이 더 많은 쪽으로
56
- var fallbackPosition = hasTopSpace ? 'top-right' : 'bottom-right';
57
- return fallbackPosition;
58
- };
59
- var Tag = exports.Tag = /** @class */function () {
60
- function Tag(options) {
61
- var _this = this;
62
- this.isTooltipVisible = false;
63
- this.calculatedPosition = 'top-right';
64
- this.tooltipElement = null;
65
- this.handleMouseEnter = function () {
66
- if (!_this.shouldTruncate()) return;
67
- _this.isTooltipVisible = true;
68
- // 위치 계산
69
- if (_this.tooltipElement) {
70
- var optimalPosition = calculateOptimalPosition(_this.element, _this.tooltipElement);
71
- _this.calculatedPosition = optimalPosition;
72
- } else {
73
- // 툴팁이 없으면 더미 요소로 계산
74
- var dummyTooltipElement = document.createElement('div');
75
- dummyTooltipElement.style.width = "".concat(_sizes.DEFAULT_TOOLTIP_WIDTH, "px");
76
- dummyTooltipElement.style.height = "".concat(_sizes.DEFAULT_TOOLTIP_HEIGHT, "px");
77
- var optimalPosition = calculateOptimalPosition(_this.element, dummyTooltipElement);
78
- _this.calculatedPosition = optimalPosition;
79
- }
80
- _this.createTooltip();
81
- };
82
- this.handleMouseLeave = function () {
83
- _this.removeTooltip(); // removeTooltip에서 isTooltipVisible을 false로 설정
84
- };
85
- this.options = __assign({
86
- size: 'sm',
87
- maxLength: 20
88
- }, options);
89
- this.createElement();
90
- }
91
- Tag.prototype.createElement = function () {
92
- // 메인 태그 요소 생성
93
- this.element = document.createElement('span');
94
- this.element.className = this.getTagClasses();
95
- // 텍스트 길이 체크 및 말줄임 처리
96
- var shouldTruncate = this.shouldTruncate();
97
- var displayText = shouldTruncate ? this.getTruncatedText() : this.options.text;
98
- // 아이콘 추가
99
- if (this.options.icon) {
100
- var iconElement = this.createSideSlot(this.options.icon);
101
- if (iconElement) {
102
- this.element.appendChild(iconElement);
103
- }
104
- }
105
- // 텍스트 요소 생성
106
- var textElement = document.createElement('span');
107
- textElement.className = _classNames.TAG_CLASS_NAMES.text;
108
- textElement.textContent = displayText;
109
- this.element.appendChild(textElement);
110
- // 카운트 추가
111
- if (this.options.count) {
112
- var countElement = document.createElement('span');
113
- countElement.className = _classNames.TAG_CLASS_NAMES.count;
114
- countElement.textContent = this.options.count;
115
- this.element.appendChild(countElement);
116
- }
117
- // 닫기 버튼 추가
118
- if (this.options.close) {
119
- var closeButton = this.createCloseButton();
120
- this.element.appendChild(closeButton);
121
- }
122
- // 툴팁 이벤트 리스너 추가 (텍스트가 잘린 경우에만)
123
- if (shouldTruncate) {
124
- this.element.addEventListener('mouseenter', this.handleMouseEnter);
125
- this.element.addEventListener('mouseleave', this.handleMouseLeave);
126
- }
127
- };
128
- Tag.prototype.getTagClasses = function () {
129
- var classes = [_classNames.TAG_CLASS_NAMES.tag, (0, _classNames.getTagSizeClassName)(this.options.size)];
130
- if (this.shouldTruncate()) {
131
- classes.push(_classNames.TAG_CLASS_NAMES.truncated);
132
- }
133
- return classes.join(' ');
134
- };
135
- Tag.prototype.shouldTruncate = function () {
136
- return this.options.text.length > this.options.maxLength;
137
- };
138
- Tag.prototype.getTruncatedText = function () {
139
- return "".concat(this.options.text.slice(0, this.options.maxLength - 2), "...");
140
- };
141
- Tag.prototype.createSideSlot = function (slot) {
142
- if (slot.type === 'icon') {
143
- // 아이콘 SVG 문자열을 DOM 요소로 변환 (DOMParser 사용)
144
- var iconSVG = this.createIconSVG(slot.icon, _sizes.iconSize[this.options.size], slot.color);
145
- var parser = new DOMParser();
146
- var doc = parser.parseFromString(iconSVG, 'image/svg+xml');
147
- return doc.documentElement;
148
- }
149
- if (slot.type === 'dot') {
150
- var dotElement = document.createElement('span');
151
- dotElement.className = "ncua-dot ncua-dot--neutral ncua-dot--".concat(slot.size || 'sm');
152
- if (slot.color) {
153
- dotElement.style.backgroundColor = slot.color;
154
- }
155
- return dotElement;
156
- }
157
- // 커스텀 요소는 그대로 반환
158
- return slot.children;
159
- };
160
- Tag.prototype.createIconSVG = function (iconName, size, color) {
161
- var colorStyle = color ? " style=\"color: ".concat(color, "\"") : '';
162
- // 현재는 arrow-left 아이콘만 지원
163
- if (iconName === 'arrow-left') {
164
- return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(size, "\" height=\"").concat(size, "\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"none\"").concat(colorStyle, ">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M19 12H5m0 0 7 7m-7-7 7-7\" />\n </svg>");
165
- }
166
- // 기본 빈 SVG
167
- return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(size, "\" height=\"").concat(size, "\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"none\"").concat(colorStyle, "></svg>");
168
- };
169
- Tag.prototype.createCloseButton = function () {
170
- // react와 동일한 구조로 직접 구현
171
- var button = document.createElement('button');
172
- button.type = 'button';
173
- button.className = _classNames.TAG_CLASS_NAMES.close;
174
- // React 버전과 동일한 SVG 생성 (문자열 방식)
175
- var grayColor = getCSSVariable('--gray-300', '#a4a5a8');
176
- var svgString = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(_sizes.iconSize[this.options.size], "\" height=\"").concat(_sizes.iconSize[this.options.size], "\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"none\" style=\"color: ").concat(grayColor, "\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M18 6 6 18M6 6l12 12\" />\n </svg>");
177
- // DOMParser로 SVG 문자열을 DOM 요소로 변환
178
- var parser = new DOMParser();
179
- var doc = parser.parseFromString(svgString, 'image/svg+xml');
180
- var svg = doc.documentElement;
181
- button.appendChild(svg);
182
- // 이벤트 리스너 추가
183
- if (this.options.onButtonClick) {
184
- button.addEventListener('click', this.options.onButtonClick);
185
- }
186
- return button;
187
- };
188
- Tag.prototype.createTooltip = function () {
189
- if (this.tooltipElement || !this.isTooltipVisible) {
190
- return; // 이미 생성됨 또는 표시하지 않음
191
- }
192
- this.tooltipElement = document.createElement('span');
193
- this.tooltipElement.className = "".concat(_classNames.TAG_CLASS_NAMES.tooltip, " ").concat((0, _classNames.getTooltipPositionClassName)(this.calculatedPosition));
194
- var tooltipContent = document.createElement('span');
195
- tooltipContent.className = _classNames.TAG_CLASS_NAMES.tooltipContent;
196
- tooltipContent.textContent = this.options.text;
197
- this.tooltipElement.appendChild(tooltipContent);
198
- this.element.appendChild(this.tooltipElement);
199
- };
200
- Tag.prototype.removeTooltip = function () {
201
- if (this.tooltipElement) {
202
- this.element.removeChild(this.tooltipElement);
203
- this.tooltipElement = null;
204
- }
205
- this.isTooltipVisible = false;
206
- };
207
- Tag.prototype.getElement = function () {
208
- return this.element;
209
- };
210
- Tag.prototype.isTooltipShown = function () {
211
- return this.isTooltipVisible;
212
- };
213
- Tag.prototype.setText = function (text) {
214
- this.options.text = text;
215
- this.updateTextElement();
216
- };
217
- Tag.prototype.setCount = function (count) {
218
- this.options.count = count;
219
- this.updateCountElement();
220
- };
221
- Tag.prototype.updateTextElement = function () {
222
- var textElement = this.element.querySelector(".".concat(_classNames.TAG_CLASS_NAMES.text));
223
- if (textElement) {
224
- var shouldTruncate = this.shouldTruncate();
225
- var displayText = shouldTruncate ? this.getTruncatedText() : this.options.text;
226
- textElement.textContent = displayText;
227
- // 클래스 업데이트
228
- if (shouldTruncate) {
229
- this.element.classList.add(_classNames.TAG_CLASS_NAMES.truncated);
230
- } else {
231
- this.element.classList.remove(_classNames.TAG_CLASS_NAMES.truncated);
232
- }
233
- }
234
- };
235
- Tag.prototype.updateCountElement = function () {
236
- var existingCount = this.element.querySelector(".".concat(_classNames.TAG_CLASS_NAMES.count));
237
- if (this.options.count) {
238
- if (existingCount) {
239
- existingCount.textContent = this.options.count;
240
- } else {
241
- // 카운트 요소 새로 생성
242
- var countElement = document.createElement('span');
243
- countElement.className = _classNames.TAG_CLASS_NAMES.count;
244
- countElement.textContent = this.options.count;
245
- // 닫기 버튼 앞에 삽입
246
- var closeButton = this.element.querySelector(".".concat(_classNames.TAG_CLASS_NAMES.close));
247
- if (closeButton) {
248
- this.element.insertBefore(countElement, closeButton);
249
- } else {
250
- this.element.appendChild(countElement);
251
- }
252
- }
253
- } else {
254
- // 카운트 제거
255
- if (existingCount) {
256
- this.element.removeChild(existingCount);
257
- }
258
- }
259
- };
260
- Tag.prototype.destroy = function () {
261
- this.element.removeEventListener('mouseenter', this.handleMouseEnter);
262
- this.element.removeEventListener('mouseleave', this.handleMouseLeave);
263
- if (this.tooltipElement) {
264
- this.removeTooltip();
265
- }
266
- };
267
- return Tag;
268
- }();