@yuntijs/ui 1.0.0-beta.102 → 1.0.0-beta.104
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/es/CollapseGroup/index.js +20 -4
- package/es/CollapseGroup/style.d.ts +3 -1
- package/es/CollapseGroup/style.js +3 -2
- package/es/Form/collapse-list/hooks.d.ts +3 -1
- package/es/Form/collapse-list/hooks.js +27 -7
- package/es/Form/collapse-list/index.d.ts +3 -2
- package/es/Form/collapse-list/index.js +48 -26
- package/es/Form/collapse-list/style.d.ts +1 -0
- package/es/Form/collapse-list/style.js +3 -2
- package/package.json +1 -1
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "variant"];
|
|
3
|
+
var _excluded = ["className", "variant", "collapsible", "expandIcon"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import { Form as LobeForm } from '@lobehub/ui';
|
|
6
|
+
import { ActionIcon, Form as LobeForm } from '@lobehub/ui';
|
|
7
|
+
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { useStyles } from "./style";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -11,13 +12,28 @@ var FormGroup = LobeForm.Group;
|
|
|
11
12
|
export var CollapseGroup = function CollapseGroup(_ref) {
|
|
12
13
|
var className = _ref.className,
|
|
13
14
|
variant = _ref.variant,
|
|
15
|
+
collapsible = _ref.collapsible,
|
|
16
|
+
_ref$expandIcon = _ref.expandIcon,
|
|
17
|
+
expandIcon = _ref$expandIcon === void 0 ? function (panelProps) {
|
|
18
|
+
return /*#__PURE__*/_jsx(ActionIcon, {
|
|
19
|
+
icon: panelProps.isActive ? ChevronDown : ChevronRight,
|
|
20
|
+
size: {
|
|
21
|
+
blockSize: 24,
|
|
22
|
+
fontSize: 14,
|
|
23
|
+
strokeWidth: 3
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
} : _ref$expandIcon,
|
|
14
27
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
var _useStyles = useStyles(
|
|
28
|
+
var _useStyles = useStyles({
|
|
29
|
+
collapsible: collapsible
|
|
30
|
+
}),
|
|
16
31
|
styles = _useStyles.styles,
|
|
17
32
|
cx = _useStyles.cx;
|
|
18
33
|
return /*#__PURE__*/_jsx(FormGroup, _objectSpread({
|
|
19
34
|
className: cx(styles.root, className),
|
|
20
|
-
collapsible: variant
|
|
35
|
+
collapsible: variant === 'pure' ? false : collapsible,
|
|
36
|
+
expandIcon: expandIcon,
|
|
21
37
|
variant: variant
|
|
22
38
|
}, otherProps));
|
|
23
39
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export declare const useStyles: (props?:
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
collapsible?: boolean | undefined;
|
|
3
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
2
4
|
root: import("antd-style").SerializedStyles;
|
|
3
5
|
}>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
export var useStyles = createStyles(function (_ref) {
|
|
4
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
prefixCls = _ref.prefixCls;
|
|
8
|
+
var collapsible = _ref2.collapsible;
|
|
8
9
|
return {
|
|
9
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
10
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n .", "-collapse {\n &-header {\n padding: 0 !important;\n &-text {\n flex: 1 !important;\n padding: ", "px ", "px ", "px\n ", "px;\n & > * {\n font-size: ", "px;\n /* font-weight: unset; */\n }\n }\n }\n &-expand-icon {\n cursor: pointer;\n padding: ", "px 0 ", "px ", "px;\n }\n &-extra {\n padding-right: ", "px;\n }\n &-item > .", "-collapse-content {\n padding: ", "px 0;\n background-color: ", ";\n }\n &-content {\n &-box {\n padding: ", "px ", "px !important;\n }\n }\n }\n "])), token.margin, prefixCls, token.paddingSM, token.paddingSM, token.paddingSM, collapsible === false ? token.paddingSM : 0, token.fontSize, token.padding, token.padding, token.paddingSM, token.paddingSM, prefixCls, token.paddingXXS, token.colorBgContainer, token.paddingXXS, token.padding)
|
|
10
11
|
};
|
|
11
12
|
});
|
|
@@ -3,9 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import type { FormCollapseListColumn } from '.';
|
|
4
4
|
import { ListFieldValue } from './utils';
|
|
5
5
|
export declare const useFormCollapseListHooks: (name: string, childrenColumnName: string, columns: FormCollapseListColumn[]) => {
|
|
6
|
+
values: ListFieldValue[];
|
|
7
|
+
updateValues: () => void;
|
|
6
8
|
expandedRowKeys: readonly React.Key[];
|
|
7
9
|
setExpandedRowKeys: React.Dispatch<React.SetStateAction<readonly React.Key[]>>;
|
|
8
|
-
|
|
10
|
+
fieldValuesToDataSource: (fields: ListFieldValue[]) => {
|
|
9
11
|
dataSource: ListFieldValue[];
|
|
10
12
|
allExpandRowKeys: React.Key[];
|
|
11
13
|
};
|
|
@@ -13,14 +13,27 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
13
13
|
var form = Form.useFormInstance();
|
|
14
14
|
var _useState = useState([]),
|
|
15
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
values = _useState2[0],
|
|
17
|
+
_setValues = _useState2[1];
|
|
18
|
+
var _useState3 = useState([]),
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
expandedRowKeys = _useState4[0],
|
|
21
|
+
setExpandedRowKeys = _useState4[1];
|
|
22
|
+
var updateValues = useCallback(function () {
|
|
23
|
+
return _setValues(form.getFieldValue(name));
|
|
24
|
+
}, [form, name]);
|
|
18
25
|
var firstColumnFormItemName = (_useMemo = useMemo(function () {
|
|
19
26
|
return columns.find(function (item) {
|
|
20
27
|
return !!item.name && !item.noStyle;
|
|
21
28
|
});
|
|
22
29
|
}, [columns])) === null || _useMemo === void 0 ? void 0 : _useMemo.name;
|
|
23
|
-
var
|
|
30
|
+
var fieldValuesToDataSource = useCallback(function (fields) {
|
|
31
|
+
if (!name) {
|
|
32
|
+
return {
|
|
33
|
+
dataSource: [],
|
|
34
|
+
allExpandRowKeys: []
|
|
35
|
+
};
|
|
36
|
+
}
|
|
24
37
|
var allExpandRowKeys = [];
|
|
25
38
|
var _setFieldPath = function _setFieldPath(field, index, path) {
|
|
26
39
|
var item = cloneDeep(field);
|
|
@@ -42,7 +55,7 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
42
55
|
})) || [],
|
|
43
56
|
allExpandRowKeys: allExpandRowKeys
|
|
44
57
|
};
|
|
45
|
-
}, [childrenColumnName]);
|
|
58
|
+
}, [childrenColumnName, name]);
|
|
46
59
|
var getFieldPath = useCallback(function (fieldKeyPath, fieldName) {
|
|
47
60
|
var fieldPath = [];
|
|
48
61
|
var _iterator = _createForOfIteratorHelper(fieldKeyPath.entries()),
|
|
@@ -86,10 +99,13 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
86
99
|
}, 200);
|
|
87
100
|
}
|
|
88
101
|
setExpandedRowKeys(_toConsumableArray(new Set([].concat(_toConsumableArray(expandedRowKeys), [toRowKey(fieldKeyPath)]))));
|
|
102
|
+
updateValues();
|
|
89
103
|
},
|
|
90
104
|
remove: function remove(index) {
|
|
91
105
|
if (fieldKeyPath.length <= 1) {
|
|
92
|
-
|
|
106
|
+
operation.remove(index);
|
|
107
|
+
updateValues();
|
|
108
|
+
return;
|
|
93
109
|
}
|
|
94
110
|
var fieldName = [name].concat(_toConsumableArray(getFieldPath(fieldKeyPath).slice(0, -1)));
|
|
95
111
|
var fieldValue = cloneDeep(form.getFieldValue(fieldName)) || [];
|
|
@@ -103,6 +119,7 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
103
119
|
return !indexs.includes(_index);
|
|
104
120
|
});
|
|
105
121
|
form.setFieldValue(fieldName, newFieldValue.length > 0 ? newFieldValue : undefined);
|
|
122
|
+
updateValues();
|
|
106
123
|
},
|
|
107
124
|
move: function move(from, to) {
|
|
108
125
|
if (fieldKeyPath.length <= 1) {
|
|
@@ -120,13 +137,16 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
120
137
|
fieldValue[from] = _ref[0];
|
|
121
138
|
fieldValue[to] = _ref[1];
|
|
122
139
|
form.setFieldValue(fieldName, fieldValue);
|
|
140
|
+
updateValues();
|
|
123
141
|
}
|
|
124
142
|
};
|
|
125
|
-
}, [childrenColumnName, expandedRowKeys, firstColumnFormItemName, form, getFieldPath, name]);
|
|
143
|
+
}, [childrenColumnName, expandedRowKeys, firstColumnFormItemName, form, getFieldPath, name, updateValues]);
|
|
126
144
|
return {
|
|
145
|
+
values: values,
|
|
146
|
+
updateValues: updateValues,
|
|
127
147
|
expandedRowKeys: expandedRowKeys,
|
|
128
148
|
setExpandedRowKeys: setExpandedRowKeys,
|
|
129
|
-
|
|
149
|
+
fieldValuesToDataSource: fieldValuesToDataSource,
|
|
130
150
|
getFieldPath: getFieldPath,
|
|
131
151
|
getFormListOperation: getFormListOperation,
|
|
132
152
|
// 首个表单输入列 (用于新增表达后 foucs 等)
|
|
@@ -3,7 +3,7 @@ import type { FormListProps as AntFormListProps } from 'antd/es/form';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { CollapseGroupProps } from '../../CollapseGroup';
|
|
5
5
|
import { FieldPath } from './utils';
|
|
6
|
-
|
|
6
|
+
interface FormCollapseListColumnItem extends Omit<FormItemProps, 'dependencies' | 'rules' | 'tooltip' | 'labelAlign' | 'labelCol' | 'colon' | 'children'> {
|
|
7
7
|
render?: (fieldName: number, index: number, operation: FormListOperation,
|
|
8
8
|
/** 当前 item 的 path */
|
|
9
9
|
fieldPath: FieldPath) => React.ReactElement;
|
|
@@ -16,7 +16,7 @@ export interface FormListOperationAddParams {
|
|
|
16
16
|
}
|
|
17
17
|
export interface FormCollapseListColumn extends FormCollapseListColumnItem, Pick<TableColumnProps<any>, 'align' | 'ellipsis' | 'fixed' | 'responsive' | 'shouldCellUpdate' | 'width'> {
|
|
18
18
|
}
|
|
19
|
-
export interface FormCollapseListProps extends Omit<AntFormListProps, 'name' | 'children'>, Pick<CollapseGroupProps, 'className' | 'extra' | 'expandIcon' | 'icon' | 'title' | 'variant' | 'defaultActive' | 'style'> {
|
|
19
|
+
export interface FormCollapseListProps extends Omit<AntFormListProps, 'name' | 'children'>, Pick<CollapseGroupProps, 'className' | 'collapsible' | 'extra' | 'expandIcon' | 'icon' | 'title' | 'variant' | 'defaultActive' | 'style'> {
|
|
20
20
|
/** 字段名 */
|
|
21
21
|
name?: FormItemProps['name'];
|
|
22
22
|
/** 表单列为空时展示的空内容 */
|
|
@@ -49,3 +49,4 @@ export interface FormCollapseListProps extends Omit<AntFormListProps, 'name' | '
|
|
|
49
49
|
rowHoverable?: boolean;
|
|
50
50
|
}
|
|
51
51
|
export declare const FormCollapseList: React.FC<FormCollapseListProps>;
|
|
52
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["extra", "expandIcon", "icon", "title", "variant", "defaultActive", "empty", "columns", "disabled", "readOnly", "addOneFieldDefault", "disableRemoveWhenOneField", "maxFileds", "name", "addParams", "className", "onRemove", "fieldRemoveButton", "style", "defaultExpandAllRows", "indentSize", "childrenColumnName", "rowHoverable"],
|
|
5
|
+
var _excluded = ["collapsible", "extra", "expandIcon", "icon", "title", "variant", "defaultActive", "empty", "columns", "disabled", "readOnly", "addOneFieldDefault", "disableRemoveWhenOneField", "maxFileds", "name", "addParams", "className", "onRemove", "fieldRemoveButton", "style", "defaultExpandAllRows", "indentSize", "childrenColumnName", "rowHoverable"],
|
|
6
6
|
_excluded2 = ["label", "name", "render", "dependencies", "rules", "align", "ellipsis", "fixed", "responsive", "shouldCellUpdate", "width", "className"],
|
|
7
7
|
_excluded3 = ["key"];
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -12,14 +12,17 @@ import { PlusOutlined } from '@ant-design/icons';
|
|
|
12
12
|
import { Icon } from '@lobehub/ui';
|
|
13
13
|
import { Button, Flex, Form, Table, Tooltip } from 'antd';
|
|
14
14
|
import { Trash2 } from 'lucide-react';
|
|
15
|
-
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
15
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
16
|
+
import Typography from "../../Typography";
|
|
16
17
|
import { CollapseGroup } from "../../CollapseGroup";
|
|
17
18
|
import { useFormCollapseListHooks } from "./hooks";
|
|
18
19
|
import { useStyles } from "./style";
|
|
19
20
|
import { FIELD_KEY_PATH, toRowKey } from "./utils";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
var Text = Typography.Text;
|
|
23
|
+
export var FormCollapseList = /*#__PURE__*/memo(function (_ref) {
|
|
24
|
+
var collapsible = _ref.collapsible,
|
|
25
|
+
extra = _ref.extra,
|
|
23
26
|
expandIcon = _ref.expandIcon,
|
|
24
27
|
icon = _ref.icon,
|
|
25
28
|
title = _ref.title,
|
|
@@ -54,26 +57,33 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
54
57
|
styles = _useStyles.styles;
|
|
55
58
|
var listAdd = useRef();
|
|
56
59
|
var form = Form.useFormInstance();
|
|
57
|
-
var fieldsWatch = Form.useWatch(name, form);
|
|
58
60
|
var _useFormCollapseListH = useFormCollapseListHooks(name, childrenColumnName, columns),
|
|
61
|
+
values = _useFormCollapseListH.values,
|
|
62
|
+
updateValues = _useFormCollapseListH.updateValues,
|
|
59
63
|
expandedRowKeys = _useFormCollapseListH.expandedRowKeys,
|
|
60
64
|
setExpandedRowKeys = _useFormCollapseListH.setExpandedRowKeys,
|
|
61
|
-
|
|
65
|
+
fieldValuesToDataSource = _useFormCollapseListH.fieldValuesToDataSource,
|
|
62
66
|
getFormListOperation = _useFormCollapseListH.getFormListOperation,
|
|
63
67
|
getFieldPath = _useFormCollapseListH.getFieldPath,
|
|
64
68
|
firstColumnFormItemName = _useFormCollapseListH.firstColumnFormItemName;
|
|
65
69
|
var _useMemo = useMemo(function () {
|
|
66
|
-
return
|
|
67
|
-
}, [
|
|
70
|
+
return fieldValuesToDataSource(values);
|
|
71
|
+
}, [fieldValuesToDataSource, values]),
|
|
68
72
|
dataSource = _useMemo.dataSource;
|
|
73
|
+
// 设置初始值以及在 readOnly 变化时更新 values
|
|
74
|
+
useEffect(function () {
|
|
75
|
+
updateValues();
|
|
76
|
+
}, [updateValues, readOnly]);
|
|
77
|
+
|
|
78
|
+
// 设置默认展开的 keys
|
|
69
79
|
useEffect(function () {
|
|
70
80
|
var fields = form.getFieldValue(name);
|
|
71
|
-
var
|
|
72
|
-
allExpandRowKeys =
|
|
81
|
+
var _fieldValuesToDataSou = fieldValuesToDataSource(fields),
|
|
82
|
+
allExpandRowKeys = _fieldValuesToDataSou.allExpandRowKeys;
|
|
73
83
|
if (defaultExpandAllRows) {
|
|
74
84
|
setExpandedRowKeys(allExpandRowKeys);
|
|
75
85
|
}
|
|
76
|
-
}, [defaultExpandAllRows,
|
|
86
|
+
}, [defaultExpandAllRows, fieldValuesToDataSource, form, name, setExpandedRowKeys]);
|
|
77
87
|
var getAddParams = useCallback(function () {
|
|
78
88
|
if (!addParams) {
|
|
79
89
|
return [];
|
|
@@ -82,9 +92,11 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
82
92
|
return [params.defaultValue, params.insertIndex];
|
|
83
93
|
}, [addParams]);
|
|
84
94
|
var handleOnRemove = useCallback(function (fieldName) {
|
|
85
|
-
var
|
|
86
|
-
return onRemove === null || onRemove === void 0 ? void 0 : onRemove(
|
|
95
|
+
var value = form.getFieldValue([name, fieldName]);
|
|
96
|
+
return onRemove === null || onRemove === void 0 ? void 0 : onRemove(value);
|
|
87
97
|
}, [form, name, onRemove]);
|
|
98
|
+
|
|
99
|
+
// 默认增加一行的处理
|
|
88
100
|
useEffect(function () {
|
|
89
101
|
var _form$getFieldValue;
|
|
90
102
|
if (addOneFieldDefault && (!(form !== null && form !== void 0 && form.getFieldValue(name)) || (form === null || form === void 0 || (_form$getFieldValue = form.getFieldValue(name)) === null || _form$getFieldValue === void 0 ? void 0 : _form$getFieldValue.length) === 0)) {
|
|
@@ -95,12 +107,12 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
95
107
|
form.focusField([name, 0, firstColumnFormItemName]);
|
|
96
108
|
}, 200);
|
|
97
109
|
}
|
|
98
|
-
}, [addOneFieldDefault, getAddParams, form, name, firstColumnFormItemName]);
|
|
110
|
+
}, [addOneFieldDefault, getAddParams, form, name, firstColumnFormItemName, updateValues]);
|
|
99
111
|
return /*#__PURE__*/_jsx(CollapseGroup, {
|
|
100
112
|
extra: extra === undefined ? name && !readOnly && /*#__PURE__*/_jsx(Tooltip, {
|
|
101
113
|
title: maxFileds && "\u6700\u591A\u6DFB\u52A0 ".concat(maxFileds, " \u9879"),
|
|
102
114
|
children: /*#__PURE__*/_jsx(Button, {
|
|
103
|
-
disabled: disabled || !!(maxFileds && (
|
|
115
|
+
disabled: disabled || !!(maxFileds && (values === null || values === void 0 ? void 0 : values.length) === maxFileds),
|
|
104
116
|
icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
|
|
105
117
|
onClick: function onClick(e) {
|
|
106
118
|
var _listAdd$current2;
|
|
@@ -116,6 +128,7 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
116
128
|
})
|
|
117
129
|
}) : extra,
|
|
118
130
|
className: className,
|
|
131
|
+
collapsible: collapsible,
|
|
119
132
|
expandIcon: expandIcon,
|
|
120
133
|
icon: icon,
|
|
121
134
|
title: title,
|
|
@@ -128,7 +141,10 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
128
141
|
children: function children(fields, operation) {
|
|
129
142
|
var add = operation.add,
|
|
130
143
|
remove = operation.remove;
|
|
131
|
-
listAdd.current =
|
|
144
|
+
listAdd.current = function (defaultValue, insertIndex) {
|
|
145
|
+
add(defaultValue, insertIndex);
|
|
146
|
+
updateValues();
|
|
147
|
+
};
|
|
132
148
|
|
|
133
149
|
// @Todo: support sort
|
|
134
150
|
return /*#__PURE__*/_jsx(Table, {
|
|
@@ -156,11 +172,11 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
156
172
|
responsive: responsive,
|
|
157
173
|
shouldCellUpdate: shouldCellUpdate,
|
|
158
174
|
width: width,
|
|
159
|
-
render: function render(
|
|
175
|
+
render: function render(text, record, index) {
|
|
160
176
|
var field = fields[index] || {};
|
|
161
177
|
var fieldName = field.name;
|
|
162
178
|
var fieldKeyPath = record[FIELD_KEY_PATH];
|
|
163
|
-
var fieldPath = getFieldPath(fieldKeyPath);
|
|
179
|
+
var fieldPath = [name].concat(_toConsumableArray(getFieldPath(fieldKeyPath)));
|
|
164
180
|
var parentFieldPath = fieldPath.slice(0, -1);
|
|
165
181
|
var key = field.key,
|
|
166
182
|
restField = _objectWithoutProperties(field, _excluded3);
|
|
@@ -179,14 +195,19 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
179
195
|
children: children
|
|
180
196
|
});
|
|
181
197
|
}
|
|
182
|
-
var chidrenProps = {
|
|
183
|
-
|
|
184
|
-
disabled
|
|
185
|
-
}
|
|
198
|
+
var chidrenProps = {};
|
|
199
|
+
if (disabled !== undefined) {
|
|
200
|
+
chidrenProps.disabled = disabled;
|
|
201
|
+
}
|
|
186
202
|
if (readOnly === true) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
203
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
204
|
+
align: "center",
|
|
205
|
+
className: cx(styles.readOnlyItem, className),
|
|
206
|
+
children: text !== null && text !== void 0 ? text : /*#__PURE__*/_jsx(Text, {
|
|
207
|
+
type: "secondary",
|
|
208
|
+
children: "-"
|
|
209
|
+
})
|
|
210
|
+
});
|
|
190
211
|
}
|
|
191
212
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread(_objectSpread({
|
|
192
213
|
className: className
|
|
@@ -227,6 +248,7 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
227
248
|
isRemove = _context.sent;
|
|
228
249
|
if (isRemove !== false) {
|
|
229
250
|
remove(fieldName);
|
|
251
|
+
updateValues();
|
|
230
252
|
}
|
|
231
253
|
case 4:
|
|
232
254
|
case "end":
|
|
@@ -266,4 +288,4 @@ export var FormCollapseList = function FormCollapseList(_ref) {
|
|
|
266
288
|
children: empty
|
|
267
289
|
})
|
|
268
290
|
});
|
|
269
|
-
};
|
|
291
|
+
});
|
|
@@ -2,4 +2,5 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
2
2
|
empty: import("antd-style").SerializedStyles;
|
|
3
3
|
list: import("antd-style").SerializedStyles;
|
|
4
4
|
noFormItem: import("antd-style").SerializedStyles;
|
|
5
|
+
readOnlyItem: import("antd-style").SerializedStyles;
|
|
5
6
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -8,6 +8,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
8
8
|
return {
|
|
9
9
|
empty: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: ", "px ", "px;\n color: ", ";\n "])), token.paddingXS, token.paddingSM, token.colorTextTertiary),
|
|
10
10
|
list: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.", "-table-wrapper {\n .", "-table {\n &-thead {\n & > tr > th {\n font-weight: normal;\n color: ", ";\n background-color: unset;\n &::before {\n display: none;\n }\n }\n }\n &-tbody {\n & > tr:last-child {\n & > td {\n border-bottom-color: transparent;\n }\n }\n }\n &-cell {\n vertical-align: top;\n .", "-table-row-expand-icon {\n margin-top: ", "px;\n }\n }\n }\n }\n .", "-form {\n &-item {\n margin-bottom: 0;\n }\n }\n "])), prefixCls, prefixCls, token.colorTextTertiary, prefixCls, token.marginXS, prefixCls),
|
|
11
|
-
noFormItem: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: ", "px;\n color: ", ";\n "])), token.controlHeight, token.colorTextTertiary)
|
|
11
|
+
noFormItem: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: ", "px;\n color: ", ";\n "])), token.controlHeight, token.colorTextTertiary),
|
|
12
|
+
readOnlyItem: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: ", "px;\n color: ", ";\n "])), token.controlHeight, token.colorTextBase)
|
|
12
13
|
};
|
|
13
14
|
});
|