aio-table 4.0.0 → 5.0.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/README.md +351 -464
- package/index.css +9 -8
- package/index.js +454 -694
- package/package.json +1 -1
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
|
|
|
@@ -19,7 +19,7 @@ var _js = require("@mdi/js");
|
|
|
19
19
|
|
|
20
20
|
var _jquery = _interopRequireDefault(require("jquery"));
|
|
21
21
|
|
|
22
|
-
var _rRangeSlider = _interopRequireDefault(require("r-range-slider"));
|
|
22
|
+
var _rRangeSlider = _interopRequireDefault(require("./r-range-slider"));
|
|
23
23
|
|
|
24
24
|
require("./index.css");
|
|
25
25
|
|
|
@@ -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,18 @@ 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;
|
|
867
872
|
var _this$state2 = this.state,
|
|
868
873
|
groupDictionary = _this$state2.groupDictionary,
|
|
869
874
|
sorts = _this$state2.sorts,
|
|
@@ -914,16 +919,16 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
914
919
|
}
|
|
915
920
|
|
|
916
921
|
if (active === true) {
|
|
917
|
-
|
|
922
|
+
_this5.sorts.push({
|
|
918
923
|
getValue: getValue,
|
|
919
924
|
type: type
|
|
920
925
|
});
|
|
921
926
|
}
|
|
922
927
|
|
|
923
928
|
if (toggle) {
|
|
924
|
-
|
|
929
|
+
_this5.toolbar.show = true;
|
|
925
930
|
|
|
926
|
-
|
|
931
|
+
_this5.toolbar.sort.push({
|
|
927
932
|
text: title,
|
|
928
933
|
checked: active === true,
|
|
929
934
|
after: /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -935,10 +940,11 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
935
940
|
}, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
936
941
|
path: type === 'dec' ? _js.mdiArrowDown : _js.mdiArrowUp,
|
|
937
942
|
size: 0.8,
|
|
938
|
-
onClick: function onClick() {
|
|
943
|
+
onClick: function onClick(e) {
|
|
944
|
+
e.stopPropagation();
|
|
939
945
|
sort.type = sort.type === 'dec' ? 'inc' : 'dec';
|
|
940
946
|
|
|
941
|
-
|
|
947
|
+
_this5.setState({
|
|
942
948
|
sorts: sorts
|
|
943
949
|
});
|
|
944
950
|
|
|
@@ -952,7 +958,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
952
958
|
onClick: function onClick() {
|
|
953
959
|
sort.active = !active;
|
|
954
960
|
|
|
955
|
-
|
|
961
|
+
_this5.setState({
|
|
956
962
|
sorts: sorts
|
|
957
963
|
});
|
|
958
964
|
|
|
@@ -994,13 +1000,13 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
994
1000
|
groupDictionary[title] = groupDictionary[title] === undefined ? active : groupDictionary[title];
|
|
995
1001
|
|
|
996
1002
|
if (groupDictionary[title]) {
|
|
997
|
-
|
|
1003
|
+
_this5.groups.push(group);
|
|
998
1004
|
}
|
|
999
1005
|
|
|
1000
1006
|
if (toggle) {
|
|
1001
|
-
|
|
1007
|
+
_this5.toolbar.show = true;
|
|
1002
1008
|
|
|
1003
|
-
|
|
1009
|
+
_this5.toolbar.groupBy.push({
|
|
1004
1010
|
text: title,
|
|
1005
1011
|
checked: groupDictionary[title],
|
|
1006
1012
|
onClick: function onClick() {
|
|
@@ -1010,7 +1016,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1010
1016
|
localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
|
|
1011
1017
|
}
|
|
1012
1018
|
|
|
1013
|
-
|
|
1019
|
+
_this5.setState({
|
|
1014
1020
|
groupDictionary: groupDictionary
|
|
1015
1021
|
});
|
|
1016
1022
|
}
|
|
@@ -1060,29 +1066,29 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1060
1066
|
|
|
1061
1067
|
column._index = _i4;
|
|
1062
1068
|
|
|
1063
|
-
if (show !== false &&
|
|
1064
|
-
|
|
1069
|
+
if (show !== false && _this5.showColumnRelativeGroups(column)) {
|
|
1070
|
+
_this5.visibleColumns.push(column);
|
|
1065
1071
|
|
|
1066
1072
|
if (freezeMode) {
|
|
1067
1073
|
if (column.freeze) {
|
|
1068
|
-
|
|
1074
|
+
_this5.freezeMode = true;
|
|
1069
1075
|
|
|
1070
|
-
|
|
1076
|
+
_this5.freezeColumns.push(column);
|
|
1071
1077
|
} else {
|
|
1072
|
-
|
|
1078
|
+
_this5.unFreezeColumns.push(column);
|
|
1073
1079
|
}
|
|
1074
1080
|
|
|
1075
1081
|
if (column.toggleFreeze) {
|
|
1076
|
-
|
|
1082
|
+
_this5.toolbar.show = true;
|
|
1077
1083
|
|
|
1078
|
-
|
|
1084
|
+
_this5.toolbar.freeze.push({
|
|
1079
1085
|
text: column.title,
|
|
1080
1086
|
checked: column.freeze === true,
|
|
1081
1087
|
onClick: function onClick() {
|
|
1082
1088
|
column.freeze = column.freeze === true ? true : false;
|
|
1083
1089
|
column.freeze = !column.freeze;
|
|
1084
1090
|
|
|
1085
|
-
|
|
1091
|
+
_this5.setState({
|
|
1086
1092
|
columns: columns
|
|
1087
1093
|
});
|
|
1088
1094
|
}
|
|
@@ -1092,9 +1098,9 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1092
1098
|
}
|
|
1093
1099
|
|
|
1094
1100
|
if (column.toggleShow) {
|
|
1095
|
-
|
|
1101
|
+
_this5.toolbar.show = true;
|
|
1096
1102
|
|
|
1097
|
-
|
|
1103
|
+
_this5.toolbar.toggle.push({
|
|
1098
1104
|
text: column.title,
|
|
1099
1105
|
checked: show !== false,
|
|
1100
1106
|
onClick: function onClick() {
|
|
@@ -1109,7 +1115,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1109
1115
|
column.show = !column.show;
|
|
1110
1116
|
}
|
|
1111
1117
|
|
|
1112
|
-
|
|
1118
|
+
_this5.setState({
|
|
1113
1119
|
columns: columns
|
|
1114
1120
|
});
|
|
1115
1121
|
}
|
|
@@ -1117,8 +1123,8 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1117
1123
|
}
|
|
1118
1124
|
|
|
1119
1125
|
if (column.search) {
|
|
1120
|
-
|
|
1121
|
-
|
|
1126
|
+
_this5.toolbar.show = true;
|
|
1127
|
+
_this5.toolbar.searchColumnIndex = column._index;
|
|
1122
1128
|
}
|
|
1123
1129
|
};
|
|
1124
1130
|
|
|
@@ -1133,7 +1139,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1133
1139
|
}, {
|
|
1134
1140
|
key: "getPaging",
|
|
1135
1141
|
value: function getPaging() {
|
|
1136
|
-
var
|
|
1142
|
+
var _this6 = this;
|
|
1137
1143
|
|
|
1138
1144
|
var paging = this.state.paging;
|
|
1139
1145
|
|
|
@@ -1141,9 +1147,9 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1141
1147
|
return null;
|
|
1142
1148
|
}
|
|
1143
1149
|
|
|
1144
|
-
var _this$
|
|
1145
|
-
rtl = _this$
|
|
1146
|
-
translate = _this$
|
|
1150
|
+
var _this$props6 = this.props,
|
|
1151
|
+
rtl = _this$props6.rtl,
|
|
1152
|
+
translate = _this$props6.translate;
|
|
1147
1153
|
var number = paging.number,
|
|
1148
1154
|
_paging$sizes = paging.sizes,
|
|
1149
1155
|
sizes = _paging$sizes === void 0 ? [1, 5, 10, 20, 30, 40, 50, 60, 70, 80] : _paging$sizes,
|
|
@@ -1152,6 +1158,8 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1152
1158
|
pages = _paging$pages === void 0 ? 1 : _paging$pages;
|
|
1153
1159
|
|
|
1154
1160
|
var changePage = function changePage(type) {
|
|
1161
|
+
var _paging$pages2 = paging.pages,
|
|
1162
|
+
pages = _paging$pages2 === void 0 ? 1 : _paging$pages2;
|
|
1155
1163
|
var newNumber;
|
|
1156
1164
|
|
|
1157
1165
|
if (type === 'prev') {
|
|
@@ -1178,7 +1186,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1178
1186
|
|
|
1179
1187
|
paging.number = newNumber;
|
|
1180
1188
|
|
|
1181
|
-
|
|
1189
|
+
_this6.setState({
|
|
1182
1190
|
paging: paging
|
|
1183
1191
|
});
|
|
1184
1192
|
|
|
@@ -1236,7 +1244,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1236
1244
|
onChange: function onChange(e) {
|
|
1237
1245
|
paging.size = parseInt(e.target.value);
|
|
1238
1246
|
|
|
1239
|
-
|
|
1247
|
+
_this6.setState({
|
|
1240
1248
|
paging: paging
|
|
1241
1249
|
});
|
|
1242
1250
|
|
|
@@ -1358,7 +1366,7 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1358
1366
|
}, {
|
|
1359
1367
|
key: "render",
|
|
1360
1368
|
value: function render() {
|
|
1361
|
-
var
|
|
1369
|
+
var _this7 = this;
|
|
1362
1370
|
|
|
1363
1371
|
if (JSON.stringify(this.props.columns) !== JSON.stringify(this.state.columns)) {
|
|
1364
1372
|
this.setState({
|
|
@@ -1372,20 +1380,21 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1372
1380
|
}); //return null;
|
|
1373
1381
|
}
|
|
1374
1382
|
|
|
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$
|
|
1383
|
+
var _this$props7 = this.props,
|
|
1384
|
+
rowHeight = _this$props7.rowHeight,
|
|
1385
|
+
headerHeight = _this$props7.headerHeight,
|
|
1386
|
+
toolbarHeight = _this$props7.toolbarHeight,
|
|
1387
|
+
rowGap = _this$props7.rowGap,
|
|
1388
|
+
className = _this$props7.className,
|
|
1389
|
+
columnGap = _this$props7.columnGap,
|
|
1390
|
+
rtl = _this$props7.rtl,
|
|
1391
|
+
style = _this$props7.style,
|
|
1392
|
+
_this$props7$attrs = _this$props7.attrs,
|
|
1393
|
+
attrs = _this$props7$attrs === void 0 ? {} : _this$props7$attrs,
|
|
1394
|
+
cardTemplate = _this$props7.cardTemplate,
|
|
1395
|
+
onChangeFilter = _this$props7.onChangeFilter,
|
|
1396
|
+
onSwap = _this$props7.onSwap,
|
|
1397
|
+
padding = _this$props7.padding;
|
|
1389
1398
|
var columns = this.state.columns;
|
|
1390
1399
|
this.rh = rowHeight;
|
|
1391
1400
|
this.hh = headerHeight;
|
|
@@ -1393,28 +1402,28 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1393
1402
|
this.rg = rowGap;
|
|
1394
1403
|
this.cg = columnGap;
|
|
1395
1404
|
this.updateColumns();
|
|
1396
|
-
var Paging = this.getPaging();
|
|
1397
1405
|
var Toolbar = this.toolbar.show ? /*#__PURE__*/_react.default.createElement(RTableToolbar, this.toolbar) : null;
|
|
1398
|
-
var table = columns ? this.getTable(
|
|
1406
|
+
var table = columns ? this.getTable(Toolbar) : '';
|
|
1407
|
+
var Paging = this.getPaging();
|
|
1399
1408
|
var context = { ...this.props,
|
|
1400
1409
|
...this.state,
|
|
1401
1410
|
touch: this.touch,
|
|
1402
1411
|
onDrag: function onDrag(obj) {
|
|
1403
|
-
return
|
|
1412
|
+
return _this7.dragStart = obj;
|
|
1404
1413
|
},
|
|
1405
1414
|
onDrop: function onDrop(obj) {
|
|
1406
|
-
if (!
|
|
1415
|
+
if (!_this7.dragStart) {
|
|
1407
1416
|
return;
|
|
1408
1417
|
}
|
|
1409
1418
|
|
|
1410
|
-
if (
|
|
1419
|
+
if (_this7.dragStart._level !== obj._level) {
|
|
1411
1420
|
return;
|
|
1412
1421
|
}
|
|
1413
1422
|
|
|
1414
|
-
if (
|
|
1415
|
-
onSwap(
|
|
1423
|
+
if (_this7.dragStart._level === 0) {
|
|
1424
|
+
onSwap(_this7.dragStart, obj);
|
|
1416
1425
|
} else {
|
|
1417
|
-
var startParents =
|
|
1426
|
+
var startParents = _this7.dragStart._getParents().map(function (o) {
|
|
1418
1427
|
return o._index;
|
|
1419
1428
|
}).toString();
|
|
1420
1429
|
|
|
@@ -1426,12 +1435,12 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1426
1435
|
return;
|
|
1427
1436
|
}
|
|
1428
1437
|
|
|
1429
|
-
onSwap(
|
|
1438
|
+
onSwap(_this7.dragStart, obj);
|
|
1430
1439
|
}
|
|
1431
1440
|
},
|
|
1432
1441
|
onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
|
|
1433
1442
|
SetState: function SetState(obj) {
|
|
1434
|
-
return
|
|
1443
|
+
return _this7.setState(obj);
|
|
1435
1444
|
},
|
|
1436
1445
|
cubes2: this.cubes2.bind(this),
|
|
1437
1446
|
toggleRow: this.toggleRow.bind(this),
|
|
@@ -1448,21 +1457,24 @@ var RTable = /*#__PURE__*/function (_Component) {
|
|
|
1448
1457
|
className: 'aio-table' + (className ? ' ' + className : '') + (rtl ? ' rtl' : ''),
|
|
1449
1458
|
tabIndex: 0,
|
|
1450
1459
|
ref: this.dom,
|
|
1451
|
-
style: style
|
|
1460
|
+
style: { ...style,
|
|
1461
|
+
padding: padding
|
|
1462
|
+
}
|
|
1452
1463
|
}, attrs), Toolbar, !cardTemplate && this.visibleColumns.length === 0 && this.getLoading(), table, Paging));
|
|
1453
1464
|
}
|
|
1454
1465
|
}]);
|
|
1455
1466
|
|
|
1456
|
-
return
|
|
1467
|
+
return AIOTable;
|
|
1457
1468
|
}(_react.Component);
|
|
1458
1469
|
|
|
1459
|
-
exports.default =
|
|
1460
|
-
|
|
1470
|
+
exports.default = AIOTable;
|
|
1471
|
+
AIOTable.defaultProps = {
|
|
1461
1472
|
columns: [],
|
|
1462
1473
|
headerHeight: 36,
|
|
1463
1474
|
rowHeight: 36,
|
|
1464
1475
|
toolbarHeight: 36,
|
|
1465
1476
|
rowGap: 6,
|
|
1477
|
+
padding: 12,
|
|
1466
1478
|
indent: 20,
|
|
1467
1479
|
translate: function translate(text) {
|
|
1468
1480
|
return text;
|
|
@@ -1486,7 +1498,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1486
1498
|
_createClass(RTableToolbar, [{
|
|
1487
1499
|
key: "changeSearch",
|
|
1488
1500
|
value: function changeSearch(value) {
|
|
1489
|
-
var
|
|
1501
|
+
var _this8 = this;
|
|
1490
1502
|
|
|
1491
1503
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
1492
1504
|
var SetState = this.context.SetState;
|
|
@@ -1495,10 +1507,10 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1495
1507
|
searchText: value
|
|
1496
1508
|
});
|
|
1497
1509
|
this.searchTimeout = setTimeout(function () {
|
|
1498
|
-
var
|
|
1499
|
-
filterDictionary =
|
|
1500
|
-
SetState =
|
|
1501
|
-
var searchColumnIndex =
|
|
1510
|
+
var _this8$context = _this8.context,
|
|
1511
|
+
filterDictionary = _this8$context.filterDictionary,
|
|
1512
|
+
SetState = _this8$context.SetState;
|
|
1513
|
+
var searchColumnIndex = _this8.props.searchColumnIndex;
|
|
1502
1514
|
filterDictionary[searchColumnIndex] = {
|
|
1503
1515
|
items: value ? [{
|
|
1504
1516
|
operator: 'contain',
|
|
@@ -1514,35 +1526,41 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1514
1526
|
}, {
|
|
1515
1527
|
key: "render",
|
|
1516
1528
|
value: function render() {
|
|
1517
|
-
var
|
|
1529
|
+
var _this9 = this;
|
|
1518
1530
|
|
|
1519
1531
|
var _this$context = this.context,
|
|
1520
1532
|
searchText = _this$context.searchText,
|
|
1521
1533
|
translate = _this$context.translate,
|
|
1522
1534
|
rtl = _this$context.rtl,
|
|
1523
|
-
toggleAllState = _this$context.toggleAllState
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1535
|
+
toggleAllState = _this$context.toggleAllState,
|
|
1536
|
+
padding = _this$context.padding;
|
|
1537
|
+
var _this$props8 = this.props,
|
|
1538
|
+
toggle = _this$props8.toggle,
|
|
1539
|
+
freeze = _this$props8.freeze,
|
|
1540
|
+
groupBy = _this$props8.groupBy,
|
|
1541
|
+
sort = _this$props8.sort,
|
|
1542
|
+
searchColumnIndex = _this$props8.searchColumnIndex,
|
|
1543
|
+
toggleAll = _this$props8.toggleAll;
|
|
1531
1544
|
var buttonProps = {
|
|
1545
|
+
type: 'select',
|
|
1546
|
+
caret: false,
|
|
1532
1547
|
rtl: rtl,
|
|
1533
1548
|
className: 'aio-table-toolbar-button',
|
|
1534
1549
|
animate: true
|
|
1535
1550
|
};
|
|
1536
1551
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1537
|
-
className: "aio-table-toolbar"
|
|
1538
|
-
|
|
1552
|
+
className: "aio-table-toolbar",
|
|
1553
|
+
style: {
|
|
1554
|
+
marginBottom: padding
|
|
1555
|
+
}
|
|
1556
|
+
}, toggleAll !== false && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1539
1557
|
key: 0
|
|
1540
1558
|
}, buttonProps, {
|
|
1541
1559
|
title: translate('Toggle All'),
|
|
1542
1560
|
onClick: function onClick() {
|
|
1543
1561
|
return toggleAll();
|
|
1544
1562
|
},
|
|
1545
|
-
|
|
1563
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1546
1564
|
path: !toggleAllState ? _js.mdiCollapseAll : _js.mdiExpandAll,
|
|
1547
1565
|
size: 0.7
|
|
1548
1566
|
})
|
|
@@ -1555,7 +1573,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1555
1573
|
value: searchText,
|
|
1556
1574
|
placeholder: translate('Search'),
|
|
1557
1575
|
onChange: function onChange(e) {
|
|
1558
|
-
return
|
|
1576
|
+
return _this9.changeSearch(e.target.value);
|
|
1559
1577
|
}
|
|
1560
1578
|
}), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1561
1579
|
className: "aio-table-search-icon",
|
|
@@ -1566,49 +1584,49 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
|
|
|
1566
1584
|
return;
|
|
1567
1585
|
}
|
|
1568
1586
|
|
|
1569
|
-
|
|
1587
|
+
_this9.changeSearch('', 0);
|
|
1570
1588
|
}
|
|
1571
1589
|
})), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
|
|
1572
1590
|
style: {
|
|
1573
1591
|
flex: 1
|
|
1574
1592
|
}
|
|
1575
|
-
}), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1593
|
+
}), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1576
1594
|
key: 2
|
|
1577
1595
|
}, buttonProps, {
|
|
1578
|
-
|
|
1596
|
+
options: groupBy,
|
|
1579
1597
|
title: translate('Group By'),
|
|
1580
|
-
|
|
1598
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1581
1599
|
path: _js.mdiFileTree,
|
|
1582
1600
|
size: 0.7,
|
|
1583
1601
|
horizontal: rtl === true
|
|
1584
1602
|
})
|
|
1585
|
-
})), sort.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1603
|
+
})), sort.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1586
1604
|
key: 3
|
|
1587
1605
|
}, buttonProps, {
|
|
1588
|
-
|
|
1606
|
+
options: sort,
|
|
1589
1607
|
title: translate('Sort'),
|
|
1590
|
-
|
|
1608
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1591
1609
|
path: _js.mdiSort,
|
|
1592
1610
|
size: 0.7
|
|
1593
1611
|
})
|
|
1594
|
-
})), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1612
|
+
})), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1595
1613
|
key: 4
|
|
1596
1614
|
}, buttonProps, {
|
|
1597
|
-
|
|
1615
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1598
1616
|
path: _js.mdiEye,
|
|
1599
1617
|
size: 0.7
|
|
1600
1618
|
}),
|
|
1601
|
-
|
|
1619
|
+
options: toggle,
|
|
1602
1620
|
title: translate('Show Columns')
|
|
1603
|
-
})), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(
|
|
1621
|
+
})), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
|
|
1604
1622
|
key: 5
|
|
1605
1623
|
}, buttonProps, {
|
|
1606
|
-
|
|
1624
|
+
text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
1607
1625
|
path: _js.mdiAlignHorizontalLeft,
|
|
1608
1626
|
size: 0.7,
|
|
1609
1627
|
horizontal: rtl === true
|
|
1610
1628
|
}),
|
|
1611
|
-
|
|
1629
|
+
options: freeze,
|
|
1612
1630
|
title: translate('Freeze Columns')
|
|
1613
1631
|
})));
|
|
1614
1632
|
}
|
|
@@ -1625,34 +1643,36 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1625
1643
|
var _super3 = _createSuper(RTableUnit);
|
|
1626
1644
|
|
|
1627
1645
|
function RTableUnit(props) {
|
|
1628
|
-
var
|
|
1646
|
+
var _this10;
|
|
1629
1647
|
|
|
1630
1648
|
_classCallCheck(this, RTableUnit);
|
|
1631
1649
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
return
|
|
1650
|
+
_this10 = _super3.call(this, props);
|
|
1651
|
+
_this10.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
1652
|
+
return _this10;
|
|
1635
1653
|
}
|
|
1636
1654
|
|
|
1637
1655
|
_createClass(RTableUnit, [{
|
|
1638
1656
|
key: "getNoData",
|
|
1639
1657
|
value: function getNoData() {
|
|
1640
|
-
var
|
|
1658
|
+
var _this$context2 = this.context,
|
|
1659
|
+
rowHeight = _this$context2.rowHeight,
|
|
1660
|
+
translate = _this$context2.translate;
|
|
1641
1661
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1642
1662
|
className: "aio-table-nodata",
|
|
1643
1663
|
style: { ...this.getFullCellStyle(),
|
|
1644
1664
|
height: rowHeight
|
|
1645
1665
|
}
|
|
1646
|
-
},
|
|
1666
|
+
}, translate('No Data'));
|
|
1647
1667
|
}
|
|
1648
1668
|
}, {
|
|
1649
1669
|
key: "getGroupToggleIcon",
|
|
1650
1670
|
value: function getGroupToggleIcon(row) {
|
|
1651
|
-
var _this$
|
|
1652
|
-
rtl = _this$
|
|
1653
|
-
SetState = _this$
|
|
1654
|
-
groupsOpen = _this$
|
|
1655
|
-
getGap = _this$
|
|
1671
|
+
var _this$context3 = this.context,
|
|
1672
|
+
rtl = _this$context3.rtl,
|
|
1673
|
+
SetState = _this$context3.SetState,
|
|
1674
|
+
groupsOpen = _this$context3.groupsOpen,
|
|
1675
|
+
getGap = _this$context3.getGap;
|
|
1656
1676
|
var icon;
|
|
1657
1677
|
|
|
1658
1678
|
if (row._opened) {
|
|
@@ -1668,12 +1688,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1668
1688
|
});
|
|
1669
1689
|
}
|
|
1670
1690
|
|
|
1671
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1691
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1672
1692
|
className: "aio-table-toggle",
|
|
1673
1693
|
onClick: function onClick() {
|
|
1674
|
-
var
|
|
1675
|
-
|
|
1676
|
-
groupsOpen[_parentField + _groupField] = !groupsOpen[_parentField + _groupField];
|
|
1694
|
+
var _groupId = row._groupId;
|
|
1695
|
+
groupsOpen[_groupId] = !groupsOpen[_groupId];
|
|
1677
1696
|
SetState({
|
|
1678
1697
|
groupsOpen: groupsOpen
|
|
1679
1698
|
});
|
|
@@ -1692,12 +1711,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1692
1711
|
}, {
|
|
1693
1712
|
key: "getStyle",
|
|
1694
1713
|
value: function getStyle() {
|
|
1695
|
-
var _this$
|
|
1696
|
-
rowGap = _this$
|
|
1697
|
-
columnGap = _this$
|
|
1698
|
-
var _this$
|
|
1699
|
-
columns = _this$
|
|
1700
|
-
style = _this$
|
|
1714
|
+
var _this$context4 = this.context,
|
|
1715
|
+
rowGap = _this$context4.rowGap,
|
|
1716
|
+
columnGap = _this$context4.columnGap;
|
|
1717
|
+
var _this$props9 = this.props,
|
|
1718
|
+
columns = _this$props9.columns,
|
|
1719
|
+
style = _this$props9.style;
|
|
1701
1720
|
var gridTemplateColumns = '';
|
|
1702
1721
|
this.gridTemplateColumns = [];
|
|
1703
1722
|
|
|
@@ -1724,19 +1743,19 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1724
1743
|
}, {
|
|
1725
1744
|
key: "getTitles",
|
|
1726
1745
|
value: function getTitles() {
|
|
1727
|
-
var
|
|
1746
|
+
var _this11 = this;
|
|
1728
1747
|
|
|
1729
1748
|
var columns = this.props.columns;
|
|
1730
1749
|
return columns.map(function (column) {
|
|
1731
|
-
return
|
|
1750
|
+
return _this11.getTitle(column);
|
|
1732
1751
|
});
|
|
1733
1752
|
}
|
|
1734
1753
|
}, {
|
|
1735
1754
|
key: "getGanttTitle",
|
|
1736
1755
|
value: function getGanttTitle(column) {
|
|
1737
|
-
var _this$
|
|
1738
|
-
headerHeight = _this$
|
|
1739
|
-
columnGap = _this$
|
|
1756
|
+
var _this$context5 = this.context,
|
|
1757
|
+
headerHeight = _this$context5.headerHeight,
|
|
1758
|
+
columnGap = _this$context5.columnGap;
|
|
1740
1759
|
var getKeys = column.getKeys,
|
|
1741
1760
|
_column$padding = column.padding,
|
|
1742
1761
|
padding = _column$padding === void 0 ? '36px' : _column$padding;
|
|
@@ -1754,38 +1773,42 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1754
1773
|
}, /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
1755
1774
|
start: 0,
|
|
1756
1775
|
end: keys.length - 1,
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1776
|
+
labelStep: 1,
|
|
1777
|
+
editLabel: function editLabel(value) {
|
|
1778
|
+
return keys[value];
|
|
1779
|
+
},
|
|
1780
|
+
labelStyle: function labelStyle() {
|
|
1781
|
+
return {
|
|
1763
1782
|
top: 0
|
|
1764
|
-
}
|
|
1783
|
+
};
|
|
1765
1784
|
},
|
|
1766
|
-
pointStyle: {
|
|
1767
|
-
|
|
1785
|
+
pointStyle: function pointStyle() {
|
|
1786
|
+
return {
|
|
1787
|
+
display: 'none'
|
|
1788
|
+
};
|
|
1768
1789
|
},
|
|
1769
|
-
lineStyle: {
|
|
1770
|
-
|
|
1790
|
+
lineStyle: function lineStyle() {
|
|
1791
|
+
return {
|
|
1792
|
+
display: 'none'
|
|
1793
|
+
};
|
|
1771
1794
|
}
|
|
1772
1795
|
}));
|
|
1773
1796
|
}
|
|
1774
1797
|
}, {
|
|
1775
1798
|
key: "getTitle",
|
|
1776
1799
|
value: function getTitle(column) {
|
|
1777
|
-
var
|
|
1800
|
+
var _this12 = this;
|
|
1778
1801
|
|
|
1779
1802
|
if (column.template === 'gantt') {
|
|
1780
1803
|
return this.getGanttTitle(column);
|
|
1781
1804
|
}
|
|
1782
1805
|
|
|
1783
|
-
var _this$
|
|
1784
|
-
SetState = _this$
|
|
1785
|
-
columns = _this$
|
|
1786
|
-
headerHeight = _this$
|
|
1787
|
-
columnGap = _this$
|
|
1788
|
-
touch = _this$
|
|
1806
|
+
var _this$context6 = this.context,
|
|
1807
|
+
SetState = _this$context6.SetState,
|
|
1808
|
+
columns = _this$context6.columns,
|
|
1809
|
+
headerHeight = _this$context6.headerHeight,
|
|
1810
|
+
columnGap = _this$context6.columnGap,
|
|
1811
|
+
touch = _this$context6.touch;
|
|
1789
1812
|
var props = {
|
|
1790
1813
|
style: {
|
|
1791
1814
|
height: headerHeight,
|
|
@@ -1805,7 +1828,7 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1805
1828
|
},
|
|
1806
1829
|
draggable: false
|
|
1807
1830
|
}, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
|
|
1808
|
-
return column.resizable ?
|
|
1831
|
+
return column.resizable ? _this12.resizeDown(e, column) : undefined;
|
|
1809
1832
|
});
|
|
1810
1833
|
|
|
1811
1834
|
var titleProps = {
|
|
@@ -1816,24 +1839,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1816
1839
|
},
|
|
1817
1840
|
draggable: column.movable !== false,
|
|
1818
1841
|
onDragStart: function onDragStart(e) {
|
|
1819
|
-
|
|
1842
|
+
_this12.startColumnSwap = column._index;
|
|
1820
1843
|
},
|
|
1821
1844
|
onDragOver: function onDragOver(e) {
|
|
1822
1845
|
e.preventDefault();
|
|
1823
|
-
|
|
1846
|
+
_this12.endColumnSwap = column._index;
|
|
1824
1847
|
},
|
|
1825
1848
|
onDrop: function onDrop(e) {
|
|
1826
1849
|
if (column.movable === false) {
|
|
1827
1850
|
return;
|
|
1828
1851
|
}
|
|
1829
1852
|
|
|
1830
|
-
if (
|
|
1853
|
+
if (_this12.startColumnSwap === undefined || _this12.startColumnSwap === _this12.endColumnSwap) {
|
|
1831
1854
|
return;
|
|
1832
1855
|
}
|
|
1833
1856
|
|
|
1834
|
-
var temp = columns[
|
|
1835
|
-
columns[
|
|
1836
|
-
columns[
|
|
1857
|
+
var temp = columns[_this12.startColumnSwap];
|
|
1858
|
+
columns[_this12.startColumnSwap] = columns[_this12.endColumnSwap];
|
|
1859
|
+
columns[_this12.endColumnSwap] = temp;
|
|
1837
1860
|
SetState({
|
|
1838
1861
|
columns: columns
|
|
1839
1862
|
});
|
|
@@ -1846,9 +1869,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1846
1869
|
}, {
|
|
1847
1870
|
key: "resizeDown",
|
|
1848
1871
|
value: function resizeDown(e, column) {
|
|
1849
|
-
var _this$
|
|
1850
|
-
touch = _this$
|
|
1851
|
-
getClient = _this$
|
|
1872
|
+
var _this$context7 = this.context,
|
|
1873
|
+
touch = _this$context7.touch,
|
|
1874
|
+
getClient = _this$context7.getClient;
|
|
1852
1875
|
(0, _jquery.default)(window).bind(touch ? 'touchmove' : 'mousemove', _jquery.default.proxy(this.resizeMove, this));
|
|
1853
1876
|
(0, _jquery.default)(window).bind(touch ? 'touchend' : 'mouseup', _jquery.default.proxy(this.resizeUp, this));
|
|
1854
1877
|
this.resizeDetails = {
|
|
@@ -1862,9 +1885,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1862
1885
|
}, {
|
|
1863
1886
|
key: "resizeMove",
|
|
1864
1887
|
value: function resizeMove(e) {
|
|
1865
|
-
var _this$
|
|
1866
|
-
rtl = _this$
|
|
1867
|
-
getClient = _this$
|
|
1888
|
+
var _this$context8 = this.context,
|
|
1889
|
+
rtl = _this$context8.rtl,
|
|
1890
|
+
getClient = _this$context8.getClient;
|
|
1868
1891
|
var Client = getClient(e);
|
|
1869
1892
|
var _this$resizeDetails2 = this.resizeDetails,
|
|
1870
1893
|
client = _this$resizeDetails2.client,
|
|
@@ -1891,9 +1914,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1891
1914
|
var touch = this.context.touch;
|
|
1892
1915
|
(0, _jquery.default)(window).unbind(touch ? 'touchmove' : 'mousemove', this.resizeMove);
|
|
1893
1916
|
(0, _jquery.default)(window).unbind(touch ? 'touchend' : 'mouseup', this.resizeUp);
|
|
1894
|
-
var _this$
|
|
1895
|
-
columns = _this$
|
|
1896
|
-
SetState = _this$
|
|
1917
|
+
var _this$context9 = this.context,
|
|
1918
|
+
columns = _this$context9.columns,
|
|
1919
|
+
SetState = _this$context9.SetState;
|
|
1897
1920
|
var _this$resizeDetails3 = this.resizeDetails,
|
|
1898
1921
|
index = _this$resizeDetails3.index,
|
|
1899
1922
|
newWidth = _this$resizeDetails3.newWidth;
|
|
@@ -1927,10 +1950,10 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
1927
1950
|
key: "arrow",
|
|
1928
1951
|
value: function arrow(e) {
|
|
1929
1952
|
var container = (0, _jquery.default)(this.dom.current);
|
|
1930
|
-
var _this$
|
|
1931
|
-
rtl = _this$
|
|
1932
|
-
focused = _this$
|
|
1933
|
-
SetState = _this$
|
|
1953
|
+
var _this$context10 = this.context,
|
|
1954
|
+
rtl = _this$context10.rtl,
|
|
1955
|
+
focused = _this$context10.focused,
|
|
1956
|
+
SetState = _this$context10.SetState;
|
|
1934
1957
|
var columns = this.props.columns;
|
|
1935
1958
|
var inputs = container.find('.aio-table-input');
|
|
1936
1959
|
|
|
@@ -2014,28 +2037,26 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2014
2037
|
}, {
|
|
2015
2038
|
key: "card",
|
|
2016
2039
|
value: function card() {
|
|
2017
|
-
var
|
|
2040
|
+
var _this13 = this;
|
|
2018
2041
|
|
|
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;
|
|
2042
|
+
var _this$context11 = this.context,
|
|
2043
|
+
indent = _this$context11.indent,
|
|
2044
|
+
_onMouseEnter = _this$context11.onMouseEnter,
|
|
2045
|
+
_onScroll = _this$context11.onScroll,
|
|
2046
|
+
rowHeight = _this$context11.rowHeight,
|
|
2047
|
+
_this$context11$cardG = _this$context11.cardGap,
|
|
2048
|
+
cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
|
|
2049
|
+
getLoading = _this$context11.getLoading,
|
|
2050
|
+
cardTemplate = _this$context11.cardTemplate,
|
|
2051
|
+
_this$context11$cardR = _this$context11.cardRowCount,
|
|
2052
|
+
cardRowCount = _this$context11$cardR === void 0 ? 1 : _this$context11$cardR,
|
|
2053
|
+
rowGap = _this$context11.rowGap,
|
|
2054
|
+
columnGap = _this$context11.columnGap,
|
|
2055
|
+
toggleRow = _this$context11.toggleRow;
|
|
2056
|
+
var _this$props10 = this.props,
|
|
2057
|
+
rows = _this$props10.rows,
|
|
2058
|
+
id = _this$props10.id,
|
|
2059
|
+
index = _this$props10.index;
|
|
2039
2060
|
var groupStyle = {
|
|
2040
2061
|
gridColumnStart: 1,
|
|
2041
2062
|
gridColumnEnd: cardRowCount + 1,
|
|
@@ -2068,30 +2089,20 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2068
2089
|
return _onScroll(e, index);
|
|
2069
2090
|
}
|
|
2070
2091
|
}, rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2071
|
-
if (row.
|
|
2092
|
+
if (row._groupId) {
|
|
2072
2093
|
var width = indent * row._level;
|
|
2073
2094
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2074
2095
|
className: "aio-table-group",
|
|
2075
2096
|
key: 'group' + i + '-' + index,
|
|
2076
2097
|
style: groupStyle
|
|
2077
|
-
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2098
|
+
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2078
2099
|
style: {
|
|
2079
2100
|
width: width,
|
|
2080
2101
|
flexShrink: 0
|
|
2081
2102
|
}
|
|
2082
|
-
}),
|
|
2103
|
+
}), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2083
2104
|
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
|
-
}));
|
|
2105
|
+
}, row._groupValue)));
|
|
2095
2106
|
}
|
|
2096
2107
|
|
|
2097
2108
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -2105,25 +2116,25 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2105
2116
|
}, {
|
|
2106
2117
|
key: "render",
|
|
2107
2118
|
value: function render() {
|
|
2108
|
-
var
|
|
2119
|
+
var _this14 = this;
|
|
2109
2120
|
|
|
2110
2121
|
if (this.context.cardTemplate) {
|
|
2111
2122
|
return this.card();
|
|
2112
2123
|
}
|
|
2113
2124
|
|
|
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$
|
|
2125
|
+
var _this$context12 = this.context,
|
|
2126
|
+
indent = _this$context12.indent,
|
|
2127
|
+
_onMouseEnter2 = _this$context12.onMouseEnter,
|
|
2128
|
+
_onScroll2 = _this$context12.onScroll,
|
|
2129
|
+
rowHeight = _this$context12.rowHeight,
|
|
2130
|
+
groups = _this$context12.groups,
|
|
2131
|
+
getLoading = _this$context12.getLoading,
|
|
2132
|
+
cardTemplate = _this$context12.cardTemplate;
|
|
2133
|
+
var _this$props11 = this.props,
|
|
2134
|
+
rows = _this$props11.rows,
|
|
2135
|
+
id = _this$props11.id,
|
|
2136
|
+
index = _this$props11.index,
|
|
2137
|
+
type = _this$props11.type;
|
|
2127
2138
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2128
2139
|
id: id,
|
|
2129
2140
|
tabIndex: 0,
|
|
@@ -2141,52 +2152,31 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
|
|
|
2141
2152
|
return _onScroll2(e, index);
|
|
2142
2153
|
}
|
|
2143
2154
|
}, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
|
|
2144
|
-
if (row.
|
|
2155
|
+
if (row._groupId) {
|
|
2145
2156
|
var width = indent * row._level;
|
|
2146
2157
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2147
2158
|
className: "aio-table-group",
|
|
2148
2159
|
key: 'group' + i + '-' + index,
|
|
2149
|
-
style: { ...
|
|
2160
|
+
style: { ..._this14.getFullCellStyle(),
|
|
2150
2161
|
height: rowHeight
|
|
2151
2162
|
}
|
|
2152
|
-
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2163
|
+
}, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2153
2164
|
style: {
|
|
2154
2165
|
width: width,
|
|
2155
2166
|
flexShrink: 0
|
|
2156
2167
|
}
|
|
2157
|
-
}),
|
|
2168
|
+
}), _this14.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
|
|
2158
2169
|
className: "aio-table-group-text"
|
|
2159
|
-
}, row.
|
|
2170
|
+
}, row._groupValue)));
|
|
2160
2171
|
}
|
|
2161
2172
|
|
|
2162
|
-
|
|
2163
|
-
|
|
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
|
-
});
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
return row.cells.map(function (r, j) {
|
|
2173
|
+
return row[type].map(function (r, j) {
|
|
2174
|
+
var id = i + '-' + j + '-' + index;
|
|
2185
2175
|
return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
|
|
2186
|
-
key:
|
|
2187
|
-
cellId:
|
|
2176
|
+
key: id,
|
|
2177
|
+
cellId: id
|
|
2188
2178
|
}, r, {
|
|
2189
|
-
|
|
2179
|
+
row: row.row
|
|
2190
2180
|
}));
|
|
2191
2181
|
});
|
|
2192
2182
|
}), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
|
|
@@ -2204,19 +2194,19 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2204
2194
|
var _super4 = _createSuper(AIOTableCell);
|
|
2205
2195
|
|
|
2206
2196
|
function AIOTableCell(props) {
|
|
2207
|
-
var
|
|
2197
|
+
var _this15;
|
|
2208
2198
|
|
|
2209
2199
|
_classCallCheck(this, AIOTableCell);
|
|
2210
2200
|
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
var value =
|
|
2214
|
-
|
|
2201
|
+
_this15 = _super4.call(this, props);
|
|
2202
|
+
_this15.dom = /*#__PURE__*/(0, _react.createRef)();
|
|
2203
|
+
var value = _this15.props.value;
|
|
2204
|
+
_this15.state = {
|
|
2215
2205
|
value: value,
|
|
2216
2206
|
error: false,
|
|
2217
2207
|
prevValue: value
|
|
2218
2208
|
};
|
|
2219
|
-
return
|
|
2209
|
+
return _this15;
|
|
2220
2210
|
}
|
|
2221
2211
|
|
|
2222
2212
|
_createClass(AIOTableCell, [{
|
|
@@ -2227,7 +2217,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2227
2217
|
}
|
|
2228
2218
|
|
|
2229
2219
|
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", {
|
|
2220
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2231
2221
|
className: "aio-table-icon"
|
|
2232
2222
|
}, before), this.context.getGap());
|
|
2233
2223
|
}
|
|
@@ -2239,7 +2229,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2239
2229
|
}
|
|
2240
2230
|
|
|
2241
2231
|
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", {
|
|
2232
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2243
2233
|
style: {
|
|
2244
2234
|
flex: 1
|
|
2245
2235
|
}
|
|
@@ -2271,7 +2261,6 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2271
2261
|
}, {
|
|
2272
2262
|
key: "getClassName",
|
|
2273
2263
|
value: function getClassName(row, column) {
|
|
2274
|
-
var relativeFilter = this.props.relativeFilter;
|
|
2275
2264
|
var className = 'aio-table-cell';
|
|
2276
2265
|
|
|
2277
2266
|
if (column.template) {
|
|
@@ -2290,7 +2279,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2290
2279
|
className += ' aio-table-cell-input';
|
|
2291
2280
|
}
|
|
2292
2281
|
|
|
2293
|
-
if (relativeFilter) {
|
|
2282
|
+
if (row._show === 'relativeFilter') {
|
|
2294
2283
|
className += ' aio-table-relative-filter';
|
|
2295
2284
|
}
|
|
2296
2285
|
|
|
@@ -2299,9 +2288,9 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2299
2288
|
}, {
|
|
2300
2289
|
key: "getToggleIcon",
|
|
2301
2290
|
value: function getToggleIcon(row) {
|
|
2302
|
-
var _this$
|
|
2303
|
-
rtl = _this$
|
|
2304
|
-
toggleRow = _this$
|
|
2291
|
+
var _this$context13 = this.context,
|
|
2292
|
+
rtl = _this$context13.rtl,
|
|
2293
|
+
toggleRow = _this$context13.toggleRow;
|
|
2305
2294
|
var icon;
|
|
2306
2295
|
|
|
2307
2296
|
if (!row._childsLength) {
|
|
@@ -2322,7 +2311,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2322
2311
|
});
|
|
2323
2312
|
}
|
|
2324
2313
|
|
|
2325
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2314
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
2326
2315
|
className: "aio-table-toggle",
|
|
2327
2316
|
onClick: function onClick() {
|
|
2328
2317
|
return toggleRow(row);
|
|
@@ -2399,50 +2388,54 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2399
2388
|
var flags = getFlags();
|
|
2400
2389
|
content = /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
2401
2390
|
start: 0,
|
|
2402
|
-
editValue: function editValue(
|
|
2403
|
-
var value = _ref.value;
|
|
2391
|
+
editValue: function editValue(value) {
|
|
2404
2392
|
return keys[value];
|
|
2405
2393
|
},
|
|
2406
2394
|
end: keys.length - 1,
|
|
2407
|
-
points: [
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2395
|
+
points: [startIndex, endIndex],
|
|
2396
|
+
fillStyle: function fillStyle(index) {
|
|
2397
|
+
if (index === 1) {
|
|
2398
|
+
return {
|
|
2399
|
+
background: backgroundColor,
|
|
2400
|
+
backgroundImage: background
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
getText: function getText(index) {
|
|
2405
|
+
if (index === 1 && text) {
|
|
2406
|
+
return text;
|
|
2407
|
+
}
|
|
2408
|
+
},
|
|
2409
|
+
textStyle: function textStyle() {
|
|
2410
|
+
return {
|
|
2411
|
+
color: color
|
|
2412
|
+
};
|
|
2413
|
+
},
|
|
2414
|
+
scaleStep: 1,
|
|
2415
|
+
scaleStyle: function scaleStyle(value) {
|
|
2416
|
+
var flag = flags.filter(function (o) {
|
|
2417
|
+
return keys.indexOf(o.value) === value;
|
|
2418
|
+
})[0];
|
|
2419
|
+
|
|
2420
|
+
if (flag) {
|
|
2421
|
+
return {
|
|
2422
|
+
background: flag.color,
|
|
2423
|
+
height: '100%',
|
|
2424
|
+
top: 0,
|
|
2425
|
+
zIndex: 100
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
return {
|
|
2424
2430
|
height: '100%',
|
|
2425
2431
|
top: 0,
|
|
2426
2432
|
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
|
-
})
|
|
2433
|
+
};
|
|
2443
2434
|
},
|
|
2444
|
-
lineStyle: {
|
|
2445
|
-
|
|
2435
|
+
lineStyle: function lineStyle() {
|
|
2436
|
+
return {
|
|
2437
|
+
opacity: .4
|
|
2438
|
+
};
|
|
2446
2439
|
}
|
|
2447
2440
|
});
|
|
2448
2441
|
} else if (template && column.inlineEdit) {
|
|
@@ -2501,7 +2494,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2501
2494
|
}, {
|
|
2502
2495
|
key: "getInput",
|
|
2503
2496
|
value: function getInput(row, column) {
|
|
2504
|
-
var
|
|
2497
|
+
var _this16 = this;
|
|
2505
2498
|
|
|
2506
2499
|
var type = column.inlineEdit.type;
|
|
2507
2500
|
var value = this.state.value;
|
|
@@ -2525,23 +2518,23 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2525
2518
|
textAlign: column.justify ? 'center' : undefined
|
|
2526
2519
|
},
|
|
2527
2520
|
onChange: function onChange(e) {
|
|
2528
|
-
return
|
|
2521
|
+
return _this16.setState({
|
|
2529
2522
|
value: e.target.value
|
|
2530
2523
|
});
|
|
2531
2524
|
},
|
|
2532
2525
|
onBlur: async function onBlur(e) {
|
|
2533
|
-
|
|
2526
|
+
_this16.setState({
|
|
2534
2527
|
loading: true
|
|
2535
2528
|
});
|
|
2536
2529
|
|
|
2537
2530
|
var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
|
|
2538
2531
|
|
|
2539
|
-
|
|
2532
|
+
_this16.setState({
|
|
2540
2533
|
loading: false
|
|
2541
2534
|
});
|
|
2542
2535
|
|
|
2543
2536
|
if (typeof error === 'string') {
|
|
2544
|
-
|
|
2537
|
+
_this16.setState({
|
|
2545
2538
|
error: error
|
|
2546
2539
|
});
|
|
2547
2540
|
}
|
|
@@ -2566,27 +2559,27 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2566
2559
|
className: "aio-table-input-container"
|
|
2567
2560
|
}, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
|
|
2568
2561
|
onFocus: function onFocus() {
|
|
2569
|
-
return
|
|
2562
|
+
return _this16.focus = true;
|
|
2570
2563
|
},
|
|
2571
2564
|
onBlur: function onBlur() {
|
|
2572
|
-
return
|
|
2565
|
+
return _this16.focus = false;
|
|
2573
2566
|
},
|
|
2574
2567
|
onChange: async function onChange(e) {
|
|
2575
2568
|
var value = e.target.value;
|
|
2576
2569
|
|
|
2577
|
-
|
|
2570
|
+
_this16.setState({
|
|
2578
2571
|
loading: true,
|
|
2579
2572
|
value: value
|
|
2580
2573
|
});
|
|
2581
2574
|
|
|
2582
2575
|
var error = await column.inlineEdit.onChange(row, e.target.value);
|
|
2583
2576
|
|
|
2584
|
-
|
|
2577
|
+
_this16.setState({
|
|
2585
2578
|
loading: false
|
|
2586
2579
|
});
|
|
2587
2580
|
|
|
2588
2581
|
if (typeof error === 'string') {
|
|
2589
|
-
|
|
2582
|
+
_this16.setState({
|
|
2590
2583
|
error: error
|
|
2591
2584
|
});
|
|
2592
2585
|
}
|
|
@@ -2616,21 +2609,21 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2616
2609
|
}, {
|
|
2617
2610
|
key: "render",
|
|
2618
2611
|
value: function render() {
|
|
2619
|
-
var
|
|
2612
|
+
var _this17 = this;
|
|
2620
2613
|
|
|
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$
|
|
2614
|
+
var _this$context14 = this.context,
|
|
2615
|
+
indent = _this$context14.indent,
|
|
2616
|
+
cubes2 = _this$context14.cubes2,
|
|
2617
|
+
focused = _this$context14.focused,
|
|
2618
|
+
SetState = _this$context14.SetState,
|
|
2619
|
+
onDrag = _this$context14.onDrag,
|
|
2620
|
+
_onDrop = _this$context14.onDrop,
|
|
2621
|
+
onSwap = _this$context14.onSwap;
|
|
2622
|
+
var _this$props12 = this.props,
|
|
2623
|
+
row = _this$props12.row,
|
|
2624
|
+
column = _this$props12.column,
|
|
2625
|
+
value = _this$props12.value,
|
|
2626
|
+
cellId = _this$props12.cellId;
|
|
2634
2627
|
|
|
2635
2628
|
if (this.state.prevValue !== value) {
|
|
2636
2629
|
this.setState({
|
|
@@ -2656,8 +2649,8 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2656
2649
|
cell = /*#__PURE__*/_react.default.createElement("div", {
|
|
2657
2650
|
className: "aio-table-error",
|
|
2658
2651
|
onClick: function onClick() {
|
|
2659
|
-
|
|
2660
|
-
value:
|
|
2652
|
+
_this17.setState({
|
|
2653
|
+
value: _this17.props.value,
|
|
2661
2654
|
error: false
|
|
2662
2655
|
});
|
|
2663
2656
|
}
|
|
@@ -2666,7 +2659,7 @@ var AIOTableCell = /*#__PURE__*/function (_Component4) {
|
|
|
2666
2659
|
var style = {
|
|
2667
2660
|
justifyContent: column.justify !== false && !column.treeMode ? 'center' : undefined
|
|
2668
2661
|
};
|
|
2669
|
-
cell = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
|
|
2662
|
+
cell = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
|
|
2670
2663
|
className: "aio-table-indent",
|
|
2671
2664
|
style: {
|
|
2672
2665
|
width: row._level * indent
|
|
@@ -2729,14 +2722,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2729
2722
|
var _super5 = _createSuper(AIOSlider);
|
|
2730
2723
|
|
|
2731
2724
|
function AIOSlider(props) {
|
|
2732
|
-
var
|
|
2725
|
+
var _this18;
|
|
2733
2726
|
|
|
2734
2727
|
_classCallCheck(this, AIOSlider);
|
|
2735
2728
|
|
|
2736
|
-
|
|
2737
|
-
var
|
|
2738
|
-
column =
|
|
2739
|
-
row =
|
|
2729
|
+
_this18 = _super5.call(this, props);
|
|
2730
|
+
var _this18$props = _this18.props,
|
|
2731
|
+
column = _this18$props.column,
|
|
2732
|
+
row = _this18$props.row;
|
|
2740
2733
|
var getValue = column.getValue;
|
|
2741
2734
|
var value = getValue(row);
|
|
2742
2735
|
|
|
@@ -2744,11 +2737,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2744
2737
|
value = [value];
|
|
2745
2738
|
}
|
|
2746
2739
|
|
|
2747
|
-
|
|
2740
|
+
_this18.state = {
|
|
2748
2741
|
value: value
|
|
2749
2742
|
};
|
|
2750
|
-
|
|
2751
|
-
return
|
|
2743
|
+
_this18.updateMode = 'outside';
|
|
2744
|
+
return _this18;
|
|
2752
2745
|
}
|
|
2753
2746
|
|
|
2754
2747
|
_createClass(AIOSlider, [{
|
|
@@ -2767,11 +2760,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2767
2760
|
}, {
|
|
2768
2761
|
key: "render",
|
|
2769
2762
|
value: function render() {
|
|
2770
|
-
var
|
|
2763
|
+
var _this19 = this;
|
|
2771
2764
|
|
|
2772
|
-
var _this$
|
|
2773
|
-
column = _this$
|
|
2774
|
-
row = _this$
|
|
2765
|
+
var _this$props13 = this.props,
|
|
2766
|
+
column = _this$props13.column,
|
|
2767
|
+
row = _this$props13.row;
|
|
2775
2768
|
var getValue = column.getValue,
|
|
2776
2769
|
_column$getStart = column.getStart,
|
|
2777
2770
|
getStart = _column$getStart === void 0 ? function () {
|
|
@@ -2846,7 +2839,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2846
2839
|
});
|
|
2847
2840
|
}
|
|
2848
2841
|
|
|
2849
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
2842
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
2850
2843
|
className: "aio-table-slider-value"
|
|
2851
2844
|
}, editValue(value[0])), /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
|
|
2852
2845
|
start: start,
|
|
@@ -2861,7 +2854,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2861
2854
|
fillStyle: {
|
|
2862
2855
|
height: '6px',
|
|
2863
2856
|
borderRadius: '24px',
|
|
2864
|
-
background:
|
|
2857
|
+
background: _this19.getBackground(value.length, i, color)
|
|
2865
2858
|
}
|
|
2866
2859
|
};
|
|
2867
2860
|
}),
|
|
@@ -2877,14 +2870,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2877
2870
|
background: '#d5d5d5'
|
|
2878
2871
|
},
|
|
2879
2872
|
editable: typeof onChange === 'function',
|
|
2880
|
-
onchange: function onchange(
|
|
2881
|
-
var points =
|
|
2873
|
+
onchange: function onchange(_ref) {
|
|
2874
|
+
var points = _ref.points;
|
|
2882
2875
|
|
|
2883
2876
|
if (!onChange) {
|
|
2884
2877
|
return;
|
|
2885
2878
|
}
|
|
2886
2879
|
|
|
2887
|
-
|
|
2880
|
+
_this19.updateMode = 'onChange';
|
|
2888
2881
|
onChange(row, points.length > 1 ? points.map(function (p) {
|
|
2889
2882
|
return p.value;
|
|
2890
2883
|
}) : points[0].value);
|
|
@@ -2892,11 +2885,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
|
|
|
2892
2885
|
pin: pinItems.length === 0 ? undefined : {
|
|
2893
2886
|
items: pinItems
|
|
2894
2887
|
},
|
|
2895
|
-
ondrag: function ondrag(
|
|
2896
|
-
var points =
|
|
2897
|
-
|
|
2888
|
+
ondrag: function ondrag(_ref2) {
|
|
2889
|
+
var points = _ref2.points;
|
|
2890
|
+
_this19.updateMode = 'onDrag';
|
|
2898
2891
|
|
|
2899
|
-
|
|
2892
|
+
_this19.setState({
|
|
2900
2893
|
value: points.map(function (p) {
|
|
2901
2894
|
return p.value;
|
|
2902
2895
|
})
|
|
@@ -2925,9 +2918,9 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
|
|
|
2925
2918
|
_createClass(RTableFilter, [{
|
|
2926
2919
|
key: "render",
|
|
2927
2920
|
value: function render() {
|
|
2928
|
-
var _this$
|
|
2929
|
-
filterDictionary = _this$
|
|
2930
|
-
rtl = _this$
|
|
2921
|
+
var _this$context15 = this.context,
|
|
2922
|
+
filterDictionary = _this$context15.filterDictionary,
|
|
2923
|
+
rtl = _this$context15.rtl;
|
|
2931
2924
|
var column = this.props.column;
|
|
2932
2925
|
|
|
2933
2926
|
if (!column.filter || column.search) {
|
|
@@ -2949,11 +2942,12 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
|
|
|
2949
2942
|
});
|
|
2950
2943
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
2951
2944
|
className: "aio-table-filter-icon"
|
|
2952
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
2945
|
+
}, /*#__PURE__*/_react.default.createElement(_aioButton.default, {
|
|
2946
|
+
type: "button",
|
|
2953
2947
|
rtl: rtl,
|
|
2954
2948
|
openRelatedTo: ".aio-table",
|
|
2955
2949
|
text: icon,
|
|
2956
|
-
|
|
2950
|
+
popOver: function popOver() {
|
|
2957
2951
|
return /*#__PURE__*/_react.default.createElement(RTableFilterPopup, {
|
|
2958
2952
|
column: column
|
|
2959
2953
|
});
|
|
@@ -2981,10 +2975,10 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
2981
2975
|
_createClass(RTableFilterPopup, [{
|
|
2982
2976
|
key: "add",
|
|
2983
2977
|
value: function add() {
|
|
2984
|
-
var _this$
|
|
2985
|
-
filterDictionary = _this$
|
|
2986
|
-
SetState = _this$
|
|
2987
|
-
onChangeFilter = _this$
|
|
2978
|
+
var _this$context16 = this.context,
|
|
2979
|
+
filterDictionary = _this$context16.filterDictionary,
|
|
2980
|
+
SetState = _this$context16.SetState,
|
|
2981
|
+
onChangeFilter = _this$context16.onChangeFilter;
|
|
2988
2982
|
var column = this.props.column;
|
|
2989
2983
|
|
|
2990
2984
|
filterDictionary[column._index].items.push({
|
|
@@ -3003,13 +2997,13 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3003
2997
|
}, {
|
|
3004
2998
|
key: "render",
|
|
3005
2999
|
value: function render() {
|
|
3006
|
-
var
|
|
3000
|
+
var _this20 = this;
|
|
3007
3001
|
|
|
3008
3002
|
var column = this.props.column;
|
|
3009
|
-
var _this$
|
|
3010
|
-
filterDictionary = _this$
|
|
3011
|
-
SetState = _this$
|
|
3012
|
-
translate = _this$
|
|
3003
|
+
var _this$context17 = this.context,
|
|
3004
|
+
filterDictionary = _this$context17.filterDictionary,
|
|
3005
|
+
SetState = _this$context17.SetState,
|
|
3006
|
+
translate = _this$context17.translate;
|
|
3013
3007
|
var filters = filterDictionary[column._index].items;
|
|
3014
3008
|
var booleanType = filterDictionary[column._index].booleanType;
|
|
3015
3009
|
var filterItems = filters.map(function (filter, i) {
|
|
@@ -3040,7 +3034,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
|
|
|
3040
3034
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
3041
3035
|
className: "aio-table-filter-add",
|
|
3042
3036
|
onClick: function onClick() {
|
|
3043
|
-
return
|
|
3037
|
+
return _this20.add();
|
|
3044
3038
|
}
|
|
3045
3039
|
}, translate('Add'))));
|
|
3046
3040
|
}
|
|
@@ -3057,26 +3051,26 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3057
3051
|
var _super8 = _createSuper(RTableFilterItem);
|
|
3058
3052
|
|
|
3059
3053
|
function RTableFilterItem(props) {
|
|
3060
|
-
var
|
|
3054
|
+
var _this21;
|
|
3061
3055
|
|
|
3062
3056
|
_classCallCheck(this, RTableFilterItem);
|
|
3063
3057
|
|
|
3064
|
-
|
|
3065
|
-
var filter =
|
|
3066
|
-
|
|
3058
|
+
_this21 = _super8.call(this, props);
|
|
3059
|
+
var filter = _this21.props.filter;
|
|
3060
|
+
_this21.state = {
|
|
3067
3061
|
value: filter.value,
|
|
3068
3062
|
prevValue: filter.value
|
|
3069
3063
|
};
|
|
3070
|
-
return
|
|
3064
|
+
return _this21;
|
|
3071
3065
|
}
|
|
3072
3066
|
|
|
3073
3067
|
_createClass(RTableFilterItem, [{
|
|
3074
3068
|
key: "remove",
|
|
3075
3069
|
value: function remove(index) {
|
|
3076
|
-
var _this$
|
|
3077
|
-
filterDictionary = _this$
|
|
3078
|
-
SetState = _this$
|
|
3079
|
-
onChangeFilter = _this$
|
|
3070
|
+
var _this$context18 = this.context,
|
|
3071
|
+
filterDictionary = _this$context18.filterDictionary,
|
|
3072
|
+
SetState = _this$context18.SetState,
|
|
3073
|
+
onChangeFilter = _this$context18.onChangeFilter;
|
|
3080
3074
|
var column = this.props.column;
|
|
3081
3075
|
|
|
3082
3076
|
filterDictionary[column._index].items.splice(index, 1);
|
|
@@ -3092,7 +3086,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3092
3086
|
}, {
|
|
3093
3087
|
key: "changeValue",
|
|
3094
3088
|
value: function changeValue(value) {
|
|
3095
|
-
var
|
|
3089
|
+
var _this22 = this;
|
|
3096
3090
|
|
|
3097
3091
|
var onChangeFilter = this.context.onChangeFilter;
|
|
3098
3092
|
clearTimeout(this.timeout);
|
|
@@ -3100,12 +3094,12 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3100
3094
|
value: value
|
|
3101
3095
|
});
|
|
3102
3096
|
this.timeout = setTimeout(function () {
|
|
3103
|
-
var
|
|
3104
|
-
SetState =
|
|
3105
|
-
filterDictionary =
|
|
3106
|
-
var
|
|
3107
|
-
column =
|
|
3108
|
-
index =
|
|
3097
|
+
var _this22$context = _this22.context,
|
|
3098
|
+
SetState = _this22$context.SetState,
|
|
3099
|
+
filterDictionary = _this22$context.filterDictionary;
|
|
3100
|
+
var _this22$props = _this22.props,
|
|
3101
|
+
column = _this22$props.column,
|
|
3102
|
+
index = _this22$props.index;
|
|
3109
3103
|
filterDictionary[column._index].items[index].value = value;
|
|
3110
3104
|
|
|
3111
3105
|
if (onChangeFilter) {
|
|
@@ -3120,17 +3114,17 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3120
3114
|
}, {
|
|
3121
3115
|
key: "render",
|
|
3122
3116
|
value: function render() {
|
|
3123
|
-
var
|
|
3117
|
+
var _this23 = this;
|
|
3124
3118
|
|
|
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$
|
|
3119
|
+
var _this$context19 = this.context,
|
|
3120
|
+
filterDictionary = _this$context19.filterDictionary,
|
|
3121
|
+
SetState = _this$context19.SetState,
|
|
3122
|
+
translate = _this$context19.translate,
|
|
3123
|
+
onChangeFilter = _this$context19.onChangeFilter;
|
|
3124
|
+
var _this$props14 = this.props,
|
|
3125
|
+
filter = _this$props14.filter,
|
|
3126
|
+
column = _this$props14.column,
|
|
3127
|
+
index = _this$props14.index;
|
|
3134
3128
|
|
|
3135
3129
|
if (this.state.prevValue !== filter.value) {
|
|
3136
3130
|
this.setState({
|
|
@@ -3178,7 +3172,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3178
3172
|
type: type,
|
|
3179
3173
|
value: value,
|
|
3180
3174
|
onChange: function onChange(e) {
|
|
3181
|
-
return
|
|
3175
|
+
return _this23.changeValue(e.target.value);
|
|
3182
3176
|
}
|
|
3183
3177
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3184
3178
|
style: {
|
|
@@ -3187,7 +3181,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3187
3181
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
3188
3182
|
className: "aio-table-filter-remove",
|
|
3189
3183
|
onClick: function onClick() {
|
|
3190
|
-
return
|
|
3184
|
+
return _this23.remove(index);
|
|
3191
3185
|
}
|
|
3192
3186
|
}, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
|
|
3193
3187
|
path: _js.mdiClose,
|
|
@@ -3199,238 +3193,4 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
|
|
|
3199
3193
|
return RTableFilterItem;
|
|
3200
3194
|
}(_react.Component);
|
|
3201
3195
|
|
|
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
|
-
};
|
|
3196
|
+
_defineProperty(RTableFilterItem, "contextType", AioTableContext);
|