@ccs-ui/rc-pro 2.3.6-alpha-7 → 2.3.6-alpha-9
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/ccs.d.ts +12 -9
- package/es/dialog/button.d.ts +1 -1
- package/es/group-form-item/index.d.ts +11 -0
- package/es/group-form-item/index.js +124 -0
- package/es/hooks/use-selection.js +5 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/pro-table/form-item.d.ts +1 -1
- package/es/pro-table/form-item.js +27 -11
- package/es/pro-table/head.js +28 -22
- package/es/pro-table/table.js +82 -57
- package/package.json +1 -1
package/es/ccs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ButtonProps, PaginationProps } from 'antd';
|
|
2
2
|
import { Rule } from 'antd/es/form';
|
|
3
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
3
4
|
import { CSSProperties, MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
4
5
|
import { TableColumn } from './pro-table/table';
|
|
5
6
|
type MenuType = {
|
|
@@ -43,13 +44,8 @@ type TableDataType<T> = {
|
|
|
43
44
|
result?: T[];
|
|
44
45
|
};
|
|
45
46
|
type TableInstance<T = any> = {
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
* 获取form表单数据,排序等条件数据
|
|
49
|
-
*/
|
|
50
|
-
formValues: Record<string, any>;
|
|
51
|
-
/** 接口请求参数 */
|
|
52
|
-
searchParam: Record<string, any>;
|
|
47
|
+
/** 获取当前表单数据 */
|
|
48
|
+
getFormValues: () => Promise<Record<string, any>>;
|
|
53
49
|
/** 获取当前表单数据 */
|
|
54
50
|
data: TableData<T>;
|
|
55
51
|
/** 查询数据,根据条件,从第一页开始显示 */
|
|
@@ -98,11 +94,11 @@ type ShowDependType = {
|
|
|
98
94
|
name: string;
|
|
99
95
|
value: any;
|
|
100
96
|
};
|
|
101
|
-
|
|
97
|
+
type FormItemType = {
|
|
102
98
|
/** label 标题 */
|
|
103
99
|
label?: string;
|
|
104
100
|
/** form name */
|
|
105
|
-
name
|
|
101
|
+
name?: string;
|
|
106
102
|
/** form item element */
|
|
107
103
|
value: ReactElement;
|
|
108
104
|
/** 数据依赖、依赖项对应的name数组 */
|
|
@@ -113,7 +109,14 @@ export type TableFormItem = {
|
|
|
113
109
|
rules?: Rule[];
|
|
114
110
|
/** 在发起请求时调用方法,格式化值 */
|
|
115
111
|
onFormat?: (e: any) => any;
|
|
112
|
+
/** 组表单项名称 */
|
|
113
|
+
groupItemNames?: NamePath[];
|
|
116
114
|
};
|
|
115
|
+
export type TableFormItem = ({
|
|
116
|
+
name: string;
|
|
117
|
+
} & Partial<FormItemType>) | ({
|
|
118
|
+
groupItemNames: NamePath[];
|
|
119
|
+
} & Partial<FormItemType>);
|
|
117
120
|
type TableFormItems = TableFormItem[];
|
|
118
121
|
type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
|
|
119
122
|
type TableColumns<RecordType = any> = TableColumn<RecordType>[];
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onOk" | "onClose" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormItemProps } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
3
|
+
export type GroupFormItemProps = FormItemProps & {
|
|
4
|
+
/** 组表单项名称 */
|
|
5
|
+
groupItemNames: NamePath[];
|
|
6
|
+
};
|
|
7
|
+
declare function GroupFormItem({ groupItemNames, name, ...formItemProps }: GroupFormItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare namespace GroupFormItem {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export default GroupFormItem;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["groupItemNames", "name"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
|
+
import { useUpdateEffect } from 'ahooks';
|
|
21
|
+
import { Form } from 'antd';
|
|
22
|
+
import { useEffect, useState } from 'react';
|
|
23
|
+
import { getDataFromFields } from "../select";
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
var FormUpdateItem = function FormUpdateItem(_ref) {
|
|
28
|
+
var name = _ref.name,
|
|
29
|
+
getFieldsValue = _ref.getFieldsValue,
|
|
30
|
+
setFieldValue = _ref.setFieldValue,
|
|
31
|
+
getFieldValue = _ref.getFieldValue,
|
|
32
|
+
groupItemNames = _ref.groupItemNames;
|
|
33
|
+
var nameValue = getFieldValue(name);
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
// 初始值
|
|
36
|
+
var initialValues = getFieldsValue(true);
|
|
37
|
+
var initNameValue = [];
|
|
38
|
+
|
|
39
|
+
// 根据子项初始值设置name的默认值
|
|
40
|
+
groupItemNames.forEach(function (item) {
|
|
41
|
+
initNameValue.push(getDataFromFields(initialValues, Array.isArray(item) ? item : [item]));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 如果子项有初始值,则设置name的默认值
|
|
45
|
+
if (initNameValue.filter(function (n) {
|
|
46
|
+
return n !== undefined;
|
|
47
|
+
}).length > 0) {
|
|
48
|
+
setFieldValue(name, initNameValue);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 如果子项没有初始值,主项有初始值
|
|
53
|
+
var groupNameValue = getDataFromFields(initialValues, Array.isArray(name) ? name : [name]);
|
|
54
|
+
if (Array.isArray(groupNameValue)) {
|
|
55
|
+
groupItemNames.forEach(function (item, index) {
|
|
56
|
+
setFieldValue(item, groupNameValue[index]);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
// 依赖主字段变更,更新子项属性值
|
|
62
|
+
useUpdateEffect(function () {
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
groupItemNames.forEach(function (item, index) {
|
|
65
|
+
setFieldValue(item, Array.isArray(nameValue) ? nameValue[index] : undefined);
|
|
66
|
+
});
|
|
67
|
+
}, 1);
|
|
68
|
+
}, [nameValue]);
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
function onGetNameValue() {
|
|
72
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
73
|
+
var name = arguments.length > 1 ? arguments[1] : undefined;
|
|
74
|
+
if (!obj) return undefined;
|
|
75
|
+
if (Array.isArray(name)) {
|
|
76
|
+
var names = _toConsumableArray(name);
|
|
77
|
+
var newName = names.shift();
|
|
78
|
+
if (names.length === 0) return obj[newName];
|
|
79
|
+
return onGetNameValue(obj[newName], names);
|
|
80
|
+
}
|
|
81
|
+
return obj[name];
|
|
82
|
+
}
|
|
83
|
+
function GroupFormItem(_ref2) {
|
|
84
|
+
var groupItemNames = _ref2.groupItemNames,
|
|
85
|
+
name = _ref2.name,
|
|
86
|
+
formItemProps = _objectWithoutProperties(_ref2, _excluded);
|
|
87
|
+
var _useState = useState(name || "_".concat(JSON.stringify(groupItemNames).replace(/[^a-zA-Z]/g, ''))),
|
|
88
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
89
|
+
itemName = _useState2[0];
|
|
90
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
+
children: [/*#__PURE__*/_jsx(Form.Item, _objectSpread({
|
|
92
|
+
name: itemName
|
|
93
|
+
}, formItemProps)), groupItemNames && groupItemNames.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
94
|
+
children: [/*#__PURE__*/_jsx(Form.Item, {
|
|
95
|
+
noStyle: true,
|
|
96
|
+
shouldUpdate: function shouldUpdate(l, r) {
|
|
97
|
+
return onGetNameValue(l, itemName) !== onGetNameValue(r, itemName);
|
|
98
|
+
},
|
|
99
|
+
children: function children(_ref3) {
|
|
100
|
+
var getFieldsValue = _ref3.getFieldsValue,
|
|
101
|
+
setFieldValue = _ref3.setFieldValue,
|
|
102
|
+
getFieldValue = _ref3.getFieldValue;
|
|
103
|
+
return /*#__PURE__*/_jsx(FormUpdateItem, {
|
|
104
|
+
getFieldsValue: getFieldsValue,
|
|
105
|
+
setFieldValue: setFieldValue,
|
|
106
|
+
getFieldValue: getFieldValue,
|
|
107
|
+
groupItemNames: groupItemNames,
|
|
108
|
+
name: itemName
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}), groupItemNames.map(function (item, index) {
|
|
112
|
+
return /*#__PURE__*/_jsx(Form.Item, {
|
|
113
|
+
noStyle: true,
|
|
114
|
+
name: item,
|
|
115
|
+
hidden: true
|
|
116
|
+
}, index);
|
|
117
|
+
})]
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
122
|
+
GroupFormItem.displayName = 'CcsGroupFormItem';
|
|
123
|
+
}
|
|
124
|
+
export default GroupFormItem;
|
|
@@ -161,9 +161,12 @@ export default function useTableSelection(props) {
|
|
|
161
161
|
}
|
|
162
162
|
handleOnChange();
|
|
163
163
|
});
|
|
164
|
-
return _objectSpread(_objectSpread({}, selectionRef.current), {}, {
|
|
164
|
+
return _objectSpread(_objectSpread(_objectSpread({}, selectionRef.current), {}, {
|
|
165
165
|
onChange: onChange,
|
|
166
166
|
onClear: onClear,
|
|
167
167
|
type: type
|
|
168
|
-
}, rowSelectionProps)
|
|
168
|
+
}, rowSelectionProps), {}, {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
onClearByProTable: onClear
|
|
171
|
+
});
|
|
169
172
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as CcsDialog } from './dialog';
|
|
|
9
9
|
export { default as CcsEditor } from './editor';
|
|
10
10
|
export { default as CcsEllipsis } from './ellipsis';
|
|
11
11
|
export { default as CcsFullScreenButton } from './full-screen';
|
|
12
|
+
export { default as CcsGroupFormItem } from './group-form-item';
|
|
12
13
|
export { default as useAppConfig } from './hooks/use-app';
|
|
13
14
|
export { default as useCcsOnceEvent } from './hooks/use-once-event';
|
|
14
15
|
export { default as useCcsPage } from './hooks/use-page';
|
package/es/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as CcsDialog } from "./dialog";
|
|
|
9
9
|
export { default as CcsEditor } from "./editor";
|
|
10
10
|
export { default as CcsEllipsis } from "./ellipsis";
|
|
11
11
|
export { default as CcsFullScreenButton } from "./full-screen";
|
|
12
|
+
export { default as CcsGroupFormItem } from "./group-form-item";
|
|
12
13
|
export { default as useAppConfig } from "./hooks/use-app";
|
|
13
14
|
export { default as useCcsOnceEvent } from "./hooks/use-once-event";
|
|
14
15
|
export { default as useCcsPage } from "./hooks/use-page";
|
|
@@ -3,5 +3,5 @@ import { CcsProTableProps } from './table';
|
|
|
3
3
|
type PropsType = TableFormItem & {
|
|
4
4
|
dependParam?: any;
|
|
5
5
|
} & Pick<CcsProTableProps<any>, 'formItemLabelWidth'>;
|
|
6
|
-
export default function HeadFormItem({ label, name, rules, value, dependParam, formItemLabelWidth, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function HeadFormItem({ label, name, rules, value, dependParam, groupItemNames, formItemLabelWidth, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
import { Form } from 'antd';
|
|
2
8
|
import { cloneElement } from 'react';
|
|
9
|
+
import { CcsGroupFormItem } from '..';
|
|
3
10
|
import { classPrefix } from "./table";
|
|
4
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -9,19 +16,28 @@ export default function HeadFormItem(_ref) {
|
|
|
9
16
|
rules = _ref.rules,
|
|
10
17
|
value = _ref.value,
|
|
11
18
|
dependParam = _ref.dependParam,
|
|
19
|
+
groupItemNames = _ref.groupItemNames,
|
|
12
20
|
formItemLabelWidth = _ref.formItemLabelWidth;
|
|
21
|
+
var props = {
|
|
22
|
+
name: name,
|
|
23
|
+
rules: rules,
|
|
24
|
+
className: "".concat(classPrefix, "-form-label"),
|
|
25
|
+
label: formItemLabelWidth ? /*#__PURE__*/_jsx("div", {
|
|
26
|
+
style: {
|
|
27
|
+
width: formItemLabelWidth
|
|
28
|
+
},
|
|
29
|
+
children: label
|
|
30
|
+
}) : label
|
|
31
|
+
};
|
|
32
|
+
if (groupItemNames) {
|
|
33
|
+
return /*#__PURE__*/_jsx(CcsGroupFormItem, _objectSpread(_objectSpread({}, props), {}, {
|
|
34
|
+
groupItemNames: groupItemNames,
|
|
35
|
+
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
13
38
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
14
|
-
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
15
|
-
name: name,
|
|
16
|
-
rules: rules,
|
|
17
|
-
className: "".concat(classPrefix, "-form-label"),
|
|
18
|
-
label: formItemLabelWidth ? /*#__PURE__*/_jsx("div", {
|
|
19
|
-
style: {
|
|
20
|
-
width: formItemLabelWidth
|
|
21
|
-
},
|
|
22
|
-
children: label
|
|
23
|
-
}) : label,
|
|
39
|
+
children: /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, props), {}, {
|
|
24
40
|
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
25
|
-
})
|
|
41
|
+
}))
|
|
26
42
|
});
|
|
27
43
|
}
|
package/es/pro-table/head.js
CHANGED
|
@@ -105,39 +105,44 @@ function HeadComponent(_ref) {
|
|
|
105
105
|
}), toolbar ? null : tableOperation]
|
|
106
106
|
});
|
|
107
107
|
var renderFormItems = function renderFormItems() {
|
|
108
|
-
return allFormItems.map(function (
|
|
109
|
-
|
|
108
|
+
return allFormItems.map(function (_ref2, index) {
|
|
109
|
+
var depends = _ref2.depends,
|
|
110
|
+
showDepends = _ref2.showDepends,
|
|
111
|
+
name = _ref2.name,
|
|
112
|
+
groupItemNames = _ref2.groupItemNames,
|
|
113
|
+
label = _ref2.label,
|
|
114
|
+
rules = _ref2.rules,
|
|
115
|
+
value = _ref2.value;
|
|
116
|
+
if (depends || showDepends) {
|
|
110
117
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
111
118
|
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
112
119
|
noStyle: true,
|
|
113
120
|
shouldUpdate: function shouldUpdate(l, n) {
|
|
114
|
-
|
|
115
|
-
return ((_item$depends = item.depends) === null || _item$depends === void 0 ? void 0 : _item$depends.some(function (i) {
|
|
121
|
+
return (depends === null || depends === void 0 ? void 0 : depends.some(function (i) {
|
|
116
122
|
return l[i] !== n[i];
|
|
117
|
-
})) || (
|
|
123
|
+
})) || (showDepends === null || showDepends === void 0 ? void 0 : showDepends.some(function (i) {
|
|
118
124
|
return l[i.name] !== n[i.name];
|
|
119
125
|
})) || false;
|
|
120
126
|
},
|
|
121
|
-
children: function children(
|
|
122
|
-
var
|
|
123
|
-
var getFieldValue = _ref2.getFieldValue;
|
|
127
|
+
children: function children(_ref3) {
|
|
128
|
+
var getFieldValue = _ref3.getFieldValue;
|
|
124
129
|
var dependParam = {};
|
|
125
|
-
|
|
130
|
+
depends === null || depends === void 0 || depends.forEach(function (i) {
|
|
126
131
|
var value = getFieldValue(i);
|
|
127
132
|
dependParam[i] = value;
|
|
128
133
|
});
|
|
129
134
|
var isShow = true;
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
isShow = (_item$showDepends2 = item.showDepends) === null || _item$showDepends2 === void 0 ? void 0 : _item$showDepends2.every(function (i) {
|
|
135
|
+
if (showDepends && showDepends.length > 0) {
|
|
136
|
+
isShow = showDepends === null || showDepends === void 0 ? void 0 : showDepends.every(function (i) {
|
|
133
137
|
return getFieldValue(i.name) === i.value;
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
140
|
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, {
|
|
137
|
-
name:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
name: name,
|
|
142
|
+
groupItemNames: groupItemNames,
|
|
143
|
+
label: label,
|
|
144
|
+
rules: rules,
|
|
145
|
+
value: value,
|
|
141
146
|
dependParam: dependParam,
|
|
142
147
|
formItemLabelWidth: formItemLabelWidth
|
|
143
148
|
});
|
|
@@ -145,18 +150,19 @@ function HeadComponent(_ref) {
|
|
|
145
150
|
return itemContent;
|
|
146
151
|
}
|
|
147
152
|
})
|
|
148
|
-
},
|
|
153
|
+
}, name);
|
|
149
154
|
}
|
|
150
155
|
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
groupItemNames: groupItemNames,
|
|
157
|
+
name: name,
|
|
158
|
+
value: value,
|
|
159
|
+
rules: rules,
|
|
160
|
+
label: label,
|
|
155
161
|
formItemLabelWidth: formItemLabelWidth
|
|
156
162
|
});
|
|
157
163
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
158
164
|
children: itemContent
|
|
159
|
-
},
|
|
165
|
+
}, index);
|
|
160
166
|
});
|
|
161
167
|
};
|
|
162
168
|
var formStyles = {
|
package/es/pro-table/table.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
9
9
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -124,8 +124,6 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
124
124
|
var filterOrderRef = useRef(defaultColumnValues);
|
|
125
125
|
// table content
|
|
126
126
|
var tableContentRef = useRef(null);
|
|
127
|
-
// 接口查询条件
|
|
128
|
-
var searchParamRef = useRef({});
|
|
129
127
|
// container
|
|
130
128
|
var containerRef = useRef(null);
|
|
131
129
|
// table ref
|
|
@@ -167,14 +165,49 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
167
165
|
});
|
|
168
166
|
}, []);
|
|
169
167
|
|
|
168
|
+
// 构建查询条件:表单数据、请求额外参数、分页参数、其他参数
|
|
169
|
+
var getFormValues = /*#__PURE__*/function () {
|
|
170
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
171
|
+
var _formRef$current;
|
|
172
|
+
var formValues;
|
|
173
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
174
|
+
while (1) switch (_context.prev = _context.next) {
|
|
175
|
+
case 0:
|
|
176
|
+
_context.next = 2;
|
|
177
|
+
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.validateFields();
|
|
178
|
+
case 2:
|
|
179
|
+
formValues = _context.sent;
|
|
180
|
+
// 格式化条件
|
|
181
|
+
if (formatFormItems.length) {
|
|
182
|
+
Object.keys(formValues).forEach(function (k) {
|
|
183
|
+
if (formValues[k] !== undefined) {
|
|
184
|
+
var s = formatFormItems.find(function (f) {
|
|
185
|
+
return f.name === k;
|
|
186
|
+
});
|
|
187
|
+
if (s) formValues[k] = s.onFormat && s.onFormat(formValues[k]);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, requestParam), formInitValues), formValues));
|
|
192
|
+
case 5:
|
|
193
|
+
case "end":
|
|
194
|
+
return _context.stop();
|
|
195
|
+
}
|
|
196
|
+
}, _callee);
|
|
197
|
+
}));
|
|
198
|
+
return function getFormValues() {
|
|
199
|
+
return _ref2.apply(this, arguments);
|
|
200
|
+
};
|
|
201
|
+
}();
|
|
202
|
+
|
|
170
203
|
// 获取数据
|
|
171
204
|
var onRequest = /*#__PURE__*/function () {
|
|
172
|
-
var
|
|
173
|
-
var
|
|
205
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventType) {
|
|
206
|
+
var _props$table;
|
|
174
207
|
var pageNo,
|
|
175
208
|
pageSize,
|
|
176
209
|
record,
|
|
177
|
-
|
|
210
|
+
allParams,
|
|
178
211
|
fieldNames,
|
|
179
212
|
_fieldNames$requestPa,
|
|
180
213
|
_fieldNames$requestPa2,
|
|
@@ -195,43 +228,31 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
195
228
|
dataSource,
|
|
196
229
|
total,
|
|
197
230
|
newData,
|
|
198
|
-
|
|
199
|
-
return _regeneratorRuntime().wrap(function
|
|
200
|
-
while (1) switch (
|
|
231
|
+
_args2 = arguments;
|
|
232
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
233
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
201
234
|
case 0:
|
|
202
|
-
pageNo =
|
|
203
|
-
pageSize =
|
|
204
|
-
record =
|
|
235
|
+
pageNo = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 1;
|
|
236
|
+
pageSize = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : (pagination ? pagination.defaultPageSize : 10) || 10;
|
|
237
|
+
record = _args2.length > 3 ? _args2[3] : undefined;
|
|
205
238
|
if (!(!isAuth || !httpRequest)) {
|
|
206
|
-
|
|
239
|
+
_context2.next = 5;
|
|
207
240
|
break;
|
|
208
241
|
}
|
|
209
|
-
return
|
|
242
|
+
return _context2.abrupt("return");
|
|
210
243
|
case 5:
|
|
211
|
-
|
|
212
|
-
return (
|
|
244
|
+
_context2.next = 7;
|
|
245
|
+
return getFormValues();
|
|
213
246
|
case 7:
|
|
214
|
-
|
|
247
|
+
allParams = _context2.sent;
|
|
215
248
|
// 接口字段指定
|
|
216
|
-
fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), (_props$table = props.table) === null || _props$table === void 0 ? void 0 : _props$table.fieldNames); //
|
|
217
|
-
if (formatFormItems.length) {
|
|
218
|
-
Object.keys(formValues).forEach(function (k) {
|
|
219
|
-
if (formValues[k] !== undefined) {
|
|
220
|
-
var s = formatFormItems.find(function (f) {
|
|
221
|
-
return f.name === k;
|
|
222
|
-
});
|
|
223
|
-
if (s) formValues[k] = s.onFormat && s.onFormat(formValues[k]);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// 请求字段
|
|
249
|
+
fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), (_props$table = props.table) === null || _props$table === void 0 ? void 0 : _props$table.fieldNames); // 请求字段
|
|
229
250
|
_fieldNames$requestPa = fieldNames.requestParam, _fieldNames$requestPa2 = _fieldNames$requestPa.filters, fsFilters = _fieldNames$requestPa2 === void 0 ? ['filters'] : _fieldNames$requestPa2, _fieldNames$requestPa3 = _fieldNames$requestPa.pageNo, fsPageNo = _fieldNames$requestPa3 === void 0 ? ['pageNo'] : _fieldNames$requestPa3, _fieldNames$requestPa4 = _fieldNames$requestPa.pageSize, fsPageSize = _fieldNames$requestPa4 === void 0 ? ['pageSize'] : _fieldNames$requestPa4, _fieldNames$requestPa5 = _fieldNames$requestPa.orderProps, fsOrderProps = _fieldNames$requestPa5 === void 0 ? ['orderProps'] : _fieldNames$requestPa5, fsQuery = _fieldNames$requestPa.query; // 构建请求参数
|
|
230
251
|
params = {};
|
|
231
252
|
if (fsQuery && fsQuery.length > 0) {
|
|
232
|
-
onSetObj(params, _toConsumableArray(fsQuery),
|
|
253
|
+
onSetObj(params, _toConsumableArray(fsQuery), allParams);
|
|
233
254
|
} else {
|
|
234
|
-
params =
|
|
255
|
+
params = allParams;
|
|
235
256
|
}
|
|
236
257
|
if (pagination !== false) {
|
|
237
258
|
// 分页
|
|
@@ -250,14 +271,12 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
250
271
|
|
|
251
272
|
// 异步树
|
|
252
273
|
if (!parentFieldName) {
|
|
253
|
-
|
|
274
|
+
_context2.next = 19;
|
|
254
275
|
break;
|
|
255
276
|
}
|
|
256
277
|
(_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 || _treeRef$current.onRequestTree(params.query, record);
|
|
257
|
-
return
|
|
258
|
-
case
|
|
259
|
-
// 记录查询条件
|
|
260
|
-
searchParamRef.current = params;
|
|
278
|
+
return _context2.abrupt("return");
|
|
279
|
+
case 19:
|
|
261
280
|
onEvent === null || onEvent === void 0 || onEvent(eventType, {
|
|
262
281
|
loading: true,
|
|
263
282
|
params: params
|
|
@@ -269,10 +288,10 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
269
288
|
loading: true
|
|
270
289
|
});
|
|
271
290
|
});
|
|
272
|
-
|
|
291
|
+
_context2.next = 23;
|
|
273
292
|
return httpRequest(params);
|
|
274
|
-
case
|
|
275
|
-
requestResult =
|
|
293
|
+
case 23:
|
|
294
|
+
requestResult = _context2.sent;
|
|
276
295
|
onEvent === null || onEvent === void 0 || onEvent(eventType, {
|
|
277
296
|
loading: false,
|
|
278
297
|
params: params,
|
|
@@ -281,7 +300,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
281
300
|
|
|
282
301
|
// 请求结果
|
|
283
302
|
if (!requestResult) {
|
|
284
|
-
|
|
303
|
+
_context2.next = 35;
|
|
285
304
|
break;
|
|
286
305
|
}
|
|
287
306
|
// 获取table数据
|
|
@@ -291,7 +310,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
291
310
|
}
|
|
292
311
|
total = getDataFromFields(requestResult, fieldNames.total);
|
|
293
312
|
if (!(total === undefined || dataSource === undefined)) {
|
|
294
|
-
|
|
313
|
+
_context2.next = 33;
|
|
295
314
|
break;
|
|
296
315
|
}
|
|
297
316
|
newData = {
|
|
@@ -302,8 +321,8 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
302
321
|
loading: false
|
|
303
322
|
};
|
|
304
323
|
setData(newData);
|
|
305
|
-
return
|
|
306
|
-
case
|
|
324
|
+
return _context2.abrupt("return");
|
|
325
|
+
case 33:
|
|
307
326
|
// 当前页无数据,返回上一页
|
|
308
327
|
if (!dataSource.length && pageNo !== 1) {
|
|
309
328
|
onRequest(TableEvent.Reload, pageNo - 1);
|
|
@@ -316,21 +335,21 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
316
335
|
total: total || 0
|
|
317
336
|
});
|
|
318
337
|
}
|
|
319
|
-
return
|
|
320
|
-
case
|
|
338
|
+
return _context2.abrupt("return");
|
|
339
|
+
case 35:
|
|
321
340
|
setData(function (d) {
|
|
322
341
|
return _objectSpread(_objectSpread({}, d), {}, {
|
|
323
342
|
loading: false
|
|
324
343
|
});
|
|
325
344
|
});
|
|
326
|
-
case
|
|
345
|
+
case 36:
|
|
327
346
|
case "end":
|
|
328
|
-
return
|
|
347
|
+
return _context2.stop();
|
|
329
348
|
}
|
|
330
|
-
},
|
|
349
|
+
}, _callee2);
|
|
331
350
|
}));
|
|
332
351
|
return function onRequest(_x) {
|
|
333
|
-
return
|
|
352
|
+
return _ref3.apply(this, arguments);
|
|
334
353
|
};
|
|
335
354
|
}();
|
|
336
355
|
|
|
@@ -382,12 +401,17 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
382
401
|
|
|
383
402
|
// 查询按钮
|
|
384
403
|
var onSearch = function onSearch() {
|
|
404
|
+
var _table$rowSelection, _table$rowSelection$o;
|
|
405
|
+
// @ts-ignore
|
|
406
|
+
table === null || table === void 0 || (_table$rowSelection = table.rowSelection) === null || _table$rowSelection === void 0 || (_table$rowSelection$o = _table$rowSelection.onClearByProTable) === null || _table$rowSelection$o === void 0 || _table$rowSelection$o.call(_table$rowSelection);
|
|
385
407
|
onRequest(TableEvent.Search);
|
|
386
408
|
};
|
|
387
409
|
|
|
388
410
|
// 重置
|
|
389
411
|
var onReset = function onReset() {
|
|
390
|
-
var _formRef$current2;
|
|
412
|
+
var _table$rowSelection2, _table$rowSelection2$, _formRef$current2;
|
|
413
|
+
// @ts-ignore
|
|
414
|
+
table === null || table === void 0 || (_table$rowSelection2 = table.rowSelection) === null || _table$rowSelection2 === void 0 || (_table$rowSelection2$ = _table$rowSelection2.onClearByProTable) === null || _table$rowSelection2$ === void 0 || _table$rowSelection2$.call(_table$rowSelection2);
|
|
391
415
|
// 重置表单
|
|
392
416
|
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.resetFields();
|
|
393
417
|
// 清空columns显示filter和sort值
|
|
@@ -406,16 +430,17 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
406
430
|
|
|
407
431
|
// 刷新
|
|
408
432
|
var onReload = function onReload() {
|
|
433
|
+
var _table$rowSelection3, _table$rowSelection3$;
|
|
434
|
+
// @ts-ignore
|
|
435
|
+
table === null || table === void 0 || (_table$rowSelection3 = table.rowSelection) === null || _table$rowSelection3 === void 0 || (_table$rowSelection3$ = _table$rowSelection3.onClearByProTable) === null || _table$rowSelection3$ === void 0 || _table$rowSelection3$.call(_table$rowSelection3);
|
|
409
436
|
onRequest(TableEvent.Reload, data.current, data.pageSize);
|
|
410
437
|
};
|
|
411
438
|
|
|
412
439
|
// form 数据 查询,重载,重置方法
|
|
413
440
|
useImperativeHandle(proRef, function () {
|
|
414
|
-
var _formRef$current3;
|
|
415
441
|
return {
|
|
416
442
|
data: data,
|
|
417
|
-
|
|
418
|
-
searchParam: searchParamRef.current,
|
|
443
|
+
getFormValues: getFormValues,
|
|
419
444
|
onSearch: onSearch,
|
|
420
445
|
onReload: onReload,
|
|
421
446
|
onPartialReload: function onPartialReload(param) {
|
|
@@ -550,9 +575,9 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
550
575
|
}, rootStyle);
|
|
551
576
|
}
|
|
552
577
|
var onFullScreen = function onFullScreen(isFull) {
|
|
553
|
-
var
|
|
554
|
-
classList =
|
|
555
|
-
style =
|
|
578
|
+
var _ref4 = containerRef.current || {},
|
|
579
|
+
classList = _ref4.classList,
|
|
580
|
+
style = _ref4.style;
|
|
556
581
|
if (isFull) {
|
|
557
582
|
classList === null || classList === void 0 || classList.add('css-table-full');
|
|
558
583
|
style.backgroundColor = token.colorBgContainer;
|