@king-design/intact 2.0.13-beta.0 → 2.0.13
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/code/index.md +2 -2
- package/components/code/index.ts +2 -2
- package/components/code/useEditor.ts +1 -1
- package/components/table/demos/animation.md +7 -0
- package/components/table/index.md +1 -0
- package/components/table/row.ts +1 -0
- package/components/table/row.vdt +5 -3
- package/components/table/table.ts +3 -0
- package/components/table/table.vdt +97 -89
- package/components/tooltip/index.ts +1 -1
- package/es/components/code/index.d.ts +2 -2
- package/es/components/code/useEditor.js +1 -1
- package/es/components/table/row.d.ts +1 -0
- package/es/components/table/row.vdt.js +5 -6
- package/es/components/table/table.d.ts +1 -0
- package/es/components/table/table.js +4 -2
- package/es/components/table/table.vdt.js +111 -104
- package/es/components/tooltip/index.d.ts +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/table/demos/animation/react.js +16 -0
- package/index.ts +2 -2
- package/package.json +1 -1
package/components/code/index.md
CHANGED
|
@@ -17,7 +17,7 @@ sidebar: doc
|
|
|
17
17
|
| readOnly | 是否只读 | `boolean` | `false` |
|
|
18
18
|
| width | 指定宽度,需要带单位 | `string` | `100%` |
|
|
19
19
|
| height | 指定高度,需要带单位 | `string` | `100%` |
|
|
20
|
-
| options | 其它可选的配置,会传给`monaco.editor.create()`方法,可选值参考[options](https://microsoft.github.io/monaco-editor/
|
|
20
|
+
| options | 其它可选的配置,会传给`monaco.editor.create()`方法,可选值参考[options](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneEditorConstructionOptions.html) | [`editor.IStandaloneEditorConstructionOptions`](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneEditorConstructionOptions.html) | `{}` |
|
|
21
21
|
|
|
22
22
|
> 例如:通过`options`可以隐藏右侧代码的缩影(minimap): `options = {minimap: {enabled: false}}`
|
|
23
23
|
|
|
@@ -25,4 +25,4 @@ sidebar: doc
|
|
|
25
25
|
|
|
26
26
|
| 事件名 | 说明 | 参数 |
|
|
27
27
|
| --- | --- | --- |
|
|
28
|
-
| ready | 组件加载并实例化完成触发 | (editor: [editor.IStandaloneCodeEditor](https://microsoft.github.io/monaco-editor/
|
|
28
|
+
| ready | 组件加载并实例化完成触发 | (editor: [editor.IStandaloneCodeEditor](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneCodeEditor.html), Editor: typeof [editor](https://microsoft.github.io/monaco-editor/docs.html#modules/editor.html), Monaco: typeof [monaco](https://microsoft.github.io/monaco-editor/docs.html)) => void |
|
package/components/code/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Component, TypeDefs, createRef} from 'intact';
|
|
2
2
|
import template from './index.vdt';
|
|
3
|
-
import type {editor} from 'monaco-editor';
|
|
3
|
+
import type {editor, default as monaco} from 'monaco-editor';
|
|
4
4
|
import {useEditor} from './useEditor';
|
|
5
5
|
import type {Events} from '../types';
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ export interface CodeProps {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface CodeEvents {
|
|
18
|
-
ready: [editor.IStandaloneCodeEditor, typeof editor]
|
|
18
|
+
ready: [editor.IStandaloneCodeEditor, typeof editor, typeof monaco]
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const typeDefs: Required<TypeDefs<CodeProps>> = {
|
|
@@ -5,6 +5,8 @@ order: 20
|
|
|
5
5
|
|
|
6
6
|
一个简单的`Table`,点击按钮,即可查看新增表格的动效。
|
|
7
7
|
|
|
8
|
+
通过`animation`可以禁用动效,取值为`false`时,禁用行和列动画;或者通过数组分别指定禁用行和列动画,如:`[false, true]`,只禁用列动画
|
|
9
|
+
|
|
8
10
|
```vdt
|
|
9
11
|
import {Table, TableColumn, Button} from 'kpc';
|
|
10
12
|
|
|
@@ -21,6 +23,11 @@ import {Table, TableColumn, Button} from 'kpc';
|
|
|
21
23
|
<TableColumn v-if={this.get('isShow')} key="b" title="Title 2"/>
|
|
22
24
|
<TableColumn key="c" title="Title 3" />
|
|
23
25
|
</Table>
|
|
26
|
+
<Table data={this.get('data')} resizable rowKey={row => row.a} animation={false}>
|
|
27
|
+
<TableColumn key="a" title="Title 1" />
|
|
28
|
+
<TableColumn v-if={this.get('isShow')} key="b" title="Title 2"/>
|
|
29
|
+
<TableColumn key="c" title="Title 3" />
|
|
30
|
+
</Table>
|
|
24
31
|
</div>
|
|
25
32
|
```
|
|
26
33
|
|
|
@@ -42,6 +42,7 @@ sidebar: doc
|
|
|
42
42
|
| minColWidth | 指定所有列拖动时的最小宽度 | `number` | `40` |
|
|
43
43
|
| widthStoreKey | 如果要保存表格拖动后的列宽信息,可以通过该属性设置保存到`localStorage`中的`key` | `string` | `undefined` |
|
|
44
44
|
| draggable | 表格行是否可拖动 | `boolean` | `false` |
|
|
45
|
+
| animation | 是否开启动效,默认开启。可以通过`true` `false`全部设置,或者通过数组单独设置行和列的动效 | `boolean` | `[boolean, boolean]` | `true` |
|
|
45
46
|
|
|
46
47
|
```ts
|
|
47
48
|
import {Props} from 'intact';
|
package/components/table/row.ts
CHANGED
package/components/table/row.vdt
CHANGED
|
@@ -3,7 +3,7 @@ import {getClassAndStyleForFixed} from './useFixedColumns';
|
|
|
3
3
|
import {Checkbox} from '../checkbox';
|
|
4
4
|
import {Radio} from '../radio';
|
|
5
5
|
import {TableCell} from './cell';
|
|
6
|
-
import {createElementVNode, className as cx} from 'intact';
|
|
6
|
+
import {createElementVNode, className as cx, createFragment} from 'intact';
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
cols, data, checkType, hasFixedLeft,
|
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
grid, index: rowIndex, indeterminate,
|
|
12
12
|
allDisabled, selected, /* hidden, */spreaded,
|
|
13
13
|
hasChildren, indent, key, offsetMap,
|
|
14
|
-
draggable, draggingKey,
|
|
14
|
+
draggable, draggingKey, animation,
|
|
15
15
|
} = this.get();
|
|
16
16
|
const classNameObj = {
|
|
17
17
|
'k-disabled': disabled,
|
|
@@ -89,7 +89,9 @@ cols.forEach((props, columnIndex) => {
|
|
|
89
89
|
);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
const rows =
|
|
92
|
+
const rows = animation ?
|
|
93
|
+
<TransitionGroup name="k-fade-expand" move={false}>{vNodes}</TransitionGroup> :
|
|
94
|
+
createFragment(vNodes, 8);
|
|
93
95
|
/* const rows = vNodes; */
|
|
94
96
|
|
|
95
97
|
// for performance, no normalize
|
|
@@ -59,6 +59,7 @@ export interface TableProps<
|
|
|
59
59
|
minColWidth?: number
|
|
60
60
|
widthStoreKey?: string
|
|
61
61
|
draggable?: boolean
|
|
62
|
+
animation?: boolean | [boolean, boolean]
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
@@ -116,6 +117,7 @@ const typeDefs: Required<TypeDefs<TableProps<unknown>>> = {
|
|
|
116
117
|
minColWidth: Number,
|
|
117
118
|
widthStoreKey: String,
|
|
118
119
|
draggable: Boolean,
|
|
120
|
+
animation: [Boolean, Array],
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
const defaults = (): Partial<TableProps> => ({
|
|
@@ -126,6 +128,7 @@ const defaults = (): Partial<TableProps> => ({
|
|
|
126
128
|
childrenKey: 'children',
|
|
127
129
|
indent: 32,
|
|
128
130
|
minColWidth: 40,
|
|
131
|
+
animation: true,
|
|
129
132
|
});
|
|
130
133
|
|
|
131
134
|
const events: Events<TableEvents> = {
|
|
@@ -23,8 +23,9 @@ const {
|
|
|
23
23
|
rowClassName, group, sort, loading,
|
|
24
24
|
merge, childrenKey, indent, tooltipPosition,
|
|
25
25
|
tooltipContainer, showIndeterminate, resizable,
|
|
26
|
-
draggable,
|
|
26
|
+
draggable, animation: _animation,
|
|
27
27
|
} = this.get();
|
|
28
|
+
const animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
28
29
|
const {columns, cols, maxRows, maxCols} = this.columns.getData();
|
|
29
30
|
const {scrollPosition, hasFixed, getHasFixedLeft, getOffsetMap} = this.fixedColumns;
|
|
30
31
|
const {scrollRef} = this.scroll;
|
|
@@ -71,23 +72,29 @@ const thead = (
|
|
|
71
72
|
<FixedColumnsContext.Provider value={offsetMap}>
|
|
72
73
|
<thead>
|
|
73
74
|
<tr v-for={columns}>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
{(() => {
|
|
76
|
+
const ths = <template>
|
|
77
|
+
<th v-if={$key === 0 && checkType !== 'none'}
|
|
78
|
+
{...getClassAndStyleForFixed({
|
|
79
|
+
fixed: hasFixedLeft ? 'left' : false,
|
|
80
|
+
}, 0)}
|
|
81
|
+
rowspan={maxRows}
|
|
82
|
+
key="$checktype"
|
|
83
|
+
>
|
|
84
|
+
<Checkbox v-if={checkType === 'checkbox'}
|
|
85
|
+
value={allCheckedStatus === AllCheckedStatus.All}
|
|
86
|
+
indeterminate={showIndeterminate && allCheckedStatus == AllCheckedStatus.Indeterminate}
|
|
87
|
+
ev-$change:value={toggleCheckedAll}
|
|
88
|
+
disabled={!hasData}
|
|
89
|
+
/>
|
|
90
|
+
</th>
|
|
91
|
+
{$value}
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
return animation[1] ?
|
|
95
|
+
<TransitionGroup name="k-fade-expand" move={false}>{ths}</TransitionGroup> :
|
|
96
|
+
ths;
|
|
97
|
+
})()}
|
|
91
98
|
</tr>
|
|
92
99
|
</thead>
|
|
93
100
|
</FixedColumnsContext.Provider>
|
|
@@ -114,84 +121,85 @@ const tbody = (
|
|
|
114
121
|
<b:empty>{_$('/(ㄒoㄒ)/~~ 没有找到亲要的数据哦~')}</b:empty>
|
|
115
122
|
</td>
|
|
116
123
|
</tr> :
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (hidden) return hidden;
|
|
124
|
+
(() => {
|
|
125
|
+
const rows = [];
|
|
126
|
+
loopData((value, index, level, hidden) => {
|
|
127
|
+
// don't render if row is hidden
|
|
128
|
+
if (hidden) return hidden;
|
|
123
129
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
const status = allStatus[index];
|
|
131
|
+
const key = allKeys[index];
|
|
132
|
+
const spreaded = isSpreaded(key);
|
|
133
|
+
const hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
134
|
+
const indentSize = indent ? indent * level : 0;
|
|
129
135
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
136
|
+
let row = <TableRow
|
|
137
|
+
key={key}
|
|
138
|
+
cols={cols}
|
|
139
|
+
data={value}
|
|
140
|
+
checkType={checkType}
|
|
141
|
+
hasFixedLeft={hasFixedLeft}
|
|
142
|
+
onClick={this.clickRow}
|
|
143
|
+
checked={status.checked}
|
|
144
|
+
indeterminate={status.indeterminate}
|
|
145
|
+
index={index}
|
|
146
|
+
disabled={status.disabled}
|
|
147
|
+
allDisabled={status.allDisabled}
|
|
148
|
+
className={rowClassName && rowClassName(value, index, key)}
|
|
149
|
+
merge={merge}
|
|
150
|
+
grid={getGrid()}
|
|
151
|
+
onChangeChecked={onChangeChecked}
|
|
152
|
+
selected={isSelected(key)}
|
|
153
|
+
spreaded={spreaded}
|
|
154
|
+
hasChildren={hasChildren}
|
|
155
|
+
indent={indentSize}
|
|
156
|
+
onToggleSpreadRow={toggleSpreadRow}
|
|
157
|
+
onBeforeUnmount={this.resetRowStatus.onRowBeforeUnmount}
|
|
158
|
+
offsetMap={offsetMap}
|
|
159
|
+
animation={animation[1]}
|
|
153
160
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
draggable={draggable}
|
|
162
|
+
draggingKey={draggingKey.value}
|
|
163
|
+
onRowDragStart={onRowDragStart}
|
|
164
|
+
onRowDragEnd={onRowDragEnd}
|
|
165
|
+
onRowDragOver={onRowDragOver}
|
|
166
|
+
/>
|
|
160
167
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
if ($blocks.tooltip) {
|
|
169
|
+
const content = <b:tooltip params={[value, index]} />;
|
|
170
|
+
row = (
|
|
171
|
+
<Tooltip key={key} position={tooltipPosition} container={tooltipContainer}>
|
|
172
|
+
<template>{row}</template>
|
|
173
|
+
<b:content>{content}</b:content>
|
|
174
|
+
</Tooltip>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
170
177
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
178
|
+
rows.push(row);
|
|
179
|
+
if ($blocks.expand) {
|
|
180
|
+
const expanded = isExpanded(key);
|
|
181
|
+
rows.push(
|
|
182
|
+
<tr class={{"k-expand": true, 'k-expanded': expanded}}
|
|
183
|
+
key={`${key}.$expand`}
|
|
184
|
+
>
|
|
185
|
+
<td colspan={colCount}>
|
|
186
|
+
<Transition {...expandAnimationCallbacks}>
|
|
187
|
+
<div v-if={expanded} class="k-table-expand">
|
|
188
|
+
<b:expand params={[value, index]} />
|
|
189
|
+
</div>
|
|
190
|
+
</Transition>
|
|
191
|
+
</td>
|
|
192
|
+
</tr>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
188
195
|
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
return hidden || !spreaded;
|
|
197
|
+
});
|
|
191
198
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
199
|
+
return animation[0] ?
|
|
200
|
+
<TransitionGroup name="k-fade-in-left" move={!draggingKey.value}>{rows}</TransitionGroup> :
|
|
201
|
+
rows;
|
|
202
|
+
})()
|
|
195
203
|
}
|
|
196
204
|
</tbody>
|
|
197
205
|
);
|
|
@@ -20,7 +20,7 @@ export interface TooltipBlocks extends BaseTooltipBlocks, TooltipContentBlocks {
|
|
|
20
20
|
content: null
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> { }
|
|
23
|
+
export declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> { }
|
|
24
24
|
|
|
25
25
|
function Wrapper(props: Props<TooltipProps, BaseTooltip>) {
|
|
26
26
|
let {children, content, $blocks, ...rest} = props;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact';
|
|
2
|
-
import type { editor } from 'monaco-editor';
|
|
2
|
+
import type { editor, default as monaco } from 'monaco-editor';
|
|
3
3
|
import type { Events } from '../types';
|
|
4
4
|
export interface CodeProps {
|
|
5
5
|
value?: string;
|
|
@@ -11,7 +11,7 @@ export interface CodeProps {
|
|
|
11
11
|
options?: editor.IStandaloneEditorConstructionOptions;
|
|
12
12
|
}
|
|
13
13
|
export interface CodeEvents {
|
|
14
|
-
ready: [editor.IStandaloneCodeEditor, typeof editor];
|
|
14
|
+
ready: [editor.IStandaloneCodeEditor, typeof editor, typeof monaco];
|
|
15
15
|
}
|
|
16
16
|
export declare class Code extends Component<CodeProps, CodeEvents> {
|
|
17
17
|
static template: string | import("intact").Template<any>;
|
|
@@ -23,6 +23,7 @@ export interface TableRowProps {
|
|
|
23
23
|
onToggleSpreadRow: (key: TableRowKey) => void;
|
|
24
24
|
onBeforeUnmount: (key: TableRowKey) => void;
|
|
25
25
|
offsetMap: Record<Key, number>;
|
|
26
|
+
animation: boolean;
|
|
26
27
|
draggable: boolean;
|
|
27
28
|
draggingKey: TableRowKey | null;
|
|
28
29
|
onRowDragStart: DragCallback;
|
|
@@ -5,7 +5,7 @@ import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
|
5
5
|
import { Checkbox } from '../checkbox';
|
|
6
6
|
import { Radio } from '../radio';
|
|
7
7
|
import { TableCell } from './cell';
|
|
8
|
-
import { createElementVNode, className as cx } from 'intact';
|
|
8
|
+
import { createElementVNode, className as cx, createFragment } from 'intact';
|
|
9
9
|
export default function ($props, $blocks, $__proto__) {
|
|
10
10
|
var _classNameObj,
|
|
11
11
|
_this = this;
|
|
@@ -34,7 +34,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
34
34
|
key = _this$get.key,
|
|
35
35
|
offsetMap = _this$get.offsetMap,
|
|
36
36
|
draggable = _this$get.draggable,
|
|
37
|
-
draggingKey = _this$get.draggingKey
|
|
37
|
+
draggingKey = _this$get.draggingKey,
|
|
38
|
+
animation = _this$get.animation;
|
|
38
39
|
|
|
39
40
|
var classNameObj = (_classNameObj = {
|
|
40
41
|
'k-disabled': disabled,
|
|
@@ -110,16 +111,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
110
111
|
'key': columnKey
|
|
111
112
|
}, columnKey));
|
|
112
113
|
});
|
|
113
|
-
|
|
114
|
-
var rows = _$cc(TransitionGroup, {
|
|
114
|
+
var rows = animation ? _$cc(TransitionGroup, {
|
|
115
115
|
'name': 'k-fade-expand',
|
|
116
116
|
'move': false,
|
|
117
117
|
'children': vNodes
|
|
118
|
-
});
|
|
118
|
+
}) : createFragment(vNodes, 8);
|
|
119
119
|
/* const rows = vNodes; */
|
|
120
120
|
// for performance, no normalize
|
|
121
121
|
|
|
122
|
-
|
|
123
122
|
return createElementVNode(2, 'tr', rows, 2, cx(classNameObj), {
|
|
124
123
|
'data-key': key,
|
|
125
124
|
'ev-mouseenter': this.onMouseEnter,
|
|
@@ -34,6 +34,7 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
|
|
|
34
34
|
minColWidth?: number;
|
|
35
35
|
widthStoreKey?: string;
|
|
36
36
|
draggable?: boolean;
|
|
37
|
+
animation?: boolean | [boolean, boolean];
|
|
37
38
|
}
|
|
38
39
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
39
40
|
clickRow: [T, number, K];
|
|
@@ -56,7 +56,8 @@ var typeDefs = {
|
|
|
56
56
|
resizable: Boolean,
|
|
57
57
|
minColWidth: Number,
|
|
58
58
|
widthStoreKey: String,
|
|
59
|
-
draggable: Boolean
|
|
59
|
+
draggable: Boolean,
|
|
60
|
+
animation: [Boolean, Array]
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
var defaults = function defaults() {
|
|
@@ -69,7 +70,8 @@ var defaults = function defaults() {
|
|
|
69
70
|
rowExpandable: true,
|
|
70
71
|
childrenKey: 'children',
|
|
71
72
|
indent: 32,
|
|
72
|
-
minColWidth: 40
|
|
73
|
+
minColWidth: 40,
|
|
74
|
+
animation: true
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
|
|
@@ -57,7 +57,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
57
57
|
tooltipContainer = _this$get.tooltipContainer,
|
|
58
58
|
showIndeterminate = _this$get.showIndeterminate,
|
|
59
59
|
resizable = _this$get.resizable,
|
|
60
|
-
draggable = _this$get.draggable
|
|
60
|
+
draggable = _this$get.draggable,
|
|
61
|
+
_animation = _this$get.animation;
|
|
62
|
+
|
|
63
|
+
var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
61
64
|
|
|
62
65
|
var _this$columns$getData = this.columns.getData(),
|
|
63
66
|
columns = _this$columns$getData.columns,
|
|
@@ -130,10 +133,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
130
133
|
'children': _$cc(FixedColumnsContext.Provider, {
|
|
131
134
|
'value': offsetMap,
|
|
132
135
|
'children': _$ce(2, 'thead', _$ma(columns, function ($value, $key) {
|
|
133
|
-
return _$ce(2, 'tr',
|
|
134
|
-
'
|
|
135
|
-
'move': false,
|
|
136
|
-
'children': [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
|
|
136
|
+
return _$ce(2, 'tr', function () {
|
|
137
|
+
var ths = [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
|
|
137
138
|
fixed: hasFixedLeft ? 'left' : false
|
|
138
139
|
}, 0), {
|
|
139
140
|
'rowspan': maxRows,
|
|
@@ -143,8 +144,13 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
143
144
|
'indeterminate': showIndeterminate && allCheckedStatus == AllCheckedStatus.Indeterminate,
|
|
144
145
|
'ev-$change:value': toggleCheckedAll,
|
|
145
146
|
'disabled': !hasData
|
|
146
|
-
}) : undefined) : undefined, $value]
|
|
147
|
-
|
|
147
|
+
}) : undefined) : undefined, $value];
|
|
148
|
+
return animation[1] ? _$cc(TransitionGroup, {
|
|
149
|
+
'name': 'k-fade-expand',
|
|
150
|
+
'move': false,
|
|
151
|
+
'children': ths
|
|
152
|
+
}) : ths;
|
|
153
|
+
}(), 0);
|
|
148
154
|
}, $this), 4)
|
|
149
155
|
})
|
|
150
156
|
})
|
|
@@ -181,115 +187,116 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
181
187
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
182
188
|
}, __$blocks['empty'](_$no)), 0, 'k-table-empty', {
|
|
183
189
|
'colspan': colCount
|
|
184
|
-
}), 2, null, null, 'table-empty') :
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var spreaded = isSpreaded(key);
|
|
195
|
-
var hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
196
|
-
var indentSize = indent ? indent * level : 0;
|
|
190
|
+
}), 2, null, null, 'table-empty') : function () {
|
|
191
|
+
var rows = [];
|
|
192
|
+
loopData(function (value, index, level, hidden) {
|
|
193
|
+
// don't render if row is hidden
|
|
194
|
+
if (hidden) return hidden;
|
|
195
|
+
var status = allStatus[index];
|
|
196
|
+
var key = allKeys[index];
|
|
197
|
+
var spreaded = isSpreaded(key);
|
|
198
|
+
var hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
199
|
+
var indentSize = indent ? indent * level : 0;
|
|
197
200
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
201
|
+
var row = _$cc(TableRow, {
|
|
202
|
+
'key': key,
|
|
203
|
+
'cols': cols,
|
|
204
|
+
'data': value,
|
|
205
|
+
'checkType': checkType,
|
|
206
|
+
'hasFixedLeft': hasFixedLeft,
|
|
207
|
+
'onClick': _this.clickRow,
|
|
208
|
+
'checked': status.checked,
|
|
209
|
+
'indeterminate': status.indeterminate,
|
|
210
|
+
'index': index,
|
|
211
|
+
'disabled': status.disabled,
|
|
212
|
+
'allDisabled': status.allDisabled,
|
|
213
|
+
'className': _$cn(rowClassName && rowClassName(value, index, key)),
|
|
214
|
+
'merge': merge,
|
|
215
|
+
'grid': getGrid(),
|
|
216
|
+
'onChangeChecked': onChangeChecked,
|
|
217
|
+
'selected': isSelected(key),
|
|
218
|
+
'spreaded': spreaded,
|
|
219
|
+
'hasChildren': hasChildren,
|
|
220
|
+
'indent': indentSize,
|
|
221
|
+
'onToggleSpreadRow': toggleSpreadRow,
|
|
222
|
+
'onBeforeUnmount': _this.resetRowStatus.onRowBeforeUnmount,
|
|
223
|
+
'offsetMap': offsetMap,
|
|
224
|
+
'animation': animation[1],
|
|
225
|
+
'draggable': draggable,
|
|
226
|
+
'draggingKey': draggingKey.value,
|
|
227
|
+
'onRowDragStart': onRowDragStart,
|
|
228
|
+
'onRowDragEnd': onRowDragEnd,
|
|
229
|
+
'onRowDragOver': onRowDragOver
|
|
230
|
+
}, key);
|
|
227
231
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
if ($blocks.tooltip) {
|
|
233
|
+
var content = (_$blocks['tooltip'] = function ($super) {
|
|
234
|
+
return null;
|
|
235
|
+
}, __$blocks['tooltip'] = function ($super, data) {
|
|
236
|
+
var block = $blocks['tooltip'];
|
|
233
237
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
var callBlock = function callBlock() {
|
|
239
|
+
return _$blocks['tooltip'].call($this, $super, data);
|
|
240
|
+
};
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
243
|
+
}, __$blocks['tooltip'](_$no, [value, index]));
|
|
244
|
+
row = _$cc(Tooltip, {
|
|
245
|
+
'key': key,
|
|
246
|
+
'position': tooltipPosition,
|
|
247
|
+
'container': tooltipContainer,
|
|
248
|
+
'children': row,
|
|
249
|
+
'$blocks': function ($blocks) {
|
|
250
|
+
var _$blocks = {},
|
|
251
|
+
__$blocks = _$ex({}, $blocks);
|
|
248
252
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
return (_$blocks['content'] = function ($super) {
|
|
254
|
+
return content;
|
|
255
|
+
}, __$blocks['content'] = function ($super, data) {
|
|
256
|
+
var block = $blocks['content'];
|
|
253
257
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
var callBlock = function callBlock() {
|
|
259
|
+
return _$blocks['content'].call($this, $super, data);
|
|
260
|
+
};
|
|
257
261
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
262
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
263
|
+
}), __$blocks;
|
|
264
|
+
}.call($this, _$em)
|
|
265
|
+
}, key);
|
|
266
|
+
}
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
rows.push(row);
|
|
265
269
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
if ($blocks.expand) {
|
|
271
|
+
var expanded = isExpanded(key);
|
|
272
|
+
rows.push(_$ce(2, 'tr', _$ce(2, 'td', _$cc(Transition, _extends({}, expandAnimationCallbacks, {
|
|
273
|
+
'children': expanded ? _$ce(2, 'div', (_$blocks['expand'] = function ($super) {
|
|
274
|
+
return null;
|
|
275
|
+
}, __$blocks['expand'] = function ($super, data) {
|
|
276
|
+
var block = $blocks['expand'];
|
|
273
277
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
var callBlock = function callBlock() {
|
|
279
|
+
return _$blocks['expand'].call($this, $super, data);
|
|
280
|
+
};
|
|
277
281
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
282
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
283
|
+
}, __$blocks['expand'](_$no, [value, index])), 0, 'k-table-expand') : undefined
|
|
284
|
+
})), 2, null, {
|
|
285
|
+
'colspan': colCount
|
|
286
|
+
}), 2, _$cn({
|
|
287
|
+
"k-expand": true,
|
|
288
|
+
'k-expanded': expanded
|
|
289
|
+
}), null, key + ".$expand"));
|
|
290
|
+
}
|
|
287
291
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
return hidden || !spreaded;
|
|
293
|
+
});
|
|
294
|
+
return animation[0] ? _$cc(TransitionGroup, {
|
|
295
|
+
'name': 'k-fade-in-left',
|
|
296
|
+
'move': !draggingKey.value,
|
|
297
|
+
'children': rows
|
|
298
|
+
}) : rows;
|
|
299
|
+
}(), 0);
|
|
293
300
|
|
|
294
301
|
var tableWidthPx = tableWidth.value ? tableWidth.value + "px" : null;
|
|
295
302
|
var _this$stickyScrollbar = this.stickyScrollbar,
|
|
@@ -8,6 +8,6 @@ export interface TooltipProps extends BaseTooltipProps {
|
|
|
8
8
|
export interface TooltipBlocks extends BaseTooltipBlocks, TooltipContentBlocks {
|
|
9
9
|
content: null;
|
|
10
10
|
}
|
|
11
|
-
declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> {
|
|
11
|
+
export declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> {
|
|
12
12
|
}
|
|
13
13
|
export declare const Tooltip: typeof _Tooltip;
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.13
|
|
2
|
+
* @king-design v2.0.13
|
|
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.13
|
|
60
|
+
export declare const version = "2.0.13";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.13
|
|
2
|
+
* @king-design v2.0.13
|
|
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.13
|
|
62
|
+
export var version = '2.0.13';
|
|
63
63
|
/* generate end */
|
|
@@ -98,6 +98,22 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
98
98
|
}) : undefined, /*#__PURE__*/React.createElement(TableColumn, {
|
|
99
99
|
key: "c",
|
|
100
100
|
title: "Title 3"
|
|
101
|
+
})), /*#__PURE__*/React.createElement(Table, {
|
|
102
|
+
data: this.state.data,
|
|
103
|
+
resizable: true,
|
|
104
|
+
rowKey: function rowKey(row) {
|
|
105
|
+
return row.a;
|
|
106
|
+
},
|
|
107
|
+
animation: false
|
|
108
|
+
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
109
|
+
key: "a",
|
|
110
|
+
title: "Title 1"
|
|
111
|
+
}), this.state.isShow ? /*#__PURE__*/React.createElement(TableColumn, {
|
|
112
|
+
key: "b",
|
|
113
|
+
title: "Title 2"
|
|
114
|
+
}) : undefined, /*#__PURE__*/React.createElement(TableColumn, {
|
|
115
|
+
key: "c",
|
|
116
|
+
title: "Title 3"
|
|
101
117
|
})));
|
|
102
118
|
};
|
|
103
119
|
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.13
|
|
2
|
+
* @king-design v2.0.13
|
|
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.13
|
|
65
|
+
export const version = '2.0.13';
|
|
66
66
|
|
|
67
67
|
/* generate end */
|