aio-table 5.0.4 → 5.1.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.
- package/index.js +153 -176
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -78,7 +78,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
78
78
|
_classCallCheck(this, AIOTable);
|
|
79
79
|
|
|
80
80
|
_this = _super.call(this, props);
|
|
81
|
-
|
|
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: "
|
|
147
|
-
value: function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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: "
|
|
171
|
-
value: function
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
285
|
+
return _this2.resizeDown(e);
|
|
296
286
|
},
|
|
297
287
|
onTouchStart: function onTouchStart(e) {
|
|
298
|
-
return
|
|
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
|
|
328
|
+
var _this3 = this;
|
|
339
329
|
|
|
340
330
|
var newModel = model.sort(function (a, b) {
|
|
341
|
-
for (var i = 0; i <
|
|
342
|
-
var
|
|
343
|
-
getValue =
|
|
344
|
-
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 !==
|
|
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
|
|
850
|
+
var _this4 = this;
|
|
861
851
|
|
|
862
852
|
var _this$props5 = this.props,
|
|
863
853
|
_this$props5$freezeMo = _this$props5.freezeMode,
|
|
@@ -921,16 +911,16 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
921
911
|
}
|
|
922
912
|
|
|
923
913
|
if (active === true) {
|
|
924
|
-
|
|
914
|
+
_this4.sorts.push({
|
|
925
915
|
getValue: getValue,
|
|
926
916
|
type: type
|
|
927
917
|
});
|
|
928
918
|
}
|
|
929
919
|
|
|
930
920
|
if (toggle) {
|
|
931
|
-
|
|
921
|
+
_this4.toolbar.show = true;
|
|
932
922
|
|
|
933
|
-
|
|
923
|
+
_this4.toolbar.sort.push({
|
|
934
924
|
text: title,
|
|
935
925
|
checked: active === true,
|
|
936
926
|
after: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -946,7 +936,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
946
936
|
e.stopPropagation();
|
|
947
937
|
sort.type = sort.type === 'dec' ? 'inc' : 'dec';
|
|
948
938
|
|
|
949
|
-
|
|
939
|
+
_this4.setState({
|
|
950
940
|
sorts: sorts
|
|
951
941
|
});
|
|
952
942
|
|
|
@@ -960,7 +950,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
960
950
|
onClick: function onClick() {
|
|
961
951
|
sort.active = !active;
|
|
962
952
|
|
|
963
|
-
|
|
953
|
+
_this4.setState({
|
|
964
954
|
sorts: sorts
|
|
965
955
|
});
|
|
966
956
|
|
|
@@ -1002,13 +992,13 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1002
992
|
groupDictionary[title] = groupDictionary[title] === undefined ? active : groupDictionary[title];
|
|
1003
993
|
|
|
1004
994
|
if (groupDictionary[title]) {
|
|
1005
|
-
|
|
995
|
+
_this4.groups.push(group);
|
|
1006
996
|
}
|
|
1007
997
|
|
|
1008
998
|
if (toggle) {
|
|
1009
|
-
|
|
999
|
+
_this4.toolbar.show = true;
|
|
1010
1000
|
|
|
1011
|
-
|
|
1001
|
+
_this4.toolbar.groupBy.push({
|
|
1012
1002
|
text: title,
|
|
1013
1003
|
checked: groupDictionary[title],
|
|
1014
1004
|
onClick: function onClick() {
|
|
@@ -1018,7 +1008,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1018
1008
|
localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
|
|
1019
1009
|
}
|
|
1020
1010
|
|
|
1021
|
-
|
|
1011
|
+
_this4.setState({
|
|
1022
1012
|
groupDictionary: groupDictionary
|
|
1023
1013
|
});
|
|
1024
1014
|
}
|
|
@@ -1068,29 +1058,29 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1068
1058
|
|
|
1069
1059
|
column._index = _i4;
|
|
1070
1060
|
|
|
1071
|
-
if (show !== false &&
|
|
1072
|
-
|
|
1061
|
+
if (show !== false && _this4.showColumnRelativeGroups(column)) {
|
|
1062
|
+
_this4.visibleColumns.push(column);
|
|
1073
1063
|
|
|
1074
1064
|
if (freezeMode) {
|
|
1075
1065
|
if (column.freeze) {
|
|
1076
|
-
|
|
1066
|
+
_this4.freezeMode = true;
|
|
1077
1067
|
|
|
1078
|
-
|
|
1068
|
+
_this4.freezeColumns.push(column);
|
|
1079
1069
|
} else {
|
|
1080
|
-
|
|
1070
|
+
_this4.unFreezeColumns.push(column);
|
|
1081
1071
|
}
|
|
1082
1072
|
|
|
1083
1073
|
if (column.toggleFreeze) {
|
|
1084
|
-
|
|
1074
|
+
_this4.toolbar.show = true;
|
|
1085
1075
|
|
|
1086
|
-
|
|
1076
|
+
_this4.toolbar.freeze.push({
|
|
1087
1077
|
text: column.title,
|
|
1088
1078
|
checked: column.freeze === true,
|
|
1089
1079
|
onClick: function onClick() {
|
|
1090
1080
|
column.freeze = column.freeze === true ? true : false;
|
|
1091
1081
|
column.freeze = !column.freeze;
|
|
1092
1082
|
|
|
1093
|
-
|
|
1083
|
+
_this4.setState({
|
|
1094
1084
|
columns: columns
|
|
1095
1085
|
});
|
|
1096
1086
|
}
|
|
@@ -1100,9 +1090,9 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1100
1090
|
}
|
|
1101
1091
|
|
|
1102
1092
|
if (column.toggleShow) {
|
|
1103
|
-
|
|
1093
|
+
_this4.toolbar.show = true;
|
|
1104
1094
|
|
|
1105
|
-
|
|
1095
|
+
_this4.toolbar.toggle.push({
|
|
1106
1096
|
text: column.title,
|
|
1107
1097
|
checked: show !== false,
|
|
1108
1098
|
onClick: function onClick() {
|
|
@@ -1117,7 +1107,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1117
1107
|
column.show = !column.show;
|
|
1118
1108
|
}
|
|
1119
1109
|
|
|
1120
|
-
|
|
1110
|
+
_this4.setState({
|
|
1121
1111
|
columns: columns
|
|
1122
1112
|
});
|
|
1123
1113
|
}
|
|
@@ -1125,8 +1115,8 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1125
1115
|
}
|
|
1126
1116
|
|
|
1127
1117
|
if (column.search) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1118
|
+
_this4.toolbar.show = true;
|
|
1119
|
+
_this4.toolbar.searchColumnIndex = column._index;
|
|
1130
1120
|
}
|
|
1131
1121
|
};
|
|
1132
1122
|
|
|
@@ -1141,7 +1131,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1141
1131
|
}, {
|
|
1142
1132
|
key: "getPaging",
|
|
1143
1133
|
value: function getPaging() {
|
|
1144
|
-
var
|
|
1134
|
+
var _this5 = this;
|
|
1145
1135
|
|
|
1146
1136
|
var paging = this.state.paging;
|
|
1147
1137
|
|
|
@@ -1188,7 +1178,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1188
1178
|
|
|
1189
1179
|
paging.number = newNumber;
|
|
1190
1180
|
|
|
1191
|
-
|
|
1181
|
+
_this5.setState({
|
|
1192
1182
|
paging: paging
|
|
1193
1183
|
});
|
|
1194
1184
|
|
|
@@ -1246,7 +1236,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1246
1236
|
onChange: function onChange(e) {
|
|
1247
1237
|
paging.size = parseInt(e.target.value);
|
|
1248
1238
|
|
|
1249
|
-
|
|
1239
|
+
_this5.setState({
|
|
1250
1240
|
paging: paging
|
|
1251
1241
|
});
|
|
1252
1242
|
|
|
@@ -1368,7 +1358,7 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1368
1358
|
}, {
|
|
1369
1359
|
key: "render",
|
|
1370
1360
|
value: function render() {
|
|
1371
|
-
var
|
|
1361
|
+
var _this6 = this;
|
|
1372
1362
|
|
|
1373
1363
|
if (JSON.stringify(this.props.columns) !== JSON.stringify(this.state.columns)) {
|
|
1374
1364
|
this.setState({
|
|
@@ -1409,23 +1399,22 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1409
1399
|
var Paging = this.getPaging();
|
|
1410
1400
|
var context = { ...this.props,
|
|
1411
1401
|
...this.state,
|
|
1412
|
-
touch: this.touch,
|
|
1413
1402
|
onDrag: function onDrag(obj) {
|
|
1414
|
-
return
|
|
1403
|
+
return _this6.dragStart = obj;
|
|
1415
1404
|
},
|
|
1416
1405
|
onDrop: function onDrop(obj) {
|
|
1417
|
-
if (!
|
|
1406
|
+
if (!_this6.dragStart) {
|
|
1418
1407
|
return;
|
|
1419
1408
|
}
|
|
1420
1409
|
|
|
1421
|
-
if (
|
|
1410
|
+
if (_this6.dragStart._level !== obj._level) {
|
|
1422
1411
|
return;
|
|
1423
1412
|
}
|
|
1424
1413
|
|
|
1425
|
-
if (
|
|
1426
|
-
onSwap(
|
|
1414
|
+
if (_this6.dragStart._level === 0) {
|
|
1415
|
+
onSwap(_this6.dragStart, obj);
|
|
1427
1416
|
} else {
|
|
1428
|
-
var startParents =
|
|
1417
|
+
var startParents = _this6.dragStart._getParents().map(function (o) {
|
|
1429
1418
|
return o._index;
|
|
1430
1419
|
}).toString();
|
|
1431
1420
|
|
|
@@ -1437,18 +1426,18 @@ var AIOTable = /*#__PURE__*/function (_Component) {
|
|
|
1437
1426
|
return;
|
|
1438
1427
|
}
|
|
1439
1428
|
|
|
1440
|
-
onSwap(
|
|
1429
|
+
onSwap(_this6.dragStart, obj);
|
|
1441
1430
|
}
|
|
1442
1431
|
},
|
|
1443
1432
|
onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
|
|
1444
1433
|
SetState: function SetState(obj) {
|
|
1445
|
-
return
|
|
1434
|
+
return _this6.setState(obj);
|
|
1446
1435
|
},
|
|
1447
1436
|
cubes2: this.cubes2.bind(this),
|
|
1448
1437
|
toggleRow: this.toggleRow.bind(this),
|
|
1449
1438
|
getGap: this.getGap.bind(this),
|
|
1450
|
-
|
|
1451
|
-
|
|
1439
|
+
onScroll1: this.onScroll1.bind(this),
|
|
1440
|
+
onScroll2: this.onScroll2.bind(this),
|
|
1452
1441
|
getClient: this.getClient.bind(this),
|
|
1453
1442
|
getLoading: this.getLoading.bind(this),
|
|
1454
1443
|
groups: this.groups
|
|
@@ -1500,7 +1489,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1500
1489
|
_createClass(RTableToolbar, [{
|
|
1501
1490
|
key: "changeSearch",
|
|
1502
1491
|
value: function changeSearch(value) {
|
|
1503
|
-
var
|
|
1492
|
+
var _this7 = this;
|
|
1504
1493
|
|
|
1505
1494
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
1506
1495
|
var SetState = this.context.SetState;
|
|
@@ -1509,10 +1498,10 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1509
1498
|
searchText: value
|
|
1510
1499
|
});
|
|
1511
1500
|
this.searchTimeout = setTimeout(function () {
|
|
1512
|
-
var
|
|
1513
|
-
filterDictionary =
|
|
1514
|
-
SetState =
|
|
1515
|
-
var searchColumnIndex =
|
|
1501
|
+
var _this7$context = _this7.context,
|
|
1502
|
+
filterDictionary = _this7$context.filterDictionary,
|
|
1503
|
+
SetState = _this7$context.SetState;
|
|
1504
|
+
var searchColumnIndex = _this7.props.searchColumnIndex;
|
|
1516
1505
|
filterDictionary[searchColumnIndex] = {
|
|
1517
1506
|
items: value ? [{
|
|
1518
1507
|
operator: 'contain',
|
|
@@ -1528,7 +1517,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1528
1517
|
}, {
|
|
1529
1518
|
key: "render",
|
|
1530
1519
|
value: function render() {
|
|
1531
|
-
var
|
|
1520
|
+
var _this8 = this;
|
|
1532
1521
|
|
|
1533
1522
|
var _this$context = this.context,
|
|
1534
1523
|
searchText = _this$context.searchText,
|
|
@@ -1587,7 +1576,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1587
1576
|
value: searchText,
|
|
1588
1577
|
placeholder: translate('Search'),
|
|
1589
1578
|
onChange: function onChange(e) {
|
|
1590
|
-
return
|
|
1579
|
+
return _this8.changeSearch(e.target.value);
|
|
1591
1580
|
}
|
|
1592
1581
|
}), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1593
1582
|
className: "aio-table-search-icon",
|
|
@@ -1598,7 +1587,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1598
1587
|
return;
|
|
1599
1588
|
}
|
|
1600
1589
|
|
|
1601
|
-
|
|
1590
|
+
_this8.changeSearch('', 0);
|
|
1602
1591
|
}
|
|
1603
1592
|
})), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
|
|
1604
1593
|
style: {
|
|
@@ -1657,13 +1646,13 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1657
1646
|
var _super3 = _createSuper(RTableUnit);
|
|
1658
1647
|
|
|
1659
1648
|
function RTableUnit(props) {
|
|
1660
|
-
var
|
|
1649
|
+
var _this9;
|
|
1661
1650
|
|
|
1662
1651
|
_classCallCheck(this, RTableUnit);
|
|
1663
1652
|
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
return
|
|
1653
|
+
_this9 = _super3.call(this, props);
|
|
1654
|
+
_this9.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
1655
|
+
return _this9;
|
|
1667
1656
|
}
|
|
1668
1657
|
|
|
1669
1658
|
_createClass(RTableUnit, [{
|
|
@@ -1757,11 +1746,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1757
1746
|
}, {
|
|
1758
1747
|
key: "getTitles",
|
|
1759
1748
|
value: function getTitles() {
|
|
1760
|
-
var
|
|
1749
|
+
var _this10 = this;
|
|
1761
1750
|
|
|
1762
1751
|
var columns = this.props.columns;
|
|
1763
1752
|
return columns.map(function (column) {
|
|
1764
|
-
return
|
|
1753
|
+
return _this10.getTitle(column);
|
|
1765
1754
|
});
|
|
1766
1755
|
}
|
|
1767
1756
|
}, {
|
|
@@ -1811,7 +1800,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1811
1800
|
}, {
|
|
1812
1801
|
key: "getTitle",
|
|
1813
1802
|
value: function getTitle(column) {
|
|
1814
|
-
var
|
|
1803
|
+
var _this11 = this;
|
|
1815
1804
|
|
|
1816
1805
|
if (column.template === 'gantt') {
|
|
1817
1806
|
return this.getGanttTitle(column);
|
|
@@ -1842,7 +1831,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1842
1831
|
},
|
|
1843
1832
|
draggable: false
|
|
1844
1833
|
}, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
|
|
1845
|
-
return column.resizable ?
|
|
1834
|
+
return column.resizable ? _this11.resizeDown(e, column) : undefined;
|
|
1846
1835
|
});
|
|
1847
1836
|
|
|
1848
1837
|
var titleProps = {
|
|
@@ -1853,24 +1842,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1853
1842
|
},
|
|
1854
1843
|
draggable: column.movable !== false,
|
|
1855
1844
|
onDragStart: function onDragStart(e) {
|
|
1856
|
-
|
|
1845
|
+
_this11.startColumnSwap = column._index;
|
|
1857
1846
|
},
|
|
1858
1847
|
onDragOver: function onDragOver(e) {
|
|
1859
1848
|
e.preventDefault();
|
|
1860
|
-
|
|
1849
|
+
_this11.endColumnSwap = column._index;
|
|
1861
1850
|
},
|
|
1862
1851
|
onDrop: function onDrop(e) {
|
|
1863
1852
|
if (column.movable === false) {
|
|
1864
1853
|
return;
|
|
1865
1854
|
}
|
|
1866
1855
|
|
|
1867
|
-
if (
|
|
1856
|
+
if (_this11.startColumnSwap === undefined || _this11.startColumnSwap === _this11.endColumnSwap) {
|
|
1868
1857
|
return;
|
|
1869
1858
|
}
|
|
1870
1859
|
|
|
1871
|
-
var temp = columns[
|
|
1872
|
-
columns[
|
|
1873
|
-
columns[
|
|
1860
|
+
var temp = columns[_this11.startColumnSwap];
|
|
1861
|
+
columns[_this11.startColumnSwap] = columns[_this11.endColumnSwap];
|
|
1862
|
+
columns[_this11.endColumnSwap] = temp;
|
|
1874
1863
|
SetState({
|
|
1875
1864
|
columns: columns
|
|
1876
1865
|
});
|
|
@@ -2051,12 +2040,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2051
2040
|
}, {
|
|
2052
2041
|
key: "card",
|
|
2053
2042
|
value: function card() {
|
|
2054
|
-
var
|
|
2043
|
+
var _this12 = this;
|
|
2055
2044
|
|
|
2056
2045
|
var _this$context11 = this.context,
|
|
2057
2046
|
indent = _this$context11.indent,
|
|
2058
|
-
|
|
2059
|
-
|
|
2047
|
+
onScroll1 = _this$context11.onScroll1,
|
|
2048
|
+
onScroll2 = _this$context11.onScroll2,
|
|
2060
2049
|
rowHeight = _this$context11.rowHeight,
|
|
2061
2050
|
_this$context11$cardG = _this$context11.cardGap,
|
|
2062
2051
|
cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
|
|
@@ -2093,14 +2082,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2093
2082
|
gridColumnGap: columnGap,
|
|
2094
2083
|
gridTemplateColumns: cardRowCount === 'auto' ? undefined : "repeat(".concat(cardRowCount, ",auto)")
|
|
2095
2084
|
},
|
|
2096
|
-
onMouseEnter: function onMouseEnter() {
|
|
2097
|
-
return _onMouseEnter(index);
|
|
2098
|
-
},
|
|
2099
|
-
onMouseDown: function onMouseDown() {
|
|
2100
|
-
return _onMouseEnter(index);
|
|
2101
|
-
},
|
|
2102
2085
|
onScroll: function onScroll(e) {
|
|
2103
|
-
return
|
|
2086
|
+
return index === 0 ? onScroll1() : onScroll2();
|
|
2104
2087
|
}
|
|
2105
2088
|
}, rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2106
2089
|
if (row._groupId) {
|
|
@@ -2114,7 +2097,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2114
2097
|
width: width,
|
|
2115
2098
|
flexShrink: 0
|
|
2116
2099
|
}
|
|
2117
|
-
}),
|
|
2100
|
+
}), _this12.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2118
2101
|
className: "aio-table-group-text"
|
|
2119
2102
|
}, row._groupValue)));
|
|
2120
2103
|
}
|
|
@@ -2130,7 +2113,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2130
2113
|
}, {
|
|
2131
2114
|
key: "render",
|
|
2132
2115
|
value: function render() {
|
|
2133
|
-
var
|
|
2116
|
+
var _this13 = this;
|
|
2134
2117
|
|
|
2135
2118
|
if (this.context.cardTemplate) {
|
|
2136
2119
|
return this.card();
|
|
@@ -2138,8 +2121,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2138
2121
|
|
|
2139
2122
|
var _this$context12 = this.context,
|
|
2140
2123
|
indent = _this$context12.indent,
|
|
2141
|
-
|
|
2142
|
-
|
|
2124
|
+
onScroll1 = _this$context12.onScroll1,
|
|
2125
|
+
onScroll2 = _this$context12.onScroll2,
|
|
2143
2126
|
rowHeight = _this$context12.rowHeight,
|
|
2144
2127
|
groups = _this$context12.groups,
|
|
2145
2128
|
getLoading = _this$context12.getLoading,
|
|
@@ -2156,14 +2139,8 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2156
2139
|
onKeyDown: this.keyDown.bind(this),
|
|
2157
2140
|
style: this.getStyle(),
|
|
2158
2141
|
ref: this.dom,
|
|
2159
|
-
onMouseEnter: function onMouseEnter() {
|
|
2160
|
-
return _onMouseEnter2(index);
|
|
2161
|
-
},
|
|
2162
|
-
onMouseDown: function onMouseDown() {
|
|
2163
|
-
return _onMouseEnter2(index);
|
|
2164
|
-
},
|
|
2165
2142
|
onScroll: function onScroll(e) {
|
|
2166
|
-
return
|
|
2143
|
+
return index === 0 ? onScroll1() : onScroll2();
|
|
2167
2144
|
}
|
|
2168
2145
|
}, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2169
2146
|
if (row._groupId) {
|
|
@@ -2171,7 +2148,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2171
2148
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2172
2149
|
className: "aio-table-group",
|
|
2173
2150
|
key: 'group' + i + '-' + index,
|
|
2174
|
-
style: { ...
|
|
2151
|
+
style: { ..._this13.getFullCellStyle(),
|
|
2175
2152
|
height: rowHeight
|
|
2176
2153
|
}
|
|
2177
2154
|
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -2179,7 +2156,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2179
2156
|
width: width,
|
|
2180
2157
|
flexShrink: 0
|
|
2181
2158
|
}
|
|
2182
|
-
}),
|
|
2159
|
+
}), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2183
2160
|
className: "aio-table-group-text"
|
|
2184
2161
|
}, row._groupValue)));
|
|
2185
2162
|
}
|
|
@@ -2208,19 +2185,19 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2208
2185
|
var _super4 = _createSuper(AIOTableCell);
|
|
2209
2186
|
|
|
2210
2187
|
function AIOTableCell(props) {
|
|
2211
|
-
var
|
|
2188
|
+
var _this14;
|
|
2212
2189
|
|
|
2213
2190
|
_classCallCheck(this, AIOTableCell);
|
|
2214
2191
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
var value =
|
|
2218
|
-
|
|
2192
|
+
_this14 = _super4.call(this, props);
|
|
2193
|
+
_this14.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
2194
|
+
var value = _this14.props.value;
|
|
2195
|
+
_this14.state = {
|
|
2219
2196
|
value: value,
|
|
2220
2197
|
error: false,
|
|
2221
2198
|
prevValue: value
|
|
2222
2199
|
};
|
|
2223
|
-
return
|
|
2200
|
+
return _this14;
|
|
2224
2201
|
}
|
|
2225
2202
|
|
|
2226
2203
|
_createClass(AIOTableCell, [{
|
|
@@ -2508,7 +2485,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2508
2485
|
}, {
|
|
2509
2486
|
key: "getInput",
|
|
2510
2487
|
value: function getInput(row, column) {
|
|
2511
|
-
var
|
|
2488
|
+
var _this15 = this;
|
|
2512
2489
|
|
|
2513
2490
|
var type = column.inlineEdit.type;
|
|
2514
2491
|
var value = this.state.value;
|
|
@@ -2532,23 +2509,23 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2532
2509
|
textAlign: column.justify ? 'center' : undefined
|
|
2533
2510
|
},
|
|
2534
2511
|
onChange: function onChange(e) {
|
|
2535
|
-
return
|
|
2512
|
+
return _this15.setState({
|
|
2536
2513
|
value: e.target.value
|
|
2537
2514
|
});
|
|
2538
2515
|
},
|
|
2539
2516
|
onBlur: async function onBlur(e) {
|
|
2540
|
-
|
|
2517
|
+
_this15.setState({
|
|
2541
2518
|
loading: true
|
|
2542
2519
|
});
|
|
2543
2520
|
|
|
2544
2521
|
var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
|
|
2545
2522
|
|
|
2546
|
-
|
|
2523
|
+
_this15.setState({
|
|
2547
2524
|
loading: false
|
|
2548
2525
|
});
|
|
2549
2526
|
|
|
2550
2527
|
if (typeof error === 'string') {
|
|
2551
|
-
|
|
2528
|
+
_this15.setState({
|
|
2552
2529
|
error: error
|
|
2553
2530
|
});
|
|
2554
2531
|
}
|
|
@@ -2573,27 +2550,27 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2573
2550
|
className: "aio-table-input-container"
|
|
2574
2551
|
}, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
|
|
2575
2552
|
onFocus: function onFocus() {
|
|
2576
|
-
return
|
|
2553
|
+
return _this15.focus = true;
|
|
2577
2554
|
},
|
|
2578
2555
|
onBlur: function onBlur() {
|
|
2579
|
-
return
|
|
2556
|
+
return _this15.focus = false;
|
|
2580
2557
|
},
|
|
2581
2558
|
onChange: async function onChange(e) {
|
|
2582
2559
|
var value = e.target.value;
|
|
2583
2560
|
|
|
2584
|
-
|
|
2561
|
+
_this15.setState({
|
|
2585
2562
|
loading: true,
|
|
2586
2563
|
value: value
|
|
2587
2564
|
});
|
|
2588
2565
|
|
|
2589
2566
|
var error = await column.inlineEdit.onChange(row, e.target.value);
|
|
2590
2567
|
|
|
2591
|
-
|
|
2568
|
+
_this15.setState({
|
|
2592
2569
|
loading: false
|
|
2593
2570
|
});
|
|
2594
2571
|
|
|
2595
2572
|
if (typeof error === 'string') {
|
|
2596
|
-
|
|
2573
|
+
_this15.setState({
|
|
2597
2574
|
error: error
|
|
2598
2575
|
});
|
|
2599
2576
|
}
|
|
@@ -2623,7 +2600,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2623
2600
|
}, {
|
|
2624
2601
|
key: "render",
|
|
2625
2602
|
value: function render() {
|
|
2626
|
-
var
|
|
2603
|
+
var _this16 = this;
|
|
2627
2604
|
|
|
2628
2605
|
var _this$context14 = this.context,
|
|
2629
2606
|
indent = _this$context14.indent,
|
|
@@ -2663,8 +2640,8 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2663
2640
|
cell = /*#__PURE__*/_react.default.createElement("div", {
|
|
2664
2641
|
className: "aio-table-error",
|
|
2665
2642
|
onClick: function onClick() {
|
|
2666
|
-
|
|
2667
|
-
value:
|
|
2643
|
+
_this16.setState({
|
|
2644
|
+
value: _this16.props.value,
|
|
2668
2645
|
error: false
|
|
2669
2646
|
});
|
|
2670
2647
|
}
|
|
@@ -2736,14 +2713,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2736
2713
|
var _super5 = _createSuper(AIOSlider);
|
|
2737
2714
|
|
|
2738
2715
|
function AIOSlider(props) {
|
|
2739
|
-
var
|
|
2716
|
+
var _this17;
|
|
2740
2717
|
|
|
2741
2718
|
_classCallCheck(this, AIOSlider);
|
|
2742
2719
|
|
|
2743
|
-
|
|
2744
|
-
var
|
|
2745
|
-
column =
|
|
2746
|
-
row =
|
|
2720
|
+
_this17 = _super5.call(this, props);
|
|
2721
|
+
var _this17$props = _this17.props,
|
|
2722
|
+
column = _this17$props.column,
|
|
2723
|
+
row = _this17$props.row;
|
|
2747
2724
|
var getValue = column.getValue;
|
|
2748
2725
|
var value = getValue(row);
|
|
2749
2726
|
|
|
@@ -2751,11 +2728,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2751
2728
|
value = [value];
|
|
2752
2729
|
}
|
|
2753
2730
|
|
|
2754
|
-
|
|
2731
|
+
_this17.state = {
|
|
2755
2732
|
value: value
|
|
2756
2733
|
};
|
|
2757
|
-
|
|
2758
|
-
return
|
|
2734
|
+
_this17.updateMode = 'outside';
|
|
2735
|
+
return _this17;
|
|
2759
2736
|
}
|
|
2760
2737
|
|
|
2761
2738
|
_createClass(AIOSlider, [{
|
|
@@ -2774,7 +2751,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2774
2751
|
}, {
|
|
2775
2752
|
key: "render",
|
|
2776
2753
|
value: function render() {
|
|
2777
|
-
var
|
|
2754
|
+
var _this18 = this;
|
|
2778
2755
|
|
|
2779
2756
|
var _this$props13 = this.props,
|
|
2780
2757
|
column = _this$props13.column,
|
|
@@ -2868,7 +2845,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2868
2845
|
fillStyle: {
|
|
2869
2846
|
height: '6px',
|
|
2870
2847
|
borderRadius: '24px',
|
|
2871
|
-
background:
|
|
2848
|
+
background: _this18.getBackground(value.length, i, color)
|
|
2872
2849
|
}
|
|
2873
2850
|
};
|
|
2874
2851
|
}),
|
|
@@ -2891,7 +2868,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2891
2868
|
return;
|
|
2892
2869
|
}
|
|
2893
2870
|
|
|
2894
|
-
|
|
2871
|
+
_this18.updateMode = 'onChange';
|
|
2895
2872
|
onChange(row, points.length > 1 ? points.map(function (p) {
|
|
2896
2873
|
return p.value;
|
|
2897
2874
|
}) : points[0].value);
|
|
@@ -2901,9 +2878,9 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2901
2878
|
},
|
|
2902
2879
|
ondrag: function ondrag(_ref2) {
|
|
2903
2880
|
var points = _ref2.points;
|
|
2904
|
-
|
|
2881
|
+
_this18.updateMode = 'onDrag';
|
|
2905
2882
|
|
|
2906
|
-
|
|
2883
|
+
_this18.setState({
|
|
2907
2884
|
value: points.map(function (p) {
|
|
2908
2885
|
return p.value;
|
|
2909
2886
|
})
|
|
@@ -3012,7 +2989,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3012
2989
|
}, {
|
|
3013
2990
|
key: "render",
|
|
3014
2991
|
value: function render() {
|
|
3015
|
-
var
|
|
2992
|
+
var _this19 = this;
|
|
3016
2993
|
|
|
3017
2994
|
var column = this.props.column;
|
|
3018
2995
|
var _this$context17 = this.context,
|
|
@@ -3049,7 +3026,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3049
3026
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
3050
3027
|
className: "aio-table-filter-add",
|
|
3051
3028
|
onClick: function onClick() {
|
|
3052
|
-
return
|
|
3029
|
+
return _this19.add();
|
|
3053
3030
|
}
|
|
3054
3031
|
}, translate('Add'))));
|
|
3055
3032
|
}
|
|
@@ -3066,17 +3043,17 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3066
3043
|
var _super8 = _createSuper(RTableFilterItem);
|
|
3067
3044
|
|
|
3068
3045
|
function RTableFilterItem(props) {
|
|
3069
|
-
var
|
|
3046
|
+
var _this20;
|
|
3070
3047
|
|
|
3071
3048
|
_classCallCheck(this, RTableFilterItem);
|
|
3072
3049
|
|
|
3073
|
-
|
|
3074
|
-
var filter =
|
|
3075
|
-
|
|
3050
|
+
_this20 = _super8.call(this, props);
|
|
3051
|
+
var filter = _this20.props.filter;
|
|
3052
|
+
_this20.state = {
|
|
3076
3053
|
value: filter.value,
|
|
3077
3054
|
prevValue: filter.value
|
|
3078
3055
|
};
|
|
3079
|
-
return
|
|
3056
|
+
return _this20;
|
|
3080
3057
|
}
|
|
3081
3058
|
|
|
3082
3059
|
_createClass(RTableFilterItem, [{
|
|
@@ -3101,7 +3078,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3101
3078
|
}, {
|
|
3102
3079
|
key: "changeValue",
|
|
3103
3080
|
value: function changeValue(value) {
|
|
3104
|
-
var
|
|
3081
|
+
var _this21 = this;
|
|
3105
3082
|
|
|
3106
3083
|
var onChangeFilter = this.context.onChangeFilter;
|
|
3107
3084
|
clearTimeout(this.timeout);
|
|
@@ -3109,12 +3086,12 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3109
3086
|
value: value
|
|
3110
3087
|
});
|
|
3111
3088
|
this.timeout = setTimeout(function () {
|
|
3112
|
-
var
|
|
3113
|
-
SetState =
|
|
3114
|
-
filterDictionary =
|
|
3115
|
-
var
|
|
3116
|
-
column =
|
|
3117
|
-
index =
|
|
3089
|
+
var _this21$context = _this21.context,
|
|
3090
|
+
SetState = _this21$context.SetState,
|
|
3091
|
+
filterDictionary = _this21$context.filterDictionary;
|
|
3092
|
+
var _this21$props = _this21.props,
|
|
3093
|
+
column = _this21$props.column,
|
|
3094
|
+
index = _this21$props.index;
|
|
3118
3095
|
filterDictionary[column._index].items[index].value = value;
|
|
3119
3096
|
|
|
3120
3097
|
if (onChangeFilter) {
|
|
@@ -3129,7 +3106,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3129
3106
|
}, {
|
|
3130
3107
|
key: "render",
|
|
3131
3108
|
value: function render() {
|
|
3132
|
-
var
|
|
3109
|
+
var _this22 = this;
|
|
3133
3110
|
|
|
3134
3111
|
var _this$context19 = this.context,
|
|
3135
3112
|
filterDictionary = _this$context19.filterDictionary,
|
|
@@ -3187,7 +3164,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3187
3164
|
type: type,
|
|
3188
3165
|
value: value,
|
|
3189
3166
|
onChange: function onChange(e) {
|
|
3190
|
-
return
|
|
3167
|
+
return _this22.changeValue(e.target.value);
|
|
3191
3168
|
}
|
|
3192
3169
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3193
3170
|
style: {
|
|
@@ -3196,7 +3173,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3196
3173
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3197
3174
|
className: "aio-table-filter-remove",
|
|
3198
3175
|
onClick: function onClick() {
|
|
3199
|
-
return
|
|
3176
|
+
return _this22.remove(index);
|
|
3200
3177
|
}
|
|
3201
3178
|
}, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
3202
3179
|
path: _js.mdiClose,
|