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
package/src/Schema.ts
CHANGED
@@ -52,11 +52,13 @@ import {DialogSchema, DialogSchemaBase} from './renderers/Dialog';
|
|
52
52
|
import {DrawerSchema} from './renderers/Drawer';
|
53
53
|
import {SearchBoxSchema} from './renderers/SearchBox';
|
54
54
|
import {SparkLineSchema} from './renderers/SparkLine';
|
55
|
+
import {TooltipWrapperSchema} from './renderers/TooltipWrapper';
|
55
56
|
import {PaginationWrapperSchema} from './renderers/PaginationWrapper';
|
56
57
|
import {PaginationSchema} from './renderers/Pagination';
|
57
58
|
import {AnchorNavSchema} from './renderers/AnchorNav';
|
58
59
|
import {AvatarSchema} from './renderers/Avatar';
|
59
60
|
import {StepsSchema} from './renderers/Steps';
|
61
|
+
import {SpinnerSchema} from './renderers/Spinner';
|
60
62
|
import {TimelineSchema} from './renderers/Timeline';
|
61
63
|
import {ArrayControlSchema} from './renderers/Form/InputArray';
|
62
64
|
import {ButtonGroupControlSchema} from './renderers/Form/ButtonGroupSelect';
|
@@ -149,6 +151,7 @@ export type SchemaType =
|
|
149
151
|
| 'month'
|
150
152
|
| 'static-month' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
|
151
153
|
| 'dialog'
|
154
|
+
| 'spinner'
|
152
155
|
| 'divider'
|
153
156
|
| 'dropdown-button'
|
154
157
|
| 'drawer'
|
@@ -331,7 +334,8 @@ export type SchemaType =
|
|
331
334
|
| 'native-date'
|
332
335
|
| 'native-time'
|
333
336
|
| 'native-number'
|
334
|
-
| 'code'
|
337
|
+
| 'code'
|
338
|
+
| 'tooltip-wrapper';
|
335
339
|
|
336
340
|
export type SchemaObject =
|
337
341
|
| PageSchema
|
@@ -382,6 +386,7 @@ export type SchemaObject =
|
|
382
386
|
| ServiceSchema
|
383
387
|
| SparkLineSchema
|
384
388
|
| StatusSchema
|
389
|
+
| SpinnerSchema
|
385
390
|
| TableSchema
|
386
391
|
| TabsSchema
|
387
392
|
| TasksSchema
|
@@ -389,6 +394,7 @@ export type SchemaObject =
|
|
389
394
|
| VideoSchema
|
390
395
|
| WizardSchema
|
391
396
|
| WrapperSchema
|
397
|
+
| TooltipWrapperSchema
|
392
398
|
| FormSchema
|
393
399
|
| AnchorNavSchema
|
394
400
|
| StepsSchema
|
@@ -593,6 +599,13 @@ export interface SchemaApiObject {
|
|
593
599
|
*/
|
594
600
|
cache?: number;
|
595
601
|
|
602
|
+
/**
|
603
|
+
* 强制将数据附加在 query,默认只有 api 地址中没有用变量的时候 crud 查询接口才会
|
604
|
+
* 自动附加数据到 query 部分,如果想强制附加请设置这个属性。
|
605
|
+
* 对于那种临时加了个变量但是又不想全部参数写一遍的时候配置很有用。
|
606
|
+
*/
|
607
|
+
forceAppendDataToQuery?: boolean;
|
608
|
+
|
596
609
|
/**
|
597
610
|
* qs 配置项
|
598
611
|
*/
|
@@ -882,4 +895,4 @@ export interface ToastSchemaBase extends BaseSchema {
|
|
882
895
|
* 持续时间
|
883
896
|
*/
|
884
897
|
timeout: number;
|
885
|
-
}
|
898
|
+
}
|
package/src/SchemaRenderer.tsx
CHANGED
@@ -15,12 +15,14 @@ import {asFormItem} from './renderers/Form/Item';
|
|
15
15
|
import {renderChild, renderChildren} from './Root';
|
16
16
|
import {IScopedContext, ScopedContext} from './Scoped';
|
17
17
|
import {Schema, SchemaNode} from './types';
|
18
|
-
import {DebugWrapper
|
18
|
+
import {DebugWrapper} from './utils/debug';
|
19
19
|
import getExprProperties from './utils/filter-schema';
|
20
20
|
import {anyChanged, chainEvents, autobind} from './utils/helper';
|
21
21
|
import {SimpleMap} from './utils/SimpleMap';
|
22
22
|
|
23
23
|
import type {RendererEvent} from './utils/renderer-event';
|
24
|
+
import {observer} from 'mobx-react';
|
25
|
+
import {isAlive} from 'mobx-state-tree';
|
24
26
|
|
25
27
|
interface SchemaRendererProps extends Partial<RendererProps> {
|
26
28
|
schema: Schema;
|
@@ -59,6 +61,7 @@ const defaultOmitList = [
|
|
59
61
|
|
60
62
|
const componentCache: SimpleMap = new SimpleMap();
|
61
63
|
|
64
|
+
@observer
|
62
65
|
class BroadcastCmpt extends React.Component<BroadcastCmptProps> {
|
63
66
|
ref: any;
|
64
67
|
unbindEvent: (() => void) | undefined = undefined;
|
@@ -99,21 +102,36 @@ class BroadcastCmpt extends React.Component<BroadcastCmptProps> {
|
|
99
102
|
}
|
100
103
|
|
101
104
|
render() {
|
102
|
-
const {component: Component, ...rest} = this.props;
|
103
|
-
|
105
|
+
const {component: Component, rootStore, ...rest} = this.props;
|
106
|
+
const visible = isAlive(rootStore)
|
107
|
+
? rootStore.visibleState[rest.$schema.id || rest.$path]
|
108
|
+
: true;
|
109
|
+
const disable = isAlive(rootStore)
|
110
|
+
? rootStore.disableState[rest.$schema.id || rest.$path]
|
111
|
+
: false;
|
104
112
|
const isClassComponent = Component.prototype?.isReactComponent;
|
105
113
|
|
106
|
-
|
114
|
+
if (disable) {
|
115
|
+
(rest as any).disabled = true;
|
116
|
+
}
|
107
117
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
118
|
+
// 函数组件不支持 ref https://reactjs.org/docs/refs-and-the-dom.html#refs-and-function-components
|
119
|
+
return visible !== false ? (
|
120
|
+
isClassComponent ? (
|
121
|
+
<Component
|
122
|
+
ref={this.childRef}
|
123
|
+
{...rest}
|
124
|
+
rootStore={rootStore}
|
125
|
+
dispatchEvent={this.dispatchEvent}
|
126
|
+
/>
|
127
|
+
) : (
|
128
|
+
<Component
|
129
|
+
{...rest}
|
130
|
+
rootStore={rootStore}
|
131
|
+
dispatchEvent={this.dispatchEvent}
|
132
|
+
/>
|
133
|
+
)
|
134
|
+
) : null;
|
117
135
|
}
|
118
136
|
}
|
119
137
|
|
@@ -399,7 +417,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
399
417
|
/>
|
400
418
|
);
|
401
419
|
|
402
|
-
return enableAMISDebug ? (
|
420
|
+
return this.props.env.enableAMISDebug ? (
|
403
421
|
<DebugWrapper renderer={renderer}>{component}</DebugWrapper>
|
404
422
|
) : (
|
405
423
|
component
|
package/src/WithStore.tsx
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
2
2
|
import {observer} from 'mobx-react';
|
3
|
+
import {isAlive} from 'mobx-state-tree';
|
3
4
|
import React from 'react';
|
4
5
|
import {RendererProps} from './factory';
|
5
6
|
import {IIRendererStore, IRendererStore} from './store';
|
@@ -257,7 +258,8 @@ export function HocStoreFactory(renderer: {
|
|
257
258
|
componentWillUnmount() {
|
258
259
|
const rootStore = this.context as IRendererStore;
|
259
260
|
const store = this.store;
|
260
|
-
|
261
|
+
|
262
|
+
isAlive(store) && rootStore.removeStore(store);
|
261
263
|
|
262
264
|
// @ts-ignore
|
263
265
|
delete this.store;
|
@@ -30,6 +30,34 @@ export class CmptAction implements Action {
|
|
30
30
|
? event.context.scoped?.getComponentById(action.componentId)
|
31
31
|
: renderer;
|
32
32
|
|
33
|
+
// 显隐&状态控制
|
34
|
+
if (['show', 'hidden'].includes(action.actionType)) {
|
35
|
+
return renderer.props.rootStore.setVisible(
|
36
|
+
action.componentId,
|
37
|
+
action.actionType === 'show'
|
38
|
+
);
|
39
|
+
} else if (['enabled', 'disabled'].includes(action.actionType)) {
|
40
|
+
return renderer.props.rootStore.setDisable(
|
41
|
+
action.componentId,
|
42
|
+
action.actionType === 'disabled'
|
43
|
+
);
|
44
|
+
}
|
45
|
+
|
46
|
+
// 数据更新
|
47
|
+
if (action.actionType === 'setValue') {
|
48
|
+
const value = dataMapping(action.value, event.data);
|
49
|
+
if (component.setData) {
|
50
|
+
return component.setData(value);
|
51
|
+
} else {
|
52
|
+
return component.props.onChange?.(value);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// 刷新
|
57
|
+
if (action.actionType === 'reload') {
|
58
|
+
return component.reload?.(undefined, action.args);
|
59
|
+
}
|
60
|
+
|
33
61
|
// 执行组件动作
|
34
62
|
return component.doAction?.(action, action.args);
|
35
63
|
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {
|
3
|
+
Action,
|
4
|
+
ListenerAction,
|
5
|
+
ListenerContext,
|
6
|
+
registerAction
|
7
|
+
} from './Action';
|
8
|
+
|
9
|
+
/**
|
10
|
+
* 返回上个页面
|
11
|
+
*
|
12
|
+
* @export
|
13
|
+
* @class PageGoBackAction
|
14
|
+
* @implements {Action}
|
15
|
+
*/
|
16
|
+
export class PageGoBackAction implements Action {
|
17
|
+
async run(
|
18
|
+
action: ListenerAction,
|
19
|
+
renderer: ListenerContext,
|
20
|
+
event: RendererEvent<any>
|
21
|
+
) {
|
22
|
+
window.history.back();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* 到指定页面
|
28
|
+
*
|
29
|
+
* @export
|
30
|
+
* @class PageGoAction
|
31
|
+
* @implements {Action}
|
32
|
+
*/
|
33
|
+
export class PageGoAction implements Action {
|
34
|
+
async run(
|
35
|
+
action: ListenerAction,
|
36
|
+
renderer: ListenerContext,
|
37
|
+
event: RendererEvent<any>
|
38
|
+
) {
|
39
|
+
window.history.go(action.delta || 0);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 浏览器刷新
|
45
|
+
*
|
46
|
+
* @export
|
47
|
+
* @class PageRefreshAction
|
48
|
+
* @implements {Action}
|
49
|
+
*/
|
50
|
+
export class PageRefreshAction implements Action {
|
51
|
+
async run(
|
52
|
+
action: ListenerAction,
|
53
|
+
renderer: ListenerContext,
|
54
|
+
event: RendererEvent<any>
|
55
|
+
) {
|
56
|
+
window.location.reload();
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
registerAction('goBack', new PageGoBackAction());
|
61
|
+
registerAction('refresh', new PageRefreshAction());
|
62
|
+
registerAction('goPage', new PageGoAction());
|
package/src/actions/index.ts
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
|
6
6
|
import React from 'react';
|
7
7
|
import {ClassNamesFn, themeable} from '../theme';
|
8
|
-
import {
|
8
|
+
import {generateIcon} from '../utils/icon';
|
9
|
+
import {Icon, getIcon} from './icons';
|
9
10
|
|
10
11
|
export interface AlertProps {
|
11
12
|
level: 'danger' | 'info' | 'success' | 'warning';
|
@@ -73,16 +74,21 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
|
73
74
|
closeButtonClassName
|
74
75
|
} = this.props;
|
75
76
|
|
77
|
+
// 优先使用内置svg,其次使用icon库
|
76
78
|
const iconNode = icon ? (
|
77
79
|
typeof icon === 'string' ? (
|
78
|
-
|
80
|
+
getIcon(icon) ? (
|
81
|
+
<Icon icon={icon} className={cx(`icon`)} />
|
82
|
+
) : (
|
83
|
+
generateIcon(cx, icon, 'icon')
|
84
|
+
)
|
79
85
|
) : React.isValidElement(icon) ? (
|
80
86
|
React.cloneElement(icon, {
|
81
87
|
className: cx(`Alert-icon`, icon.props?.className)
|
82
88
|
})
|
83
89
|
) : null
|
84
90
|
) : showIcon ? (
|
85
|
-
<Icon icon={`alert-${level}`} className={cx(`
|
91
|
+
<Icon icon={`alert-${level}`} className={cx(`icon`)} />
|
86
92
|
) : null;
|
87
93
|
|
88
94
|
return this.state.show ? (
|
@@ -88,9 +88,15 @@ export class AssociatedSelection extends BaseSelection<
|
|
88
88
|
|
89
89
|
@autobind
|
90
90
|
handleLeftDeferLoad(option: Option) {
|
91
|
-
const {leftOptions, onLeftDeferLoad} = this.props;
|
92
|
-
|
93
|
-
|
91
|
+
const {leftOptions, onLeftDeferLoad, onDeferLoad} = this.props;
|
92
|
+
|
93
|
+
if (typeof onLeftDeferLoad === 'function') {
|
94
|
+
// TabsTransfer
|
95
|
+
return onLeftDeferLoad?.(option, leftOptions);
|
96
|
+
} else if (typeof onDeferLoad === 'function') {
|
97
|
+
// Select
|
98
|
+
return onDeferLoad?.(option);
|
99
|
+
}
|
94
100
|
}
|
95
101
|
|
96
102
|
handleRetry(option: Option) {
|
@@ -20,7 +20,7 @@ export class BarCode extends React.Component<BarCodeProps> {
|
|
20
20
|
|
21
21
|
constructor(props: BarCodeProps) {
|
22
22
|
super(props);
|
23
|
-
this.dom = React.createRef<
|
23
|
+
this.dom = React.createRef<HTMLImageElement>();
|
24
24
|
}
|
25
25
|
|
26
26
|
componentDidUpdate(prevProps: BarCodeProps) {
|
@@ -43,7 +43,7 @@ export class BarCode extends React.Component<BarCodeProps> {
|
|
43
43
|
}
|
44
44
|
|
45
45
|
render() {
|
46
|
-
return <
|
46
|
+
return <img ref={this.dom} />;
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
@@ -48,6 +48,8 @@ export interface CascaderState {
|
|
48
48
|
tabs: Array<{
|
49
49
|
options: Options;
|
50
50
|
}>;
|
51
|
+
// 用于在只选择子节点模式的时候禁用按钮
|
52
|
+
disableConfirm: boolean;
|
51
53
|
}
|
52
54
|
|
53
55
|
export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
@@ -66,7 +68,8 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
66
68
|
{
|
67
69
|
options: this.props.options.slice() || []
|
68
70
|
}
|
69
|
-
]
|
71
|
+
],
|
72
|
+
disableConfirm: false
|
70
73
|
};
|
71
74
|
}
|
72
75
|
componentDidMount() {
|
@@ -288,7 +291,7 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
288
291
|
|
289
292
|
@autobind
|
290
293
|
onSelect(option: CascaderOption, tabIndex: number) {
|
291
|
-
const {multiple, valueField = 'value', cascade} = this.props;
|
294
|
+
const {multiple, valueField = 'value', cascade, onlyLeaf} = this.props;
|
292
295
|
|
293
296
|
let tabs = this.state.tabs.slice();
|
294
297
|
let {activeTab} = this.state;
|
@@ -364,10 +367,15 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
364
367
|
}
|
365
368
|
activeTab += 1;
|
366
369
|
}
|
370
|
+
let disableConfirm = false;
|
371
|
+
if (onlyLeaf && selectedOptions.length && selectedOptions[0].children) {
|
372
|
+
disableConfirm = true;
|
373
|
+
}
|
367
374
|
this.setState({
|
368
375
|
tabs,
|
369
376
|
activeTab,
|
370
|
-
selectedOptions
|
377
|
+
selectedOptions,
|
378
|
+
disableConfirm
|
371
379
|
});
|
372
380
|
}
|
373
381
|
|
@@ -428,23 +436,39 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
428
436
|
|
429
437
|
@autobind
|
430
438
|
confirm() {
|
431
|
-
const {
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
439
|
+
const {
|
440
|
+
onChange,
|
441
|
+
joinValues,
|
442
|
+
delimiter,
|
443
|
+
extractValue,
|
444
|
+
valueField,
|
445
|
+
onClose,
|
446
|
+
onlyLeaf
|
447
|
+
} = this.props;
|
448
|
+
const selectedOptions = this.getSelectedOptions();
|
449
|
+
if (onlyLeaf && selectedOptions.length && selectedOptions[0].children) {
|
450
|
+
return;
|
451
|
+
}
|
436
452
|
onChange(
|
437
453
|
joinValues
|
438
|
-
?
|
454
|
+
? selectedOptions
|
439
455
|
.map(item => item[valueField as string])
|
440
456
|
.join(delimiter)
|
441
457
|
: extractValue
|
442
|
-
?
|
443
|
-
:
|
458
|
+
? selectedOptions.map(item => item[valueField as string])
|
459
|
+
: selectedOptions
|
444
460
|
);
|
445
461
|
onClose && onClose();
|
446
462
|
}
|
447
463
|
|
464
|
+
@autobind
|
465
|
+
getSelectedOptions() {
|
466
|
+
return uniqBy(
|
467
|
+
this.getSubmitOptions(this.state.selectedOptions),
|
468
|
+
this.props.valueField
|
469
|
+
);
|
470
|
+
}
|
471
|
+
|
448
472
|
@autobind
|
449
473
|
renderOption(option: CascaderOption, tabIndex: number) {
|
450
474
|
const {
|
@@ -534,6 +558,7 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
534
558
|
classnames: cx,
|
535
559
|
className,
|
536
560
|
onClose,
|
561
|
+
valueField,
|
537
562
|
translate: __
|
538
563
|
} = this.props;
|
539
564
|
|
@@ -551,6 +576,7 @@ export class Cascader extends React.Component<CascaderProps, CascaderState> {
|
|
551
576
|
className={cx(`Cascader-btnConfirm`)}
|
552
577
|
level="text"
|
553
578
|
onClick={this.confirm}
|
579
|
+
disabled={this.state.disableConfirm}
|
554
580
|
>
|
555
581
|
{__('confirm')}
|
556
582
|
</Button>
|
@@ -16,10 +16,10 @@ interface CheckboxProps {
|
|
16
16
|
labelClassName?: string;
|
17
17
|
className?: string;
|
18
18
|
onChange?: (value: any, shift?: boolean) => void;
|
19
|
-
value?:
|
19
|
+
value?: boolean | string | number;
|
20
20
|
inline?: boolean;
|
21
|
-
trueValue?:
|
22
|
-
falseValue?:
|
21
|
+
trueValue?: boolean | string | number;
|
22
|
+
falseValue?: boolean | string | number;
|
23
23
|
disabled?: boolean;
|
24
24
|
readOnly?: boolean;
|
25
25
|
checked?: boolean;
|
@@ -28,6 +28,7 @@ interface CheckboxProps {
|
|
28
28
|
classPrefix: string;
|
29
29
|
classnames: ClassNamesFn;
|
30
30
|
partial?: boolean;
|
31
|
+
optionType?: 'default' | 'button';
|
31
32
|
}
|
32
33
|
|
33
34
|
export class Checkbox extends React.Component<CheckboxProps, any> {
|
@@ -70,14 +71,19 @@ export class Checkbox extends React.Component<CheckboxProps, any> {
|
|
70
71
|
checked,
|
71
72
|
type,
|
72
73
|
name,
|
73
|
-
labelClassName
|
74
|
+
labelClassName,
|
75
|
+
optionType
|
74
76
|
} = this.props;
|
75
77
|
|
76
78
|
return (
|
77
79
|
<label
|
78
80
|
className={cx(`Checkbox Checkbox--${type}`, className, {
|
79
81
|
'Checkbox--full': !partial,
|
80
|
-
|
82
|
+
// 'Checkbox--partial': partial
|
83
|
+
[`Checkbox--${size}`]: size,
|
84
|
+
'Checkbox--button': optionType === 'button',
|
85
|
+
'Checkbox--button--checked': optionType === 'button' && checked,
|
86
|
+
'Checkbox--button--disabled--unchecked': disabled && !checked
|
81
87
|
})}
|
82
88
|
>
|
83
89
|
<input
|
@@ -145,8 +145,11 @@ const CityArea = memo<AreaProps>(props => {
|
|
145
145
|
} else {
|
146
146
|
onChange({
|
147
147
|
code,
|
148
|
+
provinceCode: province,
|
148
149
|
province: db[province],
|
150
|
+
cityCode: city,
|
149
151
|
city: db[city],
|
152
|
+
districtCode: district,
|
150
153
|
district: db[district],
|
151
154
|
street
|
152
155
|
});
|
@@ -17,6 +17,7 @@ import Calendar from './calendar/Calendar';
|
|
17
17
|
import {localeable, LocaleProps, TranslateFn} from '../locale';
|
18
18
|
import {isMobile, ucFirst} from '../utils/helper';
|
19
19
|
import CalendarMobile from './CalendarMobile';
|
20
|
+
import Input from './Input';
|
20
21
|
|
21
22
|
const availableShortcuts: {[propName: string]: any} = {
|
22
23
|
now: {
|
@@ -302,6 +303,7 @@ export interface DatePickerState {
|
|
302
303
|
isOpened: boolean;
|
303
304
|
isFocused: boolean;
|
304
305
|
value: moment.Moment | undefined;
|
306
|
+
inputValue: string | undefined; // 手动输入的值
|
305
307
|
}
|
306
308
|
|
307
309
|
function normalizeValue(value: any, format?: string) {
|
@@ -329,11 +331,15 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
329
331
|
state: DatePickerState = {
|
330
332
|
isOpened: false,
|
331
333
|
isFocused: false,
|
332
|
-
value: normalizeValue(this.props.value, this.props.format)
|
334
|
+
value: normalizeValue(this.props.value, this.props.format),
|
335
|
+
inputValue:
|
336
|
+
normalizeValue(this.props.value, this.props.format)?.format(
|
337
|
+
this.props.inputFormat
|
338
|
+
) || ''
|
333
339
|
};
|
334
340
|
constructor(props: DateProps) {
|
335
341
|
super(props);
|
336
|
-
|
342
|
+
this.inputRef = React.createRef();
|
337
343
|
this.handleChange = this.handleChange.bind(this);
|
338
344
|
this.selectRannge = this.selectRannge.bind(this);
|
339
345
|
this.checkIsValidDate = this.checkIsValidDate.bind(this);
|
@@ -348,17 +354,26 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
348
354
|
this.getTarget = this.getTarget.bind(this);
|
349
355
|
this.handlePopOverClick = this.handlePopOverClick.bind(this);
|
350
356
|
this.renderShortCuts = this.renderShortCuts.bind(this);
|
357
|
+
this.inputChange = this.inputChange.bind(this);
|
351
358
|
}
|
352
359
|
|
353
360
|
dom: HTMLDivElement;
|
354
361
|
|
362
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
363
|
+
|
355
364
|
componentDidUpdate(prevProps: DateProps) {
|
356
365
|
const props = this.props;
|
357
366
|
|
358
|
-
|
359
|
-
|
367
|
+
const prevValue = prevProps.value;
|
368
|
+
|
369
|
+
if (prevValue !== props.value) {
|
370
|
+
const newState: any = {
|
360
371
|
value: normalizeValue(props.value, props.format)
|
361
|
-
}
|
372
|
+
};
|
373
|
+
|
374
|
+
newState.inputValue = newState.value.format(this.props.inputFormat) || '';
|
375
|
+
|
376
|
+
this.setState(newState);
|
362
377
|
}
|
363
378
|
}
|
364
379
|
|
@@ -403,13 +418,17 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
403
418
|
}
|
404
419
|
|
405
420
|
open(fn?: () => void) {
|
406
|
-
this.props.disabled
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
421
|
+
if (this.props.disabled) {
|
422
|
+
return;
|
423
|
+
}
|
424
|
+
this.setState(
|
425
|
+
{
|
426
|
+
isOpened: true
|
427
|
+
},
|
428
|
+
fn
|
429
|
+
);
|
430
|
+
const input = this.inputRef.current;
|
431
|
+
input && input.focus();
|
413
432
|
}
|
414
433
|
|
415
434
|
close() {
|
@@ -423,6 +442,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
423
442
|
e.stopPropagation();
|
424
443
|
const onChange = this.props.onChange;
|
425
444
|
onChange('');
|
445
|
+
this.setState({inputValue: ''});
|
426
446
|
}
|
427
447
|
|
428
448
|
handleChange(value: moment.Moment) {
|
@@ -432,6 +452,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
432
452
|
minDate,
|
433
453
|
maxDate,
|
434
454
|
dateFormat,
|
455
|
+
inputFormat,
|
435
456
|
timeFormat,
|
436
457
|
closeOnSelect,
|
437
458
|
utc,
|
@@ -453,6 +474,31 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
453
474
|
if (closeOnSelect && dateFormat && !timeFormat) {
|
454
475
|
this.close();
|
455
476
|
}
|
477
|
+
|
478
|
+
this.setState({
|
479
|
+
inputValue: utc
|
480
|
+
? moment.utc(value).format(inputFormat)
|
481
|
+
: value.format(inputFormat)
|
482
|
+
});
|
483
|
+
}
|
484
|
+
|
485
|
+
// 手动输入日期
|
486
|
+
inputChange(e: React.ChangeEvent<HTMLInputElement>) {
|
487
|
+
const {onChange, inputFormat, format, utc} = this.props;
|
488
|
+
const value = e.currentTarget.value;
|
489
|
+
this.setState({inputValue: value});
|
490
|
+
if (value === '') {
|
491
|
+
onChange('');
|
492
|
+
} else {
|
493
|
+
const newDate = moment(value, inputFormat);
|
494
|
+
const dateValue = utc
|
495
|
+
? moment.utc(newDate).format(format)
|
496
|
+
: newDate.format(format);
|
497
|
+
// 小于 0 的日期丢弃
|
498
|
+
if (!dateValue.startsWith('-')) {
|
499
|
+
onChange(dateValue);
|
500
|
+
}
|
501
|
+
}
|
456
502
|
}
|
457
503
|
|
458
504
|
selectRannge(item: any) {
|
@@ -684,7 +730,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
684
730
|
`DatePicker`,
|
685
731
|
{
|
686
732
|
'is-disabled': disabled,
|
687
|
-
'is-focused': this.state.isFocused,
|
733
|
+
'is-focused': !disabled && this.state.isFocused,
|
688
734
|
[`DatePicker--border${ucFirst(borderMode)}`]: borderMode,
|
689
735
|
'is-mobile': useMobileUI && isMobile()
|
690
736
|
},
|
@@ -693,15 +739,15 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
693
739
|
ref={this.domRef}
|
694
740
|
onClick={this.handleClick}
|
695
741
|
>
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
742
|
+
<Input
|
743
|
+
className={cx('DatePicker-input')}
|
744
|
+
onChange={this.inputChange}
|
745
|
+
ref={this.inputRef}
|
746
|
+
placeholder={__(placeholder)}
|
747
|
+
autoComplete="off"
|
748
|
+
value={this.state.inputValue}
|
749
|
+
disabled={disabled}
|
750
|
+
/>
|
705
751
|
|
706
752
|
{clearable && !disabled && normalizeValue(value, format) ? (
|
707
753
|
<a className={cx(`DatePicker-clear`)} onClick={this.clearValue}>
|