@king-design/vue 3.3.3 → 3.4.0-beta.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.
- package/components/table/index.spec.js +313 -221
- package/components/table/useChecked.js +3 -1
- package/components/table/useDisableRow.js +3 -1
- package/components/table/useMerge.js +6 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
- package/styles/fonts/ionicons.js +2 -1
- package/yarn-error.log +44 -43
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
1
2
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
4
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
4
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
6
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find-index";
|
|
7
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
5
8
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
9
|
+
import { __decorate } from "tslib";
|
|
6
10
|
import BasicDemo from '~/components/table/demos/basic';
|
|
7
11
|
import CheckTypeDemo from '~/components/table/demos/checkType';
|
|
8
12
|
import ExpandDemo from '~/components/table/demos/rowExpandable';
|
|
@@ -20,6 +24,7 @@ import ScrollToRowDemo from '~/components/table/demos/scrollToRow';
|
|
|
20
24
|
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
21
25
|
import { Component } from 'intact-vue-next';
|
|
22
26
|
import { Table, TableColumn } from './';
|
|
27
|
+
import { bind } from '../utils';
|
|
23
28
|
import DraggableTable from '~/components/table/demos/draggable';
|
|
24
29
|
import MergeCellDemo from '~/components/table/demos/mergeCell';
|
|
25
30
|
import { AllCheckedStatus } from './useChecked';
|
|
@@ -266,15 +271,102 @@ describe('Table', function () {
|
|
|
266
271
|
}
|
|
267
272
|
}, _callee5);
|
|
268
273
|
})));
|
|
269
|
-
it('
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
it('append a row in merged table', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
275
|
+
var _context8;
|
|
276
|
+
var uniqueId, Demo, _mount6, instance, element, _instance$get, data;
|
|
277
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context9) {
|
|
278
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
279
|
+
case 0:
|
|
280
|
+
uniqueId = 0;
|
|
281
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
282
|
+
_inheritsLoose(Demo, _Component);
|
|
283
|
+
function Demo() {
|
|
284
|
+
var _context6;
|
|
285
|
+
var _this;
|
|
286
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
287
|
+
args[_key] = arguments[_key];
|
|
288
|
+
}
|
|
289
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context6 = [this]).call(_context6, args)) || this;
|
|
290
|
+
_this.Table = Table;
|
|
291
|
+
_this.TableColumn = TableColumn;
|
|
292
|
+
return _this;
|
|
293
|
+
}
|
|
294
|
+
Demo.defaults = function defaults() {
|
|
295
|
+
return {
|
|
296
|
+
data: [{
|
|
297
|
+
Name: '刘备',
|
|
298
|
+
Title: '大哥',
|
|
299
|
+
uniqueId: 0
|
|
300
|
+
}]
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
var _proto = Demo.prototype;
|
|
304
|
+
_proto.merge = function merge(row, column, rowIndex, columnIndex) {
|
|
305
|
+
var _this$get = this.get(),
|
|
306
|
+
data = _this$get.data;
|
|
307
|
+
var _loop = function _loop(i) {
|
|
308
|
+
var _context7;
|
|
309
|
+
var mergeIndex = _findIndexInstanceProperty(data).call(data, function (item, index) {
|
|
310
|
+
var _data$i;
|
|
311
|
+
return index > i && item.Name !== ((_data$i = data[i]) == null ? void 0 : _data$i.Name);
|
|
312
|
+
});
|
|
313
|
+
var allSame = data.every(function (item, index) {
|
|
314
|
+
if (index > i) {
|
|
315
|
+
return item.Name === data[i].Name;
|
|
316
|
+
}
|
|
317
|
+
return true;
|
|
318
|
+
});
|
|
319
|
+
if (_includesInstanceProperty(_context7 = [0, 1, 2]).call(_context7, columnIndex) && rowIndex === i) {
|
|
320
|
+
if (mergeIndex === -1 && allSame) {
|
|
321
|
+
return {
|
|
322
|
+
v: {
|
|
323
|
+
rowspan: data.length - i
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (mergeIndex > -1) {
|
|
328
|
+
return {
|
|
329
|
+
v: {
|
|
330
|
+
rowspan: mergeIndex - i
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
_ret;
|
|
337
|
+
for (var i = 0; i < data.length; i++) {
|
|
338
|
+
_ret = _loop(i);
|
|
339
|
+
if (_ret) return _ret.v;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return Demo;
|
|
343
|
+
}(Component);
|
|
344
|
+
Demo.template = "\n const {Table, TableColumn} = this;\n const { data } = this.get();\n <Table data={data} merge={this.merge} rowKey={data => data.uniqueId} animation={false}>\n <TableColumn title=\"\u540D\u79F0\" key=\"Name\" />\n <TableColumn title=\"\u5934\u8854\" key=\"Title\" />\n <TableColumn title=\"uniqueId\" key=\"uniqueId\" />\n </Table>\n ";
|
|
345
|
+
__decorate([bind], Demo.prototype, "merge", null);
|
|
346
|
+
_mount6 = mount(Demo), instance = _mount6[0], element = _mount6[1];
|
|
347
|
+
_instance$get = instance.get(), data = _instance$get.data;
|
|
348
|
+
instance.set('data', _concatInstanceProperty(_context8 = []).call(_context8, data, [_extends({}, data[data.length - 1], {
|
|
349
|
+
uniqueId: ++uniqueId
|
|
350
|
+
})]));
|
|
351
|
+
_context9.next = 9;
|
|
352
|
+
return wait();
|
|
353
|
+
case 9:
|
|
354
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
355
|
+
case 10:
|
|
356
|
+
case "end":
|
|
357
|
+
return _context9.stop();
|
|
358
|
+
}
|
|
359
|
+
}, _callee6);
|
|
360
|
+
})));
|
|
361
|
+
it('sort', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
362
|
+
var _mount7, instance, element, _element$querySelecto7, th1, th2;
|
|
363
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context10) {
|
|
364
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
273
365
|
case 0:
|
|
274
|
-
|
|
366
|
+
_mount7 = mount(SortDemo), instance = _mount7[0], element = _mount7[1];
|
|
275
367
|
_element$querySelecto7 = element.querySelectorAll('thead th'), th1 = _element$querySelecto7[1], th2 = _element$querySelecto7[2];
|
|
276
368
|
th1.click();
|
|
277
|
-
|
|
369
|
+
_context10.next = 5;
|
|
278
370
|
return wait();
|
|
279
371
|
case 5:
|
|
280
372
|
expect(instance.get('sort')).to.eql({
|
|
@@ -282,7 +374,7 @@ describe('Table', function () {
|
|
|
282
374
|
type: 'desc'
|
|
283
375
|
});
|
|
284
376
|
th2.click();
|
|
285
|
-
|
|
377
|
+
_context10.next = 9;
|
|
286
378
|
return wait();
|
|
287
379
|
case 9:
|
|
288
380
|
expect(instance.get('sort')).to.eql({
|
|
@@ -290,7 +382,7 @@ describe('Table', function () {
|
|
|
290
382
|
type: 'desc'
|
|
291
383
|
});
|
|
292
384
|
th2.click();
|
|
293
|
-
|
|
385
|
+
_context10.next = 13;
|
|
294
386
|
return wait();
|
|
295
387
|
case 13:
|
|
296
388
|
expect(instance.get('sort')).to.eql({
|
|
@@ -298,34 +390,34 @@ describe('Table', function () {
|
|
|
298
390
|
type: 'asc'
|
|
299
391
|
});
|
|
300
392
|
th2.click();
|
|
301
|
-
|
|
393
|
+
_context10.next = 17;
|
|
302
394
|
return wait();
|
|
303
395
|
case 17:
|
|
304
396
|
expect(instance.get('sort')).to.eql({});
|
|
305
397
|
case 18:
|
|
306
398
|
case "end":
|
|
307
|
-
return
|
|
399
|
+
return _context10.stop();
|
|
308
400
|
}
|
|
309
|
-
},
|
|
401
|
+
}, _callee7);
|
|
310
402
|
})));
|
|
311
|
-
it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
312
|
-
var
|
|
313
|
-
return _regeneratorRuntime.wrap(function
|
|
314
|
-
while (1) switch (
|
|
403
|
+
it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
404
|
+
var _mount8, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, _dropdown2$querySelec2, checkAll, reset, confirm, newDropdown;
|
|
405
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context11) {
|
|
406
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
315
407
|
case 0:
|
|
316
|
-
|
|
408
|
+
_mount8 = mount(GroupDemo), instance = _mount8[0], element = _mount8[1];
|
|
317
409
|
_instance$refs4 = instance.refs, __test1 = _instance$refs4.__test1, __test2 = _instance$refs4.__test2;
|
|
318
410
|
_element$querySelecto8 = element.querySelectorAll('.k-table'), table1 = _element$querySelecto8[0], table2 = _element$querySelecto8[1];
|
|
319
411
|
icon = table1.querySelector('.k-table-group');
|
|
320
412
|
dispatchEvent(icon, 'click');
|
|
321
|
-
|
|
413
|
+
_context11.next = 7;
|
|
322
414
|
return wait();
|
|
323
415
|
case 7:
|
|
324
416
|
dropdown = getElement('.k-table-group-dropdown');
|
|
325
417
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
326
418
|
item = dropdown.querySelector('.k-dropdown-item:nth-child(2)');
|
|
327
419
|
item.click();
|
|
328
|
-
|
|
420
|
+
_context11.next = 13;
|
|
329
421
|
return wait();
|
|
330
422
|
case 13:
|
|
331
423
|
expect(instance.get('group')).to.eql({
|
|
@@ -334,14 +426,14 @@ describe('Table', function () {
|
|
|
334
426
|
expect(table1.innerHTML).to.matchSnapshot();
|
|
335
427
|
icon2 = table2.querySelector('.k-table-group');
|
|
336
428
|
dispatchEvent(icon2, 'click');
|
|
337
|
-
|
|
429
|
+
_context11.next = 19;
|
|
338
430
|
return wait();
|
|
339
431
|
case 19:
|
|
340
432
|
dropdown2 = getElement('.k-table-group-dropdown');
|
|
341
433
|
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
342
434
|
_dropdown2$querySelec = dropdown2.querySelectorAll('.k-checkbox'), item1 = _dropdown2$querySelec[0], item2 = _dropdown2$querySelec[1];
|
|
343
435
|
item1.click();
|
|
344
|
-
|
|
436
|
+
_context11.next = 25;
|
|
345
437
|
return wait();
|
|
346
438
|
case 25:
|
|
347
439
|
expect(instance.get('multipleGroup')).to.eql({
|
|
@@ -349,7 +441,7 @@ describe('Table', function () {
|
|
|
349
441
|
});
|
|
350
442
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
351
443
|
item2.click();
|
|
352
|
-
|
|
444
|
+
_context11.next = 30;
|
|
353
445
|
return wait();
|
|
354
446
|
case 30:
|
|
355
447
|
expect(instance.get('multipleGroup')).to.eql({
|
|
@@ -358,7 +450,7 @@ describe('Table', function () {
|
|
|
358
450
|
// click confirm
|
|
359
451
|
_dropdown2$querySelec2 = dropdown2.querySelectorAll('.k-table-group-footer .k-btn'), checkAll = _dropdown2$querySelec2[0], reset = _dropdown2$querySelec2[1], confirm = _dropdown2$querySelec2[2];
|
|
360
452
|
confirm.click();
|
|
361
|
-
|
|
453
|
+
_context11.next = 35;
|
|
362
454
|
return wait();
|
|
363
455
|
case 35:
|
|
364
456
|
expect(instance.get('multipleGroup')).to.eql({
|
|
@@ -367,12 +459,12 @@ describe('Table', function () {
|
|
|
367
459
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
368
460
|
// click reset
|
|
369
461
|
dispatchEvent(icon2, 'click');
|
|
370
|
-
|
|
462
|
+
_context11.next = 40;
|
|
371
463
|
return wait();
|
|
372
464
|
case 40:
|
|
373
465
|
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
374
466
|
reset.click();
|
|
375
|
-
|
|
467
|
+
_context11.next = 44;
|
|
376
468
|
return wait();
|
|
377
469
|
case 44:
|
|
378
470
|
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
@@ -381,11 +473,11 @@ describe('Table', function () {
|
|
|
381
473
|
});
|
|
382
474
|
// click checkAll
|
|
383
475
|
dispatchEvent(icon2, 'click');
|
|
384
|
-
|
|
476
|
+
_context11.next = 49;
|
|
385
477
|
return wait();
|
|
386
478
|
case 49:
|
|
387
479
|
checkAll.click();
|
|
388
|
-
|
|
480
|
+
_context11.next = 52;
|
|
389
481
|
return wait();
|
|
390
482
|
case 52:
|
|
391
483
|
expect(dropdown2.querySelectorAll('.k-checkbox.k-checked')).to.length(2);
|
|
@@ -395,56 +487,56 @@ describe('Table', function () {
|
|
|
395
487
|
value: 'value'
|
|
396
488
|
}]);
|
|
397
489
|
dispatchEvent(icon, 'click');
|
|
398
|
-
|
|
490
|
+
_context11.next = 57;
|
|
399
491
|
return wait(500);
|
|
400
492
|
case 57:
|
|
401
493
|
newDropdown = getElement('.k-table-group-dropdown');
|
|
402
494
|
expect(newDropdown.innerHTML).to.matchSnapshot();
|
|
403
495
|
case 59:
|
|
404
496
|
case "end":
|
|
405
|
-
return
|
|
497
|
+
return _context11.stop();
|
|
406
498
|
}
|
|
407
|
-
},
|
|
499
|
+
}, _callee8);
|
|
408
500
|
})));
|
|
409
|
-
it('fix columns', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
410
|
-
var
|
|
411
|
-
return _regeneratorRuntime.wrap(function
|
|
412
|
-
while (1) switch (
|
|
501
|
+
it('fix columns', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
502
|
+
var _mount9, instance, element, table, tableElement, scrollElement;
|
|
503
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context12) {
|
|
504
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
413
505
|
case 0:
|
|
414
|
-
|
|
506
|
+
_mount9 = mount(FixColumnDemo), instance = _mount9[0], element = _mount9[1];
|
|
415
507
|
table = instance.refs.__test;
|
|
416
508
|
element.style.width = "1000px";
|
|
417
509
|
tableElement = element.querySelector('.k-table:nth-child(2)');
|
|
418
510
|
scrollElement = tableElement.querySelector('.k-table-wrapper'); // should add k-scroll-middle classname
|
|
419
511
|
scrollElement.scrollLeft = 100;
|
|
420
|
-
|
|
512
|
+
_context12.next = 8;
|
|
421
513
|
return wait(100);
|
|
422
514
|
case 8:
|
|
423
515
|
expect(tableElement.outerHTML).to.matchSnapshot();
|
|
424
516
|
// should add k-scroll-right classname
|
|
425
517
|
scrollElement.scrollLeft = 1000;
|
|
426
|
-
|
|
518
|
+
_context12.next = 12;
|
|
427
519
|
return wait(100);
|
|
428
520
|
case 12:
|
|
429
521
|
expect(tableElement.outerHTML).to.matchSnapshot();
|
|
430
522
|
// should change max-height if we set fixHeader to true
|
|
431
523
|
table.set('fixHeader', true);
|
|
432
|
-
|
|
524
|
+
_context12.next = 16;
|
|
433
525
|
return wait();
|
|
434
526
|
case 16:
|
|
435
527
|
expect(tableElement.outerHTML).to.matchSnapshot();
|
|
436
528
|
case 17:
|
|
437
529
|
case "end":
|
|
438
|
-
return
|
|
530
|
+
return _context12.stop();
|
|
439
531
|
}
|
|
440
|
-
},
|
|
532
|
+
}, _callee9);
|
|
441
533
|
})));
|
|
442
|
-
it('resize', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
443
|
-
var
|
|
444
|
-
return _regeneratorRuntime.wrap(function
|
|
445
|
-
while (1) switch (
|
|
534
|
+
it('resize', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
535
|
+
var _mount10, instance, element, table, resize;
|
|
536
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context13) {
|
|
537
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
446
538
|
case 0:
|
|
447
|
-
|
|
539
|
+
_mount10 = mount(BasicDemo), instance = _mount10[0], element = _mount10[1];
|
|
448
540
|
table = instance.refs.__test;
|
|
449
541
|
resize = element.querySelector('.k-table-resize');
|
|
450
542
|
dispatchEvent(resize, 'mousedown', {
|
|
@@ -455,24 +547,24 @@ describe('Table', function () {
|
|
|
455
547
|
clientX: 1
|
|
456
548
|
});
|
|
457
549
|
dispatchEvent(document, 'mouseup');
|
|
458
|
-
|
|
550
|
+
_context13.next = 8;
|
|
459
551
|
return wait();
|
|
460
552
|
case 8:
|
|
461
553
|
expect(element.innerHTML).to.matchSnapshot();
|
|
462
554
|
case 9:
|
|
463
555
|
case "end":
|
|
464
|
-
return
|
|
556
|
+
return _context13.stop();
|
|
465
557
|
}
|
|
466
|
-
},
|
|
558
|
+
}, _callee10);
|
|
467
559
|
})));
|
|
468
|
-
it('store width on resizing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
469
|
-
var
|
|
470
|
-
return _regeneratorRuntime.wrap(function
|
|
471
|
-
while (1) switch (
|
|
560
|
+
it('store width on resizing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
561
|
+
var _mount11, instance, element, resize, innerHTML, _mount12, table;
|
|
562
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context14) {
|
|
563
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
472
564
|
case 0:
|
|
473
565
|
localStorage.removeItem('resizableTable');
|
|
474
|
-
|
|
475
|
-
|
|
566
|
+
_mount11 = mount(ResizableDemo), instance = _mount11[0], element = _mount11[1]; // should equal to minWidth
|
|
567
|
+
_context14.next = 4;
|
|
476
568
|
return wait();
|
|
477
569
|
case 4:
|
|
478
570
|
expect(element.querySelector('thead th:nth-child(4)').offsetWidth).to.eql(300);
|
|
@@ -485,29 +577,29 @@ describe('Table', function () {
|
|
|
485
577
|
clientX: 1
|
|
486
578
|
});
|
|
487
579
|
dispatchEvent(document, 'mouseup');
|
|
488
|
-
|
|
580
|
+
_context14.next = 11;
|
|
489
581
|
return wait();
|
|
490
582
|
case 11:
|
|
491
583
|
// rerender
|
|
492
584
|
innerHTML = element.innerHTML;
|
|
493
585
|
unmount();
|
|
494
|
-
|
|
586
|
+
_mount12 = mount(ResizableDemo), table = _mount12[1];
|
|
495
587
|
expect(table.innerHTML).to.matchSnapshot();
|
|
496
588
|
expect(table.innerHTML).to.eql(innerHTML);
|
|
497
589
|
localStorage.removeItem('resizableTable');
|
|
498
590
|
case 17:
|
|
499
591
|
case "end":
|
|
500
|
-
return
|
|
592
|
+
return _context14.stop();
|
|
501
593
|
}
|
|
502
|
-
},
|
|
594
|
+
}, _callee11);
|
|
503
595
|
})));
|
|
504
|
-
it('resize column that its previous column is hidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
505
|
-
var
|
|
506
|
-
return _regeneratorRuntime.wrap(function
|
|
507
|
-
while (1) switch (
|
|
596
|
+
it('resize column that its previous column is hidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
597
|
+
var _mount13, instance, element, resize;
|
|
598
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context15) {
|
|
599
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
508
600
|
case 0:
|
|
509
601
|
localStorage.removeItem('resizableTable');
|
|
510
|
-
|
|
602
|
+
_mount13 = mount(ResizableDemo, null, ResizableDemoData), instance = _mount13[0], element = _mount13[1];
|
|
511
603
|
resize = element.querySelector('thead th:nth-child(4) .k-table-resize');
|
|
512
604
|
dispatchEvent(resize, 'mousedown', {
|
|
513
605
|
which: 1,
|
|
@@ -517,23 +609,23 @@ describe('Table', function () {
|
|
|
517
609
|
clientX: 1
|
|
518
610
|
});
|
|
519
611
|
dispatchEvent(document, 'mouseup');
|
|
520
|
-
|
|
612
|
+
_context15.next = 8;
|
|
521
613
|
return wait();
|
|
522
614
|
case 8:
|
|
523
615
|
expect(element.innerHTML).to.matchSnapshot();
|
|
524
616
|
localStorage.removeItem('resizableTable');
|
|
525
617
|
case 10:
|
|
526
618
|
case "end":
|
|
527
|
-
return
|
|
619
|
+
return _context15.stop();
|
|
528
620
|
}
|
|
529
|
-
},
|
|
621
|
+
}, _callee12);
|
|
530
622
|
})));
|
|
531
|
-
it('should set the width of table equal to container after resizing and expanding container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
532
|
-
var
|
|
533
|
-
return _regeneratorRuntime.wrap(function
|
|
534
|
-
while (1) switch (
|
|
623
|
+
it('should set the width of table equal to container after resizing and expanding container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
624
|
+
var _mount14, instance, element, resize, container;
|
|
625
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context16) {
|
|
626
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
535
627
|
case 0:
|
|
536
|
-
|
|
628
|
+
_mount14 = mount(BasicDemo), instance = _mount14[0], element = _mount14[1];
|
|
537
629
|
resize = element.querySelector('.k-table-resize');
|
|
538
630
|
dispatchEvent(resize, 'mousedown', {
|
|
539
631
|
which: 1,
|
|
@@ -543,63 +635,63 @@ describe('Table', function () {
|
|
|
543
635
|
clientX: 1
|
|
544
636
|
});
|
|
545
637
|
dispatchEvent(document, 'mouseup');
|
|
546
|
-
|
|
638
|
+
_context16.next = 7;
|
|
547
639
|
return wait();
|
|
548
640
|
case 7:
|
|
549
641
|
container = element.parentNode;
|
|
550
642
|
container.style.width = '1000px';
|
|
551
|
-
|
|
643
|
+
_context16.next = 11;
|
|
552
644
|
return wait(200);
|
|
553
645
|
case 11:
|
|
554
646
|
expect(element.querySelector('table').style.width).to.eql('1000px');
|
|
555
647
|
case 12:
|
|
556
648
|
case "end":
|
|
557
|
-
return
|
|
649
|
+
return _context16.stop();
|
|
558
650
|
}
|
|
559
|
-
},
|
|
651
|
+
}, _callee13);
|
|
560
652
|
})));
|
|
561
|
-
it('loading', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
562
|
-
var
|
|
563
|
-
return _regeneratorRuntime.wrap(function
|
|
564
|
-
while (1) switch (
|
|
653
|
+
it('loading', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
654
|
+
var _mount15, instance, element;
|
|
655
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context17) {
|
|
656
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
565
657
|
case 0:
|
|
566
|
-
|
|
658
|
+
_mount15 = mount(LoadingDemo), instance = _mount15[0], element = _mount15[1];
|
|
567
659
|
instance.set('loading', true);
|
|
568
|
-
|
|
660
|
+
_context17.next = 4;
|
|
569
661
|
return wait();
|
|
570
662
|
case 4:
|
|
571
663
|
expect(element.innerHTML).to.matchSnapshot();
|
|
572
664
|
instance.set('loading', false);
|
|
573
|
-
|
|
665
|
+
_context17.next = 8;
|
|
574
666
|
return wait();
|
|
575
667
|
case 8:
|
|
576
668
|
expect(element.innerHTML).to.matchSnapshot();
|
|
577
669
|
case 9:
|
|
578
670
|
case "end":
|
|
579
|
-
return
|
|
671
|
+
return _context17.stop();
|
|
580
672
|
}
|
|
581
|
-
},
|
|
673
|
+
}, _callee14);
|
|
582
674
|
})));
|
|
583
|
-
it('export', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
584
|
-
var
|
|
585
|
-
return _regeneratorRuntime.wrap(function
|
|
586
|
-
while (1) switch (
|
|
675
|
+
it('export', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
676
|
+
var _mount16, instance, element, content, content1, csv;
|
|
677
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context18) {
|
|
678
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
587
679
|
case 0:
|
|
588
680
|
this.timeout(0);
|
|
589
|
-
|
|
590
|
-
|
|
681
|
+
_mount16 = mount(ExportDemo), instance = _mount16[0], element = _mount16[1];
|
|
682
|
+
_context18.next = 4;
|
|
591
683
|
return instance.refs.table.exportTable();
|
|
592
684
|
case 4:
|
|
593
|
-
content =
|
|
685
|
+
content = _context18.sent;
|
|
594
686
|
expect(content.replace(/\r\n|\r/g, '\n')).to.matchSnapshot();
|
|
595
|
-
|
|
687
|
+
_context18.next = 8;
|
|
596
688
|
return instance.refs.table.exportTable([{
|
|
597
689
|
a: '1',
|
|
598
690
|
b: 2,
|
|
599
691
|
c: 3
|
|
600
692
|
}]);
|
|
601
693
|
case 8:
|
|
602
|
-
content1 =
|
|
694
|
+
content1 = _context18.sent;
|
|
603
695
|
expect(content1.replace(/\r\n|\r/g, '\n')).to.matchSnapshot();
|
|
604
696
|
// it will be error codes if downloadjs exports below contents
|
|
605
697
|
// use custom download function instead
|
|
@@ -607,151 +699,151 @@ describe('Table', function () {
|
|
|
607
699
|
download(csv, 'test.csv');
|
|
608
700
|
case 12:
|
|
609
701
|
case "end":
|
|
610
|
-
return
|
|
702
|
+
return _context18.stop();
|
|
611
703
|
}
|
|
612
|
-
},
|
|
704
|
+
}, _callee15, this);
|
|
613
705
|
})));
|
|
614
|
-
it('selectedKeys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
615
|
-
var
|
|
616
|
-
return _regeneratorRuntime.wrap(function
|
|
617
|
-
while (1) switch (
|
|
706
|
+
it('selectedKeys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
707
|
+
var _mount17, instance, element, _element$querySelecto9, table1, table2, _table1$querySelector3, tr1, tr2, _table2$querySelector3, tr21, tr22;
|
|
708
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context19) {
|
|
709
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
618
710
|
case 0:
|
|
619
|
-
|
|
711
|
+
_mount17 = mount(SelectedKeysDemo), instance = _mount17[0], element = _mount17[1];
|
|
620
712
|
_element$querySelecto9 = element.querySelectorAll('tbody'), table1 = _element$querySelecto9[0], table2 = _element$querySelecto9[1];
|
|
621
713
|
_table1$querySelector3 = table1.querySelectorAll('tr'), tr1 = _table1$querySelector3[0], tr2 = _table1$querySelector3[1];
|
|
622
714
|
tr1.click();
|
|
623
|
-
|
|
715
|
+
_context19.next = 6;
|
|
624
716
|
return wait();
|
|
625
717
|
case 6:
|
|
626
718
|
expect(table1.innerHTML).to.matchSnapshot();
|
|
627
719
|
tr2.click();
|
|
628
|
-
|
|
720
|
+
_context19.next = 10;
|
|
629
721
|
return wait();
|
|
630
722
|
case 10:
|
|
631
723
|
expect(table1.innerHTML).to.matchSnapshot();
|
|
632
724
|
expect(instance.refs.__test1.getSelectedData()).to.have.lengthOf(1);
|
|
633
725
|
tr2.click();
|
|
634
|
-
|
|
726
|
+
_context19.next = 15;
|
|
635
727
|
return wait();
|
|
636
728
|
case 15:
|
|
637
729
|
expect(table1.innerHTML).to.matchSnapshot();
|
|
638
730
|
expect(instance.refs.__test1.getSelectedData()).to.have.lengthOf(0);
|
|
639
731
|
_table2$querySelector3 = table2.querySelectorAll('tr'), tr21 = _table2$querySelector3[0], tr22 = _table2$querySelector3[1];
|
|
640
732
|
tr21.click();
|
|
641
|
-
|
|
733
|
+
_context19.next = 21;
|
|
642
734
|
return wait();
|
|
643
735
|
case 21:
|
|
644
736
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
645
737
|
tr22.click();
|
|
646
|
-
|
|
738
|
+
_context19.next = 25;
|
|
647
739
|
return wait();
|
|
648
740
|
case 25:
|
|
649
741
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
650
742
|
expect(instance.refs.__test2.getSelectedData()).to.have.lengthOf(2);
|
|
651
743
|
tr22.click();
|
|
652
|
-
|
|
744
|
+
_context19.next = 30;
|
|
653
745
|
return wait();
|
|
654
746
|
case 30:
|
|
655
747
|
expect(table2.innerHTML).to.matchSnapshot();
|
|
656
748
|
expect(instance.refs.__test2.getSelectedData()).to.have.lengthOf(1);
|
|
657
749
|
case 32:
|
|
658
750
|
case "end":
|
|
659
|
-
return
|
|
751
|
+
return _context19.stop();
|
|
660
752
|
}
|
|
661
|
-
},
|
|
753
|
+
}, _callee16);
|
|
662
754
|
})));
|
|
663
|
-
it('tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
664
|
-
var
|
|
665
|
-
return _regeneratorRuntime.wrap(function
|
|
666
|
-
while (1) switch (
|
|
755
|
+
it('tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
756
|
+
var _mount18, instance, element, tr, content;
|
|
757
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context20) {
|
|
758
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
667
759
|
case 0:
|
|
668
|
-
|
|
760
|
+
_mount18 = mount(TooltipDemo), instance = _mount18[0], element = _mount18[1];
|
|
669
761
|
tr = element.querySelector('tbody tr');
|
|
670
762
|
dispatchEvent(tr, 'mouseenter');
|
|
671
|
-
|
|
763
|
+
_context20.next = 5;
|
|
672
764
|
return wait();
|
|
673
765
|
case 5:
|
|
674
766
|
content = getElement('.k-tooltip-content');
|
|
675
767
|
expect(content.textContent).to.matchSnapshot();
|
|
676
768
|
case 7:
|
|
677
769
|
case "end":
|
|
678
|
-
return
|
|
770
|
+
return _context20.stop();
|
|
679
771
|
}
|
|
680
|
-
},
|
|
772
|
+
}, _callee17);
|
|
681
773
|
})));
|
|
682
|
-
it('tree', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
683
|
-
var
|
|
684
|
-
return _regeneratorRuntime.wrap(function
|
|
685
|
-
while (1) switch (
|
|
774
|
+
it('tree', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
775
|
+
var _mount19, instance, element, table, checkbox, arrow;
|
|
776
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context21) {
|
|
777
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
686
778
|
case 0:
|
|
687
|
-
|
|
779
|
+
_mount19 = mount(TreeDemo), instance = _mount19[0], element = _mount19[1];
|
|
688
780
|
table = instance.$lastInput.children; // check all
|
|
689
781
|
checkbox = element.querySelector('.k-checkbox');
|
|
690
782
|
checkbox.click();
|
|
691
|
-
|
|
783
|
+
_context21.next = 6;
|
|
692
784
|
return wait();
|
|
693
785
|
case 6:
|
|
694
786
|
expect(element.innerHTML).to.matchSnapshot();
|
|
695
787
|
expect(table.getCheckedData()).to.have.lengthOf(8);
|
|
696
788
|
arrow = element.querySelector('.k-table-arrow');
|
|
697
789
|
arrow.click();
|
|
698
|
-
|
|
790
|
+
_context21.next = 12;
|
|
699
791
|
return wait();
|
|
700
792
|
case 12:
|
|
701
793
|
expect(element.innerHTML).to.matchSnapshot();
|
|
702
794
|
arrow.click();
|
|
703
|
-
|
|
795
|
+
_context21.next = 16;
|
|
704
796
|
return wait();
|
|
705
797
|
case 16:
|
|
706
798
|
expect(element.innerHTML).to.matchSnapshot();
|
|
707
799
|
expect(table.getCheckedData()).to.have.lengthOf(8);
|
|
708
800
|
case 18:
|
|
709
801
|
case "end":
|
|
710
|
-
return
|
|
802
|
+
return _context21.stop();
|
|
711
803
|
}
|
|
712
|
-
},
|
|
804
|
+
}, _callee18);
|
|
713
805
|
})));
|
|
714
|
-
it('should keep checked status of the disabled row', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
715
|
-
var
|
|
716
|
-
return _regeneratorRuntime.wrap(function
|
|
717
|
-
while (1) switch (
|
|
806
|
+
it('should keep checked status of the disabled row', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
807
|
+
var _mount20, instance, element, checked, checkbox, _element$querySelecto10, checkbox2, checkbox4;
|
|
808
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context22) {
|
|
809
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
718
810
|
case 0:
|
|
719
|
-
|
|
811
|
+
_mount20 = mount(DisabledDemo), instance = _mount20[0], element = _mount20[1];
|
|
720
812
|
checked = instance.$lastInput.children.checked;
|
|
721
813
|
checkbox = element.querySelector('.k-checkbox');
|
|
722
814
|
checkbox.click();
|
|
723
|
-
|
|
815
|
+
_context22.next = 6;
|
|
724
816
|
return wait();
|
|
725
817
|
case 6:
|
|
726
818
|
expect(instance.get('checkedKeys')).to.eql(['3', '2', '4']);
|
|
727
819
|
checkbox.click();
|
|
728
|
-
|
|
820
|
+
_context22.next = 10;
|
|
729
821
|
return wait();
|
|
730
822
|
case 10:
|
|
731
823
|
expect(instance.get('checkedKeys')).to.eql(['3']);
|
|
732
824
|
_element$querySelecto10 = element.querySelectorAll('.k-checkbox'), checkbox2 = _element$querySelecto10[2], checkbox4 = _element$querySelecto10[4];
|
|
733
825
|
checkbox2.click();
|
|
734
|
-
|
|
826
|
+
_context22.next = 15;
|
|
735
827
|
return wait();
|
|
736
828
|
case 15:
|
|
737
829
|
expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.Indeterminate);
|
|
738
830
|
checkbox4.click();
|
|
739
|
-
|
|
831
|
+
_context22.next = 19;
|
|
740
832
|
return wait();
|
|
741
833
|
case 19:
|
|
742
834
|
expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.All);
|
|
743
835
|
case 20:
|
|
744
836
|
case "end":
|
|
745
|
-
return
|
|
837
|
+
return _context22.stop();
|
|
746
838
|
}
|
|
747
|
-
},
|
|
839
|
+
}, _callee19);
|
|
748
840
|
})));
|
|
749
|
-
it('scroll to row', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
750
|
-
var
|
|
751
|
-
return _regeneratorRuntime.wrap(function
|
|
752
|
-
while (1) switch (
|
|
841
|
+
it('scroll to row', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
|
|
842
|
+
var _mount21, instance, element, table, scroll, tr, height, test;
|
|
843
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context23) {
|
|
844
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
753
845
|
case 0:
|
|
754
|
-
|
|
846
|
+
_mount21 = mount(ScrollToRowDemo), instance = _mount21[0], element = _mount21[1];
|
|
755
847
|
table = instance.refs.table;
|
|
756
848
|
scroll = element.querySelector('.k-table-wrapper');
|
|
757
849
|
tr = element.querySelector('tbody tr');
|
|
@@ -759,55 +851,55 @@ describe('Table', function () {
|
|
|
759
851
|
test = function test(rows) {
|
|
760
852
|
expect(scroll.scrollTop).to.eql(height * rows);
|
|
761
853
|
};
|
|
762
|
-
|
|
854
|
+
_context23.next = 8;
|
|
763
855
|
return table.scrollToRowByIndex(2);
|
|
764
856
|
case 8:
|
|
765
857
|
test(2);
|
|
766
|
-
|
|
858
|
+
_context23.next = 11;
|
|
767
859
|
return table.scrollToRowByIndex(1);
|
|
768
860
|
case 11:
|
|
769
861
|
test(1);
|
|
770
|
-
|
|
862
|
+
_context23.next = 14;
|
|
771
863
|
return table.scrollToRowByKey('name 3');
|
|
772
864
|
case 14:
|
|
773
865
|
test(2);
|
|
774
|
-
|
|
866
|
+
_context23.next = 17;
|
|
775
867
|
return table.scrollToRowByKey('name 2');
|
|
776
868
|
case 17:
|
|
777
869
|
test(1);
|
|
778
870
|
case 18:
|
|
779
871
|
case "end":
|
|
780
|
-
return
|
|
872
|
+
return _context23.stop();
|
|
781
873
|
}
|
|
782
|
-
},
|
|
874
|
+
}, _callee20);
|
|
783
875
|
})));
|
|
784
876
|
it('render a hidden table with minWidth', function () {
|
|
785
|
-
var Demo = /*#__PURE__*/function (
|
|
786
|
-
_inheritsLoose(Demo,
|
|
877
|
+
var Demo = /*#__PURE__*/function (_Component2) {
|
|
878
|
+
_inheritsLoose(Demo, _Component2);
|
|
787
879
|
function Demo() {
|
|
788
|
-
var
|
|
789
|
-
var
|
|
790
|
-
for (var
|
|
791
|
-
args[
|
|
880
|
+
var _context24;
|
|
881
|
+
var _this2;
|
|
882
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
883
|
+
args[_key2] = arguments[_key2];
|
|
792
884
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
return
|
|
885
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context24 = [this]).call(_context24, args)) || this;
|
|
886
|
+
_this2.Table = Table;
|
|
887
|
+
_this2.TableColumn = TableColumn;
|
|
888
|
+
return _this2;
|
|
797
889
|
}
|
|
798
890
|
return Demo;
|
|
799
891
|
}(Component);
|
|
800
892
|
Demo.template = "\n const {Table, TableColumn} = this;\n <div style=\"display: none;\">\n <Table>\n <TableColumn key=\"a\" minWidth={30} />\n </Table>\n </div>\n ";
|
|
801
|
-
var
|
|
802
|
-
element =
|
|
893
|
+
var _mount22 = mount(Demo),
|
|
894
|
+
element = _mount22[1];
|
|
803
895
|
expect(element.innerHTML).to.matchSnapshot();
|
|
804
896
|
});
|
|
805
|
-
it('draggable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
806
|
-
var
|
|
807
|
-
return _regeneratorRuntime.wrap(function
|
|
808
|
-
while (1) switch (
|
|
897
|
+
it('draggable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
|
|
898
|
+
var _mount23, instance, element, _element$querySelecto11, tr1, tr2, _element$getBoundingC, top;
|
|
899
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context25) {
|
|
900
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
809
901
|
case 0:
|
|
810
|
-
|
|
902
|
+
_mount23 = mount(DraggableTable), instance = _mount23[0], element = _mount23[1];
|
|
811
903
|
_element$querySelecto11 = element.querySelectorAll('tbody tr'), tr1 = _element$querySelecto11[0], tr2 = _element$querySelecto11[1];
|
|
812
904
|
_element$getBoundingC = element.getBoundingClientRect(), top = _element$getBoundingC.top;
|
|
813
905
|
dispatchEvent(tr2, 'dragstart');
|
|
@@ -815,33 +907,33 @@ describe('Table', function () {
|
|
|
815
907
|
clientY: top + 41 + 20
|
|
816
908
|
});
|
|
817
909
|
dispatchEvent(tr2, 'dragend');
|
|
818
|
-
|
|
910
|
+
_context25.next = 8;
|
|
819
911
|
return wait(500);
|
|
820
912
|
case 8:
|
|
821
913
|
expect(element.innerHTML).to.matchSnapshot();
|
|
822
914
|
case 9:
|
|
823
915
|
case "end":
|
|
824
|
-
return
|
|
916
|
+
return _context25.stop();
|
|
825
917
|
}
|
|
826
|
-
},
|
|
918
|
+
}, _callee21);
|
|
827
919
|
})));
|
|
828
|
-
it('should not check all even though the keys is equal but the checkedKeys have some keys that not in rowKeys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
829
|
-
var Demo,
|
|
830
|
-
return _regeneratorRuntime.wrap(function
|
|
831
|
-
while (1) switch (
|
|
920
|
+
it('should not check all even though the keys is equal but the checkedKeys have some keys that not in rowKeys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
921
|
+
var Demo, _mount24, instance, element, table, checked;
|
|
922
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context27) {
|
|
923
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
832
924
|
case 0:
|
|
833
|
-
Demo = /*#__PURE__*/function (
|
|
834
|
-
_inheritsLoose(Demo,
|
|
925
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
926
|
+
_inheritsLoose(Demo, _Component3);
|
|
835
927
|
function Demo() {
|
|
836
|
-
var
|
|
837
|
-
var
|
|
838
|
-
for (var
|
|
839
|
-
args[
|
|
928
|
+
var _context26;
|
|
929
|
+
var _this3;
|
|
930
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
931
|
+
args[_key3] = arguments[_key3];
|
|
840
932
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
return
|
|
933
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context26 = [this]).call(_context26, args)) || this;
|
|
934
|
+
_this3.Table = Table;
|
|
935
|
+
_this3.TableColumn = TableColumn;
|
|
936
|
+
return _this3;
|
|
845
937
|
}
|
|
846
938
|
Demo.defaults = function defaults() {
|
|
847
939
|
return {
|
|
@@ -856,7 +948,7 @@ describe('Table', function () {
|
|
|
856
948
|
return Demo;
|
|
857
949
|
}(Component);
|
|
858
950
|
Demo.template = "\n const {Table, TableColumn} = this;\n <Table v-model:checkedKeys=\"checkedKeys\"\n data={this.get('data')}\n rowKey={i => i.a}\n ref=\"table\"\n keepStatus={true}\n >\n <TableColumn key=\"a\" />\n </Table>\n ";
|
|
859
|
-
|
|
951
|
+
_mount24 = mount(Demo), instance = _mount24[0], element = _mount24[1];
|
|
860
952
|
table = instance.refs.table;
|
|
861
953
|
checked = table.checked;
|
|
862
954
|
expect(checked.getAllCheckedStatus()).to.eql(AllCheckedStatus.None);
|
|
@@ -865,7 +957,7 @@ describe('Table', function () {
|
|
|
865
957
|
table.uncheckAll();
|
|
866
958
|
expect(instance.get('checkedKeys')).to.eql([3, 4]);
|
|
867
959
|
instance.set('checkedKeys', [3, 4, 1]);
|
|
868
|
-
|
|
960
|
+
_context27.next = 13;
|
|
869
961
|
return wait();
|
|
870
962
|
case 13:
|
|
871
963
|
expect(checked.getAllCheckedStatus()).to.eql(AllCheckedStatus.Indeterminate);
|
|
@@ -875,47 +967,47 @@ describe('Table', function () {
|
|
|
875
967
|
instance.set('data', [{
|
|
876
968
|
a: 1
|
|
877
969
|
}]);
|
|
878
|
-
|
|
970
|
+
_context27.next = 19;
|
|
879
971
|
return wait();
|
|
880
972
|
case 19:
|
|
881
973
|
expect(instance.get('checkedKeys')).to.eql([3, 4, 1, 2]);
|
|
882
974
|
case 20:
|
|
883
975
|
case "end":
|
|
884
|
-
return
|
|
976
|
+
return _context27.stop();
|
|
885
977
|
}
|
|
886
|
-
},
|
|
978
|
+
}, _callee22);
|
|
887
979
|
})));
|
|
888
|
-
it('should update children in TableCell', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
889
|
-
var update, Test, Demo,
|
|
890
|
-
return _regeneratorRuntime.wrap(function
|
|
891
|
-
while (1) switch (
|
|
980
|
+
it('should update children in TableCell', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
|
|
981
|
+
var update, Test, Demo, _mount25, instance, element;
|
|
982
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context29) {
|
|
983
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
892
984
|
case 0:
|
|
893
985
|
update = sinon.spy();
|
|
894
|
-
Test = /*#__PURE__*/function (
|
|
895
|
-
_inheritsLoose(Test,
|
|
986
|
+
Test = /*#__PURE__*/function (_Component4) {
|
|
987
|
+
_inheritsLoose(Test, _Component4);
|
|
896
988
|
function Test() {
|
|
897
|
-
return
|
|
989
|
+
return _Component4.apply(this, arguments) || this;
|
|
898
990
|
}
|
|
899
|
-
var
|
|
900
|
-
|
|
991
|
+
var _proto2 = Test.prototype;
|
|
992
|
+
_proto2.beforeUpdate = function beforeUpdate() {
|
|
901
993
|
update();
|
|
902
994
|
};
|
|
903
995
|
return Test;
|
|
904
996
|
}(Component);
|
|
905
997
|
Test.template = "<div>test</div>";
|
|
906
|
-
Demo = /*#__PURE__*/function (
|
|
907
|
-
_inheritsLoose(Demo,
|
|
998
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
999
|
+
_inheritsLoose(Demo, _Component5);
|
|
908
1000
|
function Demo() {
|
|
909
|
-
var
|
|
910
|
-
var
|
|
911
|
-
for (var
|
|
912
|
-
args[
|
|
1001
|
+
var _context28;
|
|
1002
|
+
var _this4;
|
|
1003
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1004
|
+
args[_key4] = arguments[_key4];
|
|
913
1005
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return
|
|
1006
|
+
_this4 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context28 = [this]).call(_context28, args)) || this;
|
|
1007
|
+
_this4.Table = Table;
|
|
1008
|
+
_this4.TableColumn = TableColumn;
|
|
1009
|
+
_this4.Test = Test;
|
|
1010
|
+
return _this4;
|
|
919
1011
|
}
|
|
920
1012
|
Demo.defaults = function defaults() {
|
|
921
1013
|
return {
|
|
@@ -929,24 +1021,24 @@ describe('Table', function () {
|
|
|
929
1021
|
return Demo;
|
|
930
1022
|
}(Component);
|
|
931
1023
|
Demo.template = "\n const {Table, TableColumn, Test} = this;\n <Table data={this.get('data')} ref=\"table\">\n <TableColumn key=\"a\">\n <b:template>\n <Test />\n </b:template>\n </TableColumn>\n </Table>\n ";
|
|
932
|
-
|
|
1024
|
+
_mount25 = mount(Demo), instance = _mount25[0], element = _mount25[1];
|
|
933
1025
|
element.querySelector('tbody tr').click();
|
|
934
|
-
|
|
1026
|
+
_context29.next = 9;
|
|
935
1027
|
return wait();
|
|
936
1028
|
case 9:
|
|
937
1029
|
expect(update.callCount).to.eql(1);
|
|
938
1030
|
case 10:
|
|
939
1031
|
case "end":
|
|
940
|
-
return
|
|
1032
|
+
return _context29.stop();
|
|
941
1033
|
}
|
|
942
|
-
},
|
|
1034
|
+
}, _callee23);
|
|
943
1035
|
})));
|
|
944
|
-
it('pagination', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
945
|
-
var
|
|
946
|
-
return _regeneratorRuntime.wrap(function
|
|
947
|
-
while (1) switch (
|
|
1036
|
+
it('pagination', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
|
|
1037
|
+
var _mount26, instance, element, table, pagination, spy;
|
|
1038
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context30) {
|
|
1039
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
948
1040
|
case 0:
|
|
949
|
-
|
|
1041
|
+
_mount26 = mount(PaginationDemo), instance = _mount26[0], element = _mount26[1];
|
|
950
1042
|
table = instance.refs.table;
|
|
951
1043
|
pagination = table.pagination.paginationRef;
|
|
952
1044
|
spy = sinon.spy();
|
|
@@ -959,7 +1051,7 @@ describe('Table', function () {
|
|
|
959
1051
|
value: 2
|
|
960
1052
|
});
|
|
961
1053
|
table.trigger('$receive:pagination');
|
|
962
|
-
|
|
1054
|
+
_context30.next = 11;
|
|
963
1055
|
return wait();
|
|
964
1056
|
case 11:
|
|
965
1057
|
expect(table.getCheckedData()).to.have.length(0);
|
|
@@ -972,7 +1064,7 @@ describe('Table', function () {
|
|
|
972
1064
|
limit: 20
|
|
973
1065
|
});
|
|
974
1066
|
table.trigger('$receive:pagination');
|
|
975
|
-
|
|
1067
|
+
_context30.next = 18;
|
|
976
1068
|
return wait();
|
|
977
1069
|
case 18:
|
|
978
1070
|
expect(table.getCheckedData()).to.have.length(10);
|
|
@@ -981,7 +1073,7 @@ describe('Table', function () {
|
|
|
981
1073
|
expect(table.getCheckedData()).to.have.length(20);
|
|
982
1074
|
// change limit from pagination
|
|
983
1075
|
pagination.value.set('limit', 10);
|
|
984
|
-
|
|
1076
|
+
_context30.next = 24;
|
|
985
1077
|
return wait();
|
|
986
1078
|
case 24:
|
|
987
1079
|
expect(table.getCheckedData()).to.have.length(10);
|
|
@@ -993,7 +1085,7 @@ describe('Table', function () {
|
|
|
993
1085
|
limit: 10
|
|
994
1086
|
});
|
|
995
1087
|
// change page from pagination
|
|
996
|
-
|
|
1088
|
+
_context30.next = 29;
|
|
997
1089
|
return wait();
|
|
998
1090
|
case 29:
|
|
999
1091
|
pagination.value.changePage(2);
|
|
@@ -1005,8 +1097,8 @@ describe('Table', function () {
|
|
|
1005
1097
|
});
|
|
1006
1098
|
case 33:
|
|
1007
1099
|
case "end":
|
|
1008
|
-
return
|
|
1100
|
+
return _context30.stop();
|
|
1009
1101
|
}
|
|
1010
|
-
},
|
|
1102
|
+
}, _callee24);
|
|
1011
1103
|
})));
|
|
1012
1104
|
});
|