devextreme-planit-treegrid-react 1.3.3 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,136 @@
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 _pivotGrid = _interopRequireWildcard(require("devextreme-react/pivot-grid"));
10
- var _excel_exporter = require("devextreme/excel_exporter");
11
- var _exceljs = require("exceljs");
12
- var _fileSaver = _interopRequireDefault(require("file-saver"));
13
- var _localization = require("devextreme/localization");
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- 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); }
16
- 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; }
17
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
18
- 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."); }
19
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
22
- 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."); }
23
- 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); }
24
- 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; }
25
- 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; } }
26
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
+ var _react = require('react');
22
+ var _pivotGrid = _interopRequireWildcard(require('devextreme-react/pivot-grid'));
23
+ var _excel_exporter = require('devextreme/excel_exporter');
24
+ var _exceljs = require('exceljs');
25
+ var _fileSaver = _interopRequireDefault(require('file-saver'));
26
+ var _localization = require('devextreme/localization');
27
+ function _interopRequireDefault(obj) {
28
+ return obj && obj.__esModule ? obj : { default: obj };
29
+ }
30
+ function _getRequireWildcardCache(nodeInterop) {
31
+ if (typeof WeakMap !== 'function') return null;
32
+ var cacheBabelInterop = new WeakMap();
33
+ var cacheNodeInterop = new WeakMap();
34
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
35
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
+ })(nodeInterop);
37
+ }
38
+ function _interopRequireWildcard(obj, nodeInterop) {
39
+ if (!nodeInterop && obj && obj.__esModule) {
40
+ return obj;
41
+ }
42
+ if (obj === null || (_typeof(obj) !== 'object' && typeof obj !== 'function')) {
43
+ return { default: obj };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {};
50
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
+ for (var key in obj) {
52
+ if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
53
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
54
+ if (desc && (desc.get || desc.set)) {
55
+ Object.defineProperty(newObj, key, desc);
56
+ } else {
57
+ newObj[key] = obj[key];
58
+ }
59
+ }
60
+ }
61
+ newObj.default = obj;
62
+ if (cache) {
63
+ cache.set(obj, newObj);
64
+ }
65
+ return newObj;
66
+ }
67
+ function _toConsumableArray(arr) {
68
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
69
+ }
70
+ function _nonIterableSpread() {
71
+ throw new TypeError(
72
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
73
+ );
74
+ }
75
+ function _iterableToArray(iter) {
76
+ if ((typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) || iter['@@iterator'] != null) return Array.from(iter);
77
+ }
78
+ function _arrayWithoutHoles(arr) {
79
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
80
+ }
81
+ function _slicedToArray(arr, i) {
82
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
83
+ }
84
+ function _nonIterableRest() {
85
+ throw new TypeError(
86
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
87
+ );
88
+ }
89
+ function _unsupportedIterableToArray(o, minLen) {
90
+ if (!o) return;
91
+ if (typeof o === 'string') return _arrayLikeToArray(o, minLen);
92
+ var n = Object.prototype.toString.call(o).slice(8, -1);
93
+ if (n === 'Object' && o.constructor) n = o.constructor.name;
94
+ if (n === 'Map' || n === 'Set') return Array.from(o);
95
+ if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
96
+ }
97
+ function _arrayLikeToArray(arr, len) {
98
+ if (len == null || len > arr.length) len = arr.length;
99
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
100
+ arr2[i] = arr[i];
101
+ }
102
+ return arr2;
103
+ }
104
+ function _iterableToArrayLimit(arr, i) {
105
+ var _i = null == arr ? null : ('undefined' != typeof Symbol && arr[Symbol.iterator]) || arr['@@iterator'];
106
+ if (null != _i) {
107
+ var _s,
108
+ _e,
109
+ _x,
110
+ _r,
111
+ _arr = [],
112
+ _n = !0,
113
+ _d = !1;
114
+ try {
115
+ if (((_x = (_i = _i.call(arr)).next), 0 === i)) {
116
+ if (Object(_i) !== _i) return;
117
+ _n = !1;
118
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {}
119
+ } catch (err) {
120
+ (_d = !0), (_e = err);
121
+ } finally {
122
+ try {
123
+ if (!_n && null != _i.return && ((_r = _i.return()), Object(_r) !== _r)) return;
124
+ } finally {
125
+ if (_d) throw _e;
126
+ }
127
+ }
128
+ return _arr;
129
+ }
130
+ }
131
+ function _arrayWithHoles(arr) {
132
+ if (Array.isArray(arr)) return arr;
133
+ }
27
134
  /**
28
135
  * devextreme pivotgrid Configrations 중 사용 불가 항목 : id, width, height, showColumnGrandTotals, showColumnTotals, showRowGrandTotals, FieldChooser. fieldPanel,
29
136
  * devextreme pivotgrid Configrations 중 사용 방법 변경 항목 : stateStoring, Export
@@ -36,7 +143,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
143
  */
37
144
 
38
145
  var grandTotalCssNm = 'data-grand-total';
39
- var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
146
+ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref) {
40
147
  var children = props.children,
41
148
  _props$id = props.id,
42
149
  id = _props$id === void 0 ? 'dx-planit-vera-pivotgrid-id' : _props$id,
@@ -106,28 +213,38 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
106
213
  _useState8 = _slicedToArray(_useState7, 2),
107
214
  gridDataSource = _useState8[0],
108
215
  setGridDataSource = _useState8[1];
216
+ var _useState9 = (0, _react.useState)(null),
217
+ _useState10 = _slicedToArray(_useState9, 2),
218
+ oldDataSource = _useState10[0],
219
+ setOldDataSource = _useState10[1];
109
220
  var $tableRef = (0, _react.useRef)(null);
110
221
  var excelBorder = {
111
222
  style: 'thin',
112
223
  color: {
113
- argb: 'FF7E7E7E'
114
- }
224
+ argb: 'FF7E7E7E',
225
+ },
226
+ };
227
+ var korean = {
228
+ 'ko': {
229
+ 'dxPivotGrid-sortColumnBySummary': '"{0}" 을(를) 선택한 열 기준으로 정렬',
230
+ 'dxPivotGrid-removeAllSorting': '정렬기능 모두 제거',
231
+ 'dxPivotGrid-expandAll': '모두 펼치기',
232
+ 'dxPivotGrid-collapseAll': '모두 접기',
233
+ 'dxDataGrid-headerFilterOK': '확인',
234
+ 'dxDataGrid-headerFilterCancel': '취소',
235
+ 'dxList-selectAll': '모두 선택',
236
+ 'Search': '검색',
237
+ },
115
238
  };
239
+
240
+ /**
241
+ * devextreme 한국어 변환
242
+ * @param lang 설정한 language 정보
243
+ */
116
244
  var transferLanguage = function transferLanguage(lang) {
117
245
  (0, _localization.locale)(lang);
118
246
  if (lang === 'ko' || lang === 'ko-KR') {
119
- (0, _localization.loadMessages)({
120
- ko: {
121
- 'dxPivotGrid-sortColumnBySummary': '"{0}" 을(를) 선택한 열 기준으로 정렬',
122
- 'dxPivotGrid-removeAllSorting': '정렬기능 모두 제거',
123
- 'dxPivotGrid-expandAll': '모두 펼치기',
124
- 'dxPivotGrid-collapseAll': '모두 접기',
125
- 'dxDataGrid-headerFilterOK': '확인',
126
- 'dxDataGrid-headerFilterCancel': '취소',
127
- 'dxList-selectAll': '모두 선택',
128
- 'Search': '검색'
129
- }
130
- });
247
+ (0, _localization.loadMessages)(korean);
131
248
  }
132
249
  };
133
250
 
@@ -147,17 +264,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
147
264
  * @returns
148
265
  */
149
266
  var modifyChildren = function modifyChildren(child, index) {
150
- if (child.type.OptionName.toLowerCase() === 'fieldpanel') {
267
+ if ((child === null || child === void 0 ? void 0 : child.type.OptionName.toLowerCase()) === 'fieldpanel') {
151
268
  var _child$props$visible, _child$props$allowFie, _child$props$showRowF;
152
269
  warnDisableProps(child);
153
- return /*#__PURE__*/_react.createElement(_pivotGrid.FieldPanel, {
270
+ return /*#__PURE__*/ _react.createElement(_pivotGrid.FieldPanel, {
154
271
  key: 'FieldPanel' + index,
155
272
  visible: (_child$props$visible = child.props.visible) !== null && _child$props$visible !== void 0 ? _child$props$visible : false,
156
- allowFieldDragging: (_child$props$allowFie = child.props.allowFieldDragging) !== null && _child$props$allowFie !== void 0 ? _child$props$allowFie : true,
273
+ allowFieldDragging:
274
+ (_child$props$allowFie = child.props.allowFieldDragging) !== null && _child$props$allowFie !== void 0
275
+ ? _child$props$allowFie
276
+ : true,
157
277
  showColumnFields: false,
158
278
  showFilterFields: false,
159
279
  showDataFields: false,
160
- showRowFields: (_child$props$showRowF = child.props.showRowFields) !== null && _child$props$showRowF !== void 0 ? _child$props$showRowF : true
280
+ showRowFields:
281
+ (_child$props$showRowF = child.props.showRowFields) !== null && _child$props$showRowF !== void 0 ? _child$props$showRowF : true,
161
282
  });
162
283
  }
163
284
  return child;
@@ -171,16 +292,26 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
171
292
  var _wrapper$clientWidth;
172
293
  var wrapper = document.querySelector('.diag-table-wrapper');
173
294
  var gap = 10;
174
- setWidth((_wrapper$clientWidth = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth !== void 0 ? _wrapper$clientWidth : 0);
295
+ setWidth(
296
+ (_wrapper$clientWidth = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null &&
297
+ _wrapper$clientWidth !== void 0
298
+ ? _wrapper$clientWidth
299
+ : 0
300
+ );
175
301
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
176
302
  window.addEventListener('resize', function () {
177
303
  var _wrapper$clientWidth2;
178
- setWidth((_wrapper$clientWidth2 = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth2 !== void 0 ? _wrapper$clientWidth2 : 0);
304
+ setWidth(
305
+ (_wrapper$clientWidth2 = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null &&
306
+ _wrapper$clientWidth2 !== void 0
307
+ ? _wrapper$clientWidth2
308
+ : 0
309
+ );
179
310
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
180
311
  });
181
312
  return {
182
313
  width: width,
183
- height: height
314
+ height: height,
184
315
  };
185
316
  };
186
317
 
@@ -196,7 +327,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
196
327
  if (((_e$cell = e.cell) === null || _e$cell === void 0 ? void 0 : _e$cell.type) === 'T') {
197
328
  var _e$cell$text;
198
329
  var text = (_e$cell$text = e.cell.text) === null || _e$cell$text === void 0 ? void 0 : _e$cell$text.replace('Total', '합계');
199
- e.cellElement.innerHTML = "<span>".concat(text, "</span>");
330
+ e.cellElement.innerHTML = '<span>'.concat(text, '</span>');
200
331
  }
201
332
  };
202
333
 
@@ -223,7 +354,13 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
223
354
  if (!convertZeroToHipen) {
224
355
  return;
225
356
  }
226
- 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) {
357
+ if (
358
+ e.area === 'data' &&
359
+ (((_e$cell3 = e.cell) === null || _e$cell3 === void 0 ? void 0 : _e$cell3.text) === '0' ||
360
+ ((_e$cell4 = e.cell) === null || _e$cell4 === void 0 ? void 0 : _e$cell4.text) === '0.0%' ||
361
+ ((_e$cell5 = e.cell) === null || _e$cell5 === void 0 ? void 0 : _e$cell5.text) === '') &&
362
+ e.cellElement
363
+ ) {
227
364
  e.cellElement.innerHTML = '<span class="text-color">-</span>';
228
365
  }
229
366
  };
@@ -246,7 +383,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
246
383
  } else if (!isLast && index === 0) {
247
384
  td.setAttribute('style', 'border-bottom: 0');
248
385
  }
249
- td.innerHTML = "<span>".concat(text, "</span>");
386
+ td.innerHTML = '<span>'.concat(text, '</span>');
250
387
  return td;
251
388
  };
252
389
 
@@ -257,13 +394,15 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
257
394
  */
258
395
  var makeCheckGroupData = function makeCheckGroupData(groupField) {
259
396
  var data = {};
260
- groupField === null || groupField === void 0 ? void 0 : groupField.forEach(function (group) {
261
- if (data[group.depth]) {
262
- data[group.depth] += group.colspan;
263
- } else {
264
- data[group.depth] = group.colspan;
265
- }
266
- });
397
+ groupField === null || groupField === void 0
398
+ ? void 0
399
+ : groupField.forEach(function (group) {
400
+ if (data[group.depth]) {
401
+ data[group.depth] += group.colspan;
402
+ } else {
403
+ data[group.depth] = group.colspan;
404
+ }
405
+ });
267
406
  return data;
268
407
  };
269
408
 
@@ -289,7 +428,11 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
289
428
  */
290
429
  var setTotalElementInfo = function setTotalElementInfo(e) {
291
430
  var _e$cell6, _e$cell7, _e$cellElement;
292
- 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') {
431
+ if (
432
+ !(groupField !== null && groupField !== void 0 && groupField.length) ||
433
+ ((_e$cell6 = e.cell) === null || _e$cell6 === void 0 ? void 0 : _e$cell6.type) !== 'GT' ||
434
+ ((_e$cell7 = e.cell) === null || _e$cell7 === void 0 ? void 0 : _e$cell7.text) !== 'Grand Total'
435
+ ) {
293
436
  return;
294
437
  }
295
438
  (_e$cellElement = e.cellElement) === null || _e$cellElement === void 0 ? void 0 : _e$cellElement.classList.add(grandTotalCssNm);
@@ -316,9 +459,11 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
316
459
  */
317
460
  var getGroupDepth = function getGroupDepth(group, arr) {
318
461
  var groupData = group.slice();
319
- var set = new Set(groupData.map(function (group) {
320
- return group.depth;
321
- }));
462
+ var set = new Set(
463
+ groupData.map(function (group) {
464
+ return group.depth;
465
+ })
466
+ );
322
467
  return Array.from(set).sort(function compare(a, b) {
323
468
  if (a > b) {
324
469
  return arr === 'asc' ? -1 : 1;
@@ -363,7 +508,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
363
508
  }
364
509
  totalElement.innerHTML = '';
365
510
  totalElement.setAttribute('style', 'padding: 0; border: 0');
366
- var colgroup = (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0 ? void 0 : _thead$previousSiblin.cloneNode(true);
511
+ var colgroup =
512
+ (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0
513
+ ? void 0
514
+ : _thead$previousSiblin.cloneNode(true);
367
515
  var groupData = groupField.slice();
368
516
  var depth = getGroupDepth(groupData, 'asc');
369
517
  var table = document.createElement('table');
@@ -394,7 +542,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
394
542
  return {
395
543
  colspan: group.colspan,
396
544
  text: group.groupCaption,
397
- type: 'GT'
545
+ type: 'GT',
398
546
  };
399
547
  });
400
548
  });
@@ -408,7 +556,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
408
556
  var makeSplitCondtion = function makeSplitCondtion(condition) {
409
557
  var newCondition = {
410
558
  standard: '',
411
- condition: ''
559
+ condition: '',
412
560
  };
413
561
  _toConsumableArray(condition).forEach(function (cond) {
414
562
  if (Number.isNaN(parseFloat(cond))) {
@@ -434,7 +582,14 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
434
582
  if (e.cell.value === null) {
435
583
  return;
436
584
  }
437
- 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)) {
585
+ if (
586
+ ((_e$cell8 = e.cell) === null || _e$cell8 === void 0
587
+ ? void 0
588
+ : (_e$cell8$format = _e$cell8.format) === null || _e$cell8$format === void 0
589
+ ? void 0
590
+ : _e$cell8$format.type) === color.format &&
591
+ !Number.isNaN(e.cell.value)
592
+ ) {
438
593
  var standardData = makeSplitCondtion(color.condition.replace(/(\s*)/g, ''));
439
594
  var rate = color.format === 'percent' ? 0.01 : 1;
440
595
  var condition = false;
@@ -465,7 +620,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
465
620
  */
466
621
  var checkDataSource = function checkDataSource(dataSource) {
467
622
  if (!dataSource._fields) {
468
- throw Error('PivotGridDataSource 의 field 정보가 없습니다. 올바른 field 정보를 입력하세요. https://js.devexpress.com/Documentation/ApiReference/Data_Layer/PivotGridDataSource/Configuration/fields/');
623
+ throw Error(
624
+ 'PivotGridDataSource 의 field 정보가 없습니다. 올바른 field 정보를 입력하세요. https://js.devexpress.com/Documentation/ApiReference/Data_Layer/PivotGridDataSource/Configuration/fields/'
625
+ );
469
626
  }
470
627
  var isColumns = dataSource._fields.findIndex(function (field) {
471
628
  return field.area === 'column';
@@ -491,7 +648,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
491
648
  var exportToExcel = function exportToExcel(fileName) {
492
649
  setTimeout(function () {
493
650
  var _$tableRef$current;
494
- return exportToExcelAction((_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance, fileName);
651
+ return exportToExcelAction(
652
+ (_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance,
653
+ fileName
654
+ );
495
655
  });
496
656
  };
497
657
 
@@ -532,14 +692,17 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
532
692
  bottom: borderStyle,
533
693
  left: borderStyle,
534
694
  right: borderStyle,
535
- top: borderStyle
695
+ top: borderStyle,
536
696
  };
537
- }
697
+ },
538
698
  }).then(function () {
539
699
  workbook.xlsx.writeBuffer().then(function (buffer) {
540
- (0, _fileSaver.default)(new Blob([buffer], {
541
- type: 'application/octet-stream'
542
- }), fileName + '.xlsx');
700
+ (0, _fileSaver.default)(
701
+ new Blob([buffer], {
702
+ type: 'application/octet-stream',
703
+ }),
704
+ fileName + '.xlsx'
705
+ );
543
706
  });
544
707
  });
545
708
  e.cancel = true;
@@ -609,7 +772,6 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
609
772
  */
610
773
  var onContentReadyChild = function onContentReadyChild(e) {
611
774
  insertRowHeaderGroup();
612
- // setTimeout(() => insertRowHeaderGroup(), 0);
613
775
  getGridSize();
614
776
  return onContentReady ? onContentReady(e) : undefined;
615
777
  };
@@ -633,57 +795,80 @@ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
633
795
  };
634
796
  (0, _react.useImperativeHandle)(ref, function () {
635
797
  return {
636
- exportToExcel: exportToExcel
798
+ exportToExcel: exportToExcel,
637
799
  };
638
800
  });
639
- (0, _react.useEffect)(function () {
640
- if (Object.keys(dataSource).length) {
641
- resetSession();
642
- setGridDataSource(dataSource);
643
- checkDataSource(dataSource);
644
- }
645
- }, [dataSource]);
646
- (0, _react.useEffect)(function () {
647
- transferLanguage(language);
648
- }, [language]);
649
- return /*#__PURE__*/_react.createElement(_react.Fragment, null, Object.keys(gridDataSource).length && /*#__PURE__*/_react.createElement("div", null, /*#__PURE__*/_react.createElement(_pivotGrid.default, {
650
- id: id,
651
- ref: $tableRef,
652
- dataSource: gridDataSource,
653
- showColumnTotals: false,
654
- showColumnGrandTotals: true,
655
- showRowGrandTotals: false,
656
- width: width,
657
- height: height,
658
- allowExpandAll: allowExpandAll,
659
- allowFiltering: allowFiltering,
660
- allowSorting: allowSorting,
661
- allowSortingBySummary: allowSortingBySummary,
662
- dataFieldArea: dataFieldArea,
663
- disabled: disabled,
664
- elementAttr: elementAttr,
665
- encodeHtml: encodeHtml,
666
- hideEmptySummaryCells: hideEmptySummaryCells,
667
- hint: hint,
668
- rowHeaderLayout: rowHeaderLayout,
669
- rtlEnabled: rtlEnabled,
670
- showBorders: showBorders,
671
- showRowTotals: showRowTotals,
672
- showTotalsPrior: showTotalsPrior,
673
- tabIndex: tabIndex,
674
- visible: visible,
675
- wordWrapEnabled: wordWrapEnabled,
676
- onCellClick: onCellClickChild,
677
- onContentReady: onContentReadyChild,
678
- onCellPrepared: onCellPreparedChild,
679
- onContextMenuPreparing: onContextMenuPreparingChild,
680
- onDisposing: onDisposingChild,
681
- onExporting: onExportingChild,
682
- onInitialized: onInitializedChild,
683
- onOptionChanged: onOptionChangedChild
684
- }, convertChildren(children), /*#__PURE__*/_react.createElement(_pivotGrid.FieldChooser, {
685
- enabled: false
686
- }))));
801
+ (0, _react.useEffect)(
802
+ function () {
803
+ if (Object.keys(dataSource).length) {
804
+ if (oldDataSource && oldDataSource._fields.length !== dataSource._fields.length) {
805
+ resetSession();
806
+ setOldDataSource(dataSource);
807
+ }
808
+ setGridDataSource(dataSource);
809
+ checkDataSource(dataSource);
810
+ }
811
+ },
812
+ [dataSource]
813
+ );
814
+ (0, _react.useEffect)(
815
+ function () {
816
+ transferLanguage(language);
817
+ },
818
+ [language]
819
+ );
820
+ return /*#__PURE__*/ _react.createElement(
821
+ _react.Fragment,
822
+ null,
823
+ Object.keys(gridDataSource).length &&
824
+ /*#__PURE__*/ _react.createElement(
825
+ 'div',
826
+ null,
827
+ /*#__PURE__*/ _react.createElement(
828
+ _pivotGrid.default,
829
+ {
830
+ id: id,
831
+ ref: $tableRef,
832
+ dataSource: gridDataSource,
833
+ showColumnTotals: false,
834
+ showColumnGrandTotals: true,
835
+ showRowGrandTotals: false,
836
+ width: width,
837
+ height: height,
838
+ allowExpandAll: allowExpandAll,
839
+ allowFiltering: allowFiltering,
840
+ allowSorting: allowSorting,
841
+ allowSortingBySummary: allowSortingBySummary,
842
+ dataFieldArea: dataFieldArea,
843
+ disabled: disabled,
844
+ elementAttr: elementAttr,
845
+ encodeHtml: encodeHtml,
846
+ hideEmptySummaryCells: hideEmptySummaryCells,
847
+ hint: hint,
848
+ rowHeaderLayout: rowHeaderLayout,
849
+ rtlEnabled: rtlEnabled,
850
+ showBorders: showBorders,
851
+ showRowTotals: showRowTotals,
852
+ showTotalsPrior: showTotalsPrior,
853
+ tabIndex: tabIndex,
854
+ visible: visible,
855
+ wordWrapEnabled: wordWrapEnabled,
856
+ onCellClick: onCellClickChild,
857
+ onContentReady: onContentReadyChild,
858
+ onCellPrepared: onCellPreparedChild,
859
+ onContextMenuPreparing: onContextMenuPreparingChild,
860
+ onDisposing: onDisposingChild,
861
+ onExporting: onExportingChild,
862
+ onInitialized: onInitializedChild,
863
+ onOptionChanged: onOptionChangedChild,
864
+ },
865
+ convertChildren(children),
866
+ /*#__PURE__*/ _react.createElement(_pivotGrid.FieldChooser, {
867
+ enabled: false,
868
+ })
869
+ )
870
+ )
871
+ );
687
872
  });
688
873
  var _default = DxPlanitTreeGrid;
689
- exports.default = _default;
874
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devextreme-planit-treegrid-react",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Devextreme의 DxPivotGrid를 Tree Grid처럼 보여주는 Wrapper입니다.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "devextreme": "^22.1.6",
46
- "devextreme-planit-treegrid-react": "^1.3.2",
46
+ "devextreme-planit-treegrid-react": "^1.3.4",
47
47
  "devextreme-react": "^22.1.6",
48
48
  "exceljs": "^4.3.0",
49
49
  "file-saver": "^2.0.5",