@king-design/intact 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/table/cell.ts +4 -0
- package/components/table/demos/basic.md +8 -2
- package/components/table/index.spec.ts +38 -54
- package/components/table/useChecked.ts +1 -1
- package/es/components/table/cell.js +5 -0
- package/es/components/table/index.spec.js +76 -52
- package/es/components/table/useChecked.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/table/demos/basic/react.js +8 -2
- package/index.ts +2 -2
- package/package.json +5 -4
package/components/table/cell.ts
CHANGED
|
@@ -7,10 +7,16 @@ order: 0
|
|
|
7
7
|
组件定义表格结构,详见”定义表格结构“说明
|
|
8
8
|
|
|
9
9
|
```vdt
|
|
10
|
-
import {Table, TableColumn} from 'kpc';
|
|
10
|
+
import {Table, TableColumn, Select, Option} from 'kpc';
|
|
11
11
|
|
|
12
12
|
<Table data={this.get('data')} resizable>
|
|
13
|
-
<TableColumn key="a" title="Title 1"
|
|
13
|
+
<TableColumn key="a" title="Title 1">
|
|
14
|
+
<b:template args="[data]">
|
|
15
|
+
<Select>
|
|
16
|
+
<Option value="a">test</Option>
|
|
17
|
+
</Select>
|
|
18
|
+
</b:template>
|
|
19
|
+
</TableColumn>
|
|
14
20
|
<TableColumn key="b" title="Title 2" />
|
|
15
21
|
</Table>
|
|
16
22
|
```
|
|
@@ -521,58 +521,42 @@ describe('Table', () => {
|
|
|
521
521
|
expect(instance.get('checkedKeys')).to.eql([3, 4, 1, 2]);
|
|
522
522
|
});
|
|
523
523
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
// document.body.appendChild(container);
|
|
563
|
-
// const app = new Vue({
|
|
564
|
-
// render: h => h('Demo'),
|
|
565
|
-
// components: {
|
|
566
|
-
// Demo
|
|
567
|
-
// }
|
|
568
|
-
// }).$mount(container);
|
|
569
|
-
|
|
570
|
-
// // should show the first dropdown menu
|
|
571
|
-
// app.$el.querySelector('.k-icon').click();
|
|
572
|
-
// const dropdownMenu = app.$el.querySelectorAll('.k-dropdown-menu')[0];
|
|
573
|
-
// expect(dropdownMenu.style.display).to.eql('');
|
|
574
|
-
|
|
575
|
-
// app.$destroy();
|
|
576
|
-
// document.body.removeChild(app.$el);
|
|
577
|
-
// });
|
|
524
|
+
it('should update children in TableCell', async() => {
|
|
525
|
+
const update = sinon.spy();
|
|
526
|
+
class Test extends Component {
|
|
527
|
+
static template = `<div>test</div>`;
|
|
528
|
+
beforeUpdate() {
|
|
529
|
+
update();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
class Demo extends Component<{data: any[], checkedKeys: number[]}> {
|
|
533
|
+
static template = `
|
|
534
|
+
const {Table, TableColumn, Test} = this;
|
|
535
|
+
<Table data={this.get('data')} ref="table">
|
|
536
|
+
<TableColumn key="a">
|
|
537
|
+
<b:template>
|
|
538
|
+
<Test />
|
|
539
|
+
</b:template>
|
|
540
|
+
</TableColumn>
|
|
541
|
+
</Table>
|
|
542
|
+
`;
|
|
543
|
+
static defaults() {
|
|
544
|
+
return {
|
|
545
|
+
data: [
|
|
546
|
+
{a: 1},
|
|
547
|
+
{a: 2},
|
|
548
|
+
],
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
private Table = Table;
|
|
552
|
+
private TableColumn = TableColumn;
|
|
553
|
+
private Test = Test;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const [instance, element] = mount(Demo);
|
|
557
|
+
element.querySelector<HTMLElement>('tbody tr')!.click();
|
|
558
|
+
|
|
559
|
+
await wait();
|
|
560
|
+
expect(update.callCount).to.eql(1);
|
|
561
|
+
});
|
|
578
562
|
});
|
|
@@ -202,7 +202,7 @@ export function useChecked(
|
|
|
202
202
|
instance.on('$change:data', updateAllCheckedStatus);
|
|
203
203
|
|
|
204
204
|
instance.on('clickRow', (data: any, index: number, key: TableRowKey) => {
|
|
205
|
-
if (instance.get('rowCheckable')) {
|
|
205
|
+
if (instance.get('rowCheckable') && instance.get('checkType') !== 'none') {
|
|
206
206
|
toggleChecked(key, index);
|
|
207
207
|
}
|
|
208
208
|
});
|
|
@@ -988,56 +988,80 @@ describe('Table', function () {
|
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
}, _callee21);
|
|
991
|
-
})));
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
991
|
+
})));
|
|
992
|
+
it('should update children in TableCell', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
993
|
+
var update, Test, Demo, _mount24, instance, element;
|
|
994
|
+
|
|
995
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context25) {
|
|
996
|
+
while (1) {
|
|
997
|
+
switch (_context25.prev = _context25.next) {
|
|
998
|
+
case 0:
|
|
999
|
+
update = sinon.spy();
|
|
1000
|
+
|
|
1001
|
+
Test = /*#__PURE__*/function (_Component3) {
|
|
1002
|
+
_inheritsLoose(Test, _Component3);
|
|
1003
|
+
|
|
1004
|
+
function Test() {
|
|
1005
|
+
return _Component3.apply(this, arguments) || this;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
var _proto = Test.prototype;
|
|
1009
|
+
|
|
1010
|
+
_proto.beforeUpdate = function beforeUpdate() {
|
|
1011
|
+
update();
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
return Test;
|
|
1015
|
+
}(Component);
|
|
1016
|
+
|
|
1017
|
+
Test.template = "<div>test</div>";
|
|
1018
|
+
|
|
1019
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
1020
|
+
_inheritsLoose(Demo, _Component4);
|
|
1021
|
+
|
|
1022
|
+
function Demo() {
|
|
1023
|
+
var _context24;
|
|
1024
|
+
|
|
1025
|
+
var _this3;
|
|
1026
|
+
|
|
1027
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1028
|
+
args[_key3] = arguments[_key3];
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
_this3 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context24 = [this]).call(_context24, args)) || this;
|
|
1032
|
+
_this3.Table = Table;
|
|
1033
|
+
_this3.TableColumn = TableColumn;
|
|
1034
|
+
_this3.Test = Test;
|
|
1035
|
+
return _this3;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
Demo.defaults = function defaults() {
|
|
1039
|
+
return {
|
|
1040
|
+
data: [{
|
|
1041
|
+
a: 1
|
|
1042
|
+
}, {
|
|
1043
|
+
a: 2
|
|
1044
|
+
}]
|
|
1045
|
+
};
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
return Demo;
|
|
1049
|
+
}(Component);
|
|
1050
|
+
|
|
1051
|
+
Demo.template = "\n const {Table, TableColumn, Test} = this;\n <Table data={this.get('data')} ref=\"table\">\n <TableColumn key=\"a\">\n <b:template>\n <Test />\n </b:template>\n </TableColumn>\n </Table>\n ";
|
|
1052
|
+
_mount24 = mount(Demo), instance = _mount24[0], element = _mount24[1];
|
|
1053
|
+
element.querySelector('tbody tr').click();
|
|
1054
|
+
_context25.next = 9;
|
|
1055
|
+
return wait();
|
|
1056
|
+
|
|
1057
|
+
case 9:
|
|
1058
|
+
expect(update.callCount).to.eql(1);
|
|
1059
|
+
|
|
1060
|
+
case 10:
|
|
1061
|
+
case "end":
|
|
1062
|
+
return _context25.stop();
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}, _callee22);
|
|
1066
|
+
})));
|
|
1043
1067
|
});
|
|
@@ -211,7 +211,7 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
|
|
|
211
211
|
|
|
212
212
|
instance.on('$change:data', updateAllCheckedStatus);
|
|
213
213
|
instance.on('clickRow', function (data, index, key) {
|
|
214
|
-
if (instance.get('rowCheckable')) {
|
|
214
|
+
if (instance.get('rowCheckable') && instance.get('checkType') !== 'none') {
|
|
215
215
|
toggleChecked(key, index);
|
|
216
216
|
}
|
|
217
217
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,4 +57,4 @@ export * from './components/tree';
|
|
|
57
57
|
export * from './components/treeSelect';
|
|
58
58
|
export * from './components/upload';
|
|
59
59
|
export * from './components/wave';
|
|
60
|
-
export declare const version = "2.0.
|
|
60
|
+
export declare const version = "2.0.5";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,5 +59,5 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export var version = '2.0.
|
|
62
|
+
export var version = '2.0.5';
|
|
63
63
|
/* generate end */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { Table, TableColumn } from '@king-design/react';
|
|
4
|
+
import { Table, TableColumn, Select, Option } from '@king-design/react';
|
|
5
5
|
|
|
6
6
|
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
7
7
|
_inheritsLoose(Demo, _React$Component);
|
|
@@ -36,7 +36,13 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
36
36
|
resizable: true
|
|
37
37
|
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
38
38
|
key: "a",
|
|
39
|
-
title: "Title 1"
|
|
39
|
+
title: "Title 1",
|
|
40
|
+
slotTemplate: function slotTemplate(_ref) {
|
|
41
|
+
var data = _ref[0];
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, null, /*#__PURE__*/React.createElement(Option, {
|
|
43
|
+
value: "a"
|
|
44
|
+
}, "test")));
|
|
45
|
+
}
|
|
40
46
|
}), /*#__PURE__*/React.createElement(TableColumn, {
|
|
41
47
|
key: "b",
|
|
42
48
|
title: "Title 2"
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -62,6 +62,6 @@ export * from './components/treeSelect';
|
|
|
62
62
|
export * from './components/upload';
|
|
63
63
|
export * from './components/wave';
|
|
64
64
|
|
|
65
|
-
export const version = '2.0.
|
|
65
|
+
export const version = '2.0.5';
|
|
66
66
|
|
|
67
67
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"prelease-patch": "lerna version prepatch --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
31
31
|
"prelease-minor": "lerna version preminor --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
32
32
|
"prelease-major": "lerna version premajor --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
33
|
-
"upload:resources": "gulp upload:resources"
|
|
33
|
+
"upload:resources": "gulp upload:resources",
|
|
34
|
+
"update:deps": "lerna exec -- yarn"
|
|
34
35
|
},
|
|
35
36
|
"repository": {
|
|
36
37
|
"type": "git",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"highlight.js": "^10.4.1",
|
|
115
116
|
"history": "^5.0.0",
|
|
116
117
|
"html-webpack-plugin": "5.3.1",
|
|
117
|
-
"intact-react": "^3.0.
|
|
118
|
+
"intact-react": "^3.0.6",
|
|
118
119
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
119
120
|
"js-yaml": "^4.1.0",
|
|
120
121
|
"karma": "^6.3.2",
|
|
@@ -176,7 +177,7 @@
|
|
|
176
177
|
"dayjs": "^1.10.7",
|
|
177
178
|
"downloadjs": "^1.4.7",
|
|
178
179
|
"enquire.js": "^2.1.6",
|
|
179
|
-
"intact": "^3.0.
|
|
180
|
+
"intact": "^3.0.6",
|
|
180
181
|
"monaco-editor": "^0.26.1",
|
|
181
182
|
"mxgraphx": "^4.0.7",
|
|
182
183
|
"resize-observer-polyfill": "^1.5.1",
|