@aloudata/aloudata-design 0.4.0-beta.10 → 0.4.0-beta.12
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/es/Avatar/component/Avatar/index.d.ts +1 -1
- package/es/Avatar/component/Avatar/index.js +12 -16
- package/es/Breadcrumb/index.js +14 -18
- package/es/Button/index.d.ts +2 -2
- package/es/Button/index.js +16 -39
- package/es/Button/style/index.less +1 -1
- package/es/Checkbox/component/CheckboxGroup/index.d.ts +0 -1
- package/es/Checkbox/component/CheckboxGroup/index.js +11 -11
- package/es/Checkbox/index.js +8 -8
- package/es/Checkbox/type.d.ts +1 -1
- package/es/Checkbox/type.js +0 -1
- package/es/ConfigProvider/defaultRenderEmpty.d.ts +2 -2
- package/es/ConfigProvider/defaultRenderEmpty.js +0 -6
- package/es/ConfigProvider/sizeContext.d.ts +2 -2
- package/es/ConfigProvider/sizeContext.js +1 -1
- package/es/Divider/index.js +7 -3
- package/es/Dropdown/Button.d.ts +1 -1
- package/es/Dropdown/Button.js +16 -14
- package/es/Dropdown/index.d.ts +3 -3
- package/es/Dropdown/index.js +10 -10
- package/es/Empty/image/Authority.d.ts +0 -1
- package/es/Empty/image/Authority.js +0 -2
- package/es/Empty/image/Dataspace.d.ts +0 -1
- package/es/Empty/image/Dataspace.js +0 -2
- package/es/Empty/image/Search.d.ts +0 -1
- package/es/Empty/image/Search.js +0 -2
- package/es/Empty/image/Simple.d.ts +0 -1
- package/es/Empty/image/Simple.js +0 -2
- package/es/Empty/image/Worksheet.d.ts +0 -1
- package/es/Empty/image/Worksheet.js +0 -2
- package/es/Empty/image/empty.d.ts +0 -1
- package/es/Empty/image/empty.js +0 -2
- package/es/Empty/index.d.ts +1 -1
- package/es/Empty/index.js +16 -24
- package/es/Icon/components/Icon.js +14 -12
- package/es/Icon/components/createFromScripts.js +2 -8
- package/es/Icon/icons/AddLine.js +17 -23
- package/es/Icon/icons/AlertFill.js +17 -23
- package/es/Icon/icons/ArrowsDownLine.js +17 -23
- package/es/Icon/icons/CancelFill.js +17 -23
- package/es/Icon/icons/CheckFill.js +17 -23
- package/es/Icon/icons/CheckLine.js +17 -23
- package/es/Icon/icons/CloseLine.js +17 -23
- package/es/Icon/icons/DatabaseLine.js +17 -23
- package/es/Icon/icons/Deleteline.js +17 -23
- package/es/Icon/icons/DownloadLine.js +17 -23
- package/es/Icon/icons/ErrorFill.js +17 -23
- package/es/Icon/icons/EyeOffLine.js +17 -23
- package/es/Icon/icons/EyeOnLine.js +17 -23
- package/es/Icon/icons/FileLine.js +17 -23
- package/es/Icon/icons/HomeFill.js +17 -23
- package/es/Icon/icons/LightningLine.js +17 -23
- package/es/Icon/icons/Loading.js +17 -23
- package/es/Icon/icons/More.js +17 -23
- package/es/Icon/icons/NewWindowsLine.js +17 -23
- package/es/Icon/icons/SearchLine.js +17 -23
- package/es/Icon/icons/SortAscendingLine.js +17 -23
- package/es/Icon/icons/SortDescendingLine.js +17 -23
- package/es/Icon/icons/TextLine.js +17 -23
- package/es/Icon/icons/UserLine.js +17 -23
- package/es/Icon/icons.js +1658 -1588
- package/es/Input/components/Group/index.js +11 -9
- package/es/Input/components/Input/index.d.ts +2 -2
- package/es/Input/components/Input/index.js +10 -9
- package/es/Input/components/Password/index.js +14 -12
- package/es/Input/components/TextArea/index.js +13 -11
- package/es/InputNumber/index.js +10 -12
- package/es/Menu/Divider.js +7 -1
- package/es/Menu/MenuItem.js +7 -1
- package/es/Menu/SubMenu.js +8 -6
- package/es/Menu/index.d.ts +1 -1
- package/es/Menu/index.js +8 -6
- package/es/Modal/index.d.ts +1 -1
- package/es/Modal/index.js +18 -28
- package/es/Modal/locale.js +4 -6
- package/es/Modal/style/index.less +6 -1
- package/es/Navigator/components/Header/index.js +0 -2
- package/es/Navigator/components/Menu/index.js +14 -18
- package/es/Navigator/components/MenuItem/index.js +6 -9
- package/es/Navigator/index.js +5 -7
- package/es/Popconfirm/index.d.ts +89 -2
- package/es/Popconfirm/index.js +105 -1
- package/es/Popconfirm/style/index.less +58 -0
- package/es/Popover/index.js +9 -9
- package/es/Radio/components/Group/index.d.ts +1 -1
- package/es/Radio/components/Group/index.js +23 -32
- package/es/Radio/components/Radio/index.js +10 -19
- package/es/Radio/interface/radioGroup.d.ts +3 -3
- package/es/Select/index.d.ts +4 -4
- package/es/Select/index.js +53 -70
- package/es/Select/rc-select/BaseSelect.d.ts +7 -7
- package/es/Select/rc-select/BaseSelect.js +155 -245
- package/es/Select/rc-select/OptGroup.js +0 -1
- package/es/Select/rc-select/Option.js +0 -1
- package/es/Select/rc-select/OptionList.d.ts +2 -2
- package/es/Select/rc-select/OptionList.js +76 -128
- package/es/Select/rc-select/Select.d.ts +8 -8
- package/es/Select/rc-select/Select.js +137 -205
- package/es/Select/rc-select/SelectTrigger.js +30 -42
- package/es/Select/rc-select/Selector/Input.d.ts +1 -1
- package/es/Select/rc-select/Selector/Input.js +29 -37
- package/es/Select/rc-select/Selector/MultipleSelector.js +72 -97
- package/es/Select/rc-select/Selector/SingleSelector.js +28 -43
- package/es/Select/rc-select/Selector/index.js +33 -58
- package/es/Select/rc-select/TransBtn.js +5 -10
- package/es/Select/rc-select/hooks/useBaseProps.js +0 -1
- package/es/Select/rc-select/hooks/useCache.d.ts +1 -1
- package/es/Select/rc-select/hooks/useCache.js +9 -12
- package/es/Select/rc-select/hooks/useDelayReset.js +4 -18
- package/es/Select/rc-select/hooks/useFilterOptions.d.ts +1 -1
- package/es/Select/rc-select/hooks/useFilterOptions.js +8 -17
- package/es/Select/rc-select/hooks/useId.js +6 -17
- package/es/Select/rc-select/hooks/useLayoutEffect.js +0 -1
- package/es/Select/rc-select/hooks/useLock.js +2 -6
- package/es/Select/rc-select/hooks/useOptions.d.ts +2 -2
- package/es/Select/rc-select/hooks/useOptions.js +2 -10
- package/es/Select/rc-select/hooks/useRefFunc.js +0 -1
- package/es/Select/rc-select/hooks/useSelectTriggerControl.js +0 -5
- package/es/Select/rc-select/utils/commonUtil.js +0 -2
- package/es/Select/rc-select/utils/keyUtil.js +4 -3
- package/es/Select/rc-select/utils/legacyUtil.js +13 -22
- package/es/Select/rc-select/utils/valueUtil.js +18 -50
- package/es/Select/rc-select/utils/warningPropsUtil.js +30 -47
- package/es/Select/style/index.js +2 -1
- package/es/Select/style/status.less +3 -1
- package/es/Select/utils/iconUtil.d.ts +3 -3
- package/es/Select/utils/iconUtil.js +16 -26
- package/es/Space/index.js +1 -1
- package/es/Spin/index.d.ts +2 -2
- package/es/Steps/components/Step/index.d.ts +1 -1
- package/es/Steps/components/Step/index.js +9 -8
- package/es/Steps/index.d.ts +8 -2
- package/es/Steps/index.js +64 -10
- package/es/Steps/style/index.less +11 -12
- package/es/Switch/index.js +17 -30
- package/es/Table/Table.js +115 -191
- package/es/Table/components/Empty/index.js +0 -2
- package/es/Table/components/Loading/index.js +0 -2
- package/es/Table/components/TableBodyRowList/index.js +20 -39
- package/es/Table/components/TableHead/index.js +57 -94
- package/es/Table/interface.d.ts +1 -1
- package/es/Table/style/index.less +8 -4
- package/es/Table/utils.js +8 -29
- package/es/Tabs/index.d.ts +22 -7
- package/es/Tabs/index.js +12 -19
- package/es/Tooltip/index.d.ts +1 -1
- package/es/Tooltip/index.js +12 -12
- package/es/_utils/hooks/useControlledState.d.ts +1 -1
- package/es/_utils/hooks/useControlledState.js +8 -21
- package/es/_utils/hooks/useId.js +2 -6
- package/es/_utils/hooks/usePrefixCls.d.ts +1 -1
- package/es/_utils/hooks/usePrefixCls.js +2 -5
- package/es/index.d.ts +1 -1
- package/es/locale-provider/context.d.ts +1 -1
- package/es/locale-provider/index.js +10 -32
- package/lib/Alert/index.js +0 -4
- package/lib/Alert/style/index.js +0 -1
- package/lib/Avatar/component/Avatar/index.d.ts +1 -1
- package/lib/Avatar/component/Avatar/index.js +11 -24
- package/lib/Avatar/index.js +0 -4
- package/lib/Avatar/style/index.js +0 -1
- package/lib/Breadcrumb/index.js +14 -23
- package/lib/Breadcrumb/style/index.js +0 -1
- package/lib/Button/index.d.ts +2 -2
- package/lib/Button/index.js +16 -47
- package/lib/Button/style/index.js +0 -1
- package/lib/Button/style/index.less +1 -1
- package/lib/Card/index.js +0 -4
- package/lib/Card/style/index.js +0 -1
- package/lib/Checkbox/component/CheckboxGroup/index.d.ts +0 -1
- package/lib/Checkbox/component/CheckboxGroup/index.js +9 -16
- package/lib/Checkbox/index.js +8 -14
- package/lib/Checkbox/style/index.js +0 -1
- package/lib/Checkbox/type.d.ts +1 -1
- package/lib/Checkbox/type.js +0 -1
- package/lib/Col/index.js +0 -4
- package/lib/Col/style/index.js +0 -1
- package/lib/ConfigProvider/defaultRenderEmpty.d.ts +2 -2
- package/lib/ConfigProvider/defaultRenderEmpty.js +0 -13
- package/lib/ConfigProvider/index.js +0 -5
- package/lib/ConfigProvider/sizeContext.d.ts +2 -2
- package/lib/ConfigProvider/sizeContext.js +1 -8
- package/lib/ConfigProvider/style/index.js +0 -1
- package/lib/DatePicker/index.js +0 -4
- package/lib/DatePicker/style/index.js +0 -1
- package/lib/Divider/index.js +7 -8
- package/lib/Divider/style/index.js +0 -1
- package/lib/Drawer/index.js +0 -4
- package/lib/Drawer/style/index.js +0 -1
- package/lib/Dropdown/Button.d.ts +1 -1
- package/lib/Dropdown/Button.js +14 -20
- package/lib/Dropdown/index.d.ts +3 -3
- package/lib/Dropdown/index.js +10 -17
- package/lib/Dropdown/style/index.js +0 -2
- package/lib/Empty/image/Authority.d.ts +0 -1
- package/lib/Empty/image/Authority.js +0 -6
- package/lib/Empty/image/Dataspace.d.ts +0 -1
- package/lib/Empty/image/Dataspace.js +0 -6
- package/lib/Empty/image/Search.d.ts +0 -1
- package/lib/Empty/image/Search.js +0 -6
- package/lib/Empty/image/Simple.d.ts +0 -1
- package/lib/Empty/image/Simple.js +0 -6
- package/lib/Empty/image/Worksheet.d.ts +0 -1
- package/lib/Empty/image/Worksheet.js +0 -6
- package/lib/Empty/image/empty.d.ts +0 -1
- package/lib/Empty/image/empty.js +0 -6
- package/lib/Empty/index.d.ts +1 -1
- package/lib/Empty/index.js +15 -37
- package/lib/Form/index.js +0 -4
- package/lib/Form/style/index.js +0 -1
- package/lib/Icon/antdIconfont.js +0 -1
- package/lib/Icon/components/Icon.js +14 -16
- package/lib/Icon/components/createFromScripts.js +2 -8
- package/lib/Icon/icons/AddLine.js +16 -30
- package/lib/Icon/icons/AlertFill.js +16 -30
- package/lib/Icon/icons/ArrowsDownLine.js +16 -30
- package/lib/Icon/icons/CancelFill.js +16 -30
- package/lib/Icon/icons/CheckFill.js +16 -30
- package/lib/Icon/icons/CheckLine.js +16 -30
- package/lib/Icon/icons/CloseLine.js +16 -30
- package/lib/Icon/icons/DatabaseLine.js +16 -30
- package/lib/Icon/icons/Deleteline.js +16 -30
- package/lib/Icon/icons/DownloadLine.js +16 -30
- package/lib/Icon/icons/ErrorFill.js +16 -30
- package/lib/Icon/icons/EyeOffLine.js +16 -30
- package/lib/Icon/icons/EyeOnLine.js +16 -30
- package/lib/Icon/icons/FileLine.js +16 -30
- package/lib/Icon/icons/HomeFill.js +16 -30
- package/lib/Icon/icons/LightningLine.js +16 -30
- package/lib/Icon/icons/Loading.js +16 -30
- package/lib/Icon/icons/More.js +16 -30
- package/lib/Icon/icons/NewWindowsLine.js +16 -30
- package/lib/Icon/icons/SearchLine.js +16 -30
- package/lib/Icon/icons/SortAscendingLine.js +16 -30
- package/lib/Icon/icons/SortDescendingLine.js +16 -30
- package/lib/Icon/icons/TextLine.js +16 -30
- package/lib/Icon/icons/UserLine.js +16 -30
- package/lib/Icon/icons.js +1658 -1588
- package/lib/Icon/index.js +0 -3
- package/lib/Input/components/Group/index.js +11 -16
- package/lib/Input/components/Input/index.d.ts +2 -2
- package/lib/Input/components/Input/index.js +10 -16
- package/lib/Input/components/Password/index.js +12 -21
- package/lib/Input/components/TextArea/index.js +13 -18
- package/lib/Input/index.js +0 -6
- package/lib/Input/style/index.js +0 -2
- package/lib/InputNumber/index.js +10 -18
- package/lib/InputNumber/style/index.js +0 -1
- package/lib/Layout/index.js +0 -4
- package/lib/Layout/style/index.js +0 -1
- package/lib/Menu/Divider.js +7 -7
- package/lib/Menu/MenuItem.js +7 -7
- package/lib/Menu/SubMenu.js +8 -13
- package/lib/Menu/index.d.ts +1 -1
- package/lib/Menu/index.js +8 -16
- package/lib/Menu/style/index.js +0 -2
- package/lib/Modal/index.d.ts +1 -1
- package/lib/Modal/index.js +17 -45
- package/lib/Modal/locale.js +4 -9
- package/lib/Modal/style/index.js +0 -1
- package/lib/Modal/style/index.less +6 -1
- package/lib/Navigator/components/Header/index.js +0 -4
- package/lib/Navigator/components/Menu/index.js +13 -24
- package/lib/Navigator/components/MenuItem/index.js +6 -15
- package/lib/Navigator/index.js +5 -15
- package/lib/Navigator/style/index.js +0 -1
- package/lib/PageHeader/index.js +0 -4
- package/lib/PageHeader/style/index.js +0 -1
- package/lib/Popconfirm/index.d.ts +89 -2
- package/lib/Popconfirm/index.js +106 -5
- package/lib/Popconfirm/style/index.js +0 -1
- package/lib/Popconfirm/style/index.less +58 -0
- package/lib/Popover/index.js +9 -14
- package/lib/Popover/style/index.js +0 -1
- package/lib/Progress/index.js +0 -3
- package/lib/Progress/style/index.js +0 -1
- package/lib/Radio/components/Group/index.d.ts +1 -1
- package/lib/Radio/components/Group/index.js +22 -41
- package/lib/Radio/components/Radio/index.js +10 -30
- package/lib/Radio/index.js +0 -4
- package/lib/Radio/interface/radioGroup.d.ts +3 -3
- package/lib/Radio/style/index.js +0 -1
- package/lib/Row/index.js +0 -4
- package/lib/Row/style/index.js +0 -1
- package/lib/Select/index.d.ts +4 -4
- package/lib/Select/index.js +52 -87
- package/lib/Select/rc-select/BaseSelect.d.ts +7 -7
- package/lib/Select/rc-select/BaseSelect.js +155 -266
- package/lib/Select/rc-select/OptGroup.js +0 -2
- package/lib/Select/rc-select/Option.js +0 -2
- package/lib/Select/rc-select/OptionList.d.ts +2 -2
- package/lib/Select/rc-select/OptionList.js +75 -146
- package/lib/Select/rc-select/Select.d.ts +8 -8
- package/lib/Select/rc-select/Select.js +137 -224
- package/lib/Select/rc-select/SelectContext.js +1 -5
- package/lib/Select/rc-select/SelectTrigger.js +29 -49
- package/lib/Select/rc-select/Selector/Input.d.ts +1 -1
- package/lib/Select/rc-select/Selector/Input.js +29 -46
- package/lib/Select/rc-select/Selector/MultipleSelector.js +71 -109
- package/lib/Select/rc-select/Selector/SingleSelector.js +28 -50
- package/lib/Select/rc-select/Selector/index.js +32 -67
- package/lib/Select/rc-select/TransBtn.js +5 -16
- package/lib/Select/rc-select/hooks/useBaseProps.js +1 -7
- package/lib/Select/rc-select/hooks/useCache.d.ts +1 -1
- package/lib/Select/rc-select/hooks/useCache.js +9 -18
- package/lib/Select/rc-select/hooks/useDelayReset.js +4 -22
- package/lib/Select/rc-select/hooks/useFilterOptions.d.ts +1 -1
- package/lib/Select/rc-select/hooks/useFilterOptions.js +8 -25
- package/lib/Select/rc-select/hooks/useId.js +6 -26
- package/lib/Select/rc-select/hooks/useLayoutEffect.js +0 -6
- package/lib/Select/rc-select/hooks/useLock.js +2 -10
- package/lib/Select/rc-select/hooks/useOptions.d.ts +2 -2
- package/lib/Select/rc-select/hooks/useOptions.js +2 -15
- package/lib/Select/rc-select/hooks/useRefFunc.js +0 -5
- package/lib/Select/rc-select/hooks/useSelectTriggerControl.js +1 -10
- package/lib/Select/rc-select/index.js +0 -7
- package/lib/Select/rc-select/utils/commonUtil.js +0 -4
- package/lib/Select/rc-select/utils/keyUtil.js +4 -5
- package/lib/Select/rc-select/utils/legacyUtil.js +12 -28
- package/lib/Select/rc-select/utils/platformUtil.js +0 -1
- package/lib/Select/rc-select/utils/valueUtil.js +18 -55
- package/lib/Select/rc-select/utils/warningPropsUtil.js +30 -56
- package/lib/Select/style/index.js +0 -2
- package/lib/Select/style/status.less +3 -1
- package/lib/Select/utils/iconUtil.d.ts +3 -3
- package/lib/Select/utils/iconUtil.js +16 -39
- package/lib/Skeleton/index.js +0 -3
- package/lib/Skeleton/style/index.js +0 -1
- package/lib/Space/index.js +2 -9
- package/lib/Space/style/index.js +0 -1
- package/lib/Spin/index.d.ts +2 -2
- package/lib/Spin/index.js +0 -3
- package/lib/Spin/style/index.js +0 -1
- package/lib/Steps/components/ProcessIcon/index.js +0 -4
- package/lib/Steps/components/Step/index.d.ts +1 -1
- package/lib/Steps/components/Step/index.js +9 -18
- package/lib/Steps/index.d.ts +8 -2
- package/lib/Steps/index.js +63 -17
- package/lib/Steps/style/index.js +0 -1
- package/lib/Steps/style/index.less +11 -12
- package/lib/Switch/index.js +17 -37
- package/lib/Switch/style/index.js +0 -1
- package/lib/Table/Table.js +117 -216
- package/lib/Table/components/Empty/index.js +0 -6
- package/lib/Table/components/Loading/index.js +0 -7
- package/lib/Table/components/TableBodyRowList/index.js +19 -47
- package/lib/Table/components/TableHead/index.js +56 -108
- package/lib/Table/index.js +0 -3
- package/lib/Table/interface.d.ts +1 -1
- package/lib/Table/style/index.js +0 -1
- package/lib/Table/style/index.less +8 -4
- package/lib/Table/utils.js +8 -33
- package/lib/Tabs/index.d.ts +22 -7
- package/lib/Tabs/index.js +10 -28
- package/lib/Tabs/style/index.js +0 -2
- package/lib/Tooltip/index.d.ts +1 -1
- package/lib/Tooltip/index.js +12 -17
- package/lib/Tooltip/style/index.js +0 -1
- package/lib/Tree/index.js +0 -3
- package/lib/Tree/style/index.js +0 -1
- package/lib/Typography/index.js +0 -4
- package/lib/Typography/style/index.js +0 -1
- package/lib/Upload/index.js +0 -4
- package/lib/Upload/style/index.js +0 -1
- package/lib/_utils/hooks/useControlledState.d.ts +1 -1
- package/lib/_utils/hooks/useControlledState.js +8 -23
- package/lib/_utils/hooks/useId.js +3 -10
- package/lib/_utils/hooks/usePrefixCls.d.ts +1 -1
- package/lib/_utils/hooks/usePrefixCls.js +2 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -42
- package/lib/locale/default.js +0 -3
- package/lib/locale/en_US.js +1 -6
- package/lib/locale/zh_CN.js +1 -6
- package/lib/locale-provider/LocaleReceiver.js +0 -5
- package/lib/locale-provider/context.d.ts +1 -1
- package/lib/locale-provider/context.js +0 -2
- package/lib/locale-provider/default.js +0 -3
- package/lib/locale-provider/en_US.js +0 -3
- package/lib/locale-provider/index.js +8 -37
- package/lib/locale-provider/zh_CN.js +0 -3
- package/lib/message/index.js +0 -4
- package/lib/message/style/index.js +0 -1
- package/lib/notification/index.js +0 -4
- package/lib/notification/style/index.js +0 -1
- package/package.json +4 -3
- package/es/Table/hooks/useFrame.d.ts +0 -7
- package/es/Table/hooks/useFrame.js +0 -90
- package/es/Tabs/TabPane.d.ts +0 -21
- package/es/Tabs/TabPane.js +0 -6
- package/lib/Table/hooks/useFrame.d.ts +0 -7
- package/lib/Table/hooks/useFrame.js +0 -98
- package/lib/Tabs/TabPane.d.ts +0 -21
- package/lib/Tabs/TabPane.js +0 -18
package/es/Table/Table.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
|
|
9
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
|
|
13
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
-
|
|
15
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
-
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
17
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
|
|
19
13
|
/* eslint-disable no-unneeded-ternary */
|
|
20
14
|
/// <reference types ='./react-table-config' />
|
|
21
15
|
import classnames from 'classnames';
|
|
@@ -30,95 +24,86 @@ import Loading from './components/Loading';
|
|
|
30
24
|
import Empty from './components/Empty';
|
|
31
25
|
import TableHead from './components/TableHead';
|
|
32
26
|
import TableBodyRowList from './components/TableBodyRowList';
|
|
33
|
-
import { useTimeoutLock } from './hooks/useFrame';
|
|
34
27
|
var tableHeadRowHeight = 44;
|
|
35
|
-
var SCROLLBAR_SIZE = 15;
|
|
36
28
|
var ZERO = 0;
|
|
37
|
-
|
|
38
29
|
function Table(props, ref) {
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
height = props.height;
|
|
64
|
-
|
|
30
|
+
var _classnames2;
|
|
31
|
+
var outerKey = props.key,
|
|
32
|
+
columns = props.columns,
|
|
33
|
+
data = props.data,
|
|
34
|
+
onRowSelected = props.onRowSelected,
|
|
35
|
+
loadMore = props.loadMore,
|
|
36
|
+
loading = props.loading,
|
|
37
|
+
hasNextPage = props.hasNextPage,
|
|
38
|
+
_props$sortable = props.sortable,
|
|
39
|
+
sortable = _props$sortable === void 0 ? false : _props$sortable,
|
|
40
|
+
defaultSort = props.defaultSort,
|
|
41
|
+
_props$resizeColumn = props.resizeColumn,
|
|
42
|
+
resizeColumn = _props$resizeColumn === void 0 ? false : _props$resizeColumn,
|
|
43
|
+
allSortDirections = props.sortDirections,
|
|
44
|
+
_props$onChange = props.onChange,
|
|
45
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
46
|
+
_props$scrollThreshol = props.scrollThreshold,
|
|
47
|
+
scrollThreshold = _props$scrollThreshol === void 0 ? '150px' : _props$scrollThreshol,
|
|
48
|
+
_props$rowClassName = props.rowClassName,
|
|
49
|
+
rowClassName = _props$rowClassName === void 0 ? '' : _props$rowClassName,
|
|
50
|
+
_props$ellipsis = props.ellipsis,
|
|
51
|
+
ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
|
|
52
|
+
rowKey = props.rowKey,
|
|
53
|
+
height = props.height;
|
|
65
54
|
var _useState = useState(undefined),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
tableClientWidth = _useState2[0],
|
|
57
|
+
setTableClientWidth = _useState2[1];
|
|
70
58
|
var _useState3 = useState(undefined),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
tableClientHeight = _useState4[0],
|
|
61
|
+
setTableClientHeight = _useState4[1];
|
|
75
62
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
76
63
|
var tableRef = useRef(null);
|
|
77
|
-
var tableHeadRef = useRef(null);
|
|
78
64
|
var tableBodyRef = useRef(null);
|
|
79
65
|
var columnsWidthMapRef = useRef();
|
|
80
66
|
var columnsTotalWidthRef = useRef(ZERO);
|
|
81
|
-
|
|
82
67
|
var _useState5 = useState(false),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var lastOffsetLeftRef = useRef(ZERO);
|
|
68
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
69
|
+
loadMoreLoading = _useState6[0],
|
|
70
|
+
setLoadMoreLoading = _useState6[1];
|
|
88
71
|
var lastOffsetTopRef = useRef(ZERO);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
var _useState7 = useState(ZERO),
|
|
73
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
74
|
+
tableBodyContentHeight = _useState8[0],
|
|
75
|
+
setTableBodyContentHeight = _useState8[1];
|
|
76
|
+
// 如果列长度存在变化时,触发重新计算页面的宽度,否则需要用户手动更改key
|
|
77
|
+
var tableKey = useMemo(function () {
|
|
78
|
+
var columnLength = (columns === null || columns === void 0 ? void 0 : columns.length) || ZERO;
|
|
79
|
+
if (outerKey) {
|
|
80
|
+
return "".concat(outerKey, "-").concat(columnLength);
|
|
81
|
+
}
|
|
82
|
+
return "".concat(columnLength);
|
|
83
|
+
}, [columns === null || columns === void 0 ? void 0 : columns.length, outerKey]);
|
|
84
|
+
// 初始化进入时 渲染表格容器宽度
|
|
96
85
|
useEffect(function () {
|
|
97
86
|
if (tableRef.current) {
|
|
98
87
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
99
88
|
}
|
|
100
|
-
}, []);
|
|
101
|
-
|
|
89
|
+
}, []);
|
|
90
|
+
// 转换外部传入的columns
|
|
102
91
|
var newColumns = useMemo(function () {
|
|
103
92
|
if (!tableClientWidth) {
|
|
104
93
|
return [];
|
|
105
94
|
}
|
|
106
|
-
|
|
107
95
|
var _getColumnsWidthMap = getColumnsWidthMap(columns, tableClientWidth, columnsWidthMapRef.current),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
97
|
+
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
111
98
|
columnsWidthMapRef.current = columnsWidthMap;
|
|
112
99
|
columnsTotalWidthRef.current = totalColumnWidth;
|
|
113
100
|
return columns.map(function (column, index) {
|
|
114
101
|
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
var key = index.toString();
|
|
103
|
+
// 不设置dataIndex同时进行排序 则报错
|
|
118
104
|
if (column.dataIndex === undefined && sortable) {
|
|
119
105
|
message.error('不支持未设置dataIndex时进行排序设置');
|
|
120
106
|
}
|
|
121
|
-
|
|
122
107
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
123
108
|
width: (_columnsWidthMapRef$c = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c === void 0 ? void 0 : (_columnsWidthMapRef$c2 = _columnsWidthMapRef$c.get(key)) === null || _columnsWidthMapRef$c2 === void 0 ? void 0 : _columnsWidthMapRef$c2.width,
|
|
124
109
|
Header: column.title ? column.title : function () {
|
|
@@ -128,25 +113,23 @@ function Table(props, ref) {
|
|
|
128
113
|
accessor: column.dataIndex,
|
|
129
114
|
Cell: function Cell(_ref) {
|
|
130
115
|
var row = _ref.row,
|
|
131
|
-
|
|
116
|
+
value = _ref.value;
|
|
132
117
|
return typeof column.render === 'function' ? column.render(value, row.original, row.index) : value;
|
|
133
118
|
}
|
|
134
119
|
});
|
|
135
120
|
});
|
|
136
|
-
}, [columns, sortable, tableClientWidth]);
|
|
121
|
+
}, [columns, sortable, tableClientWidth]);
|
|
122
|
+
// 将rowId转为React Table支持的值
|
|
137
123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
138
|
-
|
|
139
124
|
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
140
125
|
if (rowKey && parent) {
|
|
141
126
|
if (typeof rowKey === 'string') {
|
|
142
127
|
return [rowKey, relativeIndex].join('.');
|
|
143
128
|
}
|
|
144
|
-
|
|
145
129
|
if (typeof rowKey === 'function') {
|
|
146
130
|
return [rowKey(row), relativeIndex].join('.');
|
|
147
131
|
}
|
|
148
132
|
}
|
|
149
|
-
|
|
150
133
|
return relativeIndex.toString();
|
|
151
134
|
};
|
|
152
135
|
/**
|
|
@@ -156,56 +139,45 @@ function Table(props, ref) {
|
|
|
156
139
|
* 3. 如果给了排序但没有默认,则按第一行排序
|
|
157
140
|
* @returns
|
|
158
141
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
142
|
var getTableInitSort = function getTableInitSort() {
|
|
162
143
|
var EMPTY_SIZE = 0;
|
|
163
|
-
|
|
164
144
|
if (!sortable || loadMore || newColumns.length === EMPTY_SIZE) {
|
|
165
145
|
return [];
|
|
166
146
|
}
|
|
167
|
-
|
|
168
147
|
if (defaultSort && defaultSort.id) {
|
|
169
148
|
return [defaultSort];
|
|
170
149
|
}
|
|
171
|
-
|
|
172
150
|
var firstColumnSortData = {
|
|
173
151
|
id: newColumns[ZERO].accessor,
|
|
174
152
|
desc: !!(newColumns[ZERO].sortOrder && newColumns[ZERO].sortOrder === 'descend')
|
|
175
153
|
};
|
|
176
|
-
|
|
177
154
|
if (firstColumnSortData.id) {
|
|
178
155
|
return [firstColumnSortData];
|
|
179
156
|
}
|
|
180
|
-
|
|
181
157
|
return [];
|
|
182
158
|
};
|
|
183
|
-
|
|
184
159
|
var _useTable = useTable({
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
160
|
+
columns: newColumns,
|
|
161
|
+
data: data,
|
|
162
|
+
disableMultiSort: true,
|
|
163
|
+
disableSortBy: !sortable,
|
|
164
|
+
getRowId: transformRowId,
|
|
165
|
+
initialState: {
|
|
166
|
+
sortBy: getTableInitSort()
|
|
167
|
+
}
|
|
168
|
+
}, useBlockLayout, useSortBy, useRowSelect, useResizeColumns),
|
|
169
|
+
getTableProps = _useTable.getTableProps,
|
|
170
|
+
getTableBodyProps = _useTable.getTableBodyProps,
|
|
171
|
+
headerGroups = _useTable.headerGroups,
|
|
172
|
+
rows = _useTable.rows,
|
|
173
|
+
prepareRow = _useTable.prepareRow,
|
|
174
|
+
setSortBy = _useTable.setSortBy;
|
|
201
175
|
var scrollToTop = function scrollToTop() {
|
|
202
176
|
var INITIAL_OFFSET_TOP = 0;
|
|
203
|
-
|
|
204
177
|
if (tableBodyRef && tableBodyRef.current) {
|
|
205
178
|
tableBodyRef.current.scrollTop = INITIAL_OFFSET_TOP;
|
|
206
179
|
}
|
|
207
180
|
};
|
|
208
|
-
|
|
209
181
|
React.useImperativeHandle(ref, function () {
|
|
210
182
|
return {
|
|
211
183
|
backToTop: function backToTop() {
|
|
@@ -216,7 +188,6 @@ function Table(props, ref) {
|
|
|
216
188
|
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
217
189
|
canResizeColumn: resizeColumn,
|
|
218
190
|
headerGroups: headerGroups,
|
|
219
|
-
// tableContentWidth={columnsTotalWidthRef.current}
|
|
220
191
|
defaultSort: defaultSort,
|
|
221
192
|
sortable: sortable,
|
|
222
193
|
columns: newColumns,
|
|
@@ -234,138 +205,92 @@ function Table(props, ref) {
|
|
|
234
205
|
rowClassName: rowClassName,
|
|
235
206
|
ellipsis: ellipsis,
|
|
236
207
|
onRowSelected: onRowSelected
|
|
237
|
-
});
|
|
238
|
-
|
|
208
|
+
});
|
|
209
|
+
// 渲染没有设置高度的表格
|
|
239
210
|
var renderTableWithoutHeight = function renderTableWithoutHeight() {
|
|
240
211
|
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
241
212
|
if (loading && !rows.length) {
|
|
242
213
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
243
214
|
}
|
|
244
|
-
|
|
245
215
|
if (!loading && !rows.length) {
|
|
246
216
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
247
217
|
}
|
|
248
|
-
|
|
249
218
|
return /*#__PURE__*/React.createElement("div", {
|
|
250
219
|
className: "".concat(prefixCls, "-list")
|
|
251
220
|
}, tableRowListNode);
|
|
252
221
|
};
|
|
253
|
-
|
|
254
222
|
return /*#__PURE__*/React.createElement("div", {
|
|
255
223
|
className: classnames("".concat(prefixCls, "-inner-wrap"))
|
|
256
|
-
}, tableHeadNode, /*#__PURE__*/React.createElement("div",
|
|
224
|
+
}, tableHeadNode, /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableBodyProps()), {}, {
|
|
257
225
|
className: classnames("".concat(prefixCls, "-tbody")),
|
|
258
226
|
style: {
|
|
259
227
|
width: columnsTotalWidthRef.current
|
|
260
228
|
}
|
|
261
229
|
}), renderNoHeightTableBody()));
|
|
262
230
|
};
|
|
263
|
-
|
|
264
|
-
var
|
|
265
|
-
if (!
|
|
231
|
+
// 存在高度时,内部的纵向的滚动
|
|
232
|
+
var onBodyVerticalScroll = useCallback(function (e) {
|
|
233
|
+
if (!tableClientHeight) {
|
|
266
234
|
return;
|
|
267
235
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
target
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
}, []); // 内部滚动时 纵向的滚动
|
|
276
|
-
|
|
277
|
-
var onBodyVerticalScroll = useCallback(function (target) {
|
|
278
|
-
if (!tableClientHeight) {
|
|
236
|
+
var _e$target = e.target,
|
|
237
|
+
scrollHeight = _e$target.scrollHeight,
|
|
238
|
+
clientHeight = _e$target.clientHeight,
|
|
239
|
+
currentTargetScrollTop = _e$target.scrollTop;
|
|
240
|
+
// 说明是横向滚动
|
|
241
|
+
if (lastOffsetTopRef.current === currentTargetScrollTop) {
|
|
279
242
|
return;
|
|
280
243
|
}
|
|
281
|
-
|
|
282
|
-
var scrollHeight = target.scrollHeight,
|
|
283
|
-
clientHeight = target.clientHeight,
|
|
284
|
-
scrollTop = target.scrollTop;
|
|
285
|
-
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop; // 当前滚动条到底部的距离
|
|
286
|
-
|
|
244
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - currentTargetScrollTop + tableHeadRowHeight; // 当前滚动条到底部的距离
|
|
287
245
|
var scrollThresholdValue = getValidScrollThreshold(scrollThreshold, tableClientHeight);
|
|
288
|
-
|
|
289
246
|
if (currentPosToBottomGap < scrollThresholdValue && hasNextPage && !loadMoreLoading) {
|
|
290
247
|
var _loadMore;
|
|
291
|
-
|
|
292
248
|
setLoadMoreLoading(true);
|
|
293
249
|
(_loadMore = loadMore()) === null || _loadMore === void 0 ? void 0 : _loadMore.then(function () {
|
|
294
250
|
setLoadMoreLoading(false);
|
|
295
251
|
});
|
|
296
252
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]); // 内部滚动 对于滚动的处理
|
|
300
|
-
|
|
301
|
-
var onBodyScroll = useCallback(function (e) {
|
|
302
|
-
var currentTarget = e.target;
|
|
303
|
-
|
|
304
|
-
if (!currentTarget) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
var scrollLeftNum = currentTarget.scrollLeft;
|
|
309
|
-
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
310
|
-
|
|
311
|
-
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
312
|
-
onBodyVerticalScroll(currentTarget);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
var compareTarget = currentTarget; // 横向滚动
|
|
320
|
-
|
|
321
|
-
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
322
|
-
setScrollTarget(compareTarget);
|
|
323
|
-
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
324
|
-
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
325
|
-
lastOffsetLeftRef.current = scrollLeftNum;
|
|
326
|
-
}
|
|
327
|
-
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
253
|
+
lastOffsetTopRef.current = currentTargetScrollTop;
|
|
254
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
328
255
|
useEffect(function () {
|
|
329
256
|
if (!hasNextPage) {
|
|
330
257
|
setLoadMoreLoading(false);
|
|
331
258
|
}
|
|
332
|
-
}, [hasNextPage]);
|
|
333
|
-
|
|
259
|
+
}, [hasNextPage]);
|
|
260
|
+
// 渲染有设置高度的表格
|
|
334
261
|
var renderTableWithHeight = function renderTableWithHeight() {
|
|
335
262
|
if (!tableClientWidth || !tableClientHeight) {
|
|
336
263
|
return null;
|
|
337
264
|
}
|
|
338
|
-
|
|
339
|
-
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
265
|
+
var renderTableBody = function renderTableBody() {
|
|
340
266
|
if (loading && !rows.length) {
|
|
341
267
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
342
268
|
}
|
|
343
|
-
|
|
344
269
|
if (!loading && !rows.length) {
|
|
345
270
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
346
271
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
},
|
|
354
|
-
ref: tableBodyRef,
|
|
355
|
-
onScroll: onBodyScroll
|
|
356
|
-
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null));
|
|
272
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
273
|
+
onResize: function onResize(_ref2) {
|
|
274
|
+
var clientHeight = _ref2.height;
|
|
275
|
+
setTableBodyContentHeight(clientHeight);
|
|
276
|
+
}
|
|
277
|
+
}, /*#__PURE__*/React.createElement("div", null, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null)));
|
|
357
278
|
};
|
|
358
|
-
|
|
359
279
|
return /*#__PURE__*/React.createElement("div", {
|
|
360
|
-
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height))
|
|
280
|
+
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height)),
|
|
281
|
+
ref: tableBodyRef,
|
|
282
|
+
onScroll: onBodyVerticalScroll
|
|
283
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
style: {
|
|
285
|
+
width: columnsTotalWidthRef.current,
|
|
286
|
+
height: tableBodyContentHeight
|
|
287
|
+
}
|
|
361
288
|
}, /*#__PURE__*/React.createElement("div", {
|
|
362
|
-
ref: tableHeadRef,
|
|
363
289
|
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
364
|
-
}, tableHeadNode), /*#__PURE__*/React.createElement("div",
|
|
365
|
-
className: classnames("".concat(prefixCls, "-tbody")
|
|
366
|
-
}),
|
|
290
|
+
}, tableHeadNode), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableBodyProps()), {}, {
|
|
291
|
+
className: classnames("".concat(prefixCls, "-tbody"))
|
|
292
|
+
}), renderTableBody())));
|
|
367
293
|
};
|
|
368
|
-
|
|
369
294
|
return /*#__PURE__*/React.createElement("div", {
|
|
370
295
|
key: tableKey,
|
|
371
296
|
className: prefixCls,
|
|
@@ -374,15 +299,14 @@ function Table(props, ref) {
|
|
|
374
299
|
height: !height ? 'unset' : height
|
|
375
300
|
}
|
|
376
301
|
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
377
|
-
onResize: function onResize(
|
|
378
|
-
var clientWidth =
|
|
379
|
-
|
|
302
|
+
onResize: function onResize(_ref3) {
|
|
303
|
+
var clientWidth = _ref3.width,
|
|
304
|
+
clientHeight = _ref3.height;
|
|
380
305
|
setTableClientWidth(clientWidth);
|
|
381
306
|
setTableClientHeight(clientHeight);
|
|
382
307
|
}
|
|
383
|
-
}, !tableClientWidth ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null)) : /*#__PURE__*/React.createElement("div",
|
|
384
|
-
className: classnames("".concat(prefixCls, "-table-wrap"), (
|
|
308
|
+
}, !tableClientWidth ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null)) : /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
309
|
+
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefixCls, "-init-loading"), data.length === ZERO && loading), _defineProperty(_classnames2, "".concat(prefixCls, "-empty"), data.length === ZERO && loading), _classnames2))
|
|
385
310
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
386
311
|
}
|
|
387
|
-
|
|
388
312
|
export default /*#__PURE__*/React.forwardRef(Table);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import usePrefixCls from '../../../_utils/hooks/usePrefixCls';
|
|
3
3
|
import Empty from '../../../Empty';
|
|
4
|
-
|
|
5
4
|
function LoadingNode() {
|
|
6
5
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
7
6
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -12,5 +11,4 @@ function LoadingNode() {
|
|
|
12
11
|
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
13
12
|
}));
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export default LoadingNode;
|
|
@@ -2,7 +2,6 @@ import "@aloudata/icons-react/styles/index.less";
|
|
|
2
2
|
import _LoadingLine from "@aloudata/icons-react/es/icons/LoadingLine";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import usePrefixCls from '../../../_utils/hooks/usePrefixCls';
|
|
5
|
-
|
|
6
5
|
function LoadingNode() {
|
|
7
6
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
8
7
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -14,5 +13,4 @@ function LoadingNode() {
|
|
|
14
13
|
className: "".concat(prefixCls, "-loading-icon")
|
|
15
14
|
}), "Loading");
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
export default LoadingNode;
|
|
@@ -1,68 +1,52 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
var _excluded = ["style"];
|
|
2
|
-
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
-
|
|
11
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
-
|
|
13
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
|
|
15
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
|
|
17
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
|
|
19
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
-
|
|
21
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
22
|
-
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
23
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
|
|
25
16
|
import React, { useCallback, useState } from 'react';
|
|
26
17
|
import usePrefixCls from '../../../_utils/hooks/usePrefixCls';
|
|
27
18
|
import classnames from 'classnames';
|
|
28
19
|
import { getValidWidthByNumber } from '../../utils';
|
|
29
|
-
|
|
30
20
|
function TableBodyRowList(props) {
|
|
31
21
|
var _props$ellipsis = props.ellipsis,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
|
|
23
|
+
data = props.data,
|
|
24
|
+
rows = props.rows,
|
|
25
|
+
prepareRow = props.prepareRow,
|
|
26
|
+
columnsTotalWidthRef = props.columnsTotalWidthRef,
|
|
27
|
+
_props$rowClassName = props.rowClassName,
|
|
28
|
+
rowClassName = _props$rowClassName === void 0 ? '' : _props$rowClassName,
|
|
29
|
+
onRowSelected = props.onRowSelected;
|
|
41
30
|
var _useState = useState(null),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
selectedRowId = _useState2[0],
|
|
33
|
+
setSelectedRowId = _useState2[1];
|
|
46
34
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
47
35
|
var onRowClick = useCallback(function (row) {
|
|
48
36
|
if (!onRowSelected) {
|
|
49
37
|
return;
|
|
50
38
|
}
|
|
51
|
-
|
|
52
39
|
setSelectedRowId(row.id);
|
|
53
40
|
onRowSelected(row.original);
|
|
54
41
|
}, [onRowSelected, setSelectedRowId]);
|
|
55
42
|
return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item, index) {
|
|
56
43
|
var _classnames;
|
|
57
|
-
|
|
58
44
|
var row = rows[index];
|
|
59
45
|
prepareRow(row);
|
|
60
|
-
|
|
61
46
|
var _row$getRowProps = row.getRowProps(),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, rowProps, {
|
|
47
|
+
rowStyle = _row$getRowProps.style,
|
|
48
|
+
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
|
49
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, rowProps), {}, {
|
|
66
50
|
style: _objectSpread(_objectSpread({}, rowStyle), {}, {
|
|
67
51
|
width: columnsTotalWidthRef.current
|
|
68
52
|
}),
|
|
@@ -73,10 +57,8 @@ function TableBodyRowList(props) {
|
|
|
73
57
|
key: row.id
|
|
74
58
|
}), row.cells.map(function (cell) {
|
|
75
59
|
var _cell$getCellProps$st, _cell$getCellProps$st2;
|
|
76
|
-
|
|
77
60
|
var currentRenderWidth = Number((_cell$getCellProps$st = cell.getCellProps().style) === null || _cell$getCellProps$st === void 0 ? void 0 : (_cell$getCellProps$st2 = _cell$getCellProps$st.width) === null || _cell$getCellProps$st2 === void 0 ? void 0 : _cell$getCellProps$st2.toString().replace('px', '')); // 表格内置计算的宽度 'px'
|
|
78
|
-
|
|
79
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, cell.getCellProps(), {
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, cell.getCellProps()), {}, {
|
|
80
62
|
className: classnames("".concat(prefixCls, "-cell")),
|
|
81
63
|
style: {
|
|
82
64
|
width: getValidWidthByNumber(currentRenderWidth)
|
|
@@ -87,5 +69,4 @@ function TableBodyRowList(props) {
|
|
|
87
69
|
}));
|
|
88
70
|
}));
|
|
89
71
|
}
|
|
90
|
-
|
|
91
72
|
export default TableBodyRowList;
|