@cloudbase/weda-ui 3.21.2 → 3.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/components/wd-select-multiple.js +12 -0
- package/dist/configs/components/wd-select.js +12 -0
- package/dist/configs/components/wd-table.js +4 -0
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/chart/statisticsCard/index.js +9 -6
- package/dist/web/components/richText/index.js +11 -21
- package/dist/web/components/richTextView/index.css +56 -4
- package/dist/web/components/richTextView/style.d.ts +1 -0
- package/dist/web/components/richTextView/style.js +1 -0
- package/dist/web/components/table/ExportFileModalByApi/index.js +11 -14
- package/dist/web/components/wd-form/form-utils.d.ts +1 -0
- package/dist/web/components/wd-form/form-utils.js +17 -0
- package/dist/web/components/wd-form/hooks/use-remote-value.js +1 -1
- package/dist/web/components/wd-form/index.js +14 -39
- package/dist/web/components/wd-select/select/selectUI.js +9 -7
- package/dist/web/components/wd-select/wd-select.js +1 -1
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +1 -1
- package/dist/web/components/wd-tabs/tabs-h5.js +14 -13
- package/dist/web/components/wd-tabs/tabs-pc.js +15 -16
- package/dist/web/utils/tool.js +19 -1
- package/package.json +1 -1
|
@@ -148,16 +148,19 @@ export default function StatisticsCard({ dataSource, filterData, field, operatio
|
|
|
148
148
|
],
|
|
149
149
|
};
|
|
150
150
|
try {
|
|
151
|
-
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) === 'database') {
|
|
151
|
+
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) === 'database' && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.name)) {
|
|
152
152
|
return await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callWedaApi({
|
|
153
153
|
action: 'DescribeChartCardData',
|
|
154
154
|
data: params,
|
|
155
155
|
}));
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.name) && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.methodName)) {
|
|
158
|
+
return await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callDataSource({
|
|
159
|
+
dataSourceName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.name,
|
|
160
|
+
methodName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.methodName,
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return [];
|
|
161
164
|
}
|
|
162
165
|
catch (e) {
|
|
163
166
|
errorHandler({
|
|
@@ -205,5 +208,5 @@ export default function StatisticsCard({ dataSource, filterData, field, operatio
|
|
|
205
208
|
[`${CLASS_PREFIX}-mobile`]: platform === 'h5',
|
|
206
209
|
[`${CLASS_PREFIX}-pc`]: platform !== 'h5',
|
|
207
210
|
});
|
|
208
|
-
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx("div", { id: id, role: role, className: cls, style: style, onClick: (e) => events.tap({}, { originEvent: e }), children: _jsxs("div", { className: `${CLASS_PREFIX}__wrapper`, children: [_jsx("div", { className: `${CLASS_PREFIX}__title`, children: label }), _jsx("div", { className: `${CLASS_PREFIX}__detail`, children: _jsxs("div", { className: `${CLASS_PREFIX}__count`, children: [isShowUnit ? formatNumber(val / unit, decimalDigits) : val, isShowUnit &&
|
|
211
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx("div", { id: id, role: role, className: cls, style: style, onClick: (e) => events.tap({}, { originEvent: e }), children: _jsxs("div", { className: `${CLASS_PREFIX}__wrapper`, children: [_jsx("div", { className: `${CLASS_PREFIX}__title`, children: label }), _jsx("div", { className: `${CLASS_PREFIX}__detail`, children: _jsxs("div", { className: `${CLASS_PREFIX}__count`, children: [isShowUnit ? formatNumber(val / unit, decimalDigits) : val, isShowUnit && _jsx("label", { className: `${CLASS_PREFIX}__unit`, children: suffix })] }) })] }) }) }));
|
|
209
212
|
}
|
|
@@ -41,6 +41,15 @@ const popover = 'clearFormat bold italic underline color backgroundColor';
|
|
|
41
41
|
let loadEditorPromise;
|
|
42
42
|
// 默认视频类型
|
|
43
43
|
const VIDEO_TYPES = ['video/*'];
|
|
44
|
+
function loadSrc(src) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
const script = document.createElement('script');
|
|
47
|
+
script.src = src;
|
|
48
|
+
script.onload = () => resolve('');
|
|
49
|
+
script.onerror = () => reject('');
|
|
50
|
+
document.body.appendChild(script);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
44
53
|
export default React.memo(RichText);
|
|
45
54
|
function RichText({
|
|
46
55
|
// 系统属性
|
|
@@ -149,32 +158,13 @@ initialContent, placeholder, iconPack, maxSize, cloudPath, visible, storageType
|
|
|
149
158
|
React.useEffect(() => {
|
|
150
159
|
if (!(window === null || window === void 0 ? void 0 : window.ExEditor3) && !loadEditorPromise) {
|
|
151
160
|
// 挂载资源
|
|
152
|
-
function loadSrc(src, css) {
|
|
153
|
-
return new Promise((resolve, reject) => {
|
|
154
|
-
const script = document.createElement('script');
|
|
155
|
-
script.src = src;
|
|
156
|
-
script.onload = () => resolve('');
|
|
157
|
-
script.onerror = () => reject('');
|
|
158
|
-
document.body.appendChild(script);
|
|
159
|
-
const link = document.createElement('link');
|
|
160
|
-
link.setAttribute('rel', 'stylesheet');
|
|
161
|
-
link.setAttribute('href', css);
|
|
162
|
-
const head = document.getElementsByTagName('head');
|
|
163
|
-
if (head.length) {
|
|
164
|
-
head[0].appendChild(link);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
document.body.appendChild(link);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
161
|
try {
|
|
172
162
|
const cfg = onlineConfig.richText;
|
|
173
163
|
if (isPrivate()) {
|
|
174
|
-
loadEditorPromise = loadSrc(cfg.private.js
|
|
164
|
+
loadEditorPromise = loadSrc(cfg.private.js).catch(() => loadSrc(cfg.js));
|
|
175
165
|
}
|
|
176
166
|
else {
|
|
177
|
-
loadEditorPromise = loadSrc(cfg.js
|
|
167
|
+
loadEditorPromise = loadSrc(cfg.js);
|
|
178
168
|
}
|
|
179
169
|
}
|
|
180
170
|
catch (e) {
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
font-size: 0.67em;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.weda-RichTextView ul {
|
|
57
|
+
/* .weda-RichTextView ul {
|
|
58
58
|
list-style: disc !important;
|
|
59
59
|
padding: revert !important;
|
|
60
|
-
}
|
|
60
|
+
} */
|
|
61
61
|
|
|
62
|
-
.weda-RichTextView ol {
|
|
62
|
+
/* .weda-RichTextView ol {
|
|
63
63
|
list-style: decimal !important;
|
|
64
64
|
padding: revert !important;
|
|
65
|
-
}
|
|
65
|
+
} */
|
|
66
66
|
|
|
67
67
|
.weda-RichTextView .tableWrapper,
|
|
68
68
|
.weda-RichTextView div:has(> table) {
|
|
@@ -114,3 +114,55 @@
|
|
|
114
114
|
.weda-RichTextView p {
|
|
115
115
|
min-height: 1em;
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
.weda-RichTextView ol,
|
|
119
|
+
.weda-RichTextView ul {
|
|
120
|
+
padding-inline-start: 32px;
|
|
121
|
+
padding-left: 32px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.weda-RichTextView ol {
|
|
125
|
+
--ol-start: 1;
|
|
126
|
+
--ol-list-style-type: decimal;
|
|
127
|
+
list-style-type: none;
|
|
128
|
+
counter-reset: olCounter calc(var(--ol-start, 1) - 1);
|
|
129
|
+
position: relative;
|
|
130
|
+
}
|
|
131
|
+
.weda-RichTextView ol > li > :first-child::before {
|
|
132
|
+
content: counter(olCounter, var(--ol-list-style-type)) '. ';
|
|
133
|
+
counter-increment: olCounter;
|
|
134
|
+
font-variant-numeric: tabular-nums;
|
|
135
|
+
position: absolute;
|
|
136
|
+
transform: translate(-100%, 0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.weda-RichTextView ul {
|
|
140
|
+
--ul-list-style-type: circle;
|
|
141
|
+
list-style-type: none;
|
|
142
|
+
position: relative;
|
|
143
|
+
}
|
|
144
|
+
.weda-RichTextView ul.nonUnicode-list-style-type > li > :first-child::before {
|
|
145
|
+
content: var(--ul-list-style-type) ' ';
|
|
146
|
+
font-variant-numeric: tabular-nums;
|
|
147
|
+
position: absolute;
|
|
148
|
+
transform: translate(-100%, 0.05em) scale(0.5);
|
|
149
|
+
}
|
|
150
|
+
.weda-RichTextView ul.unicode-list-style-type > li > :first-child::before {
|
|
151
|
+
content: var(--ul-list-style-type) ' ';
|
|
152
|
+
font-variant-numeric: tabular-nums;
|
|
153
|
+
position: absolute;
|
|
154
|
+
transform: translate(-100%, 0) scale(0.8);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.weda-RichTextView ul[data-type='todo'] {
|
|
158
|
+
padding-left: calc(2em + 10px);
|
|
159
|
+
}
|
|
160
|
+
.weda-RichTextView ul[data-type='todo'] > li > :first-child::before {
|
|
161
|
+
content: '';
|
|
162
|
+
}
|
|
163
|
+
.weda-RichTextView ul[data-type='todo'] > li > input[type='checkbox'] {
|
|
164
|
+
position: absolute;
|
|
165
|
+
left: 1em;
|
|
166
|
+
margin-top: 6px;
|
|
167
|
+
margin-right: 10px;
|
|
168
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
|
-
import { Modal, Radio, Form, Table, Checkbox, Icon, List, Status, Bubble, Tooltip
|
|
3
|
+
import { Modal, Radio, Form, Table, Checkbox, Icon, List, Status, Bubble, Tooltip } from 'tea-component';
|
|
4
4
|
import { useImportingStatus } from '../hooks/useImportingStatus';
|
|
5
5
|
import { callWedaApi } from '../../../utils/tcb';
|
|
6
6
|
import { WdButton } from '../../wd-button';
|
|
@@ -25,13 +25,11 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
return {
|
|
28
|
-
FieldId: (field === null || field === void 0 ? void 0 : field.isRelated)
|
|
29
|
-
? `@${field === null || field === void 0 ? void 0 : field.fieldKey}.${field === null || field === void 0 ? void 0 : field.relatedField}`
|
|
30
|
-
: item,
|
|
28
|
+
FieldId: (field === null || field === void 0 ? void 0 : field.isRelated) ? `@${field === null || field === void 0 ? void 0 : field.fieldKey}.${field === null || field === void 0 ? void 0 : field.relatedField}` : item,
|
|
31
29
|
ColumnName: item === '_id' ? '数据标识' : field === null || field === void 0 ? void 0 : field.header,
|
|
32
30
|
};
|
|
33
31
|
});
|
|
34
|
-
const
|
|
32
|
+
const handleExport = async () => {
|
|
35
33
|
try {
|
|
36
34
|
setStep('isExporting');
|
|
37
35
|
// 启动导出接口
|
|
@@ -105,7 +103,7 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
105
103
|
header: '字段名称',
|
|
106
104
|
},
|
|
107
105
|
{
|
|
108
|
-
key: '
|
|
106
|
+
key: 'fieldKeyLabel',
|
|
109
107
|
header: '字段标识',
|
|
110
108
|
},
|
|
111
109
|
{
|
|
@@ -113,7 +111,10 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
113
111
|
header: '字段类型',
|
|
114
112
|
},
|
|
115
113
|
];
|
|
116
|
-
return (_jsxs(Modal, { caption: "\u5BFC\u51FAExcel", visible: visible, onClose: onCancel, size: 'l', className: `weda-import-csv-file-modal`, children: [_jsxs(Modal.Body, { children: [step === 'fieldMap' && (_jsxs("div", { children: [_jsx(Form, { className: "weda-import-csv-file-modal weda-export-csv-file-modal", children: _jsx(Form.Item, { label: _jsx(_Fragment, { children: _jsx(Tooltip, { title: _jsx("span", { className: "weda-export-label-tooltip", children: "\u5982\u5BFC\u51FA\u6570\u636E\u91CF\u8D85\u51FA10\u4E07\u884C\uFF0C\u8BF7\u60A8\u7B5B\u9009\u6570\u636E\u540E\u5206\u591A\u6B21\u5BFC\u51FA\u3002" }), children: "\u5BFC\u51FA\u6570\u636E\u8303\u56F4(\u4E0A\u965010\u4E07\u884C)" }) }), children: _jsxs(Radio.Group, { value: exportType, onChange: (value) => setExportType(value), style: { display: 'flex' }, children: [_jsx(Radio, { name: "all", children: "\u5168\u90E8\u6570\u636E" }), _jsx(Radio, { name: "filter", children: "\u7B5B\u9009\u540E\u7684\u6570\u636E" }), _jsxs(Radio, { name: "selected", disabled: !(selectedKeysList === null || selectedKeysList === void 0 ? void 0 : selectedKeysList.length), children: ["\u9009\u4E2D\u7684\u6570\u636E", _jsx("span", { style: { color: 'rgba(0, 0, 0, 0.6)' }, children: !(selectedKeysList === null || selectedKeysList === void 0 ? void 0 : selectedKeysList.length) && '(无选中数据)' })] })] }) }) }), _jsx("p", { className: "weda-export-csv-file-modal__wrap_text", children: "\u5BFC\u51FA\u5B57\u6BB5" }), _jsx(Table, { records: fields
|
|
114
|
+
return (_jsxs(Modal, { caption: "\u5BFC\u51FAExcel", visible: visible, onClose: onCancel, size: 'l', className: `weda-import-csv-file-modal`, children: [_jsxs(Modal.Body, { children: [step === 'fieldMap' && (_jsxs("div", { children: [_jsx(Form, { className: "weda-import-csv-file-modal weda-export-csv-file-modal", children: _jsx(Form.Item, { label: _jsx(_Fragment, { children: _jsx(Tooltip, { title: _jsx("span", { className: "weda-export-label-tooltip", children: "\u5982\u5BFC\u51FA\u6570\u636E\u91CF\u8D85\u51FA10\u4E07\u884C\uFF0C\u8BF7\u60A8\u7B5B\u9009\u6570\u636E\u540E\u5206\u591A\u6B21\u5BFC\u51FA\u3002" }), children: "\u5BFC\u51FA\u6570\u636E\u8303\u56F4(\u4E0A\u965010\u4E07\u884C)" }) }), children: _jsxs(Radio.Group, { value: exportType, onChange: (value) => setExportType(value), style: { display: 'flex' }, children: [_jsx(Radio, { name: "all", children: "\u5168\u90E8\u6570\u636E" }), _jsx(Radio, { name: "filter", children: "\u7B5B\u9009\u540E\u7684\u6570\u636E" }), _jsxs(Radio, { name: "selected", disabled: !(selectedKeysList === null || selectedKeysList === void 0 ? void 0 : selectedKeysList.length), children: ["\u9009\u4E2D\u7684\u6570\u636E", _jsx("span", { style: { color: 'rgba(0, 0, 0, 0.6)' }, children: !(selectedKeysList === null || selectedKeysList === void 0 ? void 0 : selectedKeysList.length) && '(无选中数据)' })] })] }) }) }), _jsx("p", { className: "weda-export-csv-file-modal__wrap_text", children: "\u5BFC\u51FA\u5B57\u6BB5" }), _jsx(Table, { records: fields === null || fields === void 0 ? void 0 : fields.map((i) => ({
|
|
115
|
+
...i,
|
|
116
|
+
fieldKeyLabel: i.isRelated ? `${i.fieldKey}.${i.relatedField}` : i.name,
|
|
117
|
+
})), recordKey: "name", columns: columns, style: { border: '1px solid #E7E7E7', borderBottom: '0' }, addons: [
|
|
117
118
|
selectable({
|
|
118
119
|
value: selectedKeys,
|
|
119
120
|
onChange: (keys) => {
|
|
@@ -125,14 +126,10 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
125
126
|
maxHeight: 320,
|
|
126
127
|
}),
|
|
127
128
|
] }), _jsx(Checkbox.Group, { value: exportIdentity, onChange: (value) => setExportIdentity(value), style: { margin: '16px 0', color: 'rgba(0, 0, 0, 0.6)' }, children: _jsx(Checkbox, { name: "exportIdentity", style: { color: 'rgba(0, 0, 0, 0.6)' }, children: _jsx(Bubble, { content: "\u52FE\u9009\u540E\uFF0C\u53EF\u5BFC\u51FA\u679A\u4E3E\u5B57\u6BB5\u7684\u9009\u9879\u6807\u8BC6\uFF0C\u4E0E\u5173\u8054\u5173\u7CFB/\u4E3B\u5B50\u660E\u7EC6\u5B57\u6BB5\u5173\u8054\u6570\u636E\u7684\u6570\u636E\u6807\u8BC6\uFF0C\u53EF\u7528\u4E8E\u5BFC\u5165\u65F6\u66F4\u65B0\u679A\u4E3E/\u5173\u8054\u5173\u7CFB/\u4E3B\u5B50\u660E\u7EC6\u5B57\u6BB5\u6570\u636E", children: "\u5BFC\u51FA\u9009\u9879\u6807\u8BC6\u548C\u5173\u8054\u6570\u636E\u6807\u8BC6" }) }) })] })), step === 'isExporting' && (_jsxs("div", { className: "import-file-result-wrap", children: [status === 'error' && (_jsxs("div", { className: "error-container", children: [_jsxs("div", { className: "error-tip", children: [_jsx(Icon, { type: "error", size: "s" }), _jsx("p", { children: "\u6570\u636E\u5BFC\u51FA\u5931\u8D25" })] }), _jsx("div", { className: "error-content", children: _jsx(List, { children: Array.isArray(errorMessage)
|
|
128
|
-
? errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.map((i, index) =>
|
|
129
|
+
? errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.map((i, index) => _jsx(List.Item, { children: i }, index))
|
|
129
130
|
: errorMessage }) })] })), status !== 'validateError' && status !== 'error' && (_jsx("div", { className: `status-wrap ${status}`, children: _jsx(Status, { icon: 'blank', size: 'm', style: {
|
|
130
131
|
maxWidth: '430px',
|
|
131
|
-
}, title: status === 'success'
|
|
132
|
-
? '数据导出完成'
|
|
133
|
-
: '数据导出中,请稍候...', description: status === 'success' ? (_jsx("a", { target: '_blank', href: fileImportErrorMessage === null || fileImportErrorMessage === void 0 ? void 0 : fileImportErrorMessage.DownloadUrl, rel: "noreferrer", style: { margin: '0 auto' }, className: "wd-table__a", children: "\u70B9\u51FB\u4E0B\u8F7D" })) : (_jsxs("div", { children: [status === 'timeout'
|
|
134
|
-
? '数据导出耗时较长,请稍后在'
|
|
135
|
-
: '关闭弹窗后,导出任务会继续执行,可在', _jsx("a", { className: "wd-table__a", onClick: () => {
|
|
132
|
+
}, title: status === 'success' ? '数据导出完成' : '数据导出中,请稍候...', description: status === 'success' ? (_jsx("a", { target: '_blank', href: fileImportErrorMessage === null || fileImportErrorMessage === void 0 ? void 0 : fileImportErrorMessage.DownloadUrl, rel: "noreferrer", style: { margin: '0 auto' }, className: "wd-table__a", children: "\u70B9\u51FB\u4E0B\u8F7D" })) : (_jsxs("div", { children: [status === 'timeout' ? '数据导出耗时较长,请稍后在' : '关闭弹窗后,导出任务会继续执行,可在', _jsx("a", { className: "wd-table__a", onClick: () => {
|
|
136
133
|
onCancel();
|
|
137
134
|
handleInOrOutRecordModealVisible('export');
|
|
138
135
|
}, children: "\u6211\u7684\u5BFC\u51FA\u8BB0\u5F55" }), "\u67E5\u770B\u4EFB\u52A1\u8FDB\u5EA6"] })) }) }))] }))] }), _jsxs(Modal.Footer, { children: [step === 'fieldMap' && (_jsx(WdButton, { text: "\u6211\u7684\u5BFC\u51FA\u8BB0\u5F55", variant: "link", style: { float: 'left' }, events: {
|
|
@@ -140,5 +137,5 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
140
137
|
onCancel();
|
|
141
138
|
handleInOrOutRecordModealVisible('export');
|
|
142
139
|
},
|
|
143
|
-
} })), step === 'fieldMap' && (_jsxs(_Fragment, { children: [_jsx(WdButton, { text: "\u53D6\u6D88", events: { tap: onCancel }, theme: "secondary", variant: "outline", className: "wd-btn__margin-right" }), _jsx(WdButton, { text: "\u786E\u5B9A", events: { tap:
|
|
140
|
+
} })), step === 'fieldMap' && (_jsxs(_Fragment, { children: [_jsx(WdButton, { text: "\u53D6\u6D88", events: { tap: onCancel }, theme: "secondary", variant: "outline", className: "wd-btn__margin-right" }), _jsx(WdButton, { text: "\u786E\u5B9A", events: { tap: handleExport }, disabled: !(selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.length) })] }))] })] }));
|
|
144
141
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import lodashSet from 'lodash.set';
|
|
2
|
+
import lodashGet from 'lodash.get';
|
|
3
|
+
import { deepClone } from '../../utils/tool';
|
|
4
|
+
import { NOT_EXISTED_VALUE } from '../../utils/constant';
|
|
2
5
|
function getFormDetailValueIsNull({ formData, formItemMap, }) {
|
|
3
6
|
const formDetailList = [];
|
|
4
7
|
formItemMap.forEach((items, name) => {
|
|
@@ -40,3 +43,17 @@ export function getErrorObjectFromValidateResult(errObj) {
|
|
|
40
43
|
return acc;
|
|
41
44
|
}, {});
|
|
42
45
|
}
|
|
46
|
+
// 表单容器上挂载的表单项的值
|
|
47
|
+
export const convertFormData = (formData, formItemMapList, fieldInitValueCache) => {
|
|
48
|
+
const data = {};
|
|
49
|
+
formItemMapList.forEach((i) => {
|
|
50
|
+
const namePath = i;
|
|
51
|
+
const value = lodashGet(formData, namePath, NOT_EXISTED_VALUE);
|
|
52
|
+
// 表单容器内不包含的表单项,不赋值
|
|
53
|
+
if (value !== NOT_EXISTED_VALUE) {
|
|
54
|
+
lodashSet(data, namePath, value);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const _fieldInitValueCache = deepClone(fieldInitValueCache);
|
|
58
|
+
return Object.assign(_fieldInitValueCache, data);
|
|
59
|
+
};
|
|
@@ -227,7 +227,7 @@ export function useRemoteParamsFromValue({ dataSourceProfile, formData, formType
|
|
|
227
227
|
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;
|
|
228
228
|
acc[cur] = formData[cur];
|
|
229
229
|
if (SINGLE_SELECT_FORMATS.includes(format)) {
|
|
230
|
-
acc[cur] = { _id: formData[cur] };
|
|
230
|
+
acc[cur] = { _id: formData[cur] || '' };
|
|
231
231
|
}
|
|
232
232
|
if (MULTI_SELECT_FORMATS.includes(format)) {
|
|
233
233
|
acc[cur] = (_d = acc[cur]) === null || _d === void 0 ? void 0 : _d.map((_id) => ({ _id }));
|
|
@@ -17,12 +17,12 @@ import lodashGet from 'lodash.get';
|
|
|
17
17
|
import lodashSet from 'lodash.set';
|
|
18
18
|
import { useDataSource } from '../../utils/hooks/useDataSource';
|
|
19
19
|
import { WdForm as FormUi } from './wd-form';
|
|
20
|
-
import
|
|
20
|
+
import StatusContent from '../statusContent';
|
|
21
21
|
import { deepClone } from '../../utils/tool';
|
|
22
22
|
import isObjectEqual from '../../utils/isObjectEqual';
|
|
23
23
|
import { convertMethodParam } from '../../utils/hooks/useFormLegacy';
|
|
24
24
|
import '../style';
|
|
25
|
-
import { getErrorObjectFromValidateResult } from './form-utils';
|
|
25
|
+
import { getErrorObjectFromValidateResult, convertFormData } from './form-utils';
|
|
26
26
|
import { isNil } from '../../utils/lodash';
|
|
27
27
|
import { FormTypeProvider } from './contexts/form-type-context';
|
|
28
28
|
import { FormLayoutProvider } from './contexts/form-layout-context';
|
|
@@ -33,7 +33,7 @@ import useDebouncedCallback from '../../utils/hooks/use-debounced-callback';
|
|
|
33
33
|
const SET_VALUE_DEBOUNCE_TIMEOUT = 250;
|
|
34
34
|
const logger = debug('wd-form');
|
|
35
35
|
const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
36
|
-
var _a, _b, _c
|
|
36
|
+
var _a, _b, _c;
|
|
37
37
|
const { className, id, style, contentSlot: contentSlotEl, layout = 'horizontal', formType = 'create', _id, datasourceType = 'model', dataSourceName, methodGetItem, methodCreate, methodUpdate, paramGetItem, appCloud = tcbAppCloud, lgWidth, labelAlign = 'left', initialValues: _initialValues,
|
|
38
38
|
// 兼容流程setValue调用,其他地方别用
|
|
39
39
|
$node, $widget, } = props;
|
|
@@ -76,32 +76,14 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
76
76
|
// 表单值
|
|
77
77
|
const [formData, setFormData] = useState((_c = deepClone(_initialValues)) !== null && _c !== void 0 ? _c : emptyObject);
|
|
78
78
|
// 转换后表单值,仅保留已挂载表单项的值
|
|
79
|
-
const
|
|
79
|
+
const formFieldsValue = useMemo(() => {
|
|
80
|
+
return convertFormData(formData, formItemMapList, fieldInitValueCache);
|
|
81
|
+
}, [formData, formItemMapList, fieldInitValueCache]);
|
|
80
82
|
useDebouncedEffect(() => {
|
|
81
83
|
var _a, _b;
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
formItemMapList.forEach((i) => {
|
|
86
|
-
const namePath = i;
|
|
87
|
-
const value = lodashGet(formData, namePath, NOT_EXISTED_VALUE);
|
|
88
|
-
// 表单容器内不包含的表单项,不赋值
|
|
89
|
-
if (value !== NOT_EXISTED_VALUE) {
|
|
90
|
-
lodashSet(data, namePath, value);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
if (setNull) {
|
|
94
|
-
lodashSet(data, namePath, null);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const _fieldInitValueCache = deepClone(fieldInitValueCache);
|
|
99
|
-
return Object.assign(_fieldInitValueCache, data);
|
|
100
|
-
};
|
|
101
|
-
const _data = convertFormData(formData);
|
|
102
|
-
setFormFieldsValue(_data);
|
|
103
|
-
(_b = (_a = eventsRef === null || eventsRef === void 0 ? void 0 : eventsRef.current) === null || _a === void 0 ? void 0 : _a.onDataChange) === null || _b === void 0 ? void 0 : _b.call(_a, { data: _data });
|
|
104
|
-
}, [formData, fieldInitValueCache],
|
|
84
|
+
// 表单容器上挂载的表单项的值
|
|
85
|
+
(_b = (_a = eventsRef === null || eventsRef === void 0 ? void 0 : eventsRef.current) === null || _a === void 0 ? void 0 : _a.onDataChange) === null || _b === void 0 ? void 0 : _b.call(_a, { data: formFieldsValue });
|
|
86
|
+
}, [formFieldsValue],
|
|
105
87
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
106
88
|
SET_VALUE_DEBOUNCE_TIMEOUT);
|
|
107
89
|
const eventsRef = useSyncedRef(props.events);
|
|
@@ -508,7 +490,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
508
490
|
return `${layout}-${labelAlign}`;
|
|
509
491
|
}, [layout, labelAlign]);
|
|
510
492
|
const getFieldValue = useCallback(({ namePath, initialValue }) => {
|
|
511
|
-
const value = lodashGet(
|
|
493
|
+
const value = lodashGet(formData, namePath, NOT_EXISTED_VALUE);
|
|
512
494
|
if (value !== NOT_EXISTED_VALUE) {
|
|
513
495
|
return value;
|
|
514
496
|
}
|
|
@@ -520,7 +502,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
520
502
|
}
|
|
521
503
|
return null;
|
|
522
504
|
}
|
|
523
|
-
}, [
|
|
505
|
+
}, [formData]);
|
|
524
506
|
const setFieldValue = useCallback(({ namePath, value }) => {
|
|
525
507
|
setFormData((formData) => {
|
|
526
508
|
const _formData = deepClone(formData);
|
|
@@ -536,16 +518,9 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
536
518
|
return _formData;
|
|
537
519
|
});
|
|
538
520
|
}, []);
|
|
539
|
-
if (initValueLoadingStatus === '
|
|
540
|
-
return
|
|
521
|
+
if (initValueLoadingStatus === 'loading' && !fetchedInitialValues) {
|
|
522
|
+
return _jsx(StatusContent, { emptyText: '数据加载中,请稍候...', component: "table", icon: "loading" });
|
|
541
523
|
}
|
|
542
|
-
|
|
543
|
-
// return (
|
|
544
|
-
// <ConfigProvider classPrefix="wedatea2td">
|
|
545
|
-
// <StatusTip status="loading" loadingText="数据加载中..." />
|
|
546
|
-
// </ConfigProvider>
|
|
547
|
-
// );
|
|
548
|
-
// }
|
|
549
|
-
return (_jsx(FormWidgetProvider, { "$widget": $widget, children: _jsx(FormLayoutProvider, { layout: layout, children: _jsx(FormTypeProvider, { formType: formType, children: _jsx(FormFieldProvider, { setFieldValue: setFieldValue, isInformContainer: isInformContainer, getFieldValue: getFieldValue, children: _jsx(FormUi, { layout: layout, className: cls, style: style, id: id, lgWidth: lgWidth, labelPosition: labelPosition, children: initValueFetchError ? (_jsx(EmptyContent, { emptyText: '数据加载失败', errorObj: initValueFetchError, icon: 'error', isH5: isH5 })) : (contentSlot) }) }) }) }) }));
|
|
524
|
+
return (_jsx(FormWidgetProvider, { "$widget": $widget, children: _jsx(FormLayoutProvider, { layout: layout, children: _jsx(FormTypeProvider, { formType: formType, children: _jsx(FormFieldProvider, { setFieldValue: setFieldValue, isInformContainer: isInformContainer, getFieldValue: getFieldValue, children: _jsx(FormUi, { layout: layout, className: cls, style: style, id: id, lgWidth: lgWidth, labelPosition: labelPosition, children: initValueFetchError ? (_jsx(StatusContent, { emptyText: '数据加载失败', errorObj: initValueFetchError, icon: 'error', isH5: isH5 })) : (contentSlot) }) }) }) }) }));
|
|
550
525
|
});
|
|
551
526
|
export default React.memo(WdForm);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useMemo
|
|
2
|
+
import { useState, useRef, useMemo } from 'react';
|
|
3
|
+
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
3
4
|
import { Select, SelectMultiple, List } from 'tea-component';
|
|
4
5
|
import { WdFormItemReadOnly } from '../../wd-form-item';
|
|
5
6
|
import { Modal } from '../../wd-date/elements/Modal.h5';
|
|
@@ -12,12 +13,12 @@ import AllEmpty from '../../form/select/status/allEmpty';
|
|
|
12
13
|
import { X_RUNTIME_DEFAULT } from '../../../../configs/type-utils/x-runtime-default';
|
|
13
14
|
import '../style';
|
|
14
15
|
const OptionList = ({ options, inputFocus, currentSelected, optionClick, bottomTips, onScrollBottom }) => {
|
|
15
|
-
return (_jsxs(List, { className: "weda-ui-custom-picker__column", style: {
|
|
16
|
+
return (_jsxs(List, { className: "weda-ui-custom-picker__column wd-select-list", style: {
|
|
16
17
|
height: inputFocus ? 'calc(100vh - 190px)' : '250px',
|
|
17
18
|
}, onScrollBottom: onScrollBottom, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
|
|
18
19
|
// is-selected 选中态
|
|
19
20
|
// is-disabled 禁用态
|
|
20
|
-
const itemCls = classNames('weda-ui-custom-picker__column-item', {
|
|
21
|
+
const itemCls = classNames('weda-ui-custom-picker__column-item', 'wd-select-list-item', {
|
|
21
22
|
'is-selected': currentSelected.find((i) => i.value === item.value),
|
|
22
23
|
'is-disabled': item.disabled,
|
|
23
24
|
});
|
|
@@ -30,14 +31,15 @@ const getSelectedItem = (options = [], value) => {
|
|
|
30
31
|
};
|
|
31
32
|
function SelectH5(props) {
|
|
32
33
|
const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, filterable, onBlur, onFocus, } = props;
|
|
34
|
+
const { classPrefix } = useConfig();
|
|
33
35
|
const isMultiple = mode === 'multiple';
|
|
34
36
|
const customPickerCls = classNames('weda-ui-custom-picker__columns', {
|
|
35
37
|
'weda-ui-custom-picker__columns--select-multiple': isMultiple,
|
|
36
38
|
'weda-ui-custom-picker__columns--select': !isMultiple,
|
|
37
39
|
[`${overlayClassName}`]: true,
|
|
40
|
+
[`${classPrefix}-select-modal__columns`]: true,
|
|
38
41
|
});
|
|
39
42
|
const [visible, setVisible] = useState(false);
|
|
40
|
-
const { classPrefix } = useConfig();
|
|
41
43
|
const inputCls = `${classPrefix}-form-select_input`;
|
|
42
44
|
const focusRef = useRef();
|
|
43
45
|
// 聚焦在搜索框
|
|
@@ -133,7 +135,7 @@ function SelectH5(props) {
|
|
|
133
135
|
else {
|
|
134
136
|
setVisible(false);
|
|
135
137
|
}
|
|
136
|
-
}, onOk: handleOk, header: inputFocus, className: `${classPrefix}-
|
|
138
|
+
}, onOk: handleOk, header: inputFocus, className: `${classPrefix}-select-modal`, okButtonVisible: isMultiple, popupContainer: popupContainer, children: [searchable && renderSearch(), _jsx("div", { className: `${classPrefix}-custom-view-content`, children: !bottomTips && !(customOptions === null || customOptions === void 0 ? void 0 : customOptions.length) ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsxs("div", { children: [_jsx("div", { className: customPickerCls, "data-testid": "weda-ui-custom-picker__columns", style: {
|
|
137
139
|
height: inputFocus ? 'calc(100vh - 160px)' : '280px',
|
|
138
140
|
}, children: _jsx(OptionList, { onScrollBottom: onScrollBottom, options: customOptions, inputFocus: inputFocus, currentSelected: currentSelected, optionClick: optionClick, bottomTips: bottomTips }) }), footer] })) })] })] }));
|
|
139
141
|
}
|
|
@@ -142,14 +144,14 @@ export function SelectUI(props) {
|
|
|
142
144
|
const platform = usePlatform();
|
|
143
145
|
const [currentOption] = useSyncValue((options === null || options === void 0 ? void 0 : options.map(({ label, value }) => ({ label, value }))) || [], isObjectEqual);
|
|
144
146
|
// 更新option,从而更新最新的选项值
|
|
145
|
-
|
|
147
|
+
useDeepCompareEffect(() => {
|
|
146
148
|
if (setAllOption) {
|
|
147
149
|
setAllOption(currentOption);
|
|
148
150
|
}
|
|
149
151
|
}, [currentOption, setAllOption]);
|
|
150
152
|
const isMultiple = mode === 'multiple';
|
|
151
153
|
const [selectedItem, setSelectedItem] = useState([]);
|
|
152
|
-
|
|
154
|
+
useDeepCompareEffect(() => {
|
|
153
155
|
// 缓存展示的选中项
|
|
154
156
|
setSelectedItem((selectItem) => {
|
|
155
157
|
const newSelectItem = getSelectedItem(options, value);
|
|
@@ -19,7 +19,7 @@ import { SelectProvider } from './contexts/selectContext';
|
|
|
19
19
|
* 下拉单选-标准化
|
|
20
20
|
*/
|
|
21
21
|
export const WdSelect = forwardRef(function WsSelect(props, ref) {
|
|
22
|
-
const { classRoot = 'select', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, format, tipBlock = X_RUNTIME_DEFAULT.tipBlock, where = X_RUNTIME_DEFAULT.where, enumName, primaryField, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
|
|
22
|
+
const { classRoot = 'select', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range = [], format, tipBlock = X_RUNTIME_DEFAULT.tipBlock, where = X_RUNTIME_DEFAULT.where, enumName, primaryField, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
|
|
23
23
|
selectFieldType = 'primary', searchPlaceholder, searchable = X_RUNTIME_DEFAULT.searchable, filterable = X_RUNTIME_DEFAULT.filterable, selectFieldLabel, } = props;
|
|
24
24
|
const childRef = useRef(null);
|
|
25
25
|
// 是否是关联
|
|
@@ -20,7 +20,7 @@ import { SelectProvider } from '../wd-select/contexts/selectContext';
|
|
|
20
20
|
* 下拉多选-标准化
|
|
21
21
|
*/
|
|
22
22
|
export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref) {
|
|
23
|
-
const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, where = X_RUNTIME_DEFAULT.where, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
|
|
23
|
+
const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range = [], enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, where = X_RUNTIME_DEFAULT.where, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
|
|
24
24
|
selectFieldType = 'primary', searchPlaceholder, searchable = X_RUNTIME_DEFAULT.searchable, filterable = X_RUNTIME_DEFAULT.filterable, selectFieldLabel, } = props;
|
|
25
25
|
const childRef = useRef(null);
|
|
26
26
|
// 是否是关联
|
|
@@ -3,7 +3,7 @@ import { useState, useCallback, useRef, useEffect } from 'react';
|
|
|
3
3
|
import { useConfig } from '../../utils/config-context';
|
|
4
4
|
import { usePlatform } from '../../utils/platform';
|
|
5
5
|
import WdIcon from '../wd-icon';
|
|
6
|
-
import { useSyncedRef } from '@react-hookz/web';
|
|
6
|
+
import { useDebouncedCallback, useSyncedRef } from '@react-hookz/web';
|
|
7
7
|
import { renderSlot } from './util';
|
|
8
8
|
export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProps }) => {
|
|
9
9
|
const { classPrefix } = useConfig();
|
|
@@ -35,16 +35,14 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
35
35
|
data[index] += i === null || i === void 0 ? void 0 : i.clientWidth;
|
|
36
36
|
}
|
|
37
37
|
itemData.set(itemIndex, {
|
|
38
|
-
offset: itemData.get(itemIndex - Number('1'))['offset'] +
|
|
39
|
-
itemData.get(itemIndex - Number('1'))['clientWidth'],
|
|
38
|
+
offset: itemData.get(itemIndex - Number('1'))['offset'] + itemData.get(itemIndex - Number('1'))['clientWidth'],
|
|
40
39
|
clientWidth: i === null || i === void 0 ? void 0 : i.clientWidth,
|
|
41
40
|
});
|
|
42
41
|
itemIndex = itemIndex + Number('1');
|
|
43
42
|
}
|
|
44
43
|
// 计算右侧是否显示遮罩
|
|
45
44
|
const paddingWidth = 16;
|
|
46
|
-
const showMask = itemData.get(menuItem.length)['offset'] +
|
|
47
|
-
itemData.get(menuItem.length)['clientWidth'] >
|
|
45
|
+
const showMask = itemData.get(menuItem.length)['offset'] + itemData.get(menuItem.length)['clientWidth'] >
|
|
48
46
|
parentWidth + paddingWidth;
|
|
49
47
|
setShowMask(showMask);
|
|
50
48
|
setItemOffsetData(itemData);
|
|
@@ -58,10 +56,16 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
58
56
|
useEffect(() => {
|
|
59
57
|
setSelectedTab(selectedIndex);
|
|
60
58
|
}, [selectedIndex]);
|
|
59
|
+
const debouncedChangeEvent = useDebouncedCallback((value) => {
|
|
60
|
+
var _a;
|
|
61
|
+
(_a = restProps === null || restProps === void 0 ? void 0 : restProps.events) === null || _a === void 0 ? void 0 : _a.change(value);
|
|
62
|
+
}, [restProps],
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
64
|
+
300);
|
|
61
65
|
// 渲染菜单
|
|
62
66
|
const RenderTabItem = (index, item) => {
|
|
63
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: () => {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
65
69
|
if (!(item === null || item === void 0 ? void 0 : item.isDisabled) && !(item === null || item === void 0 ? void 0 : item.selected)) {
|
|
66
70
|
if (restProps.direction !== 'vertical') {
|
|
67
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;
|
|
@@ -77,8 +81,7 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
77
81
|
itemOffset >
|
|
78
82
|
parentWidths) {
|
|
79
83
|
(_k = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _k === void 0 ? void 0 : _k.scrollTo(((_l = itemOffsetData.get(index + Number('1'))) === null || _l === void 0 ? void 0 : _l.offset) -
|
|
80
|
-
(parentWidths -
|
|
81
|
-
((_m = itemOffsetData.get(index + Number('1'))) === null || _m === void 0 ? void 0 : _m.clientWidth)), 0);
|
|
84
|
+
(parentWidths - ((_m = itemOffsetData.get(index + Number('1'))) === null || _m === void 0 ? void 0 : _m.clientWidth)), 0);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
setSelectedTab(index);
|
|
@@ -86,13 +89,11 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
86
89
|
// HACK widget 时序
|
|
87
90
|
if ((_p = (_o = $node.current) === null || _o === void 0 ? void 0 : _o._getInstanceRef()) === null || _p === void 0 ? void 0 : _p.current) {
|
|
88
91
|
const currentSelectedValue = item === null || item === void 0 ? void 0 : item.value;
|
|
89
|
-
if (currentSelectedValue !==
|
|
90
|
-
$node.current._getInstanceRef().current.selectedValue
|
|
91
|
-
$node.current._getInstanceRef().current.selectedValue =
|
|
92
|
-
currentSelectedValue;
|
|
92
|
+
if (currentSelectedValue !== $node.current._getInstanceRef().current.selectedValue) {
|
|
93
|
+
$node.current._getInstanceRef().current.selectedValue = currentSelectedValue;
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
(
|
|
96
|
+
debouncedChangeEvent({ value: item === null || item === void 0 ? void 0 : item.value });
|
|
96
97
|
}
|
|
97
98
|
}, 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] }));
|
|
98
99
|
};
|