@king-design/react 3.0.0-beta.0 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/__tests__/__snapshots__/Dialog.md +1 -1
  2. package/__tests__/__snapshots__/React Demos.md +468 -309
  3. package/__tests__/components/cascader.spec.tsx +53 -0
  4. package/__tests__/components/drawer.spec.tsx +67 -5
  5. package/components/button/index.d.ts +1 -1
  6. package/components/button/index.js +1 -1
  7. package/components/button/styles.d.ts +1 -1
  8. package/components/button/styles.js +3 -5
  9. package/components/carousel/index.vdt.js +2 -2
  10. package/components/cascader/index.d.ts +22 -11
  11. package/components/cascader/index.js +9 -12
  12. package/components/cascader/index.spec.js +81 -0
  13. package/components/cascader/index.vdt.js +11 -9
  14. package/components/cascader/styles.js +1 -1
  15. package/components/cascader/useFields.d.ts +2 -0
  16. package/components/cascader/useFields.js +18 -0
  17. package/components/cascader/useFilterable.d.ts +2 -1
  18. package/components/cascader/useFilterable.js +17 -6
  19. package/components/cascader/useLabel.d.ts +2 -1
  20. package/components/cascader/useLabel.js +4 -4
  21. package/components/cascader/useLoad.d.ts +2 -1
  22. package/components/cascader/useLoad.js +9 -7
  23. package/components/collapse/item.vdt.js +1 -1
  24. package/components/colorpicker/index.d.ts +2 -0
  25. package/components/colorpicker/index.js +7 -2
  26. package/components/colorpicker/index.vdt.js +3 -6
  27. package/components/copy/index.d.ts +17 -0
  28. package/components/copy/index.js +43 -0
  29. package/components/copy/index.spec.d.ts +1 -0
  30. package/components/copy/index.spec.js +52 -0
  31. package/components/copy/index.vdt.js +45 -0
  32. package/components/copy/styles.d.ts +2 -0
  33. package/components/copy/styles.js +14 -0
  34. package/components/copy/useCopy.d.ts +4 -0
  35. package/components/copy/useCopy.js +90 -0
  36. package/components/datepicker/calendar.vdt.js +6 -6
  37. package/components/datepicker/index.spec.js +171 -153
  38. package/components/datepicker/index.vdt.js +1 -1
  39. package/components/datepicker/styles.js +1 -1
  40. package/components/datepicker/useValue.d.ts +3 -3
  41. package/components/datepicker/useValue.js +38 -9
  42. package/components/diagram/shapes/callout.d.ts +1 -1
  43. package/components/diagram/shapes/circle.d.ts +1 -1
  44. package/components/diagram/shapes/document.d.ts +1 -1
  45. package/components/diagram/shapes/ellipse.d.ts +1 -1
  46. package/components/diagram/shapes/hexagon.d.ts +1 -1
  47. package/components/diagram/shapes/image.d.ts +1 -1
  48. package/components/diagram/shapes/parallelogram.d.ts +1 -1
  49. package/components/diagram/shapes/rectangle.d.ts +1 -1
  50. package/components/diagram/shapes/square.d.ts +1 -1
  51. package/components/diagram/shapes/text.d.ts +1 -1
  52. package/components/dialog/alert.vdt.js +6 -5
  53. package/components/dialog/index.spec.js +6 -6
  54. package/components/dialog/styles.js +1 -1
  55. package/components/dropdown/dropdown.d.ts +6 -6
  56. package/components/dropdown/dropdown.js +58 -75
  57. package/components/dropdown/index.spec.js +96 -17
  58. package/components/dropdown/item.d.ts +1 -1
  59. package/components/dropdown/item.js +19 -7
  60. package/components/dropdown/menu.js +1 -1
  61. package/components/dropdown/usePosition.js +11 -2
  62. package/components/editable/index.d.ts +1 -0
  63. package/components/editable/index.js +20 -6
  64. package/components/editable/index.vdt.js +2 -1
  65. package/components/form/index.spec.js +4 -2
  66. package/components/form/item.vdt.js +2 -1
  67. package/components/form/styles.js +4 -4
  68. package/components/grid/useGutter.js +8 -8
  69. package/components/icon/styles.js +1 -1
  70. package/components/input/index.d.ts +13 -2
  71. package/components/input/index.js +16 -13
  72. package/components/input/index.spec.js +169 -1
  73. package/components/input/index.vdt.js +44 -12
  74. package/components/input/search.vdt.js +2 -4
  75. package/components/input/styles.js +30 -6
  76. package/components/input/useAutoRows.d.ts +2 -0
  77. package/components/input/useAutoRows.js +79 -0
  78. package/components/input/useAutoWidth.js +13 -3
  79. package/components/input/useFocus.d.ts +4 -0
  80. package/components/input/useFocus.js +21 -0
  81. package/components/input/useShowPassword.d.ts +7 -0
  82. package/components/input/useShowPassword.js +31 -0
  83. package/components/menu/index.spec.js +26 -15
  84. package/components/menu/item.d.ts +2 -0
  85. package/components/menu/item.js +5 -0
  86. package/components/menu/item.vdt.js +4 -1
  87. package/components/pagination/index.d.ts +1 -1
  88. package/components/pagination/index.js +3 -2
  89. package/components/pagination/index.spec.js +49 -0
  90. package/components/pagination/index.vdt.js +10 -12
  91. package/components/pagination/styles.js +1 -1
  92. package/components/popover/content.d.ts +19 -0
  93. package/components/popover/content.js +31 -0
  94. package/components/popover/content.vdt.js +68 -0
  95. package/components/popover/index.d.ts +16 -0
  96. package/components/popover/index.js +44 -0
  97. package/components/popover/index.spec.d.ts +1 -0
  98. package/components/popover/index.spec.js +195 -0
  99. package/components/popover/styles.d.ts +1 -0
  100. package/components/popover/styles.js +22 -0
  101. package/components/portal.d.ts +6 -2
  102. package/components/portal.js +4 -3
  103. package/components/position.js +2 -1
  104. package/components/progress/index.js +1 -1
  105. package/components/progress/index.vdt.js +46 -8
  106. package/components/progress/styles.js +19 -13
  107. package/components/rate/styles.js +1 -1
  108. package/components/select/base.d.ts +7 -3
  109. package/components/select/base.js +9 -3
  110. package/components/select/base.vdt.js +75 -47
  111. package/components/select/index.spec.js +25 -13
  112. package/components/select/menu.vdt.js +6 -6
  113. package/components/select/option.vdt.js +2 -1
  114. package/components/select/styles.js +11 -5
  115. package/components/select/useDraggble.d.ts +2 -0
  116. package/components/select/useDraggble.js +11 -0
  117. package/components/slider/index.spec.js +48 -9
  118. package/components/slider/index.vdt.js +23 -12
  119. package/components/slider/styles.js +23 -14
  120. package/components/slider/useValue.d.ts +3 -1
  121. package/components/slider/useValue.js +12 -0
  122. package/components/spinner/index.d.ts +0 -1
  123. package/components/spinner/index.js +1 -19
  124. package/components/spinner/index.vdt.js +13 -8
  125. package/components/spinner/styles.js +2 -2
  126. package/components/spinner/useChange.d.ts +1 -1
  127. package/components/spinner/useChange.js +2 -2
  128. package/components/spinner/useValue.d.ts +1 -0
  129. package/components/spinner/useValue.js +16 -1
  130. package/components/split/index.vdt.js +32 -20
  131. package/components/split/memo.d.ts +9 -0
  132. package/components/split/memo.js +26 -0
  133. package/components/steps/index.d.ts +1 -0
  134. package/components/steps/index.js +2 -1
  135. package/components/steps/index.spec.js +1 -1
  136. package/components/steps/index.vdt.js +7 -4
  137. package/components/steps/step.vdt.js +2 -3
  138. package/components/steps/styles.d.ts +1 -0
  139. package/components/steps/styles.js +50 -17
  140. package/components/switch/index.spec.js +82 -65
  141. package/components/table/cell.js +1 -6
  142. package/components/table/cell.vdt.js +1 -1
  143. package/components/table/column.vdt.js +40 -24
  144. package/components/table/index.spec.js +162 -20
  145. package/components/table/row.d.ts +1 -1
  146. package/components/table/row.js +2 -1
  147. package/components/table/styles.js +16 -9
  148. package/components/table/table.d.ts +15 -0
  149. package/components/table/table.js +16 -7
  150. package/components/table/table.vdt.js +20 -6
  151. package/components/table/useChecked.d.ts +3 -2
  152. package/components/table/useChecked.js +23 -12
  153. package/components/table/useDisableRow.d.ts +2 -1
  154. package/components/table/useDisableRow.js +4 -4
  155. package/components/table/useDraggable.d.ts +3 -2
  156. package/components/table/useDraggable.js +11 -15
  157. package/components/table/useGroup.d.ts +9 -3
  158. package/components/table/useGroup.js +48 -37
  159. package/components/table/useMerge.d.ts +2 -1
  160. package/components/table/useMerge.js +5 -4
  161. package/components/table/usePagination.d.ts +8 -0
  162. package/components/table/usePagination.js +81 -0
  163. package/components/table/useStickyScrollbar.js +2 -2
  164. package/components/table/useTree.d.ts +2 -1
  165. package/components/table/useTree.js +3 -4
  166. package/components/table/useWidth.js +2 -2
  167. package/components/tabs/index.d.ts +1 -1
  168. package/components/tabs/index.js +1 -1
  169. package/components/tabs/index.spec.js +67 -0
  170. package/components/tabs/index.vdt.js +9 -4
  171. package/components/tabs/styles.js +32 -34
  172. package/components/tabs/useScroll.d.ts +1 -1
  173. package/components/tabs/useScroll.js +75 -48
  174. package/components/tag/base.d.ts +1 -0
  175. package/components/tag/base.js +1 -1
  176. package/components/tag/index.d.ts +1 -0
  177. package/components/tag/index.js +2 -1
  178. package/components/tag/index.spec.js +147 -4
  179. package/components/tag/styles.d.ts +67 -0
  180. package/components/tag/styles.js +33 -8
  181. package/components/tag/tags.d.ts +27 -0
  182. package/components/tag/tags.js +51 -0
  183. package/components/tag/tags.vdt.js +91 -0
  184. package/components/tag/useChildren.d.ts +2 -0
  185. package/components/tag/useChildren.js +39 -0
  186. package/components/tag/useDraggable.d.ts +3 -0
  187. package/components/tag/useDraggable.js +89 -0
  188. package/components/tag/useNowrap.d.ts +7 -0
  189. package/components/tag/useNowrap.js +115 -0
  190. package/components/timepicker/index.spec.js +1 -1
  191. package/components/tooltip/content.d.ts +3 -2
  192. package/components/tooltip/content.js +18 -1
  193. package/components/tooltip/content.vdt.js +22 -10
  194. package/components/tooltip/index.spec.js +147 -92
  195. package/components/tooltip/styles.d.ts +23 -0
  196. package/components/tooltip/styles.js +2 -2
  197. package/components/tooltip/tooltip.d.ts +1 -1
  198. package/components/tooltip/tooltip.js +11 -11
  199. package/components/transfer/index.vdt.js +14 -3
  200. package/components/types.d.ts +1 -0
  201. package/components/upload/index.spec.js +5 -6
  202. package/components/upload/index.vdt.js +7 -5
  203. package/components/utils.d.ts +2 -0
  204. package/components/utils.js +24 -3
  205. package/components/virtual.d.ts +8 -0
  206. package/components/virtual.js +126 -0
  207. package/hooks/useResizeObserver.d.ts +1 -1
  208. package/hooks/useResizeObserver.js +19 -6
  209. package/i18n/en-US.d.ts +4 -1
  210. package/i18n/en-US.js +6 -2
  211. package/index.d.ts +5 -3
  212. package/index.js +5 -3
  213. package/package.json +2 -2
  214. package/styles/fonts/iconfont.eot +0 -0
  215. package/styles/fonts/iconfont.js +2 -2
  216. package/styles/fonts/iconfont.svg +35 -35
  217. package/styles/fonts/iconfont.ttf +0 -0
  218. package/styles/fonts/iconfont.woff +0 -0
  219. package/styles/fonts/ionicons.js +3 -3
  220. package/styles/global.js +1 -1
  221. package/yarn-error.log +41 -43
  222. package/components/table/useResizeObserver.d.ts +0 -2
  223. package/components/table/useResizeObserver.js +0 -20
@@ -23,13 +23,14 @@ import { Table, TableColumn } from './';
23
23
  import DraggableTable from '~/components/table/demos/draggable';
24
24
  import MergeCellDemo from '~/components/table/demos/mergeCell';
25
25
  import { AllCheckedStatus } from './useChecked';
26
+ import PaginationDemo from '~/components/table/demos/pagination';
26
27
  describe('Table', function () {
27
28
  afterEach(function () {
28
29
  unmount();
29
30
  localStorage.removeItem('resizableTable');
30
31
  });
31
32
  it('check & uncheck', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
32
- var _mount, instance, element, table, checked, spy, _element$querySelecto, tr1, tr2, all;
33
+ var _mount, instance, element, table, checked, spy, spyCheckRow, spyUncheckRow, spyCheckAll, spyUncheckAll, _element$querySelecto, tr1, tr2, all;
33
34
 
34
35
  return _regeneratorRuntime.wrap(function _callee$(_context) {
35
36
  while (1) {
@@ -42,54 +43,76 @@ describe('Table', function () {
42
43
  spy = sinon.spy(function (v) {
43
44
  return console.log(v);
44
45
  });
45
- table.on('$change:checkedKeys', spy); // click row
46
+ table.on('$change:checkedKeys', spy);
47
+ spyCheckRow = sinon.spy(function (data, index, key) {
48
+ return console.log('checkRow', data, index, key);
49
+ });
50
+ table.on('checkRow', spyCheckRow);
51
+ spyUncheckRow = sinon.spy(function (data, index, key) {
52
+ return console.log('uncheckRow', data, index, key);
53
+ });
54
+ table.on('uncheckRow', spyUncheckRow);
55
+ spyCheckAll = sinon.spy(function () {
56
+ return console.log('checkAll');
57
+ });
58
+ table.on('checkAll', spyCheckAll);
59
+ spyUncheckAll = sinon.spy(function () {
60
+ return console.log('uncheckAll');
61
+ });
62
+ table.on('uncheckAll', spyUncheckAll); // click row
46
63
 
47
64
  _element$querySelecto = element.querySelectorAll('tbody tr'), tr1 = _element$querySelecto[0], tr2 = _element$querySelecto[1];
48
65
  tr1.click();
49
- _context.next = 9;
66
+ _context.next = 17;
50
67
  return wait();
51
68
 
52
- case 9:
69
+ case 17:
53
70
  expect(table.get('checkedKeys')).to.eql([0]);
71
+ expect(spyCheckRow.callCount).to.eql(1);
54
72
  tr2.click();
55
- _context.next = 13;
73
+ _context.next = 22;
56
74
  return wait();
57
75
 
58
- case 13:
76
+ case 22:
59
77
  expect(table.get('checkedKeys')).to.eql([0, 1]);
60
78
  expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.All);
79
+ expect(spyCheckRow.callCount).to.eql(2);
80
+ expect(spyCheckAll.callCount).to.eq(0);
61
81
  tr1.click();
62
- _context.next = 18;
82
+ _context.next = 29;
63
83
  return wait();
64
84
 
65
- case 18:
85
+ case 29:
66
86
  expect(table.get('checkedKeys')).to.eql([1]);
67
87
  expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.Indeterminate);
88
+ expect(spyUncheckRow.callCount).to.eql(1);
68
89
  all = element.querySelector('.k-checkbox');
69
90
  all.click();
70
- _context.next = 24;
91
+ _context.next = 36;
71
92
  return wait();
72
93
 
73
- case 24:
94
+ case 36:
74
95
  expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.All);
96
+ expect(spyCheckAll.callCount).to.eql(1);
75
97
  all.click();
76
- _context.next = 28;
98
+ _context.next = 41;
77
99
  return wait();
78
100
 
79
- case 28:
101
+ case 41:
80
102
  expect(checked.getAllCheckedStatus()).eql(AllCheckedStatus.None);
81
103
  expect(table.get('checkedKeys')).to.eql([]);
104
+ expect(spyUncheckAll.callCount).to.eql(1);
82
105
  expect(spy.callCount).to.eql(5); // clear data of table should only trigger $change:checked event once, #407
83
106
 
84
107
  all.click();
85
- table.set('data', []);
86
- _context.next = 35;
108
+ instance.set('data', []);
109
+ _context.next = 49;
87
110
  return wait();
88
111
 
89
- case 35:
112
+ case 49:
90
113
  expect(spy.callCount).to.eql(7);
91
114
 
92
- case 36:
115
+ case 50:
93
116
  case "end":
94
117
  return _context.stop();
95
118
  }
@@ -342,7 +365,7 @@ describe('Table', function () {
342
365
  }, _callee6);
343
366
  })));
344
367
  it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
345
- var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2;
368
+ var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, _dropdown2$querySelec2, reset, confirm, newDropdown;
346
369
 
347
370
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
348
371
  while (1) {
@@ -384,7 +407,7 @@ describe('Table', function () {
384
407
 
385
408
  case 25:
386
409
  expect(instance.get('multipleGroup')).to.eql({
387
- status: ['active']
410
+ status: []
388
411
  });
389
412
  expect(table2.innerHTML).to.matchSnapshot();
390
413
  item2.click();
@@ -392,12 +415,55 @@ describe('Table', function () {
392
415
  return wait();
393
416
 
394
417
  case 30:
418
+ expect(instance.get('multipleGroup')).to.eql({
419
+ status: []
420
+ }); // click confirm
421
+
422
+ _dropdown2$querySelec2 = dropdown2.querySelectorAll('.k-table-group-footer .k-btn'), reset = _dropdown2$querySelec2[0], confirm = _dropdown2$querySelec2[1];
423
+ confirm.click();
424
+ _context7.next = 35;
425
+ return wait();
426
+
427
+ case 35:
395
428
  expect(instance.get('multipleGroup')).to.eql({
396
429
  status: ['active', 'stopped']
397
430
  });
398
- expect(table2.innerHTML).to.matchSnapshot();
431
+ expect(table2.innerHTML).to.matchSnapshot(); // click reset
399
432
 
400
- case 32:
433
+ dispatchEvent(icon2, 'click');
434
+ _context7.next = 40;
435
+ return wait();
436
+
437
+ case 40:
438
+ expect(dropdown2.innerHTML).to.matchSnapshot();
439
+ reset.click();
440
+ _context7.next = 44;
441
+ return wait();
442
+
443
+ case 44:
444
+ expect(dropdown2.innerHTML).to.matchSnapshot();
445
+ confirm.click();
446
+ _context7.next = 48;
447
+ return wait();
448
+
449
+ case 48:
450
+ expect(instance.get('multipleGroup')).to.eql({
451
+ status: []
452
+ }); // update group
453
+
454
+ instance.set('statusGroup', [{
455
+ label: 'label',
456
+ value: 'value'
457
+ }]);
458
+ dispatchEvent(icon, 'click');
459
+ _context7.next = 53;
460
+ return wait(500);
461
+
462
+ case 53:
463
+ newDropdown = getElement('.k-table-group-dropdown');
464
+ expect(newDropdown.innerHTML).to.matchSnapshot();
465
+
466
+ case 55:
401
467
  case "end":
402
468
  return _context7.stop();
403
469
  }
@@ -1064,4 +1130,80 @@ describe('Table', function () {
1064
1130
  }
1065
1131
  }, _callee22);
1066
1132
  })));
1133
+ it('pagination', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
1134
+ var _mount25, instance, element, table, pagination, spy;
1135
+
1136
+ return _regeneratorRuntime.wrap(function _callee23$(_context26) {
1137
+ while (1) {
1138
+ switch (_context26.prev = _context26.next) {
1139
+ case 0:
1140
+ _mount25 = mount(PaginationDemo), instance = _mount25[0], element = _mount25[1];
1141
+ table = instance.refs.table;
1142
+ pagination = table.pagination.paginationRef;
1143
+ spy = sinon.spy();
1144
+ table.on('changePage', spy); // check all
1145
+
1146
+ table.checkAll();
1147
+ expect(table.getCheckedData()).to.have.length(10); // next page
1148
+
1149
+ table.set('pagination', {
1150
+ value: 2
1151
+ });
1152
+ table.trigger('$receive:pagination');
1153
+ _context26.next = 11;
1154
+ return wait();
1155
+
1156
+ case 11:
1157
+ expect(table.getCheckedData()).to.have.length(0); // check all again
1158
+
1159
+ table.checkAll();
1160
+ expect(table.getCheckedData()).to.have.length(10); // change limit
1161
+
1162
+ table.set('pagination', {
1163
+ value: 1,
1164
+ limit: 20
1165
+ });
1166
+ table.trigger('$receive:pagination');
1167
+ _context26.next = 18;
1168
+ return wait();
1169
+
1170
+ case 18:
1171
+ expect(table.getCheckedData()).to.have.length(10); // check all again
1172
+
1173
+ table.checkAll();
1174
+ expect(table.getCheckedData()).to.have.length(20); // change limit from pagination
1175
+
1176
+ pagination.value.set('limit', 10);
1177
+ _context26.next = 24;
1178
+ return wait();
1179
+
1180
+ case 24:
1181
+ expect(table.getCheckedData()).to.have.length(10); // FIXME: Pagination component should no trigger change event multiple times
1182
+ // when we set value and limit at the same time
1183
+
1184
+ expect(spy.callCount).to.eql(4);
1185
+ expect(spy.lastCall.lastArg).to.eql({
1186
+ value: 1,
1187
+ limit: 10
1188
+ }); // change page from pagination
1189
+
1190
+ _context26.next = 29;
1191
+ return wait();
1192
+
1193
+ case 29:
1194
+ pagination.value.changePage(2);
1195
+ expect(table.getCheckedData()).to.have.length(0);
1196
+ expect(spy.callCount).to.eql(5);
1197
+ expect(spy.lastCall.lastArg).to.eql({
1198
+ value: 2,
1199
+ limit: 10
1200
+ });
1201
+
1202
+ case 33:
1203
+ case "end":
1204
+ return _context26.stop();
1205
+ }
1206
+ }
1207
+ }, _callee23);
1208
+ })));
1067
1209
  });
@@ -14,7 +14,7 @@ export interface TableRowProps {
14
14
  index: number;
15
15
  disabled: boolean;
16
16
  allDisabled: boolean;
17
- onChangeChecked: (index: number, checked: boolean) => void;
17
+ onChangeChecked: (index: number, checked: boolean, key: TableRowKey) => void;
18
18
  grid: TableGrid;
19
19
  selected: boolean;
20
20
  spreaded: boolean;
@@ -56,9 +56,10 @@ export var TableRow = /*#__PURE__*/function (_Component) {
56
56
  _proto.onChangeChecked = function onChangeChecked(v) {
57
57
  var _this$get2 = this.get(),
58
58
  index = _this$get2.index,
59
+ key = _this$get2.key,
59
60
  onChangeChecked = _this$get2.onChangeChecked;
60
61
 
61
- onChangeChecked(index, v);
62
+ onChangeChecked(index, v, key);
62
63
  };
63
64
 
64
65
  _proto.onClickArrow = function onClickArrow(e) {
@@ -31,6 +31,10 @@ var defaults = {
31
31
  return theme.color.bg;
32
32
  },
33
33
 
34
+ get color() {
35
+ return theme.color.lightBlack;
36
+ },
37
+
34
38
  padding: "0 5px 0 12px",
35
39
  fontSize: "12px",
36
40
  fontWeight: "bold",
@@ -51,10 +55,9 @@ var defaults = {
51
55
  stripeBgColor: '#f9f9fc',
52
56
  // group
53
57
  group: {
54
- width: "14px",
55
- gap: "10px",
56
- color: "#a6a6a6",
58
+ gap: "8px",
57
59
  menuMaxHeight: '200px',
60
+ menuMinWidth: '200px',
58
61
 
59
62
  get activeColor() {
60
63
  return theme.color.primary;
@@ -70,9 +73,13 @@ var defaults = {
70
73
  // sort
71
74
  sort: {
72
75
  iconHeight: "7px",
73
- gap: "10px",
74
- color: "#d0d5d9",
75
- disabledColor: "#ddd"
76
+ gap: "8px",
77
+
78
+ // color: `#d0d5d9`,
79
+ get enabledColor() {
80
+ return theme.color.primary;
81
+ }
82
+
76
83
  },
77
84
  expandBgColor: '#fdfcff',
78
85
 
@@ -95,10 +102,10 @@ setDefault(function () {
95
102
  }).table;
96
103
  });
97
104
  export function makeStyles() {
98
- return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.k-table-title{display:inline-flex;align-items:center;max-width:100%;color:", theme.color.lightBlack, ";}.k-table-title-text{flex:1;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.k-fixed-left,.k-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.k-fixed-left:after{right:-11px;}.k-fixed-right:after{left:-11px;}&.k-scroll-left .k-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.k-scroll-right .k-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.k-scroll-middle{.k-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.k-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.k-fixed-right+.k-fixed-right:after{display:none;}.k-table-affix-header{position:sticky;top:0;left:0;.k-affix-wrapper{overflow:hidden;}&.k-fixed{position:relative;}}&.k-border,&.k-grid{.k-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.k-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.k-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.k-table-group{width:", table.group.width, "!important;height:", table.group.width, "!important;margin-left:", table.group.gap, ";position:relative;color:", table.group.color, ";&:hover{color:", theme.color.primary, ";}.k-icon{transition:transform ", table.transition, ";}&.k-dropdown-open .k-icon{transform:rotate(180deg);}}.k-table-check{.k-checkbox,.k-radio{position:relative;top:-1px;}}.k-column-sortable{cursor:pointer;}.k-column-sort{.k-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin-left:", _sortInstanceProperty(table).gap, ";color:", _sortInstanceProperty(table).color, ";}&.k-asc .k-icon.k-desc,&.k-desc .k-icon.k-asc{color:", _sortInstanceProperty(table).disabledColor, ";}}.k-table-spin.k-overlay{z-index:2;}.k-table-empty{text-align:center;}tr.k-expand{td{padding:0;background:#fdfcff;}}&.k-with-expand{tr:not(.k-expand){td{border-bottom:none;}}}.k-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.k-selected td{background:", table.selectedBgColor, ";}.k-table-arrow{margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.k-spreaded{.k-table-arrow{transform:rotate(90deg);}}.k-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.k-dragging{opacity:", table.draggingOpacity, ";}.k-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.k-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
105
+ return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.k-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.k-table-title-text{flex:1;display:inline-flex;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.k-fixed-left,.k-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.k-fixed-left:after{right:-11px;}.k-fixed-right:after{left:-11px;}&.k-scroll-left .k-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.k-scroll-right .k-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.k-scroll-middle{.k-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.k-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.k-fixed-right+.k-fixed-right:after{display:none;}.k-table-affix-header{position:sticky;top:0;left:0;.k-affix-wrapper{overflow:hidden;}&.k-fixed{position:relative;}}&.k-border,&.k-grid{.k-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.k-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.k-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.k-table-group{margin-left:", table.group.gap, ";}.k-table-check{.k-checkbox,.k-radio{position:relative;top:-1px;}}.k-column-sortable{cursor:pointer;}.k-column-sort{.k-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.k-desc .k-icon.k-desc,&.k-asc .k-icon.k-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.k-table-spin.k-overlay{z-index:2;}.k-table-empty{text-align:center;}tr.k-expand{td{padding:0;background:#fdfcff;}}&.k-with-expand{tr:not(.k-expand){td{border-bottom:none;}}}.k-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.k-selected td{background:", table.selectedBgColor, ";}.k-table-arrow{margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.k-spreaded{.k-table-arrow{transform:rotate(90deg);}}.k-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.k-dragging{opacity:", table.draggingOpacity, ";}.k-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.k-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
99
106
  return /*#__PURE__*/css(".k-align-", type, "{text-align:", type, ";}");
100
- }), ";");
107
+ }), ">.k-pagination{margin:16px 0;}");
101
108
  }
102
109
  export function makeGroupMenuStyles() {
103
- return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";overflow:auto;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}.k-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}");
110
+ return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";min-width:", table.group.menuMinWidth, "!important;overflow:auto;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}.k-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}.k-table-group-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.k-btn{margin-left:8px;}}");
104
111
  }
@@ -2,6 +2,7 @@ import { Component, TypeDefs } from 'intact-react';
2
2
  import { TableMerge } from './useMerge';
3
3
  import { TooltipProps } from '../tooltip/tooltip';
4
4
  import type { Events } from '../types';
5
+ import type { PaginationProps, PaginationChangeData } from '../pagination';
5
6
  export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C extends CheckType = CheckType, S extends string = string, G extends TableGroupValue = TableGroupValue> {
6
7
  data?: T[];
7
8
  fixHeader?: boolean | string | number;
@@ -35,6 +36,8 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
35
36
  widthStoreKey?: string;
36
37
  draggable?: boolean;
37
38
  animation?: boolean | [boolean, boolean];
39
+ hideHeader?: boolean;
40
+ pagination?: boolean | PaginationProps;
38
41
  }
39
42
  export interface TableEvents<T = any, K extends TableRowKey = number> {
40
43
  clickRow: [T, number, K];
@@ -47,6 +50,11 @@ export interface TableEvents<T = any, K extends TableRowKey = number> {
47
50
  from: number;
48
51
  to: number;
49
52
  }];
53
+ checkRow: [T, number, K];
54
+ uncheckRow: [T, number, K];
55
+ checkAll: [];
56
+ uncheckAll: [];
57
+ changePage: [PaginationChangeData];
50
58
  }
51
59
  export interface TableBlocks<T = unknown> {
52
60
  empty: null;
@@ -66,6 +74,13 @@ export declare class Table<T = any, RowKey extends TableRowKey = TableRowKey, Ch
66
74
  static typeDefs: Required<TypeDefs<TableProps<unknown, TableRowKey, CheckType, string, TableGroupValue<string | number | symbol>>>>;
67
75
  static defaults: () => Partial<TableProps<any, TableRowKey, CheckType, string, TableGroupValue<string | number | symbol>>>;
68
76
  static events: Events<TableEvents<any, number>>;
77
+ pagination: {
78
+ data: import("../../hooks/useState").State<any[] | undefined>;
79
+ value: import("../../hooks/useState").State<number>;
80
+ limit: import("../../hooks/useState").State<number>;
81
+ onChange: (data: PaginationChangeData) => void;
82
+ paginationRef: import("intact").RefObject<import("../pagination").Pagination>;
83
+ };
69
84
  private tree;
70
85
  private columns;
71
86
  private scroll;
@@ -25,6 +25,7 @@ import { useDraggable } from './useDraggable';
25
25
  import { useStickyScrollbar } from './useStickyScrollbar';
26
26
  import { useWidth } from './useWidth';
27
27
  import { useScroll } from './useScroll';
28
+ import { usePagination } from './usePagination';
28
29
  var typeDefs = {
29
30
  data: Array,
30
31
  fixHeader: [Boolean, String, Number],
@@ -57,7 +58,9 @@ var typeDefs = {
57
58
  minColWidth: Number,
58
59
  widthStoreKey: String,
59
60
  draggable: Boolean,
60
- animation: [Boolean, Array]
61
+ animation: [Boolean, Array],
62
+ hideHeader: Boolean,
63
+ pagination: [Boolean, Object]
61
64
  };
62
65
 
63
66
  var defaults = function defaults() {
@@ -78,7 +81,12 @@ var defaults = function defaults() {
78
81
  var events = {
79
82
  clickRow: true,
80
83
  dragstart: true,
81
- dragend: true
84
+ dragend: true,
85
+ checkRow: true,
86
+ uncheckRow: true,
87
+ checkAll: true,
88
+ uncheckAll: true,
89
+ changePage: true
82
90
  };
83
91
  export var Table = /*#__PURE__*/function (_Component) {
84
92
  _inheritsLoose(Table, _Component);
@@ -93,21 +101,22 @@ export var Table = /*#__PURE__*/function (_Component) {
93
101
  }
94
102
 
95
103
  _this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
96
- _this.tree = useTree();
104
+ _this.pagination = usePagination();
105
+ _this.tree = useTree(_this.pagination.data);
97
106
  _this.columns = useColumns();
98
107
  _this.scroll = useScroll();
99
108
  _this.stickyHeader = useStickyHeader(_this.scroll.callbacks);
100
109
  _this.width = useWidth(_this.scroll.scrollRef, _this.columns.getColumns);
101
110
  _this.resizable = useResizable(_this.scroll.scrollRef, _this.width.tableRef, _this.width.tableWidth, _this.width.widthMap, _this.width.storeWidth);
102
111
  _this.fixedColumns = useFixedColumns(_this.columns.getColumns, _this.scroll, _this.width.widthMap);
103
- _this.disableRow = useDisableRow(_this.tree.loopData);
104
- _this.merge = useMerge(_this.columns.getCols);
105
- _this.checked = useChecked(_this.disableRow.getEnableKeys, _this.disableRow.getAllKeys, _this.disableRow.isDisabledKey, _this.merge.getGrid, _this.tree.loopData);
112
+ _this.disableRow = useDisableRow(_this.tree.loopData, _this.pagination.data);
113
+ _this.merge = useMerge(_this.columns.getCols, _this.pagination.data);
114
+ _this.checked = useChecked(_this.disableRow.getEnableKeys, _this.disableRow.getAllKeys, _this.disableRow.isDisabledKey, _this.merge.getGrid, _this.tree.loopData, _this.pagination.data);
106
115
  _this.sortable = useSortable();
107
116
  _this.expandable = useExpandable();
108
117
  _this.selected = useSelected();
109
118
  _this.resetRowStatus = useRestRowStatus(_this.disableRow.getAllKeys);
110
- _this.draggable = useDraggable();
119
+ _this.draggable = useDraggable(_this.pagination.data);
111
120
  _this.stickyScrollbar = useStickyScrollbar(_this.stickyHeader.elementRef, _this.scroll, _this.width.tableRef, _this.fixedColumns.setScrollPosition);
112
121
  return _this;
113
122
  }
@@ -3,7 +3,7 @@ import _sortInstanceProperty from "@babel/runtime-corejs3/core-js/instance/sort"
3
3
  import { createElementVNode as _$ce, map as _$ma, className as _$cn, createUnknownComponentVNode as _$cc, createVNode as _$cv, noop as _$no, extend as _$ex, EMPTY_OBJ as _$em } from 'intact-react';
4
4
  import { eachChildren } from '../utils';
5
5
  import { makeStyles } from './styles';
6
- import { isStringOrNumber, isNull } from 'intact-shared';
6
+ import { isStringOrNumber, isNull, isObject, EMPTY_OBJ } from 'intact-shared';
7
7
  import { getClassAndStyleForFixed } from './useFixedColumns';
8
8
  import { Affix } from '../affix';
9
9
  import { TableRow } from './row';
@@ -19,6 +19,7 @@ import { Tooltip } from '../tooltip';
19
19
  import { AllCheckedStatus } from './useChecked';
20
20
  import { context as ResizableContext } from './useResizable';
21
21
  import { context as FixedColumnsContext } from './useFixedColumns';
22
+ import { Pagination } from '../pagination';
22
23
  var _$tmp0 = {
23
24
  'width': '40'
24
25
  };
@@ -58,7 +59,9 @@ export default function ($props, $blocks, $__proto__) {
58
59
  showIndeterminate = _this$get.showIndeterminate,
59
60
  resizable = _this$get.resizable,
60
61
  draggable = _this$get.draggable,
61
- _animation = _this$get.animation;
62
+ _animation = _this$get.animation,
63
+ hideHeader = _this$get.hideHeader,
64
+ pagination = _this$get.pagination;
62
65
 
63
66
  var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
64
67
 
@@ -112,8 +115,7 @@ export default function ($props, $blocks, $__proto__) {
112
115
  onChangeChecked = _this$checked.onChangeChecked;
113
116
  var allCheckedStatus = getAllCheckedStatus();
114
117
  var offsetMap = getOffsetMap();
115
-
116
- var thead = _$cc(TableContext.Provider, {
118
+ var thead = hideHeader ? null : _$cc(TableContext.Provider, {
117
119
  'value': checkType,
118
120
  'children': _$cc(GroupContext.Provider, {
119
121
  'value': {
@@ -157,7 +159,6 @@ export default function ($props, $blocks, $__proto__) {
157
159
  })
158
160
  })
159
161
  });
160
-
161
162
  var getAllKeys = this.disableRow.getAllKeys;
162
163
  var getGrid = this.merge.getGrid;
163
164
  var allStatus = getAllStatus();
@@ -306,6 +307,11 @@ export default function ($props, $blocks, $__proto__) {
306
307
  scrollbarRef = _this$stickyScrollbar.scrollbarRef,
307
308
  onScrollbarScroll = _this$stickyScrollbar.onScroll,
308
309
  tableActualWidth = _this$stickyScrollbar.tableActualWidth;
310
+ var _this$pagination = this.pagination,
311
+ pageValue = _this$pagination.value,
312
+ pageLimit = _this$pagination.limit,
313
+ onPageChange = _this$pagination.onChange,
314
+ paginationRef = _this$pagination.paginationRef;
309
315
  return _$ce(2, 'div', [_$ce(2, 'div', [!isNull(stickHeader.value) ? _$cc(Affix, {
310
316
  'top': stickHeader.value,
311
317
  'exclude': excludeStickHeader,
@@ -321,7 +327,15 @@ export default function ($props, $blocks, $__proto__) {
321
327
  }
322
328
  }, null, tableRef)], 0, 'k-table-wrapper', {
323
329
  'style': style
324
- }, null, scrollRef), _$cc(Transition, {
330
+ }, null, scrollRef), pagination ? _$cc(Pagination, _extends({
331
+ 'ref': paginationRef,
332
+ 'total': data ? data.length : 0,
333
+ 'size': 'small'
334
+ }, isObject(pagination) ? pagination : EMPTY_OBJ, {
335
+ 'value': pageValue.value,
336
+ 'limit': pageLimit.value,
337
+ 'ev-change': onPageChange
338
+ }), null, paginationRef) : undefined, _$cc(Transition, {
325
339
  'name': 'k-fade',
326
340
  'children': loading ? _$cc(Spin, _$tmp1) : undefined
327
341
  }), !isNull(stickScrollbar.value) ? _$cc(Affix, {
@@ -1,3 +1,4 @@
1
+ import { State } from '../../hooks/useState';
1
2
  import type { TableRowKey } from './';
2
3
  import type { TableGrid } from './useMerge';
3
4
  import type { useTree } from './useTree';
@@ -12,12 +13,12 @@ export declare enum AllCheckedStatus {
12
13
  Indeterminate = 1,
13
14
  None = 2
14
15
  }
15
- export declare function useChecked(getEnableKeys: () => TableRowKey[], getAllKeys: () => TableRowKey[], isDisabledKey: (key: TableRowKey) => boolean, getGrid: () => TableGrid, loopData: ReturnType<typeof useTree>['loopData']): {
16
+ export declare function useChecked(getEnableKeys: () => TableRowKey[], getAllKeys: () => TableRowKey[], isDisabledKey: (key: TableRowKey) => boolean, getGrid: () => TableGrid, loopData: ReturnType<typeof useTree>['loopData'], data: State<any[] | undefined>): {
16
17
  isChecked: (key: TableRowKey) => boolean;
17
18
  getAllCheckedStatus: () => AllCheckedStatus;
18
19
  toggleCheckedAll: (v: boolean) => void;
19
20
  getAllStatus: () => RowStatus[];
20
- onChangeChecked: (rowIndex: number, v: boolean) => void;
21
+ onChangeChecked: (rowIndex: number, v: boolean, key: TableRowKey) => void;
21
22
  };
22
23
  export declare function inArray<T>(arr: T[] | undefined, v: T): boolean;
23
24
  export declare function addOrRemove(keys: TableRowKey[], key: TableRowKey, isAdd: boolean): void;
@@ -2,6 +2,7 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/i
2
2
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
3
3
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
4
4
  import { useInstance } from 'intact-react';
5
+ import { watchState } from '../../hooks/useState';
5
6
  import { toggleArray } from '../utils';
6
7
  export var AllCheckedStatus;
7
8
 
@@ -11,7 +12,7 @@ export var AllCheckedStatus;
11
12
  AllCheckedStatus[AllCheckedStatus["None"] = 2] = "None";
12
13
  })(AllCheckedStatus || (AllCheckedStatus = {}));
13
14
 
14
- export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, loopData) {
15
+ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, loopData, data) {
15
16
  var instance = useInstance();
16
17
  var allStatus = [];
17
18
 
@@ -21,7 +22,10 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
21
22
 
22
23
  function toggleChecked(key, rowIndex) {
23
24
  if (instance.get('checkType') === 'checkbox') {
24
- instance.set('checkedKeys', toggleArray(instance.get('checkedKeys'), key));
25
+ instance.set('checkedKeys', toggleArray(instance.get('checkedKeys'), key)); // trigger check event for checkbox,
26
+ // radio check event trigger in onChangeChecked function
27
+
28
+ triggerEvent(isChecked(key), key, rowIndex);
25
29
  } else {
26
30
  if (isChecked(key)) return;
27
31
  var grid = getGrid();
@@ -34,7 +38,7 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
34
38
  }
35
39
  }
36
40
 
37
- onChangeChecked(rowIndex, true);
41
+ onChangeChecked(rowIndex, true, key);
38
42
  }
39
43
  }
40
44
 
@@ -61,6 +65,7 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
61
65
 
62
66
  function toggleCheckedAll(v) {
63
67
  instance.set('checkedKeys', getCheckedAllOrUncheckedAllKeys(v));
68
+ instance.trigger(v ? 'checkAll' : 'uncheckAll');
64
69
  }
65
70
  /**
66
71
  * keep the original keys which don't exist in the enableKeys,
@@ -92,12 +97,11 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
92
97
  allStatus = [];
93
98
 
94
99
  var _instance$get2 = instance.get(),
95
- data = _instance$get2.data,
96
100
  rowKey = _instance$get2.rowKey,
97
101
  checkType = _instance$get2.checkType,
98
102
  merge = _instance$get2.merge;
99
103
 
100
- if (!data || !data.length) return;
104
+ if (!data.value || !data.value.length) return;
101
105
  var allKeys = getAllKeys();
102
106
  allKeys.forEach(function (key) {
103
107
  var disabled = isDisabledKey(key);
@@ -161,7 +165,7 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
161
165
  }
162
166
  }
163
167
 
164
- function onChangeChecked(rowIndex, v) {
168
+ function onChangeChecked(rowIndex, v, key) {
165
169
  var _context;
166
170
 
167
171
  // should check or uncheck all grouped rows
@@ -172,9 +176,9 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
172
176
 
173
177
  if (checkType === 'radio') {
174
178
  for (var i = 0; i < checkedKeys.length; i++) {
175
- var key = checkedKeys[i]; // FIXME: should ignore the disabled status, if we remove the radio keys
179
+ var _key = checkedKeys[i]; // FIXME: should ignore the disabled status, if we remove the radio keys
176
180
 
177
- if (isDisabledKey(key)) continue;
181
+ if (isDisabledKey(_key)) continue;
178
182
 
179
183
  _spliceInstanceProperty(checkedKeys).call(checkedKeys, i, 1);
180
184
 
@@ -189,27 +193,34 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
189
193
  if ((rowspan = grid[rowIndex]) && (rowspan = rowspan[0]) && (rowspan = rowspan.spans) && (rowspan = rowspan.rowspan) && rowspan > 1) {
190
194
  for (var _i = rowIndex; _i < rowspan + rowIndex; _i++) {
191
195
  var status = allStatus[_i];
192
- var _key = allKeys[_i];
196
+ var _key2 = allKeys[_i];
193
197
 
194
198
  if (!status.disabled) {
195
- addOrRemove(checkedKeys, _key, v);
199
+ addOrRemove(checkedKeys, _key2, v);
196
200
  }
197
201
  }
198
202
  } else {
199
203
  addOrRemove(checkedKeys, allKeys[rowIndex], v);
200
204
  }
201
205
 
202
- instance.set('checkedKeys', checkedKeys);
206
+ instance.set('checkedKeys', checkedKeys); // onChangeChecked will be called in clickRow and check in Row component
207
+
208
+ triggerEvent(v, key, rowIndex);
203
209
  }
204
210
 
205
211
  function getAllStatus() {
206
212
  return allStatus;
207
213
  }
208
214
 
215
+ function triggerEvent(isChecked, key, rowIndex) {
216
+ instance.trigger(isChecked ? 'checkRow' : 'uncheckRow', data.value[rowIndex], rowIndex, key);
217
+ }
218
+
209
219
  instance.on('$receive:children', updateAllCheckedStatus);
210
220
  instance.on('$change:checkedKeys', updateAllCheckedStatus); // for draggable
211
221
 
212
- instance.on('$change:data', updateAllCheckedStatus);
222
+ watchState(data, updateAllCheckedStatus); // instance.on('$change:data', updateAllCheckedStatus);
223
+
213
224
  instance.on('clickRow', function (data, index, key) {
214
225
  if (instance.get('rowCheckable') && instance.get('checkType') !== 'none') {
215
226
  toggleChecked(key, index);