@king-design/vue 3.4.5 → 3.5.0

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 (53) hide show
  1. package/__tests__/__snapshots__/Vue Next Demos.md +70 -38
  2. package/components/affix/index.d.ts +1 -0
  3. package/components/affix/index.js +2 -1
  4. package/components/affix/useStyle.js +50 -47
  5. package/components/datepicker/basepicker.js +3 -3
  6. package/components/dialog/styles.js +2 -2
  7. package/components/dropdown/useKeyboard.js +3 -0
  8. package/components/input/index.spec.js +21 -0
  9. package/components/input/index.vdt.js +1 -1
  10. package/components/input/styles.js +1 -1
  11. package/components/layout/styles.js +1 -1
  12. package/components/select/base.d.ts +1 -0
  13. package/components/select/base.js +2 -1
  14. package/components/select/group.vdt.js +8 -3
  15. package/components/select/index.spec.js +13 -1
  16. package/components/select/menu.vdt.js +12 -3
  17. package/components/select/select.vdt.js +2 -1
  18. package/components/select/useFilterable.js +7 -5
  19. package/components/select/useInput.js +6 -2
  20. package/components/table/index.spec.js +7 -6
  21. package/components/table/styles.js +1 -1
  22. package/components/table/table.d.ts +1 -0
  23. package/components/table/table.js +3 -2
  24. package/components/table/table.vdt.js +126 -114
  25. package/components/treeSelect/index.js +4 -3
  26. package/components/virtualList/container.d.ts +10 -0
  27. package/components/virtualList/container.js +26 -0
  28. package/components/virtualList/container.vdt.js +39 -0
  29. package/components/virtualList/index.d.ts +5 -0
  30. package/components/virtualList/index.js +5 -0
  31. package/components/virtualList/index.spec.d.ts +1 -0
  32. package/components/virtualList/index.spec.js +372 -0
  33. package/components/virtualList/phantom.d.ts +9 -0
  34. package/components/virtualList/phantom.js +24 -0
  35. package/components/virtualList/phantom.vdt.js +33 -0
  36. package/components/virtualList/rows.d.ts +8 -0
  37. package/components/virtualList/rows.js +20 -0
  38. package/components/virtualList/rows.vdt.js +32 -0
  39. package/components/virtualList/styles.d.ts +13 -0
  40. package/components/virtualList/styles.js +34 -0
  41. package/components/virtualList/useRows.d.ts +2 -0
  42. package/components/virtualList/useRows.js +19 -0
  43. package/components/virtualList/useVirtualRows.d.ts +20 -0
  44. package/components/virtualList/useVirtualRows.js +120 -0
  45. package/components/virtualList/virtual.d.ts +8 -0
  46. package/components/virtualList/virtual.js +15 -0
  47. package/components/virtualList/virtual.vdt.js +26 -0
  48. package/components/virtualList/wrapper.d.ts +9 -0
  49. package/components/virtualList/wrapper.js +24 -0
  50. package/components/virtualList/wrapper.vdt.js +34 -0
  51. package/index.d.ts +3 -2
  52. package/index.js +3 -2
  53. package/package.json +1 -1
@@ -4,6 +4,7 @@ export interface AffixProps {
4
4
  bottom?: number;
5
5
  exclude?: (data: ExcludeParam) => boolean;
6
6
  shouldFix?: (data: ShouldFixParam) => boolean;
7
+ disabled?: boolean;
7
8
  }
8
9
  export interface AffixEvents {
9
10
  change: [boolean];
@@ -8,7 +8,8 @@ var typeDefs = {
8
8
  top: Number,
9
9
  bottom: Number,
10
10
  exclude: Function,
11
- shouldFix: Function
11
+ shouldFix: Function,
12
+ disabled: Boolean
12
13
  };
13
14
  export var Affix = /*#__PURE__*/function (_Component) {
14
15
  _inheritsLoose(Affix, _Component);
@@ -14,54 +14,57 @@ export function useStyle(elementRef) {
14
14
  offsetTop = _instance$get.top,
15
15
  offsetBottom = _instance$get.bottom,
16
16
  exclude = _instance$get.exclude,
17
- shouldFix = _instance$get.shouldFix;
18
- var _elementRef$value$get = elementRef.value.getBoundingClientRect(),
19
- top = _elementRef$value$get.top,
20
- bottom = _elementRef$value$get.bottom,
21
- width = _elementRef$value$get.width,
22
- height = _elementRef$value$get.height;
23
- var setStyle = function setStyle(styles) {
24
- if (!exclude || exclude && !exclude({
25
- offsetTop: offsetTop,
26
- offsetBottom: offsetBottom,
27
- top: top,
28
- bottom: bottom,
29
- width: width,
30
- height: height
31
- })) {
32
- style.set(_extends({
33
- position: 'fixed',
34
- width: width + "px"
35
- }, styles));
36
- containerStyle.set({
37
- height: height + "px"
38
- });
39
- } else {
40
- resetStyle();
41
- }
42
- };
43
- if (isNullOrUndefined(offsetTop) && isNullOrUndefined(offsetBottom)) {
44
- offsetTop = 0;
45
- }
46
- if (!isNullOrUndefined(offsetTop)) {
47
- if (shouldFix && shouldFix({
48
- offsetTop: offsetTop,
49
- offsetBottom: offsetBottom
50
- }) || !shouldFix && top < offsetTop) {
51
- return setStyle({
52
- top: offsetTop + "px"
53
- });
17
+ shouldFix = _instance$get.shouldFix,
18
+ disabled = _instance$get.disabled;
19
+ if (!disabled) {
20
+ var _elementRef$value$get = elementRef.value.getBoundingClientRect(),
21
+ top = _elementRef$value$get.top,
22
+ bottom = _elementRef$value$get.bottom,
23
+ width = _elementRef$value$get.width,
24
+ height = _elementRef$value$get.height;
25
+ var setStyle = function setStyle(styles) {
26
+ if (!exclude || exclude && !exclude({
27
+ offsetTop: offsetTop,
28
+ offsetBottom: offsetBottom,
29
+ top: top,
30
+ bottom: bottom,
31
+ width: width,
32
+ height: height
33
+ })) {
34
+ style.set(_extends({
35
+ position: 'fixed',
36
+ width: width + "px"
37
+ }, styles));
38
+ containerStyle.set({
39
+ height: height + "px"
40
+ });
41
+ } else {
42
+ resetStyle();
43
+ }
44
+ };
45
+ if (isNullOrUndefined(offsetTop) && isNullOrUndefined(offsetBottom)) {
46
+ offsetTop = 0;
54
47
  }
55
- } else {
56
- var viewportHeight = document.documentElement.clientHeight;
57
- if (shouldFix && shouldFix({
58
- offsetTop: offsetTop,
59
- offsetBottom: offsetBottom,
60
- viewportHeight: viewportHeight
61
- }) || !shouldFix && !isNullOrUndefined(offsetBottom) && viewportHeight - bottom <= offsetBottom) {
62
- return setStyle({
63
- bottom: offsetBottom + "px"
64
- });
48
+ if (!isNullOrUndefined(offsetTop)) {
49
+ if (shouldFix && shouldFix({
50
+ offsetTop: offsetTop,
51
+ offsetBottom: offsetBottom
52
+ }) || !shouldFix && top < offsetTop) {
53
+ return setStyle({
54
+ top: offsetTop + "px"
55
+ });
56
+ }
57
+ } else {
58
+ var viewportHeight = document.documentElement.clientHeight;
59
+ if (shouldFix && shouldFix({
60
+ offsetTop: offsetTop,
61
+ offsetBottom: offsetBottom,
62
+ viewportHeight: viewportHeight
63
+ }) || !shouldFix && !isNullOrUndefined(offsetBottom) && viewportHeight - bottom <= offsetBottom) {
64
+ return setStyle({
65
+ bottom: offsetBottom + "px"
66
+ });
67
+ }
65
68
  }
66
69
  }
67
70
  resetStyle();
@@ -15,13 +15,13 @@ import { findValueIndex } from './helpers';
15
15
  import { isEqualArray, last, bind } from '../utils';
16
16
  import { BaseSelect } from '../select/base';
17
17
  var typeDefs = _extends({}, BaseSelect.typeDefs, {
18
- value: [String, Array, Date, Number, dayjs.Dayjs],
18
+ value: [String, Array, Date, Number, dayjs],
19
19
  range: Boolean,
20
20
  format: String,
21
21
  valueFormat: String,
22
22
  showFormat: String,
23
- min: [String, Date, Number, dayjs.Dayjs],
24
- max: [String, Date, Number, dayjs.Dayjs],
23
+ min: [String, Date, Number, dayjs],
24
+ max: [String, Date, Number, dayjs],
25
25
  disabledDate: Function
26
26
  });
27
27
  var defaults = function defaults() {
@@ -58,8 +58,8 @@ var defaults = {
58
58
  padding: "0 24px",
59
59
  bodyMarginTop: "-25px",
60
60
  tipIconMarginBottom: '10px',
61
- tipIconFontSize: '24px',
62
- tipIconLineHeight: '24px',
61
+ tipIconFontSize: '40px',
62
+ tipIconLineHeight: '40px',
63
63
  // with title
64
64
  titleFontWeight: '500',
65
65
  titleTipIconFontSize: '24px',
@@ -91,6 +91,7 @@ export function useMenuKeyboard() {
91
91
  function reset() {
92
92
  var item = items[focusIndex];
93
93
  if (focusIndex > -1 && item) {
94
+ // TODO(find bug)
94
95
  itemEvents.get(item).onFocusout();
95
96
  focusIndex = -1;
96
97
  }
@@ -141,6 +142,8 @@ export function useItemKeyboard(itemEvents) {
141
142
  onMouseLeave: function onMouseLeave(e) {
142
143
  instance.trigger('mouseleave', e);
143
144
  keyboard.reset();
145
+ // If it is a virtual item, it needs to be reset manually because the DOM is reused.
146
+ isFocus.set(false);
144
147
  },
145
148
  isFocus: isFocus
146
149
  };
@@ -8,6 +8,7 @@ import SearchDemo from '~/components/input/demos/search';
8
8
  import FrozenDemo from '~/components/input/demos/frozen';
9
9
  import AutoRowsDemo from '~/components/input/demos/autoRows';
10
10
  import PasswordDemo from '~/components/input/demos/password';
11
+ import AutoWidthDemo from '~/components/input/demos/autowidth';
11
12
  import { Input } from './';
12
13
  import { Dialog } from '../dialog';
13
14
  import { Component } from 'intact-vue-next';
@@ -238,4 +239,24 @@ describe('Input', function () {
238
239
  }
239
240
  }, _callee6);
240
241
  })));
242
+ it('autoWidth', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
243
+ var _mount7, instance, element, input;
244
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
245
+ while (1) switch (_context8.prev = _context8.next) {
246
+ case 0:
247
+ // should expand when input spaces
248
+ _mount7 = mount(AutoWidthDemo), instance = _mount7[0], element = _mount7[1];
249
+ input = element.querySelector('input');
250
+ input.value = 'ab ';
251
+ dispatchEvent(input, 'input');
252
+ _context8.next = 6;
253
+ return wait(50);
254
+ case 6:
255
+ expect(input.offsetWidth).to.gt(16);
256
+ case 7:
257
+ case "end":
258
+ return _context8.stop();
259
+ }
260
+ }, _callee7);
261
+ })));
241
262
  });
@@ -133,7 +133,7 @@ export default function ($props, $blocks, $__proto__) {
133
133
  return block ? block.call($this, callBlock, data) : callBlock();
134
134
  }, __$blocks['suffix'](_$no))], 0, _$cn(k + "-input-suffix"), {
135
135
  'ev-click': stopPropagation
136
- }) : undefined, autoWidth ? _$ce(2, 'div', _$ce(2, 'span', !hasValue ? hasInputValue || !defaultValue ? placeholder : defaultValue : inputValue, 0, null, null, null, fakeRef), 2, _$cn(k + "-input-fake")) : undefined], 0, _$cn(k + "-input-wrapper"), {
136
+ }) : undefined, autoWidth ? _$ce(2, 'div', _$ce(2, 'pre', !hasValue ? hasInputValue || !defaultValue ? placeholder : defaultValue : inputValue, 0, null, null, null, fakeRef), 2, _$cn(k + "-input-fake")) : undefined], 0, _$cn(k + "-input-wrapper"), {
137
137
  'ev-click': focusInputOnClick
138
138
  })
139
139
  });
@@ -125,7 +125,7 @@ export var makeStyles = cache(function makeStyles(k) {
125
125
  return /*#__PURE__*/css("&.", k, "-", size, "{", sizeClassName, ";}");
126
126
  }), "&.", k, "-inline{.", k, "-input-wrapper{height:auto;border:none;border-radius:0;padding:0;}}&.", k, "-type-textarea{.", k, "-input-wrapper{display:inline-block;padding:0;height:auto;}.", k, "-textarea{width:100%;padding:", input.textareaPadding, ";line-height:1.5;vertical-align:top;}.", k, "-input-suffix{margin:0;justify-content:flex-end;}}", _mapInstanceProperty(_context = Input.typeDefs.resize).call(_context, function (type) {
127
127
  return /*#__PURE__*/css("&.", k, "-resize-", type, "{.", k, "-textarea{resize:", type, ";}}");
128
- }), ".", k, "-input-fake{left:0;top:0;position:absolute;overflow:hidden;visibility:hidden;white-space:nowrap;}&.", k, "-auto-width{width:auto;max-width:100%;}.", k, "-input-count{color:", input.count.color, ";}");
128
+ }), ".", k, "-input-fake{left:0;top:0;position:absolute;overflow:hidden;visibility:hidden;white-space:nowrap;pre{font-family:inherit;}}&.", k, "-auto-width{width:auto;max-width:100%;}.", k, "-input-count{color:", input.count.color, ";}");
129
129
  });
130
130
  export var makeSearchStyles = cache(function makeSearchStyles(k) {
131
131
  return /*#__PURE__*/css("position:relative;display:inline-block;.", k, "-input{transition:width ", input.transition, ";}.", k, "-btn{position:absolute;top:0;right:0;z-index:1;}&.", k, "-default .", k, "-btn:hover{background:transparent;}.", k, "-input-suffix{margin-right:", input.search.suffixMarginRight, ";}&.", k, "-hide{", _mapInstanceProperty(sizes).call(sizes, function (size) {
@@ -60,7 +60,7 @@ export var makeAsideStyles = cache(function makeAsideStyles(k) {
60
60
  if (theme === 'dark') return;
61
61
  var styles = layout.light;
62
62
  return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-right:", styles.border, ";}");
63
- }), " &.", k, "-fixed{position:fixed;overflow:auto;left:0;top:0;bottom:0;z-index:", theme.midZIndex, ";}.", k, "-menu{width:auto!important;}");
63
+ }), " &.", k, "-fixed{position:fixed;overflow:auto;left:0;top:0;bottom:0;z-index:", theme.midZIndex, ";}.", k, "-menu{width:auto!important;border-right:none!important;}");
64
64
  });
65
65
  export var makeBodyStyles = cache(function makeBodyStyles(k) {
66
66
  return /*#__PURE__*/css("transition:padding-left ", layout.transition, ";");
@@ -24,6 +24,7 @@ export interface BaseSelectProps<V, Multipe extends boolean = boolean, Attach =
24
24
  flat?: boolean;
25
25
  nowrap?: boolean;
26
26
  draggable?: boolean;
27
+ virtual?: boolean;
27
28
  }
28
29
  export interface BaseSelectEvents {
29
30
  keydown: [KeyboardEvent];
@@ -37,7 +37,8 @@ var typeDefs = {
37
37
  position: Dropdown.typeDefs.position,
38
38
  flat: Boolean,
39
39
  nowrap: Boolean,
40
- draggable: Boolean
40
+ draggable: Boolean,
41
+ virtual: Boolean
41
42
  };
42
43
  var defaults = function defaults() {
43
44
  return {
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
- import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no } from 'intact-vue-next';
2
+ import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact-vue-next';
3
3
  import { makeGroupStyles } from './styles';
4
4
  import { getRestProps } from '../utils';
5
+ import { VirtualList } from '../virtualList';
5
6
  export default function ($props, $blocks, $__proto__) {
6
7
  var _classNameObj;
7
8
  $blocks || ($blocks = {});
@@ -14,7 +15,8 @@ export default function ($props, $blocks, $__proto__) {
14
15
  label = _this$get.label,
15
16
  className = _this$get.className;
16
17
  var _this$select$get = this.select.get(),
17
- card = _this$select$get.card;
18
+ card = _this$select$get.card,
19
+ virtual = _this$select$get.virtual;
18
20
  var k = this.config.k;
19
21
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-select-group"] = true, _classNameObj[className] = className, _classNameObj[makeGroupStyles(k)] = true, _classNameObj);
20
22
  return _$cv('div', _extends({}, getRestProps(this), {
@@ -27,6 +29,9 @@ export default function ($props, $blocks, $__proto__) {
27
29
  return _$blocks['label'].call($this, $super, data);
28
30
  };
29
31
  return block ? block.call($this, callBlock, data) : callBlock();
30
- }, __$blocks['label'](_$no)), 0, _$cn(k + "-select-group-label")) : undefined, children]);
32
+ }, __$blocks['label'](_$no)), 0, _$cn(k + "-select-group-label")) : undefined, _$cc(VirtualList, {
33
+ 'disabled': !virtual,
34
+ 'children': children
35
+ })]);
31
36
  }
32
37
  ;
@@ -240,7 +240,19 @@ describe('Select', function () {
240
240
  return wait();
241
241
  case 50:
242
242
  expect(instance.get('day1')).to.eql('Wednesday');
243
- case 51:
243
+ // should input spaces
244
+ input1.click();
245
+ _context6.next = 54;
246
+ return wait();
247
+ case 54:
248
+ dispatchEvent(input1, 'focus');
249
+ input1.value = 'm ';
250
+ dispatchEvent(input1, 'input');
251
+ _context6.next = 59;
252
+ return wait();
253
+ case 59:
254
+ expect(input1.value).to.eql('m ');
255
+ case 60:
244
256
  case "end":
245
257
  return _context6.stop();
246
258
  }
@@ -10,6 +10,7 @@ import { Button } from '../button';
10
10
  import { Icon } from '../icon';
11
11
  import { context } from './useSearchable';
12
12
  import { Tabs, Tab } from '../tabs';
13
+ import { VirtualList } from '../virtualList';
13
14
  export default function ($props, $blocks, $__proto__) {
14
15
  var _classNameObj;
15
16
  $blocks || ($blocks = {});
@@ -21,7 +22,8 @@ export default function ($props, $blocks, $__proto__) {
21
22
  var _this$select$get = this.select.get(),
22
23
  card = _this$select$get.card,
23
24
  searchable = _this$select$get.searchable,
24
- multiple = _this$select$get.multiple;
25
+ multiple = _this$select$get.multiple,
26
+ virtual = _this$select$get.virtual;
25
27
  var k = this.config.k;
26
28
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-select-menu"] = true, _classNameObj[k + "-card"] = card, _classNameObj[k + "-searchable"] = searchable, _classNameObj[className] = className, _classNameObj[makeMenuStyles(k)] = true, _classNameObj);
27
29
  if (card) {
@@ -43,9 +45,16 @@ export default function ($props, $blocks, $__proto__) {
43
45
  });
44
46
  }, $this)
45
47
  }), group];
46
- }
47
- if (isEmptyChildren(children)) {
48
+ } else if (isEmptyChildren(children)) {
48
49
  children = _$ce(2, 'div', _$('无数据'), 0, _$cn(k + "-select-empty"));
50
+ } else {
51
+ children = _$cc(VirtualList, {
52
+ 'style': {
53
+ maxHeight: '200px'
54
+ },
55
+ 'disabled': !virtual,
56
+ 'children': children
57
+ });
49
58
  }
50
59
  if (searchable) {
51
60
  var _this$searchable = this.searchable,
@@ -14,7 +14,8 @@ export default function ($props, $blocks, $__proto__) {
14
14
  autoDisableArrow = _this$get.autoDisableArrow,
15
15
  disabled = _this$get.disabled,
16
16
  multiple = _this$get.multiple,
17
- value = _this$get.value;
17
+ value = _this$get.value,
18
+ virtual = _this$get.virtual;
18
19
  var _this$filterable = this.filterable,
19
20
  getCreatedVNode = _this$filterable.getCreatedVNode,
20
21
  filter = _filterInstanceProperty(_this$filterable);
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
- import _findInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find";
3
2
  import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
3
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find";
4
4
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
5
5
  import { useInstance, createVNode as h, directClone } from 'intact-vue-next';
6
6
  import { Option } from './option';
@@ -10,18 +10,19 @@ import { getTextByChildren, mapChildren, isComponentVNode } from '../utils';
10
10
  export function useFilterable(keywords) {
11
11
  var component = useInstance();
12
12
  function getCreatedVNode(children) {
13
+ var _context;
13
14
  var _component$get = component.get(),
14
15
  creatable = _component$get.creatable,
15
16
  filterable = _component$get.filterable;
16
- var _keywords = keywords.value;
17
+ var _keywords = _trimInstanceProperty(_context = keywords.value).call(_context);
17
18
  if (creatable && filterable && _keywords) {
18
19
  if (!_findInstanceProperty(children).call(children, function (vNode) {
19
20
  // TODO: create Option for OptionGroup
20
21
  if (vNode.tag === Option) {
21
- var _context;
22
+ var _context2;
22
23
  var props = vNode.props;
23
24
  if (isNullOrUndefined(props)) return false;
24
- if (props.value === _keywords || _trimInstanceProperty(_context = props.label).call(_context) === _keywords) {
25
+ if (props.value === _keywords || _trimInstanceProperty(_context2 = props.label).call(_context2) === _keywords) {
25
26
  return true;
26
27
  }
27
28
  }
@@ -47,6 +48,7 @@ export function useFilterable(keywords) {
47
48
  var _children = [];
48
49
  mapChildren(children, function (vNode) {
49
50
  if (isComponentVNode(vNode, Option)) {
51
+ var _context3;
50
52
  var props = vNode.props;
51
53
  if (isNullOrUndefined(props)) return;
52
54
  vNode = directClone(vNode);
@@ -59,7 +61,7 @@ export function useFilterable(keywords) {
59
61
  if (isStringOrNumber(value)) {
60
62
  vNode.key = value;
61
63
  }
62
- if (filter(keywords.value, vNode.props)) {
64
+ if (filter(_trimInstanceProperty(_context3 = keywords.value).call(_context3), vNode.props)) {
63
65
  _children.push(vNode);
64
66
  }
65
67
  } else if (isComponentVNode(vNode, OptionGroup)) {
@@ -1,4 +1,3 @@
1
- import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
2
1
  import { useInstance, nextTick, createRef } from 'intact-vue-next';
3
2
  import { useState } from '../../hooks/useState';
4
3
  export function useInput(resetKeywords) {
@@ -6,7 +5,12 @@ export function useInput(resetKeywords) {
6
5
  var keywords = useState('');
7
6
  var inputRef = createRef();
8
7
  function onInput(value) {
9
- keywords.set(_trimInstanceProperty(value).call(value));
8
+ /**
9
+ * can not trim the keywords, otherwise we can not input spaces
10
+ * https://github.com/ksc-fe/kpc/issues/1047
11
+ */
12
+ // keywords.set(value.trim());
13
+ keywords.set(value);
10
14
  var dropdown = component.dropdownRef.value;
11
15
  // the position may be flip, and the select input height may change height too,
12
16
  // so we should reset the position
@@ -777,27 +777,28 @@ describe('Table', function () {
777
777
  while (1) switch (_context21.prev = _context21.next) {
778
778
  case 0:
779
779
  _mount19 = mount(TreeDemo), instance = _mount19[0], element = _mount19[1];
780
- table = instance.$lastInput.children; // check all
780
+ table = instance.$lastInput.children[0].children; // check all
781
781
  checkbox = element.querySelector('.k-checkbox');
782
782
  checkbox.click();
783
783
  _context21.next = 6;
784
784
  return wait();
785
785
  case 6:
786
786
  expect(element.innerHTML).to.matchSnapshot();
787
+ debugger;
787
788
  expect(table.getCheckedData()).to.have.lengthOf(8);
788
789
  arrow = element.querySelector('.k-table-arrow');
789
790
  arrow.click();
790
- _context21.next = 12;
791
+ _context21.next = 13;
791
792
  return wait();
792
- case 12:
793
+ case 13:
793
794
  expect(element.innerHTML).to.matchSnapshot();
794
795
  arrow.click();
795
- _context21.next = 16;
796
+ _context21.next = 17;
796
797
  return wait();
797
- case 16:
798
+ case 17:
798
799
  expect(element.innerHTML).to.matchSnapshot();
799
800
  expect(table.getCheckedData()).to.have.lengthOf(8);
800
- case 18:
801
+ case 19:
801
802
  case "end":
802
803
  return _context21.stop();
803
804
  }
@@ -93,7 +93,7 @@ export { table };
93
93
  export var makeStyles = cache(function makeStyles(k) {
94
94
  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-collapse:separate;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}tfoot{z-index:2;tr{td{border-top:", table.border, ";border-bottom-color:transparent;}}}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%);}&.", k, "-fixed-right:before{left:-2px;}&: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;line-height:1.4;}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, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;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) {
95
95
  return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
96
- }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}thead{position:sticky;top:0;}}&.", k, "-fix-footer{min-height:0;.", k, "-table-wrapper{height:100%;}tfoot{position:sticky;bottom:0;}}");
96
+ }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}thead{position:sticky;top:0;}}&.", k, "-fix-footer{min-height:0;.", k, "-table-wrapper{height:100%;}tfoot{position:sticky;bottom:0;}}.", k, "-table-phantom{position:static;}");
97
97
  });
98
98
  export var makeGroupMenuStyles = cache(function makeGroupMenuStyles(k) {
99
99
  return /*#__PURE__*/css("min-width:", table.group.menuMinWidth, "!important;.", 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-body{max-height:", table.group.menuMaxHeight, ";overflow:auto;}.", k, "-table-group-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.", k, "-btn{margin-left:8px;}}");
@@ -39,6 +39,7 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
39
39
  hideHeader?: boolean;
40
40
  pagination?: boolean | PaginationProps;
41
41
  fixFooter?: boolean;
42
+ virtual?: boolean;
42
43
  spreadArrowIndex?: number;
43
44
  load?: (value: T) => Promise<void> | void;
44
45
  }
@@ -63,6 +63,7 @@ var typeDefs = {
63
63
  hideHeader: Boolean,
64
64
  pagination: [Boolean, Object],
65
65
  fixFooter: Boolean,
66
+ virtual: Boolean,
66
67
  spreadArrowIndex: Number,
67
68
  load: Function
68
69
  };
@@ -146,9 +147,9 @@ export var Table = /*#__PURE__*/function (_Component) {
146
147
  // we can not use scrollIntoView with smooth, because it can only operate one element
147
148
  // at the same time
148
149
  // elem.scrollIntoView({behavior: 'smooth'});
149
- var headerHeight = scrollElement.querySelector('thead').offsetHeight;
150
+ // const headerHeight = (scrollElement.querySelector('thead') as HTMLElement).offsetHeight;
150
151
  var scrollTop = scrollElement.scrollTop;
151
- var offsetTop = tr.offsetTop - headerHeight;
152
+ var offsetTop = tr.offsetTop;
152
153
  var top = offsetTop - scrollTop;
153
154
  var topOneFrame = top / 60 / (100 / 1000);
154
155
  var step = function step() {