@ncds/ui-admin 1.6.1 → 1.6.3
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/dist/cjs/assets/scripts/comboBox.js +3 -3
- package/dist/cjs/assets/scripts/selectBox.js +2 -2
- package/dist/cjs/assets/scripts/utils/{selectbox/SelectBoxController.js → unifiedBox/UnifiedBoxController.js} +38 -38
- package/dist/cjs/assets/scripts/utils/{selectbox/UnifiedSelectBox.js → unifiedBox/UnifiedBoxManager.js} +42 -42
- package/dist/cjs/src/components/button/Button.js +0 -1
- package/dist/cjs/src/components/checkbox/CheckboxInput.js +0 -3
- package/dist/cjs/src/components/date-picker/DatePicker.js +5 -1
- package/dist/cjs/src/components/dot/Dot.js +1 -1
- package/dist/cjs/src/components/pagination/Pagination.js +1 -1
- package/dist/cjs/src/components/select/Select.js +0 -3
- package/dist/cjs/src/components/tab/HorizontalTab.js +1 -1
- package/dist/cjs/src/components/tab/VerticalTab.js +1 -1
- package/dist/cjs/src/types/side-slot.js +5 -0
- package/dist/esm/assets/scripts/comboBox.js +3 -3
- package/dist/esm/assets/scripts/selectBox.js +2 -2
- package/dist/esm/assets/scripts/utils/{selectbox/SelectBoxController.js → unifiedBox/UnifiedBoxController.js} +38 -38
- package/dist/esm/assets/scripts/utils/{selectbox/UnifiedSelectBox.js → unifiedBox/UnifiedBoxManager.js} +42 -42
- package/dist/esm/src/components/button/Button.js +0 -1
- package/dist/esm/src/components/checkbox/CheckboxInput.js +0 -3
- package/dist/esm/src/components/date-picker/DatePicker.js +5 -1
- package/dist/esm/src/components/dot/Dot.js +1 -1
- package/dist/esm/src/components/pagination/Pagination.js +1 -1
- package/dist/esm/src/components/select/Select.js +0 -3
- package/dist/esm/src/components/switch/Switch.js +1 -1
- package/dist/esm/src/components/tab/HorizontalTab.js +1 -1
- package/dist/esm/src/components/tab/VerticalTab.js +1 -1
- package/dist/esm/src/types/side-slot.js +1 -0
- package/dist/types/assets/scripts/comboBox.d.ts +3 -3
- package/dist/types/assets/scripts/modal/const/types.d.ts +1 -1
- package/dist/types/assets/scripts/selectBox.d.ts +1 -1
- package/dist/types/assets/scripts/utils/{selectbox/SelectBoxController.d.ts → unifiedBox/UnifiedBoxController.d.ts} +5 -5
- package/dist/types/assets/scripts/utils/{selectbox/UnifiedSelectBox.d.ts → unifiedBox/UnifiedBoxManager.d.ts} +6 -6
- package/dist/types/src/components/badge/BadgeGroup.d.ts +1 -1
- package/dist/types/src/components/button/Button.d.ts +13 -13
- package/dist/types/src/components/checkbox/Checkbox.d.ts +1 -2
- package/dist/types/src/components/checkbox/CheckboxInput.d.ts +0 -3
- package/dist/types/src/components/combobox/ComboBox.d.ts +3 -4
- package/dist/types/src/components/dot/Dot.d.ts +1 -1
- package/dist/types/src/components/dropdown/Dropdown.d.ts +1 -5
- package/dist/types/src/components/input/InputBase.d.ts +3 -3
- package/dist/types/src/components/input/NumberInput.d.ts +1 -1
- package/dist/types/src/components/modal/Modal.d.ts +2 -2
- package/dist/types/src/components/pagination/Pagination.d.ts +1 -1
- package/dist/types/src/components/progress-bar/types.d.ts +1 -1
- package/dist/types/src/components/radio/Radio.d.ts +1 -2
- package/dist/types/src/components/select/Select.d.ts +3 -7
- package/dist/types/src/components/selectbox/SelectBox.d.ts +3 -4
- package/dist/types/src/components/spinner/Spinner.d.ts +1 -1
- package/dist/types/src/components/tag/Tag.d.ts +1 -1
- package/dist/types/src/types/side-slot.d.ts +26 -0
- package/dist/ui-admin/assets/styles/style.css +22 -40
- package/package.json +1 -1
- /package/dist/cjs/assets/scripts/utils/{selectbox → unifiedBox}/DOMRenderer.js +0 -0
- /package/dist/cjs/assets/scripts/utils/{selectbox → unifiedBox}/DropdownModel.js +0 -0
- /package/dist/esm/assets/scripts/utils/{selectbox → unifiedBox}/DOMRenderer.js +0 -0
- /package/dist/esm/assets/scripts/utils/{selectbox → unifiedBox}/DropdownModel.js +0 -0
- /package/dist/types/assets/scripts/utils/{selectbox → unifiedBox}/DOMRenderer.d.ts +0 -0
- /package/dist/types/assets/scripts/utils/{selectbox → unifiedBox}/DropdownModel.d.ts +0 -0
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ComboBox = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _UnifiedBoxManager = require("./utils/unifiedBox/UnifiedBoxManager");
|
|
8
8
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
9
9
|
__assign = Object.assign || function (t) {
|
|
10
10
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -80,7 +80,7 @@ var ComboBox = exports.ComboBox = /** @class */function () {
|
|
|
80
80
|
(_a = config.onChange) === null || _a === void 0 ? void 0 : _a.call(config, value);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
this.unifiedSelectBox = new
|
|
83
|
+
this.unifiedSelectBox = new _UnifiedBoxManager.UnifiedBoxManager(element, unifiedConfig);
|
|
84
84
|
// 초기화 완료 (다음 이벤트 루프에서 실행)
|
|
85
85
|
setTimeout(function () {
|
|
86
86
|
_this.isInitializing = false;
|
|
@@ -235,7 +235,7 @@ var ComboBox = exports.ComboBox = /** @class */function () {
|
|
|
235
235
|
};
|
|
236
236
|
// ComboBox 특화 메서드들
|
|
237
237
|
ComboBox.prototype.clearInput = function () {
|
|
238
|
-
//
|
|
238
|
+
// UnifiedBoxManager의 handleClearInput과 동일한 로직
|
|
239
239
|
this.unifiedSelectBox.close();
|
|
240
240
|
};
|
|
241
241
|
ComboBox.prototype.getDebugInfo = function () {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SelectBox = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _UnifiedBoxManager = require("./utils/unifiedBox/UnifiedBoxManager");
|
|
8
8
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
9
9
|
__assign = Object.assign || function (t) {
|
|
10
10
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -73,7 +73,7 @@ var SelectBox = exports.SelectBox = /** @class */function () {
|
|
|
73
73
|
(_a = config.onChange) === null || _a === void 0 ? void 0 : _a.call(config, realValue);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
this.unifiedSelectBox = new
|
|
76
|
+
this.unifiedSelectBox = new _UnifiedBoxManager.UnifiedBoxManager(element, unifiedConfig);
|
|
77
77
|
// 초기화 완료 (다음 이벤트 루프에서 실행)
|
|
78
78
|
setTimeout(function () {
|
|
79
79
|
_this.isInitializing = false;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.UnifiedBoxController = void 0;
|
|
7
7
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
8
8
|
__assign = Object.assign || function (t) {
|
|
9
9
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -18,8 +18,8 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
18
18
|
* SelectBox 통합 컨트롤러
|
|
19
19
|
* 이벤트 처리, UI 상태 제어, 사용자 인터랙션 담당
|
|
20
20
|
*/
|
|
21
|
-
var
|
|
22
|
-
function
|
|
21
|
+
var UnifiedBoxController = exports.UnifiedBoxController = /** @class */function () {
|
|
22
|
+
function UnifiedBoxController(config) {
|
|
23
23
|
this.isOpen = false;
|
|
24
24
|
this.focusedIndex = -1;
|
|
25
25
|
this.isKeyboardNavigation = false;
|
|
@@ -38,7 +38,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
38
38
|
/**
|
|
39
39
|
* 상태 변경 리스너 (Observer Pattern)
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
UnifiedBoxController.prototype.onStateChange = function (newState, changedFields) {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
// 드롭다운 열기/닫기 상태 동기화
|
|
44
44
|
if (changedFields.includes('isOpen')) {
|
|
@@ -64,7 +64,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
64
64
|
/**
|
|
65
65
|
* 이벤트 핸들러 설정
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
UnifiedBoxController.prototype.setupEventHandlers = function () {
|
|
68
68
|
var _this = this;
|
|
69
69
|
// 외부 클릭 핸들러
|
|
70
70
|
this.outsideClickHandler = function (e) {
|
|
@@ -94,7 +94,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
94
94
|
/**
|
|
95
95
|
* 드롭다운 열기
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
UnifiedBoxController.prototype.open = function () {
|
|
98
98
|
var _a, _b;
|
|
99
99
|
if (this.config.disabled || this.isOpen) return;
|
|
100
100
|
this.config.model.setOpen(true);
|
|
@@ -107,7 +107,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
107
107
|
/**
|
|
108
108
|
* 드롭다운 닫기
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
UnifiedBoxController.prototype.close = function () {
|
|
111
111
|
var _a, _b;
|
|
112
112
|
if (!this.isOpen) return;
|
|
113
113
|
this.config.model.setOpen(false);
|
|
@@ -120,7 +120,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
120
120
|
/**
|
|
121
121
|
* 드롭다운 토글
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
UnifiedBoxController.prototype.toggle = function () {
|
|
124
124
|
if (this.isOpen) {
|
|
125
125
|
this.close();
|
|
126
126
|
} else {
|
|
@@ -130,7 +130,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
130
130
|
/**
|
|
131
131
|
* 키보드 입력 처리
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
UnifiedBoxController.prototype.handleKeyDown = function (event) {
|
|
134
134
|
var state = this.config.model.getState();
|
|
135
135
|
switch (event.key) {
|
|
136
136
|
case 'ArrowDown':
|
|
@@ -173,7 +173,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
173
173
|
/**
|
|
174
174
|
* 옵션 검색
|
|
175
175
|
*/
|
|
176
|
-
|
|
176
|
+
UnifiedBoxController.prototype.searchOption = function (char) {
|
|
177
177
|
var state = this.config.model.getState();
|
|
178
178
|
var options = state.filteredOptions;
|
|
179
179
|
var startIndex = this.focusedIndex >= 0 ? this.focusedIndex + 1 : 0;
|
|
@@ -192,13 +192,13 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
192
192
|
/**
|
|
193
193
|
* 드롭다운 표시/숨김 업데이트
|
|
194
194
|
*/
|
|
195
|
-
|
|
195
|
+
UnifiedBoxController.prototype.updateDropdownVisibility = function (isOpen) {
|
|
196
196
|
this.config.dropdownElement.style.display = isOpen ? 'block' : 'none';
|
|
197
197
|
};
|
|
198
198
|
/**
|
|
199
199
|
* 옵션 표시 업데이트
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
UnifiedBoxController.prototype.updateOptionsDisplay = function (state) {
|
|
202
202
|
var hasFilteredOptions = state.filteredOptions.length > 0;
|
|
203
203
|
var countChanged = this.lastFilteredOptionsCount !== state.filteredOptions.length;
|
|
204
204
|
// 빈 옵션일 때 해시 초기화 및 전체 렌더링
|
|
@@ -275,7 +275,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
275
275
|
/**
|
|
276
276
|
* 포커스된 옵션 업데이트
|
|
277
277
|
*/
|
|
278
|
-
|
|
278
|
+
UnifiedBoxController.prototype.updateFocusedOption = function (focusedIndex) {
|
|
279
279
|
this.optionElements.forEach(function (element, index) {
|
|
280
280
|
if (index === focusedIndex) {
|
|
281
281
|
element.classList.add('ncua-select-dropdown__option--focused');
|
|
@@ -290,7 +290,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
290
290
|
/**
|
|
291
291
|
* 옵션 클릭 이벤트 핸들러 등록
|
|
292
292
|
*/
|
|
293
|
-
|
|
293
|
+
UnifiedBoxController.prototype.attachOptionEventHandlers = function () {
|
|
294
294
|
var _this = this;
|
|
295
295
|
// 기존 이벤트 리스너 제거
|
|
296
296
|
this.removeOptionEventHandlers();
|
|
@@ -333,7 +333,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
333
333
|
/**
|
|
334
334
|
* 옵션 이벤트 핸들러 제거
|
|
335
335
|
*/
|
|
336
|
-
|
|
336
|
+
UnifiedBoxController.prototype.removeOptionEventHandlers = function () {
|
|
337
337
|
this.optionElements.forEach(function (element) {
|
|
338
338
|
var clickHandler = element._clickHandler;
|
|
339
339
|
var hoverHandler = element._hoverHandler;
|
|
@@ -350,7 +350,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
350
350
|
/**
|
|
351
351
|
* 옵션 업데이트가 필요한지 판단
|
|
352
352
|
*/
|
|
353
|
-
|
|
353
|
+
UnifiedBoxController.prototype.shouldUpdateOptions = function (changedFields) {
|
|
354
354
|
return changedFields.some(function (field) {
|
|
355
355
|
return ['options', 'filteredOptions', 'selectedValues', 'showAllItems'].includes(field);
|
|
356
356
|
});
|
|
@@ -358,20 +358,20 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
358
358
|
/**
|
|
359
359
|
* 외부 클릭 감지 활성화
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
UnifiedBoxController.prototype.enableOutsideClick = function () {
|
|
362
362
|
document.addEventListener('mousedown', this.outsideClickHandler);
|
|
363
363
|
};
|
|
364
364
|
/**
|
|
365
365
|
* 외부 클릭 감지 비활성화
|
|
366
366
|
*/
|
|
367
|
-
|
|
367
|
+
UnifiedBoxController.prototype.disableOutsideClick = function () {
|
|
368
368
|
document.removeEventListener('mousedown', this.outsideClickHandler);
|
|
369
369
|
};
|
|
370
370
|
/**
|
|
371
371
|
* 스크롤 잠금 활성화 (드롭다운 내부 스크롤은 허용)
|
|
372
372
|
* ComboBox 또는 multiple 모드에서는 스크롤 잠금 비활성화
|
|
373
373
|
*/
|
|
374
|
-
|
|
374
|
+
UnifiedBoxController.prototype.enableScrollLock = function () {
|
|
375
375
|
var _this = this;
|
|
376
376
|
// ComboBox 또는 multiple 모드에서는 스크롤 잠금 비활성화
|
|
377
377
|
if (this.config.type === 'combobox' || this.config.model.isMultiple()) {
|
|
@@ -437,7 +437,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
437
437
|
/**
|
|
438
438
|
* 스크롤 가능한 부모 요소 찾기
|
|
439
439
|
*/
|
|
440
|
-
|
|
440
|
+
UnifiedBoxController.prototype.findScrollableParent = function (element, boundary) {
|
|
441
441
|
var current = element;
|
|
442
442
|
while (current && current !== boundary && boundary.contains(current)) {
|
|
443
443
|
var computedStyle = window.getComputedStyle(current);
|
|
@@ -456,7 +456,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
456
456
|
/**
|
|
457
457
|
* 스크롤 잠금 해제
|
|
458
458
|
*/
|
|
459
|
-
|
|
459
|
+
UnifiedBoxController.prototype.disableScrollLock = function () {
|
|
460
460
|
if (this.scrollLockHandlers) {
|
|
461
461
|
document.removeEventListener('wheel', this.scrollLockHandlers.wheel);
|
|
462
462
|
document.removeEventListener('touchmove', this.scrollLockHandlers.touchmove);
|
|
@@ -467,7 +467,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
467
467
|
/**
|
|
468
468
|
* 마우스 호버 처리 (외부에서 호출용)
|
|
469
469
|
*/
|
|
470
|
-
|
|
470
|
+
UnifiedBoxController.prototype.handleMouseHover = function (index) {
|
|
471
471
|
if (!this.isKeyboardNavigation) {
|
|
472
472
|
this.config.model.setFocusedIndex(index);
|
|
473
473
|
}
|
|
@@ -475,7 +475,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
475
475
|
/**
|
|
476
476
|
* 옵션 배열 업데이트
|
|
477
477
|
*/
|
|
478
|
-
|
|
478
|
+
UnifiedBoxController.prototype.updateOptions = function (options) {
|
|
479
479
|
var _this = this;
|
|
480
480
|
this.config.model.updateOptions(options);
|
|
481
481
|
// 스크롤 리스너는 이미 등록되어 있으므로 제거/재등록 불필요
|
|
@@ -488,24 +488,24 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
|
-
|
|
491
|
+
UnifiedBoxController.prototype.getIsOpen = function () {
|
|
492
492
|
return this.config.model.getState().isOpen;
|
|
493
493
|
};
|
|
494
|
-
|
|
494
|
+
UnifiedBoxController.prototype.setFocus = function (index) {
|
|
495
495
|
this.config.model.setFocusedIndex(index);
|
|
496
496
|
};
|
|
497
|
-
|
|
497
|
+
UnifiedBoxController.prototype.getFocusedIndex = function () {
|
|
498
498
|
return this.config.model.getState().focusedIndex;
|
|
499
499
|
};
|
|
500
500
|
/**
|
|
501
501
|
* DropdownUtils 호환을 위한 정적 팩토리 메서드
|
|
502
502
|
*/
|
|
503
|
-
|
|
503
|
+
UnifiedBoxController.createFromDropdownConfig = function (config) {
|
|
504
504
|
// DropdownModel 생성
|
|
505
505
|
var model = new (require('./DropdownModel').DropdownModel)(config.options || [], false);
|
|
506
506
|
// DOMRenderer 생성
|
|
507
507
|
var renderer = new (require('./DOMRenderer').DOMRenderer)();
|
|
508
|
-
//
|
|
508
|
+
// UnifiedBoxController 생성
|
|
509
509
|
var controllerConfig = {
|
|
510
510
|
triggerElement: config.triggerElement,
|
|
511
511
|
dropdownElement: config.dropdownElement,
|
|
@@ -527,13 +527,13 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
527
527
|
if (index >= 0) (_c = config.onOptionSelect) === null || _c === void 0 ? void 0 : _c.call(config, index);
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
|
-
return new
|
|
530
|
+
return new UnifiedBoxController(controllerConfig);
|
|
531
531
|
};
|
|
532
532
|
/**
|
|
533
533
|
* 드롭다운 위치 조정 (화면 크기에 따라 up/down 방향 결정)
|
|
534
534
|
* 단일 선택 모드에서만 적용
|
|
535
535
|
*/
|
|
536
|
-
|
|
536
|
+
UnifiedBoxController.prototype.adjustDropdownPosition = function () {
|
|
537
537
|
if (!this.config.dropdownElement || !this.config.triggerElement) return;
|
|
538
538
|
// ComboBox 또는 multiple 모드에서는 위치 조정 비활성화
|
|
539
539
|
if (this.config.type === 'combobox' || this.config.model.isMultiple()) {
|
|
@@ -558,7 +558,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
558
558
|
/**
|
|
559
559
|
* 드롭다운 위치 계산 (React dropdownUtils.ts 로직 참고)
|
|
560
560
|
*/
|
|
561
|
-
|
|
561
|
+
UnifiedBoxController.prototype.calculateDropdownPosition = function () {
|
|
562
562
|
if (!this.config.triggerElement || !this.config.dropdownElement) {
|
|
563
563
|
return {
|
|
564
564
|
direction: 'down',
|
|
@@ -586,7 +586,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
586
586
|
/**
|
|
587
587
|
* 드롭다운 예상 높이 계산
|
|
588
588
|
*/
|
|
589
|
-
|
|
589
|
+
UnifiedBoxController.prototype.estimateDropdownHeight = function () {
|
|
590
590
|
var itemHeight = 40; // 대략적인 옵션 항목 높이
|
|
591
591
|
var itemCount = this.config.model.getState().filteredOptions.length || this.config.model.getState().options.length;
|
|
592
592
|
return Math.min(itemCount * itemHeight, this.config.renderConfig.maxHeight);
|
|
@@ -594,7 +594,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
594
594
|
/**
|
|
595
595
|
* 드롭다운 세부 위치 조정 (뷰포트 경계 처리)
|
|
596
596
|
*/
|
|
597
|
-
|
|
597
|
+
UnifiedBoxController.prototype.adjustDropdownPositionDetails = function (dropdownElement) {
|
|
598
598
|
var dropdownRect = dropdownElement.getBoundingClientRect();
|
|
599
599
|
var viewportWidth = window.innerWidth;
|
|
600
600
|
var viewportHeight = window.innerHeight;
|
|
@@ -617,7 +617,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
617
617
|
/**
|
|
618
618
|
* 스크롤 바닥 감지 활성화
|
|
619
619
|
*/
|
|
620
|
-
|
|
620
|
+
UnifiedBoxController.prototype.enableScrollBottomDetection = function () {
|
|
621
621
|
var _this = this;
|
|
622
622
|
if (!this.config.onScrollBottom) return;
|
|
623
623
|
// 이미 리스너가 등록되어 있으면 중복 등록 방지
|
|
@@ -647,7 +647,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
647
647
|
/**
|
|
648
648
|
* 스크롤 바닥 감지 비활성화
|
|
649
649
|
*/
|
|
650
|
-
|
|
650
|
+
UnifiedBoxController.prototype.disableScrollBottomDetection = function () {
|
|
651
651
|
if (this.scrollBottomHandler) {
|
|
652
652
|
var optionsList = this.config.dropdownElement.querySelector('.ncua-select-dropdown__options');
|
|
653
653
|
if (optionsList) {
|
|
@@ -659,7 +659,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
659
659
|
/**
|
|
660
660
|
* disabled 상태 설정
|
|
661
661
|
*/
|
|
662
|
-
|
|
662
|
+
UnifiedBoxController.prototype.setDisabled = function (disabled) {
|
|
663
663
|
this.config.disabled = disabled;
|
|
664
664
|
// disabled로 설정될 때 드롭다운이 열려있으면 닫기
|
|
665
665
|
if (disabled && this.isOpen) {
|
|
@@ -669,7 +669,7 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
669
669
|
/**
|
|
670
670
|
* 정리
|
|
671
671
|
*/
|
|
672
|
-
|
|
672
|
+
UnifiedBoxController.prototype.destroy = function () {
|
|
673
673
|
this.config.model.removeListener(this);
|
|
674
674
|
this.disableOutsideClick();
|
|
675
675
|
this.disableScrollLock();
|
|
@@ -677,5 +677,5 @@ var SelectBoxController = exports.SelectBoxController = /** @class */function ()
|
|
|
677
677
|
this.disableScrollBottomDetection(); // 스크롤 감지 정리
|
|
678
678
|
this.config.triggerElement.removeEventListener('keydown', this.keyDownHandler);
|
|
679
679
|
};
|
|
680
|
-
return
|
|
680
|
+
return UnifiedBoxController;
|
|
681
681
|
}();
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.UnifiedBoxManager = void 0;
|
|
7
7
|
var _DOMRenderer = require("./DOMRenderer");
|
|
8
8
|
var _DropdownModel = require("./DropdownModel");
|
|
9
|
-
var
|
|
9
|
+
var _UnifiedBoxController = require("./UnifiedBoxController");
|
|
10
10
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
11
11
|
__assign = Object.assign || function (t) {
|
|
12
12
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -142,11 +142,11 @@ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack
|
|
|
142
142
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
|
-
* 통합된
|
|
145
|
+
* 통합된 UnifiedBox 클래스
|
|
146
146
|
* SelectBox와 ComboBox의 기능을 모두 포함
|
|
147
147
|
*/
|
|
148
|
-
var
|
|
149
|
-
function
|
|
148
|
+
var UnifiedBoxManager = exports.UnifiedBoxManager = /** @class */function () {
|
|
149
|
+
function UnifiedBoxManager(element, config) {
|
|
150
150
|
if (config === void 0) {
|
|
151
151
|
config = {};
|
|
152
152
|
}
|
|
@@ -169,7 +169,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
169
169
|
});
|
|
170
170
|
this.initialize();
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
UnifiedBoxManager.prototype.initialize = function () {
|
|
173
173
|
this.element.innerHTML = '';
|
|
174
174
|
this.setupElementClasses();
|
|
175
175
|
// 초기 옵션이 있는지 확인 (select 태그 등에서 파싱된 옵션이 있는 경우)
|
|
@@ -186,7 +186,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
186
186
|
this.model.setValue(this.config.value);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
|
|
189
|
+
UnifiedBoxManager.prototype.setupElementClasses = function () {
|
|
190
190
|
var baseClass = this.config.type === 'combobox' ? 'ncua-combobox' : 'ncua-selectbox';
|
|
191
191
|
this.element.className = "".concat(baseClass, " ").concat(baseClass, "--").concat(this.config.size);
|
|
192
192
|
if (this.config.disabled) {
|
|
@@ -196,14 +196,14 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
196
196
|
this.element.classList.add("".concat(baseClass, "--multiple"));
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
|
|
199
|
+
UnifiedBoxManager.prototype.createUI = function () {
|
|
200
200
|
if (this.config.type === 'combobox') {
|
|
201
201
|
this.createComboBoxUI();
|
|
202
202
|
} else {
|
|
203
203
|
this.createSelectBoxUI();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
206
|
+
UnifiedBoxManager.prototype.createComboBoxUI = function () {
|
|
207
207
|
var _this = this;
|
|
208
208
|
// 컨텐츠 컨테이너
|
|
209
209
|
var content = _DOMRenderer.DOMRenderer.createElementWithClass('div', 'ncua-combobox__content');
|
|
@@ -232,7 +232,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
232
232
|
// 드롭다운 생성
|
|
233
233
|
this.createDropdown(content);
|
|
234
234
|
};
|
|
235
|
-
|
|
235
|
+
UnifiedBoxManager.prototype.createSelectBoxUI = function () {
|
|
236
236
|
// 트리거 생성
|
|
237
237
|
var trigger = _DOMRenderer.DOMRenderer.createElementWithClass('div', 'ncua-selectbox__content');
|
|
238
238
|
trigger.setAttribute('tabindex', this.config.disabled ? '-1' : '0');
|
|
@@ -250,7 +250,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
250
250
|
// 드롭다운 생성
|
|
251
251
|
this.createDropdown(this.element);
|
|
252
252
|
};
|
|
253
|
-
|
|
253
|
+
UnifiedBoxManager.prototype.createDropdown = function (parent) {
|
|
254
254
|
var _this = this;
|
|
255
255
|
var dropdownStructure = this.renderer.createDropdownStructure({
|
|
256
256
|
maxHeight: this.config.maxHeight || 275,
|
|
@@ -288,7 +288,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
288
288
|
this.dropdownElement.appendChild(this.footerElement);
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
|
|
291
|
+
UnifiedBoxManager.prototype.setupController = function () {
|
|
292
292
|
var _this = this;
|
|
293
293
|
if (!this.triggerElement || !this.dropdownElement) {
|
|
294
294
|
throw new Error('Trigger or dropdown element not found');
|
|
@@ -340,12 +340,12 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
340
340
|
},
|
|
341
341
|
type: this.config.type // 타입 정보 전달
|
|
342
342
|
};
|
|
343
|
-
this.controller = new
|
|
343
|
+
this.controller = new _UnifiedBoxController.UnifiedBoxController(controllerConfig);
|
|
344
344
|
};
|
|
345
345
|
/**
|
|
346
346
|
* 디바운싱 타이머 취소
|
|
347
347
|
*/
|
|
348
|
-
|
|
348
|
+
UnifiedBoxManager.prototype.cancelDebounceTimer = function () {
|
|
349
349
|
if (this.searchDebounceTimer) {
|
|
350
350
|
clearTimeout(this.searchDebounceTimer);
|
|
351
351
|
this.searchDebounceTimer = undefined;
|
|
@@ -353,7 +353,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
353
353
|
}
|
|
354
354
|
};
|
|
355
355
|
// 이벤트 핸들러들
|
|
356
|
-
|
|
356
|
+
UnifiedBoxManager.prototype.handleInput = function (value) {
|
|
357
357
|
var _this = this;
|
|
358
358
|
var _a, _b;
|
|
359
359
|
this.cancelDebounceTimer();
|
|
@@ -419,7 +419,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
419
419
|
(_b = (_a = this.config).onSearch) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
|
-
|
|
422
|
+
UnifiedBoxManager.prototype.handleInputClick = function () {
|
|
423
423
|
var _a, _b;
|
|
424
424
|
if (!this.config.disabled) {
|
|
425
425
|
(_a = this.inputField) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -431,7 +431,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
};
|
|
434
|
-
|
|
434
|
+
UnifiedBoxManager.prototype.handleClearInput = function () {
|
|
435
435
|
this.cancelDebounceTimer();
|
|
436
436
|
// input 필드 텍스트 지우기
|
|
437
437
|
if (this.inputField) {
|
|
@@ -448,7 +448,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
448
448
|
}
|
|
449
449
|
this.controller.close();
|
|
450
450
|
};
|
|
451
|
-
|
|
451
|
+
UnifiedBoxManager.prototype.handleShowAll = function () {
|
|
452
452
|
var _a, _b, _c, _d;
|
|
453
453
|
return __awaiter(this, void 0, void 0, function () {
|
|
454
454
|
var hasOptions;
|
|
@@ -475,7 +475,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
475
475
|
});
|
|
476
476
|
});
|
|
477
477
|
};
|
|
478
|
-
|
|
478
|
+
UnifiedBoxManager.prototype.handleSelectionChange = function (selectedValues) {
|
|
479
479
|
var _a, _b;
|
|
480
480
|
this.cancelDebounceTimer();
|
|
481
481
|
var result = this.config.multiple ? selectedValues : selectedValues[0] || '';
|
|
@@ -493,7 +493,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
493
493
|
this.controller.close();
|
|
494
494
|
}
|
|
495
495
|
};
|
|
496
|
-
|
|
496
|
+
UnifiedBoxManager.prototype.updateSelectBoxValue = function () {
|
|
497
497
|
var valueSpan = this.element.querySelector('.ncua-selectbox__value');
|
|
498
498
|
if (valueSpan) {
|
|
499
499
|
if (this.config.multiple) {
|
|
@@ -507,7 +507,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
};
|
|
510
|
-
|
|
510
|
+
UnifiedBoxManager.prototype.canToggleDropdown = function () {
|
|
511
511
|
var _a;
|
|
512
512
|
if (this.config.type === 'combobox') {
|
|
513
513
|
// ComboBox의 경우: 인풋에 텍스트가 있으면 항상 토글 가능
|
|
@@ -517,7 +517,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
517
517
|
return true; // SelectBox는 항상 토글 가능
|
|
518
518
|
};
|
|
519
519
|
// 푸터 버튼 핸들러들
|
|
520
|
-
|
|
520
|
+
UnifiedBoxManager.prototype.handleSelectAll = function () {
|
|
521
521
|
var _a, _b;
|
|
522
522
|
if (this.config.multiple) {
|
|
523
523
|
this.model.toggleSelectAll();
|
|
@@ -526,7 +526,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
526
526
|
(_b = (_a = this.config).onSelectAll) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
|
-
|
|
529
|
+
UnifiedBoxManager.prototype.handleComplete = function () {
|
|
530
530
|
var _a, _b, _c, _d;
|
|
531
531
|
if (this.config.multiple || this.config.type === 'combobox') {
|
|
532
532
|
var currentValues = this.model.getValue();
|
|
@@ -551,12 +551,12 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
551
551
|
this.controller.close();
|
|
552
552
|
}
|
|
553
553
|
};
|
|
554
|
-
|
|
554
|
+
UnifiedBoxManager.prototype.updateSelectAllButtonText = function () {
|
|
555
555
|
if (!this.config.multiple || !this.footerElement) return;
|
|
556
556
|
this.renderer.updateSelectAllButtonText(this.footerElement, this.model.getSelectAllButtonText());
|
|
557
557
|
};
|
|
558
558
|
// Public API
|
|
559
|
-
|
|
559
|
+
UnifiedBoxManager.prototype.getValues = function () {
|
|
560
560
|
var selectedIds = this.model.getValue();
|
|
561
561
|
var allOptions = this.getOptions();
|
|
562
562
|
// selectedIds가 배열이 아닌 경우 배열로 변환
|
|
@@ -570,10 +570,10 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
570
570
|
return opt !== undefined;
|
|
571
571
|
});
|
|
572
572
|
};
|
|
573
|
-
|
|
573
|
+
UnifiedBoxManager.prototype.getOptions = function () {
|
|
574
574
|
return this.config.options || [];
|
|
575
575
|
};
|
|
576
|
-
|
|
576
|
+
UnifiedBoxManager.prototype.setValues = function (value) {
|
|
577
577
|
// 옵션 객체 배열에서 id 배열로 변환
|
|
578
578
|
var ids = value.map(function (option) {
|
|
579
579
|
return option.id;
|
|
@@ -595,13 +595,13 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
};
|
|
598
|
-
|
|
598
|
+
UnifiedBoxManager.prototype.updateOptions = function (newOptions) {
|
|
599
599
|
// config.options도 업데이트 (getOptions()가 이를 반환하므로)
|
|
600
600
|
this.config.options = __spreadArray([], newOptions, true);
|
|
601
601
|
this.model.updateOptions(newOptions);
|
|
602
602
|
this.controller.updateOptions(newOptions);
|
|
603
603
|
};
|
|
604
|
-
|
|
604
|
+
UnifiedBoxManager.prototype.setDisabled = function (disabled) {
|
|
605
605
|
var _a, _b;
|
|
606
606
|
this.config.disabled = disabled;
|
|
607
607
|
var baseClass = this.config.type === 'combobox' ? 'ncua-combobox' : 'ncua-selectbox';
|
|
@@ -620,13 +620,13 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
620
620
|
this.triggerElement.setAttribute('tabindex', disabled ? '-1' : '0');
|
|
621
621
|
}
|
|
622
622
|
};
|
|
623
|
-
|
|
623
|
+
UnifiedBoxManager.prototype.open = function () {
|
|
624
624
|
this.controller.open();
|
|
625
625
|
};
|
|
626
|
-
|
|
626
|
+
UnifiedBoxManager.prototype.close = function () {
|
|
627
627
|
this.controller.close();
|
|
628
628
|
};
|
|
629
|
-
|
|
629
|
+
UnifiedBoxManager.prototype.focus = function () {
|
|
630
630
|
var _a, _b;
|
|
631
631
|
if (this.config.type === 'combobox') {
|
|
632
632
|
(_a = this.inputField) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -634,14 +634,14 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
634
634
|
(_b = this.triggerElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
|
-
|
|
637
|
+
UnifiedBoxManager.prototype.destroy = function () {
|
|
638
638
|
this.cancelDebounceTimer();
|
|
639
639
|
this.controller.destroy();
|
|
640
640
|
this.renderer.clearCache();
|
|
641
641
|
this.inputField = undefined;
|
|
642
642
|
};
|
|
643
643
|
// Multiple 모드 전용 메서드들
|
|
644
|
-
|
|
644
|
+
UnifiedBoxManager.prototype.selectAll = function () {
|
|
645
645
|
var _a;
|
|
646
646
|
if (this.config.multiple) {
|
|
647
647
|
var allOptionIds = ((_a = this.config.options) === null || _a === void 0 ? void 0 : _a.map(function (option) {
|
|
@@ -650,15 +650,15 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
650
650
|
this.model.setValue(allOptionIds);
|
|
651
651
|
}
|
|
652
652
|
};
|
|
653
|
-
|
|
653
|
+
UnifiedBoxManager.prototype.deselectAll = function () {
|
|
654
654
|
if (this.config.multiple) {
|
|
655
655
|
this.model.setValue([]);
|
|
656
656
|
}
|
|
657
657
|
};
|
|
658
|
-
|
|
658
|
+
UnifiedBoxManager.prototype.isMultiple = function () {
|
|
659
659
|
return this.config.multiple || false;
|
|
660
660
|
};
|
|
661
|
-
|
|
661
|
+
UnifiedBoxManager.prototype.toggleSelectAll = function () {
|
|
662
662
|
var _a;
|
|
663
663
|
if (!this.config.multiple) return;
|
|
664
664
|
var currentValues = this.model.getValue();
|
|
@@ -674,7 +674,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
674
674
|
}
|
|
675
675
|
};
|
|
676
676
|
// 디버깅용
|
|
677
|
-
|
|
677
|
+
UnifiedBoxManager.prototype.getDebugInfo = function () {
|
|
678
678
|
return {
|
|
679
679
|
config: this.config,
|
|
680
680
|
modelState: this.model.getDebugInfo(),
|
|
@@ -685,7 +685,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
685
685
|
* 드롭다운을 스크롤의 바닥으로 이동
|
|
686
686
|
* 전체 선택 시 추가 데이터 로드를 트리거하기 위해 사용
|
|
687
687
|
*/
|
|
688
|
-
|
|
688
|
+
UnifiedBoxManager.prototype.scrollToBottom = function () {
|
|
689
689
|
if (!this.dropdownElement) return;
|
|
690
690
|
var optionsList = this.dropdownElement.querySelector('.ncua-select-dropdown__options');
|
|
691
691
|
if (!optionsList) return;
|
|
@@ -696,7 +696,7 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
696
696
|
* 전체 선택 버튼의 텍스트를 외부에서 변경
|
|
697
697
|
* @param text 버튼에 표시할 텍스트
|
|
698
698
|
*/
|
|
699
|
-
|
|
699
|
+
UnifiedBoxManager.prototype.setSelectAllButtonText = function (text) {
|
|
700
700
|
if (!this.config.multiple || !this.footerElement) return;
|
|
701
701
|
this.renderer.updateSelectAllButtonText(this.footerElement, text);
|
|
702
702
|
};
|
|
@@ -704,8 +704,8 @@ var UnifiedSelectBox = exports.UnifiedSelectBox = /** @class */function () {
|
|
|
704
704
|
* 특정 인덱스의 옵션으로 포커스 이동
|
|
705
705
|
* @param index 포커스를 이동할 옵션의 인덱스
|
|
706
706
|
*/
|
|
707
|
-
|
|
707
|
+
UnifiedBoxManager.prototype.setFocusIndex = function (index) {
|
|
708
708
|
this.controller.setFocus(index);
|
|
709
709
|
};
|
|
710
|
-
return
|
|
710
|
+
return UnifiedBoxManager;
|
|
711
711
|
}();
|
|
@@ -47,7 +47,6 @@ var dotSize = exports.dotSize = {
|
|
|
47
47
|
md: 'md'
|
|
48
48
|
};
|
|
49
49
|
var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
50
|
-
// NOTE: 엘리먼트 종류에 따라 props의 타입이 달라지므로 분리
|
|
51
50
|
var _a = props.size,
|
|
52
51
|
size = _a === void 0 ? 'md' : _a,
|
|
53
52
|
children = props.children,
|