feffery_antd_components 0.3.0-b0 → 0.3.0-b2
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/NAMESPACE +1 -0
- package/Project.toml +1 -1
- package/build/lib/feffery_antd_components/AntdDraggablePanel.py +121 -0
- package/build/lib/feffery_antd_components/AntdDropdown.py +15 -6
- package/build/lib/feffery_antd_components/_imports_.py +2 -0
- package/build/lib/feffery_antd_components/alias.py +2 -0
- package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
- package/build/lib/feffery_antd_components/async-data_display.js +12 -12
- package/build/lib/feffery_antd_components/async-data_entry.js +8 -8
- package/build/lib/feffery_antd_components/async-upload.js +2 -2
- package/build/lib/feffery_antd_components/feffery_antd_components.min.js +22 -22
- package/build/lib/feffery_antd_components/metadata.json +309 -0
- package/build/lib/feffery_antd_components/package-info.json +3 -2
- package/feffery_antd_components/AntdDraggablePanel.py +121 -0
- package/feffery_antd_components/AntdDropdown.py +15 -6
- package/feffery_antd_components/_imports_.py +2 -0
- package/feffery_antd_components/alias.py +2 -0
- package/feffery_antd_components/async-antd_table.js +1 -1
- package/feffery_antd_components/async-data_display.js +12 -12
- package/feffery_antd_components/async-data_entry.js +8 -8
- package/feffery_antd_components/async-upload.js +2 -2
- package/feffery_antd_components/feffery_antd_components.min.js +22 -22
- package/feffery_antd_components/metadata.json +309 -0
- package/feffery_antd_components/package-info.json +3 -2
- package/package.json +3 -2
- package/src/jl/'feffery'_antddraggablepanel.jl +62 -0
- package/src/jl/'feffery'_antddropdown.jl +10 -1
- package/src/lib/components/dataDisplay/AntdDraggablePanel.react.js +174 -0
- package/src/lib/components/feedback/AntdNotification.react.js +7 -6
- package/src/lib/components/navigation/AntdDropdown.react.js +47 -10
- package/src/lib/components/other/AntdConfigProvider.js +3 -1
- package/src/lib/fragments/AntdTable.react.js +67 -65
- package/src/lib/fragments/dataDisplay/AntdDraggablePanel.react.js +62 -0
- package/src/lib/index.js +3 -1
- package/usage.py +50 -26
|
@@ -14,8 +14,11 @@ const AntdDropdown = (props) => {
|
|
|
14
14
|
// 取得必要属性或参数
|
|
15
15
|
let {
|
|
16
16
|
id,
|
|
17
|
+
children,
|
|
17
18
|
className,
|
|
18
19
|
style,
|
|
20
|
+
wrapperStyle,
|
|
21
|
+
wrapperClassName,
|
|
19
22
|
key,
|
|
20
23
|
title,
|
|
21
24
|
buttonMode,
|
|
@@ -159,16 +162,32 @@ const AntdDropdown = (props) => {
|
|
|
159
162
|
/>
|
|
160
163
|
) :
|
|
161
164
|
(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
165
|
+
children ?
|
|
166
|
+
(
|
|
167
|
+
<div className={
|
|
168
|
+
isString(wrapperClassName) ?
|
|
169
|
+
wrapperClassName :
|
|
170
|
+
(wrapperClassName ? useCss(wrapperClassName) : undefined)
|
|
171
|
+
}
|
|
172
|
+
style={{
|
|
173
|
+
display: 'inline-block',
|
|
174
|
+
...wrapperStyle
|
|
175
|
+
}}>
|
|
176
|
+
{children}
|
|
177
|
+
</div>
|
|
178
|
+
) :
|
|
179
|
+
(
|
|
180
|
+
buttonMode ?
|
|
181
|
+
<Button
|
|
182
|
+
{...buttonProps}
|
|
183
|
+
>
|
|
184
|
+
{title} <DownOutlined />
|
|
185
|
+
</Button>
|
|
186
|
+
:
|
|
187
|
+
<Link onClick={e => e.preventDefault()}>
|
|
188
|
+
{title} <DownOutlined />
|
|
189
|
+
</Link>
|
|
190
|
+
)
|
|
172
191
|
)
|
|
173
192
|
}
|
|
174
193
|
</Dropdown>
|
|
@@ -180,6 +199,11 @@ AntdDropdown.propTypes = {
|
|
|
180
199
|
// 组件id
|
|
181
200
|
id: PropTypes.string,
|
|
182
201
|
|
|
202
|
+
/**
|
|
203
|
+
* 自定义下拉菜单锚定的自定义元素,优先级最高
|
|
204
|
+
*/
|
|
205
|
+
children: PropTypes.node,
|
|
206
|
+
|
|
183
207
|
// css类名
|
|
184
208
|
className: PropTypes.oneOfType([
|
|
185
209
|
PropTypes.string,
|
|
@@ -189,6 +213,19 @@ AntdDropdown.propTypes = {
|
|
|
189
213
|
// 自定义css字典
|
|
190
214
|
style: PropTypes.object,
|
|
191
215
|
|
|
216
|
+
/**
|
|
217
|
+
* 针对自定义锚定元素的父容器设置css样式
|
|
218
|
+
*/
|
|
219
|
+
wrapperStyle: PropTypes.object,
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* 针对自定义锚定元素的父容器设置css类名
|
|
223
|
+
*/
|
|
224
|
+
wrapperClassName: PropTypes.oneOfType([
|
|
225
|
+
PropTypes.string,
|
|
226
|
+
PropTypes.object
|
|
227
|
+
]),
|
|
228
|
+
|
|
192
229
|
// 辅助刷新用唯一标识key值
|
|
193
230
|
key: PropTypes.string,
|
|
194
231
|
|
|
@@ -1754,6 +1754,73 @@ class AntdTable extends Component {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
|
+
// 统一合并处理onCell自定义函数逻辑
|
|
1758
|
+
columns = [...columns].map(
|
|
1759
|
+
item => {
|
|
1760
|
+
return {
|
|
1761
|
+
...item,
|
|
1762
|
+
...{
|
|
1763
|
+
onCell: (record, index) => {
|
|
1764
|
+
// 初始化onCell返回值
|
|
1765
|
+
let returnValue = {}
|
|
1766
|
+
// 处理自定义样式特性
|
|
1767
|
+
if (conditionalStyleFuncs && conditionalStyleFuncs[item.dataIndex]) {
|
|
1768
|
+
try {
|
|
1769
|
+
returnValue = {
|
|
1770
|
+
...returnValue,
|
|
1771
|
+
...eval(conditionalStyleFuncs[item.dataIndex])(record, index)
|
|
1772
|
+
}
|
|
1773
|
+
} catch (e) {
|
|
1774
|
+
console.error(e)
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
// 处理单元格点击事件
|
|
1778
|
+
if (enableCellClickListenColumns && enableCellClickListenColumns.includes(item.dataIndex)) {
|
|
1779
|
+
try {
|
|
1780
|
+
returnValue = {
|
|
1781
|
+
...returnValue,
|
|
1782
|
+
onClick: e => {
|
|
1783
|
+
setProps({
|
|
1784
|
+
recentlyCellClickColumn: item.dataIndex,
|
|
1785
|
+
recentlyCellClickRecord: record,
|
|
1786
|
+
nClicksCell: nClicksCell + 1
|
|
1787
|
+
})
|
|
1788
|
+
},
|
|
1789
|
+
onDoubleClick: e => {
|
|
1790
|
+
setProps({
|
|
1791
|
+
recentlyCellDoubleClickColumn: item.dataIndex,
|
|
1792
|
+
recentlyCellDoubleClickRecord: record,
|
|
1793
|
+
nDoubleClicksCell: nDoubleClicksCell + 1
|
|
1794
|
+
})
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
} catch (e) {
|
|
1798
|
+
console.error(e)
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
// 处理可编辑特性
|
|
1803
|
+
if (item.editable) {
|
|
1804
|
+
try {
|
|
1805
|
+
returnValue = {
|
|
1806
|
+
...returnValue,
|
|
1807
|
+
record,
|
|
1808
|
+
editable: item.editable,
|
|
1809
|
+
dataIndex: item.dataIndex,
|
|
1810
|
+
title: item.title
|
|
1811
|
+
}
|
|
1812
|
+
} catch (e) {
|
|
1813
|
+
console.error(e)
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
return returnValue;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
)
|
|
1823
|
+
|
|
1757
1824
|
// 若存在至少一个字段有group参数,则对columns进行重构以支持多层表头
|
|
1758
1825
|
let tempColumns = []
|
|
1759
1826
|
if (columns.some(e => e.group)) {
|
|
@@ -1773,71 +1840,6 @@ class AntdTable extends Component {
|
|
|
1773
1840
|
tempColumns = [...columns]
|
|
1774
1841
|
}
|
|
1775
1842
|
|
|
1776
|
-
// 统一合并处理onCell自定义函数逻辑
|
|
1777
|
-
tempColumns = tempColumns.map(
|
|
1778
|
-
item => ({
|
|
1779
|
-
...item,
|
|
1780
|
-
...{
|
|
1781
|
-
onCell: (record, index) => {
|
|
1782
|
-
// 初始化onCell返回值
|
|
1783
|
-
let returnValue = {}
|
|
1784
|
-
// 处理自定义样式特性
|
|
1785
|
-
if (conditionalStyleFuncs && conditionalStyleFuncs[item.dataIndex]) {
|
|
1786
|
-
try {
|
|
1787
|
-
returnValue = {
|
|
1788
|
-
...returnValue,
|
|
1789
|
-
...eval(conditionalStyleFuncs[item.dataIndex])(record, index)
|
|
1790
|
-
}
|
|
1791
|
-
} catch (e) {
|
|
1792
|
-
console.error(e)
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
// 处理单元格点击事件
|
|
1796
|
-
if (enableCellClickListenColumns && enableCellClickListenColumns.includes(item.dataIndex)) {
|
|
1797
|
-
try {
|
|
1798
|
-
returnValue = {
|
|
1799
|
-
...returnValue,
|
|
1800
|
-
onClick: e => {
|
|
1801
|
-
setProps({
|
|
1802
|
-
recentlyCellClickColumn: item.dataIndex,
|
|
1803
|
-
recentlyCellClickRecord: record,
|
|
1804
|
-
nClicksCell: nClicksCell + 1
|
|
1805
|
-
})
|
|
1806
|
-
},
|
|
1807
|
-
onDoubleClick: e => {
|
|
1808
|
-
setProps({
|
|
1809
|
-
recentlyCellDoubleClickColumn: item.dataIndex,
|
|
1810
|
-
recentlyCellDoubleClickRecord: record,
|
|
1811
|
-
nDoubleClicksCell: nDoubleClicksCell + 1
|
|
1812
|
-
})
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
} catch (e) {
|
|
1816
|
-
console.error(e)
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
// 处理可编辑特性
|
|
1821
|
-
if (item.editable) {
|
|
1822
|
-
try {
|
|
1823
|
-
returnValue = {
|
|
1824
|
-
...returnValue,
|
|
1825
|
-
record,
|
|
1826
|
-
editable: item.editable,
|
|
1827
|
-
dataIndex: item.dataIndex,
|
|
1828
|
-
title: item.title
|
|
1829
|
-
}
|
|
1830
|
-
} catch (e) {
|
|
1831
|
-
console.error(e)
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
return returnValue;
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
})
|
|
1839
|
-
)
|
|
1840
|
-
|
|
1841
1843
|
return (
|
|
1842
1844
|
<ConfigProvider
|
|
1843
1845
|
locale={str2Locale.get(locale)}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useCss from '../../hooks/useCss';
|
|
3
|
+
import { isString } from 'lodash';
|
|
4
|
+
import { DraggablePanel } from '@ant-design/pro-editor/es/DraggablePanel';
|
|
5
|
+
import { propTypes, defaultProps } from '../../components/dataDisplay/AntdDraggablePanel.react';
|
|
6
|
+
|
|
7
|
+
// 定义可拖拽面板组件AntdDraggablePanel,api参数参考https://pro-editor.antdigital.dev/zh-CN/components/draggable-panel
|
|
8
|
+
const AntdDraggablePanel = (props) => {
|
|
9
|
+
// 取得必要属性或参数
|
|
10
|
+
let {
|
|
11
|
+
id,
|
|
12
|
+
children,
|
|
13
|
+
style,
|
|
14
|
+
className,
|
|
15
|
+
key,
|
|
16
|
+
mode,
|
|
17
|
+
defaultSize,
|
|
18
|
+
defaultPosition,
|
|
19
|
+
placement,
|
|
20
|
+
minWidth,
|
|
21
|
+
minHeight,
|
|
22
|
+
maxWidth,
|
|
23
|
+
maxHeight,
|
|
24
|
+
resize,
|
|
25
|
+
expandable,
|
|
26
|
+
isExpand,
|
|
27
|
+
setProps,
|
|
28
|
+
loading_state
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<DraggablePanel id={id}
|
|
33
|
+
className={
|
|
34
|
+
isString(className) ?
|
|
35
|
+
className :
|
|
36
|
+
(className ? useCss(className) : undefined)
|
|
37
|
+
}
|
|
38
|
+
style={style}
|
|
39
|
+
key={key}
|
|
40
|
+
mode={mode}
|
|
41
|
+
defaultSize={defaultSize}
|
|
42
|
+
defaultPosition={defaultPosition}
|
|
43
|
+
placement={placement}
|
|
44
|
+
minWidth={minWidth}
|
|
45
|
+
minHeight={minHeight}
|
|
46
|
+
maxWidth={maxWidth}
|
|
47
|
+
maxHeight={maxHeight}
|
|
48
|
+
resize={resize}
|
|
49
|
+
expandable={expandable}
|
|
50
|
+
isExpand={isExpand}
|
|
51
|
+
data-dash-is-loading={
|
|
52
|
+
(loading_state && loading_state.is_loading) || undefined
|
|
53
|
+
} >
|
|
54
|
+
{children}
|
|
55
|
+
</DraggablePanel>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default AntdDraggablePanel;
|
|
60
|
+
|
|
61
|
+
AntdDraggablePanel.defaultProps = defaultProps;
|
|
62
|
+
AntdDraggablePanel.propTypes = propTypes;
|
package/src/lib/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import AntdCollapse from './components/dataDisplay/AntdCollapse.react';
|
|
|
47
47
|
import AntdComment from './components/dataDisplay/AntdComment.react';
|
|
48
48
|
import AntdDescriptions from './components/dataDisplay/descriptions/AntdDescriptions.react';
|
|
49
49
|
import AntdDescriptionItem from './components/dataDisplay/descriptions/AntdDescriptionItem.react';
|
|
50
|
+
import AntdDraggablePanel from './components/dataDisplay/AntdDraggablePanel.react';
|
|
50
51
|
import AntdEmpty from './components/dataDisplay/AntdEmpty.react';
|
|
51
52
|
import AntdImage from './components/dataDisplay/AntdImage.react';
|
|
52
53
|
import AntdImageGroup from './fragments/dataDisplay/AntdImageGroup.react';
|
|
@@ -214,5 +215,6 @@ export {
|
|
|
214
215
|
AntdCompact,
|
|
215
216
|
AntdTour,
|
|
216
217
|
AntdColorPicker,
|
|
217
|
-
AntdQRCode
|
|
218
|
+
AntdQRCode,
|
|
219
|
+
AntdDraggablePanel
|
|
218
220
|
};
|
package/usage.py
CHANGED
|
@@ -1,39 +1,63 @@
|
|
|
1
1
|
import dash
|
|
2
2
|
from dash import html
|
|
3
3
|
import feffery_antd_components as fac
|
|
4
|
+
from dash.dependencies import Input, Output
|
|
4
5
|
|
|
5
6
|
app = dash.Dash(__name__)
|
|
6
7
|
|
|
7
8
|
app.layout = html.Div(
|
|
8
9
|
[
|
|
9
|
-
fac.
|
|
10
|
-
|
|
11
|
-
menuItems=[
|
|
10
|
+
fac.AntdTable(
|
|
11
|
+
columns=[
|
|
12
12
|
{
|
|
13
|
-
'title':
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
direction='vertical',
|
|
31
|
-
size=0
|
|
32
|
-
)
|
|
33
|
-
]
|
|
34
|
-
)
|
|
13
|
+
'title': '字段1-1-1',
|
|
14
|
+
'dataIndex': '字段1-1-1',
|
|
15
|
+
'group': ['字段1', '字段1-1']
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
'title': '字段1-1-2',
|
|
19
|
+
'dataIndex': '字段1-1-2',
|
|
20
|
+
'group': ['字段1', '字段1-1']
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
'title': '字段1-2',
|
|
24
|
+
'dataIndex': '字段1-2',
|
|
25
|
+
'group': '字段1'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
'title': '字段2',
|
|
29
|
+
'dataIndex': '字段2'
|
|
35
30
|
}
|
|
36
|
-
]
|
|
31
|
+
],
|
|
32
|
+
data=[
|
|
33
|
+
{
|
|
34
|
+
'字段1-1-1': 1,
|
|
35
|
+
'字段1-1-2': 1,
|
|
36
|
+
'字段1-2': 1,
|
|
37
|
+
'字段2': 1
|
|
38
|
+
}
|
|
39
|
+
] * 3,
|
|
40
|
+
filterOptions={
|
|
41
|
+
'字段1-1-1': {}
|
|
42
|
+
},
|
|
43
|
+
sortOptions={
|
|
44
|
+
'sortDataIndexes': ['字段1-1-1']
|
|
45
|
+
},
|
|
46
|
+
bordered=True,
|
|
47
|
+
conditionalStyleFuncs={
|
|
48
|
+
'字段1-1-1': '''
|
|
49
|
+
(record, index) => {
|
|
50
|
+
console.log(record)
|
|
51
|
+
if ( index % 2 === 1 ) {
|
|
52
|
+
return {
|
|
53
|
+
style: {
|
|
54
|
+
backgroundColor: "#ebfbee"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
'''
|
|
60
|
+
}
|
|
37
61
|
)
|
|
38
62
|
],
|
|
39
63
|
style={
|