amis 1.7.0 → 1.8.0-beta.13
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/lib/Schema.d.ts +10 -2
- package/lib/Schema.js +0 -1
- package/lib/Schema.js.map +2 -2
- package/lib/SchemaRenderer.js +19 -3
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/WithRootStore.d.ts +18 -0
- package/lib/WithStore.js +2 -1
- package/lib/WithStore.js.map +2 -2
- package/lib/actions/CmptAction.js +26 -4
- package/lib/actions/CmptAction.js.map +2 -2
- package/lib/actions/PageAction.d.ts +32 -0
- package/lib/actions/PageAction.js +72 -0
- package/lib/actions/PageAction.js.map +13 -0
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/index.js.map +2 -2
- package/lib/components/Alert2.js +4 -2
- package/lib/components/Alert2.js.map +2 -2
- package/lib/components/AssociatedSelection.js +9 -2
- package/lib/components/AssociatedSelection.js.map +2 -2
- package/lib/components/Avatar.d.ts +20 -20
- package/lib/components/BarCode.js +1 -1
- package/lib/components/BarCode.js.map +2 -2
- package/lib/components/CalendarMobile.d.ts +84 -84
- package/lib/components/Card.d.ts +20 -20
- package/lib/components/Cascader.d.ts +2 -0
- package/lib/components/Cascader.js +28 -12
- package/lib/components/Cascader.js.map +2 -2
- package/lib/components/Checkbox.d.ts +24 -23
- package/lib/components/Checkbox.js +5 -1
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/CityArea.js +3 -0
- package/lib/components/CityArea.js.map +2 -2
- package/lib/components/Collapse.d.ts +20 -20
- package/lib/components/DatePicker.d.ts +87 -84
- package/lib/components/DatePicker.js +48 -11
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +285 -171
- package/lib/components/DateRangePicker.js +471 -66
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Drawer.js +1 -1
- package/lib/components/Drawer.js.map +2 -2
- package/lib/components/ListGroup.d.ts +21 -21
- package/lib/components/Modal.js +1 -1
- package/lib/components/Modal.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/Overlay.d.ts +1 -0
- package/lib/components/Overlay.js +4 -3
- package/lib/components/Overlay.js.map +2 -2
- package/lib/components/Progress.d.ts +29 -24
- package/lib/components/Progress.js +52 -21
- package/lib/components/Progress.js.map +2 -2
- package/lib/components/PullRefresh.d.ts +86 -0
- package/lib/components/PullRefresh.js +135 -0
- package/lib/components/PullRefresh.js.map +13 -0
- package/lib/components/Radios.d.ts +22 -22
- package/lib/components/Radios.js +3 -5
- package/lib/components/Radios.js.map +2 -2
- package/lib/components/Range.d.ts +2 -2
- package/lib/components/Range.js +24 -11
- package/lib/components/Range.js.map +2 -2
- package/lib/components/Spinner.d.ts +200 -107
- package/lib/components/Spinner.js +30 -26
- package/lib/components/Spinner.js.map +2 -2
- package/lib/components/Steps.d.ts +6 -0
- package/lib/components/Steps.js +13 -9
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/Tabs.d.ts +27 -23
- package/lib/components/Tabs.js +37 -22
- package/lib/components/Tabs.js.map +2 -2
- package/lib/components/Tooltip.d.ts +4 -0
- package/lib/components/Tooltip.js +6 -4
- package/lib/components/Tooltip.js.map +2 -2
- package/lib/components/TooltipWrapper.d.ts +87 -24
- package/lib/components/TooltipWrapper.js +40 -8
- package/lib/components/TooltipWrapper.js.map +2 -2
- package/lib/components/Transfer.d.ts +84 -84
- package/lib/components/TransferDropDown.d.ts +84 -84
- package/lib/components/Tree.d.ts +87 -85
- package/lib/components/Tree.js +13 -5
- package/lib/components/Tree.js.map +2 -2
- package/lib/components/TreeSelection.d.ts +84 -84
- package/lib/components/calendar/Calendar.js +3 -12
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/calendar/TimeView.d.ts +1 -0
- package/lib/components/calendar/TimeView.js +7 -0
- package/lib/components/calendar/TimeView.js.map +2 -2
- package/lib/components/calendar/YearsView.js +3 -3
- package/lib/components/calendar/YearsView.js.map +2 -2
- package/lib/components/condition-builder/Expression.d.ts +1 -0
- package/lib/components/condition-builder/Expression.js +4 -4
- package/lib/components/condition-builder/Expression.js.map +2 -2
- package/lib/components/condition-builder/Field.d.ts +1 -0
- package/lib/components/condition-builder/Field.js +3 -2
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Group.d.ts +1 -0
- package/lib/components/condition-builder/Group.js +2 -2
- package/lib/components/condition-builder/Group.js.map +2 -2
- package/lib/components/condition-builder/GroupOrItem.d.ts +1 -0
- package/lib/components/condition-builder/GroupOrItem.js +2 -2
- package/lib/components/condition-builder/GroupOrItem.js.map +2 -2
- package/lib/components/condition-builder/InputSwitch.d.ts +2 -1
- package/lib/components/condition-builder/InputSwitch.js +2 -2
- package/lib/components/condition-builder/InputSwitch.js.map +2 -2
- package/lib/components/condition-builder/Item.d.ts +1 -0
- package/lib/components/condition-builder/Item.js +9 -8
- package/lib/components/condition-builder/Item.js.map +2 -2
- package/lib/components/condition-builder/Value.d.ts +1 -0
- package/lib/components/condition-builder/Value.js +5 -5
- package/lib/components/condition-builder/Value.js.map +2 -2
- package/lib/components/condition-builder/index.d.ts +1 -0
- package/lib/components/condition-builder/index.js +2 -2
- package/lib/components/condition-builder/index.js.map +2 -2
- package/lib/components/formula/Editor.d.ts +90 -86
- package/lib/components/formula/Editor.js +26 -4
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/Picker.d.ts +5 -0
- package/lib/components/formula/Picker.js +21 -4
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/factory.d.ts +5 -0
- package/lib/factory.js +24 -3
- package/lib/factory.js.map +2 -2
- package/lib/icons/trash.js +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +18 -1
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +18 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +18 -1
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +3 -1
- package/lib/renderers/Action.js +23 -5
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/App.d.ts +1 -0
- package/lib/renderers/App.js +3 -0
- package/lib/renderers/App.js.map +2 -2
- package/lib/renderers/ButtonGroup.d.ts +2 -2
- package/lib/renderers/ButtonGroup.js.map +1 -1
- package/lib/renderers/CRUD.d.ts +8 -0
- package/lib/renderers/CRUD.js +12 -5
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Carousel.d.ts +1 -0
- package/lib/renderers/Carousel.js +13 -1
- package/lib/renderers/Carousel.js.map +2 -2
- package/lib/renderers/Chart.d.ts +1 -0
- package/lib/renderers/Chart.js +3 -0
- package/lib/renderers/Chart.js.map +2 -2
- package/lib/renderers/Dialog.d.ts +5 -0
- package/lib/renderers/Dialog.js +7 -3
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/Drawer.d.ts +1 -0
- package/lib/renderers/Drawer.js +6 -1
- package/lib/renderers/Drawer.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +2 -0
- package/lib/renderers/DropDownButton.js +13 -4
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/Checkbox.d.ts +5 -2
- package/lib/renderers/Form/Checkbox.js +2 -2
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.d.ts +7 -2
- package/lib/renderers/Form/Checkboxes.js +101 -12
- package/lib/renderers/Form/Checkboxes.js.map +2 -2
- package/lib/renderers/Form/Combo.d.ts +6 -4
- package/lib/renderers/Form/Combo.js +132 -45
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +3 -2
- package/lib/renderers/Form/Editor.d.ts +2 -2
- package/lib/renderers/Form/InputCity.d.ts +87 -84
- package/lib/renderers/Form/InputCity.js +48 -3
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputDate.js +10 -3
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.d.ts +5 -0
- package/lib/renderers/Form/InputDateRange.js +12 -3
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/InputFile.js +19 -8
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputFormula.d.ts +4 -0
- package/lib/renderers/Form/InputFormula.js +2 -2
- package/lib/renderers/Form/InputFormula.js.map +2 -2
- package/lib/renderers/Form/InputImage.js +18 -7
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/InputMonthRange.js +5 -1
- package/lib/renderers/Form/InputMonthRange.js.map +2 -2
- package/lib/renderers/Form/InputRange.d.ts +2 -2
- package/lib/renderers/Form/InputRange.js +13 -14
- package/lib/renderers/Form/InputRange.js.map +2 -2
- package/lib/renderers/Form/InputTable.js +4 -2
- package/lib/renderers/Form/InputTable.js.map +2 -2
- package/lib/renderers/Form/InputText.d.ts +1 -1
- package/lib/renderers/Form/InputText.js +8 -10
- package/lib/renderers/Form/InputText.js.map +2 -2
- package/lib/renderers/Form/InputTree.d.ts +5 -0
- package/lib/renderers/Form/InputTree.js +51 -2
- package/lib/renderers/Form/InputTree.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +79 -76
- package/lib/renderers/Form/Item.js +3 -1
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/NestedSelect.d.ts +4 -0
- package/lib/renderers/Form/NestedSelect.js +14 -5
- package/lib/renderers/Form/NestedSelect.js.map +2 -2
- package/lib/renderers/Form/Options.js +61 -27
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Select.js +4 -2
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/Textarea.js +2 -1
- package/lib/renderers/Form/Textarea.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.d.ts +11 -2
- package/lib/renderers/Form/TreeSelect.js +56 -10
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.d.ts +3 -0
- package/lib/renderers/Form/index.js +53 -16
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.d.ts +10 -0
- package/lib/renderers/Form/wrapControl.js +41 -19
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/Nav.d.ts +82 -67
- package/lib/renderers/Nav.js +49 -13
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.d.ts +21 -0
- package/lib/renderers/Page.js +56 -17
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Progress.d.ts +4 -7
- package/lib/renderers/Progress.js +3 -3
- package/lib/renderers/Progress.js.map +2 -2
- package/lib/renderers/Service.d.ts +3 -0
- package/lib/renderers/Service.js +55 -20
- package/lib/renderers/Service.js.map +2 -2
- package/lib/renderers/Spinner.d.ts +58 -2
- package/lib/renderers/Spinner.js +8 -1
- package/lib/renderers/Spinner.js.map +2 -2
- package/lib/renderers/Steps.d.ts +8 -0
- package/lib/renderers/Steps.js +2 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/ColumnToggler.d.ts +4 -0
- package/lib/renderers/Table/ColumnToggler.js +11 -6
- package/lib/renderers/Table/ColumnToggler.js.map +2 -2
- package/lib/renderers/Table/TableCell.js +27 -1
- package/lib/renderers/Table/TableCell.js.map +2 -2
- package/lib/renderers/Table/TableRow.js +1 -1
- package/lib/renderers/Table/TableRow.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +2 -0
- package/lib/renderers/Table/index.js +23 -10
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tabs.d.ts +14 -2
- package/lib/renderers/Tabs.js +24 -8
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/TooltipWrapper.d.ts +133 -0
- package/lib/renderers/TooltipWrapper.js +70 -0
- package/lib/renderers/TooltipWrapper.js.map +13 -0
- package/lib/renderers/Wizard.d.ts +7 -3
- package/lib/renderers/Wizard.js +269 -152
- package/lib/renderers/Wizard.js.map +2 -2
- package/lib/store/combo.d.ts +2 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +55 -19
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +1 -1
- package/lib/store/form.js +5 -1
- package/lib/store/form.js.map +2 -2
- package/lib/store/formItem.js +1 -1
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/index.d.ts +5 -0
- package/lib/store/index.js +14 -0
- package/lib/store/index.js.map +2 -2
- package/lib/store/table.d.ts +2 -2
- package/lib/store/table.js +4 -4
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +965 -210
- package/lib/themes/ang.css +955 -175
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +1080 -325
- package/lib/themes/antd.css +956 -176
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1048 -293
- package/lib/themes/cxd.css +961 -180
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +965 -210
- package/lib/themes/dark.css +955 -175
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +1048 -293
- package/lib/themes/default.css +961 -180
- package/lib/themes/default.css.map +1 -1
- package/lib/types.d.ts +3 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/ColorScale.d.ts +19 -0
- package/lib/utils/ColorScale.js +104 -0
- package/lib/utils/ColorScale.js.map +13 -0
- package/lib/utils/api.js +20 -4
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/columnsSplit.d.ts +1 -0
- package/lib/utils/columnsSplit.js +40 -0
- package/lib/utils/columnsSplit.js.map +13 -0
- package/lib/utils/debug.d.ts +1 -1
- package/lib/utils/debug.js +16 -22
- package/lib/utils/debug.js.map +2 -2
- package/lib/utils/dom.d.ts +1 -1
- package/lib/utils/dom.js +7 -5
- package/lib/utils/dom.js.map +2 -2
- package/lib/utils/position.js +0 -1
- package/lib/utils/position.js.map +2 -2
- package/lib/utils/scrollPosition.d.ts +6 -0
- package/lib/utils/scrollPosition.js +31 -0
- package/lib/utils/scrollPosition.js.map +13 -0
- package/package.json +3 -2
- package/schema.json +30213 -29222
- package/scss/_properties.scss +67 -25
- package/scss/components/_alert.scss +1 -1
- package/scss/components/_barcode.scss +1 -1
- package/scss/components/_button-group.scss +15 -0
- package/scss/components/_carousel.scss +1 -0
- package/scss/components/_column-toggler.scss +21 -11
- package/scss/components/_debug.scss +3 -3
- package/scss/components/_formula.scss +19 -1
- package/scss/components/_nav.scss +51 -6
- package/scss/components/_progress.scss +7 -14
- package/scss/components/_pull-refresh.scss +25 -0
- package/scss/components/_spinner.scss +134 -56
- package/scss/components/_steps.scss +199 -8
- package/scss/components/_tabs.scss +145 -13
- package/scss/components/_tooltip.scss +76 -9
- package/scss/components/form/_checks.scss +125 -2
- package/scss/components/form/_combo.scss +13 -1
- package/scss/components/form/_date-range.scss +27 -2
- package/scss/components/form/_date.scss +25 -0
- package/scss/components/form/_editor.scss +2 -1
- package/scss/components/form/_file.scss +4 -0
- package/scss/components/form/_form.scss +31 -8
- package/scss/components/form/_number.scss +5 -2
- package/scss/components/form/_select.scss +0 -1
- package/scss/components/form/_textarea.scss +1 -23
- package/scss/components/form/_transfer.scss +3 -2
- package/scss/themes/_antd-variables.scss +1 -1
- package/scss/themes/_common.scss +1 -0
- package/scss/themes/_cxd-variables.scss +6 -5
- package/sdk/ang-ie11.css +1059 -198
- package/sdk/ang.css +1050 -164
- package/sdk/antd-ie11.css +1167 -306
- package/sdk/antd.css +1051 -165
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +1145 -284
- package/sdk/cxd.css +1056 -169
- package/sdk/dark-ie11.css +1056 -195
- package/sdk/dark.css +1050 -164
- package/sdk/exceljs.js +1 -1
- package/sdk/locale/de-DE.js +18 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +17 -17
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +1145 -284
- package/sdk/sdk.css +1056 -169
- package/sdk/sdk.js +1321 -1273
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/Schema.ts +15 -2
- package/src/SchemaRenderer.tsx +32 -14
- package/src/WithStore.tsx +3 -1
- package/src/actions/CmptAction.ts +28 -0
- package/src/actions/PageAction.ts +62 -0
- package/src/actions/index.ts +1 -0
- package/src/components/Alert2.tsx +9 -3
- package/src/components/AssociatedSelection.tsx +9 -3
- package/src/components/BarCode.tsx +2 -2
- package/src/components/Cascader.tsx +37 -11
- package/src/components/Checkbox.tsx +11 -5
- package/src/components/CityArea.tsx +3 -0
- package/src/components/DatePicker.tsx +68 -22
- package/src/components/DateRangePicker.tsx +551 -88
- package/src/components/Drawer.tsx +1 -0
- package/src/components/Modal.tsx +1 -0
- package/src/components/Overlay.tsx +6 -3
- package/src/components/Progress.tsx +64 -33
- package/src/components/PullRefresh.tsx +197 -0
- package/src/components/Radios.tsx +6 -17
- package/src/components/Range.tsx +26 -12
- package/src/components/Spinner.tsx +77 -42
- package/src/components/Steps.tsx +28 -27
- package/src/components/Tabs.tsx +51 -21
- package/src/components/Tooltip.tsx +12 -3
- package/src/components/TooltipWrapper.tsx +140 -33
- package/src/components/Tree.tsx +19 -5
- package/src/components/calendar/Calendar.tsx +4 -13
- package/src/components/calendar/TimeView.tsx +12 -0
- package/src/components/calendar/YearsView.tsx +3 -4
- package/src/components/condition-builder/Expression.tsx +6 -1
- package/src/components/condition-builder/Field.tsx +5 -1
- package/src/components/condition-builder/Group.tsx +4 -1
- package/src/components/condition-builder/GroupOrItem.tsx +4 -1
- package/src/components/condition-builder/InputSwitch.tsx +4 -1
- package/src/components/condition-builder/Item.tsx +28 -4
- package/src/components/condition-builder/Value.tsx +7 -1
- package/src/components/condition-builder/index.tsx +4 -2
- package/src/components/formula/Editor.tsx +46 -10
- package/src/components/formula/Picker.tsx +32 -1
- package/src/components/icons.tsx +2 -0
- package/src/factory.tsx +31 -3
- package/src/icons/trash.svg +8 -0
- package/src/index.tsx +1 -0
- package/src/locale/de-DE.ts +18 -1
- package/src/locale/en-US.ts +18 -1
- package/src/locale/zh-CN.ts +18 -1
- package/src/renderers/Action.tsx +24 -2
- package/src/renderers/App.tsx +4 -0
- package/src/renderers/ButtonGroup.tsx +2 -2
- package/src/renderers/CRUD.tsx +23 -5
- package/src/renderers/Carousel.tsx +8 -0
- package/src/renderers/Chart.tsx +4 -0
- package/src/renderers/Dialog.tsx +21 -3
- package/src/renderers/Drawer.tsx +14 -2
- package/src/renderers/DropDownButton.tsx +14 -3
- package/src/renderers/Form/Checkbox.tsx +11 -2
- package/src/renderers/Form/Checkboxes.tsx +106 -23
- package/src/renderers/Form/Combo.tsx +179 -66
- package/src/renderers/Form/InputCity.tsx +46 -5
- package/src/renderers/Form/InputDate.tsx +18 -4
- package/src/renderers/Form/InputDateRange.tsx +27 -3
- package/src/renderers/Form/InputFile.tsx +23 -7
- package/src/renderers/Form/InputFormula.tsx +7 -0
- package/src/renderers/Form/InputImage.tsx +22 -6
- package/src/renderers/Form/InputMonthRange.tsx +7 -1
- package/src/renderers/Form/InputRange.tsx +20 -22
- package/src/renderers/Form/InputTable.tsx +6 -2
- package/src/renderers/Form/InputText.tsx +14 -4
- package/src/renderers/Form/InputTree.tsx +40 -2
- package/src/renderers/Form/Item.tsx +7 -0
- package/src/renderers/Form/NestedSelect.tsx +23 -4
- package/src/renderers/Form/Options.tsx +26 -7
- package/src/renderers/Form/Select.tsx +5 -3
- package/src/renderers/Form/Textarea.tsx +3 -1
- package/src/renderers/Form/TreeSelect.tsx +47 -9
- package/src/renderers/Form/index.tsx +56 -25
- package/src/renderers/Form/wrapControl.tsx +23 -12
- package/src/renderers/Nav.tsx +231 -33
- package/src/renderers/Page.tsx +97 -35
- package/src/renderers/Progress.tsx +9 -11
- package/src/renderers/Service.tsx +66 -27
- package/src/renderers/Spinner.tsx +85 -3
- package/src/renderers/Steps.tsx +14 -0
- package/src/renderers/Table/ColumnToggler.tsx +36 -11
- package/src/renderers/Table/TableCell.tsx +39 -1
- package/src/renderers/Table/TableRow.tsx +1 -1
- package/src/renderers/Table/index.tsx +43 -19
- package/src/renderers/Tabs.tsx +90 -31
- package/src/renderers/TooltipWrapper.tsx +262 -0
- package/src/renderers/Wizard.tsx +169 -93
- package/src/store/crud.ts +50 -5
- package/src/store/form.ts +8 -3
- package/src/store/formItem.ts +1 -2
- package/src/store/index.ts +20 -0
- package/src/store/table.ts +4 -4
- package/src/types.ts +8 -1
- package/src/utils/ColorScale.ts +138 -0
- package/src/utils/api.ts +26 -4
- package/src/utils/columnsSplit.tsx +57 -0
- package/src/utils/debug.tsx +17 -24
- package/src/utils/dom.tsx +7 -6
- package/src/utils/position.ts +0 -1
- package/src/utils/scrollPosition.ts +29 -0
@@ -7,7 +7,6 @@
|
|
7
7
|
import React from 'react';
|
8
8
|
import moment from 'moment';
|
9
9
|
import {findDOMNode} from 'react-dom';
|
10
|
-
import cx from 'classnames';
|
11
10
|
import {Icon} from './icons';
|
12
11
|
import Overlay from './Overlay';
|
13
12
|
import {ShortCuts, ShortCutDateRange} from './DatePicker';
|
@@ -19,11 +18,13 @@ import {PlainObject} from '../types';
|
|
19
18
|
import {isMobile, noop, ucFirst} from '../utils/helper';
|
20
19
|
import {LocaleProps, localeable} from '../locale';
|
21
20
|
import CalendarMobile from './CalendarMobile';
|
21
|
+
import Input from './Input';
|
22
22
|
|
23
23
|
export interface DateRangePickerProps extends ThemeProps, LocaleProps {
|
24
24
|
className?: string;
|
25
25
|
popoverClassName?: string;
|
26
|
-
|
26
|
+
startPlaceholder?: string;
|
27
|
+
endPlaceholder?: string;
|
27
28
|
theme?: any;
|
28
29
|
format: string;
|
29
30
|
utc?: boolean;
|
@@ -52,6 +53,7 @@ export interface DateRangePickerProps extends ThemeProps, LocaleProps {
|
|
52
53
|
useMobileUI?: boolean;
|
53
54
|
onFocus?: Function;
|
54
55
|
onBlur?: Function;
|
56
|
+
type?: string;
|
55
57
|
}
|
56
58
|
|
57
59
|
export interface DateRangePickerState {
|
@@ -59,6 +61,9 @@ export interface DateRangePickerState {
|
|
59
61
|
isFocused: boolean;
|
60
62
|
startDate?: moment.Moment;
|
61
63
|
endDate?: moment.Moment;
|
64
|
+
editState?: 'start' | 'end'; // 编辑开始时间还是结束时间
|
65
|
+
startInputValue?: string;
|
66
|
+
endInputValue?: string;
|
62
67
|
}
|
63
68
|
|
64
69
|
export const availableRanges: {[propName: string]: any} = {
|
@@ -82,8 +87,19 @@ export const availableRanges: {[propName: string]: any} = {
|
|
82
87
|
}
|
83
88
|
},
|
84
89
|
|
85
|
-
'
|
86
|
-
label: '
|
90
|
+
'tomorrow': {
|
91
|
+
label: 'Date.tomorrow',
|
92
|
+
startDate: (now: moment.Moment) => {
|
93
|
+
return now.add(1, 'days').startOf('day');
|
94
|
+
},
|
95
|
+
endDate: (now: moment.Moment) => {
|
96
|
+
return now.add(1, 'days').endOf('day');
|
97
|
+
}
|
98
|
+
},
|
99
|
+
|
100
|
+
// 兼容一下错误的用法
|
101
|
+
'1daysago': {
|
102
|
+
label: 'DateRange.1daysago',
|
87
103
|
startDate: (now: moment.Moment) => {
|
88
104
|
return now.add(-1, 'days');
|
89
105
|
},
|
@@ -203,12 +219,184 @@ export const availableRanges: {[propName: string]: any} = {
|
|
203
219
|
}
|
204
220
|
};
|
205
221
|
|
222
|
+
export const advancedRanges = [
|
223
|
+
{
|
224
|
+
regexp: /^(\d+)hoursago$/,
|
225
|
+
resolve: (__: any, _: string, hours: string) => {
|
226
|
+
return {
|
227
|
+
label: __('DateRange.hoursago', {hours}),
|
228
|
+
startDate: (now: moment.Moment) => {
|
229
|
+
return now.add(-hours, 'hours').startOf('hour');
|
230
|
+
},
|
231
|
+
endDate: (now: moment.Moment) => {
|
232
|
+
return now.add(-1, 'hours').endOf('hours');
|
233
|
+
}
|
234
|
+
};
|
235
|
+
}
|
236
|
+
},
|
237
|
+
{
|
238
|
+
regexp: /^(\d+)hourslater$/,
|
239
|
+
resolve: (__: any, _: string, hours: string) => {
|
240
|
+
return {
|
241
|
+
label: __('DateRange.hourslater', {hours}),
|
242
|
+
startDate: (now: moment.Moment) => {
|
243
|
+
return now.startOf('hour');
|
244
|
+
},
|
245
|
+
endDate: (now: moment.Moment) => {
|
246
|
+
return now.add(hours, 'hours').endOf('hour');
|
247
|
+
}
|
248
|
+
};
|
249
|
+
}
|
250
|
+
},
|
251
|
+
{
|
252
|
+
regexp: /^(\d+)daysago$/,
|
253
|
+
resolve: (__: any, _: string, days: string) => {
|
254
|
+
return {
|
255
|
+
label: __('DateRange.daysago', {days}),
|
256
|
+
startDate: (now: moment.Moment) => {
|
257
|
+
return now.add(-days, 'days').startOf('day');
|
258
|
+
},
|
259
|
+
endDate: (now: moment.Moment) => {
|
260
|
+
return now.add(-1, 'days').endOf('day');
|
261
|
+
}
|
262
|
+
};
|
263
|
+
}
|
264
|
+
},
|
265
|
+
{
|
266
|
+
regexp: /^(\d+)dayslater$/,
|
267
|
+
resolve: (__: any, _: string, days: string) => {
|
268
|
+
return {
|
269
|
+
label: __('DateRange.dayslater', {days}),
|
270
|
+
startDate: (now: moment.Moment) => {
|
271
|
+
return now.startOf('day');
|
272
|
+
},
|
273
|
+
endDate: (now: moment.Moment) => {
|
274
|
+
return now.add(days, 'days').endOf('day');
|
275
|
+
}
|
276
|
+
};
|
277
|
+
}
|
278
|
+
},
|
279
|
+
{
|
280
|
+
regexp: /^(\d+)weeksago$/,
|
281
|
+
resolve: (__: any, _: string, weeks: string) => {
|
282
|
+
return {
|
283
|
+
label: __('DateRange.weeksago', {weeks}),
|
284
|
+
startDate: (now: moment.Moment) => {
|
285
|
+
return now.startOf('week').add(-weeks, 'weeks');
|
286
|
+
},
|
287
|
+
endDate: (now: moment.Moment) => {
|
288
|
+
return now.startOf('week').add(-1, 'days').endOf('day');
|
289
|
+
}
|
290
|
+
};
|
291
|
+
}
|
292
|
+
},
|
293
|
+
{
|
294
|
+
regexp: /^(\d+)weekslater$/,
|
295
|
+
resolve: (__: any, _: string, weeks: string) => {
|
296
|
+
return {
|
297
|
+
label: __('DateRange.weekslater', {weeks}),
|
298
|
+
startDate: (now: moment.Moment) => {
|
299
|
+
return now.startOf('week');
|
300
|
+
},
|
301
|
+
endDate: (now: moment.Moment) => {
|
302
|
+
return now.startOf('week').add(weeks, 'weeks').endOf('day');
|
303
|
+
}
|
304
|
+
};
|
305
|
+
}
|
306
|
+
},
|
307
|
+
{
|
308
|
+
regexp: /^(\d+)monthsago$/,
|
309
|
+
resolve: (__: any, _: string, months: string) => {
|
310
|
+
return {
|
311
|
+
label: __('DateRange.monthsago', {months}),
|
312
|
+
startDate: (now: moment.Moment) => {
|
313
|
+
return now.startOf('months').add(-months, 'months');
|
314
|
+
},
|
315
|
+
endDate: (now: moment.Moment) => {
|
316
|
+
return now.startOf('month').add(-1, 'days').endOf('day');
|
317
|
+
}
|
318
|
+
};
|
319
|
+
}
|
320
|
+
},
|
321
|
+
{
|
322
|
+
regexp: /^(\d+)monthslater$/,
|
323
|
+
resolve: (__: any, _: string, months: string) => {
|
324
|
+
return {
|
325
|
+
label: __('DateRange.monthslater', {months}),
|
326
|
+
startDate: (now: moment.Moment) => {
|
327
|
+
return now.startOf('month');
|
328
|
+
},
|
329
|
+
endDate: (now: moment.Moment) => {
|
330
|
+
return now.startOf('month').add(months, 'months').endOf('day');
|
331
|
+
}
|
332
|
+
};
|
333
|
+
}
|
334
|
+
},
|
335
|
+
{
|
336
|
+
regexp: /^(\d+)quartersago$/,
|
337
|
+
resolve: (__: any, _: string, quarters: string) => {
|
338
|
+
return {
|
339
|
+
label: __('DateRange.quartersago', {quarters}),
|
340
|
+
startDate: (now: moment.Moment) => {
|
341
|
+
return now.startOf('quarters').add(-quarters, 'quarters');
|
342
|
+
},
|
343
|
+
endDate: (now: moment.Moment) => {
|
344
|
+
return now.startOf('quarter').add(-1, 'days').endOf('day');
|
345
|
+
}
|
346
|
+
};
|
347
|
+
}
|
348
|
+
},
|
349
|
+
{
|
350
|
+
regexp: /^(\d+)quarterslater$/,
|
351
|
+
resolve: (__: any, _: string, quarters: string) => {
|
352
|
+
return {
|
353
|
+
label: __('DateRange.quarterslater', {quarters}),
|
354
|
+
startDate: (now: moment.Moment) => {
|
355
|
+
return now.startOf('quarter');
|
356
|
+
},
|
357
|
+
endDate: (now: moment.Moment) => {
|
358
|
+
return now.startOf('quarter').add(quarters, 'quarters').endOf('day');
|
359
|
+
}
|
360
|
+
};
|
361
|
+
}
|
362
|
+
},
|
363
|
+
{
|
364
|
+
regexp: /^(\d+)yearsago$/,
|
365
|
+
resolve: (__: any, _: string, years: string) => {
|
366
|
+
return {
|
367
|
+
label: __('DateRange.yearsago', {years}),
|
368
|
+
startDate: (now: moment.Moment) => {
|
369
|
+
return now.startOf('years').add(-years, 'years');
|
370
|
+
},
|
371
|
+
endDate: (now: moment.Moment) => {
|
372
|
+
return now.startOf('year').add(-1, 'days').endOf('day');
|
373
|
+
}
|
374
|
+
};
|
375
|
+
}
|
376
|
+
},
|
377
|
+
{
|
378
|
+
regexp: /^(\d+)yearslater$/,
|
379
|
+
resolve: (__: any, _: string, years: string) => {
|
380
|
+
return {
|
381
|
+
label: __('DateRange.yearslater', {years}),
|
382
|
+
startDate: (now: moment.Moment) => {
|
383
|
+
return now.startOf('year');
|
384
|
+
},
|
385
|
+
endDate: (now: moment.Moment) => {
|
386
|
+
return now.startOf('year').add(years, 'years').endOf('day');
|
387
|
+
}
|
388
|
+
};
|
389
|
+
}
|
390
|
+
}
|
391
|
+
];
|
392
|
+
|
206
393
|
export class DateRangePicker extends React.Component<
|
207
394
|
DateRangePickerProps,
|
208
395
|
DateRangePickerState
|
209
396
|
> {
|
210
397
|
static defaultProps = {
|
211
|
-
|
398
|
+
startPlaceholder: 'Calendar.startPick',
|
399
|
+
endPlaceholder: 'Calendar.endPick',
|
212
400
|
format: 'X',
|
213
401
|
inputFormat: 'YYYY-MM-DD',
|
214
402
|
joinValues: true,
|
@@ -272,14 +460,29 @@ export class DateRangePicker extends React.Component<
|
|
272
460
|
}
|
273
461
|
|
274
462
|
dom: React.RefObject<HTMLDivElement>;
|
463
|
+
calendarRef: React.RefObject<HTMLDivElement>;
|
275
464
|
nextMonth = moment().add(1, 'months');
|
276
465
|
|
466
|
+
startInputRef: React.RefObject<HTMLInputElement>;
|
467
|
+
endInputRef: React.RefObject<HTMLInputElement>;
|
468
|
+
|
277
469
|
constructor(props: DateRangePickerProps) {
|
278
470
|
super(props);
|
279
471
|
|
472
|
+
this.startInputRef = React.createRef();
|
473
|
+
this.endInputRef = React.createRef();
|
474
|
+
this.calendarRef = React.createRef();
|
280
475
|
this.open = this.open.bind(this);
|
476
|
+
this.openStart = this.openStart.bind(this);
|
477
|
+
this.openEnd = this.openEnd.bind(this);
|
281
478
|
this.close = this.close.bind(this);
|
282
|
-
this.
|
479
|
+
this.startInputChange = this.startInputChange.bind(this);
|
480
|
+
this.endInputChange = this.endInputChange.bind(this);
|
481
|
+
this.handleDateChange = this.handleDateChange.bind(this);
|
482
|
+
this.handleStartDateChange = this.handleStartDateChange.bind(this);
|
483
|
+
this.handeleEndDateChange = this.handeleEndDateChange.bind(this);
|
484
|
+
this.handleTimeStartChange = this.handleTimeStartChange.bind(this);
|
485
|
+
this.handleTimeEndChange = this.handleTimeEndChange.bind(this);
|
283
486
|
this.handleFocus = this.handleFocus.bind(this);
|
284
487
|
this.handleBlur = this.handleBlur.bind(this);
|
285
488
|
this.checkStartIsValidDate = this.checkStartIsValidDate.bind(this);
|
@@ -293,22 +496,63 @@ export class DateRangePicker extends React.Component<
|
|
293
496
|
this.renderDay = this.renderDay.bind(this);
|
294
497
|
this.renderQuarter = this.renderQuarter.bind(this);
|
295
498
|
this.handleMobileChange = this.handleMobileChange.bind(this);
|
296
|
-
|
297
|
-
|
499
|
+
this.handleOutClick = this.handleOutClick.bind(this);
|
500
|
+
const {format, joinValues, delimiter, value, inputFormat} = this.props;
|
501
|
+
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
502
|
+
value,
|
503
|
+
format,
|
504
|
+
joinValues,
|
505
|
+
delimiter
|
506
|
+
);
|
298
507
|
this.state = {
|
299
508
|
isOpened: false,
|
300
509
|
isFocused: false,
|
301
|
-
|
510
|
+
startDate,
|
511
|
+
endDate,
|
512
|
+
startInputValue: startDate?.format(inputFormat),
|
513
|
+
endInputValue: endDate?.format(inputFormat)
|
302
514
|
};
|
303
515
|
}
|
516
|
+
componentDidMount() {
|
517
|
+
document.body.addEventListener('click', this.handleOutClick, true);
|
518
|
+
}
|
519
|
+
|
520
|
+
componentWillUnmount() {
|
521
|
+
document.body.removeEventListener('click', this.handleOutClick, true);
|
522
|
+
}
|
523
|
+
|
524
|
+
handleOutClick(e: Event) {
|
525
|
+
if (
|
526
|
+
!e.target ||
|
527
|
+
!this.dom.current ||
|
528
|
+
this.dom.current.contains(e.target as HTMLElement) ||
|
529
|
+
!this.calendarRef.current ||
|
530
|
+
this.calendarRef.current.contains(e.target as HTMLElement)
|
531
|
+
) {
|
532
|
+
return;
|
533
|
+
}
|
534
|
+
if (this.state.isOpened) {
|
535
|
+
e.preventDefault();
|
536
|
+
this.close();
|
537
|
+
}
|
538
|
+
}
|
304
539
|
|
305
540
|
componentDidUpdate(prevProps: DateRangePickerProps) {
|
306
541
|
const props = this.props;
|
307
|
-
const {value, format, joinValues, delimiter} = props;
|
542
|
+
const {value, format, joinValues, inputFormat, delimiter} = props;
|
308
543
|
|
309
544
|
if (prevProps.value !== value) {
|
545
|
+
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
546
|
+
value,
|
547
|
+
format,
|
548
|
+
joinValues,
|
549
|
+
delimiter
|
550
|
+
);
|
310
551
|
this.setState({
|
311
|
-
|
552
|
+
startDate,
|
553
|
+
endDate,
|
554
|
+
startInputValue: startDate?.format(inputFormat),
|
555
|
+
endInputValue: endDate?.format(inputFormat)
|
312
556
|
});
|
313
557
|
}
|
314
558
|
}
|
@@ -355,10 +599,31 @@ export class DateRangePicker extends React.Component<
|
|
355
599
|
});
|
356
600
|
}
|
357
601
|
|
602
|
+
openStart() {
|
603
|
+
if (this.props.disabled) {
|
604
|
+
return;
|
605
|
+
}
|
606
|
+
this.setState({
|
607
|
+
isOpened: true,
|
608
|
+
editState: 'start'
|
609
|
+
});
|
610
|
+
}
|
611
|
+
|
612
|
+
openEnd() {
|
613
|
+
if (this.props.disabled) {
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
this.setState({
|
617
|
+
isOpened: true,
|
618
|
+
editState: 'end'
|
619
|
+
});
|
620
|
+
}
|
621
|
+
|
358
622
|
close() {
|
359
623
|
this.setState(
|
360
624
|
{
|
361
|
-
isOpened: false
|
625
|
+
isOpened: false,
|
626
|
+
editState: undefined
|
362
627
|
},
|
363
628
|
this.blur
|
364
629
|
);
|
@@ -428,55 +693,223 @@ export class DateRangePicker extends React.Component<
|
|
428
693
|
return value;
|
429
694
|
}
|
430
695
|
|
431
|
-
|
432
|
-
|
696
|
+
handleDateChange(newValue: moment.Moment) {
|
697
|
+
let {editState} = this.state;
|
698
|
+
if (editState === 'start') {
|
699
|
+
this.handleStartDateChange(newValue);
|
700
|
+
} else if (editState === 'end') {
|
701
|
+
this.handeleEndDateChange(newValue);
|
702
|
+
}
|
703
|
+
}
|
704
|
+
|
705
|
+
handleStartDateChange(newValue: moment.Moment) {
|
706
|
+
const {timeFormat, minDate, inputFormat, type} = this.props;
|
707
|
+
let {startDate} = this.state;
|
708
|
+
if (minDate && newValue.isBefore(minDate)) {
|
709
|
+
newValue = minDate;
|
710
|
+
}
|
711
|
+
const date = this.filterDate(
|
712
|
+
newValue,
|
713
|
+
startDate || minDate,
|
714
|
+
timeFormat,
|
715
|
+
'start'
|
716
|
+
);
|
717
|
+
const newState = {
|
718
|
+
startDate: date,
|
719
|
+
startInputValue: date.format(inputFormat)
|
720
|
+
} as any;
|
721
|
+
// 这些没有时间的选择点第一次后第二次就是选结束时间
|
722
|
+
if (
|
723
|
+
type === 'input-date-range' ||
|
724
|
+
type === 'input-year-range' ||
|
725
|
+
type === 'input-quarter-range'
|
726
|
+
) {
|
727
|
+
newState.editState = 'end';
|
728
|
+
}
|
729
|
+
this.setState(newState);
|
730
|
+
}
|
731
|
+
|
732
|
+
handeleEndDateChange(newValue: moment.Moment) {
|
733
|
+
const {embed, timeFormat, inputFormat} = this.props;
|
433
734
|
let {startDate, endDate} = this.state;
|
735
|
+
newValue = this.getEndDateByDuration(newValue);
|
434
736
|
|
435
|
-
//
|
436
|
-
if (
|
437
|
-
// 这种情况说明第二次点击点击了前面的时间,这时要标记为第二次点击
|
438
|
-
if (newValue.isBefore(startDate)) {
|
439
|
-
this.isFirstClick = true;
|
440
|
-
}
|
441
|
-
if (minDate && newValue.isBefore(minDate)) {
|
442
|
-
newValue = minDate;
|
443
|
-
}
|
737
|
+
// 如果结束时间在前面,需要清空开始时间
|
738
|
+
if (newValue.isBefore(startDate)) {
|
444
739
|
this.setState({
|
445
|
-
startDate:
|
446
|
-
|
447
|
-
startDate || minDate,
|
448
|
-
timeFormat,
|
449
|
-
'start'
|
450
|
-
),
|
451
|
-
endDate: undefined
|
740
|
+
startDate: undefined,
|
741
|
+
startInputValue: ''
|
452
742
|
});
|
453
|
-
}
|
454
|
-
// 第二次点击作为结束时间
|
455
|
-
if (!startDate) {
|
456
|
-
// 不大可能,但只能作为开始时间了
|
457
|
-
startDate = newValue;
|
458
|
-
}
|
743
|
+
}
|
459
744
|
|
460
|
-
|
461
|
-
|
745
|
+
const date = this.filterDate(newValue, endDate, timeFormat, 'end');
|
746
|
+
this.setState(
|
747
|
+
{
|
748
|
+
endDate: date,
|
749
|
+
endInputValue: date.format(inputFormat)
|
750
|
+
},
|
751
|
+
() => {
|
752
|
+
embed && this.confirm();
|
462
753
|
}
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
754
|
+
);
|
755
|
+
}
|
756
|
+
|
757
|
+
// 手动控制输入时间
|
758
|
+
startInputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
759
|
+
const {onChange, inputFormat, format, utc} = this.props;
|
760
|
+
const value = e.currentTarget.value;
|
761
|
+
this.setState({startInputValue: value});
|
762
|
+
if (value === '') {
|
763
|
+
onChange('');
|
764
|
+
} else {
|
765
|
+
let newDate = this.getStartDateByDuration(moment(value, inputFormat));
|
766
|
+
this.setState({startDate: newDate});
|
767
|
+
}
|
768
|
+
}
|
769
|
+
|
770
|
+
endInputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
771
|
+
const {onChange, inputFormat, format, utc} = this.props;
|
772
|
+
const value = e.currentTarget.value;
|
773
|
+
this.setState({endInputValue: value});
|
774
|
+
if (value === '') {
|
775
|
+
onChange('');
|
776
|
+
} else {
|
777
|
+
let newDate = this.getEndDateByDuration(moment(value, inputFormat));
|
778
|
+
this.setState({endDate: newDate});
|
779
|
+
}
|
780
|
+
}
|
781
|
+
|
782
|
+
// 根据 duration 修复结束时间
|
783
|
+
getEndDateByDuration(newValue: moment.Moment) {
|
784
|
+
const {minDuration, maxDuration, type} = this.props;
|
785
|
+
let {startDate, endDate, editState} = this.state;
|
786
|
+
if (!startDate) {
|
787
|
+
return newValue;
|
788
|
+
}
|
789
|
+
|
790
|
+
// 时间范围必须统一成同一天,不然会不一致
|
791
|
+
if (type === 'input-time-range' && startDate) {
|
792
|
+
newValue.set({
|
793
|
+
year: startDate.year(),
|
794
|
+
month: startDate.month(),
|
795
|
+
date: startDate.date()
|
796
|
+
});
|
797
|
+
}
|
798
|
+
|
799
|
+
if (minDuration && newValue.isBefore(startDate.clone().add(minDuration))) {
|
800
|
+
newValue = startDate.clone().add(minDuration);
|
801
|
+
}
|
802
|
+
|
803
|
+
if (maxDuration && newValue.isAfter(startDate.clone().add(maxDuration))) {
|
804
|
+
newValue = startDate.clone().add(maxDuration);
|
805
|
+
}
|
806
|
+
|
807
|
+
return newValue;
|
808
|
+
}
|
809
|
+
|
810
|
+
// 根据 duration 修复起始时间
|
811
|
+
getStartDateByDuration(newValue: moment.Moment) {
|
812
|
+
const {minDuration, maxDuration, type} = this.props;
|
813
|
+
let {endDate, editState} = this.state;
|
814
|
+
if (!endDate) {
|
815
|
+
return newValue;
|
816
|
+
}
|
817
|
+
// 时间范围必须统一成同一天,不然会不一致
|
818
|
+
if (type === 'input-time-range' && endDate) {
|
819
|
+
newValue.set({
|
820
|
+
year: endDate.year(),
|
821
|
+
month: endDate.month(),
|
822
|
+
date: endDate.date()
|
823
|
+
});
|
824
|
+
}
|
825
|
+
|
826
|
+
if (
|
827
|
+
minDuration &&
|
828
|
+
newValue.isBefore(endDate.clone().subtract(minDuration))
|
829
|
+
) {
|
830
|
+
newValue = endDate.clone().subtract(minDuration);
|
831
|
+
}
|
832
|
+
|
833
|
+
if (
|
834
|
+
maxDuration &&
|
835
|
+
newValue.isAfter(endDate.clone().subtract(maxDuration))
|
836
|
+
) {
|
837
|
+
newValue = endDate.clone().subtract(maxDuration);
|
838
|
+
}
|
839
|
+
|
840
|
+
return newValue;
|
841
|
+
}
|
842
|
+
|
843
|
+
// 主要用于处理时间的情况
|
844
|
+
handleTimeStartChange(newValue: moment.Moment) {
|
845
|
+
const {embed, timeFormat, inputFormat, minDuration, maxDuration, minDate} =
|
846
|
+
this.props;
|
847
|
+
const {startDate, endDate} = this.state;
|
848
|
+
|
849
|
+
// 时间范围必须统一成同一天,不然会不一致
|
850
|
+
if (endDate) {
|
851
|
+
newValue.set({
|
852
|
+
year: endDate.year(),
|
853
|
+
month: endDate.month(),
|
854
|
+
date: endDate.date()
|
855
|
+
});
|
856
|
+
}
|
857
|
+
|
858
|
+
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
859
|
+
newValue = minDate;
|
860
|
+
}
|
861
|
+
|
862
|
+
this.setState(
|
863
|
+
{
|
864
|
+
startDate: newValue,
|
865
|
+
startInputValue: newValue.format(inputFormat)
|
866
|
+
},
|
867
|
+
() => {
|
868
|
+
embed && this.confirm();
|
468
869
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
870
|
+
);
|
871
|
+
}
|
872
|
+
|
873
|
+
handleTimeEndChange(newValue: moment.Moment) {
|
874
|
+
const {embed, timeFormat, inputFormat, minDuration, maxDuration, maxDate} =
|
875
|
+
this.props;
|
876
|
+
const {startDate, endDate} = this.state;
|
877
|
+
if (startDate) {
|
878
|
+
newValue.set({
|
879
|
+
year: startDate.year(),
|
880
|
+
month: startDate.month(),
|
881
|
+
date: startDate.date()
|
882
|
+
});
|
883
|
+
}
|
884
|
+
|
885
|
+
if (maxDate && newValue && newValue.isAfter(maxDate, 'second')) {
|
886
|
+
newValue = maxDate;
|
887
|
+
}
|
888
|
+
|
889
|
+
if (
|
890
|
+
startDate &&
|
891
|
+
minDuration &&
|
892
|
+
newValue.isAfter(startDate.clone().add(minDuration))
|
893
|
+
) {
|
894
|
+
newValue = startDate.clone().add(minDuration);
|
895
|
+
}
|
896
|
+
if (
|
897
|
+
startDate &&
|
898
|
+
maxDuration &&
|
899
|
+
newValue.isBefore(startDate.clone().add(maxDuration))
|
900
|
+
) {
|
901
|
+
newValue = startDate.clone().add(maxDuration);
|
477
902
|
}
|
478
903
|
|
479
|
-
this.
|
904
|
+
this.setState(
|
905
|
+
{
|
906
|
+
endDate: newValue,
|
907
|
+
endInputValue: newValue.format(inputFormat)
|
908
|
+
},
|
909
|
+
() => {
|
910
|
+
embed && this.confirm();
|
911
|
+
}
|
912
|
+
);
|
480
913
|
}
|
481
914
|
|
482
915
|
handleMobileChange(data: any, callback?: () => void) {
|
@@ -528,8 +961,20 @@ export class DateRangePicker extends React.Component<
|
|
528
961
|
}
|
529
962
|
let range: PlainObject = {};
|
530
963
|
if (typeof item === 'string') {
|
531
|
-
|
532
|
-
|
964
|
+
if (availableRanges[item]) {
|
965
|
+
range = availableRanges[item];
|
966
|
+
range.key = item;
|
967
|
+
} else {
|
968
|
+
// 通过正则尝试匹配
|
969
|
+
for (let i = 0, len = advancedRanges.length; i < len; i++) {
|
970
|
+
let value = advancedRanges[i];
|
971
|
+
const m = value.regexp.exec(item);
|
972
|
+
if (m) {
|
973
|
+
range = value.resolve.apply(item, [__, ...m]);
|
974
|
+
range.key = item;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
}
|
533
978
|
} else if (
|
534
979
|
(item as ShortCutDateRange).startDate &&
|
535
980
|
(item as ShortCutDateRange).endDate
|
@@ -558,7 +1003,7 @@ export class DateRangePicker extends React.Component<
|
|
558
1003
|
e.preventDefault();
|
559
1004
|
e.stopPropagation();
|
560
1005
|
const {resetValue, onChange} = this.props;
|
561
|
-
|
1006
|
+
this.setState({startInputValue: '', endInputValue: ''});
|
562
1007
|
onChange(resetValue);
|
563
1008
|
}
|
564
1009
|
|
@@ -672,19 +1117,28 @@ export class DateRangePicker extends React.Component<
|
|
672
1117
|
ranges,
|
673
1118
|
locale,
|
674
1119
|
embed,
|
1120
|
+
type,
|
675
1121
|
viewMode = 'days'
|
676
1122
|
} = this.props;
|
677
1123
|
const __ = this.props.translate;
|
678
1124
|
|
679
1125
|
const {startDate, endDate} = this.state;
|
1126
|
+
|
680
1127
|
return (
|
681
|
-
<div className={`${ns}DateRangePicker-wrap`}>
|
1128
|
+
<div className={`${ns}DateRangePicker-wrap`} ref={this.calendarRef}>
|
682
1129
|
{this.renderRanges(ranges)}
|
683
|
-
|
684
1130
|
<Calendar
|
685
1131
|
className={`${ns}DateRangePicker-start`}
|
686
1132
|
value={startDate}
|
687
|
-
|
1133
|
+
// 区分的原因是 time-range 左侧就只能选起始时间,而其它都能在左侧同时同时选择起始和结束
|
1134
|
+
// TODO: 后续得把 time-range 代码拆分出来
|
1135
|
+
onChange={
|
1136
|
+
type === 'input-datetime-range'
|
1137
|
+
? this.handleStartDateChange
|
1138
|
+
: viewMode === 'time'
|
1139
|
+
? this.handleTimeStartChange
|
1140
|
+
: this.handleDateChange
|
1141
|
+
}
|
688
1142
|
requiredConfirm={false}
|
689
1143
|
dateFormat={dateFormat}
|
690
1144
|
inputFormat={inputFormat}
|
@@ -697,11 +1151,16 @@ export class DateRangePicker extends React.Component<
|
|
697
1151
|
renderQuarter={this.renderQuarter}
|
698
1152
|
locale={locale}
|
699
1153
|
/>
|
700
|
-
|
701
1154
|
<Calendar
|
702
1155
|
className={`${ns}DateRangePicker-end`}
|
703
1156
|
value={endDate}
|
704
|
-
onChange={
|
1157
|
+
onChange={
|
1158
|
+
type === 'input-datetime-range'
|
1159
|
+
? this.handeleEndDateChange
|
1160
|
+
: viewMode === 'time'
|
1161
|
+
? this.handleTimeEndChange
|
1162
|
+
: this.handleDateChange
|
1163
|
+
}
|
705
1164
|
requiredConfirm={false}
|
706
1165
|
dateFormat={dateFormat}
|
707
1166
|
inputFormat={inputFormat}
|
@@ -724,7 +1183,10 @@ export class DateRangePicker extends React.Component<
|
|
724
1183
|
</a>
|
725
1184
|
<a
|
726
1185
|
className={cx('Button', 'Button--primary', 'm-l-sm', {
|
727
|
-
'is-disabled':
|
1186
|
+
'is-disabled':
|
1187
|
+
!this.state.startDate ||
|
1188
|
+
!this.state.endDate ||
|
1189
|
+
this.state.endDate?.isBefore(this.state.startDate)
|
728
1190
|
})}
|
729
1191
|
onClick={this.confirm}
|
730
1192
|
>
|
@@ -741,8 +1203,10 @@ export class DateRangePicker extends React.Component<
|
|
741
1203
|
className,
|
742
1204
|
popoverClassName,
|
743
1205
|
classPrefix: ns,
|
1206
|
+
classnames: cx,
|
744
1207
|
value,
|
745
|
-
|
1208
|
+
startPlaceholder,
|
1209
|
+
endPlaceholder,
|
746
1210
|
popOverContainer,
|
747
1211
|
inputFormat,
|
748
1212
|
format,
|
@@ -770,21 +1234,6 @@ export class DateRangePicker extends React.Component<
|
|
770
1234
|
|
771
1235
|
const {isOpened, isFocused, startDate, endDate} = this.state;
|
772
1236
|
|
773
|
-
const selectedDate = DateRangePicker.unFormatValue(
|
774
|
-
value,
|
775
|
-
format,
|
776
|
-
joinValues,
|
777
|
-
delimiter
|
778
|
-
);
|
779
|
-
const startViewValue = selectedDate.startDate
|
780
|
-
? selectedDate.startDate.format(inputFormat)
|
781
|
-
: '';
|
782
|
-
const endViewValue = selectedDate.endDate
|
783
|
-
? selectedDate.endDate.format(inputFormat)
|
784
|
-
: '';
|
785
|
-
const arr = [];
|
786
|
-
startViewValue && arr.push(startViewValue);
|
787
|
-
endViewValue && arr.push(endViewValue);
|
788
1237
|
const __ = this.props.translate;
|
789
1238
|
|
790
1239
|
const calendarMobile = (
|
@@ -849,17 +1298,32 @@ export class DateRangePicker extends React.Component<
|
|
849
1298
|
className
|
850
1299
|
)}
|
851
1300
|
ref={this.dom}
|
852
|
-
onClick={this.handleClick}
|
853
1301
|
>
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
1302
|
+
<Input
|
1303
|
+
className={cx('DateRangePicker-input', {
|
1304
|
+
isActive: this.state.editState === 'start'
|
1305
|
+
})}
|
1306
|
+
onChange={this.startInputChange}
|
1307
|
+
onClick={this.openStart}
|
1308
|
+
ref={this.startInputRef}
|
1309
|
+
placeholder={__(startPlaceholder)}
|
1310
|
+
autoComplete="off"
|
1311
|
+
value={this.state.startInputValue || ''}
|
1312
|
+
disabled={disabled}
|
1313
|
+
/>
|
1314
|
+
<span className={cx('DateRangePicker-input-separator')}>~</span>
|
1315
|
+
<Input
|
1316
|
+
className={cx('DateRangePicker-input', {
|
1317
|
+
isActive: this.state.editState === 'end'
|
1318
|
+
})}
|
1319
|
+
onChange={this.endInputChange}
|
1320
|
+
onClick={this.openEnd}
|
1321
|
+
ref={this.endInputRef}
|
1322
|
+
placeholder={__(endPlaceholder)}
|
1323
|
+
autoComplete="off"
|
1324
|
+
value={this.state.endInputValue || ''}
|
1325
|
+
disabled={disabled}
|
1326
|
+
/>
|
863
1327
|
|
864
1328
|
{clearable && !disabled && value ? (
|
865
1329
|
<a className={`${ns}DateRangePicker-clear`} onClick={this.clearValue}>
|
@@ -896,7 +1360,6 @@ export class DateRangePicker extends React.Component<
|
|
896
1360
|
className={cx(`${ns}DateRangePicker-popover`, popoverClassName)}
|
897
1361
|
onHide={this.close}
|
898
1362
|
onClick={this.handlePopOverClick}
|
899
|
-
overlay
|
900
1363
|
>
|
901
1364
|
{this.renderCalendar()}
|
902
1365
|
</PopOver>
|