@cloudbase/weda-ui 0.2.9 → 0.2.13
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/package.json +61 -40
- package/src/.DS_Store +0 -0
- package/src/configs/.DS_Store +0 -0
- package/src/configs/components/button.json +7 -3
- package/src/configs/components/form/richText.json +1 -1
- package/src/configs/components/form/uploader.json +29 -1
- package/src/configs/components/form/uploaderFile.json +158 -0
- package/src/configs/components/image.json +12 -3
- package/src/configs/components/link.json +3 -3
- package/src/configs/components/richtextview.json +2 -2
- package/src/configs/components/scrollVeiw.json +5 -5
- package/src/configs/components/swiper.json +6 -6
- package/src/configs/components/tabs.json +3 -3
- package/src/configs/components/text.json +39 -4
- package/src/configs/index.js +5 -3
- package/src/mp/components/button/index.js +1 -0
- package/src/mp/components/button/index.wxss +8 -0
- package/src/mp/components/form/select/index.js +18 -0
- package/src/mp/components/form/uploader/index.js +26 -29
- package/src/mp/components/form/uploaderFile/index.js +247 -0
- package/src/mp/components/form/uploaderFile/index.json +9 -0
- package/src/mp/components/form/uploaderFile/index.wxml +46 -0
- package/src/mp/components/form/uploaderFile/index.wxss +104 -0
- package/src/mp/components/text/index.js +33 -0
- package/src/mp/components/text/index.wxml +1 -1
- package/src/mp/components/text/index.wxss +18 -0
- package/src/mp/index.json +1 -0
- package/src/mp/utils/platform.js +20 -0
- package/src/mp/utils/tcb.js +11 -0
- package/src/web/.DS_Store +0 -0
- package/src/web/actions/showModal/{index.jsx → index.tsx} +53 -3
- package/src/web/components/auth/index.js +2 -2
- package/src/web/components/button/index.css +9 -0
- package/src/web/components/button/{index.jsx → index.tsx} +27 -41
- package/src/web/components/container/{index.jsx → index.tsx} +6 -10
- package/src/web/components/drawer/index.tsx +57 -0
- package/src/web/components/form/checkbox/{index.jsx → index.tsx} +24 -48
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +1 -6
- package/src/web/components/form/enumSelect/{NormalSelect.jsx → NormalSelect.tsx} +3 -14
- package/src/web/components/form/form/index.tsx +48 -0
- package/src/web/components/form/formcell/{index.jsx → index.tsx} +6 -13
- package/src/web/components/form/input/index.css +4 -0
- package/src/web/components/form/input/{index.jsx → index.tsx} +33 -67
- package/src/web/components/form/radio/{index.jsx → index.tsx} +19 -42
- package/src/web/components/form/{renderDecorator.jsx → renderDecorator.tsx} +1 -3
- package/src/web/components/form/select/{h5.jsx → h5.tsx} +18 -62
- package/src/web/components/form/select/{index.jsx → index.tsx} +51 -94
- package/src/web/components/form/select/region/{cities.js → cities.ts} +1 -1
- package/src/web/components/form/select/region/{index.js → index.ts} +3 -3
- package/src/web/components/form/select/region/{provinces.js → provinces.ts} +1 -1
- package/src/web/components/form/select/region/{regions.js → regions.ts} +1 -1
- package/src/web/components/form/select/time.jsx +2 -2
- package/src/web/components/form/switch/{index.jsx → index.tsx} +30 -47
- package/src/web/components/form/textarea/{index.jsx → index.tsx} +22 -55
- package/src/web/components/form/tips/{index.jsx → index.tsx} +8 -22
- package/src/web/components/form/types.d.ts +12 -0
- package/src/web/components/form/uploader/{index.jsx → index.tsx} +16 -14
- package/src/web/components/form/uploader/{uploader.h5.jsx → uploader.h5.tsx} +67 -57
- package/src/web/components/form/uploader/{uploader.pc.jsx → uploader.pc.tsx} +26 -43
- package/src/web/components/form/uploaderFile/fail.svg +12 -0
- package/src/web/components/form/uploaderFile/index.css +423 -0
- package/src/web/components/form/uploaderFile/index.jsx +30 -0
- package/src/web/components/form/uploaderFile/pending.svg +18 -0
- package/src/web/components/form/uploaderFile/success.svg +12 -0
- package/src/web/components/form/uploaderFile/uploadFile.h5.jsx +562 -0
- package/src/web/components/form/uploaderFile/uploadFile.pc.jsx +487 -0
- package/src/web/components/image/{image.jsx → image.tsx} +8 -21
- package/src/web/components/image/{index.jsx → index.tsx} +22 -37
- package/src/web/components/index.js +36 -1
- package/src/web/components/link/{index.jsx → index.tsx} +19 -36
- package/src/web/components/modal/{index.jsx → index.tsx} +24 -10
- package/src/web/components/picker/{datePicker.jsx → datePicker.tsx} +11 -12
- package/src/web/components/picker/{picker.jsx → picker.tsx} +7 -10
- package/src/web/components/picker/{timePicker.jsx → timePicker.tsx} +8 -16
- package/src/web/components/richText/{const.js → const.ts} +0 -0
- package/src/web/components/richText/index.jsx +5 -2
- package/src/web/components/richTextView/index.tsx +67 -0
- package/src/web/components/scrollView/{index.jsx → index.tsx} +18 -33
- package/src/web/components/slot/{index.jsx → index.tsx} +8 -9
- package/src/web/components/swiper/index.css +1 -1
- package/src/web/components/swiper/{index.jsx → index.tsx} +66 -73
- package/src/web/components/tabs/index.tsx +33 -0
- package/src/web/components/tabs/{tabs.h5.jsx → tabs.h5.tsx} +4 -33
- package/src/web/components/tabs/{tabs.pc.jsx → tabs.pc.tsx} +5 -39
- package/src/web/components/text/index.css +18 -0
- package/src/web/components/text/index.tsx +69 -0
- package/src/web/components/uploaderFileView/index.css +11 -0
- package/src/web/components/uploaderFileView/index.jsx +75 -0
- package/src/web/components/uploaderView/{index.jsx → index.tsx} +12 -15
- package/src/web/types.d.ts +20 -0
- package/src/web/utils/constant.js +2 -0
- package/src/web/utils/loading-fallback.tsx +2 -0
- package/src/web/utils/platform.js +77 -6
- package/src/web/utils/tcb.js +0 -8
- package/src/web/utils/useSetState.ts +14 -0
- package/src/web/utils/useSyncValue.ts +17 -0
- package/src/web/wedatheme/.code.yml +16 -0
- package/src/web/wedatheme/.editorconfig +9 -0
- package/src/web/wedatheme/.eslintrc +20 -0
- package/src/web/wedatheme/.git +1 -0
- package/src/web/wedatheme/.gitignore +5 -0
- package/src/web/wedatheme/.npmrc +1 -0
- package/src/web/wedatheme/.orange-ci.yml +55 -0
- package/src/web/wedatheme/.vscode/extensions.json +3 -0
- package/src/web/wedatheme/.vscode/settings.json +11 -0
- package/src/web/wedatheme/README.md +50 -0
- package/src/web/wedatheme/i18n/README.md +4 -0
- package/src/web/wedatheme/i18n/translation/index.js +10 -0
- package/src/web/wedatheme/i18n/translation/zh.js +15 -0
- package/src/web/wedatheme/jsconfig.json +15 -0
- package/src/web/wedatheme/mock/app.js +42 -0
- package/src/web/wedatheme/mock/history-context.js +8 -0
- package/src/web/wedatheme/mock/index.js +3 -0
- package/src/web/wedatheme/mock/layout/AppLayout.jsx +28 -0
- package/src/web/wedatheme/mock/layout/MenuWithRouter.jsx +50 -0
- package/src/web/wedatheme/mock/layout/index.js +1 -0
- package/src/web/wedatheme/package-lock.json +14335 -0
- package/src/web/wedatheme/package.json +61 -0
- package/src/web/wedatheme/public/index.html +19 -0
- package/src/web/wedatheme/src/app.js +22 -0
- package/src/web/wedatheme/src/components/README.md +4 -0
- package/src/web/wedatheme/src/configs/menu.js +9 -0
- package/src/web/wedatheme/src/routes/wedatheme-index/Component.jsx +402 -0
- package/src/web/wedatheme/src/routes/wedatheme-index/Form.jsx +729 -0
- package/src/web/wedatheme/src/routes/wedatheme-index/FormItem.jsx +18 -0
- package/src/web/wedatheme/src/routes/wedatheme-index/WedathemeIndex.jsx +1276 -0
- package/src/web/wedatheme/src/routes/wedatheme-index/index.js +1 -0
- package/src/web/wedatheme/src/routes/weui2td/WEUI2TD.jsx +3 -0
- package/src/web/wedatheme/src/routes/weui2td/index.js +1 -0
- package/src/web/wedatheme/src/styles/_btn.scss +24 -0
- package/src/web/wedatheme/src/styles/_icon.scss +653 -0
- package/src/web/wedatheme/src/styles/_map.scss +12 -0
- package/src/web/wedatheme/src/styles/_middle.scss +340 -0
- package/src/web/wedatheme/src/styles/_upload.scss +47 -0
- package/src/web/wedatheme/src/styles/assets/alert-close.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/and.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowdown--line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowdown.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowleft--line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowleft.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowright--line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowright-blue--line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowright.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowup--line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/arrowup.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/bell-warning.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/btnback.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/calendar.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/chartcolumn-1.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/chartcolumn.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/chartline-1.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/chartline.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/chartpie-1.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/chartpie.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/check-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/check-2.svg +1 -0
- package/src/web/wedatheme/src/styles/assets/check.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/close-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/close.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/consult.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/convertip--blue.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/convertip.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/copy.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/cur-active.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/cur.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/daily.svg +13 -0
- package/src/web/wedatheme/src/styles/assets/database.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/datasheet.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/delete-white.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/delete.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/detail.svg +13 -0
- package/src/web/wedatheme/src/styles/assets/dismiss.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/download.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/drop.svg +15 -0
- package/src/web/wedatheme/src/styles/assets/email-error.svg +14 -0
- package/src/web/wedatheme/src/styles/assets/email-warning.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/email.svg +14 -0
- package/src/web/wedatheme/src/styles/assets/emailv.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/error-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/error-filled.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/error.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/externallink.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/favorable.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/filter.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/firstpage.svg +13 -0
- package/src/web/wedatheme/src/styles/assets/folderclose.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/folderopen.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/fullscreenquit.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/fullsreen.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/globe-gray.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/guide.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/help.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/hide.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/info.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/infoblue-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/infoblue-filled.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/infoblue.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/jump-black.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/jump.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/lastpage.svg +13 -0
- package/src/web/wedatheme/src/styles/assets/loading.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/local.svg +10 -0
- package/src/web/wedatheme/src/styles/assets/menu-fold-white.svg +6 -0
- package/src/web/wedatheme/src/styles/assets/menu-fold.svg +6 -0
- package/src/web/wedatheme/src/styles/assets/minus.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/monitor.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/more.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/multi-line.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/news.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/not.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/notice.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/pencil.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/pending-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/pending-gray.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/pending.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/percent-blue.svg +16 -0
- package/src/web/wedatheme/src/styles/assets/percent.svg +16 -0
- package/src/web/wedatheme/src/styles/assets/phone-error.svg +11 -0
- package/src/web/wedatheme/src/styles/assets/phone-warning.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/phone.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/phonev.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/plus.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/qq.svg +11 -0
- package/src/web/wedatheme/src/styles/assets/realname.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/realnamev.svg +9 -0
- package/src/web/wedatheme/src/styles/assets/refresh-blue.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/refresh.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/relationship-1.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/relationship.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/remind.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/search.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/setting.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/shopcart.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/show.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/sort.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/sortdown.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/sortup.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/success-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/success-filled.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/success.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/table-1.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/table.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/tag.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/time.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/transfer.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/trenddown.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/trendup.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/viewgrid.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/viewlist.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/warning-1.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/warning-filled.svg +3 -0
- package/src/web/wedatheme/src/styles/assets/warning.svg +8 -0
- package/src/web/wedatheme/src/styles/assets/wechat-error.svg +14 -0
- package/src/web/wedatheme/src/styles/assets/wechat-warning.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/wechat.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/wechatv.svg +12 -0
- package/src/web/wedatheme/src/styles/assets/zoom-in-white.svg +4 -0
- package/src/web/wedatheme/src/styles/assets/zoom-in.svg +4 -0
- package/src/web/wedatheme/src/styles/assets/zoom-out-white.svg +4 -0
- package/src/web/wedatheme/src/styles/assets/zoom-out.svg +4 -0
- package/src/web/wedatheme/src/styles/index.scss +18 -0
- package/src/web/wedatheme/src/styles/main.css +166 -0
- package/src/web/wedatheme/src/styles/theme/_alert.scss +73 -0
- package/src/web/wedatheme/src/styles/theme/_badge.scss +38 -0
- package/src/web/wedatheme/src/styles/theme/_blank-page-v2.scss +7 -0
- package/src/web/wedatheme/src/styles/theme/_breadcrumb.scss +8 -0
- package/src/web/wedatheme/src/styles/theme/_bubble.scss +24 -0
- package/src/web/wedatheme/src/styles/theme/_button.scss +212 -0
- package/src/web/wedatheme/src/styles/theme/_card.scss +12 -0
- package/src/web/wedatheme/src/styles/theme/_cascader.scss +43 -0
- package/src/web/wedatheme/src/styles/theme/_checkbox&radio.scss +83 -0
- package/src/web/wedatheme/src/styles/theme/_datepicker.scss +36 -0
- package/src/web/wedatheme/src/styles/theme/_dialog.scss +39 -0
- package/src/web/wedatheme/src/styles/theme/_divider.scss +1 -0
- package/src/web/wedatheme/src/styles/theme/_drawer.scss +15 -0
- package/src/web/wedatheme/src/styles/theme/_dropdown.scss +53 -0
- package/src/web/wedatheme/src/styles/theme/_form.scss +38 -0
- package/src/web/wedatheme/src/styles/theme/_icon.scss +0 -0
- package/src/web/wedatheme/src/styles/theme/_input&textarea&select.scss +85 -0
- package/src/web/wedatheme/src/styles/theme/_inputnumber.scss +16 -0
- package/src/web/wedatheme/src/styles/theme/_link.scss +14 -0
- package/src/web/wedatheme/src/styles/theme/_list.scss +41 -0
- package/src/web/wedatheme/src/styles/theme/_metrics-board.scss +14 -0
- package/src/web/wedatheme/src/styles/theme/_notification.scss +27 -0
- package/src/web/wedatheme/src/styles/theme/_pagination.scss +22 -0
- package/src/web/wedatheme/src/styles/theme/_popconfirm.scss +4 -0
- package/src/web/wedatheme/src/styles/theme/_progress.scss +28 -0
- package/src/web/wedatheme/src/styles/theme/_region-select.scss +17 -0
- package/src/web/wedatheme/src/styles/theme/_search.scss +18 -0
- package/src/web/wedatheme/src/styles/theme/_segment.scss +69 -0
- package/src/web/wedatheme/src/styles/theme/_slider.scss +18 -0
- package/src/web/wedatheme/src/styles/theme/_status.scss +4 -0
- package/src/web/wedatheme/src/styles/theme/_steps.scss +68 -0
- package/src/web/wedatheme/src/styles/theme/_switch.scss +11 -0
- package/src/web/wedatheme/src/styles/theme/_table.scss +44 -0
- package/src/web/wedatheme/src/styles/theme/_tabs.scss +44 -0
- package/src/web/wedatheme/src/styles/theme/_tag-search.scss +9 -0
- package/src/web/wedatheme/src/styles/theme/_tag.scss +48 -0
- package/src/web/wedatheme/src/styles/theme/_timeline.scss +0 -0
- package/src/web/wedatheme/src/styles/theme/_toast.scss +3 -0
- package/src/web/wedatheme/src/styles/theme/_transfer.scss +9 -0
- package/src/web/wedatheme/src/styles/theme/_tree.scss +11 -0
- package/src/web/wedatheme/src/styles/theme/_upload.scss +14 -0
- package/src/web/wedatheme/src/styles/theme/_variables.scss +140 -0
- package/src/web/wedatheme/src/styles/theme/index.scss +91 -0
- package/src/web/wedatheme/style-package/README.md +31 -0
- package/src/web/wedatheme/style-package/ef6fa527e24e354765d806b826b41391.svg +627 -0
- package/src/web/wedatheme/style-package/index.css +3 -0
- package/src/web/wedatheme/style-package/package.json +15 -0
- package/src/web/wedatheme/tea.config.js +66 -0
- package/src/web/wedatheme/webpack/css.config.js +114 -0
- package/src/web/wedatheme/webpack/plugins/css-package-plugin.js +23 -0
- package/src/web/wedatheme/webpack/plugins/inject-assets-plugin.js +32 -0
- package/src/web/wedatheme/webpack/plugins/package-json-plugin.js +66 -0
- package/src/configs/components/button.svg +0 -18
- package/src/web/components/drawer/index.jsx +0 -64
- package/src/web/components/form/enumSelect/hooks/index.js +0 -49
- package/src/web/components/form/form/index.jsx +0 -76
- package/src/web/components/richTextView/index.jsx +0 -89
- package/src/web/components/tabs/index.jsx +0 -10
- package/src/web/components/text/index.jsx +0 -71
- package/src/web/utils/useSyncValue.js +0 -14
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { CommonPropsType } from '../../types';
|
|
2
3
|
import classNames from '../../utils/classnames';
|
|
3
4
|
import './index.css';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
export interface PropsType extends CommonPropsType {
|
|
7
|
+
/**
|
|
8
|
+
* 内容
|
|
9
|
+
*/
|
|
10
|
+
content?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 链接地址
|
|
13
|
+
*/
|
|
14
|
+
url?: string;
|
|
15
|
+
/**
|
|
16
|
+
* 参数
|
|
17
|
+
*/
|
|
18
|
+
params?: {key: string, value: string}[];
|
|
19
|
+
contentSlot?: React.ReactNode;
|
|
20
|
+
}
|
|
5
21
|
|
|
6
22
|
// 所有绝对地址直接交由浏览器,新开窗口交由浏览器
|
|
7
23
|
// 当前窗口相对地址交给平台
|
|
@@ -13,7 +29,7 @@ export default function Link({
|
|
|
13
29
|
className,
|
|
14
30
|
contentSlot,
|
|
15
31
|
params = [], // TODO 格式定义
|
|
16
|
-
}) {
|
|
32
|
+
}: PropsType) {
|
|
17
33
|
url = url.trim();
|
|
18
34
|
const cls = classNames({
|
|
19
35
|
'weda-link': true,
|
|
@@ -97,37 +113,4 @@ export default function Link({
|
|
|
97
113
|
{content}
|
|
98
114
|
</a>
|
|
99
115
|
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
Link.propTypes = {
|
|
103
|
-
// 系统属性
|
|
104
|
-
/**
|
|
105
|
-
* 类名
|
|
106
|
-
*/
|
|
107
|
-
className: PropTypes.string,
|
|
108
|
-
/**
|
|
109
|
-
* 事件
|
|
110
|
-
*/
|
|
111
|
-
events: PropTypes.objectOf(PropTypes.func),
|
|
112
|
-
/**
|
|
113
|
-
* 内联样式
|
|
114
|
-
*/
|
|
115
|
-
style: PropTypes.object,
|
|
116
|
-
// 组件属性
|
|
117
|
-
/**
|
|
118
|
-
* 内容
|
|
119
|
-
*/
|
|
120
|
-
content: PropTypes.string,
|
|
121
|
-
/**
|
|
122
|
-
* 链接地址
|
|
123
|
-
*/
|
|
124
|
-
url: PropTypes.string,
|
|
125
|
-
/**
|
|
126
|
-
* 参数
|
|
127
|
-
*/
|
|
128
|
-
params: PropTypes.array,
|
|
129
|
-
|
|
130
|
-
contentSlot: PropTypes.any,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
Link.defaultProps = {};
|
|
116
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Modal, Button } from 'tea-component';
|
|
2
|
+
import { Modal, Button, ModalProps, ConfigProvider } from 'tea-component';
|
|
3
|
+
import { unknownFunction } from '../../types';
|
|
3
4
|
import classNames from '../../utils/classnames';
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
+
export interface PropTypes extends ModalProps {
|
|
7
|
+
content: string,
|
|
8
|
+
customButton: React.ReactNode,
|
|
9
|
+
customContent: React.ReactNode,
|
|
10
|
+
isDefaultButton: boolean,
|
|
11
|
+
emit?: unknownFunction,
|
|
12
|
+
events: Record<string, unknownFunction>,
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function WeDaModal(_props: PropTypes) {
|
|
6
17
|
const {
|
|
7
18
|
className,
|
|
8
19
|
content,
|
|
@@ -11,34 +22,37 @@ export default function WeDaModal(_props) {
|
|
|
11
22
|
customContent,
|
|
12
23
|
isDefaultButton,
|
|
13
24
|
emit,
|
|
25
|
+
events,
|
|
14
26
|
...props
|
|
15
27
|
} = _props;
|
|
16
28
|
|
|
17
29
|
return (
|
|
30
|
+
<ConfigProvider classPrefix="wedatea2td">
|
|
18
31
|
<Modal
|
|
19
32
|
className={classNames('weda-ui', 'lcap-modal', 'container', className)}
|
|
20
33
|
visible={visible}
|
|
21
34
|
onClose={() => {
|
|
22
|
-
emit('close');
|
|
35
|
+
emit('close', {});
|
|
23
36
|
}}
|
|
24
37
|
{...props}
|
|
25
|
-
|
|
38
|
+
>
|
|
26
39
|
<Modal.Body>{content ? content : customContent}</Modal.Body>
|
|
27
40
|
<Modal.Footer>
|
|
28
41
|
{isDefaultButton ? (
|
|
29
42
|
<Button
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
type="primary"
|
|
44
|
+
onClick={() => {
|
|
45
|
+
emit('confirm', {});
|
|
46
|
+
// events.confirm();
|
|
47
|
+
}}
|
|
35
48
|
>
|
|
36
49
|
确定
|
|
37
50
|
</Button>
|
|
38
51
|
) : (
|
|
39
52
|
customButton
|
|
40
|
-
|
|
53
|
+
)}
|
|
41
54
|
</Modal.Footer>
|
|
42
55
|
</Modal>
|
|
56
|
+
</ConfigProvider>
|
|
43
57
|
);
|
|
44
58
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
2
|
import weui from '../../utils/weui';
|
|
4
3
|
|
|
5
4
|
import classNames from '../../utils/classnames';
|
|
5
|
+
import { CommonPropsType } from '../../types';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export interface PropsType extends CommonPropsType {
|
|
8
|
+
start: string;
|
|
9
|
+
end: string;
|
|
10
|
+
defaultValue: string;
|
|
11
|
+
title: string;
|
|
12
|
+
children?: React.ReactNode|undefined
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function DatePicker(props: PropsType) {
|
|
8
16
|
const { start, end, defaultValue, title, children, className } = props;
|
|
9
17
|
const click = function () {
|
|
10
18
|
let fixedDefaultValue = undefined;
|
|
@@ -37,13 +45,4 @@ export default function DatePicker(props) {
|
|
|
37
45
|
{children}
|
|
38
46
|
</div>
|
|
39
47
|
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
DatePicker.propTypes = {
|
|
43
|
-
start: PropTypes.string,
|
|
44
|
-
end: PropTypes.string,
|
|
45
|
-
defaultValue: PropTypes.string,
|
|
46
|
-
title: PropTypes.string,
|
|
47
|
-
children: PropTypes.any,
|
|
48
|
-
className: PropTypes.string,
|
|
49
|
-
};
|
|
48
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
2
|
import weui from '../../utils/weui';
|
|
4
|
-
|
|
5
3
|
import classNames from '../../utils/classnames';
|
|
4
|
+
import { CommonPropsType } from '../../types';
|
|
5
|
+
|
|
6
|
+
export interface PropsType extends CommonPropsType {
|
|
7
|
+
title?: string
|
|
8
|
+
}
|
|
6
9
|
|
|
7
|
-
export default function Picker(props) {
|
|
10
|
+
export default function Picker(props: PropsType) {
|
|
8
11
|
const { title, children, className } = props;
|
|
9
12
|
const click = function () {
|
|
10
13
|
weui.picker(
|
|
@@ -53,10 +56,4 @@ export default function Picker(props) {
|
|
|
53
56
|
{children}
|
|
54
57
|
</div>
|
|
55
58
|
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Picker.propTypes = {
|
|
59
|
-
title: PropTypes.string,
|
|
60
|
-
children: PropTypes.any,
|
|
61
|
-
className: PropTypes.string,
|
|
62
|
-
};
|
|
59
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
2
|
import weui from '../../utils/weui';
|
|
4
3
|
|
|
5
4
|
import classNames from '../../utils/classnames';
|
|
5
|
+
import { CommonPropsType } from '../../types';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
7
|
+
export interface PropsType extends CommonPropsType {
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function TimePicker(props: PropsType) {
|
|
12
|
+
const { title = '时间', defaultValue = '', children, className } = props;
|
|
9
13
|
|
|
10
14
|
const click = function () {
|
|
11
15
|
const hour = [];
|
|
@@ -49,16 +53,4 @@ export default function TimePicker(props) {
|
|
|
49
53
|
{children}
|
|
50
54
|
</div>
|
|
51
55
|
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
TimePicker.propTypes = {
|
|
55
|
-
title: PropTypes.string,
|
|
56
|
-
defaultValue: PropTypes.string,
|
|
57
|
-
children: PropTypes.any,
|
|
58
|
-
className: PropTypes.string,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
TimePicker.defaultProps = {
|
|
62
|
-
title: '时间',
|
|
63
|
-
defaultValue: '',
|
|
64
|
-
};
|
|
56
|
+
}
|
|
File without changes
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import BraftEditor from 'braft-editor';
|
|
3
|
-
import { useSetState } from '
|
|
4
|
+
import { useSetState } from '../../utils/useSetState';
|
|
4
5
|
import * as PropsTypes from 'prop-types';
|
|
5
6
|
import { ContentUtils } from 'braft-utils';
|
|
6
7
|
import classNames from '../../utils/classnames';
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
import { getCloudInstance, getTempFileURL } from '../../utils/tcb';
|
|
9
10
|
import {
|
|
10
11
|
message,
|
|
@@ -149,6 +150,7 @@ export default function RichText({
|
|
|
149
150
|
}
|
|
150
151
|
}}
|
|
151
152
|
excludeControls={['media', 'fullscreen']}
|
|
153
|
+
/** @ts-ignore */
|
|
152
154
|
extendControls={extendControls}
|
|
153
155
|
handleKeyCommand={(command, editState) => {
|
|
154
156
|
const newState = ContentUtils.handleKeyCommand(
|
|
@@ -194,6 +196,7 @@ export const CustomUploader = (props) => {
|
|
|
194
196
|
const getBase64 = (file) => {
|
|
195
197
|
const reader = new FileReader();
|
|
196
198
|
reader.onloadend = () => {
|
|
199
|
+
// @ts-ignore
|
|
197
200
|
setState({ previewImg: reader.result });
|
|
198
201
|
};
|
|
199
202
|
reader.readAsDataURL(file);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import classNames from '../../utils/classnames';
|
|
3
|
+
import { getTempFileURL } from '../../utils/tcb';
|
|
4
|
+
import './index.css';
|
|
5
|
+
import { LOAD_ERR_IMG_BASE64 } from '../../utils/constant';
|
|
6
|
+
import { CommonPropsType } from '../../types';
|
|
7
|
+
|
|
8
|
+
export interface PropsType extends CommonPropsType {
|
|
9
|
+
value: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function RichTextView({
|
|
13
|
+
value = '',
|
|
14
|
+
className,
|
|
15
|
+
style,
|
|
16
|
+
id
|
|
17
|
+
}: PropsType) {
|
|
18
|
+
let parseValue = value;
|
|
19
|
+
try {
|
|
20
|
+
parseValue = JSON.parse(value);
|
|
21
|
+
} catch (e) {}
|
|
22
|
+
const cls = classNames({
|
|
23
|
+
'weda-ui': true,
|
|
24
|
+
'weda-RichTextView': true,
|
|
25
|
+
[className]: className,
|
|
26
|
+
});
|
|
27
|
+
const [displayValue, setDisplayValue] = useState('');
|
|
28
|
+
const regex = new RegExp(/<img [^>]*src=\\*"([^"]*?)\\*"/g);
|
|
29
|
+
const iferror = `javascript:this.width='80';this.src='${LOAD_ERR_IMG_BASE64}';this.onerror=null`;
|
|
30
|
+
|
|
31
|
+
let tempValue = parseValue
|
|
32
|
+
.toString()
|
|
33
|
+
.replace(/<img /g, `<img onerror=${iferror} style="max-width:100%" `);
|
|
34
|
+
|
|
35
|
+
const getSrc = async (img) => {
|
|
36
|
+
const url = img.replace(regex, '$1');
|
|
37
|
+
if (img.includes('cloud://')) {
|
|
38
|
+
const newURL = await getTempFileURL(url);
|
|
39
|
+
if (newURL) {
|
|
40
|
+
tempValue = tempValue.replace(new RegExp(url, 'g'), newURL);
|
|
41
|
+
setDisplayValue(tempValue);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setDisplayValue(tempValue);
|
|
48
|
+
try {
|
|
49
|
+
const imgs = parseValue.match(regex);
|
|
50
|
+
if (imgs && imgs.length > 0) {
|
|
51
|
+
imgs.forEach((img) => {
|
|
52
|
+
getSrc(img);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {}
|
|
56
|
+
}, [value]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
displayValue && (
|
|
60
|
+
<div className={cls} style={style}
|
|
61
|
+
id={id}
|
|
62
|
+
>
|
|
63
|
+
<div dangerouslySetInnerHTML={{ __html: displayValue }}></div>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { CommonPropsType } from '../../types';
|
|
4
3
|
import classNames from '../../utils/classnames';
|
|
5
4
|
|
|
5
|
+
export interface PropsType extends CommonPropsType {
|
|
6
|
+
scrollX?: boolean;
|
|
7
|
+
scrollY?: boolean;
|
|
8
|
+
scrollTop?: number;
|
|
9
|
+
scrollLeft?: number;
|
|
10
|
+
scrollIntoView?: string;
|
|
11
|
+
upperThreshold?: number;
|
|
12
|
+
lowerThreshold?: number;
|
|
13
|
+
domRef?: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
export default function ScrollView({
|
|
7
17
|
id,
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
scrollX = false,
|
|
19
|
+
scrollY = true,
|
|
10
20
|
style,
|
|
11
21
|
scrollTop,
|
|
12
22
|
scrollLeft,
|
|
@@ -23,7 +33,7 @@ export default function ScrollView({
|
|
|
23
33
|
const [scrollLeftPos, setScrollLeftPos] = React.useState(0);
|
|
24
34
|
const [scrollTopPos, setScrollTopPos] = React.useState(0);
|
|
25
35
|
|
|
26
|
-
const scrollViewRef = domRef || React.useRef(null);
|
|
36
|
+
const scrollViewRef = domRef || React.useRef<HTMLElement>(null);
|
|
27
37
|
|
|
28
38
|
const handleOnScroll = function (e) {
|
|
29
39
|
const detail = {
|
|
@@ -35,7 +45,6 @@ export default function ScrollView({
|
|
|
35
45
|
const deltaY = scrollY ? e.target.scrollTop - scrollTopPos : 0;
|
|
36
46
|
const deltaX = scrollX ? e.target.scrollLeft - scrollLeftPos : 0;
|
|
37
47
|
let delta;
|
|
38
|
-
// console.log(">>>>", deltaY, deltaX,e.target.scrollLeft,e.target.scrollTop)
|
|
39
48
|
// 横向滚动
|
|
40
49
|
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
41
50
|
delta = deltaX;
|
|
@@ -101,8 +110,8 @@ export default function ScrollView({
|
|
|
101
110
|
React.useEffect(() => {
|
|
102
111
|
if (scrollIntoView) {
|
|
103
112
|
const children = scrollViewRef.current.children;
|
|
104
|
-
const item = Array.from(children).find(
|
|
105
|
-
(item) => item && item.id === scrollIntoView
|
|
113
|
+
const item: any = Array.from(children).find(
|
|
114
|
+
(item: any) => item && item.id === scrollIntoView
|
|
106
115
|
);
|
|
107
116
|
scrollY && (scrollViewRef.current.scrollTop = item.offsetTop);
|
|
108
117
|
scrollX && (scrollViewRef.current.scrollLeft = item.offsetLeft);
|
|
@@ -136,28 +145,4 @@ export default function ScrollView({
|
|
|
136
145
|
{children}
|
|
137
146
|
</div>
|
|
138
147
|
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
ScrollView.propTypes = {
|
|
142
|
-
scrollX: PropTypes.bool,
|
|
143
|
-
scrollY: PropTypes.bool,
|
|
144
|
-
scrollTop: PropTypes.number,
|
|
145
|
-
scrollLeft: PropTypes.number,
|
|
146
|
-
scrollIntoView: PropTypes.string,
|
|
147
|
-
upperThreshold: PropTypes.number,
|
|
148
|
-
lowerThreshold: PropTypes.number,
|
|
149
|
-
domRef: PropTypes.any,
|
|
150
|
-
children: PropTypes.any,
|
|
151
|
-
id: PropTypes.string,
|
|
152
|
-
className: PropTypes.string,
|
|
153
|
-
style: PropTypes.string,
|
|
154
|
-
events: PropTypes.objectOf(PropTypes.func),
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
ScrollView.defaultProps = {
|
|
158
|
-
scrollX: false,
|
|
159
|
-
scrollY: true,
|
|
160
|
-
upperThreshold: 50,
|
|
161
|
-
lowerThreshold: 50,
|
|
162
|
-
events: {},
|
|
163
|
-
};
|
|
148
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
2
|
|
|
4
|
-
export
|
|
3
|
+
export interface PropsType {
|
|
4
|
+
className?: string,
|
|
5
|
+
name: string,
|
|
6
|
+
compositeParent: any
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
export default function Slot({ compositeParent, name, className }: PropsType) {
|
|
5
10
|
if (!compositeParent) {
|
|
6
11
|
console.warn('Slot组件只能用于实现复合组件');
|
|
7
12
|
// 兼容编辑器点击,可选中 Slot 组件
|
|
@@ -12,10 +17,4 @@ export default function Slot({ compositeParent, name, className }) {
|
|
|
12
17
|
);
|
|
13
18
|
}
|
|
14
19
|
return compositeParent.props.data[name] || null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
Slot.propTypes = {
|
|
18
|
-
className: PropTypes.string,
|
|
19
|
-
name: PropTypes.string,
|
|
20
|
-
compositeParent: PropTypes.any,
|
|
21
|
-
};
|
|
20
|
+
}
|
|
@@ -1,27 +1,49 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
-
import * as propTypes from 'prop-types';
|
|
4
3
|
import classNames from '../../utils/classnames';
|
|
5
4
|
import Swipe from 'react-easy-swipe';
|
|
5
|
+
import {useDebouncedCallback, useEventListener, useResizeObserver} from '@react-hookz/web'
|
|
6
6
|
|
|
7
7
|
import './index.css';
|
|
8
|
+
import { CommonPropsType } from '../../types';
|
|
9
|
+
|
|
10
|
+
export interface PropsType extends CommonPropsType {
|
|
11
|
+
/**
|
|
12
|
+
* 是否启用指示点
|
|
13
|
+
*/
|
|
14
|
+
indicatorDots: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 是否自动切换
|
|
17
|
+
*/
|
|
18
|
+
autoplay: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 当前索引值
|
|
21
|
+
*/
|
|
22
|
+
current: number;
|
|
23
|
+
interval: number;
|
|
24
|
+
duration: number;
|
|
25
|
+
circular: boolean;
|
|
26
|
+
vertical: boolean;
|
|
27
|
+
indicatorColor: string;
|
|
28
|
+
indicatorActiveColor: string;
|
|
29
|
+
}
|
|
8
30
|
|
|
9
31
|
export default function Swiper({
|
|
10
32
|
children,
|
|
11
33
|
className,
|
|
12
34
|
style = {},
|
|
13
|
-
autoplay,
|
|
14
|
-
circular,
|
|
15
|
-
vertical,
|
|
35
|
+
autoplay = true,
|
|
36
|
+
circular = true,
|
|
37
|
+
vertical = false,
|
|
16
38
|
indicatorDots,
|
|
17
|
-
indicatorColor,
|
|
18
|
-
indicatorActiveColor,
|
|
39
|
+
indicatorColor = 'rgba(200, 200, 200, 0.9)',
|
|
40
|
+
indicatorActiveColor = 'rgba(0, 0, 0, 0.9)',
|
|
19
41
|
duration = 500,
|
|
20
42
|
interval = 5000,
|
|
21
43
|
current = 0,
|
|
22
44
|
events = {},
|
|
23
45
|
id,
|
|
24
|
-
}) {
|
|
46
|
+
}: PropsType) {
|
|
25
47
|
const itemCount = React.Children.count(children);
|
|
26
48
|
current = Math.max(0, Math.min(itemCount - 1, current));
|
|
27
49
|
|
|
@@ -55,23 +77,11 @@ export default function Swiper({
|
|
|
55
77
|
};
|
|
56
78
|
}, [currentIndex, vertical]);
|
|
57
79
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
node.children[0] &&
|
|
63
|
-
node.children[0].getBoundingClientRect() &&
|
|
64
|
-
node.children[0].getBoundingClientRect().height;
|
|
80
|
+
const outerWrapRef = useRef<HTMLDivElement>();
|
|
81
|
+
useEventListener(outerWrapRef, 'load', (e) => {
|
|
82
|
+
setHeight(e.target.clientHeight);
|
|
83
|
+
});
|
|
65
84
|
|
|
66
|
-
if (h && height) {
|
|
67
|
-
setHeight(Math.min(h, height));
|
|
68
|
-
} else {
|
|
69
|
-
setHeight(Math.max(h, height));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[height]
|
|
74
|
-
);
|
|
75
85
|
|
|
76
86
|
const itemsClone = React.Children.map(children, (x, i) => {
|
|
77
87
|
return (
|
|
@@ -148,9 +158,7 @@ export default function Swiper({
|
|
|
148
158
|
vertical: vertical,
|
|
149
159
|
})}
|
|
150
160
|
style={{ height: height ? height : 'auto', ...style }}
|
|
151
|
-
|
|
152
|
-
cb(e.target.closest('.g-swiper-item'));
|
|
153
|
-
}}
|
|
161
|
+
ref={outerWrapRef}
|
|
154
162
|
id={id}
|
|
155
163
|
>
|
|
156
164
|
{itemCount > 0 ? (
|
|
@@ -173,17 +181,7 @@ export default function Swiper({
|
|
|
173
181
|
>
|
|
174
182
|
{itemsClone[itemCount - 1]}
|
|
175
183
|
{React.Children.map(children, (x, i) => {
|
|
176
|
-
return
|
|
177
|
-
<div
|
|
178
|
-
className={classNames('g-swiper-item', {
|
|
179
|
-
current: i === currentIndex,
|
|
180
|
-
})}
|
|
181
|
-
ref={cb}
|
|
182
|
-
data-index={i}
|
|
183
|
-
>
|
|
184
|
-
{x}
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
184
|
+
return <SwiperItem setHeight={setHeight} currentIndex={currentIndex} index={i}>{x}</SwiperItem>;
|
|
187
185
|
})}
|
|
188
186
|
{itemsClone[0]}
|
|
189
187
|
</Swipe>
|
|
@@ -234,40 +232,35 @@ export default function Swiper({
|
|
|
234
232
|
);
|
|
235
233
|
}
|
|
236
234
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
};
|
|
235
|
+
const SwiperItem: React.FC<{
|
|
236
|
+
setHeight: React.Dispatch<React.SetStateAction<number>>,
|
|
237
|
+
currentIndex: number,
|
|
238
|
+
index: number,
|
|
239
|
+
children?: React.ReactNode
|
|
240
|
+
}> = ({setHeight, children, currentIndex, index}) => {
|
|
241
|
+
const firstChildRef = useRef<HTMLDivElement>(null);
|
|
242
|
+
const syncHeight = useDebouncedCallback((e) => {
|
|
243
|
+
setHeight(e.contentRect.height);
|
|
244
|
+
}, [setHeight], 500, 2000) // 必须debounce延迟,让resize完成后再设置高度
|
|
248
245
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
style: propTypes.object,
|
|
271
|
-
events: propTypes.objectOf(propTypes.func),
|
|
272
|
-
id: propTypes.string,
|
|
273
|
-
};
|
|
246
|
+
// 因为有loading 所以得用resizeobserver
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
useResizeObserver(firstChildRef, (e) => {
|
|
249
|
+
if(currentIndex === index) {
|
|
250
|
+
syncHeight(e)
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
const wrapRef = useRef<HTMLDivElement>();
|
|
254
|
+
return (
|
|
255
|
+
<div
|
|
256
|
+
className={classNames('g-swiper-item', {
|
|
257
|
+
current: index === currentIndex,
|
|
258
|
+
})}
|
|
259
|
+
data-index={index}
|
|
260
|
+
>
|
|
261
|
+
<div ref={firstChildRef}>
|
|
262
|
+
{children}
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import loadable from '@loadable/component';
|
|
3
|
+
import { CommonPropsType } from '../../types';
|
|
4
|
+
import { usePlatform } from '../../utils/platform';
|
|
5
|
+
import { fallback } from '../../utils/loading-fallback';
|
|
6
|
+
import TabsH5 from './tabs.h5';
|
|
7
|
+
import TabsPc from './tabs.pc';
|
|
8
|
+
|
|
9
|
+
// const TabsH5 = loadable(() => import('./tabs.h5'), { fallback });
|
|
10
|
+
// const TabsPc = loadable(() => import('./tabs.pc'), { fallback });
|
|
11
|
+
|
|
12
|
+
export interface PropsType extends CommonPropsType {
|
|
13
|
+
tabs: {
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
// @deprecated
|
|
17
|
+
name?: string;
|
|
18
|
+
}[];
|
|
19
|
+
selectedIndex: number
|
|
20
|
+
[key: string]: React.ReactNode
|
|
21
|
+
// [panel: `panel${number}`]: React.ReactNode; // require typescript@4.4
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function Tabs(props: PropsType) {
|
|
25
|
+
const platform = usePlatform();
|
|
26
|
+
if (props?.showType === 'pc') {
|
|
27
|
+
return <TabsPc {...props} />;
|
|
28
|
+
}
|
|
29
|
+
if (props?.showType === 'h5') {
|
|
30
|
+
return <TabsH5 {...props} />;
|
|
31
|
+
}
|
|
32
|
+
return platform === 'h5' ? <TabsH5 {...props} /> : <TabsPc {...props} />;
|
|
33
|
+
}
|