amis 1.5.6 → 1.6.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-commit +1 -1
- package/README.md +1 -0
- package/lib/RootRenderer.d.ts +2 -0
- package/lib/RootRenderer.js +19 -1
- package/lib/RootRenderer.js.map +2 -2
- package/lib/Schema.d.ts +3 -2
- package/lib/Schema.js.map +1 -1
- package/lib/SchemaRenderer.js +52 -1
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/Scoped.d.ts +2 -0
- package/lib/Scoped.js +27 -1
- package/lib/Scoped.js.map +2 -2
- package/lib/actions/Action.d.ts +33 -0
- package/lib/actions/Action.js +100 -0
- package/lib/actions/Action.js.map +13 -0
- package/lib/actions/AjaxAction.d.ts +14 -0
- package/lib/actions/AjaxAction.js +68 -0
- package/lib/actions/AjaxAction.js.map +13 -0
- package/lib/actions/BreakAction.d.ts +12 -0
- package/lib/actions/BreakAction.js +28 -0
- package/lib/actions/BreakAction.js.map +13 -0
- package/lib/actions/BroadcastAction.d.ts +12 -0
- package/lib/actions/BroadcastAction.js +40 -0
- package/lib/actions/BroadcastAction.js.map +13 -0
- package/lib/actions/CmptAction.d.ts +12 -0
- package/lib/actions/CmptAction.js +40 -0
- package/lib/actions/CmptAction.js.map +13 -0
- package/lib/actions/ContinueAction.d.ts +12 -0
- package/lib/actions/ContinueAction.js +28 -0
- package/lib/actions/ContinueAction.js.map +13 -0
- package/lib/actions/CopyAction.d.ts +12 -0
- package/lib/actions/CopyAction.js +35 -0
- package/lib/actions/CopyAction.js.map +13 -0
- package/lib/actions/CustomAction.d.ts +12 -0
- package/lib/actions/CustomAction.js +43 -0
- package/lib/actions/CustomAction.js.map +13 -0
- package/lib/actions/DialogAction.d.ts +12 -0
- package/lib/actions/DialogAction.js +31 -0
- package/lib/actions/DialogAction.js.map +13 -0
- package/lib/actions/DrawerAction.d.ts +12 -0
- package/lib/actions/DrawerAction.js +31 -0
- package/lib/actions/DrawerAction.js.map +13 -0
- package/lib/actions/EmailAction.d.ts +12 -0
- package/lib/actions/EmailAction.js +37 -0
- package/lib/actions/EmailAction.js.map +13 -0
- package/lib/actions/LoopAction.d.ts +12 -0
- package/lib/actions/LoopAction.js +93 -0
- package/lib/actions/LoopAction.js.map +13 -0
- package/lib/actions/OpenPageAction.d.ts +12 -0
- package/lib/actions/OpenPageAction.js +33 -0
- package/lib/actions/OpenPageAction.js.map +13 -0
- package/lib/actions/ParallelAction.d.ts +5 -0
- package/lib/actions/ParallelAction.js +33 -0
- package/lib/actions/ParallelAction.js.map +13 -0
- package/lib/actions/SwitchAction.d.ts +8 -0
- package/lib/actions/SwitchAction.js +45 -0
- package/lib/actions/SwitchAction.js.map +13 -0
- package/lib/actions/index.d.ts +18 -0
- package/lib/actions/index.js +22 -0
- package/lib/actions/index.js.map +13 -0
- package/lib/components/AnchorNav.d.ts +20 -20
- package/lib/components/AssociatedSelection.d.ts +84 -84
- package/lib/components/AssociatedSelection.js +2 -2
- package/lib/components/AssociatedSelection.js.map +2 -2
- package/lib/components/Avatar.d.ts +135 -0
- package/lib/components/Avatar.js +120 -0
- package/lib/components/Avatar.js.map +13 -0
- package/lib/components/BaiduMapPicker.js.map +2 -2
- package/lib/components/Button.d.ts +20 -20
- package/lib/components/CalendarMobile.d.ts +573 -0
- package/lib/components/CalendarMobile.js +486 -0
- package/lib/components/CalendarMobile.js.map +13 -0
- package/lib/components/Cascader.d.ts +123 -0
- package/lib/components/Cascader.js +487 -0
- package/lib/components/Cascader.js.map +13 -0
- package/lib/components/ChainedSelection.d.ts +84 -84
- package/lib/components/ChainedSelection.js +15 -3
- package/lib/components/ChainedSelection.js.map +2 -2
- package/lib/components/CityArea.d.ts +527 -0
- package/lib/components/CityArea.js +177 -0
- package/lib/components/CityArea.js.map +13 -0
- package/lib/components/Collapse.d.ts +20 -20
- package/lib/components/ColorPicker.d.ts +84 -84
- package/lib/components/ColorPicker.js +4 -3
- package/lib/components/ColorPicker.js.map +2 -2
- package/lib/components/DatePicker.d.ts +85 -84
- package/lib/components/DatePicker.js +21 -8
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +85 -84
- package/lib/components/DateRangePicker.js +19 -6
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/GroupedSelection.d.ts +84 -84
- package/lib/components/GroupedSelection.js +14 -2
- package/lib/components/GroupedSelection.js.map +2 -2
- package/lib/components/InputBox.d.ts +21 -21
- package/lib/components/ListGroup.d.ts +21 -21
- package/lib/components/ListMenu.d.ts +84 -84
- package/lib/components/MonthRangePicker.d.ts +85 -84
- package/lib/components/MonthRangePicker.js +18 -7
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/Overlay.d.ts +1 -1
- package/lib/components/Overlay.js.map +1 -1
- package/lib/components/Picker.d.ts +1 -0
- package/lib/components/Picker.js +16 -7
- package/lib/components/Picker.js.map +2 -2
- package/lib/components/PickerColumn.d.ts +1 -0
- package/lib/components/PickerColumn.js +21 -18
- package/lib/components/PickerColumn.js.map +2 -2
- package/lib/components/PickerContainer.d.ts +3 -0
- package/lib/components/PickerContainer.js +12 -5
- package/lib/components/PickerContainer.js.map +2 -2
- package/lib/components/PopOverContainer.d.ts +1 -0
- package/lib/components/PopOverContainer.js +5 -3
- package/lib/components/PopOverContainer.js.map +2 -2
- package/lib/components/PopUp.d.ts +1041 -28
- package/lib/components/PopUp.js +32 -8
- package/lib/components/PopUp.js.map +2 -2
- package/lib/components/Radios.d.ts +21 -21
- package/lib/components/Rating.d.ts +21 -21
- package/lib/components/ResultBox.d.ts +85 -84
- package/lib/components/ResultBox.js +9 -4
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/ResultList.d.ts +9 -2
- package/lib/components/ResultList.js +22 -2
- package/lib/components/ResultList.js.map +2 -2
- package/lib/components/Select.d.ts +238 -238
- package/lib/components/Select.js +13 -9
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Selection.d.ts +94 -86
- package/lib/components/Selection.js +11 -2
- package/lib/components/Selection.js.map +2 -2
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/TableSelection.d.ts +85 -85
- package/lib/components/TableSelection.js +1 -9
- package/lib/components/TableSelection.js.map +2 -2
- package/lib/components/Tabs.js +31 -33
- package/lib/components/Tabs.js.map +2 -2
- package/lib/components/TabsTransfer.d.ts +87 -256
- package/lib/components/TabsTransfer.js +52 -9
- package/lib/components/TabsTransfer.js.map +2 -2
- package/lib/components/TabsTransferPicker.d.ts +1 -1
- package/lib/components/TabsTransferPicker.js +20 -18
- package/lib/components/TabsTransferPicker.js.map +2 -2
- package/lib/components/Timeline.d.ts +69 -0
- package/lib/components/Timeline.js +16 -0
- package/lib/components/Timeline.js.map +13 -0
- package/lib/components/TimelineItem.d.ts +517 -0
- package/lib/components/TimelineItem.js +40 -0
- package/lib/components/TimelineItem.js.map +13 -0
- package/lib/components/Transfer.d.ts +100 -98
- package/lib/components/Transfer.js +2 -3
- package/lib/components/Transfer.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +85 -84
- package/lib/components/TransferDropDown.js +9 -10
- package/lib/components/TransferDropDown.js.map +2 -2
- package/lib/components/TransferPicker.d.ts +1 -0
- package/lib/components/TransferPicker.js +19 -4
- package/lib/components/TransferPicker.js.map +2 -2
- package/lib/components/Tree.d.ts +84 -84
- package/lib/components/TreeSelection.d.ts +85 -85
- package/lib/components/TreeSelection.js +7 -1
- package/lib/components/TreeSelection.js.map +2 -2
- package/lib/components/calendar/Calendar.d.ts +19 -0
- package/lib/components/calendar/Calendar.js +71 -1
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/calendar/DaysView.d.ts +21 -0
- package/lib/components/calendar/DaysView.js +76 -17
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/calendar/MonthsView.d.ts +34 -0
- package/lib/components/calendar/MonthsView.js +68 -3
- package/lib/components/calendar/MonthsView.js.map +2 -2
- package/lib/components/calendar/QuartersView.d.ts +1 -0
- package/lib/components/calendar/QuartersView.js +2 -2
- package/lib/components/calendar/QuartersView.js.map +2 -2
- package/lib/components/calendar/TimeView.d.ts +30 -18
- package/lib/components/calendar/TimeView.js +47 -8
- package/lib/components/calendar/TimeView.js.map +2 -2
- package/lib/components/calendar/YearsView.d.ts +6 -0
- package/lib/components/calendar/YearsView.js +21 -10
- package/lib/components/calendar/YearsView.js.map +2 -2
- package/lib/components/condition-builder/Field.js +1 -4
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Func.js +1 -1
- package/lib/components/condition-builder/Func.js.map +2 -2
- package/lib/components/formula/Editor.d.ts +3 -0
- package/lib/components/formula/Editor.js +3 -2
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/FuncList.js +2 -1
- package/lib/components/formula/FuncList.js.map +2 -2
- package/lib/components/formula/Picker.js +1 -1
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/components/formula/plugin.js +0 -1
- package/lib/components/formula/plugin.js.map +2 -2
- package/lib/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +4 -2
- package/lib/components/index.js.map +2 -2
- package/lib/components/virtual-list/SizeAndPositionManager.js.map +2 -2
- package/lib/components/virtual-list/index.js +1 -2
- package/lib/components/virtual-list/index.js.map +2 -2
- package/lib/env.d.ts +4 -0
- package/lib/env.js.map +2 -2
- package/lib/factory.d.ts +2 -1
- package/lib/factory.js +83 -0
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/icons/tree-down.js +7 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +17 -2
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +17 -2
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +16 -1
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +1 -1
- package/lib/renderers/Action.js +26 -10
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/Avatar.d.ts +35 -26
- package/lib/renderers/Avatar.js +14 -19
- package/lib/renderers/Avatar.js.map +2 -2
- package/lib/renderers/CRUD.js +1 -2
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Card.js +6 -5
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Custom.d.ts +1 -1
- package/lib/renderers/Custom.js +1 -1
- package/lib/renderers/Custom.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +11 -2
- package/lib/renderers/DropDownButton.js +30 -12
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Each.js +5 -2
- package/lib/renderers/Each.js.map +2 -2
- package/lib/renderers/Flex.js +1 -5
- package/lib/renderers/Flex.js.map +2 -2
- package/lib/renderers/Form/ChartRadios.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.js.map +2 -2
- package/lib/renderers/Form/CityDB.js +526 -2
- package/lib/renderers/Form/CityDB.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +6 -0
- package/lib/renderers/Form/DiffEditor.js +2 -1
- package/lib/renderers/Form/DiffEditor.js.map +2 -2
- package/lib/renderers/Form/Editor.d.ts +6 -0
- package/lib/renderers/Form/InputCity.d.ts +85 -84
- package/lib/renderers/Form/InputCity.js +4 -2
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputColor.d.ts +84 -84
- package/lib/renderers/Form/InputColor.js +6 -2
- package/lib/renderers/Form/InputColor.js.map +2 -2
- package/lib/renderers/Form/InputDate.js +10 -5
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.js +6 -2
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/InputFormula.d.ts +4 -1
- package/lib/renderers/Form/InputFormula.js +2 -2
- package/lib/renderers/Form/InputFormula.js.map +2 -2
- package/lib/renderers/Form/InputImage.d.ts +1 -0
- package/lib/renderers/Form/InputImage.js +8 -4
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/InputMonthRange.js +1 -1
- package/lib/renderers/Form/InputMonthRange.js.map +2 -2
- package/lib/renderers/Form/InputQuarterRange.js +1 -1
- package/lib/renderers/Form/InputQuarterRange.js.map +2 -2
- package/lib/renderers/Form/InputYearRange.js +1 -1
- package/lib/renderers/Form/InputYearRange.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +10 -14
- package/lib/renderers/Form/Item.js +18 -9
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/NestedSelect.d.ts +1 -0
- package/lib/renderers/Form/NestedSelect.js +8 -4
- package/lib/renderers/Form/NestedSelect.js.map +2 -2
- package/lib/renderers/Form/Options.js +9 -7
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Select.d.ts +2 -0
- package/lib/renderers/Form/Select.js +9 -6
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TabsTransfer.d.ts +5 -32
- package/lib/renderers/Form/TabsTransfer.js +20 -1
- package/lib/renderers/Form/TabsTransfer.js.map +2 -2
- package/lib/renderers/Form/TabsTransferPicker.d.ts +5 -35
- package/lib/renderers/Form/TabsTransferPicker.js +21 -2
- package/lib/renderers/Form/TabsTransferPicker.js.map +2 -2
- package/lib/renderers/Form/Transfer.d.ts +15 -4
- package/lib/renderers/Form/Transfer.js +55 -18
- package/lib/renderers/Form/Transfer.js.map +2 -2
- package/lib/renderers/Form/TransferPicker.d.ts +3 -32
- package/lib/renderers/Form/TransferPicker.js +1 -1
- package/lib/renderers/Form/TransferPicker.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.js +4 -4
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.js +10 -2
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/IFrame.js +0 -2
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Link.d.ts +1 -1
- package/lib/renderers/Link.js +27 -6
- package/lib/renderers/Link.js.map +2 -2
- package/lib/renderers/Nav.d.ts +21 -21
- package/lib/renderers/Nav.js +4 -1
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Remark.d.ts +5 -1
- package/lib/renderers/Remark.js +39 -7
- package/lib/renderers/Remark.js.map +2 -2
- package/lib/renderers/Steps.js +5 -5
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/TableRow.js +4 -1
- package/lib/renderers/Table/TableRow.js.map +2 -2
- package/lib/renderers/Table/index.js +4 -1
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tabs.js +1 -1
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/Timeline.d.ts +65 -0
- package/lib/renderers/Timeline.js +54 -0
- package/lib/renderers/Timeline.js.map +13 -0
- package/lib/renderers/Video.js.map +2 -2
- package/lib/schemaExtend.js +23 -9
- package/lib/schemaExtend.js.map +2 -2
- package/lib/store/combo.js.map +2 -2
- package/lib/store/formItem.js +7 -7
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/table.js +1 -1
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +1149 -53
- package/lib/themes/ang.css +1149 -53
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +1187 -53
- package/lib/themes/antd.css +1187 -53
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1190 -71
- package/lib/themes/cxd.css +1190 -71
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +1152 -53
- package/lib/themes/dark.css +1152 -53
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +1190 -71
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/RootClose.js +3 -1
- package/lib/utils/RootClose.js.map +2 -2
- package/lib/utils/api.js +14 -3
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/debug.d.ts +26 -0
- package/lib/utils/debug.js +351 -0
- package/lib/utils/debug.js.map +13 -0
- package/lib/utils/helper.d.ts +1 -6
- package/lib/utils/helper.js +6 -17
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/renderer-event.d.ts +38 -0
- package/lib/utils/renderer-event.js +28 -0
- package/lib/utils/renderer-event.js.map +13 -0
- package/package.json +12 -6
- package/schema.json +3483 -810
- package/scss/_properties.scss +20 -6
- package/scss/_variables.scss +1 -0
- package/scss/components/_avatar.scss +27 -9
- package/scss/components/_calendar.scss +291 -0
- package/scss/components/_card.scss +1 -1
- package/scss/components/_cascader.scss +102 -0
- package/scss/components/_city-area.scss +27 -0
- package/scss/components/_collapse-group.scss +1 -3
- package/scss/components/_debug.scss +167 -0
- package/scss/components/_dropdown.scss +39 -9
- package/scss/components/_formula.scss +30 -6
- package/scss/components/_modal.scss +18 -0
- package/scss/components/_panel.scss +45 -0
- package/scss/components/_picker-columns.scss +15 -5
- package/scss/components/_popup.scss +43 -16
- package/scss/components/_result-box.scss +31 -0
- package/scss/components/_timeline.scss +198 -0
- package/scss/components/form/_checks.scss +2 -0
- package/scss/components/form/_color.scss +2 -2
- package/scss/components/form/_date-range.scss +34 -1
- package/scss/components/form/_date.scss +46 -1
- package/scss/components/form/_form.scss +170 -0
- package/scss/components/form/_nested-select.scss +3 -0
- package/scss/components/form/_result-list.scss +2 -0
- package/scss/components/form/_select.scss +32 -3
- package/scss/components/form/_selection.scss +5 -4
- package/scss/components/form/_transfer.scss +3 -0
- package/scss/components/form/_tree-select.scss +1 -1
- package/scss/themes/_antd-variables.scss +45 -0
- package/scss/themes/_common.scss +5 -0
- package/scss/themes/_cxd-variables.scss +51 -2
- package/scss/themes/_dark-variables.scss +4 -0
- package/scss/themes/cxd.scss +0 -19
- package/sdk/ang-ie11.css +1450 -142
- package/sdk/ang.css +1473 -159
- package/sdk/antd-ie11.css +1451 -142
- package/sdk/antd.css +1511 -159
- package/sdk/charts.js +15 -15
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +1449 -159
- package/sdk/cxd.css +1514 -179
- package/sdk/dark-ie11.css +1450 -142
- package/sdk/dark.css +1476 -159
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/locale/de-DE.js +17 -2
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +18 -18
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +1449 -159
- package/sdk/sdk.css +1514 -179
- package/sdk/sdk.js +1311 -1253
- 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/RootRenderer.tsx +27 -1
- package/src/Schema.ts +3 -0
- package/src/SchemaRenderer.tsx +70 -4
- package/src/Scoped.tsx +46 -4
- package/src/actions/Action.ts +138 -0
- package/src/actions/AjaxAction.ts +58 -0
- package/src/actions/BreakAction.ts +27 -0
- package/src/actions/BroadcastAction.ts +41 -0
- package/src/actions/CmptAction.ts +36 -0
- package/src/actions/ContinueAction.ts +27 -0
- package/src/actions/CopyAction.ts +41 -0
- package/src/actions/CustomAction.ts +46 -0
- package/src/actions/DialogAction.ts +28 -0
- package/src/actions/DrawerAction.ts +28 -0
- package/src/actions/EmailAction.ts +38 -0
- package/src/actions/LoopAction.ts +77 -0
- package/src/actions/OpenPageAction.ts +39 -0
- package/src/actions/ParallelAction.ts +26 -0
- package/src/actions/SwitchAction.ts +35 -0
- package/src/actions/index.ts +20 -0
- package/src/components/AssociatedSelection.tsx +5 -1
- package/src/components/Avatar.tsx +253 -0
- package/src/components/BaiduMapPicker.tsx +19 -14
- package/src/components/CalendarMobile.tsx +658 -0
- package/src/components/Cascader.tsx +564 -0
- package/src/components/ChainedSelection.tsx +16 -3
- package/src/components/CityArea.tsx +315 -0
- package/src/components/ColorPicker.tsx +41 -40
- package/src/components/DatePicker.tsx +80 -34
- package/src/components/DateRangePicker.tsx +85 -30
- package/src/components/GroupedSelection.tsx +14 -2
- package/src/components/MonthRangePicker.tsx +78 -31
- package/src/components/Overlay.tsx +1 -1
- package/src/components/Picker.tsx +55 -35
- package/src/components/PickerColumn.tsx +43 -36
- package/src/components/PickerContainer.tsx +13 -1
- package/src/components/PopOverContainer.tsx +31 -17
- package/src/components/PopUp.tsx +84 -57
- package/src/components/ResultBox.tsx +14 -2
- package/src/components/ResultList.tsx +36 -6
- package/src/components/Select.tsx +24 -26
- package/src/components/Selection.tsx +21 -3
- package/src/components/Steps.tsx +23 -10
- package/src/components/TableSelection.tsx +1 -44
- package/src/components/Tabs.tsx +65 -54
- package/src/components/TabsTransfer.tsx +78 -9
- package/src/components/TabsTransferPicker.tsx +25 -13
- package/src/components/Timeline.tsx +36 -0
- package/src/components/TimelineItem.tsx +140 -0
- package/src/components/Transfer.tsx +11 -8
- package/src/components/TransferDropDown.tsx +20 -12
- package/src/components/TransferPicker.tsx +25 -4
- package/src/components/TreeSelection.tsx +7 -1
- package/src/components/calendar/Calendar.tsx +101 -4
- package/src/components/calendar/DaysView.tsx +165 -33
- package/src/components/calendar/MonthsView.tsx +108 -1
- package/src/components/calendar/QuartersView.tsx +3 -2
- package/src/components/calendar/TimeView.tsx +104 -41
- package/src/components/calendar/YearsView.tsx +34 -17
- package/src/components/condition-builder/Field.tsx +1 -3
- package/src/components/condition-builder/Func.tsx +1 -1
- package/src/components/formula/Editor.tsx +16 -11
- package/src/components/formula/FuncList.tsx +3 -1
- package/src/components/formula/Picker.tsx +2 -1
- package/src/components/formula/plugin.ts +0 -2
- package/src/components/icons.tsx +2 -0
- package/src/components/index.tsx +2 -0
- package/src/components/virtual-list/SizeAndPositionManager.ts +6 -3
- package/src/components/virtual-list/index.tsx +4 -6
- package/src/env.tsx +22 -0
- package/src/factory.tsx +93 -1
- package/src/icons/tree-down.svg +5 -0
- package/src/index.tsx +5 -0
- package/src/locale/de-DE.ts +17 -2
- package/src/locale/en-US.ts +17 -2
- package/src/locale/zh-CN.ts +16 -1
- package/src/renderers/Action.tsx +11 -2
- package/src/renderers/Avatar.tsx +83 -74
- package/src/renderers/CRUD.tsx +1 -3
- package/src/renderers/Card.tsx +10 -6
- package/src/renderers/Custom.tsx +7 -4
- package/src/renderers/DropDownButton.tsx +69 -35
- package/src/renderers/Each.tsx +4 -4
- package/src/renderers/Flex.tsx +3 -7
- package/src/renderers/Form/ChartRadios.tsx +2 -7
- package/src/renderers/Form/Checkboxes.tsx +1 -1
- package/src/renderers/Form/CityDB.ts +526 -2
- package/src/renderers/Form/DiffEditor.tsx +2 -3
- package/src/renderers/Form/InputCity.tsx +23 -3
- package/src/renderers/Form/InputColor.tsx +21 -2
- package/src/renderers/Form/InputDate.tsx +48 -20
- package/src/renderers/Form/InputDateRange.tsx +9 -2
- package/src/renderers/Form/InputFormula.tsx +9 -4
- package/src/renderers/Form/InputImage.tsx +9 -4
- package/src/renderers/Form/InputMonthRange.tsx +0 -1
- package/src/renderers/Form/InputQuarterRange.tsx +0 -1
- package/src/renderers/Form/InputYearRange.tsx +0 -1
- package/src/renderers/Form/Item.tsx +29 -8
- package/src/renderers/Form/NestedSelect.tsx +32 -4
- package/src/renderers/Form/Options.tsx +15 -7
- package/src/renderers/Form/Select.tsx +21 -5
- package/src/renderers/Form/TabsTransfer.tsx +28 -38
- package/src/renderers/Form/TabsTransferPicker.tsx +28 -46
- package/src/renderers/Form/Transfer.tsx +75 -24
- package/src/renderers/Form/TransferPicker.tsx +6 -38
- package/src/renderers/Form/TreeSelect.tsx +18 -16
- package/src/renderers/Form/index.tsx +9 -2
- package/src/renderers/IFrame.tsx +0 -2
- package/src/renderers/Link.tsx +18 -3
- package/src/renderers/Nav.tsx +4 -1
- package/src/renderers/Remark.tsx +68 -18
- package/src/renderers/Steps.tsx +11 -13
- package/src/renderers/Table/TableRow.tsx +3 -1
- package/src/renderers/Table/index.tsx +7 -1
- package/src/renderers/Tabs.tsx +6 -2
- package/src/renderers/Timeline.tsx +141 -0
- package/src/renderers/Video.tsx +4 -20
- package/src/schemaExtend.ts +22 -10
- package/src/store/combo.ts +1 -3
- package/src/store/formItem.ts +3 -3
- package/src/store/table.ts +2 -1
- package/src/utils/RootClose.ts +5 -1
- package/src/utils/api.ts +15 -2
- package/src/utils/debug.tsx +438 -0
- package/src/utils/helper.ts +6 -16
- package/src/utils/renderer-event.ts +75 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {
|
3
|
+
Action,
|
4
|
+
ListenerAction,
|
5
|
+
ListenerContext,
|
6
|
+
LoopStatus,
|
7
|
+
registerAction
|
8
|
+
} from './Action';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* 自定义动作,JS脚本
|
12
|
+
*
|
13
|
+
* @export
|
14
|
+
* @class CustomAction
|
15
|
+
* @implements {Action}
|
16
|
+
*/
|
17
|
+
export class CustomAction implements Action {
|
18
|
+
async run(
|
19
|
+
action: ListenerAction,
|
20
|
+
renderer: ListenerContext,
|
21
|
+
event: RendererEvent<any>
|
22
|
+
) {
|
23
|
+
// 执行自定义编排脚本
|
24
|
+
let scriptFunc = action.script;
|
25
|
+
|
26
|
+
if (typeof scriptFunc === 'string') {
|
27
|
+
scriptFunc = new Function(
|
28
|
+
'context',
|
29
|
+
'doAction',
|
30
|
+
'event',
|
31
|
+
scriptFunc
|
32
|
+
) as any;
|
33
|
+
}
|
34
|
+
|
35
|
+
// 外部可以直接调用doAction来完成动作调用
|
36
|
+
// 可以通过上下文直接编排动作调用,通过event来进行动作干预
|
37
|
+
await (scriptFunc as any)?.call(
|
38
|
+
null,
|
39
|
+
renderer,
|
40
|
+
renderer.doAction.bind(renderer),
|
41
|
+
event
|
42
|
+
);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
registerAction('custom', new CustomAction());
|
@@ -0,0 +1,28 @@
|
|
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 DialogAction
|
14
|
+
* @implements {Action}
|
15
|
+
*/
|
16
|
+
export class DialogAction implements Action {
|
17
|
+
async run(
|
18
|
+
action: ListenerAction,
|
19
|
+
renderer: ListenerContext,
|
20
|
+
event: RendererEvent<any>
|
21
|
+
) {
|
22
|
+
const store = renderer.props.store;
|
23
|
+
store.setCurrentAction(action);
|
24
|
+
store.openDialog(action.args);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
registerAction('dialog', new DialogAction());
|
@@ -0,0 +1,28 @@
|
|
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 DrawerAction
|
14
|
+
* @implements {Action}
|
15
|
+
*/
|
16
|
+
export class DrawerAction implements Action {
|
17
|
+
async run(
|
18
|
+
action: ListenerAction,
|
19
|
+
renderer: ListenerContext,
|
20
|
+
event: RendererEvent<any>
|
21
|
+
) {
|
22
|
+
const store = renderer.props.store;
|
23
|
+
store.setCurrentAction(action);
|
24
|
+
store.openDrawer(action.args);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
registerAction('drawer', new DrawerAction());
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {filter} from '../utils/tpl';
|
3
|
+
import pick from 'lodash/pick';
|
4
|
+
import mapValues from 'lodash/mapValues';
|
5
|
+
import qs from 'qs';
|
6
|
+
import {
|
7
|
+
Action,
|
8
|
+
ListenerAction,
|
9
|
+
ListenerContext,
|
10
|
+
registerAction
|
11
|
+
} from './Action';
|
12
|
+
|
13
|
+
/**
|
14
|
+
* 邮件动作
|
15
|
+
*
|
16
|
+
* @export
|
17
|
+
* @class EmailAction
|
18
|
+
* @implements {Action}
|
19
|
+
*/
|
20
|
+
export class EmailAction implements Action {
|
21
|
+
async run(
|
22
|
+
action: ListenerAction,
|
23
|
+
renderer: ListenerContext,
|
24
|
+
event: RendererEvent<any>
|
25
|
+
) {
|
26
|
+
const mailTo = filter(action.to, action.args);
|
27
|
+
const mailInfo = mapValues(
|
28
|
+
pick(action, 'to', 'cc', 'bcc', 'subject', 'body'),
|
29
|
+
val => filter(val, action.args)
|
30
|
+
);
|
31
|
+
const mailStr = qs.stringify(mailInfo);
|
32
|
+
const mailto = `mailto:${mailTo}?${mailStr}`;
|
33
|
+
|
34
|
+
window.open(mailto);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
registerAction('email', new EmailAction());
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {createObject} from '../utils/helper';
|
3
|
+
import {
|
4
|
+
Action,
|
5
|
+
ListenerContext,
|
6
|
+
LogicAction,
|
7
|
+
LoopStatus,
|
8
|
+
registerAction,
|
9
|
+
runAction,
|
10
|
+
runActions
|
11
|
+
} from './Action';
|
12
|
+
import {resolveVariable} from '../utils/tpl-builtin';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* 循环动作
|
16
|
+
*
|
17
|
+
* @export
|
18
|
+
* @class LoopAction
|
19
|
+
* @implements {Action}
|
20
|
+
*/
|
21
|
+
export class LoopAction implements Action {
|
22
|
+
async run(
|
23
|
+
action: LogicAction,
|
24
|
+
renderer: ListenerContext,
|
25
|
+
event: RendererEvent<any>,
|
26
|
+
mergeData: any
|
27
|
+
) {
|
28
|
+
if (typeof action.loopName !== 'string') {
|
29
|
+
console.warn('loopName 必须是字符串类型');
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
const loopData = resolveVariable(action.loopName, mergeData) || [];
|
34
|
+
|
35
|
+
// 必须是数组
|
36
|
+
if (!loopData) {
|
37
|
+
console.warn(`没有找到数据 ${action.loopName}`);
|
38
|
+
} else if (!Array.isArray(loopData)) {
|
39
|
+
console.warn(`${action.loopName} 数据不是数组`);
|
40
|
+
} else if (action.children?.length) {
|
41
|
+
// 暂存一下
|
42
|
+
const protoData = event.data;
|
43
|
+
|
44
|
+
for (const data of loopData) {
|
45
|
+
renderer.loopStatus = LoopStatus.NORMAL;
|
46
|
+
// 追加逻辑处理中的数据,事件数据优先,用完还要还原
|
47
|
+
event.setData(createObject(event.data, data));
|
48
|
+
|
49
|
+
for (const subAction of action.children) {
|
50
|
+
// @ts-ignore
|
51
|
+
if (renderer.loopStatus === LoopStatus.CONTINUE) {
|
52
|
+
continue;
|
53
|
+
}
|
54
|
+
await runActions(subAction, renderer, event);
|
55
|
+
|
56
|
+
// @ts-ignore
|
57
|
+
if (renderer.loopStatus === LoopStatus.BREAK || event.stoped) {
|
58
|
+
// 还原事件数据
|
59
|
+
event.setData(protoData);
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
if (event.stoped) {
|
65
|
+
// 还原事件数据
|
66
|
+
event.setData(protoData);
|
67
|
+
break;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
renderer.loopStatus = LoopStatus.NORMAL;
|
72
|
+
event.setData(protoData);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
registerAction('loop', new LoopAction());
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {filter} from '../utils/tpl';
|
3
|
+
import {
|
4
|
+
Action,
|
5
|
+
ListenerAction,
|
6
|
+
ListenerContext,
|
7
|
+
registerAction
|
8
|
+
} from './Action';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* 打开页面动作
|
12
|
+
*
|
13
|
+
* @export
|
14
|
+
* @class OpenPageAction
|
15
|
+
* @implements {Action}
|
16
|
+
*/
|
17
|
+
export class OpenPageAction implements Action {
|
18
|
+
async run(
|
19
|
+
action: ListenerAction,
|
20
|
+
renderer: ListenerContext,
|
21
|
+
event: RendererEvent<any>
|
22
|
+
) {
|
23
|
+
if (!renderer.props.env?.jumpTo) {
|
24
|
+
throw new Error('env.jumpTo is required!');
|
25
|
+
}
|
26
|
+
|
27
|
+
renderer.props.env.jumpTo(
|
28
|
+
filter(
|
29
|
+
(action.to || action.url || action.link) as string,
|
30
|
+
action.args,
|
31
|
+
'| raw'
|
32
|
+
),
|
33
|
+
action,
|
34
|
+
action.args
|
35
|
+
);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
registerAction('openpage', new OpenPageAction());
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {
|
3
|
+
Action,
|
4
|
+
ListenerContext,
|
5
|
+
LogicAction,
|
6
|
+
registerAction,
|
7
|
+
runActions
|
8
|
+
} from './Action';
|
9
|
+
|
10
|
+
export class ParallelAction implements Action {
|
11
|
+
async run(
|
12
|
+
action: LogicAction,
|
13
|
+
renderer: ListenerContext,
|
14
|
+
event: RendererEvent<any>
|
15
|
+
) {
|
16
|
+
if (action.children && action.children.length) {
|
17
|
+
const childActions = action.children.map((child: LogicAction) => {
|
18
|
+
// 并行动作互不干扰,但不管哪个存在干预都对后续动作生效
|
19
|
+
return runActions(child, renderer, event);
|
20
|
+
});
|
21
|
+
await Promise.all(childActions);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
registerAction('parallel', new ParallelAction());
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import {RendererEvent} from '../utils/renderer-event';
|
2
|
+
import {evalExpression} from '../utils/tpl';
|
3
|
+
import {
|
4
|
+
Action,
|
5
|
+
ListenerContext,
|
6
|
+
LogicAction,
|
7
|
+
registerAction,
|
8
|
+
runActions
|
9
|
+
} from './Action';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* 排他动作
|
13
|
+
*/
|
14
|
+
export class SwitchAction implements Action {
|
15
|
+
async run(
|
16
|
+
action: LogicAction,
|
17
|
+
renderer: ListenerContext,
|
18
|
+
event: RendererEvent<any>,
|
19
|
+
mergeData: any
|
20
|
+
) {
|
21
|
+
for (const branch of action.children || []) {
|
22
|
+
if (!branch.expression) {
|
23
|
+
continue;
|
24
|
+
}
|
25
|
+
|
26
|
+
if (evalExpression(branch.expression, mergeData)) {
|
27
|
+
await runActions(branch, renderer, event);
|
28
|
+
// 去掉runAllMatch,这里只做排他,多个可以直接通过execOn
|
29
|
+
break;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
registerAction('switch', new SwitchAction());
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* @file 导入所有动作
|
3
|
+
*/
|
4
|
+
|
5
|
+
import './LoopAction';
|
6
|
+
import './BreakAction';
|
7
|
+
import './ContinueAction';
|
8
|
+
import './SwitchAction';
|
9
|
+
import './ParallelAction';
|
10
|
+
import './CustomAction';
|
11
|
+
import './BroadcastAction';
|
12
|
+
import './CmptAction';
|
13
|
+
import './AjaxAction';
|
14
|
+
import './CopyAction';
|
15
|
+
import './DialogAction';
|
16
|
+
import './DrawerAction';
|
17
|
+
import './EmailAction';
|
18
|
+
import './OpenPageAction';
|
19
|
+
|
20
|
+
export * from './Action';
|
@@ -106,7 +106,8 @@ export class AssociatedSelection extends BaseSelection<
|
|
106
106
|
leftMode,
|
107
107
|
cellRender,
|
108
108
|
multiple,
|
109
|
-
onDeferLoad
|
109
|
+
onDeferLoad,
|
110
|
+
itemRender
|
110
111
|
} = this.props;
|
111
112
|
|
112
113
|
const selectdOption = BaseSelection.resolveSelected(
|
@@ -186,6 +187,7 @@ export class AssociatedSelection extends BaseSelection<
|
|
186
187
|
onChange={onChange}
|
187
188
|
option2value={option2value}
|
188
189
|
multiple={multiple}
|
190
|
+
itemRender={itemRender}
|
189
191
|
/>
|
190
192
|
) : rightMode === 'chained' ? (
|
191
193
|
<ChainedSelection
|
@@ -195,6 +197,7 @@ export class AssociatedSelection extends BaseSelection<
|
|
195
197
|
onChange={onChange}
|
196
198
|
option2value={option2value}
|
197
199
|
multiple={multiple}
|
200
|
+
itemRender={itemRender}
|
198
201
|
/>
|
199
202
|
) : (
|
200
203
|
<GroupedSelection
|
@@ -204,6 +207,7 @@ export class AssociatedSelection extends BaseSelection<
|
|
204
207
|
onChange={onChange}
|
205
208
|
option2value={option2value}
|
206
209
|
multiple={multiple}
|
210
|
+
itemRender={itemRender}
|
207
211
|
/>
|
208
212
|
)
|
209
213
|
) : (
|
@@ -0,0 +1,253 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Avatar 属性
|
6
|
+
*/
|
7
|
+
interface AvatarCmptProps extends ThemeProps {
|
8
|
+
style?: {
|
9
|
+
[prop: string]: any
|
10
|
+
};
|
11
|
+
className?: string;
|
12
|
+
classnames: ClassNamesFn;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* 图片地址
|
16
|
+
*/
|
17
|
+
src?: string | React.ReactNode;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* 图标
|
21
|
+
*/
|
22
|
+
icon?: string | React.ReactNode;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* 图片相对于容器的缩放方式
|
26
|
+
*/
|
27
|
+
fit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 形状
|
31
|
+
*/
|
32
|
+
shape?: 'circle' | 'square' | 'rounded';
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 大小
|
36
|
+
*/
|
37
|
+
size?: number | 'small' | 'default' | 'large';
|
38
|
+
|
39
|
+
/**
|
40
|
+
* 文本
|
41
|
+
*/
|
42
|
+
text?: string;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* 字符类型距离左右两侧边界单位像素
|
46
|
+
*/
|
47
|
+
gap?: number;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* 图片无法显示时的替换文字地址
|
51
|
+
*/
|
52
|
+
alt?: string;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* 图片是否允许拖动
|
56
|
+
*/
|
57
|
+
draggable?: boolean;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* 图片CORS属性
|
61
|
+
*/
|
62
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | '';
|
63
|
+
|
64
|
+
/**
|
65
|
+
* 图片加载失败的事件,返回 false 会关闭组件默认的
|
66
|
+
*/
|
67
|
+
onError?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => boolean;
|
68
|
+
|
69
|
+
/**
|
70
|
+
*
|
71
|
+
*/
|
72
|
+
children?: JSX.Element | ((props?: any) => JSX.Element)
|
73
|
+
}
|
74
|
+
|
75
|
+
const prefix = 'Avatar--';
|
76
|
+
const childPrefix = prefix + 'text';
|
77
|
+
|
78
|
+
export interface AvatarState {
|
79
|
+
scale: number;
|
80
|
+
hasImg: boolean;
|
81
|
+
}
|
82
|
+
|
83
|
+
export class Avatar extends React.Component<AvatarCmptProps, AvatarState> {
|
84
|
+
static defaultProps: Partial<AvatarCmptProps> = {
|
85
|
+
shape: 'circle',
|
86
|
+
size: 'default',
|
87
|
+
fit: 'cover',
|
88
|
+
gap: 4
|
89
|
+
};
|
90
|
+
|
91
|
+
state: AvatarState = {
|
92
|
+
scale: 1,
|
93
|
+
hasImg: true
|
94
|
+
};
|
95
|
+
|
96
|
+
avatarChildrenRef: React.RefObject<HTMLElement>;
|
97
|
+
avatarRef: React.RefObject<HTMLElement>;
|
98
|
+
|
99
|
+
constructor(props: AvatarCmptProps) {
|
100
|
+
super(props);
|
101
|
+
|
102
|
+
this.avatarChildrenRef = React.createRef();
|
103
|
+
this.avatarRef = React.createRef();
|
104
|
+
|
105
|
+
this.handleImageLoadError = this.handleImageLoadError.bind(this);
|
106
|
+
}
|
107
|
+
|
108
|
+
componentDidMount() {
|
109
|
+
this.setScaleByGap();
|
110
|
+
}
|
111
|
+
|
112
|
+
componentDidUpdate(prevProps: AvatarCmptProps, prevState: AvatarState) {
|
113
|
+
const {src, gap, text, children} = this.props;
|
114
|
+
const {hasImg} = this.state;
|
115
|
+
if (prevProps.src !== src) {
|
116
|
+
this.setState({
|
117
|
+
hasImg: !!src
|
118
|
+
});
|
119
|
+
}
|
120
|
+
if ((prevState.hasImg && !hasImg)
|
121
|
+
|| (prevProps.text !== text)
|
122
|
+
|| (prevProps.children !== children)
|
123
|
+
|| (prevProps.gap !== gap)) {
|
124
|
+
this.setScaleByGap();
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
handleImageLoadError(event: React.SyntheticEvent<HTMLImageElement, Event>) {
|
129
|
+
const {onError} = this.props;
|
130
|
+
this.setState({
|
131
|
+
hasImg: onError ? !onError(event) : false
|
132
|
+
});
|
133
|
+
}
|
134
|
+
|
135
|
+
setScaleByGap() {
|
136
|
+
const {gap = 4} = this.props;
|
137
|
+
if (!this.avatarChildrenRef.current || !this.avatarRef.current) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
const childrenWidth = this.avatarChildrenRef.current.offsetWidth;
|
141
|
+
const nodeWidth = this.avatarRef.current.offsetWidth;
|
142
|
+
if (childrenWidth && nodeWidth) {
|
143
|
+
if (gap * 2 < nodeWidth) {
|
144
|
+
const diff = nodeWidth - gap * 2;
|
145
|
+
this.setState({
|
146
|
+
scale: diff < childrenWidth ? diff / childrenWidth : 1
|
147
|
+
});
|
148
|
+
}
|
149
|
+
}
|
150
|
+
};
|
151
|
+
|
152
|
+
render() {
|
153
|
+
let {
|
154
|
+
style = {},
|
155
|
+
className,
|
156
|
+
shape,
|
157
|
+
size,
|
158
|
+
src,
|
159
|
+
icon,
|
160
|
+
alt,
|
161
|
+
draggable,
|
162
|
+
crossOrigin,
|
163
|
+
fit,
|
164
|
+
text,
|
165
|
+
children,
|
166
|
+
classnames: cx
|
167
|
+
} = this.props;
|
168
|
+
|
169
|
+
const {scale, hasImg} = this.state;
|
170
|
+
|
171
|
+
const isImgRender = React.isValidElement(src);
|
172
|
+
const isIconRender = React.isValidElement(icon);
|
173
|
+
|
174
|
+
let childrenRender;
|
175
|
+
|
176
|
+
let sizeStyle = {};
|
177
|
+
let sizeClass = '';
|
178
|
+
|
179
|
+
if (typeof size === 'number') {
|
180
|
+
sizeStyle = {
|
181
|
+
height: size,
|
182
|
+
width: size,
|
183
|
+
lineHeight: size + 'px'
|
184
|
+
};
|
185
|
+
}
|
186
|
+
else if (typeof size === 'string') {
|
187
|
+
sizeClass = size === 'large'
|
188
|
+
? `${prefix}lg`
|
189
|
+
: size === 'small' ? `${prefix}sm` : '';
|
190
|
+
}
|
191
|
+
|
192
|
+
const scaleX = `scale(${scale}) translateX(-50%)`;
|
193
|
+
const scaleStyle = {
|
194
|
+
msTransform: scaleX,
|
195
|
+
WebkitTransform: scaleX,
|
196
|
+
transform: scaleX
|
197
|
+
};
|
198
|
+
|
199
|
+
if (typeof src === 'string' && hasImg) {
|
200
|
+
const imgStyle = fit ? {objectFit: fit} : {};
|
201
|
+
childrenRender = (
|
202
|
+
<img
|
203
|
+
style={imgStyle}
|
204
|
+
src={src}
|
205
|
+
alt={alt}
|
206
|
+
draggable={draggable}
|
207
|
+
onError={this.handleImageLoadError}
|
208
|
+
crossOrigin={crossOrigin}
|
209
|
+
/>
|
210
|
+
);
|
211
|
+
}
|
212
|
+
else if (isImgRender) {
|
213
|
+
childrenRender = src;
|
214
|
+
}
|
215
|
+
else if (typeof text === 'string' || typeof text === 'number') {
|
216
|
+
childrenRender = (
|
217
|
+
<span
|
218
|
+
className={cx(childPrefix)}
|
219
|
+
ref={this.avatarChildrenRef}
|
220
|
+
style={scaleStyle}>
|
221
|
+
{text}
|
222
|
+
</span>
|
223
|
+
);
|
224
|
+
}
|
225
|
+
else if (typeof icon === 'string') {
|
226
|
+
childrenRender = (<i className={icon} />);
|
227
|
+
}
|
228
|
+
else if (isIconRender) {
|
229
|
+
childrenRender = icon;
|
230
|
+
}
|
231
|
+
else {
|
232
|
+
childrenRender = (
|
233
|
+
<span
|
234
|
+
className={cx(childPrefix)}
|
235
|
+
ref={this.avatarChildrenRef}
|
236
|
+
style={scaleStyle}>
|
237
|
+
{children}
|
238
|
+
</span>
|
239
|
+
);
|
240
|
+
}
|
241
|
+
|
242
|
+
return (
|
243
|
+
<span
|
244
|
+
className={cx(`Avatar`, className, prefix + shape, sizeClass)}
|
245
|
+
style={{...sizeStyle, ...style}}
|
246
|
+
ref={this.avatarRef}>
|
247
|
+
{childrenRender}
|
248
|
+
</span>
|
249
|
+
);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
export default themeable(Avatar);
|
@@ -120,7 +120,11 @@ export class BaiduMapPicker extends React.Component<
|
|
120
120
|
? new BMap.Point(value.lng, value.lat)
|
121
121
|
: new BMap.Point(116.404, 39.915);
|
122
122
|
if (this.props.coordinatesType == 'gcj02') {
|
123
|
-
point = await this.covertPoint(
|
123
|
+
point = await this.covertPoint(
|
124
|
+
point,
|
125
|
+
COORDINATES_GCJ02,
|
126
|
+
COORDINATES_BD09
|
127
|
+
);
|
124
128
|
map.centerAndZoom(point, 15);
|
125
129
|
} else {
|
126
130
|
map.centerAndZoom(point, 15);
|
@@ -269,27 +273,29 @@ export class BaiduMapPicker extends React.Component<
|
|
269
273
|
|
270
274
|
covertPoint(point: any, from: number, to: number) {
|
271
275
|
return new Promise((resolve, reject) => {
|
272
|
-
this.convertor.translate([point], from, to, (res:any)=> {
|
276
|
+
this.convertor.translate([point], from, to, (res: any) => {
|
273
277
|
if (res.status === 0 && res.points.length) {
|
274
278
|
resolve(new BMap.Point(res.points[0].lng, res.points[0].lat));
|
275
|
-
} else
|
279
|
+
} else {
|
276
280
|
reject();
|
277
281
|
}
|
278
|
-
})
|
279
|
-
})
|
282
|
+
});
|
283
|
+
});
|
280
284
|
}
|
281
285
|
|
282
286
|
triggerOnChange(loc: LocationItem) {
|
283
287
|
const point = new BMap.Point(loc.lng, loc.lat);
|
284
288
|
if (this.props.coordinatesType == 'gcj02') {
|
285
|
-
this.covertPoint(point, COORDINATES_BD09, COORDINATES_GCJ02).then(
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
289
|
+
this.covertPoint(point, COORDINATES_BD09, COORDINATES_GCJ02).then(
|
290
|
+
(convertedPoint: any) => {
|
291
|
+
this.props?.onChange({
|
292
|
+
address: loc.address.trim() || loc.title,
|
293
|
+
lat: convertedPoint.lat,
|
294
|
+
lng: convertedPoint.lng,
|
295
|
+
city: loc.city
|
296
|
+
});
|
297
|
+
}
|
298
|
+
);
|
293
299
|
} else {
|
294
300
|
this.props?.onChange({
|
295
301
|
address: loc.address.trim() || loc.title,
|
@@ -298,7 +304,6 @@ export class BaiduMapPicker extends React.Component<
|
|
298
304
|
city: loc.city
|
299
305
|
});
|
300
306
|
}
|
301
|
-
|
302
307
|
}
|
303
308
|
|
304
309
|
@autobind
|