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.
- package/@types/gnui.d.ts +8 -0
- package/dist/js/gnui.esm.js +847 -263
- package/dist/js/gnui.js +847 -263
- package/dist/js/gnui.min.js +6 -6
- package/dist/styles/default.css +10743 -20757
- package/dist/styles/gpi.css +10773 -20787
- package/dist/styles/green24.css +11407 -21435
- package/dist/styles/insights.css +10759 -20774
- package/dist/styles/nac.css +10773 -20796
- package/dist/styles/ztnac.css +11407 -21436
- package/package.json +9 -3
- package/styleguide/assets/components.js +213 -12
- package/styleguide/assets/js/gnui.js +847 -263
- package/styleguide/assets/js/gnui.min.js +6 -6
- package/styleguide/assets/styles/default.css +10743 -20757
- package/styleguide/assets/styles/gpi.css +10773 -20787
- package/styleguide/assets/styles/green24.css +11407 -21435
- package/styleguide/assets/styles/insights.css +10759 -20774
- package/styleguide/assets/styles/nac.css +10773 -20796
- package/styleguide/assets/styles/ztnac.css +11407 -21436
- package/styleguide/category/COLOR/index.html +1 -1
- package/styleguide/category/COMPONENT/Alert(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Bignumber/index.html +1 -1
- package/styleguide/category/COMPONENT/Breadcrumb/index.html +1 -1
- package/styleguide/category/COMPONENT/Calendar(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Card/index.html +1 -1
- package/styleguide/category/COMPONENT/Chart(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Datagrid(js)/index.html +109 -11
- package/styleguide/category/COMPONENT/Datalist(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Growl(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/JsonView(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Loader(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/MenuButton(js)/index.html +169 -21
- package/styleguide/category/COMPONENT/Message(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Modal(js)/index.html +31 -1
- package/styleguide/category/COMPONENT/Pagination(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Panel/index.html +1 -1
- package/styleguide/category/COMPONENT/Progressbar(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tab(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tagcloud(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tooltip(js)/index.html +1 -1
- package/styleguide/category/COMPONENT/Tree(js)/index.html +98 -19
- package/styleguide/category/CONTROLS/Button(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Checkbox/index.html +1 -1
- package/styleguide/category/CONTROLS/Colorpicker(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Datepicker(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Dropdown(js)/index.html +67 -10
- package/styleguide/category/CONTROLS/File/index.html +1 -1
- package/styleguide/category/CONTROLS/Form/Control/index.html +1 -1
- package/styleguide/category/CONTROLS/Form/Field/index.html +54 -2
- package/styleguide/category/CONTROLS/Form/Plain/index.html +2 -2
- package/styleguide/category/CONTROLS/Input/index.html +1 -1
- package/styleguide/category/CONTROLS/MultiText(js)/index.html +32 -1
- package/styleguide/category/CONTROLS/Picklist(js)/index.html +67 -13
- package/styleguide/category/CONTROLS/Radio/index.html +1 -1
- package/styleguide/category/CONTROLS/Select/index.html +1 -1
- package/styleguide/category/CONTROLS/SelectButton(js)/index.html +2 -2
- package/styleguide/category/CONTROLS/Slider/index.html +1 -1
- package/styleguide/category/CONTROLS/SortableList(js)/index.html +2 -2
- package/styleguide/category/CONTROLS/Switch(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/SyntaxInput(js)/index.html +1 -1
- package/styleguide/category/CONTROLS/Textarea/index.html +2 -2
- package/styleguide/category/CONTROLS/Time(js)/index.html +2 -2
- package/styleguide/category/ELEMENTS/Box/index.html +1 -1
- package/styleguide/category/ELEMENTS/Icon/index.html +1 -1
- package/styleguide/category/ELEMENTS/Image/index.html +1 -1
- package/styleguide/category/ELEMENTS/List/index.html +1 -1
- package/styleguide/category/ELEMENTS/Table/index.html +1 -1
- package/styleguide/category/ELEMENTS/Tag/index.html +1 -1
- package/styleguide/category/ELEMENTS/Title/index.html +1 -1
- package/styleguide/category/LAYOUT/Container/index.html +1 -1
- package/styleguide/category/LAYOUT/Grid/index.html +1 -1
- package/styleguide/category/LAYOUT/Splitter(js)/index.html +1 -1
- package/styleguide/category/UTILITY/index.html +9 -2
- package/styleguide/category/Utils/index.html +1 -1
- package/styleguide/color.html +1 -1
- package/styleguide/index.html +1 -1
- package/styleguide/tag/javascript/index.html +4680 -4183
- package/styleguide/tag/v.0.1.0/index.html +5762 -5206
package/dist/js/gnui.esm.js
CHANGED
|
@@ -16870,65 +16870,65 @@ class GNCoreEventManager {
|
|
|
16870
16870
|
return GNCoreEventManager.instance;
|
|
16871
16871
|
}
|
|
16872
16872
|
// life cycle event add
|
|
16873
|
-
stateAdd(
|
|
16874
|
-
return this.add(undefined,
|
|
16873
|
+
stateAdd(cid, name, handler) {
|
|
16874
|
+
return this.add(undefined, cid, name, handler);
|
|
16875
16875
|
}
|
|
16876
|
-
add(target,
|
|
16877
|
-
if (!this._eventMap[
|
|
16878
|
-
this._eventMap[
|
|
16876
|
+
add(target, cid, name, handler) {
|
|
16877
|
+
if (!this._eventMap[cid]) {
|
|
16878
|
+
this._eventMap[cid] = []; // 해당 cid에 대한 이벤트가 없는 경우 초기화
|
|
16879
16879
|
}
|
|
16880
|
-
const eid = this._getEventId(
|
|
16881
|
-
this._eventMap[
|
|
16880
|
+
const eid = this._getEventId(cid); // eventID 생성
|
|
16881
|
+
this._eventMap[cid].push(target
|
|
16882
16882
|
? {
|
|
16883
16883
|
target,
|
|
16884
16884
|
eid,
|
|
16885
|
-
|
|
16885
|
+
cid,
|
|
16886
16886
|
name,
|
|
16887
16887
|
handler
|
|
16888
16888
|
}
|
|
16889
16889
|
: {
|
|
16890
16890
|
eid,
|
|
16891
|
-
|
|
16891
|
+
cid,
|
|
16892
16892
|
name,
|
|
16893
16893
|
handler
|
|
16894
16894
|
});
|
|
16895
16895
|
target && on(target, name, handler); // 이벤트 바인딩
|
|
16896
16896
|
return eid;
|
|
16897
16897
|
}
|
|
16898
|
-
remove(
|
|
16899
|
-
const _events = this._getEvent(
|
|
16898
|
+
remove(cid, name) {
|
|
16899
|
+
const _events = this._getEvent(cid, name);
|
|
16900
16900
|
// 이벤트 해제
|
|
16901
16901
|
if (_events.length) {
|
|
16902
16902
|
_events.forEach((_event) => {
|
|
16903
16903
|
off(_event.target, _event.name, _event.handler);
|
|
16904
16904
|
// eventMap에서 해당 이벤트 삭제
|
|
16905
|
-
this._eventMap[
|
|
16906
|
-
this._eventMap[
|
|
16905
|
+
this._eventMap[cid].some(event => event.eid === _event.eid) &&
|
|
16906
|
+
this._eventMap[cid].splice(this._eventMap[cid].findIndex(event => event.eid === _event.eid), 1);
|
|
16907
16907
|
});
|
|
16908
|
-
//
|
|
16909
|
-
if (!this._eventMap[
|
|
16910
|
-
delete this._eventMap[
|
|
16908
|
+
// cid에 대한 이벤트가 남아있지 않은 경우 cid 키 삭제
|
|
16909
|
+
if (!this._eventMap[cid].length) {
|
|
16910
|
+
delete this._eventMap[cid];
|
|
16911
16911
|
}
|
|
16912
16912
|
}
|
|
16913
16913
|
}
|
|
16914
|
-
removeAll(
|
|
16915
|
-
if (!this._eventMap[
|
|
16914
|
+
removeAll(cid) {
|
|
16915
|
+
if (!this._eventMap[cid]) {
|
|
16916
16916
|
return;
|
|
16917
16917
|
}
|
|
16918
16918
|
// 이벤트 해제
|
|
16919
|
-
this._eventMap[
|
|
16919
|
+
this._eventMap[cid].forEach(event => {
|
|
16920
16920
|
if (event.target) {
|
|
16921
16921
|
off(event.target, event.name, event.handler);
|
|
16922
16922
|
}
|
|
16923
16923
|
});
|
|
16924
16924
|
// 이벤트 삭제
|
|
16925
|
-
delete this._eventMap[
|
|
16925
|
+
delete this._eventMap[cid];
|
|
16926
16926
|
}
|
|
16927
16927
|
/**
|
|
16928
16928
|
* lifeCycle 핸들러 실행
|
|
16929
16929
|
*/
|
|
16930
|
-
cyclepatch(
|
|
16931
|
-
const _events = this._getEvent(
|
|
16930
|
+
cyclepatch(cid, name, params) {
|
|
16931
|
+
const _events = this._getEvent(cid, name);
|
|
16932
16932
|
if (_events.length) {
|
|
16933
16933
|
_events.forEach((_event) => {
|
|
16934
16934
|
const _tagret = _event.target || this;
|
|
@@ -16943,8 +16943,8 @@ class GNCoreEventManager {
|
|
|
16943
16943
|
* - 모든 핸들러를 순차 실행한 뒤, 하나라도 `false` 를 반환한 경우 `true`(cancelled)를 반환한다.
|
|
16944
16944
|
* (첫 false 에서 중단하지 않고, 나머지 핸들러도 계속 실행한다)
|
|
16945
16945
|
*/
|
|
16946
|
-
async dispatch(
|
|
16947
|
-
const _events = this._getEvent(
|
|
16946
|
+
async dispatch(cid, name, params) {
|
|
16947
|
+
const _events = this._getEvent(cid, name);
|
|
16948
16948
|
let cancelled = false;
|
|
16949
16949
|
if (_events.length) {
|
|
16950
16950
|
for (const _event of _events) {
|
|
@@ -16958,17 +16958,17 @@ class GNCoreEventManager {
|
|
|
16958
16958
|
}
|
|
16959
16959
|
return cancelled;
|
|
16960
16960
|
}
|
|
16961
|
-
_getEvent(
|
|
16961
|
+
_getEvent(cid, name) {
|
|
16962
16962
|
// parameters에 해당하는 이벤트 반환
|
|
16963
|
-
return this._eventMap[
|
|
16964
|
-
? this._eventMap[
|
|
16963
|
+
return this._eventMap[cid]
|
|
16964
|
+
? this._eventMap[cid].filter(event => {
|
|
16965
16965
|
return event.name === name;
|
|
16966
16966
|
}) || []
|
|
16967
16967
|
: [];
|
|
16968
16968
|
}
|
|
16969
|
-
_getEventId(
|
|
16969
|
+
_getEventId(cid) {
|
|
16970
16970
|
// event ID 생성
|
|
16971
|
-
return `ev_${
|
|
16971
|
+
return `ev_${cid}${this._eventMap[cid].length}`;
|
|
16972
16972
|
}
|
|
16973
16973
|
}
|
|
16974
16974
|
|
|
@@ -17012,12 +17012,12 @@ class GNUIState {
|
|
|
17012
17012
|
}
|
|
17013
17013
|
// 최초 생성 후 state에 등록 - created
|
|
17014
17014
|
_addComponent(component) {
|
|
17015
|
-
const
|
|
17016
|
-
if (
|
|
17017
|
-
this._componentMap[
|
|
17015
|
+
const cid = component._cid;
|
|
17016
|
+
if (cid) {
|
|
17017
|
+
this._componentMap[cid] = {
|
|
17018
17018
|
component: component,
|
|
17019
17019
|
selector: component.$selector,
|
|
17020
|
-
|
|
17020
|
+
cid: cid,
|
|
17021
17021
|
status: 'created'
|
|
17022
17022
|
};
|
|
17023
17023
|
}
|
|
@@ -17032,13 +17032,28 @@ class GNUIState {
|
|
|
17032
17032
|
if (!_selector) {
|
|
17033
17033
|
return undefined;
|
|
17034
17034
|
}
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17035
|
+
// 1) cid 직접 조회 (string selector 인 경우)
|
|
17036
|
+
if (typeof selector === 'string' && this._componentMap[selector]) {
|
|
17037
|
+
_findComponent = this._componentMap[selector].component;
|
|
17038
|
+
_findComponent._status = this._componentMap[selector].status;
|
|
17039
|
+
return _findComponent;
|
|
17040
|
+
}
|
|
17041
|
+
// 2) data-component-id 기반 조회
|
|
17042
|
+
const dataCid = (_selector === null || _selector === void 0 ? void 0 : _selector.getAttribute) && _selector.getAttribute('data-component-id');
|
|
17043
|
+
if (dataCid && this._componentMap[dataCid]) {
|
|
17044
|
+
_findComponent = this._componentMap[dataCid].component;
|
|
17045
|
+
_findComponent._status = this._componentMap[dataCid].status;
|
|
17046
|
+
return _findComponent;
|
|
17047
|
+
}
|
|
17048
|
+
// 3) selector/element 비교 fallback
|
|
17049
|
+
Object.values(this._componentMap).some(n => {
|
|
17050
|
+
var _a;
|
|
17051
|
+
if (isEquals(n.selector, _selector) || isEquals((_a = n.component) === null || _a === void 0 ? void 0 : _a.$el, _selector)) {
|
|
17038
17052
|
_findComponent = n.component;
|
|
17039
17053
|
_findComponent._status = n.status;
|
|
17040
|
-
return
|
|
17054
|
+
return true;
|
|
17041
17055
|
}
|
|
17056
|
+
return false;
|
|
17042
17057
|
});
|
|
17043
17058
|
return _findComponent;
|
|
17044
17059
|
}
|
|
@@ -17052,7 +17067,7 @@ class GNUIState {
|
|
|
17052
17067
|
// 동일한 selector 인지 비교해서 동일한 component의 selector이면 제거 처리
|
|
17053
17068
|
if (isEquals(n.selector, _selector)) {
|
|
17054
17069
|
// componentMap에서 완전히 제거
|
|
17055
|
-
delete this._componentMap[n.
|
|
17070
|
+
delete this._componentMap[n.cid];
|
|
17056
17071
|
// 컴포넌트 내부 참조도 제거 (메모리 누수 방지)
|
|
17057
17072
|
if (n.component) {
|
|
17058
17073
|
n.component = null;
|
|
@@ -17061,32 +17076,32 @@ class GNUIState {
|
|
|
17061
17076
|
}
|
|
17062
17077
|
});
|
|
17063
17078
|
}
|
|
17064
|
-
// 등록된 컴포넌트 제거 (
|
|
17065
|
-
|
|
17066
|
-
if (!
|
|
17079
|
+
// 등록된 컴포넌트 제거 (cid 기반)
|
|
17080
|
+
_removeComponentByCid(cid) {
|
|
17081
|
+
if (!cid || !this._componentMap[cid]) {
|
|
17067
17082
|
return;
|
|
17068
17083
|
}
|
|
17069
17084
|
// 컴포넌트 내부 참조 제거 (메모리 누수 방지)
|
|
17070
|
-
const componentInfo = this._componentMap[
|
|
17085
|
+
const componentInfo = this._componentMap[cid];
|
|
17071
17086
|
if (componentInfo.component) {
|
|
17072
17087
|
componentInfo.component = null;
|
|
17073
17088
|
}
|
|
17074
17089
|
componentInfo.selector = null;
|
|
17075
17090
|
// componentMap에서 완전히 제거
|
|
17076
|
-
delete this._componentMap[
|
|
17091
|
+
delete this._componentMap[cid];
|
|
17077
17092
|
}
|
|
17078
17093
|
// 컴포넌트 life cycle에 따른 eventManager dispatch
|
|
17079
|
-
_detectedCycle(
|
|
17094
|
+
_detectedCycle(cid, name) {
|
|
17080
17095
|
// component 마지막 status 업데이트
|
|
17081
|
-
if (this._componentMap[
|
|
17082
|
-
this._componentMap[
|
|
17096
|
+
if (this._componentMap[cid]) {
|
|
17097
|
+
this._componentMap[cid].status = name;
|
|
17083
17098
|
}
|
|
17084
|
-
// event manager를 이용해 해당
|
|
17099
|
+
// event manager를 이용해 해당 cid 이벤트 dispatch
|
|
17085
17100
|
const eventManager = GNCoreEventManager.getInstance();
|
|
17086
17101
|
// 호출 후
|
|
17087
|
-
eventManager.cyclepatch(
|
|
17102
|
+
eventManager.cyclepatch(cid, name, '');
|
|
17088
17103
|
// 이벤트 해제 - life cycle 은 컴포넌트 별로 한번씩만 존재하므로..
|
|
17089
|
-
eventManager.remove(
|
|
17104
|
+
eventManager.remove(cid, name);
|
|
17090
17105
|
}
|
|
17091
17106
|
// document DOM observer 실행
|
|
17092
17107
|
// - DOM 변환 이벤트 감지해서 removedNodes 가 생기면 해당 node와 일치하는 component를 찾아 제거한다.
|
|
@@ -17111,18 +17126,18 @@ class GNUIState {
|
|
|
17111
17126
|
if (isElement$2(rm) && attr(rm, 'data-gnui')) {
|
|
17112
17127
|
remove($('#' + attr(rm, 'data-gnui')));
|
|
17113
17128
|
}
|
|
17114
|
-
const childComponents = $$('[data-
|
|
17129
|
+
const childComponents = $$('[data-component-id]', rm);
|
|
17115
17130
|
each(childComponents, (childComponent) => {
|
|
17116
17131
|
if (isElement$2(childComponent)) {
|
|
17117
17132
|
const findComponent = closerThis._getComponent($(childComponent));
|
|
17118
|
-
if (findComponent && findComponent.
|
|
17119
|
-
// $destroy 내부에서 removeAll과
|
|
17133
|
+
if (findComponent && findComponent._cid && findComponent.$el && findComponent.$name !== 'modal') {
|
|
17134
|
+
// $destroy 내부에서 removeAll과 _removeComponentByCid를 처리하므로 직접 호출만
|
|
17120
17135
|
findComponent.$destroy(findComponent, false);
|
|
17121
17136
|
}
|
|
17122
17137
|
}
|
|
17123
17138
|
});
|
|
17124
17139
|
const findComponent = closerThis._getComponent($(rm));
|
|
17125
|
-
if (findComponent && findComponent.
|
|
17140
|
+
if (findComponent && findComponent._cid && !((_a = findComponent.$el) === null || _a === void 0 ? void 0 : _a.parentNode) && findComponent.$name !== 'modal') {
|
|
17126
17141
|
findComponent.$destroy(findComponent, false);
|
|
17127
17142
|
}
|
|
17128
17143
|
});
|
|
@@ -17155,6 +17170,7 @@ class GNCoreInstance {
|
|
|
17155
17170
|
return generateUUID();
|
|
17156
17171
|
};
|
|
17157
17172
|
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()}`;
|
|
17173
|
+
this._cid = `${GN_CONSTANT.PREFIX}${uuid()}`;
|
|
17158
17174
|
}
|
|
17159
17175
|
$reset() { }
|
|
17160
17176
|
$init(component, options) {
|
|
@@ -17165,14 +17181,14 @@ class GNCoreInstance {
|
|
|
17165
17181
|
// component.$options.states => 사용자가 정의한 lifecycle callback handler
|
|
17166
17182
|
this.$stateBind(component);
|
|
17167
17183
|
// stateManager를 통해 beforeMount 상태 dispatch
|
|
17168
|
-
stateManager._detectedCycle(component.
|
|
17184
|
+
stateManager._detectedCycle(component._cid, 'beforeMount');
|
|
17169
17185
|
this.$mount(component, this.$selector);
|
|
17170
17186
|
this.$render(component.$options);
|
|
17171
17187
|
// stateManager를 통해 beforeBind 상태 dispatch
|
|
17172
|
-
stateManager._detectedCycle(component.
|
|
17188
|
+
stateManager._detectedCycle(component._cid, 'beforeBind');
|
|
17173
17189
|
this.$bind(component);
|
|
17174
17190
|
// stateManager를 통해 completed 상태 dispatch
|
|
17175
|
-
stateManager._detectedCycle(component.
|
|
17191
|
+
stateManager._detectedCycle(component._cid, 'completed');
|
|
17176
17192
|
}
|
|
17177
17193
|
$create(component, options) {
|
|
17178
17194
|
// extend options
|
|
@@ -17234,7 +17250,7 @@ class GNCoreInstance {
|
|
|
17234
17250
|
const eventManager = GNCoreEventManager.getInstance();
|
|
17235
17251
|
// lifecycle 관련 이벤트 add to eventManager
|
|
17236
17252
|
GN_CONSTANT.LIFE_CYCLE.forEach((ev) => {
|
|
17237
|
-
eventManager.stateAdd(component.
|
|
17253
|
+
eventManager.stateAdd(component._cid, ev, (...args) => {
|
|
17238
17254
|
// 해당 life cycle 상태에 해당하는 함수가 각 컴포넌트 내부에 정의되어 있으면 호출한다.
|
|
17239
17255
|
if (isFunction(component[ev])) {
|
|
17240
17256
|
component[ev](args);
|
|
@@ -17279,13 +17295,17 @@ class GNCoreInstance {
|
|
|
17279
17295
|
if (tmpRole) {
|
|
17280
17296
|
attr(this.$el, 'role', tmpRole);
|
|
17281
17297
|
}
|
|
17282
|
-
attr(this.$el, 'data-
|
|
17298
|
+
attr(this.$el, 'data-component-id', this._cid);
|
|
17283
17299
|
// inherit selector class
|
|
17284
17300
|
selector.className && addClass(this.$el, selector.className);
|
|
17285
17301
|
}
|
|
17286
17302
|
else {
|
|
17287
17303
|
this.$el = $(this.$selector);
|
|
17288
17304
|
}
|
|
17305
|
+
// 항상 컴포넌트 cid를 DOM에 표시 (기존 DOM 사용 시에도)
|
|
17306
|
+
if (this.$el) {
|
|
17307
|
+
attr(this.$el, 'data-component-id', this._cid);
|
|
17308
|
+
}
|
|
17289
17309
|
// delegates 바인딩
|
|
17290
17310
|
each(this.$options.delegates, (val, key) => {
|
|
17291
17311
|
if (isString(val)) {
|
|
@@ -17305,11 +17325,11 @@ class GNCoreInstance {
|
|
|
17305
17325
|
const eventManager = GNCoreEventManager.getInstance();
|
|
17306
17326
|
each(events, (event, name) => {
|
|
17307
17327
|
if (isFunction(event)) {
|
|
17308
|
-
eventManager.add(this.$el, this.
|
|
17328
|
+
eventManager.add(this.$el, this._cid, event.name || name, event);
|
|
17309
17329
|
}
|
|
17310
17330
|
else if (isPlainObject$1(event)) {
|
|
17311
17331
|
const delegate = isFunction(event.delegate) ? event.delegate() : event.delegate;
|
|
17312
|
-
eventManager.add(delegate, this.
|
|
17332
|
+
eventManager.add(delegate, this._cid, event.name, event.handler);
|
|
17313
17333
|
}
|
|
17314
17334
|
});
|
|
17315
17335
|
}
|
|
@@ -17328,13 +17348,13 @@ class GNCoreInstance {
|
|
|
17328
17348
|
*/
|
|
17329
17349
|
async $event(component, name, ...params) {
|
|
17330
17350
|
const eventManager = GNCoreEventManager.getInstance();
|
|
17331
|
-
return eventManager.dispatch(component.
|
|
17351
|
+
return eventManager.dispatch(component._cid, name, params);
|
|
17332
17352
|
}
|
|
17333
17353
|
$destroy(component = this, removeEl = true) {
|
|
17334
17354
|
var _a;
|
|
17335
17355
|
const stateManager = GNUIState.getInstance();
|
|
17336
17356
|
// state manager 를 통해 destroy 상태 dispatch
|
|
17337
|
-
stateManager._detectedCycle(component.
|
|
17357
|
+
stateManager._detectedCycle(component._cid, 'destroy');
|
|
17338
17358
|
// remove DOM (by removeEl)
|
|
17339
17359
|
if (removeEl) {
|
|
17340
17360
|
style(component.$el, 'display', 'none');
|
|
@@ -17344,11 +17364,11 @@ class GNCoreInstance {
|
|
|
17344
17364
|
component.$options._destroy();
|
|
17345
17365
|
}
|
|
17346
17366
|
// state manager 를 통해 destroy 상태 dispatch
|
|
17347
|
-
stateManager._detectedCycle(component.
|
|
17367
|
+
stateManager._detectedCycle(component._cid, 'destroyed');
|
|
17348
17368
|
// event manager 에서 등록 해제
|
|
17349
|
-
GNCoreEventManager.getInstance().removeAll(component.
|
|
17350
|
-
// state manager에서 component 제거 (
|
|
17351
|
-
stateManager.
|
|
17369
|
+
GNCoreEventManager.getInstance().removeAll(component._cid);
|
|
17370
|
+
// state manager에서 component 제거 (cid 기반)
|
|
17371
|
+
stateManager._removeComponentByCid(component._cid);
|
|
17352
17372
|
// 메모리 누수 방지: component의 모든 hasOwnProperty 제거
|
|
17353
17373
|
// config, events, methods, _hidden 등 동적으로 추가된 속성 포함
|
|
17354
17374
|
Object.keys(component).forEach((key) => {
|
|
@@ -33305,7 +33325,10 @@ class Dropdown extends GNCoreInstance {
|
|
|
33305
33325
|
text: ''
|
|
33306
33326
|
};
|
|
33307
33327
|
}
|
|
33308
|
-
|
|
33328
|
+
// 기존 의미 유지: 클릭된 옵션 기준으로 value/text 전달
|
|
33329
|
+
const value = !isArray$1(option.value) ? String(option.value) : '';
|
|
33330
|
+
const text = option.text || (isArray$1(option === null || option === void 0 ? void 0 : option.cols) ? option.cols : value);
|
|
33331
|
+
this.$event(this, 'onChange', value, text, this.$options.value);
|
|
33309
33332
|
},
|
|
33310
33333
|
toggle: () => {
|
|
33311
33334
|
if (this.$options.disabled) {
|
|
@@ -33401,18 +33424,33 @@ class Dropdown extends GNCoreInstance {
|
|
|
33401
33424
|
const target = e instanceof Event ? $(e.currentTarget) : find(`[data-value=${option.value}]`, this.$el);
|
|
33402
33425
|
e instanceof Event && e.stopPropagation();
|
|
33403
33426
|
// toggle 처리
|
|
33427
|
+
const checkbox = find('input[type=checkbox]', target);
|
|
33404
33428
|
if (hasClass(target, 'is-active')) {
|
|
33405
33429
|
removeClass(target, 'is-active');
|
|
33406
|
-
|
|
33430
|
+
if (checkbox) {
|
|
33431
|
+
checkbox.checked = false;
|
|
33432
|
+
}
|
|
33407
33433
|
}
|
|
33408
33434
|
else {
|
|
33409
33435
|
addClass(target, 'is-active');
|
|
33410
|
-
|
|
33436
|
+
if (checkbox) {
|
|
33437
|
+
checkbox.checked = true;
|
|
33438
|
+
}
|
|
33411
33439
|
}
|
|
33412
33440
|
const selected = findAll('.dropdown-item.is-active', this.$el).map((item) => data(item, 'data-value'));
|
|
33413
|
-
this.$options.value = this.$options.data.filter((opt) =>
|
|
33441
|
+
this.$options.value = this.$options.data.filter((opt) => {
|
|
33442
|
+
// value가 배열이 아닌 경우에만 비교
|
|
33443
|
+
return !isArray$1(opt.value) && selected.includes(opt.value);
|
|
33444
|
+
});
|
|
33414
33445
|
// text 표시
|
|
33415
|
-
|
|
33446
|
+
// Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
|
|
33447
|
+
const selectText = this.$options.value.map((v) => {
|
|
33448
|
+
if (isArray$1(v === null || v === void 0 ? void 0 : v.cols)) {
|
|
33449
|
+
return v.cols[0];
|
|
33450
|
+
}
|
|
33451
|
+
// value가 배열이 아닌 경우에만 사용
|
|
33452
|
+
return v.text || (!isArray$1(v.value) ? String(v.value) : '');
|
|
33453
|
+
}).join(',');
|
|
33416
33454
|
text$1(find('.dropdown-text', this.$el), selectText.length ? escapeEntity(selectText) : this.$options.textSets && this.$options.textSets.selectText ? this.$options.textSets.selectText : '');
|
|
33417
33455
|
this._hidden.change(option);
|
|
33418
33456
|
}
|
|
@@ -33434,9 +33472,21 @@ class Dropdown extends GNCoreInstance {
|
|
|
33434
33472
|
}
|
|
33435
33473
|
// text 표시
|
|
33436
33474
|
const selectText = find('.dropdown-text', this.$el);
|
|
33437
|
-
|
|
33475
|
+
// Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
|
|
33476
|
+
let displayText;
|
|
33477
|
+
if (isArray$1(option === null || option === void 0 ? void 0 : option.cols)) {
|
|
33478
|
+
displayText = option.cols[0];
|
|
33479
|
+
}
|
|
33480
|
+
else {
|
|
33481
|
+
// value가 배열이 아닌 경우에만 사용
|
|
33482
|
+
displayText = option.text || (!isArray$1(option.value) ? String(option.value) : '');
|
|
33483
|
+
}
|
|
33484
|
+
text$1(selectText, escapeEntity(displayText));
|
|
33438
33485
|
// select 선택값 변경
|
|
33439
|
-
|
|
33486
|
+
// value가 배열이 아닌 경우에만 설정
|
|
33487
|
+
if (!isArray$1(option.value)) {
|
|
33488
|
+
targetSelect.value = option.value;
|
|
33489
|
+
}
|
|
33440
33490
|
trigger(targetSelect, 'change');
|
|
33441
33491
|
this.$options.value = option;
|
|
33442
33492
|
this._hidden.change(option);
|
|
@@ -33493,21 +33543,76 @@ class Dropdown extends GNCoreInstance {
|
|
|
33493
33543
|
return;
|
|
33494
33544
|
}
|
|
33495
33545
|
findAll('.dropdown-item', this.$el).forEach((option) => {
|
|
33496
|
-
|
|
33546
|
+
const itemValue = data(option, 'value');
|
|
33547
|
+
// value가 배열이 아닌 항목만 검색 대상으로 처리
|
|
33548
|
+
const rowData = this.$options.flatData.find((item) => {
|
|
33549
|
+
// value가 배열이 아닌 경우에만 비교
|
|
33550
|
+
return !isArray$1(item.value) && String(item.value) === itemValue;
|
|
33551
|
+
});
|
|
33552
|
+
let match = false;
|
|
33553
|
+
// Implements [US-Rev-014] 다중 컬럼 모드: cols 배열의 값들을 검색
|
|
33554
|
+
if (isArray$1(rowData === null || rowData === void 0 ? void 0 : rowData.cols)) {
|
|
33555
|
+
match = rowData.cols.some((colValue) => {
|
|
33556
|
+
return includes(String(colValue).toUpperCase(), q.toUpperCase());
|
|
33557
|
+
});
|
|
33558
|
+
// value 필드도 검색 대상에 포함 (배열이 아닌 경우에만)
|
|
33559
|
+
if (!match && rowData.value && !isArray$1(rowData.value)) {
|
|
33560
|
+
match = includes(String(rowData.value).toUpperCase(), q.toUpperCase());
|
|
33561
|
+
}
|
|
33562
|
+
}
|
|
33563
|
+
else if (rowData) {
|
|
33564
|
+
// 단일 컬럼 모드: text 또는 value 필드 검색
|
|
33565
|
+
const textValue = rowData.text || (!isArray$1(rowData.value) ? String(rowData.value) : '');
|
|
33566
|
+
const valueStr = !isArray$1(rowData.value) ? String(rowData.value) : '';
|
|
33567
|
+
match = includes(valueStr.toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
|
|
33568
|
+
}
|
|
33569
|
+
else {
|
|
33570
|
+
// rowData를 찾지 못한 경우 (그룹화된 항목 등), DOM에서 직접 검색
|
|
33571
|
+
const textValue = text$1(find('.dropdown-text', option));
|
|
33572
|
+
match = includes(itemValue.toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
|
|
33573
|
+
}
|
|
33574
|
+
if (!match) {
|
|
33497
33575
|
css$1(option, 'display', 'none');
|
|
33498
33576
|
}
|
|
33499
33577
|
});
|
|
33500
33578
|
},
|
|
33501
33579
|
renderLabel: () => {
|
|
33502
|
-
|
|
33503
|
-
|
|
33504
|
-
|
|
33505
|
-
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33509
|
-
|
|
33510
|
-
|
|
33580
|
+
// Implements [US-Rev-014] cols가 있는 경우 첫 번째 컬럼 값을 표시
|
|
33581
|
+
let _labelText = '';
|
|
33582
|
+
if (this.$options.value) {
|
|
33583
|
+
if (isArray$1(this.$options.value)) {
|
|
33584
|
+
_labelText = this.$options.value.map((v) => {
|
|
33585
|
+
if (isArray$1(v === null || v === void 0 ? void 0 : v.cols)) {
|
|
33586
|
+
return v.cols[0];
|
|
33587
|
+
}
|
|
33588
|
+
// value가 배열이 아닌 경우에만 사용
|
|
33589
|
+
return v.text || (!isArray$1(v.value) ? String(v.value) : '');
|
|
33590
|
+
}).join(',');
|
|
33591
|
+
}
|
|
33592
|
+
else {
|
|
33593
|
+
const value = this.$options.value;
|
|
33594
|
+
if (isArray$1(value === null || value === void 0 ? void 0 : value.cols)) {
|
|
33595
|
+
_labelText = value.cols[0];
|
|
33596
|
+
}
|
|
33597
|
+
else {
|
|
33598
|
+
// value가 배열이 아닌 경우에만 사용
|
|
33599
|
+
_labelText = value.text || (!isArray$1(value.value) ? String(value.value) : '');
|
|
33600
|
+
}
|
|
33601
|
+
}
|
|
33602
|
+
}
|
|
33603
|
+
else if (this.$options.textSets && this.$options.textSets.selectText) {
|
|
33604
|
+
_labelText = this.$options.textSets.selectText;
|
|
33605
|
+
}
|
|
33606
|
+
else if (this.$options.flatData.length) {
|
|
33607
|
+
const firstItem = this.$options.flatData[0];
|
|
33608
|
+
if (isArray$1(firstItem === null || firstItem === void 0 ? void 0 : firstItem.cols)) {
|
|
33609
|
+
_labelText = firstItem.cols[0];
|
|
33610
|
+
}
|
|
33611
|
+
else {
|
|
33612
|
+
// value가 배열이 아닌 경우에만 사용
|
|
33613
|
+
_labelText = firstItem.text || (!isArray$1(firstItem.value) ? String(firstItem.value) : '');
|
|
33614
|
+
}
|
|
33615
|
+
}
|
|
33511
33616
|
return createElement$1("span", { className: "dropdown-text" }, escapeEntity(_labelText));
|
|
33512
33617
|
},
|
|
33513
33618
|
renderSub: (data) => {
|
|
@@ -33517,24 +33622,43 @@ class Dropdown extends GNCoreInstance {
|
|
|
33517
33622
|
if (this.$options.type === 'opened' && !items.length) {
|
|
33518
33623
|
return createElement$1("div", { className: 'dropdown-nodata' }, this.$options.textSets.noData);
|
|
33519
33624
|
}
|
|
33520
|
-
|
|
33521
|
-
|
|
33522
|
-
|
|
33523
|
-
|
|
33524
|
-
|
|
33525
|
-
|
|
33526
|
-
|
|
33527
|
-
|
|
33528
|
-
option.
|
|
33529
|
-
|
|
33530
|
-
|
|
33531
|
-
|
|
33532
|
-
|
|
33533
|
-
|
|
33534
|
-
|
|
33535
|
-
|
|
33536
|
-
|
|
33537
|
-
|
|
33625
|
+
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));
|
|
33626
|
+
return (createElement$1("ul", { className: hasCols ? 'is-cols' : '' }, items.map((option, index) => {
|
|
33627
|
+
const hasHtml = !!option.html;
|
|
33628
|
+
const hasColsData = isArray$1(option === null || option === void 0 ? void 0 : option.cols);
|
|
33629
|
+
const renderAsCols = !hasHtml && hasColsData;
|
|
33630
|
+
// html이 있으면 text가 있는 항목만 선택 가능
|
|
33631
|
+
// cols가 있으면 첫 번째 컬럼을 displayText로 사용 (value가 비어도 선택 가능)
|
|
33632
|
+
const displayText = hasHtml
|
|
33633
|
+
? (option.text || '')
|
|
33634
|
+
: renderAsCols
|
|
33635
|
+
? (option.cols && option.cols.length ? String(option.cols[0]) : '')
|
|
33636
|
+
: (option.text || (!isArray$1(option.value) ? String(option.value) : ''));
|
|
33637
|
+
return (createElement$1("li", { key: index, id: this._uid + '_opt_' + index, className: 'dropdown-item' +
|
|
33638
|
+
(renderAsCols ? ' dropdown-row' : '') +
|
|
33639
|
+
(displayText ? '' : ' is-unselectable') +
|
|
33640
|
+
(this.$options.value &&
|
|
33641
|
+
(isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value)
|
|
33642
|
+
? ' is-active'
|
|
33643
|
+
: '') +
|
|
33644
|
+
(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)) : '' },
|
|
33645
|
+
createElement$1("span", { className: "dropdown-text", innerHTML: option.html ? option.html : '' },
|
|
33646
|
+
option.html ? ('') : renderAsCols ? (createElement$1("div", { className: "gn-checks dropdown-cols" },
|
|
33647
|
+
this.$options.multiple && (createElement$1("div", { className: "is-small is-no-padding" },
|
|
33648
|
+
createElement$1("input", { type: "checkbox", id: this._uid + '_chk_' + index, defaultChecked: this.$options.value &&
|
|
33649
|
+
(isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value), disabled: this.$options.disabled }),
|
|
33650
|
+
createElement$1("label", { for: this._uid + '_chk_' + index }))),
|
|
33651
|
+
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" },
|
|
33652
|
+
createElement$1("input", { type: "checkbox", id: this._uid + '_chk_' + index, defaultChecked: this.$options.value &&
|
|
33653
|
+
(isArray$1(this.$options.value) ? this.$options.value.find((v) => v.value === option.value) : option.value === this.$options.value.value), disabled: this.$options.disabled }),
|
|
33654
|
+
createElement$1("label", { for: this._uid + '_chk_' + index }, escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : ''))))) : option.icon ? (createElement$1("span", null,
|
|
33655
|
+
createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
|
|
33656
|
+
createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
|
|
33657
|
+
escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : '')))) : (escapeEntity(option.text || (!isArray$1(option.value) ? String(option.value) : ''))),
|
|
33658
|
+
isArray$1(option.value) && (createElement$1("span", { className: "gn-icon is-small submenu-icon" },
|
|
33659
|
+
createElement$1("i", { className: "fas fa-angle-right" })))),
|
|
33660
|
+
isArray$1(option.value) && this._hidden.renderSub(option.value)));
|
|
33661
|
+
})));
|
|
33538
33662
|
},
|
|
33539
33663
|
flatData: () => {
|
|
33540
33664
|
// data 검색 편의성을 위해 depth를 없앤 flatdata 생성
|
|
@@ -33572,11 +33696,17 @@ class Dropdown extends GNCoreInstance {
|
|
|
33572
33696
|
: [String(this.$options.value)]; // 기타: 숫자 등
|
|
33573
33697
|
this.$options.value = this.$options.flatData.filter((opt) => {
|
|
33574
33698
|
const optValue = typeof opt.value === 'string' ? opt.value : String(opt.value);
|
|
33575
|
-
|
|
33699
|
+
// Implements [US-Rev-014] cols가 있으면 text 없어도 선택 가능
|
|
33700
|
+
return values.includes(optValue) && (opt.text || isArray$1(opt === null || opt === void 0 ? void 0 : opt.cols) || (!isArray$1(opt.value)));
|
|
33576
33701
|
});
|
|
33577
33702
|
}
|
|
33578
33703
|
else {
|
|
33579
|
-
|
|
33704
|
+
// Implements [US-Rev-014] cols가 있으면 text 없어도 선택 가능
|
|
33705
|
+
this.$options.value = this.$options.flatData.find((opt) => {
|
|
33706
|
+
const optValue = !isArray$1(opt.value) ? String(opt.value) : '';
|
|
33707
|
+
const compareValue = String(this.$options.value);
|
|
33708
|
+
return optValue === compareValue && (opt.text || isArray$1(opt === null || opt === void 0 ? void 0 : opt.cols) || optValue);
|
|
33709
|
+
});
|
|
33580
33710
|
}
|
|
33581
33711
|
}
|
|
33582
33712
|
},
|
|
@@ -34419,7 +34549,7 @@ class Chart extends GNCoreInstance {
|
|
|
34419
34549
|
const newOptions = merge(this.chartDefault, merge(chartOptions, typesDefault[this.$options.type] || {}));
|
|
34420
34550
|
if (!newOptions.theme) {
|
|
34421
34551
|
newOptions.theme = {
|
|
34422
|
-
palette: '
|
|
34552
|
+
palette: 'palette1'
|
|
34423
34553
|
};
|
|
34424
34554
|
}
|
|
34425
34555
|
this.$options.chart = new ApexCharts$1(this.$el, newOptions);
|
|
@@ -37089,6 +37219,13 @@ class DataGrid extends GNCoreInstance {
|
|
|
37089
37219
|
this.$event(this, 'onSort', column);
|
|
37090
37220
|
},
|
|
37091
37221
|
renderHeader: (columns, isReset = false) => {
|
|
37222
|
+
if (this._isHorizontalState()) {
|
|
37223
|
+
return (createElement$1("div", { className: "gn-datagrid-header-row is-horizontal" },
|
|
37224
|
+
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' } },
|
|
37225
|
+
createElement$1("input", { type: "checkbox", className: "is-allChecker", id: this._uid + '-rows-check', "on-click": (e) => {
|
|
37226
|
+
this._hidden.checkAll.call(this, e);
|
|
37227
|
+
}, disabled: this.$options.disabled }))))));
|
|
37228
|
+
}
|
|
37092
37229
|
this._setColumnsTemplate(isReset);
|
|
37093
37230
|
return (createElement$1("div", { className: "gn-datagrid-header-row", style: {
|
|
37094
37231
|
'grid-template-columns': this._columnsTemplate.join(' ')
|
|
@@ -37129,15 +37266,24 @@ class DataGrid extends GNCoreInstance {
|
|
|
37129
37266
|
},
|
|
37130
37267
|
renderBody: (data, columns) => {
|
|
37131
37268
|
// 헤더가 숨겨진 경우에도 body 렌더 전에 템플릿 폭을 준비한다
|
|
37132
|
-
if (!this._columnsTemplate || !this._columnsTemplate.length) {
|
|
37269
|
+
if (!this._isHorizontalState() && (!this._columnsTemplate || !this._columnsTemplate.length)) {
|
|
37133
37270
|
this._setColumnsTemplate();
|
|
37134
37271
|
}
|
|
37135
37272
|
rowIdx$1 = 0;
|
|
37136
|
-
return (createElement$1("div", { className:
|
|
37273
|
+
return (createElement$1("div", { className: 'gn-datagrid-body' + (this._isHorizontalState() ? ' is-horizontal' : ''), style: {
|
|
37274
|
+
'grid-template-columns': this._isHorizontalState()
|
|
37275
|
+
? this._orientationState.columns === 'auto-fit'
|
|
37276
|
+
? `repeat(auto-fit, minmax(${this._orientationState.minWidth}, 1fr))`
|
|
37277
|
+
: `repeat(${this._orientationState.columns}, minmax(0, 1fr))`
|
|
37278
|
+
: '',
|
|
37279
|
+
gap: this._isHorizontalState() ? this._orientationState.gap : '',
|
|
37137
37280
|
maxHeight: this.$options.bodyHeight ? this.$options.bodyHeight : 'auto'
|
|
37138
37281
|
} }, (data === null || data === void 0 ? void 0 : data.length) ? this._hidden.renderRows(data, columns) : this._hidden.renderNodata()));
|
|
37139
37282
|
},
|
|
37140
37283
|
renderRows: (rows, columns, depth = 0, isOpen = false) => {
|
|
37284
|
+
if (this._isHorizontalState()) {
|
|
37285
|
+
return rows.map((row) => this._hidden.renderRow(row, columns, 0, false, false));
|
|
37286
|
+
}
|
|
37141
37287
|
return rows.map((row) => {
|
|
37142
37288
|
return row[this.$options.childField] && isArray$1(row[this.$options.childField])
|
|
37143
37289
|
? [this._hidden.renderRow(row, columns, depth, true, isOpen), this._hidden.renderRows(row[this.$options.childField], columns, depth + 1, row.isOpened)]
|
|
@@ -37146,83 +37292,140 @@ class DataGrid extends GNCoreInstance {
|
|
|
37146
37292
|
},
|
|
37147
37293
|
renderRow: (row, columns, depth = 0, hasChild, isOpened, isCheck = false) => {
|
|
37148
37294
|
const _index = rowIdx$1++;
|
|
37295
|
+
const getHorizontalRowClass = () => {
|
|
37296
|
+
if (!this._isHorizontalState() || this._orientationState.columns === 'auto-fit') {
|
|
37297
|
+
return '';
|
|
37298
|
+
}
|
|
37299
|
+
const classes = ['is-horizontal'];
|
|
37300
|
+
if (_index % this._orientationState.columns === 0) {
|
|
37301
|
+
classes.push('is-horizontal-first-col');
|
|
37302
|
+
}
|
|
37303
|
+
if ((_index + 1) % this._orientationState.columns === 0 || _index === this.$options.data.length - 1) {
|
|
37304
|
+
classes.push('is-horizontal-last-col');
|
|
37305
|
+
}
|
|
37306
|
+
if (_index < this._orientationState.columns) {
|
|
37307
|
+
classes.push('is-horizontal-first-row');
|
|
37308
|
+
}
|
|
37309
|
+
return ' ' + classes.join(' ');
|
|
37310
|
+
};
|
|
37311
|
+
const horizontalClass = getHorizontalRowClass();
|
|
37149
37312
|
if (row.isChecked) {
|
|
37150
37313
|
isCheck = true;
|
|
37151
37314
|
}
|
|
37152
37315
|
return (createElement$1("div", { "on-click": (e) => {
|
|
37153
|
-
|
|
37316
|
+
var _a;
|
|
37317
|
+
((_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);
|
|
37154
37318
|
}, "on-dblclick": (e) => {
|
|
37155
|
-
|
|
37156
|
-
|
|
37157
|
-
|
|
37158
|
-
|
|
37159
|
-
|
|
37160
|
-
|
|
37161
|
-
|
|
37162
|
-
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
37170
|
-
|
|
37171
|
-
|
|
37172
|
-
|
|
37173
|
-
|
|
37174
|
-
|
|
37175
|
-
|
|
37176
|
-
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
|
|
37186
|
-
|
|
37319
|
+
var _a;
|
|
37320
|
+
((_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);
|
|
37321
|
+
}, className: 'gn-datagrid-body-row' +
|
|
37322
|
+
(hasChild ? ' has-child' : '') +
|
|
37323
|
+
(row.isOpened ? '' : ' is-collapsed') +
|
|
37324
|
+
(depth > 0 && !isOpened ? ' is-hidden' : '') +
|
|
37325
|
+
(row.color ? ` ${row.color}` : '') +
|
|
37326
|
+
horizontalClass, style: {
|
|
37327
|
+
'grid-template-columns': this._isHorizontalState() ? '' : this._columnsTemplate.join(' ')
|
|
37328
|
+
}, id: this._uid + '-row-' + _index, "data-depth": depth },
|
|
37329
|
+
this._isHorizontalState() && this._hidden.renderHorizontalCardHeader(row, _index, hasChild, isCheck),
|
|
37330
|
+
columns.map((col, idx) => {
|
|
37331
|
+
const cellStyle = {};
|
|
37332
|
+
if (col.bodyStyle || col.style) {
|
|
37333
|
+
each(col.bodyStyle || col.style, (value, key) => {
|
|
37334
|
+
if (key !== 'width') {
|
|
37335
|
+
cellStyle[key] = value;
|
|
37336
|
+
}
|
|
37337
|
+
});
|
|
37338
|
+
}
|
|
37339
|
+
if (idx === 0 && depth !== 0) {
|
|
37340
|
+
cellStyle.paddingLeft = depth * 15 + 10 + 'px';
|
|
37341
|
+
}
|
|
37342
|
+
if (isIE) {
|
|
37343
|
+
cellStyle.display = 'inline-block';
|
|
37344
|
+
}
|
|
37345
|
+
if (col.key === 'btnOrder') {
|
|
37346
|
+
cellStyle.display = 'flex';
|
|
37347
|
+
cellStyle.padding = '0';
|
|
37348
|
+
cellStyle['justify-content'] = 'space-evenly';
|
|
37349
|
+
cellStyle['align-items'] = 'center';
|
|
37350
|
+
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) => {
|
|
37351
|
+
this._hidden.stopRowSelectEvent(e);
|
|
37187
37352
|
} },
|
|
37188
|
-
createElement$1("
|
|
37189
|
-
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37194
|
-
|
|
37195
|
-
|
|
37196
|
-
|
|
37197
|
-
|
|
37198
|
-
|
|
37353
|
+
createElement$1("span", { className: 'gn-icon btn-order ' + (_index == 0 ? 'is-cancel' : 'is-info'), "on-click": () => {
|
|
37354
|
+
!this.$options.disabled && this._hidden.moveRowUp.call(this, _index);
|
|
37355
|
+
} },
|
|
37356
|
+
createElement$1("i", { className: "fas fa-arrow-circle-up" })),
|
|
37357
|
+
createElement$1("span", { className: 'gn-icon btn-order ' + (_index == this.$options.data.length - 1 ? 'is-cancel' : 'is-info'), "on-click": () => {
|
|
37358
|
+
!this.$options.disabled && this._hidden.moveRowDown.call(this, _index);
|
|
37359
|
+
} },
|
|
37360
|
+
createElement$1("i", { className: "fas fa-arrow-circle-down" }))));
|
|
37361
|
+
}
|
|
37362
|
+
if (col.key === 'btnDelete') {
|
|
37363
|
+
cellStyle.display = 'flex';
|
|
37364
|
+
cellStyle['justify-content'] = 'center';
|
|
37365
|
+
cellStyle['align-items'] = 'center';
|
|
37366
|
+
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) => {
|
|
37367
|
+
this._hidden.stopRowSelectEvent(e);
|
|
37199
37368
|
} },
|
|
37200
|
-
createElement$1("
|
|
37201
|
-
|
|
37202
|
-
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
|
|
37210
|
-
|
|
37211
|
-
|
|
37212
|
-
|
|
37213
|
-
|
|
37214
|
-
|
|
37369
|
+
createElement$1("span", { className: "gn-icon is-small is-mono", "on-click": () => {
|
|
37370
|
+
!this.$options.disabled && this._hidden.deleteRow.call(this, _index);
|
|
37371
|
+
} },
|
|
37372
|
+
createElement$1("i", { className: "fas fa-trash" }))));
|
|
37373
|
+
}
|
|
37374
|
+
return (createElement$1("div", { className: 'gn-datagrid-body-cell ' +
|
|
37375
|
+
(col.bodyClass ? col.bodyClass : col.className ? col.className : '') +
|
|
37376
|
+
(isFunction(col.onSelect) ? ' is-selectable' : '') +
|
|
37377
|
+
(col.isHidden ? ' is-unvisible' : '') +
|
|
37378
|
+
(this._isHorizontalState() ? ' is-horizontal' : ''), "data-key": col.key, style: cellStyle, "on-click": (e) => {
|
|
37379
|
+
col.onSelect && !this.$options.disabled && this._hidden.selectCell.call(this, col, row, _index, e);
|
|
37380
|
+
}, "on-mouseenter": (e) => {
|
|
37381
|
+
col.onHover && !this.$options.disabled && this._hidden.hoverCell.call(this, col, row, _index, e);
|
|
37382
|
+
}, "on-mouseleave": (e) => {
|
|
37383
|
+
col.offHover && this._hidden.blurCell.call(this, col, row, _index, e);
|
|
37384
|
+
}, 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)));
|
|
37385
|
+
})));
|
|
37386
|
+
},
|
|
37387
|
+
renderHorizontalCellLabel: (col) => {
|
|
37388
|
+
if (this._isSystemAddedColumn(col.key)) {
|
|
37389
|
+
return null;
|
|
37390
|
+
}
|
|
37391
|
+
return createElement$1("span", { className: "gn-datagrid-cell-label" }, col.label);
|
|
37392
|
+
},
|
|
37393
|
+
renderHorizontalCardHeader: (row, index, hasChild, isCheck) => {
|
|
37394
|
+
const hasHeader = this.$options.hasCheck || (this.$options.hasDelete && !this.$options.readonly);
|
|
37395
|
+
const showCheck = this.$options.hasCheck && row.noCheck !== true && row.noCheck !== 'true';
|
|
37396
|
+
const showDelete = this.$options.hasDelete && !this.$options.readonly;
|
|
37397
|
+
if (!hasHeader) {
|
|
37398
|
+
return null;
|
|
37399
|
+
}
|
|
37400
|
+
return (createElement$1("div", { className: "gn-datagrid-card-header" },
|
|
37401
|
+
createElement$1("div", { className: "gn-datagrid-card-header-left" }, showCheck && (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
|
|
37402
|
+
createElement$1("input", { type: "checkbox", id: this._uid + '-row-check-' + index, className: "is-rowChecker", "on-click": (e) => {
|
|
37403
|
+
this._hidden.check.call(this, row, e);
|
|
37404
|
+
}, defaultChecked: isCheck, disabled: this.$options.disabled || row.disabled })))),
|
|
37405
|
+
createElement$1("div", { className: "gn-datagrid-card-header-right" }, showDelete && (createElement$1("span", { className: "gn-icon is-small is-mono", "on-click": (e) => {
|
|
37406
|
+
this._hidden.stopRowSelectEvent(e);
|
|
37407
|
+
!this.$options.disabled && this._hidden.deleteRow.call(this, index);
|
|
37408
|
+
} },
|
|
37409
|
+
createElement$1("i", { className: "fas fa-trash" }))))));
|
|
37410
|
+
},
|
|
37411
|
+
renderCellValue: (row, col, idx, hasChild, isCheck, _index) => {
|
|
37215
37412
|
return [
|
|
37216
|
-
idx === 0 && hasChild ? (createElement$1("span", { className: "is-toggler", "on-click": (e) => {
|
|
37413
|
+
idx === 0 && hasChild && !this._isHorizontalState() ? (createElement$1("span", { className: "is-toggler", "on-click": (e) => {
|
|
37217
37414
|
!this.$options.disabled && this._hidden.toggle.call(this, row, e);
|
|
37218
37415
|
} })) : (''),
|
|
37219
|
-
idx === 0 && this.$options.hasCheck && row.noCheck !== true && row.noCheck !== 'true' ? (createElement$1("label", { className: "gn-checkbox is-no-padding", style: { width: '20px' } },
|
|
37416
|
+
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' } },
|
|
37220
37417
|
createElement$1("input", { type: "checkbox", id: this._uid + '-row-check-' + _index, className: "is-rowChecker", "on-click": (e) => {
|
|
37221
37418
|
this._hidden.check.call(this, row, e);
|
|
37222
37419
|
}, defaultChecked: isCheck, disabled: this.$options.disabled || row.disabled }))) : (''),
|
|
37223
37420
|
col.template ? createElement$1("span", { className: "gn-datagrid-cell", innerHTML: col.template(col.key, row, col) }) : row[col.key] !== undefined ? row[col.key] : ''
|
|
37224
37421
|
];
|
|
37225
37422
|
},
|
|
37423
|
+
renderCell: (row, col, idx, hasChild, isCheck, _index) => {
|
|
37424
|
+
if (this._isHorizontalState()) {
|
|
37425
|
+
return [this._hidden.renderHorizontalCellLabel(col), createElement$1("div", { className: "gn-datagrid-cell-value" }, this._hidden.renderCellValue(row, col, idx, hasChild, isCheck, _index))];
|
|
37426
|
+
}
|
|
37427
|
+
return this._hidden.renderCellValue(row, col, idx, hasChild, isCheck, _index);
|
|
37428
|
+
},
|
|
37226
37429
|
renderNodata: () => {
|
|
37227
37430
|
return (createElement$1("div", { className: "gn-datagrid-body-row is-nodata" },
|
|
37228
37431
|
createElement$1("div", { className: "gn-datagrid-body-cell has-text-center" }, this.$options.textSets.noData)));
|
|
@@ -37308,7 +37511,10 @@ class DataGrid extends GNCoreInstance {
|
|
|
37308
37511
|
});
|
|
37309
37512
|
this.$event(this, 'onCheckAll', e.target.checked);
|
|
37310
37513
|
},
|
|
37311
|
-
showDetail(index, headerKeys, rawDataKeys) {
|
|
37514
|
+
showDetail: (index, headerKeys, rawDataKeys) => {
|
|
37515
|
+
if (this._isHorizontalState()) {
|
|
37516
|
+
return;
|
|
37517
|
+
}
|
|
37312
37518
|
const rows = findAll(`.gn-datagrid-body > .gn-datagrid-body-row`, this.$el);
|
|
37313
37519
|
const row = rows[+index];
|
|
37314
37520
|
if (next(row) && hasClass(next(row), 'gn-datagrid-body-row-detail')) {
|
|
@@ -37395,6 +37601,7 @@ class DataGrid extends GNCoreInstance {
|
|
|
37395
37601
|
},
|
|
37396
37602
|
reRender: ({ headers, data, hasCheck }) => {
|
|
37397
37603
|
return new Promise(resolve => {
|
|
37604
|
+
this._refreshOrientationState(this.$options);
|
|
37398
37605
|
if (hasCheck === undefined) {
|
|
37399
37606
|
hasCheck = this.$options.hasCheck;
|
|
37400
37607
|
}
|
|
@@ -37603,8 +37810,8 @@ class DataGrid extends GNCoreInstance {
|
|
|
37603
37810
|
visibles.forEach((visible, index) => {
|
|
37604
37811
|
const colNumber = index + 1;
|
|
37605
37812
|
!visible
|
|
37606
|
-
? addClass(findAll(
|
|
37607
|
-
: removeClass(findAll(
|
|
37813
|
+
? addClass(findAll(`.gn-datagrid-body-cell[data-key="${this.$options.headers[index].key}"]`, this.$el), 'is-unvisible')
|
|
37814
|
+
: removeClass(findAll(`.gn-datagrid-body-cell[data-key="${this.$options.headers[index].key}"]`, this.$el), 'is-unvisible');
|
|
37608
37815
|
!visible
|
|
37609
37816
|
? addClass(findAll('.gn-datagrid-header-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible')
|
|
37610
37817
|
: removeClass(findAll('.gn-datagrid-header-cell:nth-child(' + colNumber + ')', this.$el), 'is-unvisible');
|
|
@@ -37649,6 +37856,13 @@ class DataGrid extends GNCoreInstance {
|
|
|
37649
37856
|
removeClass(this.$el, 'is-disabled');
|
|
37650
37857
|
}
|
|
37651
37858
|
};
|
|
37859
|
+
this._orientationState = {
|
|
37860
|
+
orientation: 'vertical',
|
|
37861
|
+
columns: 1,
|
|
37862
|
+
gap: 0,
|
|
37863
|
+
minWidth: 240,
|
|
37864
|
+
hasGap: false
|
|
37865
|
+
};
|
|
37652
37866
|
this.config = {
|
|
37653
37867
|
width: '100%',
|
|
37654
37868
|
hasCheck: false,
|
|
@@ -37663,6 +37877,7 @@ class DataGrid extends GNCoreInstance {
|
|
|
37663
37877
|
deleteLabel: '',
|
|
37664
37878
|
deleteConfirmMessage: ''
|
|
37665
37879
|
},
|
|
37880
|
+
orientation: 'vertical',
|
|
37666
37881
|
childField: 'child',
|
|
37667
37882
|
checkCapturing: true,
|
|
37668
37883
|
sort: {
|
|
@@ -37683,10 +37898,10 @@ class DataGrid extends GNCoreInstance {
|
|
|
37683
37898
|
onDelete: true
|
|
37684
37899
|
};
|
|
37685
37900
|
this.methods = {
|
|
37686
|
-
reRender(options) {
|
|
37901
|
+
reRender: (options) => {
|
|
37687
37902
|
return this._hidden.reRender(options);
|
|
37688
37903
|
},
|
|
37689
|
-
resetData(data) {
|
|
37904
|
+
resetData: (data) => {
|
|
37690
37905
|
if (isFunction(data)) {
|
|
37691
37906
|
this.$options.asyncData = data;
|
|
37692
37907
|
data = [];
|
|
@@ -37695,45 +37910,60 @@ class DataGrid extends GNCoreInstance {
|
|
|
37695
37910
|
}
|
|
37696
37911
|
return this._hidden.resetData(arrClone(data));
|
|
37697
37912
|
},
|
|
37698
|
-
addChild(index, data) {
|
|
37913
|
+
addChild: (index, data) => {
|
|
37914
|
+
if (this._isHorizontalState()) {
|
|
37915
|
+
return;
|
|
37916
|
+
}
|
|
37699
37917
|
this._hidden.addChild(index, arrClone(data));
|
|
37700
37918
|
},
|
|
37701
|
-
addRow(data) {
|
|
37919
|
+
addRow: (data) => {
|
|
37920
|
+
if (this._isHorizontalState()) {
|
|
37921
|
+
return;
|
|
37922
|
+
}
|
|
37702
37923
|
this._hidden.addChild(null, arrClone(data));
|
|
37703
37924
|
this.$options.data = this.$options.data.concat(data);
|
|
37704
37925
|
},
|
|
37705
|
-
expand(index) {
|
|
37926
|
+
expand: (index) => {
|
|
37927
|
+
if (this._isHorizontalState()) {
|
|
37928
|
+
return;
|
|
37929
|
+
}
|
|
37706
37930
|
this._hidden.expand(index);
|
|
37707
37931
|
},
|
|
37708
|
-
collapse(index) {
|
|
37932
|
+
collapse: (index) => {
|
|
37933
|
+
if (this._isHorizontalState()) {
|
|
37934
|
+
return;
|
|
37935
|
+
}
|
|
37709
37936
|
this._hidden.collapse(index);
|
|
37710
37937
|
},
|
|
37711
|
-
getChecked() {
|
|
37938
|
+
getChecked: () => {
|
|
37712
37939
|
return this._hidden.getChecked();
|
|
37713
37940
|
},
|
|
37714
|
-
hideCols(keys) {
|
|
37941
|
+
hideCols: (keys) => {
|
|
37715
37942
|
this._hidden.hideCols(keys);
|
|
37716
37943
|
},
|
|
37717
|
-
showCols(keys) {
|
|
37944
|
+
showCols: (keys) => {
|
|
37718
37945
|
this._hidden.showCols(keys);
|
|
37719
37946
|
},
|
|
37720
|
-
showAll() {
|
|
37947
|
+
showAll: () => {
|
|
37721
37948
|
this._hidden.showAll();
|
|
37722
37949
|
},
|
|
37723
|
-
showDetail(index, headerKeys, rawDataKeys) {
|
|
37950
|
+
showDetail: (index, headerKeys, rawDataKeys) => {
|
|
37951
|
+
if (this._isHorizontalState()) {
|
|
37952
|
+
return;
|
|
37953
|
+
}
|
|
37724
37954
|
this._hidden.showDetail.call(this, index, headerKeys, rawDataKeys);
|
|
37725
37955
|
},
|
|
37726
|
-
selectRow(index, rowData) {
|
|
37956
|
+
selectRow: (index, rowData) => {
|
|
37727
37957
|
let row = rowData;
|
|
37728
37958
|
if (!row) {
|
|
37729
37959
|
row = this.$options.data[index];
|
|
37730
37960
|
}
|
|
37731
37961
|
!this.$options.disable && this._hidden.selectRow(row, index);
|
|
37732
37962
|
},
|
|
37733
|
-
disable() {
|
|
37963
|
+
disable: () => {
|
|
37734
37964
|
this._hidden.disable();
|
|
37735
37965
|
},
|
|
37736
|
-
enable() {
|
|
37966
|
+
enable: () => {
|
|
37737
37967
|
this._hidden.enable();
|
|
37738
37968
|
}
|
|
37739
37969
|
};
|
|
@@ -37786,6 +38016,34 @@ class DataGrid extends GNCoreInstance {
|
|
|
37786
38016
|
});
|
|
37787
38017
|
}
|
|
37788
38018
|
}
|
|
38019
|
+
// 렌더에서 바로 쓸 수 있는 orientation 상태를 만든다.
|
|
38020
|
+
_resolveOrientationState(config = this.$options) {
|
|
38021
|
+
var _a, _b, _c, _d, _e;
|
|
38022
|
+
const orientation = (config === null || config === void 0 ? void 0 : config.orientation) === 'horizontal' ? 'horizontal' : 'vertical';
|
|
38023
|
+
const optionColumns = (_a = config === null || config === void 0 ? void 0 : config.orientationOptions) === null || _a === void 0 ? void 0 : _a.columns;
|
|
38024
|
+
const columns = optionColumns === 'auto-fit' ? optionColumns : Number.isInteger(Number(optionColumns)) && Number(optionColumns) > 0 ? Number(optionColumns) : 1;
|
|
38025
|
+
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;
|
|
38026
|
+
const isZeroLikeGap = optionGap === 0 || optionGap === '0' || optionGap === '0px' || optionGap === '';
|
|
38027
|
+
const gap = columns === 'auto-fit' && isZeroLikeGap ? '5px' : isZeroLikeGap ? 0 : typeof optionGap === 'number' ? optionGap + 'px' : optionGap;
|
|
38028
|
+
const rawMinWidth = (_e = (_d = config.orientationOptions) === null || _d === void 0 ? void 0 : _d.minWidth) !== null && _e !== void 0 ? _e : 240;
|
|
38029
|
+
const minWidth = typeof rawMinWidth === 'number' ? rawMinWidth + 'px' : rawMinWidth;
|
|
38030
|
+
return {
|
|
38031
|
+
orientation,
|
|
38032
|
+
columns,
|
|
38033
|
+
gap,
|
|
38034
|
+
minWidth,
|
|
38035
|
+
hasGap: gap !== 0
|
|
38036
|
+
};
|
|
38037
|
+
}
|
|
38038
|
+
// 실제 옵션이 갱신될 때 내부 orientation 상태를 새로 계산한다.
|
|
38039
|
+
_refreshOrientationState(config = this.$options) {
|
|
38040
|
+
this._orientationState = this._resolveOrientationState(config);
|
|
38041
|
+
return this._orientationState;
|
|
38042
|
+
}
|
|
38043
|
+
// 내부 렌더 분기에서는 orientationState만 기준으로 사용한다.
|
|
38044
|
+
_isHorizontalState() {
|
|
38045
|
+
return this._orientationState.orientation === 'horizontal';
|
|
38046
|
+
}
|
|
37789
38047
|
_isSystemAddedColumn(key) {
|
|
37790
38048
|
return ['btnOrder', 'btnDelete'].includes(key);
|
|
37791
38049
|
}
|
|
@@ -37793,6 +38051,10 @@ class DataGrid extends GNCoreInstance {
|
|
|
37793
38051
|
_prepareHeaders(headers = []) {
|
|
37794
38052
|
const hasOrderColumn = headers.some((header) => header.key === 'btnOrder');
|
|
37795
38053
|
const hasDeleteColumn = headers.some((header) => header.key === 'btnDelete');
|
|
38054
|
+
const horizontal = this._isHorizontalState();
|
|
38055
|
+
if (horizontal) {
|
|
38056
|
+
headers = headers.map((header) => (Object.assign(Object.assign({}, header), { sortable: false, draggable: false })));
|
|
38057
|
+
}
|
|
37796
38058
|
if (this.$options.hasOrder && !this.$options.readonly && !hasOrderColumn) {
|
|
37797
38059
|
headers.push({
|
|
37798
38060
|
label: this.$options.textSets.orderLabel,
|
|
@@ -37802,7 +38064,7 @@ class DataGrid extends GNCoreInstance {
|
|
|
37802
38064
|
}
|
|
37803
38065
|
});
|
|
37804
38066
|
}
|
|
37805
|
-
if (this.$options.hasDelete && !this.$options.readonly && !hasDeleteColumn) {
|
|
38067
|
+
if (this.$options.hasDelete && !this.$options.readonly && !hasDeleteColumn && !horizontal) {
|
|
37806
38068
|
headers.push({
|
|
37807
38069
|
label: this.$options.textSets.deleteLabel,
|
|
37808
38070
|
key: 'btnDelete',
|
|
@@ -37815,9 +38077,14 @@ class DataGrid extends GNCoreInstance {
|
|
|
37815
38077
|
return headers;
|
|
37816
38078
|
}
|
|
37817
38079
|
template(config) {
|
|
38080
|
+
const resolvedConfig = Object.assign(Object.assign({}, this.$options), config);
|
|
38081
|
+
this._refreshOrientationState(resolvedConfig);
|
|
38082
|
+
const contentsMarginTop = this.$options.bodyTopMargin ? this.$options.bodyTopMargin : this._isHorizontalState() && this._orientationState.hasGap ? String(this._orientationState.gap) : '0';
|
|
37818
38083
|
const styles = {};
|
|
37819
38084
|
const headers = this._prepareHeaders(config.headers);
|
|
37820
38085
|
return (createElement$1("div", { id: this._uid, className: 'gn-datagrid' +
|
|
38086
|
+
(this._isHorizontalState() ? ' is-horizontal' : '') +
|
|
38087
|
+
(this._isHorizontalState() && this._orientationState.hasGap ? ' has-horizontal-gap' : '') +
|
|
37821
38088
|
(config.style ? ' is-' + config.style : '') +
|
|
37822
38089
|
(config.isEllipsis ? ' is-ellipsis' : '') +
|
|
37823
38090
|
(config.bodyHeight ? ' has-fixed-body' : '') +
|
|
@@ -37827,7 +38094,7 @@ class DataGrid extends GNCoreInstance {
|
|
|
37827
38094
|
(config.data.some((d) => isArray$1(d[this.$options.childField])) ? ' has-left-padding' : '') +
|
|
37828
38095
|
(config.disabled ? ' is-disabled' : ''), style: styles },
|
|
37829
38096
|
config.hasHeader && createElement$1("div", { className: "gn-datagrid-header" }, this._hidden.renderHeader(headers)),
|
|
37830
|
-
createElement$1("div", { className: "gn-datagrid-contents", style: { marginTop:
|
|
38097
|
+
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)),
|
|
37831
38098
|
config.paginator /* 페이지네이터 옵션 확인 */ && createElement$1("div", { className: "gn-datagrid-footer" })));
|
|
37832
38099
|
}
|
|
37833
38100
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -37844,7 +38111,12 @@ class DataGrid extends GNCoreInstance {
|
|
|
37844
38111
|
}
|
|
37845
38112
|
}
|
|
37846
38113
|
completed() {
|
|
37847
|
-
|
|
38114
|
+
const isHorizontal = this._isHorizontalState();
|
|
38115
|
+
const isVertical = !isHorizontal;
|
|
38116
|
+
const usesFixedHeader = this.$options.fixHeader && this.$options.hasHeader;
|
|
38117
|
+
const needsBlankHeader = usesFixedHeader || this.$options.bodyHeight;
|
|
38118
|
+
isHorizontal ? addClass(this.$el, 'is-horizontal') : removeClass(this.$el, 'is-horizontal');
|
|
38119
|
+
if (usesFixedHeader && isVertical) {
|
|
37848
38120
|
const body = find('.gn-datagrid-contents', this.$el);
|
|
37849
38121
|
const header = find('.gn-datagrid-header', this.$el);
|
|
37850
38122
|
if (header) {
|
|
@@ -37857,7 +38129,7 @@ class DataGrid extends GNCoreInstance {
|
|
|
37857
38129
|
css$1(body, 'margin-bottom', this.$options.bodyBottomMargin);
|
|
37858
38130
|
}
|
|
37859
38131
|
}
|
|
37860
|
-
if (
|
|
38132
|
+
if (isVertical && needsBlankHeader) {
|
|
37861
38133
|
this._hidden.setBlankHeader();
|
|
37862
38134
|
on(window, 'resize', this._hidden.setBlankHeader);
|
|
37863
38135
|
}
|
|
@@ -37893,7 +38165,7 @@ class DataList extends GNCoreInstance {
|
|
|
37893
38165
|
color: (this.$options.readonly ? 'info' : 'cancel')
|
|
37894
38166
|
};
|
|
37895
38167
|
return (createElement$1("div", { "on-dblclick": (e) => {
|
|
37896
|
-
this._hidden.doubleSelect.call(this, row, _index, e);
|
|
38168
|
+
this.$options.onDoubleClick && this._hidden.doubleSelect.call(this, row, _index, e);
|
|
37897
38169
|
}, 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' } },
|
|
37898
38170
|
createElement$1("ol", { className: 'gn-datalist-ol-container' }, columns.map((col, idx) => {
|
|
37899
38171
|
const cellStyle = {};
|
|
@@ -37922,9 +38194,9 @@ class DataList extends GNCoreInstance {
|
|
|
37922
38194
|
(col.bodyClass ? col.bodyClass : col.className ? col.className : '') +
|
|
37923
38195
|
(isFunction(col.onSelect) ? ' is-selectable' : '') +
|
|
37924
38196
|
(col.isHidden ? ' is-unvisible' : ''), style: cellStyle, "on-mouseenter": (e) => {
|
|
37925
|
-
this._hidden.hoverCell.call(this, col, row, _index, e);
|
|
38197
|
+
col.onHover && this._hidden.hoverCell.call(this, col, row, _index, e);
|
|
37926
38198
|
}, "on-mouseleave": (e) => {
|
|
37927
|
-
this._hidden.blurCell.call(this, col, row, _index, e);
|
|
38199
|
+
col.offHover && this._hidden.blurCell.call(this, col, row, _index, e);
|
|
37928
38200
|
}, title: !col.template && row[col.key] ? row[col.key] : '' }, this._hidden.renderCell(row, col, idx, hasChild)))));
|
|
37929
38201
|
})),
|
|
37930
38202
|
createElement$1("div", { id: this._uid + '-btn-' + index, className: "gn-datalist-btn-container" },
|
|
@@ -38335,6 +38607,10 @@ class Modal extends GNCoreInstance {
|
|
|
38335
38607
|
focus: () => {
|
|
38336
38608
|
const modal = find('.modal-content', this.$el);
|
|
38337
38609
|
modal.focus();
|
|
38610
|
+
},
|
|
38611
|
+
extra: (actionKey) => {
|
|
38612
|
+
// notify page about which extra button clicked
|
|
38613
|
+
this.$event(this, 'onExtra', actionKey);
|
|
38338
38614
|
}
|
|
38339
38615
|
};
|
|
38340
38616
|
this.config = {
|
|
@@ -38352,6 +38628,7 @@ class Modal extends GNCoreInstance {
|
|
|
38352
38628
|
hasClose: true,
|
|
38353
38629
|
hasConfirm: false,
|
|
38354
38630
|
hasCancel: false,
|
|
38631
|
+
extraButtons: [],
|
|
38355
38632
|
isModal: true,
|
|
38356
38633
|
minimized: false,
|
|
38357
38634
|
resizable: false,
|
|
@@ -38362,7 +38639,8 @@ class Modal extends GNCoreInstance {
|
|
|
38362
38639
|
this.events = {
|
|
38363
38640
|
onClose: true,
|
|
38364
38641
|
onConfirm: true,
|
|
38365
|
-
onOpen: true
|
|
38642
|
+
onOpen: true,
|
|
38643
|
+
onExtra: true
|
|
38366
38644
|
};
|
|
38367
38645
|
this.methods = {
|
|
38368
38646
|
close() {
|
|
@@ -38404,7 +38682,10 @@ class Modal extends GNCoreInstance {
|
|
|
38404
38682
|
createElement$1("i", { className: "fas fa-times" })))))),
|
|
38405
38683
|
createElement$1("div", { className: "modal-body", style: styles },
|
|
38406
38684
|
createElement$1("div", { className: "modal-body-content", style: contStyles })),
|
|
38407
|
-
(config.hasConfirm || config.hasCancel) /*
|
|
38685
|
+
(config.hasConfirm || config.hasCancel || (Array.isArray(config.extraButtons) && config.extraButtons.length > 0)) /* 확인/취소/추가버튼 옵션 확인 */ && (createElement$1("div", { className: "modal-footer has-text-center" },
|
|
38686
|
+
Array.isArray(config.extraButtons) &&
|
|
38687
|
+
config.extraButtons.length > 0 &&
|
|
38688
|
+
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))),
|
|
38408
38689
|
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)),
|
|
38409
38690
|
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)))))));
|
|
38410
38691
|
}
|
|
@@ -39199,6 +39480,7 @@ class Message extends GNCoreInstance {
|
|
|
39199
39480
|
|
|
39200
39481
|
class MenuButton extends GNCoreInstance {
|
|
39201
39482
|
constructor(name, selector, options = {}) {
|
|
39483
|
+
var _a, _b, _c, _d;
|
|
39202
39484
|
super(name, selector, options);
|
|
39203
39485
|
this._hidden = {
|
|
39204
39486
|
open: () => {
|
|
@@ -39210,7 +39492,9 @@ class MenuButton extends GNCoreInstance {
|
|
|
39210
39492
|
removeClass(this.$el, 'is-open');
|
|
39211
39493
|
},
|
|
39212
39494
|
select: (menu, e) => {
|
|
39213
|
-
|
|
39495
|
+
// cols만 있고 text가 없는 경우 cols[0]을 text로 사용 (호환성 유지)
|
|
39496
|
+
const menuText = menu.text || (isArray$1(menu === null || menu === void 0 ? void 0 : menu.cols) ? menu.cols[0] : menu.value || '');
|
|
39497
|
+
this.$event(this, 'onSelect', menu.value, menuText, menu, e);
|
|
39214
39498
|
this._hidden.close();
|
|
39215
39499
|
},
|
|
39216
39500
|
changeText: (buttonText) => {
|
|
@@ -39245,12 +39529,16 @@ class MenuButton extends GNCoreInstance {
|
|
|
39245
39529
|
// 부모 경로를 포함한 고유한 ID 생성
|
|
39246
39530
|
const currentPath = parentPath ? `${parentPath}-${index}` : `${index}`;
|
|
39247
39531
|
const uniqueId = `${this._uid}-${currentPath}`;
|
|
39532
|
+
const hasColsData = isArray$1(menu === null || menu === void 0 ? void 0 : menu.cols);
|
|
39533
|
+
const renderAsCols = !hasHtml && hasColsData;
|
|
39534
|
+
const canSelect = !hasHtml || !!menu.text;
|
|
39248
39535
|
return (createElement$1("li", { id: uniqueId, className: 'menuButton-menu' +
|
|
39249
39536
|
(this.$options.align ? ' has-text-' + this.$options.align : '') +
|
|
39250
39537
|
(canRenderChild ? ' has-submenu' : '') +
|
|
39251
39538
|
(depth > 0 ? ' is-submenu-item' : '') +
|
|
39252
39539
|
(isDisabled ? ' is-disabled' : '') +
|
|
39253
|
-
(isActived ? ' is-actived' : '')
|
|
39540
|
+
(isActived ? ' is-actived' : '') +
|
|
39541
|
+
(renderAsCols ? ' has-cols' : ''), "on-click": (e) => {
|
|
39254
39542
|
// disabled 상태이거나 자식 메뉴가 있는 경우 클릭 이벤트 처리하지 않음
|
|
39255
39543
|
if (isDisabled) {
|
|
39256
39544
|
e.stopPropagation();
|
|
@@ -39259,12 +39547,16 @@ class MenuButton extends GNCoreInstance {
|
|
|
39259
39547
|
}
|
|
39260
39548
|
// 자식 메뉴가 없는 경우에만 select 이벤트 발생
|
|
39261
39549
|
if (!canRenderChild) {
|
|
39550
|
+
if (!canSelect) {
|
|
39551
|
+
e.stopPropagation();
|
|
39552
|
+
return;
|
|
39553
|
+
}
|
|
39262
39554
|
e.stopPropagation();
|
|
39263
39555
|
this._hidden.select.call(this, menu, e);
|
|
39264
39556
|
}
|
|
39265
39557
|
}, innerHTML: hasHtml ? menu.html : '' },
|
|
39266
|
-
hasHtml ? ('') : (createElement$1("span", { className: "menuButton-menu-content" },
|
|
39267
|
-
createElement$1("span", { className: "menuButton-menu-text" }, menu.text),
|
|
39558
|
+
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" },
|
|
39559
|
+
createElement$1("span", { className: "menuButton-menu-text" }, menu.text || menu.value || ''),
|
|
39268
39560
|
canRenderChild && (createElement$1("span", { className: "menuButton-menu-arrow" },
|
|
39269
39561
|
createElement$1("i", { className: "fas fa-caret-right" }))))),
|
|
39270
39562
|
canRenderChild && this._hidden.renderMenus.call(this, menu.child, depth + 1, currentPath)));
|
|
@@ -39276,9 +39568,11 @@ class MenuButton extends GNCoreInstance {
|
|
|
39276
39568
|
};
|
|
39277
39569
|
this.config = {
|
|
39278
39570
|
textSets: {
|
|
39279
|
-
buttonText: this.$selector.
|
|
39571
|
+
buttonText: ((_a = this.$selector) === null || _a === void 0 ? void 0 : _a.cols)
|
|
39572
|
+
? (isArray$1(this.$selector.cols) ? this.$selector.cols.join(', ') : String(this.$selector.cols))
|
|
39573
|
+
: (((_b = this.$selector) === null || _b === void 0 ? void 0 : _b.textContent) || ((_c = this.$selector) === null || _c === void 0 ? void 0 : _c.text) || '')
|
|
39280
39574
|
},
|
|
39281
|
-
name: this.$selector.name,
|
|
39575
|
+
name: (_d = this.$selector) === null || _d === void 0 ? void 0 : _d.name,
|
|
39282
39576
|
data: [],
|
|
39283
39577
|
align: 'left'
|
|
39284
39578
|
};
|
|
@@ -39430,15 +39724,124 @@ class Tab extends GNCoreInstance {
|
|
|
39430
39724
|
}
|
|
39431
39725
|
|
|
39432
39726
|
class MultiTextArea extends GNCoreInstance {
|
|
39727
|
+
_isMaxLengthMessageEnabled() {
|
|
39728
|
+
return !!(this.$options.maxlength && this.$options.useMaxLengthMessage);
|
|
39729
|
+
}
|
|
39730
|
+
_getTotalLength(valueSet) {
|
|
39731
|
+
return this.$options.lang.reduce((sum, currentLang) => {
|
|
39732
|
+
const currentValue = valueSet[currentLang] || '';
|
|
39733
|
+
return sum + currentValue.length;
|
|
39734
|
+
}, 0);
|
|
39735
|
+
}
|
|
39736
|
+
_getTotalLengthWithoutLang(valueSet, excludeLang) {
|
|
39737
|
+
return this.$options.lang.reduce((sum, currentLang) => {
|
|
39738
|
+
if (currentLang === excludeLang) {
|
|
39739
|
+
return sum;
|
|
39740
|
+
}
|
|
39741
|
+
const currentValue = valueSet[currentLang] || '';
|
|
39742
|
+
return sum + currentValue.length;
|
|
39743
|
+
}, 0);
|
|
39744
|
+
}
|
|
39745
|
+
_getRemainMessage(remain) {
|
|
39746
|
+
var _a, _b;
|
|
39747
|
+
const template = ((_b = (_a = this.$options) === null || _a === void 0 ? void 0 : _a.textSets) === null || _b === void 0 ? void 0 : _b.maxLengthMessage) || '{{maxlength}}자 입력 가능합니다.';
|
|
39748
|
+
return template.replace(/\{\{\s*maxlength\s*\}\}/g, String(remain));
|
|
39749
|
+
}
|
|
39433
39750
|
constructor(name, selector, options = {}) {
|
|
39434
39751
|
super(name, selector, options);
|
|
39435
39752
|
this._hidden = {
|
|
39753
|
+
beforeInput: (e) => {
|
|
39754
|
+
var _a, _b;
|
|
39755
|
+
if (!this.$options.maxlength || !this._isMaxLengthMessageEnabled()) {
|
|
39756
|
+
return;
|
|
39757
|
+
}
|
|
39758
|
+
const target = e.target;
|
|
39759
|
+
const lang = data(target, 'data-lang');
|
|
39760
|
+
if (!lang) {
|
|
39761
|
+
return;
|
|
39762
|
+
}
|
|
39763
|
+
if (e.inputType && e.inputType.startsWith('delete')) {
|
|
39764
|
+
return;
|
|
39765
|
+
}
|
|
39766
|
+
const currentValue = val(target) || '';
|
|
39767
|
+
const selectionStart = typeof target.selectionStart === 'number' ? target.selectionStart : currentValue.length;
|
|
39768
|
+
const selectionEnd = typeof target.selectionEnd === 'number' ? target.selectionEnd : currentValue.length;
|
|
39769
|
+
const selectedLength = Math.max(0, selectionEnd - selectionStart);
|
|
39770
|
+
let insertValue = e.data || '';
|
|
39771
|
+
if (e.inputType === 'insertLineBreak' || e.inputType === 'insertParagraph') {
|
|
39772
|
+
insertValue = '\n';
|
|
39773
|
+
}
|
|
39774
|
+
if (e.inputType === 'insertFromPaste' && !insertValue) {
|
|
39775
|
+
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');
|
|
39776
|
+
insertValue = typeof pastedText === 'string' ? pastedText : '';
|
|
39777
|
+
}
|
|
39778
|
+
// 현재 언어를 제외한 나머지 언어들의 총 입력 길이를 기준으로 남은 입력 가능 길이를 계산한다.
|
|
39779
|
+
const totalLengthWithoutCurrent = this._getTotalLengthWithoutLang(this.$options.value, lang);
|
|
39780
|
+
const allowedLengthForCurrent = Math.max(0, this.$options.maxlength - totalLengthWithoutCurrent);
|
|
39781
|
+
const remainingForInsert = this.$options.maxlength - totalLengthWithoutCurrent - (currentValue.length - selectedLength);
|
|
39782
|
+
// paste는 "붙여넣기 내용 우선 반영 + 전체 결과의 뒤를 자르기" 정책을 적용한다.
|
|
39783
|
+
if (e.inputType === 'insertFromPaste') {
|
|
39784
|
+
if (remainingForInsert <= 0) {
|
|
39785
|
+
e.preventDefault();
|
|
39786
|
+
return;
|
|
39787
|
+
}
|
|
39788
|
+
const before = currentValue.slice(0, selectionStart);
|
|
39789
|
+
const after = currentValue.slice(selectionEnd);
|
|
39790
|
+
const nextValue = `${before}${insertValue}${after}`;
|
|
39791
|
+
if (nextValue.length <= allowedLengthForCurrent) {
|
|
39792
|
+
return;
|
|
39793
|
+
}
|
|
39794
|
+
e.preventDefault();
|
|
39795
|
+
const clamped = nextValue.slice(0, allowedLengthForCurrent);
|
|
39796
|
+
val(target, clamped);
|
|
39797
|
+
const nextCaret = Math.min((before + insertValue).length, clamped.length);
|
|
39798
|
+
target.setSelectionRange(nextCaret, nextCaret);
|
|
39799
|
+
trigger(target, 'input');
|
|
39800
|
+
return;
|
|
39801
|
+
}
|
|
39802
|
+
if (remainingForInsert >= insertValue.length) {
|
|
39803
|
+
return;
|
|
39804
|
+
}
|
|
39805
|
+
if (remainingForInsert <= 0) {
|
|
39806
|
+
e.preventDefault();
|
|
39807
|
+
return;
|
|
39808
|
+
}
|
|
39809
|
+
// 붙여넣기/다중 입력이 한도를 넘는 경우 허용 가능한 길이만 잘라서 반영한다.
|
|
39810
|
+
e.preventDefault();
|
|
39811
|
+
const partial = insertValue.slice(0, remainingForInsert);
|
|
39812
|
+
target.setRangeText(partial, selectionStart, selectionEnd, 'end');
|
|
39813
|
+
trigger(target, 'input');
|
|
39814
|
+
},
|
|
39436
39815
|
change: (e) => {
|
|
39437
39816
|
const target = e.target;
|
|
39438
39817
|
const lang = data(target, 'data-lang');
|
|
39439
|
-
|
|
39440
|
-
|
|
39441
|
-
|
|
39818
|
+
if (!lang) {
|
|
39819
|
+
return;
|
|
39820
|
+
}
|
|
39821
|
+
this.$options.value[lang] = val(target) || '';
|
|
39822
|
+
if (this.$options.maxlength && this._isMaxLengthMessageEnabled()) {
|
|
39823
|
+
// 총합 maxlength를 넘지 않도록 현재 언어 값만 상한선까지 보정한다.
|
|
39824
|
+
const totalLengthWithoutCurrent = this._getTotalLengthWithoutLang(this.$options.value, lang);
|
|
39825
|
+
const allowedLength = Math.max(0, this.$options.maxlength - totalLengthWithoutCurrent);
|
|
39826
|
+
const clampedValue = this.$options.value[lang].slice(0, allowedLength);
|
|
39827
|
+
if (clampedValue !== this.$options.value[lang]) {
|
|
39828
|
+
this.$options.value[lang] = clampedValue;
|
|
39829
|
+
val(target, clampedValue);
|
|
39830
|
+
}
|
|
39831
|
+
}
|
|
39832
|
+
if (this.$options.maxlength && this.$options.delegates[lang]) {
|
|
39833
|
+
const hasMaxLengthMessage = this._isMaxLengthMessageEnabled();
|
|
39834
|
+
if (hasMaxLengthMessage) {
|
|
39835
|
+
// 메시지 모드에서는 모든 탭에 동일한 "남은 글자 수" 안내를 동기화한다.
|
|
39836
|
+
const totalLength = this._getTotalLength(this.$options.value);
|
|
39837
|
+
const textValue = this._getRemainMessage(this.$options.maxlength - totalLength);
|
|
39838
|
+
this.$options.lang.forEach((targetLang) => {
|
|
39839
|
+
text$1(this.$options.delegates[targetLang], textValue);
|
|
39840
|
+
});
|
|
39841
|
+
}
|
|
39842
|
+
else {
|
|
39843
|
+
text$1(this.$options.delegates[lang], this.$options.value[lang].length);
|
|
39844
|
+
}
|
|
39442
39845
|
}
|
|
39443
39846
|
this.$event(this, 'onChange', this.$options.value);
|
|
39444
39847
|
},
|
|
@@ -39455,7 +39858,7 @@ class MultiTextArea extends GNCoreInstance {
|
|
|
39455
39858
|
}
|
|
39456
39859
|
const textInput = find(`[data-lang=${lang}]`, this.$el);
|
|
39457
39860
|
val(textInput, value[lang]);
|
|
39458
|
-
trigger(textInput, '
|
|
39861
|
+
trigger(textInput, 'input');
|
|
39459
39862
|
});
|
|
39460
39863
|
},
|
|
39461
39864
|
disable: () => {
|
|
@@ -39474,6 +39877,10 @@ class MultiTextArea extends GNCoreInstance {
|
|
|
39474
39877
|
this.config = {
|
|
39475
39878
|
lang: ['en', 'ko'],
|
|
39476
39879
|
value: {},
|
|
39880
|
+
useMaxLengthMessage: false,
|
|
39881
|
+
textSets: {
|
|
39882
|
+
maxLengthMessage: '{{maxlength}}자 입력 가능합니다.'
|
|
39883
|
+
},
|
|
39477
39884
|
delegates: {}
|
|
39478
39885
|
};
|
|
39479
39886
|
this.events = {
|
|
@@ -39498,6 +39905,12 @@ class MultiTextArea extends GNCoreInstance {
|
|
|
39498
39905
|
}
|
|
39499
39906
|
template(config) {
|
|
39500
39907
|
const styles = {};
|
|
39908
|
+
const totalLength = config.lang.reduce((sum, currentLang) => {
|
|
39909
|
+
const currentValue = config.value && config.value[currentLang] ? config.value[currentLang] : '';
|
|
39910
|
+
return sum + currentValue.length;
|
|
39911
|
+
}, 0);
|
|
39912
|
+
const hasMaxLengthMessage = this._isMaxLengthMessageEnabled();
|
|
39913
|
+
const remainMessage = config.maxlength ? this._getRemainMessage(config.maxlength - totalLength) : '';
|
|
39501
39914
|
if (config.width) {
|
|
39502
39915
|
styles.width = getUnit('width', config.width);
|
|
39503
39916
|
}
|
|
@@ -39506,11 +39919,14 @@ class MultiTextArea extends GNCoreInstance {
|
|
|
39506
39919
|
createElement$1("ul", null, config.lang.map((l, index) => (createElement$1("li", { className: index === 0 ? 'is-active' : '' },
|
|
39507
39920
|
createElement$1("a", { href: '#' + this._uid + '-' + l }, l)))))),
|
|
39508
39921
|
createElement$1("div", { id: this._uid + '_content' }, config.lang.map((l) => (createElement$1("div", { id: this._uid + '-' + l },
|
|
39509
|
-
createElement$1("textarea", { className: "gn-textarea", "data-lang": l, rows: config.rows ? config.rows : '', maxLength: config.maxlength ? config.maxlength : 524288, "on-
|
|
39510
|
-
config.maxlength && (createElement$1("
|
|
39511
|
-
createElement$1("
|
|
39512
|
-
|
|
39513
|
-
|
|
39922
|
+
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] : ''),
|
|
39923
|
+
config.maxlength && (createElement$1("div", { className: "has-text-size6" },
|
|
39924
|
+
!hasMaxLengthMessage && (createElement$1("p", null,
|
|
39925
|
+
createElement$1("span", { className: "charLen", "data-lang": l }, config.value && config.value[l] ? config.value[l].length : 0),
|
|
39926
|
+
"/",
|
|
39927
|
+
config.maxlength)),
|
|
39928
|
+
hasMaxLengthMessage && (createElement$1("p", null,
|
|
39929
|
+
createElement$1("span", { className: "charLen", "data-lang": l }, remainMessage)))))))))));
|
|
39514
39930
|
}
|
|
39515
39931
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39516
39932
|
$render(config) {
|
|
@@ -39556,9 +39972,27 @@ class Picklist extends GNCoreInstance {
|
|
|
39556
39972
|
return;
|
|
39557
39973
|
}
|
|
39558
39974
|
findAll(`.picklist-${obj} .dropdown-item`, this.$el).forEach((option) => {
|
|
39559
|
-
|
|
39975
|
+
const itemValue = data(option, 'value');
|
|
39976
|
+
const rowData = this.$options.data[obj].find((item) => item.value === itemValue);
|
|
39977
|
+
let match = false;
|
|
39978
|
+
// Implements [US-Rev-023] 다중 컬럼 모드: cols 배열의 값들을 검색
|
|
39979
|
+
if (isArray$1(rowData === null || rowData === void 0 ? void 0 : rowData.cols)) {
|
|
39980
|
+
match = rowData.cols.some((colValue) => {
|
|
39981
|
+
return includes(String(colValue).toUpperCase(), q.toUpperCase());
|
|
39982
|
+
});
|
|
39983
|
+
// value 필드도 검색 대상에 포함
|
|
39984
|
+
if (!match && rowData.value) {
|
|
39985
|
+
match = includes(String(rowData.value).toUpperCase(), q.toUpperCase());
|
|
39986
|
+
}
|
|
39987
|
+
}
|
|
39988
|
+
else {
|
|
39989
|
+
// 단일 컬럼 모드: text 또는 value 필드 검색
|
|
39990
|
+
const textValue = text$1(find('.dropdown-text', option));
|
|
39991
|
+
match = includes(data(option, 'value').toUpperCase(), q.toUpperCase()) || includes(textValue.toUpperCase(), q.toUpperCase());
|
|
39992
|
+
}
|
|
39993
|
+
if (!match) {
|
|
39560
39994
|
css$1(option, 'display', 'none');
|
|
39561
|
-
this.$options.data[`filtered-${obj}`] = this.$options.data[`filtered-${obj}`].filter((e) => e.value !==
|
|
39995
|
+
this.$options.data[`filtered-${obj}`] = this.$options.data[`filtered-${obj}`].filter((e) => e.value !== itemValue);
|
|
39562
39996
|
}
|
|
39563
39997
|
});
|
|
39564
39998
|
},
|
|
@@ -39667,9 +40101,20 @@ class Picklist extends GNCoreInstance {
|
|
|
39667
40101
|
isArray$1(addArr) &&
|
|
39668
40102
|
addArr.forEach((option) => {
|
|
39669
40103
|
const _index = source.findIndex((select) => {
|
|
39670
|
-
|
|
40104
|
+
const valueMatch = option.value === select.value;
|
|
40105
|
+
if (isArray$1(option === null || option === void 0 ? void 0 : option.cols)) {
|
|
40106
|
+
if (!isArray$1(select === null || select === void 0 ? void 0 : select.cols) || select.cols.length !== option.cols.length) {
|
|
40107
|
+
return false;
|
|
40108
|
+
}
|
|
40109
|
+
const colsMatch = option.cols.every((col, idx) => col === select.cols[idx]);
|
|
40110
|
+
return valueMatch && colsMatch;
|
|
40111
|
+
}
|
|
40112
|
+
return valueMatch && option.text === select.text;
|
|
39671
40113
|
});
|
|
39672
|
-
|
|
40114
|
+
// 매칭 실패 시 (_index === -1) 마지막 항목이 제거되는 것을 방지
|
|
40115
|
+
if (_index >= 0) {
|
|
40116
|
+
target.push(source.splice(_index, 1).pop());
|
|
40117
|
+
}
|
|
39673
40118
|
});
|
|
39674
40119
|
},
|
|
39675
40120
|
reRender: (obj) => {
|
|
@@ -39679,21 +40124,32 @@ class Picklist extends GNCoreInstance {
|
|
|
39679
40124
|
},
|
|
39680
40125
|
renderSub: (item) => {
|
|
39681
40126
|
const items = this.$options.data[item] || [];
|
|
39682
|
-
|
|
40127
|
+
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));
|
|
40128
|
+
return (createElement$1("ul", { className: hasColsForList ? 'is-cols' : '' }, items.map((option, index) => {
|
|
39683
40129
|
var _a;
|
|
39684
|
-
|
|
40130
|
+
const hasHtml = !!option.html;
|
|
40131
|
+
const hasColsData = isArray$1(option === null || option === void 0 ? void 0 : option.cols);
|
|
40132
|
+
const renderAsCols = !hasHtml && hasColsData;
|
|
40133
|
+
// html이 있으면 text가 있는 항목만 선택 가능
|
|
40134
|
+
// cols가 있으면 첫 번째 컬럼을 displayText로 사용 (value가 비어도 선택 가능)
|
|
40135
|
+
const displayText = hasHtml
|
|
40136
|
+
? (option.text || '')
|
|
40137
|
+
: renderAsCols
|
|
40138
|
+
? (option.cols && option.cols.length ? String(option.cols[0]) : '')
|
|
40139
|
+
: (option.text || option.value);
|
|
40140
|
+
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
|
|
39685
40141
|
? null
|
|
39686
40142
|
: this._hidden.move.bind(this, item === 'source' ? 'add' : 'remove', [
|
|
39687
40143
|
{
|
|
39688
40144
|
value: option.value,
|
|
39689
|
-
text: option.text,
|
|
40145
|
+
text: renderAsCols ? undefined : option.text,
|
|
40146
|
+
cols: hasColsData ? option.cols : undefined,
|
|
39690
40147
|
html: (_a = option.html) !== null && _a !== void 0 ? _a : null
|
|
39691
40148
|
}
|
|
39692
|
-
]) },
|
|
39693
|
-
createElement$1("span", { className:
|
|
39694
|
-
createElement$1("
|
|
39695
|
-
|
|
39696
|
-
escapeEntity(option.text))) : (escapeEntity(option.text)))));
|
|
40149
|
+
]) }, 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,
|
|
40150
|
+
createElement$1("span", { className: 'gn-icon' + (this.$options.size ? ' is-' + this.$options.size : '') },
|
|
40151
|
+
createElement$1("i", { className: (this.isBrandIcon(option.icon) ? 'fab' : 'fa') + ` fa-${option.icon}` })),
|
|
40152
|
+
escapeEntity(option.text || option.value))) : (escapeEntity(option.text || option.value))))));
|
|
39697
40153
|
})));
|
|
39698
40154
|
},
|
|
39699
40155
|
getSelection: (target) => {
|
|
@@ -40761,41 +41217,56 @@ class Tagcloud extends GNCoreInstance {
|
|
|
40761
41217
|
class Tree extends GNCoreInstance {
|
|
40762
41218
|
constructor(name, selector, options = {}) {
|
|
40763
41219
|
super(name, selector, options);
|
|
41220
|
+
this._checkerIdSeq = 0;
|
|
40764
41221
|
this._hidden = {
|
|
40765
41222
|
select: (item, e) => {
|
|
40766
41223
|
if (item.disabled) {
|
|
40767
41224
|
return;
|
|
40768
41225
|
}
|
|
41226
|
+
if (hasClass(this.$el, 'is-disabled')) {
|
|
41227
|
+
return;
|
|
41228
|
+
}
|
|
40769
41229
|
let target = e.target;
|
|
40770
|
-
// 트리 아이콘을 클릭한 경우, 텍스트로 타겟 변경
|
|
40771
41230
|
if (this.$options.showIcon && target.tagName === 'I') {
|
|
40772
41231
|
target = parent(target);
|
|
40773
41232
|
}
|
|
40774
|
-
if (
|
|
41233
|
+
if (this.$options.hasCheck) {
|
|
41234
|
+
// hasCheck 시: 노드 클릭으로 체크박스 토글, is-active 미적용
|
|
41235
|
+
const itemEl = hasClass(target, 'tree-item') ? target : parents(target, '.tree-item')[0];
|
|
41236
|
+
if (!itemEl)
|
|
41237
|
+
return;
|
|
41238
|
+
const checker = find('.is-checker', itemEl);
|
|
41239
|
+
if (!checker)
|
|
41240
|
+
return;
|
|
41241
|
+
// 라벨 또는 input 직접 클릭 시 여기서 토글하지 않음 → input 클릭 핸들러만 한 번 실행되게 함 (이중 토글·이중 onCheck 방지)
|
|
41242
|
+
const labelTarget = parents(e.target, 'label')[0];
|
|
41243
|
+
if (e.target === checker || (labelTarget && checker.id && labelTarget.getAttribute('for') === checker.id)) {
|
|
41244
|
+
return;
|
|
41245
|
+
}
|
|
41246
|
+
checker.checked = !checker.checked;
|
|
41247
|
+
this._hidden.check.call(this, item, { target: checker, stopPropagation: () => { } });
|
|
41248
|
+
}
|
|
41249
|
+
else {
|
|
41250
|
+
// hasCheck 미사용 시: 노드 클릭 시 is-active 적용, onSelect 발생
|
|
40775
41251
|
removeClass(findAll('.tree-item', this.$el), 'is-active');
|
|
40776
41252
|
addClass(target, 'is-active');
|
|
40777
41253
|
this.$event(this, 'onSelect', item, e);
|
|
40778
41254
|
}
|
|
40779
|
-
else {
|
|
40780
|
-
toggleClass(target, 'is-active');
|
|
40781
|
-
if (hasClass(target, 'is-active')) {
|
|
40782
|
-
this.$event(this, 'onSelect', item, e);
|
|
40783
|
-
}
|
|
40784
|
-
}
|
|
40785
41255
|
},
|
|
40786
41256
|
addChild: (index, addData) => {
|
|
40787
41257
|
const itemEl = findAll('.tree-item', this.$el)[index];
|
|
40788
41258
|
const itemData = this._hidden.findData(index);
|
|
41259
|
+
const nextChildren = this._hidden.setPaths(addData.slice(), itemData.path);
|
|
40789
41260
|
if (!itemData[this.$options.childField]) {
|
|
40790
41261
|
itemData[this.$options.childField] = [];
|
|
40791
41262
|
}
|
|
40792
|
-
itemData[this.$options.childField] = itemData[this.$options.childField].concat(
|
|
41263
|
+
itemData[this.$options.childField] = itemData[this.$options.childField].concat(nextChildren);
|
|
40793
41264
|
const appendTarget = siblings(itemEl, 'ul').pop();
|
|
40794
41265
|
if (!appendTarget) {
|
|
40795
41266
|
this.$template.reRender(parent(itemEl), this._hidden.renderItem(itemData));
|
|
40796
41267
|
}
|
|
40797
41268
|
else {
|
|
40798
|
-
|
|
41269
|
+
nextChildren.forEach((item) => {
|
|
40799
41270
|
const newItem = document.createElement('li');
|
|
40800
41271
|
append(appendTarget, newItem);
|
|
40801
41272
|
this.$template.reRender(newItem, this._hidden.renderItem(item));
|
|
@@ -40826,23 +41297,57 @@ class Tree extends GNCoreInstance {
|
|
|
40826
41297
|
},
|
|
40827
41298
|
check: (item, e) => {
|
|
40828
41299
|
const target = e.target;
|
|
40829
|
-
|
|
40830
|
-
|
|
40831
|
-
|
|
40832
|
-
|
|
40833
|
-
|
|
40834
|
-
parents(target, 'ul')
|
|
40835
|
-
.map((list) => siblings(list, '.tree-item').pop())
|
|
40836
|
-
.filter((item) => item)
|
|
40837
|
-
.forEach((item) => {
|
|
40838
|
-
find('.is-checker', item).checked = true;
|
|
40839
|
-
});
|
|
41300
|
+
if (hasClass(this.$el, 'is-disabled') || item.disabled) {
|
|
41301
|
+
if (typeof e.preventDefault === 'function')
|
|
41302
|
+
e.preventDefault();
|
|
41303
|
+
target.checked = !target.checked; // 브라우저가 이미 토글했으므로 원래대로 되돌림
|
|
41304
|
+
return;
|
|
40840
41305
|
}
|
|
41306
|
+
if (typeof e.stopPropagation === 'function')
|
|
41307
|
+
e.stopPropagation();
|
|
41308
|
+
this._hidden.applyCheckedState(target, target.checked);
|
|
40841
41309
|
this.$event(this, 'onCheck', item, target.checked, this._hidden.getItemIndex(target), e);
|
|
40842
41310
|
},
|
|
40843
|
-
checkAll: () => {
|
|
41311
|
+
checkAll: (isChecked) => {
|
|
41312
|
+
if (this.$options.disabled) {
|
|
41313
|
+
return;
|
|
41314
|
+
}
|
|
40844
41315
|
findAll('.is-checker', this.$el).forEach((c) => {
|
|
40845
|
-
c.
|
|
41316
|
+
if (c.disabled) {
|
|
41317
|
+
return;
|
|
41318
|
+
}
|
|
41319
|
+
c.checked = isChecked;
|
|
41320
|
+
});
|
|
41321
|
+
},
|
|
41322
|
+
setChecked: (targets, checked) => {
|
|
41323
|
+
if (!this.$options.hasCheck || this.$options.disabled) {
|
|
41324
|
+
return;
|
|
41325
|
+
}
|
|
41326
|
+
const normalizedTargets = Array.isArray(targets) ? targets : [targets];
|
|
41327
|
+
const targetSet = new Set(normalizedTargets);
|
|
41328
|
+
findAll('.tree-item', this.$el).forEach((itemEl, index) => {
|
|
41329
|
+
const itemData = this._hidden.findData(index);
|
|
41330
|
+
const itemValue = itemData === null || itemData === void 0 ? void 0 : itemData.value;
|
|
41331
|
+
if (itemValue === undefined || itemValue === null || itemValue === '') {
|
|
41332
|
+
return;
|
|
41333
|
+
}
|
|
41334
|
+
if (!targetSet.has(String(itemValue))) {
|
|
41335
|
+
return;
|
|
41336
|
+
}
|
|
41337
|
+
const checker = find('.is-checker', itemEl);
|
|
41338
|
+
if (!checker) {
|
|
41339
|
+
return;
|
|
41340
|
+
}
|
|
41341
|
+
if (checker.disabled || (itemData === null || itemData === void 0 ? void 0 : itemData.disabled)) {
|
|
41342
|
+
return;
|
|
41343
|
+
}
|
|
41344
|
+
checker.checked = checked;
|
|
41345
|
+
this._hidden.applyCheckedState(checker, checked);
|
|
41346
|
+
});
|
|
41347
|
+
},
|
|
41348
|
+
setCheckersDisabled: (disabled) => {
|
|
41349
|
+
findAll('.is-checker', this.$el).forEach((el) => {
|
|
41350
|
+
el.disabled = disabled;
|
|
40846
41351
|
});
|
|
40847
41352
|
},
|
|
40848
41353
|
getChecked: (withStatus = false) => {
|
|
@@ -40868,14 +41373,53 @@ class Tree extends GNCoreInstance {
|
|
|
40868
41373
|
findData.__status.isOpened = hasClass(target, 'is-open');
|
|
40869
41374
|
findData.__status.isChecked = find('.is-checker', target).checked;
|
|
40870
41375
|
findData.__status.isSelected = hasClass(target, 'is-active');
|
|
40871
|
-
findData.__status.hasChildren = isArray$1(findData.
|
|
41376
|
+
findData.__status.hasChildren = isArray$1(findData[this.$options.childField]);
|
|
40872
41377
|
}
|
|
40873
41378
|
return findData;
|
|
40874
41379
|
});
|
|
40875
41380
|
},
|
|
40876
41381
|
getItemIndex: (item) => {
|
|
41382
|
+
const itemEl = hasClass(item, 'tree-item') ? item : parents(item, '.tree-item')[0];
|
|
41383
|
+
if (!itemEl) {
|
|
41384
|
+
return -1;
|
|
41385
|
+
}
|
|
40877
41386
|
const itemList = findAll('.tree-item', this.$el);
|
|
40878
|
-
return itemList.findIndex((el) => el ==
|
|
41387
|
+
return itemList.findIndex((el) => el == itemEl);
|
|
41388
|
+
},
|
|
41389
|
+
applyCheckedState: (checker, checked) => {
|
|
41390
|
+
const listItem = parents(checker, 'li')[0];
|
|
41391
|
+
if (!listItem) {
|
|
41392
|
+
return;
|
|
41393
|
+
}
|
|
41394
|
+
if (this.$options.checkChild !== false) {
|
|
41395
|
+
findAll('.is-checker', listItem).forEach((childChecker) => {
|
|
41396
|
+
if (childChecker.disabled) {
|
|
41397
|
+
return;
|
|
41398
|
+
}
|
|
41399
|
+
childChecker.checked = checked;
|
|
41400
|
+
});
|
|
41401
|
+
}
|
|
41402
|
+
if (!this.$options.checkPath) {
|
|
41403
|
+
return;
|
|
41404
|
+
}
|
|
41405
|
+
parents(checker, 'ul')
|
|
41406
|
+
.map((list) => siblings(list, '.tree-item').pop())
|
|
41407
|
+
.filter((item) => item)
|
|
41408
|
+
.forEach((item) => {
|
|
41409
|
+
const parentChecker = find('.is-checker', item);
|
|
41410
|
+
if (!parentChecker) {
|
|
41411
|
+
return;
|
|
41412
|
+
}
|
|
41413
|
+
const parentLi = parents(item, 'li')[0];
|
|
41414
|
+
if (!parentLi) {
|
|
41415
|
+
return;
|
|
41416
|
+
}
|
|
41417
|
+
const descendantCheckers = findAll('.is-checker', parentLi).filter((candidate) => candidate !== parentChecker);
|
|
41418
|
+
if (!descendantCheckers.length) {
|
|
41419
|
+
return;
|
|
41420
|
+
}
|
|
41421
|
+
parentChecker.checked = descendantCheckers.some((candidate) => candidate.checked);
|
|
41422
|
+
});
|
|
40879
41423
|
},
|
|
40880
41424
|
getPathArray(path) {
|
|
40881
41425
|
const pathParts = path.split('/');
|
|
@@ -40954,34 +41498,46 @@ class Tree extends GNCoreInstance {
|
|
|
40954
41498
|
}
|
|
40955
41499
|
this.$event(this, 'onToggle', item, hasClass(target, 'is-open') ? 'expanded' : 'collapsed', this._hidden.getItemIndex(target), e);
|
|
40956
41500
|
},
|
|
40957
|
-
renderTree: (data) => {
|
|
40958
|
-
return (createElement$1("ul", null, data.map((item) => {
|
|
40959
|
-
|
|
41501
|
+
renderTree: (data, keyPath = '') => {
|
|
41502
|
+
return (createElement$1("ul", null, data.map((item, idx) => {
|
|
41503
|
+
const itemKeyPath = keyPath ? `${keyPath}-${idx}` : `${idx}`;
|
|
41504
|
+
return this._hidden.renderItem(item, itemKeyPath);
|
|
40960
41505
|
})));
|
|
40961
41506
|
},
|
|
40962
|
-
renderItem: (item) => {
|
|
41507
|
+
renderItem: (item, keyPath) => {
|
|
40963
41508
|
var _a;
|
|
41509
|
+
const resolvedKeyPath = keyPath !== null && keyPath !== void 0 ? keyPath : `seq-${this._checkerIdSeq++}`;
|
|
41510
|
+
const checkerId = `${this._uid}-chk-${resolvedKeyPath}`;
|
|
40964
41511
|
return (createElement$1("li", null,
|
|
40965
|
-
createElement$1("div", { className: [
|
|
41512
|
+
createElement$1("div", { className: [
|
|
41513
|
+
'tree-item',
|
|
41514
|
+
item[this.$options.childField] ? 'has-child' : '',
|
|
41515
|
+
item.opened ? 'is-open' : '',
|
|
41516
|
+
!this.$options.hasCheck && item.actived ? ' is-active' : '',
|
|
41517
|
+
item.disabled ? 'is-disabled' : ''
|
|
41518
|
+
].join(' '), "on-click": this._hidden.select.bind(this, item), "data-path": (_a = item.path) !== null && _a !== void 0 ? _a : '', title: item.text },
|
|
40966
41519
|
// has child field - arrow toggle
|
|
40967
41520
|
item[this.$options.childField] ? (createElement$1("div", { className: "is-toggler", "on-click": (e) => {
|
|
40968
41521
|
this._hidden.toggle.call(this, item, e);
|
|
40969
41522
|
} })) : (''),
|
|
40970
41523
|
// has checkbox
|
|
40971
|
-
this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true' ? (createElement$1("
|
|
40972
|
-
createElement$1("input", { type: "checkbox", className: "is-checker", "on-click": (e) => {
|
|
41524
|
+
this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true' ? (createElement$1("div", { className: "gn-checks is-small is-no-padding" },
|
|
41525
|
+
createElement$1("input", { type: "checkbox", className: "is-checker", id: checkerId, disabled: !!this.$options.disabled || !!item.disabled, "on-click": (e) => {
|
|
40973
41526
|
this._hidden.check.call(this, item, e);
|
|
40974
|
-
}, defaultChecked: !!item.selected })
|
|
41527
|
+
}, defaultChecked: !!item.selected }),
|
|
41528
|
+
createElement$1("label", { for: checkerId }, item.text))) : (''),
|
|
40975
41529
|
// show icon
|
|
40976
41530
|
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') }))) : (''),
|
|
40977
|
-
item.text),
|
|
40978
|
-
item[this.$options.childField] && this._hidden.renderTree(item[this.$options.childField])));
|
|
41531
|
+
!(this.$options.hasCheck && item.noCheck !== true && item.noCheck !== 'true') && item.text),
|
|
41532
|
+
item[this.$options.childField] && this._hidden.renderTree(item[this.$options.childField], resolvedKeyPath)));
|
|
40979
41533
|
},
|
|
40980
|
-
setPaths(data, basePath = '') {
|
|
41534
|
+
setPaths: (data, basePath = '') => {
|
|
40981
41535
|
return data.map(item => {
|
|
40982
|
-
const
|
|
40983
|
-
const
|
|
40984
|
-
|
|
41536
|
+
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;
|
|
41537
|
+
const itemPath = basePath ? `${basePath}/${itemKey}` : itemKey;
|
|
41538
|
+
const children = item[this.$options.childField];
|
|
41539
|
+
const childPath = children ? this._hidden.setPaths(children, itemPath) : null;
|
|
41540
|
+
return Object.assign(Object.assign({}, item), { path: itemPath, [this.$options.childField]: childPath });
|
|
40985
41541
|
});
|
|
40986
41542
|
}
|
|
40987
41543
|
};
|
|
@@ -40992,10 +41548,11 @@ class Tree extends GNCoreInstance {
|
|
|
40992
41548
|
data: [],
|
|
40993
41549
|
childField: 'child',
|
|
40994
41550
|
hasCheck: false,
|
|
40995
|
-
|
|
41551
|
+
checkChild: true,
|
|
40996
41552
|
checkPath: false,
|
|
40997
41553
|
showIcon: false,
|
|
40998
|
-
hideIcon: false
|
|
41554
|
+
hideIcon: false,
|
|
41555
|
+
disabled: false
|
|
40999
41556
|
};
|
|
41000
41557
|
this.events = {
|
|
41001
41558
|
onSelect: true,
|
|
@@ -41020,7 +41577,19 @@ class Tree extends GNCoreInstance {
|
|
|
41020
41577
|
this._hidden.collapseAll();
|
|
41021
41578
|
},
|
|
41022
41579
|
checkAll() {
|
|
41023
|
-
this.
|
|
41580
|
+
if (!this.$options.hasCheck || this.$options.disabled)
|
|
41581
|
+
return;
|
|
41582
|
+
this._hidden.checkAll(true);
|
|
41583
|
+
},
|
|
41584
|
+
uncheckAll() {
|
|
41585
|
+
if (!this.$options.hasCheck || this.$options.disabled)
|
|
41586
|
+
return;
|
|
41587
|
+
this._hidden.checkAll(false);
|
|
41588
|
+
},
|
|
41589
|
+
setChecked(targets, checked) {
|
|
41590
|
+
if (this.$options.disabled)
|
|
41591
|
+
return;
|
|
41592
|
+
this._hidden.setChecked(targets, checked);
|
|
41024
41593
|
},
|
|
41025
41594
|
getChecked(withStatus = false) {
|
|
41026
41595
|
return this._hidden.getChecked(withStatus);
|
|
@@ -41033,14 +41602,29 @@ class Tree extends GNCoreInstance {
|
|
|
41033
41602
|
},
|
|
41034
41603
|
filter(keyword) {
|
|
41035
41604
|
return this._hidden.filter(keyword);
|
|
41605
|
+
},
|
|
41606
|
+
disable() {
|
|
41607
|
+
this.$options.disabled = true;
|
|
41608
|
+
addClass(this.$el, 'is-disabled');
|
|
41609
|
+
this._hidden.setCheckersDisabled(true);
|
|
41610
|
+
},
|
|
41611
|
+
enable() {
|
|
41612
|
+
this.$options.disabled = false;
|
|
41613
|
+
removeClass(this.$el, 'is-disabled');
|
|
41614
|
+
this._hidden.setCheckersDisabled(false);
|
|
41036
41615
|
}
|
|
41037
41616
|
};
|
|
41617
|
+
// multiple → hasCheck 치환(동일 기능으로 지원 X)
|
|
41618
|
+
if (options && options.multiple) {
|
|
41619
|
+
options.hasCheck = true;
|
|
41620
|
+
delete options.multiple;
|
|
41621
|
+
}
|
|
41038
41622
|
this.$init(this, options);
|
|
41039
41623
|
}
|
|
41040
41624
|
template(config) {
|
|
41041
41625
|
config.data = this._hidden.setPaths(config.data);
|
|
41042
41626
|
const styles = {};
|
|
41043
|
-
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 },
|
|
41627
|
+
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 },
|
|
41044
41628
|
config.textSets.title && createElement$1("p", { className: "tree-label", innerHTML: config.textSets.title }),
|
|
41045
41629
|
this._hidden.renderTree(config.data)));
|
|
41046
41630
|
}
|