@zat-design/sisyphus-react 4.6.1 → 4.6.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.
@@ -239,6 +239,12 @@
239
239
  }
240
240
  }
241
241
 
242
+ .@{ant-prefix}-table-tbody
243
+ .is-editing:not(.@{ant-prefix}-table-measure-row):not(.@{ant-prefix}-table-row-extra)
244
+ .@{ant-prefix}-form-item.@{ant-prefix}-form-item-has-error {
245
+ margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1)) !important;
246
+ }
247
+
242
248
  .@{ant-prefix}-table.@{ant-prefix}-table-bordered > .@{ant-prefix}-table-container {
243
249
  border: 0;
244
250
  }
@@ -19,6 +19,7 @@ import ProIcon from "../../../../../ProIcon";
19
19
  import locale from "../../../../../locale";
20
20
  import deleteSvg from "../../../../../assets/delete.svg";
21
21
  import close2Svg from "../../../../../assets/close2.svg";
22
+ import { FORM_LIST_ACTION_ABORT } from "../toolbarActions";
22
23
  const filterKeys = ["actionType"];
23
24
  const getDefaultActions = (mode) => {
24
25
  const originActions = {
@@ -36,7 +37,7 @@ const getDefaultActions = (mode) => {
36
37
  remove(index);
37
38
  },
38
39
  label: locale.ProForm.formListActions[1],
39
- icon: mode === "less" ? /* @__PURE__ */ jsx(ProIcon, { component: close2Svg, size: 14, className: "single-delete" }) : /* @__PURE__ */ jsx(ProIcon, { component: deleteSvg, size: 18 })
40
+ icon: mode === "less" || mode === "tabs" ? /* @__PURE__ */ jsx(ProIcon, { component: close2Svg, size: 14, className: "single-delete" }) : /* @__PURE__ */ jsx(ProIcon, { component: deleteSvg, size: 18 })
40
41
  },
41
42
  copy: {
42
43
  onClick: (record, { namePath, index, operation }) => {
@@ -69,12 +70,7 @@ const getDefaultActions = (mode) => {
69
70
  originActions[key].className = "pro-form-list-tool-btn";
70
71
  });
71
72
  }
72
- if (mode === "line") {
73
- Object.keys(originActions).forEach((key) => {
74
- delete originActions[key].label;
75
- });
76
- }
77
- if (mode === "less") {
73
+ if (mode === "line" || mode === "less" || mode === "tabs") {
78
74
  Object.keys(originActions).forEach((key) => {
79
75
  delete originActions[key].label;
80
76
  });
@@ -115,6 +111,8 @@ const ActionButton = (props) => {
115
111
  const handleClick = async (defaultCallback, callback, index2, item) => {
116
112
  const value = form.getFieldValue(namePath);
117
113
  const data = await (callback == null ? void 0 : callback(value, { namePath, index: index2, operation, form }));
114
+ if (data === FORM_LIST_ACTION_ABORT)
115
+ return;
118
116
  if (!callback || data === true) {
119
117
  defaultCallback == null ? void 0 : defaultCallback(value, { namePath, index: index2, operation, form });
120
118
  return;
@@ -172,6 +170,8 @@ const ActionButton = (props) => {
172
170
  const handleAddClick = async () => {
173
171
  const value = form.getFieldValue(namePath);
174
172
  const data = await (_onClick == null ? void 0 : _onClick(value, { namePath, index, operation, form }));
173
+ if (data === FORM_LIST_ACTION_ABORT)
174
+ return;
175
175
  if (!_onClick || data === true) {
176
176
  if (item.addIndex !== void 0) {
177
177
  const insertIndex = typeof item.addIndex === "function" ? item.addIndex(value, { index, namePath, form, operation }) : item.addIndex;
@@ -208,6 +208,7 @@ const ActionButton = (props) => {
208
208
  {
209
209
  ...defaultRest,
210
210
  ...omit(rest, filterKeys),
211
+ className: "pro-form-list-delete-icon",
211
212
  type: "text",
212
213
  onClick: (e) => e.stopPropagation(),
213
214
  children: label || defaultLabel
@@ -221,7 +222,8 @@ const ActionButton = (props) => {
221
222
  className: classNames({
222
223
  "pro-form-list-tool-btn": mode === "line",
223
224
  "pro-form-list-tool-btn-block": mode === "block",
224
- "pro-form-list-tool-btn-less": mode === "less"
225
+ "pro-form-list-tool-btn-less": mode === "less",
226
+ "pro-form-list-tool-btn-tabs": mode === "tabs"
225
227
  }),
226
228
  ...defaultRest,
227
229
  ...omit(rest, filterKeys),
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { FormInstance, FormListFieldData } from 'antd';
3
+ import type { InternalNamePath } from 'antd/es/form/interface';
4
+ import type { DiffConfigType } from '../../../../propsType';
5
+ import type { FormListType } from '../propsType';
6
+ interface Props extends Omit<FormListType, 'fields' | 'form'> {
7
+ diffConfig?: DiffConfigType;
8
+ fields: FormListFieldData[];
9
+ form: FormInstance;
10
+ isView?: boolean;
11
+ namePath: InternalNamePath;
12
+ processColumns: (index: number, namePath: InternalNamePath) => FormListType['columns'];
13
+ }
14
+ declare const TabsFields: React.FC<Props>;
15
+ export default TabsFields;
@@ -0,0 +1,269 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import { Row, Tabs } from "antd";
4
+ 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";
8
+ import isFunction from "lodash/isFunction";
9
+ import dragSvg from "../../../../../assets/drag.svg";
10
+ import ProIcon from "../../../../../ProIcon";
11
+ import locale from "../../../../../locale";
12
+ import RenderFields from "../../../render/RenderFields";
13
+ import ActionButton from "./ActionButton";
14
+ import { memoWith } from "../utils";
15
+ import {
16
+ executeToolbarAdd,
17
+ FORM_LIST_ACTION_ABORT,
18
+ isToolbarActionVisible,
19
+ normalizeToolbarActions
20
+ } from "../toolbarActions";
21
+ const MemoRenderFields = React.memo(RenderFields, memoWith);
22
+ const SortableTabLabel = ({
23
+ children,
24
+ disabled,
25
+ draggable,
26
+ fieldKey
27
+ }) => {
28
+ const {
29
+ attributes,
30
+ listeners,
31
+ setActivatorNodeRef,
32
+ setNodeRef,
33
+ transform,
34
+ transition,
35
+ isDragging
36
+ } = useSortable({
37
+ id: fieldKey,
38
+ disabled: disabled || !draggable
39
+ });
40
+ return /* @__PURE__ */ jsxs(
41
+ "div",
42
+ {
43
+ ref: setNodeRef,
44
+ className: "pro-form-list-tabs-label",
45
+ style: {
46
+ opacity: isDragging ? 0.4 : void 0,
47
+ transform: CSS.Translate.toString(transform),
48
+ transition
49
+ },
50
+ children: [
51
+ !disabled && draggable && /* @__PURE__ */ jsx(
52
+ "span",
53
+ {
54
+ ...attributes,
55
+ ...listeners,
56
+ ref: setActivatorNodeRef,
57
+ className: "pro-form-list-tabs-drag-handle",
58
+ children: /* @__PURE__ */ jsx(ProIcon, { component: dragSvg, size: 16, color: "#949599" })
59
+ }
60
+ ),
61
+ children
62
+ ]
63
+ }
64
+ );
65
+ };
66
+ const TabsFields = (props) => {
67
+ const {
68
+ actionProps,
69
+ diffConfig,
70
+ disabled,
71
+ draggable,
72
+ fields,
73
+ form,
74
+ isView,
75
+ max,
76
+ min,
77
+ namePath,
78
+ operation,
79
+ processColumns,
80
+ span = 8,
81
+ title,
82
+ toolbarProps
83
+ } = props;
84
+ const fieldKeys = fields.map((field) => String(field.key));
85
+ const fieldKeysSignature = fieldKeys.join("\0");
86
+ const [activeKey, setActiveKey] = useState(fieldKeys[0]);
87
+ const activeIndexRef = useRef(0);
88
+ const fieldKeysRef = useRef(fieldKeys);
89
+ const pendingAddKeysRef = useRef(null);
90
+ const validatingRef = useRef(false);
91
+ fieldKeysRef.current = fieldKeys;
92
+ const currentIndex = activeKey ? fieldKeys.indexOf(activeKey) : -1;
93
+ if (currentIndex >= 0)
94
+ activeIndexRef.current = currentIndex;
95
+ useEffect(() => {
96
+ const pendingKeys = pendingAddKeysRef.current;
97
+ const addedKey = pendingKeys && fieldKeys.find((key) => !pendingKeys.has(key));
98
+ if (addedKey) {
99
+ pendingAddKeysRef.current = null;
100
+ activeIndexRef.current = fieldKeys.indexOf(addedKey);
101
+ setActiveKey(addedKey);
102
+ return;
103
+ }
104
+ if (activeKey && fieldKeys.includes(activeKey))
105
+ return;
106
+ const fallbackIndex = Math.min(activeIndexRef.current, fieldKeys.length - 1);
107
+ setActiveKey(fallbackIndex >= 0 ? fieldKeys[fallbackIndex] : void 0);
108
+ }, [activeKey, fieldKeysSignature]);
109
+ const validateCurrent = useCallback(async () => {
110
+ if (!activeKey)
111
+ return true;
112
+ const activeField = fields.find((field) => String(field.key) === activeKey);
113
+ if (!activeField || !(form == null ? void 0 : form.validateFields))
114
+ return true;
115
+ try {
116
+ await form.validateFields([[...namePath, activeField.name]], { recursive: true });
117
+ return true;
118
+ } catch {
119
+ return false;
120
+ }
121
+ }, [activeKey, fieldKeysSignature, form, namePath]);
122
+ const runAfterValidation = useCallback(
123
+ async (callback) => {
124
+ if (validatingRef.current)
125
+ return false;
126
+ validatingRef.current = true;
127
+ try {
128
+ if (!await validateCurrent())
129
+ return false;
130
+ return await callback();
131
+ } finally {
132
+ validatingRef.current = false;
133
+ }
134
+ },
135
+ [validateCurrent]
136
+ );
137
+ const normalizedToolbarProps = useMemo(
138
+ () => toolbarProps === false ? [] : normalizeToolbarActions(toolbarProps),
139
+ [toolbarProps]
140
+ );
141
+ const addAction = normalizedToolbarProps.find(
142
+ (item) => item.type === "add" && isToolbarActionVisible(item, form, namePath)
143
+ );
144
+ const addLabel = (addAction == null ? void 0 : addAction.label) ?? locale.ProForm.formListTabsAdd;
145
+ const hideAdd = !addAction || addAction.disabled || disabled || isView || Boolean(max && max <= fields.length);
146
+ const handleAdd = async () => {
147
+ if (!addAction || hideAdd)
148
+ return;
149
+ await runAfterValidation(async () => {
150
+ pendingAddKeysRef.current = new Set(fieldKeysRef.current);
151
+ const added = await executeToolbarAdd({ action: addAction, form, namePath, operation });
152
+ if (!added)
153
+ pendingAddKeysRef.current = null;
154
+ return added;
155
+ });
156
+ };
157
+ const handleChange = (nextActiveKey) => {
158
+ if (nextActiveKey === activeKey)
159
+ return;
160
+ void runAfterValidation(() => {
161
+ const nextIndex = fieldKeysRef.current.indexOf(nextActiveKey);
162
+ if (nextIndex < 0)
163
+ return false;
164
+ activeIndexRef.current = nextIndex;
165
+ setActiveKey(nextActiveKey);
166
+ return true;
167
+ });
168
+ };
169
+ const handleDragEnd = ({ active, over }) => {
170
+ if (!over || active.id === over.id)
171
+ return;
172
+ const activeIndex = fieldKeys.indexOf(String(active.id));
173
+ const overIndex = fieldKeys.indexOf(String(over.id));
174
+ if (activeIndex >= 0 && overIndex >= 0)
175
+ operation.move(activeIndex, overIndex);
176
+ };
177
+ const wrapValidatedActions = (items2) => items2 == null ? void 0 : items2.filter((item) => item.type !== "moveUp" && item.type !== "moveDown").map((item) => {
178
+ if (item.type !== "add" && item.type !== "copy")
179
+ return item;
180
+ const callback = item.onClick || item.onHandle;
181
+ return {
182
+ ...item,
183
+ onHandle: void 0,
184
+ onClick: async (record, option) => {
185
+ let didRun = false;
186
+ const result = await runAfterValidation(() => {
187
+ didRun = true;
188
+ return callback ? callback(record, option) : item.type === "copy" ? true : void 0;
189
+ });
190
+ return didRun ? result : FORM_LIST_ACTION_ABORT;
191
+ }
192
+ };
193
+ });
194
+ const items = fields.map((field, index) => {
195
+ const fieldKey = String(field.key);
196
+ const itemNamePath = [...namePath, field.name];
197
+ const record = form.getFieldValue(itemNamePath);
198
+ const tabTitle = isFunction(title) ? title(record, index, form) : title;
199
+ const renderedTitle = tabTitle ?? `Tab ${index + 1}`;
200
+ const tabActionProps = wrapValidatedActions(actionProps || void 0);
201
+ return {
202
+ key: fieldKey,
203
+ closable: false,
204
+ label: /* @__PURE__ */ jsxs(SortableTabLabel, { fieldKey, draggable, disabled: disabled || isView, children: [
205
+ /* @__PURE__ */ jsx("span", { className: "pro-form-list-tabs-title", children: renderedTitle }),
206
+ actionProps !== false && /* @__PURE__ */ jsx(
207
+ ActionButton,
208
+ {
209
+ min,
210
+ max,
211
+ index,
212
+ length: fields.length,
213
+ operation,
214
+ namePath: itemNamePath,
215
+ form,
216
+ field: { ...field, key: fieldKey },
217
+ fields,
218
+ actionProps: tabActionProps,
219
+ mode: "tabs",
220
+ disabled,
221
+ isView
222
+ }
223
+ )
224
+ ] }),
225
+ children: /* @__PURE__ */ jsx("div", { className: "pro-form-list-tabs-content", children: /* @__PURE__ */ jsx(Row, { gutter: 16, className: "pro-form-list-fields", children: /* @__PURE__ */ jsx(
226
+ MemoRenderFields,
227
+ {
228
+ columns: processColumns(index, itemNamePath),
229
+ form,
230
+ colProps: { span },
231
+ disabled,
232
+ isView,
233
+ diffConfig
234
+ }
235
+ ) }) })
236
+ };
237
+ });
238
+ return /* @__PURE__ */ jsx(DndContext, { onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(
239
+ SortableContext,
240
+ {
241
+ items: fieldKeys.map((key) => ({ id: key })),
242
+ strategy: horizontalListSortingStrategy,
243
+ children: /* @__PURE__ */ jsx(
244
+ Tabs,
245
+ {
246
+ className: "pro-form-list-tabs",
247
+ type: "editable-card",
248
+ size: "small",
249
+ activeKey,
250
+ addIcon: /* @__PURE__ */ jsxs("span", { className: "pro-form-list-tabs-add", children: [
251
+ /* @__PURE__ */ jsx(PlusOutlined, {}),
252
+ /* @__PURE__ */ jsx("span", { className: "pro-form-list-tabs-add-label", children: addLabel })
253
+ ] }),
254
+ hideAdd,
255
+ items,
256
+ onChange: handleChange,
257
+ onEdit: (_, action) => {
258
+ if (action === "add")
259
+ void handleAdd();
260
+ }
261
+ }
262
+ )
263
+ }
264
+ ) });
265
+ };
266
+ var TabsFields_default = TabsFields;
267
+ export {
268
+ TabsFields_default as default
269
+ };
@@ -1,10 +1,14 @@
1
1
  import { Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Space, Button } from "antd";
3
3
  import { PlusOutlined } from "@ant-design/icons";
4
- import isFunction from "lodash/isFunction";
5
4
  import omit from "lodash/omit";
6
5
  import { useMemo } from "react";
7
6
  import locale from "../../../../../locale";
7
+ import {
8
+ executeToolbarAdd,
9
+ isToolbarActionVisible,
10
+ normalizeToolbarActions
11
+ } from "../toolbarActions";
8
12
  const actions = {
9
13
  add: {
10
14
  onClick: (value, { operation }) => {
@@ -15,65 +19,27 @@ const actions = {
15
19
  icon: /* @__PURE__ */ jsx(PlusOutlined, {})
16
20
  }
17
21
  };
18
- const defaultActionProps = [{ type: "add" }];
19
22
  const filterKeys = ["actionType", "addIndex", "show"];
20
23
  const ToolbarButton = (props) => {
21
24
  const { namePath, form, operation, length, fields, min, max, disabled, isView } = props;
22
- const toolbarProps = useMemo(() => {
23
- var _a;
24
- const _toolbarProps = (_a = props.toolbarProps) == null ? void 0 : _a.map((item) => {
25
- return {
26
- ...item,
27
- type: item.actionType || item.type
28
- };
29
- });
30
- if (!(_toolbarProps == null ? void 0 : _toolbarProps.find((item) => item.type === "add"))) {
31
- return _toolbarProps ? [..._toolbarProps, ...defaultActionProps] : defaultActionProps;
32
- }
33
- return _toolbarProps;
34
- }, [props.toolbarProps]);
35
- const handleClick = async (defaultCallback, callback, item) => {
36
- const value = form.getFieldValue(namePath);
37
- const data = await (callback == null ? void 0 : callback(value, { operation, form, namePath, index: (value == null ? void 0 : value.length) || 0 }));
38
- if (!callback || data === true) {
39
- if ((item == null ? void 0 : item.type) === "add") {
40
- if (item.addIndex !== void 0) {
41
- const insertIndex = typeof item.addIndex === "function" ? item.addIndex(value, { namePath, form, operation, index: (value == null ? void 0 : value.length) || 0 }) : item.addIndex;
42
- operation.add(data, insertIndex);
43
- } else {
44
- operation.add(data);
45
- }
46
- } else {
47
- defaultCallback == null ? void 0 : defaultCallback(value, { operation, form, namePath, index: (value == null ? void 0 : value.length) || 0 });
48
- }
49
- return;
50
- }
51
- if ((item == null ? void 0 : item.type) === "add" && data) {
52
- if (item.addIndex !== void 0) {
53
- const insertIndex = typeof item.addIndex === "function" ? item.addIndex(value, { namePath, form, operation, index: (value == null ? void 0 : value.length) || 0 }) : item.addIndex;
54
- operation.add(data, insertIndex);
55
- } else {
56
- operation.add(data);
57
- }
58
- }
59
- };
25
+ const toolbarProps = useMemo(
26
+ () => normalizeToolbarActions(props.toolbarProps),
27
+ [props.toolbarProps]
28
+ );
60
29
  const customClick = (callback, item) => {
61
30
  const value = form.getFieldValue(namePath);
62
31
  callback == null ? void 0 : callback(value, { operation, form, namePath, index: 0 });
63
32
  };
64
33
  return /* @__PURE__ */ jsx(Space, { align: "start", className: "pro-form-list-toolbar", children: toolbarProps == null ? void 0 : toolbarProps.map((item) => {
65
- if (item.show === false)
34
+ if (!isToolbarActionVisible(item, form, namePath))
66
35
  return /* @__PURE__ */ jsx(Fragment, {});
67
- if (isFunction(item.show) && !item.show(form.getFieldValue(namePath), { namePath, form })) {
68
- return /* @__PURE__ */ jsx(Fragment, {});
69
- }
70
36
  const { label, onClick, onHandle, type, ...rest } = item;
71
37
  const toolbarKey = `${namePath.join(".")}-${type ?? "custom"}-${label ?? ""}`;
72
38
  const _onClick = onClick || onHandle;
73
39
  if (type === "add") {
74
40
  if (disabled || isView)
75
41
  return /* @__PURE__ */ jsx(Fragment, {});
76
- const { onClick: internalOnClick, label: defaultLabel, ...defaultRest } = actions[type];
42
+ const { label: defaultLabel, ...defaultRest } = actions[type];
77
43
  if (max && max <= fields.length && type === "add") {
78
44
  return false;
79
45
  }
@@ -83,7 +49,7 @@ const ToolbarButton = (props) => {
83
49
  ...actions[type],
84
50
  ...omit(rest, filterKeys),
85
51
  type: "link",
86
- onClick: () => handleClick(internalOnClick, _onClick, item),
52
+ onClick: () => executeToolbarAdd({ action: item, form, namePath, operation }),
87
53
  children: label || defaultLabel
88
54
  },
89
55
  toolbarKey
@@ -10,6 +10,7 @@ import ToolbarButton from "./components/ToolbarButton";
10
10
  import BlockFields from "./components/BlockFields";
11
11
  import LineFields from "./components/LineFields";
12
12
  import Empty from "./components/Empty";
13
+ import TabsFields from "./components/TabsFields";
13
14
  import ProForm from "../../../../ProForm";
14
15
  import { useProConfig } from "../../../../ProConfigProvider";
15
16
  const FormList = (props, ref) => {
@@ -108,6 +109,24 @@ const FormList = (props, ref) => {
108
109
  props.operation.move(activeIndex, overIndex);
109
110
  }
110
111
  };
112
+ if (mode === "tabs") {
113
+ return /* @__PURE__ */ jsxs("div", { className, children: [
114
+ /* @__PURE__ */ jsx(
115
+ TabsFields,
116
+ {
117
+ ...props,
118
+ mode: "tabs",
119
+ fields,
120
+ form,
121
+ isView,
122
+ namePath: _namePath,
123
+ processColumns,
124
+ diffConfig: _diffConfig
125
+ }
126
+ ),
127
+ /* @__PURE__ */ jsx(Form.ErrorList, { errors })
128
+ ] });
129
+ }
111
130
  return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(DndContext, { onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxs(
112
131
  SortableContext,
113
132
  {
@@ -34,7 +34,7 @@ export interface ToolbarActionType extends Omit<ActionType, 'actionType' | 'onHa
34
34
  show?: boolean | ((record: any, option: Pick<Option, 'form' | 'namePath'>) => boolean);
35
35
  addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
36
36
  }
37
- export type FormListMode = 'block' | 'line' | 'less';
37
+ export type FormListMode = 'block' | 'line' | 'less' | 'tabs';
38
38
  export interface FormListType {
39
39
  columns: ProFormColumnType[];
40
40
  otherProps?: ProFormOtherType;
@@ -17,16 +17,6 @@
17
17
  color: #949599;
18
18
  }
19
19
 
20
- .single-delete {
21
- width: 14px !important;
22
- height: 14px !important;
23
- color: @zaui-placeholder;
24
-
25
- &:hover {
26
- color: @zaui-aide-text;
27
- }
28
- }
29
-
30
20
  &:nth-child(1) {
31
21
  flex: 1;
32
22
  }
@@ -59,6 +49,30 @@
59
49
  }
60
50
  }
61
51
 
52
+ .pro-form-list,
53
+ .pro-form-list-tabs {
54
+ .@{ant-prefix}-tabs-nav {
55
+ margin-bottom: 0 !important;
56
+ }
57
+ &.@{ant-prefix}-tabs-card {
58
+ .@{ant-prefix}-tabs-tab {
59
+ padding: 0 !important;
60
+ margin-right: 4px !important;
61
+ min-width: 70px;
62
+ }
63
+ }
64
+
65
+ .single-delete {
66
+ width: 14px !important;
67
+ height: 14px !important;
68
+ color: @zaui-placeholder;
69
+
70
+ &:hover {
71
+ color: @zaui-aide-text;
72
+ }
73
+ }
74
+ }
75
+
62
76
  .pro-form-list-line {
63
77
  padding: var(--zaui-height-size-md, 16px);
64
78
  padding-bottom: 0;
@@ -102,6 +116,89 @@
102
116
  background: transparent !important;
103
117
  }
104
118
  }
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
+ }
131
+
132
+ .pro-form-list-tabs {
133
+ &.@{ant-prefix}-tabs-card > .@{ant-prefix}-tabs-nav {
134
+ &::before {
135
+ border-bottom-color: var(--ant-color-border, #d9d9d9);
136
+ }
137
+
138
+ .@{ant-prefix}-tabs-tab {
139
+ padding: 0;
140
+ border-color: var(--ant-color-border, #d9d9d9);
141
+ border-radius: var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px) 0 0;
142
+
143
+ &.@{ant-prefix}-tabs-tab-active {
144
+ border-bottom-color: var(--ant-color-bg-container, #fff);
145
+ }
146
+ }
147
+
148
+ .@{ant-prefix}-tabs-tab + .@{ant-prefix}-tabs-tab,
149
+ .@{ant-prefix}-tabs-nav-add {
150
+ margin-left: 4px;
151
+ }
152
+
153
+ .@{ant-prefix}-tabs-nav-add {
154
+ width: auto;
155
+ padding: 0 @zaui-space-size-xs;
156
+ border-color: var(--ant-color-border, #d9d9d9);
157
+ border-radius: var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px) 0 0;
158
+ }
159
+ }
160
+
161
+ .pro-form-list-tabs-label {
162
+ display: inline-flex;
163
+ align-items: center;
164
+ gap: 4px;
165
+ }
166
+
167
+ .pro-form-list-tabs-title {
168
+ white-space: nowrap;
169
+ }
170
+
171
+ .pro-form-list-tabs-drag-handle {
172
+ display: inline-flex;
173
+ align-items: center;
174
+ .pro-icon {
175
+ cursor: move;
176
+ }
177
+ }
178
+ .pro-form-list-delete-icon {
179
+ &:hover {
180
+ background: transparent !important;
181
+ }
182
+ }
183
+
184
+ .pro-form-list-tabs-add {
185
+ display: inline-flex;
186
+ gap: 4px;
187
+ align-items: center;
188
+ white-space: nowrap;
189
+ .pro-form-list-tabs-add-label {
190
+ font-size: 14px;
191
+ }
192
+ }
193
+
194
+ .pro-form-list-action {
195
+ padding-bottom: 0;
196
+ }
197
+
198
+ .pro-form-list-tabs-content {
199
+ padding: 12px 0 0;
200
+ border: 0;
201
+ }
105
202
  }
106
203
 
107
204
  .pro-form-list-empty {
@@ -0,0 +1,14 @@
1
+ import type { FormInstance, FormListOperation } from 'antd';
2
+ import type { InternalNamePath } from 'antd/es/form/interface';
3
+ import type { ToolbarActionType } from './propsType';
4
+ export declare const FORM_LIST_ACTION_ABORT: unique symbol;
5
+ export declare const normalizeToolbarActions: (toolbarProps?: ToolbarActionType[]) => ToolbarActionType[];
6
+ export declare const isToolbarActionVisible: (item: ToolbarActionType, form: FormInstance, namePath: InternalNamePath) => boolean;
7
+ interface ExecuteToolbarAddOptions {
8
+ action: ToolbarActionType;
9
+ form: FormInstance;
10
+ namePath: InternalNamePath;
11
+ operation: FormListOperation;
12
+ }
13
+ export declare const executeToolbarAdd: ({ action, form, namePath, operation, }: ExecuteToolbarAddOptions) => Promise<boolean>;
14
+ export {};