@zw-team/react-lib 1.0.1
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 +207 -0
- package/dist/components/AccessReport/index.d.ts +29 -0
- package/dist/components/AccessReport/index.js +129 -0
- package/dist/components/Avatar/Avatar.d.ts +3 -0
- package/dist/components/Avatar/Avatar.js +58 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/types.d.ts +9 -0
- package/dist/components/Avatar/types.js +0 -0
- package/dist/components/Block/Block.css +8 -0
- package/dist/components/Block/Block.d.ts +4 -0
- package/dist/components/Block/Block.js +11 -0
- package/dist/components/Block/index.d.ts +2 -0
- package/dist/components/Block/index.js +2 -0
- package/dist/components/Block/types.d.ts +3 -0
- package/dist/components/Block/types.js +0 -0
- package/dist/components/ConfigProvider/ConfigContext.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigContext.js +19 -0
- package/dist/components/ConfigProvider/ConfigProvider.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +57 -0
- package/dist/components/ConfigProvider/index.d.ts +2 -0
- package/dist/components/ConfigProvider/index.js +2 -0
- package/dist/components/ConfigProvider/types.d.ts +19 -0
- package/dist/components/ConfigProvider/types.js +0 -0
- package/dist/components/CustomColumn/CustomColumn.d.ts +4 -0
- package/dist/components/CustomColumn/CustomColumn.js +388 -0
- package/dist/components/CustomColumn/CustomColumn.scss +135 -0
- package/dist/components/CustomColumn/index.d.ts +2 -0
- package/dist/components/CustomColumn/index.js +2 -0
- package/dist/components/CustomColumn/types.d.ts +19 -0
- package/dist/components/CustomColumn/types.js +0 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.js +89 -0
- package/dist/components/DatePicker/datePickerOption.d.ts +14 -0
- package/dist/components/DatePicker/datePickerOption.js +149 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DatePicker/types.d.ts +12 -0
- package/dist/components/DatePicker/types.js +0 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.d.ts +6 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.js +397 -0
- package/dist/components/DatePickerPanel/datePickerPanel.scss +362 -0
- package/dist/components/DatePickerPanel/index.d.ts +2 -0
- package/dist/components/DatePickerPanel/index.js +2 -0
- package/dist/components/DatePickerPanel/type.d.ts +23 -0
- package/dist/components/DatePickerPanel/type.js +0 -0
- package/dist/components/DownloadCenter/DownloadCenter.d.ts +5 -0
- package/dist/components/DownloadCenter/DownloadCenter.js +367 -0
- package/dist/components/DownloadCenter/index.css +54 -0
- package/dist/components/DownloadCenter/index.d.ts +2 -0
- package/dist/components/DownloadCenter/index.js +2 -0
- package/dist/components/DownloadCenter/types.d.ts +27 -0
- package/dist/components/DownloadCenter/types.js +0 -0
- package/dist/components/Fireworks/Fireworks.d.ts +11 -0
- package/dist/components/Fireworks/Fireworks.js +415 -0
- package/dist/components/Fireworks/imgs/birthday-cake.svg +180 -0
- package/dist/components/Fireworks/imgs/hb.png +0 -0
- package/dist/components/Fireworks/imgs/sd.png +0 -0
- package/dist/components/Fireworks/imgs/xc.png +0 -0
- package/dist/components/Fireworks/imgs/yd.png +0 -0
- package/dist/components/Fireworks/index.d.ts +2 -0
- package/dist/components/Fireworks/index.js +2 -0
- package/dist/components/Fireworks/index.scss +9 -0
- package/dist/components/Fireworks/types.d.ts +6 -0
- package/dist/components/Fireworks/types.js +0 -0
- package/dist/components/Form/Form.css +4 -0
- package/dist/components/Form/Form.d.ts +9 -0
- package/dist/components/Form/Form.js +18 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/FormItem/FormItem.css +38 -0
- package/dist/components/FormItem/FormItem.d.ts +9 -0
- package/dist/components/FormItem/FormItem.js +25 -0
- package/dist/components/FormItem/index.d.ts +1 -0
- package/dist/components/FormItem/index.js +2 -0
- package/dist/components/HomeData/HomeData.d.ts +6 -0
- package/dist/components/HomeData/HomeData.js +364 -0
- package/dist/components/HomeData/HomeData.scss +161 -0
- package/dist/components/HomeData/index.d.ts +1 -0
- package/dist/components/HomeData/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +4 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Icon/types.d.ts +8 -0
- package/dist/components/Icon/types.js +0 -0
- package/dist/components/Log/index.d.ts +2 -0
- package/dist/components/Log/index.js +2 -0
- package/dist/components/Log/src/Detail.d.ts +7 -0
- package/dist/components/Log/src/Detail.js +71 -0
- package/dist/components/Log/src/Detail.scss +27 -0
- package/dist/components/Log/src/Log.d.ts +5 -0
- package/dist/components/Log/src/Log.js +335 -0
- package/dist/components/Log/src/Log.scss +50 -0
- package/dist/components/Log/src/useLogTableColumns.d.ts +2 -0
- package/dist/components/Log/src/useLogTableColumns.js +141 -0
- package/dist/components/Log/types.d.ts +5 -0
- package/dist/components/Log/types.js +0 -0
- package/dist/components/LogButton/LogButton.d.ts +4 -0
- package/dist/components/LogButton/LogButton.js +30 -0
- package/dist/components/LogButton/index.d.ts +2 -0
- package/dist/components/LogButton/index.js +2 -0
- package/dist/components/LogButton/logbutton.css +15 -0
- package/dist/components/LogButton/types.d.ts +10 -0
- package/dist/components/LogButton/types.js +0 -0
- package/dist/components/LogDialog/BiLogManager.d.ts +29 -0
- package/dist/components/LogDialog/BiLogManager.js +78 -0
- package/dist/components/LogDialog/LogDialog.d.ts +8 -0
- package/dist/components/LogDialog/LogDialog.js +106 -0
- package/dist/components/LogDialog/LogDialog.scss +29 -0
- package/dist/components/LogDialog/index.d.ts +3 -0
- package/dist/components/LogDialog/index.js +3 -0
- package/dist/components/LogDialog/types.d.ts +8 -0
- package/dist/components/LogDialog/types.js +0 -0
- package/dist/components/MediaPreview/MediaPreview.d.ts +5 -0
- package/dist/components/MediaPreview/MediaPreview.js +124 -0
- package/dist/components/MediaPreview/hook.d.ts +26 -0
- package/dist/components/MediaPreview/hook.js +174 -0
- package/dist/components/MediaPreview/index.css +202 -0
- package/dist/components/MediaPreview/index.d.ts +2 -0
- package/dist/components/MediaPreview/index.js +2 -0
- package/dist/components/MediaPreview/types.d.ts +24 -0
- package/dist/components/MediaPreview/types.js +0 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.js +31 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/types.d.ts +8 -0
- package/dist/components/Modal/types.js +0 -0
- package/dist/components/ModalStore/ModalProvider.d.ts +11 -0
- package/dist/components/ModalStore/ModalProvider.js +15 -0
- package/dist/components/ModalStore/ModalStore.d.ts +78 -0
- package/dist/components/ModalStore/ModalStore.js +188 -0
- package/dist/components/ModalStore/index.d.ts +3 -0
- package/dist/components/ModalStore/index.js +4 -0
- package/dist/components/ModalStore/types.d.ts +73 -0
- package/dist/components/ModalStore/types.js +0 -0
- package/dist/components/MoreButton/MoreButton.d.ts +3 -0
- package/dist/components/MoreButton/MoreButton.js +50 -0
- package/dist/components/MoreButton/index.d.ts +2 -0
- package/dist/components/MoreButton/index.js +2 -0
- package/dist/components/MoreButton/types.d.ts +15 -0
- package/dist/components/MoreButton/types.js +0 -0
- package/dist/components/NavbarTool/NavbarTool.d.ts +5 -0
- package/dist/components/NavbarTool/NavbarTool.js +143 -0
- package/dist/components/NavbarTool/components/index.css +49 -0
- package/dist/components/NavbarTool/components/index.d.ts +5 -0
- package/dist/components/NavbarTool/components/index.js +98 -0
- package/dist/components/NavbarTool/index.css +14 -0
- package/dist/components/NavbarTool/index.d.ts +2 -0
- package/dist/components/NavbarTool/index.js +2 -0
- package/dist/components/NavbarTool/types.d.ts +40 -0
- package/dist/components/NavbarTool/types.js +0 -0
- package/dist/components/NoticeCenter/NoticeCenter.d.ts +4 -0
- package/dist/components/NoticeCenter/NoticeCenter.js +334 -0
- package/dist/components/NoticeCenter/assets/notice.png +0 -0
- package/dist/components/NoticeCenter/assets/tongzhi.png +0 -0
- package/dist/components/NoticeCenter/index.d.ts +2 -0
- package/dist/components/NoticeCenter/index.js +2 -0
- package/dist/components/NoticeCenter/noticeCenter.scss +232 -0
- package/dist/components/NoticeCenter/types.d.ts +6 -0
- package/dist/components/NoticeCenter/types.js +0 -0
- package/dist/components/Pagination/BiPagination.css +152 -0
- package/dist/components/Pagination/Pagination.d.ts +5 -0
- package/dist/components/Pagination/Pagination.js +67 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +2 -0
- package/dist/components/Pagination/types.d.ts +14 -0
- package/dist/components/Pagination/types.js +0 -0
- package/dist/components/ResponseInterceptor/index.d.ts +17 -0
- package/dist/components/ResponseInterceptor/index.js +43 -0
- package/dist/components/SuperDate/SuperDate.d.ts +6 -0
- package/dist/components/SuperDate/SuperDate.js +113 -0
- package/dist/components/SuperDate/SuperDate.scss +42 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.d.ts +5 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.js +87 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.scss +52 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.d.ts +6 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.js +129 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/dynamicTimeCom.scss +70 -0
- package/dist/components/SuperDate/constant.d.ts +35 -0
- package/dist/components/SuperDate/constant.js +27 -0
- package/dist/components/SuperDate/index.d.ts +2 -0
- package/dist/components/SuperDate/index.js +2 -0
- package/dist/components/SuperDate/store.d.ts +68 -0
- package/dist/components/SuperDate/store.js +254 -0
- package/dist/components/SuperDate/types.d.ts +34 -0
- package/dist/components/SuperDate/types.js +0 -0
- package/dist/components/SuperDate/utils.d.ts +18 -0
- package/dist/components/SuperDate/utils.js +14 -0
- package/dist/components/SystemLink/SystemLink.d.ts +4 -0
- package/dist/components/SystemLink/SystemLink.js +85 -0
- package/dist/components/SystemLink/index.d.ts +1 -0
- package/dist/components/SystemLink/index.js +2 -0
- package/dist/components/SystemLink/index.scss +142 -0
- package/dist/components/Table/ResizableTitle.d.ts +3 -0
- package/dist/components/Table/ResizableTitle.js +43 -0
- package/dist/components/Table/Table.d.ts +9 -0
- package/dist/components/Table/Table.js +189 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Table/index.scss +42 -0
- package/dist/components/Table/types.d.ts +24 -0
- package/dist/components/Table/types.js +0 -0
- package/dist/components/Table/useHeaderPopper.d.ts +8 -0
- package/dist/components/Table/useHeaderPopper.js +95 -0
- package/dist/components/TableHeaderPopper/EditBox.d.ts +6 -0
- package/dist/components/TableHeaderPopper/EditBox.js +208 -0
- package/dist/components/TableHeaderPopper/Popover.d.ts +6 -0
- package/dist/components/TableHeaderPopper/Popover.js +85 -0
- package/dist/components/TableHeaderPopper/index.d.ts +3 -0
- package/dist/components/TableHeaderPopper/index.js +3 -0
- package/dist/components/TableHeaderPopper/index.scss +96 -0
- package/dist/components/TaskCenter/TaskCenter.d.ts +4 -0
- package/dist/components/TaskCenter/TaskCenter.js +257 -0
- package/dist/components/TaskCenter/TaskCenter.scss +44 -0
- package/dist/components/TaskCenter/api.d.ts +13 -0
- package/dist/components/TaskCenter/api.js +13 -0
- package/dist/components/TaskCenter/index.d.ts +2 -0
- package/dist/components/TaskCenter/index.js +2 -0
- package/dist/components/TaskCenter/types.d.ts +29 -0
- package/dist/components/TaskCenter/types.js +0 -0
- package/dist/components/TooltipIcon/TooltipIcon.d.ts +3 -0
- package/dist/components/TooltipIcon/TooltipIcon.js +43 -0
- package/dist/components/TooltipIcon/index.d.ts +2 -0
- package/dist/components/TooltipIcon/index.js +2 -0
- package/dist/components/TooltipIcon/types.d.ts +14 -0
- package/dist/components/TooltipIcon/types.js +0 -0
- package/dist/components/Verification/content.d.ts +11 -0
- package/dist/components/Verification/content.js +223 -0
- package/dist/components/Verification/index.css +43 -0
- package/dist/components/Verification/index.d.ts +1 -0
- package/dist/components/Verification/index.js +37 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.js +29 -0
- package/dist/config/index.d.ts +83 -0
- package/dist/config/index.js +115 -0
- package/dist/config/theme/index.d.ts +368 -0
- package/dist/config/theme/index.js +369 -0
- package/dist/hooks/createAlive.d.ts +11 -0
- package/dist/hooks/createAlive.js +22 -0
- package/dist/hooks/createGlobalState.d.ts +7 -0
- package/dist/hooks/createGlobalState.js +28 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.js +25 -0
- package/dist/hooks/useAsync.d.ts +27 -0
- package/dist/hooks/useAsync.js +76 -0
- package/dist/hooks/useClickOther.d.ts +10 -0
- package/dist/hooks/useClickOther.js +30 -0
- package/dist/hooks/useCopyToClipboard.d.ts +7 -0
- package/dist/hooks/useCopyToClipboard.js +32 -0
- package/dist/hooks/useCreate.d.ts +7 -0
- package/dist/hooks/useCreate.js +21 -0
- package/dist/hooks/useEventListener.d.ts +22 -0
- package/dist/hooks/useEventListener.js +33 -0
- package/dist/hooks/useHistoryStore.d.ts +16 -0
- package/dist/hooks/useHistoryStore.js +106 -0
- package/dist/hooks/useIntersectionObserver.d.ts +8 -0
- package/dist/hooks/useIntersectionObserver.js +23 -0
- package/dist/hooks/useInterval.d.ts +8 -0
- package/dist/hooks/useInterval.js +19 -0
- package/dist/hooks/useLatest.d.ts +2 -0
- package/dist/hooks/useLatest.js +12 -0
- package/dist/hooks/useLockAsyncFn.d.ts +7 -0
- package/dist/hooks/useLockAsyncFn.js +24 -0
- package/dist/hooks/useLockFn.d.ts +7 -0
- package/dist/hooks/useLockFn.js +17 -0
- package/dist/hooks/useMergedState.d.ts +10 -0
- package/dist/hooks/useMergedState.js +30 -0
- package/dist/hooks/useMountedState.d.ts +4 -0
- package/dist/hooks/useMountedState.js +13 -0
- package/dist/hooks/usePermission.d.ts +8 -0
- package/dist/hooks/usePermission.js +21 -0
- package/dist/hooks/usePersistFn.d.ts +8 -0
- package/dist/hooks/usePersistFn.js +13 -0
- package/dist/hooks/useReactive.d.ts +7 -0
- package/dist/hooks/useReactive.js +34 -0
- package/dist/hooks/useRefresh.d.ts +5 -0
- package/dist/hooks/useRefresh.js +8 -0
- package/dist/hooks/useToggle.d.ts +16 -0
- package/dist/hooks/useToggle.js +20 -0
- package/dist/hooks/useUnmount.d.ts +6 -0
- package/dist/hooks/useUnmount.js +10 -0
- package/dist/hooks/useUpdateEffect.d.ts +9 -0
- package/dist/hooks/useUpdateEffect.js +10 -0
- package/dist/hooks/useWindowSize.d.ts +6 -0
- package/dist/hooks/useWindowSize.js +15 -0
- package/dist/hooks/util.d.ts +9 -0
- package/dist/hooks/util.js +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/utils/array.d.ts +12 -0
- package/dist/utils/array.js +15 -0
- package/dist/utils/classNames.d.ts +4 -0
- package/dist/utils/classNames.js +19 -0
- package/dist/utils/date.d.ts +98 -0
- package/dist/utils/date.js +101 -0
- package/dist/utils/debounce.d.ts +8 -0
- package/dist/utils/debounce.js +38 -0
- package/dist/utils/deepClone.d.ts +6 -0
- package/dist/utils/deepClone.js +10 -0
- package/dist/utils/empty.d.ts +16 -0
- package/dist/utils/empty.js +24 -0
- package/dist/utils/formatPrice.d.ts +2 -0
- package/dist/utils/formatPrice.js +15 -0
- package/dist/utils/getUUID.d.ts +1 -0
- package/dist/utils/getUUID.js +17 -0
- package/dist/utils/getUrlParams.d.ts +11 -0
- package/dist/utils/getUrlParams.js +10 -0
- package/dist/utils/index.d.ts +20 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/listToTree.d.ts +12 -0
- package/dist/utils/listToTree.js +14 -0
- package/dist/utils/object.d.ts +6 -0
- package/dist/utils/object.js +5 -0
- package/dist/utils/ossUpload.d.ts +45 -0
- package/dist/utils/ossUpload.js +88 -0
- package/dist/utils/parseTo.d.ts +6 -0
- package/dist/utils/parseTo.js +9 -0
- package/dist/utils/request/accessReport.d.ts +2 -0
- package/dist/utils/request/accessReport.js +27 -0
- package/dist/utils/request/defaultRequest.d.ts +9 -0
- package/dist/utils/request/defaultRequest.js +33 -0
- package/dist/utils/request/exportDownload.d.ts +2 -0
- package/dist/utils/request/exportDownload.js +28 -0
- package/dist/utils/request/index.d.ts +29 -0
- package/dist/utils/request/index.js +40 -0
- package/dist/utils/request/noticeCenter.d.ts +2 -0
- package/dist/utils/request/noticeCenter.js +28 -0
- package/dist/utils/svgIcon/index.d.ts +47 -0
- package/dist/utils/svgIcon/index.js +76 -0
- package/dist/utils/throttle.d.ts +10 -0
- package/dist/utils/throttle.js +21 -0
- package/dist/utils/time/index.d.ts +7 -0
- package/dist/utils/time/index.js +12 -0
- package/dist/utils/tools.d.ts +43 -0
- package/dist/utils/tools.js +57 -0
- package/package.json +116 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CloseOutlined, HolderOutlined, UnorderedListOutlined } from "@ant-design/icons";
|
|
3
|
+
import { Button, Card, Checkbox, Modal } from "antd";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import sortablejs from "sortablejs";
|
|
6
|
+
import "./CustomColumn.scss";
|
|
7
|
+
const CustomColumn_CustomColumn = ({ columnName, dialogWidth = '770px', type = 'primary', tableColumn, defaultColumn, handleTableColumn })=>{
|
|
8
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
9
|
+
const [checkList, setCheckList] = useState([]);
|
|
10
|
+
const [columnLists, setColumnLists] = useState({
|
|
11
|
+
left: [],
|
|
12
|
+
center: [],
|
|
13
|
+
right: []
|
|
14
|
+
});
|
|
15
|
+
const [tableColumnList, setTableColumnList] = useState([]);
|
|
16
|
+
const columnRefs = {
|
|
17
|
+
left: useRef(null),
|
|
18
|
+
center: useRef(null),
|
|
19
|
+
right: useRef(null)
|
|
20
|
+
};
|
|
21
|
+
const sortableInstancesRef = useRef([
|
|
22
|
+
null,
|
|
23
|
+
null,
|
|
24
|
+
null
|
|
25
|
+
]);
|
|
26
|
+
const getLocalStorage = useCallback(()=>{
|
|
27
|
+
try {
|
|
28
|
+
const localData = localStorage.getItem(columnName);
|
|
29
|
+
if (localData) {
|
|
30
|
+
const parsedData = JSON.parse(localData);
|
|
31
|
+
if (parsedData?.left && parsedData?.center && parsedData?.right) return parsedData;
|
|
32
|
+
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('解析 localStorage 数据失败:', error);
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}, [
|
|
38
|
+
columnName
|
|
39
|
+
]);
|
|
40
|
+
const defaultColumnInit = useCallback(()=>{
|
|
41
|
+
const localData = getLocalStorage();
|
|
42
|
+
const { left, center, right } = localData || defaultColumn;
|
|
43
|
+
const checkListInit = [];
|
|
44
|
+
const newColumnLists = {
|
|
45
|
+
left: [],
|
|
46
|
+
center: [],
|
|
47
|
+
right: []
|
|
48
|
+
};
|
|
49
|
+
setTableColumnList(tableColumn);
|
|
50
|
+
const processColumn = (columnType, props)=>{
|
|
51
|
+
props.forEach((prop)=>{
|
|
52
|
+
checkListInit.push(prop);
|
|
53
|
+
const column = tableColumn.find((item)=>item.prop === prop);
|
|
54
|
+
if (column) newColumnLists[columnType].push(column.prop);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
processColumn('left', left);
|
|
58
|
+
processColumn('center', center);
|
|
59
|
+
processColumn('right', right);
|
|
60
|
+
setColumnLists(newColumnLists);
|
|
61
|
+
setCheckList(checkListInit);
|
|
62
|
+
}, [
|
|
63
|
+
defaultColumn,
|
|
64
|
+
tableColumn,
|
|
65
|
+
getLocalStorage
|
|
66
|
+
]);
|
|
67
|
+
const saveLocalStorage = useCallback(()=>{
|
|
68
|
+
const localData = {
|
|
69
|
+
left: columnLists.left,
|
|
70
|
+
center: columnLists.center,
|
|
71
|
+
right: columnLists.right
|
|
72
|
+
};
|
|
73
|
+
localStorage.setItem(columnName, JSON.stringify(localData));
|
|
74
|
+
}, [
|
|
75
|
+
columnName,
|
|
76
|
+
columnLists
|
|
77
|
+
]);
|
|
78
|
+
const showModal = ()=>{
|
|
79
|
+
defaultColumnInit();
|
|
80
|
+
setIsModalOpen(true);
|
|
81
|
+
};
|
|
82
|
+
const handleOk = ()=>{
|
|
83
|
+
saveLocalStorage();
|
|
84
|
+
const columnProps = [
|
|
85
|
+
...columnLists.left,
|
|
86
|
+
...columnLists.center,
|
|
87
|
+
...columnLists.right
|
|
88
|
+
];
|
|
89
|
+
handleTableColumn?.(columnProps.map((prop)=>tableColumnList.find((col)=>col.prop === prop)));
|
|
90
|
+
setIsModalOpen(false);
|
|
91
|
+
};
|
|
92
|
+
const handleCancel = ()=>{
|
|
93
|
+
setIsModalOpen(false);
|
|
94
|
+
};
|
|
95
|
+
const onAllChange = (e)=>{
|
|
96
|
+
const checked = e.target.checked;
|
|
97
|
+
if (checked) {
|
|
98
|
+
const allProps = tableColumnList.map((item)=>item.prop);
|
|
99
|
+
setCheckList(allProps);
|
|
100
|
+
const existingLeft = [
|
|
101
|
+
...columnLists.left
|
|
102
|
+
];
|
|
103
|
+
const existingRight = [
|
|
104
|
+
...columnLists.right
|
|
105
|
+
];
|
|
106
|
+
const existingCenter = [
|
|
107
|
+
...columnLists.center
|
|
108
|
+
];
|
|
109
|
+
const addedProps = allProps.filter((prop)=>!existingLeft.includes(prop) && !existingCenter.includes(prop) && !existingRight.includes(prop));
|
|
110
|
+
setColumnLists({
|
|
111
|
+
left: existingLeft,
|
|
112
|
+
center: [
|
|
113
|
+
...existingCenter,
|
|
114
|
+
...addedProps
|
|
115
|
+
],
|
|
116
|
+
right: existingRight
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
setCheckList([]);
|
|
120
|
+
setColumnLists({
|
|
121
|
+
left: [],
|
|
122
|
+
center: [],
|
|
123
|
+
right: []
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const onClearCheckList = ()=>{
|
|
128
|
+
setCheckList([]);
|
|
129
|
+
setColumnLists({
|
|
130
|
+
left: [],
|
|
131
|
+
center: [],
|
|
132
|
+
right: []
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const handleRemoveItem = (listType, prop)=>{
|
|
136
|
+
setColumnLists((prev)=>({
|
|
137
|
+
...prev,
|
|
138
|
+
[listType]: prev[listType].filter((item)=>item !== prop)
|
|
139
|
+
}));
|
|
140
|
+
setCheckList((prev)=>prev.filter((item)=>item !== prop));
|
|
141
|
+
};
|
|
142
|
+
const handleSortEnd = useCallback((evt)=>{
|
|
143
|
+
const { oldIndex, newIndex, from, to, item } = evt;
|
|
144
|
+
if (from !== to) from.appendChild(item);
|
|
145
|
+
const fromType = from.getAttribute('data-column-type');
|
|
146
|
+
const toType = to.getAttribute('data-column-type');
|
|
147
|
+
if (!fromType || !toType) return;
|
|
148
|
+
setColumnLists((prev)=>{
|
|
149
|
+
const newLists = {
|
|
150
|
+
...prev
|
|
151
|
+
};
|
|
152
|
+
if (fromType === toType) {
|
|
153
|
+
const list = [
|
|
154
|
+
...newLists[fromType]
|
|
155
|
+
];
|
|
156
|
+
const [movedItem] = list.splice(oldIndex, 1);
|
|
157
|
+
list.splice(newIndex, 0, movedItem);
|
|
158
|
+
newLists[fromType] = list;
|
|
159
|
+
} else {
|
|
160
|
+
const sourceList = [
|
|
161
|
+
...newLists[fromType]
|
|
162
|
+
];
|
|
163
|
+
const targetList = [
|
|
164
|
+
...newLists[toType]
|
|
165
|
+
];
|
|
166
|
+
const [movedItem] = sourceList.splice(oldIndex, 1);
|
|
167
|
+
targetList.splice(newIndex, 0, movedItem);
|
|
168
|
+
newLists[fromType] = sourceList;
|
|
169
|
+
newLists[toType] = targetList;
|
|
170
|
+
}
|
|
171
|
+
return newLists;
|
|
172
|
+
});
|
|
173
|
+
}, []);
|
|
174
|
+
const onCheckChange = (prop, e)=>{
|
|
175
|
+
const checked = e.target.checked;
|
|
176
|
+
if (checked) {
|
|
177
|
+
setCheckList((prev)=>[
|
|
178
|
+
...prev,
|
|
179
|
+
prop
|
|
180
|
+
]);
|
|
181
|
+
setColumnLists((prev)=>({
|
|
182
|
+
...prev,
|
|
183
|
+
center: [
|
|
184
|
+
...prev.center,
|
|
185
|
+
prop
|
|
186
|
+
]
|
|
187
|
+
}));
|
|
188
|
+
} else {
|
|
189
|
+
setCheckList((prev)=>prev.filter((item)=>item !== prop));
|
|
190
|
+
setColumnLists((prev)=>({
|
|
191
|
+
left: prev.left.filter((item)=>item !== prop),
|
|
192
|
+
center: prev.center.filter((item)=>item !== prop),
|
|
193
|
+
right: prev.right.filter((item)=>item !== prop)
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
useEffect(()=>{
|
|
198
|
+
if (!isModalOpen) return;
|
|
199
|
+
const initSortable = ()=>{
|
|
200
|
+
sortableInstancesRef.current.forEach((instance)=>{
|
|
201
|
+
if (instance) try {
|
|
202
|
+
instance.destroy();
|
|
203
|
+
} catch (error) {
|
|
204
|
+
console.warn('Error destroying Sortable instance:', error);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const commonConfig = {
|
|
208
|
+
animation: 150,
|
|
209
|
+
group: {
|
|
210
|
+
name: 'columns',
|
|
211
|
+
pull: true,
|
|
212
|
+
put: true
|
|
213
|
+
},
|
|
214
|
+
onEnd: handleSortEnd,
|
|
215
|
+
preventOnFilter: false,
|
|
216
|
+
forceFallback: true,
|
|
217
|
+
fallbackOnBody: true,
|
|
218
|
+
swapThreshold: 0.65
|
|
219
|
+
};
|
|
220
|
+
Object.keys(columnRefs).forEach((key, index)=>{
|
|
221
|
+
const columnType = key;
|
|
222
|
+
const ref = columnRefs[columnType];
|
|
223
|
+
if (ref.current) {
|
|
224
|
+
sortableInstancesRef.current[index] = new sortablejs(ref.current, {
|
|
225
|
+
...commonConfig,
|
|
226
|
+
dataIdAttr: 'data-column-type'
|
|
227
|
+
});
|
|
228
|
+
ref.current.setAttribute('data-column-type', columnType);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
const timer = setTimeout(initSortable, 100);
|
|
233
|
+
return ()=>{
|
|
234
|
+
clearTimeout(timer);
|
|
235
|
+
sortableInstancesRef.current.forEach((instance)=>{
|
|
236
|
+
if (instance) try {
|
|
237
|
+
instance.destroy();
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.warn('Error destroying Sortable instance:', error);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
}, [
|
|
244
|
+
isModalOpen,
|
|
245
|
+
handleSortEnd
|
|
246
|
+
]);
|
|
247
|
+
useEffect(()=>{
|
|
248
|
+
defaultColumnInit();
|
|
249
|
+
}, [
|
|
250
|
+
defaultColumnInit
|
|
251
|
+
]);
|
|
252
|
+
const renderColumnItem = (listType, item)=>{
|
|
253
|
+
const column = tableColumnList.find((col)=>col.prop === item);
|
|
254
|
+
const label = column?.label || item;
|
|
255
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
256
|
+
className: "column-item",
|
|
257
|
+
children: [
|
|
258
|
+
/*#__PURE__*/ jsxs("div", {
|
|
259
|
+
className: "column-item-content",
|
|
260
|
+
children: [
|
|
261
|
+
/*#__PURE__*/ jsx(HolderOutlined, {
|
|
262
|
+
style: {
|
|
263
|
+
marginRight: 8
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ jsx("div", {
|
|
267
|
+
className: "text",
|
|
268
|
+
children: label
|
|
269
|
+
})
|
|
270
|
+
]
|
|
271
|
+
}),
|
|
272
|
+
/*#__PURE__*/ jsx("div", {
|
|
273
|
+
className: "column-item-delete",
|
|
274
|
+
children: /*#__PURE__*/ jsx(CloseOutlined, {
|
|
275
|
+
onClick: (e)=>{
|
|
276
|
+
e.stopPropagation();
|
|
277
|
+
handleRemoveItem(listType, item);
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
}, item);
|
|
283
|
+
};
|
|
284
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
285
|
+
children: [
|
|
286
|
+
/*#__PURE__*/ jsx(Button, {
|
|
287
|
+
type: type,
|
|
288
|
+
onClick: showModal,
|
|
289
|
+
icon: /*#__PURE__*/ jsx(UnorderedListOutlined, {}),
|
|
290
|
+
children: "自定义列"
|
|
291
|
+
}),
|
|
292
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
293
|
+
width: dialogWidth,
|
|
294
|
+
title: "自定义列",
|
|
295
|
+
open: isModalOpen,
|
|
296
|
+
onOk: handleOk,
|
|
297
|
+
onCancel: handleCancel,
|
|
298
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
299
|
+
className: "dialog-body",
|
|
300
|
+
style: {
|
|
301
|
+
minHeight: '160px'
|
|
302
|
+
},
|
|
303
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
304
|
+
className: "bi-column-container",
|
|
305
|
+
children: [
|
|
306
|
+
/*#__PURE__*/ jsx("div", {
|
|
307
|
+
className: "checkbox-container",
|
|
308
|
+
children: /*#__PURE__*/ jsx(Card, {
|
|
309
|
+
className: "box-card",
|
|
310
|
+
title: "可操作性的列",
|
|
311
|
+
style: {
|
|
312
|
+
width: '100%'
|
|
313
|
+
},
|
|
314
|
+
type: "inner",
|
|
315
|
+
extra: /*#__PURE__*/ jsx(Checkbox, {
|
|
316
|
+
onChange: onAllChange,
|
|
317
|
+
checked: 0 !== checkList.length && checkList.length === tableColumnList.length,
|
|
318
|
+
indeterminate: checkList.length > 0 && checkList.length < tableColumnList.length,
|
|
319
|
+
children: "全选"
|
|
320
|
+
}),
|
|
321
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
322
|
+
className: "checkbox-group",
|
|
323
|
+
children: tableColumnList.map((item)=>{
|
|
324
|
+
const isChecked = checkList.includes(item.prop);
|
|
325
|
+
return /*#__PURE__*/ jsx(Checkbox, {
|
|
326
|
+
className: "checkbox",
|
|
327
|
+
checked: isChecked,
|
|
328
|
+
onChange: (e)=>onCheckChange(item.prop, e),
|
|
329
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
330
|
+
className: "text2",
|
|
331
|
+
children: item.label
|
|
332
|
+
})
|
|
333
|
+
}, item.prop);
|
|
334
|
+
})
|
|
335
|
+
})
|
|
336
|
+
})
|
|
337
|
+
}),
|
|
338
|
+
/*#__PURE__*/ jsx("div", {
|
|
339
|
+
className: "column-container",
|
|
340
|
+
children: /*#__PURE__*/ jsxs(Card, {
|
|
341
|
+
className: "box-card",
|
|
342
|
+
title: `已选${checkList.length || 0}列`,
|
|
343
|
+
type: "inner",
|
|
344
|
+
extra: /*#__PURE__*/ jsx(Button, {
|
|
345
|
+
type: "link",
|
|
346
|
+
onClick: onClearCheckList,
|
|
347
|
+
children: "清空全部"
|
|
348
|
+
}),
|
|
349
|
+
children: [
|
|
350
|
+
/*#__PURE__*/ jsx("div", {
|
|
351
|
+
className: "column-group-title",
|
|
352
|
+
children: "左侧固定列"
|
|
353
|
+
}),
|
|
354
|
+
/*#__PURE__*/ jsx("div", {
|
|
355
|
+
className: "left-column",
|
|
356
|
+
ref: columnRefs.left,
|
|
357
|
+
children: columnLists.left.map((item)=>renderColumnItem('left', item))
|
|
358
|
+
}),
|
|
359
|
+
/*#__PURE__*/ jsx("div", {
|
|
360
|
+
className: "column-group-title",
|
|
361
|
+
children: "中间不固定列"
|
|
362
|
+
}),
|
|
363
|
+
/*#__PURE__*/ jsx("div", {
|
|
364
|
+
className: "center-column",
|
|
365
|
+
ref: columnRefs.center,
|
|
366
|
+
children: columnLists.center.map((item)=>renderColumnItem('center', item))
|
|
367
|
+
}),
|
|
368
|
+
/*#__PURE__*/ jsx("div", {
|
|
369
|
+
className: "column-group-title",
|
|
370
|
+
children: "右侧固定列"
|
|
371
|
+
}),
|
|
372
|
+
/*#__PURE__*/ jsx("div", {
|
|
373
|
+
className: "right-column",
|
|
374
|
+
ref: columnRefs.right,
|
|
375
|
+
children: columnLists.right.map((item)=>renderColumnItem('right', item))
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
]
|
|
381
|
+
})
|
|
382
|
+
})
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
const CustomColumn = CustomColumn_CustomColumn;
|
|
388
|
+
export { CustomColumn as default };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
.bi-column-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
|
|
5
|
+
.checkbox-container {
|
|
6
|
+
flex: 1;
|
|
7
|
+
min-height: 200px;
|
|
8
|
+
|
|
9
|
+
.checkbox-group {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: repeat(2, 1fr);
|
|
12
|
+
gap: 8px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.column-container {
|
|
17
|
+
margin-left: 16px;
|
|
18
|
+
width: 254px;
|
|
19
|
+
flex: 0 0 254px;
|
|
20
|
+
min-height: 200px;
|
|
21
|
+
|
|
22
|
+
.column-group-title {
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
color: rgba(0, 0, 0, 0.85);
|
|
26
|
+
margin-bottom: 12px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.center-column,
|
|
30
|
+
.left-column,
|
|
31
|
+
.right-column {
|
|
32
|
+
margin-bottom: 14px;
|
|
33
|
+
padding: 8px;
|
|
34
|
+
border: 1px dashed #d9d9d9;
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
transition: border-color 0.2s;
|
|
37
|
+
max-height: 250px;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
border-color: #40a9ff;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 列项样式
|
|
47
|
+
.column-item {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
padding: 8px 12px;
|
|
52
|
+
margin-bottom: 8px;
|
|
53
|
+
background-color: #f5f5f5;
|
|
54
|
+
border-radius: 4px;
|
|
55
|
+
cursor: move;
|
|
56
|
+
transition: all 0.2s;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
background-color: #e8e8e8;
|
|
60
|
+
|
|
61
|
+
.column-item-delete {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
visibility: visible;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 拖拽状态下的样式
|
|
68
|
+
&.sortable-ghost,
|
|
69
|
+
&.sortable-chosen,
|
|
70
|
+
&.sortable-drag {
|
|
71
|
+
opacity: 0.6;
|
|
72
|
+
|
|
73
|
+
.column-item-delete {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
visibility: hidden;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.column-item-content {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
flex: 1;
|
|
83
|
+
color: rgba(0, 0, 0, 0.85);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.column-item-delete {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
width: 20px;
|
|
91
|
+
height: 20px;
|
|
92
|
+
color: #999;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
transition: all 0.2s;
|
|
95
|
+
opacity: 0;
|
|
96
|
+
visibility: hidden;
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
color: #f5222d;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sortable-drag,
|
|
106
|
+
.sortable-ghost,
|
|
107
|
+
.sortable-chosen {
|
|
108
|
+
.column-item-content {
|
|
109
|
+
display: flex;
|
|
110
|
+
}
|
|
111
|
+
.column-item-delete {
|
|
112
|
+
opacity: 0 !important;
|
|
113
|
+
visibility: hidden !important;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.sortable-fallback {
|
|
118
|
+
.column-item-content {
|
|
119
|
+
display: flex;
|
|
120
|
+
}
|
|
121
|
+
.column-item-delete {
|
|
122
|
+
display: none !important;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.text,
|
|
127
|
+
.text2 {
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
max-width: 100px;
|
|
132
|
+
}
|
|
133
|
+
.text2 {
|
|
134
|
+
max-width: 165px;
|
|
135
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ButtonProps } from 'antd';
|
|
2
|
+
export interface DefaultColumn {
|
|
3
|
+
left: string[];
|
|
4
|
+
right: string[];
|
|
5
|
+
center: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface TableColumn {
|
|
8
|
+
prop: string;
|
|
9
|
+
label: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface CustomColumnProps {
|
|
13
|
+
columnName: string;
|
|
14
|
+
dialogWidth?: string;
|
|
15
|
+
type?: ButtonProps['type'];
|
|
16
|
+
tableColumn: TableColumn[];
|
|
17
|
+
defaultColumn: DefaultColumn;
|
|
18
|
+
handleTableColumn?: (prop: TableColumn[]) => void;
|
|
19
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DatePicker } from "antd";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
5
|
+
import { utcDatePickerOptions } from "./datePickerOption.js";
|
|
6
|
+
const { RangePicker } = DatePicker;
|
|
7
|
+
const formatDate = (date, format)=>date ? date.format(format) : null;
|
|
8
|
+
const parseDate = (value, format)=>{
|
|
9
|
+
if (!value) return '';
|
|
10
|
+
if ('number' == typeof value) return dayjs(value);
|
|
11
|
+
const parsed = dayjs(value, format, true);
|
|
12
|
+
return parsed.isValid() ? parsed : dayjs(value);
|
|
13
|
+
};
|
|
14
|
+
const parseRangeValue = (value, format)=>{
|
|
15
|
+
if (!value || !Array.isArray(value) || 2 !== value.length) return '';
|
|
16
|
+
const start = parseDate(value[0], format);
|
|
17
|
+
const end = parseDate(value[1], format);
|
|
18
|
+
return start && end ? [
|
|
19
|
+
start,
|
|
20
|
+
end
|
|
21
|
+
] : '';
|
|
22
|
+
};
|
|
23
|
+
const getBaseComponent = (isRange)=>isRange ? RangePicker : DatePicker;
|
|
24
|
+
const BiDatePicker = (props)=>{
|
|
25
|
+
const { isRange = false, format = 'YYYY-MM-DD', utc = 8, value = '', onChange, valueType = 'date', ...restProps } = props;
|
|
26
|
+
const internalValue = useMemo(()=>{
|
|
27
|
+
if (isRange) return parseRangeValue(value, format);
|
|
28
|
+
return parseDate(value, format);
|
|
29
|
+
}, [
|
|
30
|
+
value,
|
|
31
|
+
isRange,
|
|
32
|
+
format
|
|
33
|
+
]);
|
|
34
|
+
const handleChange = useCallback((dates, dateString)=>{
|
|
35
|
+
if (!onChange) return;
|
|
36
|
+
let externalValue = null;
|
|
37
|
+
if (isRange) {
|
|
38
|
+
const dayjsDates = dates;
|
|
39
|
+
if (dayjsDates && dayjsDates[0] && dayjsDates[1]) externalValue = 'timestamp' === valueType ? [
|
|
40
|
+
dayjsDates[0].valueOf(),
|
|
41
|
+
dayjsDates[1].valueOf()
|
|
42
|
+
] : [
|
|
43
|
+
formatDate(dayjsDates[0], format),
|
|
44
|
+
formatDate(dayjsDates[1], format)
|
|
45
|
+
];
|
|
46
|
+
} else {
|
|
47
|
+
const dayjsDate = dates;
|
|
48
|
+
if (dayjsDate) externalValue = 'timestamp' === valueType ? dayjsDate.valueOf() : formatDate(dayjsDate, format);
|
|
49
|
+
}
|
|
50
|
+
onChange(externalValue, dateString);
|
|
51
|
+
}, [
|
|
52
|
+
onChange,
|
|
53
|
+
isRange,
|
|
54
|
+
format,
|
|
55
|
+
valueType
|
|
56
|
+
]);
|
|
57
|
+
const DynamicComponent = useMemo(()=>getBaseComponent(isRange), [
|
|
58
|
+
isRange
|
|
59
|
+
]);
|
|
60
|
+
const pickerPresets = useMemo(()=>{
|
|
61
|
+
if (isRange) {
|
|
62
|
+
const basePresets = utcDatePickerOptions(utc);
|
|
63
|
+
let defaultPresets = [];
|
|
64
|
+
if (restProps.picker && 'date' !== restProps.picker) {
|
|
65
|
+
if ('month' === restProps.picker) defaultPresets = basePresets['monthrange'];
|
|
66
|
+
} else defaultPresets = restProps.showTime ? basePresets['daterange'] : basePresets['datetimerange'];
|
|
67
|
+
return [
|
|
68
|
+
...defaultPresets,
|
|
69
|
+
...restProps.presets || []
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
return [];
|
|
73
|
+
}, [
|
|
74
|
+
isRange,
|
|
75
|
+
utc,
|
|
76
|
+
restProps.showTime,
|
|
77
|
+
restProps.picker,
|
|
78
|
+
restProps.presets
|
|
79
|
+
]);
|
|
80
|
+
return /*#__PURE__*/ jsx(DynamicComponent, {
|
|
81
|
+
format: format,
|
|
82
|
+
value: internalValue,
|
|
83
|
+
onChange: handleChange,
|
|
84
|
+
presets: pickerPresets,
|
|
85
|
+
...restProps
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const DatePicker_DatePicker = BiDatePicker;
|
|
89
|
+
export { DatePicker_DatePicker as default };
|