@king-design/react 3.5.0-beta.0 → 3.5.1-beta.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.
- package/components/affix/index.d.ts +1 -0
- package/components/affix/index.js +2 -1
- package/components/affix/useStyle.js +50 -47
- package/components/datepicker/basepicker.js +3 -3
- package/components/dialog/styles.js +2 -2
- package/components/dropdown/useKeyboard.js +3 -0
- package/components/input/index.spec.js +4 -2
- package/components/layout/styles.js +1 -1
- package/components/select/base.d.ts +1 -0
- package/components/select/base.js +2 -1
- package/components/select/base.vdt.js +2 -4
- package/components/select/group.vdt.js +8 -3
- package/components/select/menu.vdt.js +12 -3
- package/components/select/select.vdt.js +2 -1
- package/components/select/useFilterable.js +7 -5
- package/components/select/useInput.js +6 -2
- package/components/table/index.spec.js +7 -6
- package/components/table/styles.js +1 -1
- package/components/table/table.d.ts +1 -0
- package/components/table/table.js +3 -2
- package/components/table/table.vdt.js +126 -114
- package/components/treeSelect/index.js +4 -3
- package/components/virtualList/container.d.ts +10 -0
- package/components/virtualList/container.js +26 -0
- package/components/virtualList/container.vdt.js +39 -0
- package/components/virtualList/index.d.ts +5 -0
- package/components/virtualList/index.js +5 -0
- package/components/virtualList/index.spec.d.ts +1 -0
- package/components/virtualList/index.spec.js +372 -0
- package/components/virtualList/phantom.d.ts +9 -0
- package/components/virtualList/phantom.js +24 -0
- package/components/virtualList/phantom.vdt.js +33 -0
- package/components/virtualList/rows.d.ts +8 -0
- package/components/virtualList/rows.js +20 -0
- package/components/virtualList/rows.vdt.js +32 -0
- package/components/virtualList/styles.d.ts +13 -0
- package/components/virtualList/styles.js +34 -0
- package/components/virtualList/useRows.d.ts +2 -0
- package/components/virtualList/useRows.js +19 -0
- package/components/virtualList/useVirtualRows.d.ts +20 -0
- package/components/virtualList/useVirtualRows.js +120 -0
- package/components/virtualList/virtual.d.ts +8 -0
- package/components/virtualList/virtual.js +15 -0
- package/components/virtualList/virtual.vdt.js +26 -0
- package/components/virtualList/wrapper.d.ts +9 -0
- package/components/virtualList/wrapper.js +24 -0
- package/components/virtualList/wrapper.vdt.js +34 -0
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +2 -2
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
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
|
|
24
|
-
max: [String, Date, Number, 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: '
|
|
62
|
-
tipIconLineHeight: '
|
|
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
|
};
|
|
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
|
3
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
5
5
|
import BasicDemo from '~/components/input/demos/basic';
|
|
6
|
-
import { mount, dispatchEvent, wait, getElement } from '../../test/utils';
|
|
6
|
+
import { mount, unmount, dispatchEvent, wait, getElement } from '../../test/utils';
|
|
7
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';
|
|
@@ -13,7 +13,9 @@ import { Input } from './';
|
|
|
13
13
|
import { Dialog } from '../dialog';
|
|
14
14
|
import { Component } from 'intact-react';
|
|
15
15
|
describe('Input', function () {
|
|
16
|
-
|
|
16
|
+
afterEach(function () {
|
|
17
|
+
unmount();
|
|
18
|
+
});
|
|
17
19
|
it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
20
|
var _mount, instance, element, input;
|
|
19
21
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -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, ";");
|
|
@@ -71,8 +71,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
71
71
|
'key': 'filter',
|
|
72
72
|
'readonly': !show,
|
|
73
73
|
'waveDisabled': true,
|
|
74
|
-
'flat': flat
|
|
75
|
-
'frozenOnInput': true
|
|
74
|
+
'flat': flat
|
|
76
75
|
}, 'filter', inputRef) : undefined;
|
|
77
76
|
return _$cc(ErrorContext.Consumer, {
|
|
78
77
|
'defaultValue': false,
|
|
@@ -123,8 +122,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
123
122
|
'key': 'input',
|
|
124
123
|
'readonly': !show,
|
|
125
124
|
'waveDisabled': true,
|
|
126
|
-
'flat': flat
|
|
127
|
-
'frozenOnInput': true
|
|
125
|
+
'flat': flat
|
|
128
126
|
}, 'input', inputRef) : !filterable && !hasValue ? _$ce(2, 'div', placeholder, 0, _$cn(k + "-select-placeholder c-ellipsis"), null, 'placeholder') : !multiple ? _$ce(2, 'div', (_$blocks['value'] = function ($super) {
|
|
129
127
|
return label;
|
|
130
128
|
}, __$blocks['value'] = function ($super, data) {
|
|
@@ -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-react';
|
|
2
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact-react';
|
|
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,
|
|
32
|
+
}, __$blocks['label'](_$no)), 0, _$cn(k + "-select-group-label")) : undefined, _$cc(VirtualList, {
|
|
33
|
+
'disabled': !virtual,
|
|
34
|
+
'children': children
|
|
35
|
+
})]);
|
|
31
36
|
}
|
|
32
37
|
;
|
|
@@ -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-react';
|
|
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
|
|
22
|
+
var _context2;
|
|
22
23
|
var props = vNode.props;
|
|
23
24
|
if (isNullOrUndefined(props)) return false;
|
|
24
|
-
if (props.value === _keywords || _trimInstanceProperty(
|
|
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-react';
|
|
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
|
-
|
|
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 =
|
|
791
|
+
_context21.next = 13;
|
|
791
792
|
return wait();
|
|
792
|
-
case
|
|
793
|
+
case 13:
|
|
793
794
|
expect(element.innerHTML).to.matchSnapshot();
|
|
794
795
|
arrow.click();
|
|
795
|
-
_context21.next =
|
|
796
|
+
_context21.next = 17;
|
|
796
797
|
return wait();
|
|
797
|
-
case
|
|
798
|
+
case 17:
|
|
798
799
|
expect(element.innerHTML).to.matchSnapshot();
|
|
799
800
|
expect(table.getCheckedData()).to.have.lengthOf(8);
|
|
800
|
-
case
|
|
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
|
-
|
|
150
|
+
// const headerHeight = (scrollElement.querySelector('thead') as HTMLElement).offsetHeight;
|
|
150
151
|
var scrollTop = scrollElement.scrollTop;
|
|
151
|
-
var offsetTop = tr.offsetTop
|
|
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() {
|