@para-ui/core 3.0.53 → 3.0.55
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 +24 -0
- package/package.json +1 -1
- package/AutoBox/index.d.ts +0 -34
- package/AutoBox/index.js +0 -277
- package/AutoBox/protal.d.ts +0 -17
- package/AutoTips/autoTipsMultiline/index.d.ts +0 -18
- package/AutoTips/index.d.ts +0 -35
- package/AutoTips/index.js +0 -271
- package/Breadcrumbs/index.d.ts +0 -53
- package/Breadcrumbs/index.js +0 -266
- package/Breadcrumbs/lang/en_US.d.ts +0 -4
- package/Breadcrumbs/lang/index.d.ts +0 -9
- package/Breadcrumbs/lang/zh_CN.d.ts +0 -4
- package/Button/SplitButton.d.ts +0 -64
- package/Button/index.d.ts +0 -79
- package/Button/index.js +0 -376
- package/Button/lang/en_US.d.ts +0 -4
- package/Button/lang/index.d.ts +0 -9
- package/Button/lang/zh_CN.d.ts +0 -4
- package/ButtonGroup/index.d.ts +0 -33
- package/ButtonGroup/index.js +0 -124
- package/Carousel/index.d.ts +0 -38
- package/Carousel/index.js +0 -78
- package/Cascader/index.d.ts +0 -54
- package/Cascader/index.js +0 -159
- package/Cascader/lang/en_US.d.ts +0 -4
- package/Cascader/lang/index.d.ts +0 -9
- package/Cascader/lang/zh_CN.d.ts +0 -4
- package/Checkbox/index.d.ts +0 -40
- package/Checkbox/index.js +0 -109
- package/CheckboxGroup/index.d.ts +0 -45
- package/CheckboxGroup/index.js +0 -142
- package/Collapse/collapsePanel.d.ts +0 -30
- package/Collapse/index.d.ts +0 -57
- package/Collapse/index.js +0 -152
- package/Collapse/motion.d.ts +0 -5
- package/Collapse/util.d.ts +0 -11
- package/CollapseBox/index.d.ts +0 -27
- package/CollapseBox/index.js +0 -148
- package/CollapseBox/util.d.ts +0 -5
- package/CollapseLayout/index.d.ts +0 -53
- package/CollapseLayout/index.js +0 -176
- package/ColorPicker/index.d.ts +0 -4
- package/ColorPicker/index.js +0 -4
- package/ComboSelect/index.d.ts +0 -6
- package/ComboSelect/index.js +0 -1049
- package/ComboSelect/interface.d.ts +0 -146
- package/ComboSelect/lang/en_US.d.ts +0 -9
- package/ComboSelect/lang/index.d.ts +0 -19
- package/ComboSelect/lang/zh_CN.d.ts +0 -9
- package/ComboSelect/utils.d.ts +0 -9
- package/Container/index.d.ts +0 -77
- package/Container/index.js +0 -232
- package/DatePicker/PickerButton.d.ts +0 -3
- package/DatePicker/PickerTag.d.ts +0 -3
- package/DatePicker/generatePicker/generateRangePicker.d.ts +0 -4
- package/DatePicker/generatePicker/generateSinglePicker.d.ts +0 -11
- package/DatePicker/generatePicker/index.d.ts +0 -95
- package/DatePicker/index.d.ts +0 -18
- package/DatePicker/index.js +0 -633
- package/DatePicker/lang/en_US.d.ts +0 -3
- package/DatePicker/lang/index.d.ts +0 -7
- package/DatePicker/lang/zh_CN.d.ts +0 -3
- package/DatePicker/util.d.ts +0 -22
- package/Desktop/index.d.ts +0 -57
- package/Desktop/index.js +0 -746
- package/DragVerify/index.d.ts +0 -36
- package/DragVerify/index.js +0 -385
- package/DragVerify/lang/en_US.d.ts +0 -5
- package/DragVerify/lang/index.d.ts +0 -11
- package/DragVerify/lang/zh_CN.d.ts +0 -5
- package/Drawer/index.d.ts +0 -11
- package/Drawer/index.js +0 -235
- package/Drawer/interface.d.ts +0 -92
- package/Drawer/lang/en_US.d.ts +0 -5
- package/Drawer/lang/index.d.ts +0 -11
- package/Drawer/lang/zh_CN.d.ts +0 -5
- package/Dropdown/index.d.ts +0 -40
- package/Dropdown/index.js +0 -10
- package/DynamicMultiBox/formItem.d.ts +0 -14
- package/DynamicMultiBox/index.d.ts +0 -5
- package/DynamicMultiBox/index.js +0 -1313
- package/DynamicMultiBox/interface.d.ts +0 -161
- package/DynamicMultiBox/rowForm.d.ts +0 -24
- package/Empty/images/index.d.ts +0 -3
- package/Empty/index.d.ts +0 -30
- package/Empty/index.js +0 -642
- package/Empty/lang/en_US.d.ts +0 -6
- package/Empty/lang/index.d.ts +0 -13
- package/Empty/lang/zh_CN.d.ts +0 -6
- package/Form/index.d.ts +0 -187
- package/Form/index.js +0 -355
- package/FormItem/compoments/defaultCompoments/index.d.ts +0 -19
- package/FormItem/compoments/formCheckboxGroup/index.d.ts +0 -8
- package/FormItem/compoments/formFile/index.d.ts +0 -38
- package/FormItem/compoments/formRadioGroup/index.d.ts +0 -8
- package/FormItem/compoments/formSelect/index.d.ts +0 -18
- package/FormItem/errorTips.d.ts +0 -12
- package/FormItem/index.d.ts +0 -152
- package/FormItem/index.js +0 -78
- package/FormItem/itemType.d.ts +0 -42
- package/FormItem/validateFunction.d.ts +0 -15
- package/FunctionModal/dialog.d.ts +0 -58
- package/FunctionModal/index.d.ts +0 -8
- package/FunctionModal/index.js +0 -43
- package/FunctionModal/modalContext.d.ts +0 -15
- package/GlobalContext/componentsProps.d.ts +0 -21
- package/GlobalContext/confirmLocale.d.ts +0 -7
- package/GlobalContext/constant.d.ts +0 -8
- package/GlobalContext/index.d.ts +0 -28
- package/GlobalContext/index.js +0 -41
- package/GlobalContext/intl.d.ts +0 -34
- package/GlobalContext/useFormatMessage.d.ts +0 -3
- package/GlobalContext/usePopupContainer.d.ts +0 -4
- package/Help/index.d.ts +0 -24
- package/Help/index.js +0 -41
- package/HelperText/index.d.ts +0 -27
- package/HelperText/index.js +0 -34
- package/Hooks/useGlobalProps.d.ts +0 -1
- package/InputLang/index.d.ts +0 -46
- package/InputLang/index.js +0 -247
- package/InputNumber/index.d.ts +0 -71
- package/InputNumber/index.js +0 -277
- package/Label/index.d.ts +0 -37
- package/Label/index.js +0 -85
- package/Loading/index.d.ts +0 -17
- package/Loading/index.js +0 -47
- package/Menu/footerExpansion.d.ts +0 -9
- package/Menu/index.d.ts +0 -10
- package/Menu/index.js +0 -1105
- package/Menu/interface.d.ts +0 -141
- package/Menu/logo.d.ts +0 -9
- package/Menu/verticalMenuList.d.ts +0 -14
- package/Message/index.d.ts +0 -99
- package/Message/index.js +0 -246
- package/Modal/Confirm/index.d.ts +0 -65
- package/Modal/index.d.ts +0 -99
- package/Modal/index.js +0 -421
- package/Modal/lang/en_US.d.ts +0 -5
- package/Modal/lang/index.d.ts +0 -11
- package/Modal/lang/zh_CN.d.ts +0 -5
- package/MultiBox/index.d.ts +0 -58
- package/MultiBox/index.js +0 -272
- package/MultiBox/lang/en_US.d.ts +0 -4
- package/MultiBox/lang/index.d.ts +0 -9
- package/MultiBox/lang/zh_CN.d.ts +0 -4
- package/Notification/index.d.ts +0 -74
- package/Notification/index.js +0 -252
- package/OperateBtn/index.d.ts +0 -59
- package/OperateBtn/index.js +0 -237
- package/OperateBtn/lang/en_US.d.ts +0 -4
- package/OperateBtn/lang/index.d.ts +0 -9
- package/OperateBtn/lang/zh_CN.d.ts +0 -4
- package/PageHeader/horizontalMeun.d.ts +0 -9
- package/PageHeader/horizontalMeunRight.d.ts +0 -9
- package/PageHeader/index.d.ts +0 -10
- package/PageHeader/index.js +0 -1050
- package/PageHeader/interface.d.ts +0 -169
- package/Pagination/index.d.ts +0 -46
- package/Pagination/index.js +0 -461
- package/Pagination/lang/en_US.d.ts +0 -8
- package/Pagination/lang/index.d.ts +0 -17
- package/Pagination/lang/zh_CN.d.ts +0 -8
- package/ParauiProvider/index.d.ts +0 -8
- package/ParauiProvider/index.js +0 -52
- package/PasswordRules/index.d.ts +0 -46
- package/PasswordRules/index.js +0 -113
- package/PopConfirm/index.d.ts +0 -61
- package/PopConfirm/index.js +0 -194
- package/PopConfirm/lang/en_US.d.ts +0 -5
- package/PopConfirm/lang/index.d.ts +0 -11
- package/PopConfirm/lang/zh_CN.d.ts +0 -5
- package/Popover/index.d.ts +0 -16
- package/Popover/index.js +0 -59
- package/Progress/Line.d.ts +0 -47
- package/Progress/Steps.d.ts +0 -17
- package/Progress/index.d.ts +0 -83
- package/Progress/index.js +0 -323
- package/Progress/utils.d.ts +0 -6
- package/Querying/images/index.d.ts +0 -3
- package/Querying/index.d.ts +0 -26
- package/Querying/index.js +0 -760
- package/Querying/lang/en_US.d.ts +0 -4
- package/Querying/lang/index.d.ts +0 -9
- package/Querying/lang/zh_CN.d.ts +0 -4
- package/Radio/index.d.ts +0 -38
- package/Radio/index.js +0 -97
- package/RadioGroup/index.d.ts +0 -46
- package/RadioGroup/index.js +0 -134
- package/Search/index.d.ts +0 -57
- package/Search/index.js +0 -208
- package/Select/index.d.ts +0 -93
- package/Select/index.js +0 -1146
- package/Select/lang/en_US.d.ts +0 -5
- package/Select/lang/index.d.ts +0 -11
- package/Select/lang/zh_CN.d.ts +0 -5
- package/SelectInput/index.d.ts +0 -12
- package/SelectInput/index.js +0 -55
- package/Selector/index.d.ts +0 -11
- package/Selector/index.js +0 -2175
- package/Selector/interface.d.ts +0 -432
- package/Selector/lang/en_US.d.ts +0 -11
- package/Selector/lang/index.d.ts +0 -23
- package/Selector/lang/zh_CN.d.ts +0 -11
- package/Selector/selectorData/index.d.ts +0 -10
- package/Selector/selectorMain/index.d.ts +0 -10
- package/Selector/selectorNode/index.d.ts +0 -10
- package/Selector/util.d.ts +0 -15
- package/SelectorPicker/index.d.ts +0 -53
- package/SelectorPicker/index.js +0 -444
- package/SelectorPicker/lang/en_US.d.ts +0 -5
- package/SelectorPicker/lang/index.d.ts +0 -11
- package/SelectorPicker/lang/zh_CN.d.ts +0 -5
- package/SingleBox/index.d.ts +0 -44
- package/SingleBox/index.js +0 -224
- package/SingleBox/lang/en_US.d.ts +0 -4
- package/SingleBox/lang/index.d.ts +0 -9
- package/SingleBox/lang/zh_CN.d.ts +0 -4
- package/Slider/index.d.ts +0 -14
- package/Slider/index.js +0 -119
- package/Slider/interface.d.ts +0 -102
- package/Split/index.d.ts +0 -7
- package/Split/index.js +0 -123
- package/Status/index.d.ts +0 -21
- package/Status/index.js +0 -37
- package/Stepper/icons.d.ts +0 -5
- package/Stepper/index.d.ts +0 -59
- package/Stepper/index.js +0 -97
- package/Switch/index.d.ts +0 -78
- package/Switch/index.js +0 -71
- package/Table/index.d.ts +0 -10
- package/Table/index.js +0 -2999
- package/Table/interface.d.ts +0 -346
- package/Table/lang/en_US.d.ts +0 -8
- package/Table/lang/index.d.ts +0 -17
- package/Table/lang/zh_CN.d.ts +0 -8
- package/Table/tableBody.d.ts +0 -9
- package/Table/tableBodyElement/index.d.ts +0 -15
- package/Table/tableBodyInterface.d.ts +0 -73
- package/Table/tableContainer/index.d.ts +0 -16
- package/Table/tableElement/index.d.ts +0 -17
- package/Table/tableHead.d.ts +0 -9
- package/Table/tableHeadElement/index.d.ts +0 -15
- package/Table/tableHeadInterface.d.ts +0 -37
- package/Table/tablePagination.d.ts +0 -9
- package/Table/tablePaginationInterface.d.ts +0 -27
- package/Table/tdElement/index.d.ts +0 -15
- package/Table/thElement/index.d.ts +0 -28
- package/Table/trElement/index.d.ts +0 -15
- package/Table/util.d.ts +0 -34
- package/Tabs/index.d.ts +0 -69
- package/Tabs/index.js +0 -205
- package/Tabs/lang/en_US.d.ts +0 -4
- package/Tabs/lang/index.d.ts +0 -9
- package/Tabs/lang/zh_CN.d.ts +0 -4
- package/Tag/TagGroup.d.ts +0 -66
- package/Tag/index.d.ts +0 -34
- package/Tag/index.js +0 -259
- package/TextEditor/common.d.ts +0 -11
- package/TextEditor/index.d.ts +0 -127
- package/TextEditor/index.js +0 -286
- package/TextField/index.d.ts +0 -90
- package/TextField/index.js +0 -611
- package/TimePicker/index.d.ts +0 -22
- package/TimePicker/index.js +0 -80
- package/TimePicker/locale/en_US.d.ts +0 -3
- package/TimePicker/locale/zh_CN.d.ts +0 -3
- package/TimePicker/style/index.d.ts +0 -1
- package/Timeline/TimelineItem.d.ts +0 -30
- package/Timeline/index.d.ts +0 -32
- package/Timeline/index.js +0 -148
- package/Title/index.d.ts +0 -30
- package/Title/index.js +0 -50
- package/ToggleButton/ToggleButtonGroup.d.ts +0 -49
- package/ToggleButton/index.d.ts +0 -49
- package/ToggleButton/index.js +0 -193
- package/Tooltip/index.d.ts +0 -11
- package/Tooltip/index.js +0 -368
- package/Tooltip/interface.d.ts +0 -35
- package/Tooltip/utils.d.ts +0 -18
- package/Transfer/box.d.ts +0 -38
- package/Transfer/index.d.ts +0 -32
- package/Transfer/index.js +0 -611
- package/Transfer/lang/en_US.d.ts +0 -10
- package/Transfer/lang/index.d.ts +0 -21
- package/Transfer/lang/zh_CN.d.ts +0 -10
- package/Transfer/useClick.d.ts +0 -3
- package/Tree/OperateBar/index.d.ts +0 -13
- package/Tree/Tree.d.ts +0 -4
- package/Tree/index.d.ts +0 -5
- package/Tree/index.js +0 -38
- package/Tree/interface.d.ts +0 -210
- package/Tree/lang/en_US.d.ts +0 -8
- package/Tree/lang/index.d.ts +0 -17
- package/Tree/lang/zh_CN.d.ts +0 -8
- package/Tree/utils/closestPolyfill.d.ts +0 -0
- package/Tree/utils/tools.d.ts +0 -25
- package/Tree/utils/treeUtil.d.ts +0 -15
- package/Upload/Dragger/index.d.ts +0 -10
- package/Upload/ErroTip/index.d.ts +0 -13
- package/Upload/ImageUpload/index.d.ts +0 -16
- package/Upload/ImgCrop/EasyCrop.d.ts +0 -17
- package/Upload/ImgCrop/constants.d.ts +0 -7
- package/Upload/ImgCrop/index.d.ts +0 -6
- package/Upload/ImgCrop/interface.d.ts +0 -48
- package/Upload/UploadList/index.d.ts +0 -5
- package/Upload/index.d.ts +0 -15
- package/Upload/index.js +0 -1446
- package/Upload/interface.d.ts +0 -136
- package/Upload/lang/en_US.d.ts +0 -12
- package/Upload/lang/index.d.ts +0 -25
- package/Upload/lang/zh_CN.d.ts +0 -12
- package/_verture/constant-66aa48a1.js +0 -10
- package/_verture/defineProperty-62acccfc.js +0 -34
- package/_verture/index-74f820ba.js +0 -1355
- package/_verture/index-77f9e0fb.js +0 -236
- package/_verture/index-9fd86055.js +0 -711
- package/_verture/index-a369ca3f.js +0 -4
- package/_verture/index-beef914f.js +0 -340
- package/_verture/index-e2881a53.js +0 -16
- package/_verture/intl-5cbb940c.js +0 -57
- package/_verture/modalContext-92bb0e16.js +0 -201
- package/_verture/slicedToArray-76060636.js +0 -43
- package/_verture/sortable.esm-49896035.js +0 -3791
- package/_verture/style-inject.es-300983ab.js +0 -28
- package/_verture/toConsumableArray-81040c9e.js +0 -19
- package/_verture/tslib.es6-55ed4bd2.js +0 -38
- package/_verture/typeof-498dd2b1.js +0 -11
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/useFormatMessage-703f8b20.js +0 -20
- package/_verture/useGlobalProps-1b846a65.js +0 -11
- package/_verture/usePopupContainer-87febeb9.js +0 -68
- package/_verture/util-7e1fb1e2.js +0 -18
- package/index.d.ts +0 -144
- package/index.js +0 -180
- package/umd/AutoBox.js +0 -43
- package/umd/AutoTips.js +0 -15
- package/umd/Breadcrumbs.js +0 -42
- package/umd/Button.js +0 -43
- package/umd/ButtonGroup.js +0 -43
- package/umd/Carousel.js +0 -6
- package/umd/Cascader.js +0 -43
- package/umd/Checkbox.js +0 -42
- package/umd/CheckboxGroup.js +0 -42
- package/umd/Collapse.js +0 -43
- package/umd/CollapseBox.js +0 -1
- package/umd/CollapseLayout.js +0 -29
- package/umd/ColorPicker.js +0 -1
- package/umd/ComboSelect.js +0 -42
- package/umd/Container.js +0 -1
- package/umd/DatePicker.js +0 -42
- package/umd/Desktop.js +0 -42
- package/umd/DragVerify.js +0 -28
- package/umd/Drawer.js +0 -43
- package/umd/Dropdown.js +0 -15
- package/umd/DynamicMultiBox.js +0 -54
- package/umd/Empty.js +0 -15
- package/umd/Form.js +0 -42
- package/umd/FormItem.js +0 -42
- package/umd/FunctionModal.js +0 -42
- package/umd/GlobalContext.js +0 -1
- package/umd/Help.js +0 -42
- package/umd/HelperText.js +0 -1
- package/umd/InputLang.js +0 -42
- package/umd/InputNumber.js +0 -42
- package/umd/Label.js +0 -42
- package/umd/Loading.js +0 -29
- package/umd/Menu.js +0 -29
- package/umd/Message.js +0 -30
- package/umd/Modal.js +0 -42
- package/umd/MultiBox.js +0 -42
- package/umd/Notification.js +0 -43
- package/umd/OperateBtn.js +0 -42
- package/umd/PageHeader.js +0 -42
- package/umd/Pagination.js +0 -42
- package/umd/ParauiProvider.js +0 -15
- package/umd/PasswordRules.js +0 -29
- package/umd/PopConfirm.js +0 -42
- package/umd/Popover.js +0 -15
- package/umd/Progress.js +0 -35
- package/umd/Querying.js +0 -15
- package/umd/Radio.js +0 -42
- package/umd/RadioGroup.js +0 -42
- package/umd/Search.js +0 -42
- package/umd/Select.js +0 -42
- package/umd/SelectInput.js +0 -42
- package/umd/Selector.js +0 -42
- package/umd/SelectorPicker.js +0 -42
- package/umd/SingleBox.js +0 -42
- package/umd/Slider.js +0 -15
- package/umd/Split.js +0 -1
- package/umd/Status.js +0 -1
- package/umd/Stepper.js +0 -42
- package/umd/Switch.js +0 -42
- package/umd/Table.js +0 -42
- package/umd/Tabs.js +0 -42
- package/umd/Tag.js +0 -43
- package/umd/TextEditor.js +0 -205
- package/umd/TextField.js +0 -42
- package/umd/TimePicker.js +0 -42
- package/umd/Timeline.js +0 -1
- package/umd/Title.js +0 -1
- package/umd/ToggleButton.js +0 -43
- package/umd/Tooltip.js +0 -15
- package/umd/Transfer.js +0 -49
- package/umd/Tree.js +0 -42
- package/umd/Upload.js +0 -56
package/Table/index.js
DELETED
|
@@ -1,2999 +0,0 @@
|
|
|
1
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-81040c9e.js';
|
|
2
|
-
import { _ as _typeof } from '../_verture/typeof-498dd2b1.js';
|
|
3
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-76060636.js';
|
|
4
|
-
import { r as regenerator } from '../_verture/index-beef914f.js';
|
|
5
|
-
import { _ as __rest, a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
6
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import { useRef, useState, useEffect, useMemo, useCallback, Fragment as Fragment$1 } from 'react';
|
|
8
|
-
import { Get, Post, DeepClone, GetBrowserClass, Cancel, ArrayToObject } from '@paraview/lib';
|
|
9
|
-
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
10
|
-
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
11
|
-
import { Popover } from '../Popover/index.js';
|
|
12
|
-
import { Checkbox } from '../Checkbox/index.js';
|
|
13
|
-
import { Button } from '../Button/index.js';
|
|
14
|
-
import AutoTips from '../AutoTips/index.js';
|
|
15
|
-
import Screen from '@para-ui/icons/ScreenF';
|
|
16
|
-
import SolidArrowUp from '@para-ui/icons/UpTriangleF';
|
|
17
|
-
import SolidArrowDown from '@para-ui/icons/DownTriangleF';
|
|
18
|
-
import Panel from '@para-ui/icons/Panel';
|
|
19
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
|
|
20
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
|
|
21
|
-
import { Radio } from '../Radio/index.js';
|
|
22
|
-
import Empty from '../Empty/index.js';
|
|
23
|
-
import OperateBtn from '../OperateBtn/index.js';
|
|
24
|
-
import Down from '@para-ui/icons/Down';
|
|
25
|
-
import { Pagination } from '../Pagination/index.js';
|
|
26
|
-
import { Loading } from '../Loading/index.js';
|
|
27
|
-
import { u as useGlobalProps } from '../_verture/useGlobalProps-1b846a65.js';
|
|
28
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
29
|
-
import '../Tooltip/index.js';
|
|
30
|
-
import 'rc-tooltip';
|
|
31
|
-
import 'rc-tooltip/lib/placements';
|
|
32
|
-
import 'clsx';
|
|
33
|
-
import '../_verture/usePopupContainer-87febeb9.js';
|
|
34
|
-
import '../Label/index.js';
|
|
35
|
-
import '../Help/index.js';
|
|
36
|
-
import '@para-ui/icons/Help';
|
|
37
|
-
import '@para-ui/icons/LoadingF';
|
|
38
|
-
import '@para-ui/icons/Forbid';
|
|
39
|
-
import '../_verture/index-77f9e0fb.js';
|
|
40
|
-
import 'rc-dropdown';
|
|
41
|
-
import 'dayjs';
|
|
42
|
-
import '@para-ui/core/GlobalContext';
|
|
43
|
-
import '@para-ui/icons/More';
|
|
44
|
-
import '../TextField/index.js';
|
|
45
|
-
import '@para-ui/icons/PreviewClose';
|
|
46
|
-
import '@para-ui/icons/PreviewOpen';
|
|
47
|
-
import '@para-ui/icons/CloseCircle';
|
|
48
|
-
import '../HelperText/index.js';
|
|
49
|
-
import '../Select/index.js';
|
|
50
|
-
import '@para-ui/icons/Close';
|
|
51
|
-
import '@para-ui/icons/Check';
|
|
52
|
-
import '@para-ui/icons/Search';
|
|
53
|
-
import '@para-ui/icons/DoubleLeft';
|
|
54
|
-
import '@para-ui/icons/Left';
|
|
55
|
-
import 'rc-pagination';
|
|
56
|
-
import '@para-ui/icons/Right';
|
|
57
|
-
import '@para-ui/icons/DoubleRight';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 发送请求
|
|
61
|
-
* @param obj {ReqProps} 请求信息
|
|
62
|
-
*/
|
|
63
|
-
var requestFunc = function requestFunc(obj) {
|
|
64
|
-
var method = obj.method,
|
|
65
|
-
url = obj.url,
|
|
66
|
-
ctx = obj.ctx,
|
|
67
|
-
data = obj.data,
|
|
68
|
-
otherProps = __rest(obj, ["method", "url", "ctx", "data"]);
|
|
69
|
-
if (method === 'Get') {
|
|
70
|
-
return Get(Object.assign({
|
|
71
|
-
url: url,
|
|
72
|
-
ctx: ctx
|
|
73
|
-
}, otherProps));
|
|
74
|
-
}
|
|
75
|
-
if (method === 'Post') {
|
|
76
|
-
return Post(Object.assign({
|
|
77
|
-
url: url,
|
|
78
|
-
ctx: ctx,
|
|
79
|
-
data: data
|
|
80
|
-
}, otherProps));
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* 处理get请求地址
|
|
85
|
-
* @param obj {ReqProps} 请求信息
|
|
86
|
-
* @return string get请求地址参数
|
|
87
|
-
*/
|
|
88
|
-
var handGetReqParams = function handGetReqParams(obj) {
|
|
89
|
-
var str = obj.url;
|
|
90
|
-
var params = obj.data || {};
|
|
91
|
-
var arrKey = Object.keys(params);
|
|
92
|
-
var paramsArr = [];
|
|
93
|
-
for (var i = 0, l = arrKey.length; i < l; i++) {
|
|
94
|
-
var key = arrKey[i];
|
|
95
|
-
var val = params[key];
|
|
96
|
-
if (_typeof(val) === 'object') {
|
|
97
|
-
val = encodeURIComponent(JSON.stringify(val));
|
|
98
|
-
} else {
|
|
99
|
-
val = encodeURIComponent(val);
|
|
100
|
-
}
|
|
101
|
-
paramsArr.push(key + '=' + val);
|
|
102
|
-
}
|
|
103
|
-
var paramsStr = paramsArr.join('&');
|
|
104
|
-
var pos = str.indexOf('?');
|
|
105
|
-
if (pos !== -1) {
|
|
106
|
-
str += (pos === str.length - 1 ? '' : '&') + paramsStr;
|
|
107
|
-
} else {
|
|
108
|
-
str += '?' + paramsStr;
|
|
109
|
-
}
|
|
110
|
-
return str;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* 提取字符串里面的数字
|
|
114
|
-
* */
|
|
115
|
-
var getStringInNumber = function getStringInNumber(str) {
|
|
116
|
-
if (typeof str === 'number') return str;
|
|
117
|
-
var strHand = str.replace(/[^0-9$]/ig, '');
|
|
118
|
-
return Number(strHand);
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* 获取选择列localStorage
|
|
122
|
-
* @param key {string} 键值
|
|
123
|
-
* @param num {number} 过期天数
|
|
124
|
-
* */
|
|
125
|
-
var getLocalStorageSelectHead = function getLocalStorageSelectHead(key, num) {
|
|
126
|
-
//debugger
|
|
127
|
-
var headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
128
|
-
var headJson = JSON.parse(headJsonStr);
|
|
129
|
-
var headJsonArr = Object.keys(headJson);
|
|
130
|
-
for (var i = 0, l = headJsonArr.length; i < l; i++) {
|
|
131
|
-
var keyStr = headJsonArr[i];
|
|
132
|
-
var item = headJson[i];
|
|
133
|
-
if (!item) continue;
|
|
134
|
-
var newDate = new Date().getTime(); // 当前时间
|
|
135
|
-
var endTime = item.storageTime + item.validity; // 过期时间
|
|
136
|
-
// 过期时间 小于 当前时间, 说明已经过期了, 删除当前表格列数据
|
|
137
|
-
if (endTime < newDate) {
|
|
138
|
-
delete headJson[keyStr];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
var headJsonItem = headJson[key];
|
|
142
|
-
// 重置过期时间
|
|
143
|
-
if (headJsonItem) {
|
|
144
|
-
headJsonItem.storageTime = new Date().getTime();
|
|
145
|
-
headJsonItem.validity = num * (60 * 60 * 24);
|
|
146
|
-
}
|
|
147
|
-
return headJsonItem || {};
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* 设置选择列localStorage
|
|
151
|
-
* @param key {string} 键值
|
|
152
|
-
* @param val {HeadLocalStorageItem} 保存值
|
|
153
|
-
* */
|
|
154
|
-
var setLocalStorageSelectHead = function setLocalStorageSelectHead(key, val) {
|
|
155
|
-
var headJsonStr = window.localStorage.getItem('_paraui_table_head') || '{}';
|
|
156
|
-
var headJson = JSON.parse(headJsonStr);
|
|
157
|
-
headJson[key] = val;
|
|
158
|
-
window.localStorage.setItem('_paraui_table_head', JSON.stringify(headJson));
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* 查找元素
|
|
162
|
-
* @param el 当前元素
|
|
163
|
-
* @param selector 查找元素class
|
|
164
|
-
*/
|
|
165
|
-
var closest = function closest(el, selector) {
|
|
166
|
-
var matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
167
|
-
while (el) {
|
|
168
|
-
if (matchesSelector.call(el, selector)) {
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
el = el.parentElement;
|
|
172
|
-
}
|
|
173
|
-
return el;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
var css_248z$7 = ".table-head-element {\n display: table-header-group;\n}";
|
|
177
|
-
styleInject(css_248z$7);
|
|
178
|
-
|
|
179
|
-
var TableHeadElement = function TableHeadElement(props) {
|
|
180
|
-
var className = props.className,
|
|
181
|
-
style = props.style,
|
|
182
|
-
children = props.children,
|
|
183
|
-
otherProps = __rest(props, ["className", "style", "children"]);
|
|
184
|
-
var handClass = function handClass() {
|
|
185
|
-
var str = 'table-head-element';
|
|
186
|
-
if (className) str += ' ' + className;
|
|
187
|
-
return str;
|
|
188
|
-
};
|
|
189
|
-
return jsx("thead", Object.assign({
|
|
190
|
-
className: handClass(),
|
|
191
|
-
style: style
|
|
192
|
-
}, otherProps, {
|
|
193
|
-
children: children
|
|
194
|
-
}));
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
var css_248z$6 = ".tr-element {\n display: table-row;\n outline: 0;\n vertical-align: middle;\n}";
|
|
198
|
-
styleInject(css_248z$6);
|
|
199
|
-
|
|
200
|
-
var TrElement = function TrElement(props) {
|
|
201
|
-
var className = props.className,
|
|
202
|
-
style = props.style,
|
|
203
|
-
children = props.children,
|
|
204
|
-
otherProps = __rest(props, ["className", "style", "children"]);
|
|
205
|
-
var handClass = function handClass() {
|
|
206
|
-
var str = 'tr-element';
|
|
207
|
-
if (className) str += ' ' + className;
|
|
208
|
-
return str;
|
|
209
|
-
};
|
|
210
|
-
return jsx("tr", Object.assign({
|
|
211
|
-
className: handClass(),
|
|
212
|
-
style: style
|
|
213
|
-
}, otherProps, {
|
|
214
|
-
children: children
|
|
215
|
-
}));
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
var css_248z$5 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.th-element {\n letter-spacing: 0.01071em;\n line-height: 1.43;\n padding: 0;\n font-weight: 700;\n font-size: 14px;\n background-color: rgb(248, 249, 251);\n border-bottom: 1px solid rgba(171, 176, 185, 0.12);\n height: 100%;\n}\n.th-element.th-element-draggable {\n position: relative;\n}\n.th-element:first-child {\n border-top-left-radius: 4px;\n}\n.th-element:last-child {\n border-top-right-radius: 4px;\n}\n.th-element:hover {\n background-color: rgb(237, 241, 249);\n}\n.th-element.table-operate.table-operate-small {\n width: 112px;\n}\n.th-element.table-operate.table-operate-small > .table-header-box {\n width: 112px;\n}\n.th-element > .th-element-draggable-box {\n width: 6px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n}\n.th-element:hover > .th-element-draggable-box {\n background-color: rgba(54, 102, 214, 0.2);\n cursor: ew-resize;\n}";
|
|
219
|
-
styleInject(css_248z$5);
|
|
220
|
-
|
|
221
|
-
var ThElement = function ThElement(props) {
|
|
222
|
-
var className = props.className,
|
|
223
|
-
style = props.style,
|
|
224
|
-
children = props.children,
|
|
225
|
-
draggable = props.draggable,
|
|
226
|
-
_props$lineWidth = props.lineWidth,
|
|
227
|
-
lineWidth = _props$lineWidth === void 0 ? 80 : _props$lineWidth,
|
|
228
|
-
headCell = props.headCell,
|
|
229
|
-
onDragDown = props.onDragDown,
|
|
230
|
-
otherProps = __rest(props, ["className", "style", "children", "draggable", "lineWidth", "headCell", "onDragDown"]);
|
|
231
|
-
var domRef = useRef(null);
|
|
232
|
-
var constData = useRef({
|
|
233
|
-
startX: 0,
|
|
234
|
-
moveX: 0,
|
|
235
|
-
table: null,
|
|
236
|
-
tableContainer: null,
|
|
237
|
-
lineDom: null,
|
|
238
|
-
th: null
|
|
239
|
-
});
|
|
240
|
-
// 处理最小宽度
|
|
241
|
-
var handMinWidth = function handMinWidth(e) {
|
|
242
|
-
var minWidth = lineWidth;
|
|
243
|
-
// 自身设置列宽度小于默认列宽度,最小取自身的
|
|
244
|
-
if (headCell === null || headCell === void 0 ? void 0 : headCell.width) {
|
|
245
|
-
var width = getStringInNumber(headCell.width);
|
|
246
|
-
if (width < minWidth) minWidth = width;
|
|
247
|
-
}
|
|
248
|
-
var thWidth = constData.current.th.offsetWidth; // th宽度
|
|
249
|
-
var moveX = e.clientX - constData.current.startX; // 移动的位置
|
|
250
|
-
var handWidth = thWidth + moveX;
|
|
251
|
-
var initX = constData.current.th.offsetLeft + thWidth;
|
|
252
|
-
var left = initX + moveX;
|
|
253
|
-
// 移动以后的宽度小于最小宽度,取最小宽度
|
|
254
|
-
if (handWidth < minWidth) {
|
|
255
|
-
// 超出大小限制
|
|
256
|
-
handWidth = minWidth;
|
|
257
|
-
left = constData.current.th.offsetLeft + handWidth;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
width: handWidth,
|
|
261
|
-
left: left // 定位线居左距离
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
|
-
// 鼠标移动事件
|
|
265
|
-
var mousemove = function mousemove(e) {
|
|
266
|
-
var result = handMinWidth(e);
|
|
267
|
-
constData.current.lineDom.style.left = result.left + 'px';
|
|
268
|
-
};
|
|
269
|
-
// 鼠标抬起
|
|
270
|
-
var mouseup = function mouseup(e) {
|
|
271
|
-
var _a, _b;
|
|
272
|
-
var dom = domRef.current;
|
|
273
|
-
var result = handMinWidth(e);
|
|
274
|
-
dom.style.width = result.width + 'px';
|
|
275
|
-
(_a = constData.current.tableContainer) === null || _a === void 0 ? void 0 : _a.removeChild(constData.current.lineDom);
|
|
276
|
-
(_b = constData.current.table) === null || _b === void 0 ? void 0 : _b.classList.remove("".concat($prefixCls, "-table-draggable"));
|
|
277
|
-
onDragDown && onDragDown(result);
|
|
278
|
-
window.removeEventListener('mousemove', mousemove);
|
|
279
|
-
window.removeEventListener('mouseup', mouseup);
|
|
280
|
-
};
|
|
281
|
-
// 鼠标按下
|
|
282
|
-
var onMouseDown = function onMouseDown(e) {
|
|
283
|
-
var _a;
|
|
284
|
-
constData.current.startX = e.clientX;
|
|
285
|
-
constData.current.table = closest(domRef.current, ".".concat($prefixCls, "-table"));
|
|
286
|
-
constData.current.tableContainer = closest(domRef.current, ".".concat($prefixCls, "-table .table-container"));
|
|
287
|
-
constData.current.th = closest(domRef.current, 'th');
|
|
288
|
-
(_a = constData.current.table) === null || _a === void 0 ? void 0 : _a.classList.add("".concat($prefixCls, "-table-draggable"));
|
|
289
|
-
appendLine();
|
|
290
|
-
window.addEventListener('mousemove', mousemove);
|
|
291
|
-
window.addEventListener('mouseup', mouseup);
|
|
292
|
-
};
|
|
293
|
-
/** 添加定位线 */
|
|
294
|
-
var appendLine = function appendLine() {
|
|
295
|
-
if (!constData.current.tableContainer || !constData.current.th) return;
|
|
296
|
-
var tableDom = closest(domRef.current, ".".concat($prefixCls, "-table .table-container table"));
|
|
297
|
-
var tableContainerHeight = constData.current.tableContainer.offsetHeight;
|
|
298
|
-
var tableDomHeight = tableDom.offsetHeight;
|
|
299
|
-
var div = document.createElement('div');
|
|
300
|
-
div.setAttribute('class', 'table-pos-line');
|
|
301
|
-
// 定位线高度
|
|
302
|
-
div.style.height = (tableDomHeight > tableContainerHeight ? tableContainerHeight : tableDomHeight) + 'px';
|
|
303
|
-
// 定位线的居左距离
|
|
304
|
-
div.style.left = constData.current.th.offsetLeft + constData.current.th.offsetWidth + 'px';
|
|
305
|
-
constData.current.lineDom = div;
|
|
306
|
-
constData.current.tableContainer.appendChild(div);
|
|
307
|
-
};
|
|
308
|
-
/** 拖动元素 */
|
|
309
|
-
var handDrag = function handDrag() {
|
|
310
|
-
if (!draggable) return null;
|
|
311
|
-
return jsx("div", {
|
|
312
|
-
className: "th-element-draggable-box",
|
|
313
|
-
onMouseDown: onMouseDown
|
|
314
|
-
});
|
|
315
|
-
};
|
|
316
|
-
// 处理className
|
|
317
|
-
var handClass = function handClass() {
|
|
318
|
-
var str = 'th-element';
|
|
319
|
-
if (draggable) str += ' th-element-draggable';
|
|
320
|
-
if (className) str += ' ' + className;
|
|
321
|
-
return str;
|
|
322
|
-
};
|
|
323
|
-
return jsxs("th", Object.assign({
|
|
324
|
-
className: handClass(),
|
|
325
|
-
style: style
|
|
326
|
-
}, otherProps, {
|
|
327
|
-
ref: domRef
|
|
328
|
-
}, {
|
|
329
|
-
children: [children, handDrag()]
|
|
330
|
-
}));
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
var en = {
|
|
334
|
-
empty: 'Empty',
|
|
335
|
-
determine: 'Ok',
|
|
336
|
-
restoreDefault: 'Restore default',
|
|
337
|
-
serial: 'Sort',
|
|
338
|
-
loadMore: 'Load more'
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
var zh = {
|
|
342
|
-
empty: '清空',
|
|
343
|
-
determine: '确定',
|
|
344
|
-
restoreDefault: '恢复默认',
|
|
345
|
-
serial: '序号',
|
|
346
|
-
loadMore: '加载更多'
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
var localeJson = {
|
|
350
|
-
zh: zh,
|
|
351
|
-
en: en
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
var TableHead$1 = function TableHead(props) {
|
|
355
|
-
var _props$headData = props.headData,
|
|
356
|
-
headData = _props$headData === void 0 ? [] : _props$headData,
|
|
357
|
-
sortTable = props.sortTable,
|
|
358
|
-
filter = props.filter,
|
|
359
|
-
expandable = props.expandable,
|
|
360
|
-
check = props.check,
|
|
361
|
-
radio = props.radio,
|
|
362
|
-
onRequestSort = props.onRequestSort,
|
|
363
|
-
_props$orderFieldArr = props.orderFieldArr,
|
|
364
|
-
orderFieldArr = _props$orderFieldArr === void 0 ? [] : _props$orderFieldArr,
|
|
365
|
-
_props$orderTypeArr = props.orderTypeArr,
|
|
366
|
-
orderTypeArr = _props$orderTypeArr === void 0 ? [] : _props$orderTypeArr,
|
|
367
|
-
selectAll = props.selectAll,
|
|
368
|
-
selectStatus = props.selectStatus,
|
|
369
|
-
align = props.align,
|
|
370
|
-
_props$showList = props.showList,
|
|
371
|
-
showList = _props$showList === void 0 ? [] : _props$showList,
|
|
372
|
-
changeShowList = props.changeShowList,
|
|
373
|
-
selectFilter = props.selectFilter,
|
|
374
|
-
changeFilter = props.changeFilter,
|
|
375
|
-
operate = props.operate,
|
|
376
|
-
showColumns = props.showColumns,
|
|
377
|
-
fixedTable = props.fixedTable,
|
|
378
|
-
fixedColumn = props.fixedColumn,
|
|
379
|
-
posFixed = props.posFixed,
|
|
380
|
-
beyondText = props.beyondText,
|
|
381
|
-
lineWidth = props.lineWidth,
|
|
382
|
-
dragColumn = props.dragColumn,
|
|
383
|
-
changeColumnWidth = props.changeColumnWidth,
|
|
384
|
-
headDataConfig = props.headDataConfig,
|
|
385
|
-
getPopupContainer = props.getPopupContainer,
|
|
386
|
-
tipMaxWidth = props.tipMaxWidth;
|
|
387
|
-
var _useState = useState(false),
|
|
388
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
389
|
-
indeterminate = _useState2[0],
|
|
390
|
-
setIndeterminate = _useState2[1]; // 半选中
|
|
391
|
-
var _useState3 = useState(false),
|
|
392
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
393
|
-
checked = _useState4[0],
|
|
394
|
-
setChecked = _useState4[1]; // 选中
|
|
395
|
-
var _useState5 = useState(null),
|
|
396
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
397
|
-
anchorElColums = _useState6[0],
|
|
398
|
-
setAnchorElColums = _useState6[1]; // 显示列定位元素
|
|
399
|
-
var _useState7 = useState({}),
|
|
400
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
401
|
-
headDataJson = _useState8[0],
|
|
402
|
-
setHeadDataJson = _useState8[1]; // 显示列json
|
|
403
|
-
var _useState9 = useState({}),
|
|
404
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
405
|
-
filterHead = _useState10[0],
|
|
406
|
-
setFilterHead = _useState10[1]; // 过滤项当前表头数据
|
|
407
|
-
var _useState11 = useState({}),
|
|
408
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
409
|
-
selectFilterCom = _useState12[0],
|
|
410
|
-
setSelectFilterCom = _useState12[1]; // 过滤项当前选中值
|
|
411
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
412
|
-
useEffect(function () {
|
|
413
|
-
// 全选
|
|
414
|
-
if (selectStatus === 'all') {
|
|
415
|
-
setChecked(true);
|
|
416
|
-
setIndeterminate(false);
|
|
417
|
-
}
|
|
418
|
-
// 半选
|
|
419
|
-
if (selectStatus === 'half') {
|
|
420
|
-
setChecked(false);
|
|
421
|
-
setIndeterminate(true);
|
|
422
|
-
}
|
|
423
|
-
// 不选
|
|
424
|
-
if (selectStatus === 'not') {
|
|
425
|
-
setChecked(false);
|
|
426
|
-
setIndeterminate(false);
|
|
427
|
-
}
|
|
428
|
-
}, [selectStatus]);
|
|
429
|
-
useEffect(function () {
|
|
430
|
-
if (headData) {
|
|
431
|
-
var json = [];
|
|
432
|
-
for (var i = 0, l = headData.length; i < l; i++) {
|
|
433
|
-
var item = headData[i];
|
|
434
|
-
json[item.name] = item;
|
|
435
|
-
}
|
|
436
|
-
setHeadDataJson(json);
|
|
437
|
-
}
|
|
438
|
-
}, [headData]);
|
|
439
|
-
useEffect(function () {
|
|
440
|
-
if (selectFilter) setSelectFilterCom(DeepClone(selectFilter));
|
|
441
|
-
}, [selectFilter]);
|
|
442
|
-
/**
|
|
443
|
-
* 表格排序
|
|
444
|
-
* @param name 排序列
|
|
445
|
-
* @param event 当前排序元素
|
|
446
|
-
*/
|
|
447
|
-
var createSortHandler = function createSortHandler(name, item) {
|
|
448
|
-
return function (event) {
|
|
449
|
-
// 不存在排序,不触发事件
|
|
450
|
-
if (!(sortTable && item.name && item.sort !== false)) return;
|
|
451
|
-
if (onRequestSort) onRequestSort(event, name);
|
|
452
|
-
};
|
|
453
|
-
};
|
|
454
|
-
/**
|
|
455
|
-
* 全选 / 全不选
|
|
456
|
-
* @param event 操作元素
|
|
457
|
-
* @param bol 选中 / 不选中
|
|
458
|
-
*/
|
|
459
|
-
var onSelectAll = function onSelectAll(event, bol) {
|
|
460
|
-
if (selectAll) selectAll(event, bol);
|
|
461
|
-
};
|
|
462
|
-
/**
|
|
463
|
-
* 点击显示选择列
|
|
464
|
-
* @param event 点击元素
|
|
465
|
-
*/
|
|
466
|
-
var clickShowColums = function clickShowColums(event) {
|
|
467
|
-
setAnchorElColums(event.currentTarget);
|
|
468
|
-
};
|
|
469
|
-
// 点击隐藏选择列
|
|
470
|
-
var clickHideColums = function clickHideColums(bol) {
|
|
471
|
-
if (bol) return;
|
|
472
|
-
setAnchorElColums(null);
|
|
473
|
-
};
|
|
474
|
-
/**
|
|
475
|
-
* 点击显示列 列表
|
|
476
|
-
* @param item 详细
|
|
477
|
-
*/
|
|
478
|
-
var clickColumsList = function clickColumsList(item) {
|
|
479
|
-
return function () {
|
|
480
|
-
var name = item.name;
|
|
481
|
-
var itemHead = headDataJson[name];
|
|
482
|
-
if (itemHead) {
|
|
483
|
-
// 取消勾选
|
|
484
|
-
delete headDataJson[name];
|
|
485
|
-
var arr = Object.keys(headDataJson);
|
|
486
|
-
var arr1 = [];
|
|
487
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
488
|
-
var _name = arr[i];
|
|
489
|
-
arr1.push(headDataJson[_name]);
|
|
490
|
-
}
|
|
491
|
-
changeShowList && changeShowList(arr1, false, item);
|
|
492
|
-
} else {
|
|
493
|
-
headData.push(item);
|
|
494
|
-
changeShowList && changeShowList(headData, false, item);
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
};
|
|
498
|
-
// 重置显示列
|
|
499
|
-
var resetShowList = function resetShowList() {
|
|
500
|
-
changeShowList && changeShowList(headData, true);
|
|
501
|
-
};
|
|
502
|
-
/**
|
|
503
|
-
* 点击显示过滤
|
|
504
|
-
* @param headCell 当前列信息
|
|
505
|
-
* @param event 元素
|
|
506
|
-
*/
|
|
507
|
-
var clickShowFilter = function clickShowFilter(headCell) {
|
|
508
|
-
return function (event) {
|
|
509
|
-
setFilterHead(headCell);
|
|
510
|
-
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
// 点击隐藏过滤
|
|
514
|
-
var clickHideFilter = function clickHideFilter(bol) {
|
|
515
|
-
if (bol) return;
|
|
516
|
-
setFilterHead({});
|
|
517
|
-
setSelectFilterCom(Object.assign({}, selectFilter));
|
|
518
|
-
};
|
|
519
|
-
// 点击过滤
|
|
520
|
-
var clickFilter = function clickFilter(item) {
|
|
521
|
-
return function () {
|
|
522
|
-
var name = filterHead.name;
|
|
523
|
-
var filterValue = DeepClone(selectFilterCom[name] || []);
|
|
524
|
-
var index = filterValue.indexOf(item.value);
|
|
525
|
-
if (index !== -1) {
|
|
526
|
-
// 勾选 -> 不勾选
|
|
527
|
-
filterValue.splice(index, 1);
|
|
528
|
-
} else {
|
|
529
|
-
// 不勾选 -> 勾选
|
|
530
|
-
filterValue.push(item.value);
|
|
531
|
-
}
|
|
532
|
-
var filterRadio = filterHead.filterRadio;
|
|
533
|
-
if (filterRadio) {
|
|
534
|
-
// 过滤单个
|
|
535
|
-
var num = filterValue.indexOf(item.value);
|
|
536
|
-
if (num !== -1) {
|
|
537
|
-
filterValue = [filterValue[num]];
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
selectFilterCom[name] = filterValue;
|
|
541
|
-
setSelectFilterCom(Object.assign({}, selectFilterCom));
|
|
542
|
-
};
|
|
543
|
-
};
|
|
544
|
-
/**
|
|
545
|
-
* 重置 / 确定过滤
|
|
546
|
-
* @param type {'reset' | 'confirm'} 重置 / 确定过滤
|
|
547
|
-
*/
|
|
548
|
-
var filterFunc = function filterFunc(type) {
|
|
549
|
-
return function () {
|
|
550
|
-
if (type === 'confirm') {
|
|
551
|
-
// 确定
|
|
552
|
-
changeFilter && changeFilter(Object.assign({}, selectFilterCom));
|
|
553
|
-
setFilterHead({});
|
|
554
|
-
} else {
|
|
555
|
-
// 重置
|
|
556
|
-
var json = DeepClone(selectFilterCom);
|
|
557
|
-
delete json[filterHead.name];
|
|
558
|
-
setSelectFilterCom(json);
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
};
|
|
562
|
-
/**
|
|
563
|
-
* 自定义过滤确定
|
|
564
|
-
* @param val {[name: string]: any[]}
|
|
565
|
-
* */
|
|
566
|
-
var filterCustomConfirm = function filterCustomConfirm() {
|
|
567
|
-
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
568
|
-
changeFilter && changeFilter(Object.assign({}, val));
|
|
569
|
-
setFilterHead({});
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
572
|
-
* 处理TableCell
|
|
573
|
-
* @param item 当前列信息
|
|
574
|
-
*/
|
|
575
|
-
var handCellClass = function handCellClass(item) {
|
|
576
|
-
var str = 'table-header-box';
|
|
577
|
-
// 排序
|
|
578
|
-
if (sortTable && item.name && item.sort !== false) {
|
|
579
|
-
str += ' table-header-box-sort';
|
|
580
|
-
var index = orderFieldArr.indexOf(item.name);
|
|
581
|
-
if (index !== -1) {
|
|
582
|
-
// 升序
|
|
583
|
-
if (orderTypeArr[index] === 'asc') {
|
|
584
|
-
str += ' table-header-box-sort-asc';
|
|
585
|
-
}
|
|
586
|
-
// 降序
|
|
587
|
-
if (orderTypeArr[index] === 'desc') {
|
|
588
|
-
str += ' table-header-box-sort-desc';
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
// 过滤
|
|
593
|
-
if (filter && item.name && item.filter) {
|
|
594
|
-
str += ' table-header-box-filter';
|
|
595
|
-
}
|
|
596
|
-
return str;
|
|
597
|
-
};
|
|
598
|
-
// 复选框memo
|
|
599
|
-
var TableCheckMemo = useMemo(function () {
|
|
600
|
-
if (check) {
|
|
601
|
-
var handCls = function handCls() {
|
|
602
|
-
var str = 'table-checkbox table-head-btn';
|
|
603
|
-
if (fixedColumn) {
|
|
604
|
-
str += ' table-fixed-dom-left';
|
|
605
|
-
// 左边没有定位,且没有单选,没有嵌套表格
|
|
606
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol) && !radio && !expandable) {
|
|
607
|
-
str += ' table-fixed-dom-left-last';
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
return str;
|
|
611
|
-
};
|
|
612
|
-
return jsx(ThElement, Object.assign({
|
|
613
|
-
align: "center",
|
|
614
|
-
className: handCls(),
|
|
615
|
-
draggable: false
|
|
616
|
-
}, {
|
|
617
|
-
children: jsx("div", Object.assign({
|
|
618
|
-
className: "table-header-box"
|
|
619
|
-
}, {
|
|
620
|
-
children: jsx(Checkbox, {
|
|
621
|
-
indeterminate: indeterminate,
|
|
622
|
-
checked: checked,
|
|
623
|
-
onChange: onSelectAll
|
|
624
|
-
})
|
|
625
|
-
}))
|
|
626
|
-
}));
|
|
627
|
-
}
|
|
628
|
-
}, [check, indeterminate, checked, selectAll, posFixed, radio, expandable, fixedColumn]);
|
|
629
|
-
// 单选框memo
|
|
630
|
-
var TableRadioMemo = useMemo(function () {
|
|
631
|
-
if (radio) {
|
|
632
|
-
var handCls = function handCls() {
|
|
633
|
-
var str = 'table-radio table-head-btn';
|
|
634
|
-
if (fixedColumn) {
|
|
635
|
-
str += ' table-fixed-dom-left';
|
|
636
|
-
// 左边没有定位,没有嵌套表格
|
|
637
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol) && !expandable) {
|
|
638
|
-
str += ' table-fixed-dom-left-last';
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
return str;
|
|
642
|
-
};
|
|
643
|
-
return jsx(ThElement, Object.assign({
|
|
644
|
-
align: "center",
|
|
645
|
-
className: handCls(),
|
|
646
|
-
draggable: false
|
|
647
|
-
}, {
|
|
648
|
-
children: jsx("div", {
|
|
649
|
-
className: "table-header-box"
|
|
650
|
-
})
|
|
651
|
-
}));
|
|
652
|
-
}
|
|
653
|
-
}, [radio, posFixed, expandable, fixedColumn]);
|
|
654
|
-
// 嵌套表格memo
|
|
655
|
-
var TableExpandableMemo = useMemo(function () {
|
|
656
|
-
if (expandable) {
|
|
657
|
-
var handCls = function handCls() {
|
|
658
|
-
var str = 'table-expandable table-head-btn';
|
|
659
|
-
if (fixedColumn) {
|
|
660
|
-
str += ' table-fixed-dom-left';
|
|
661
|
-
// 左边没有定位,没有嵌套表格
|
|
662
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol)) {
|
|
663
|
-
str += ' table-fixed-dom-left-last';
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
return str;
|
|
667
|
-
};
|
|
668
|
-
return jsx(ThElement, Object.assign({
|
|
669
|
-
align: "center",
|
|
670
|
-
className: handCls(),
|
|
671
|
-
draggable: false
|
|
672
|
-
}, {
|
|
673
|
-
children: jsx("div", {
|
|
674
|
-
className: "table-header-box"
|
|
675
|
-
})
|
|
676
|
-
}));
|
|
677
|
-
}
|
|
678
|
-
}, [expandable, posFixed, fixedColumn]);
|
|
679
|
-
// 过滤弹窗内容
|
|
680
|
-
var filterPopoverContent = function filterPopoverContent() {
|
|
681
|
-
var name = filterHead.name;
|
|
682
|
-
if (!name) return;
|
|
683
|
-
var filterValue = selectFilterCom[name] || [];
|
|
684
|
-
if (filterHead.filterRender) {
|
|
685
|
-
// 自定义渲染过滤
|
|
686
|
-
return filterHead.filterRender({
|
|
687
|
-
filterValue: filterValue,
|
|
688
|
-
selectFilter: selectFilterCom,
|
|
689
|
-
filterHead: filterHead,
|
|
690
|
-
setFilter: filterCustomConfirm
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
return jsxs("div", Object.assign({
|
|
694
|
-
className: "filter-select"
|
|
695
|
-
}, {
|
|
696
|
-
children: [jsx("div", Object.assign({
|
|
697
|
-
className: "filter-select-box"
|
|
698
|
-
}, {
|
|
699
|
-
children: function () {
|
|
700
|
-
var arr = filterHead.enums || [];
|
|
701
|
-
return arr.map(function (item, index) {
|
|
702
|
-
var checked = filterValue.indexOf(item.value) !== -1;
|
|
703
|
-
return jsxs("div", Object.assign({
|
|
704
|
-
onClick: clickFilter(item),
|
|
705
|
-
className: checked ? 'filter-select-item filter-select-item-select' : 'filter-select-item'
|
|
706
|
-
}, {
|
|
707
|
-
children: [jsx(Checkbox, {
|
|
708
|
-
checked: checked
|
|
709
|
-
}), jsx("span", {
|
|
710
|
-
children: jsx(AutoTips, Object.assign({
|
|
711
|
-
tipMaxWidth: tipMaxWidth
|
|
712
|
-
}, {
|
|
713
|
-
children: item.displayName
|
|
714
|
-
}))
|
|
715
|
-
})]
|
|
716
|
-
}), index);
|
|
717
|
-
});
|
|
718
|
-
}()
|
|
719
|
-
})), jsxs("div", Object.assign({
|
|
720
|
-
className: "filter-select-footer"
|
|
721
|
-
}, {
|
|
722
|
-
children: [jsx(Button, Object.assign({
|
|
723
|
-
onClick: filterFunc('reset'),
|
|
724
|
-
variant: "outlined"
|
|
725
|
-
}, {
|
|
726
|
-
children: intl({
|
|
727
|
-
id: 'empty'
|
|
728
|
-
})
|
|
729
|
-
})), jsx(Button, Object.assign({
|
|
730
|
-
onClick: filterFunc('confirm'),
|
|
731
|
-
variant: "outlined"
|
|
732
|
-
}, {
|
|
733
|
-
children: intl({
|
|
734
|
-
id: 'determine'
|
|
735
|
-
})
|
|
736
|
-
}))]
|
|
737
|
-
}))]
|
|
738
|
-
}));
|
|
739
|
-
};
|
|
740
|
-
// 表格列拖拽放下
|
|
741
|
-
var onDragDown = function onDragDown(headCell) {
|
|
742
|
-
return function (result) {
|
|
743
|
-
changeColumnWidth && changeColumnWidth(headCell, result);
|
|
744
|
-
};
|
|
745
|
-
};
|
|
746
|
-
// 获取宽度
|
|
747
|
-
var getWidth = function getWidth(item) {
|
|
748
|
-
var w = item.width || '';
|
|
749
|
-
var name = item.name || '';
|
|
750
|
-
var wDrag = headDataConfig[name] && headDataConfig[name].width;
|
|
751
|
-
if (wDrag) w = wDrag + 'px';
|
|
752
|
-
return w;
|
|
753
|
-
};
|
|
754
|
-
// 内容列memo
|
|
755
|
-
var TableContentMemo = useMemo(function () {
|
|
756
|
-
// 处理过滤的class
|
|
757
|
-
var handFilterClass = function handFilterClass(item) {
|
|
758
|
-
var str = 'table-header-filter';
|
|
759
|
-
if (filterHead.name === item.name) str += ' table-header-filter-show';
|
|
760
|
-
if (item.name && selectFilterCom[item.name] && selectFilterCom[item.name].length > 0) str += ' table-header-filter-select';
|
|
761
|
-
return str;
|
|
762
|
-
};
|
|
763
|
-
var handCls = function handCls(item) {
|
|
764
|
-
var str = '';
|
|
765
|
-
if (item.className) str += item.className;
|
|
766
|
-
if (fixedColumn && item.fixed) {
|
|
767
|
-
str += ' table-fixed-dom-' + item.fixed;
|
|
768
|
-
// 固定左边,判断是否是最后一个
|
|
769
|
-
if (item.fixed === 'left' && item.paraui_fixed_left_last) {
|
|
770
|
-
str += ' table-fixed-dom-left-last';
|
|
771
|
-
}
|
|
772
|
-
// 固定右边,判断是否是第一个
|
|
773
|
-
if (item.fixed === 'right' && item.paraui_fixed_right_first) {
|
|
774
|
-
str += ' table-fixed-dom-right-first';
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
return str;
|
|
778
|
-
};
|
|
779
|
-
var handStyle = function handStyle(item) {
|
|
780
|
-
var json = {
|
|
781
|
-
width: getWidth(item)
|
|
782
|
-
};
|
|
783
|
-
if (fixedColumn && item.fixed && item.width) {
|
|
784
|
-
if (item.fixed === 'left') {
|
|
785
|
-
json.left = item.paraui_left_width + 'px';
|
|
786
|
-
}
|
|
787
|
-
if (item.fixed === 'right') {
|
|
788
|
-
json.right = item.paraui_right_width + 'px';
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
return Object.assign(Object.assign({}, json), item.style);
|
|
792
|
-
};
|
|
793
|
-
// 处理拖拽
|
|
794
|
-
var handDrag = function handDrag(item) {
|
|
795
|
-
if (item.name === 'table-serial-number') return false; // 序号不拖拽
|
|
796
|
-
if (dragColumn && item.drag !== false) return true;
|
|
797
|
-
return false;
|
|
798
|
-
};
|
|
799
|
-
return headData.map(function (headCell, index) {
|
|
800
|
-
var str = "".concat($prefixCls, "-filter-popover ").concat($prefixCls, "-scrollbar-small");
|
|
801
|
-
if (!headCell.filterRender) str += " ".concat($prefixCls, "-filter-popover-default");
|
|
802
|
-
return jsx(ThElement, Object.assign({
|
|
803
|
-
className: handCls(headCell),
|
|
804
|
-
align: headCell.align || align,
|
|
805
|
-
style: handStyle(headCell),
|
|
806
|
-
draggable: handDrag(headCell),
|
|
807
|
-
headCell: headCell,
|
|
808
|
-
onDragDown: onDragDown(headCell),
|
|
809
|
-
lineWidth: lineWidth
|
|
810
|
-
}, {
|
|
811
|
-
children: jsx(Popover, Object.assign({
|
|
812
|
-
placement: "bottom-start",
|
|
813
|
-
visible: filterHead.name === headCell.name,
|
|
814
|
-
content: filterPopoverContent(),
|
|
815
|
-
onVisibleChange: clickHideFilter,
|
|
816
|
-
overlayClassName: str,
|
|
817
|
-
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
818
|
-
return document.body;
|
|
819
|
-
}
|
|
820
|
-
}, {
|
|
821
|
-
children: jsxs("div", Object.assign({
|
|
822
|
-
className: handCellClass(headCell)
|
|
823
|
-
}, {
|
|
824
|
-
children: [jsx("div", Object.assign({
|
|
825
|
-
className: "table-header-title"
|
|
826
|
-
}, {
|
|
827
|
-
children: jsx("span", Object.assign({
|
|
828
|
-
className: "table-header-title-label"
|
|
829
|
-
}, {
|
|
830
|
-
children: jsx(AutoTips, Object.assign({
|
|
831
|
-
beyondText: headCell.beyondText === undefined ? beyondText : headCell.beyondText,
|
|
832
|
-
tipMaxWidth: headCell.tipMaxWidth !== undefined ? headCell.tipMaxWidth : tipMaxWidth
|
|
833
|
-
}, {
|
|
834
|
-
children: headCell.label
|
|
835
|
-
}))
|
|
836
|
-
}))
|
|
837
|
-
})), filter && headCell.name && headCell.filter && jsx("div", Object.assign({
|
|
838
|
-
className: handFilterClass(headCell),
|
|
839
|
-
onClick: clickShowFilter(headCell)
|
|
840
|
-
}, {
|
|
841
|
-
children: jsx("span", {
|
|
842
|
-
children: jsx(Screen, {})
|
|
843
|
-
})
|
|
844
|
-
})), sortTable && headCell.name && headCell.sort !== false && jsx("div", Object.assign({
|
|
845
|
-
className: "table-sort-svg"
|
|
846
|
-
}, {
|
|
847
|
-
children: jsxs("span", Object.assign({
|
|
848
|
-
onClick: createSortHandler(headCell.name, headCell)
|
|
849
|
-
}, {
|
|
850
|
-
children: [jsx(SolidArrowUp, {
|
|
851
|
-
className: "up-svg"
|
|
852
|
-
}), jsx(SolidArrowDown, {
|
|
853
|
-
className: "down-svg"
|
|
854
|
-
})]
|
|
855
|
-
}))
|
|
856
|
-
}))]
|
|
857
|
-
}))
|
|
858
|
-
}))
|
|
859
|
-
}), headCell.name || index);
|
|
860
|
-
});
|
|
861
|
-
}, [headData, sortTable, filter, orderFieldArr, orderTypeArr, align, filterHead, selectFilterCom, beyondText, selectFilter, fixedColumn, lineWidth, dragColumn, changeColumnWidth, headDataConfig, getPopupContainer, tipMaxWidth]);
|
|
862
|
-
// 操作栏memo
|
|
863
|
-
var TableOperateMemo = useMemo(function () {
|
|
864
|
-
if (operate) {
|
|
865
|
-
var handCls = function handCls() {
|
|
866
|
-
var str = 'table-operate';
|
|
867
|
-
if (operate.operateBtnRender) str += ' table-operate-small';
|
|
868
|
-
if (fixedColumn) {
|
|
869
|
-
str += ' table-fixed-dom-right';
|
|
870
|
-
// 存在显示列,且没有右侧固定列
|
|
871
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
872
|
-
str += ' table-fixed-dom-right-first';
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
return str;
|
|
876
|
-
};
|
|
877
|
-
var handStyle = function handStyle() {
|
|
878
|
-
var json = {
|
|
879
|
-
width: operate.width
|
|
880
|
-
};
|
|
881
|
-
if (fixedColumn) {
|
|
882
|
-
json.right = showColumns === "inside" ? '56px' : '0px';
|
|
883
|
-
}
|
|
884
|
-
return Object.assign(Object.assign({}, json), operate.style);
|
|
885
|
-
};
|
|
886
|
-
return jsx(ThElement, Object.assign({
|
|
887
|
-
align: operate.align || align,
|
|
888
|
-
style: handStyle(),
|
|
889
|
-
className: handCls(),
|
|
890
|
-
draggable: false
|
|
891
|
-
}, {
|
|
892
|
-
children: jsx("div", Object.assign({
|
|
893
|
-
className: "table-header-box"
|
|
894
|
-
}, {
|
|
895
|
-
children: jsx("div", Object.assign({
|
|
896
|
-
className: "table-header-title"
|
|
897
|
-
}, {
|
|
898
|
-
children: jsx("span", Object.assign({
|
|
899
|
-
className: "table-header-title-label"
|
|
900
|
-
}, {
|
|
901
|
-
children: jsx(AutoTips, Object.assign({
|
|
902
|
-
beyondText: operate.beyondText === undefined ? beyondText : operate.beyondText,
|
|
903
|
-
tipMaxWidth: tipMaxWidth
|
|
904
|
-
}, {
|
|
905
|
-
children: operate.label
|
|
906
|
-
}))
|
|
907
|
-
}))
|
|
908
|
-
}))
|
|
909
|
-
}))
|
|
910
|
-
}));
|
|
911
|
-
}
|
|
912
|
-
}, [operate, align, posFixed, showColumns, posFixed, beyondText, fixedColumn, tipMaxWidth]);
|
|
913
|
-
// 显示列弹窗内容
|
|
914
|
-
var showListContent = function showListContent() {
|
|
915
|
-
return jsxs("div", Object.assign({
|
|
916
|
-
className: "show-colums-select"
|
|
917
|
-
}, {
|
|
918
|
-
children: [jsx("div", Object.assign({
|
|
919
|
-
className: "show-colums-select-box"
|
|
920
|
-
}, {
|
|
921
|
-
children: showList.map(function (item, index) {
|
|
922
|
-
var checked = Boolean(headDataJson[item.name]);
|
|
923
|
-
return jsxs("div", Object.assign({
|
|
924
|
-
onClick: clickColumsList(item),
|
|
925
|
-
className: checked ? 'show-colums-select-item show-colums-select-item-select' : 'show-colums-select-item'
|
|
926
|
-
}, {
|
|
927
|
-
children: [jsx(Checkbox, {
|
|
928
|
-
checked: checked
|
|
929
|
-
}), jsx("span", {
|
|
930
|
-
children: jsx(AutoTips, Object.assign({
|
|
931
|
-
tipMaxWidth: tipMaxWidth
|
|
932
|
-
}, {
|
|
933
|
-
children: item.label
|
|
934
|
-
}))
|
|
935
|
-
})]
|
|
936
|
-
}), index);
|
|
937
|
-
})
|
|
938
|
-
})), jsx("div", Object.assign({
|
|
939
|
-
className: "show-colums-select-footer"
|
|
940
|
-
}, {
|
|
941
|
-
children: jsx(Button, Object.assign({
|
|
942
|
-
variant: "outlined",
|
|
943
|
-
onClick: resetShowList
|
|
944
|
-
}, {
|
|
945
|
-
children: intl({
|
|
946
|
-
id: 'restoreDefault'
|
|
947
|
-
})
|
|
948
|
-
}))
|
|
949
|
-
}))]
|
|
950
|
-
}));
|
|
951
|
-
};
|
|
952
|
-
// 显示列memo
|
|
953
|
-
var TableShowList = useMemo(function () {
|
|
954
|
-
var handCls = function handCls() {
|
|
955
|
-
var str = 'show-colums table-fixed-dom-right';
|
|
956
|
-
// 没有固定列参数 或者 没有操作栏且没有右侧固定列
|
|
957
|
-
if (!fixedColumn || !operate && !(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
958
|
-
str += ' table-fixed-dom-right-first';
|
|
959
|
-
}
|
|
960
|
-
return str;
|
|
961
|
-
};
|
|
962
|
-
return showColumns === 'inside' && jsx(Popover, Object.assign({
|
|
963
|
-
placement: "bottom-end",
|
|
964
|
-
visible: Boolean(anchorElColums),
|
|
965
|
-
content: showListContent(),
|
|
966
|
-
onVisibleChange: clickHideColums,
|
|
967
|
-
overlayClassName: "".concat($prefixCls, "-table-show-colums-popover ").concat($prefixCls, "-scrollbar-small"),
|
|
968
|
-
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
969
|
-
return document.body;
|
|
970
|
-
}
|
|
971
|
-
}, {
|
|
972
|
-
children: jsx(ThElement, Object.assign({
|
|
973
|
-
align: "center",
|
|
974
|
-
className: handCls(),
|
|
975
|
-
onClick: clickShowColums,
|
|
976
|
-
draggable: false
|
|
977
|
-
}, {
|
|
978
|
-
children: jsx("div", Object.assign({
|
|
979
|
-
className: "table-header-box"
|
|
980
|
-
}, {
|
|
981
|
-
children: jsx(Panel, {})
|
|
982
|
-
}))
|
|
983
|
-
}))
|
|
984
|
-
}));
|
|
985
|
-
}, [showColumns, posFixed, operate, anchorElColums, showList, headDataJson, getPopupContainer, tipMaxWidth]);
|
|
986
|
-
// 处理class
|
|
987
|
-
var handClass = function handClass() {
|
|
988
|
-
var str = 'table-head';
|
|
989
|
-
if (showColumns === 'inside') str += ' table-head-inside';
|
|
990
|
-
if (!fixedTable) str += ' table-head-scroll'; // 防止长度过长
|
|
991
|
-
// 没有 复选框,单选框,展开 按钮
|
|
992
|
-
if (!check && !radio && !expandable) str += ' table-head-no-btn';
|
|
993
|
-
return str;
|
|
994
|
-
};
|
|
995
|
-
return jsx(TableHeadElement, Object.assign({
|
|
996
|
-
className: handClass()
|
|
997
|
-
}, {
|
|
998
|
-
children: jsxs(TrElement, {
|
|
999
|
-
children: [TableCheckMemo, TableRadioMemo, TableExpandableMemo, TableContentMemo, TableOperateMemo, TableShowList]
|
|
1000
|
-
})
|
|
1001
|
-
}));
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
var css_248z$4 = ".table-body-element {\n display: table-row-group;\n}";
|
|
1005
|
-
styleInject(css_248z$4);
|
|
1006
|
-
|
|
1007
|
-
var TableBodyElement = function TableBodyElement(props) {
|
|
1008
|
-
var className = props.className,
|
|
1009
|
-
style = props.style,
|
|
1010
|
-
children = props.children,
|
|
1011
|
-
otherProps = __rest(props, ["className", "style", "children"]);
|
|
1012
|
-
var handClass = function handClass() {
|
|
1013
|
-
var str = 'table-body-element';
|
|
1014
|
-
if (className) str += ' ' + className;
|
|
1015
|
-
return str;
|
|
1016
|
-
};
|
|
1017
|
-
return jsx("tbody", Object.assign({
|
|
1018
|
-
className: handClass(),
|
|
1019
|
-
style: style
|
|
1020
|
-
}, otherProps, {
|
|
1021
|
-
children: children
|
|
1022
|
-
}));
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.td-element {\n letter-spacing: 0.01071em;\n padding: 0 8px;\n font-weight: 400;\n font-size: 14px;\n white-space: nowrap;\n border: 0;\n line-height: 1.43;\n}\n.td-element.table-operate {\n /* position: sticky;\n right: 0;*/\n}";
|
|
1026
|
-
styleInject(css_248z$3);
|
|
1027
|
-
|
|
1028
|
-
var TdElement = function TdElement(props) {
|
|
1029
|
-
var className = props.className,
|
|
1030
|
-
style = props.style,
|
|
1031
|
-
children = props.children,
|
|
1032
|
-
otherProps = __rest(props, ["className", "style", "children"]);
|
|
1033
|
-
var handClass = function handClass() {
|
|
1034
|
-
var str = 'td-element';
|
|
1035
|
-
if (className) str += ' ' + className;
|
|
1036
|
-
return str;
|
|
1037
|
-
};
|
|
1038
|
-
return jsx("td", Object.assign({
|
|
1039
|
-
className: handClass(),
|
|
1040
|
-
style: style
|
|
1041
|
-
}, otherProps, {
|
|
1042
|
-
children: children
|
|
1043
|
-
}));
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
var TableBody = function TableBody(props) {
|
|
1047
|
-
var url = props.url,
|
|
1048
|
-
emptyProps = props.emptyProps,
|
|
1049
|
-
_props$rowData = props.rowData,
|
|
1050
|
-
rowData = _props$rowData === void 0 ? [] : _props$rowData,
|
|
1051
|
-
_props$rowKey = props.rowKey,
|
|
1052
|
-
rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
|
|
1053
|
-
check = props.check,
|
|
1054
|
-
radio = props.radio,
|
|
1055
|
-
tableCell = props.tableCell,
|
|
1056
|
-
expandable = props.expandable,
|
|
1057
|
-
_props$headData = props.headData,
|
|
1058
|
-
headData = _props$headData === void 0 ? [] : _props$headData,
|
|
1059
|
-
_props$disabledJson = props.disabledJson,
|
|
1060
|
-
disabledJson = _props$disabledJson === void 0 ? {} : _props$disabledJson,
|
|
1061
|
-
disabledArrStatus = props.disabledArrStatus,
|
|
1062
|
-
_props$checkJson = props.checkJson,
|
|
1063
|
-
checkJson = _props$checkJson === void 0 ? {} : _props$checkJson,
|
|
1064
|
-
radioValue = props.radioValue,
|
|
1065
|
-
selectCheck = props.selectCheck,
|
|
1066
|
-
selectRadio = props.selectRadio,
|
|
1067
|
-
align = props.align,
|
|
1068
|
-
operate = props.operate,
|
|
1069
|
-
showColumns = props.showColumns,
|
|
1070
|
-
fixedTable = props.fixedTable,
|
|
1071
|
-
fixedColumn = props.fixedColumn,
|
|
1072
|
-
formatter = props.formatter,
|
|
1073
|
-
_props$orderFieldArr = props.orderFieldArr,
|
|
1074
|
-
orderFieldArr = _props$orderFieldArr === void 0 ? [] : _props$orderFieldArr,
|
|
1075
|
-
_props$orderTypeArr = props.orderTypeArr,
|
|
1076
|
-
orderTypeArr = _props$orderTypeArr === void 0 ? [] : _props$orderTypeArr,
|
|
1077
|
-
sortTable = props.sortTable,
|
|
1078
|
-
loadState = props.loadState,
|
|
1079
|
-
loadMore = props.loadMore,
|
|
1080
|
-
loadMoreRender = props.loadMoreRender,
|
|
1081
|
-
onClickMore = props.onClickMore,
|
|
1082
|
-
total = props.total,
|
|
1083
|
-
page = props.page,
|
|
1084
|
-
currentRowsPerPage = props.currentRowsPerPage,
|
|
1085
|
-
changePage = props.changePage,
|
|
1086
|
-
loadMoreUrl = props.loadMoreUrl,
|
|
1087
|
-
_props$expandMultiple = props.expandMultiple,
|
|
1088
|
-
expandMultiple = _props$expandMultiple === void 0 ? false : _props$expandMultiple,
|
|
1089
|
-
_props$expandValue = props.expandValue,
|
|
1090
|
-
expandValue = _props$expandValue === void 0 ? [] : _props$expandValue,
|
|
1091
|
-
_props$disabledExpand = props.disabledExpand,
|
|
1092
|
-
disabledExpand = _props$disabledExpand === void 0 ? [] : _props$disabledExpand,
|
|
1093
|
-
_props$defaultExpandA = props.defaultExpandAllRows,
|
|
1094
|
-
defaultExpandAllRows = _props$defaultExpandA === void 0 ? false : _props$defaultExpandA,
|
|
1095
|
-
onExpand = props.onExpand,
|
|
1096
|
-
_onRefresh = props.onRefresh,
|
|
1097
|
-
posFixed = props.posFixed,
|
|
1098
|
-
beyondText = props.beyondText,
|
|
1099
|
-
onClickRow = props.onClickRow,
|
|
1100
|
-
rowClassMapping = props.rowClassMapping,
|
|
1101
|
-
tipMaxWidth = props.tipMaxWidth;
|
|
1102
|
-
var _useState = useState(0),
|
|
1103
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1104
|
-
expandableColSpan = _useState2[0],
|
|
1105
|
-
setExpandableColSpan = _useState2[1]; // 嵌套表格合并列数
|
|
1106
|
-
var _useState3 = useState({}),
|
|
1107
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1108
|
-
expandableRow = _useState4[0],
|
|
1109
|
-
setExpandableRow = _useState4[1]; // 当前哪行展开表格嵌套
|
|
1110
|
-
var _useState5 = useState(true),
|
|
1111
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1112
|
-
showMoreBtn = _useState6[0],
|
|
1113
|
-
setShowMoreBtn = _useState6[1]; // 加载更多
|
|
1114
|
-
var _useState7 = useState({}),
|
|
1115
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1116
|
-
disabledExpandJson = _useState8[0],
|
|
1117
|
-
setDisabledExpand = _useState8[1]; // 禁用加减部分嵌套
|
|
1118
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
1119
|
-
// 默认是否展开所有
|
|
1120
|
-
useEffect(function () {
|
|
1121
|
-
if (!defaultExpandAllRows) {
|
|
1122
|
-
setExpandableRow({});
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
var json = {};
|
|
1126
|
-
for (var i = 0, l = rowData.length; i < l; i++) {
|
|
1127
|
-
var item = rowData[i] || {};
|
|
1128
|
-
var id = item[rowKey];
|
|
1129
|
-
json[id] = {
|
|
1130
|
-
id: id,
|
|
1131
|
-
status: 'develop'
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
setExpandableRow(json);
|
|
1135
|
-
}, [defaultExpandAllRows, rowData, rowKey]);
|
|
1136
|
-
// 监听展开表格
|
|
1137
|
-
// 如果直接写expandMultiple, expandValue会死循环
|
|
1138
|
-
useEffect(function () {
|
|
1139
|
-
if (props.expandValue === undefined) return;
|
|
1140
|
-
var json = {};
|
|
1141
|
-
var expandValueHand = expandValue;
|
|
1142
|
-
// 只展开一个,去第一个值
|
|
1143
|
-
if (!expandMultiple && expandValue.length > 0) {
|
|
1144
|
-
expandValueHand = [expandValue[0]];
|
|
1145
|
-
}
|
|
1146
|
-
for (var i = 0, l = expandValueHand.length; i < l; i++) {
|
|
1147
|
-
var id = expandValueHand[i];
|
|
1148
|
-
json[id] = {
|
|
1149
|
-
id: id,
|
|
1150
|
-
status: 'develop'
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
setExpandableRow(json);
|
|
1154
|
-
}, [props.expandMultiple, props.expandValue, rowData]);
|
|
1155
|
-
// 监听禁用嵌套 props.disabledExpand 防止死循环
|
|
1156
|
-
useEffect(function () {
|
|
1157
|
-
var json = {};
|
|
1158
|
-
for (var i = 0, l = disabledExpand.length; i < l; i++) {
|
|
1159
|
-
var id = disabledExpand[i];
|
|
1160
|
-
json[id] = true;
|
|
1161
|
-
}
|
|
1162
|
-
setDisabledExpand(json);
|
|
1163
|
-
}, [props.disabledExpand]);
|
|
1164
|
-
useEffect(function () {
|
|
1165
|
-
if (loadMoreUrl) {
|
|
1166
|
-
var bol = Number(total) > Number(page) * Number(currentRowsPerPage);
|
|
1167
|
-
setShowMoreBtn(bol);
|
|
1168
|
-
}
|
|
1169
|
-
}, [loadMoreUrl, total, page, currentRowsPerPage]);
|
|
1170
|
-
// 处理嵌套表格合并列数
|
|
1171
|
-
useEffect(function () {
|
|
1172
|
-
var num = headData.length;
|
|
1173
|
-
if (expandable) num += 1;
|
|
1174
|
-
if (check) num += 1;
|
|
1175
|
-
if (radio) num += 1;
|
|
1176
|
-
if (operate) num += 1;
|
|
1177
|
-
if (showColumns === 'inside') num += 1;
|
|
1178
|
-
setExpandableColSpan(num);
|
|
1179
|
-
}, [headData, expandable, check, radio]);
|
|
1180
|
-
// 展开/收起嵌套表格
|
|
1181
|
-
var handClickNestTable = function handClickNestTable(row) {
|
|
1182
|
-
return function (event) {
|
|
1183
|
-
var id = row[rowKey];
|
|
1184
|
-
var expandItem = expandableRow[id] || {};
|
|
1185
|
-
var status = 'develop';
|
|
1186
|
-
if (expandItem.status === 'develop') status = 'retract';
|
|
1187
|
-
expandItem = {
|
|
1188
|
-
id: id,
|
|
1189
|
-
status: status
|
|
1190
|
-
};
|
|
1191
|
-
if (expandMultiple) {
|
|
1192
|
-
// 展开多个
|
|
1193
|
-
expandableRow[id] = expandItem;
|
|
1194
|
-
setExpandableRow(Object.assign({}, expandableRow));
|
|
1195
|
-
} else {
|
|
1196
|
-
// 展开一个
|
|
1197
|
-
setExpandableRow(_defineProperty({}, id, expandItem));
|
|
1198
|
-
}
|
|
1199
|
-
onExpand && onExpand(row, status);
|
|
1200
|
-
event.stopPropagation();
|
|
1201
|
-
};
|
|
1202
|
-
};
|
|
1203
|
-
// 处理class
|
|
1204
|
-
var handClass = function handClass() {
|
|
1205
|
-
var str = 'table-body';
|
|
1206
|
-
if (!fixedTable) str += ' table-body-scroll';
|
|
1207
|
-
// 没有 复选框,单选框,展开 按钮
|
|
1208
|
-
if (!check && !radio && !expandable) str += ' table-body-no-btn';
|
|
1209
|
-
return str;
|
|
1210
|
-
};
|
|
1211
|
-
// 处理嵌套表格class
|
|
1212
|
-
var handExpandClass = function handExpandClass(row) {
|
|
1213
|
-
var id = row[rowKey];
|
|
1214
|
-
var expandItem = expandableRow[id] || {};
|
|
1215
|
-
var str = 'retract';
|
|
1216
|
-
if (expandItem.status === 'develop') {
|
|
1217
|
-
str = 'expand';
|
|
1218
|
-
}
|
|
1219
|
-
return str;
|
|
1220
|
-
};
|
|
1221
|
-
// 点击加载更多
|
|
1222
|
-
var clickMore = function clickMore() {
|
|
1223
|
-
if (loadMoreUrl) changePage && changePage();
|
|
1224
|
-
onClickMore && onClickMore();
|
|
1225
|
-
};
|
|
1226
|
-
// 暂无数据memo
|
|
1227
|
-
var NodataMemo = useMemo(function () {
|
|
1228
|
-
// 处理刷新按钮
|
|
1229
|
-
var handRefreshBtn = function handRefreshBtn() {
|
|
1230
|
-
if ((emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh) !== undefined) {
|
|
1231
|
-
return emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.showRefresh;
|
|
1232
|
-
}
|
|
1233
|
-
if (url) {
|
|
1234
|
-
return true;
|
|
1235
|
-
}
|
|
1236
|
-
return false;
|
|
1237
|
-
};
|
|
1238
|
-
// 处理className
|
|
1239
|
-
var handClassNoData = function handClassNoData() {
|
|
1240
|
-
var str = 'table-no-data';
|
|
1241
|
-
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size) str += ' table-no-data-' + (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size);
|
|
1242
|
-
return str;
|
|
1243
|
-
};
|
|
1244
|
-
return jsx(TrElement, Object.assign({
|
|
1245
|
-
className: handClassNoData()
|
|
1246
|
-
}, {
|
|
1247
|
-
children: jsx(TdElement, Object.assign({
|
|
1248
|
-
align: "center",
|
|
1249
|
-
colSpan: expandableColSpan
|
|
1250
|
-
}, {
|
|
1251
|
-
children: jsx(Empty, Object.assign({}, emptyProps, {
|
|
1252
|
-
showRefresh: handRefreshBtn(),
|
|
1253
|
-
onRefresh: function onRefresh(event) {
|
|
1254
|
-
if (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh) {
|
|
1255
|
-
emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.onRefresh(event);
|
|
1256
|
-
return;
|
|
1257
|
-
}
|
|
1258
|
-
_onRefresh && _onRefresh();
|
|
1259
|
-
}
|
|
1260
|
-
}))
|
|
1261
|
-
}))
|
|
1262
|
-
}));
|
|
1263
|
-
}, [expandableColSpan, emptyProps, url, _onRefresh]);
|
|
1264
|
-
// 复选框useCallback
|
|
1265
|
-
var TableCheckCallback = useCallback(function (row) {
|
|
1266
|
-
if (check) {
|
|
1267
|
-
var handId = row[rowKey];
|
|
1268
|
-
var disabledHand = Boolean(disabledJson[handId]);
|
|
1269
|
-
var checkHand = checkJson[handId] || false;
|
|
1270
|
-
var showCheck = true;
|
|
1271
|
-
if (disabledHand && disabledArrStatus) {
|
|
1272
|
-
// 选中
|
|
1273
|
-
if (disabledArrStatus[handId] === true) {
|
|
1274
|
-
checkHand = true;
|
|
1275
|
-
}
|
|
1276
|
-
// 不选中
|
|
1277
|
-
if (disabledArrStatus[handId] === false) {
|
|
1278
|
-
checkHand = false;
|
|
1279
|
-
}
|
|
1280
|
-
// 不显示
|
|
1281
|
-
if (disabledArrStatus[handId] === null) {
|
|
1282
|
-
showCheck = false;
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
var handCls = function handCls() {
|
|
1286
|
-
var str = 'table-checkbox table-body-btn';
|
|
1287
|
-
if (fixedColumn) {
|
|
1288
|
-
str += ' table-fixed-dom-left';
|
|
1289
|
-
// 左边没有定位,且没有单选,没有嵌套表格
|
|
1290
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol) && !radio && !expandable) {
|
|
1291
|
-
str += ' table-fixed-dom-left-last';
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
return str;
|
|
1295
|
-
};
|
|
1296
|
-
return jsx(TdElement, Object.assign({
|
|
1297
|
-
align: "center",
|
|
1298
|
-
className: handCls()
|
|
1299
|
-
}, {
|
|
1300
|
-
children: showCheck && jsx(Checkbox, {
|
|
1301
|
-
disabled: disabledHand,
|
|
1302
|
-
checked: checkHand,
|
|
1303
|
-
onChange: function onChange(event, bol) {
|
|
1304
|
-
event.stopPropagation();
|
|
1305
|
-
selectCheck && selectCheck(event, bol, row[rowKey]);
|
|
1306
|
-
}
|
|
1307
|
-
})
|
|
1308
|
-
}));
|
|
1309
|
-
}
|
|
1310
|
-
}, [check, disabledJson, rowKey, checkJson, selectCheck, disabledArrStatus, posFixed, expandable, radio, fixedColumn]);
|
|
1311
|
-
// 单选框useCallback
|
|
1312
|
-
var TableRadioCallback = useCallback(function (row) {
|
|
1313
|
-
if (radio) {
|
|
1314
|
-
var handId = row[rowKey];
|
|
1315
|
-
var disabledHand = Boolean(disabledJson[handId]);
|
|
1316
|
-
var checkHand = radioValue === row[rowKey];
|
|
1317
|
-
var showRadio = true;
|
|
1318
|
-
if (disabledHand && disabledArrStatus) {
|
|
1319
|
-
// 选中
|
|
1320
|
-
if (disabledArrStatus[handId] === true) {
|
|
1321
|
-
checkHand = true;
|
|
1322
|
-
}
|
|
1323
|
-
// 不选中
|
|
1324
|
-
if (disabledArrStatus[handId] === false) {
|
|
1325
|
-
checkHand = false;
|
|
1326
|
-
}
|
|
1327
|
-
// 不显示
|
|
1328
|
-
if (disabledArrStatus[handId] === null) {
|
|
1329
|
-
showRadio = false;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
var handCls = function handCls() {
|
|
1333
|
-
var str = 'table-radio table-body-btn';
|
|
1334
|
-
if (fixedColumn) {
|
|
1335
|
-
str += ' table-fixed-dom-left';
|
|
1336
|
-
// 左边没有定位,没有嵌套表格
|
|
1337
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol) && !expandable) {
|
|
1338
|
-
str += ' table-fixed-dom-left-last';
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
return str;
|
|
1342
|
-
};
|
|
1343
|
-
return jsx(TdElement, Object.assign({
|
|
1344
|
-
align: "center",
|
|
1345
|
-
className: handCls()
|
|
1346
|
-
}, {
|
|
1347
|
-
children: showRadio && jsx(Radio, {
|
|
1348
|
-
disabled: disabledHand,
|
|
1349
|
-
checked: checkHand,
|
|
1350
|
-
onChange: function onChange(event) {
|
|
1351
|
-
event.stopPropagation();
|
|
1352
|
-
selectRadio && selectRadio(event, row[rowKey]);
|
|
1353
|
-
}
|
|
1354
|
-
})
|
|
1355
|
-
}));
|
|
1356
|
-
}
|
|
1357
|
-
}, [radio, disabledJson, radioValue, rowKey, selectRadio, disabledArrStatus, expandable, posFixed, fixedColumn]);
|
|
1358
|
-
// 嵌套加减useCallback
|
|
1359
|
-
var TableExpandableMemo = useCallback(function (row) {
|
|
1360
|
-
if (!expandable) return null;
|
|
1361
|
-
var expandableDemo = expandable(row);
|
|
1362
|
-
// 禁用一行表格展开 或者 展开表格返回值为false,返回空列
|
|
1363
|
-
if (disabledExpandJson[row[rowKey]] || expandableDemo === false) return jsx(TdElement, {});
|
|
1364
|
-
var handCls = function handCls() {
|
|
1365
|
-
var str = 'table-expandable table-body-btn';
|
|
1366
|
-
if (fixedColumn) {
|
|
1367
|
-
str += ' table-fixed-dom-left';
|
|
1368
|
-
// 左边没有定位,没有嵌套表格
|
|
1369
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.leftBol)) {
|
|
1370
|
-
str += ' table-fixed-dom-left-last';
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
return str;
|
|
1374
|
-
};
|
|
1375
|
-
return jsx(TdElement, Object.assign({
|
|
1376
|
-
align: "center",
|
|
1377
|
-
className: handCls()
|
|
1378
|
-
}, {
|
|
1379
|
-
children: jsx(Down, {
|
|
1380
|
-
className: handExpandClass(row),
|
|
1381
|
-
onClick: handClickNestTable(row)
|
|
1382
|
-
})
|
|
1383
|
-
}));
|
|
1384
|
-
}, [expandable, expandableRow, rowKey, disabledExpandJson, onExpand, fixedColumn]);
|
|
1385
|
-
// 表格一行内容useCallback
|
|
1386
|
-
var TableContentUseCallback = useCallback(function (row, rowIndex) {
|
|
1387
|
-
var params = {
|
|
1388
|
-
orderFieldArr: orderFieldArr,
|
|
1389
|
-
orderTypeArr: orderTypeArr
|
|
1390
|
-
};
|
|
1391
|
-
var handContentClass = function handContentClass(item) {
|
|
1392
|
-
var str = 'table-content-columms';
|
|
1393
|
-
if (item.className) str += ' ' + item.className;
|
|
1394
|
-
// 排序
|
|
1395
|
-
if (sortTable && item.name && item.sort !== false) {
|
|
1396
|
-
var index = orderFieldArr.indexOf(item.name);
|
|
1397
|
-
if (index !== -1) {
|
|
1398
|
-
// 升序
|
|
1399
|
-
if (orderTypeArr[index] === 'asc') {
|
|
1400
|
-
str += ' table-content-columms-asc';
|
|
1401
|
-
}
|
|
1402
|
-
// 降序
|
|
1403
|
-
if (orderTypeArr[index] === 'desc') {
|
|
1404
|
-
str += ' table-content-columms-desc';
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
if (item.fixed && fixedColumn) {
|
|
1409
|
-
str += ' table-fixed-dom-' + item.fixed;
|
|
1410
|
-
// 固定左边,判断是否是最后一个
|
|
1411
|
-
if (item.fixed === 'left' && item.paraui_fixed_left_last) {
|
|
1412
|
-
str += ' table-fixed-dom-left-last';
|
|
1413
|
-
}
|
|
1414
|
-
// 固定右边,判断是否是第一个
|
|
1415
|
-
if (item.fixed === 'right' && item.paraui_fixed_right_first) {
|
|
1416
|
-
str += ' table-fixed-dom-right-first';
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
return str;
|
|
1420
|
-
};
|
|
1421
|
-
var handStyle = function handStyle(item) {
|
|
1422
|
-
var json = {};
|
|
1423
|
-
if (fixedColumn && item.fixed && item.width) {
|
|
1424
|
-
if (item.fixed === 'left') {
|
|
1425
|
-
json.left = item.paraui_left_width + 'px';
|
|
1426
|
-
}
|
|
1427
|
-
if (item.fixed === 'right') {
|
|
1428
|
-
json.right = item.paraui_right_width + 'px';
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
return json;
|
|
1432
|
-
};
|
|
1433
|
-
return tableCell ? tableCell(row, params) : headData.map(function (item, index) {
|
|
1434
|
-
var text = row[item.name];
|
|
1435
|
-
var colSpan = 1;
|
|
1436
|
-
if (item.render) text = item.render(row, item, row[item.name], index, rowIndex);
|
|
1437
|
-
if (formatter) text = formatter(row, item, row[item.name], index, rowIndex);
|
|
1438
|
-
// 存在显示列,最后一列占两格
|
|
1439
|
-
if (showColumns === 'inside' && !operate && index === headData.length - 1) {
|
|
1440
|
-
colSpan = 2;
|
|
1441
|
-
}
|
|
1442
|
-
return jsx(TdElement, Object.assign({
|
|
1443
|
-
align: item.align || align,
|
|
1444
|
-
className: handContentClass(item),
|
|
1445
|
-
colSpan: colSpan,
|
|
1446
|
-
style: handStyle(item)
|
|
1447
|
-
}, {
|
|
1448
|
-
children: item.autoTips === undefined || item.autoTips === true ? jsx(AutoTips, Object.assign({
|
|
1449
|
-
beyondText: item.beyondText === undefined ? beyondText : item.beyondText,
|
|
1450
|
-
tipMaxWidth: item.tipMaxWidth !== undefined ? item.tipMaxWidth : tipMaxWidth
|
|
1451
|
-
}, {
|
|
1452
|
-
children: text
|
|
1453
|
-
})) : text
|
|
1454
|
-
}), item.name || index);
|
|
1455
|
-
});
|
|
1456
|
-
}, [tableCell, headData, align, formatter, orderFieldArr, orderTypeArr, sortTable, showColumns, operate, beyondText, fixedColumn, tipMaxWidth]);
|
|
1457
|
-
// 操作栏useCallback
|
|
1458
|
-
var TableOperateUseCallback = useCallback(function (row, rowIndex) {
|
|
1459
|
-
if (operate) {
|
|
1460
|
-
var colSpan = 1;
|
|
1461
|
-
if (showColumns === "inside") colSpan = 2;
|
|
1462
|
-
var handOperate = function handOperate() {
|
|
1463
|
-
if (operate.render) return operate.render(row);
|
|
1464
|
-
if (operate.operateBtnRender) {
|
|
1465
|
-
var operateConfig = operate.operateBtnRender(row, rowIndex);
|
|
1466
|
-
return jsx(OperateBtn, Object.assign({}, operateConfig));
|
|
1467
|
-
}
|
|
1468
|
-
};
|
|
1469
|
-
var handStyle = function handStyle() {
|
|
1470
|
-
var json = {
|
|
1471
|
-
right: '0'
|
|
1472
|
-
};
|
|
1473
|
-
return json;
|
|
1474
|
-
};
|
|
1475
|
-
var handCls = function handCls() {
|
|
1476
|
-
var str = 'table-operate';
|
|
1477
|
-
if (fixedColumn) {
|
|
1478
|
-
str += ' table-fixed-dom-right';
|
|
1479
|
-
if (!(posFixed === null || posFixed === void 0 ? void 0 : posFixed.rightBol)) {
|
|
1480
|
-
str += ' table-fixed-dom-right-first';
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
return str;
|
|
1484
|
-
};
|
|
1485
|
-
return jsx(TdElement, Object.assign({
|
|
1486
|
-
align: operate.align || align,
|
|
1487
|
-
className: handCls(),
|
|
1488
|
-
colSpan: colSpan,
|
|
1489
|
-
style: handStyle()
|
|
1490
|
-
}, {
|
|
1491
|
-
children: handOperate()
|
|
1492
|
-
}));
|
|
1493
|
-
}
|
|
1494
|
-
}, [operate, align, showColumns, posFixed, fixedColumn]);
|
|
1495
|
-
// 嵌套表格useCallback
|
|
1496
|
-
var TableExpandableContentUseCallback = useCallback(function (row) {
|
|
1497
|
-
var id = row[rowKey];
|
|
1498
|
-
var expandItem = expandableRow[id] || {};
|
|
1499
|
-
if (expandable && expandItem.status === 'develop') {
|
|
1500
|
-
var expandableDemo = expandable(row);
|
|
1501
|
-
if (expandableDemo === false) return null; // 展开表格返回值为false,不展示这一行
|
|
1502
|
-
return jsx(TrElement, Object.assign({
|
|
1503
|
-
className: "table-body-expand-row"
|
|
1504
|
-
}, {
|
|
1505
|
-
children: jsx(TdElement, Object.assign({
|
|
1506
|
-
align: "center",
|
|
1507
|
-
colSpan: expandableColSpan
|
|
1508
|
-
}, {
|
|
1509
|
-
children: expandableDemo
|
|
1510
|
-
}))
|
|
1511
|
-
}), Math.random());
|
|
1512
|
-
}
|
|
1513
|
-
}, [expandable, expandableRow, expandableColSpan, rowKey]);
|
|
1514
|
-
// 加载更多
|
|
1515
|
-
var MoreMemo = useMemo(function () {
|
|
1516
|
-
if (!loadMore || !showMoreBtn) return null;
|
|
1517
|
-
return jsx(TrElement, Object.assign({
|
|
1518
|
-
className: "more-table-row",
|
|
1519
|
-
onClick: clickMore
|
|
1520
|
-
}, {
|
|
1521
|
-
children: jsx(TdElement, Object.assign({
|
|
1522
|
-
align: "center",
|
|
1523
|
-
colSpan: expandableColSpan
|
|
1524
|
-
}, {
|
|
1525
|
-
children: loadMoreRender ? loadMoreRender : jsx("span", Object.assign({
|
|
1526
|
-
className: "more-btn"
|
|
1527
|
-
}, {
|
|
1528
|
-
children: intl({
|
|
1529
|
-
id: 'loadMore'
|
|
1530
|
-
})
|
|
1531
|
-
}))
|
|
1532
|
-
}))
|
|
1533
|
-
}));
|
|
1534
|
-
}, [expandableColSpan, loadMore, loadMoreRender, onClickMore, showMoreBtn, changePage, loadMoreUrl]);
|
|
1535
|
-
var TableBodySubjectContentMemo = useMemo(function () {
|
|
1536
|
-
return jsx(Fragment, {
|
|
1537
|
-
children: rowData.map(function (row, index) {
|
|
1538
|
-
var str = 'table-body-row';
|
|
1539
|
-
if (rowClassMapping && rowClassMapping[row[rowKey]]) {
|
|
1540
|
-
str += ' ' + rowClassMapping[row[rowKey]];
|
|
1541
|
-
}
|
|
1542
|
-
return jsxs(Fragment$1, {
|
|
1543
|
-
children: [jsxs(TrElement, Object.assign({
|
|
1544
|
-
className: str,
|
|
1545
|
-
onClick: function onClick(e) {
|
|
1546
|
-
onClickRow && onClickRow(row, e);
|
|
1547
|
-
}
|
|
1548
|
-
}, {
|
|
1549
|
-
children: [TableCheckCallback(row), TableRadioCallback(row), TableExpandableMemo(row), TableContentUseCallback(row, index), TableOperateUseCallback(row, index)]
|
|
1550
|
-
}), row[rowKey]), TableExpandableContentUseCallback(row)]
|
|
1551
|
-
}, index);
|
|
1552
|
-
})
|
|
1553
|
-
});
|
|
1554
|
-
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, disabledExpandJson, onExpand, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth]);
|
|
1555
|
-
// 内容memo
|
|
1556
|
-
var TableBodyContentMemo = useMemo(function () {
|
|
1557
|
-
return jsxs(Fragment$1, {
|
|
1558
|
-
children: [TableBodySubjectContentMemo, MoreMemo]
|
|
1559
|
-
});
|
|
1560
|
-
}, [rowData, rowKey, disabledJson, checkJson, radio, radioValue, expandable, expandableRow, tableCell, headData, align, operate, expandableColSpan, selectCheck, selectRadio, loadMore, loadMoreRender, onClickMore, changePage, loadMoreUrl, disabledExpandJson, onExpand, showMoreBtn, disabledArrStatus, showColumns, onClickRow, rowClassMapping, tipMaxWidth]);
|
|
1561
|
-
// 处理内容
|
|
1562
|
-
var handContent = function handContent() {
|
|
1563
|
-
// 无数据,且不再请求,显示暂无数据
|
|
1564
|
-
if (rowData.length === 0 && !loadState) return NodataMemo;
|
|
1565
|
-
return TableBodyContentMemo;
|
|
1566
|
-
};
|
|
1567
|
-
return jsx(TableBodyElement, Object.assign({
|
|
1568
|
-
className: handClass()
|
|
1569
|
-
}, {
|
|
1570
|
-
children: handContent()
|
|
1571
|
-
}));
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
var TableHead = function TableHead(props) {
|
|
1575
|
-
var paginationType = props.paginationType,
|
|
1576
|
-
flippingArrow = props.flippingArrow,
|
|
1577
|
-
autoPagination = props.autoPagination,
|
|
1578
|
-
total = props.total,
|
|
1579
|
-
page = props.page,
|
|
1580
|
-
rowsPerPage = props.rowsPerPage,
|
|
1581
|
-
currentRowsPerPage = props.currentRowsPerPage,
|
|
1582
|
-
changePage = props.changePage,
|
|
1583
|
-
changeRowsPerPage = props.changeRowsPerPage;
|
|
1584
|
-
// 改变页面
|
|
1585
|
-
var changePageCom = function changePageCom(num) {
|
|
1586
|
-
changePage && changePage(num);
|
|
1587
|
-
};
|
|
1588
|
-
// 改变每页显示条数
|
|
1589
|
-
var changeRowsPerPageCom = function changeRowsPerPageCom(num) {
|
|
1590
|
-
changeRowsPerPage && changeRowsPerPage(num);
|
|
1591
|
-
};
|
|
1592
|
-
return jsx("div", Object.assign({
|
|
1593
|
-
className: 'table-pagination'
|
|
1594
|
-
}, {
|
|
1595
|
-
children: jsx(Pagination, {
|
|
1596
|
-
type: paginationType,
|
|
1597
|
-
autoType: autoPagination,
|
|
1598
|
-
flippingArrow: flippingArrow,
|
|
1599
|
-
total: total,
|
|
1600
|
-
page: page,
|
|
1601
|
-
rowsPerPage: rowsPerPage,
|
|
1602
|
-
currentRowsPerPage: currentRowsPerPage,
|
|
1603
|
-
changePage: changePageCom,
|
|
1604
|
-
changeRowsPerPage: changeRowsPerPageCom,
|
|
1605
|
-
getPopupContainer: function getPopupContainer() {
|
|
1606
|
-
return document.body;
|
|
1607
|
-
}
|
|
1608
|
-
})
|
|
1609
|
-
}));
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
|
-
var css_248z$2 = ".table-container {\n overflow-x: auto;\n}";
|
|
1613
|
-
styleInject(css_248z$2);
|
|
1614
|
-
|
|
1615
|
-
var TableContainer = function TableContainer(props) {
|
|
1616
|
-
var cRef = props.cRef,
|
|
1617
|
-
className = props.className,
|
|
1618
|
-
style = props.style,
|
|
1619
|
-
children = props.children,
|
|
1620
|
-
otherProps = __rest(props, ["cRef", "className", "style", "children"]);
|
|
1621
|
-
var handClass = function handClass() {
|
|
1622
|
-
var str = 'table-container';
|
|
1623
|
-
if (className) str += ' ' + className;
|
|
1624
|
-
return str;
|
|
1625
|
-
};
|
|
1626
|
-
return jsx("div", Object.assign({
|
|
1627
|
-
className: handClass(),
|
|
1628
|
-
style: style,
|
|
1629
|
-
ref: cRef
|
|
1630
|
-
}, otherProps, {
|
|
1631
|
-
children: children
|
|
1632
|
-
}));
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
|
-
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.table-element {\n width: 100%;\n display: table;\n border-collapse: separate;\n border-spacing: 0;\n}\n.table-element.table-element-fixed-column > .table-body-element > .tr-element > .td-element {\n position: sticky;\n}\n.table-element > .table-head-element > .tr-element > .th-element {\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left {\n z-index: 11;\n}\n.table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right {\n z-index: 11;\n}\n.table-element > .table-body-element > .tr-element > .td-element {\n z-index: 1;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n height: 100%;\n width: 30px;\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-100%);\n content: \"\";\n transition: box-shadow 0.3s;\n pointer-events: none;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left {\n z-index: 2;\n}\n.table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right {\n z-index: 2;\n}\n\n.table-scroll-left .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n.table-scroll-left .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n\n.table-scroll-right .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n.table-scroll-right .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n\n.table-scroll-middle .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n.table-scroll-middle .table-element > .table-head-element > .tr-element > .th-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n.table-scroll-middle .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-left.table-fixed-dom-left-last::after {\n box-shadow: inset 10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}\n.table-scroll-middle .table-element > .table-body-element > .tr-element > .td-element.table-fixed-dom-right.table-fixed-dom-right-first::after {\n box-shadow: inset -10px 0 10px -8px rgba(0, 0, 0, 0.1);\n}";
|
|
1636
|
-
styleInject(css_248z$1);
|
|
1637
|
-
|
|
1638
|
-
var TableElement = function TableElement(props) {
|
|
1639
|
-
var className = props.className,
|
|
1640
|
-
style = props.style,
|
|
1641
|
-
fixedColumn = props.fixedColumn,
|
|
1642
|
-
children = props.children,
|
|
1643
|
-
otherProps = __rest(props, ["className", "style", "fixedColumn", "children"]);
|
|
1644
|
-
var handClass = function handClass() {
|
|
1645
|
-
var str = 'table-element';
|
|
1646
|
-
if (fixedColumn) str += ' table-element-fixed-column';
|
|
1647
|
-
if (className) str += ' ' + className;
|
|
1648
|
-
return str;
|
|
1649
|
-
};
|
|
1650
|
-
return jsx("table", Object.assign({
|
|
1651
|
-
className: handClass(),
|
|
1652
|
-
style: style
|
|
1653
|
-
}, otherProps, {
|
|
1654
|
-
children: children
|
|
1655
|
-
}));
|
|
1656
|
-
};
|
|
1657
|
-
|
|
1658
|
-
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-table {\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n position: relative;\n}\n.paraui-v3-table.paraui-v3-table-draggable * {\n user-select: none !important;\n}\n.paraui-v3-table.paraui-v3-table-fixed-table > .table-contain > table {\n table-layout: fixed;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn > .table-contain > table .table-checkbox {\n left: 0;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn > .table-contain > table .table-radio {\n left: 0;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn > .table-contain > table .table-expandable {\n left: 0;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn.paraui-v3-table-radio.paraui-v3-table-check .table-radio {\n left: 48px;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn.paraui-v3-table-expandable.paraui-v3-table-check .table-expandable {\n left: 48px;\n}\n.paraui-v3-table.paraui-v3-table-fixed-cloumn.paraui-v3-table-expandable.paraui-v3-table-check.paraui-v3-table-radio .table-expandable {\n left: 80px;\n}\n.paraui-v3-table.paraui-v3-table-no-data > .table-container > table {\n height: 100%;\n}\n.paraui-v3-table.paraui-v3-table-no-data > .table-container > table .paraui-v3-empty {\n overflow: hidden;\n}\n.paraui-v3-table.paraui-v3-table-load.paraui-v3-table-no-data > .table-container > table {\n height: auto;\n}\n.paraui-v3-table.paraui-v3-table-pagination > .table-contain {\n height: calc(100% - 60px);\n}\n.paraui-v3-table.paraui-v3-table-pagination.table-load-more > .table-contain {\n height: 100%;\n}\n.paraui-v3-table.paraui-v3-table-load-more.paraui-v3-table-pagination > .table-contain {\n height: 100%;\n}\n.paraui-v3-table > .table-contain {\n height: 100%;\n position: relative;\n}\n.paraui-v3-table > .table-contain > table {\n height: auto;\n}\n.paraui-v3-table > .table-contain > table .table-checkbox > label {\n vertical-align: middle;\n}\n.paraui-v3-table > .table-contain > table .table-checkbox .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v3-table > .table-contain > table .table-radio > label {\n vertical-align: middle;\n}\n.paraui-v3-table > .table-contain > table .table-radio .table-header-box {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v3-table > .table-contain > table .table-expandable > svg {\n vertical-align: middle;\n}\n.paraui-v3-table > .table-contain > table > .table-head {\n width: 100%;\n white-space: nowrap;\n}\n.paraui-v3-table > .table-contain > table > .table-head > tr th {\n height: 50px;\n}\n.paraui-v3-table > .table-contain > table > .table-head.table-head-scroll tr th {\n max-width: 240px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-serial-number .table-header-box .table-header-title {\n padding-right: 0;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box {\n height: 49px;\n line-height: 49px;\n position: relative;\n padding: 0 8px;\n display: flex;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-title {\n max-width: 100%;\n display: flex;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-title > .table-header-title-label {\n width: 100%;\n color: rgba(46, 55, 67, 0.7);\n font-weight: 700;\n font-size: 14px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span {\n width: 20px;\n height: 20px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover {\n background-color: rgb(227, 234, 247);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span:hover > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > svg {\n font-size: 12px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .up-svg {\n position: relative;\n top: 2px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-sort-svg > span > .down-svg {\n position: relative;\n top: -3px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span {\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n cursor: pointer;\n border-radius: 2px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover {\n background-color: rgb(227, 234, 247);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span:hover > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter > span > svg {\n font-size: 14px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-show > span > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box > .table-header-filter.table-header-filter-select > span:after {\n position: absolute;\n width: 4px;\n height: 4px;\n border-radius: 50%;\n background-color: rgb(235, 96, 84);\n content: \"\";\n right: 3px;\n top: 2px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box.table-header-box-filter > .table-header-title {\n padding-right: 8px;\n max-width: calc(100% - 20px);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort.table-header-box-filter > .table-header-title {\n max-width: calc(100% - 40px);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-asc > .table-sort-svg > span > .up-svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-header-box.table-header-box-sort-desc > .table-sort-svg > span > .down-svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head .show-colums {\n width: 56px;\n cursor: pointer;\n border-left: 1px solid rgba(171, 176, 185, 0.12);\n right: 0;\n}\n.paraui-v3-table > .table-contain > table > .table-head .show-colums .table-header-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 55px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .show-colums .table-header-box > svg {\n font-size: 24px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-table > .table-contain > table > .table-head .show-colums .table-header-box:hover > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-head.table-head-no-btn tr th:first-child .table-header-box {\n padding-left: 16px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-head-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-head-btn > .table-header-box {\n width: 32px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-head-btn:first-child {\n width: 48px;\n}\n.paraui-v3-table > .table-contain > table > .table-head .table-head-btn:first-child > .table-header-box {\n width: 48px;\n}\n.paraui-v3-table > .table-contain > table > .table-body {\n width: 100%;\n}\n.paraui-v3-table > .table-contain > table > .table-body.table-body-scroll tr td {\n max-width: 240px;\n}\n.paraui-v3-table > .table-contain > table > .table-body tr {\n height: 56px;\n}\n.paraui-v3-table > .table-contain > table > .table-body tr td {\n background-color: white;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-table > .table-contain > table > .table-body tr:nth-of-type(2n) td {\n background-color: rgb(249, 250, 251);\n}\n.paraui-v3-table > .table-contain > table > .table-body tr:hover td {\n background-color: rgb(237, 241, 249);\n}\n.paraui-v3-table > .table-contain > table > .table-body tr .table-expandable > svg {\n transition: all 0.3s;\n cursor: pointer;\n font-size: 16px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-table > .table-contain > table > .table-body tr .table-expandable > svg:hover {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-body tr .table-expandable > .expand {\n transform: rotate(180deg);\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table > .table-contain > table > .table-body .more-table-row {\n cursor: pointer;\n}\n.paraui-v3-table > .table-contain > table > .table-body .more-table-row .more-btn {\n color: rgb(54, 102, 214);\n font-size: 14px;\n}\n.paraui-v3-table > .table-contain > table > .table-body .more-table-row > .td-element {\n bottom: 0;\n background: white;\n box-shadow: 4px -4px 8px 0px rgba(171, 176, 185, 0.12);\n z-index: 100;\n}\n.paraui-v3-table > .table-contain > table > .table-body.table-body-no-btn tr td:first-child {\n padding-left: 16px;\n}\n.paraui-v3-table > .table-contain > table > .table-body.table-body-no-btn tr.more-table-row td:first-child {\n padding-left: 8px;\n}\n.paraui-v3-table > .table-contain > table > .table-body.table-body-no-btn > .table-no-data > td:first-child {\n padding: 0;\n}\n.paraui-v3-table > .table-contain > table > .table-body .table-body-btn {\n width: 32px;\n padding: 0;\n}\n.paraui-v3-table > .table-contain > table > .table-body .table-body-btn:first-child {\n width: 48px;\n}\n.paraui-v3-table > .table-contain > table > .table-body > .table-no-data {\n height: calc(100% - 50px);\n}\n.paraui-v3-table > .table-contain > table > .table-body > .table-no-data:hover td {\n background-color: white;\n}\n.paraui-v3-table > .table-contain > table > .table-body > .table-no-data > td {\n padding: 56px 0 0 0;\n}\n.paraui-v3-table > .table-contain > .table-pos-line {\n position: absolute;\n top: 0;\n width: 1px;\n background-color: rgb(54, 102, 214);\n z-index: 1000;\n}\n.paraui-v3-table > .table-pagination {\n width: 100%;\n height: 60px;\n padding-right: 10px;\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n}\n\n.paraui-v3-table-show-colums-popover > .component-popover-content {\n width: 200px;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box {\n padding-top: 8px;\n max-height: 224px;\n overflow-y: auto;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item {\n height: 36px;\n line-height: 36px;\n cursor: pointer;\n display: flex;\n padding: 0 4px;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > label {\n width: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item > span {\n color: rgb(46, 55, 67);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 32px);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item:hover > span {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item:hover > label .checkbox-box-inner {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-select > span {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-box > .show-colums-select-item.show-colums-select-item-select > label .checkbox-box-inner {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer {\n height: 45px;\n border-top: 1px solid rgba(171, 176, 185, 0.2);\n text-align: center;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button {\n width: 100%;\n height: 100%;\n border: 0;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button > span {\n font-size: 14px;\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button > span > span {\n margin-right: 5px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button > span > span svg {\n font-size: 14px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-table-show-colums-popover > .component-popover-content .show-colums-select > .show-colums-select-footer > button:hover > span > span svg {\n color: rgb(54, 102, 214);\n}\n\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box {\n padding-top: 8px;\n max-height: 224px;\n overflow-y: auto;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item {\n height: 36px;\n line-height: 36px;\n cursor: pointer;\n display: flex;\n padding: 0 4px;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > label {\n width: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item > span {\n color: rgb(46, 55, 67);\n font-size: 14px;\n display: inline-block;\n width: calc(100% - 32px);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item:hover > span {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item:hover > label .checkbox-box-inner {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item.filter-select-item-select > span {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-box > .filter-select-item.filter-select-item-select > label .checkbox-box-inner {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer {\n height: 45px;\n border-top: 1px solid rgba(171, 176, 185, 0.2);\n text-align: center;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button {\n width: 50%;\n height: 100%;\n border: 0;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button > span {\n font-size: 14px;\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button > span > span {\n margin-right: 5px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button > span > span svg {\n font-size: 14px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-filter-popover > .component-popover-content .filter-select > .filter-select-footer > button:hover > span > span svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-filter-popover.paraui-v3-filter-popover-default > .component-popover-content {\n width: 200px;\n}";
|
|
1659
|
-
styleInject(css_248z);
|
|
1660
|
-
|
|
1661
|
-
var Table = function Table(propsInit) {
|
|
1662
|
-
var props = useGlobalProps(propsInit, 'Table');
|
|
1663
|
-
// 判断浏览器
|
|
1664
|
-
var Browser = GetBrowserClass();
|
|
1665
|
-
if (Browser === 'ie') {
|
|
1666
|
-
// IE浏览器没有固定列
|
|
1667
|
-
props.fixedColumn = false;
|
|
1668
|
-
}
|
|
1669
|
-
var className = props.className,
|
|
1670
|
-
style = props.style,
|
|
1671
|
-
url = props.url,
|
|
1672
|
-
ctx = props.ctx,
|
|
1673
|
-
emptyProps = props.emptyProps,
|
|
1674
|
-
_props$method = props.method,
|
|
1675
|
-
method = _props$method === void 0 ? 'Get' : _props$method,
|
|
1676
|
-
data = props.data,
|
|
1677
|
-
_props$page = props.page,
|
|
1678
|
-
page = _props$page === void 0 ? 1 : _props$page,
|
|
1679
|
-
_props$size = props.size,
|
|
1680
|
-
size = _props$size === void 0 ? 10 : _props$size,
|
|
1681
|
-
_props$sizeArr = props.sizeArr,
|
|
1682
|
-
sizeArr = _props$sizeArr === void 0 ? [10, 20, 30] : _props$sizeArr,
|
|
1683
|
-
search = props.search,
|
|
1684
|
-
_props$pagination = props.pagination,
|
|
1685
|
-
pagination = _props$pagination === void 0 ? true : _props$pagination,
|
|
1686
|
-
_props$paginationType = props.paginationType,
|
|
1687
|
-
paginationType = _props$paginationType === void 0 ? 'complex' : _props$paginationType,
|
|
1688
|
-
flippingArrow = props.flippingArrow,
|
|
1689
|
-
_props$autoPagination = props.autoPagination,
|
|
1690
|
-
autoPagination = _props$autoPagination === void 0 ? true : _props$autoPagination,
|
|
1691
|
-
tableCell = props.tableCell,
|
|
1692
|
-
requestCallback = props.requestCallback,
|
|
1693
|
-
checkDefaultValue = props.checkDefaultValue,
|
|
1694
|
-
setCheck = props.setCheck,
|
|
1695
|
-
radioDefaultValue = props.radioDefaultValue,
|
|
1696
|
-
setRadio = props.setRadio,
|
|
1697
|
-
refresh = props.refresh,
|
|
1698
|
-
disabledArr = props.disabledArr,
|
|
1699
|
-
disabledArrStatus = props.disabledArrStatus,
|
|
1700
|
-
_props$headData = props.headData,
|
|
1701
|
-
headData = _props$headData === void 0 ? [] : _props$headData,
|
|
1702
|
-
sortTableRadio = props.sortTableRadio,
|
|
1703
|
-
_props$sortTable = props.sortTable,
|
|
1704
|
-
sortTable = _props$sortTable === void 0 ? false : _props$sortTable,
|
|
1705
|
-
_props$filter = props.filter,
|
|
1706
|
-
filter = _props$filter === void 0 ? false : _props$filter,
|
|
1707
|
-
expandable = props.expandable,
|
|
1708
|
-
_props$rowKey = props.rowKey,
|
|
1709
|
-
rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
|
|
1710
|
-
_props$check = props.check,
|
|
1711
|
-
check = _props$check === void 0 ? false : _props$check,
|
|
1712
|
-
_props$radio = props.radio,
|
|
1713
|
-
radio = _props$radio === void 0 ? false : _props$radio,
|
|
1714
|
-
_props$checkRememberP = props.checkRememberPage,
|
|
1715
|
-
checkRememberPage = _props$checkRememberP === void 0 ? false : _props$checkRememberP,
|
|
1716
|
-
_props$align = props.align,
|
|
1717
|
-
align = _props$align === void 0 ? 'left' : _props$align,
|
|
1718
|
-
paramsCallback = props.paramsCallback,
|
|
1719
|
-
operate = props.operate,
|
|
1720
|
-
_props$showColumns = props.showColumns,
|
|
1721
|
-
showColumns = _props$showColumns === void 0 ? 'inside' : _props$showColumns,
|
|
1722
|
-
_props$fixedTable = props.fixedTable,
|
|
1723
|
-
fixedTable = _props$fixedTable === void 0 ? true : _props$fixedTable,
|
|
1724
|
-
_props$fixedColumn = props.fixedColumn,
|
|
1725
|
-
fixedColumn = _props$fixedColumn === void 0 ? true : _props$fixedColumn,
|
|
1726
|
-
_props$dragColumn = props.dragColumn,
|
|
1727
|
-
dragColumn = _props$dragColumn === void 0 ? true : _props$dragColumn,
|
|
1728
|
-
formatter = props.formatter,
|
|
1729
|
-
_props$lineHeight = props.lineHeight,
|
|
1730
|
-
lineHeight = _props$lineHeight === void 0 ? 56 : _props$lineHeight,
|
|
1731
|
-
_props$lineWidth = props.lineWidth,
|
|
1732
|
-
lineWidth = _props$lineWidth === void 0 ? 80 : _props$lineWidth,
|
|
1733
|
-
_props$autoSize = props.autoSize,
|
|
1734
|
-
autoSize = _props$autoSize === void 0 ? true : _props$autoSize,
|
|
1735
|
-
_props$loadMore = props.loadMore,
|
|
1736
|
-
loadMore = _props$loadMore === void 0 ? false : _props$loadMore,
|
|
1737
|
-
loadMoreRender = props.loadMoreRender,
|
|
1738
|
-
onClickMore = props.onClickMore,
|
|
1739
|
-
expandValue = props.expandValue,
|
|
1740
|
-
expandMultiple = props.expandMultiple,
|
|
1741
|
-
disabledExpand = props.disabledExpand,
|
|
1742
|
-
onExpand = props.onExpand,
|
|
1743
|
-
_props$defaultExpandA = props.defaultExpandAllRows,
|
|
1744
|
-
defaultExpandAllRows = _props$defaultExpandA === void 0 ? false : _props$defaultExpandA,
|
|
1745
|
-
onClickColumns = props.onClickColumns,
|
|
1746
|
-
_props$beyondText = props.beyondText,
|
|
1747
|
-
beyondText = _props$beyondText === void 0 ? true : _props$beyondText,
|
|
1748
|
-
_props$tipMaxWidth = props.tipMaxWidth,
|
|
1749
|
-
tipMaxWidth = _props$tipMaxWidth === void 0 ? 500 : _props$tipMaxWidth,
|
|
1750
|
-
loading = props.loading,
|
|
1751
|
-
defaultSortValue = props.defaultSortValue,
|
|
1752
|
-
defaultFilterValue = props.defaultFilterValue,
|
|
1753
|
-
searchKeyName = props.searchKeyName,
|
|
1754
|
-
filterSearchCallback = props.filterSearchCallback,
|
|
1755
|
-
onClickRow = props.onClickRow,
|
|
1756
|
-
rowClassMapping = props.rowClassMapping,
|
|
1757
|
-
getPopupContainer = props.getPopupContainer,
|
|
1758
|
-
onSort = props.onSort,
|
|
1759
|
-
onError = props.onError;
|
|
1760
|
-
var intl = useFormatMessage('Table', localeJson);
|
|
1761
|
-
var dayNum = props.expirationTime ? props.expirationTime === 0 ? 100000000 : props.expirationTime : 7; // 过期天数
|
|
1762
|
-
var _useState = useState(props.page !== undefined ? props.page : 1),
|
|
1763
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1764
|
-
pageCom = _useState2[0],
|
|
1765
|
-
setPageCom = _useState2[1]; // 页数
|
|
1766
|
-
var _useState3 = useState(null),
|
|
1767
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1768
|
-
sizeCom = _useState4[0],
|
|
1769
|
-
setSizeCom = _useState4[1]; // 每页条数
|
|
1770
|
-
var _useState5 = useState(sizeArr),
|
|
1771
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1772
|
-
sizeArrCom = _useState6[0],
|
|
1773
|
-
setSizeArrCom = _useState6[1]; // 每页条数数组
|
|
1774
|
-
var _useState7 = useState(0),
|
|
1775
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1776
|
-
total = _useState8[0],
|
|
1777
|
-
setTotal = _useState8[1]; // 总数
|
|
1778
|
-
var _useState9 = useState([]),
|
|
1779
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
1780
|
-
rowData = _useState10[0],
|
|
1781
|
-
setRowData = _useState10[1]; // 当前页数据
|
|
1782
|
-
var _useState11 = useState({}),
|
|
1783
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
1784
|
-
rowDataJson = _useState12[0],
|
|
1785
|
-
setRowDataJson = _useState12[1]; // 当前页数据对象
|
|
1786
|
-
var _useState13 = useState({}),
|
|
1787
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
1788
|
-
totalDataJson = _useState14[0],
|
|
1789
|
-
setTotalDataJson = _useState14[1]; // 数据总数对象--用来分页记录数据的
|
|
1790
|
-
var _useState15 = useState(Object.values(defaultSortValue || {})),
|
|
1791
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
1792
|
-
orderTypeArr = _useState16[0],
|
|
1793
|
-
setOrderTypeArr = _useState16[1]; // 排序类型
|
|
1794
|
-
var _useState17 = useState(Object.keys(defaultSortValue || {})),
|
|
1795
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
1796
|
-
orderFieldArr = _useState18[0],
|
|
1797
|
-
setOrderFieldArr = _useState18[1]; // 排序字段
|
|
1798
|
-
var _useState19 = useState('not'),
|
|
1799
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
1800
|
-
headSelectStatus = _useState20[0],
|
|
1801
|
-
setHeadSelectStatus = _useState20[1]; // 表格头复选框状态
|
|
1802
|
-
var _useState21 = useState({}),
|
|
1803
|
-
_useState22 = _slicedToArray(_useState21, 2),
|
|
1804
|
-
checkJson = _useState22[0],
|
|
1805
|
-
setCheckJson = _useState22[1]; // 多选 选中的数据
|
|
1806
|
-
var _useState23 = useState(),
|
|
1807
|
-
_useState24 = _slicedToArray(_useState23, 2),
|
|
1808
|
-
radioValue = _useState24[0],
|
|
1809
|
-
setRadioValue = _useState24[1]; // 单选 选中的数据
|
|
1810
|
-
var _useState25 = useState({}),
|
|
1811
|
-
_useState26 = _slicedToArray(_useState25, 2),
|
|
1812
|
-
disabledJson = _useState26[0],
|
|
1813
|
-
setDisabledJson = _useState26[1]; // 禁用对象
|
|
1814
|
-
var _useState27 = useState({}),
|
|
1815
|
-
_useState28 = _slicedToArray(_useState27, 2),
|
|
1816
|
-
originalHead = _useState28[0],
|
|
1817
|
-
setOriginalHead = _useState28[1]; // 接口原数据表头json
|
|
1818
|
-
var _useState29 = useState([]),
|
|
1819
|
-
_useState30 = _slicedToArray(_useState29, 2),
|
|
1820
|
-
showHeadList = _useState30[0],
|
|
1821
|
-
setShowHeadList = _useState30[1]; // 显示列下拉值 所有头部的配置
|
|
1822
|
-
var _useState31 = useState([]),
|
|
1823
|
-
_useState32 = _slicedToArray(_useState31, 2),
|
|
1824
|
-
headDataCom = _useState32[0],
|
|
1825
|
-
setHeadDataCom = _useState32[1]; // 表格当前显示列 集合本地数据
|
|
1826
|
-
var _useState33 = useState(Object.assign({}, defaultFilterValue)),
|
|
1827
|
-
_useState34 = _slicedToArray(_useState33, 2),
|
|
1828
|
-
selectFilterCom = _useState34[0],
|
|
1829
|
-
setSelectFilterCom = _useState34[1]; // 过滤值
|
|
1830
|
-
var _useState35 = useState(true),
|
|
1831
|
-
_useState36 = _slicedToArray(_useState35, 2),
|
|
1832
|
-
loadState = _useState36[0],
|
|
1833
|
-
setLoadState = _useState36[1]; // 加载进度条状态
|
|
1834
|
-
var _useState37 = useState(false),
|
|
1835
|
-
_useState38 = _slicedToArray(_useState37, 2),
|
|
1836
|
-
loadMoreUrl = _useState38[0],
|
|
1837
|
-
setLoadMoreUrl = _useState38[1];
|
|
1838
|
-
var _useState39 = useState(Math.random().toString()),
|
|
1839
|
-
_useState40 = _slicedToArray(_useState39, 1),
|
|
1840
|
-
reqId = _useState40[0];
|
|
1841
|
-
var _useState41 = useState(),
|
|
1842
|
-
_useState42 = _slicedToArray(_useState41, 2),
|
|
1843
|
-
refreshCom = _useState42[0],
|
|
1844
|
-
setRefreshCom = _useState42[1];
|
|
1845
|
-
var _useState43 = useState(0),
|
|
1846
|
-
_useState44 = _slicedToArray(_useState43, 2),
|
|
1847
|
-
tableMinWidth = _useState44[0],
|
|
1848
|
-
setTableMinWidth = _useState44[1]; // 表格最小width
|
|
1849
|
-
var _useState45 = useState({}),
|
|
1850
|
-
_useState46 = _slicedToArray(_useState45, 2),
|
|
1851
|
-
posFixed = _useState46[0],
|
|
1852
|
-
setPosFixed = _useState46[1]; // 固定位置
|
|
1853
|
-
var _useState47 = useState({}),
|
|
1854
|
-
_useState48 = _slicedToArray(_useState47, 2),
|
|
1855
|
-
headDataConfig = _useState48[0],
|
|
1856
|
-
setHeadDataConfig = _useState48[1]; // 表头配置
|
|
1857
|
-
var containerRef = useRef(); // 表格内容高度
|
|
1858
|
-
var tableRef = useRef(); // 表格
|
|
1859
|
-
var constData = useRef({
|
|
1860
|
-
page: props.page !== undefined ? props.page : 1,
|
|
1861
|
-
headDataConfig: {}
|
|
1862
|
-
}); // 存储常量
|
|
1863
|
-
constData.current.loadMoreUrl = loadMore && url; // 用来判断加载更多请求是否放在表格里面
|
|
1864
|
-
constData.current.search = search;
|
|
1865
|
-
constData.current.url = url;
|
|
1866
|
-
constData.current.orderTypeArr = orderTypeArr;
|
|
1867
|
-
constData.current.orderFieldArr = orderFieldArr;
|
|
1868
|
-
constData.current.selectFilterCom = selectFilterCom;
|
|
1869
|
-
constData.current.data = data;
|
|
1870
|
-
constData.current.searchKeyName = searchKeyName;
|
|
1871
|
-
constData.current.filterSearchCallback = filterSearchCallback;
|
|
1872
|
-
constData.current.onError = onError;
|
|
1873
|
-
useEffect(function () {
|
|
1874
|
-
window.addEventListener('resize', changeResize);
|
|
1875
|
-
return function () {
|
|
1876
|
-
constData.current.isDestroy = true;
|
|
1877
|
-
clearTimeout(constData.current.reqTimer);
|
|
1878
|
-
clearTimeout(constData.current.loadingTimer);
|
|
1879
|
-
Cancel(reqId);
|
|
1880
|
-
window.removeEventListener('resize', changeResize);
|
|
1881
|
-
};
|
|
1882
|
-
}, []);
|
|
1883
|
-
useEffect(function () {
|
|
1884
|
-
if (loading !== undefined) {
|
|
1885
|
-
clearTimeout(constData.current.loadingTimer);
|
|
1886
|
-
constData.current.loadingTimer = setTimeout(function () {
|
|
1887
|
-
setLoadState(loading);
|
|
1888
|
-
}, 50);
|
|
1889
|
-
}
|
|
1890
|
-
}, [loading]);
|
|
1891
|
-
useEffect(function () {
|
|
1892
|
-
setLoadMoreUrl(Boolean(loadMore && url));
|
|
1893
|
-
}, [loadMore, url]);
|
|
1894
|
-
// 监听page
|
|
1895
|
-
useEffect(function () {
|
|
1896
|
-
if (props.page !== undefined) {
|
|
1897
|
-
handPage(props.page);
|
|
1898
|
-
}
|
|
1899
|
-
}, [page]);
|
|
1900
|
-
// 自动计算表格一页展示条数
|
|
1901
|
-
useEffect(function () {
|
|
1902
|
-
if (!autoSize) return handSize(size);
|
|
1903
|
-
if (props.size) {
|
|
1904
|
-
handSize(size);
|
|
1905
|
-
} else {
|
|
1906
|
-
if (containerRef && containerRef.current) {
|
|
1907
|
-
var height = containerRef.current.clientHeight - 50;
|
|
1908
|
-
if (props.loadMore) height -= 56;
|
|
1909
|
-
var num = Math.floor(height / lineHeight);
|
|
1910
|
-
var columnsNUmber = num < 1 ? size : num;
|
|
1911
|
-
if (sizeArr.indexOf(columnsNUmber) === -1) {
|
|
1912
|
-
sizeArr.unshift(columnsNUmber);
|
|
1913
|
-
// 数组排序
|
|
1914
|
-
sizeArr.sort(function (a, b) {
|
|
1915
|
-
return a - b;
|
|
1916
|
-
});
|
|
1917
|
-
setSizeArrCom(sizeArr);
|
|
1918
|
-
}
|
|
1919
|
-
handSize(columnsNUmber);
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
}, [size, autoSize]);
|
|
1923
|
-
// 处理表格头部
|
|
1924
|
-
useEffect(function () {
|
|
1925
|
-
if (props.headData !== undefined) {
|
|
1926
|
-
handInitHead(headData, false);
|
|
1927
|
-
}
|
|
1928
|
-
}, [headData]);
|
|
1929
|
-
// 设置总数对象
|
|
1930
|
-
useEffect(function () {
|
|
1931
|
-
if (data) {
|
|
1932
|
-
constData.current.historyData = [];
|
|
1933
|
-
var dataHand = handLocalData();
|
|
1934
|
-
var handTotalDataJson = ArrayToObject(rowKey, dataHand);
|
|
1935
|
-
setTotalDataJson(handTotalDataJson);
|
|
1936
|
-
setRefreshCom(Math.random());
|
|
1937
|
-
}
|
|
1938
|
-
}, [data]);
|
|
1939
|
-
useEffect(function () {
|
|
1940
|
-
// 第一次初始化不设置
|
|
1941
|
-
if (!constData.current.initReq) return;
|
|
1942
|
-
handPage(1);
|
|
1943
|
-
constData.current.historyData = [];
|
|
1944
|
-
}, [search, url]);
|
|
1945
|
-
useEffect(function () {
|
|
1946
|
-
if (constData.current.loadMoreUrl) {
|
|
1947
|
-
constData.current.historyData = [];
|
|
1948
|
-
}
|
|
1949
|
-
handPage(1);
|
|
1950
|
-
}, [refresh]);
|
|
1951
|
-
// 表格数据获取赋值
|
|
1952
|
-
useEffect(function () {
|
|
1953
|
-
clearTimeout(constData.current.reqTimer);
|
|
1954
|
-
if (constData.current.url) Cancel(reqId);
|
|
1955
|
-
constData.current.reqTimer = setTimeout(function () {
|
|
1956
|
-
constData.current.initReq = true;
|
|
1957
|
-
if (constData.current.url) {
|
|
1958
|
-
// 提交参数
|
|
1959
|
-
var postBody = {};
|
|
1960
|
-
if (pagination) {
|
|
1961
|
-
if (constData.current.page === null || constData.current.size === null) return;
|
|
1962
|
-
postBody.size = constData.current.size;
|
|
1963
|
-
postBody.page = constData.current.page;
|
|
1964
|
-
}
|
|
1965
|
-
if (orderFieldArr.length > 0) {
|
|
1966
|
-
postBody.orderField = orderFieldArr;
|
|
1967
|
-
postBody.orderType = orderTypeArr;
|
|
1968
|
-
// 单个排序
|
|
1969
|
-
if (props.sortTableRadio) {
|
|
1970
|
-
postBody.orderField = orderFieldArr[0];
|
|
1971
|
-
postBody.orderType = orderTypeArr[0];
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
if (selectFilterCom && Object.keys(selectFilterCom).length > 0) {
|
|
1975
|
-
var filterValue = handFilterReq();
|
|
1976
|
-
if (Object.keys(filterValue).length > 0) postBody.filter = filterValue;
|
|
1977
|
-
}
|
|
1978
|
-
if (constData.current.search) {
|
|
1979
|
-
if (_typeof(constData.current.search) === 'object') {
|
|
1980
|
-
postBody = Object.assign(Object.assign({}, postBody), constData.current.search);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
var obj = {
|
|
1984
|
-
url: constData.current.url,
|
|
1985
|
-
ctx: ctx,
|
|
1986
|
-
method: method,
|
|
1987
|
-
data: postBody
|
|
1988
|
-
};
|
|
1989
|
-
// get 请求
|
|
1990
|
-
if (method === 'Get') {
|
|
1991
|
-
if (paramsCallback) {
|
|
1992
|
-
paramsCallback(obj, function (handObj) {
|
|
1993
|
-
var handUrl = handGetReqParams(handObj);
|
|
1994
|
-
requestData(Object.assign(Object.assign({}, handObj), {
|
|
1995
|
-
url: handUrl,
|
|
1996
|
-
ctx: ctx,
|
|
1997
|
-
method: method
|
|
1998
|
-
}));
|
|
1999
|
-
});
|
|
2000
|
-
} else {
|
|
2001
|
-
var handUrl = handGetReqParams(obj);
|
|
2002
|
-
requestData({
|
|
2003
|
-
url: handUrl,
|
|
2004
|
-
ctx: ctx,
|
|
2005
|
-
method: method
|
|
2006
|
-
});
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
// post 请求
|
|
2010
|
-
if (method === 'Post') {
|
|
2011
|
-
if (paramsCallback) paramsCallback(obj, function (handObj) {
|
|
2012
|
-
requestData(handObj);
|
|
2013
|
-
});else requestData(obj);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
if (constData.current.data) {
|
|
2017
|
-
var dataT = handLocalData();
|
|
2018
|
-
dataT = filterSearchData(dataT); // 过滤数据
|
|
2019
|
-
if (pagination) {
|
|
2020
|
-
if (constData.current.page === null || constData.current.size === null) return;
|
|
2021
|
-
// 分页
|
|
2022
|
-
var sliceData = dataT.slice((constData.current.page - 1) * constData.current.size, (constData.current.page - 1) * constData.current.size + constData.current.size);
|
|
2023
|
-
setNowPageData(sliceData);
|
|
2024
|
-
setTotal(dataT.length);
|
|
2025
|
-
} else {
|
|
2026
|
-
// 不分页
|
|
2027
|
-
setNowPageData(dataT);
|
|
2028
|
-
}
|
|
2029
|
-
if (props.loading === undefined) setLoadState(false);
|
|
2030
|
-
}
|
|
2031
|
-
}, 50);
|
|
2032
|
-
}, [refreshCom]);
|
|
2033
|
-
// 单选赋值默认值
|
|
2034
|
-
useEffect(function () {
|
|
2035
|
-
if (radioDefaultValue !== undefined && radioDefaultValue !== radioValue) {
|
|
2036
|
-
setRadioValue(radioDefaultValue);
|
|
2037
|
-
}
|
|
2038
|
-
}, [radioDefaultValue]);
|
|
2039
|
-
// 复选框赋默认值
|
|
2040
|
-
useEffect(function () {
|
|
2041
|
-
if (checkDefaultValue) {
|
|
2042
|
-
var json = {};
|
|
2043
|
-
for (var i = 0, l = checkDefaultValue.length; i < l; i++) {
|
|
2044
|
-
var item = checkDefaultValue[i];
|
|
2045
|
-
json[item] = true;
|
|
2046
|
-
}
|
|
2047
|
-
setCheckJson(json);
|
|
2048
|
-
}
|
|
2049
|
-
}, [checkDefaultValue]);
|
|
2050
|
-
// 设置禁用对象
|
|
2051
|
-
useEffect(function () {
|
|
2052
|
-
if (disabledArr) {
|
|
2053
|
-
var json = {};
|
|
2054
|
-
for (var i = 0, l = disabledArr.length; i < l; i++) {
|
|
2055
|
-
var item = disabledArr[i];
|
|
2056
|
-
json[item] = true;
|
|
2057
|
-
}
|
|
2058
|
-
setDisabledJson(json);
|
|
2059
|
-
}
|
|
2060
|
-
}, [disabledArr]);
|
|
2061
|
-
// 计算复选框状态
|
|
2062
|
-
useEffect(function () {
|
|
2063
|
-
if (Object.keys(checkJson).length === 0) {
|
|
2064
|
-
// 全不选
|
|
2065
|
-
setHeadSelectStatus('not');
|
|
2066
|
-
} else {
|
|
2067
|
-
var arr = Object.keys(rowDataJson);
|
|
2068
|
-
if (arr.length === 0) {
|
|
2069
|
-
return setHeadSelectStatus('not');
|
|
2070
|
-
}
|
|
2071
|
-
var numTotal = arr.length;
|
|
2072
|
-
var num = 0;
|
|
2073
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2074
|
-
var key = arr[i];
|
|
2075
|
-
if (disabledJson[key]) {
|
|
2076
|
-
numTotal--;
|
|
2077
|
-
} else {
|
|
2078
|
-
if (checkJson[key] !== undefined) {
|
|
2079
|
-
num++;
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
if (num === 0) {
|
|
2084
|
-
// 全不选
|
|
2085
|
-
return setHeadSelectStatus('not');
|
|
2086
|
-
}
|
|
2087
|
-
if (num === numTotal) {
|
|
2088
|
-
// 全选
|
|
2089
|
-
return setHeadSelectStatus('all');
|
|
2090
|
-
}
|
|
2091
|
-
if (num < numTotal) {
|
|
2092
|
-
// 半选
|
|
2093
|
-
return setHeadSelectStatus('half');
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
}, [checkJson, rowData, disabledJson]);
|
|
2097
|
-
// 表格更新计算是否有滚动条
|
|
2098
|
-
useEffect(function () {
|
|
2099
|
-
tableBoxScroll({
|
|
2100
|
-
target: containerRef.current
|
|
2101
|
-
});
|
|
2102
|
-
});
|
|
2103
|
-
/** 设置size */
|
|
2104
|
-
var handSize = function handSize(num) {
|
|
2105
|
-
constData.current.size = num;
|
|
2106
|
-
setSizeCom(num);
|
|
2107
|
-
setRefreshCom(Math.random());
|
|
2108
|
-
};
|
|
2109
|
-
/**
|
|
2110
|
-
* 处理page
|
|
2111
|
-
* */
|
|
2112
|
-
var handPage = function handPage(num) {
|
|
2113
|
-
constData.current.page = num;
|
|
2114
|
-
setPageCom(num);
|
|
2115
|
-
setRefreshCom(Math.random());
|
|
2116
|
-
};
|
|
2117
|
-
/** 处理本地data */
|
|
2118
|
-
var handLocalData = function handLocalData() {
|
|
2119
|
-
var _a;
|
|
2120
|
-
var dataT = [];
|
|
2121
|
-
if (constData.current.data instanceof Array) {
|
|
2122
|
-
dataT = constData.current.data;
|
|
2123
|
-
} else {
|
|
2124
|
-
dataT = (_a = constData.current.data) === null || _a === void 0 ? void 0 : _a.list;
|
|
2125
|
-
}
|
|
2126
|
-
return dataT;
|
|
2127
|
-
};
|
|
2128
|
-
/** 本地数据过滤搜索数据 */
|
|
2129
|
-
var filterSearchData = function filterSearchData(arr) {
|
|
2130
|
-
var filterKeys = Object.keys(constData.current.selectFilterCom || {});
|
|
2131
|
-
var handArr = [];
|
|
2132
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2133
|
-
var item = arr[i];
|
|
2134
|
-
var bol = true;
|
|
2135
|
-
if (constData.current.filterSearchCallback) {
|
|
2136
|
-
// 自定义过滤方法
|
|
2137
|
-
bol = constData.current.filterSearchCallback(item, {
|
|
2138
|
-
search: constData.current.search,
|
|
2139
|
-
filter: constData.current.selectFilterCom
|
|
2140
|
-
});
|
|
2141
|
-
} else {
|
|
2142
|
-
// 过滤条件
|
|
2143
|
-
for (var j = 0, k = filterKeys.length; j < k; j++) {
|
|
2144
|
-
var name = filterKeys[j];
|
|
2145
|
-
var filterVal = constData.current.selectFilterCom[name];
|
|
2146
|
-
var val = item[name];
|
|
2147
|
-
// 不满足当前过滤的数据,过滤掉
|
|
2148
|
-
if (filterVal.length > 0 && filterVal.indexOf(val) === -1) {
|
|
2149
|
-
bol = false;
|
|
2150
|
-
continue;
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
// 搜索条件
|
|
2154
|
-
if (bol) {
|
|
2155
|
-
bol = handLocalSearch(item);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
if (bol) handArr.push(item);
|
|
2159
|
-
}
|
|
2160
|
-
return handArr;
|
|
2161
|
-
};
|
|
2162
|
-
/** 处理本地搜索, 返回true满足搜索条件 */
|
|
2163
|
-
var handLocalSearch = function handLocalSearch(item) {
|
|
2164
|
-
var searchKey;
|
|
2165
|
-
if (constData.current.search && typeof constData.current.search !== "string" && constData.current.search.searchKey) {
|
|
2166
|
-
searchKey = constData.current.search.searchKey;
|
|
2167
|
-
}
|
|
2168
|
-
if (searchKey !== undefined && constData.current.searchKeyName && constData.current.searchKeyName.length > 0) {
|
|
2169
|
-
for (var i = 0, l = constData.current.searchKeyName.length; i < l; i++) {
|
|
2170
|
-
var name = constData.current.searchKeyName[i];
|
|
2171
|
-
var nameVal = item[name];
|
|
2172
|
-
if (nameVal.indexOf(searchKey) !== -1) {
|
|
2173
|
-
// 存在一项就满足
|
|
2174
|
-
return true;
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
} else {
|
|
2178
|
-
return true;
|
|
2179
|
-
}
|
|
2180
|
-
return false;
|
|
2181
|
-
};
|
|
2182
|
-
/** 本地显示列key */
|
|
2183
|
-
var getTableHeadKey = function getTableHeadKey() {
|
|
2184
|
-
// 自定义key
|
|
2185
|
-
if (props.tableKey) {
|
|
2186
|
-
return props.tableKey;
|
|
2187
|
-
}
|
|
2188
|
-
// 本地数据
|
|
2189
|
-
if (props.data) {
|
|
2190
|
-
return window.location.origin + window.location.pathname + window.location.hash;
|
|
2191
|
-
}
|
|
2192
|
-
// url
|
|
2193
|
-
if (props.url) {
|
|
2194
|
-
return props.url + '_' + (props.method || 'Get');
|
|
2195
|
-
}
|
|
2196
|
-
return '';
|
|
2197
|
-
};
|
|
2198
|
-
/** 获取储存的表头列 */
|
|
2199
|
-
var getLocalStorageHeadCom = function getLocalStorageHeadCom() {
|
|
2200
|
-
if (props.rememberColumns === false) return {};
|
|
2201
|
-
var json = getLocalStorageSelectHead(getTableHeadKey(), dayNum);
|
|
2202
|
-
return json;
|
|
2203
|
-
};
|
|
2204
|
-
/**
|
|
2205
|
-
* 设置本地表格列
|
|
2206
|
-
*
|
|
2207
|
-
* */
|
|
2208
|
-
var setLocalStorageHeadCom = function setLocalStorageHeadCom(obj) {
|
|
2209
|
-
if (props.rememberColumns === false) return;
|
|
2210
|
-
var localStorageData = getLocalStorageHeadCom();
|
|
2211
|
-
var json = {
|
|
2212
|
-
headName: localStorageData.headName || {},
|
|
2213
|
-
headDataConfig: localStorageData.headDataConfig || {},
|
|
2214
|
-
storageTime: new Date().getTime(),
|
|
2215
|
-
validity: dayNum * (60 * 60 * 24)
|
|
2216
|
-
};
|
|
2217
|
-
// 设置固定列
|
|
2218
|
-
if (obj.setFixed) {
|
|
2219
|
-
var selectHeadJson = ArrayToObject('name', obj.headArr || []);
|
|
2220
|
-
for (var i = 0, l = showHeadList.length; i < l; i++) {
|
|
2221
|
-
var item = showHeadList[i];
|
|
2222
|
-
var name = item.name || '';
|
|
2223
|
-
json.headName[name] = false;
|
|
2224
|
-
if (selectHeadJson[name]) {
|
|
2225
|
-
json.headName[name] = true;
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
// 设置拖动列
|
|
2230
|
-
if (obj.setDrag) {
|
|
2231
|
-
json.headDataConfig = obj.headDataConfig || {};
|
|
2232
|
-
}
|
|
2233
|
-
setLocalStorageSelectHead(getTableHeadKey(), json);
|
|
2234
|
-
};
|
|
2235
|
-
/**
|
|
2236
|
-
* 处理表格列是否显示
|
|
2237
|
-
* @param item {HeadDataProps} 当前列
|
|
2238
|
-
* @param showHeadArr {HeadDataProps[]} 显示列与本地数据集合
|
|
2239
|
-
* @param localHead {HeadLocalStorageItem} 本地显示列数据
|
|
2240
|
-
* */
|
|
2241
|
-
var handHeadShow = function handHeadShow(item, showHeadArr, localHead) {
|
|
2242
|
-
if (showColumns === false) {
|
|
2243
|
-
// 如果不显示选择列,全部显示
|
|
2244
|
-
showHeadArr.push(item);
|
|
2245
|
-
return;
|
|
2246
|
-
}
|
|
2247
|
-
if (props.rememberColumns === false) {
|
|
2248
|
-
// 不记住列
|
|
2249
|
-
if (item.selected) showHeadArr.push(item);
|
|
2250
|
-
} else {
|
|
2251
|
-
// 记住列
|
|
2252
|
-
var nameSelectJson = localHead.headName || {};
|
|
2253
|
-
var name = item.name || '';
|
|
2254
|
-
var nameSelect = nameSelectJson[name];
|
|
2255
|
-
if (nameSelect !== undefined) {
|
|
2256
|
-
// 存在本地选择列里面,选中添加到显示列
|
|
2257
|
-
if (nameSelect) showHeadArr.push(item);
|
|
2258
|
-
} else {
|
|
2259
|
-
// 不存在本地选择列里面,当前选中,则添加进去
|
|
2260
|
-
if (item.selected) showHeadArr.push(item);
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
};
|
|
2264
|
-
/** 处理序号 */
|
|
2265
|
-
var handSerial = function handSerial(arr) {
|
|
2266
|
-
var defaultVal = {
|
|
2267
|
-
label: intl({
|
|
2268
|
-
id: 'serial'
|
|
2269
|
-
}),
|
|
2270
|
-
selected: true,
|
|
2271
|
-
width: props.radio || props.check || props.expandable ? 45 : 55,
|
|
2272
|
-
fixed: 'left',
|
|
2273
|
-
className: 'table-serial-number',
|
|
2274
|
-
name: 'table-serial-number',
|
|
2275
|
-
render: function render(row, item, val, index, rowIndex) {
|
|
2276
|
-
return Number(rowIndex) + 1;
|
|
2277
|
-
}
|
|
2278
|
-
};
|
|
2279
|
-
if (props.serialNumber) {
|
|
2280
|
-
if (typeof props.serialNumber === 'boolean') {
|
|
2281
|
-
arr.unshift(defaultVal);
|
|
2282
|
-
} else {
|
|
2283
|
-
arr.unshift(Object.assign(Object.assign({}, defaultVal), props.serialNumber));
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2287
|
-
/**
|
|
2288
|
-
* 初始化设置表头
|
|
2289
|
-
* @param arr {(HeadDataProps | HeadDataReqProps)[]} 表头数据
|
|
2290
|
-
* @param bol {boolean} true请求表头
|
|
2291
|
-
* */
|
|
2292
|
-
var handInitHead = function handInitHead(arr, bol) {
|
|
2293
|
-
var headShowArr = []; // 表格显示列
|
|
2294
|
-
var headArr = []; // 显示列列表
|
|
2295
|
-
var json = {};
|
|
2296
|
-
var localHead = getLocalStorageHeadCom();
|
|
2297
|
-
constData.current.headDataConfig = localHead.headDataConfig || {};
|
|
2298
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2299
|
-
var item = arr[i];
|
|
2300
|
-
var name = item.name || '';
|
|
2301
|
-
if (typeof item.width === 'number') item.width = item.width + 'px';
|
|
2302
|
-
if (!bol) item.orderNum = i;
|
|
2303
|
-
handHeadShow(item, headShowArr, localHead);
|
|
2304
|
-
headArr.push(item);
|
|
2305
|
-
json[name] = item;
|
|
2306
|
-
}
|
|
2307
|
-
if (bol) {
|
|
2308
|
-
headShowArr.sort(function (a, b) {
|
|
2309
|
-
return Number(a.orderNum) - Number(b.orderNum);
|
|
2310
|
-
});
|
|
2311
|
-
headArr.sort(function (a, b) {
|
|
2312
|
-
return Number(a.orderNum) - Number(b.orderNum);
|
|
2313
|
-
});
|
|
2314
|
-
}
|
|
2315
|
-
handSerial(headShowArr); // 处理序号
|
|
2316
|
-
handHeadDataCom(headShowArr); // 处理显示列宽度
|
|
2317
|
-
setHeadDataCom(headShowArr); // 表格当前显示列 集合本地数据
|
|
2318
|
-
setShowHeadList(headArr); // 显示列下拉值 所有头部的配置
|
|
2319
|
-
setHeadDataConfig(Object.assign({}, constData.current.headDataConfig));
|
|
2320
|
-
constData.current.headDataJson = json;
|
|
2321
|
-
};
|
|
2322
|
-
// 计算左边的差量
|
|
2323
|
-
var handLeftWidth = function handLeftWidth() {
|
|
2324
|
-
var leftNum = 0;
|
|
2325
|
-
// 复选
|
|
2326
|
-
if (props.check) {
|
|
2327
|
-
leftNum += 48;
|
|
2328
|
-
}
|
|
2329
|
-
// 单选
|
|
2330
|
-
if (props.radio) {
|
|
2331
|
-
if (props.check) {
|
|
2332
|
-
leftNum += 32;
|
|
2333
|
-
} else {
|
|
2334
|
-
leftNum += 48;
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
|
-
// 嵌套
|
|
2338
|
-
if (props.expandable) {
|
|
2339
|
-
if (props.check || props.radio) {
|
|
2340
|
-
leftNum += 32;
|
|
2341
|
-
} else {
|
|
2342
|
-
leftNum += 48;
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
return leftNum;
|
|
2346
|
-
};
|
|
2347
|
-
// 计算右边的差量
|
|
2348
|
-
var handRightWidth = function handRightWidth() {
|
|
2349
|
-
var rightNum = 0;
|
|
2350
|
-
// 显示列宽度
|
|
2351
|
-
if (props.showColumns === 'inside' || props.showColumns === undefined) {
|
|
2352
|
-
rightNum += 56;
|
|
2353
|
-
}
|
|
2354
|
-
// 操作列
|
|
2355
|
-
if (props.operate) {
|
|
2356
|
-
if (props.operate.width) {
|
|
2357
|
-
rightNum += getStringInNumber(props.operate.width);
|
|
2358
|
-
} else {
|
|
2359
|
-
if (props.operate.operateBtnRender) {
|
|
2360
|
-
// 操作按钮组
|
|
2361
|
-
rightNum += 112;
|
|
2362
|
-
} else {
|
|
2363
|
-
rightNum += lineWidth; // 自定义操作
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
return rightNum;
|
|
2369
|
-
};
|
|
2370
|
-
// 获取宽度
|
|
2371
|
-
var getWidth = function getWidth(item) {
|
|
2372
|
-
var w = item.width || '';
|
|
2373
|
-
var name = item.name || '';
|
|
2374
|
-
var wDrag = constData.current.headDataConfig[name] && constData.current.headDataConfig[name].width;
|
|
2375
|
-
if (wDrag) w = wDrag;
|
|
2376
|
-
return w;
|
|
2377
|
-
};
|
|
2378
|
-
/**
|
|
2379
|
-
* 处理显示列宽度
|
|
2380
|
-
* */
|
|
2381
|
-
var handHeadDataCom = function handHeadDataCom(arr) {
|
|
2382
|
-
// 左侧定位数组
|
|
2383
|
-
var leftArr = [];
|
|
2384
|
-
// 右侧定位数组
|
|
2385
|
-
var rightArr = [];
|
|
2386
|
-
// 表格最小宽度
|
|
2387
|
-
var tableMinWidth = 0;
|
|
2388
|
-
// 左边差量
|
|
2389
|
-
var leftWidth = handLeftWidth();
|
|
2390
|
-
tableMinWidth += leftWidth;
|
|
2391
|
-
// 右边差量
|
|
2392
|
-
var rightWidth = handRightWidth();
|
|
2393
|
-
tableMinWidth += rightWidth;
|
|
2394
|
-
var posJson = {
|
|
2395
|
-
leftBol: false,
|
|
2396
|
-
rightBol: false
|
|
2397
|
-
};
|
|
2398
|
-
// 显示列
|
|
2399
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2400
|
-
var item = arr[i];
|
|
2401
|
-
var itemWidth = 0;
|
|
2402
|
-
var handW = getWidth(item); // 获取宽度,有拖动过后宽度,就用拖动的
|
|
2403
|
-
if (handW) {
|
|
2404
|
-
itemWidth = getStringInNumber(handW);
|
|
2405
|
-
tableMinWidth += itemWidth;
|
|
2406
|
-
} else {
|
|
2407
|
-
tableMinWidth += lineWidth;
|
|
2408
|
-
}
|
|
2409
|
-
if (item.fixed === 'left' && item.width) {
|
|
2410
|
-
// 固定列必须具有宽度
|
|
2411
|
-
leftArr.push(item);
|
|
2412
|
-
}
|
|
2413
|
-
if (item.fixed === 'right' && item.width) {
|
|
2414
|
-
// 固定列必须具有宽度
|
|
2415
|
-
rightArr.push(item);
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
if (leftArr.length > 0) {
|
|
2419
|
-
posJson.leftBol = true;
|
|
2420
|
-
// 左边定位位置
|
|
2421
|
-
var leftOps = leftWidth;
|
|
2422
|
-
for (var _i = 0, _l = leftArr.length; _i < _l; _i++) {
|
|
2423
|
-
var _item = leftArr[_i];
|
|
2424
|
-
if (_item.width) {
|
|
2425
|
-
var _handW = getWidth(_item); // 获取宽度,有拖动过后宽度,就用拖动的
|
|
2426
|
-
var _itemWidth = getStringInNumber(_handW);
|
|
2427
|
-
_item.paraui_left_width = leftOps;
|
|
2428
|
-
leftOps += _itemWidth;
|
|
2429
|
-
// 最后一个
|
|
2430
|
-
if (_i === leftArr.length - 1) {
|
|
2431
|
-
_item.paraui_fixed_left_last = true;
|
|
2432
|
-
} else {
|
|
2433
|
-
_item.paraui_fixed_left_last = false;
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
if (rightArr.length > 0) {
|
|
2439
|
-
posJson.rightBol = true;
|
|
2440
|
-
// 右边定位位置
|
|
2441
|
-
var rightOps = rightWidth;
|
|
2442
|
-
for (var _i2 = rightArr.length - 1; _i2 >= 0; _i2--) {
|
|
2443
|
-
var _item2 = rightArr[_i2];
|
|
2444
|
-
if (_item2.width) {
|
|
2445
|
-
var _handW2 = getWidth(_item2); // 获取宽度,有拖动过后宽度,就用拖动的
|
|
2446
|
-
var _itemWidth2 = getStringInNumber(_handW2);
|
|
2447
|
-
_item2.paraui_right_width = rightOps;
|
|
2448
|
-
rightOps += _itemWidth2;
|
|
2449
|
-
// 最后一个
|
|
2450
|
-
if (_i2 === rightArr.length - 1) {
|
|
2451
|
-
_item2.paraui_fixed_right_first = true;
|
|
2452
|
-
} else {
|
|
2453
|
-
_item2.paraui_fixed_right_first = false;
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
}
|
|
2458
|
-
setTableMinWidth(tableMinWidth); // 表格最小宽度
|
|
2459
|
-
setPosFixed(posJson); // 定位信息
|
|
2460
|
-
};
|
|
2461
|
-
/**
|
|
2462
|
-
* 处理过滤请求数据
|
|
2463
|
-
* */
|
|
2464
|
-
var handFilterReq = function handFilterReq() {
|
|
2465
|
-
var json = {};
|
|
2466
|
-
var arr = Object.keys(selectFilterCom);
|
|
2467
|
-
var headDataJson = constData.current.headDataJson || {};
|
|
2468
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2469
|
-
var name = arr[i];
|
|
2470
|
-
var itemValue = selectFilterCom[name];
|
|
2471
|
-
if (itemValue.length === 0) continue; // 未选择的过滤项不参与请求
|
|
2472
|
-
var item = headDataJson[name];
|
|
2473
|
-
if (item && item.filterRadio) {
|
|
2474
|
-
json[name] = itemValue[0];
|
|
2475
|
-
} else {
|
|
2476
|
-
json[name] = itemValue;
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
return json;
|
|
2480
|
-
};
|
|
2481
|
-
/**
|
|
2482
|
-
* 发送请求
|
|
2483
|
-
* @param obj {ReqProps} 请求信息
|
|
2484
|
-
*/
|
|
2485
|
-
var requestData = function requestData(obj) {
|
|
2486
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
2487
|
-
var _yield$requestFunc, data, err, onErrorFlag;
|
|
2488
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
2489
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2490
|
-
case 0:
|
|
2491
|
-
obj.uuid = reqId;
|
|
2492
|
-
if (props.loading === undefined) setLoadState(true);
|
|
2493
|
-
_context.next = 4;
|
|
2494
|
-
return requestFunc(obj);
|
|
2495
|
-
case 4:
|
|
2496
|
-
_yield$requestFunc = _context.sent;
|
|
2497
|
-
data = _yield$requestFunc.data;
|
|
2498
|
-
err = _yield$requestFunc.err;
|
|
2499
|
-
if (!constData.current.isDestroy) {
|
|
2500
|
-
_context.next = 9;
|
|
2501
|
-
break;
|
|
2502
|
-
}
|
|
2503
|
-
return _context.abrupt("return");
|
|
2504
|
-
case 9:
|
|
2505
|
-
if (!err) {
|
|
2506
|
-
_context.next = 23;
|
|
2507
|
-
break;
|
|
2508
|
-
}
|
|
2509
|
-
if (props.loading === undefined) setLoadState(false);
|
|
2510
|
-
// cancel的接口 不清除上次展示的数据
|
|
2511
|
-
if (err.__CANCEL__) {
|
|
2512
|
-
_context.next = 22;
|
|
2513
|
-
break;
|
|
2514
|
-
}
|
|
2515
|
-
onErrorFlag = false;
|
|
2516
|
-
if (!constData.current.onError) {
|
|
2517
|
-
_context.next = 17;
|
|
2518
|
-
break;
|
|
2519
|
-
}
|
|
2520
|
-
_context.next = 16;
|
|
2521
|
-
return constData.current.onError(err);
|
|
2522
|
-
case 16:
|
|
2523
|
-
onErrorFlag = _context.sent;
|
|
2524
|
-
case 17:
|
|
2525
|
-
if (onErrorFlag) {
|
|
2526
|
-
_context.next = 19;
|
|
2527
|
-
break;
|
|
2528
|
-
}
|
|
2529
|
-
return _context.abrupt("return");
|
|
2530
|
-
case 19:
|
|
2531
|
-
setRowData([]);
|
|
2532
|
-
setTotal(0);
|
|
2533
|
-
setRowDataJson({});
|
|
2534
|
-
case 22:
|
|
2535
|
-
return _context.abrupt("return", false);
|
|
2536
|
-
case 23:
|
|
2537
|
-
if (requestCallback) {
|
|
2538
|
-
requestCallback(data, function (handData) {
|
|
2539
|
-
if (handData) {
|
|
2540
|
-
if (handData.data) handData = handData.data;
|
|
2541
|
-
handReqData(handData);
|
|
2542
|
-
if (props.loading === undefined) setLoadState(false);
|
|
2543
|
-
}
|
|
2544
|
-
});
|
|
2545
|
-
} else {
|
|
2546
|
-
if (data.data) data = data.data;
|
|
2547
|
-
handReqData(data);
|
|
2548
|
-
if (props.loading === undefined) setLoadState(false);
|
|
2549
|
-
}
|
|
2550
|
-
case 24:
|
|
2551
|
-
case "end":
|
|
2552
|
-
return _context.stop();
|
|
2553
|
-
}
|
|
2554
|
-
}, _callee);
|
|
2555
|
-
}));
|
|
2556
|
-
};
|
|
2557
|
-
/**
|
|
2558
|
-
* 设置请求数据
|
|
2559
|
-
* @param data {any} 请求信息
|
|
2560
|
-
*/
|
|
2561
|
-
var handReqData = function handReqData(data) {
|
|
2562
|
-
if (data.columns && props.headData === undefined) {
|
|
2563
|
-
var str = JSON.stringify(data.columns);
|
|
2564
|
-
if (str !== JSON.stringify(originalHead)) {
|
|
2565
|
-
setOriginalHead(data.columns);
|
|
2566
|
-
var arr = Object.keys(data.columns);
|
|
2567
|
-
var headDataArr = []; // 表头数据
|
|
2568
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2569
|
-
var key = arr[i];
|
|
2570
|
-
var item = data.columns[key];
|
|
2571
|
-
item.name = key;
|
|
2572
|
-
item.label = item.displayName;
|
|
2573
|
-
item.filter = item.filterFlag;
|
|
2574
|
-
item.filterRadio = item.filterRadioFlag;
|
|
2575
|
-
item.sort = item.orderFlag;
|
|
2576
|
-
item.selected = item.selectedFlag;
|
|
2577
|
-
item.width = item.width;
|
|
2578
|
-
headDataArr.push(item);
|
|
2579
|
-
}
|
|
2580
|
-
handInitHead(headDataArr, true);
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
if (pagination) {
|
|
2584
|
-
// 分页 data是对象
|
|
2585
|
-
setNowPageData(data.list || []);
|
|
2586
|
-
setTotal(data.total);
|
|
2587
|
-
if (data.page !== undefined && data.page !== null) {
|
|
2588
|
-
constData.current.page = Number(data.page);
|
|
2589
|
-
setPageCom(Number(data.page));
|
|
2590
|
-
}
|
|
2591
|
-
} else {
|
|
2592
|
-
var handData1 = [];
|
|
2593
|
-
if (data instanceof Array) {
|
|
2594
|
-
handData1 = data;
|
|
2595
|
-
} else {
|
|
2596
|
-
handData1 = data.list || [];
|
|
2597
|
-
}
|
|
2598
|
-
setNowPageData(handData1);
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
/**
|
|
2602
|
-
* 设置当前页数据
|
|
2603
|
-
* @param nowPageData {any} 当前页数据
|
|
2604
|
-
*/
|
|
2605
|
-
var setNowPageData = function setNowPageData(nowPageData) {
|
|
2606
|
-
// 加载更多请求放在里面
|
|
2607
|
-
if (constData.current.loadMoreUrl) {
|
|
2608
|
-
var historyData = constData.current.historyData || [];
|
|
2609
|
-
if (historyData.length > 0) {
|
|
2610
|
-
nowPageData = [].concat(_toConsumableArray(historyData), _toConsumableArray(nowPageData));
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
var handDataJson = ArrayToObject(rowKey, nowPageData);
|
|
2614
|
-
constData.current.historyData = nowPageData;
|
|
2615
|
-
setRowDataJson(handDataJson);
|
|
2616
|
-
setRowData(nowPageData);
|
|
2617
|
-
// 设置总数对象
|
|
2618
|
-
if (url) {
|
|
2619
|
-
setTotalDataJson(Object.assign(Object.assign({}, totalDataJson), handDataJson));
|
|
2620
|
-
}
|
|
2621
|
-
};
|
|
2622
|
-
/**
|
|
2623
|
-
* 改变页数
|
|
2624
|
-
* @param num {number | undefined} 页数
|
|
2625
|
-
*/
|
|
2626
|
-
var changePage = function changePage(num) {
|
|
2627
|
-
if (num !== undefined) handPage(num);
|
|
2628
|
-
clearCheckValue();
|
|
2629
|
-
};
|
|
2630
|
-
/**
|
|
2631
|
-
* 改变每页条数
|
|
2632
|
-
* @param num {number | undefined} 条数
|
|
2633
|
-
*/
|
|
2634
|
-
var changeRowsPerPage = function changeRowsPerPage(num) {
|
|
2635
|
-
if (num !== undefined) handSize(num);
|
|
2636
|
-
handPage(1);
|
|
2637
|
-
};
|
|
2638
|
-
/**
|
|
2639
|
-
* 加载更多,点击改变分页
|
|
2640
|
-
*/
|
|
2641
|
-
var changePageMore = function changePageMore() {
|
|
2642
|
-
var pageHnad = Number(pageCom) + 1;
|
|
2643
|
-
handPage(pageHnad);
|
|
2644
|
-
};
|
|
2645
|
-
/**
|
|
2646
|
-
* 排序
|
|
2647
|
-
* @param event 元素
|
|
2648
|
-
* @param name 当前列name
|
|
2649
|
-
*/
|
|
2650
|
-
var handleRequestSort = function handleRequestSort(event, name) {
|
|
2651
|
-
// asc 升序 -> desc降序 -> undefined 无序
|
|
2652
|
-
var index = orderFieldArr.indexOf(name);
|
|
2653
|
-
if (index !== -1) {
|
|
2654
|
-
// 排序过
|
|
2655
|
-
var orderType = orderTypeArr[index];
|
|
2656
|
-
if (orderType === 'asc') {
|
|
2657
|
-
orderTypeArr[index] = 'desc';
|
|
2658
|
-
}
|
|
2659
|
-
if (orderType === 'desc') {
|
|
2660
|
-
orderFieldArr.splice(index, 1);
|
|
2661
|
-
orderTypeArr.splice(index, 1);
|
|
2662
|
-
}
|
|
2663
|
-
if (orderType === undefined) {
|
|
2664
|
-
orderTypeArr[index] = 'asc';
|
|
2665
|
-
}
|
|
2666
|
-
} else {
|
|
2667
|
-
// 没有排序过
|
|
2668
|
-
orderFieldArr.push(name);
|
|
2669
|
-
orderTypeArr.push('asc');
|
|
2670
|
-
}
|
|
2671
|
-
var orderFieldArrHand = _toConsumableArray(orderFieldArr);
|
|
2672
|
-
var orderTypeArrHand = _toConsumableArray(orderTypeArr);
|
|
2673
|
-
// 单个排序
|
|
2674
|
-
if (sortTableRadio) {
|
|
2675
|
-
var num = orderFieldArrHand.indexOf(name);
|
|
2676
|
-
if (num !== -1) {
|
|
2677
|
-
orderFieldArrHand = [orderFieldArrHand[num]];
|
|
2678
|
-
orderTypeArrHand = [orderTypeArrHand[num]];
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
setOrderFieldArr(orderFieldArrHand);
|
|
2682
|
-
setOrderTypeArr(orderTypeArrHand);
|
|
2683
|
-
constData.current.orderFieldArr = orderFieldArrHand;
|
|
2684
|
-
constData.current.orderTypeArr = orderTypeArrHand;
|
|
2685
|
-
// 只试用与本地数据
|
|
2686
|
-
if (onSort) onSort({
|
|
2687
|
-
orderField: orderFieldArrHand,
|
|
2688
|
-
orderType: orderTypeArrHand
|
|
2689
|
-
});
|
|
2690
|
-
if (constData.current.loadMoreUrl) {
|
|
2691
|
-
constData.current.historyData = [];
|
|
2692
|
-
handPage(1);
|
|
2693
|
-
}
|
|
2694
|
-
setRefreshCom(Math.random());
|
|
2695
|
-
};
|
|
2696
|
-
/**
|
|
2697
|
-
* 处理复选框往外抛值
|
|
2698
|
-
* @param json 当前选中值
|
|
2699
|
-
*/
|
|
2700
|
-
var handCheckValue = function handCheckValue(json) {
|
|
2701
|
-
if (props.checkDefaultValue === undefined) setCheckJson(Object.assign({}, json));
|
|
2702
|
-
var arr = Object.keys(json);
|
|
2703
|
-
if (setCheck) {
|
|
2704
|
-
var selectData = [];
|
|
2705
|
-
for (var i = 0, l = arr.length; i < l; i++) {
|
|
2706
|
-
if (totalDataJson[arr[i]]) selectData.push(totalDataJson[arr[i]]);
|
|
2707
|
-
}
|
|
2708
|
-
setCheck(arr, selectData);
|
|
2709
|
-
}
|
|
2710
|
-
};
|
|
2711
|
-
/**
|
|
2712
|
-
* 复选框 - 全选 / 全不选
|
|
2713
|
-
* @param event 选择的元素
|
|
2714
|
-
* @param bol 全选 / 全不选
|
|
2715
|
-
*/
|
|
2716
|
-
var setAllCheck = function setAllCheck(event, bol) {
|
|
2717
|
-
// 存在checkDefaultValue, {...checkJson}解决直接使用checkJson, 复选框会一闪
|
|
2718
|
-
// 不存在checkDefaultValue,内部直接记录状态
|
|
2719
|
-
var checkJsonDeep = props.checkDefaultValue !== undefined ? Object.assign({}, checkJson) : checkJson;
|
|
2720
|
-
for (var i = 0, l = rowData.length; i < l; i++) {
|
|
2721
|
-
var key = rowData[i][rowKey];
|
|
2722
|
-
if (!disabledJson[key]) {
|
|
2723
|
-
if (bol) {
|
|
2724
|
-
checkJsonDeep[key] = true;
|
|
2725
|
-
} else {
|
|
2726
|
-
if (checkJsonDeep[key]) delete checkJsonDeep[key];
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
handCheckValue(checkJsonDeep);
|
|
2731
|
-
};
|
|
2732
|
-
/**
|
|
2733
|
-
* 复选框 - 选择
|
|
2734
|
-
* @param event 选择的元素
|
|
2735
|
-
* @param bol 选 / 不选
|
|
2736
|
-
* @param key 当前行key
|
|
2737
|
-
*/
|
|
2738
|
-
var selectCheck = function selectCheck(event, bol, key) {
|
|
2739
|
-
// 存在checkDefaultValue, {...checkJson}解决直接使用checkJson, 复选框会一闪
|
|
2740
|
-
// 不存在checkDefaultValue,内部直接记录状态
|
|
2741
|
-
var checkJsonDeep = props.checkDefaultValue !== undefined ? Object.assign({}, checkJson) : checkJson;
|
|
2742
|
-
checkJsonDeep[key] = bol;
|
|
2743
|
-
if (checkJsonDeep[key] === false) delete checkJsonDeep[key]; // 确保json里面的数据都是选中的
|
|
2744
|
-
handCheckValue(checkJsonDeep);
|
|
2745
|
-
};
|
|
2746
|
-
/**
|
|
2747
|
-
* 单选 - 选择
|
|
2748
|
-
* @param event 选择的元素
|
|
2749
|
-
* @param item 当前行数据
|
|
2750
|
-
*/
|
|
2751
|
-
var selectRadio = function selectRadio(event, val) {
|
|
2752
|
-
if (setRadio) setRadio(val, totalDataJson[val]);
|
|
2753
|
-
};
|
|
2754
|
-
/**
|
|
2755
|
-
* 清空复选框选中值
|
|
2756
|
-
*/
|
|
2757
|
-
var clearCheckValue = function clearCheckValue() {
|
|
2758
|
-
if (!checkRememberPage) {
|
|
2759
|
-
setCheckJson({});
|
|
2760
|
-
handCheckValue({});
|
|
2761
|
-
}
|
|
2762
|
-
};
|
|
2763
|
-
/**
|
|
2764
|
-
* 改变选择列
|
|
2765
|
-
* @param arr {HeadDataProps[]} 当前显示列
|
|
2766
|
-
* @param item 当前点击项
|
|
2767
|
-
* @param isRest 是否重置
|
|
2768
|
-
* */
|
|
2769
|
-
var changeSelectHead = function changeSelectHead(arr, item, isRest) {
|
|
2770
|
-
handHeadDataCom(arr);
|
|
2771
|
-
setHeadDataCom(arr);
|
|
2772
|
-
var obj = {
|
|
2773
|
-
setFixed: true,
|
|
2774
|
-
headArr: arr
|
|
2775
|
-
};
|
|
2776
|
-
if (isRest) {
|
|
2777
|
-
obj.setDrag = true;
|
|
2778
|
-
obj.headDataConfig = {};
|
|
2779
|
-
}
|
|
2780
|
-
// 本地记住选择列
|
|
2781
|
-
setLocalStorageHeadCom(obj);
|
|
2782
|
-
onClickColumns && onClickColumns(arr, item);
|
|
2783
|
-
};
|
|
2784
|
-
/**
|
|
2785
|
-
* 改变显示列 bol true重置
|
|
2786
|
-
* @param headShowArr 当前显示列
|
|
2787
|
-
* @param bol 重置
|
|
2788
|
-
* @param item 当前点击项
|
|
2789
|
-
*/
|
|
2790
|
-
var changeShowList = function changeShowList(headShowArr, bol, item) {
|
|
2791
|
-
if (bol) {
|
|
2792
|
-
constData.current.headDataConfig = {};
|
|
2793
|
-
setHeadDataConfig({}); // 重置拖拽列
|
|
2794
|
-
var arr = [];
|
|
2795
|
-
var arrShow = _toConsumableArray(showHeadList);
|
|
2796
|
-
handSerial(arrShow);
|
|
2797
|
-
for (var i = 0, l = arrShow.length; i < l; i++) {
|
|
2798
|
-
var _item3 = arrShow[i];
|
|
2799
|
-
if (_item3 && _item3.selected) {
|
|
2800
|
-
// 当前显示字段
|
|
2801
|
-
arr.push(_item3);
|
|
2802
|
-
}
|
|
2803
|
-
}
|
|
2804
|
-
changeSelectHead(arr, item, true);
|
|
2805
|
-
return;
|
|
2806
|
-
}
|
|
2807
|
-
headShowArr.sort(function (a, b) {
|
|
2808
|
-
return Number(a.orderNum) - Number(b.orderNum);
|
|
2809
|
-
});
|
|
2810
|
-
var headShowArrHand = _toConsumableArray(headShowArr);
|
|
2811
|
-
changeSelectHead(headShowArrHand, item);
|
|
2812
|
-
};
|
|
2813
|
-
/**
|
|
2814
|
-
* 改变过滤
|
|
2815
|
-
*/
|
|
2816
|
-
var changeFilter = function changeFilter(val) {
|
|
2817
|
-
constData.current.selectFilterCom = DeepClone(val);
|
|
2818
|
-
setSelectFilterCom(DeepClone(val));
|
|
2819
|
-
handPage(1);
|
|
2820
|
-
};
|
|
2821
|
-
/** 改变拖拽列width */
|
|
2822
|
-
var changeColumnWidth = function changeColumnWidth(headCell, result) {
|
|
2823
|
-
var name = headCell.name || '';
|
|
2824
|
-
constData.current.headDataConfig[name] = {
|
|
2825
|
-
width: result.width
|
|
2826
|
-
};
|
|
2827
|
-
setHeadDataConfig(Object.assign({}, constData.current.headDataConfig)); // 设置表格列配置,被拖动的width
|
|
2828
|
-
handHeadDataCom(_toConsumableArray(headData)); // 重新计算表格的最小宽度
|
|
2829
|
-
// 本地记住拖动列宽度
|
|
2830
|
-
setLocalStorageHeadCom({
|
|
2831
|
-
headDataConfig: constData.current.headDataConfig,
|
|
2832
|
-
setDrag: true
|
|
2833
|
-
});
|
|
2834
|
-
};
|
|
2835
|
-
// 表格头部memo
|
|
2836
|
-
var TableHeadMemo = useMemo(function () {
|
|
2837
|
-
return jsx(TableHead$1, {
|
|
2838
|
-
orderTypeArr: orderTypeArr,
|
|
2839
|
-
orderFieldArr: orderFieldArr,
|
|
2840
|
-
sortTable: sortTable,
|
|
2841
|
-
filter: filter,
|
|
2842
|
-
expandable: expandable,
|
|
2843
|
-
check: check,
|
|
2844
|
-
selectStatus: headSelectStatus,
|
|
2845
|
-
radio: radio,
|
|
2846
|
-
align: align,
|
|
2847
|
-
showList: showHeadList,
|
|
2848
|
-
headData: headDataCom,
|
|
2849
|
-
selectFilter: selectFilterCom,
|
|
2850
|
-
operate: operate,
|
|
2851
|
-
onRequestSort: handleRequestSort,
|
|
2852
|
-
selectAll: setAllCheck,
|
|
2853
|
-
changeShowList: changeShowList,
|
|
2854
|
-
changeFilter: changeFilter,
|
|
2855
|
-
showColumns: showColumns,
|
|
2856
|
-
rowKey: rowKey,
|
|
2857
|
-
fixedTable: fixedTable,
|
|
2858
|
-
fixedColumn: fixedColumn,
|
|
2859
|
-
posFixed: posFixed,
|
|
2860
|
-
beyondText: beyondText,
|
|
2861
|
-
lineWidth: lineWidth,
|
|
2862
|
-
dragColumn: dragColumn,
|
|
2863
|
-
headDataConfig: headDataConfig,
|
|
2864
|
-
tipMaxWidth: tipMaxWidth,
|
|
2865
|
-
changeColumnWidth: changeColumnWidth,
|
|
2866
|
-
getPopupContainer: getPopupContainer
|
|
2867
|
-
});
|
|
2868
|
-
}, [totalDataJson, showColumns, rowKey, rowData, checkJson, disabledJson, orderTypeArr, orderFieldArr, sortTable, filter, expandable, check, headSelectStatus, radio, align, showHeadList, headDataCom, selectFilterCom, operate, onClickColumns, sortTableRadio, fixedTable, posFixed, beyondText, fixedColumn, lineWidth, dragColumn, headDataConfig, getPopupContainer, onSort, tipMaxWidth]);
|
|
2869
|
-
// 表格内容memo
|
|
2870
|
-
var TableBodyMemo = useMemo(function () {
|
|
2871
|
-
return jsx(TableBody, {
|
|
2872
|
-
url: url,
|
|
2873
|
-
emptyProps: emptyProps,
|
|
2874
|
-
changePage: changePageMore,
|
|
2875
|
-
loadMoreUrl: loadMoreUrl,
|
|
2876
|
-
total: total,
|
|
2877
|
-
page: pageCom,
|
|
2878
|
-
currentRowsPerPage: sizeCom,
|
|
2879
|
-
loadState: loadState,
|
|
2880
|
-
loadMore: loadMore,
|
|
2881
|
-
loadMoreRender: loadMoreRender,
|
|
2882
|
-
onClickMore: onClickMore,
|
|
2883
|
-
rowData: rowData,
|
|
2884
|
-
headData: headDataCom,
|
|
2885
|
-
expandable: expandable,
|
|
2886
|
-
check: check,
|
|
2887
|
-
radio: radio,
|
|
2888
|
-
checkJson: checkJson,
|
|
2889
|
-
radioValue: radioValue,
|
|
2890
|
-
disabledJson: disabledJson,
|
|
2891
|
-
disabledArrStatus: disabledArrStatus,
|
|
2892
|
-
align: align,
|
|
2893
|
-
tableCell: tableCell,
|
|
2894
|
-
operate: operate,
|
|
2895
|
-
showColumns: showColumns,
|
|
2896
|
-
formatter: formatter,
|
|
2897
|
-
orderTypeArr: orderTypeArr,
|
|
2898
|
-
orderFieldArr: orderFieldArr,
|
|
2899
|
-
sortTable: sortTable,
|
|
2900
|
-
selectCheck: selectCheck,
|
|
2901
|
-
selectRadio: selectRadio,
|
|
2902
|
-
rowKey: rowKey,
|
|
2903
|
-
expandMultiple: expandMultiple,
|
|
2904
|
-
expandValue: expandValue,
|
|
2905
|
-
disabledExpand: disabledExpand,
|
|
2906
|
-
onExpand: onExpand,
|
|
2907
|
-
defaultExpandAllRows: defaultExpandAllRows,
|
|
2908
|
-
onRefresh: function onRefresh() {
|
|
2909
|
-
return setRefreshCom(Math.random());
|
|
2910
|
-
},
|
|
2911
|
-
posFixed: posFixed,
|
|
2912
|
-
beyondText: beyondText,
|
|
2913
|
-
fixedColumn: fixedColumn,
|
|
2914
|
-
fixedTable: fixedTable,
|
|
2915
|
-
onClickRow: onClickRow,
|
|
2916
|
-
rowClassMapping: rowClassMapping,
|
|
2917
|
-
tipMaxWidth: tipMaxWidth
|
|
2918
|
-
});
|
|
2919
|
-
}, [showColumns, formatter, rowKey, rowData, headDataCom, expandable, check, radio, checkJson, sortTable, orderTypeArr, orderFieldArr, radioValue, disabledJson, align, tableCell, operate, setRadio, setCheck, totalDataJson, loadMore, loadMoreRender, onClickMore, total, pageCom, sizeCom, loadMoreUrl, expandValue, expandMultiple, disabledExpand, onExpand, defaultExpandAllRows, loadState, emptyProps, url, disabledArrStatus, posFixed, beyondText, fixedTable, fixedColumn, onClickRow, rowClassMapping, tipMaxWidth]);
|
|
2920
|
-
// 表格分页memo
|
|
2921
|
-
var TablePaginationMemo = useMemo(function () {
|
|
2922
|
-
if (constData.current.page === null || constData.current.size === null || loadMore) return;
|
|
2923
|
-
return pagination && jsx(TableHead, {
|
|
2924
|
-
paginationType: paginationType,
|
|
2925
|
-
flippingArrow: flippingArrow,
|
|
2926
|
-
autoPagination: autoPagination,
|
|
2927
|
-
total: total,
|
|
2928
|
-
page: pageCom,
|
|
2929
|
-
currentRowsPerPage: sizeCom,
|
|
2930
|
-
rowsPerPage: sizeArrCom,
|
|
2931
|
-
changePage: changePage,
|
|
2932
|
-
changeRowsPerPage: changeRowsPerPage
|
|
2933
|
-
});
|
|
2934
|
-
}, [total, pageCom, sizeCom, sizeArrCom, pagination, loadMore, autoPagination, paginationType, flippingArrow]);
|
|
2935
|
-
// 表格内容滚动
|
|
2936
|
-
var tableBoxScroll = function tableBoxScroll(e) {
|
|
2937
|
-
var dom = tableRef.current;
|
|
2938
|
-
var scrollDom = e.target;
|
|
2939
|
-
if (!dom || !scrollDom) return;
|
|
2940
|
-
dom.classList.remove('table-scroll-left', 'table-scroll-right', 'table-scroll-middle');
|
|
2941
|
-
if (scrollDom.scrollWidth <= scrollDom.clientWidth) return;
|
|
2942
|
-
// 最左边
|
|
2943
|
-
if (scrollDom.scrollLeft === 0) {
|
|
2944
|
-
dom.classList.add('table-scroll-left');
|
|
2945
|
-
return;
|
|
2946
|
-
}
|
|
2947
|
-
// 最右边
|
|
2948
|
-
if (scrollDom.scrollLeft + scrollDom.clientWidth === scrollDom.scrollWidth) {
|
|
2949
|
-
dom.classList.add('table-scroll-right');
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
dom.classList.add('table-scroll-middle');
|
|
2953
|
-
};
|
|
2954
|
-
// 处理class
|
|
2955
|
-
var handClass = function handClass() {
|
|
2956
|
-
var str = $prefixCls + '-table';
|
|
2957
|
-
if (showColumns === 'inside') str += " ".concat($prefixCls, "-table-columns-inside");
|
|
2958
|
-
if (pagination) str += " ".concat($prefixCls, "-table-pagination");
|
|
2959
|
-
if (loadMore) str += " ".concat($prefixCls, "-table-load-more");
|
|
2960
|
-
if (fixedTable) str += " ".concat($prefixCls, "-table-fixed-table");
|
|
2961
|
-
if (fixedColumn) str += " ".concat($prefixCls, "-table-fixed-cloumn");
|
|
2962
|
-
if (dragColumn) str += " ".concat($prefixCls, "-table-drag-column");
|
|
2963
|
-
if (check) str += " ".concat($prefixCls, "-table-check");
|
|
2964
|
-
if (radio) str += " ".concat($prefixCls, "-table-radio");
|
|
2965
|
-
if (expandable) str += " ".concat($prefixCls, "-table-expandable");
|
|
2966
|
-
if (rowData.length === 0) str += " ".concat($prefixCls, "-table-no-data");
|
|
2967
|
-
if (loadState) str += " ".concat($prefixCls, "-table-load");
|
|
2968
|
-
if (className) str += ' ' + className;
|
|
2969
|
-
return str;
|
|
2970
|
-
};
|
|
2971
|
-
// 改变屏幕大小
|
|
2972
|
-
var changeResize = function changeResize() {
|
|
2973
|
-
tableBoxScroll({
|
|
2974
|
-
target: containerRef.current
|
|
2975
|
-
});
|
|
2976
|
-
};
|
|
2977
|
-
return jsxs("div", Object.assign({
|
|
2978
|
-
className: handClass(),
|
|
2979
|
-
style: style,
|
|
2980
|
-
ref: tableRef
|
|
2981
|
-
}, {
|
|
2982
|
-
children: [jsx(TableContainer, Object.assign({
|
|
2983
|
-
className: "table-contain",
|
|
2984
|
-
cRef: containerRef,
|
|
2985
|
-
onScroll: tableBoxScroll
|
|
2986
|
-
}, {
|
|
2987
|
-
children: jsxs(TableElement, Object.assign({
|
|
2988
|
-
fixedColumn: fixedColumn,
|
|
2989
|
-
style: {
|
|
2990
|
-
minWidth: tableMinWidth + 'px'
|
|
2991
|
-
}
|
|
2992
|
-
}, {
|
|
2993
|
-
children: [TableHeadMemo, TableBodyMemo]
|
|
2994
|
-
}))
|
|
2995
|
-
})), loadState && jsx(Loading, {}), TablePaginationMemo]
|
|
2996
|
-
}));
|
|
2997
|
-
};
|
|
2998
|
-
|
|
2999
|
-
export { Table as default };
|