@cloudbase/weda-ui 3.4.3 → 3.4.4
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/dist/configs/components/chart/bar.json +4 -0
- package/dist/configs/components/chart/line.js +14 -10
- package/dist/configs/components/chart/pie.json +4 -0
- package/dist/configs/components/dataView.js +507 -0
- package/dist/configs/components/form/location.json +2 -1
- package/dist/configs/components/form/userTreeSelect.json +55 -0
- package/dist/configs/components/formdetail.json +12 -2
- package/dist/configs/components/grid/col.js +125 -0
- package/dist/configs/components/grid/grid.js +131 -0
- package/dist/configs/components/grid/row.js +143 -0
- package/dist/configs/components/image.js +11 -1
- package/dist/configs/components/link.js +11 -1
- package/dist/configs/components/listView.js +988 -0
- package/dist/configs/components/navigationBar.json +9 -1
- package/dist/configs/components/repeater-item.json +17 -0
- package/dist/configs/components/repeater.js +125 -0
- package/dist/configs/components/table.json +67 -24
- package/dist/configs/components/text.js +12 -1
- package/dist/configs/components/wd-bubble.js +204 -0
- package/dist/configs/components/wd-button.js +417 -0
- package/dist/configs/components/wd-divider.js +89 -0
- package/dist/configs/components/wd-icon.js +126 -0
- package/dist/configs/components/wd-image.js +164 -0
- package/dist/configs/components/wd-link.js +234 -0
- package/dist/configs/components/wd-table.js +59 -0
- package/dist/configs/components/wd-text.js +142 -0
- package/dist/configs/components/wxOpenApi/phone.js +2 -2
- package/dist/configs/components/wxOpenApi/phoneCode.js +2 -2
- package/dist/configs/index.js +34 -3
- package/dist/configs/type-utils/index.js +4 -1
- package/dist/docs/common/componentList.js +144 -0
- package/dist/docs/common/components/classes-view.js +34 -0
- package/dist/docs/common/components/event-view.js +46 -0
- package/dist/docs/common/components/json-schema-view.js +18 -0
- package/dist/docs/common/components/methods-view.js +32 -0
- package/dist/docs/common/components/properties-view.js +45 -0
- package/dist/docs/common/format.js +60 -35
- package/dist/docs/common/helper.js +1 -0
- package/dist/docs/common/tableView.js +61 -50
- package/dist/enum/index.js +521 -0
- package/dist/index.js +1 -1
- package/dist/style/index.scss +1 -0
- package/dist/web/actions/showMessage/index.css +0 -3
- package/dist/web/actions/showMessage/index.js +1 -1
- package/dist/web/actions/showModal/index.css +0 -3
- package/dist/web/components/button/index.css +2 -5
- package/dist/web/components/button/index.js +3 -3
- package/dist/web/components/calendar/index.css +29 -32
- package/dist/web/components/calendar/index.js +37 -35
- package/dist/web/components/carousel/index.css +11 -14
- package/dist/web/components/carousel/index.js +3 -1
- package/dist/web/components/chart/common/core/eChartBar.js +10 -2
- package/dist/web/components/chart/common/core/eChartLine.js +16 -8
- package/dist/web/components/chart/common/core/eChartPie.js +2 -1
- package/dist/web/components/chart/statisticsCard/index.css +12 -15
- package/dist/web/components/chart/statisticsCard/index.js +6 -1
- package/dist/web/components/dataView/index.js +3 -3
- package/dist/web/components/emptyContent/index.css +26 -0
- package/dist/web/components/emptyContent/index.js +46 -0
- package/dist/web/components/flow/components/FlowModuleText/index.css +1 -4
- package/dist/web/components/flow/components/FlowUserSelect/index.css +29 -32
- package/dist/web/components/flow/components/HighlightTextarea/index.css +5 -8
- package/dist/web/components/flow/components/UserSelectModel/UserSelect.js +5 -2
- package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.css +1 -4
- package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.js +8 -5
- package/dist/web/components/flow/components/WedaUserTransfer/index.css +0 -3
- package/dist/web/components/flow/frame/getCommonFlowData.js +3 -1
- package/dist/web/components/flow/frame/index.js +18 -1
- package/dist/web/components/flow/frame/types.js +6 -0
- package/dist/web/components/flow/frame/utils.js +20 -11
- package/dist/web/components/flow/modules/basic/Basic.css +3 -6
- package/dist/web/components/flow/modules/basic/BasicMobile.css +9 -12
- package/dist/web/components/flow/modules/chart/Chart.js +2 -2
- package/dist/web/components/flow/modules/chart/index.css +23 -26
- package/dist/web/components/flow/modules/chart/isString.js +5 -0
- package/dist/web/components/flow/modules/control/ApprovalDrawer.css +44 -47
- package/dist/web/components/flow/modules/control/ApprovalPopup.css +34 -37
- package/dist/web/components/flow/modules/control/ApprovalPopup.js +10 -6
- package/dist/web/components/flow/modules/control/Control.css +7 -10
- package/dist/web/components/flow/modules/control/Control.js +4 -1
- package/dist/web/components/flow/modules/control/ControlMobile.css +10 -13
- package/dist/web/components/flow/modules/control/FlowTaskInfoModal.css +0 -3
- package/dist/web/components/flow/modules/control/provider/useControlModel.js +18 -5
- package/dist/web/components/flow/modules/layout/index.css +0 -3
- package/dist/web/components/flow/modules/process/Process.js +1 -1
- package/dist/web/components/flow/modules/process/ProcessMobile.js +1 -1
- package/dist/web/components/flow/modules/process/index.css +49 -43
- package/dist/web/components/form/form/index.css +2 -5
- package/dist/web/components/form/form/index.js +48 -4
- package/dist/web/components/form/formcell/index.css +29 -17
- package/dist/web/components/form/input/index.css +5 -8
- package/dist/web/components/form/input/index.js +11 -0
- package/dist/web/components/form/location/common/mapChoose.css +88 -91
- package/dist/web/components/form/location/common/selectModal.css +10 -13
- package/dist/web/components/form/location/components/LocationH5/index.css +17 -20
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +2 -3
- package/dist/web/components/form/location/components/LocationH5/location.module.css +0 -3
- package/dist/web/components/form/location/components/LocationPC/index.css +10 -13
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +2 -3
- package/dist/web/components/form/location/index.css +0 -3
- package/dist/web/components/form/radio/index.css +0 -3
- package/dist/web/components/form/select/allTimePicker/calendar.css +15 -18
- package/dist/web/components/form/select/allTimePicker/index.css +53 -27
- package/dist/web/components/form/select/dropdown-select/h5.js +22 -11
- package/dist/web/components/form/select/dropdown-select/index.css +28 -28
- package/dist/web/components/form/select/dropdown-select/index.js +37 -4
- package/dist/web/components/form/select/dropdown-select/pc.js +57 -17
- package/dist/web/components/form/select/dropdown-select/ui.js +5 -2
- package/dist/web/components/form/select/index.css +12 -8
- package/dist/web/components/form/select/index.js +2 -2
- package/dist/web/components/form/select/status/index.css +10 -13
- package/dist/web/components/form/switch/switch.module.css +0 -3
- package/dist/web/components/form/textarea/index.css +1 -4
- package/dist/web/components/form/tips/index.css +11 -2
- package/dist/web/components/form/uploader/index.css +14 -17
- package/dist/web/components/form/uploaderFile/index.css +61 -64
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +120 -38
- package/dist/web/components/form/userOrgSelect/common/utils.js +89 -1
- package/dist/web/components/form/userOrgSelect/component/depart-breadcrumb.js +15 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +63 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +96 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +69 -0
- package/dist/web/components/form/userOrgSelect/{user-select-pc → component}/error-tips.js +0 -0
- package/dist/web/components/form/userOrgSelect/component/index.css +323 -0
- package/dist/web/components/form/userOrgSelect/component/input-tags.js +21 -0
- package/dist/web/components/form/userOrgSelect/component/modal-search-h5.js +25 -0
- package/dist/web/components/form/userOrgSelect/component/modal-search.js +11 -0
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +201 -0
- package/dist/web/components/form/userOrgSelect/component/org-tree-h5.js +19 -0
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +33 -0
- package/dist/web/components/form/userOrgSelect/component/selected-list-h5.js +44 -0
- package/dist/web/components/form/userOrgSelect/component/selected-list.js +15 -0
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +55 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +151 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-list-h5.js +107 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +50 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/error-tips.js +11 -0
- package/dist/web/components/form/userOrgSelect/{user-select-pc → component/user-select-pc}/model-user-list.js +9 -9
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/org-tree.js +10 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +75 -0
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +65 -0
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +1160 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +54 -87
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +30 -35
- package/dist/web/components/form/userOrgSelect/hooks/use-views-data.js +48 -0
- package/dist/web/components/formdetail/index.css +34 -31
- package/dist/web/components/formdetail/index.js +12 -3
- package/dist/web/components/graphicCard/index.css +15 -18
- package/dist/web/components/grid/_utils.css +67 -0
- package/dist/web/components/grid/col.js +33 -0
- package/dist/web/components/grid/grid.css +1185 -0
- package/dist/web/components/grid/grid.js +19 -0
- package/dist/web/components/grid/row.js +14 -0
- package/dist/web/components/image/image.js +9 -1
- package/dist/web/components/image/index.css +2 -5
- package/dist/web/components/index.js +17 -3
- package/dist/web/components/link/index.css +0 -3
- package/dist/web/components/listView/index.css +21 -23
- package/dist/web/components/listView/index.js +171 -34
- package/dist/web/components/lottery/index.css +72 -75
- package/dist/web/components/modal/h5.css +19 -21
- package/dist/web/components/modal/modal.h5.js +11 -10
- package/dist/web/components/navLayout/index.css +14 -139
- package/dist/web/components/navigationBar/common.js +5 -4
- package/dist/web/components/navigationBar/h5Menu.js +12 -10
- package/dist/web/components/navigationBar/horizontalMenu.js +42 -35
- package/dist/web/components/navigationBar/index.css +130 -86
- package/dist/web/components/navigationBar/index.js +6 -4
- package/dist/web/components/navigationBar/verticalMenu.js +13 -9
- package/dist/web/components/pageLayout/PageContent/index.css +7 -10
- package/dist/web/components/pageLayout/index.css +0 -3
- package/dist/web/components/pageLayout/index.js +2 -1
- package/dist/web/components/repeater/index.js +17 -0
- package/dist/web/components/repeater-item/index.js +9 -0
- package/dist/web/components/richText/index.css +5 -8
- package/dist/web/components/richText/index.js +4 -2
- package/dist/web/components/richText/richtext.module.css +1 -4
- package/dist/web/components/richTextView/index.css +7 -10
- package/dist/web/components/swiper/index.css +10 -13
- package/dist/web/components/swiper/index.js +19 -5
- package/dist/web/components/table/BaseTable.js +352 -283
- package/dist/web/components/table/ExportFileModalByApi/index.css +9 -0
- package/dist/web/components/table/ExportFileModalByApi/index.js +150 -0
- package/dist/web/components/table/FieldRender.js +25 -18
- package/dist/web/components/table/FilterFields.js +17 -11
- package/dist/web/components/table/Form/Location.css +2 -5
- package/dist/web/components/table/ImportFileModal/csvTemplate.json +65 -6
- package/dist/web/components/table/ImportFileModalByApi/index.css +130 -0
- package/dist/web/components/table/ImportFileModalByApi/index.js +321 -0
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +115 -0
- package/dist/web/components/table/InOrOutRecordModeal.js +139 -0
- package/dist/web/components/table/SelectableBlock/index.css +0 -2
- package/dist/web/components/table/UserDepartment/viewCell.css +3 -6
- package/dist/web/components/table/baseTable.css +579 -0
- package/dist/web/components/table/hooks/useImportingStatus.js +69 -0
- package/dist/web/components/table/hooks/useInOutFieldsRecords.js +23 -0
- package/dist/web/components/table/index.css +275 -508
- package/dist/web/components/table/index.js +6 -4
- package/dist/web/components/tabs/index.css +19 -18
- package/dist/web/components/tabs/tabs.h5.js +7 -16
- package/dist/web/components/text/index.css +6 -9
- package/dist/web/components/uploaderFileView/index.css +0 -3
- package/dist/web/components/uploaderView/index.css +5 -8
- package/dist/web/components/wd-bubble/index.js +3 -17
- package/dist/web/components/wd-bubble/wd-bubble.js +17 -0
- package/dist/web/components/wd-button/convert-legacy-props.js +14 -0
- package/dist/web/components/wd-button/index.js +3 -0
- package/dist/web/components/wd-button/wd-button.js +89 -0
- package/dist/web/components/wd-config-provider/index.js +1 -0
- package/dist/web/components/wd-config-provider/wd-config-context.js +5 -0
- package/dist/web/components/wd-config-provider/wd-config-provider.js +12 -0
- package/dist/web/components/wd-divider/index.js +3 -0
- package/dist/web/components/wd-divider/wd-divider.js +29 -0
- package/dist/web/components/wd-icon/convert-legacy-props.js +14 -0
- package/dist/web/components/wd-icon/index.js +3 -0
- package/dist/web/components/wd-icon/wd-icon.js +63 -0
- package/dist/web/components/wd-image/image.js +171 -0
- package/dist/web/components/wd-image/index.js +82 -0
- package/dist/web/components/wd-link/index.js +3 -0
- package/dist/web/components/wd-link/wd-link.js +105 -0
- package/dist/web/components/wd-table/index.js +3 -0
- package/dist/web/components/wd-table/wd-table.js +24 -0
- package/dist/web/components/wd-text/convert-legacy-props.js +14 -0
- package/dist/web/components/wd-text/index.js +3 -0
- package/dist/web/components/wd-text/wd-text.js +91 -0
- package/dist/web/components/wedaVideo/index.css +2 -5
- package/dist/web/components/wedaVideo/index.js +8 -6
- package/dist/web/index.js +1 -1
- package/dist/web/utils/config-context/index.js +1 -0
- package/dist/web/utils/config-context/use-config.js +9 -0
- package/dist/web/utils/constant.js +1 -0
- package/dist/web/utils/datasource.js +19 -7
- package/dist/web/utils/file.js +22 -0
- package/dist/web/utils/hooks/CreatePortal.js +6 -0
- package/dist/web/utils/hooks/EnumHoc.js +23 -3
- package/dist/web/utils/hooks/context.js +5 -1
- package/dist/web/utils/platform.js +31 -11
- package/dist/web/utils/pollingInterface.js +61 -0
- package/dist/web/utils/tcb.js +16 -0
- package/dist/web/utils/tool.js +88 -0
- package/dist/web/utils/widget-api/index.js +18 -0
- package/dist/web/weda-ui.css +128 -4
- package/package.json +50 -32
- package/dist/configs/components/dataView.json +0 -305
- package/dist/configs/components/listView.json +0 -515
- package/dist/configs/components/wd-bubble.json +0 -170
- package/dist/web/components/form/userOrgSelect/comTool.js +0 -102
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +0 -155
- package/dist/web/components/form/userOrgSelect/departTreeSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/getUserService.js +0 -165
- package/dist/web/components/form/userOrgSelect/index.js +0 -17
- package/dist/web/components/form/userOrgSelect/user-select-pc/index.css +0 -216
- package/dist/web/components/form/userOrgSelect/user-select-pc/index.js +0 -195
- package/dist/web/components/form/userOrgSelect/user-select-pc/org-tree.js +0 -15
- package/dist/web/components/form/userOrgSelect/user-select-pc/search-user.js +0 -80
- package/dist/web/components/form/userOrgSelect/user-select-pc/selected-user-list.js +0 -12
- package/dist/web/components/form/userOrgSelect/user-select-pc/user-model.js +0 -36
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +0 -824
- package/dist/web/components/form/userOrgSelect/userTreeSelect.h5.js +0 -302
- package/dist/web/components/form/userOrgSelect/utils.js +0 -95
- package/dist/web/components/table/ImportFileModal/index.css +0 -263
- package/dist/web/components/wd-bubble/index.css +0 -21
- package/dist/web/utils/hooks/useRequest.js +0 -25
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { usePlatform } from '../../utils/platform';
|
|
3
|
+
// import { CreatePortal } from '../../utils/hooks/CreatePortal';
|
|
4
|
+
import { useGesture } from '@use-gesture/react';
|
|
5
|
+
import { useConfig } from '../../utils/config-context';
|
|
6
|
+
import { useRef } from 'react';
|
|
7
|
+
import { findDOMNode } from 'react-dom';
|
|
8
|
+
const ASPECT_RASIO = 1;
|
|
9
|
+
const OFFSET_RASIO = 0.5;
|
|
10
|
+
const SCALE_RASIO_PC = 0.8;
|
|
11
|
+
const SCALE_RASIO_H5 = 1;
|
|
12
|
+
export function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }) {
|
|
13
|
+
const { classPrefix } = useConfig();
|
|
14
|
+
const platform = usePlatform();
|
|
15
|
+
const [imgShow, setImgShow] = React.useState(false);
|
|
16
|
+
const imagePreviewRef = useRef();
|
|
17
|
+
const onMaskClick = () => {
|
|
18
|
+
if (maskClosable) {
|
|
19
|
+
setImgShow(false);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const [showHeight, setShowHeight] = React.useState(0);
|
|
23
|
+
const [showWidth, setShowWidth] = React.useState(0);
|
|
24
|
+
const realWidth = React.useRef(0);
|
|
25
|
+
const realHeight = React.useRef(0);
|
|
26
|
+
const [offsetHeight, setOffsetHeight] = React.useState(0);
|
|
27
|
+
const [offsetWidth, setOffsetWidth] = React.useState(0);
|
|
28
|
+
const [translateX, setTranslateX] = React.useState(0);
|
|
29
|
+
const [translateY, setTranslateY] = React.useState(0);
|
|
30
|
+
const [previewScale, setPreviewScale] = React.useState(ASPECT_RASIO);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
// 防止触发浏览器的放大缩小
|
|
33
|
+
const handler = (e) => e.preventDefault();
|
|
34
|
+
document.addEventListener('gesturestart', handler);
|
|
35
|
+
document.addEventListener('gesturechange', handler);
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener('gesturestart', handler);
|
|
38
|
+
document.removeEventListener('gesturechange', handler);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const bind = useGesture({
|
|
42
|
+
onClick: ({ event }) => {
|
|
43
|
+
// 防止冒泡出发关闭预览
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
46
|
+
const component = findDOMNode(imagePreviewRef.current);
|
|
47
|
+
if (component && event.target === component) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
onPinch: ({ offset }) => {
|
|
52
|
+
const [s] = offset;
|
|
53
|
+
setPreviewScale(s);
|
|
54
|
+
},
|
|
55
|
+
onDrag: ({ offset, event }) => {
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
const [x, y] = offset;
|
|
58
|
+
setTranslateX(x);
|
|
59
|
+
setTranslateY(y);
|
|
60
|
+
},
|
|
61
|
+
}, {
|
|
62
|
+
drag: {
|
|
63
|
+
delay: true,
|
|
64
|
+
preventDefault: true,
|
|
65
|
+
from: () => [translateX, translateY],
|
|
66
|
+
},
|
|
67
|
+
pinch: {
|
|
68
|
+
scaleBounds: { min: 0.6, max: 5 },
|
|
69
|
+
pointer: {
|
|
70
|
+
touch: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (platform === 'h5' || !imgPreview || isError) {
|
|
75
|
+
return (React.createElement(React.Fragment, null,
|
|
76
|
+
React.createElement("img", { style: {
|
|
77
|
+
objectFit,
|
|
78
|
+
...style,
|
|
79
|
+
}, className: `${className} wd-h5-image`, alt: alt, src: src, onLoad: (e) => {
|
|
80
|
+
const img = e.target;
|
|
81
|
+
const { naturalHeight, naturalWidth } = img;
|
|
82
|
+
realHeight.current = naturalHeight;
|
|
83
|
+
realWidth.current = naturalWidth;
|
|
84
|
+
setIsError(false);
|
|
85
|
+
events.load && events.load({}, { originEvent: e });
|
|
86
|
+
}, onError: (e) => {
|
|
87
|
+
setIsError(true);
|
|
88
|
+
events.error && events.error({}, { originEvent: e });
|
|
89
|
+
}, onClick: (e) => {
|
|
90
|
+
if (imgPreview && !isError) {
|
|
91
|
+
setTranslateX(0);
|
|
92
|
+
setTranslateY(0);
|
|
93
|
+
setPreviewScale(ASPECT_RASIO);
|
|
94
|
+
const windowHeight = window.innerHeight;
|
|
95
|
+
const windowWidth = window.innerWidth;
|
|
96
|
+
const widthRasio = (windowWidth * SCALE_RASIO_H5) / realWidth.current;
|
|
97
|
+
const heightRasio = (windowHeight * SCALE_RASIO_H5) / realHeight.current;
|
|
98
|
+
const scale = Math.min(widthRasio, heightRasio, ASPECT_RASIO) || ASPECT_RASIO;
|
|
99
|
+
setOffsetHeight((windowHeight - realHeight.current * scale) * OFFSET_RASIO);
|
|
100
|
+
setOffsetWidth((windowWidth - realWidth.current * scale) * OFFSET_RASIO);
|
|
101
|
+
setShowHeight(realHeight.current * scale);
|
|
102
|
+
setShowWidth(realWidth.current * scale);
|
|
103
|
+
setImgShow(true);
|
|
104
|
+
}
|
|
105
|
+
events.tap && events.tap({}, { originEvent: e });
|
|
106
|
+
}, loading: lazyLoad ? 'lazy' : undefined }),
|
|
107
|
+
imgShow && (
|
|
108
|
+
// <CreatePortal>
|
|
109
|
+
React.createElement("div", { className: `${classPrefix}-image-mask`, onClick: onMaskClick },
|
|
110
|
+
React.createElement("div", { onClick: () => setImgShow(false), className: `${classPrefix}-image-mask__close-btn` },
|
|
111
|
+
React.createElement("i", { className: `${classPrefix}-image-mask__icon-close` })),
|
|
112
|
+
React.createElement("div", { ...bind(), ref: imagePreviewRef, className: `${classPrefix}-image-preview`, style: {
|
|
113
|
+
touchAction: 'none',
|
|
114
|
+
backgroundImage: `url('${src}')`,
|
|
115
|
+
transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
|
|
116
|
+
width: showWidth,
|
|
117
|
+
height: showHeight,
|
|
118
|
+
marginTop: offsetHeight,
|
|
119
|
+
marginLeft: offsetWidth,
|
|
120
|
+
} }))
|
|
121
|
+
// </CreatePortal>
|
|
122
|
+
)));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return (React.createElement(React.Fragment, null,
|
|
126
|
+
React.createElement("img", { style: {
|
|
127
|
+
objectFit,
|
|
128
|
+
cursor: 'zoom-in',
|
|
129
|
+
...style,
|
|
130
|
+
}, className: `${className} wd-pc-image`, alt: alt, src: src, onLoad: (e) => {
|
|
131
|
+
const img = e.target;
|
|
132
|
+
const { naturalHeight, naturalWidth } = img;
|
|
133
|
+
realHeight.current = naturalHeight;
|
|
134
|
+
realWidth.current = naturalWidth;
|
|
135
|
+
setIsError(false);
|
|
136
|
+
events.load && events.load({}, { originEvent: e });
|
|
137
|
+
}, onError: (e) => {
|
|
138
|
+
setIsError(true);
|
|
139
|
+
events.error && events.error({}, { originEvent: e });
|
|
140
|
+
}, loading: lazyLoad ? 'lazy' : undefined, onClick: (e) => {
|
|
141
|
+
if (imgPreview && !isError) {
|
|
142
|
+
const windowHeight = window.innerHeight;
|
|
143
|
+
const windowWidth = window.innerWidth;
|
|
144
|
+
const widthRasio = (windowWidth * SCALE_RASIO_PC) / realWidth.current;
|
|
145
|
+
const heightRasio = (windowHeight * SCALE_RASIO_PC) / realHeight.current;
|
|
146
|
+
const scale = Math.min(widthRasio, heightRasio, ASPECT_RASIO) || ASPECT_RASIO;
|
|
147
|
+
setOffsetHeight((windowHeight - realHeight.current * scale) * OFFSET_RASIO);
|
|
148
|
+
setOffsetWidth((windowWidth - realWidth.current * scale) * OFFSET_RASIO);
|
|
149
|
+
setShowHeight(realHeight.current * scale);
|
|
150
|
+
setShowWidth(realWidth.current * scale);
|
|
151
|
+
setImgShow(true);
|
|
152
|
+
}
|
|
153
|
+
events.tap && events.tap({}, { originEvent: e });
|
|
154
|
+
} }),
|
|
155
|
+
imgShow && (
|
|
156
|
+
// <CreatePortal>
|
|
157
|
+
React.createElement("div", { className: `${classPrefix}-image-mask`, onClick: onMaskClick },
|
|
158
|
+
React.createElement("div", { onClick: () => setImgShow(false), className: `${classPrefix}-image-mask__close-btn` },
|
|
159
|
+
React.createElement("i", { className: `${classPrefix}-image-mask__icon-close` })),
|
|
160
|
+
React.createElement("div", { ...bind(), className: `${classPrefix}-image-preview`, style: {
|
|
161
|
+
touchAction: 'none',
|
|
162
|
+
backgroundImage: `url('${src}')`,
|
|
163
|
+
width: showWidth,
|
|
164
|
+
height: showHeight,
|
|
165
|
+
marginTop: offsetHeight,
|
|
166
|
+
marginLeft: offsetWidth,
|
|
167
|
+
} }))
|
|
168
|
+
// </CreatePortal>
|
|
169
|
+
)));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import { ImageInner } from './image';
|
|
5
|
+
import { emptyObject } from '../../utils/constant';
|
|
6
|
+
import { useTempUrl } from '../../utils/hooks/use-cloud-id-temp-url';
|
|
7
|
+
import { useConfig } from '../../utils/config-context';
|
|
8
|
+
export default function Image({
|
|
9
|
+
// 系统属性
|
|
10
|
+
className, events = emptyObject, style,
|
|
11
|
+
// 组件属性
|
|
12
|
+
src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }) {
|
|
13
|
+
const [isError, setIsError] = useState(false);
|
|
14
|
+
const { classPrefix } = useConfig();
|
|
15
|
+
const cls = classNames({
|
|
16
|
+
[`${classPrefix}-image`]: true,
|
|
17
|
+
[`${classPrefix}-image__error`]: isError,
|
|
18
|
+
[className]: className,
|
|
19
|
+
});
|
|
20
|
+
const objectFit = fit || getObjectFitByWxImageMode(mode);
|
|
21
|
+
const { data: realSrc } = useTempUrl(src);
|
|
22
|
+
/**
|
|
23
|
+
* 模拟小程序的widthFix、heightFix模式
|
|
24
|
+
*/
|
|
25
|
+
const realFit = useMemo(() => {
|
|
26
|
+
if (objectFit === 'widthFix' || objectFit === 'heightFix') {
|
|
27
|
+
return 'unset';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return objectFit;
|
|
31
|
+
}
|
|
32
|
+
}, [objectFit]);
|
|
33
|
+
const realStyle = useMemo(() => {
|
|
34
|
+
if (isError) {
|
|
35
|
+
return style;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (objectFit === 'widthFix') {
|
|
39
|
+
return {
|
|
40
|
+
...style,
|
|
41
|
+
height: 'auto',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
else if (objectFit === 'heightFix') {
|
|
45
|
+
return {
|
|
46
|
+
...style,
|
|
47
|
+
width: 'auto',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return style;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [style, objectFit, isError]);
|
|
55
|
+
return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (React.createElement(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable })) : null;
|
|
56
|
+
}
|
|
57
|
+
function getObjectFitByWxImageMode(mode) {
|
|
58
|
+
const array = [
|
|
59
|
+
{
|
|
60
|
+
mode: 'scaleToFill',
|
|
61
|
+
h5: 'fill',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
mode: 'aspectFit',
|
|
65
|
+
h5: 'contain',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
mode: 'aspectFill',
|
|
69
|
+
h5: 'cover',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
mode: 'widthFix',
|
|
73
|
+
h5: 'cover',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
mode: 'heightFix',
|
|
77
|
+
h5: 'contain',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
const item = array.find((item) => item.mode === mode);
|
|
81
|
+
return item === null || item === void 0 ? void 0 : item.h5;
|
|
82
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from '../../utils/classnames';
|
|
3
|
+
import { emptyObject } from '../../utils/constant';
|
|
4
|
+
import { useConfig } from '../../utils/config-context';
|
|
5
|
+
import { usePlatform } from '../../utils/platform';
|
|
6
|
+
import { WdIcon } from '../index';
|
|
7
|
+
export const WdLink = ({ content, url, isOpenInNewWindow, params, iconType, iconSource = 'inner', icon, iconSrc, iconPosition = 'before', disabled, enableSlot = true, contentSlot, events = emptyObject, className, style, id, ...props }) => {
|
|
8
|
+
const platform = usePlatform();
|
|
9
|
+
// 样式
|
|
10
|
+
const { classPrefix } = useConfig();
|
|
11
|
+
const compClassName = `${classPrefix}-link`;
|
|
12
|
+
// 类名
|
|
13
|
+
// 响应式css api
|
|
14
|
+
const platformCss = `${classPrefix}-${platform}-link`;
|
|
15
|
+
const classes = {
|
|
16
|
+
[`${classPrefix}-link`]: true,
|
|
17
|
+
// 是否是纯图标
|
|
18
|
+
[`${compClassName}--icon`]: iconType === 'icon-only',
|
|
19
|
+
// 禁用
|
|
20
|
+
'is-disabled': disabled,
|
|
21
|
+
[platformCss]: true,
|
|
22
|
+
};
|
|
23
|
+
const { href, path, paramObj, isAbosolutePath } = processUrl(url, params);
|
|
24
|
+
// 方法
|
|
25
|
+
const onClick = (e) => {
|
|
26
|
+
var _a;
|
|
27
|
+
if (disabled)
|
|
28
|
+
return;
|
|
29
|
+
events.tap && events.tap({}, { originEvent: e });
|
|
30
|
+
if (!e.defaultPrevented && !isAbosolutePath && (window === null || window === void 0 ? void 0 : window.app)) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
(_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.navigateTo({
|
|
33
|
+
pageId: path,
|
|
34
|
+
packageName: '',
|
|
35
|
+
mode: 'weDa',
|
|
36
|
+
params: paramObj,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const Icon = () => {
|
|
41
|
+
// icon样式
|
|
42
|
+
const iconCls = classNames({
|
|
43
|
+
[`${classPrefix}-link__icon`]: true,
|
|
44
|
+
[`${classPrefix}-link__before-icon`]: iconType === 'text-with-icon' && iconPosition === 'before',
|
|
45
|
+
[`${classPrefix}-link__after-icon`]: iconType === 'text-with-icon' && iconPosition === 'after',
|
|
46
|
+
[`${classPrefix}-icon--inherit`]: (style === null || style === void 0 ? void 0 : style.fontSize) && iconSource === 'inner',
|
|
47
|
+
});
|
|
48
|
+
return icon || iconSrc ? (React.createElement(WdIcon, { className: iconCls, size: 'sm', name: icon, src: iconSrc, type: iconSource })) : null;
|
|
49
|
+
};
|
|
50
|
+
return (React.createElement("a", { style: style, className: classNames(classes, className), target: isOpenInNewWindow ? '_blank' : '_self', href: href, id: id, onClick: onClick, rel: "noopener noreferrer", ...props },
|
|
51
|
+
enableSlot && contentSlot && (React.createElement("div", { className: `${classPrefix}-link__slot` }, contentSlot)),
|
|
52
|
+
React.createElement("span", { className: `${classPrefix}-link__wrap` },
|
|
53
|
+
iconPosition === 'before' && iconType === 'text-with-icon' && React.createElement(Icon, null),
|
|
54
|
+
iconType === 'icon-only' ? (React.createElement(Icon, null)) : (React.createElement("span", { className: `${classPrefix}-link__text` }, content)),
|
|
55
|
+
iconPosition === 'after' && iconType === 'text-with-icon' && React.createElement(Icon, null))));
|
|
56
|
+
};
|
|
57
|
+
function processUrl(url, params) {
|
|
58
|
+
url = url === null || url === void 0 ? void 0 : url.trim();
|
|
59
|
+
// URL 构造函数不支持 '//xxx.com' 的格式
|
|
60
|
+
if ((url === null || url === void 0 ? void 0 : url.indexOf('//')) === 0) {
|
|
61
|
+
url = location.protocol + url;
|
|
62
|
+
}
|
|
63
|
+
// "proto:" 或 "//" 起头的是绝对路径
|
|
64
|
+
let isAbosolutePath = /^(?:[a-z]+:)/i.test(url);
|
|
65
|
+
let base, path, href, paramObj = {}, urlObj;
|
|
66
|
+
if (!isAbosolutePath) {
|
|
67
|
+
// 相对地址使用站位域名,不实际使用
|
|
68
|
+
base =
|
|
69
|
+
location.origin && location.origin !== 'null'
|
|
70
|
+
? location.origin
|
|
71
|
+
: 'https://we.da';
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
urlObj = new URL(url, base);
|
|
75
|
+
params.forEach((x) => {
|
|
76
|
+
urlObj === null || urlObj === void 0 ? void 0 : urlObj.searchParams.append(x.key, x.value);
|
|
77
|
+
});
|
|
78
|
+
href = urlObj === null || urlObj === void 0 ? void 0 : urlObj.href;
|
|
79
|
+
path = urlObj === null || urlObj === void 0 ? void 0 : urlObj.pathname;
|
|
80
|
+
for (const [key, value] of urlObj.searchParams) {
|
|
81
|
+
paramObj[key] = value;
|
|
82
|
+
}
|
|
83
|
+
// 相对地址去掉占位域名
|
|
84
|
+
if (!isAbosolutePath) {
|
|
85
|
+
href = (urlObj === null || urlObj === void 0 ? void 0 : urlObj.pathname) + (urlObj === null || urlObj === void 0 ? void 0 : urlObj.search) + (urlObj === null || urlObj === void 0 ? void 0 : urlObj.hash);
|
|
86
|
+
href = href === null || href === void 0 ? void 0 : href.replace(/^\//, '');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
// 非法 url
|
|
91
|
+
isAbosolutePath = true;
|
|
92
|
+
href = url;
|
|
93
|
+
path = '';
|
|
94
|
+
paramObj = params === null || params === void 0 ? void 0 : params.reduce((p, x) => {
|
|
95
|
+
p[x.key] = x.value;
|
|
96
|
+
return p;
|
|
97
|
+
}, {});
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
isAbosolutePath,
|
|
101
|
+
href,
|
|
102
|
+
path,
|
|
103
|
+
paramObj,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useConfig } from '../../utils/config-context';
|
|
3
|
+
import { WdButton } from '../wd-button';
|
|
4
|
+
export const WdTable = ({ className,
|
|
5
|
+
// style,
|
|
6
|
+
// id,
|
|
7
|
+
type = 'solid', }) => {
|
|
8
|
+
// 兼容旧版组件的属性值
|
|
9
|
+
const { classPrefix } = useConfig();
|
|
10
|
+
const compClassName = `${classPrefix}-table`;
|
|
11
|
+
// 类名
|
|
12
|
+
const classList = [compClassName];
|
|
13
|
+
type && classList.push(`${compClassName}--${type}`);
|
|
14
|
+
// diriction && classList.push(`${btnClassName}-${diriction}`);
|
|
15
|
+
// 用户定义的className
|
|
16
|
+
classList.push(className);
|
|
17
|
+
return (React.createElement("div", { className: `${classPrefix}-table-wrap`, "data-testid": "wd-table-test" },
|
|
18
|
+
React.createElement("div", { className: `${classPrefix}-table-wrap__toolbar` },
|
|
19
|
+
React.createElement("div", { className: `${classPrefix}-table-wrap__toolbar-col` },
|
|
20
|
+
React.createElement(WdButton, { theme: "primary", text: "\u65B0\u5EFA" }),
|
|
21
|
+
React.createElement(WdButton, { theme: "secondary", text: "\u5220\u9664" })),
|
|
22
|
+
React.createElement("div", { className: `${classPrefix}-table-wrap__toolbar-col` },
|
|
23
|
+
React.createElement(WdButton, { iconType: "icon-only", theme: "secondary", icon: "td:filter" })))));
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const PROPS_VALUE_MAP = {
|
|
2
|
+
level: {
|
|
3
|
+
'0': 'body-md',
|
|
4
|
+
'1': 'title-1',
|
|
5
|
+
'2': 'title-2',
|
|
6
|
+
'3': 'title-3',
|
|
7
|
+
'4': 'title-4',
|
|
8
|
+
'5': 'title-5',
|
|
9
|
+
'6': 'title-6',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export const convertLegacyProps = (key, prop) => {
|
|
13
|
+
return PROPS_VALUE_MAP[key][prop];
|
|
14
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from '../../utils/classnames';
|
|
3
|
+
import { useConfig } from '../../utils/config-context';
|
|
4
|
+
import { textToString, usePlatform } from '../../utils/platform';
|
|
5
|
+
import { convertLegacyProps } from './convert-legacy-props';
|
|
6
|
+
import { convertLegacyEnum } from '../../utils/tool';
|
|
7
|
+
import { WD_TEXT_LEVEL, WD_TEXT_MAX_LINES } from '../../../enum';
|
|
8
|
+
export const WdText = ({ className, style, id, level: _level = 'body-default', text, overflow, maxLines: _maxLines, space, tips, userSelect, events, contenteditable, onInput, onBlur, ...props }) => {
|
|
9
|
+
const platform = usePlatform();
|
|
10
|
+
// 兼容旧版组件的属性值
|
|
11
|
+
let level = convertLegacyProps('level', String(_level)) || _level;
|
|
12
|
+
// 枚举转换
|
|
13
|
+
level = convertLegacyEnum(level, WD_TEXT_LEVEL);
|
|
14
|
+
const maxLines = convertLegacyEnum(String(_maxLines), WD_TEXT_MAX_LINES);
|
|
15
|
+
// 样式
|
|
16
|
+
const { classPrefix } = useConfig();
|
|
17
|
+
const compClassName = `${classPrefix}-typography`;
|
|
18
|
+
const levelClass = {
|
|
19
|
+
'title-1': `${compClassName}-display-lg`,
|
|
20
|
+
'title-2': `${compClassName}-display-md`,
|
|
21
|
+
'title-3': `${compClassName}-headline-lg`,
|
|
22
|
+
'title-4': `${compClassName}-headline-sm`,
|
|
23
|
+
'title-5': `${compClassName}-title-xl`,
|
|
24
|
+
'title-6': `${compClassName}-title-lg`,
|
|
25
|
+
'body-sm': `${compClassName}-body-sm`,
|
|
26
|
+
'body-md': `${compClassName}-body-md`,
|
|
27
|
+
'body-lg': `${compClassName}-body-lg`,
|
|
28
|
+
};
|
|
29
|
+
// 响应式css api
|
|
30
|
+
const platformCss = `${classPrefix}-${platform}-typography`;
|
|
31
|
+
const classes = {
|
|
32
|
+
[compClassName]: true,
|
|
33
|
+
// size
|
|
34
|
+
[levelClass[level]]: levelClass[level],
|
|
35
|
+
// 连续字符会换行,正常英文不会强制换行
|
|
36
|
+
[`${classPrefix}-g-wrod-break`]: true,
|
|
37
|
+
// 是否可选中
|
|
38
|
+
[`${classPrefix}-g-user-select-none`]: !userSelect,
|
|
39
|
+
// 超出隐藏多少行
|
|
40
|
+
[`${classPrefix}-g-text-ellipsis-${maxLines}`]: overflow,
|
|
41
|
+
// 是否支持空格
|
|
42
|
+
[`${classPrefix}-g-white-space-pre-wrap`]: space,
|
|
43
|
+
[platformCss]: true,
|
|
44
|
+
};
|
|
45
|
+
const maxLevel = 10;
|
|
46
|
+
// 兼容旧的text组件溢出省略
|
|
47
|
+
const inlineStyle = React.useMemo(() => Number(_maxLines) > maxLevel
|
|
48
|
+
? {
|
|
49
|
+
WebkitLineClamp: _maxLines,
|
|
50
|
+
...style,
|
|
51
|
+
}
|
|
52
|
+
: { ...style }, [style, _maxLines]);
|
|
53
|
+
const propsStartWithOn = React.useMemo(() => {
|
|
54
|
+
return Object.keys(props).reduce((acc, cur) => {
|
|
55
|
+
if (cur.startsWith('on') || cur === 'data-testid') {
|
|
56
|
+
acc[cur] = props[cur];
|
|
57
|
+
}
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
}, [props]);
|
|
61
|
+
switch (level) {
|
|
62
|
+
case 'title-1':
|
|
63
|
+
return (React.createElement("h1", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
64
|
+
//@ts-expect-error contentEditable type def sucks
|
|
65
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
66
|
+
case 'title-2':
|
|
67
|
+
return (React.createElement("h2", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
68
|
+
//@ts-expect-error contentEditable type def sucks
|
|
69
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
70
|
+
case 'title-3':
|
|
71
|
+
return (React.createElement("h3", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
72
|
+
//@ts-expect-error contentEditable type def sucks
|
|
73
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
74
|
+
case 'title-4':
|
|
75
|
+
return (React.createElement("h4", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
76
|
+
//@ts-expect-error contentEditable type def sucks
|
|
77
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
78
|
+
case 'title-5':
|
|
79
|
+
return (React.createElement("h5", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
80
|
+
//@ts-expect-error contentEditable type def sucks
|
|
81
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
82
|
+
case 'title-6':
|
|
83
|
+
return (React.createElement("h6", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
84
|
+
//@ts-expect-error contentEditable type def sucks
|
|
85
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
86
|
+
default:
|
|
87
|
+
return (React.createElement("p", { className: classNames(classes, className), style: inlineStyle, id: id,
|
|
88
|
+
//@ts-expect-error contentEditable type def sucks
|
|
89
|
+
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, title: tips ? textToString(text) : '', onClick: (e) => events.tap({}, { originEvent: e }), ...propsStartWithOn }, textToString(text)));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.weda-ui_video {
|
|
2
|
-
height:
|
|
2
|
+
height: 500px;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
background-color: #000;
|
|
5
5
|
position: relative;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.weda-ui_video-h5 {
|
|
9
|
-
height:
|
|
9
|
+
height: 250px;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.weda-ui_video_control .vjs-control-bar {
|
|
@@ -40,6 +40,3 @@
|
|
|
40
40
|
justify-content: center;
|
|
41
41
|
color: #fff;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
/*# sourceURL=webpack://./src/web/components/wedaVideo/index.css */
|
|
45
|
-
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8uL3NyYy93ZWIvY29tcG9uZW50cy93ZWRhVmlkZW8vaW5kZXguY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0VBQ0UsbUJBQW1CO0VBQ25CLGdCQUFnQjtFQUNoQixzQkFBc0I7RUFDdEIsa0JBQWtCO0FBQ3BCOztBQUVBO0VBQ0UsbUJBQW1CO0FBQ3JCOztBQUVBO0VBQ0UsMkJBQTJCO0FBQzdCOztBQUVBO0VBQ0UseUJBQXlCO0VBQ3pCLHVCQUF1QjtBQUN6Qjs7QUFFQTs7RUFFRSxjQUFjO0FBQ2hCOztBQUVBO0VBQ0UsdUJBQXVCO0FBQ3pCOztBQUVBO0VBQ0Usa0JBQWtCO0VBQ2xCLFlBQVk7RUFDWixPQUFPO0VBQ1AsTUFBTTtFQUNOLFdBQVc7RUFDWCxZQUFZO0VBQ1osc0JBQXNCO0VBQ3RCLGFBQWE7RUFDYixtQkFBbUI7RUFDbkIsdUJBQXVCO0VBQ3ZCLFdBQVc7QUFDYiIsInNvdXJjZXNDb250ZW50IjpbIi53ZWRhLXVpX3ZpZGVvIHtcbiAgaGVpZ2h0OiAzNS43MTQyOXJlbTtcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzAwMDtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xufVxuXG4ud2VkYS11aV92aWRlby1oNSB7XG4gIGhlaWdodDogMTcuODU3MTRyZW07XG59XG5cbi53ZWRhLXVpX3ZpZGVvX2NvbnRyb2wgLnZqcy1jb250cm9sLWJhciB7XG4gIGJhY2tncm91bmQ6IG5vbmUgIWltcG9ydGFudDtcbn1cblxuLndlZGEtdWlfdmlkZW9fX3ZpZGVvLXdyYXAge1xuICBwYWRkaW5nLXRvcDogMCAhaW1wb3J0YW50O1xuICBoZWlnaHQ6IDEwMCUgIWltcG9ydGFudDtcbn1cblxuLnZqcy1wYXVzZWQgLnZqcy1iaWctcGxheS1idXR0b24sXG4udmpzLXBhdXNlZC52anMtaGFzLXN0YXJ0ZWQgLnZqcy1iaWctcGxheS1idXR0b24ge1xuICBkaXNwbGF5OiBibG9jaztcbn1cblxuLnZqcy1zbGlkZXItdmVydGljYWwgLnZqcy12b2x1bWUtbGV2ZWw6YmVmb3JlIHtcbiAgbGVmdDogLTAuNWVtICFpbXBvcnRhbnQ7XG59XG5cbi53ZWRhLXVpX3ZpZGVvX192aWRlby1sb2FkaW5nIHtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICB6LWluZGV4OiAxMDA7XG4gIGxlZnQ6IDA7XG4gIHRvcDogMDtcbiAgd2lkdGg6IDEwMCU7XG4gIGhlaWdodDogMTAwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzAwMDtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIGNvbG9yOiAjZmZmO1xufVxuIl0sInNvdXJjZVJvb3QiOiIifQ== */
|
|
@@ -75,12 +75,14 @@ const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPla
|
|
|
75
75
|
{ name: 'FullscreenToggle' }, // 全屏按钮
|
|
76
76
|
],
|
|
77
77
|
},
|
|
78
|
-
sources:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
sources: realSrc
|
|
79
|
+
? [
|
|
80
|
+
{
|
|
81
|
+
src: realSrc,
|
|
82
|
+
type: MimetypesKind[videoType] || 'video/mp4',
|
|
83
|
+
},
|
|
84
|
+
]
|
|
85
|
+
: [],
|
|
84
86
|
};
|
|
85
87
|
playerRef.current = videojs(videoElement, videoOptions, () => {
|
|
86
88
|
players.currentTime(startTime); //指定播放时间
|
package/dist/web/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useConfig } from './use-config';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { WdConfigContext, DEFAULT_CLASS_PREFIX, } from '../../components/wd-config-provider/wd-config-context';
|
|
3
|
+
export function useConfig() {
|
|
4
|
+
const context = useContext(WdConfigContext) || {};
|
|
5
|
+
return {
|
|
6
|
+
classPrefix: DEFAULT_CLASS_PREFIX,
|
|
7
|
+
...context,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -116,9 +116,13 @@ export const getDataSourceByName = async (dbName, GetColumnAuth = false) => {
|
|
|
116
116
|
// dbName 为空时
|
|
117
117
|
if (!dbName)
|
|
118
118
|
return;
|
|
119
|
-
// 兼容私有环境,新接口不存在的情况
|
|
119
|
+
// 兼容私有环境,新接口不存在的情况 私有化权限接口存在两种情况 1、sdk版本getDataSourceProfileAsync方法不存在 2、getDataSourceProfileAsync方法存在但是没有返回权限字段resourceCheckInfos
|
|
120
120
|
if ((window === null || window === void 0 ? void 0 : window._isPrivate) && !((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getDataSourceProfileAsync)) {
|
|
121
|
-
|
|
121
|
+
const { resourceCheckInfos } = await window.app.cloud.getDataSourceProfileAsync(GetColumnAuth ? { Name: dbName, GetColumnAuth: true } : dbName);
|
|
122
|
+
// 没有返回权限字段resourceCheckInfos
|
|
123
|
+
if (!resourceCheckInfos) {
|
|
124
|
+
return getDataSourceByNameCompatibleProvite(dbName);
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
const datasource = await window.app.cloud.getDataSourceProfileAsync(GetColumnAuth ? { Name: dbName, GetColumnAuth: true } : dbName);
|
|
124
128
|
return datasource;
|
|
@@ -186,17 +190,25 @@ export const getAuthFieldsByName = async (dbName) => {
|
|
|
186
190
|
*/
|
|
187
191
|
export const getDataSourceFieldsWithAuth = (authList, resourceCheckInfos) => {
|
|
188
192
|
try {
|
|
189
|
-
if (isInIde() ||
|
|
190
|
-
// 编辑器编辑区 和
|
|
193
|
+
if (isInIde() || !resourceCheckInfos) {
|
|
194
|
+
// 编辑器编辑区 和 兼容私有环境,新接口不存在的情况没有返回权限字段
|
|
191
195
|
return authList.map((item) => ({ ...item, readWriteAuth: 'rw' }));
|
|
192
196
|
}
|
|
193
197
|
if ((resourceCheckInfos === null || resourceCheckInfos === void 0 ? void 0 : resourceCheckInfos.length) > 0 && (authList === null || authList === void 0 ? void 0 : authList.length) > 0) {
|
|
194
|
-
const resourceCheckInfosList = resourceCheckInfos.map((item) => item.ReadWrite);
|
|
195
198
|
return authList.map((authItem) => {
|
|
196
|
-
|
|
199
|
+
var _a, _b;
|
|
200
|
+
const recordName = (authItem === null || authItem === void 0 ? void 0 : authItem['x-viewType']) === 'RELATION_VIEW'
|
|
201
|
+
? authItem === null || authItem === void 0 ? void 0 : authItem.parentRelationRecordsName //关联模型字段name
|
|
202
|
+
: authItem === null || authItem === void 0 ? void 0 : authItem.name;
|
|
203
|
+
let authInfoList = resourceCheckInfos.filter((item) => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item['ReadWrite']) === null || _a === void 0 ? void 0 : _a[recordName]); });
|
|
204
|
+
if ((authItem === null || authItem === void 0 ? void 0 : authItem['x-viewType']) === 'RELATION_VIEW') {
|
|
205
|
+
// 可能会有字段名重复的,通过关联模型字段筛选出来
|
|
206
|
+
authInfoList = authInfoList === null || authInfoList === void 0 ? void 0 : authInfoList.filter((item) => `@${item === null || item === void 0 ? void 0 : item.RelationField}` === (authItem === null || authItem === void 0 ? void 0 : authItem['x-parentRelationKey']));
|
|
207
|
+
}
|
|
197
208
|
// 匹配到了权限字段
|
|
198
209
|
if (authInfoList[0]) {
|
|
199
|
-
authItem.readWriteAuth =
|
|
210
|
+
authItem.readWriteAuth =
|
|
211
|
+
(_b = (_a = authInfoList === null || authInfoList === void 0 ? void 0 : authInfoList[0]) === null || _a === void 0 ? void 0 : _a['ReadWrite']) === null || _b === void 0 ? void 0 : _b[recordName];
|
|
200
212
|
if (authInfoList[0][authItem.name] === 'r') {
|
|
201
213
|
// 只读字段标单项disable状态
|
|
202
214
|
authItem['x-powerDisabled'] = true;
|