bootstrap-table-rails 1.15.4 → 1.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -21
- data/lib/bootstrap-table-rails/version.rb +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table-locale-all.js +182 -0
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.css +1 -1
- data/vendor/assets/javascripts/bootstrap-table/bootstrap-table.js +145 -110
- data/vendor/assets/javascripts/bootstrap-table/extensions/export/bootstrap-table-export.js +34 -28
- data/vendor/assets/javascripts/bootstrap-table/extensions/filter-control/bootstrap-table-filter-control.js +2 -2
- data/vendor/assets/javascripts/bootstrap-table/extensions/sticky-header/bootstrap-table-sticky-header.js +6 -2
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Cyrl-RS.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/locale/bootstrap-table-sr-Latn-RS.js +721 -0
- data/vendor/assets/javascripts/bootstrap-table/themes/bulma/bootstrap-table-bulma.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/foundation/bootstrap-table-foundation.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/materialize/bootstrap-table-materialize.js +1 -1
- data/vendor/assets/javascripts/bootstrap-table/themes/semantic/bootstrap-table-semantic.js +1 -1
- metadata +4 -12
- data/vendor/assets/javascripts/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.css +0 -3
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.css +0 -53
- data/vendor/assets/javascripts/bootstrap-table/extensions/group-by/bootstrap-table-group-by.js +0 -257
- data/vendor/assets/javascripts/bootstrap-table/extensions/multi-column-toggle/bootstrap-table-multi-toggle.js +0 -105
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-search/bootstrap-table-multiple-search.js +0 -85
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.css +0 -17
- data/vendor/assets/javascripts/bootstrap-table/extensions/multiple-selection-row/bootstrap-table-multiple-selection-row.js +0 -143
- data/vendor/assets/javascripts/bootstrap-table/extensions/select2-filter/bootstrap-table-select2-filter.js +0 -341
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.css +0 -1
- data/vendor/assets/javascripts/bootstrap-table/extensions/tree-column/bootstrap-table-tree-column.js +0 -142
@@ -2634,7 +2634,7 @@
|
|
2634
2634
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
2635
2635
|
}
|
2636
2636
|
|
2637
|
-
var VERSION = '1.15.
|
2637
|
+
var VERSION = '1.15.5';
|
2638
2638
|
var bootstrapVersion = 4;
|
2639
2639
|
|
2640
2640
|
try {
|
@@ -2670,6 +2670,7 @@
|
|
2670
2670
|
buttonsDropdown: 'btn-group',
|
2671
2671
|
pull: 'pull',
|
2672
2672
|
inputGroup: 'input-group',
|
2673
|
+
inputPrefix: 'input-',
|
2673
2674
|
input: 'form-control',
|
2674
2675
|
paginationDropdown: 'btn-group dropdown',
|
2675
2676
|
dropup: 'dropup',
|
@@ -2680,7 +2681,7 @@
|
|
2680
2681
|
html: {
|
2681
2682
|
toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
|
2682
2683
|
toolbarDropdownItem: '<li role="menuitem"><label>%s</label></li>',
|
2683
|
-
|
2684
|
+
toolbarDropdownSeparator: '<li class="divider"></li>',
|
2684
2685
|
pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
|
2685
2686
|
pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
|
2686
2687
|
dropdownCaret: '<span class="caret"></span>',
|
@@ -2715,6 +2716,7 @@
|
|
2715
2716
|
buttonsDropdown: 'btn-group',
|
2716
2717
|
pull: 'float',
|
2717
2718
|
inputGroup: 'btn-group',
|
2719
|
+
inputPrefix: 'form-control-',
|
2718
2720
|
input: 'form-control',
|
2719
2721
|
paginationDropdown: 'btn-group dropdown',
|
2720
2722
|
dropup: 'dropup',
|
@@ -2727,7 +2729,7 @@
|
|
2727
2729
|
toolbarDropdownItem: '<label class="dropdown-item">%s</label>',
|
2728
2730
|
pageDropdown: ['<div class="dropdown-menu">', '</div>'],
|
2729
2731
|
pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
|
2730
|
-
|
2732
|
+
toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
|
2731
2733
|
dropdownCaret: '<span class="caret"></span>',
|
2732
2734
|
pagination: ['<ul class="pagination%s">', '</ul>'],
|
2733
2735
|
paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
|
@@ -3667,7 +3669,7 @@
|
|
3667
3669
|
this.itemHeight = options.itemHeight;
|
3668
3670
|
this.cache = {};
|
3669
3671
|
this.scrollTop = this.scrollEl.scrollTop;
|
3670
|
-
this.initDOM(this.rows);
|
3672
|
+
this.initDOM(this.rows, options.fixedScroll);
|
3671
3673
|
this.scrollEl.scrollTop = this.scrollTop;
|
3672
3674
|
this.lastCluster = 0;
|
3673
3675
|
|
@@ -3690,13 +3692,14 @@
|
|
3690
3692
|
|
3691
3693
|
_createClass(VirtualScroll, [{
|
3692
3694
|
key: "initDOM",
|
3693
|
-
value: function initDOM(rows) {
|
3695
|
+
value: function initDOM(rows, fixedScroll) {
|
3694
3696
|
if (typeof this.clusterHeight === 'undefined') {
|
3697
|
+
this.cache.scrollTop = this.scrollEl.scrollTop;
|
3695
3698
|
this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
|
3696
3699
|
this.getRowsHeight(rows);
|
3697
3700
|
}
|
3698
3701
|
|
3699
|
-
var data = this.initData(rows, this.getNum());
|
3702
|
+
var data = this.initData(rows, this.getNum(fixedScroll));
|
3700
3703
|
var thisRows = data.rows.join('');
|
3701
3704
|
var dataChanged = this.checkChanges('data', thisRows);
|
3702
3705
|
var topOffsetChanged = this.checkChanges('top', data.topOffset);
|
@@ -3715,6 +3718,10 @@
|
|
3715
3718
|
}
|
3716
3719
|
|
3717
3720
|
this.contentEl.innerHTML = html.join('');
|
3721
|
+
|
3722
|
+
if (fixedScroll) {
|
3723
|
+
this.contentEl.scrollTop = this.cache.scrollTop;
|
3724
|
+
}
|
3718
3725
|
} else if (bottomOffsetChanged) {
|
3719
3726
|
this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
|
3720
3727
|
}
|
@@ -3734,8 +3741,8 @@
|
|
3734
3741
|
}
|
3735
3742
|
}, {
|
3736
3743
|
key: "getNum",
|
3737
|
-
value: function getNum() {
|
3738
|
-
this.scrollTop = this.scrollEl.scrollTop;
|
3744
|
+
value: function getNum(fixedScroll) {
|
3745
|
+
this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
|
3739
3746
|
return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
|
3740
3747
|
}
|
3741
3748
|
}, {
|
@@ -4247,7 +4254,6 @@
|
|
4247
4254
|
var html = [];
|
4248
4255
|
var timeoutId = 0;
|
4249
4256
|
var $keepOpen;
|
4250
|
-
var $search;
|
4251
4257
|
var switchableCount = 0;
|
4252
4258
|
|
4253
4259
|
if (this.$toolbar.find('.bs-bars').children().length) {
|
@@ -4289,7 +4295,7 @@
|
|
4289
4295
|
if (o.showColumnsToggleAll) {
|
4290
4296
|
var allFieldsVisible = this.getVisibleColumns().length === this.columns.length;
|
4291
4297
|
html.push(Utils.sprintf(this.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', o.formatColumnsToggleAll())));
|
4292
|
-
html.push(this.constants.html.
|
4298
|
+
html.push(this.constants.html.toolbarDropdownSeparator);
|
4293
4299
|
}
|
4294
4300
|
|
4295
4301
|
this.columns.forEach(function (column, i) {
|
@@ -4375,7 +4381,7 @@
|
|
4375
4381
|
html = [];
|
4376
4382
|
var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, o.formatSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.search) : '', o.showButtonText ? o.formatSearch() : '');
|
4377
4383
|
var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, o.formatClearSearch(), o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.clearSearch) : '', o.showButtonText ? o.formatClearSearch() : '');
|
4378
|
-
var searchInputHtml = "<input class=\"".concat(this.constants.classes.input).concat(Utils.sprintf('
|
4384
|
+
var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, o.iconSize), "\n search-input\" type=\"text\" placeholder=\"").concat(o.formatSearch(), "\">");
|
4379
4385
|
var searchInputFinalHtml = searchInputHtml;
|
4380
4386
|
|
4381
4387
|
if (o.showSearchButton || o.showSearchClearButton) {
|
@@ -4386,25 +4392,43 @@
|
|
4386
4392
|
html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(o.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
|
4387
4393
|
this.$toolbar.append(html.join(''));
|
4388
4394
|
var $searchInput = this.$toolbar.find('.search input');
|
4389
|
-
$search = o.showSearchButton ? this.$toolbar.find('.search button[name=search]') : $searchInput;
|
4390
|
-
var eventTriggers = o.showSearchButton ? 'click' : Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur';
|
4391
|
-
$search.off(eventTriggers).on(eventTriggers, function (event) {
|
4392
|
-
if (o.searchOnEnterKey && event.keyCode !== 13) {
|
4393
|
-
return;
|
4394
|
-
}
|
4395
4395
|
|
4396
|
-
|
4397
|
-
|
4398
|
-
|
4396
|
+
var handleInputEvent = function handleInputEvent() {
|
4397
|
+
var eventTriggers = Utils.isIEBrowser() ? 'mouseup' : 'keyup drop blur';
|
4398
|
+
$searchInput.off(eventTriggers).on(eventTriggers, function (event) {
|
4399
|
+
if (o.searchOnEnterKey && event.keyCode !== 13) {
|
4400
|
+
return;
|
4401
|
+
}
|
4399
4402
|
|
4400
|
-
|
4403
|
+
if ([37, 38, 39, 40].includes(event.keyCode)) {
|
4404
|
+
return;
|
4405
|
+
}
|
4401
4406
|
|
4402
|
-
|
4403
|
-
|
4404
|
-
|
4405
|
-
|
4406
|
-
|
4407
|
-
|
4407
|
+
clearTimeout(timeoutId); // doesn't matter if it's 0
|
4408
|
+
|
4409
|
+
timeoutId = setTimeout(function () {
|
4410
|
+
_this4.onSearch(event);
|
4411
|
+
}, o.searchTimeOut);
|
4412
|
+
});
|
4413
|
+
};
|
4414
|
+
|
4415
|
+
if (o.showSearchButton) {
|
4416
|
+
this.$toolbar.find('.search button[name=search]').off('click').on('click', function (event) {
|
4417
|
+
clearTimeout(timeoutId); // doesn't matter if it's 0
|
4418
|
+
|
4419
|
+
timeoutId = setTimeout(function () {
|
4420
|
+
_this4.onSearch({
|
4421
|
+
currentTarget: $searchInput
|
4422
|
+
});
|
4423
|
+
}, o.searchTimeOut);
|
4424
|
+
});
|
4425
|
+
|
4426
|
+
if (o.searchOnEnterKey) {
|
4427
|
+
handleInputEvent();
|
4428
|
+
}
|
4429
|
+
} else {
|
4430
|
+
handleInputEvent();
|
4431
|
+
}
|
4408
4432
|
|
4409
4433
|
if (o.showSearchClearButton) {
|
4410
4434
|
this.$toolbar.find('.search button[name=clearSearch]').click(function () {
|
@@ -5170,11 +5194,14 @@
|
|
5170
5194
|
|
5171
5195
|
this.virtualScroll = new VirtualScroll({
|
5172
5196
|
rows: rows,
|
5197
|
+
fixedScroll: fixedScroll,
|
5173
5198
|
scrollEl: this.$tableBody[0],
|
5174
5199
|
contentEl: this.$body[0],
|
5175
5200
|
itemHeight: this.options.virtualScrollItemHeight,
|
5176
5201
|
callback: function callback() {
|
5177
5202
|
_this8.fitHeader();
|
5203
|
+
|
5204
|
+
_this8.initBodyEvent();
|
5178
5205
|
}
|
5179
5206
|
});
|
5180
5207
|
}
|
@@ -5182,53 +5209,69 @@
|
|
5182
5209
|
|
5183
5210
|
if (!fixedScroll) {
|
5184
5211
|
this.scrollTo(0);
|
5185
|
-
}
|
5212
|
+
}
|
5186
5213
|
|
5214
|
+
this.initBodyEvent();
|
5215
|
+
this.updateSelected();
|
5216
|
+
this.initFooter();
|
5217
|
+
this.resetView();
|
5187
5218
|
|
5219
|
+
if (this.options.sidePagination !== 'server') {
|
5220
|
+
this.options.totalRows = data.length;
|
5221
|
+
}
|
5222
|
+
|
5223
|
+
this.trigger('post-body', data);
|
5224
|
+
}
|
5225
|
+
}, {
|
5226
|
+
key: "initBodyEvent",
|
5227
|
+
value: function initBodyEvent() {
|
5228
|
+
var _this9 = this;
|
5229
|
+
|
5230
|
+
// click to select by column
|
5188
5231
|
this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
|
5189
5232
|
var $td = $(e.currentTarget);
|
5190
5233
|
var $tr = $td.parent();
|
5191
5234
|
var $cardViewArr = $(e.target).parents('.card-views').children();
|
5192
5235
|
var $cardViewTarget = $(e.target).parents('.card-view');
|
5193
5236
|
var rowIndex = $tr.data('index');
|
5194
|
-
var item =
|
5195
|
-
var index =
|
5237
|
+
var item = _this9.data[rowIndex];
|
5238
|
+
var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
|
5196
5239
|
|
5197
|
-
var fields =
|
5240
|
+
var fields = _this9.getVisibleFields();
|
5198
5241
|
|
5199
|
-
var field = fields[
|
5200
|
-
var column =
|
5201
|
-
var value = Utils.getItemField(item, field,
|
5242
|
+
var field = fields[_this9.options.detailView && _this9.options.detailViewIcon && !_this9.options.cardView ? index - 1 : index];
|
5243
|
+
var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
|
5244
|
+
var value = Utils.getItemField(item, field, _this9.options.escape);
|
5202
5245
|
|
5203
5246
|
if ($td.find('.detail-icon').length) {
|
5204
5247
|
return;
|
5205
5248
|
}
|
5206
5249
|
|
5207
|
-
|
5250
|
+
_this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
|
5208
5251
|
|
5209
|
-
|
5252
|
+
_this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
|
5210
5253
|
|
5211
5254
|
|
5212
|
-
if (e.type === 'click' &&
|
5213
|
-
var $selectItem = $tr.find(Utils.sprintf('[name="%s"]',
|
5255
|
+
if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
|
5256
|
+
var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
|
5214
5257
|
|
5215
5258
|
if ($selectItem.length) {
|
5216
5259
|
$selectItem[0].click();
|
5217
5260
|
}
|
5218
5261
|
}
|
5219
5262
|
|
5220
|
-
if (e.type === 'click' &&
|
5221
|
-
|
5263
|
+
if (e.type === 'click' && _this9.options.detailViewByClick) {
|
5264
|
+
_this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
|
5222
5265
|
}
|
5223
5266
|
}).off('mousedown').on('mousedown', function (e) {
|
5224
5267
|
// https://github.com/jquery/jquery/issues/1741
|
5225
|
-
|
5226
|
-
|
5268
|
+
_this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
|
5269
|
+
_this9.multipleSelectRowShiftKey = e.shiftKey;
|
5227
5270
|
});
|
5228
5271
|
this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
|
5229
5272
|
e.preventDefault();
|
5230
5273
|
|
5231
|
-
|
5274
|
+
_this9.toggleDetailView($(e.currentTarget).parent().parent().data('index'));
|
5232
5275
|
|
5233
5276
|
return false;
|
5234
5277
|
});
|
@@ -5237,7 +5280,7 @@
|
|
5237
5280
|
e.stopImmediatePropagation();
|
5238
5281
|
var $this = $(e.currentTarget);
|
5239
5282
|
|
5240
|
-
|
5283
|
+
_this9._toggleCheck($this.prop('checked'), $this.data('index'));
|
5241
5284
|
});
|
5242
5285
|
this.header.events.forEach(function (_events, i) {
|
5243
5286
|
var events = _events;
|
@@ -5251,15 +5294,15 @@
|
|
5251
5294
|
events = Utils.calculateObjectValue(null, events);
|
5252
5295
|
}
|
5253
5296
|
|
5254
|
-
var field =
|
5297
|
+
var field = _this9.header.fields[i];
|
5255
5298
|
|
5256
|
-
var fieldIndex =
|
5299
|
+
var fieldIndex = _this9.getVisibleFields().indexOf(field);
|
5257
5300
|
|
5258
5301
|
if (fieldIndex === -1) {
|
5259
5302
|
return;
|
5260
5303
|
}
|
5261
5304
|
|
5262
|
-
if (
|
5305
|
+
if (_this9.options.detailView && !_this9.options.cardView) {
|
5263
5306
|
fieldIndex += 1;
|
5264
5307
|
}
|
5265
5308
|
|
@@ -5270,17 +5313,17 @@
|
|
5270
5313
|
|
5271
5314
|
var event = events[key];
|
5272
5315
|
|
5273
|
-
|
5316
|
+
_this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
|
5274
5317
|
var $tr = $(tr);
|
5275
|
-
var $td = $tr.find(
|
5318
|
+
var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
|
5276
5319
|
var index = key.indexOf(' ');
|
5277
5320
|
var name = key.substring(0, index);
|
5278
5321
|
var el = key.substring(index + 1);
|
5279
5322
|
$td.find(el).off(name).on(name, function (e) {
|
5280
5323
|
var index = $tr.data('index');
|
5281
|
-
var row =
|
5324
|
+
var row = _this9.data[index];
|
5282
5325
|
var value = row[field];
|
5283
|
-
event.apply(
|
5326
|
+
event.apply(_this9, [e, value, row, index]);
|
5284
5327
|
});
|
5285
5328
|
});
|
5286
5329
|
};
|
@@ -5291,20 +5334,11 @@
|
|
5291
5334
|
if (_ret === "continue") continue;
|
5292
5335
|
}
|
5293
5336
|
});
|
5294
|
-
this.updateSelected();
|
5295
|
-
this.initFooter();
|
5296
|
-
this.resetView();
|
5297
|
-
|
5298
|
-
if (this.options.sidePagination !== 'server') {
|
5299
|
-
this.options.totalRows = data.length;
|
5300
|
-
}
|
5301
|
-
|
5302
|
-
this.trigger('post-body', data);
|
5303
5337
|
}
|
5304
5338
|
}, {
|
5305
5339
|
key: "initServer",
|
5306
5340
|
value: function initServer(silent, query, url) {
|
5307
|
-
var
|
5341
|
+
var _this10 = this;
|
5308
5342
|
|
5309
5343
|
var data = {};
|
5310
5344
|
var index = this.header.fields.indexOf(this.options.sortName);
|
@@ -5366,31 +5400,31 @@
|
|
5366
5400
|
cache: this.options.cache,
|
5367
5401
|
contentType: this.options.contentType,
|
5368
5402
|
dataType: this.options.dataType,
|
5369
|
-
success: function success(_res) {
|
5370
|
-
var res = Utils.calculateObjectValue(
|
5403
|
+
success: function success(_res, textStatus, jqXHR) {
|
5404
|
+
var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
|
5371
5405
|
|
5372
|
-
|
5406
|
+
_this10.load(res);
|
5373
5407
|
|
5374
|
-
|
5408
|
+
_this10.trigger('load-success', res, jqXHR.status, jqXHR);
|
5375
5409
|
|
5376
5410
|
if (!silent) {
|
5377
|
-
|
5411
|
+
_this10.hideLoading();
|
5378
5412
|
}
|
5379
5413
|
},
|
5380
5414
|
error: function error(jqXHR) {
|
5381
5415
|
var data = [];
|
5382
5416
|
|
5383
|
-
if (
|
5417
|
+
if (_this10.options.sidePagination === 'server') {
|
5384
5418
|
data = {};
|
5385
|
-
data[
|
5386
|
-
data[
|
5419
|
+
data[_this10.options.totalField] = 0;
|
5420
|
+
data[_this10.options.dataField] = [];
|
5387
5421
|
}
|
5388
5422
|
|
5389
|
-
|
5423
|
+
_this10.load(data);
|
5390
5424
|
|
5391
|
-
|
5425
|
+
_this10.trigger('load-error', jqXHR.status, jqXHR);
|
5392
5426
|
|
5393
|
-
if (!silent)
|
5427
|
+
if (!silent) _this10.$tableLoading.hide();
|
5394
5428
|
}
|
5395
5429
|
});
|
5396
5430
|
|
@@ -5425,10 +5459,10 @@
|
|
5425
5459
|
}, {
|
5426
5460
|
key: "getCaret",
|
5427
5461
|
value: function getCaret() {
|
5428
|
-
var
|
5462
|
+
var _this11 = this;
|
5429
5463
|
|
5430
5464
|
this.$header.find('th').each(function (i, th) {
|
5431
|
-
$(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') ===
|
5465
|
+
$(th).find('.sortable').removeClass('desc asc').addClass($(th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
|
5432
5466
|
});
|
5433
5467
|
}
|
5434
5468
|
}, {
|
@@ -5443,10 +5477,10 @@
|
|
5443
5477
|
}, {
|
5444
5478
|
key: "updateRows",
|
5445
5479
|
value: function updateRows() {
|
5446
|
-
var
|
5480
|
+
var _this12 = this;
|
5447
5481
|
|
5448
5482
|
this.$selectItem.each(function (i, el) {
|
5449
|
-
|
5483
|
+
_this12.data[$(el).data('index')][_this12.header.stateField] = $(el).prop('checked');
|
5450
5484
|
});
|
5451
5485
|
}
|
5452
5486
|
}, {
|
@@ -5503,23 +5537,23 @@
|
|
5503
5537
|
}, {
|
5504
5538
|
key: "resetHeader",
|
5505
5539
|
value: function resetHeader() {
|
5506
|
-
var
|
5540
|
+
var _this13 = this;
|
5507
5541
|
|
5508
5542
|
// fix #61: the hidden table reset header bug.
|
5509
5543
|
// fix bug: get $el.css('width') error sometime (height = 500)
|
5510
5544
|
clearTimeout(this.timeoutId_);
|
5511
5545
|
this.timeoutId_ = setTimeout(function () {
|
5512
|
-
return
|
5546
|
+
return _this13.fitHeader();
|
5513
5547
|
}, this.$el.is(':hidden') ? 100 : 0);
|
5514
5548
|
}
|
5515
5549
|
}, {
|
5516
5550
|
key: "fitHeader",
|
5517
5551
|
value: function fitHeader() {
|
5518
|
-
var
|
5552
|
+
var _this14 = this;
|
5519
5553
|
|
5520
5554
|
if (this.$el.is(':hidden')) {
|
5521
5555
|
this.timeoutId_ = setTimeout(function () {
|
5522
|
-
return
|
5556
|
+
return _this14.fitHeader();
|
5523
5557
|
}, 100);
|
5524
5558
|
return;
|
5525
5559
|
}
|
@@ -5558,7 +5592,7 @@
|
|
5558
5592
|
|
5559
5593
|
|
5560
5594
|
this.$header.find('th[data-field]').each(function (i, el) {
|
5561
|
-
|
5595
|
+
_this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $(el).data('field'))).data($(el).data());
|
5562
5596
|
});
|
5563
5597
|
var visibleFields = this.getVisibleFields();
|
5564
5598
|
var $ths = this.$header_.find('th');
|
@@ -5572,7 +5606,7 @@
|
|
5572
5606
|
var $this = $(el);
|
5573
5607
|
var index = i;
|
5574
5608
|
|
5575
|
-
if (
|
5609
|
+
if (_this14.options.detailView && _this14.options.detailViewIcon && !_this14.options.cardView) {
|
5576
5610
|
if (i === 0) {
|
5577
5611
|
var $thDetail = $ths.filter('.detail');
|
5578
5612
|
|
@@ -5588,7 +5622,7 @@
|
|
5588
5622
|
return;
|
5589
5623
|
}
|
5590
5624
|
|
5591
|
-
var $th =
|
5625
|
+
var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
|
5592
5626
|
|
5593
5627
|
if ($th.length > 1) {
|
5594
5628
|
$th = $($ths[$this[0].cellIndex]);
|
@@ -5683,11 +5717,11 @@
|
|
5683
5717
|
}, {
|
5684
5718
|
key: "fitFooter",
|
5685
5719
|
value: function fitFooter() {
|
5686
|
-
var
|
5720
|
+
var _this15 = this;
|
5687
5721
|
|
5688
5722
|
if (this.$el.is(':hidden')) {
|
5689
5723
|
setTimeout(function () {
|
5690
|
-
return
|
5724
|
+
return _this15.fitFooter();
|
5691
5725
|
}, 100);
|
5692
5726
|
return;
|
5693
5727
|
}
|
@@ -5707,7 +5741,7 @@
|
|
5707
5741
|
var $this = $(el);
|
5708
5742
|
var index = i;
|
5709
5743
|
|
5710
|
-
if (
|
5744
|
+
if (_this15.options.detailView && !_this15.options.cardView) {
|
5711
5745
|
if (i === 0) {
|
5712
5746
|
var $thDetail = $ths.filter('.detail');
|
5713
5747
|
|
@@ -5732,21 +5766,22 @@
|
|
5732
5766
|
}, {
|
5733
5767
|
key: "horizontalScroll",
|
5734
5768
|
value: function horizontalScroll() {
|
5735
|
-
var
|
5769
|
+
var _this16 = this;
|
5736
5770
|
|
5737
5771
|
// horizontal scroll event
|
5738
5772
|
// TODO: it's probably better improving the layout than binding to scroll event
|
5739
|
-
this.trigger('scroll-body');
|
5740
5773
|
this.$tableBody.off('scroll').on('scroll', function (_ref6) {
|
5741
5774
|
var currentTarget = _ref6.currentTarget;
|
5742
5775
|
|
5743
|
-
if (
|
5744
|
-
|
5776
|
+
if (_this16.options.showHeader && _this16.options.height) {
|
5777
|
+
_this16.$tableHeader.scrollLeft($(currentTarget).scrollLeft());
|
5745
5778
|
}
|
5746
5779
|
|
5747
|
-
if (
|
5748
|
-
|
5780
|
+
if (_this16.options.showFooter && !_this16.options.cardView) {
|
5781
|
+
_this16.$tableFooter.scrollLeft($(currentTarget).scrollLeft());
|
5749
5782
|
}
|
5783
|
+
|
5784
|
+
_this16.trigger('scroll-body', $(currentTarget));
|
5750
5785
|
});
|
5751
5786
|
}
|
5752
5787
|
}, {
|
@@ -5838,20 +5873,20 @@
|
|
5838
5873
|
}, {
|
5839
5874
|
key: "getSelections",
|
5840
5875
|
value: function getSelections() {
|
5841
|
-
var
|
5876
|
+
var _this17 = this;
|
5842
5877
|
|
5843
5878
|
// fix #2424: from html with checkbox
|
5844
5879
|
return this.data.filter(function (row) {
|
5845
|
-
return row[
|
5880
|
+
return row[_this17.header.stateField] === true;
|
5846
5881
|
});
|
5847
5882
|
}
|
5848
5883
|
}, {
|
5849
5884
|
key: "getAllSelections",
|
5850
5885
|
value: function getAllSelections() {
|
5851
|
-
var
|
5886
|
+
var _this18 = this;
|
5852
5887
|
|
5853
5888
|
return this.options.data.filter(function (row) {
|
5854
|
-
return row[
|
5889
|
+
return row[_this18.header.stateField] === true;
|
5855
5890
|
});
|
5856
5891
|
}
|
5857
5892
|
}, {
|
@@ -6123,7 +6158,7 @@
|
|
6123
6158
|
}, {
|
6124
6159
|
key: "updateCellByUniqueId",
|
6125
6160
|
value: function updateCellByUniqueId(params) {
|
6126
|
-
var
|
6161
|
+
var _this19 = this;
|
6127
6162
|
|
6128
6163
|
if (!params.hasOwnProperty('id') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
|
6129
6164
|
return;
|
@@ -6135,13 +6170,13 @@
|
|
6135
6170
|
field = _ref7.field,
|
6136
6171
|
value = _ref7.value;
|
6137
6172
|
|
6138
|
-
var rowId =
|
6173
|
+
var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
|
6139
6174
|
|
6140
6175
|
if (rowId === -1) {
|
6141
6176
|
return;
|
6142
6177
|
}
|
6143
6178
|
|
6144
|
-
|
6179
|
+
_this19.options.data[rowId][field] = value;
|
6145
6180
|
});
|
6146
6181
|
|
6147
6182
|
if (params.reinit === false) {
|
@@ -6235,21 +6270,21 @@
|
|
6235
6270
|
}, {
|
6236
6271
|
key: "showColumn",
|
6237
6272
|
value: function showColumn(field) {
|
6238
|
-
var
|
6273
|
+
var _this20 = this;
|
6239
6274
|
|
6240
6275
|
var fields = Array.isArray(field) ? field : [field];
|
6241
6276
|
fields.forEach(function (field) {
|
6242
|
-
|
6277
|
+
_this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
|
6243
6278
|
});
|
6244
6279
|
}
|
6245
6280
|
}, {
|
6246
6281
|
key: "hideColumn",
|
6247
6282
|
value: function hideColumn(field) {
|
6248
|
-
var
|
6283
|
+
var _this21 = this;
|
6249
6284
|
|
6250
6285
|
var fields = Array.isArray(field) ? field : [field];
|
6251
6286
|
fields.forEach(function (field) {
|
6252
|
-
|
6287
|
+
_this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
|
6253
6288
|
});
|
6254
6289
|
}
|
6255
6290
|
}, {
|
@@ -6306,7 +6341,7 @@
|
|
6306
6341
|
}, {
|
6307
6342
|
key: "_toggleAllColumns",
|
6308
6343
|
value: function _toggleAllColumns(visible) {
|
6309
|
-
var
|
6344
|
+
var _this22 = this;
|
6310
6345
|
|
6311
6346
|
var _iteratorNormalCompletion8 = true;
|
6312
6347
|
var _didIteratorError8 = false;
|
@@ -6351,7 +6386,7 @@
|
|
6351
6386
|
$items.prop('checked', visible);
|
6352
6387
|
} else {
|
6353
6388
|
$items.get().reverse().forEach(function (item) {
|
6354
|
-
if ($items.filter(':checked').length >
|
6389
|
+
if ($items.filter(':checked').length > _this22.options.minimumCountColumns) {
|
6355
6390
|
$(item).prop('checked', visible);
|
6356
6391
|
}
|
6357
6392
|
});
|
@@ -6509,7 +6544,7 @@
|
|
6509
6544
|
}, {
|
6510
6545
|
key: "_toggleCheckBy",
|
6511
6546
|
value: function _toggleCheckBy(checked, obj) {
|
6512
|
-
var
|
6547
|
+
var _this23 = this;
|
6513
6548
|
|
6514
6549
|
if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
|
6515
6550
|
return;
|
@@ -6522,7 +6557,7 @@
|
|
6522
6557
|
}
|
6523
6558
|
|
6524
6559
|
if (obj.values.includes(row[obj.field])) {
|
6525
|
-
var $el =
|
6560
|
+
var $el = _this23.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
|
6526
6561
|
|
6527
6562
|
$el = checked ? $el.not(':checked') : $el.filter(':checked');
|
6528
6563
|
|
@@ -6531,10 +6566,10 @@
|
|
6531
6566
|
}
|
6532
6567
|
|
6533
6568
|
$el.prop('checked', checked);
|
6534
|
-
row[
|
6569
|
+
row[_this23.header.stateField] = checked;
|
6535
6570
|
rows.push(row);
|
6536
6571
|
|
6537
|
-
|
6572
|
+
_this23.trigger(checked ? 'check' : 'uncheck', row, $el);
|
6538
6573
|
}
|
6539
6574
|
});
|
6540
6575
|
this.updateSelected();
|
@@ -6581,7 +6616,7 @@
|
|
6581
6616
|
if (!this.options.cardView && this.options.showHeader && this.options.height) {
|
6582
6617
|
this.$tableHeader.show();
|
6583
6618
|
this.resetHeader();
|
6584
|
-
padding += this.$header.outerHeight(true);
|
6619
|
+
padding += this.$header.outerHeight(true) + 1;
|
6585
6620
|
} else {
|
6586
6621
|
this.$tableHeader.hide();
|
6587
6622
|
this.trigger('post-header');
|