@ant-design/agentic-ui 2.12.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatLayout/style.js +17 -0
- package/dist/MarkdownEditor/editor/Editor.js +13 -13
- package/dist/MarkdownEditor/editor/elements/Image/index.js +25 -7
- package/dist/MarkdownEditor/editor/elements/Media.js +127 -34
- package/dist/MarkdownEditor/editor/elements/Schema.js +4 -1
- package/dist/Plugins/chart/index.js +24 -9
- package/dist/Schema/index.d.ts +2 -2
- package/dist/Schema/index.js +1 -2
- package/package.json +1 -1
package/dist/ChatLayout/style.js
CHANGED
|
@@ -51,6 +51,7 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
|
|
54
|
+
var MOBILE_PADDING = 'var(--padding-1x)';
|
|
54
55
|
var genStyle = function(token) {
|
|
55
56
|
return _define_property({}, token.componentCls, {
|
|
56
57
|
display: 'flex',
|
|
@@ -198,6 +199,22 @@ var genStyle = function(token) {
|
|
|
198
199
|
zIndex: 100,
|
|
199
200
|
borderBottomLeftRadius: 'var(--radius-xl)',
|
|
200
201
|
borderBottomRightRadius: 'var(--radius-xl)'
|
|
202
|
+
},
|
|
203
|
+
'@media (max-width: 768px)': {
|
|
204
|
+
'&-header': {
|
|
205
|
+
padding: "0 ".concat(MOBILE_PADDING)
|
|
206
|
+
},
|
|
207
|
+
'&-content': {
|
|
208
|
+
'&-scrollable': {
|
|
209
|
+
paddingTop: MOBILE_PADDING,
|
|
210
|
+
paddingLeft: MOBILE_PADDING,
|
|
211
|
+
paddingRight: MOBILE_PADDING,
|
|
212
|
+
paddingBottom: '144px'
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
'&-footer': {
|
|
216
|
+
padding: MOBILE_PADDING
|
|
217
|
+
}
|
|
201
218
|
}
|
|
202
219
|
});
|
|
203
220
|
};
|
|
@@ -232,17 +232,17 @@ function _ts_generator(thisArg, body) {
|
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
import { useDebounceFn } from "@ant-design/pro-components";
|
|
235
236
|
import classNames from "classnames";
|
|
236
237
|
import React, { useCallback, useContext, useEffect, useMemo, useRef } from "react";
|
|
237
238
|
import { ErrorBoundary } from "react-error-boundary";
|
|
238
239
|
import { Editor, Node, Range, Transforms } from "slate";
|
|
239
|
-
import { parserMdToSchema } from "../BaseMarkdownEditor";
|
|
240
|
-
import { LazyElement } from "./components/LazyElement";
|
|
241
|
-
import { MElement, MLeaf } from "./elements";
|
|
242
|
-
import { useDebounceFn } from "@ant-design/pro-components";
|
|
243
240
|
import { Editable, ReactEditor, Slate } from "slate-react";
|
|
244
241
|
import { useRefFunction } from "../../Hooks/useRefFunction";
|
|
242
|
+
import { parserMdToSchema } from "../BaseMarkdownEditor";
|
|
245
243
|
import { PluginContext } from "../plugin";
|
|
244
|
+
import { LazyElement } from "./components/LazyElement";
|
|
245
|
+
import { MElement, MLeaf } from "./elements";
|
|
246
246
|
import { handleFilesPaste, handleHtmlPaste, handleHttpLinkPaste, handlePlainTextPaste, handleSlateMarkdownFragment, handleSpecialTextPaste, handleTagNodePaste, shouldInsertTextDirectly } from "./plugins/handlePaste";
|
|
247
247
|
import { useHighlight } from "./plugins/useHighlight";
|
|
248
248
|
import { useKeyboard } from "./plugins/useKeyboard";
|
|
@@ -251,6 +251,14 @@ import { useEditorStore } from "./store";
|
|
|
251
251
|
import { useStyle } from "./style";
|
|
252
252
|
import { MARKDOWN_EDITOR_EVENTS, parserSlateNodeToMarkdown } from "./utils";
|
|
253
253
|
import { EditorUtils, findByPathAndText, findLeafPath, getSelectionFromDomSelection, hasEditableTarget, isEventHandled, isPath } from "./utils/editorUtils";
|
|
254
|
+
// 默认允许的类型
|
|
255
|
+
var defaultAllowedTypes = [
|
|
256
|
+
'application/x-slate-md-fragment',
|
|
257
|
+
'text/html',
|
|
258
|
+
'Files',
|
|
259
|
+
'text/markdown',
|
|
260
|
+
'text/plain'
|
|
261
|
+
];
|
|
254
262
|
/**
|
|
255
263
|
* 生成表格最小尺寸配置
|
|
256
264
|
*
|
|
@@ -754,7 +762,7 @@ import { EditorUtils, findByPathAndText, findLeafPath, getSelectionFromDomSelect
|
|
|
754
762
|
* 实际的粘贴处理逻辑
|
|
755
763
|
*/ var handlePasteEvent = /*#__PURE__*/ function() {
|
|
756
764
|
var _ref = _async_to_generator(function(event) {
|
|
757
|
-
var _props_onPaste, _event_clipboardData, pasteConfig, currentTextSelection, nodeList, curNode, types,
|
|
765
|
+
var _props_onPaste, _event_clipboardData, pasteConfig, currentTextSelection, nodeList, curNode, types, allowedTypes, _event_clipboardData_getData, _event_clipboardData_getData1, _event_clipboardData1, text, _event_clipboardData_getData2, _event_clipboardData_getData3, _event_clipboardData2, text1, selection, e;
|
|
758
766
|
return _ts_generator(this, function(_state) {
|
|
759
767
|
switch(_state.label){
|
|
760
768
|
case 0:
|
|
@@ -787,14 +795,6 @@ import { EditorUtils, findByPathAndText, findLeafPath, getSelectionFromDomSelect
|
|
|
787
795
|
types = ((_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.types) || [
|
|
788
796
|
'text/plain'
|
|
789
797
|
];
|
|
790
|
-
// 默认允许的类型
|
|
791
|
-
defaultAllowedTypes = [
|
|
792
|
-
'application/x-slate-md-fragment',
|
|
793
|
-
'text/html',
|
|
794
|
-
'Files',
|
|
795
|
-
'text/markdown',
|
|
796
|
-
'text/plain'
|
|
797
|
-
];
|
|
798
798
|
// 获取允许的类型
|
|
799
799
|
allowedTypes = (pasteConfig === null || pasteConfig === void 0 ? void 0 : pasteConfig.allowedTypes) || defaultAllowedTypes;
|
|
800
800
|
// 1. 首先尝试处理 slate-md-fragment
|
|
@@ -247,7 +247,7 @@ function _ts_generator(thisArg, body) {
|
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
import { BlockOutlined, DeleteFilled, LoadingOutlined } from "@ant-design/icons";
|
|
250
|
+
import { BlockOutlined, DeleteFilled, ExclamationCircleOutlined, LoadingOutlined } from "@ant-design/icons";
|
|
251
251
|
import { Image, Modal, Popover, Space } from "antd";
|
|
252
252
|
import React, { useCallback, useContext, useLayoutEffect, useMemo, useRef } from "react";
|
|
253
253
|
import { useDebounceFn } from "@ant-design/pro-components";
|
|
@@ -286,14 +286,20 @@ import { getMediaType } from "../../utils/dom";
|
|
|
286
286
|
color: '#1890ff',
|
|
287
287
|
textDecoration: 'underline',
|
|
288
288
|
wordBreak: 'break-all',
|
|
289
|
-
display: 'inline-
|
|
289
|
+
display: 'inline-flex',
|
|
290
|
+
alignItems: 'center',
|
|
291
|
+
gap: '8px',
|
|
290
292
|
maxWidth: '100%',
|
|
291
293
|
padding: '8px 12px',
|
|
292
294
|
border: '1px dashed #d9d9d9',
|
|
293
295
|
borderRadius: '6px',
|
|
294
296
|
backgroundColor: '#fafafa'
|
|
295
297
|
}
|
|
296
|
-
},
|
|
298
|
+
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
299
|
+
style: {
|
|
300
|
+
color: '#faad14'
|
|
301
|
+
}
|
|
302
|
+
}), props.alt || props.src || '图片链接');
|
|
297
303
|
}
|
|
298
304
|
if (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_image = editorProps.image) === null || _editorProps_image === void 0 ? void 0 : _editorProps_image.render) {
|
|
299
305
|
var _editorProps_image_render, _editorProps_image1;
|
|
@@ -356,7 +362,9 @@ import { getMediaType } from "../../utils/dom";
|
|
|
356
362
|
color: '#1890ff',
|
|
357
363
|
textDecoration: 'underline',
|
|
358
364
|
wordBreak: 'break-all',
|
|
359
|
-
display: 'inline-
|
|
365
|
+
display: 'inline-flex',
|
|
366
|
+
alignItems: 'center',
|
|
367
|
+
gap: '8px',
|
|
360
368
|
maxWidth: '100%',
|
|
361
369
|
padding: '8px 12px',
|
|
362
370
|
border: '1px dashed #d9d9d9',
|
|
@@ -365,7 +373,11 @@ import { getMediaType } from "../../utils/dom";
|
|
|
365
373
|
fontSize: '13px',
|
|
366
374
|
lineHeight: '1.5'
|
|
367
375
|
}
|
|
368
|
-
},
|
|
376
|
+
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
377
|
+
style: {
|
|
378
|
+
color: '#faad14'
|
|
379
|
+
}
|
|
380
|
+
}), props.alt || props.src);
|
|
369
381
|
}
|
|
370
382
|
return /*#__PURE__*/ React.createElement("div", {
|
|
371
383
|
"data-testid": "resize-image-container",
|
|
@@ -546,7 +558,9 @@ export function EditorImage(param) {
|
|
|
546
558
|
color: '#1890ff',
|
|
547
559
|
textDecoration: 'underline',
|
|
548
560
|
wordBreak: 'break-all',
|
|
549
|
-
display: 'inline-
|
|
561
|
+
display: 'inline-flex',
|
|
562
|
+
alignItems: 'center',
|
|
563
|
+
gap: '8px',
|
|
550
564
|
maxWidth: '100%',
|
|
551
565
|
padding: '8px 12px',
|
|
552
566
|
border: '1px dashed #d9d9d9',
|
|
@@ -555,7 +569,11 @@ export function EditorImage(param) {
|
|
|
555
569
|
fontSize: '13px',
|
|
556
570
|
lineHeight: '1.5'
|
|
557
571
|
}
|
|
558
|
-
},
|
|
572
|
+
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
573
|
+
style: {
|
|
574
|
+
color: '#faad14'
|
|
575
|
+
}
|
|
576
|
+
}), (element === null || element === void 0 ? void 0 : element.alt) || ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || (element === null || element === void 0 ? void 0 : element.url) || '图片链接');
|
|
559
577
|
}
|
|
560
578
|
return !readonly ? /*#__PURE__*/ React.createElement(ResizeImage, {
|
|
561
579
|
defaultSize: {
|
|
@@ -223,7 +223,7 @@ function _ts_generator(thisArg, body) {
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
import { DeleteFilled, EyeOutlined, LoadingOutlined } from "@ant-design/icons";
|
|
226
|
+
import { DeleteFilled, ExclamationCircleOutlined, EyeOutlined, LoadingOutlined } from "@ant-design/icons";
|
|
227
227
|
import { Modal, Popover } from "antd";
|
|
228
228
|
import React, { useCallback, useContext, useLayoutEffect, useMemo, useRef } from "react";
|
|
229
229
|
import { useDebounceFn } from "@ant-design/pro-components";
|
|
@@ -398,23 +398,24 @@ export function Media(param) {
|
|
|
398
398
|
path
|
|
399
399
|
]);
|
|
400
400
|
var initial = useCallback(/*#__PURE__*/ _async_to_generator(function() {
|
|
401
|
-
var type, realUrl, img;
|
|
401
|
+
var type, finalType, realUrl, img, video, audio;
|
|
402
402
|
return _ts_generator(this, function(_state) {
|
|
403
403
|
type = getMediaType(element === null || element === void 0 ? void 0 : element.url, element.alt);
|
|
404
404
|
type = !type ? 'image' : type;
|
|
405
|
+
finalType = [
|
|
406
|
+
'image',
|
|
407
|
+
'video',
|
|
408
|
+
'autio',
|
|
409
|
+
'attachment'
|
|
410
|
+
].includes(type) ? type : 'other';
|
|
405
411
|
setState({
|
|
406
|
-
type:
|
|
407
|
-
'image',
|
|
408
|
-
'video',
|
|
409
|
-
'autio',
|
|
410
|
-
'attachment'
|
|
411
|
-
].includes(type) ? type : 'other'
|
|
412
|
+
type: finalType
|
|
412
413
|
});
|
|
413
414
|
realUrl = element === null || element === void 0 ? void 0 : element.url;
|
|
414
415
|
setState({
|
|
415
416
|
url: realUrl
|
|
416
417
|
});
|
|
417
|
-
if (
|
|
418
|
+
if (finalType === 'image' || finalType === 'other') {
|
|
418
419
|
img = document.createElement('img');
|
|
419
420
|
img.referrerPolicy = 'no-referrer';
|
|
420
421
|
img.crossOrigin = 'anonymous';
|
|
@@ -430,6 +431,36 @@ export function Media(param) {
|
|
|
430
431
|
});
|
|
431
432
|
};
|
|
432
433
|
}
|
|
434
|
+
if (finalType === 'video') {
|
|
435
|
+
video = document.createElement('video');
|
|
436
|
+
video.src = realUrl;
|
|
437
|
+
video.preload = 'metadata';
|
|
438
|
+
video.onerror = function() {
|
|
439
|
+
setState({
|
|
440
|
+
loadSuccess: false
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
video.onloadedmetadata = function() {
|
|
444
|
+
setState({
|
|
445
|
+
loadSuccess: true
|
|
446
|
+
});
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
if (finalType === 'audio') {
|
|
450
|
+
audio = document.createElement('audio');
|
|
451
|
+
audio.src = realUrl;
|
|
452
|
+
audio.preload = 'metadata';
|
|
453
|
+
audio.onerror = function() {
|
|
454
|
+
setState({
|
|
455
|
+
loadSuccess: false
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
audio.onloadedmetadata = function() {
|
|
459
|
+
setState({
|
|
460
|
+
loadSuccess: true
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
}
|
|
433
464
|
if (!element.mediaType) {
|
|
434
465
|
updateElement({
|
|
435
466
|
mediaType: state().type
|
|
@@ -494,30 +525,85 @@ export function Media(param) {
|
|
|
494
525
|
state().selected
|
|
495
526
|
]);
|
|
496
527
|
var mediaElement = useMemo(function() {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
528
|
+
if (state().type === 'video') {
|
|
529
|
+
var _state;
|
|
530
|
+
if (!state().loadSuccess) {
|
|
531
|
+
var _state1, _state2;
|
|
532
|
+
return /*#__PURE__*/ React.createElement("a", {
|
|
533
|
+
href: ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
534
|
+
target: "_blank",
|
|
535
|
+
rel: "noopener noreferrer",
|
|
536
|
+
style: {
|
|
537
|
+
color: '#1890ff',
|
|
538
|
+
textDecoration: 'underline',
|
|
539
|
+
wordBreak: 'break-all',
|
|
540
|
+
display: 'inline-flex',
|
|
541
|
+
alignItems: 'center',
|
|
542
|
+
gap: '8px',
|
|
543
|
+
maxWidth: '100%',
|
|
544
|
+
padding: '8px 12px',
|
|
545
|
+
border: '1px dashed #d9d9d9',
|
|
546
|
+
borderRadius: '6px',
|
|
547
|
+
backgroundColor: '#fafafa'
|
|
548
|
+
}
|
|
549
|
+
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
550
|
+
style: {
|
|
551
|
+
color: '#faad14'
|
|
552
|
+
}
|
|
553
|
+
}), element.alt || ((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url) || '视频链接');
|
|
517
554
|
}
|
|
518
|
-
|
|
555
|
+
return /*#__PURE__*/ React.createElement("video", {
|
|
556
|
+
"data-testid": "video-element",
|
|
557
|
+
controls: element.controls !== false,
|
|
558
|
+
autoPlay: element.autoplay,
|
|
559
|
+
loop: element.loop,
|
|
560
|
+
muted: element.muted,
|
|
561
|
+
poster: element.poster,
|
|
562
|
+
style: {
|
|
563
|
+
width: element.width ? "".concat(element.width, "px") : '100%',
|
|
564
|
+
height: element.height ? "".concat(element.height, "px") : 'auto',
|
|
565
|
+
maxWidth: 600,
|
|
566
|
+
borderRadius: '6px',
|
|
567
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)'
|
|
568
|
+
},
|
|
569
|
+
src: ((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || '',
|
|
570
|
+
preload: "metadata",
|
|
571
|
+
onError: function() {
|
|
572
|
+
var _state;
|
|
573
|
+
console.warn('Video failed to load:', (_state = state()) === null || _state === void 0 ? void 0 : _state.url);
|
|
574
|
+
setState({
|
|
575
|
+
loadSuccess: false
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
}
|
|
519
580
|
if (state().type === 'audio') {
|
|
520
|
-
var
|
|
581
|
+
var _state3;
|
|
582
|
+
if (!state().loadSuccess) {
|
|
583
|
+
var _state4, _state5;
|
|
584
|
+
return /*#__PURE__*/ React.createElement("a", {
|
|
585
|
+
href: ((_state4 = state()) === null || _state4 === void 0 ? void 0 : _state4.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
586
|
+
target: "_blank",
|
|
587
|
+
rel: "noopener noreferrer",
|
|
588
|
+
style: {
|
|
589
|
+
color: '#1890ff',
|
|
590
|
+
textDecoration: 'underline',
|
|
591
|
+
wordBreak: 'break-all',
|
|
592
|
+
display: 'inline-flex',
|
|
593
|
+
alignItems: 'center',
|
|
594
|
+
gap: '8px',
|
|
595
|
+
maxWidth: '100%',
|
|
596
|
+
padding: '8px 12px',
|
|
597
|
+
border: '1px dashed #d9d9d9',
|
|
598
|
+
borderRadius: '6px',
|
|
599
|
+
backgroundColor: '#fafafa'
|
|
600
|
+
}
|
|
601
|
+
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
602
|
+
style: {
|
|
603
|
+
color: '#faad14'
|
|
604
|
+
}
|
|
605
|
+
}), element.alt || ((_state5 = state()) === null || _state5 === void 0 ? void 0 : _state5.url) || (element === null || element === void 0 ? void 0 : element.url) || '音频链接');
|
|
606
|
+
}
|
|
521
607
|
return /*#__PURE__*/ React.createElement("audio", {
|
|
522
608
|
"data-testid": "audio-element",
|
|
523
609
|
controls: true,
|
|
@@ -525,11 +611,18 @@ export function Media(param) {
|
|
|
525
611
|
width: '100%',
|
|
526
612
|
height: 'auto'
|
|
527
613
|
},
|
|
528
|
-
src: ((
|
|
614
|
+
src: ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || '',
|
|
615
|
+
onError: function() {
|
|
616
|
+
var _state;
|
|
617
|
+
console.warn('Audio failed to load:', (_state = state()) === null || _state === void 0 ? void 0 : _state.url);
|
|
618
|
+
setState({
|
|
619
|
+
loadSuccess: false
|
|
620
|
+
});
|
|
621
|
+
}
|
|
529
622
|
}, "Your browser does not support the", /*#__PURE__*/ React.createElement("code", null, "audio"), " element.");
|
|
530
623
|
}
|
|
531
624
|
if (state().type === 'attachment') {
|
|
532
|
-
var
|
|
625
|
+
var _state6, _element_alt, _element_alt1, _element_otherProps, _element_otherProps_collaborators, _element_otherProps1, _element_otherProps2;
|
|
533
626
|
return /*#__PURE__*/ React.createElement("div", {
|
|
534
627
|
style: {
|
|
535
628
|
padding: 12,
|
|
@@ -561,7 +654,7 @@ export function Media(param) {
|
|
|
561
654
|
minWidth: 0
|
|
562
655
|
}
|
|
563
656
|
}, /*#__PURE__*/ React.createElement("a", {
|
|
564
|
-
href: (
|
|
657
|
+
href: (_state6 = state()) === null || _state6 === void 0 ? void 0 : _state6.url,
|
|
565
658
|
style: {
|
|
566
659
|
overflow: 'ellipsis',
|
|
567
660
|
textOverflow: 'ellipsis',
|
|
@@ -100,9 +100,12 @@ import { useEditorStore } from "../store";
|
|
|
100
100
|
var renderedContent = apaasify.render(props, bubble === null || bubble === void 0 ? void 0 : bubble.originData);
|
|
101
101
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, node.attributes), {
|
|
102
102
|
"data-testid": "schema-container",
|
|
103
|
+
contentEditable: false,
|
|
103
104
|
style: {
|
|
104
105
|
display: 'flex',
|
|
105
|
-
flexDirection: 'column'
|
|
106
|
+
flexDirection: 'column',
|
|
107
|
+
userSelect: 'text',
|
|
108
|
+
WebkitUserSelect: 'text'
|
|
106
109
|
}
|
|
107
110
|
}), renderedContent, /*#__PURE__*/ React.createElement("div", {
|
|
108
111
|
"data-testid": "schema-hidden-json",
|
|
@@ -300,11 +300,20 @@ export { ChartFilter, ChartToolBar, downloadChart } from "./components";
|
|
|
300
300
|
var htmlRef = React.useRef(null);
|
|
301
301
|
var _React_useState1 = _sliced_to_array(React.useState(256), 2), minWidth = _React_useState1[0], setMinWidth = _React_useState1[1];
|
|
302
302
|
useEffect(function() {
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
var updateWidth = function() {
|
|
304
|
+
var _rootContainer_current, _htmlRef_current_parentElement, _htmlRef_current;
|
|
305
|
+
var width = Math.max((rootContainer === null || rootContainer === void 0 ? void 0 : (_rootContainer_current = rootContainer.current) === null || _rootContainer_current === void 0 ? void 0 : _rootContainer_current.clientWidth) || ((_htmlRef_current = htmlRef.current) === null || _htmlRef_current === void 0 ? void 0 : (_htmlRef_current_parentElement = _htmlRef_current.parentElement) === null || _htmlRef_current_parentElement === void 0 ? void 0 : _htmlRef_current_parentElement.clientWidth) || 256, 256);
|
|
306
|
+
setMinWidth(width || 256);
|
|
307
|
+
setColumnLength(Math.min(Math.floor(width / 256), config.length));
|
|
308
|
+
};
|
|
309
|
+
updateWidth();
|
|
310
|
+
window.addEventListener('resize', updateWidth);
|
|
311
|
+
return function() {
|
|
312
|
+
return window.removeEventListener('resize', updateWidth);
|
|
313
|
+
};
|
|
314
|
+
}, [
|
|
315
|
+
config.length
|
|
316
|
+
]);
|
|
308
317
|
return useMemo(function() {
|
|
309
318
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({
|
|
310
319
|
className: 'ant-agentic-md-editor-drag-el'
|
|
@@ -312,9 +321,11 @@ export { ChartFilter, ChartToolBar, downloadChart } from "./components";
|
|
|
312
321
|
"data-be": 'chart',
|
|
313
322
|
style: {
|
|
314
323
|
flex: 1,
|
|
315
|
-
minWidth:
|
|
324
|
+
minWidth: 0,
|
|
325
|
+
width: '100%',
|
|
316
326
|
maxWidth: '100%',
|
|
317
|
-
margin: '1em 0'
|
|
327
|
+
margin: '1em 0',
|
|
328
|
+
overflow: 'hidden'
|
|
318
329
|
},
|
|
319
330
|
ref: htmlRef,
|
|
320
331
|
onDragStart: function(e) {
|
|
@@ -448,7 +459,9 @@ export { ChartFilter, ChartToolBar, downloadChart } from "./components";
|
|
|
448
459
|
key: index + subIndex,
|
|
449
460
|
style: {
|
|
450
461
|
margin: 'auto',
|
|
451
|
-
minWidth:
|
|
462
|
+
minWidth: 0,
|
|
463
|
+
width: columnLength === 1 ? '100%' : "calc(".concat(100 / columnLength, "% - 8px)"),
|
|
464
|
+
maxWidth: '100%',
|
|
452
465
|
flex: 1,
|
|
453
466
|
userSelect: 'none'
|
|
454
467
|
},
|
|
@@ -462,7 +475,9 @@ export { ChartFilter, ChartToolBar, downloadChart } from "./components";
|
|
|
462
475
|
style: {
|
|
463
476
|
userSelect: 'none',
|
|
464
477
|
margin: 'auto',
|
|
465
|
-
minWidth:
|
|
478
|
+
minWidth: 0,
|
|
479
|
+
width: columnLength === 1 ? '100%' : "calc(".concat(100 / columnLength, "% - 8px)"),
|
|
480
|
+
maxWidth: '100%',
|
|
466
481
|
flex: 1
|
|
467
482
|
},
|
|
468
483
|
onClick: function(e) {
|
package/dist/Schema/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
import { SchemaEditor } from './SchemaEditor';
|
|
8
8
|
import { SchemaForm } from './SchemaForm';
|
|
9
9
|
import { SchemaRenderer, TemplateEngine } from './SchemaRenderer';
|
|
10
|
-
import { LowCodeSchema } from './types';
|
|
11
10
|
import { SchemaValidator, mdDataSchemaValidator } from './validator';
|
|
12
|
-
export { LowCodeSchema
|
|
11
|
+
export type { LowCodeSchema } from './types';
|
|
12
|
+
export { SchemaEditor, SchemaForm, SchemaRenderer, SchemaValidator, TemplateEngine, mdDataSchemaValidator as validator, };
|
package/dist/Schema/index.js
CHANGED
|
@@ -6,6 +6,5 @@
|
|
|
6
6
|
*/ import { SchemaEditor } from "./SchemaEditor";
|
|
7
7
|
import { SchemaForm } from "./SchemaForm";
|
|
8
8
|
import { SchemaRenderer, TemplateEngine } from "./SchemaRenderer";
|
|
9
|
-
import { LowCodeSchema } from "./types";
|
|
10
9
|
import { SchemaValidator, mdDataSchemaValidator } from "./validator";
|
|
11
|
-
export {
|
|
10
|
+
export { SchemaEditor, SchemaForm, SchemaRenderer, SchemaValidator, TemplateEngine, mdDataSchemaValidator as validator };
|