@ant-design/agentic-ui 2.30.15 → 2.30.19
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/Bubble/AIBubble.js +3 -2
- package/dist/Bubble/ContentFilemapView.d.ts +2 -0
- package/dist/Bubble/ContentFilemapView.js +9 -6
- package/dist/Bubble/MessagesContent/index.js +7 -7
- package/dist/Bubble/UserBubble.js +2 -1
- package/dist/Hooks/useLanguage.d.ts +28 -1
- package/dist/I18n/locales.d.ts +28 -1
- package/dist/I18n/locales.js +64 -4
- package/dist/MarkdownEditor/editor/elements/Code/index.js +12 -0
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +5 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +55 -5
- package/dist/MarkdownInputField/FileMapView/index.js +1 -7
- package/dist/MarkdownInputField/FileMapView/style.js +1 -2
- package/dist/MarkdownInputField/MarkdownInputField.js +16 -5
- package/dist/MarkdownInputField/SendActions/index.js +2 -2
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +1 -0
- package/dist/MarkdownInputField/style.js +24 -1
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +3 -3
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +1 -1
- package/dist/Plugins/chart/ChartRender.js +3 -1
- package/dist/Plugins/chart/DonutChart/index.js +1 -1
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +56 -2
- package/dist/Plugins/code/components/CodeToolbar.js +1 -1
- package/dist/Schema/SchemaForm/index.js +18 -9
- package/dist/Workspace/File/FileComponent.js +178 -103
- package/dist/Workspace/File/FileTypeProcessor.js +1 -4
- package/dist/Workspace/File/PreviewComponent.js +6 -6
- package/dist/Workspace/File/index.d.ts +1 -0
- package/dist/Workspace/File/index.js +1 -0
- package/dist/Workspace/File/style.js +20 -0
- package/dist/Workspace/File/utils.js +4 -2
- package/dist/Workspace/types.d.ts +8 -1
- package/dist/Workspace/types.js +74 -35
- package/package.json +1 -2
|
@@ -135,6 +135,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
135
135
|
import { ConfigProvider } from "antd";
|
|
136
136
|
import classNames from "clsx";
|
|
137
137
|
import React, { memo, useContext, useState } from "react";
|
|
138
|
+
import { TextLoading } from "../Components/lotties/TextLoading";
|
|
139
|
+
import { useLocale } from "../I18n";
|
|
138
140
|
import { BaseMarkdownEditor } from "../MarkdownEditor";
|
|
139
141
|
import { BorderBeamAnimation } from "./BorderBeamAnimation";
|
|
140
142
|
import { useFileUploadManager } from "./FileUploadManager";
|
|
@@ -167,7 +169,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
167
169
|
* @param {string} [props.placeholder] - 占位符文本
|
|
168
170
|
* @param {string} [props.triggerSendKey='Enter'] - 触发发送的快捷键(Enter 发送,Shift+Enter 换行)
|
|
169
171
|
* @param {boolean} [props.disabled] - 是否禁用
|
|
170
|
-
* @param {boolean} [props.typing] -
|
|
172
|
+
* @param {boolean} [props.typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
171
173
|
* @param {AttachmentProps} [props.attachment] - 附件配置
|
|
172
174
|
* @param {string[]} [props.bgColorList] - 背景颜色列表,推荐使用3-4种颜色
|
|
173
175
|
* @param {React.RefObject} [props.inputRef] - 输入框引用
|
|
@@ -213,6 +215,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
213
215
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
214
216
|
var baseCls = getPrefixCls('agentic-md-input-field');
|
|
215
217
|
var _useStyle = useStyle(baseCls, props.disableHoverAnimation), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
218
|
+
var locale = useLocale();
|
|
216
219
|
// 状态管理
|
|
217
220
|
var _useMarkdownInputFieldState = useMarkdownInputFieldState({
|
|
218
221
|
value: props.value,
|
|
@@ -305,6 +308,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
305
308
|
isHover: isHover,
|
|
306
309
|
isLoading: isLoading
|
|
307
310
|
});
|
|
311
|
+
var editorReadonly = isLoading || !!props.typing;
|
|
308
312
|
var sendActionsNode = useSendActionsNode({
|
|
309
313
|
props: {
|
|
310
314
|
attachment: attachment,
|
|
@@ -356,7 +360,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
356
360
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
357
361
|
ref: inputRef,
|
|
358
362
|
"data-testid": testId !== null && testId !== void 0 ? testId : MARKDOWN_INPUT_FIELD_TEST_IDS.ROOT,
|
|
359
|
-
className: classNames(baseCls, hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-disabled"), props.disabled), _define_property(_obj, "".concat(baseCls, "-skill-mode"), (_props_skillMode = props.skillMode) === null || _props_skillMode === void 0 ? void 0 : _props_skillMode.open), _define_property(_obj, "".concat(baseCls, "-typing"),
|
|
363
|
+
className: classNames(baseCls, hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-disabled"), props.disabled), _define_property(_obj, "".concat(baseCls, "-skill-mode"), (_props_skillMode = props.skillMode) === null || _props_skillMode === void 0 ? void 0 : _props_skillMode.open), _define_property(_obj, "".concat(baseCls, "-typing"), !!props.typing), _define_property(_obj, "".concat(baseCls, "-loading"), isLoading), _define_property(_obj, "".concat(baseCls, "-is-multi-row"), isMultiRowLayout), _define_property(_obj, "".concat(baseCls, "-enlarged"), isEnlarged), _define_property(_obj, "".concat(baseCls, "-focused"), isFocused), _define_property(_obj, "".concat(baseCls, "-has-tools-wrapper"), !!props.toolsRender), _obj)),
|
|
360
364
|
style: _object_spread_props(_object_spread({}, props.style, enlargedStyle), {
|
|
361
365
|
height: isEnlarged ? "".concat((_ref = (_props_enlargeable = props.enlargeable) === null || _props_enlargeable === void 0 ? void 0 : _props_enlargeable.height) !== null && _ref !== void 0 ? _ref : 980, "px") : "min(".concat(collapsedHeightPx, "px,100%)"),
|
|
362
366
|
borderRadius: borderRadius || 12,
|
|
@@ -397,7 +401,14 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
397
401
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
398
402
|
className: classNames("".concat(baseCls, "-editor-content"), hashId),
|
|
399
403
|
"data-testid": MARKDOWN_INPUT_FIELD_TEST_IDS.EDITOR_CONTENT
|
|
400
|
-
}, attachmentList, /*#__PURE__*/ React.createElement(
|
|
404
|
+
}, attachmentList, (props.typing || isLoading) && !value && /*#__PURE__*/ React.createElement("div", {
|
|
405
|
+
className: classNames("".concat(baseCls, "-typing-hint"), hashId),
|
|
406
|
+
"aria-live": "polite",
|
|
407
|
+
"aria-label": locale['input.typing.hint']
|
|
408
|
+
}, /*#__PURE__*/ React.createElement(TextLoading, {
|
|
409
|
+
text: locale['input.typing.hint'],
|
|
410
|
+
fontSize: 13
|
|
411
|
+
})), /*#__PURE__*/ React.createElement(BaseMarkdownEditor, _object_spread({
|
|
401
412
|
editorRef: markdownEditorRef,
|
|
402
413
|
leafRender: props.leafRender,
|
|
403
414
|
style: {
|
|
@@ -412,7 +423,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
412
423
|
floatBar: {
|
|
413
424
|
enable: false
|
|
414
425
|
},
|
|
415
|
-
readonly:
|
|
426
|
+
readonly: editorReadonly,
|
|
416
427
|
contentStyle: {
|
|
417
428
|
alignItems: 'flex-start',
|
|
418
429
|
padding: 'var(--padding-3x)',
|
|
@@ -475,7 +486,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
475
486
|
onFileMapChange: setFileMap,
|
|
476
487
|
isHover: isHover,
|
|
477
488
|
isLoading: isLoading,
|
|
478
|
-
disabled: props.disabled,
|
|
489
|
+
disabled: props.disabled || !!props.typing,
|
|
479
490
|
fileUploadStatus: fileUploadStatus,
|
|
480
491
|
refinePrompt: props.refinePrompt,
|
|
481
492
|
editorRef: markdownEditorRef,
|
|
@@ -90,13 +90,13 @@ import { MARKDOWN_INPUT_FIELD_TEST_IDS } from "../testIds";
|
|
|
90
90
|
var _attachment_onFileMapChange;
|
|
91
91
|
attachment === null || attachment === void 0 ? void 0 : (_attachment_onFileMapChange = attachment.onFileMapChange) === null || _attachment_onFileMapChange === void 0 ? void 0 : _attachment_onFileMapChange.call(attachment, fileMap);
|
|
92
92
|
},
|
|
93
|
-
disabled: !fileUploadDone || (attachment === null || attachment === void 0 ? void 0 : attachment.disabled)
|
|
93
|
+
disabled: !fileUploadDone || (attachment === null || attachment === void 0 ? void 0 : attachment.disabled) || !!typing
|
|
94
94
|
})) : null,
|
|
95
95
|
voiceRecognizer ? /*#__PURE__*/ React.createElement(VoiceInputButton, {
|
|
96
96
|
key: "voice-input-button",
|
|
97
97
|
title: collapseSendActions && defaultActionsLen > 2 ? (locale === null || locale === void 0 ? void 0 : locale['input.voiceInput']) || '语音输入' : '',
|
|
98
98
|
recording: recording,
|
|
99
|
-
disabled: disabled,
|
|
99
|
+
disabled: disabled || !!typing,
|
|
100
100
|
onStart: onStartRecording || function() {
|
|
101
101
|
return Promise.resolve();
|
|
102
102
|
},
|
|
@@ -389,6 +389,7 @@ import { getFileListFromDataTransferItems } from "../FilePaste";
|
|
|
389
389
|
var handleContainerClick = useRefFunction(function(e) {
|
|
390
390
|
var _markdownEditorRef_current_markdownEditorRef, _markdownEditorRef_current;
|
|
391
391
|
if (props.disabled) return;
|
|
392
|
+
if (props.typing) return;
|
|
392
393
|
var editor = markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : (_markdownEditorRef_current_markdownEditorRef = _markdownEditorRef_current.markdownEditorRef) === null || _markdownEditorRef_current_markdownEditorRef === void 0 ? void 0 : _markdownEditorRef_current_markdownEditorRef.current;
|
|
393
394
|
if (!editor) return;
|
|
394
395
|
try {
|
|
@@ -198,7 +198,8 @@ var genStyle = function genStyle(token) {
|
|
|
198
198
|
maxHeight: 'inherit',
|
|
199
199
|
minHeight: 0,
|
|
200
200
|
borderRadius: 'inherit',
|
|
201
|
-
overflow: 'hidden'
|
|
201
|
+
overflow: 'hidden',
|
|
202
|
+
position: 'relative'
|
|
202
203
|
}, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
|
|
203
204
|
padding: "".concat(MOBILE_PADDING, " !important")
|
|
204
205
|
}),
|
|
@@ -215,6 +216,28 @@ var genStyle = function genStyle(token) {
|
|
|
215
216
|
'&-loading': {
|
|
216
217
|
cursor: 'not-allowed'
|
|
217
218
|
},
|
|
219
|
+
'&-typing': {
|
|
220
|
+
cursor: 'not-allowed'
|
|
221
|
+
},
|
|
222
|
+
'&-typing-hint': {
|
|
223
|
+
position: 'absolute',
|
|
224
|
+
left: 'var(--padding-3x)',
|
|
225
|
+
top: '50%',
|
|
226
|
+
transform: 'translateY(-50%)',
|
|
227
|
+
pointerEvents: 'none',
|
|
228
|
+
zIndex: 10,
|
|
229
|
+
display: 'flex',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
gap: 6,
|
|
232
|
+
color: 'rgba(0,0,0,0.35)',
|
|
233
|
+
fontSize: 13,
|
|
234
|
+
userSelect: 'none'
|
|
235
|
+
},
|
|
236
|
+
'&-typing-hint-dots': {
|
|
237
|
+
display: 'inline-flex',
|
|
238
|
+
gap: 3,
|
|
239
|
+
alignItems: 'center'
|
|
240
|
+
},
|
|
218
241
|
'&-send-tools': {
|
|
219
242
|
boxSizing: 'border-box',
|
|
220
243
|
display: 'flex',
|
|
@@ -14,7 +14,7 @@ import type { CreateRecognizer } from '../VoiceInput';
|
|
|
14
14
|
* @property {React.CSSProperties} [style] - 应用于输入字段的内联样式
|
|
15
15
|
* @property {string} [className] - 应用于输入字段的 CSS 类名
|
|
16
16
|
* @property {boolean} [disabled] - 是否禁用输入字段
|
|
17
|
-
* @property {boolean} [typing] -
|
|
17
|
+
* @property {boolean} [typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
18
18
|
* @property {'Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键(Enter 发送,Shift+Enter 换行)
|
|
19
19
|
* @property {function} [onSend] - 当内容发送时触发的异步回调函数
|
|
20
20
|
*/
|
|
@@ -51,8 +51,8 @@ export type MarkdownInputFieldProps = {
|
|
|
51
51
|
*/
|
|
52
52
|
disabled?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @example typing={
|
|
54
|
+
* 为 true 时表示 AI 正在回复等场景:输入区只读、展示 typing 提示,且不可上传附件或语音输入。
|
|
55
|
+
* @example typing={isAssistantStreaming}
|
|
56
56
|
*/
|
|
57
57
|
typing?: boolean;
|
|
58
58
|
/**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @property {React.CSSProperties} [style] - 应用于输入字段的内联样式
|
|
9
9
|
* @property {string} [className] - 应用于输入字段的 CSS 类名
|
|
10
10
|
* @property {boolean} [disabled] - 是否禁用输入字段
|
|
11
|
-
* @property {boolean} [typing] -
|
|
11
|
+
* @property {boolean} [typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
12
12
|
* @property {'Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键(Enter 发送,Shift+Enter 换行)
|
|
13
13
|
* @property {function} [onSend] - 当内容发送时触发的异步回调函数
|
|
14
14
|
*/ export { };
|
|
@@ -408,6 +408,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
408
408
|
var i18n = useContext(I18nContext);
|
|
409
409
|
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, BoxPlotChart = runtime.BoxPlotChart, HistogramChart = runtime.HistogramChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
410
410
|
if (chartType === 'pie') {
|
|
411
|
+
var pieSize = (config === null || config === void 0 ? void 0 : config.height) || 400;
|
|
411
412
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
412
413
|
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-pie"),
|
|
413
414
|
data: convertDonutData,
|
|
@@ -417,7 +418,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
417
418
|
showLegend: true
|
|
418
419
|
}
|
|
419
420
|
],
|
|
420
|
-
|
|
421
|
+
width: pieSize,
|
|
422
|
+
height: pieSize,
|
|
421
423
|
title: title,
|
|
422
424
|
showToolbar: true,
|
|
423
425
|
dataTime: dataTime,
|
|
@@ -578,7 +578,7 @@ import { useStyle } from "./style";
|
|
|
578
578
|
'transparent'
|
|
579
579
|
] : resolvedVisibleBackgroundColors.slice(0, values.length),
|
|
580
580
|
hoverBorderColor: chartHoverBorderColor,
|
|
581
|
-
borderWidth: cfg.chartStyle === 'pie' ?
|
|
581
|
+
borderWidth: cfg.chartStyle === 'pie' ? 2 : isMobile ? 1 : 1,
|
|
582
582
|
spacing: isSingleValueMode ? 0 : cfg.chartStyle === 'pie' ? 0 : isDarkTheme ? isMobile ? 4 : 8 : isMobile ? 3 : 6,
|
|
583
583
|
borderRadius: cfg.chartStyle === 'pie' ? 0 : 4,
|
|
584
584
|
hoverOffset: function hoverOffset(ctx) {
|
|
@@ -308,6 +308,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
308
308
|
'workspace.fileProcessError': string;
|
|
309
309
|
'workspace.download': string;
|
|
310
310
|
'workspace.empty': string;
|
|
311
|
+
'workspace.file.showMore': string;
|
|
312
|
+
'workspace.file.showMoreFiles': string;
|
|
311
313
|
'workspace.title': string;
|
|
312
314
|
'workspace.searchPlaceholder': string;
|
|
313
315
|
'workspace.noResultsFor': string;
|
|
@@ -352,7 +354,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
352
354
|
'suggestion.followUp': string;
|
|
353
355
|
'input.fileUpload': string;
|
|
354
356
|
'input.attachmentListTitle': string;
|
|
355
|
-
'chat.fileMapTitle': string;
|
|
356
357
|
'input.voiceInput': string;
|
|
357
358
|
'input.voiceInputting': string;
|
|
358
359
|
'input.placeholder': string;
|
|
@@ -364,6 +365,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
364
365
|
'input.sendButtonTooltip.newline': string;
|
|
365
366
|
'input.sendButtonTooltip.send.mod': string;
|
|
366
367
|
'input.sendButtonTooltip.newline.mod': string;
|
|
368
|
+
'input.typing.hint': string;
|
|
367
369
|
'common.name': string;
|
|
368
370
|
'common.updateTime': string;
|
|
369
371
|
'common.type': string;
|
|
@@ -436,6 +438,31 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
436
438
|
'jinja.template.filter.description': string;
|
|
437
439
|
'jinja.template.setVariable.title': string;
|
|
438
440
|
'jinja.template.setVariable.description': string;
|
|
441
|
+
'schemaForm.invalidFormat': string;
|
|
442
|
+
'schemaForm.mustBeNumber': string;
|
|
443
|
+
'schemaForm.minValue': string;
|
|
444
|
+
'schemaForm.maxValue': string;
|
|
445
|
+
'schemaForm.minItems': string;
|
|
446
|
+
'schemaForm.maxItems': string;
|
|
447
|
+
'schemaForm.addItem': string;
|
|
448
|
+
'schemaForm.deleteItem': string;
|
|
449
|
+
'fileType.plainText': string;
|
|
450
|
+
'fileType.image': string;
|
|
451
|
+
'fileType.video': string;
|
|
452
|
+
'fileType.audio': string;
|
|
453
|
+
'fileType.pdf': string;
|
|
454
|
+
'fileType.word': string;
|
|
455
|
+
'fileType.excel': string;
|
|
456
|
+
'fileType.csv': string;
|
|
457
|
+
'fileType.archive': string;
|
|
458
|
+
'fileType.shell': string;
|
|
459
|
+
'fileType.config': string;
|
|
460
|
+
'fileType.powerpoint': string;
|
|
461
|
+
'workspace.file.unsupportedPreview': string;
|
|
462
|
+
'workspace.file.downloadButton': string;
|
|
463
|
+
'workspace.file.videoNotSupported': string;
|
|
464
|
+
'workspace.file.audioNotSupported': string;
|
|
465
|
+
'workspace.file.fileType': string;
|
|
439
466
|
};
|
|
440
467
|
language: "zh-CN" | "en-US";
|
|
441
468
|
setLanguage?: ((language: "zh-CN" | "en-US") => void) | undefined;
|
|
@@ -704,6 +731,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
704
731
|
'workspace.fileProcessError': string;
|
|
705
732
|
'workspace.download': string;
|
|
706
733
|
'workspace.empty': string;
|
|
734
|
+
'workspace.file.showMore': string;
|
|
735
|
+
'workspace.file.showMoreFiles': string;
|
|
707
736
|
'workspace.title': string;
|
|
708
737
|
'workspace.searchPlaceholder': string;
|
|
709
738
|
'workspace.noResultsFor': string;
|
|
@@ -748,7 +777,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
748
777
|
'suggestion.followUp': string;
|
|
749
778
|
'input.fileUpload': string;
|
|
750
779
|
'input.attachmentListTitle': string;
|
|
751
|
-
'chat.fileMapTitle': string;
|
|
752
780
|
'input.voiceInput': string;
|
|
753
781
|
'input.voiceInputting': string;
|
|
754
782
|
'input.placeholder': string;
|
|
@@ -760,6 +788,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
760
788
|
'input.sendButtonTooltip.newline': string;
|
|
761
789
|
'input.sendButtonTooltip.send.mod': string;
|
|
762
790
|
'input.sendButtonTooltip.newline.mod': string;
|
|
791
|
+
'input.typing.hint': string;
|
|
763
792
|
'common.name': string;
|
|
764
793
|
'common.updateTime': string;
|
|
765
794
|
'common.type': string;
|
|
@@ -832,6 +861,31 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
832
861
|
'jinja.template.filter.description': string;
|
|
833
862
|
'jinja.template.setVariable.title': string;
|
|
834
863
|
'jinja.template.setVariable.description': string;
|
|
864
|
+
'schemaForm.invalidFormat': string;
|
|
865
|
+
'schemaForm.mustBeNumber': string;
|
|
866
|
+
'schemaForm.minValue': string;
|
|
867
|
+
'schemaForm.maxValue': string;
|
|
868
|
+
'schemaForm.minItems': string;
|
|
869
|
+
'schemaForm.maxItems': string;
|
|
870
|
+
'schemaForm.addItem': string;
|
|
871
|
+
'schemaForm.deleteItem': string;
|
|
872
|
+
'fileType.plainText': string;
|
|
873
|
+
'fileType.image': string;
|
|
874
|
+
'fileType.video': string;
|
|
875
|
+
'fileType.audio': string;
|
|
876
|
+
'fileType.pdf': string;
|
|
877
|
+
'fileType.word': string;
|
|
878
|
+
'fileType.excel': string;
|
|
879
|
+
'fileType.csv': string;
|
|
880
|
+
'fileType.archive': string;
|
|
881
|
+
'fileType.shell': string;
|
|
882
|
+
'fileType.config': string;
|
|
883
|
+
'fileType.powerpoint': string;
|
|
884
|
+
'workspace.file.unsupportedPreview': string;
|
|
885
|
+
'workspace.file.downloadButton': string;
|
|
886
|
+
'workspace.file.videoNotSupported': string;
|
|
887
|
+
'workspace.file.audioNotSupported': string;
|
|
888
|
+
'workspace.file.fileType': string;
|
|
835
889
|
}) => void) | undefined;
|
|
836
890
|
}>;
|
|
837
891
|
context: React.ContextType<typeof I18nContext>;
|
|
@@ -158,7 +158,7 @@ import { LoadImage } from "./LoadImage";
|
|
|
158
158
|
width: '1em'
|
|
159
159
|
},
|
|
160
160
|
src: langIconMap.get(((_element_language1 = element.language) === null || _element_language1 === void 0 ? void 0 : _element_language1.toLowerCase()) || '')
|
|
161
|
-
})), /*#__PURE__*/ React.createElement("div", null, element.language
|
|
161
|
+
})), /*#__PURE__*/ React.createElement("div", null, element.language && element.language !== 'plain text' && /*#__PURE__*/ React.createElement("span", null, element.katex ? 'Formula' : element.language === 'html' && element.render ? 'Html Renderer' : element.language))) : // 非只读模式:显示语言选择器
|
|
162
162
|
/*#__PURE__*/ React.createElement(LanguageSelector, languageSelectorProps)), /*#__PURE__*/ React.createElement("div", {
|
|
163
163
|
style: {
|
|
164
164
|
display: 'flex',
|
|
@@ -101,7 +101,7 @@ import { Plus } from "@sofa-design/icons";
|
|
|
101
101
|
import { Button, Card, Form, Input, InputNumber, Select, Space } from "antd";
|
|
102
102
|
import { merge } from "lodash-es";
|
|
103
103
|
import React, { memo, useCallback, useContext, useEffect, useMemo } from "react";
|
|
104
|
-
import { I18nContext } from "../../I18n";
|
|
104
|
+
import { I18nContext, compileTemplate } from "../../I18n";
|
|
105
105
|
/**
|
|
106
106
|
* SchemaForm 组件 - 基于Schema的表单组件
|
|
107
107
|
*
|
|
@@ -169,26 +169,30 @@ import { I18nContext } from "../../I18n";
|
|
|
169
169
|
if (property.type === 'string' && property.pattern) {
|
|
170
170
|
rules.push({
|
|
171
171
|
pattern: new RegExp(property.pattern),
|
|
172
|
-
message: property.patternMessage || "".concat(property.title || property.description || ''
|
|
172
|
+
message: property.patternMessage || "".concat(property.title || property.description || '').concat((locale === null || locale === void 0 ? void 0 : locale['schemaForm.invalidFormat']) || '格式不正确')
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
if (property.type === 'number') {
|
|
176
176
|
rules.push({
|
|
177
177
|
type: 'number',
|
|
178
|
-
message: "".concat(property.title || property.description || ''
|
|
178
|
+
message: "".concat(property.title || property.description || '').concat((locale === null || locale === void 0 ? void 0 : locale['schemaForm.mustBeNumber']) || '必须是数字')
|
|
179
179
|
});
|
|
180
180
|
if (typeof property.minimum === 'number') {
|
|
181
181
|
rules.push({
|
|
182
182
|
type: 'number',
|
|
183
183
|
min: property.minimum,
|
|
184
|
-
message: "".concat(property.title || property.description || ''
|
|
184
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.minValue']) || '不能小于 ${min}', {
|
|
185
|
+
min: String(property.minimum)
|
|
186
|
+
}))
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
if (typeof property.maximum === 'number') {
|
|
188
190
|
rules.push({
|
|
189
191
|
type: 'number',
|
|
190
192
|
max: property.maximum,
|
|
191
|
-
message: "".concat(property.title || property.description || ''
|
|
193
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.maxValue']) || '不能大于 ${max}', {
|
|
194
|
+
max: String(property.maximum)
|
|
195
|
+
}))
|
|
192
196
|
});
|
|
193
197
|
}
|
|
194
198
|
}
|
|
@@ -197,14 +201,18 @@ import { I18nContext } from "../../I18n";
|
|
|
197
201
|
rules.push({
|
|
198
202
|
type: 'array',
|
|
199
203
|
min: property.minItems,
|
|
200
|
-
message: "".concat(property.title || property.description || ''
|
|
204
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.minItems']) || '至少需要 ${min} 项', {
|
|
205
|
+
min: String(property.minItems)
|
|
206
|
+
}))
|
|
201
207
|
});
|
|
202
208
|
}
|
|
203
209
|
if (typeof property.maxItems === 'number') {
|
|
204
210
|
rules.push({
|
|
205
211
|
type: 'array',
|
|
206
212
|
max: property.maxItems,
|
|
207
|
-
message: "".concat(property.title || property.description || ''
|
|
213
|
+
message: "".concat(property.title || property.description || '').concat(compileTemplate((locale === null || locale === void 0 ? void 0 : locale['schemaForm.maxItems']) || '最多只能有 ${max} 项', {
|
|
214
|
+
max: String(property.maxItems)
|
|
215
|
+
}))
|
|
208
216
|
});
|
|
209
217
|
}
|
|
210
218
|
}
|
|
@@ -344,12 +352,13 @@ import { I18nContext } from "../../I18n";
|
|
|
344
352
|
},
|
|
345
353
|
block: true,
|
|
346
354
|
icon: /*#__PURE__*/ React.createElement(Plus, null)
|
|
347
|
-
},
|
|
355
|
+
}, (locale === null || locale === void 0 ? void 0 : locale['schemaForm.addItem']) || '添加', " ", getPropertyTitle(property, key))));
|
|
348
356
|
});
|
|
349
357
|
}, [
|
|
350
358
|
readonly,
|
|
351
359
|
renderArrayItemContent,
|
|
352
|
-
getPropertyTitle
|
|
360
|
+
getPropertyTitle,
|
|
361
|
+
locale
|
|
353
362
|
]);
|
|
354
363
|
// 渲染对象表单项
|
|
355
364
|
var renderObjectFormItem = useCallback(function(key, property, baseName) {
|