aio-table 4.0.0 → 5.0.3
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/README.md +351 -464
- package/index.css +9 -8
- package/index.js +469 -695
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _aioButton = _interopRequireDefault(require("aio-button"));
|
|
15
15
|
|
|
16
16
|
var _react2 = require("@mdi/react");
|
|
17
17
|
|
|
@@ -67,15 +67,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
67
67
|
|
|
68
68
|
var AioTableContext = /*#__PURE__*/(0, _react.createContext)();
|
|
69
69
|
|
|
70
|
-
var
|
|
71
|
-
_inherits(
|
|
70
|
+
var AIOTable = /*#__PURE__*/function (_Component) {
|
|
71
|
+
_inherits(AIOTable, _Component);
|
|
72
72
|
|
|
73
|
-
var _super = _createSuper(
|
|
73
|
+
var _super = _createSuper(AIOTable);
|
|
74
74
|
|
|
75
|
-
function
|
|
75
|
+
function AIOTable(props) {
|
|
76
76
|
var _this;
|
|
77
77
|
|
|
78
|
-
_classCallCheck(this,
|
|
78
|
+
_classCallCheck(this, AIOTable);
|
|
79
79
|
|
|
80
80
|
_this = _super.call(this, props);
|
|
81
81
|
_this.touch = false;
|
|
@@ -142,23 +142,33 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
142
142
|
return _this;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
_createClass(
|
|
145
|
+
_createClass(AIOTable, [{
|
|
146
146
|
key: "onScroll",
|
|
147
147
|
value: function onScroll(e, index) {
|
|
148
|
+
var _this2 = this;
|
|
149
|
+
|
|
148
150
|
if (!this.freezeMode) {
|
|
149
151
|
return;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
this.activeTableIndex = 0;
|
|
155
|
-
this.deactiveTableIndex = 1;
|
|
154
|
+
if (this.activeTableIndex === undefined) {
|
|
155
|
+
return;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
if (index !== this.activeTableIndex) {
|
|
159
|
+
this.onMouseEnter(index);
|
|
160
|
+
clearTimeout(this.timeo);
|
|
161
|
+
this.timeo = setTimeout(function () {
|
|
162
|
+
return _this2.bindScroll();
|
|
163
|
+
}, 40);
|
|
159
164
|
return;
|
|
160
165
|
}
|
|
161
166
|
|
|
167
|
+
this.bindScroll();
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "bindScroll",
|
|
171
|
+
value: function bindScroll() {
|
|
162
172
|
var units = (0, _jquery.default)(this.dom.current).find('.aio-table-unit');
|
|
163
173
|
var scrollTop = units.eq(this.activeTableIndex).scrollTop();
|
|
164
174
|
units.eq(this.deactiveTableIndex).scrollTop(scrollTop);
|
|
@@ -227,11 +237,13 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
227
237
|
}
|
|
228
238
|
}, {
|
|
229
239
|
key: "getBodyStyle",
|
|
230
|
-
value: function getBodyStyle(
|
|
231
|
-
var
|
|
240
|
+
value: function getBodyStyle(Toolbar) {
|
|
241
|
+
var paging = this.state.paging;
|
|
242
|
+
var padding = this.props.padding;
|
|
243
|
+
var def = padding,
|
|
232
244
|
top = 0;
|
|
233
245
|
|
|
234
|
-
if (
|
|
246
|
+
if (paging) {
|
|
235
247
|
def += 36;
|
|
236
248
|
}
|
|
237
249
|
|
|
@@ -247,8 +259,8 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
247
259
|
}
|
|
248
260
|
}, {
|
|
249
261
|
key: "getTable",
|
|
250
|
-
value: function getTable(
|
|
251
|
-
var
|
|
262
|
+
value: function getTable(Toolbar) {
|
|
263
|
+
var _this3 = this;
|
|
252
264
|
|
|
253
265
|
var rows = this.getRows();
|
|
254
266
|
this.rows = rows;
|
|
@@ -256,33 +268,34 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
256
268
|
if (!this.freezeMode) {
|
|
257
269
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
258
270
|
className: 'aio-table-body',
|
|
259
|
-
style: this.getBodyStyle(
|
|
271
|
+
style: this.getBodyStyle(Toolbar)
|
|
260
272
|
}, /*#__PURE__*/_react.default.createElement(RTableUnit, {
|
|
261
273
|
rows: rows,
|
|
262
|
-
columns: this.visibleColumns
|
|
274
|
+
columns: this.visibleColumns,
|
|
275
|
+
type: "cells"
|
|
263
276
|
}));
|
|
264
277
|
} else {
|
|
265
278
|
var freezeSize = this.state.freezeSize;
|
|
266
279
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
267
280
|
className: 'aio-table-body',
|
|
268
|
-
style: this.getBodyStyle(
|
|
281
|
+
style: this.getBodyStyle(Toolbar)
|
|
269
282
|
}, /*#__PURE__*/_react.default.createElement(RTableUnit, {
|
|
270
283
|
key: 0,
|
|
271
284
|
id: "aio-table-first-split",
|
|
272
285
|
rows: rows,
|
|
273
286
|
columns: this.freezeColumns,
|
|
274
287
|
index: 0,
|
|
275
|
-
type: "
|
|
288
|
+
type: "freezeCells",
|
|
276
289
|
style: {
|
|
277
290
|
width: freezeSize
|
|
278
291
|
}
|
|
279
292
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
280
293
|
className: "aio-table-splitter",
|
|
281
294
|
onMouseDown: function onMouseDown(e) {
|
|
282
|
-
return
|
|
295
|
+
return _this3.resizeDown(e);
|
|
283
296
|
},
|
|
284
297
|
onTouchStart: function onTouchStart(e) {
|
|
285
|
-
return
|
|
298
|
+
return _this3.resizeDown(e);
|
|
286
299
|
}
|
|
287
300
|
}), true && /*#__PURE__*/_react.default.createElement(RTableUnit, {
|
|
288
301
|
key: 1,
|
|
@@ -290,36 +303,28 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
290
303
|
rows: rows,
|
|
291
304
|
columns: this.unFreezeColumns,
|
|
292
305
|
index: 1,
|
|
293
|
-
type: "
|
|
306
|
+
type: "unFreezeCells"
|
|
294
307
|
}));
|
|
295
308
|
}
|
|
296
309
|
}
|
|
297
310
|
}, {
|
|
298
311
|
key: "convertFlat",
|
|
299
|
-
value: function convertFlat(model) {
|
|
300
|
-
var _this$props2 = this.props,
|
|
301
|
-
getRowId = _this$props2.getRowId,
|
|
302
|
-
getRowParentId = _this$props2.getRowParentId;
|
|
303
|
-
|
|
312
|
+
value: function convertFlat(model, getId, getParentId, childsField) {
|
|
304
313
|
var convertModelRecursive = function convertModelRecursive(array, parentId, parentObject) {
|
|
305
314
|
for (var i = 0; i < array.length; i++) {
|
|
306
315
|
var row = array[i];
|
|
307
|
-
|
|
316
|
+
var rowParentId = getParentId(row);
|
|
308
317
|
|
|
309
|
-
if (
|
|
318
|
+
if (rowParentId !== parentId) {
|
|
310
319
|
continue;
|
|
311
320
|
}
|
|
312
321
|
|
|
313
|
-
var rowId =
|
|
314
|
-
row
|
|
322
|
+
var rowId = getId(row);
|
|
323
|
+
row[childsField] = [];
|
|
315
324
|
parentObject.push(row);
|
|
316
|
-
|
|
317
|
-
var newArray = _toConsumableArray(array);
|
|
318
|
-
|
|
319
|
-
newArray.splice(i, 1);
|
|
320
325
|
array.splice(i, 1);
|
|
321
326
|
i--;
|
|
322
|
-
convertModelRecursive(
|
|
327
|
+
convertModelRecursive(_toConsumableArray(array), rowId, row[childsField]);
|
|
323
328
|
}
|
|
324
329
|
};
|
|
325
330
|
|
|
@@ -330,13 +335,13 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
330
335
|
}, {
|
|
331
336
|
key: "sort",
|
|
332
337
|
value: function sort(model) {
|
|
333
|
-
var
|
|
338
|
+
var _this4 = this;
|
|
334
339
|
|
|
335
340
|
var newModel = model.sort(function (a, b) {
|
|
336
|
-
for (var i = 0; i <
|
|
337
|
-
var
|
|
338
|
-
getValue =
|
|
339
|
-
type =
|
|
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;
|
|
340
345
|
var aValue = getValue(a),
|
|
341
346
|
bValue = getValue(b);
|
|
342
347
|
|
|
@@ -348,7 +353,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
348
353
|
return 1 * (type === 'dec' ? -1 : 1);
|
|
349
354
|
}
|
|
350
355
|
|
|
351
|
-
if (i !==
|
|
356
|
+
if (i !== _this4.sorts.length - 1) {
|
|
352
357
|
continue;
|
|
353
358
|
}
|
|
354
359
|
|
|
@@ -362,10 +367,11 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
362
367
|
}, {
|
|
363
368
|
key: "getRows",
|
|
364
369
|
value: function getRows() {
|
|
365
|
-
var _this$
|
|
366
|
-
model = _this$
|
|
367
|
-
|
|
368
|
-
|
|
370
|
+
var _this$props2 = this.props,
|
|
371
|
+
model = _this$props2.model,
|
|
372
|
+
getRowId = _this$props2.getRowId,
|
|
373
|
+
getRowParentId = _this$props2.getRowParentId,
|
|
374
|
+
onChangeSort = _this$props2.onChangeSort;
|
|
369
375
|
var paging = this.state.paging;
|
|
370
376
|
|
|
371
377
|
if (!model) {
|
|
@@ -376,7 +382,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
376
382
|
this.rowRenderIndex = 0;
|
|
377
383
|
this.rowRealIndex = 0;
|
|
378
384
|
this.perf = 0;
|
|
379
|
-
var convertedModel =
|
|
385
|
+
var convertedModel = getRowParentId ? this.convertFlat(_toConsumableArray(model), getRowId, getRowParentId, '_childs') : _toConsumableArray(model);
|
|
380
386
|
|
|
381
387
|
if (this.sorts.length && !onChangeSort) {
|
|
382
388
|
convertedModel = this.sort(convertedModel);
|
|
@@ -451,25 +457,25 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
451
457
|
var groupsOpen = this.state.groupsOpen;
|
|
452
458
|
var groups = this.groups;
|
|
453
459
|
|
|
454
|
-
function msf(obj, _level) {
|
|
455
|
-
var _parentField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
456
|
-
|
|
460
|
+
function msf(obj, _level, parents) {
|
|
457
461
|
if (Array.isArray(obj)) {
|
|
458
462
|
groupedRows = groupedRows.concat(obj);
|
|
459
463
|
} else {
|
|
460
464
|
for (var prop in obj) {
|
|
461
|
-
|
|
465
|
+
var newParents = parents.concat(prop);
|
|
466
|
+
|
|
467
|
+
var _groupId = newParents.toString();
|
|
468
|
+
|
|
469
|
+
groupsOpen[_groupId] = groupsOpen[_groupId] === undefined ? true : groupsOpen[_groupId];
|
|
462
470
|
groupedRows.push({
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
_openField: _parentField + prop,
|
|
471
|
+
_groupValue: prop,
|
|
472
|
+
_groupId: _groupId,
|
|
466
473
|
_level: _level,
|
|
467
|
-
_opened: groupsOpen[
|
|
468
|
-
_parentField: _parentField
|
|
474
|
+
_opened: groupsOpen[_groupId]
|
|
469
475
|
});
|
|
470
476
|
|
|
471
|
-
if (groupsOpen[
|
|
472
|
-
msf(obj[prop], _level + 1,
|
|
477
|
+
if (groupsOpen[_groupId]) {
|
|
478
|
+
msf(obj[prop], _level + 1, newParents);
|
|
473
479
|
}
|
|
474
480
|
}
|
|
475
481
|
}
|
|
@@ -505,20 +511,20 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
505
511
|
|
|
506
512
|
var groupedRows = [];
|
|
507
513
|
var _level = 0;
|
|
508
|
-
msf(newModel, _level);
|
|
514
|
+
msf(newModel, _level, []);
|
|
509
515
|
return groupedRows;
|
|
510
516
|
}
|
|
511
517
|
}, {
|
|
512
518
|
key: "getRowsReq",
|
|
513
519
|
value: function getRowsReq(model, rows, _level, parents) {
|
|
514
520
|
var openDictionary = this.state.openDictionary;
|
|
515
|
-
var _this$
|
|
516
|
-
getRowId = _this$
|
|
517
|
-
getRowChilds = _this$
|
|
518
|
-
|
|
519
|
-
|
|
521
|
+
var _this$props3 = this.props,
|
|
522
|
+
getRowId = _this$props3.getRowId,
|
|
523
|
+
getRowChilds = _this$props3.getRowChilds,
|
|
524
|
+
getRowVisible = _this$props3.getRowVisible,
|
|
525
|
+
getRowParentId = _this$props3.getRowParentId;
|
|
520
526
|
|
|
521
|
-
if (
|
|
527
|
+
if (getRowParentId) {
|
|
522
528
|
getRowChilds = function getRowChilds(row) {
|
|
523
529
|
return row._childs;
|
|
524
530
|
};
|
|
@@ -531,7 +537,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
531
537
|
continue;
|
|
532
538
|
}
|
|
533
539
|
|
|
534
|
-
if (row.
|
|
540
|
+
if (row._groupId) {
|
|
535
541
|
rows.push(row);
|
|
536
542
|
continue;
|
|
537
543
|
}
|
|
@@ -553,7 +559,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
553
559
|
var id = getRowId(row);
|
|
554
560
|
|
|
555
561
|
if (id === undefined) {
|
|
556
|
-
console.error('
|
|
562
|
+
console.error('AIOTable => id of row is not defined, please check getRowId props of AIOTable');
|
|
557
563
|
}
|
|
558
564
|
|
|
559
565
|
openDictionary[id] = openDictionary[id] === false ? false : true;
|
|
@@ -713,7 +719,6 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
713
719
|
|
|
714
720
|
var obj = {
|
|
715
721
|
key: row._index + ',' + column._index,
|
|
716
|
-
row: row,
|
|
717
722
|
column: column,
|
|
718
723
|
value: value,
|
|
719
724
|
freeze: column.freeze
|
|
@@ -787,9 +792,9 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
787
792
|
openDictionary = _this$state.openDictionary,
|
|
788
793
|
groupsOpen = _this$state.groupsOpen,
|
|
789
794
|
toggleAllState = _this$state.toggleAllState;
|
|
790
|
-
var _this$
|
|
791
|
-
id = _this$
|
|
792
|
-
getRowId = _this$
|
|
795
|
+
var _this$props4 = this.props,
|
|
796
|
+
id = _this$props4.id,
|
|
797
|
+
getRowId = _this$props4.getRowId;
|
|
793
798
|
|
|
794
799
|
if (getRowId) {
|
|
795
800
|
for (var prop in openDictionary) {
|
|
@@ -852,18 +857,20 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
852
857
|
}, {
|
|
853
858
|
key: "updateColumns",
|
|
854
859
|
value: function updateColumns() {
|
|
855
|
-
var
|
|
860
|
+
var _this5 = this;
|
|
856
861
|
|
|
857
|
-
var _this$
|
|
858
|
-
_this$
|
|
859
|
-
freezeMode = _this$
|
|
860
|
-
translate = _this$
|
|
861
|
-
groups = _this$
|
|
862
|
-
cardTemplate = _this$
|
|
863
|
-
onChangeSort = _this$
|
|
864
|
-
_this$
|
|
865
|
-
toggleAll = _this$
|
|
866
|
-
id = _this$
|
|
862
|
+
var _this$props5 = this.props,
|
|
863
|
+
_this$props5$freezeMo = _this$props5.freezeMode,
|
|
864
|
+
freezeMode = _this$props5$freezeMo === void 0 ? true : _this$props5$freezeMo,
|
|
865
|
+
translate = _this$props5.translate,
|
|
866
|
+
groups = _this$props5.groups,
|
|
867
|
+
cardTemplate = _this$props5.cardTemplate,
|
|
868
|
+
onChangeSort = _this$props5.onChangeSort,
|
|
869
|
+
_this$props5$toggleAl = _this$props5.toggleAll,
|
|
870
|
+
toggleAll = _this$props5$toggleAl === void 0 ? false : _this$props5$toggleAl,
|
|
871
|
+
id = _this$props5.id,
|
|
872
|
+
_this$props5$toolbarI = _this$props5.toolbarItems,
|
|
873
|
+
toolbarItems = _this$props5$toolbarI === void 0 ? [] : _this$props5$toolbarI;
|
|
867
874
|
var _this$state2 = this.state,
|
|
868
875
|
groupDictionary = _this$state2.groupDictionary,
|
|
869
876
|
sorts = _this$state2.sorts,
|
|
@@ -875,7 +882,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
875
882
|
this.freezeColumns = [];
|
|
876
883
|
this.unFreezeColumns = [];
|
|
877
884
|
this.toolbar = {
|
|
878
|
-
show: toggleAll,
|
|
885
|
+
show: toggleAll === true || toolbarItems.length > 0,
|
|
879
886
|
toggle: [{
|
|
880
887
|
text: translate('Show Columns')
|
|
881
888
|
}],
|
|
@@ -914,16 +921,16 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
914
921
|
}
|
|
915
922
|
|
|
916
923
|
if (active === true) {
|
|
917
|
-
|
|
924
|
+
_this5.sorts.push({
|
|
918
925
|
getValue: getValue,
|
|
919
926
|
type: type
|
|
920
927
|
});
|
|
921
928
|
}
|
|
922
929
|
|
|
923
930
|
if (toggle) {
|
|
924
|
-
|
|
931
|
+
_this5.toolbar.show = true;
|
|
925
932
|
|
|
926
|
-
|
|
933
|
+
_this5.toolbar.sort.push({
|
|
927
934
|
text: title,
|
|
928
935
|
checked: active === true,
|
|
929
936
|
after: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -935,10 +942,11 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
935
942
|
}, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
936
943
|
path: type === 'dec' ? _js.mdiArrowDown : _js.mdiArrowUp,
|
|
937
944
|
size: 0.8,
|
|
938
|
-
onClick: function onClick() {
|
|
945
|
+
onClick: function onClick(e) {
|
|
946
|
+
e.stopPropagation();
|
|
939
947
|
sort.type = sort.type === 'dec' ? 'inc' : 'dec';
|
|
940
948
|
|
|
941
|
-
|
|
949
|
+
_this5.setState({
|
|
942
950
|
sorts: sorts
|
|
943
951
|
});
|
|
944
952
|
|
|
@@ -952,7 +960,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
952
960
|
onClick: function onClick() {
|
|
953
961
|
sort.active = !active;
|
|
954
962
|
|
|
955
|
-
|
|
963
|
+
_this5.setState({
|
|
956
964
|
sorts: sorts
|
|
957
965
|
});
|
|
958
966
|
|
|
@@ -994,13 +1002,13 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
994
1002
|
groupDictionary[title] = groupDictionary[title] === undefined ? active : groupDictionary[title];
|
|
995
1003
|
|
|
996
1004
|
if (groupDictionary[title]) {
|
|
997
|
-
|
|
1005
|
+
_this5.groups.push(group);
|
|
998
1006
|
}
|
|
999
1007
|
|
|
1000
1008
|
if (toggle) {
|
|
1001
|
-
|
|
1009
|
+
_this5.toolbar.show = true;
|
|
1002
1010
|
|
|
1003
|
-
|
|
1011
|
+
_this5.toolbar.groupBy.push({
|
|
1004
1012
|
text: title,
|
|
1005
1013
|
checked: groupDictionary[title],
|
|
1006
1014
|
onClick: function onClick() {
|
|
@@ -1010,7 +1018,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1010
1018
|
localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
|
|
1011
1019
|
}
|
|
1012
1020
|
|
|
1013
|
-
|
|
1021
|
+
_this5.setState({
|
|
1014
1022
|
groupDictionary: groupDictionary
|
|
1015
1023
|
});
|
|
1016
1024
|
}
|
|
@@ -1060,29 +1068,29 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1060
1068
|
|
|
1061
1069
|
column._index = _i4;
|
|
1062
1070
|
|
|
1063
|
-
if (show !== false &&
|
|
1064
|
-
|
|
1071
|
+
if (show !== false && _this5.showColumnRelativeGroups(column)) {
|
|
1072
|
+
_this5.visibleColumns.push(column);
|
|
1065
1073
|
|
|
1066
1074
|
if (freezeMode) {
|
|
1067
1075
|
if (column.freeze) {
|
|
1068
|
-
|
|
1076
|
+
_this5.freezeMode = true;
|
|
1069
1077
|
|
|
1070
|
-
|
|
1078
|
+
_this5.freezeColumns.push(column);
|
|
1071
1079
|
} else {
|
|
1072
|
-
|
|
1080
|
+
_this5.unFreezeColumns.push(column);
|
|
1073
1081
|
}
|
|
1074
1082
|
|
|
1075
1083
|
if (column.toggleFreeze) {
|
|
1076
|
-
|
|
1084
|
+
_this5.toolbar.show = true;
|
|
1077
1085
|
|
|
1078
|
-
|
|
1086
|
+
_this5.toolbar.freeze.push({
|
|
1079
1087
|
text: column.title,
|
|
1080
1088
|
checked: column.freeze === true,
|
|
1081
1089
|
onClick: function onClick() {
|
|
1082
1090
|
column.freeze = column.freeze === true ? true : false;
|
|
1083
1091
|
column.freeze = !column.freeze;
|
|
1084
1092
|
|
|
1085
|
-
|
|
1093
|
+
_this5.setState({
|
|
1086
1094
|
columns: columns
|
|
1087
1095
|
});
|
|
1088
1096
|
}
|
|
@@ -1092,9 +1100,9 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1092
1100
|
}
|
|
1093
1101
|
|
|
1094
1102
|
if (column.toggleShow) {
|
|
1095
|
-
|
|
1103
|
+
_this5.toolbar.show = true;
|
|
1096
1104
|
|
|
1097
|
-
|
|
1105
|
+
_this5.toolbar.toggle.push({
|
|
1098
1106
|
text: column.title,
|
|
1099
1107
|
checked: show !== false,
|
|
1100
1108
|
onClick: function onClick() {
|
|
@@ -1109,7 +1117,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1109
1117
|
column.show = !column.show;
|
|
1110
1118
|
}
|
|
1111
1119
|
|
|
1112
|
-
|
|
1120
|
+
_this5.setState({
|
|
1113
1121
|
columns: columns
|
|
1114
1122
|
});
|
|
1115
1123
|
}
|
|
@@ -1117,8 +1125,8 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1117
1125
|
}
|
|
1118
1126
|
|
|
1119
1127
|
if (column.search) {
|
|
1120
|
-
|
|
1121
|
-
|
|
1128
|
+
_this5.toolbar.show = true;
|
|
1129
|
+
_this5.toolbar.searchColumnIndex = column._index;
|
|
1122
1130
|
}
|
|
1123
1131
|
};
|
|
1124
1132
|
|
|
@@ -1133,7 +1141,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1133
1141
|
}, {
|
|
1134
1142
|
key: "getPaging",
|
|
1135
1143
|
value: function getPaging() {
|
|
1136
|
-
var
|
|
1144
|
+
var _this6 = this;
|
|
1137
1145
|
|
|
1138
1146
|
var paging = this.state.paging;
|
|
1139
1147
|
|
|
@@ -1141,9 +1149,9 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1141
1149
|
return null;
|
|
1142
1150
|
}
|
|
1143
1151
|
|
|
1144
|
-
var _this$
|
|
1145
|
-
rtl = _this$
|
|
1146
|
-
translate = _this$
|
|
1152
|
+
var _this$props6 = this.props,
|
|
1153
|
+
rtl = _this$props6.rtl,
|
|
1154
|
+
translate = _this$props6.translate;
|
|
1147
1155
|
var number = paging.number,
|
|
1148
1156
|
_paging$sizes = paging.sizes,
|
|
1149
1157
|
sizes = _paging$sizes === void 0 ? [1, 5, 10, 20, 30, 40, 50, 60, 70, 80] : _paging$sizes,
|
|
@@ -1152,6 +1160,8 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1152
1160
|
pages = _paging$pages === void 0 ? 1 : _paging$pages;
|
|
1153
1161
|
|
|
1154
1162
|
var changePage = function changePage(type) {
|
|
1163
|
+
var _paging$pages2 = paging.pages,
|
|
1164
|
+
pages = _paging$pages2 === void 0 ? 1 : _paging$pages2;
|
|
1155
1165
|
var newNumber;
|
|
1156
1166
|
|
|
1157
1167
|
if (type === 'prev') {
|
|
@@ -1178,7 +1188,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1178
1188
|
|
|
1179
1189
|
paging.number = newNumber;
|
|
1180
1190
|
|
|
1181
|
-
|
|
1191
|
+
_this6.setState({
|
|
1182
1192
|
paging: paging
|
|
1183
1193
|
});
|
|
1184
1194
|
|
|
@@ -1236,7 +1246,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1236
1246
|
onChange: function onChange(e) {
|
|
1237
1247
|
paging.size = parseInt(e.target.value);
|
|
1238
1248
|
|
|
1239
|
-
|
|
1249
|
+
_this6.setState({
|
|
1240
1250
|
paging: paging
|
|
1241
1251
|
});
|
|
1242
1252
|
|
|
@@ -1358,7 +1368,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1358
1368
|
}, {
|
|
1359
1369
|
key: "render",
|
|
1360
1370
|
value: function render() {
|
|
1361
|
-
var
|
|
1371
|
+
var _this7 = this;
|
|
1362
1372
|
|
|
1363
1373
|
if (JSON.stringify(this.props.columns) !== JSON.stringify(this.state.columns)) {
|
|
1364
1374
|
this.setState({
|
|
@@ -1372,20 +1382,21 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1372
1382
|
}); //return null;
|
|
1373
1383
|
}
|
|
1374
1384
|
|
|
1375
|
-
var _this$
|
|
1376
|
-
rowHeight = _this$
|
|
1377
|
-
headerHeight = _this$
|
|
1378
|
-
toolbarHeight = _this$
|
|
1379
|
-
rowGap = _this$
|
|
1380
|
-
className = _this$
|
|
1381
|
-
columnGap = _this$
|
|
1382
|
-
rtl = _this$
|
|
1383
|
-
style = _this$
|
|
1384
|
-
_this$
|
|
1385
|
-
attrs = _this$
|
|
1386
|
-
cardTemplate = _this$
|
|
1387
|
-
onChangeFilter = _this$
|
|
1388
|
-
onSwap = _this$
|
|
1385
|
+
var _this$props7 = this.props,
|
|
1386
|
+
rowHeight = _this$props7.rowHeight,
|
|
1387
|
+
headerHeight = _this$props7.headerHeight,
|
|
1388
|
+
toolbarHeight = _this$props7.toolbarHeight,
|
|
1389
|
+
rowGap = _this$props7.rowGap,
|
|
1390
|
+
className = _this$props7.className,
|
|
1391
|
+
columnGap = _this$props7.columnGap,
|
|
1392
|
+
rtl = _this$props7.rtl,
|
|
1393
|
+
style = _this$props7.style,
|
|
1394
|
+
_this$props7$attrs = _this$props7.attrs,
|
|
1395
|
+
attrs = _this$props7$attrs === void 0 ? {} : _this$props7$attrs,
|
|
1396
|
+
cardTemplate = _this$props7.cardTemplate,
|
|
1397
|
+
onChangeFilter = _this$props7.onChangeFilter,
|
|
1398
|
+
onSwap = _this$props7.onSwap,
|
|
1399
|
+
padding = _this$props7.padding;
|
|
1389
1400
|
var columns = this.state.columns;
|
|
1390
1401
|
this.rh = rowHeight;
|
|
1391
1402
|
this.hh = headerHeight;
|
|
@@ -1393,28 +1404,28 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1393
1404
|
this.rg = rowGap;
|
|
1394
1405
|
this.cg = columnGap;
|
|
1395
1406
|
this.updateColumns();
|
|
1396
|
-
var Paging = this.getPaging();
|
|
1397
1407
|
var Toolbar = this.toolbar.show ? /*#__PURE__*/_react.default.createElement(RTableToolbar, this.toolbar) : null;
|
|
1398
|
-
var table = columns ? this.getTable(
|
|
1408
|
+
var table = columns ? this.getTable(Toolbar) : '';
|
|
1409
|
+
var Paging = this.getPaging();
|
|
1399
1410
|
var context = { ...this.props,
|
|
1400
1411
|
...this.state,
|
|
1401
1412
|
touch: this.touch,
|
|
1402
1413
|
onDrag: function onDrag(obj) {
|
|
1403
|
-
return
|
|
1414
|
+
return _this7.dragStart = obj;
|
|
1404
1415
|
},
|
|
1405
1416
|
onDrop: function onDrop(obj) {
|
|
1406
|
-
if (!
|
|
1417
|
+
if (!_this7.dragStart) {
|
|
1407
1418
|
return;
|
|
1408
1419
|
}
|
|
1409
1420
|
|
|
1410
|
-
if (
|
|
1421
|
+
if (_this7.dragStart._level !== obj._level) {
|
|
1411
1422
|
return;
|
|
1412
1423
|
}
|
|
1413
1424
|
|
|
1414
|
-
if (
|
|
1415
|
-
onSwap(
|
|
1425
|
+
if (_this7.dragStart._level === 0) {
|
|
1426
|
+
onSwap(_this7.dragStart, obj);
|
|
1416
1427
|
} else {
|
|
1417
|
-
var startParents =
|
|
1428
|
+
var startParents = _this7.dragStart._getParents().map(function (o) {
|
|
1418
1429
|
return o._index;
|
|
1419
1430
|
}).toString();
|
|
1420
1431
|
|
|
@@ -1426,12 +1437,12 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1426
1437
|
return;
|
|
1427
1438
|
}
|
|
1428
1439
|
|
|
1429
|
-
onSwap(
|
|
1440
|
+
onSwap(_this7.dragStart, obj);
|
|
1430
1441
|
}
|
|
1431
1442
|
},
|
|
1432
1443
|
onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
|
|
1433
1444
|
SetState: function SetState(obj) {
|
|
1434
|
-
return
|
|
1445
|
+
return _this7.setState(obj);
|
|
1435
1446
|
},
|
|
1436
1447
|
cubes2: this.cubes2.bind(this),
|
|
1437
1448
|
toggleRow: this.toggleRow.bind(this),
|
|
@@ -1448,21 +1459,24 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1448
1459
|
className: 'aio-table' + (className ? ' ' + className : '') + (rtl ? ' rtl' : ''),
|
|
1449
1460
|
tabIndex: 0,
|
|
1450
1461
|
ref: this.dom,
|
|
1451
|
-
style: style
|
|
1462
|
+
style: { ...style,
|
|
1463
|
+
padding: padding
|
|
1464
|
+
}
|
|
1452
1465
|
}, attrs), Toolbar, !cardTemplate && this.visibleColumns.length === 0 && this.getLoading(), table, Paging));
|
|
1453
1466
|
}
|
|
1454
1467
|
}]);
|
|
1455
1468
|
|
|
1456
|
-
return
|
|
1469
|
+
return AIOTable;
|
|
1457
1470
|
}(_react.Component);
|
|
1458
1471
|
|
|
1459
|
-
exports.default =
|
|
1460
|
-
|
|
1472
|
+
exports.default = AIOTable;
|
|
1473
|
+
AIOTable.defaultProps = {
|
|
1461
1474
|
columns: [],
|
|
1462
1475
|
headerHeight: 36,
|
|
1463
1476
|
rowHeight: 36,
|
|
1464
1477
|
toolbarHeight: 36,
|
|
1465
1478
|
rowGap: 6,
|
|
1479
|
+
padding: 12,
|
|
1466
1480
|
indent: 20,
|
|
1467
1481
|
translate: function translate(text) {
|
|
1468
1482
|
return text;
|
|
@@ -1486,7 +1500,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1486
1500
|
_createClass(RTableToolbar, [{
|
|
1487
1501
|
key: "changeSearch",
|
|
1488
1502
|
value: function changeSearch(value) {
|
|
1489
|
-
var
|
|
1503
|
+
var _this8 = this;
|
|
1490
1504
|
|
|
1491
1505
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
1492
1506
|
var SetState = this.context.SetState;
|
|
@@ -1495,10 +1509,10 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1495
1509
|
searchText: value
|
|
1496
1510
|
});
|
|
1497
1511
|
this.searchTimeout = setTimeout(function () {
|
|
1498
|
-
var
|
|
1499
|
-
filterDictionary =
|
|
1500
|
-
SetState =
|
|
1501
|
-
var searchColumnIndex =
|
|
1512
|
+
var _this8$context = _this8.context,
|
|
1513
|
+
filterDictionary = _this8$context.filterDictionary,
|
|
1514
|
+
SetState = _this8$context.SetState;
|
|
1515
|
+
var searchColumnIndex = _this8.props.searchColumnIndex;
|
|
1502
1516
|
filterDictionary[searchColumnIndex] = {
|
|
1503
1517
|
items: value ? [{
|
|
1504
1518
|
operator: 'contain',
|
|
@@ -1514,39 +1528,57 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1514
1528
|
}, {
|
|
1515
1529
|
key: "render",
|
|
1516
1530
|
value: function render() {
|
|
1517
|
-
var
|
|
1531
|
+
var _this9 = this;
|
|
1518
1532
|
|
|
1519
1533
|
var _this$context = this.context,
|
|
1520
1534
|
searchText = _this$context.searchText,
|
|
1521
1535
|
translate = _this$context.translate,
|
|
1522
1536
|
rtl = _this$context.rtl,
|
|
1523
|
-
toggleAllState = _this$context.toggleAllState
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1537
|
+
toggleAllState = _this$context.toggleAllState,
|
|
1538
|
+
padding = _this$context.padding,
|
|
1539
|
+
_this$context$toolbar = _this$context.toolbarItems,
|
|
1540
|
+
toolbarItems = _this$context$toolbar === void 0 ? [] : _this$context$toolbar;
|
|
1541
|
+
var _this$props8 = this.props,
|
|
1542
|
+
toggle = _this$props8.toggle,
|
|
1543
|
+
freeze = _this$props8.freeze,
|
|
1544
|
+
groupBy = _this$props8.groupBy,
|
|
1545
|
+
sort = _this$props8.sort,
|
|
1546
|
+
searchColumnIndex = _this$props8.searchColumnIndex,
|
|
1547
|
+
toggleAll = _this$props8.toggleAll;
|
|
1531
1548
|
var buttonProps = {
|
|
1549
|
+
type: 'select',
|
|
1550
|
+
caret: false,
|
|
1532
1551
|
rtl: rtl,
|
|
1533
1552
|
className: 'aio-table-toolbar-button',
|
|
1534
1553
|
animate: true
|
|
1535
1554
|
};
|
|
1536
1555
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1537
|
-
className: "aio-table-toolbar"
|
|
1538
|
-
|
|
1556
|
+
className: "aio-table-toolbar",
|
|
1557
|
+
style: {
|
|
1558
|
+
marginBottom: padding
|
|
1559
|
+
}
|
|
1560
|
+
}, toggleAll !== false && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1539
1561
|
key: 0
|
|
1540
1562
|
}, buttonProps, {
|
|
1563
|
+
type: "button",
|
|
1541
1564
|
title: translate('Toggle All'),
|
|
1542
1565
|
onClick: function onClick() {
|
|
1543
1566
|
return toggleAll();
|
|
1544
1567
|
},
|
|
1545
|
-
|
|
1568
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1546
1569
|
path: !toggleAllState ? _js.mdiCollapseAll : _js.mdiExpandAll,
|
|
1547
1570
|
size: 0.7
|
|
1548
1571
|
})
|
|
1549
|
-
})),
|
|
1572
|
+
})), toolbarItems.map(function (o, i) {
|
|
1573
|
+
return /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1574
|
+
type: "button"
|
|
1575
|
+
}, o, {
|
|
1576
|
+
rtl: rtl,
|
|
1577
|
+
className: "aio-table-toolbar-button",
|
|
1578
|
+
animate: true,
|
|
1579
|
+
key: 'ti' + i
|
|
1580
|
+
}));
|
|
1581
|
+
}), searchColumnIndex !== false && /*#__PURE__*/_react.default.createElement("div", {
|
|
1550
1582
|
key: 1,
|
|
1551
1583
|
className: "aio-table-search"
|
|
1552
1584
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
@@ -1555,7 +1587,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1555
1587
|
value: searchText,
|
|
1556
1588
|
placeholder: translate('Search'),
|
|
1557
1589
|
onChange: function onChange(e) {
|
|
1558
|
-
return
|
|
1590
|
+
return _this9.changeSearch(e.target.value);
|
|
1559
1591
|
}
|
|
1560
1592
|
}), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1561
1593
|
className: "aio-table-search-icon",
|
|
@@ -1566,49 +1598,49 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1566
1598
|
return;
|
|
1567
1599
|
}
|
|
1568
1600
|
|
|
1569
|
-
|
|
1601
|
+
_this9.changeSearch('', 0);
|
|
1570
1602
|
}
|
|
1571
1603
|
})), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
|
|
1572
1604
|
style: {
|
|
1573
1605
|
flex: 1
|
|
1574
1606
|
}
|
|
1575
|
-
}), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1607
|
+
}), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1576
1608
|
key: 2
|
|
1577
1609
|
}, buttonProps, {
|
|
1578
|
-
|
|
1610
|
+
options: groupBy,
|
|
1579
1611
|
title: translate('Group By'),
|
|
1580
|
-
|
|
1612
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1581
1613
|
path: _js.mdiFileTree,
|
|
1582
1614
|
size: 0.7,
|
|
1583
1615
|
horizontal: rtl === true
|
|
1584
1616
|
})
|
|
1585
|
-
})), sort.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1617
|
+
})), sort.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1586
1618
|
key: 3
|
|
1587
1619
|
}, buttonProps, {
|
|
1588
|
-
|
|
1620
|
+
options: sort,
|
|
1589
1621
|
title: translate('Sort'),
|
|
1590
|
-
|
|
1622
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1591
1623
|
path: _js.mdiSort,
|
|
1592
1624
|
size: 0.7
|
|
1593
1625
|
})
|
|
1594
|
-
})), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1626
|
+
})), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1595
1627
|
key: 4
|
|
1596
1628
|
}, buttonProps, {
|
|
1597
|
-
|
|
1629
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1598
1630
|
path: _js.mdiEye,
|
|
1599
1631
|
size: 0.7
|
|
1600
1632
|
}),
|
|
1601
|
-
|
|
1633
|
+
options: toggle,
|
|
1602
1634
|
title: translate('Show Columns')
|
|
1603
|
-
})), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1635
|
+
})), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1604
1636
|
key: 5
|
|
1605
1637
|
}, buttonProps, {
|
|
1606
|
-
|
|
1638
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1607
1639
|
path: _js.mdiAlignHorizontalLeft,
|
|
1608
1640
|
size: 0.7,
|
|
1609
1641
|
horizontal: rtl === true
|
|
1610
1642
|
}),
|
|
1611
|
-
|
|
1643
|
+
options: freeze,
|
|
1612
1644
|
title: translate('Freeze Columns')
|
|
1613
1645
|
})));
|
|
1614
1646
|
}
|
|
@@ -1625,34 +1657,36 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1625
1657
|
var _super3 = _createSuper(RTableUnit);
|
|
1626
1658
|
|
|
1627
1659
|
function RTableUnit(props) {
|
|
1628
|
-
var
|
|
1660
|
+
var _this10;
|
|
1629
1661
|
|
|
1630
1662
|
_classCallCheck(this, RTableUnit);
|
|
1631
1663
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
return
|
|
1664
|
+
_this10 = _super3.call(this, props);
|
|
1665
|
+
_this10.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
1666
|
+
return _this10;
|
|
1635
1667
|
}
|
|
1636
1668
|
|
|
1637
1669
|
_createClass(RTableUnit, [{
|
|
1638
1670
|
key: "getNoData",
|
|
1639
1671
|
value: function getNoData() {
|
|
1640
|
-
var
|
|
1672
|
+
var _this$context2 = this.context,
|
|
1673
|
+
rowHeight = _this$context2.rowHeight,
|
|
1674
|
+
translate = _this$context2.translate;
|
|
1641
1675
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1642
1676
|
className: "aio-table-nodata",
|
|
1643
1677
|
style: { ...this.getFullCellStyle(),
|
|
1644
1678
|
height: rowHeight
|
|
1645
1679
|
}
|
|
1646
|
-
},
|
|
1680
|
+
}, translate('No Data'));
|
|
1647
1681
|
}
|
|
1648
1682
|
}, {
|
|
1649
1683
|
key: "getGroupToggleIcon",
|
|
1650
1684
|
value: function getGroupToggleIcon(row) {
|
|
1651
|
-
var _this$
|
|
1652
|
-
rtl = _this$
|
|
1653
|
-
SetState = _this$
|
|
1654
|
-
groupsOpen = _this$
|
|
1655
|
-
getGap = _this$
|
|
1685
|
+
var _this$context3 = this.context,
|
|
1686
|
+
rtl = _this$context3.rtl,
|
|
1687
|
+
SetState = _this$context3.SetState,
|
|
1688
|
+
groupsOpen = _this$context3.groupsOpen,
|
|
1689
|
+
getGap = _this$context3.getGap;
|
|
1656
1690
|
var icon;
|
|
1657
1691
|
|
|
1658
1692
|
if (row._opened) {
|
|
@@ -1668,12 +1702,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1668
1702
|
});
|
|
1669
1703
|
}
|
|
1670
1704
|
|
|
1671
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1705
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1672
1706
|
className: "aio-table-toggle",
|
|
1673
1707
|
onClick: function onClick() {
|
|
1674
|
-
var
|
|
1675
|
-
|
|
1676
|
-
groupsOpen[_parentField + _groupField] = !groupsOpen[_parentField + _groupField];
|
|
1708
|
+
var _groupId = row._groupId;
|
|
1709
|
+
groupsOpen[_groupId] = !groupsOpen[_groupId];
|
|
1677
1710
|
SetState({
|
|
1678
1711
|
groupsOpen: groupsOpen
|
|
1679
1712
|
});
|
|
@@ -1692,12 +1725,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1692
1725
|
}, {
|
|
1693
1726
|
key: "getStyle",
|
|
1694
1727
|
value: function getStyle() {
|
|
1695
|
-
var _this$
|
|
1696
|
-
rowGap = _this$
|
|
1697
|
-
columnGap = _this$
|
|
1698
|
-
var _this$
|
|
1699
|
-
columns = _this$
|
|
1700
|
-
style = _this$
|
|
1728
|
+
var _this$context4 = this.context,
|
|
1729
|
+
rowGap = _this$context4.rowGap,
|
|
1730
|
+
columnGap = _this$context4.columnGap;
|
|
1731
|
+
var _this$props9 = this.props,
|
|
1732
|
+
columns = _this$props9.columns,
|
|
1733
|
+
style = _this$props9.style;
|
|
1701
1734
|
var gridTemplateColumns = '';
|
|
1702
1735
|
this.gridTemplateColumns = [];
|
|
1703
1736
|
|
|
@@ -1724,19 +1757,19 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1724
1757
|
}, {
|
|
1725
1758
|
key: "getTitles",
|
|
1726
1759
|
value: function getTitles() {
|
|
1727
|
-
var
|
|
1760
|
+
var _this11 = this;
|
|
1728
1761
|
|
|
1729
1762
|
var columns = this.props.columns;
|
|
1730
1763
|
return columns.map(function (column) {
|
|
1731
|
-
return
|
|
1764
|
+
return _this11.getTitle(column);
|
|
1732
1765
|
});
|
|
1733
1766
|
}
|
|
1734
1767
|
}, {
|
|
1735
1768
|
key: "getGanttTitle",
|
|
1736
1769
|
value: function getGanttTitle(column) {
|
|
1737
|
-
var _this$
|
|
1738
|
-
headerHeight = _this$
|
|
1739
|
-
columnGap = _this$
|
|
1770
|
+
var _this$context5 = this.context,
|
|
1771
|
+
headerHeight = _this$context5.headerHeight,
|
|
1772
|
+
columnGap = _this$context5.columnGap;
|
|
1740
1773
|
var getKeys = column.getKeys,
|
|
1741
1774
|
_column$padding = column.padding,
|
|
1742
1775
|
padding = _column$padding === void 0 ? '36px' : _column$padding;
|
|
@@ -1754,38 +1787,42 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1754
1787
|
}, /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
1755
1788
|
start: 0,
|
|
1756
1789
|
end: keys.length - 1,
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1790
|
+
labelStep: 1,
|
|
1791
|
+
editLabel: function editLabel(value) {
|
|
1792
|
+
return keys[value];
|
|
1793
|
+
},
|
|
1794
|
+
labelStyle: function labelStyle() {
|
|
1795
|
+
return {
|
|
1763
1796
|
top: 0
|
|
1764
|
-
}
|
|
1797
|
+
};
|
|
1765
1798
|
},
|
|
1766
|
-
pointStyle: {
|
|
1767
|
-
|
|
1799
|
+
pointStyle: function pointStyle() {
|
|
1800
|
+
return {
|
|
1801
|
+
display: 'none'
|
|
1802
|
+
};
|
|
1768
1803
|
},
|
|
1769
|
-
lineStyle: {
|
|
1770
|
-
|
|
1804
|
+
lineStyle: function lineStyle() {
|
|
1805
|
+
return {
|
|
1806
|
+
display: 'none'
|
|
1807
|
+
};
|
|
1771
1808
|
}
|
|
1772
1809
|
}));
|
|
1773
1810
|
}
|
|
1774
1811
|
}, {
|
|
1775
1812
|
key: "getTitle",
|
|
1776
1813
|
value: function getTitle(column) {
|
|
1777
|
-
var
|
|
1814
|
+
var _this12 = this;
|
|
1778
1815
|
|
|
1779
1816
|
if (column.template === 'gantt') {
|
|
1780
1817
|
return this.getGanttTitle(column);
|
|
1781
1818
|
}
|
|
1782
1819
|
|
|
1783
|
-
var _this$
|
|
1784
|
-
SetState = _this$
|
|
1785
|
-
columns = _this$
|
|
1786
|
-
headerHeight = _this$
|
|
1787
|
-
columnGap = _this$
|
|
1788
|
-
touch = _this$
|
|
1820
|
+
var _this$context6 = this.context,
|
|
1821
|
+
SetState = _this$context6.SetState,
|
|
1822
|
+
columns = _this$context6.columns,
|
|
1823
|
+
headerHeight = _this$context6.headerHeight,
|
|
1824
|
+
columnGap = _this$context6.columnGap,
|
|
1825
|
+
touch = _this$context6.touch;
|
|
1789
1826
|
var props = {
|
|
1790
1827
|
style: {
|
|
1791
1828
|
height: headerHeight,
|
|
@@ -1805,7 +1842,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1805
1842
|
},
|
|
1806
1843
|
draggable: false
|
|
1807
1844
|
}, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
|
|
1808
|
-
return column.resizable ?
|
|
1845
|
+
return column.resizable ? _this12.resizeDown(e, column) : undefined;
|
|
1809
1846
|
});
|
|
1810
1847
|
|
|
1811
1848
|
var titleProps = {
|
|
@@ -1816,24 +1853,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1816
1853
|
},
|
|
1817
1854
|
draggable: column.movable !== false,
|
|
1818
1855
|
onDragStart: function onDragStart(e) {
|
|
1819
|
-
|
|
1856
|
+
_this12.startColumnSwap = column._index;
|
|
1820
1857
|
},
|
|
1821
1858
|
onDragOver: function onDragOver(e) {
|
|
1822
1859
|
e.preventDefault();
|
|
1823
|
-
|
|
1860
|
+
_this12.endColumnSwap = column._index;
|
|
1824
1861
|
},
|
|
1825
1862
|
onDrop: function onDrop(e) {
|
|
1826
1863
|
if (column.movable === false) {
|
|
1827
1864
|
return;
|
|
1828
1865
|
}
|
|
1829
1866
|
|
|
1830
|
-
if (
|
|
1867
|
+
if (_this12.startColumnSwap === undefined || _this12.startColumnSwap === _this12.endColumnSwap) {
|
|
1831
1868
|
return;
|
|
1832
1869
|
}
|
|
1833
1870
|
|
|
1834
|
-
var temp = columns[
|
|
1835
|
-
columns[
|
|
1836
|
-
columns[
|
|
1871
|
+
var temp = columns[_this12.startColumnSwap];
|
|
1872
|
+
columns[_this12.startColumnSwap] = columns[_this12.endColumnSwap];
|
|
1873
|
+
columns[_this12.endColumnSwap] = temp;
|
|
1837
1874
|
SetState({
|
|
1838
1875
|
columns: columns
|
|
1839
1876
|
});
|
|
@@ -1846,9 +1883,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1846
1883
|
}, {
|
|
1847
1884
|
key: "resizeDown",
|
|
1848
1885
|
value: function resizeDown(e, column) {
|
|
1849
|
-
var _this$
|
|
1850
|
-
touch = _this$
|
|
1851
|
-
getClient = _this$
|
|
1886
|
+
var _this$context7 = this.context,
|
|
1887
|
+
touch = _this$context7.touch,
|
|
1888
|
+
getClient = _this$context7.getClient;
|
|
1852
1889
|
(0, _jquery.default)(window).bind(touch ? 'touchmove' : 'mousemove', _jquery.default.proxy(this.resizeMove, this));
|
|
1853
1890
|
(0, _jquery.default)(window).bind(touch ? 'touchend' : 'mouseup', _jquery.default.proxy(this.resizeUp, this));
|
|
1854
1891
|
this.resizeDetails = {
|
|
@@ -1862,9 +1899,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1862
1899
|
}, {
|
|
1863
1900
|
key: "resizeMove",
|
|
1864
1901
|
value: function resizeMove(e) {
|
|
1865
|
-
var _this$
|
|
1866
|
-
rtl = _this$
|
|
1867
|
-
getClient = _this$
|
|
1902
|
+
var _this$context8 = this.context,
|
|
1903
|
+
rtl = _this$context8.rtl,
|
|
1904
|
+
getClient = _this$context8.getClient;
|
|
1868
1905
|
var Client = getClient(e);
|
|
1869
1906
|
var _this$resizeDetails2 = this.resizeDetails,
|
|
1870
1907
|
client = _this$resizeDetails2.client,
|
|
@@ -1891,9 +1928,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1891
1928
|
var touch = this.context.touch;
|
|
1892
1929
|
(0, _jquery.default)(window).unbind(touch ? 'touchmove' : 'mousemove', this.resizeMove);
|
|
1893
1930
|
(0, _jquery.default)(window).unbind(touch ? 'touchend' : 'mouseup', this.resizeUp);
|
|
1894
|
-
var _this$
|
|
1895
|
-
columns = _this$
|
|
1896
|
-
SetState = _this$
|
|
1931
|
+
var _this$context9 = this.context,
|
|
1932
|
+
columns = _this$context9.columns,
|
|
1933
|
+
SetState = _this$context9.SetState;
|
|
1897
1934
|
var _this$resizeDetails3 = this.resizeDetails,
|
|
1898
1935
|
index = _this$resizeDetails3.index,
|
|
1899
1936
|
newWidth = _this$resizeDetails3.newWidth;
|
|
@@ -1927,10 +1964,10 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1927
1964
|
key: "arrow",
|
|
1928
1965
|
value: function arrow(e) {
|
|
1929
1966
|
var container = (0, _jquery.default)(this.dom.current);
|
|
1930
|
-
var _this$
|
|
1931
|
-
rtl = _this$
|
|
1932
|
-
focused = _this$
|
|
1933
|
-
SetState = _this$
|
|
1967
|
+
var _this$context10 = this.context,
|
|
1968
|
+
rtl = _this$context10.rtl,
|
|
1969
|
+
focused = _this$context10.focused,
|
|
1970
|
+
SetState = _this$context10.SetState;
|
|
1934
1971
|
var columns = this.props.columns;
|
|
1935
1972
|
var inputs = container.find('.aio-table-input');
|
|
1936
1973
|
|
|
@@ -2014,28 +2051,26 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2014
2051
|
}, {
|
|
2015
2052
|
key: "card",
|
|
2016
2053
|
value: function card() {
|
|
2017
|
-
var
|
|
2054
|
+
var _this13 = this;
|
|
2018
2055
|
|
|
2019
|
-
var _this$
|
|
2020
|
-
indent = _this$
|
|
2021
|
-
_onMouseEnter = _this$
|
|
2022
|
-
_onScroll = _this$
|
|
2023
|
-
rowHeight = _this$
|
|
2024
|
-
_this$
|
|
2025
|
-
cardGap = _this$
|
|
2026
|
-
getLoading = _this$
|
|
2027
|
-
cardTemplate = _this$
|
|
2028
|
-
_this$
|
|
2029
|
-
cardRowCount = _this$
|
|
2030
|
-
rowGap = _this$
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
id = _this$props11.id,
|
|
2038
|
-
index = _this$props11.index;
|
|
2056
|
+
var _this$context11 = this.context,
|
|
2057
|
+
indent = _this$context11.indent,
|
|
2058
|
+
_onMouseEnter = _this$context11.onMouseEnter,
|
|
2059
|
+
_onScroll = _this$context11.onScroll,
|
|
2060
|
+
rowHeight = _this$context11.rowHeight,
|
|
2061
|
+
_this$context11$cardG = _this$context11.cardGap,
|
|
2062
|
+
cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
|
|
2063
|
+
getLoading = _this$context11.getLoading,
|
|
2064
|
+
cardTemplate = _this$context11.cardTemplate,
|
|
2065
|
+
_this$context11$cardR = _this$context11.cardRowCount,
|
|
2066
|
+
cardRowCount = _this$context11$cardR === void 0 ? 1 : _this$context11$cardR,
|
|
2067
|
+
rowGap = _this$context11.rowGap,
|
|
2068
|
+
columnGap = _this$context11.columnGap,
|
|
2069
|
+
toggleRow = _this$context11.toggleRow;
|
|
2070
|
+
var _this$props10 = this.props,
|
|
2071
|
+
rows = _this$props10.rows,
|
|
2072
|
+
id = _this$props10.id,
|
|
2073
|
+
index = _this$props10.index;
|
|
2039
2074
|
var groupStyle = {
|
|
2040
2075
|
gridColumnStart: 1,
|
|
2041
2076
|
gridColumnEnd: cardRowCount + 1,
|
|
@@ -2068,30 +2103,20 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2068
2103
|
return _onScroll(e, index);
|
|
2069
2104
|
}
|
|
2070
2105
|
}, rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2071
|
-
if (row.
|
|
2106
|
+
if (row._groupId) {
|
|
2072
2107
|
var width = indent * row._level;
|
|
2073
2108
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2074
2109
|
className: "aio-table-group",
|
|
2075
2110
|
key: 'group' + i + '-' + index,
|
|
2076
2111
|
style: groupStyle
|
|
2077
|
-
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2112
|
+
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2078
2113
|
style: {
|
|
2079
2114
|
width: width,
|
|
2080
2115
|
flexShrink: 0
|
|
2081
2116
|
}
|
|
2082
|
-
}),
|
|
2117
|
+
}), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2083
2118
|
className: "aio-table-group-text"
|
|
2084
|
-
}, row.
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
if (cardType === 'layout') {
|
|
2088
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2089
|
-
key: i + '-' + index,
|
|
2090
|
-
className: "aio-table-card"
|
|
2091
|
-
}, /*#__PURE__*/_react.default.createElement(RLayout, {
|
|
2092
|
-
gap: cardGap,
|
|
2093
|
-
layout: cardTemplate(row.row)
|
|
2094
|
-
}));
|
|
2119
|
+
}, row._groupValue)));
|
|
2095
2120
|
}
|
|
2096
2121
|
|
|
2097
2122
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -2105,25 +2130,25 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2105
2130
|
}, {
|
|
2106
2131
|
key: "render",
|
|
2107
2132
|
value: function render() {
|
|
2108
|
-
var
|
|
2133
|
+
var _this14 = this;
|
|
2109
2134
|
|
|
2110
2135
|
if (this.context.cardTemplate) {
|
|
2111
2136
|
return this.card();
|
|
2112
2137
|
}
|
|
2113
2138
|
|
|
2114
|
-
var _this$
|
|
2115
|
-
indent = _this$
|
|
2116
|
-
_onMouseEnter2 = _this$
|
|
2117
|
-
_onScroll2 = _this$
|
|
2118
|
-
rowHeight = _this$
|
|
2119
|
-
groups = _this$
|
|
2120
|
-
getLoading = _this$
|
|
2121
|
-
cardTemplate = _this$
|
|
2122
|
-
var _this$
|
|
2123
|
-
rows = _this$
|
|
2124
|
-
id = _this$
|
|
2125
|
-
index = _this$
|
|
2126
|
-
type = _this$
|
|
2139
|
+
var _this$context12 = this.context,
|
|
2140
|
+
indent = _this$context12.indent,
|
|
2141
|
+
_onMouseEnter2 = _this$context12.onMouseEnter,
|
|
2142
|
+
_onScroll2 = _this$context12.onScroll,
|
|
2143
|
+
rowHeight = _this$context12.rowHeight,
|
|
2144
|
+
groups = _this$context12.groups,
|
|
2145
|
+
getLoading = _this$context12.getLoading,
|
|
2146
|
+
cardTemplate = _this$context12.cardTemplate;
|
|
2147
|
+
var _this$props11 = this.props,
|
|
2148
|
+
rows = _this$props11.rows,
|
|
2149
|
+
id = _this$props11.id,
|
|
2150
|
+
index = _this$props11.index,
|
|
2151
|
+
type = _this$props11.type;
|
|
2127
2152
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2128
2153
|
id: id,
|
|
2129
2154
|
tabIndex: 0,
|
|
@@ -2141,52 +2166,31 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2141
2166
|
return _onScroll2(e, index);
|
|
2142
2167
|
}
|
|
2143
2168
|
}, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2144
|
-
if (row.
|
|
2169
|
+
if (row._groupId) {
|
|
2145
2170
|
var width = indent * row._level;
|
|
2146
2171
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2147
2172
|
className: "aio-table-group",
|
|
2148
2173
|
key: 'group' + i + '-' + index,
|
|
2149
|
-
style: { ...
|
|
2174
|
+
style: { ..._this14.getFullCellStyle(),
|
|
2150
2175
|
height: rowHeight
|
|
2151
2176
|
}
|
|
2152
|
-
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2177
|
+
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2153
2178
|
style: {
|
|
2154
2179
|
width: width,
|
|
2155
2180
|
flexShrink: 0
|
|
2156
2181
|
}
|
|
2157
|
-
}),
|
|
2182
|
+
}), _this14.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2158
2183
|
className: "aio-table-group-text"
|
|
2159
|
-
}, row.
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
if (type === 'freeze') {
|
|
2163
|
-
return row.freezeCells.map(function (r, j) {
|
|
2164
|
-
return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
|
|
2165
|
-
key: i + '-' + j + '-' + index,
|
|
2166
|
-
cellId: i + '-' + j + '-' + index
|
|
2167
|
-
}, r, {
|
|
2168
|
-
relativeFilter: row.row._show === 'relativeFilter'
|
|
2169
|
-
}));
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
if (type === 'unFreeze') {
|
|
2174
|
-
return row.unFreezeCells.map(function (r, j) {
|
|
2175
|
-
return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
|
|
2176
|
-
key: i + '-' + j + '-' + index,
|
|
2177
|
-
cellId: i + '-' + j + '-' + index
|
|
2178
|
-
}, r, {
|
|
2179
|
-
relativeFilter: row.row._show === 'relativeFilter'
|
|
2180
|
-
}));
|
|
2181
|
-
});
|
|
2184
|
+
}, row._groupValue)));
|
|
2182
2185
|
}
|
|
2183
2186
|
|
|
2184
|
-
return row.
|
|
2187
|
+
return row[type].map(function (r, j) {
|
|
2188
|
+
var id = i + '-' + j + '-' + index;
|
|
2185
2189
|
return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
|
|
2186
|
-
key:
|
|
2187
|
-
cellId:
|
|
2190
|
+
key: id,
|
|
2191
|
+
cellId: id
|
|
2188
2192
|
}, r, {
|
|
2189
|
-
|
|
2193
|
+
row: row.row
|
|
2190
2194
|
}));
|
|
2191
2195
|
});
|
|
2192
2196
|
}), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
|
|
@@ -2204,19 +2208,19 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2204
2208
|
var _super4 = _createSuper(AIOTableCell);
|
|
2205
2209
|
|
|
2206
2210
|
function AIOTableCell(props) {
|
|
2207
|
-
var
|
|
2211
|
+
var _this15;
|
|
2208
2212
|
|
|
2209
2213
|
_classCallCheck(this, AIOTableCell);
|
|
2210
2214
|
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
var value =
|
|
2214
|
-
|
|
2215
|
+
_this15 = _super4.call(this, props);
|
|
2216
|
+
_this15.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
2217
|
+
var value = _this15.props.value;
|
|
2218
|
+
_this15.state = {
|
|
2215
2219
|
value: value,
|
|
2216
2220
|
error: false,
|
|
2217
2221
|
prevValue: value
|
|
2218
2222
|
};
|
|
2219
|
-
return
|
|
2223
|
+
return _this15;
|
|
2220
2224
|
}
|
|
2221
2225
|
|
|
2222
2226
|
_createClass(AIOTableCell, [{
|
|
@@ -2227,7 +2231,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2227
2231
|
}
|
|
2228
2232
|
|
|
2229
2233
|
var before = typeof column.before === 'function' ? column.before(row, column) : column.before;
|
|
2230
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2234
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2231
2235
|
className: "aio-table-icon"
|
|
2232
2236
|
}, before), this.context.getGap());
|
|
2233
2237
|
}
|
|
@@ -2239,7 +2243,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2239
2243
|
}
|
|
2240
2244
|
|
|
2241
2245
|
var after = typeof column.after === 'function' ? column.after(row, column) : column.after;
|
|
2242
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2246
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2243
2247
|
style: {
|
|
2244
2248
|
flex: 1
|
|
2245
2249
|
}
|
|
@@ -2271,7 +2275,6 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2271
2275
|
}, {
|
|
2272
2276
|
key: "getClassName",
|
|
2273
2277
|
value: function getClassName(row, column) {
|
|
2274
|
-
var relativeFilter = this.props.relativeFilter;
|
|
2275
2278
|
var className = 'aio-table-cell';
|
|
2276
2279
|
|
|
2277
2280
|
if (column.template) {
|
|
@@ -2290,7 +2293,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2290
2293
|
className += ' aio-table-cell-input';
|
|
2291
2294
|
}
|
|
2292
2295
|
|
|
2293
|
-
if (relativeFilter) {
|
|
2296
|
+
if (row._show === 'relativeFilter') {
|
|
2294
2297
|
className += ' aio-table-relative-filter';
|
|
2295
2298
|
}
|
|
2296
2299
|
|
|
@@ -2299,9 +2302,9 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2299
2302
|
}, {
|
|
2300
2303
|
key: "getToggleIcon",
|
|
2301
2304
|
value: function getToggleIcon(row) {
|
|
2302
|
-
var _this$
|
|
2303
|
-
rtl = _this$
|
|
2304
|
-
toggleRow = _this$
|
|
2305
|
+
var _this$context13 = this.context,
|
|
2306
|
+
rtl = _this$context13.rtl,
|
|
2307
|
+
toggleRow = _this$context13.toggleRow;
|
|
2305
2308
|
var icon;
|
|
2306
2309
|
|
|
2307
2310
|
if (!row._childsLength) {
|
|
@@ -2322,7 +2325,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2322
2325
|
});
|
|
2323
2326
|
}
|
|
2324
2327
|
|
|
2325
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2328
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2326
2329
|
className: "aio-table-toggle",
|
|
2327
2330
|
onClick: function onClick() {
|
|
2328
2331
|
return toggleRow(row);
|
|
@@ -2399,50 +2402,54 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2399
2402
|
var flags = getFlags();
|
|
2400
2403
|
content = /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
2401
2404
|
start: 0,
|
|
2402
|
-
editValue: function editValue(
|
|
2403
|
-
var value = _ref.value;
|
|
2405
|
+
editValue: function editValue(value) {
|
|
2404
2406
|
return keys[value];
|
|
2405
2407
|
},
|
|
2406
2408
|
end: keys.length - 1,
|
|
2407
|
-
points: [
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2409
|
+
points: [startIndex, endIndex],
|
|
2410
|
+
fillStyle: function fillStyle(index) {
|
|
2411
|
+
if (index === 1) {
|
|
2412
|
+
return {
|
|
2413
|
+
background: backgroundColor,
|
|
2414
|
+
backgroundImage: background
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
getText: function getText(index) {
|
|
2419
|
+
if (index === 1 && text) {
|
|
2420
|
+
return text;
|
|
2421
|
+
}
|
|
2422
|
+
},
|
|
2423
|
+
textStyle: function textStyle() {
|
|
2424
|
+
return {
|
|
2425
|
+
color: color
|
|
2426
|
+
};
|
|
2427
|
+
},
|
|
2428
|
+
scaleStep: 1,
|
|
2429
|
+
scaleStyle: function scaleStyle(value) {
|
|
2430
|
+
var flag = flags.filter(function (o) {
|
|
2431
|
+
return keys.indexOf(o.value) === value;
|
|
2432
|
+
})[0];
|
|
2433
|
+
|
|
2434
|
+
if (flag) {
|
|
2435
|
+
return {
|
|
2436
|
+
background: flag.color,
|
|
2437
|
+
height: '100%',
|
|
2438
|
+
top: 0,
|
|
2439
|
+
zIndex: 100
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
return {
|
|
2424
2444
|
height: '100%',
|
|
2425
2445
|
top: 0,
|
|
2426
2446
|
opacity: .4
|
|
2427
|
-
}
|
|
2428
|
-
items: flags.map(function (_ref2) {
|
|
2429
|
-
var index = _ref2.index,
|
|
2430
|
-
value = _ref2.value,
|
|
2431
|
-
_ref2$color = _ref2.color,
|
|
2432
|
-
color = _ref2$color === void 0 ? 'red' : _ref2$color;
|
|
2433
|
-
var flag = index !== undefined ? index : keys.indexOf(value);
|
|
2434
|
-
return {
|
|
2435
|
-
value: flag,
|
|
2436
|
-
style: {
|
|
2437
|
-
background: color,
|
|
2438
|
-
height: '100%',
|
|
2439
|
-
top: 0
|
|
2440
|
-
}
|
|
2441
|
-
};
|
|
2442
|
-
})
|
|
2447
|
+
};
|
|
2443
2448
|
},
|
|
2444
|
-
lineStyle: {
|
|
2445
|
-
|
|
2449
|
+
lineStyle: function lineStyle() {
|
|
2450
|
+
return {
|
|
2451
|
+
opacity: .4
|
|
2452
|
+
};
|
|
2446
2453
|
}
|
|
2447
2454
|
});
|
|
2448
2455
|
} else if (template && column.inlineEdit) {
|
|
@@ -2501,7 +2508,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2501
2508
|
}, {
|
|
2502
2509
|
key: "getInput",
|
|
2503
2510
|
value: function getInput(row, column) {
|
|
2504
|
-
var
|
|
2511
|
+
var _this16 = this;
|
|
2505
2512
|
|
|
2506
2513
|
var type = column.inlineEdit.type;
|
|
2507
2514
|
var value = this.state.value;
|
|
@@ -2525,23 +2532,23 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2525
2532
|
textAlign: column.justify ? 'center' : undefined
|
|
2526
2533
|
},
|
|
2527
2534
|
onChange: function onChange(e) {
|
|
2528
|
-
return
|
|
2535
|
+
return _this16.setState({
|
|
2529
2536
|
value: e.target.value
|
|
2530
2537
|
});
|
|
2531
2538
|
},
|
|
2532
2539
|
onBlur: async function onBlur(e) {
|
|
2533
|
-
|
|
2540
|
+
_this16.setState({
|
|
2534
2541
|
loading: true
|
|
2535
2542
|
});
|
|
2536
2543
|
|
|
2537
2544
|
var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
|
|
2538
2545
|
|
|
2539
|
-
|
|
2546
|
+
_this16.setState({
|
|
2540
2547
|
loading: false
|
|
2541
2548
|
});
|
|
2542
2549
|
|
|
2543
2550
|
if (typeof error === 'string') {
|
|
2544
|
-
|
|
2551
|
+
_this16.setState({
|
|
2545
2552
|
error: error
|
|
2546
2553
|
});
|
|
2547
2554
|
}
|
|
@@ -2566,27 +2573,27 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2566
2573
|
className: "aio-table-input-container"
|
|
2567
2574
|
}, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
|
|
2568
2575
|
onFocus: function onFocus() {
|
|
2569
|
-
return
|
|
2576
|
+
return _this16.focus = true;
|
|
2570
2577
|
},
|
|
2571
2578
|
onBlur: function onBlur() {
|
|
2572
|
-
return
|
|
2579
|
+
return _this16.focus = false;
|
|
2573
2580
|
},
|
|
2574
2581
|
onChange: async function onChange(e) {
|
|
2575
2582
|
var value = e.target.value;
|
|
2576
2583
|
|
|
2577
|
-
|
|
2584
|
+
_this16.setState({
|
|
2578
2585
|
loading: true,
|
|
2579
2586
|
value: value
|
|
2580
2587
|
});
|
|
2581
2588
|
|
|
2582
2589
|
var error = await column.inlineEdit.onChange(row, e.target.value);
|
|
2583
2590
|
|
|
2584
|
-
|
|
2591
|
+
_this16.setState({
|
|
2585
2592
|
loading: false
|
|
2586
2593
|
});
|
|
2587
2594
|
|
|
2588
2595
|
if (typeof error === 'string') {
|
|
2589
|
-
|
|
2596
|
+
_this16.setState({
|
|
2590
2597
|
error: error
|
|
2591
2598
|
});
|
|
2592
2599
|
}
|
|
@@ -2616,21 +2623,21 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2616
2623
|
}, {
|
|
2617
2624
|
key: "render",
|
|
2618
2625
|
value: function render() {
|
|
2619
|
-
var
|
|
2626
|
+
var _this17 = this;
|
|
2620
2627
|
|
|
2621
|
-
var _this$
|
|
2622
|
-
indent = _this$
|
|
2623
|
-
cubes2 = _this$
|
|
2624
|
-
focused = _this$
|
|
2625
|
-
SetState = _this$
|
|
2626
|
-
onDrag = _this$
|
|
2627
|
-
_onDrop = _this$
|
|
2628
|
-
onSwap = _this$
|
|
2629
|
-
var _this$
|
|
2630
|
-
row = _this$
|
|
2631
|
-
column = _this$
|
|
2632
|
-
value = _this$
|
|
2633
|
-
cellId = _this$
|
|
2628
|
+
var _this$context14 = this.context,
|
|
2629
|
+
indent = _this$context14.indent,
|
|
2630
|
+
cubes2 = _this$context14.cubes2,
|
|
2631
|
+
focused = _this$context14.focused,
|
|
2632
|
+
SetState = _this$context14.SetState,
|
|
2633
|
+
onDrag = _this$context14.onDrag,
|
|
2634
|
+
_onDrop = _this$context14.onDrop,
|
|
2635
|
+
onSwap = _this$context14.onSwap;
|
|
2636
|
+
var _this$props12 = this.props,
|
|
2637
|
+
row = _this$props12.row,
|
|
2638
|
+
column = _this$props12.column,
|
|
2639
|
+
value = _this$props12.value,
|
|
2640
|
+
cellId = _this$props12.cellId;
|
|
2634
2641
|
|
|
2635
2642
|
if (this.state.prevValue !== value) {
|
|
2636
2643
|
this.setState({
|
|
@@ -2656,8 +2663,8 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2656
2663
|
cell = /*#__PURE__*/_react.default.createElement("div", {
|
|
2657
2664
|
className: "aio-table-error",
|
|
2658
2665
|
onClick: function onClick() {
|
|
2659
|
-
|
|
2660
|
-
value:
|
|
2666
|
+
_this17.setState({
|
|
2667
|
+
value: _this17.props.value,
|
|
2661
2668
|
error: false
|
|
2662
2669
|
});
|
|
2663
2670
|
}
|
|
@@ -2666,7 +2673,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2666
2673
|
var style = {
|
|
2667
2674
|
justifyContent: column.justify !== false && !column.treeMode ? 'center' : undefined
|
|
2668
2675
|
};
|
|
2669
|
-
cell = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
|
|
2676
|
+
cell = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
|
|
2670
2677
|
className: "aio-table-indent",
|
|
2671
2678
|
style: {
|
|
2672
2679
|
width: row._level * indent
|
|
@@ -2729,14 +2736,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2729
2736
|
var _super5 = _createSuper(AIOSlider);
|
|
2730
2737
|
|
|
2731
2738
|
function AIOSlider(props) {
|
|
2732
|
-
var
|
|
2739
|
+
var _this18;
|
|
2733
2740
|
|
|
2734
2741
|
_classCallCheck(this, AIOSlider);
|
|
2735
2742
|
|
|
2736
|
-
|
|
2737
|
-
var
|
|
2738
|
-
column =
|
|
2739
|
-
row =
|
|
2743
|
+
_this18 = _super5.call(this, props);
|
|
2744
|
+
var _this18$props = _this18.props,
|
|
2745
|
+
column = _this18$props.column,
|
|
2746
|
+
row = _this18$props.row;
|
|
2740
2747
|
var getValue = column.getValue;
|
|
2741
2748
|
var value = getValue(row);
|
|
2742
2749
|
|
|
@@ -2744,11 +2751,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2744
2751
|
value = [value];
|
|
2745
2752
|
}
|
|
2746
2753
|
|
|
2747
|
-
|
|
2754
|
+
_this18.state = {
|
|
2748
2755
|
value: value
|
|
2749
2756
|
};
|
|
2750
|
-
|
|
2751
|
-
return
|
|
2757
|
+
_this18.updateMode = 'outside';
|
|
2758
|
+
return _this18;
|
|
2752
2759
|
}
|
|
2753
2760
|
|
|
2754
2761
|
_createClass(AIOSlider, [{
|
|
@@ -2767,11 +2774,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2767
2774
|
}, {
|
|
2768
2775
|
key: "render",
|
|
2769
2776
|
value: function render() {
|
|
2770
|
-
var
|
|
2777
|
+
var _this19 = this;
|
|
2771
2778
|
|
|
2772
|
-
var _this$
|
|
2773
|
-
column = _this$
|
|
2774
|
-
row = _this$
|
|
2779
|
+
var _this$props13 = this.props,
|
|
2780
|
+
column = _this$props13.column,
|
|
2781
|
+
row = _this$props13.row;
|
|
2775
2782
|
var getValue = column.getValue,
|
|
2776
2783
|
_column$getStart = column.getStart,
|
|
2777
2784
|
getStart = _column$getStart === void 0 ? function () {
|
|
@@ -2846,7 +2853,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2846
2853
|
});
|
|
2847
2854
|
}
|
|
2848
2855
|
|
|
2849
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
2856
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
2850
2857
|
className: "aio-table-slider-value"
|
|
2851
2858
|
}, editValue(value[0])), /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
2852
2859
|
start: start,
|
|
@@ -2861,7 +2868,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2861
2868
|
fillStyle: {
|
|
2862
2869
|
height: '6px',
|
|
2863
2870
|
borderRadius: '24px',
|
|
2864
|
-
background:
|
|
2871
|
+
background: _this19.getBackground(value.length, i, color)
|
|
2865
2872
|
}
|
|
2866
2873
|
};
|
|
2867
2874
|
}),
|
|
@@ -2877,14 +2884,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2877
2884
|
background: '#d5d5d5'
|
|
2878
2885
|
},
|
|
2879
2886
|
editable: typeof onChange === 'function',
|
|
2880
|
-
onchange: function onchange(
|
|
2881
|
-
var points =
|
|
2887
|
+
onchange: function onchange(_ref) {
|
|
2888
|
+
var points = _ref.points;
|
|
2882
2889
|
|
|
2883
2890
|
if (!onChange) {
|
|
2884
2891
|
return;
|
|
2885
2892
|
}
|
|
2886
2893
|
|
|
2887
|
-
|
|
2894
|
+
_this19.updateMode = 'onChange';
|
|
2888
2895
|
onChange(row, points.length > 1 ? points.map(function (p) {
|
|
2889
2896
|
return p.value;
|
|
2890
2897
|
}) : points[0].value);
|
|
@@ -2892,11 +2899,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2892
2899
|
pin: pinItems.length === 0 ? undefined : {
|
|
2893
2900
|
items: pinItems
|
|
2894
2901
|
},
|
|
2895
|
-
ondrag: function ondrag(
|
|
2896
|
-
var points =
|
|
2897
|
-
|
|
2902
|
+
ondrag: function ondrag(_ref2) {
|
|
2903
|
+
var points = _ref2.points;
|
|
2904
|
+
_this19.updateMode = 'onDrag';
|
|
2898
2905
|
|
|
2899
|
-
|
|
2906
|
+
_this19.setState({
|
|
2900
2907
|
value: points.map(function (p) {
|
|
2901
2908
|
return p.value;
|
|
2902
2909
|
})
|
|
@@ -2925,9 +2932,9 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
|
|
|
2925
2932
|
_createClass(RTableFilter, [{
|
|
2926
2933
|
key: "render",
|
|
2927
2934
|
value: function render() {
|
|
2928
|
-
var _this$
|
|
2929
|
-
filterDictionary = _this$
|
|
2930
|
-
rtl = _this$
|
|
2935
|
+
var _this$context15 = this.context,
|
|
2936
|
+
filterDictionary = _this$context15.filterDictionary,
|
|
2937
|
+
rtl = _this$context15.rtl;
|
|
2931
2938
|
var column = this.props.column;
|
|
2932
2939
|
|
|
2933
2940
|
if (!column.filter || column.search) {
|
|
@@ -2949,11 +2956,12 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
|
|
|
2949
2956
|
});
|
|
2950
2957
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2951
2958
|
className: "aio-table-filter-icon"
|
|
2952
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
2959
|
+
}, /*#__PURE__*/_react.default.createElement(_aioButton.default, {
|
|
2960
|
+
type: "button",
|
|
2953
2961
|
rtl: rtl,
|
|
2954
2962
|
openRelatedTo: ".aio-table",
|
|
2955
2963
|
text: icon,
|
|
2956
|
-
|
|
2964
|
+
popOver: function popOver() {
|
|
2957
2965
|
return /*#__PURE__*/_react.default.createElement(RTableFilterPopup, {
|
|
2958
2966
|
column: column
|
|
2959
2967
|
});
|
|
@@ -2981,10 +2989,10 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
2981
2989
|
_createClass(RTableFilterPopup, [{
|
|
2982
2990
|
key: "add",
|
|
2983
2991
|
value: function add() {
|
|
2984
|
-
var _this$
|
|
2985
|
-
filterDictionary = _this$
|
|
2986
|
-
SetState = _this$
|
|
2987
|
-
onChangeFilter = _this$
|
|
2992
|
+
var _this$context16 = this.context,
|
|
2993
|
+
filterDictionary = _this$context16.filterDictionary,
|
|
2994
|
+
SetState = _this$context16.SetState,
|
|
2995
|
+
onChangeFilter = _this$context16.onChangeFilter;
|
|
2988
2996
|
var column = this.props.column;
|
|
2989
2997
|
|
|
2990
2998
|
filterDictionary[column._index].items.push({
|
|
@@ -3003,13 +3011,13 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3003
3011
|
}, {
|
|
3004
3012
|
key: "render",
|
|
3005
3013
|
value: function render() {
|
|
3006
|
-
var
|
|
3014
|
+
var _this20 = this;
|
|
3007
3015
|
|
|
3008
3016
|
var column = this.props.column;
|
|
3009
|
-
var _this$
|
|
3010
|
-
filterDictionary = _this$
|
|
3011
|
-
SetState = _this$
|
|
3012
|
-
translate = _this$
|
|
3017
|
+
var _this$context17 = this.context,
|
|
3018
|
+
filterDictionary = _this$context17.filterDictionary,
|
|
3019
|
+
SetState = _this$context17.SetState,
|
|
3020
|
+
translate = _this$context17.translate;
|
|
3013
3021
|
var filters = filterDictionary[column._index].items;
|
|
3014
3022
|
var booleanType = filterDictionary[column._index].booleanType;
|
|
3015
3023
|
var filterItems = filters.map(function (filter, i) {
|
|
@@ -3040,7 +3048,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3040
3048
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
3041
3049
|
className: "aio-table-filter-add",
|
|
3042
3050
|
onClick: function onClick() {
|
|
3043
|
-
return
|
|
3051
|
+
return _this20.add();
|
|
3044
3052
|
}
|
|
3045
3053
|
}, translate('Add'))));
|
|
3046
3054
|
}
|
|
@@ -3057,26 +3065,26 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3057
3065
|
var _super8 = _createSuper(RTableFilterItem);
|
|
3058
3066
|
|
|
3059
3067
|
function RTableFilterItem(props) {
|
|
3060
|
-
var
|
|
3068
|
+
var _this21;
|
|
3061
3069
|
|
|
3062
3070
|
_classCallCheck(this, RTableFilterItem);
|
|
3063
3071
|
|
|
3064
|
-
|
|
3065
|
-
var filter =
|
|
3066
|
-
|
|
3072
|
+
_this21 = _super8.call(this, props);
|
|
3073
|
+
var filter = _this21.props.filter;
|
|
3074
|
+
_this21.state = {
|
|
3067
3075
|
value: filter.value,
|
|
3068
3076
|
prevValue: filter.value
|
|
3069
3077
|
};
|
|
3070
|
-
return
|
|
3078
|
+
return _this21;
|
|
3071
3079
|
}
|
|
3072
3080
|
|
|
3073
3081
|
_createClass(RTableFilterItem, [{
|
|
3074
3082
|
key: "remove",
|
|
3075
3083
|
value: function remove(index) {
|
|
3076
|
-
var _this$
|
|
3077
|
-
filterDictionary = _this$
|
|
3078
|
-
SetState = _this$
|
|
3079
|
-
onChangeFilter = _this$
|
|
3084
|
+
var _this$context18 = this.context,
|
|
3085
|
+
filterDictionary = _this$context18.filterDictionary,
|
|
3086
|
+
SetState = _this$context18.SetState,
|
|
3087
|
+
onChangeFilter = _this$context18.onChangeFilter;
|
|
3080
3088
|
var column = this.props.column;
|
|
3081
3089
|
|
|
3082
3090
|
filterDictionary[column._index].items.splice(index, 1);
|
|
@@ -3092,7 +3100,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3092
3100
|
}, {
|
|
3093
3101
|
key: "changeValue",
|
|
3094
3102
|
value: function changeValue(value) {
|
|
3095
|
-
var
|
|
3103
|
+
var _this22 = this;
|
|
3096
3104
|
|
|
3097
3105
|
var onChangeFilter = this.context.onChangeFilter;
|
|
3098
3106
|
clearTimeout(this.timeout);
|
|
@@ -3100,12 +3108,12 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3100
3108
|
value: value
|
|
3101
3109
|
});
|
|
3102
3110
|
this.timeout = setTimeout(function () {
|
|
3103
|
-
var
|
|
3104
|
-
SetState =
|
|
3105
|
-
filterDictionary =
|
|
3106
|
-
var
|
|
3107
|
-
column =
|
|
3108
|
-
index =
|
|
3111
|
+
var _this22$context = _this22.context,
|
|
3112
|
+
SetState = _this22$context.SetState,
|
|
3113
|
+
filterDictionary = _this22$context.filterDictionary;
|
|
3114
|
+
var _this22$props = _this22.props,
|
|
3115
|
+
column = _this22$props.column,
|
|
3116
|
+
index = _this22$props.index;
|
|
3109
3117
|
filterDictionary[column._index].items[index].value = value;
|
|
3110
3118
|
|
|
3111
3119
|
if (onChangeFilter) {
|
|
@@ -3120,17 +3128,17 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3120
3128
|
}, {
|
|
3121
3129
|
key: "render",
|
|
3122
3130
|
value: function render() {
|
|
3123
|
-
var
|
|
3131
|
+
var _this23 = this;
|
|
3124
3132
|
|
|
3125
|
-
var _this$
|
|
3126
|
-
filterDictionary = _this$
|
|
3127
|
-
SetState = _this$
|
|
3128
|
-
translate = _this$
|
|
3129
|
-
onChangeFilter = _this$
|
|
3130
|
-
var _this$
|
|
3131
|
-
filter = _this$
|
|
3132
|
-
column = _this$
|
|
3133
|
-
index = _this$
|
|
3133
|
+
var _this$context19 = this.context,
|
|
3134
|
+
filterDictionary = _this$context19.filterDictionary,
|
|
3135
|
+
SetState = _this$context19.SetState,
|
|
3136
|
+
translate = _this$context19.translate,
|
|
3137
|
+
onChangeFilter = _this$context19.onChangeFilter;
|
|
3138
|
+
var _this$props14 = this.props,
|
|
3139
|
+
filter = _this$props14.filter,
|
|
3140
|
+
column = _this$props14.column,
|
|
3141
|
+
index = _this$props14.index;
|
|
3134
3142
|
|
|
3135
3143
|
if (this.state.prevValue !== filter.value) {
|
|
3136
3144
|
this.setState({
|
|
@@ -3178,7 +3186,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3178
3186
|
type: type,
|
|
3179
3187
|
value: value,
|
|
3180
3188
|
onChange: function onChange(e) {
|
|
3181
|
-
return
|
|
3189
|
+
return _this23.changeValue(e.target.value);
|
|
3182
3190
|
}
|
|
3183
3191
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3184
3192
|
style: {
|
|
@@ -3187,7 +3195,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3187
3195
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3188
3196
|
className: "aio-table-filter-remove",
|
|
3189
3197
|
onClick: function onClick() {
|
|
3190
|
-
return
|
|
3198
|
+
return _this23.remove(index);
|
|
3191
3199
|
}
|
|
3192
3200
|
}, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
3193
3201
|
path: _js.mdiClose,
|
|
@@ -3199,238 +3207,4 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3199
3207
|
return RTableFilterItem;
|
|
3200
3208
|
}(_react.Component);
|
|
3201
3209
|
|
|
3202
|
-
_defineProperty(RTableFilterItem, "contextType", AioTableContext);
|
|
3203
|
-
|
|
3204
|
-
var RLayout = /*#__PURE__*/function (_Component9) {
|
|
3205
|
-
_inherits(RLayout, _Component9);
|
|
3206
|
-
|
|
3207
|
-
var _super9 = _createSuper(RLayout);
|
|
3208
|
-
|
|
3209
|
-
function RLayout() {
|
|
3210
|
-
var _this23;
|
|
3211
|
-
|
|
3212
|
-
_classCallCheck(this, RLayout);
|
|
3213
|
-
|
|
3214
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3215
|
-
args[_key] = arguments[_key];
|
|
3216
|
-
}
|
|
3217
|
-
|
|
3218
|
-
_this23 = _super9.call.apply(_super9, [this].concat(args));
|
|
3219
|
-
|
|
3220
|
-
_defineProperty(_assertThisInitialized(_this23), "touch", 'ontouchstart' in document.documentElement);
|
|
3221
|
-
|
|
3222
|
-
return _this23;
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
|
-
_createClass(RLayout, [{
|
|
3226
|
-
key: "eventHandler",
|
|
3227
|
-
value: function eventHandler(event, action) {
|
|
3228
|
-
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'bind';
|
|
3229
|
-
event = this.touch ? {
|
|
3230
|
-
mousemove: "touchmove",
|
|
3231
|
-
mouseup: "touchend"
|
|
3232
|
-
}[event] : event;
|
|
3233
|
-
(0, _jquery.default)(window).unbind(event, action);
|
|
3234
|
-
|
|
3235
|
-
if (type === 'bind') {
|
|
3236
|
-
(0, _jquery.default)(window).bind(event, action);
|
|
3237
|
-
}
|
|
3238
|
-
}
|
|
3239
|
-
}, {
|
|
3240
|
-
key: "getClient",
|
|
3241
|
-
value: function getClient(e) {
|
|
3242
|
-
return this.touch ? {
|
|
3243
|
-
x: e.changedTouches[0].clientX,
|
|
3244
|
-
y: e.changedTouches[0].clientY
|
|
3245
|
-
} : {
|
|
3246
|
-
x: e.clientX,
|
|
3247
|
-
y: e.clientY
|
|
3248
|
-
};
|
|
3249
|
-
}
|
|
3250
|
-
}, {
|
|
3251
|
-
key: "getHtml",
|
|
3252
|
-
value: function getHtml(obj, index, parentObj) {
|
|
3253
|
-
var _this24 = this,
|
|
3254
|
-
_ref6;
|
|
3255
|
-
|
|
3256
|
-
var parent = parentObj || {};
|
|
3257
|
-
var show = typeof obj.show === 'function' ? obj.show() : obj.show;
|
|
3258
|
-
|
|
3259
|
-
if (show === false) {
|
|
3260
|
-
return null;
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
var childsAttrs = (typeof parent.childsAttrs === 'function' ? parent.childsAttrs(obj, index) : parent.childsAttrs) || {};
|
|
3264
|
-
var childsProps = (typeof parent.childsProps === 'function' ? parent.childsProps(obj, index) : parent.childsProps) || {};
|
|
3265
|
-
var parentDir = parent.row ? 'row' : 'column';
|
|
3266
|
-
var dir = obj.row ? 'row' : 'column';
|
|
3267
|
-
var gap = parent.gap === undefined ? this.gap : parent.gap;
|
|
3268
|
-
var Size = obj.size === undefined ? childsProps.size : obj.size;
|
|
3269
|
-
var size = typeof Size === 'function' ? Size() : Size;
|
|
3270
|
-
var flex = obj.flex === undefined ? childsProps.flex : obj.flex;
|
|
3271
|
-
|
|
3272
|
-
if (parentObj) {
|
|
3273
|
-
flex = flex || 1;
|
|
3274
|
-
}
|
|
3275
|
-
|
|
3276
|
-
var hideInSmall = obj.hideInSmall === undefined ? childsProps.hideInSmall : obj.hideInSmall;
|
|
3277
|
-
var hideInLarge = obj.hideInLarge === undefined ? childsProps.hideInLarge : obj.hideInLarge;
|
|
3278
|
-
var align = obj.align === undefined ? childsProps.align : obj.align;
|
|
3279
|
-
var onResize = obj.onResize;
|
|
3280
|
-
var Childs = obj[dir] || [];
|
|
3281
|
-
var childs = typeof Childs === 'function' ? Childs() : Childs;
|
|
3282
|
-
var html = typeof obj.html === 'function' ? obj.html() : obj.html;
|
|
3283
|
-
var attrs = (typeof obj.attrs === 'function' ? obj.attrs() : obj.attrs) || {};
|
|
3284
|
-
var className = childs.length ? 'r-layout-parent' : 'r-layout-item';
|
|
3285
|
-
var gapClassName = 'r-layout-gap';
|
|
3286
|
-
|
|
3287
|
-
if (childsAttrs.className) {
|
|
3288
|
-
className += ' ' + childsAttrs.className;
|
|
3289
|
-
}
|
|
3290
|
-
|
|
3291
|
-
if (attrs.className) {
|
|
3292
|
-
className += ' ' + attrs.className;
|
|
3293
|
-
}
|
|
3294
|
-
|
|
3295
|
-
if (hideInLarge) {
|
|
3296
|
-
className += ' r-layout-hide-in-large';
|
|
3297
|
-
gapClassName += ' r-layout-hide-in-large';
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
|
-
if (hideInSmall) {
|
|
3301
|
-
className += ' r-layout-hide-in-small';
|
|
3302
|
-
gapClassName += ' r-layout-hide-in-small';
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
var style = { ...childsAttrs.style,
|
|
3306
|
-
...attrs.style
|
|
3307
|
-
};
|
|
3308
|
-
|
|
3309
|
-
if (align === 'v') {
|
|
3310
|
-
style.alignItems = 'center';
|
|
3311
|
-
} else if (align === 'h') {
|
|
3312
|
-
style.justifyContent = 'center';
|
|
3313
|
-
} else if (align === 'vh' || align === 'hv') {
|
|
3314
|
-
style.alignItems = 'center';
|
|
3315
|
-
style.justifyContent = 'center';
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
|
-
var result;
|
|
3319
|
-
var dataId = 'a' + Math.random();
|
|
3320
|
-
|
|
3321
|
-
if (!childs.length) {
|
|
3322
|
-
var _ref5;
|
|
3323
|
-
|
|
3324
|
-
result = /*#__PURE__*/_react.default.createElement("div", _extends({}, childsAttrs, attrs, {
|
|
3325
|
-
"data-id": dataId,
|
|
3326
|
-
className: className,
|
|
3327
|
-
style: (_ref5 = { ...style
|
|
3328
|
-
}, _defineProperty(_ref5, parentDir === 'row' ? 'width' : 'height', size), _defineProperty(_ref5, "flex", !size ? flex : undefined), _ref5)
|
|
3329
|
-
}), html);
|
|
3330
|
-
} else {
|
|
3331
|
-
var _Style;
|
|
3332
|
-
|
|
3333
|
-
var Style = (_Style = { ...style,
|
|
3334
|
-
flexDirection: dir
|
|
3335
|
-
}, _defineProperty(_Style, parentDir === 'row' ? 'width' : 'height', size), _defineProperty(_Style, "flex", !size ? flex || 1 : undefined), _Style);
|
|
3336
|
-
result = /*#__PURE__*/_react.default.createElement("div", _extends({}, childsAttrs, attrs, {
|
|
3337
|
-
"data-id": dataId,
|
|
3338
|
-
className: className,
|
|
3339
|
-
style: Style
|
|
3340
|
-
}), childs.map(function (o, i) {
|
|
3341
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
3342
|
-
key: i
|
|
3343
|
-
}, _this24.getHtml(o, i, obj));
|
|
3344
|
-
}));
|
|
3345
|
-
}
|
|
3346
|
-
|
|
3347
|
-
var event = {},
|
|
3348
|
-
axis,
|
|
3349
|
-
cursor = '';
|
|
3350
|
-
|
|
3351
|
-
if (size && onResize) {
|
|
3352
|
-
if (parentDir === 'row') {
|
|
3353
|
-
axis = 'x';
|
|
3354
|
-
cursor = 'col-resize';
|
|
3355
|
-
} else {
|
|
3356
|
-
axis = 'y';
|
|
3357
|
-
cursor = 'row-resize';
|
|
3358
|
-
}
|
|
3359
|
-
|
|
3360
|
-
event[this.touch ? 'onTouchStart' : 'onMouseDown'] = function (e) {
|
|
3361
|
-
var pos = _this24.getClient(e);
|
|
3362
|
-
|
|
3363
|
-
_this24.so = {
|
|
3364
|
-
pos: pos,
|
|
3365
|
-
onResize: onResize,
|
|
3366
|
-
axis: axis,
|
|
3367
|
-
size: size,
|
|
3368
|
-
dataId: dataId
|
|
3369
|
-
};
|
|
3370
|
-
|
|
3371
|
-
_this24.eventHandler('mousemove', _jquery.default.proxy(_this24.mouseMove, _this24));
|
|
3372
|
-
|
|
3373
|
-
_this24.eventHandler('mouseup', _jquery.default.proxy(_this24.mouseUp, _this24));
|
|
3374
|
-
};
|
|
3375
|
-
}
|
|
3376
|
-
|
|
3377
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
3378
|
-
key: index
|
|
3379
|
-
}, result, /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
3380
|
-
className: gapClassName,
|
|
3381
|
-
draggable: false,
|
|
3382
|
-
onDragStart: function onDragStart(e) {
|
|
3383
|
-
return e.preventDefault();
|
|
3384
|
-
},
|
|
3385
|
-
style: (_ref6 = {}, _defineProperty(_ref6, {
|
|
3386
|
-
'row': 'width',
|
|
3387
|
-
'column': 'height'
|
|
3388
|
-
}[parentDir], gap), _defineProperty(_ref6, "cursor", cursor), _ref6)
|
|
3389
|
-
}, event)));
|
|
3390
|
-
}
|
|
3391
|
-
}, {
|
|
3392
|
-
key: "mouseMove",
|
|
3393
|
-
value: function mouseMove(e) {
|
|
3394
|
-
var rtl = this.props.rtl;
|
|
3395
|
-
var _this$so = this.so,
|
|
3396
|
-
pos = _this$so.pos,
|
|
3397
|
-
axis = _this$so.axis,
|
|
3398
|
-
size = _this$so.size,
|
|
3399
|
-
dataId = _this$so.dataId;
|
|
3400
|
-
var client = this.getClient(e);
|
|
3401
|
-
var offset = (client[axis] - pos[axis]) * (rtl ? -1 : 1);
|
|
3402
|
-
this.so.newSize = offset + size;
|
|
3403
|
-
var panel = (0, _jquery.default)('[data-id="' + dataId + '"]');
|
|
3404
|
-
panel.css(_defineProperty({}, {
|
|
3405
|
-
'x': 'width',
|
|
3406
|
-
'y': 'height'
|
|
3407
|
-
}[axis], this.so.newSize));
|
|
3408
|
-
}
|
|
3409
|
-
}, {
|
|
3410
|
-
key: "mouseUp",
|
|
3411
|
-
value: function mouseUp() {
|
|
3412
|
-
this.eventHandler('mousemove', this.mouseMove, 'unbind');
|
|
3413
|
-
this.eventHandler('mouseup', this.mouseUp, 'unbind');
|
|
3414
|
-
var _this$so2 = this.so,
|
|
3415
|
-
onResize = _this$so2.onResize,
|
|
3416
|
-
newSize = _this$so2.newSize;
|
|
3417
|
-
onResize(newSize);
|
|
3418
|
-
}
|
|
3419
|
-
}, {
|
|
3420
|
-
key: "render",
|
|
3421
|
-
value: function render() {
|
|
3422
|
-
var _this$props16 = this.props,
|
|
3423
|
-
gap = _this$props16.gap,
|
|
3424
|
-
layout = _this$props16.layout;
|
|
3425
|
-
this.gap = gap;
|
|
3426
|
-
return this.getHtml(layout, 0);
|
|
3427
|
-
}
|
|
3428
|
-
}]);
|
|
3429
|
-
|
|
3430
|
-
return RLayout;
|
|
3431
|
-
}(_react.Component);
|
|
3432
|
-
|
|
3433
|
-
RLayout.defaultProps = {
|
|
3434
|
-
gap: 12,
|
|
3435
|
-
layout: {}
|
|
3436
|
-
};
|
|
3210
|
+
_defineProperty(RTableFilterItem, "contextType", AioTableContext);
|