@nokecy/qc-ui 0.1.53 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/array-table/arrayAddBtn.d.ts +3 -0
- package/dist/cjs/array-table/arrayAddBtn.js +82 -0
- package/dist/cjs/array-table/arrayBase.d.ts +1 -1
- package/dist/cjs/array-table/arrayBase.js +22 -81
- package/dist/cjs/array-table/index.js +30 -24
- package/dist/cjs/editable/index.js +3 -1
- package/dist/esm/array-table/arrayAddBtn.d.ts +3 -0
- package/dist/esm/array-table/arrayAddBtn.js +66 -0
- package/dist/esm/array-table/arrayBase.d.ts +1 -1
- package/dist/esm/array-table/arrayBase.js +24 -83
- package/dist/esm/array-table/index.js +31 -27
- package/dist/esm/editable/index.js +2 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
8
8
|
|
|
9
9
|
import React, { createContext, useContext } from 'react';
|
|
10
10
|
import { Button } from 'antd';
|
|
11
|
-
import { DeleteOutlined, DownOutlined, UpOutlined,
|
|
11
|
+
import { DeleteOutlined, DownOutlined, UpOutlined, CopyOutlined } from '@ant-design/icons';
|
|
12
12
|
import { useField } from '@formily/react';
|
|
13
|
-
import {
|
|
13
|
+
import { clone, isUndef } from '@formily/shared';
|
|
14
14
|
import { usePrefixCls } from '@formily/antd-v5/lib/__builtins__';
|
|
15
15
|
import cls from 'classnames';
|
|
16
16
|
var ItemContext = /*#__PURE__*/createContext(null);
|
|
@@ -33,24 +33,6 @@ var useRecord = function useRecord(record) {
|
|
|
33
33
|
return takeRecord(ctx ? ctx.record : record, ctx === null || ctx === void 0 ? void 0 : ctx.index);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
var getSchemaDefaultValue = function getSchemaDefaultValue(schema) {
|
|
37
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array') return [];
|
|
38
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object') return {};
|
|
39
|
-
|
|
40
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'void') {
|
|
41
|
-
for (var key in schema.properties) {
|
|
42
|
-
var value = getSchemaDefaultValue(schema.properties[key]);
|
|
43
|
-
if (isValid(value)) return value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var getDefaultValue = function getDefaultValue(defaultValue, schema) {
|
|
49
|
-
if (isValid(defaultValue)) return clone(defaultValue);
|
|
50
|
-
if (Array.isArray(schema === null || schema === void 0 ? void 0 : schema.items)) return getSchemaDefaultValue(schema === null || schema === void 0 ? void 0 : schema.items[0]);
|
|
51
|
-
return getSchemaDefaultValue(schema === null || schema === void 0 ? void 0 : schema.items);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
36
|
export var ArrayBase = function ArrayBase(props) {
|
|
55
37
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
|
|
56
38
|
};
|
|
@@ -72,56 +54,15 @@ ArrayBase.Index = function (props) {
|
|
|
72
54
|
}), "#", (index ? index : 0) + 1, ".");
|
|
73
55
|
};
|
|
74
56
|
|
|
75
|
-
ArrayBase.Addition = function (props) {
|
|
76
|
-
var _array$field, _array$field2;
|
|
77
|
-
|
|
78
|
-
var self = useField();
|
|
79
|
-
var array = useArray();
|
|
80
|
-
var prefixCls = usePrefixCls('formily-array-base');
|
|
81
|
-
if (!array) return null;
|
|
82
|
-
if (((_array$field = array.field) === null || _array$field === void 0 ? void 0 : _array$field.pattern) !== 'editable' && ((_array$field2 = array.field) === null || _array$field2 === void 0 ? void 0 : _array$field2.pattern) !== 'disabled') return null;
|
|
83
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
84
|
-
type: "dashed",
|
|
85
|
-
block: true
|
|
86
|
-
}, props, {
|
|
87
|
-
disabled: self === null || self === void 0 ? void 0 : self.disabled,
|
|
88
|
-
className: cls("".concat(prefixCls, "-addition"), props.className),
|
|
89
|
-
onClick: function onClick(e) {
|
|
90
|
-
var _array$props;
|
|
91
|
-
|
|
92
|
-
if ((_array$props = array.props) !== null && _array$props !== void 0 && _array$props.disabled) return;
|
|
93
|
-
var defaultValue = getDefaultValue(props.defaultValue, array.schema);
|
|
94
|
-
|
|
95
|
-
if (props.method === 'unshift') {
|
|
96
|
-
var _array$field3, _array$field3$unshift, _array$props2, _array$props2$onAdd;
|
|
97
|
-
|
|
98
|
-
(_array$field3 = array.field) === null || _array$field3 === void 0 ? void 0 : (_array$field3$unshift = _array$field3.unshift) === null || _array$field3$unshift === void 0 ? void 0 : _array$field3$unshift.call(_array$field3, defaultValue);
|
|
99
|
-
(_array$props2 = array.props) === null || _array$props2 === void 0 ? void 0 : (_array$props2$onAdd = _array$props2.onAdd) === null || _array$props2$onAdd === void 0 ? void 0 : _array$props2$onAdd.call(_array$props2, 0);
|
|
100
|
-
} else {
|
|
101
|
-
var _array$field4, _array$field4$push, _array$props3, _array$props3$onAdd, _array$field5, _array$field5$value;
|
|
102
|
-
|
|
103
|
-
(_array$field4 = array.field) === null || _array$field4 === void 0 ? void 0 : (_array$field4$push = _array$field4.push) === null || _array$field4$push === void 0 ? void 0 : _array$field4$push.call(_array$field4, defaultValue);
|
|
104
|
-
(_array$props3 = array.props) === null || _array$props3 === void 0 ? void 0 : (_array$props3$onAdd = _array$props3.onAdd) === null || _array$props3$onAdd === void 0 ? void 0 : _array$props3$onAdd.call(_array$props3, (array === null || array === void 0 ? void 0 : (_array$field5 = array.field) === null || _array$field5 === void 0 ? void 0 : (_array$field5$value = _array$field5.value) === null || _array$field5$value === void 0 ? void 0 : _array$field5$value.length) - 1);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (props.onClick) {
|
|
108
|
-
//@ts-ignore
|
|
109
|
-
props.onClick(e);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
icon: isUndef(props.icon) ? /*#__PURE__*/React.createElement(PlusOutlined, null) : props.icon
|
|
113
|
-
}), props.title || self.title);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
57
|
ArrayBase.Copy = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
117
|
-
var _array$
|
|
58
|
+
var _array$field;
|
|
118
59
|
|
|
119
60
|
var self = useField();
|
|
120
61
|
var array = useArray();
|
|
121
62
|
var index = useIndex(props.index);
|
|
122
63
|
var prefixCls = usePrefixCls('formily-array-base');
|
|
123
64
|
if (!array) return null;
|
|
124
|
-
if (((_array$
|
|
65
|
+
if (((_array$field = array.field) === null || _array$field === void 0 ? void 0 : _array$field.pattern) !== 'editable') return null;
|
|
125
66
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
126
67
|
type: "text"
|
|
127
68
|
}, props, {
|
|
@@ -129,15 +70,15 @@ ArrayBase.Copy = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
129
70
|
className: cls("".concat(prefixCls, "-copy"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-copy-disabled") : '', props.className),
|
|
130
71
|
ref: ref,
|
|
131
72
|
onClick: function onClick(e) {
|
|
132
|
-
var _array$
|
|
73
|
+
var _array$props, _array$field2, _array$field3, _array$field3$insert, _array$props2, _array$props2$onCopy;
|
|
133
74
|
|
|
134
75
|
if (self !== null && self !== void 0 && self.disabled) return;
|
|
135
76
|
e.stopPropagation();
|
|
136
|
-
if ((_array$
|
|
137
|
-
var value = clone(array === null || array === void 0 ? void 0 : (_array$
|
|
77
|
+
if ((_array$props = array.props) !== null && _array$props !== void 0 && _array$props.disabled) return;
|
|
78
|
+
var value = clone(array === null || array === void 0 ? void 0 : (_array$field2 = array.field) === null || _array$field2 === void 0 ? void 0 : _array$field2.value[index]);
|
|
138
79
|
var distIndex = index + 1;
|
|
139
|
-
(_array$
|
|
140
|
-
(_array$
|
|
80
|
+
(_array$field3 = array.field) === null || _array$field3 === void 0 ? void 0 : (_array$field3$insert = _array$field3.insert) === null || _array$field3$insert === void 0 ? void 0 : _array$field3$insert.call(_array$field3, distIndex, value);
|
|
81
|
+
(_array$props2 = array.props) === null || _array$props2 === void 0 ? void 0 : (_array$props2$onCopy = _array$props2.onCopy) === null || _array$props2$onCopy === void 0 ? void 0 : _array$props2$onCopy.call(_array$props2, distIndex);
|
|
141
82
|
|
|
142
83
|
if (props.onClick) {
|
|
143
84
|
//@ts-ignore
|
|
@@ -148,14 +89,14 @@ ArrayBase.Copy = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
148
89
|
}), props.title || self.title);
|
|
149
90
|
});
|
|
150
91
|
ArrayBase.Remove = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
151
|
-
var _array$
|
|
92
|
+
var _array$field4;
|
|
152
93
|
|
|
153
94
|
var index = useIndex(props.index);
|
|
154
95
|
var self = useField();
|
|
155
96
|
var array = useArray();
|
|
156
97
|
var prefixCls = usePrefixCls('formily-array-base');
|
|
157
98
|
if (!array) return null;
|
|
158
|
-
if (((_array$
|
|
99
|
+
if (((_array$field4 = array.field) === null || _array$field4 === void 0 ? void 0 : _array$field4.pattern) !== 'editable') return null;
|
|
159
100
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
160
101
|
type: "text"
|
|
161
102
|
}, props, {
|
|
@@ -163,12 +104,12 @@ ArrayBase.Remove = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
163
104
|
className: cls("".concat(prefixCls, "-remove"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-remove-disabled") : '', props.className),
|
|
164
105
|
ref: ref,
|
|
165
106
|
onClick: function onClick(e) {
|
|
166
|
-
var _array$
|
|
107
|
+
var _array$field5, _array$field5$remove, _array$props3, _array$props3$onRemov;
|
|
167
108
|
|
|
168
109
|
if (self !== null && self !== void 0 && self.disabled) return;
|
|
169
110
|
e.stopPropagation();
|
|
170
|
-
(_array$
|
|
171
|
-
(_array$
|
|
111
|
+
(_array$field5 = array.field) === null || _array$field5 === void 0 ? void 0 : (_array$field5$remove = _array$field5.remove) === null || _array$field5$remove === void 0 ? void 0 : _array$field5$remove.call(_array$field5, index);
|
|
112
|
+
(_array$props3 = array.props) === null || _array$props3 === void 0 ? void 0 : (_array$props3$onRemov = _array$props3.onRemove) === null || _array$props3$onRemov === void 0 ? void 0 : _array$props3$onRemov.call(_array$props3, index);
|
|
172
113
|
|
|
173
114
|
if (props.onClick) {
|
|
174
115
|
//@ts-ignore
|
|
@@ -179,14 +120,14 @@ ArrayBase.Remove = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
179
120
|
}), props.title || self.title);
|
|
180
121
|
});
|
|
181
122
|
ArrayBase.MoveDown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
182
|
-
var _array$
|
|
123
|
+
var _array$field6;
|
|
183
124
|
|
|
184
125
|
var index = useIndex(props.index);
|
|
185
126
|
var self = useField();
|
|
186
127
|
var array = useArray();
|
|
187
128
|
var prefixCls = usePrefixCls('formily-array-base');
|
|
188
129
|
if (!array) return null;
|
|
189
|
-
if (((_array$
|
|
130
|
+
if (((_array$field6 = array.field) === null || _array$field6 === void 0 ? void 0 : _array$field6.pattern) !== 'editable') return null;
|
|
190
131
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
191
132
|
type: "text"
|
|
192
133
|
}, props, {
|
|
@@ -194,12 +135,12 @@ ArrayBase.MoveDown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
194
135
|
className: cls("".concat(prefixCls, "-move-down"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-move-down-disabled") : '', props.className),
|
|
195
136
|
ref: ref,
|
|
196
137
|
onClick: function onClick(e) {
|
|
197
|
-
var _array$
|
|
138
|
+
var _array$field7, _array$field7$moveDow, _array$props4, _array$props4$onMoveD;
|
|
198
139
|
|
|
199
140
|
if (self !== null && self !== void 0 && self.disabled) return;
|
|
200
141
|
e.stopPropagation();
|
|
201
|
-
(_array$
|
|
202
|
-
(_array$
|
|
142
|
+
(_array$field7 = array.field) === null || _array$field7 === void 0 ? void 0 : (_array$field7$moveDow = _array$field7.moveDown) === null || _array$field7$moveDow === void 0 ? void 0 : _array$field7$moveDow.call(_array$field7, index);
|
|
143
|
+
(_array$props4 = array.props) === null || _array$props4 === void 0 ? void 0 : (_array$props4$onMoveD = _array$props4.onMoveDown) === null || _array$props4$onMoveD === void 0 ? void 0 : _array$props4$onMoveD.call(_array$props4, index);
|
|
203
144
|
|
|
204
145
|
if (props.onClick) {
|
|
205
146
|
//@ts-ignore
|
|
@@ -210,14 +151,14 @@ ArrayBase.MoveDown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
210
151
|
}), props.title || self.title);
|
|
211
152
|
});
|
|
212
153
|
ArrayBase.MoveUp = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
213
|
-
var _array$
|
|
154
|
+
var _array$field8;
|
|
214
155
|
|
|
215
156
|
var index = useIndex(props.index);
|
|
216
157
|
var self = useField();
|
|
217
158
|
var array = useArray();
|
|
218
159
|
var prefixCls = usePrefixCls('formily-array-base');
|
|
219
160
|
if (!array) return null;
|
|
220
|
-
if (((_array$
|
|
161
|
+
if (((_array$field8 = array.field) === null || _array$field8 === void 0 ? void 0 : _array$field8.pattern) !== 'editable') return null;
|
|
221
162
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
222
163
|
type: "text"
|
|
223
164
|
}, props, {
|
|
@@ -225,12 +166,12 @@ ArrayBase.MoveUp = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
225
166
|
className: cls("".concat(prefixCls, "-move-up"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-move-up-disabled") : '', props.className),
|
|
226
167
|
ref: ref,
|
|
227
168
|
onClick: function onClick(e) {
|
|
228
|
-
var _array$
|
|
169
|
+
var _array$field9, _array$props5, _array$props5$onMoveU;
|
|
229
170
|
|
|
230
171
|
if (self !== null && self !== void 0 && self.disabled) return;
|
|
231
172
|
e.stopPropagation();
|
|
232
|
-
array === null || array === void 0 ? void 0 : (_array$
|
|
233
|
-
array === null || array === void 0 ? void 0 : (_array$
|
|
173
|
+
array === null || array === void 0 ? void 0 : (_array$field9 = array.field) === null || _array$field9 === void 0 ? void 0 : _array$field9.moveUp(index);
|
|
174
|
+
array === null || array === void 0 ? void 0 : (_array$props5 = array.props) === null || _array$props5 === void 0 ? void 0 : (_array$props5$onMoveU = _array$props5.onMoveUp) === null || _array$props5$onMoveU === void 0 ? void 0 : _array$props5$onMoveU.call(_array$props5, index);
|
|
234
175
|
|
|
235
176
|
if (props.onClick) {
|
|
236
177
|
//@ts-ignore
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import _sortBy from "lodash/sortBy";
|
|
2
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
-
|
|
11
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
4
|
|
|
13
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -23,9 +15,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
23
15
|
import React, { Fragment, useRef, useState } from "react";
|
|
24
16
|
import { AgGridReact } from "ag-grid-react";
|
|
25
17
|
import { useField, observer, RecursionField } from "@formily/react";
|
|
18
|
+
import { useFieldSchema } from '@formily/react';
|
|
26
19
|
import uniqueId from "lodash/uniqueId";
|
|
27
|
-
import {
|
|
28
|
-
import ArrayBase from "./arrayBase";
|
|
20
|
+
import { useArrayTableColumns, useArrayTableSources, isColumnComponent } from "./utils";
|
|
21
|
+
import ArrayBase from "./arrayBase";
|
|
22
|
+
import ArrayAddBtn from "./arrayAddBtn";
|
|
23
|
+
import { Space } from "antd"; //@ts-ignore
|
|
29
24
|
|
|
30
25
|
export var ArrayTable = observer(function (props) {
|
|
31
26
|
var height = props.height;
|
|
@@ -41,13 +36,28 @@ export var ArrayTable = observer(function (props) {
|
|
|
41
36
|
var dataSource = Array.isArray(field.value) ? field.value.slice() : [];
|
|
42
37
|
var sources = useArrayTableSources();
|
|
43
38
|
var columns = useArrayTableColumns(dataSource, field, sources);
|
|
44
|
-
var
|
|
39
|
+
var schema = useFieldSchema();
|
|
45
40
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
41
|
ref: ref,
|
|
47
42
|
style: {
|
|
48
43
|
height: height ? height : 400
|
|
49
44
|
}
|
|
50
|
-
}, /*#__PURE__*/React.createElement(ArrayBase, null, /*#__PURE__*/React.createElement(
|
|
45
|
+
}, /*#__PURE__*/React.createElement(ArrayBase, null, /*#__PURE__*/React.createElement(Space, {
|
|
46
|
+
style: {
|
|
47
|
+
marginBottom: 5
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ArrayAddBtn, {
|
|
50
|
+
arrayField: field,
|
|
51
|
+
schema: schema,
|
|
52
|
+
defaultValue: {
|
|
53
|
+
_id: uniqueId(),
|
|
54
|
+
_isNew: true
|
|
55
|
+
},
|
|
56
|
+
title: "新增",
|
|
57
|
+
onAdd: function onAdd() {
|
|
58
|
+
setIsAdd(true);
|
|
59
|
+
}
|
|
60
|
+
})), /*#__PURE__*/React.createElement(AgGridReact, {
|
|
51
61
|
onGridReady: function onGridReady(params) {
|
|
52
62
|
apiRef.current = params.api;
|
|
53
63
|
},
|
|
@@ -60,6 +70,15 @@ export var ArrayTable = observer(function (props) {
|
|
|
60
70
|
}
|
|
61
71
|
},
|
|
62
72
|
className: "ag-theme-alpine",
|
|
73
|
+
defaultColDef: {
|
|
74
|
+
resizable: true,
|
|
75
|
+
headerComponentParams: {
|
|
76
|
+
template: '<div class="ag-cell-label-container" role="presentation">' + // ' <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>' +
|
|
77
|
+
' <div ref="eLabel" class="ag-header-cell-label" role="presentation">' + ' <span ref="eText" class="ag-header-cell-text"></span>' + // ' <span ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' +
|
|
78
|
+
// ' <span ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' +
|
|
79
|
+
' <span ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' + ' <span ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' + ' <span ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' + ' </div>' + '</div>'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
63
82
|
getRowId: function getRowId(_ref) {
|
|
64
83
|
var data = _ref.data;
|
|
65
84
|
return data._id || data.id;
|
|
@@ -104,19 +123,4 @@ ArrayTable.Column = function () {
|
|
|
104
123
|
};
|
|
105
124
|
|
|
106
125
|
ArrayBase.mixin(ArrayTable);
|
|
107
|
-
|
|
108
|
-
var Addition = function Addition(props) {
|
|
109
|
-
return /*#__PURE__*/React.createElement(ArrayBase.Addition, _extends({
|
|
110
|
-
type: "primary",
|
|
111
|
-
children: "新增行"
|
|
112
|
-
}, props, {
|
|
113
|
-
block: false,
|
|
114
|
-
defaultValue: _objectSpread(_objectSpread({}, props.defaultValue), {}, {
|
|
115
|
-
_id: uniqueId(),
|
|
116
|
-
_isNew: true
|
|
117
|
-
})
|
|
118
|
-
}));
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
ArrayTable.Addition = Addition;
|
|
122
126
|
export default ArrayTable;
|
|
@@ -25,7 +25,8 @@ import { isVoidField } from '@formily/core';
|
|
|
25
25
|
import { observer, useField } from '@formily/react';
|
|
26
26
|
import { Popover as AntdPopover } from 'antd';
|
|
27
27
|
import cls from 'classnames';
|
|
28
|
-
import {
|
|
28
|
+
import { FormItem } from '@formily/antd-v5';
|
|
29
|
+
import { ArrayBase } from "../array-table/arrayBase";
|
|
29
30
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
30
31
|
import { useClickAway, usePrefixCls } from '@formily/antd-v5/lib/__builtins__';
|
|
31
32
|
import useStyle from "./style";
|