@teamix/pro 1.5.0-beta.1 → 1.6.0-beta.0
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/README.md +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +77100 -67703
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +13 -6
- package/es/actions/base.js +8 -21
- package/es/actions/dialog-component.js +3 -13
- package/es/actions/dialog-form.js +41 -79
- package/es/actions/dialog-info.js +1 -5
- package/es/actions/dialog.js +57 -96
- package/es/actions/index.js +94 -161
- package/es/actions/link.js +3 -6
- package/es/actions/request.js +12 -28
- package/es/actions/utils.js +1 -9
- package/es/card/card-container.js +11 -9
- package/es/card/divider.js +2 -9
- package/es/card/index.js +70 -98
- package/es/card/selectable.js +6 -17
- package/es/card/tab.js +3 -14
- package/es/card/utils.js +0 -2
- package/es/form/Components/Editable/index.js +17 -56
- package/es/form/Components/FormGroup/index.js +11 -25
- package/es/form/Components/LightFilter/index.js +22 -33
- package/es/form/Components/ProField/index.js +4 -18
- package/es/form/Components/ProField/mapDateFormat.js +2 -28
- package/es/form/Components/Text/index.js +4 -15
- package/es/form/Filter/AdvancedFilter.js +16 -29
- package/es/form/Filter/Layout.js +11 -24
- package/es/form/Filter/LightFilter.js +17 -24
- package/es/form/Filter/SimpleFilter.js +12 -23
- package/es/form/Filter/index.js +113 -161
- package/es/form/Filter/index2.js +22 -34
- package/es/form/Filter/layout.scss +1 -1
- package/es/form/Filter/useBindUrl.js +18 -43
- package/es/form/Filter/useSpecialProps.js +8 -12
- package/es/form/ProForm/addCascadeEffect.js +203 -0
- package/es/form/ProForm/customComponent.js +0 -5
- package/es/form/ProForm/index.js +33 -38
- package/es/form/ProForm/useAutoLayout.js +21 -38
- package/es/form/ProForm/useAutoSubmit.js +3 -9
- package/es/form/ProForm/useFieldRequest.js +0 -5
- package/es/form/ProForm/useFormDisplayValues.js +12 -27
- package/es/form/ProForm/useInitialRequest.js +0 -5
- package/es/form/SchemaForm/adapterComponent.js +1 -3
- package/es/form/SchemaForm/adapterDecorator.js +1 -8
- package/es/form/SchemaForm/adapterType.js +1 -2
- package/es/form/SchemaForm/index.js +82 -105
- 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 -29
- 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 -32
- package/es/form/SchemaForm/initializeRequest.js +2 -16
- package/es/form/SchemaForm/initializeRules.js +4 -22
- package/es/form/SchemaForm/initializeSelectTable.js +8 -33
- package/es/form/SchemaForm/reactions.js +19 -29
- package/es/form/index.js +4 -9
- package/es/form/utils.js +15 -48
- package/es/form/warning.js +3 -6
- package/es/index-without-icon.js +4 -3
- package/es/index.js +8 -7
- package/es/info/components/InfoGroup/index.js +23 -36
- package/es/info/components/InfoValueItem/index.js +85 -126
- package/es/info/components/ProInfoItem/index.js +13 -20
- package/es/info/components/baseInfo/index.js +14 -23
- package/es/info/components/headerInfo/index.js +8 -20
- package/es/info/components/tableInfo/index.js +22 -50
- package/es/info/index.js +59 -82
- package/es/info/utils/index.js +3 -11
- package/es/layout/index.js +2 -0
- package/es/nocode/configurators/common.js +5 -6
- package/es/nocode/configurators/index.js +1 -3
- package/es/nocode/index.js +7 -5
- package/es/nocode/pages/editor.js +5 -9
- package/es/nocode/pages/index.js +6 -3
- package/es/nocode/pages/playground.js +21 -40
- package/es/nocode/pages/renderer.js +13 -48
- package/es/nocode/playground.js +12 -27
- package/es/page-header/index.js +54 -80
- package/es/sidebar/components/sidebar-container/index.js +59 -71
- package/es/sidebar/components/sidebar-container/index.scss +21 -14
- package/es/sidebar/components/tree/index.js +107 -127
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +13 -29
- package/es/sidebar/components/tree-node/components/IconAction/index.js +12 -36
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -24
- package/es/sidebar/components/tree-node/index.js +55 -84
- package/es/sidebar/index.js +73 -87
- package/es/sidebar/utils/action-ref.js +2 -7
- package/es/sidebar/utils/index.js +59 -108
- package/es/table/components/Filter/index.js +41 -72
- package/es/table/components/Layout/index.js +34 -49
- package/es/table/components/Pagination/index.js +35 -66
- package/es/table/components/QuickAction/index.js +6 -13
- package/es/table/components/ToolBar/DensityIcon.js +24 -31
- package/es/table/components/ToolBar/FilterColumnIcon.js +47 -91
- package/es/table/components/ToolBar/FullScreenIcon.js +7 -61
- package/es/table/components/ToolBar/Fullscreen.js +15 -25
- package/es/table/components/ToolBar/RefreshIcon.js +4 -5
- package/es/table/components/ToolBar/index.js +88 -25
- package/es/table/components/ToolBar/index.scss +22 -2
- package/es/table/index.js +242 -356
- package/es/table/utils/columnRender.js +52 -87
- package/es/table/utils/genProColumnToColumn.js +3 -13
- package/es/table/utils/index.js +18 -45
- package/es/table/utils/pureColumnRender.js +26 -50
- package/es/table/utils/pureGenProColumnToColumn.js +2 -10
- package/es/table/utils/useTableSelection.js +6 -33
- package/es/templates/List/index.js +6 -15
- package/es/templates/index.js +2 -1
- package/es/timeline/ProTimeLineItem/index.js +30 -66
- package/es/timeline/index.js +11 -25
- package/es/utils/message.js +3 -10
- 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 +3 -19
- package/lib/actions/dialog-form.js +41 -92
- package/lib/actions/dialog-info.js +1 -10
- package/lib/actions/dialog-table.js +0 -5
- package/lib/actions/dialog.js +56 -112
- 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.js +93 -191
- package/lib/actions/link.js +3 -11
- package/lib/actions/notice.js +0 -5
- package/lib/actions/pop-confirm.js +0 -5
- package/lib/actions/request.js +10 -33
- package/lib/actions/utils.js +1 -9
- package/lib/card/card-container.js +6 -13
- package/lib/card/divider.js +2 -11
- package/lib/card/index.js +68 -124
- package/lib/card/selectable.js +6 -24
- package/lib/card/tab.js +3 -18
- package/lib/card/utils.js +0 -6
- package/lib/field/index.js +0 -6
- package/lib/form/Components/Editable/index.js +16 -66
- package/lib/form/Components/FormGroup/index.js +11 -31
- package/lib/form/Components/LightFilter/index.js +22 -45
- package/lib/form/Components/ProField/index.js +4 -25
- package/lib/form/Components/ProField/mapDateFormat.js +2 -32
- package/lib/form/Components/Text/index.js +4 -20
- package/lib/form/Filter/AdvancedFilter.js +16 -37
- package/lib/form/Filter/Layout.js +11 -33
- package/lib/form/Filter/LightFilter.js +17 -32
- package/lib/form/Filter/SimpleFilter.js +10 -29
- package/lib/form/Filter/index.js +112 -181
- package/lib/form/Filter/index2.js +22 -44
- package/lib/form/Filter/layout.scss +1 -1
- package/lib/form/Filter/useBindUrl.js +18 -47
- package/lib/form/Filter/useSpecialProps.js +6 -13
- package/lib/form/ProForm/addCascadeEffect.js +210 -0
- package/lib/form/ProForm/customComponent.js +0 -8
- package/lib/form/ProForm/index.js +33 -60
- package/lib/form/ProForm/useAutoLayout.js +21 -41
- package/lib/form/ProForm/useAutoSubmit.js +3 -11
- package/lib/form/ProForm/useFieldRequest.js +0 -8
- package/lib/form/ProForm/useFormDisplayValues.js +12 -33
- package/lib/form/ProForm/useInitialRequest.js +0 -6
- package/lib/form/SchemaForm/adapterComponent.js +1 -6
- package/lib/form/SchemaForm/adapterDecorator.js +0 -12
- package/lib/form/SchemaForm/adapterType.js +1 -5
- package/lib/form/SchemaForm/index.js +82 -135
- 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 -30
- 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 -36
- 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 -32
- package/lib/form/docs/ActionResponse.js +0 -5
- package/lib/form/index.js +0 -25
- package/lib/form/typing.js +1 -5
- package/lib/form/utils.js +14 -60
- package/lib/form/warning.js +3 -7
- package/lib/hooks/index.js +0 -5
- package/lib/index-without-icon.js +2 -36
- package/lib/index.js +2 -39
- package/lib/info/components/InfoGroup/index.js +23 -46
- package/lib/info/components/InfoValueItem/index.js +85 -141
- package/lib/info/components/ProInfoItem/index.js +14 -29
- package/lib/info/components/baseInfo/index.js +15 -36
- package/lib/info/components/headerInfo/index.js +8 -31
- package/lib/info/components/tableInfo/index.js +22 -62
- package/lib/info/index.js +59 -97
- package/lib/info/typing.js +1 -5
- package/lib/info/utils/index.js +3 -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 +1 -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 +21 -57
- package/lib/nocode/pages/renderer.js +13 -59
- package/lib/nocode/playground.js +12 -39
- package/lib/page-container/index.js +0 -6
- package/lib/page-header/index.js +53 -93
- package/lib/sidebar/components/sidebar-container/index.js +59 -83
- package/lib/sidebar/components/sidebar-container/index.scss +21 -14
- package/lib/sidebar/components/tree/index.js +107 -141
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +13 -37
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +12 -47
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -34
- package/lib/sidebar/components/tree-node/index.js +55 -100
- package/lib/sidebar/index.js +73 -103
- package/lib/sidebar/typing.js +1 -5
- package/lib/sidebar/utils/action-ref.js +2 -8
- package/lib/sidebar/utils/index.js +59 -116
- package/lib/skeleton/index.js +0 -6
- package/lib/table/components/EmptyContent/index.js +0 -6
- package/lib/table/components/Filter/index.js +41 -82
- package/lib/table/components/Layout/index.js +35 -63
- package/lib/table/components/Pagination/index.js +35 -76
- package/lib/table/components/QuickAction/index.js +6 -17
- package/lib/table/components/ToolBar/DensityIcon.js +24 -42
- package/lib/table/components/ToolBar/FilterColumnIcon.js +47 -103
- package/lib/table/components/ToolBar/FullScreenIcon.js +10 -73
- package/lib/table/components/ToolBar/Fullscreen.js +15 -32
- package/lib/table/components/ToolBar/RefreshIcon.js +5 -12
- package/lib/table/components/ToolBar/index.js +91 -34
- package/lib/table/components/ToolBar/index.scss +22 -2
- package/lib/table/index.js +243 -380
- package/lib/table/typing.js +1 -5
- package/lib/table/utils/columnRender.js +51 -100
- package/lib/table/utils/genProColumnToColumn.js +3 -18
- package/lib/table/utils/getTableProps.js +0 -2
- package/lib/table/utils/getTableSortIcons.js +0 -5
- package/lib/table/utils/index.js +16 -53
- package/lib/table/utils/pureColumnRender.js +26 -61
- 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 +6 -25
- package/lib/templates/index.js +0 -6
- package/lib/timeline/ProTimeLineItem/index.js +30 -77
- package/lib/timeline/index.js +11 -36
- package/lib/timeline/typing.js +1 -5
- package/lib/utils/index.js +0 -6
- package/lib/utils/message.js +3 -15
- package/package.json +5 -6
- package/es/actions/base.d.ts +0 -24
- package/es/actions/confirm.d.ts +0 -7
- package/es/actions/danger-confirm.d.ts +0 -7
- package/es/actions/danger-pop-confirm.d.ts +0 -5
- package/es/actions/dialog-component.d.ts +0 -10
- package/es/actions/dialog-form.d.ts +0 -29
- package/es/actions/dialog-info.d.ts +0 -9
- package/es/actions/dialog-table.d.ts +0 -9
- package/es/actions/dialog.d.ts +0 -40
- package/es/actions/drawer-form.d.ts +0 -6
- package/es/actions/drawer-info.d.ts +0 -6
- package/es/actions/drawer-table.d.ts +0 -6
- package/es/actions/drawer.d.ts +0 -6
- package/es/actions/error.d.ts +0 -7
- package/es/actions/index.d.ts +0 -107
- package/es/actions/link.d.ts +0 -8
- package/es/actions/notice.d.ts +0 -7
- package/es/actions/pop-confirm.d.ts +0 -9
- package/es/actions/request.d.ts +0 -9
- package/es/actions/utils.d.ts +0 -1
- package/es/card/card-container.d.ts +0 -18
- package/es/card/divider.d.ts +0 -6
- package/es/card/index.d.ts +0 -109
- package/es/card/selectable.d.ts +0 -13
- package/es/card/tab.d.ts +0 -6
- package/es/card/utils.d.ts +0 -9
- package/es/field/index.d.ts +0 -3
- package/es/form/Components/Editable/index.d.ts +0 -20
- package/es/form/Components/FormGroup/index.d.ts +0 -13
- package/es/form/Components/LightFilter/componentMap.d.ts +0 -3
- package/es/form/Components/LightFilter/index.d.ts +0 -17
- package/es/form/Components/ProField/index.d.ts +0 -2
- package/es/form/Components/ProField/mapDateFormat.d.ts +0 -3
- package/es/form/Components/Text/index.d.ts +0 -7
- package/es/form/Filter/AdvancedFilter.d.ts +0 -7
- package/es/form/Filter/Layout.d.ts +0 -5
- package/es/form/Filter/LightFilter.d.ts +0 -7
- package/es/form/Filter/SimpleFilter.d.ts +0 -7
- package/es/form/Filter/index.d.ts +0 -9
- package/es/form/Filter/index2.d.ts +0 -13
- package/es/form/Filter/useBindUrl.d.ts +0 -2
- package/es/form/Filter/useSpecialProps.d.ts +0 -6
- package/es/form/ProForm/customComponent.d.ts +0 -3
- package/es/form/ProForm/index.d.ts +0 -5
- package/es/form/ProForm/useAutoLayout.d.ts +0 -9
- package/es/form/ProForm/useAutoSubmit.d.ts +0 -6
- package/es/form/ProForm/useFieldRequest.d.ts +0 -5
- package/es/form/ProForm/useFormDisplayValues.d.ts +0 -4
- package/es/form/ProForm/useInitialRequest.d.ts +0 -6
- package/es/form/SchemaForm/adapterComponent.d.ts +0 -5
- package/es/form/SchemaForm/adapterDecorator.d.ts +0 -6
- package/es/form/SchemaForm/adapterType.d.ts +0 -5
- package/es/form/SchemaForm/index.d.ts +0 -4
- package/es/form/SchemaForm/initializeArrayCards.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayItems.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayTable.d.ts +0 -3
- package/es/form/SchemaForm/initializeDataSource.d.ts +0 -15
- package/es/form/SchemaForm/initializeFormButton.d.ts +0 -3
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +0 -3
- package/es/form/SchemaForm/initializeFormGroup.d.ts +0 -3
- package/es/form/SchemaForm/initializeFormStep.d.ts +0 -5
- package/es/form/SchemaForm/initializeFormTab.d.ts +0 -3
- package/es/form/SchemaForm/initializeReactions.d.ts +0 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +0 -11
- package/es/form/SchemaForm/initializeRules.d.ts +0 -11
- package/es/form/SchemaForm/initializeSelectTable.d.ts +0 -3
- package/es/form/SchemaForm/reactions.d.ts +0 -6
- package/es/form/docs/ActionResponse.d.ts +0 -7
- package/es/form/fieldTypeMap.d.ts +0 -7
- package/es/form/index.d.ts +0 -125
- package/es/form/locales/validate.d.ts +0 -159
- package/es/form/schemaNameMap.d.ts +0 -5
- package/es/form/typing.d.ts +0 -172
- package/es/form/utils.d.ts +0 -55
- package/es/form/warning.d.ts +0 -3
- package/es/hooks/index.d.ts +0 -2
- package/es/index-without-icon.d.ts +0 -32
- package/es/index.d.ts +0 -32
- package/es/info/components/InfoGroup/index.d.ts +0 -5
- package/es/info/components/InfoValueItem/index.d.ts +0 -5
- package/es/info/components/ProInfoItem/index.d.ts +0 -5
- package/es/info/components/baseInfo/index.d.ts +0 -8
- package/es/info/components/headerInfo/index.d.ts +0 -8
- package/es/info/components/tableInfo/index.d.ts +0 -7
- package/es/info/index.d.ts +0 -10
- package/es/info/typing.d.ts +0 -218
- package/es/info/utils/index.d.ts +0 -20
- package/es/info/utils/layout.d.ts +0 -2
- package/es/info/utils/utils.d.ts +0 -1
- package/es/layout/index.d.ts +0 -2
- package/es/nocode/configurators/Card.d.ts +0 -3
- package/es/nocode/configurators/PageHeader.d.ts +0 -3
- package/es/nocode/configurators/ProTable.d.ts +0 -3
- package/es/nocode/configurators/common.d.ts +0 -280
- package/es/nocode/configurators/index.d.ts +0 -15
- package/es/nocode/configurators/map.d.ts +0 -2
- package/es/nocode/index.d.ts +0 -8
- package/es/nocode/pages/editor.d.ts +0 -12
- package/es/nocode/pages/index.d.ts +0 -14
- package/es/nocode/pages/playground.d.ts +0 -11
- package/es/nocode/pages/renderer.d.ts +0 -10
- package/es/nocode/playground.d.ts +0 -14
- package/es/page-container/index.d.ts +0 -3
- package/es/page-header/index.d.ts +0 -74
- package/es/sidebar/components/sidebar-container/index.d.ts +0 -5
- package/es/sidebar/components/tree/index.d.ts +0 -6
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.d.ts +0 -15
- package/es/sidebar/components/tree-node/components/IconAction/index.d.ts +0 -12
- package/es/sidebar/components/tree-node/components/IconSwitch/index.d.ts +0 -23
- package/es/sidebar/components/tree-node/index.d.ts +0 -7
- package/es/sidebar/index.d.ts +0 -7
- package/es/sidebar/typing.d.ts +0 -137
- package/es/sidebar/utils/action-ref.d.ts +0 -3
- package/es/sidebar/utils/index.d.ts +0 -361
- package/es/skeleton/index.d.ts +0 -3
- package/es/table/components/EmptyContent/index.d.ts +0 -2
- package/es/table/components/Filter/index.d.ts +0 -9
- package/es/table/components/Layout/index.d.ts +0 -5
- package/es/table/components/Pagination/index.d.ts +0 -7
- package/es/table/components/QuickAction/index.d.ts +0 -10
- package/es/table/components/ToolBar/DensityIcon.d.ts +0 -4
- package/es/table/components/ToolBar/FilterColumnIcon.d.ts +0 -4
- package/es/table/components/ToolBar/FullScreenIcon.d.ts +0 -4
- package/es/table/components/ToolBar/Fullscreen.d.ts +0 -10
- package/es/table/components/ToolBar/RefreshIcon.d.ts +0 -4
- package/es/table/components/ToolBar/index.d.ts +0 -5
- package/es/table/index.d.ts +0 -5
- package/es/table/typing.d.ts +0 -299
- package/es/table/utils/columnRender.d.ts +0 -13
- package/es/table/utils/genProColumnToColumn.d.ts +0 -13
- package/es/table/utils/getTableProps.d.ts +0 -2
- package/es/table/utils/getTableSortIcons.d.ts +0 -3
- package/es/table/utils/index.d.ts +0 -19
- package/es/table/utils/pureColumnRender.d.ts +0 -9
- package/es/table/utils/pureGenProColumnToColumn.d.ts +0 -7
- package/es/table/utils/useTableSelection.d.ts +0 -3
- package/es/templates/Detail/index.d.ts +0 -2
- package/es/templates/Form/index.d.ts +0 -2
- package/es/templates/List/index.d.ts +0 -9
- package/es/templates/index.d.ts +0 -3
- package/es/timeline/ProTimeLineItem/index.d.ts +0 -5
- package/es/timeline/index.d.ts +0 -10
- package/es/timeline/typing.d.ts +0 -106
- package/es/utils/index.d.ts +0 -3
- package/es/utils/message.d.ts +0 -3
- package/lib/actions/base.d.ts +0 -24
- package/lib/actions/confirm.d.ts +0 -7
- package/lib/actions/danger-confirm.d.ts +0 -7
- package/lib/actions/danger-pop-confirm.d.ts +0 -5
- package/lib/actions/dialog-component.d.ts +0 -10
- package/lib/actions/dialog-form.d.ts +0 -29
- package/lib/actions/dialog-info.d.ts +0 -9
- package/lib/actions/dialog-table.d.ts +0 -9
- package/lib/actions/dialog.d.ts +0 -40
- package/lib/actions/drawer-form.d.ts +0 -6
- package/lib/actions/drawer-info.d.ts +0 -6
- package/lib/actions/drawer-table.d.ts +0 -6
- package/lib/actions/drawer.d.ts +0 -6
- package/lib/actions/error.d.ts +0 -7
- package/lib/actions/index.d.ts +0 -107
- package/lib/actions/link.d.ts +0 -8
- package/lib/actions/notice.d.ts +0 -7
- package/lib/actions/pop-confirm.d.ts +0 -9
- package/lib/actions/request.d.ts +0 -9
- package/lib/actions/utils.d.ts +0 -1
- package/lib/card/card-container.d.ts +0 -18
- package/lib/card/divider.d.ts +0 -6
- package/lib/card/index.d.ts +0 -109
- package/lib/card/selectable.d.ts +0 -13
- package/lib/card/tab.d.ts +0 -6
- package/lib/card/utils.d.ts +0 -9
- package/lib/field/index.d.ts +0 -3
- package/lib/form/Components/Editable/index.d.ts +0 -20
- package/lib/form/Components/FormGroup/index.d.ts +0 -13
- package/lib/form/Components/LightFilter/componentMap.d.ts +0 -3
- package/lib/form/Components/LightFilter/index.d.ts +0 -17
- package/lib/form/Components/ProField/index.d.ts +0 -2
- package/lib/form/Components/ProField/mapDateFormat.d.ts +0 -3
- package/lib/form/Components/Text/index.d.ts +0 -7
- package/lib/form/Filter/AdvancedFilter.d.ts +0 -7
- package/lib/form/Filter/Layout.d.ts +0 -5
- package/lib/form/Filter/LightFilter.d.ts +0 -7
- package/lib/form/Filter/SimpleFilter.d.ts +0 -7
- package/lib/form/Filter/index.d.ts +0 -9
- package/lib/form/Filter/index2.d.ts +0 -13
- package/lib/form/Filter/useBindUrl.d.ts +0 -2
- package/lib/form/Filter/useSpecialProps.d.ts +0 -6
- package/lib/form/ProForm/customComponent.d.ts +0 -3
- package/lib/form/ProForm/index.d.ts +0 -5
- package/lib/form/ProForm/useAutoLayout.d.ts +0 -9
- package/lib/form/ProForm/useAutoSubmit.d.ts +0 -6
- package/lib/form/ProForm/useFieldRequest.d.ts +0 -5
- package/lib/form/ProForm/useFormDisplayValues.d.ts +0 -4
- package/lib/form/ProForm/useInitialRequest.d.ts +0 -6
- package/lib/form/SchemaForm/adapterComponent.d.ts +0 -5
- package/lib/form/SchemaForm/adapterDecorator.d.ts +0 -6
- package/lib/form/SchemaForm/adapterType.d.ts +0 -5
- package/lib/form/SchemaForm/index.d.ts +0 -4
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +0 -3
- package/lib/form/SchemaForm/initializeDataSource.d.ts +0 -15
- package/lib/form/SchemaForm/initializeFormButton.d.ts +0 -3
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +0 -3
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +0 -3
- package/lib/form/SchemaForm/initializeFormStep.d.ts +0 -5
- package/lib/form/SchemaForm/initializeFormTab.d.ts +0 -3
- package/lib/form/SchemaForm/initializeReactions.d.ts +0 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +0 -11
- package/lib/form/SchemaForm/initializeRules.d.ts +0 -11
- package/lib/form/SchemaForm/initializeSelectTable.d.ts +0 -3
- package/lib/form/SchemaForm/reactions.d.ts +0 -6
- package/lib/form/docs/ActionResponse.d.ts +0 -7
- package/lib/form/fieldTypeMap.d.ts +0 -7
- package/lib/form/index.d.ts +0 -125
- package/lib/form/locales/validate.d.ts +0 -159
- package/lib/form/schemaNameMap.d.ts +0 -5
- package/lib/form/typing.d.ts +0 -172
- package/lib/form/utils.d.ts +0 -55
- package/lib/form/warning.d.ts +0 -3
- package/lib/hooks/index.d.ts +0 -2
- package/lib/index-without-icon.d.ts +0 -32
- package/lib/index.d.ts +0 -32
- package/lib/info/components/InfoGroup/index.d.ts +0 -5
- package/lib/info/components/InfoValueItem/index.d.ts +0 -5
- package/lib/info/components/ProInfoItem/index.d.ts +0 -5
- package/lib/info/components/baseInfo/index.d.ts +0 -8
- package/lib/info/components/headerInfo/index.d.ts +0 -8
- package/lib/info/components/tableInfo/index.d.ts +0 -7
- package/lib/info/index.d.ts +0 -10
- package/lib/info/typing.d.ts +0 -218
- package/lib/info/utils/index.d.ts +0 -20
- package/lib/info/utils/layout.d.ts +0 -2
- package/lib/info/utils/utils.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -2
- package/lib/nocode/configurators/Card.d.ts +0 -3
- package/lib/nocode/configurators/PageHeader.d.ts +0 -3
- package/lib/nocode/configurators/ProTable.d.ts +0 -3
- package/lib/nocode/configurators/common.d.ts +0 -280
- package/lib/nocode/configurators/index.d.ts +0 -15
- package/lib/nocode/configurators/map.d.ts +0 -2
- package/lib/nocode/index.d.ts +0 -8
- package/lib/nocode/pages/editor.d.ts +0 -12
- package/lib/nocode/pages/index.d.ts +0 -14
- package/lib/nocode/pages/playground.d.ts +0 -11
- package/lib/nocode/pages/renderer.d.ts +0 -10
- package/lib/nocode/playground.d.ts +0 -14
- package/lib/page-container/index.d.ts +0 -3
- package/lib/page-header/index.d.ts +0 -74
- package/lib/sidebar/components/sidebar-container/index.d.ts +0 -5
- package/lib/sidebar/components/tree/index.d.ts +0 -6
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.d.ts +0 -15
- package/lib/sidebar/components/tree-node/components/IconAction/index.d.ts +0 -12
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.d.ts +0 -23
- package/lib/sidebar/components/tree-node/index.d.ts +0 -7
- package/lib/sidebar/index.d.ts +0 -7
- package/lib/sidebar/typing.d.ts +0 -137
- package/lib/sidebar/utils/action-ref.d.ts +0 -3
- package/lib/sidebar/utils/index.d.ts +0 -361
- package/lib/skeleton/index.d.ts +0 -3
- package/lib/table/components/EmptyContent/index.d.ts +0 -2
- package/lib/table/components/Filter/index.d.ts +0 -9
- package/lib/table/components/Layout/index.d.ts +0 -5
- package/lib/table/components/Pagination/index.d.ts +0 -7
- package/lib/table/components/QuickAction/index.d.ts +0 -10
- package/lib/table/components/ToolBar/DensityIcon.d.ts +0 -4
- package/lib/table/components/ToolBar/FilterColumnIcon.d.ts +0 -4
- package/lib/table/components/ToolBar/FullScreenIcon.d.ts +0 -4
- package/lib/table/components/ToolBar/Fullscreen.d.ts +0 -10
- package/lib/table/components/ToolBar/RefreshIcon.d.ts +0 -4
- package/lib/table/components/ToolBar/index.d.ts +0 -5
- package/lib/table/index.d.ts +0 -5
- package/lib/table/typing.d.ts +0 -299
- package/lib/table/utils/columnRender.d.ts +0 -13
- package/lib/table/utils/genProColumnToColumn.d.ts +0 -13
- package/lib/table/utils/getTableProps.d.ts +0 -2
- package/lib/table/utils/getTableSortIcons.d.ts +0 -3
- package/lib/table/utils/index.d.ts +0 -19
- package/lib/table/utils/pureColumnRender.d.ts +0 -9
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +0 -7
- package/lib/table/utils/useTableSelection.d.ts +0 -3
- package/lib/templates/Detail/index.d.ts +0 -2
- package/lib/templates/Form/index.d.ts +0 -2
- package/lib/templates/List/index.d.ts +0 -9
- package/lib/templates/index.d.ts +0 -3
- package/lib/timeline/ProTimeLineItem/index.d.ts +0 -5
- package/lib/timeline/index.d.ts +0 -10
- package/lib/timeline/typing.d.ts +0 -106
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/message.d.ts +0 -3
package/lib/table/index.js
CHANGED
|
@@ -5,45 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {};
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
var _components = require("@alicloudfe/components");
|
|
12
|
-
|
|
13
10
|
var _Pagination = _interopRequireDefault(require("./components/Pagination"));
|
|
14
|
-
|
|
15
11
|
var _genProColumnToColumn = _interopRequireDefault(require("./utils/genProColumnToColumn"));
|
|
16
|
-
|
|
17
12
|
var _utils = require("@teamix/utils");
|
|
18
|
-
|
|
19
13
|
var _skeleton = require("../skeleton");
|
|
20
|
-
|
|
21
14
|
require("./index.scss");
|
|
22
|
-
|
|
23
15
|
var _Layout = _interopRequireDefault(require("./components/Layout"));
|
|
24
|
-
|
|
25
16
|
var _utils2 = require("./utils");
|
|
26
|
-
|
|
27
17
|
var _getTableProps = _interopRequireDefault(require("./utils/getTableProps"));
|
|
28
|
-
|
|
29
18
|
var _getTableSortIcons = _interopRequireDefault(require("./utils/getTableSortIcons"));
|
|
30
|
-
|
|
31
19
|
var _useTableSelection = _interopRequireDefault(require("./utils/useTableSelection"));
|
|
32
|
-
|
|
33
20
|
var _Fullscreen = _interopRequireDefault(require("./components/ToolBar/Fullscreen"));
|
|
34
|
-
|
|
35
21
|
var _EmptyContent = _interopRequireDefault(require("./components/EmptyContent"));
|
|
36
|
-
|
|
37
|
-
var _actions = require("../actions");
|
|
38
|
-
|
|
22
|
+
var _actions2 = require("../actions");
|
|
39
23
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
40
|
-
|
|
41
24
|
var _pageContainer = _interopRequireDefault(require("../page-container"));
|
|
42
|
-
|
|
43
25
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
44
|
-
|
|
45
26
|
var _typing = require("./typing");
|
|
46
|
-
|
|
47
27
|
Object.keys(_typing).forEach(function (key) {
|
|
48
28
|
if (key === "default" || key === "__esModule") return;
|
|
49
29
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -55,271 +35,224 @@ Object.keys(_typing).forEach(function (key) {
|
|
|
55
35
|
}
|
|
56
36
|
});
|
|
57
37
|
});
|
|
58
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree"];
|
|
59
|
-
|
|
38
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "fixedTableBody", "isTree"];
|
|
60
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
-
|
|
62
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
63
|
-
|
|
64
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
65
|
-
|
|
42
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
66
43
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
67
|
-
|
|
68
44
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
69
|
-
|
|
70
45
|
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."); }
|
|
71
|
-
|
|
72
46
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
73
|
-
|
|
74
47
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
75
|
-
|
|
76
48
|
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; }
|
|
77
|
-
|
|
78
49
|
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; }
|
|
79
|
-
|
|
80
50
|
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; }
|
|
81
|
-
|
|
82
51
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
83
|
-
|
|
84
52
|
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."); }
|
|
85
|
-
|
|
86
53
|
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); }
|
|
87
|
-
|
|
88
54
|
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; }
|
|
89
|
-
|
|
90
55
|
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; }
|
|
91
|
-
|
|
92
56
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
93
|
-
|
|
94
57
|
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; }
|
|
95
|
-
|
|
96
58
|
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; }
|
|
97
|
-
|
|
98
59
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-table');
|
|
60
|
+
|
|
99
61
|
/**
|
|
100
62
|
* 处理原生传入的 columns 以便于 选择列 方便处理
|
|
101
63
|
* @param columns 原生传入的 columns
|
|
102
64
|
* @returns
|
|
103
65
|
*/
|
|
104
|
-
|
|
105
66
|
var processColumns = function processColumns(columns, initialColumns) {
|
|
106
67
|
var _getGlobalConfig;
|
|
107
|
-
|
|
108
68
|
var globalFilterColumns = (_getGlobalConfig = (0, _utils.getGlobalConfig)('ProTable')) === null || _getGlobalConfig === void 0 ? void 0 : _getGlobalConfig.filterColumns;
|
|
109
69
|
var filterColumns = columns.filter(function (item) {
|
|
110
70
|
return item.columnFilters !== false && (item === null || item === void 0 ? void 0 : item.hidden) !== true && (!globalFilterColumns || globalFilterColumns(item));
|
|
111
|
-
});
|
|
112
|
-
|
|
71
|
+
});
|
|
72
|
+
// 处理只剩一列批量选择的情况下宽度错乱问题
|
|
113
73
|
if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
|
|
114
74
|
var _initialColumns$;
|
|
115
|
-
|
|
116
75
|
if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
|
|
117
76
|
var _filterColumns$, _filterColumns$2;
|
|
118
|
-
|
|
119
77
|
if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
|
|
120
78
|
delete filterColumns[0].width;
|
|
121
79
|
}
|
|
122
|
-
|
|
123
80
|
if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
|
|
124
81
|
filterColumns[0].lock = false;
|
|
125
82
|
}
|
|
126
83
|
} else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
|
|
127
84
|
var _initialColumns$2, _initialColumns$3;
|
|
128
|
-
|
|
129
85
|
if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
|
|
130
86
|
filterColumns[0].width = initialColumns[0].width;
|
|
131
87
|
}
|
|
132
|
-
|
|
133
88
|
if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
|
|
134
89
|
filterColumns[0].lock = initialColumns[0].lock;
|
|
135
90
|
}
|
|
136
91
|
}
|
|
137
92
|
}
|
|
138
|
-
|
|
139
93
|
return filterColumns;
|
|
140
94
|
};
|
|
141
|
-
/** 默认请求翻页参数 */
|
|
142
|
-
|
|
143
95
|
|
|
96
|
+
/** 默认请求翻页参数 */
|
|
144
97
|
var globalPageKey = 'currentPage';
|
|
145
98
|
var globalPageSizeKey = 'pageSize';
|
|
146
|
-
|
|
147
99
|
var globalFormatSort = function globalFormatSort(sort) {
|
|
148
100
|
if (Object.keys(sort).length > 0) {
|
|
149
101
|
return {
|
|
150
102
|
sort: sort
|
|
151
103
|
};
|
|
152
104
|
}
|
|
153
|
-
|
|
154
105
|
return {};
|
|
155
106
|
};
|
|
156
|
-
|
|
157
107
|
var ProTable = function ProTable(props) {
|
|
158
108
|
var _rowSelection$selecte;
|
|
159
|
-
|
|
160
109
|
var header = props.header,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
110
|
+
className = props.className,
|
|
111
|
+
tableClassName = props.tableClassName,
|
|
112
|
+
mainAction = props.mainAction,
|
|
113
|
+
extra = props.extra,
|
|
114
|
+
propsDataFilter = props.dataFilter,
|
|
115
|
+
afterDataFilter = props.afterDataFilter,
|
|
116
|
+
toolBar = props.toolBar,
|
|
117
|
+
propsColumns = props.columns,
|
|
118
|
+
useRowSelection = props.useRowSelection,
|
|
119
|
+
propsRowSelection = props.rowSelection,
|
|
120
|
+
onChangeRowSelection = props.onChangeRowSelection,
|
|
121
|
+
getRowSelection = props.getRowSelection,
|
|
122
|
+
primaryKey = props.primaryKey,
|
|
123
|
+
footerAction = props.footerAction,
|
|
124
|
+
footer = props.footer,
|
|
125
|
+
url = props.url,
|
|
126
|
+
pageKey = props.pageKey,
|
|
127
|
+
pageSizeKey = props.pageSizeKey,
|
|
128
|
+
_props$method = props.method,
|
|
129
|
+
method = _props$method === void 0 ? 'get' : _props$method,
|
|
130
|
+
_props$params = props.params,
|
|
131
|
+
propsParams = _props$params === void 0 ? {} : _props$params,
|
|
132
|
+
formatSort = props.formatSort,
|
|
133
|
+
_props$formatParams = props.formatParams,
|
|
134
|
+
formatParams = _props$formatParams === void 0 ? function (params) {
|
|
135
|
+
return params;
|
|
136
|
+
} : _props$formatParams,
|
|
137
|
+
formatResult = props.formatResult,
|
|
138
|
+
requestConfig = props.requestConfig,
|
|
139
|
+
_props$requestWhenMou = props.requestWhenMount,
|
|
140
|
+
requestWhenMount = _props$requestWhenMou === void 0 ? true : _props$requestWhenMou,
|
|
141
|
+
_props$showPagination = props.showPagination,
|
|
142
|
+
showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
|
|
143
|
+
_props$pageSizeList = props.pageSizeList,
|
|
144
|
+
pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
|
|
145
|
+
responsivePaginationType = props.responsivePaginationType,
|
|
146
|
+
_props$showSkeleton = props.showSkeleton,
|
|
147
|
+
propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
|
|
148
|
+
_props$skeletonSize = props.skeletonSize,
|
|
149
|
+
skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
|
|
150
|
+
propsActionRef = props.actionRef,
|
|
151
|
+
propsDataSource = props.dataSource,
|
|
152
|
+
_props$filterDebounce = props.filterDebounce,
|
|
153
|
+
filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
|
|
154
|
+
_props$footerSuction = props.footerSuction,
|
|
155
|
+
footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
|
|
156
|
+
_props$autoRefresh = props.autoRefresh,
|
|
157
|
+
autoRefresh = _props$autoRefresh === void 0 ? function () {
|
|
158
|
+
return false;
|
|
159
|
+
} : _props$autoRefresh,
|
|
160
|
+
customRequest = props.customRequest,
|
|
161
|
+
_props$filterColumnTy = props.filterColumnType,
|
|
162
|
+
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
|
163
|
+
defaultFilterParams = props.defaultFilterParams,
|
|
164
|
+
_props$reserveSelecte = props.reserveSelectedRecords,
|
|
165
|
+
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
|
166
|
+
_props$size = props.size,
|
|
167
|
+
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
|
168
|
+
disableSelectAll = props.disableSelectAll,
|
|
169
|
+
context = props.context,
|
|
170
|
+
_props$fixedTableBody = props.fixedTableBody,
|
|
171
|
+
fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
|
|
172
|
+
isTree = props.isTree,
|
|
173
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
225
174
|
var targetPageKey = pageKey || globalPageKey;
|
|
226
175
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
|
227
176
|
var targetFormatSort = formatSort || globalFormatSort;
|
|
228
|
-
|
|
229
177
|
var _useState = (0, _react.useState)(1),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
178
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
179
|
+
currentPage = _useState2[0],
|
|
180
|
+
setCurrentPage = _useState2[1];
|
|
234
181
|
var _useState3 = (0, _react.useState)(props.pageSize || 10),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
182
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
183
|
+
pageSize = _useState4[0],
|
|
184
|
+
setPageSize = _useState4[1];
|
|
239
185
|
var _useState5 = (0, _react.useState)(0),
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
186
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
187
|
+
total = _useState6[0],
|
|
188
|
+
setTotal = _useState6[1];
|
|
244
189
|
var _useState7 = (0, _react.useState)(propsDataSource !== null && propsDataSource !== void 0 ? propsDataSource : []),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
190
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
191
|
+
data = _useState8[0],
|
|
192
|
+
setData = _useState8[1];
|
|
249
193
|
var _useState9 = (0, _react.useState)(props.sort || {}),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
194
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
195
|
+
sort = _useState10[0],
|
|
196
|
+
setSort = _useState10[1];
|
|
254
197
|
var _useState11 = (0, _react.useState)(!propsDataSource && requestWhenMount && propsShowSkeleton),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
198
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
199
|
+
showSkeleton = _useState12[0],
|
|
200
|
+
setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
|
|
260
201
|
var skeletonDataSource = new Array(skeletonSize).fill({});
|
|
261
|
-
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
|
262
|
-
|
|
202
|
+
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
|
203
|
+
// 如果使用 customRequest 的话,内置 loading
|
|
263
204
|
var _useState13 = (0, _react.useState)(requestWhenMount),
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
205
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
206
|
+
customTableLoading = _useState14[0],
|
|
207
|
+
setCustomTableLoading = _useState14[1];
|
|
268
208
|
var tableRef = (0, _react.useRef)(null);
|
|
269
|
-
var actionRef = (0, _react.useRef)();
|
|
270
|
-
|
|
209
|
+
var actionRef = (0, _react.useRef)();
|
|
210
|
+
// 传给 table 的过滤后的 columns
|
|
271
211
|
var _useState15 = (0, _react.useState)(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns)),
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
212
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
213
|
+
filteredColumns = _useState16[0],
|
|
214
|
+
setFilteredColumns = _useState16[1];
|
|
276
215
|
var _useState17 = (0, _react.useState)(propsSize),
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
216
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
217
|
+
size = _useState18[0],
|
|
218
|
+
_setSize = _useState18[1];
|
|
281
219
|
var _useState19 = (0, _react.useState)(true),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
|
286
|
-
|
|
220
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
221
|
+
showLoading = _useState20[0],
|
|
222
|
+
setShowLoading = _useState20[1];
|
|
287
223
|
|
|
224
|
+
// 存储能够被 on 监听到的 ProTable 状态
|
|
225
|
+
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
|
288
226
|
var _useState21 = (0, _react.useState)({
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
227
|
+
fullScreenState: false,
|
|
228
|
+
filterRules: {},
|
|
229
|
+
filterColumns: []
|
|
230
|
+
}),
|
|
231
|
+
_useState22 = _slicedToArray(_useState21, 1),
|
|
232
|
+
actionRefState = _useState22[0];
|
|
233
|
+
|
|
234
|
+
// 存储 on 监听事件
|
|
297
235
|
var _useState23 = (0, _react.useState)({
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
236
|
+
fullScreenState: {}
|
|
237
|
+
}),
|
|
238
|
+
_useState24 = _slicedToArray(_useState23, 1),
|
|
239
|
+
actionRefCallback = _useState24[0];
|
|
303
240
|
|
|
241
|
+
// 存储定时器 id
|
|
304
242
|
var autoRefreshTimerRef = (0, _react.useRef)();
|
|
305
243
|
var onResize = null;
|
|
306
244
|
(0, _react.useEffect)(function () {
|
|
307
245
|
var _propsDataFilter$sche, _propsDataFilter$sche2;
|
|
308
|
-
|
|
309
246
|
getHeaderHeight(fullscreenState);
|
|
310
247
|
getFooterSuctionState();
|
|
311
|
-
|
|
312
248
|
if (window.onresize) {
|
|
313
249
|
onResize = window.onresize;
|
|
314
250
|
window.onresize = (0, _lodash.default)(function () {
|
|
315
251
|
var _onResize;
|
|
316
|
-
|
|
317
252
|
(_onResize = onResize) === null || _onResize === void 0 ? void 0 : _onResize();
|
|
318
|
-
|
|
319
253
|
if (footerSuction) {
|
|
320
254
|
getFooterSuctionState();
|
|
321
255
|
}
|
|
322
|
-
|
|
323
256
|
if (fixedTableBody) {
|
|
324
257
|
getHeaderHeight(fullscreenState);
|
|
325
258
|
}
|
|
@@ -329,44 +262,37 @@ var ProTable = function ProTable(props) {
|
|
|
329
262
|
if (footerSuction) {
|
|
330
263
|
getFooterSuctionState();
|
|
331
264
|
}
|
|
332
|
-
|
|
333
265
|
if (fixedTableBody) {
|
|
334
266
|
getHeaderHeight(fullscreenState);
|
|
335
267
|
}
|
|
336
268
|
}, 500);
|
|
337
|
-
}
|
|
338
|
-
|
|
269
|
+
}
|
|
339
270
|
|
|
271
|
+
// 如果不传 dataFilter,则在这里初始化请求
|
|
340
272
|
var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
|
|
341
|
-
|
|
342
273
|
if (requestWhenMount && !hasDataFilter) {
|
|
343
274
|
(0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
|
|
344
|
-
|
|
345
275
|
_request();
|
|
346
276
|
}
|
|
347
|
-
|
|
348
277
|
return function () {
|
|
349
278
|
if (onResize) {
|
|
350
279
|
window.onresize = onResize;
|
|
351
280
|
} else {
|
|
352
281
|
window.onresize = null;
|
|
353
282
|
}
|
|
354
|
-
|
|
355
283
|
if (autoRefreshTimerRef.current) {
|
|
356
284
|
clearTimeout(autoRefreshTimerRef.current);
|
|
357
285
|
}
|
|
358
|
-
|
|
359
286
|
actionRef.current = undefined;
|
|
360
287
|
};
|
|
361
|
-
}, []);
|
|
288
|
+
}, []);
|
|
362
289
|
|
|
290
|
+
// 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
|
363
291
|
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
|
364
292
|
var _tableDom$getElements, _tableDom$getElements2, _document$querySelect, _document$querySelect2, _document$querySelect3;
|
|
365
|
-
|
|
366
293
|
if (!fixedTableBody) {
|
|
367
294
|
return;
|
|
368
295
|
}
|
|
369
|
-
|
|
370
296
|
var tableDom = tableRef.current;
|
|
371
297
|
var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
|
|
372
298
|
var basePrefix = (0, _utils.usePrefixCls)('', {
|
|
@@ -375,95 +301,92 @@ var ProTable = function ProTable(props) {
|
|
|
375
301
|
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
|
376
302
|
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
|
377
303
|
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
|
378
|
-
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
|
379
|
-
|
|
304
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
|
305
|
+
// 这边不能直接取 next-table-body
|
|
380
306
|
var tableBodyDom = (_document$querySelect = document.querySelector('.teamix-pro-table')) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.getElementsByTagName('table')) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2[1]) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.parentNode;
|
|
381
307
|
var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
|
|
382
308
|
setTimeout(function () {
|
|
383
309
|
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
310
|
+
var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0;
|
|
311
|
+
// table表头默认一行。即42px
|
|
387
312
|
var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
|
|
388
|
-
var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50;
|
|
389
|
-
|
|
313
|
+
var footerRowSelectionHeight = (footerRowSelectionDom === null || footerRowSelectionDom === void 0 ? void 0 : footerRowSelectionDom.offsetHeight) || 50;
|
|
314
|
+
// 固定表格主体高度
|
|
390
315
|
if (fixedTableBody && !isFullscreen) {
|
|
391
316
|
var _pageContainerDom$off, _teamixNavDom$offsetH;
|
|
392
|
-
|
|
393
317
|
// 16px 为 padding
|
|
394
318
|
var pageHeaderHeight = ((_pageContainerDom$off = pageContainerDom === null || pageContainerDom === void 0 ? void 0 : pageContainerDom.offsetHeight) !== null && _pageContainerDom$off !== void 0 ? _pageContainerDom$off : 0) + 16;
|
|
395
|
-
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
|
|
319
|
+
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0;
|
|
396
320
|
|
|
321
|
+
// 1 为预留值,js无法取出精确高度,会被四舍五入
|
|
397
322
|
var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
|
|
398
|
-
|
|
399
323
|
if (tableBodyDom.clientHeight < tableBodyDom.scrollHeight) {
|
|
400
324
|
setFooterSuctionState(true);
|
|
401
325
|
} else {
|
|
402
326
|
setFooterSuctionState(false);
|
|
403
|
-
}
|
|
404
|
-
|
|
327
|
+
}
|
|
405
328
|
|
|
329
|
+
// 如果有切换区tab,那么重新计算
|
|
406
330
|
if (headerFixedTopSectionDom.clientHeight) {
|
|
407
331
|
var _headerFixedTopSectio;
|
|
332
|
+
var headerFixedTopSectionHeight = (_headerFixedTopSectio = headerFixedTopSectionDom.clientHeight) !== null && _headerFixedTopSectio !== void 0 ? _headerFixedTopSectio : 0;
|
|
408
333
|
|
|
409
|
-
|
|
334
|
+
// const clientTableBodyHeight =
|
|
410
335
|
// document.body.clientHeight - offsetHeaderHeight;
|
|
411
336
|
|
|
412
337
|
setHeaderHeight(headerFixedTopSectionHeight + teamixNavHeight + footerRowSelectionHeight + tableHeaderHeight + 1);
|
|
413
338
|
return;
|
|
414
339
|
}
|
|
415
|
-
|
|
416
340
|
setHeaderHeight(offsetHeaderHeight);
|
|
417
341
|
} else {
|
|
418
342
|
// 24px 为 padding
|
|
419
343
|
setHeaderHeight(headerHeight + tableHeaderHeight + footerRowSelectionHeight + 24 + (offset !== null && offset !== void 0 ? offset : 0) + 1);
|
|
420
344
|
}
|
|
421
345
|
}, 50);
|
|
422
|
-
};
|
|
423
|
-
|
|
346
|
+
};
|
|
424
347
|
|
|
348
|
+
// header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
|
425
349
|
var _useState25 = (0, _react.useState)(0),
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
350
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
351
|
+
headerHeight = _useState26[0],
|
|
352
|
+
setHeaderHeight = _useState26[1];
|
|
430
353
|
|
|
354
|
+
// 全屏显示 className
|
|
431
355
|
var _useState27 = (0, _react.useState)(false),
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
356
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
357
|
+
fullscreenState = _useState28[0],
|
|
358
|
+
setFullscreenState = _useState28[1];
|
|
359
|
+
// 切换全屏搜索开关
|
|
437
360
|
var filterEnableRef = (0, _react.useRef)({
|
|
438
361
|
fullscreen: false,
|
|
439
362
|
normal: true
|
|
440
|
-
});
|
|
363
|
+
});
|
|
441
364
|
|
|
365
|
+
// 非全屏状态下的
|
|
442
366
|
var normalDataFilterFormRef = (0, _react.useRef)();
|
|
443
367
|
var fullscreenDataFilterFormRef = (0, _react.useRef)();
|
|
444
368
|
var normalDataFilterForm = normalDataFilterFormRef.current;
|
|
445
|
-
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current;
|
|
369
|
+
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current;
|
|
446
370
|
|
|
447
|
-
|
|
448
|
-
|
|
371
|
+
// 传给 QueryFilter 的 formRef
|
|
372
|
+
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
|
373
|
+
// let dataFilterForm = dataFilterFormRef.current;
|
|
449
374
|
|
|
375
|
+
// 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
|
450
376
|
var _useState29 = (0, _react.useState)(false),
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
377
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
378
|
+
footerSuctionState = _useState30[0],
|
|
379
|
+
setFooterSuctionState = _useState30[1];
|
|
455
380
|
|
|
381
|
+
// TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
|
456
382
|
var getFooterSuctionState = function getFooterSuctionState() {
|
|
457
383
|
if (!footerSuction) {
|
|
458
384
|
return;
|
|
459
385
|
}
|
|
460
|
-
|
|
461
386
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
|
462
|
-
|
|
463
387
|
if (containerDom) {
|
|
464
388
|
var offsetHeight = containerDom.offsetHeight;
|
|
465
389
|
var scrollHeight = containerDom.scrollHeight;
|
|
466
|
-
|
|
467
390
|
if (offsetHeight < scrollHeight) {
|
|
468
391
|
setFooterSuctionState(true);
|
|
469
392
|
} else {
|
|
@@ -475,35 +398,29 @@ var ProTable = function ProTable(props) {
|
|
|
475
398
|
setFooterSuctionState(true);
|
|
476
399
|
}
|
|
477
400
|
}
|
|
478
|
-
};
|
|
479
|
-
|
|
401
|
+
};
|
|
480
402
|
|
|
403
|
+
// rowSelection 相关
|
|
481
404
|
var rowSelectionHook = (0, _useTableSelection.default)(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
|
|
482
405
|
// 当初始出现骨架屏的时候,不可选择
|
|
483
406
|
getProps: function getProps(record, index) {
|
|
484
407
|
var result = {};
|
|
485
|
-
|
|
486
408
|
if (propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.getProps) {
|
|
487
409
|
result = propsRowSelection.getProps(record, index);
|
|
488
410
|
}
|
|
489
|
-
|
|
490
411
|
if (showSkeleton && result) {
|
|
491
412
|
result.disabled = true;
|
|
492
413
|
}
|
|
493
|
-
|
|
494
414
|
return result;
|
|
495
415
|
},
|
|
496
416
|
titleProps: function titleProps() {
|
|
497
417
|
var result = {};
|
|
498
|
-
|
|
499
418
|
if (propsRowSelection === null || propsRowSelection === void 0 ? void 0 : propsRowSelection.titleProps) {
|
|
500
419
|
result = propsRowSelection.titleProps();
|
|
501
420
|
}
|
|
502
|
-
|
|
503
421
|
if (showSkeleton || disableSelectAll) {
|
|
504
422
|
result.disabled = true;
|
|
505
423
|
}
|
|
506
|
-
|
|
507
424
|
return result;
|
|
508
425
|
},
|
|
509
426
|
onChange: onChangeRowSelection
|
|
@@ -512,21 +429,21 @@ var ProTable = function ProTable(props) {
|
|
|
512
429
|
var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
|
|
513
430
|
(0, _react.useEffect)(function () {
|
|
514
431
|
getRowSelection && getRowSelection(rowSelectionHook);
|
|
515
|
-
}, [rowSelectionHook]);
|
|
432
|
+
}, [rowSelectionHook]);
|
|
516
433
|
|
|
434
|
+
// 获取 table 左下角 checkbox 属性
|
|
517
435
|
function getCheckAllProps() {
|
|
518
|
-
var
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
436
|
+
var _ref = rowSelection,
|
|
437
|
+
_ref$onChange = _ref.onChange,
|
|
438
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
439
|
+
_ref$onSelectAll = _ref.onSelectAll,
|
|
440
|
+
onSelectAll = _ref$onSelectAll === void 0 ? function () {} : _ref$onSelectAll,
|
|
441
|
+
_ref$selectedRowKeys = _ref.selectedRowKeys,
|
|
442
|
+
selectedRowKeys = _ref$selectedRowKeys === void 0 ? [] : _ref$selectedRowKeys,
|
|
443
|
+
getProps = _ref.getProps;
|
|
526
444
|
var dataSource = data;
|
|
527
445
|
var allRowKeys = dataSource.filter(function (d, i) {
|
|
528
446
|
var _getProps;
|
|
529
|
-
|
|
530
447
|
return getProps ? !((_getProps = getProps(d, i)) === null || _getProps === void 0 ? void 0 : _getProps.disabled) : true;
|
|
531
448
|
}).map(function (d) {
|
|
532
449
|
return (0, _utils.getDeepValue)(primaryKey || 'id', d);
|
|
@@ -542,15 +459,12 @@ var ProTable = function ProTable(props) {
|
|
|
542
459
|
result.push.apply(result, _toConsumableArray(allRowKeys.filter(function (k) {
|
|
543
460
|
return !selectedRowKeys.includes(k);
|
|
544
461
|
})));
|
|
545
|
-
|
|
546
462
|
_onChange(result, dataSource);
|
|
547
|
-
|
|
548
463
|
onSelectAll(check, dataSource);
|
|
549
464
|
} else {
|
|
550
465
|
_onChange(selectedRowKeys.filter(function (k) {
|
|
551
466
|
return !allRowKeys.includes(k);
|
|
552
467
|
}), []);
|
|
553
|
-
|
|
554
468
|
onSelectAll(check, []);
|
|
555
469
|
}
|
|
556
470
|
},
|
|
@@ -558,7 +472,6 @@ var ProTable = function ProTable(props) {
|
|
|
558
472
|
checked: nowCheckedKeys.length !== 0 && nowCheckedKeys.length === allRowKeys.length
|
|
559
473
|
};
|
|
560
474
|
}
|
|
561
|
-
|
|
562
475
|
(0, _react.useEffect)(function () {
|
|
563
476
|
if (typeof propsActionRef === 'function' && actionRef.current) {
|
|
564
477
|
// @ts-ignore
|
|
@@ -567,18 +480,19 @@ var ProTable = function ProTable(props) {
|
|
|
567
480
|
}, [propsActionRef]);
|
|
568
481
|
(0, _react.useEffect)(function () {
|
|
569
482
|
var _actionRef$current, _actionRef$current$se;
|
|
570
|
-
|
|
571
483
|
var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
|
|
572
484
|
setFilteredColumns(columns);
|
|
573
485
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
|
|
574
|
-
}, [propsColumns]);
|
|
486
|
+
}, [propsColumns]);
|
|
575
487
|
|
|
488
|
+
// dataSource 受控
|
|
576
489
|
(0, _react.useEffect)(function () {
|
|
577
490
|
if (propsDataSource) {
|
|
578
491
|
setData(propsDataSource);
|
|
579
492
|
}
|
|
580
|
-
}, [propsDataSource]);
|
|
493
|
+
}, [propsDataSource]);
|
|
581
494
|
|
|
495
|
+
// 初始化 ActionRef。
|
|
582
496
|
(0, _utils2.initActionRef)(actionRef, {
|
|
583
497
|
getState: function getState() {
|
|
584
498
|
return actionRefState;
|
|
@@ -594,32 +508,29 @@ var ProTable = function ProTable(props) {
|
|
|
594
508
|
if (!actionRefCallback[state]) {
|
|
595
509
|
actionRefCallback[state] = {};
|
|
596
510
|
}
|
|
597
|
-
|
|
598
511
|
actionRefCallback[state][name] = fun;
|
|
599
512
|
},
|
|
600
513
|
off: function off(name) {
|
|
601
|
-
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (
|
|
602
|
-
var
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
k = _ref4[0];
|
|
609
|
-
|
|
514
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref2) {
|
|
515
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
516
|
+
k = _ref3[0],
|
|
517
|
+
v = _ref3[1];
|
|
518
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref4) {
|
|
519
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
520
|
+
k = _ref5[0];
|
|
610
521
|
return k !== name;
|
|
611
522
|
}));
|
|
612
523
|
return [k, filterV];
|
|
613
524
|
}));
|
|
614
525
|
}
|
|
615
|
-
});
|
|
526
|
+
});
|
|
616
527
|
|
|
528
|
+
// 绑定 Actions
|
|
617
529
|
(0, _utils2.useActionType)(actionRef, {
|
|
618
530
|
fullScreen: function fullScreen() {
|
|
619
531
|
var _actionRef$current2, _actionRef$current2$s;
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
532
|
+
var state = !fullscreenState;
|
|
533
|
+
// 全屏时需要重新计算header高度
|
|
623
534
|
setFullscreenState(state);
|
|
624
535
|
getHeaderHeight(state);
|
|
625
536
|
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'fullScreenState', state);
|
|
@@ -627,12 +538,10 @@ var ProTable = function ProTable(props) {
|
|
|
627
538
|
},
|
|
628
539
|
setColumn: function setColumn(newColumns) {
|
|
629
540
|
var _actionRef$current3, _actionRef$current3$s;
|
|
630
|
-
|
|
631
541
|
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
632
542
|
var columns = processColumns(newColumns, propsColumns);
|
|
633
543
|
setFilteredColumns(columns);
|
|
634
544
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterColumns', columns);
|
|
635
|
-
|
|
636
545
|
if (update) {
|
|
637
546
|
(0, _utils2.emit)('refreshFilterState', newColumns);
|
|
638
547
|
}
|
|
@@ -649,22 +558,18 @@ var ProTable = function ProTable(props) {
|
|
|
649
558
|
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
|
650
559
|
setCurrentPage(params[targetPageKey]);
|
|
651
560
|
}
|
|
652
|
-
|
|
653
561
|
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
|
654
562
|
setPageSize(params[targetPageSizeKey]);
|
|
655
563
|
}
|
|
656
|
-
|
|
657
564
|
_request(params);
|
|
658
565
|
},
|
|
659
566
|
reset: function reset() {
|
|
660
567
|
var _actionRef$current4, _actionRef$current4$s, _dataFilterFormRef$cu;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
568
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
|
569
|
+
// 清空列过滤参数
|
|
664
570
|
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
|
|
665
571
|
(_dataFilterFormRef$cu = dataFilterFormRef.current) === null || _dataFilterFormRef$cu === void 0 ? void 0 : _dataFilterFormRef$cu.reset();
|
|
666
572
|
setCurrentPage(1);
|
|
667
|
-
|
|
668
573
|
_request(_defineProperty({}, targetPageKey, 1));
|
|
669
574
|
},
|
|
670
575
|
resetPage: function resetPage() {
|
|
@@ -692,32 +597,29 @@ var ProTable = function ProTable(props) {
|
|
|
692
597
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight(offset) {
|
|
693
598
|
getHeaderHeight(fullscreenState, offset);
|
|
694
599
|
}
|
|
695
|
-
});
|
|
600
|
+
});
|
|
696
601
|
|
|
602
|
+
// 将 Actions 绑定到传入的 propsActionRef 中
|
|
697
603
|
if (propsActionRef) {
|
|
698
604
|
propsActionRef.current = actionRef.current;
|
|
699
605
|
}
|
|
700
|
-
|
|
701
606
|
function onFormatResult(next) {
|
|
702
607
|
var _next$data;
|
|
703
|
-
|
|
704
608
|
props.onFormatResult && props.onFormatResult(next);
|
|
705
609
|
var time = autoRefresh ? autoRefresh(next.data) : false;
|
|
706
|
-
|
|
707
610
|
if (Number.isInteger(time) && time >= 1000) {
|
|
708
611
|
autoRefreshTimerRef.current = setTimeout(function () {
|
|
709
612
|
// 自动刷新不显示 loading
|
|
710
613
|
_request({}, true);
|
|
711
614
|
}, Number(time));
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
|
|
615
|
+
}
|
|
616
|
+
// 设置 dataSource、total
|
|
715
617
|
setData(next.data || []);
|
|
716
618
|
setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
|
|
717
619
|
setShowSkeleton(false);
|
|
718
|
-
}
|
|
719
|
-
|
|
620
|
+
}
|
|
720
621
|
|
|
622
|
+
// 请求表格数据工具函数
|
|
721
623
|
var getData = (0, _utils.useRequest)(function (params) {
|
|
722
624
|
return _defineProperty({
|
|
723
625
|
url: url,
|
|
@@ -726,13 +628,13 @@ var ProTable = function ProTable(props) {
|
|
|
726
628
|
}, {
|
|
727
629
|
// 使用 request 方法代替 fetch
|
|
728
630
|
requestMethod: function requestMethod(params) {
|
|
729
|
-
|
|
631
|
+
// 支持使用 requestConfig 自定义请求配置
|
|
632
|
+
return (0, _utils.request)(_objectSpread(_objectSpread({}, params), requestConfig));
|
|
730
633
|
},
|
|
731
634
|
manual: true,
|
|
732
635
|
onSuccess: function onSuccess(result) {
|
|
733
636
|
props.onSuccess && props.onSuccess(result);
|
|
734
637
|
var nextData = result;
|
|
735
|
-
|
|
736
638
|
if (formatResult) {
|
|
737
639
|
if (typeof formatResult === 'function') {
|
|
738
640
|
nextData = formatResult(result) || {};
|
|
@@ -744,7 +646,6 @@ var ProTable = function ProTable(props) {
|
|
|
744
646
|
};
|
|
745
647
|
}
|
|
746
648
|
}
|
|
747
|
-
|
|
748
649
|
if (nextData instanceof Promise) {
|
|
749
650
|
nextData.then(function (res) {
|
|
750
651
|
onFormatResult(res);
|
|
@@ -753,62 +654,56 @@ var ProTable = function ProTable(props) {
|
|
|
753
654
|
});
|
|
754
655
|
} else {
|
|
755
656
|
onFormatResult(nextData);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
|
|
657
|
+
}
|
|
658
|
+
// 重新计算是否需要吸底
|
|
759
659
|
if (footerSuction) {
|
|
760
660
|
getFooterSuctionState();
|
|
761
661
|
}
|
|
762
|
-
|
|
763
662
|
if (fixedTableBody) {
|
|
764
663
|
getHeaderHeight(fullscreenState);
|
|
765
664
|
}
|
|
766
665
|
},
|
|
767
666
|
onError: function onError(error) {
|
|
768
667
|
setShowSkeleton(false);
|
|
769
|
-
|
|
770
668
|
if (props.onError) {
|
|
771
669
|
props.onError(error);
|
|
772
|
-
} else {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
670
|
+
} else {
|
|
671
|
+
// Message.error(error.toString());
|
|
672
|
+
}
|
|
673
|
+
// 重新计算是否需要吸底
|
|
776
674
|
if (footerSuction) {
|
|
777
675
|
getFooterSuctionState();
|
|
778
676
|
}
|
|
779
|
-
|
|
780
677
|
if (fixedTableBody) {
|
|
781
678
|
getHeaderHeight(fullscreenState);
|
|
782
679
|
}
|
|
783
680
|
}
|
|
784
|
-
});
|
|
681
|
+
});
|
|
785
682
|
|
|
683
|
+
// 请求函数
|
|
786
684
|
function _request(params, noLoading, filterParams) {
|
|
787
685
|
var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
|
|
788
|
-
|
|
789
686
|
// 如果没有传 url 且没有 customRequest,直接返回
|
|
790
687
|
if (!url && !customRequest) {
|
|
791
688
|
return;
|
|
792
689
|
}
|
|
793
|
-
|
|
794
690
|
var nextShowLoading = !noLoading;
|
|
795
|
-
nextShowLoading !== showLoading && setShowLoading(nextShowLoading);
|
|
691
|
+
nextShowLoading !== showLoading && setShowLoading(nextShowLoading);
|
|
692
|
+
// 请求前需要优先清空列过滤条件
|
|
796
693
|
// actionRef.current?.setFilterRules?.({});
|
|
694
|
+
var sortParams = targetFormatSort(sort);
|
|
695
|
+
// 筛选区请求参数
|
|
696
|
+
var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values;
|
|
697
|
+
// 列过滤请求参数
|
|
698
|
+
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
|
797
699
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values; // 列过滤请求参数
|
|
801
|
-
|
|
802
|
-
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
|
803
|
-
|
|
700
|
+
// 格式化后的请求参数
|
|
804
701
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
|
|
805
|
-
|
|
806
702
|
if (requestData) {
|
|
807
703
|
if (autoRefreshTimerRef.current) {
|
|
808
704
|
clearTimeout(autoRefreshTimerRef.current);
|
|
809
705
|
autoRefreshTimerRef.current = null;
|
|
810
706
|
}
|
|
811
|
-
|
|
812
707
|
if (!(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.searchUndefined)) {
|
|
813
708
|
Object.keys(requestData).forEach(function (key) {
|
|
814
709
|
if (requestData[key] === undefined) {
|
|
@@ -816,43 +711,38 @@ var ProTable = function ProTable(props) {
|
|
|
816
711
|
}
|
|
817
712
|
});
|
|
818
713
|
}
|
|
819
|
-
|
|
820
714
|
if (!(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.searchEmptyString)) {
|
|
821
715
|
Object.keys(requestData).forEach(function (key) {
|
|
822
716
|
if (requestData[key] === '') {
|
|
823
717
|
delete requestData[key];
|
|
824
718
|
}
|
|
825
719
|
});
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
|
|
720
|
+
}
|
|
721
|
+
// 如果使用自定义请求
|
|
829
722
|
if (customRequest && typeof customRequest === 'function') {
|
|
830
723
|
setCustomTableLoading(true);
|
|
831
724
|
customRequest(requestData).then(function (res) {
|
|
832
725
|
var data = res.data,
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
726
|
+
total = res.total,
|
|
727
|
+
success = res.success;
|
|
836
728
|
if (success === true) {
|
|
837
729
|
// 设置 dataSource、total
|
|
838
730
|
setData(data || []);
|
|
839
731
|
setTotal(total || (data === null || data === void 0 ? void 0 : data.length));
|
|
840
732
|
setShowSkeleton(false);
|
|
841
733
|
setCustomTableLoading(false);
|
|
842
|
-
}
|
|
843
|
-
|
|
734
|
+
}
|
|
844
735
|
|
|
736
|
+
// 重新计算是否需要吸底
|
|
845
737
|
if (footerSuction) {
|
|
846
738
|
getFooterSuctionState();
|
|
847
739
|
}
|
|
848
|
-
|
|
849
740
|
if (fixedTableBody) {
|
|
850
741
|
getHeaderHeight(fullscreenState);
|
|
851
|
-
}
|
|
852
|
-
|
|
742
|
+
}
|
|
853
743
|
|
|
744
|
+
// customRequest 中支持 autoRefresh
|
|
854
745
|
var time = autoRefresh ? autoRefresh(data) : false;
|
|
855
|
-
|
|
856
746
|
if (Number.isInteger(time) && time >= 1000) {
|
|
857
747
|
autoRefreshTimerRef.current = setTimeout(function () {
|
|
858
748
|
// 自动刷新不显示 loading
|
|
@@ -865,23 +755,19 @@ var ProTable = function ProTable(props) {
|
|
|
865
755
|
}
|
|
866
756
|
}
|
|
867
757
|
}
|
|
868
|
-
|
|
869
758
|
function onSort(dataIndex, order) {
|
|
870
759
|
var nextSort = _defineProperty({}, dataIndex, order);
|
|
871
|
-
|
|
872
760
|
setSort(nextSort);
|
|
873
|
-
|
|
874
761
|
_request(targetFormatSort(nextSort));
|
|
875
|
-
}
|
|
876
|
-
|
|
762
|
+
}
|
|
877
763
|
|
|
764
|
+
// 处理 dataFilter 中的 onFilter、onReset
|
|
878
765
|
var dataFilter = _objectSpread(_objectSpread({
|
|
879
766
|
mode: 'inline',
|
|
880
767
|
forceClear: true
|
|
881
768
|
}, propsDataFilter), {}, {
|
|
882
769
|
onInit: (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) || requestWhenMount ? function (values) {
|
|
883
770
|
var _propsDataFilter$onIn;
|
|
884
|
-
|
|
885
771
|
// 表单初始化请求处理
|
|
886
772
|
propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$onIn = propsDataFilter.onInit) === null || _propsDataFilter$onIn === void 0 ? void 0 : _propsDataFilter$onIn.call(propsDataFilter, values);
|
|
887
773
|
!fullscreenState && requestWhenMount && _request({}, false, values);
|
|
@@ -889,39 +775,32 @@ var ProTable = function ProTable(props) {
|
|
|
889
775
|
} : undefined,
|
|
890
776
|
onFilter: function onFilter(values) {
|
|
891
777
|
var _actionRef$current6, _actionRef$current6$c;
|
|
892
|
-
|
|
893
778
|
// 全屏状态,判断全屏表单onFilter是否禁用
|
|
894
779
|
if (fullscreenState && !filterEnableRef.current.fullscreen) {
|
|
895
780
|
filterEnableRef.current.fullscreen = true;
|
|
896
781
|
return;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
|
|
782
|
+
}
|
|
783
|
+
// 非全屏状态,判断普通表单onFiler是否禁用
|
|
900
784
|
if (!fullscreenState && !filterEnableRef.current.normal) {
|
|
901
785
|
filterEnableRef.current.normal = true;
|
|
902
786
|
return;
|
|
903
787
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
788
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
|
|
789
|
+
// 搜索变化时,暂时先清空选择
|
|
907
790
|
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
|
|
908
791
|
setCurrentPage(1);
|
|
909
792
|
console.log('currentPageSize1', pageSize);
|
|
910
|
-
|
|
911
793
|
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
|
912
794
|
},
|
|
913
795
|
onReset: function onReset(values) {
|
|
914
796
|
var _dataFilterFormRef$cu3;
|
|
915
|
-
|
|
916
797
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
|
917
798
|
(_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
|
|
918
799
|
setCurrentPage(1);
|
|
919
800
|
console.log('currentPageSize2', pageSize);
|
|
920
|
-
|
|
921
801
|
_request(_defineProperty({}, targetPageKey, 1), false, values);
|
|
922
802
|
}
|
|
923
803
|
});
|
|
924
|
-
|
|
925
804
|
var getTableLoading = function getTableLoading() {
|
|
926
805
|
if (!customRequest) {
|
|
927
806
|
return showLoading && !showSkeleton && (getData.loading || props.loading);
|
|
@@ -929,7 +808,6 @@ var ProTable = function ProTable(props) {
|
|
|
929
808
|
return showLoading && !showSkeleton && (customTableLoading || props.loading);
|
|
930
809
|
}
|
|
931
810
|
};
|
|
932
|
-
|
|
933
811
|
var renderTable = function renderTable(isFullScreen) {
|
|
934
812
|
if (propsColumns) {
|
|
935
813
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -948,8 +826,9 @@ var ProTable = function ProTable(props) {
|
|
|
948
826
|
afterDataFilter: afterDataFilter,
|
|
949
827
|
dataFilterFormRef: isFullScreen ? fullscreenDataFilterFormRef : normalDataFilterFormRef,
|
|
950
828
|
rowSelection: rowSelection,
|
|
951
|
-
filterColumnType: filterColumnType
|
|
952
|
-
|
|
829
|
+
filterColumnType: filterColumnType,
|
|
830
|
+
fullScreenState: isFullScreen
|
|
831
|
+
}), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, _extends({
|
|
953
832
|
hasBorder: false,
|
|
954
833
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
|
955
834
|
columns: (0, _genProColumnToColumn.default)(filteredColumns, showSkeleton, actionRef, context),
|
|
@@ -968,75 +847,61 @@ var ProTable = function ProTable(props) {
|
|
|
968
847
|
sortIcons: (0, _getTableSortIcons.default)(),
|
|
969
848
|
fixedHeader: fullscreenState || fixedTableBody,
|
|
970
849
|
maxBodyHeight: "calc(100vh - ".concat(headerHeight, "px)")
|
|
850
|
+
// 过滤出可以传到 Table 的 Props
|
|
971
851
|
}, (0, _utils.pickProps)((0, _getTableProps.default)(), otherProps))));
|
|
972
852
|
} else {
|
|
973
853
|
// 不传 columns 直接返回原始 Table
|
|
974
|
-
return /*#__PURE__*/_react.default.createElement(_components.Table,
|
|
854
|
+
return /*#__PURE__*/_react.default.createElement(_components.Table, _extends({
|
|
975
855
|
className: cls()
|
|
976
856
|
}, (0, _utils.pickProps)((0, _getTableProps.default)(), otherProps)));
|
|
977
857
|
}
|
|
978
858
|
};
|
|
979
|
-
|
|
980
859
|
var renderFooterAction = function renderFooterAction() {
|
|
981
|
-
var
|
|
982
|
-
|
|
983
|
-
if (_typeof(footerAction) === 'object' && (footerAction === null || footerAction === void 0 ? void 0 : (_footerAction$actions = footerAction.actions) === null || _footerAction$actions === void 0 ? void 0 : _footerAction$actions.length) >= 0) {
|
|
860
|
+
var _actions;
|
|
861
|
+
if (_typeof(footerAction) === 'object' && (footerAction === null || footerAction === void 0 ? void 0 : (_actions = footerAction.actions) === null || _actions === void 0 ? void 0 : _actions.length) >= 0) {
|
|
984
862
|
// 默认 context
|
|
985
863
|
var defaultContext = {
|
|
986
864
|
action: actionRef.current,
|
|
987
865
|
rowSelection: rowSelection
|
|
988
|
-
};
|
|
989
|
-
|
|
866
|
+
};
|
|
867
|
+
// 未选择的时候所有 button 默认 disabled
|
|
990
868
|
var targetActions = footerAction.actions.map(function (action) {
|
|
991
869
|
return _objectSpread(_objectSpread({}, action), {}, {
|
|
992
870
|
disabled: (action === null || action === void 0 ? void 0 : action.disabled) || selectedCount === 0
|
|
993
871
|
});
|
|
994
872
|
});
|
|
995
|
-
|
|
996
873
|
var targetFooterActions = _objectSpread(_objectSpread({}, footerAction), {}, {
|
|
997
874
|
actions: targetActions
|
|
998
875
|
});
|
|
999
|
-
|
|
1000
876
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1001
877
|
className: cls('footer-action')
|
|
1002
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
878
|
+
}, /*#__PURE__*/_react.default.createElement(_actions2.ProActionGroup, _extends({}, targetFooterActions, {
|
|
1003
879
|
context: _objectSpread(_objectSpread({}, defaultContext), targetFooterActions === null || targetFooterActions === void 0 ? void 0 : targetFooterActions.context)
|
|
1004
880
|
})));
|
|
1005
881
|
} else return footerAction;
|
|
1006
882
|
};
|
|
1007
|
-
|
|
1008
883
|
var renderFooter = function renderFooter() {
|
|
1009
884
|
function onChangePagination(currentPage) {
|
|
1010
885
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1011
|
-
|
|
1012
886
|
// 翻页默认清空选择
|
|
1013
887
|
if (!reserveSelectedRecords) {
|
|
1014
888
|
var _actionRef$current7, _actionRef$current7$c;
|
|
1015
|
-
|
|
1016
889
|
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
|
1017
890
|
}
|
|
1018
|
-
|
|
1019
891
|
setCurrentPage(currentPage);
|
|
1020
|
-
|
|
1021
892
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
|
1022
893
|
}
|
|
1023
|
-
|
|
1024
894
|
function onChangePaginationSize(currentPageSize) {
|
|
1025
895
|
var _request5;
|
|
1026
|
-
|
|
1027
896
|
// 翻页默认清空选择
|
|
1028
897
|
if (!reserveSelectedRecords) {
|
|
1029
898
|
var _actionRef$current8, _actionRef$current8$c;
|
|
1030
|
-
|
|
1031
899
|
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
|
1032
900
|
}
|
|
1033
|
-
|
|
1034
901
|
setPageSize(currentPageSize);
|
|
1035
902
|
setCurrentPage(1);
|
|
1036
|
-
|
|
1037
903
|
_request((_request5 = {}, _defineProperty(_request5, targetPageSizeKey, currentPageSize), _defineProperty(_request5, targetPageKey, 1), _request5));
|
|
1038
904
|
}
|
|
1039
|
-
|
|
1040
905
|
function renderRowSelection() {
|
|
1041
906
|
if (rowSelection) {
|
|
1042
907
|
if (showSkeleton) {
|
|
@@ -1046,7 +911,7 @@ var ProTable = function ProTable(props) {
|
|
|
1046
911
|
} else {
|
|
1047
912
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1048
913
|
className: cls('footer-left-wrapper')
|
|
1049
|
-
}, rowSelection.mode !== 'single' && /*#__PURE__*/_react.default.createElement(_components.Checkbox,
|
|
914
|
+
}, rowSelection.mode !== 'single' && /*#__PURE__*/_react.default.createElement(_components.Checkbox, _extends({
|
|
1050
915
|
className: cls("footer-checkbox-".concat(size))
|
|
1051
916
|
}, getCheckAllProps())), footerAction && renderFooterAction(), /*#__PURE__*/_react.default.createElement("span", {
|
|
1052
917
|
className: cls('selected-msg')
|
|
@@ -1066,7 +931,6 @@ var ProTable = function ProTable(props) {
|
|
|
1066
931
|
}
|
|
1067
932
|
}
|
|
1068
933
|
}
|
|
1069
|
-
|
|
1070
934
|
if (showPagination) {
|
|
1071
935
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1072
936
|
className: cls('footer', {
|
|
@@ -1075,15 +939,16 @@ var ProTable = function ProTable(props) {
|
|
|
1075
939
|
})
|
|
1076
940
|
}, renderRowSelection(), /*#__PURE__*/_react.default.createElement("div", {
|
|
1077
941
|
className: cls('footer-right-wrapper')
|
|
1078
|
-
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, data.length > 0 && /*#__PURE__*/_react.default.createElement(_Pagination.default,
|
|
942
|
+
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, data.length > 0 && /*#__PURE__*/_react.default.createElement(_Pagination.default, _extends({
|
|
1079
943
|
className: cls('pagination'),
|
|
1080
944
|
onChange: function onChange(number) {
|
|
1081
945
|
return onChangePagination(number);
|
|
1082
946
|
},
|
|
1083
947
|
total: total,
|
|
1084
|
-
responsivePaginationType: responsivePaginationType
|
|
948
|
+
responsivePaginationType: responsivePaginationType
|
|
1085
949
|
// shape="arrow-only"
|
|
1086
950
|
// pageSizePosition="end"
|
|
951
|
+
,
|
|
1087
952
|
totalRender: function totalRender(total) {
|
|
1088
953
|
return (0, _utils.getMessage)('total', {
|
|
1089
954
|
total: new Intl.NumberFormat().format(total)
|
|
@@ -1107,20 +972,18 @@ var ProTable = function ProTable(props) {
|
|
|
1107
972
|
className: cls('footer-right-wrapper')
|
|
1108
973
|
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : footer));
|
|
1109
974
|
}
|
|
1110
|
-
};
|
|
1111
|
-
|
|
975
|
+
};
|
|
1112
976
|
|
|
977
|
+
// 判断是否需要吸底
|
|
1113
978
|
var fixFooterState = (0, _react.useMemo)(function () {
|
|
1114
979
|
if (fullscreenState) {
|
|
1115
980
|
return false;
|
|
1116
981
|
}
|
|
1117
|
-
|
|
1118
982
|
if (fixedTableBody || footerSuction) {
|
|
1119
983
|
if (footerSuctionState) {
|
|
1120
984
|
return true;
|
|
1121
985
|
}
|
|
1122
986
|
}
|
|
1123
|
-
|
|
1124
987
|
return false;
|
|
1125
988
|
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
|
1126
989
|
return /*#__PURE__*/_react.default.createElement(_Fullscreen.default, {
|
|
@@ -1130,13 +993,13 @@ var ProTable = function ProTable(props) {
|
|
|
1130
993
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1131
994
|
className: cls({
|
|
1132
995
|
'': true,
|
|
1133
|
-
fullscreen: fullscreenState
|
|
1134
|
-
|
|
996
|
+
fullscreen: fullscreenState
|
|
997
|
+
// 'footer-suction': footerSuctionState && footerSuction,
|
|
1135
998
|
}),
|
|
999
|
+
|
|
1136
1000
|
ref: tableRef
|
|
1137
1001
|
}, renderTable(isFullScreen), fixFooterState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !fixFooterState && renderFooter());
|
|
1138
1002
|
});
|
|
1139
1003
|
};
|
|
1140
|
-
|
|
1141
1004
|
var _default = ProTable;
|
|
1142
1005
|
exports.default = _default;
|