@cloudbase/weda-ui 3.12.0 → 3.12.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/dist/configs/components/dataView.d.ts +1 -0
- package/dist/configs/components/dataView.js +2 -1
- package/dist/configs/components/listView.js +5 -12
- package/dist/configs/components/wd-modal.d.ts +10 -1
- package/dist/configs/components/wd-modal.js +52 -1
- package/dist/configs/components/wd-table.d.ts +10 -0
- package/dist/configs/components/wd-table.js +9 -17
- package/dist/configs/components/web-view.d.ts +4 -0
- package/dist/configs/components/web-view.js +19 -1
- package/dist/configs/index.d.ts +36 -2
- package/dist/configs/type-utils/type-form.js +2 -28
- package/dist/style/weda-ui.min.css +1 -1
- package/dist/web/components/form/uploader/uploader.pc.d.ts +5 -0
- package/dist/web/components/form/uploader/uploader.pc.js +7 -9
- package/dist/web/components/uploaderView/index.d.ts +8 -1
- package/dist/web/components/uploaderView/index.js +5 -4
- package/dist/web/components/wd-form-item/wd-input-wrap.js +8 -2
- package/dist/web/components/wd-image/ImagePreview.js +5 -8
- package/dist/web/components/wd-image/image.d.ts +2 -1
- package/dist/web/components/wd-image/image.js +4 -6
- package/dist/web/components/wd-image/index.d.ts +1 -0
- package/dist/web/components/wd-image/index.js +4 -4
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +7 -12
- package/dist/web/components/wd-select/select/selectUI.js +8 -13
- package/dist/web/components/wd-table/wd-table.js +16 -46
- package/dist/web/components/web-view/web-view.d.ts +2 -0
- package/dist/web/components/web-view/web-view.js +2 -2
- package/dist/web/utils/getModelParams.js +8 -3
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export interface TcbImageProps {
|
|
|
20
20
|
imgTypeCls?: string;
|
|
21
21
|
previewIcon?: string;
|
|
22
22
|
actions?: React.ReactNode;
|
|
23
|
+
portalContainer?: HTMLElement;
|
|
23
24
|
}
|
|
24
25
|
export declare const TcbImage: (props: TcbImageProps) => JSX.Element;
|
|
25
26
|
export interface PropsType extends H5UploaderProps {
|
|
@@ -28,6 +29,10 @@ export interface PropsType extends H5UploaderProps {
|
|
|
28
29
|
btnTitle?: string;
|
|
29
30
|
uploadPath?: string;
|
|
30
31
|
readOnly?: boolean;
|
|
32
|
+
popupContainer?: HTMLElement;
|
|
33
|
+
onChange?: (value: string | string[]) => void;
|
|
34
|
+
onError?: (error: Error) => void;
|
|
35
|
+
onSuccess?: (value: string | string[]) => void;
|
|
31
36
|
}
|
|
32
37
|
export declare function encodeConvert(src: any): any;
|
|
33
38
|
export {};
|
|
@@ -21,7 +21,7 @@ export const IMAGE_TYPES = [
|
|
|
21
21
|
'image/gif',
|
|
22
22
|
];
|
|
23
23
|
export function UploaderPCInner(props) {
|
|
24
|
-
const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, acceptTypes = IMAGE_TYPES, events, single = false, disabled = false, onChange, imgTypeCls, readOnly, sourceType, callbacks, } = props;
|
|
24
|
+
const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, acceptTypes = IMAGE_TYPES, events, single = false, disabled = false, onChange, imgTypeCls, readOnly, sourceType, callbacks, popupContainer: portalContainer, } = props;
|
|
25
25
|
const { tempFile, uploading, upload, getTempFile } = useUploader(props);
|
|
26
26
|
const handleChange = (allFile = [], isDelete = false) => {
|
|
27
27
|
var _a;
|
|
@@ -84,8 +84,7 @@ export function UploaderPCInner(props) {
|
|
|
84
84
|
if (typeof ret === 'boolean') {
|
|
85
85
|
shouldUploadToCos = ret;
|
|
86
86
|
}
|
|
87
|
-
else if (Array.isArray(ret) &&
|
|
88
|
-
ret.every((item) => item instanceof File)) {
|
|
87
|
+
else if (Array.isArray(ret) && ret.every((item) => item instanceof File)) {
|
|
89
88
|
fileList = ret;
|
|
90
89
|
}
|
|
91
90
|
else if (!isNil(ret)) {
|
|
@@ -115,13 +114,11 @@ export function UploaderPCInner(props) {
|
|
|
115
114
|
const extraProps = {};
|
|
116
115
|
//是否支持多选
|
|
117
116
|
extraProps['multiple'] = !single;
|
|
118
|
-
extraProps['accept'] =
|
|
119
|
-
acceptTypes.length === 0 ? IMAGE_TYPES : Array.from(new Set(acceptTypes));
|
|
117
|
+
extraProps['accept'] = acceptTypes.length === 0 ? IMAGE_TYPES : Array.from(new Set(acceptTypes));
|
|
120
118
|
tips && (extraProps['title'] = tips);
|
|
121
119
|
maxSize && (extraProps['maxSize'] = maxSize * 1024 * 1024);
|
|
122
120
|
const hasActions = !uploading && !readOnly && !(disabled || sourceType === 'camera');
|
|
123
|
-
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.key))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("li", { className: `_weda-fn-upload-result__item wedatea2td-disabled ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) ||
|
|
124
|
-
(single && tempFile.length < 1 && !uploading)) &&
|
|
121
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", portalContainer: portalContainer, actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.key))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("li", { className: `_weda-fn-upload-result__item wedatea2td-disabled ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) || (single && tempFile.length < 1 && !uploading)) &&
|
|
125
122
|
!readOnly && (
|
|
126
123
|
// single 模式时,当数组为空且不在上传文件过程中时显示
|
|
127
124
|
_jsx(Upload, { ...extraProps, beforeUpload: beforeHandle, children: _jsxs("li", {
|
|
@@ -133,7 +130,7 @@ export function UploaderPCInner(props) {
|
|
|
133
130
|
className: `_weda-fn-upload-result__item _weda-fn-upload-result__item--upload ${imgTypeCls}`, children: [imgTypeCls, _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] })] }) })))] })] }) }));
|
|
134
131
|
}
|
|
135
132
|
export const TcbImage = (props) => {
|
|
136
|
-
const { fileID, tempFile = { progress: 100, loading: false, realUrl: null, tempUrl: null }, isZoom, imgTypeCls, previewIcon, actions, allFile, index, ...rest } = props;
|
|
133
|
+
const { fileID, tempFile = { progress: 100, loading: false, realUrl: null, tempUrl: null }, isZoom, imgTypeCls, previewIcon, actions, allFile = [], index, portalContainer, ...rest } = props;
|
|
137
134
|
const { progress, loading, realUrl, tempUrl } = tempFile;
|
|
138
135
|
const fileCloudID = (realUrl !== null && realUrl !== void 0 ? realUrl : tempUrl) || fileID;
|
|
139
136
|
const [isError, setIsError] = React.useState(false);
|
|
@@ -162,10 +159,11 @@ export const TcbImage = (props) => {
|
|
|
162
159
|
className: `${CLASS_PREFIX}__image ${imgTypeCls}`,
|
|
163
160
|
src: encodeURI(encodeSrc),
|
|
164
161
|
previewImageList,
|
|
162
|
+
portalContainer,
|
|
165
163
|
};
|
|
166
164
|
if (previewIcon || actions) {
|
|
167
165
|
return (_jsx(ImagePreview, { ...previewProps, children: (open) => {
|
|
168
|
-
return (_jsxs(_Fragment, { children: [renderImg(), _jsxs("div", { className: `_weda-fn-upload-result__op ${imgTypeCls} ${CLASS_PREFIX}__image-actions`, children: [previewIcon && (_jsx(WdIcon, { name: previewIcon, onClick: open, className: `${CLASS_PREFIX}__image-actions-open`, size: "sm" })), actions &&
|
|
166
|
+
return (_jsxs(_Fragment, { children: [renderImg(), _jsxs("div", { className: `_weda-fn-upload-result__op ${imgTypeCls} ${CLASS_PREFIX}__image-actions`, children: [previewIcon && (_jsx(WdIcon, { name: previewIcon, onClick: open, className: `${CLASS_PREFIX}__image-actions-open`, size: "sm" })), actions && _jsx("span", { className: `${CLASS_PREFIX}__image-actions-separator`, children: "|" }), actions] })] }));
|
|
169
167
|
} }));
|
|
170
168
|
}
|
|
171
169
|
else {
|
|
@@ -5,7 +5,7 @@ import './style';
|
|
|
5
5
|
* 图片上传-展示组件
|
|
6
6
|
*/
|
|
7
7
|
export default function UploaderView({ srcList, // 兼容 cloud:和https: 协议,兼容 字符串和字符串数组
|
|
8
|
-
alt, gutter, height, width, events, isZoom, isEmptyPlace, className, id, style, }: PropsType): JSX.Element;
|
|
8
|
+
alt, gutter, height, width, events, isZoom, isEmptyPlace, className, id, style, popupContainer: portalContainer, }: PropsType): JSX.Element;
|
|
9
9
|
export interface PropsType extends CommonPropsType {
|
|
10
10
|
srcList?: string[] | string;
|
|
11
11
|
alt?: string;
|
|
@@ -14,4 +14,11 @@ export interface PropsType extends CommonPropsType {
|
|
|
14
14
|
height?: number;
|
|
15
15
|
width?: number;
|
|
16
16
|
isEmptyPlace?: boolean;
|
|
17
|
+
popupContainer?: HTMLElement;
|
|
18
|
+
events?: {
|
|
19
|
+
load?: ({ success, error }: {
|
|
20
|
+
success: string[];
|
|
21
|
+
error: string[];
|
|
22
|
+
}) => void;
|
|
23
|
+
};
|
|
17
24
|
}
|
|
@@ -9,7 +9,7 @@ const CLASS_PREFIX = 'g-uploader-view';
|
|
|
9
9
|
* 图片上传-展示组件
|
|
10
10
|
*/
|
|
11
11
|
export default function UploaderView({ srcList, // 兼容 cloud:和https: 协议,兼容 字符串和字符串数组
|
|
12
|
-
alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObject, isZoom = true, isEmptyPlace = true, className, id, style, }) {
|
|
12
|
+
alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObject, isZoom = true, isEmptyPlace = true, className, id, style, popupContainer: portalContainer, }) {
|
|
13
13
|
const cls = classNames({
|
|
14
14
|
[CLASS_PREFIX]: true,
|
|
15
15
|
[className]: className,
|
|
@@ -26,10 +26,9 @@ alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObj
|
|
|
26
26
|
marginBottom: gutter,
|
|
27
27
|
height: height,
|
|
28
28
|
width: width,
|
|
29
|
+
cursor: isZoom ? 'zoom-in' : 'auto',
|
|
29
30
|
};
|
|
30
|
-
const values = []
|
|
31
|
-
.concat(srcList)
|
|
32
|
-
.filter((d) => typeof d === 'string' && d !== '');
|
|
31
|
+
const values = [].concat(srcList).filter((d) => typeof d === 'string' && d !== '');
|
|
33
32
|
return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: `${CLASS_PREFIX}__image-list`, children: [values.map((d, i) => {
|
|
34
33
|
const imgProps = {
|
|
35
34
|
fileID: d,
|
|
@@ -38,6 +37,8 @@ alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObj
|
|
|
38
37
|
isZoom,
|
|
39
38
|
onLoad: () => setSuccessList((list) => [...list, d]),
|
|
40
39
|
onError: () => setErrorList((list) => [...list, d]),
|
|
40
|
+
portalContainer,
|
|
41
|
+
allFile: values === null || values === void 0 ? void 0 : values.map((d) => ({ realUrl: d })),
|
|
41
42
|
};
|
|
42
43
|
return (_jsx("div", { className: `${CLASS_PREFIX}__image-box`, style: boxStyle, title: d, children: _jsx(TcbImage, { ...imgProps }) }, `${d}-${i}`));
|
|
43
44
|
}), values.length === 0 && isEmptyPlace && (_jsx("div", { className: `${CLASS_PREFIX}__image-box`, style: boxStyle, children: _jsx("img", { className: `${CLASS_PREFIX}__image`, alt: "\u6682\u65E0\u56FE\u7247" }) }))] }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useMemo } from 'react';
|
|
2
|
+
import { useRef, useMemo, useState } from 'react';
|
|
3
3
|
import { useConfig } from '../../utils/config-context';
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import { useSize, convertIconSize } from '../../utils/hooks/useFormLegacy';
|
|
@@ -16,6 +16,7 @@ export const WdInputWrap = (props) => {
|
|
|
16
16
|
const { classPrefix } = useConfig();
|
|
17
17
|
const size = useSize(props);
|
|
18
18
|
const iconSize = convertIconSize(size);
|
|
19
|
+
const [isFocus, setIsFocus] = useState(false);
|
|
19
20
|
const root = `${classPrefix}-${classRoot}`;
|
|
20
21
|
const inputWrap = `${classPrefix}-form-input-wrap`;
|
|
21
22
|
const contentCls = `${inputWrap}__content`;
|
|
@@ -29,11 +30,16 @@ export const WdInputWrap = (props) => {
|
|
|
29
30
|
[`${inputWrap}--no-radius-left`]: before,
|
|
30
31
|
[`${inputWrap}--no-radius-right`]: after,
|
|
31
32
|
[`${inputWrap}--no-radius`]: before && after,
|
|
33
|
+
'is-focused': isFocus,
|
|
32
34
|
});
|
|
33
35
|
const propsStartWithOn = useMemo(() => {
|
|
34
36
|
return filterPropsWithOn(rest);
|
|
35
37
|
}, [rest]);
|
|
36
38
|
if (readOnly)
|
|
37
39
|
return _jsx(_Fragment, { children: children });
|
|
38
|
-
return (_jsxs("div", { className: cls, ref: wrapRef, onFocus: () => {
|
|
40
|
+
return (_jsxs("div", { className: cls, ref: wrapRef, onFocus: () => {
|
|
41
|
+
setIsFocus(true);
|
|
42
|
+
}, onBlur: () => {
|
|
43
|
+
setIsFocus(false);
|
|
44
|
+
}, ...propsStartWithOn, children: [prefixType && (_jsx("div", { className: prefixCls, children: _jsx(WdIcon, { size: iconSize, name: prefixIcon, type: prefixType, src: prefixSrc, className: prefixIconCls }) })), _jsx("div", { className: contentCls, children: children }), hasClearIcon && (_jsx("div", { className: suffixCls, children: _jsx(WdIcon, { size: iconSize, className: `${classPrefix}-icon__trigger`, name: "td:close-circle-filled", onMouseDown: onClear }) })), !hasClearIcon && suffixType && (_jsx("div", { className: suffixCls, children: _jsx(WdIcon, { size: iconSize, name: suffixIcon, type: suffixType, src: suffixSrc, className: suffixIconCls }) }))] }));
|
|
39
45
|
};
|
|
@@ -92,8 +92,9 @@ export const ImagePreview = (props) => {
|
|
|
92
92
|
setRotate(0);
|
|
93
93
|
setTranslateX(0);
|
|
94
94
|
setTranslateY(0);
|
|
95
|
+
setCurrentImg(previewImageList[index]);
|
|
95
96
|
});
|
|
96
|
-
}, [children]);
|
|
97
|
+
}, [children, index, previewImageList, setCurrentImg]);
|
|
97
98
|
return (_jsxs(_Fragment, { children: [child, visible && (_jsx(Portal, { type: "div", portalContainer: portalContainer, children: _jsx("div", { "data-testid": "portal-container", style: { zIndex: 1001, position: 'relative' }, className: `${classPrefix}-image-preview-container`, children: _jsxs("div", { className: `${classPrefix}-image-mask`, onClick: onMaskClick, children: [_jsx("div", { onClick: (e) => {
|
|
98
99
|
if (isStopPropagation) {
|
|
99
100
|
e.stopPropagation();
|
|
@@ -102,18 +103,14 @@ export const ImagePreview = (props) => {
|
|
|
102
103
|
}, className: `${classPrefix}-image-mask__close-btn`, children: _jsx("i", { className: `${classPrefix}-image-mask__icon-close` }) }), _jsx("div", { ...bind(), className: `${classPrefix}-image-preview`, style: previewStyle }), platform === 'pc' && (_jsxs("div", { className: `${classPrefix}-image-preview-toolbar`, children: [(previewImageList === null || previewImageList === void 0 ? void 0 : previewImageList.length) > 1 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "wd-icon-wrap wd-event-tap", children: _jsx(WdIcon, { name: 'td:chevron-left', size: "sm", events: {
|
|
103
104
|
tap: () => {
|
|
104
105
|
const index = previewImageList.findIndex((i) => i === currentImg);
|
|
105
|
-
const currentIndex = index === 0
|
|
106
|
-
? previewImageList.length - 1
|
|
107
|
-
: index - 1;
|
|
106
|
+
const currentIndex = index === 0 ? previewImageList.length - 1 : index - 1;
|
|
108
107
|
setCurrentImg(previewImageList[currentIndex]);
|
|
109
108
|
setRotate(0);
|
|
110
109
|
},
|
|
111
110
|
} }) }), _jsx("span", { className: "wd-icon-wrap wd-event-tap", children: _jsx(WdIcon, { name: 'td:chevron-right', size: "sm", events: {
|
|
112
111
|
tap: () => {
|
|
113
112
|
const index = previewImageList.findIndex((i) => i === currentImg);
|
|
114
|
-
const currentIndex = index === previewImageList.length - 1
|
|
115
|
-
? 0
|
|
116
|
-
: index + 1;
|
|
113
|
+
const currentIndex = index === previewImageList.length - 1 ? 0 : index + 1;
|
|
117
114
|
setCurrentImg(previewImageList[currentIndex]);
|
|
118
115
|
setRotate(0);
|
|
119
116
|
},
|
|
@@ -121,7 +118,7 @@ export const ImagePreview = (props) => {
|
|
|
121
118
|
tap: (arg, { originEvent: e }) => {
|
|
122
119
|
e.stopPropagation();
|
|
123
120
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
124
|
-
setRotate(rotate
|
|
121
|
+
setRotate(rotate - 90);
|
|
125
122
|
},
|
|
126
123
|
} }) })] }))] }) }) }))] }));
|
|
127
124
|
};
|
|
@@ -5,6 +5,7 @@ interface ImageInnerPropsType extends Except<PropsType, 'fit'> {
|
|
|
5
5
|
objectFit: React.CSSProperties['objectFit'];
|
|
6
6
|
isError: boolean;
|
|
7
7
|
setIsError: React.Dispatch<React.SetStateAction<boolean>>;
|
|
8
|
+
portalContainer?: HTMLElement;
|
|
8
9
|
}
|
|
9
|
-
export declare function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, id, isStopPropagation, }: ImageInnerPropsType): JSX.Element;
|
|
10
|
+
export declare function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, id, isStopPropagation, portalContainer, }: ImageInnerPropsType): JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { usePlatform } from '../../utils/platform';
|
|
4
|
-
import { useRef } from 'react';
|
|
5
4
|
import { ImagePreview } from './ImagePreview';
|
|
6
5
|
const ASPECT_RASIO = 1;
|
|
7
6
|
const OFFSET_RASIO = 0.5;
|
|
8
7
|
const SCALE_RADIO_PC = 0.8;
|
|
9
8
|
const SCALE_RADIO_H5 = 1;
|
|
10
|
-
export function ImageInner(
|
|
11
|
-
var
|
|
9
|
+
export function ImageInner(_a) {
|
|
10
|
+
var _b;
|
|
11
|
+
var { objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, id, isStopPropagation, portalContainer = (_b = document.getElementById('root')) !== null && _b !== void 0 ? _b : document.body, } = _a;
|
|
12
12
|
const platform = usePlatform();
|
|
13
|
-
const portalContainer = useRef((_a = document.getElementById('root')) !== null && _a !== void 0 ? _a : document.body);
|
|
14
13
|
const [showHeight, setShowHeight] = React.useState(0);
|
|
15
14
|
const [showWidth, setShowWidth] = React.useState(0);
|
|
16
15
|
const realWidth = React.useRef(0);
|
|
@@ -48,8 +47,7 @@ export function ImageInner({ objectFit, style, className, alt, src, isError, set
|
|
|
48
47
|
const windowWidth = window.innerWidth;
|
|
49
48
|
const widthRasio = (windowWidth * SCALE_RADIO) / realWidth.current;
|
|
50
49
|
const heightRasio = (windowHeight * SCALE_RADIO) / realHeight.current;
|
|
51
|
-
const scale = Math.min(widthRasio, heightRasio, ASPECT_RASIO) ||
|
|
52
|
-
ASPECT_RASIO;
|
|
50
|
+
const scale = Math.min(widthRasio, heightRasio, ASPECT_RASIO) || ASPECT_RASIO;
|
|
53
51
|
setOffsetHeight((windowHeight - realHeight.current * scale) * OFFSET_RASIO);
|
|
54
52
|
setOffsetWidth((windowWidth - realWidth.current * scale) * OFFSET_RASIO);
|
|
55
53
|
setShowHeight(realHeight.current * scale);
|
|
@@ -3,6 +3,7 @@ import type { CommonPropsType } from '../../types';
|
|
|
3
3
|
import type { DataType } from '../../../configs/components/image';
|
|
4
4
|
export interface PropsType extends CommonPropsType, DataType {
|
|
5
5
|
isStopPropagation?: boolean;
|
|
6
|
+
popupContainer?: HTMLElement;
|
|
6
7
|
}
|
|
7
8
|
import '../style';
|
|
8
9
|
declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<unknown>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useImperativeHandle, useState, useMemo, useEffect
|
|
2
|
+
import { forwardRef, useImperativeHandle, useState, useMemo, useEffect } from 'react';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import { ImageInner } from './image';
|
|
5
5
|
import { usePlatform } from '../../utils/platform';
|
|
@@ -11,7 +11,7 @@ export default forwardRef(function WdImage({
|
|
|
11
11
|
// 系统属性
|
|
12
12
|
className, events = emptyObject, style,
|
|
13
13
|
// 组件属性
|
|
14
|
-
src, alt, mode, lazyLoad = false, imgPreview = false, maskClosable = true, fit, id, isStopPropagation = false, }, ref) {
|
|
14
|
+
src, alt, mode, lazyLoad = false, imgPreview = false, maskClosable = true, fit, id, isStopPropagation = false, popupContainer, }, ref) {
|
|
15
15
|
const [isError, setIsError] = useState(false);
|
|
16
16
|
const { classPrefix } = useConfig();
|
|
17
17
|
const platform = usePlatform();
|
|
@@ -20,7 +20,7 @@ src, alt, mode, lazyLoad = false, imgPreview = false, maskClosable = true, fit,
|
|
|
20
20
|
[`${classPrefix}-image__error`]: isError,
|
|
21
21
|
[className]: className,
|
|
22
22
|
[`${classPrefix}-${platform}-image`]: true,
|
|
23
|
-
[`${classPrefix}-image__zoom-in`]:
|
|
23
|
+
[`${classPrefix}-image__zoom-in`]: imgPreview && !isError,
|
|
24
24
|
});
|
|
25
25
|
const objectFit = fit || getObjectFitByWxImageMode(mode);
|
|
26
26
|
const { data: realSrc, isLoading } = useTempUrl(src);
|
|
@@ -80,7 +80,7 @@ src, alt, mode, lazyLoad = false, imgPreview = false, maskClosable = true, fit,
|
|
|
80
80
|
*
|
|
81
81
|
* 4. 图片src未传,传入undefined,不展示占位符
|
|
82
82
|
*/
|
|
83
|
-
return isLoading || (!isLoading && src === undefined) ? null : (_jsx(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc || null, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable, id: id, isStopPropagation: isStopPropagation }));
|
|
83
|
+
return isLoading || (!isLoading && src === undefined) ? null : (_jsx(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc || null, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable, id: id, isStopPropagation: isStopPropagation, portalContainer: popupContainer }));
|
|
84
84
|
});
|
|
85
85
|
function getObjectFitByWxImageMode(mode) {
|
|
86
86
|
const array = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
|
-
import { useState, useImperativeHandle, useMemo, useEffect, useCallback
|
|
3
|
+
import { useState, useImperativeHandle, useMemo, useEffect, useCallback } from 'react';
|
|
4
4
|
import { LoadingTip } from 'tea-component';
|
|
5
5
|
import { SelectUI as Select } from '../select/selectUI';
|
|
6
6
|
import { WdIcon } from '../../wd-icon';
|
|
@@ -48,6 +48,7 @@ const OptionText = ({ mode, option, selectFields, authFields, onChange, onRelati
|
|
|
48
48
|
const defaultSize = 50;
|
|
49
49
|
const defaultPage = 1;
|
|
50
50
|
export function RelationSelect(props) {
|
|
51
|
+
var _a;
|
|
51
52
|
const { placeholder, size, disabled, onChange, value, onSearch, addRelationButton, childRef, dataSourceName, selectFields, selectFieldType, primaryField, setRefreshStatus, mode, onRelationOptionJump, enableRelationOptionJump, } = props;
|
|
52
53
|
const { authFields } = useAuthFields({
|
|
53
54
|
dbName: dataSourceName,
|
|
@@ -115,26 +116,20 @@ export function RelationSelect(props) {
|
|
|
115
116
|
}, 500);
|
|
116
117
|
},
|
|
117
118
|
};
|
|
118
|
-
}, [
|
|
119
|
-
getRelationOptions,
|
|
120
|
-
query.pageNo,
|
|
121
|
-
searchOptionListWithWhere,
|
|
122
|
-
setRefreshStatus,
|
|
123
|
-
]);
|
|
119
|
+
}, [getRelationOptions, query.pageNo, searchOptionListWithWhere, setRefreshStatus]);
|
|
124
120
|
const searchHandle = (keyword) => {
|
|
125
121
|
let where = whereList;
|
|
126
122
|
if (keyword === null || keyword === void 0 ? void 0 : keyword.length) {
|
|
127
123
|
// 筛选面板的查询条件与数据过滤的查询条件是且的关系
|
|
128
124
|
where = {
|
|
129
|
-
$and: [
|
|
130
|
-
...whereList,
|
|
131
|
-
{ $and: [{ [primaryField]: { $search: keyword } }] },
|
|
132
|
-
],
|
|
125
|
+
$and: [...whereList, { $and: [{ [primaryField]: { $search: keyword } }] }],
|
|
133
126
|
};
|
|
134
127
|
}
|
|
135
128
|
searchOptionListWithWhere(where);
|
|
136
129
|
onSearch(keyword);
|
|
137
130
|
};
|
|
131
|
+
const primaryFieldTitle = (_a = authFields === null || authFields === void 0 ? void 0 : authFields.find((j) => (j === null || j === void 0 ? void 0 : j.name) === primaryField)) === null || _a === void 0 ? void 0 : _a.title;
|
|
132
|
+
const searchPlaceholder = `搜索主列${primaryFieldTitle}[${primaryField}]`;
|
|
138
133
|
return (_jsx(EnumHoc, { fields: authFields, children: _jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, matchButtonWidth: true, placeholder: placeholder, appearance: 'button', size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle, tips: isLoading ? '' : undefined, bottomTips: isLoading ? _jsx(LoadingTip, {}) : undefined, onScrollBottom: () => {
|
|
139
134
|
if (!isLoading && customOptions.length < total) {
|
|
140
135
|
setQuery((query) => ({
|
|
@@ -144,7 +139,7 @@ export function RelationSelect(props) {
|
|
|
144
139
|
}
|
|
145
140
|
}, onOpen: () => {
|
|
146
141
|
searchOptionListWithWhere();
|
|
147
|
-
}, footer: addRelationButton, mode: mode }) }));
|
|
142
|
+
}, footer: addRelationButton, mode: mode, searchPlaceholder: searchPlaceholder }) }));
|
|
148
143
|
}
|
|
149
144
|
export function EnumSelect(props) {
|
|
150
145
|
const { placeholder, size, disabled, onChange, value, onSearch, addRelationButton, childRef, dataSourceName, enumName, primaryField, format, viewId, where, setRefreshStatus, mode, } = props;
|
|
@@ -5,12 +5,12 @@ import { WdFormItemReadOnly } from '../../wd-form-item';
|
|
|
5
5
|
import { Modal } from '../../wd-date/elements/Modal.h5';
|
|
6
6
|
import classNames from '../../../utils/classnames';
|
|
7
7
|
import { useConfig } from '../../../utils/config-context';
|
|
8
|
-
import { usePlatform } from '../../../utils/platform';
|
|
8
|
+
import { usePlatform, textToString } from '../../../utils/platform';
|
|
9
9
|
import { useSyncValue } from '../../../utils/hooks/useSyncValue';
|
|
10
10
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
11
11
|
import AllEmpty from '../../form/select/status/allEmpty';
|
|
12
12
|
import '../style';
|
|
13
|
-
const OptionList = ({ options, inputFocus, currentSelected, optionClick, bottomTips, onScrollBottom
|
|
13
|
+
const OptionList = ({ options, inputFocus, currentSelected, optionClick, bottomTips, onScrollBottom }) => {
|
|
14
14
|
return (_jsxs(List, { className: "weda-ui-custom-picker__cloumn", style: {
|
|
15
15
|
height: inputFocus ? 'calc(100vh - 190px)' : '250px',
|
|
16
16
|
}, onScrollBottom: onScrollBottom, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
|
|
@@ -20,15 +20,12 @@ const OptionList = ({ options, inputFocus, currentSelected, optionClick, bottomT
|
|
|
20
20
|
'is-selected': currentSelected.find((i) => i.value === item.value),
|
|
21
21
|
'is-disabled': item.disabled,
|
|
22
22
|
});
|
|
23
|
-
return (_jsx(List.Item, { className: itemCls, onClick: () => optionClick(item), children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text', children: item.text || item.label }) }, index));
|
|
23
|
+
return (_jsx(List.Item, { className: itemCls, onClick: () => optionClick(item), children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text', children: textToString(item.text) || textToString(item.label) }) }, index));
|
|
24
24
|
}), bottomTips && (_jsx(List.Item, { children: _jsx("div", { className: "weda-ui-custom-picker__status weda-ui-custom-picker__status--empty", children: bottomTips }) }))] }));
|
|
25
25
|
};
|
|
26
26
|
const getSelectedItem = (options = [], value) => {
|
|
27
|
-
if (!value) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
27
|
const selectedVal = Array.isArray(value) ? value : [value];
|
|
31
|
-
return options === null || options === void 0 ? void 0 : options.filter((i) => selectedVal.find((j) => j === i.value));
|
|
28
|
+
return options === null || options === void 0 ? void 0 : options.filter((i) => selectedVal.find((j) => j === i.value) !== undefined);
|
|
32
29
|
};
|
|
33
30
|
function SelectH5(props) {
|
|
34
31
|
const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, } = props;
|
|
@@ -156,25 +153,23 @@ export function SelectUI(props) {
|
|
|
156
153
|
const selectedItem = getSelectedItem(options, value);
|
|
157
154
|
if (isMultiple) {
|
|
158
155
|
return selectedItem
|
|
159
|
-
.map((i) => (i === null || i === void 0 ? void 0 : i.label) || i.value)
|
|
156
|
+
.map((i) => textToString(i === null || i === void 0 ? void 0 : i.label) || textToString(i.value))
|
|
160
157
|
.join(',');
|
|
161
158
|
}
|
|
162
159
|
else {
|
|
163
|
-
return ((_a = selectedItem[0]) === null || _a === void 0 ? void 0 : _a.label) || ((_b = selectedItem[0]) === null || _b === void 0 ? void 0 : _b.value) || '';
|
|
160
|
+
return textToString((_a = selectedItem[0]) === null || _a === void 0 ? void 0 : _a.label) || textToString((_b = selectedItem[0]) === null || _b === void 0 ? void 0 : _b.value) || '';
|
|
164
161
|
}
|
|
165
162
|
}, [isMultiple, options, value]);
|
|
166
163
|
const render = () => {
|
|
167
164
|
if (platform === 'h5') {
|
|
168
|
-
return
|
|
165
|
+
return _jsx(SelectH5, { ...props, readValue: readValue, searchPlaceholder: searchPlaceholder });
|
|
169
166
|
}
|
|
170
167
|
else if (mode === 'multiple') {
|
|
171
168
|
return (_jsx(SelectMultiple, { popupContainer: popupContainer, button: (selectedItem) => {
|
|
172
169
|
if (!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.length)) {
|
|
173
170
|
return _jsx("div", { className: "wedatea2td-text-weak", children: placeholder });
|
|
174
171
|
}
|
|
175
|
-
return selectedItem
|
|
176
|
-
.map((i) => (i === null || i === void 0 ? void 0 : i.label) || i.value)
|
|
177
|
-
.join(',');
|
|
172
|
+
return selectedItem.map((i) => (i === null || i === void 0 ? void 0 : i.label) || i.value).join(',');
|
|
178
173
|
}, staging: false, overlayClassName: `${overlayClassName} multiple`, searchable: searchable, matchButtonWidth: true, placeholder: placeholder, searchPlaceholder: searchPlaceholder, appearance: 'button', size: size, disabled: disabled, autoClearSearchValue: true, options: options === null || options === void 0 ? void 0 : options.map((i) => ({ ...i, text: i.text || i.label })), value: Array.isArray(value) ? value : [], onChange: onChange, onSearch: onSearch, footer: footer, onOpen: onOpen, onScrollBottom: onScrollBottom, bottomTips: bottomTips, tips: tips, listHeight: listHeight, listWidth: listWidth }));
|
|
179
174
|
}
|
|
180
175
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
|
-
import { useRef, useEffect, useState, useMemo, forwardRef, memo
|
|
3
|
+
import { useRef, useEffect, useState, useMemo, forwardRef, memo } from 'react';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
5
|
import { Table, ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandleByApi, exportHandle, FilterFieldsPanel, ToolBar, } from './components';
|
|
6
6
|
import classNames from '../../utils/classnames';
|
|
@@ -19,7 +19,7 @@ import { useQueryParams } from './hooks/useQueryParams';
|
|
|
19
19
|
import { WdCompError } from '../../utils/error';
|
|
20
20
|
import { getSlots, getFilterFields, getSelectedView, getSortColumns, mapTableDataWithView, checkSupport, DataSourceType, getRecordKey, getCurrentPageData, } from './utils';
|
|
21
21
|
import { Mock } from './mock';
|
|
22
|
-
import { getTableColumns, slotRender, mapColumKey
|
|
22
|
+
import { getTableColumns, slotRender, mapColumKey } from './components/FieldRender';
|
|
23
23
|
import Modal from '../modal';
|
|
24
24
|
import { WdButton } from '../wd-button';
|
|
25
25
|
import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
@@ -30,7 +30,7 @@ export const _defaultPageSize = 10;
|
|
|
30
30
|
export const TableOption = function TableOption({ slots, ...props }) {
|
|
31
31
|
return slotRender(slots[CELL_CUSTOM_OPTION], props);
|
|
32
32
|
};
|
|
33
|
-
export const GlobalButton = memo(function GlobalButtonDom({ classPrefix, slots
|
|
33
|
+
export const GlobalButton = memo(function GlobalButtonDom({ classPrefix, slots }) {
|
|
34
34
|
return _jsx("div", { className: `${classPrefix}-global-btn`, children: slotRender(slots) });
|
|
35
35
|
});
|
|
36
36
|
// eslint-disable-next-line complexity
|
|
@@ -92,9 +92,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
92
92
|
// 数据源类型是否是apis
|
|
93
93
|
const isApis = dataSourceType === DataSourceType.CustomConnector;
|
|
94
94
|
const { enabledFieldNames, isNewData, selectedViewIds } = bindMetadata;
|
|
95
|
-
const datasource = isModel
|
|
96
|
-
? bindMetadata.datasource
|
|
97
|
-
: bindConnectMetadata.datasource;
|
|
95
|
+
const datasource = isModel ? bindMetadata.datasource : bindConnectMetadata.datasource;
|
|
98
96
|
const { outParams } = connectorMethod;
|
|
99
97
|
const dbName = datasource === null || datasource === void 0 ? void 0 : datasource.name;
|
|
100
98
|
// 数据源名称
|
|
@@ -144,10 +142,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
144
142
|
initPageIndex = parseInt(initPageIndex);
|
|
145
143
|
initPageSize = parseInt(initPageSize);
|
|
146
144
|
// 排序规则
|
|
147
|
-
const _sort = useMemo(() => {
|
|
148
|
-
var _a;
|
|
149
|
-
return ((_a = sorter === null || sorter === void 0 ? void 0 : sorter.filter((n) => n.orderBy && n.orderType)) === null || _a === void 0 ? void 0 : _a.map((i) => ({ by: i.orderBy, order: i.orderType }))) || [];
|
|
150
|
-
}, [sorter]);
|
|
145
|
+
const _sort = useMemo(() => { var _a; return ((_a = sorter === null || sorter === void 0 ? void 0 : sorter.filter((n) => n.orderBy && n.orderType)) === null || _a === void 0 ? void 0 : _a.map((i) => ({ by: i.orderBy, order: i.orderType }))) || []; }, [sorter]);
|
|
151
146
|
const [queryParams, setQueryParams] = useState({
|
|
152
147
|
pageIndex: initPageIndex,
|
|
153
148
|
pageSize: initPageSize,
|
|
@@ -294,7 +289,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
294
289
|
isSupportMultipleSort,
|
|
295
290
|
});
|
|
296
291
|
// 查询数据
|
|
297
|
-
const { tableData, tableTotal, tableLoading, getNewList, isError, errorObj, emptyTable
|
|
292
|
+
const { tableData, tableTotal, tableLoading, getNewList, isError, errorObj, emptyTable } = useTableData({
|
|
298
293
|
dataSourceAPI,
|
|
299
294
|
dbName,
|
|
300
295
|
connectorMethod,
|
|
@@ -346,9 +341,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
346
341
|
if ((isTableLoading && !isH5) || isNoDataSourceBind) {
|
|
347
342
|
return [];
|
|
348
343
|
}
|
|
349
|
-
if (isTableLoading &&
|
|
350
|
-
isH5 &&
|
|
351
|
-
(queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === _defaultPageIndex) {
|
|
344
|
+
if (isTableLoading && isH5 && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === _defaultPageIndex) {
|
|
352
345
|
return [];
|
|
353
346
|
}
|
|
354
347
|
if (viewFieldsData === null || viewFieldsData === void 0 ? void 0 : viewFieldsData.selectedViewId) {
|
|
@@ -547,6 +540,10 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
547
540
|
});
|
|
548
541
|
}
|
|
549
542
|
},
|
|
543
|
+
// 清空选中项
|
|
544
|
+
clearSelection: () => {
|
|
545
|
+
onSelectChange([], {}, true);
|
|
546
|
+
},
|
|
550
547
|
// 当前页数据
|
|
551
548
|
records: isExpression && !enableTotal
|
|
552
549
|
? getCurrentPageData(dataRef.current.tableRecords, query.pageNo, query.pageSize)
|
|
@@ -563,9 +560,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
563
560
|
defaultPageSize,
|
|
564
561
|
defaultPageIndex,
|
|
565
562
|
dataSourceData: dataRef.current.dataSourceData,
|
|
566
|
-
sort: supportManyRelated
|
|
567
|
-
? query.orderBy
|
|
568
|
-
: [{ orderBy: query.orderBy, orderType: query.orderType }],
|
|
563
|
+
sort: supportManyRelated ? query.orderBy : [{ orderBy: query.orderBy, orderType: query.orderType }],
|
|
569
564
|
filter: supportManyRelated ? query.filter : query === null || query === void 0 ? void 0 : query.where,
|
|
570
565
|
dataSourceVersion: supportManyRelated ? 'v2' : 'v1',
|
|
571
566
|
filterConfig,
|
|
@@ -614,15 +609,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
614
609
|
});
|
|
615
610
|
}
|
|
616
611
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
617
|
-
}, [
|
|
618
|
-
isH5,
|
|
619
|
-
isModel,
|
|
620
|
-
selectedRecords,
|
|
621
|
-
total,
|
|
622
|
-
tableRecords === null || tableRecords === void 0 ? void 0 : tableRecords.length,
|
|
623
|
-
query.pageNo,
|
|
624
|
-
query.pageSize,
|
|
625
|
-
]);
|
|
612
|
+
}, [isH5, isModel, selectedRecords, total, tableRecords === null || tableRecords === void 0 ? void 0 : tableRecords.length, query.pageNo, query.pageSize]);
|
|
626
613
|
useEffect(() => {
|
|
627
614
|
if (isModel || isExpression) {
|
|
628
615
|
setQueryParams((queryParams) => ({
|
|
@@ -645,19 +632,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
645
632
|
sort: [],
|
|
646
633
|
}));
|
|
647
634
|
}
|
|
648
|
-
}, [
|
|
649
|
-
defaultPageIndex,
|
|
650
|
-
defaultPageSize,
|
|
651
|
-
connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageSize,
|
|
652
|
-
connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageNo,
|
|
653
|
-
isModel,
|
|
654
|
-
orderBy,
|
|
655
|
-
orderType,
|
|
656
|
-
connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.orderBy,
|
|
657
|
-
connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.orderType,
|
|
658
|
-
isExpression,
|
|
659
|
-
_sort,
|
|
660
|
-
]);
|
|
635
|
+
}, [defaultPageIndex, defaultPageSize, connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageSize, connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageNo, isModel, orderBy, orderType, connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.orderBy, connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.orderType, isExpression, _sort]);
|
|
661
636
|
useEffect(() => {
|
|
662
637
|
if (isH5) {
|
|
663
638
|
setQueryParams((queryParams) => ({ ...queryParams, pageIndex: 1 }));
|
|
@@ -749,18 +724,13 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
749
724
|
const errorMsg = isError ? errorObj : fieldsError;
|
|
750
725
|
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: authFields, children: _jsxs("div", { className: classNames(wrapClassList, className), style: style, id: id, children: [hasFilterButton && (_jsx(FilterFieldsPanel, { ref: filterMethodsRef, openMobileFilter: openMobileFilter, setOpenMobileFilter: setOpenMobileFilter, filterFields: filterFieldsData, fetchData: onFilterChange, setFilterConfig: setFilterConfig })), _jsxs("div", { className: `${classPrefix}-table-container`, children: [!isH5 && !isNoDataSourceBind && (_jsxs("div", { className: `${classPrefix}-table-wrap-toolbar`, children: [enableGlobalButton && (_jsx("div", { className: `${classPrefix}-table-wrap-toolbar__col ${classPrefix}-table-wrap-toolbar__col-start`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) })), (enableRefreshBtn || enableTableHeightSizeBtn) && (_jsx("div", { className: `${classPrefix}-table-wrap-toolbar__col ${classPrefix}-table-wrap-toolbar__col-end`, children: _jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
751
726
|
setOpenMobileFilter(true);
|
|
752
|
-
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 &&
|
|
753
|
-
(enablePagination ||
|
|
754
|
-
enableRefreshBtn ||
|
|
755
|
-
enableTableHeightSizeBtn ||
|
|
756
|
-
hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
727
|
+
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 && (enablePagination || enableRefreshBtn || enableTableHeightSizeBtn || hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
757
728
|
setOpenMobileFilter(true);
|
|
758
729
|
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(Table, { events: events, emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: columns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, onQueryChange: onQueryChange, rowClick: rowClick, cellClick: cellClick, isError: errorStatus, errorObj: errorMsg, __innerSlot: __innerSlot }), isH5 && enableGlobalButton && !isNoDataSourceBind && (_jsx("div", { className: `${classPrefix}-h5-table-wrap-footer`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) }))] }), _jsx(ImportFileModal, { columnSets: columnSets, dbName: dbName, datasourceTitle: datasourceTitle, fields: fields, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, isImportFileModalByApiVisible: isImportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, refresh: refreshTable, supportManyRelated: supportManyRelated }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: mapColumKey(columns), isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, supportManyRelated: supportManyRelated }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { overlayClassName: `${classPrefix}-h5-table-overlay`, className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
|
|
759
730
|
close: () => {
|
|
760
731
|
setIsMobileOptionVisible(false);
|
|
761
732
|
},
|
|
762
|
-
}, content: '', customContent: _jsx("div", { className: `${classPrefix}-h5-table-option-btn-wrap`, children: enableCellCustomOption &&
|
|
763
|
-
slotRender(slots[CELL_CUSTOM_OPTION], rowData) }), customButton: _jsx(WdButton, { variant: "text", text: "\u53D6\u6D88", events: {
|
|
733
|
+
}, content: '', customContent: _jsx("div", { className: `${classPrefix}-h5-table-option-btn-wrap`, children: enableCellCustomOption && slotRender(slots[CELL_CUSTOM_OPTION], rowData) }), customButton: _jsx(WdButton, { variant: "text", text: "\u53D6\u6D88", events: {
|
|
764
734
|
tap: () => {
|
|
765
735
|
setIsMobileOptionVisible(false);
|
|
766
736
|
},
|
|
@@ -4,6 +4,8 @@ import type { DataType, EventsType } from '../../../configs/components/web-view'
|
|
|
4
4
|
import './style';
|
|
5
5
|
export declare const WebView: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
6
6
|
link: string;
|
|
7
|
+
allow: string;
|
|
8
|
+
sandbox: string;
|
|
7
9
|
} & {
|
|
8
10
|
events: {
|
|
9
11
|
load: (eventDetail: {
|
|
@@ -7,7 +7,7 @@ import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
|
7
7
|
import { Bubble } from 'tea-component';
|
|
8
8
|
import EmptyContent from '../statusContent';
|
|
9
9
|
import './style';
|
|
10
|
-
export const WebView = forwardRef(function WebView({ link = '', events, className, style }, ref) {
|
|
10
|
+
export const WebView = forwardRef(function WebView({ link = '', events, className, style, allow = 'microphone;camera;midi;encrypted-media;geolocation;fullscreen;clipboard-write;clipboard-read;', sandbox = 'allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts allow-downloads', }, ref) {
|
|
11
11
|
const platform = usePlatform();
|
|
12
12
|
const iframeRef = useRef(null);
|
|
13
13
|
// 样式
|
|
@@ -68,5 +68,5 @@ export const WebView = forwardRef(function WebView({ link = '', events, classNam
|
|
|
68
68
|
(events === null || events === void 0 ? void 0 : events.message) && (events === null || events === void 0 ? void 0 : events.message({ data: e.data }));
|
|
69
69
|
}, false);
|
|
70
70
|
}, [events, link]);
|
|
71
|
-
return (_jsx(_Fragment, { children: isInIde() ? (_jsx(_Fragment, { children: _jsx(Bubble, { content: "\u8BE5\u7EC4\u4EF6\u5728\u5C0F\u7A0B\u5E8F\u7AEF\u5C06\u94FA\u6EE1\u6574\u4E2A\u9875\u9762\u5E76\u8986\u76D6\u5176\u4ED6\u7EC4\u4EF6\uFF0C\u5E76\u4E14\u5C0F\u7A0B\u5E8F\u4E3A\u4F01\u4E1A\u4E3B\u4F53\u65F6\u624D\u80FD\u6B63\u5E38\u4F7F\u7528", children: link ? (_jsx("iframe", { src: link, style: style, className: classNames(classes, className) })) : (_jsx("div", { style: style, className: classNames(classes, className), children: _jsx(EmptyContent, { emptyText: "\u6682\u65E0\u7F51\u9875\uFF0C\u8BF7\u8F93\u5165\u7F51\u9875\u94FE\u63A5", component: "table", isH5: true }) })) }) })) : (_jsx(_Fragment, { children: link ? (_jsx("iframe", { onLoad: onLoad, onError: () => onError(), ref: iframeRef, id: 'web-view', name: 'web-view', src: link, title: 'web-view', style: style, className: classNames(classes, className) })) : (_jsx("div", { style: style, className: classNames(classes, className), children: _jsx(EmptyContent, { emptyText: "\u6682\u65E0\u7F51\u9875\uFF0C\u8BF7\u8F93\u5165\u7F51\u9875\u94FE\u63A5", component: "table", isH5: true }) })) })) }));
|
|
71
|
+
return (_jsx(_Fragment, { children: isInIde() ? (_jsx(_Fragment, { children: _jsx(Bubble, { content: "\u8BE5\u7EC4\u4EF6\u5728\u5C0F\u7A0B\u5E8F\u7AEF\u5C06\u94FA\u6EE1\u6574\u4E2A\u9875\u9762\u5E76\u8986\u76D6\u5176\u4ED6\u7EC4\u4EF6\uFF0C\u5E76\u4E14\u5C0F\u7A0B\u5E8F\u4E3A\u4F01\u4E1A\u4E3B\u4F53\u65F6\u624D\u80FD\u6B63\u5E38\u4F7F\u7528", children: link ? (_jsx("iframe", { src: link, style: style, className: classNames(classes, className) })) : (_jsx("div", { style: style, className: classNames(classes, className), children: _jsx(EmptyContent, { emptyText: "\u6682\u65E0\u7F51\u9875\uFF0C\u8BF7\u8F93\u5165\u7F51\u9875\u94FE\u63A5", component: "table", isH5: true }) })) }) })) : (_jsx(_Fragment, { children: link ? (_jsx("iframe", { onLoad: onLoad, onError: () => onError(), ref: iframeRef, id: 'web-view', name: 'web-view', src: link, title: 'web-view', style: style, className: classNames(classes, className), allow: allow, sandbox: sandbox })) : (_jsx("div", { style: style, className: classNames(classes, className), children: _jsx(EmptyContent, { emptyText: "\u6682\u65E0\u7F51\u9875\uFF0C\u8BF7\u8F93\u5165\u7F51\u9875\u94FE\u63A5", component: "table", isH5: true }) })) })) }));
|
|
72
72
|
});
|