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