amis-ui 2.6.0 → 2.7.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/esm/_virtual/index.js +8 -0
- package/esm/_virtual/react-is.development.js +8 -0
- package/esm/_virtual/react-is.production.min.js +8 -0
- package/esm/components/404.js +2 -2
- package/esm/components/Alert.js +2 -2
- package/esm/components/Alert2.js +2 -2
- package/esm/components/AnchorNav.js +2 -2
- package/esm/components/ArrayInput.js +2 -2
- package/esm/components/AsideNav.js +2 -2
- package/esm/components/AssociatedSelection.js +2 -2
- package/esm/components/Avatar.js +2 -2
- package/esm/components/Badge.js +2 -2
- package/esm/components/BaiduMapPicker.js +2 -2
- package/esm/components/BarCode.js +2 -2
- package/esm/components/Breadcrumb.js +2 -2
- package/esm/components/Button.js +2 -2
- package/esm/components/CalendarMobile.js +2 -2
- package/esm/components/Card.js +2 -2
- package/esm/components/Cascader.js +2 -2
- package/esm/components/ChainedSelection.js +2 -2
- package/esm/components/Checkbox.js +2 -2
- package/esm/components/CityArea.js +2 -2
- package/esm/components/CityDB.js +2 -2
- package/esm/components/CodeMirror.js +2 -2
- package/esm/components/Collapse.js +5 -3
- package/esm/components/CollapseGroup.js +2 -2
- package/esm/components/ColorPicker.js +2 -2
- package/esm/components/Combo.js +2 -2
- package/esm/components/ConfirmBox.js +2 -2
- package/esm/components/ContextMenu.js +2 -2
- package/esm/components/DatePicker.js +7 -2
- package/esm/components/DateRangePicker.d.ts +7 -4
- package/esm/components/DateRangePicker.js +5 -6
- package/esm/components/DndContainer.d.ts +293 -0
- package/esm/components/DndContainer.js +25 -0
- package/esm/components/Drawer.js +2 -2
- package/esm/components/Editor.js +2 -2
- package/esm/components/Form.js +2 -2
- package/esm/components/FormField.js +2 -2
- package/esm/components/GridNav.js +2 -2
- package/esm/components/GroupedSelection.js +4 -4
- package/esm/components/Html.js +2 -2
- package/esm/components/ImageGallery.d.ts +6 -5
- package/esm/components/ImageGallery.js +26 -10
- package/esm/components/Input.js +2 -2
- package/esm/components/InputBox.js +2 -2
- package/esm/components/InputBoxWithSuggestion.js +2 -2
- package/esm/components/InputTable.js +2 -2
- package/esm/components/Layout.js +2 -2
- package/esm/components/Link.js +2 -2
- package/esm/components/ListGroup.js +2 -2
- package/esm/components/ListMenu.js +2 -2
- package/esm/components/LocationPicker.js +2 -2
- package/esm/components/Markdown.js +2 -2
- package/esm/components/Modal.js +2 -2
- package/esm/components/ModalManager.js +2 -2
- package/esm/components/MultilineText.js +2 -2
- package/esm/components/NumberInput.js +4 -4
- package/esm/components/Pagination.js +2 -2
- package/esm/components/Picker.js +2 -2
- package/esm/components/PickerColumn.js +2 -2
- package/esm/components/PickerContainer.js +2 -2
- package/esm/components/PopOverContainer.js +2 -2
- package/esm/components/PopUp.js +2 -2
- package/esm/components/Progress.js +2 -2
- package/esm/components/PullRefresh.js +2 -2
- package/esm/components/Radios.js +2 -2
- package/esm/components/Range.js +2 -2
- package/esm/components/Rating.d.ts +12 -55
- package/esm/components/Rating.js +32 -16
- package/esm/components/ResultBox.d.ts +41 -40
- package/esm/components/ResultBox.js +16 -7
- package/esm/components/ResultList.d.ts +41 -40
- package/esm/components/ResultList.js +4 -4
- package/esm/components/ResultTableList.js +2 -2
- package/esm/components/ResultTreeList.js +2 -2
- package/esm/components/RichText.js +2 -2
- package/esm/components/SearchBox.js +2 -2
- package/esm/components/Select.d.ts +194 -193
- package/esm/components/Select.js +12 -8
- package/esm/components/Selection.js +2 -2
- package/esm/components/SparkLine.js +2 -2
- package/esm/components/Spinner.js +2 -2
- package/esm/components/Steps.js +2 -2
- package/esm/components/Switch.js +2 -2
- package/esm/components/TableSelection.js +2 -2
- package/esm/components/Tabs.js +16 -12
- package/esm/components/TabsTransfer.d.ts +40 -40
- package/esm/components/TabsTransfer.js +2 -2
- package/esm/components/TabsTransferPicker.js +2 -2
- package/esm/components/Tag.d.ts +14 -10
- package/esm/components/Tag.js +22 -2
- package/esm/components/Textarea.js +2 -2
- package/esm/components/Timeline.js +2 -2
- package/esm/components/TimelineItem.js +2 -2
- package/esm/components/Tinymce.js +2 -2
- package/esm/components/TitleBar.js +2 -2
- package/esm/components/Toast.js +3 -3
- package/esm/components/Tooltip.js +2 -2
- package/esm/components/TooltipWrapper.js +2 -2
- package/esm/components/Transfer.d.ts +41 -40
- package/esm/components/Transfer.js +4 -4
- package/esm/components/TransferDropDown.d.ts +40 -40
- package/esm/components/TransferDropDown.js +4 -4
- package/esm/components/TransferPicker.js +2 -2
- package/esm/components/TransferSearch.js +2 -2
- package/esm/components/Tree.js +21 -8
- package/esm/components/TreeSelection.js +2 -2
- package/esm/components/UserSelect.js +4 -2
- package/esm/components/UserTabSelect.js +4 -2
- package/esm/components/WithRemoteConfig.js +7 -6
- package/esm/components/WithStore.js +2 -2
- package/esm/components/calendar/Calendar.js +2 -2
- package/esm/components/calendar/CalendarContainer.js +2 -2
- package/esm/components/calendar/DaysView.js +2 -2
- package/esm/components/calendar/MonthsView.js +2 -2
- package/esm/components/calendar/QuartersView.js +2 -2
- package/esm/components/calendar/TimeView.js +2 -2
- package/esm/components/calendar/YearsView.js +2 -2
- package/esm/components/condition-builder/Expression.js +2 -2
- package/esm/components/condition-builder/Field.js +2 -2
- package/esm/components/condition-builder/Formula.js +2 -2
- package/esm/components/condition-builder/Func.js +2 -2
- package/esm/components/condition-builder/Group.js +2 -2
- package/esm/components/condition-builder/GroupOrItem.js +2 -2
- package/esm/components/condition-builder/InputSwitch.js +2 -2
- package/esm/components/condition-builder/Item.js +2 -2
- package/esm/components/condition-builder/Value.js +2 -2
- package/esm/components/condition-builder/config.js +2 -2
- package/esm/components/condition-builder/index.js +2 -2
- package/esm/components/formula/Editor.js +2 -2
- package/esm/components/formula/FuncList.js +2 -2
- package/esm/components/formula/Picker.js +2 -2
- package/esm/components/formula/VariableList.js +2 -2
- package/esm/components/formula/plugin.js +2 -2
- package/esm/components/icons.d.ts +2 -1
- package/esm/components/icons.js +31 -15
- package/esm/components/index.d.ts +3 -1
- package/esm/components/json-schema/Array.js +2 -2
- package/esm/components/json-schema/Item.js +2 -2
- package/esm/components/json-schema/Object.js +2 -2
- package/esm/components/json-schema/index.js +2 -2
- package/esm/components/menu/MenuContext.d.ts +73 -0
- package/esm/components/menu/MenuContext.js +25 -0
- package/esm/components/menu/MenuItem.d.ts +84 -0
- package/esm/components/menu/MenuItem.js +125 -0
- package/esm/components/menu/SubMenu.d.ts +88 -0
- package/esm/components/menu/SubMenu.js +141 -0
- package/esm/components/menu/index.d.ts +246 -0
- package/esm/components/menu/index.js +315 -0
- package/esm/components/schema-editor/Array.js +2 -2
- package/esm/components/schema-editor/Common.js +2 -2
- package/esm/components/schema-editor/Item.js +2 -2
- package/esm/components/schema-editor/Object.js +2 -2
- package/esm/components/schema-editor/SchemaVariableList.js +2 -2
- package/esm/components/schema-editor/SchemaVariableListPicker.js +2 -2
- package/esm/components/schema-editor/index.js +2 -2
- package/esm/components/table/Cell.js +2 -2
- package/esm/components/table/HeadCellDropDown.js +2 -2
- package/esm/components/table/HeadCellFilter.js +2 -2
- package/esm/components/table/HeadCellSelect.js +2 -2
- package/esm/components/table/HeadCellSort.d.ts +2 -0
- package/esm/components/table/HeadCellSort.js +25 -17
- package/esm/components/table/ItemActionsWrapper.js +2 -2
- package/esm/components/table/index.d.ts +1 -0
- package/esm/components/table/index.js +16 -9
- package/esm/components/virtual-list/AutoSizer.js +2 -2
- package/esm/components/virtual-list/SizeAndPositionManager.js +2 -2
- package/esm/components/virtual-list/constants.js +2 -2
- package/esm/components/virtual-list/index.js +2 -2
- package/esm/hooks/use-set-state.js +2 -2
- package/esm/hooks/use-sub-form.js +2 -2
- package/esm/hooks/use-touch.js +2 -2
- package/esm/hooks/use-update-effect.js +2 -2
- package/esm/hooks/use-validation-resolver.js +2 -2
- package/esm/icons/alert-danger.svg.js +2 -2
- package/esm/icons/alert-info.svg.js +2 -2
- package/esm/icons/alert-success.svg.js +2 -2
- package/esm/icons/alert-warning.svg.js +2 -2
- package/esm/icons/back.svg.js +2 -2
- package/esm/icons/calendar.svg.js +2 -2
- package/esm/icons/caret.svg.js +2 -2
- package/esm/icons/check.svg.js +2 -2
- package/esm/icons/clock.svg.js +2 -2
- package/esm/icons/close-small.svg.js +2 -2
- package/esm/icons/close.svg.js +2 -2
- package/esm/icons/cloud-upload.svg.js +7 -16
- package/esm/icons/column-filter.svg.js +2 -2
- package/esm/icons/columns.svg.js +2 -2
- package/esm/icons/compress-alt.svg.js +2 -2
- package/esm/icons/copy.svg.js +2 -2
- package/esm/icons/date.svg.js +2 -2
- package/esm/icons/department.svg.js +2 -2
- package/esm/icons/desk-empty.svg.js +2 -2
- package/esm/icons/dot.svg.js +2 -2
- package/esm/icons/down-arrow-bold.svg.js +2 -2
- package/esm/icons/down.svg.js +2 -2
- package/esm/icons/download.svg.js +2 -2
- package/esm/icons/drag-bar.svg.js +2 -2
- package/esm/icons/drag.svg.js +2 -2
- package/esm/icons/edit.svg.js +2 -2
- package/esm/icons/ellipsis-v.svg.js +2 -2
- package/esm/icons/enter.svg.js +2 -2
- package/esm/icons/exchange.svg.js +2 -2
- package/esm/icons/expand-alt.svg.js +2 -2
- package/esm/icons/fail.svg.js +12 -10
- package/esm/icons/file.svg.js +2 -2
- package/esm/icons/filter.svg.js +2 -2
- package/esm/icons/folder.svg.js +2 -2
- package/esm/icons/function.svg.js +2 -2
- package/esm/icons/home.svg.js +2 -2
- package/esm/icons/image.svg.js +2 -2
- package/esm/icons/info-circle.svg.js +2 -2
- package/esm/icons/info.svg.js +2 -2
- package/esm/icons/input-clear.svg.js +2 -2
- package/esm/icons/invisible.svg.js +2 -2
- package/esm/icons/left-arrow.svg.js +2 -2
- package/esm/icons/loading-outline.svg.js +2 -2
- package/esm/icons/location.svg.js +2 -2
- package/esm/icons/menu.svg.js +2 -2
- package/esm/icons/minus.svg.js +2 -2
- package/esm/icons/move.svg.js +2 -2
- package/esm/icons/mute.svg.js +2 -2
- package/esm/icons/new-edit.svg.js +2 -2
- package/esm/icons/pause.svg.js +2 -2
- package/esm/icons/pencil.svg.js +2 -2
- package/esm/icons/play.svg.js +2 -2
- package/esm/icons/plus-cicle.svg.js +2 -2
- package/esm/icons/plus-fine.svg.js +2 -2
- package/esm/icons/plus.svg.js +2 -2
- package/esm/icons/post.svg.js +2 -2
- package/esm/icons/question-mark.svg.js +2 -2
- package/esm/icons/question.svg.js +2 -2
- package/esm/icons/redo.svg.js +2 -2
- package/esm/icons/refresh.svg.js +2 -2
- package/esm/icons/reload.svg.js +2 -2
- package/esm/icons/remove.svg.js +2 -2
- package/esm/icons/retry.svg.js +2 -2
- package/esm/icons/right-arrow-bold.svg.js +2 -2
- package/esm/icons/right-arrow.svg.js +2 -2
- package/esm/icons/right-double-arrow.svg.js +2 -2
- package/esm/icons/role.svg.js +2 -2
- package/esm/icons/rotate-left.svg.js +2 -2
- package/esm/icons/rotate-right.svg.js +2 -2
- package/esm/icons/scale-origin.svg.js +2 -2
- package/esm/icons/schedule.svg.js +2 -2
- package/esm/icons/search.svg.js +2 -2
- package/esm/icons/setting.svg.js +2 -2
- package/esm/icons/slider-handle-icon.svg.js +2 -2
- package/esm/icons/sort-asc.svg.js +2 -2
- package/esm/icons/sort-default.svg.js +2 -2
- package/esm/icons/sort-desc.svg.js +2 -2
- package/esm/icons/star.svg.js +2 -2
- package/esm/icons/status-close.svg.js +2 -2
- package/esm/icons/steps-finsh.svg.js +2 -2
- package/esm/icons/success.svg.js +14 -12
- package/esm/icons/transparent.svg.js +2 -2
- package/esm/icons/trash.svg.js +2 -2
- package/esm/icons/tree-down.svg.js +2 -2
- package/esm/icons/undo.svg.js +2 -2
- package/esm/icons/upload.svg.js +2 -2
- package/esm/icons/user-remove.svg.js +2 -2
- package/esm/icons/view.svg.js +2 -2
- package/esm/icons/volume.svg.js +2 -2
- package/esm/icons/warning-mark.svg.js +2 -2
- package/esm/icons/warning.svg.js +2 -2
- package/esm/icons/window-restore.svg.js +2 -2
- package/esm/icons/zoom-in.svg.js +2 -2
- package/esm/icons/zoom-out.svg.js +2 -2
- package/esm/index.js +4 -2
- package/esm/locale/de-DE.js +2 -2
- package/esm/locale/en-US.js +2 -2
- package/esm/locale/zh-CN.js +2 -2
- package/esm/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +14 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +10 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +13 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +12 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/createClass.js +26 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/createSuper.js +25 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/defineProperty.js +23 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/extends.js +21 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +13 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/inherits.js +25 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +18 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +36 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +10 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +30 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +24 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +19 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +18 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +14 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +15 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +19 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +14 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/typeof.js +16 -0
- package/esm/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +17 -0
- package/esm/node_modules/rc-overflow/es/Item.js +90 -0
- package/esm/node_modules/rc-overflow/es/Overflow.js +341 -0
- package/esm/node_modules/rc-overflow/es/RawItem.js +48 -0
- package/esm/node_modules/rc-overflow/es/hooks/useBatchFrameState.js +51 -0
- package/esm/node_modules/rc-overflow/es/index.js +7 -0
- package/esm/node_modules/rc-resize-observer/es/Collection.js +41 -0
- package/esm/node_modules/rc-resize-observer/es/SingleObserver/DomWrapper.js +37 -0
- package/esm/node_modules/rc-resize-observer/es/SingleObserver/index.js +108 -0
- package/esm/node_modules/rc-resize-observer/es/index.js +37 -0
- package/esm/node_modules/rc-resize-observer/es/utils/observerUtil.js +48 -0
- package/esm/node_modules/rc-util/es/Children/toArray.js +28 -0
- package/esm/node_modules/rc-util/es/Dom/canUseDom.js +10 -0
- package/esm/node_modules/rc-util/es/Dom/findDOMNode.js +22 -0
- package/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +14 -0
- package/esm/node_modules/rc-util/es/hooks/useState.js +35 -0
- package/esm/node_modules/rc-util/es/raf.js +55 -0
- package/esm/node_modules/rc-util/es/ref.js +55 -0
- package/esm/node_modules/rc-util/es/warning.js +15 -0
- package/esm/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.js +195 -0
- package/esm/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.js +31 -0
- package/esm/node_modules/rc-util/node_modules/react-is/index.js +17 -0
- package/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +933 -0
- package/esm/themes/ang.js +2 -2
- package/esm/themes/antd.js +2 -2
- package/esm/themes/cxd.js +2 -2
- package/esm/themes/dark.js +2 -2
- package/lib/_virtual/index.js +12 -0
- package/lib/_virtual/react-is.development.js +12 -0
- package/lib/_virtual/react-is.production.min.js +12 -0
- package/lib/components/404.js +2 -2
- package/lib/components/Alert.d.ts +40 -40
- package/lib/components/Alert.js +2 -2
- package/lib/components/Alert2.d.ts +10 -10
- package/lib/components/Alert2.js +2 -2
- package/lib/components/AnchorNav.d.ts +10 -10
- package/lib/components/AnchorNav.js +2 -2
- package/lib/components/ArrayInput.d.ts +40 -40
- package/lib/components/ArrayInput.js +2 -2
- package/lib/components/AsideNav.d.ts +10 -10
- package/lib/components/AsideNav.js +2 -2
- package/lib/components/AssociatedSelection.d.ts +40 -40
- package/lib/components/AssociatedSelection.js +2 -2
- package/lib/components/Avatar.d.ts +10 -10
- package/lib/components/Avatar.js +2 -2
- package/lib/components/Badge.js +2 -2
- package/lib/components/BaiduMapPicker.js +2 -2
- package/lib/components/BarCode.js +2 -2
- package/lib/components/Breadcrumb.js +2 -2
- package/lib/components/Button.d.ts +10 -10
- package/lib/components/Button.js +2 -2
- package/lib/components/CalendarMobile.d.ts +40 -40
- package/lib/components/CalendarMobile.js +2 -2
- package/lib/components/Card.d.ts +10 -10
- package/lib/components/Card.js +2 -2
- package/lib/components/Cascader.js +2 -2
- package/lib/components/ChainedSelection.d.ts +40 -40
- package/lib/components/ChainedSelection.js +2 -2
- package/lib/components/Checkbox.d.ts +10 -10
- package/lib/components/Checkbox.js +2 -2
- package/lib/components/CityArea.js +2 -2
- package/lib/components/CityDB.js +2 -2
- package/lib/components/CodeMirror.js +2 -2
- package/lib/components/Collapse.d.ts +10 -10
- package/lib/components/Collapse.js +5 -3
- package/lib/components/CollapseGroup.d.ts +10 -10
- package/lib/components/CollapseGroup.js +2 -2
- package/lib/components/ColorPicker.d.ts +40 -40
- package/lib/components/ColorPicker.js +2 -2
- package/lib/components/Combo.js +2 -2
- package/lib/components/ConfirmBox.d.ts +40 -40
- package/lib/components/ConfirmBox.js +2 -2
- package/lib/components/ContextMenu.js +2 -2
- package/lib/components/DatePicker.d.ts +81 -81
- package/lib/components/DatePicker.js +7 -2
- package/lib/components/DateRangePicker.d.ts +47 -44
- package/lib/components/DateRangePicker.js +5 -6
- package/lib/components/DndContainer.d.ts +293 -0
- package/lib/components/DndContainer.js +34 -0
- package/lib/components/Drawer.d.ts +10 -10
- package/lib/components/Drawer.js +2 -2
- package/lib/components/Editor.d.ts +40 -40
- package/lib/components/Editor.js +2 -2
- package/lib/components/Form.js +2 -2
- package/lib/components/FormField.js +2 -2
- package/lib/components/GridNav.js +2 -2
- package/lib/components/GroupedSelection.d.ts +40 -40
- package/lib/components/GroupedSelection.js +4 -4
- package/lib/components/Html.js +2 -2
- package/lib/components/ImageGallery.d.ts +46 -45
- package/lib/components/ImageGallery.js +26 -10
- package/lib/components/Input.js +2 -2
- package/lib/components/InputBox.d.ts +10 -10
- package/lib/components/InputBox.js +2 -2
- package/lib/components/InputBoxWithSuggestion.js +2 -2
- package/lib/components/InputTable.js +2 -2
- package/lib/components/Layout.d.ts +10 -10
- package/lib/components/Layout.js +2 -2
- package/lib/components/Link.js +2 -2
- package/lib/components/ListGroup.d.ts +10 -10
- package/lib/components/ListGroup.js +2 -2
- package/lib/components/ListMenu.d.ts +40 -40
- package/lib/components/ListMenu.js +2 -2
- package/lib/components/LocationPicker.d.ts +40 -40
- package/lib/components/LocationPicker.js +2 -2
- package/lib/components/Markdown.js +2 -2
- package/lib/components/Modal.d.ts +40 -40
- package/lib/components/Modal.js +2 -2
- package/lib/components/ModalManager.js +2 -2
- package/lib/components/MonthRangePicker.d.ts +40 -40
- package/lib/components/MultilineText.d.ts +40 -40
- package/lib/components/MultilineText.js +2 -2
- package/lib/components/NumberInput.d.ts +10 -10
- package/lib/components/NumberInput.js +4 -4
- package/lib/components/Pagination.d.ts +40 -40
- package/lib/components/Pagination.js +2 -2
- package/lib/components/Picker.js +2 -2
- package/lib/components/PickerColumn.js +2 -2
- package/lib/components/PickerContainer.js +2 -2
- package/lib/components/PopOverContainer.js +2 -2
- package/lib/components/PopUp.d.ts +40 -40
- package/lib/components/PopUp.js +2 -2
- package/lib/components/Progress.d.ts +10 -10
- package/lib/components/Progress.js +2 -2
- package/lib/components/PullRefresh.js +2 -2
- package/lib/components/Radios.d.ts +10 -10
- package/lib/components/Radios.js +2 -2
- package/lib/components/Range.js +2 -2
- package/lib/components/Rating.d.ts +22 -65
- package/lib/components/Rating.js +32 -16
- package/lib/components/ResultBox.d.ts +41 -40
- package/lib/components/ResultBox.js +16 -7
- package/lib/components/ResultList.d.ts +41 -40
- package/lib/components/ResultList.js +4 -4
- package/lib/components/ResultTableList.d.ts +40 -40
- package/lib/components/ResultTableList.js +2 -2
- package/lib/components/ResultTreeList.d.ts +40 -40
- package/lib/components/ResultTreeList.js +2 -2
- package/lib/components/RichText.js +2 -2
- package/lib/components/SearchBox.d.ts +40 -40
- package/lib/components/SearchBox.js +2 -2
- package/lib/components/Select.d.ts +194 -193
- package/lib/components/Select.js +12 -8
- package/lib/components/Selection.d.ts +40 -40
- package/lib/components/Selection.js +2 -2
- package/lib/components/SparkLine.d.ts +40 -40
- package/lib/components/SparkLine.js +2 -2
- package/lib/components/Spinner.d.ts +10 -10
- package/lib/components/Spinner.js +2 -2
- package/lib/components/Steps.js +2 -2
- package/lib/components/Switch.d.ts +10 -10
- package/lib/components/Switch.js +2 -2
- package/lib/components/TableSelection.d.ts +40 -40
- package/lib/components/TableSelection.js +2 -2
- package/lib/components/Tabs.d.ts +40 -40
- package/lib/components/Tabs.js +16 -12
- package/lib/components/TabsTransfer.d.ts +40 -40
- package/lib/components/TabsTransfer.js +2 -2
- package/lib/components/TabsTransferPicker.js +2 -2
- package/lib/components/Tag.d.ts +14 -10
- package/lib/components/Tag.js +22 -2
- package/lib/components/Textarea.d.ts +40 -40
- package/lib/components/Textarea.js +2 -2
- package/lib/components/Timeline.js +2 -2
- package/lib/components/TimelineItem.js +2 -2
- package/lib/components/Tinymce.js +2 -2
- package/lib/components/TitleBar.js +2 -2
- package/lib/components/Toast.d.ts +40 -40
- package/lib/components/Toast.js +3 -3
- package/lib/components/Tooltip.js +2 -2
- package/lib/components/TooltipWrapper.d.ts +10 -10
- package/lib/components/TooltipWrapper.js +2 -2
- package/lib/components/Transfer.d.ts +50 -49
- package/lib/components/Transfer.js +4 -4
- package/lib/components/TransferDropDown.d.ts +40 -40
- package/lib/components/TransferDropDown.js +4 -4
- package/lib/components/TransferPicker.js +2 -2
- package/lib/components/TransferSearch.js +2 -2
- package/lib/components/Tree.d.ts +40 -40
- package/lib/components/Tree.js +21 -8
- package/lib/components/TreeSelection.d.ts +40 -40
- package/lib/components/TreeSelection.js +2 -2
- package/lib/components/UserSelect.d.ts +40 -40
- package/lib/components/UserSelect.js +4 -2
- package/lib/components/UserTabSelect.d.ts +40 -40
- package/lib/components/UserTabSelect.js +4 -2
- package/lib/components/WithRemoteConfig.js +7 -6
- package/lib/components/WithStore.js +2 -2
- package/lib/components/calendar/Calendar.js +2 -2
- package/lib/components/calendar/CalendarContainer.js +2 -2
- package/lib/components/calendar/DaysView.js +2 -2
- package/lib/components/calendar/MonthsView.js +2 -2
- package/lib/components/calendar/QuartersView.js +2 -2
- package/lib/components/calendar/TimeView.js +2 -2
- package/lib/components/calendar/YearsView.js +2 -2
- package/lib/components/condition-builder/Expression.js +2 -2
- package/lib/components/condition-builder/Field.js +2 -2
- package/lib/components/condition-builder/Formula.js +2 -2
- package/lib/components/condition-builder/Func.js +2 -2
- package/lib/components/condition-builder/Group.js +2 -2
- package/lib/components/condition-builder/GroupOrItem.js +2 -2
- package/lib/components/condition-builder/InputSwitch.js +2 -2
- package/lib/components/condition-builder/Item.js +2 -2
- package/lib/components/condition-builder/Value.js +2 -2
- package/lib/components/condition-builder/config.js +2 -2
- package/lib/components/condition-builder/index.d.ts +1 -1
- package/lib/components/condition-builder/index.js +2 -2
- package/lib/components/formula/Editor.d.ts +40 -40
- package/lib/components/formula/Editor.js +2 -2
- package/lib/components/formula/FuncList.js +2 -2
- package/lib/components/formula/Picker.d.ts +40 -40
- package/lib/components/formula/Picker.js +2 -2
- package/lib/components/formula/VariableList.js +2 -2
- package/lib/components/formula/plugin.js +2 -2
- package/lib/components/icons.d.ts +2 -1
- package/lib/components/icons.js +30 -14
- package/lib/components/index.d.ts +3 -1
- package/lib/components/json-schema/Array.js +2 -2
- package/lib/components/json-schema/Item.js +2 -2
- package/lib/components/json-schema/Object.js +2 -2
- package/lib/components/json-schema/index.js +2 -2
- package/lib/components/menu/MenuContext.d.ts +73 -0
- package/lib/components/menu/MenuContext.js +29 -0
- package/lib/components/menu/MenuItem.d.ts +84 -0
- package/lib/components/menu/MenuItem.js +135 -0
- package/lib/components/menu/SubMenu.d.ts +88 -0
- package/lib/components/menu/SubMenu.js +151 -0
- package/lib/components/menu/index.d.ts +246 -0
- package/lib/components/menu/index.js +328 -0
- package/lib/components/schema-editor/Array.js +2 -2
- package/lib/components/schema-editor/Common.js +2 -2
- package/lib/components/schema-editor/Item.js +2 -2
- package/lib/components/schema-editor/Object.js +2 -2
- package/lib/components/schema-editor/SchemaVariableList.js +2 -2
- package/lib/components/schema-editor/SchemaVariableListPicker.js +2 -2
- package/lib/components/schema-editor/index.d.ts +40 -40
- package/lib/components/schema-editor/index.js +2 -2
- package/lib/components/table/Cell.d.ts +40 -40
- package/lib/components/table/Cell.js +2 -2
- package/lib/components/table/HeadCellDropDown.js +2 -2
- package/lib/components/table/HeadCellFilter.d.ts +40 -40
- package/lib/components/table/HeadCellFilter.js +2 -2
- package/lib/components/table/HeadCellSelect.d.ts +40 -40
- package/lib/components/table/HeadCellSelect.js +2 -2
- package/lib/components/table/HeadCellSort.d.ts +2 -0
- package/lib/components/table/HeadCellSort.js +25 -17
- package/lib/components/table/ItemActionsWrapper.js +2 -2
- package/lib/components/table/index.d.ts +41 -40
- package/lib/components/table/index.js +16 -9
- package/lib/components/virtual-list/AutoSizer.js +2 -2
- package/lib/components/virtual-list/SizeAndPositionManager.js +2 -2
- package/lib/components/virtual-list/constants.js +2 -2
- package/lib/components/virtual-list/index.js +2 -2
- package/lib/hooks/use-set-state.js +2 -2
- package/lib/hooks/use-sub-form.js +2 -2
- package/lib/hooks/use-touch.js +2 -2
- package/lib/hooks/use-update-effect.js +2 -2
- package/lib/hooks/use-validation-resolver.js +2 -2
- package/lib/icons/alert-danger.svg.js +2 -2
- package/lib/icons/alert-info.svg.js +2 -2
- package/lib/icons/alert-success.svg.js +2 -2
- package/lib/icons/alert-warning.svg.js +2 -2
- package/lib/icons/back.svg.js +2 -2
- package/lib/icons/calendar.svg.js +2 -2
- package/lib/icons/caret.svg.js +2 -2
- package/lib/icons/check.svg.js +2 -2
- package/lib/icons/clock.svg.js +2 -2
- package/lib/icons/close-small.svg.js +2 -2
- package/lib/icons/close.svg.js +2 -2
- package/lib/icons/cloud-upload.svg.js +7 -16
- package/lib/icons/column-filter.svg.js +2 -2
- package/lib/icons/columns.svg.js +2 -2
- package/lib/icons/compress-alt.svg.js +2 -2
- package/lib/icons/copy.svg.js +2 -2
- package/lib/icons/date.svg.js +2 -2
- package/lib/icons/department.svg.js +2 -2
- package/lib/icons/desk-empty.svg.js +2 -2
- package/lib/icons/dot.svg.js +2 -2
- package/lib/icons/down-arrow-bold.svg.js +2 -2
- package/lib/icons/down.svg.js +2 -2
- package/lib/icons/download.svg.js +2 -2
- package/lib/icons/drag-bar.svg.js +2 -2
- package/lib/icons/drag.svg.js +2 -2
- package/lib/icons/edit.svg.js +2 -2
- package/lib/icons/ellipsis-v.svg.js +2 -2
- package/lib/icons/enter.svg.js +2 -2
- package/lib/icons/exchange.svg.js +2 -2
- package/lib/icons/expand-alt.svg.js +2 -2
- package/lib/icons/fail.svg.js +12 -10
- package/lib/icons/file.svg.js +2 -2
- package/lib/icons/filter.svg.js +2 -2
- package/lib/icons/folder.svg.js +2 -2
- package/lib/icons/function.svg.js +2 -2
- package/lib/icons/home.svg.js +2 -2
- package/lib/icons/image.svg.js +2 -2
- package/lib/icons/info-circle.svg.js +2 -2
- package/lib/icons/info.svg.js +2 -2
- package/lib/icons/input-clear.svg.js +2 -2
- package/lib/icons/invisible.svg.js +2 -2
- package/lib/icons/left-arrow.svg.js +2 -2
- package/lib/icons/loading-outline.svg.js +2 -2
- package/lib/icons/location.svg.js +2 -2
- package/lib/icons/menu.svg.js +2 -2
- package/lib/icons/minus.svg.js +2 -2
- package/lib/icons/move.svg.js +2 -2
- package/lib/icons/mute.svg.js +2 -2
- package/lib/icons/new-edit.svg.js +2 -2
- package/lib/icons/pause.svg.js +2 -2
- package/lib/icons/pencil.svg.js +2 -2
- package/lib/icons/play.svg.js +2 -2
- package/lib/icons/plus-cicle.svg.js +2 -2
- package/lib/icons/plus-fine.svg.js +2 -2
- package/lib/icons/plus.svg.js +2 -2
- package/lib/icons/post.svg.js +2 -2
- package/lib/icons/question-mark.svg.js +2 -2
- package/lib/icons/question.svg.js +2 -2
- package/lib/icons/redo.svg.js +2 -2
- package/lib/icons/refresh.svg.js +2 -2
- package/lib/icons/reload.svg.js +2 -2
- package/lib/icons/remove.svg.js +2 -2
- package/lib/icons/retry.svg.js +2 -2
- package/lib/icons/right-arrow-bold.svg.js +2 -2
- package/lib/icons/right-arrow.svg.js +2 -2
- package/lib/icons/right-double-arrow.svg.js +2 -2
- package/lib/icons/role.svg.js +2 -2
- package/lib/icons/rotate-left.svg.js +2 -2
- package/lib/icons/rotate-right.svg.js +2 -2
- package/lib/icons/scale-origin.svg.js +2 -2
- package/lib/icons/schedule.svg.js +2 -2
- package/lib/icons/search.svg.js +2 -2
- package/lib/icons/setting.svg.js +2 -2
- package/lib/icons/slider-handle-icon.svg.js +2 -2
- package/lib/icons/sort-asc.svg.js +2 -2
- package/lib/icons/sort-default.svg.js +2 -2
- package/lib/icons/sort-desc.svg.js +2 -2
- package/lib/icons/star.svg.js +2 -2
- package/lib/icons/status-close.svg.js +2 -2
- package/lib/icons/steps-finsh.svg.js +2 -2
- package/lib/icons/success.svg.js +29 -27
- package/lib/icons/transparent.svg.js +2 -2
- package/lib/icons/trash.svg.js +2 -2
- package/lib/icons/tree-down.svg.js +2 -2
- package/lib/icons/undo.svg.js +2 -2
- package/lib/icons/upload.svg.js +2 -2
- package/lib/icons/user-remove.svg.js +2 -2
- package/lib/icons/view.svg.js +2 -2
- package/lib/icons/volume.svg.js +2 -2
- package/lib/icons/warning-mark.svg.js +2 -2
- package/lib/icons/warning.svg.js +2 -2
- package/lib/icons/window-restore.svg.js +2 -2
- package/lib/icons/zoom-in.svg.js +2 -2
- package/lib/icons/zoom-out.svg.js +2 -2
- package/lib/index.js +6 -2
- package/lib/locale/de-DE.js +2 -2
- package/lib/locale/en-US.js +2 -2
- package/lib/locale/zh-CN.js +2 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +18 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +14 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +17 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +16 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/createClass.js +30 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/createSuper.js +29 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/defineProperty.js +27 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/extends.js +25 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +17 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/inherits.js +29 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +22 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +40 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +14 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +34 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +28 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +23 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +22 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +18 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +19 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +23 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +18 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/typeof.js +20 -0
- package/lib/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +21 -0
- package/lib/node_modules/rc-overflow/es/Item.js +117 -0
- package/lib/node_modules/rc-overflow/es/Overflow.js +368 -0
- package/lib/node_modules/rc-overflow/es/RawItem.js +75 -0
- package/lib/node_modules/rc-overflow/es/hooks/useBatchFrameState.js +55 -0
- package/lib/node_modules/rc-overflow/es/index.js +14 -0
- package/lib/node_modules/rc-resize-observer/es/Collection.js +66 -0
- package/lib/node_modules/rc-resize-observer/es/SingleObserver/DomWrapper.js +61 -0
- package/lib/node_modules/rc-resize-observer/es/SingleObserver/index.js +132 -0
- package/lib/node_modules/rc-resize-observer/es/index.js +61 -0
- package/lib/node_modules/rc-resize-observer/es/utils/observerUtil.js +53 -0
- package/lib/node_modules/rc-util/es/Children/toArray.js +36 -0
- package/lib/node_modules/rc-util/es/Dom/canUseDom.js +14 -0
- package/lib/node_modules/rc-util/es/Dom/findDOMNode.js +31 -0
- package/lib/node_modules/rc-util/es/hooks/useLayoutEffect.js +38 -0
- package/lib/node_modules/rc-util/es/hooks/useState.js +59 -0
- package/lib/node_modules/rc-util/es/raf.js +59 -0
- package/lib/node_modules/rc-util/es/ref.js +61 -0
- package/lib/node_modules/rc-util/es/warning.js +19 -0
- package/lib/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.js +199 -0
- package/lib/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.js +35 -0
- package/lib/node_modules/rc-util/node_modules/react-is/index.js +19 -0
- package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +937 -0
- package/lib/{scss → packages/amis-ui/scss}/helper.scss.js +2 -2
- package/lib/{scss → packages/amis-ui/scss}/themes/ang.scss.js +2 -2
- package/lib/{scss → packages/amis-ui/scss}/themes/antd.scss.js +2 -2
- package/lib/{scss → packages/amis-ui/scss}/themes/cxd.scss.js +2 -2
- package/lib/{scss → packages/amis-ui/scss}/themes/dark.scss.js +2 -2
- package/lib/{scss → packages/amis-ui/scss}/themes/default.scss.js +2 -2
- package/lib/themes/ang.css +4130 -873
- package/lib/themes/ang.js +2 -2
- package/lib/themes/antd.css +4130 -873
- package/lib/themes/antd.js +2 -2
- package/lib/themes/cxd.css +4131 -873
- package/lib/themes/cxd.js +2 -2
- package/lib/themes/dark.css +4130 -873
- package/lib/themes/dark.js +2 -2
- package/lib/themes/default.css +4131 -873
- package/package.json +5 -3
- package/scss/_components.scss +1752 -72
- package/scss/_mixins.scss +15 -6
- package/scss/_properties.scss +60 -314
- package/scss/base/_typography.scss +13 -0
- package/scss/components/_anchor-nav.scss +3 -3
- package/scss/components/_array-input.scss +1 -0
- package/scss/components/_button.scss +5 -0
- package/scss/components/_collapse-group.scss +2 -1
- package/scss/components/_collapse.scss +49 -35
- package/scss/components/_divider.scss +3 -3
- package/scss/components/_formula.scss +9 -1
- package/scss/components/_link.scss +15 -1
- package/scss/components/_menu.scss +1153 -0
- package/scss/components/_nav.scss +137 -82
- package/scss/components/_panel.scss +44 -17
- package/scss/components/_result-box.scss +4 -0
- package/scss/components/_tabs.scss +405 -137
- package/scss/components/form/_checks.scss +174 -14
- package/scss/components/form/_combo.scss +1 -0
- package/scss/components/form/_file.scss +59 -14
- package/scss/components/form/_form.scss +27 -28
- package/scss/components/form/_image.scss +95 -50
- package/scss/components/form/_list.scss +84 -1
- package/scss/components/form/_number.scss +247 -25
- package/scss/components/form/_range.scss +35 -13
- package/scss/components/form/_rating.scss +9 -3
- package/scss/components/form/_switch.scss +45 -47
- package/scss/components/form/_tag.scss +1 -0
- package/scss/components/form/_text.scss +189 -13
- package/scss/components/form/_textarea.scss +7 -9
- package/scss/components/form/_tree.scss +7 -2
- package/scss/themes/_ang-variables.scss +50 -50
- package/scss/themes/_antd-variables.scss +50 -50
- package/scss/themes/_common.scss +1 -0
- package/scss/themes/_cxd-variables.scss +51 -50
- package/scss/themes/_dark-variables.scss +50 -50
- package/esm/icons/check-circle.svg.js +0 -29
- package/esm/icons/status-fail.svg.js +0 -22
- package/esm/icons/status-info.svg.js +0 -26
- package/esm/icons/status-success.svg.js +0 -22
- package/esm/icons/status-warning.svg.js +0 -26
- package/lib/icons/check-circle.svg.js +0 -53
- package/lib/icons/status-fail.svg.js +0 -46
- package/lib/icons/status-info.svg.js +0 -50
- package/lib/icons/status-success.svg.js +0 -46
- package/lib/icons/status-warning.svg.js +0 -50
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _extends from '../../@babel/runtime/helpers/esm/extends.js';
|
|
7
|
+
import _objectSpread2 from '../../@babel/runtime/helpers/esm/objectSpread2.js';
|
|
8
|
+
import _slicedToArray from '../../@babel/runtime/helpers/esm/slicedToArray.js';
|
|
9
|
+
import _objectWithoutProperties from '../../@babel/runtime/helpers/esm/objectWithoutProperties.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
12
|
+
import cx from 'classnames';
|
|
13
|
+
import ResizeObserver from '../../rc-resize-observer/es/index.js';
|
|
14
|
+
import useLayoutEffect from '../../rc-util/es/hooks/useLayoutEffect.js';
|
|
15
|
+
import Item from './Item.js';
|
|
16
|
+
import { useBatchFrameState } from './hooks/useBatchFrameState.js';
|
|
17
|
+
import RawItem from './RawItem.js';
|
|
18
|
+
|
|
19
|
+
var _excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
|
|
20
|
+
var OverflowContext = /*#__PURE__*/React.createContext(null);
|
|
21
|
+
var RESPONSIVE = 'responsive';
|
|
22
|
+
var INVALIDATE = 'invalidate';
|
|
23
|
+
|
|
24
|
+
function defaultRenderRest(omittedItems) {
|
|
25
|
+
return "+ ".concat(omittedItems.length, " ...");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Overflow(props, ref) {
|
|
29
|
+
var _props$prefixCls = props.prefixCls,
|
|
30
|
+
prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls,
|
|
31
|
+
_props$data = props.data,
|
|
32
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
33
|
+
renderItem = props.renderItem,
|
|
34
|
+
renderRawItem = props.renderRawItem,
|
|
35
|
+
itemKey = props.itemKey,
|
|
36
|
+
_props$itemWidth = props.itemWidth,
|
|
37
|
+
itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth,
|
|
38
|
+
ssr = props.ssr,
|
|
39
|
+
style = props.style,
|
|
40
|
+
className = props.className,
|
|
41
|
+
maxCount = props.maxCount,
|
|
42
|
+
renderRest = props.renderRest,
|
|
43
|
+
renderRawRest = props.renderRawRest,
|
|
44
|
+
suffix = props.suffix,
|
|
45
|
+
_props$component = props.component,
|
|
46
|
+
Component = _props$component === void 0 ? 'div' : _props$component,
|
|
47
|
+
itemComponent = props.itemComponent,
|
|
48
|
+
onVisibleChange = props.onVisibleChange,
|
|
49
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
50
|
+
|
|
51
|
+
var createUseState = useBatchFrameState();
|
|
52
|
+
var fullySSR = ssr === 'full';
|
|
53
|
+
|
|
54
|
+
var _createUseState = createUseState(null),
|
|
55
|
+
_createUseState2 = _slicedToArray(_createUseState, 2),
|
|
56
|
+
containerWidth = _createUseState2[0],
|
|
57
|
+
setContainerWidth = _createUseState2[1];
|
|
58
|
+
|
|
59
|
+
var mergedContainerWidth = containerWidth || 0;
|
|
60
|
+
|
|
61
|
+
var _createUseState3 = createUseState(new Map()),
|
|
62
|
+
_createUseState4 = _slicedToArray(_createUseState3, 2),
|
|
63
|
+
itemWidths = _createUseState4[0],
|
|
64
|
+
setItemWidths = _createUseState4[1];
|
|
65
|
+
|
|
66
|
+
var _createUseState5 = createUseState(0),
|
|
67
|
+
_createUseState6 = _slicedToArray(_createUseState5, 2),
|
|
68
|
+
prevRestWidth = _createUseState6[0],
|
|
69
|
+
setPrevRestWidth = _createUseState6[1];
|
|
70
|
+
|
|
71
|
+
var _createUseState7 = createUseState(0),
|
|
72
|
+
_createUseState8 = _slicedToArray(_createUseState7, 2),
|
|
73
|
+
restWidth = _createUseState8[0],
|
|
74
|
+
setRestWidth = _createUseState8[1];
|
|
75
|
+
|
|
76
|
+
var _createUseState9 = createUseState(0),
|
|
77
|
+
_createUseState10 = _slicedToArray(_createUseState9, 2),
|
|
78
|
+
suffixWidth = _createUseState10[0],
|
|
79
|
+
setSuffixWidth = _createUseState10[1];
|
|
80
|
+
|
|
81
|
+
var _useState = useState(null),
|
|
82
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
83
|
+
suffixFixedStart = _useState2[0],
|
|
84
|
+
setSuffixFixedStart = _useState2[1];
|
|
85
|
+
|
|
86
|
+
var _useState3 = useState(null),
|
|
87
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
88
|
+
displayCount = _useState4[0],
|
|
89
|
+
setDisplayCount = _useState4[1];
|
|
90
|
+
|
|
91
|
+
var mergedDisplayCount = React.useMemo(function () {
|
|
92
|
+
if (displayCount === null && fullySSR) {
|
|
93
|
+
return Number.MAX_SAFE_INTEGER;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return displayCount || 0;
|
|
97
|
+
}, [displayCount, containerWidth]);
|
|
98
|
+
|
|
99
|
+
var _useState5 = useState(false),
|
|
100
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
101
|
+
restReady = _useState6[0],
|
|
102
|
+
setRestReady = _useState6[1];
|
|
103
|
+
|
|
104
|
+
var itemPrefixCls = "".concat(prefixCls, "-item"); // Always use the max width to avoid blink
|
|
105
|
+
|
|
106
|
+
var mergedRestWidth = Math.max(prevRestWidth, restWidth); // ================================= Data =================================
|
|
107
|
+
|
|
108
|
+
var isResponsive = maxCount === RESPONSIVE;
|
|
109
|
+
var shouldResponsive = data.length && isResponsive;
|
|
110
|
+
var invalidate = maxCount === INVALIDATE;
|
|
111
|
+
/**
|
|
112
|
+
* When is `responsive`, we will always render rest node to get the real width of it for calculation
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount;
|
|
116
|
+
var mergedData = useMemo(function () {
|
|
117
|
+
var items = data;
|
|
118
|
+
|
|
119
|
+
if (shouldResponsive) {
|
|
120
|
+
if (containerWidth === null && fullySSR) {
|
|
121
|
+
items = data;
|
|
122
|
+
} else {
|
|
123
|
+
items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
|
|
124
|
+
}
|
|
125
|
+
} else if (typeof maxCount === 'number') {
|
|
126
|
+
items = data.slice(0, maxCount);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return items;
|
|
130
|
+
}, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
|
|
131
|
+
var omittedItems = useMemo(function () {
|
|
132
|
+
if (shouldResponsive) {
|
|
133
|
+
return data.slice(mergedDisplayCount + 1);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return data.slice(mergedData.length);
|
|
137
|
+
}, [data, mergedData, shouldResponsive, mergedDisplayCount]); // ================================= Item =================================
|
|
138
|
+
|
|
139
|
+
var getKey = useCallback(function (item, index) {
|
|
140
|
+
var _ref;
|
|
141
|
+
|
|
142
|
+
if (typeof itemKey === 'function') {
|
|
143
|
+
return itemKey(item);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index;
|
|
147
|
+
}, [itemKey]);
|
|
148
|
+
var mergedRenderItem = useCallback(renderItem || function (item) {
|
|
149
|
+
return item;
|
|
150
|
+
}, [renderItem]);
|
|
151
|
+
|
|
152
|
+
function updateDisplayCount(count, suffixFixedStartVal, notReady) {
|
|
153
|
+
// React 18 will sync render even when the value is same in some case.
|
|
154
|
+
// We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
|
|
155
|
+
// ref: https://github.com/ant-design/ant-design/issues/36559
|
|
156
|
+
if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
setDisplayCount(count);
|
|
161
|
+
|
|
162
|
+
if (!notReady) {
|
|
163
|
+
setRestReady(count < data.length - 1);
|
|
164
|
+
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (suffixFixedStartVal !== undefined) {
|
|
168
|
+
setSuffixFixedStart(suffixFixedStartVal);
|
|
169
|
+
}
|
|
170
|
+
} // ================================= Size =================================
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
function onOverflowResize(_, element) {
|
|
174
|
+
setContainerWidth(element.clientWidth);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function registerSize(key, width) {
|
|
178
|
+
setItemWidths(function (origin) {
|
|
179
|
+
var clone = new Map(origin);
|
|
180
|
+
|
|
181
|
+
if (width === null) {
|
|
182
|
+
clone.delete(key);
|
|
183
|
+
} else {
|
|
184
|
+
clone.set(key, width);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return clone;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function registerOverflowSize(_, width) {
|
|
192
|
+
setRestWidth(width);
|
|
193
|
+
setPrevRestWidth(restWidth);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function registerSuffixSize(_, width) {
|
|
197
|
+
setSuffixWidth(width);
|
|
198
|
+
} // ================================ Effect ================================
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
function getItemWidth(index) {
|
|
202
|
+
return itemWidths.get(getKey(mergedData[index], index));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
useLayoutEffect(function () {
|
|
206
|
+
if (mergedContainerWidth && mergedRestWidth && mergedData) {
|
|
207
|
+
var totalWidth = suffixWidth;
|
|
208
|
+
var len = mergedData.length;
|
|
209
|
+
var lastIndex = len - 1; // When data count change to 0, reset this since not loop will reach
|
|
210
|
+
|
|
211
|
+
if (!len) {
|
|
212
|
+
updateDisplayCount(0, null);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
for (var i = 0; i < len; i += 1) {
|
|
217
|
+
var currentItemWidth = getItemWidth(i); // Fully will always render
|
|
218
|
+
|
|
219
|
+
if (fullySSR) {
|
|
220
|
+
currentItemWidth = currentItemWidth || 0;
|
|
221
|
+
} // Break since data not ready
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if (currentItemWidth === undefined) {
|
|
225
|
+
updateDisplayCount(i - 1, undefined, true);
|
|
226
|
+
break;
|
|
227
|
+
} // Find best match
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
totalWidth += currentItemWidth;
|
|
231
|
+
|
|
232
|
+
if ( // Only one means `totalWidth` is the final width
|
|
233
|
+
lastIndex === 0 && totalWidth <= mergedContainerWidth || // Last two width will be the final width
|
|
234
|
+
i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) {
|
|
235
|
+
// Additional check if match the end
|
|
236
|
+
updateDisplayCount(lastIndex, null);
|
|
237
|
+
break;
|
|
238
|
+
} else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
|
|
239
|
+
// Can not hold all the content to show rest
|
|
240
|
+
updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
|
|
246
|
+
setSuffixFixedStart(null);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]); // ================================ Render ================================
|
|
250
|
+
|
|
251
|
+
var displayRest = restReady && !!omittedItems.length;
|
|
252
|
+
var suffixStyle = {};
|
|
253
|
+
|
|
254
|
+
if (suffixFixedStart !== null && shouldResponsive) {
|
|
255
|
+
suffixStyle = {
|
|
256
|
+
position: 'absolute',
|
|
257
|
+
left: suffixFixedStart,
|
|
258
|
+
top: 0
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var itemSharedProps = {
|
|
263
|
+
prefixCls: itemPrefixCls,
|
|
264
|
+
responsive: shouldResponsive,
|
|
265
|
+
component: itemComponent,
|
|
266
|
+
invalidate: invalidate
|
|
267
|
+
}; // >>>>> Choice render fun by `renderRawItem`
|
|
268
|
+
|
|
269
|
+
var internalRenderItemNode = renderRawItem ? function (item, index) {
|
|
270
|
+
var key = getKey(item, index);
|
|
271
|
+
return /*#__PURE__*/React.createElement(OverflowContext.Provider, {
|
|
272
|
+
key: key,
|
|
273
|
+
value: _objectSpread2(_objectSpread2({}, itemSharedProps), {}, {
|
|
274
|
+
order: index,
|
|
275
|
+
item: item,
|
|
276
|
+
itemKey: key,
|
|
277
|
+
registerSize: registerSize,
|
|
278
|
+
display: index <= mergedDisplayCount
|
|
279
|
+
})
|
|
280
|
+
}, renderRawItem(item, index));
|
|
281
|
+
} : function (item, index) {
|
|
282
|
+
var key = getKey(item, index);
|
|
283
|
+
return /*#__PURE__*/React.createElement(Item, _extends({}, itemSharedProps, {
|
|
284
|
+
order: index,
|
|
285
|
+
key: key,
|
|
286
|
+
item: item,
|
|
287
|
+
renderItem: mergedRenderItem,
|
|
288
|
+
itemKey: key,
|
|
289
|
+
registerSize: registerSize,
|
|
290
|
+
display: index <= mergedDisplayCount
|
|
291
|
+
}));
|
|
292
|
+
}; // >>>>> Rest node
|
|
293
|
+
|
|
294
|
+
var restNode;
|
|
295
|
+
var restContextProps = {
|
|
296
|
+
order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
|
|
297
|
+
className: "".concat(itemPrefixCls, "-rest"),
|
|
298
|
+
registerSize: registerOverflowSize,
|
|
299
|
+
display: displayRest
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
if (!renderRawRest) {
|
|
303
|
+
var mergedRenderRest = renderRest || defaultRenderRest;
|
|
304
|
+
restNode = /*#__PURE__*/React.createElement(Item, _extends({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest);
|
|
305
|
+
} else if (renderRawRest) {
|
|
306
|
+
restNode = /*#__PURE__*/React.createElement(OverflowContext.Provider, {
|
|
307
|
+
value: _objectSpread2(_objectSpread2({}, itemSharedProps), restContextProps)
|
|
308
|
+
}, renderRawRest(omittedItems));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
var overflowNode = /*#__PURE__*/React.createElement(Component, _extends({
|
|
312
|
+
className: cx(!invalidate && prefixCls, className),
|
|
313
|
+
style: style,
|
|
314
|
+
ref: ref
|
|
315
|
+
}, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/React.createElement(Item, _extends({}, itemSharedProps, {
|
|
316
|
+
responsive: isResponsive,
|
|
317
|
+
responsiveDisabled: !shouldResponsive,
|
|
318
|
+
order: mergedDisplayCount,
|
|
319
|
+
className: "".concat(itemPrefixCls, "-suffix"),
|
|
320
|
+
registerSize: registerSuffixSize,
|
|
321
|
+
display: true,
|
|
322
|
+
style: suffixStyle
|
|
323
|
+
}), suffix));
|
|
324
|
+
|
|
325
|
+
if (isResponsive) {
|
|
326
|
+
overflowNode = /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
327
|
+
onResize: onOverflowResize,
|
|
328
|
+
disabled: !shouldResponsive
|
|
329
|
+
}, overflowNode);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return overflowNode;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var ForwardOverflow = /*#__PURE__*/React.forwardRef(Overflow);
|
|
336
|
+
ForwardOverflow.displayName = 'Overflow';
|
|
337
|
+
ForwardOverflow.Item = RawItem;
|
|
338
|
+
ForwardOverflow.RESPONSIVE = RESPONSIVE;
|
|
339
|
+
ForwardOverflow.INVALIDATE = INVALIDATE; // Convert to generic type
|
|
340
|
+
|
|
341
|
+
export { OverflowContext, ForwardOverflow as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _extends from '../../@babel/runtime/helpers/esm/extends.js';
|
|
7
|
+
import _objectWithoutProperties from '../../@babel/runtime/helpers/esm/objectWithoutProperties.js';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import cx from 'classnames';
|
|
10
|
+
import Item from './Item.js';
|
|
11
|
+
import { OverflowContext } from './Overflow.js';
|
|
12
|
+
|
|
13
|
+
var _excluded = ["component"],
|
|
14
|
+
_excluded2 = ["className"],
|
|
15
|
+
_excluded3 = ["className"];
|
|
16
|
+
|
|
17
|
+
var InternalRawItem = function InternalRawItem(props, ref) {
|
|
18
|
+
var context = React.useContext(OverflowContext); // Render directly when context not provided
|
|
19
|
+
|
|
20
|
+
if (!context) {
|
|
21
|
+
var _props$component = props.component,
|
|
22
|
+
Component = _props$component === void 0 ? 'div' : _props$component,
|
|
23
|
+
_restProps = _objectWithoutProperties(props, _excluded);
|
|
24
|
+
|
|
25
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, _restProps, {
|
|
26
|
+
ref: ref
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var contextClassName = context.className,
|
|
31
|
+
restContext = _objectWithoutProperties(context, _excluded2);
|
|
32
|
+
|
|
33
|
+
var className = props.className,
|
|
34
|
+
restProps = _objectWithoutProperties(props, _excluded3); // Do not pass context to sub item to avoid multiple measure
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(OverflowContext.Provider, {
|
|
38
|
+
value: null
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Item, _extends({
|
|
40
|
+
ref: ref,
|
|
41
|
+
className: cx(contextClassName, className)
|
|
42
|
+
}, restContext, restProps)));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var RawItem = /*#__PURE__*/React.forwardRef(InternalRawItem);
|
|
46
|
+
RawItem.displayName = 'RawItem';
|
|
47
|
+
|
|
48
|
+
export { RawItem as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _slicedToArray from '../../../@babel/runtime/helpers/esm/slicedToArray.js';
|
|
7
|
+
import { useRef } from 'react';
|
|
8
|
+
import wrapperRaf from '../../../rc-util/es/raf.js';
|
|
9
|
+
import useSafeState from '../../../rc-util/es/hooks/useState.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* State generate. Return a `setState` but it will flush all state with one render to save perf.
|
|
13
|
+
* This is not a realization of `unstable_batchedUpdates`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function useBatchFrameState() {
|
|
17
|
+
var _useState = useSafeState({}),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
forceUpdate = _useState2[1];
|
|
20
|
+
|
|
21
|
+
var statesRef = useRef([]);
|
|
22
|
+
var walkingIndex = 0;
|
|
23
|
+
var beforeFrameId = 0;
|
|
24
|
+
|
|
25
|
+
function createState(defaultValue) {
|
|
26
|
+
var myIndex = walkingIndex;
|
|
27
|
+
walkingIndex += 1; // Fill value if not exist yet
|
|
28
|
+
|
|
29
|
+
if (statesRef.current.length < myIndex + 1) {
|
|
30
|
+
statesRef.current[myIndex] = defaultValue;
|
|
31
|
+
} // Return filled as `setState`
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var value = statesRef.current[myIndex];
|
|
35
|
+
|
|
36
|
+
function setValue(val) {
|
|
37
|
+
statesRef.current[myIndex] = typeof val === 'function' ? val(statesRef.current[myIndex]) : val;
|
|
38
|
+
wrapperRaf.cancel(beforeFrameId); // Flush with batch
|
|
39
|
+
|
|
40
|
+
beforeFrameId = wrapperRaf(function () {
|
|
41
|
+
forceUpdate({}, true);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return [value, setValue];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return createState;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { useBatchFrameState };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
var CollectionContext = /*#__PURE__*/React.createContext(null);
|
|
9
|
+
/**
|
|
10
|
+
* Collect all the resize event from children ResizeObserver
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
function Collection(_ref) {
|
|
14
|
+
var children = _ref.children,
|
|
15
|
+
onBatchResize = _ref.onBatchResize;
|
|
16
|
+
var resizeIdRef = React.useRef(0);
|
|
17
|
+
var resizeInfosRef = React.useRef([]);
|
|
18
|
+
var onCollectionResize = React.useContext(CollectionContext);
|
|
19
|
+
var onResize = React.useCallback(function (size, element, data) {
|
|
20
|
+
resizeIdRef.current += 1;
|
|
21
|
+
var currentId = resizeIdRef.current;
|
|
22
|
+
resizeInfosRef.current.push({
|
|
23
|
+
size: size,
|
|
24
|
+
element: element,
|
|
25
|
+
data: data
|
|
26
|
+
});
|
|
27
|
+
Promise.resolve().then(function () {
|
|
28
|
+
if (currentId === resizeIdRef.current) {
|
|
29
|
+
onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current);
|
|
30
|
+
resizeInfosRef.current = [];
|
|
31
|
+
}
|
|
32
|
+
}); // Continue bubbling if parent exist
|
|
33
|
+
|
|
34
|
+
onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data);
|
|
35
|
+
}, [onBatchResize, onCollectionResize]);
|
|
36
|
+
return /*#__PURE__*/React.createElement(CollectionContext.Provider, {
|
|
37
|
+
value: onResize
|
|
38
|
+
}, children);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Collection, CollectionContext };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _classCallCheck from '../../../@babel/runtime/helpers/esm/classCallCheck.js';
|
|
7
|
+
import _createClass from '../../../@babel/runtime/helpers/esm/createClass.js';
|
|
8
|
+
import _inherits from '../../../@babel/runtime/helpers/esm/inherits.js';
|
|
9
|
+
import _createSuper from '../../../@babel/runtime/helpers/esm/createSuper.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Fallback to findDOMNode if origin ref do not provide any dom element
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var DomWrapper = /*#__PURE__*/function (_React$Component) {
|
|
17
|
+
_inherits(DomWrapper, _React$Component);
|
|
18
|
+
|
|
19
|
+
var _super = _createSuper(DomWrapper);
|
|
20
|
+
|
|
21
|
+
function DomWrapper() {
|
|
22
|
+
_classCallCheck(this, DomWrapper);
|
|
23
|
+
|
|
24
|
+
return _super.apply(this, arguments);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_createClass(DomWrapper, [{
|
|
28
|
+
key: "render",
|
|
29
|
+
value: function render() {
|
|
30
|
+
return this.props.children;
|
|
31
|
+
}
|
|
32
|
+
}]);
|
|
33
|
+
|
|
34
|
+
return DomWrapper;
|
|
35
|
+
}(React.Component);
|
|
36
|
+
|
|
37
|
+
export { DomWrapper as default };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _objectSpread2 from '../../../@babel/runtime/helpers/esm/objectSpread2.js';
|
|
7
|
+
import { supportRef, composeRef } from '../../../rc-util/es/ref.js';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import findDOMNode from '../../../rc-util/es/Dom/findDOMNode.js';
|
|
10
|
+
import { observe, unobserve } from '../utils/observerUtil.js';
|
|
11
|
+
import DomWrapper from './DomWrapper.js';
|
|
12
|
+
import { CollectionContext } from '../Collection.js';
|
|
13
|
+
|
|
14
|
+
function SingleObserver(props) {
|
|
15
|
+
var children = props.children,
|
|
16
|
+
disabled = props.disabled;
|
|
17
|
+
var elementRef = React.useRef(null);
|
|
18
|
+
var wrapperRef = React.useRef(null);
|
|
19
|
+
var onCollectionResize = React.useContext(CollectionContext); // =========================== Children ===========================
|
|
20
|
+
|
|
21
|
+
var isRenderProps = typeof children === 'function';
|
|
22
|
+
var mergedChildren = isRenderProps ? children(elementRef) : children; // ============================= Size =============================
|
|
23
|
+
|
|
24
|
+
var sizeRef = React.useRef({
|
|
25
|
+
width: -1,
|
|
26
|
+
height: -1,
|
|
27
|
+
offsetWidth: -1,
|
|
28
|
+
offsetHeight: -1
|
|
29
|
+
}); // ============================= Ref ==============================
|
|
30
|
+
|
|
31
|
+
var canRef = !isRenderProps && /*#__PURE__*/React.isValidElement(mergedChildren) && supportRef(mergedChildren);
|
|
32
|
+
var originRef = canRef ? mergedChildren.ref : null;
|
|
33
|
+
var mergedRef = React.useMemo(function () {
|
|
34
|
+
return composeRef(originRef, elementRef);
|
|
35
|
+
}, [originRef, elementRef]); // =========================== Observe ============================
|
|
36
|
+
|
|
37
|
+
var propsRef = React.useRef(props);
|
|
38
|
+
propsRef.current = props; // Handler
|
|
39
|
+
|
|
40
|
+
var onInternalResize = React.useCallback(function (target) {
|
|
41
|
+
var _propsRef$current = propsRef.current,
|
|
42
|
+
onResize = _propsRef$current.onResize,
|
|
43
|
+
data = _propsRef$current.data;
|
|
44
|
+
|
|
45
|
+
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
46
|
+
width = _target$getBoundingCl.width,
|
|
47
|
+
height = _target$getBoundingCl.height;
|
|
48
|
+
|
|
49
|
+
var offsetWidth = target.offsetWidth,
|
|
50
|
+
offsetHeight = target.offsetHeight;
|
|
51
|
+
/**
|
|
52
|
+
* Resize observer trigger when content size changed.
|
|
53
|
+
* In most case we just care about element size,
|
|
54
|
+
* let's use `boundary` instead of `contentRect` here to avoid shaking.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
var fixedWidth = Math.floor(width);
|
|
58
|
+
var fixedHeight = Math.floor(height);
|
|
59
|
+
|
|
60
|
+
if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
|
|
61
|
+
var size = {
|
|
62
|
+
width: fixedWidth,
|
|
63
|
+
height: fixedHeight,
|
|
64
|
+
offsetWidth: offsetWidth,
|
|
65
|
+
offsetHeight: offsetHeight
|
|
66
|
+
};
|
|
67
|
+
sizeRef.current = size; // IE is strange, right?
|
|
68
|
+
|
|
69
|
+
var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
|
|
70
|
+
var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
|
|
71
|
+
|
|
72
|
+
var sizeInfo = _objectSpread2(_objectSpread2({}, size), {}, {
|
|
73
|
+
offsetWidth: mergedOffsetWidth,
|
|
74
|
+
offsetHeight: mergedOffsetHeight
|
|
75
|
+
}); // Let collection know what happened
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data);
|
|
79
|
+
|
|
80
|
+
if (onResize) {
|
|
81
|
+
// defer the callback but not defer to next frame
|
|
82
|
+
Promise.resolve().then(function () {
|
|
83
|
+
onResize(sizeInfo, target);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, []); // Dynamic observe
|
|
88
|
+
|
|
89
|
+
React.useEffect(function () {
|
|
90
|
+
var currentElement = findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current);
|
|
91
|
+
|
|
92
|
+
if (currentElement && !disabled) {
|
|
93
|
+
observe(currentElement, onInternalResize);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return function () {
|
|
97
|
+
return unobserve(currentElement, onInternalResize);
|
|
98
|
+
};
|
|
99
|
+
}, [elementRef.current, disabled]); // ============================ Render ============================
|
|
100
|
+
|
|
101
|
+
return /*#__PURE__*/React.createElement(DomWrapper, {
|
|
102
|
+
ref: wrapperRef
|
|
103
|
+
}, canRef ? /*#__PURE__*/React.cloneElement(mergedChildren, {
|
|
104
|
+
ref: mergedRef
|
|
105
|
+
}) : mergedChildren);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { SingleObserver as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-ui v2.7.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import _extends from '../../@babel/runtime/helpers/esm/extends.js';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import toArray from '../../rc-util/es/Children/toArray.js';
|
|
9
|
+
import { warning } from '../../rc-util/es/warning.js';
|
|
10
|
+
import SingleObserver from './SingleObserver/index.js';
|
|
11
|
+
import { Collection } from './Collection.js';
|
|
12
|
+
|
|
13
|
+
var INTERNAL_PREFIX_KEY = 'rc-observer-key';
|
|
14
|
+
|
|
15
|
+
function ResizeObserver(props) {
|
|
16
|
+
var children = props.children;
|
|
17
|
+
var childNodes = typeof children === 'function' ? [children] : toArray(children);
|
|
18
|
+
|
|
19
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
20
|
+
if (childNodes.length > 1) {
|
|
21
|
+
warning(false, 'Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead.');
|
|
22
|
+
} else if (childNodes.length === 0) {
|
|
23
|
+
warning(false, '`children` of ResizeObserver is empty. Nothing is in observe.');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return childNodes.map(function (child, index) {
|
|
28
|
+
var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index);
|
|
29
|
+
return /*#__PURE__*/React.createElement(SingleObserver, _extends({}, props, {
|
|
30
|
+
key: key
|
|
31
|
+
}), child);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ResizeObserver.Collection = Collection;
|
|
36
|
+
|
|
37
|
+
export { ResizeObserver as default };
|