@ant-design/agentic-ui 2.0.8 → 2.0.10

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.
@@ -1,7 +1,8 @@
1
1
  import { default as React } from 'react';
2
2
  import { AttachmentButtonPopoverProps } from './AttachmentButtonPopover';
3
- import { AttachmentFile } from './types';
3
+ import { AttachmentFile, UploadResponse } from './types';
4
4
  export * from './AttachmentButtonPopover';
5
+ export type { AttachmentFile, UploadResponse } from './types';
5
6
  /**
6
7
  * AttachmentButton 组件的属性
7
8
  */
@@ -17,6 +18,28 @@ export type AttachmentButtonProps = {
17
18
  * }
18
19
  */
19
20
  upload?: (file: AttachmentFile) => Promise<string>;
21
+ /**
22
+ * 处理文件上传的函数(返回完整响应对象)。返回一个 Promise,解析为 UploadResponse 对象。
23
+ * 优先级高于 upload 接口,返回的完整响应对象会存储在 file.uploadResponse 中。
24
+ * @param file - 要上传的附件文件
25
+ * @param index - 文件在上传队列中的索引
26
+ * @returns 解析为 UploadResponse 对象的 Promise
27
+ * @example
28
+ * const uploadWithResponse = async (file: AttachmentFile, index: number) => {
29
+ * const response = await api.uploadFile(file);
30
+ * return {
31
+ * contentId: null,
32
+ * errorMessage: null,
33
+ * fileId: response.fileId,
34
+ * fileName: response.fileName,
35
+ * fileSize: file.size,
36
+ * fileType: response.fileType,
37
+ * fileUrl: response.fileUrl,
38
+ * uploadStatus: 'SUCCESS'
39
+ * };
40
+ * }
41
+ */
42
+ uploadWithResponse?: (file: AttachmentFile, index: number) => Promise<UploadResponse>;
20
43
  /**
21
44
  * 存储当前附件文件的 Map,以文件 ID 为键,文件对象为值
22
45
  * @example
@@ -86,6 +109,7 @@ export declare const upLoadFileToServer: (files: ArrayLike<File>, props: {
86
109
  fileMap?: Map<string, AttachmentFile> | undefined;
87
110
  onFileMapChange?: ((files?: Map<string, AttachmentFile>) => void) | undefined;
88
111
  upload?: ((file: AttachmentFile, index: number) => Promise<string>) | undefined;
112
+ uploadWithResponse?: ((file: AttachmentFile, index: number) => Promise<UploadResponse>) | undefined;
89
113
  maxFileSize?: number | undefined;
90
114
  maxFileCount?: number | undefined;
91
115
  minFileCount?: number | undefined;
@@ -46,7 +46,7 @@ var waitTime = (time) => {
46
46
  });
47
47
  };
48
48
  var upLoadFileToServer = (files, props) => __async(void 0, null, function* () {
49
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
50
50
  const map = props.fileMap || /* @__PURE__ */ new Map();
51
51
  const hideLoading = message.loading(
52
52
  ((_a = props.locale) == null ? void 0 : _a.uploading) || "Uploading..."
@@ -98,24 +98,41 @@ var upLoadFileToServer = (files, props) => __async(void 0, null, function* () {
98
98
  continue;
99
99
  }
100
100
  try {
101
- const url = (yield (_h = props == null ? void 0 : props.upload) == null ? void 0 : _h.call(props, file, index)) || file.previewUrl;
102
- if (url) {
101
+ let url;
102
+ let isSuccess = false;
103
+ let errorMsg = null;
104
+ if (props.uploadWithResponse) {
105
+ const uploadResult = yield props.uploadWithResponse(file, index);
106
+ url = uploadResult.fileUrl;
107
+ isSuccess = uploadResult.uploadStatus === "SUCCESS";
108
+ errorMsg = uploadResult.errorMessage || null;
109
+ file.uploadResponse = uploadResult;
110
+ } else if (props.upload) {
111
+ url = yield props.upload(file, index);
112
+ isSuccess = !!url;
113
+ } else {
114
+ url = file.previewUrl;
115
+ isSuccess = !!url;
116
+ }
117
+ if (isSuccess && url) {
103
118
  file.status = "done";
104
119
  file.url = url;
105
120
  map.set(file.uuid || "", file);
106
- (_i = props.onFileMapChange) == null ? void 0 : _i.call(props, map);
107
- message.success(((_j = props.locale) == null ? void 0 : _j.uploadSuccess) || "Upload success");
121
+ (_h = props.onFileMapChange) == null ? void 0 : _h.call(props, map);
122
+ message.success(((_i = props.locale) == null ? void 0 : _i.uploadSuccess) || "Upload success");
108
123
  } else {
109
124
  file.status = "error";
110
125
  map.set(file.uuid || "", file);
111
- (_k = props.onFileMapChange) == null ? void 0 : _k.call(props, map);
112
- message.error(((_l = props.locale) == null ? void 0 : _l.uploadFailed) || "Upload failed");
126
+ (_j = props.onFileMapChange) == null ? void 0 : _j.call(props, map);
127
+ const failedMsg = errorMsg || ((_k = props.locale) == null ? void 0 : _k.uploadFailed) || "Upload failed";
128
+ message.error(failedMsg);
113
129
  }
114
130
  } catch (error2) {
115
131
  file.status = "error";
116
132
  map.set(file.uuid || "", file);
117
- (_m = props.onFileMapChange) == null ? void 0 : _m.call(props, map);
118
- message.error(((_n = props.locale) == null ? void 0 : _n.uploadFailed) || "Upload failed");
133
+ (_l = props.onFileMapChange) == null ? void 0 : _l.call(props, map);
134
+ const errorMessage = error2 instanceof Error ? error2.message : ((_m = props.locale) == null ? void 0 : _m.uploadFailed) || "Upload failed";
135
+ message.error(errorMessage);
119
136
  }
120
137
  index++;
121
138
  }
@@ -136,8 +153,8 @@ var upLoadFileToServer = (files, props) => __async(void 0, null, function* () {
136
153
  map.set(file.uuid || "", file);
137
154
  }
138
155
  });
139
- message.error(((_o = props.locale) == null ? void 0 : _o.uploadFailed) || "Upload failed");
140
- (_p = props.onFileMapChange) == null ? void 0 : _p.call(props, map);
156
+ message.error(((_n = props.locale) == null ? void 0 : _n.uploadFailed) || "Upload failed");
157
+ (_o = props.onFileMapChange) == null ? void 0 : _o.call(props, map);
141
158
  } finally {
142
159
  hideLoading();
143
160
  }
@@ -1,6 +1,21 @@
1
+ /**
2
+ * 上传响应对象类型
3
+ */
4
+ export type UploadResponse = {
5
+ contentId?: string | null;
6
+ errorMessage?: string | null;
7
+ fileId: string;
8
+ fileName: string;
9
+ fileSize?: number | null;
10
+ fileType: string;
11
+ fileUrl: string;
12
+ uploadStatus: 'SUCCESS' | 'FAIL' | string;
13
+ };
1
14
  export type AttachmentFile = File & {
2
15
  url?: string;
3
16
  status?: 'error' | 'uploading' | 'done';
4
17
  uuid?: string;
5
18
  previewUrl?: string;
19
+ /** 上传响应数据(使用 uploadWithResponse 时会填充此字段) */
20
+ uploadResponse?: UploadResponse;
6
21
  };
@@ -19,8 +19,85 @@ var __spreadValues = (a, b) => {
19
19
  import { GripVertical, Menu } from "@sofa-design/icons";
20
20
  import { ConfigProvider, Popover } from "antd";
21
21
  import classNames from "classnames";
22
- import React, { useContext, useEffect, useRef, useState } from "react";
22
+ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
23
23
  import { useStyle } from "../../components/ActionItemBox";
24
+ import { useRefFunction } from "../../hooks/useRefFunction";
25
+ var INTERACTIVE_SELECTOR = 'button, a, input, textarea, select, [role="button"], [contenteditable="true"], [data-no-pan]';
26
+ var PAN_THRESHOLD = 6;
27
+ var SCROLL_STYLE = {
28
+ display: "flex",
29
+ alignItems: "center",
30
+ width: "100%",
31
+ gap: 8,
32
+ overflowX: "auto",
33
+ overflowY: "hidden",
34
+ WebkitOverflowScrolling: "touch",
35
+ overscrollBehavior: "contain",
36
+ touchAction: "pan-x"
37
+ };
38
+ var POPOVER_OVERLAY_STYLE = { padding: 0 };
39
+ var DraggablePopupItem = React.memo((props) => {
40
+ const {
41
+ entry,
42
+ index,
43
+ basePrefixCls,
44
+ hashId,
45
+ draggingIndex,
46
+ overIndex,
47
+ isHandlePressRef,
48
+ onDragStart,
49
+ onDragOver,
50
+ onDrop,
51
+ onDragEnd,
52
+ isHandleTarget,
53
+ setDraggingIndex
54
+ } = props;
55
+ const handleMouseDown = useRefFunction((evt) => {
56
+ const isHandle = isHandleTarget(evt.target);
57
+ isHandlePressRef.current = isHandle;
58
+ setDraggingIndex(isHandle ? index : null);
59
+ });
60
+ const handleMouseUp = useRefFunction(() => {
61
+ if (draggingIndex === null) {
62
+ isHandlePressRef.current = false;
63
+ }
64
+ });
65
+ const handleGripMouseDown = useRefFunction((evt) => {
66
+ isHandlePressRef.current = true;
67
+ setDraggingIndex(index);
68
+ evt.stopPropagation();
69
+ });
70
+ return /* @__PURE__ */ React.createElement(
71
+ "div",
72
+ {
73
+ key: entry.key,
74
+ className: classNames(
75
+ `${basePrefixCls}-overflow-container-popup-item`,
76
+ hashId,
77
+ {
78
+ [`${basePrefixCls}-dragging`]: draggingIndex === index,
79
+ [`${basePrefixCls}-drag-over`]: overIndex === index
80
+ }
81
+ ),
82
+ draggable: true,
83
+ onMouseDown: handleMouseDown,
84
+ onMouseUp: handleMouseUp,
85
+ onDragStart: (evt) => onDragStart(evt, index),
86
+ onDragOver: (evt) => onDragOver(evt, index),
87
+ onDrop: (evt) => onDrop(evt, index),
88
+ onDragEnd
89
+ },
90
+ /* @__PURE__ */ React.createElement(
91
+ GripVertical,
92
+ {
93
+ className: classNames(`${basePrefixCls}-drag-handle`, hashId),
94
+ onMouseDown: handleGripMouseDown
95
+ }
96
+ ),
97
+ /* @__PURE__ */ React.createElement("div", { draggable: false }, entry.node)
98
+ );
99
+ });
100
+ DraggablePopupItem.displayName = "DraggablePopupItem";
24
101
  var ActionItemContainer = (props) => {
25
102
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
26
103
  const basePrefixCls = getPrefixCls("agent-chat-action-item-box");
@@ -37,23 +114,24 @@ var ActionItemContainer = (props) => {
37
114
  const panStartScrollLeftRef = useRef(0);
38
115
  const hasPanMovedRef = useRef(false);
39
116
  const panIntentRef = useRef(false);
40
- const isInteractiveTarget = (target) => {
117
+ const isInteractiveTarget = useRefFunction((target) => {
41
118
  if (!(target instanceof HTMLElement))
42
119
  return false;
43
- if (target.closest(
44
- 'button, a, input, textarea, select, [role="button"], [contenteditable="true"], [data-no-pan]'
45
- )) {
46
- return true;
47
- }
48
- return false;
49
- };
50
- const toEntries = (nodes) => {
120
+ return !!target.closest(INTERACTIVE_SELECTOR);
121
+ });
122
+ const isHandleTarget = useRefFunction((target) => {
123
+ if (!(target instanceof HTMLElement))
124
+ return false;
125
+ const handle = target.closest(`.${basePrefixCls}-drag-handle`);
126
+ return !!handle;
127
+ });
128
+ const toEntries = useRefFunction((nodes) => {
51
129
  const array = React.Children.toArray(nodes);
52
130
  return array.map((node) => {
53
131
  var _a;
54
132
  return { key: (_a = node == null ? void 0 : node.key) != null ? _a : null, node };
55
133
  });
56
- };
134
+ });
57
135
  const [ordered, setOrdered] = useState(
58
136
  () => toEntries(props.children)
59
137
  );
@@ -91,154 +169,175 @@ var ActionItemContainer = (props) => {
91
169
  }
92
170
  setOrdered(merged.length === incoming.length ? merged : incoming);
93
171
  }, [props.children]);
94
- const handleDragStart = (e, index) => {
95
- e.stopPropagation();
96
- e.dataTransfer.effectAllowed = "move";
97
- try {
98
- e.dataTransfer.setData("text/plain", String(index));
99
- } catch (e2) {
100
- console.error(e);
172
+ const reorder = useRefFunction(
173
+ (list, from, to) => {
174
+ const next = list.slice();
175
+ const [moved] = next.splice(from, 1);
176
+ next.splice(to, 0, moved);
177
+ return next;
101
178
  }
102
- setDraggingIndex(index);
103
- };
104
- const handleDragOver = (e, index) => {
105
- e.preventDefault();
106
- e.dataTransfer.dropEffect = "move";
107
- if (overIndex !== index)
108
- setOverIndex(index);
109
- };
110
- const reorder = (list, from, to) => {
111
- const next = list.slice();
112
- const [moved] = next.splice(from, 1);
113
- next.splice(to, 0, moved);
114
- return next;
115
- };
116
- const handleDrop = (e, index) => {
117
- e.preventDefault();
118
- e.stopPropagation();
119
- const from = draggingIndex;
120
- if (from === null)
121
- return;
122
- const to = index;
123
- if (from === to)
124
- return;
125
- setOrdered((prev) => reorder(prev, from, to));
126
- setDraggingIndex(null);
127
- setOverIndex(null);
128
- isHandlePressRef.current = false;
129
- };
130
- const handleDragEnd = () => {
179
+ );
180
+ const handleDragStart = useRefFunction(
181
+ (e, index) => {
182
+ e.stopPropagation();
183
+ e.dataTransfer.effectAllowed = "move";
184
+ try {
185
+ e.dataTransfer.setData("text/plain", String(index));
186
+ } catch (e2) {
187
+ console.error(e);
188
+ }
189
+ setDraggingIndex(index);
190
+ }
191
+ );
192
+ const handleDragOver = useRefFunction(
193
+ (e, index) => {
194
+ e.preventDefault();
195
+ e.dataTransfer.dropEffect = "move";
196
+ if (overIndex !== index)
197
+ setOverIndex(index);
198
+ }
199
+ );
200
+ const handleDrop = useRefFunction(
201
+ (e, index) => {
202
+ e.preventDefault();
203
+ e.stopPropagation();
204
+ if (draggingIndex === null)
205
+ return;
206
+ if (draggingIndex === index)
207
+ return;
208
+ setOrdered((prev) => reorder(prev, draggingIndex, index));
209
+ setDraggingIndex(null);
210
+ setOverIndex(null);
211
+ isHandlePressRef.current = false;
212
+ }
213
+ );
214
+ const handleDragEnd = useRefFunction(() => {
131
215
  setDraggingIndex(null);
132
216
  setOverIndex(null);
133
217
  isHandlePressRef.current = false;
134
- };
135
- const isHandleTarget = (target) => {
136
- if (!(target instanceof HTMLElement))
137
- return false;
138
- const handle = target.closest(`.${basePrefixCls}-drag-handle`);
139
- return !!handle;
140
- };
218
+ });
219
+ const handlePointerDown = useRefFunction(
220
+ (e) => {
221
+ const el = scrollRef.current;
222
+ if (!el || e.button !== 0 || isInteractiveTarget(e.target))
223
+ return;
224
+ panIntentRef.current = true;
225
+ hasPanMovedRef.current = false;
226
+ panStartXRef.current = e.clientX;
227
+ panStartScrollLeftRef.current = el.scrollLeft;
228
+ }
229
+ );
230
+ const handlePointerMove = useRefFunction(
231
+ (e) => {
232
+ const el = scrollRef.current;
233
+ if (!el)
234
+ return;
235
+ if (!isPanningRef.current && panIntentRef.current) {
236
+ const dx = e.clientX - panStartXRef.current;
237
+ if (Math.abs(dx) > PAN_THRESHOLD) {
238
+ isPanningRef.current = true;
239
+ hasPanMovedRef.current = true;
240
+ try {
241
+ el.setPointerCapture(e.pointerId);
242
+ } catch (e2) {
243
+ }
244
+ }
245
+ }
246
+ if (isPanningRef.current) {
247
+ const dx = e.clientX - panStartXRef.current;
248
+ el.scrollLeft = panStartScrollLeftRef.current - dx;
249
+ if (e.cancelable)
250
+ e.preventDefault();
251
+ e.stopPropagation();
252
+ }
253
+ }
254
+ );
255
+ const handlePointerUp = useRefFunction(
256
+ (e) => {
257
+ const el = scrollRef.current;
258
+ if (!el)
259
+ return;
260
+ panIntentRef.current = false;
261
+ if (isPanningRef.current) {
262
+ isPanningRef.current = false;
263
+ try {
264
+ el.releasePointerCapture(e.pointerId);
265
+ } catch (e2) {
266
+ }
267
+ }
268
+ }
269
+ );
270
+ const handlePointerCancel = useRefFunction(() => {
271
+ isPanningRef.current = false;
272
+ panIntentRef.current = false;
273
+ });
274
+ const handleWheel = useRefFunction((e) => {
275
+ const el = scrollRef.current;
276
+ if (!el)
277
+ return;
278
+ const horizontalDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
279
+ if (horizontalDelta !== 0) {
280
+ el.scrollLeft += horizontalDelta;
281
+ }
282
+ e.stopPropagation();
283
+ });
284
+ const handleClick = useRefFunction((e) => {
285
+ if (hasPanMovedRef.current) {
286
+ e.preventDefault();
287
+ e.stopPropagation();
288
+ hasPanMovedRef.current = false;
289
+ }
290
+ });
291
+ const handlePopoverChange = useRefFunction((visible) => {
292
+ if (!props.menuDisabled) {
293
+ setShowOverflowPopup(visible);
294
+ }
295
+ });
296
+ const handleMenuMouseEnter = useRefFunction(() => {
297
+ if (!props.menuDisabled) {
298
+ setIsIndicatorHover(true);
299
+ }
300
+ });
301
+ const handleMenuMouseLeave = useRefFunction(() => {
302
+ if (!props.menuDisabled) {
303
+ setIsIndicatorHover(false);
304
+ }
305
+ });
306
+ const handlePopupWheel = useRefFunction((e) => {
307
+ e.stopPropagation();
308
+ });
309
+ const containerStyle = useMemo(() => __spreadValues({}, props.style), [props.style]);
310
+ const containerClassName = useMemo(
311
+ () => classNames(
312
+ `${basePrefixCls}-container`,
313
+ {
314
+ [`${basePrefixCls}-container-${props.size}`]: props.size,
315
+ [`${basePrefixCls}-container-no-hover`]: isIndicatorHover
316
+ },
317
+ hashId
318
+ ),
319
+ [basePrefixCls, props.size, isIndicatorHover, hashId]
320
+ );
141
321
  return wrapSSR(
142
322
  /* @__PURE__ */ React.createElement(
143
323
  "div",
144
324
  {
145
325
  ref: containerRef,
146
- style: __spreadValues({}, props.style),
147
- className: classNames(
148
- `${basePrefixCls}-container`,
149
- {
150
- [`${basePrefixCls}-container-${props.size}`]: props.size,
151
- [`${basePrefixCls}-container-no-hover`]: isIndicatorHover
152
- },
153
- hashId
154
- ),
155
- onPointerDown: (e) => {
156
- const el = scrollRef.current;
157
- if (!el)
158
- return;
159
- if (e.button !== 0)
160
- return;
161
- if (isInteractiveTarget(e.target))
162
- return;
163
- panIntentRef.current = true;
164
- hasPanMovedRef.current = false;
165
- panStartXRef.current = e.clientX;
166
- panStartScrollLeftRef.current = el.scrollLeft;
167
- },
168
- onPointerMove: (e) => {
169
- const el = scrollRef.current;
170
- if (!el)
171
- return;
172
- if (!isPanningRef.current && panIntentRef.current) {
173
- const dx = e.clientX - panStartXRef.current;
174
- if (Math.abs(dx) > 6) {
175
- isPanningRef.current = true;
176
- hasPanMovedRef.current = true;
177
- try {
178
- el.setPointerCapture(e.pointerId);
179
- } catch (e2) {
180
- }
181
- }
182
- }
183
- if (isPanningRef.current) {
184
- const dx = e.clientX - panStartXRef.current;
185
- el.scrollLeft = panStartScrollLeftRef.current - dx;
186
- if (e.cancelable)
187
- e.preventDefault();
188
- e.stopPropagation();
189
- }
190
- },
191
- onPointerUp: (e) => {
192
- const el = scrollRef.current;
193
- if (!el)
194
- return;
195
- panIntentRef.current = false;
196
- if (isPanningRef.current) {
197
- isPanningRef.current = false;
198
- try {
199
- el.releasePointerCapture(e.pointerId);
200
- } catch (e2) {
201
- }
202
- }
203
- },
204
- onPointerCancel: () => {
205
- isPanningRef.current = false;
206
- panIntentRef.current = false;
207
- },
208
- onWheel: (e) => {
209
- const el = scrollRef.current;
210
- if (!el)
211
- return;
212
- const horizontalDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
213
- if (horizontalDelta !== 0) {
214
- el.scrollLeft += horizontalDelta;
215
- }
216
- e.stopPropagation();
217
- },
218
- onClick: (e) => {
219
- if (hasPanMovedRef.current) {
220
- e.preventDefault();
221
- e.stopPropagation();
222
- hasPanMovedRef.current = false;
223
- }
224
- }
326
+ style: containerStyle,
327
+ className: containerClassName,
328
+ onPointerDown: handlePointerDown,
329
+ onPointerMove: handlePointerMove,
330
+ onPointerUp: handlePointerUp,
331
+ onPointerCancel: handlePointerCancel,
332
+ onWheel: handleWheel,
333
+ onClick: handleClick
225
334
  },
226
335
  /* @__PURE__ */ React.createElement(
227
336
  "div",
228
337
  {
229
338
  ref: scrollRef,
230
339
  className: classNames(`${basePrefixCls}-scroll`, hashId),
231
- style: {
232
- display: "flex",
233
- alignItems: "center",
234
- width: "100%",
235
- gap: 8,
236
- overflowX: "auto",
237
- overflowY: "hidden",
238
- WebkitOverflowScrolling: "touch",
239
- overscrollBehavior: "contain",
240
- touchAction: "pan-x"
241
- }
340
+ style: SCROLL_STYLE
242
341
  },
243
342
  ordered.map((entry) => /* @__PURE__ */ React.createElement(React.Fragment, { key: entry.key }, entry.node))
244
343
  ),
@@ -269,11 +368,11 @@ var ActionItemContainer = (props) => {
269
368
  Popover,
270
369
  {
271
370
  open: showOverflowPopup,
272
- onOpenChange: (visible) => !props.menuDisabled && setShowOverflowPopup(visible),
371
+ onOpenChange: handlePopoverChange,
273
372
  trigger: "click",
274
373
  placement: "topRight",
275
374
  arrow: false,
276
- overlayInnerStyle: { padding: 0 },
375
+ overlayInnerStyle: POPOVER_OVERLAY_STYLE,
277
376
  overlayClassName: classNames(
278
377
  `${basePrefixCls}-overflow-popover`,
279
378
  hashId
@@ -285,60 +384,27 @@ var ActionItemContainer = (props) => {
285
384
  `${basePrefixCls}-overflow-container-popup`,
286
385
  hashId
287
386
  ),
288
- onWheel: (e) => {
289
- e.stopPropagation();
290
- }
387
+ onWheel: handlePopupWheel
291
388
  },
292
- ordered.length > 0 ? ordered.map((entry, index) => /* @__PURE__ */ React.createElement(
293
- "div",
389
+ ordered.map((entry, index) => /* @__PURE__ */ React.createElement(
390
+ DraggablePopupItem,
294
391
  {
295
392
  key: entry.key,
296
- className: classNames(
297
- `${basePrefixCls}-overflow-container-popup-item`,
298
- hashId,
299
- {
300
- [`${basePrefixCls}-dragging`]: draggingIndex === index,
301
- [`${basePrefixCls}-drag-over`]: overIndex === index
302
- }
303
- ),
304
- draggable: true,
305
- onMouseDown: (evt) => {
306
- const isHandle = isHandleTarget(evt.target);
307
- isHandlePressRef.current = isHandle;
308
- if (isHandle) {
309
- setDraggingIndex(index);
310
- } else {
311
- setDraggingIndex(null);
312
- }
313
- },
314
- onMouseUp: () => {
315
- if (draggingIndex === null) {
316
- isHandlePressRef.current = false;
317
- }
318
- },
319
- onDragStart: (evt) => {
320
- handleDragStart(evt, index);
321
- },
322
- onDragOver: (evt) => handleDragOver(evt, index),
323
- onDrop: (evt) => handleDrop(evt, index),
324
- onDragEnd: handleDragEnd
325
- },
326
- /* @__PURE__ */ React.createElement(
327
- GripVertical,
328
- {
329
- className: classNames(
330
- `${basePrefixCls}-drag-handle`,
331
- hashId
332
- ),
333
- onMouseDown: (evt) => {
334
- isHandlePressRef.current = true;
335
- setDraggingIndex(index);
336
- evt.stopPropagation();
337
- }
338
- }
339
- ),
340
- /* @__PURE__ */ React.createElement("div", { draggable: false }, entry.node)
341
- )) : null
393
+ entry,
394
+ index,
395
+ basePrefixCls,
396
+ hashId,
397
+ draggingIndex,
398
+ overIndex,
399
+ isHandlePressRef,
400
+ onDragStart: handleDragStart,
401
+ onDragOver: handleDragOver,
402
+ onDrop: handleDrop,
403
+ onDragEnd: handleDragEnd,
404
+ isHandleTarget,
405
+ setDraggingIndex
406
+ }
407
+ ))
342
408
  )
343
409
  },
344
410
  /* @__PURE__ */ React.createElement(
@@ -351,8 +417,8 @@ var ActionItemContainer = (props) => {
351
417
  [`${basePrefixCls}-overflow-container-menu-disabled`]: props.menuDisabled
352
418
  }
353
419
  ),
354
- onMouseEnter: () => !props.menuDisabled && setIsIndicatorHover(true),
355
- onMouseLeave: () => !props.menuDisabled && setIsIndicatorHover(false)
420
+ onMouseEnter: handleMenuMouseEnter,
421
+ onMouseLeave: handleMenuMouseLeave
356
422
  },
357
423
  /* @__PURE__ */ React.createElement(Menu, null)
358
424
  )
@@ -28,6 +28,7 @@ var genStyle = (token) => {
28
28
  [`${token.componentCls}`]: {
29
29
  maxWidth: "100%",
30
30
  display: "flex",
31
+ minWidth: "0px",
31
32
  flexDirection: "column",
32
33
  flexWrap: "nowrap",
33
34
  overflow: "auto",