@cloudbase/weda-ui 3.25.0 → 3.26.0
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/wd-drawer.d.ts +144 -0
- package/dist/configs/components/wd-drawer.js +358 -0
- package/dist/configs/components/wd-image.js +1 -1
- package/dist/configs/components/wd-modal.js +5 -1
- package/dist/configs/components/wd-table.d.ts +5 -0
- package/dist/configs/components/wd-table.js +11 -0
- package/dist/configs/components/wxOpenApi/userInfo.d.ts +2 -2
- package/dist/configs/index.d.ts +256 -2
- package/dist/configs/index.js +2 -0
- package/dist/enum/index.d.ts +4 -0
- package/dist/enum/index.js +18 -0
- package/dist/style/index.css +146 -3
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +4 -4
- package/dist/web/components/form/uploader/upload/index.js +3 -1
- package/dist/web/components/form/uploader/uploader.pc.js +3 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +25 -17
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +26 -17
- package/dist/web/components/form/userOrgSelect/component/depart-breadcrumb.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +8 -4
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +10 -3
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +6 -6
- package/dist/web/components/form/userOrgSelect/component/error-tips.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/error-tips.js +7 -4
- package/dist/web/components/form/userOrgSelect/component/modal-search-h5.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/modal-search.js +4 -1
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +8 -11
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +3 -1
- package/dist/web/components/form/userOrgSelect/component/selected-list-h5.js +8 -8
- package/dist/web/components/form/userOrgSelect/component/selected-list.js +5 -10
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +12 -21
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-list-h5.js +6 -10
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +5 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +4 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +2 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +12 -11
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +9 -9
- package/dist/web/components/form-input-hooks/validator.js +1 -1
- package/dist/web/components/index.d.ts +2 -0
- package/dist/web/components/index.js +2 -0
- package/dist/web/components/richText/const.d.ts +57 -0
- package/dist/web/components/richText/const.js +57 -0
- package/dist/web/components/richText/index.css +3 -1
- package/dist/web/components/richText/index.d.ts +1 -2
- package/dist/web/components/richText/index.js +26 -20
- package/dist/web/components/table/ImportFileModal/index.css +21 -69
- package/dist/web/components/uploaderFileView/index.js +2 -0
- package/dist/web/components/uploaderView/index.js +6 -3
- package/dist/web/components/wd-config-provider/wd-config-context.d.ts +9 -0
- package/dist/web/components/wd-config-provider/wd-config-context.js +2 -0
- package/dist/web/components/wd-config-provider/wd-config-provider.js +8 -9
- package/dist/web/components/wd-drawer/index.d.ts +3 -0
- package/dist/web/components/wd-drawer/index.js +3 -0
- package/dist/web/components/wd-drawer/wd-drawer.d.ts +11 -0
- package/dist/web/components/wd-drawer/wd-drawer.js +122 -0
- package/dist/web/components/wd-form/hooks/use-remote-value.js +1 -1
- package/dist/web/components/wd-image/ImagePreview.js +5 -1
- package/dist/web/components/wd-modal/wd-modal.js +4 -2
- package/dist/web/components/wd-rich-text/wd-rich-text.js +1 -1
- package/dist/web/components/wd-table/components/Table/index.js +3 -1
- package/dist/web/components/wd-table/wd-table.js +27 -29
- package/dist/web/components/wd-tabs/tabs-h5.js +6 -3
- package/dist/web/components/wd-tabs/tabs-pc.js +6 -3
- package/dist/web/components/wd-tabs/tabs.js +2 -6
- package/dist/web/components/wd-tree/utils.d.ts +1 -1
- package/dist/web/components/wd-unified-link/utils.js +2 -2
- package/dist/web/components/wd-upload-file/wd-upload-file.js +5 -1
- package/dist/web/utils/config-context/use-config.d.ts +1 -0
- package/dist/web/utils/config-context/use-config.js +2 -1
- package/dist/web/utils/i18n/index.d.ts +1 -0
- package/dist/web/utils/i18n/index.js +1 -0
- package/dist/web/utils/i18n/locale/en_US.d.ts +119 -0
- package/dist/web/utils/i18n/locale/en_US.js +187 -0
- package/dist/web/utils/i18n/locale/zh_CN.d.ts +120 -0
- package/dist/web/utils/i18n/locale/zh_CN.js +188 -0
- package/dist/web/utils/i18n/translation.d.ts +9 -0
- package/dist/web/utils/i18n/translation.js +28 -0
- package/dist/web/utils/i18n/translationMap.d.ts +15 -0
- package/dist/web/utils/i18n/translationMap.js +10 -0
- package/package.json +3 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
|
+
import { useEffect, useRef, useState, useCallback, useImperativeHandle, forwardRef } from 'react';
|
|
4
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
|
+
import classNames from '../../utils/classnames';
|
|
6
|
+
import { useConfig } from '../../utils/config-context';
|
|
7
|
+
import { useSyncValue } from '../../utils/hooks/useSyncValue';
|
|
8
|
+
import { usePlatform } from '../../utils/platform';
|
|
9
|
+
import { convertLegacyEnum } from '../../utils/tool';
|
|
10
|
+
import { WD_DRAWER_PLACEMENT } from '../../../enum';
|
|
11
|
+
// 常量定义
|
|
12
|
+
const DEFAULT_DURATION = 300;
|
|
13
|
+
const DEFAULT_Z_INDEX = 1000;
|
|
14
|
+
const MASK_Z_INDEX_OFFSET = 1;
|
|
15
|
+
const DEFAULT_DELAY = 100;
|
|
16
|
+
// 默认样式对象
|
|
17
|
+
const DEFAULT_STYLE = {};
|
|
18
|
+
const WdDrawer = forwardRef(function WdDrawer(props, ref) {
|
|
19
|
+
const { id, visible: _visible, placement: _placement, mask = true, className = '', style = DEFAULT_STYLE, duration = DEFAULT_DURATION, zIndex = DEFAULT_Z_INDEX, closeType = ['outerClick'], events, headerSlot, contentSlot, footerSlot, enableHeaderSlot = true, enableContentSlot = true, enableFooterSlot = false, } = props;
|
|
20
|
+
const [openInfo, setOpenInfo] = useState(null);
|
|
21
|
+
const [closeInfo, setCloseInfo] = useState(null);
|
|
22
|
+
const platform = usePlatform();
|
|
23
|
+
const [visible, setVisible] = useSyncValue(_visible);
|
|
24
|
+
const drawerRef = useRef(null);
|
|
25
|
+
const maskRef = useRef(null);
|
|
26
|
+
const { classPrefix: _classPrefix } = useConfig();
|
|
27
|
+
const classPrefix = _classPrefix + '-';
|
|
28
|
+
const placement = convertLegacyEnum(_placement, WD_DRAWER_PLACEMENT, 'right');
|
|
29
|
+
/**
|
|
30
|
+
* 关闭弹窗
|
|
31
|
+
*/
|
|
32
|
+
const close = useCallback((params) => {
|
|
33
|
+
setVisible(false);
|
|
34
|
+
setCloseInfo((params === null || params === void 0 ? void 0 : params.info) || params);
|
|
35
|
+
events === null || events === void 0 ? void 0 : events.close(params);
|
|
36
|
+
}, [events, setVisible]);
|
|
37
|
+
/**
|
|
38
|
+
* 开启弹窗
|
|
39
|
+
*/
|
|
40
|
+
const open = useCallback((params) => {
|
|
41
|
+
setOpenInfo((params === null || params === void 0 ? void 0 : params.info) || params);
|
|
42
|
+
setVisible(true);
|
|
43
|
+
events === null || events === void 0 ? void 0 : events.open(params);
|
|
44
|
+
}, [events, setVisible]);
|
|
45
|
+
/** 点击遮罩层是否关闭抽屉 */
|
|
46
|
+
const maskClosable = closeType.includes('outerClick');
|
|
47
|
+
/** 点击 ESC 键是否关闭 */
|
|
48
|
+
const escClosable = closeType.includes('esc');
|
|
49
|
+
// ESC 键关闭
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const handleKeyDown = (e) => {
|
|
52
|
+
if (e.key === 'Escape' && visible) {
|
|
53
|
+
close();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
if (visible && platform === 'pc' && escClosable) {
|
|
57
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
58
|
+
}
|
|
59
|
+
return () => {
|
|
60
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
61
|
+
};
|
|
62
|
+
}, [close, escClosable, platform, visible]);
|
|
63
|
+
// 点击外部关闭
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const handleDocumentClick = (e) => {
|
|
66
|
+
// 只有在允许点击关闭时才处理
|
|
67
|
+
if (maskClosable && visible && drawerRef.current) {
|
|
68
|
+
// 检查点击目标是否在抽屉内部
|
|
69
|
+
if (!drawerRef.current.contains(e.target)) {
|
|
70
|
+
close();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
if (visible && maskClosable) {
|
|
75
|
+
// 延迟添加事件监听器,避免立即触发
|
|
76
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
77
|
+
const timer = setTimeout(() => {
|
|
78
|
+
document.addEventListener('click', handleDocumentClick);
|
|
79
|
+
}, DEFAULT_DELAY);
|
|
80
|
+
return () => {
|
|
81
|
+
clearTimeout(timer);
|
|
82
|
+
document.removeEventListener('click', handleDocumentClick);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}, [close, maskClosable, visible]);
|
|
86
|
+
// 遮罩层点击关闭
|
|
87
|
+
const handleMaskClick = (e) => {
|
|
88
|
+
if (maskClosable && e.target === maskRef.current) {
|
|
89
|
+
close();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
// 阻止抽屉内容区域的点击事件冒泡
|
|
93
|
+
const handleDrawerClick = (e) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
};
|
|
96
|
+
// 获取抽屉样式
|
|
97
|
+
const getDrawerStyle = () => {
|
|
98
|
+
const baseStyle = {
|
|
99
|
+
zIndex,
|
|
100
|
+
...style,
|
|
101
|
+
};
|
|
102
|
+
if (placement === 'left' || placement === 'right') {
|
|
103
|
+
baseStyle.height = '100%';
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
baseStyle.width = '100%';
|
|
107
|
+
}
|
|
108
|
+
return baseStyle;
|
|
109
|
+
};
|
|
110
|
+
// Widget API,挂载组件只读属性和组件方法
|
|
111
|
+
useImperativeHandle(ref, () => {
|
|
112
|
+
return {
|
|
113
|
+
close,
|
|
114
|
+
open,
|
|
115
|
+
modalState: visible ? 'open' : 'close',
|
|
116
|
+
openInfo,
|
|
117
|
+
closeInfo,
|
|
118
|
+
};
|
|
119
|
+
}, [close, open, visible, openInfo, closeInfo]);
|
|
120
|
+
return (_jsxs("div", { id: id, className: classNames(`${classPrefix}drawer`, `${classPrefix}${platform}-drawer`, className), style: { display: (style === null || style === void 0 ? void 0 : style.display) || 'block' }, "data-testid": "wd-drawer-test", children: [mask && (_jsx(CSSTransition, { in: visible, timeout: duration, classNames: `${classPrefix}drawer-mask`, unmountOnExit: true, nodeRef: maskRef, children: _jsx("div", { ref: maskRef, className: `${classPrefix}drawer-mask`, style: { zIndex: zIndex - MASK_Z_INDEX_OFFSET }, onClick: handleMaskClick }) })), _jsx(CSSTransition, { in: visible, timeout: duration, classNames: `${classPrefix}drawer-${placement}`, unmountOnExit: true, nodeRef: drawerRef, children: _jsxs("div", { ref: drawerRef, className: classNames(`${classPrefix}drawer-content-wrapper`, `${classPrefix}drawer-${placement}`), style: getDrawerStyle(), onClick: handleDrawerClick, children: [enableHeaderSlot && _jsx("div", { className: `${classPrefix}drawer-header`, children: headerSlot }), enableContentSlot && _jsx("div", { className: `${classPrefix}drawer-body`, children: contentSlot }), enableFooterSlot && _jsx("div", { className: `${classPrefix}drawer-footer`, children: footerSlot })] }) })] }));
|
|
121
|
+
});
|
|
122
|
+
export { WdDrawer };
|
|
@@ -226,7 +226,7 @@ export function useRemoteParamsFromValue({ dataSourceProfile, formData, formType
|
|
|
226
226
|
const format = (_c = (_b = (_a = dataSourceProfile.schema) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b[cur]) === null || _c === void 0 ? void 0 : _c.format;
|
|
227
227
|
acc[cur] = formData[cur];
|
|
228
228
|
if (SINGLE_SELECT_FORMATS.includes(format)) {
|
|
229
|
-
acc[cur] = { _id: formData[cur]
|
|
229
|
+
acc[cur] = { _id: formData[cur] };
|
|
230
230
|
}
|
|
231
231
|
if (MULTI_SELECT_FORMATS.includes(format)) {
|
|
232
232
|
acc[cur] = (_d = acc[cur]) === null || _d === void 0 ? void 0 : _d.map((_id) => ({ _id }));
|
|
@@ -95,7 +95,11 @@ export const ImagePreview = (props) => {
|
|
|
95
95
|
setCurrentImg(previewImageList[index]);
|
|
96
96
|
});
|
|
97
97
|
}, [children, index, previewImageList, setCurrentImg]);
|
|
98
|
-
return (_jsxs(_Fragment, { children: [child, visible && (_jsx(Portal, { type: "div", portalContainer: portalContainer, children: _jsx("div", { "data-testid": "portal-container", style: { zIndex: 1010, position: 'relative' }, className: `${classPrefix}-image-preview-container`, children: _jsxs("div", { className: `${classPrefix}-image-mask`,
|
|
98
|
+
return (_jsxs(_Fragment, { children: [child, visible && (_jsx(Portal, { type: "div", portalContainer: portalContainer, children: _jsx("div", { "data-testid": "portal-container", style: { zIndex: 1010, position: 'relative' }, className: `${classPrefix}-image-preview-container`, children: _jsxs("div", { className: `${classPrefix}-image-mask`, onDoubleClick: (e) => {
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
}, onClick: onMaskClick, children: [_jsx("div", { onDoubleClick: (e) => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
}, onClick: (e) => {
|
|
99
103
|
if (isStopPropagation) {
|
|
100
104
|
e.stopPropagation();
|
|
101
105
|
}
|
|
@@ -138,9 +138,11 @@ export const WdModal = forwardRef(function WdModal(props, ref) {
|
|
|
138
138
|
}
|
|
139
139
|
}, children: _jsxs("div", { style: { ...styleList, ...style }, className: classNames(modalBdClasses), onClick: (e) => {
|
|
140
140
|
e.stopPropagation();
|
|
141
|
-
}, children: [_jsx("div", { className: `${classPrefix}-modal-bd__hd`, style: headerFooterStlye, children: props.headerSlot }), _jsx("div", { className: `${classPrefix}-modal-bd__main`, children: props.contentSlot }), _jsx("div", { className: `${classPrefix}-modal-bd__ft ${['confirm', 'notice'].includes(props.template) && platform === 'h5'
|
|
141
|
+
}, children: [props.headerSlot && (_jsx("div", { className: `${classPrefix}-modal-bd__hd`, style: headerFooterStlye, children: props.headerSlot })), props.contentSlot && _jsx("div", { className: `${classPrefix}-modal-bd__main`, children: props.contentSlot }), props.footerSlot && (_jsx("div", { className: `${classPrefix}-modal-bd__ft ${['confirm', 'notice'].includes(props.template) && platform === 'h5'
|
|
142
142
|
? `${classPrefix}-modal-bd__ft-text-btn`
|
|
143
|
-
: ''} ${props.template === 'notice' && platform === 'h5'
|
|
143
|
+
: ''} ${props.template === 'notice' && platform === 'h5'
|
|
144
|
+
? `${classPrefix}-modal-bd__ft-text-btn--vertical`
|
|
145
|
+
: ''}`, style: headerFooterStlye, children: props.footerSlot }))] }) })] }));
|
|
144
146
|
};
|
|
145
147
|
return (_jsx("div", { id: id, className: classNames(classes, className), style: { display: (style === null || style === void 0 ? void 0 : style.display) || 'block' }, "data-testid": "wd-modal-test", children: maskPreToShow && renderNode() }));
|
|
146
148
|
});
|
|
@@ -26,5 +26,5 @@ export const WdRichText = forwardRef(function WdRichText(props, ref) {
|
|
|
26
26
|
};
|
|
27
27
|
if (!visible)
|
|
28
28
|
return null;
|
|
29
|
-
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, {
|
|
29
|
+
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, { events: events, acceptTypes: acceptTypes, maxSize: maxSize, readOnly: readOnly, disabled: disabled, value: value, decorator: null, onChange: onChange, id: props.id, storageType: storageType }) }));
|
|
30
30
|
});
|
|
@@ -10,6 +10,7 @@ import StatusContent from '../../../statusContent';
|
|
|
10
10
|
import classNames from '../../../../utils/classnames';
|
|
11
11
|
import { setTableHeaderStyle } from './util';
|
|
12
12
|
import { orderByFieldKey } from '../../utils/index';
|
|
13
|
+
import { FormFieldProvider } from '../../../wd-form/contexts/form-field-context';
|
|
13
14
|
const { LoadingTip } = StatusTip;
|
|
14
15
|
const defaultTotal = 0;
|
|
15
16
|
const pageIndexSpan = 1;
|
|
@@ -179,7 +180,8 @@ export const BaseTableCom = ({ events, recordKey, className, columns, setColumns
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
if (shouldShowBottomTip) {
|
|
182
|
-
|
|
183
|
+
// 表格底部插槽内的表单组件,非标准数组字段,不受表格控制
|
|
184
|
+
return (_jsx(FormFieldProvider, { setFieldValue: () => { }, getFieldValue: () => { }, children: bottomTip }));
|
|
183
185
|
}
|
|
184
186
|
return null;
|
|
185
187
|
};
|
|
@@ -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 } from 'react';
|
|
3
|
+
import { useRef, useEffect, useState, useMemo, forwardRef, memo, useCallback } from 'react';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
5
|
import { ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandleByApi, exportHandle, FilterFieldsPanel, ToolBar, } from './components';
|
|
6
6
|
import { TableWithForm } from './table-with-form';
|
|
@@ -63,7 +63,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
63
63
|
// 以下为非标准属性,config中没有
|
|
64
64
|
// isOrderBy, // API是否支持排序(旧的表格有该属性)
|
|
65
65
|
isMock = false, //是否mock数据
|
|
66
|
-
enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText = '暂无数据', dataSourceData, //绑定表达式时的表格数据
|
|
66
|
+
enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText = '暂无数据', dataSourceData = [], //绑定表达式时的表格数据
|
|
67
67
|
recordKey: _recordKey = '_id', // 数据主键
|
|
68
68
|
total: _total, // 表格总条数
|
|
69
69
|
enableTotal = false, //是否开启动态分页
|
|
@@ -75,7 +75,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
75
75
|
isSupportMultipleSort = false, // 是否支持多字段排序
|
|
76
76
|
sorter, // 排序规则
|
|
77
77
|
__innerSlot, enableRelationTag = true, // 关联关系字段是否开启关联标签
|
|
78
|
-
enableBottomTipSlot = false, row__bottom__slot, ...props } = tableProps;
|
|
78
|
+
enableBottomTipSlot = false, row__bottom__slot, rowDisabled, ...props } = tableProps;
|
|
79
79
|
const wList = convertWhere(props, supportManyRelated); // 查询参数
|
|
80
80
|
const { classPrefix } = useConfig();
|
|
81
81
|
const platform = usePlatform();
|
|
@@ -123,10 +123,6 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
123
123
|
// 移动端操作按钮弹窗
|
|
124
124
|
const [isMobileOptionVisible, setIsMobileOptionVisible] = useState(false);
|
|
125
125
|
const modalRef = useRef(null);
|
|
126
|
-
const dataRef = useRef({
|
|
127
|
-
dataSourceData: [],
|
|
128
|
-
tableRecords: [],
|
|
129
|
-
});
|
|
130
126
|
const { enumOptions } = useEnumContext();
|
|
131
127
|
const dataSourceAPI = useMemo(() => new DataSource(dbName), [dbName]); // datasource 方法-模型
|
|
132
128
|
// 插槽属性
|
|
@@ -332,7 +328,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
332
328
|
};
|
|
333
329
|
const isTableLoading = getLoadingStatus();
|
|
334
330
|
// 表格数据
|
|
335
|
-
const mapTableData = () => {
|
|
331
|
+
const mapTableData = useCallback(() => {
|
|
336
332
|
if (isMock) {
|
|
337
333
|
return Mock.records;
|
|
338
334
|
}
|
|
@@ -354,8 +350,21 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
354
350
|
mapTableDataWithView(viewFieldsData, tableData);
|
|
355
351
|
}
|
|
356
352
|
return tableData;
|
|
357
|
-
|
|
358
|
-
|
|
353
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
354
|
+
}, [
|
|
355
|
+
dataSourceData,
|
|
356
|
+
exprLoading,
|
|
357
|
+
isExpression,
|
|
358
|
+
isH5,
|
|
359
|
+
isMock,
|
|
360
|
+
isNoDataSourceBind,
|
|
361
|
+
isTableLoading,
|
|
362
|
+
queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex,
|
|
363
|
+
tableData,
|
|
364
|
+
]);
|
|
365
|
+
const tableRecords = useMemo(() => {
|
|
366
|
+
return mapTableData();
|
|
367
|
+
}, [mapTableData]);
|
|
359
368
|
// 总数
|
|
360
369
|
let total = isExpression ? tableRecords === null || tableRecords === void 0 ? void 0 : tableRecords.length : tableTotal;
|
|
361
370
|
if (enableTotal && isExpression && !isNaN(parseInt(`${_total}`))) {
|
|
@@ -365,17 +374,6 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
365
374
|
setSelectedKeys([]);
|
|
366
375
|
setSelectedRecords([]);
|
|
367
376
|
}, [_recordKey]);
|
|
368
|
-
useEffect(() => {
|
|
369
|
-
var _a, _b;
|
|
370
|
-
if (isExpression &&
|
|
371
|
-
Array.isArray(dataSourceData) &&
|
|
372
|
-
!isObjectEqual((_a = dataRef === null || dataRef === void 0 ? void 0 : dataRef.current) === null || _a === void 0 ? void 0 : _a.dataSourceData, dataSourceData)) {
|
|
373
|
-
dataRef.current.dataSourceData = [...dataSourceData];
|
|
374
|
-
}
|
|
375
|
-
if (!isObjectEqual((_b = dataRef === null || dataRef === void 0 ? void 0 : dataRef.current) === null || _b === void 0 ? void 0 : _b.tableRecords, tableRecords)) {
|
|
376
|
-
dataRef.current.tableRecords = [...tableRecords];
|
|
377
|
-
}
|
|
378
|
-
}, [dataSourceData, tableRecords, isExpression]);
|
|
379
377
|
const beforeModalDestroy = () => {
|
|
380
378
|
// 重新加载数据
|
|
381
379
|
refreshTable();
|
|
@@ -557,7 +555,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
557
555
|
onSelectChange([], {}, true);
|
|
558
556
|
return;
|
|
559
557
|
}
|
|
560
|
-
const recordsMap = new Map(
|
|
558
|
+
const recordsMap = new Map(tableRecords.map((item) => [item[recordKey], item]));
|
|
561
559
|
const records = (_b = (_a = params === null || params === void 0 ? void 0 : params.selectedKeys) === null || _a === void 0 ? void 0 : _a.map((key) => recordsMap.get(key))) === null || _b === void 0 ? void 0 : _b.filter(Boolean);
|
|
562
560
|
const context = { record: records, selectedRecords: records };
|
|
563
561
|
const validSelectedKeys = (records === null || records === void 0 ? void 0 : records.map((record) => record[recordKey])) || [];
|
|
@@ -565,8 +563,8 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
565
563
|
},
|
|
566
564
|
// 当前页数据
|
|
567
565
|
records: isExpression && !enableTotal && enablePagination
|
|
568
|
-
? getCurrentPageData(
|
|
569
|
-
:
|
|
566
|
+
? getCurrentPageData(tableRecords, query.pageNo, query.pageSize)
|
|
567
|
+
: tableRecords,
|
|
570
568
|
// 当前总数
|
|
571
569
|
total: total,
|
|
572
570
|
pageNo: query.pageNo,
|
|
@@ -578,7 +576,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
578
576
|
columnSets,
|
|
579
577
|
defaultPageSize,
|
|
580
578
|
defaultPageIndex,
|
|
581
|
-
dataSourceData
|
|
579
|
+
dataSourceData,
|
|
582
580
|
sort: supportManyRelated ? query.orderBy : [{ orderBy: query.orderBy, orderType: query.orderType }],
|
|
583
581
|
filter: supportManyRelated ? query.filter : query === null || query === void 0 ? void 0 : query.where,
|
|
584
582
|
dataSourceVersion: supportManyRelated ? 'v2' : 'v1',
|
|
@@ -592,7 +590,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
592
590
|
isH5,
|
|
593
591
|
isModel,
|
|
594
592
|
selectedKeys,
|
|
595
|
-
|
|
593
|
+
tableRecords,
|
|
596
594
|
total,
|
|
597
595
|
query.pageNo,
|
|
598
596
|
query.pageSize,
|
|
@@ -601,7 +599,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
601
599
|
bindMetadata,
|
|
602
600
|
defaultPageSize,
|
|
603
601
|
defaultPageIndex,
|
|
604
|
-
|
|
602
|
+
dataSourceData,
|
|
605
603
|
selectedRecords,
|
|
606
604
|
query === null || query === void 0 ? void 0 : query.orderBy,
|
|
607
605
|
query === null || query === void 0 ? void 0 : query.orderType,
|
|
@@ -738,7 +736,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
738
736
|
pageIndex: 1,
|
|
739
737
|
}));
|
|
740
738
|
}
|
|
741
|
-
events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues });
|
|
739
|
+
events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues, filterConfig });
|
|
742
740
|
};
|
|
743
741
|
const errorStatus = isError || fieldsError;
|
|
744
742
|
const errorMsg = isError ? errorObj : fieldsError;
|
|
@@ -747,7 +745,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
747
745
|
setOpenMobileFilter(true);
|
|
748
746
|
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 && (enablePagination || enableRefreshBtn || enableTableHeightSizeBtn || hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
749
747
|
setOpenMobileFilter(true);
|
|
750
|
-
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(TableWithForm, { ref: ref, 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: visibleColumns, 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, bottomTip: row__bottom__slot, enableBottomTipSlot: enableBottomTipSlot, componentType: "table" }), 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: {
|
|
748
|
+
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(TableWithForm, { ref: ref, 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: visibleColumns, 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, bottomTip: row__bottom__slot, enableBottomTipSlot: enableBottomTipSlot, componentType: "table", rowDisabled: rowDisabled }), 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: {
|
|
751
749
|
close: () => {
|
|
752
750
|
setIsMobileOptionVisible(false);
|
|
753
751
|
},
|
|
@@ -64,8 +64,8 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
64
64
|
300);
|
|
65
65
|
// 渲染菜单
|
|
66
66
|
const RenderTabItem = (index, item) => {
|
|
67
|
-
return (_jsxs("div", { className: `${classPrefix}-tabs__item ${(item === null || item === void 0 ? void 0 : item.selected) ? 'is-selected' : ''} ${(item === null || item === void 0 ? void 0 : item.isDisabled) ? 'is-disabled' : ''}`, onClick: () => {
|
|
68
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
67
|
+
return (_jsxs("div", { className: `${classPrefix}-tabs__item ${(item === null || item === void 0 ? void 0 : item.selected) ? 'is-selected' : ''} ${(item === null || item === void 0 ? void 0 : item.isDisabled) ? 'is-disabled' : ''}`, onClick: (e) => {
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
69
69
|
if (!(item === null || item === void 0 ? void 0 : item.isDisabled) && !(item === null || item === void 0 ? void 0 : item.selected)) {
|
|
70
70
|
if (restProps.direction !== 'vertical') {
|
|
71
71
|
const parentWidths = (_b = (_a = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.clientWidth;
|
|
@@ -93,6 +93,7 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
93
93
|
$node.current._getInstanceRef().current.selectedValue = currentSelectedValue;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
(_q = restProps === null || restProps === void 0 ? void 0 : restProps.events) === null || _q === void 0 ? void 0 : _q.tap({}, { originEvent: e });
|
|
96
97
|
debouncedChangeEvent({ value: item === null || item === void 0 ? void 0 : item.value });
|
|
97
98
|
}
|
|
98
99
|
}, children: [(item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'prefix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null, _jsx("div", { className: `${classPrefix}-tabs__item-text`, children: item === null || item === void 0 ? void 0 : item.label }), (item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'suffix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null] }));
|
|
@@ -108,5 +109,7 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
108
109
|
const showRightMask = Math.round(scrollLeft + parentWidth) < scrollWidth;
|
|
109
110
|
setShowRightMask(showRightMask);
|
|
110
111
|
}
|
|
111
|
-
}, children: tabsDatas === null || tabsDatas === void 0 ? void 0 : tabsDatas.map((item, index) => RenderTabItem(index, item)) }), showMask && restProps.direction !== 'vertical' && (_jsx("div", { className: `${classPrefix}-tabs__header-item-mask`, style: { opacity: `${showRightMask ? '1' : '0'}` } }))] }) }), _jsx("div", { className: `${classPrefix}-tabs__body`,
|
|
112
|
+
}, children: tabsDatas === null || tabsDatas === void 0 ? void 0 : tabsDatas.map((item, index) => RenderTabItem(index, item)) }), showMask && restProps.direction !== 'vertical' && (_jsx("div", { className: `${classPrefix}-tabs__header-item-mask`, style: { opacity: `${showRightMask ? '1' : '0'}` } }))] }) }), _jsx("div", { className: `${classPrefix}-tabs__body`, onClick: (e) => {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
}, children: _jsx("div", { className: `${classPrefix}-tabs__body-content`, children: renderSlot({ ...restProps, selectedTab, tabsDatas, isMultipleSlot }) }) })] }));
|
|
112
115
|
};
|
|
@@ -65,8 +65,8 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
65
65
|
300);
|
|
66
66
|
// 渲染菜单
|
|
67
67
|
const RenderTabItem = (index, item) => {
|
|
68
|
-
return (_jsxs("div", { className: `${classPrefix}-tabs__item ${(item === null || item === void 0 ? void 0 : item.selected) ? 'is-selected' : ''} ${(item === null || item === void 0 ? void 0 : item.isDisabled) ? 'is-disabled' : ''}`, onClick: () => {
|
|
69
|
-
var _a, _b, _c, _d, _e, _f;
|
|
68
|
+
return (_jsxs("div", { className: `${classPrefix}-tabs__item ${(item === null || item === void 0 ? void 0 : item.selected) ? 'is-selected' : ''} ${(item === null || item === void 0 ? void 0 : item.isDisabled) ? 'is-disabled' : ''}`, onClick: (e) => {
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
70
70
|
if (!(item === null || item === void 0 ? void 0 : item.isDisabled) && !(item === null || item === void 0 ? void 0 : item.selected)) {
|
|
71
71
|
if (restProps.direction !== 'vertical') {
|
|
72
72
|
const parentWidths = (_b = (_a = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.clientWidth;
|
|
@@ -95,6 +95,7 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
95
95
|
$node.current._getInstanceRef().current.selectedValue = currentSelectedValue;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
(_g = restProps === null || restProps === void 0 ? void 0 : restProps.events) === null || _g === void 0 ? void 0 : _g.tap({}, { originEvent: e });
|
|
98
99
|
debouncedChangeEvent({ value: item === null || item === void 0 ? void 0 : item.value });
|
|
99
100
|
}
|
|
100
101
|
}, children: [(item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'prefix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null, _jsx("div", { className: `${classPrefix}-tabs__item-text`, children: item === null || item === void 0 ? void 0 : item.label }), (item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'suffix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null] }));
|
|
@@ -115,5 +116,7 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
115
116
|
index: position.index + Number('1'),
|
|
116
117
|
offset: result,
|
|
117
118
|
});
|
|
118
|
-
} }))] }), _jsx("div", { className: `${classPrefix}-tabs__body`,
|
|
119
|
+
} }))] }), _jsx("div", { className: `${classPrefix}-tabs__body`, onClick: (e) => {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
}, children: _jsx("div", { className: `${classPrefix}-tabs__body-content`, children: renderSlot({ ...restProps, selectedTab, tabsDatas, isMultipleSlot }) }) })] }));
|
|
119
122
|
};
|
|
@@ -14,10 +14,6 @@ export const WdTabs = (props) => {
|
|
|
14
14
|
setIndex(val);
|
|
15
15
|
};
|
|
16
16
|
return (_jsx("div", { "data-testid": "wd-tabs", className: `${classPrefix}-tabs-root ${props.direction === 'vertical'
|
|
17
|
-
? `${classPrefix}-tabs--vertical ${classPrefix}-side-tab-root ${isH5
|
|
18
|
-
|
|
19
|
-
: `${classPrefix}-pc-side-tab-root`}`
|
|
20
|
-
: `${classPrefix}-top-tab-root ${isH5
|
|
21
|
-
? `${classPrefix}-h5-top-tab-root`
|
|
22
|
-
: `${classPrefix}-pc-top-tab-root`}`} ${isH5 ? `${classPrefix}-tabs-h5-root` : ''} ${props === null || props === void 0 ? void 0 : props.className}`, style: props === null || props === void 0 ? void 0 : props.style, onClick: (e) => { var _a; return (_a = props === null || props === void 0 ? void 0 : props.events) === null || _a === void 0 ? void 0 : _a.tap({}, { originEvent: e }); }, children: !isH5 ? (_jsx(WdTabsPc, { getIndex: getIndex, ...props })) : (_jsx(WdTabsH5, { getIndex: getIndex, ...props })) }));
|
|
17
|
+
? `${classPrefix}-tabs--vertical ${classPrefix}-side-tab-root ${isH5 ? `${classPrefix}-h5-side-tab-root` : `${classPrefix}-pc-side-tab-root`}`
|
|
18
|
+
: `${classPrefix}-top-tab-root ${isH5 ? `${classPrefix}-h5-top-tab-root` : `${classPrefix}-pc-top-tab-root`}`} ${isH5 ? `${classPrefix}-tabs-h5-root` : ''} ${props === null || props === void 0 ? void 0 : props.className}`, style: props === null || props === void 0 ? void 0 : props.style, children: !isH5 ? _jsx(WdTabsPc, { getIndex: getIndex, ...props }) : _jsx(WdTabsH5, { getIndex: getIndex, ...props }) }));
|
|
23
19
|
};
|
|
@@ -148,8 +148,8 @@ declare const getTreeInfo: (params: IFindNodeParams, checkable: boolean) => {
|
|
|
148
148
|
expandedtate?: boolean;
|
|
149
149
|
expanded: string[];
|
|
150
150
|
event: string;
|
|
151
|
-
checked: string[];
|
|
152
151
|
selected: string[];
|
|
152
|
+
checked: string[];
|
|
153
153
|
currentNode: {
|
|
154
154
|
data?: {
|
|
155
155
|
label: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { alertErrorMessage } from '../../utils/platform';
|
|
3
3
|
// ! reference in src/web/components/richTextView/index.tsx
|
|
4
4
|
export const getOnClick = (props) => {
|
|
5
|
-
const { url, options, events } = props;
|
|
5
|
+
const { url, options, events, simulatingAnchorScrolling = true } = props;
|
|
6
6
|
const isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i);
|
|
7
7
|
return async (e) => {
|
|
8
8
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -16,7 +16,7 @@ export const getOnClick = (props) => {
|
|
|
16
16
|
const targetId = url.split('#')[1];
|
|
17
17
|
const target = document.getElementById(targetId) || ((_g = document.getElementsByName(targetId)) === null || _g === void 0 ? void 0 : _g[0]);
|
|
18
18
|
// hash路由下模拟锚点滚动
|
|
19
|
-
if (isHashRouter && target &&
|
|
19
|
+
if (isHashRouter && target && simulatingAnchorScrolling) {
|
|
20
20
|
if ((isOrigin && isHashLink) || url.startsWith('#')) {
|
|
21
21
|
if (!e.defaultPrevented) {
|
|
22
22
|
e.preventDefault();
|
|
@@ -7,12 +7,16 @@ import UploaderFile from '../form/uploaderFile';
|
|
|
7
7
|
import { emptyObject } from '../../utils/constant';
|
|
8
8
|
import { convertSingleValue } from '../../utils/tool';
|
|
9
9
|
import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
|
|
10
|
+
import { useTranslation } from '../../utils/i18n/translation';
|
|
10
11
|
import './style';
|
|
11
12
|
/**
|
|
12
13
|
* 文件上传-标准化
|
|
13
14
|
*/
|
|
14
15
|
export const WdUploadFile = forwardRef(function WdUploadFile(props, ref) {
|
|
15
|
-
const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText
|
|
16
|
+
const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText: _uploadButtonText, uploadTipText: _uploadTipText, storageType = 'cloudID', } = props;
|
|
17
|
+
const t = useTranslation();
|
|
18
|
+
const uploadButtonText = _uploadButtonText !== null && _uploadButtonText !== void 0 ? _uploadButtonText : t.clickToUpload;
|
|
19
|
+
const uploadTipText = _uploadTipText !== null && _uploadTipText !== void 0 ? _uploadTipText : t.supportBatchUpload;
|
|
16
20
|
const acceptTypes = useMemo(() => convertAcceptTypes(_acceptTypes), [_acceptTypes]);
|
|
17
21
|
// 强制转换初始值
|
|
18
22
|
const initRef = useRef(false);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { WdConfigContext, DEFAULT_CLASS_PREFIX, } from '../../components/wd-config-provider/wd-config-context';
|
|
2
|
+
import { WdConfigContext, DEFAULT_CLASS_PREFIX, DEFAULT_LOCALE, } from '../../components/wd-config-provider/wd-config-context';
|
|
3
3
|
export function useConfig() {
|
|
4
4
|
const context = useContext(WdConfigContext) || {};
|
|
5
5
|
return {
|
|
6
6
|
classPrefix: DEFAULT_CLASS_PREFIX,
|
|
7
|
+
locale: DEFAULT_LOCALE,
|
|
7
8
|
...context,
|
|
8
9
|
};
|
|
9
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTranslation } from './translation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTranslation } from './translation';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
locale: string;
|
|
3
|
+
okText: string;
|
|
4
|
+
cancelText: string;
|
|
5
|
+
loadingText: string;
|
|
6
|
+
loadErrorText: string;
|
|
7
|
+
loadRetryText: string;
|
|
8
|
+
closeText: string;
|
|
9
|
+
helpText: string;
|
|
10
|
+
cleanText: string;
|
|
11
|
+
resetText: string;
|
|
12
|
+
searchText: string;
|
|
13
|
+
emptyText: string;
|
|
14
|
+
selectAllText: string;
|
|
15
|
+
paginationRecordCount: (count: any) => JSX.Element;
|
|
16
|
+
paginationPrevPage: string;
|
|
17
|
+
paginationNextPage: string;
|
|
18
|
+
paginationToFirstPage: string;
|
|
19
|
+
paginationToLastPage: string;
|
|
20
|
+
paginationAtFirst: string;
|
|
21
|
+
paginationAtLast: string;
|
|
22
|
+
paginationRecordPerPage: string;
|
|
23
|
+
paginationPageCount: (count: any) => string;
|
|
24
|
+
pleaseSelect: string;
|
|
25
|
+
foundText: string;
|
|
26
|
+
foundManyText: (count: any) => string;
|
|
27
|
+
foundManyTextWithKeyword: (keyword: any, count: any) => string;
|
|
28
|
+
foundNothingWithKeyword: (keyword: any) => string;
|
|
29
|
+
clearResultText: string;
|
|
30
|
+
tagSearchBoxTips: string;
|
|
31
|
+
tagSearchBoxEditingTips: string;
|
|
32
|
+
tagSearchBoxSelectTitle: string;
|
|
33
|
+
today: string;
|
|
34
|
+
curMonth: string;
|
|
35
|
+
prevMonth: string;
|
|
36
|
+
nextMonth: string;
|
|
37
|
+
curYear: string;
|
|
38
|
+
prevYear: string;
|
|
39
|
+
nextYear: string;
|
|
40
|
+
curTwentyYears: string;
|
|
41
|
+
prevTwentyYears: string;
|
|
42
|
+
nextTwentyYears: string;
|
|
43
|
+
monthBeforeYear: boolean;
|
|
44
|
+
yearFormat: string;
|
|
45
|
+
selectTime: string;
|
|
46
|
+
startTime: string;
|
|
47
|
+
endTime: string;
|
|
48
|
+
selectDate: string;
|
|
49
|
+
guideCancel: string;
|
|
50
|
+
guideBack: string;
|
|
51
|
+
guideNext: string;
|
|
52
|
+
guideFinish: string;
|
|
53
|
+
copy: string;
|
|
54
|
+
copied: string;
|
|
55
|
+
clickToEnlarge: string;
|
|
56
|
+
expand: string;
|
|
57
|
+
collapse: string;
|
|
58
|
+
recentlyVisited: string;
|
|
59
|
+
member: string;
|
|
60
|
+
department: string;
|
|
61
|
+
directMember: string;
|
|
62
|
+
memberPlaceholder: string;
|
|
63
|
+
memberLabel: string;
|
|
64
|
+
memberSelect: string;
|
|
65
|
+
organization: string;
|
|
66
|
+
selected: string;
|
|
67
|
+
multiple: string;
|
|
68
|
+
departmentLabel: string;
|
|
69
|
+
departmentPlaceholder: string;
|
|
70
|
+
selectDepartment: string;
|
|
71
|
+
noDepartmentData: string;
|
|
72
|
+
pleaseSelectDepartment: string;
|
|
73
|
+
loadingFailed: string;
|
|
74
|
+
noImage: string;
|
|
75
|
+
uploadFile: string;
|
|
76
|
+
clickToUpload: string;
|
|
77
|
+
supportBatchUpload: string;
|
|
78
|
+
fileName: string;
|
|
79
|
+
fileSize: string;
|
|
80
|
+
fileStatus: string;
|
|
81
|
+
fileOperation: string;
|
|
82
|
+
pendingUpload: string;
|
|
83
|
+
uploading: string;
|
|
84
|
+
uploadSuccess: string;
|
|
85
|
+
uploadFailed: string;
|
|
86
|
+
delete: string;
|
|
87
|
+
reupload: string;
|
|
88
|
+
download: string;
|
|
89
|
+
waitingUpload: string;
|
|
90
|
+
fileTotalExceed: string;
|
|
91
|
+
fileTypeError: string;
|
|
92
|
+
fileSizeExceed: string;
|
|
93
|
+
clickTopBtn: string;
|
|
94
|
+
richTextTitle: string;
|
|
95
|
+
richTextPlaceholder: string;
|
|
96
|
+
fileSizeExceedsLimit: string;
|
|
97
|
+
uploadImageFailed: string;
|
|
98
|
+
copySuccess: string;
|
|
99
|
+
fileFormatNotSupported: string;
|
|
100
|
+
headingH1: string;
|
|
101
|
+
headingH2: string;
|
|
102
|
+
headingH3: string;
|
|
103
|
+
headingH4: string;
|
|
104
|
+
headingH5: string;
|
|
105
|
+
headingH6: string;
|
|
106
|
+
normal: string;
|
|
107
|
+
sourceHanSans: string;
|
|
108
|
+
richTextErrorMessage: string;
|
|
109
|
+
batchSelect: string;
|
|
110
|
+
unrelatedUser: string;
|
|
111
|
+
unselectedMembers: string;
|
|
112
|
+
unselectedDepartments: string;
|
|
113
|
+
noMoreData: string;
|
|
114
|
+
noSelectableMembers: string;
|
|
115
|
+
noRelated: string;
|
|
116
|
+
noSelectable: string;
|
|
117
|
+
uploadImage: string;
|
|
118
|
+
};
|
|
119
|
+
export default _default;
|