@ncds/ui-admin 1.4.1 → 1.5.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/dist/cjs/assets/scripts/comboBox.js +18 -0
- package/dist/cjs/assets/scripts/datePicker.js +60 -7
- package/dist/cjs/assets/scripts/imageFileInput/ImageFileInputModel.js +6 -19
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +146 -0
- package/dist/cjs/assets/scripts/notification/Notification.js +6 -3
- package/dist/cjs/assets/scripts/notification/const/classNames.js +14 -0
- package/dist/cjs/assets/scripts/notification/const/index.js +14 -1
- package/dist/cjs/assets/scripts/notification/const/sizes.js +7 -1
- package/dist/cjs/assets/scripts/notification/const/types.js +10 -1
- package/dist/cjs/assets/scripts/notification/index.js +8 -0
- package/dist/cjs/assets/scripts/notification/utils.js +3 -3
- package/dist/cjs/assets/scripts/utils/selectbox/DropdownModel.js +7 -0
- package/dist/cjs/assets/scripts/utils/selectbox/UnifiedSelectBox.js +77 -43
- package/dist/cjs/src/components/button/ButtonGroup.js +1 -2
- package/dist/cjs/src/components/button/ButtonStepper.js +23 -0
- package/dist/cjs/src/components/button/index.js +22 -0
- package/dist/cjs/src/components/date-picker/DatePicker.js +45 -6
- package/dist/cjs/src/components/date-picker/RangeDatePicker.js +3 -1
- package/dist/cjs/src/components/date-picker/RangeDatePickerWithButtons.js +7 -3
- package/dist/cjs/src/components/index.js +11 -0
- package/dist/cjs/src/components/input/InputBase.js +1 -1
- package/dist/cjs/src/components/input/NumberInput.js +130 -0
- package/dist/cjs/src/components/input/PasswordInput.js +3 -2
- package/dist/cjs/src/components/input/index.js +11 -0
- package/dist/cjs/src/components/notification/MessageNotification.js +137 -0
- package/dist/cjs/src/components/notification/Notification.js +23 -9
- package/dist/cjs/src/components/notification/index.js +11 -0
- package/dist/cjs/src/components/tooltip/Tooltip.js +32 -21
- package/dist/esm/assets/scripts/comboBox.js +18 -0
- package/dist/esm/assets/scripts/datePicker.js +60 -7
- package/dist/esm/assets/scripts/imageFileInput/ImageFileInputModel.js +6 -19
- package/dist/esm/assets/scripts/notification/MessageNotification.js +141 -0
- package/dist/esm/assets/scripts/notification/Notification.js +6 -3
- package/dist/esm/assets/scripts/notification/const/classNames.js +14 -0
- package/dist/esm/assets/scripts/notification/const/index.js +2 -1
- package/dist/esm/assets/scripts/notification/const/sizes.js +6 -0
- package/dist/esm/assets/scripts/notification/const/types.js +8 -1
- package/dist/esm/assets/scripts/notification/index.js +1 -0
- package/dist/esm/assets/scripts/notification/utils.js +3 -3
- package/dist/esm/assets/scripts/utils/selectbox/DropdownModel.js +7 -0
- package/dist/esm/assets/scripts/utils/selectbox/UnifiedSelectBox.js +77 -43
- package/dist/esm/src/components/button/ButtonStepper.js +15 -0
- package/dist/esm/src/components/button/index.js +3 -1
- package/dist/esm/src/components/date-picker/DatePicker.js +46 -7
- package/dist/esm/src/components/date-picker/RangeDatePicker.js +3 -1
- package/dist/esm/src/components/date-picker/RangeDatePickerWithButtons.js +7 -3
- package/dist/esm/src/components/index.js +2 -1
- package/dist/esm/src/components/input/InputBase.js +1 -1
- package/dist/esm/src/components/input/NumberInput.js +124 -0
- package/dist/esm/src/components/input/PasswordInput.js +4 -3
- package/dist/esm/src/components/input/index.js +1 -0
- package/dist/esm/src/components/notification/MessageNotification.js +130 -0
- package/dist/esm/src/components/notification/Notification.js +23 -9
- package/dist/esm/src/components/notification/index.js +2 -1
- package/dist/esm/src/components/tooltip/Tooltip.js +33 -22
- package/dist/types/assets/scripts/comboBox.d.ts +12 -0
- package/dist/types/assets/scripts/datePicker.d.ts +1 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +23 -0
- package/dist/types/assets/scripts/notification/Notification.d.ts +1 -1
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +14 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +2 -1
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +5 -0
- package/dist/types/assets/scripts/notification/const/types.d.ts +1 -0
- package/dist/types/assets/scripts/notification/index.d.ts +1 -0
- package/dist/types/assets/scripts/utils/selectbox/DropdownModel.d.ts +4 -0
- package/dist/types/assets/scripts/utils/selectbox/UnifiedSelectBox.d.ts +20 -1
- package/dist/types/src/components/button/ButtonGroup.d.ts +1 -3
- package/dist/types/src/components/button/ButtonStepper.d.ts +10 -0
- package/dist/types/src/components/button/index.d.ts +2 -0
- package/dist/types/src/components/date-picker/DatePicker.d.ts +1 -0
- package/dist/types/src/components/date-picker/RangeDatePickerWithButtons.d.ts +4 -4
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/input/NumberInput.d.ts +10 -0
- package/dist/types/src/components/input/index.d.ts +1 -0
- package/dist/types/src/components/modal/Modal.d.ts +2 -2
- package/dist/types/src/components/notification/MessageNotification.d.ts +40 -0
- package/dist/types/src/components/notification/Notification.d.ts +6 -1
- package/dist/types/src/components/notification/index.d.ts +1 -0
- package/dist/types/src/components/selectbox/SelectBox.d.ts +1 -1
- package/dist/types/src/components/tooltip/Tooltip.d.ts +4 -2
- package/dist/ui-admin/assets/styles/style.css +298 -18
- package/package.json +1 -1
|
@@ -74,22 +74,26 @@ var Tooltip = function (_a) {
|
|
|
74
74
|
hideArrow = _f === void 0 ? false : _f,
|
|
75
75
|
_g = _a.type,
|
|
76
76
|
type = _g === void 0 ? 'short' : _g,
|
|
77
|
+
_h = _a.iconColor,
|
|
78
|
+
iconColor = _h === void 0 ? 'var(--gray-300)' : _h,
|
|
79
|
+
_j = _a.iconStyle,
|
|
80
|
+
iconStyle = _j === void 0 ? 'help-circle' : _j,
|
|
77
81
|
className = _a.className;
|
|
78
82
|
var iconSize = size === 'sm' ? 14 : 16;
|
|
79
83
|
var tooltipRef = (0, _react.useRef)(null);
|
|
80
84
|
var tooltipBgRef = (0, _react.useRef)(null);
|
|
81
|
-
var
|
|
82
|
-
calculatedPosition =
|
|
83
|
-
setCalculatedPosition =
|
|
84
|
-
var _j = (0, _react.useState)(false),
|
|
85
|
-
isVisible = _j[0],
|
|
86
|
-
setIsVisible = _j[1];
|
|
87
|
-
var _k = (0, _react.useState)(false),
|
|
88
|
-
isManuallyClose = _k[0],
|
|
89
|
-
setIsManuallyClose = _k[1];
|
|
85
|
+
var _k = (0, _react.useState)(position === 'auto' ? 'bottom' : position),
|
|
86
|
+
calculatedPosition = _k[0],
|
|
87
|
+
setCalculatedPosition = _k[1];
|
|
90
88
|
var _l = (0, _react.useState)(false),
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
isVisible = _l[0],
|
|
90
|
+
setIsVisible = _l[1];
|
|
91
|
+
var _m = (0, _react.useState)(false),
|
|
92
|
+
isManuallyClose = _m[0],
|
|
93
|
+
setIsManuallyClose = _m[1];
|
|
94
|
+
var _o = (0, _react.useState)(false),
|
|
95
|
+
isMeasuring = _o[0],
|
|
96
|
+
setIsMeasuring = _o[1];
|
|
93
97
|
var handleMouseEnter = (0, _react.useCallback)(function () {
|
|
94
98
|
if (isManuallyClose) return;
|
|
95
99
|
setIsVisible(true);
|
|
@@ -137,15 +141,23 @@ var Tooltip = function (_a) {
|
|
|
137
141
|
onMouseEnter: handleMouseEnter,
|
|
138
142
|
onMouseLeave: handleMouseLeave
|
|
139
143
|
}, {
|
|
140
|
-
children: [iconType === 'stroke' ? (0, _jsxRuntime.jsx)(_uiAdminIcon.HelpCircle, {
|
|
144
|
+
children: [iconStyle === 'help-circle' && (iconType === 'stroke' ? (0, _jsxRuntime.jsx)(_uiAdminIcon.HelpCircle, {
|
|
141
145
|
width: iconSize,
|
|
142
146
|
height: iconSize,
|
|
143
|
-
color:
|
|
147
|
+
color: iconColor
|
|
144
148
|
}) : (0, _jsxRuntime.jsx)(_uiAdminIcon.HelpCircleFill, {
|
|
145
149
|
width: iconSize,
|
|
146
150
|
height: iconSize,
|
|
147
|
-
color:
|
|
148
|
-
}), (0, _jsxRuntime.
|
|
151
|
+
color: iconColor
|
|
152
|
+
})), iconStyle === 'alert-circle' && (iconType === 'stroke' ? (0, _jsxRuntime.jsx)(_uiAdminIcon.AlertCircle, {
|
|
153
|
+
width: iconSize,
|
|
154
|
+
height: iconSize,
|
|
155
|
+
color: iconColor
|
|
156
|
+
}) : (0, _jsxRuntime.jsx)(_uiAdminIcon.AlertCircleFill, {
|
|
157
|
+
width: iconSize,
|
|
158
|
+
height: iconSize,
|
|
159
|
+
color: iconColor
|
|
160
|
+
})), (0, _jsxRuntime.jsxs)("span", __assign({
|
|
149
161
|
ref: tooltipBgRef,
|
|
150
162
|
className: tooltipBgClassName
|
|
151
163
|
}, {
|
|
@@ -153,12 +165,11 @@ var Tooltip = function (_a) {
|
|
|
153
165
|
className: "ncua-tooltip__title"
|
|
154
166
|
}, {
|
|
155
167
|
children: title
|
|
156
|
-
})), content && (0, _jsxRuntime.jsx)("span", {
|
|
157
|
-
className: "ncua-tooltip__content"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}), type === 'long' && (0, _jsxRuntime.jsx)(_ButtonCloseX.ButtonCloseX, {
|
|
168
|
+
})), content && (0, _jsxRuntime.jsx)("span", __assign({
|
|
169
|
+
className: "ncua-tooltip__content"
|
|
170
|
+
}, {
|
|
171
|
+
children: content
|
|
172
|
+
})), type === 'long' && (0, _jsxRuntime.jsx)(_ButtonCloseX.ButtonCloseX, {
|
|
162
173
|
className: "ncua-tooltip__close-button",
|
|
163
174
|
size: "xs",
|
|
164
175
|
theme: tooltipType === 'white' ? 'dark' : 'light',
|
|
@@ -252,6 +252,24 @@ var ComboBox = /** @class */function () {
|
|
|
252
252
|
ComboBox.prototype.toggleSelectAll = function () {
|
|
253
253
|
this.unifiedSelectBox.toggleSelectAll();
|
|
254
254
|
};
|
|
255
|
+
/**
|
|
256
|
+
* 드롭다운을 스크롤의 바닥으로 이동
|
|
257
|
+
*/
|
|
258
|
+
ComboBox.prototype.scrollToBottom = function () {
|
|
259
|
+
this.unifiedSelectBox.scrollToBottom();
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* 전체 선택 버튼의 텍스트를 외부에서 변경
|
|
263
|
+
*/
|
|
264
|
+
ComboBox.prototype.setSelectAllButtonText = function (text) {
|
|
265
|
+
this.unifiedSelectBox.setSelectAllButtonText(text);
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* 특정 인덱스의 옵션으로 포커스 이동
|
|
269
|
+
*/
|
|
270
|
+
ComboBox.prototype.setFocusIndex = function (index) {
|
|
271
|
+
this.unifiedSelectBox.setFocusIndex(index);
|
|
272
|
+
};
|
|
255
273
|
return ComboBox;
|
|
256
274
|
}();
|
|
257
275
|
export { ComboBox };
|
|
@@ -245,6 +245,19 @@ export var DatePicker = /** @class */function () {
|
|
|
245
245
|
if (formattedInput === input) return;
|
|
246
246
|
target.value = formattedInput;
|
|
247
247
|
};
|
|
248
|
+
// 외부 클릭 시 시간 입력 강제 blur 처리
|
|
249
|
+
var handleMouseDown = function (e) {
|
|
250
|
+
var flatpickrCalendar = wrapper.querySelector('.flatpickr-calendar.open');
|
|
251
|
+
if (flatpickrCalendar && !flatpickrCalendar.contains(e.target)) {
|
|
252
|
+
var timeInputs = flatpickrCalendar.querySelectorAll('.flatpickr-time input');
|
|
253
|
+
timeInputs.forEach(function (input) {
|
|
254
|
+
if (document.activeElement === input) {
|
|
255
|
+
input.blur();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
document.addEventListener('mousedown', handleMouseDown, true);
|
|
248
261
|
return flatpickr(input, __assign(__assign({}, options), {
|
|
249
262
|
allowInput: (_b = options.allowInput) !== null && _b !== void 0 ? _b : true,
|
|
250
263
|
appendTo: wrapper,
|
|
@@ -271,6 +284,7 @@ export var DatePicker = /** @class */function () {
|
|
|
271
284
|
input.removeEventListener('input', onInputHandler);
|
|
272
285
|
input.removeEventListener('input', onHourInputHandler);
|
|
273
286
|
input.removeEventListener('input', onMinuteInputHandler);
|
|
287
|
+
document.removeEventListener('mousedown', handleMouseDown, true);
|
|
274
288
|
}
|
|
275
289
|
}));
|
|
276
290
|
};
|
|
@@ -329,19 +343,58 @@ export var DatePicker = /** @class */function () {
|
|
|
329
343
|
var startDate = dates[0],
|
|
330
344
|
endDate = dates[1];
|
|
331
345
|
var datesToSet = this.datePickerOptions.map(function (option, index) {
|
|
332
|
-
var _a;
|
|
346
|
+
var _a, _b;
|
|
333
347
|
var date = index === 0 ? startDate : endDate;
|
|
334
|
-
if (!date) return '';
|
|
348
|
+
if (!date || date === '0000-00-00') return '';
|
|
335
349
|
var hasTime = (_a = option.options) === null || _a === void 0 ? void 0 : _a.enableTime;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
350
|
+
var flatpickrFormat = ((_b = option.options) === null || _b === void 0 ? void 0 : _b.dateFormat) || (hasTime ? 'Y-m-d H:i' : 'Y-m-d');
|
|
351
|
+
// dateFormat이 설정되어 있지 않을 때만 hasTime에 따라 기본값 설정
|
|
352
|
+
// dateFormat이 설정되어 있으면 그 형식을 그대로 사용 (enableTime과 무관하게)
|
|
353
|
+
var momentFormat = _this.convertFlatpickrFormatToMoment(flatpickrFormat);
|
|
354
|
+
var momentDate;
|
|
355
|
+
if (hasTime && !date.includes(':')) {
|
|
356
|
+
// 시간이 없는 날짜 형식으로 파싱
|
|
357
|
+
momentDate = moment(date);
|
|
358
|
+
if (!momentDate.isValid()) return '';
|
|
359
|
+
return index === 0 ? momentDate.startOf('day').format(momentFormat) : momentDate.endOf('day').format(momentFormat);
|
|
360
|
+
}
|
|
361
|
+
if (hasTime && date.includes(':')) {
|
|
362
|
+
momentDate = moment(date);
|
|
363
|
+
if (!momentDate.isValid()) return '';
|
|
364
|
+
return momentDate.format(momentFormat);
|
|
365
|
+
}
|
|
366
|
+
// 시간이 없는 경우 (hasTime이 false이거나 date에 시간이 없는 경우)
|
|
367
|
+
momentDate = moment(date);
|
|
368
|
+
if (!momentDate.isValid()) {
|
|
369
|
+
momentDate = moment(date, momentFormat, true);
|
|
370
|
+
}
|
|
371
|
+
// 둘 다 실패하면 다른 일반적인 형식들로 시도
|
|
372
|
+
if (!momentDate.isValid()) {
|
|
373
|
+
momentDate = moment(date, [momentFormat, 'YYYY-MM-DD', 'YYYY/MM/DD', 'MM/DD/YYYY'], true);
|
|
374
|
+
}
|
|
375
|
+
if (!momentDate.isValid()) return '';
|
|
376
|
+
// dateFormat 형식으로 포맷팅하여 반환 (flatpickr가 표시하는 형식과 일치)
|
|
377
|
+
return momentDate.format(momentFormat);
|
|
340
378
|
});
|
|
341
|
-
var period = moment(
|
|
379
|
+
var period = datesToSet[0] && datesToSet[1] ? moment(datesToSet[1]).diff(moment(datesToSet[0]), 'days') : null;
|
|
342
380
|
this.updateButtonsByPeriod(period);
|
|
343
381
|
this.setMultipleDates(datesToSet);
|
|
344
382
|
};
|
|
383
|
+
// flatpickr 형식을 moment 형식으로 변환하는 헬퍼 메서드
|
|
384
|
+
DatePicker.prototype.convertFlatpickrFormatToMoment = function (flatpickrFormat) {
|
|
385
|
+
var map = {
|
|
386
|
+
Y: 'YYYY',
|
|
387
|
+
y: 'YY',
|
|
388
|
+
m: 'MM',
|
|
389
|
+
d: 'DD',
|
|
390
|
+
H: 'HH',
|
|
391
|
+
i: 'mm',
|
|
392
|
+
S: 'ss'
|
|
393
|
+
};
|
|
394
|
+
return flatpickrFormat.replace(/[YymdHiS]/g, function (matched) {
|
|
395
|
+
return map[matched] || matched;
|
|
396
|
+
});
|
|
397
|
+
};
|
|
345
398
|
DatePicker.prototype.getDates = function () {
|
|
346
399
|
var _this = this;
|
|
347
400
|
return this.flatpickrInstances.map(function (instance) {
|
|
@@ -174,36 +174,23 @@ var ImageFileInputModel = /** @class */function () {
|
|
|
174
174
|
var validFiles = [];
|
|
175
175
|
var invalidFiles = [];
|
|
176
176
|
var currentFiles = this.getFiles();
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
if (currentFiles.some(function (f) {
|
|
180
|
-
return f.name === file.name && f.size === file.size;
|
|
181
|
-
})) {
|
|
182
|
-
invalidFiles.push(__assign(__assign({}, file), {
|
|
183
|
-
errorType: ImageFileInputErrorType.ALREADY_UPLOADED
|
|
184
|
-
}));
|
|
185
|
-
return "continue";
|
|
186
|
-
}
|
|
177
|
+
for (var _i = 0, fileList_1 = fileList; _i < fileList_1.length; _i++) {
|
|
178
|
+
var file = fileList_1[_i];
|
|
187
179
|
// 파일 크기 체크
|
|
188
|
-
if (
|
|
180
|
+
if (this.options.maxFileSize && file.size > this.options.maxFileSize) {
|
|
189
181
|
invalidFiles.push(__assign(__assign({}, file), {
|
|
190
182
|
errorType: ImageFileInputErrorType.EXCEED_MAX_FILE_SIZE
|
|
191
183
|
}));
|
|
192
|
-
|
|
184
|
+
continue;
|
|
193
185
|
}
|
|
194
186
|
// 파일 개수 체크 (maxFileCount가 1이면 교체 가능하므로 체크하지 않음)
|
|
195
|
-
if (
|
|
187
|
+
if (this.options.maxFileCount && this.options.maxFileCount !== 1 && currentFiles.length + validFiles.length >= this.options.maxFileCount) {
|
|
196
188
|
invalidFiles.push(__assign(__assign({}, file), {
|
|
197
189
|
errorType: ImageFileInputErrorType.EXCEED_MAX_FILE_COUNT
|
|
198
190
|
}));
|
|
199
|
-
|
|
191
|
+
continue;
|
|
200
192
|
}
|
|
201
193
|
validFiles.push(file);
|
|
202
|
-
};
|
|
203
|
-
var this_1 = this;
|
|
204
|
-
for (var _i = 0, fileList_1 = fileList; _i < fileList_1.length; _i++) {
|
|
205
|
-
var file = fileList_1[_i];
|
|
206
|
-
_loop_1(file);
|
|
207
194
|
}
|
|
208
195
|
return {
|
|
209
196
|
validFiles: validFiles,
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
import { SVG_ICONS, CLASS_NAMES, FLOATING_ICON_MAP, MESSAGE_SIZES } from './const';
|
|
12
|
+
import { FeaturedIcon } from '../featuredIcon';
|
|
13
|
+
import { createWrapperElement, renderSupportingText, renderActions, bindNotificationEvents, setupAutoClose } from './utils';
|
|
14
|
+
var MessageNotification = /** @class */function () {
|
|
15
|
+
function MessageNotification(options) {
|
|
16
|
+
this.options = __assign({
|
|
17
|
+
color: 'neutral',
|
|
18
|
+
className: '',
|
|
19
|
+
actions: [],
|
|
20
|
+
autoClose: 0,
|
|
21
|
+
supportingText: undefined
|
|
22
|
+
}, options);
|
|
23
|
+
this.element = this.createElement();
|
|
24
|
+
this.bindEvents();
|
|
25
|
+
this.setupAutoClose();
|
|
26
|
+
}
|
|
27
|
+
MessageNotification.prototype.createElement = function () {
|
|
28
|
+
var _a = this.options,
|
|
29
|
+
title = _a.title,
|
|
30
|
+
supportingText = _a.supportingText,
|
|
31
|
+
color = _a.color,
|
|
32
|
+
className = _a.className,
|
|
33
|
+
actions = _a.actions,
|
|
34
|
+
onClose = _a.onClose,
|
|
35
|
+
onHidePermanently = _a.onHidePermanently;
|
|
36
|
+
// message 타입은 neutral, error, warning, success 4가지 색상만 지원
|
|
37
|
+
var actualColor = color;
|
|
38
|
+
if (color === 'info') {
|
|
39
|
+
console.warn('Message notification does not support "info" color. Using "neutral" instead.');
|
|
40
|
+
actualColor = 'neutral';
|
|
41
|
+
}
|
|
42
|
+
var wrapper = createWrapperElement(CLASS_NAMES.MESSAGE.BASE, actualColor, className);
|
|
43
|
+
var iconFunction = FLOATING_ICON_MAP[actualColor];
|
|
44
|
+
// FeaturedIcon 생성
|
|
45
|
+
var featuredIconElement = null;
|
|
46
|
+
if (iconFunction) {
|
|
47
|
+
var iconSvg = iconFunction(MESSAGE_SIZES.ICON_PIXEL);
|
|
48
|
+
this.featuredIcon = FeaturedIcon.create({
|
|
49
|
+
svgString: iconSvg,
|
|
50
|
+
theme: 'light-circle',
|
|
51
|
+
color: actualColor,
|
|
52
|
+
size: MESSAGE_SIZES.FEATURED_ICON
|
|
53
|
+
});
|
|
54
|
+
featuredIconElement = this.featuredIcon.getElement();
|
|
55
|
+
}
|
|
56
|
+
wrapper.innerHTML = this.buildTemplate({
|
|
57
|
+
title: title,
|
|
58
|
+
supportingText: supportingText,
|
|
59
|
+
actions: actions,
|
|
60
|
+
onClose: onClose,
|
|
61
|
+
onHidePermanently: onHidePermanently
|
|
62
|
+
});
|
|
63
|
+
// FeaturedIcon을 content-wrapper에 추가
|
|
64
|
+
if (featuredIconElement) {
|
|
65
|
+
var contentWrapper = wrapper.querySelector(".".concat(CLASS_NAMES.MESSAGE.CONTENT_WRAPPER));
|
|
66
|
+
if (contentWrapper) {
|
|
67
|
+
contentWrapper.insertBefore(featuredIconElement, contentWrapper.firstChild);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return wrapper;
|
|
71
|
+
};
|
|
72
|
+
MessageNotification.prototype.buildTemplate = function (params) {
|
|
73
|
+
var title = params.title,
|
|
74
|
+
supportingText = params.supportingText,
|
|
75
|
+
actions = params.actions,
|
|
76
|
+
onClose = params.onClose,
|
|
77
|
+
onHidePermanently = params.onHidePermanently;
|
|
78
|
+
return "\n <div class=\"".concat(CLASS_NAMES.MESSAGE.CONTAINER, "\">\n <div class=\"").concat(CLASS_NAMES.MESSAGE.CONTENT, "\">\n <div class=\"").concat(CLASS_NAMES.MESSAGE.CONTENT_WRAPPER, "\">\n <div class=\"").concat(CLASS_NAMES.MESSAGE.TEXT_CONTAINER, "\">\n <span class=\"").concat(CLASS_NAMES.MESSAGE.TITLE, "\">").concat(title, "</span>\n ").concat(renderSupportingText(supportingText, CLASS_NAMES.MESSAGE.SUPPORTING_TEXT), "\n </div>\n </div>\n <div class=\"").concat(CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER, "\">\n ").concat(actions && actions.length > 0 ? renderActions(actions, CLASS_NAMES.MESSAGE.ACTIONS) : '', "\n </div>\n <div class=\"").concat(CLASS_NAMES.MESSAGE.ACTIONS_CONTAINER, "\">\n ").concat(this.renderHidePermanentlyButton(onHidePermanently), "\n ").concat(this.renderCloseButton(onClose), "\n </div>\n </div>\n </div>\n ");
|
|
79
|
+
};
|
|
80
|
+
MessageNotification.prototype.renderHidePermanentlyButton = function (onHidePermanently) {
|
|
81
|
+
if (!onHidePermanently) return '';
|
|
82
|
+
return "\n <button type=\"button\" class=\"".concat(CLASS_NAMES.COMMON.ACTION_BUTTON, " ").concat(CLASS_NAMES.COMMON.ACTION_BUTTON, "--text ").concat(CLASS_NAMES.MESSAGE.HIDE_LINK, "\" data-hide-permanently=\"true\">\n \uB2E4\uC2DC \uBCF4\uC9C0 \uC54A\uAE30\n </button>\n ");
|
|
83
|
+
};
|
|
84
|
+
MessageNotification.prototype.renderCloseButton = function (onClose) {
|
|
85
|
+
if (!onClose) return '';
|
|
86
|
+
return "\n <button type=\"button\" class=\"".concat(CLASS_NAMES.MESSAGE.CLOSE_BUTTON, "\" aria-label=\"\uC54C\uB9BC \uB2EB\uAE30\">\n ").concat(SVG_ICONS['x-close'](MESSAGE_SIZES.CLOSE_BUTTON).replace('stroke="currentColor"', "stroke=\"#2F2F30\""), "\n </button>\n ");
|
|
87
|
+
};
|
|
88
|
+
MessageNotification.prototype.bindEvents = function () {
|
|
89
|
+
var _this = this;
|
|
90
|
+
bindNotificationEvents(this.element, this.options.actions, this.options.onClose, function () {
|
|
91
|
+
return _this.remove();
|
|
92
|
+
});
|
|
93
|
+
// 다시보지 않기 버튼 이벤트 바인딩
|
|
94
|
+
if (this.options.onHidePermanently) {
|
|
95
|
+
var hidePermanentlyButton = this.element.querySelector('[data-hide-permanently="true"]');
|
|
96
|
+
if (hidePermanentlyButton) {
|
|
97
|
+
hidePermanentlyButton.addEventListener('click', function () {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
(_b = (_a = _this.options).onHidePermanently) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
100
|
+
_this.remove();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
MessageNotification.prototype.setupAutoClose = function () {
|
|
106
|
+
var _this = this;
|
|
107
|
+
this.autoCloseTimer = setupAutoClose(this.options.autoClose, this.options.onClose, function () {
|
|
108
|
+
return _this.remove();
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
// Public methods
|
|
112
|
+
MessageNotification.prototype.getElement = function () {
|
|
113
|
+
return this.element;
|
|
114
|
+
};
|
|
115
|
+
MessageNotification.prototype.appendTo = function (parent) {
|
|
116
|
+
parent.appendChild(this.element);
|
|
117
|
+
};
|
|
118
|
+
MessageNotification.prototype.remove = function () {
|
|
119
|
+
if (this.autoCloseTimer) {
|
|
120
|
+
clearTimeout(this.autoCloseTimer);
|
|
121
|
+
this.autoCloseTimer = undefined;
|
|
122
|
+
}
|
|
123
|
+
if (this.element && this.element.parentNode) {
|
|
124
|
+
this.element.parentNode.removeChild(this.element);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
MessageNotification.prototype.destroy = function () {
|
|
128
|
+
// FeaturedIcon 정리
|
|
129
|
+
if (this.featuredIcon) {
|
|
130
|
+
this.featuredIcon.destroy();
|
|
131
|
+
this.featuredIcon = undefined;
|
|
132
|
+
}
|
|
133
|
+
this.remove();
|
|
134
|
+
};
|
|
135
|
+
// Static factory methods
|
|
136
|
+
MessageNotification.create = function (options) {
|
|
137
|
+
return new MessageNotification(options);
|
|
138
|
+
};
|
|
139
|
+
return MessageNotification;
|
|
140
|
+
}();
|
|
141
|
+
export { MessageNotification };
|
|
@@ -18,16 +18,19 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
18
18
|
};
|
|
19
19
|
import { FullWidthNotification } from './FullWidthNotification';
|
|
20
20
|
import { FloatingNotification } from './FloatingNotification';
|
|
21
|
+
import { MessageNotification } from './MessageNotification';
|
|
21
22
|
// 통합 Notification 클래스
|
|
22
23
|
var Notification = /** @class */function () {
|
|
23
24
|
function Notification(options) {
|
|
24
25
|
var _a = options.type,
|
|
25
26
|
type = _a === void 0 ? 'floating' : _a,
|
|
26
27
|
baseOptions = __rest(options, ["type"]);
|
|
27
|
-
if (type === '
|
|
28
|
-
this.instance = new
|
|
29
|
-
} else {
|
|
28
|
+
if (type === 'message') {
|
|
29
|
+
this.instance = new MessageNotification(baseOptions);
|
|
30
|
+
} else if (type === 'full-width') {
|
|
30
31
|
this.instance = new FullWidthNotification(baseOptions);
|
|
32
|
+
} else {
|
|
33
|
+
this.instance = new FloatingNotification(baseOptions);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
// 모든 메서드를 instance에 위임
|
|
@@ -24,6 +24,20 @@ export var CLASS_NAMES = {
|
|
|
24
24
|
ACTIONS: 'ncua-floating-notification__actions',
|
|
25
25
|
CLOSE_BUTTON: 'ncua-floating-notification__close-button'
|
|
26
26
|
},
|
|
27
|
+
MESSAGE: {
|
|
28
|
+
BASE: 'ncua-message-notification',
|
|
29
|
+
CONTAINER: 'ncua-message-notification__container',
|
|
30
|
+
CONTENT: 'ncua-message-notification__content',
|
|
31
|
+
CONTENT_WRAPPER: 'ncua-message-notification__content-wrapper',
|
|
32
|
+
ICON: 'ncua-message-notification__icon',
|
|
33
|
+
TEXT_CONTAINER: 'ncua-message-notification__text-container',
|
|
34
|
+
TITLE: 'ncua-message-notification__title',
|
|
35
|
+
SUPPORTING_TEXT: 'ncua-message-notification__supporting-text',
|
|
36
|
+
ACTIONS_CONTAINER: 'ncua-message-notification__actions-container',
|
|
37
|
+
ACTIONS: 'ncua-message-notification__actions',
|
|
38
|
+
HIDE_LINK: 'ncua-message-notification__hide-link',
|
|
39
|
+
CLOSE_BUTTON: 'ncua-message-notification__close-button'
|
|
40
|
+
},
|
|
27
41
|
COMMON: {
|
|
28
42
|
ACTION_BUTTON: 'ncua-notification__action-button'
|
|
29
43
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { SVG_ICONS, FLOATING_ICON_MAP, FULL_WIDTH_ICON_MAP, ICON_MAP } from './icons';
|
|
2
2
|
export { CLASS_NAMES } from './classNames';
|
|
3
|
-
export { FEATURED_ICON_SIZES, ICON_PIXEL_SIZES, CLOSE_BUTTON_SIZES, CLOSE_BUTTON_SVG_SIZES, FULL_WIDTH_SIZES, getSizes } from './sizes';
|
|
3
|
+
export { FEATURED_ICON_SIZES, ICON_PIXEL_SIZES, CLOSE_BUTTON_SIZES, CLOSE_BUTTON_SVG_SIZES, FULL_WIDTH_SIZES, MESSAGE_SIZES, getSizes } from './sizes';
|
|
4
|
+
export { MESSAGE_CLOSE_ICON_COLORS } from './types';
|
|
@@ -25,6 +25,12 @@ export var FULL_WIDTH_SIZES = {
|
|
|
25
25
|
ICON: '16',
|
|
26
26
|
CLOSE_BUTTON: '20'
|
|
27
27
|
};
|
|
28
|
+
// Message 알림 고정 사이즈
|
|
29
|
+
export var MESSAGE_SIZES = {
|
|
30
|
+
FEATURED_ICON: 'lg',
|
|
31
|
+
ICON_PIXEL: '24',
|
|
32
|
+
CLOSE_BUTTON: '20'
|
|
33
|
+
};
|
|
28
34
|
// 사이즈 유틸리티 함수들
|
|
29
35
|
export var getSizes = {
|
|
30
36
|
featuredIcon: function (isMobile) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Notification } from './Notification';
|
|
2
2
|
export { FullWidthNotification } from './FullWidthNotification';
|
|
3
3
|
export { FloatingNotification } from './FloatingNotification';
|
|
4
|
+
export { MessageNotification } from './MessageNotification';
|
|
4
5
|
export * from './utils';
|
|
5
6
|
export { SVG_ICONS, CLASS_NAMES, ICON_MAP, FLOATING_ICON_MAP, FULL_WIDTH_ICON_MAP } from './const';
|
|
6
7
|
// 전역 등록 ( 추후 index.ts와 개별동작 할 수 있게끔 대비 )
|
|
@@ -27,7 +27,7 @@ export function renderActions(actions, wrapperClass) {
|
|
|
27
27
|
return '';
|
|
28
28
|
}
|
|
29
29
|
var buttonsHtml = actions.map(function (action) {
|
|
30
|
-
var buttonHtml = "\n <button \n class=\"ncua-
|
|
30
|
+
var buttonHtml = "\n <button \n class=\"ncua-btn ncua-btn--sm ncua-btn--".concat(action.hierarchy || 'text', "\"\n data-action=\"").concat(action.label, "-").concat(action.hierarchy, "\"\n >\n ").concat(action.label, "\n </button>");
|
|
31
31
|
return buttonHtml;
|
|
32
32
|
}).join('');
|
|
33
33
|
return "<div class=\"".concat(wrapperClass, "\">").concat(buttonsHtml, "</div>");
|
|
@@ -37,13 +37,13 @@ export function bindNotificationEvents(element, actions, onClose, onRemove) {
|
|
|
37
37
|
element.addEventListener('click', function (event) {
|
|
38
38
|
var target = event.target;
|
|
39
39
|
// 닫기 버튼 클릭 처리
|
|
40
|
-
if (target.matches(".".concat(CLASS_NAMES.FULL_WIDTH.CLOSE_BUTTON, ", .").concat(CLASS_NAMES.FLOATING.CLOSE_BUTTON)) || target.closest(".".concat(CLASS_NAMES.FULL_WIDTH.CLOSE_BUTTON, ", .").concat(CLASS_NAMES.FLOATING.CLOSE_BUTTON))) {
|
|
40
|
+
if (target.matches(".".concat(CLASS_NAMES.FULL_WIDTH.CLOSE_BUTTON, ", .").concat(CLASS_NAMES.FLOATING.CLOSE_BUTTON)) || target.closest(".".concat(CLASS_NAMES.FULL_WIDTH.CLOSE_BUTTON, ", .").concat(CLASS_NAMES.FLOATING.CLOSE_BUTTON)) || target.closest(".".concat(CLASS_NAMES.MESSAGE.CLOSE_BUTTON))) {
|
|
41
41
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
42
42
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
// 액션 버튼 클릭 처리
|
|
46
|
-
var actionButton = target.closest('.ncua-
|
|
46
|
+
var actionButton = target.closest('.ncua-btn[data-action]');
|
|
47
47
|
if (actionButton && actions) {
|
|
48
48
|
var actionData = actionButton.getAttribute('data-action');
|
|
49
49
|
if (actionData) {
|
|
@@ -284,6 +284,13 @@ var DropdownModel = /** @class */function () {
|
|
|
284
284
|
this.updateFilteredOptions();
|
|
285
285
|
this.notifyListeners(['searchValue', 'filteredOptions', 'showAllItems']);
|
|
286
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* 검색어만 업데이트 (필터링 없이, API 모드용)
|
|
289
|
+
*/
|
|
290
|
+
DropdownModel.prototype.updateSearchValue = function (searchValue) {
|
|
291
|
+
this.state.searchValue = searchValue;
|
|
292
|
+
this.notifyListeners(['searchValue']);
|
|
293
|
+
};
|
|
287
294
|
/**
|
|
288
295
|
* 드롭다운이 열릴 수 있는지 확인 (ComboBox용)
|
|
289
296
|
*/
|