aio-table 2.1.0 → 5.0.1

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 +792 -1
  2. package/index.css +119 -44
  3. package/index.js +1521 -687
  4. package/package.json +3 -3
package/index.js CHANGED
@@ -11,18 +11,18 @@ 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
18
  var _js = require("@mdi/js");
19
19
 
20
+ var _jquery = _interopRequireDefault(require("jquery"));
21
+
20
22
  var _rRangeSlider = _interopRequireDefault(require("r-range-slider"));
21
23
 
22
24
  require("./index.css");
23
25
 
24
- var _jquery = _interopRequireDefault(require("jquery"));
25
-
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -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
 
@@ -65,60 +65,110 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
65
65
 
66
66
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
67
67
 
68
- var RTableContext = /*#__PURE__*/(0, _react.createContext)();
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;
82
82
  _this.dom = /*#__PURE__*/(0, _react.createRef)();
83
83
  var _this$props = _this.props,
84
84
  id = _this$props.id,
85
- dataset = _this$props.dataset,
86
- freezeSize = _this$props.freezeSize;
87
- _this.dataset = dataset;
88
- var openDictionary = {};
85
+ freezeSize = _this$props.freezeSize,
86
+ sorts = _this$props.sorts,
87
+ paging = _this$props.paging,
88
+ columns = _this$props.columns;
89
+ var openDictionary = {},
90
+ groupDictionary = {};
89
91
 
90
92
  if (id !== undefined) {
91
- openDictionary = localStorage.getItem('r table ' + id);
93
+ openDictionary = localStorage.getItem('aio table ' + id);
92
94
 
93
95
  if (openDictionary === null || openDictionary === undefined) {
94
- localStorage.setItem('r table ' + id, '{}');
96
+ localStorage.setItem('aio table ' + id, '{}');
95
97
  openDictionary = {};
96
98
  } else {
97
99
  openDictionary = JSON.parse(openDictionary);
98
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
+ }
99
110
  }
100
111
 
101
- _this.activeTableIndex = 0;
112
+ (0, _jquery.default)(window).bind('click', function (e) {
113
+ var focused = _this.state.focused;
114
+
115
+ if (focused === false) {
116
+ return;
117
+ }
118
+
119
+ var target = (0, _jquery.default)(e.target);
120
+
121
+ if (target.parents('.aio-table-cell').length !== 0 || target.hasClass('aio-table-cell')) {
122
+ return;
123
+ }
124
+
125
+ _this.setState({
126
+ focused: false
127
+ });
128
+ });
102
129
  _this.state = {
103
130
  openDictionary: openDictionary,
104
131
  filterDictionary: {},
105
132
  groupsOpen: {},
106
- freezeSize: freezeSize
133
+ freezeSize: freezeSize,
134
+ groupDictionary: groupDictionary,
135
+ sorts: sorts,
136
+ paging: paging,
137
+ columns: columns,
138
+ focused: false,
139
+ toggleAllState: true,
140
+ searchText: ''
107
141
  };
108
142
  return _this;
109
143
  }
110
144
 
111
- _createClass(RTable, [{
145
+ _createClass(AIOTable, [{
112
146
  key: "onScroll",
113
147
  value: function onScroll(e, index) {
148
+ var _this2 = this;
149
+
114
150
  if (!this.freezeMode) {
115
151
  return;
116
152
  }
117
153
 
154
+ if (this.activeTableIndex === undefined) {
155
+ return;
156
+ }
157
+
118
158
  if (index !== this.activeTableIndex) {
159
+ this.onMouseEnter(index);
160
+ clearTimeout(this.timeo);
161
+ this.timeo = setTimeout(function () {
162
+ return _this2.bindScroll();
163
+ }, 40);
119
164
  return;
120
165
  }
121
166
 
167
+ this.bindScroll();
168
+ }
169
+ }, {
170
+ key: "bindScroll",
171
+ value: function bindScroll() {
122
172
  var units = (0, _jquery.default)(this.dom.current).find('.aio-table-unit');
123
173
  var scrollTop = units.eq(this.activeTableIndex).scrollTop();
124
174
  units.eq(this.deactiveTableIndex).scrollTop(scrollTop);
@@ -129,49 +179,20 @@ var RTable = /*#__PURE__*/function (_Component) {
129
179
  this.activeTableIndex = index;
130
180
  this.deactiveTableIndex = index === 0 ? 1 : 0;
131
181
  }
132
- }, {
133
- key: "getValueByField",
134
- value: function getValueByField(obj, field) {
135
- var fieldString = typeof field === 'function' ? field(obj) : field;
136
-
137
- if (!fieldString || typeof fieldString !== 'string') {
138
- console.error('Grid.getValueByField() receive invalid field');
139
- return undefined;
140
- }
141
-
142
- var fields = fieldString.split('.');
143
- var value = obj[fields[0]];
144
-
145
- if (value === undefined) {
146
- return;
147
- }
148
-
149
- for (var i = 1; i < fields.length; i++) {
150
- value = value[fields[i]];
151
-
152
- if (value === undefined || value === null) {
153
- return;
154
- }
155
- }
156
-
157
- return value;
158
- }
159
182
  }, {
160
183
  key: "getGap",
161
184
  value: function getGap() {
162
- var cellGap = this.props.cellGap;
163
185
  return /*#__PURE__*/_react.default.createElement("div", {
164
186
  className: "aio-table-gap",
165
187
  style: {
166
- width: cellGap
188
+ width: this.props.cellGap
167
189
  }
168
190
  });
169
191
  }
170
192
  }, {
171
193
  key: "getClient",
172
194
  value: function getClient(e) {
173
- var touch = this.context.touch;
174
- return touch ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY];
195
+ return this.context.touch ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [e.clientX, e.clientY];
175
196
  }
176
197
  }, {
177
198
  key: "resizeDown",
@@ -214,41 +235,67 @@ var RTable = /*#__PURE__*/function (_Component) {
214
235
  freezeSize: this.resizeDetails.newWidth
215
236
  });
216
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
+ }
217
260
  }, {
218
261
  key: "getTable",
219
- value: function getTable() {
220
- var _this2 = this;
262
+ value: function getTable(Toolbar) {
263
+ var _this3 = this;
221
264
 
222
265
  var rows = this.getRows();
266
+ this.rows = rows;
223
267
 
224
268
  if (!this.freezeMode) {
225
269
  return /*#__PURE__*/_react.default.createElement("div", {
226
- className: 'aio-table-body'
270
+ className: 'aio-table-body',
271
+ style: this.getBodyStyle(Toolbar)
227
272
  }, /*#__PURE__*/_react.default.createElement(RTableUnit, {
228
273
  rows: rows,
229
- columns: this.visibleColumns
274
+ columns: this.visibleColumns,
275
+ type: "cells"
230
276
  }));
231
277
  } else {
232
278
  var freezeSize = this.state.freezeSize;
233
279
  return /*#__PURE__*/_react.default.createElement("div", {
234
- className: 'aio-table-body'
280
+ className: 'aio-table-body',
281
+ style: this.getBodyStyle(Toolbar)
235
282
  }, /*#__PURE__*/_react.default.createElement(RTableUnit, {
236
283
  key: 0,
237
284
  id: "aio-table-first-split",
238
285
  rows: rows,
239
286
  columns: this.freezeColumns,
240
287
  index: 0,
241
- type: "freeze",
288
+ type: "freezeCells",
242
289
  style: {
243
290
  width: freezeSize
244
291
  }
245
292
  }), /*#__PURE__*/_react.default.createElement("div", {
246
293
  className: "aio-table-splitter",
247
294
  onMouseDown: function onMouseDown(e) {
248
- return _this2.resizeDown(e);
295
+ return _this3.resizeDown(e);
249
296
  },
250
297
  onTouchStart: function onTouchStart(e) {
251
- return _this2.resizeDown(e);
298
+ return _this3.resizeDown(e);
252
299
  }
253
300
  }), true && /*#__PURE__*/_react.default.createElement(RTableUnit, {
254
301
  key: 1,
@@ -256,54 +303,76 @@ var RTable = /*#__PURE__*/function (_Component) {
256
303
  rows: rows,
257
304
  columns: this.unFreezeColumns,
258
305
  index: 1,
259
- type: "unFreeze"
306
+ type: "unFreezeCells"
260
307
  }));
261
308
  }
262
309
  }
263
310
  }, {
264
311
  key: "convertFlat",
265
- value: function convertFlat(model) {
266
- var _this3 = this;
267
-
312
+ value: function convertFlat(model, getId, getParentId, childsField) {
268
313
  var convertModelRecursive = function convertModelRecursive(array, parentId, parentObject) {
269
314
  for (var i = 0; i < array.length; i++) {
270
315
  var row = array[i];
316
+ var rowParentId = getParentId(row);
271
317
 
272
- if (row._parentId === undefined) {
273
- row._parentId = _this3.getValueByField(row, _this3.dataset.parentId);
274
- _this3.perf++;
275
- }
276
-
277
- if (row._parentId !== parentId) {
318
+ if (rowParentId !== parentId) {
278
319
  continue;
279
320
  }
280
321
 
281
- var rowId = _this3.getValueByField(row, _this3.dataset.id);
282
-
283
- row._childs = [];
322
+ var rowId = getId(row);
323
+ row[childsField] = [];
284
324
  parentObject.push(row);
285
-
286
- var newArray = _toConsumableArray(array);
287
-
288
- newArray.splice(i, 1);
289
325
  array.splice(i, 1);
290
326
  i--;
291
- convertModelRecursive(newArray, rowId, row._childs);
327
+ convertModelRecursive(_toConsumableArray(array), rowId, row[childsField]);
292
328
  }
293
329
  };
294
330
 
295
- this.dataset.childs = '_childs';
296
331
  var result = [];
297
332
  convertModelRecursive(_toConsumableArray(model), undefined, result);
298
333
  return result;
299
334
  }
335
+ }, {
336
+ key: "sort",
337
+ value: function sort(model) {
338
+ var _this4 = this;
339
+
340
+ var newModel = model.sort(function (a, b) {
341
+ for (var i = 0; i < _this4.sorts.length; i++) {
342
+ var _this4$sorts$i = _this4.sorts[i],
343
+ getValue = _this4$sorts$i.getValue,
344
+ type = _this4$sorts$i.type;
345
+ var aValue = getValue(a),
346
+ bValue = getValue(b);
347
+
348
+ if (aValue < bValue) {
349
+ return -1 * (type === 'dec' ? -1 : 1);
350
+ }
351
+
352
+ if (aValue > bValue) {
353
+ return 1 * (type === 'dec' ? -1 : 1);
354
+ }
355
+
356
+ if (i !== _this4.sorts.length - 1) {
357
+ continue;
358
+ }
359
+
360
+ return 0;
361
+ }
362
+
363
+ return 0;
364
+ });
365
+ return newModel;
366
+ }
300
367
  }, {
301
368
  key: "getRows",
302
369
  value: function getRows() {
303
370
  var _this$props2 = this.props,
304
371
  model = _this$props2.model,
305
- flat = _this$props2.flat,
306
- paging = _this$props2.paging;
372
+ getRowId = _this$props2.getRowId,
373
+ getRowParentId = _this$props2.getRowParentId,
374
+ onChangeSort = _this$props2.onChangeSort;
375
+ var paging = this.state.paging;
307
376
 
308
377
  if (!model) {
309
378
  return false;
@@ -313,21 +382,19 @@ var RTable = /*#__PURE__*/function (_Component) {
313
382
  this.rowRenderIndex = 0;
314
383
  this.rowRealIndex = 0;
315
384
  this.perf = 0;
316
- var convertedModel = flat ? this.convertFlat(_toConsumableArray(model)) : _toConsumableArray(model);
317
- var groupedModel = this.getModelByGroup(convertedModel);
318
- this.getRowsReq(groupedModel, rows, 0, []);
319
- this.roots = [];
385
+ var convertedModel = getRowParentId ? this.convertFlat(_toConsumableArray(model), getRowId, getRowParentId, '_childs') : _toConsumableArray(model);
320
386
 
321
- if (!paging || paging.outSide) {
322
- return rows;
387
+ if (this.sorts.length && !onChangeSort) {
388
+ convertedModel = this.sort(convertedModel);
323
389
  }
324
390
 
391
+ this.getRowsReq(convertedModel, rows, 0, []);
325
392
  var roots = [];
326
393
 
327
- for (var i = 0; i < rows.length; i++) {
328
- var row = rows[i];
394
+ for (var _i = 0; _i < rows.length; _i++) {
395
+ var row = rows[_i];
329
396
 
330
- if (row.show === false) {
397
+ if (row.row._show === false) {
331
398
  continue;
332
399
  }
333
400
 
@@ -338,16 +405,28 @@ var RTable = /*#__PURE__*/function (_Component) {
338
405
  roots[roots.length - 1].push(row);
339
406
  }
340
407
 
341
- return this.getRowsByPaging(roots);
408
+ if (paging) {
409
+ roots = this.getRowsByPaging(roots);
410
+ }
411
+
412
+ if (this.groups.length) {
413
+ roots = this.getModelByGroup(roots);
414
+ }
415
+
416
+ var Rows = [];
417
+
418
+ for (var i = 0; i < roots.length; i++) {
419
+ Rows = Rows.concat(roots[i]);
420
+ }
421
+
422
+ return Rows;
342
423
  }
343
424
  }, {
344
425
  key: "getRowsByPaging",
345
426
  value: function getRowsByPaging(roots) {
346
- var paging = this.props.paging;
347
- var length = roots.length;
427
+ var paging = this.state.paging;
428
+ var length = paging.onChange ? paging.count : roots.length;
348
429
  paging.pages = Math.ceil(length / paging.size);
349
- var start = 0;
350
- var end = length;
351
430
 
352
431
  if (paging.number > Math.ceil(length / paging.size)) {
353
432
  paging.number = Math.ceil(length / paging.size);
@@ -357,53 +436,46 @@ var RTable = /*#__PURE__*/function (_Component) {
357
436
  }
358
437
  }
359
438
 
360
- start = (paging.number - 1) * paging.size;
361
- end = start + paging.size;
362
- this.rowRealIndex = start;
363
- var Rows = [];
439
+ if (paging.onChange) {
440
+ return roots;
441
+ } //اگر پیجینگ آنچنج داشت تغییری در ردیف ها نده و اجازه بده تغییرات در آنچنج روی مدل ورودی انجام شود
364
442
 
365
- for (var i = start; i <= end; i++) {
366
- var root = roots[i];
367
443
 
368
- if (!root) {
369
- continue;
370
- }
444
+ var start = (paging.number - 1) * paging.size;
445
+ var end = start + paging.size;
371
446
 
372
- Rows = Rows.concat(root);
447
+ if (end > length) {
448
+ end = length;
373
449
  }
374
450
 
375
- return Rows;
451
+ this.rowRealIndex = start;
452
+ return roots.slice(start, end);
376
453
  }
377
454
  }, {
378
455
  key: "getModelByGroup",
379
- value: function getModelByGroup(model) {
380
- var _this4 = this;
381
-
382
- if (!this.groupByMode) {
383
- return model;
384
- }
385
-
456
+ value: function getModelByGroup(roots) {
386
457
  var groupsOpen = this.state.groupsOpen;
387
458
  var groups = this.groups;
388
459
 
389
- function msf(obj, _level) {
390
- var _parentField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
391
-
460
+ function msf(obj, _level, parents) {
392
461
  if (Array.isArray(obj)) {
393
462
  groupedRows = groupedRows.concat(obj);
394
463
  } else {
395
464
  for (var prop in obj) {
396
- 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];
397
470
  groupedRows.push({
398
- _groupField: prop,
399
- _groupText: prop,
471
+ _groupValue: prop,
472
+ _groupId: _groupId,
400
473
  _level: _level,
401
- _opened: groupsOpen[_parentField + prop],
402
- _parentField: _parentField
474
+ _opened: groupsOpen[_groupId]
403
475
  });
404
476
 
405
- if (groupsOpen[_parentField + prop]) {
406
- msf(obj[prop], _level + 1, _parentField + prop);
477
+ if (groupsOpen[_groupId]) {
478
+ msf(obj[prop], _level + 1, newParents);
407
479
  }
408
480
  }
409
481
  }
@@ -412,14 +484,10 @@ var RTable = /*#__PURE__*/function (_Component) {
412
484
  var newModel = {};
413
485
 
414
486
  var _loop = function _loop(i) {
415
- var row = model[i];
487
+ var root = roots[i];
416
488
  obj = newModel;
417
489
  var values = groups.map(function (group) {
418
- if (typeof group.field === 'function') {
419
- return group.field(row);
420
- } else {
421
- return _this4.getValueByField(row, group.field);
422
- }
490
+ return group.getValue(root[0].row);
423
491
  });
424
492
 
425
493
  for (var j = 0; j < values.length; j++) {
@@ -427,7 +495,7 @@ var RTable = /*#__PURE__*/function (_Component) {
427
495
 
428
496
  if (j === values.length - 1) {
429
497
  obj[value] = obj[value] || [];
430
- obj[value].push(row);
498
+ obj[value].push(root);
431
499
  } else {
432
500
  obj[value] = obj[value] || {};
433
501
  obj = obj[value];
@@ -435,7 +503,7 @@ var RTable = /*#__PURE__*/function (_Component) {
435
503
  }
436
504
  };
437
505
 
438
- for (var i = 0; i < model.length; i++) {
506
+ for (var i = 0; i < roots.length; i++) {
439
507
  var obj;
440
508
 
441
509
  _loop(i);
@@ -443,18 +511,33 @@ var RTable = /*#__PURE__*/function (_Component) {
443
511
 
444
512
  var groupedRows = [];
445
513
  var _level = 0;
446
- msf(newModel, _level);
514
+ msf(newModel, _level, []);
447
515
  return groupedRows;
448
516
  }
449
517
  }, {
450
518
  key: "getRowsReq",
451
519
  value: function getRowsReq(model, rows, _level, parents) {
452
520
  var openDictionary = this.state.openDictionary;
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;
526
+
527
+ if (getRowParentId) {
528
+ getRowChilds = function getRowChilds(row) {
529
+ return row._childs;
530
+ };
531
+ }
453
532
 
454
533
  for (var i = 0; i < model.length; i++) {
455
534
  var row = model[i];
456
535
 
457
- if (row._groupField) {
536
+ if (getRowVisible && getRowVisible(row) === false) {
537
+ continue;
538
+ }
539
+
540
+ if (row._groupId) {
458
541
  rows.push(row);
459
542
  continue;
460
543
  }
@@ -472,11 +555,11 @@ var RTable = /*#__PURE__*/function (_Component) {
472
555
  return parents;
473
556
  };
474
557
 
475
- if (this.dataset && this.dataset.id) {
476
- var id = this.getValueByField(row, this.dataset.id);
558
+ if (getRowId) {
559
+ var id = getRowId(row);
477
560
 
478
561
  if (id === undefined) {
479
- console.error('RTable => id of row is not defined, please check getId props of RTable');
562
+ console.error('AIOTable => id of row is not defined, please check getRowId props of AIOTable');
480
563
  }
481
564
 
482
565
  openDictionary[id] = openDictionary[id] === false ? false : true;
@@ -489,8 +572,8 @@ var RTable = /*#__PURE__*/function (_Component) {
489
572
  row._childsLength = 0;
490
573
  var childs = [];
491
574
 
492
- if (this.dataset && this.dataset.childs) {
493
- childs = this.getValueByField(row, this.dataset.childs) || [];
575
+ if (getRowChilds) {
576
+ childs = getRowChilds(row) || [];
494
577
  row._childsLength = childs.length;
495
578
  }
496
579
 
@@ -499,10 +582,8 @@ var RTable = /*#__PURE__*/function (_Component) {
499
582
  row: row
500
583
  });
501
584
 
502
- if (row._opened) {
503
- if (row._childsLength) {
504
- this.getRowsReq(childs, rows, _level + 1, parents.concat(row));
505
- }
585
+ if (row._opened && row._childsLength) {
586
+ this.getRowsReq(childs, rows, _level + 1, parents.concat(row));
506
587
  } else {
507
588
  this.rowRealIndex += row._childsLength;
508
589
  }
@@ -511,6 +592,10 @@ var RTable = /*#__PURE__*/function (_Component) {
511
592
  }, {
512
593
  key: "getFilterResult_and",
513
594
  value: function getFilterResult_and(filters, value) {
595
+ if (value === undefined) {
596
+ return false;
597
+ }
598
+
514
599
  for (var i = 0; i < filters.length; i++) {
515
600
  var filterItem = filters[i];
516
601
 
@@ -518,19 +603,19 @@ var RTable = /*#__PURE__*/function (_Component) {
518
603
  continue;
519
604
  }
520
605
 
521
- if (filterItem.operator === 'contain' && value.indexOf(filterItem.value) === -1) {
606
+ if (filterItem.operator === 'contain' && value.toString().toLowerCase().indexOf(filterItem.value.toString().toLowerCase()) === -1) {
522
607
  return false;
523
608
  }
524
609
 
525
- if (filterItem.operator === 'notContain' && value.indexOf(filterItem.value) !== -1) {
610
+ if (filterItem.operator === 'notContain' && value.toString().toLowerCase().indexOf(filterItem.value.toString().toLowerCase()) !== -1) {
526
611
  return false;
527
612
  }
528
613
 
529
- if (filterItem.operator === 'equal' && value !== filterItem.value) {
614
+ if (filterItem.operator === 'equal' && value.toString().toLowerCase() !== filterItem.value.toString().toLowerCase()) {
530
615
  return false;
531
616
  }
532
617
 
533
- if (filterItem.operator === 'notEqual' && value === filterItem.value) {
618
+ if (filterItem.operator === 'notEqual' && value.toString().toLowerCase() === filterItem.value.toString().toLowerCase()) {
534
619
  return false;
535
620
  }
536
621
 
@@ -548,6 +633,10 @@ var RTable = /*#__PURE__*/function (_Component) {
548
633
  }, {
549
634
  key: "getFilterResult_or",
550
635
  value: function getFilterResult_or(filters, value) {
636
+ if (value === undefined) {
637
+ return false;
638
+ }
639
+
551
640
  for (var i = 0; i < filters.length; i++) {
552
641
  var filterItem = filters[i];
553
642
 
@@ -555,27 +644,27 @@ var RTable = /*#__PURE__*/function (_Component) {
555
644
  return true;
556
645
  }
557
646
 
558
- if (filterItem.operator === 'contain' && value.indexOf(filterItem.value) !== -1) {
647
+ if (filterItem.operator === 'contain' && value.toString().toLowerCase().indexOf(filterItem.value.toString().toLowerCase()) !== -1) {
559
648
  return true;
560
649
  }
561
650
 
562
- if (filterItem.operator === 'notContain' && value.indexOf(filterItem.value) === -1) {
651
+ if (filterItem.operator === 'notContain' && value.toString().toLowerCase().indexOf(filterItem.value.toString().toLowerCase()) === -1) {
563
652
  return true;
564
653
  }
565
654
 
566
- if (filterItem.operator === 'equal' && value === filterItem.value) {
655
+ if (filterItem.operator === 'equal' && value.toString().toLowerCase() === filterItem.value.toString().toLowerCase()) {
567
656
  return true;
568
657
  }
569
658
 
570
- if (filterItem.operator === 'notEqual' && value !== filterItem.value) {
659
+ if (filterItem.operator === 'notEqual' && value.toString().toLowerCase() !== filterItem.value.toString().toLowerCase()) {
571
660
  return true;
572
661
  }
573
662
 
574
- if (filterItem.operator === 'greater' && value > filterItem.value) {
663
+ if (filterItem.operator === 'greater' && parseFloat(value) > parseFloat(filterItem.value)) {
575
664
  return true;
576
665
  }
577
666
 
578
- if (filterItem.operator === 'less' && value < filterItem.value) {
667
+ if (filterItem.operator === 'less' && parseFloat(value) < parseFloat(filterItem.value)) {
579
668
  return true;
580
669
  }
581
670
  }
@@ -586,10 +675,6 @@ var RTable = /*#__PURE__*/function (_Component) {
586
675
  key: "getFilterResult",
587
676
  value: function getFilterResult(column, value) {
588
677
  var filterDictionary = this.state.filterDictionary;
589
- filterDictionary[column._index] = filterDictionary[column._index] || {
590
- items: [],
591
- booleanType: 'or'
592
- };
593
678
  var filters = filterDictionary[column._index].items;
594
679
 
595
680
  if (filters.length) {
@@ -602,34 +687,38 @@ var RTable = /*#__PURE__*/function (_Component) {
602
687
  }, {
603
688
  key: "getRow",
604
689
  value: function getRow(row) {
690
+ var onChangeFilter = this.props.onChangeFilter;
691
+ var filterDictionary = this.state.filterDictionary;
605
692
  row._values = {};
606
- var show = true;
607
- var lastFreezedColumn;
608
- var lastColumn;
609
- var isThereAutoColumn = false;
610
- var cells = [];
611
- var freezeCells = [];
612
- var unFreezeCells = [];
693
+ var show = true,
694
+ lastColumn,
695
+ isThereAutoColumn = false,
696
+ cells = [],
697
+ freezeCells = [],
698
+ unFreezeCells = [];
613
699
 
614
700
  for (var i = 0; i < this.visibleColumns.length; i++) {
615
701
  var column = this.visibleColumns[i],
616
702
  value = void 0;
617
703
 
618
- if (typeof column.field === 'function') {
619
- value = column.field(row);
620
- } else {
621
- value = column.field ? this.getValueByField(row, column.field) : undefined;
704
+ try {
705
+ value = typeof column.getValue === 'function' ? column.getValue(row) : undefined;
706
+ } catch {
707
+ value = undefined;
622
708
  }
623
709
 
624
710
  row._values[column._index] = value;
711
+ filterDictionary[column._index] = filterDictionary[column._index] || {
712
+ items: [],
713
+ booleanType: 'or'
714
+ };
625
715
 
626
- if (show) {
716
+ if (show && !onChangeFilter) {
627
717
  show = show && this.getFilterResult(column, value);
628
718
  }
629
719
 
630
720
  var obj = {
631
721
  key: row._index + ',' + column._index,
632
- row: row,
633
722
  column: column,
634
723
  value: value,
635
724
  freeze: column.freeze
@@ -639,7 +728,6 @@ var RTable = /*#__PURE__*/function (_Component) {
639
728
  if (column.freeze) {
640
729
  column._renderIndex = freezeCells.length;
641
730
  freezeCells.push(obj);
642
- lastFreezedColumn = column;
643
731
  } else {
644
732
  column._renderIndex = unFreezeCells.length;
645
733
  lastColumn = column;
@@ -660,20 +748,18 @@ var RTable = /*#__PURE__*/function (_Component) {
660
748
  }
661
749
  }
662
750
 
751
+ row._show = show;
752
+
663
753
  if (show) {
664
754
  var parents = row._getParents();
665
755
 
666
- for (var _i = 0; _i < parents.length; _i++) {
667
- if (parents[_i].show === false) {
668
- parents[_i].show = 'relativeFilter';
756
+ for (var _i2 = 0; _i2 < parents.length; _i2++) {
757
+ if (parents[_i2]._show === false) {
758
+ parents[_i2]._show = 'relativeFilter';
669
759
  }
670
760
  }
671
761
  }
672
762
 
673
- if (lastFreezedColumn) {
674
- lastFreezedColumn.width = 'auto';
675
- }
676
-
677
763
  if (!isThereAutoColumn && lastColumn) {
678
764
  lastColumn.width = 'auto';
679
765
  }
@@ -681,86 +767,306 @@ var RTable = /*#__PURE__*/function (_Component) {
681
767
  return {
682
768
  cells: cells,
683
769
  freezeCells: freezeCells,
684
- unFreezeCells: unFreezeCells,
685
- show: show
770
+ unFreezeCells: unFreezeCells
771
+ };
772
+ }
773
+ }, {
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
+ }
823
+ }
824
+
825
+ for (var _prop in groupsOpen) {
826
+ groupsOpen[_prop] = toggleAllState;
827
+ }
828
+
829
+ localStorage.setItem('aio table ' + id, JSON.stringify(openDictionary));
830
+ var obj = {
831
+ openDictionary: openDictionary,
832
+ groupsOpen: groupsOpen,
833
+ toggleAllState: !toggleAllState
686
834
  };
835
+ this.setState(obj);
687
836
  }
688
837
  }, {
689
- key: "setColumnWidth",
690
- value: function setColumnWidth(column) {
691
- if (column.template === 'checkbox' && !column.width) {
692
- column.width = '48px';
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;
693
845
  }
694
846
 
695
- if (typeof column.width !== 'string') {
696
- column.width = 'auto';
847
+ if (!groups.length) {
848
+ return true;
697
849
  }
698
850
 
699
- if (column.width !== 'auto' && column.width.indexOf('px') === -1) {
700
- column.width = 'auto';
851
+ if (!column.groupName) {
852
+ return true;
701
853
  }
854
+
855
+ return groupDictionary[column.groupName] !== true;
702
856
  }
703
857
  }, {
704
858
  key: "updateColumns",
705
859
  value: function updateColumns() {
706
860
  var _this5 = this;
707
861
 
708
- var _this$props3 = this.props,
709
- columns = _this$props3.columns,
710
- onChange = _this$props3.onChange,
711
- _this$props3$freezeMo = _this$props3.freezeMode,
712
- freezeMode = _this$props3$freezeMo === void 0 ? true : _this$props3$freezeMo,
713
- _this$props3$groupByM = _this$props3.groupByMode,
714
- groupByMode = _this$props3$groupByM === void 0 ? true : _this$props3$groupByM;
862
+ var _this$props5 = this.props,
863
+ _this$props5$freezeMo = _this$props5.freezeMode,
864
+ freezeMode = _this$props5$freezeMo === void 0 ? true : _this$props5$freezeMo,
865
+ translate = _this$props5.translate,
866
+ groups = _this$props5.groups,
867
+ cardTemplate = _this$props5.cardTemplate,
868
+ onChangeSort = _this$props5.onChangeSort,
869
+ _this$props5$toggleAl = _this$props5.toggleAll,
870
+ toggleAll = _this$props5$toggleAl === void 0 ? false : _this$props5$toggleAl,
871
+ id = _this$props5.id;
872
+ var _this$state2 = this.state,
873
+ groupDictionary = _this$state2.groupDictionary,
874
+ sorts = _this$state2.sorts,
875
+ columns = _this$state2.columns;
715
876
  this.groups = [];
877
+ this.sorts = [];
716
878
  this.freezeMode = false;
717
- this.groupByMode = false;
718
879
  this.visibleColumns = [];
719
880
  this.freezeColumns = [];
720
881
  this.unFreezeColumns = [];
721
882
  this.toolbar = {
722
- show: false,
723
- toggle: [],
724
- freeze: [],
725
- groupBy: [],
883
+ show: toggleAll,
884
+ toggle: [{
885
+ text: translate('Show Columns')
886
+ }],
887
+ toggleAll: toggleAll ? this.toggleAll.bind(this) : false,
888
+ freeze: [{
889
+ text: translate('Freeze')
890
+ }],
891
+ groupBy: [{
892
+ text: translate('Group By')
893
+ }],
894
+ sort: [{
895
+ text: translate('Sort')
896
+ }],
726
897
  searchColumnIndex: false
727
898
  };
728
899
 
729
900
  var _loop2 = function _loop2(i) {
730
- var column = columns[i];
901
+ var sort = sorts[i];
902
+ var getValue = sort.getValue,
903
+ _sort$type = sort.type,
904
+ type = _sort$type === void 0 ? 'inc' : _sort$type,
905
+ title = sort.title,
906
+ _sort$active = sort.active,
907
+ active = _sort$active === void 0 ? true : _sort$active,
908
+ _sort$toggle = sort.toggle,
909
+ toggle = _sort$toggle === void 0 ? true : _sort$toggle;
910
+
911
+ if (!title) {
912
+ console.error('aio table => missing sort title property');
913
+ return "continue";
914
+ }
915
+
916
+ if (typeof getValue !== 'function') {
917
+ console.error('aio table => sort getValue property is not a function');
918
+ return "continue";
919
+ }
920
+
921
+ if (active === true) {
922
+ _this5.sorts.push({
923
+ getValue: getValue,
924
+ type: type
925
+ });
926
+ }
731
927
 
732
- _this5.setColumnWidth(column);
928
+ if (toggle) {
929
+ _this5.toolbar.show = true;
733
930
 
734
- column._index = i;
931
+ _this5.toolbar.sort.push({
932
+ text: title,
933
+ checked: active === true,
934
+ after: /*#__PURE__*/_react.default.createElement("div", {
935
+ style: {
936
+ width: '30px',
937
+ display: 'flex',
938
+ justifyContent: 'flex-end'
939
+ }
940
+ }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
941
+ path: type === 'dec' ? _js.mdiArrowDown : _js.mdiArrowUp,
942
+ size: 0.8,
943
+ onClick: function onClick(e) {
944
+ e.stopPropagation();
945
+ sort.type = sort.type === 'dec' ? 'inc' : 'dec';
946
+
947
+ _this5.setState({
948
+ sorts: sorts
949
+ });
735
950
 
736
- if (groupByMode) {
737
- if (column.groupBy) {
738
- _this5.groups.push({
739
- field: column.field,
740
- text: column.title
741
- });
951
+ if (onChangeSort) {
952
+ onChangeSort(sorts.filter(function (o) {
953
+ return o.active !== false;
954
+ }));
955
+ }
956
+ }
957
+ })),
958
+ onClick: function onClick() {
959
+ sort.active = !active;
742
960
 
743
- _this5.groupByMode = true;
744
- }
961
+ _this5.setState({
962
+ sorts: sorts
963
+ });
745
964
 
746
- if (column.toggleGroupBy) {
747
- _this5.toolbar.show = true;
748
-
749
- _this5.toolbar.groupBy.push({
750
- field: column.field,
751
- text: column.title,
752
- checked: column.groupBy === true,
753
- onClick: function onClick() {
754
- column.groupBy = !column.groupBy;
755
- onChange({
756
- columns: columns
757
- });
965
+ if (onChangeSort) {
966
+ onChangeSort(sorts.filter(function (o) {
967
+ return o.active !== false;
968
+ }));
758
969
  }
759
- });
970
+ }
971
+ });
972
+ }
973
+ };
974
+
975
+ for (var i = 0; i < sorts.length; i++) {
976
+ var _ret = _loop2(i);
977
+
978
+ if (_ret === "continue") continue;
979
+ }
980
+
981
+ var _loop3 = function _loop3(_i3) {
982
+ var group = groups[_i3];
983
+ var title = group.title,
984
+ _group$active = group.active,
985
+ active = _group$active === void 0 ? true : _group$active,
986
+ _group$toggle = group.toggle,
987
+ toggle = _group$toggle === void 0 ? true : _group$toggle,
988
+ getValue = group.getValue;
989
+
990
+ if (!title) {
991
+ console.error('aio table => missing group title property');
992
+ return "continue";
993
+ }
994
+
995
+ if (typeof getValue !== 'function') {
996
+ console.error('aio table => group getValue property is not a function');
997
+ return "continue";
998
+ }
999
+
1000
+ groupDictionary[title] = groupDictionary[title] === undefined ? active : groupDictionary[title];
1001
+
1002
+ if (groupDictionary[title]) {
1003
+ _this5.groups.push(group);
1004
+ }
1005
+
1006
+ if (toggle) {
1007
+ _this5.toolbar.show = true;
1008
+
1009
+ _this5.toolbar.groupBy.push({
1010
+ text: title,
1011
+ checked: groupDictionary[title],
1012
+ onClick: function onClick() {
1013
+ groupDictionary[title] = !groupDictionary[title];
1014
+
1015
+ if (id) {
1016
+ localStorage.setItem('aio table group' + id, JSON.stringify(groupDictionary));
1017
+ }
1018
+
1019
+ _this5.setState({
1020
+ groupDictionary: groupDictionary
1021
+ });
1022
+ }
1023
+ });
1024
+ }
1025
+ };
1026
+
1027
+ for (var _i3 = 0; _i3 < groups.length; _i3++) {
1028
+ var _ret2 = _loop3(_i3);
1029
+
1030
+ if (_ret2 === "continue") continue;
1031
+ }
1032
+
1033
+ if (cardTemplate) {
1034
+ return;
1035
+ }
1036
+
1037
+ var _loop4 = function _loop4(_i4) {
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
+ }
1056
+
1057
+ if (column._storageObj.width !== undefined) {
1058
+ column.width = column._storageObj.width;
1059
+ } else {
1060
+ column.width = column.width || 'auto';
760
1061
  }
1062
+ } else {
1063
+ show = column.show;
1064
+ column.width = column.width || 'auto';
761
1065
  }
762
1066
 
763
- if (column.show !== false && column.groupBy !== true) {
1067
+ column._index = _i4;
1068
+
1069
+ if (show !== false && _this5.showColumnRelativeGroups(column)) {
764
1070
  _this5.visibleColumns.push(column);
765
1071
 
766
1072
  if (freezeMode) {
@@ -781,7 +1087,8 @@ var RTable = /*#__PURE__*/function (_Component) {
781
1087
  onClick: function onClick() {
782
1088
  column.freeze = column.freeze === true ? true : false;
783
1089
  column.freeze = !column.freeze;
784
- onChange({
1090
+
1091
+ _this5.setState({
785
1092
  columns: columns
786
1093
  });
787
1094
  }
@@ -795,11 +1102,20 @@ var RTable = /*#__PURE__*/function (_Component) {
795
1102
 
796
1103
  _this5.toolbar.toggle.push({
797
1104
  text: column.title,
798
- checked: column.show !== false,
1105
+ checked: show !== false,
799
1106
  onClick: function onClick() {
800
1107
  column.show = column.show === false ? false : true;
801
- column.show = !column.show;
802
- onChange({
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
+ }
1117
+
1118
+ _this5.setState({
803
1119
  columns: columns
804
1120
  });
805
1121
  }
@@ -807,12 +1123,13 @@ var RTable = /*#__PURE__*/function (_Component) {
807
1123
  }
808
1124
 
809
1125
  if (column.search) {
1126
+ _this5.toolbar.show = true;
810
1127
  _this5.toolbar.searchColumnIndex = column._index;
811
1128
  }
812
1129
  };
813
1130
 
814
- for (var i = 0; i < columns.length; i++) {
815
- _loop2(i);
1131
+ for (var _i4 = 0; _i4 < columns.length; _i4++) {
1132
+ _loop4(_i4);
816
1133
  }
817
1134
 
818
1135
  if (this.freezeColumns.length === 0 || this.unFreezeColumns.length === 0) {
@@ -822,24 +1139,27 @@ var RTable = /*#__PURE__*/function (_Component) {
822
1139
  }, {
823
1140
  key: "getPaging",
824
1141
  value: function getPaging() {
825
- var _this$props4 = this.props,
826
- paging = _this$props4.paging,
827
- rtl = _this$props4.rtl,
828
- translate = _this$props4.translate;
1142
+ var _this6 = this;
1143
+
1144
+ var paging = this.state.paging;
829
1145
 
830
1146
  if (!paging) {
831
1147
  return null;
832
1148
  }
833
1149
 
1150
+ var _this$props6 = this.props,
1151
+ rtl = _this$props6.rtl,
1152
+ translate = _this$props6.translate;
834
1153
  var number = paging.number,
835
1154
  _paging$sizes = paging.sizes,
836
- sizes = _paging$sizes === void 0 ? [1, 5, 10, 20, 30] : _paging$sizes,
1155
+ sizes = _paging$sizes === void 0 ? [1, 5, 10, 20, 30, 40, 50, 60, 70, 80] : _paging$sizes,
837
1156
  size = paging.size,
838
- _paging$onChange = paging.onChange,
839
- _onChange = _paging$onChange === void 0 ? function () {} : _paging$onChange,
840
- pages = paging.pages;
1157
+ _paging$pages = paging.pages,
1158
+ pages = _paging$pages === void 0 ? 1 : _paging$pages;
841
1159
 
842
1160
  var changePage = function changePage(type) {
1161
+ var _paging$pages2 = paging.pages,
1162
+ pages = _paging$pages2 === void 0 ? 1 : _paging$pages2;
843
1163
  var newNumber;
844
1164
 
845
1165
  if (type === 'prev') {
@@ -864,10 +1184,15 @@ var RTable = /*#__PURE__*/function (_Component) {
864
1184
  return;
865
1185
  }
866
1186
 
867
- _onChange({
868
- number: newNumber,
869
- size: size
1187
+ paging.number = newNumber;
1188
+
1189
+ _this6.setState({
1190
+ paging: paging
870
1191
  });
1192
+
1193
+ if (paging.onChange) {
1194
+ paging.onChange(paging);
1195
+ }
871
1196
  };
872
1197
 
873
1198
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -917,10 +1242,15 @@ var RTable = /*#__PURE__*/function (_Component) {
917
1242
  className: "aio-table-paging-button",
918
1243
  value: size,
919
1244
  onChange: function onChange(e) {
920
- return _onChange({
921
- number: number,
922
- size: parseInt(e.target.value)
1245
+ paging.size = parseInt(e.target.value);
1246
+
1247
+ _this6.setState({
1248
+ paging: paging
923
1249
  });
1250
+
1251
+ if (paging.onChange) {
1252
+ paging.onChange(paging);
1253
+ }
924
1254
  },
925
1255
  title: translate('Rows Count Per Page')
926
1256
  }, sizes.map(function (s, i) {
@@ -977,7 +1307,7 @@ var RTable = /*#__PURE__*/function (_Component) {
977
1307
  display: 'flex',
978
1308
  alignItems: 'center',
979
1309
  justifyContent: 'center',
980
- background: '#fff'
1310
+ background: 'transparent'
981
1311
  }
982
1312
  }, items);
983
1313
  }
@@ -990,80 +1320,168 @@ var RTable = /*#__PURE__*/function (_Component) {
990
1320
  thickness: [6, 40]
991
1321
  }));
992
1322
  }
1323
+ }, {
1324
+ key: "onChangeFilter",
1325
+ value: function onChangeFilter(obj) {
1326
+ var onChangeFilter = this.props.onChangeFilter;
1327
+ var columns = this.state.columns;
1328
+ var filters = [];
1329
+
1330
+ for (var prop in obj) {
1331
+ if (obj[prop].items.length) {
1332
+ filters.push({
1333
+ column: columns[prop],
1334
+ ...obj[prop]
1335
+ });
1336
+ }
1337
+ }
1338
+
1339
+ onChangeFilter(filters);
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
+ }
993
1366
  }, {
994
1367
  key: "render",
995
1368
  value: function render() {
996
- var _this6 = this;
1369
+ var _this7 = this;
997
1370
 
998
- var _this$props5 = this.props,
999
- columns = _this$props5.columns,
1000
- rowHeight = _this$props5.rowHeight,
1001
- headerHeight = _this$props5.headerHeight,
1002
- toolbarHeight = _this$props5.toolbarHeight,
1003
- rowGap = _this$props5.rowGap,
1004
- className = _this$props5.className,
1005
- columnGap = _this$props5.columnGap,
1006
- rtl = _this$props5.rtl,
1007
- style = _this$props5.style,
1008
- _this$props5$attrs = _this$props5.attrs,
1009
- attrs = _this$props5$attrs === void 0 ? {} : _this$props5$attrs;
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
+
1383
+ var _this$props7 = this.props,
1384
+ rowHeight = _this$props7.rowHeight,
1385
+ headerHeight = _this$props7.headerHeight,
1386
+ toolbarHeight = _this$props7.toolbarHeight,
1387
+ rowGap = _this$props7.rowGap,
1388
+ className = _this$props7.className,
1389
+ columnGap = _this$props7.columnGap,
1390
+ rtl = _this$props7.rtl,
1391
+ style = _this$props7.style,
1392
+ _this$props7$attrs = _this$props7.attrs,
1393
+ attrs = _this$props7$attrs === void 0 ? {} : _this$props7$attrs,
1394
+ cardTemplate = _this$props7.cardTemplate,
1395
+ onChangeFilter = _this$props7.onChangeFilter,
1396
+ onSwap = _this$props7.onSwap,
1397
+ padding = _this$props7.padding;
1398
+ var columns = this.state.columns;
1010
1399
  this.rh = rowHeight;
1011
1400
  this.hh = headerHeight;
1012
1401
  this.th = toolbarHeight;
1013
1402
  this.rg = rowGap;
1014
1403
  this.cg = columnGap;
1015
1404
  this.updateColumns();
1016
- 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();
1017
1408
  var context = { ...this.props,
1018
1409
  ...this.state,
1019
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
+ },
1441
+ onChangeFilter: onChangeFilter ? this.onChangeFilter.bind(this) : undefined,
1020
1442
  SetState: function SetState(obj) {
1021
- return _this6.setState(obj);
1443
+ return _this7.setState(obj);
1022
1444
  },
1023
1445
  cubes2: this.cubes2.bind(this),
1446
+ toggleRow: this.toggleRow.bind(this),
1024
1447
  getGap: this.getGap.bind(this),
1025
- getValueByField: this.getValueByField.bind(this),
1026
1448
  onScroll: this.onScroll.bind(this),
1027
1449
  onMouseEnter: this.onMouseEnter.bind(this),
1028
1450
  getClient: this.getClient.bind(this),
1029
1451
  getLoading: this.getLoading.bind(this),
1030
1452
  groups: this.groups
1031
1453
  };
1032
- return /*#__PURE__*/_react.default.createElement(RTableContext.Provider, {
1454
+ return /*#__PURE__*/_react.default.createElement(AioTableContext.Provider, {
1033
1455
  value: context
1034
1456
  }, /*#__PURE__*/_react.default.createElement("div", _extends({
1035
1457
  className: 'aio-table' + (className ? ' ' + className : '') + (rtl ? ' rtl' : ''),
1036
1458
  tabIndex: 0,
1037
1459
  ref: this.dom,
1038
- style: style
1039
- }, attrs), /*#__PURE__*/_react.default.createElement(RTableToolbar, this.toolbar), this.visibleColumns.length === 0 && this.getLoading(), table, /*#__PURE__*/_react.default.createElement("div", {
1040
- style: {
1041
- height: rowGap
1460
+ style: { ...style,
1461
+ padding: padding
1042
1462
  }
1043
- }), /*#__PURE__*/_react.default.createElement("div", {
1044
- style: {
1045
- flex: 1,
1046
- background: '#fff'
1047
- }
1048
- }), this.getPaging()));
1463
+ }, attrs), Toolbar, !cardTemplate && this.visibleColumns.length === 0 && this.getLoading(), table, Paging));
1049
1464
  }
1050
1465
  }]);
1051
1466
 
1052
- return RTable;
1467
+ return AIOTable;
1053
1468
  }(_react.Component);
1054
1469
 
1055
- exports.default = RTable;
1056
- RTable.defaultProps = {
1470
+ exports.default = AIOTable;
1471
+ AIOTable.defaultProps = {
1057
1472
  columns: [],
1058
1473
  headerHeight: 36,
1059
1474
  rowHeight: 36,
1060
1475
  toolbarHeight: 36,
1061
1476
  rowGap: 6,
1477
+ padding: 12,
1062
1478
  indent: 20,
1063
1479
  translate: function translate(text) {
1064
1480
  return text;
1065
1481
  },
1066
- freezeSize: 300
1482
+ freezeSize: 300,
1483
+ sorts: [],
1484
+ groups: []
1067
1485
  };
1068
1486
 
1069
1487
  var RTableToolbar = /*#__PURE__*/function (_Component2) {
@@ -1072,21 +1490,9 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1072
1490
  var _super2 = _createSuper(RTableToolbar);
1073
1491
 
1074
1492
  function RTableToolbar() {
1075
- var _this7;
1076
-
1077
1493
  _classCallCheck(this, RTableToolbar);
1078
1494
 
1079
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1080
- args[_key] = arguments[_key];
1081
- }
1082
-
1083
- _this7 = _super2.call.apply(_super2, [this].concat(args));
1084
-
1085
- _defineProperty(_assertThisInitialized(_this7), "state", {
1086
- searchText: ''
1087
- });
1088
-
1089
- return _this7;
1495
+ return _super2.apply(this, arguments);
1090
1496
  }
1091
1497
 
1092
1498
  _createClass(RTableToolbar, [{
@@ -1094,8 +1500,10 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1094
1500
  value: function changeSearch(value) {
1095
1501
  var _this8 = this;
1096
1502
 
1503
+ var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
1504
+ var SetState = this.context.SetState;
1097
1505
  clearTimeout(this.searchTimeout);
1098
- this.setState({
1506
+ SetState({
1099
1507
  searchText: value
1100
1508
  });
1101
1509
  this.searchTimeout = setTimeout(function () {
@@ -1113,7 +1521,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1113
1521
  SetState({
1114
1522
  filterDictionary: filterDictionary
1115
1523
  });
1116
- }, 1000);
1524
+ }, time);
1117
1525
  }
1118
1526
  }, {
1119
1527
  key: "render",
@@ -1121,70 +1529,105 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1121
1529
  var _this9 = this;
1122
1530
 
1123
1531
  var _this$context = this.context,
1532
+ searchText = _this$context.searchText,
1124
1533
  translate = _this$context.translate,
1125
- rtl = _this$context.rtl;
1126
- var searchText = this.state.searchText;
1127
- var _this$props6 = this.props,
1128
- show = _this$props6.show,
1129
- toggle = _this$props6.toggle,
1130
- freeze = _this$props6.freeze,
1131
- groupBy = _this$props6.groupBy,
1132
- searchColumnIndex = _this$props6.searchColumnIndex;
1133
-
1134
- if (!show) {
1135
- return null;
1136
- }
1137
-
1534
+ rtl = _this$context.rtl,
1535
+ toggleAllState = _this$context.toggleAllState,
1536
+ padding = _this$context.padding;
1537
+ var _this$props8 = this.props,
1538
+ toggle = _this$props8.toggle,
1539
+ freeze = _this$props8.freeze,
1540
+ groupBy = _this$props8.groupBy,
1541
+ sort = _this$props8.sort,
1542
+ searchColumnIndex = _this$props8.searchColumnIndex,
1543
+ toggleAll = _this$props8.toggleAll;
1138
1544
  var buttonProps = {
1545
+ type: 'select',
1546
+ caret: false,
1139
1547
  rtl: rtl,
1140
- className: 'aio-table-toolbar-dropdown',
1548
+ className: 'aio-table-toolbar-button',
1141
1549
  animate: true
1142
1550
  };
1143
1551
  return /*#__PURE__*/_react.default.createElement("div", {
1144
- className: "aio-table-toolbar"
1145
- }, groupBy.length !== 0 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1552
+ className: "aio-table-toolbar",
1553
+ style: {
1554
+ marginBottom: padding
1555
+ }
1556
+ }, toggleAll !== false && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1146
1557
  key: 0
1147
1558
  }, buttonProps, {
1148
- items: groupBy,
1559
+ title: translate('Toggle All'),
1560
+ onClick: function onClick() {
1561
+ return toggleAll();
1562
+ },
1563
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1564
+ path: !toggleAllState ? _js.mdiCollapseAll : _js.mdiExpandAll,
1565
+ size: 0.7
1566
+ })
1567
+ })), searchColumnIndex !== false && /*#__PURE__*/_react.default.createElement("div", {
1568
+ key: 1,
1569
+ className: "aio-table-search"
1570
+ }, /*#__PURE__*/_react.default.createElement("input", {
1571
+ className: "aio-table-search-input",
1572
+ type: "text",
1573
+ value: searchText,
1574
+ placeholder: translate('Search'),
1575
+ onChange: function onChange(e) {
1576
+ return _this9.changeSearch(e.target.value);
1577
+ }
1578
+ }), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1579
+ className: "aio-table-search-icon",
1580
+ path: searchText ? _js.mdiClose : _js.mdiMagnify,
1581
+ size: 0.8,
1582
+ onClick: function onClick() {
1583
+ if (!searchText) {
1584
+ return;
1585
+ }
1586
+
1587
+ _this9.changeSearch('', 0);
1588
+ }
1589
+ })), searchColumnIndex === false && /*#__PURE__*/_react.default.createElement("div", {
1590
+ style: {
1591
+ flex: 1
1592
+ }
1593
+ }), groupBy.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1594
+ key: 2
1595
+ }, buttonProps, {
1596
+ options: groupBy,
1149
1597
  title: translate('Group By'),
1150
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1598
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1151
1599
  path: _js.mdiFileTree,
1152
1600
  size: 0.7,
1153
1601
  horizontal: rtl === true
1154
1602
  })
1155
- })), toggle.length !== 0 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1156
- key: 1
1603
+ })), sort.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1604
+ key: 3
1157
1605
  }, buttonProps, {
1158
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1606
+ options: sort,
1607
+ title: translate('Sort'),
1608
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1609
+ path: _js.mdiSort,
1610
+ size: 0.7
1611
+ })
1612
+ })), toggle.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1613
+ key: 4
1614
+ }, buttonProps, {
1615
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1159
1616
  path: _js.mdiEye,
1160
1617
  size: 0.7
1161
1618
  }),
1162
- items: toggle,
1619
+ options: toggle,
1163
1620
  title: translate('Show Columns')
1164
- })), freeze.length !== 0 && /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, _extends({
1165
- key: 2
1621
+ })), freeze.length > 1 && /*#__PURE__*/_react.default.createElement(_aioButton.default, _extends({
1622
+ key: 5
1166
1623
  }, buttonProps, {
1167
- icon: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1624
+ text: /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1168
1625
  path: _js.mdiAlignHorizontalLeft,
1169
1626
  size: 0.7,
1170
1627
  horizontal: rtl === true
1171
1628
  }),
1172
- items: freeze,
1629
+ options: freeze,
1173
1630
  title: translate('Freeze Columns')
1174
- })), searchColumnIndex !== false && /*#__PURE__*/_react.default.createElement("div", {
1175
- key: 3,
1176
- className: "aio-table-search"
1177
- }, /*#__PURE__*/_react.default.createElement("input", {
1178
- className: "aio-table-search-input",
1179
- type: "text",
1180
- value: searchText,
1181
- onChange: function onChange(e) {
1182
- return _this9.changeSearch(e.target.value);
1183
- }
1184
- }), /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1185
- className: "aio-table-search-icon",
1186
- path: _js.mdiMagnify,
1187
- size: 0.8
1188
1631
  })));
1189
1632
  }
1190
1633
  }]);
@@ -1192,7 +1635,7 @@ var RTableToolbar = /*#__PURE__*/function (_Component2) {
1192
1635
  return RTableToolbar;
1193
1636
  }(_react.Component);
1194
1637
 
1195
- _defineProperty(RTableToolbar, "contextType", RTableContext);
1638
+ _defineProperty(RTableToolbar, "contextType", AioTableContext);
1196
1639
 
1197
1640
  var RTableUnit = /*#__PURE__*/function (_Component3) {
1198
1641
  _inherits(RTableUnit, _Component3);
@@ -1212,22 +1655,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1212
1655
  _createClass(RTableUnit, [{
1213
1656
  key: "getNoData",
1214
1657
  value: function getNoData() {
1215
- var rowHeight = this.context.rowHeight;
1658
+ var _this$context2 = this.context,
1659
+ rowHeight = _this$context2.rowHeight,
1660
+ translate = _this$context2.translate;
1216
1661
  return /*#__PURE__*/_react.default.createElement("div", {
1217
1662
  className: "aio-table-nodata",
1218
1663
  style: { ...this.getFullCellStyle(),
1219
1664
  height: rowHeight
1220
1665
  }
1221
- }, "\u062F\u06CC\u062A\u0627\u06CC\u06CC \u0645\u0648\u062C\u0648\u062F \u0646\u06CC\u0633\u062A");
1666
+ }, translate('No Data'));
1222
1667
  }
1223
1668
  }, {
1224
1669
  key: "getGroupToggleIcon",
1225
1670
  value: function getGroupToggleIcon(row) {
1226
- var _this$context2 = this.context,
1227
- rtl = _this$context2.rtl,
1228
- SetState = _this$context2.SetState,
1229
- groupsOpen = _this$context2.groupsOpen,
1230
- getGap = _this$context2.getGap;
1671
+ var _this$context3 = this.context,
1672
+ rtl = _this$context3.rtl,
1673
+ SetState = _this$context3.SetState,
1674
+ groupsOpen = _this$context3.groupsOpen,
1675
+ getGap = _this$context3.getGap;
1231
1676
  var icon;
1232
1677
 
1233
1678
  if (row._opened) {
@@ -1243,12 +1688,11 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1243
1688
  });
1244
1689
  }
1245
1690
 
1246
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1691
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1247
1692
  className: "aio-table-toggle",
1248
1693
  onClick: function onClick() {
1249
- var _groupField = row._groupField,
1250
- _parentField = row._parentField;
1251
- groupsOpen[_parentField + _groupField] = !groupsOpen[_parentField + _groupField];
1694
+ var _groupId = row._groupId;
1695
+ groupsOpen[_groupId] = !groupsOpen[_groupId];
1252
1696
  SetState({
1253
1697
  groupsOpen: groupsOpen
1254
1698
  });
@@ -1267,19 +1711,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1267
1711
  }, {
1268
1712
  key: "getStyle",
1269
1713
  value: function getStyle() {
1270
- var _this$context3 = this.context,
1271
- rowGap = _this$context3.rowGap,
1272
- columnGap = _this$context3.columnGap;
1273
- var _this$props7 = this.props,
1274
- columns = _this$props7.columns,
1275
- index = _this$props7.index,
1276
- style = _this$props7.style;
1714
+ var _this$context4 = this.context,
1715
+ rowGap = _this$context4.rowGap,
1716
+ columnGap = _this$context4.columnGap;
1717
+ var _this$props9 = this.props,
1718
+ columns = _this$props9.columns,
1719
+ style = _this$props9.style;
1277
1720
  var gridTemplateColumns = '';
1278
1721
  this.gridTemplateColumns = [];
1279
1722
 
1280
1723
  for (var i = 0; i < columns.length; i++) {
1281
1724
  var _columns$i$width = columns[i].width,
1282
1725
  width = _columns$i$width === void 0 ? 'auto' : _columns$i$width;
1726
+ width = width.toString();
1727
+
1728
+ if (width !== 'auto' && width.indexOf('px') === -1) {
1729
+ width += 'px';
1730
+ }
1731
+
1283
1732
  this.gridTemplateColumns.push(width);
1284
1733
  gridTemplateColumns += width + (i < columns.length - 1 ? ' ' : '');
1285
1734
  }
@@ -1304,11 +1753,13 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1304
1753
  }, {
1305
1754
  key: "getGanttTitle",
1306
1755
  value: function getGanttTitle(column) {
1307
- var _this$context4 = this.context,
1308
- headerHeight = _this$context4.headerHeight,
1309
- columnGap = _this$context4.columnGap;
1310
- var keys = column.keys,
1311
- padding = column.padding;
1756
+ var _this$context5 = this.context,
1757
+ headerHeight = _this$context5.headerHeight,
1758
+ columnGap = _this$context5.columnGap;
1759
+ var getKeys = column.getKeys,
1760
+ _column$padding = column.padding,
1761
+ padding = _column$padding === void 0 ? '36px' : _column$padding;
1762
+ var keys = getKeys();
1312
1763
  return /*#__PURE__*/_react.default.createElement("div", {
1313
1764
  className: "aio-table-title aio-table-title-gantt",
1314
1765
  style: {
@@ -1322,20 +1773,24 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1322
1773
  }, /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
1323
1774
  start: 0,
1324
1775
  end: keys.length - 1,
1325
- label: {
1326
- step: 1,
1327
- edit: function edit(value) {
1328
- return keys[value];
1329
- },
1330
- style: {
1776
+ labelStep: 1,
1777
+ editLabel: function editLabel(value) {
1778
+ return keys[value];
1779
+ },
1780
+ labelStyle: function labelStyle() {
1781
+ return {
1331
1782
  top: 0
1332
- }
1783
+ };
1333
1784
  },
1334
- pointStyle: {
1335
- display: 'none'
1785
+ pointStyle: function pointStyle() {
1786
+ return {
1787
+ display: 'none'
1788
+ };
1336
1789
  },
1337
- lineStyle: {
1338
- display: 'none'
1790
+ lineStyle: function lineStyle() {
1791
+ return {
1792
+ display: 'none'
1793
+ };
1339
1794
  }
1340
1795
  }));
1341
1796
  }
@@ -1348,24 +1803,12 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1348
1803
  return this.getGanttTitle(column);
1349
1804
  }
1350
1805
 
1351
- var _this$context5 = this.context,
1352
- onChange = _this$context5.onChange,
1353
- columns = _this$context5.columns,
1354
- headerHeight = _this$context5.headerHeight,
1355
- columnGap = _this$context5.columnGap,
1356
- touch = _this$context5.touch;
1357
-
1358
- if (column.template === 'checkbox') {
1359
- if (column.checkAll) {
1360
- column.title = /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1361
- path: _js.mdiCheckboxMarkedOutline,
1362
- size: 1
1363
- });
1364
- }
1365
-
1366
- column.center = true;
1367
- }
1368
-
1806
+ var _this$context6 = this.context,
1807
+ SetState = _this$context6.SetState,
1808
+ columns = _this$context6.columns,
1809
+ headerHeight = _this$context6.headerHeight,
1810
+ columnGap = _this$context6.columnGap,
1811
+ touch = _this$context6.touch;
1369
1812
  var props = {
1370
1813
  style: {
1371
1814
  height: headerHeight,
@@ -1380,15 +1823,18 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1380
1823
 
1381
1824
  var resizeProps = _defineProperty({
1382
1825
  className: 'aio-table-resize',
1826
+ style: {
1827
+ cursor: column.resizable ? 'col-resize' : 'default'
1828
+ },
1383
1829
  draggable: false
1384
1830
  }, touch ? 'onTouchStart' : 'onMouseDown', function (e) {
1385
- return _this12.resizeDown(e, column);
1831
+ return column.resizable ? _this12.resizeDown(e, column) : undefined;
1386
1832
  });
1387
1833
 
1388
1834
  var titleProps = {
1389
1835
  className: 'aio-table-title-text',
1390
1836
  style: {
1391
- justifyContent: column.center ? 'center' : undefined,
1837
+ justifyContent: column.titleJustify !== false ? 'center' : undefined,
1392
1838
  cursor: column.movable === false ? undefined : 'move'
1393
1839
  },
1394
1840
  draggable: column.movable !== false,
@@ -1404,19 +1850,16 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1404
1850
  return;
1405
1851
  }
1406
1852
 
1407
- if (_this12.startColumnSwap === _this12.endColumnSwap) {
1853
+ if (_this12.startColumnSwap === undefined || _this12.startColumnSwap === _this12.endColumnSwap) {
1408
1854
  return;
1409
1855
  }
1410
1856
 
1411
1857
  var temp = columns[_this12.startColumnSwap];
1412
1858
  columns[_this12.startColumnSwap] = columns[_this12.endColumnSwap];
1413
1859
  columns[_this12.endColumnSwap] = temp;
1414
-
1415
- if (onChange) {
1416
- onChange({
1417
- columns: columns
1418
- });
1419
- }
1860
+ SetState({
1861
+ columns: columns
1862
+ });
1420
1863
  }
1421
1864
  };
1422
1865
  return /*#__PURE__*/_react.default.createElement("div", props, /*#__PURE__*/_react.default.createElement(RTableFilter, {
@@ -1426,9 +1869,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1426
1869
  }, {
1427
1870
  key: "resizeDown",
1428
1871
  value: function resizeDown(e, column) {
1429
- var _this$context6 = this.context,
1430
- touch = _this$context6.touch,
1431
- getClient = _this$context6.getClient;
1872
+ var _this$context7 = this.context,
1873
+ touch = _this$context7.touch,
1874
+ getClient = _this$context7.getClient;
1432
1875
  (0, _jquery.default)(window).bind(touch ? 'touchmove' : 'mousemove', _jquery.default.proxy(this.resizeMove, this));
1433
1876
  (0, _jquery.default)(window).bind(touch ? 'touchend' : 'mouseup', _jquery.default.proxy(this.resizeUp, this));
1434
1877
  this.resizeDetails = {
@@ -1442,9 +1885,9 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1442
1885
  }, {
1443
1886
  key: "resizeMove",
1444
1887
  value: function resizeMove(e) {
1445
- var _this$context7 = this.context,
1446
- rtl = _this$context7.rtl,
1447
- getClient = _this$context7.getClient;
1888
+ var _this$context8 = this.context,
1889
+ rtl = _this$context8.rtl,
1890
+ getClient = _this$context8.getClient;
1448
1891
  var Client = getClient(e);
1449
1892
  var _this$resizeDetails2 = this.resizeDetails,
1450
1893
  client = _this$resizeDetails2.client,
@@ -1471,27 +1914,46 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1471
1914
  var touch = this.context.touch;
1472
1915
  (0, _jquery.default)(window).unbind(touch ? 'touchmove' : 'mousemove', this.resizeMove);
1473
1916
  (0, _jquery.default)(window).unbind(touch ? 'touchend' : 'mouseup', this.resizeUp);
1474
- var _this$context8 = this.context,
1475
- columns = _this$context8.columns,
1476
- _this$context8$onChan = _this$context8.onChange,
1477
- onChange = _this$context8$onChan === void 0 ? function () {} : _this$context8$onChan;
1917
+ var _this$context9 = this.context,
1918
+ columns = _this$context9.columns,
1919
+ SetState = _this$context9.SetState;
1478
1920
  var _this$resizeDetails3 = this.resizeDetails,
1479
1921
  index = _this$resizeDetails3.index,
1480
1922
  newWidth = _this$resizeDetails3.newWidth;
1481
- columns[index].width = newWidth;
1482
- onChange({
1923
+ var column = columns[index];
1924
+ column.width = newWidth;
1925
+
1926
+ if (column.storageKey) {
1927
+ column._storageObj.width = newWidth;
1928
+ localStorage.setItem('aio-table-column-storage-' + column.storageKey, JSON.stringify(column._storageObj));
1929
+ }
1930
+
1931
+ SetState({
1483
1932
  columns: columns
1484
1933
  });
1485
1934
  }
1486
1935
  }, {
1487
1936
  key: "keyDown",
1488
1937
  value: function keyDown(e) {
1489
- if ([37, 38, 39, 40].indexOf(e.keyCode) === -1) {
1490
- return;
1491
- }
1938
+ var SetState = this.context.SetState;
1492
1939
 
1940
+ if (e.keyCode === 27) {
1941
+ (0, _jquery.default)('.aio-table-input').blur();
1942
+ SetState({
1943
+ focused: false
1944
+ });
1945
+ } else if ([37, 38, 39, 40].indexOf(e.keyCode) !== -1) {
1946
+ this.arrow(e);
1947
+ }
1948
+ }
1949
+ }, {
1950
+ key: "arrow",
1951
+ value: function arrow(e) {
1493
1952
  var container = (0, _jquery.default)(this.dom.current);
1494
- var rtl = this.context.rtl;
1953
+ var _this$context10 = this.context,
1954
+ rtl = _this$context10.rtl,
1955
+ focused = _this$context10.focused,
1956
+ SetState = _this$context10.SetState;
1495
1957
  var columns = this.props.columns;
1496
1958
  var inputs = container.find('.aio-table-input');
1497
1959
 
@@ -1501,8 +1963,20 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1501
1963
 
1502
1964
  var focusedInput = inputs.filter(':focus');
1503
1965
 
1504
- if (focusedInput.length === 0) {
1505
- inputs.eq(0).focus().select();
1966
+ if (focused === false) {
1967
+ var inputCells = (0, _jquery.default)('.aio-table-cell-input');
1968
+
1969
+ if (inputCells.length) {
1970
+ var cell = inputCells.eq(0);
1971
+ var cellId = cell.attr('cellid');
1972
+ SetState({
1973
+ focused: cellId
1974
+ });
1975
+ setTimeout(function () {
1976
+ (0, _jquery.default)('.aio-table-cell-input[cellid=' + cellId + '] .aio-table-input').focus().select();
1977
+ }, 10);
1978
+ }
1979
+
1506
1980
  return;
1507
1981
  }
1508
1982
 
@@ -1561,29 +2035,50 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1561
2035
  };
1562
2036
  }
1563
2037
  }, {
1564
- key: "render",
1565
- value: function render() {
2038
+ key: "card",
2039
+ value: function card() {
1566
2040
  var _this13 = this;
1567
2041
 
1568
- var _this$context9 = this.context,
1569
- indent = _this$context9.indent,
1570
- _onMouseEnter = _this$context9.onMouseEnter,
1571
- _onScroll = _this$context9.onScroll,
1572
- rowHeight = _this$context9.rowHeight,
1573
- groups = _this$context9.groups,
1574
- getLoading = _this$context9.getLoading;
1575
- var _this$props8 = this.props,
1576
- rows = _this$props8.rows,
1577
- id = _this$props8.id,
1578
- index = _this$props8.index,
1579
- type = _this$props8.type;
2042
+ var _this$context11 = this.context,
2043
+ indent = _this$context11.indent,
2044
+ _onMouseEnter = _this$context11.onMouseEnter,
2045
+ _onScroll = _this$context11.onScroll,
2046
+ rowHeight = _this$context11.rowHeight,
2047
+ _this$context11$cardG = _this$context11.cardGap,
2048
+ cardGap = _this$context11$cardG === void 0 ? 0 : _this$context11$cardG,
2049
+ getLoading = _this$context11.getLoading,
2050
+ cardTemplate = _this$context11.cardTemplate,
2051
+ _this$context11$cardR = _this$context11.cardRowCount,
2052
+ cardRowCount = _this$context11$cardR === void 0 ? 1 : _this$context11$cardR,
2053
+ rowGap = _this$context11.rowGap,
2054
+ columnGap = _this$context11.columnGap,
2055
+ toggleRow = _this$context11.toggleRow;
2056
+ var _this$props10 = this.props,
2057
+ rows = _this$props10.rows,
2058
+ id = _this$props10.id,
2059
+ index = _this$props10.index;
2060
+ var groupStyle = {
2061
+ gridColumnStart: 1,
2062
+ gridColumnEnd: cardRowCount + 1,
2063
+ height: rowHeight
2064
+ };
2065
+
2066
+ if (cardRowCount === 'auto') {
2067
+ groupStyle.gridColumnStart = undefined;
2068
+ groupStyle.gridColumnEnd = undefined;
2069
+ }
2070
+
1580
2071
  return /*#__PURE__*/_react.default.createElement("div", {
1581
2072
  id: id,
1582
2073
  tabIndex: 0,
1583
2074
  className: "aio-table-unit",
1584
2075
  onKeyDown: this.keyDown.bind(this),
1585
- style: this.getStyle(),
1586
2076
  ref: this.dom,
2077
+ style: {
2078
+ gridRowGap: rowGap,
2079
+ gridColumnGap: columnGap,
2080
+ gridTemplateColumns: cardRowCount === 'auto' ? undefined : "repeat(".concat(cardRowCount, ",auto)")
2081
+ },
1587
2082
  onMouseEnter: function onMouseEnter() {
1588
2083
  return _onMouseEnter(index);
1589
2084
  },
@@ -1593,47 +2088,95 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1593
2088
  onScroll: function onScroll(e) {
1594
2089
  return _onScroll(e, index);
1595
2090
  }
1596
- }, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
1597
- if (row._groupField) {
2091
+ }, rows && rows.length !== 0 && rows.map(function (row, i) {
2092
+ if (row._groupId) {
1598
2093
  var width = indent * row._level;
1599
2094
  return /*#__PURE__*/_react.default.createElement("div", {
1600
2095
  className: "aio-table-group",
1601
2096
  key: 'group' + i + '-' + index,
1602
- style: { ..._this13.getFullCellStyle(),
1603
- height: rowHeight
1604
- }
1605
- }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2097
+ style: groupStyle
2098
+ }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1606
2099
  style: {
1607
- width: width
2100
+ width: width,
2101
+ flexShrink: 0
1608
2102
  }
1609
- }), _this13.getGroupToggleIcon(row), row._groupText));
2103
+ }), _this13.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2104
+ className: "aio-table-group-text"
2105
+ }, row._groupValue)));
1610
2106
  }
1611
2107
 
1612
- if (type === 'freeze') {
1613
- return row.freezeCells.map(function (r, j) {
1614
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
1615
- key: i + '-' + j + '-' + index
1616
- }, r, {
1617
- relativeFilter: row.show === 'relativeFilter'
1618
- }));
1619
- });
1620
- }
2108
+ return /*#__PURE__*/_react.default.createElement("div", {
2109
+ key: i + '-' + index,
2110
+ className: "aio-table-card"
2111
+ }, cardTemplate(row.row, function () {
2112
+ return toggleRow(row.row);
2113
+ }));
2114
+ }), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
2115
+ }
2116
+ }, {
2117
+ key: "render",
2118
+ value: function render() {
2119
+ var _this14 = this;
1621
2120
 
1622
- if (type === 'unFreeze') {
1623
- return row.unFreezeCells.map(function (r, j) {
1624
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
1625
- key: i + '-' + j + '-' + index
1626
- }, r, {
1627
- relativeFilter: row.show === 'relativeFilter'
1628
- }));
1629
- });
2121
+ if (this.context.cardTemplate) {
2122
+ return this.card();
2123
+ }
2124
+
2125
+ var _this$context12 = this.context,
2126
+ indent = _this$context12.indent,
2127
+ _onMouseEnter2 = _this$context12.onMouseEnter,
2128
+ _onScroll2 = _this$context12.onScroll,
2129
+ rowHeight = _this$context12.rowHeight,
2130
+ groups = _this$context12.groups,
2131
+ getLoading = _this$context12.getLoading,
2132
+ cardTemplate = _this$context12.cardTemplate;
2133
+ var _this$props11 = this.props,
2134
+ rows = _this$props11.rows,
2135
+ id = _this$props11.id,
2136
+ index = _this$props11.index,
2137
+ type = _this$props11.type;
2138
+ return /*#__PURE__*/_react.default.createElement("div", {
2139
+ id: id,
2140
+ tabIndex: 0,
2141
+ className: "aio-table-unit",
2142
+ onKeyDown: this.keyDown.bind(this),
2143
+ style: this.getStyle(),
2144
+ ref: this.dom,
2145
+ onMouseEnter: function onMouseEnter() {
2146
+ return _onMouseEnter2(index);
2147
+ },
2148
+ onMouseDown: function onMouseDown() {
2149
+ return _onMouseEnter2(index);
2150
+ },
2151
+ onScroll: function onScroll(e) {
2152
+ return _onScroll2(e, index);
2153
+ }
2154
+ }, this.getTitles(), rows && rows.length !== 0 && rows.map(function (row, i) {
2155
+ if (row._groupId) {
2156
+ var width = indent * row._level;
2157
+ return /*#__PURE__*/_react.default.createElement("div", {
2158
+ className: "aio-table-group",
2159
+ key: 'group' + i + '-' + index,
2160
+ style: { ..._this14.getFullCellStyle(),
2161
+ height: rowHeight
2162
+ }
2163
+ }, index !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2164
+ style: {
2165
+ width: width,
2166
+ flexShrink: 0
2167
+ }
2168
+ }), _this14.getGroupToggleIcon(row), /*#__PURE__*/_react.default.createElement("div", {
2169
+ className: "aio-table-group-text"
2170
+ }, row._groupValue)));
1630
2171
  }
1631
2172
 
1632
- return row.cells.map(function (r, j) {
1633
- return /*#__PURE__*/_react.default.createElement(RTableCell, _extends({
1634
- key: i + '-' + j + '-' + index
2173
+ return row[type].map(function (r, j) {
2174
+ var id = i + '-' + j + '-' + index;
2175
+ return /*#__PURE__*/_react.default.createElement(AIOTableCell, _extends({
2176
+ key: id,
2177
+ cellId: id
1635
2178
  }, r, {
1636
- relativeFilter: row.show === 'relativeFilter'
2179
+ row: row.row
1637
2180
  }));
1638
2181
  });
1639
2182
  }), rows && rows.length === 0 && this.getNoData(), !rows && getLoading());
@@ -1643,73 +2186,74 @@ var RTableUnit = /*#__PURE__*/function (_Component3) {
1643
2186
  return RTableUnit;
1644
2187
  }(_react.Component);
1645
2188
 
1646
- _defineProperty(RTableUnit, "contextType", RTableContext);
2189
+ _defineProperty(RTableUnit, "contextType", AioTableContext);
1647
2190
 
1648
- var RTableCell = /*#__PURE__*/function (_Component4) {
1649
- _inherits(RTableCell, _Component4);
2191
+ var AIOTableCell = /*#__PURE__*/function (_Component4) {
2192
+ _inherits(AIOTableCell, _Component4);
1650
2193
 
1651
- var _super4 = _createSuper(RTableCell);
2194
+ var _super4 = _createSuper(AIOTableCell);
1652
2195
 
1653
- function RTableCell(props) {
1654
- var _this14;
2196
+ function AIOTableCell(props) {
2197
+ var _this15;
1655
2198
 
1656
- _classCallCheck(this, RTableCell);
2199
+ _classCallCheck(this, AIOTableCell);
1657
2200
 
1658
- _this14 = _super4.call(this, props);
1659
- _this14.dom = /*#__PURE__*/(0, _react.createRef)();
1660
- var value = _this14.props.value;
1661
- _this14.state = {
2201
+ _this15 = _super4.call(this, props);
2202
+ _this15.dom = /*#__PURE__*/(0, _react.createRef)();
2203
+ var value = _this15.props.value;
2204
+ _this15.state = {
1662
2205
  value: value,
1663
2206
  error: false,
1664
2207
  prevValue: value
1665
2208
  };
1666
- return _this14;
2209
+ return _this15;
1667
2210
  }
1668
2211
 
1669
- _createClass(RTableCell, [{
1670
- key: "getPrev",
1671
- value: function getPrev(row, column) {
1672
- if (!column.prev) {
2212
+ _createClass(AIOTableCell, [{
2213
+ key: "getBefore",
2214
+ value: function getBefore(row, column) {
2215
+ if (!column.before) {
1673
2216
  return '';
1674
2217
  }
1675
2218
 
1676
- var prev = typeof column.prev === 'function' ? column.prev(row, column) : column.prev;
1677
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2219
+ var before = typeof column.before === 'function' ? column.before(row, column) : column.before;
2220
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1678
2221
  className: "aio-table-icon"
1679
- }, prev), this.context.getGap());
2222
+ }, before), this.context.getGap());
1680
2223
  }
1681
2224
  }, {
1682
- key: "getNext",
1683
- value: function getNext(row, column) {
1684
- if (!column.next) {
2225
+ key: "getAfter",
2226
+ value: function getAfter(row, column) {
2227
+ if (!column.after) {
1685
2228
  return '';
1686
2229
  }
1687
2230
 
1688
- var next = typeof column.next === 'function' ? column.next(row, column) : column.next;
1689
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2231
+ var after = typeof column.after === 'function' ? column.after(row, column) : column.after;
2232
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1690
2233
  style: {
1691
2234
  flex: 1
1692
2235
  }
1693
2236
  }), /*#__PURE__*/_react.default.createElement("div", {
1694
2237
  className: "aio-table-icon"
1695
- }, next));
2238
+ }, after));
1696
2239
  }
1697
2240
  }, {
1698
2241
  key: "getStyle",
1699
2242
  value: function getStyle(column) {
2243
+ var _column$padding2 = column.padding,
2244
+ padding = _column$padding2 === void 0 ? '36px' : _column$padding2,
2245
+ template = column.template,
2246
+ _column$minWidth = column.minWidth,
2247
+ minWidth = _column$minWidth === void 0 ? '30px' : _column$minWidth;
1700
2248
  var rowHeight = this.context.rowHeight;
1701
- var _column$minWidth = column.minWidth,
1702
- minWidth = _column$minWidth === void 0 ? '30px' : _column$minWidth,
1703
- justify = column.justify;
1704
2249
  var style = {
1705
2250
  height: rowHeight,
1706
- overflow: column.template ? undefined : 'hidden',
1707
- minWidth: minWidth,
1708
- justifyContent: justify ? 'center' : undefined
2251
+ overflow: template ? undefined : 'hidden',
2252
+ minWidth: minWidth
1709
2253
  };
1710
2254
 
1711
2255
  if (column.template === 'gantt') {
1712
- style.padding = "0 ".concat(column.padding || '36px');
2256
+ style.padding = "0 ".concat(padding);
1713
2257
  }
1714
2258
 
1715
2259
  return style;
@@ -1717,9 +2261,12 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1717
2261
  }, {
1718
2262
  key: "getClassName",
1719
2263
  value: function getClassName(row, column) {
1720
- var relativeFilter = this.props.relativeFilter;
1721
2264
  var className = 'aio-table-cell';
1722
2265
 
2266
+ if (column.template) {
2267
+ className += ' aio-table-cell-template';
2268
+ }
2269
+
1723
2270
  if (column.template === 'gantt') {
1724
2271
  className += ' aio-table-cell-gantt';
1725
2272
  }
@@ -1728,11 +2275,11 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1728
2275
  className += ' ' + column.className;
1729
2276
  }
1730
2277
 
1731
- if (column.input) {
2278
+ if (column.inlineEdit) {
1732
2279
  className += ' aio-table-cell-input';
1733
2280
  }
1734
2281
 
1735
- if (relativeFilter) {
2282
+ if (row._show === 'relativeFilter') {
1736
2283
  className += ' aio-table-relative-filter';
1737
2284
  }
1738
2285
 
@@ -1741,13 +2288,9 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1741
2288
  }, {
1742
2289
  key: "getToggleIcon",
1743
2290
  value: function getToggleIcon(row) {
1744
- var _this$context10 = this.context,
1745
- rtl = _this$context10.rtl,
1746
- onChange = _this$context10.onChange,
1747
- model = _this$context10.model,
1748
- id = _this$context10.id,
1749
- openDictionary = _this$context10.openDictionary,
1750
- SetState = _this$context10.SetState;
2291
+ var _this$context13 = this.context,
2292
+ rtl = _this$context13.rtl,
2293
+ toggleRow = _this$context13.toggleRow;
1751
2294
  var icon;
1752
2295
 
1753
2296
  if (!row._childsLength) {
@@ -1768,71 +2311,40 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1768
2311
  });
1769
2312
  }
1770
2313
 
1771
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
2314
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
1772
2315
  className: "aio-table-toggle",
1773
2316
  onClick: function onClick() {
1774
- if (row._id !== undefined) {
1775
- openDictionary[row._id] = !openDictionary[row._id];
1776
-
1777
- if (id !== undefined) {
1778
- localStorage.setItem('r table ' + id, JSON.stringify(openDictionary));
1779
- }
1780
-
1781
- SetState({
1782
- openDictionary: openDictionary
1783
- });
1784
- } else {
1785
- row._opened = !row._opened;
1786
- onChange({
1787
- model: model
1788
- });
1789
- }
2317
+ return toggleRow(row);
1790
2318
  }
1791
2319
  }, icon), this.context.getGap());
1792
2320
  }
1793
- }, {
1794
- key: "getCheckbox",
1795
- value: function getCheckbox(row, column) {
1796
- var _index = column._index,
1797
- _column$onChange = column.onChange,
1798
- onChange = _column$onChange === void 0 ? function () {} : _column$onChange,
1799
- _column$disabled = column.disabled,
1800
- disabled = _column$disabled === void 0 ? function () {
1801
- return false;
1802
- } : _column$disabled;
1803
- row._values[_index] = row._values[_index] === true ? true : false;
1804
- var value = row._values[_index];
1805
- var isDisabled = disabled(row);
1806
- return /*#__PURE__*/_react.default.createElement("div", {
1807
- className: 'aio-table-checkbox' + (isDisabled ? ' disabled' : ''),
1808
- onClick: function onClick() {
1809
- if (!isDisabled) {
1810
- onChange(row, !value);
1811
- }
1812
- }
1813
- }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
1814
- path: value ? _js.mdiCheckboxMarkedOutline : _js.mdiCheckboxBlankOutline,
1815
- size: 1
1816
- }));
1817
- }
1818
2321
  }, {
1819
2322
  key: "getContent",
1820
2323
  value: function getContent(row, column, value) {
2324
+ var focused = this.context.focused;
1821
2325
  var content = '';
2326
+ var template = typeof column.template === 'function' ? column.template(row, column) : column.template;
1822
2327
 
1823
- if (column.template === 'checkbox') {
1824
- content = this.getCheckbox(row, column);
1825
- } else if (column.template === 'gantt') {
1826
- var _this$context11 = this.context,
1827
- getValueByField = _this$context11.getValueByField,
1828
- rtl = _this$context11.rtl;
1829
- var keys = column.keys,
1830
- _column$color = column.color,
1831
- color = _column$color === void 0 ? '#69bedb' : _column$color,
1832
- _column$progressColor = column.progressColor,
1833
- progressColor = _column$progressColor === void 0 ? '#1891be' : _column$progressColor,
1834
- _column$flags = column.flags,
1835
- flags = _column$flags === void 0 ? [] : _column$flags,
2328
+ if (template === 'slider') {
2329
+ content = /*#__PURE__*/_react.default.createElement(AIOSlider, {
2330
+ row: row,
2331
+ column: column
2332
+ });
2333
+ } else if (template === 'gantt') {
2334
+ var rtl = this.context.rtl;
2335
+ var getKeys = column.getKeys,
2336
+ _column$getColor = column.getColor,
2337
+ getColor = _column$getColor === void 0 ? function () {
2338
+ return '#fff';
2339
+ } : _column$getColor,
2340
+ _column$getBackground = column.getBackgroundColor,
2341
+ getBackgroundColor = _column$getBackground === void 0 ? function () {
2342
+ return '#69bedb';
2343
+ } : _column$getBackground,
2344
+ _column$getFlags = column.getFlags,
2345
+ getFlags = _column$getFlags === void 0 ? function () {
2346
+ return [];
2347
+ } : _column$getFlags,
1836
2348
  _column$getProgress = column.getProgress,
1837
2349
  getProgress = _column$getProgress === void 0 ? function () {
1838
2350
  return false;
@@ -1840,64 +2352,115 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1840
2352
  _column$getText = column.getText,
1841
2353
  getText = _column$getText === void 0 ? function () {
1842
2354
  return false;
1843
- } : _column$getText;
2355
+ } : _column$getText,
2356
+ getStart = column.getStart,
2357
+ getEnd = column.getEnd;
2358
+
2359
+ if (typeof getStart !== 'function') {
2360
+ console.error('aio table => gantt column => column getStart property is not a function');
2361
+ return '';
2362
+ }
2363
+
2364
+ if (typeof getEnd !== 'function') {
2365
+ console.error('aio table => gantt column => column getEnd property is not a function');
2366
+ return '';
2367
+ }
2368
+
2369
+ if (typeof getKeys !== 'function') {
2370
+ console.error('aio table => gantt column => column getKeys property is not a function');
2371
+ return '';
2372
+ }
2373
+
2374
+ var keys = getKeys();
2375
+
2376
+ if (!Array.isArray(keys)) {
2377
+ console.error('aio table => gantt column => column getKeys property must return an array of strings');
2378
+ return '';
2379
+ }
2380
+
2381
+ var color = getColor(row);
2382
+ var backgroundColor = getBackgroundColor(row);
1844
2383
  var progress = getProgress(row);
1845
2384
  var text = getText(row);
1846
- var startIndex = keys.indexOf(getValueByField(row, column.startField));
1847
- var endIndex = keys.indexOf(getValueByField(row, column.endField));
1848
- var background = progress === false ? color : "linear-gradient(to ".concat(rtl ? 'left' : 'right', ",").concat(progressColor, " 0%,").concat(progressColor, " ").concat(progress, "% ,").concat(color, " ").concat(progress, "%,").concat(color, " 100%)");
2385
+ var startIndex = keys.indexOf(getStart(row));
2386
+ var endIndex = keys.indexOf(getEnd(row));
2387
+ var background = progress === false ? color : "linear-gradient(to ".concat(rtl ? 'left' : 'right', ",rgba(0,0,0,.1) 0%,rgba(0,0,0,.1) ").concat(progress, "% ,transparent ").concat(progress, "%,transparent 100%)");
2388
+ var flags = getFlags();
1849
2389
  content = /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
1850
2390
  start: 0,
1851
- editValue: function editValue(_ref) {
1852
- var value = _ref.value;
2391
+ editValue: function editValue(value) {
1853
2392
  return keys[value];
1854
2393
  },
1855
2394
  end: keys.length - 1,
1856
- points: [{
1857
- value: startIndex
1858
- }, {
1859
- value: endIndex,
1860
- fillStyle: {
1861
- background: background
1862
- },
1863
- text: text === false ? undefined : text
1864
- }],
1865
- pin: {
1866
- step: 1,
1867
- style: {
2395
+ points: [startIndex, endIndex],
2396
+ fillStyle: function fillStyle(index) {
2397
+ if (index === 1) {
2398
+ return {
2399
+ background: backgroundColor,
2400
+ backgroundImage: background
2401
+ };
2402
+ }
2403
+ },
2404
+ getText: function getText(index) {
2405
+ if (index === 1 && text) {
2406
+ return text;
2407
+ }
2408
+ },
2409
+ textStyle: function textStyle() {
2410
+ return {
2411
+ color: color
2412
+ };
2413
+ },
2414
+ scaleStep: 1,
2415
+ scaleStyle: function scaleStyle(value) {
2416
+ var flag = flags.filter(function (o) {
2417
+ return keys.indexOf(o.value) === value;
2418
+ })[0];
2419
+
2420
+ if (flag) {
2421
+ return {
2422
+ background: flag.color,
2423
+ height: '100%',
2424
+ top: 0,
2425
+ zIndex: 100
2426
+ };
2427
+ }
2428
+
2429
+ return {
1868
2430
  height: '100%',
1869
2431
  top: 0,
1870
2432
  opacity: .4
1871
- },
1872
- items: flags.map(function (_ref2) {
1873
- var index = _ref2.index,
1874
- value = _ref2.value,
1875
- _ref2$color = _ref2.color,
1876
- color = _ref2$color === void 0 ? 'red' : _ref2$color;
1877
- var flag = index !== undefined ? index : keys.indexOf(value);
1878
- return {
1879
- value: flag,
1880
- style: {
1881
- background: color,
1882
- height: '100%',
1883
- top: 0
1884
- }
1885
- };
1886
- })
2433
+ };
1887
2434
  },
1888
- lineStyle: {
1889
- opacity: .4
2435
+ lineStyle: function lineStyle() {
2436
+ return {
2437
+ opacity: .4
2438
+ };
1890
2439
  }
1891
2440
  });
1892
- } else if (column.template) {
1893
- content = column.template(row, column);
1894
- } else if (column.input) {
2441
+ } else if (template && column.inlineEdit) {
2442
+ if (!focused) {
2443
+ content = template;
2444
+ } else {
2445
+ content = this.getInput(row, column);
2446
+ }
2447
+ } else if (template) {
2448
+ content = template;
2449
+ } else if (column.inlineEdit) {
1895
2450
  content = this.getInput(row, column);
1896
- } else if (column.field) {
2451
+ } else if (column.getValue) {
1897
2452
  content = value;
1898
2453
  }
1899
2454
 
1900
2455
  if (column.subText) {
2456
+ var subText;
2457
+
2458
+ try {
2459
+ subText = column.subText(row);
2460
+ } catch {
2461
+ subText = '';
2462
+ }
2463
+
1901
2464
  return /*#__PURE__*/_react.default.createElement("div", {
1902
2465
  style: {
1903
2466
  flex: 1,
@@ -1923,7 +2486,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1923
2486
  flex: 1,
1924
2487
  position: 'relative'
1925
2488
  }
1926
- }, column.subText(row)));
2489
+ }, subText));
1927
2490
  }
1928
2491
 
1929
2492
  return content;
@@ -1931,39 +2494,47 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1931
2494
  }, {
1932
2495
  key: "getInput",
1933
2496
  value: function getInput(row, column) {
1934
- var _this15 = this;
2497
+ var _this16 = this;
1935
2498
 
1936
- var type = column.input.type;
2499
+ var type = column.inlineEdit.type;
1937
2500
  var value = this.state.value;
1938
- var props = { ...column.input,
2501
+ var _column$inlineEdit$di = column.inlineEdit.disabled,
2502
+ disabled = _column$inlineEdit$di === void 0 ? function () {
2503
+ return false;
2504
+ } : _column$inlineEdit$di;
2505
+ var props = { ...column.inlineEdit,
1939
2506
  className: 'aio-table-input',
1940
2507
  rowindex: row._renderIndex,
1941
2508
  colindex: column._renderIndex,
1942
- value: value
2509
+ value: value === null ? '' : value,
2510
+ disabled: disabled(row)
1943
2511
  };
1944
2512
 
1945
2513
  if (type === 'text' || type === 'number') {
1946
2514
  return /*#__PURE__*/_react.default.createElement("div", {
1947
- className: "aio-table-input-container"
2515
+ className: 'aio-table-input-container'
1948
2516
  }, /*#__PURE__*/_react.default.createElement("input", _extends({}, props, {
2517
+ style: {
2518
+ textAlign: column.justify ? 'center' : undefined
2519
+ },
1949
2520
  onChange: function onChange(e) {
1950
- return _this15.setState({
2521
+ return _this16.setState({
1951
2522
  value: e.target.value
1952
2523
  });
1953
2524
  },
1954
2525
  onBlur: async function onBlur(e) {
1955
- _this15.setState({
2526
+ _this16.setState({
1956
2527
  loading: true
1957
2528
  });
1958
2529
 
1959
- var error = await column.input.onChange(value, row);
2530
+ var error = await column.inlineEdit.onChange(row, type === 'number' ? parseFloat(value) : value);
1960
2531
 
1961
- _this15.setState({
2532
+ _this16.setState({
1962
2533
  loading: false
1963
2534
  });
1964
2535
 
1965
2536
  if (typeof error === 'string') {
1966
- _this15.setState({
2537
+ _this16.setState({
1967
2538
  error: error
1968
2539
  });
1969
2540
  }
@@ -1974,37 +2545,48 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
1974
2545
  }
1975
2546
 
1976
2547
  if (type === 'select') {
2548
+ if (!column.inlineEdit.options) {
2549
+ console.error('aio table => missing options property of column inlineEdit with type="select"');
2550
+ return '';
2551
+ }
2552
+
2553
+ if (!Array.isArray(column.inlineEdit.options)) {
2554
+ console.error('aio table => options property of column inlineEdit with type="select" must be an array of objects . each object must have text and value property!!!');
2555
+ return '';
2556
+ }
2557
+
1977
2558
  return /*#__PURE__*/_react.default.createElement("div", {
1978
2559
  className: "aio-table-input-container"
1979
2560
  }, /*#__PURE__*/_react.default.createElement("select", _extends({}, props, {
1980
2561
  onFocus: function onFocus() {
1981
- return _this15.focus = true;
2562
+ return _this16.focus = true;
1982
2563
  },
1983
2564
  onBlur: function onBlur() {
1984
- return _this15.focus = false;
2565
+ return _this16.focus = false;
1985
2566
  },
1986
2567
  onChange: async function onChange(e) {
1987
2568
  var value = e.target.value;
1988
2569
 
1989
- _this15.setState({
2570
+ _this16.setState({
1990
2571
  loading: true,
1991
2572
  value: value
1992
2573
  });
1993
2574
 
1994
- var error = await column.input.onChange(e.target.value, row);
2575
+ var error = await column.inlineEdit.onChange(row, e.target.value);
1995
2576
 
1996
- _this15.setState({
2577
+ _this16.setState({
1997
2578
  loading: false
1998
2579
  });
1999
2580
 
2000
2581
  if (typeof error === 'string') {
2001
- _this15.setState({
2582
+ _this16.setState({
2002
2583
  error: error
2003
2584
  });
2004
2585
  }
2005
2586
  }
2006
- }), column.input.options.map(function (o) {
2587
+ }), column.inlineEdit.options.map(function (o, i) {
2007
2588
  return /*#__PURE__*/_react.default.createElement("option", {
2589
+ key: i,
2008
2590
  value: o.value
2009
2591
  }, o.text);
2010
2592
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -2012,6 +2594,7 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2012
2594
  }));
2013
2595
  }
2014
2596
 
2597
+ console.error('aio table => missing type property of column input');
2015
2598
  return '';
2016
2599
  }
2017
2600
  }, {
@@ -2019,23 +2602,28 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2019
2602
  value: function componentDidUpdate() {
2020
2603
  var column = this.props.column;
2021
2604
 
2022
- if (column.input && column.input.type === 'select' && this.focus) {
2605
+ if (column.inlineEdit && column.inlineEdit.type === 'select' && this.focus) {
2023
2606
  (0, _jquery.default)(this.dom.current).find('.aio-table-input').focus();
2024
2607
  }
2025
2608
  }
2026
2609
  }, {
2027
2610
  key: "render",
2028
2611
  value: function render() {
2029
- var _this16 = this;
2612
+ var _this17 = this;
2030
2613
 
2031
- var _this$context12 = this.context,
2032
- indent = _this$context12.indent,
2033
- onChange = _this$context12.onChange,
2034
- cubes2 = _this$context12.cubes2;
2035
- var _this$props9 = this.props,
2036
- row = _this$props9.row,
2037
- column = _this$props9.column,
2038
- value = _this$props9.value;
2614
+ var _this$context14 = this.context,
2615
+ indent = _this$context14.indent,
2616
+ cubes2 = _this$context14.cubes2,
2617
+ focused = _this$context14.focused,
2618
+ SetState = _this$context14.SetState,
2619
+ onDrag = _this$context14.onDrag,
2620
+ _onDrop = _this$context14.onDrop,
2621
+ onSwap = _this$context14.onSwap;
2622
+ var _this$props12 = this.props,
2623
+ row = _this$props12.row,
2624
+ column = _this$props12.column,
2625
+ value = _this$props12.value,
2626
+ cellId = _this$props12.cellId;
2039
2627
 
2040
2628
  if (this.state.prevValue !== value) {
2041
2629
  this.setState({
@@ -2044,13 +2632,13 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2044
2632
  });
2045
2633
  }
2046
2634
 
2047
- var _this$state = this.state,
2048
- error = _this$state.error,
2049
- loading = _this$state.loading;
2635
+ var _this$state3 = this.state,
2636
+ error = _this$state3.error,
2637
+ loading = _this$state3.loading;
2050
2638
  var content = this.getContent(row, column, value);
2051
- var prev = this.getPrev(row, column);
2052
- var next = this.getNext(row, column);
2053
- var showToggleIcon = column.treeMode && (row._id !== undefined || onChange);
2639
+ var before = this.getBefore(row, column);
2640
+ var after = this.getAfter(row, column);
2641
+ var showToggleIcon = column.treeMode;
2054
2642
  var cell;
2055
2643
 
2056
2644
  if (loading) {
@@ -2061,25 +2649,33 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2061
2649
  cell = /*#__PURE__*/_react.default.createElement("div", {
2062
2650
  className: "aio-table-error",
2063
2651
  onClick: function onClick() {
2064
- _this16.setState({
2065
- value: _this16.props.value,
2652
+ _this17.setState({
2653
+ value: _this17.props.value,
2066
2654
  error: false
2067
2655
  });
2068
2656
  }
2069
2657
  }, error);
2070
2658
  } else {
2071
- cell = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
2659
+ var style = {
2660
+ justifyContent: column.justify !== false && !column.treeMode ? 'center' : undefined
2661
+ };
2662
+ cell = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, column.treeMode && /*#__PURE__*/_react.default.createElement("div", {
2072
2663
  className: "aio-table-indent",
2073
2664
  style: {
2074
2665
  width: row._level * indent
2075
2666
  }
2076
- }), showToggleIcon && this.getToggleIcon(row), prev, content, next);
2667
+ }), showToggleIcon && this.getToggleIcon(row), before, /*#__PURE__*/_react.default.createElement("div", {
2668
+ className: "aio-table-content",
2669
+ style: style
2670
+ }, content), after);
2077
2671
  }
2078
2672
 
2079
2673
  return /*#__PURE__*/_react.default.createElement("div", {
2080
2674
  key: row._index + '-' + column._index,
2081
2675
  tabIndex: 0,
2082
2676
  ref: this.dom,
2677
+ cellid: cellId,
2678
+ title: typeof content === 'string' ? content : '',
2083
2679
  rowindex: row._renderIndex,
2084
2680
  colindex: column._renderIndex,
2085
2681
  childindex: row._childIndex,
@@ -2089,41 +2685,255 @@ var RTableCell = /*#__PURE__*/function (_Component4) {
2089
2685
  childslength: row._childsLength,
2090
2686
  style: this.getStyle(column),
2091
2687
  className: this.getClassName(row, column),
2092
- onClick: function onClick(e) {}
2688
+ draggable: typeof onSwap === 'function' && column.swap,
2689
+ onDragOver: function onDragOver(e) {
2690
+ return e.preventDefault();
2691
+ },
2692
+ onDragStart: function onDragStart() {
2693
+ return onDrag(row);
2694
+ },
2695
+ onDrop: function onDrop() {
2696
+ return _onDrop(row);
2697
+ },
2698
+ onClick: function onClick(e) {
2699
+ if (column.inlineEdit) {
2700
+ if (focused !== cellId) {
2701
+ SetState({
2702
+ focused: cellId
2703
+ });
2704
+ setTimeout(function () {
2705
+ return (0, _jquery.default)('.aio-table-input:focus').select();
2706
+ }, 10);
2707
+ }
2708
+ }
2709
+ }
2093
2710
  }, cell);
2094
2711
  }
2095
2712
  }]);
2096
2713
 
2097
- return RTableCell;
2714
+ return AIOTableCell;
2098
2715
  }(_react.Component);
2099
2716
 
2100
- _defineProperty(RTableCell, "contextType", RTableContext);
2717
+ _defineProperty(AIOTableCell, "contextType", AioTableContext);
2718
+
2719
+ var AIOSlider = /*#__PURE__*/function (_Component5) {
2720
+ _inherits(AIOSlider, _Component5);
2721
+
2722
+ var _super5 = _createSuper(AIOSlider);
2723
+
2724
+ function AIOSlider(props) {
2725
+ var _this18;
2726
+
2727
+ _classCallCheck(this, AIOSlider);
2728
+
2729
+ _this18 = _super5.call(this, props);
2730
+ var _this18$props = _this18.props,
2731
+ column = _this18$props.column,
2732
+ row = _this18$props.row;
2733
+ var getValue = column.getValue;
2734
+ var value = getValue(row);
2735
+
2736
+ if (!Array.isArray(value)) {
2737
+ value = [value];
2738
+ }
2739
+
2740
+ _this18.state = {
2741
+ value: value
2742
+ };
2743
+ _this18.updateMode = 'outside';
2744
+ return _this18;
2745
+ }
2746
+
2747
+ _createClass(AIOSlider, [{
2748
+ key: "getBackground",
2749
+ value: function getBackground(length, i, color) {
2750
+ if (length === 1 && i === 0) {
2751
+ return color;
2752
+ }
2753
+
2754
+ if (length > 1 && i > 0 && i < length) {
2755
+ return color;
2756
+ }
2757
+
2758
+ return 'transparent';
2759
+ }
2760
+ }, {
2761
+ key: "render",
2762
+ value: function render() {
2763
+ var _this19 = this;
2764
+
2765
+ var _this$props13 = this.props,
2766
+ column = _this$props13.column,
2767
+ row = _this$props13.row;
2768
+ var getValue = column.getValue,
2769
+ _column$getStart = column.getStart,
2770
+ getStart = _column$getStart === void 0 ? function () {
2771
+ return 0;
2772
+ } : _column$getStart,
2773
+ _column$getEnd = column.getEnd,
2774
+ getEnd = _column$getEnd === void 0 ? function () {
2775
+ return 100;
2776
+ } : _column$getEnd,
2777
+ _column$getColor2 = column.getColor,
2778
+ getColor = _column$getColor2 === void 0 ? function () {
2779
+ return 'dodgerblue';
2780
+ } : _column$getColor2,
2781
+ onChange = column.onChange,
2782
+ _column$getMin = column.getMin,
2783
+ getMin = _column$getMin === void 0 ? function () {} : _column$getMin,
2784
+ _column$getMax = column.getMax,
2785
+ getMax = _column$getMax === void 0 ? function () {} : _column$getMax,
2786
+ _column$editValue = column.editValue,
2787
+ editValue = _column$editValue === void 0 ? function (value) {
2788
+ return value;
2789
+ } : _column$editValue,
2790
+ _column$getStep = column.getStep,
2791
+ getStep = _column$getStep === void 0 ? function () {} : _column$getStep;
2792
+ var value = this.state.value;
2793
+ var Value = getValue(row);
2794
+
2795
+ if (Value === false) {
2796
+ return null;
2797
+ }
2798
+
2799
+ if (!Array.isArray(Value)) {
2800
+ Value = [Value];
2801
+ }
2802
+
2803
+ if (this.updateMode === 'onChange') {
2804
+ this.updateMode = 'outside';
2805
+ this.setState({
2806
+ value: Value
2807
+ });
2808
+ return null;
2809
+ } else if (this.updateMode === 'outside' && JSON.stringify(Value) !== JSON.stringify(value)) {
2810
+ this.setState({
2811
+ value: Value
2812
+ });
2813
+ return null;
2814
+ }
2815
+
2816
+ var start = getStart(row);
2817
+ var end = getEnd(row);
2818
+ var color = getColor(row);
2819
+ var min = getMin(row);
2820
+ var max = getMax(row);
2821
+ var step = getStep(row);
2822
+ var pinItems = [];
2823
+
2824
+ if (min !== undefined) {
2825
+ pinItems.push({
2826
+ value: min,
2827
+ style: {
2828
+ height: 10
2829
+ }
2830
+ });
2831
+ }
2832
+
2833
+ if (max !== undefined) {
2834
+ pinItems.push({
2835
+ value: max,
2836
+ style: {
2837
+ height: 10
2838
+ }
2839
+ });
2840
+ }
2841
+
2842
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, value.length > 1 && /*#__PURE__*/_react.default.createElement("div", {
2843
+ className: "aio-table-slider-value"
2844
+ }, editValue(value[0])), /*#__PURE__*/_react.default.createElement(_rRangeSlider.default, {
2845
+ start: start,
2846
+ end: end,
2847
+ min: min,
2848
+ max: max,
2849
+ step: step,
2850
+ showValue: false,
2851
+ points: value.map(function (o, i) {
2852
+ return {
2853
+ value: o,
2854
+ fillStyle: {
2855
+ height: '6px',
2856
+ borderRadius: '24px',
2857
+ background: _this19.getBackground(value.length, i, color)
2858
+ }
2859
+ };
2860
+ }),
2861
+ pointStyle: {
2862
+ opacity: 0,
2863
+ height: 24,
2864
+ width: 24
2865
+ },
2866
+ lineStyle: {
2867
+ height: 6,
2868
+ borderRadius: '24px',
2869
+ boxShadow: 'inset 0px 1px 3px 0px rgba(0,0,0,.1)',
2870
+ background: '#d5d5d5'
2871
+ },
2872
+ editable: typeof onChange === 'function',
2873
+ onchange: function onchange(_ref) {
2874
+ var points = _ref.points;
2875
+
2876
+ if (!onChange) {
2877
+ return;
2878
+ }
2879
+
2880
+ _this19.updateMode = 'onChange';
2881
+ onChange(row, points.length > 1 ? points.map(function (p) {
2882
+ return p.value;
2883
+ }) : points[0].value);
2884
+ },
2885
+ pin: pinItems.length === 0 ? undefined : {
2886
+ items: pinItems
2887
+ },
2888
+ ondrag: function ondrag(_ref2) {
2889
+ var points = _ref2.points;
2890
+ _this19.updateMode = 'onDrag';
2891
+
2892
+ _this19.setState({
2893
+ value: points.map(function (p) {
2894
+ return p.value;
2895
+ })
2896
+ });
2897
+ }
2898
+ }), /*#__PURE__*/_react.default.createElement("div", {
2899
+ className: "aio-table-slider-value"
2900
+ }, editValue(value.length > 1 ? value[1] : value[0])));
2901
+ }
2902
+ }]);
2101
2903
 
2102
- var RTableFilter = /*#__PURE__*/function (_Component5) {
2103
- _inherits(RTableFilter, _Component5);
2904
+ return AIOSlider;
2905
+ }(_react.Component);
2104
2906
 
2105
- var _super5 = _createSuper(RTableFilter);
2907
+ var RTableFilter = /*#__PURE__*/function (_Component6) {
2908
+ _inherits(RTableFilter, _Component6);
2909
+
2910
+ var _super6 = _createSuper(RTableFilter);
2106
2911
 
2107
2912
  function RTableFilter() {
2108
2913
  _classCallCheck(this, RTableFilter);
2109
2914
 
2110
- return _super5.apply(this, arguments);
2915
+ return _super6.apply(this, arguments);
2111
2916
  }
2112
2917
 
2113
2918
  _createClass(RTableFilter, [{
2114
2919
  key: "render",
2115
2920
  value: function render() {
2116
- var _this$context13 = this.context,
2117
- filterDictionary = _this$context13.filterDictionary,
2118
- rtl = _this$context13.rtl;
2921
+ var _this$context15 = this.context,
2922
+ filterDictionary = _this$context15.filterDictionary,
2923
+ rtl = _this$context15.rtl;
2119
2924
  var column = this.props.column;
2120
2925
 
2121
2926
  if (!column.filter || column.search) {
2122
2927
  return null;
2123
2928
  }
2124
2929
 
2930
+ if (!filterDictionary[column._index]) {
2931
+ return null;
2932
+ }
2933
+
2125
2934
  var filters = filterDictionary[column._index].items;
2126
2935
  var icon = filters.length ? /*#__PURE__*/_react.default.createElement(_react2.Icon, {
2936
+ className: "has-filter",
2127
2937
  path: _js.mdiFilterMenu,
2128
2938
  size: 0.7
2129
2939
  }) : /*#__PURE__*/_react.default.createElement(_react2.Icon, {
@@ -2132,11 +2942,12 @@ var RTableFilter = /*#__PURE__*/function (_Component5) {
2132
2942
  });
2133
2943
  return /*#__PURE__*/_react.default.createElement("div", {
2134
2944
  className: "aio-table-filter-icon"
2135
- }, /*#__PURE__*/_react.default.createElement(_rDropdownButton.default, {
2945
+ }, /*#__PURE__*/_react.default.createElement(_aioButton.default, {
2946
+ type: "button",
2136
2947
  rtl: rtl,
2137
2948
  openRelatedTo: ".aio-table",
2138
2949
  text: icon,
2139
- items: function items() {
2950
+ popOver: function popOver() {
2140
2951
  return /*#__PURE__*/_react.default.createElement(RTableFilterPopup, {
2141
2952
  column: column
2142
2953
  });
@@ -2148,25 +2959,26 @@ var RTableFilter = /*#__PURE__*/function (_Component5) {
2148
2959
  return RTableFilter;
2149
2960
  }(_react.Component);
2150
2961
 
2151
- _defineProperty(RTableFilter, "contextType", RTableContext);
2962
+ _defineProperty(RTableFilter, "contextType", AioTableContext);
2152
2963
 
2153
- var RTableFilterPopup = /*#__PURE__*/function (_Component6) {
2154
- _inherits(RTableFilterPopup, _Component6);
2964
+ var RTableFilterPopup = /*#__PURE__*/function (_Component7) {
2965
+ _inherits(RTableFilterPopup, _Component7);
2155
2966
 
2156
- var _super6 = _createSuper(RTableFilterPopup);
2967
+ var _super7 = _createSuper(RTableFilterPopup);
2157
2968
 
2158
2969
  function RTableFilterPopup() {
2159
2970
  _classCallCheck(this, RTableFilterPopup);
2160
2971
 
2161
- return _super6.apply(this, arguments);
2972
+ return _super7.apply(this, arguments);
2162
2973
  }
2163
2974
 
2164
2975
  _createClass(RTableFilterPopup, [{
2165
2976
  key: "add",
2166
2977
  value: function add() {
2167
- var _this$context14 = this.context,
2168
- filterDictionary = _this$context14.filterDictionary,
2169
- SetState = _this$context14.SetState;
2978
+ var _this$context16 = this.context,
2979
+ filterDictionary = _this$context16.filterDictionary,
2980
+ SetState = _this$context16.SetState,
2981
+ onChangeFilter = _this$context16.onChangeFilter;
2170
2982
  var column = this.props.column;
2171
2983
 
2172
2984
  filterDictionary[column._index].items.push({
@@ -2174,6 +2986,10 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component6) {
2174
2986
  value: ''
2175
2987
  });
2176
2988
 
2989
+ if (onChangeFilter) {
2990
+ onChangeFilter(filterDictionary);
2991
+ }
2992
+
2177
2993
  SetState({
2178
2994
  filterDictionary: filterDictionary
2179
2995
  });
@@ -2181,13 +2997,13 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component6) {
2181
2997
  }, {
2182
2998
  key: "render",
2183
2999
  value: function render() {
2184
- var _this17 = this;
3000
+ var _this20 = this;
2185
3001
 
2186
3002
  var column = this.props.column;
2187
- var _this$context15 = this.context,
2188
- filterDictionary = _this$context15.filterDictionary,
2189
- SetState = _this$context15.SetState,
2190
- translate = _this$context15.translate;
3003
+ var _this$context17 = this.context,
3004
+ filterDictionary = _this$context17.filterDictionary,
3005
+ SetState = _this$context17.SetState,
3006
+ translate = _this$context17.translate;
2191
3007
  var filters = filterDictionary[column._index].items;
2192
3008
  var booleanType = filterDictionary[column._index].booleanType;
2193
3009
  var filterItems = filters.map(function (filter, i) {
@@ -2218,7 +3034,7 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component6) {
2218
3034
  }, /*#__PURE__*/_react.default.createElement("button", {
2219
3035
  className: "aio-table-filter-add",
2220
3036
  onClick: function onClick() {
2221
- return _this17.add();
3037
+ return _this20.add();
2222
3038
  }
2223
3039
  }, translate('Add'))));
2224
3040
  }
@@ -2227,37 +3043,42 @@ var RTableFilterPopup = /*#__PURE__*/function (_Component6) {
2227
3043
  return RTableFilterPopup;
2228
3044
  }(_react.Component);
2229
3045
 
2230
- _defineProperty(RTableFilterPopup, "contextType", RTableContext);
3046
+ _defineProperty(RTableFilterPopup, "contextType", AioTableContext);
2231
3047
 
2232
- var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2233
- _inherits(RTableFilterItem, _Component7);
3048
+ var RTableFilterItem = /*#__PURE__*/function (_Component8) {
3049
+ _inherits(RTableFilterItem, _Component8);
2234
3050
 
2235
- var _super7 = _createSuper(RTableFilterItem);
3051
+ var _super8 = _createSuper(RTableFilterItem);
2236
3052
 
2237
3053
  function RTableFilterItem(props) {
2238
- var _this18;
3054
+ var _this21;
2239
3055
 
2240
3056
  _classCallCheck(this, RTableFilterItem);
2241
3057
 
2242
- _this18 = _super7.call(this, props);
2243
- var filter = _this18.props.filter;
2244
- _this18.state = {
3058
+ _this21 = _super8.call(this, props);
3059
+ var filter = _this21.props.filter;
3060
+ _this21.state = {
2245
3061
  value: filter.value,
2246
3062
  prevValue: filter.value
2247
3063
  };
2248
- return _this18;
3064
+ return _this21;
2249
3065
  }
2250
3066
 
2251
3067
  _createClass(RTableFilterItem, [{
2252
3068
  key: "remove",
2253
3069
  value: function remove(index) {
2254
- var _this$context16 = this.context,
2255
- filterDictionary = _this$context16.filterDictionary,
2256
- SetState = _this$context16.SetState;
3070
+ var _this$context18 = this.context,
3071
+ filterDictionary = _this$context18.filterDictionary,
3072
+ SetState = _this$context18.SetState,
3073
+ onChangeFilter = _this$context18.onChangeFilter;
2257
3074
  var column = this.props.column;
2258
3075
 
2259
3076
  filterDictionary[column._index].items.splice(index, 1);
2260
3077
 
3078
+ if (onChangeFilter) {
3079
+ onChangeFilter(filterDictionary);
3080
+ }
3081
+
2261
3082
  SetState({
2262
3083
  filterDictionary: filterDictionary
2263
3084
  });
@@ -2265,20 +3086,26 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2265
3086
  }, {
2266
3087
  key: "changeValue",
2267
3088
  value: function changeValue(value) {
2268
- var _this19 = this;
3089
+ var _this22 = this;
2269
3090
 
3091
+ var onChangeFilter = this.context.onChangeFilter;
2270
3092
  clearTimeout(this.timeout);
2271
3093
  this.setState({
2272
3094
  value: value
2273
3095
  });
2274
3096
  this.timeout = setTimeout(function () {
2275
- var _this19$context = _this19.context,
2276
- SetState = _this19$context.SetState,
2277
- filterDictionary = _this19$context.filterDictionary;
2278
- var _this19$props = _this19.props,
2279
- column = _this19$props.column,
2280
- index = _this19$props.index;
3097
+ var _this22$context = _this22.context,
3098
+ SetState = _this22$context.SetState,
3099
+ filterDictionary = _this22$context.filterDictionary;
3100
+ var _this22$props = _this22.props,
3101
+ column = _this22$props.column,
3102
+ index = _this22$props.index;
2281
3103
  filterDictionary[column._index].items[index].value = value;
3104
+
3105
+ if (onChangeFilter) {
3106
+ onChangeFilter(filterDictionary);
3107
+ }
3108
+
2282
3109
  SetState({
2283
3110
  filterDictionary: filterDictionary
2284
3111
  });
@@ -2287,16 +3114,17 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2287
3114
  }, {
2288
3115
  key: "render",
2289
3116
  value: function render() {
2290
- var _this20 = this;
2291
-
2292
- var _this$context17 = this.context,
2293
- filterDictionary = _this$context17.filterDictionary,
2294
- SetState = _this$context17.SetState,
2295
- translate = _this$context17.translate;
2296
- var _this$props10 = this.props,
2297
- filter = _this$props10.filter,
2298
- column = _this$props10.column,
2299
- index = _this$props10.index;
3117
+ var _this23 = this;
3118
+
3119
+ var _this$context19 = this.context,
3120
+ filterDictionary = _this$context19.filterDictionary,
3121
+ SetState = _this$context19.SetState,
3122
+ translate = _this$context19.translate,
3123
+ onChangeFilter = _this$context19.onChangeFilter;
3124
+ var _this$props14 = this.props,
3125
+ filter = _this$props14.filter,
3126
+ column = _this$props14.column,
3127
+ index = _this$props14.index;
2300
3128
 
2301
3129
  if (this.state.prevValue !== filter.value) {
2302
3130
  this.setState({
@@ -2307,13 +3135,19 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2307
3135
  }
2308
3136
 
2309
3137
  var value = this.state.value;
2310
- var type = column.filter.type;
3138
+ var _column$filter$type = column.filter.type,
3139
+ type = _column$filter$type === void 0 ? 'text' : _column$filter$type;
2311
3140
  return /*#__PURE__*/_react.default.createElement("div", {
2312
3141
  className: "aio-table-filter-item"
2313
3142
  }, /*#__PURE__*/_react.default.createElement("select", {
2314
3143
  value: filter.operator,
2315
3144
  onChange: function onChange(e) {
2316
3145
  filterDictionary[column._index].items[index].operator = e.target.value;
3146
+
3147
+ if (onChangeFilter) {
3148
+ onChangeFilter(filterDictionary);
3149
+ }
3150
+
2317
3151
  SetState({
2318
3152
  filterDictionary: filterDictionary
2319
3153
  });
@@ -2338,7 +3172,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2338
3172
  type: type,
2339
3173
  value: value,
2340
3174
  onChange: function onChange(e) {
2341
- return _this20.changeValue(e.target.value);
3175
+ return _this23.changeValue(e.target.value);
2342
3176
  }
2343
3177
  }), /*#__PURE__*/_react.default.createElement("div", {
2344
3178
  style: {
@@ -2347,7 +3181,7 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2347
3181
  }), /*#__PURE__*/_react.default.createElement("div", {
2348
3182
  className: "aio-table-filter-remove",
2349
3183
  onClick: function onClick() {
2350
- return _this20.remove(index);
3184
+ return _this23.remove(index);
2351
3185
  }
2352
3186
  }, /*#__PURE__*/_react.default.createElement(_react2.Icon, {
2353
3187
  path: _js.mdiClose,
@@ -2359,4 +3193,4 @@ var RTableFilterItem = /*#__PURE__*/function (_Component7) {
2359
3193
  return RTableFilterItem;
2360
3194
  }(_react.Component);
2361
3195
 
2362
- _defineProperty(RTableFilterItem, "contextType", RTableContext);
3196
+ _defineProperty(RTableFilterItem, "contextType", AioTableContext);