plain-design 1.0.0-beta.10 → 1.0.0-beta.101
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/plain-design.commonjs.min.js +3 -3
- package/dist/plain-design.min.css +63 -48
- package/dist/plain-design.min.js +3 -3
- package/dist/report.html +5 -5
- package/package.json +49 -47
- package/src/packages/build.ts +2 -10
- package/src/packages/components/$address/createAddressService.tsx +20 -1
- package/src/packages/components/$file/index.tsx +1 -1
- package/src/packages/components/$loading/index.tsx +3 -0
- package/src/packages/components/$message/image.service.utils.tsx +2 -2
- package/src/packages/components/$object/createObjectService.tsx +38 -24
- package/src/packages/components/$object/object.service.utils.ts +7 -3
- package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +108 -0
- package/src/packages/components/$previewer/image-previewer-fixed-container.scss +18 -0
- package/src/packages/components/$previewer/index.tsx +52 -0
- package/src/packages/components/$search/SearchFooter.tsx +32 -0
- package/src/packages/components/$search/SearchList.tsx +207 -0
- package/src/packages/components/$search/SearchServicePanel.tsx +233 -0
- package/src/packages/components/$search/createSearchService.tsx +43 -0
- package/src/packages/components/$search/index.tsx +6 -0
- package/src/packages/components/$search/search-service.scss +220 -0
- package/src/packages/components/$search/search.utils.tsx +112 -0
- package/src/packages/components/$upload/createUploadService.tsx +1 -1
- package/src/packages/components/AddressCascade/createAddressCascade.multiple.tsx +1 -0
- package/src/packages/components/AddressCascade/createAddressCascade.single.tsx +1 -0
- package/src/packages/components/AddressCascade/index.tsx +2 -0
- package/src/packages/components/Alert/alert.scss +7 -4
- package/src/packages/components/Alert/index.tsx +4 -4
- package/src/packages/components/Application/index.tsx +6 -3
- package/src/packages/components/Application/service/createApplicationServiceManager.tsx +5 -2
- package/src/packages/components/Application/service/useApplicationService.tsx +2 -0
- package/src/packages/components/Application/theme/theme.ts +50 -28
- package/src/packages/components/Application/utils/application.utils.ts +2 -6
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +17 -4
- package/src/packages/components/AutoLoadingObserver/index.tsx +173 -0
- package/src/packages/components/AutoTable/AutoTable.tsx +1 -1
- package/src/packages/components/AutoTable/auto-table.scss +62 -20
- package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +6 -7
- package/src/packages/components/AutoTable/filter/useTableOption.filter.search.tsx +5 -5
- package/src/packages/components/AutoTable/setting/useTableOption.setting.all.fitler.tsx +4 -4
- package/src/packages/components/AutoTable/setting/useTableOption.setting.cache.tsx +16 -16
- package/src/packages/components/AutoTable/setting/useTableOption.setting.config.tsx +11 -11
- package/src/packages/components/AutoTable/setting/useTableOption.setting.export.tsx +20 -20
- package/src/packages/components/AutoTable/setting/useTableOption.setting.import.tsx +1 -1
- package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.filter.tsx +11 -11
- package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.sort.tsx +7 -7
- package/src/packages/components/AutoTable/setting/useTableOption.setting.tsx +2 -2
- package/src/packages/components/AutoTable/use/useTableOption.buttons.tsx +30 -18
- package/src/packages/components/AutoTable/use/useTableOption.cache.ts +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.check.tsx +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.column.popper.tsx +10 -9
- package/src/packages/components/AutoTable/use/useTableOption.confirm.tsx +3 -3
- package/src/packages/components/AutoTable/use/useTableOption.fill.tsx +2 -1
- package/src/packages/components/AutoTable/use/useTableOption.hooks.tsx +9 -1
- package/src/packages/components/AutoTable/use/useTableOption.loading.tsx +9 -3
- package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +19 -17
- package/src/packages/components/AutoTable/use/useTableOption.pagination.tsx +8 -3
- package/src/packages/components/AutoTable/use/useTableOption.sort.ts +5 -5
- package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +10 -3
- package/src/packages/components/AutoTable/use/useTableOption.tips.tsx +1 -1
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +4 -0
- package/src/packages/components/AutoTable/utils/TableOption.utils.tsx +1 -1
- package/src/packages/components/Badge/badge.scss +1 -1
- package/src/packages/components/Box/box.scss +6 -0
- package/src/packages/components/Box/index.tsx +30 -0
- package/src/packages/components/Button/button.scss +41 -9
- package/src/packages/components/Button/index.tsx +69 -11
- package/src/packages/components/ButtonGroup/button-group.scss +2 -2
- package/src/packages/components/ButtonGroup/index.tsx +1 -1
- package/src/packages/components/Card/card.scss +1 -1
- package/src/packages/components/Carousel/carousel.scss +391 -0
- package/src/packages/components/Carousel/index.tsx +569 -22
- package/src/packages/components/CarouselItem/index.tsx +77 -0
- package/src/packages/components/Cascade/cascade.scss +2 -2
- package/src/packages/components/Cascade/createMultipleCascadeRender.tsx +1 -1
- package/src/packages/components/Cascade/createSingleCascadeRender.tsx +2 -2
- package/src/packages/components/Cascade/index.tsx +1 -1
- package/src/packages/components/CascadePanel/flat/cascade-flat-panel.scss +22 -34
- package/src/packages/components/CascadePanel/flat/createCascadeFlatRender.tsx +1 -1
- package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +3 -3
- package/src/packages/components/Checkbox/checkbox.scss +4 -0
- package/src/packages/components/Checkbox/index.tsx +1 -1
- package/src/packages/components/CheckboxGroup/index.tsx +2 -2
- package/src/packages/components/CheckboxInner/checkbox-inner.scss +2 -1
- package/src/packages/components/ColorPicker/color-picker.scss +6 -0
- package/src/packages/components/ConfirmPopup/confirm-popup.scss +16 -0
- package/src/packages/components/ConfirmPopup/index.tsx +72 -0
- package/src/packages/components/Corner/corner.scss +14 -0
- package/src/packages/components/Corner/index.tsx +80 -0
- package/src/packages/components/DatePicker/createDateRender.multiple.tsx +1 -0
- package/src/packages/components/DatePicker/createDateRender.single.tsx +1 -0
- package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +33 -25
- package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +11 -3
- package/src/packages/components/DatePicker/date.scss +2 -2
- package/src/packages/components/DatePicker/date.utils.tsx +4 -3
- package/src/packages/components/DatePicker/index.tsx +2 -2
- package/src/packages/components/DatePicker/panel/DatePanelDate.tsx +7 -7
- package/src/packages/components/DatePicker/panel/DatePanelMonth.tsx +12 -12
- package/src/packages/components/DatePicker/useRangeDateRender.tsx +1 -0
- package/src/packages/components/Dialog/dialog.scss +7 -4
- package/src/packages/components/Dialog/index.tsx +15 -25
- package/src/packages/components/Dropdown/dropdown.public.scss +10 -0
- package/src/packages/components/Dropdown/dropdown.utils.tsx +4 -3
- package/src/packages/components/Dropdown/index.tsx +2 -2
- package/src/packages/components/DropdownOption/index.tsx +3 -3
- package/src/packages/components/DropdownSeparator/index.tsx +8 -0
- package/src/packages/components/Empty/index.tsx +1 -1
- package/src/packages/components/FilterFormMultiple/filter-form-multiple.scss +10 -1
- package/src/packages/components/FilterFormMultiple/index.tsx +34 -13
- package/src/packages/components/FilterFormSingle/index.tsx +9 -4
- package/src/packages/components/FilterService/filter/filter.city.tsx +4 -4
- package/src/packages/components/FilterService/filter/filter.date.tsx +4 -4
- package/src/packages/components/FilterService/filter/filter.datetime.tsx +2 -2
- package/src/packages/components/FilterService/filter/filter.district.tsx +4 -4
- package/src/packages/components/FilterService/filter/filter.number.tsx +1 -1
- package/src/packages/components/FilterService/filter/filter.province.tsx +4 -4
- package/src/packages/components/FilterService/filter/filter.select.tsx +3 -3
- package/src/packages/components/FilterService/filter/filter.text.tsx +4 -4
- package/src/packages/components/FilterService/filter/fitler.object.tsx +4 -4
- package/src/packages/components/FilterService/index.tsx +7 -7
- package/src/packages/components/FilterService/utils/filter.service.utils.ts +1 -1
- package/src/packages/components/Form/form.scss +85 -2
- package/src/packages/components/Form/index.tsx +10 -1
- package/src/packages/components/Form/layout/useFormLayout.tsx +88 -23
- package/src/packages/components/Form/types/any.tsx +6 -6
- package/src/packages/components/Form/types/array.tsx +7 -7
- package/src/packages/components/Form/types/date.tsx +6 -6
- package/src/packages/components/Form/types/email.tsx +1 -1
- package/src/packages/components/Form/types/idcard.tsx +1 -1
- package/src/packages/components/Form/types/number.tsx +7 -7
- package/src/packages/components/Form/types/phone.tsx +1 -1
- package/src/packages/components/Form/types/qq.tsx +1 -1
- package/src/packages/components/Form/types/string.tsx +7 -7
- package/src/packages/components/Form/validate/createValidation.tsx +6 -2
- package/src/packages/components/Form/validate/useFormValidation.tsx +21 -16
- package/src/packages/components/Form/validate/validate.utils.tsx +4 -1
- package/src/packages/components/FormItem/FormItemValidateMessage.tsx +16 -0
- package/src/packages/components/FormItem/index.tsx +31 -18
- package/src/packages/components/Formatter/index.tsx +1 -1
- package/src/packages/components/Grid/GridCol.tsx +4 -3
- package/src/packages/components/Grid/GridRow.tsx +42 -6
- package/src/packages/components/Grid/grid.scss +2 -2
- package/src/packages/components/Image/image.scss +5 -4
- package/src/packages/components/Image/index.tsx +15 -14
- package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +574 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerButtonBar.tsx +140 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +54 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +202 -0
- package/src/packages/components/ImagePreviewer/PreviewerLoading.tsx +26 -0
- package/src/packages/components/ImagePreviewer/image-previewer.scss +244 -0
- package/src/packages/components/ImagePreviewer/image-previewer.utils.tsx +136 -0
- package/src/packages/components/ImagePreviewer/index.tsx +5 -0
- package/src/packages/components/ImagePreviewer/previewer-loading.scss +52 -0
- package/src/packages/components/ImageUploader/index.tsx +10 -8
- package/src/packages/components/Input/index.scss +57 -13
- package/src/packages/components/Input/index.tsx +22 -6
- package/src/packages/components/Input/input.utils.ts +3 -2
- package/src/packages/components/Input/useMultipleInput.tsx +17 -92
- package/src/packages/components/Input/useSingleInput.tsx +15 -13
- package/src/packages/components/Input/useTextareaInput.tsx +23 -20
- package/src/packages/components/Input/uses/useInputEnterHandler.tsx +1 -1
- package/src/packages/components/Input/uses/useInputHooks.tsx +11 -11
- package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +12 -8
- package/src/packages/components/InputNumber/NumberResize.tsx +14 -1
- package/src/packages/components/InputNumber/index.tsx +1 -1
- package/src/packages/components/InputNumber/input-number.utils.tsx +7 -5
- package/src/packages/components/InputNumber/number.scss +17 -2
- package/src/packages/components/InputNumber/useInputNumber.public.tsx +25 -6
- package/src/packages/components/Loading/loading.scss +2 -0
- package/src/packages/components/LoadingMask/index.tsx +1 -1
- package/src/packages/components/Object/createObjectRender.multiple.tsx +1 -1
- package/src/packages/components/Object/createObjectRender.single.tsx +7 -3
- package/src/packages/components/Object/object.scss +15 -2
- package/src/packages/components/Object/object.utils.ts +3 -1
- package/src/packages/components/PageCard/index.tsx +48 -0
- package/src/packages/components/PageCard/page-card.scss +124 -0
- package/src/packages/components/PageCardContent/index.tsx +44 -0
- package/src/packages/components/PageCardTitle/index.tsx +51 -0
- package/src/packages/components/PageRenderList/index.tsx +22 -0
- package/src/packages/components/PageThemeUtils/deepmerge.ts +21 -0
- package/src/packages/components/PageThemeUtils/index.tsx +184 -49
- package/src/packages/components/Pagination/index.tsx +7 -7
- package/src/packages/components/Pagination/pagination.scss +4 -3
- package/src/packages/components/Paragraph/index.tsx +46 -0
- package/src/packages/components/Paragraph/paragraph.scss +12 -0
- package/src/packages/components/ParagraphItem/index.tsx +21 -0
- package/src/packages/components/PlcImage/index.tsx +8 -2
- package/src/packages/components/PlcObject/index.tsx +1 -1
- package/src/packages/components/PlcOv/index.tsx +14 -4
- package/src/packages/components/Popup/PopupProvider.tsx +1 -2
- package/src/packages/components/Popup/index.tsx +13 -3
- package/src/packages/components/ProgressBar/progress-bar.scss +1 -1
- package/src/packages/components/RollingNumber/index.tsx +66 -0
- package/src/packages/components/Scroll/index.tsx +47 -9
- package/src/packages/components/Scroll/scroll.scss +4 -2
- package/src/packages/components/Select/SelectPanel.tsx +4 -1
- package/src/packages/components/Select/createMultipleSelectRender.tsx +4 -4
- package/src/packages/components/Select/createPublicSelectRender.tsx +1 -1
- package/src/packages/components/Select/select.utils.tsx +1 -1
- package/src/packages/components/SelectDisplay/index.tsx +1 -1
- package/src/packages/components/SelectGroup/index.tsx +37 -0
- package/src/packages/components/Slider/index.tsx +1 -1
- package/src/packages/components/Slider/slider.scss +1 -1
- package/src/packages/components/SortList/index.tsx +191 -0
- package/src/packages/components/SortList/sort-list.scss +11 -0
- package/src/packages/components/Space/index.tsx +36 -0
- package/src/packages/components/Space/space.scss +39 -0
- package/src/packages/components/StackCard/index.tsx +416 -0
- package/src/packages/components/StackCard/stack-card.scss +40 -0
- package/src/packages/components/StackCardItem/index.tsx +24 -0
- package/src/packages/components/StepGroup/step-group.scss +9 -9
- package/src/packages/components/TabGroup/TabsInner.tsx +5 -3
- package/src/packages/components/TabGroup/header/horizontal/tabs-header-horizontal.scss +0 -1
- package/src/packages/components/TabGroup/index.tsx +5 -1
- package/src/packages/components/TabGroup/tabs.scss +26 -0
- package/src/packages/components/Table/editor/PlcAddress.tsx +7 -7
- package/src/packages/components/Table/editor/PlcDate.utils.tsx +1 -1
- package/src/packages/components/Table/editor/PlcTime.utils.ts +1 -1
- package/src/packages/components/Table/plc/use/useBasePlc.tsx +1 -1
- package/src/packages/components/Table/plc/useTablePlc.tsx +1 -1
- package/src/packages/components/Table/plc/utils/plc.utils.ts +1 -1
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.multiple.tsx +4 -4
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.tsx +1 -1
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.utils.ts +1 -1
- package/src/packages/components/Table/standard/PlcExpand.tsx +20 -22
- package/src/packages/components/Table/standard/PlcIndex.tsx +1 -1
- package/src/packages/components/Table/standard/PlcOperation/OuterOperation.tsx +5 -4
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +7 -7
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.utils.tsx +2 -0
- package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +5 -3
- package/src/packages/components/Table/standard/PlcTree/PlcTree.renderNode.tsx +7 -4
- package/src/packages/components/Table/standard/PlcTree/PlcTree.tsx +1 -1
- package/src/packages/components/Table/standard/PlcTree/PlcTree.utils.ts +1 -1
- package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +2 -1
- package/src/packages/components/Table/table/Table.tsx +11 -3
- package/src/packages/components/Table/table/body/cell.tsx +17 -12
- package/src/packages/components/Table/table/body/row.tsx +1 -1
- package/src/packages/components/Table/table/body/useCellValue.tsx +10 -6
- package/src/packages/components/Table/table/table.scss +20 -16
- package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +20 -8
- package/src/packages/components/Table/table/use/useTableDraggier.tsx +1 -1
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +6 -4
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +8 -8
- package/src/packages/components/Table/table/utils/createTableHooks.ts +4 -2
- package/src/packages/components/Table/table/utils/table.utils.ts +7 -1
- package/src/packages/components/ThemeColor/index.tsx +22 -0
- package/src/packages/components/ThemeColor/theme-color.scss +36 -0
- package/src/packages/components/ThemeColorSelector/index.tsx +53 -0
- package/src/packages/components/ThemeDarkSelector/index.tsx +37 -0
- package/src/packages/components/ThemeEditor/index.tsx +199 -0
- package/src/packages/components/ThemeEditor/theme-editor.scss +106 -0
- package/src/packages/components/ThemeLocaleSelector/index.tsx +41 -0
- package/src/packages/components/ThemeShapeSelector/index.tsx +55 -0
- package/src/packages/components/ThemeSizeSelector/index.tsx +50 -0
- package/src/packages/components/TimePicker/createRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSingleTimeRender.tsx +1 -0
- package/src/packages/components/TimePicker/index.tsx +1 -1
- package/src/packages/components/TimePicker/time.utils.ts +2 -1
- package/src/packages/components/TimePicker/useRangeTimeRender.tsx +1 -0
- package/src/packages/components/Toggle/index.tsx +6 -2
- package/src/packages/components/Toggle/toggle.scss +102 -98
- package/src/packages/components/Transition/index.tsx +2 -1
- package/src/packages/components/Tree/RenderTreeNode.tsx +7 -3
- package/src/packages/components/Tree/index.tsx +4 -3
- package/src/packages/components/Tree/tree.scss +8 -1
- package/src/packages/components/TreeCore/createTreeDraggier.tsx +62 -52
- package/src/packages/components/TreeCore/createTreeMethods.tsx +1 -0
- package/src/packages/components/TreeCore/createTreeProps.ts +1 -1
- package/src/packages/components/TreeCore/createTreeUtils.ts +1 -1
- package/src/packages/components/TreeNodeWithMenu/index.tsx +44 -6
- package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +1 -0
- package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
- package/src/packages/components/Upload/index.tsx +12 -12
- package/src/packages/components/VirtualList/createVirtualDraggier.ts +375 -0
- package/src/packages/components/VirtualList/index.tsx +56 -10
- package/src/packages/components/VirtualList/useVirtualList.tsx +239 -115
- package/src/packages/components/VirtualList/virtual-list.scss +41 -18
- package/src/packages/components/VirtualTable/index.tsx +29 -16
- package/src/packages/components/VirtualTable/virtual-table.scss +2 -3
- package/src/packages/components/createAutoScrollManager/index.tsx +41 -0
- package/src/packages/components/createHttp/index.tsx +4 -1
- package/src/packages/components/createPlainAddressService/index.tsx +12 -6
- package/src/packages/components/createRequestInterceptor/index.ts +139 -0
- package/src/packages/components/createScrollDraggier/index.ts +341 -0
- package/src/packages/components/createTransitionHandler/index.ts +46 -0
- package/src/packages/components/createVirtualDraggier/index.ts +5 -0
- package/src/packages/components/createWebDraggier/index.ts +5 -0
- package/src/packages/components/loadFile/index.ts +20 -0
- package/src/packages/components/useAutoScrollUtils/index.tsx +1 -1
- package/src/packages/components/useDialog/DialogService.tsx +22 -10
- package/src/packages/components/useDialog/index.tsx +2 -2
- package/src/packages/components/useImage/ImageService.tsx +35 -12
- package/src/packages/components/useLoading/LoadingService.tsx +106 -0
- package/src/packages/components/useLoading/index.tsx +31 -0
- package/src/packages/components/useLoading/loading.service.scss +25 -0
- package/src/packages/components/useLoading/loading.service.utils.tsx +13 -0
- package/src/packages/components/useMessage/Message.tsx +9 -3
- package/src/packages/components/useMessage/index.tsx +1 -1
- package/src/packages/components/useMessage/message.scss +7 -3
- package/src/packages/components/useNotice/Notice.tsx +4 -2
- package/src/packages/components/useNotice/index.tsx +2 -2
- package/src/packages/components/useNotice/notice.scss +3 -3
- package/src/packages/components/usePageRender/index.tsx +3 -0
- package/src/packages/components/usePageRenderContext/index.tsx +8 -0
- package/src/packages/components/usePopup/PopupItem.tsx +60 -28
- package/src/packages/components/usePopup/popup-item.scss +34 -3
- package/src/packages/components/usePopup/refresh/MaxMinTopLeft.ts +38 -0
- package/src/packages/components/usePopup/refresh/calcPosition.ts +7 -4
- package/src/packages/components/usePopup/refresh/refreshPopup.ts +3 -1
- package/src/packages/components/usePopup/trigger/useManagerTrigger.clickOutside.tsx +2 -2
- package/src/packages/components/usePopup/usePopup.tsx +23 -7
- package/src/packages/components/usePopup/usePopupManager.tsx +2 -1
- package/src/packages/components/usePopup/utils/popup.utils.ts +8 -4
- package/src/packages/components/useTooltip/index.tsx +14 -3
- package/src/packages/directives/ResizeDetector/index.tsx +10 -3
- package/src/packages/entry.tsx +95 -4
- package/src/packages/i18n/i18n.utils.ts +235 -111
- package/src/packages/i18n/index.ts +4 -3
- package/src/packages/i18n/lang/en-us.ts +257 -185
- package/src/packages/i18n/lang/zh-cn.ts +72 -0
- package/src/packages/styles/application/application.public.scss +7 -0
- package/src/packages/styles/global.import.scss +17 -1
- package/src/packages/uses/useCollapseStyles.tsx +56 -0
- package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
- package/src/packages/uses/useEdit.ts +5 -1
- package/src/packages/uses/useStyle.tsx +20 -6
- package/src/packages/utils/ComponentUtils.ts +10 -0
- package/src/packages/utils/buildCycleIndexList.ts +31 -0
- package/src/packages/utils/createDraggier.ts +256 -0
- package/src/packages/utils/createListUtils.ts +38 -0
- package/src/packages/utils/findReactElement.tsx +2 -2
- package/src/packages/utils/getDeviceInfo.ts +44 -44
- package/src/packages/utils/inheritSlots.ts +28 -0
- package/src/packages/utils/onParentElementsScroll.tsx +1 -1
- package/src/packages/utils/plainDate.ts +6 -2
- package/src/packages/utils/renderInputModeTextRangeValue.tsx +25 -0
- package/src/packages/utils/watchEffectAutoClear.ts +19 -7
- package/src/packages/components/CarouselGroup/carousel.scss +0 -143
- package/src/packages/components/CarouselGroup/index.tsx +0 -274
- package/src/packages/components/createProvider/index.ts +0 -5
- package/src/packages/utils/createProvider.tsx +0 -35
- package/src/packages/utils/doNothing.ts +0 -3
- package/src/packages/utils/findParentElement.ts +0 -12
- package/src/packages/utils/formatServiceOptions.ts +0 -7
- package/src/packages/utils/getElement.ts +0 -17
- package/src/packages/utils/getElementParents.ts +0 -9
- package/src/packages/utils/getScrollParent.ts +0 -11
- package/src/packages/utils/iterate.ts +0 -53
- package/src/packages/utils/omit.ts +0 -6
- package/src/packages/utils/pick.ts +0 -11
- package/src/packages/utils/runOnce.tsx +0 -14
- package/src/pages/data/address.json +0 -39317
- package/src/pages/data/data-1.json +0 -754
- package/src/pages/data/data-2.json +0 -3006
- package/src/pages/data/data-200.json +0 -5206
- package/src/pages/data/data-2000.json +0 -51954
- package/src/pages/data/data-50.json +0 -2075
- package/src/pages/data/data.json +0 -30002
- package/src/pages/data/demo.json +0 -1702
- package/src/pages/data/mock.database.js +0 -43
- package/src/pages/data/mock.js +0 -141
- package/src/pages/data/tree.data.json +0 -87
- package/src/pages/env/config/local.js +0 -3
- package/src/pages/env/config/prod.js +0 -3
- package/src/pages/env/config/undefined.js +0 -1
- package/src/pages/env/env.d.ts +0 -4
- package/src/pages/env/index.ts +0 -1
- package/src/pages/history/createHistory.ts +0 -94
- package/src/pages/history/history.utils.ts +0 -64
- package/src/pages/index/App.tsx +0 -17
- package/src/pages/index/Demo/DemoLine.tsx +0 -23
- package/src/pages/index/Demo/DemoRow.scss +0 -128
- package/src/pages/index/Demo/DemoRow.tsx +0 -71
- package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
- package/src/pages/index/Demo/DemoRowController.tsx +0 -45
- package/src/pages/index/Demo/index.ts +0 -8
- package/src/pages/index/app.scss +0 -197
- package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -51
- package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
- package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
- package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
- package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
- package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
- package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
- package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
- package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
- package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
- package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
- package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
- package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
- package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
- package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
- package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
- package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
- package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
- package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
- package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
- package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
- package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
- package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
- package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
- package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
- package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
- package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
- package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
- package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
- package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
- package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
- package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
- package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
- package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
- package/src/pages/index/components/normal/DemoButton.tsx +0 -300
- package/src/pages/index/components/normal/DemoCard.tsx +0 -176
- package/src/pages/index/components/normal/DemoCarousel.tsx +0 -125
- package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
- package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
- package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
- package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
- package/src/pages/index/components/normal/DemoColor.scss +0 -20
- package/src/pages/index/components/normal/DemoColor.tsx +0 -82
- package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
- package/src/pages/index/components/normal/DemoDate.tsx +0 -443
- package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
- package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
- package/src/pages/index/components/normal/DemoGrid.scss +0 -26
- package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
- package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
- package/src/pages/index/components/normal/DemoImage.tsx +0 -122
- package/src/pages/index/components/normal/DemoInput.scss +0 -0
- package/src/pages/index/components/normal/DemoInput.tsx +0 -790
- package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
- package/src/pages/index/components/normal/DemoLayout.tsx +0 -144
- package/src/pages/index/components/normal/DemoList.scss +0 -15
- package/src/pages/index/components/normal/DemoList.tsx +0 -82
- package/src/pages/index/components/normal/DemoLoading.tsx +0 -86
- package/src/pages/index/components/normal/DemoNumber.tsx +0 -266
- package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
- package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
- package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
- package/src/pages/index/components/normal/DemoRadio.scss +0 -16
- package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
- package/src/pages/index/components/normal/DemoRate.tsx +0 -77
- package/src/pages/index/components/normal/DemoScroll.scss +0 -22
- package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
- package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
- package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
- package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
- package/src/pages/index/components/normal/DemoStep.scss +0 -18
- package/src/pages/index/components/normal/DemoStep.tsx +0 -291
- package/src/pages/index/components/normal/DemoTab.tsx +0 -338
- package/src/pages/index/components/normal/DemoTag.tsx +0 -100
- package/src/pages/index/components/normal/DemoTime.tsx +0 -403
- package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
- package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
- package/src/pages/index/components/normal/DemoTree.tsx +0 -1168
- package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
- package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -378
- package/src/pages/index/components/service/DemoDialogService.tsx +0 -248
- package/src/pages/index/components/service/DemoFileService.tsx +0 -110
- package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
- package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
- package/src/pages/index/components/service/DemoPopupService.tsx +0 -325
- package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
- package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
- package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
- package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
- package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
- package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
- package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
- package/src/pages/index/components/table/DemoTableExpand.tsx +0 -181
- package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
- package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
- package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
- package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
- package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
- package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
- package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
- package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
- package/src/pages/index/components/test/DemoI18n.tsx +0 -27
- package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
- package/src/pages/index/home/AppContent.tsx +0 -69
- package/src/pages/index/home/AppHead.tsx +0 -105
- package/src/pages/index/home/AppHome.tsx +0 -16
- package/src/pages/index/home/AppMenu.tsx +0 -38
- package/src/pages/index/home/menus.tsx +0 -218
- package/src/pages/index/home/plain-design.png +0 -0
- package/src/pages/index/main.tsx +0 -23
- package/src/pages/index/nav/$nav.ts +0 -41
- package/src/pages/index/pages.d.ts +0 -6
- package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
- package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
- package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
- package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
- package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
- package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
- package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
- package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
- package/src/pages/libs/iconfont-symbol/demo.css +0 -539
- package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
- package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
- package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
- package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
- package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
- package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
- package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
- package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
- package/src/pages/libs/install.iconfont-symbol.scss +0 -7
- package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
- package/src/pages/module/address.ts +0 -27
- package/src/pages/module/http.ts +0 -24
- package/src/pages/module/index.ts +0 -19
- package/src/pages/module/object.ts +0 -5
- package/src/pages/module/ov.tsx +0 -13
- package/src/pages/module/upload.ts +0 -9
- package/src/pages/module/useTableOption.ts +0 -28
@@ -0,0 +1,140 @@
|
|
1
|
+
import {computed, designComponent, iMouseEvent, PropType, useClasses} from "plain-design-composition";
|
2
|
+
import Tooltip from "../Tooltip";
|
3
|
+
import {iImagePreviewerOption} from "./image-previewer.utils";
|
4
|
+
|
5
|
+
export const ImagePreviewerButtonBar = designComponent({
|
6
|
+
name: 'image-previewer-button-bar',
|
7
|
+
props: {
|
8
|
+
button: { type: [Boolean, Object] as PropType<iImagePreviewerOption['button']> }
|
9
|
+
},
|
10
|
+
emits: {
|
11
|
+
onZoomIn: () => true,
|
12
|
+
onZoomOut: () => true,
|
13
|
+
onAnticlockwise: () => true,
|
14
|
+
onClockwise: () => true,
|
15
|
+
onReset: () => true,
|
16
|
+
onClose: () => true,
|
17
|
+
},
|
18
|
+
setup({ props, event: { emit } }) {
|
19
|
+
|
20
|
+
const classes = useClasses(() => [
|
21
|
+
'image-previewer-button-bar'
|
22
|
+
]);
|
23
|
+
|
24
|
+
const buttonAvailable = computed((): Exclude<iImagePreviewerOption['button'], boolean | undefined> => {
|
25
|
+
if (props.button == null || props.button == true) {
|
26
|
+
return {
|
27
|
+
zoomIn: true,
|
28
|
+
zoomOut: true,
|
29
|
+
clockwise: true,
|
30
|
+
anticlockwise: true,
|
31
|
+
reset: true,
|
32
|
+
close: true,
|
33
|
+
};
|
34
|
+
}
|
35
|
+
if (props.button === false) {
|
36
|
+
return {
|
37
|
+
zoomIn: false,
|
38
|
+
zoomOut: false,
|
39
|
+
clockwise: false,
|
40
|
+
anticlockwise: false,
|
41
|
+
reset: false,
|
42
|
+
close: false,
|
43
|
+
};
|
44
|
+
}
|
45
|
+
return {
|
46
|
+
zoomIn: props.button.zoomIn != false,
|
47
|
+
zoomOut: props.button.zoomOut != false,
|
48
|
+
clockwise: props.button.clockwise != false,
|
49
|
+
anticlockwise: props.button.anticlockwise != false,
|
50
|
+
reset: props.button.reset != false,
|
51
|
+
close: props.button.close != false,
|
52
|
+
};
|
53
|
+
});
|
54
|
+
|
55
|
+
const buttons = [
|
56
|
+
buttonAvailable.value.zoomIn && {
|
57
|
+
tip: '放大(滚轮上滑)', icon: () => (
|
58
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-zoom-in" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
59
|
+
<path d="M32.6066 32.6066C35.3211 29.8921 37 26.1421 37 22C37 13.7157 30.2843 7 22 7C13.7157 7 7 13.7157 7 22C7 30.2843 13.7157 37 22 37C26.1421 37 29.8921 35.3211 32.6066 32.6066ZM32.6066 32.6066L41.5 41.5M29 22H15M22 29V15"></path>
|
60
|
+
</svg>
|
61
|
+
), handler: (e: iMouseEvent) => {
|
62
|
+
e.stopPropagation();
|
63
|
+
emit.onZoomIn();
|
64
|
+
}
|
65
|
+
},
|
66
|
+
buttonAvailable.value.zoomOut && {
|
67
|
+
tip: '缩小(滚轮下滑)', icon: () => (
|
68
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-zoom-out" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
69
|
+
<path d="M32.6066 32.6066C35.3211 29.8921 37 26.1421 37 22C37 13.7157 30.2843 7 22 7C13.7157 7 7 13.7157 7 22C7 30.2843 13.7157 37 22 37C26.1421 37 29.8921 35.3211 32.6066 32.6066ZM32.6066 32.6066L41.5 41.5M29 22H15"></path>
|
70
|
+
</svg>
|
71
|
+
), handler: (e: iMouseEvent) => {
|
72
|
+
e.stopPropagation();
|
73
|
+
emit.onZoomOut();
|
74
|
+
}
|
75
|
+
},
|
76
|
+
buttonAvailable.value.anticlockwise && {
|
77
|
+
tip: '逆时针旋转', icon: () => (
|
78
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-rotate-left" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
79
|
+
<path d="M10 22C10 21.4477 10.4477 21 11 21H31C31.5523 21 32 21.4477 32 22V38C32 38.5523 31.5523 39 31 39H11C10.4477 39 10 38.5523 10 38V22Z"></path>
|
80
|
+
<path d="M23 11H34C37.3137 11 40 13.6863 40 17V23"></path>
|
81
|
+
<path d="M22.5 12.8933L19.5873 11L22.5 9.10672L22.5 12.8933Z"></path>
|
82
|
+
</svg>
|
83
|
+
), handler: (e: iMouseEvent) => {
|
84
|
+
e.stopPropagation();
|
85
|
+
emit.onAnticlockwise();
|
86
|
+
}
|
87
|
+
},
|
88
|
+
buttonAvailable.value.clockwise && {
|
89
|
+
tip: '顺时针旋转', icon: () => (
|
90
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-rotate-right" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
91
|
+
<path d="M38 22C38 21.4477 37.5523 21 37 21H17C16.4477 21 16 21.4477 16 22V38C16 38.5523 16.4477 39 17 39H37C37.5523 39 38 38.5523 38 38V22Z"></path>
|
92
|
+
<path d="M25 11H14C10.6863 11 8 13.6863 8 17V23"></path>
|
93
|
+
<path d="M25.5 12.8933L28.4127 11L25.5 9.10672L25.5 12.8933Z"></path>
|
94
|
+
</svg>
|
95
|
+
), handler: (e: iMouseEvent) => {
|
96
|
+
e.stopPropagation();
|
97
|
+
emit.onClockwise();
|
98
|
+
}
|
99
|
+
},
|
100
|
+
buttonAvailable.value.reset && {
|
101
|
+
tip: '重置', icon: () => (
|
102
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-sync" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
103
|
+
<path d="M33.1927 11.9799L34.607 10.5657L36.0212 9.15145H33.1927V11.9799Z" fill="currentColor" stroke="none" strokeWidth="none"></path>
|
104
|
+
<path d="M14.8115 36.018L13.3973 37.4322L11.9831 38.8464H14.8115V36.018Z" fill="currentColor" stroke="none" strokeWidth="none"></path>
|
105
|
+
<path d="M34.607 10.5657L36.0212 9.15145H33.1927V11.9799L34.607 10.5657ZM34.607 10.5657L36.0212 11.9799C42.6601 18.6188 42.6601 29.3826 36.0212 36.0215C33.4881 38.5545 30.3546 40.1211 27.0788 40.7212M13.3973 37.4322L11.9831 38.8464H14.8115V36.018L13.3973 37.4322ZM13.3973 37.4322L11.9831 36.018C5.34418 29.379 5.34418 18.6152 11.9831 11.9763C14.5161 9.44329 17.6497 7.87672 20.9255 7.27661"></path>
|
106
|
+
</svg>
|
107
|
+
), handler: (e: iMouseEvent) => {
|
108
|
+
e.stopPropagation();
|
109
|
+
emit.onReset();
|
110
|
+
}
|
111
|
+
},
|
112
|
+
buttonAvailable.value.close && {
|
113
|
+
tip: '关闭(ESC按键/双击图片)', icon: () => (
|
114
|
+
<svg width="1em" height="1em" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" className="pi-close" strokeWidth="2" strokeLinecap="butt" strokeLinejoin="miter" style={{ verticalAlign: "baseline" }}>
|
115
|
+
<path d="M9.85742 9.85791L23.9996 24M23.9996 24L38.1417 38.1422M23.9996 24L38.1417 9.85791M23.9996 24L9.85742 38.1422"></path>
|
116
|
+
</svg>
|
117
|
+
), handler: (e: iMouseEvent) => {
|
118
|
+
e.stopPropagation();
|
119
|
+
emit.onClose();
|
120
|
+
}
|
121
|
+
},
|
122
|
+
].filter(Boolean);
|
123
|
+
|
124
|
+
const onDoubleClickStopPropagation = (e: iMouseEvent) => {e.stopPropagation();};
|
125
|
+
|
126
|
+
return () => (
|
127
|
+
buttons.length && (
|
128
|
+
<div className={classes.value}>
|
129
|
+
{buttons.map((btn) => (
|
130
|
+
!!btn && typeof btn != "boolean" && !!btn.icon() && <Tooltip key={btn.tip} message={btn.tip} placement="bottom">
|
131
|
+
<div onClick={btn.handler} onDoubleClick={onDoubleClickStopPropagation} className="image-previewer-button">
|
132
|
+
{btn.icon()}
|
133
|
+
</div>
|
134
|
+
</Tooltip>
|
135
|
+
))}
|
136
|
+
</div>
|
137
|
+
)
|
138
|
+
);
|
139
|
+
},
|
140
|
+
});
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import {designComponent, iHTMLImageElement, iMouseEvent, PropType, reactive, useRefs, useStyles} from "plain-design-composition";
|
2
|
+
import {delay} from "plain-utils/utils/delay";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* img自动判断自己是应该宽度沾满还是高度沾满
|
6
|
+
* @author 韦胜健
|
7
|
+
* @date 2024/1/5 15:47
|
8
|
+
*/
|
9
|
+
export const ImagePreviewerCarouselImage = designComponent({
|
10
|
+
props: {
|
11
|
+
src: { type: String, required: true },
|
12
|
+
direction: { type: String as PropType<'horizontal' | 'vertical'> },
|
13
|
+
clientRatio: { type: Number, required: true },
|
14
|
+
},
|
15
|
+
inheritPropsType: iHTMLImageElement,
|
16
|
+
emits: {
|
17
|
+
onReady: () => true,
|
18
|
+
},
|
19
|
+
setup({ props, event: { emit } }) {
|
20
|
+
|
21
|
+
const { refs, onRef } = useRefs({ img: iHTMLImageElement });
|
22
|
+
|
23
|
+
const state = reactive({
|
24
|
+
direction: props.direction as null | undefined | 'horizontal' | 'vertical'
|
25
|
+
});
|
26
|
+
|
27
|
+
const styles = useStyles(style => {
|
28
|
+
if (!state.direction) {style.opacity = "0";}
|
29
|
+
});
|
30
|
+
|
31
|
+
const onLoad = async () => {
|
32
|
+
if (!state.direction) {
|
33
|
+
const { height, width } = refs.img!;
|
34
|
+
const imageRatio = width / height;
|
35
|
+
state.direction = imageRatio > props.clientRatio ? 'horizontal' : 'vertical';
|
36
|
+
await delay();
|
37
|
+
}
|
38
|
+
emit.onReady();
|
39
|
+
};
|
40
|
+
|
41
|
+
const onError = async () => {emit.onReady();};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 阻止点击冒泡,避免触发image previewer的双击关闭动作
|
45
|
+
* @author 韦胜健
|
46
|
+
* @date 2024/1/8 10:05
|
47
|
+
*/
|
48
|
+
const preventDefaultDraggier = (e: iMouseEvent) => {e.preventDefault();};
|
49
|
+
|
50
|
+
return () => (
|
51
|
+
<img data-ignore="true" ref={onRef.img} style={styles.value} src={props.src} data-direction={state.direction} onLoad={onLoad} onError={onError} onDragStart={preventDefaultDraggier}/>
|
52
|
+
);
|
53
|
+
},
|
54
|
+
});
|
@@ -0,0 +1,202 @@
|
|
1
|
+
import {computed, designComponent, iHTMLDivElement, iMouseEvent, onBeforeUnmount, PropType, reactive, useClasses, useModel, useRefs, useStyles} from "plain-design-composition";
|
2
|
+
import {notNull} from "plain-utils/utils/notNull";
|
3
|
+
import {delay} from "plain-utils/utils/delay";
|
4
|
+
import {Icon} from "../Icon";
|
5
|
+
import {iImagePreviewerOption} from "./image-previewer.utils";
|
6
|
+
import {PreviewerLoading} from "./PreviewerLoading";
|
7
|
+
import {VirtualList} from "../VirtualList";
|
8
|
+
import {useDragHorizontalScroll} from "../../uses/useDragHorizontalScroll";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* 画廊组件
|
12
|
+
* @author 韦胜健
|
13
|
+
* @date 2024/1/8 10:13
|
14
|
+
*/
|
15
|
+
export const ImagePreviewerGallery = designComponent({
|
16
|
+
name: 'image-gallery',
|
17
|
+
props: {
|
18
|
+
modelValue: { type: Number },
|
19
|
+
option: { type: Object as PropType<iImagePreviewerOption>, required: true }
|
20
|
+
},
|
21
|
+
inheritPropsType: iHTMLDivElement,
|
22
|
+
emits: {
|
23
|
+
onUpdateModelValue: (val?: number) => true,
|
24
|
+
},
|
25
|
+
setup({ props, event: { emit } }) {
|
26
|
+
|
27
|
+
const { refs, onRef } = useRefs({ virtual: VirtualList });
|
28
|
+
|
29
|
+
const model = useModel(() => notNull(props.modelValue, 0), emit.onUpdateModelValue, { onChange: () => {handler.adjustScrollLeft();} });
|
30
|
+
|
31
|
+
const state = reactive({
|
32
|
+
/*是否显示滚动按钮*/
|
33
|
+
showScroller: false,
|
34
|
+
|
35
|
+
readyMap: {} as Record<string, boolean | undefined>,
|
36
|
+
});
|
37
|
+
|
38
|
+
const classes = useClasses(() => [
|
39
|
+
'image-previewer-component-gallery',
|
40
|
+
{
|
41
|
+
'image-previewer-component-gallery-show-scroller': state.showScroller
|
42
|
+
}
|
43
|
+
]);
|
44
|
+
|
45
|
+
const utils = {
|
46
|
+
getScrollInfo: () => {
|
47
|
+
const { offsetWidth, scrollWidth, scrollLeft } = refs.virtual!.refs.scroll!.refs.wrapper!;
|
48
|
+
return { wrapperWidth: offsetWidth, scrollWidth, scrollLeft };
|
49
|
+
},
|
50
|
+
scrollLeft: (left: number, duration: number) => {
|
51
|
+
refs.virtual!.refs.scroll?.methods.scrollLeft(left, duration);
|
52
|
+
},
|
53
|
+
};
|
54
|
+
|
55
|
+
const handler = {
|
56
|
+
|
57
|
+
/**
|
58
|
+
* 根据选中的元素位置自动调整滚动距离,使得选中的元素居中展示
|
59
|
+
* @author 韦胜健
|
60
|
+
* @date 2024/1/5 17:53
|
61
|
+
*/
|
62
|
+
adjustScrollLeft: async (duration = 300) => {
|
63
|
+
await delay();
|
64
|
+
const { wrapperWidth } = utils.getScrollInfo();
|
65
|
+
let scrollLeft = itemRect.value.width * model.value - Math.ceil(itemRect.value.width / 2) - Math.ceil(wrapperWidth / 2);
|
66
|
+
if (scrollLeft < 0) {scrollLeft = 0;}
|
67
|
+
utils.scrollLeft(scrollLeft, duration);
|
68
|
+
},
|
69
|
+
/**
|
70
|
+
* 图片加载完毕时,自动判断是否需要显示滚动按钮
|
71
|
+
* @author 韦胜健
|
72
|
+
* @date 2024/1/5 17:53
|
73
|
+
*/
|
74
|
+
onImageLoad: async (thumbUrl: string) => {
|
75
|
+
state.readyMap = { ...state.readyMap, [thumbUrl]: true };
|
76
|
+
await delay();
|
77
|
+
const { wrapperWidth, scrollWidth } = utils.getScrollInfo();
|
78
|
+
const showScroller = scrollWidth > wrapperWidth;
|
79
|
+
if (state.showScroller != showScroller) {
|
80
|
+
state.showScroller = showScroller;
|
81
|
+
await handler.adjustScrollLeft(0);
|
82
|
+
}
|
83
|
+
},
|
84
|
+
/**
|
85
|
+
* 点击gallery item的时候更新绑定值,并且调整滚动位置
|
86
|
+
* @author 韦胜健
|
87
|
+
* @date 2024/1/5 17:54
|
88
|
+
*/
|
89
|
+
onClickGalleryItem: async (index: number) => {
|
90
|
+
model.value = index;
|
91
|
+
},
|
92
|
+
/**
|
93
|
+
* 滚动到上一页
|
94
|
+
* @author 韦胜健
|
95
|
+
* @date 2024/1/5 17:54
|
96
|
+
*/
|
97
|
+
scrollPrev: (e: iMouseEvent) => {
|
98
|
+
e.stopPropagation();
|
99
|
+
const { wrapperWidth, scrollLeft } = utils.getScrollInfo();
|
100
|
+
utils.scrollLeft(Math.ceil(scrollLeft - wrapperWidth / 2), 300);
|
101
|
+
},
|
102
|
+
/**
|
103
|
+
* 滚动到下一页
|
104
|
+
* @author 韦胜健
|
105
|
+
* @date 2024/1/5 17:54
|
106
|
+
*/
|
107
|
+
scrollNext: (e: iMouseEvent) => {
|
108
|
+
e.stopPropagation();
|
109
|
+
const { wrapperWidth, scrollLeft } = utils.getScrollInfo();
|
110
|
+
utils.scrollLeft(Math.ceil(scrollLeft + wrapperWidth / 2), 300);
|
111
|
+
},
|
112
|
+
/**
|
113
|
+
* 双击滚动按钮的时候阻止事件冒泡,避免影响导致关闭预览
|
114
|
+
* @author 韦胜健
|
115
|
+
* @date 2024/1/5 17:54
|
116
|
+
*/
|
117
|
+
onDoubleClickGallery: (e: iMouseEvent) => {
|
118
|
+
e.stopPropagation();
|
119
|
+
},
|
120
|
+
/**
|
121
|
+
* 拖拽图片的时候阻止默认行为,避免下载图片
|
122
|
+
* @author 韦胜健
|
123
|
+
* @date 2024/1/5 17:55
|
124
|
+
*/
|
125
|
+
preventDragImage: (e: iMouseEvent) => {
|
126
|
+
e.preventDefault();
|
127
|
+
},
|
128
|
+
...(() => {
|
129
|
+
let clickIndex: number | null = null;
|
130
|
+
let clickClientX: number | null = null;
|
131
|
+
const onMousedownItem = (e: iMouseEvent, index: number) => {
|
132
|
+
clickIndex = index;
|
133
|
+
clickClientX = e.clientX;
|
134
|
+
};
|
135
|
+
const onMouseupItem = (e: iMouseEvent, index: number) => {
|
136
|
+
if (index !== clickIndex || clickIndex == null || clickClientX == null) {return;}
|
137
|
+
if (Math.abs(e.clientX - clickClientX) > 10) {
|
138
|
+
/*距离过长,为拖拽而不是点击*/
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
handler.onClickGalleryItem(index);
|
142
|
+
};
|
143
|
+
|
144
|
+
return { onMousedownItem, onMouseupItem };
|
145
|
+
})()
|
146
|
+
};
|
147
|
+
|
148
|
+
const itemRect = computed(() => {
|
149
|
+
const height = props.option.galleryHeight;
|
150
|
+
const width = Math.ceil(1920 / 1080 * height);
|
151
|
+
return { height, width };
|
152
|
+
});
|
153
|
+
|
154
|
+
const itemStyles = useStyles(style => {
|
155
|
+
style.height = itemRect.value.height + 'px';
|
156
|
+
style.width = itemRect.value.width + 'px';
|
157
|
+
});
|
158
|
+
|
159
|
+
onBeforeUnmount(useDragHorizontalScroll(() => refs.virtual?.refs.scroll?.refs.wrapper));
|
160
|
+
|
161
|
+
return () => (
|
162
|
+
<div className={classes.value} onDoubleClick={handler.onDoubleClickGallery}>
|
163
|
+
{state.showScroller && (
|
164
|
+
<div className="image-previewer-component-gallery-scroller">
|
165
|
+
<div className="image-previewer-component-gallery-scroller-prev" onClick={handler.scrollPrev}>
|
166
|
+
<Icon icon="pi-left"/>
|
167
|
+
</div>
|
168
|
+
<div className="image-previewer-component-gallery-scroller-next" onClick={handler.scrollNext}>
|
169
|
+
<Icon icon="pi-right"/>
|
170
|
+
</div>
|
171
|
+
</div>
|
172
|
+
)}
|
173
|
+
<div className="image-previewer-component-gallery-container">
|
174
|
+
<VirtualList
|
175
|
+
ref={onRef.virtual}
|
176
|
+
data={props.option.urls}
|
177
|
+
horizontal
|
178
|
+
size={itemRect.value.width}
|
179
|
+
v-slots={{
|
180
|
+
default: ({ index, vIndex, item, vid }) => (
|
181
|
+
<div
|
182
|
+
data-vid={vid}
|
183
|
+
data-idx={index}
|
184
|
+
key={vIndex}
|
185
|
+
style={itemStyles.value}
|
186
|
+
className="image-previewer-component-gallery-item"
|
187
|
+
onMouseDown={(e) => handler.onMousedownItem(e, index)}
|
188
|
+
onMouseUp={(e) => handler.onMouseupItem(e, index)}
|
189
|
+
data-active={String(model.value == index)}
|
190
|
+
>
|
191
|
+
<img data-ignore="true" src={item.thumbUrl} onMouseDown={handler.preventDragImage} onLoad={() => handler.onImageLoad(item.thumbUrl)} onError={() => handler.onImageLoad(item.thumbUrl)}/>
|
192
|
+
{/*{<PreviewerLoading/>}*/}
|
193
|
+
{state.readyMap[item.thumbUrl] !== true && <PreviewerLoading/>}
|
194
|
+
</div>
|
195
|
+
),
|
196
|
+
}}
|
197
|
+
/>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
);
|
201
|
+
},
|
202
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import {designComponent} from "plain-design-composition";
|
2
|
+
import './previewer-loading.scss';
|
3
|
+
|
4
|
+
export const PreviewerLoading = designComponent({
|
5
|
+
name: 'previewer-loading',
|
6
|
+
setup() {
|
7
|
+
return () => (
|
8
|
+
<div className="previewer-loading">
|
9
|
+
<div className="plain-loading-tag">
|
10
|
+
<div className="plain-loading-inner"></div>
|
11
|
+
<div className="plain-loading-inner"></div>
|
12
|
+
<div className="plain-loading-inner"></div>
|
13
|
+
<div className="plain-loading-inner"></div>
|
14
|
+
<div className="plain-loading-inner"></div>
|
15
|
+
<div className="plain-loading-inner"></div>
|
16
|
+
<div className="plain-loading-inner"></div>
|
17
|
+
<div className="plain-loading-inner"></div>
|
18
|
+
<div className="plain-loading-inner"></div>
|
19
|
+
<div className="plain-loading-inner"></div>
|
20
|
+
<div className="plain-loading-inner"></div>
|
21
|
+
<div className="plain-loading-inner"></div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
);
|
25
|
+
},
|
26
|
+
});
|
@@ -0,0 +1,244 @@
|
|
1
|
+
.image-previewer-component {
|
2
|
+
position: relative;
|
3
|
+
height: 100%;
|
4
|
+
width: 100%;
|
5
|
+
margin: 0 !important;
|
6
|
+
padding: 0 !important;
|
7
|
+
user-select: none;
|
8
|
+
|
9
|
+
.image-previewer-component-mask {
|
10
|
+
position: absolute;
|
11
|
+
inset: 0;
|
12
|
+
z-index: 1;
|
13
|
+
opacity: 1;
|
14
|
+
transition: opacity 300ms linear;
|
15
|
+
content: '';
|
16
|
+
}
|
17
|
+
|
18
|
+
@include comp(carousel) {
|
19
|
+
position: relative;
|
20
|
+
z-index: 2;
|
21
|
+
box-sizing: border-box;
|
22
|
+
|
23
|
+
.carousel-item-inner {
|
24
|
+
display: flex;
|
25
|
+
align-items: center;
|
26
|
+
justify-content: center;
|
27
|
+
}
|
28
|
+
|
29
|
+
.carousel-indicator, .carousel-switch-button-prev, .carousel-switch-button-next, img {
|
30
|
+
pointer-events: auto;
|
31
|
+
}
|
32
|
+
.carousel-indicator {
|
33
|
+
transition: none;
|
34
|
+
bottom: -12px;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
img {
|
39
|
+
display: inline-block;
|
40
|
+
object-fit: contain;
|
41
|
+
|
42
|
+
&[data-direction=horizontal] {
|
43
|
+
width: 100%;
|
44
|
+
}
|
45
|
+
|
46
|
+
&[data-direction=vertical] {
|
47
|
+
height: 100%;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
&.image-previewer-component-waiting {
|
52
|
+
.image-previewer-component-mask, .image-previewer-component-gallery {
|
53
|
+
opacity: 0;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
.image-previewer-component-gallery {
|
58
|
+
position: relative;
|
59
|
+
z-index: 2;
|
60
|
+
width: 100%;
|
61
|
+
transition: opacity 300ms linear;
|
62
|
+
user-select: none;
|
63
|
+
|
64
|
+
.image-previewer-component-gallery-container {
|
65
|
+
overflow: hidden;
|
66
|
+
height: 100%;
|
67
|
+
width: 100%;
|
68
|
+
}
|
69
|
+
|
70
|
+
.image-previewer-component-gallery-item {
|
71
|
+
display: inline-block;
|
72
|
+
height: 100%;
|
73
|
+
padding: 2px 1px;
|
74
|
+
cursor: pointer;
|
75
|
+
box-sizing: border-box;
|
76
|
+
position: relative;
|
77
|
+
background-color: #DDDDDD;
|
78
|
+
|
79
|
+
img {
|
80
|
+
height: 100%;
|
81
|
+
width: 100%;
|
82
|
+
object-fit: cover;
|
83
|
+
object-position: center;
|
84
|
+
position: relative;
|
85
|
+
z-index: 2;
|
86
|
+
}
|
87
|
+
|
88
|
+
&[data-active=true] {
|
89
|
+
&:before {
|
90
|
+
position: absolute;
|
91
|
+
inset: 0 -1px;
|
92
|
+
content: '';
|
93
|
+
background-color: gold;
|
94
|
+
z-index: 1;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
&:first-child {
|
99
|
+
padding-left: 2px;
|
100
|
+
|
101
|
+
&[data-active=true] {
|
102
|
+
&:before {
|
103
|
+
top: 0;
|
104
|
+
left: 0;
|
105
|
+
right: -1px;
|
106
|
+
bottom: 0;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
&:last-child {
|
112
|
+
padding-right: 2px;
|
113
|
+
|
114
|
+
&[data-active=true] {
|
115
|
+
&:before {
|
116
|
+
top: 0;
|
117
|
+
right: 0;
|
118
|
+
left: -1px;
|
119
|
+
bottom: 0;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
.image-previewer-component-gallery-scroller {
|
126
|
+
position: absolute;
|
127
|
+
inset: 0;
|
128
|
+
pointer-events: none;
|
129
|
+
display: flex;
|
130
|
+
align-items: stretch;
|
131
|
+
justify-content: space-between;
|
132
|
+
z-index: 3;
|
133
|
+
|
134
|
+
.image-previewer-component-gallery-scroller-prev, .image-previewer-component-gallery-scroller-next {
|
135
|
+
display: flex;
|
136
|
+
align-items: center;
|
137
|
+
justify-content: center;
|
138
|
+
width: 50px;
|
139
|
+
color: white;
|
140
|
+
font-size: 20px;
|
141
|
+
pointer-events: auto;
|
142
|
+
cursor: pointer;
|
143
|
+
position: relative;
|
144
|
+
|
145
|
+
&:before {
|
146
|
+
position: absolute;
|
147
|
+
inset: 0;
|
148
|
+
content: '';
|
149
|
+
opacity: 0.5;
|
150
|
+
transition: opacity 300ms ease;
|
151
|
+
z-index: 1;
|
152
|
+
}
|
153
|
+
|
154
|
+
@include comp(icon) {
|
155
|
+
position: relative;
|
156
|
+
z-index: 2;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
.image-previewer-component-gallery-scroller-prev {
|
161
|
+
&:before {
|
162
|
+
background: linear-gradient(to right, black, transparent);
|
163
|
+
}
|
164
|
+
|
165
|
+
&:hover {
|
166
|
+
&:before {
|
167
|
+
opacity: 1;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
.image-previewer-component-gallery-scroller-next {
|
173
|
+
&:before {
|
174
|
+
background: linear-gradient(to left, black, transparent);
|
175
|
+
}
|
176
|
+
|
177
|
+
&:hover {
|
178
|
+
&:before {
|
179
|
+
opacity: 1;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
&.image-previewer-component-gallery-show-scroller {
|
186
|
+
justify-content: flex-start;
|
187
|
+
}
|
188
|
+
|
189
|
+
&:not(.image-previewer-component-gallery-show-scroller) {
|
190
|
+
.scroll-wrapper {
|
191
|
+
text-align: center;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
.previewer-loading {
|
196
|
+
position: absolute;
|
197
|
+
inset: 0;
|
198
|
+
display: flex;
|
199
|
+
align-items: center;
|
200
|
+
justify-content: center;
|
201
|
+
width: 100%;
|
202
|
+
height: 100%;
|
203
|
+
color: white;
|
204
|
+
font-size: 16px;
|
205
|
+
z-index: 3;
|
206
|
+
background-color: black;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
.image-previewer-button-bar {
|
211
|
+
position: absolute;
|
212
|
+
top: 0;
|
213
|
+
left: 0;
|
214
|
+
right: 0;
|
215
|
+
pointer-events: none;
|
216
|
+
display: flex;
|
217
|
+
align-items: center;
|
218
|
+
justify-content: center;
|
219
|
+
z-index: 3;
|
220
|
+
padding: 16px;
|
221
|
+
|
222
|
+
.image-previewer-button {
|
223
|
+
pointer-events: auto;
|
224
|
+
color: white;
|
225
|
+
height: 50px;
|
226
|
+
width: 50px;
|
227
|
+
font-size: 28px;
|
228
|
+
background-color: rgba(black, 0.2);
|
229
|
+
display: flex;
|
230
|
+
align-items: center;
|
231
|
+
justify-content: center;
|
232
|
+
cursor: pointer;
|
233
|
+
transition: background-color ease 300ms;
|
234
|
+
|
235
|
+
& + .image-previewer-button {
|
236
|
+
margin-left: 1px;
|
237
|
+
}
|
238
|
+
|
239
|
+
&:hover {
|
240
|
+
background-color: rgba(black, 0.3);
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|