devextreme-planit-treegrid-react 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
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>
@@ -0,0 +1,9 @@
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 ADDED
@@ -0,0 +1,6 @@
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 ADDED
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,3 @@
1
+ {
2
+ "typescript.tsdk": "node_modules\\typescript\\lib"
3
+ }
package/README.md CHANGED
@@ -18,7 +18,7 @@ npm install file-saver
18
18
  DevExtreme이 설치되어 있어야 합니다.
19
19
 
20
20
  ```
21
- npm install devextreme
21
+ npm install devextreme devextreme-react
22
22
  ```
23
23
 
24
24
  ```
@@ -47,6 +47,10 @@ import DxPlanitTreeGrid from 'devextreme-planit-treegrid-react'
47
47
  />
48
48
  ```
49
49
 
50
+ ```
51
+ **Note: id가 필수사항은 아니지만 가급적 사용할 것을 권고합니다. id를 사용하지 않으면 한 페이지에 여러 개의 Tree Grid를 생성할 경우 DevExtreme의 Load Pannel이 의도치 않은 곳에 생성될 수 있습니다.
52
+ ```
53
+
50
54
  DevExtreme PivotGrid에 몇몇 기능이 추가되었습니다. 추가된 기능은 아래와 같습니다.
51
55
 
52
56
  ### 1. dataColor
@@ -0,0 +1,11 @@
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
+ };
@@ -1,150 +1,32 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
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,
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
19
6
  });
20
7
  exports.default = void 0;
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
-
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; }
146
28
  var grandTotalCssNm = 'data-grand-total';
147
- var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref) {
29
+ var DxPlanitTreeGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
148
30
  var _props$id = props.id,
149
31
  id = _props$id === void 0 ? 'dx-planit-vera-pivotgrid-id' : _props$id,
150
32
  groupField = props.groupField,
@@ -219,49 +101,39 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
219
101
  var excelBorder = {
220
102
  style: 'thin',
221
103
  color: {
222
- argb: 'FF7E7E7E',
223
- },
104
+ argb: 'FF7E7E7E'
105
+ }
224
106
  };
225
107
  (0, _react.useImperativeHandle)(ref, function () {
226
108
  return {
227
- exportToExcel: exportToExcel,
109
+ exportToExcel: exportToExcel
228
110
  };
229
111
  });
230
112
 
231
- /**
232
- * 그리드 사이즈 재조정
233
- * @returns 그리드 사이즈
113
+ /**
114
+ * 그리드 사이즈 재조정
115
+ * @returns 그리드 사이즈
234
116
  */
235
117
  var getGridSize = function getGridSize() {
236
118
  var _wrapper$clientWidth;
237
119
  var wrapper = document.querySelector('.diag-table-wrapper');
238
120
  var gap = 10;
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
- );
121
+ setWidth((_wrapper$clientWidth = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth !== void 0 ? _wrapper$clientWidth : 0);
245
122
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
246
123
  window.addEventListener('resize', function () {
247
124
  var _wrapper$clientWidth2;
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
- );
125
+ setWidth((_wrapper$clientWidth2 = wrapper === null || wrapper === void 0 ? void 0 : wrapper.clientWidth) !== null && _wrapper$clientWidth2 !== void 0 ? _wrapper$clientWidth2 : 0);
254
126
  setHeight(wrapper ? wrapper.clientHeight - gap : 0);
255
127
  });
256
128
  return {
257
129
  width: width,
258
- height: height,
130
+ height: height
259
131
  };
260
132
  };
261
133
 
262
- /**
263
- * 'Total' 을 한글로 변경
264
- * @param e devextreme CellPreparedEvent
134
+ /**
135
+ * 'Total' 을 한글로 변경
136
+ * @param e devextreme CellPreparedEvent
265
137
  */
266
138
  var changeTotalText = function changeTotalText(e) {
267
139
  var _e$cell;
@@ -271,13 +143,13 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
271
143
  if (((_e$cell = e.cell) === null || _e$cell === void 0 ? void 0 : _e$cell.type) === 'T') {
272
144
  var _e$cell$text;
273
145
  var text = (_e$cell$text = e.cell.text) === null || _e$cell$text === void 0 ? void 0 : _e$cell$text.replace('Total', '합계');
274
- e.cellElement.innerHTML = '<span>'.concat(text, '</span>');
146
+ e.cellElement.innerHTML = "<span>".concat(text, "</span>");
275
147
  }
276
148
  };
277
149
 
278
- /**
279
- * null값을 하이픈으로 모두 변경
280
- * @param e devextreme CellPreparedEvent
150
+ /**
151
+ * null값을 하이픈으로 모두 변경
152
+ * @param e devextreme CellPreparedEvent
281
153
  */
282
154
  var changeNullToHipen = function changeNullToHipen(e) {
283
155
  var _e$cell2;
@@ -289,30 +161,24 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
289
161
  }
290
162
  };
291
163
 
292
- /**
293
- * '0', '0.0%' 를 하이픈으로 모두 변경
294
- * @param e devextreme CellPreparedEvent
164
+ /**
165
+ * '0', '0.0%' 를 하이픈으로 모두 변경
166
+ * @param e devextreme CellPreparedEvent
295
167
  */
296
168
  var changeZeroToHipen = function changeZeroToHipen(e) {
297
169
  var _e$cell3, _e$cell4, _e$cell5;
298
170
  if (!convertZeroToHipen) {
299
171
  return;
300
172
  }
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
- ) {
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) {
308
174
  e.cellElement.innerHTML = '<span class="text-color">-</span>';
309
175
  }
310
176
  };
311
177
 
312
- /**
313
- * 테이블 헤더에 colspan, rowspan 한 HTMLElement 정보 반환
314
- * @param groupField 사용자가 작성한 그룹 정보
315
- * @return
178
+ /**
179
+ * 테이블 헤더에 colspan, rowspan 한 HTMLElement 정보 반환
180
+ * @param groupField 사용자가 작성한 그룹 정보
181
+ * @return
316
182
  */
317
183
  var makeColspan = function makeColspan(group, index, isLast) {
318
184
  var _group$html;
@@ -327,33 +193,31 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
327
193
  } else if (!isLast && index === 0) {
328
194
  td.setAttribute('style', 'border-bottom: 0');
329
195
  }
330
- td.innerHTML = '<span>'.concat(text, '</span>');
196
+ td.innerHTML = "<span>".concat(text, "</span>");
331
197
  return td;
332
198
  };
333
199
 
334
- /**
335
- * 그룹 필드 데이터 유효성 검증용 데이터 생성
336
- * @param groupField
337
- * @returns
200
+ /**
201
+ * 그룹 필드 데이터 유효성 검증용 데이터 생성
202
+ * @param groupField
203
+ * @returns
338
204
  */
339
205
  var makeCheckGroupData = function makeCheckGroupData(groupField) {
340
206
  var data = {};
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
- });
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
+ });
350
214
  return data;
351
215
  };
352
216
 
353
- /**
354
- * GroupField 데이터 검증
355
- * @param 사용자가 설정한 그룹 필드 정보
356
- * @returns 데이터 검증 결과
217
+ /**
218
+ * GroupField 데이터 검증
219
+ * @param 사용자가 설정한 그룹 필드 정보
220
+ * @returns 데이터 검증 결과
357
221
  */
358
222
  var isCheckGroupField = function isCheckGroupField(groupField) {
359
223
  var map = makeCheckGroupData(groupField);
@@ -366,25 +230,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
366
230
  return true;
367
231
  };
368
232
 
369
- /**
370
- * Grand Total 셀 정보 저장
371
- * @param e
233
+ /**
234
+ * Grand Total 셀 정보 저장
235
+ * @param e
372
236
  */
373
237
  var setTotalElementInfo = function setTotalElementInfo(e) {
374
238
  var _e$cell6, _e$cell7, _e$cellElement;
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
- ) {
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') {
380
240
  return;
381
241
  }
382
242
  (_e$cellElement = e.cellElement) === null || _e$cellElement === void 0 ? void 0 : _e$cellElement.classList.add(grandTotalCssNm);
383
243
  };
384
244
 
385
- /**
386
- * cell의 columnIndex 최대값 저장
387
- * @param e
245
+ /**
246
+ * cell의 columnIndex 최대값 저장
247
+ * @param e
388
248
  */
389
249
  var setMaxColumIndex = function setMaxColumIndex(e) {
390
250
  if (!e.columnIndex) {
@@ -395,19 +255,17 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
395
255
  }
396
256
  };
397
257
 
398
- /**
399
- * groupField depth의 유니크한 배열 구하기
400
- * @param group
401
- * @param arr
402
- * @returns
258
+ /**
259
+ * groupField depth의 유니크한 배열 구하기
260
+ * @param group
261
+ * @param arr
262
+ * @returns
403
263
  */
404
264
  var getGroupDepth = function getGroupDepth(group, arr) {
405
265
  var groupData = group.slice();
406
- var set = new Set(
407
- groupData.map(function (group) {
408
- return group.depth;
409
- })
410
- );
266
+ var set = new Set(groupData.map(function (group) {
267
+ return group.depth;
268
+ }));
411
269
  return Array.from(set).sort(function compare(a, b) {
412
270
  if (a > b) {
413
271
  return arr === 'asc' ? -1 : 1;
@@ -419,11 +277,11 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
419
277
  });
420
278
  };
421
279
 
422
- /**
423
- * 현재 depth에 맞는 그룹 필드 정보 반환
424
- * @param group
425
- * @param depth
426
- * @returns
280
+ /**
281
+ * 현재 depth에 맞는 그룹 필드 정보 반환
282
+ * @param group
283
+ * @param depth
284
+ * @returns
427
285
  */
428
286
  var getCurrentGroup = function getCurrentGroup(group, depth) {
429
287
  return group.filter(function (gr) {
@@ -431,8 +289,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
431
289
  });
432
290
  };
433
291
 
434
- /**
435
- * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
292
+ /**
293
+ * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
436
294
  */
437
295
  var insertRowHeaderGroup = function insertRowHeaderGroup() {
438
296
  var _thead$previousSiblin;
@@ -452,10 +310,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
452
310
  }
453
311
  totalElement.innerHTML = '';
454
312
  totalElement.setAttribute('style', 'padding: 0; border: 0');
455
- var colgroup =
456
- (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0
457
- ? void 0
458
- : _thead$previousSiblin.cloneNode(true);
313
+ var colgroup = (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0 ? void 0 : _thead$previousSiblin.cloneNode(true);
459
314
  var groupData = groupField.slice();
460
315
  var depth = getGroupDepth(groupData, 'asc');
461
316
  var table = document.createElement('table');
@@ -472,10 +327,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
472
327
  totalElement.appendChild(table);
473
328
  };
474
329
 
475
- /**
476
- * Devextreme의 dateController columnInfo에 그룹 정보 삽입
477
- * @param group
478
- * @returns
330
+ /**
331
+ * Devextreme의 dateController columnInfo에 그룹 정보 삽입
332
+ * @param group
333
+ * @returns
479
334
  */
480
335
  var makeDataControllerColumnGroup = function makeDataControllerColumnGroup(group) {
481
336
  var groupData = group.slice();
@@ -486,21 +341,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
486
341
  return {
487
342
  colspan: group.colspan,
488
343
  text: group.groupCaption,
489
- type: 'GT',
344
+ type: 'GT'
490
345
  };
491
346
  });
492
347
  });
493
348
  };
494
349
 
495
- /**
496
- * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
497
- * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
498
- * @returns
350
+ /**
351
+ * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
352
+ * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
353
+ * @returns
499
354
  */
500
355
  var makeSplitCondtion = function makeSplitCondtion(condition) {
501
356
  var newCondition = {
502
357
  standard: '',
503
- condition: '',
358
+ condition: ''
504
359
  };
505
360
  _toConsumableArray(condition).forEach(function (cond) {
506
361
  if (Number.isNaN(parseFloat(cond))) {
@@ -512,10 +367,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
512
367
  return newCondition;
513
368
  };
514
369
 
515
- /**
516
- * 데이터에 색상 적용
517
- * @param e onCellPrepared 이벤트
518
- * @returns
370
+ /**
371
+ * 데이터에 색상 적용
372
+ * @param e onCellPrepared 이벤트
373
+ * @returns
519
374
  */
520
375
  var makeColorAtPercent = function makeColorAtPercent(e) {
521
376
  if (!dataColor || !e.cellElement) {
@@ -526,14 +381,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
526
381
  if (e.cell.value === null) {
527
382
  return;
528
383
  }
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
- ) {
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)) {
537
385
  var standardData = makeSplitCondtion(color.condition.replace(/(\s*)/g, ''));
538
386
  var rate = color.format === 'percent' ? 0.01 : 1;
539
387
  var condition = false;
@@ -558,9 +406,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
558
406
  });
559
407
  };
560
408
 
561
- /**
562
- * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
563
- * @param dataSource
409
+ /**
410
+ * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
411
+ * @param dataSource
564
412
  */
565
413
  var checkDataSource = function checkDataSource(dataSource) {
566
414
  var isColumns = dataSource._fields.findIndex(function (field) {
@@ -580,31 +428,28 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
580
428
  }
581
429
  };
582
430
 
583
- /**
584
- * 그리드 펼침 정보 세션스토리지 리셋
431
+ /**
432
+ * 그리드 펼침 정보 세션스토리지 리셋
585
433
  */
586
434
  var resetSession = function resetSession() {
587
435
  sessionStorage.removeItem('dx-vera-pivotgrid-storing');
588
436
  };
589
437
 
590
- /**
591
- * 엑셀 export 명령
592
- * @param fileName 저장하고자 하는 엑셀파일명
438
+ /**
439
+ * 엑셀 export 명령
440
+ * @param fileName 저장하고자 하는 엑셀파일명
593
441
  */
594
442
  var exportToExcel = function exportToExcel(fileName) {
595
443
  setTimeout(function () {
596
444
  var _$tableRef$current;
597
- return exportToExcelAction(
598
- (_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance,
599
- fileName
600
- );
445
+ return exportToExcelAction((_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance, fileName);
601
446
  });
602
447
  };
603
448
 
604
- /**
605
- * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
606
- * @param component devextreme component
607
- * @returns devextreme component
449
+ /**
450
+ * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
451
+ * @param component devextreme component
452
+ * @returns devextreme component
608
453
  */
609
454
  var convertDataControllerColumnsInfo = function convertDataControllerColumnsInfo(component) {
610
455
  var arr = [];
@@ -620,9 +465,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
620
465
  return component;
621
466
  };
622
467
 
623
- /**
624
- * 엑셀 export
625
- * @param e
468
+ /**
469
+ * 엑셀 export
470
+ * @param e
626
471
  */
627
472
  var exportToExcelAction = function exportToExcelAction(e, fileName) {
628
473
  var newComponent = convertDataControllerColumnsInfo(e);
@@ -638,25 +483,22 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
638
483
  bottom: borderStyle,
639
484
  left: borderStyle,
640
485
  right: borderStyle,
641
- top: borderStyle,
486
+ top: borderStyle
642
487
  };
643
- },
488
+ }
644
489
  }).then(function () {
645
490
  workbook.xlsx.writeBuffer().then(function (buffer) {
646
- (0, _fileSaver.default)(
647
- new Blob([buffer], {
648
- type: 'application/octet-stream',
649
- }),
650
- fileName + '.xlsx'
651
- );
491
+ (0, _fileSaver.default)(new Blob([buffer], {
492
+ type: 'application/octet-stream'
493
+ }), fileName + '.xlsx');
652
494
  });
653
495
  });
654
496
  e.cancel = true;
655
497
  };
656
498
 
657
- /**
658
- * devextreme CellPreparedEvent 이벤트 실행
659
- * @param e
499
+ /**
500
+ * devextreme CellPreparedEvent 이벤트 실행
501
+ * @param e
660
502
  */
661
503
  var onCellPreparedChild = function onCellPreparedChild(e) {
662
504
  makeColorAtPercent(e);
@@ -668,8 +510,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
668
510
  return onCellPrepared ? onCellPrepared(e) : undefined;
669
511
  };
670
512
 
671
- /**
672
- * devextreme Raise Event
513
+ /**
514
+ * devextreme Raise Event
673
515
  */
674
516
  var onContentReadyChild = function onContentReadyChild(e) {
675
517
  setTimeout(function () {
@@ -696,77 +538,57 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
696
538
  var onOptionChangedChild = function onOptionChangedChild(e) {
697
539
  return onOptionChanged ? onOptionChanged(e) : undefined;
698
540
  };
699
- (0, _react.useEffect)(
700
- function () {
701
- if (customExcelButton) {
702
- }
703
- },
704
- [customExcelButton]
705
- );
706
- (0, _react.useEffect)(
707
- function () {
708
- setGridDataSource(dataSource);
709
- checkDataSource(dataSource);
710
- resetSession();
711
- },
712
- [dataSource]
713
- );
714
- return /*#__PURE__*/ _react.createElement(
715
- 'div',
716
- null,
717
- /*#__PURE__*/ _react.createElement(_loadPanel.LoadPanel, {
718
- position: {
719
- of: id,
720
- },
721
- }),
722
- /*#__PURE__*/ _react.createElement(
723
- _pivotGrid.default,
724
- {
725
- id: id,
726
- ref: $tableRef,
727
- dataSource: gridDataSource,
728
- showColumnTotals: false,
729
- showColumnGrandTotals: true,
730
- showRowGrandTotals: false,
731
- width: width,
732
- height: height,
733
- allowExpandAll: allowExpandAll,
734
- allowFiltering: allowFiltering,
735
- allowSorting: allowSorting,
736
- allowSortingBySummary: allowSortingBySummary,
737
- dataFieldArea: dataFieldArea,
738
- disabled: disabled,
739
- elementAttr: elementAttr,
740
- encodeHtml: encodeHtml,
741
- hideEmptySummaryCells: hideEmptySummaryCells,
742
- hint: hint,
743
- rowHeaderLayout: rowHeaderLayout,
744
- rtlEnabled: rtlEnabled,
745
- showBorders: showBorders,
746
- showRowTotals: showRowTotals,
747
- showTotalsPrior: showTotalsPrior,
748
- tabIndex: tabIndex,
749
- visible: visible,
750
- wordWrapEnabled: wordWrapEnabled,
751
- onCellClick: onCellClickChild,
752
- onContentReady: onContentReadyChild,
753
- onCellPrepared: onCellPreparedChild,
754
- onContextMenuPreparing: onContextMenuPreparingChild,
755
- onDisposing: onDisposingChild,
756
- onExporting: onExportingChild,
757
- onInitialized: onInitializedChild,
758
- onOptionChanged: onOptionChangedChild,
759
- },
760
- /*#__PURE__*/ _react.createElement(_dataGrid.StateStoring, {
761
- enabled: stateStoringKey === null || stateStoringKey === void 0 ? void 0 : stateStoringKey.length,
762
- type: 'sessionStorage',
763
- storageKey: stateStoringKey,
764
- }),
765
- /*#__PURE__*/ _react.createElement(_pivotGrid.FieldChooser, {
766
- enabled: false,
767
- })
768
- )
769
- );
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
+ })));
770
592
  });
771
593
  var _default = DxPlanitTreeGrid;
772
- exports.default = _default;
594
+ exports.default = _default;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,23 @@
1
- export declare const DxPlanitTreeGrid;
2
- export default DxPlanitTreeGrid;
1
+ export declare const DxPlanitTreeGrid;
2
+ export default DxPlanitTreeGrid;
3
+
4
+ export declare module DxPlanit {
5
+ export interface IGroupField {
6
+ groupCaption: string;
7
+ groupName?: string;
8
+ html?: string;
9
+ depth: number;
10
+ colspan: number;
11
+ }
12
+
13
+ export interface Props extends DevExpress.ui.dxPivotGrid.Properties {
14
+ id?: string;
15
+ dataSource?: any;
16
+ groupField?: IGroupField[];
17
+ dataColor?: IColorInfo[];
18
+ convertNullToHipen?: boolean;
19
+ convertZeroToHipen?: boolean;
20
+ stateStoringKey?: string;
21
+ customExcelButton?: boolean;
22
+ }
23
+ }
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "devextreme-planit-treegrid-react",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Devextreme의 DxPivotGrid를 Tree Grid처럼 보여주는 Wrapper입니다.",
5
5
  "main": "dist/index.js",
6
- "files": [
7
- "dist",
8
- "README.md"
9
- ],
6
+ "types": "dist/index.d.ts",
10
7
  "repository": "https://github.com/hsquare-analytics/ui-tree-grid.git",
11
8
  "author": "bcahn <antonio1926@gmail.com>",
12
9
  "license": "MIT",
@@ -15,7 +12,7 @@
15
12
  },
16
13
  "scripts": {
17
14
  "start": "react-scripts start",
18
- "build": "react-scripts build",
15
+ "build": "tsc",
19
16
  "test": "react-scripts test",
20
17
  "eject": "react-scripts eject",
21
18
  "clean": "rimraf dist",
@@ -39,7 +36,7 @@
39
36
  ],
40
37
  "dependencies": {
41
38
  "devextreme": "^22.1.6",
42
- "devextreme-planit-treegrid-react": "^0.3.0",
39
+ "devextreme-planit-treegrid-react": "^1.1.0",
43
40
  "devextreme-react": "^22.1.6",
44
41
  "exceljs": "^4.3.0",
45
42
  "file-saver": "^2.0.5",
Binary file
@@ -0,0 +1,43 @@
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
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1,27 @@
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
+ };