@king-design/intact 3.5.0-beta.0 → 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.
- package/components/affix/index.md +1 -0
- package/components/affix/index.ts +2 -0
- package/components/affix/useStyle.ts +38 -35
- package/components/datepicker/basepicker.ts +3 -3
- package/components/dialog/styles.ts +2 -2
- package/components/dropdown/useKeyboard.ts +3 -0
- package/components/layout/styles.ts +1 -0
- package/components/select/base.ts +2 -0
- package/components/select/base.vdt +0 -2
- package/components/select/demos/group.md +1 -1
- package/components/select/demos/virtual.md +47 -0
- package/components/select/group.vdt +3 -2
- package/components/select/index.md +1 -0
- package/components/select/menu.vdt +5 -4
- package/components/select/select.vdt +1 -1
- package/components/select/useFilterable.ts +2 -2
- package/components/select/useInput.ts +6 -1
- package/components/table/demos/fixHeader.md +25 -5
- package/components/table/demos/virtual.md +105 -0
- package/components/table/index.md +1 -0
- package/components/table/index.spec.ts +2 -1
- package/components/table/row.ts +2 -1
- package/components/table/styles.ts +4 -0
- package/components/table/table.ts +6 -4
- package/components/table/table.vdt +15 -11
- package/components/treeSelect/index.ts +1 -1
- package/components/virtualList/container.ts +36 -0
- package/components/virtualList/container.vdt +30 -0
- package/components/virtualList/demos/basic.md +67 -0
- package/components/virtualList/demos/combined.md +57 -0
- package/components/virtualList/demos/delete.md +70 -0
- package/components/virtualList/index.md +19 -0
- package/components/virtualList/index.spec.ts +263 -0
- package/components/virtualList/index.ts +5 -0
- package/components/virtualList/phantom.ts +18 -0
- package/components/virtualList/phantom.vdt +28 -0
- package/components/virtualList/rows.ts +13 -0
- package/components/virtualList/rows.vdt +20 -0
- package/components/virtualList/styles.ts +29 -0
- package/components/virtualList/useRows.ts +24 -0
- package/components/virtualList/useVirtualRows.ts +145 -0
- package/components/virtualList/virtual.ts +19 -0
- package/components/virtualList/virtual.vdt +17 -0
- package/components/virtualList/wrapper.ts +17 -0
- package/components/virtualList/wrapper.vdt +24 -0
- package/es/components/affix/index.d.ts +1 -0
- package/es/components/affix/index.js +2 -1
- package/es/components/affix/useStyle.js +50 -47
- package/es/components/datepicker/basepicker.js +3 -3
- package/es/components/dialog/styles.js +2 -2
- package/es/components/dropdown/useKeyboard.js +3 -0
- package/es/components/input/index.spec.js +4 -2
- package/es/components/layout/styles.js +1 -1
- package/es/components/select/base.d.ts +1 -0
- package/es/components/select/base.js +2 -1
- package/es/components/select/base.vdt.js +2 -4
- package/es/components/select/group.vdt.js +8 -3
- package/es/components/select/menu.vdt.js +12 -3
- package/es/components/select/select.vdt.js +2 -1
- package/es/components/select/useFilterable.js +7 -5
- package/es/components/select/useInput.js +6 -2
- package/es/components/table/index.spec.js +7 -6
- package/es/components/table/styles.js +1 -1
- package/es/components/table/table.d.ts +1 -0
- package/es/components/table/table.js +3 -2
- package/es/components/table/table.vdt.js +126 -114
- package/es/components/treeSelect/index.js +4 -3
- package/es/components/virtualList/container.d.ts +10 -0
- package/es/components/virtualList/container.js +26 -0
- package/es/components/virtualList/container.vdt.js +39 -0
- package/es/components/virtualList/index.d.ts +5 -0
- package/es/components/virtualList/index.js +5 -0
- package/es/components/virtualList/index.spec.d.ts +1 -0
- package/es/components/virtualList/index.spec.js +372 -0
- package/es/components/virtualList/phantom.d.ts +9 -0
- package/es/components/virtualList/phantom.js +24 -0
- package/es/components/virtualList/phantom.vdt.js +33 -0
- package/es/components/virtualList/rows.d.ts +8 -0
- package/es/components/virtualList/rows.js +20 -0
- package/es/components/virtualList/rows.vdt.js +32 -0
- package/es/components/virtualList/styles.d.ts +13 -0
- package/es/components/virtualList/styles.js +34 -0
- package/es/components/virtualList/useRows.d.ts +2 -0
- package/es/components/virtualList/useRows.js +19 -0
- package/es/components/virtualList/useVirtualRows.d.ts +20 -0
- package/es/components/virtualList/useVirtualRows.js +120 -0
- package/es/components/virtualList/virtual.d.ts +8 -0
- package/es/components/virtualList/virtual.js +15 -0
- package/es/components/virtualList/virtual.vdt.js +26 -0
- package/es/components/virtualList/wrapper.d.ts +9 -0
- package/es/components/virtualList/wrapper.js +24 -0
- package/es/components/virtualList/wrapper.vdt.js +34 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/site/data/components/select/demos/virtual/index.d.ts +11 -0
- package/es/site/data/components/select/demos/virtual/index.js +32 -0
- package/es/site/data/components/select/demos/virtual/react.d.ts +11 -0
- package/es/site/data/components/select/demos/virtual/react.js +53 -0
- package/es/site/data/components/table/demos/fixHeader/index.d.ts +6 -0
- package/es/site/data/components/table/demos/fixHeader/index.js +14 -0
- package/es/site/data/components/table/demos/fixHeader/react.d.ts +6 -0
- package/es/site/data/components/table/demos/fixHeader/react.js +28 -11
- package/es/site/data/components/table/demos/virtual/index.d.ts +13 -0
- package/es/site/data/components/table/demos/virtual/index.js +76 -0
- package/es/site/data/components/table/demos/virtual/react.d.ts +14 -0
- package/es/site/data/components/table/demos/virtual/react.js +114 -0
- package/es/site/data/components/virtualList/demos/basic/index.d.ts +12 -0
- package/es/site/data/components/virtualList/demos/basic/index.js +42 -0
- package/es/site/data/components/virtualList/demos/basic/react.d.ts +12 -0
- package/es/site/data/components/virtualList/demos/basic/react.js +67 -0
- package/es/site/data/components/virtualList/demos/combined/index.d.ts +11 -0
- package/es/site/data/components/virtualList/demos/combined/index.js +32 -0
- package/es/site/data/components/virtualList/demos/combined/react.d.ts +11 -0
- package/es/site/data/components/virtualList/demos/combined/react.js +50 -0
- package/es/site/data/components/virtualList/demos/delete/index.d.ts +13 -0
- package/es/site/data/components/virtualList/demos/delete/index.js +51 -0
- package/es/site/data/components/virtualList/demos/delete/react.d.ts +13 -0
- package/es/site/data/components/virtualList/demos/delete/react.js +75 -0
- package/es/site/data/components/virtualList/index.d.ts +57 -0
- package/es/site/data/components/virtualList/index.js +32 -0
- package/index.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Table, TableColumn } from '@king-design/react';
|
|
7
|
+
import './index.styl';
|
|
8
|
+
import { bind } from '@king-design/react/components/utils';
|
|
9
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inheritsLoose(Demo, _React$Component);
|
|
11
|
+
function Demo() {
|
|
12
|
+
var _context;
|
|
13
|
+
var _this;
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
18
|
+
_this.state = {
|
|
19
|
+
data: [],
|
|
20
|
+
variableHeightData: []
|
|
21
|
+
};
|
|
22
|
+
_this.table = void 0;
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
var _proto = Demo.prototype;
|
|
26
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
27
|
+
var arr = [];
|
|
28
|
+
for (var index = 0; index < 10000; index++) {
|
|
29
|
+
arr.push({
|
|
30
|
+
a: "Cell " + index + "-1",
|
|
31
|
+
b: "Cell " + index + "-2"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
this.setState({
|
|
35
|
+
data: arr
|
|
36
|
+
});
|
|
37
|
+
var generateTreeData = function generateTreeData(count) {
|
|
38
|
+
var result = [];
|
|
39
|
+
var _loop = function _loop(i) {
|
|
40
|
+
var hasChildren = Math.random() > 0.5;
|
|
41
|
+
var node = {
|
|
42
|
+
name: "Node-" + i,
|
|
43
|
+
key: "node-" + i,
|
|
44
|
+
size: Math.floor(Math.random() * 100)
|
|
45
|
+
};
|
|
46
|
+
if (hasChildren) {
|
|
47
|
+
node.children = _Array$from({
|
|
48
|
+
length: 2
|
|
49
|
+
}, function (_, j) {
|
|
50
|
+
return {
|
|
51
|
+
name: "Node-" + i + "-" + j,
|
|
52
|
+
key: "node-" + i + "-" + j,
|
|
53
|
+
size: Math.floor(Math.random() * 100),
|
|
54
|
+
children: Math.random() > 0.5 ? [{
|
|
55
|
+
name: "Node-" + i + "-" + j + "-0",
|
|
56
|
+
key: "node-" + i + "-" + j + "-0",
|
|
57
|
+
size: Math.floor(Math.random() * 100)
|
|
58
|
+
}] : undefined
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
result.push(node);
|
|
63
|
+
};
|
|
64
|
+
for (var i = 0; i < count; i++) {
|
|
65
|
+
_loop(i);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
var data = generateTreeData(10000);
|
|
70
|
+
this.setState({
|
|
71
|
+
variableHeightData: data
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
_proto.scrollToRowByKey = function scrollToRowByKey() {
|
|
75
|
+
this.table.scrollToRowByKey('Node-400');
|
|
76
|
+
};
|
|
77
|
+
_proto.render = function render() {
|
|
78
|
+
var _this2 = this;
|
|
79
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, "\u8868\u683C"), /*#__PURE__*/React.createElement(Table, {
|
|
80
|
+
data: this.state.data,
|
|
81
|
+
virtual: true,
|
|
82
|
+
fixHeader: "400"
|
|
83
|
+
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
84
|
+
key: "a",
|
|
85
|
+
title: "Title 1",
|
|
86
|
+
minWidth: 200
|
|
87
|
+
}), /*#__PURE__*/React.createElement(TableColumn, {
|
|
88
|
+
key: "b",
|
|
89
|
+
title: "Title 2",
|
|
90
|
+
minWidth: 300
|
|
91
|
+
})), /*#__PURE__*/React.createElement("h4", null, "\u6811\u5F62\u8868\u683C"), /*#__PURE__*/React.createElement(Table, {
|
|
92
|
+
ref: function ref(i) {
|
|
93
|
+
return _this2.table = i;
|
|
94
|
+
},
|
|
95
|
+
data: this.state.variableHeightData,
|
|
96
|
+
virtual: true,
|
|
97
|
+
rowKey: function rowKey(data) {
|
|
98
|
+
return data.name;
|
|
99
|
+
},
|
|
100
|
+
fixHeader: "400"
|
|
101
|
+
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
102
|
+
key: "name",
|
|
103
|
+
title: "Title 1",
|
|
104
|
+
minWidth: 200
|
|
105
|
+
}), /*#__PURE__*/React.createElement(TableColumn, {
|
|
106
|
+
key: "size",
|
|
107
|
+
title: "Title 2",
|
|
108
|
+
minWidth: 300
|
|
109
|
+
})));
|
|
110
|
+
};
|
|
111
|
+
return Demo;
|
|
112
|
+
}(React.Component);
|
|
113
|
+
export { Demo as default };
|
|
114
|
+
__decorate([bind], Demo.prototype, "scrollToRowByKey", null);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import './index.styl';
|
|
4
|
+
interface Props {
|
|
5
|
+
data: any[];
|
|
6
|
+
variableHeightData: any[];
|
|
7
|
+
}
|
|
8
|
+
export default class extends Component {
|
|
9
|
+
static template: string | import("intact").Template<any>;
|
|
10
|
+
static defaults(): Props;
|
|
11
|
+
init(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _repeatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/repeat";
|
|
3
|
+
export { default as data } from './index.json';
|
|
4
|
+
import { Component } from 'intact';
|
|
5
|
+
import template from './index.vdt';
|
|
6
|
+
import './index.styl';
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
default_1.defaults = function defaults() {
|
|
13
|
+
return {
|
|
14
|
+
data: [],
|
|
15
|
+
variableHeightData: []
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var _proto = default_1.prototype;
|
|
19
|
+
_proto.init = function init() {
|
|
20
|
+
var arr = [];
|
|
21
|
+
var variableHeightData = [];
|
|
22
|
+
for (var index = 0; index < 10000; index++) {
|
|
23
|
+
var _context;
|
|
24
|
+
arr.push({
|
|
25
|
+
value: index,
|
|
26
|
+
label: "\u6D4B\u8BD5" + index
|
|
27
|
+
});
|
|
28
|
+
var repeatPart = _repeatInstanceProperty(_context = '行内容').call(_context, Math.floor(Math.random() * 5) + 1);
|
|
29
|
+
variableHeightData.push({
|
|
30
|
+
value: index,
|
|
31
|
+
label: "\u4E0D\u5B9A\u9AD8\u5EA6\u9879 " + index + "\n" + repeatPart
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
this.set({
|
|
35
|
+
data: arr,
|
|
36
|
+
variableHeightData: variableHeightData
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return default_1;
|
|
40
|
+
}(Component);
|
|
41
|
+
default_1.template = template;
|
|
42
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.styl';
|
|
3
|
+
interface Props {
|
|
4
|
+
data: any[];
|
|
5
|
+
variableHeightData: any[];
|
|
6
|
+
}
|
|
7
|
+
export default class Demo extends React.Component<{}, Props> {
|
|
8
|
+
state: Props;
|
|
9
|
+
componentDidMount(): void;
|
|
10
|
+
render(): React.JSX.Element;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _repeatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/repeat";
|
|
4
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { VirtualList } from '@king-design/react';
|
|
7
|
+
import './index.styl';
|
|
8
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inheritsLoose(Demo, _React$Component);
|
|
10
|
+
function Demo() {
|
|
11
|
+
var _context;
|
|
12
|
+
var _this;
|
|
13
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
args[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
17
|
+
_this.state = {
|
|
18
|
+
data: [],
|
|
19
|
+
variableHeightData: []
|
|
20
|
+
};
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
var _proto = Demo.prototype;
|
|
24
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
25
|
+
var arr = [];
|
|
26
|
+
var variableHeightData = [];
|
|
27
|
+
for (var index = 0; index < 10000; index++) {
|
|
28
|
+
var _context2;
|
|
29
|
+
arr.push({
|
|
30
|
+
value: index,
|
|
31
|
+
label: "\u6D4B\u8BD5" + index
|
|
32
|
+
});
|
|
33
|
+
var repeatPart = _repeatInstanceProperty(_context2 = '行内容').call(_context2, Math.floor(Math.random() * 5) + 1);
|
|
34
|
+
variableHeightData.push({
|
|
35
|
+
value: index,
|
|
36
|
+
label: "\u4E0D\u5B9A\u9AD8\u5EA6\u9879 " + index + "\n" + repeatPart
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
this.setState({
|
|
40
|
+
data: arr,
|
|
41
|
+
variableHeightData: variableHeightData
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
_proto.render = function render() {
|
|
45
|
+
var _context3, _context4;
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, "1. \u5B9A\u9AD8\u5143\u7D20"), /*#__PURE__*/React.createElement(VirtualList, {
|
|
47
|
+
style: {
|
|
48
|
+
"height": "450px"
|
|
49
|
+
}
|
|
50
|
+
}, _mapInstanceProperty(_context3 = this.state.data).call(_context3, function ($value, $key) {
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "fixed-height-item"
|
|
53
|
+
}, $value.label);
|
|
54
|
+
})), /*#__PURE__*/React.createElement("h3", null, "2. \u4E0D\u5B9A\u9AD8\u5143\u7D20"), /*#__PURE__*/React.createElement(VirtualList, {
|
|
55
|
+
style: {
|
|
56
|
+
"width": "200px",
|
|
57
|
+
"height": "450px"
|
|
58
|
+
}
|
|
59
|
+
}, _mapInstanceProperty(_context4 = this.state.variableHeightData).call(_context4, function ($value, $key) {
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "variable-height-item"
|
|
62
|
+
}, $value.label);
|
|
63
|
+
})));
|
|
64
|
+
};
|
|
65
|
+
return Demo;
|
|
66
|
+
}(React.Component);
|
|
67
|
+
export { Demo as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import './index.styl';
|
|
4
|
+
interface Props {
|
|
5
|
+
data: any[];
|
|
6
|
+
}
|
|
7
|
+
export default class extends Component {
|
|
8
|
+
static template: string | import("intact").Template<any>;
|
|
9
|
+
static defaults(): Props;
|
|
10
|
+
init(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
import './index.styl';
|
|
6
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
7
|
+
_inheritsLoose(default_1, _Component);
|
|
8
|
+
function default_1() {
|
|
9
|
+
return _Component.apply(this, arguments) || this;
|
|
10
|
+
}
|
|
11
|
+
default_1.defaults = function defaults() {
|
|
12
|
+
return {
|
|
13
|
+
data: []
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var _proto = default_1.prototype;
|
|
17
|
+
_proto.init = function init() {
|
|
18
|
+
var arr = [];
|
|
19
|
+
for (var index = 0; index < 10000; index++) {
|
|
20
|
+
arr.push({
|
|
21
|
+
value: index,
|
|
22
|
+
label: "\u6D4B\u8BD5" + index
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
this.set({
|
|
26
|
+
data: arr
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
return default_1;
|
|
30
|
+
}(Component);
|
|
31
|
+
default_1.template = template;
|
|
32
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/react';
|
|
6
|
+
import './index.styl';
|
|
7
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inheritsLoose(Demo, _React$Component);
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
var _this;
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
16
|
+
_this.state = {
|
|
17
|
+
data: []
|
|
18
|
+
};
|
|
19
|
+
return _this;
|
|
20
|
+
}
|
|
21
|
+
var _proto = Demo.prototype;
|
|
22
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
23
|
+
var arr = [];
|
|
24
|
+
for (var index = 0; index < 10000; index++) {
|
|
25
|
+
arr.push({
|
|
26
|
+
value: index,
|
|
27
|
+
label: "\u6D4B\u8BD5" + index
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
this.setState({
|
|
31
|
+
data: arr
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
_proto.render = function render() {
|
|
35
|
+
var _context2;
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
style: {
|
|
38
|
+
"height": "460px"
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(VirtualListContainer, null, /*#__PURE__*/React.createElement(VirtualListPhantom, null), /*#__PURE__*/React.createElement(VirtualListWrapper, {
|
|
41
|
+
tagName: "ul"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(VirtualListRows, null, _mapInstanceProperty(_context2 = this.state.data).call(_context2, function ($value, $key) {
|
|
43
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
44
|
+
className: "fixed-height-item"
|
|
45
|
+
}, $value.label);
|
|
46
|
+
})))));
|
|
47
|
+
};
|
|
48
|
+
return Demo;
|
|
49
|
+
}(React.Component);
|
|
50
|
+
export { Demo as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import './index.styl';
|
|
4
|
+
interface Props {
|
|
5
|
+
data: any[];
|
|
6
|
+
}
|
|
7
|
+
export default class extends Component<Props> {
|
|
8
|
+
static template: string | import("intact").Template<any>;
|
|
9
|
+
static defaults(): Props;
|
|
10
|
+
init(): void;
|
|
11
|
+
removeItems(): void;
|
|
12
|
+
removeLastItems(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
3
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
export { default as data } from './index.json';
|
|
6
|
+
import { Component } from 'intact';
|
|
7
|
+
import template from './index.vdt';
|
|
8
|
+
import './index.styl';
|
|
9
|
+
import { bind } from 'kpc/components/utils';
|
|
10
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inheritsLoose(default_1, _Component);
|
|
12
|
+
function default_1() {
|
|
13
|
+
return _Component.apply(this, arguments) || this;
|
|
14
|
+
}
|
|
15
|
+
default_1.defaults = function defaults() {
|
|
16
|
+
return {
|
|
17
|
+
data: []
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
var _proto = default_1.prototype;
|
|
21
|
+
_proto.init = function init() {
|
|
22
|
+
var newData = [];
|
|
23
|
+
var variableHeightData = [];
|
|
24
|
+
for (var index = 0; index < 10000; index++) {
|
|
25
|
+
newData.push({
|
|
26
|
+
value: index,
|
|
27
|
+
label: "\u6D4B\u8BD5" + index
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
this.set({
|
|
31
|
+
data: newData
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
_proto.removeItems = function removeItems() {
|
|
35
|
+
var _context;
|
|
36
|
+
var data = _sliceInstanceProperty(_context = this.get('data')).call(_context);
|
|
37
|
+
_spliceInstanceProperty(data).call(data, 0, 5);
|
|
38
|
+
this.set('data', data);
|
|
39
|
+
};
|
|
40
|
+
_proto.removeLastItems = function removeLastItems() {
|
|
41
|
+
var _context2;
|
|
42
|
+
var data = _sliceInstanceProperty(_context2 = this.get('data')).call(_context2);
|
|
43
|
+
_spliceInstanceProperty(data).call(data, data.length - 5);
|
|
44
|
+
this.set('data', data);
|
|
45
|
+
};
|
|
46
|
+
return default_1;
|
|
47
|
+
}(Component);
|
|
48
|
+
default_1.template = template;
|
|
49
|
+
export { default_1 as default };
|
|
50
|
+
__decorate([bind], default_1.prototype, "removeItems", null);
|
|
51
|
+
__decorate([bind], default_1.prototype, "removeLastItems", null);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.styl';
|
|
3
|
+
interface Props {
|
|
4
|
+
data: any[];
|
|
5
|
+
}
|
|
6
|
+
export default class Demo extends React.Component<{}, Props> {
|
|
7
|
+
state: Props;
|
|
8
|
+
componentDidMount(): void;
|
|
9
|
+
removeItems(): void;
|
|
10
|
+
removeLastItems(): void;
|
|
11
|
+
render(): React.JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
4
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
5
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { VirtualList, Button } from '@king-design/react';
|
|
9
|
+
import './index.styl';
|
|
10
|
+
import { bind } from '@king-design/react/components/utils';
|
|
11
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inheritsLoose(Demo, _React$Component);
|
|
13
|
+
function Demo() {
|
|
14
|
+
var _context;
|
|
15
|
+
var _this;
|
|
16
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
+
args[_key] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
20
|
+
_this.state = {
|
|
21
|
+
data: []
|
|
22
|
+
};
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
var _proto = Demo.prototype;
|
|
26
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
27
|
+
var newData = [];
|
|
28
|
+
var variableHeightData = [];
|
|
29
|
+
for (var index = 0; index < 10000; index++) {
|
|
30
|
+
newData.push({
|
|
31
|
+
value: index,
|
|
32
|
+
label: "\u6D4B\u8BD5" + index
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
this.setState({
|
|
36
|
+
data: newData
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
_proto.removeItems = function removeItems() {
|
|
40
|
+
var _context2;
|
|
41
|
+
var data = _sliceInstanceProperty(_context2 = this.state.data).call(_context2);
|
|
42
|
+
_spliceInstanceProperty(data).call(data, 0, 5);
|
|
43
|
+
this.setState({
|
|
44
|
+
data: data
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
_proto.removeLastItems = function removeLastItems() {
|
|
48
|
+
var _context3;
|
|
49
|
+
var data = _sliceInstanceProperty(_context3 = this.state.data).call(_context3);
|
|
50
|
+
_spliceInstanceProperty(data).call(data, data.length - 5);
|
|
51
|
+
this.setState({
|
|
52
|
+
data: data
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
_proto.render = function render() {
|
|
56
|
+
var _context4;
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
58
|
+
onClick: this.removeItems
|
|
59
|
+
}, "\u5220\u9664\u524D5\u9879"), /*#__PURE__*/React.createElement(Button, {
|
|
60
|
+
onClick: this.removeLastItems
|
|
61
|
+
}, "\u5220\u9664\u540E5\u9879"), /*#__PURE__*/React.createElement(VirtualList, {
|
|
62
|
+
style: {
|
|
63
|
+
"height": "450px"
|
|
64
|
+
}
|
|
65
|
+
}, _mapInstanceProperty(_context4 = this.state.data).call(_context4, function ($value, $key) {
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "fixed-height-item"
|
|
68
|
+
}, $value.label);
|
|
69
|
+
})));
|
|
70
|
+
};
|
|
71
|
+
return Demo;
|
|
72
|
+
}(React.Component);
|
|
73
|
+
export { Demo as default };
|
|
74
|
+
__decorate([bind], Demo.prototype, "removeItems", null);
|
|
75
|
+
__decorate([bind], Demo.prototype, "removeLastItems", null);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Component } from 'intact';
|
|
2
|
+
import Article from '~/../src/components/article';
|
|
3
|
+
export default class extends Article {
|
|
4
|
+
static sidebar: {
|
|
5
|
+
组件: {
|
|
6
|
+
title: string;
|
|
7
|
+
category: string;
|
|
8
|
+
order: number;
|
|
9
|
+
sidebar: string;
|
|
10
|
+
path: string;
|
|
11
|
+
}[];
|
|
12
|
+
undefined: ({
|
|
13
|
+
title: string;
|
|
14
|
+
order: number;
|
|
15
|
+
sidebar: string;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
path: string;
|
|
18
|
+
} | {
|
|
19
|
+
title: string;
|
|
20
|
+
order: number;
|
|
21
|
+
sidebar: string;
|
|
22
|
+
path: string;
|
|
23
|
+
disabled?: undefined;
|
|
24
|
+
})[];
|
|
25
|
+
};
|
|
26
|
+
static data: {
|
|
27
|
+
setting: {
|
|
28
|
+
title: string;
|
|
29
|
+
category: string;
|
|
30
|
+
order: number;
|
|
31
|
+
sidebar: string;
|
|
32
|
+
};
|
|
33
|
+
contents: string;
|
|
34
|
+
index: string;
|
|
35
|
+
catalogs: {
|
|
36
|
+
text: string;
|
|
37
|
+
level: number;
|
|
38
|
+
id: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
static defaults: () => {
|
|
42
|
+
demos: Component<any, {}, {}, {}>[];
|
|
43
|
+
setting: {
|
|
44
|
+
title: string;
|
|
45
|
+
category: string;
|
|
46
|
+
order: number;
|
|
47
|
+
sidebar: string;
|
|
48
|
+
};
|
|
49
|
+
contents: string;
|
|
50
|
+
index: string;
|
|
51
|
+
catalogs: {
|
|
52
|
+
text: string;
|
|
53
|
+
level: number;
|
|
54
|
+
id: string;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
3
|
+
import _keysInstanceProperty from "@babel/runtime-corejs3/core-js/instance/keys";
|
|
4
|
+
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js/instance/starts-with";
|
|
5
|
+
import Article from '~/../src/components/article';
|
|
6
|
+
import data from './index.json';
|
|
7
|
+
import sidebar from '~/doc.json';
|
|
8
|
+
var r = require.context('./', true, /demos.*(index|demo).ts/);
|
|
9
|
+
var keys = _keysInstanceProperty(r).call(r);
|
|
10
|
+
var demos = [];
|
|
11
|
+
for (var i = 0; i < keys.length; i++) {
|
|
12
|
+
var file = keys[i];
|
|
13
|
+
if (!_startsWithInstanceProperty(file).call(file, '.')) continue;
|
|
14
|
+
// if we found demo.js then ignore index.js
|
|
15
|
+
if (/demo.ts$/.test(file)) i++;
|
|
16
|
+
demos.push(r(file));
|
|
17
|
+
}
|
|
18
|
+
var default_1 = /*#__PURE__*/function (_Article) {
|
|
19
|
+
_inheritsLoose(default_1, _Article);
|
|
20
|
+
function default_1() {
|
|
21
|
+
return _Article.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
return default_1;
|
|
24
|
+
}(Article);
|
|
25
|
+
default_1.sidebar = sidebar;
|
|
26
|
+
default_1.data = data;
|
|
27
|
+
default_1.defaults = function () {
|
|
28
|
+
return _extends({}, Article.defaults, data, {
|
|
29
|
+
demos: demos
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { default_1 as default };
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.5.0
|
|
2
|
+
* @king-design v3.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -67,8 +67,9 @@ export * from './components/tree';
|
|
|
67
67
|
export * from './components/treeSelect';
|
|
68
68
|
export * from './components/upload';
|
|
69
69
|
export * from './components/view';
|
|
70
|
+
export * from './components/virtualList';
|
|
70
71
|
export * from './components/wave';
|
|
71
72
|
|
|
72
|
-
export const version = '3.5.0
|
|
73
|
+
export const version = '3.5.0';
|
|
73
74
|
|
|
74
75
|
/* generate end */
|