@nokecy/qc-ui 0.1.50 → 0.1.51

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.
@@ -19,8 +19,6 @@ require("./global.scss");
19
19
 
20
20
  require("./index.less");
21
21
 
22
- var _interface = require("./interface");
23
-
24
22
  var _queryForm = _interopRequireDefault(require("./queryForm"));
25
23
 
26
24
  var _toolBar = _interopRequireDefault(require("./toolBar"));
@@ -232,6 +230,11 @@ function AgGridPlus(props) {
232
230
  onRefresh: onRefresh
233
231
  };
234
232
  }, [queryFilter, JSON.stringify(gridParams), JSON.stringify(sortColumn)]);
233
+ var colDefs = (0, _react.useMemo)(function () {
234
+ return _react.default.Children.map(children, function (child, index) {
235
+ return child.props;
236
+ });
237
+ }, [children]);
235
238
  return /*#__PURE__*/_react.default.createElement(_antd.Spin, {
236
239
  spinning: loading,
237
240
  wrapperClassName: "grid-spin"
@@ -355,18 +358,8 @@ function AgGridPlus(props) {
355
358
  } // animateRows={true}
356
359
  //停用默认分页组件
357
360
  ,
358
- suppressPaginationPanel: true
359
- }), props.rowSelection ? /*#__PURE__*/_react.default.createElement(_interface.AgGridColumn, {
360
- field: "",
361
- width: 30,
362
- flex: 0,
363
- headerCheckboxSelection: true,
364
- checkboxSelection: true,
365
- showDisabledCheckboxes: true,
366
- filter: false,
367
- pinned: "left"
368
- }) : null, _react.default.Children.map(children, function (child, index) {
369
- return child;
361
+ suppressPaginationPanel: true,
362
+ columnDefs: colDefs || props.columnDefs
370
363
  }))), /*#__PURE__*/_react.default.createElement("div", {
371
364
  style: {
372
365
  marginTop: 12,
@@ -11,7 +11,6 @@
11
11
  --ag-font-family: ('microsoft yahei', 'Helvetica', 'Arial'),
12
12
 
13
13
  --ag-borders: solid 0px,
14
- --ag-borders-row: solid 1px,
15
14
  --ag-row-border-color:#f0f0f0,
16
15
  --ag-grid-size: 4px,
17
16
 
@@ -1,5 +1,5 @@
1
- import { GridApi } from 'ag-grid-community';
2
- import { AgGridReactProps, AgGridColumnProps, AgGridColumnGroupProps } from 'ag-grid-react';
1
+ import { GridApi, ColDef, ColGroupDef } from 'ag-grid-community';
2
+ import { AgGridReactProps } from 'ag-grid-react';
3
3
  import React, { CSSProperties, ReactNode } from 'react';
4
4
  interface GridRef {
5
5
  onRefresh: () => void;
@@ -26,7 +26,7 @@ interface GridProps extends AgGridReactProps {
26
26
  gridColumnState?: any[];
27
27
  gridRef?: React.Ref<GridRef | undefined>;
28
28
  }
29
- interface AgGridColumnPropsClone extends AgGridColumnProps {
29
+ interface AgGridColumnPropsClone extends ColDef {
30
30
  hideInTable?: boolean;
31
31
  hideInSearch?: boolean;
32
32
  queryField?: string;
@@ -34,5 +34,5 @@ interface AgGridColumnPropsClone extends AgGridColumnProps {
34
34
  searchComponentProps?: any;
35
35
  searchSort?: number;
36
36
  }
37
- declare function AgGridColumn(props: AgGridColumnPropsClone | AgGridColumnGroupProps): JSX.Element;
37
+ declare function AgGridColumn(props: AgGridColumnPropsClone | ColGroupDef): JSX.Element;
38
38
  export { GridProps, AgGridColumn, GridRef };
@@ -5,13 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.AgGridColumn = AgGridColumn;
7
7
 
8
- var _agGridReact = require("ag-grid-react");
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
9
 
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
 
14
12
  function AgGridColumn(props) {
15
13
  ///@ts-ignore
16
- return /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridColumn, props);
14
+ return /*#__PURE__*/_react.default.createElement(AgGridColumnClone, props);
17
15
  }
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from 'antd/lib/button';
3
+ import { ArrayField } from '@formily/core';
4
+ import { Schema, JSXComponent } from '@formily/react';
5
+ export interface IArrayBaseAdditionProps extends ButtonProps {
6
+ title?: string;
7
+ method?: 'push' | 'unshift';
8
+ defaultValue?: any;
9
+ }
10
+ export interface IArrayBaseOperationProps extends ButtonProps {
11
+ title?: string;
12
+ index?: number;
13
+ ref?: React.Ref<HTMLElement>;
14
+ }
15
+ export interface IArrayBaseContext {
16
+ props: IArrayBaseProps;
17
+ field: ArrayField;
18
+ schema: Schema;
19
+ }
20
+ export interface IArrayBaseItemProps {
21
+ index: number;
22
+ record: ((index: number) => Record<string, any>) | Record<string, any>;
23
+ props: IArrayBaseProps;
24
+ field: ArrayField;
25
+ schema: Schema;
26
+ }
27
+ export declare type ArrayBaseMixins = {
28
+ Addition?: React.FC<React.PropsWithChildren<IArrayBaseAdditionProps>>;
29
+ Copy?: React.FC<React.PropsWithChildren<IArrayBaseOperationProps & {
30
+ index?: number;
31
+ }>>;
32
+ Remove?: React.FC<React.PropsWithChildren<IArrayBaseOperationProps & {
33
+ index?: number;
34
+ }>>;
35
+ MoveUp?: React.FC<React.PropsWithChildren<IArrayBaseOperationProps & {
36
+ index?: number;
37
+ }>>;
38
+ MoveDown?: React.FC<React.PropsWithChildren<IArrayBaseOperationProps & {
39
+ index?: number;
40
+ }>>;
41
+ SortHandle?: React.FC<React.PropsWithChildren<IArrayBaseOperationProps & {
42
+ index?: number;
43
+ }>>;
44
+ Index?: React.FC;
45
+ useArray?: () => IArrayBaseContext;
46
+ useIndex?: (index?: number) => number;
47
+ useRecord?: (record?: number) => any;
48
+ };
49
+ export interface IArrayBaseProps {
50
+ disabled?: boolean;
51
+ onAdd?: (index: number) => void;
52
+ onCopy?: (index: number) => void;
53
+ onRemove?: (index: number) => void;
54
+ onMoveDown?: (index: number) => void;
55
+ onMoveUp?: (index: number) => void;
56
+ }
57
+ declare type ComposedArrayBase = React.FC<React.PropsWithChildren<IArrayBaseProps>> & ArrayBaseMixins & {
58
+ Item?: React.FC<React.PropsWithChildren<IArrayBaseItemProps>>;
59
+ mixin?: <T extends JSXComponent>(target: T) => T & ArrayBaseMixins;
60
+ };
61
+ export declare const ArrayBase: ComposedArrayBase;
62
+ export default ArrayBase;
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.ArrayBase = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _antd = require("antd");
13
+
14
+ var _icons = require("@ant-design/icons");
15
+
16
+ var _react2 = require("@formily/react");
17
+
18
+ var _shared = require("@formily/shared");
19
+
20
+ var _builtins__ = require("@formily/antd-v5/lib/__builtins__");
21
+
22
+ var _classnames = _interopRequireDefault(require("classnames"));
23
+
24
+ var _excluded = ["children"];
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
32
+ 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); }
33
+
34
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
35
+
36
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
37
+
38
+ var ItemContext = /*#__PURE__*/(0, _react.createContext)(null);
39
+
40
+ var takeRecord = function takeRecord(val, index) {
41
+ return typeof val === 'function' ? val(index) : val;
42
+ };
43
+
44
+ var useArray = function useArray() {
45
+ return (0, _react.useContext)(ItemContext);
46
+ };
47
+
48
+ var useIndex = function useIndex(index) {
49
+ var ctx = (0, _react.useContext)(ItemContext);
50
+ return ctx ? ctx.index : index || 0;
51
+ };
52
+
53
+ var useRecord = function useRecord(record) {
54
+ var ctx = (0, _react.useContext)(ItemContext);
55
+ return takeRecord(ctx ? ctx.record : record, ctx === null || ctx === void 0 ? void 0 : ctx.index);
56
+ };
57
+
58
+ var getSchemaDefaultValue = function getSchemaDefaultValue(schema) {
59
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array') return [];
60
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object') return {};
61
+
62
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'void') {
63
+ for (var key in schema.properties) {
64
+ var value = getSchemaDefaultValue(schema.properties[key]);
65
+ if ((0, _shared.isValid)(value)) return value;
66
+ }
67
+ }
68
+ };
69
+
70
+ var getDefaultValue = function getDefaultValue(defaultValue, schema) {
71
+ if ((0, _shared.isValid)(defaultValue)) return (0, _shared.clone)(defaultValue);
72
+ if (Array.isArray(schema === null || schema === void 0 ? void 0 : schema.items)) return getSchemaDefaultValue(schema === null || schema === void 0 ? void 0 : schema.items[0]);
73
+ return getSchemaDefaultValue(schema === null || schema === void 0 ? void 0 : schema.items);
74
+ };
75
+
76
+ var ArrayBase = function ArrayBase(props) {
77
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
78
+ };
79
+
80
+ exports.ArrayBase = ArrayBase;
81
+
82
+ ArrayBase.Item = function (_ref) {
83
+ var children = _ref.children,
84
+ props = _objectWithoutProperties(_ref, _excluded);
85
+
86
+ return /*#__PURE__*/_react.default.createElement(ItemContext.Provider, {
87
+ value: props
88
+ }, children);
89
+ };
90
+
91
+ ArrayBase.Index = function (props) {
92
+ var index = useIndex();
93
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
94
+ return /*#__PURE__*/_react.default.createElement("span", _extends({}, props, {
95
+ className: "".concat(prefixCls, "-index")
96
+ }), "#", (index ? index : 0) + 1, ".");
97
+ };
98
+
99
+ ArrayBase.Addition = function (props) {
100
+ var _array$field, _array$field2;
101
+
102
+ var self = (0, _react2.useField)();
103
+ var array = useArray();
104
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
105
+ if (!array) return null;
106
+ 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;
107
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
108
+ type: "dashed",
109
+ block: true
110
+ }, props, {
111
+ disabled: self === null || self === void 0 ? void 0 : self.disabled,
112
+ className: (0, _classnames.default)("".concat(prefixCls, "-addition"), props.className),
113
+ onClick: function onClick(e) {
114
+ var _array$props;
115
+
116
+ if ((_array$props = array.props) !== null && _array$props !== void 0 && _array$props.disabled) return;
117
+ var defaultValue = getDefaultValue(props.defaultValue, array.schema);
118
+
119
+ if (props.method === 'unshift') {
120
+ var _array$field3, _array$field3$unshift, _array$props2, _array$props2$onAdd;
121
+
122
+ (_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);
123
+ (_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);
124
+ } else {
125
+ var _array$field4, _array$field4$push, _array$props3, _array$props3$onAdd, _array$field5, _array$field5$value;
126
+
127
+ (_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);
128
+ (_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);
129
+ }
130
+
131
+ if (props.onClick) {
132
+ //@ts-ignore
133
+ props.onClick(e);
134
+ }
135
+ },
136
+ icon: (0, _shared.isUndef)(props.icon) ? /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null) : props.icon
137
+ }), props.title || self.title);
138
+ };
139
+
140
+ ArrayBase.Copy = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
141
+ var _array$field6;
142
+
143
+ var self = (0, _react2.useField)();
144
+ var array = useArray();
145
+ var index = useIndex(props.index);
146
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
147
+ if (!array) return null;
148
+ if (((_array$field6 = array.field) === null || _array$field6 === void 0 ? void 0 : _array$field6.pattern) !== 'editable') return null;
149
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
150
+ type: "text"
151
+ }, props, {
152
+ disabled: self === null || self === void 0 ? void 0 : self.disabled,
153
+ className: (0, _classnames.default)("".concat(prefixCls, "-copy"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-copy-disabled") : '', props.className),
154
+ ref: ref,
155
+ onClick: function onClick(e) {
156
+ var _array$props4, _array$field7, _array$field8, _array$field8$insert, _array$props5, _array$props5$onCopy;
157
+
158
+ if (self !== null && self !== void 0 && self.disabled) return;
159
+ e.stopPropagation();
160
+ if ((_array$props4 = array.props) !== null && _array$props4 !== void 0 && _array$props4.disabled) return;
161
+ var value = (0, _shared.clone)(array === null || array === void 0 ? void 0 : (_array$field7 = array.field) === null || _array$field7 === void 0 ? void 0 : _array$field7.value[index]);
162
+ var distIndex = index + 1;
163
+ (_array$field8 = array.field) === null || _array$field8 === void 0 ? void 0 : (_array$field8$insert = _array$field8.insert) === null || _array$field8$insert === void 0 ? void 0 : _array$field8$insert.call(_array$field8, distIndex, value);
164
+ (_array$props5 = array.props) === null || _array$props5 === void 0 ? void 0 : (_array$props5$onCopy = _array$props5.onCopy) === null || _array$props5$onCopy === void 0 ? void 0 : _array$props5$onCopy.call(_array$props5, distIndex);
165
+
166
+ if (props.onClick) {
167
+ //@ts-ignore
168
+ props.onClick(e);
169
+ }
170
+ },
171
+ icon: (0, _shared.isUndef)(props.icon) ? /*#__PURE__*/_react.default.createElement(_icons.CopyOutlined, null) : props.icon
172
+ }), props.title || self.title);
173
+ });
174
+ ArrayBase.Remove = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
175
+ var _array$field9;
176
+
177
+ var index = useIndex(props.index);
178
+ var self = (0, _react2.useField)();
179
+ var array = useArray();
180
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
181
+ if (!array) return null;
182
+ if (((_array$field9 = array.field) === null || _array$field9 === void 0 ? void 0 : _array$field9.pattern) !== 'editable') return null;
183
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
184
+ type: "text"
185
+ }, props, {
186
+ disabled: self === null || self === void 0 ? void 0 : self.disabled,
187
+ className: (0, _classnames.default)("".concat(prefixCls, "-remove"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-remove-disabled") : '', props.className),
188
+ ref: ref,
189
+ onClick: function onClick(e) {
190
+ var _array$field10, _array$field10$remove, _array$props6, _array$props6$onRemov;
191
+
192
+ if (self !== null && self !== void 0 && self.disabled) return;
193
+ e.stopPropagation();
194
+ (_array$field10 = array.field) === null || _array$field10 === void 0 ? void 0 : (_array$field10$remove = _array$field10.remove) === null || _array$field10$remove === void 0 ? void 0 : _array$field10$remove.call(_array$field10, index);
195
+ (_array$props6 = array.props) === null || _array$props6 === void 0 ? void 0 : (_array$props6$onRemov = _array$props6.onRemove) === null || _array$props6$onRemov === void 0 ? void 0 : _array$props6$onRemov.call(_array$props6, index);
196
+
197
+ if (props.onClick) {
198
+ //@ts-ignore
199
+ props.onClick(e);
200
+ }
201
+ },
202
+ icon: (0, _shared.isUndef)(props.icon) ? /*#__PURE__*/_react.default.createElement(_icons.DeleteOutlined, null) : props.icon
203
+ }), props.title || self.title);
204
+ });
205
+ ArrayBase.MoveDown = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
206
+ var _array$field11;
207
+
208
+ var index = useIndex(props.index);
209
+ var self = (0, _react2.useField)();
210
+ var array = useArray();
211
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
212
+ if (!array) return null;
213
+ if (((_array$field11 = array.field) === null || _array$field11 === void 0 ? void 0 : _array$field11.pattern) !== 'editable') return null;
214
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
215
+ type: "text"
216
+ }, props, {
217
+ disabled: self === null || self === void 0 ? void 0 : self.disabled,
218
+ className: (0, _classnames.default)("".concat(prefixCls, "-move-down"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-move-down-disabled") : '', props.className),
219
+ ref: ref,
220
+ onClick: function onClick(e) {
221
+ var _array$field12, _array$field12$moveDo, _array$props7, _array$props7$onMoveD;
222
+
223
+ if (self !== null && self !== void 0 && self.disabled) return;
224
+ e.stopPropagation();
225
+ (_array$field12 = array.field) === null || _array$field12 === void 0 ? void 0 : (_array$field12$moveDo = _array$field12.moveDown) === null || _array$field12$moveDo === void 0 ? void 0 : _array$field12$moveDo.call(_array$field12, index);
226
+ (_array$props7 = array.props) === null || _array$props7 === void 0 ? void 0 : (_array$props7$onMoveD = _array$props7.onMoveDown) === null || _array$props7$onMoveD === void 0 ? void 0 : _array$props7$onMoveD.call(_array$props7, index);
227
+
228
+ if (props.onClick) {
229
+ //@ts-ignore
230
+ props.onClick(e);
231
+ }
232
+ },
233
+ icon: (0, _shared.isUndef)(props.icon) ? /*#__PURE__*/_react.default.createElement(_icons.DownOutlined, null) : props.icon
234
+ }), props.title || self.title);
235
+ });
236
+ ArrayBase.MoveUp = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
237
+ var _array$field13;
238
+
239
+ var index = useIndex(props.index);
240
+ var self = (0, _react2.useField)();
241
+ var array = useArray();
242
+ var prefixCls = (0, _builtins__.usePrefixCls)('formily-array-base');
243
+ if (!array) return null;
244
+ if (((_array$field13 = array.field) === null || _array$field13 === void 0 ? void 0 : _array$field13.pattern) !== 'editable') return null;
245
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
246
+ type: "text"
247
+ }, props, {
248
+ disabled: self === null || self === void 0 ? void 0 : self.disabled,
249
+ className: (0, _classnames.default)("".concat(prefixCls, "-move-up"), self !== null && self !== void 0 && self.disabled ? "".concat(prefixCls, "-move-up-disabled") : '', props.className),
250
+ ref: ref,
251
+ onClick: function onClick(e) {
252
+ var _array$field14, _array$props8, _array$props8$onMoveU;
253
+
254
+ if (self !== null && self !== void 0 && self.disabled) return;
255
+ e.stopPropagation();
256
+ array === null || array === void 0 ? void 0 : (_array$field14 = array.field) === null || _array$field14 === void 0 ? void 0 : _array$field14.moveUp(index);
257
+ array === null || array === void 0 ? void 0 : (_array$props8 = array.props) === null || _array$props8 === void 0 ? void 0 : (_array$props8$onMoveU = _array$props8.onMoveUp) === null || _array$props8$onMoveU === void 0 ? void 0 : _array$props8$onMoveU.call(_array$props8, index);
258
+
259
+ if (props.onClick) {
260
+ //@ts-ignore
261
+ props.onClick(e);
262
+ }
263
+ },
264
+ icon: (0, _shared.isUndef)(props.icon) ? /*#__PURE__*/_react.default.createElement(_icons.UpOutlined, null) : props.icon
265
+ }), props.title || self.title);
266
+ });
267
+ ArrayBase.useArray = useArray;
268
+ ArrayBase.useIndex = useIndex;
269
+ ArrayBase.useRecord = useRecord;
270
+
271
+ ArrayBase.mixin = function (target) {
272
+ target.Index = ArrayBase.Index;
273
+ target.SortHandle = ArrayBase.SortHandle;
274
+ target.Addition = ArrayBase.Addition;
275
+ target.Copy = ArrayBase.Copy;
276
+ target.Remove = ArrayBase.Remove;
277
+ target.MoveDown = ArrayBase.MoveDown;
278
+ target.MoveUp = ArrayBase.MoveUp;
279
+ target.useArray = ArrayBase.useArray;
280
+ target.useIndex = ArrayBase.useIndex;
281
+ target.useRecord = ArrayBase.useRecord;
282
+ return target;
283
+ };
284
+
285
+ var _default = ArrayBase;
286
+ exports.default = _default;
@@ -11,16 +11,16 @@ var _sortBy2 = _interopRequireDefault(require("lodash/sortBy"));
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
- var _agGridPlus = require("../ag-grid-plus");
14
+ var _agGridReact = require("ag-grid-react");
15
15
 
16
16
  var _react2 = require("@formily/react");
17
17
 
18
- var _antdV = require("@formily/antd-v5");
19
-
20
18
  var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
21
19
 
22
20
  var _utils = require("./utils");
23
21
 
22
+ var _arrayBase = _interopRequireDefault(require("./arrayBase"));
23
+
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
 
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -68,11 +68,7 @@ var ArrayTable = (0, _react2.observer)(function (props) {
68
68
  style: {
69
69
  height: height ? height : 400
70
70
  }
71
- }, /*#__PURE__*/_react.default.createElement(_antdV.ArrayBase, {
72
- onAdd: function onAdd() {
73
- setIsAdd(true);
74
- }
75
- }, /*#__PURE__*/_react.default.createElement(_agGridPlus.AgGridPlus, {
71
+ }, /*#__PURE__*/_react.default.createElement(_arrayBase.default, null, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
76
72
  onGridReady: function onGridReady(params) {
77
73
  apiRef.current = params.api;
78
74
  },
@@ -85,14 +81,10 @@ var ArrayTable = (0, _react2.observer)(function (props) {
85
81
  }
86
82
  },
87
83
  className: "ag-theme-alpine",
88
- search: false,
89
84
  getRowId: function getRowId(_ref) {
90
85
  var data = _ref.data;
91
86
  return data._id || data.id;
92
87
  },
93
- toolBarRender: function toolBarRender() {
94
- return [addition];
95
- },
96
88
  rowDragEntireRow: true,
97
89
  onRowDragEnd: function onRowDragEnd(event) {
98
90
  var overIndex = event.overIndex,
@@ -133,14 +125,10 @@ ArrayTable.Column = function () {
133
125
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null);
134
126
  };
135
127
 
136
- _antdV.ArrayBase.mixin(ArrayTable);
128
+ _arrayBase.default.mixin(ArrayTable);
137
129
 
138
130
  var Addition = function Addition(props) {
139
- var self = (0, _react2.useField)();
140
-
141
- var array = _antdV.ArrayBase.useArray();
142
-
143
- return /*#__PURE__*/_react.default.createElement(_antdV.ArrayBase.Addition, _extends({
131
+ return /*#__PURE__*/_react.default.createElement(_arrayBase.default.Addition, _extends({
144
132
  type: "primary",
145
133
  children: "新增行"
146
134
  }, props, {
@@ -1,20 +1,26 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.useArrayTableSources = exports.useArrayTableColumns = exports.useAddition = exports.isColumnComponent = void 0;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
9
11
 
10
12
  var _react2 = require("@formily/react");
11
13
 
12
14
  var _shared = require("@formily/shared");
13
15
 
14
- var _antdV = require("@formily/antd-v5");
16
+ var _arrayBase = _interopRequireDefault(require("./arrayBase"));
15
17
 
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
18
24
  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; }
19
25
 
20
26
  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; }
@@ -90,40 +96,50 @@ var useArrayTableSources = function useArrayTableSources() {
90
96
  };
91
97
 
92
98
  exports.useArrayTableSources = useArrayTableSources;
99
+ var AgField = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
100
+ var value = _ref.value,
101
+ record = _ref.data,
102
+ dataSource = _ref.dataSource,
103
+ schema = _ref.schema,
104
+ field = _ref.field;
105
+ var index = dataSource === null || dataSource === void 0 ? void 0 : dataSource.indexOf(record);
106
+
107
+ var children = /*#__PURE__*/_react.default.createElement(_arrayBase.default.Item, {
108
+ index: index,
109
+ record: function record() {
110
+ var _field$value;
111
+
112
+ return (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value[index];
113
+ },
114
+ schema: schema,
115
+ field: field
116
+ }, /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
117
+ schema: schema,
118
+ name: index,
119
+ onlyRenderProperties: true
120
+ }));
121
+
122
+ return children;
123
+ });
93
124
 
94
125
  var useArrayTableColumns = function useArrayTableColumns(dataSource, field, sources) {
95
- return sources.reduce(function (buf, _ref, key) {
96
- var name = _ref.name,
97
- columnProps = _ref.columnProps,
98
- schema = _ref.schema,
99
- display = _ref.display;
126
+ return sources.reduce(function (buf, _ref2, key) {
127
+ var name = _ref2.name,
128
+ columnProps = _ref2.columnProps,
129
+ schema = _ref2.schema,
130
+ display = _ref2.display;
100
131
  if (display !== 'visible') return buf;
101
132
  if (!isColumnComponent(schema)) return buf;
102
133
  return buf.concat(_objectSpread(_objectSpread({}, columnProps), {}, {
103
134
  //@ts-ignore
104
135
  headerName: columnProps.headerName || columnProps.title,
105
136
  field: name,
106
- cellRenderer: function cellRenderer(_ref2) {
107
- var rowIndex = _ref2.rowIndex,
108
- value = _ref2.value,
109
- record = _ref2.data;
110
- var index = dataSource === null || dataSource === void 0 ? void 0 : dataSource.indexOf(record);
111
-
112
- var children = /*#__PURE__*/_react.default.createElement(_antdV.ArrayBase.Item, {
113
- index: index,
114
- record: function record() {
115
- var _field$value;
116
-
117
- return field === null || field === void 0 ? void 0 : (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value[index];
118
- }
119
- }, /*#__PURE__*/_react.default.createElement(_react2.RecursionField, {
120
- schema: schema,
121
- name: index,
122
- onlyRenderProperties: true
123
- }));
124
-
125
- return children;
126
- }
137
+ cellRendererParams: {
138
+ dataSource: dataSource,
139
+ schema: schema,
140
+ field: field
141
+ },
142
+ cellRenderer: AgField
127
143
  }));
128
144
  }, []);
129
145
  };
@@ -26,11 +26,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
26
26
 
27
27
  import { AgGridReact } from 'ag-grid-react';
28
28
  import { Spin, Pagination, Card, Tag } from 'antd';
29
- import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
29
+ import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
30
30
  import "ag-grid-enterprise";
31
31
  import "./global.scss";
32
32
  import "./index.less";
33
- import { AgGridColumn } from "./interface";
34
33
  import FormRender from "./queryForm";
35
34
  import ToolBar from "./toolBar";
36
35
  import SettingItem from "./settingItem";
@@ -205,6 +204,11 @@ function AgGridPlus(props) {
205
204
  onRefresh: onRefresh
206
205
  };
207
206
  }, [queryFilter, JSON.stringify(gridParams), JSON.stringify(sortColumn)]);
207
+ var colDefs = useMemo(function () {
208
+ return React.Children.map(children, function (child, index) {
209
+ return child.props;
210
+ });
211
+ }, [children]);
208
212
  return /*#__PURE__*/React.createElement(Spin, {
209
213
  spinning: loading,
210
214
  wrapperClassName: "grid-spin"
@@ -328,18 +332,8 @@ function AgGridPlus(props) {
328
332
  } // animateRows={true}
329
333
  //停用默认分页组件
330
334
  ,
331
- suppressPaginationPanel: true
332
- }), props.rowSelection ? /*#__PURE__*/React.createElement(AgGridColumn, {
333
- field: "",
334
- width: 30,
335
- flex: 0,
336
- headerCheckboxSelection: true,
337
- checkboxSelection: true,
338
- showDisabledCheckboxes: true,
339
- filter: false,
340
- pinned: "left"
341
- }) : null, React.Children.map(children, function (child, index) {
342
- return child;
335
+ suppressPaginationPanel: true,
336
+ columnDefs: colDefs || props.columnDefs
343
337
  }))), /*#__PURE__*/React.createElement("div", {
344
338
  style: {
345
339
  marginTop: 12,