gnui 1.2.19 → 1.2.21

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 (79) hide show
  1. package/@types/gnui.d.ts +8 -0
  2. package/dist/js/gnui.esm.js +847 -263
  3. package/dist/js/gnui.js +847 -263
  4. package/dist/js/gnui.min.js +6 -6
  5. package/dist/styles/default.css +10743 -20757
  6. package/dist/styles/gpi.css +10773 -20787
  7. package/dist/styles/green24.css +11407 -21435
  8. package/dist/styles/insights.css +10759 -20774
  9. package/dist/styles/nac.css +10773 -20796
  10. package/dist/styles/ztnac.css +11407 -21436
  11. package/package.json +9 -3
  12. package/styleguide/assets/components.js +213 -12
  13. package/styleguide/assets/js/gnui.js +847 -263
  14. package/styleguide/assets/js/gnui.min.js +6 -6
  15. package/styleguide/assets/styles/default.css +10743 -20757
  16. package/styleguide/assets/styles/gpi.css +10773 -20787
  17. package/styleguide/assets/styles/green24.css +11407 -21435
  18. package/styleguide/assets/styles/insights.css +10759 -20774
  19. package/styleguide/assets/styles/nac.css +10773 -20796
  20. package/styleguide/assets/styles/ztnac.css +11407 -21436
  21. package/styleguide/category/COLOR/index.html +1 -1
  22. package/styleguide/category/COMPONENT/Alert(js)/index.html +1 -1
  23. package/styleguide/category/COMPONENT/Bignumber/index.html +1 -1
  24. package/styleguide/category/COMPONENT/Breadcrumb/index.html +1 -1
  25. package/styleguide/category/COMPONENT/Calendar(js)/index.html +1 -1
  26. package/styleguide/category/COMPONENT/Card/index.html +1 -1
  27. package/styleguide/category/COMPONENT/Chart(js)/index.html +1 -1
  28. package/styleguide/category/COMPONENT/Datagrid(js)/index.html +109 -11
  29. package/styleguide/category/COMPONENT/Datalist(js)/index.html +1 -1
  30. package/styleguide/category/COMPONENT/Growl(js)/index.html +1 -1
  31. package/styleguide/category/COMPONENT/JsonView(js)/index.html +1 -1
  32. package/styleguide/category/COMPONENT/Loader(js)/index.html +1 -1
  33. package/styleguide/category/COMPONENT/MenuButton(js)/index.html +169 -21
  34. package/styleguide/category/COMPONENT/Message(js)/index.html +1 -1
  35. package/styleguide/category/COMPONENT/Modal(js)/index.html +31 -1
  36. package/styleguide/category/COMPONENT/Pagination(js)/index.html +1 -1
  37. package/styleguide/category/COMPONENT/Panel/index.html +1 -1
  38. package/styleguide/category/COMPONENT/Progressbar(js)/index.html +1 -1
  39. package/styleguide/category/COMPONENT/Tab(js)/index.html +1 -1
  40. package/styleguide/category/COMPONENT/Tagcloud(js)/index.html +1 -1
  41. package/styleguide/category/COMPONENT/Tooltip(js)/index.html +1 -1
  42. package/styleguide/category/COMPONENT/Tree(js)/index.html +98 -19
  43. package/styleguide/category/CONTROLS/Button(js)/index.html +1 -1
  44. package/styleguide/category/CONTROLS/Checkbox/index.html +1 -1
  45. package/styleguide/category/CONTROLS/Colorpicker(js)/index.html +1 -1
  46. package/styleguide/category/CONTROLS/Datepicker(js)/index.html +1 -1
  47. package/styleguide/category/CONTROLS/Dropdown(js)/index.html +67 -10
  48. package/styleguide/category/CONTROLS/File/index.html +1 -1
  49. package/styleguide/category/CONTROLS/Form/Control/index.html +1 -1
  50. package/styleguide/category/CONTROLS/Form/Field/index.html +54 -2
  51. package/styleguide/category/CONTROLS/Form/Plain/index.html +2 -2
  52. package/styleguide/category/CONTROLS/Input/index.html +1 -1
  53. package/styleguide/category/CONTROLS/MultiText(js)/index.html +32 -1
  54. package/styleguide/category/CONTROLS/Picklist(js)/index.html +67 -13
  55. package/styleguide/category/CONTROLS/Radio/index.html +1 -1
  56. package/styleguide/category/CONTROLS/Select/index.html +1 -1
  57. package/styleguide/category/CONTROLS/SelectButton(js)/index.html +2 -2
  58. package/styleguide/category/CONTROLS/Slider/index.html +1 -1
  59. package/styleguide/category/CONTROLS/SortableList(js)/index.html +2 -2
  60. package/styleguide/category/CONTROLS/Switch(js)/index.html +1 -1
  61. package/styleguide/category/CONTROLS/SyntaxInput(js)/index.html +1 -1
  62. package/styleguide/category/CONTROLS/Textarea/index.html +2 -2
  63. package/styleguide/category/CONTROLS/Time(js)/index.html +2 -2
  64. package/styleguide/category/ELEMENTS/Box/index.html +1 -1
  65. package/styleguide/category/ELEMENTS/Icon/index.html +1 -1
  66. package/styleguide/category/ELEMENTS/Image/index.html +1 -1
  67. package/styleguide/category/ELEMENTS/List/index.html +1 -1
  68. package/styleguide/category/ELEMENTS/Table/index.html +1 -1
  69. package/styleguide/category/ELEMENTS/Tag/index.html +1 -1
  70. package/styleguide/category/ELEMENTS/Title/index.html +1 -1
  71. package/styleguide/category/LAYOUT/Container/index.html +1 -1
  72. package/styleguide/category/LAYOUT/Grid/index.html +1 -1
  73. package/styleguide/category/LAYOUT/Splitter(js)/index.html +1 -1
  74. package/styleguide/category/UTILITY/index.html +9 -2
  75. package/styleguide/category/Utils/index.html +1 -1
  76. package/styleguide/color.html +1 -1
  77. package/styleguide/index.html +1 -1
  78. package/styleguide/tag/javascript/index.html +4680 -4183
  79. package/styleguide/tag/v.0.1.0/index.html +5762 -5206
package/dist/js/gnui.js CHANGED
@@ -16876,65 +16876,65 @@
16876
16876
  return GNCoreEventManager.instance;
16877
16877
  }
16878
16878
  // life cycle event add
16879
- stateAdd(uid, name, handler) {
16880
- return this.add(undefined, uid, name, handler);
16879
+ stateAdd(cid, name, handler) {
16880
+ return this.add(undefined, cid, name, handler);
16881
16881
  }
16882
- add(target, uid, name, handler) {
16883
- if (!this._eventMap[uid]) {
16884
- this._eventMap[uid] = []; // 해당 uid에 대한 이벤트가 없는 경우 초기화
16882
+ add(target, cid, name, handler) {
16883
+ if (!this._eventMap[cid]) {
16884
+ this._eventMap[cid] = []; // 해당 cid에 대한 이벤트가 없는 경우 초기화
16885
16885
  }
16886
- const eid = this._getEventId(uid); // eventID 생성
16887
- this._eventMap[uid].push(target
16886
+ const eid = this._getEventId(cid); // eventID 생성
16887
+ this._eventMap[cid].push(target
16888
16888
  ? {
16889
16889
  target,
16890
16890
  eid,
16891
- uid,
16891
+ cid,
16892
16892
  name,
16893
16893
  handler
16894
16894
  }
16895
16895
  : {
16896
16896
  eid,
16897
- uid,
16897
+ cid,
16898
16898
  name,
16899
16899
  handler
16900
16900
  });
16901
16901
  target && on(target, name, handler); // 이벤트 바인딩
16902
16902
  return eid;
16903
16903
  }
16904
- remove(uid, name) {
16905
- const _events = this._getEvent(uid, name);
16904
+ remove(cid, name) {
16905
+ const _events = this._getEvent(cid, name);
16906
16906
  // 이벤트 해제
16907
16907
  if (_events.length) {
16908
16908
  _events.forEach((_event) => {
16909
16909
  off(_event.target, _event.name, _event.handler);
16910
16910
  // eventMap에서 해당 이벤트 삭제
16911
- this._eventMap[uid].some(event => event.eid === _event.eid) &&
16912
- this._eventMap[uid].splice(this._eventMap[uid].findIndex(event => event.eid === _event.eid), 1);
16911
+ this._eventMap[cid].some(event => event.eid === _event.eid) &&
16912
+ this._eventMap[cid].splice(this._eventMap[cid].findIndex(event => event.eid === _event.eid), 1);
16913
16913
  });
16914
- // uid에 대한 이벤트가 남아있지 않은 경우 uid 키 삭제
16915
- if (!this._eventMap[uid].length) {
16916
- delete this._eventMap[uid];
16914
+ // cid에 대한 이벤트가 남아있지 않은 경우 cid 키 삭제
16915
+ if (!this._eventMap[cid].length) {
16916
+ delete this._eventMap[cid];
16917
16917
  }
16918
16918
  }
16919
16919
  }
16920
- removeAll(uid) {
16921
- if (!this._eventMap[uid]) {
16920
+ removeAll(cid) {
16921
+ if (!this._eventMap[cid]) {
16922
16922
  return;
16923
16923
  }
16924
16924
  // 이벤트 해제
16925
- this._eventMap[uid].forEach(event => {
16925
+ this._eventMap[cid].forEach(event => {
16926
16926
  if (event.target) {
16927
16927
  off(event.target, event.name, event.handler);
16928
16928
  }
16929
16929
  });
16930
16930
  // 이벤트 삭제
16931
- delete this._eventMap[uid];
16931
+ delete this._eventMap[cid];
16932
16932
  }
16933
16933
  /**
16934
16934
  * lifeCycle 핸들러 실행
16935
16935
  */
16936
- cyclepatch(uid, name, params) {
16937
- const _events = this._getEvent(uid, name);
16936
+ cyclepatch(cid, name, params) {
16937
+ const _events = this._getEvent(cid, name);
16938
16938
  if (_events.length) {
16939
16939
  _events.forEach((_event) => {
16940
16940
  const _tagret = _event.target || this;
@@ -16949,8 +16949,8 @@
16949
16949
  * - 모든 핸들러를 순차 실행한 뒤, 하나라도 `false` 를 반환한 경우 `true`(cancelled)를 반환한다.
16950
16950
  * (첫 false 에서 중단하지 않고, 나머지 핸들러도 계속 실행한다)
16951
16951
  */
16952
- async dispatch(uid, name, params) {
16953
- const _events = this._getEvent(uid, name);
16952
+ async dispatch(cid, name, params) {
16953
+ const _events = this._getEvent(cid, name);
16954
16954
  let cancelled = false;
16955
16955
  if (_events.length) {
16956
16956
  for (const _event of _events) {
@@ -16964,17 +16964,17 @@
16964
16964
  }
16965
16965
  return cancelled;
16966
16966
  }
16967
- _getEvent(uid, name) {
16967
+ _getEvent(cid, name) {
16968
16968
  // parameters에 해당하는 이벤트 반환
16969
- return this._eventMap[uid]
16970
- ? this._eventMap[uid].filter(event => {
16969
+ return this._eventMap[cid]
16970
+ ? this._eventMap[cid].filter(event => {
16971
16971
  return event.name === name;
16972
16972
  }) || []
16973
16973
  : [];
16974
16974
  }
16975
- _getEventId(uid) {
16975
+ _getEventId(cid) {
16976
16976
  // event ID 생성
16977
- return `ev_${uid}${this._eventMap[uid].length}`;
16977
+ return `ev_${cid}${this._eventMap[cid].length}`;
16978
16978
  }
16979
16979
  }
16980
16980
 
@@ -17018,12 +17018,12 @@
17018
17018
  }
17019
17019
  // 최초 생성 후 state에 등록 - created
17020
17020
  _addComponent(component) {
17021
- const uid = component._uid;
17022
- if (uid) {
17023
- this._componentMap[uid] = {
17021
+ const cid = component._cid;
17022
+ if (cid) {
17023
+ this._componentMap[cid] = {
17024
17024
  component: component,
17025
17025
  selector: component.$selector,
17026
- uid: uid,
17026
+ cid: cid,
17027
17027
  status: 'created'
17028
17028
  };
17029
17029
  }
@@ -17038,13 +17038,28 @@
17038
17038
  if (!_selector) {
17039
17039
  return undefined;
17040
17040
  }
17041
- Object.values(this._componentMap).forEach(n => {
17042
- // 동일한 selector 인지 비교
17043
- if (isEquals(n.uid, _selector) || isEquals(_selector.id, n.uid)) {
17041
+ // 1) cid 직접 조회 (string selector 인 경우)
17042
+ if (typeof selector === 'string' && this._componentMap[selector]) {
17043
+ _findComponent = this._componentMap[selector].component;
17044
+ _findComponent._status = this._componentMap[selector].status;
17045
+ return _findComponent;
17046
+ }
17047
+ // 2) data-component-id 기반 조회
17048
+ const dataCid = (_selector === null || _selector === void 0 ? void 0 : _selector.getAttribute) && _selector.getAttribute('data-component-id');
17049
+ if (dataCid && this._componentMap[dataCid]) {
17050
+ _findComponent = this._componentMap[dataCid].component;
17051
+ _findComponent._status = this._componentMap[dataCid].status;
17052
+ return _findComponent;
17053
+ }
17054
+ // 3) selector/element 비교 fallback
17055
+ Object.values(this._componentMap).some(n => {
17056
+ var _a;
17057
+ if (isEquals(n.selector, _selector) || isEquals((_a = n.component) === null || _a === void 0 ? void 0 : _a.$el, _selector)) {
17044
17058
  _findComponent = n.component;
17045
17059
  _findComponent._status = n.status;
17046
- return false;
17060
+ return true;
17047
17061
  }
17062
+ return false;
17048
17063
  });
17049
17064
  return _findComponent;
17050
17065
  }
@@ -17058,7 +17073,7 @@
17058
17073
  // 동일한 selector 인지 비교해서 동일한 component의 selector이면 제거 처리
17059
17074
  if (isEquals(n.selector, _selector)) {
17060
17075
  // componentMap에서 완전히 제거
17061
- delete this._componentMap[n.uid];
17076
+ delete this._componentMap[n.cid];
17062
17077
  // 컴포넌트 내부 참조도 제거 (메모리 누수 방지)
17063
17078
  if (n.component) {
17064
17079
  n.component = null;
@@ -17067,32 +17082,32 @@
17067
17082
  }
17068
17083
  });
17069
17084
  }
17070
- // 등록된 컴포넌트 제거 (uid 기반 - 더 효율적)
17071
- _removeComponentByUid(uid) {
17072
- if (!uid || !this._componentMap[uid]) {
17085
+ // 등록된 컴포넌트 제거 (cid 기반)
17086
+ _removeComponentByCid(cid) {
17087
+ if (!cid || !this._componentMap[cid]) {
17073
17088
  return;
17074
17089
  }
17075
17090
  // 컴포넌트 내부 참조 제거 (메모리 누수 방지)
17076
- const componentInfo = this._componentMap[uid];
17091
+ const componentInfo = this._componentMap[cid];
17077
17092
  if (componentInfo.component) {
17078
17093
  componentInfo.component = null;
17079
17094
  }
17080
17095
  componentInfo.selector = null;
17081
17096
  // componentMap에서 완전히 제거
17082
- delete this._componentMap[uid];
17097
+ delete this._componentMap[cid];
17083
17098
  }
17084
17099
  // 컴포넌트 life cycle에 따른 eventManager dispatch
17085
- _detectedCycle(uid, name) {
17100
+ _detectedCycle(cid, name) {
17086
17101
  // component 마지막 status 업데이트
17087
- if (this._componentMap[uid]) {
17088
- this._componentMap[uid].status = name;
17102
+ if (this._componentMap[cid]) {
17103
+ this._componentMap[cid].status = name;
17089
17104
  }
17090
- // event manager를 이용해 해당 uid 이벤트 dispatch
17105
+ // event manager를 이용해 해당 cid 이벤트 dispatch
17091
17106
  const eventManager = GNCoreEventManager.getInstance();
17092
17107
  // 호출 후
17093
- eventManager.cyclepatch(uid, name, '');
17108
+ eventManager.cyclepatch(cid, name, '');
17094
17109
  // 이벤트 해제 - life cycle 은 컴포넌트 별로 한번씩만 존재하므로..
17095
- eventManager.remove(uid, name);
17110
+ eventManager.remove(cid, name);
17096
17111
  }
17097
17112
  // document DOM observer 실행
17098
17113
  // - DOM 변환 이벤트 감지해서 removedNodes 가 생기면 해당 node와 일치하는 component를 찾아 제거한다.
@@ -17117,18 +17132,18 @@
17117
17132
  if (isElement$2(rm) && attr(rm, 'data-gnui')) {
17118
17133
  remove($('#' + attr(rm, 'data-gnui')));
17119
17134
  }
17120
- const childComponents = $$('[data-gn-uid]', rm);
17135
+ const childComponents = $$('[data-component-id]', rm);
17121
17136
  each(childComponents, (childComponent) => {
17122
17137
  if (isElement$2(childComponent)) {
17123
17138
  const findComponent = closerThis._getComponent($(childComponent));
17124
- if (findComponent && findComponent._uid && findComponent.$el && findComponent.$name !== 'modal') {
17125
- // $destroy 내부에서 removeAll과 _removeComponentByUid를 처리하므로 직접 호출만
17139
+ if (findComponent && findComponent._cid && findComponent.$el && findComponent.$name !== 'modal') {
17140
+ // $destroy 내부에서 removeAll과 _removeComponentByCid를 처리하므로 직접 호출만
17126
17141
  findComponent.$destroy(findComponent, false);
17127
17142
  }
17128
17143
  }
17129
17144
  });
17130
17145
  const findComponent = closerThis._getComponent($(rm));
17131
- if (findComponent && findComponent._uid && !((_a = findComponent.$el) === null || _a === void 0 ? void 0 : _a.parentNode) && findComponent.$name !== 'modal') {
17146
+ if (findComponent && findComponent._cid && !((_a = findComponent.$el) === null || _a === void 0 ? void 0 : _a.parentNode) && findComponent.$name !== 'modal') {
17132
17147
  findComponent.$destroy(findComponent, false);
17133
17148
  }
17134
17149
  });
@@ -17161,6 +17176,7 @@
17161
17176
  return generateUUID();
17162
17177
  };
17163
17178
  this._uid = ((_a = this.$options) === null || _a === void 0 ? void 0 : _a.id) || ((_b = this.$selector) === null || _b === void 0 ? void 0 : _b.id) || `${GN_CONSTANT.PREFIX}${uuid()}`;
17179
+ this._cid = `${GN_CONSTANT.PREFIX}${uuid()}`;
17164
17180
  }
17165
17181
  $reset() { }
17166
17182
  $init(component, options) {
@@ -17171,14 +17187,14 @@
17171
17187
  // component.$options.states => 사용자가 정의한 lifecycle callback handler
17172
17188
  this.$stateBind(component);
17173
17189
  // stateManager를 통해 beforeMount 상태 dispatch
17174
- stateManager._detectedCycle(component._uid, 'beforeMount');
17190
+ stateManager._detectedCycle(component._cid, 'beforeMount');
17175
17191
  this.$mount(component, this.$selector);
17176
17192
  this.$render(component.$options);
17177
17193
  // stateManager를 통해 beforeBind 상태 dispatch
17178
- stateManager._detectedCycle(component._uid, 'beforeBind');
17194
+ stateManager._detectedCycle(component._cid, 'beforeBind');
17179
17195
  this.$bind(component);
17180
17196
  // stateManager를 통해 completed 상태 dispatch
17181
- stateManager._detectedCycle(component._uid, 'completed');
17197
+ stateManager._detectedCycle(component._cid, 'completed');
17182
17198
  }
17183
17199
  $create(component, options) {
17184
17200
  // extend options
@@ -17240,7 +17256,7 @@
17240
17256
  const eventManager = GNCoreEventManager.getInstance();
17241
17257
  // lifecycle 관련 이벤트 add to eventManager
17242
17258
  GN_CONSTANT.LIFE_CYCLE.forEach((ev) => {
17243
- eventManager.stateAdd(component._uid, ev, (...args) => {
17259
+ eventManager.stateAdd(component._cid, ev, (...args) => {
17244
17260
  // 해당 life cycle 상태에 해당하는 함수가 각 컴포넌트 내부에 정의되어 있으면 호출한다.
17245
17261
  if (isFunction(component[ev])) {
17246
17262
  component[ev](args);
@@ -17285,13 +17301,17 @@
17285
17301
  if (tmpRole) {
17286
17302
  attr(this.$el, 'role', tmpRole);
17287
17303
  }
17288
- attr(this.$el, 'data-gn-uid', this._uid);
17304
+ attr(this.$el, 'data-component-id', this._cid);
17289
17305
  // inherit selector class
17290
17306
  selector.className && addClass(this.$el, selector.className);
17291
17307
  }
17292
17308
  else {
17293
17309
  this.$el = $(this.$selector);
17294
17310
  }
17311
+ // 항상 컴포넌트 cid를 DOM에 표시 (기존 DOM 사용 시에도)
17312
+ if (this.$el) {
17313
+ attr(this.$el, 'data-component-id', this._cid);
17314
+ }
17295
17315
  // delegates 바인딩
17296
17316
  each(this.$options.delegates, (val, key) => {
17297
17317
  if (isString(val)) {
@@ -17311,11 +17331,11 @@
17311
17331
  const eventManager = GNCoreEventManager.getInstance();
17312
17332
  each(events, (event, name) => {
17313
17333
  if (isFunction(event)) {
17314
- eventManager.add(this.$el, this._uid, event.name || name, event);
17334
+ eventManager.add(this.$el, this._cid, event.name || name, event);
17315
17335
  }
17316
17336
  else if (isPlainObject$1(event)) {
17317
17337
  const delegate = isFunction(event.delegate) ? event.delegate() : event.delegate;
17318
- eventManager.add(delegate, this._uid, event.name, event.handler);
17338
+ eventManager.add(delegate, this._cid, event.name, event.handler);
17319
17339
  }
17320
17340
  });
17321
17341
  }
@@ -17334,13 +17354,13 @@
17334
17354
  */
17335
17355
  async $event(component, name, ...params) {
17336
17356
  const eventManager = GNCoreEventManager.getInstance();
17337
- return eventManager.dispatch(component._uid, name, params);
17357
+ return eventManager.dispatch(component._cid, name, params);
17338
17358
  }
17339
17359
  $destroy(component = this, removeEl = true) {
17340
17360
  var _a;
17341
17361
  const stateManager = GNUIState.getInstance();
17342
17362
  // state manager 를 통해 destroy 상태 dispatch
17343
- stateManager._detectedCycle(component._uid, 'destroy');
17363
+ stateManager._detectedCycle(component._cid, 'destroy');
17344
17364
  // remove DOM (by removeEl)
17345
17365
  if (removeEl) {
17346
17366
  style(component.$el, 'display', 'none');
@@ -17350,11 +17370,11 @@
17350
17370
  component.$options._destroy();
17351
17371
  }
17352
17372
  // state manager 를 통해 destroy 상태 dispatch
17353
- stateManager._detectedCycle(component._uid, 'destroyed');
17373
+ stateManager._detectedCycle(component._cid, 'destroyed');
17354
17374
  // event manager 에서 등록 해제
17355
- GNCoreEventManager.getInstance().removeAll(component._uid);
17356
- // state manager에서 component 제거 (uid 기반으로 효율적 제거)
17357
- stateManager._removeComponentByUid(component._uid);
17375
+ GNCoreEventManager.getInstance().removeAll(component._cid);
17376
+ // state manager에서 component 제거 (cid 기반)
17377
+ stateManager._removeComponentByCid(component._cid);
17358
17378
  // 메모리 누수 방지: component의 모든 hasOwnProperty 제거
17359
17379
  // config, events, methods, _hidden 등 동적으로 추가된 속성 포함
17360
17380
  Object.keys(component).forEach((key) => {
@@ -33311,7 +33331,10 @@
33311
33331
  text: ''
33312
33332
  };
33313
33333
  }
33314
- this.$event(this, 'onChange', option.value, option.text, this.$options.value);
33334
+ // 기존 의미 유지: 클릭된 옵션 기준으로 value/text 전달
33335
+ const value = !isArray$1(option.value) ? String(option.value) : '';
33336
+ const text = option.text || (isArray$1(option === null || option === void 0 ? void 0 : option.cols) ? option.cols : value);
33337
+ this.$event(this, 'onChange', value, text, this.$options.value);
33315
33338
  },
33316
33339
  toggle: () => {
33317
33340
  if (this.$options.disabled) {
@@ -33407,18 +33430,33 @@
33407
33430
  const target = e instanceof Event ? $(e.currentTarget) : find(`[data-value=${option.value}]`, this.$el);
33408
33431
  e instanceof Event && e.stopPropagation();
33409
33432
  // toggle 처리
33433
+ const checkbox = find('input[type=checkbox]', target);
33410
33434
  if (hasClass(target, 'is-active')) {
33411
33435
  removeClass(target, 'is-active');
33412
- find('input[type=checkbox]', target).checked = false;
33436
+ if (checkbox) {
33437
+ checkbox.checked = false;
33438
+ }
33413
33439
  }
33414
33440
  else {
33415
33441
  addClass(target, 'is-active');
33416
- find('input[type=checkbox]', target).checked = true;
33442
+ if (checkbox) {
33443
+ checkbox.checked = true;
33444
+ }
33417
33445
  }
33418
33446
  const selected = findAll('.dropdown-item.is-active', this.$el).map((item) => data(item, 'data-value'));
33419
- this.$options.value = this.$options.data.filter((opt) => selected.includes(opt.value));
33447
+ this.$options.value = this.$options.data.filter((opt) => {
33448
+ // value가 배열이 아닌 경우에만 비교
33449
+ return !isArray$1(opt.value) && selected.includes(opt.value);
33450
+ });
33420
33451
  // text 표시
33421
- const selectText = this.$options.value.map((v) => v.text).join(',');
33452
+ // Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
33453
+ const selectText = this.$options.value.map((v) => {
33454
+ if (isArray$1(v === null || v === void 0 ? void 0 : v.cols)) {
33455
+ return v.cols[0];
33456
+ }
33457
+ // value가 배열이 아닌 경우에만 사용
33458
+ return v.text || (!isArray$1(v.value) ? String(v.value) : '');
33459
+ }).join(',');
33422
33460
  text$1(find('.dropdown-text', this.$el), selectText.length ? escapeEntity(selectText) : this.$options.textSets && this.$options.textSets.selectText ? this.$options.textSets.selectText : '');
33423
33461
  this._hidden.change(option);
33424
33462
  }
@@ -33440,9 +33478,21 @@
33440
33478
  }
33441
33479
  // text 표시
33442
33480
  const selectText = find('.dropdown-text', this.$el);
33443
- text$1(selectText, escapeEntity(option.text));
33481
+ // Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
33482
+ let displayText;
33483
+ if (isArray$1(option === null || option === void 0 ? void 0 : option.cols)) {
33484
+ displayText = option.cols[0];
33485
+ }
33486
+ else {
33487
+ // value가 배열이 아닌 경우에만 사용
33488
+ displayText = option.text || (!isArray$1(option.value) ? String(option.value) : '');
33489
+ }
33490
+ text$1(selectText, escapeEntity(displayText));
33444
33491
  // select 선택값 변경
33445
- targetSelect.value = option.value;
33492
+ // value 배열이 아닌 경우에만 설정
33493
+ if (!isArray$1(option.value)) {
33494
+ targetSelect.value = option.value;
33495
+ }
33446
33496
  trigger(targetSelect, 'change');
33447
33497
  this.$options.value = option;
33448
33498
  this._hidden.change(option);
@@ -33499,21 +33549,76 @@
33499
33549
  return;
33500
33550
  }
33501
33551
  findAll('.dropdown-item', this.$el).forEach((option) => {
33502
- if (!includes(data(option, 'value').toUpperCase(), q.toUpperCase()) && !includes(text$1(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
33552
+ const itemValue = data(option, 'value');
33553
+ // value가 배열이 아닌 항목만 검색 대상으로 처리
33554
+ const rowData = this.$options.flatData.find((item) => {
33555
+ // value가 배열이 아닌 경우에만 비교
33556
+ return !isArray$1(item.value) && String(item.value) === itemValue;
33557
+ });
33558
+ let match = false;
33559
+ // Implements [US-Rev-014] 다중 컬럼 모드: cols 배열의 값들을 검색
33560
+ if (isArray$1(rowData === null || rowData === void 0 ? void 0 : rowData.cols)) {
33561
+ match = rowData.cols.some((colValue) => {
33562
+ return includes(String(colValue).toUpperCase(), q.toUpperCase());
33563
+ });
33564
+ // value 필드도 검색 대상에 포함 (배열이 아닌 경우에만)
33565
+ if (!match && rowData.value && !isArray$1(rowData.value)) {
33566
+ match = includes(String(rowData.value).toUpperCase(), q.toUpperCase());
33567
+ }
33568
+ }
33569
+ else if (rowData) {
33570
+ // 단일 컬럼 모드: text 또는 value 필드 검색
33571
+ const textValue = rowData.text || (!isArray$1(rowData.value) ? String(rowData.value) : '');
33572
+ const valueStr = !isArray$1(rowData.value) ? String(rowData.value) : '';
33573
+ match = includes(valueStr.toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
33574
+ }
33575
+ else {
33576
+ // rowData를 찾지 못한 경우 (그룹화된 항목 등), DOM에서 직접 검색
33577
+ const textValue = text$1(find('.dropdown-text', option));
33578
+ match = includes(itemValue.toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
33579
+ }
33580
+ if (!match) {
33503
33581
  css$1(option, 'display', 'none');
33504
33582
  }
33505
33583
  });
33506
33584
  },
33507
33585
  renderLabel: () => {
33508
- const _labelText = this.$options.value
33509
- ? isArray$1(this.$options.value)
33510
- ? this.$options.value.map((v) => v.text).join(',')
33511
- : this.$options.value.text
33512
- : this.$options.textSets && this.$options.textSets.selectText
33513
- ? this.$options.textSets.selectText
33514
- : this.$options.flatData.length
33515
- ? this.$options.flatData[0].text
33516
- : '';
33586
+ // Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
33587
+ let _labelText = '';
33588
+ if (this.$options.value) {
33589
+ if (isArray$1(this.$options.value)) {
33590
+ _labelText = this.$options.value.map((v) => {
33591
+ if (isArray$1(v === null || v === void 0 ? void 0 : v.cols)) {
33592
+ return v.cols[0];
33593
+ }
33594
+ // value가 배열이 아닌 경우에만 사용
33595
+ return v.text || (!isArray$1(v.value) ? String(v.value) : '');
33596
+ }).join(',');
33597
+ }
33598
+ else {
33599
+ const value = this.$options.value;
33600
+ if (isArray$1(value === null || value === void 0 ? void 0 : value.cols)) {
33601
+ _labelText = value.cols[0];
33602
+ }
33603
+ else {
33604
+ // value가 배열이 아닌 경우에만 사용
33605
+ _labelText = value.text || (!isArray$1(value.value) ? String(value.value) : '');
33606
+ }
33607
+ }
33608
+ }
33609
+ else if (this.$options.textSets && this.$options.textSets.selectText) {
33610
+ _labelText = this.$options.textSets.selectText;
33611
+ }
33612
+ else if (this.$options.flatData.length) {
33613
+ const firstItem = this.$options.flatData[0];
33614
+ if (isArray$1(firstItem === null || firstItem === void 0 ? void 0 : firstItem.cols)) {
33615
+ _labelText = firstItem.cols[0];
33616
+ }
33617
+ else {
33618
+ // value가 배열이 아닌 경우에만 사용
33619
+ _labelText = firstItem.text || (!isArray$1(firstItem.value) ? String(firstItem.value) : '');
33620
+ }
33621
+ }
33517
33622
  return createElement$1("span", { className: "dropdown-text" }, escapeEntity(_labelText));
33518
33623
  },
33519
33624
  renderSub: (data) => {
@@ -33523,24 +33628,43 @@
33523
33628
  if (this.$options.type === 'opened' && !items.length) {
33524
33629
  return createElement$1("div", { className: 'dropdown-nodata' }, this.$options.textSets.noData);
33525
33630
  }
33526
- return (createElement$1("ul", null, items.map((option, index) => (createElement$1("li", { id: this._uid + '_opt_' + index, className: 'dropdown-item' +
33527
- (option.text ? '' : ' is-unselectable') +
33528
- (this.$options.value &&
33529
- (isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value)
33530
- ? ' is-active'
33531
- : '') +
33532
- (this.$options.multiple ? ' has-checkbox' : ''), "on-click": isArray$1(option.value) || !option.text ? null : this._hidden.select.bind(this, option), "data-value": isArray$1(option.value) ? '' : option.value, title: option.text ? escapeEntity(option.text) : '' },
33533
- createElement$1("span", { className: "dropdown-text", innerHTML: option.html ? option.html : '' },
33534
- option.html ? ('') : this.$options.multiple ? (createElement$1("div", { className: "gn-checks is-small is-no-padding" },
33535
- createElement$1("input", { type: "checkbox", id: this._uid + '_chk_' + index, defaultChecked: this.$options.value &&
33536
- (isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value), disabled: this.$options.disabled }),
33537
- createElement$1("label", { for: this._uid + '_chk_' + index }, escapeEntity(option.text)))) : option.icon ? (createElement$1("span", null,
33538
- createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
33539
- createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
33540
- escapeEntity(option.text))) : (escapeEntity(option.text)),
33541
- isArray$1(option.value) && (createElement$1("span", { className: "gn-icon is-small submenu-icon" },
33542
- createElement$1("i", { className: "fas fa-angle-right" })))),
33543
- isArray$1(option.value) && this._hidden.renderSub(option.value))))));
33631
+ const hasCols = items.some((item) => !(item === null || item === void 0 ? void 0 : item.html) && isArray$1(item === null || item === void 0 ? void 0 : item.cols));
33632
+ return (createElement$1("ul", { className: hasCols ? 'is-cols' : '' }, items.map((option, index) => {
33633
+ const hasHtml = !!option.html;
33634
+ const hasColsData = isArray$1(option === null || option === void 0 ? void 0 : option.cols);
33635
+ const renderAsCols = !hasHtml && hasColsData;
33636
+ // html이 있으면 text가 있는 항목만 선택 가능
33637
+ // cols가 있으면 번째 컬럼을 displayText로 사용 (value 비어도 선택 가능)
33638
+ const displayText = hasHtml
33639
+ ? (option.text || '')
33640
+ : renderAsCols
33641
+ ? (option.cols && option.cols.length ? String(option.cols[0]) : '')
33642
+ : (option.text || (!isArray$1(option.value) ? String(option.value) : ''));
33643
+ return (createElement$1("li", { key: index, id: this._uid + '_opt_' + index, className: 'dropdown-item' +
33644
+ (renderAsCols ? ' dropdown-row' : '') +
33645
+ (displayText ? '' : ' is-unselectable') +
33646
+ (this.$options.value &&
33647
+ (isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value)
33648
+ ? ' is-active'
33649
+ : '') +
33650
+ (this.$options.multiple ? ' has-checkbox' : ''), "on-click": isArray$1(option.value) || !displayText ? null : this._hidden.select.bind(this, option), "data-value": isArray$1(option.value) ? '' : option.value, title: displayText ? escapeEntity(String(displayText)) : '' },
33651
+ createElement$1("span", { className: "dropdown-text", innerHTML: option.html ? option.html : '' },
33652
+ option.html ? ('') : renderAsCols ? (createElement$1("div", { className: "gn-checks dropdown-cols" },
33653
+ this.$options.multiple && (createElement$1("div", { className: "is-small is-no-padding" },
33654
+ createElement$1("input", { type: "checkbox", id: this._uid + '_chk_' + index, defaultChecked: this.$options.value &&
33655
+ (isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value), disabled: this.$options.disabled }),
33656
+ createElement$1("label", { for: this._uid + '_chk_' + index }))),
33657
+ option.cols.map((col, colIndex) => (createElement$1("span", { key: colIndex, className: "dropdown-col" }, escapeEntity(col)))))) : this.$options.multiple ? (createElement$1("div", { className: "gn-checks is-small is-no-padding" },
33658
+ createElement$1("input", { type: "checkbox", id: this._uid + '_chk_' + index, defaultChecked: this.$options.value &&
33659
+ (isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value), disabled: this.$options.disabled }),
33660
+ createElement$1("label", { for: this._uid + '_chk_' + index }, escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : ''))))) : option.icon ? (createElement$1("span", null,
33661
+ createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
33662
+ createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
33663
+ escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : '')))) : (escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : ''))),
33664
+ isArray$1(option.value) && (createElement$1("span", { className: "gn-icon is-small submenu-icon" },
33665
+ createElement$1("i", { className: "fas fa-angle-right" })))),
33666
+ isArray$1(option.value) && this._hidden.renderSub(option.value)));
33667
+ })));
33544
33668
  },
33545
33669
  flatData: () => {
33546
33670
  // data 검색 편의성을 위해 depth를 없앤 flatdata 생성
@@ -33578,11 +33702,17 @@
33578
33702
  : [String(this.$options.value)]; // 기타: 숫자 등
33579
33703
  this.$options.value = this.$options.flatData.filter((opt) => {
33580
33704
  const optValue = typeof opt.value === 'string' ? opt.value : String(opt.value);
33581
- return values.includes(optValue) && opt.text;
33705
+ // Implements [US-Rev-014] cols가 있으면 text 없어도 선택 가능
33706
+ return values.includes(optValue) && (opt.text || isArray$1(opt === null || opt === void 0 ? void 0 : opt.cols) || (!isArray$1(opt.value)));
33582
33707
  });
33583
33708
  }
33584
33709
  else {
33585
- this.$options.value = this.$options.flatData.find((opt) => opt.value + '' === this.$options.value + '' && opt.text);
33710
+ // Implements [US-Rev-014] cols가 있으면 text 없어도 선택 가능
33711
+ this.$options.value = this.$options.flatData.find((opt) => {
33712
+ const optValue = !isArray$1(opt.value) ? String(opt.value) : '';
33713
+ const compareValue = String(this.$options.value);
33714
+ return optValue === compareValue && (opt.text || isArray$1(opt === null || opt === void 0 ? void 0 : opt.cols) || optValue);
33715
+ });
33586
33716
  }
33587
33717
  }
33588
33718
  },
@@ -34425,7 +34555,7 @@
34425
34555
  const newOptions = merge(this.chartDefault, merge(chartOptions, typesDefault[this.$options.type] || {}));
34426
34556
  if (!newOptions.theme) {
34427
34557
  newOptions.theme = {
34428
- palette: 'palette4'
34558
+ palette: 'palette1'
34429
34559
  };
34430
34560
  }
34431
34561
  this.$options.chart = new ApexCharts$1(this.$el, newOptions);
@@ -37095,6 +37225,13 @@
37095
37225
  this.$event(this, 'onSort', column);
37096
37226
  },
37097
37227
  renderHeader: (columns, isReset = false) => {
37228
+ if (this._isHorizontalState()) {
37229
+ return (createElement$1("div", { className: "gn-datagrid-header-row is-horizontal" },
37230
+ createElement$1("div", { className: "gn-datagrid-header-cell is-horizontal" }, this.$options.hasCheck && (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
37231
+ createElement$1("input", { type: "checkbox", className: "is-allChecker", id: this._uid + '-rows-check', "on-click": (e) => {
37232
+ this._hidden.checkAll.call(this, e);
37233
+ }, disabled: this.$options.disabled }))))));
37234
+ }
37098
37235
  this._setColumnsTemplate(isReset);
37099
37236
  return (createElement$1("div", { className: "gn-datagrid-header-row", style: {
37100
37237
  'grid-template-columns': this._columnsTemplate.join(' ')
@@ -37135,15 +37272,24 @@
37135
37272
  },
37136
37273
  renderBody: (data, columns) => {
37137
37274
  // 헤더가 숨겨진 경우에도 body 렌더 전에 템플릿 폭을 준비한다
37138
- if (!this._columnsTemplate || !this._columnsTemplate.length) {
37275
+ if (!this._isHorizontalState() && (!this._columnsTemplate || !this._columnsTemplate.length)) {
37139
37276
  this._setColumnsTemplate();
37140
37277
  }
37141
37278
  rowIdx$1 = 0;
37142
- return (createElement$1("div", { className: "gn-datagrid-body", style: {
37279
+ return (createElement$1("div", { className: 'gn-datagrid-body' + (this._isHorizontalState() ? ' is-horizontal' : ''), style: {
37280
+ 'grid-template-columns': this._isHorizontalState()
37281
+ ? this._orientationState.columns === 'auto-fit'
37282
+ ? `repeat(auto-fit, minmax(${this._orientationState.minWidth}, 1fr))`
37283
+ : `repeat(${this._orientationState.columns}, minmax(0, 1fr))`
37284
+ : '',
37285
+ gap: this._isHorizontalState() ? this._orientationState.gap : '',
37143
37286
  maxHeight: this.$options.bodyHeight ? this.$options.bodyHeight : 'auto'
37144
37287
  } }, (data === null || data === void 0 ? void 0 : data.length) ? this._hidden.renderRows(data, columns) : this._hidden.renderNodata()));
37145
37288
  },
37146
37289
  renderRows: (rows, columns, depth = 0, isOpen = false) => {
37290
+ if (this._isHorizontalState()) {
37291
+ return rows.map((row) => this._hidden.renderRow(row, columns, 0, false, false));
37292
+ }
37147
37293
  return rows.map((row) => {
37148
37294
  return row[this.$options.childField] && isArray$1(row[this.$options.childField])
37149
37295
  ? [this._hidden.renderRow(row, columns, depth, true, isOpen), this._hidden.renderRows(row[this.$options.childField], columns, depth + 1, row.isOpened)]
@@ -37152,83 +37298,140 @@
37152
37298
  },
37153
37299
  renderRow: (row, columns, depth = 0, hasChild, isOpened, isCheck = false) => {
37154
37300
  const _index = rowIdx$1++;
37301
+ const getHorizontalRowClass = () => {
37302
+ if (!this._isHorizontalState() || this._orientationState.columns === 'auto-fit') {
37303
+ return '';
37304
+ }
37305
+ const classes = ['is-horizontal'];
37306
+ if (_index % this._orientationState.columns === 0) {
37307
+ classes.push('is-horizontal-first-col');
37308
+ }
37309
+ if ((_index + 1) % this._orientationState.columns === 0 || _index === this.$options.data.length - 1) {
37310
+ classes.push('is-horizontal-last-col');
37311
+ }
37312
+ if (_index < this._orientationState.columns) {
37313
+ classes.push('is-horizontal-first-row');
37314
+ }
37315
+ return ' ' + classes.join(' ');
37316
+ };
37317
+ const horizontalClass = getHorizontalRowClass();
37155
37318
  if (row.isChecked) {
37156
37319
  isCheck = true;
37157
37320
  }
37158
37321
  return (createElement$1("div", { "on-click": (e) => {
37159
- !this.$options.disabled && this._hidden.selectRow.call(this, row, _index, e);
37322
+ var _a;
37323
+ ((_a = this === null || this === void 0 ? void 0 : this.$options) === null || _a === void 0 ? void 0 : _a.onSelect) && !this.$options.disabled && this._hidden.selectRow.call(this, row, _index, e);
37160
37324
  }, "on-dblclick": (e) => {
37161
- !this.$options.disabled && this._hidden.doubleSelect.call(this, row, _index, e);
37162
- }, className: 'gn-datagrid-body-row' + (hasChild ? ' has-child' : '') + (row.isOpened ? '' : ' is-collapsed') + (depth > 0 && !isOpened ? ' is-hidden' : '') + (row.color ? ` ${row.color}` : ''), style: {
37163
- 'grid-template-columns': this._columnsTemplate.join(' ')
37164
- }, id: this._uid + '-row-' + _index, "data-depth": depth }, columns.map((col, idx) => {
37165
- const cellStyle = {};
37166
- if (col.bodyStyle || col.style) {
37167
- each(col.bodyStyle || col.style, (value, key) => {
37168
- if (key !== 'width') {
37169
- cellStyle[key] = value;
37170
- }
37171
- });
37172
- }
37173
- if (idx === 0 && depth !== 0) {
37174
- cellStyle.paddingLeft = depth * 15 + 10 + 'px';
37175
- }
37176
- if (isIE) {
37177
- cellStyle.display = 'inline-block';
37178
- }
37179
- if (col.key === 'btnOrder') {
37180
- cellStyle.display = 'flex';
37181
- cellStyle.padding = '0';
37182
- cellStyle['justify-content'] = 'space-evenly';
37183
- cellStyle['align-items'] = 'center';
37184
- return (createElement$1("div", { className: 'gn-datagrid-body-cell btn-container ' + (col.key ? col.key : ''), style: cellStyle, "on-click": (e) => {
37185
- this._hidden.stopRowSelectEvent(e);
37186
- } },
37187
- createElement$1("span", { className: 'gn-icon btn-order ' + (_index == 0 ? 'is-cancel' : 'is-info'), "on-click": () => {
37188
- !this.$options.disabled && this._hidden.moveRowUp.call(this, _index);
37189
- } },
37190
- createElement$1("i", { className: "fas fa-arrow-circle-up" })),
37191
- createElement$1("span", { className: 'gn-icon btn-order ' + (_index == this.$options.data.length - 1 ? 'is-cancel' : 'is-info'), "on-click": () => {
37192
- !this.$options.disabled && this._hidden.moveRowDown.call(this, _index);
37325
+ var _a;
37326
+ ((_a = this === null || this === void 0 ? void 0 : this.$options) === null || _a === void 0 ? void 0 : _a.onDoubleClick) && !this.$options.disabled && this._hidden.doubleSelect.call(this, row, _index, e);
37327
+ }, className: 'gn-datagrid-body-row' +
37328
+ (hasChild ? ' has-child' : '') +
37329
+ (row.isOpened ? '' : ' is-collapsed') +
37330
+ (depth > 0 && !isOpened ? ' is-hidden' : '') +
37331
+ (row.color ? ` ${row.color}` : '') +
37332
+ horizontalClass, style: {
37333
+ 'grid-template-columns': this._isHorizontalState() ? '' : this._columnsTemplate.join(' ')
37334
+ }, id: this._uid + '-row-' + _index, "data-depth": depth },
37335
+ this._isHorizontalState() && this._hidden.renderHorizontalCardHeader(row, _index, hasChild, isCheck),
37336
+ columns.map((col, idx) => {
37337
+ const cellStyle = {};
37338
+ if (col.bodyStyle || col.style) {
37339
+ each(col.bodyStyle || col.style, (value, key) => {
37340
+ if (key !== 'width') {
37341
+ cellStyle[key] = value;
37342
+ }
37343
+ });
37344
+ }
37345
+ if (idx === 0 && depth !== 0) {
37346
+ cellStyle.paddingLeft = depth * 15 + 10 + 'px';
37347
+ }
37348
+ if (isIE) {
37349
+ cellStyle.display = 'inline-block';
37350
+ }
37351
+ if (col.key === 'btnOrder') {
37352
+ cellStyle.display = 'flex';
37353
+ cellStyle.padding = '0';
37354
+ cellStyle['justify-content'] = 'space-evenly';
37355
+ cellStyle['align-items'] = 'center';
37356
+ return (createElement$1("div", { className: 'gn-datagrid-body-cell btn-container ' + (col.key ? col.key : '') + (this._isHorizontalState() ? ' is-horizontal' : ''), style: cellStyle, "data-key": col.key, "on-click": (e) => {
37357
+ this._hidden.stopRowSelectEvent(e);
37193
37358
  } },
37194
- createElement$1("i", { className: "fas fa-arrow-circle-down" }))));
37195
- }
37196
- if (col.key === 'btnDelete') {
37197
- cellStyle.display = 'flex';
37198
- cellStyle['justify-content'] = 'center';
37199
- cellStyle['align-items'] = 'center';
37200
- return (createElement$1("div", { className: 'gn-datagrid-body-cell btn-container ' + (col.key ? col.key : ''), style: cellStyle, "on-click": (e) => {
37201
- this._hidden.stopRowSelectEvent(e);
37202
- } },
37203
- createElement$1("span", { className: "gn-icon is-small is-mono", "on-click": () => {
37204
- !this.$options.disabled && this._hidden.deleteRow.call(this, _index);
37359
+ createElement$1("span", { className: 'gn-icon btn-order ' + (_index == 0 ? 'is-cancel' : 'is-info'), "on-click": () => {
37360
+ !this.$options.disabled && this._hidden.moveRowUp.call(this, _index);
37361
+ } },
37362
+ createElement$1("i", { className: "fas fa-arrow-circle-up" })),
37363
+ createElement$1("span", { className: 'gn-icon btn-order ' + (_index == this.$options.data.length - 1 ? 'is-cancel' : 'is-info'), "on-click": () => {
37364
+ !this.$options.disabled && this._hidden.moveRowDown.call(this, _index);
37365
+ } },
37366
+ createElement$1("i", { className: "fas fa-arrow-circle-down" }))));
37367
+ }
37368
+ if (col.key === 'btnDelete') {
37369
+ cellStyle.display = 'flex';
37370
+ cellStyle['justify-content'] = 'center';
37371
+ cellStyle['align-items'] = 'center';
37372
+ return (createElement$1("div", { className: 'gn-datagrid-body-cell btn-container ' + (col.key ? col.key : '') + (this._isHorizontalState() ? ' is-horizontal' : ''), style: cellStyle, "data-key": col.key, "on-click": (e) => {
37373
+ this._hidden.stopRowSelectEvent(e);
37205
37374
  } },
37206
- createElement$1("i", { className: "fas fa-trash" }))));
37207
- }
37208
- return (createElement$1("div", { className: 'gn-datagrid-body-cell ' +
37209
- (col.bodyClass ? col.bodyClass : col.className ? col.className : '') +
37210
- (isFunction(col.onSelect) ? ' is-selectable' : '') +
37211
- (col.isHidden ? ' is-unvisible' : ''), "data-key": col.key, style: cellStyle, "on-click": (e) => {
37212
- !this.$options.disabled && this._hidden.selectCell.call(this, col, row, _index, e);
37213
- }, "on-mouseenter": (e) => {
37214
- !this.$options.disabled && this._hidden.hoverCell.call(this, col, row, _index, e);
37215
- }, "on-mouseleave": (e) => {
37216
- this._hidden.blurCell.call(this, col, row, _index, e);
37217
- }, title: col.tipField && row[col.tipField] ? row[col.tipField] : !col.template && row[col.key] ? row[col.key] : '' }, this._hidden.renderCell(row, col, idx, hasChild, isCheck, _index)));
37218
- })));
37219
- },
37220
- renderCell: (row, col, idx, hasChild, isCheck, _index) => {
37375
+ createElement$1("span", { className: "gn-icon is-small is-mono", "on-click": () => {
37376
+ !this.$options.disabled && this._hidden.deleteRow.call(this, _index);
37377
+ } },
37378
+ createElement$1("i", { className: "fas fa-trash" }))));
37379
+ }
37380
+ return (createElement$1("div", { className: 'gn-datagrid-body-cell ' +
37381
+ (col.bodyClass ? col.bodyClass : col.className ? col.className : '') +
37382
+ (isFunction(col.onSelect) ? ' is-selectable' : '') +
37383
+ (col.isHidden ? ' is-unvisible' : '') +
37384
+ (this._isHorizontalState() ? ' is-horizontal' : ''), "data-key": col.key, style: cellStyle, "on-click": (e) => {
37385
+ col.onSelect && !this.$options.disabled && this._hidden.selectCell.call(this, col, row, _index, e);
37386
+ }, "on-mouseenter": (e) => {
37387
+ col.onHover && !this.$options.disabled && this._hidden.hoverCell.call(this, col, row, _index, e);
37388
+ }, "on-mouseleave": (e) => {
37389
+ col.offHover && this._hidden.blurCell.call(this, col, row, _index, e);
37390
+ }, title: col.tipField && row[col.tipField] ? row[col.tipField] : !col.template && row[col.key] ? row[col.key] : '' }, this._hidden.renderCell(row, col, idx, hasChild, isCheck, _index)));
37391
+ })));
37392
+ },
37393
+ renderHorizontalCellLabel: (col) => {
37394
+ if (this._isSystemAddedColumn(col.key)) {
37395
+ return null;
37396
+ }
37397
+ return createElement$1("span", { className: "gn-datagrid-cell-label" }, col.label);
37398
+ },
37399
+ renderHorizontalCardHeader: (row, index, hasChild, isCheck) => {
37400
+ const hasHeader = this.$options.hasCheck || (this.$options.hasDelete && !this.$options.readonly);
37401
+ const showCheck = this.$options.hasCheck && row.noCheck !== true && row.noCheck !== 'true';
37402
+ const showDelete = this.$options.hasDelete && !this.$options.readonly;
37403
+ if (!hasHeader) {
37404
+ return null;
37405
+ }
37406
+ return (createElement$1("div", { className: "gn-datagrid-card-header" },
37407
+ createElement$1("div", { className: "gn-datagrid-card-header-left" }, showCheck && (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
37408
+ createElement$1("input", { type: "checkbox", id: this._uid + '-row-check-' + index, className: "is-rowChecker", "on-click": (e) => {
37409
+ this._hidden.check.call(this, row, e);
37410
+ }, defaultChecked: isCheck, disabled: this.$options.disabled || row.disabled })))),
37411
+ createElement$1("div", { className: "gn-datagrid-card-header-right" }, showDelete && (createElement$1("span", { className: "gn-icon is-small is-mono", "on-click": (e) => {
37412
+ this._hidden.stopRowSelectEvent(e);
37413
+ !this.$options.disabled && this._hidden.deleteRow.call(this, index);
37414
+ } },
37415
+ createElement$1("i", { className: "fas fa-trash" }))))));
37416
+ },
37417
+ renderCellValue: (row, col, idx, hasChild, isCheck, _index) => {
37221
37418
  return [
37222
- idx === 0 && hasChild ? (createElement$1("span", { className: "is-toggler", "on-click": (e) => {
37419
+ idx === 0 && hasChild && !this._isHorizontalState() ? (createElement$1("span", { className: "is-toggler", "on-click": (e) => {
37223
37420
  !this.$options.disabled && this._hidden.toggle.call(this, row, e);
37224
37421
  } })) : (''),
37225
- idx === 0 && this.$options.hasCheck && row.noCheck !== true && row.noCheck !== 'true' ? (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
37422
+ idx === 0 && this.$options.hasCheck && row.noCheck !== true && row.noCheck !== 'true' && !this._isHorizontalState() ? (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
37226
37423
  createElement$1("input", { type: "checkbox", id: this._uid + '-row-check-' + _index, className: "is-rowChecker", "on-click": (e) => {
37227
37424
  this._hidden.check.call(this, row, e);
37228
37425
  }, defaultChecked: isCheck, disabled: this.$options.disabled || row.disabled }))) : (''),
37229
37426
  col.template ? createElement$1("span", { className: "gn-datagrid-cell", innerHTML: col.template(col.key, row, col) }) : row[col.key] !== undefined ? row[col.key] : ''
37230
37427
  ];
37231
37428
  },
37429
+ renderCell: (row, col, idx, hasChild, isCheck, _index) => {
37430
+ if (this._isHorizontalState()) {
37431
+ return [this._hidden.renderHorizontalCellLabel(col), createElement$1("div", { className: "gn-datagrid-cell-value" }, this._hidden.renderCellValue(row, col, idx, hasChild, isCheck, _index))];
37432
+ }
37433
+ return this._hidden.renderCellValue(row, col, idx, hasChild, isCheck, _index);
37434
+ },
37232
37435
  renderNodata: () => {
37233
37436
  return (createElement$1("div", { className: "gn-datagrid-body-row is-nodata" },
37234
37437
  createElement$1("div", { className: "gn-datagrid-body-cell has-text-center" }, this.$options.textSets.noData)));
@@ -37314,7 +37517,10 @@
37314
37517
  });
37315
37518
  this.$event(this, 'onCheckAll', e.target.checked);
37316
37519
  },
37317
- showDetail(index, headerKeys, rawDataKeys) {
37520
+ showDetail: (index, headerKeys, rawDataKeys) => {
37521
+ if (this._isHorizontalState()) {
37522
+ return;
37523
+ }
37318
37524
  const rows = findAll(`.gn-datagrid-body > .gn-datagrid-body-row`, this.$el);
37319
37525
  const row = rows[+index];
37320
37526
  if (next(row) && hasClass(next(row), 'gn-datagrid-body-row-detail')) {
@@ -37401,6 +37607,7 @@
37401
37607
  },
37402
37608
  reRender: ({ headers, data, hasCheck }) => {
37403
37609
  return new Promise(resolve => {
37610
+ this._refreshOrientationState(this.$options);
37404
37611
  if (hasCheck === undefined) {
37405
37612
  hasCheck = this.$options.hasCheck;
37406
37613
  }
@@ -37609,8 +37816,8 @@
37609
37816
  visibles.forEach((visible, index) => {
37610
37817
  const colNumber = index + 1;
37611
37818
  !visible
37612
- ? addClass(findAll('.gn-datagrid-body-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible')
37613
- : removeClass(findAll('.gn-datagrid-body-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible');
37819
+ ? addClass(findAll(`.gn-datagrid-body-cell[data-key="${this.$options.headers[index].key}"]`, this.$el), 'is-unvisible')
37820
+ : removeClass(findAll(`.gn-datagrid-body-cell[data-key="${this.$options.headers[index].key}"]`, this.$el), 'is-unvisible');
37614
37821
  !visible
37615
37822
  ? addClass(findAll('.gn-datagrid-header-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible')
37616
37823
  : removeClass(findAll('.gn-datagrid-header-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible');
@@ -37655,6 +37862,13 @@
37655
37862
  removeClass(this.$el, 'is-disabled');
37656
37863
  }
37657
37864
  };
37865
+ this._orientationState = {
37866
+ orientation: 'vertical',
37867
+ columns: 1,
37868
+ gap: 0,
37869
+ minWidth: 240,
37870
+ hasGap: false
37871
+ };
37658
37872
  this.config = {
37659
37873
  width: '100%',
37660
37874
  hasCheck: false,
@@ -37669,6 +37883,7 @@
37669
37883
  deleteLabel: '',
37670
37884
  deleteConfirmMessage: ''
37671
37885
  },
37886
+ orientation: 'vertical',
37672
37887
  childField: 'child',
37673
37888
  checkCapturing: true,
37674
37889
  sort: {
@@ -37689,10 +37904,10 @@
37689
37904
  onDelete: true
37690
37905
  };
37691
37906
  this.methods = {
37692
- reRender(options) {
37907
+ reRender: (options) => {
37693
37908
  return this._hidden.reRender(options);
37694
37909
  },
37695
- resetData(data) {
37910
+ resetData: (data) => {
37696
37911
  if (isFunction(data)) {
37697
37912
  this.$options.asyncData = data;
37698
37913
  data = [];
@@ -37701,45 +37916,60 @@
37701
37916
  }
37702
37917
  return this._hidden.resetData(arrClone(data));
37703
37918
  },
37704
- addChild(index, data) {
37919
+ addChild: (index, data) => {
37920
+ if (this._isHorizontalState()) {
37921
+ return;
37922
+ }
37705
37923
  this._hidden.addChild(index, arrClone(data));
37706
37924
  },
37707
- addRow(data) {
37925
+ addRow: (data) => {
37926
+ if (this._isHorizontalState()) {
37927
+ return;
37928
+ }
37708
37929
  this._hidden.addChild(null, arrClone(data));
37709
37930
  this.$options.data = this.$options.data.concat(data);
37710
37931
  },
37711
- expand(index) {
37932
+ expand: (index) => {
37933
+ if (this._isHorizontalState()) {
37934
+ return;
37935
+ }
37712
37936
  this._hidden.expand(index);
37713
37937
  },
37714
- collapse(index) {
37938
+ collapse: (index) => {
37939
+ if (this._isHorizontalState()) {
37940
+ return;
37941
+ }
37715
37942
  this._hidden.collapse(index);
37716
37943
  },
37717
- getChecked() {
37944
+ getChecked: () => {
37718
37945
  return this._hidden.getChecked();
37719
37946
  },
37720
- hideCols(keys) {
37947
+ hideCols: (keys) => {
37721
37948
  this._hidden.hideCols(keys);
37722
37949
  },
37723
- showCols(keys) {
37950
+ showCols: (keys) => {
37724
37951
  this._hidden.showCols(keys);
37725
37952
  },
37726
- showAll() {
37953
+ showAll: () => {
37727
37954
  this._hidden.showAll();
37728
37955
  },
37729
- showDetail(index, headerKeys, rawDataKeys) {
37956
+ showDetail: (index, headerKeys, rawDataKeys) => {
37957
+ if (this._isHorizontalState()) {
37958
+ return;
37959
+ }
37730
37960
  this._hidden.showDetail.call(this, index, headerKeys, rawDataKeys);
37731
37961
  },
37732
- selectRow(index, rowData) {
37962
+ selectRow: (index, rowData) => {
37733
37963
  let row = rowData;
37734
37964
  if (!row) {
37735
37965
  row = this.$options.data[index];
37736
37966
  }
37737
37967
  !this.$options.disable && this._hidden.selectRow(row, index);
37738
37968
  },
37739
- disable() {
37969
+ disable: () => {
37740
37970
  this._hidden.disable();
37741
37971
  },
37742
- enable() {
37972
+ enable: () => {
37743
37973
  this._hidden.enable();
37744
37974
  }
37745
37975
  };
@@ -37792,6 +38022,34 @@
37792
38022
  });
37793
38023
  }
37794
38024
  }
38025
+ // 렌더에서 바로 쓸 수 있는 orientation 상태를 만든다.
38026
+ _resolveOrientationState(config = this.$options) {
38027
+ var _a, _b, _c, _d, _e;
38028
+ const orientation = (config === null || config === void 0 ? void 0 : config.orientation) === 'horizontal' ? 'horizontal' : 'vertical';
38029
+ const optionColumns = (_a = config === null || config === void 0 ? void 0 : config.orientationOptions) === null || _a === void 0 ? void 0 : _a.columns;
38030
+ const columns = optionColumns === 'auto-fit' ? optionColumns : Number.isInteger(Number(optionColumns)) && Number(optionColumns) > 0 ? Number(optionColumns) : 1;
38031
+ const optionGap = (_c = (_b = config === null || config === void 0 ? void 0 : config.orientationOptions) === null || _b === void 0 ? void 0 : _b.gap) !== null && _c !== void 0 ? _c : 0;
38032
+ const isZeroLikeGap = optionGap === 0 || optionGap === '0' || optionGap === '0px' || optionGap === '';
38033
+ const gap = columns === 'auto-fit' && isZeroLikeGap ? '5px' : isZeroLikeGap ? 0 : typeof optionGap === 'number' ? optionGap + 'px' : optionGap;
38034
+ const rawMinWidth = (_e = (_d = config.orientationOptions) === null || _d === void 0 ? void 0 : _d.minWidth) !== null && _e !== void 0 ? _e : 240;
38035
+ const minWidth = typeof rawMinWidth === 'number' ? rawMinWidth + 'px' : rawMinWidth;
38036
+ return {
38037
+ orientation,
38038
+ columns,
38039
+ gap,
38040
+ minWidth,
38041
+ hasGap: gap !== 0
38042
+ };
38043
+ }
38044
+ // 실제 옵션이 갱신될 때 내부 orientation 상태를 새로 계산한다.
38045
+ _refreshOrientationState(config = this.$options) {
38046
+ this._orientationState = this._resolveOrientationState(config);
38047
+ return this._orientationState;
38048
+ }
38049
+ // 내부 렌더 분기에서는 orientationState만 기준으로 사용한다.
38050
+ _isHorizontalState() {
38051
+ return this._orientationState.orientation === 'horizontal';
38052
+ }
37795
38053
  _isSystemAddedColumn(key) {
37796
38054
  return ['btnOrder', 'btnDelete'].includes(key);
37797
38055
  }
@@ -37799,6 +38057,10 @@
37799
38057
  _prepareHeaders(headers = []) {
37800
38058
  const hasOrderColumn = headers.some((header) => header.key === 'btnOrder');
37801
38059
  const hasDeleteColumn = headers.some((header) => header.key === 'btnDelete');
38060
+ const horizontal = this._isHorizontalState();
38061
+ if (horizontal) {
38062
+ headers = headers.map((header) => (Object.assign(Object.assign({}, header), { sortable: false, draggable: false })));
38063
+ }
37802
38064
  if (this.$options.hasOrder && !this.$options.readonly && !hasOrderColumn) {
37803
38065
  headers.push({
37804
38066
  label: this.$options.textSets.orderLabel,
@@ -37808,7 +38070,7 @@
37808
38070
  }
37809
38071
  });
37810
38072
  }
37811
- if (this.$options.hasDelete && !this.$options.readonly && !hasDeleteColumn) {
38073
+ if (this.$options.hasDelete && !this.$options.readonly && !hasDeleteColumn && !horizontal) {
37812
38074
  headers.push({
37813
38075
  label: this.$options.textSets.deleteLabel,
37814
38076
  key: 'btnDelete',
@@ -37821,9 +38083,14 @@
37821
38083
  return headers;
37822
38084
  }
37823
38085
  template(config) {
38086
+ const resolvedConfig = Object.assign(Object.assign({}, this.$options), config);
38087
+ this._refreshOrientationState(resolvedConfig);
38088
+ const contentsMarginTop = this.$options.bodyTopMargin ? this.$options.bodyTopMargin : this._isHorizontalState() && this._orientationState.hasGap ? String(this._orientationState.gap) : '0';
37824
38089
  const styles = {};
37825
38090
  const headers = this._prepareHeaders(config.headers);
37826
38091
  return (createElement$1("div", { id: this._uid, className: 'gn-datagrid' +
38092
+ (this._isHorizontalState() ? ' is-horizontal' : '') +
38093
+ (this._isHorizontalState() && this._orientationState.hasGap ? ' has-horizontal-gap' : '') +
37827
38094
  (config.style ? ' is-' + config.style : '') +
37828
38095
  (config.isEllipsis ? ' is-ellipsis' : '') +
37829
38096
  (config.bodyHeight ? ' has-fixed-body' : '') +
@@ -37833,7 +38100,7 @@
37833
38100
  (config.data.some((d) => isArray$1(d[this.$options.childField])) ? ' has-left-padding' : '') +
37834
38101
  (config.disabled ? ' is-disabled' : ''), style: styles },
37835
38102
  config.hasHeader && createElement$1("div", { className: "gn-datagrid-header" }, this._hidden.renderHeader(headers)),
37836
- createElement$1("div", { className: "gn-datagrid-contents", style: { marginTop: this.$options.bodyTopMargin ? this.$options.bodyTopMargin : '0', marginBottom: this.$options.bodyBottomMargin ? this.$options.bodyBottomMargin : '0' } }, this._hidden.renderBody(arrClone(config.data), headers)),
38103
+ createElement$1("div", { className: "gn-datagrid-contents", style: { marginTop: contentsMarginTop, marginBottom: this.$options.bodyBottomMargin ? this.$options.bodyBottomMargin : '0' } }, this._hidden.renderBody(arrClone(config.data), headers)),
37837
38104
  config.paginator /* 페이지네이터 옵션 확인 */ && createElement$1("div", { className: "gn-datagrid-footer" })));
37838
38105
  }
37839
38106
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -37850,7 +38117,12 @@
37850
38117
  }
37851
38118
  }
37852
38119
  completed() {
37853
- if (this.$options.fixHeader && this.$options.hasHeader) {
38120
+ const isHorizontal = this._isHorizontalState();
38121
+ const isVertical = !isHorizontal;
38122
+ const usesFixedHeader = this.$options.fixHeader && this.$options.hasHeader;
38123
+ const needsBlankHeader = usesFixedHeader || this.$options.bodyHeight;
38124
+ isHorizontal ? addClass(this.$el, 'is-horizontal') : removeClass(this.$el, 'is-horizontal');
38125
+ if (usesFixedHeader && isVertical) {
37854
38126
  const body = find('.gn-datagrid-contents', this.$el);
37855
38127
  const header = find('.gn-datagrid-header', this.$el);
37856
38128
  if (header) {
@@ -37863,7 +38135,7 @@
37863
38135
  css$1(body, 'margin-bottom', this.$options.bodyBottomMargin);
37864
38136
  }
37865
38137
  }
37866
- if ((this.$options.fixHeader && this.$options.hasHeader) || this.$options.bodyHeight) {
38138
+ if (isVertical && needsBlankHeader) {
37867
38139
  this._hidden.setBlankHeader();
37868
38140
  on(window, 'resize', this._hidden.setBlankHeader);
37869
38141
  }
@@ -37899,7 +38171,7 @@
37899
38171
  color: (this.$options.readonly ? 'info' : 'cancel')
37900
38172
  };
37901
38173
  return (createElement$1("div", { "on-dblclick": (e) => {
37902
- this._hidden.doubleSelect.call(this, row, _index, e);
38174
+ this.$options.onDoubleClick && this._hidden.doubleSelect.call(this, row, _index, e);
37903
38175
  }, id: this._uid + '-row-' + _index, className: 'gn-datalist-body-row' + (hasChild ? ' has-child' : '') + (row.isOpened ? '' : ' is-collapsed') + (row.isSelectedRow ? ' is-active' : '') + (depth > 0 && !isOpened ? ' is-hidden' : ''), "data-depth": depth, style: { cursor: this.$options.onSelect ? 'pointer' : 'default' } },
37904
38176
  createElement$1("ol", { className: 'gn-datalist-ol-container' }, columns.map((col, idx) => {
37905
38177
  const cellStyle = {};
@@ -37928,9 +38200,9 @@
37928
38200
  (col.bodyClass ? col.bodyClass : col.className ? col.className : '') +
37929
38201
  (isFunction(col.onSelect) ? ' is-selectable' : '') +
37930
38202
  (col.isHidden ? ' is-unvisible' : ''), style: cellStyle, "on-mouseenter": (e) => {
37931
- this._hidden.hoverCell.call(this, col, row, _index, e);
38203
+ col.onHover && this._hidden.hoverCell.call(this, col, row, _index, e);
37932
38204
  }, "on-mouseleave": (e) => {
37933
- this._hidden.blurCell.call(this, col, row, _index, e);
38205
+ col.offHover && this._hidden.blurCell.call(this, col, row, _index, e);
37934
38206
  }, title: !col.template && row[col.key] ? row[col.key] : '' }, this._hidden.renderCell(row, col, idx, hasChild)))));
37935
38207
  })),
37936
38208
  createElement$1("div", { id: this._uid + '-btn-' + index, className: "gn-datalist-btn-container" },
@@ -38341,6 +38613,10 @@
38341
38613
  focus: () => {
38342
38614
  const modal = find('.modal-content', this.$el);
38343
38615
  modal.focus();
38616
+ },
38617
+ extra: (actionKey) => {
38618
+ // notify page about which extra button clicked
38619
+ this.$event(this, 'onExtra', actionKey);
38344
38620
  }
38345
38621
  };
38346
38622
  this.config = {
@@ -38358,6 +38634,7 @@
38358
38634
  hasClose: true,
38359
38635
  hasConfirm: false,
38360
38636
  hasCancel: false,
38637
+ extraButtons: [],
38361
38638
  isModal: true,
38362
38639
  minimized: false,
38363
38640
  resizable: false,
@@ -38368,7 +38645,8 @@
38368
38645
  this.events = {
38369
38646
  onClose: true,
38370
38647
  onConfirm: true,
38371
- onOpen: true
38648
+ onOpen: true,
38649
+ onExtra: true
38372
38650
  };
38373
38651
  this.methods = {
38374
38652
  close() {
@@ -38410,7 +38688,10 @@
38410
38688
  createElement$1("i", { className: "fas fa-times" })))))),
38411
38689
  createElement$1("div", { className: "modal-body", style: styles },
38412
38690
  createElement$1("div", { className: "modal-body-content", style: contStyles })),
38413
- (config.hasConfirm || config.hasCancel) /* 확인/취소 옵션 확인 */ && (createElement$1("div", { className: "modal-footer has-text-center" },
38691
+ (config.hasConfirm || config.hasCancel || (Array.isArray(config.extraButtons) && config.extraButtons.length > 0)) /* 확인/취소/추가버튼 옵션 확인 */ && (createElement$1("div", { className: "modal-footer has-text-center" },
38692
+ Array.isArray(config.extraButtons) &&
38693
+ config.extraButtons.length > 0 &&
38694
+ config.extraButtons.map((btn) => (createElement$1("button", { type: "button", className: 'gn-button ' + (btn.className ? btn.className : 'is-mono'), "on-click": this._hidden.extra.bind(this, btn.key || btn.label) }, btn.label || btn.key))),
38414
38695
  config.hasConfirm && (createElement$1("button", { type: "button", className: 'gn-button' + ` is-${config.sizeSets.confirm}`, id: this._uid + '_confirm', "on-click": this._hidden.confirm }, config.textSets.confirm)),
38415
38696
  config.hasCancel && (createElement$1("button", { type: "button", className: 'gn-button btnCloseModal is-cancel' + ` is-${config.sizeSets.cancel}`, id: this._uid + '_cancel', "on-click": this._hidden.close }, config.textSets.cancel)))))));
38416
38697
  }
@@ -39205,6 +39486,7 @@
39205
39486
 
39206
39487
  class MenuButton extends GNCoreInstance {
39207
39488
  constructor(name, selector, options = {}) {
39489
+ var _a, _b, _c, _d;
39208
39490
  super(name, selector, options);
39209
39491
  this._hidden = {
39210
39492
  open: () => {
@@ -39216,7 +39498,9 @@
39216
39498
  removeClass(this.$el, 'is-open');
39217
39499
  },
39218
39500
  select: (menu, e) => {
39219
- this.$event(this, 'onSelect', menu.value, menu.text, menu, e);
39501
+ // cols만 있고 text 없는 경우 cols[0]을 text로 사용 (호환성 유지)
39502
+ const menuText = menu.text || (isArray$1(menu === null || menu === void 0 ? void 0 : menu.cols) ? menu.cols[0] : menu.value || '');
39503
+ this.$event(this, 'onSelect', menu.value, menuText, menu, e);
39220
39504
  this._hidden.close();
39221
39505
  },
39222
39506
  changeText: (buttonText) => {
@@ -39251,12 +39535,16 @@
39251
39535
  // 부모 경로를 포함한 고유한 ID 생성
39252
39536
  const currentPath = parentPath ? `${parentPath}-${index}` : `${index}`;
39253
39537
  const uniqueId = `${this._uid}-${currentPath}`;
39538
+ const hasColsData = isArray$1(menu === null || menu === void 0 ? void 0 : menu.cols);
39539
+ const renderAsCols = !hasHtml && hasColsData;
39540
+ const canSelect = !hasHtml || !!menu.text;
39254
39541
  return (createElement$1("li", { id: uniqueId, className: 'menuButton-menu' +
39255
39542
  (this.$options.align ? ' has-text-' + this.$options.align : '') +
39256
39543
  (canRenderChild ? ' has-submenu' : '') +
39257
39544
  (depth > 0 ? ' is-submenu-item' : '') +
39258
39545
  (isDisabled ? ' is-disabled' : '') +
39259
- (isActived ? ' is-actived' : ''), "on-click": (e) => {
39546
+ (isActived ? ' is-actived' : '') +
39547
+ (renderAsCols ? ' has-cols' : ''), "on-click": (e) => {
39260
39548
  // disabled 상태이거나 자식 메뉴가 있는 경우 클릭 이벤트 처리하지 않음
39261
39549
  if (isDisabled) {
39262
39550
  e.stopPropagation();
@@ -39265,12 +39553,16 @@
39265
39553
  }
39266
39554
  // 자식 메뉴가 없는 경우에만 select 이벤트 발생
39267
39555
  if (!canRenderChild) {
39556
+ if (!canSelect) {
39557
+ e.stopPropagation();
39558
+ return;
39559
+ }
39268
39560
  e.stopPropagation();
39269
39561
  this._hidden.select.call(this, menu, e);
39270
39562
  }
39271
39563
  }, innerHTML: hasHtml ? menu.html : '' },
39272
- hasHtml ? ('') : (createElement$1("span", { className: "menuButton-menu-content" },
39273
- createElement$1("span", { className: "menuButton-menu-text" }, menu.text),
39564
+ hasHtml ? ('') : renderAsCols ? (createElement$1("div", { className: "menubutton-cols" }, menu.cols.map((col, colIndex) => (createElement$1("span", { key: colIndex, className: "menubutton-col" }, escapeEntity(col)))))) : (createElement$1("span", { className: "menuButton-menu-content" },
39565
+ createElement$1("span", { className: "menuButton-menu-text" }, menu.text || menu.value || ''),
39274
39566
  canRenderChild && (createElement$1("span", { className: "menuButton-menu-arrow" },
39275
39567
  createElement$1("i", { className: "fas fa-caret-right" }))))),
39276
39568
  canRenderChild && this._hidden.renderMenus.call(this, menu.child, depth + 1, currentPath)));
@@ -39282,9 +39574,11 @@
39282
39574
  };
39283
39575
  this.config = {
39284
39576
  textSets: {
39285
- buttonText: this.$selector.textContent
39577
+ buttonText: ((_a = this.$selector) === null || _a === void 0 ? void 0 : _a.cols)
39578
+ ? (isArray$1(this.$selector.cols) ? this.$selector.cols.join(', ') : String(this.$selector.cols))
39579
+ : (((_b = this.$selector) === null || _b === void 0 ? void 0 : _b.textContent) || ((_c = this.$selector) === null || _c === void 0 ? void 0 : _c.text) || '')
39286
39580
  },
39287
- name: this.$selector.name,
39581
+ name: (_d = this.$selector) === null || _d === void 0 ? void 0 : _d.name,
39288
39582
  data: [],
39289
39583
  align: 'left'
39290
39584
  };
@@ -39436,15 +39730,124 @@
39436
39730
  }
39437
39731
 
39438
39732
  class MultiTextArea extends GNCoreInstance {
39733
+ _isMaxLengthMessageEnabled() {
39734
+ return !!(this.$options.maxlength && this.$options.useMaxLengthMessage);
39735
+ }
39736
+ _getTotalLength(valueSet) {
39737
+ return this.$options.lang.reduce((sum, currentLang) => {
39738
+ const currentValue = valueSet[currentLang] || '';
39739
+ return sum + currentValue.length;
39740
+ }, 0);
39741
+ }
39742
+ _getTotalLengthWithoutLang(valueSet, excludeLang) {
39743
+ return this.$options.lang.reduce((sum, currentLang) => {
39744
+ if (currentLang === excludeLang) {
39745
+ return sum;
39746
+ }
39747
+ const currentValue = valueSet[currentLang] || '';
39748
+ return sum + currentValue.length;
39749
+ }, 0);
39750
+ }
39751
+ _getRemainMessage(remain) {
39752
+ var _a, _b;
39753
+ const template = ((_b = (_a = this.$options) === null || _a === void 0 ? void 0 : _a.textSets) === null || _b === void 0 ? void 0 : _b.maxLengthMessage) || '{{maxlength}}자 입력 가능합니다.';
39754
+ return template.replace(/\{\{\s*maxlength\s*\}\}/g, String(remain));
39755
+ }
39439
39756
  constructor(name, selector, options = {}) {
39440
39757
  super(name, selector, options);
39441
39758
  this._hidden = {
39759
+ beforeInput: (e) => {
39760
+ var _a, _b;
39761
+ if (!this.$options.maxlength || !this._isMaxLengthMessageEnabled()) {
39762
+ return;
39763
+ }
39764
+ const target = e.target;
39765
+ const lang = data(target, 'data-lang');
39766
+ if (!lang) {
39767
+ return;
39768
+ }
39769
+ if (e.inputType && e.inputType.startsWith('delete')) {
39770
+ return;
39771
+ }
39772
+ const currentValue = val(target) || '';
39773
+ const selectionStart = typeof target.selectionStart === 'number' ? target.selectionStart : currentValue.length;
39774
+ const selectionEnd = typeof target.selectionEnd === 'number' ? target.selectionEnd : currentValue.length;
39775
+ const selectedLength = Math.max(0, selectionEnd - selectionStart);
39776
+ let insertValue = e.data || '';
39777
+ if (e.inputType === 'insertLineBreak' || e.inputType === 'insertParagraph') {
39778
+ insertValue = '\n';
39779
+ }
39780
+ if (e.inputType === 'insertFromPaste' && !insertValue) {
39781
+ const pastedText = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData) === null || _b === void 0 ? void 0 : _b.call(_a, 'text/plain');
39782
+ insertValue = typeof pastedText === 'string' ? pastedText : '';
39783
+ }
39784
+ // 현재 언어를 제외한 나머지 언어들의 총 입력 길이를 기준으로 남은 입력 가능 길이를 계산한다.
39785
+ const totalLengthWithoutCurrent = this._getTotalLengthWithoutLang(this.$options.value, lang);
39786
+ const allowedLengthForCurrent = Math.max(0, this.$options.maxlength - totalLengthWithoutCurrent);
39787
+ const remainingForInsert = this.$options.maxlength - totalLengthWithoutCurrent - (currentValue.length - selectedLength);
39788
+ // paste는 "붙여넣기 내용 우선 반영 + 전체 결과의 뒤를 자르기" 정책을 적용한다.
39789
+ if (e.inputType === 'insertFromPaste') {
39790
+ if (remainingForInsert <= 0) {
39791
+ e.preventDefault();
39792
+ return;
39793
+ }
39794
+ const before = currentValue.slice(0, selectionStart);
39795
+ const after = currentValue.slice(selectionEnd);
39796
+ const nextValue = `${before}${insertValue}${after}`;
39797
+ if (nextValue.length <= allowedLengthForCurrent) {
39798
+ return;
39799
+ }
39800
+ e.preventDefault();
39801
+ const clamped = nextValue.slice(0, allowedLengthForCurrent);
39802
+ val(target, clamped);
39803
+ const nextCaret = Math.min((before + insertValue).length, clamped.length);
39804
+ target.setSelectionRange(nextCaret, nextCaret);
39805
+ trigger(target, 'input');
39806
+ return;
39807
+ }
39808
+ if (remainingForInsert >= insertValue.length) {
39809
+ return;
39810
+ }
39811
+ if (remainingForInsert <= 0) {
39812
+ e.preventDefault();
39813
+ return;
39814
+ }
39815
+ // 붙여넣기/다중 입력이 한도를 넘는 경우 허용 가능한 길이만 잘라서 반영한다.
39816
+ e.preventDefault();
39817
+ const partial = insertValue.slice(0, remainingForInsert);
39818
+ target.setRangeText(partial, selectionStart, selectionEnd, 'end');
39819
+ trigger(target, 'input');
39820
+ },
39442
39821
  change: (e) => {
39443
39822
  const target = e.target;
39444
39823
  const lang = data(target, 'data-lang');
39445
- this.$options.value[lang] = val(target);
39446
- if (this.$options.maxlength) {
39447
- text$1(this.$options.delegates[lang], this.$options.value[lang].length);
39824
+ if (!lang) {
39825
+ return;
39826
+ }
39827
+ this.$options.value[lang] = val(target) || '';
39828
+ if (this.$options.maxlength && this._isMaxLengthMessageEnabled()) {
39829
+ // 총합 maxlength를 넘지 않도록 현재 언어 값만 상한선까지 보정한다.
39830
+ const totalLengthWithoutCurrent = this._getTotalLengthWithoutLang(this.$options.value, lang);
39831
+ const allowedLength = Math.max(0, this.$options.maxlength - totalLengthWithoutCurrent);
39832
+ const clampedValue = this.$options.value[lang].slice(0, allowedLength);
39833
+ if (clampedValue !== this.$options.value[lang]) {
39834
+ this.$options.value[lang] = clampedValue;
39835
+ val(target, clampedValue);
39836
+ }
39837
+ }
39838
+ if (this.$options.maxlength && this.$options.delegates[lang]) {
39839
+ const hasMaxLengthMessage = this._isMaxLengthMessageEnabled();
39840
+ if (hasMaxLengthMessage) {
39841
+ // 메시지 모드에서는 모든 탭에 동일한 "남은 글자 수" 안내를 동기화한다.
39842
+ const totalLength = this._getTotalLength(this.$options.value);
39843
+ const textValue = this._getRemainMessage(this.$options.maxlength - totalLength);
39844
+ this.$options.lang.forEach((targetLang) => {
39845
+ text$1(this.$options.delegates[targetLang], textValue);
39846
+ });
39847
+ }
39848
+ else {
39849
+ text$1(this.$options.delegates[lang], this.$options.value[lang].length);
39850
+ }
39448
39851
  }
39449
39852
  this.$event(this, 'onChange', this.$options.value);
39450
39853
  },
@@ -39461,7 +39864,7 @@
39461
39864
  }
39462
39865
  const textInput = find(`[data-lang=${lang}]`, this.$el);
39463
39866
  val(textInput, value[lang]);
39464
- trigger(textInput, 'keyup');
39867
+ trigger(textInput, 'input');
39465
39868
  });
39466
39869
  },
39467
39870
  disable: () => {
@@ -39480,6 +39883,10 @@
39480
39883
  this.config = {
39481
39884
  lang: ['en', 'ko'],
39482
39885
  value: {},
39886
+ useMaxLengthMessage: false,
39887
+ textSets: {
39888
+ maxLengthMessage: '{{maxlength}}자 입력 가능합니다.'
39889
+ },
39483
39890
  delegates: {}
39484
39891
  };
39485
39892
  this.events = {
@@ -39504,6 +39911,12 @@
39504
39911
  }
39505
39912
  template(config) {
39506
39913
  const styles = {};
39914
+ const totalLength = config.lang.reduce((sum, currentLang) => {
39915
+ const currentValue = config.value && config.value[currentLang] ? config.value[currentLang] : '';
39916
+ return sum + currentValue.length;
39917
+ }, 0);
39918
+ const hasMaxLengthMessage = this._isMaxLengthMessageEnabled();
39919
+ const remainMessage = config.maxlength ? this._getRemainMessage(config.maxlength - totalLength) : '';
39507
39920
  if (config.width) {
39508
39921
  styles.width = getUnit('width', config.width);
39509
39922
  }
@@ -39512,11 +39925,14 @@
39512
39925
  createElement$1("ul", null, config.lang.map((l, index) => (createElement$1("li", { className: index === 0 ? 'is-active' : '' },
39513
39926
  createElement$1("a", { href: '#' + this._uid + '-' + l }, l)))))),
39514
39927
  createElement$1("div", { id: this._uid + '_content' }, config.lang.map((l) => (createElement$1("div", { id: this._uid + '-' + l },
39515
- createElement$1("textarea", { className: "gn-textarea", "data-lang": l, rows: config.rows ? config.rows : '', maxLength: config.maxlength ? config.maxlength : 524288, "on-keyup": this._hidden.change, disabled: config.disabled, readOnly: config.readonly }, config.value ? config.value[l] : ''),
39516
- config.maxlength && (createElement$1("p", { className: "has-text-right has-text-size6" },
39517
- createElement$1("span", { className: "charLen", "data-lang": l }, config.value && config.value[l] ? config.value[l].length : 0),
39518
- "/",
39519
- config.maxlength))))))));
39928
+ createElement$1("textarea", { className: "gn-textarea", "data-lang": l, rows: config.rows ? config.rows : '', maxLength: config.maxlength ? config.maxlength : 524288, "on-beforeinput": this._hidden.beforeInput, "on-input": this._hidden.change, disabled: config.disabled, readOnly: config.readonly }, config.value ? config.value[l] : ''),
39929
+ config.maxlength && (createElement$1("div", { className: "has-text-size6" },
39930
+ !hasMaxLengthMessage && (createElement$1("p", null,
39931
+ createElement$1("span", { className: "charLen", "data-lang": l }, config.value && config.value[l] ? config.value[l].length : 0),
39932
+ "/",
39933
+ config.maxlength)),
39934
+ hasMaxLengthMessage && (createElement$1("p", null,
39935
+ createElement$1("span", { className: "charLen", "data-lang": l }, remainMessage)))))))))));
39520
39936
  }
39521
39937
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
39522
39938
  $render(config) {
@@ -39562,9 +39978,27 @@
39562
39978
  return;
39563
39979
  }
39564
39980
  findAll(`.picklist-${obj} .dropdown-item`, this.$el).forEach((option) => {
39565
- if (!includes(data(option, 'value').toUpperCase(), q.toUpperCase()) && !includes(text$1(find('.dropdown-text', option)).toUpperCase(), q.toUpperCase())) {
39981
+ const itemValue = data(option, 'value');
39982
+ const rowData = this.$options.data[obj].find((item) => item.value === itemValue);
39983
+ let match = false;
39984
+ // Implements [US-Rev-023] 다중 컬럼 모드: cols 배열의 값들을 검색
39985
+ if (isArray$1(rowData === null || rowData === void 0 ? void 0 : rowData.cols)) {
39986
+ match = rowData.cols.some((colValue) => {
39987
+ return includes(String(colValue).toUpperCase(), q.toUpperCase());
39988
+ });
39989
+ // value 필드도 검색 대상에 포함
39990
+ if (!match && rowData.value) {
39991
+ match = includes(String(rowData.value).toUpperCase(), q.toUpperCase());
39992
+ }
39993
+ }
39994
+ else {
39995
+ // 단일 컬럼 모드: text 또는 value 필드 검색
39996
+ const textValue = text$1(find('.dropdown-text', option));
39997
+ match = includes(data(option, 'value').toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
39998
+ }
39999
+ if (!match) {
39566
40000
  css$1(option, 'display', 'none');
39567
- this.$options.data[`filtered-${obj}`] = this.$options.data[`filtered-${obj}`].filter((e) => e.value !== option.dataset.value);
40001
+ this.$options.data[`filtered-${obj}`] = this.$options.data[`filtered-${obj}`].filter((e) => e.value !== itemValue);
39568
40002
  }
39569
40003
  });
39570
40004
  },
@@ -39673,9 +40107,20 @@
39673
40107
  isArray$1(addArr) &&
39674
40108
  addArr.forEach((option) => {
39675
40109
  const _index = source.findIndex((select) => {
39676
- return option.value === select.value && option.text === select.text;
40110
+ const valueMatch = option.value === select.value;
40111
+ if (isArray$1(option === null || option === void 0 ? void 0 : option.cols)) {
40112
+ if (!isArray$1(select === null || select === void 0 ? void 0 : select.cols) || select.cols.length !== option.cols.length) {
40113
+ return false;
40114
+ }
40115
+ const colsMatch = option.cols.every((col, idx) => col === select.cols[idx]);
40116
+ return valueMatch && colsMatch;
40117
+ }
40118
+ return valueMatch && option.text === select.text;
39677
40119
  });
39678
- target.push(source.splice(_index, 1).pop());
40120
+ // 매칭 실패 시 (_index === -1) 마지막 항목이 제거되는 것을 방지
40121
+ if (_index >= 0) {
40122
+ target.push(source.splice(_index, 1).pop());
40123
+ }
39679
40124
  });
39680
40125
  },
39681
40126
  reRender: (obj) => {
@@ -39685,21 +40130,32 @@
39685
40130
  },
39686
40131
  renderSub: (item) => {
39687
40132
  const items = this.$options.data[item] || [];
39688
- return (createElement$1("ul", null, items.map((option, index) => {
40133
+ const hasColsForList = items.some((item) => !(item === null || item === void 0 ? void 0 : item.html) && isArray$1(item === null || item === void 0 ? void 0 : item.cols));
40134
+ return (createElement$1("ul", { className: hasColsForList ? 'is-cols' : '' }, items.map((option, index) => {
39689
40135
  var _a;
39690
- return (createElement$1("li", { id: this._uid + '_opt_' + index, className: 'dropdown-item' + (option.selected ? ' is-active' : ''), "data-value": option.value, "on-click": !option.text ? null : this._hidden.toggle.bind(this), "on-dblclick": !option.text
40136
+ const hasHtml = !!option.html;
40137
+ const hasColsData = isArray$1(option === null || option === void 0 ? void 0 : option.cols);
40138
+ const renderAsCols = !hasHtml && hasColsData;
40139
+ // html이 있으면 text가 있는 항목만 선택 가능
40140
+ // cols가 있으면 첫 번째 컬럼을 displayText로 사용 (value가 비어도 선택 가능)
40141
+ const displayText = hasHtml
40142
+ ? (option.text || '')
40143
+ : renderAsCols
40144
+ ? (option.cols && option.cols.length ? String(option.cols[0]) : '')
40145
+ : (option.text || option.value);
40146
+ return (createElement$1("li", { key: index, id: this._uid + '_opt_' + index, className: 'dropdown-item' + (renderAsCols ? ' picklist-row' : '') + (option.selected ? ' is-active' : ''), "data-value": option.value, "on-click": !displayText ? null : this._hidden.toggle.bind(this), "on-dblclick": !displayText
39691
40147
  ? null
39692
40148
  : this._hidden.move.bind(this, item === 'source' ? 'add' : 'remove', [
39693
40149
  {
39694
40150
  value: option.value,
39695
- text: option.text,
40151
+ text: renderAsCols ? undefined : option.text,
40152
+ cols: hasColsData ? option.cols : undefined,
39696
40153
  html: (_a = option.html) !== null && _a !== void 0 ? _a : null
39697
40154
  }
39698
- ]) },
39699
- createElement$1("span", { className: "dropdown-text", innerHTML: option.html ? option.html : '' }, option.html ? ('') : option.icon ? (createElement$1("span", null,
39700
- createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
39701
- createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
39702
- escapeEntity(option.text))) : (escapeEntity(option.text)))));
40155
+ ]) }, hasHtml ? (createElement$1("span", { className: "dropdown-text", innerHTML: option.html })) : renderAsCols ? (createElement$1("div", { className: "picklist-cols" }, option.cols.map((col, colIndex) => (createElement$1("span", { key: colIndex, className: "picklist-col" }, escapeEntity(col)))))) : (createElement$1("span", { className: "dropdown-text" }, option.icon ? (createElement$1("span", null,
40156
+ createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
40157
+ createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
40158
+ escapeEntity(option.text || option.value))) : (escapeEntity(option.text || option.value))))));
39703
40159
  })));
39704
40160
  },
39705
40161
  getSelection: (target) => {
@@ -40767,41 +41223,56 @@
40767
41223
  class Tree extends GNCoreInstance {
40768
41224
  constructor(name, selector, options = {}) {
40769
41225
  super(name, selector, options);
41226
+ this._checkerIdSeq = 0;
40770
41227
  this._hidden = {
40771
41228
  select: (item, e) => {
40772
41229
  if (item.disabled) {
40773
41230
  return;
40774
41231
  }
41232
+ if (hasClass(this.$el, 'is-disabled')) {
41233
+ return;
41234
+ }
40775
41235
  let target = e.target;
40776
- // 트리 아이콘을 클릭한 경우, 텍스트로 타겟 변경
40777
41236
  if (this.$options.showIcon && target.tagName === 'I') {
40778
41237
  target = parent(target);
40779
41238
  }
40780
- if (!this.$options.multiple) {
41239
+ if (this.$options.hasCheck) {
41240
+ // hasCheck 시: 노드 클릭으로 체크박스 토글, is-active 미적용
41241
+ const itemEl = hasClass(target, 'tree-item') ? target : parents(target, '.tree-item')[0];
41242
+ if (!itemEl)
41243
+ return;
41244
+ const checker = find('.is-checker', itemEl);
41245
+ if (!checker)
41246
+ return;
41247
+ // 라벨 또는 input 직접 클릭 시 여기서 토글하지 않음 → input 클릭 핸들러만 한 번 실행되게 함 (이중 토글·이중 onCheck 방지)
41248
+ const labelTarget = parents(e.target, 'label')[0];
41249
+ if (e.target === checker || (labelTarget && checker.id && labelTarget.getAttribute('for') === checker.id)) {
41250
+ return;
41251
+ }
41252
+ checker.checked = !checker.checked;
41253
+ this._hidden.check.call(this, item, { target: checker, stopPropagation: () => { } });
41254
+ }
41255
+ else {
41256
+ // hasCheck 미사용 시: 노드 클릭 시 is-active 적용, onSelect 발생
40781
41257
  removeClass(findAll('.tree-item', this.$el), 'is-active');
40782
41258
  addClass(target, 'is-active');
40783
41259
  this.$event(this, 'onSelect', item, e);
40784
41260
  }
40785
- else {
40786
- toggleClass(target, 'is-active');
40787
- if (hasClass(target, 'is-active')) {
40788
- this.$event(this, 'onSelect', item, e);
40789
- }
40790
- }
40791
41261
  },
40792
41262
  addChild: (index, addData) => {
40793
41263
  const itemEl = findAll('.tree-item', this.$el)[index];
40794
41264
  const itemData = this._hidden.findData(index);
41265
+ const nextChildren = this._hidden.setPaths(addData.slice(), itemData.path);
40795
41266
  if (!itemData[this.$options.childField]) {
40796
41267
  itemData[this.$options.childField] = [];
40797
41268
  }
40798
- itemData[this.$options.childField] = itemData[this.$options.childField].concat(addData);
41269
+ itemData[this.$options.childField] = itemData[this.$options.childField].concat(nextChildren);
40799
41270
  const appendTarget = siblings(itemEl, 'ul').pop();
40800
41271
  if (!appendTarget) {
40801
41272
  this.$template.reRender(parent(itemEl), this._hidden.renderItem(itemData));
40802
41273
  }
40803
41274
  else {
40804
- addData.forEach((item) => {
41275
+ nextChildren.forEach((item) => {
40805
41276
  const newItem = document.createElement('li');
40806
41277
  append(appendTarget, newItem);
40807
41278
  this.$template.reRender(newItem, this._hidden.renderItem(item));
@@ -40832,23 +41303,57 @@
40832
41303
  },
40833
41304
  check: (item, e) => {
40834
41305
  const target = e.target;
40835
- e.stopPropagation();
40836
- findAll('.is-checker', parents(target, 'li')[0]).forEach((c) => {
40837
- c.checked = target.checked;
40838
- });
40839
- if (this.$options.checkPath && target.checked) {
40840
- parents(target, 'ul')
40841
- .map((list) => siblings(list, '.tree-item').pop())
40842
- .filter((item) => item)
40843
- .forEach((item) => {
40844
- find('.is-checker', item).checked = true;
40845
- });
41306
+ if (hasClass(this.$el, 'is-disabled') || item.disabled) {
41307
+ if (typeof e.preventDefault === 'function')
41308
+ e.preventDefault();
41309
+ target.checked = !target.checked; // 브라우저가 이미 토글했으므로 원래대로 되돌림
41310
+ return;
40846
41311
  }
41312
+ if (typeof e.stopPropagation === 'function')
41313
+ e.stopPropagation();
41314
+ this._hidden.applyCheckedState(target, target.checked);
40847
41315
  this.$event(this, 'onCheck', item, target.checked, this._hidden.getItemIndex(target), e);
40848
41316
  },
40849
- checkAll: () => {
41317
+ checkAll: (isChecked) => {
41318
+ if (this.$options.disabled) {
41319
+ return;
41320
+ }
40850
41321
  findAll('.is-checker', this.$el).forEach((c) => {
40851
- c.checked = true;
41322
+ if (c.disabled) {
41323
+ return;
41324
+ }
41325
+ c.checked = isChecked;
41326
+ });
41327
+ },
41328
+ setChecked: (targets, checked) => {
41329
+ if (!this.$options.hasCheck || this.$options.disabled) {
41330
+ return;
41331
+ }
41332
+ const normalizedTargets = Array.isArray(targets) ? targets : [targets];
41333
+ const targetSet = new Set(normalizedTargets);
41334
+ findAll('.tree-item', this.$el).forEach((itemEl, index) => {
41335
+ const itemData = this._hidden.findData(index);
41336
+ const itemValue = itemData === null || itemData === void 0 ? void 0 : itemData.value;
41337
+ if (itemValue === undefined || itemValue === null || itemValue === '') {
41338
+ return;
41339
+ }
41340
+ if (!targetSet.has(String(itemValue))) {
41341
+ return;
41342
+ }
41343
+ const checker = find('.is-checker', itemEl);
41344
+ if (!checker) {
41345
+ return;
41346
+ }
41347
+ if (checker.disabled || (itemData === null || itemData === void 0 ? void 0 : itemData.disabled)) {
41348
+ return;
41349
+ }
41350
+ checker.checked = checked;
41351
+ this._hidden.applyCheckedState(checker, checked);
41352
+ });
41353
+ },
41354
+ setCheckersDisabled: (disabled) => {
41355
+ findAll('.is-checker', this.$el).forEach((el) => {
41356
+ el.disabled = disabled;
40852
41357
  });
40853
41358
  },
40854
41359
  getChecked: (withStatus = false) => {
@@ -40874,14 +41379,53 @@
40874
41379
  findData.__status.isOpened = hasClass(target, 'is-open');
40875
41380
  findData.__status.isChecked = find('.is-checker', target).checked;
40876
41381
  findData.__status.isSelected = hasClass(target, 'is-active');
40877
- findData.__status.hasChildren = isArray$1(findData.child);
41382
+ findData.__status.hasChildren = isArray$1(findData[this.$options.childField]);
40878
41383
  }
40879
41384
  return findData;
40880
41385
  });
40881
41386
  },
40882
41387
  getItemIndex: (item) => {
41388
+ const itemEl = hasClass(item, 'tree-item') ? item : parents(item, '.tree-item')[0];
41389
+ if (!itemEl) {
41390
+ return -1;
41391
+ }
40883
41392
  const itemList = findAll('.tree-item', this.$el);
40884
- return itemList.findIndex((el) => el == item);
41393
+ return itemList.findIndex((el) => el == itemEl);
41394
+ },
41395
+ applyCheckedState: (checker, checked) => {
41396
+ const listItem = parents(checker, 'li')[0];
41397
+ if (!listItem) {
41398
+ return;
41399
+ }
41400
+ if (this.$options.checkChild !== false) {
41401
+ findAll('.is-checker', listItem).forEach((childChecker) => {
41402
+ if (childChecker.disabled) {
41403
+ return;
41404
+ }
41405
+ childChecker.checked = checked;
41406
+ });
41407
+ }
41408
+ if (!this.$options.checkPath) {
41409
+ return;
41410
+ }
41411
+ parents(checker, 'ul')
41412
+ .map((list) => siblings(list, '.tree-item').pop())
41413
+ .filter((item) => item)
41414
+ .forEach((item) => {
41415
+ const parentChecker = find('.is-checker', item);
41416
+ if (!parentChecker) {
41417
+ return;
41418
+ }
41419
+ const parentLi = parents(item, 'li')[0];
41420
+ if (!parentLi) {
41421
+ return;
41422
+ }
41423
+ const descendantCheckers = findAll('.is-checker', parentLi).filter((candidate) => candidate !== parentChecker);
41424
+ if (!descendantCheckers.length) {
41425
+ return;
41426
+ }
41427
+ parentChecker.checked = descendantCheckers.some((candidate) => candidate.checked);
41428
+ });
40885
41429
  },
40886
41430
  getPathArray(path) {
40887
41431
  const pathParts = path.split('/');
@@ -40960,34 +41504,46 @@
40960
41504
  }
40961
41505
  this.$event(this, 'onToggle', item, hasClass(target, 'is-open') ? 'expanded' : 'collapsed', this._hidden.getItemIndex(target), e);
40962
41506
  },
40963
- renderTree: (data) => {
40964
- return (createElement$1("ul", null, data.map((item) => {
40965
- return this._hidden.renderItem(item);
41507
+ renderTree: (data, keyPath = '') => {
41508
+ return (createElement$1("ul", null, data.map((item, idx) => {
41509
+ const itemKeyPath = keyPath ? `${keyPath}-${idx}` : `${idx}`;
41510
+ return this._hidden.renderItem(item, itemKeyPath);
40966
41511
  })));
40967
41512
  },
40968
- renderItem: (item) => {
41513
+ renderItem: (item, keyPath) => {
40969
41514
  var _a;
41515
+ const resolvedKeyPath = keyPath !== null && keyPath !== void 0 ? keyPath : `seq-${this._checkerIdSeq++}`;
41516
+ const checkerId = `${this._uid}-chk-${resolvedKeyPath}`;
40970
41517
  return (createElement$1("li", null,
40971
- createElement$1("div", { className: ['tree-item', item[this.$options.childField] ? 'has-child' : '', item.opened ? 'is-open' : '', item.actived ? ' is-active' : '', item.disabled ? 'is-disabled' : ''].join(' '), "on-click": this._hidden.select.bind(this, item), "data-path": (_a = item.path) !== null && _a !== void 0 ? _a : '', title: item.text },
41518
+ createElement$1("div", { className: [
41519
+ 'tree-item',
41520
+ item[this.$options.childField] ? 'has-child' : '',
41521
+ item.opened ? 'is-open' : '',
41522
+ !this.$options.hasCheck && item.actived ? ' is-active' : '',
41523
+ item.disabled ? 'is-disabled' : ''
41524
+ ].join(' '), "on-click": this._hidden.select.bind(this, item), "data-path": (_a = item.path) !== null && _a !== void 0 ? _a : '', title: item.text },
40972
41525
  // has child field - arrow toggle
40973
41526
  item[this.$options.childField] ? (createElement$1("div", { className: "is-toggler", "on-click": (e) => {
40974
41527
  this._hidden.toggle.call(this, item, e);
40975
41528
  } })) : (''),
40976
41529
  // has checkbox
40977
- this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true' ? (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
40978
- createElement$1("input", { type: "checkbox", className: "is-checker", "on-click": (e) => {
41530
+ this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true' ? (createElement$1("div", { className: "gn-checks is-small is-no-padding" },
41531
+ createElement$1("input", { type: "checkbox", className: "is-checker", id: checkerId, disabled: !!this.$options.disabled || !!item.disabled, "on-click": (e) => {
40979
41532
  this._hidden.check.call(this, item, e);
40980
- }, defaultChecked: !!item.selected }))) : (''),
41533
+ }, defaultChecked: !!item.selected }),
41534
+ createElement$1("label", { for: checkerId }, item.text))) : (''),
40981
41535
  // show icon
40982
41536
  this.$options.showIcon && !item.hideIcon ? (item.icon ? (createElement$1("span", { innerHTML: item.icon })) : (createElement$1("i", { style: { marginRight: '5px' }, className: 'far fa-' + (item.opened ? 'folder-open' : 'folder') }))) : (''),
40983
- item.text),
40984
- item[this.$options.childField] && this._hidden.renderTree(item[this.$options.childField])));
41537
+ !(this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true') && item.text),
41538
+ item[this.$options.childField] && this._hidden.renderTree(item[this.$options.childField], resolvedKeyPath)));
40985
41539
  },
40986
- setPaths(data, basePath = '') {
41540
+ setPaths: (data, basePath = '') => {
40987
41541
  return data.map(item => {
40988
- const itemPath = basePath ? `${basePath}/${item.text}` : item.text;
40989
- const childPath = item.child ? this.setPaths(item.child, itemPath) : null;
40990
- return Object.assign(Object.assign({}, item), { path: itemPath, child: childPath });
41542
+ const itemKey = (item === null || item === void 0 ? void 0 : item.value) !== undefined && (item === null || item === void 0 ? void 0 : item.value) !== null && (item === null || item === void 0 ? void 0 : item.value) !== '' ? String(item.value) : item.text;
41543
+ const itemPath = basePath ? `${basePath}/${itemKey}` : itemKey;
41544
+ const children = item[this.$options.childField];
41545
+ const childPath = children ? this._hidden.setPaths(children, itemPath) : null;
41546
+ return Object.assign(Object.assign({}, item), { path: itemPath, [this.$options.childField]: childPath });
40991
41547
  });
40992
41548
  }
40993
41549
  };
@@ -40998,10 +41554,11 @@
40998
41554
  data: [],
40999
41555
  childField: 'child',
41000
41556
  hasCheck: false,
41001
- multiple: false,
41557
+ checkChild: true,
41002
41558
  checkPath: false,
41003
41559
  showIcon: false,
41004
- hideIcon: false
41560
+ hideIcon: false,
41561
+ disabled: false
41005
41562
  };
41006
41563
  this.events = {
41007
41564
  onSelect: true,
@@ -41026,7 +41583,19 @@
41026
41583
  this._hidden.collapseAll();
41027
41584
  },
41028
41585
  checkAll() {
41029
- this._hidden.checkAll();
41586
+ if (!this.$options.hasCheck || this.$options.disabled)
41587
+ return;
41588
+ this._hidden.checkAll(true);
41589
+ },
41590
+ uncheckAll() {
41591
+ if (!this.$options.hasCheck || this.$options.disabled)
41592
+ return;
41593
+ this._hidden.checkAll(false);
41594
+ },
41595
+ setChecked(targets, checked) {
41596
+ if (this.$options.disabled)
41597
+ return;
41598
+ this._hidden.setChecked(targets, checked);
41030
41599
  },
41031
41600
  getChecked(withStatus = false) {
41032
41601
  return this._hidden.getChecked(withStatus);
@@ -41039,14 +41608,29 @@
41039
41608
  },
41040
41609
  filter(keyword) {
41041
41610
  return this._hidden.filter(keyword);
41611
+ },
41612
+ disable() {
41613
+ this.$options.disabled = true;
41614
+ addClass(this.$el, 'is-disabled');
41615
+ this._hidden.setCheckersDisabled(true);
41616
+ },
41617
+ enable() {
41618
+ this.$options.disabled = false;
41619
+ removeClass(this.$el, 'is-disabled');
41620
+ this._hidden.setCheckersDisabled(false);
41042
41621
  }
41043
41622
  };
41623
+ // multiple → hasCheck 치환(동일 기능으로 지원 X)
41624
+ if (options && options.multiple) {
41625
+ options.hasCheck = true;
41626
+ delete options.multiple;
41627
+ }
41044
41628
  this.$init(this, options);
41045
41629
  }
41046
41630
  template(config) {
41047
41631
  config.data = this._hidden.setPaths(config.data);
41048
41632
  const styles = {};
41049
- return (createElement$1("div", { id: this._uid, className: 'gn-tree' + (config.color ? ' is-' + config.color : '') + (config.type ? ' is-' + config.type : '') + (config.size ? ' is-' + config.size : ''), style: styles },
41633
+ return (createElement$1("div", { id: this._uid, className: 'gn-tree' + (config.color ? ' is-' + config.color : '') + (config.type ? ' is-' + config.type : '') + (config.size ? ' is-' + config.size : '') + (config.disabled ? ' is-disabled' : ''), style: styles },
41050
41634
  config.textSets.title && createElement$1("p", { className: "tree-label", innerHTML: config.textSets.title }),
41051
41635
  this._hidden.renderTree(config.data)));
41052
41636
  }