devextreme-planit-treegrid-react 1.1.1 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -74,7 +74,9 @@ value가 0 | '0' | '0%' 인 데이터를 하이픈('-')으로 보여줍니다.
74
74
  groupField는 그리드 상단에 colspan 된 새로운 column을 생성합니다. 자세한 사용법은 github의 demo 폴더를 확인하십시오.
75
75
 
76
76
  ```
77
- export const TreeDataGroup: IGroupField[] = [
77
+ import { TypeDxPlanit } from 'devextreme-planit-treegrid-react';
78
+
79
+ export const TreeDataGroup: TypeDxPlanit.IGroupField[] = [
78
80
  {
79
81
  groupCaption: '진료 수입 (백만원)',
80
82
  groupName: 'mediIncome',
@@ -1,32 +1,150 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
3
+ function _typeof(obj) {
4
+ '@babel/helpers - typeof';
5
+ return (
6
+ (_typeof =
7
+ 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
8
+ ? function (obj) {
9
+ return typeof obj;
10
+ }
11
+ : function (obj) {
12
+ return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
13
+ }),
14
+ _typeof(obj)
15
+ );
16
+ }
17
+ Object.defineProperty(exports, '__esModule', {
18
+ value: true,
6
19
  });
7
20
  exports.default = void 0;
8
- var _react = require("react");
9
- var _loadPanel = require("devextreme-react/load-panel");
10
- var _pivotGrid = _interopRequireWildcard(require("devextreme-react/pivot-grid"));
11
- var _dataGrid = require("devextreme-react/data-grid");
12
- var _excel_exporter = require("devextreme/excel_exporter");
13
- var _exceljs = require("exceljs");
14
- var _fileSaver = _interopRequireDefault(require("file-saver"));
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
26
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
27
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+ var _react = require('react');
22
+ var _loadPanel = require('devextreme-react/load-panel');
23
+ var _pivotGrid = _interopRequireWildcard(require('devextreme-react/pivot-grid'));
24
+ var _dataGrid = require('devextreme-react/data-grid');
25
+ var _excel_exporter = require('devextreme/excel_exporter');
26
+ var _exceljs = require('exceljs');
27
+ var _fileSaver = _interopRequireDefault(require('file-saver'));
28
+ function _interopRequireDefault(obj) {
29
+ return obj && obj.__esModule ? obj : { default: obj };
30
+ }
31
+ function _getRequireWildcardCache(nodeInterop) {
32
+ if (typeof WeakMap !== 'function') return null;
33
+ var cacheBabelInterop = new WeakMap();
34
+ var cacheNodeInterop = new WeakMap();
35
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
36
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
37
+ })(nodeInterop);
38
+ }
39
+ function _interopRequireWildcard(obj, nodeInterop) {
40
+ if (!nodeInterop && obj && obj.__esModule) {
41
+ return obj;
42
+ }
43
+ if (obj === null || (_typeof(obj) !== 'object' && typeof obj !== 'function')) {
44
+ return { default: obj };
45
+ }
46
+ var cache = _getRequireWildcardCache(nodeInterop);
47
+ if (cache && cache.has(obj)) {
48
+ return cache.get(obj);
49
+ }
50
+ var newObj = {};
51
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
52
+ for (var key in obj) {
53
+ if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
54
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
55
+ if (desc && (desc.get || desc.set)) {
56
+ Object.defineProperty(newObj, key, desc);
57
+ } else {
58
+ newObj[key] = obj[key];
59
+ }
60
+ }
61
+ }
62
+ newObj.default = obj;
63
+ if (cache) {
64
+ cache.set(obj, newObj);
65
+ }
66
+ return newObj;
67
+ }
68
+ function _toConsumableArray(arr) {
69
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
70
+ }
71
+ function _nonIterableSpread() {
72
+ throw new TypeError(
73
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
74
+ );
75
+ }
76
+ function _iterableToArray(iter) {
77
+ if ((typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) || iter['@@iterator'] != null) return Array.from(iter);
78
+ }
79
+ function _arrayWithoutHoles(arr) {
80
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
81
+ }
82
+ function _slicedToArray(arr, i) {
83
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
84
+ }
85
+ function _nonIterableRest() {
86
+ throw new TypeError(
87
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
88
+ );
89
+ }
90
+ function _unsupportedIterableToArray(o, minLen) {
91
+ if (!o) return;
92
+ if (typeof o === 'string') return _arrayLikeToArray(o, minLen);
93
+ var n = Object.prototype.toString.call(o).slice(8, -1);
94
+ if (n === 'Object' && o.constructor) n = o.constructor.name;
95
+ if (n === 'Map' || n === 'Set') return Array.from(o);
96
+ if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
97
+ }
98
+ function _arrayLikeToArray(arr, len) {
99
+ if (len == null || len > arr.length) len = arr.length;
100
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
101
+ arr2[i] = arr[i];
102
+ }
103
+ return arr2;
104
+ }
105
+ function _iterableToArrayLimit(arr, i) {
106
+ var _i = null == arr ? null : ('undefined' != typeof Symbol && arr[Symbol.iterator]) || arr['@@iterator'];
107
+ if (null != _i) {
108
+ var _s,
109
+ _e,
110
+ _x,
111
+ _r,
112
+ _arr = [],
113
+ _n = !0,
114
+ _d = !1;
115
+ try {
116
+ if (((_x = (_i = _i.call(arr)).next), 0 === i)) {
117
+ if (Object(_i) !== _i) return;
118
+ _n = !1;
119
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {}
120
+ } catch (err) {
121
+ (_d = !0), (_e = err);
122
+ } finally {
123
+ try {
124
+ if (!_n && null != _i.return && ((_r = _i.return()), Object(_r) !== _r)) return;
125
+ } finally {
126
+ if (_d) throw _e;
127
+ }
128
+ }
129
+ return _arr;
130
+ }
131
+ }
132
+ function _arrayWithHoles(arr) {
133
+ if (Array.isArray(arr)) return arr;
134
+ }
135
+ /**
136
+ * devextreme pivotgrid Configrations 중 사용 불가 항목 : id, width, height, showColumnGrandTotals, showColumnTotals, showRowGrandTotals, FieldChooser
137
+ * devextreme pivotgrid Configrations 중 사용 방법 변경 항목 : stateStoring, Export
138
+ * onExported, onFileSaving 이벤트 사용하지 않음.
139
+ */
140
+ /**
141
+ * todoList:
142
+ * 2) columIndex 초기화 기능이 있어야 함(column 개수 변할 때)
143
+ * 3) 헤더에 테이블 삽입되면서 그리드 크기가 늘어남. height에 그리드 크기 늘어난 만큼 반영되어야 함.
144
+ */
145
+
28
146
  var grandTotalCssNm = 'data-grand-total';
29
- var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
147
+ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref) {
30
148
  var _props$id = props.id,
31
149
  id = _props$id === void 0 ? 'dx-planit-vera-pivotgrid-id' : _props$id,
32
150
  groupField = props.groupField,
@@ -101,39 +219,49 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
101
219
  var excelBorder = {
102
220
  style: 'thin',
103
221
  color: {
104
- argb: 'FF7E7E7E'
105
- }
222
+ argb: 'FF7E7E7E',
223
+ },
106
224
  };
107
225
  (0, _react.useImperativeHandle)(ref, function () {
108
226
  return {
109
- exportToExcel: exportToExcel
227
+ exportToExcel: exportToExcel,
110
228
  };
111
229
  });
112
230
 
113
- /**
114
- * 그리드 사이즈 재조정
115
- * @returns 그리드 사이즈
231
+ /**
232
+ * 그리드 사이즈 재조정
233
+ * @returns 그리드 사이즈
116
234
  */
117
235
  var getGridSize = function getGridSize() {
118
236
  var _wrapper$clientWidth;
119
237
  var wrapper = document.querySelector('.diag-table-wrapper');
120
238
  var gap = 10;
121
- setWidth((_wrapper$clientWidth = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth !== void 0 ? _wrapper$clientWidth : 0);
239
+ setWidth(
240
+ (_wrapper$clientWidth = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null &&
241
+ _wrapper$clientWidth !== void 0
242
+ ? _wrapper$clientWidth
243
+ : 0
244
+ );
122
245
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
123
246
  window.addEventListener('resize', function () {
124
247
  var _wrapper$clientWidth2;
125
- setWidth((_wrapper$clientWidth2 = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth2 !== void 0 ? _wrapper$clientWidth2 : 0);
248
+ setWidth(
249
+ (_wrapper$clientWidth2 = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null &&
250
+ _wrapper$clientWidth2 !== void 0
251
+ ? _wrapper$clientWidth2
252
+ : 0
253
+ );
126
254
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
127
255
  });
128
256
  return {
129
257
  width: width,
130
- height: height
258
+ height: height,
131
259
  };
132
260
  };
133
261
 
134
- /**
135
- * 'Total' 을 한글로 변경
136
- * @param e devextreme CellPreparedEvent
262
+ /**
263
+ * 'Total' 을 한글로 변경
264
+ * @param e devextreme CellPreparedEvent
137
265
  */
138
266
  var changeTotalText = function changeTotalText(e) {
139
267
  var _e$cell;
@@ -143,13 +271,13 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
143
271
  if (((_e$cell = e.cell) === null || _e$cell === void 0 ? void 0 : _e$cell.type) === 'T') {
144
272
  var _e$cell$text;
145
273
  var text = (_e$cell$text = e.cell.text) === null || _e$cell$text === void 0 ? void 0 : _e$cell$text.replace('Total', '합계');
146
- e.cellElement.innerHTML = "<span>".concat(text, "</span>");
274
+ e.cellElement.innerHTML = '<span>'.concat(text, '</span>');
147
275
  }
148
276
  };
149
277
 
150
- /**
151
- * null값을 하이픈으로 모두 변경
152
- * @param e devextreme CellPreparedEvent
278
+ /**
279
+ * null값을 하이픈으로 모두 변경
280
+ * @param e devextreme CellPreparedEvent
153
281
  */
154
282
  var changeNullToHipen = function changeNullToHipen(e) {
155
283
  var _e$cell2;
@@ -161,24 +289,30 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
161
289
  }
162
290
  };
163
291
 
164
- /**
165
- * '0', '0.0%' 를 하이픈으로 모두 변경
166
- * @param e devextreme CellPreparedEvent
292
+ /**
293
+ * '0', '0.0%' 를 하이픈으로 모두 변경
294
+ * @param e devextreme CellPreparedEvent
167
295
  */
168
296
  var changeZeroToHipen = function changeZeroToHipen(e) {
169
297
  var _e$cell3, _e$cell4, _e$cell5;
170
298
  if (!convertZeroToHipen) {
171
299
  return;
172
300
  }
173
- if (e.area === 'data' && (((_e$cell3 = e.cell) === null || _e$cell3 === void 0 ? void 0 : _e$cell3.text) === '0' || ((_e$cell4 = e.cell) === null || _e$cell4 === void 0 ? void 0 : _e$cell4.text) === '0.0%' || ((_e$cell5 = e.cell) === null || _e$cell5 === void 0 ? void 0 : _e$cell5.text) === '') && e.cellElement) {
301
+ if (
302
+ e.area === 'data' &&
303
+ (((_e$cell3 = e.cell) === null || _e$cell3 === void 0 ? void 0 : _e$cell3.text) === '0' ||
304
+ ((_e$cell4 = e.cell) === null || _e$cell4 === void 0 ? void 0 : _e$cell4.text) === '0.0%' ||
305
+ ((_e$cell5 = e.cell) === null || _e$cell5 === void 0 ? void 0 : _e$cell5.text) === '') &&
306
+ e.cellElement
307
+ ) {
174
308
  e.cellElement.innerHTML = '<span class="text-color">-</span>';
175
309
  }
176
310
  };
177
311
 
178
- /**
179
- * 테이블 헤더에 colspan, rowspan 한 HTMLElement 정보 반환
180
- * @param groupField 사용자가 작성한 그룹 정보
181
- * @return
312
+ /**
313
+ * 테이블 헤더에 colspan, rowspan 한 HTMLElement 정보 반환
314
+ * @param groupField 사용자가 작성한 그룹 정보
315
+ * @return
182
316
  */
183
317
  var makeColspan = function makeColspan(group, index, isLast) {
184
318
  var _group$html;
@@ -193,31 +327,33 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
193
327
  } else if (!isLast && index === 0) {
194
328
  td.setAttribute('style', 'border-bottom: 0');
195
329
  }
196
- td.innerHTML = "<span>".concat(text, "</span>");
330
+ td.innerHTML = '<span>'.concat(text, '</span>');
197
331
  return td;
198
332
  };
199
333
 
200
- /**
201
- * 그룹 필드 데이터 유효성 검증용 데이터 생성
202
- * @param groupField
203
- * @returns
334
+ /**
335
+ * 그룹 필드 데이터 유효성 검증용 데이터 생성
336
+ * @param groupField
337
+ * @returns
204
338
  */
205
339
  var makeCheckGroupData = function makeCheckGroupData(groupField) {
206
340
  var data = {};
207
- groupField === null || groupField === void 0 ? void 0 : groupField.forEach(function (group) {
208
- if (data[group.depth]) {
209
- data[group.depth] += group.colspan;
210
- } else {
211
- data[group.depth] = group.colspan;
212
- }
213
- });
341
+ groupField === null || groupField === void 0
342
+ ? void 0
343
+ : groupField.forEach(function (group) {
344
+ if (data[group.depth]) {
345
+ data[group.depth] += group.colspan;
346
+ } else {
347
+ data[group.depth] = group.colspan;
348
+ }
349
+ });
214
350
  return data;
215
351
  };
216
352
 
217
- /**
218
- * GroupField 데이터 검증
219
- * @param 사용자가 설정한 그룹 필드 정보
220
- * @returns 데이터 검증 결과
353
+ /**
354
+ * GroupField 데이터 검증
355
+ * @param 사용자가 설정한 그룹 필드 정보
356
+ * @returns 데이터 검증 결과
221
357
  */
222
358
  var isCheckGroupField = function isCheckGroupField(groupField) {
223
359
  var map = makeCheckGroupData(groupField);
@@ -230,21 +366,25 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
230
366
  return true;
231
367
  };
232
368
 
233
- /**
234
- * Grand Total 셀 정보 저장
235
- * @param e
369
+ /**
370
+ * Grand Total 셀 정보 저장
371
+ * @param e
236
372
  */
237
373
  var setTotalElementInfo = function setTotalElementInfo(e) {
238
374
  var _e$cell6, _e$cell7, _e$cellElement;
239
- if (!(groupField !== null && groupField !== void 0 && groupField.length) || ((_e$cell6 = e.cell) === null || _e$cell6 === void 0 ? void 0 : _e$cell6.type) !== 'GT' || ((_e$cell7 = e.cell) === null || _e$cell7 === void 0 ? void 0 : _e$cell7.text) !== 'Grand Total') {
375
+ if (
376
+ !(groupField !== null && groupField !== void 0 && groupField.length) ||
377
+ ((_e$cell6 = e.cell) === null || _e$cell6 === void 0 ? void 0 : _e$cell6.type) !== 'GT' ||
378
+ ((_e$cell7 = e.cell) === null || _e$cell7 === void 0 ? void 0 : _e$cell7.text) !== 'Grand Total'
379
+ ) {
240
380
  return;
241
381
  }
242
382
  (_e$cellElement = e.cellElement) === null || _e$cellElement === void 0 ? void 0 : _e$cellElement.classList.add(grandTotalCssNm);
243
383
  };
244
384
 
245
- /**
246
- * cell의 columnIndex 최대값 저장
247
- * @param e
385
+ /**
386
+ * cell의 columnIndex 최대값 저장
387
+ * @param e
248
388
  */
249
389
  var setMaxColumIndex = function setMaxColumIndex(e) {
250
390
  if (!e.columnIndex) {
@@ -255,17 +395,19 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
255
395
  }
256
396
  };
257
397
 
258
- /**
259
- * groupField depth의 유니크한 배열 구하기
260
- * @param group
261
- * @param arr
262
- * @returns
398
+ /**
399
+ * groupField depth의 유니크한 배열 구하기
400
+ * @param group
401
+ * @param arr
402
+ * @returns
263
403
  */
264
404
  var getGroupDepth = function getGroupDepth(group, arr) {
265
405
  var groupData = group.slice();
266
- var set = new Set(groupData.map(function (group) {
267
- return group.depth;
268
- }));
406
+ var set = new Set(
407
+ groupData.map(function (group) {
408
+ return group.depth;
409
+ })
410
+ );
269
411
  return Array.from(set).sort(function compare(a, b) {
270
412
  if (a > b) {
271
413
  return arr === 'asc' ? -1 : 1;
@@ -277,11 +419,11 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
277
419
  });
278
420
  };
279
421
 
280
- /**
281
- * 현재 depth에 맞는 그룹 필드 정보 반환
282
- * @param group
283
- * @param depth
284
- * @returns
422
+ /**
423
+ * 현재 depth에 맞는 그룹 필드 정보 반환
424
+ * @param group
425
+ * @param depth
426
+ * @returns
285
427
  */
286
428
  var getCurrentGroup = function getCurrentGroup(group, depth) {
287
429
  return group.filter(function (gr) {
@@ -289,8 +431,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
289
431
  });
290
432
  };
291
433
 
292
- /**
293
- * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
434
+ /**
435
+ * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
294
436
  */
295
437
  var insertRowHeaderGroup = function insertRowHeaderGroup() {
296
438
  var _thead$previousSiblin;
@@ -310,7 +452,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
310
452
  }
311
453
  totalElement.innerHTML = '';
312
454
  totalElement.setAttribute('style', 'padding: 0; border: 0');
313
- var colgroup = (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0 ? void 0 : _thead$previousSiblin.cloneNode(true);
455
+ var colgroup =
456
+ (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0
457
+ ? void 0
458
+ : _thead$previousSiblin.cloneNode(true);
314
459
  var groupData = groupField.slice();
315
460
  var depth = getGroupDepth(groupData, 'asc');
316
461
  var table = document.createElement('table');
@@ -327,10 +472,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
327
472
  totalElement.appendChild(table);
328
473
  };
329
474
 
330
- /**
331
- * Devextreme의 dateController columnInfo에 그룹 정보 삽입
332
- * @param group
333
- * @returns
475
+ /**
476
+ * Devextreme의 dateController columnInfo에 그룹 정보 삽입
477
+ * @param group
478
+ * @returns
334
479
  */
335
480
  var makeDataControllerColumnGroup = function makeDataControllerColumnGroup(group) {
336
481
  var groupData = group.slice();
@@ -341,21 +486,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
341
486
  return {
342
487
  colspan: group.colspan,
343
488
  text: group.groupCaption,
344
- type: 'GT'
489
+ type: 'GT',
345
490
  };
346
491
  });
347
492
  });
348
493
  };
349
494
 
350
- /**
351
- * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
352
- * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
353
- * @returns
495
+ /**
496
+ * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
497
+ * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
498
+ * @returns
354
499
  */
355
500
  var makeSplitCondtion = function makeSplitCondtion(condition) {
356
501
  var newCondition = {
357
502
  standard: '',
358
- condition: ''
503
+ condition: '',
359
504
  };
360
505
  _toConsumableArray(condition).forEach(function (cond) {
361
506
  if (Number.isNaN(parseFloat(cond))) {
@@ -367,10 +512,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
367
512
  return newCondition;
368
513
  };
369
514
 
370
- /**
371
- * 데이터에 색상 적용
372
- * @param e onCellPrepared 이벤트
373
- * @returns
515
+ /**
516
+ * 데이터에 색상 적용
517
+ * @param e onCellPrepared 이벤트
518
+ * @returns
374
519
  */
375
520
  var makeColorAtPercent = function makeColorAtPercent(e) {
376
521
  if (!dataColor || !e.cellElement) {
@@ -381,7 +526,14 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
381
526
  if (e.cell.value === null) {
382
527
  return;
383
528
  }
384
- if (((_e$cell8 = e.cell) === null || _e$cell8 === void 0 ? void 0 : (_e$cell8$format = _e$cell8.format) === null || _e$cell8$format === void 0 ? void 0 : _e$cell8$format.type) === color.format && !Number.isNaN(e.cell.value)) {
529
+ if (
530
+ ((_e$cell8 = e.cell) === null || _e$cell8 === void 0
531
+ ? void 0
532
+ : (_e$cell8$format = _e$cell8.format) === null || _e$cell8$format === void 0
533
+ ? void 0
534
+ : _e$cell8$format.type) === color.format &&
535
+ !Number.isNaN(e.cell.value)
536
+ ) {
385
537
  var standardData = makeSplitCondtion(color.condition.replace(/(\s*)/g, ''));
386
538
  var rate = color.format === 'percent' ? 0.01 : 1;
387
539
  var condition = false;
@@ -406,9 +558,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
406
558
  });
407
559
  };
408
560
 
409
- /**
410
- * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
411
- * @param dataSource
561
+ /**
562
+ * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
563
+ * @param dataSource
412
564
  */
413
565
  var checkDataSource = function checkDataSource(dataSource) {
414
566
  var isColumns = dataSource._fields.findIndex(function (field) {
@@ -428,28 +580,31 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
428
580
  }
429
581
  };
430
582
 
431
- /**
432
- * 그리드 펼침 정보 세션스토리지 리셋
583
+ /**
584
+ * 그리드 펼침 정보 세션스토리지 리셋
433
585
  */
434
586
  var resetSession = function resetSession() {
435
587
  sessionStorage.removeItem('dx-vera-pivotgrid-storing');
436
588
  };
437
589
 
438
- /**
439
- * 엑셀 export 명령
440
- * @param fileName 저장하고자 하는 엑셀파일명
590
+ /**
591
+ * 엑셀 export 명령
592
+ * @param fileName 저장하고자 하는 엑셀파일명
441
593
  */
442
594
  var exportToExcel = function exportToExcel(fileName) {
443
595
  setTimeout(function () {
444
596
  var _$tableRef$current;
445
- return exportToExcelAction((_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance, fileName);
597
+ return exportToExcelAction(
598
+ (_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance,
599
+ fileName
600
+ );
446
601
  });
447
602
  };
448
603
 
449
- /**
450
- * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
451
- * @param component devextreme component
452
- * @returns devextreme component
604
+ /**
605
+ * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
606
+ * @param component devextreme component
607
+ * @returns devextreme component
453
608
  */
454
609
  var convertDataControllerColumnsInfo = function convertDataControllerColumnsInfo(component) {
455
610
  var arr = [];
@@ -465,9 +620,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
465
620
  return component;
466
621
  };
467
622
 
468
- /**
469
- * 엑셀 export
470
- * @param e
623
+ /**
624
+ * 엑셀 export
625
+ * @param e
471
626
  */
472
627
  var exportToExcelAction = function exportToExcelAction(e, fileName) {
473
628
  var newComponent = convertDataControllerColumnsInfo(e);
@@ -483,22 +638,25 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
483
638
  bottom: borderStyle,
484
639
  left: borderStyle,
485
640
  right: borderStyle,
486
- top: borderStyle
641
+ top: borderStyle,
487
642
  };
488
- }
643
+ },
489
644
  }).then(function () {
490
645
  workbook.xlsx.writeBuffer().then(function (buffer) {
491
- (0, _fileSaver.default)(new Blob([buffer], {
492
- type: 'application/octet-stream'
493
- }), fileName + '.xlsx');
646
+ (0, _fileSaver.default)(
647
+ new Blob([buffer], {
648
+ type: 'application/octet-stream',
649
+ }),
650
+ fileName + '.xlsx'
651
+ );
494
652
  });
495
653
  });
496
654
  e.cancel = true;
497
655
  };
498
656
 
499
- /**
500
- * devextreme CellPreparedEvent 이벤트 실행
501
- * @param e
657
+ /**
658
+ * devextreme CellPreparedEvent 이벤트 실행
659
+ * @param e
502
660
  */
503
661
  var onCellPreparedChild = function onCellPreparedChild(e) {
504
662
  makeColorAtPercent(e);
@@ -510,8 +668,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
510
668
  return onCellPrepared ? onCellPrepared(e) : undefined;
511
669
  };
512
670
 
513
- /**
514
- * devextreme Raise Event
671
+ /**
672
+ * devextreme Raise Event
515
673
  */
516
674
  var onContentReadyChild = function onContentReadyChild(e) {
517
675
  setTimeout(function () {
@@ -538,57 +696,70 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
538
696
  var onOptionChangedChild = function onOptionChangedChild(e) {
539
697
  return onOptionChanged ? onOptionChanged(e) : undefined;
540
698
  };
541
- (0, _react.useEffect)(function () {
542
- setGridDataSource(dataSource);
543
- checkDataSource(dataSource);
544
- resetSession();
545
- }, [dataSource]);
546
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_loadPanel.LoadPanel, {
547
- position: {
548
- of: id
549
- }
550
- }), /*#__PURE__*/React.createElement(_pivotGrid.default, {
551
- id: id,
552
- ref: $tableRef,
553
- dataSource: gridDataSource,
554
- showColumnTotals: false,
555
- showColumnGrandTotals: true,
556
- showRowGrandTotals: false,
557
- width: width,
558
- height: height,
559
- allowExpandAll: allowExpandAll,
560
- allowFiltering: allowFiltering,
561
- allowSorting: allowSorting,
562
- allowSortingBySummary: allowSortingBySummary,
563
- dataFieldArea: dataFieldArea,
564
- disabled: disabled,
565
- elementAttr: elementAttr,
566
- encodeHtml: encodeHtml,
567
- hideEmptySummaryCells: hideEmptySummaryCells,
568
- hint: hint,
569
- rowHeaderLayout: rowHeaderLayout,
570
- rtlEnabled: rtlEnabled,
571
- showBorders: showBorders,
572
- showRowTotals: showRowTotals,
573
- showTotalsPrior: showTotalsPrior,
574
- tabIndex: tabIndex,
575
- visible: visible,
576
- wordWrapEnabled: wordWrapEnabled,
577
- onCellClick: onCellClickChild,
578
- onContentReady: onContentReadyChild,
579
- onCellPrepared: onCellPreparedChild,
580
- onContextMenuPreparing: onContextMenuPreparingChild,
581
- onDisposing: onDisposingChild,
582
- onExporting: onExportingChild,
583
- onInitialized: onInitializedChild,
584
- onOptionChanged: onOptionChangedChild
585
- }, /*#__PURE__*/React.createElement(_dataGrid.StateStoring, {
586
- enabled: stateStoringKey === null || stateStoringKey === void 0 ? void 0 : stateStoringKey.length,
587
- type: "sessionStorage",
588
- storageKey: stateStoringKey
589
- }), /*#__PURE__*/React.createElement(_pivotGrid.FieldChooser, {
590
- enabled: false
591
- })));
699
+ (0, _react.useEffect)(
700
+ function () {
701
+ setGridDataSource(dataSource);
702
+ checkDataSource(dataSource);
703
+ resetSession();
704
+ },
705
+ [dataSource]
706
+ );
707
+ return /*#__PURE__*/ _react.createElement(
708
+ 'div',
709
+ null,
710
+ /*#__PURE__*/ _react.createElement(_loadPanel.LoadPanel, {
711
+ position: {
712
+ of: id,
713
+ },
714
+ }),
715
+ /*#__PURE__*/ _react.createElement(
716
+ _pivotGrid.default,
717
+ {
718
+ id: id,
719
+ ref: $tableRef,
720
+ dataSource: gridDataSource,
721
+ showColumnTotals: false,
722
+ showColumnGrandTotals: true,
723
+ showRowGrandTotals: false,
724
+ width: width,
725
+ height: height,
726
+ allowExpandAll: allowExpandAll,
727
+ allowFiltering: allowFiltering,
728
+ allowSorting: allowSorting,
729
+ allowSortingBySummary: allowSortingBySummary,
730
+ dataFieldArea: dataFieldArea,
731
+ disabled: disabled,
732
+ elementAttr: elementAttr,
733
+ encodeHtml: encodeHtml,
734
+ hideEmptySummaryCells: hideEmptySummaryCells,
735
+ hint: hint,
736
+ rowHeaderLayout: rowHeaderLayout,
737
+ rtlEnabled: rtlEnabled,
738
+ showBorders: showBorders,
739
+ showRowTotals: showRowTotals,
740
+ showTotalsPrior: showTotalsPrior,
741
+ tabIndex: tabIndex,
742
+ visible: visible,
743
+ wordWrapEnabled: wordWrapEnabled,
744
+ onCellClick: onCellClickChild,
745
+ onContentReady: onContentReadyChild,
746
+ onCellPrepared: onCellPreparedChild,
747
+ onContextMenuPreparing: onContextMenuPreparingChild,
748
+ onDisposing: onDisposingChild,
749
+ onExporting: onExportingChild,
750
+ onInitialized: onInitializedChild,
751
+ onOptionChanged: onOptionChangedChild,
752
+ },
753
+ /*#__PURE__*/ _react.createElement(_dataGrid.StateStoring, {
754
+ enabled: stateStoringKey === null || stateStoringKey === void 0 ? void 0 : stateStoringKey.length,
755
+ type: 'sessionStorage',
756
+ storageKey: stateStoringKey,
757
+ }),
758
+ /*#__PURE__*/ _react.createElement(_pivotGrid.FieldChooser, {
759
+ enabled: false,
760
+ })
761
+ )
762
+ );
592
763
  });
593
764
  var _default = DxPlanitTreeGrid;
594
- exports.default = _default;
765
+ exports.default = _default;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
+ import DevExpress from 'devextreme';
2
+ import { Format } from 'devextreme/localization';
3
+
1
4
  export declare const DxPlanitTreeGrid;
2
5
  export default DxPlanitTreeGrid;
3
6
 
4
- export declare module DxPlanit {
7
+ export declare module TypeDxPlanit {
5
8
  export interface IGroupField {
6
9
  groupCaption: string;
7
10
  groupName?: string;
@@ -10,6 +13,18 @@ export declare module DxPlanit {
10
13
  colspan: number;
11
14
  }
12
15
 
16
+ export interface ColumnField {
17
+ colspan: number;
18
+ text: string;
19
+ type: string;
20
+ }
21
+
22
+ export interface IColorInfo {
23
+ format: Format;
24
+ color: string;
25
+ condition: string;
26
+ }
27
+
13
28
  export interface Props extends DevExpress.ui.dxPivotGrid.Properties {
14
29
  id?: string;
15
30
  dataSource?: any;
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "devextreme-planit-treegrid-react",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Devextreme의 DxPivotGrid를 Tree Grid처럼 보여주는 Wrapper입니다.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
7
11
  "repository": "https://github.com/hsquare-analytics/ui-tree-grid.git",
8
12
  "author": "bcahn <antonio1926@gmail.com>",
9
13
  "license": "MIT",
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/ui-tree-grid.iml" filepath="$PROJECT_DIR$/.idea/ui-tree-grid.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
package/.prettierrc DELETED
@@ -1,12 +0,0 @@
1
- # Prettier configuration
2
-
3
- printWidth: 140
4
- singleQuote: true
5
- tabWidth: 2
6
- useTabs: false
7
-
8
- # js and ts rules:
9
- arrowParens: avoid
10
-
11
- # jsx and tsx rules:
12
- jsxBracketSameLine: false
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules\\typescript\\lib"
3
- }
package/babel.config.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = function (api) {
2
- api.cache(true);
3
-
4
- const presets = ['@babel/preset-env', ['@babel/preset-react', { runtime: 'automatic' }], '@babel/preset-typescript'];
5
- const plugins = ['macros'];
6
-
7
- return {
8
- presets,
9
- plugins,
10
- };
11
- };
Binary file
package/public/index.html DELETED
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
Binary file
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
package/public/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
package/webpack.config.js DELETED
@@ -1,27 +0,0 @@
1
- module.exports = {
2
- entry: './server.js',
3
- output: {
4
- filename: 'compiled.js',
5
- },
6
- resolve: {
7
- extensions: ['ts', 'tsx'],
8
- },
9
- module: {
10
- rules: [
11
- {
12
- test: /\.(ts|tsx)$/,
13
- exclude: /(node_modules)/,
14
- use: {
15
- loader: 'babel-loader',
16
- },
17
- query: {
18
- presets: ['react'],
19
- },
20
- },
21
- {
22
- test: /\.css$/i,
23
- use: ['style-loader', 'css-loader'],
24
- },
25
- ],
26
- },
27
- };