@clake/react-bootstrap4-window 0.7.7 → 1.0.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.
Files changed (62) hide show
  1. package/dist/react-bootstrap4-window.js +4 -4
  2. package/lib/CTable.js +190 -203
  3. package/lib/CTable.js.map +3 -3
  4. package/lib/CTableInput.js +18 -24
  5. package/lib/CTableInput.js.map +3 -3
  6. package/lib/Drag.js +63 -27
  7. package/lib/Drag.js.map +3 -3
  8. package/lib/IconButton.js +22 -24
  9. package/lib/IconButton.js.map +3 -3
  10. package/lib/PageBar.js +9 -21
  11. package/lib/PageBar.js.map +3 -3
  12. package/lib/TopMenu.js +104 -107
  13. package/lib/TopMenu.js.map +3 -3
  14. package/lib/WCalendar.js +17 -20
  15. package/lib/WCalendar.js.map +3 -3
  16. package/lib/WCombo.js +14 -9
  17. package/lib/WCombo.js.map +3 -3
  18. package/lib/WModal.js +118 -79
  19. package/lib/WModal.js.map +3 -3
  20. package/lib/Window.js +58 -40
  21. package/lib/Window.js.map +3 -3
  22. package/lib/WindowGroup.js +19 -11
  23. package/lib/WindowGroup.js.map +3 -3
  24. package/lib/i18n/CTable.js +4 -4
  25. package/lib/i18n/CTable.js.map +3 -3
  26. package/lib/index.js +59 -36
  27. package/lib/index.js.map +3 -3
  28. package/lib/types/gulpfile.babel.d.ts +2 -0
  29. package/lib/types/gulpfile.babel.d.ts.map +1 -0
  30. package/lib/types/src/CTable.d.ts +224 -0
  31. package/lib/types/src/CTable.d.ts.map +1 -0
  32. package/lib/types/src/CTableInput.d.ts +41 -0
  33. package/lib/types/src/CTableInput.d.ts.map +1 -0
  34. package/lib/types/src/Drag.d.ts +50 -0
  35. package/lib/types/src/Drag.d.ts.map +1 -0
  36. package/lib/types/src/IconButton.d.ts +19 -0
  37. package/lib/types/src/IconButton.d.ts.map +1 -0
  38. package/lib/types/src/PageBar.d.ts +27 -0
  39. package/lib/types/src/PageBar.d.ts.map +1 -0
  40. package/lib/types/src/TopMenu.d.ts +42 -0
  41. package/lib/types/src/TopMenu.d.ts.map +1 -0
  42. package/lib/types/src/WCalendar.d.ts +32 -0
  43. package/lib/types/src/WCalendar.d.ts.map +1 -0
  44. package/lib/types/src/WCombo.d.ts +28 -0
  45. package/lib/types/src/WCombo.d.ts.map +1 -0
  46. package/lib/types/src/WModal.d.ts +106 -0
  47. package/lib/types/src/WModal.d.ts.map +1 -0
  48. package/lib/types/src/Window.d.ts +79 -0
  49. package/lib/types/src/Window.d.ts.map +1 -0
  50. package/lib/types/src/WindowGroup.d.ts +28 -0
  51. package/lib/types/src/WindowGroup.d.ts.map +1 -0
  52. package/lib/types/src/i18n/CTable.d.ts +3 -0
  53. package/lib/types/src/i18n/CTable.d.ts.map +1 -0
  54. package/lib/types/src/index.d.ts +6 -0
  55. package/lib/types/src/index.d.ts.map +1 -0
  56. package/lib/types/webpack.common.d.ts +55 -0
  57. package/lib/types/webpack.common.d.ts.map +1 -0
  58. package/lib/types/webpack.dev.d.ts +3 -0
  59. package/lib/types/webpack.dev.d.ts.map +1 -0
  60. package/lib/types/webpack.prod.d.ts +3 -0
  61. package/lib/types/webpack.prod.d.ts.map +1 -0
  62. package/package.json +17 -9
package/lib/CTable.js CHANGED
@@ -1,19 +1,17 @@
1
- /* @clake/react-bootstrap4-window v0.7.7 | by Clake
1
+ /* @clake/react-bootstrap4-window v1.0.1 | by Clake
2
2
  * Copyright (c) 2024 Clake,
3
- * 2024-03-18T14:45:06+0800
3
+ * 2024-03-28T11:03:43+0800
4
4
  */
5
5
  "use strict";
6
6
 
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports["default"] = void 0;
10
+ exports["default"] = exports.CTable = void 0;
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
- var _bind = _interopRequireDefault(require("classnames/bind"));
14
+ var _classnames = _interopRequireDefault(require("classnames"));
17
15
 
18
16
  var _reactBootstrap = require("@clake/react-bootstrap4");
19
17
 
@@ -23,7 +21,7 @@ var _Drag = _interopRequireDefault(require("./Drag"));
23
21
 
24
22
  var _CTableInput = _interopRequireDefault(require("./CTableInput"));
25
23
 
26
- var _CTable2 = _interopRequireDefault(require("./i18n/CTable"));
24
+ var _CTable3 = _interopRequireDefault(require("./i18n/CTable"));
27
25
 
28
26
  var _PageBar = _interopRequireDefault(require("./PageBar"));
29
27
 
@@ -61,22 +59,84 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
61
59
 
62
60
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
63
61
 
64
- /**
65
- * data Grid class
66
- * @extends React.Component
67
- */
68
- var CTable =
62
+ var CTable = exports.CTable =
69
63
  /*#__PURE__*/
70
64
  function (_React$Component) {
71
65
  _inherits(CTable, _React$Component);
72
66
 
73
67
  function CTable(props) {
68
+ var _this$props$dataCount, _this$props$select;
69
+
74
70
  var _this;
75
71
 
76
72
  _classCallCheck(this, CTable);
77
73
 
78
74
  _this = _possibleConstructorReturn(this, _getPrototypeOf(CTable).call(this, props));
79
75
 
76
+ _defineProperty(_assertThisInitialized(_this), "originalData", void 0);
77
+
78
+ _defineProperty(_assertThisInitialized(_this), "domId", void 0);
79
+
80
+ _defineProperty(_assertThisInitialized(_this), "select_all", void 0);
81
+
82
+ _defineProperty(_assertThisInitialized(_this), "selectRows", void 0);
83
+
84
+ _defineProperty(_assertThisInitialized(_this), "headerSplits", void 0);
85
+
86
+ _defineProperty(_assertThisInitialized(_this), "sortList", void 0);
87
+
88
+ _defineProperty(_assertThisInitialized(_this), "is_sort", void 0);
89
+
90
+ _defineProperty(_assertThisInitialized(_this), "is_filter", void 0);
91
+
92
+ _defineProperty(_assertThisInitialized(_this), "current_sort", void 0);
93
+
94
+ _defineProperty(_assertThisInitialized(_this), "filter_list", void 0);
95
+
96
+ _defineProperty(_assertThisInitialized(_this), "editRows", void 0);
97
+
98
+ _defineProperty(_assertThisInitialized(_this), "cacheRow", void 0);
99
+
100
+ _defineProperty(_assertThisInitialized(_this), "headers", void 0);
101
+
102
+ _defineProperty(_assertThisInitialized(_this), "noClone", void 0);
103
+
104
+ _defineProperty(_assertThisInitialized(_this), "lockColumns", void 0);
105
+
106
+ _defineProperty(_assertThisInitialized(_this), "isLock", void 0);
107
+
108
+ _defineProperty(_assertThisInitialized(_this), "filter", void 0);
109
+
110
+ _defineProperty(_assertThisInitialized(_this), "width", void 0);
111
+
112
+ _defineProperty(_assertThisInitialized(_this), "tableHeader", void 0);
113
+
114
+ _defineProperty(_assertThisInitialized(_this), "tableTotal", void 0);
115
+
116
+ _defineProperty(_assertThisInitialized(_this), "table_rows", void 0);
117
+
118
+ _defineProperty(_assertThisInitialized(_this), "table_head", void 0);
119
+
120
+ _defineProperty(_assertThisInitialized(_this), "table_body", void 0);
121
+
122
+ _defineProperty(_assertThisInitialized(_this), "table_total", void 0);
123
+
124
+ _defineProperty(_assertThisInitialized(_this), "split", void 0);
125
+
126
+ _defineProperty(_assertThisInitialized(_this), "mainDom", void 0);
127
+
128
+ _defineProperty(_assertThisInitialized(_this), "mainMenu", void 0);
129
+
130
+ _defineProperty(_assertThisInitialized(_this), "numMenu", void 0);
131
+
132
+ _defineProperty(_assertThisInitialized(_this), "drag", void 0);
133
+
134
+ _defineProperty(_assertThisInitialized(_this), "dragColumnLeft", void 0);
135
+
136
+ _defineProperty(_assertThisInitialized(_this), "dragWidth", void 0);
137
+
138
+ _defineProperty(_assertThisInitialized(_this), "allchk", void 0);
139
+
80
140
  _defineProperty(_assertThisInitialized(_this), "equals", function (a, b) {
81
141
  if (a === b) return true;
82
142
  if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
@@ -105,11 +165,14 @@ function (_React$Component) {
105
165
  selectHalf: false
106
166
  }, function () {
107
167
  if (typeof _this.props.onCheckAll === 'function') {
108
- _this.props.onCheckAll(_this.state.selectAll, _this.state.data);
168
+ _this.props.onCheckAll(_this.state.selectAll, _this.state.data, _this.props.jsxId);
109
169
  }
110
170
  });
111
171
  });
112
172
 
173
+ /**
174
+ * sort
175
+ */
113
176
  _defineProperty(_assertThisInitialized(_this), "sortHandler", function (e) {
114
177
  var dom = e.currentTarget;
115
178
  var sort_type = dom.dataset.sort || 'asc';
@@ -117,6 +180,10 @@ function (_React$Component) {
117
180
  _this.changeSort(dom, sort_type);
118
181
  });
119
182
 
183
+ /**
184
+ * scroll header and total foot
185
+ * @param e
186
+ */
120
187
  _defineProperty(_assertThisInitialized(_this), "scrollHandler", function (e) {
121
188
  _this.tableHeader.style.transform = "translateX(-".concat(e.currentTarget.scrollLeft, "px)"); // this.tableHeader.scrollLeft = e.currentTarget.scrollLeft;
122
189
 
@@ -152,10 +219,13 @@ function (_React$Component) {
152
219
 
153
220
  _defineProperty(_assertThisInitialized(_this), "selectPageHandler", function (page) {
154
221
  if (typeof _this.props.onSelectPage === 'function') {
155
- _this.props.onSelectPage(page);
222
+ _this.props.onSelectPage(page, _this.props.jsxId);
156
223
  }
157
224
  });
158
225
 
226
+ /**
227
+ * edit mode
228
+ */
159
229
  _defineProperty(_assertThisInitialized(_this), "addNewHandler", function (e) {
160
230
  var data = _this.state.data.slice(0);
161
231
 
@@ -167,10 +237,13 @@ function (_React$Component) {
167
237
  data: data,
168
238
  dataCount: data.length
169
239
  }, function () {
170
- document.querySelector("#".concat(_this.domId, "-edit")).previousElementSibling.querySelector('input:not([disabled])').focus();
240
+ var _document$querySelect, _document$querySelect2, _document$querySelect3;
241
+
242
+ (_document$querySelect = document.querySelector("#".concat(_this.domId, "-edit"))) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.previousElementSibling) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2.querySelector('input:not([disabled])')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.focus();
171
243
  });
172
244
  });
173
245
 
246
+ //编辑事件
174
247
  _defineProperty(_assertThisInitialized(_this), "editHandler", function (e, val, row) {
175
248
  var dataset = row === 'chk' ? e.currentTarget.dataset : e.target.dataset;
176
249
  var index = parseInt(dataset.row);
@@ -183,12 +256,12 @@ function (_React$Component) {
183
256
  if (_this.editRows.indexOf(index) === -1) {
184
257
  _this.editRows.push(index);
185
258
 
186
- var data = _this.state.data.slice(0);
259
+ var _data = _this.state.data.slice(0);
187
260
 
188
- data[index][field] = val;
261
+ _data[index][field] = val;
189
262
 
190
263
  _this.setState({
191
- data: data
264
+ data: _data
192
265
  });
193
266
  } else {
194
267
  _this.state.data[index][field] = val;
@@ -199,23 +272,24 @@ function (_React$Component) {
199
272
  }
200
273
  });
201
274
 
275
+ //自定义 onEdit 事件回调函数
202
276
  _defineProperty(_assertThisInitialized(_this), "editCallback", function (index, editData) {
203
277
  if (_this.state.data[index]) {
204
- var data = _this.state.data.slice(0);
278
+ var _data2 = _this.state.data.slice(0);
205
279
 
206
- data[index] = Object.assign(data[index], editData);
280
+ _data2[index] = Object.assign(_data2[index], editData);
207
281
 
208
282
  _this.setState({
209
- data: data
283
+ data: _data2
210
284
  });
211
285
  }
212
286
  });
213
287
 
214
288
  _this.state = {
215
289
  data: _this.props.data || [],
216
- dataCount: _this.props.dataCount,
290
+ dataCount: (_this$props$dataCount = _this.props.dataCount) !== null && _this$props$dataCount !== void 0 ? _this$props$dataCount : 0,
217
291
  page: 1,
218
- select: _this.props.select,
292
+ select: (_this$props$select = _this.props.select) !== null && _this$props$select !== void 0 ? _this$props$select : false,
219
293
  total: _this.props.total,
220
294
  filter: {
221
295
  start: '',
@@ -237,8 +311,8 @@ function (_React$Component) {
237
311
  _this.selectRows = [];
238
312
  _this.headerSplits = [];
239
313
  _this.sortList = {};
240
- _this.is_sort = typeof _this.props.onSort === 'function' || _this.props.sort;
241
- _this.is_filter = typeof _this.props.onFilter === 'function' || _this.props.filter;
314
+ _this.is_sort = typeof _this.props.onSort === 'function' || !!_this.props.sort;
315
+ _this.is_filter = typeof _this.props.onFilter === 'function' || !!_this.props.filter;
242
316
  _this.current_sort = null;
243
317
  _this.filter_list = [];
244
318
  _this.editRows = [];
@@ -262,9 +336,11 @@ function (_React$Component) {
262
336
  this.bindSplit();
263
337
  }
264
338
  }, {
265
- key: "componentWillReceiveProps",
266
- value: function componentWillReceiveProps(nextProps) {
339
+ key: "UNSAFE_componentWillReceiveProps",
340
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
267
341
  if (this.state.data !== nextProps.data) {
342
+ var _nextProps$data, _nextProps$dataCount, _nextProps$page;
343
+
268
344
  if (this.props.edit) {
269
345
  if (this.equals(this.originalData, nextProps.data)) {
270
346
  return;
@@ -301,9 +377,9 @@ function (_React$Component) {
301
377
  }
302
378
 
303
379
  this.setState({
304
- data: nextProps.data,
305
- dataCount: nextProps.dataCount,
306
- page: nextProps.page,
380
+ data: (_nextProps$data = nextProps.data) !== null && _nextProps$data !== void 0 ? _nextProps$data : [],
381
+ dataCount: (_nextProps$dataCount = nextProps.dataCount) !== null && _nextProps$dataCount !== void 0 ? _nextProps$dataCount : 0,
382
+ page: (_nextProps$page = nextProps.page) !== null && _nextProps$page !== void 0 ? _nextProps$page : 0,
307
383
  total: nextProps.total,
308
384
  selectRows: selectRows,
309
385
  selectHalf: isHalf,
@@ -339,16 +415,16 @@ function (_React$Component) {
339
415
  var _this2 = this;
340
416
 
341
417
  if (this.props.width) {
342
- this.width = 0;
418
+ var width = 0;
343
419
  var reg = /(\d+)(px|rem|cm|mm|pt)$/;
344
420
  var matchs = this.props.width.match(reg);
345
- var unit = matchs[2];
421
+ var unit = matchs ? matchs[2] : 'px';
346
422
 
347
423
  _react["default"].Children.map(this.props.children, function (item, key) {
348
424
  if (item.props.width) {
349
425
  var _matchs = item.props.width.match(reg);
350
426
 
351
- _this2.width += parseInt(_matchs[1]);
427
+ width += parseInt(_matchs[1]);
352
428
  _this2.headers[item.props.field] = item.props;
353
429
 
354
430
  if (item.props.noClone) {
@@ -358,10 +434,10 @@ function (_React$Component) {
358
434
  });
359
435
 
360
436
  if (this.props.select) {
361
- this.width += 20;
437
+ width += 20;
362
438
  }
363
439
 
364
- this.width += unit;
440
+ this.width = width + unit;
365
441
  }
366
442
  } //inner source ********************
367
443
 
@@ -449,14 +525,14 @@ function (_React$Component) {
449
525
  });
450
526
 
451
527
  if (typeof _this5.props.onCheck === "function") {
452
- _this5.props.onCheck(checked, row);
528
+ _this5.props.onCheck(checked, row, _this5.props.jsxId);
453
529
  }
454
530
  };
455
531
  }
456
532
  }, {
457
533
  key: "checkAllCheckHalf",
458
534
  value: function checkAllCheckHalf(selectRows) {
459
- if (!this.allchk || this.props.selectOnce) {
535
+ if (!this.state.selectAll || this.props.selectOnce) {
460
536
  return [false, false];
461
537
  }
462
538
 
@@ -496,7 +572,7 @@ function (_React$Component) {
496
572
 
497
573
  return function () {
498
574
  if (typeof _this6.props.onClick === 'function') {
499
- _this6.props.onClick(row, i);
575
+ _this6.props.onClick(row, i, _this6.props.jsxId);
500
576
  }
501
577
 
502
578
  if (_this6.props.select && _this6.props.rowCheck) {
@@ -514,10 +590,6 @@ function (_React$Component) {
514
590
  }
515
591
  };
516
592
  }
517
- /**
518
- * sort
519
- */
520
-
521
593
  }, {
522
594
  key: "changeSort",
523
595
  value: function changeSort(dom, sort_type) {
@@ -525,17 +597,26 @@ function (_React$Component) {
525
597
  return;
526
598
  }
527
599
 
600
+ if (!dom.dataset.field) {
601
+ return;
602
+ }
603
+
528
604
  this.clearSort(false);
529
605
  this.current_sort = dom.dataset.field;
530
606
  dom.dataset.sort = sort_type === 'asc' ? 'desc' : 'asc';
531
607
  dom.classList.remove('ck-ctable-sort');
532
608
  this.sortList[dom.dataset.field] = sort_type;
533
609
  var child = dom.querySelector('i');
610
+
611
+ if (!child) {
612
+ return;
613
+ }
614
+
534
615
  child.classList.remove('fa-sort', 'fa-sort-alpha-up', 'fa-sort-alpha-down');
535
616
  child.classList.add('fa-sort-alpha-' + (sort_type === 'asc' ? 'down' : 'up'));
536
617
 
537
618
  if (typeof this.props.onSort === 'function') {
538
- this.props.onSort(dom.dataset.field, sort_type);
619
+ this.props.onSort(dom.dataset.field, sort_type, this.props.jsxId);
539
620
  } else {// this.localSort(dom.dataset.field,sort_type)
540
621
  }
541
622
  }
@@ -544,9 +625,11 @@ function (_React$Component) {
544
625
  value: function clearSort(emitEvt) {
545
626
  if (this.current_sort) {
546
627
  var prv = document.querySelector("#".concat(this.domId, "-sort-").concat(this.current_sort));
628
+ if (!prv) return;
547
629
  prv.dataset.sort = 'asc';
548
630
  prv.classList.add('ck-ctable-sort');
549
631
  var prv_child = prv.querySelector('i');
632
+ if (!prv_child) return;
550
633
  prv_child.classList.remove('fa-sort', 'fa-sort-alpha-up', 'fa-sort-alpha-down');
551
634
  prv_child.classList.add('fa-sort');
552
635
  this.sortList[this.current_sort] = null;
@@ -555,9 +638,11 @@ function (_React$Component) {
555
638
  if (emitEvt && typeof this.props.onSort === 'function') {
556
639
  this.props.onSort('', 'clear');
557
640
  } else {
558
- this.setState({
559
- data: this.originalData.slice(0)
560
- });
641
+ if (this.props.edit) {
642
+ this.setState({
643
+ data: this.originalData.slice(0)
644
+ });
645
+ }
561
646
  }
562
647
 
563
648
  return true;
@@ -574,16 +659,12 @@ function (_React$Component) {
574
659
  if (a[field] > b[field]) return desc ? -1 : 1;
575
660
  if (a[field] < b[field]) return desc ? 1 : -1;
576
661
  if (a[field] === b[field]) return 0;
662
+ return 0;
577
663
  });
578
664
  this.setState({
579
665
  data: data
580
666
  });
581
667
  }
582
- /**
583
- * scroll header and total foot
584
- * @param e
585
- */
586
-
587
668
  }, {
588
669
  key: "menuContextHandler",
589
670
 
@@ -672,11 +753,11 @@ function (_React$Component) {
672
753
  contain: ''
673
754
  }
674
755
  });
675
- this.mainMenu.hide();
676
- this.numMenu.hide();
756
+ this.mainMenu.hide(undefined);
757
+ this.numMenu.hide(undefined);
677
758
 
678
759
  if (typeof this.props.onFilter === 'function') {
679
- this.props.onFilter(text, field, type);
760
+ this.props.onFilter(text, field, type, this.props.jsxId);
680
761
  } else {
681
762
  this.localFilter(text, field, type);
682
763
  }
@@ -728,8 +809,8 @@ function (_React$Component) {
728
809
 
729
810
  try {
730
811
  for (var _iterator = this.editRows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
731
- var row = _step.value;
732
- list.push(this.state.data[row]);
812
+ var _row2 = _step.value;
813
+ list.push(this.state.data[_row2]);
733
814
  }
734
815
  } catch (err) {
735
816
  _didIteratorError = true;
@@ -761,7 +842,7 @@ function (_React$Component) {
761
842
  }
762
843
 
763
844
  if (typeof this.props.onDelete === 'function') {
764
- this.props.onDelete(this.state.data[row_index], row_index, this.deleteRow);
845
+ this.props.onDelete(this.state.data[row_index], row_index, this.deleteRow, this.props.jsxId);
765
846
  } else {
766
847
  this.deleteRow(row_index);
767
848
  }
@@ -862,7 +943,7 @@ function (_React$Component) {
862
943
  start: function start(dragDom, eventDom) {
863
944
  var xy = _reactBootstrap.Common.GetDomXY(eventDom, _this11.mainDom);
864
945
 
865
- _this11.dragWidth = parseInt(eventDom.parentNode.style.width);
946
+ _this11.dragWidth = parseInt((eventDom === null || eventDom === void 0 ? void 0 : eventDom.parentNode).style.width);
866
947
  _this11.dragColumnLeft = xy.left - _this11.table_rows.scrollLeft;
867
948
  dragDom.style.left = _this11.dragColumnLeft + 'px';
868
949
  dragDom.classList.remove('d-none');
@@ -905,46 +986,46 @@ function (_React$Component) {
905
986
  var base = 'table ck-table';
906
987
 
907
988
  if (!!name) {
908
- base = (0, _bind["default"])(base, name);
989
+ base = (0, _classnames["default"])(base, name);
909
990
  } //striped
910
991
 
911
992
 
912
993
  if (this.props.striped && !this.props.edit) {
913
- base = (0, _bind["default"])(base, 'table-striped');
994
+ base = (0, _classnames["default"])(base, 'table-striped');
914
995
  } //theme
915
996
 
916
997
 
917
998
  if (this.props.theme) {
918
- base = (0, _bind["default"])(base, 'table-' + this.props.theme);
999
+ base = (0, _classnames["default"])(base, 'table-' + this.props.theme);
919
1000
  } //bordered
920
1001
 
921
1002
 
922
1003
  if (this.props.bordered) {
923
- base = (0, _bind["default"])(base, 'table-bordered');
1004
+ base = (0, _classnames["default"])(base, 'table-bordered');
924
1005
  } //hover
925
1006
 
926
1007
 
927
1008
  if (this.props.hover) {
928
- base = (0, _bind["default"])(base, 'table-hover');
1009
+ base = (0, _classnames["default"])(base, 'table-hover');
929
1010
  } //sm
930
1011
 
931
1012
 
932
1013
  if (this.props.sm) {
933
- base = (0, _bind["default"])(base, 'table-sm');
1014
+ base = (0, _classnames["default"])(base, 'table-sm');
934
1015
  }
935
1016
 
936
1017
  if (this.props.fontSm) {
937
- base = (0, _bind["default"])(base, 'table-font-sm');
1018
+ base = (0, _classnames["default"])(base, 'table-font-sm');
938
1019
  } //responsive
939
1020
 
940
1021
 
941
1022
  if (this.props.responsive) {
942
- base = (0, _bind["default"])(base, 'table-responsive');
1023
+ base = (0, _classnames["default"])(base, 'table-responsive');
943
1024
  } //nowrap
944
1025
 
945
1026
 
946
1027
  if (this.props.noWrap) {
947
- base = (0, _bind["default"])(base, 'ck-ctable-nowrap');
1028
+ base = (0, _classnames["default"])(base, 'ck-ctable-nowrap');
948
1029
  }
949
1030
 
950
1031
  return base;
@@ -955,10 +1036,10 @@ function (_React$Component) {
955
1036
  var base = 'ck-ctable-main d-flex flex-column';
956
1037
 
957
1038
  if (this.props.bordered) {
958
- base = (0, _bind["default"])(base, 'border');
1039
+ base = (0, _classnames["default"])(base, 'border');
959
1040
  }
960
1041
 
961
- return (0, _bind["default"])(base, this.props.className);
1042
+ return (0, _classnames["default"])(base, this.props.className);
962
1043
  }
963
1044
  }, {
964
1045
  key: "getStyles",
@@ -1004,10 +1085,10 @@ function (_React$Component) {
1004
1085
  var base = 'ck-ctable-header';
1005
1086
 
1006
1087
  if (this.props.headerTheme) {
1007
- base = (0, _bind["default"])(base, 'table-' + this.props.headerTheme);
1088
+ base = (0, _classnames["default"])(base, 'table-' + this.props.headerTheme);
1008
1089
  }
1009
1090
 
1010
- return (0, _bind["default"])(base, this.props.headClass);
1091
+ return (0, _classnames["default"])(base, this.props.headClass);
1011
1092
  }
1012
1093
  }, {
1013
1094
  key: "getTableStyles",
@@ -1089,8 +1170,8 @@ function (_React$Component) {
1089
1170
  return _this14.table_head = c;
1090
1171
  },
1091
1172
  id: "table-head-".concat(this.domId),
1092
- className: this.getClasses(),
1093
- style: this.getTableStyles()
1173
+ className: this.getClasses(''),
1174
+ style: this.getTableStyles(null)
1094
1175
  }, _react["default"].createElement("thead", {
1095
1176
  className: this.getHeaderClasses()
1096
1177
  }, _react["default"].createElement("tr", null, this.state.select || this.props.edit ? _react["default"].createElement("th", {
@@ -1130,7 +1211,7 @@ function (_React$Component) {
1130
1211
  }
1131
1212
 
1132
1213
  return _react["default"].createElement("th", {
1133
- onContextMenu: _this14.menuContextHandler,
1214
+ onContextMenu: _this14.menuContextHandler(''),
1134
1215
  id: _this14.domId + '-' + key,
1135
1216
  "data-key": 'head_' + key,
1136
1217
  style: style
@@ -1175,7 +1256,7 @@ function (_React$Component) {
1175
1256
  return _this15.renderEditRow(row, i);
1176
1257
  }
1177
1258
 
1178
- return _this15.renderRow(row, i);
1259
+ return _this15.renderRow(row, i, null);
1179
1260
  }), this.props.edit ? this.renderEditAddRow() : null)), this.props.menu ? this.renderMenu() : null, this.props.menu ? this.renderNumberMenu() : null);
1180
1261
  }
1181
1262
  }, {
@@ -1185,7 +1266,7 @@ function (_React$Component) {
1185
1266
 
1186
1267
  var checked = this.state.selectRows.indexOf(i) !== -1;
1187
1268
  var focus = i === this.state.focus && this.props.focus;
1188
- var rowClass = focus ? 'ck-table-focus' : checked ? 'ck-table-selected' : null;
1269
+ var rowClass = focus ? 'ck-table-focus' : checked ? 'ck-table-selected' : undefined;
1189
1270
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
1190
1271
  className: rowClass,
1191
1272
  onClick: this.clickHandler(row, i)
@@ -1234,9 +1315,6 @@ function (_React$Component) {
1234
1315
  "data-row": "".concat(i),
1235
1316
  "data-field": item.props.field,
1236
1317
  className: item.props.className,
1237
- style: {
1238
- 'text-align': align
1239
- },
1240
1318
  key: 'col_' + key
1241
1319
  }, _react["default"].cloneElement(item, {
1242
1320
  text: item.props.text,
@@ -1274,7 +1352,7 @@ function (_React$Component) {
1274
1352
  var _this17 = this;
1275
1353
 
1276
1354
  return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("tr", {
1277
- className: this.props.onClick ? 'click-row' : null,
1355
+ className: this.props.onClick ? 'click-row' : undefined,
1278
1356
  onClick: this.clickHandler(row, i)
1279
1357
  }, _react["default"].createElement("th", {
1280
1358
  style: {
@@ -1401,13 +1479,15 @@ function (_React$Component) {
1401
1479
  data: row[item.field],
1402
1480
  align: item.align,
1403
1481
  disabled: item.disabled,
1404
- onBlur: this.state.total && this.state.total.hasOwnProperty(item.field) ? this.calcLocalTotal(item.field) : null
1482
+ onBlur: this.state.total && this.state.total.hasOwnProperty(item.field) ? this.calcLocalTotal(item.field) : undefined
1405
1483
  });
1406
1484
  }
1407
1485
  }
1408
1486
  }, {
1409
1487
  key: "renderFoot",
1410
1488
  value: function renderFoot() {
1489
+ var _this$props$showNumbe, _this$props$showPages, _this$props$edit;
1490
+
1411
1491
  if (!this.props.foot) {
1412
1492
  return null;
1413
1493
  }
@@ -1416,9 +1496,9 @@ function (_React$Component) {
1416
1496
  page: this.state.page,
1417
1497
  dataCount: this.state.dataCount,
1418
1498
  onSelect: this.selectPageHandler,
1419
- showNumbers: this.props.showNumbers,
1420
- showPages: this.props.showPages,
1421
- noPage: this.props.edit
1499
+ showNumbers: (_this$props$showNumbe = this.props.showNumbers) !== null && _this$props$showNumbe !== void 0 ? _this$props$showNumbe : 0,
1500
+ showPages: (_this$props$showPages = this.props.showPages) !== null && _this$props$showPages !== void 0 ? _this$props$showPages : 0,
1501
+ noPage: (_this$props$edit = this.props.edit) !== null && _this$props$edit !== void 0 ? _this$props$edit : false
1422
1502
  }));
1423
1503
  }
1424
1504
  }, {
@@ -1479,10 +1559,10 @@ function (_React$Component) {
1479
1559
  var i18 = _reactBootstrap.i18n.getLang();
1480
1560
 
1481
1561
  var langStr = typeof lang === 'string' ? lang : i18["short"];
1482
- lang = _CTable2["default"][langStr];
1562
+ lang = _CTable3["default"][langStr];
1483
1563
  } else {
1484
1564
  if (typeof this.props.lang === 'string') {
1485
- lang = _CTable2["default"][this.props.lang];
1565
+ lang = _CTable3["default"][this.props.lang];
1486
1566
  } else {
1487
1567
  lang = this.props.lang;
1488
1568
  }
@@ -1502,11 +1582,13 @@ function (_React$Component) {
1502
1582
  className: "me-1",
1503
1583
  icon: "copy"
1504
1584
  }), lang['Copy']), this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1585
+ field: "",
1505
1586
  step: true
1506
1587
  }) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1507
1588
  field: "select_filter",
1508
1589
  onClick: function onClick(e, field, data) {
1509
1590
  var select = document.getSelection();
1591
+ if (!select) return;
1510
1592
 
1511
1593
  _this21.filterHandler(select.toString(), data.field, 'contain');
1512
1594
  }
@@ -1517,6 +1599,7 @@ function (_React$Component) {
1517
1599
  field: "select_exclude",
1518
1600
  onClick: function onClick(e, field, data) {
1519
1601
  var select = document.getSelection();
1602
+ if (!select) return;
1520
1603
 
1521
1604
  _this21.filterHandler(select.toString(), data.field, 'exclude');
1522
1605
  }
@@ -1534,6 +1617,7 @@ function (_React$Component) {
1534
1617
  className: "me-1",
1535
1618
  icon: "brush"
1536
1619
  }), lang['Clear Filter / Sort'])) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1620
+ field: "",
1537
1621
  step: true
1538
1622
  }) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1539
1623
  field: "equal"
@@ -1624,6 +1708,7 @@ function (_React$Component) {
1624
1708
  },
1625
1709
  icon: "search"
1626
1710
  })) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1711
+ field: "",
1627
1712
  step: true
1628
1713
  }) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1629
1714
  field: "filter",
@@ -1640,12 +1725,14 @@ function (_React$Component) {
1640
1725
  _this21.filterHandler(_this21.state.filter.condition, _this21.mainMenu.data.field, 'condition');
1641
1726
  }
1642
1727
  })) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1728
+ field: "",
1643
1729
  step: true
1644
1730
  }) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1645
1731
  field: "delete_row"
1646
1732
  }, lang['Delete Row']) : null, this.props.edit ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1647
1733
  field: "clone_row"
1648
1734
  }, lang['Clone Row']) : null, this.props.customMenu ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1735
+ field: "",
1649
1736
  step: true
1650
1737
  }) : null, this.props.customMenu ? this.props.customMenu.map(function (menu) {
1651
1738
  return _this21.explainCustomMenu(menu);
@@ -1662,10 +1749,10 @@ function (_React$Component) {
1662
1749
  var i18 = _reactBootstrap.i18n.getLang();
1663
1750
 
1664
1751
  var langStr = typeof lang === 'string' ? lang : i18["short"];
1665
- lang = _CTable2["default"][langStr];
1752
+ lang = _CTable3["default"][langStr];
1666
1753
  } else {
1667
1754
  if (typeof this.props.lang === 'string') {
1668
- lang = _CTable2["default"][this.props.lang];
1755
+ lang = _CTable3["default"][this.props.lang];
1669
1756
  } else {
1670
1757
  lang = this.props.lang;
1671
1758
  }
@@ -1685,11 +1772,13 @@ function (_React$Component) {
1685
1772
  className: "me-1",
1686
1773
  icon: "copy"
1687
1774
  }), lang['Copy']), this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1775
+ field: "",
1688
1776
  step: true
1689
1777
  }) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1690
1778
  field: "select_filter",
1691
1779
  onClick: function onClick(e, field, data) {
1692
1780
  var select = document.getSelection();
1781
+ if (!select) return;
1693
1782
 
1694
1783
  _this22.filterHandler(select.toString(), data.field, 'contain');
1695
1784
  }
@@ -1700,6 +1789,7 @@ function (_React$Component) {
1700
1789
  field: "select_exclude",
1701
1790
  onClick: function onClick(e, field, data) {
1702
1791
  var select = document.getSelection();
1792
+ if (!select) return;
1703
1793
 
1704
1794
  _this22.filterHandler(select.toString(), data.field, 'exclude');
1705
1795
  }
@@ -1717,6 +1807,7 @@ function (_React$Component) {
1717
1807
  className: "me-1",
1718
1808
  icon: "brush"
1719
1809
  }), lang['Clear Filter / Sort'])) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1810
+ field: "",
1720
1811
  step: true
1721
1812
  }) : null, this.is_filter ? _react["default"].createElement(_reactBootstrap.Menu.Item, {
1722
1813
  field: "filter",
@@ -1759,119 +1850,7 @@ function (_React$Component) {
1759
1850
  return CTable;
1760
1851
  }(_react["default"].Component);
1761
1852
 
1762
- var inputStyle = {
1763
- width: '80px'
1764
- };
1765
-
1766
- var stopEvent = function stopEvent(e) {
1767
- e.stopPropagation();
1768
- };
1769
-
1770
- CTable.propTypes = {
1771
- //主题
1772
- theme: _propTypes["default"].oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']),
1773
- //标头主题
1774
- headerTheme: _propTypes["default"].oneOf(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']),
1775
- //标头css class
1776
- headClass: _propTypes["default"].string,
1777
- //数据来源
1778
- data: _propTypes["default"].array,
1779
- //数据总记录数
1780
- dataCount: _propTypes["default"].number,
1781
- //总页数
1782
- page: _propTypes["default"].number,
1783
- //第一列是否出现选择项
1784
- select: _propTypes["default"].bool,
1785
- //是否只能选中一项
1786
- selectOnce: _propTypes["default"].bool,
1787
- //是否显示标头
1788
- header: _propTypes["default"].bool,
1789
- //
1790
- center: _propTypes["default"].bool,
1791
- //数据当前页
1792
- currentPage: _propTypes["default"].number,
1793
- //
1794
- striped: _propTypes["default"].bool,
1795
- //是否显示边框
1796
- bordered: _propTypes["default"].bool,
1797
- //行是否有hover效果
1798
- hover: _propTypes["default"].bool,
1799
- //是否小型化显示列表
1800
- sm: _propTypes["default"].bool,
1801
- //文字最小化
1802
- fontSm: _propTypes["default"].bool,
1803
- responsive: _propTypes["default"].bool,
1804
- //文字列表 left,center,right
1805
- align: _propTypes["default"].string,
1806
- //是否显示树结构
1807
- tree: _propTypes["default"].string,
1808
- //点击树事件
1809
- onClickTree: _propTypes["default"].func,
1810
- //点击事件
1811
- onClick: _propTypes["default"].func,
1812
- //选择事件
1813
- onCheck: _propTypes["default"].func,
1814
- //选择所有
1815
- onCheckAll: _propTypes["default"].func,
1816
- //过滤事件
1817
- onFilter: _propTypes["default"].func,
1818
- //排序事件
1819
- onSort: _propTypes["default"].func,
1820
- //是否列可移动
1821
- move: _propTypes["default"].bool,
1822
- //刷新事件
1823
- onRefresh: _propTypes["default"].func,
1824
- //刷新事件按钮文字
1825
- refreshText: _propTypes["default"].string,
1826
- //是否漂浮
1827
- absolute: _propTypes["default"].bool,
1828
- //漂浮X坐标
1829
- x: _propTypes["default"].string,
1830
- //漂浮Y坐标
1831
- y: _propTypes["default"].string,
1832
- //表宽
1833
- width: _propTypes["default"].string,
1834
- //表高
1835
- height: _propTypes["default"].string,
1836
- // foot : PropTypes.bool,
1837
- //是否显示列表尾
1838
- foot: _propTypes["default"].object,
1839
- //表自动随主体小设置
1840
- position: _propTypes["default"].object,
1841
- //显示的页码数
1842
- showPages: _propTypes["default"].number,
1843
- //显示的记录条数
1844
- showNumbers: _propTypes["default"].number,
1845
- //翻页事件
1846
- onSelectPage: _propTypes["default"].func,
1847
- //是否自动换行
1848
- noWrap: _propTypes["default"].bool,
1849
- //是否启用右键菜单
1850
- menu: _propTypes["default"].bool,
1851
- //是否显示每列记录总合数
1852
- total: _propTypes["default"].object,
1853
- //是否编辑模式
1854
- edit: _propTypes["default"].bool,
1855
- //数据删除事件
1856
- onDelete: _propTypes["default"].func,
1857
- //是否启用排序
1858
- sort: _propTypes["default"].bool,
1859
- //是否启用过滤
1860
- filter: _propTypes["default"].bool,
1861
- //自定义右键菜单
1862
- customMenu: _propTypes["default"].array,
1863
- //自定义显示语言
1864
- lang: _propTypes["default"].object,
1865
- source: _propTypes["default"].string,
1866
- sourceFunc: _propTypes["default"].func,
1867
- //是否显示全部选取
1868
- allSelect: _propTypes["default"].bool,
1869
- //focus 是否显示焦点
1870
- focus: _propTypes["default"].bool,
1871
- //是否全行点选
1872
- rowCheck: _propTypes["default"].bool
1873
- };
1874
- CTable.defaultProps = {
1853
+ _defineProperty(CTable, "defaultProps", {
1875
1854
  data: [],
1876
1855
  dataCount: 1,
1877
1856
  select: true,
@@ -1896,7 +1875,15 @@ CTable.defaultProps = {
1896
1875
  allSelect: true,
1897
1876
  rowCheck: false,
1898
1877
  focus: true
1878
+ });
1879
+
1880
+ var inputStyle = {
1881
+ width: '80px'
1899
1882
  };
1900
- var _default = CTable;
1901
- exports["default"] = _default;
1883
+
1884
+ var stopEvent = function stopEvent(e) {
1885
+ e.stopPropagation();
1886
+ };
1887
+
1888
+ var _default = exports["default"] = CTable;
1902
1889
  //# sourceMappingURL=CTable.js.map