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
@@ -1,8 +1,10 @@
|
|
1
|
+
import {iMouseEvent} from 'plain-design-composition';
|
2
|
+
|
1
3
|
export const ClientZoom = (() => {
|
2
4
|
let zoom: '' | number = '';
|
3
5
|
return {
|
4
|
-
get: () => {
|
5
|
-
return zoom;
|
6
|
+
get: (): number => {
|
7
|
+
return zoom === '' ? 1 : zoom;
|
6
8
|
},
|
7
9
|
set: (_zoom: number | null) => {
|
8
10
|
const __zoom = _zoom == null ? '' : _zoom;
|
@@ -24,5 +26,25 @@ export const ClientZoom = (() => {
|
|
24
26
|
};
|
25
27
|
}
|
26
28
|
},
|
29
|
+
getClientPosition: (e: iMouseEvent | MouseEvent): { clientX: number, clientY: number, offsetX: number, offsetY: number, } => {
|
30
|
+
const { clientX, clientY, offsetX, offsetY } = 'nativeEvent' in e ? e.nativeEvent : e;
|
31
|
+
return {
|
32
|
+
clientX: ClientZoom.formatClientValue(clientX),
|
33
|
+
clientY: ClientZoom.formatClientValue(clientY),
|
34
|
+
offsetX: ClientZoom.formatClientValue(offsetX),
|
35
|
+
offsetY: ClientZoom.formatClientValue(offsetY),
|
36
|
+
};
|
37
|
+
},
|
38
|
+
formatClientValue: (val: number) => {
|
39
|
+
return ClientZoom.zoomPosition(val);
|
40
|
+
},
|
41
|
+
zoomPosition(val: number) {
|
42
|
+
const zoom = ClientZoom.get();
|
43
|
+
return Number((val / zoom).toFixed(2));
|
44
|
+
},
|
45
|
+
zoomSize(val: number) {
|
46
|
+
const zoom = ClientZoom.get();
|
47
|
+
return Number((val * zoom).toFixed(2));
|
48
|
+
},
|
27
49
|
};
|
28
50
|
})();
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export function buildCycleIndexList({ length, current }: { length: number, current: number }) {
|
2
|
+
|
3
|
+
const sourceList = new Array(length).fill(null).map((_, index) => index);
|
4
|
+
const cycleIndexList = (() => {
|
5
|
+
|
6
|
+
if (sourceList.length <= 2) {
|
7
|
+
return sourceList;
|
8
|
+
}
|
9
|
+
|
10
|
+
const leftList = sourceList.slice(0, current);
|
11
|
+
const rightList = sourceList.slice(current + 1);
|
12
|
+
|
13
|
+
while (Math.abs(leftList.length - rightList.length) >= 2) {
|
14
|
+
if (leftList.length > rightList.length) {
|
15
|
+
rightList.push(leftList.shift()!);
|
16
|
+
} else {
|
17
|
+
leftList.unshift(rightList.pop()!);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return [...leftList, current, ...rightList];
|
21
|
+
})();
|
22
|
+
|
23
|
+
const currentIndexInCycle = cycleIndexList.indexOf(current);
|
24
|
+
|
25
|
+
const index2distance = cycleIndexList.reduce((prev, item, cycleIndex) => {
|
26
|
+
prev[item] = cycleIndex - currentIndexInCycle;
|
27
|
+
return prev;
|
28
|
+
}, {} as Record<number, number>);
|
29
|
+
|
30
|
+
return { cycleIndexList, currentIndexInCycle, index2distance };
|
31
|
+
}
|
@@ -9,50 +9,50 @@ interface iDeviceInfo {
|
|
9
9
|
osType: typeof eOsType.TYPE,
|
10
10
|
}
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
12
|
+
let info: iDeviceInfo | null = null;
|
13
|
+
|
14
|
+
export const getDeviceInfo = () => {
|
15
|
+
if (isSSR()) {
|
16
|
+
throw new Error('服务端渲染的情况下不可以获取设备信息');
|
17
|
+
}
|
18
|
+
if (!info) {
|
19
|
+
const userAgent = navigator.userAgent;
|
20
|
+
|
21
|
+
info = {
|
22
|
+
deviceType: (() => {
|
23
|
+
const isMobile = /Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
24
|
+
if (isMobile) {
|
25
|
+
return eDeviceType.mobile;
|
26
|
+
}
|
27
|
+
if (/iPad|Android/i.test(userAgent) && !isMobile) {
|
28
|
+
return eDeviceType.tablet;
|
29
|
+
}
|
30
|
+
return eDeviceType.desktop;
|
31
|
+
})(),
|
32
|
+
osType: (() => {
|
33
|
+
if (/Win/i.test(userAgent)) {
|
34
|
+
return eOsType.win;
|
35
|
+
}
|
36
|
+
if (/Mac/i.test(userAgent)) {
|
37
|
+
return eOsType.mac;
|
38
|
+
}
|
39
|
+
if (/Linux/i.test(userAgent)) {
|
40
|
+
return eOsType.linux;
|
41
|
+
}
|
42
|
+
if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) {
|
43
|
+
return eOsType.ios;
|
44
|
+
}
|
45
|
+
if (/Android/.test(userAgent)) {
|
46
|
+
return eOsType.android;
|
47
|
+
}
|
48
|
+
return 'unknown';
|
49
|
+
})()
|
50
|
+
};
|
51
|
+
}
|
52
|
+
return info;
|
53
|
+
};
|
54
|
+
|
55
|
+
export const clearDeviceInfo = () => {info = null;};
|
56
56
|
|
57
57
|
export const isPC = () => getDeviceInfo().deviceType === eDeviceType.desktop;
|
58
58
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export function getRectAutoFormat(el: HTMLElement) {
|
2
|
+
const { top, left, height, width } = el.getBoundingClientRect();
|
3
|
+
return {
|
4
|
+
top: Number(top.toFixed(0)),
|
5
|
+
left: Number(left.toFixed(0)),
|
6
|
+
height: Number(height.toFixed(0)),
|
7
|
+
width: Number(width.toFixed(0)),
|
8
|
+
};
|
9
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import {RenderNode} from "plain-design-composition";
|
2
|
+
|
3
|
+
export function inheritSlots<
|
4
|
+
Slots extends Record<string, (() => RenderNode) & { isExist: () => boolean }>,
|
5
|
+
ScopeSlots extends Record<string, ((...args: any[]) => RenderNode) & { isExist: () => boolean }>,
|
6
|
+
>(
|
7
|
+
{
|
8
|
+
slots,
|
9
|
+
scopeSlots,
|
10
|
+
defaultSlots,
|
11
|
+
defaultScopeSlots,
|
12
|
+
}: {
|
13
|
+
slots?: Slots,
|
14
|
+
scopeSlots?: ScopeSlots,
|
15
|
+
defaultSlots?: { [k in keyof Slots]: Omit<Slots[k], 'isExist'> },
|
16
|
+
defaultScopeSlots?: { [k in keyof ScopeSlots]: Omit<ScopeSlots[k], 'isExist'> },
|
17
|
+
}
|
18
|
+
) {
|
19
|
+
const ret = {} as any;
|
20
|
+
|
21
|
+
!!defaultSlots && Object.entries(defaultSlots).forEach(([key, val]) => {ret[key] = val;});
|
22
|
+
!!defaultScopeSlots && Object.entries(defaultScopeSlots).forEach(([key, val]) => {ret[key] = val;});
|
23
|
+
|
24
|
+
!!slots && Object.keys(slots).forEach((k: keyof Slots) => {if (slots[k].isExist()) {ret[k] = () => slots[k]();}});
|
25
|
+
!!scopeSlots && Object.keys(scopeSlots).forEach((k: keyof ScopeSlots) => {if (scopeSlots[k].isExist()) {ret[k] = (...args: any[]) => scopeSlots[k](...args);}});
|
26
|
+
|
27
|
+
return ret;
|
28
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export function notNull<T, D>(val: T, defaultValue: D | (() => D)): Exclude<T, null | undefined> | D {
|
2
|
+
// @ts-ignore
|
3
|
+
return val != null ? val : (typeof defaultValue === "function" ? defaultValue() : defaultValue);
|
4
|
+
}
|
5
|
+
|
6
|
+
export function notNullFunction<T, D>(val: T, defaultValue: D): Exclude<T, null | undefined> | D {
|
7
|
+
// @ts-ignore
|
8
|
+
return val != null ? val : defaultValue;
|
9
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import {createEffects} from "plain-utils/utils/createEffects";
|
2
2
|
import {watch} from "plain-design-composition";
|
3
3
|
import {removeUnit} from "plain-utils/string/removeUnit";
|
4
|
+
import {ClientZoom} from "../components/ClientZoom";
|
4
5
|
|
5
6
|
export function useMove(
|
6
7
|
{
|
@@ -26,6 +27,8 @@ export function useMove(
|
|
26
27
|
|
27
28
|
const onMousedown = (e: MouseEvent) => {
|
28
29
|
|
30
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
31
|
+
|
29
32
|
const { effects: draggierEffects } = createEffects();
|
30
33
|
|
31
34
|
const el = e.currentTarget as HTMLElement;
|
@@ -35,16 +38,19 @@ export function useMove(
|
|
35
38
|
const dragState = {
|
36
39
|
isDragging: false,
|
37
40
|
start: {
|
38
|
-
x:
|
39
|
-
y:
|
41
|
+
x: clientX,
|
42
|
+
y: clientY,
|
40
43
|
left: Number(removeUnit(style.left) || 0),
|
41
44
|
top: Number(removeUnit(style.top) || 0),
|
42
45
|
}
|
43
46
|
};
|
44
47
|
|
45
48
|
const onMousemove = (e: MouseEvent) => {
|
46
|
-
|
47
|
-
const
|
49
|
+
|
50
|
+
const { clientX, clientY } = ClientZoom.getClientPosition(e);
|
51
|
+
|
52
|
+
const durX = clientX - dragState.start.x;
|
53
|
+
const durY = clientY - dragState.start.y;
|
48
54
|
|
49
55
|
if (!dragState.isDragging) {
|
50
56
|
if (durX >= 5 || durY >= 5) {
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {onBeforeUnmount,
|
1
|
+
import {onBeforeUnmount, watch} from "plain-design-composition";
|
2
|
+
import {createEffects} from "plain-utils/utils/createEffects";
|
2
3
|
|
3
4
|
/**
|
4
5
|
* watch函数封装,支持清理副作用
|
@@ -6,11 +7,22 @@ import {onBeforeUnmount, SimpleFunction, watch} from "plain-design-composition";
|
|
6
7
|
* @date 2022.7.3 13:15
|
7
8
|
*/
|
8
9
|
export function useWatchAutoClear<T>(watcher: () => T, handler: (newVal: T, oldVal: undefined | T) => (() => void)) {
|
9
|
-
let clear: SimpleFunction | null = null;
|
10
|
-
watch(() => watcher(), (newVal, oldVal) => {
|
11
|
-
clear?.();
|
12
|
-
clear = handler(newVal, oldVal);
|
13
|
-
}, { immediate: true });
|
14
10
|
|
15
|
-
|
11
|
+
const { effects: setupEffects } = createEffects();
|
12
|
+
const { effects: watchEffects } = createEffects();
|
13
|
+
|
14
|
+
setupEffects.push(
|
15
|
+
watch(() => watcher(), (newVal, oldVal) => {
|
16
|
+
watchEffects.clear();
|
17
|
+
watchEffects.push(
|
18
|
+
handler(newVal, oldVal)
|
19
|
+
);
|
20
|
+
}, { immediate: true })
|
21
|
+
);
|
22
|
+
|
23
|
+
onBeforeUnmount(() => {
|
24
|
+
setupEffects.clear();
|
25
|
+
watchEffects.clear();
|
26
|
+
});
|
16
27
|
}
|
28
|
+
|
@@ -1,143 +0,0 @@
|
|
1
|
-
@include prefix(carousel-group) {
|
2
|
-
position: relative;
|
3
|
-
|
4
|
-
&:not(.carousel-vertical) {
|
5
|
-
overflow-x: hidden;
|
6
|
-
}
|
7
|
-
|
8
|
-
.#{componentName(carousel)}, .carousel-cover, .carousel-operator, .carousel-indicator {
|
9
|
-
position: absolute;
|
10
|
-
top: 0;
|
11
|
-
left: 0;
|
12
|
-
right: 0;
|
13
|
-
bottom: 0;
|
14
|
-
pointer-events: none;
|
15
|
-
|
16
|
-
&.carousel-cover, &.carousel-operator, &.carousel-indicator {
|
17
|
-
z-index: 99;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
.#{componentName(carousel)} {
|
22
|
-
&.carousel-animating {
|
23
|
-
transition: transform ease 600ms;
|
24
|
-
}
|
25
|
-
|
26
|
-
pointer-events: auto;
|
27
|
-
}
|
28
|
-
|
29
|
-
.carousel-cover {
|
30
|
-
pointer-events: auto;
|
31
|
-
}
|
32
|
-
|
33
|
-
.carousel-operator {
|
34
|
-
display: flex;
|
35
|
-
align-items: center;
|
36
|
-
justify-content: space-between;
|
37
|
-
padding: 0 20px;
|
38
|
-
|
39
|
-
.carousel-operator-btn {
|
40
|
-
transition: background-color 300ms linear;
|
41
|
-
cursor: pointer;
|
42
|
-
pointer-events: auto;
|
43
|
-
background-color: rgba(#ffffff, 0.45);
|
44
|
-
color: white;
|
45
|
-
width: 36px;
|
46
|
-
height: 36px;
|
47
|
-
border-radius: 36px;
|
48
|
-
display: flex;
|
49
|
-
align-items: center;
|
50
|
-
justify-content: center;
|
51
|
-
user-select: none;
|
52
|
-
|
53
|
-
&:hover:not(:active) {
|
54
|
-
background-color: rgba(#ffffff, 0.65);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
.carousel-indicator {
|
60
|
-
top: initial;
|
61
|
-
display: flex;
|
62
|
-
align-items: center;
|
63
|
-
justify-content: center;
|
64
|
-
padding: 20px;
|
65
|
-
flex-wrap: nowrap;
|
66
|
-
|
67
|
-
.carousel-indicator-item {
|
68
|
-
pointer-events: auto;
|
69
|
-
width: 20px;
|
70
|
-
height: 2px;
|
71
|
-
background-color: plv(background-color);
|
72
|
-
opacity: 0.6;
|
73
|
-
transition: all 200ms linear;
|
74
|
-
cursor: pointer;
|
75
|
-
|
76
|
-
&:not(:last-child) {
|
77
|
-
margin-right: 8px;
|
78
|
-
}
|
79
|
-
|
80
|
-
&.carousel-indicator-item-active {
|
81
|
-
opacity: 1;
|
82
|
-
width: 30px;
|
83
|
-
height: 4px;
|
84
|
-
}
|
85
|
-
|
86
|
-
&:hover {
|
87
|
-
opacity: 0.8;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
&.carousel-vertical {
|
93
|
-
overflow-y: hidden;
|
94
|
-
|
95
|
-
.carousel-operator {
|
96
|
-
flex-direction: column;
|
97
|
-
padding: 20px;
|
98
|
-
align-items: flex-end;
|
99
|
-
|
100
|
-
.carousel-operator-btn:nth-child(1) {
|
101
|
-
transform: rotate(90deg);
|
102
|
-
}
|
103
|
-
|
104
|
-
.carousel-operator-btn:nth-child(2) {
|
105
|
-
transform: rotate(90deg);
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
.carousel-indicator {
|
110
|
-
flex-direction: column;
|
111
|
-
padding: 20px 36px;
|
112
|
-
left: initial;
|
113
|
-
top: 0;
|
114
|
-
|
115
|
-
.carousel-indicator-item {
|
116
|
-
height: 8px;
|
117
|
-
width: 2px;
|
118
|
-
margin-right: 0;
|
119
|
-
|
120
|
-
&.carousel-indicator-item-active {
|
121
|
-
height: 16px;
|
122
|
-
width: 4px;
|
123
|
-
}
|
124
|
-
|
125
|
-
&:not(:last-child) {
|
126
|
-
margin-bottom: 4px;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
&.carousel-card {
|
133
|
-
.#{componentName(carousel)} {
|
134
|
-
right: initial;
|
135
|
-
}
|
136
|
-
|
137
|
-
.carousel-indicator {
|
138
|
-
.carousel-indicator-item {
|
139
|
-
background-color: rgba(black, 0.5);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|