devextreme-planit-treegrid-react 1.0.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
  ```
@@ -31,6 +31,7 @@ npm install devextreme-planit-treegrid-react
31
31
  import DxPlanitTreeGrid from 'devextreme-planit-treegrid-react'
32
32
 
33
33
  <DxPlanitTreeGrid
34
+ id='dx-planit-vera-pivotgrid-id'
34
35
  ref={$childRef}
35
36
  dataSource={dataSource}
36
37
  groupField={TreeDataGroup}
@@ -46,6 +47,10 @@ import DxPlanitTreeGrid from 'devextreme-planit-treegrid-react'
46
47
  />
47
48
  ```
48
49
 
50
+ ```
51
+ **Note: id가 필수사항은 아니지만 가급적 사용할 것을 권고합니다. id를 사용하지 않으면 한 페이지에 여러 개의 Tree Grid를 생성할 경우 DevExtreme의 Load Pannel이 의도치 않은 곳에 생성될 수 있습니다.
52
+ ```
53
+
49
54
  DevExtreme PivotGrid에 몇몇 기능이 추가되었습니다. 추가된 기능은 아래와 같습니다.
50
55
 
51
56
  ### 1. dataColor
@@ -73,6 +78,7 @@ export const TreeDataGroup: IGroupField[] = [
73
78
  {
74
79
  groupCaption: '진료 수입 (백만원)',
75
80
  groupName: 'mediIncome',
81
+ html: '진료 수입 <em>(백만원)</em>',
76
82
  depth: 1,
77
83
  colspan: 7,
78
84
  },
@@ -89,7 +95,7 @@ export const TreeDataGroup: IGroupField[] = [
89
95
 
90
96
  \*\*Note: [DevExtreme PivotGrid](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxPivotGrid/) 중 아래의 기능은 사용 불능 처리되었습니다.
91
97
 
92
- > id, width, height, showColumnGrandTotals, showColumnTotals, showRowGrandTotals, FieldChooser
98
+ > width, height, showColumnGrandTotals, showColumnTotals, showRowGrandTotals, FieldChooser
93
99
 
94
100
  \*\*Note: [DevExtreme PivotGrid](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxPivotGrid/) 중 아래의 기능은 사용 방법이 변경되었습니다.
95
101
 
@@ -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,37 +161,29 @@ 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) {
184
+ var _group$html;
318
185
  var td = document.createElement('td');
319
- var text = group.groupCaption;
320
- if (group.depth === 1) {
321
- text = ''.concat(group.groupCaption);
322
- }
186
+ var text = (_group$html = group.html) !== null && _group$html !== void 0 ? _group$html : group.groupCaption;
323
187
  td.setAttribute('colspan', group.colspan.toString());
324
188
  td.setAttribute('class', 'dx-row-total dx-grand-total dx-planit-colspan');
325
189
  if (isLast && index === 0) {
@@ -329,33 +193,31 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
329
193
  } else if (!isLast && index === 0) {
330
194
  td.setAttribute('style', 'border-bottom: 0');
331
195
  }
332
- td.innerHTML = '<div>'.concat(text, '</div>');
196
+ td.innerHTML = "<span>".concat(text, "</span>");
333
197
  return td;
334
198
  };
335
199
 
336
- /**
337
- * 그룹 필드 데이터 유효성 검증용 데이터 생성
338
- * @param groupField
339
- * @returns
200
+ /**
201
+ * 그룹 필드 데이터 유효성 검증용 데이터 생성
202
+ * @param groupField
203
+ * @returns
340
204
  */
341
205
  var makeCheckGroupData = function makeCheckGroupData(groupField) {
342
206
  var data = {};
343
- groupField === null || groupField === void 0
344
- ? void 0
345
- : groupField.forEach(function (group) {
346
- if (data[group.depth]) {
347
- data[group.depth] += group.colspan;
348
- } else {
349
- data[group.depth] = group.colspan;
350
- }
351
- });
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
+ });
352
214
  return data;
353
215
  };
354
216
 
355
- /**
356
- * GroupField 데이터 검증
357
- * @param 사용자가 설정한 그룹 필드 정보
358
- * @returns 데이터 검증 결과
217
+ /**
218
+ * GroupField 데이터 검증
219
+ * @param 사용자가 설정한 그룹 필드 정보
220
+ * @returns 데이터 검증 결과
359
221
  */
360
222
  var isCheckGroupField = function isCheckGroupField(groupField) {
361
223
  var map = makeCheckGroupData(groupField);
@@ -368,25 +230,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
368
230
  return true;
369
231
  };
370
232
 
371
- /**
372
- * Grand Total 셀 정보 저장
373
- * @param e
233
+ /**
234
+ * Grand Total 셀 정보 저장
235
+ * @param e
374
236
  */
375
237
  var setTotalElementInfo = function setTotalElementInfo(e) {
376
238
  var _e$cell6, _e$cell7, _e$cellElement;
377
- if (
378
- !(groupField !== null && groupField !== void 0 && groupField.length) ||
379
- ((_e$cell6 = e.cell) === null || _e$cell6 === void 0 ? void 0 : _e$cell6.type) !== 'GT' ||
380
- ((_e$cell7 = e.cell) === null || _e$cell7 === void 0 ? void 0 : _e$cell7.text) !== 'Grand Total'
381
- ) {
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') {
382
240
  return;
383
241
  }
384
242
  (_e$cellElement = e.cellElement) === null || _e$cellElement === void 0 ? void 0 : _e$cellElement.classList.add(grandTotalCssNm);
385
243
  };
386
244
 
387
- /**
388
- * cell의 columnIndex 최대값 저장
389
- * @param e
245
+ /**
246
+ * cell의 columnIndex 최대값 저장
247
+ * @param e
390
248
  */
391
249
  var setMaxColumIndex = function setMaxColumIndex(e) {
392
250
  if (!e.columnIndex) {
@@ -397,19 +255,17 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
397
255
  }
398
256
  };
399
257
 
400
- /**
401
- * groupField depth의 유니크한 배열 구하기
402
- * @param group
403
- * @param arr
404
- * @returns
258
+ /**
259
+ * groupField depth의 유니크한 배열 구하기
260
+ * @param group
261
+ * @param arr
262
+ * @returns
405
263
  */
406
264
  var getGroupDepth = function getGroupDepth(group, arr) {
407
265
  var groupData = group.slice();
408
- var set = new Set(
409
- groupData.map(function (group) {
410
- return group.depth;
411
- })
412
- );
266
+ var set = new Set(groupData.map(function (group) {
267
+ return group.depth;
268
+ }));
413
269
  return Array.from(set).sort(function compare(a, b) {
414
270
  if (a > b) {
415
271
  return arr === 'asc' ? -1 : 1;
@@ -421,11 +277,11 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
421
277
  });
422
278
  };
423
279
 
424
- /**
425
- * 현재 depth에 맞는 그룹 필드 정보 반환
426
- * @param group
427
- * @param depth
428
- * @returns
280
+ /**
281
+ * 현재 depth에 맞는 그룹 필드 정보 반환
282
+ * @param group
283
+ * @param depth
284
+ * @returns
429
285
  */
430
286
  var getCurrentGroup = function getCurrentGroup(group, depth) {
431
287
  return group.filter(function (gr) {
@@ -433,8 +289,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
433
289
  });
434
290
  };
435
291
 
436
- /**
437
- * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
292
+ /**
293
+ * 테이블 헤더(DOM)에 colspan 적용된 테이블 삽입
438
294
  */
439
295
  var insertRowHeaderGroup = function insertRowHeaderGroup() {
440
296
  var _thead$previousSiblin;
@@ -454,10 +310,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
454
310
  }
455
311
  totalElement.innerHTML = '';
456
312
  totalElement.setAttribute('style', 'padding: 0; border: 0');
457
- var colgroup =
458
- (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0
459
- ? void 0
460
- : _thead$previousSiblin.cloneNode(true);
313
+ var colgroup = (_thead$previousSiblin = thead.previousSibling) === null || _thead$previousSiblin === void 0 ? void 0 : _thead$previousSiblin.cloneNode(true);
461
314
  var groupData = groupField.slice();
462
315
  var depth = getGroupDepth(groupData, 'asc');
463
316
  var table = document.createElement('table');
@@ -474,10 +327,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
474
327
  totalElement.appendChild(table);
475
328
  };
476
329
 
477
- /**
478
- * Devextreme의 dateController columnInfo에 그룹 정보 삽입
479
- * @param group
480
- * @returns
330
+ /**
331
+ * Devextreme의 dateController columnInfo에 그룹 정보 삽입
332
+ * @param group
333
+ * @returns
481
334
  */
482
335
  var makeDataControllerColumnGroup = function makeDataControllerColumnGroup(group) {
483
336
  var groupData = group.slice();
@@ -488,21 +341,21 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
488
341
  return {
489
342
  colspan: group.colspan,
490
343
  text: group.groupCaption,
491
- type: 'GT',
344
+ type: 'GT'
492
345
  };
493
346
  });
494
347
  });
495
348
  };
496
349
 
497
- /**
498
- * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
499
- * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
500
- * @returns
350
+ /**
351
+ * 사용자가 입력한 컬러 조건을 { standard: string; condition: string } 형식으로 변경 반환
352
+ * @param condition 사용자 입력 컬러 조건식 ex) '>= 100'
353
+ * @returns
501
354
  */
502
355
  var makeSplitCondtion = function makeSplitCondtion(condition) {
503
356
  var newCondition = {
504
357
  standard: '',
505
- condition: '',
358
+ condition: ''
506
359
  };
507
360
  _toConsumableArray(condition).forEach(function (cond) {
508
361
  if (Number.isNaN(parseFloat(cond))) {
@@ -514,10 +367,10 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
514
367
  return newCondition;
515
368
  };
516
369
 
517
- /**
518
- * 데이터에 색상 적용
519
- * @param e onCellPrepared 이벤트
520
- * @returns
370
+ /**
371
+ * 데이터에 색상 적용
372
+ * @param e onCellPrepared 이벤트
373
+ * @returns
521
374
  */
522
375
  var makeColorAtPercent = function makeColorAtPercent(e) {
523
376
  if (!dataColor || !e.cellElement) {
@@ -528,14 +381,7 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
528
381
  if (e.cell.value === null) {
529
382
  return;
530
383
  }
531
- if (
532
- ((_e$cell8 = e.cell) === null || _e$cell8 === void 0
533
- ? void 0
534
- : (_e$cell8$format = _e$cell8.format) === null || _e$cell8$format === void 0
535
- ? void 0
536
- : _e$cell8$format.type) === color.format &&
537
- !Number.isNaN(e.cell.value)
538
- ) {
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)) {
539
385
  var standardData = makeSplitCondtion(color.condition.replace(/(\s*)/g, ''));
540
386
  var rate = color.format === 'percent' ? 0.01 : 1;
541
387
  var condition = false;
@@ -560,9 +406,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
560
406
  });
561
407
  };
562
408
 
563
- /**
564
- * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
565
- * @param dataSource
409
+ /**
410
+ * 그리드 데이터 정합성 체크. 데이터 잘못되어 있으면 에러 발생
411
+ * @param dataSource
566
412
  */
567
413
  var checkDataSource = function checkDataSource(dataSource) {
568
414
  var isColumns = dataSource._fields.findIndex(function (field) {
@@ -582,31 +428,28 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
582
428
  }
583
429
  };
584
430
 
585
- /**
586
- * 그리드 펼침 정보 세션스토리지 리셋
431
+ /**
432
+ * 그리드 펼침 정보 세션스토리지 리셋
587
433
  */
588
434
  var resetSession = function resetSession() {
589
435
  sessionStorage.removeItem('dx-vera-pivotgrid-storing');
590
436
  };
591
437
 
592
- /**
593
- * 엑셀 export 명령
594
- * @param fileName 저장하고자 하는 엑셀파일명
438
+ /**
439
+ * 엑셀 export 명령
440
+ * @param fileName 저장하고자 하는 엑셀파일명
595
441
  */
596
442
  var exportToExcel = function exportToExcel(fileName) {
597
443
  setTimeout(function () {
598
444
  var _$tableRef$current;
599
- return exportToExcelAction(
600
- (_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance,
601
- fileName
602
- );
445
+ return exportToExcelAction((_$tableRef$current = $tableRef.current) === null || _$tableRef$current === void 0 ? void 0 : _$tableRef$current.instance, fileName);
603
446
  });
604
447
  };
605
448
 
606
- /**
607
- * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
608
- * @param component devextreme component
609
- * @returns devextreme component
449
+ /**
450
+ * devextreme component 정보의 dataController의 columnInfo에 사용자가 설정한 groupFIled 정보 병합
451
+ * @param component devextreme component
452
+ * @returns devextreme component
610
453
  */
611
454
  var convertDataControllerColumnsInfo = function convertDataControllerColumnsInfo(component) {
612
455
  var arr = [];
@@ -622,9 +465,9 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
622
465
  return component;
623
466
  };
624
467
 
625
- /**
626
- * 엑셀 export
627
- * @param e
468
+ /**
469
+ * 엑셀 export
470
+ * @param e
628
471
  */
629
472
  var exportToExcelAction = function exportToExcelAction(e, fileName) {
630
473
  var newComponent = convertDataControllerColumnsInfo(e);
@@ -640,25 +483,22 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
640
483
  bottom: borderStyle,
641
484
  left: borderStyle,
642
485
  right: borderStyle,
643
- top: borderStyle,
486
+ top: borderStyle
644
487
  };
645
- },
488
+ }
646
489
  }).then(function () {
647
490
  workbook.xlsx.writeBuffer().then(function (buffer) {
648
- (0, _fileSaver.default)(
649
- new Blob([buffer], {
650
- type: 'application/octet-stream',
651
- }),
652
- fileName + '.xlsx'
653
- );
491
+ (0, _fileSaver.default)(new Blob([buffer], {
492
+ type: 'application/octet-stream'
493
+ }), fileName + '.xlsx');
654
494
  });
655
495
  });
656
496
  e.cancel = true;
657
497
  };
658
498
 
659
- /**
660
- * devextreme CellPreparedEvent 이벤트 실행
661
- * @param e
499
+ /**
500
+ * devextreme CellPreparedEvent 이벤트 실행
501
+ * @param e
662
502
  */
663
503
  var onCellPreparedChild = function onCellPreparedChild(e) {
664
504
  makeColorAtPercent(e);
@@ -670,8 +510,8 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
670
510
  return onCellPrepared ? onCellPrepared(e) : undefined;
671
511
  };
672
512
 
673
- /**
674
- * devextreme Raise Event
513
+ /**
514
+ * devextreme Raise Event
675
515
  */
676
516
  var onContentReadyChild = function onContentReadyChild(e) {
677
517
  setTimeout(function () {
@@ -698,77 +538,57 @@ var DxPlanitTreeGrid = /*#__PURE__*/ (0, _react.forwardRef)(function (props, ref
698
538
  var onOptionChangedChild = function onOptionChangedChild(e) {
699
539
  return onOptionChanged ? onOptionChanged(e) : undefined;
700
540
  };
701
- (0, _react.useEffect)(
702
- function () {
703
- if (customExcelButton) {
704
- }
705
- },
706
- [customExcelButton]
707
- );
708
- (0, _react.useEffect)(
709
- function () {
710
- setGridDataSource(dataSource);
711
- checkDataSource(dataSource);
712
- resetSession();
713
- },
714
- [dataSource]
715
- );
716
- return /*#__PURE__*/ _react.createElement(
717
- 'div',
718
- null,
719
- /*#__PURE__*/ _react.createElement(_loadPanel.LoadPanel, {
720
- position: {
721
- of: id,
722
- },
723
- }),
724
- /*#__PURE__*/ _react.createElement(
725
- _pivotGrid.default,
726
- {
727
- id: id,
728
- ref: $tableRef,
729
- dataSource: gridDataSource,
730
- showColumnTotals: false,
731
- showColumnGrandTotals: true,
732
- showRowGrandTotals: false,
733
- width: width,
734
- height: height,
735
- allowExpandAll: allowExpandAll,
736
- allowFiltering: allowFiltering,
737
- allowSorting: allowSorting,
738
- allowSortingBySummary: allowSortingBySummary,
739
- dataFieldArea: dataFieldArea,
740
- disabled: disabled,
741
- elementAttr: elementAttr,
742
- encodeHtml: encodeHtml,
743
- hideEmptySummaryCells: hideEmptySummaryCells,
744
- hint: hint,
745
- rowHeaderLayout: rowHeaderLayout,
746
- rtlEnabled: rtlEnabled,
747
- showBorders: showBorders,
748
- showRowTotals: showRowTotals,
749
- showTotalsPrior: showTotalsPrior,
750
- tabIndex: tabIndex,
751
- visible: visible,
752
- wordWrapEnabled: wordWrapEnabled,
753
- onCellClick: onCellClickChild,
754
- onContentReady: onContentReadyChild,
755
- onCellPrepared: onCellPreparedChild,
756
- onContextMenuPreparing: onContextMenuPreparingChild,
757
- onDisposing: onDisposingChild,
758
- onExporting: onExportingChild,
759
- onInitialized: onInitializedChild,
760
- onOptionChanged: onOptionChangedChild,
761
- },
762
- /*#__PURE__*/ _react.createElement(_dataGrid.StateStoring, {
763
- enabled: stateStoringKey === null || stateStoringKey === void 0 ? void 0 : stateStoringKey.length,
764
- type: 'sessionStorage',
765
- storageKey: stateStoringKey,
766
- }),
767
- /*#__PURE__*/ _react.createElement(_pivotGrid.FieldChooser, {
768
- enabled: false,
769
- })
770
- )
771
- );
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
+ })));
772
592
  });
773
593
  var _default = DxPlanitTreeGrid;
774
- 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.0.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
+ };