amis-ui 1.0.0-beta.0
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/dist/components/404.d.ts +54 -0
- package/dist/components/404.js +44 -0
- package/dist/components/Alert.d.ts +560 -0
- package/dist/components/Alert.js +201 -0
- package/dist/components/Alert2.d.ts +66 -0
- package/dist/components/Alert2.js +69 -0
- package/dist/components/AnchorNav.d.ts +118 -0
- package/dist/components/AnchorNav.js +181 -0
- package/dist/components/ArrayInput.d.ts +625 -0
- package/dist/components/ArrayInput.js +162 -0
- package/dist/components/AsideNav.d.ts +142 -0
- package/dist/components/AsideNav.js +139 -0
- package/dist/components/AssociatedSelection.d.ts +491 -0
- package/dist/components/AssociatedSelection.js +113 -0
- package/dist/components/Avatar.d.ts +113 -0
- package/dist/components/Avatar.js +150 -0
- package/dist/components/Badge.d.ts +120 -0
- package/dist/components/BaiduMapPicker.d.ts +86 -0
- package/dist/components/BarCode.d.ts +58 -0
- package/dist/components/Breadcrumb.d.ts +115 -0
- package/dist/components/Breadcrumb.js +173 -0
- package/dist/components/Button.d.ts +74 -0
- package/dist/components/Button.js +73 -0
- package/dist/components/CalendarMobile.d.ts +353 -0
- package/dist/components/CalendarMobile.js +541 -0
- package/dist/components/Card.d.ts +75 -0
- package/dist/components/Cascader.d.ts +109 -0
- package/dist/components/ChainedSelection.d.ts +480 -0
- package/dist/components/ChainedSelection.js +131 -0
- package/dist/components/Checkbox.d.ts +69 -0
- package/dist/components/Checkbox.js +73 -0
- package/dist/components/CityArea.d.ts +307 -0
- package/dist/components/CityDB.d.ts +13 -0
- package/dist/components/CodeMirror.d.ts +25 -0
- package/dist/components/CodeMirror.js +113 -0
- package/dist/components/Collapse.d.ts +92 -0
- package/dist/components/Collapse.js +166 -0
- package/dist/components/CollapseGroup.d.ts +68 -0
- package/dist/components/CollapseGroup.js +96 -0
- package/dist/components/ColorPicker.d.ts +524 -0
- package/dist/components/ContextMenu.d.ts +96 -0
- package/dist/components/ContextMenu.js +225 -0
- package/dist/components/DatePicker.d.ts +619 -0
- package/dist/components/DatePicker.js +534 -0
- package/dist/components/DateRangePicker.d.ts +876 -0
- package/dist/components/DateRangePicker.js +1050 -0
- package/dist/components/Drawer.d.ts +95 -0
- package/dist/components/Drawer.js +262 -0
- package/dist/components/Editor.d.ts +605 -0
- package/dist/components/Editor.js +245 -0
- package/dist/components/Form.d.ts +22 -0
- package/dist/components/FormField.d.ts +65 -0
- package/dist/components/GridNav.d.ts +52 -0
- package/dist/components/GroupedSelection.d.ts +467 -0
- package/dist/components/GroupedSelection.js +71 -0
- package/dist/components/Html.d.ts +83 -0
- package/dist/components/Html.js +61 -0
- package/dist/components/ImageGallery.d.ts +297 -0
- package/dist/components/Input.d.ts +16 -0
- package/dist/components/Input.js +70 -0
- package/dist/components/InputBox.d.ts +99 -0
- package/dist/components/InputBox.js +106 -0
- package/dist/components/InputBoxWithSuggestion.d.ts +280 -0
- package/dist/components/InputBoxWithSuggestion.js +75 -0
- package/dist/components/Layout.d.ts +144 -0
- package/dist/components/Layout.js +75 -0
- package/dist/components/Link.d.ts +62 -0
- package/dist/components/ListGroup.d.ts +76 -0
- package/dist/components/ListGroup.js +40 -0
- package/dist/components/ListMenu.d.ts +573 -0
- package/dist/components/LocationPicker.d.ts +427 -0
- package/dist/components/Markdown.d.ts +20 -0
- package/dist/components/Modal.d.ts +1278 -0
- package/dist/components/Modal.js +159 -0
- package/dist/components/ModalManager.d.ts +17 -0
- package/dist/components/ModalManager.js +53 -0
- package/dist/components/MonthRangePicker.d.ts +748 -0
- package/dist/components/NumberInput.d.ts +89 -0
- package/dist/components/NumberInput.js +147 -0
- package/dist/components/Overlay.d.ts +41 -0
- package/dist/components/Overlay.js +218 -0
- package/dist/components/Pagination.d.ts +685 -0
- package/dist/components/Picker.d.ts +284 -0
- package/dist/components/Picker.js +82 -0
- package/dist/components/PickerColumn.d.ts +63 -0
- package/dist/components/PickerColumn.js +285 -0
- package/dist/components/PickerContainer.d.ts +303 -0
- package/dist/components/PickerContainer.js +158 -0
- package/dist/components/PopOver.d.ts +90 -0
- package/dist/components/PopOver.js +98 -0
- package/dist/components/PopOverContainer.d.ts +28 -0
- package/dist/components/PopOverContainer.js +101 -0
- package/dist/components/PopUp.d.ts +578 -0
- package/dist/components/PopUp.js +96 -0
- package/dist/components/Progress.d.ts +68 -0
- package/dist/components/PullRefresh.d.ts +64 -0
- package/dist/components/PullRefresh.js +149 -0
- package/dist/components/Radios.d.ts +180 -0
- package/dist/components/Radios.js +121 -0
- package/dist/components/Range.d.ts +122 -0
- package/dist/components/Range.js +418 -0
- package/dist/components/Rating.d.ts +252 -0
- package/dist/components/Rating.js +324 -0
- package/dist/components/ResultBox.d.ts +290 -0
- package/dist/components/ResultBox.js +156 -0
- package/dist/components/ResultList.d.ts +319 -0
- package/dist/components/ResultList.js +192 -0
- package/dist/components/ResultTableList.d.ts +708 -0
- package/dist/components/ResultTableList.js +135 -0
- package/dist/components/ResultTreeList.d.ts +308 -0
- package/dist/components/ResultTreeList.js +217 -0
- package/dist/components/RichText.d.ts +45 -0
- package/dist/components/SearchBox.d.ts +504 -0
- package/dist/components/SearchBox.js +137 -0
- package/dist/components/Select.d.ts +6280 -0
- package/dist/components/Select.js +772 -0
- package/dist/components/Selection.d.ts +510 -0
- package/dist/components/Selection.js +151 -0
- package/dist/components/SparkLine.d.ts +403 -0
- package/dist/components/SparkLine.js +71 -0
- package/dist/components/Spinner.d.ts +174 -0
- package/dist/components/Spinner.js +77 -0
- package/dist/components/Steps.d.ts +110 -0
- package/dist/components/Switch.d.ts +101 -0
- package/dist/components/Switch.js +73 -0
- package/dist/components/TableSelection.d.ts +695 -0
- package/dist/components/TableSelection.js +88 -0
- package/dist/components/Tabs.d.ts +210 -0
- package/dist/components/Tabs.js +486 -0
- package/dist/components/TabsTransfer.d.ts +297 -0
- package/dist/components/TabsTransfer.js +220 -0
- package/dist/components/TabsTransferPicker.d.ts +273 -0
- package/dist/components/Tag.d.ts +104 -0
- package/dist/components/Textarea.d.ts +568 -0
- package/dist/components/Textarea.js +144 -0
- package/dist/components/Timeline.d.ts +47 -0
- package/dist/components/TimelineItem.d.ts +297 -0
- package/dist/components/Tinymce.d.ts +55 -0
- package/dist/components/TitleBar.d.ts +115 -0
- package/dist/components/TitleBar.js +57 -0
- package/dist/components/Toast.d.ts +358 -0
- package/dist/components/Toast.js +260 -0
- package/dist/components/Tooltip.d.ts +65 -0
- package/dist/components/Tooltip.js +45 -0
- package/dist/components/TooltipWrapper.d.ts +155 -0
- package/dist/components/TooltipWrapper.js +192 -0
- package/dist/components/Transfer.d.ts +1243 -0
- package/dist/components/Transfer.js +332 -0
- package/dist/components/TransferDropDown.d.ts +271 -0
- package/dist/components/TransferPicker.d.ts +277 -0
- package/dist/components/TransferSearch.d.ts +292 -0
- package/dist/components/TransferSearch.js +104 -0
- package/dist/components/Tree.d.ts +1708 -0
- package/dist/components/Tree.js +773 -0
- package/dist/components/TreeSelection.d.ts +526 -0
- package/dist/components/TreeSelection.js +209 -0
- package/dist/components/UserSelect.d.ts +500 -0
- package/dist/components/UserTabSelect.d.ts +320 -0
- package/dist/components/WithRemoteConfig.d.ts +386 -0
- package/dist/components/WithRemoteConfig.js +268 -0
- package/dist/components/WithStore.d.ts +75 -0
- package/dist/components/WithStore.js +57 -0
- package/dist/components/calendar/Calendar.d.ts +64 -0
- package/dist/components/calendar/Calendar.js +499 -0
- package/dist/components/calendar/CalendarContainer.d.ts +10 -0
- package/dist/components/calendar/CalendarContainer.js +35 -0
- package/dist/components/calendar/DaysView.d.ts +170 -0
- package/dist/components/calendar/DaysView.js +453 -0
- package/dist/components/calendar/MonthsView.d.ts +128 -0
- package/dist/components/calendar/MonthsView.js +168 -0
- package/dist/components/calendar/QuartersView.d.ts +92 -0
- package/dist/components/calendar/QuartersView.js +93 -0
- package/dist/components/calendar/TimeView.d.ts +178 -0
- package/dist/components/calendar/TimeView.js +474 -0
- package/dist/components/calendar/YearsView.d.ts +102 -0
- package/dist/components/calendar/YearsView.js +131 -0
- package/dist/components/condition-builder/Expression.d.ts +298 -0
- package/dist/components/condition-builder/Field.d.ts +280 -0
- package/dist/components/condition-builder/Formula.d.ts +269 -0
- package/dist/components/condition-builder/Func.d.ts +279 -0
- package/dist/components/condition-builder/Group.d.ts +296 -0
- package/dist/components/condition-builder/GroupOrItem.d.ts +72 -0
- package/dist/components/condition-builder/InputSwitch.d.ts +47 -0
- package/dist/components/condition-builder/Item.d.ts +292 -0
- package/dist/components/condition-builder/Value.d.ts +277 -0
- package/dist/components/condition-builder/config.d.ts +35 -0
- package/dist/components/condition-builder/index.d.ts +303 -0
- package/dist/components/condition-builder/types.d.ts +150 -0
- package/dist/components/formula/Editor.d.ts +362 -0
- package/dist/components/formula/Editor.js +217 -0
- package/dist/components/formula/FuncList.d.ts +48 -0
- package/dist/components/formula/FuncList.js +57 -0
- package/dist/components/formula/Picker.d.ts +440 -0
- package/dist/components/formula/Picker.js +231 -0
- package/dist/components/formula/VariableList.d.ts +54 -0
- package/dist/components/formula/VariableList.js +49 -0
- package/dist/components/formula/plugin.d.ts +27 -0
- package/dist/components/formula/plugin.js +211 -0
- package/dist/components/icons.d.ts +45 -0
- package/dist/components/icons.js +270 -0
- package/dist/components/index.d.ts +64 -0
- package/dist/components/json-schema/Array.d.ts +3 -0
- package/dist/components/json-schema/Array.js +136 -0
- package/dist/components/json-schema/Item.d.ts +3 -0
- package/dist/components/json-schema/Item.js +45 -0
- package/dist/components/json-schema/Object.d.ts +3 -0
- package/dist/components/json-schema/Object.js +189 -0
- package/dist/components/json-schema/index.d.ts +277 -0
- package/dist/components/json-schema/index.js +28 -0
- package/dist/components/schema-editor/Array.d.ts +11 -0
- package/dist/components/schema-editor/Common.d.ts +29 -0
- package/dist/components/schema-editor/Item.d.ts +8 -0
- package/dist/components/schema-editor/Object.d.ts +44 -0
- package/dist/components/schema-editor/SchemaVariableList.d.ts +193 -0
- package/dist/components/schema-editor/SchemaVariableList.js +83 -0
- package/dist/components/schema-editor/SchemaVariableListPicker.d.ts +186 -0
- package/dist/components/schema-editor/SchemaVariableListPicker.js +43 -0
- package/dist/components/schema-editor/index.d.ts +303 -0
- package/dist/components/table/Cell.d.ts +489 -0
- package/dist/components/table/Cell.js +47 -0
- package/dist/components/table/HeadCellDropDown.d.ts +293 -0
- package/dist/components/table/HeadCellDropDown.js +64 -0
- package/dist/components/table/HeadCellFilter.d.ts +419 -0
- package/dist/components/table/HeadCellFilter.js +146 -0
- package/dist/components/table/HeadCellSelect.d.ts +364 -0
- package/dist/components/table/HeadCellSelect.js +57 -0
- package/dist/components/table/HeadCellSort.d.ts +278 -0
- package/dist/components/table/HeadCellSort.js +83 -0
- package/dist/components/table/ItemActionsWrapper.d.ts +10 -0
- package/dist/components/table/ItemActionsWrapper.js +37 -0
- package/dist/components/table/index.d.ts +794 -0
- package/dist/components/table/index.js +1250 -0
- package/dist/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/dist/components/virtual-list/SizeAndPositionManager.js +220 -0
- package/dist/components/virtual-list/constants.d.ts +34 -0
- package/dist/components/virtual-list/constants.js +53 -0
- package/dist/components/virtual-list/index.d.ts +94 -0
- package/dist/components/virtual-list/index.js +309 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/use-set-state.d.ts +2 -0
- package/dist/hooks/use-set-state.js +27 -0
- package/dist/hooks/use-touch.d.ts +16 -0
- package/dist/hooks/use-touch.js +81 -0
- package/dist/hooks/use-update-effect.d.ts +3 -0
- package/dist/hooks/use-update-effect.js +25 -0
- package/dist/hooks/use-validation-resolver.d.ts +2 -0
- package/dist/hooks/use-validation-resolver.js +59 -0
- package/dist/icons/alert-danger.svg.js +48 -0
- package/dist/icons/alert-info.svg.js +48 -0
- package/dist/icons/alert-success.svg.js +48 -0
- package/dist/icons/alert-warning.svg.js +48 -0
- package/dist/icons/back.svg.js +47 -0
- package/dist/icons/calendar.svg.js +56 -0
- package/dist/icons/caret.svg.js +46 -0
- package/dist/icons/check.svg.js +45 -0
- package/dist/icons/clock.svg.js +56 -0
- package/dist/icons/close-small.svg.js +49 -0
- package/dist/icons/close.svg.js +45 -0
- package/dist/icons/cloud-upload.svg.js +57 -0
- package/dist/icons/column-filter.svg.js +47 -0
- package/dist/icons/columns.svg.js +46 -0
- package/dist/icons/compress-alt.svg.js +46 -0
- package/dist/icons/copy.svg.js +51 -0
- package/dist/icons/date.svg.js +52 -0
- package/dist/icons/department.svg.js +78 -0
- package/dist/icons/desk-empty.svg.js +99 -0
- package/dist/icons/dot.svg.js +62 -0
- package/dist/icons/down-arrow-bold.svg.js +48 -0
- package/dist/icons/download.svg.js +50 -0
- package/dist/icons/drag-bar.svg.js +79 -0
- package/dist/icons/drag.svg.js +48 -0
- package/dist/icons/edit.svg.js +48 -0
- package/dist/icons/ellipsis-v.svg.js +47 -0
- package/dist/icons/enter.svg.js +45 -0
- package/dist/icons/exchange.svg.js +47 -0
- package/dist/icons/expand-alt.svg.js +46 -0
- package/dist/icons/fail.svg.js +54 -0
- package/dist/icons/file.svg.js +47 -0
- package/dist/icons/filter.svg.js +46 -0
- package/dist/icons/folder.svg.js +49 -0
- package/dist/icons/function.svg.js +48 -0
- package/dist/icons/home.svg.js +46 -0
- package/dist/icons/image.svg.js +45 -0
- package/dist/icons/info-circle.svg.js +46 -0
- package/dist/icons/info.svg.js +52 -0
- package/dist/icons/input-clear.svg.js +48 -0
- package/dist/icons/invisible.svg.js +48 -0
- package/dist/icons/left-arrow.svg.js +46 -0
- package/dist/icons/loading-outline.svg.js +49 -0
- package/dist/icons/location.svg.js +46 -0
- package/dist/icons/menu.svg.js +48 -0
- package/dist/icons/minus.svg.js +46 -0
- package/dist/icons/move.svg.js +47 -0
- package/dist/icons/mute.svg.js +46 -0
- package/dist/icons/pause.svg.js +46 -0
- package/dist/icons/pencil.svg.js +46 -0
- package/dist/icons/play.svg.js +45 -0
- package/dist/icons/plus-cicle.svg.js +47 -0
- package/dist/icons/plus-fine.svg.js +48 -0
- package/dist/icons/plus.svg.js +47 -0
- package/dist/icons/post.svg.js +74 -0
- package/dist/icons/question-mark.svg.js +51 -0
- package/dist/icons/question.svg.js +46 -0
- package/dist/icons/redo.svg.js +46 -0
- package/dist/icons/refresh.svg.js +47 -0
- package/dist/icons/reload.svg.js +46 -0
- package/dist/icons/remove.svg.js +48 -0
- package/dist/icons/retry.svg.js +51 -0
- package/dist/icons/right-arrow-bold.svg.js +46 -0
- package/dist/icons/right-arrow.svg.js +46 -0
- package/dist/icons/role.svg.js +69 -0
- package/dist/icons/schedule.svg.js +49 -0
- package/dist/icons/search.svg.js +45 -0
- package/dist/icons/setting.svg.js +47 -0
- package/dist/icons/slider-handle-icon.svg.js +48 -0
- package/dist/icons/sort-asc.svg.js +46 -0
- package/dist/icons/sort-default.svg.js +47 -0
- package/dist/icons/sort-desc.svg.js +46 -0
- package/dist/icons/star.svg.js +47 -0
- package/dist/icons/status-close.svg.js +49 -0
- package/dist/icons/status-fail.svg.js +48 -0
- package/dist/icons/status-info.svg.js +52 -0
- package/dist/icons/status-success.svg.js +48 -0
- package/dist/icons/status-warning.svg.js +52 -0
- package/dist/icons/success.svg.js +52 -0
- package/dist/icons/transparent.svg.js +65 -0
- package/dist/icons/trash.svg.js +48 -0
- package/dist/icons/tree-down.svg.js +47 -0
- package/dist/icons/undo.svg.js +46 -0
- package/dist/icons/upload.svg.js +48 -0
- package/dist/icons/user-remove.svg.js +59 -0
- package/dist/icons/view.svg.js +48 -0
- package/dist/icons/volume.svg.js +49 -0
- package/dist/icons/warning-mark.svg.js +49 -0
- package/dist/icons/warning.svg.js +46 -0
- package/dist/icons/window-restore.svg.js +46 -0
- package/dist/icons/zoom-in.svg.js +46 -0
- package/dist/icons/zoom-out.svg.js +46 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +151 -0
- package/dist/locale/de-DE.d.ts +1 -0
- package/dist/locale/de-DE.js +344 -0
- package/dist/locale/en-US.d.ts +1 -0
- package/dist/locale/en-US.js +347 -0
- package/dist/locale/zh-CN.d.ts +1 -0
- package/dist/locale/zh-CN.js +358 -0
- package/dist/themes/ang.d.ts +3 -0
- package/dist/themes/ang.js +20 -0
- package/dist/themes/antd.d.ts +1 -0
- package/dist/themes/antd.js +44 -0
- package/dist/themes/cxd.d.ts +3 -0
- package/dist/themes/cxd.js +459 -0
- package/dist/themes/dark.d.ts +3 -0
- package/dist/themes/dark.js +28 -0
- package/dist/themes/default.d.ts +4 -0
- package/esm-dist/components/404.d.ts +54 -0
- package/esm-dist/components/404.js +35 -0
- package/esm-dist/components/Alert.d.ts +560 -0
- package/esm-dist/components/Alert.js +188 -0
- package/esm-dist/components/Alert2.d.ts +66 -0
- package/esm-dist/components/Alert2.js +60 -0
- package/esm-dist/components/AnchorNav.d.ts +118 -0
- package/esm-dist/components/AnchorNav.js +171 -0
- package/esm-dist/components/ArrayInput.d.ts +625 -0
- package/esm-dist/components/ArrayInput.js +152 -0
- package/esm-dist/components/AsideNav.d.ts +142 -0
- package/esm-dist/components/AsideNav.js +130 -0
- package/esm-dist/components/AssociatedSelection.d.ts +491 -0
- package/esm-dist/components/AssociatedSelection.js +104 -0
- package/esm-dist/components/Avatar.d.ts +113 -0
- package/esm-dist/components/Avatar.js +125 -0
- package/esm-dist/components/Badge.d.ts +120 -0
- package/esm-dist/components/BaiduMapPicker.d.ts +86 -0
- package/esm-dist/components/BarCode.d.ts +58 -0
- package/esm-dist/components/Breadcrumb.d.ts +115 -0
- package/esm-dist/components/Breadcrumb.js +163 -0
- package/esm-dist/components/Button.d.ts +74 -0
- package/esm-dist/components/Button.js +64 -0
- package/esm-dist/components/CalendarMobile.d.ts +353 -0
- package/esm-dist/components/CalendarMobile.js +531 -0
- package/esm-dist/components/Card.d.ts +75 -0
- package/esm-dist/components/Cascader.d.ts +109 -0
- package/esm-dist/components/ChainedSelection.d.ts +480 -0
- package/esm-dist/components/ChainedSelection.js +121 -0
- package/esm-dist/components/Checkbox.d.ts +69 -0
- package/esm-dist/components/Checkbox.js +64 -0
- package/esm-dist/components/CityArea.d.ts +307 -0
- package/esm-dist/components/CityDB.d.ts +13 -0
- package/esm-dist/components/CodeMirror.d.ts +25 -0
- package/esm-dist/components/CodeMirror.js +104 -0
- package/esm-dist/components/Collapse.d.ts +92 -0
- package/esm-dist/components/Collapse.js +156 -0
- package/esm-dist/components/CollapseGroup.d.ts +68 -0
- package/esm-dist/components/CollapseGroup.js +88 -0
- package/esm-dist/components/ColorPicker.d.ts +524 -0
- package/esm-dist/components/ContextMenu.d.ts +96 -0
- package/esm-dist/components/ContextMenu.js +213 -0
- package/esm-dist/components/DatePicker.d.ts +619 -0
- package/esm-dist/components/DatePicker.js +524 -0
- package/esm-dist/components/DateRangePicker.d.ts +876 -0
- package/esm-dist/components/DateRangePicker.js +1038 -0
- package/esm-dist/components/Drawer.d.ts +95 -0
- package/esm-dist/components/Drawer.js +250 -0
- package/esm-dist/components/Editor.d.ts +605 -0
- package/esm-dist/components/Editor.js +234 -0
- package/esm-dist/components/Form.d.ts +22 -0
- package/esm-dist/components/FormField.d.ts +65 -0
- package/esm-dist/components/GridNav.d.ts +52 -0
- package/esm-dist/components/GroupedSelection.d.ts +467 -0
- package/esm-dist/components/GroupedSelection.js +62 -0
- package/esm-dist/components/Html.d.ts +83 -0
- package/esm-dist/components/Html.js +52 -0
- package/esm-dist/components/ImageGallery.d.ts +297 -0
- package/esm-dist/components/Input.d.ts +16 -0
- package/esm-dist/components/Input.js +62 -0
- package/esm-dist/components/InputBox.d.ts +99 -0
- package/esm-dist/components/InputBox.js +97 -0
- package/esm-dist/components/InputBoxWithSuggestion.d.ts +280 -0
- package/esm-dist/components/InputBoxWithSuggestion.js +66 -0
- package/esm-dist/components/Layout.d.ts +144 -0
- package/esm-dist/components/Layout.js +66 -0
- package/esm-dist/components/Link.d.ts +62 -0
- package/esm-dist/components/ListGroup.d.ts +76 -0
- package/esm-dist/components/ListGroup.js +31 -0
- package/esm-dist/components/ListMenu.d.ts +573 -0
- package/esm-dist/components/LocationPicker.d.ts +427 -0
- package/esm-dist/components/Markdown.d.ts +20 -0
- package/esm-dist/components/Modal.d.ts +1278 -0
- package/esm-dist/components/Modal.js +148 -0
- package/esm-dist/components/ModalManager.d.ts +17 -0
- package/esm-dist/components/ModalManager.js +42 -0
- package/esm-dist/components/MonthRangePicker.d.ts +748 -0
- package/esm-dist/components/NumberInput.d.ts +89 -0
- package/esm-dist/components/NumberInput.js +136 -0
- package/esm-dist/components/Overlay.d.ts +41 -0
- package/esm-dist/components/Overlay.js +207 -0
- package/esm-dist/components/Pagination.d.ts +685 -0
- package/esm-dist/components/Picker.d.ts +284 -0
- package/esm-dist/components/Picker.js +74 -0
- package/esm-dist/components/PickerColumn.d.ts +63 -0
- package/esm-dist/components/PickerColumn.js +275 -0
- package/esm-dist/components/PickerContainer.d.ts +303 -0
- package/esm-dist/components/PickerContainer.js +149 -0
- package/esm-dist/components/PopOver.d.ts +90 -0
- package/esm-dist/components/PopOver.js +89 -0
- package/esm-dist/components/PopOverContainer.d.ts +28 -0
- package/esm-dist/components/PopOverContainer.js +92 -0
- package/esm-dist/components/PopUp.d.ts +578 -0
- package/esm-dist/components/PopUp.js +85 -0
- package/esm-dist/components/Progress.d.ts +68 -0
- package/esm-dist/components/PullRefresh.d.ts +64 -0
- package/esm-dist/components/PullRefresh.js +141 -0
- package/esm-dist/components/Radios.d.ts +180 -0
- package/esm-dist/components/Radios.js +112 -0
- package/esm-dist/components/Range.d.ts +122 -0
- package/esm-dist/components/Range.js +405 -0
- package/esm-dist/components/Rating.d.ts +252 -0
- package/esm-dist/components/Rating.js +315 -0
- package/esm-dist/components/ResultBox.d.ts +290 -0
- package/esm-dist/components/ResultBox.js +146 -0
- package/esm-dist/components/ResultList.d.ts +319 -0
- package/esm-dist/components/ResultList.js +182 -0
- package/esm-dist/components/ResultTableList.d.ts +708 -0
- package/esm-dist/components/ResultTableList.js +126 -0
- package/esm-dist/components/ResultTreeList.d.ts +308 -0
- package/esm-dist/components/ResultTreeList.js +208 -0
- package/esm-dist/components/RichText.d.ts +45 -0
- package/esm-dist/components/SearchBox.d.ts +504 -0
- package/esm-dist/components/SearchBox.js +127 -0
- package/esm-dist/components/Select.d.ts +6281 -0
- package/esm-dist/components/Select.js +756 -0
- package/esm-dist/components/Selection.d.ts +510 -0
- package/esm-dist/components/Selection.js +140 -0
- package/esm-dist/components/SparkLine.d.ts +403 -0
- package/esm-dist/components/SparkLine.js +62 -0
- package/esm-dist/components/Spinner.d.ts +174 -0
- package/esm-dist/components/Spinner.js +67 -0
- package/esm-dist/components/Steps.d.ts +110 -0
- package/esm-dist/components/Switch.d.ts +101 -0
- package/esm-dist/components/Switch.js +64 -0
- package/esm-dist/components/TableSelection.d.ts +695 -0
- package/esm-dist/components/TableSelection.js +79 -0
- package/esm-dist/components/Tabs.d.ts +210 -0
- package/esm-dist/components/Tabs.js +473 -0
- package/esm-dist/components/TabsTransfer.d.ts +297 -0
- package/esm-dist/components/TabsTransfer.js +210 -0
- package/esm-dist/components/TabsTransferPicker.d.ts +273 -0
- package/esm-dist/components/Tag.d.ts +104 -0
- package/esm-dist/components/Textarea.d.ts +568 -0
- package/esm-dist/components/Textarea.js +134 -0
- package/esm-dist/components/Timeline.d.ts +47 -0
- package/esm-dist/components/TimelineItem.d.ts +297 -0
- package/esm-dist/components/Tinymce.d.ts +55 -0
- package/esm-dist/components/TitleBar.d.ts +115 -0
- package/esm-dist/components/TitleBar.js +48 -0
- package/esm-dist/components/Toast.d.ts +358 -0
- package/esm-dist/components/Toast.js +247 -0
- package/esm-dist/components/Tooltip.d.ts +65 -0
- package/esm-dist/components/Tooltip.js +36 -0
- package/esm-dist/components/TooltipWrapper.d.ts +155 -0
- package/esm-dist/components/TooltipWrapper.js +183 -0
- package/esm-dist/components/Transfer.d.ts +1243 -0
- package/esm-dist/components/Transfer.js +323 -0
- package/esm-dist/components/TransferDropDown.d.ts +271 -0
- package/esm-dist/components/TransferPicker.d.ts +277 -0
- package/esm-dist/components/TransferSearch.d.ts +292 -0
- package/esm-dist/components/TransferSearch.js +95 -0
- package/esm-dist/components/Tree.d.ts +1708 -0
- package/esm-dist/components/Tree.js +764 -0
- package/esm-dist/components/TreeSelection.d.ts +526 -0
- package/esm-dist/components/TreeSelection.js +200 -0
- package/esm-dist/components/UserSelect.d.ts +500 -0
- package/esm-dist/components/UserTabSelect.d.ts +320 -0
- package/esm-dist/components/WithRemoteConfig.d.ts +386 -0
- package/esm-dist/components/WithRemoteConfig.js +257 -0
- package/esm-dist/components/WithStore.d.ts +75 -0
- package/esm-dist/components/WithStore.js +48 -0
- package/esm-dist/components/calendar/Calendar.d.ts +64 -0
- package/esm-dist/components/calendar/Calendar.js +489 -0
- package/esm-dist/components/calendar/CalendarContainer.d.ts +10 -0
- package/esm-dist/components/calendar/CalendarContainer.js +27 -0
- package/esm-dist/components/calendar/DaysView.d.ts +170 -0
- package/esm-dist/components/calendar/DaysView.js +440 -0
- package/esm-dist/components/calendar/MonthsView.d.ts +128 -0
- package/esm-dist/components/calendar/MonthsView.js +158 -0
- package/esm-dist/components/calendar/QuartersView.d.ts +92 -0
- package/esm-dist/components/calendar/QuartersView.js +83 -0
- package/esm-dist/components/calendar/TimeView.d.ts +178 -0
- package/esm-dist/components/calendar/TimeView.js +462 -0
- package/esm-dist/components/calendar/YearsView.d.ts +102 -0
- package/esm-dist/components/calendar/YearsView.js +121 -0
- package/esm-dist/components/condition-builder/Expression.d.ts +298 -0
- package/esm-dist/components/condition-builder/Field.d.ts +280 -0
- package/esm-dist/components/condition-builder/Formula.d.ts +269 -0
- package/esm-dist/components/condition-builder/Func.d.ts +279 -0
- package/esm-dist/components/condition-builder/Group.d.ts +296 -0
- package/esm-dist/components/condition-builder/GroupOrItem.d.ts +72 -0
- package/esm-dist/components/condition-builder/InputSwitch.d.ts +47 -0
- package/esm-dist/components/condition-builder/Item.d.ts +292 -0
- package/esm-dist/components/condition-builder/Value.d.ts +277 -0
- package/esm-dist/components/condition-builder/config.d.ts +35 -0
- package/esm-dist/components/condition-builder/index.d.ts +303 -0
- package/esm-dist/components/condition-builder/types.d.ts +150 -0
- package/esm-dist/components/formula/Editor.d.ts +362 -0
- package/esm-dist/components/formula/Editor.js +208 -0
- package/esm-dist/components/formula/FuncList.d.ts +48 -0
- package/esm-dist/components/formula/FuncList.js +48 -0
- package/esm-dist/components/formula/Picker.d.ts +440 -0
- package/esm-dist/components/formula/Picker.js +222 -0
- package/esm-dist/components/formula/VariableList.d.ts +54 -0
- package/esm-dist/components/formula/VariableList.js +41 -0
- package/esm-dist/components/formula/plugin.d.ts +27 -0
- package/esm-dist/components/formula/plugin.js +206 -0
- package/esm-dist/components/icons.d.ts +45 -0
- package/esm-dist/components/icons.js +249 -0
- package/esm-dist/components/index.d.ts +64 -0
- package/esm-dist/components/json-schema/Array.d.ts +3 -0
- package/esm-dist/components/json-schema/Array.js +128 -0
- package/esm-dist/components/json-schema/Item.d.ts +3 -0
- package/esm-dist/components/json-schema/Item.js +37 -0
- package/esm-dist/components/json-schema/Object.d.ts +3 -0
- package/esm-dist/components/json-schema/Object.js +181 -0
- package/esm-dist/components/json-schema/index.d.ts +277 -0
- package/esm-dist/components/json-schema/index.js +20 -0
- package/esm-dist/components/schema-editor/Array.d.ts +11 -0
- package/esm-dist/components/schema-editor/Common.d.ts +29 -0
- package/esm-dist/components/schema-editor/Item.d.ts +8 -0
- package/esm-dist/components/schema-editor/Object.d.ts +44 -0
- package/esm-dist/components/schema-editor/SchemaVariableList.d.ts +193 -0
- package/esm-dist/components/schema-editor/SchemaVariableList.js +74 -0
- package/esm-dist/components/schema-editor/SchemaVariableListPicker.d.ts +186 -0
- package/esm-dist/components/schema-editor/SchemaVariableListPicker.js +34 -0
- package/esm-dist/components/schema-editor/index.d.ts +303 -0
- package/esm-dist/components/table/Cell.d.ts +489 -0
- package/esm-dist/components/table/Cell.js +38 -0
- package/esm-dist/components/table/HeadCellDropDown.d.ts +293 -0
- package/esm-dist/components/table/HeadCellDropDown.js +55 -0
- package/esm-dist/components/table/HeadCellFilter.d.ts +419 -0
- package/esm-dist/components/table/HeadCellFilter.js +136 -0
- package/esm-dist/components/table/HeadCellSelect.d.ts +364 -0
- package/esm-dist/components/table/HeadCellSelect.js +48 -0
- package/esm-dist/components/table/HeadCellSort.d.ts +278 -0
- package/esm-dist/components/table/HeadCellSort.js +74 -0
- package/esm-dist/components/table/ItemActionsWrapper.d.ts +10 -0
- package/esm-dist/components/table/ItemActionsWrapper.js +29 -0
- package/esm-dist/components/table/index.d.ts +794 -0
- package/esm-dist/components/table/index.js +1234 -0
- package/esm-dist/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/esm-dist/components/virtual-list/SizeAndPositionManager.js +216 -0
- package/esm-dist/components/virtual-list/constants.d.ts +34 -0
- package/esm-dist/components/virtual-list/constants.js +45 -0
- package/esm-dist/components/virtual-list/index.d.ts +94 -0
- package/esm-dist/components/virtual-list/index.js +281 -0
- package/esm-dist/hooks/index.d.ts +7 -0
- package/esm-dist/hooks/use-set-state.d.ts +2 -0
- package/esm-dist/hooks/use-set-state.js +19 -0
- package/esm-dist/hooks/use-touch.d.ts +16 -0
- package/esm-dist/hooks/use-touch.js +77 -0
- package/esm-dist/hooks/use-update-effect.d.ts +3 -0
- package/esm-dist/hooks/use-update-effect.js +21 -0
- package/esm-dist/hooks/use-validation-resolver.d.ts +2 -0
- package/esm-dist/hooks/use-validation-resolver.js +49 -0
- package/esm-dist/icons/alert-danger.svg.js +24 -0
- package/esm-dist/icons/alert-info.svg.js +24 -0
- package/esm-dist/icons/alert-success.svg.js +24 -0
- package/esm-dist/icons/alert-warning.svg.js +24 -0
- package/esm-dist/icons/back.svg.js +23 -0
- package/esm-dist/icons/calendar.svg.js +32 -0
- package/esm-dist/icons/caret.svg.js +22 -0
- package/esm-dist/icons/check.svg.js +21 -0
- package/esm-dist/icons/clock.svg.js +32 -0
- package/esm-dist/icons/close-small.svg.js +25 -0
- package/esm-dist/icons/close.svg.js +21 -0
- package/esm-dist/icons/cloud-upload.svg.js +33 -0
- package/esm-dist/icons/column-filter.svg.js +23 -0
- package/esm-dist/icons/columns.svg.js +22 -0
- package/esm-dist/icons/compress-alt.svg.js +22 -0
- package/esm-dist/icons/copy.svg.js +27 -0
- package/esm-dist/icons/date.svg.js +28 -0
- package/esm-dist/icons/department.svg.js +54 -0
- package/esm-dist/icons/desk-empty.svg.js +75 -0
- package/esm-dist/icons/dot.svg.js +38 -0
- package/esm-dist/icons/down-arrow-bold.svg.js +24 -0
- package/esm-dist/icons/download.svg.js +26 -0
- package/esm-dist/icons/drag-bar.svg.js +55 -0
- package/esm-dist/icons/drag.svg.js +24 -0
- package/esm-dist/icons/edit.svg.js +24 -0
- package/esm-dist/icons/ellipsis-v.svg.js +23 -0
- package/esm-dist/icons/enter.svg.js +21 -0
- package/esm-dist/icons/exchange.svg.js +23 -0
- package/esm-dist/icons/expand-alt.svg.js +22 -0
- package/esm-dist/icons/fail.svg.js +30 -0
- package/esm-dist/icons/file.svg.js +23 -0
- package/esm-dist/icons/filter.svg.js +22 -0
- package/esm-dist/icons/folder.svg.js +25 -0
- package/esm-dist/icons/function.svg.js +24 -0
- package/esm-dist/icons/home.svg.js +22 -0
- package/esm-dist/icons/image.svg.js +21 -0
- package/esm-dist/icons/info-circle.svg.js +22 -0
- package/esm-dist/icons/info.svg.js +28 -0
- package/esm-dist/icons/input-clear.svg.js +24 -0
- package/esm-dist/icons/invisible.svg.js +24 -0
- package/esm-dist/icons/left-arrow.svg.js +22 -0
- package/esm-dist/icons/loading-outline.svg.js +25 -0
- package/esm-dist/icons/location.svg.js +22 -0
- package/esm-dist/icons/menu.svg.js +24 -0
- package/esm-dist/icons/minus.svg.js +22 -0
- package/esm-dist/icons/move.svg.js +23 -0
- package/esm-dist/icons/mute.svg.js +22 -0
- package/esm-dist/icons/pause.svg.js +22 -0
- package/esm-dist/icons/pencil.svg.js +22 -0
- package/esm-dist/icons/play.svg.js +21 -0
- package/esm-dist/icons/plus-cicle.svg.js +23 -0
- package/esm-dist/icons/plus-fine.svg.js +24 -0
- package/esm-dist/icons/plus.svg.js +23 -0
- package/esm-dist/icons/post.svg.js +50 -0
- package/esm-dist/icons/question-mark.svg.js +27 -0
- package/esm-dist/icons/question.svg.js +22 -0
- package/esm-dist/icons/redo.svg.js +22 -0
- package/esm-dist/icons/refresh.svg.js +23 -0
- package/esm-dist/icons/reload.svg.js +22 -0
- package/esm-dist/icons/remove.svg.js +24 -0
- package/esm-dist/icons/retry.svg.js +27 -0
- package/esm-dist/icons/right-arrow-bold.svg.js +22 -0
- package/esm-dist/icons/right-arrow.svg.js +22 -0
- package/esm-dist/icons/role.svg.js +45 -0
- package/esm-dist/icons/schedule.svg.js +25 -0
- package/esm-dist/icons/search.svg.js +21 -0
- package/esm-dist/icons/setting.svg.js +23 -0
- package/esm-dist/icons/slider-handle-icon.svg.js +24 -0
- package/esm-dist/icons/sort-asc.svg.js +22 -0
- package/esm-dist/icons/sort-default.svg.js +23 -0
- package/esm-dist/icons/sort-desc.svg.js +22 -0
- package/esm-dist/icons/star.svg.js +23 -0
- package/esm-dist/icons/status-close.svg.js +25 -0
- package/esm-dist/icons/status-fail.svg.js +24 -0
- package/esm-dist/icons/status-info.svg.js +28 -0
- package/esm-dist/icons/status-success.svg.js +24 -0
- package/esm-dist/icons/status-warning.svg.js +28 -0
- package/esm-dist/icons/success.svg.js +28 -0
- package/esm-dist/icons/transparent.svg.js +41 -0
- package/esm-dist/icons/trash.svg.js +24 -0
- package/esm-dist/icons/tree-down.svg.js +23 -0
- package/esm-dist/icons/undo.svg.js +22 -0
- package/esm-dist/icons/upload.svg.js +24 -0
- package/esm-dist/icons/user-remove.svg.js +35 -0
- package/esm-dist/icons/view.svg.js +24 -0
- package/esm-dist/icons/volume.svg.js +25 -0
- package/esm-dist/icons/warning-mark.svg.js +25 -0
- package/esm-dist/icons/warning.svg.js +22 -0
- package/esm-dist/icons/window-restore.svg.js +22 -0
- package/esm-dist/icons/zoom-in.svg.js +22 -0
- package/esm-dist/icons/zoom-out.svg.js +22 -0
- package/esm-dist/index.d.ts +10 -0
- package/esm-dist/index.js +74 -0
- package/esm-dist/locale/de-DE.d.ts +1 -0
- package/esm-dist/locale/de-DE.js +342 -0
- package/esm-dist/locale/en-US.d.ts +1 -0
- package/esm-dist/locale/en-US.js +345 -0
- package/esm-dist/locale/zh-CN.d.ts +1 -0
- package/esm-dist/locale/zh-CN.js +356 -0
- package/esm-dist/themes/ang.d.ts +3 -0
- package/esm-dist/themes/ang.js +15 -0
- package/esm-dist/themes/antd.d.ts +1 -0
- package/esm-dist/themes/antd.js +42 -0
- package/esm-dist/themes/cxd.d.ts +3 -0
- package/esm-dist/themes/cxd.js +455 -0
- package/esm-dist/themes/dark.d.ts +3 -0
- package/esm-dist/themes/dark.js +23 -0
- package/esm-dist/themes/default.d.ts +4 -0
- package/package.json +71 -0
- package/rollup.config.js +129 -0
- package/scss/README.md +9 -0
- package/scss/_functions.scss +101 -0
- package/scss/_mixins.scss +472 -0
- package/scss/_properties.scss +1702 -0
- package/scss/_thirds.scss +8 -0
- package/scss/_utilities.scss +1753 -0
- package/scss/_variables.scss +417 -0
- package/scss/base/_common.scss +3 -0
- package/scss/base/_normalize.scss +361 -0
- package/scss/base/_reset.scss +18 -0
- package/scss/base/_typography.scss +59 -0
- package/scss/components/_alert.scss +82 -0
- package/scss/components/_anchor-nav.scss +115 -0
- package/scss/components/_app.scss +31 -0
- package/scss/components/_array-input.scss +101 -0
- package/scss/components/_audio.scss +146 -0
- package/scss/components/_avatar.scss +55 -0
- package/scss/components/_badge.scss +136 -0
- package/scss/components/_barcode.scss +6 -0
- package/scss/components/_breadcrumb.scss +98 -0
- package/scss/components/_button-group.scss +131 -0
- package/scss/components/_button.scss +379 -0
- package/scss/components/_calendar.scss +395 -0
- package/scss/components/_card.scss +359 -0
- package/scss/components/_card2.scss +28 -0
- package/scss/components/_cards.scss +187 -0
- package/scss/components/_carousel.scss +197 -0
- package/scss/components/_cascader.scss +102 -0
- package/scss/components/_chart.scss +20 -0
- package/scss/components/_city-area.scss +29 -0
- package/scss/components/_collapse-group.scss +30 -0
- package/scss/components/_collapse.scss +120 -0
- package/scss/components/_color.scss +18 -0
- package/scss/components/_column-toggler.scss +244 -0
- package/scss/components/_condition-builder.scss +280 -0
- package/scss/components/_context-menu.scss +206 -0
- package/scss/components/_copyable.scss +10 -0
- package/scss/components/_crud.scss +151 -0
- package/scss/components/_debug.scss +170 -0
- package/scss/components/_divider.scss +11 -0
- package/scss/components/_drawer.scss +314 -0
- package/scss/components/_dropdown.scss +144 -0
- package/scss/components/_each.scss +7 -0
- package/scss/components/_formula.scss +407 -0
- package/scss/components/_grid-nav.scss +128 -0
- package/scss/components/_icon.scss +4 -0
- package/scss/components/_image-gallery.scss +205 -0
- package/scss/components/_images.scss +186 -0
- package/scss/components/_input-box.scss +74 -0
- package/scss/components/_json-schema-editor.scss +126 -0
- package/scss/components/_json-schema.scss +124 -0
- package/scss/components/_json.scss +7 -0
- package/scss/components/_link.scss +6 -0
- package/scss/components/_list-menu.scss +74 -0
- package/scss/components/_list.scss +249 -0
- package/scss/components/_log.scss +141 -0
- package/scss/components/_mapping.scss +6 -0
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_modal.scss +252 -0
- package/scss/components/_nav.scss +310 -0
- package/scss/components/_page.scss +144 -0
- package/scss/components/_pagination.scss +200 -0
- package/scss/components/_panel.scss +229 -0
- package/scss/components/_picker-columns.scss +140 -0
- package/scss/components/_popover.scss +54 -0
- package/scss/components/_popoverable.scss +62 -0
- package/scss/components/_popup.scss +160 -0
- package/scss/components/_portlet.scss +51 -0
- package/scss/components/_progress.scss +142 -0
- package/scss/components/_property.scss +47 -0
- package/scss/components/_pull-refresh.scss +25 -0
- package/scss/components/_quick-edit.scss +56 -0
- package/scss/components/_remark.scss +58 -0
- package/scss/components/_result-box.scss +246 -0
- package/scss/components/_search-box.scss +138 -0
- package/scss/components/_service.scss +3 -0
- package/scss/components/_sparkline.scss +18 -0
- package/scss/components/_spinner.scss +176 -0
- package/scss/components/_status.scss +102 -0
- package/scss/components/_steps.scss +394 -0
- package/scss/components/_table-v2.scss +912 -0
- package/scss/components/_table.scss +936 -0
- package/scss/components/_tabs.scss +1021 -0
- package/scss/components/_tag.scss +177 -0
- package/scss/components/_timeline.scss +198 -0
- package/scss/components/_toast.scss +272 -0
- package/scss/components/_tooltip.scss +339 -0
- package/scss/components/_tpl.scss +5 -0
- package/scss/components/_video.scss +38 -0
- package/scss/components/_wizard.scss +270 -0
- package/scss/components/_wrapper.scss +21 -0
- package/scss/components/form/_chained-select.scss +5 -0
- package/scss/components/form/_checks.scss +513 -0
- package/scss/components/form/_city.scss +33 -0
- package/scss/components/form/_color.scss +119 -0
- package/scss/components/form/_combo.scss +316 -0
- package/scss/components/form/_date-range.scss +222 -0
- package/scss/components/form/_date.scss +633 -0
- package/scss/components/form/_editor.scss +125 -0
- package/scss/components/form/_excel.scss +42 -0
- package/scss/components/form/_fieldset.scss +136 -0
- package/scss/components/form/_file.scss +246 -0
- package/scss/components/form/_form.scss +617 -0
- package/scss/components/form/_group.scss +116 -0
- package/scss/components/form/_icon-picker.scss +107 -0
- package/scss/components/form/_image.scss +266 -0
- package/scss/components/form/_input-group.scss +150 -0
- package/scss/components/form/_list.scss +122 -0
- package/scss/components/form/_location.scss +140 -0
- package/scss/components/form/_matrix.scss +5 -0
- package/scss/components/form/_nested-select.scss +106 -0
- package/scss/components/form/_number.scss +312 -0
- package/scss/components/form/_picker.scss +101 -0
- package/scss/components/form/_qr-code.scss +4 -0
- package/scss/components/form/_range.scss +274 -0
- package/scss/components/form/_rating.scss +74 -0
- package/scss/components/form/_repeat.scss +40 -0
- package/scss/components/form/_result-list.scss +87 -0
- package/scss/components/form/_rich-text.scss +116 -0
- package/scss/components/form/_select.scss +447 -0
- package/scss/components/form/_selection.scss +350 -0
- package/scss/components/form/_sub-form.scss +118 -0
- package/scss/components/form/_switch.scss +102 -0
- package/scss/components/form/_tag.scss +92 -0
- package/scss/components/form/_text.scss +307 -0
- package/scss/components/form/_textarea.scss +62 -0
- package/scss/components/form/_tinymce.scss +6 -0
- package/scss/components/form/_transfer.scss +320 -0
- package/scss/components/form/_tree-select.scss +39 -0
- package/scss/components/form/_tree.scss +317 -0
- package/scss/components/form/_user-select.scss +422 -0
- package/scss/components/react-datetime.scss +247 -0
- package/scss/helper/background/_background-color.scss +214 -0
- package/scss/helper/border/_border-color.scss +178 -0
- package/scss/helper/border/_border-radius.scss +152 -0
- package/scss/helper/border/_border-style.scss +40 -0
- package/scss/helper/border/_border-width.scss +72 -0
- package/scss/helper/box-alignment/_align-content.scss +44 -0
- package/scss/helper/box-alignment/_align-items.scss +41 -0
- package/scss/helper/box-alignment/_align-self.scss +40 -0
- package/scss/helper/box-alignment/_justify-content.scss +44 -0
- package/scss/helper/box-alignment/_justify-items.scss +40 -0
- package/scss/helper/box-alignment/_justify-self.scss +40 -0
- package/scss/helper/box-alignment/_place-content.scss +48 -0
- package/scss/helper/box-alignment/_place-items.scss +40 -0
- package/scss/helper/box-alignment/_place-self.scss +40 -0
- package/scss/helper/effect/_box-shadow.scss +74 -0
- package/scss/helper/effect/_opacity.scss +66 -0
- package/scss/helper/flex/_direction.scss +41 -0
- package/scss/helper/flex/_flex.scss +38 -0
- package/scss/helper/flex/_grow.scss +28 -0
- package/scss/helper/flex/_order.scss +56 -0
- package/scss/helper/flex/_shrink.scss +27 -0
- package/scss/helper/flex/_wrap.scss +36 -0
- package/scss/helper/grid/_auto-columns.scss +38 -0
- package/scss/helper/grid/_auto-flow.scss +38 -0
- package/scss/helper/grid/_auto-rows.scss +38 -0
- package/scss/helper/grid/_column-start-end.scss +201 -0
- package/scss/helper/grid/_columns.scss +74 -0
- package/scss/helper/grid/_gap.scss +154 -0
- package/scss/helper/grid/_row-start-end.scss +201 -0
- package/scss/helper/grid/_rows.scss +50 -0
- package/scss/helper/layout/_box-sizing.scss +51 -0
- package/scss/helper/layout/_clear.scss +56 -0
- package/scss/helper/layout/_display.scss +82 -0
- package/scss/helper/layout/_float.scss +71 -0
- package/scss/helper/layout/_overflow.scss +85 -0
- package/scss/helper/layout/_position.scss +55 -0
- package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
- package/scss/helper/layout/_visibility.scss +42 -0
- package/scss/helper/layout/_z-index.scss +67 -0
- package/scss/helper/sizing/_height.scss +161 -0
- package/scss/helper/sizing/_width.scss +158 -0
- package/scss/helper/spacing/_margin.scss +821 -0
- package/scss/helper/spacing/_padding.scss +394 -0
- package/scss/helper/spacing/_space-between.scss +224 -0
- package/scss/helper/typography/_font-family.scss +28 -0
- package/scss/helper/typography/_font-size.scss +40 -0
- package/scss/helper/typography/_font-style.scss +31 -0
- package/scss/helper/typography/_font-weight.scss +49 -0
- package/scss/helper/typography/_letter-spacing.scss +43 -0
- package/scss/helper/typography/_line-height.scss +59 -0
- package/scss/helper/typography/_list-style-type.scss +43 -0
- package/scss/helper/typography/_text-align.scss +34 -0
- package/scss/helper/typography/_text-color.scss +184 -0
- package/scss/helper/typography/_text-decoration.scss +34 -0
- package/scss/helper/typography/_text-overflow.scss +40 -0
- package/scss/helper/typography/_text-transform.scss +40 -0
- package/scss/helper/typography/_vertical-align.scss +44 -0
- package/scss/helper/typography/_whitespace.scss +42 -0
- package/scss/helper/typography/_word-break.scss +36 -0
- package/scss/helper.scss +70 -0
- package/scss/layout/_aside.scss +361 -0
- package/scss/layout/_grid.scss +171 -0
- package/scss/layout/_hbox.scss +127 -0
- package/scss/layout/_header.scss +0 -0
- package/scss/layout/_layout.scss +458 -0
- package/scss/layout/_vbox.scss +38 -0
- package/scss/themes/_ang-variables.scss +132 -0
- package/scss/themes/_antd-colors.scss +149 -0
- package/scss/themes/_antd-variables.scss +171 -0
- package/scss/themes/_common.scss +138 -0
- package/scss/themes/_cxd-colors.scss +56 -0
- package/scss/themes/_cxd-variables.scss +687 -0
- package/scss/themes/_dark-variables.scss +129 -0
- package/scss/themes/ang-ie11.scss +1 -0
- package/scss/themes/ang.scss +4 -0
- package/scss/themes/antd-ie11.scss +1 -0
- package/scss/themes/antd.scss +5 -0
- package/scss/themes/cxd-ie11.scss +1 -0
- package/scss/themes/cxd.scss +426 -0
- package/scss/themes/dark-ie11.scss +1 -0
- package/scss/themes/dark.scss +3 -0
- package/scss/themes/default.scss +2 -0
- package/scss/themes/extract-antd-color.py +27 -0
- package/src/components/404.tsx +49 -0
- package/src/components/Alert.tsx +300 -0
- package/src/components/Alert2.tsx +117 -0
- package/src/components/AnchorNav.tsx +265 -0
- package/src/components/ArrayInput.tsx +234 -0
- package/src/components/AsideNav.tsx +280 -0
- package/src/components/AssociatedSelection.tsx +243 -0
- package/src/components/Avatar.tsx +255 -0
- package/src/components/Badge.tsx +300 -0
- package/src/components/BaiduMapPicker.tsx +394 -0
- package/src/components/BarCode.tsx +50 -0
- package/src/components/Breadcrumb.tsx +294 -0
- package/src/components/Button.tsx +149 -0
- package/src/components/CalendarMobile.tsx +803 -0
- package/src/components/Card.tsx +206 -0
- package/src/components/Cascader.tsx +596 -0
- package/src/components/ChainedSelection.tsx +253 -0
- package/src/components/Checkbox.tsx +117 -0
- package/src/components/CityArea.tsx +318 -0
- package/src/components/CityDB.ts +4109 -0
- package/src/components/CodeMirror.tsx +99 -0
- package/src/components/Collapse.tsx +253 -0
- package/src/components/CollapseGroup.tsx +133 -0
- package/src/components/ColorPicker.tsx +374 -0
- package/src/components/ContextMenu.tsx +313 -0
- package/src/components/DatePicker.tsx +879 -0
- package/src/components/DateRangePicker.tsx +1500 -0
- package/src/components/Drawer.tsx +357 -0
- package/src/components/Editor.tsx +341 -0
- package/src/components/Form.tsx +70 -0
- package/src/components/FormField.tsx +127 -0
- package/src/components/GridNav.tsx +233 -0
- package/src/components/GroupedSelection.tsx +123 -0
- package/src/components/Html.tsx +75 -0
- package/src/components/ImageGallery.tsx +179 -0
- package/src/components/Input.tsx +72 -0
- package/src/components/InputBox.tsx +126 -0
- package/src/components/InputBoxWithSuggestion.tsx +113 -0
- package/src/components/Layout.tsx +123 -0
- package/src/components/Link.tsx +85 -0
- package/src/components/ListGroup.tsx +72 -0
- package/src/components/ListMenu.tsx +112 -0
- package/src/components/LocationPicker.tsx +213 -0
- package/src/components/Markdown.tsx +53 -0
- package/src/components/Modal.tsx +294 -0
- package/src/components/ModalManager.ts +49 -0
- package/src/components/MonthRangePicker.tsx +699 -0
- package/src/components/NumberInput.tsx +255 -0
- package/src/components/Overlay.tsx +317 -0
- package/src/components/Pagination.tsx +526 -0
- package/src/components/Picker.tsx +161 -0
- package/src/components/PickerColumn.tsx +400 -0
- package/src/components/PickerContainer.tsx +178 -0
- package/src/components/PopOver.tsx +155 -0
- package/src/components/PopOverContainer.tsx +114 -0
- package/src/components/PopUp.tsx +161 -0
- package/src/components/Progress.tsx +173 -0
- package/src/components/PullRefresh.tsx +197 -0
- package/src/components/Radios.tsx +198 -0
- package/src/components/Range.tsx +561 -0
- package/src/components/Rating.tsx +421 -0
- package/src/components/ResultBox.tsx +224 -0
- package/src/components/ResultList.tsx +300 -0
- package/src/components/ResultTableList.tsx +229 -0
- package/src/components/ResultTreeList.tsx +312 -0
- package/src/components/RichText.tsx +312 -0
- package/src/components/SearchBox.tsx +175 -0
- package/src/components/Select.tsx +1229 -0
- package/src/components/Selection.tsx +232 -0
- package/src/components/SparkLine.tsx +111 -0
- package/src/components/Spinner.tsx +126 -0
- package/src/components/Steps.tsx +221 -0
- package/src/components/Switch.tsx +122 -0
- package/src/components/TableSelection.tsx +183 -0
- package/src/components/Tabs.tsx +747 -0
- package/src/components/TabsTransfer.tsx +422 -0
- package/src/components/TabsTransferPicker.tsx +111 -0
- package/src/components/Tag.tsx +179 -0
- package/src/components/Textarea.tsx +234 -0
- package/src/components/Timeline.tsx +36 -0
- package/src/components/TimelineItem.tsx +140 -0
- package/src/components/Tinymce.tsx +614 -0
- package/src/components/TitleBar.tsx +61 -0
- package/src/components/Toast.tsx +421 -0
- package/src/components/Tooltip.tsx +78 -0
- package/src/components/TooltipWrapper.tsx +366 -0
- package/src/components/Transfer.tsx +755 -0
- package/src/components/TransferDropDown.tsx +136 -0
- package/src/components/TransferPicker.tsx +118 -0
- package/src/components/TransferSearch.tsx +126 -0
- package/src/components/Tree.tsx +1183 -0
- package/src/components/TreeSelection.tsx +315 -0
- package/src/components/UserSelect.tsx +850 -0
- package/src/components/UserTabSelect.tsx +261 -0
- package/src/components/WithRemoteConfig.tsx +406 -0
- package/src/components/WithStore.tsx +73 -0
- package/src/components/calendar/Calendar.tsx +710 -0
- package/src/components/calendar/CalendarContainer.tsx +30 -0
- package/src/components/calendar/DaysView.tsx +812 -0
- package/src/components/calendar/MonthsView.tsx +288 -0
- package/src/components/calendar/QuartersView.tsx +156 -0
- package/src/components/calendar/TimeView.tsx +742 -0
- package/src/components/calendar/YearsView.tsx +214 -0
- package/src/components/condition-builder/Expression.tsx +244 -0
- package/src/components/condition-builder/Field.tsx +152 -0
- package/src/components/condition-builder/Formula.tsx +39 -0
- package/src/components/condition-builder/Func.tsx +141 -0
- package/src/components/condition-builder/Group.tsx +258 -0
- package/src/components/condition-builder/GroupOrItem.tsx +161 -0
- package/src/components/condition-builder/InputSwitch.tsx +51 -0
- package/src/components/condition-builder/Item.tsx +427 -0
- package/src/components/condition-builder/Value.tsx +162 -0
- package/src/components/condition-builder/config.ts +133 -0
- package/src/components/condition-builder/index.tsx +269 -0
- package/src/components/condition-builder/types.ts +218 -0
- package/src/components/formula/Editor.tsx +337 -0
- package/src/components/formula/FuncList.tsx +113 -0
- package/src/components/formula/Picker.tsx +415 -0
- package/src/components/formula/VariableList.tsx +126 -0
- package/src/components/formula/plugin.ts +252 -0
- package/src/components/icons.tsx +267 -0
- package/src/components/index.tsx +133 -0
- package/src/components/json-schema/Array.tsx +216 -0
- package/src/components/json-schema/Item.tsx +47 -0
- package/src/components/json-schema/Object.tsx +339 -0
- package/src/components/json-schema/index.tsx +48 -0
- package/src/components/schema-editor/Array.tsx +99 -0
- package/src/components/schema-editor/Common.tsx +191 -0
- package/src/components/schema-editor/Item.tsx +30 -0
- package/src/components/schema-editor/Object.tsx +302 -0
- package/src/components/schema-editor/SchemaVariableList.tsx +98 -0
- package/src/components/schema-editor/SchemaVariableListPicker.tsx +68 -0
- package/src/components/schema-editor/index.tsx +228 -0
- package/src/components/table/Cell.tsx +71 -0
- package/src/components/table/HeadCellDropDown.tsx +112 -0
- package/src/components/table/HeadCellFilter.tsx +230 -0
- package/src/components/table/HeadCellSelect.tsx +97 -0
- package/src/components/table/HeadCellSort.tsx +99 -0
- package/src/components/table/ItemActionsWrapper.tsx +37 -0
- package/src/components/table/index.tsx +2012 -0
- package/src/components/virtual-list/SizeAndPositionManager.ts +308 -0
- package/src/components/virtual-list/constants.ts +41 -0
- package/src/components/virtual-list/index.tsx +447 -0
- package/src/custom.d.ts +14 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-set-state.ts +19 -0
- package/src/hooks/use-touch.ts +100 -0
- package/src/hooks/use-update-effect.ts +16 -0
- package/src/hooks/use-validation-resolver.ts +47 -0
- package/src/icons/alert-danger.svg +1 -0
- package/src/icons/alert-info.svg +1 -0
- package/src/icons/alert-success.svg +1 -0
- package/src/icons/alert-warning.svg +1 -0
- package/src/icons/back.svg +11 -0
- package/src/icons/calendar.svg +27 -0
- package/src/icons/caret.svg +7 -0
- package/src/icons/check.svg +9 -0
- package/src/icons/clock.svg +1 -0
- package/src/icons/close-small.svg +5 -0
- package/src/icons/close.svg +4 -0
- package/src/icons/cloud-upload.svg +22 -0
- package/src/icons/column-filter.svg +9 -0
- package/src/icons/columns.svg +7 -0
- package/src/icons/compress-alt.svg +3 -0
- package/src/icons/copy.svg +9 -0
- package/src/icons/date.svg +9 -0
- package/src/icons/department.svg +17 -0
- package/src/icons/desk-empty.svg +25 -0
- package/src/icons/dot.svg +11 -0
- package/src/icons/down-arrow-bold.svg +10 -0
- package/src/icons/download.svg +4 -0
- package/src/icons/drag-bar.svg +13 -0
- package/src/icons/drag.svg +8 -0
- package/src/icons/edit.svg +8 -0
- package/src/icons/ellipsis-v.svg +9 -0
- package/src/icons/enter.svg +4 -0
- package/src/icons/exchange.svg +7 -0
- package/src/icons/expand-alt.svg +3 -0
- package/src/icons/fail.svg +8 -0
- package/src/icons/file.svg +8 -0
- package/src/icons/filter.svg +7 -0
- package/src/icons/folder.svg +9 -0
- package/src/icons/function.svg +4 -0
- package/src/icons/home.svg +7 -0
- package/src/icons/image.svg +1 -0
- package/src/icons/info-circle.svg +7 -0
- package/src/icons/info.svg +8 -0
- package/src/icons/input-clear.svg +1 -0
- package/src/icons/invisible.svg +10 -0
- package/src/icons/left-arrow.svg +7 -0
- package/src/icons/loading-outline.svg +4 -0
- package/src/icons/location.svg +10 -0
- package/src/icons/menu.svg +2 -0
- package/src/icons/minus.svg +7 -0
- package/src/icons/move.svg +8 -0
- package/src/icons/mute.svg +4 -0
- package/src/icons/pause.svg +5 -0
- package/src/icons/pencil.svg +7 -0
- package/src/icons/play.svg +4 -0
- package/src/icons/plus-cicle.svg +9 -0
- package/src/icons/plus-fine.svg +10 -0
- package/src/icons/plus.svg +9 -0
- package/src/icons/post.svg +15 -0
- package/src/icons/question-mark.svg +12 -0
- package/src/icons/question.svg +7 -0
- package/src/icons/redo.svg +7 -0
- package/src/icons/refresh.svg +7 -0
- package/src/icons/reload.svg +6 -0
- package/src/icons/remove.svg +10 -0
- package/src/icons/retry.svg +8 -0
- package/src/icons/right-arrow-bold.svg +7 -0
- package/src/icons/right-arrow.svg +7 -0
- package/src/icons/role.svg +14 -0
- package/src/icons/schedule.svg +9 -0
- package/src/icons/search.svg +4 -0
- package/src/icons/setting.svg +9 -0
- package/src/icons/slider-handle-icon.svg +6 -0
- package/src/icons/sort-asc.svg +7 -0
- package/src/icons/sort-default.svg +9 -0
- package/src/icons/sort-desc.svg +7 -0
- package/src/icons/star.svg +12 -0
- package/src/icons/status-close.svg +10 -0
- package/src/icons/status-fail.svg +10 -0
- package/src/icons/status-info.svg +8 -0
- package/src/icons/status-success.svg +10 -0
- package/src/icons/status-warning.svg +8 -0
- package/src/icons/success.svg +10 -0
- package/src/icons/transparent.svg +11 -0
- package/src/icons/trash.svg +8 -0
- package/src/icons/tree-down.svg +5 -0
- package/src/icons/undo.svg +7 -0
- package/src/icons/upload.svg +9 -0
- package/src/icons/user-remove.svg +12 -0
- package/src/icons/view.svg +10 -0
- package/src/icons/volume.svg +5 -0
- package/src/icons/warning-mark.svg +13 -0
- package/src/icons/warning.svg +7 -0
- package/src/icons/window-restore.svg +7 -0
- package/src/icons/zoom-in.svg +7 -0
- package/src/icons/zoom-out.svg +7 -0
- package/src/index.tsx +11 -0
- package/src/locale/de-DE.ts +357 -0
- package/src/locale/en-US.ts +346 -0
- package/src/locale/zh-CN.ts +351 -0
- package/src/themes/ang.ts +8 -0
- package/src/themes/antd.ts +44 -0
- package/src/themes/cxd.ts +458 -0
- package/src/themes/dark.ts +16 -0
- package/src/themes/default.ts +5 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,1500 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file DateRangePicker
|
|
3
|
+
* @description 自定义日期范围时间选择器组件
|
|
4
|
+
* @author fex
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import moment from 'moment';
|
|
9
|
+
import {findDOMNode} from 'react-dom';
|
|
10
|
+
import {Icon} from './icons';
|
|
11
|
+
import Overlay from './Overlay';
|
|
12
|
+
import {ShortCuts, ShortCutDateRange} from './DatePicker';
|
|
13
|
+
import Calendar from './calendar/Calendar';
|
|
14
|
+
import PopOver from './PopOver';
|
|
15
|
+
import PopUp from './PopUp';
|
|
16
|
+
import {ClassNamesFn, themeable, ThemeProps} from 'amis-core';
|
|
17
|
+
import type {PlainObject} from 'amis-core/dist/types';
|
|
18
|
+
import {isMobile, noop, ucFirst} from 'amis-core';
|
|
19
|
+
import {LocaleProps, localeable} from 'amis-core';
|
|
20
|
+
import CalendarMobile from './CalendarMobile';
|
|
21
|
+
import Input from './Input';
|
|
22
|
+
|
|
23
|
+
export interface DateRangePickerProps extends ThemeProps, LocaleProps {
|
|
24
|
+
className?: string;
|
|
25
|
+
popoverClassName?: string;
|
|
26
|
+
startPlaceholder?: string;
|
|
27
|
+
endPlaceholder?: string;
|
|
28
|
+
theme?: any;
|
|
29
|
+
format: string;
|
|
30
|
+
utc?: boolean;
|
|
31
|
+
inputFormat?: string;
|
|
32
|
+
ranges?: string | Array<ShortCuts>;
|
|
33
|
+
clearable?: boolean;
|
|
34
|
+
minDate?: moment.Moment;
|
|
35
|
+
maxDate?: moment.Moment;
|
|
36
|
+
minDuration?: moment.Duration;
|
|
37
|
+
maxDuration?: moment.Duration;
|
|
38
|
+
joinValues: boolean;
|
|
39
|
+
delimiter: string;
|
|
40
|
+
value?: any;
|
|
41
|
+
onChange: (value: any) => void;
|
|
42
|
+
data?: any;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
closeOnSelect?: boolean;
|
|
45
|
+
overlayPlacement: string;
|
|
46
|
+
timeFormat?: string;
|
|
47
|
+
resetValue?: any;
|
|
48
|
+
popOverContainer?: any;
|
|
49
|
+
dateFormat?: string;
|
|
50
|
+
embed?: boolean;
|
|
51
|
+
viewMode?: 'days' | 'months' | 'years' | 'time' | 'quarters';
|
|
52
|
+
borderMode?: 'full' | 'half' | 'none';
|
|
53
|
+
useMobileUI?: boolean;
|
|
54
|
+
onFocus?: Function;
|
|
55
|
+
onBlur?: Function;
|
|
56
|
+
type?: string;
|
|
57
|
+
onRef?: any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface DateRangePickerState {
|
|
61
|
+
isOpened: boolean;
|
|
62
|
+
isFocused: boolean;
|
|
63
|
+
startDate?: moment.Moment;
|
|
64
|
+
endDate?: moment.Moment;
|
|
65
|
+
editState?: 'start' | 'end'; // 编辑开始时间还是结束时间
|
|
66
|
+
startInputValue?: string;
|
|
67
|
+
endInputValue?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const availableRanges: {[propName: string]: any} = {
|
|
71
|
+
'today': {
|
|
72
|
+
label: 'Date.today',
|
|
73
|
+
startDate: (now: moment.Moment) => {
|
|
74
|
+
return now.startOf('day');
|
|
75
|
+
},
|
|
76
|
+
endDate: (now: moment.Moment) => {
|
|
77
|
+
return now;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
'yesterday': {
|
|
82
|
+
label: 'Date.yesterday',
|
|
83
|
+
startDate: (now: moment.Moment) => {
|
|
84
|
+
return now.add(-1, 'days').startOf('day');
|
|
85
|
+
},
|
|
86
|
+
endDate: (now: moment.Moment) => {
|
|
87
|
+
return now.add(-1, 'days').endOf('day');
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
'tomorrow': {
|
|
92
|
+
label: 'Date.tomorrow',
|
|
93
|
+
startDate: (now: moment.Moment) => {
|
|
94
|
+
return now.add(1, 'days').startOf('day');
|
|
95
|
+
},
|
|
96
|
+
endDate: (now: moment.Moment) => {
|
|
97
|
+
return now.add(1, 'days').endOf('day');
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// 兼容一下错误的用法
|
|
102
|
+
'1daysago': {
|
|
103
|
+
label: 'DateRange.1daysago',
|
|
104
|
+
startDate: (now: moment.Moment) => {
|
|
105
|
+
return now.add(-1, 'days');
|
|
106
|
+
},
|
|
107
|
+
endDate: (now: moment.Moment) => {
|
|
108
|
+
return now;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
'1dayago': {
|
|
113
|
+
label: 'DateRange.1daysago',
|
|
114
|
+
startDate: (now: moment.Moment) => {
|
|
115
|
+
return now.add(-1, 'days');
|
|
116
|
+
},
|
|
117
|
+
endDate: (now: moment.Moment) => {
|
|
118
|
+
return now;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
'7daysago': {
|
|
123
|
+
label: 'DateRange.7daysago',
|
|
124
|
+
startDate: (now: moment.Moment) => {
|
|
125
|
+
return now.add(-7, 'days').startOf('day');
|
|
126
|
+
},
|
|
127
|
+
endDate: (now: moment.Moment) => {
|
|
128
|
+
return now.add(-1, 'days').endOf('day');
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
'30daysago': {
|
|
133
|
+
label: 'DateRange.30daysago',
|
|
134
|
+
startDate: (now: moment.Moment) => {
|
|
135
|
+
return now.add(-30, 'days').startOf('day');
|
|
136
|
+
},
|
|
137
|
+
endDate: (now: moment.Moment) => {
|
|
138
|
+
return now.add(-1, 'days').endOf('day');
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
'90daysago': {
|
|
143
|
+
label: 'DateRange.90daysago',
|
|
144
|
+
startDate: (now: moment.Moment) => {
|
|
145
|
+
return now.add(-90, 'days').startOf('day');
|
|
146
|
+
},
|
|
147
|
+
endDate: (now: moment.Moment) => {
|
|
148
|
+
return now.add(-1, 'days').endOf('day');
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
'prevweek': {
|
|
153
|
+
label: 'DateRange.lastWeek',
|
|
154
|
+
startDate: (now: moment.Moment) => {
|
|
155
|
+
return now.startOf('week').add(-1, 'weeks');
|
|
156
|
+
},
|
|
157
|
+
endDate: (now: moment.Moment) => {
|
|
158
|
+
return now.startOf('week').add(-1, 'days').endOf('day');
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
'thisweek': {
|
|
163
|
+
label: 'DateRange.thisWeek',
|
|
164
|
+
startDate: (now: moment.Moment) => {
|
|
165
|
+
return now.startOf('week');
|
|
166
|
+
},
|
|
167
|
+
endDate: (now: moment.Moment) => {
|
|
168
|
+
return now.endOf('week');
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
'thismonth': {
|
|
173
|
+
label: 'DateRange.thisMonth',
|
|
174
|
+
startDate: (now: moment.Moment) => {
|
|
175
|
+
return now.startOf('month');
|
|
176
|
+
},
|
|
177
|
+
endDate: (now: moment.Moment) => {
|
|
178
|
+
return now.endOf('month');
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
'thisquarter': {
|
|
183
|
+
label: 'DateRange.thisQuarter',
|
|
184
|
+
startDate: (now: moment.Moment) => {
|
|
185
|
+
return now.startOf('quarter');
|
|
186
|
+
},
|
|
187
|
+
endDate: (now: moment.Moment) => {
|
|
188
|
+
return now.endOf('quarter');
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
'prevmonth': {
|
|
193
|
+
label: 'DateRange.lastMonth',
|
|
194
|
+
startDate: (now: moment.Moment) => {
|
|
195
|
+
return now.startOf('month').add(-1, 'month');
|
|
196
|
+
},
|
|
197
|
+
endDate: (now: moment.Moment) => {
|
|
198
|
+
return now.startOf('month').add(-1, 'day').endOf('day');
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
'prevquarter': {
|
|
203
|
+
label: 'DateRange.lastQuarter',
|
|
204
|
+
startDate: (now: moment.Moment) => {
|
|
205
|
+
return now.startOf('quarter').add(-1, 'quarter');
|
|
206
|
+
},
|
|
207
|
+
endDate: (now: moment.Moment) => {
|
|
208
|
+
return now.startOf('quarter').add(-1, 'day').endOf('day');
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
'thisyear': {
|
|
213
|
+
label: 'DateRange.thisYear',
|
|
214
|
+
startDate: (now: moment.Moment) => {
|
|
215
|
+
return now.startOf('year');
|
|
216
|
+
},
|
|
217
|
+
endDate: (now: moment.Moment) => {
|
|
218
|
+
return now.endOf('year');
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
// 兼容一下之前的用法 'lastYear'
|
|
223
|
+
'prevyear': {
|
|
224
|
+
label: 'DateRange.lastYear',
|
|
225
|
+
startDate: (now: moment.Moment) => {
|
|
226
|
+
return now.startOf('year').add(-1, 'year');
|
|
227
|
+
},
|
|
228
|
+
endDate: (now: moment.Moment) => {
|
|
229
|
+
return now.endOf('year').add(-1, 'year').endOf('day');
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
'lastYear': {
|
|
234
|
+
label: 'DateRange.lastYear',
|
|
235
|
+
startDate: (now: moment.Moment) => {
|
|
236
|
+
return now.startOf('year').add(-1, 'year');
|
|
237
|
+
},
|
|
238
|
+
endDate: (now: moment.Moment) => {
|
|
239
|
+
return now.endOf('year').add(-1, 'year').endOf('day');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const advancedRanges = [
|
|
245
|
+
{
|
|
246
|
+
regexp: /^(\d+)hoursago$/,
|
|
247
|
+
resolve: (__: any, _: string, hours: string) => {
|
|
248
|
+
return {
|
|
249
|
+
label: __('DateRange.hoursago', {hours}),
|
|
250
|
+
startDate: (now: moment.Moment) => {
|
|
251
|
+
return now.add(-hours, 'hours').startOf('hour');
|
|
252
|
+
},
|
|
253
|
+
endDate: (now: moment.Moment) => {
|
|
254
|
+
return now.add(-1, 'hours').endOf('hours');
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
regexp: /^(\d+)hourslater$/,
|
|
261
|
+
resolve: (__: any, _: string, hours: string) => {
|
|
262
|
+
return {
|
|
263
|
+
label: __('DateRange.hourslater', {hours}),
|
|
264
|
+
startDate: (now: moment.Moment) => {
|
|
265
|
+
return now.startOf('hour');
|
|
266
|
+
},
|
|
267
|
+
endDate: (now: moment.Moment) => {
|
|
268
|
+
return now.add(hours, 'hours').endOf('hour');
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
regexp: /^(\d+)daysago$/,
|
|
275
|
+
resolve: (__: any, _: string, days: string) => {
|
|
276
|
+
return {
|
|
277
|
+
label: __('DateRange.daysago', {days}),
|
|
278
|
+
startDate: (now: moment.Moment) => {
|
|
279
|
+
return now.add(-days, 'days').startOf('day');
|
|
280
|
+
},
|
|
281
|
+
endDate: (now: moment.Moment) => {
|
|
282
|
+
return now.add(-1, 'days').endOf('day');
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
regexp: /^(\d+)dayslater$/,
|
|
289
|
+
resolve: (__: any, _: string, days: string) => {
|
|
290
|
+
return {
|
|
291
|
+
label: __('DateRange.dayslater', {days}),
|
|
292
|
+
startDate: (now: moment.Moment) => {
|
|
293
|
+
return now.startOf('day');
|
|
294
|
+
},
|
|
295
|
+
endDate: (now: moment.Moment) => {
|
|
296
|
+
return now.add(days, 'days').endOf('day');
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
regexp: /^(\d+)weeksago$/,
|
|
303
|
+
resolve: (__: any, _: string, weeks: string) => {
|
|
304
|
+
return {
|
|
305
|
+
label: __('DateRange.weeksago', {weeks}),
|
|
306
|
+
startDate: (now: moment.Moment) => {
|
|
307
|
+
return now.startOf('week').add(-weeks, 'weeks');
|
|
308
|
+
},
|
|
309
|
+
endDate: (now: moment.Moment) => {
|
|
310
|
+
return now.startOf('week').add(-1, 'days').endOf('day');
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
regexp: /^(\d+)weekslater$/,
|
|
317
|
+
resolve: (__: any, _: string, weeks: string) => {
|
|
318
|
+
return {
|
|
319
|
+
label: __('DateRange.weekslater', {weeks}),
|
|
320
|
+
startDate: (now: moment.Moment) => {
|
|
321
|
+
return now.startOf('week');
|
|
322
|
+
},
|
|
323
|
+
endDate: (now: moment.Moment) => {
|
|
324
|
+
return now.startOf('week').add(weeks, 'weeks').endOf('day');
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
regexp: /^(\d+)monthsago$/,
|
|
331
|
+
resolve: (__: any, _: string, months: string) => {
|
|
332
|
+
return {
|
|
333
|
+
label: __('DateRange.monthsago', {months}),
|
|
334
|
+
startDate: (now: moment.Moment) => {
|
|
335
|
+
return now.startOf('months').add(-months, 'months');
|
|
336
|
+
},
|
|
337
|
+
endDate: (now: moment.Moment) => {
|
|
338
|
+
return now.startOf('month').add(-1, 'days').endOf('day');
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
regexp: /^(\d+)monthslater$/,
|
|
345
|
+
resolve: (__: any, _: string, months: string) => {
|
|
346
|
+
return {
|
|
347
|
+
label: __('DateRange.monthslater', {months}),
|
|
348
|
+
startDate: (now: moment.Moment) => {
|
|
349
|
+
return now.startOf('month');
|
|
350
|
+
},
|
|
351
|
+
endDate: (now: moment.Moment) => {
|
|
352
|
+
return now.startOf('month').add(months, 'months').endOf('day');
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
regexp: /^(\d+)quartersago$/,
|
|
359
|
+
resolve: (__: any, _: string, quarters: string) => {
|
|
360
|
+
return {
|
|
361
|
+
label: __('DateRange.quartersago', {quarters}),
|
|
362
|
+
startDate: (now: moment.Moment) => {
|
|
363
|
+
return now.startOf('quarters').add(-quarters, 'quarters');
|
|
364
|
+
},
|
|
365
|
+
endDate: (now: moment.Moment) => {
|
|
366
|
+
return now.startOf('quarter').add(-1, 'days').endOf('day');
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
regexp: /^(\d+)quarterslater$/,
|
|
373
|
+
resolve: (__: any, _: string, quarters: string) => {
|
|
374
|
+
return {
|
|
375
|
+
label: __('DateRange.quarterslater', {quarters}),
|
|
376
|
+
startDate: (now: moment.Moment) => {
|
|
377
|
+
return now.startOf('quarter');
|
|
378
|
+
},
|
|
379
|
+
endDate: (now: moment.Moment) => {
|
|
380
|
+
return now.startOf('quarter').add(quarters, 'quarters').endOf('day');
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
regexp: /^(\d+)yearsago$/,
|
|
387
|
+
resolve: (__: any, _: string, years: string) => {
|
|
388
|
+
return {
|
|
389
|
+
label: __('DateRange.yearsago', {years}),
|
|
390
|
+
startDate: (now: moment.Moment) => {
|
|
391
|
+
return now.startOf('years').add(-years, 'years');
|
|
392
|
+
},
|
|
393
|
+
endDate: (now: moment.Moment) => {
|
|
394
|
+
return now.startOf('year').add(-1, 'days').endOf('day');
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
regexp: /^(\d+)yearslater$/,
|
|
401
|
+
resolve: (__: any, _: string, years: string) => {
|
|
402
|
+
return {
|
|
403
|
+
label: __('DateRange.yearslater', {years}),
|
|
404
|
+
startDate: (now: moment.Moment) => {
|
|
405
|
+
return now.startOf('year');
|
|
406
|
+
},
|
|
407
|
+
endDate: (now: moment.Moment) => {
|
|
408
|
+
return now.startOf('year').add(years, 'years').endOf('day');
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
];
|
|
414
|
+
|
|
415
|
+
export class DateRangePicker extends React.Component<
|
|
416
|
+
DateRangePickerProps,
|
|
417
|
+
DateRangePickerState
|
|
418
|
+
> {
|
|
419
|
+
static defaultProps = {
|
|
420
|
+
startPlaceholder: 'Calendar.startPick',
|
|
421
|
+
endPlaceholder: 'Calendar.endPick',
|
|
422
|
+
format: 'X',
|
|
423
|
+
inputFormat: 'YYYY-MM-DD',
|
|
424
|
+
joinValues: true,
|
|
425
|
+
clearable: true,
|
|
426
|
+
delimiter: ',',
|
|
427
|
+
ranges: 'yesterday,7daysago,prevweek,thismonth,prevmonth,prevquarter',
|
|
428
|
+
resetValue: '',
|
|
429
|
+
closeOnSelect: true,
|
|
430
|
+
overlayPlacement: 'auto'
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
innerDom: any;
|
|
434
|
+
popover: any;
|
|
435
|
+
input?: HTMLInputElement;
|
|
436
|
+
|
|
437
|
+
// 是否是第一次点击,如果是第一次点击就可以点任意地址
|
|
438
|
+
isFirstClick: boolean = true;
|
|
439
|
+
|
|
440
|
+
static formatValue(
|
|
441
|
+
newValue: any,
|
|
442
|
+
format: string,
|
|
443
|
+
joinValues: boolean,
|
|
444
|
+
delimiter: string,
|
|
445
|
+
utc = false
|
|
446
|
+
) {
|
|
447
|
+
newValue = [
|
|
448
|
+
(utc ? moment.utc(newValue.startDate) : newValue.startDate)?.format(
|
|
449
|
+
format
|
|
450
|
+
),
|
|
451
|
+
(utc ? moment.utc(newValue.endDate) : newValue.endDate)?.format(format)
|
|
452
|
+
];
|
|
453
|
+
|
|
454
|
+
if (joinValues) {
|
|
455
|
+
newValue = newValue.join(delimiter);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return newValue;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
static unFormatValue(
|
|
462
|
+
value: any,
|
|
463
|
+
format: string,
|
|
464
|
+
joinValues: boolean,
|
|
465
|
+
delimiter: string
|
|
466
|
+
) {
|
|
467
|
+
if (!value) {
|
|
468
|
+
return {
|
|
469
|
+
startDate: undefined,
|
|
470
|
+
endDate: undefined
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (joinValues && typeof value === 'string') {
|
|
475
|
+
value = value.split(delimiter);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
startDate: value[0] ? moment(value[0], format) : undefined,
|
|
480
|
+
endDate: value[1] ? moment(value[1], format) : undefined
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
dom: React.RefObject<HTMLDivElement>;
|
|
485
|
+
calendarRef: React.RefObject<HTMLDivElement>;
|
|
486
|
+
nextMonth = moment().add(1, 'months');
|
|
487
|
+
|
|
488
|
+
startInputRef: React.RefObject<HTMLInputElement>;
|
|
489
|
+
endInputRef: React.RefObject<HTMLInputElement>;
|
|
490
|
+
|
|
491
|
+
constructor(props: DateRangePickerProps) {
|
|
492
|
+
super(props);
|
|
493
|
+
|
|
494
|
+
this.startInputRef = React.createRef();
|
|
495
|
+
this.endInputRef = React.createRef();
|
|
496
|
+
this.calendarRef = React.createRef();
|
|
497
|
+
this.open = this.open.bind(this);
|
|
498
|
+
this.openStart = this.openStart.bind(this);
|
|
499
|
+
this.openEnd = this.openEnd.bind(this);
|
|
500
|
+
this.close = this.close.bind(this);
|
|
501
|
+
this.startInputChange = this.startInputChange.bind(this);
|
|
502
|
+
this.endInputChange = this.endInputChange.bind(this);
|
|
503
|
+
this.handleDateChange = this.handleDateChange.bind(this);
|
|
504
|
+
this.handleStartDateChange = this.handleStartDateChange.bind(this);
|
|
505
|
+
this.handeleEndDateChange = this.handeleEndDateChange.bind(this);
|
|
506
|
+
this.handleTimeStartChange = this.handleTimeStartChange.bind(this);
|
|
507
|
+
this.handleTimeEndChange = this.handleTimeEndChange.bind(this);
|
|
508
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
509
|
+
this.handleBlur = this.handleBlur.bind(this);
|
|
510
|
+
this.checkStartIsValidDate = this.checkStartIsValidDate.bind(this);
|
|
511
|
+
this.checkEndIsValidDate = this.checkEndIsValidDate.bind(this);
|
|
512
|
+
this.confirm = this.confirm.bind(this);
|
|
513
|
+
this.clearValue = this.clearValue.bind(this);
|
|
514
|
+
this.dom = React.createRef();
|
|
515
|
+
this.handleClick = this.handleClick.bind(this);
|
|
516
|
+
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
517
|
+
this.handlePopOverClick = this.handlePopOverClick.bind(this);
|
|
518
|
+
this.renderDay = this.renderDay.bind(this);
|
|
519
|
+
this.renderMonth = this.renderMonth.bind(this);
|
|
520
|
+
this.renderQuarter = this.renderQuarter.bind(this);
|
|
521
|
+
this.renderYear = this.renderYear.bind(this);
|
|
522
|
+
this.handleMobileChange = this.handleMobileChange.bind(this);
|
|
523
|
+
this.handleOutClick = this.handleOutClick.bind(this);
|
|
524
|
+
const {format, joinValues, delimiter, value, inputFormat} = this.props;
|
|
525
|
+
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
|
526
|
+
value,
|
|
527
|
+
format,
|
|
528
|
+
joinValues,
|
|
529
|
+
delimiter
|
|
530
|
+
);
|
|
531
|
+
this.state = {
|
|
532
|
+
isOpened: false,
|
|
533
|
+
isFocused: false,
|
|
534
|
+
editState: 'start',
|
|
535
|
+
startDate,
|
|
536
|
+
endDate,
|
|
537
|
+
startInputValue: startDate?.format(inputFormat),
|
|
538
|
+
endInputValue: endDate?.format(inputFormat)
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
componentDidMount() {
|
|
542
|
+
document.body.addEventListener('click', this.handleOutClick, true);
|
|
543
|
+
this.props?.onRef?.(this);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
componentWillUnmount() {
|
|
547
|
+
document.body.removeEventListener('click', this.handleOutClick, true);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
handleOutClick(e: Event) {
|
|
551
|
+
if (
|
|
552
|
+
!e.target ||
|
|
553
|
+
!this.dom.current ||
|
|
554
|
+
this.dom.current.contains(e.target as HTMLElement) ||
|
|
555
|
+
!this.calendarRef.current ||
|
|
556
|
+
this.calendarRef.current.contains(e.target as HTMLElement)
|
|
557
|
+
) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (this.state.isOpened) {
|
|
561
|
+
e.preventDefault();
|
|
562
|
+
this.close();
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
componentDidUpdate(prevProps: DateRangePickerProps) {
|
|
567
|
+
const props = this.props;
|
|
568
|
+
const {value, format, joinValues, inputFormat, delimiter} = props;
|
|
569
|
+
|
|
570
|
+
if (prevProps.value !== value) {
|
|
571
|
+
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
|
572
|
+
value,
|
|
573
|
+
format,
|
|
574
|
+
joinValues,
|
|
575
|
+
delimiter
|
|
576
|
+
);
|
|
577
|
+
this.setState({
|
|
578
|
+
startDate,
|
|
579
|
+
endDate,
|
|
580
|
+
startInputValue: startDate?.format(inputFormat),
|
|
581
|
+
endInputValue: endDate?.format(inputFormat)
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
focus() {
|
|
587
|
+
if (!this.dom.current || this.props.disabled) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
this.dom.current.focus();
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
blur() {
|
|
595
|
+
if (!this.dom.current || this.props.disabled) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
this.dom.current.blur();
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
handleFocus(e: React.SyntheticEvent<HTMLDivElement>) {
|
|
603
|
+
this.setState({
|
|
604
|
+
isFocused: true
|
|
605
|
+
});
|
|
606
|
+
const {onFocus} = this.props;
|
|
607
|
+
onFocus && onFocus(e);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
handleBlur(e: React.SyntheticEvent<HTMLDivElement>) {
|
|
611
|
+
this.setState({
|
|
612
|
+
isFocused: false
|
|
613
|
+
});
|
|
614
|
+
const {onBlur} = this.props;
|
|
615
|
+
onBlur && onBlur(e);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
open() {
|
|
619
|
+
if (this.props.disabled) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
this.setState({
|
|
624
|
+
isOpened: true
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
openStart() {
|
|
629
|
+
if (this.props.disabled) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
this.setState({
|
|
633
|
+
isOpened: true,
|
|
634
|
+
editState: 'start'
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
openEnd() {
|
|
639
|
+
if (this.props.disabled) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this.setState({
|
|
643
|
+
isOpened: true,
|
|
644
|
+
editState: 'end'
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
close() {
|
|
649
|
+
this.setState(
|
|
650
|
+
{
|
|
651
|
+
isOpened: false,
|
|
652
|
+
editState: undefined
|
|
653
|
+
},
|
|
654
|
+
this.blur
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
handleClick() {
|
|
659
|
+
this.state.isOpened ? this.close() : this.open();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
handlePopOverClick(e: React.MouseEvent<any>) {
|
|
663
|
+
e.stopPropagation();
|
|
664
|
+
e.preventDefault();
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
handleKeyPress(e: React.KeyboardEvent) {
|
|
668
|
+
if (e.key === ' ') {
|
|
669
|
+
this.handleClick();
|
|
670
|
+
e.preventDefault();
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
confirm() {
|
|
675
|
+
if (!this.state.startDate && !this.state.endDate) {
|
|
676
|
+
return;
|
|
677
|
+
} else if (this.state.startDate?.isAfter(this.state.endDate)) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
this.props.onChange(
|
|
682
|
+
DateRangePicker.formatValue(
|
|
683
|
+
{
|
|
684
|
+
startDate: this.state.startDate,
|
|
685
|
+
endDate: this.state.endDate
|
|
686
|
+
},
|
|
687
|
+
this.props.format,
|
|
688
|
+
this.props.joinValues,
|
|
689
|
+
this.props.delimiter,
|
|
690
|
+
this.props.utc
|
|
691
|
+
)
|
|
692
|
+
);
|
|
693
|
+
if (this.state.startDate && !this.state.endDate) {
|
|
694
|
+
this.setState({editState: 'end'});
|
|
695
|
+
} else {
|
|
696
|
+
this.close();
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
filterDate(
|
|
701
|
+
date: moment.Moment,
|
|
702
|
+
originValue?: moment.Moment,
|
|
703
|
+
timeFormat?: string,
|
|
704
|
+
type: 'start' | 'end' = 'start'
|
|
705
|
+
): moment.Moment {
|
|
706
|
+
let value = date.clone();
|
|
707
|
+
|
|
708
|
+
// 没有初始值
|
|
709
|
+
if (!originValue) {
|
|
710
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('day');
|
|
711
|
+
} else if (typeof timeFormat === 'string' && /ss/.test(timeFormat)) {
|
|
712
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('second');
|
|
713
|
+
} else if (typeof timeFormat === 'string' && /mm/.test(timeFormat)) {
|
|
714
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('minute');
|
|
715
|
+
} else if (typeof timeFormat === 'string' && /HH/i.test(timeFormat)) {
|
|
716
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('hour');
|
|
717
|
+
} else if (typeof timeFormat === 'string' && /Q/i.test(timeFormat)) {
|
|
718
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('quarter');
|
|
719
|
+
} else {
|
|
720
|
+
value = value[type === 'start' ? 'startOf' : 'endOf']('day');
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
return value;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
handleDateChange(newValue: moment.Moment) {
|
|
727
|
+
let {editState} = this.state;
|
|
728
|
+
if (editState === 'start') {
|
|
729
|
+
this.handleStartDateChange(newValue);
|
|
730
|
+
} else if (editState === 'end') {
|
|
731
|
+
this.handeleEndDateChange(newValue);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
handleStartDateChange(newValue: moment.Moment) {
|
|
736
|
+
const {timeFormat, minDate, inputFormat, type} = this.props;
|
|
737
|
+
let {startDate} = this.state;
|
|
738
|
+
if (minDate && newValue.isBefore(minDate)) {
|
|
739
|
+
newValue = minDate;
|
|
740
|
+
}
|
|
741
|
+
const date = this.filterDate(
|
|
742
|
+
newValue,
|
|
743
|
+
startDate || minDate,
|
|
744
|
+
timeFormat,
|
|
745
|
+
'start'
|
|
746
|
+
);
|
|
747
|
+
const newState = {
|
|
748
|
+
startDate: date,
|
|
749
|
+
startInputValue: date.format(inputFormat)
|
|
750
|
+
} as any;
|
|
751
|
+
// 这些没有时间的选择点第一次后第二次就是选结束时间
|
|
752
|
+
if (
|
|
753
|
+
type === 'input-date-range' ||
|
|
754
|
+
type === 'input-year-range' ||
|
|
755
|
+
type === 'input-quarter-range' ||
|
|
756
|
+
type === 'input-month-range'
|
|
757
|
+
) {
|
|
758
|
+
newState.editState = 'end';
|
|
759
|
+
}
|
|
760
|
+
this.setState(newState);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
handeleEndDateChange(newValue: moment.Moment) {
|
|
764
|
+
const {embed, timeFormat, inputFormat} = this.props;
|
|
765
|
+
let {startDate, endDate} = this.state;
|
|
766
|
+
newValue = this.getEndDateByDuration(newValue);
|
|
767
|
+
|
|
768
|
+
// 如果结束时间在前面,需要清空开始时间
|
|
769
|
+
if (newValue.isBefore(startDate)) {
|
|
770
|
+
this.setState({
|
|
771
|
+
startDate: undefined,
|
|
772
|
+
startInputValue: ''
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const date = this.filterDate(newValue, endDate, timeFormat, 'end');
|
|
777
|
+
this.setState(
|
|
778
|
+
{
|
|
779
|
+
endDate: date,
|
|
780
|
+
endInputValue: date.format(inputFormat)
|
|
781
|
+
},
|
|
782
|
+
() => {
|
|
783
|
+
embed && this.confirm();
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// 手动控制输入时间
|
|
789
|
+
startInputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
790
|
+
const {onChange, inputFormat, format, utc} = this.props;
|
|
791
|
+
const value = e.currentTarget.value;
|
|
792
|
+
this.setState({startInputValue: value});
|
|
793
|
+
if (value === '') {
|
|
794
|
+
onChange('');
|
|
795
|
+
} else {
|
|
796
|
+
let newDate = this.getStartDateByDuration(moment(value, inputFormat));
|
|
797
|
+
this.setState({startDate: newDate});
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
endInputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
802
|
+
const {onChange, inputFormat, format, utc} = this.props;
|
|
803
|
+
const value = e.currentTarget.value;
|
|
804
|
+
this.setState({endInputValue: value});
|
|
805
|
+
if (value === '') {
|
|
806
|
+
onChange('');
|
|
807
|
+
} else {
|
|
808
|
+
let newDate = this.getEndDateByDuration(moment(value, inputFormat));
|
|
809
|
+
this.setState({endDate: newDate});
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// 根据 duration 修复结束时间
|
|
814
|
+
getEndDateByDuration(newValue: moment.Moment) {
|
|
815
|
+
const {minDuration, maxDuration, type} = this.props;
|
|
816
|
+
let {startDate, endDate, editState} = this.state;
|
|
817
|
+
if (!startDate) {
|
|
818
|
+
return newValue;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// 时间范围必须统一成同一天,不然会不一致
|
|
822
|
+
if (type === 'input-time-range' && startDate) {
|
|
823
|
+
newValue.set({
|
|
824
|
+
year: startDate.year(),
|
|
825
|
+
month: startDate.month(),
|
|
826
|
+
date: startDate.date()
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
if (minDuration && newValue.isBefore(startDate.clone().add(minDuration))) {
|
|
831
|
+
newValue = startDate.clone().add(minDuration);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (maxDuration && newValue.isAfter(startDate.clone().add(maxDuration))) {
|
|
835
|
+
newValue = startDate.clone().add(maxDuration);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
return newValue;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// 根据 duration 修复起始时间
|
|
842
|
+
getStartDateByDuration(newValue: moment.Moment) {
|
|
843
|
+
const {minDuration, maxDuration, type} = this.props;
|
|
844
|
+
let {endDate, editState} = this.state;
|
|
845
|
+
if (!endDate) {
|
|
846
|
+
return newValue;
|
|
847
|
+
}
|
|
848
|
+
// 时间范围必须统一成同一天,不然会不一致
|
|
849
|
+
if (type === 'input-time-range' && endDate) {
|
|
850
|
+
newValue.set({
|
|
851
|
+
year: endDate.year(),
|
|
852
|
+
month: endDate.month(),
|
|
853
|
+
date: endDate.date()
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (
|
|
858
|
+
minDuration &&
|
|
859
|
+
newValue.isBefore(endDate.clone().subtract(minDuration))
|
|
860
|
+
) {
|
|
861
|
+
newValue = endDate.clone().subtract(minDuration);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (
|
|
865
|
+
maxDuration &&
|
|
866
|
+
newValue.isAfter(endDate.clone().subtract(maxDuration))
|
|
867
|
+
) {
|
|
868
|
+
newValue = endDate.clone().subtract(maxDuration);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return newValue;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// 主要用于处理时间的情况
|
|
875
|
+
handleTimeStartChange(newValue: moment.Moment) {
|
|
876
|
+
const {embed, timeFormat, inputFormat, minDuration, maxDuration, minDate} =
|
|
877
|
+
this.props;
|
|
878
|
+
const {startDate, endDate} = this.state;
|
|
879
|
+
|
|
880
|
+
// 时间范围必须统一成同一天,不然会不一致
|
|
881
|
+
if (endDate) {
|
|
882
|
+
newValue.set({
|
|
883
|
+
year: endDate.year(),
|
|
884
|
+
month: endDate.month(),
|
|
885
|
+
date: endDate.date()
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
|
890
|
+
newValue = minDate;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
this.setState(
|
|
894
|
+
{
|
|
895
|
+
startDate: newValue,
|
|
896
|
+
startInputValue: newValue.format(inputFormat)
|
|
897
|
+
},
|
|
898
|
+
() => {
|
|
899
|
+
embed && this.confirm();
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
handleTimeEndChange(newValue: moment.Moment) {
|
|
905
|
+
const {embed, timeFormat, inputFormat, minDuration, maxDuration, maxDate} =
|
|
906
|
+
this.props;
|
|
907
|
+
const {startDate, endDate} = this.state;
|
|
908
|
+
if (startDate) {
|
|
909
|
+
newValue.set({
|
|
910
|
+
year: startDate.year(),
|
|
911
|
+
month: startDate.month(),
|
|
912
|
+
date: startDate.date()
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
|
|
917
|
+
newValue = maxDate;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (
|
|
921
|
+
startDate &&
|
|
922
|
+
minDuration &&
|
|
923
|
+
newValue.isAfter(startDate.clone().add(minDuration))
|
|
924
|
+
) {
|
|
925
|
+
newValue = startDate.clone().add(minDuration);
|
|
926
|
+
}
|
|
927
|
+
if (
|
|
928
|
+
startDate &&
|
|
929
|
+
maxDuration &&
|
|
930
|
+
newValue.isBefore(startDate.clone().add(maxDuration))
|
|
931
|
+
) {
|
|
932
|
+
newValue = startDate.clone().add(maxDuration);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
this.setState(
|
|
936
|
+
{
|
|
937
|
+
endDate: newValue,
|
|
938
|
+
endInputValue: newValue.format(inputFormat)
|
|
939
|
+
},
|
|
940
|
+
() => {
|
|
941
|
+
embed && this.confirm();
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
handleMobileChange(data: any, callback?: () => void) {
|
|
947
|
+
this.setState(
|
|
948
|
+
{
|
|
949
|
+
startDate: data.startDate,
|
|
950
|
+
endDate: data.endDate
|
|
951
|
+
},
|
|
952
|
+
callback
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
selectRannge(range: PlainObject) {
|
|
957
|
+
const {closeOnSelect, minDate, maxDate} = this.props;
|
|
958
|
+
const now = moment();
|
|
959
|
+
this.setState(
|
|
960
|
+
{
|
|
961
|
+
startDate:
|
|
962
|
+
minDate && minDate.isValid()
|
|
963
|
+
? moment.max(range.startDate(now.clone()), minDate)
|
|
964
|
+
: range.startDate(now.clone()),
|
|
965
|
+
endDate:
|
|
966
|
+
maxDate && maxDate.isValid()
|
|
967
|
+
? moment.min(maxDate, range.endDate(now.clone()))
|
|
968
|
+
: range.endDate(now.clone())
|
|
969
|
+
},
|
|
970
|
+
closeOnSelect ? this.confirm : noop
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
renderRanges(ranges: string | Array<ShortCuts> | undefined) {
|
|
975
|
+
if (!ranges) {
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
const {classPrefix: ns} = this.props;
|
|
979
|
+
let rangeArr: Array<string | ShortCuts>;
|
|
980
|
+
if (typeof ranges === 'string') {
|
|
981
|
+
rangeArr = ranges.split(',');
|
|
982
|
+
} else {
|
|
983
|
+
rangeArr = ranges;
|
|
984
|
+
}
|
|
985
|
+
const __ = this.props.translate;
|
|
986
|
+
|
|
987
|
+
return (
|
|
988
|
+
<ul className={`${ns}DateRangePicker-rangers`}>
|
|
989
|
+
{rangeArr.map(item => {
|
|
990
|
+
if (!item) {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
let range: PlainObject = {};
|
|
994
|
+
if (typeof item === 'string') {
|
|
995
|
+
if (availableRanges[item]) {
|
|
996
|
+
range = availableRanges[item];
|
|
997
|
+
range.key = item;
|
|
998
|
+
} else {
|
|
999
|
+
// 通过正则尝试匹配
|
|
1000
|
+
for (let i = 0, len = advancedRanges.length; i < len; i++) {
|
|
1001
|
+
let value = advancedRanges[i];
|
|
1002
|
+
const m = value.regexp.exec(item);
|
|
1003
|
+
if (m) {
|
|
1004
|
+
range = value.resolve.apply(item, [__, ...m]);
|
|
1005
|
+
range.key = item;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
} else if (
|
|
1010
|
+
(item as ShortCutDateRange).startDate &&
|
|
1011
|
+
(item as ShortCutDateRange).endDate
|
|
1012
|
+
) {
|
|
1013
|
+
range = {
|
|
1014
|
+
...item,
|
|
1015
|
+
startDate: () => (item as ShortCutDateRange).startDate,
|
|
1016
|
+
endDate: () => (item as ShortCutDateRange).endDate
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
if (Object.keys(range).length) {
|
|
1020
|
+
return (
|
|
1021
|
+
<li
|
|
1022
|
+
className={`${ns}DateRangePicker-ranger`}
|
|
1023
|
+
onClick={() => this.selectRannge(range)}
|
|
1024
|
+
key={range.key || range.label}
|
|
1025
|
+
>
|
|
1026
|
+
<a>{__(range.label)}</a>
|
|
1027
|
+
</li>
|
|
1028
|
+
);
|
|
1029
|
+
} else {
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
})}
|
|
1033
|
+
</ul>
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
clearValue(e: React.MouseEvent<any>) {
|
|
1038
|
+
e.preventDefault();
|
|
1039
|
+
e.stopPropagation();
|
|
1040
|
+
const {onChange} = this.props;
|
|
1041
|
+
this.setState({startInputValue: '', endInputValue: ''});
|
|
1042
|
+
onChange('');
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
// 清空
|
|
1046
|
+
clear() {
|
|
1047
|
+
const {onChange} = this.props;
|
|
1048
|
+
this.setState({startInputValue: '', endInputValue: ''});
|
|
1049
|
+
onChange('');
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// 重置
|
|
1053
|
+
reset() {
|
|
1054
|
+
const {resetValue, onChange, format, joinValues, delimiter, inputFormat} =
|
|
1055
|
+
this.props;
|
|
1056
|
+
if (!resetValue) {
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
|
1060
|
+
resetValue,
|
|
1061
|
+
format,
|
|
1062
|
+
joinValues,
|
|
1063
|
+
delimiter
|
|
1064
|
+
);
|
|
1065
|
+
onChange(resetValue);
|
|
1066
|
+
this.setState({
|
|
1067
|
+
startInputValue: startDate?.format(inputFormat),
|
|
1068
|
+
endInputValue: endDate?.format(inputFormat)
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
checkStartIsValidDate(currentDate: moment.Moment) {
|
|
1073
|
+
let {endDate, startDate} = this.state;
|
|
1074
|
+
let {minDate, maxDate, minDuration, maxDuration, viewMode} = this.props;
|
|
1075
|
+
const precision = viewMode === 'time' ? 'hours' : viewMode || 'day';
|
|
1076
|
+
|
|
1077
|
+
maxDate =
|
|
1078
|
+
maxDate && endDate
|
|
1079
|
+
? maxDate.isBefore(endDate)
|
|
1080
|
+
? maxDate
|
|
1081
|
+
: endDate
|
|
1082
|
+
: undefined;
|
|
1083
|
+
|
|
1084
|
+
if (minDate && currentDate.isBefore(minDate, precision)) {
|
|
1085
|
+
return false;
|
|
1086
|
+
} else if (maxDate && currentDate.isAfter(maxDate, precision)) {
|
|
1087
|
+
return false;
|
|
1088
|
+
} else if (
|
|
1089
|
+
// 如果配置了 minDuration 那么 EndDate - minDuration 之后的天数也不能选
|
|
1090
|
+
endDate &&
|
|
1091
|
+
minDuration &&
|
|
1092
|
+
currentDate.isAfter(endDate.clone().subtract(minDuration))
|
|
1093
|
+
) {
|
|
1094
|
+
return false;
|
|
1095
|
+
} else if (
|
|
1096
|
+
endDate &&
|
|
1097
|
+
maxDuration &&
|
|
1098
|
+
currentDate.isBefore(endDate.clone().subtract(maxDuration))
|
|
1099
|
+
) {
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
return true;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
checkEndIsValidDate(currentDate: moment.Moment) {
|
|
1107
|
+
let {startDate} = this.state;
|
|
1108
|
+
let {minDate, maxDate, minDuration, maxDuration, viewMode} = this.props;
|
|
1109
|
+
const precision = viewMode === 'time' ? 'hours' : viewMode || 'day';
|
|
1110
|
+
|
|
1111
|
+
minDate =
|
|
1112
|
+
minDate && startDate
|
|
1113
|
+
? minDate.isAfter(startDate)
|
|
1114
|
+
? minDate
|
|
1115
|
+
: startDate
|
|
1116
|
+
: undefined;
|
|
1117
|
+
|
|
1118
|
+
if (minDate && currentDate.isBefore(minDate, precision)) {
|
|
1119
|
+
return false;
|
|
1120
|
+
} else if (maxDate && currentDate.isAfter(maxDate, precision)) {
|
|
1121
|
+
return false;
|
|
1122
|
+
} else if (
|
|
1123
|
+
startDate &&
|
|
1124
|
+
minDuration &&
|
|
1125
|
+
currentDate.isBefore(startDate.clone().add(minDuration))
|
|
1126
|
+
) {
|
|
1127
|
+
return false;
|
|
1128
|
+
} else if (
|
|
1129
|
+
startDate &&
|
|
1130
|
+
maxDuration &&
|
|
1131
|
+
currentDate.isAfter(startDate.clone().add(maxDuration))
|
|
1132
|
+
) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return true;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
renderDay(props: any, currentDate: moment.Moment) {
|
|
1140
|
+
let {startDate, endDate} = this.state;
|
|
1141
|
+
|
|
1142
|
+
if (
|
|
1143
|
+
startDate &&
|
|
1144
|
+
endDate &&
|
|
1145
|
+
currentDate.isBetween(startDate, endDate, 'day', '[]')
|
|
1146
|
+
) {
|
|
1147
|
+
props.className += ' rdtBetween';
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
return (
|
|
1151
|
+
<td {...props}>
|
|
1152
|
+
<span>{currentDate.date()}</span>
|
|
1153
|
+
</td>
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
renderMonth(props: any, month: number, year: number, date: any) {
|
|
1158
|
+
const m = moment();
|
|
1159
|
+
const currentDate = m.year(year).month(month);
|
|
1160
|
+
const {startDate, endDate} = this.state;
|
|
1161
|
+
|
|
1162
|
+
var localMoment = m.localeData().monthsShort(m.month(month));
|
|
1163
|
+
var strLength = 3;
|
|
1164
|
+
var monthStrFixedLength = localMoment.substring(0, strLength);
|
|
1165
|
+
|
|
1166
|
+
if (
|
|
1167
|
+
startDate &&
|
|
1168
|
+
endDate &&
|
|
1169
|
+
currentDate.isBetween(startDate, endDate, 'month', '[]')
|
|
1170
|
+
) {
|
|
1171
|
+
props.className += ' rdtBetween';
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
return (
|
|
1175
|
+
<td {...props}>
|
|
1176
|
+
<span>{monthStrFixedLength}</span>
|
|
1177
|
+
</td>
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
renderQuarter(props: any, quarter: number, year: number) {
|
|
1182
|
+
const currentDate = moment().year(year).quarter(quarter);
|
|
1183
|
+
const {startDate, endDate} = this.state;
|
|
1184
|
+
|
|
1185
|
+
if (
|
|
1186
|
+
startDate &&
|
|
1187
|
+
endDate &&
|
|
1188
|
+
currentDate.isBetween(startDate, endDate, 'quarter', '[]')
|
|
1189
|
+
) {
|
|
1190
|
+
props.className += ' rdtBetween';
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
return (
|
|
1194
|
+
<td {...props}>
|
|
1195
|
+
<span>Q{quarter}</span>
|
|
1196
|
+
</td>
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
renderYear(props: any, year: number) {
|
|
1200
|
+
const currentDate = moment().year(year);
|
|
1201
|
+
const {startDate, endDate} = this.state;
|
|
1202
|
+
|
|
1203
|
+
if (
|
|
1204
|
+
startDate &&
|
|
1205
|
+
endDate &&
|
|
1206
|
+
currentDate.isBetween(startDate, endDate, 'year', '[]')
|
|
1207
|
+
) {
|
|
1208
|
+
props.className += ' rdtBetween';
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
return (
|
|
1212
|
+
<td {...props}>
|
|
1213
|
+
<span>{year}</span>
|
|
1214
|
+
</td>
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
renderCalendar() {
|
|
1219
|
+
const {
|
|
1220
|
+
classPrefix: ns,
|
|
1221
|
+
classnames: cx,
|
|
1222
|
+
dateFormat,
|
|
1223
|
+
timeFormat,
|
|
1224
|
+
inputFormat,
|
|
1225
|
+
ranges,
|
|
1226
|
+
locale,
|
|
1227
|
+
embed,
|
|
1228
|
+
type,
|
|
1229
|
+
viewMode = 'days'
|
|
1230
|
+
} = this.props;
|
|
1231
|
+
const __ = this.props.translate;
|
|
1232
|
+
|
|
1233
|
+
const {startDate, endDate, editState} = this.state;
|
|
1234
|
+
|
|
1235
|
+
// timeRange需要单独选择范围
|
|
1236
|
+
const isTimeRange = type === 'input-datetime-range' || viewMode === 'time';
|
|
1237
|
+
|
|
1238
|
+
return (
|
|
1239
|
+
<div className={`${ns}DateRangePicker-wrap`} ref={this.calendarRef}>
|
|
1240
|
+
{this.renderRanges(ranges)}
|
|
1241
|
+
{(!isTimeRange || (editState === 'start' && !embed)) && (
|
|
1242
|
+
<Calendar
|
|
1243
|
+
className={`${ns}DateRangePicker-start`}
|
|
1244
|
+
value={startDate}
|
|
1245
|
+
// 区分的原因是 time-range 左侧就只能选起始时间,而其它都能在左侧同时同时选择起始和结束
|
|
1246
|
+
// TODO: 后续得把 time-range 代码拆分出来
|
|
1247
|
+
onChange={
|
|
1248
|
+
type === 'input-datetime-range'
|
|
1249
|
+
? this.handleStartDateChange
|
|
1250
|
+
: viewMode === 'time'
|
|
1251
|
+
? this.handleTimeStartChange
|
|
1252
|
+
: this.handleDateChange
|
|
1253
|
+
}
|
|
1254
|
+
requiredConfirm={false}
|
|
1255
|
+
dateFormat={dateFormat}
|
|
1256
|
+
inputFormat={inputFormat}
|
|
1257
|
+
timeFormat={timeFormat}
|
|
1258
|
+
isValidDate={this.checkStartIsValidDate}
|
|
1259
|
+
viewMode={viewMode}
|
|
1260
|
+
input={false}
|
|
1261
|
+
onClose={this.close}
|
|
1262
|
+
renderDay={this.renderDay}
|
|
1263
|
+
renderMonth={this.renderMonth}
|
|
1264
|
+
renderQuarter={this.renderQuarter}
|
|
1265
|
+
renderYear={this.renderYear}
|
|
1266
|
+
locale={locale}
|
|
1267
|
+
timeRangeHeader="开始时间"
|
|
1268
|
+
/>
|
|
1269
|
+
)}
|
|
1270
|
+
{(!isTimeRange || (editState === 'end' && !embed)) && (
|
|
1271
|
+
<Calendar
|
|
1272
|
+
className={`${ns}DateRangePicker-end`}
|
|
1273
|
+
value={endDate}
|
|
1274
|
+
onChange={
|
|
1275
|
+
type === 'input-datetime-range'
|
|
1276
|
+
? this.handeleEndDateChange
|
|
1277
|
+
: viewMode === 'time'
|
|
1278
|
+
? this.handleTimeEndChange
|
|
1279
|
+
: this.handleDateChange
|
|
1280
|
+
}
|
|
1281
|
+
requiredConfirm={false}
|
|
1282
|
+
dateFormat={dateFormat}
|
|
1283
|
+
inputFormat={inputFormat}
|
|
1284
|
+
timeFormat={timeFormat}
|
|
1285
|
+
viewDate={this.nextMonth}
|
|
1286
|
+
isEndDate
|
|
1287
|
+
isValidDate={this.checkEndIsValidDate}
|
|
1288
|
+
viewMode={viewMode}
|
|
1289
|
+
input={false}
|
|
1290
|
+
onClose={this.close}
|
|
1291
|
+
renderDay={this.renderDay}
|
|
1292
|
+
renderMonth={this.renderMonth}
|
|
1293
|
+
renderQuarter={this.renderQuarter}
|
|
1294
|
+
renderYear={this.renderYear}
|
|
1295
|
+
locale={locale}
|
|
1296
|
+
timeRangeHeader="结束时间"
|
|
1297
|
+
/>
|
|
1298
|
+
)}
|
|
1299
|
+
|
|
1300
|
+
{embed ? null : (
|
|
1301
|
+
<div key="button" className={`${ns}DateRangePicker-actions`}>
|
|
1302
|
+
<a className={cx('Button', 'Button--default')} onClick={this.close}>
|
|
1303
|
+
{__('cancel')}
|
|
1304
|
+
</a>
|
|
1305
|
+
<a
|
|
1306
|
+
className={cx('Button', 'Button--primary', 'm-l-sm', {
|
|
1307
|
+
'is-disabled':
|
|
1308
|
+
(!this.state.startDate &&
|
|
1309
|
+
isTimeRange &&
|
|
1310
|
+
editState === 'start') ||
|
|
1311
|
+
(!this.state.endDate && isTimeRange && editState === 'end') ||
|
|
1312
|
+
this.state.endDate?.isBefore(this.state.startDate)
|
|
1313
|
+
})}
|
|
1314
|
+
onClick={this.confirm}
|
|
1315
|
+
>
|
|
1316
|
+
{__('confirm')}
|
|
1317
|
+
</a>
|
|
1318
|
+
</div>
|
|
1319
|
+
)}
|
|
1320
|
+
</div>
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
render() {
|
|
1325
|
+
const {
|
|
1326
|
+
className,
|
|
1327
|
+
popoverClassName,
|
|
1328
|
+
classPrefix: ns,
|
|
1329
|
+
classnames: cx,
|
|
1330
|
+
value,
|
|
1331
|
+
startPlaceholder,
|
|
1332
|
+
endPlaceholder,
|
|
1333
|
+
popOverContainer,
|
|
1334
|
+
inputFormat,
|
|
1335
|
+
format,
|
|
1336
|
+
joinValues,
|
|
1337
|
+
delimiter,
|
|
1338
|
+
clearable,
|
|
1339
|
+
disabled,
|
|
1340
|
+
embed,
|
|
1341
|
+
overlayPlacement,
|
|
1342
|
+
borderMode,
|
|
1343
|
+
useMobileUI,
|
|
1344
|
+
timeFormat,
|
|
1345
|
+
minDate,
|
|
1346
|
+
maxDate,
|
|
1347
|
+
minDuration,
|
|
1348
|
+
maxDuration,
|
|
1349
|
+
dateFormat,
|
|
1350
|
+
viewMode = 'days',
|
|
1351
|
+
ranges
|
|
1352
|
+
} = this.props;
|
|
1353
|
+
const useCalendarMobile =
|
|
1354
|
+
useMobileUI &&
|
|
1355
|
+
isMobile() &&
|
|
1356
|
+
['days', 'months', 'quarters'].indexOf(viewMode) > -1;
|
|
1357
|
+
|
|
1358
|
+
const {isOpened, isFocused, startDate, endDate} = this.state;
|
|
1359
|
+
|
|
1360
|
+
const __ = this.props.translate;
|
|
1361
|
+
|
|
1362
|
+
const calendarMobile = (
|
|
1363
|
+
<CalendarMobile
|
|
1364
|
+
timeFormat={timeFormat}
|
|
1365
|
+
inputFormat={inputFormat}
|
|
1366
|
+
startDate={startDate}
|
|
1367
|
+
endDate={endDate}
|
|
1368
|
+
minDate={minDate}
|
|
1369
|
+
maxDate={maxDate}
|
|
1370
|
+
minDuration={minDuration}
|
|
1371
|
+
maxDuration={maxDuration}
|
|
1372
|
+
dateFormat={dateFormat}
|
|
1373
|
+
embed={embed}
|
|
1374
|
+
viewMode={viewMode}
|
|
1375
|
+
close={this.close}
|
|
1376
|
+
confirm={this.confirm}
|
|
1377
|
+
onChange={this.handleMobileChange}
|
|
1378
|
+
footerExtra={this.renderRanges(ranges)}
|
|
1379
|
+
showViewMode={
|
|
1380
|
+
viewMode === 'quarters' || viewMode === 'months' ? 'years' : 'months'
|
|
1381
|
+
}
|
|
1382
|
+
/>
|
|
1383
|
+
);
|
|
1384
|
+
|
|
1385
|
+
if (embed) {
|
|
1386
|
+
return (
|
|
1387
|
+
<div
|
|
1388
|
+
className={cx(
|
|
1389
|
+
`${ns}DateRangeCalendar`,
|
|
1390
|
+
{
|
|
1391
|
+
'is-disabled': disabled
|
|
1392
|
+
},
|
|
1393
|
+
className
|
|
1394
|
+
)}
|
|
1395
|
+
>
|
|
1396
|
+
{useCalendarMobile ? calendarMobile : this.renderCalendar()}
|
|
1397
|
+
</div>
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
const CalendarMobileTitle = (
|
|
1402
|
+
<div className={`${ns}CalendarMobile-title`}>
|
|
1403
|
+
{__('Calendar.datepicker')}
|
|
1404
|
+
</div>
|
|
1405
|
+
);
|
|
1406
|
+
|
|
1407
|
+
return (
|
|
1408
|
+
<div
|
|
1409
|
+
tabIndex={0}
|
|
1410
|
+
onKeyPress={this.handleKeyPress}
|
|
1411
|
+
onFocus={this.handleFocus}
|
|
1412
|
+
onBlur={this.handleBlur}
|
|
1413
|
+
className={cx(
|
|
1414
|
+
`${ns}DateRangePicker`,
|
|
1415
|
+
{
|
|
1416
|
+
'is-disabled': disabled,
|
|
1417
|
+
'is-focused': isFocused,
|
|
1418
|
+
[`${ns}DateRangePicker--border${ucFirst(borderMode)}`]: borderMode,
|
|
1419
|
+
'is-mobile': useMobileUI && isMobile()
|
|
1420
|
+
},
|
|
1421
|
+
className
|
|
1422
|
+
)}
|
|
1423
|
+
ref={this.dom}
|
|
1424
|
+
>
|
|
1425
|
+
<Input
|
|
1426
|
+
className={cx('DateRangePicker-input', {
|
|
1427
|
+
isActive: this.state.editState === 'start' && isOpened
|
|
1428
|
+
})}
|
|
1429
|
+
onChange={this.startInputChange}
|
|
1430
|
+
onClick={this.openStart}
|
|
1431
|
+
ref={this.startInputRef}
|
|
1432
|
+
placeholder={__(startPlaceholder)}
|
|
1433
|
+
autoComplete="off"
|
|
1434
|
+
value={this.state.startInputValue || ''}
|
|
1435
|
+
disabled={disabled}
|
|
1436
|
+
/>
|
|
1437
|
+
<span className={cx('DateRangePicker-input-separator')}>-</span>
|
|
1438
|
+
<Input
|
|
1439
|
+
className={cx('DateRangePicker-input', {
|
|
1440
|
+
isActive: this.state.editState === 'end' && isOpened
|
|
1441
|
+
})}
|
|
1442
|
+
onChange={this.endInputChange}
|
|
1443
|
+
onClick={this.openEnd}
|
|
1444
|
+
ref={this.endInputRef}
|
|
1445
|
+
placeholder={__(endPlaceholder)}
|
|
1446
|
+
autoComplete="off"
|
|
1447
|
+
value={this.state.endInputValue || ''}
|
|
1448
|
+
disabled={disabled}
|
|
1449
|
+
/>
|
|
1450
|
+
|
|
1451
|
+
{clearable && !disabled && value ? (
|
|
1452
|
+
<a className={`${ns}DateRangePicker-clear`} onClick={this.clearValue}>
|
|
1453
|
+
<Icon icon="input-clear" className="icon" />
|
|
1454
|
+
</a>
|
|
1455
|
+
) : null}
|
|
1456
|
+
|
|
1457
|
+
<a className={`${ns}DateRangePicker-toggler`}>
|
|
1458
|
+
<Icon
|
|
1459
|
+
icon={viewMode === 'time' ? 'clock' : 'date'}
|
|
1460
|
+
className="icon"
|
|
1461
|
+
/>
|
|
1462
|
+
</a>
|
|
1463
|
+
|
|
1464
|
+
{isOpened ? (
|
|
1465
|
+
useMobileUI && isMobile() ? (
|
|
1466
|
+
<PopUp
|
|
1467
|
+
isShow={isOpened}
|
|
1468
|
+
container={popOverContainer}
|
|
1469
|
+
className={cx(`${ns}CalendarMobile-pop`)}
|
|
1470
|
+
onHide={this.close}
|
|
1471
|
+
header={CalendarMobileTitle}
|
|
1472
|
+
>
|
|
1473
|
+
{useCalendarMobile ? calendarMobile : this.renderCalendar()}
|
|
1474
|
+
</PopUp>
|
|
1475
|
+
) : (
|
|
1476
|
+
<Overlay
|
|
1477
|
+
target={() => this.dom.current}
|
|
1478
|
+
onHide={this.close}
|
|
1479
|
+
container={popOverContainer || (() => findDOMNode(this))}
|
|
1480
|
+
rootClose={false}
|
|
1481
|
+
placement={overlayPlacement}
|
|
1482
|
+
show
|
|
1483
|
+
>
|
|
1484
|
+
<PopOver
|
|
1485
|
+
classPrefix={ns}
|
|
1486
|
+
className={cx(`${ns}DateRangePicker-popover`, popoverClassName)}
|
|
1487
|
+
onHide={this.close}
|
|
1488
|
+
onClick={this.handlePopOverClick}
|
|
1489
|
+
>
|
|
1490
|
+
{this.renderCalendar()}
|
|
1491
|
+
</PopOver>
|
|
1492
|
+
</Overlay>
|
|
1493
|
+
)
|
|
1494
|
+
) : null}
|
|
1495
|
+
</div>
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
export default themeable(localeable(DateRangePicker));
|