@zat-design/sisyphus-react 4.6.5-beta.1 → 4.6.5-beta.2
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/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +6 -1
- package/es/ProForm/components/combination/FormList/components/TabsFields.js +134 -62
- package/es/ProForm/components/combination/FormList/style/index.less +175 -44
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import omit from "lodash/omit";
|
|
|
10
10
|
import classNames from "classnames";
|
|
11
11
|
import { useMemo } from "react";
|
|
12
12
|
import {
|
|
13
|
+
CloseOutlined,
|
|
13
14
|
CopyOutlined,
|
|
14
15
|
PlusSquareOutlined,
|
|
15
16
|
ArrowUpOutlined,
|
|
@@ -37,7 +38,7 @@ const getDefaultActions = (mode) => {
|
|
|
37
38
|
remove(index);
|
|
38
39
|
},
|
|
39
40
|
label: locale.ProForm.formListActions[1],
|
|
40
|
-
icon: mode === "
|
|
41
|
+
icon: mode === "tabs" ? /* @__PURE__ */ jsx(CloseOutlined, {}) : mode === "less" ? /* @__PURE__ */ jsx(ProIcon, { component: close2Svg, size: 14, className: "single-delete" }) : /* @__PURE__ */ jsx(ProIcon, { component: deleteSvg, size: 18 })
|
|
41
42
|
},
|
|
42
43
|
copy: {
|
|
43
44
|
onClick: (record, { namePath, index, operation }) => {
|
|
@@ -196,6 +197,8 @@ const ActionButton = (props) => {
|
|
|
196
197
|
title: title ?? `${locale.ProForm.formListConfirmMessage}`,
|
|
197
198
|
onCancel: (e) => e.stopPropagation(),
|
|
198
199
|
onConfirm: (e) => {
|
|
200
|
+
if (mode === "tabs")
|
|
201
|
+
e == null ? void 0 : e.stopPropagation();
|
|
199
202
|
if (type === "add") {
|
|
200
203
|
handleAddClick();
|
|
201
204
|
} else {
|
|
@@ -209,6 +212,7 @@ const ActionButton = (props) => {
|
|
|
209
212
|
...defaultRest,
|
|
210
213
|
...omit(rest, filterKeys),
|
|
211
214
|
className: "pro-form-list-delete-icon",
|
|
215
|
+
"data-form-list-action": mode === "tabs" ? type : void 0,
|
|
212
216
|
type: "text",
|
|
213
217
|
onClick: (e) => e.stopPropagation(),
|
|
214
218
|
children: label || defaultLabel
|
|
@@ -227,6 +231,7 @@ const ActionButton = (props) => {
|
|
|
227
231
|
}),
|
|
228
232
|
...defaultRest,
|
|
229
233
|
...omit(rest, filterKeys),
|
|
234
|
+
"data-form-list-action": mode === "tabs" ? type : void 0,
|
|
230
235
|
type: "text",
|
|
231
236
|
onClick: (e) => {
|
|
232
237
|
e.stopPropagation();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import React, { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { Badge, Row, Tabs, theme, Tooltip } from "antd";
|
|
4
5
|
import { PlusOutlined } from "@ant-design/icons";
|
|
5
|
-
import { DndContext } from "@dnd-kit/core";
|
|
6
|
-
import { horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable";
|
|
7
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
6
|
+
import { DndContext, DragOverlay, useDraggable, useDroppable } from "@dnd-kit/core";
|
|
8
7
|
import isFunction from "lodash/isFunction";
|
|
9
8
|
import dragSvg from "../../../../../assets/drag.svg";
|
|
10
9
|
import ProIcon from "../../../../../ProIcon";
|
|
@@ -21,6 +20,7 @@ import {
|
|
|
21
20
|
} from "../toolbarActions";
|
|
22
21
|
import { subscribeFormListTabsValidation } from "../tabsValidation";
|
|
23
22
|
const MemoRenderFields = React.memo(RenderFields, memoWith);
|
|
23
|
+
const MAX_TAB_TITLE_LENGTH = 10;
|
|
24
24
|
const getTabErrorCounts = (errorFields, fields, namePath) => {
|
|
25
25
|
const uniqueErrors = /* @__PURE__ */ new Map();
|
|
26
26
|
errorFields.forEach((errorField) => {
|
|
@@ -48,27 +48,40 @@ const SortableTabLabel = ({
|
|
|
48
48
|
draggable,
|
|
49
49
|
fieldKey
|
|
50
50
|
}) => {
|
|
51
|
+
const instanceId = useId();
|
|
52
|
+
const id = `${fieldKey}-${instanceId}`;
|
|
51
53
|
const {
|
|
52
54
|
attributes,
|
|
53
55
|
listeners,
|
|
54
56
|
setActivatorNodeRef,
|
|
55
|
-
setNodeRef,
|
|
56
|
-
transform,
|
|
57
|
-
transition,
|
|
57
|
+
setNodeRef: setDragNodeRef,
|
|
58
58
|
isDragging
|
|
59
|
-
} =
|
|
60
|
-
id
|
|
59
|
+
} = useDraggable({
|
|
60
|
+
id,
|
|
61
|
+
data: { fieldKey },
|
|
61
62
|
disabled: disabled || !draggable
|
|
62
63
|
});
|
|
64
|
+
const { setNodeRef: setDropNodeRef, isOver } = useDroppable({
|
|
65
|
+
id,
|
|
66
|
+
data: { fieldKey },
|
|
67
|
+
disabled: disabled || !draggable
|
|
68
|
+
});
|
|
69
|
+
const setNodeRef = useCallback(
|
|
70
|
+
(node) => {
|
|
71
|
+
setDragNodeRef(node);
|
|
72
|
+
setDropNodeRef(node);
|
|
73
|
+
},
|
|
74
|
+
[setDragNodeRef, setDropNodeRef]
|
|
75
|
+
);
|
|
63
76
|
return /* @__PURE__ */ jsxs(
|
|
64
77
|
"div",
|
|
65
78
|
{
|
|
66
79
|
ref: setNodeRef,
|
|
67
80
|
className: "pro-form-list-tabs-label",
|
|
81
|
+
"data-drag-over": isOver || void 0,
|
|
82
|
+
"data-form-list-field-key": fieldKey,
|
|
68
83
|
style: {
|
|
69
|
-
opacity: isDragging ? 0.4 : void 0
|
|
70
|
-
transform: CSS.Translate.toString(transform),
|
|
71
|
-
transition
|
|
84
|
+
opacity: isDragging ? 0.4 : void 0
|
|
72
85
|
},
|
|
73
86
|
children: [
|
|
74
87
|
!disabled && draggable && /* @__PURE__ */ jsx(
|
|
@@ -78,7 +91,7 @@ const SortableTabLabel = ({
|
|
|
78
91
|
...listeners,
|
|
79
92
|
ref: setActivatorNodeRef,
|
|
80
93
|
className: "pro-form-list-tabs-drag-handle",
|
|
81
|
-
children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size: 16
|
|
94
|
+
children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size: 16 })
|
|
82
95
|
}
|
|
83
96
|
),
|
|
84
97
|
children
|
|
@@ -87,6 +100,20 @@ const SortableTabLabel = ({
|
|
|
87
100
|
);
|
|
88
101
|
};
|
|
89
102
|
const TabsFields = (props) => {
|
|
103
|
+
var _a;
|
|
104
|
+
const { token } = theme.useToken();
|
|
105
|
+
const tabsStyle = {
|
|
106
|
+
"--pro-form-list-tabs-primary": token.colorPrimary,
|
|
107
|
+
"--pro-form-list-tabs-primary-hover": token.colorPrimaryHover,
|
|
108
|
+
"--pro-form-list-tabs-primary-bg": token.colorPrimaryBg,
|
|
109
|
+
"--pro-form-list-tabs-text": token.colorText,
|
|
110
|
+
"--pro-form-list-tabs-muted": token.colorTextDescription,
|
|
111
|
+
"--pro-form-list-tabs-close": token.colorTextQuaternary,
|
|
112
|
+
"--pro-form-list-tabs-border": token.colorBorder,
|
|
113
|
+
"--pro-form-list-tabs-bg": token.colorBgContainer,
|
|
114
|
+
"--pro-form-list-tabs-error": token.colorError,
|
|
115
|
+
"--pro-form-list-tabs-solid-text": token.colorTextLightSolid
|
|
116
|
+
};
|
|
90
117
|
const {
|
|
91
118
|
actionProps,
|
|
92
119
|
diffConfig,
|
|
@@ -108,6 +135,7 @@ const TabsFields = (props) => {
|
|
|
108
135
|
const fieldKeys = fields.map((field) => String(field.key));
|
|
109
136
|
const fieldKeysSignature = fieldKeys.join("\0");
|
|
110
137
|
const [activeKey, setActiveKey] = useState(fieldKeys[0]);
|
|
138
|
+
const [draggedKey, setDraggedKey] = useState();
|
|
111
139
|
const [validationErrorFields, setValidationErrorFields] = useState([]);
|
|
112
140
|
const activeIndexRef = useRef(0);
|
|
113
141
|
const fieldKeysRef = useRef(fieldKeys);
|
|
@@ -136,21 +164,22 @@ const TabsFields = (props) => {
|
|
|
136
164
|
const fallbackIndex = Math.min(activeIndexRef.current, fieldKeys.length - 1);
|
|
137
165
|
setActiveKey(fallbackIndex >= 0 ? fieldKeys[fallbackIndex] : void 0);
|
|
138
166
|
}, [activeKey, fieldKeysSignature]);
|
|
167
|
+
const activateFirstError = useCallback((errorFields) => {
|
|
168
|
+
const counts = getTabErrorCounts(errorFields, fieldsRef.current, namePathRef.current);
|
|
169
|
+
const firstErrorIndex = fieldsRef.current.findIndex((field) => counts.has(String(field.key)));
|
|
170
|
+
if (firstErrorIndex < 0)
|
|
171
|
+
return;
|
|
172
|
+
activeIndexRef.current = firstErrorIndex;
|
|
173
|
+
setActiveKey(String(fieldsRef.current[firstErrorIndex].key));
|
|
174
|
+
}, []);
|
|
139
175
|
useEffect(
|
|
140
176
|
() => subscribeFormListTabsValidation(form, (event) => {
|
|
141
177
|
setValidationErrorFields(event.errorFields);
|
|
142
178
|
if (event.reason !== "submitFailed")
|
|
143
179
|
return;
|
|
144
|
-
|
|
145
|
-
const firstErrorIndex = fieldsRef.current.findIndex(
|
|
146
|
-
(field) => counts.has(String(field.key))
|
|
147
|
-
);
|
|
148
|
-
if (firstErrorIndex < 0)
|
|
149
|
-
return;
|
|
150
|
-
activeIndexRef.current = firstErrorIndex;
|
|
151
|
-
setActiveKey(String(fieldsRef.current[firstErrorIndex].key));
|
|
180
|
+
activateFirstError(event.errorFields);
|
|
152
181
|
}),
|
|
153
|
-
[form]
|
|
182
|
+
[form, activateFirstError]
|
|
154
183
|
);
|
|
155
184
|
const validateCurrent = useCallback(async () => {
|
|
156
185
|
if (!activeKey)
|
|
@@ -165,13 +194,31 @@ const TabsFields = (props) => {
|
|
|
165
194
|
return false;
|
|
166
195
|
}
|
|
167
196
|
}, [activeKey, fieldKeysSignature, form, namePath]);
|
|
197
|
+
const validateAllItems = useCallback(async () => {
|
|
198
|
+
if (!fieldsRef.current.length || !(form == null ? void 0 : form.validateFields))
|
|
199
|
+
return true;
|
|
200
|
+
try {
|
|
201
|
+
await form.validateFields(
|
|
202
|
+
fieldsRef.current.map((field) => [...namePathRef.current, field.name]),
|
|
203
|
+
{ recursive: true }
|
|
204
|
+
);
|
|
205
|
+
setValidationErrorFields([]);
|
|
206
|
+
return true;
|
|
207
|
+
} catch (error) {
|
|
208
|
+
if (error && typeof error === "object" && "errorFields" in error && Array.isArray(error.errorFields) && !("outOfDate" in error && error.outOfDate)) {
|
|
209
|
+
setValidationErrorFields(error.errorFields);
|
|
210
|
+
activateFirstError(error.errorFields);
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
}, [form, activateFirstError]);
|
|
168
215
|
const runAfterValidation = useCallback(
|
|
169
|
-
async (callback) => {
|
|
216
|
+
async (callback, validate = validateCurrent) => {
|
|
170
217
|
if (validatingRef.current)
|
|
171
218
|
return false;
|
|
172
219
|
validatingRef.current = true;
|
|
173
220
|
try {
|
|
174
|
-
if (!await
|
|
221
|
+
if (!await validate())
|
|
175
222
|
return false;
|
|
176
223
|
return await callback();
|
|
177
224
|
} finally {
|
|
@@ -199,7 +246,7 @@ const TabsFields = (props) => {
|
|
|
199
246
|
if (!added)
|
|
200
247
|
pendingAddKeysRef.current = null;
|
|
201
248
|
return added;
|
|
202
|
-
});
|
|
249
|
+
}, validateAllItems);
|
|
203
250
|
};
|
|
204
251
|
const handleChange = (nextActiveKey) => {
|
|
205
252
|
if (nextActiveKey === activeKey)
|
|
@@ -214,10 +261,14 @@ const TabsFields = (props) => {
|
|
|
214
261
|
});
|
|
215
262
|
};
|
|
216
263
|
const handleDragEnd = ({ active, over }) => {
|
|
217
|
-
|
|
264
|
+
var _a2, _b;
|
|
265
|
+
setDraggedKey(void 0);
|
|
266
|
+
const sourceKey = (_a2 = active.data.current) == null ? void 0 : _a2.fieldKey;
|
|
267
|
+
const targetKey = (_b = over == null ? void 0 : over.data.current) == null ? void 0 : _b.fieldKey;
|
|
268
|
+
if (!over || sourceKey === targetKey)
|
|
218
269
|
return;
|
|
219
|
-
const activeIndex = fieldKeys.indexOf(
|
|
220
|
-
const overIndex = fieldKeys.indexOf(
|
|
270
|
+
const activeIndex = fieldKeys.indexOf(sourceKey);
|
|
271
|
+
const overIndex = fieldKeys.indexOf(targetKey);
|
|
221
272
|
if (activeIndex >= 0 && overIndex >= 0)
|
|
222
273
|
operation.move(activeIndex, overIndex);
|
|
223
274
|
};
|
|
@@ -233,7 +284,7 @@ const TabsFields = (props) => {
|
|
|
233
284
|
const result = await runAfterValidation(() => {
|
|
234
285
|
didRun = true;
|
|
235
286
|
return callback ? callback(record, option) : item.type === "copy" ? true : void 0;
|
|
236
|
-
});
|
|
287
|
+
}, validateAllItems);
|
|
237
288
|
return didRun ? result : FORM_LIST_ACTION_ABORT;
|
|
238
289
|
}
|
|
239
290
|
};
|
|
@@ -244,6 +295,9 @@ const TabsFields = (props) => {
|
|
|
244
295
|
const record = form.getFieldValue(itemNamePath);
|
|
245
296
|
const tabTitle = isFunction(title) ? title(record, index, form) : title;
|
|
246
297
|
const renderedTitle = tabTitle ?? `Tab ${index + 1}`;
|
|
298
|
+
const titleChars = typeof renderedTitle === "string" || typeof renderedTitle === "number" ? Array.from(String(renderedTitle)) : void 0;
|
|
299
|
+
const isTitleOverflow = titleChars && titleChars.length > MAX_TAB_TITLE_LENGTH;
|
|
300
|
+
const displayTitle = isTitleOverflow ? `${titleChars.slice(0, MAX_TAB_TITLE_LENGTH).join("")}...` : renderedTitle;
|
|
247
301
|
const tabActionProps = wrapValidatedActions(actionProps || void 0);
|
|
248
302
|
const errorCount = errorCounts.get(fieldKey) || 0;
|
|
249
303
|
return {
|
|
@@ -258,33 +312,27 @@ const TabsFields = (props) => {
|
|
|
258
312
|
count: errorCount,
|
|
259
313
|
overflowCount: 99,
|
|
260
314
|
size: "small",
|
|
261
|
-
children: /* @__PURE__ */ jsxs(
|
|
262
|
-
"span",
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
isView
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
]
|
|
286
|
-
}
|
|
287
|
-
)
|
|
315
|
+
children: /* @__PURE__ */ jsxs("span", { className: "pro-form-list-tabs-title-content", children: [
|
|
316
|
+
isTitleOverflow ? /* @__PURE__ */ jsx(Tooltip, { title: renderedTitle, placement: "top", children: /* @__PURE__ */ jsx("span", { className: "pro-form-list-tabs-title", children: displayTitle }) }) : /* @__PURE__ */ jsx("span", { className: "pro-form-list-tabs-title", children: displayTitle }),
|
|
317
|
+
actionProps !== false && /* @__PURE__ */ jsx(
|
|
318
|
+
ActionButton,
|
|
319
|
+
{
|
|
320
|
+
min,
|
|
321
|
+
max,
|
|
322
|
+
index,
|
|
323
|
+
length: fields.length,
|
|
324
|
+
operation,
|
|
325
|
+
namePath: itemNamePath,
|
|
326
|
+
form,
|
|
327
|
+
field: { ...field, key: fieldKey },
|
|
328
|
+
fields,
|
|
329
|
+
actionProps: tabActionProps,
|
|
330
|
+
mode: "tabs",
|
|
331
|
+
disabled,
|
|
332
|
+
isView
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] })
|
|
288
336
|
}
|
|
289
337
|
) }),
|
|
290
338
|
children: /* @__PURE__ */ jsx("div", { className: "pro-form-list-tabs-content", children: /* @__PURE__ */ jsx(Row, { gutter: 16, className: "pro-form-list-fields", children: /* @__PURE__ */ jsx(
|
|
@@ -300,16 +348,24 @@ const TabsFields = (props) => {
|
|
|
300
348
|
) }) })
|
|
301
349
|
};
|
|
302
350
|
});
|
|
303
|
-
|
|
304
|
-
|
|
351
|
+
const draggedLabel = (_a = items.find((item) => item.key === draggedKey)) == null ? void 0 : _a.label;
|
|
352
|
+
return /* @__PURE__ */ jsxs(
|
|
353
|
+
DndContext,
|
|
305
354
|
{
|
|
306
|
-
|
|
307
|
-
|
|
355
|
+
onDragStart: ({ active }) => {
|
|
356
|
+
var _a2;
|
|
357
|
+
return setDraggedKey((_a2 = active.data.current) == null ? void 0 : _a2.fieldKey);
|
|
358
|
+
},
|
|
359
|
+
onDragCancel: () => setDraggedKey(void 0),
|
|
360
|
+
onDragEnd: handleDragEnd,
|
|
308
361
|
children: [
|
|
309
362
|
/* @__PURE__ */ jsx(
|
|
310
363
|
Tabs,
|
|
311
364
|
{
|
|
312
365
|
className: "pro-form-list-tabs",
|
|
366
|
+
style: tabsStyle,
|
|
367
|
+
classNames: { popup: { root: "pro-form-list-tabs-dropdown" } },
|
|
368
|
+
more: { overlayStyle: tabsStyle },
|
|
313
369
|
type: "editable-card",
|
|
314
370
|
size: "small",
|
|
315
371
|
activeKey,
|
|
@@ -337,10 +393,26 @@ const TabsFields = (props) => {
|
|
|
337
393
|
emptyBtnText,
|
|
338
394
|
onAdd: handleAdd
|
|
339
395
|
}
|
|
396
|
+
),
|
|
397
|
+
typeof document !== "undefined" && createPortal(
|
|
398
|
+
/* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, zIndex: token.zIndexPopupBase + 100, children: React.isValidElement(draggedLabel) && /* @__PURE__ */ jsx(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
className: "pro-form-list-tabs pro-form-list-tabs-drag-overlay",
|
|
402
|
+
style: tabsStyle,
|
|
403
|
+
"data-active": draggedKey === activeKey,
|
|
404
|
+
"aria-hidden": "true",
|
|
405
|
+
children: /* @__PURE__ */ jsxs("div", { className: "pro-form-list-tabs-label", children: [
|
|
406
|
+
/* @__PURE__ */ jsx("span", { className: "pro-form-list-tabs-drag-handle", children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size: 16 }) }),
|
|
407
|
+
draggedLabel.props.children
|
|
408
|
+
] })
|
|
409
|
+
}
|
|
410
|
+
) }),
|
|
411
|
+
document.body
|
|
340
412
|
)
|
|
341
413
|
]
|
|
342
414
|
}
|
|
343
|
-
)
|
|
415
|
+
);
|
|
344
416
|
};
|
|
345
417
|
var TabsFields_default = TabsFields;
|
|
346
418
|
export {
|
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.pro-form-list
|
|
53
|
-
.pro-form-list-tabs {
|
|
52
|
+
.pro-form-list {
|
|
54
53
|
.@{ant-prefix}-tabs-nav {
|
|
55
54
|
margin-bottom: 0 !important;
|
|
56
55
|
}
|
|
@@ -116,63 +115,94 @@
|
|
|
116
115
|
background: transparent !important;
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
.pro-form-list-tool-btn-tabs {
|
|
121
|
-
width: auto;
|
|
122
|
-
min-width: 20px;
|
|
123
|
-
height: 20px;
|
|
124
|
-
padding: 0;
|
|
125
|
-
|
|
126
|
-
&:hover {
|
|
127
|
-
background: transparent !important;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
118
|
}
|
|
131
119
|
|
|
132
120
|
.pro-form-list-tabs {
|
|
133
121
|
&.@{ant-prefix}-tabs > .@{ant-prefix}-tabs-nav {
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
padding-top: 8px;
|
|
124
|
+
|
|
125
|
+
&::before {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
134
129
|
.@{ant-prefix}-tabs-nav-wrap {
|
|
130
|
+
min-width: 0;
|
|
135
131
|
overflow-x: clip;
|
|
136
132
|
overflow-y: visible;
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
.@{ant-prefix}-tabs-nav-list {
|
|
140
136
|
overflow: visible;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: 12px;
|
|
141
139
|
}
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
&.@{ant-prefix}-tabs-card > .@{ant-prefix}-tabs-nav {
|
|
145
|
-
&::before {
|
|
146
|
-
border-bottom-color: var(--ant-color-border, #d9d9d9);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
143
|
.@{ant-prefix}-tabs-tab {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
144
|
+
height: 32px;
|
|
145
|
+
// 覆盖全局 card Tabs 的强制内外边距,间距统一交给 nav-list。
|
|
146
|
+
padding: 0 !important;
|
|
147
|
+
margin: 0 !important;
|
|
148
|
+
background: transparent;
|
|
149
|
+
border: 0;
|
|
150
|
+
|
|
151
|
+
&.@{ant-prefix}-tabs-tab-active .pro-form-list-tabs-label {
|
|
152
|
+
color: var(--pro-form-list-tabs-primary);
|
|
153
|
+
background: var(--pro-form-list-tabs-primary-bg);
|
|
154
|
+
border-color: var(--pro-form-list-tabs-primary);
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
.@{ant-prefix}-tabs-tab
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
.@{ant-prefix}-tabs-tab-btn {
|
|
159
|
+
color: inherit;
|
|
160
|
+
text-shadow: none;
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
.@{ant-prefix}-tabs-nav-add {
|
|
165
164
|
width: auto;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
min-width: 32px;
|
|
166
|
+
height: 32px;
|
|
167
|
+
padding: 0 12px;
|
|
168
|
+
margin: 0;
|
|
169
|
+
color: var(--pro-form-list-tabs-muted);
|
|
170
|
+
background: var(--pro-form-list-tabs-bg);
|
|
171
|
+
border: 1px dashed var(--pro-form-list-tabs-border);
|
|
172
|
+
border-radius: 16px;
|
|
173
|
+
|
|
174
|
+
&:focus:not(:hover) {
|
|
175
|
+
color: var(--pro-form-list-tabs-muted);
|
|
176
|
+
border-color: var(--pro-form-list-tabs-border);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:hover {
|
|
180
|
+
color: var(--pro-form-list-tabs-primary-hover);
|
|
181
|
+
border-color: var(--pro-form-list-tabs-primary-hover);
|
|
182
|
+
}
|
|
169
183
|
}
|
|
170
184
|
}
|
|
171
185
|
|
|
172
186
|
.pro-form-list-tabs-label {
|
|
187
|
+
position: relative;
|
|
173
188
|
display: inline-flex;
|
|
174
189
|
align-items: center;
|
|
175
190
|
gap: 4px;
|
|
191
|
+
height: 32px;
|
|
192
|
+
padding: 0 12px;
|
|
193
|
+
color: var(--pro-form-list-tabs-text);
|
|
194
|
+
background: var(--pro-form-list-tabs-bg);
|
|
195
|
+
border: 1px solid var(--pro-form-list-tabs-border);
|
|
196
|
+
border-radius: 16px;
|
|
197
|
+
|
|
198
|
+
&:hover {
|
|
199
|
+
color: var(--pro-form-list-tabs-primary-hover);
|
|
200
|
+
border-color: var(--pro-form-list-tabs-primary-hover);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&[data-drag-over='true'] {
|
|
204
|
+
border-color: var(--pro-form-list-tabs-primary-hover);
|
|
205
|
+
}
|
|
176
206
|
}
|
|
177
207
|
|
|
178
208
|
.pro-form-list-tabs-title {
|
|
@@ -180,15 +210,20 @@
|
|
|
180
210
|
}
|
|
181
211
|
|
|
182
212
|
.pro-form-list-tabs-error-badge {
|
|
213
|
+
// 角标以整个胶囊为定位容器,随拖动一起移动。
|
|
214
|
+
position: static;
|
|
183
215
|
display: inline-flex;
|
|
216
|
+
color: inherit;
|
|
184
217
|
|
|
185
218
|
.@{ant-prefix}-badge-count {
|
|
186
|
-
top:
|
|
187
|
-
right:
|
|
219
|
+
top: 4px;
|
|
220
|
+
right: 4px;
|
|
188
221
|
z-index: 2;
|
|
189
222
|
pointer-events: none;
|
|
190
223
|
transform: translate(50%, -50%);
|
|
191
|
-
|
|
224
|
+
color: var(--pro-form-list-tabs-solid-text);
|
|
225
|
+
background: var(--pro-form-list-tabs-error);
|
|
226
|
+
box-shadow: 0 0 0 2px var(--pro-form-list-tabs-bg);
|
|
192
227
|
transition: none;
|
|
193
228
|
animation: none;
|
|
194
229
|
|
|
@@ -204,36 +239,132 @@
|
|
|
204
239
|
align-items: center;
|
|
205
240
|
}
|
|
206
241
|
|
|
242
|
+
.pro-form-list-tabs-add {
|
|
243
|
+
display: inline-flex;
|
|
244
|
+
gap: 4px;
|
|
245
|
+
align-items: center;
|
|
246
|
+
white-space: nowrap;
|
|
247
|
+
.pro-form-list-tabs-add-label {
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.pro-form-list-tabs-content {
|
|
253
|
+
padding: 12px 0 0;
|
|
254
|
+
border: 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.pro-form-list-tabs,
|
|
259
|
+
.pro-form-list-tabs-dropdown {
|
|
207
260
|
.pro-form-list-tabs-drag-handle {
|
|
208
261
|
display: inline-flex;
|
|
262
|
+
flex-shrink: 0;
|
|
209
263
|
align-items: center;
|
|
264
|
+
color: var(--pro-form-list-tabs-muted);
|
|
265
|
+
touch-action: none;
|
|
266
|
+
|
|
210
267
|
.pro-icon {
|
|
211
268
|
cursor: move;
|
|
212
269
|
}
|
|
213
270
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
271
|
+
|
|
272
|
+
.pro-form-list-action {
|
|
273
|
+
padding-bottom: 0;
|
|
274
|
+
|
|
275
|
+
[data-form-list-action] {
|
|
276
|
+
min-width: 20px;
|
|
277
|
+
height: 20px;
|
|
278
|
+
padding: 0;
|
|
279
|
+
color: inherit;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
[data-form-list-action='delete'] {
|
|
283
|
+
color: var(--pro-form-list-tabs-close);
|
|
284
|
+
border-radius: 4px;
|
|
285
|
+
transition: color 0.2s;
|
|
286
|
+
|
|
287
|
+
&:hover {
|
|
288
|
+
color: var(--pro-form-list-tabs-muted);
|
|
289
|
+
background: transparent;
|
|
290
|
+
}
|
|
217
291
|
}
|
|
218
292
|
}
|
|
293
|
+
}
|
|
219
294
|
|
|
220
|
-
|
|
221
|
-
|
|
295
|
+
.pro-form-list-tabs-dropdown {
|
|
296
|
+
min-width: 180px;
|
|
297
|
+
max-width: calc(100vw - 32px);
|
|
298
|
+
|
|
299
|
+
.@{ant-prefix}-tabs-dropdown-menu-item {
|
|
300
|
+
&:hover,
|
|
301
|
+
&-active,
|
|
302
|
+
&-selected {
|
|
303
|
+
background: transparent;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.@{ant-prefix}-tabs-dropdown-menu-item > span {
|
|
308
|
+
display: block;
|
|
309
|
+
width: 100%;
|
|
310
|
+
min-width: 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.pro-form-list-tabs-label {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
222
316
|
gap: 4px;
|
|
317
|
+
width: 100%;
|
|
318
|
+
min-width: 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.pro-form-list-tabs-error-badge {
|
|
322
|
+
display: flex;
|
|
323
|
+
flex: 1;
|
|
223
324
|
align-items: center;
|
|
325
|
+
gap: 8px;
|
|
326
|
+
min-width: 0;
|
|
327
|
+
color: inherit;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.pro-form-list-tabs-title-content {
|
|
331
|
+
display: contents;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.pro-form-list-tabs-title {
|
|
335
|
+
flex: 1;
|
|
336
|
+
min-width: 0;
|
|
337
|
+
overflow: hidden;
|
|
224
338
|
white-space: nowrap;
|
|
225
|
-
|
|
226
|
-
font-size: 14px;
|
|
227
|
-
}
|
|
339
|
+
text-overflow: ellipsis;
|
|
228
340
|
}
|
|
229
341
|
|
|
230
342
|
.pro-form-list-action {
|
|
231
|
-
|
|
343
|
+
order: 2;
|
|
344
|
+
flex-shrink: 0;
|
|
345
|
+
margin-inline-start: auto;
|
|
232
346
|
}
|
|
233
347
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
348
|
+
.@{ant-prefix}-badge-count {
|
|
349
|
+
position: static;
|
|
350
|
+
order: 1;
|
|
351
|
+
flex-shrink: 0;
|
|
352
|
+
transform: none;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.pro-form-list-tabs-drag-overlay {
|
|
357
|
+
pointer-events: none;
|
|
358
|
+
|
|
359
|
+
.pro-form-list-tabs-label {
|
|
360
|
+
width: max-content;
|
|
361
|
+
min-width: 100%;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&[data-active='true'] .pro-form-list-tabs-label {
|
|
365
|
+
color: var(--pro-form-list-tabs-primary);
|
|
366
|
+
background: var(--pro-form-list-tabs-primary-bg);
|
|
367
|
+
border-color: var(--pro-form-list-tabs-primary);
|
|
237
368
|
}
|
|
238
369
|
}
|
|
239
370
|
|