aio-table 3.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +351 -464
  2. package/index.css +49 -31
  3. package/index.js +769 -792
  4. package/package.json +3 -3
package/index.js CHANGED
@@ -11,14 +11,14 @@ exports.default = void 0;
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
- var _rDropdownButton = _interopRequireDefault(require("r-dropdown-button"));
14
+ var _aioButton = _interopRequireDefault(require("aio-button"));
15
15
 
16
16
  var _react2 = require("@mdi/react");
17
17
 
18
- var _jquery = _interopRequireDefault(require("jquery"));
19
-
20
18
  var _js = require("@mdi/js");
21
19
 
20
+ var _jquery = _interopRequireDefault(require("jquery"));
21
+
22
22
  var _rRangeSlider = _interopRequireDefault(require("r-range-slider"));
23
23
 
24
24
  require("./index.css");
@@ -57,7 +57,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
57
57
 
58
58
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
59
59
 
60
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
60
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
61
61
 
62
62
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
63
63
 
@@ -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 RTable = /*#__PURE__*/function (_Component) {
71
- _inherits(RTable, _Component);
70
+ var AIOTable = /*#__PURE__*/function (_Component) {
71
+ _inherits(AIOTable, _Component);
72
72
 
73
- var _super = _createSuper(RTable);
73
+ var _super = _createSuper(AIOTable);
74
74
 
75
- function RTable(props) {
75
+ function AIOTable(props) {
76
76
  var _this;
77
77
 
78
- _classCallCheck(this, RTable);
78
+ _classCallCheck(this, AIOTable);
79
79
 
80
80
  _this = _super.call(this, props);
81
81
  _this.touch = false;
@@ -84,20 +84,29 @@ var RTable = /*#__PURE__*/function (_Component) {
84
84
  id = _this$props.id,
85
85
  freezeSize = _this$props.freezeSize,
86
86
  sorts = _this$props.sorts,
87
- selectives = _this$props.selectives,
88
87
  paging = _this$props.paging,
89
88
  columns = _this$props.columns;
90
- var openDictionary = {};
89
+ var openDictionary = {},
90
+ groupDictionary = {};
91
91
 
92
92
  if (id !== undefined) {
93
- openDictionary = localStorage.getItem('r table ' + id);
93
+ openDictionary = localStorage.getItem('aio table ' + id);
94
94
 
95
95
  if (openDictionary === null || openDictionary === undefined) {
96
- localStorage.setItem('r table ' + id, '{}');
96
+ localStorage.setItem('aio table ' + id, '{}');
97
97
  openDictionary = {};
98
98
  } else {
99
99
  openDictionary = JSON.parse(openDictionary);
100
100
  }
101
+
102
+ groupDictionary = localStorage.getItem('aio table group' + id);
103
+
104
+ if (groupDictionary === null || groupDictionary === undefined) {
105
+ localStorage.setItem('aio table group' + id, '{}');
106
+ groupDictionary = {};
107
+ } else {
108
+ groupDictionary = JSON.parse(groupDictionary);
109
+ }
101
110
  }
102
111
 
103
112
  (0, _jquery.default)(window).bind('click', function (e) {
@@ -117,34 +126,49 @@ var RTable = /*#__PURE__*/function (_Component) {
117
126
  focused: false
118
127
  });
119
128
  });
120
- _this.activeTableIndex = 0;
121
129
  _this.state = {
122
130
  openDictionary: openDictionary,
123
131
  filterDictionary: {},
124
132
  groupsOpen: {},
125
133
  freezeSize: freezeSize,
126
- groupDictionary: {},
134
+ groupDictionary: groupDictionary,
127
135
  sorts: sorts,
128
- selectives: selectives,
129
- selectivesDictionary: [],
130
136
  paging: paging,
131
137
  columns: columns,
132
- focused: false
138
+ focused: false,
139
+ toggleAllState: true,
140
+ searchText: ''
133
141
  };
134
142
  return _this;
135
143
  }
136
144
 
137
- _createClass(RTable, [{
145
+ _createClass(AIOTable, [{
138
146
  key: "onScroll",
139
147
  value: function onScroll(e, index) {
148
+ var _this2 = this;
149
+
140
150
  if (!this.freezeMode) {
141
151
  return;
142
152
  }
143
153
 
154
+ if (this.activeTableIndex === undefined) {
155
+ return;
156
+ }
157
+
144
158
  if (index !== this.activeTableIndex) {
159
+ this.onMouseEnter(index);
160
+ clearTimeout(this.timeo);
161
+ this.timeo = setTimeout(function () {
162
+ return _this2.bindScroll();
163
+ }, 40);
145
164
  return;
146
165
  }
147
166
 
167
+ this.bindScroll();
168
+ }
169
+ }, {
170
+ key: "bindScroll",
171
+ value: function bindScroll() {
148
172
  var units = (0, _jquery.default)(this.dom.current).find('.aio-table-unit');
149
173
  var scrollTop = units.eq(this.activeTableIndex).scrollTop();
150
174
  units.eq(this.deactiveTableIndex).scrollTop(scrollTop);
@@ -211,41 +235,67 @@ var RTable = /*#__PURE__*/function (_Component) {
211
235
  freezeSize: this.resizeDetails.newWidth
212
236
  });
213
237
  }
238
+ }, {
239
+ key: "getBodyStyle",
240
+ value: function getBodyStyle(Toolbar) {
241
+ var paging = this.state.paging;
242
+ var padding = this.props.padding;
243
+ var def = padding,
244
+ top = 0;
245
+
246
+ if (paging) {
247
+ def += 36;
248
+ }
249
+
250
+ if (Toolbar !== null) {
251
+ def += 36;
252
+ top += 36;
253
+ }
254
+
255
+ return {
256
+ height: "calc(100% - ".concat(def, "px)"),
257
+ top: top
258
+ };
259
+ }
214
260
  }, {
215
261
  key: "getTable",
216
- value: function getTable() {
217
- var _this2 = this;
262
+ value: function getTable(Toolbar) {
263
+ var _this3 = this;
218
264
 
219
265
  var rows = this.getRows();
266
+ this.rows = rows;
220
267
 
221
268
  if (!this.freezeMode) {
222
269
  return /*#__PURE__*/_react.default.createElement("div", {
223
- className: 'aio-table-body'
270
+ className: 'aio-table-body',
271
+ style: this.getBodyStyle(Toolbar)
224
272
  }, /*#__PURE__*/_react.default.createElement(RTableUnit, {
225
273
  rows: rows,
226
- columns: this.visibleColumns
274
+ columns: this.visibleColumns,
275
+ type: "cells"
227
276
  }));
228
277
  } else {
229
278
  var freezeSize = this.state.freezeSize;
230
279
  return /*#__PURE__*/_react.default.createElement("div", {
231
- className: 'aio-table-body'
280
+ className: 'aio-table-body',
281
+ style: this.getBodyStyle(Toolbar)
232
282
  }, /*#__PURE__*/_react.default.createElement(RTableUnit, {
233
283
  key: 0,
234
284
  id: "aio-table-first-split",
235
285
  rows: rows,
236
286
  columns: this.freezeColumns,
237
287
  index: 0,
238
- type: "freeze",
288
+ type: "freezeCells",
239
289
  style: {
240
290
  width: freezeSize
241
291
  }
242
292
  }), /*#__PURE__*/_react.default.createElement("div", {
243
293
  className: "aio-table-splitter",
244
294
  onMouseDown: function onMouseDown(e) {
245
- return _this2.resizeDown(e);
295
+ return _this3.resizeDown(e);
246
296
  },
247
297
  onTouchStart: function onTouchStart(e) {
248
- return _this2.resizeDown(e);
298
+ return _this3.resizeDown(e);
249
299
  }
250
300
  }), true && /*#__PURE__*/_react.default.createElement(RTableUnit, {
251
301
  key: 1,
@@ -253,36 +303,28 @@ var RTable = /*#__PURE__*/function (_Component) {
253
303
  rows: rows,
254
304
  columns: this.unFreezeColumns,
255
305
  index: 1,
256
- type: "unFreeze"
306
+ type: "unFreezeCells"
257
307
  }));
258
308
  }
259
309
  }
260
310
  }, {
261
311
  key: "convertFlat",
262
- value: function convertFlat(model) {
263
- var _this$props2 = this.props,
264
- getRowId = _this$props2.getRowId,
265
- getRowParentId = _this$props2.getRowParentId;
266
-
312
+ value: function convertFlat(model, getId, getParentId, childsField) {
267
313
  var convertModelRecursive = function convertModelRecursive(array, parentId, parentObject) {
268
314
  for (var i = 0; i < array.length; i++) {
269
315
  var row = array[i];
270
- row._parentId = getRowParentId(row);
316
+ var rowParentId = getParentId(row);
271
317
 
272
- if (row._parentId !== parentId) {
318
+ if (rowParentId !== parentId) {
273
319
  continue;
274
320
  }
275
321
 
276
- var rowId = getRowId(row);
277
- row._childs = [];
322
+ var rowId = getId(row);
323
+ row[childsField] = [];
278
324
  parentObject.push(row);
279
-
280
- var newArray = _toConsumableArray(array);
281
-
282
- newArray.splice(i, 1);
283
325
  array.splice(i, 1);
284
326
  i--;
285
- convertModelRecursive(newArray, rowId, row._childs);
327
+ convertModelRecursive(_toConsumableArray(array), rowId, row[childsField]);
286
328
  }
287
329
  };
288
330
 
@@ -293,13 +335,13 @@ var RTable = /*#__PURE__*/function (_Component) {
293
335
  }, {
294
336
  key: "sort",
295
337
  value: function sort(model) {
296
- var _this3 = this;
338
+ var _this4 = this;
297
339
 
298
340
  var newModel = model.sort(function (a, b) {
299
- for (var i = 0; i < _this3.sorts.length; i++) {
300
- var _this3$sorts$i = _this3.sorts[i],
301
- getValue = _this3$sorts$i.getValue,
302
- type = _this3$sorts$i.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;
303
345
  var aValue = getValue(a),
304
346
  bValue = getValue(b);
305
347
 
@@ -311,74 +353,25 @@ var RTable = /*#__PURE__*/function (_Component) {
311
353
  return 1 * (type === 'dec' ? -1 : 1);
312
354
  }
313
355
 
314
- if (i !== _this3.sorts.length - 1) {
356
+ if (i !== _this4.sorts.length - 1) {
315
357
  continue;
316
358
  }
317
359
 
318
360
  return 0;
319
361
  }
362
+
363
+ return 0;
320
364
  });
321
365
  return newModel;
322
366
  }
323
- }, {
324
- key: "getRowBySelectives",
325
- value: function getRowBySelectives(row, index) {
326
- var _this4 = this;
327
-
328
- var selectives = this.state.selectives;
329
-
330
- if (row.show === false || row.row._level !== 0 || selectives.length === 0) {
331
- return;
332
- }
333
-
334
- var _loop = function _loop(j) {
335
- var selective = selectives[j];
336
- var value = selective.getValue(row.row);
337
-
338
- if (index === 0) {
339
- selective.items = [];
340
- selective.repeat = {};
341
- selective.dictionary = selective.dictionary || {};
342
- }
343
-
344
- if (selective.dictionary[value] === false) {
345
- row.show = false;
346
- }
347
-
348
- if (selective.repeat[value]) {
349
- return "continue";
350
- }
351
-
352
- selective.dictionary[value] = selective.dictionary[value] === undefined ? true : selective.dictionary[value];
353
- selective.repeat[value] = true;
354
- var text = selective.getText(row.row);
355
- selective.items.push({
356
- text: text,
357
- value: value,
358
- checked: selective.dictionary[value],
359
- onClick: function onClick() {
360
- selective.dictionary[value] = !selective.dictionary[value];
361
-
362
- _this4.setState({
363
- selectives: selectives
364
- });
365
- }
366
- });
367
- };
368
-
369
- for (var j = 0; j < selectives.length; j++) {
370
- var _ret = _loop(j);
371
-
372
- if (_ret === "continue") continue;
373
- }
374
- }
375
367
  }, {
376
368
  key: "getRows",
377
369
  value: function getRows() {
378
- var _this$props3 = this.props,
379
- model = _this$props3.model,
380
- flat = _this$props3.flat,
381
- onChangeSort = _this$props3.onChangeSort;
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;
382
375
  var paging = this.state.paging;
383
376
 
384
377
  if (!model) {
@@ -389,7 +382,7 @@ var RTable = /*#__PURE__*/function (_Component) {
389
382
  this.rowRenderIndex = 0;
390
383
  this.rowRealIndex = 0;
391
384
  this.perf = 0;
392
- var convertedModel = flat ? this.convertFlat(_toConsumableArray(model)) : _toConsumableArray(model);
385
+ var convertedModel = getRowParentId ? this.convertFlat(_toConsumableArray(model), getRowId, getRowParentId, '_childs') : _toConsumableArray(model);
393
386
 
394
387
  if (this.sorts.length && !onChangeSort) {
395
388
  convertedModel = this.sort(convertedModel);
@@ -400,9 +393,8 @@ var RTable = /*#__PURE__*/function (_Component) {
400
393
 
401
394
  for (var _i = 0; _i < rows.length; _i++) {
402
395
  var row = rows[_i];
403
- this.getRowBySelectives(row, _i);
404
396
 
405
- if (row.show === false) {
397
+ if (row.row._show === false) {
406
398
  continue;
407
399
  }
408
400
 
@@ -444,10 +436,6 @@ var RTable = /*#__PURE__*/function (_Component) {
444
436
  }
445
437
  }
446
438
 
447
- if (!paging.sizes) {
448
- paging.sizes = [5, 10, 20, 30, 40, 50, 60, 70, 80];
449
- }
450
-
451
439
  if (paging.onChange) {
452
440
  return roots;
453
441
  } //اگر پیجینگ آنچنج داشت تغییری در ردیف ها نده و اجازه بده تغییرات در آنچنج روی مدل ورودی انجام شود
@@ -469,24 +457,25 @@ var RTable = /*#__PURE__*/function (_Component) {
469
457
  var groupsOpen = this.state.groupsOpen;
470
458
  var groups = this.groups;
471
459
 
472
- function msf(obj, _level) {
473
- var _parentField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
474
-
460
+ function msf(obj, _level, parents) {
475
461
  if (Array.isArray(obj)) {
476
462
  groupedRows = groupedRows.concat(obj);
477
463
  } else {
478
464
  for (var prop in obj) {
479
- groupsOpen[_parentField + prop] = groupsOpen[_parentField + prop] === undefined ? true : groupsOpen[_parentField + prop];
465
+ var newParents = parents.concat(prop);
466
+
467
+ var _groupId = newParents.toString();
468
+
469
+ groupsOpen[_groupId] = groupsOpen[_groupId] === undefined ? true : groupsOpen[_groupId];
480
470
  groupedRows.push({
481
- _groupField: prop,
482
- _groupText: prop,
471
+ _groupValue: prop,
472
+ _groupId: _groupId,
483
473
  _level: _level,
484
- _opened: groupsOpen[_parentField + prop],
485
- _parentField: _parentField
474
+ _opened: groupsOpen[_groupId]
486
475
  });
487
476
 
488
- if (groupsOpen[_parentField + prop]) {
489
- msf(obj[prop], _level + 1, _parentField + prop);
477
+ if (groupsOpen[_groupId]) {
478
+ msf(obj[prop], _level + 1, newParents);
490
479
  }
491
480
  }
492
481
  }
@@ -494,7 +483,7 @@ var RTable = /*#__PURE__*/function (_Component) {
494
483
 
495
484
  var newModel = {};
496
485
 
497
- var _loop2 = function _loop2(i) {
486
+ var _loop = function _loop(i) {
498
487
  var root = roots[i];
499
488
  obj = newModel;
500
489
  var values = groups.map(function (group) {
@@ -517,24 +506,25 @@ var RTable = /*#__PURE__*/function (_Component) {
517
506
  for (var i = 0; i < roots.length; i++) {
518
507
  var obj;
519
508
 
520
- _loop2(i);
509
+ _loop(i);
521
510
  }
522
511
 
523
512
  var groupedRows = [];
524
513
  var _level = 0;
525
- msf(newModel, _level);
514
+ msf(newModel, _level, []);
526
515
  return groupedRows;
527
516
  }
528
517
  }, {
529
518
  key: "getRowsReq",
530
519
  value: function getRowsReq(model, rows, _level, parents) {
531
520
  var openDictionary = this.state.openDictionary;
532
- var _this$props4 = this.props,
533
- getRowId = _this$props4.getRowId,
534
- getRowChilds = _this$props4.getRowChilds,
535
- flat = _this$props4.flat;
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;
536
526
 
537
- if (flat) {
527
+ if (getRowParentId) {
538
528
  getRowChilds = function getRowChilds(row) {
539
529
  return row._childs;
540
530
  };
@@ -543,7 +533,11 @@ var RTable = /*#__PURE__*/function (_Component) {
543
533
  for (var i = 0; i < model.length; i++) {
544
534
  var row = model[i];
545
535
 
546
- if (row._groupField) {
536
+ if (getRowVisible && getRowVisible(row) === false) {
537
+ continue;
538
+ }
539
+
540
+ if (row._groupId) {
547
541
  rows.push(row);
548
542
  continue;
549
543
  }
@@ -565,7 +559,7 @@ var RTable = /*#__PURE__*/function (_Component) {
565
559
  var id = getRowId(row);
566
560
 
567
561
  if (id === undefined) {
568
- console.error('RTable => id of row is not defined, please check getRowId props of RTable');
562
+ console.error('AIOTable => id of row is not defined, please check getRowId props of AIOTable');
569
563
  }
570
564
 
571
565
  openDictionary[id] = openDictionary[id] === false ? false : true;
@@ -588,10 +582,8 @@ var RTable = /*#__PURE__*/function (_Component) {
588
582
  row: row
589
583
  });
590
584
 
591
- if (row._opened) {
592
- if (row._childsLength) {
593
- this.getRowsReq(childs, rows, _level + 1, parents.concat(row));
594
- }
585
+ if (row._opened && row._childsLength) {
586
+ this.getRowsReq(childs, rows, _level + 1, parents.concat(row));
595
587
  } else {
596
588
  this.rowRealIndex += row._childsLength;
597
589
  }
@@ -600,6 +592,10 @@ var RTable = /*#__PURE__*/function (_Component) {
600
592
  }, {
601
593
  key: "getFilterResult_and",
602
594
  value: function getFilterResult_and(filters, value) {
595
+ if (value === undefined) {
596
+ return false;
597
+ }
598
+
603
599
  for (var i = 0; i < filters.length; i++) {
604
600
  var filterItem = filters[i];
605
601
 
@@ -637,6 +633,10 @@ var RTable = /*#__PURE__*/function (_Component) {
637
633
  }, {
638
634
  key: "getFilterResult_or",
639
635
  value: function getFilterResult_or(filters, value) {
636
+ if (value === undefined) {
637
+ return false;
638
+ }
639
+
640
640
  for (var i = 0; i < filters.length; i++) {
641
641
  var filterItem = filters[i];
642
642
 
@@ -719,7 +719,6 @@ var RTable = /*#__PURE__*/function (_Component) {
719
719
 
720
720
  var obj = {
721
721
  key: row._index + ',' + column._index,
722
- row: row,
723
722
  column: column,
724
723
  value: value,
725
724
  freeze: column.freeze
@@ -749,12 +748,14 @@ var RTable = /*#__PURE__*/function (_Component) {
749
748
  }
750
749
  }
751
750
 
751
+ row._show = show;
752
+
752
753
  if (show) {
753
754
  var parents = row._getParents();
754
755
 
755
756
  for (var _i2 = 0; _i2 < parents.length; _i2++) {
756
- if (parents[_i2].show === false) {
757
- parents[_i2].show = 'relativeFilter';
757
+ if (parents[_i2]._show === false) {
758
+ parents[_i2]._show = 'relativeFilter';
758
759
  }
759
760
  }
760
761
  }
@@ -766,20 +767,92 @@ var RTable = /*#__PURE__*/function (_Component) {
766
767
  return {
767
768
  cells: cells,
768
769
  freezeCells: freezeCells,
769
- unFreezeCells: unFreezeCells,
770
- show: show
770
+ unFreezeCells: unFreezeCells
771
771
  };
772
772
  }
773
773
  }, {
774
- key: "setColumnWidth",
775
- value: function setColumnWidth(column) {
776
- if (typeof column.width !== 'string') {
777
- column.width = 'auto';
774
+ key: "getRowById",
775
+ value: function getRowById(id) {
776
+ for (var i = 0; i < this.rows.length; i++) {
777
+ var row = this.rows[i];
778
+
779
+ if (!row.row) {
780
+ continue;
781
+ }
782
+
783
+ if (row.row._id === id) {
784
+ return row;
785
+ }
786
+ }
787
+ }
788
+ }, {
789
+ key: "toggleAll",
790
+ value: function toggleAll() {
791
+ var _this$state = this.state,
792
+ openDictionary = _this$state.openDictionary,
793
+ groupsOpen = _this$state.groupsOpen,
794
+ toggleAllState = _this$state.toggleAllState;
795
+ var _this$props4 = this.props,
796
+ id = _this$props4.id,
797
+ getRowId = _this$props4.getRowId;
798
+
799
+ if (getRowId) {
800
+ for (var prop in openDictionary) {
801
+ var row = this.getRowById(prop);
802
+
803
+ if (row && row.row && row.row._show === 'relativeFilter') {
804
+ continue;
805
+ }
806
+
807
+ openDictionary[prop] = toggleAllState;
808
+ }
809
+ } else {
810
+ for (var i = 0; i < this.rows.length; i++) {
811
+ var _row = this.rows[i];
812
+
813
+ if (!_row.row) {
814
+ continue;
815
+ }
816
+
817
+ if (_row.row._show === 'relativeFilter') {
818
+ continue;
819
+ }
820
+
821
+ _row.row._opened = toggleAllState;
822
+ }
778
823
  }
779
824
 
780
- if (column.width !== 'auto' && column.width.indexOf('px') === -1) {
781
- column.width = 'auto';
825
+ for (var _prop in groupsOpen) {
826
+ groupsOpen[_prop] = toggleAllState;
782
827
  }
828
+
829
+ localStorage.setItem('aio table ' + id, JSON.stringify(openDictionary));
830
+ var obj = {
831
+ openDictionary: openDictionary,
832
+ groupsOpen: groupsOpen,
833
+ toggleAllState: !toggleAllState
834
+ };
835
+ this.setState(obj);
836
+ }
837
+ }, {
838
+ key: "showColumnRelativeGroups",
839
+ value: function showColumnRelativeGroups(column) {
840
+ var groups = this.props.groups;
841
+ var groupDictionary = this.state.groupDictionary;
842
+
843
+ if (!groups) {
844
+ return true;
845
+ }
846
+
847
+ if (!groups.length) {
848
+ return true;
849
+ }
850
+
851
+ if (!column.groupName) {
852
+ return true;
853
+ }
854
+
855
+ return groupDictionary[column.groupName] !== true;
783
856
  }
784
857
  }, {
785
858
  key: "updateColumns",
@@ -792,24 +865,26 @@ var RTable = /*#__PURE__*/function (_Component) {
792
865
  translate = _this$props5.translate,
793
866
  groups = _this$props5.groups,
794
867
  cardTemplate = _this$props5.cardTemplate,
795
- onChangeSort = _this$props5.onChangeSort;
796
- var _this$state = this.state,
797
- groupDictionary = _this$state.groupDictionary,
798
- sorts = _this$state.sorts,
799
- selectives = _this$state.selectives,
800
- columns = _this$state.columns;
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
+ var _this$state2 = this.state,
873
+ groupDictionary = _this$state2.groupDictionary,
874
+ sorts = _this$state2.sorts,
875
+ columns = _this$state2.columns;
801
876
  this.groups = [];
802
877
  this.sorts = [];
803
- this.selectives = [];
804
878
  this.freezeMode = false;
805
879
  this.visibleColumns = [];
806
880
  this.freezeColumns = [];
807
881
  this.unFreezeColumns = [];
808
882
  this.toolbar = {
809
- show: selectives.length !== 0,
883
+ show: toggleAll,
810
884
  toggle: [{
811
- text: translate('Show')
885
+ text: translate('Show Columns')
812
886
  }],
887
+ toggleAll: toggleAll ? this.toggleAll.bind(this) : false,
813
888
  freeze: [{
814
889
  text: translate('Freeze')
815
890
  }],
@@ -819,11 +894,10 @@ var RTable = /*#__PURE__*/function (_Component) {
819
894
  sort: [{
820
895
  text: translate('Sort')
821
896
  }],
822
- selectives: selectives,
823
897
  searchColumnIndex: false
824
898
  };
825
899
 
826
- var _loop3 = function _loop3(i) {
900
+ var _loop2 = function _loop2(i) {
827
901
  var sort = sorts[i];
828
902
  var getValue = sort.getValue,
829
903
  _sort$type = sort.type,
@@ -866,7 +940,8 @@ var RTable = /*#__PURE__*/function (_Component) {
866
940
  }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
867
941
  path: type === 'dec' ? _js.mdiArrowDown : _js.mdiArrowUp,
868
942
  size: 0.8,
869
- onClick: function onClick() {
943
+ onClick: function onClick(e) {
944
+ e.stopPropagation();
870
945
  sort.type = sort.type === 'dec' ? 'inc' : 'dec';
871
946
 
872
947
  _this5.setState({
@@ -898,12 +973,12 @@ var RTable = /*#__PURE__*/function (_Component) {
898
973
  };
899
974
 
900
975
  for (var i = 0; i < sorts.length; i++) {
901
- var _ret2 = _loop3(i);
976
+ var _ret = _loop2(i);
902
977
 
903
- if (_ret2 === "continue") continue;
978
+ if (_ret === "continue") continue;
904
979
  }
905
980
 
906
- var _loop4 = function _loop4(_i3) {
981
+ var _loop3 = function _loop3(_i3) {
907
982
  var group = groups[_i3];
908
983
  var title = group.title,
909
984
  _group$active = group.active,
@@ -937,6 +1012,10 @@ var RTable = /*#__PURE__*/function (_Component) {
937
1012
  onClick: function onClick() {
938
1013
  groupDictionary[title] = !groupDictionary[title];
939
1014
 
1015
+ if (id) {
1016
+ localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
1017
+ }
1018
+
940
1019
  _this5.setState({
941
1020
  groupDictionary: groupDictionary
942
1021
  });
@@ -946,23 +1025,48 @@ var RTable = /*#__PURE__*/function (_Component) {
946
1025
  };
947
1026
 
948
1027
  for (var _i3 = 0; _i3 < groups.length; _i3++) {
949
- var _ret3 = _loop4(_i3);
1028
+ var _ret2 = _loop3(_i3);
950
1029
 
951
- if (_ret3 === "continue") continue;
1030
+ if (_ret2 === "continue") continue;
952
1031
  }
953
1032
 
954
1033
  if (cardTemplate) {
955
1034
  return;
956
1035
  }
957
1036
 
958
- var _loop5 = function _loop5(_i4) {
1037
+ var _loop4 = function _loop4(_i4) {
959
1038
  var column = columns[_i4];
1039
+ var show = void 0;
1040
+
1041
+ if (column.storageKey && column.toggleShow) {
1042
+ var storageStr = localStorage.getItem('aio-table-column-storage-' + column.storageKey);
1043
+
1044
+ if (!storageStr || storageStr === null) {
1045
+ column._storageObj = {};
1046
+ localStorage.setItem('aio-table-column-storage-' + column.storageKey, JSON.stringify(column._storageObj));
1047
+ } else {
1048
+ column._storageObj = JSON.parse(storageStr);
1049
+ }
1050
+
1051
+ if (column._storageObj.show !== undefined) {
1052
+ show = column._storageObj.show;
1053
+ } else {
1054
+ show = column.show;
1055
+ }
960
1056
 
961
- _this5.setColumnWidth(column);
1057
+ if (column._storageObj.width !== undefined) {
1058
+ column.width = column._storageObj.width;
1059
+ } else {
1060
+ column.width = column.width || 'auto';
1061
+ }
1062
+ } else {
1063
+ show = column.show;
1064
+ column.width = column.width || 'auto';
1065
+ }
962
1066
 
963
1067
  column._index = _i4;
964
1068
 
965
- if (column.show !== false) {
1069
+ if (show !== false && _this5.showColumnRelativeGroups(column)) {
966
1070
  _this5.visibleColumns.push(column);
967
1071
 
968
1072
  if (freezeMode) {
@@ -998,10 +1102,18 @@ var RTable = /*#__PURE__*/function (_Component) {
998
1102
 
999
1103
  _this5.toolbar.toggle.push({
1000
1104
  text: column.title,
1001
- checked: column.show !== false,
1105
+ checked: show !== false,
1002
1106
  onClick: function onClick() {
1003
1107
  column.show = column.show === false ? false : true;
1004
- column.show = !column.show;
1108
+
1109
+ if (column.storageKey) {
1110
+ column._storageObj.show = column._storageObj.show === false ? false : column._storageObj.show;
1111
+ column._storageObj.show = !column._storageObj.show;
1112
+ column.show = column._storageObj.show;
1113
+ localStorage.setItem('aio-table-column-storage-' + column.storageKey, JSON.stringify(column._storageObj));
1114
+ } else {
1115
+ column.show = !column.show;
1116
+ }
1005
1117
 
1006
1118
  _this5.setState({
1007
1119
  columns: columns
@@ -1017,7 +1129,7 @@ var RTable = /*#__PURE__*/function (_Component) {
1017
1129
  };
1018
1130
 
1019
1131
  for (var _i4 = 0; _i4 < columns.length; _i4++) {
1020
- _loop5(_i4);
1132
+ _loop4(_i4);
1021
1133
  }
1022
1134
 
1023
1135
  if (this.freezeColumns.length === 0 || this.unFreezeColumns.length === 0) {
@@ -1029,7 +1141,7 @@ var RTable = /*#__PURE__*/function (_Component) {
1029
1141
  value: function getPaging() {
1030
1142
  var _this6 = this;
1031
1143
 
1032
- var paging = this.props.paging;
1144
+ var paging = this.state.paging;
1033
1145
 
1034
1146
  if (!paging) {
1035
1147
  return null;
@@ -1039,11 +1151,15 @@ var RTable = /*#__PURE__*/function (_Component) {
1039
1151
  rtl = _this$props6.rtl,
1040
1152
  translate = _this$props6.translate;
1041
1153
  var number = paging.number,
1042
- sizes = paging.sizes,
1154
+ _paging$sizes = paging.sizes,
1155
+ sizes = _paging$sizes === void 0 ? [1, 5, 10, 20, 30, 40, 50, 60, 70, 80] : _paging$sizes,
1043
1156
  size = paging.size,
1044
- pages = paging.pages;
1157
+ _paging$pages = paging.pages,
1158
+ pages = _paging$pages === void 0 ? 1 : _paging$pages;
1045
1159
 
1046
1160
  var changePage = function changePage(type) {
1161
+ var _paging$pages2 = paging.pages,
1162
+ pages = _paging$pages2 === void 0 ? 1 : _paging$pages2;
1047
1163
  var newNumber;
1048
1164
 
1049
1165
  if (type === 'prev') {
@@ -1191,7 +1307,7 @@ var RTable = /*#__PURE__*/function (_Component) {
1191
1307
  display: 'flex',
1192
1308
  alignItems: 'center',
1193
1309
  justifyContent: 'center',
1194
- background: '#fff'
1310
+ background: 'transparent'
1195
1311
  }
1196
1312
  }, items);
1197
1313
  }
@@ -1222,11 +1338,48 @@ var RTable = /*#__PURE__*/function (_Component) {
1222
1338
 
1223
1339
  onChangeFilter(filters);
1224
1340
  }
1341
+ }, {
1342
+ key: "toggleRow",
1343
+ value: function toggleRow(row) {
1344
+ var openDictionary = this.state.openDictionary;
1345
+ var id = this.props.id;
1346
+
1347
+ if (row._show === 'relativeFilter') {
1348
+ return;
1349
+ }
1350
+
1351
+ if (row._id !== undefined) {
1352
+ openDictionary[row._id] = !openDictionary[row._id];
1353
+
1354
+ if (id !== undefined) {
1355
+ localStorage.setItem('aio table ' + id, JSON.stringify(openDictionary));
1356
+ }
1357
+
1358
+ this.setState({
1359
+ openDictionary: openDictionary
1360
+ });
1361
+ } else {
1362
+ row._opened = !row._opened;
1363
+ this.setState({});
1364
+ }
1365
+ }
1225
1366
  }, {
1226
1367
  key: "render",
1227
1368
  value: function render() {
1228
1369
  var _this7 = this;
1229
1370
 
1371
+ if (JSON.stringify(this.props.columns) !== JSON.stringify(this.state.columns)) {
1372
+ this.setState({
1373
+ columns: this.props.columns
1374
+ }); //return null;
1375
+ }
1376
+
1377
+ if (JSON.stringify(this.props.paging) !== JSON.stringify(this.state.paging)) {
1378
+ this.setState({
1379
+ paging: this.props.paging
1380
+ }); //return null;
1381
+ }
1382
+
1230
1383
  var _this$props7 = this.props,
1231
1384
  rowHeight = _this$props7.rowHeight,
1232
1385
  headerHeight = _this$props7.headerHeight,
@@ -1239,7 +1392,9 @@ var RTable = /*#__PURE__*/function (_Component) {
1239
1392
  _this$props7$attrs = _this$props7.attrs,
1240
1393
  attrs = _this$props7$attrs === void 0 ? {} : _this$props7$attrs,
1241
1394
  cardTemplate = _this$props7.cardTemplate,
1242
- onChangeFilter = _this$props7.onChangeFilter;
1395
+ onChangeFilter = _this$props7.onChangeFilter,
1396
+ onSwap = _this$props7.onSwap,
1397
+ padding = _this$props7.padding;
1243
1398
  var columns = this.state.columns;
1244
1399
  this.rh = rowHeight;
1245
1400
  this.hh = headerHeight;
@@ -1247,15 +1402,48 @@ var RTable = /*#__PURE__*/function (_Component) {
1247
1402
  this.rg = rowGap;
1248
1403
  this.cg = columnGap;
1249
1404
  this.updateColumns();
1250
- var table = columns ? this.getTable() : '';
1405
+ var Toolbar = this.toolbar.show ? /*#__PURE__*/_react.default.createElement(RTableToolbar, this.toolbar) : null;
1406
+ var table = columns ? this.getTable(Toolbar) : '';
1407
+ var Paging = this.getPaging();
1251
1408
  var context = { ...this.props,
1252
1409
  ...this.state,
1253
1410
  touch: this.touch,
1411
+ onDrag: function onDrag(obj) {
1412
+ return _this7.dragStart = obj;
1413
+ },
1414
+ onDrop: function onDrop(obj) {
1415
+ if (!_this7.dragStart) {
1416
+ return;
1417
+ }
1418
+
1419
+ if (_this7.dragStart._level !== obj._level) {
1420
+ return;
1421
+ }
1422
+
1423
+ if (_this7.dragStart._level === 0) {
1424
+ onSwap(_this7.dragStart, obj);
1425
+ } else {
1426
+ var startParents = _this7.dragStart._getParents().map(function (o) {
1427
+ return o._index;
1428
+ }).toString();
1429
+
1430
+ var endParents = obj._getParents().map(function (o) {
1431
+ return o._index;
1432
+ }).toString();
1433
+
1434
+ if (startParents !== endParents) {
1435
+ return;
1436
+ }
1437
+
1438
+ onSwap(_this7.dragStart, obj);
1439
+ }
1440
+ },
1254
1441
  onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
1255
1442
  SetState: function SetState(obj) {
1256
1443
  return _this7.setState(obj);
1257
1444
  },
1258
1445
  cubes2: this.cubes2.bind(this),
1446
+ toggleRow: this.toggleRow.bind(this),
1259
1447
  getGap: this.getGap.bind(this),
1260
1448
  onScroll: this.onScroll.bind(this),
1261
1449
  onMouseEnter: this.onMouseEnter.bind(this),
@@ -1269,38 +1457,31 @@ var RTable = /*#__PURE__*/function (_Component) {
1269
1457
  className: 'aio-table' + (className ? ' ' + className : '') + (rtl ? ' rtl' : ''),
1270
1458
  tabIndex: 0,
1271
1459
  ref: this.dom,
1272
- style: style
1273
- }, attrs), /*#__PURE__*/_react.default.createElement(RTableToolbar, this.toolbar), !cardTemplate && this.visibleColumns.length === 0 && this.getLoading(), table, /*#__PURE__*/_react.default.createElement("div", {
1274
- style: {
1275
- height: rowGap
1276
- }
1277
- }), /*#__PURE__*/_react.default.createElement("div", {
1278
- style: {
1279
- flex: 1,
1280
- background: '#fff'
1460
+ style: { ...style,
1461
+ padding: padding
1281
1462
  }
1282
- }), this.getPaging()));
1463
+ }, attrs), Toolbar, !cardTemplate && this.visibleColumns.length === 0 && this.getLoading(), table, Paging));
1283
1464
  }
1284
1465
  }]);
1285
1466
 
1286
- return RTable;
1467
+ return AIOTable;
1287
1468
  }(_react.Component);
1288
1469
 
1289
- exports.default = RTable;
1290
- RTable.defaultProps = {
1470
+ exports.default = AIOTable;
1471
+ AIOTable.defaultProps = {
1291
1472
  columns: [],
1292
1473
  headerHeight: 36,
1293
1474
  rowHeight: 36,
1294
1475
  toolbarHeight: 36,
1295
1476
  rowGap: 6,
1477
+ padding: 12,
1296
1478
  indent: 20,
1297
1479
  translate: function translate(text) {
1298
1480
  return text;
1299
1481
  },
1300
1482
  freezeSize: 300,
1301
1483
  sorts: [],
1302
- groups: [],
1303
- selectives: []
1484
+ groups: []
1304
1485
  };
1305
1486
 
1306
1487
  var RTableToolbar = /*#__PURE__*/function (_Component2) {
@@ -1309,37 +1490,27 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1309
1490
  var _super2 = _createSuper(RTableToolbar);
1310
1491
 
1311
1492
  function RTableToolbar() {
1312
- var _this8;
1313
-
1314
1493
  _classCallCheck(this, RTableToolbar);
1315
1494
 
1316
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1317
- args[_key] = arguments[_key];
1318
- }
1319
-
1320
- _this8 = _super2.call.apply(_super2, [this].concat(args));
1321
-
1322
- _defineProperty(_assertThisInitialized(_this8), "state", {
1323
- searchText: ''
1324
- });
1325
-
1326
- return _this8;
1495
+ return _super2.apply(this, arguments);
1327
1496
  }
1328
1497
 
1329
1498
  _createClass(RTableToolbar, [{
1330
1499
  key: "changeSearch",
1331
1500
  value: function changeSearch(value) {
1332
- var _this9 = this;
1501
+ var _this8 = this;
1333
1502
 
1503
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
1504
+ var SetState = this.context.SetState;
1334
1505
  clearTimeout(this.searchTimeout);
1335
- this.setState({
1506
+ SetState({
1336
1507
  searchText: value
1337
1508
  });
1338
1509
  this.searchTimeout = setTimeout(function () {
1339
- var _this9$context = _this9.context,
1340
- filterDictionary = _this9$context.filterDictionary,
1341
- SetState = _this9$context.SetState;
1342
- var searchColumnIndex = _this9.props.searchColumnIndex;
1510
+ var _this8$context = _this8.context,
1511
+ filterDictionary = _this8$context.filterDictionary,
1512
+ SetState = _this8$context.SetState;
1513
+ var searchColumnIndex = _this8.props.searchColumnIndex;
1343
1514
  filterDictionary[searchColumnIndex] = {
1344
1515
  items: value ? [{
1345
1516
  operator: 'contain',
@@ -1350,104 +1521,124 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1350
1521
  SetState({
1351
1522
  filterDictionary: filterDictionary
1352
1523
  });
1353
- }, 1000);
1524
+ }, time);
1354
1525
  }
1355
1526
  }, {
1356
1527
  key: "render",
1357
1528
  value: function render() {
1358
- var _this10 = this;
1529
+ var _this9 = this;
1359
1530
 
1360
1531
  var _this$context = this.context,
1532
+ searchText = _this$context.searchText,
1361
1533
  translate = _this$context.translate,
1362
- rtl = _this$context.rtl;
1363
- var searchText = this.state.searchText;
1534
+ rtl = _this$context.rtl,
1535
+ toggleAllState = _this$context.toggleAllState,
1536
+ padding = _this$context.padding,
1537
+ _this$context$toolbar = _this$context.toolbarItems,
1538
+ toolbarItems = _this$context$toolbar === void 0 ? [] : _this$context$toolbar;
1364
1539
  var _this$props8 = this.props,
1365
- show = _this$props8.show,
1366
1540
  toggle = _this$props8.toggle,
1367
1541
  freeze = _this$props8.freeze,
1368
1542
  groupBy = _this$props8.groupBy,
1369
1543
  sort = _this$props8.sort,
1370
1544
  searchColumnIndex = _this$props8.searchColumnIndex,
1371
- selectives = _this$props8.selectives;
1372
-
1373
- if (!show) {
1374
- return null;
1375
- }
1376
-
1545
+ toggleAll = _this$props8.toggleAll;
1377
1546
  var buttonProps = {
1547
+ type: 'select',
1548
+ caret: false,
1378
1549
  rtl: rtl,
1379
- className: 'aio-table-toolbar-dropdown',
1550
+ className: 'aio-table-toolbar-button',
1380
1551
  animate: true
1381
1552
  };
1382
- var Selectives = selectives.map(function (selective, i) {
1383
- return /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1384
- key: 'selectives' + i
1385
- }, buttonProps, {
1386
- items: selective.items,
1387
- style: {
1388
- width: 'auto'
1389
- },
1390
- text: selective.title,
1391
- icon: selective.icon
1392
- }));
1393
- });
1394
1553
  return /*#__PURE__*/_react.default.createElement("div", {
1395
- className: "aio-table-toolbar"
1396
- }, Selectives, searchColumnIndex !== false && /*#__PURE__*/_react.default.createElement("div", {
1397
- key: 3,
1554
+ className: "aio-table-toolbar",
1555
+ style: {
1556
+ marginBottom: padding
1557
+ }
1558
+ }, toggleAll !== false && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1559
+ key: 0
1560
+ }, buttonProps, {
1561
+ type: "button",
1562
+ title: translate('Toggle All'),
1563
+ onClick: function onClick() {
1564
+ return toggleAll();
1565
+ },
1566
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1567
+ path: !toggleAllState ? _js.mdiCollapseAll : _js.mdiExpandAll,
1568
+ size: 0.7
1569
+ })
1570
+ })), toolbarItems.map(function (o, i) {
1571
+ return /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1572
+ type: "button"
1573
+ }, o, {
1574
+ rtl: rtl,
1575
+ className: "aio-table-toolbar-button",
1576
+ animate: true,
1577
+ key: 'ti' + i
1578
+ }));
1579
+ }), searchColumnIndex !== false && /*#__PURE__*/_react.default.createElement("div", {
1580
+ key: 1,
1398
1581
  className: "aio-table-search"
1399
1582
  }, /*#__PURE__*/_react.default.createElement("input", {
1400
1583
  className: "aio-table-search-input",
1401
1584
  type: "text",
1402
1585
  value: searchText,
1586
+ placeholder: translate('Search'),
1403
1587
  onChange: function onChange(e) {
1404
- return _this10.changeSearch(e.target.value);
1588
+ return _this9.changeSearch(e.target.value);
1405
1589
  }
1406
1590
  }), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1407
1591
  className: "aio-table-search-icon",
1408
- path: _js.mdiMagnify,
1409
- size: 0.8
1592
+ path: searchText ? _js.mdiClose : _js.mdiMagnify,
1593
+ size: 0.8,
1594
+ onClick: function onClick() {
1595
+ if (!searchText) {
1596
+ return;
1597
+ }
1598
+
1599
+ _this9.changeSearch('', 0);
1600
+ }
1410
1601
  })), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
1411
1602
  style: {
1412
1603
  flex: 1
1413
1604
  }
1414
- }), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1415
- key: 0
1605
+ }), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1606
+ key: 2
1416
1607
  }, buttonProps, {
1417
- items: groupBy,
1608
+ options: groupBy,
1418
1609
  title: translate('Group By'),
1419
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1610
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1420
1611
  path: _js.mdiFileTree,
1421
1612
  size: 0.7,
1422
1613
  horizontal: rtl === true
1423
1614
  })
1424
- })), sort.length > 1 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1425
- key: 1
1615
+ })), sort.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1616
+ key: 3
1426
1617
  }, buttonProps, {
1427
- items: sort,
1618
+ options: sort,
1428
1619
  title: translate('Sort'),
1429
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1620
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1430
1621
  path: _js.mdiSort,
1431
1622
  size: 0.7
1432
1623
  })
1433
- })), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1434
- key: 2
1624
+ })), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1625
+ key: 4
1435
1626
  }, buttonProps, {
1436
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1627
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1437
1628
  path: _js.mdiEye,
1438
1629
  size: 0.7
1439
1630
  }),
1440
- items: toggle,
1631
+ options: toggle,
1441
1632
  title: translate('Show Columns')
1442
- })), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1443
- key: 3
1633
+ })), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1634
+ key: 5
1444
1635
  }, buttonProps, {
1445
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1636
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1446
1637
  path: _js.mdiAlignHorizontalLeft,
1447
1638
  size: 0.7,
1448
1639
  horizontal: rtl === true
1449
1640
  }),
1450
- items: freeze,
1641
+ options: freeze,
1451
1642
  title: translate('Freeze Columns')
1452
1643
  })));
1453
1644
  }
@@ -1464,34 +1655,36 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1464
1655
  var _super3 = _createSuper(RTableUnit);
1465
1656
 
1466
1657
  function RTableUnit(props) {
1467
- var _this11;
1658
+ var _this10;
1468
1659
 
1469
1660
  _classCallCheck(this, RTableUnit);
1470
1661
 
1471
- _this11 = _super3.call(this, props);
1472
- _this11.dom = /*#__PURE__*/(0, _react.createRef)();
1473
- return _this11;
1662
+ _this10 = _super3.call(this, props);
1663
+ _this10.dom = /*#__PURE__*/(0, _react.createRef)();
1664
+ return _this10;
1474
1665
  }
1475
1666
 
1476
1667
  _createClass(RTableUnit, [{
1477
1668
  key: "getNoData",
1478
1669
  value: function getNoData() {
1479
- var rowHeight = this.context.rowHeight;
1670
+ var _this$context2 = this.context,
1671
+ rowHeight = _this$context2.rowHeight,
1672
+ translate = _this$context2.translate;
1480
1673
  return /*#__PURE__*/_react.default.createElement("div", {
1481
1674
  className: "aio-table-nodata",
1482
1675
  style: { ...this.getFullCellStyle(),
1483
1676
  height: rowHeight
1484
1677
  }
1485
- }, "\u062F\u06CC\u062A\u0627\u06CC\u06CC \u0645\u0648\u062C\u0648\u062F \u0646\u06CC\u0633\u062A");
1678
+ }, translate('No Data'));
1486
1679
  }
1487
1680
  }, {
1488
1681
  key: "getGroupToggleIcon",
1489
1682
  value: function getGroupToggleIcon(row) {
1490
- var _this$context2 = this.context,
1491
- rtl = _this$context2.rtl,
1492
- SetState = _this$context2.SetState,
1493
- groupsOpen = _this$context2.groupsOpen,
1494
- getGap = _this$context2.getGap;
1683
+ var _this$context3 = this.context,
1684
+ rtl = _this$context3.rtl,
1685
+ SetState = _this$context3.SetState,
1686
+ groupsOpen = _this$context3.groupsOpen,
1687
+ getGap = _this$context3.getGap;
1495
1688
  var icon;
1496
1689
 
1497
1690
  if (row._opened) {
@@ -1507,12 +1700,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1507
1700
  });
1508
1701
  }
1509
1702
 
1510
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1703
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1511
1704
  className: "aio-table-toggle",
1512
1705
  onClick: function onClick() {
1513
- var _groupField = row._groupField,
1514
- _parentField = row._parentField;
1515
- groupsOpen[_parentField + _groupField] = !groupsOpen[_parentField + _groupField];
1706
+ var _groupId = row._groupId;
1707
+ groupsOpen[_groupId] = !groupsOpen[_groupId];
1516
1708
  SetState({
1517
1709
  groupsOpen: groupsOpen
1518
1710
  });
@@ -1531,9 +1723,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1531
1723
  }, {
1532
1724
  key: "getStyle",
1533
1725
  value: function getStyle() {
1534
- var _this$context3 = this.context,
1535
- rowGap = _this$context3.rowGap,
1536
- columnGap = _this$context3.columnGap;
1726
+ var _this$context4 = this.context,
1727
+ rowGap = _this$context4.rowGap,
1728
+ columnGap = _this$context4.columnGap;
1537
1729
  var _this$props9 = this.props,
1538
1730
  columns = _this$props9.columns,
1539
1731
  style = _this$props9.style;
@@ -1543,6 +1735,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1543
1735
  for (var i = 0; i < columns.length; i++) {
1544
1736
  var _columns$i$width = columns[i].width,
1545
1737
  width = _columns$i$width === void 0 ? 'auto' : _columns$i$width;
1738
+ width = width.toString();
1739
+
1740
+ if (width !== 'auto' && width.indexOf('px') === -1) {
1741
+ width += 'px';
1742
+ }
1743
+
1546
1744
  this.gridTemplateColumns.push(width);
1547
1745
  gridTemplateColumns += width + (i < columns.length - 1 ? ' ' : '');
1548
1746
  }
@@ -1557,19 +1755,19 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1557
1755
  }, {
1558
1756
  key: "getTitles",
1559
1757
  value: function getTitles() {
1560
- var _this12 = this;
1758
+ var _this11 = this;
1561
1759
 
1562
1760
  var columns = this.props.columns;
1563
1761
  return columns.map(function (column) {
1564
- return _this12.getTitle(column);
1762
+ return _this11.getTitle(column);
1565
1763
  });
1566
1764
  }
1567
1765
  }, {
1568
1766
  key: "getGanttTitle",
1569
1767
  value: function getGanttTitle(column) {
1570
- var _this$context4 = this.context,
1571
- headerHeight = _this$context4.headerHeight,
1572
- columnGap = _this$context4.columnGap;
1768
+ var _this$context5 = this.context,
1769
+ headerHeight = _this$context5.headerHeight,
1770
+ columnGap = _this$context5.columnGap;
1573
1771
  var getKeys = column.getKeys,
1574
1772
  _column$padding = column.padding,
1575
1773
  padding = _column$padding === void 0 ? '36px' : _column$padding;
@@ -1587,38 +1785,42 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1587
1785
  }, /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
1588
1786
  start: 0,
1589
1787
  end: keys.length - 1,
1590
- label: {
1591
- step: 1,
1592
- edit: function edit(value) {
1593
- return keys[value];
1594
- },
1595
- style: {
1788
+ labelStep: 1,
1789
+ editLabel: function editLabel(value) {
1790
+ return keys[value];
1791
+ },
1792
+ labelStyle: function labelStyle() {
1793
+ return {
1596
1794
  top: 0
1597
- }
1795
+ };
1598
1796
  },
1599
- pointStyle: {
1600
- display: 'none'
1797
+ pointStyle: function pointStyle() {
1798
+ return {
1799
+ display: 'none'
1800
+ };
1601
1801
  },
1602
- lineStyle: {
1603
- display: 'none'
1802
+ lineStyle: function lineStyle() {
1803
+ return {
1804
+ display: 'none'
1805
+ };
1604
1806
  }
1605
1807
  }));
1606
1808
  }
1607
1809
  }, {
1608
1810
  key: "getTitle",
1609
1811
  value: function getTitle(column) {
1610
- var _this13 = this;
1812
+ var _this12 = this;
1611
1813
 
1612
1814
  if (column.template === 'gantt') {
1613
1815
  return this.getGanttTitle(column);
1614
1816
  }
1615
1817
 
1616
- var _this$context5 = this.context,
1617
- SetState = _this$context5.SetState,
1618
- columns = _this$context5.columns,
1619
- headerHeight = _this$context5.headerHeight,
1620
- columnGap = _this$context5.columnGap,
1621
- touch = _this$context5.touch;
1818
+ var _this$context6 = this.context,
1819
+ SetState = _this$context6.SetState,
1820
+ columns = _this$context6.columns,
1821
+ headerHeight = _this$context6.headerHeight,
1822
+ columnGap = _this$context6.columnGap,
1823
+ touch = _this$context6.touch;
1622
1824
  var props = {
1623
1825
  style: {
1624
1826
  height: headerHeight,
@@ -1638,35 +1840,35 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1638
1840
  },
1639
1841
  draggable: false
1640
1842
  }, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
1641
- return column.resizable ? _this13.resizeDown(e, column) : undefined;
1843
+ return column.resizable ? _this12.resizeDown(e, column) : undefined;
1642
1844
  });
1643
1845
 
1644
1846
  var titleProps = {
1645
1847
  className: 'aio-table-title-text',
1646
1848
  style: {
1647
- justifyContent: column.titleJustify ? 'center' : undefined,
1849
+ justifyContent: column.titleJustify !== false ? 'center' : undefined,
1648
1850
  cursor: column.movable === false ? undefined : 'move'
1649
1851
  },
1650
1852
  draggable: column.movable !== false,
1651
1853
  onDragStart: function onDragStart(e) {
1652
- _this13.startColumnSwap = column._index;
1854
+ _this12.startColumnSwap = column._index;
1653
1855
  },
1654
1856
  onDragOver: function onDragOver(e) {
1655
1857
  e.preventDefault();
1656
- _this13.endColumnSwap = column._index;
1858
+ _this12.endColumnSwap = column._index;
1657
1859
  },
1658
1860
  onDrop: function onDrop(e) {
1659
1861
  if (column.movable === false) {
1660
1862
  return;
1661
1863
  }
1662
1864
 
1663
- if (_this13.startColumnSwap === _this13.endColumnSwap) {
1865
+ if (_this12.startColumnSwap === undefined || _this12.startColumnSwap === _this12.endColumnSwap) {
1664
1866
  return;
1665
1867
  }
1666
1868
 
1667
- var temp = columns[_this13.startColumnSwap];
1668
- columns[_this13.startColumnSwap] = columns[_this13.endColumnSwap];
1669
- columns[_this13.endColumnSwap] = temp;
1869
+ var temp = columns[_this12.startColumnSwap];
1870
+ columns[_this12.startColumnSwap] = columns[_this12.endColumnSwap];
1871
+ columns[_this12.endColumnSwap] = temp;
1670
1872
  SetState({
1671
1873
  columns: columns
1672
1874
  });
@@ -1679,9 +1881,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1679
1881
  }, {
1680
1882
  key: "resizeDown",
1681
1883
  value: function resizeDown(e, column) {
1682
- var _this$context6 = this.context,
1683
- touch = _this$context6.touch,
1684
- getClient = _this$context6.getClient;
1884
+ var _this$context7 = this.context,
1885
+ touch = _this$context7.touch,
1886
+ getClient = _this$context7.getClient;
1685
1887
  (0, _jquery.default)(window).bind(touch ? 'touchmove' : 'mousemove', _jquery.default.proxy(this.resizeMove, this));
1686
1888
  (0, _jquery.default)(window).bind(touch ? 'touchend' : 'mouseup', _jquery.default.proxy(this.resizeUp, this));
1687
1889
  this.resizeDetails = {
@@ -1695,9 +1897,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1695
1897
  }, {
1696
1898
  key: "resizeMove",
1697
1899
  value: function resizeMove(e) {
1698
- var _this$context7 = this.context,
1699
- rtl = _this$context7.rtl,
1700
- getClient = _this$context7.getClient;
1900
+ var _this$context8 = this.context,
1901
+ rtl = _this$context8.rtl,
1902
+ getClient = _this$context8.getClient;
1701
1903
  var Client = getClient(e);
1702
1904
  var _this$resizeDetails2 = this.resizeDetails,
1703
1905
  client = _this$resizeDetails2.client,
@@ -1724,13 +1926,20 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1724
1926
  var touch = this.context.touch;
1725
1927
  (0, _jquery.default)(window).unbind(touch ? 'touchmove' : 'mousemove', this.resizeMove);
1726
1928
  (0, _jquery.default)(window).unbind(touch ? 'touchend' : 'mouseup', this.resizeUp);
1727
- var _this$context8 = this.context,
1728
- columns = _this$context8.columns,
1729
- SetState = _this$context8.SetState;
1929
+ var _this$context9 = this.context,
1930
+ columns = _this$context9.columns,
1931
+ SetState = _this$context9.SetState;
1730
1932
  var _this$resizeDetails3 = this.resizeDetails,
1731
1933
  index = _this$resizeDetails3.index,
1732
1934
  newWidth = _this$resizeDetails3.newWidth;
1733
- columns[index].width = newWidth;
1935
+ var column = columns[index];
1936
+ column.width = newWidth;
1937
+
1938
+ if (column.storageKey) {
1939
+ column._storageObj.width = newWidth;
1940
+ localStorage.setItem('aio-table-column-storage-' + column.storageKey, JSON.stringify(column._storageObj));
1941
+ }
1942
+
1734
1943
  SetState({
1735
1944
  columns: columns
1736
1945
  });
@@ -1753,10 +1962,10 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1753
1962
  key: "arrow",
1754
1963
  value: function arrow(e) {
1755
1964
  var container = (0, _jquery.default)(this.dom.current);
1756
- var _this$context9 = this.context,
1757
- rtl = _this$context9.rtl,
1758
- focused = _this$context9.focused,
1759
- SetState = _this$context9.SetState;
1965
+ var _this$context10 = this.context,
1966
+ rtl = _this$context10.rtl,
1967
+ focused = _this$context10.focused,
1968
+ SetState = _this$context10.SetState;
1760
1969
  var columns = this.props.columns;
1761
1970
  var inputs = container.find('.aio-table-input');
1762
1971
 
@@ -1840,23 +2049,22 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1840
2049
  }, {
1841
2050
  key: "card",
1842
2051
  value: function card() {
1843
- var _this14 = this;
2052
+ var _this13 = this;
1844
2053
 
1845
- var _this$context10 = this.context,
1846
- indent = _this$context10.indent,
1847
- _onMouseEnter = _this$context10.onMouseEnter,
1848
- _onScroll = _this$context10.onScroll,
1849
- rowHeight = _this$context10.rowHeight,
1850
- _this$context10$cardG = _this$context10.cardGap,
1851
- cardGap = _this$context10$cardG === void 0 ? 0 : _this$context10$cardG,
1852
- getLoading = _this$context10.getLoading,
1853
- cardTemplate = _this$context10.cardTemplate,
1854
- _this$context10$cardR = _this$context10.cardRowCount,
1855
- cardRowCount = _this$context10$cardR === void 0 ? 1 : _this$context10$cardR,
1856
- rowGap = _this$context10.rowGap,
1857
- _this$context10$cardT = _this$context10.cardType,
1858
- cardType = _this$context10$cardT === void 0 ? 'html' : _this$context10$cardT,
1859
- columnGap = _this$context10.columnGap;
2054
+ var _this$context11 = this.context,
2055
+ indent = _this$context11.indent,
2056
+ _onMouseEnter = _this$context11.onMouseEnter,
2057
+ _onScroll = _this$context11.onScroll,
2058
+ rowHeight = _this$context11.rowHeight,
2059
+ _this$context11$cardG = _this$context11.cardGap,
2060
+ cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
2061
+ getLoading = _this$context11.getLoading,
2062
+ cardTemplate = _this$context11.cardTemplate,
2063
+ _this$context11$cardR = _this$context11.cardRowCount,
2064
+ cardRowCount = _this$context11$cardR === void 0 ? 1 : _this$context11$cardR,
2065
+ rowGap = _this$context11.rowGap,
2066
+ columnGap = _this$context11.columnGap,
2067
+ toggleRow = _this$context11.toggleRow;
1860
2068
  var _this$props10 = this.props,
1861
2069
  rows = _this$props10.rows,
1862
2070
  id = _this$props10.id,
@@ -1893,50 +2101,47 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1893
2101
  return _onScroll(e, index);
1894
2102
  }
1895
2103
  }, rows && rows.length !== 0 && rows.map(function (row, i) {
1896
- if (row._groupField) {
2104
+ if (row._groupId) {
1897
2105
  var width = indent * row._level;
1898
2106
  return /*#__PURE__*/_react.default.createElement("div", {
1899
2107
  className: "aio-table-group",
1900
2108
  key: 'group' + i + '-' + index,
1901
2109
  style: groupStyle
1902
- }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2110
+ }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1903
2111
  style: {
1904
- width: width
2112
+ width: width,
2113
+ flexShrink: 0
1905
2114
  }
1906
- }), _this14.getGroupToggleIcon(row), row._groupText));
1907
- }
1908
-
1909
- if (cardType === 'layout') {
1910
- return /*#__PURE__*/_react.default.createElement("div", {
1911
- className: "aio-table-card"
1912
- }, /*#__PURE__*/_react.default.createElement(RLayout, {
1913
- gap: cardGap,
1914
- layout: cardTemplate(row.row)
1915
- }));
2115
+ }), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2116
+ className: "aio-table-group-text"
2117
+ }, row._groupValue)));
1916
2118
  }
1917
2119
 
1918
2120
  return /*#__PURE__*/_react.default.createElement("div", {
2121
+ key: i + '-' + index,
1919
2122
  className: "aio-table-card"
1920
- }, cardTemplate(row.row));
2123
+ }, cardTemplate(row.row, function () {
2124
+ return toggleRow(row.row);
2125
+ }));
1921
2126
  }), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
1922
2127
  }
1923
2128
  }, {
1924
2129
  key: "render",
1925
2130
  value: function render() {
1926
- var _this15 = this;
2131
+ var _this14 = this;
1927
2132
 
1928
2133
  if (this.context.cardTemplate) {
1929
2134
  return this.card();
1930
2135
  }
1931
2136
 
1932
- var _this$context11 = this.context,
1933
- indent = _this$context11.indent,
1934
- _onMouseEnter2 = _this$context11.onMouseEnter,
1935
- _onScroll2 = _this$context11.onScroll,
1936
- rowHeight = _this$context11.rowHeight,
1937
- groups = _this$context11.groups,
1938
- getLoading = _this$context11.getLoading,
1939
- cardTemplate = _this$context11.cardTemplate;
2137
+ var _this$context12 = this.context,
2138
+ indent = _this$context12.indent,
2139
+ _onMouseEnter2 = _this$context12.onMouseEnter,
2140
+ _onScroll2 = _this$context12.onScroll,
2141
+ rowHeight = _this$context12.rowHeight,
2142
+ groups = _this$context12.groups,
2143
+ getLoading = _this$context12.getLoading,
2144
+ cardTemplate = _this$context12.cardTemplate;
1940
2145
  var _this$props11 = this.props,
1941
2146
  rows = _this$props11.rows,
1942
2147
  id = _this$props11.id,
@@ -1959,49 +2164,31 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1959
2164
  return _onScroll2(e, index);
1960
2165
  }
1961
2166
  }, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
1962
- if (row._groupField) {
2167
+ if (row._groupId) {
1963
2168
  var width = indent * row._level;
1964
2169
  return /*#__PURE__*/_react.default.createElement("div", {
1965
2170
  className: "aio-table-group",
1966
2171
  key: 'group' + i + '-' + index,
1967
- style: { ..._this15.getFullCellStyle(),
2172
+ style: { ..._this14.getFullCellStyle(),
1968
2173
  height: rowHeight
1969
2174
  }
1970
- }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2175
+ }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1971
2176
  style: {
1972
- width: width
2177
+ width: width,
2178
+ flexShrink: 0
1973
2179
  }
1974
- }), _this15.getGroupToggleIcon(row), row._groupText));
1975
- }
1976
-
1977
- if (type === 'freeze') {
1978
- return row.freezeCells.map(function (r, j) {
1979
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
1980
- key: i + '-' + j + '-' + index,
1981
- cellId: i + '-' + j + '-' + index
1982
- }, r, {
1983
- relativeFilter: row.show === 'relativeFilter'
1984
- }));
1985
- });
2180
+ }), _this14.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2181
+ className: "aio-table-group-text"
2182
+ }, row._groupValue)));
1986
2183
  }
1987
2184
 
1988
- if (type === 'unFreeze') {
1989
- return row.unFreezeCells.map(function (r, j) {
1990
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
1991
- key: i + '-' + j + '-' + index,
1992
- cellId: i + '-' + j + '-' + index
1993
- }, r, {
1994
- relativeFilter: row.show === 'relativeFilter'
1995
- }));
1996
- });
1997
- }
1998
-
1999
- return row.cells.map(function (r, j) {
2000
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
2001
- key: i + '-' + j + '-' + index,
2002
- cellId: i + '-' + j + '-' + index
2185
+ return row[type].map(function (r, j) {
2186
+ var id = i + '-' + j + '-' + index;
2187
+ return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
2188
+ key: id,
2189
+ cellId: id
2003
2190
  }, r, {
2004
- relativeFilter: row.show === 'relativeFilter'
2191
+ row: row.row
2005
2192
  }));
2006
2193
  });
2007
2194
  }), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
@@ -2013,28 +2200,28 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
2013
2200
 
2014
2201
  _defineProperty(RTableUnit, "contextType", AioTableContext);
2015
2202
 
2016
- var RTableCell = /*#__PURE__*/function (_Component4) {
2017
- _inherits(RTableCell, _Component4);
2203
+ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2204
+ _inherits(AIOTableCell, _Component4);
2018
2205
 
2019
- var _super4 = _createSuper(RTableCell);
2206
+ var _super4 = _createSuper(AIOTableCell);
2020
2207
 
2021
- function RTableCell(props) {
2022
- var _this16;
2208
+ function AIOTableCell(props) {
2209
+ var _this15;
2023
2210
 
2024
- _classCallCheck(this, RTableCell);
2211
+ _classCallCheck(this, AIOTableCell);
2025
2212
 
2026
- _this16 = _super4.call(this, props);
2027
- _this16.dom = /*#__PURE__*/(0, _react.createRef)();
2028
- var value = _this16.props.value;
2029
- _this16.state = {
2213
+ _this15 = _super4.call(this, props);
2214
+ _this15.dom = /*#__PURE__*/(0, _react.createRef)();
2215
+ var value = _this15.props.value;
2216
+ _this15.state = {
2030
2217
  value: value,
2031
2218
  error: false,
2032
2219
  prevValue: value
2033
2220
  };
2034
- return _this16;
2221
+ return _this15;
2035
2222
  }
2036
2223
 
2037
- _createClass(RTableCell, [{
2224
+ _createClass(AIOTableCell, [{
2038
2225
  key: "getBefore",
2039
2226
  value: function getBefore(row, column) {
2040
2227
  if (!column.before) {
@@ -2042,7 +2229,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2042
2229
  }
2043
2230
 
2044
2231
  var before = typeof column.before === 'function' ? column.before(row, column) : column.before;
2045
- 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", {
2046
2233
  className: "aio-table-icon"
2047
2234
  }, before), this.context.getGap());
2048
2235
  }
@@ -2054,7 +2241,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2054
2241
  }
2055
2242
 
2056
2243
  var after = typeof column.after === 'function' ? column.after(row, column) : column.after;
2057
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2244
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2058
2245
  style: {
2059
2246
  flex: 1
2060
2247
  }
@@ -2069,14 +2256,12 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2069
2256
  padding = _column$padding2 === void 0 ? '36px' : _column$padding2,
2070
2257
  template = column.template,
2071
2258
  _column$minWidth = column.minWidth,
2072
- minWidth = _column$minWidth === void 0 ? '30px' : _column$minWidth,
2073
- justify = column.justify;
2259
+ minWidth = _column$minWidth === void 0 ? '30px' : _column$minWidth;
2074
2260
  var rowHeight = this.context.rowHeight;
2075
2261
  var style = {
2076
2262
  height: rowHeight,
2077
2263
  overflow: template ? undefined : 'hidden',
2078
- minWidth: minWidth,
2079
- justifyContent: justify ? 'center' : undefined
2264
+ minWidth: minWidth
2080
2265
  };
2081
2266
 
2082
2267
  if (column.template === 'gantt') {
@@ -2088,7 +2273,6 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2088
2273
  }, {
2089
2274
  key: "getClassName",
2090
2275
  value: function getClassName(row, column) {
2091
- var relativeFilter = this.props.relativeFilter;
2092
2276
  var className = 'aio-table-cell';
2093
2277
 
2094
2278
  if (column.template) {
@@ -2107,7 +2291,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2107
2291
  className += ' aio-table-cell-input';
2108
2292
  }
2109
2293
 
2110
- if (relativeFilter) {
2294
+ if (row._show === 'relativeFilter') {
2111
2295
  className += ' aio-table-relative-filter';
2112
2296
  }
2113
2297
 
@@ -2116,11 +2300,9 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2116
2300
  }, {
2117
2301
  key: "getToggleIcon",
2118
2302
  value: function getToggleIcon(row) {
2119
- var _this$context12 = this.context,
2120
- rtl = _this$context12.rtl,
2121
- id = _this$context12.id,
2122
- openDictionary = _this$context12.openDictionary,
2123
- SetState = _this$context12.SetState;
2303
+ var _this$context13 = this.context,
2304
+ rtl = _this$context13.rtl,
2305
+ toggleRow = _this$context13.toggleRow;
2124
2306
  var icon;
2125
2307
 
2126
2308
  if (!row._childsLength) {
@@ -2141,23 +2323,10 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2141
2323
  });
2142
2324
  }
2143
2325
 
2144
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2326
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2145
2327
  className: "aio-table-toggle",
2146
2328
  onClick: function onClick() {
2147
- if (row._id !== undefined) {
2148
- openDictionary[row._id] = !openDictionary[row._id];
2149
-
2150
- if (id !== undefined) {
2151
- localStorage.setItem('r table ' + id, JSON.stringify(openDictionary));
2152
- }
2153
-
2154
- SetState({
2155
- openDictionary: openDictionary
2156
- });
2157
- } else {
2158
- row._opened = !row._opened;
2159
- SetState({});
2160
- }
2329
+ return toggleRow(row);
2161
2330
  }
2162
2331
  }, icon), this.context.getGap());
2163
2332
  }
@@ -2166,13 +2335,14 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2166
2335
  value: function getContent(row, column, value) {
2167
2336
  var focused = this.context.focused;
2168
2337
  var content = '';
2338
+ var template = typeof column.template === 'function' ? column.template(row, column) : column.template;
2169
2339
 
2170
- if (column.template === 'slider') {
2340
+ if (template === 'slider') {
2171
2341
  content = /*#__PURE__*/_react.default.createElement(AIOSlider, {
2172
2342
  row: row,
2173
2343
  column: column
2174
2344
  });
2175
- } else if (column.template === 'gantt') {
2345
+ } else if (template === 'gantt') {
2176
2346
  var rtl = this.context.rtl;
2177
2347
  var getKeys = column.getKeys,
2178
2348
  _column$getColor = column.getColor,
@@ -2230,60 +2400,64 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2230
2400
  var flags = getFlags();
2231
2401
  content = /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
2232
2402
  start: 0,
2233
- editValue: function editValue(_ref) {
2234
- var value = _ref.value;
2403
+ editValue: function editValue(value) {
2235
2404
  return keys[value];
2236
2405
  },
2237
2406
  end: keys.length - 1,
2238
- points: [{
2239
- value: startIndex
2240
- }, {
2241
- value: endIndex,
2242
- fillStyle: {
2243
- background: backgroundColor,
2244
- backgroundImage: background
2245
- },
2246
- text: text === false ? undefined : /*#__PURE__*/_react.default.createElement("div", {
2247
- style: {
2248
- color: color
2249
- }
2250
- }, text)
2251
- }],
2252
- pin: {
2253
- step: 1,
2254
- style: {
2407
+ points: [startIndex, endIndex],
2408
+ fillStyle: function fillStyle(index) {
2409
+ if (index === 1) {
2410
+ return {
2411
+ background: backgroundColor,
2412
+ backgroundImage: background
2413
+ };
2414
+ }
2415
+ },
2416
+ getText: function getText(index) {
2417
+ if (index === 1 && text) {
2418
+ return text;
2419
+ }
2420
+ },
2421
+ textStyle: function textStyle() {
2422
+ return {
2423
+ color: color
2424
+ };
2425
+ },
2426
+ scaleStep: 1,
2427
+ scaleStyle: function scaleStyle(value) {
2428
+ var flag = flags.filter(function (o) {
2429
+ return keys.indexOf(o.value) === value;
2430
+ })[0];
2431
+
2432
+ if (flag) {
2433
+ return {
2434
+ background: flag.color,
2435
+ height: '100%',
2436
+ top: 0,
2437
+ zIndex: 100
2438
+ };
2439
+ }
2440
+
2441
+ return {
2255
2442
  height: '100%',
2256
2443
  top: 0,
2257
2444
  opacity: .4
2258
- },
2259
- items: flags.map(function (_ref2) {
2260
- var index = _ref2.index,
2261
- value = _ref2.value,
2262
- _ref2$color = _ref2.color,
2263
- color = _ref2$color === void 0 ? 'red' : _ref2$color;
2264
- var flag = index !== undefined ? index : keys.indexOf(value);
2265
- return {
2266
- value: flag,
2267
- style: {
2268
- background: color,
2269
- height: '100%',
2270
- top: 0
2271
- }
2272
- };
2273
- })
2445
+ };
2274
2446
  },
2275
- lineStyle: {
2276
- opacity: .4
2447
+ lineStyle: function lineStyle() {
2448
+ return {
2449
+ opacity: .4
2450
+ };
2277
2451
  }
2278
2452
  });
2279
- } else if (column.template && column.inlineEdit) {
2453
+ } else if (template && column.inlineEdit) {
2280
2454
  if (!focused) {
2281
- content = column.template(row, column);
2455
+ content = template;
2282
2456
  } else {
2283
2457
  content = this.getInput(row, column);
2284
2458
  }
2285
- } else if (column.template) {
2286
- content = column.template(row, column);
2459
+ } else if (template) {
2460
+ content = template;
2287
2461
  } else if (column.inlineEdit) {
2288
2462
  content = this.getInput(row, column);
2289
2463
  } else if (column.getValue) {
@@ -2291,6 +2465,14 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2291
2465
  }
2292
2466
 
2293
2467
  if (column.subText) {
2468
+ var subText;
2469
+
2470
+ try {
2471
+ subText = column.subText(row);
2472
+ } catch {
2473
+ subText = '';
2474
+ }
2475
+
2294
2476
  return /*#__PURE__*/_react.default.createElement("div", {
2295
2477
  style: {
2296
2478
  flex: 1,
@@ -2316,7 +2498,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2316
2498
  flex: 1,
2317
2499
  position: 'relative'
2318
2500
  }
2319
- }, column.subText(row)));
2501
+ }, subText));
2320
2502
  }
2321
2503
 
2322
2504
  return content;
@@ -2324,7 +2506,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2324
2506
  }, {
2325
2507
  key: "getInput",
2326
2508
  value: function getInput(row, column) {
2327
- var _this17 = this;
2509
+ var _this16 = this;
2328
2510
 
2329
2511
  var type = column.inlineEdit.type;
2330
2512
  var value = this.state.value;
@@ -2336,7 +2518,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2336
2518
  className: 'aio-table-input',
2337
2519
  rowindex: row._renderIndex,
2338
2520
  colindex: column._renderIndex,
2339
- value: value,
2521
+ value: value === null ? '' : value,
2340
2522
  disabled: disabled(row)
2341
2523
  };
2342
2524
 
@@ -2344,24 +2526,27 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2344
2526
  return /*#__PURE__*/_react.default.createElement("div", {
2345
2527
  className: 'aio-table-input-container'
2346
2528
  }, /*#__PURE__*/_react.default.createElement("input", _extends({}, props, {
2529
+ style: {
2530
+ textAlign: column.justify ? 'center' : undefined
2531
+ },
2347
2532
  onChange: function onChange(e) {
2348
- return _this17.setState({
2533
+ return _this16.setState({
2349
2534
  value: e.target.value
2350
2535
  });
2351
2536
  },
2352
2537
  onBlur: async function onBlur(e) {
2353
- _this17.setState({
2538
+ _this16.setState({
2354
2539
  loading: true
2355
2540
  });
2356
2541
 
2357
- var error = await column.inlineEdit.onChange(row, value);
2542
+ var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
2358
2543
 
2359
- _this17.setState({
2544
+ _this16.setState({
2360
2545
  loading: false
2361
2546
  });
2362
2547
 
2363
2548
  if (typeof error === 'string') {
2364
- _this17.setState({
2549
+ _this16.setState({
2365
2550
  error: error
2366
2551
  });
2367
2552
  }
@@ -2386,27 +2571,27 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2386
2571
  className: "aio-table-input-container"
2387
2572
  }, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
2388
2573
  onFocus: function onFocus() {
2389
- return _this17.focus = true;
2574
+ return _this16.focus = true;
2390
2575
  },
2391
2576
  onBlur: function onBlur() {
2392
- return _this17.focus = false;
2577
+ return _this16.focus = false;
2393
2578
  },
2394
2579
  onChange: async function onChange(e) {
2395
2580
  var value = e.target.value;
2396
2581
 
2397
- _this17.setState({
2582
+ _this16.setState({
2398
2583
  loading: true,
2399
2584
  value: value
2400
2585
  });
2401
2586
 
2402
2587
  var error = await column.inlineEdit.onChange(row, e.target.value);
2403
2588
 
2404
- _this17.setState({
2589
+ _this16.setState({
2405
2590
  loading: false
2406
2591
  });
2407
2592
 
2408
2593
  if (typeof error === 'string') {
2409
- _this17.setState({
2594
+ _this16.setState({
2410
2595
  error: error
2411
2596
  });
2412
2597
  }
@@ -2436,13 +2621,16 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2436
2621
  }, {
2437
2622
  key: "render",
2438
2623
  value: function render() {
2439
- var _this18 = this;
2624
+ var _this17 = this;
2440
2625
 
2441
- var _this$context13 = this.context,
2442
- indent = _this$context13.indent,
2443
- cubes2 = _this$context13.cubes2,
2444
- focused = _this$context13.focused,
2445
- SetState = _this$context13.SetState;
2626
+ var _this$context14 = this.context,
2627
+ indent = _this$context14.indent,
2628
+ cubes2 = _this$context14.cubes2,
2629
+ focused = _this$context14.focused,
2630
+ SetState = _this$context14.SetState,
2631
+ onDrag = _this$context14.onDrag,
2632
+ _onDrop = _this$context14.onDrop,
2633
+ onSwap = _this$context14.onSwap;
2446
2634
  var _this$props12 = this.props,
2447
2635
  row = _this$props12.row,
2448
2636
  column = _this$props12.column,
@@ -2456,9 +2644,9 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2456
2644
  });
2457
2645
  }
2458
2646
 
2459
- var _this$state2 = this.state,
2460
- error = _this$state2.error,
2461
- loading = _this$state2.loading;
2647
+ var _this$state3 = this.state,
2648
+ error = _this$state3.error,
2649
+ loading = _this$state3.loading;
2462
2650
  var content = this.getContent(row, column, value);
2463
2651
  var before = this.getBefore(row, column);
2464
2652
  var after = this.getAfter(row, column);
@@ -2473,19 +2661,25 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2473
2661
  cell = /*#__PURE__*/_react.default.createElement("div", {
2474
2662
  className: "aio-table-error",
2475
2663
  onClick: function onClick() {
2476
- _this18.setState({
2477
- value: _this18.props.value,
2664
+ _this17.setState({
2665
+ value: _this17.props.value,
2478
2666
  error: false
2479
2667
  });
2480
2668
  }
2481
2669
  }, error);
2482
2670
  } else {
2483
- cell = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
2671
+ var style = {
2672
+ justifyContent: column.justify !== false && !column.treeMode ? 'center' : undefined
2673
+ };
2674
+ cell = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
2484
2675
  className: "aio-table-indent",
2485
2676
  style: {
2486
2677
  width: row._level * indent
2487
2678
  }
2488
- }), showToggleIcon && this.getToggleIcon(row), before, content, after);
2679
+ }), showToggleIcon && this.getToggleIcon(row), before, /*#__PURE__*/_react.default.createElement("div", {
2680
+ className: "aio-table-content",
2681
+ style: style
2682
+ }, content), after);
2489
2683
  }
2490
2684
 
2491
2685
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -2493,6 +2687,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2493
2687
  tabIndex: 0,
2494
2688
  ref: this.dom,
2495
2689
  cellid: cellId,
2690
+ title: typeof content === 'string' ? content : '',
2496
2691
  rowindex: row._renderIndex,
2497
2692
  colindex: column._renderIndex,
2498
2693
  childindex: row._childIndex,
@@ -2502,6 +2697,16 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2502
2697
  childslength: row._childsLength,
2503
2698
  style: this.getStyle(column),
2504
2699
  className: this.getClassName(row, column),
2700
+ draggable: typeof onSwap === 'function' && column.swap,
2701
+ onDragOver: function onDragOver(e) {
2702
+ return e.preventDefault();
2703
+ },
2704
+ onDragStart: function onDragStart() {
2705
+ return onDrag(row);
2706
+ },
2707
+ onDrop: function onDrop() {
2708
+ return _onDrop(row);
2709
+ },
2505
2710
  onClick: function onClick(e) {
2506
2711
  if (column.inlineEdit) {
2507
2712
  if (focused !== cellId) {
@@ -2518,10 +2723,10 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2518
2723
  }
2519
2724
  }]);
2520
2725
 
2521
- return RTableCell;
2726
+ return AIOTableCell;
2522
2727
  }(_react.Component);
2523
2728
 
2524
- _defineProperty(RTableCell, "contextType", AioTableContext);
2729
+ _defineProperty(AIOTableCell, "contextType", AioTableContext);
2525
2730
 
2526
2731
  var AIOSlider = /*#__PURE__*/function (_Component5) {
2527
2732
  _inherits(AIOSlider, _Component5);
@@ -2529,14 +2734,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2529
2734
  var _super5 = _createSuper(AIOSlider);
2530
2735
 
2531
2736
  function AIOSlider(props) {
2532
- var _this19;
2737
+ var _this18;
2533
2738
 
2534
2739
  _classCallCheck(this, AIOSlider);
2535
2740
 
2536
- _this19 = _super5.call(this, props);
2537
- var _this19$props = _this19.props,
2538
- column = _this19$props.column,
2539
- row = _this19$props.row;
2741
+ _this18 = _super5.call(this, props);
2742
+ var _this18$props = _this18.props,
2743
+ column = _this18$props.column,
2744
+ row = _this18$props.row;
2540
2745
  var getValue = column.getValue;
2541
2746
  var value = getValue(row);
2542
2747
 
@@ -2544,11 +2749,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2544
2749
  value = [value];
2545
2750
  }
2546
2751
 
2547
- _this19.state = {
2752
+ _this18.state = {
2548
2753
  value: value
2549
2754
  };
2550
- _this19.updateMode = 'outside';
2551
- return _this19;
2755
+ _this18.updateMode = 'outside';
2756
+ return _this18;
2552
2757
  }
2553
2758
 
2554
2759
  _createClass(AIOSlider, [{
@@ -2567,7 +2772,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2567
2772
  }, {
2568
2773
  key: "render",
2569
2774
  value: function render() {
2570
- var _this20 = this;
2775
+ var _this19 = this;
2571
2776
 
2572
2777
  var _this$props13 = this.props,
2573
2778
  column = _this$props13.column,
@@ -2646,7 +2851,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2646
2851
  });
2647
2852
  }
2648
2853
 
2649
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
2854
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
2650
2855
  className: "aio-table-slider-value"
2651
2856
  }, editValue(value[0])), /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
2652
2857
  start: start,
@@ -2661,7 +2866,7 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2661
2866
  fillStyle: {
2662
2867
  height: '6px',
2663
2868
  borderRadius: '24px',
2664
- background: _this20.getBackground(value.length, i, color)
2869
+ background: _this19.getBackground(value.length, i, color)
2665
2870
  }
2666
2871
  };
2667
2872
  }),
@@ -2677,14 +2882,14 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2677
2882
  background: '#d5d5d5'
2678
2883
  },
2679
2884
  editable: typeof onChange === 'function',
2680
- onchange: function onchange(_ref3) {
2681
- var points = _ref3.points;
2885
+ onchange: function onchange(_ref) {
2886
+ var points = _ref.points;
2682
2887
 
2683
2888
  if (!onChange) {
2684
2889
  return;
2685
2890
  }
2686
2891
 
2687
- _this20.updateMode = 'onChange';
2892
+ _this19.updateMode = 'onChange';
2688
2893
  onChange(row, points.length > 1 ? points.map(function (p) {
2689
2894
  return p.value;
2690
2895
  }) : points[0].value);
@@ -2692,11 +2897,11 @@ var AIOSlider = /*#__PURE__*/function (_Component5) {
2692
2897
  pin: pinItems.length === 0 ? undefined : {
2693
2898
  items: pinItems
2694
2899
  },
2695
- ondrag: function ondrag(_ref4) {
2696
- var points = _ref4.points;
2697
- _this20.updateMode = 'onDrag';
2900
+ ondrag: function ondrag(_ref2) {
2901
+ var points = _ref2.points;
2902
+ _this19.updateMode = 'onDrag';
2698
2903
 
2699
- _this20.setState({
2904
+ _this19.setState({
2700
2905
  value: points.map(function (p) {
2701
2906
  return p.value;
2702
2907
  })
@@ -2725,17 +2930,22 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
2725
2930
  _createClass(RTableFilter, [{
2726
2931
  key: "render",
2727
2932
  value: function render() {
2728
- var _this$context14 = this.context,
2729
- filterDictionary = _this$context14.filterDictionary,
2730
- rtl = _this$context14.rtl;
2933
+ var _this$context15 = this.context,
2934
+ filterDictionary = _this$context15.filterDictionary,
2935
+ rtl = _this$context15.rtl;
2731
2936
  var column = this.props.column;
2732
2937
 
2733
2938
  if (!column.filter || column.search) {
2734
2939
  return null;
2735
2940
  }
2736
2941
 
2942
+ if (!filterDictionary[column._index]) {
2943
+ return null;
2944
+ }
2945
+
2737
2946
  var filters = filterDictionary[column._index].items;
2738
2947
  var icon = filters.length ? /*#__PURE__*/_react.default.createElement(_react2.Icon, {
2948
+ className: "has-filter",
2739
2949
  path: _js.mdiFilterMenu,
2740
2950
  size: 0.7
2741
2951
  }) : /*#__PURE__*/_react.default.createElement(_react2.Icon, {
@@ -2744,11 +2954,12 @@ var RTableFilter = /*#__PURE__*/function (_Component6) {
2744
2954
  });
2745
2955
  return /*#__PURE__*/_react.default.createElement("div", {
2746
2956
  className: "aio-table-filter-icon"
2747
- }, /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, {
2957
+ }, /*#__PURE__*/_react.default.createElement(_aioButton.default, {
2958
+ type: "button",
2748
2959
  rtl: rtl,
2749
2960
  openRelatedTo: ".aio-table",
2750
2961
  text: icon,
2751
- items: function items() {
2962
+ popOver: function popOver() {
2752
2963
  return /*#__PURE__*/_react.default.createElement(RTableFilterPopup, {
2753
2964
  column: column
2754
2965
  });
@@ -2776,10 +2987,10 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
2776
2987
  _createClass(RTableFilterPopup, [{
2777
2988
  key: "add",
2778
2989
  value: function add() {
2779
- var _this$context15 = this.context,
2780
- filterDictionary = _this$context15.filterDictionary,
2781
- SetState = _this$context15.SetState,
2782
- onChangeFilter = _this$context15.onChangeFilter;
2990
+ var _this$context16 = this.context,
2991
+ filterDictionary = _this$context16.filterDictionary,
2992
+ SetState = _this$context16.SetState,
2993
+ onChangeFilter = _this$context16.onChangeFilter;
2783
2994
  var column = this.props.column;
2784
2995
 
2785
2996
  filterDictionary[column._index].items.push({
@@ -2798,13 +3009,13 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
2798
3009
  }, {
2799
3010
  key: "render",
2800
3011
  value: function render() {
2801
- var _this21 = this;
3012
+ var _this20 = this;
2802
3013
 
2803
3014
  var column = this.props.column;
2804
- var _this$context16 = this.context,
2805
- filterDictionary = _this$context16.filterDictionary,
2806
- SetState = _this$context16.SetState,
2807
- translate = _this$context16.translate;
3015
+ var _this$context17 = this.context,
3016
+ filterDictionary = _this$context17.filterDictionary,
3017
+ SetState = _this$context17.SetState,
3018
+ translate = _this$context17.translate;
2808
3019
  var filters = filterDictionary[column._index].items;
2809
3020
  var booleanType = filterDictionary[column._index].booleanType;
2810
3021
  var filterItems = filters.map(function (filter, i) {
@@ -2835,7 +3046,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
2835
3046
  }, /*#__PURE__*/_react.default.createElement("button", {
2836
3047
  className: "aio-table-filter-add",
2837
3048
  onClick: function onClick() {
2838
- return _this21.add();
3049
+ return _this20.add();
2839
3050
  }
2840
3051
  }, translate('Add'))));
2841
3052
  }
@@ -2852,26 +3063,26 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2852
3063
  var _super8 = _createSuper(RTableFilterItem);
2853
3064
 
2854
3065
  function RTableFilterItem(props) {
2855
- var _this22;
3066
+ var _this21;
2856
3067
 
2857
3068
  _classCallCheck(this, RTableFilterItem);
2858
3069
 
2859
- _this22 = _super8.call(this, props);
2860
- var filter = _this22.props.filter;
2861
- _this22.state = {
3070
+ _this21 = _super8.call(this, props);
3071
+ var filter = _this21.props.filter;
3072
+ _this21.state = {
2862
3073
  value: filter.value,
2863
3074
  prevValue: filter.value
2864
3075
  };
2865
- return _this22;
3076
+ return _this21;
2866
3077
  }
2867
3078
 
2868
3079
  _createClass(RTableFilterItem, [{
2869
3080
  key: "remove",
2870
3081
  value: function remove(index) {
2871
- var _this$context17 = this.context,
2872
- filterDictionary = _this$context17.filterDictionary,
2873
- SetState = _this$context17.SetState,
2874
- onChangeFilter = _this$context17.onChangeFilter;
3082
+ var _this$context18 = this.context,
3083
+ filterDictionary = _this$context18.filterDictionary,
3084
+ SetState = _this$context18.SetState,
3085
+ onChangeFilter = _this$context18.onChangeFilter;
2875
3086
  var column = this.props.column;
2876
3087
 
2877
3088
  filterDictionary[column._index].items.splice(index, 1);
@@ -2887,7 +3098,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2887
3098
  }, {
2888
3099
  key: "changeValue",
2889
3100
  value: function changeValue(value) {
2890
- var _this23 = this;
3101
+ var _this22 = this;
2891
3102
 
2892
3103
  var onChangeFilter = this.context.onChangeFilter;
2893
3104
  clearTimeout(this.timeout);
@@ -2895,12 +3106,12 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2895
3106
  value: value
2896
3107
  });
2897
3108
  this.timeout = setTimeout(function () {
2898
- var _this23$context = _this23.context,
2899
- SetState = _this23$context.SetState,
2900
- filterDictionary = _this23$context.filterDictionary;
2901
- var _this23$props = _this23.props,
2902
- column = _this23$props.column,
2903
- index = _this23$props.index;
3109
+ var _this22$context = _this22.context,
3110
+ SetState = _this22$context.SetState,
3111
+ filterDictionary = _this22$context.filterDictionary;
3112
+ var _this22$props = _this22.props,
3113
+ column = _this22$props.column,
3114
+ index = _this22$props.index;
2904
3115
  filterDictionary[column._index].items[index].value = value;
2905
3116
 
2906
3117
  if (onChangeFilter) {
@@ -2915,13 +3126,13 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2915
3126
  }, {
2916
3127
  key: "render",
2917
3128
  value: function render() {
2918
- var _this24 = this;
3129
+ var _this23 = this;
2919
3130
 
2920
- var _this$context18 = this.context,
2921
- filterDictionary = _this$context18.filterDictionary,
2922
- SetState = _this$context18.SetState,
2923
- translate = _this$context18.translate,
2924
- onChangeFilter = _this$context18.onChangeFilter;
3131
+ var _this$context19 = this.context,
3132
+ filterDictionary = _this$context19.filterDictionary,
3133
+ SetState = _this$context19.SetState,
3134
+ translate = _this$context19.translate,
3135
+ onChangeFilter = _this$context19.onChangeFilter;
2925
3136
  var _this$props14 = this.props,
2926
3137
  filter = _this$props14.filter,
2927
3138
  column = _this$props14.column,
@@ -2973,7 +3184,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2973
3184
  type: type,
2974
3185
  value: value,
2975
3186
  onChange: function onChange(e) {
2976
- return _this24.changeValue(e.target.value);
3187
+ return _this23.changeValue(e.target.value);
2977
3188
  }
2978
3189
  }), /*#__PURE__*/_react.default.createElement("div", {
2979
3190
  style: {
@@ -2982,7 +3193,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2982
3193
  }), /*#__PURE__*/_react.default.createElement("div", {
2983
3194
  className: "aio-table-filter-remove",
2984
3195
  onClick: function onClick() {
2985
- return _this24.remove(index);
3196
+ return _this23.remove(index);
2986
3197
  }
2987
3198
  }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
2988
3199
  path: _js.mdiClose,
@@ -2994,238 +3205,4 @@ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
2994
3205
  return RTableFilterItem;
2995
3206
  }(_react.Component);
2996
3207
 
2997
- _defineProperty(RTableFilterItem, "contextType", AioTableContext);
2998
-
2999
- var RLayout = /*#__PURE__*/function (_Component9) {
3000
- _inherits(RLayout, _Component9);
3001
-
3002
- var _super9 = _createSuper(RLayout);
3003
-
3004
- function RLayout() {
3005
- var _this25;
3006
-
3007
- _classCallCheck(this, RLayout);
3008
-
3009
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3010
- args[_key2] = arguments[_key2];
3011
- }
3012
-
3013
- _this25 = _super9.call.apply(_super9, [this].concat(args));
3014
-
3015
- _defineProperty(_assertThisInitialized(_this25), "touch", 'ontouchstart' in document.documentElement);
3016
-
3017
- return _this25;
3018
- }
3019
-
3020
- _createClass(RLayout, [{
3021
- key: "eventHandler",
3022
- value: function eventHandler(event, action) {
3023
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'bind';
3024
- event = this.touch ? {
3025
- mousemove: "touchmove",
3026
- mouseup: "touchend"
3027
- }[event] : event;
3028
- (0, _jquery.default)(window).unbind(event, action);
3029
-
3030
- if (type === 'bind') {
3031
- (0, _jquery.default)(window).bind(event, action);
3032
- }
3033
- }
3034
- }, {
3035
- key: "getClient",
3036
- value: function getClient(e) {
3037
- return this.touch ? {
3038
- x: e.changedTouches[0].clientX,
3039
- y: e.changedTouches[0].clientY
3040
- } : {
3041
- x: e.clientX,
3042
- y: e.clientY
3043
- };
3044
- }
3045
- }, {
3046
- key: "getHtml",
3047
- value: function getHtml(obj, index, parentObj) {
3048
- var _this26 = this,
3049
- _ref6;
3050
-
3051
- var parent = parentObj || {};
3052
- var show = typeof obj.show === 'function' ? obj.show() : obj.show;
3053
-
3054
- if (show === false) {
3055
- return null;
3056
- }
3057
-
3058
- var childsAttrs = (typeof parent.childsAttrs === 'function' ? parent.childsAttrs(obj, index) : parent.childsAttrs) || {};
3059
- var childsProps = (typeof parent.childsProps === 'function' ? parent.childsProps(obj, index) : parent.childsProps) || {};
3060
- var parentDir = parent.row ? 'row' : 'column';
3061
- var dir = obj.row ? 'row' : 'column';
3062
- var gap = parent.gap === undefined ? this.gap : parent.gap;
3063
- var Size = obj.size === undefined ? childsProps.size : obj.size;
3064
- var size = typeof Size === 'function' ? Size() : Size;
3065
- var flex = obj.flex === undefined ? childsProps.flex : obj.flex;
3066
-
3067
- if (parentObj) {
3068
- flex = flex || 1;
3069
- }
3070
-
3071
- var hideInSmall = obj.hideInSmall === undefined ? childsProps.hideInSmall : obj.hideInSmall;
3072
- var hideInLarge = obj.hideInLarge === undefined ? childsProps.hideInLarge : obj.hideInLarge;
3073
- var align = obj.align === undefined ? childsProps.align : obj.align;
3074
- var onResize = obj.onResize;
3075
- var Childs = obj[dir] || [];
3076
- var childs = typeof Childs === 'function' ? Childs() : Childs;
3077
- var html = typeof obj.html === 'function' ? obj.html() : obj.html;
3078
- var attrs = (typeof obj.attrs === 'function' ? obj.attrs() : obj.attrs) || {};
3079
- var className = childs.length ? 'r-layout-parent' : 'r-layout-item';
3080
- var gapClassName = 'r-layout-gap';
3081
-
3082
- if (childsAttrs.className) {
3083
- className += ' ' + childsAttrs.className;
3084
- }
3085
-
3086
- if (attrs.className) {
3087
- className += ' ' + attrs.className;
3088
- }
3089
-
3090
- if (hideInLarge) {
3091
- className += ' r-layout-hide-in-large';
3092
- gapClassName += ' r-layout-hide-in-large';
3093
- }
3094
-
3095
- if (hideInSmall) {
3096
- className += ' r-layout-hide-in-small';
3097
- gapClassName += ' r-layout-hide-in-small';
3098
- }
3099
-
3100
- var style = { ...childsAttrs.style,
3101
- ...attrs.style
3102
- };
3103
-
3104
- if (align === 'v') {
3105
- style.alignItems = 'center';
3106
- } else if (align === 'h') {
3107
- style.justifyContent = 'center';
3108
- } else if (align === 'vh' || align === 'hv') {
3109
- style.alignItems = 'center';
3110
- style.justifyContent = 'center';
3111
- }
3112
-
3113
- var result;
3114
- var dataId = 'a' + Math.random();
3115
-
3116
- if (!childs.length) {
3117
- var _ref5;
3118
-
3119
- result = /*#__PURE__*/_react.default.createElement("div", _extends({}, childsAttrs, attrs, {
3120
- "data-id": dataId,
3121
- className: className,
3122
- style: (_ref5 = { ...style
3123
- }, _defineProperty(_ref5, parentDir === 'row' ? 'width' : 'height', size), _defineProperty(_ref5, "flex", !size ? flex : undefined), _ref5)
3124
- }), html);
3125
- } else {
3126
- var _Style;
3127
-
3128
- var Style = (_Style = { ...style,
3129
- flexDirection: dir
3130
- }, _defineProperty(_Style, parentDir === 'row' ? 'width' : 'height', size), _defineProperty(_Style, "flex", !size ? flex || 1 : undefined), _Style);
3131
- result = /*#__PURE__*/_react.default.createElement("div", _extends({}, childsAttrs, attrs, {
3132
- "data-id": dataId,
3133
- className: className,
3134
- style: Style
3135
- }), childs.map(function (o, i) {
3136
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
3137
- key: i
3138
- }, _this26.getHtml(o, i, obj));
3139
- }));
3140
- }
3141
-
3142
- var event = {},
3143
- axis,
3144
- cursor = '';
3145
-
3146
- if (size && onResize) {
3147
- if (parentDir === 'row') {
3148
- axis = 'x';
3149
- cursor = 'col-resize';
3150
- } else {
3151
- axis = 'y';
3152
- cursor = 'row-resize';
3153
- }
3154
-
3155
- event[this.touch ? 'onTouchStart' : 'onMouseDown'] = function (e) {
3156
- var pos = _this26.getClient(e);
3157
-
3158
- _this26.so = {
3159
- pos: pos,
3160
- onResize: onResize,
3161
- axis: axis,
3162
- size: size,
3163
- dataId: dataId
3164
- };
3165
-
3166
- _this26.eventHandler('mousemove', _jquery.default.proxy(_this26.mouseMove, _this26));
3167
-
3168
- _this26.eventHandler('mouseup', _jquery.default.proxy(_this26.mouseUp, _this26));
3169
- };
3170
- }
3171
-
3172
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
3173
- key: index
3174
- }, result, /*#__PURE__*/_react.default.createElement("div", _extends({
3175
- className: gapClassName,
3176
- draggable: false,
3177
- onDragStart: function onDragStart(e) {
3178
- return e.preventDefault();
3179
- },
3180
- style: (_ref6 = {}, _defineProperty(_ref6, {
3181
- 'row': 'width',
3182
- 'column': 'height'
3183
- }[parentDir], gap), _defineProperty(_ref6, "cursor", cursor), _ref6)
3184
- }, event)));
3185
- }
3186
- }, {
3187
- key: "mouseMove",
3188
- value: function mouseMove(e) {
3189
- var rtl = this.props.rtl;
3190
- var _this$so = this.so,
3191
- pos = _this$so.pos,
3192
- axis = _this$so.axis,
3193
- size = _this$so.size,
3194
- dataId = _this$so.dataId;
3195
- var client = this.getClient(e);
3196
- var offset = (client[axis] - pos[axis]) * (rtl ? -1 : 1);
3197
- this.so.newSize = offset + size;
3198
- var panel = (0, _jquery.default)('[data-id="' + dataId + '"]');
3199
- panel.css(_defineProperty({}, {
3200
- 'x': 'width',
3201
- 'y': 'height'
3202
- }[axis], this.so.newSize));
3203
- }
3204
- }, {
3205
- key: "mouseUp",
3206
- value: function mouseUp() {
3207
- this.eventHandler('mousemove', this.mouseMove, 'unbind');
3208
- this.eventHandler('mouseup', this.mouseUp, 'unbind');
3209
- var _this$so2 = this.so,
3210
- onResize = _this$so2.onResize,
3211
- newSize = _this$so2.newSize;
3212
- onResize(newSize);
3213
- }
3214
- }, {
3215
- key: "render",
3216
- value: function render() {
3217
- var _this$props15 = this.props,
3218
- gap = _this$props15.gap,
3219
- layout = _this$props15.layout;
3220
- this.gap = gap;
3221
- return this.getHtml(layout, 0);
3222
- }
3223
- }]);
3224
-
3225
- return RLayout;
3226
- }(_react.Component);
3227
-
3228
- RLayout.defaultProps = {
3229
- gap: 12,
3230
- layout: {}
3231
- };
3208
+ _defineProperty(RTableFilterItem, "contextType", AioTableContext);