@cloudbase/weda-ui 3.13.1 → 3.13.3
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-select-multiple.d.ts +0 -9
- package/dist/configs/components/wd-select-multiple.js +1 -6
- package/dist/configs/components/wd-upload-image.d.ts +7 -2
- package/dist/configs/components/wd-upload-image.js +40 -6
- package/dist/configs/index.d.ts +14 -22
- package/dist/configs/type-utils/classes.js +1 -1
- package/dist/configs/type-utils/type-form.js +6 -6
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/echart/echart.js +3 -4
- package/dist/web/components/form/uploader/uploader.h5.js +14 -17
- package/dist/web/components/form/uploader/uploader.pc.js +3 -3
- package/dist/web/components/wd-location/wd-location.css +7 -10
- package/dist/web/components/wd-location/wd-location.js +4 -0
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +8 -3
- package/dist/web/components/wd-select/select/selectUI.js +1 -1
- package/dist/web/components/wd-select/wd-select.css +12 -22
- package/dist/web/components/wd-table/components/FieldRender/index.d.ts +3 -3
- package/dist/web/components/wd-table/components/FieldRender/index.js +31 -46
- package/dist/web/components/wd-table/hooks/useChooseList.d.ts +2 -1
- package/dist/web/components/wd-table/hooks/useChooseList.js +15 -3
- package/dist/web/utils/moment.js +3 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, forwardRef, useImperativeHandle, useState, useCallback, useEffect
|
|
2
|
+
import { useRef, forwardRef, useImperativeHandle, useState, useCallback, useEffect } from 'react';
|
|
3
3
|
import { useEventListener, useResizeObserver } from '@react-hookz/web';
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import { useConfig } from '../../utils/config-context';
|
|
@@ -9,8 +9,7 @@ let Echarts = null;
|
|
|
9
9
|
const getEchartInstance = async () => {
|
|
10
10
|
if (ReactEcharts && Echarts)
|
|
11
11
|
return ReactEcharts;
|
|
12
|
-
const { default: _ } = await import(
|
|
13
|
-
/* webpackChunkName: "echarts-for-react" */ 'echarts-for-react');
|
|
12
|
+
const { default: _ } = await import(/* webpackChunkName: "echarts-for-react" */ 'echarts-for-react');
|
|
14
13
|
Echarts = await import(/* webpackChunkName: "echarts" */ 'echarts');
|
|
15
14
|
ReactEcharts = _;
|
|
16
15
|
};
|
|
@@ -102,5 +101,5 @@ export const Echart = forwardRef(function Echart(props, ref) {
|
|
|
102
101
|
click,
|
|
103
102
|
dblclick,
|
|
104
103
|
};
|
|
105
|
-
return (_jsx("div", { id: id, style: { width: '100%', ...style }, ref: domRef, "data-testid": "wd-chart-test", children: init && (_jsx(ReactEcharts, {
|
|
104
|
+
return (_jsx("div", { id: id, className: classNames(classes, className), style: { width: '100%', ...style }, ref: domRef, "data-testid": "wd-chart-test", children: init && (_jsx(ReactEcharts, { option: props.option || {}, theme: themeState || (props.dark ? 'dark' : 'auto'), opts: props.opts, onChartReady: onChartReadyCallback, onEvents: onEvents })) }));
|
|
106
105
|
});
|
|
@@ -40,9 +40,7 @@ export function ImageUploaderH5(props) {
|
|
|
40
40
|
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value, isDelete });
|
|
41
41
|
};
|
|
42
42
|
const accepts = React.useMemo(() => {
|
|
43
|
-
return acceptTypes.length === 0
|
|
44
|
-
? IMAGE_TYPES
|
|
45
|
-
: Array.from(new Set(acceptTypes));
|
|
43
|
+
return acceptTypes.length === 0 ? IMAGE_TYPES : Array.from(new Set(acceptTypes));
|
|
46
44
|
}, [acceptTypes]);
|
|
47
45
|
const showAdd = React.useMemo(() => {
|
|
48
46
|
if (single) {
|
|
@@ -92,8 +90,7 @@ export function ImageUploaderH5(props) {
|
|
|
92
90
|
if (typeof ret === 'boolean') {
|
|
93
91
|
shouldUploadToCos = ret;
|
|
94
92
|
}
|
|
95
|
-
else if (Array.isArray(ret) &&
|
|
96
|
-
ret.every((item) => item instanceof File)) {
|
|
93
|
+
else if (Array.isArray(ret) && ret.every((item) => item instanceof File)) {
|
|
97
94
|
files = ret;
|
|
98
95
|
}
|
|
99
96
|
else if (!isNil(ret)) {
|
|
@@ -114,15 +111,15 @@ export function ImageUploaderH5(props) {
|
|
|
114
111
|
const allFile = await upload(files);
|
|
115
112
|
handleChange(allFile);
|
|
116
113
|
};
|
|
117
|
-
return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsx("div", { className: "weui-uploader__bd", children: _jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(_a = (tempFile !== null && tempFile !== void 0 ? tempFile : [])) === null || _a === void 0 ? void 0 : _a.map((f) => (_jsx(SingleImage, { tempFile: f, deleteBySrc: deleteFile, disabled: disabled || readOnly || sourceType === 'album', imgTypeCls: imgTypeCls }, f === null || f === void 0 ? void 0 : f.key))), tempFile.length < 1 && readOnly && _jsx(_Fragment, { children: "-" }), showAdd && !readOnly && (_jsx("li", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled &&
|
|
115
|
+
sourceType !== 'album' &&
|
|
116
|
+
(sourceType === 'camera' ? (_jsx("input", { ref: inputRef, onClick: () => {
|
|
117
|
+
inputRef.current && (inputRef.current.value = '');
|
|
118
|
+
}, "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), capture: true, onChange: uploadChange })) : (_jsx("input", { ref: inputRef, onClick: () => {
|
|
119
|
+
inputRef.current && (inputRef.current.value = '');
|
|
120
|
+
}, "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), onChange: uploadChange }))) }))] }) })] }) }));
|
|
124
121
|
}
|
|
125
|
-
function SingleImage({ deleteBySrc, disabled, imgTypeCls, tempFile
|
|
122
|
+
function SingleImage({ deleteBySrc, disabled, imgTypeCls, tempFile }) {
|
|
126
123
|
const { progress, loading, realUrl, tempUrl } = tempFile;
|
|
127
124
|
const cls = classNames({
|
|
128
125
|
'weui-uploader__file': true,
|
|
@@ -149,11 +146,11 @@ function SingleImage({ deleteBySrc, disabled, imgTypeCls, tempFile, }) {
|
|
|
149
146
|
},
|
|
150
147
|
});
|
|
151
148
|
};
|
|
152
|
-
return (_jsxs("li", { className: `${cls} ${imgTypeCls}`, style: imgStyle, onClick: showGallery, "data-testid": "uploaderh5_imgStyle", children: [error || status ? (_jsx("div", { className: "weui-uploader__file-content", children: error ? (_jsx("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (_jsx("i", { className: `weui-loading ${imgTypeCls}`, style: { width: 30, height: 30 } })) })) : (false), loading &&
|
|
149
|
+
return (_jsxs("li", { className: `${cls} ${imgTypeCls}`, style: imgStyle, onClick: showGallery, "data-testid": "uploaderh5_imgStyle", children: [error || status ? (_jsx("div", { className: "weui-uploader__file-content", children: error ? (_jsx("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (_jsx("i", { className: `weui-loading ${imgTypeCls}`, style: { width: 30, height: 30 } })) })) : (false), loading && _jsxs("div", { className: "weui-uploader__file-progress", children: [progress, "%"] })] }));
|
|
153
150
|
}
|
|
154
|
-
const UploaderLabel = ({ layout, label, currentCount, maxCount, requiredFlag, labelVisible
|
|
151
|
+
const UploaderLabel = ({ layout, label, currentCount, maxCount, requiredFlag, labelVisible }) => {
|
|
155
152
|
if (layout === 'horizontal') {
|
|
156
|
-
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsx("div", { className: "weda-formcells__label weui-cell", children: _jsxs("div", { children: [requiredFlag &&
|
|
153
|
+
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsx("div", { className: "weda-formcells__label weui-cell", children: _jsxs("div", { children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] }) })) }) }));
|
|
157
154
|
}
|
|
158
|
-
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [requiredFlag &&
|
|
155
|
+
return (_jsx(React.Fragment, { children: _jsx(_Fragment, { children: labelVisible && (_jsxs("div", { className: "weda-formcells__label weui-cell", children: [_jsxs("div", { className: "weui-uploader__label", children: [requiredFlag && _jsx("label", { className: "weda-formcells__flag", children: "*" }), _jsx("p", { className: "weui-uploader__title", children: label })] }), _jsxs("div", { className: "weui-uploader__info", children: [_jsx("span", { id: "uploadCount", children: currentCount }), "/", maxCount] })] })) }) }));
|
|
159
156
|
};
|
|
@@ -118,16 +118,16 @@ export function UploaderPCInner(props) {
|
|
|
118
118
|
tips && (extraProps['title'] = tips);
|
|
119
119
|
maxSize && (extraProps['maxSize'] = maxSize * 1024 * 1024);
|
|
120
120
|
const hasActions = !uploading && !readOnly && !(disabled || sourceType === 'camera');
|
|
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("
|
|
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("div", { className: `_weda-fn-upload-result__item wedatea2td-disabled weda-uploader-btn__box ${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)) &&
|
|
122
122
|
!readOnly && (
|
|
123
123
|
// single 模式时,当数组为空且不在上传文件过程中时显示
|
|
124
|
-
_jsx(Upload, { ...extraProps, beforeUpload: beforeHandle, children: _jsxs("
|
|
124
|
+
_jsx(Upload, { ...extraProps, beforeUpload: beforeHandle, children: _jsxs("div", {
|
|
125
125
|
// className={"_weda-fn-upload-result__item _weda-fn-upload-result__item--upload" imgTypeCls}
|
|
126
126
|
// className={classNames(
|
|
127
127
|
// `_weda-fn-upload-result__item _weda-fn-upload-result__item--upload`,
|
|
128
128
|
// imgTypeCls
|
|
129
129
|
// )}
|
|
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 })] })] }) })))] })] }) }));
|
|
130
|
+
className: `_weda-fn-upload-result__item weda-uploader-btn__box _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 })] })] }) })))] })] }) }));
|
|
131
131
|
}
|
|
132
132
|
export const TcbImage = (props) => {
|
|
133
133
|
const { fileID, tempFile = { progress: 100, loading: false, realUrl: null, tempUrl: null }, isZoom, imgTypeCls, previewIcon, actions, allFile = [], index, portalContainer, ...rest } = props;
|
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
width: 100% !important;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.wd-form-item.wd-pc-location-root
|
|
27
|
-
._weda-fn-map
|
|
28
|
-
.weda-fn-map__local_loc_btn_left {
|
|
26
|
+
.wd-form-item.wd-pc-location-root ._weda-fn-map .weda-fn-map__local_loc_btn_left {
|
|
29
27
|
margin: 0;
|
|
30
28
|
line-height: 1;
|
|
31
29
|
}
|
|
@@ -36,15 +34,10 @@
|
|
|
36
34
|
margin-top: 0;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
.wd-form-item.wd-pc-location-root
|
|
40
|
-
._weda-fn-map
|
|
41
|
-
.wedatea2td-justify-grid__col--right {
|
|
37
|
+
.wd-form-item.wd-pc-location-root ._weda-fn-map .wedatea2td-justify-grid__col--right {
|
|
42
38
|
position: unset;
|
|
43
39
|
}
|
|
44
|
-
.wd-form-item.wd-pc-location-root
|
|
45
|
-
._weda-fn-map
|
|
46
|
-
.wedatea2td-justify-grid__col--right
|
|
47
|
-
input {
|
|
40
|
+
.wd-form-item.wd-pc-location-root ._weda-fn-map .wedatea2td-justify-grid__col--right input {
|
|
48
41
|
width: 75px;
|
|
49
42
|
}
|
|
50
43
|
|
|
@@ -55,3 +48,7 @@
|
|
|
55
48
|
.form-location-con__text.wd-btn--link:hover:not(.is-disabled) {
|
|
56
49
|
text-decoration: none;
|
|
57
50
|
}
|
|
51
|
+
|
|
52
|
+
.wd-form-item.showMap .wd-form-input-wrap.size-height-md {
|
|
53
|
+
height: auto;
|
|
54
|
+
}
|
|
@@ -3,6 +3,7 @@ import { forwardRef, useCallback, useMemo, useState } from 'react';
|
|
|
3
3
|
import { useHandleClear } from '../../utils/hooks/useFormLegacy';
|
|
4
4
|
import { useFormInputTrait } from '../../components/form-input-hooks';
|
|
5
5
|
import { WdFormItem, WdInputGroup, WdInputWrap } from '../wd-form-item';
|
|
6
|
+
import classNames from '../../utils/classnames';
|
|
6
7
|
import Location from '../form/location';
|
|
7
8
|
import { emptyObject } from '../../utils/constant';
|
|
8
9
|
import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
|
|
@@ -39,6 +40,9 @@ export const WdLocation = forwardRef(function WdLocation(props, ref) {
|
|
|
39
40
|
readValue,
|
|
40
41
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
41
42
|
readOnly: locationType === 2 ? readOnly && isInit : readOnly,
|
|
43
|
+
className: classNames(props.className, {
|
|
44
|
+
showMap: showMap,
|
|
45
|
+
}),
|
|
42
46
|
};
|
|
43
47
|
const inputGroupProps = { ...props, classRoot };
|
|
44
48
|
const inputWrapProps = { ...props, classRoot, disabled, ...clearProps };
|
|
@@ -44,7 +44,7 @@ const OptionText = ({ mode, option, selectFields, authFields, onChange, onRelati
|
|
|
44
44
|
option,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
}, children: [_jsxs("div", { className: "wd-relation-select-header", children: [_jsx("p", { className: "wd-relation-select-header-text", children: (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value) }), enableRelationOptionJump && (_jsx("span", { onClick: () => {
|
|
47
|
+
}, children: [_jsxs("div", { className: "wd-relation-select-header", children: [_jsx("p", { className: "wd-relation-select-header-text", title: (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value), children: (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value) }), enableRelationOptionJump && (_jsx("span", { onClick: () => {
|
|
48
48
|
onRelationOptionJump({ item: option });
|
|
49
49
|
}, children: _jsx(WdIcon, { name: "td:jump", size: "s", type: "inner" }) }))] }), _jsxs("div", { className: "wd-relation-select-option-group", children: [_jsx("div", { className: "wd-relation-select-option-header", children: columns.map((i) => (_jsx("div", { className: "wd-relation-select-option-text", style: { width: columns.length > 1 ? i.width : 'auto' }, children: i.header }, i.key))) }), _jsx("div", { className: "wd-relation-select-option-content", children: columns.map((i) => (_jsx("div", { className: "wd-relation-select-option-text", style: { width: columns.length > 1 ? i.width : 'auto' }, children: i.render(option === null || option === void 0 ? void 0 : option.extra) }, i.key))) })] })] }));
|
|
50
50
|
};
|
|
@@ -80,13 +80,15 @@ export function RelationSelect(props) {
|
|
|
80
80
|
pageSize: defaultSize,
|
|
81
81
|
where: whereList,
|
|
82
82
|
}, isObjectEqual);
|
|
83
|
-
const { result: options, total, isValidating
|
|
83
|
+
const { result: options, total, isValidating, empty, getRelationOptions, } = useChooseList({
|
|
84
84
|
dataSourceAPI,
|
|
85
85
|
childDbName: dataSourceName,
|
|
86
86
|
queryParams: query,
|
|
87
87
|
primaryColumn: primaryField,
|
|
88
88
|
value,
|
|
89
|
+
isInsertSelectedValue: true,
|
|
89
90
|
});
|
|
91
|
+
const [isLoading, setIsLoading] = useSyncValue(isValidating, isObjectEqual);
|
|
90
92
|
// 下拉选项数据
|
|
91
93
|
const customOptions = useMemo(() => {
|
|
92
94
|
return isRelationSelectOption
|
|
@@ -128,6 +130,8 @@ export function RelationSelect(props) {
|
|
|
128
130
|
};
|
|
129
131
|
}, [getRelationOptions, query.pageNo, searchOptionListWithWhere, setRefreshStatus]);
|
|
130
132
|
const searchHandle = (keyword) => {
|
|
133
|
+
empty();
|
|
134
|
+
setIsLoading(true);
|
|
131
135
|
let where = whereList;
|
|
132
136
|
if (keyword === null || keyword === void 0 ? void 0 : keyword.length) {
|
|
133
137
|
// 筛选面板的查询条件与数据过滤的查询条件是且的关系
|
|
@@ -138,7 +142,7 @@ export function RelationSelect(props) {
|
|
|
138
142
|
searchOptionListWithWhere(where);
|
|
139
143
|
onSearch(keyword);
|
|
140
144
|
};
|
|
141
|
-
return (_jsx(EnumHoc, { fields: authFields, children: _jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, listWidth: listWidth, listHeight: _listHeight, matchButtonWidth: _matchButtonWidth, placeholder: placeholder, appearance: 'button', filter: () => true, size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle,
|
|
145
|
+
return (_jsx(EnumHoc, { fields: authFields, children: _jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, listWidth: listWidth, listHeight: _listHeight, matchButtonWidth: _matchButtonWidth, placeholder: placeholder, appearance: 'button', filter: () => true, size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle, bottomTips: isLoading ? _jsx(LoadingTip, {}) : undefined, onScrollBottom: () => {
|
|
142
146
|
if (!isLoading && customOptions.length < total) {
|
|
143
147
|
setQuery((query) => ({
|
|
144
148
|
...query,
|
|
@@ -146,6 +150,7 @@ export function RelationSelect(props) {
|
|
|
146
150
|
}));
|
|
147
151
|
}
|
|
148
152
|
}, onOpen: () => {
|
|
153
|
+
setIsLoading(true);
|
|
149
154
|
searchOptionListWithWhere();
|
|
150
155
|
}, footer: addRelationButton, mode: mode }) }));
|
|
151
156
|
}
|
|
@@ -157,7 +157,7 @@ export function SelectUI(props) {
|
|
|
157
157
|
.join(',');
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
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) ||
|
|
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) || value;
|
|
161
161
|
}
|
|
162
162
|
}, [isMultiple, options, value]);
|
|
163
163
|
const render = () => {
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
padding-right: 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.wd-form-item.wd-pc-select-root
|
|
45
|
-
.wedatea2td-dropdown-btn.wedatea2td-dropdown__header {
|
|
44
|
+
.wd-form-item.wd-pc-select-root .wedatea2td-dropdown-btn.wedatea2td-dropdown__header {
|
|
46
45
|
border: none;
|
|
47
46
|
padding: 0;
|
|
48
47
|
display: flex;
|
|
@@ -58,16 +57,13 @@
|
|
|
58
57
|
color: var(--wd-color-text-placeholder) !important;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
.wd-form--vertical-left
|
|
62
|
-
.wd-h5-select-root
|
|
63
|
-
.wd-form-select-relational-setting--wrap {
|
|
60
|
+
.wd-form--vertical-left .wd-h5-select-root .wd-form-select-relational-setting--wrap {
|
|
64
61
|
top: 16px;
|
|
65
62
|
}
|
|
66
63
|
.wd-form-select-relational-setting--wrap {
|
|
67
64
|
display: flex;
|
|
68
65
|
}
|
|
69
|
-
.wd-form.wd-pc-form
|
|
70
|
-
.wd-form-input-group.wd-form-select-relational-setting--group,
|
|
66
|
+
.wd-form.wd-pc-form .wd-form-input-group.wd-form-select-relational-setting--group,
|
|
71
67
|
.wd-form-input-group.wd-form-select-relational-setting--group {
|
|
72
68
|
width: auto;
|
|
73
69
|
}
|
|
@@ -80,9 +76,7 @@
|
|
|
80
76
|
.wd-form-select-relational-setting--group .wd-link {
|
|
81
77
|
display: flex;
|
|
82
78
|
}
|
|
83
|
-
.wd-select-select
|
|
84
|
-
.wd-form-input-wrap__content
|
|
85
|
-
> .weda-ui-custom-picker__status {
|
|
79
|
+
.wd-select-select .wd-form-input-wrap__content > .weda-ui-custom-picker__status {
|
|
86
80
|
padding-left: 5px;
|
|
87
81
|
}
|
|
88
82
|
|
|
@@ -125,6 +119,10 @@
|
|
|
125
119
|
}
|
|
126
120
|
.wd-relation-select-header-text {
|
|
127
121
|
font-size: 16px;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
text-overflow: ellipsis;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
max-width: 300px;
|
|
128
126
|
}
|
|
129
127
|
.wd-relation-select-header .wd-icon {
|
|
130
128
|
color: var(--wd-color-brand, #0052d9);
|
|
@@ -159,18 +157,12 @@
|
|
|
159
157
|
display: block;
|
|
160
158
|
white-space: nowrap;
|
|
161
159
|
}
|
|
162
|
-
.wd-relation-select-overlay
|
|
163
|
-
.wedatea2td-dropdown-box
|
|
164
|
-
.wedatea2td-list--option
|
|
165
|
-
> li {
|
|
160
|
+
.wd-relation-select-overlay .wedatea2td-dropdown-box .wedatea2td-list--option > li {
|
|
166
161
|
width: auto !important;
|
|
167
162
|
min-width: 100%;
|
|
168
163
|
padding: 0;
|
|
169
164
|
}
|
|
170
|
-
.wd-relation-select-overlay
|
|
171
|
-
.wedatea2td-dropdown-box
|
|
172
|
-
.wedatea2td-list--option
|
|
173
|
-
.wedatea2td-list__status {
|
|
165
|
+
.wd-relation-select-overlay .wedatea2td-dropdown-box .wedatea2td-list--option .wedatea2td-list__status {
|
|
174
166
|
padding: 6px 8px;
|
|
175
167
|
}
|
|
176
168
|
/* h5端关联下拉样式 */
|
|
@@ -184,13 +176,11 @@
|
|
|
184
176
|
.weda-ui-custom-picker__cloumns.wd-relation-select-overlay {
|
|
185
177
|
overflow: auto;
|
|
186
178
|
}
|
|
187
|
-
.weda-ui-custom-picker__cloumns.wd-relation-select-overlay
|
|
188
|
-
.weda-ui-custom-picker__cloumn {
|
|
179
|
+
.weda-ui-custom-picker__cloumns.wd-relation-select-overlay .weda-ui-custom-picker__cloumn {
|
|
189
180
|
width: auto;
|
|
190
181
|
min-width: 100%;
|
|
191
182
|
}
|
|
192
|
-
.weda-ui-custom-picker__cloumns.wd-relation-select-overlay
|
|
193
|
-
.weda-ui-custom-picker__cloumn-item.is-selected {
|
|
183
|
+
.weda-ui-custom-picker__cloumns.wd-relation-select-overlay .weda-ui-custom-picker__cloumn-item.is-selected {
|
|
194
184
|
background-color: var(--wd-color-brand-light, #ecf2fe);
|
|
195
185
|
border-radius: 3px;
|
|
196
186
|
}
|
|
@@ -56,7 +56,7 @@ export declare const formatNumberFix: (val: any, field: any, setZero?: boolean)
|
|
|
56
56
|
* 根据 fields 信息生成 column
|
|
57
57
|
* h5 和 pc 部分参数不同
|
|
58
58
|
*/
|
|
59
|
-
export declare const getColumns: ({ columnSets, fields, isH5, supportManyRelated, showRelationWithTag
|
|
59
|
+
export declare const getColumns: ({ columnSets, fields, isH5, supportManyRelated, showRelationWithTag }: {
|
|
60
60
|
columnSets?: any[];
|
|
61
61
|
fields: any;
|
|
62
62
|
isH5?: boolean;
|
|
@@ -123,7 +123,7 @@ export declare const filterCustomColumns: ({ columns, columnSets, slots, fields,
|
|
|
123
123
|
* 过滤字段列表
|
|
124
124
|
* 导出/搜索框,不展示自定义列
|
|
125
125
|
*/
|
|
126
|
-
export declare const filterCustomFields: ({ fields, columnSets, isFilterGenre
|
|
126
|
+
export declare const filterCustomFields: ({ fields, columnSets, isFilterGenre }: {
|
|
127
127
|
fields: any;
|
|
128
128
|
columnSets: any;
|
|
129
129
|
isFilterGenre?: boolean;
|
|
@@ -131,7 +131,7 @@ export declare const filterCustomFields: ({ fields, columnSets, isFilterGenre, }
|
|
|
131
131
|
/**
|
|
132
132
|
* 列管理加入冻结属性
|
|
133
133
|
*/
|
|
134
|
-
export declare const getFixedColumnSets: ({ fixedFront, fixedEnd, columnSets
|
|
134
|
+
export declare const getFixedColumnSets: ({ fixedFront, fixedEnd, columnSets }: {
|
|
135
135
|
fixedFront?: string;
|
|
136
136
|
fixedEnd?: string;
|
|
137
137
|
columnSets: any;
|
|
@@ -39,7 +39,7 @@ export const TextWrap = React.memo(function TextWrapComp(props) {
|
|
|
39
39
|
export function getFieldRender(field = {}, extra = {}) {
|
|
40
40
|
var _a;
|
|
41
41
|
const { type, format, items, properties, title, parentDatasource } = field;
|
|
42
|
-
const { modelType, showTip = true, detailText = '详情', isH5, showRelationWithTag = true
|
|
42
|
+
const { modelType, showTip = true, detailText = '详情', isH5, showRelationWithTag = true } = extra;
|
|
43
43
|
const textProps = { showTip };
|
|
44
44
|
// 枚举-旧,新版 TODO
|
|
45
45
|
if ((_a = field['x-enumObj']) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -81,7 +81,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
81
81
|
properties: locationProperties,
|
|
82
82
|
},
|
|
83
83
|
};
|
|
84
|
-
return
|
|
84
|
+
return _jsx(ArrayComponent, { isH5: isH5, value: value, modelType: modelType, field: locationField, items: items });
|
|
85
85
|
}
|
|
86
86
|
if (modelType === 'table') {
|
|
87
87
|
const content = (_a = formatLocationData(val)) === null || _a === void 0 ? void 0 : _a.flatContent;
|
|
@@ -115,10 +115,9 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
else if (format === 'x-file') {
|
|
117
117
|
// 文件
|
|
118
|
-
return
|
|
118
|
+
return _jsx(UploaderFileView, { value: fieldValue, single: (extra === null || extra === void 0 ? void 0 : extra.modelType) !== 'detail' });
|
|
119
119
|
}
|
|
120
|
-
else if (!(extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) &&
|
|
121
|
-
isShowOrgsView(field, modelType)) {
|
|
120
|
+
else if (!(extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) && isShowOrgsView(field, modelType)) {
|
|
122
121
|
return (_jsx(ViewCell, { data: fieldValue, showType: modelType,
|
|
123
122
|
// type={field['x-parent']?.parentDataSourceName === 'sys_department' ? 'org' : 'user'}
|
|
124
123
|
relation: extra === null || extra === void 0 ? void 0 : extra.relation }));
|
|
@@ -131,15 +130,14 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
131
130
|
// 网址
|
|
132
131
|
return (_jsx("a", { className: "wd-table__a", target: "_blank", href: fieldValue, rel: "noreferrer", children: _jsx(TextWrap, { ...textProps, children: fieldValue }) }));
|
|
133
132
|
}
|
|
134
|
-
else if ((extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) &&
|
|
135
|
-
(format === 'father-son' || format === 'related')) {
|
|
133
|
+
else if ((extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) && (format === 'father-son' || format === 'related')) {
|
|
136
134
|
const primaryField = ((_b = (_a = field === null || field === void 0 ? void 0 : field.parentDatasource) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b['x-primary-column']) || '';
|
|
137
135
|
const relatedField = (_c = extra === null || extra === void 0 ? void 0 : extra.columnSet) === null || _c === void 0 ? void 0 : _c.relatedField;
|
|
138
136
|
if (!showRelationWithTag) {
|
|
139
137
|
if (typeof fieldValue === 'string') {
|
|
140
138
|
return _jsx(TextWrap, { ...textProps, children: fieldValue });
|
|
141
139
|
}
|
|
142
|
-
return
|
|
140
|
+
return _jsx(TextWrap, { ...textProps, children: fieldValue[relatedField] || fieldValue[primaryField] || '-' });
|
|
143
141
|
}
|
|
144
142
|
if (typeof fieldValue === 'string') {
|
|
145
143
|
return fieldValue && fieldValue !== '-' ? (_jsx(WdTag, { range: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(',').map((i) => ({
|
|
@@ -167,6 +165,10 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
167
165
|
}
|
|
168
166
|
else if (type === 'number') {
|
|
169
167
|
fieldValue = formatNumber(val, field);
|
|
168
|
+
if (Object.prototype.hasOwnProperty.call(val, '$date')) {
|
|
169
|
+
field.format = 'datetime';
|
|
170
|
+
fieldValue = formatNumber(val.$date, field);
|
|
171
|
+
}
|
|
170
172
|
return _jsx(TextWrap, { children: fieldValue });
|
|
171
173
|
}
|
|
172
174
|
else if (type === 'boolean') {
|
|
@@ -176,7 +178,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
176
178
|
else if (type === 'object') {
|
|
177
179
|
const objectRender = ({ value, modelType, fields }) => {
|
|
178
180
|
if (typeof val === 'object') {
|
|
179
|
-
return
|
|
181
|
+
return _jsx(DataItemView, { value: value, modelType: modelType, fields: fields, isH5: isH5 });
|
|
180
182
|
}
|
|
181
183
|
return _jsx(TextWrap, { ...textProps, children: value });
|
|
182
184
|
};
|
|
@@ -194,14 +196,12 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
194
196
|
fields: properties,
|
|
195
197
|
});
|
|
196
198
|
}
|
|
197
|
-
else if (format === 'many-one' ||
|
|
198
|
-
format === 'one-one' ||
|
|
199
|
-
format === 'one-one-r') {
|
|
199
|
+
else if (format === 'many-one' || format === 'one-one' || format === 'one-one-r') {
|
|
200
200
|
const primaryField = ((_e = (_d = field === null || field === void 0 ? void 0 : field.parentDatasource) === null || _d === void 0 ? void 0 : _d.schema) === null || _e === void 0 ? void 0 : _e['x-primary-column']) || '';
|
|
201
201
|
const relatedField = (_f = extra === null || extra === void 0 ? void 0 : extra.columnSet) === null || _f === void 0 ? void 0 : _f.relatedField;
|
|
202
202
|
const _readValue = fieldValue[relatedField] || fieldValue[primaryField];
|
|
203
203
|
if (!showRelationWithTag) {
|
|
204
|
-
return
|
|
204
|
+
return _jsx(TextWrap, { ...textProps, children: fieldValue[relatedField] || fieldValue[primaryField] });
|
|
205
205
|
}
|
|
206
206
|
return _readValue ? (_jsx(WdTag, { range: _readValue === null || _readValue === void 0 ? void 0 : _readValue.split(',').map((i) => ({
|
|
207
207
|
label: i,
|
|
@@ -219,8 +219,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
else if (type === 'array') {
|
|
222
|
-
if (field.name === '_departmentList' &&
|
|
223
|
-
['table', 'detail'].includes(modelType)) {
|
|
222
|
+
if (field.name === '_departmentList' && ['table', 'detail'].includes(modelType)) {
|
|
224
223
|
return _jsx(TextWrap, { ...textProps, children: val || '-' });
|
|
225
224
|
}
|
|
226
225
|
if (format === 'x-enum') {
|
|
@@ -243,8 +242,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
243
242
|
// 文件数组,在详情页和表格页展示不同
|
|
244
243
|
return _jsx(UploaderFileView, { value: fieldValue, single: false });
|
|
245
244
|
}
|
|
246
|
-
else if ((extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) &&
|
|
247
|
-
(format === 'one-many' || format === 'many-many')) {
|
|
245
|
+
else if ((extra === null || extra === void 0 ? void 0 : extra.supportManyRelated) && (format === 'one-many' || format === 'many-many')) {
|
|
248
246
|
const primaryField = ((_h = (_g = field === null || field === void 0 ? void 0 : field.parentDatasource) === null || _g === void 0 ? void 0 : _g.schema) === null || _h === void 0 ? void 0 : _h['x-primary-column']) || '';
|
|
249
247
|
const relatedField = (_j = extra === null || extra === void 0 ? void 0 : extra.columnSet) === null || _j === void 0 ? void 0 : _j.relatedField;
|
|
250
248
|
const rowId = extra === null || extra === void 0 ? void 0 : extra.rowId;
|
|
@@ -252,8 +250,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
252
250
|
const propertyArr = Object.keys(properties);
|
|
253
251
|
const relatedKey = propertyArr.find((item) => {
|
|
254
252
|
var _a;
|
|
255
|
-
if (properties[item].format === 'many-one' ||
|
|
256
|
-
properties[item].format === 'many-many') {
|
|
253
|
+
if (properties[item].format === 'many-one' || properties[item].format === 'many-many') {
|
|
257
254
|
return ((_a = properties[item]['x-parent']) === null || _a === void 0 ? void 0 : _a.parentFieldKey) === field.name;
|
|
258
255
|
}
|
|
259
256
|
else {
|
|
@@ -287,7 +284,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
287
284
|
}
|
|
288
285
|
else {
|
|
289
286
|
fieldValue = safeJsonParse(val);
|
|
290
|
-
return
|
|
287
|
+
return _jsx(ArrayComponent, { isH5: isH5, value: fieldValue, field: field, modelType: modelType, items: items });
|
|
291
288
|
}
|
|
292
289
|
}
|
|
293
290
|
return _jsx("span", { children: JSON.stringify(fieldValue) });
|
|
@@ -368,8 +365,7 @@ const ArrayComponent = ({ items, modelType, value, field, isH5 }) => {
|
|
|
368
365
|
export const formatNumber = (value, field) => {
|
|
369
366
|
let newValue = value;
|
|
370
367
|
try {
|
|
371
|
-
if (['date', 'time', 'datetime'].includes(field === null || field === void 0 ? void 0 : field.format) &&
|
|
372
|
-
typeof value === 'number') {
|
|
368
|
+
if (['date', 'time', 'datetime'].includes(field === null || field === void 0 ? void 0 : field.format) && typeof value === 'number') {
|
|
373
369
|
newValue = formatTimeByType(field === null || field === void 0 ? void 0 : field.format, value, field);
|
|
374
370
|
}
|
|
375
371
|
else {
|
|
@@ -433,8 +429,8 @@ export const formatNumberFix = (val, field, setZero = false) => {
|
|
|
433
429
|
* 根据 fields 信息生成 column
|
|
434
430
|
* h5 和 pc 部分参数不同
|
|
435
431
|
*/
|
|
436
|
-
export const getColumns = ({ columnSets = [], fields, isH5 = false, supportManyRelated, showRelationWithTag
|
|
437
|
-
const TableCell = ({ record, field, isH5, supportManyRelated, showRelationWithTag
|
|
432
|
+
export const getColumns = ({ columnSets = [], fields, isH5 = false, supportManyRelated, showRelationWithTag }) => fields === null || fields === void 0 ? void 0 : fields.map((item) => formatFieldToColumn(item, isH5, columnSets, supportManyRelated, showRelationWithTag));
|
|
433
|
+
const TableCell = ({ record, field, isH5, supportManyRelated, showRelationWithTag }) => {
|
|
438
434
|
const component = React.useMemo(() => {
|
|
439
435
|
const { name } = field;
|
|
440
436
|
const value = getFieldValue(name, record);
|
|
@@ -457,7 +453,7 @@ const TableCell = ({ record, field, isH5, supportManyRelated, showRelationWithTa
|
|
|
457
453
|
return getFieldRender(field, extra)(value);
|
|
458
454
|
}, [record, field, isH5]);
|
|
459
455
|
// 处理渲染错误
|
|
460
|
-
return
|
|
456
|
+
return _jsx(ErrorBoundary, { FallbackComponent: () => _jsx("span", { className: "", children: "\u274C \u6570\u636E\u5F02\u5E38" }), children: component });
|
|
461
457
|
};
|
|
462
458
|
/**
|
|
463
459
|
* 根据 field 属性,生成 column 配置
|
|
@@ -470,9 +466,7 @@ export const formatFieldToColumn = (field, isH5, columnSets, supportManyRelated,
|
|
|
470
466
|
const item = columnSets === null || columnSets === void 0 ? void 0 : columnSets.find((i) => i.key === name);
|
|
471
467
|
const isIllegalWidth = typeof (item === null || item === void 0 ? void 0 : item.width) !== 'number';
|
|
472
468
|
return {
|
|
473
|
-
width: !item || (item === null || item === void 0 ? void 0 : item.widthType) === 'auto' || isIllegalWidth
|
|
474
|
-
? width
|
|
475
|
-
: item === null || item === void 0 ? void 0 : item.width,
|
|
469
|
+
width: !item || (item === null || item === void 0 ? void 0 : item.widthType) === 'auto' || isIllegalWidth ? width : item === null || item === void 0 ? void 0 : item.width,
|
|
476
470
|
render: (record) => (_jsx(TableCell, { record: record, field: field, isH5: isH5, supportManyRelated: supportManyRelated, showRelationWithTag: showRelationWithTag })),
|
|
477
471
|
key: name,
|
|
478
472
|
slotKey: (item === null || item === void 0 ? void 0 : item.slotKey) || name,
|
|
@@ -515,9 +509,7 @@ export const getFieldWidth = (field) => {
|
|
|
515
509
|
// 按类型列宽度
|
|
516
510
|
const typeWidth = ((_a = TypeFormatWidthMap === null || TypeFormatWidthMap === void 0 ? void 0 : TypeFormatWidthMap[type]) === null || _a === void 0 ? void 0 : _a[format || (items === null || items === void 0 ? void 0 : items.format) || 'default']) || 0;
|
|
517
511
|
// 最终宽度
|
|
518
|
-
const width = typeWidth
|
|
519
|
-
? Math.max(nameWidth, typeWidth)
|
|
520
|
-
: Math.max(nameWidth, 120);
|
|
512
|
+
const width = typeWidth ? Math.max(nameWidth, typeWidth) : Math.max(nameWidth, 120);
|
|
521
513
|
return width;
|
|
522
514
|
};
|
|
523
515
|
/**
|
|
@@ -595,9 +587,7 @@ export const formatDataToExport = (datas, fields, enumOptions = {}) => {
|
|
|
595
587
|
newDatas[zhTitle] = formatDataToExport([].concat(data), Object.values(((_d = field === null || field === void 0 ? void 0 : field.items) === null || _d === void 0 ? void 0 : _d.properties) || {}));
|
|
596
588
|
}
|
|
597
589
|
else if (((_e = field === null || field === void 0 ? void 0 : field.items) === null || _e === void 0 ? void 0 : _e.type) === 'number') {
|
|
598
|
-
newDatas[zhTitle] = []
|
|
599
|
-
.concat(data)
|
|
600
|
-
.map((d) => formatNumber(d, field === null || field === void 0 ? void 0 : field.items));
|
|
590
|
+
newDatas[zhTitle] = [].concat(data).map((d) => formatNumber(d, field === null || field === void 0 ? void 0 : field.items));
|
|
601
591
|
}
|
|
602
592
|
else if (((_f = field === null || field === void 0 ? void 0 : field.items) === null || _f === void 0 ? void 0 : _f.type) === 'boolean') {
|
|
603
593
|
newDatas[zhTitle] = [].concat(data).map((d) => formatBoolean(d));
|
|
@@ -732,7 +722,7 @@ export const slotRender = (Slot, props = {}) => {
|
|
|
732
722
|
}
|
|
733
723
|
return Slot !== null && Slot !== void 0 ? Slot : null;
|
|
734
724
|
};
|
|
735
|
-
const TableSlotCell = ({ record, rowKey, recordIndex, column, columnIndex, slot
|
|
725
|
+
const TableSlotCell = ({ record, rowKey, recordIndex, column, columnIndex, slot }) => {
|
|
736
726
|
return slotRender(slot, {
|
|
737
727
|
record,
|
|
738
728
|
rowKey,
|
|
@@ -810,12 +800,11 @@ export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5,
|
|
|
810
800
|
};
|
|
811
801
|
const value = getFieldValue(key, record, relatedField, isMany(_oriField));
|
|
812
802
|
const component = getFieldRender(field, extra)(value);
|
|
813
|
-
return
|
|
803
|
+
return _jsx(ErrorBoundary, { FallbackComponent: () => _jsx("span", { className: "", children: "\u274C \u6570\u636E\u5F02\u5E38" }), children: component });
|
|
814
804
|
};
|
|
815
805
|
const _oriWidth = getFieldWidth(field) + 10;
|
|
816
806
|
const isIllegalWidth = typeof (item2 === null || item2 === void 0 ? void 0 : item2.width) !== 'number';
|
|
817
|
-
item2.width =
|
|
818
|
-
(item2 === null || item2 === void 0 ? void 0 : item2.widthType) === 'auto' || isIllegalWidth ? _oriWidth : item2 === null || item2 === void 0 ? void 0 : item2.width;
|
|
807
|
+
item2.width = (item2 === null || item2 === void 0 ? void 0 : item2.widthType) === 'auto' || isIllegalWidth ? _oriWidth : item2 === null || item2 === void 0 ? void 0 : item2.width;
|
|
819
808
|
// 拿到自定义列属性值
|
|
820
809
|
const customColumn = {
|
|
821
810
|
...columnsMap[key],
|
|
@@ -882,22 +871,20 @@ const getCustomField = (_field, columnSet) => {
|
|
|
882
871
|
* 过滤字段列表
|
|
883
872
|
* 导出/搜索框,不展示自定义列
|
|
884
873
|
*/
|
|
885
|
-
export const filterCustomFields = ({ fields, columnSets, isFilterGenre = false
|
|
874
|
+
export const filterCustomFields = ({ fields, columnSets, isFilterGenre = false }) => {
|
|
886
875
|
if (!Array.isArray(fields))
|
|
887
876
|
return [];
|
|
888
877
|
if (!Array.isArray(columnSets))
|
|
889
878
|
return fields;
|
|
890
879
|
const fieldsMap = fromEntries(fields.map((item) => [item.name, item]));
|
|
891
880
|
return columnSets
|
|
892
|
-
.filter((item1) => (item1 === null || item1 === void 0 ? void 0 : item1.key) &&
|
|
893
|
-
fieldsMap[item1.key] &&
|
|
894
|
-
((item1 === null || item1 === void 0 ? void 0 : item1.genre) !== 'slot' || isFilterGenre))
|
|
881
|
+
.filter((item1) => (item1 === null || item1 === void 0 ? void 0 : item1.key) && fieldsMap[item1.key] && ((item1 === null || item1 === void 0 ? void 0 : item1.genre) !== 'slot' || isFilterGenre))
|
|
895
882
|
.map((item2) => ({ ...fieldsMap[item2.key], title: item2.header }));
|
|
896
883
|
};
|
|
897
884
|
/**
|
|
898
885
|
* 列管理加入冻结属性
|
|
899
886
|
*/
|
|
900
|
-
export const getFixedColumnSets = ({ fixedFront = '', fixedEnd = '', columnSets
|
|
887
|
+
export const getFixedColumnSets = ({ fixedFront = '', fixedEnd = '', columnSets }) => {
|
|
901
888
|
if (!Array.isArray(columnSets))
|
|
902
889
|
return columnSets;
|
|
903
890
|
const fixedFrontIndex = columnSets.findIndex((item) => (item === null || item === void 0 ? void 0 : item.key) && item.key.length > 0 && item.key === fixedFront);
|
|
@@ -905,9 +892,7 @@ export const getFixedColumnSets = ({ fixedFront = '', fixedEnd = '', columnSets,
|
|
|
905
892
|
return Array.isArray(columnSets)
|
|
906
893
|
? columnSets.map((item, index) => {
|
|
907
894
|
// 当冻结尾列在冻结前列之后时,冻结尾列属性才生效
|
|
908
|
-
if (fixedEndIndex >= 0 &&
|
|
909
|
-
fixedEndIndex > fixedFrontIndex &&
|
|
910
|
-
index >= fixedEndIndex) {
|
|
895
|
+
if (fixedEndIndex >= 0 && fixedEndIndex > fixedFrontIndex && index >= fixedEndIndex) {
|
|
911
896
|
return { ...item, fixed: 'right' };
|
|
912
897
|
}
|
|
913
898
|
else if (fixedFrontIndex >= 0 && index <= fixedFrontIndex) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export declare const getDataBaseInfo: (fields: any, format: any, childDbName: any) => any;
|
|
2
2
|
export declare const mapResult: (records: any, primaryColumn: any) => any;
|
|
3
|
-
export declare const useChooseList: ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value }: {
|
|
3
|
+
export declare const useChooseList: ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value, isInsertSelectedValue, }: {
|
|
4
4
|
dataSourceAPI: any;
|
|
5
5
|
queryParams: any;
|
|
6
6
|
childDbName: any;
|
|
7
7
|
primaryColumn: any;
|
|
8
8
|
value: any;
|
|
9
|
+
isInsertSelectedValue?: boolean;
|
|
9
10
|
}) => {
|
|
10
11
|
result: any[];
|
|
11
12
|
total: number;
|