yootd 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/Preview/assets/phonebg.png +0 -0
- package/dist/Preview/components/icons/AdaptIcon.d.ts +3 -0
- package/dist/Preview/components/icons/AdaptIcon.js +60 -0
- package/dist/Preview/components/icons/MagnifyIcon.d.ts +3 -0
- package/dist/Preview/components/icons/MagnifyIcon.js +40 -0
- package/dist/Preview/components/icons/ResetIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ResetIcon.js +66 -0
- package/dist/Preview/components/icons/ShrinkIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ShrinkIcon.js +40 -0
- package/dist/Preview/components/preview/phone.d.ts +7 -0
- package/dist/Preview/components/preview/phone.js +10 -0
- package/dist/Preview/components/preview/phone.scss +8 -0
- package/dist/Preview/components/preview/web.d.ts +6 -0
- package/dist/Preview/components/preview/web.js +10 -0
- package/dist/Preview/components/reactflow/Controls.d.ts +5 -0
- package/dist/Preview/components/reactflow/Controls.js +69 -0
- package/dist/Preview/components/reactflow/TopPreview.d.ts +5 -0
- package/dist/Preview/components/reactflow/TopPreview.js +28 -0
- package/dist/Preview/index.d.ts +5 -0
- package/dist/Preview/index.js +94 -0
- package/dist/Preview/index.scss +35 -0
- package/dist/Preview/types/type.d.ts +21 -0
- package/dist/affix/index.d.ts +3 -0
- package/dist/affix/index.js +2 -0
- package/dist/alert/index.d.ts +5 -0
- package/dist/alert/index.js +2 -0
- package/dist/anchor/index.d.ts +10 -0
- package/dist/anchor/index.js +18 -0
- package/dist/anchor/index.scss +23 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.js +2 -0
- package/dist/approval-process/components/Avatar.d.ts +3 -0
- package/dist/approval-process/components/Avatar.js +100 -0
- package/dist/approval-process/components/BackOut.d.ts +3 -0
- package/dist/approval-process/components/BackOut.js +35 -0
- package/dist/approval-process/components/Failed.d.ts +3 -0
- package/dist/approval-process/components/Failed.js +37 -0
- package/dist/approval-process/components/Pending.d.ts +3 -0
- package/dist/approval-process/components/Pending.js +51 -0
- package/dist/approval-process/components/StartIcon.d.ts +3 -0
- package/dist/approval-process/components/StartIcon.js +35 -0
- package/dist/approval-process/components/Success.d.ts +3 -0
- package/dist/approval-process/components/Success.js +35 -0
- package/dist/approval-process/index.d.ts +7 -0
- package/dist/approval-process/index.js +96 -0
- package/dist/approval-process/index.scss +95 -0
- package/dist/areas/index.d.ts +4 -0
- package/dist/areas/index.js +317 -0
- package/dist/areas/index.scss +21 -0
- package/dist/areas/types/types.d.ts +39 -0
- package/dist/aside/components/AddBtnIcon.d.ts +3 -0
- package/dist/aside/components/AddBtnIcon.js +27 -0
- package/dist/aside/components/DelBtnIcon.d.ts +3 -0
- package/dist/aside/components/DelBtnIcon.js +33 -0
- package/dist/aside/components/DragBtnIcon.d.ts +3 -0
- package/dist/aside/components/DragBtnIcon.js +26 -0
- package/dist/aside/components/EditBtnIcon.d.ts +3 -0
- package/dist/aside/components/EditBtnIcon.js +33 -0
- package/dist/aside/components/SortableItem.d.ts +5 -0
- package/dist/aside/components/SortableItem.js +125 -0
- package/dist/aside/components/SortableItem.scss +93 -0
- package/dist/aside/index.d.ts +4 -0
- package/dist/aside/index.js +186 -0
- package/dist/aside/index.scss +25 -0
- package/dist/aside/types/types.d.ts +44 -0
- package/dist/auto-complete/index.d.ts +4 -0
- package/dist/auto-complete/index.js +2 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badge/index.d.ts +11 -0
- package/dist/badge/index.js +21 -0
- package/dist/badge/index.scss +5 -0
- package/dist/breadcrumb/index.d.ts +9 -0
- package/dist/breadcrumb/index.js +10 -0
- package/dist/business-tree/components/dept.d.ts +4 -0
- package/dist/business-tree/components/dept.js +35 -0
- package/dist/business-tree/components/space.d.ts +4 -0
- package/dist/business-tree/components/space.js +48 -0
- package/dist/business-tree/index.d.ts +3 -0
- package/dist/business-tree/index.js +16 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +54 -0
- package/dist/button/index.scss +31 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +2 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.js +2 -0
- package/dist/carousel/index.d.ts +3 -0
- package/dist/carousel/index.js +2 -0
- package/dist/cascader/index.d.ts +11 -0
- package/dist/cascader/index.js +23 -0
- package/dist/cascader/index.scss +5 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +13 -0
- package/dist/collapse/index.d.ts +3 -0
- package/dist/collapse/index.js +2 -0
- package/dist/color-picker/index.d.ts +6 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/config-provider/context.d.ts +8 -0
- package/dist/config-provider/context.js +2 -0
- package/dist/config-provider/index.d.ts +24 -0
- package/dist/config-provider/index.js +34 -0
- package/dist/date-interval/index.d.ts +16 -0
- package/dist/date-interval/index.js +82 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/index.js +2 -0
- package/dist/date-range/index.d.ts +16 -0
- package/dist/date-range/index.js +83 -0
- package/dist/description/index.d.ts +3 -0
- package/dist/description/index.js +2 -0
- package/dist/dictionary/index.d.ts +6 -0
- package/dist/dictionary/index.js +45 -0
- package/dist/dictionary/types/types.d.ts +14 -0
- package/dist/divider/index.d.ts +4 -0
- package/dist/divider/index.js +5 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +2 -0
- package/dist/drawer-modal/components/CloseOutlined.d.ts +7 -0
- package/dist/drawer-modal/components/CloseOutlined.js +23 -0
- package/dist/drawer-modal/index.d.ts +6 -0
- package/dist/drawer-modal/index.js +37 -0
- package/dist/drawer-modal/index.scss +39 -0
- package/dist/drawer-modal/types/types.d.ts +3 -0
- package/dist/dropdown/assets/arrow-down.svg +6 -0
- package/dist/dropdown/index.d.ts +9 -0
- package/dist/dropdown/index.js +7 -0
- package/dist/empty/assets/404.png +0 -0
- package/dist/empty/assets/empty-content.png +0 -0
- package/dist/empty/assets/empty-data.png +0 -0
- package/dist/empty/assets/image-error.png +0 -0
- package/dist/empty/assets/net-error.png +0 -0
- package/dist/empty/assets/no-collect.png +0 -0
- package/dist/empty/assets/no-news.png +0 -0
- package/dist/empty/assets/no-notice.png +0 -0
- package/dist/empty/assets/no-schedule.png +0 -0
- package/dist/empty/assets/no-search-data.png +0 -0
- package/dist/empty/assets/submit-fail.png +0 -0
- package/dist/empty/assets/submit-success.png +0 -0
- package/dist/empty/index.d.ts +12 -0
- package/dist/empty/index.js +131 -0
- package/dist/empty/index.scss +15 -0
- package/dist/flex/index.d.ts +4 -0
- package/dist/flex/index.js +5 -0
- package/dist/float-button/index.d.ts +9 -0
- package/dist/float-button/index.js +10 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.js +2 -0
- package/dist/grid/index.d.ts +6 -0
- package/dist/grid/index.js +8 -0
- package/dist/group-title/index.d.ts +7 -0
- package/dist/group-title/index.js +21 -0
- package/dist/group-title/index.scss +31 -0
- package/dist/hooks/useAssets.d.ts +1 -0
- package/dist/hooks/useAssets.js +11 -0
- package/dist/hooks/useBem.d.ts +15 -0
- package/dist/hooks/useBem.js +80 -0
- package/dist/hooks/useRequest.d.ts +1 -0
- package/dist/hooks/useRequest.js +11 -0
- package/dist/image/assets/default.png +0 -0
- package/dist/image/assets/error.png +0 -0
- package/dist/image/assets/eye.png +0 -0
- package/dist/image/index.d.ts +10 -0
- package/dist/image/index.js +95 -0
- package/dist/image/index.scss +27 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +85 -0
- package/dist/input/index.d.ts +10 -0
- package/dist/input/index.js +24 -0
- package/dist/input/index.scss +5 -0
- package/dist/input-number/index.d.ts +3 -0
- package/dist/input-number/index.js +2 -0
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.js +2 -0
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +2 -0
- package/dist/mentions/index.d.ts +3 -0
- package/dist/mentions/index.js +2 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +12 -0
- package/dist/message/index.d.ts +3 -0
- package/dist/message/index.js +2 -0
- package/dist/modal/components/header-icon.d.ts +3 -0
- package/dist/modal/components/header-icon.js +46 -0
- package/dist/modal/index.d.ts +10 -0
- package/dist/modal/index.js +41 -0
- package/dist/modal/index.scss +65 -0
- package/dist/notification/index.d.ts +3 -0
- package/dist/notification/index.js +2 -0
- package/dist/pagination/index.d.ts +5 -0
- package/dist/pagination/index.js +22 -0
- package/dist/pagination/index.scss +47 -0
- package/dist/pop-confirm/index.d.ts +3 -0
- package/dist/pop-confirm/index.js +2 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +2 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/index.d.ts +3 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/radio/index.d.ts +4 -0
- package/dist/radio/index.js +3 -0
- package/dist/rate/index.d.ts +3 -0
- package/dist/rate/index.js +2 -0
- package/dist/result/index.d.ts +2 -0
- package/dist/result/index.js +2 -0
- package/dist/school/index.d.ts +4 -0
- package/dist/school/index.js +304 -0
- package/dist/school/index.scss +21 -0
- package/dist/school/types/types.d.ts +84 -0
- package/dist/segmented/index.d.ts +3 -0
- package/dist/segmented/index.js +2 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/index.d.ts +9 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/index.js +2 -0
- package/dist/space/index.d.ts +6 -0
- package/dist/space/index.js +2 -0
- package/dist/spin/index.d.ts +2 -0
- package/dist/spin/index.js +2 -0
- package/dist/splitter/index.d.ts +6 -0
- package/dist/splitter/index.js +2 -0
- package/dist/state/index.d.ts +8 -0
- package/dist/state/index.js +28 -0
- package/dist/state/index.scss +89 -0
- package/dist/statistic/index.d.ts +2 -0
- package/dist/statistic/index.js +2 -0
- package/dist/steps/index.d.ts +10 -0
- package/dist/steps/index.js +18 -0
- package/dist/steps/index.scss +32 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/index.js +2 -0
- package/dist/table/components/icons/DownOutlined.d.ts +3 -0
- package/dist/table/components/icons/DownOutlined.js +28 -0
- package/dist/table/components/icons/DragHandler.d.ts +3 -0
- package/dist/table/components/icons/DragHandler.js +24 -0
- package/dist/table/components/icons/SettingFilled.d.ts +3 -0
- package/dist/table/components/icons/SettingFilled.js +22 -0
- package/dist/table/components/icons/UpOutlined.d.ts +3 -0
- package/dist/table/components/icons/UpOutlined.js +28 -0
- package/dist/table/components/primary-header-row/index.d.ts +3 -0
- package/dist/table/components/primary-header-row/index.js +130 -0
- package/dist/table/components/primary-header-row/index.scss +58 -0
- package/dist/table/components/primary-tbody-row/index.d.ts +3 -0
- package/dist/table/components/primary-tbody-row/index.js +40 -0
- package/dist/table/components/primary-tbody-row/index.scss +5 -0
- package/dist/table/index.d.ts +41 -0
- package/dist/table/index.js +146 -0
- package/dist/table/index.module.scss +9 -0
- package/dist/table/index.scss +33 -0
- package/dist/tabs/index.d.ts +12 -0
- package/dist/tabs/index.js +108 -0
- package/dist/tabs/index.scss +50 -0
- package/dist/tag/index.d.ts +2 -0
- package/dist/tag/index.js +2 -0
- package/dist/teacher/index.d.ts +3 -0
- package/dist/teacher/index.js +59 -0
- package/dist/teacher/types/types.d.ts +31 -0
- package/dist/time-picker/index.d.ts +3 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/timeline/index.d.ts +5 -0
- package/dist/timeline/index.js +2 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tour/index.d.ts +5 -0
- package/dist/tour/index.js +2 -0
- package/dist/transfer/index.d.ts +3 -0
- package/dist/transfer/index.js +2 -0
- package/dist/tree/components/BedIcon.d.ts +3 -0
- package/dist/tree/components/BedIcon.js +29 -0
- package/dist/tree/components/CampusIcon.d.ts +3 -0
- package/dist/tree/components/CampusIcon.js +30 -0
- package/dist/tree/components/DeptIcon.d.ts +3 -0
- package/dist/tree/components/DeptIcon.js +32 -0
- package/dist/tree/components/FloorIcon.d.ts +3 -0
- package/dist/tree/components/FloorIcon.js +32 -0
- package/dist/tree/components/RoomIcon.d.ts +3 -0
- package/dist/tree/components/RoomIcon.js +32 -0
- package/dist/tree/components/SchoolIcon.d.ts +3 -0
- package/dist/tree/components/SchoolIcon.js +70 -0
- package/dist/tree/components/TierlIcon.d.ts +3 -0
- package/dist/tree/components/TierlIcon.js +39 -0
- package/dist/tree/index.d.ts +27 -0
- package/dist/tree/index.js +207 -0
- package/dist/tree/index.scss +25 -0
- package/dist/tree-select/index.d.ts +3 -0
- package/dist/tree-select/index.js +2 -0
- package/dist/typography/index.d.ts +3 -0
- package/dist/typography/index.js +2 -0
- package/dist/upload/assets/again.png +0 -0
- package/dist/upload/assets/delete.png +0 -0
- package/dist/upload/assets/success.png +0 -0
- package/dist/upload/components/AgainIcon.d.ts +3 -0
- package/dist/upload/components/AgainIcon.js +29 -0
- package/dist/upload/components/DeleteIcon.d.ts +3 -0
- package/dist/upload/components/DeleteIcon.js +28 -0
- package/dist/upload/components/DeleteImage.d.ts +3 -0
- package/dist/upload/components/DeleteImage.js +47 -0
- package/dist/upload/components/SuccessIcon.d.ts +3 -0
- package/dist/upload/components/SuccessIcon.js +28 -0
- package/dist/upload/components/UpLoadIconAdd.d.ts +3 -0
- package/dist/upload/components/UpLoadIconAdd.js +28 -0
- package/dist/upload/components/UploadIcon.d.ts +3 -0
- package/dist/upload/components/UploadIcon.js +36 -0
- package/dist/upload/components/fileUpload.d.ts +13 -0
- package/dist/upload/components/fileUpload.js +258 -0
- package/dist/upload/components/imageUpload.d.ts +13 -0
- package/dist/upload/components/imageUpload.js +243 -0
- package/dist/upload/index.d.ts +20 -0
- package/dist/upload/index.js +16 -0
- package/dist/upload/index.scss +115 -0
- package/dist/user-dropdown/index.d.ts +3 -0
- package/dist/user-dropdown/index.js +101 -0
- package/dist/user-dropdown/types/types.d.ts +44 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +12 -0
- package/dist/watermark/index.d.ts +3 -0
- package/dist/watermark/index.js +2 -0
- package/dist/year-options/index.d.ts +11 -0
- package/dist/year-options/index.js +32 -0
- package/dist/year-term/index.d.ts +4 -0
- package/dist/year-term/index.js +169 -0
- package/dist/year-term/index.scss +21 -0
- package/dist/year-term/types/types.d.ts +28 -0
- package/dist/zones/index.d.ts +3 -0
- package/dist/zones/index.js +186 -0
- package/dist/zones/index.module.scss +23 -0
- package/dist/zones/types/types.d.ts +26 -0
- package/package.json +97 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# yotd
|
2
|
+
|
3
|
+
[](https://npmjs.org/package/yotd)
|
4
|
+
[](https://npmjs.org/package/yotd)
|
5
|
+
|
6
|
+
A react library developed with dumi
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
TODO
|
11
|
+
|
12
|
+
## Options
|
13
|
+
|
14
|
+
TODO
|
15
|
+
|
16
|
+
## Development
|
17
|
+
|
18
|
+
```bash
|
19
|
+
# install dependencies
|
20
|
+
$ pnpm install
|
21
|
+
|
22
|
+
# develop library by docs demo
|
23
|
+
$ pnpm start
|
24
|
+
|
25
|
+
# build library source code
|
26
|
+
$ pnpm run build
|
27
|
+
|
28
|
+
# build library source code in watch mode
|
29
|
+
$ pnpm run build:watch
|
30
|
+
|
31
|
+
# build docs
|
32
|
+
$ pnpm run docs:build
|
33
|
+
|
34
|
+
# Locally preview the production build.
|
35
|
+
$ pnpm run docs:preview
|
36
|
+
|
37
|
+
# check your project for potential problems
|
38
|
+
$ pnpm run doctor
|
39
|
+
```
|
40
|
+
|
41
|
+
## LICENSE
|
42
|
+
|
43
|
+
MIT
|
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var AdaptIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
style: style,
|
13
|
+
className: className
|
14
|
+
}, rest, {
|
15
|
+
width: "16",
|
16
|
+
height: "16",
|
17
|
+
viewBox: "0 0 16 16",
|
18
|
+
fill: "none",
|
19
|
+
xmlns: "http://www.w3.org/2000/svg"
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "\xE6\x94\xBE\xE5\xA4\xA7"
|
22
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
23
|
+
id: "rect-stroke",
|
24
|
+
x: "0.5",
|
25
|
+
y: "2.5",
|
26
|
+
width: "15",
|
27
|
+
height: "11",
|
28
|
+
rx: "0.5",
|
29
|
+
stroke: "black",
|
30
|
+
strokeOpacity: "0.85"
|
31
|
+
}), /*#__PURE__*/React.createElement("path", {
|
32
|
+
id: "Union",
|
33
|
+
fillRule: "evenodd",
|
34
|
+
clipRule: "evenodd",
|
35
|
+
d: "M2.5 4C2.22386 4 2 4.22386 2 4.5V6.5C2 6.77614 2.22386 7 2.5 7C2.77614 7 3 6.77614 3 6.5V5L4.5 5C4.77614 5 5 4.77614 5 4.5C5 4.22386 4.77614 4 4.5 4H2.5Z",
|
36
|
+
fill: "black",
|
37
|
+
fillOpacity: "0.85"
|
38
|
+
}), /*#__PURE__*/React.createElement("path", {
|
39
|
+
id: "Union_2",
|
40
|
+
fillRule: "evenodd",
|
41
|
+
clipRule: "evenodd",
|
42
|
+
d: "M2.5 12C2.22386 12 2 11.7761 2 11.5V9.5C2 9.22386 2.22386 9 2.5 9C2.77614 9 3 9.22386 3 9.5V11L4.5 11C4.77614 11 5 11.2239 5 11.5C5 11.7761 4.77614 12 4.5 12H2.5Z",
|
43
|
+
fill: "black",
|
44
|
+
fillOpacity: "0.85"
|
45
|
+
}), /*#__PURE__*/React.createElement("path", {
|
46
|
+
id: "Union_3",
|
47
|
+
fillRule: "evenodd",
|
48
|
+
clipRule: "evenodd",
|
49
|
+
d: "M13.5 4C13.7761 4 14 4.22386 14 4.5V6.5C14 6.77614 13.7761 7 13.5 7C13.2239 7 13 6.77614 13 6.5V5L11.5 5C11.2239 5 11 4.77614 11 4.5C11 4.22386 11.2239 4 11.5 4H13.5Z",
|
50
|
+
fill: "black",
|
51
|
+
fillOpacity: "0.85"
|
52
|
+
}), /*#__PURE__*/React.createElement("path", {
|
53
|
+
id: "Union_4",
|
54
|
+
fillRule: "evenodd",
|
55
|
+
clipRule: "evenodd",
|
56
|
+
d: "M13.5 12C13.7761 12 14 11.7761 14 11.5V9.5C14 9.22386 13.7761 9 13.5 9C13.2239 9 13 9.22386 13 9.5V11L11.5 11C11.2239 11 11 11.2239 11 11.5C11 11.7761 11.2239 12 11.5 12H13.5Z",
|
57
|
+
fill: "black",
|
58
|
+
fillOpacity: "0.85"
|
59
|
+
})));
|
60
|
+
});
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var MagnifyIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
style: style,
|
13
|
+
className: className
|
14
|
+
}, rest, {
|
15
|
+
width: "16",
|
16
|
+
height: "16",
|
17
|
+
viewBox: "0 0 16 16",
|
18
|
+
fill: "none",
|
19
|
+
xmlns: "http://www.w3.org/2000/svg"
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "\xE6\x94\xBE\xE5\xA4\xA7",
|
22
|
+
clipPath: "url(#clip0_628_30973)"
|
23
|
+
}, /*#__PURE__*/React.createElement("path", {
|
24
|
+
id: "Vector",
|
25
|
+
d: "M11.9247 10.982L15.3327 14.3906L14.39 15.3333L10.9814 11.9253C9.8553 12.8383 8.44906 13.3356 6.99935 13.3333C5.74674 13.3333 4.52225 12.9619 3.48074 12.2659C2.43923 11.57 1.62747 10.5809 1.14811 9.42362C0.66876 8.26636 0.543339 6.99294 0.787712 5.76439C1.03208 4.53584 1.63528 3.40735 2.52101 2.52162C3.40674 1.63589 4.53523 1.0327 5.76378 0.788322C6.99233 0.543949 8.26575 0.66937 9.42301 1.14873C10.5803 1.62808 11.5694 2.43984 12.2653 3.48135C12.9612 4.52286 13.3327 5.74735 13.3327 6.99996C13.335 8.44967 12.8377 9.85591 11.9247 10.982ZM6.99935 12C8.32543 12 9.5972 11.4732 10.5349 10.5355C11.4726 9.59781 11.9994 8.32604 11.9994 6.99996C11.9994 5.67388 11.4726 4.40211 10.5349 3.46443C9.5972 2.52675 8.32543 1.99996 6.99935 1.99996C5.67327 1.99996 4.4015 2.52675 3.46382 3.46443C2.52614 4.40211 1.99935 5.67388 1.99935 6.99996C1.99935 8.32604 2.52614 9.59781 3.46382 10.5355C4.4015 11.4732 5.67327 12 6.99935 12Z",
|
26
|
+
fill: "black",
|
27
|
+
fillOpacity: "0.85"
|
28
|
+
}), /*#__PURE__*/React.createElement("path", {
|
29
|
+
id: "Vector_2",
|
30
|
+
d: "M7.66732 6.33337H9.66732V7.66671H7.66732V9.66671H6.33398V7.66671H4.33398V6.33337H6.33398V4.33337H7.66732V6.33337Z",
|
31
|
+
fill: "black",
|
32
|
+
fillOpacity: "0.85"
|
33
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
34
|
+
id: "clip0_628_30973"
|
35
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
36
|
+
width: "16",
|
37
|
+
height: "16",
|
38
|
+
fill: "white"
|
39
|
+
}))));
|
40
|
+
});
|
@@ -0,0 +1,66 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var ResetIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
style: style,
|
13
|
+
className: className
|
14
|
+
}, rest, {
|
15
|
+
width: "16",
|
16
|
+
height: "16",
|
17
|
+
viewBox: "0 0 16 16",
|
18
|
+
fill: "none",
|
19
|
+
xmlns: "http://www.w3.org/2000/svg"
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "\xE6\x94\xBE\xE5\xA4\xA7"
|
22
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
23
|
+
id: "rect-stroke",
|
24
|
+
x: "0.5",
|
25
|
+
y: "2.5",
|
26
|
+
width: "15",
|
27
|
+
height: "11",
|
28
|
+
rx: "0.5",
|
29
|
+
stroke: "black",
|
30
|
+
strokeOpacity: "0.85"
|
31
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
32
|
+
id: "reset-icon-rect",
|
33
|
+
x: "4",
|
34
|
+
y: "5",
|
35
|
+
width: "1",
|
36
|
+
height: "6",
|
37
|
+
rx: "0.5",
|
38
|
+
fill: "black",
|
39
|
+
fillOpacity: "0.85"
|
40
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
41
|
+
id: "reset-icon-rect",
|
42
|
+
x: "11",
|
43
|
+
y: "5",
|
44
|
+
width: "1",
|
45
|
+
height: "6",
|
46
|
+
rx: "0.5",
|
47
|
+
fill: "black",
|
48
|
+
fillOpacity: "0.85"
|
49
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
50
|
+
id: "reset-icon-rect",
|
51
|
+
width: "1",
|
52
|
+
height: "1",
|
53
|
+
rx: "0.5",
|
54
|
+
transform: "matrix(1 0 0 -1 7 10)",
|
55
|
+
fill: "black",
|
56
|
+
fillOpacity: "0.85"
|
57
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
58
|
+
id: "reset-icon-rect",
|
59
|
+
width: "1",
|
60
|
+
height: "1",
|
61
|
+
rx: "0.5",
|
62
|
+
transform: "matrix(-4.37114e-08 1 1 4.37114e-08 7 6)",
|
63
|
+
fill: "black",
|
64
|
+
fillOpacity: "0.85"
|
65
|
+
})));
|
66
|
+
});
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var _excluded = ["style", "className"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import React, { forwardRef } from 'react';
|
6
|
+
export var ShrinkIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref,
|
12
|
+
style: style,
|
13
|
+
className: className
|
14
|
+
}, rest, {
|
15
|
+
width: "16",
|
16
|
+
height: "16",
|
17
|
+
viewBox: "0 0 16 16",
|
18
|
+
fill: "none",
|
19
|
+
xmlns: "http://www.w3.org/2000/svg"
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "\xE7\xBC\xA9\xE5\xB0\x8F",
|
22
|
+
clipPath: "url(#clip0_628_30970)"
|
23
|
+
}, /*#__PURE__*/React.createElement("path", {
|
24
|
+
id: "Vector",
|
25
|
+
d: "M11.9247 10.982L15.3327 14.3906L14.39 15.3333L10.9814 11.9253C9.8553 12.8383 8.44906 13.3356 6.99935 13.3333C5.74674 13.3333 4.52225 12.9619 3.48074 12.2659C2.43923 11.57 1.62747 10.5809 1.14811 9.42362C0.66876 8.26636 0.543339 6.99294 0.787712 5.76439C1.03208 4.53584 1.63528 3.40735 2.52101 2.52162C3.40674 1.63589 4.53523 1.0327 5.76378 0.788322C6.99233 0.543949 8.26575 0.66937 9.42301 1.14873C10.5803 1.62808 11.5694 2.43984 12.2653 3.48135C12.9612 4.52286 13.3327 5.74735 13.3327 6.99996C13.335 8.44967 12.8377 9.85591 11.9247 10.982ZM6.99935 12C8.32543 12 9.5972 11.4732 10.5349 10.5355C11.4726 9.59781 11.9994 8.32604 11.9994 6.99996C11.9994 5.67388 11.4726 4.40211 10.5349 3.46443C9.5972 2.52675 8.32543 1.99996 6.99935 1.99996C5.67327 1.99996 4.4015 2.52675 3.46382 3.46443C2.52614 4.40211 1.99935 5.67388 1.99935 6.99996C1.99935 8.32604 2.52614 9.59781 3.46382 10.5355C4.4015 11.4732 5.67327 12 6.99935 12Z",
|
26
|
+
fill: "black",
|
27
|
+
fillOpacity: "0.85"
|
28
|
+
}), /*#__PURE__*/React.createElement("path", {
|
29
|
+
id: "Vector_2",
|
30
|
+
d: "M4.33398 7.99996V6.66663H9.66732V7.99996H4.33398Z",
|
31
|
+
fill: "black",
|
32
|
+
fillOpacity: "0.85"
|
33
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
34
|
+
id: "clip0_628_30970"
|
35
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
36
|
+
width: "16",
|
37
|
+
height: "16",
|
38
|
+
fill: "white"
|
39
|
+
}))));
|
40
|
+
});
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { useBem } from "../../../hooks/useBem";
|
3
|
+
import "./phone.scss";
|
4
|
+
export default function Phone(_ref) {
|
5
|
+
var data = _ref.data;
|
6
|
+
var mb = useBem('preview-phone');
|
7
|
+
return /*#__PURE__*/React.createElement("div", {
|
8
|
+
className: "".concat(mb)
|
9
|
+
}, data === null || data === void 0 ? void 0 : data.value);
|
10
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
var _excluded = ["defaultZoom"];
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import { useReactFlow, useViewport } from '@xyflow/react';
|
6
|
+
import React, { useEffect } from 'react';
|
7
|
+
import { Button, Tooltip } from "../../..";
|
8
|
+
import { useBem } from "../../../hooks/useBem";
|
9
|
+
import "../../index.scss";
|
10
|
+
import { AdaptIcon } from "../icons/AdaptIcon";
|
11
|
+
import { MagnifyIcon } from "../icons/MagnifyIcon";
|
12
|
+
import { ResetIcon } from "../icons/ResetIcon";
|
13
|
+
import { ShrinkIcon } from "../icons/ShrinkIcon";
|
14
|
+
// 右下角缩放组件
|
15
|
+
var Controls = function Controls(_ref) {
|
16
|
+
var defaultZoom = _ref.defaultZoom,
|
17
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
18
|
+
var mb = useBem('preview');
|
19
|
+
var cbtn = mb.b('controls');
|
20
|
+
var _useViewport = useViewport(),
|
21
|
+
zoom = _useViewport.zoom;
|
22
|
+
var reactFlow = useReactFlow();
|
23
|
+
var _useReactFlow = useReactFlow(),
|
24
|
+
zoomOut = _useReactFlow.zoomOut,
|
25
|
+
zoomIn = _useReactFlow.zoomIn,
|
26
|
+
fitView = _useReactFlow.fitView;
|
27
|
+
var handleZoomTo = function handleZoomTo() {
|
28
|
+
reactFlow.zoomTo(1);
|
29
|
+
};
|
30
|
+
// 初始化放大
|
31
|
+
useEffect(function () {
|
32
|
+
// 初始化缩放
|
33
|
+
if (defaultZoom != null) {
|
34
|
+
reactFlow.zoomTo(defaultZoom);
|
35
|
+
}
|
36
|
+
}, [defaultZoom]);
|
37
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
38
|
+
className: "".concat(mb.b('controls'))
|
39
|
+
}, rest), /*#__PURE__*/React.createElement(Button, {
|
40
|
+
className: "".concat(cbtn.e('zoom'))
|
41
|
+
}, Math.round(zoom * 100), "%"), /*#__PURE__*/React.createElement(Button, {
|
42
|
+
icon: /*#__PURE__*/React.createElement(ShrinkIcon, null),
|
43
|
+
onClick: function onClick() {
|
44
|
+
return zoomOut();
|
45
|
+
},
|
46
|
+
className: "".concat(cbtn.e('shrink'))
|
47
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
48
|
+
icon: /*#__PURE__*/React.createElement(MagnifyIcon, null),
|
49
|
+
onClick: function onClick() {
|
50
|
+
return zoomIn();
|
51
|
+
},
|
52
|
+
className: "".concat(cbtn.e('magnify'))
|
53
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
54
|
+
title: "\u9002\u5E94\u89C6\u56FE"
|
55
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
56
|
+
icon: /*#__PURE__*/React.createElement(AdaptIcon, null),
|
57
|
+
onClick: function onClick() {
|
58
|
+
return fitView();
|
59
|
+
},
|
60
|
+
className: "".concat(cbtn.e('adapt'))
|
61
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
62
|
+
title: "\u91CD\u7F6E\u89C6\u56FE"
|
63
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
64
|
+
icon: /*#__PURE__*/React.createElement(ResetIcon, null),
|
65
|
+
onClick: handleZoomTo,
|
66
|
+
className: "".concat(cbtn.e('reset'))
|
67
|
+
})));
|
68
|
+
};
|
69
|
+
export default Controls;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Panel } from '@xyflow/react';
|
2
|
+
import React from 'react';
|
3
|
+
import { Segmented } from "../../..";
|
4
|
+
import { useBem } from "../../../hooks/useBem";
|
5
|
+
import "../../index.scss";
|
6
|
+
// 顶部预览组件
|
7
|
+
var TopPreview = function TopPreview(_ref) {
|
8
|
+
var mode = _ref.mode,
|
9
|
+
_onChange = _ref.onChange;
|
10
|
+
var mb = useBem('preview');
|
11
|
+
return /*#__PURE__*/React.createElement(Panel, {
|
12
|
+
className: "".concat(mb.e('pannel')),
|
13
|
+
position: "top-center"
|
14
|
+
}, /*#__PURE__*/React.createElement(Segmented, {
|
15
|
+
options: [{
|
16
|
+
value: 'phone',
|
17
|
+
label: '手机'
|
18
|
+
}, {
|
19
|
+
value: 'web',
|
20
|
+
label: '电脑'
|
21
|
+
}],
|
22
|
+
value: mode,
|
23
|
+
onChange: function onChange(value) {
|
24
|
+
_onChange(value);
|
25
|
+
}
|
26
|
+
}));
|
27
|
+
};
|
28
|
+
export default TopPreview;
|
@@ -0,0 +1,94 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
13
|
+
import { Background, ReactFlow } from '@xyflow/react';
|
14
|
+
import '@xyflow/react/dist/style.css';
|
15
|
+
import React, { useEffect, useState } from 'react';
|
16
|
+
import { useBem } from "../hooks/useBem";
|
17
|
+
import Phone from "./components/preview/phone";
|
18
|
+
import Web from "./components/preview/web";
|
19
|
+
import Controls from "./components/reactflow/Controls";
|
20
|
+
import TopPreview from "./components/reactflow/TopPreview";
|
21
|
+
import "./index.scss";
|
22
|
+
export var Preview = function Preview(_ref) {
|
23
|
+
var _ref$controls = _ref.controls,
|
24
|
+
controls = _ref$controls === void 0 ? true : _ref$controls,
|
25
|
+
defaultZoom = _ref.defaultZoom,
|
26
|
+
minZoom = _ref.minZoom,
|
27
|
+
maxZoom = _ref.maxZoom,
|
28
|
+
panOnDrag = _ref.panOnDrag,
|
29
|
+
zoomOnScroll = _ref.zoomOnScroll,
|
30
|
+
content = _ref.content,
|
31
|
+
_ref$modes = _ref.modes,
|
32
|
+
modes = _ref$modes === void 0 ? ['phone', 'web'] : _ref$modes,
|
33
|
+
_ref$width = _ref.width,
|
34
|
+
width = _ref$width === void 0 ? '50vw' : _ref$width,
|
35
|
+
_ref$height = _ref.height,
|
36
|
+
height = _ref$height === void 0 ? '50vh' : _ref$height,
|
37
|
+
style = _ref.style;
|
38
|
+
var mb = useBem('preview');
|
39
|
+
var nodeTypes = {
|
40
|
+
phone: Phone,
|
41
|
+
web: Web
|
42
|
+
};
|
43
|
+
var _useState = useState('phone'),
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
45
|
+
mode = _useState2[0],
|
46
|
+
setMode = _useState2[1];
|
47
|
+
// 切换预览组件
|
48
|
+
var changeMode = function changeMode(value) {
|
49
|
+
setMode(value);
|
50
|
+
};
|
51
|
+
// 预览模式初始值
|
52
|
+
useEffect(function () {
|
53
|
+
setMode(modes === null || modes === void 0 ? void 0 : modes[0]);
|
54
|
+
}, [modes]);
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
56
|
+
className: "".concat(mb),
|
57
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
58
|
+
width: width,
|
59
|
+
height: height
|
60
|
+
})
|
61
|
+
}, /*#__PURE__*/React.createElement(ReactFlow, {
|
62
|
+
nodeTypes: nodeTypes,
|
63
|
+
nodes: [{
|
64
|
+
id: "preview-".concat(mode),
|
65
|
+
type: mode,
|
66
|
+
data: {
|
67
|
+
value: content
|
68
|
+
},
|
69
|
+
draggable: false,
|
70
|
+
connectable: false,
|
71
|
+
position: {
|
72
|
+
x: 0,
|
73
|
+
y: 0
|
74
|
+
}
|
75
|
+
}],
|
76
|
+
maxZoom: maxZoom,
|
77
|
+
minZoom: minZoom,
|
78
|
+
panOnDrag: panOnDrag,
|
79
|
+
zoomOnScroll: zoomOnScroll,
|
80
|
+
fitView: true,
|
81
|
+
preventScrolling: false
|
82
|
+
}, controls && /*#__PURE__*/React.createElement(Controls, {
|
83
|
+
defaultZoom: defaultZoom
|
84
|
+
}), /*#__PURE__*/React.createElement(Background, {
|
85
|
+
gap: 12,
|
86
|
+
size: 1,
|
87
|
+
style: {
|
88
|
+
backgroundColor: '#F1F1F1'
|
89
|
+
}
|
90
|
+
}), (modes === null || modes === void 0 ? void 0 : modes.length) > 1 && /*#__PURE__*/React.createElement(TopPreview, {
|
91
|
+
mode: mode,
|
92
|
+
onChange: changeMode
|
93
|
+
})));
|
94
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.yot-preview {
|
2
|
+
&-controls {
|
3
|
+
display: flex;
|
4
|
+
justify-content: center;
|
5
|
+
align-items: center;
|
6
|
+
z-index: 100;
|
7
|
+
position: absolute;
|
8
|
+
bottom: 10px;
|
9
|
+
right: 10px;
|
10
|
+
background-color: #ffffff;
|
11
|
+
border-radius: 8px;
|
12
|
+
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.16);
|
13
|
+
.ant-btn.css-var-yotd.ant-btn-default.ant-btn-color-default.ant-btn-variant-outlined {
|
14
|
+
background-color: transparent;
|
15
|
+
border: none;
|
16
|
+
&:hover .ant-btn-icon svg path {
|
17
|
+
fill: var(--ant-color-primary);
|
18
|
+
}
|
19
|
+
&:hover .ant-btn-icon svg #rect-stroke {
|
20
|
+
stroke: var(--ant-color-primary);
|
21
|
+
}
|
22
|
+
&:hover .ant-btn-icon svg #reset-icon-rect {
|
23
|
+
fill: var(--ant-color-primary);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
&--zoom {
|
27
|
+
width: 64px;
|
28
|
+
background-color: transparent;
|
29
|
+
border: none;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
.react-flow__panel.center {
|
33
|
+
transform: translateX(-63%);
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export interface PrevewProps {
|
2
|
+
controls?: boolean; // 是否显示右下角的放大缩小组件
|
3
|
+
defaultZoom?: number; // 初始化放大倍数
|
4
|
+
maxZoom?: number; // 最大放大倍数
|
5
|
+
minZoom?: number; // 最小放大倍数
|
6
|
+
panOnDrag?: boolean; // 是否可以拖拽
|
7
|
+
zoomOnScroll?: boolean; // 是否可以滚动
|
8
|
+
modes?: ['phone', 'web'] | ['phone'] | ['web']; // 预览模式
|
9
|
+
content?: ReactNode; // 数据
|
10
|
+
width?: number | string; // 宽度
|
11
|
+
height?: number | string; // 高度
|
12
|
+
style?: React.CSSProperties; // 样式
|
13
|
+
}
|
14
|
+
|
15
|
+
export interface TopPreviewProps {
|
16
|
+
mode: string;
|
17
|
+
onChange: (value: string) => void;
|
18
|
+
}
|
19
|
+
export interface ControlsProps {
|
20
|
+
defaultZoom?: number; // 初始化放大倍数
|
21
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export type { AlertProps } from 'antd/es/alert';
|
3
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<import("antd").AlertProps & import("react").RefAttributes<import("antd/es/alert/Alert").AlertRef>> & {
|
4
|
+
ErrorBoundary: typeof import("antd/es/alert/ErrorBoundary").default;
|
5
|
+
};
|