aio-table 5.0.2 → 5.2.0

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 (3) hide show
  1. package/index.css +28 -24
  2. package/index.js +167 -181
  3. package/package.json +1 -1
package/index.css CHANGED
@@ -19,6 +19,7 @@
19
19
  display: flex;
20
20
  width:100%;
21
21
  flex:1;
22
+ overflow:hidden;
22
23
  }
23
24
  .aio-table-unit{
24
25
  display: grid;
@@ -35,30 +36,7 @@
35
36
  overflow-x:scroll;
36
37
  }
37
38
 
38
- /* custom scrollbar */
39
- .aio-table-unit::-webkit-scrollbar {
40
- width: 10px !important;
41
- height:10px !important;
42
- }
43
- #aio-table-first-split::-webkit-scrollbar {
44
- width: 0px !important;
45
- height: 10px !important;
46
- }
47
-
48
- .aio-table-unit::-webkit-scrollbar-track {
49
- background-color: transparent;
50
- }
51
-
52
- .aio-table-unit::-webkit-scrollbar-thumb {
53
- background-color: #cdd4e0;
54
- border-radius: 20px;
55
- border: 3px solid transparent;
56
- background-clip: content-box;
57
- }
58
-
59
- .aio-table-unit::-webkit-scrollbar-thumb:hover {
60
- background-color: #868e9e;
61
- }
39
+
62
40
  .aio-table-title{
63
41
  display:flex;
64
42
  align-items: center;
@@ -264,6 +242,9 @@ select.aio-table-paging-button{
264
242
  .aio-table-cell.aio-table-relative-filter{
265
243
  opacity:.4;
266
244
  }
245
+ .aio-table-cell.striped[data-evenodd = even]{
246
+ background:#f5f5f5
247
+ }
267
248
  .aio-table-filter-popup{
268
249
  background:#e3e6ea;
269
250
  padding:6px;
@@ -497,3 +478,26 @@ display:none;
497
478
  display: none !important;
498
479
  }
499
480
  }
481
+ /* custom scrollbar */
482
+ .aio-table-unit::-webkit-scrollbar {
483
+ width: 10px !important;
484
+ height:10px !important;
485
+ }
486
+ #aio-table-first-split::-webkit-scrollbar {
487
+ width: 0px !important;
488
+ }
489
+
490
+ .aio-table-unit::-webkit-scrollbar-track {
491
+ background-color: transparent;
492
+ }
493
+
494
+ .aio-table-unit::-webkit-scrollbar-thumb {
495
+ background-color: #cdd4e0;
496
+ border-radius: 20px;
497
+ border: 3px solid transparent;
498
+ background-clip: content-box;
499
+ }
500
+
501
+ .aio-table-unit::-webkit-scrollbar-thumb:hover {
502
+ background-color: #868e9e;
503
+ }
package/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }
4
4
 
5
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5
+ 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); }
6
6
 
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
@@ -49,9 +49,9 @@ function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Con
49
49
 
50
50
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
51
51
 
52
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
52
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
53
53
 
54
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
54
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
55
55
 
56
56
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
57
57
 
@@ -78,7 +78,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
78
78
  _classCallCheck(this, AIOTable);
79
79
 
80
80
  _this = _super.call(this, props);
81
- _this.touch = false;
81
+ var touch = ('ontouchstart' in document.documentElement);
82
82
  _this.dom = /*#__PURE__*/(0, _react.createRef)();
83
83
  var _this$props = _this.props,
84
84
  id = _this$props.id,
@@ -127,6 +127,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
127
127
  });
128
128
  });
129
129
  _this.state = {
130
+ touch: touch,
130
131
  openDictionary: openDictionary,
131
132
  filterDictionary: {},
132
133
  groupsOpen: {},
@@ -143,41 +144,30 @@ var AIOTable = /*#__PURE__*/function (_Component) {
143
144
  }
144
145
 
145
146
  _createClass(AIOTable, [{
146
- key: "onScroll",
147
- value: function onScroll(e, index) {
148
- var _this2 = this;
149
-
150
- if (!this.freezeMode) {
151
- return;
152
- }
153
-
154
- if (this.activeTableIndex === undefined) {
155
- return;
147
+ key: "onScroll1",
148
+ value: function onScroll1() {
149
+ if (!this.firstscroll) {
150
+ this.secondscroll = true;
151
+ var unit1 = (0, _jquery.default)(this.dom.current).find('#aio-table-first-split');
152
+ var unit2 = (0, _jquery.default)(this.dom.current).find('#aio-table-second-split');
153
+ var scrollTop = unit1.scrollTop();
154
+ unit2.scrollTop(scrollTop);
156
155
  }
157
156
 
158
- if (index !== this.activeTableIndex) {
159
- this.onMouseEnter(index);
160
- clearTimeout(this.timeo);
161
- this.timeo = setTimeout(function () {
162
- return _this2.bindScroll();
163
- }, 40);
164
- return;
165
- }
166
-
167
- this.bindScroll();
157
+ this.firstscroll = false;
168
158
  }
169
159
  }, {
170
- key: "bindScroll",
171
- value: function bindScroll() {
172
- var units = (0, _jquery.default)(this.dom.current).find('.aio-table-unit');
173
- var scrollTop = units.eq(this.activeTableIndex).scrollTop();
174
- units.eq(this.deactiveTableIndex).scrollTop(scrollTop);
175
- }
176
- }, {
177
- key: "onMouseEnter",
178
- value: function onMouseEnter(index) {
179
- this.activeTableIndex = index;
180
- this.deactiveTableIndex = index === 0 ? 1 : 0;
160
+ key: "onScroll2",
161
+ value: function onScroll2() {
162
+ if (!this.secondscroll) {
163
+ this.firstscroll = true;
164
+ var unit1 = (0, _jquery.default)(this.dom.current).find('#aio-table-first-split');
165
+ var unit2 = (0, _jquery.default)(this.dom.current).find('#aio-table-second-split');
166
+ var scrollTop = unit2.scrollTop();
167
+ unit1.scrollTop(scrollTop);
168
+ }
169
+
170
+ this.secondscroll = false;
181
171
  }
182
172
  }, {
183
173
  key: "getGap",
@@ -192,12 +182,12 @@ var AIOTable = /*#__PURE__*/function (_Component) {
192
182
  }, {
193
183
  key: "getClient",
194
184
  value: function getClient(e) {
195
- return this.context.touch ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY];
185
+ return this.state.touch ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY];
196
186
  }
197
187
  }, {
198
188
  key: "resizeDown",
199
189
  value: function resizeDown(e) {
200
- var touch = this.context.touch;
190
+ var touch = this.state.touch;
201
191
  (0, _jquery.default)(window).bind(touch ? 'touchmove' : 'mousemove', _jquery.default.proxy(this.resizeMove, this));
202
192
  (0, _jquery.default)(window).bind(touch ? 'touchend' : 'mouseup', _jquery.default.proxy(this.resizeUp, this));
203
193
  this.resizeDetails = {
@@ -228,7 +218,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
228
218
  }, {
229
219
  key: "resizeUp",
230
220
  value: function resizeUp() {
231
- var touch = this.context.touch;
221
+ var touch = this.state.touch;
232
222
  (0, _jquery.default)(window).unbind(touch ? 'touchmove' : 'mousemove', this.resizeMove);
233
223
  (0, _jquery.default)(window).unbind(touch ? 'touchend' : 'mouseup', this.resizeUp);
234
224
  this.setState({
@@ -260,7 +250,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
260
250
  }, {
261
251
  key: "getTable",
262
252
  value: function getTable(Toolbar) {
263
- var _this3 = this;
253
+ var _this2 = this;
264
254
 
265
255
  var rows = this.getRows();
266
256
  this.rows = rows;
@@ -292,10 +282,10 @@ var AIOTable = /*#__PURE__*/function (_Component) {
292
282
  }), /*#__PURE__*/_react.default.createElement("div", {
293
283
  className: "aio-table-splitter",
294
284
  onMouseDown: function onMouseDown(e) {
295
- return _this3.resizeDown(e);
285
+ return _this2.resizeDown(e);
296
286
  },
297
287
  onTouchStart: function onTouchStart(e) {
298
- return _this3.resizeDown(e);
288
+ return _this2.resizeDown(e);
299
289
  }
300
290
  }), true && /*#__PURE__*/_react.default.createElement(RTableUnit, {
301
291
  key: 1,
@@ -335,13 +325,13 @@ var AIOTable = /*#__PURE__*/function (_Component) {
335
325
  }, {
336
326
  key: "sort",
337
327
  value: function sort(model) {
338
- var _this4 = this;
328
+ var _this3 = this;
339
329
 
340
330
  var newModel = model.sort(function (a, b) {
341
- for (var i = 0; i < _this4.sorts.length; i++) {
342
- var _this4$sorts$i = _this4.sorts[i],
343
- getValue = _this4$sorts$i.getValue,
344
- type = _this4$sorts$i.type;
331
+ for (var i = 0; i < _this3.sorts.length; i++) {
332
+ var _this3$sorts$i = _this3.sorts[i],
333
+ getValue = _this3$sorts$i.getValue,
334
+ type = _this3$sorts$i.type;
345
335
  var aValue = getValue(a),
346
336
  bValue = getValue(b);
347
337
 
@@ -353,7 +343,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
353
343
  return 1 * (type === 'dec' ? -1 : 1);
354
344
  }
355
345
 
356
- if (i !== _this4.sorts.length - 1) {
346
+ if (i !== _this3.sorts.length - 1) {
357
347
  continue;
358
348
  }
359
349
 
@@ -857,7 +847,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
857
847
  }, {
858
848
  key: "updateColumns",
859
849
  value: function updateColumns() {
860
- var _this5 = this;
850
+ var _this4 = this;
861
851
 
862
852
  var _this$props5 = this.props,
863
853
  _this$props5$freezeMo = _this$props5.freezeMode,
@@ -868,7 +858,9 @@ var AIOTable = /*#__PURE__*/function (_Component) {
868
858
  onChangeSort = _this$props5.onChangeSort,
869
859
  _this$props5$toggleAl = _this$props5.toggleAll,
870
860
  toggleAll = _this$props5$toggleAl === void 0 ? false : _this$props5$toggleAl,
871
- id = _this$props5.id;
861
+ id = _this$props5.id,
862
+ _this$props5$toolbarI = _this$props5.toolbarItems,
863
+ toolbarItems = _this$props5$toolbarI === void 0 ? [] : _this$props5$toolbarI;
872
864
  var _this$state2 = this.state,
873
865
  groupDictionary = _this$state2.groupDictionary,
874
866
  sorts = _this$state2.sorts,
@@ -880,7 +872,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
880
872
  this.freezeColumns = [];
881
873
  this.unFreezeColumns = [];
882
874
  this.toolbar = {
883
- show: toggleAll,
875
+ show: toggleAll === true || toolbarItems.length > 0,
884
876
  toggle: [{
885
877
  text: translate('Show Columns')
886
878
  }],
@@ -919,16 +911,16 @@ var AIOTable = /*#__PURE__*/function (_Component) {
919
911
  }
920
912
 
921
913
  if (active === true) {
922
- _this5.sorts.push({
914
+ _this4.sorts.push({
923
915
  getValue: getValue,
924
916
  type: type
925
917
  });
926
918
  }
927
919
 
928
920
  if (toggle) {
929
- _this5.toolbar.show = true;
921
+ _this4.toolbar.show = true;
930
922
 
931
- _this5.toolbar.sort.push({
923
+ _this4.toolbar.sort.push({
932
924
  text: title,
933
925
  checked: active === true,
934
926
  after: /*#__PURE__*/_react.default.createElement("div", {
@@ -944,7 +936,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
944
936
  e.stopPropagation();
945
937
  sort.type = sort.type === 'dec' ? 'inc' : 'dec';
946
938
 
947
- _this5.setState({
939
+ _this4.setState({
948
940
  sorts: sorts
949
941
  });
950
942
 
@@ -958,7 +950,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
958
950
  onClick: function onClick() {
959
951
  sort.active = !active;
960
952
 
961
- _this5.setState({
953
+ _this4.setState({
962
954
  sorts: sorts
963
955
  });
964
956
 
@@ -1000,13 +992,13 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1000
992
  groupDictionary[title] = groupDictionary[title] === undefined ? active : groupDictionary[title];
1001
993
 
1002
994
  if (groupDictionary[title]) {
1003
- _this5.groups.push(group);
995
+ _this4.groups.push(group);
1004
996
  }
1005
997
 
1006
998
  if (toggle) {
1007
- _this5.toolbar.show = true;
999
+ _this4.toolbar.show = true;
1008
1000
 
1009
- _this5.toolbar.groupBy.push({
1001
+ _this4.toolbar.groupBy.push({
1010
1002
  text: title,
1011
1003
  checked: groupDictionary[title],
1012
1004
  onClick: function onClick() {
@@ -1016,7 +1008,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1016
1008
  localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
1017
1009
  }
1018
1010
 
1019
- _this5.setState({
1011
+ _this4.setState({
1020
1012
  groupDictionary: groupDictionary
1021
1013
  });
1022
1014
  }
@@ -1066,29 +1058,29 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1066
1058
 
1067
1059
  column._index = _i4;
1068
1060
 
1069
- if (show !== false && _this5.showColumnRelativeGroups(column)) {
1070
- _this5.visibleColumns.push(column);
1061
+ if (show !== false && _this4.showColumnRelativeGroups(column)) {
1062
+ _this4.visibleColumns.push(column);
1071
1063
 
1072
1064
  if (freezeMode) {
1073
1065
  if (column.freeze) {
1074
- _this5.freezeMode = true;
1066
+ _this4.freezeMode = true;
1075
1067
 
1076
- _this5.freezeColumns.push(column);
1068
+ _this4.freezeColumns.push(column);
1077
1069
  } else {
1078
- _this5.unFreezeColumns.push(column);
1070
+ _this4.unFreezeColumns.push(column);
1079
1071
  }
1080
1072
 
1081
1073
  if (column.toggleFreeze) {
1082
- _this5.toolbar.show = true;
1074
+ _this4.toolbar.show = true;
1083
1075
 
1084
- _this5.toolbar.freeze.push({
1076
+ _this4.toolbar.freeze.push({
1085
1077
  text: column.title,
1086
1078
  checked: column.freeze === true,
1087
1079
  onClick: function onClick() {
1088
1080
  column.freeze = column.freeze === true ? true : false;
1089
1081
  column.freeze = !column.freeze;
1090
1082
 
1091
- _this5.setState({
1083
+ _this4.setState({
1092
1084
  columns: columns
1093
1085
  });
1094
1086
  }
@@ -1098,9 +1090,9 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1098
1090
  }
1099
1091
 
1100
1092
  if (column.toggleShow) {
1101
- _this5.toolbar.show = true;
1093
+ _this4.toolbar.show = true;
1102
1094
 
1103
- _this5.toolbar.toggle.push({
1095
+ _this4.toolbar.toggle.push({
1104
1096
  text: column.title,
1105
1097
  checked: show !== false,
1106
1098
  onClick: function onClick() {
@@ -1115,7 +1107,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1115
1107
  column.show = !column.show;
1116
1108
  }
1117
1109
 
1118
- _this5.setState({
1110
+ _this4.setState({
1119
1111
  columns: columns
1120
1112
  });
1121
1113
  }
@@ -1123,8 +1115,8 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1123
1115
  }
1124
1116
 
1125
1117
  if (column.search) {
1126
- _this5.toolbar.show = true;
1127
- _this5.toolbar.searchColumnIndex = column._index;
1118
+ _this4.toolbar.show = true;
1119
+ _this4.toolbar.searchColumnIndex = column._index;
1128
1120
  }
1129
1121
  };
1130
1122
 
@@ -1139,7 +1131,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1139
1131
  }, {
1140
1132
  key: "getPaging",
1141
1133
  value: function getPaging() {
1142
- var _this6 = this;
1134
+ var _this5 = this;
1143
1135
 
1144
1136
  var paging = this.state.paging;
1145
1137
 
@@ -1186,7 +1178,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1186
1178
 
1187
1179
  paging.number = newNumber;
1188
1180
 
1189
- _this6.setState({
1181
+ _this5.setState({
1190
1182
  paging: paging
1191
1183
  });
1192
1184
 
@@ -1244,7 +1236,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1244
1236
  onChange: function onChange(e) {
1245
1237
  paging.size = parseInt(e.target.value);
1246
1238
 
1247
- _this6.setState({
1239
+ _this5.setState({
1248
1240
  paging: paging
1249
1241
  });
1250
1242
 
@@ -1366,7 +1358,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1366
1358
  }, {
1367
1359
  key: "render",
1368
1360
  value: function render() {
1369
- var _this7 = this;
1361
+ var _this6 = this;
1370
1362
 
1371
1363
  if (JSON.stringify(this.props.columns) !== JSON.stringify(this.state.columns)) {
1372
1364
  this.setState({
@@ -1407,23 +1399,22 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1407
1399
  var Paging = this.getPaging();
1408
1400
  var context = { ...this.props,
1409
1401
  ...this.state,
1410
- touch: this.touch,
1411
1402
  onDrag: function onDrag(obj) {
1412
- return _this7.dragStart = obj;
1403
+ return _this6.dragStart = obj;
1413
1404
  },
1414
1405
  onDrop: function onDrop(obj) {
1415
- if (!_this7.dragStart) {
1406
+ if (!_this6.dragStart) {
1416
1407
  return;
1417
1408
  }
1418
1409
 
1419
- if (_this7.dragStart._level !== obj._level) {
1410
+ if (_this6.dragStart._level !== obj._level) {
1420
1411
  return;
1421
1412
  }
1422
1413
 
1423
- if (_this7.dragStart._level === 0) {
1424
- onSwap(_this7.dragStart, obj);
1414
+ if (_this6.dragStart._level === 0) {
1415
+ onSwap(_this6.dragStart, obj);
1425
1416
  } else {
1426
- var startParents = _this7.dragStart._getParents().map(function (o) {
1417
+ var startParents = _this6.dragStart._getParents().map(function (o) {
1427
1418
  return o._index;
1428
1419
  }).toString();
1429
1420
 
@@ -1435,18 +1426,18 @@ var AIOTable = /*#__PURE__*/function (_Component) {
1435
1426
  return;
1436
1427
  }
1437
1428
 
1438
- onSwap(_this7.dragStart, obj);
1429
+ onSwap(_this6.dragStart, obj);
1439
1430
  }
1440
1431
  },
1441
1432
  onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
1442
1433
  SetState: function SetState(obj) {
1443
- return _this7.setState(obj);
1434
+ return _this6.setState(obj);
1444
1435
  },
1445
1436
  cubes2: this.cubes2.bind(this),
1446
1437
  toggleRow: this.toggleRow.bind(this),
1447
1438
  getGap: this.getGap.bind(this),
1448
- onScroll: this.onScroll.bind(this),
1449
- onMouseEnter: this.onMouseEnter.bind(this),
1439
+ onScroll1: this.onScroll1.bind(this),
1440
+ onScroll2: this.onScroll2.bind(this),
1450
1441
  getClient: this.getClient.bind(this),
1451
1442
  getLoading: this.getLoading.bind(this),
1452
1443
  groups: this.groups
@@ -1498,7 +1489,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1498
1489
  _createClass(RTableToolbar, [{
1499
1490
  key: "changeSearch",
1500
1491
  value: function changeSearch(value) {
1501
- var _this8 = this;
1492
+ var _this7 = this;
1502
1493
 
1503
1494
  var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
1504
1495
  var SetState = this.context.SetState;
@@ -1507,10 +1498,10 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1507
1498
  searchText: value
1508
1499
  });
1509
1500
  this.searchTimeout = setTimeout(function () {
1510
- var _this8$context = _this8.context,
1511
- filterDictionary = _this8$context.filterDictionary,
1512
- SetState = _this8$context.SetState;
1513
- var searchColumnIndex = _this8.props.searchColumnIndex;
1501
+ var _this7$context = _this7.context,
1502
+ filterDictionary = _this7$context.filterDictionary,
1503
+ SetState = _this7$context.SetState;
1504
+ var searchColumnIndex = _this7.props.searchColumnIndex;
1514
1505
  filterDictionary[searchColumnIndex] = {
1515
1506
  items: value ? [{
1516
1507
  operator: 'contain',
@@ -1526,7 +1517,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1526
1517
  }, {
1527
1518
  key: "render",
1528
1519
  value: function render() {
1529
- var _this9 = this;
1520
+ var _this8 = this;
1530
1521
 
1531
1522
  var _this$context = this.context,
1532
1523
  searchText = _this$context.searchText,
@@ -1585,7 +1576,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1585
1576
  value: searchText,
1586
1577
  placeholder: translate('Search'),
1587
1578
  onChange: function onChange(e) {
1588
- return _this9.changeSearch(e.target.value);
1579
+ return _this8.changeSearch(e.target.value);
1589
1580
  }
1590
1581
  }), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1591
1582
  className: "aio-table-search-icon",
@@ -1596,7 +1587,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1596
1587
  return;
1597
1588
  }
1598
1589
 
1599
- _this9.changeSearch('', 0);
1590
+ _this8.changeSearch('', 0);
1600
1591
  }
1601
1592
  })), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
1602
1593
  style: {
@@ -1655,13 +1646,13 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1655
1646
  var _super3 = _createSuper(RTableUnit);
1656
1647
 
1657
1648
  function RTableUnit(props) {
1658
- var _this10;
1649
+ var _this9;
1659
1650
 
1660
1651
  _classCallCheck(this, RTableUnit);
1661
1652
 
1662
- _this10 = _super3.call(this, props);
1663
- _this10.dom = /*#__PURE__*/(0, _react.createRef)();
1664
- return _this10;
1653
+ _this9 = _super3.call(this, props);
1654
+ _this9.dom = /*#__PURE__*/(0, _react.createRef)();
1655
+ return _this9;
1665
1656
  }
1666
1657
 
1667
1658
  _createClass(RTableUnit, [{
@@ -1755,11 +1746,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1755
1746
  }, {
1756
1747
  key: "getTitles",
1757
1748
  value: function getTitles() {
1758
- var _this11 = this;
1749
+ var _this10 = this;
1759
1750
 
1760
1751
  var columns = this.props.columns;
1761
1752
  return columns.map(function (column) {
1762
- return _this11.getTitle(column);
1753
+ return _this10.getTitle(column);
1763
1754
  });
1764
1755
  }
1765
1756
  }, {
@@ -1809,7 +1800,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1809
1800
  }, {
1810
1801
  key: "getTitle",
1811
1802
  value: function getTitle(column) {
1812
- var _this12 = this;
1803
+ var _this11 = this;
1813
1804
 
1814
1805
  if (column.template === 'gantt') {
1815
1806
  return this.getGanttTitle(column);
@@ -1840,7 +1831,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1840
1831
  },
1841
1832
  draggable: false
1842
1833
  }, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
1843
- return column.resizable ? _this12.resizeDown(e, column) : undefined;
1834
+ return column.resizable ? _this11.resizeDown(e, column) : undefined;
1844
1835
  });
1845
1836
 
1846
1837
  var titleProps = {
@@ -1851,24 +1842,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1851
1842
  },
1852
1843
  draggable: column.movable !== false,
1853
1844
  onDragStart: function onDragStart(e) {
1854
- _this12.startColumnSwap = column._index;
1845
+ _this11.startColumnSwap = column._index;
1855
1846
  },
1856
1847
  onDragOver: function onDragOver(e) {
1857
1848
  e.preventDefault();
1858
- _this12.endColumnSwap = column._index;
1849
+ _this11.endColumnSwap = column._index;
1859
1850
  },
1860
1851
  onDrop: function onDrop(e) {
1861
1852
  if (column.movable === false) {
1862
1853
  return;
1863
1854
  }
1864
1855
 
1865
- if (_this12.startColumnSwap === undefined || _this12.startColumnSwap === _this12.endColumnSwap) {
1856
+ if (_this11.startColumnSwap === undefined || _this11.startColumnSwap === _this11.endColumnSwap) {
1866
1857
  return;
1867
1858
  }
1868
1859
 
1869
- var temp = columns[_this12.startColumnSwap];
1870
- columns[_this12.startColumnSwap] = columns[_this12.endColumnSwap];
1871
- columns[_this12.endColumnSwap] = temp;
1860
+ var temp = columns[_this11.startColumnSwap];
1861
+ columns[_this11.startColumnSwap] = columns[_this11.endColumnSwap];
1862
+ columns[_this11.endColumnSwap] = temp;
1872
1863
  SetState({
1873
1864
  columns: columns
1874
1865
  });
@@ -2049,12 +2040,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2049
2040
  }, {
2050
2041
  key: "card",
2051
2042
  value: function card() {
2052
- var _this13 = this;
2043
+ var _this12 = this;
2053
2044
 
2054
2045
  var _this$context11 = this.context,
2055
2046
  indent = _this$context11.indent,
2056
- _onMouseEnter = _this$context11.onMouseEnter,
2057
- _onScroll = _this$context11.onScroll,
2047
+ onScroll1 = _this$context11.onScroll1,
2048
+ onScroll2 = _this$context11.onScroll2,
2058
2049
  rowHeight = _this$context11.rowHeight,
2059
2050
  _this$context11$cardG = _this$context11.cardGap,
2060
2051
  cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
@@ -2091,14 +2082,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2091
2082
  gridColumnGap: columnGap,
2092
2083
  gridTemplateColumns: cardRowCount === 'auto' ? undefined : "repeat(".concat(cardRowCount, ",auto)")
2093
2084
  },
2094
- onMouseEnter: function onMouseEnter() {
2095
- return _onMouseEnter(index);
2096
- },
2097
- onMouseDown: function onMouseDown() {
2098
- return _onMouseEnter(index);
2099
- },
2100
2085
  onScroll: function onScroll(e) {
2101
- return _onScroll(e, index);
2086
+ return index === 0 ? onScroll1() : onScroll2();
2102
2087
  }
2103
2088
  }, rows && rows.length !== 0 && rows.map(function (row, i) {
2104
2089
  if (row._groupId) {
@@ -2112,7 +2097,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2112
2097
  width: width,
2113
2098
  flexShrink: 0
2114
2099
  }
2115
- }), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2100
+ }), _this12.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2116
2101
  className: "aio-table-group-text"
2117
2102
  }, row._groupValue)));
2118
2103
  }
@@ -2128,7 +2113,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2128
2113
  }, {
2129
2114
  key: "render",
2130
2115
  value: function render() {
2131
- var _this14 = this;
2116
+ var _this13 = this;
2132
2117
 
2133
2118
  if (this.context.cardTemplate) {
2134
2119
  return this.card();
@@ -2136,8 +2121,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2136
2121
 
2137
2122
  var _this$context12 = this.context,
2138
2123
  indent = _this$context12.indent,
2139
- _onMouseEnter2 = _this$context12.onMouseEnter,
2140
- _onScroll2 = _this$context12.onScroll,
2124
+ onScroll1 = _this$context12.onScroll1,
2125
+ onScroll2 = _this$context12.onScroll2,
2141
2126
  rowHeight = _this$context12.rowHeight,
2142
2127
  groups = _this$context12.groups,
2143
2128
  getLoading = _this$context12.getLoading,
@@ -2154,14 +2139,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2154
2139
  onKeyDown: this.keyDown.bind(this),
2155
2140
  style: this.getStyle(),
2156
2141
  ref: this.dom,
2157
- onMouseEnter: function onMouseEnter() {
2158
- return _onMouseEnter2(index);
2159
- },
2160
- onMouseDown: function onMouseDown() {
2161
- return _onMouseEnter2(index);
2162
- },
2163
2142
  onScroll: function onScroll(e) {
2164
- return _onScroll2(e, index);
2143
+ return index === 0 ? onScroll1() : onScroll2();
2165
2144
  }
2166
2145
  }, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
2167
2146
  if (row._groupId) {
@@ -2169,7 +2148,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2169
2148
  return /*#__PURE__*/_react.default.createElement("div", {
2170
2149
  className: "aio-table-group",
2171
2150
  key: 'group' + i + '-' + index,
2172
- style: { ..._this14.getFullCellStyle(),
2151
+ style: { ..._this13.getFullCellStyle(),
2173
2152
  height: rowHeight
2174
2153
  }
2175
2154
  }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
@@ -2177,7 +2156,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2177
2156
  width: width,
2178
2157
  flexShrink: 0
2179
2158
  }
2180
- }), _this14.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2159
+ }), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2181
2160
  className: "aio-table-group-text"
2182
2161
  }, row._groupValue)));
2183
2162
  }
@@ -2206,19 +2185,19 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2206
2185
  var _super4 = _createSuper(AIOTableCell);
2207
2186
 
2208
2187
  function AIOTableCell(props) {
2209
- var _this15;
2188
+ var _this14;
2210
2189
 
2211
2190
  _classCallCheck(this, AIOTableCell);
2212
2191
 
2213
- _this15 = _super4.call(this, props);
2214
- _this15.dom = /*#__PURE__*/(0, _react.createRef)();
2215
- var value = _this15.props.value;
2216
- _this15.state = {
2192
+ _this14 = _super4.call(this, props);
2193
+ _this14.dom = /*#__PURE__*/(0, _react.createRef)();
2194
+ var value = _this14.props.value;
2195
+ _this14.state = {
2217
2196
  value: value,
2218
2197
  error: false,
2219
2198
  prevValue: value
2220
2199
  };
2221
- return _this15;
2200
+ return _this14;
2222
2201
  }
2223
2202
 
2224
2203
  _createClass(AIOTableCell, [{
@@ -2273,8 +2252,13 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2273
2252
  }, {
2274
2253
  key: "getClassName",
2275
2254
  value: function getClassName(row, column) {
2255
+ var striped = this.context.striped;
2276
2256
  var className = 'aio-table-cell';
2277
2257
 
2258
+ if (striped) {
2259
+ className += ' striped';
2260
+ }
2261
+
2278
2262
  if (column.template) {
2279
2263
  className += ' aio-table-cell-template';
2280
2264
  }
@@ -2506,7 +2490,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2506
2490
  }, {
2507
2491
  key: "getInput",
2508
2492
  value: function getInput(row, column) {
2509
- var _this16 = this;
2493
+ var _this15 = this;
2510
2494
 
2511
2495
  var type = column.inlineEdit.type;
2512
2496
  var value = this.state.value;
@@ -2530,23 +2514,23 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2530
2514
  textAlign: column.justify ? 'center' : undefined
2531
2515
  },
2532
2516
  onChange: function onChange(e) {
2533
- return _this16.setState({
2517
+ return _this15.setState({
2534
2518
  value: e.target.value
2535
2519
  });
2536
2520
  },
2537
2521
  onBlur: async function onBlur(e) {
2538
- _this16.setState({
2522
+ _this15.setState({
2539
2523
  loading: true
2540
2524
  });
2541
2525
 
2542
2526
  var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
2543
2527
 
2544
- _this16.setState({
2528
+ _this15.setState({
2545
2529
  loading: false
2546
2530
  });
2547
2531
 
2548
2532
  if (typeof error === 'string') {
2549
- _this16.setState({
2533
+ _this15.setState({
2550
2534
  error: error
2551
2535
  });
2552
2536
  }
@@ -2571,27 +2555,27 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2571
2555
  className: "aio-table-input-container"
2572
2556
  }, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
2573
2557
  onFocus: function onFocus() {
2574
- return _this16.focus = true;
2558
+ return _this15.focus = true;
2575
2559
  },
2576
2560
  onBlur: function onBlur() {
2577
- return _this16.focus = false;
2561
+ return _this15.focus = false;
2578
2562
  },
2579
2563
  onChange: async function onChange(e) {
2580
2564
  var value = e.target.value;
2581
2565
 
2582
- _this16.setState({
2566
+ _this15.setState({
2583
2567
  loading: true,
2584
2568
  value: value
2585
2569
  });
2586
2570
 
2587
2571
  var error = await column.inlineEdit.onChange(row, e.target.value);
2588
2572
 
2589
- _this16.setState({
2573
+ _this15.setState({
2590
2574
  loading: false
2591
2575
  });
2592
2576
 
2593
2577
  if (typeof error === 'string') {
2594
- _this16.setState({
2578
+ _this15.setState({
2595
2579
  error: error
2596
2580
  });
2597
2581
  }
@@ -2621,7 +2605,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2621
2605
  }, {
2622
2606
  key: "render",
2623
2607
  value: function render() {
2624
- var _this17 = this;
2608
+ var _this16 = this;
2625
2609
 
2626
2610
  var _this$context14 = this.context,
2627
2611
  indent = _this$context14.indent,
@@ -2661,8 +2645,8 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2661
2645
  cell = /*#__PURE__*/_react.default.createElement("div", {
2662
2646
  className: "aio-table-error",
2663
2647
  onClick: function onClick() {
2664
- _this17.setState({
2665
- value: _this17.props.value,
2648
+ _this16.setState({
2649
+ value: _this16.props.value,
2666
2650
  error: false
2667
2651
  });
2668
2652
  }
@@ -2688,6 +2672,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2688
2672
  ref: this.dom,
2689
2673
  cellid: cellId,
2690
2674
  title: typeof content === 'string' ? content : '',
2675
+ "data-evenodd": row._index % 2 === 0 ? 'even' : 'odd',
2691
2676
  rowindex: row._renderIndex,
2692
2677
  colindex: column._renderIndex,
2693
2678
  childindex: row._childIndex,
@@ -2734,14 +2719,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2734
2719
  var _super5 = _createSuper(AIOSlider);
2735
2720
 
2736
2721
  function AIOSlider(props) {
2737
- var _this18;
2722
+ var _this17;
2738
2723
 
2739
2724
  _classCallCheck(this, AIOSlider);
2740
2725
 
2741
- _this18 = _super5.call(this, props);
2742
- var _this18$props = _this18.props,
2743
- column = _this18$props.column,
2744
- row = _this18$props.row;
2726
+ _this17 = _super5.call(this, props);
2727
+ var _this17$props = _this17.props,
2728
+ column = _this17$props.column,
2729
+ row = _this17$props.row;
2745
2730
  var getValue = column.getValue;
2746
2731
  var value = getValue(row);
2747
2732
 
@@ -2749,11 +2734,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2749
2734
  value = [value];
2750
2735
  }
2751
2736
 
2752
- _this18.state = {
2737
+ _this17.state = {
2753
2738
  value: value
2754
2739
  };
2755
- _this18.updateMode = 'outside';
2756
- return _this18;
2740
+ _this17.updateMode = 'outside';
2741
+ return _this17;
2757
2742
  }
2758
2743
 
2759
2744
  _createClass(AIOSlider, [{
@@ -2772,7 +2757,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2772
2757
  }, {
2773
2758
  key: "render",
2774
2759
  value: function render() {
2775
- var _this19 = this;
2760
+ var _this18 = this;
2776
2761
 
2777
2762
  var _this$props13 = this.props,
2778
2763
  column = _this$props13.column,
@@ -2866,7 +2851,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2866
2851
  fillStyle: {
2867
2852
  height: '6px',
2868
2853
  borderRadius: '24px',
2869
- background: _this19.getBackground(value.length, i, color)
2854
+ background: _this18.getBackground(value.length, i, color)
2870
2855
  }
2871
2856
  };
2872
2857
  }),
@@ -2889,7 +2874,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2889
2874
  return;
2890
2875
  }
2891
2876
 
2892
- _this19.updateMode = 'onChange';
2877
+ _this18.updateMode = 'onChange';
2893
2878
  onChange(row, points.length > 1 ? points.map(function (p) {
2894
2879
  return p.value;
2895
2880
  }) : points[0].value);
@@ -2899,9 +2884,9 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2899
2884
  },
2900
2885
  ondrag: function ondrag(_ref2) {
2901
2886
  var points = _ref2.points;
2902
- _this19.updateMode = 'onDrag';
2887
+ _this18.updateMode = 'onDrag';
2903
2888
 
2904
- _this19.setState({
2889
+ _this18.setState({
2905
2890
  value: points.map(function (p) {
2906
2891
  return p.value;
2907
2892
  })
@@ -2957,6 +2942,7 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
2957
2942
  }, /*#__PURE__*/_react.default.createElement(_aioButton.default, {
2958
2943
  type: "button",
2959
2944
  rtl: rtl,
2945
+ caret: false,
2960
2946
  openRelatedTo: ".aio-table",
2961
2947
  text: icon,
2962
2948
  popOver: function popOver() {
@@ -3009,7 +2995,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
3009
2995
  }, {
3010
2996
  key: "render",
3011
2997
  value: function render() {
3012
- var _this20 = this;
2998
+ var _this19 = this;
3013
2999
 
3014
3000
  var column = this.props.column;
3015
3001
  var _this$context17 = this.context,
@@ -3046,7 +3032,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
3046
3032
  }, /*#__PURE__*/_react.default.createElement("button", {
3047
3033
  className: "aio-table-filter-add",
3048
3034
  onClick: function onClick() {
3049
- return _this20.add();
3035
+ return _this19.add();
3050
3036
  }
3051
3037
  }, translate('Add'))));
3052
3038
  }
@@ -3063,17 +3049,17 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3063
3049
  var _super8 = _createSuper(RTableFilterItem);
3064
3050
 
3065
3051
  function RTableFilterItem(props) {
3066
- var _this21;
3052
+ var _this20;
3067
3053
 
3068
3054
  _classCallCheck(this, RTableFilterItem);
3069
3055
 
3070
- _this21 = _super8.call(this, props);
3071
- var filter = _this21.props.filter;
3072
- _this21.state = {
3056
+ _this20 = _super8.call(this, props);
3057
+ var filter = _this20.props.filter;
3058
+ _this20.state = {
3073
3059
  value: filter.value,
3074
3060
  prevValue: filter.value
3075
3061
  };
3076
- return _this21;
3062
+ return _this20;
3077
3063
  }
3078
3064
 
3079
3065
  _createClass(RTableFilterItem, [{
@@ -3098,7 +3084,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3098
3084
  }, {
3099
3085
  key: "changeValue",
3100
3086
  value: function changeValue(value) {
3101
- var _this22 = this;
3087
+ var _this21 = this;
3102
3088
 
3103
3089
  var onChangeFilter = this.context.onChangeFilter;
3104
3090
  clearTimeout(this.timeout);
@@ -3106,12 +3092,12 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3106
3092
  value: value
3107
3093
  });
3108
3094
  this.timeout = setTimeout(function () {
3109
- var _this22$context = _this22.context,
3110
- SetState = _this22$context.SetState,
3111
- filterDictionary = _this22$context.filterDictionary;
3112
- var _this22$props = _this22.props,
3113
- column = _this22$props.column,
3114
- index = _this22$props.index;
3095
+ var _this21$context = _this21.context,
3096
+ SetState = _this21$context.SetState,
3097
+ filterDictionary = _this21$context.filterDictionary;
3098
+ var _this21$props = _this21.props,
3099
+ column = _this21$props.column,
3100
+ index = _this21$props.index;
3115
3101
  filterDictionary[column._index].items[index].value = value;
3116
3102
 
3117
3103
  if (onChangeFilter) {
@@ -3126,7 +3112,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3126
3112
  }, {
3127
3113
  key: "render",
3128
3114
  value: function render() {
3129
- var _this23 = this;
3115
+ var _this22 = this;
3130
3116
 
3131
3117
  var _this$context19 = this.context,
3132
3118
  filterDictionary = _this$context19.filterDictionary,
@@ -3184,7 +3170,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3184
3170
  type: type,
3185
3171
  value: value,
3186
3172
  onChange: function onChange(e) {
3187
- return _this23.changeValue(e.target.value);
3173
+ return _this22.changeValue(e.target.value);
3188
3174
  }
3189
3175
  }), /*#__PURE__*/_react.default.createElement("div", {
3190
3176
  style: {
@@ -3193,7 +3179,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3193
3179
  }), /*#__PURE__*/_react.default.createElement("div", {
3194
3180
  className: "aio-table-filter-remove",
3195
3181
  onClick: function onClick() {
3196
- return _this23.remove(index);
3182
+ return _this22.remove(index);
3197
3183
  }
3198
3184
  }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
3199
3185
  path: _js.mdiClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-table",
3
- "version": "5.0.2",
3
+ "version": "5.2.0",
4
4
  "description": "all in one table. tree mode , simple mode , tree mode, gantt mode , groupby mode, freeze mode.",
5
5
  "main": "index.js",
6
6
  "scripts": {