plain-design 1.0.0-beta.4 → 1.0.0-beta.41
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 +37 -29
- package/dist/plain-design.min.js +3 -3
- package/dist/report.html +5 -5
- package/package.json +9 -8
- package/src/packages/build.ts +2 -10
- package/src/packages/components/$object/createObjectService.tsx +31 -20
- 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/Alert/alert.scss +3 -3
- package/src/packages/components/Application/service/useApplicationService.tsx +2 -0
- package/src/packages/components/Application/theme/theme.ts +3 -3
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +4 -4
- package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +2 -0
- package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +3 -3
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +4 -0
- package/src/packages/components/Badge/badge.scss +1 -1
- package/src/packages/components/Button/button.scss +2 -2
- 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/CascadePanel/list/CascadeListPanelItem.tsx +3 -3
- package/src/packages/components/CheckboxInner/checkbox-inner.scss +1 -1
- package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +8 -5
- package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +7 -4
- package/src/packages/components/DatePicker/date.scss +1 -1
- package/src/packages/components/Dialog/dialog.scss +1 -1
- package/src/packages/components/Dialog/index.tsx +4 -3
- package/src/packages/components/Dialog/useDialogMovable.tsx +7 -4
- package/src/packages/components/Dialog/utils/dialog.mouse.ts +4 -2
- package/src/packages/components/Dropdown/dropdown.public.scss +10 -0
- package/src/packages/components/Dropdown/dropdown.utils.tsx +3 -1
- 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/FilterFormMultiple/index.tsx +31 -10
- package/src/packages/components/Image/image.scss +3 -3
- 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 +135 -0
- package/src/packages/components/ImagePreviewer/index.tsx +5 -0
- package/src/packages/components/ImagePreviewer/previewer-loading.scss +52 -0
- package/src/packages/components/Input/index.scss +2 -2
- package/src/packages/components/Input/useMultipleInput.tsx +2 -76
- package/src/packages/components/Input/useTextareaInput.tsx +10 -5
- package/src/packages/components/Input/uses/useInputHooks.tsx +11 -11
- package/src/packages/components/InputNumber/NumberResize.tsx +20 -3
- package/src/packages/components/InputNumber/input-number.utils.tsx +7 -5
- package/src/packages/components/InputNumber/number.scss +10 -1
- package/src/packages/components/InputNumber/useInputNumber.public.tsx +25 -6
- package/src/packages/components/Layout/index.tsx +31 -0
- package/src/packages/components/Layout/layout.scss +227 -0
- package/src/packages/components/Layout/layout.utils.ts +3 -0
- package/src/packages/components/LayoutSection/index.tsx +67 -0
- package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +184 -0
- package/src/packages/components/LoadingMask/index.tsx +1 -1
- package/src/packages/components/PageThemeUtils/index.tsx +54 -14
- package/src/packages/components/Pagination/pagination.scss +2 -2
- package/src/packages/components/PlcOv/index.tsx +14 -4
- package/src/packages/components/Popup/index.tsx +24 -10
- package/src/packages/components/ProgressBar/progress-bar.scss +1 -1
- package/src/packages/components/Rate/index.tsx +3 -1
- package/src/packages/components/Scroll/HorizontalScrollbar.tsx +7 -3
- package/src/packages/components/Scroll/VerticalScrollbar.tsx +7 -3
- package/src/packages/components/Scroll/index.tsx +6 -6
- package/src/packages/components/Select/createPublicSelectRender.tsx +1 -1
- package/src/packages/components/Slider/slider.scss +1 -1
- package/src/packages/components/Slider/useSliderDotDragier.tsx +7 -4
- package/src/packages/components/SortList/index.tsx +191 -0
- package/src/packages/components/SortList/sort-list.scss +11 -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 +3 -0
- package/src/packages/components/Table/standard/PlcExpand.tsx +12 -20
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +1 -1
- package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +2 -0
- package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +2 -1
- package/src/packages/components/Table/table/Table.tsx +10 -3
- 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/head/useHeadCellResize.ts +8 -3
- package/src/packages/components/Table/table/table.scss +2 -1
- package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +10 -5
- package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +12 -7
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +1 -1
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +1 -1
- package/src/packages/components/Table/table/utils/createTableHooks.ts +4 -2
- package/src/packages/components/Table/table/utils/table.utils.ts +6 -1
- package/src/packages/components/ThemeEditor/index.tsx +173 -0
- package/src/packages/components/ThemeEditor/theme-editor.scss +105 -0
- package/src/packages/components/ThemePrimaryColors/index.ts +5 -0
- package/src/packages/components/Tree/RenderTreeNode.tsx +8 -3
- package/src/packages/components/Tree/index.tsx +4 -3
- package/src/packages/components/Tree/tree.scss +42 -9
- package/src/packages/components/TreeCore/TreeCore.type.tsx +2 -0
- package/src/packages/components/TreeCore/createTreeCore.tsx +5 -1
- package/src/packages/components/TreeCore/createTreeDraggier.tsx +70 -56
- package/src/packages/components/TreeCore/createTreeMethods.tsx +1 -0
- package/src/packages/components/TreeCore/createTreeProps.ts +2 -1
- package/src/packages/components/TreeNodeWithMenu/index.tsx +91 -0
- package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +39 -0
- package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
- package/src/packages/components/VirtualList/index.tsx +15 -6
- package/src/packages/components/VirtualList/useVirtualList.tsx +182 -107
- package/src/packages/components/VirtualList/virtual-list.scss +31 -17
- package/src/packages/components/VirtualTable/index.tsx +7 -7
- package/src/packages/components/VirtualTable/virtual-table.scss +1 -2
- package/src/packages/components/createProvider/index.ts +5 -0
- package/src/packages/components/nextPopupId/index.ts +5 -0
- package/src/packages/components/useDialog/DialogService.tsx +13 -1
- package/src/packages/components/useDialog/index.tsx +1 -1
- package/src/packages/components/useImage/ImageService.tsx +7 -4
- package/src/packages/components/useMessage/Message.tsx +5 -1
- package/src/packages/components/useMessage/message.scss +5 -1
- package/src/packages/components/useNotice/notice.scss +2 -2
- package/src/packages/components/usePopup/PopupItem.tsx +45 -26
- package/src/packages/components/usePopup/popup-item.scss +5 -1
- 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 +2 -1
- package/src/packages/components/usePopupManager/index.ts +5 -0
- package/src/packages/components/usePopupTrigger/index.tsx +5 -0
- package/src/packages/components/useReferenceTrigger/index.tsx +5 -0
- package/src/packages/components/useTooltip/index.tsx +10 -2
- package/src/packages/components/useWatchAutoClear/index.ts +5 -0
- package/src/packages/entry.tsx +48 -2
- package/src/packages/i18n/lang/en-us.ts +36 -0
- package/src/packages/i18n/lang/zh-cn.ts +36 -0
- package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
- package/src/packages/uses/useEdit.ts +5 -1
- package/src/packages/uses/useStyle.tsx +10 -2
- package/src/packages/utils/ClientZoom.ts +24 -2
- package/src/packages/utils/ComponentUtils.ts +10 -0
- package/src/packages/utils/buildCycleIndexList.ts +31 -0
- package/src/packages/utils/getDeviceInfo.ts +44 -44
- package/src/packages/utils/getRectAutoFormat.ts +9 -0
- package/src/packages/utils/inheritSlots.ts +28 -0
- package/src/packages/utils/notNull.ts +9 -0
- package/src/packages/utils/useMove.tsx +10 -4
- 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/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 -192
- 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/DemoList.scss +0 -15
- package/src/pages/index/components/normal/DemoList.tsx +0 -82
- package/src/pages/index/components/normal/DemoLoading.tsx +0 -83
- 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 -1099
- 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 -322
- 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 -104
- 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 -217
- 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,135 @@
|
|
1
|
+
import {PartialFields} from "../../utils/type";
|
2
|
+
import {createCounter, createHooks} from "plain-design-composition";
|
3
|
+
import {notNull} from "../../utils/notNull";
|
4
|
+
|
5
|
+
export const ImagePreviewerConstants = {
|
6
|
+
/*画廊高度,默认70px*/
|
7
|
+
DEFAULT_GALLERY_HEIGHT: 70,
|
8
|
+
/*画廊与大图之间的距离,默认24px*/
|
9
|
+
DEFAULT_SEPARATOR_HEIGHT: 0,
|
10
|
+
};
|
11
|
+
|
12
|
+
export interface iImagePreviewerOptionPartialFields {
|
13
|
+
imageElement?: null | HTMLImageElement, // 点击的图片原始dom对象,如果有传这个属性对象的话会有一个显示放大动画
|
14
|
+
galleryHeight: number, // 底部画廊的高度
|
15
|
+
separatorHeight: number, // 底部画廊距离图片显示区域的距离
|
16
|
+
autoHeight: boolean, // 自动高度,默认是true。这样设置之后图片会撑满宽度,高度自动;关闭的时候会设置高度100%,图片宽度自动
|
17
|
+
mask: boolean, // 显示背部遮罩
|
18
|
+
button?: boolean | { // 顶部按钮栏控制,button为false则禁用所有按钮;为对象则单独禁用某个按钮
|
19
|
+
zoomIn?: boolean, // 放大按钮
|
20
|
+
zoomOut?: boolean, // 缩小按钮
|
21
|
+
clockwise?: boolean, // 顺时针旋转按钮
|
22
|
+
anticlockwise?: boolean, // 逆时针旋转按钮
|
23
|
+
reset?: boolean, // 重置按钮
|
24
|
+
close?: boolean, // 关闭按钮
|
25
|
+
},
|
26
|
+
swipeButton?: boolean // 左右切换按钮控制,swipeButton为false则禁用前后按钮
|
27
|
+
gallery?: boolean, // 底部画廊控制,为false则禁用底部画廊
|
28
|
+
globalKeyboardEvent?: boolean // 监听全局的键盘事件,默认不监听全局键盘按键事件,而是等鼠标移入的时候才监听
|
29
|
+
maskColor?: string, // 遮罩颜色
|
30
|
+
disableZoomOnWheel?: boolean, // 禁用滚轮缩放
|
31
|
+
/*---------------------------------------以下为不可配置属性-------------------------------------------*/
|
32
|
+
id: string, // option唯一标识
|
33
|
+
oldSourceImageOpacity?: string // 原始的img对象的opacity属性值
|
34
|
+
}
|
35
|
+
|
36
|
+
export interface iImagePreviewerOption extends iImagePreviewerOptionPartialFields {
|
37
|
+
current: number; // 当前显示的元素索引
|
38
|
+
urls: { url: string, thumbUrl: string }[]; // 所有展示的图片,url为大图地址,thumbUrl为底部画廊图片预览地址
|
39
|
+
}
|
40
|
+
|
41
|
+
export type iImagePreviewerParamOption = string | string[] | iImagePreviewerOption['urls'] | Omit<PartialFields<iImagePreviewerOption, keyof iImagePreviewerOptionPartialFields>, 'urls'> & { urls: string[] | iImagePreviewerOption['urls'] }
|
42
|
+
|
43
|
+
export const ImagePreviewerHooks = {
|
44
|
+
/*PreviewerComponent挂载完毕事件*/
|
45
|
+
onImagePreviewerReady: createHooks<(data: { option: iImagePreviewerOption }) => void>()
|
46
|
+
};
|
47
|
+
|
48
|
+
const nextOptionId = createCounter('image_previewer');
|
49
|
+
|
50
|
+
export function createImagePreviewerOption(
|
51
|
+
param: iImagePreviewerParamOption,
|
52
|
+
imageElement?: HTMLImageElement,
|
53
|
+
defaultParam?: Partial<iImagePreviewerOption>
|
54
|
+
): iImagePreviewerOption {
|
55
|
+
if (typeof param === "string") {
|
56
|
+
return {
|
57
|
+
id: nextOptionId(),
|
58
|
+
current: 0,
|
59
|
+
imageElement,
|
60
|
+
autoHeight: true,
|
61
|
+
mask: false,
|
62
|
+
urls: [{ url: param, thumbUrl: param }],
|
63
|
+
galleryHeight: ImagePreviewerConstants.DEFAULT_GALLERY_HEIGHT,
|
64
|
+
separatorHeight: ImagePreviewerConstants.DEFAULT_SEPARATOR_HEIGHT,
|
65
|
+
...defaultParam,
|
66
|
+
};
|
67
|
+
}
|
68
|
+
if (Array.isArray(param)) {
|
69
|
+
return {
|
70
|
+
id: nextOptionId(),
|
71
|
+
current: 0,
|
72
|
+
imageElement,
|
73
|
+
autoHeight: true,
|
74
|
+
mask: false,
|
75
|
+
urls: param.map(p => typeof p === "string" ? { url: p, thumbUrl: p } : p),
|
76
|
+
galleryHeight: ImagePreviewerConstants.DEFAULT_GALLERY_HEIGHT,
|
77
|
+
separatorHeight: ImagePreviewerConstants.DEFAULT_SEPARATOR_HEIGHT,
|
78
|
+
...defaultParam,
|
79
|
+
};
|
80
|
+
}
|
81
|
+
if (!!imageElement) {
|
82
|
+
param.imageElement = imageElement;
|
83
|
+
}
|
84
|
+
return {
|
85
|
+
autoHeight: true,
|
86
|
+
mask: false,
|
87
|
+
galleryHeight: notNull(param.galleryHeight, ImagePreviewerConstants.DEFAULT_GALLERY_HEIGHT),
|
88
|
+
separatorHeight: notNull(param.separatorHeight, ImagePreviewerConstants.DEFAULT_SEPARATOR_HEIGHT),
|
89
|
+
...defaultParam,
|
90
|
+
...param,
|
91
|
+
id: nextOptionId(),
|
92
|
+
urls: param.urls.map(p => typeof p === "string" ? { url: p, thumbUrl: p } : p),
|
93
|
+
};
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* 获取imageElement在containerElement容器中居中铺满的位置信息
|
98
|
+
* @author 韦胜健
|
99
|
+
* @date 2024/1/10 18:50
|
100
|
+
*/
|
101
|
+
export const getCenterRect = (
|
102
|
+
{
|
103
|
+
imageElement, containerElement
|
104
|
+
}: {
|
105
|
+
imageElement: HTMLDivElement,
|
106
|
+
containerElement: HTMLDivElement | { containerRatio: number, containerHeight: number, containerWidth: number },
|
107
|
+
}
|
108
|
+
) => {
|
109
|
+
const imageRatio = Number((imageElement.offsetWidth / imageElement.offsetHeight).toFixed(2));
|
110
|
+
const { containerRatio, containerHeight, containerWidth } = 'tagName' in containerElement ? (() => {
|
111
|
+
const containerRatio = Number((containerElement.offsetWidth / containerElement.offsetHeight).toFixed(2));
|
112
|
+
return {
|
113
|
+
containerRatio,
|
114
|
+
containerHeight: containerElement.offsetHeight,
|
115
|
+
containerWidth: containerElement.offsetWidth,
|
116
|
+
};
|
117
|
+
})() : containerElement;
|
118
|
+
|
119
|
+
|
120
|
+
if (imageRatio > containerRatio) {
|
121
|
+
/*宽度更宽,固定宽度为屏幕宽度缩放*/
|
122
|
+
const left = 0;
|
123
|
+
const width = containerWidth;
|
124
|
+
const height = Number((imageElement.offsetHeight / imageElement.offsetWidth * width).toFixed(0));
|
125
|
+
const top = Number(((containerHeight - height) / 2).toFixed(0));
|
126
|
+
return { top, left, width, height };
|
127
|
+
} else {
|
128
|
+
/*高度更高,固定高度将宽度缩放*/
|
129
|
+
const top = 0;
|
130
|
+
const height = containerHeight;
|
131
|
+
const width = Number((imageElement.offsetWidth / imageElement.offsetHeight * height).toFixed(0));
|
132
|
+
const left = Number(((containerWidth - width) / 2).toFixed(0));
|
133
|
+
return { top, left, width, height };
|
134
|
+
}
|
135
|
+
};
|
@@ -0,0 +1,52 @@
|
|
1
|
+
.previewer-loading {
|
2
|
+
|
3
|
+
$size: 1em;
|
4
|
+
|
5
|
+
height: $size;
|
6
|
+
width: $size;
|
7
|
+
|
8
|
+
.plain-loading-tag {
|
9
|
+
$centerRadius: (0.5*$size)/1.2;
|
10
|
+
$itemWidth: (0.35*$size)/1.2;
|
11
|
+
$itemHeight: (0.1*$size)/1.2;
|
12
|
+
$width: $centerRadius + $itemWidth * 2;
|
13
|
+
$height: $width;
|
14
|
+
|
15
|
+
width: $width;
|
16
|
+
height: $height;
|
17
|
+
position: relative;
|
18
|
+
display: block;
|
19
|
+
|
20
|
+
.plain-loading-inner {
|
21
|
+
background-color: currentColor;
|
22
|
+
display: inline-block;
|
23
|
+
width: $itemWidth;
|
24
|
+
height: $itemHeight;
|
25
|
+
margin-top: $itemHeight / 2 * -1;
|
26
|
+
margin-left: $centerRadius / 2;
|
27
|
+
top: 50%;
|
28
|
+
left: 50%;
|
29
|
+
position: absolute;
|
30
|
+
transform-origin: ($centerRadius / 2 * -1) ($itemHeight / 2);
|
31
|
+
@for $i from 1 through 12 {
|
32
|
+
&:nth-child(#{$i}) {
|
33
|
+
transform: rotate(($i - 1) * 30deg);
|
34
|
+
animation: plain-loading-tag 1s linear infinite #{-1 + $i / 12}s;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
@keyframes plain-loading-tag {
|
38
|
+
0% {
|
39
|
+
opacity: 1;
|
40
|
+
}
|
41
|
+
@for $i from 1 through 11 {
|
42
|
+
#{$i / 12 * 100}% {
|
43
|
+
opacity: 1 - $i / 12;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
100% {
|
47
|
+
opacity: 1;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
@@ -41,7 +41,7 @@
|
|
41
41
|
border: none;
|
42
42
|
background-color: transparent;
|
43
43
|
box-sizing: border-box;
|
44
|
-
line-height:
|
44
|
+
line-height: plv(line-height);
|
45
45
|
padding-top: 3px;
|
46
46
|
padding-bottom: 3px;
|
47
47
|
color: plv(text-2);
|
@@ -352,7 +352,7 @@
|
|
352
352
|
display: inline-block;
|
353
353
|
padding: 3px 12px;
|
354
354
|
box-sizing: border-box;
|
355
|
-
line-height:
|
355
|
+
line-height: plv(line-height);
|
356
356
|
word-break: break-all;
|
357
357
|
}
|
358
358
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import {AutoWidthInput} from "../AutoWidthInput";
|
2
2
|
import {iInputCompositionData, inputScrollEnd} from "./input.utils";
|
3
3
|
import Icon from "../Icon";
|
4
|
-
import {iHTMLElement, useClasses, useModel, useRefs
|
4
|
+
import {iHTMLElement, useClasses, useModel, useRefs} from "plain-design-composition";
|
5
5
|
import {getKey, KEY} from "../KeyboardService";
|
6
6
|
import {delay} from "plain-utils/utils/delay";
|
7
7
|
import {createEffectiveHandler} from "../../utils/createEffectiveHandler";
|
8
8
|
import {createEffects} from "plain-utils/utils/createEffects";
|
9
|
+
import {useDragHorizontalScroll} from "../../uses/useDragHorizontalScroll";
|
9
10
|
|
10
11
|
/**
|
11
12
|
* 渲染多值输入框
|
@@ -120,78 +121,3 @@ export const useMultipleInput = createEffectiveHandler(({ hooks, props, model, r
|
|
120
121
|
|
121
122
|
return effects.clear;
|
122
123
|
});
|
123
|
-
|
124
|
-
function useDragHorizontalScroll(getEl: () => HTMLElement | null | undefined) {
|
125
|
-
|
126
|
-
const staticState = {
|
127
|
-
isDragging: false,
|
128
|
-
el: null as null | undefined | HTMLElement,
|
129
|
-
start: {
|
130
|
-
x: 0,
|
131
|
-
left: 0,
|
132
|
-
width: 0,
|
133
|
-
},
|
134
|
-
move: {
|
135
|
-
x: 0
|
136
|
-
}
|
137
|
-
};
|
138
|
-
|
139
|
-
const { effects } = createEffects();
|
140
|
-
|
141
|
-
const handler = {
|
142
|
-
mousedown: (e: MouseEvent) => {
|
143
|
-
staticState.isDragging = false;
|
144
|
-
staticState.start = {
|
145
|
-
x: e.clientX,
|
146
|
-
left: staticState.el!.scrollLeft,
|
147
|
-
width: staticState.el!.scrollWidth,
|
148
|
-
};
|
149
|
-
document.documentElement.addEventListener('mousemove', handler.mousemove, true);
|
150
|
-
document.documentElement.addEventListener('mouseup', handler.mouseup, true);
|
151
|
-
},
|
152
|
-
mousemove: (e: MouseEvent) => {
|
153
|
-
staticState.move.x = e.clientX;
|
154
|
-
const durX = staticState.move.x - staticState.start.x;
|
155
|
-
if (!staticState.isDragging) {
|
156
|
-
if (Math.abs(durX) > 5) {
|
157
|
-
staticState.isDragging = true;
|
158
|
-
}
|
159
|
-
}
|
160
|
-
if (!staticState.isDragging) {
|
161
|
-
return;
|
162
|
-
}
|
163
|
-
staticState.el!.scrollLeft = staticState.start.left - durX;
|
164
|
-
},
|
165
|
-
mouseup: () => {
|
166
|
-
document.documentElement.removeEventListener('mousemove', handler.mousemove, true);
|
167
|
-
document.documentElement.removeEventListener('mouseup', handler.mouseup, true);
|
168
|
-
},
|
169
|
-
onWheel: (e: WheelEvent) => {
|
170
|
-
e.stopPropagation();
|
171
|
-
e.preventDefault();
|
172
|
-
const el = e.currentTarget as HTMLElement;
|
173
|
-
const delta = e.deltaX + e.deltaY;
|
174
|
-
el.scrollLeft += delta;
|
175
|
-
},
|
176
|
-
};
|
177
|
-
|
178
|
-
effects.push(watch(() => getEl(), el => {
|
179
|
-
if (!!staticState.el) {
|
180
|
-
staticState.el.removeEventListener('mousedown', handler.mousedown);
|
181
|
-
staticState.el.removeEventListener('wheel', handler.onWheel);
|
182
|
-
}
|
183
|
-
staticState.el = el;
|
184
|
-
if (!staticState.el) {return;}
|
185
|
-
staticState.el.addEventListener('mousedown', handler.mousedown);
|
186
|
-
staticState.el.addEventListener('wheel', handler.onWheel);
|
187
|
-
}));
|
188
|
-
|
189
|
-
effects.push(() => {
|
190
|
-
if (!!staticState.el) {
|
191
|
-
staticState.el.removeEventListener('mousedown', handler.mousedown);
|
192
|
-
staticState.el.removeEventListener('wheel', handler.onWheel);
|
193
|
-
}
|
194
|
-
});
|
195
|
-
|
196
|
-
return effects.clear;
|
197
|
-
}
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import {iInputCompositionData} from "./input.utils";
|
2
|
-
import {iKeyboardEvent, reactive, useClasses, useStyles} from "plain-design-composition";
|
2
|
+
import {fixInputCursor, iKeyboardEvent, reactive, useClasses, useStyles} from "plain-design-composition";
|
3
3
|
import {unit} from "plain-utils/string/unit";
|
4
4
|
import {createEffects} from "plain-utils/utils/createEffects";
|
5
|
+
import {ClientZoom} from "../ClientZoom";
|
6
|
+
|
7
|
+
const _Textarea = fixInputCursor('textarea')
|
5
8
|
|
6
9
|
export function useTextareaInput(data: iInputCompositionData) {
|
7
10
|
|
@@ -61,7 +64,7 @@ export function useTextareaInput(data: iInputCompositionData) {
|
|
61
64
|
))}
|
62
65
|
{!model.value && <> </>}
|
63
66
|
</span>
|
64
|
-
<
|
67
|
+
<_Textarea
|
65
68
|
ref={handler.onRef}
|
66
69
|
value={model.value}
|
67
70
|
onInput={handler.onInput}
|
@@ -95,8 +98,10 @@ function useTextareaResize({ hooks, onResize }: iInputCompositionData & { onResi
|
|
95
98
|
const handler = {
|
96
99
|
textarea: null as null | HTMLInputElement,
|
97
100
|
mousedown: (e: MouseEvent) => {
|
98
|
-
const { offsetX, offsetY, clientY
|
99
|
-
|
101
|
+
const { offsetX, offsetY, clientY } = ClientZoom.getClientPosition(e);
|
102
|
+
let { offsetWidth, offsetHeight } = e.target as any;
|
103
|
+
const dragSize = 12
|
104
|
+
if (!(offsetWidth - offsetX < dragSize && offsetHeight - offsetY < dragSize)) {
|
100
105
|
return;
|
101
106
|
}
|
102
107
|
staticState.isDragging = false;
|
@@ -108,7 +113,7 @@ function useTextareaResize({ hooks, onResize }: iInputCompositionData & { onResi
|
|
108
113
|
document.documentElement.addEventListener('mouseup', handler.mouseup);
|
109
114
|
},
|
110
115
|
mousemove: (e: MouseEvent) => {
|
111
|
-
const { clientY } = e;
|
116
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
112
117
|
staticState.move = { y: clientY };
|
113
118
|
const durY = staticState.move.y - staticState.start.y;
|
114
119
|
if (!staticState.isDragging) {
|
@@ -3,18 +3,18 @@ import {iSelectOptionProps} from "../../Select/select.utils";
|
|
3
3
|
|
4
4
|
export function useInputHooks() {
|
5
5
|
return {
|
6
|
-
onRenderDefault: createSyncHooks<(content: RenderNode) => void>(), // 渲染默认插槽
|
7
|
-
onRenderSuffix: createSyncHooks<(content: RenderNode) => void>(), // 渲染suffix插槽
|
8
|
-
onRefInput: createHooks<(el: HTMLInputElement | null) => void>(),
|
9
|
-
onRefWrapper: createHooks<(el: HTMLElement | null) => void>(),
|
10
|
-
onInputKeydown: createHooks<(e: iKeyboardEvent) => void>(),
|
11
|
-
onInput: createHooks<(val: any) => void>(),
|
12
|
-
onClasses: createSyncHooks<(val: any[]) => void>(), // 计算根节点classes
|
6
|
+
onRenderDefault: createSyncHooks<(content: RenderNode) => void>(true), // 渲染默认插槽
|
7
|
+
onRenderSuffix: createSyncHooks<(content: RenderNode) => void>(true), // 渲染suffix插槽
|
8
|
+
onRefInput: createHooks<(el: HTMLInputElement | null) => void>(), // input dom对象引用
|
9
|
+
onRefWrapper: createHooks<(el: HTMLElement | null) => void>(), // 容器节点dom对象引用
|
10
|
+
onInputKeydown: createHooks<(e: iKeyboardEvent) => void>(), // input触发按键事件
|
11
|
+
onInput: createHooks<(val: any) => void>(), // input的输入动作
|
12
|
+
onClasses: createSyncHooks<(val: any[]) => void>(true), // 计算根节点classes
|
13
13
|
onSuggestion: createHooks<(data: { val: string, optionProps: iSelectOptionProps }) => void>(),// 点击了某个推荐选项
|
14
|
-
onTagChange: createHooks<() => void>(),
|
15
|
-
onTriggerOpenSuggestion: createHooks<() => void>(),
|
16
|
-
onTriggerCloseSuggestion: createHooks<() => void>(),
|
17
|
-
onGetSuggestionIsShow: createSyncHooks<(flag: boolean) => void>(), // suggestion 面板是否已经打开
|
14
|
+
onTagChange: createHooks<() => void>(), // 多值输入的时候的变化动作
|
15
|
+
onTriggerOpenSuggestion: createHooks<() => void>(), // 触发打开suggestion的动作
|
16
|
+
onTriggerCloseSuggestion: createHooks<() => void>(), // 触发打开suggestion的动作
|
17
|
+
onGetSuggestionIsShow: createSyncHooks<(flag: boolean) => void>(true), // suggestion 面板是否已经打开
|
18
18
|
};
|
19
19
|
}
|
20
20
|
|
@@ -2,6 +2,8 @@ import {designComponent, getComponentCls, iHTMLDivElement, iMouseEvent, useRefs}
|
|
2
2
|
import {Icon} from "../Icon";
|
3
3
|
import {createEffects} from "plain-utils/utils/createEffects";
|
4
4
|
import {addClass} from "plain-utils/dom/addClass";
|
5
|
+
import {ClientZoom} from "../ClientZoom";
|
6
|
+
import {roundFixed} from "plain-utils/utils/roundFixed";
|
5
7
|
|
6
8
|
export const NumberResize = designComponent({
|
7
9
|
name: "number-resize",
|
@@ -9,6 +11,9 @@ export const NumberResize = designComponent({
|
|
9
11
|
props: {
|
10
12
|
step: { type: Number, default: 1 },
|
11
13
|
value: { type: Number },
|
14
|
+
precision: { type: Number },
|
15
|
+
max: { type: Number },
|
16
|
+
min: { type: Number }
|
12
17
|
},
|
13
18
|
emits: {
|
14
19
|
onChange: (val: number) => true,
|
@@ -35,6 +40,8 @@ export const NumberResize = designComponent({
|
|
35
40
|
|
36
41
|
const handler = {
|
37
42
|
onMousedown: (e: iMouseEvent) => {
|
43
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
44
|
+
|
38
45
|
event.emit.onMouseDown(e);
|
39
46
|
const el = refs.el!.cloneNode(true) as HTMLDivElement;
|
40
47
|
const { top, left, height, width } = refs.el!.getBoundingClientRect();
|
@@ -50,7 +57,7 @@ export const NumberResize = designComponent({
|
|
50
57
|
addClass(el, 'number-resize-dragging');
|
51
58
|
|
52
59
|
staticState = {
|
53
|
-
startY:
|
60
|
+
startY: clientY,
|
54
61
|
startValue: props.value == null ? 0 : props.value,
|
55
62
|
el,
|
56
63
|
startTop: top,
|
@@ -71,10 +78,20 @@ export const NumberResize = designComponent({
|
|
71
78
|
},
|
72
79
|
onMousemove: (e: MouseEvent) => {
|
73
80
|
if (!staticState) {return;}
|
74
|
-
const
|
81
|
+
const { clientY } = ClientZoom.getClientPosition(e);
|
82
|
+
const durY = (clientY - staticState.startY);
|
75
83
|
const elMoveTop = staticState.startTop + durY;
|
76
84
|
staticState.el.style.transform = `translate3d(${staticState.startLeft}px,${elMoveTop}px,0)`;
|
77
|
-
|
85
|
+
let newValue = Math.ceil(staticState.startValue + (durY * -1) / unit) * props.step;
|
86
|
+
if (props.precision != null) {
|
87
|
+
newValue = roundFixed(newValue, props.precision)!;
|
88
|
+
}
|
89
|
+
if (props.max != null && newValue > props.max) {
|
90
|
+
newValue = props.max;
|
91
|
+
}
|
92
|
+
if (props.min != null && newValue < props.min) {
|
93
|
+
newValue = props.min;
|
94
|
+
}
|
78
95
|
event.emit.onChange(newValue);
|
79
96
|
// console.log(newValue);
|
80
97
|
},
|
@@ -12,13 +12,15 @@ export const InputNumberPropsOption = {
|
|
12
12
|
min: { type: [String, Number] }, // 最小值
|
13
13
|
max: { type: [String, Number] }, // 最大值
|
14
14
|
step: { type: [String, Number], default: 1 }, // 计数器步长
|
15
|
-
stepStrictly: { type: Boolean },
|
15
|
+
stepStrictly: { type: Boolean }, // 是否只能输入 step 的倍数
|
16
16
|
precision: { type: [Number, String] }, // 数值精度
|
17
17
|
button: { type: [String, Boolean] as PropType<boolean | typeof NumberButtonTypes.TYPE | null>, default: NumberButtonTypes.right },// 按钮模式 false, 'none','button','right'
|
18
|
-
availableUnits: { type: Array as PropType<string[]> },
|
19
|
-
defaultUnit: { type: String },
|
20
|
-
addIcon: { type: String },
|
21
|
-
subIcon: { type: String },
|
18
|
+
availableUnits: { type: Array as PropType<string[]> }, // 允许输入的数字单位
|
19
|
+
defaultUnit: { type: String }, // 默认的数字单位,当没有值的时候点击加减号默认给的单位
|
20
|
+
addIcon: { type: String }, // add按钮图标
|
21
|
+
subIcon: { type: String }, // sub按钮图标
|
22
|
+
requireUnit: { type: Boolean }, // 输入的值必须带单位,否则视为无效输入(不会触发change,并且失焦之后恢复上一次有效值)
|
23
|
+
isValueEffective: { type: Function as PropType<(val: string | number, unit?: string | null) => boolean> }, // 判断值是否有效,否则视为无效输入
|
22
24
|
|
23
25
|
/*---------------------------------------input-------------------------------------------*/
|
24
26
|
inputAttrs: { type: Object }, // input属性配置对象
|
@@ -47,12 +47,21 @@
|
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
50
|
+
.number-prepend-button, .number-append-button {
|
51
|
+
transform: scale(0.9);
|
52
|
+
}
|
53
|
+
|
50
54
|
@include sizeMixin(input, ()) {
|
51
55
|
.number-button-container {
|
52
|
-
width: $height
|
56
|
+
width: $height;
|
57
|
+
height: calc(#{$height} - 2px);
|
53
58
|
}
|
54
59
|
}
|
55
60
|
}
|
61
|
+
|
62
|
+
.input-box {
|
63
|
+
align-self: center;
|
64
|
+
}
|
56
65
|
}
|
57
66
|
|
58
67
|
@include prefix(number-resize) {
|
@@ -41,18 +41,26 @@ export function useInputNumberPublic(param: iInputNumberCompositionParam) {
|
|
41
41
|
*/
|
42
42
|
getValueInfo: (val: any): iInputNumberValueInfo => {
|
43
43
|
if (!props.availableUnits || props.availableUnits.length === 0) {
|
44
|
-
|
44
|
+
|
45
|
+
/*---------------------------------------不允许带单位-------------------------------------------*/
|
46
|
+
|
45
47
|
if (val == null) return { val: undefined };
|
46
48
|
val = String(val).trim();
|
47
49
|
if (val === '') return { val: undefined };
|
48
50
|
val = Number(val);
|
49
51
|
if (isNaN(val)) {
|
50
52
|
return { val: NAN };
|
51
|
-
} else {
|
52
|
-
return { val: val };
|
53
53
|
}
|
54
|
+
if (!!props.isValueEffective && !props.isValueEffective(val)) {
|
55
|
+
return { val: NAN };
|
56
|
+
}
|
57
|
+
|
58
|
+
return { val: val };
|
59
|
+
|
54
60
|
} else {
|
55
|
-
|
61
|
+
|
62
|
+
/*---------------------------------------允许带单位-------------------------------------------*/
|
63
|
+
|
56
64
|
if (val == null) return { val: undefined, unit: props.defaultUnit };
|
57
65
|
if (typeof val === "string") {
|
58
66
|
val = val.trim();
|
@@ -69,9 +77,17 @@ export function useInputNumberPublic(param: iInputNumberCompositionParam) {
|
|
69
77
|
|
70
78
|
if (isNaN(num)) {
|
71
79
|
return { val: NAN, unit };
|
72
|
-
} else {
|
73
|
-
return { val: num, unit: !!unit ? unit : undefined };
|
74
80
|
}
|
81
|
+
|
82
|
+
if (!!props.requireUnit && !unit) {
|
83
|
+
return { val: NAN, unit };
|
84
|
+
}
|
85
|
+
|
86
|
+
if (!!props.isValueEffective && !props.isValueEffective(num, unit)) {
|
87
|
+
return { val: NAN, unit };
|
88
|
+
}
|
89
|
+
|
90
|
+
return { val: num, unit: !!unit ? unit : undefined };
|
75
91
|
}
|
76
92
|
}
|
77
93
|
}
|
@@ -334,6 +350,9 @@ export function useInputNumberPublic(param: iInputNumberCompositionParam) {
|
|
334
350
|
<NumberResize
|
335
351
|
value={effectiveInputValue.value?.val || 0}
|
336
352
|
step={numberState.step}
|
353
|
+
precision={numberState.precision}
|
354
|
+
max={numberState.max}
|
355
|
+
min={numberState.min}
|
337
356
|
onChange={handler.onResize}
|
338
357
|
onMouseDown={handler.onMousedownResize}
|
339
358
|
/>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import {designComponent, getComponentCls, useClassCache} from "plain-design-composition";
|
2
|
+
import './layout.scss';
|
3
|
+
|
4
|
+
export const Layout = designComponent({
|
5
|
+
name: 'layout',
|
6
|
+
props: {
|
7
|
+
vertical: { type: Boolean }
|
8
|
+
},
|
9
|
+
provideRefer: true,
|
10
|
+
slots: ['default'],
|
11
|
+
setup({ props, slots }) {
|
12
|
+
|
13
|
+
const classes = useClassCache(() => [
|
14
|
+
getComponentCls('layout'),
|
15
|
+
{
|
16
|
+
'layout-vertical': props.vertical,
|
17
|
+
}
|
18
|
+
]);
|
19
|
+
|
20
|
+
return {
|
21
|
+
refer: { props },
|
22
|
+
render: () => (
|
23
|
+
<div className={classes.value}>
|
24
|
+
{slots.default()}
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
};
|
28
|
+
},
|
29
|
+
});
|
30
|
+
|
31
|
+
export default Layout;
|