@teamix/pro 1.5.3 → 1.5.4-beta.1
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/dist/pro.css +1 -1
- package/dist/pro.js +20319 -19813
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -6
- package/es/actions/base.js +8 -21
- package/es/actions/dialog-component.js +2 -9
- package/es/actions/dialog-form.js +37 -75
- package/es/actions/dialog-info.js +1 -5
- package/es/actions/dialog.js +57 -95
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +70 -156
- package/es/actions/link.js +3 -5
- package/es/actions/quick.js +0 -6
- package/es/actions/request.js +12 -27
- package/es/actions/utils.js +1 -9
- package/es/card/card-container.js +0 -5
- package/es/card/divider.js +0 -5
- package/es/card/index.js +56 -95
- package/es/card/selectable.js +4 -13
- package/es/card/tab.js +1 -10
- package/es/card/utils.js +0 -2
- package/es/form/Components/Editable/index.js +16 -55
- package/es/form/Components/FormGroup/index.d.ts +1 -0
- package/es/form/Components/FormGroup/index.js +7 -22
- package/es/form/Components/LightFilter/index.js +15 -35
- package/es/form/Components/ProField/index.js +2 -14
- package/es/form/Components/ProField/mapDateFormat.js +2 -28
- package/es/form/Components/Text/index.d.ts +1 -0
- package/es/form/Components/Text/index.js +2 -11
- package/es/form/Filter/AdvancedFilter.js +11 -26
- package/es/form/Filter/Layout.js +11 -24
- package/es/form/Filter/LightFilter.js +13 -24
- package/es/form/Filter/SimpleFilter.js +7 -21
- package/es/form/Filter/index.js +106 -171
- package/es/form/Filter/index2.js +11 -28
- package/es/form/Filter/useBindUrl.js +18 -46
- package/es/form/Filter/useSpecialProps.js +8 -13
- package/es/form/ProForm/addCascadeEffect.js +10 -32
- package/es/form/ProForm/customComponent.js +0 -5
- package/es/form/ProForm/index.js +23 -34
- package/es/form/ProForm/useAutoLayout.js +21 -42
- package/es/form/ProForm/useAutoSubmit.js +3 -8
- package/es/form/ProForm/useFieldRequest.js +0 -5
- package/es/form/ProForm/useFormDisplayValues.js +12 -28
- package/es/form/ProForm/useInitialRequest.js +0 -5
- package/es/form/SchemaForm/adapterComponent.js +0 -3
- package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/es/form/SchemaForm/adapterDecorator.js +0 -8
- package/es/form/SchemaForm/adapterType.js +0 -2
- package/es/form/SchemaForm/index.js +78 -114
- package/es/form/SchemaForm/initializeArrayCards.js +0 -6
- package/es/form/SchemaForm/initializeArrayCollapse.js +0 -6
- package/es/form/SchemaForm/initializeArrayItems.js +2 -9
- package/es/form/SchemaForm/initializeArrayTable.js +21 -34
- package/es/form/SchemaForm/initializeDataSource.js +2 -6
- package/es/form/SchemaForm/initializeFormButton.js +14 -31
- package/es/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/es/form/SchemaForm/initializeFormGroup.js +10 -20
- package/es/form/SchemaForm/initializeFormStep.js +11 -23
- package/es/form/SchemaForm/initializeFormTab.js +10 -20
- package/es/form/SchemaForm/initializeReactions.js +9 -33
- package/es/form/SchemaForm/initializeRequest.js +2 -16
- package/es/form/SchemaForm/initializeRules.js +4 -22
- package/es/form/SchemaForm/initializeSelectTable.js +7 -33
- package/es/form/SchemaForm/reactions.js +19 -34
- package/es/form/docs/ActionResponse.d.ts +1 -0
- package/es/form/index.d.ts +9 -9
- package/es/form/index.js +0 -9
- package/es/form/typing.d.ts +6 -4
- package/es/form/utils.d.ts +1 -1
- package/es/form/utils.js +4 -49
- package/es/form/warning.js +2 -7
- package/es/index-without-icon.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -8
- package/es/info/components/InfoGroup/index.js +21 -32
- package/es/info/components/InfoValueItem/index.js +66 -119
- package/es/info/components/ProInfoItem/index.js +13 -21
- package/es/info/components/baseInfo/index.js +14 -26
- package/es/info/components/headerInfo/index.js +8 -20
- package/es/info/components/tableInfo/index.js +20 -50
- package/es/info/index.js +53 -82
- package/es/info/utils/index.js +0 -11
- package/es/nocode/configurators/common.js +5 -6
- package/es/nocode/configurators/index.js +2 -3
- package/es/nocode/index.js +6 -6
- package/es/nocode/pages/editor.js +5 -9
- package/es/nocode/pages/index.js +4 -4
- package/es/nocode/pages/playground.js +18 -35
- package/es/nocode/pages/renderer.js +9 -42
- package/es/nocode/playground.js +10 -23
- package/es/page-header/index.d.ts +2 -2
- package/es/page-header/index.js +39 -75
- package/es/sidebar/components/sidebar-container/index.js +41 -72
- package/es/sidebar/components/tree/index.js +88 -144
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -26
- package/es/sidebar/components/tree-node/components/IconAction/index.js +9 -35
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -25
- package/es/sidebar/components/tree-node/index.js +41 -83
- package/es/sidebar/index.js +69 -94
- package/es/sidebar/utils/action-ref.js +2 -7
- package/es/sidebar/utils/index.d.ts +5 -2
- package/es/sidebar/utils/index.js +41 -98
- package/es/table/components/CardView/index.js +62 -149
- package/es/table/components/Filter/index.js +42 -83
- package/es/table/components/Layout/index.js +25 -45
- package/es/table/components/LoadMore/index.js +15 -34
- package/es/table/components/Pagination/index.js +25 -58
- package/es/table/components/QuickAction/index.js +3 -11
- package/es/table/components/ToolBar/CardSwitch.js +6 -17
- package/es/table/components/ToolBar/DensityIcon.js +18 -31
- package/es/table/components/ToolBar/FilterColumnIcon.js +50 -106
- package/es/table/components/ToolBar/FullScreenIcon.js +2 -6
- package/es/table/components/ToolBar/Fullscreen.js +19 -35
- package/es/table/components/ToolBar/RefreshIcon.js +2 -5
- package/es/table/components/ToolBar/index.js +23 -45
- package/es/table/index.js +226 -399
- package/es/table/utils/columnRender.d.ts +1 -1
- package/es/table/utils/columnRender.js +32 -76
- package/es/table/utils/genProColumnToColumn.js +5 -14
- package/es/table/utils/index.js +14 -47
- package/es/table/utils/pureColumnRender.js +21 -53
- package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/es/table/utils/pureGenProColumnToColumn.js +2 -10
- package/es/table/utils/useTableSelection.js +6 -33
- package/es/templates/List/index.js +2 -9
- package/es/timeline/ProTimeLineItem/index.js +24 -64
- package/es/timeline/index.js +8 -22
- package/es/timeline/typing.d.ts +1 -0
- package/es/utils/message.d.ts +2 -2
- package/es/utils/message.js +0 -5
- package/es/utils/useRealHistory.d.ts +8 -0
- package/es/utils/useRealHistory.js +23 -0
- package/lib/actions/base.js +8 -24
- package/lib/actions/confirm.js +0 -5
- package/lib/actions/danger-confirm.js +0 -5
- package/lib/actions/danger-pop-confirm.js +0 -4
- package/lib/actions/dialog-component.js +2 -15
- package/lib/actions/dialog-form.js +36 -88
- package/lib/actions/dialog-info.js +1 -10
- package/lib/actions/dialog-table.js +0 -5
- package/lib/actions/dialog.js +55 -111
- package/lib/actions/drawer-form.js +0 -3
- package/lib/actions/drawer-info.js +0 -3
- package/lib/actions/drawer-table.js +0 -3
- package/lib/actions/drawer.js +0 -4
- package/lib/actions/error.js +0 -5
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +70 -186
- package/lib/actions/link.js +3 -10
- package/lib/actions/notice.js +0 -5
- package/lib/actions/pop-confirm.js +0 -5
- package/lib/actions/quick.js +0 -13
- package/lib/actions/request.js +10 -32
- package/lib/actions/utils.js +1 -9
- package/lib/card/card-container.js +0 -9
- package/lib/card/divider.js +0 -7
- package/lib/card/index.js +56 -122
- package/lib/card/selectable.js +4 -20
- package/lib/card/tab.js +1 -14
- package/lib/card/utils.js +0 -6
- package/lib/field/index.js +0 -6
- package/lib/form/Components/Editable/index.js +15 -65
- package/lib/form/Components/FormGroup/index.d.ts +1 -0
- package/lib/form/Components/FormGroup/index.js +7 -28
- package/lib/form/Components/LightFilter/index.js +15 -47
- package/lib/form/Components/ProField/index.js +2 -21
- package/lib/form/Components/ProField/mapDateFormat.js +2 -32
- package/lib/form/Components/Text/index.d.ts +1 -0
- package/lib/form/Components/Text/index.js +2 -16
- package/lib/form/Filter/AdvancedFilter.js +11 -34
- package/lib/form/Filter/Layout.js +11 -33
- package/lib/form/Filter/LightFilter.js +13 -32
- package/lib/form/Filter/SimpleFilter.js +5 -27
- package/lib/form/Filter/index.js +105 -191
- package/lib/form/Filter/index2.js +11 -38
- package/lib/form/Filter/useBindUrl.js +18 -50
- package/lib/form/Filter/useSpecialProps.js +6 -13
- package/lib/form/ProForm/addCascadeEffect.js +10 -35
- package/lib/form/ProForm/customComponent.js +0 -8
- package/lib/form/ProForm/index.js +23 -57
- package/lib/form/ProForm/useAutoLayout.js +21 -45
- package/lib/form/ProForm/useAutoSubmit.js +3 -10
- package/lib/form/ProForm/useFieldRequest.js +0 -8
- package/lib/form/ProForm/useFormDisplayValues.js +12 -34
- package/lib/form/ProForm/useInitialRequest.js +0 -6
- package/lib/form/SchemaForm/adapterComponent.js +0 -6
- package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/lib/form/SchemaForm/adapterDecorator.js +0 -12
- package/lib/form/SchemaForm/adapterType.js +0 -5
- package/lib/form/SchemaForm/index.js +78 -144
- package/lib/form/SchemaForm/initializeArrayCards.js +0 -7
- package/lib/form/SchemaForm/initializeArrayCollapse.js +0 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +2 -10
- package/lib/form/SchemaForm/initializeArrayTable.js +21 -34
- package/lib/form/SchemaForm/initializeDataSource.js +2 -8
- package/lib/form/SchemaForm/initializeFormButton.js +14 -32
- package/lib/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/lib/form/SchemaForm/initializeFormGroup.js +10 -20
- package/lib/form/SchemaForm/initializeFormStep.js +11 -23
- package/lib/form/SchemaForm/initializeFormTab.js +10 -20
- package/lib/form/SchemaForm/initializeReactions.js +9 -37
- package/lib/form/SchemaForm/initializeRequest.js +2 -18
- package/lib/form/SchemaForm/initializeRules.js +4 -24
- package/lib/form/SchemaForm/initializeSelectTable.js +7 -36
- package/lib/form/SchemaForm/reactions.js +17 -37
- package/lib/form/docs/ActionResponse.d.ts +1 -0
- package/lib/form/docs/ActionResponse.js +0 -5
- package/lib/form/index.d.ts +9 -9
- package/lib/form/index.js +0 -25
- package/lib/form/typing.d.ts +6 -4
- package/lib/form/utils.d.ts +1 -1
- package/lib/form/utils.js +4 -61
- package/lib/form/warning.js +2 -8
- package/lib/hooks/index.js +0 -5
- package/lib/index-without-icon.js +2 -36
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -39
- package/lib/info/components/InfoGroup/index.js +21 -42
- package/lib/info/components/InfoValueItem/index.js +66 -134
- package/lib/info/components/ProInfoItem/index.js +13 -29
- package/lib/info/components/baseInfo/index.js +14 -38
- package/lib/info/components/headerInfo/index.js +8 -31
- package/lib/info/components/tableInfo/index.js +20 -62
- package/lib/info/index.js +53 -97
- package/lib/info/utils/index.js +0 -19
- package/lib/info/utils/utils.js +0 -1
- package/lib/nocode/configurators/PageHeader.js +0 -2
- package/lib/nocode/configurators/ProTable.js +0 -2
- package/lib/nocode/configurators/common.js +5 -10
- package/lib/nocode/configurators/index.js +2 -10
- package/lib/nocode/configurators/map.js +0 -5
- package/lib/nocode/index.js +0 -11
- package/lib/nocode/pages/editor.js +5 -19
- package/lib/nocode/pages/index.js +2 -9
- package/lib/nocode/pages/playground.js +18 -52
- package/lib/nocode/pages/renderer.js +9 -53
- package/lib/nocode/playground.js +10 -35
- package/lib/page-container/index.js +0 -6
- package/lib/page-header/index.d.ts +2 -2
- package/lib/page-header/index.js +38 -88
- package/lib/sidebar/components/sidebar-container/index.js +41 -84
- package/lib/sidebar/components/tree/index.js +88 -158
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -34
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +9 -46
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -35
- package/lib/sidebar/components/tree-node/index.js +41 -99
- package/lib/sidebar/index.js +69 -112
- package/lib/sidebar/utils/action-ref.js +2 -8
- package/lib/sidebar/utils/index.d.ts +5 -2
- package/lib/sidebar/utils/index.js +41 -106
- package/lib/skeleton/index.js +0 -6
- package/lib/table/components/CardView/index.js +62 -161
- package/lib/table/components/EmptyContent/index.js +0 -6
- package/lib/table/components/Filter/index.js +42 -93
- package/lib/table/components/Layout/index.js +25 -58
- package/lib/table/components/LoadMore/index.js +15 -44
- package/lib/table/components/Pagination/index.js +25 -68
- package/lib/table/components/QuickAction/index.js +3 -15
- package/lib/table/components/ToolBar/CardSwitch.js +6 -28
- package/lib/table/components/ToolBar/DensityIcon.js +18 -42
- package/lib/table/components/ToolBar/FilterColumnIcon.js +50 -118
- package/lib/table/components/ToolBar/FullScreenIcon.js +3 -13
- package/lib/table/components/ToolBar/Fullscreen.js +19 -42
- package/lib/table/components/ToolBar/RefreshIcon.js +3 -12
- package/lib/table/components/ToolBar/index.js +23 -63
- package/lib/table/index.js +226 -423
- package/lib/table/utils/columnRender.d.ts +1 -1
- package/lib/table/utils/columnRender.js +32 -89
- package/lib/table/utils/genProColumnToColumn.js +5 -19
- package/lib/table/utils/getTableProps.js +0 -2
- package/lib/table/utils/getTableSortIcons.js +0 -5
- package/lib/table/utils/index.js +12 -55
- package/lib/table/utils/pureColumnRender.js +21 -64
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/lib/table/utils/pureGenProColumnToColumn.js +2 -11
- package/lib/table/utils/useTableSelection.js +6 -35
- package/lib/templates/Detail/index.js +0 -5
- package/lib/templates/Form/index.js +0 -5
- package/lib/templates/List/index.js +2 -19
- package/lib/templates/index.js +0 -6
- package/lib/timeline/ProTimeLineItem/index.js +24 -75
- package/lib/timeline/index.js +8 -33
- package/lib/timeline/typing.d.ts +1 -0
- package/lib/utils/index.js +0 -6
- package/lib/utils/message.d.ts +2 -2
- package/lib/utils/message.js +0 -10
- package/lib/utils/useRealHistory.d.ts +8 -0
- package/lib/utils/useRealHistory.js +32 -0
- package/package.json +1 -1
@@ -7,44 +7,38 @@ import defaultLayoutMap from '../../utils/layout';
|
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
8
|
import { getDataIndexValue, isHidden } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
|
-
|
11
|
-
|
10
|
+
Col = Grid.Col;
|
12
11
|
var ProBaseInfo = function ProBaseInfo(props) {
|
13
12
|
var _size$width;
|
14
|
-
|
15
13
|
var columns = props.columns,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
24
|
-
|
14
|
+
dataSource = props.dataSource,
|
15
|
+
loading = props.loading,
|
16
|
+
result = props.result,
|
17
|
+
actionRef = props.actionRef,
|
18
|
+
layout = props.layout,
|
19
|
+
size = props.size,
|
20
|
+
context = props.context;
|
21
|
+
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
22
|
+
// 获取列内的布局参数
|
25
23
|
var getFormItemLayout = function getFormItemLayout(colspan) {
|
26
|
-
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout));
|
27
|
-
|
24
|
+
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout));
|
25
|
+
// 自定义布局
|
28
26
|
if (layout) {
|
29
27
|
var _layout$labelCol, _layout$wrapperCol;
|
30
|
-
|
31
28
|
var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
|
32
29
|
var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
|
33
30
|
formItemLayout.labelCol = labelCol;
|
34
31
|
formItemLayout.wrapperCol = wrapperCol;
|
35
32
|
}
|
36
|
-
|
37
33
|
var newLabelSpan = formItemLayout.labelCol.span;
|
38
|
-
var newWrapperSpan = formItemLayout.wrapperCol.span;
|
39
|
-
|
34
|
+
var newWrapperSpan = formItemLayout.wrapperCol.span;
|
35
|
+
// 计算合并列情况。label与wrapper需要重新计算
|
40
36
|
if (colspan) {
|
41
37
|
var _layout$span, _layout$span2;
|
42
|
-
|
43
38
|
var realColspan = ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : 24 / defaultLayout.span > colspan) ? colspan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : 24 / defaultLayout.span;
|
44
39
|
newLabelSpan = newLabelSpan / realColspan;
|
45
40
|
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
46
41
|
}
|
47
|
-
|
48
42
|
var newFormItemLayout = {
|
49
43
|
labelCol: {
|
50
44
|
span: newLabelSpan.toFixed()
|
@@ -55,17 +49,13 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
55
49
|
};
|
56
50
|
return Object.assign(formItemLayout, newFormItemLayout);
|
57
51
|
};
|
58
|
-
|
59
52
|
var renderContent = function renderContent() {
|
60
53
|
return columns.map(function (item, index) {
|
61
54
|
var _ref, _ref2, _layout$span3, _layout$span4, _item$title, _item$valueType, _ref3, _item$colSpan;
|
62
|
-
|
63
55
|
var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
|
64
|
-
|
65
56
|
if (hidden) {
|
66
57
|
return;
|
67
58
|
}
|
68
|
-
|
69
59
|
var span = item.colSpan ? defaultLayout.span : defaultLayout.span;
|
70
60
|
var layoutSpan = item.colSpan ? ((_layout$span3 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span3 !== void 0 ? _layout$span3 : span) * item.colSpan : (_layout$span4 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span4 !== void 0 ? _layout$span4 : span;
|
71
61
|
return /*#__PURE__*/React.createElement(Col, {
|
@@ -94,12 +84,10 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
94
84
|
}));
|
95
85
|
});
|
96
86
|
};
|
97
|
-
|
98
87
|
return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
|
99
88
|
wrap: true,
|
100
89
|
className: "teamix-pro-info-content-row",
|
101
90
|
gutter: 20
|
102
91
|
}, renderContent()));
|
103
92
|
};
|
104
|
-
|
105
93
|
export default ProBaseInfo;
|
@@ -7,43 +7,33 @@ import { getLayout } from '../../utils/utils';
|
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
8
|
import { getDataIndexValue, isHidden } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
|
-
|
11
|
-
|
10
|
+
Col = Grid.Col;
|
12
11
|
var ProHeaderInfo = function ProHeaderInfo(props) {
|
13
12
|
var _size$width;
|
14
|
-
|
15
13
|
var columns = props.columns,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
dataSource = props.dataSource,
|
15
|
+
layout = props.layout,
|
16
|
+
loading = props.loading,
|
17
|
+
result = props.result,
|
18
|
+
actionRef = props.actionRef,
|
19
|
+
size = props.size,
|
20
|
+
context = props.context;
|
23
21
|
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
24
|
-
|
25
22
|
var renderContent = function renderContent() {
|
26
23
|
return columns.map(function (item, index) {
|
27
24
|
var _ref, _ref2, _item$title, _item$valueType;
|
28
|
-
|
29
25
|
var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
|
30
|
-
|
31
26
|
if (hidden) {
|
32
27
|
return;
|
33
28
|
}
|
34
|
-
|
35
29
|
var span = 24;
|
36
|
-
|
37
30
|
if (layout === null || layout === void 0 ? void 0 : layout.colNum) {
|
38
31
|
var _item$colSpan;
|
39
|
-
|
40
32
|
span = 24 / (layout === null || layout === void 0 ? void 0 : layout.colNum) * ((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 1);
|
41
33
|
} else {
|
42
34
|
var _item$colSpan2;
|
43
|
-
|
44
35
|
span = defaultLayout.span * ((_item$colSpan2 = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan2 !== void 0 ? _item$colSpan2 : 1);
|
45
36
|
}
|
46
|
-
|
47
37
|
return /*#__PURE__*/React.createElement(Col, {
|
48
38
|
span: span,
|
49
39
|
key: index
|
@@ -70,11 +60,9 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
|
|
70
60
|
}));
|
71
61
|
});
|
72
62
|
};
|
73
|
-
|
74
63
|
return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
|
75
64
|
wrap: true,
|
76
65
|
className: "teamix-pro-info-content-row"
|
77
66
|
}, renderContent()));
|
78
67
|
};
|
79
|
-
|
80
68
|
export default ProHeaderInfo;
|
@@ -1,21 +1,12 @@
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2
|
-
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
-
|
5
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
-
|
7
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
|
-
|
9
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
10
|
-
|
11
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
12
|
-
|
13
7
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
14
|
-
|
15
8
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
16
|
-
|
17
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
18
|
-
|
19
10
|
import React, { useMemo } from 'react';
|
20
11
|
import './index.scss';
|
21
12
|
import { Table } from '@alicloudfe/components';
|
@@ -25,21 +16,19 @@ import InfoValueItem from '../InfoValueItem';
|
|
25
16
|
import { ProSkeletonRaw } from '../../..';
|
26
17
|
import { getDataIndexValue, isHidden } from '../../utils';
|
27
18
|
import cloneDeep from 'lodash.clonedeep';
|
28
|
-
|
29
19
|
var ProTableInfo = function ProTableInfo(props) {
|
30
20
|
var columns = props.columns,
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
21
|
+
dataSource = props.dataSource,
|
22
|
+
_props$layout = props.layout,
|
23
|
+
layout = _props$layout === void 0 ? {} : _props$layout,
|
24
|
+
loading = props.loading,
|
25
|
+
result = props.result,
|
26
|
+
actionRef = props.actionRef,
|
27
|
+
context = props.context;
|
38
28
|
var _layout$colNum = layout.colNum,
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
colNum = _layout$colNum === void 0 ? 2 : _layout$colNum,
|
30
|
+
_layout$labelGutter = layout.labelGutter,
|
31
|
+
labelGutter = _layout$labelGutter === void 0 ? '80px' : _layout$labelGutter;
|
43
32
|
var getNewColumns = function getNewColumns() {
|
44
33
|
// 需要 fill 填充 否则有可能不执行
|
45
34
|
return _toConsumableArray(new Array(colNum)).fill(1).map(function (_, index) {
|
@@ -56,10 +45,8 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
56
45
|
return [].concat(_toConsumableArray(acc), _toConsumableArray(cur));
|
57
46
|
}, []);
|
58
47
|
};
|
59
|
-
|
60
48
|
var getInfoValueItem = function getInfoValueItem(item) {
|
61
49
|
var _item$valueType;
|
62
|
-
|
63
50
|
return /*#__PURE__*/React.createElement(InfoValueItem, {
|
64
51
|
type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
|
65
52
|
value: getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result),
|
@@ -71,77 +58,66 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
71
58
|
props: item.props
|
72
59
|
});
|
73
60
|
};
|
74
|
-
|
75
61
|
var newDataSource = useMemo(function () {
|
76
62
|
var nResult = [];
|
77
63
|
var columnsCopy = cloneDeep(columns).filter(function (item) {
|
78
64
|
return !isHidden(item.hidden, getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result), dataSource !== null && dataSource !== void 0 ? dataSource : result, context);
|
79
|
-
});
|
80
|
-
|
65
|
+
});
|
66
|
+
// 取当前行的数据。直到取完
|
81
67
|
while (columnsCopy.length > 0) {
|
82
68
|
var filterColumns = [];
|
83
|
-
var col = colNum * 2;
|
84
|
-
|
69
|
+
var col = colNum * 2;
|
70
|
+
// 需要判断是否有合并行情况
|
85
71
|
while (col >= 2) {
|
86
72
|
if (columnsCopy.length > 0) {
|
87
73
|
var _columnsItem$colSpan;
|
88
|
-
|
89
74
|
var columnsItem = columnsCopy.shift();
|
90
|
-
var needCol = 1 + ((_columnsItem$colSpan = columnsItem === null || columnsItem === void 0 ? void 0 : columnsItem.colSpan) !== null && _columnsItem$colSpan !== void 0 ? _columnsItem$colSpan : 1);
|
91
|
-
|
75
|
+
var needCol = 1 + ((_columnsItem$colSpan = columnsItem === null || columnsItem === void 0 ? void 0 : columnsItem.colSpan) !== null && _columnsItem$colSpan !== void 0 ? _columnsItem$colSpan : 1);
|
76
|
+
// 如果剩余的col能满足下一组数据那么就放在这一组
|
92
77
|
if (needCol <= col) {
|
93
78
|
col = col - needCol;
|
94
79
|
filterColumns.push(columnsItem);
|
95
80
|
} else {
|
96
81
|
var _filterColumns$0$colS;
|
97
|
-
|
98
82
|
// 不满足条件。再安回去。。。
|
99
|
-
columnsCopy.unshift(columnsItem);
|
100
|
-
|
101
|
-
filterColumns[0].colSpan = ((_filterColumns$0$colS = filterColumns[0].colSpan) !== null && _filterColumns$0$colS !== void 0 ? _filterColumns$0$colS : 1) + col;
|
102
|
-
|
83
|
+
columnsCopy.unshift(columnsItem);
|
84
|
+
// 并且把剩余的col都分配给前一组数据
|
85
|
+
filterColumns[0].colSpan = ((_filterColumns$0$colS = filterColumns[0].colSpan) !== null && _filterColumns$0$colS !== void 0 ? _filterColumns$0$colS : 1) + col;
|
86
|
+
// 置0
|
103
87
|
col = 0;
|
104
88
|
}
|
105
89
|
}
|
106
|
-
|
107
90
|
if (columnsCopy.length === 0) {
|
108
91
|
// 如果剩余仍有列数并且已经没有columns分配了
|
109
92
|
col = 0;
|
110
93
|
}
|
111
94
|
}
|
112
|
-
|
113
95
|
var itemData = filterColumns.map(function (item, index) {
|
114
96
|
var _item$title, _data;
|
115
|
-
|
116
97
|
var data = (_data = {}, _defineProperty(_data, "label_".concat(index), /*#__PURE__*/React.createElement(LabelIconTip, {
|
117
98
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
118
99
|
tooltip: item.tooltip,
|
119
100
|
icon: item.tooltipIcon
|
120
101
|
})), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/React.createElement(React.Fragment, null, loading && /*#__PURE__*/React.createElement(ProSkeletonRaw.Info.Item, null), !loading && getInfoValueItem(item))), _data);
|
121
|
-
|
122
102
|
if (item.colSpan) {
|
123
103
|
data['formatter'] = {
|
124
104
|
colSpan: item.colSpan
|
125
105
|
};
|
126
106
|
}
|
127
|
-
|
128
107
|
return data;
|
129
108
|
}).reduce(function (acc, cur) {
|
130
109
|
return _objectSpread(_objectSpread({}, acc), cur);
|
131
110
|
}, {});
|
132
111
|
nResult.push(itemData);
|
133
112
|
}
|
134
|
-
|
135
113
|
return nResult;
|
136
114
|
}, [loading, result]);
|
137
|
-
|
138
115
|
var setCellProps = function setCellProps(rowIndex, colIndex, dataIndex, record) {
|
139
116
|
if (colIndex % 2 === 0) {
|
140
117
|
return {
|
141
118
|
className: 'key-type'
|
142
119
|
};
|
143
120
|
}
|
144
|
-
|
145
121
|
if (record.formatter) {
|
146
122
|
if (record.formatter.colSpan) {
|
147
123
|
if (colIndex === record.formatter.colSpan) {
|
@@ -149,28 +125,23 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
149
125
|
colSpan: record.formatter.colSpan
|
150
126
|
};
|
151
127
|
}
|
152
|
-
|
153
128
|
var length = Object.keys(record).length;
|
154
|
-
|
155
129
|
if (length <= 3) {
|
156
130
|
return {
|
157
131
|
colSpan: record.formatter.colSpan
|
158
132
|
};
|
159
133
|
}
|
160
|
-
|
161
134
|
if (length > 5) {
|
162
135
|
return {
|
163
136
|
colSpan: record.formatter.colSpan
|
164
137
|
};
|
165
138
|
}
|
166
139
|
}
|
167
|
-
|
168
140
|
return {
|
169
141
|
rowSpan: record.formatter.rowSpan
|
170
142
|
};
|
171
143
|
}
|
172
144
|
};
|
173
|
-
|
174
145
|
return /*#__PURE__*/React.createElement(Table.StickyLock, {
|
175
146
|
className: "teamix-pro-info-table",
|
176
147
|
cellProps: setCellProps,
|
@@ -180,5 +151,4 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
180
151
|
dataSource: newDataSource
|
181
152
|
});
|
182
153
|
};
|
183
|
-
|
184
154
|
export default ProTableInfo;
|
package/es/info/index.js
CHANGED
@@ -1,28 +1,16 @@
|
|
1
1
|
var _excluded = ["type", "url", "method", "formatResult", "formatParams", "params", "actionRef", "header", "onSuccess", "onError", "beforeRequest", "extendParams", "className", "style", "columns", "layout", "dataSource", "loading", "extra", "context"],
|
2
|
-
|
3
|
-
|
2
|
+
_excluded2 = ["context"];
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
|
-
|
6
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
|
-
|
8
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
9
|
-
|
10
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
11
|
-
|
12
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
13
|
-
|
14
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
15
|
-
|
16
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
17
|
-
|
18
10
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
19
|
-
|
20
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
21
|
-
|
22
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
23
|
-
|
24
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
25
|
-
|
26
14
|
import React, { isValidElement, useContext, useEffect, useRef, useState, useMemo } from 'react';
|
27
15
|
import ProTableInfo from './components/tableInfo';
|
28
16
|
import ProHeaderInfo from './components/headerInfo';
|
@@ -34,67 +22,59 @@ import { doCommonRequest, cls, getTestRequestData, getTestRequestParams } from '
|
|
34
22
|
import { useSize } from '@teamix/hooks';
|
35
23
|
import { ProCard } from '..';
|
36
24
|
export * from './typing';
|
37
|
-
|
38
25
|
var ProInfo = function ProInfo(props) {
|
39
26
|
var _ref;
|
40
|
-
|
41
27
|
var _props$type = props.type,
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
28
|
+
type = _props$type === void 0 ? 'base' : _props$type,
|
29
|
+
url = props.url,
|
30
|
+
_props$method = props.method,
|
31
|
+
method = _props$method === void 0 ? 'post' : _props$method,
|
32
|
+
formatResult = props.formatResult,
|
33
|
+
formatParams = props.formatParams,
|
34
|
+
params = props.params,
|
35
|
+
propsActionRef = props.actionRef,
|
36
|
+
_props$header = props.header,
|
37
|
+
header = _props$header === void 0 ? {} : _props$header,
|
38
|
+
onSuccess = props.onSuccess,
|
39
|
+
onError = props.onError,
|
40
|
+
beforeRequest = props.beforeRequest,
|
41
|
+
extendParams = props.extendParams,
|
42
|
+
className = props.className,
|
43
|
+
style = props.style,
|
44
|
+
columns = props.columns,
|
45
|
+
layout = props.layout,
|
46
|
+
dataSource = props.dataSource,
|
47
|
+
userLoading = props.loading,
|
48
|
+
extra = props.extra,
|
49
|
+
infoContext = props.context,
|
50
|
+
others = _objectWithoutProperties(props, _excluded);
|
66
51
|
var _useContext = useContext(ProInfoGroupContext),
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
52
|
+
contextUrl = _useContext.url,
|
53
|
+
contextMethod = _useContext.method,
|
54
|
+
contextParams = _useContext.params,
|
55
|
+
contextFormatResult = _useContext.formatResult,
|
56
|
+
contextVisible = _useContext.visible,
|
57
|
+
contextSize = _useContext.size,
|
58
|
+
contextOnSuccess = _useContext.onSuccess,
|
59
|
+
contextOnError = _useContext.onError,
|
60
|
+
contextFormatParams = _useContext.formatParams,
|
61
|
+
contextBeforeRequest = _useContext.beforeRequest,
|
62
|
+
contextExtendParams = _useContext.extendParams,
|
63
|
+
_useContext$context = _useContext.context,
|
64
|
+
contextContext = _useContext$context === void 0 ? {} : _useContext$context;
|
65
|
+
// 获取容器宽度
|
82
66
|
var ref = useRef();
|
83
67
|
var size = contextVisible ? contextSize : useSize(ref);
|
84
|
-
|
85
68
|
var _useState = useState(false),
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
70
|
+
loading = _useState2[0],
|
71
|
+
setLoading = _useState2[1];
|
72
|
+
// 请求数据
|
91
73
|
var _useState3 = useState(),
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
74
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
75
|
+
data = _useState4[0],
|
76
|
+
setData = _useState4[1];
|
96
77
|
var requestDataKey = (contextMethod !== null && contextMethod !== void 0 ? contextMethod : method).toLowerCase() === 'get' ? 'params' : 'data';
|
97
|
-
|
98
78
|
var requestConfig = _defineProperty({
|
99
79
|
url: (_ref = contextUrl !== null && contextUrl !== void 0 ? contextUrl : url) !== null && _ref !== void 0 ? _ref : '',
|
100
80
|
method: contextMethod !== null && contextMethod !== void 0 ? contextMethod : method,
|
@@ -105,7 +85,6 @@ var ProInfo = function ProInfo(props) {
|
|
105
85
|
beforeRequest: contextBeforeRequest !== null && contextBeforeRequest !== void 0 ? contextBeforeRequest : beforeRequest,
|
106
86
|
extendParams: contextExtendParams !== null && contextExtendParams !== void 0 ? contextExtendParams : extendParams
|
107
87
|
}, requestDataKey, contextParams !== null && contextParams !== void 0 ? contextParams : params);
|
108
|
-
|
109
88
|
useEffect(function () {
|
110
89
|
if (url || contextUrl) {
|
111
90
|
setLoading(false);
|
@@ -118,8 +97,8 @@ var ProInfo = function ProInfo(props) {
|
|
118
97
|
return _objectSpread(_objectSpread({}, infoContext), {}, {
|
119
98
|
record: dataSource !== null && dataSource !== void 0 ? dataSource : data
|
120
99
|
}, contextContext);
|
121
|
-
}, [dataSource, data]);
|
122
|
-
|
100
|
+
}, [dataSource, data]);
|
101
|
+
// 获取数据
|
123
102
|
var request = function request() {
|
124
103
|
setLoading(true);
|
125
104
|
doCommonRequest(requestConfig).then(function (resp) {
|
@@ -128,38 +107,31 @@ var ProInfo = function ProInfo(props) {
|
|
128
107
|
setLoading(false);
|
129
108
|
});
|
130
109
|
};
|
131
|
-
|
132
|
-
|
133
|
-
|
110
|
+
var actionRef = useRef();
|
111
|
+
// 将 Actions 绑定到传入的 propsActionRef 中
|
134
112
|
if (propsActionRef) {
|
135
113
|
propsActionRef.current = actionRef.current;
|
136
|
-
}
|
137
|
-
|
138
|
-
|
114
|
+
}
|
115
|
+
// 绑定 Actions
|
139
116
|
useActionType(actionRef, {
|
140
117
|
refresh: function refresh() {
|
141
118
|
request();
|
142
119
|
}
|
143
120
|
});
|
144
|
-
|
145
121
|
var getExtra = function getExtra() {
|
146
122
|
if (!extra) {
|
147
123
|
return undefined;
|
148
124
|
}
|
149
|
-
|
150
125
|
if ( /*#__PURE__*/isValidElement(extra)) {
|
151
126
|
return extra;
|
152
127
|
}
|
153
|
-
|
154
128
|
var _extra$context = extra.context,
|
155
|
-
|
156
|
-
|
157
|
-
|
129
|
+
actionContext = _extra$context === void 0 ? {} : _extra$context,
|
130
|
+
others = _objectWithoutProperties(extra, _excluded2);
|
158
131
|
return _objectSpread(_objectSpread({}, others), {}, {
|
159
132
|
context: _objectSpread(_objectSpread({}, context), actionContext)
|
160
133
|
});
|
161
134
|
};
|
162
|
-
|
163
135
|
return /*#__PURE__*/React.createElement("div", {
|
164
136
|
ref: ref,
|
165
137
|
style: style,
|
@@ -203,7 +175,6 @@ var ProInfo = function ProInfo(props) {
|
|
203
175
|
context: context
|
204
176
|
})));
|
205
177
|
};
|
206
|
-
|
207
178
|
ProInfo.Group = ProInfoGroup;
|
208
179
|
ProInfo.ProInfoGroup = ProInfoGroup;
|
209
180
|
export default ProInfo;
|
package/es/info/utils/index.js
CHANGED
@@ -1,19 +1,14 @@
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2
|
-
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
-
|
5
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
-
|
7
4
|
import { getDeepValue, getTargetValue } from '@teamix/utils';
|
8
5
|
import React from 'react';
|
9
6
|
export function useActionType(ref, action) {
|
10
7
|
// 合并自定义事件
|
11
8
|
var userAction = _objectSpread({}, action);
|
12
|
-
|
13
9
|
ref.current = userAction;
|
14
10
|
}
|
15
11
|
/** ProInfoGroupContext */
|
16
|
-
|
17
12
|
export var ProInfoGroupContext = /*#__PURE__*/React.createContext({});
|
18
13
|
/**
|
19
14
|
* 获取 dataIndex 值
|
@@ -21,14 +16,12 @@ export var ProInfoGroupContext = /*#__PURE__*/React.createContext({});
|
|
21
16
|
* @param dataSource
|
22
17
|
* @returns
|
23
18
|
*/
|
24
|
-
|
25
19
|
export function getDataIndexValue(dataIndex, dataSource) {
|
26
20
|
if (Array.isArray(dataIndex)) {
|
27
21
|
return dataIndex.map(function (item) {
|
28
22
|
return getDeepValue(item !== null && item !== void 0 ? item : '', dataSource);
|
29
23
|
});
|
30
24
|
}
|
31
|
-
|
32
25
|
return getDeepValue(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
|
33
26
|
}
|
34
27
|
/**
|
@@ -38,7 +31,6 @@ export function getDataIndexValue(dataIndex, dataSource) {
|
|
38
31
|
* @param record
|
39
32
|
* @param context
|
40
33
|
*/
|
41
|
-
|
42
34
|
export function isHidden(hidden, value, record, context) {
|
43
35
|
if (typeof hidden === 'string') {
|
44
36
|
return getTargetValue(hidden, _objectSpread(_objectSpread({}, record), {}, {
|
@@ -47,14 +39,11 @@ export function isHidden(hidden, value, record, context) {
|
|
47
39
|
context: context
|
48
40
|
}));
|
49
41
|
}
|
50
|
-
|
51
42
|
if (typeof hidden === 'boolean') {
|
52
43
|
return hidden;
|
53
44
|
}
|
54
|
-
|
55
45
|
if (typeof hidden === 'function') {
|
56
46
|
return hidden === null || hidden === void 0 ? void 0 : hidden(value, record);
|
57
47
|
}
|
58
|
-
|
59
48
|
return false;
|
60
49
|
}
|
@@ -55,12 +55,11 @@ export function array(title, name, fields, main, arrayTitle) {
|
|
55
55
|
}
|
56
56
|
export function actions(props) {
|
57
57
|
var _ref = props || {},
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
_ref$title = _ref.title,
|
59
|
+
title = _ref$title === void 0 ? '操作项' : _ref$title,
|
60
|
+
_ref$name = _ref.name,
|
61
|
+
name = _ref$name === void 0 ? 'actions' : _ref$name,
|
62
|
+
arrayTitle = _ref.arrayTitle;
|
64
63
|
return array(title, name, [{
|
65
64
|
name: 'children',
|
66
65
|
title: '文字',
|
@@ -1,19 +1,18 @@
|
|
1
1
|
import React, { useMemo } from 'react';
|
2
2
|
import ProForm, { createForm } from '../../form';
|
3
|
+
// @ts-ignore
|
3
4
|
export var initConfigurator = function initConfigurator(schema, defaultInitialValues, defaultValues) {
|
4
5
|
return function (props) {
|
5
6
|
var initialValues = props.initialValues,
|
6
|
-
|
7
|
+
onValuesChange = props.onValuesChange;
|
7
8
|
var form = useMemo(function () {
|
8
9
|
return createForm({
|
9
10
|
initialValues: Object.assign({}, defaultValues, initialValues || defaultInitialValues)
|
10
11
|
});
|
11
12
|
}, []);
|
12
|
-
|
13
13
|
var onChange = function onChange(values) {
|
14
14
|
onValuesChange && onValuesChange(values);
|
15
15
|
};
|
16
|
-
|
17
16
|
return /*#__PURE__*/React.createElement(ProForm, {
|
18
17
|
labelCol: 6,
|
19
18
|
wrapperCol: 18,
|