fan-standard-comp 3.2.1 → 4.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/fan-standard-comp.min.css +1 -0
- package/dist/fan-standard-comp.min.js +1 -0
- package/es/ButtonGroup/PopConfirmTitle.d.ts +1 -1
- package/es/ButtonGroup/PopConfirmTitle.js +2 -2
- package/es/ButtonGroup/index.d.ts +5 -3
- package/es/ButtonGroup/index.js +259 -189
- package/es/ButtonGroup/styles/index.d.ts +8 -0
- package/es/ButtonGroup/styles/index.js +61 -0
- package/es/ButtonGroup/testStyles/index(antd-style).d.ts +11 -0
- package/es/ButtonGroup/testStyles/index(antd-style).js +28 -0
- package/es/ButtonGroup/testStyles/index(cssinjs).js +133 -0
- package/es/ButtonGroup/testStyles/index.d.ts +11 -0
- package/es/ButtonGroup/testStyles/index.js +23 -0
- package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/es/CalendarCoordPicker/CalendarMonthPicker.js +32 -0
- package/es/CalendarCoordPicker/index.d.ts +7 -0
- package/es/CalendarCoordPicker/index.js +314 -0
- package/es/CalendarCoordPicker/styles/index.d.ts +6 -0
- package/es/CalendarCoordPicker/styles/index.js +28 -0
- package/es/CalendarCoordPicker/styles/index.less +37 -0
- package/es/ConfigContext/index.d.ts +7 -0
- package/es/ConfigContext/index.js +20 -0
- package/es/DragContent/DragBar.d.ts +3 -0
- package/es/DragContent/DragBar.js +0 -1
- package/es/DragContent/index.d.ts +1 -1
- package/es/DragContent/index.js +20 -6
- package/es/DragContent/styles/index.d.ts +6 -0
- package/es/DragContent/styles/index.js +52 -0
- package/es/FormComp/ChunkUploader/api.js +11 -11
- package/es/FormComp/ChunkUploader/index.js +125 -132
- package/es/FormComp/ChunkUploader/lib.js +19 -19
- package/es/FormComp/ChunkUploader/upload-queue.class.js +51 -51
- package/es/FormComp/EditButton/index.d.ts +1 -1
- package/es/FormComp/EditButton/index.js +18 -17
- package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/es/FormComp/FieldComponent/ReUpload.js +45 -37
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +28 -19
- package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/es/FormComp/FieldComponent/UploaderViewer.d.ts +2 -0
- package/es/FormComp/FieldComponent/UploaderViewer.js +92 -0
- package/es/FormComp/FieldComponent/index.d.ts +1 -1
- package/es/FormComp/FieldComponent/index.js +88 -109
- package/es/FormComp/FieldComponent/setReadonlyValues.js +21 -15
- package/es/FormComp/FieldComponent/style/TreeSelect.d.ts +6 -0
- package/es/FormComp/FieldComponent/style/TreeSelect.js +42 -0
- package/es/FormComp/FieldComponent/style/UploaderStyle.d.ts +6 -0
- package/es/FormComp/FieldComponent/style/UploaderStyle.js +25 -0
- package/es/FormComp/FieldComponent/style/index.less +26 -21
- package/es/FormComp/RenderItemGroup/index.d.ts +4 -0
- package/es/FormComp/RenderItemGroup/index.js +183 -66
- package/es/FormComp/RenderItemGroup/style/index.d.ts +6 -0
- package/es/FormComp/RenderItemGroup/style/index.js +40 -0
- package/es/FormComp/Uploader/index.js +94 -75
- package/es/FormComp/Uploader/style/index.less +14 -14
- package/es/FormComp/Uploader/util.d.ts +2 -2
- package/es/FormComp/VarTemplate/index.js +32 -40
- package/es/FormComp/index.js +1 -1
- package/es/NavLeafScroll/Main.js +443 -0
- package/es/NavLeafScroll/index.d.ts +2 -0
- package/es/NavLeafScroll/index.js +21 -395
- package/es/NavLeafScroll/style/index.d.ts +6 -0
- package/es/NavLeafScroll/style/index.js +56 -0
- package/es/NavLeafScroll/style/index.less +22 -22
- package/es/RefactorTree/index.d.ts +1 -1
- package/es/RefactorTree/index.js +21 -19
- package/es/RefactorTree/style/index.js +1 -1
- package/es/RefactorTree/style/index.less +22 -22
- package/es/RefactorTree/util.d.ts +2 -2
- package/es/RefactorTree/util.js +30 -15
- package/es/SpecIcon/fonts/demo_index.html +559 -5
- package/es/SpecIcon/fonts/iconfont.css +101 -3
- package/es/SpecIcon/fonts/iconfont.js +34 -27
- package/es/SpecIcon/fonts/iconfont.json +168 -0
- package/es/SpecIcon/fonts/iconfont.svg +163 -171
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/index.d.ts +0 -1
- package/es/SpecIcon/index.js +33 -12
- package/es/SpecIcon/styles/index(antd-style).d.ts +6 -0
- package/es/SpecIcon/styles/index(antd-style).js +13 -0
- package/es/SpecIcon/styles/index.d.ts +6 -0
- package/es/SpecIcon/styles/index.js +93 -0
- package/es/StandardContent/SplitterLayout/Pane.js +3 -3
- package/es/StandardContent/SplitterLayout/index.js +7 -6
- package/es/StandardContent/SplitterLayout/index.less +0 -1
- package/es/StandardContent/SubfieldContent.d.ts +3 -2
- package/es/StandardContent/SubfieldContent.js +24 -12
- package/es/StandardContent/WrapperContent.d.ts +2 -2
- package/es/StandardContent/WrapperContent.js +22 -11
- package/es/StandardContent/styles/Subfield.d.ts +6 -0
- package/es/StandardContent/styles/Subfield.js +30 -0
- package/es/StandardContent/styles/Wrapper.d.ts +6 -0
- package/es/StandardContent/styles/Wrapper.js +28 -0
- package/es/StandardContent/styles/index.less +67 -0
- package/es/StandardDragModal/ChangeStandardModal.d.ts +2 -2
- package/es/StandardDragModal/ChangeStandardModal.js +84 -71
- package/es/StandardDragModal/DraggableModal.js +7 -4
- package/es/StandardDragModal/DraggableModalContext.d.ts +1 -1
- package/es/StandardDragModal/DraggableModalInner.d.ts +2 -2
- package/es/StandardDragModal/DraggableModalInner.js +31 -21
- package/es/StandardDragModal/DraggableModalProvider.js +5 -5
- package/es/StandardDragModal/Modal.d.ts +1 -1
- package/es/StandardDragModal/Modal.js +8 -5
- package/es/StandardDragModal/ResizeHandle.js +2 -1
- package/es/StandardDragModal/draggableModalReducer.d.ts +4 -4
- package/es/StandardDragModal/draggableModalReducer.js +31 -22
- package/es/StandardDragModal/index.js +3 -3
- package/es/StandardDragModal/useDrag.js +2 -2
- package/es/StandardDragModal/useResize.js +2 -2
- package/es/StandardFilter/index.d.ts +8 -17
- package/es/StandardFilter/index.js +279 -206
- package/es/StandardFilter/style/FilterStyle.d.ts +6 -0
- package/es/StandardFilter/style/FilterStyle.js +50 -0
- package/es/StandardFilter/style/index.less +85 -36
- package/es/StandardForm/ActionList.d.ts +9 -0
- package/es/StandardForm/ActionList.js +5 -5
- package/es/StandardForm/StepForm.d.ts +1 -1
- package/es/StandardForm/StepForm.js +47 -40
- package/es/StandardForm/TabForm.d.ts +2 -1
- package/es/StandardForm/TabForm.js +50 -41
- package/es/StandardForm/index.d.ts +2 -1
- package/es/StandardForm/index.js +40 -22
- package/es/StandardForm/style/index.d.ts +6 -0
- package/es/StandardForm/style/index.js +49 -0
- package/es/StandardForm/style/index.less +23 -12
- package/es/StandardModal/UpdateFormRef.js +0 -1
- package/es/StandardModal/index.d.ts +4 -3
- package/es/StandardModal/index.js +153 -133
- package/es/StandardModal/style/index.d.ts +6 -0
- package/es/StandardModal/style/index.js +46 -0
- package/es/StandardModal/style/index.less +29 -29
- package/es/StandardPanel/index.d.ts +1 -1
- package/es/StandardPanel/index.js +28 -17
- package/es/StandardPanel/style/index.d.ts +6 -0
- package/es/StandardPanel/style/index.js +87 -0
- package/es/StandardPanel/style/index.less +30 -32
- package/es/StandardTable/index.d.ts +6 -1
- package/es/StandardTable/index.js +92 -40
- package/es/StandardTable/style/index.d.ts +6 -1
- package/es/StandardTable/style/index.js +113 -1
- package/es/StandardTable/style/index.less +89 -80
- package/es/components/IconNode/index.d.ts +1 -1
- package/es/components/IconNode/index.js +12 -1
- package/es/components/index.js +1 -1
- package/es/data/func.code.d.ts +16 -0
- package/es/data/general.config.d.ts +191 -0
- package/es/data/general.config.js +32 -1
- package/es/data/index.d.ts +3 -0
- package/es/data/index.js +2 -2
- package/es/index.d.ts +7 -6
- package/es/index.js +32 -26
- package/es/theme/index.d.ts +27 -0
- package/es/theme/index.js +29 -0
- package/es/theme/utils/genStyleHook.d.ts +1 -0
- package/es/theme/utils/genStyleHook.js +32 -0
- package/es/utils/ValueFormat.d.ts +3 -0
- package/es/utils/ValueFormat.js +17 -4
- package/es/utils/dictSelectUtil.d.ts +36 -0
- package/es/utils/dictSelectUtil.js +3 -3
- package/es/utils/filterPermission.d.ts +5 -0
- package/es/utils/filterPermission.js +4 -6
- package/es/utils/getParentNodes.d.ts +79 -0
- package/es/utils/getParentNodes.js +89 -13
- package/es/utils/index.d.ts +5 -0
- package/es/utils/index.js +5 -4
- package/es/utils/transferFile.d.ts +4 -0
- package/es/utils/transferFile.js +56 -0
- package/es/utils/urlUtils.d.ts +14 -0
- package/es/utils/urlUtils.js +77 -0
- package/lib/ButtonGroup/PopConfirmTitle.d.ts +1 -1
- package/lib/ButtonGroup/PopConfirmTitle.js +3 -4
- package/lib/ButtonGroup/index.d.ts +5 -3
- package/lib/ButtonGroup/index.js +261 -194
- package/lib/ButtonGroup/styles/index.d.ts +8 -0
- package/lib/ButtonGroup/styles/index.js +68 -0
- package/lib/ButtonGroup/testStyles/index(antd-style).d.ts +11 -0
- package/lib/ButtonGroup/testStyles/index(antd-style).js +34 -0
- package/lib/ButtonGroup/testStyles/index(cssinjs).js +134 -0
- package/lib/ButtonGroup/testStyles/index.d.ts +11 -0
- package/lib/ButtonGroup/testStyles/index.js +29 -0
- package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/lib/CalendarCoordPicker/CalendarMonthPicker.js +41 -0
- package/lib/CalendarCoordPicker/index.d.ts +7 -0
- package/lib/CalendarCoordPicker/index.js +323 -0
- package/lib/CalendarCoordPicker/styles/index.d.ts +6 -0
- package/lib/CalendarCoordPicker/styles/index.js +34 -0
- package/lib/CalendarCoordPicker/styles/index.less +37 -0
- package/lib/ConfigContext/index.d.ts +7 -0
- package/lib/ConfigContext/index.js +25 -0
- package/lib/DragContent/DragBar.d.ts +3 -0
- package/lib/DragContent/DragBar.js +1 -3
- package/lib/DragContent/index.d.ts +1 -1
- package/lib/DragContent/index.js +22 -9
- package/lib/DragContent/styles/index.d.ts +6 -0
- package/lib/DragContent/styles/index.js +58 -0
- package/lib/FormComp/ChunkUploader/api.js +11 -11
- package/lib/FormComp/ChunkUploader/index.js +123 -130
- package/lib/FormComp/ChunkUploader/lib.js +19 -19
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +52 -53
- package/lib/FormComp/EditButton/index.d.ts +1 -1
- package/lib/FormComp/EditButton/index.js +22 -22
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/lib/FormComp/FieldComponent/ReUpload.js +47 -41
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +29 -21
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/lib/FormComp/FieldComponent/TitleNode.js +1 -2
- package/lib/FormComp/FieldComponent/UploaderViewer.d.ts +2 -0
- package/lib/FormComp/FieldComponent/UploaderViewer.js +102 -0
- package/lib/FormComp/FieldComponent/index.d.ts +1 -1
- package/lib/FormComp/FieldComponent/index.js +83 -107
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +29 -28
- package/lib/FormComp/FieldComponent/style/TreeSelect.d.ts +6 -0
- package/lib/FormComp/FieldComponent/style/TreeSelect.js +48 -0
- package/lib/FormComp/FieldComponent/style/UploaderStyle.d.ts +6 -0
- package/lib/FormComp/FieldComponent/style/UploaderStyle.js +31 -0
- package/lib/FormComp/FieldComponent/style/index.less +26 -21
- package/lib/FormComp/RenderItemGroup/index.d.ts +4 -0
- package/lib/FormComp/RenderItemGroup/index.js +182 -65
- package/lib/FormComp/RenderItemGroup/style/index.d.ts +6 -0
- package/lib/FormComp/RenderItemGroup/style/index.js +46 -0
- package/lib/FormComp/Uploader/index.js +95 -80
- package/lib/FormComp/Uploader/style/index.less +14 -14
- package/lib/FormComp/Uploader/util.d.ts +2 -2
- package/lib/FormComp/VarTemplate/index.js +38 -48
- package/lib/NavLeafScroll/Main.js +451 -0
- package/lib/NavLeafScroll/index.d.ts +2 -0
- package/lib/NavLeafScroll/index.js +21 -398
- package/lib/NavLeafScroll/style/index.d.ts +6 -0
- package/lib/NavLeafScroll/style/index.js +62 -0
- package/lib/NavLeafScroll/style/index.less +22 -22
- package/lib/RefactorTree/index.d.ts +1 -1
- package/lib/RefactorTree/index.js +21 -21
- package/lib/RefactorTree/style/index.less +22 -22
- package/lib/RefactorTree/util.d.ts +2 -2
- package/lib/RefactorTree/util.js +30 -15
- package/lib/SpecIcon/fonts/demo_index.html +559 -5
- package/lib/SpecIcon/fonts/iconfont.css +101 -3
- package/lib/SpecIcon/fonts/iconfont.js +34 -27
- package/lib/SpecIcon/fonts/iconfont.json +168 -0
- package/lib/SpecIcon/fonts/iconfont.svg +163 -171
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.d.ts +0 -1
- package/lib/SpecIcon/index.js +34 -14
- package/lib/SpecIcon/styles/index(antd-style).d.ts +6 -0
- package/lib/SpecIcon/styles/index(antd-style).js +19 -0
- package/lib/SpecIcon/styles/index.d.ts +6 -0
- package/lib/SpecIcon/styles/index.js +100 -0
- package/lib/StandardContent/SplitterLayout/Pane.js +3 -4
- package/lib/StandardContent/SplitterLayout/index.js +6 -6
- package/lib/StandardContent/SplitterLayout/index.less +0 -1
- package/lib/StandardContent/SubfieldContent.d.ts +3 -2
- package/lib/StandardContent/SubfieldContent.js +24 -13
- package/lib/StandardContent/WrapperContent.d.ts +2 -2
- package/lib/StandardContent/WrapperContent.js +23 -13
- package/lib/StandardContent/styles/Subfield.d.ts +6 -0
- package/lib/StandardContent/styles/Subfield.js +36 -0
- package/lib/StandardContent/styles/Wrapper.d.ts +6 -0
- package/lib/StandardContent/styles/Wrapper.js +34 -0
- package/lib/StandardContent/styles/index.less +67 -0
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +2 -2
- package/lib/StandardDragModal/ChangeStandardModal.js +85 -72
- package/lib/StandardDragModal/DraggableModal.js +11 -8
- package/lib/StandardDragModal/DraggableModalContext.d.ts +1 -1
- package/lib/StandardDragModal/DraggableModalContext.js +3 -4
- package/lib/StandardDragModal/DraggableModalInner.d.ts +2 -2
- package/lib/StandardDragModal/DraggableModalInner.js +38 -30
- package/lib/StandardDragModal/DraggableModalProvider.js +10 -10
- package/lib/StandardDragModal/Modal.d.ts +1 -1
- package/lib/StandardDragModal/Modal.js +7 -5
- package/lib/StandardDragModal/ResizeHandle.js +6 -6
- package/lib/StandardDragModal/clamp.js +2 -3
- package/lib/StandardDragModal/draggableModalReducer.d.ts +4 -4
- package/lib/StandardDragModal/draggableModalReducer.js +34 -29
- package/lib/StandardDragModal/getWindowSize.js +2 -3
- package/lib/StandardDragModal/useDrag.js +4 -5
- package/lib/StandardDragModal/usePrevious.js +2 -3
- package/lib/StandardDragModal/useResize.js +4 -5
- package/lib/StandardFilter/index.d.ts +8 -17
- package/lib/StandardFilter/index.js +281 -207
- package/lib/StandardFilter/style/FilterStyle.d.ts +6 -0
- package/lib/StandardFilter/style/FilterStyle.js +56 -0
- package/lib/StandardFilter/style/index.less +85 -36
- package/lib/StandardForm/ActionList.d.ts +9 -0
- package/lib/StandardForm/ActionList.js +6 -7
- package/lib/StandardForm/StepForm.d.ts +1 -1
- package/lib/StandardForm/StepForm.js +46 -41
- package/lib/StandardForm/TabForm.d.ts +2 -1
- package/lib/StandardForm/TabForm.js +48 -41
- package/lib/StandardForm/index.d.ts +2 -1
- package/lib/StandardForm/index.js +39 -23
- package/lib/StandardForm/style/index.d.ts +6 -0
- package/lib/StandardForm/style/index.js +55 -0
- package/lib/StandardForm/style/index.less +23 -12
- package/lib/StandardModal/UpdateFormRef.js +3 -4
- package/lib/StandardModal/index.d.ts +4 -3
- package/lib/StandardModal/index.js +152 -133
- package/lib/StandardModal/style/index.d.ts +6 -0
- package/lib/StandardModal/style/index.js +52 -0
- package/lib/StandardModal/style/index.less +29 -29
- package/lib/StandardPanel/index.d.ts +1 -1
- package/lib/StandardPanel/index.js +29 -20
- package/lib/StandardPanel/style/index.d.ts +6 -0
- package/lib/StandardPanel/style/index.js +93 -0
- package/lib/StandardPanel/style/index.less +30 -32
- package/lib/StandardTable/index.d.ts +6 -1
- package/lib/StandardTable/index.js +93 -40
- package/lib/StandardTable/style/index.d.ts +6 -1
- package/lib/StandardTable/style/index.js +117 -1
- package/lib/StandardTable/style/index.less +89 -80
- package/lib/components/IconNode/index.d.ts +1 -1
- package/lib/components/IconNode/index.js +13 -3
- package/lib/data/func.code.d.ts +16 -0
- package/lib/data/func.code.js +2 -3
- package/lib/data/general.config.d.ts +191 -0
- package/lib/data/general.config.js +34 -4
- package/lib/data/index.d.ts +3 -0
- package/lib/index.d.ts +7 -6
- package/lib/index.js +24 -12
- package/lib/theme/index.d.ts +27 -0
- package/lib/theme/index.js +35 -0
- package/lib/theme/utils/genStyleHook.d.ts +1 -0
- package/lib/theme/utils/genStyleHook.js +38 -0
- package/lib/utils/ValueFormat.d.ts +3 -0
- package/lib/utils/ValueFormat.js +20 -6
- package/lib/utils/dictSelectUtil.d.ts +36 -0
- package/lib/utils/dictSelectUtil.js +3 -3
- package/lib/utils/filterPermission.d.ts +5 -0
- package/lib/utils/filterPermission.js +9 -16
- package/lib/utils/getParentNodes.d.ts +79 -0
- package/lib/utils/getParentNodes.js +91 -16
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +42 -32
- package/lib/utils/transferFile.d.ts +4 -0
- package/lib/utils/transferFile.js +63 -0
- package/lib/utils/urlUtils.d.ts +14 -0
- package/lib/utils/urlUtils.js +84 -0
- package/package.json +80 -33
- package/Readme.md +0 -49
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fan-standard-comp.umd.js +0 -602
- package/dist/fonts/iconfont.eot +0 -0
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +0 -2
- package/es/ButtonGroup/ButtonList.js +0 -34
- package/es/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/es/ButtonGroup/ButtonMenu.js +0 -35
- package/es/ButtonGroup/style/index.less +0 -36
- package/es/RefactorTree/indexTreeNode.d.ts +0 -39
- package/es/RefactorTree/indexTreeNode.js +0 -204
- package/es/SpecIcon/style/iconfont.less +0 -213
- package/es/SpecIcon/style/index.less +0 -98
- package/es/SplitterLayout/Pane.d.ts +0 -13
- package/es/SplitterLayout/Pane.js +0 -33
- package/es/SplitterLayout/index.js +0 -325
- package/es/SplitterLayout/index.less +0 -58
- package/es/StandardContent/style/index.less +0 -80
- package/es/theme/spec-variable.less +0 -48
- package/lib/ButtonGroup/ButtonList.d.ts +0 -2
- package/lib/ButtonGroup/ButtonList.js +0 -43
- package/lib/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/lib/ButtonGroup/ButtonMenu.js +0 -44
- package/lib/ButtonGroup/style/index.less +0 -36
- package/lib/RefactorTree/indexTreeNode.d.ts +0 -39
- package/lib/RefactorTree/indexTreeNode.js +0 -214
- package/lib/SpecIcon/style/iconfont.less +0 -213
- package/lib/SpecIcon/style/index.less +0 -98
- package/lib/SplitterLayout/Pane.d.ts +0 -13
- package/lib/SplitterLayout/Pane.js +0 -41
- package/lib/SplitterLayout/index.js +0 -332
- package/lib/SplitterLayout/index.less +0 -58
- package/lib/StandardContent/style/index.less +0 -80
- package/lib/theme/spec-variable.less +0 -48
- /package/es/{styles/index.less → ButtonGroup/testStyles/index(cssinjs).d.ts} +0 -0
- /package/lib/{styles/index.less → ButtonGroup/testStyles/index(cssinjs).d.ts} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { createStyleHook } from "../../theme/utils/genStyleHook";
|
|
8
|
+
import _ from 'lodash';
|
|
9
|
+
export var prepareComponentToken = function prepareComponentToken(token) {
|
|
10
|
+
return {
|
|
11
|
+
fontWeight: 400
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
var SpecButtonGroupTextStyle = function SpecButtonGroupTextStyle(prefixCls, token) {
|
|
15
|
+
return _defineProperty({}, "".concat(prefixCls, "-text"), _defineProperty({
|
|
16
|
+
position: 'relative',
|
|
17
|
+
display: 'inline-block',
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
color: token.colorPrimary,
|
|
20
|
+
'&:disabled': {
|
|
21
|
+
cursor: 'not-allowed',
|
|
22
|
+
color: token.colorTextDisabled
|
|
23
|
+
}
|
|
24
|
+
}, "& + ".concat(prefixCls, "-text"), {
|
|
25
|
+
position: 'relative',
|
|
26
|
+
marginLeft: token.paddingSM,
|
|
27
|
+
'&:before': {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
content: '""',
|
|
30
|
+
top: '50%',
|
|
31
|
+
left: " calc(-".concat(token.paddingSM, "px / 2)"),
|
|
32
|
+
transform: 'translate(0, -50%)',
|
|
33
|
+
display: 'inline-block',
|
|
34
|
+
height: '.9em',
|
|
35
|
+
verticalAlign: 'middle',
|
|
36
|
+
borderLeft: "1px solid ".concat(token.colorBorder)
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
var SpecButtonGroupStyleFunc = function SpecButtonGroupStyleFunc(prefix) {
|
|
41
|
+
return createStyleHook(prefix, function (token) {
|
|
42
|
+
var SpecButtonGroupToken = _.merge(token, {
|
|
43
|
+
// testButtonSmallSize: token.paddingXS,
|
|
44
|
+
// testButtonMiddleSize: token.padding,
|
|
45
|
+
// testButtonLargeSize: token.paddingLG,
|
|
46
|
+
});
|
|
47
|
+
var prefixCls = ".".concat(prefix);
|
|
48
|
+
return [_defineProperty({}, prefixCls, _objectSpread({
|
|
49
|
+
display: 'inline-block',
|
|
50
|
+
verticalAlign: 'middle',
|
|
51
|
+
'> *': {
|
|
52
|
+
marginLeft: token.marginSM,
|
|
53
|
+
'&:first-child': {
|
|
54
|
+
marginLeft: 0
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, SpecButtonGroupTextStyle(prefixCls, SpecButtonGroupToken)))];
|
|
58
|
+
}, prepareComponentToken // 当前组件扩展的变量
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export default SpecButtonGroupStyleFunc;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
SpecButtonGroupStyle: {
|
|
3
|
+
display: "inline-block";
|
|
4
|
+
verticalAlign: string;
|
|
5
|
+
".ant-btn + .ant-btn": {
|
|
6
|
+
marginLeft: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
SpecButtonGroupCSS: import("antd-style").SerializedStyles;
|
|
10
|
+
SpecButtonGroupTextCSS: import("antd-style").SerializedStyles;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { createStyles } from 'antd-style';
|
|
8
|
+
export var useStyles = createStyles(function (_ref) {
|
|
9
|
+
var token = _ref.token,
|
|
10
|
+
css = _ref.css;
|
|
11
|
+
return {
|
|
12
|
+
// 支持 css object 的写法
|
|
13
|
+
SpecButtonGroupStyle: _defineProperty({
|
|
14
|
+
display: 'inline-block',
|
|
15
|
+
verticalAlign: 'middle'
|
|
16
|
+
}, '.ant-btn + .ant-btn', {
|
|
17
|
+
marginLeft: "".concat(token.paddingSM, "px")
|
|
18
|
+
}),
|
|
19
|
+
// 也支持通过 css 字符串模板获得和 普通 css 一致的书写体验
|
|
20
|
+
SpecButtonGroupCSS: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n vertical-align: middle;\n .ant-btn + .ant-btn {\n margin-left: ", "px;\n }\n "])), token.paddingSM),
|
|
21
|
+
SpecButtonGroupTextCSS: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n cursor: pointer;\n color: ", ";\n\n &[disabled] {\n cursor: not-allowed;\n color: ", ";\n }\n\n & + .spec-button-group-text {\n position: relative;\n margin-left: ", "px;\n\n &:before {\n position: absolute;\n content: '';\n top: 50%;\n left: calc(-", "px / 2);\n transform: translate(0, -50%);\n display: inline-block;\n height: .9em;\n vertical-align: middle;\n border-left: 1px solid ", ";\n\n }\n }\n "])), token.colorPrimary, token.colorTextDisabled, token.paddingSM, token.paddingSM, token.colorBorder)
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// 使用方式
|
|
26
|
+
//
|
|
27
|
+
// import { useStyles } from "./styles";
|
|
28
|
+
// const { styles, cx, theme } = useStyles();
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// import type { CSSObject } from '@ant-design/cssinjs';
|
|
2
|
+
// import { Keyframes } from '@ant-design/cssinjs';
|
|
3
|
+
//
|
|
4
|
+
// import { resetComponent } from '../../style';
|
|
5
|
+
// import type { GlobalToken } from '../../theme';
|
|
6
|
+
// import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
7
|
+
// import { genPresetColor, mergeToken } from '../../theme/internal';
|
|
8
|
+
// import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
|
9
|
+
//
|
|
10
|
+
// export default function genComponentStyleHook<ComponentName extends OverrideComponent>(
|
|
11
|
+
// componentName: ComponentName | [ComponentName, string],
|
|
12
|
+
// styleFn: GenStyleFn<ComponentName>,
|
|
13
|
+
// getDefaultToken?:
|
|
14
|
+
// | null
|
|
15
|
+
// | OverrideTokenWithoutDerivative[ComponentName]
|
|
16
|
+
// | ((token: GlobalToken) => OverrideTokenWithoutDerivative[ComponentName]),
|
|
17
|
+
// options: {
|
|
18
|
+
// resetStyle?: boolean;
|
|
19
|
+
// // Deprecated token key map [["oldTokenKey", "newTokenKey"], ["oldTokenKey", "newTokenKey"]]
|
|
20
|
+
// deprecatedTokens?: [ComponentTokenKey<ComponentName>, ComponentTokenKey<ComponentName>][];
|
|
21
|
+
// /**
|
|
22
|
+
// * Only use component style in client side. Ignore in SSR.
|
|
23
|
+
// */
|
|
24
|
+
// clientOnly?: boolean;
|
|
25
|
+
// /**
|
|
26
|
+
// * Set order of component style. Default is -999.
|
|
27
|
+
// */
|
|
28
|
+
// order?: number;
|
|
29
|
+
// } = {},
|
|
30
|
+
// ) {
|
|
31
|
+
// const cells = (Array.isArray(componentName) ? componentName : [componentName, componentName]) as [
|
|
32
|
+
// ComponentName,
|
|
33
|
+
// string,
|
|
34
|
+
// ];
|
|
35
|
+
//
|
|
36
|
+
// const [component] = cells;
|
|
37
|
+
// const concatComponent = cells.join('-');
|
|
38
|
+
//
|
|
39
|
+
// return (prefixCls: string): UseComponentStyleResult => {
|
|
40
|
+
// const [theme, token, hashId] = useToken();
|
|
41
|
+
// const { getPrefixCls, iconPrefixCls, csp } = useContext(ConfigContext);
|
|
42
|
+
// const rootPrefixCls = getPrefixCls();
|
|
43
|
+
//
|
|
44
|
+
// // Shared config
|
|
45
|
+
// const sharedConfig: Omit<Parameters<typeof useStyleRegister>[0], 'path'> = {
|
|
46
|
+
// theme,
|
|
47
|
+
// token,
|
|
48
|
+
// hashId,
|
|
49
|
+
// nonce: () => csp?.nonce!,
|
|
50
|
+
// clientOnly: options.clientOnly,
|
|
51
|
+
//
|
|
52
|
+
// // antd is always at top of styles
|
|
53
|
+
// order: options.order || -999,
|
|
54
|
+
// };
|
|
55
|
+
//
|
|
56
|
+
// // Generate style for all a tags in antd component.
|
|
57
|
+
// useStyleRegister(
|
|
58
|
+
// { ...sharedConfig, clientOnly: false, path: ['Shared', rootPrefixCls] },
|
|
59
|
+
// () => [
|
|
60
|
+
// {
|
|
61
|
+
// // Link
|
|
62
|
+
// '&': genLinkStyle(token),
|
|
63
|
+
// },
|
|
64
|
+
// ],
|
|
65
|
+
// );
|
|
66
|
+
//
|
|
67
|
+
// // Generate style for icons
|
|
68
|
+
// useResetIconStyle(iconPrefixCls, csp);
|
|
69
|
+
//
|
|
70
|
+
// return [
|
|
71
|
+
// useStyleRegister(
|
|
72
|
+
// { ...sharedConfig, path: [concatComponent, prefixCls, iconPrefixCls] },
|
|
73
|
+
// () => {
|
|
74
|
+
// const { token: proxyToken, flush } = statisticToken(token);
|
|
75
|
+
//
|
|
76
|
+
// const customComponentToken = { ...(token[component] as ComponentToken<ComponentName>) };
|
|
77
|
+
// if (options.deprecatedTokens) {
|
|
78
|
+
// const { deprecatedTokens } = options;
|
|
79
|
+
// deprecatedTokens.forEach(([oldTokenKey, newTokenKey]) => {
|
|
80
|
+
// if (process.env.NODE_ENV !== 'production') {
|
|
81
|
+
// warning(
|
|
82
|
+
// !customComponentToken?.[oldTokenKey],
|
|
83
|
+
// `The token '${String(oldTokenKey)}' of ${component} had deprecated, use '${String(
|
|
84
|
+
// newTokenKey,
|
|
85
|
+
// )}' instead.`,
|
|
86
|
+
// );
|
|
87
|
+
// }
|
|
88
|
+
//
|
|
89
|
+
// // Should wrap with `if` clause, or there will be `undefined` in object.
|
|
90
|
+
// if (customComponentToken?.[oldTokenKey] || customComponentToken?.[newTokenKey]) {
|
|
91
|
+
// customComponentToken[newTokenKey] ??= customComponentToken?.[oldTokenKey];
|
|
92
|
+
// }
|
|
93
|
+
// });
|
|
94
|
+
// }
|
|
95
|
+
// const defaultComponentToken =
|
|
96
|
+
// typeof getDefaultToken === 'function'
|
|
97
|
+
// ? getDefaultToken(mergeToken(proxyToken, customComponentToken ?? {}))
|
|
98
|
+
// : getDefaultToken;
|
|
99
|
+
//
|
|
100
|
+
// const mergedComponentToken = { ...defaultComponentToken, ...customComponentToken };
|
|
101
|
+
//
|
|
102
|
+
// const componentCls = `.${prefixCls}`;
|
|
103
|
+
// const mergedToken = mergeToken<
|
|
104
|
+
// TokenWithCommonCls<GlobalTokenWithComponent<OverrideComponent>>
|
|
105
|
+
// >(
|
|
106
|
+
// proxyToken,
|
|
107
|
+
// {
|
|
108
|
+
// componentCls,
|
|
109
|
+
// prefixCls,
|
|
110
|
+
// iconCls: `.${iconPrefixCls}`,
|
|
111
|
+
// antCls: `.${rootPrefixCls}`,
|
|
112
|
+
// },
|
|
113
|
+
// mergedComponentToken,
|
|
114
|
+
// );
|
|
115
|
+
//
|
|
116
|
+
// const styleInterpolation = styleFn(mergedToken as unknown as FullToken<ComponentName>, {
|
|
117
|
+
// hashId,
|
|
118
|
+
// prefixCls,
|
|
119
|
+
// rootPrefixCls,
|
|
120
|
+
// iconPrefixCls,
|
|
121
|
+
// overrideComponentToken: customComponentToken as any,
|
|
122
|
+
// });
|
|
123
|
+
// flush(component, mergedComponentToken);
|
|
124
|
+
// return [
|
|
125
|
+
// options.resetStyle === false ? null : genCommonStyle(mergedToken, prefixCls),
|
|
126
|
+
// styleInterpolation,
|
|
127
|
+
// ];
|
|
128
|
+
// },
|
|
129
|
+
// ),
|
|
130
|
+
// hashId,
|
|
131
|
+
// ];
|
|
132
|
+
// };
|
|
133
|
+
// }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
SpecButtonGroupStyle: {
|
|
3
|
+
display: "inline-block";
|
|
4
|
+
verticalAlign: string;
|
|
5
|
+
".ant-btn + .ant-btn": {
|
|
6
|
+
marginLeft: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
SpecButtonGroupCSS: import("antd-style").SerializedStyles;
|
|
10
|
+
SpecButtonGroupTextCSS: import("antd-style").SerializedStyles;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { createStyles } from 'antd-style';
|
|
8
|
+
export var useStyles = createStyles(function (_ref) {
|
|
9
|
+
var token = _ref.token,
|
|
10
|
+
css = _ref.css;
|
|
11
|
+
return {
|
|
12
|
+
// 支持 css object 的写法
|
|
13
|
+
SpecButtonGroupStyle: _defineProperty({
|
|
14
|
+
display: 'inline-block',
|
|
15
|
+
verticalAlign: 'middle'
|
|
16
|
+
}, '.ant-btn + .ant-btn', {
|
|
17
|
+
marginLeft: "".concat(token.paddingSM, "px")
|
|
18
|
+
}),
|
|
19
|
+
// 也支持通过 css 字符串模板获得和 普通 css 一致的书写体验
|
|
20
|
+
SpecButtonGroupCSS: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n vertical-align: middle;\n .ant-btn + .ant-btn {\n margin-left: ", "px;\n }\n "])), token.paddingSM),
|
|
21
|
+
SpecButtonGroupTextCSS: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n cursor: pointer;\n color: ", ";\n\n &[disabled] {\n cursor: not-allowed;\n color: ", ";\n }\n\n & + .spec-button-group-text {\n position: relative;\n margin-left: ", "px;\n\n &:before {\n position: absolute;\n content: '';\n top: 50%;\n left: calc(-", "px / 2);\n transform: translate(0, -50%);\n display: inline-block;\n height: .9em;\n vertical-align: middle;\n border-left: 1px solid ", ";\n\n }\n }\n "])), token.colorPrimary, token.colorTextDisabled, token.paddingSM, token.paddingSM, token.colorBorder)
|
|
22
|
+
};
|
|
23
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var _excluded = ["year", "month"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { Calendar } from 'antd';
|
|
7
|
+
import "./styles/index.less";
|
|
8
|
+
// moment与dayjs不能同时使用,不然locale配置会无效
|
|
9
|
+
// import moment from 'moment'
|
|
10
|
+
//去除RFC2822/ISO date formats的警告
|
|
11
|
+
// moment.suppressDeprecationWarnings = true;
|
|
12
|
+
import dayjs from 'dayjs';
|
|
13
|
+
import 'dayjs/locale/zh-cn';
|
|
14
|
+
dayjs.locale('zh-cn');
|
|
15
|
+
var CalendarMonthPicker = function CalendarMonthPicker(props) {
|
|
16
|
+
var year = props.year,
|
|
17
|
+
month = props.month,
|
|
18
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
var monthRangeDays = useMemo(function () {
|
|
20
|
+
var time = (year || dayjs().year()) + '-01';
|
|
21
|
+
var startTime = dayjs(time).month(month - 1).date(1).startOf("month"); //.format('YYYY-MM-DD')
|
|
22
|
+
var endTime = dayjs(time).month(month - 1).date(1).endOf("month"); //.format('YYYY-MM-DD')
|
|
23
|
+
return [startTime, endTime];
|
|
24
|
+
}, [year]);
|
|
25
|
+
// dayjs.locale('zh-cn')
|
|
26
|
+
return /*#__PURE__*/React.createElement(Calendar, _extends({
|
|
27
|
+
fullscreen: false,
|
|
28
|
+
value: dayjs((year || dayjs().year()) + '-' + month),
|
|
29
|
+
validRange: monthRangeDays
|
|
30
|
+
}, others));
|
|
31
|
+
};
|
|
32
|
+
export default CalendarMonthPicker;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { Button } from 'antd';
|
|
9
|
+
// import type { CalendarProps } from 'antd';
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
|
+
import "./styles/index.less";
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
|
14
|
+
import CalendarMonthPicker from "./CalendarMonthPicker";
|
|
15
|
+
import useStyle from "./styles";
|
|
16
|
+
var CalendarCoordPicker = function CalendarCoordPicker(props) {
|
|
17
|
+
var _props$type = props.type,
|
|
18
|
+
type = _props$type === void 0 ? 'directPick' : _props$type,
|
|
19
|
+
year = props.year;
|
|
20
|
+
var componentName = 'spec-calendar-coordinate';
|
|
21
|
+
var _useStyle = useStyle(componentName),
|
|
22
|
+
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
23
|
+
wrapSSR = _useStyle2[0],
|
|
24
|
+
hashId = _useStyle2[1];
|
|
25
|
+
var _useState = useState(dayjs().year()),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
yearNum = _useState2[0],
|
|
28
|
+
setYearNum = _useState2[1];
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setYearNum(year || dayjs().year());
|
|
31
|
+
}, [year]);
|
|
32
|
+
// const cellDays = useMemo(() => {
|
|
33
|
+
// return
|
|
34
|
+
// }, [])
|
|
35
|
+
// const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
|
|
36
|
+
// console.log(value.format('YYYY-MM-DD'), mode);
|
|
37
|
+
// };
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
// 获取日历格子元素
|
|
40
|
+
// var calendarCells = document.querySelectorAll('.calendar-cell');
|
|
41
|
+
var calendarCells = document.querySelectorAll('.ant-picker-cell');
|
|
42
|
+
// console.log('calendarCells', calendarCells)
|
|
43
|
+
// console.log('calendarCells', document.getElementsByClassName('ant-picker-cell-in-view'))
|
|
44
|
+
// 记录鼠标按下的位置
|
|
45
|
+
var startX, startY;
|
|
46
|
+
|
|
47
|
+
// 记录鼠标框选的起始位置和结束位置
|
|
48
|
+
// let startCell: any;
|
|
49
|
+
var endCell;
|
|
50
|
+
var startCellIndex, endCellIndex;
|
|
51
|
+
var startCellRect, endCellRect;
|
|
52
|
+
var cellSelectProcessing = false;
|
|
53
|
+
|
|
54
|
+
// 监听鼠标按下事件
|
|
55
|
+
document.addEventListener('mousedown', function (event) {
|
|
56
|
+
// 记录鼠标按下的位置
|
|
57
|
+
startX = event.clientX;
|
|
58
|
+
startY = event.clientY;
|
|
59
|
+
var startCellConfig = getCellFromCoordinates(startX, startY);
|
|
60
|
+
// 获取鼠标按下的日历格子
|
|
61
|
+
// startCell = startCellConfig.cell;
|
|
62
|
+
startCellIndex = startCellConfig.cellIndex;
|
|
63
|
+
startCellRect = startCellConfig.cellRect;
|
|
64
|
+
cellSelectProcessing = true;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// 监听鼠标移动事件
|
|
68
|
+
document.addEventListener('mousemove', function (event) {
|
|
69
|
+
// 获取鼠标移动的位置
|
|
70
|
+
var currentX = event.clientX;
|
|
71
|
+
var currentY = event.clientY;
|
|
72
|
+
|
|
73
|
+
// 获取鼠标移动的日历格子
|
|
74
|
+
var currentCellConfig = getCellFromCoordinates(currentX, currentY);
|
|
75
|
+
var currentCell = currentCellConfig.cell;
|
|
76
|
+
var currentCellIndex = currentCellConfig.cellIndex;
|
|
77
|
+
var currentCellRect = currentCellConfig.cellRect;
|
|
78
|
+
|
|
79
|
+
// 如果鼠标移动的日历格子不为空,则进行框选
|
|
80
|
+
if (cellSelectProcessing && currentCell) {
|
|
81
|
+
// 清除之前的框选样式
|
|
82
|
+
clearSelection();
|
|
83
|
+
// 设置当前日历格子的框选样式
|
|
84
|
+
// currentCell.classList.add('spec-calendar-coordinate-picker__order-selected');
|
|
85
|
+
// 记录结束位置
|
|
86
|
+
endCell = currentCell;
|
|
87
|
+
endCellIndex = currentCellIndex;
|
|
88
|
+
endCellRect = currentCellRect;
|
|
89
|
+
type === 'orderPick' ? getCellSelected() : getCellCoordinate();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// 监听鼠标松开事件
|
|
94
|
+
document.addEventListener('mouseup', function (event) {
|
|
95
|
+
// 清除框选样式
|
|
96
|
+
clearSelection();
|
|
97
|
+
|
|
98
|
+
// 获取鼠标松开的位置
|
|
99
|
+
var endX = event.clientX;
|
|
100
|
+
var endY = event.clientY;
|
|
101
|
+
|
|
102
|
+
// 获取鼠标松开的日历格子
|
|
103
|
+
var endCellConfig = getCellFromCoordinates(endX, endY);
|
|
104
|
+
endCell = endCellConfig.cell;
|
|
105
|
+
endCellIndex = endCellConfig.cellIndex;
|
|
106
|
+
endCellRect = endCellConfig.cellRect;
|
|
107
|
+
|
|
108
|
+
// 如果鼠标松开的日历格子不为空,则进行框选
|
|
109
|
+
if (endCell) {
|
|
110
|
+
type === 'orderPick' ? getCellSelected() : getCellCoordinate();
|
|
111
|
+
}
|
|
112
|
+
cellSelectProcessing = false;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// 按坐标内的顺序选中
|
|
116
|
+
var getCellSelected = function getCellSelected() {
|
|
117
|
+
for (var i = Math.min(startCellIndex, endCellIndex); i <= Math.max(startCellIndex, endCellIndex); i++) {
|
|
118
|
+
// const rect = calendarCells[i].getBoundingClientRect();
|
|
119
|
+
if (calendarCells[i].classList.contains('ant-picker-cell-in-view')) {
|
|
120
|
+
calendarCells[i].classList.add('spec-calendar-coordinate-picker__order-selected');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// 按坐标内的范围选中
|
|
125
|
+
var getCellCoordinate = function getCellCoordinate() {
|
|
126
|
+
var _startCellRect, _endCellRect, _startCellRect2, _endCellRect2, _startCellRect3, _endCellRect3;
|
|
127
|
+
var direct = ''; // 选中单元格方位
|
|
128
|
+
if (!startCellRect && !endCellRect) return;
|
|
129
|
+
if (((_startCellRect = startCellRect) === null || _startCellRect === void 0 ? void 0 : _startCellRect.x) === ((_endCellRect = endCellRect) === null || _endCellRect === void 0 ? void 0 : _endCellRect.x)) {
|
|
130
|
+
if (startCellRect.y === endCellRect.y) {
|
|
131
|
+
direct = 'center';
|
|
132
|
+
} else if (startCellRect.y > endCellRect.y) {
|
|
133
|
+
direct = 'centerTop';
|
|
134
|
+
} else if (startCellRect.y < endCellRect.y) {
|
|
135
|
+
direct = 'centerBottom';
|
|
136
|
+
}
|
|
137
|
+
} else if (((_startCellRect2 = startCellRect) === null || _startCellRect2 === void 0 ? void 0 : _startCellRect2.x) > ((_endCellRect2 = endCellRect) === null || _endCellRect2 === void 0 ? void 0 : _endCellRect2.x)) {
|
|
138
|
+
if (startCellRect.y === endCellRect.y) {
|
|
139
|
+
direct = 'centerLeft';
|
|
140
|
+
} else if (startCellRect.y > endCellRect.y) {
|
|
141
|
+
direct = 'leftTop';
|
|
142
|
+
} else if (startCellRect.y < endCellRect.y) {
|
|
143
|
+
direct = 'leftBottom';
|
|
144
|
+
}
|
|
145
|
+
} else if (((_startCellRect3 = startCellRect) === null || _startCellRect3 === void 0 ? void 0 : _startCellRect3.x) < ((_endCellRect3 = endCellRect) === null || _endCellRect3 === void 0 ? void 0 : _endCellRect3.x)) {
|
|
146
|
+
if (startCellRect.y === endCellRect.y) {
|
|
147
|
+
direct = 'centerRight';
|
|
148
|
+
} else if (startCellRect.y > endCellRect.y) {
|
|
149
|
+
direct = 'rightTop';
|
|
150
|
+
} else if (startCellRect.y < endCellRect.y) {
|
|
151
|
+
direct = 'rightBottom';
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
var selectedCells = []; // 过滤当前选中的单元格
|
|
155
|
+
for (var i = 0; i < calendarCells.length; i++) {
|
|
156
|
+
var rect = calendarCells[i].getBoundingClientRect();
|
|
157
|
+
if (rect && calendarCells[i].classList.contains('ant-picker-cell-in-view')) {
|
|
158
|
+
switch (direct) {
|
|
159
|
+
case 'center':
|
|
160
|
+
if (rect.x === endCellRect.x && rect.y === endCellRect.y) {
|
|
161
|
+
selectedCells.push(calendarCells[i]);
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case 'centerTop':
|
|
165
|
+
if (rect.x === endCellRect.x && rect.y >= endCellRect.y && rect.x === endCellRect.x && rect.y <= startCellRect.y) {
|
|
166
|
+
selectedCells.push(calendarCells[i]);
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case 'centerBottom':
|
|
170
|
+
if (rect.x === endCellRect.x && rect.y <= endCellRect.y && rect.x === endCellRect.x && rect.y >= startCellRect.y) {
|
|
171
|
+
selectedCells.push(calendarCells[i]);
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case 'centerRight':
|
|
175
|
+
if (rect.y === endCellRect.y && rect.x <= endCellRect.x && rect.y === endCellRect.y && rect.x >= startCellRect.x) {
|
|
176
|
+
selectedCells.push(calendarCells[i]);
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case 'rightBottom':
|
|
180
|
+
if (rect.y >= startCellRect.y && rect.y <= endCellRect.y && rect.x >= startCellRect.x && rect.x <= endCellRect.x) {
|
|
181
|
+
selectedCells.push(calendarCells[i]);
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case 'rightTop':
|
|
185
|
+
if (rect.x >= startCellRect.x && rect.x <= endCellRect.x && rect.y >= endCellRect.y && rect.y <= startCellRect.y) {
|
|
186
|
+
selectedCells.push(calendarCells[i]);
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case 'centerLeft':
|
|
190
|
+
if (rect.y === endCellRect.y && rect.x >= endCellRect.x && rect.y === endCellRect.y && rect.x <= startCellRect.x) {
|
|
191
|
+
selectedCells.push(calendarCells[i]);
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
case 'leftBottom':
|
|
195
|
+
if (rect.y >= startCellRect.y && rect.y <= endCellRect.y && rect.x <= startCellRect.x && rect.x >= endCellRect.x) {
|
|
196
|
+
selectedCells.push(calendarCells[i]);
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case 'leftTop':
|
|
200
|
+
if (rect.y <= startCellRect.y && rect.y >= endCellRect.y && rect.x <= startCellRect.x && rect.x >= endCellRect.x) {
|
|
201
|
+
selectedCells.push(calendarCells[i]);
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// console.log('selectedCells', calendarCells)
|
|
208
|
+
for (var j = 0; j < selectedCells.length; j++) {
|
|
209
|
+
// rect.x >= startX && rect.x <= overX && rect.y >= startY && rect.y <= overY
|
|
210
|
+
selectedCells[j].classList.add('spec-calendar-coordinate-picker__directed-selected');
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
// 获取指定坐标的日历格子(按坐标)
|
|
214
|
+
var getCellFromCoordinates = function getCellFromCoordinates(x, y) {
|
|
215
|
+
var cell = null;
|
|
216
|
+
var cellIndex = null;
|
|
217
|
+
var cellRect = null; // 当前格子的坐标信息
|
|
218
|
+
// 遍历所有日历格子
|
|
219
|
+
for (var i = 0; i < calendarCells.length; i++) {
|
|
220
|
+
var rect = calendarCells[i].getBoundingClientRect();
|
|
221
|
+
// 判断坐标是否在日历格子的范围内
|
|
222
|
+
if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
|
|
223
|
+
cell = calendarCells[i];
|
|
224
|
+
cellIndex = i;
|
|
225
|
+
cellRect = rect;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
cellIndex: cellIndex,
|
|
231
|
+
cell: cell,
|
|
232
|
+
cellRect: cellRect
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// 清除框选样式
|
|
237
|
+
var clearSelection = function clearSelection() {
|
|
238
|
+
for (var i = 0; i < calendarCells.length; i++) {
|
|
239
|
+
calendarCells[i].classList.remove('spec-calendar-coordinate-picker__order-selected');
|
|
240
|
+
calendarCells[i].classList.remove('spec-calendar-coordinate-picker__directed-selected');
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return function () {
|
|
244
|
+
document.removeEventListener('mousedown', function () {}, false);
|
|
245
|
+
document.removeEventListener('mousemove', function () {}, false);
|
|
246
|
+
document.removeEventListener('mouseup', function () {}, false);
|
|
247
|
+
};
|
|
248
|
+
}, [type]);
|
|
249
|
+
var renderPickerHeader = function renderPickerHeader(_ref) {
|
|
250
|
+
var value = _ref.value;
|
|
251
|
+
//
|
|
252
|
+
// const start = 0;
|
|
253
|
+
// const end = 12;
|
|
254
|
+
// const monthOptions = [];
|
|
255
|
+
var current = value.clone();
|
|
256
|
+
var localeData = value.localeData();
|
|
257
|
+
var months = [];
|
|
258
|
+
for (var i = 0; i < 12; i++) {
|
|
259
|
+
current.month(i);
|
|
260
|
+
months.push(localeData.monthsShort(current));
|
|
261
|
+
}
|
|
262
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
263
|
+
style: {
|
|
264
|
+
textAlign: 'right',
|
|
265
|
+
fontSize: '16px',
|
|
266
|
+
paddingRight: '10px'
|
|
267
|
+
}
|
|
268
|
+
}, months[value.month()]);
|
|
269
|
+
};
|
|
270
|
+
var monthArray = useMemo(function () {
|
|
271
|
+
var months = [];
|
|
272
|
+
for (var i = 0; i < 12; i++) {
|
|
273
|
+
months.push(i + 1);
|
|
274
|
+
}
|
|
275
|
+
return months;
|
|
276
|
+
}, []);
|
|
277
|
+
return wrapSSR( /*#__PURE__*/React.createElement("div", {
|
|
278
|
+
className: classNames(componentName, hashId)
|
|
279
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
280
|
+
className: 'spec-calendar-coordinate-header'
|
|
281
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: 'spec-calendar-coordinate-header-action prev'
|
|
283
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
284
|
+
size: 'small',
|
|
285
|
+
icon: /*#__PURE__*/React.createElement(LeftOutlined, null),
|
|
286
|
+
title: "".concat(yearNum - 1, "\u5E74"),
|
|
287
|
+
onClick: function onClick() {
|
|
288
|
+
return setYearNum(yearNum - 1);
|
|
289
|
+
}
|
|
290
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: 'spec-calendar-coordinate-header-year'
|
|
292
|
+
}, yearNum, "\u5E74"), /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: 'spec-calendar-coordinate-header-action next'
|
|
294
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
295
|
+
size: 'small',
|
|
296
|
+
icon: /*#__PURE__*/React.createElement(RightOutlined, null),
|
|
297
|
+
title: "".concat(yearNum + 1, "\u5E74"),
|
|
298
|
+
onClick: function onClick() {
|
|
299
|
+
return setYearNum(yearNum + 1);
|
|
300
|
+
}
|
|
301
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
302
|
+
className: 'spec-calendar-coordinate-picker'
|
|
303
|
+
}, monthArray.map(function (mItem) {
|
|
304
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
className: 'spec-calendar-coordinate-picker-col',
|
|
306
|
+
key: mItem
|
|
307
|
+
}, /*#__PURE__*/React.createElement(CalendarMonthPicker, {
|
|
308
|
+
month: mItem,
|
|
309
|
+
year: yearNum,
|
|
310
|
+
headerRender: renderPickerHeader
|
|
311
|
+
}));
|
|
312
|
+
}))));
|
|
313
|
+
};
|
|
314
|
+
export default CalendarCoordPicker;
|