amis-rev-ui 6.13.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/LICENSE +201 -0
- package/esm/HTMLFilterContext.d.ts +3 -0
- package/esm/HTMLFilterContext.js +10 -0
- package/esm/components/404.js +35 -0
- package/esm/components/Alert.js +266 -0
- package/esm/components/Alert2.js +58 -0
- package/esm/components/AlphabetIndexer.d.ts +11 -0
- package/esm/components/AlphabetIndexer.js +48 -0
- package/esm/components/AnchorNav.js +153 -0
- package/esm/components/AnchorNavSection.d.ts +2 -0
- package/esm/components/AnchorNavSection.js +7 -0
- package/esm/components/ArrayInput.js +146 -0
- package/esm/components/AsideNav.js +133 -0
- package/esm/components/AssociatedSelection.js +107 -0
- package/esm/components/AutoFoldedList.js +124 -0
- package/esm/components/AutoSizer.d.ts +2 -0
- package/esm/components/AutoSizer.js +8 -0
- package/esm/components/Avatar.js +126 -0
- package/esm/components/Badge.d.ts +20 -0
- package/esm/components/Badge.js +154 -0
- package/esm/components/BaiduMapPicker.js +366 -0
- package/esm/components/BarCode.js +42 -0
- package/esm/components/Breadcrumb.js +160 -0
- package/esm/components/Button.js +64 -0
- package/esm/components/CalendarMobile.js +538 -0
- package/esm/components/Card.js +88 -0
- package/esm/components/Cascader.js +515 -0
- package/esm/components/ChainedDropdownSelection.js +104 -0
- package/esm/components/ChainedSelection.js +184 -0
- package/esm/components/Checkbox.js +87 -0
- package/esm/components/CityArea.js +190 -0
- package/esm/components/CityDB.d.ts +13 -0
- package/esm/components/CityDB.js +3942 -0
- package/esm/components/CodeMirror.d.ts +29 -0
- package/esm/components/CodeMirror.js +140 -0
- package/esm/components/Collapse.js +184 -0
- package/esm/components/CollapseGroup.js +117 -0
- package/esm/components/ColorPicker.js +259 -0
- package/esm/components/Combo.js +212 -0
- package/esm/components/ConditionBuilder.d.ts +2 -0
- package/esm/components/ConditionBuilder.js +7 -0
- package/esm/components/ConfirmBox.js +128 -0
- package/esm/components/ContextMenu.js +310 -0
- package/esm/components/DatePicker.js +716 -0
- package/esm/components/DateRangePicker.js +1385 -0
- package/esm/components/DiffEditor.d.ts +21 -0
- package/esm/components/DiffEditor.js +119 -0
- package/esm/components/DndContainer.js +25 -0
- package/esm/components/Drawer.js +272 -0
- package/esm/components/DropDownSelection.js +77 -0
- package/esm/components/DropdownContextMenus.js +93 -0
- package/esm/components/Editor.js +238 -0
- package/esm/components/Form.d.ts +31 -0
- package/esm/components/Form.js +84 -0
- package/esm/components/FormField.js +78 -0
- package/esm/components/FormulaPicker.d.ts +2 -0
- package/esm/components/FormulaPicker.js +7 -0
- package/esm/components/GaodeMapPicker.js +204 -0
- package/esm/components/GridNav.d.ts +53 -0
- package/esm/components/GridNav.js +125 -0
- package/esm/components/GridNavItem.d.ts +2 -0
- package/esm/components/GridNavItem.js +7 -0
- package/esm/components/GroupedSelection.js +138 -0
- package/esm/components/HeadCellDropDown.d.ts +2 -0
- package/esm/components/HeadCellDropDown.js +7 -0
- package/esm/components/HorizontalScroll.d.ts +74 -0
- package/esm/components/HorizontalScroll.js +271 -0
- package/esm/components/Html.js +55 -0
- package/esm/components/Icon.d.ts +2 -0
- package/esm/components/Icon.js +7 -0
- package/esm/components/ImageGallery.js +396 -0
- package/esm/components/Input.d.ts +18 -0
- package/esm/components/Input.js +75 -0
- package/esm/components/InputBox.js +99 -0
- package/esm/components/InputBoxWithSuggestion.js +70 -0
- package/esm/components/InputJSONSchema.d.ts +2 -0
- package/esm/components/InputJSONSchema.js +7 -0
- package/esm/components/InputTable.js +176 -0
- package/esm/components/JSONSchemaEditor.d.ts +2 -0
- package/esm/components/JSONSchemaEditor.js +7 -0
- package/esm/components/Layout.js +60 -0
- package/esm/components/Link.js +44 -0
- package/esm/components/ListGroup.js +31 -0
- package/esm/components/ListMenu.js +62 -0
- package/esm/components/LocationPicker.js +208 -0
- package/esm/components/Markdown.d.ts +25 -0
- package/esm/components/Markdown.js +70 -0
- package/esm/components/Menu.d.ts +2 -0
- package/esm/components/Menu.js +7 -0
- package/esm/components/MixedInput.js +88 -0
- package/esm/components/MobileDevTool.d.ts +12 -0
- package/esm/components/MobileDevTool.js +312 -0
- package/esm/components/Modal.js +261 -0
- package/esm/components/ModalManager.d.ts +16 -0
- package/esm/components/ModalManager.js +42 -0
- package/esm/components/MultilineText.js +90 -0
- package/esm/components/NumberInput.js +274 -0
- package/esm/components/OverflowTpl.js +100 -0
- package/esm/components/Pagination.js +377 -0
- package/esm/components/PdfViewer.js +83 -0
- package/esm/components/Picker.js +73 -0
- package/esm/components/PickerColumn.js +276 -0
- package/esm/components/PickerContainer.js +157 -0
- package/esm/components/PopOverContainer.d.ts +59 -0
- package/esm/components/PopOverContainer.js +148 -0
- package/esm/components/PopUp.js +85 -0
- package/esm/components/Progress.js +136 -0
- package/esm/components/PullRefresh.js +172 -0
- package/esm/components/Radios.js +129 -0
- package/esm/components/Range.js +516 -0
- package/esm/components/Rating.js +341 -0
- package/esm/components/ResultBox.js +195 -0
- package/esm/components/ResultList.js +253 -0
- package/esm/components/ResultTableList.js +152 -0
- package/esm/components/ResultTreeList.js +241 -0
- package/esm/components/RichText.d.ts +48 -0
- package/esm/components/RichText.js +271 -0
- package/esm/components/SearchBox.js +298 -0
- package/esm/components/Select.js +814 -0
- package/esm/components/SelectMobile.d.ts +38 -0
- package/esm/components/SelectMobile.js +369 -0
- package/esm/components/Selection.js +166 -0
- package/esm/components/Shape.js +429 -0
- package/esm/components/Signature.js +294 -0
- package/esm/components/Slider.js +140 -0
- package/esm/components/SparkLine.js +62 -0
- package/esm/components/Spinner.js +202 -0
- package/esm/components/Steps.js +76 -0
- package/esm/components/Switch.js +73 -0
- package/esm/components/Tab.d.ts +2 -0
- package/esm/components/Tab.js +7 -0
- package/esm/components/Table.d.ts +2 -0
- package/esm/components/Table.js +7 -0
- package/esm/components/TableSelection.js +169 -0
- package/esm/components/Tabs.js +607 -0
- package/esm/components/TabsTransfer.js +221 -0
- package/esm/components/TabsTransferPicker.js +81 -0
- package/esm/components/Tag.js +137 -0
- package/esm/components/Textarea.js +146 -0
- package/esm/components/Timeline.js +60 -0
- package/esm/components/TimelineItem.js +101 -0
- package/esm/components/Tinymce.d.ts +66 -0
- package/esm/components/Tinymce.js +634 -0
- package/esm/components/TitleBar.js +48 -0
- package/esm/components/Toast.js +247 -0
- package/esm/components/Tooltip.js +36 -0
- package/esm/components/TooltipWrapper.js +180 -0
- package/esm/components/Transfer.js +485 -0
- package/esm/components/TransferDropDown.js +98 -0
- package/esm/components/TransferPicker.js +98 -0
- package/esm/components/TransferSearch.js +100 -0
- package/esm/components/Tree.js +1256 -0
- package/esm/components/TreeSelection.js +201 -0
- package/esm/components/UserSelect.js +674 -0
- package/esm/components/UserTabSelect.js +227 -0
- package/esm/components/VerificationCode.js +172 -0
- package/esm/components/VirtualList.d.ts +2 -0
- package/esm/components/VirtualList.js +7 -0
- package/esm/components/WithRemoteConfig.d.ts +70 -0
- package/esm/components/WithRemoteConfig.js +301 -0
- package/esm/components/WithStore.d.ts +13 -0
- package/esm/components/WithStore.js +48 -0
- package/esm/components/calendar/Calendar.d.ts +83 -0
- package/esm/components/calendar/Calendar.js +529 -0
- package/esm/components/calendar/CalendarContainer.d.ts +10 -0
- package/esm/components/calendar/CalendarContainer.js +27 -0
- package/esm/components/calendar/DaysView.js +528 -0
- package/esm/components/calendar/MonthsView.js +175 -0
- package/esm/components/calendar/QuartersView.js +125 -0
- package/esm/components/calendar/TimeView.js +559 -0
- package/esm/components/calendar/YearsView.js +122 -0
- package/esm/components/condition-builder/Expression.js +121 -0
- package/esm/components/condition-builder/Field.js +32 -0
- package/esm/components/condition-builder/Func.js +75 -0
- package/esm/components/condition-builder/Group.js +196 -0
- package/esm/components/condition-builder/GroupOrItem.js +107 -0
- package/esm/components/condition-builder/InputSwitch.js +28 -0
- package/esm/components/condition-builder/Item.js +233 -0
- package/esm/components/condition-builder/Value.js +115 -0
- package/esm/components/condition-builder/config.d.ts +36 -0
- package/esm/components/condition-builder/config.js +120 -0
- package/esm/components/condition-builder/index.js +242 -0
- package/esm/components/condition-builder/types.d.ts +116 -0
- package/esm/components/formula/CodeEditor.js +99 -0
- package/esm/components/formula/Editor.js +446 -0
- package/esm/components/formula/FuncList.js +64 -0
- package/esm/components/formula/Input.js +141 -0
- package/esm/components/formula/Picker.js +454 -0
- package/esm/components/formula/VariableList.js +185 -0
- package/esm/components/formula/plugin.d.ts +51 -0
- package/esm/components/formula/plugin.js +445 -0
- package/esm/components/icons.d.ts +61 -0
- package/esm/components/icons.js +458 -0
- package/esm/components/index.d.ts +138 -0
- package/esm/components/json-schema/Array.d.ts +3 -0
- package/esm/components/json-schema/Array.js +129 -0
- package/esm/components/json-schema/Item.d.ts +5 -0
- package/esm/components/json-schema/Item.js +63 -0
- package/esm/components/json-schema/Object.d.ts +5 -0
- package/esm/components/json-schema/Object.js +272 -0
- package/esm/components/json-schema/index.js +29 -0
- package/esm/components/menu/MenuContext.d.ts +82 -0
- package/esm/components/menu/MenuContext.js +25 -0
- package/esm/components/menu/MenuItem.js +112 -0
- package/esm/components/menu/PanelMenu.js +68 -0
- package/esm/components/menu/SubMenu.js +137 -0
- package/esm/components/menu/index.js +368 -0
- package/esm/components/schema-editor/Array.d.ts +11 -0
- package/esm/components/schema-editor/Array.js +84 -0
- package/esm/components/schema-editor/Common.d.ts +61 -0
- package/esm/components/schema-editor/Common.js +162 -0
- package/esm/components/schema-editor/Item.d.ts +8 -0
- package/esm/components/schema-editor/Item.js +24 -0
- package/esm/components/schema-editor/Object.d.ts +51 -0
- package/esm/components/schema-editor/Object.js +294 -0
- package/esm/components/schema-editor/SchemaVariableList.js +74 -0
- package/esm/components/schema-editor/SchemaVariableListPicker.js +34 -0
- package/esm/components/schema-editor/index.js +122 -0
- package/esm/components/table/Cell.d.ts +36 -0
- package/esm/components/table/Cell.js +43 -0
- package/esm/components/table/ColGroup.d.ts +24 -0
- package/esm/components/table/ColGroup.js +77 -0
- package/esm/components/table/Head.d.ts +45 -0
- package/esm/components/table/Head.js +150 -0
- package/esm/components/table/HeadCellDropDown.js +54 -0
- package/esm/components/table/HeadCellFilter.js +130 -0
- package/esm/components/table/HeadCellSelect.js +51 -0
- package/esm/components/table/HeadCellSort.js +88 -0
- package/esm/components/table/ItemActionsWrapper.d.ts +10 -0
- package/esm/components/table/ItemActionsWrapper.js +29 -0
- package/esm/components/table/Row.d.ts +56 -0
- package/esm/components/table/Row.js +224 -0
- package/esm/components/table/SummaryRow.d.ts +28 -0
- package/esm/components/table/SummaryRow.js +73 -0
- package/esm/components/table/index.js +1095 -0
- package/esm/components/table/util.d.ts +25 -0
- package/esm/components/table/util.js +279 -0
- package/esm/components/virtual-list/AutoSizer.d.ts +19 -0
- package/esm/components/virtual-list/AutoSizer.js +48 -0
- package/esm/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/esm/components/virtual-list/SizeAndPositionManager.js +216 -0
- package/esm/components/virtual-list/constants.d.ts +34 -0
- package/esm/components/virtual-list/constants.js +45 -0
- package/esm/components/virtual-list/index.d.ts +98 -0
- package/esm/components/virtual-list/index.js +288 -0
- package/esm/components/withBadge.d.ts +2 -0
- package/esm/components/withBadge.js +7 -0
- package/esm/hooks/index.d.ts +8 -0
- package/esm/hooks/use-click-away.d.ts +12 -0
- package/esm/hooks/use-click-away.js +55 -0
- package/esm/hooks/use-on-screen.d.ts +2 -0
- package/esm/hooks/use-on-screen.js +28 -0
- package/esm/hooks/use-set-state.d.ts +2 -0
- package/esm/hooks/use-set-state.js +19 -0
- package/esm/hooks/use-sub-form.d.ts +4 -0
- package/esm/hooks/use-sub-form.js +39 -0
- package/esm/hooks/use-touch.d.ts +16 -0
- package/esm/hooks/use-touch.js +77 -0
- package/esm/hooks/use-update-effect.d.ts +3 -0
- package/esm/hooks/use-update-effect.js +21 -0
- package/esm/hooks/use-validation-resolver.d.ts +7 -0
- package/esm/hooks/use-validation-resolver.js +115 -0
- package/esm/icons/alert-danger.svg.js +22 -0
- package/esm/icons/alert-info.svg.js +22 -0
- package/esm/icons/alert-success.svg.js +22 -0
- package/esm/icons/alert-warning.svg.js +22 -0
- package/esm/icons/arrow-double-left.svg.js +24 -0
- package/esm/icons/arrow-double-right.svg.js +24 -0
- package/esm/icons/back.svg.js +21 -0
- package/esm/icons/calendar.svg.js +31 -0
- package/esm/icons/caret.svg.js +21 -0
- package/esm/icons/check.svg.js +21 -0
- package/esm/icons/clock.svg.js +29 -0
- package/esm/icons/close-small.svg.js +24 -0
- package/esm/icons/close.svg.js +21 -0
- package/esm/icons/cloud-upload.svg.js +22 -0
- package/esm/icons/column-filter.svg.js +22 -0
- package/esm/icons/columns.svg.js +21 -0
- package/esm/icons/compress-alt.svg.js +21 -0
- package/esm/icons/copy.svg.js +26 -0
- package/esm/icons/date.svg.js +26 -0
- package/esm/icons/department.svg.js +52 -0
- package/esm/icons/desk-empty.svg.js +73 -0
- package/esm/icons/dot.svg.js +36 -0
- package/esm/icons/down-arrow-bold.svg.js +22 -0
- package/esm/icons/down.svg.js +23 -0
- package/esm/icons/download.svg.js +24 -0
- package/esm/icons/drag-bar.svg.js +53 -0
- package/esm/icons/drag.svg.js +22 -0
- package/esm/icons/edit.svg.js +21 -0
- package/esm/icons/ellipsis-v.svg.js +21 -0
- package/esm/icons/enter.svg.js +20 -0
- package/esm/icons/exchange.svg.js +21 -0
- package/esm/icons/expand-alt.svg.js +21 -0
- package/esm/icons/fail.svg.js +31 -0
- package/esm/icons/file.svg.js +22 -0
- package/esm/icons/filter.svg.js +21 -0
- package/esm/icons/folder.svg.js +24 -0
- package/esm/icons/fullscreen.svg.js +21 -0
- package/esm/icons/function.svg.js +21 -0
- package/esm/icons/home.svg.js +21 -0
- package/esm/icons/if.svg.js +21 -0
- package/esm/icons/image.svg.js +20 -0
- package/esm/icons/info-circle.svg.js +21 -0
- package/esm/icons/info.svg.js +27 -0
- package/esm/icons/input-clear.svg.js +20 -0
- package/esm/icons/invisible.svg.js +22 -0
- package/esm/icons/left-arrow.svg.js +23 -0
- package/esm/icons/loading-outline.svg.js +21 -0
- package/esm/icons/location.svg.js +20 -0
- package/esm/icons/menu.svg.js +20 -0
- package/esm/icons/minus.svg.js +21 -0
- package/esm/icons/move.svg.js +22 -0
- package/esm/icons/mute.svg.js +21 -0
- package/esm/icons/new-edit.svg.js +22 -0
- package/esm/icons/pause.svg.js +21 -0
- package/esm/icons/pencil.svg.js +21 -0
- package/esm/icons/play.svg.js +20 -0
- package/esm/icons/plus-cicle.svg.js +20 -0
- package/esm/icons/plus-fine.svg.js +21 -0
- package/esm/icons/plus.svg.js +21 -0
- package/esm/icons/post.svg.js +48 -0
- package/esm/icons/question-mark.svg.js +26 -0
- package/esm/icons/question.svg.js +21 -0
- package/esm/icons/question2.svg.js +34 -0
- package/esm/icons/redo.svg.js +21 -0
- package/esm/icons/refresh.svg.js +21 -0
- package/esm/icons/reload.svg.js +21 -0
- package/esm/icons/remove.svg.js +21 -0
- package/esm/icons/retry.svg.js +24 -0
- package/esm/icons/right-arrow-bold.svg.js +21 -0
- package/esm/icons/right-arrow.svg.js +23 -0
- package/esm/icons/right-double-arrow.svg.js +22 -0
- package/esm/icons/role.svg.js +43 -0
- package/esm/icons/rotate-left.svg.js +22 -0
- package/esm/icons/rotate-right.svg.js +22 -0
- package/esm/icons/rotate-screen.svg.js +21 -0
- package/esm/icons/scale-origin.svg.js +24 -0
- package/esm/icons/schedule.svg.js +24 -0
- package/esm/icons/search.svg.js +21 -0
- package/esm/icons/setting.svg.js +21 -0
- package/esm/icons/slider-handle-icon.svg.js +22 -0
- package/esm/icons/sort-asc.svg.js +21 -0
- package/esm/icons/sort-default.svg.js +21 -0
- package/esm/icons/sort-desc.svg.js +21 -0
- package/esm/icons/star.svg.js +21 -0
- package/esm/icons/status-close.svg.js +23 -0
- package/esm/icons/steps-finsh.svg.js +22 -0
- package/esm/icons/sub-plus.svg.js +20 -0
- package/esm/icons/success.svg.js +29 -0
- package/esm/icons/transparent.svg.js +38 -0
- package/esm/icons/trash.svg.js +22 -0
- package/esm/icons/tree-down.svg.js +21 -0
- package/esm/icons/undo-normal.svg.js +25 -0
- package/esm/icons/undo.svg.js +21 -0
- package/esm/icons/unfullscreen.svg.js +21 -0
- package/esm/icons/upload.svg.js +21 -0
- package/esm/icons/user-remove.svg.js +33 -0
- package/esm/icons/view.svg.js +22 -0
- package/esm/icons/volume.svg.js +24 -0
- package/esm/icons/warning-mark.svg.js +22 -0
- package/esm/icons/warning.svg.js +21 -0
- package/esm/icons/window-restore.svg.js +21 -0
- package/esm/icons/zoom-in.svg.js +21 -0
- package/esm/icons/zoom-out.svg.js +21 -0
- package/esm/index.d.ts +16 -0
- package/esm/index.js +157 -0
- package/esm/locale/de-DE.d.ts +1 -0
- package/esm/locale/de-DE.js +423 -0
- package/esm/locale/en-US.d.ts +1 -0
- package/esm/locale/en-US.js +429 -0
- package/esm/locale/zh-CN.d.ts +1 -0
- package/esm/locale/zh-CN.js +438 -0
- package/esm/themes/ang.d.ts +3 -0
- package/esm/themes/ang.js +15 -0
- package/esm/themes/antd.d.ts +1 -0
- package/esm/themes/antd.js +42 -0
- package/esm/themes/cxd.d.ts +3 -0
- package/esm/themes/cxd.js +455 -0
- package/esm/themes/dark.d.ts +3 -0
- package/esm/themes/dark.js +23 -0
- package/esm/themes/default.d.ts +4 -0
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/smoothSignature.d.ts +86 -0
- package/esm/utils/vectorComputed.d.ts +20 -0
- package/esm/utils/vectorComputed.js +75 -0
- package/esm/withRemoteConfig.d.ts +2 -0
- package/esm/withRemoteConfig.js +7 -0
- package/esm/withStore.d.ts +2 -0
- package/esm/withStore.js +7 -0
- package/lib/HTMLFilterContext.d.ts +3 -0
- package/lib/components/AlphabetIndexer.d.ts +11 -0
- package/lib/components/AnchorNavSection.d.ts +2 -0
- package/lib/components/AutoSizer.d.ts +2 -0
- package/lib/components/Badge.d.ts +20 -0
- package/lib/components/BarCode.js +44 -0
- package/lib/components/CityDB.d.ts +13 -0
- package/lib/components/CityDB.js +3945 -0
- package/lib/components/CodeMirror.d.ts +29 -0
- package/lib/components/ColorPicker.js +267 -0
- package/lib/components/ConditionBuilder.d.ts +2 -0
- package/lib/components/DiffEditor.d.ts +21 -0
- package/lib/components/Form.d.ts +31 -0
- package/lib/components/FormulaPicker.d.ts +2 -0
- package/lib/components/GridNav.d.ts +53 -0
- package/lib/components/GridNavItem.d.ts +2 -0
- package/lib/components/HeadCellDropDown.d.ts +2 -0
- package/lib/components/HorizontalScroll.d.ts +74 -0
- package/lib/components/Icon.d.ts +2 -0
- package/lib/components/Input.d.ts +18 -0
- package/lib/components/InputJSONSchema.d.ts +2 -0
- package/lib/components/JSONSchemaEditor.d.ts +2 -0
- package/lib/components/Markdown.d.ts +25 -0
- package/lib/components/Markdown.js +76 -0
- package/lib/components/Menu.d.ts +2 -0
- package/lib/components/MobileDevTool.d.ts +12 -0
- package/lib/components/ModalManager.d.ts +16 -0
- package/lib/components/PdfViewer.js +83 -0
- package/lib/components/PopOverContainer.d.ts +59 -0
- package/lib/components/RichText.d.ts +48 -0
- package/lib/components/RichText.js +275 -0
- package/lib/components/SelectMobile.d.ts +38 -0
- package/lib/components/Tab.d.ts +2 -0
- package/lib/components/Table.d.ts +2 -0
- package/lib/components/Tinymce.d.ts +66 -0
- package/lib/components/Tinymce.js +641 -0
- package/lib/components/VirtualList.d.ts +2 -0
- package/lib/components/WithRemoteConfig.d.ts +70 -0
- package/lib/components/WithStore.d.ts +13 -0
- package/lib/components/calendar/Calendar.d.ts +83 -0
- package/lib/components/calendar/CalendarContainer.d.ts +10 -0
- package/lib/components/condition-builder/config.d.ts +36 -0
- package/lib/components/condition-builder/types.d.ts +116 -0
- package/lib/components/formula/plugin.d.ts +51 -0
- package/lib/components/icons.d.ts +61 -0
- package/lib/components/index.d.ts +138 -0
- package/lib/components/json-schema/Array.d.ts +3 -0
- package/lib/components/json-schema/Item.d.ts +5 -0
- package/lib/components/json-schema/Object.d.ts +5 -0
- package/lib/components/menu/MenuContext.d.ts +82 -0
- package/lib/components/schema-editor/Array.d.ts +11 -0
- package/lib/components/schema-editor/Common.d.ts +61 -0
- package/lib/components/schema-editor/Item.d.ts +8 -0
- package/lib/components/schema-editor/Object.d.ts +51 -0
- package/lib/components/table/Cell.d.ts +36 -0
- package/lib/components/table/ColGroup.d.ts +24 -0
- package/lib/components/table/Head.d.ts +45 -0
- package/lib/components/table/ItemActionsWrapper.d.ts +10 -0
- package/lib/components/table/Row.d.ts +56 -0
- package/lib/components/table/SummaryRow.d.ts +28 -0
- package/lib/components/table/util.d.ts +25 -0
- package/lib/components/virtual-list/AutoSizer.d.ts +19 -0
- package/lib/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/lib/components/virtual-list/constants.d.ts +34 -0
- package/lib/components/virtual-list/index.d.ts +98 -0
- package/lib/components/withBadge.d.ts +2 -0
- package/lib/helper.css +47762 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/use-click-away.d.ts +12 -0
- package/lib/hooks/use-on-screen.d.ts +2 -0
- package/lib/hooks/use-set-state.d.ts +2 -0
- package/lib/hooks/use-sub-form.d.ts +4 -0
- package/lib/hooks/use-touch.d.ts +16 -0
- package/lib/hooks/use-update-effect.d.ts +3 -0
- package/lib/hooks/use-validation-resolver.d.ts +7 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +28 -0
- package/lib/locale/de-DE.d.ts +1 -0
- package/lib/locale/en-US.d.ts +1 -0
- package/lib/locale/zh-CN.d.ts +1 -0
- package/lib/scss/helper.scss.js +12 -0
- package/lib/scss/themes/ang.scss.js +12 -0
- package/lib/scss/themes/antd.scss.js +12 -0
- package/lib/scss/themes/cxd.scss.js +12 -0
- package/lib/scss/themes/dark.scss.js +12 -0
- package/lib/scss/themes/default.scss.js +12 -0
- package/lib/themes/ang.css +45895 -0
- package/lib/themes/ang.d.ts +3 -0
- package/lib/themes/antd.css +45882 -0
- package/lib/themes/antd.d.ts +1 -0
- package/lib/themes/cxd.css +45871 -0
- package/lib/themes/cxd.d.ts +3 -0
- package/lib/themes/dark.css +45902 -0
- package/lib/themes/dark.d.ts +3 -0
- package/lib/themes/default.css +45871 -0
- package/lib/themes/default.d.ts +4 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/smoothSignature.d.ts +86 -0
- package/lib/utils/vectorComputed.d.ts +20 -0
- package/lib/withRemoteConfig.d.ts +2 -0
- package/lib/withStore.d.ts +2 -0
- package/package.json +158 -0
- package/scss/README.md +9 -0
- package/scss/_components.scss +4346 -0
- package/scss/_functions.scss +137 -0
- package/scss/_mixins.scss +805 -0
- package/scss/_properties.scss +898 -0
- package/scss/_thirds.scss +12 -0
- package/scss/_utilities.scss +1757 -0
- package/scss/_variables.scss +439 -0
- package/scss/base/_animate.scss +84 -0
- package/scss/base/_common.scss +19 -0
- package/scss/base/_normalize.scss +376 -0
- package/scss/base/_reset.scss +18 -0
- package/scss/base/_typography.scss +79 -0
- package/scss/components/_alert.scss +123 -0
- package/scss/components/_anchor-nav.scss +158 -0
- package/scss/components/_app.scss +46 -0
- package/scss/components/_array-input.scss +107 -0
- package/scss/components/_audio.scss +146 -0
- package/scss/components/_auto-folder.scss +40 -0
- package/scss/components/_avatar.scss +55 -0
- package/scss/components/_badge.scss +145 -0
- package/scss/components/_barcode.scss +6 -0
- package/scss/components/_breadcrumb.scss +110 -0
- package/scss/components/_button-group.scss +165 -0
- package/scss/components/_button.scss +871 -0
- package/scss/components/_calendar.scss +442 -0
- package/scss/components/_card.scss +389 -0
- package/scss/components/_card2.scss +28 -0
- package/scss/components/_cards.scss +221 -0
- package/scss/components/_carousel.scss +292 -0
- package/scss/components/_cascader.scss +157 -0
- package/scss/components/_chart.scss +22 -0
- package/scss/components/_city-area.scss +37 -0
- package/scss/components/_code.scss +10 -0
- package/scss/components/_collapse-group.scss +83 -0
- package/scss/components/_collapse.scss +245 -0
- package/scss/components/_color.scss +17 -0
- package/scss/components/_column-toggler.scss +261 -0
- package/scss/components/_condition-builder.scss +521 -0
- package/scss/components/_context-menu.scss +204 -0
- package/scss/components/_copyable.scss +10 -0
- package/scss/components/_crud.scss +195 -0
- package/scss/components/_crud2.scss +345 -0
- package/scss/components/_debug.scss +259 -0
- package/scss/components/_divider.scss +81 -0
- package/scss/components/_drawer.scss +393 -0
- package/scss/components/_dropdown-context-menus.scss +27 -0
- package/scss/components/_dropdown.scss +159 -0
- package/scss/components/_each.scss +7 -0
- package/scss/components/_formula.scss +723 -0
- package/scss/components/_grid-nav.scss +128 -0
- package/scss/components/_horizontal-scroll.scss +51 -0
- package/scss/components/_icon.scss +4 -0
- package/scss/components/_image-gallery.scss +331 -0
- package/scss/components/_images.scss +650 -0
- package/scss/components/_input-box.scss +111 -0
- package/scss/components/_json-schema-editor.scss +149 -0
- package/scss/components/_json-schema.scss +166 -0
- package/scss/components/_json.scss +7 -0
- package/scss/components/_link.scss +22 -0
- package/scss/components/_list-menu.scss +114 -0
- package/scss/components/_list.scss +313 -0
- package/scss/components/_log.scss +169 -0
- package/scss/components/_mapping.scss +6 -0
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_menu.scss +795 -0
- package/scss/components/_mobile-dev-tool.scss +175 -0
- package/scss/components/_modal.scss +282 -0
- package/scss/components/_multiline-text.scss +20 -0
- package/scss/components/_nav.scss +45 -0
- package/scss/components/_overflow-tpl.scss +5 -0
- package/scss/components/_page.scss +198 -0
- package/scss/components/_pagination.scss +403 -0
- package/scss/components/_panel.scss +263 -0
- package/scss/components/_pdf_viewer.scss +47 -0
- package/scss/components/_picker-columns.scss +140 -0
- package/scss/components/_popover.scss +54 -0
- package/scss/components/_popoverable.scss +100 -0
- package/scss/components/_popup.scss +171 -0
- package/scss/components/_portlet.scss +51 -0
- package/scss/components/_print.scss +13 -0
- package/scss/components/_progress.scss +165 -0
- package/scss/components/_property.scss +47 -0
- package/scss/components/_pull-refresh.scss +30 -0
- package/scss/components/_quick-edit.scss +53 -0
- package/scss/components/_remark.scss +58 -0
- package/scss/components/_result-box.scss +380 -0
- package/scss/components/_search-box.scss +267 -0
- package/scss/components/_service.scss +3 -0
- package/scss/components/_shape.scss +19 -0
- package/scss/components/_signature.scss +98 -0
- package/scss/components/_slider.scss +27 -0
- package/scss/components/_sparkline.scss +18 -0
- package/scss/components/_spinner.scss +214 -0
- package/scss/components/_status.scss +118 -0
- package/scss/components/_steps.scss +481 -0
- package/scss/components/_table.scss +1234 -0
- package/scss/components/_table2.scss +1066 -0
- package/scss/components/_tabs.scss +1410 -0
- package/scss/components/_tag.scss +191 -0
- package/scss/components/_timeline.scss +572 -0
- package/scss/components/_toast.scss +342 -0
- package/scss/components/_tooltip.scss +340 -0
- package/scss/components/_tpl.scss +51 -0
- package/scss/components/_verificationCode.scss +33 -0
- package/scss/components/_video.scss +38 -0
- package/scss/components/_wizard.scss +287 -0
- package/scss/components/_wrapper.scss +26 -0
- package/scss/components/form/_chained-select.scss +10 -0
- package/scss/components/form/_checks.scss +433 -0
- package/scss/components/form/_city.scss +33 -0
- package/scss/components/form/_color.scss +148 -0
- package/scss/components/form/_combo.scss +360 -0
- package/scss/components/form/_date-range.scss +332 -0
- package/scss/components/form/_date.scss +807 -0
- package/scss/components/form/_editor.scss +139 -0
- package/scss/components/form/_excel.scss +150 -0
- package/scss/components/form/_fieldset.scss +202 -0
- package/scss/components/form/_file.scss +308 -0
- package/scss/components/form/_form.scss +936 -0
- package/scss/components/form/_group.scss +116 -0
- package/scss/components/form/_icon-picker.scss +113 -0
- package/scss/components/form/_icon-select.scss +245 -0
- package/scss/components/form/_image.scss +359 -0
- package/scss/components/form/_input-group.scss +213 -0
- package/scss/components/form/_input-table.scss +17 -0
- package/scss/components/form/_list.scss +225 -0
- package/scss/components/form/_location.scss +210 -0
- package/scss/components/form/_matrix.scss +7 -0
- package/scss/components/form/_nested-select.scss +149 -0
- package/scss/components/form/_number.scss +633 -0
- package/scss/components/form/_picker.scss +237 -0
- package/scss/components/form/_qr-code.scss +4 -0
- package/scss/components/form/_range.scss +438 -0
- package/scss/components/form/_rating.scss +94 -0
- package/scss/components/form/_repeat.scss +40 -0
- package/scss/components/form/_result-list.scss +98 -0
- package/scss/components/form/_rich-text.scss +163 -0
- package/scss/components/form/_select.scss +712 -0
- package/scss/components/form/_selection.scss +485 -0
- package/scss/components/form/_sub-form.scss +118 -0
- package/scss/components/form/_switch.scss +228 -0
- package/scss/components/form/_tag.scss +146 -0
- package/scss/components/form/_text.scss +508 -0
- package/scss/components/form/_textarea.scss +78 -0
- package/scss/components/form/_tinymce.scss +6 -0
- package/scss/components/form/_transfer.scss +624 -0
- package/scss/components/form/_tree-select.scss +47 -0
- package/scss/components/form/_tree.scss +458 -0
- package/scss/components/form/_user-select.scss +643 -0
- package/scss/components/react-datetime.scss +267 -0
- package/scss/helper/background/_background-color.md +131 -0
- package/scss/helper/background/_background-color.scss +214 -0
- package/scss/helper/border/_border-color.md +109 -0
- package/scss/helper/border/_border-color.scss +178 -0
- package/scss/helper/border/_border-radius.md +86 -0
- package/scss/helper/border/_border-radius.scss +152 -0
- package/scss/helper/border/_border-style.md +11 -0
- package/scss/helper/border/_border-style.scss +40 -0
- package/scss/helper/border/_border-width.md +31 -0
- package/scss/helper/border/_border-width.scss +72 -0
- package/scss/helper/box-alignment/_align-content.md +12 -0
- package/scss/helper/box-alignment/_align-content.scss +44 -0
- package/scss/helper/box-alignment/_align-items.md +11 -0
- package/scss/helper/box-alignment/_align-items.scss +41 -0
- package/scss/helper/box-alignment/_align-self.md +11 -0
- package/scss/helper/box-alignment/_align-self.scss +40 -0
- package/scss/helper/box-alignment/_justify-content.md +12 -0
- package/scss/helper/box-alignment/_justify-content.scss +44 -0
- package/scss/helper/box-alignment/_justify-items.md +11 -0
- package/scss/helper/box-alignment/_justify-items.scss +40 -0
- package/scss/helper/box-alignment/_justify-self.md +11 -0
- package/scss/helper/box-alignment/_justify-self.scss +40 -0
- package/scss/helper/box-alignment/_place-content.md +13 -0
- package/scss/helper/box-alignment/_place-content.scss +48 -0
- package/scss/helper/box-alignment/_place-items.md +11 -0
- package/scss/helper/box-alignment/_place-items.scss +40 -0
- package/scss/helper/box-alignment/_place-self.md +11 -0
- package/scss/helper/box-alignment/_place-self.scss +40 -0
- package/scss/helper/effect/_box-shadow.md +16 -0
- package/scss/helper/effect/_box-shadow.scss +74 -0
- package/scss/helper/effect/_opacity.md +21 -0
- package/scss/helper/effect/_opacity.scss +66 -0
- package/scss/helper/flex/_direction.md +10 -0
- package/scss/helper/flex/_direction.scss +41 -0
- package/scss/helper/flex/_flex.md +10 -0
- package/scss/helper/flex/_flex.scss +38 -0
- package/scss/helper/flex/_grow.md +8 -0
- package/scss/helper/flex/_grow.scss +28 -0
- package/scss/helper/flex/_order.md +20 -0
- package/scss/helper/flex/_order.scss +56 -0
- package/scss/helper/flex/_shrink.md +8 -0
- package/scss/helper/flex/_shrink.scss +27 -0
- package/scss/helper/flex/_wrap.md +9 -0
- package/scss/helper/flex/_wrap.scss +36 -0
- package/scss/helper/grid/_auto-columns.md +10 -0
- package/scss/helper/grid/_auto-columns.scss +38 -0
- package/scss/helper/grid/_auto-flow.md +10 -0
- package/scss/helper/grid/_auto-flow.scss +38 -0
- package/scss/helper/grid/_auto-rows.md +10 -0
- package/scss/helper/grid/_auto-rows.scss +38 -0
- package/scss/helper/grid/_column-start-end.md +48 -0
- package/scss/helper/grid/_column-start-end.scss +201 -0
- package/scss/helper/grid/_columns.md +19 -0
- package/scss/helper/grid/_columns.scss +74 -0
- package/scss/helper/grid/_gap.md +117 -0
- package/scss/helper/grid/_gap.scss +154 -0
- package/scss/helper/grid/_row-start-end.md +48 -0
- package/scss/helper/grid/_row-start-end.scss +201 -0
- package/scss/helper/grid/_rows.md +13 -0
- package/scss/helper/grid/_rows.scss +50 -0
- package/scss/helper/layout/_box-sizing.md +35 -0
- package/scss/helper/layout/_box-sizing.scss +51 -0
- package/scss/helper/layout/_clear.md +27 -0
- package/scss/helper/layout/_clear.scss +56 -0
- package/scss/helper/layout/_display.md +41 -0
- package/scss/helper/layout/_display.scss +82 -0
- package/scss/helper/layout/_float.md +47 -0
- package/scss/helper/layout/_float.scss +71 -0
- package/scss/helper/layout/_overflow.md +34 -0
- package/scss/helper/layout/_overflow.scss +85 -0
- package/scss/helper/layout/_position.md +27 -0
- package/scss/helper/layout/_position.scss +55 -0
- package/scss/helper/layout/_top-right-bottom-left.md +150 -0
- package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
- package/scss/helper/layout/_visibility.md +21 -0
- package/scss/helper/layout/_visibility.scss +42 -0
- package/scss/helper/layout/_z-index.md +37 -0
- package/scss/helper/layout/_z-index.scss +67 -0
- package/scss/helper/sizing/_height.md +103 -0
- package/scss/helper/sizing/_height.scss +161 -0
- package/scss/helper/sizing/_width.md +109 -0
- package/scss/helper/sizing/_width.scss +174 -0
- package/scss/helper/spacing/_margin.md +527 -0
- package/scss/helper/spacing/_margin.scss +821 -0
- package/scss/helper/spacing/_padding.md +265 -0
- package/scss/helper/spacing/_padding.scss +394 -0
- package/scss/helper/spacing/_space-between.md +155 -0
- package/scss/helper/spacing/_space-between.scss +224 -0
- package/scss/helper/typography/_font-family.md +9 -0
- package/scss/helper/typography/_font-family.scss +28 -0
- package/scss/helper/typography/_font-size.md +19 -0
- package/scss/helper/typography/_font-size.scss +40 -0
- package/scss/helper/typography/_font-style.md +8 -0
- package/scss/helper/typography/_font-style.scss +31 -0
- package/scss/helper/typography/_font-weight.md +15 -0
- package/scss/helper/typography/_font-weight.scss +49 -0
- package/scss/helper/typography/_letter-spacing.md +12 -0
- package/scss/helper/typography/_letter-spacing.scss +43 -0
- package/scss/helper/typography/_line-height.md +20 -0
- package/scss/helper/typography/_line-height.scss +59 -0
- package/scss/helper/typography/_list-style-type.md +11 -0
- package/scss/helper/typography/_list-style-type.scss +43 -0
- package/scss/helper/typography/_text-align.md +10 -0
- package/scss/helper/typography/_text-align.scss +34 -0
- package/scss/helper/typography/_text-color.md +110 -0
- package/scss/helper/typography/_text-color.scss +184 -0
- package/scss/helper/typography/_text-decoration.md +9 -0
- package/scss/helper/typography/_text-decoration.scss +34 -0
- package/scss/helper/typography/_text-overflow.md +9 -0
- package/scss/helper/typography/_text-overflow.scss +40 -0
- package/scss/helper/typography/_text-transform.md +10 -0
- package/scss/helper/typography/_text-transform.scss +40 -0
- package/scss/helper/typography/_vertical-align.md +12 -0
- package/scss/helper/typography/_vertical-align.scss +44 -0
- package/scss/helper/typography/_whitespace.md +11 -0
- package/scss/helper/typography/_whitespace.scss +42 -0
- package/scss/helper/typography/_word-break.md +9 -0
- package/scss/helper/typography/_word-break.scss +36 -0
- package/scss/helper.scss +72 -0
- package/scss/layout/_aside.scss +361 -0
- package/scss/layout/_grid.scss +173 -0
- package/scss/layout/_hbox.scss +127 -0
- package/scss/layout/_header.scss +0 -0
- package/scss/layout/_layout.scss +492 -0
- package/scss/layout/_vbox.scss +38 -0
- package/scss/themes/_ang-variables.scss +224 -0
- package/scss/themes/_antd-variables.scss +238 -0
- package/scss/themes/_common.scss +157 -0
- package/scss/themes/_cxd-variables.scss +222 -0
- package/scss/themes/_dark-variables.scss +229 -0
- package/scss/themes/ang-ie11.scss +1 -0
- package/scss/themes/ang.scss +27 -0
- package/scss/themes/antd-ie11.scss +1 -0
- package/scss/themes/antd.scss +5 -0
- package/scss/themes/cxd-ie11.scss +1 -0
- package/scss/themes/cxd.scss +5 -0
- package/scss/themes/dark-ie11.scss +1 -0
- package/scss/themes/dark.scss +34 -0
- package/scss/themes/default.scss +2 -0
- package/scss/themes/extract-antd-color.py +27 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __read, __assign } from 'tslib';
|
|
7
|
+
import React__default, { forwardRef, useRef, useMemo, useCallback, useEffect, useImperativeHandle } from 'react';
|
|
8
|
+
import isObject from 'lodash/isObject';
|
|
9
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
10
|
+
import { themeable, uncontrollable, range, highlight, labelToString } from 'amis-rev-core';
|
|
11
|
+
import useSetState from '../hooks/use-set-state.js';
|
|
12
|
+
import useUpdateEffect from '../hooks/use-update-effect.js';
|
|
13
|
+
import useTouch from '../hooks/use-touch.js';
|
|
14
|
+
import 'lodash/pick';
|
|
15
|
+
|
|
16
|
+
var DEFAULT_DURATION = 200;
|
|
17
|
+
var MOMENTUM_LIMIT_TIME = 300;
|
|
18
|
+
var MOMENTUM_LIMIT_DISTANCE = 15;
|
|
19
|
+
function getElementTranslateY(element) {
|
|
20
|
+
if (!element) {
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
var style = window.getComputedStyle(element);
|
|
24
|
+
var transform = style.transform || style.webkitTransform;
|
|
25
|
+
// 格式如:matrix( scaleX(), skewY(), skewX(), scaleY(), translateX(), translateY() );
|
|
26
|
+
var translateY = transform.slice(7, transform.length - 1).split(', ')[5];
|
|
27
|
+
return Number(translateY);
|
|
28
|
+
}
|
|
29
|
+
function isOptionDisabled(option) {
|
|
30
|
+
return isObject(option) && option.disabled;
|
|
31
|
+
}
|
|
32
|
+
var PickerColumn = forwardRef(function (props, ref) {
|
|
33
|
+
var _a = props.visibleItemCount, visibleItemCount = _a === void 0 ? 5 : _a, _b = props.itemHeight, itemHeight = _b === void 0 ? 48 : _b, value = props.value, _c = props.valueField, valueField = _c === void 0 ? 'value' : _c, _d = props.swipeDuration, swipeDuration = _d === void 0 ? 1000 : _d, _e = props.labelField, labelField = _e === void 0 ? 'text' : _e, _f = props.highlightTxt, highlightTxt = _f === void 0 ? '' : _f, _g = props.options, options = _g === void 0 ? [] : _g, cx = props.classnames;
|
|
34
|
+
var root = useRef(null);
|
|
35
|
+
var menuItemRef = useRef(null);
|
|
36
|
+
var wrapper = useRef(null);
|
|
37
|
+
var moving = useRef(false);
|
|
38
|
+
var startOffset = useRef(0);
|
|
39
|
+
var transitionEndTrigger = useRef(null);
|
|
40
|
+
var touchStartTime = useRef(0);
|
|
41
|
+
var momentumOffset = useRef(0);
|
|
42
|
+
var touch = useTouch();
|
|
43
|
+
var count = options.length;
|
|
44
|
+
var getOptionText = function (option) {
|
|
45
|
+
if (isObject(option) && labelField in option) {
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
return labelToString(option[labelField]);
|
|
48
|
+
}
|
|
49
|
+
return labelToString(option);
|
|
50
|
+
};
|
|
51
|
+
var getOptionValue = function (option) {
|
|
52
|
+
if (isObject(option) && valueField in option) {
|
|
53
|
+
//@ts-ignore
|
|
54
|
+
return option[valueField];
|
|
55
|
+
}
|
|
56
|
+
return option;
|
|
57
|
+
};
|
|
58
|
+
var defaultIndex = options.findIndex(function (item) { return getOptionValue(item) === value; });
|
|
59
|
+
var baseOffset = useMemo(function () {
|
|
60
|
+
// 默认转入第一个选项的位置
|
|
61
|
+
return (itemHeight * (+visibleItemCount - 1)) / 2;
|
|
62
|
+
}, [itemHeight, visibleItemCount]);
|
|
63
|
+
var adjustIndex = function (index) {
|
|
64
|
+
index = range(index, 0, count);
|
|
65
|
+
if (!options) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (var i = index; i < count; i += 1) {
|
|
69
|
+
if (!isOptionDisabled(options[i]))
|
|
70
|
+
return i;
|
|
71
|
+
}
|
|
72
|
+
for (var i = index - 1; i >= 0; i -= 1) {
|
|
73
|
+
if (!isOptionDisabled(options[i]))
|
|
74
|
+
return i;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
};
|
|
78
|
+
var _h = __read(useSetState({
|
|
79
|
+
index: adjustIndex(defaultIndex) || 0,
|
|
80
|
+
offset: 0,
|
|
81
|
+
duration: 0,
|
|
82
|
+
options: cloneDeep(options)
|
|
83
|
+
}), 2), state = _h[0], updateState = _h[1];
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @param index 索引
|
|
87
|
+
* @param emitChange 是否派发变动消息
|
|
88
|
+
* @param confirm 是否为确认类型,为真时触发value改变
|
|
89
|
+
*/
|
|
90
|
+
var setIndex = function (index, emitChange, confirm) {
|
|
91
|
+
index = adjustIndex(index) || 0;
|
|
92
|
+
var offset = -index * itemHeight;
|
|
93
|
+
var trigger = function () {
|
|
94
|
+
updateState({ index: index });
|
|
95
|
+
if (emitChange && props.onChange) {
|
|
96
|
+
requestAnimationFrame(function () {
|
|
97
|
+
var _a;
|
|
98
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, getOptionValue(options[index]), index, confirm);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
// trigger the change event after transitionend when moving
|
|
103
|
+
if (moving.current && offset !== state.offset) {
|
|
104
|
+
//@ts-ignore
|
|
105
|
+
transitionEndTrigger.current = trigger;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
trigger();
|
|
109
|
+
}
|
|
110
|
+
updateState({ offset: offset });
|
|
111
|
+
};
|
|
112
|
+
var setOptions = function (options) {
|
|
113
|
+
if (JSON.stringify(options) !== JSON.stringify(state.options)) {
|
|
114
|
+
updateState({ options: options });
|
|
115
|
+
var index = options.findIndex(function (item) { return getOptionValue(item) === value; }) || 0;
|
|
116
|
+
setIndex(index, true, true);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var onClickItem = function (index) {
|
|
120
|
+
if (moving.current || props.readonly) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
transitionEndTrigger.current = null;
|
|
124
|
+
updateState({ duration: DEFAULT_DURATION });
|
|
125
|
+
setIndex(index, true, true);
|
|
126
|
+
};
|
|
127
|
+
var getIndexByOffset = function (offset) {
|
|
128
|
+
return range(Math.round(-offset / itemHeight), 0, count - 1);
|
|
129
|
+
};
|
|
130
|
+
var momentum = function (distance, duration) {
|
|
131
|
+
var speed = Math.abs(distance / duration);
|
|
132
|
+
distance = state.offset + (speed / 0.003) * (distance < 0 ? -1 : 1);
|
|
133
|
+
var index = getIndexByOffset(distance);
|
|
134
|
+
updateState({ duration: +swipeDuration });
|
|
135
|
+
setIndex(index, true);
|
|
136
|
+
};
|
|
137
|
+
var stopMomentum = function () {
|
|
138
|
+
moving.current = false;
|
|
139
|
+
updateState({ duration: 0 });
|
|
140
|
+
if (transitionEndTrigger.current) {
|
|
141
|
+
//@ts-ignore
|
|
142
|
+
transitionEndTrigger.current();
|
|
143
|
+
transitionEndTrigger.current = null;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var onTouchStart = function (event) {
|
|
147
|
+
if (props.readonly) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
touch.start(event);
|
|
151
|
+
var offset = state.offset;
|
|
152
|
+
if (moving.current) {
|
|
153
|
+
var translateY = getElementTranslateY(wrapper.current);
|
|
154
|
+
offset = Math.min(0, translateY - baseOffset);
|
|
155
|
+
startOffset.current = offset;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
startOffset.current = offset;
|
|
159
|
+
}
|
|
160
|
+
updateState({ duration: 0, offset: offset });
|
|
161
|
+
touchStartTime.current = Date.now();
|
|
162
|
+
momentumOffset.current = startOffset.current;
|
|
163
|
+
transitionEndTrigger.current = null;
|
|
164
|
+
};
|
|
165
|
+
var onTouchMove = function (event) {
|
|
166
|
+
if (props.readonly) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
touch.move(event);
|
|
170
|
+
if (touch.isVertical()) {
|
|
171
|
+
moving.current = true;
|
|
172
|
+
}
|
|
173
|
+
var offset = range(startOffset.current + touch.deltaY, -(count * itemHeight), itemHeight);
|
|
174
|
+
updateState({
|
|
175
|
+
offset: offset
|
|
176
|
+
});
|
|
177
|
+
var now = Date.now();
|
|
178
|
+
if (now - touchStartTime.current > MOMENTUM_LIMIT_TIME) {
|
|
179
|
+
touchStartTime.current = now;
|
|
180
|
+
momentumOffset.current = offset;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var onTouchEnd = function () {
|
|
184
|
+
if (props.readonly) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
var distance = state.offset - momentumOffset.current;
|
|
188
|
+
var duration = Date.now() - touchStartTime.current;
|
|
189
|
+
var allowMomentum = duration < MOMENTUM_LIMIT_TIME &&
|
|
190
|
+
Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
|
|
191
|
+
if (allowMomentum) {
|
|
192
|
+
momentum(distance, duration);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
var index = getIndexByOffset(state.offset);
|
|
196
|
+
updateState({ duration: DEFAULT_DURATION });
|
|
197
|
+
setIndex(index, true);
|
|
198
|
+
// compatible with desktop scenario
|
|
199
|
+
// use setTimeout to skip the click event triggered after touchstart
|
|
200
|
+
setTimeout(function () {
|
|
201
|
+
moving.current = false;
|
|
202
|
+
}, 0);
|
|
203
|
+
};
|
|
204
|
+
var renderOptions = function () {
|
|
205
|
+
var style = {
|
|
206
|
+
height: "".concat(itemHeight, "px"),
|
|
207
|
+
lineHeight: "".concat(itemHeight, "px")
|
|
208
|
+
};
|
|
209
|
+
return state.options.map(function (option, index) {
|
|
210
|
+
var text = getOptionText(option);
|
|
211
|
+
var disabled = isOptionDisabled(option);
|
|
212
|
+
var data = {
|
|
213
|
+
role: 'button',
|
|
214
|
+
key: index,
|
|
215
|
+
style: style,
|
|
216
|
+
tabIndex: disabled ? -1 : 0,
|
|
217
|
+
className: props.classnames("PickerColumns-columnItem", {
|
|
218
|
+
'is-disabled': disabled,
|
|
219
|
+
'is-selected': index === state.index
|
|
220
|
+
}),
|
|
221
|
+
onClick: function () {
|
|
222
|
+
onClickItem(index);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var childData = {
|
|
226
|
+
className: 'text-ellipsis',
|
|
227
|
+
children: (highlightTxt
|
|
228
|
+
? highlight(text, highlightTxt, cx('Select-option-hl'))
|
|
229
|
+
: text)
|
|
230
|
+
};
|
|
231
|
+
return (React__default.createElement("li", __assign({}, data, { ref: menuItemRef }), props.optionRender ? (props.optionRender(option, { index: index, checked: state.index === index })) : (React__default.createElement("div", __assign({}, childData)))));
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
var setValue = function (value) {
|
|
235
|
+
var options = state.options;
|
|
236
|
+
for (var i = 0; i < options.length; i += 1) {
|
|
237
|
+
if (options[i] === value) {
|
|
238
|
+
return setIndex(i);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
};
|
|
243
|
+
var getValue = useCallback(function () { return state.options[state.index]; }, [state.index, state.options]);
|
|
244
|
+
useEffect(function () {
|
|
245
|
+
setIndex(defaultIndex);
|
|
246
|
+
}, [defaultIndex]);
|
|
247
|
+
useUpdateEffect(function () {
|
|
248
|
+
setOptions(cloneDeep(options));
|
|
249
|
+
}, [options]);
|
|
250
|
+
useImperativeHandle(ref, function () { return ({
|
|
251
|
+
state: state,
|
|
252
|
+
setIndex: setIndex,
|
|
253
|
+
getValue: getValue,
|
|
254
|
+
setValue: setValue,
|
|
255
|
+
setOptions: setOptions,
|
|
256
|
+
stopMomentum: stopMomentum
|
|
257
|
+
}); });
|
|
258
|
+
var wrapperStyle = {
|
|
259
|
+
transform: "translate3d(0, ".concat(state.offset + baseOffset, "px, 0)"),
|
|
260
|
+
transitionDuration: "".concat(state.duration, "ms"),
|
|
261
|
+
transitionProperty: state.duration ? 'all' : 'none'
|
|
262
|
+
};
|
|
263
|
+
return (React__default.createElement("div", { ref: root, className: props.classnames('PickerColumns', props.className), onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onTouchEnd, onTouchCancel: onTouchEnd },
|
|
264
|
+
React__default.createElement("ul", { ref: wrapper, style: wrapperStyle, className: props.classnames('PickerColumns-columnWrapper'), onTransitionEnd: stopMomentum }, renderOptions())));
|
|
265
|
+
});
|
|
266
|
+
PickerColumn.defaultProps = {
|
|
267
|
+
options: [],
|
|
268
|
+
visibleItemCount: 5,
|
|
269
|
+
swipeDuration: 1000,
|
|
270
|
+
itemHeight: 48
|
|
271
|
+
};
|
|
272
|
+
var Column = themeable(uncontrollable(PickerColumn, {
|
|
273
|
+
value: 'onChange'
|
|
274
|
+
}));
|
|
275
|
+
|
|
276
|
+
export { Column as default };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __extends, __spreadArray, __read, __awaiter, __generator, __assign, __rest, __decorate, __metadata } from 'tslib';
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { isObject, autobind, themeable, localeable } from 'amis-rev-core';
|
|
9
|
+
import ConfirmBox from './ConfirmBox.js';
|
|
10
|
+
|
|
11
|
+
var PickerContainer = /** @class */ (function (_super) {
|
|
12
|
+
__extends(PickerContainer, _super);
|
|
13
|
+
function PickerContainer() {
|
|
14
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
15
|
+
_this.state = {
|
|
16
|
+
isOpened: false,
|
|
17
|
+
value: _this.props.value
|
|
18
|
+
};
|
|
19
|
+
return _this;
|
|
20
|
+
}
|
|
21
|
+
PickerContainer.prototype.componentDidUpdate = function (prevProps) {
|
|
22
|
+
var props = this.props;
|
|
23
|
+
if (props.value !== prevProps.value) {
|
|
24
|
+
this.setState({
|
|
25
|
+
value: props.value
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
PickerContainer.prototype.handleClick = function () {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31
|
+
var state, _a;
|
|
32
|
+
var _this = this;
|
|
33
|
+
var _b, _c;
|
|
34
|
+
return __generator(this, function (_d) {
|
|
35
|
+
switch (_d.label) {
|
|
36
|
+
case 0:
|
|
37
|
+
_a = [{ value: this.props.value }];
|
|
38
|
+
return [4 /*yield*/, ((_c = (_b = this.props).onPickerOpen) === null || _c === void 0 ? void 0 : _c.call(_b, this.props))];
|
|
39
|
+
case 1:
|
|
40
|
+
state = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), { isOpened: true }]);
|
|
41
|
+
this.setState(state, function () { var _a, _b; return (_b = (_a = _this.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a); });
|
|
42
|
+
return [2 /*return*/];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
PickerContainer.prototype.close = function (e, callback) {
|
|
48
|
+
var _this = this;
|
|
49
|
+
this.setState({
|
|
50
|
+
isOpened: false
|
|
51
|
+
}, function () {
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
(_b = (_a = _this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
54
|
+
if (callback) {
|
|
55
|
+
callback();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
(_d = (_c = _this.props).onCancel) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
PickerContainer.prototype.handleChange = function (value) {
|
|
62
|
+
this.setState({
|
|
63
|
+
value: value
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
PickerContainer.prototype.beforeConfirm = function (form) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var _a, onConfirm, beforeConfirm, ret, _b, state;
|
|
69
|
+
var _c, _d;
|
|
70
|
+
return __generator(this, function (_e) {
|
|
71
|
+
switch (_e.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
_a = this.props, onConfirm = _a.onConfirm, beforeConfirm = _a.beforeConfirm;
|
|
74
|
+
if (!beforeConfirm) return [3 /*break*/, 2];
|
|
75
|
+
return [4 /*yield*/, (beforeConfirm === null || beforeConfirm === void 0 ? void 0 : beforeConfirm(form))];
|
|
76
|
+
case 1:
|
|
77
|
+
_b = _e.sent();
|
|
78
|
+
return [3 /*break*/, 4];
|
|
79
|
+
case 2: return [4 /*yield*/, ((_c = form === null || form === void 0 ? void 0 : form.submit) === null || _c === void 0 ? void 0 : _c.call(form))];
|
|
80
|
+
case 3:
|
|
81
|
+
_b = _e.sent();
|
|
82
|
+
_e.label = 4;
|
|
83
|
+
case 4:
|
|
84
|
+
ret = _b;
|
|
85
|
+
state = {
|
|
86
|
+
isOpened: false
|
|
87
|
+
};
|
|
88
|
+
// beforeConfirm 返回 false 则阻止后续动作
|
|
89
|
+
if (ret === false) {
|
|
90
|
+
return [2 /*return*/, false];
|
|
91
|
+
}
|
|
92
|
+
else if (isObject(ret)) {
|
|
93
|
+
state.value = ret;
|
|
94
|
+
}
|
|
95
|
+
return [4 /*yield*/, (onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm((_d = state.value) !== null && _d !== void 0 ? _d : this.state.value))];
|
|
96
|
+
case 5:
|
|
97
|
+
_e.sent();
|
|
98
|
+
this.setState(state);
|
|
99
|
+
return [2 /*return*/];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
PickerContainer.prototype.updateState = function (state) {
|
|
105
|
+
if (state === void 0) { state = {}; }
|
|
106
|
+
state.isOpened; var rest = __rest(state, ["isOpened"]);
|
|
107
|
+
this.setState(__assign(__assign({}, this.state), rest));
|
|
108
|
+
};
|
|
109
|
+
PickerContainer.prototype.render = function () {
|
|
110
|
+
var _this = this;
|
|
111
|
+
var _a = this.props, children = _a.children, popOverRender = _a.bodyRender, title = _a.title, showTitle = _a.showTitle, headerClassName = _a.headerClassName, bodyClassName = _a.bodyClassName, className = _a.className, __ = _a.translate, size = _a.size, showFooter = _a.showFooter, closeOnEsc = _a.closeOnEsc, popOverContainer = _a.popOverContainer, mobileUI = _a.mobileUI, disabled = _a.disabled, testIdBuilder = _a.testIdBuilder;
|
|
112
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
113
|
+
children({
|
|
114
|
+
isOpened: this.state.isOpened,
|
|
115
|
+
onClick: this.handleClick,
|
|
116
|
+
setState: this.updateState
|
|
117
|
+
}),
|
|
118
|
+
React__default.createElement(ConfirmBox, { type: "dialog", size: size, closeOnEsc: closeOnEsc, show: this.state.isOpened, onCancel: this.close, title: title || __('Select.placeholder'), showTitle: showTitle, headerClassName: headerClassName, bodyClassName: bodyClassName, className: className, showFooter: showFooter, beforeConfirm: this.beforeConfirm, popOverContainer: popOverContainer, mobileUI: mobileUI, disabled: disabled, testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('confirm-box') }, function (_a) {
|
|
119
|
+
var popOverContainer = _a.popOverContainer, loading = _a.loading, onConfirm = _a.onConfirm, bodyRef = _a.bodyRef;
|
|
120
|
+
return popOverRender === null || popOverRender === void 0 ? void 0 : popOverRender(__assign(__assign({}, _this.state), { ref: bodyRef, setState: _this.updateState, onClose: _this.close, onChange: _this.handleChange, onConfirm: onConfirm, popOverContainer: popOverContainer, loading: loading }));
|
|
121
|
+
})));
|
|
122
|
+
};
|
|
123
|
+
__decorate([
|
|
124
|
+
autobind,
|
|
125
|
+
__metadata("design:type", Function),
|
|
126
|
+
__metadata("design:paramtypes", []),
|
|
127
|
+
__metadata("design:returntype", Promise)
|
|
128
|
+
], PickerContainer.prototype, "handleClick", null);
|
|
129
|
+
__decorate([
|
|
130
|
+
autobind,
|
|
131
|
+
__metadata("design:type", Function),
|
|
132
|
+
__metadata("design:paramtypes", [Object, Function]),
|
|
133
|
+
__metadata("design:returntype", void 0)
|
|
134
|
+
], PickerContainer.prototype, "close", null);
|
|
135
|
+
__decorate([
|
|
136
|
+
autobind,
|
|
137
|
+
__metadata("design:type", Function),
|
|
138
|
+
__metadata("design:paramtypes", [Object]),
|
|
139
|
+
__metadata("design:returntype", void 0)
|
|
140
|
+
], PickerContainer.prototype, "handleChange", null);
|
|
141
|
+
__decorate([
|
|
142
|
+
autobind,
|
|
143
|
+
__metadata("design:type", Function),
|
|
144
|
+
__metadata("design:paramtypes", [Object]),
|
|
145
|
+
__metadata("design:returntype", Promise)
|
|
146
|
+
], PickerContainer.prototype, "beforeConfirm", null);
|
|
147
|
+
__decorate([
|
|
148
|
+
autobind,
|
|
149
|
+
__metadata("design:type", Function),
|
|
150
|
+
__metadata("design:paramtypes", [Object]),
|
|
151
|
+
__metadata("design:returntype", void 0)
|
|
152
|
+
], PickerContainer.prototype, "updateState", null);
|
|
153
|
+
return PickerContainer;
|
|
154
|
+
}(React__default.Component));
|
|
155
|
+
var PickerContainer$1 = themeable(localeable(PickerContainer));
|
|
156
|
+
|
|
157
|
+
export { PickerContainer, PickerContainer$1 as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type OverlayAlignType = 'left' | 'center' | 'right';
|
|
3
|
+
export interface PopOverOverlay {
|
|
4
|
+
width?: string | number;
|
|
5
|
+
align?: OverlayAlignType;
|
|
6
|
+
}
|
|
7
|
+
export interface PopOverContainerProps {
|
|
8
|
+
show?: boolean;
|
|
9
|
+
children: (props: {
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onClick: (e: React.MouseEvent) => void;
|
|
12
|
+
isOpened: boolean;
|
|
13
|
+
ref: any;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** 弹出层打开时触发的事件 */
|
|
17
|
+
onOpen?: () => void;
|
|
18
|
+
popOverRender: (props: {
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
}) => JSX.Element;
|
|
21
|
+
popOverContainer?: any;
|
|
22
|
+
popOverClassName?: string;
|
|
23
|
+
mobileUI?: boolean;
|
|
24
|
+
placement?: string;
|
|
25
|
+
overlayWidth?: number | string;
|
|
26
|
+
overlayWidthField?: 'minWidth' | 'width';
|
|
27
|
+
showConfirm?: boolean;
|
|
28
|
+
align?: OverlayAlignType;
|
|
29
|
+
/** Popover层隐藏前触发的事件 */
|
|
30
|
+
onBeforeHide?: () => void;
|
|
31
|
+
/** Popover层隐藏后触发的事件 */
|
|
32
|
+
onAfterHide?: () => void;
|
|
33
|
+
onConfirm?: () => void;
|
|
34
|
+
}
|
|
35
|
+
export interface PopOverContainerState {
|
|
36
|
+
isOpened: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare class PopOverContainer extends React.Component<PopOverContainerProps, PopOverContainerState> {
|
|
39
|
+
static alignPlacementMap: {
|
|
40
|
+
left: string;
|
|
41
|
+
right: string;
|
|
42
|
+
center: string;
|
|
43
|
+
};
|
|
44
|
+
state: PopOverContainerState;
|
|
45
|
+
target: any;
|
|
46
|
+
targetRef(target: any): void;
|
|
47
|
+
handleClick(e?: React.MouseEvent): void;
|
|
48
|
+
close(): void;
|
|
49
|
+
getTarget(): any;
|
|
50
|
+
getParent(): any;
|
|
51
|
+
onConfirm(): void;
|
|
52
|
+
static calcOverlayWidth(overlay: PopOverOverlay, targetWidth: number): string | number | undefined;
|
|
53
|
+
static alignToPlacement(overlay?: PopOverOverlay): string;
|
|
54
|
+
getOverlayStyle(): {
|
|
55
|
+
[x: string]: string | number;
|
|
56
|
+
};
|
|
57
|
+
render(): React.JSX.Element;
|
|
58
|
+
}
|
|
59
|
+
export default PopOverContainer;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __extends, __spreadArray, __read, __decorate, __metadata } from 'tslib';
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { findDomCompat, toNumber, Overlay, PopOver, autobind } from 'amis-rev-core';
|
|
9
|
+
import PopUp from './PopUp.js';
|
|
10
|
+
import isNumber from 'lodash/isNumber';
|
|
11
|
+
|
|
12
|
+
var PopOverContainer = /** @class */ (function (_super) {
|
|
13
|
+
__extends(PopOverContainer, _super);
|
|
14
|
+
function PopOverContainer() {
|
|
15
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
16
|
+
_this.state = {
|
|
17
|
+
isOpened: false
|
|
18
|
+
};
|
|
19
|
+
return _this;
|
|
20
|
+
}
|
|
21
|
+
PopOverContainer.prototype.targetRef = function (target) {
|
|
22
|
+
this.target = target ? findDomCompat(target) : null;
|
|
23
|
+
};
|
|
24
|
+
PopOverContainer.prototype.handleClick = function (e) {
|
|
25
|
+
var _this = this;
|
|
26
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
27
|
+
this.props.disabled ||
|
|
28
|
+
this.setState({
|
|
29
|
+
isOpened: true
|
|
30
|
+
}, function () {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
(_b = (_a = _this.props).onOpen) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
PopOverContainer.prototype.close = function () {
|
|
36
|
+
var _a = this.props, onBeforeHide = _a.onBeforeHide, onAfterHide = _a.onAfterHide;
|
|
37
|
+
if (onBeforeHide && typeof onBeforeHide === 'function') {
|
|
38
|
+
onBeforeHide === null || onBeforeHide === void 0 ? void 0 : onBeforeHide();
|
|
39
|
+
}
|
|
40
|
+
this.setState({
|
|
41
|
+
isOpened: false
|
|
42
|
+
});
|
|
43
|
+
if (onAfterHide && typeof onAfterHide === 'function') {
|
|
44
|
+
onAfterHide === null || onAfterHide === void 0 ? void 0 : onAfterHide();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
PopOverContainer.prototype.getTarget = function () {
|
|
48
|
+
return this.target || findDomCompat(this);
|
|
49
|
+
};
|
|
50
|
+
PopOverContainer.prototype.getParent = function () {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
53
|
+
};
|
|
54
|
+
PopOverContainer.prototype.onConfirm = function () {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
(_b = (_a = this.props).onConfirm) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
57
|
+
this.close();
|
|
58
|
+
};
|
|
59
|
+
PopOverContainer.calcOverlayWidth = function (overlay, targetWidth) {
|
|
60
|
+
var overlayWidth = overlay && overlay.width;
|
|
61
|
+
if (!overlayWidth || !isNumber(targetWidth) || targetWidth < 1)
|
|
62
|
+
return;
|
|
63
|
+
// 数字字符串需要转化下,否则不生效
|
|
64
|
+
if (typeof overlayWidth === 'number' || /^\d+$/.test(overlayWidth)) {
|
|
65
|
+
return toNumber(overlayWidth);
|
|
66
|
+
}
|
|
67
|
+
// 带单位,如: 80%、200px、30vw、5rem
|
|
68
|
+
if (/^\d+(px|%|rem|em|vw)$/.test(overlayWidth)) {
|
|
69
|
+
return overlayWidth;
|
|
70
|
+
}
|
|
71
|
+
// 带单位的相对值
|
|
72
|
+
// 如: -100px 代表 100% - 100px。+10vw 代表 100% + 10vw
|
|
73
|
+
if (/^(\+|\-)\d+(px|%|rem|em|vw)$/.test(overlayWidth)) {
|
|
74
|
+
// 不能使用 calc(100% $1 $2),需要考虑到 popOverContainer
|
|
75
|
+
return overlayWidth.replace(/^(\+|\-)(.*)/, "calc(".concat(targetWidth, "px $1 $2)"));
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
};
|
|
79
|
+
PopOverContainer.alignToPlacement = function (overlay) {
|
|
80
|
+
var align = overlay && overlay.align;
|
|
81
|
+
return (align && PopOverContainer.alignPlacementMap[align]) || 'auto';
|
|
82
|
+
};
|
|
83
|
+
// 可以自定义下拉框宽度
|
|
84
|
+
PopOverContainer.prototype.getOverlayStyle = function () {
|
|
85
|
+
var _a;
|
|
86
|
+
var _b;
|
|
87
|
+
var _c = this.props, overlayWidth = _c.overlayWidth, overlayWidthField = _c.overlayWidthField;
|
|
88
|
+
return _a = {},
|
|
89
|
+
_a[overlayWidthField || 'minWidth'] = PopOverContainer.calcOverlayWidth({ width: overlayWidth }, (_b = this.target) === null || _b === void 0 ? void 0 : _b.offsetWidth) || (this.target ? Math.max(this.target.offsetWidth, 100) : 'auto'),
|
|
90
|
+
_a;
|
|
91
|
+
};
|
|
92
|
+
PopOverContainer.prototype.render = function () {
|
|
93
|
+
var _a = this.props, mobileUI = _a.mobileUI, children = _a.children, popOverContainer = _a.popOverContainer, popOverClassName = _a.popOverClassName, dropdownRender = _a.popOverRender, placement = _a.placement, align = _a.align, showConfirm = _a.showConfirm; _a.onConfirm; var disabled = _a.disabled;
|
|
94
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
95
|
+
children({
|
|
96
|
+
isOpened: this.state.isOpened && this.props.show !== false,
|
|
97
|
+
onClick: this.handleClick,
|
|
98
|
+
ref: this.targetRef,
|
|
99
|
+
disabled: disabled
|
|
100
|
+
}),
|
|
101
|
+
mobileUI ? (React__default.createElement(PopUp, { isShow: this.state.isOpened && this.props.show !== false, container: popOverContainer, className: popOverClassName, showConfirm: showConfirm, onHide: this.close, onConfirm: this.onConfirm }, dropdownRender({ onClose: this.close }))) : (React__default.createElement(Overlay, { container: popOverContainer || this.getParent, target: this.getTarget, placement: placement || PopOverContainer.alignToPlacement({ align: align }), show: this.state.isOpened && this.props.show !== false },
|
|
102
|
+
React__default.createElement(PopOver, { overlay: true, className: popOverClassName, style: this.getOverlayStyle(), onHide: this.close }, dropdownRender({ onClose: this.close }))))));
|
|
103
|
+
};
|
|
104
|
+
PopOverContainer.alignPlacementMap = {
|
|
105
|
+
left: 'left-bottom-left-top',
|
|
106
|
+
right: 'right-bottom-right-top',
|
|
107
|
+
center: 'center-bottom-center-top'
|
|
108
|
+
};
|
|
109
|
+
__decorate([
|
|
110
|
+
autobind,
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [Object]),
|
|
113
|
+
__metadata("design:returntype", void 0)
|
|
114
|
+
], PopOverContainer.prototype, "targetRef", null);
|
|
115
|
+
__decorate([
|
|
116
|
+
autobind,
|
|
117
|
+
__metadata("design:type", Function),
|
|
118
|
+
__metadata("design:paramtypes", [Object]),
|
|
119
|
+
__metadata("design:returntype", void 0)
|
|
120
|
+
], PopOverContainer.prototype, "handleClick", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
autobind,
|
|
123
|
+
__metadata("design:type", Function),
|
|
124
|
+
__metadata("design:paramtypes", []),
|
|
125
|
+
__metadata("design:returntype", void 0)
|
|
126
|
+
], PopOverContainer.prototype, "close", null);
|
|
127
|
+
__decorate([
|
|
128
|
+
autobind,
|
|
129
|
+
__metadata("design:type", Function),
|
|
130
|
+
__metadata("design:paramtypes", []),
|
|
131
|
+
__metadata("design:returntype", void 0)
|
|
132
|
+
], PopOverContainer.prototype, "getTarget", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
autobind,
|
|
135
|
+
__metadata("design:type", Function),
|
|
136
|
+
__metadata("design:paramtypes", []),
|
|
137
|
+
__metadata("design:returntype", void 0)
|
|
138
|
+
], PopOverContainer.prototype, "getParent", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
autobind,
|
|
141
|
+
__metadata("design:type", Function),
|
|
142
|
+
__metadata("design:paramtypes", []),
|
|
143
|
+
__metadata("design:returntype", void 0)
|
|
144
|
+
], PopOverContainer.prototype, "onConfirm", null);
|
|
145
|
+
return PopOverContainer;
|
|
146
|
+
}(React__default.Component));
|
|
147
|
+
|
|
148
|
+
export { PopOverContainer, PopOverContainer as default };
|