amis 1.5.6-beta.5 → 1.6.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/lib/Schema.d.ts +3 -2
- package/lib/Schema.js.map +1 -1
- 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/CalendarMobile.d.ts +547 -0
- package/lib/components/CalendarMobile.js +432 -0
- package/lib/components/CalendarMobile.js.map +13 -0
- package/lib/components/Card.js +1 -1
- package/lib/components/Card.js.map +2 -2
- 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.js +1 -1
- package/lib/components/Collapse.js.map +2 -2
- 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 +15 -8
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +85 -84
- package/lib/components/DateRangePicker.js +18 -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/MonthRangePicker.d.ts +85 -84
- package/lib/components/MonthRangePicker.js +16 -6
- 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/Rating.d.ts +203 -73
- package/lib/components/Rating.js +147 -31
- package/lib/components/Rating.js.map +2 -2
- 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 +237 -237
- package/lib/components/Select.js +9 -6
- 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 +516 -0
- package/lib/components/TimelineItem.js +41 -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/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/icons.js +4 -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/factory.js +5 -0
- package/lib/factory.js.map +2 -2
- package/lib/icons/star.js +12 -0
- package/lib/icons/tree-down.js +7 -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 +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/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.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.js +2 -1
- package/lib/renderers/Form/DiffEditor.js.map +2 -2
- 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/InputRating.d.ts +37 -0
- package/lib/renderers/Form/InputRating.js +6 -2
- package/lib/renderers/Form/InputRating.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/Select.d.ts +2 -0
- package/lib/renderers/Form/Select.js +7 -4
- 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 +2 -1
- 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/Json.js +7 -0
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Nav.js +4 -1
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Remark.d.ts +4 -0
- 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 +6 -6
- 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 +1018 -67
- package/lib/themes/ang.css +1018 -67
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +1053 -67
- package/lib/themes/antd.css +1053 -67
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1058 -78
- package/lib/themes/cxd.css +1058 -78
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +1019 -67
- package/lib/themes/dark.css +1019 -67
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +1058 -78
- 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/helper.d.ts +1 -6
- package/lib/utils/helper.js +6 -17
- package/lib/utils/helper.js.map +2 -2
- package/package.json +12 -6
- package/schema.json +3696 -971
- package/scss/_properties.scss +21 -7
- package/scss/components/_avatar.scss +27 -9
- package/scss/components/_calendar.scss +287 -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/_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 +42 -15
- 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 +1 -1
- package/scss/components/form/_date.scss +46 -1
- package/scss/components/form/_form.scss +168 -0
- package/scss/components/form/_nested-select.scss +3 -0
- package/scss/components/form/_rating.scss +60 -21
- 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 +42 -0
- package/scss/themes/_common.scss +3 -0
- package/scss/themes/_cxd-variables.scss +51 -2
- package/scss/themes/_dark-variables.scss +1 -0
- package/scss/themes/cxd.scss +0 -12
- package/sdk/ang-ie11.css +1278 -141
- package/sdk/ang.css +1296 -153
- package/sdk/antd-ie11.css +1278 -141
- package/sdk/antd.css +1331 -153
- 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 +1258 -132
- package/sdk/cxd.css +1338 -168
- package/sdk/dark-ie11.css +1278 -141
- package/sdk/dark.css +1297 -153
- package/sdk/exceljs.js +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 +1258 -132
- package/sdk/sdk.css +1338 -168
- package/sdk/sdk.js +1242 -1218
- 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 +3 -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 +563 -0
- package/src/components/Card.tsx +2 -2
- package/src/components/Cascader.tsx +564 -0
- package/src/components/ChainedSelection.tsx +16 -3
- package/src/components/CityArea.tsx +315 -0
- package/src/components/Collapse.tsx +1 -1
- package/src/components/ColorPicker.tsx +41 -40
- package/src/components/DatePicker.tsx +54 -38
- package/src/components/DateRangePicker.tsx +83 -29
- package/src/components/GroupedSelection.tsx +14 -2
- package/src/components/MonthRangePicker.tsx +76 -30
- 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/Rating.tsx +235 -47
- package/src/components/ResultBox.tsx +14 -2
- package/src/components/ResultList.tsx +36 -6
- package/src/components/Select.tsx +20 -23
- 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 +31 -0
- package/src/components/TimelineItem.tsx +107 -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/icons.tsx +4 -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/factory.tsx +6 -0
- package/src/icons/star.svg +12 -0
- package/src/icons/tree-down.svg +5 -0
- package/src/index.tsx +1 -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/Avatar.tsx +83 -74
- package/src/renderers/CRUD.tsx +1 -3
- package/src/renderers/Card.tsx +10 -6
- package/src/renderers/Custom.tsx +6 -3
- 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/InputRating.tsx +66 -3
- 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/Select.tsx +15 -3
- 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 +2 -1
- package/src/renderers/IFrame.tsx +0 -2
- package/src/renderers/Json.tsx +5 -0
- 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 +2 -2
- package/src/store/table.ts +2 -1
- package/src/utils/RootClose.ts +5 -1
- package/src/utils/helper.ts +6 -16
@@ -7,6 +7,7 @@ var Item_1 = require("./Item");
|
|
7
7
|
var theme_1 = require("../../theme");
|
8
8
|
var Spinner_1 = (0, tslib_1.__importDefault)(require("../../components/Spinner"));
|
9
9
|
var Select_1 = (0, tslib_1.__importDefault)(require("../../components/Select"));
|
10
|
+
var CityArea_1 = (0, tslib_1.__importDefault)(require("../../components/CityArea"));
|
10
11
|
var helper_1 = require("../../utils/helper");
|
11
12
|
var Options_1 = require("./Options");
|
12
13
|
var locale_1 = require("../../locale");
|
@@ -265,8 +266,9 @@ var LocationControl = /** @class */ (function (_super) {
|
|
265
266
|
return _super !== null && _super.apply(this, arguments) || this;
|
266
267
|
}
|
267
268
|
LocationControl.prototype.render = function () {
|
268
|
-
var _a = this.props, value = _a.value, onChange = _a.onChange, allowCity = _a.allowCity, allowDistrict = _a.allowDistrict, extractValue = _a.extractValue, joinValues = _a.joinValues, allowStreet = _a.allowStreet, disabled = _a.disabled, searchable = _a.searchable;
|
269
|
-
|
269
|
+
var _a = this.props, value = _a.value, onChange = _a.onChange, allowCity = _a.allowCity, allowDistrict = _a.allowDistrict, extractValue = _a.extractValue, joinValues = _a.joinValues, allowStreet = _a.allowStreet, disabled = _a.disabled, searchable = _a.searchable, env = _a.env, useMobileUI = _a.useMobileUI;
|
270
|
+
var mobileUI = useMobileUI && (0, helper_1.isMobile)();
|
271
|
+
return mobileUI ? (react_1.default.createElement(CityArea_1.default, { value: value, popOverContainer: env && env.getModalContainer ? env.getModalContainer : undefined, onChange: onChange, allowCity: allowCity, allowDistrict: allowDistrict, extractValue: extractValue, joinValues: joinValues, allowStreet: allowStreet, disabled: disabled, useMobileUI: useMobileUI })) : (react_1.default.createElement(ThemedCity, { searchable: searchable, value: value, onChange: onChange, allowCity: allowCity, allowDistrict: allowDistrict, extractValue: extractValue, joinValues: joinValues, allowStreet: allowStreet, disabled: disabled }));
|
270
272
|
};
|
271
273
|
return LocationControl;
|
272
274
|
}(react_1.default.Component));
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/renderers/Form/InputCity.tsx"
|
7
7
|
],
|
8
8
|
"names": [],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,EAC5B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CAAC,CAAC,CACF,8BAAC,UAAU,IACT,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;IACJ,CAAC;IACH,sBAAC;AAAD,CAAC,AA7CD,CAAqC,eAAK,CAAC,SAAS,GA6CnD;AA7CY,0CAAe;AAmD5B;IAA6C,wDAAe;IAA5D;;IAA8D,CAAC;IAAlD,uBAAuB;QAJnC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,KAAK;SACnB,CAAC;OACW,uBAAuB,CAA2B;IAAD,8BAAC;CAAA,AAA/D,CAA6C,eAAe,GAAG;AAAlD,0DAAuB",
|
10
10
|
"sourcesContent": [
|
11
|
-
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport {ClassNamesFn, themeable, ThemeProps} from '../../theme';\nimport Spinner from '../../components/Spinner';\nimport Select from '../../components/Select';\nimport {autobind} from '../../utils/helper';\nimport {Option} from './Options';\nimport {localeable, LocaleProps} from '../../locale';\n\n/**\n * City 城市选择框。\n * 文档:https://baidu.gitee.io/amis/docs/components/form/city\n */\nexport interface InputCityControlSchema extends FormBaseControl {\n /**\n * 指定为城市选择框。\n */\n type: 'input-city';\n\n /**\n * 开启后只会存城市的 code 信息\n */\n extractValue?: boolean;\n\n /**\n * 是否将各个信息拼接成字符串。\n */\n joinValues?: boolean;\n\n /**\n * 拼接的符号是啥?\n */\n delimiter?: string;\n\n /**\n * 允许选择城市?\n */\n allowCity?: boolean;\n\n /**\n * 允许选择地区?\n */\n allowDistrict?: boolean;\n\n /**\n * 允许选择街道?\n */\n allowStreet?: boolean;\n\n /**\n * 是否显示搜索框\n */\n searchable?: boolean;\n}\n\nexport interface CityPickerProps\n extends Omit<InputCityControlSchema, 'type' | 'className'>,\n LocaleProps,\n ThemeProps {\n value: any;\n onChange: (value: any) => void;\n\n extractValue: boolean;\n delimiter: string;\n allowCity: boolean;\n allowDistrict: boolean;\n allowStreet: boolean;\n}\n\nexport interface CityPickerState {\n code: number;\n province: string;\n provinceCode: number;\n city: string;\n cityCode: number;\n district: string;\n districtCode: number;\n street: string;\n\n db?: {\n province: Array<string>;\n city: {\n [propName: number]: Array<number>;\n };\n district: {\n [propName: number]:\n | {\n [propName: number]: Array<number>;\n }\n | Array<number>;\n };\n [propName: string]: any;\n };\n}\n\nexport class CityPicker extends React.Component<\n CityPickerProps,\n CityPickerState\n> {\n static defaultProps = {\n joinValues: true,\n extractValue: true,\n delimiter: ',',\n allowCity: true,\n allowDistrict: true,\n allowStreet: false\n };\n\n state: CityPickerState = {\n code: 0,\n province: '',\n provinceCode: 0,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: ''\n };\n\n componentDidMount() {\n this.loadDb(() => this.syncIn());\n }\n\n componentDidUpdate(prevProps: CityPickerProps) {\n const props = this.props;\n\n if (props.value !== prevProps.value) {\n this.loadDb(() => this.syncIn(props));\n }\n }\n\n loadDb(callback?: () => void) {\n if (this.state.db) {\n callback?.();\n return;\n }\n\n import('./CityDB').then(db => {\n this.setState(\n {\n db: {\n ...db.default,\n province: db.province as any,\n city: db.city,\n district: db.district\n }\n },\n callback\n );\n });\n\n // require.ensure(['./CityDB'], (db: any) =>\n // this.setState(\n // {\n // db: {\n // ...db.default,\n // province: db.province,\n // city: db.city,\n // district: db.district\n // }\n // },\n // callback\n // )\n // );\n }\n\n @autobind\n handleProvinceChange(option: Option) {\n this.setState(\n {\n province: option.label as string,\n provinceCode: option.value as number,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: '',\n code: option.value\n },\n this.syncOut\n );\n }\n\n @autobind\n handleCityChange(option: Option) {\n if (option.value % 100) {\n return this.handleDistrictChange(option, {\n cityCode: option.value as number\n });\n }\n\n this.setState(\n {\n city: option.label as string,\n cityCode: option.value as number,\n district: '',\n districtCode: 0,\n street: '',\n code: option.value\n },\n this.syncOut\n );\n }\n\n @autobind\n handleDistrictChange(\n option: Option,\n otherStates: Partial<CityPickerState> = {}\n ) {\n this.setState(\n {\n ...(otherStates as any),\n district: option.label as string,\n districtCode: option.value as number,\n street: '',\n code: option.value as number\n },\n this.syncOut\n );\n }\n\n @autobind\n handleStreetChange(e: React.ChangeEvent<HTMLInputElement>) {\n this.setState({\n street: e.currentTarget.value\n });\n }\n\n @autobind\n handleStreetEnd() {\n this.syncOut();\n }\n\n @autobind\n syncIn(props = this.props) {\n const db = this.state.db!;\n const {value, delimiter} = props;\n\n if (!db) {\n return;\n }\n\n const state = {\n code: 0,\n province: '',\n provinceCode: 0,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: ''\n };\n\n let code =\n (value && value.code) ||\n (typeof value === 'number' && value) ||\n (typeof value === 'string' && /(\\d{6})/.test(value) && RegExp.$1);\n\n if (code && db[code]) {\n code = parseInt(code, 10);\n state.code = code;\n\n const provinceCode = code - (code % 10000);\n if (db[provinceCode]) {\n state.provinceCode = provinceCode;\n state.province = db[provinceCode];\n }\n\n const cityCode = code - (code % 100);\n if (db[cityCode]) {\n state.cityCode = cityCode;\n state.city = db[cityCode];\n } else if (~db.city[provinceCode]?.indexOf(code)) {\n state.cityCode = code;\n state.city = db[code];\n }\n\n if (code % 100) {\n state.district = db[code];\n state.districtCode = code;\n }\n } else if (value) {\n // todo 模糊查找\n }\n\n if (value && value.street) {\n state.street = value.street;\n } else if (typeof value === 'string' && ~value.indexOf(delimiter)) {\n state.street = value.slice(value.indexOf(delimiter) + delimiter.length);\n }\n\n this.setState(state);\n }\n\n @autobind\n syncOut() {\n const {onChange, allowStreet, joinValues, extractValue, delimiter} =\n this.props;\n\n const {code, province, city, district, street} = this.state;\n\n if (typeof extractValue === 'undefined' ? joinValues : extractValue) {\n code\n ? onChange(\n allowStreet && street\n ? [code, street].join(delimiter)\n : String(code)\n )\n : onChange('');\n } else {\n onChange({\n code,\n province,\n city,\n district,\n street\n });\n }\n }\n\n render() {\n const {\n classnames: cx,\n className,\n disabled,\n allowCity,\n allowDistrict,\n allowStreet,\n searchable,\n translate: __\n } = this.props;\n\n const {provinceCode, cityCode, districtCode, street, db} = this.state;\n\n return db ? (\n <div className={cx('CityPicker', className)}>\n <Select\n searchable={searchable}\n disabled={disabled}\n options={db.province.map(item => ({\n label: db[item],\n value: item\n }))}\n value={provinceCode}\n onChange={this.handleProvinceChange}\n />\n\n {provinceCode &&\n allowDistrict &&\n Array.isArray(db.district[provinceCode]) ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={(db.district[provinceCode] as Array<number>).map(item => ({\n label: db[item],\n value: item\n }))}\n value={districtCode}\n onChange={this.handleDistrictChange}\n />\n ) : allowCity &&\n db.city[provinceCode] &&\n db.city[provinceCode].length ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={db.city[provinceCode].map(item => ({\n label: db[item],\n value: item\n }))}\n value={cityCode}\n onChange={this.handleCityChange}\n />\n ) : null}\n\n {cityCode &&\n allowDistrict &&\n (db.district[provinceCode]?.[cityCode] as any)?.length ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={(db.district[provinceCode][cityCode] as Array<number>).map(\n item => ({\n label: db[item],\n value: item\n })\n )}\n value={districtCode}\n onChange={this.handleDistrictChange}\n />\n ) : null}\n\n {allowStreet && provinceCode ? (\n <input\n className={cx('CityPicker-input')}\n value={street}\n onChange={this.handleStreetChange}\n onBlur={this.handleStreetEnd}\n placeholder={__('City.street')}\n disabled={disabled}\n />\n ) : null}\n </div>\n ) : (\n <Spinner show size=\"sm\" />\n );\n }\n}\n\nconst ThemedCity = themeable(localeable(CityPicker));\nexport default ThemedCity;\n\nexport interface LocationControlProps extends FormControlProps {\n allowCity?: boolean;\n allowDistrict?: boolean;\n extractValue?: boolean;\n joinValues?: boolean;\n allowStreet?: boolean;\n}\nexport class LocationControl extends React.Component<LocationControlProps> {\n render() {\n const {\n value,\n onChange,\n allowCity,\n allowDistrict,\n extractValue,\n joinValues,\n allowStreet,\n disabled,\n searchable\n } = this.props;\n return (\n <ThemedCity\n searchable={searchable}\n value={value}\n onChange={onChange}\n allowCity={allowCity}\n allowDistrict={allowDistrict}\n extractValue={extractValue}\n joinValues={joinValues}\n allowStreet={allowStreet}\n disabled={disabled}\n />\n );\n }\n}\n\n@FormItem({\n type: 'input-city',\n sizeMutable: false\n})\nexport class CheckboxControlRenderer extends LocationControl {}\n"
|
11
|
+
"import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport {ClassNamesFn, themeable, ThemeProps} from '../../theme';\nimport Spinner from '../../components/Spinner';\nimport Select from '../../components/Select';\nimport CityArea from '../../components/CityArea';\nimport {autobind, isMobile} from '../../utils/helper';\nimport {Option} from './Options';\nimport {localeable, LocaleProps} from '../../locale';\n\n/**\n * City 城市选择框。\n * 文档:https://baidu.gitee.io/amis/docs/components/form/city\n */\nexport interface InputCityControlSchema extends FormBaseControl {\n /**\n * 指定为城市选择框。\n */\n type: 'input-city';\n\n /**\n * 开启后只会存城市的 code 信息\n */\n extractValue?: boolean;\n\n /**\n * 是否将各个信息拼接成字符串。\n */\n joinValues?: boolean;\n\n /**\n * 拼接的符号是啥?\n */\n delimiter?: string;\n\n /**\n * 允许选择城市?\n */\n allowCity?: boolean;\n\n /**\n * 允许选择地区?\n */\n allowDistrict?: boolean;\n\n /**\n * 允许选择街道?\n */\n allowStreet?: boolean;\n\n /**\n * 是否显示搜索框\n */\n searchable?: boolean;\n}\n\nexport interface CityPickerProps\n extends Omit<InputCityControlSchema, 'type' | 'className'>,\n LocaleProps,\n ThemeProps {\n value: any;\n onChange: (value: any) => void;\n\n extractValue: boolean;\n delimiter: string;\n allowCity: boolean;\n allowDistrict: boolean;\n allowStreet: boolean;\n useMobileUI?: boolean;\n}\n\nexport interface CityPickerState {\n code: number;\n province: string;\n provinceCode: number;\n city: string;\n cityCode: number;\n district: string;\n districtCode: number;\n street: string;\n\n db?: {\n province: Array<string>;\n city: {\n [propName: number]: Array<number>;\n };\n district: {\n [propName: number]:\n | {\n [propName: number]: Array<number>;\n }\n | Array<number>;\n };\n [propName: string]: any;\n };\n}\n\nexport class CityPicker extends React.Component<\n CityPickerProps,\n CityPickerState\n> {\n static defaultProps = {\n joinValues: true,\n extractValue: true,\n delimiter: ',',\n allowCity: true,\n allowDistrict: true,\n allowStreet: false\n };\n\n state: CityPickerState = {\n code: 0,\n province: '',\n provinceCode: 0,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: ''\n };\n\n componentDidMount() {\n this.loadDb(() => this.syncIn());\n }\n\n componentDidUpdate(prevProps: CityPickerProps) {\n const props = this.props;\n\n if (props.value !== prevProps.value) {\n this.loadDb(() => this.syncIn(props));\n }\n }\n\n loadDb(callback?: () => void) {\n if (this.state.db) {\n callback?.();\n return;\n }\n\n import('./CityDB').then(db => {\n this.setState(\n {\n db: {\n ...db.default,\n province: db.province as any,\n city: db.city,\n district: db.district\n }\n },\n callback\n );\n });\n\n // require.ensure(['./CityDB'], (db: any) =>\n // this.setState(\n // {\n // db: {\n // ...db.default,\n // province: db.province,\n // city: db.city,\n // district: db.district\n // }\n // },\n // callback\n // )\n // );\n }\n\n @autobind\n handleProvinceChange(option: Option) {\n this.setState(\n {\n province: option.label as string,\n provinceCode: option.value as number,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: '',\n code: option.value\n },\n this.syncOut\n );\n }\n\n @autobind\n handleCityChange(option: Option) {\n if (option.value % 100) {\n return this.handleDistrictChange(option, {\n cityCode: option.value as number\n });\n }\n\n this.setState(\n {\n city: option.label as string,\n cityCode: option.value as number,\n district: '',\n districtCode: 0,\n street: '',\n code: option.value\n },\n this.syncOut\n );\n }\n\n @autobind\n handleDistrictChange(\n option: Option,\n otherStates: Partial<CityPickerState> = {}\n ) {\n this.setState(\n {\n ...(otherStates as any),\n district: option.label as string,\n districtCode: option.value as number,\n street: '',\n code: option.value as number\n },\n this.syncOut\n );\n }\n\n @autobind\n handleStreetChange(e: React.ChangeEvent<HTMLInputElement>) {\n this.setState({\n street: e.currentTarget.value\n });\n }\n\n @autobind\n handleStreetEnd() {\n this.syncOut();\n }\n\n @autobind\n syncIn(props = this.props) {\n const db = this.state.db!;\n const {value, delimiter} = props;\n\n if (!db) {\n return;\n }\n\n const state = {\n code: 0,\n province: '',\n provinceCode: 0,\n city: '',\n cityCode: 0,\n district: '',\n districtCode: 0,\n street: ''\n };\n\n let code =\n (value && value.code) ||\n (typeof value === 'number' && value) ||\n (typeof value === 'string' && /(\\d{6})/.test(value) && RegExp.$1);\n\n if (code && db[code]) {\n code = parseInt(code, 10);\n state.code = code;\n\n const provinceCode = code - (code % 10000);\n if (db[provinceCode]) {\n state.provinceCode = provinceCode;\n state.province = db[provinceCode];\n }\n\n const cityCode = code - (code % 100);\n if (db[cityCode]) {\n state.cityCode = cityCode;\n state.city = db[cityCode];\n } else if (~db.city[provinceCode]?.indexOf(code)) {\n state.cityCode = code;\n state.city = db[code];\n }\n\n if (code % 100) {\n state.district = db[code];\n state.districtCode = code;\n }\n } else if (value) {\n // todo 模糊查找\n }\n\n if (value && value.street) {\n state.street = value.street;\n } else if (typeof value === 'string' && ~value.indexOf(delimiter)) {\n state.street = value.slice(value.indexOf(delimiter) + delimiter.length);\n }\n\n this.setState(state);\n }\n\n @autobind\n syncOut() {\n const {onChange, allowStreet, joinValues, extractValue, delimiter} =\n this.props;\n\n const {code, province, city, district, street} = this.state;\n\n if (typeof extractValue === 'undefined' ? joinValues : extractValue) {\n code\n ? onChange(\n allowStreet && street\n ? [code, street].join(delimiter)\n : String(code)\n )\n : onChange('');\n } else {\n onChange({\n code,\n province,\n city,\n district,\n street\n });\n }\n }\n\n render() {\n const {\n classnames: cx,\n className,\n disabled,\n allowCity,\n allowDistrict,\n allowStreet,\n searchable,\n translate: __\n } = this.props;\n\n const {provinceCode, cityCode, districtCode, street, db} = this.state;\n\n return db ? (\n <div className={cx('CityPicker', className)}>\n <Select\n searchable={searchable}\n disabled={disabled}\n options={db.province.map(item => ({\n label: db[item],\n value: item\n }))}\n value={provinceCode}\n onChange={this.handleProvinceChange}\n />\n\n {provinceCode &&\n allowDistrict &&\n Array.isArray(db.district[provinceCode]) ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={(db.district[provinceCode] as Array<number>).map(item => ({\n label: db[item],\n value: item\n }))}\n value={districtCode}\n onChange={this.handleDistrictChange}\n />\n ) : allowCity &&\n db.city[provinceCode] &&\n db.city[provinceCode].length ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={db.city[provinceCode].map(item => ({\n label: db[item],\n value: item\n }))}\n value={cityCode}\n onChange={this.handleCityChange}\n />\n ) : null}\n\n {cityCode &&\n allowDistrict &&\n (db.district[provinceCode]?.[cityCode] as any)?.length ? (\n <Select\n searchable={searchable}\n disabled={disabled}\n options={(db.district[provinceCode][cityCode] as Array<number>).map(\n item => ({\n label: db[item],\n value: item\n })\n )}\n value={districtCode}\n onChange={this.handleDistrictChange}\n />\n ) : null}\n\n {allowStreet && provinceCode ? (\n <input\n className={cx('CityPicker-input')}\n value={street}\n onChange={this.handleStreetChange}\n onBlur={this.handleStreetEnd}\n placeholder={__('City.street')}\n disabled={disabled}\n />\n ) : null}\n </div>\n ) : (\n <Spinner show size=\"sm\" />\n );\n }\n}\n\nconst ThemedCity = themeable(localeable(CityPicker));\nexport default ThemedCity;\n\nexport interface LocationControlProps extends FormControlProps {\n allowCity?: boolean;\n allowDistrict?: boolean;\n extractValue?: boolean;\n joinValues?: boolean;\n allowStreet?: boolean;\n}\nexport class LocationControl extends React.Component<LocationControlProps> {\n render() {\n const {\n value,\n onChange,\n allowCity,\n allowDistrict,\n extractValue,\n joinValues,\n allowStreet,\n disabled,\n searchable,\n env,\n useMobileUI\n } = this.props;\n const mobileUI = useMobileUI && isMobile();\n return mobileUI ? (\n <CityArea\n value={value}\n popOverContainer={\n env && env.getModalContainer ? env.getModalContainer : undefined\n }\n onChange={onChange}\n allowCity={allowCity}\n allowDistrict={allowDistrict}\n extractValue={extractValue}\n joinValues={joinValues}\n allowStreet={allowStreet}\n disabled={disabled}\n useMobileUI={useMobileUI}\n />\n ) : (\n <ThemedCity\n searchable={searchable}\n value={value}\n onChange={onChange}\n allowCity={allowCity}\n allowDistrict={allowDistrict}\n extractValue={extractValue}\n joinValues={joinValues}\n allowStreet={allowStreet}\n disabled={disabled}\n />\n );\n }\n}\n\n@FormItem({\n type: 'input-city',\n sizeMutable: false\n})\nexport class CheckboxControlRenderer extends LocationControl {}\n"
|
12
12
|
]
|
13
13
|
}
|