feffery_antd_components 0.1.2 → 0.1.3
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/DESCRIPTION +1 -1
- package/Project.toml +1 -1
- package/build/lib/feffery_antd_components/feffery_antd_components.min.js +9 -9
- package/build/lib/feffery_antd_components/package-info.json +2 -2
- package/feffery_antd_components/AntdAlert.py +2 -2
- package/feffery_antd_components/AntdTable.py +8 -4
- package/feffery_antd_components/feffery_antd_components.min.js +8 -8
- package/feffery_antd_components/metadata.json +34 -4
- package/feffery_antd_components/package-info.json +1 -1
- package/package.json +1 -1
- package/src/FefferyAntdComponents.jl +3 -3
- package/src/jl/'feffery'_antdalert.jl +2 -2
- package/src/jl/'feffery'_antdtable.jl +4 -2
- package/src/lib/components/AntdAlert.react.js +19 -11
- package/src/lib/components/AntdTable.react.js +116 -94
- package/usage.py +116 -0
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
},
|
|
115
115
|
"description": {
|
|
116
116
|
"type": {
|
|
117
|
-
"name": "
|
|
117
|
+
"name": "any"
|
|
118
118
|
},
|
|
119
119
|
"required": false,
|
|
120
120
|
"description": ""
|
|
@@ -124,12 +124,12 @@
|
|
|
124
124
|
"name": "union",
|
|
125
125
|
"value": [
|
|
126
126
|
{
|
|
127
|
-
"name": "
|
|
127
|
+
"name": "any"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
"name": "arrayOf",
|
|
131
131
|
"value": {
|
|
132
|
-
"name": "
|
|
132
|
+
"name": "any"
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
]
|
|
@@ -9587,12 +9587,35 @@
|
|
|
9587
9587
|
"type": {
|
|
9588
9588
|
"name": "arrayOf",
|
|
9589
9589
|
"value": {
|
|
9590
|
-
"name": "
|
|
9590
|
+
"name": "union",
|
|
9591
|
+
"value": [
|
|
9592
|
+
{
|
|
9593
|
+
"name": "string"
|
|
9594
|
+
},
|
|
9595
|
+
{
|
|
9596
|
+
"name": "number"
|
|
9597
|
+
}
|
|
9598
|
+
]
|
|
9591
9599
|
}
|
|
9592
9600
|
},
|
|
9593
9601
|
"required": false,
|
|
9594
9602
|
"description": ""
|
|
9595
9603
|
},
|
|
9604
|
+
"rowSelectionWidth": {
|
|
9605
|
+
"type": {
|
|
9606
|
+
"name": "union",
|
|
9607
|
+
"value": [
|
|
9608
|
+
{
|
|
9609
|
+
"name": "string"
|
|
9610
|
+
},
|
|
9611
|
+
{
|
|
9612
|
+
"name": "number"
|
|
9613
|
+
}
|
|
9614
|
+
]
|
|
9615
|
+
},
|
|
9616
|
+
"required": false,
|
|
9617
|
+
"description": ""
|
|
9618
|
+
},
|
|
9596
9619
|
"selectedRows": {
|
|
9597
9620
|
"type": {
|
|
9598
9621
|
"name": "array"
|
|
@@ -9600,6 +9623,13 @@
|
|
|
9600
9623
|
"required": false,
|
|
9601
9624
|
"description": ""
|
|
9602
9625
|
},
|
|
9626
|
+
"sticky": {
|
|
9627
|
+
"type": {
|
|
9628
|
+
"name": "bool"
|
|
9629
|
+
},
|
|
9630
|
+
"required": false,
|
|
9631
|
+
"description": ""
|
|
9632
|
+
},
|
|
9603
9633
|
"enableHoverListen": {
|
|
9604
9634
|
"type": {
|
|
9605
9635
|
"name": "bool"
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ module FefferyAntdComponents
|
|
|
3
3
|
using Dash
|
|
4
4
|
|
|
5
5
|
const resources_path = realpath(joinpath( @__DIR__, "..", "deps"))
|
|
6
|
-
const version = "0.1.
|
|
6
|
+
const version = "0.1.3"
|
|
7
7
|
|
|
8
8
|
include("jl/'feffery'_antdaffix.jl")
|
|
9
9
|
include("jl/'feffery'_antdalert.jl")
|
|
@@ -92,14 +92,14 @@ function __init__()
|
|
|
92
92
|
[
|
|
93
93
|
DashBase.Resource(
|
|
94
94
|
relative_package_path = "feffery_antd_components.min.js",
|
|
95
|
-
external_url = "https://unpkg.com/feffery_antd_components@0.1.
|
|
95
|
+
external_url = "https://unpkg.com/feffery_antd_components@0.1.3/feffery_antd_components/feffery_antd_components.min.js",
|
|
96
96
|
dynamic = nothing,
|
|
97
97
|
async = nothing,
|
|
98
98
|
type = :js
|
|
99
99
|
),
|
|
100
100
|
DashBase.Resource(
|
|
101
101
|
relative_package_path = "feffery_antd_components.min.js.map",
|
|
102
|
-
external_url = "https://unpkg.com/feffery_antd_components@0.1.
|
|
102
|
+
external_url = "https://unpkg.com/feffery_antd_components@0.1.3/feffery_antd_components/feffery_antd_components.min.js.map",
|
|
103
103
|
dynamic = true,
|
|
104
104
|
async = nothing,
|
|
105
105
|
type = :js
|
|
@@ -11,13 +11,13 @@ Keyword arguments:
|
|
|
11
11
|
- `id` (String; optional)
|
|
12
12
|
- `className` (String; optional)
|
|
13
13
|
- `closable` (Bool; optional)
|
|
14
|
-
- `description` (String; optional)
|
|
14
|
+
- `description` (Bool | Real | String | Dict | Array; optional)
|
|
15
15
|
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
16
16
|
Those elements have the following types:
|
|
17
17
|
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
18
18
|
- `prop_name` (String; optional): Holds which property is loading
|
|
19
19
|
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
20
|
-
- `message` (String | Array of
|
|
20
|
+
- `message` (Bool | Real | String | Dict | Array | Array of Bool | Real | String | Dict | Arrays; optional)
|
|
21
21
|
- `messageRenderMode` (a value equal to: 'default', 'loop-text', 'marquee'; optional)
|
|
22
22
|
- `showIcon` (Bool; optional)
|
|
23
23
|
- `style` (Dict; optional)
|
|
@@ -69,7 +69,8 @@ Those elements have the following types:
|
|
|
69
69
|
- `recentlyMouseEnterColumn` (String; optional)
|
|
70
70
|
- `recentlyMouseEnterRow` (String | Real; optional)
|
|
71
71
|
- `rowSelectionType` (a value equal to: 'checkbox', 'radio'; optional)
|
|
72
|
-
- `
|
|
72
|
+
- `rowSelectionWidth` (String | Real; optional)
|
|
73
|
+
- `selectedRowKeys` (Array of String | Reals; optional)
|
|
73
74
|
- `selectedRows` (Array; optional)
|
|
74
75
|
- `size` (a value equal to: 'small', 'default', 'large'; optional)
|
|
75
76
|
- `sortOptions` (optional): . sortOptions has the following type: lists containing elements 'sortDataIndexes', 'multiple'.
|
|
@@ -80,11 +81,12 @@ Those elements have the following types:
|
|
|
80
81
|
Those elements have the following types:
|
|
81
82
|
- `columns` (Array of Strings; optional)
|
|
82
83
|
- `orders` (Array of a value equal to: 'ascend', 'descend's; optional)
|
|
84
|
+
- `sticky` (Bool; optional)
|
|
83
85
|
- `style` (Dict; optional)
|
|
84
86
|
- `titlePopoverInfo` (Dict; optional)
|
|
85
87
|
"""
|
|
86
88
|
function 'feffery'_antdtable(; kwargs...)
|
|
87
|
-
available_props = Symbol[:id, :bordered, :className, :clickedContent, :columns, :columnsFormatConstraint, :containerId, :currentData, :data, :enableHoverListen, :filter, :filterOptions, :loading_state, :locale, :maxHeight, :mode, :nClicksButton, :pagination, :recentlyButtonClickedRow, :recentlyChangedRow, :recentlyMouseEnterColumn, :recentlyMouseEnterRow, :rowSelectionType, :selectedRowKeys, :selectedRows, :size, :sortOptions, :sorter, :style, :titlePopoverInfo]
|
|
89
|
+
available_props = Symbol[:id, :bordered, :className, :clickedContent, :columns, :columnsFormatConstraint, :containerId, :currentData, :data, :enableHoverListen, :filter, :filterOptions, :loading_state, :locale, :maxHeight, :mode, :nClicksButton, :pagination, :recentlyButtonClickedRow, :recentlyChangedRow, :recentlyMouseEnterColumn, :recentlyMouseEnterRow, :rowSelectionType, :rowSelectionWidth, :selectedRowKeys, :selectedRows, :size, :sortOptions, :sorter, :sticky, :style, :titlePopoverInfo]
|
|
88
90
|
wild_props = Symbol[]
|
|
89
91
|
return Component("'feffery'_antdtable", "AntdTable", "feffery_antd_components", available_props, wild_props; kwargs...)
|
|
90
92
|
end
|
|
@@ -2,6 +2,8 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import TextLoop from 'react-text-loop'
|
|
4
4
|
import { Alert } from 'antd';
|
|
5
|
+
import { omit } from "ramda";
|
|
6
|
+
import { renderDashComponents } from "dash-extensions-js";
|
|
5
7
|
import Marquee from 'react-fast-marquee';
|
|
6
8
|
import 'antd/dist/antd.css';
|
|
7
9
|
|
|
@@ -13,8 +15,6 @@ export default class AntdAlert extends Component {
|
|
|
13
15
|
id,
|
|
14
16
|
className,
|
|
15
17
|
style,
|
|
16
|
-
description,
|
|
17
|
-
message,
|
|
18
18
|
type,
|
|
19
19
|
showIcon,
|
|
20
20
|
closable,
|
|
@@ -23,18 +23,25 @@ export default class AntdAlert extends Component {
|
|
|
23
23
|
loading_state
|
|
24
24
|
} = this.props;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// 解析非children参数传入的其他组件数组
|
|
27
|
+
let nProps = omit(
|
|
28
|
+
["setProps", "children", "loading_state", "className"],
|
|
29
|
+
this.props
|
|
30
|
+
);
|
|
31
|
+
nProps = renderDashComponents(nProps, ["message", "description"]);
|
|
32
|
+
|
|
33
|
+
if (messageRenderMode === 'loop-text' && Array.isArray(nProps.message)) {
|
|
27
34
|
return (
|
|
28
35
|
<Alert id={id}
|
|
29
36
|
className={className}
|
|
30
37
|
style={style}
|
|
31
38
|
message={
|
|
32
39
|
<TextLoop mask>
|
|
33
|
-
{message.map(item => <div>{item}</div>)}
|
|
40
|
+
{nProps.message.map(item => <div>{item}</div>)}
|
|
34
41
|
</TextLoop>
|
|
35
42
|
}
|
|
36
43
|
type={type}
|
|
37
|
-
description={description}
|
|
44
|
+
description={nProps.description}
|
|
38
45
|
showIcon={showIcon}
|
|
39
46
|
closable={closable}
|
|
40
47
|
data-dash-is-loading={
|
|
@@ -51,12 +58,12 @@ export default class AntdAlert extends Component {
|
|
|
51
58
|
message={
|
|
52
59
|
messageRenderMode === 'marquee' ?
|
|
53
60
|
<Marquee pauseOnHover gradient={false}>
|
|
54
|
-
{message}
|
|
61
|
+
{nProps.message}
|
|
55
62
|
</Marquee> :
|
|
56
|
-
message
|
|
63
|
+
nProps.message
|
|
57
64
|
}
|
|
58
65
|
type={type}
|
|
59
|
-
description={description}
|
|
66
|
+
description={nProps.description}
|
|
60
67
|
showIcon={showIcon}
|
|
61
68
|
closable={closable}>
|
|
62
69
|
</Alert>
|
|
@@ -66,6 +73,7 @@ export default class AntdAlert extends Component {
|
|
|
66
73
|
|
|
67
74
|
// 定义参数或属性
|
|
68
75
|
AntdAlert.propTypes = {
|
|
76
|
+
|
|
69
77
|
// 组件id
|
|
70
78
|
id: PropTypes.string,
|
|
71
79
|
|
|
@@ -76,12 +84,12 @@ AntdAlert.propTypes = {
|
|
|
76
84
|
style: PropTypes.object,
|
|
77
85
|
|
|
78
86
|
// 设置警告组件内的额外信息元素
|
|
79
|
-
description: PropTypes.
|
|
87
|
+
description: PropTypes.any,
|
|
80
88
|
|
|
81
89
|
// 设置显示的文字信息
|
|
82
90
|
message: PropTypes.oneOfType([
|
|
83
|
-
PropTypes.
|
|
84
|
-
PropTypes.arrayOf(PropTypes.
|
|
91
|
+
PropTypes.any,
|
|
92
|
+
PropTypes.arrayOf(PropTypes.any)
|
|
85
93
|
]),
|
|
86
94
|
|
|
87
95
|
// 设置提示类型,可选的有'success'、'info'、'warning'和'error'四种
|
|
@@ -153,61 +153,6 @@ export default class AntdTable extends Component {
|
|
|
153
153
|
|
|
154
154
|
render() {
|
|
155
155
|
|
|
156
|
-
// 取得必要属性或参数
|
|
157
|
-
let {
|
|
158
|
-
id,
|
|
159
|
-
className,
|
|
160
|
-
style,
|
|
161
|
-
locale,
|
|
162
|
-
containerId,
|
|
163
|
-
setProps,
|
|
164
|
-
columns,
|
|
165
|
-
rowSelectionType,
|
|
166
|
-
titlePopoverInfo,
|
|
167
|
-
columnsFormatConstraint,
|
|
168
|
-
enableHoverListen,
|
|
169
|
-
data,
|
|
170
|
-
sortOptions,
|
|
171
|
-
filterOptions,
|
|
172
|
-
pagination,
|
|
173
|
-
bordered,
|
|
174
|
-
maxHeight,
|
|
175
|
-
size,
|
|
176
|
-
mode,
|
|
177
|
-
nClicksButton,
|
|
178
|
-
loading_state
|
|
179
|
-
} = this.props;
|
|
180
|
-
|
|
181
|
-
let size2size = new Map([
|
|
182
|
-
['small', 'default'],
|
|
183
|
-
['default', 'small'],
|
|
184
|
-
['large', 'middle']
|
|
185
|
-
])
|
|
186
|
-
|
|
187
|
-
pagination = {
|
|
188
|
-
...pagination,
|
|
189
|
-
...{
|
|
190
|
-
showTotalPrefix: pagination?.showTotalPrefix ? pagination?.showTotalPrefix : '共 ',
|
|
191
|
-
showTotalSuffix: pagination?.showTotalSuffix ? pagination?.showTotalSuffix : ' 条记录',
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// 为columns添加默认属性
|
|
196
|
-
for (let i in columns) {
|
|
197
|
-
|
|
198
|
-
columns[i] = {
|
|
199
|
-
...{ align: 'center' },
|
|
200
|
-
...columns[i]
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 当未设置行key时,自动以自增1作为key
|
|
205
|
-
for (let i in data) {
|
|
206
|
-
if (!data[i].hasOwnProperty('key')) {
|
|
207
|
-
data[i]['key'] = i.toString()
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
156
|
// 自定义可编辑单元格
|
|
212
157
|
const EditableContext = React.createContext(null);
|
|
213
158
|
|
|
@@ -325,6 +270,84 @@ export default class AntdTable extends Component {
|
|
|
325
270
|
return <td {...restProps}>{childNode}</td>;
|
|
326
271
|
};
|
|
327
272
|
|
|
273
|
+
// 配置自定义组件
|
|
274
|
+
const components = {
|
|
275
|
+
body: {
|
|
276
|
+
row: EditableRow,
|
|
277
|
+
cell: EditableCell,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// 数值比较函数
|
|
282
|
+
const compareNumeric = (x, y) => {
|
|
283
|
+
if (x.value < y.value) {
|
|
284
|
+
return -1;
|
|
285
|
+
} else if (x.value > y.value) {
|
|
286
|
+
return 1;
|
|
287
|
+
} else {
|
|
288
|
+
return 0;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// 取得必要属性或参数
|
|
293
|
+
let {
|
|
294
|
+
id,
|
|
295
|
+
className,
|
|
296
|
+
style,
|
|
297
|
+
locale,
|
|
298
|
+
containerId,
|
|
299
|
+
setProps,
|
|
300
|
+
columns,
|
|
301
|
+
rowSelectionType,
|
|
302
|
+
selectedRowKeys,
|
|
303
|
+
rowSelectionWidth,
|
|
304
|
+
sticky,
|
|
305
|
+
titlePopoverInfo,
|
|
306
|
+
columnsFormatConstraint,
|
|
307
|
+
enableHoverListen,
|
|
308
|
+
data,
|
|
309
|
+
sortOptions,
|
|
310
|
+
filterOptions,
|
|
311
|
+
pagination,
|
|
312
|
+
bordered,
|
|
313
|
+
maxHeight,
|
|
314
|
+
size,
|
|
315
|
+
mode,
|
|
316
|
+
nClicksButton,
|
|
317
|
+
loading_state
|
|
318
|
+
} = this.props;
|
|
319
|
+
|
|
320
|
+
// 重新映射size到符合常识的顺序
|
|
321
|
+
let size2size = new Map([
|
|
322
|
+
['small', 'default'],
|
|
323
|
+
['default', 'small'],
|
|
324
|
+
['large', 'middle']
|
|
325
|
+
])
|
|
326
|
+
|
|
327
|
+
pagination = {
|
|
328
|
+
...pagination,
|
|
329
|
+
...{
|
|
330
|
+
showTotalPrefix: pagination?.showTotalPrefix ? pagination?.showTotalPrefix : '共 ',
|
|
331
|
+
showTotalSuffix: pagination?.showTotalSuffix ? pagination?.showTotalSuffix : ' 条记录',
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 当未设置行key时,自动以自增1作为key
|
|
336
|
+
for (let i in data) {
|
|
337
|
+
if (!data[i].hasOwnProperty('key')) {
|
|
338
|
+
data[i]['key'] = i.toString()
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// 为columns添加默认属性
|
|
343
|
+
for (let i in columns) {
|
|
344
|
+
|
|
345
|
+
columns[i] = {
|
|
346
|
+
...{ align: 'center' },
|
|
347
|
+
...columns[i]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
328
351
|
// 处理可编辑特性
|
|
329
352
|
columns = columns.map((col) => {
|
|
330
353
|
if (!col.editable) {
|
|
@@ -344,17 +367,6 @@ export default class AntdTable extends Component {
|
|
|
344
367
|
|
|
345
368
|
// 处理可筛选特性
|
|
346
369
|
|
|
347
|
-
// 数值比较比较函数
|
|
348
|
-
const compareNumeric = (x, y) => {
|
|
349
|
-
if (x.value < y.value) {
|
|
350
|
-
return -1;
|
|
351
|
-
} else if (x.value > y.value) {
|
|
352
|
-
return 1;
|
|
353
|
-
} else {
|
|
354
|
-
return 0;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
370
|
// 若为前端渲染模式,在filterOptions中每个字段filterCustomItems缺失的情况下
|
|
359
371
|
// 则会自动根据前端一次性灌入的数据推算出所有添加过滤器字段的唯一值集合作为待选菜单
|
|
360
372
|
if (mode !== 'server-side') {
|
|
@@ -756,13 +768,6 @@ export default class AntdTable extends Component {
|
|
|
756
768
|
}
|
|
757
769
|
}
|
|
758
770
|
|
|
759
|
-
// 配置自定义组件
|
|
760
|
-
const components = {
|
|
761
|
-
body: {
|
|
762
|
-
row: EditableRow,
|
|
763
|
-
cell: EditableCell,
|
|
764
|
-
},
|
|
765
|
-
};
|
|
766
771
|
|
|
767
772
|
// 处理columns.title的增广功能设置
|
|
768
773
|
if (titlePopoverInfo) {
|
|
@@ -802,12 +807,33 @@ export default class AntdTable extends Component {
|
|
|
802
807
|
}
|
|
803
808
|
}
|
|
804
809
|
|
|
810
|
+
// 添加表头单元格监听事件
|
|
811
|
+
if (enableHoverListen) {
|
|
812
|
+
columns = columns.map(
|
|
813
|
+
item => (
|
|
814
|
+
{
|
|
815
|
+
...item,
|
|
816
|
+
...{
|
|
817
|
+
onHeaderCell: (e) => {
|
|
818
|
+
return {
|
|
819
|
+
onMouseEnter: event => { setProps({ recentlyMouseEnterColumn: e.dataIndex }) }, // 鼠标移入字段名
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
)
|
|
826
|
+
}
|
|
827
|
+
|
|
805
828
|
let rowSelection
|
|
806
829
|
// 处理行选择功能设置
|
|
807
830
|
if (rowSelectionType) {
|
|
808
831
|
|
|
809
832
|
rowSelection = {
|
|
833
|
+
columnWidth: rowSelectionWidth,
|
|
834
|
+
fixed: true,
|
|
810
835
|
type: rowSelectionType,
|
|
836
|
+
selectedRowKeys: selectedRowKeys,
|
|
811
837
|
selections: [
|
|
812
838
|
Table.SELECTION_ALL,
|
|
813
839
|
Table.SELECTION_INVERT,
|
|
@@ -822,25 +848,6 @@ export default class AntdTable extends Component {
|
|
|
822
848
|
}
|
|
823
849
|
}
|
|
824
850
|
|
|
825
|
-
// 添加表头单元格监听事件
|
|
826
|
-
if (enableHoverListen) {
|
|
827
|
-
columns = columns.map(
|
|
828
|
-
item => (
|
|
829
|
-
{
|
|
830
|
-
...item,
|
|
831
|
-
...{
|
|
832
|
-
onHeaderCell: (e) => {
|
|
833
|
-
return {
|
|
834
|
-
onMouseEnter: event => { setProps({ recentlyMouseEnterColumn: e.dataIndex }) }, // 鼠标移入字段名
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
)
|
|
840
|
-
)
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
|
|
844
851
|
return (
|
|
845
852
|
<ConfigProvider locale={str2Locale.get(locale)}>
|
|
846
853
|
<Table
|
|
@@ -853,6 +860,7 @@ export default class AntdTable extends Component {
|
|
|
853
860
|
columns={columns}
|
|
854
861
|
size={size2size.get(size)}
|
|
855
862
|
rowSelection={rowSelection}
|
|
863
|
+
sticky={sticky}
|
|
856
864
|
pagination={{ ...pagination, ...{ showTotal: total => `${pagination.showTotalPrefix}${total}${pagination.showTotalSuffix}` } }}
|
|
857
865
|
bordered={bordered}
|
|
858
866
|
scroll={{
|
|
@@ -870,7 +878,7 @@ export default class AntdTable extends Component {
|
|
|
870
878
|
data-dash-is-loading={
|
|
871
879
|
(loading_state && loading_state.is_loading) || undefined
|
|
872
880
|
}
|
|
873
|
-
getPopupContainer={containerId ? () => document.getElementById(containerId) : undefined}
|
|
881
|
+
getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}
|
|
874
882
|
/>
|
|
875
883
|
</ConfigProvider>
|
|
876
884
|
);
|
|
@@ -960,11 +968,25 @@ AntdTable.propTypes = {
|
|
|
960
968
|
rowSelectionType: PropTypes.oneOf(['checkbox', 'radio']),
|
|
961
969
|
|
|
962
970
|
// 记录已被选择的行key值数组
|
|
963
|
-
selectedRowKeys: PropTypes.arrayOf(
|
|
971
|
+
selectedRowKeys: PropTypes.arrayOf(
|
|
972
|
+
PropTypes.oneOfType([
|
|
973
|
+
PropTypes.string,
|
|
974
|
+
PropTypes.number
|
|
975
|
+
])
|
|
976
|
+
),
|
|
977
|
+
|
|
978
|
+
// 设置行选择框宽度,默认为'32px'
|
|
979
|
+
rowSelectionWidth: PropTypes.oneOfType([
|
|
980
|
+
PropTypes.string,
|
|
981
|
+
PropTypes.number
|
|
982
|
+
]),
|
|
964
983
|
|
|
965
984
|
// 记录已被选择的行记录值列表
|
|
966
985
|
selectedRows: PropTypes.array,
|
|
967
986
|
|
|
987
|
+
// 设置是否开启粘性头部,默认为false
|
|
988
|
+
sticky: PropTypes.bool,
|
|
989
|
+
|
|
968
990
|
// 设置是否启用行悬浮事件监听(此功能可能会干扰其他正常表格功能,慎用),默认为false
|
|
969
991
|
enableHoverListen: PropTypes.bool,
|
|
970
992
|
|
package/usage.py
CHANGED
|
@@ -8,7 +8,123 @@ app = dash.Dash(__name__)
|
|
|
8
8
|
|
|
9
9
|
app.layout = html.Div(
|
|
10
10
|
[
|
|
11
|
+
fac.AntdTable(
|
|
12
|
+
selectedRowKeys=['2', '4'],
|
|
13
|
+
rowSelectionWidth='5rem',
|
|
14
|
+
columns=[
|
|
15
|
+
{
|
|
16
|
+
'title': '默认的checkbox模式',
|
|
17
|
+
'dataIndex': f'默认的checkbox模式',
|
|
18
|
+
'width': 400
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
'title': '自定义选项的checkbox模式',
|
|
22
|
+
'dataIndex': '自定义选项的checkbox模式',
|
|
23
|
+
'width': 400
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
'title': 'keyword模式',
|
|
27
|
+
'dataIndex': 'keyword模式',
|
|
28
|
+
'width': 400
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
containerId='docs-content',
|
|
32
|
+
sticky=True,
|
|
33
|
+
pagination={
|
|
34
|
+
'pageSize': 100
|
|
35
|
+
},
|
|
36
|
+
data=[
|
|
37
|
+
{
|
|
38
|
+
'默认的checkbox模式': i,
|
|
39
|
+
'自定义选项的checkbox模式': i,
|
|
40
|
+
'keyword模式': i
|
|
41
|
+
}
|
|
42
|
+
for i in range(500)
|
|
43
|
+
],
|
|
44
|
+
filterOptions={
|
|
45
|
+
'默认的checkbox模式': {
|
|
46
|
+
'filterMode': 'keyword'
|
|
47
|
+
},
|
|
48
|
+
'自定义选项的checkbox模式': {
|
|
49
|
+
'filterMode': 'keyword'
|
|
50
|
+
},
|
|
51
|
+
'keyword模式': {
|
|
52
|
+
'filterMode': 'keyword'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
rowSelectionType='checkbox',
|
|
56
|
+
style={
|
|
57
|
+
'width': '600px'
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
|
|
61
|
+
html.Div(
|
|
62
|
+
[
|
|
63
|
+
fac.AntdAlert(
|
|
64
|
+
description='好样的',
|
|
65
|
+
message=[
|
|
66
|
+
html.Div(
|
|
67
|
+
[
|
|
68
|
+
fac.AntdText(
|
|
69
|
+
'这是一段测试文字,'
|
|
70
|
+
),
|
|
71
|
+
fac.AntdText(
|
|
72
|
+
'加粗',
|
|
73
|
+
strong=True
|
|
74
|
+
),
|
|
75
|
+
html.A(
|
|
76
|
+
'链接',
|
|
77
|
+
href='/'
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
],
|
|
82
|
+
showIcon=True
|
|
83
|
+
)
|
|
84
|
+
]
|
|
85
|
+
),
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
html.Div(
|
|
89
|
+
[
|
|
90
|
+
fac.AntdAlert(
|
|
91
|
+
description='这是一段辅助说明文字',
|
|
92
|
+
message=[
|
|
93
|
+
'君不见黄河之水天上来',
|
|
94
|
+
'奔流到海不复回',
|
|
95
|
+
'君不见高堂明镜悲白发',
|
|
96
|
+
'朝如青丝暮成雪',
|
|
97
|
+
'人生得意须尽欢',
|
|
98
|
+
'莫使金樽空对月',
|
|
99
|
+
'天生我材必有用',
|
|
100
|
+
'千金散尽还复来'
|
|
101
|
+
],
|
|
102
|
+
showIcon=True,
|
|
103
|
+
messageRenderMode='loop-text'
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
),
|
|
11
107
|
|
|
108
|
+
html.Div(
|
|
109
|
+
[
|
|
110
|
+
fac.AntdAlert(
|
|
111
|
+
'这是一段辅助说明文字',
|
|
112
|
+
message=','.join([
|
|
113
|
+
'君不见黄河之水天上来',
|
|
114
|
+
'奔流到海不复回',
|
|
115
|
+
'君不见高堂明镜悲白发',
|
|
116
|
+
'朝如青丝暮成雪',
|
|
117
|
+
'人生得意须尽欢',
|
|
118
|
+
'莫使金樽空对月',
|
|
119
|
+
'天生我材必有用',
|
|
120
|
+
'千金散尽还复来'
|
|
121
|
+
]) + '。',
|
|
122
|
+
description='这是跑马灯模式示例',
|
|
123
|
+
showIcon=True,
|
|
124
|
+
messageRenderMode='marquee'
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
),
|
|
12
128
|
|
|
13
129
|
fac.AntdRadioGroup(
|
|
14
130
|
options=[
|