@teamix/pro 1.1.3 → 1.1.7
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 +97 -0
- package/dist/pro.css +1 -1
- package/dist/pro.js +1198 -1228
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +1 -1
- package/es/actions/base.d.ts +13 -0
- package/es/actions/base.js +23 -0
- package/es/actions/confirm.d.ts +7 -0
- package/es/actions/confirm.js +11 -0
- package/es/actions/danger-confirm.d.ts +7 -0
- package/es/actions/danger-confirm.js +14 -0
- package/es/actions/dialog-component.d.ts +10 -0
- package/es/actions/dialog-component.js +25 -0
- package/es/actions/dialog-form.d.ts +15 -0
- package/es/actions/dialog-form.js +129 -0
- package/es/actions/dialog-table.d.ts +9 -0
- package/es/actions/dialog-table.js +10 -0
- package/es/actions/dialog.d.ts +17 -0
- package/es/actions/dialog.js +197 -0
- package/es/actions/drawer-form.d.ts +6 -0
- package/es/actions/drawer-form.js +7 -0
- package/es/actions/drawer-table.d.ts +6 -0
- package/es/actions/drawer-table.js +7 -0
- package/es/actions/drawer.d.ts +6 -0
- package/es/actions/drawer.js +7 -0
- package/es/actions/error.d.ts +7 -0
- package/es/actions/error.js +11 -0
- package/es/actions/index.d.ts +71 -0
- package/es/actions/index.js +337 -0
- package/es/actions/index.scss +34 -0
- package/es/actions/link.d.ts +14 -0
- package/es/actions/link.js +45 -0
- package/es/actions/notice.d.ts +7 -0
- package/es/actions/notice.js +11 -0
- package/es/actions/request.d.ts +9 -0
- package/es/actions/request.js +60 -0
- package/es/card/index.d.ts +47 -0
- package/es/card/index.js +159 -0
- package/es/card/index.scss +98 -0
- package/es/field/index.d.ts +3 -0
- package/es/field/index.js +3 -0
- package/es/form/Components/Editable/index.d.ts +20 -0
- package/es/form/Components/Editable/index.js +228 -0
- package/es/form/Components/FormGroup/index.d.ts +13 -0
- package/es/form/Components/FormGroup/index.js +89 -0
- package/es/form/Components/FormGroup/index.scss +23 -0
- package/es/form/Components/ProField/index.d.ts +150 -0
- package/es/form/Components/ProField/index.js +53 -0
- package/es/form/Components/Query/index.d.ts +4 -0
- package/es/form/Components/Query/index.js +70 -0
- package/es/form/Components/Query/index.scss +90 -0
- package/es/form/Components/QueryFilter/index.d.ts +3 -0
- package/es/form/Components/QueryFilter/index.js +111 -0
- package/es/form/Components/Search/index.d.ts +11 -0
- package/es/form/Components/Search/index.js +89 -0
- package/es/form/Filter/index.d.ts +16 -0
- package/es/form/Filter/index.js +218 -0
- package/es/form/ProForm/index.d.ts +5 -0
- package/es/form/ProForm/index.js +100 -0
- package/es/form/ProForm/index.scss +254 -0
- package/es/form/SchemaForm/adapterComponent.d.ts +5 -0
- package/es/form/SchemaForm/adapterComponent.js +17 -0
- package/es/form/SchemaForm/adapterDecorator.d.ts +6 -0
- package/es/form/SchemaForm/adapterDecorator.js +28 -0
- package/es/form/SchemaForm/adapterType.d.ts +5 -0
- package/es/form/SchemaForm/adapterType.js +52 -0
- package/es/form/SchemaForm/index.d.ts +4 -0
- package/es/form/SchemaForm/index.js +259 -0
- package/es/form/SchemaForm/initializeArrayCards.d.ts +3 -0
- package/es/form/SchemaForm/initializeArrayCards.js +24 -0
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +3 -0
- package/es/form/SchemaForm/initializeArrayCollapse.js +24 -0
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +3 -0
- package/es/form/SchemaForm/initializeArrayIcon.js +57 -0
- package/es/form/SchemaForm/initializeArrayItems.d.ts +3 -0
- package/es/form/SchemaForm/initializeArrayItems.js +38 -0
- package/es/form/SchemaForm/initializeArrayTable.d.ts +3 -0
- package/es/form/SchemaForm/initializeArrayTable.js +56 -0
- package/es/form/SchemaForm/initializeFormButton.d.ts +3 -0
- package/es/form/SchemaForm/initializeFormButton.js +75 -0
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +3 -0
- package/es/form/SchemaForm/initializeFormCollapse.js +43 -0
- package/es/form/SchemaForm/initializeFormGroup.d.ts +3 -0
- package/es/form/SchemaForm/initializeFormGroup.js +46 -0
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -0
- package/es/form/SchemaForm/initializeFormStep.js +48 -0
- package/es/form/SchemaForm/initializeFormTab.d.ts +3 -0
- package/es/form/SchemaForm/initializeFormTab.js +53 -0
- package/es/form/SchemaForm/initializeProField.d.ts +5 -0
- package/es/form/SchemaForm/initializeProField.js +67 -0
- package/es/form/SchemaForm/initializeRequest.d.ts +11 -0
- package/es/form/SchemaForm/initializeRequest.js +25 -0
- package/es/form/SchemaForm/reactions.d.ts +4 -0
- package/es/form/SchemaForm/reactions.js +62 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +35 -0
- package/es/form/typing.d.ts +69 -0
- package/es/form/typing.js +1 -0
- package/es/form/utils.d.ts +9 -0
- package/es/form/utils.js +108 -0
- package/es/form/warning.d.ts +3 -0
- package/es/form/warning.js +16 -0
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/index.d.ts +24 -0
- package/es/index.js +29 -0
- package/es/info/components/FormItem/index.d.ts +5 -0
- package/es/info/components/FormItem/index.js +63 -0
- package/es/info/components/FormItem/index.scss +60 -0
- package/es/info/components/InfoGroup/index.d.ts +5 -0
- package/es/info/components/InfoGroup/index.js +47 -0
- package/es/info/components/InfoGroup/index.scss +14 -0
- package/es/info/components/InfoValueItem/index.d.ts +5 -0
- package/es/info/components/InfoValueItem/index.js +223 -0
- package/es/info/components/InfoValueItem/index.scss +21 -0
- package/es/info/components/baseInfo/index.d.ts +7 -0
- package/es/info/components/baseInfo/index.js +73 -0
- package/es/info/components/baseInfo/index.scss +3 -0
- package/es/info/components/headerInfo/index.d.ts +7 -0
- package/es/info/components/headerInfo/index.js +85 -0
- package/es/info/components/headerInfo/index.scss +0 -0
- package/es/info/components/tableInfo/index.d.ts +8 -0
- package/es/info/components/tableInfo/index.js +175 -0
- package/es/info/components/tableInfo/index.scss +18 -0
- package/es/info/index.d.ts +10 -0
- package/es/info/index.js +87 -0
- package/es/info/index.scss +12 -0
- package/es/info/typing.d.ts +157 -0
- package/es/info/typing.js +1 -0
- package/es/info/utils/index.d.ts +12 -0
- package/es/info/utils/index.js +33 -0
- package/es/info/utils/layout.d.ts +2 -0
- package/es/info/utils/layout.js +58 -0
- package/es/info/utils/useInfoRequest.d.ts +14 -0
- package/es/info/utils/useInfoRequest.js +73 -0
- package/es/info/utils/utils.d.ts +1 -0
- package/es/info/utils/utils.js +13 -0
- package/es/layout/index.d.ts +2 -0
- package/es/layout/index.js +3 -0
- package/es/nocode/configurators/Card.d.ts +3 -0
- package/es/nocode/configurators/Card.js +109 -0
- package/es/nocode/configurators/PageHeader.d.ts +3 -0
- package/es/nocode/configurators/PageHeader.js +202 -0
- package/es/nocode/configurators/ProTable.d.ts +3 -0
- package/es/nocode/configurators/ProTable.js +320 -0
- package/es/nocode/configurators/common.d.ts +188 -0
- package/es/nocode/configurators/common.js +318 -0
- package/es/nocode/configurators/index.d.ts +15 -0
- package/es/nocode/configurators/index.js +27 -0
- package/es/nocode/configurators/map.d.ts +2 -0
- package/es/nocode/configurators/map.js +8 -0
- package/es/nocode/index.d.ts +8 -0
- package/es/nocode/index.js +11 -0
- package/es/nocode/index.scss +93 -0
- package/es/nocode/pages/editor.d.ts +12 -0
- package/es/nocode/pages/editor.js +40 -0
- package/es/nocode/pages/index.d.ts +14 -0
- package/es/nocode/pages/index.js +41 -0
- package/es/nocode/pages/playground.d.ts +11 -0
- package/es/nocode/pages/playground.js +130 -0
- package/es/nocode/pages/renderer.d.ts +10 -0
- package/es/nocode/pages/renderer.js +144 -0
- package/es/nocode/playground.d.ts +14 -0
- package/es/nocode/playground.js +68 -0
- package/es/page-container/index.d.ts +3 -0
- package/es/page-container/index.js +3 -0
- package/es/page-header/index.d.ts +43 -0
- package/es/page-header/index.js +233 -0
- package/es/page-header/index.scss +169 -0
- package/es/skeleton/index.d.ts +3 -0
- package/es/skeleton/index.js +3 -0
- package/es/table/components/Filter/index.d.ts +9 -0
- package/es/table/components/Filter/index.js +223 -0
- package/es/table/components/Filter/index.scss +23 -0
- package/es/table/components/Layout/index.d.ts +5 -0
- package/es/table/components/Layout/index.js +242 -0
- package/es/table/components/Layout/index.scss +39 -0
- package/es/table/components/QuickAction/index.d.ts +10 -0
- package/es/table/components/QuickAction/index.js +53 -0
- package/es/table/components/QuickAction/index.scss +0 -0
- package/es/table/components/ToolBar/DensityIcon.d.ts +4 -0
- package/es/table/components/ToolBar/DensityIcon.js +117 -0
- package/es/table/components/ToolBar/FilterColumnIcon.d.ts +4 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +284 -0
- package/es/table/components/ToolBar/FullScreenIcon.d.ts +4 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +89 -0
- package/es/table/components/ToolBar/Fullscreen.d.ts +10 -0
- package/es/table/components/ToolBar/Fullscreen.js +68 -0
- package/es/table/components/ToolBar/RefreshIcon.d.ts +4 -0
- package/es/table/components/ToolBar/RefreshIcon.js +45 -0
- package/es/table/components/ToolBar/index.d.ts +5 -0
- package/es/table/components/ToolBar/index.js +79 -0
- package/es/table/components/ToolBar/index.scss +110 -0
- package/es/table/index.d.ts +6 -0
- package/es/table/index.js +607 -0
- package/es/table/index.scss +103 -0
- package/es/table/typing.d.ts +222 -0
- package/es/table/typing.js +1 -0
- package/es/table/utils/columnRender.d.ts +13 -0
- package/es/table/utils/columnRender.js +185 -0
- package/es/table/utils/genProColumnToColumn.d.ts +9 -0
- package/es/table/utils/genProColumnToColumn.js +51 -0
- package/es/table/utils/getTableProps.d.ts +2 -0
- package/es/table/utils/getTableProps.js +4 -0
- package/es/table/utils/getTableSortIcons.d.ts +3 -0
- package/es/table/utils/getTableSortIcons.js +21 -0
- package/es/table/utils/index.d.ts +4 -0
- package/es/table/utils/index.js +100 -0
- package/es/table/utils/useTableSelection.d.ts +3 -0
- package/es/table/utils/useTableSelection.js +107 -0
- package/es/templates/Detail/index.d.ts +2 -0
- package/es/templates/Detail/index.js +5 -0
- package/es/templates/Detail/index.scss +3 -0
- package/es/templates/Form/index.d.ts +2 -0
- package/es/templates/Form/index.js +5 -0
- package/es/templates/Form/index.scss +3 -0
- package/es/templates/List/index.d.ts +9 -0
- package/es/templates/List/index.js +45 -0
- package/es/templates/List/index.scss +3 -0
- package/es/templates/index.d.ts +5 -0
- package/es/templates/index.js +7 -0
- package/es/templates/index.scss +3 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +2 -0
- package/lib/actions/base.d.ts +13 -0
- package/lib/actions/base.js +33 -0
- package/lib/actions/confirm.d.ts +7 -0
- package/lib/actions/confirm.js +25 -0
- package/lib/actions/danger-confirm.d.ts +7 -0
- package/lib/actions/danger-confirm.js +28 -0
- package/lib/actions/dialog-component.d.ts +10 -0
- package/lib/actions/dialog-component.js +39 -0
- package/lib/actions/dialog-form.d.ts +15 -0
- package/lib/actions/dialog-form.js +152 -0
- package/lib/actions/dialog-table.d.ts +9 -0
- package/lib/actions/dialog-table.js +24 -0
- package/lib/actions/dialog.d.ts +17 -0
- package/lib/actions/dialog.js +219 -0
- package/lib/actions/drawer-form.d.ts +6 -0
- package/lib/actions/drawer-form.js +18 -0
- package/lib/actions/drawer-table.d.ts +6 -0
- package/lib/actions/drawer-table.js +18 -0
- package/lib/actions/drawer.d.ts +6 -0
- package/lib/actions/drawer.js +20 -0
- package/lib/actions/error.d.ts +7 -0
- package/lib/actions/error.js +25 -0
- package/lib/actions/index.d.ts +71 -0
- package/lib/actions/index.js +380 -0
- package/lib/actions/index.scss +34 -0
- package/lib/actions/link.d.ts +14 -0
- package/lib/actions/link.js +60 -0
- package/lib/actions/notice.d.ts +7 -0
- package/lib/actions/notice.js +25 -0
- package/lib/actions/request.d.ts +9 -0
- package/lib/actions/request.js +75 -0
- package/lib/card/index.d.ts +47 -0
- package/lib/card/index.js +179 -0
- package/lib/card/index.scss +98 -0
- package/lib/field/index.d.ts +3 -0
- package/lib/field/index.js +30 -0
- package/lib/form/Components/Editable/index.d.ts +20 -0
- package/lib/form/Components/Editable/index.js +251 -0
- package/lib/form/Components/FormGroup/index.d.ts +13 -0
- package/lib/form/Components/FormGroup/index.js +103 -0
- package/lib/form/Components/FormGroup/index.scss +23 -0
- package/lib/form/Components/ProField/index.d.ts +150 -0
- package/lib/form/Components/ProField/index.js +68 -0
- package/lib/form/Components/Query/index.d.ts +4 -0
- package/lib/form/Components/Query/index.js +91 -0
- package/lib/form/Components/Query/index.scss +90 -0
- package/lib/form/Components/QueryFilter/index.d.ts +3 -0
- package/lib/form/Components/QueryFilter/index.js +130 -0
- package/lib/form/Components/Search/index.d.ts +11 -0
- package/lib/form/Components/Search/index.js +103 -0
- package/lib/form/Filter/index.d.ts +16 -0
- package/lib/form/Filter/index.js +242 -0
- package/lib/form/ProForm/index.d.ts +5 -0
- package/lib/form/ProForm/index.js +125 -0
- package/lib/form/ProForm/index.scss +254 -0
- package/lib/form/SchemaForm/adapterComponent.d.ts +5 -0
- package/lib/form/SchemaForm/adapterComponent.js +27 -0
- package/lib/form/SchemaForm/adapterDecorator.d.ts +6 -0
- package/lib/form/SchemaForm/adapterDecorator.js +34 -0
- package/lib/form/SchemaForm/adapterType.d.ts +5 -0
- package/lib/form/SchemaForm/adapterType.js +62 -0
- package/lib/form/SchemaForm/index.d.ts +4 -0
- package/lib/form/SchemaForm/index.js +302 -0
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +3 -0
- package/lib/form/SchemaForm/initializeArrayCards.js +32 -0
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +3 -0
- package/lib/form/SchemaForm/initializeArrayCollapse.js +32 -0
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +3 -0
- package/lib/form/SchemaForm/initializeArrayIcon.js +68 -0
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +3 -0
- package/lib/form/SchemaForm/initializeArrayItems.js +46 -0
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +3 -0
- package/lib/form/SchemaForm/initializeArrayTable.js +63 -0
- package/lib/form/SchemaForm/initializeFormButton.d.ts +3 -0
- package/lib/form/SchemaForm/initializeFormButton.js +82 -0
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +3 -0
- package/lib/form/SchemaForm/initializeFormCollapse.js +50 -0
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +3 -0
- package/lib/form/SchemaForm/initializeFormGroup.js +53 -0
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -0
- package/lib/form/SchemaForm/initializeFormStep.js +55 -0
- package/lib/form/SchemaForm/initializeFormTab.d.ts +3 -0
- package/lib/form/SchemaForm/initializeFormTab.js +60 -0
- package/lib/form/SchemaForm/initializeProField.d.ts +5 -0
- package/lib/form/SchemaForm/initializeProField.js +74 -0
- package/lib/form/SchemaForm/initializeRequest.d.ts +11 -0
- package/lib/form/SchemaForm/initializeRequest.js +34 -0
- package/lib/form/SchemaForm/reactions.d.ts +4 -0
- package/lib/form/SchemaForm/reactions.js +72 -0
- package/lib/form/index.d.ts +27 -0
- package/lib/form/index.js +139 -0
- package/lib/form/typing.d.ts +69 -0
- package/lib/form/typing.js +5 -0
- package/lib/form/utils.d.ts +9 -0
- package/lib/form/utils.js +124 -0
- package/lib/form/warning.d.ts +3 -0
- package/lib/form/warning.js +24 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +17 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.js +244 -0
- package/lib/info/components/FormItem/index.d.ts +5 -0
- package/lib/info/components/FormItem/index.js +78 -0
- package/lib/info/components/FormItem/index.scss +60 -0
- package/lib/info/components/InfoGroup/index.d.ts +5 -0
- package/lib/info/components/InfoGroup/index.js +67 -0
- package/lib/info/components/InfoGroup/index.scss +14 -0
- package/lib/info/components/InfoValueItem/index.d.ts +5 -0
- package/lib/info/components/InfoValueItem/index.js +249 -0
- package/lib/info/components/InfoValueItem/index.scss +21 -0
- package/lib/info/components/baseInfo/index.d.ts +7 -0
- package/lib/info/components/baseInfo/index.js +100 -0
- package/lib/info/components/baseInfo/index.scss +3 -0
- package/lib/info/components/headerInfo/index.d.ts +7 -0
- package/lib/info/components/headerInfo/index.js +112 -0
- package/lib/info/components/headerInfo/index.scss +0 -0
- package/lib/info/components/tableInfo/index.d.ts +8 -0
- package/lib/info/components/tableInfo/index.js +197 -0
- package/lib/info/components/tableInfo/index.scss +18 -0
- package/lib/info/index.d.ts +10 -0
- package/lib/info/index.js +123 -0
- package/lib/info/index.scss +12 -0
- package/lib/info/typing.d.ts +157 -0
- package/lib/info/typing.js +5 -0
- package/lib/info/utils/index.d.ts +12 -0
- package/lib/info/utils/index.js +50 -0
- package/lib/info/utils/layout.d.ts +2 -0
- package/lib/info/utils/layout.js +65 -0
- package/lib/info/utils/useInfoRequest.d.ts +14 -0
- package/lib/info/utils/useInfoRequest.js +82 -0
- package/lib/info/utils/utils.d.ts +1 -0
- package/lib/info/utils/utils.js +20 -0
- package/lib/layout/index.d.ts +2 -0
- package/lib/layout/index.js +10 -0
- package/lib/nocode/configurators/Card.d.ts +3 -0
- package/lib/nocode/configurators/Card.js +116 -0
- package/lib/nocode/configurators/PageHeader.d.ts +3 -0
- package/lib/nocode/configurators/PageHeader.js +211 -0
- package/lib/nocode/configurators/ProTable.d.ts +3 -0
- package/lib/nocode/configurators/ProTable.js +329 -0
- package/lib/nocode/configurators/common.d.ts +188 -0
- package/lib/nocode/configurators/common.js +329 -0
- package/lib/nocode/configurators/index.d.ts +15 -0
- package/lib/nocode/configurators/index.js +44 -0
- package/lib/nocode/configurators/map.d.ts +2 -0
- package/lib/nocode/configurators/map.js +21 -0
- package/lib/nocode/index.d.ts +8 -0
- package/lib/nocode/index.js +76 -0
- package/lib/nocode/index.scss +93 -0
- package/lib/nocode/pages/editor.d.ts +12 -0
- package/lib/nocode/pages/editor.js +58 -0
- package/lib/nocode/pages/index.d.ts +14 -0
- package/lib/nocode/pages/index.js +93 -0
- package/lib/nocode/pages/playground.d.ts +11 -0
- package/lib/nocode/pages/playground.js +158 -0
- package/lib/nocode/pages/renderer.d.ts +10 -0
- package/lib/nocode/pages/renderer.js +164 -0
- package/lib/nocode/playground.d.ts +14 -0
- package/lib/nocode/playground.js +91 -0
- package/lib/page-container/index.d.ts +3 -0
- package/lib/page-container/index.js +30 -0
- package/lib/page-header/index.d.ts +43 -0
- package/lib/page-header/index.js +252 -0
- package/lib/page-header/index.scss +169 -0
- package/lib/skeleton/index.d.ts +3 -0
- package/lib/skeleton/index.js +30 -0
- package/lib/table/components/Filter/index.d.ts +9 -0
- package/lib/table/components/Filter/index.js +244 -0
- package/lib/table/components/Filter/index.scss +23 -0
- package/lib/table/components/Layout/index.d.ts +5 -0
- package/lib/table/components/Layout/index.js +266 -0
- package/lib/table/components/Layout/index.scss +39 -0
- package/lib/table/components/QuickAction/index.d.ts +10 -0
- package/lib/table/components/QuickAction/index.js +65 -0
- package/lib/table/components/QuickAction/index.scss +0 -0
- package/lib/table/components/ToolBar/DensityIcon.d.ts +4 -0
- package/lib/table/components/ToolBar/DensityIcon.js +135 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.d.ts +4 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +303 -0
- package/lib/table/components/ToolBar/FullScreenIcon.d.ts +4 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +107 -0
- package/lib/table/components/ToolBar/Fullscreen.d.ts +10 -0
- package/lib/table/components/ToolBar/Fullscreen.js +85 -0
- package/lib/table/components/ToolBar/RefreshIcon.d.ts +4 -0
- package/lib/table/components/ToolBar/RefreshIcon.js +60 -0
- package/lib/table/components/ToolBar/index.d.ts +5 -0
- package/lib/table/components/ToolBar/index.js +96 -0
- package/lib/table/components/ToolBar/index.scss +110 -0
- package/lib/table/index.d.ts +6 -0
- package/lib/table/index.js +662 -0
- package/lib/table/index.scss +103 -0
- package/lib/table/typing.d.ts +222 -0
- package/lib/table/typing.js +5 -0
- package/lib/table/utils/columnRender.d.ts +13 -0
- package/lib/table/utils/columnRender.js +201 -0
- package/lib/table/utils/genProColumnToColumn.d.ts +9 -0
- package/lib/table/utils/genProColumnToColumn.js +62 -0
- package/lib/table/utils/getTableProps.d.ts +2 -0
- package/lib/table/utils/getTableProps.js +13 -0
- package/lib/table/utils/getTableSortIcons.d.ts +3 -0
- package/lib/table/utils/getTableSortIcons.js +34 -0
- package/lib/table/utils/index.d.ts +4 -0
- package/lib/table/utils/index.js +112 -0
- package/lib/table/utils/useTableSelection.d.ts +3 -0
- package/lib/table/utils/useTableSelection.js +112 -0
- package/lib/templates/Detail/index.d.ts +2 -0
- package/lib/templates/Detail/index.js +18 -0
- package/lib/templates/Detail/index.scss +3 -0
- package/lib/templates/Form/index.d.ts +2 -0
- package/lib/templates/Form/index.js +18 -0
- package/lib/templates/Form/index.scss +3 -0
- package/lib/templates/List/index.d.ts +9 -0
- package/lib/templates/List/index.js +67 -0
- package/lib/templates/List/index.scss +3 -0
- package/lib/templates/index.d.ts +5 -0
- package/lib/templates/index.js +59 -0
- package/lib/templates/index.scss +3 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +17 -0
- package/package.json +5 -5
@@ -0,0 +1,607 @@
|
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction"];
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
+
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
6
|
+
|
7
|
+
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."); }
|
8
|
+
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
10
|
+
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
12
|
+
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
14
|
+
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
20
|
+
|
21
|
+
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."); }
|
22
|
+
|
23
|
+
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); }
|
24
|
+
|
25
|
+
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; }
|
26
|
+
|
27
|
+
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; }
|
28
|
+
|
29
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
30
|
+
|
31
|
+
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; }
|
32
|
+
|
33
|
+
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; }
|
34
|
+
|
35
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
36
|
+
import { Table, Pagination, Message, Checkbox } from '@alicloudfe/components';
|
37
|
+
import genProColumnToColumn from './utils/genProColumnToColumn';
|
38
|
+
import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps } from '@teamix/utils';
|
39
|
+
import { BaseSkeleton as Skeleton } from '../skeleton';
|
40
|
+
import './index.scss';
|
41
|
+
import Layout from './components/Layout';
|
42
|
+
import { useActionType } from './utils';
|
43
|
+
import getTableProps from './utils/getTableProps';
|
44
|
+
import getTableSortIcons from './utils/getTableSortIcons';
|
45
|
+
import useTableSelection from './utils/useTableSelection';
|
46
|
+
import FullScreen from './components/ToolBar/Fullscreen';
|
47
|
+
import { createForm, formilyReactive } from '../form';
|
48
|
+
import { ActionGroup } from '../actions';
|
49
|
+
import debounce from 'lodash.debounce';
|
50
|
+
import classNames from 'classnames';
|
51
|
+
export * from './typing'; // 导出 ProActions 组件
|
52
|
+
|
53
|
+
export * from '../actions';
|
54
|
+
import { useSize } from 'ahooks';
|
55
|
+
var cls = baseClass('teamix-pro-table');
|
56
|
+
var toJS = formilyReactive.toJS;
|
57
|
+
/**
|
58
|
+
* 处理原生传入的 columns 以便于 选择列 方便处理
|
59
|
+
* @param columns 原生传入的 columns
|
60
|
+
* @returns
|
61
|
+
*/
|
62
|
+
|
63
|
+
var processColumns = function processColumns(columns) {
|
64
|
+
return columns.filter(function (item) {
|
65
|
+
return item.columnFilters !== false;
|
66
|
+
});
|
67
|
+
};
|
68
|
+
/** 默认请求翻页参数 */
|
69
|
+
|
70
|
+
|
71
|
+
var globalPageKey = 'currentPage';
|
72
|
+
var globalPageSizeKey = 'pageSize';
|
73
|
+
|
74
|
+
var globalFormatSort = function globalFormatSort(sort) {
|
75
|
+
if (Object.keys(sort).length > 0) {
|
76
|
+
return {
|
77
|
+
sort: sort
|
78
|
+
};
|
79
|
+
}
|
80
|
+
|
81
|
+
return {};
|
82
|
+
};
|
83
|
+
|
84
|
+
var ProTable = function ProTable(props) {
|
85
|
+
var _rowSelection$selecte;
|
86
|
+
|
87
|
+
var header = props.header,
|
88
|
+
className = props.className,
|
89
|
+
tableClassName = props.tableClassName,
|
90
|
+
mainAction = props.mainAction,
|
91
|
+
quickAction = props.quickAction,
|
92
|
+
propsDataFilter = props.dataFilter,
|
93
|
+
toolBar = props.toolBar,
|
94
|
+
propsColumns = props.columns,
|
95
|
+
useRowSelection = props.useRowSelection,
|
96
|
+
propsRowSelection = props.rowSelection,
|
97
|
+
onChangeRowSelection = props.onChangeRowSelection,
|
98
|
+
getRowSelection = props.getRowSelection,
|
99
|
+
primaryKey = props.primaryKey,
|
100
|
+
footerAction = props.footerAction,
|
101
|
+
url = props.url,
|
102
|
+
pageKey = props.pageKey,
|
103
|
+
pageSizeKey = props.pageSizeKey,
|
104
|
+
_props$method = props.method,
|
105
|
+
method = _props$method === void 0 ? 'get' : _props$method,
|
106
|
+
_props$params = props.params,
|
107
|
+
propsParams = _props$params === void 0 ? {} : _props$params,
|
108
|
+
formatSort = props.formatSort,
|
109
|
+
_props$formatParams = props.formatParams,
|
110
|
+
formatParams = _props$formatParams === void 0 ? function (params) {
|
111
|
+
return params;
|
112
|
+
} : _props$formatParams,
|
113
|
+
formatResult = props.formatResult,
|
114
|
+
_props$requestWhenMou = props.requestWhenMount,
|
115
|
+
requestWhenMount = _props$requestWhenMou === void 0 ? true : _props$requestWhenMou,
|
116
|
+
_props$showPagination = props.showPagination,
|
117
|
+
showPagination = _props$showPagination === void 0 ? true : _props$showPagination,
|
118
|
+
_props$pageSizeList = props.pageSizeList,
|
119
|
+
pageSizeList = _props$pageSizeList === void 0 ? [5, 10, 20, 50, 100] : _props$pageSizeList,
|
120
|
+
_props$showSkeleton = props.showSkeleton,
|
121
|
+
propsShowSkeleton = _props$showSkeleton === void 0 ? true : _props$showSkeleton,
|
122
|
+
_props$skeletonSize = props.skeletonSize,
|
123
|
+
skeletonSize = _props$skeletonSize === void 0 ? 5 : _props$skeletonSize,
|
124
|
+
propsActionRef = props.actionRef,
|
125
|
+
dataSource = props.dataSource,
|
126
|
+
_props$filterDebounce = props.filterDebounce,
|
127
|
+
filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
|
128
|
+
_props$footerSuction = props.footerSuction,
|
129
|
+
footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
|
130
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
131
|
+
|
132
|
+
var targetPageKey = pageKey || globalPageKey;
|
133
|
+
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
134
|
+
var targetFormatSort = formatSort || globalFormatSort;
|
135
|
+
|
136
|
+
var _useState = useState(1),
|
137
|
+
_useState2 = _slicedToArray(_useState, 2),
|
138
|
+
currentPage = _useState2[0],
|
139
|
+
setCurrentPage = _useState2[1];
|
140
|
+
|
141
|
+
var _useState3 = useState(props.pageSize || 10),
|
142
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
143
|
+
pageSize = _useState4[0],
|
144
|
+
setPageSize = _useState4[1];
|
145
|
+
|
146
|
+
var _useState5 = useState(0),
|
147
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
148
|
+
total = _useState6[0],
|
149
|
+
setTotal = _useState6[1];
|
150
|
+
|
151
|
+
var _useState7 = useState([]),
|
152
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
153
|
+
data = _useState8[0],
|
154
|
+
setData = _useState8[1];
|
155
|
+
|
156
|
+
var _useState9 = useState(props.sort || {}),
|
157
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
158
|
+
sort = _useState10[0],
|
159
|
+
setSort = _useState10[1];
|
160
|
+
|
161
|
+
var _useState11 = useState(requestWhenMount && propsShowSkeleton),
|
162
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
163
|
+
showSkeleton = _useState12[0],
|
164
|
+
setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
|
165
|
+
|
166
|
+
|
167
|
+
var skeletonDataSource = new Array(skeletonSize).fill({});
|
168
|
+
var requestDataKey = method.toLowerCase() === 'get' ? 'params' : 'data';
|
169
|
+
var tableRef = useRef(null);
|
170
|
+
var actionRef = useRef(); // 传给 table 的过滤后的 columns
|
171
|
+
|
172
|
+
var _useState13 = useState(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [])),
|
173
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
174
|
+
filteredColumns = _useState14[0],
|
175
|
+
setFilteredColumns = _useState14[1];
|
176
|
+
|
177
|
+
var _useState15 = useState('medium'),
|
178
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
179
|
+
size = _useState16[0],
|
180
|
+
_setSize = _useState16[1]; // 获取header高度,用作全屏吸底吸顶高度计算
|
181
|
+
|
182
|
+
|
183
|
+
var getHeaderHeight = function getHeaderHeight() {
|
184
|
+
var _tableDom$getElements, _tableDom$getElements2;
|
185
|
+
|
186
|
+
var tableDom = tableRef.current;
|
187
|
+
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];
|
188
|
+
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName('next-table-header-inner')) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
189
|
+
return new Promise(function (resolve) {
|
190
|
+
setTimeout(function () {
|
191
|
+
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
192
|
+
|
193
|
+
var headerHeight = (_headerDom$offsetHeig = headerDom === null || headerDom === void 0 ? void 0 : headerDom.offsetHeight) !== null && _headerDom$offsetHeig !== void 0 ? _headerDom$offsetHeig : 0; // table表头默认一行。即42px
|
194
|
+
|
195
|
+
var tableHeaderHeight = (_tableHeaderDom$offse = tableHeaderDom === null || tableHeaderDom === void 0 ? void 0 : tableHeaderDom.offsetHeight) !== null && _tableHeaderDom$offse !== void 0 ? _tableHeaderDom$offse : 42;
|
196
|
+
resolve(headerHeight + tableHeaderHeight);
|
197
|
+
}, 50);
|
198
|
+
});
|
199
|
+
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
200
|
+
|
201
|
+
|
202
|
+
var _useState17 = useState(0),
|
203
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
204
|
+
headerHeight = _useState18[0],
|
205
|
+
setHeaderHeight = _useState18[1]; // 全屏显示 className
|
206
|
+
|
207
|
+
|
208
|
+
var _useState19 = useState(false),
|
209
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
210
|
+
fullscreenState = _useState20[0],
|
211
|
+
setFullscreenState = _useState20[1]; // 父元素位置。用作非全屏模式下的吸底
|
212
|
+
|
213
|
+
|
214
|
+
var _useState21 = useState(),
|
215
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
216
|
+
parentPosition = _useState22[0],
|
217
|
+
setParentPosition = _useState22[1];
|
218
|
+
/** 筛选区域 form */
|
219
|
+
|
220
|
+
|
221
|
+
var dataFilterForm = useMemo(function () {
|
222
|
+
return createForm();
|
223
|
+
}, []); // 获取表格大小
|
224
|
+
|
225
|
+
var tableSize = useSize(tableRef); // 获取父元素位置
|
226
|
+
|
227
|
+
var getParentPosition = function getParentPosition() {
|
228
|
+
// 暂时仅支持使用全家桶
|
229
|
+
if (footerSuction) {
|
230
|
+
var _parentDom$offsetLeft, _parentDom$offsetRigh;
|
231
|
+
|
232
|
+
var parentDom = document.querySelector('.teamix-pro-page-container');
|
233
|
+
setParentPosition({
|
234
|
+
offsetLeft: (_parentDom$offsetLeft = parentDom === null || parentDom === void 0 ? void 0 : parentDom.offsetLeft) !== null && _parentDom$offsetLeft !== void 0 ? _parentDom$offsetLeft : 0,
|
235
|
+
offsetRight: (_parentDom$offsetRigh = parentDom === null || parentDom === void 0 ? void 0 : parentDom.offsetRight) !== null && _parentDom$offsetRigh !== void 0 ? _parentDom$offsetRigh : 0
|
236
|
+
});
|
237
|
+
}
|
238
|
+
}; // 监听表格大小动态改变吸底footer大小
|
239
|
+
|
240
|
+
|
241
|
+
useEffect(function () {
|
242
|
+
getParentPosition();
|
243
|
+
}, [tableSize]); // rowSelection 相关
|
244
|
+
|
245
|
+
var rowSelectionHook = useTableSelection(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
|
246
|
+
onChange: onChangeRowSelection
|
247
|
+
}), primaryKey);
|
248
|
+
var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
|
249
|
+
var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
|
250
|
+
useEffect(function () {
|
251
|
+
getRowSelection && getRowSelection(rowSelectionHook);
|
252
|
+
}, [rowSelectionHook]); // 获取 table 左下角 checkbox 属性
|
253
|
+
|
254
|
+
function getCheckAllProps() {
|
255
|
+
var _rowSelection$onChang = rowSelection.onChange,
|
256
|
+
_onChange = _rowSelection$onChang === void 0 ? function () {} : _rowSelection$onChang,
|
257
|
+
_rowSelection$onSelec = rowSelection.onSelectAll,
|
258
|
+
onSelectAll = _rowSelection$onSelec === void 0 ? function () {} : _rowSelection$onSelec,
|
259
|
+
_rowSelection$selecte2 = rowSelection.selectedRowKeys,
|
260
|
+
selectedRowKeys = _rowSelection$selecte2 === void 0 ? [] : _rowSelection$selecte2,
|
261
|
+
getProps = rowSelection.getProps;
|
262
|
+
|
263
|
+
var dataSource = data;
|
264
|
+
var allRowKeys = dataSource.filter(function (d, i) {
|
265
|
+
var _getProps;
|
266
|
+
|
267
|
+
return getProps ? !((_getProps = getProps(d, i)) === null || _getProps === void 0 ? void 0 : _getProps.disabled) : true;
|
268
|
+
}).map(function (d) {
|
269
|
+
return getDeepValue(primaryKey || 'id', d);
|
270
|
+
});
|
271
|
+
var nowCheckedKeys = allRowKeys.filter(function (k) {
|
272
|
+
return selectedRowKeys.includes(k);
|
273
|
+
});
|
274
|
+
return {
|
275
|
+
onChange: function onChange(check) {
|
276
|
+
if (check) {
|
277
|
+
var result = selectedRowKeys.concat([]);
|
278
|
+
result.push.apply(result, _toConsumableArray(allRowKeys.filter(function (k) {
|
279
|
+
return !selectedRowKeys.includes(k);
|
280
|
+
})));
|
281
|
+
|
282
|
+
_onChange(result, dataSource);
|
283
|
+
|
284
|
+
onSelectAll(check, dataSource);
|
285
|
+
} else {
|
286
|
+
_onChange(selectedRowKeys.filter(function (k) {
|
287
|
+
return !allRowKeys.includes(k);
|
288
|
+
}), []);
|
289
|
+
|
290
|
+
onSelectAll(check, []);
|
291
|
+
}
|
292
|
+
},
|
293
|
+
indeterminate: nowCheckedKeys.length !== allRowKeys.length && nowCheckedKeys.length > 0,
|
294
|
+
checked: nowCheckedKeys.length !== 0 && nowCheckedKeys.length === allRowKeys.length
|
295
|
+
};
|
296
|
+
}
|
297
|
+
|
298
|
+
useEffect(function () {
|
299
|
+
if (typeof propsActionRef === 'function' && actionRef.current) {
|
300
|
+
// @ts-ignore
|
301
|
+
propsActionRef(actionRef.current);
|
302
|
+
}
|
303
|
+
}, [propsActionRef]);
|
304
|
+
useEffect(function () {
|
305
|
+
setFilteredColumns(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []));
|
306
|
+
}, [propsColumns]); // 绑定 Actions
|
307
|
+
|
308
|
+
useActionType(actionRef, {
|
309
|
+
fullScreen: function fullScreen() {
|
310
|
+
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
311
|
+
|
312
|
+
getHeaderHeight().then(function (height) {
|
313
|
+
setHeaderHeight(height);
|
314
|
+
});
|
315
|
+
setFullscreenState(state);
|
316
|
+
return state;
|
317
|
+
},
|
318
|
+
setColumn: function setColumn(newColumns) {
|
319
|
+
setFilteredColumns(processColumns(newColumns));
|
320
|
+
},
|
321
|
+
setSize: function setSize(mode) {
|
322
|
+
_setSize(mode);
|
323
|
+
},
|
324
|
+
refresh: function refresh(params) {
|
325
|
+
return _request(params);
|
326
|
+
},
|
327
|
+
request: function request(params) {
|
328
|
+
return _request(params);
|
329
|
+
},
|
330
|
+
reset: function reset() {
|
331
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
332
|
+
dataFilterForm.reset();
|
333
|
+
setCurrentPage(1);
|
334
|
+
|
335
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
336
|
+
},
|
337
|
+
clearRowSelection: function clearRowSelection() {
|
338
|
+
rowSelectionHook.setSelectedRowKeys([]);
|
339
|
+
rowSelectionHook.setSelectedRecords([]);
|
340
|
+
onChangeRowSelection && onChangeRowSelection([]);
|
341
|
+
},
|
342
|
+
pageInfo: {
|
343
|
+
total: total,
|
344
|
+
current: currentPage,
|
345
|
+
pageSize: pageSize
|
346
|
+
},
|
347
|
+
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
348
|
+
getHeaderHeight().then(function (height) {
|
349
|
+
setHeaderHeight(height);
|
350
|
+
});
|
351
|
+
}
|
352
|
+
}); // 将 Actions 绑定到传入的 propsActionRef 中
|
353
|
+
|
354
|
+
if (propsActionRef) {
|
355
|
+
propsActionRef.current = actionRef.current;
|
356
|
+
} // 请求表格数据工具函数
|
357
|
+
|
358
|
+
|
359
|
+
var getData = useRequest(function (params) {
|
360
|
+
return _defineProperty({
|
361
|
+
url: url,
|
362
|
+
method: method
|
363
|
+
}, requestDataKey, params);
|
364
|
+
}, {
|
365
|
+
// 使用 request 方法代替 fetch
|
366
|
+
requestMethod: function requestMethod(params) {
|
367
|
+
return utilResquest(params);
|
368
|
+
},
|
369
|
+
manual: true,
|
370
|
+
onSuccess: function onSuccess(result) {
|
371
|
+
props.onSuccess && props.onSuccess(result);
|
372
|
+
var nextData = result;
|
373
|
+
|
374
|
+
if (formatResult) {
|
375
|
+
if (typeof formatResult === 'function') {
|
376
|
+
nextData = formatResult(result) || {};
|
377
|
+
} else if (_typeof(formatResult) === 'object') {
|
378
|
+
var dataTotal = getDeepValue(formatResult.total, result);
|
379
|
+
nextData = {
|
380
|
+
data: getDeepValue(formatResult.data, result) || [],
|
381
|
+
total: isNaN(dataTotal) ? 0 : Number(dataTotal)
|
382
|
+
};
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
function onFormatResult(next) {
|
387
|
+
var _next$data;
|
388
|
+
|
389
|
+
props.onFormatResult && props.onFormatResult(next); // 设置 dataSource、total
|
390
|
+
|
391
|
+
setData(next.data || []);
|
392
|
+
setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
|
393
|
+
setShowSkeleton(false);
|
394
|
+
}
|
395
|
+
|
396
|
+
if (nextData instanceof Promise) {
|
397
|
+
nextData.then(function (res) {
|
398
|
+
onFormatResult(res);
|
399
|
+
}).catch(function () {
|
400
|
+
onFormatResult({});
|
401
|
+
});
|
402
|
+
} else {
|
403
|
+
onFormatResult(nextData);
|
404
|
+
}
|
405
|
+
},
|
406
|
+
onError: function onError(error) {
|
407
|
+
setShowSkeleton(false);
|
408
|
+
|
409
|
+
if (props.onError) {
|
410
|
+
props.onError(error);
|
411
|
+
} else {
|
412
|
+
Message.error(error.toString());
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}); // 请求函数
|
416
|
+
|
417
|
+
function _request(params) {
|
418
|
+
var _actionRef$current, _actionRef$current$se, _objectSpread2;
|
419
|
+
|
420
|
+
// 请求前需要优先清空列过滤条件
|
421
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setFilterRules) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, {});
|
422
|
+
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
423
|
+
|
424
|
+
var dataFilterParams = toJS(dataFilterForm.values); // 格式化后的请求参数
|
425
|
+
|
426
|
+
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams) : _objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams)), params));
|
427
|
+
|
428
|
+
if (requestData) {
|
429
|
+
// console.log('requestData', requestData);
|
430
|
+
getData.run(requestData);
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
434
|
+
useEffect(function () {
|
435
|
+
if (requestWhenMount) {
|
436
|
+
_request();
|
437
|
+
}
|
438
|
+
}, []);
|
439
|
+
|
440
|
+
function onSort(dataIndex, order) {
|
441
|
+
var nextSort = _defineProperty({}, dataIndex, order);
|
442
|
+
|
443
|
+
setSort(nextSort);
|
444
|
+
|
445
|
+
_request(targetFormatSort(nextSort));
|
446
|
+
} // 处理 dataFilter 中的 onFilter、onReset
|
447
|
+
|
448
|
+
|
449
|
+
var dataFilter = _objectSpread(_objectSpread({}, propsDataFilter), {}, {
|
450
|
+
onFilter: debounce(function () {
|
451
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
|
452
|
+
setCurrentPage(1);
|
453
|
+
|
454
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
455
|
+
}, filterDebounce),
|
456
|
+
onReset: function onReset() {
|
457
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
458
|
+
dataFilterForm.reset();
|
459
|
+
setCurrentPage(1);
|
460
|
+
|
461
|
+
_request(_defineProperty({}, targetPageKey, 1));
|
462
|
+
}
|
463
|
+
});
|
464
|
+
|
465
|
+
var renderTable = function renderTable() {
|
466
|
+
if (propsColumns) {
|
467
|
+
return /*#__PURE__*/React.createElement("div", {
|
468
|
+
className: classNames('teamix-pro-table-container', className)
|
469
|
+
}, /*#__PURE__*/React.createElement(Layout, {
|
470
|
+
header: header,
|
471
|
+
mainAction: mainAction,
|
472
|
+
quickAction: quickAction,
|
473
|
+
toolBar: toolBar,
|
474
|
+
actionRef: actionRef,
|
475
|
+
columns: propsColumns,
|
476
|
+
dataFilter: dataFilter,
|
477
|
+
dataFilterForm: dataFilterForm,
|
478
|
+
rowSelection: rowSelection
|
479
|
+
}), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
480
|
+
hasBorder: false,
|
481
|
+
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
482
|
+
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef),
|
483
|
+
loading: !showSkeleton && (getData.loading || props.loading),
|
484
|
+
className: classNames('teamix-pro-table', tableClassName, {
|
485
|
+
'with-row-select': rowSelection
|
486
|
+
}),
|
487
|
+
size: size,
|
488
|
+
onSort: onSort,
|
489
|
+
sort: sort,
|
490
|
+
primaryKey: primaryKey,
|
491
|
+
rowSelection: rowSelection,
|
492
|
+
sortIcons: getTableSortIcons(),
|
493
|
+
fixedHeader: fullscreenState,
|
494
|
+
// 102px 为 底部 50px + 空格10px + 顶部 24px padding
|
495
|
+
maxBodyHeight: "calc(100vh - 84px - ".concat(headerHeight, "px)")
|
496
|
+
}, pickProps(getTableProps(), otherProps))));
|
497
|
+
} else {
|
498
|
+
// 不传 columns 直接返回原始 Table
|
499
|
+
return /*#__PURE__*/React.createElement(Table, _objectSpread({
|
500
|
+
className: cls()
|
501
|
+
}, pickProps(getTableProps(), otherProps)));
|
502
|
+
}
|
503
|
+
};
|
504
|
+
|
505
|
+
var renderFooterAction = function renderFooterAction() {
|
506
|
+
var _footerAction$actions;
|
507
|
+
|
508
|
+
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) {
|
509
|
+
// 默认 context
|
510
|
+
var defaultContext = {
|
511
|
+
action: actionRef.current,
|
512
|
+
rowSelection: rowSelection
|
513
|
+
};
|
514
|
+
return /*#__PURE__*/React.createElement("div", {
|
515
|
+
className: cls('footer-action')
|
516
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, _objectSpread(_objectSpread({}, footerAction), {}, {
|
517
|
+
context: _objectSpread(_objectSpread({}, defaultContext), footerAction.context)
|
518
|
+
})));
|
519
|
+
} else return footerAction;
|
520
|
+
};
|
521
|
+
|
522
|
+
var renderFooter = function renderFooter() {
|
523
|
+
function onChangePagination(currentPage) {
|
524
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
525
|
+
setCurrentPage(currentPage);
|
526
|
+
|
527
|
+
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
528
|
+
}
|
529
|
+
|
530
|
+
function onChangePaginationSize(currentPageSize) {
|
531
|
+
setPageSize(currentPageSize);
|
532
|
+
|
533
|
+
_request(_defineProperty({}, targetPageSizeKey, currentPageSize));
|
534
|
+
}
|
535
|
+
|
536
|
+
function renderRowSelection() {
|
537
|
+
if (rowSelection) {
|
538
|
+
if (showSkeleton) {
|
539
|
+
return /*#__PURE__*/React.createElement("div", {
|
540
|
+
className: cls('footer-left-wrapper')
|
541
|
+
}, /*#__PURE__*/React.createElement(Skeleton.Footer.Operation, null));
|
542
|
+
} else {
|
543
|
+
return /*#__PURE__*/React.createElement("div", {
|
544
|
+
className: cls('footer-left-wrapper')
|
545
|
+
}, rowSelection.mode !== 'single' && /*#__PURE__*/React.createElement(Checkbox, _objectSpread({
|
546
|
+
className: cls("footer-checkbox-".concat(size))
|
547
|
+
}, getCheckAllProps())), footerAction && renderFooterAction(), /*#__PURE__*/React.createElement("span", {
|
548
|
+
className: cls('selected-msg')
|
549
|
+
}, getMessage('selected', {
|
550
|
+
count: selectedCount
|
551
|
+
})));
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
|
556
|
+
if (showPagination || footerAction) {
|
557
|
+
var _parentPosition$offse, _parentPosition$offse2;
|
558
|
+
|
559
|
+
return /*#__PURE__*/React.createElement("div", {
|
560
|
+
className: cls('footer', {
|
561
|
+
'footer-has-rowSelection': rowSelection
|
562
|
+
}),
|
563
|
+
style: {
|
564
|
+
left: "".concat(fullscreenState ? 0 : (_parentPosition$offse = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetLeft) !== null && _parentPosition$offse !== void 0 ? _parentPosition$offse : 0, "px"),
|
565
|
+
right: "".concat(fullscreenState ? 0 : (_parentPosition$offse2 = parentPosition === null || parentPosition === void 0 ? void 0 : parentPosition.offsetRight) !== null && _parentPosition$offse2 !== void 0 ? _parentPosition$offse2 : 0, "px")
|
566
|
+
}
|
567
|
+
}, renderRowSelection(), /*#__PURE__*/React.createElement("div", {
|
568
|
+
className: cls('footer-right-wrapper')
|
569
|
+
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : /*#__PURE__*/React.createElement(Pagination, _objectSpread({
|
570
|
+
className: cls('pagination'),
|
571
|
+
onChange: function onChange(number) {
|
572
|
+
return onChangePagination(number);
|
573
|
+
},
|
574
|
+
total: total,
|
575
|
+
totalRender: function totalRender(total) {
|
576
|
+
return getMessage('total', {
|
577
|
+
total: total
|
578
|
+
});
|
579
|
+
},
|
580
|
+
pageSize: pageSize,
|
581
|
+
current: currentPage,
|
582
|
+
shape: "arrow-only",
|
583
|
+
pageSizeList: pageSizeList,
|
584
|
+
pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
|
585
|
+
pageSizePosition: "end",
|
586
|
+
type: total / pageSize <= 2 ? 'simple' : 'normal',
|
587
|
+
onPageSizeChange: function onPageSizeChange(number) {
|
588
|
+
return onChangePaginationSize(number);
|
589
|
+
}
|
590
|
+
}, props.paginationProps))));
|
591
|
+
}
|
592
|
+
};
|
593
|
+
|
594
|
+
return /*#__PURE__*/React.createElement(FullScreen, {
|
595
|
+
visible: fullscreenState,
|
596
|
+
actionRef: actionRef
|
597
|
+
}, /*#__PURE__*/React.createElement("div", {
|
598
|
+
className: cls({
|
599
|
+
'': true,
|
600
|
+
fullscreen: fullscreenState,
|
601
|
+
'footer-suction': footerSuction
|
602
|
+
}),
|
603
|
+
ref: tableRef
|
604
|
+
}, renderTable(), renderFooter()));
|
605
|
+
};
|
606
|
+
|
607
|
+
export default ProTable;
|