@ccs-ui/rc-pro 1.1.25-beta-21 → 1.1.25-beta-23
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/auth/index.js +26 -12
- package/es/auth/index.less +1 -0
- package/es/dialog/DialogRequestButton.d.ts +1 -1
- package/es/dialog/DialogSelfOkButton.d.ts +1 -1
- package/es/editor/index.less +1 -0
- package/es/pro-table/_utils.d.ts +1 -1
- package/es/pro-table/_utils.js +1 -1
- package/es/pro-table/form-item.d.ts +1 -6
- package/es/pro-table/form-item.js +15 -60
- package/es/pro-table/head.d.ts +0 -5
- package/es/pro-table/head.js +38 -65
- package/es/pro-table/index.less +12 -0
- package/es/pro-table/operation.js +2 -1
- package/es/pro-table/table.d.ts +6 -6
- package/es/pro-table/table.js +1 -1
- package/package.json +1 -1
package/es/auth/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
-
var _excluded = ["
|
|
3
|
-
_excluded2 = ["key", "label",
|
|
2
|
+
var _excluded = ["onDisabled", "onHidden"],
|
|
3
|
+
_excluded2 = ["key", "label"],
|
|
4
|
+
_excluded3 = ["key", "label", "disabled", "onDisabled", "onHidden"];
|
|
4
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
7
|
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; }
|
|
@@ -69,6 +70,17 @@ function AuthGroup(_ref4) {
|
|
|
69
70
|
return !item.hidden && !(item.onHidden && item.onHidden(selectedRows));
|
|
70
71
|
});
|
|
71
72
|
|
|
73
|
+
// link按钮删除无用参数
|
|
74
|
+
if (isLink) {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
+
authButtons = authButtons.map(function (_ref7) {
|
|
77
|
+
var onDisabled = _ref7.onDisabled,
|
|
78
|
+
onHidden = _ref7.onHidden,
|
|
79
|
+
b = _objectWithoutProperties(_ref7, _excluded);
|
|
80
|
+
return _objectSpread({}, b);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
72
84
|
// 需要判断权限
|
|
73
85
|
if (onAuth) {
|
|
74
86
|
authButtons = authButtons.filter(function (b) {
|
|
@@ -111,10 +123,10 @@ function AuthGroup(_ref4) {
|
|
|
111
123
|
type: "vertical"
|
|
112
124
|
}),
|
|
113
125
|
className: "ccs-group-link",
|
|
114
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (
|
|
115
|
-
var key =
|
|
116
|
-
label =
|
|
117
|
-
restProps = _objectWithoutProperties(
|
|
126
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (_ref8) {
|
|
127
|
+
var key = _ref8.key,
|
|
128
|
+
label = _ref8.label,
|
|
129
|
+
restProps = _objectWithoutProperties(_ref8, _excluded2);
|
|
118
130
|
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
119
131
|
size: size,
|
|
120
132
|
type: "link",
|
|
@@ -147,12 +159,14 @@ function AuthGroup(_ref4) {
|
|
|
147
159
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
148
160
|
children: [/*#__PURE__*/_jsx(Space, {
|
|
149
161
|
wrap: true,
|
|
150
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function ( // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
163
|
+
_ref9, index) {
|
|
164
|
+
var key = _ref9.key,
|
|
165
|
+
label = _ref9.label,
|
|
166
|
+
disabled = _ref9.disabled,
|
|
167
|
+
onDisabled = _ref9.onDisabled,
|
|
168
|
+
onHidden = _ref9.onHidden,
|
|
169
|
+
restProps = _objectWithoutProperties(_ref9, _excluded3);
|
|
156
170
|
// 按钮禁用
|
|
157
171
|
var isDisabled = disabled || onDisabled && onDisabled(selectedRows);
|
|
158
172
|
|
package/es/auth/index.less
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogRequestButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "
|
|
4
|
+
declare const DialogRequestButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "request" | "onRequestBefore"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogSelfOkButton: ({ auth, formRef, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "
|
|
4
|
+
declare const DialogSelfOkButton: ({ auth, formRef, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "onOk"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/editor/index.less
CHANGED
package/es/pro-table/_utils.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ declare const getAllChildrenId: (data: any[], rowKey: string) => string[];
|
|
|
9
9
|
declare const isComponent: (element: ReactNode, displayName: string) => boolean;
|
|
10
10
|
/** 查找所有父级依赖 */
|
|
11
11
|
declare const getShowDpends: (items: CCS.TableFormItems, item: CCS.TableFormItems[0], depends: ShowDependType[]) => ShowDependType[];
|
|
12
|
-
export {
|
|
12
|
+
export { getAllChildrenId, getDataById, getShowDpends, isComponent, onTableInModalOrDrawer, onTableInTabItem, };
|
package/es/pro-table/_utils.js
CHANGED
|
@@ -91,4 +91,4 @@ var getShowDpends = function getShowDpends(items, item, depends) {
|
|
|
91
91
|
}
|
|
92
92
|
return depends;
|
|
93
93
|
};
|
|
94
|
-
export {
|
|
94
|
+
export { getAllChildrenId, getDataById, getShowDpends, isComponent, onTableInModalOrDrawer, onTableInTabItem };
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TableFormItem } from '../ccs';
|
|
3
|
-
import { FormItemRef } from './head';
|
|
4
2
|
import { CcsProTableProps } from './table';
|
|
5
3
|
type PropsType = TableFormItem & {
|
|
6
|
-
index: number;
|
|
7
4
|
dependParam?: any;
|
|
8
|
-
onSetShowNum: () => void;
|
|
9
|
-
formItemsRef: React.MutableRefObject<FormItemRef>;
|
|
10
5
|
} & Pick<CcsProTableProps<any>, 'formItemLabelWidth'>;
|
|
11
|
-
export default function HeadFormItem({ label, name, rules, value,
|
|
6
|
+
export default function HeadFormItem({ label, name, rules, value, dependParam, formItemLabelWidth, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
12
7
|
export {};
|
|
@@ -1,72 +1,27 @@
|
|
|
1
1
|
import { Form } from 'antd';
|
|
2
|
-
import { cloneElement
|
|
3
|
-
import { CcsResizeObserver } from '..';
|
|
2
|
+
import { cloneElement } from 'react';
|
|
4
3
|
import { classPrefix } from "./table";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
6
|
export default function HeadFormItem(_ref) {
|
|
9
7
|
var label = _ref.label,
|
|
10
8
|
name = _ref.name,
|
|
11
9
|
rules = _ref.rules,
|
|
12
10
|
value = _ref.value,
|
|
13
|
-
index = _ref.index,
|
|
14
11
|
dependParam = _ref.dependParam,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
if (hasIndex === -1) {
|
|
31
|
-
formItemsRef.current.push(item);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
formItemsRef.current[index] = item;
|
|
35
|
-
historyRef.current = item;
|
|
36
|
-
};
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
onSaveRef();
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
// 尺寸大小改变监听
|
|
42
|
-
var onResize = function onResize(size) {
|
|
43
|
-
var _index;
|
|
44
|
-
if ((size === null || size === void 0 ? void 0 : size.width) !== ((_index = formItemsRef.current[index]) === null || _index === void 0 ? void 0 : _index.width)) {
|
|
45
|
-
onSaveRef();
|
|
46
|
-
onSetShowNum();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
50
|
-
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
51
|
-
targetRef: ref,
|
|
52
|
-
onResize: onResize
|
|
53
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
54
|
-
ref: ref,
|
|
55
|
-
style: {
|
|
56
|
-
paddingRight: 10
|
|
57
|
-
},
|
|
58
|
-
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
59
|
-
name: name,
|
|
60
|
-
rules: rules,
|
|
61
|
-
className: "".concat(classPrefix, "-form-label"),
|
|
62
|
-
label: formItemLabelWidth ? /*#__PURE__*/_jsx("div", {
|
|
63
|
-
style: {
|
|
64
|
-
width: formItemLabelWidth
|
|
65
|
-
},
|
|
66
|
-
children: label
|
|
67
|
-
}) : label,
|
|
68
|
-
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
69
|
-
})
|
|
70
|
-
})]
|
|
12
|
+
formItemLabelWidth = _ref.formItemLabelWidth;
|
|
13
|
+
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,
|
|
24
|
+
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
25
|
+
})
|
|
71
26
|
});
|
|
72
27
|
}
|
package/es/pro-table/head.d.ts
CHANGED
|
@@ -12,11 +12,6 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
|
|
|
12
12
|
tableOperation: ReactElement;
|
|
13
13
|
onSearch: () => void;
|
|
14
14
|
};
|
|
15
|
-
export type FormItemRef = {
|
|
16
|
-
index: number;
|
|
17
|
-
ref: HTMLDivElement;
|
|
18
|
-
width: number;
|
|
19
|
-
}[];
|
|
20
15
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
21
16
|
declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, titleBordered, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
17
|
export default HeadComponent;
|
package/es/pro-table/head.js
CHANGED
|
@@ -14,27 +14,16 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
|
|
14
14
|
import { useUpdateEffect } from 'ahooks';
|
|
15
15
|
import { Button, Card, Form } from 'antd';
|
|
16
16
|
import _debounce from 'lodash/debounce';
|
|
17
|
-
import React, {
|
|
17
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
18
18
|
import { CcsResizeObserver } from '..';
|
|
19
19
|
import { getShowDpends } from "./_utils";
|
|
20
20
|
import HeadFormItem from "./form-item";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
-
function onShowMaxItem(nums, maxWidth) {
|
|
25
|
-
var newNums = 0;
|
|
26
|
-
for (var i = 0; i < nums.length; i++) {
|
|
27
|
-
if (newNums + nums[i] > maxWidth) {
|
|
28
|
-
return i - 1;
|
|
29
|
-
} else {
|
|
30
|
-
newNums += nums[i];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return nums.length - 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
24
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
37
25
|
function HeadComponent(_ref) {
|
|
26
|
+
var _formItemsRef$current;
|
|
38
27
|
var form = _ref.form,
|
|
39
28
|
title = _ref.title,
|
|
40
29
|
toolbar = _ref.toolbar,
|
|
@@ -48,40 +37,20 @@ function HeadComponent(_ref) {
|
|
|
48
37
|
formItemLabelWidth = _ref.formItemLabelWidth,
|
|
49
38
|
tableOperation = _ref.tableOperation,
|
|
50
39
|
onSearch = _ref.onSearch;
|
|
51
|
-
var
|
|
52
|
-
var formItemsRef = useRef(
|
|
40
|
+
var searchBtnRef = useRef(null);
|
|
41
|
+
var formItemsRef = useRef(null);
|
|
53
42
|
// 查询条件是否展开
|
|
54
43
|
var _useState = useState(expandForm),
|
|
55
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
56
45
|
isExpand = _useState2[0],
|
|
57
46
|
setIsExpand = _useState2[1];
|
|
58
|
-
|
|
59
|
-
var _useState3 = useState(-1),
|
|
47
|
+
var _useState3 = useState({}),
|
|
60
48
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
|
-
|
|
62
|
-
setShowNum = _useState4[1];
|
|
49
|
+
update = _useState4[1];
|
|
63
50
|
useUpdateEffect(function () {
|
|
64
51
|
setIsExpand(expandForm);
|
|
65
52
|
}, [expandForm]);
|
|
66
53
|
|
|
67
|
-
// 设置最大显示条件数量
|
|
68
|
-
var onSetShowNum = function onSetShowNum() {
|
|
69
|
-
if (!cardRef.current) return;
|
|
70
|
-
|
|
71
|
-
// 单行查询条件可占空间
|
|
72
|
-
var maxWidth = cardRef.current.clientWidth - 32 - 64 * 2;
|
|
73
|
-
if (maxWidth < 0) return;
|
|
74
|
-
|
|
75
|
-
// 单行可显示的查询条件
|
|
76
|
-
var maxItems = onShowMaxItem(formItemsRef.current.map(function (f) {
|
|
77
|
-
return f.width;
|
|
78
|
-
}), maxWidth);
|
|
79
|
-
setShowNum(maxItems);
|
|
80
|
-
};
|
|
81
|
-
useEffect(function () {
|
|
82
|
-
onSetShowNum();
|
|
83
|
-
}, [isExpand]);
|
|
84
|
-
|
|
85
54
|
// 处理form item 依赖
|
|
86
55
|
var allFormItems = useMemo(function () {
|
|
87
56
|
formItems.forEach(function (item) {
|
|
@@ -96,13 +65,15 @@ function HeadComponent(_ref) {
|
|
|
96
65
|
// 查询条件记录数
|
|
97
66
|
var itemLen = allFormItems.length;
|
|
98
67
|
var hasItem = itemLen > 0;
|
|
99
|
-
var hasMore =
|
|
68
|
+
var hasMore = (((_formItemsRef$current = formItemsRef.current) === null || _formItemsRef$current === void 0 ? void 0 : _formItemsRef$current.scrollHeight) || 0) > 40;
|
|
69
|
+
console.log('hasMore', hasMore);
|
|
100
70
|
|
|
101
71
|
// 操作按钮
|
|
102
|
-
var
|
|
72
|
+
var renderSearchBtn = /*#__PURE__*/_jsxs("div", {
|
|
73
|
+
ref: searchBtnRef,
|
|
103
74
|
style: {
|
|
104
75
|
textAlign: 'right',
|
|
105
|
-
flex: isExpand ? '1 1 auto' : '0 0 auto'
|
|
76
|
+
flex: isExpand && hasMore ? '1 1 auto' : '0 0 auto'
|
|
106
77
|
},
|
|
107
78
|
children: [hasMore && /*#__PURE__*/_jsx(Button, {
|
|
108
79
|
type: "link",
|
|
@@ -118,13 +89,13 @@ function HeadComponent(_ref) {
|
|
|
118
89
|
type: "primary",
|
|
119
90
|
htmlType: "submit",
|
|
120
91
|
children: "\u67E5\u8BE2"
|
|
121
|
-
})]
|
|
92
|
+
}), toolbar ? null : tableOperation]
|
|
122
93
|
});
|
|
123
94
|
var renderFormItems = function renderFormItems() {
|
|
124
|
-
return allFormItems.map(function (item
|
|
95
|
+
return allFormItems.map(function (item) {
|
|
125
96
|
if (item.depends || item.showDepends) {
|
|
126
|
-
return /*#__PURE__*/
|
|
127
|
-
children:
|
|
97
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
98
|
+
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
128
99
|
noStyle: true,
|
|
129
100
|
shouldUpdate: function shouldUpdate(l, n) {
|
|
130
101
|
var _item$depends, _item$showDepends;
|
|
@@ -150,41 +121,35 @@ function HeadComponent(_ref) {
|
|
|
150
121
|
});
|
|
151
122
|
}
|
|
152
123
|
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, {
|
|
153
|
-
index: index,
|
|
154
124
|
name: item.name,
|
|
155
125
|
label: item.label,
|
|
156
126
|
rules: item.rules,
|
|
157
127
|
value: item.value,
|
|
158
128
|
dependParam: dependParam,
|
|
159
|
-
onSetShowNum: onSetShowNum,
|
|
160
|
-
formItemsRef: formItemsRef,
|
|
161
129
|
formItemLabelWidth: formItemLabelWidth
|
|
162
130
|
});
|
|
163
131
|
if (!isShow) return null;
|
|
164
132
|
return itemContent;
|
|
165
133
|
}
|
|
166
|
-
})
|
|
134
|
+
})
|
|
167
135
|
}, item.name);
|
|
168
136
|
}
|
|
169
137
|
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, {
|
|
170
|
-
index: index,
|
|
171
138
|
name: item.name,
|
|
172
139
|
value: item.value,
|
|
173
140
|
rules: item.rules,
|
|
174
141
|
label: item.label,
|
|
175
|
-
onSetShowNum: onSetShowNum,
|
|
176
|
-
formItemsRef: formItemsRef,
|
|
177
142
|
formItemLabelWidth: formItemLabelWidth
|
|
178
143
|
});
|
|
179
|
-
return /*#__PURE__*/
|
|
180
|
-
children:
|
|
144
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
145
|
+
children: itemContent
|
|
181
146
|
}, item.name);
|
|
182
147
|
});
|
|
183
148
|
};
|
|
184
149
|
|
|
185
150
|
// 尺寸变化重设尺寸
|
|
186
151
|
var resizeFn = _debounce(function () {
|
|
187
|
-
|
|
152
|
+
update({});
|
|
188
153
|
}, 500);
|
|
189
154
|
|
|
190
155
|
// 监听dom尺寸变化
|
|
@@ -195,16 +160,12 @@ function HeadComponent(_ref) {
|
|
|
195
160
|
// table是否有边框
|
|
196
161
|
var hasBorder = titleBordered === true;
|
|
197
162
|
var formStyles = {
|
|
198
|
-
|
|
163
|
+
flexWrap: isExpand ? 'wrap' : 'nowrap'
|
|
199
164
|
};
|
|
200
|
-
// 单行条件右对齐
|
|
201
|
-
if (!isExpand && (hasMore || formItemsRef.current.length - 1 === showNum)) {
|
|
202
|
-
formStyles.justifyContent = 'flex-end';
|
|
203
|
-
}
|
|
204
165
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
166
|
children: [hasItem && /*#__PURE__*/_jsxs(_Fragment, {
|
|
206
167
|
children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
|
|
207
|
-
targetRef:
|
|
168
|
+
targetRef: formItemsRef,
|
|
208
169
|
onResize: onResize
|
|
209
170
|
}), /*#__PURE__*/_jsx(Card, {
|
|
210
171
|
className: "ccs-pl-adaptation",
|
|
@@ -216,23 +177,35 @@ function HeadComponent(_ref) {
|
|
|
216
177
|
} : {}),
|
|
217
178
|
styles: {
|
|
218
179
|
body: {
|
|
219
|
-
padding: 16
|
|
220
|
-
height: hasMore && !isExpand ? 64 : 'auto'
|
|
180
|
+
padding: 16
|
|
221
181
|
}
|
|
222
182
|
},
|
|
223
183
|
bordered: hasBorder,
|
|
224
184
|
title: title,
|
|
225
|
-
ref: cardRef,
|
|
226
185
|
children: /*#__PURE__*/_jsxs(Form, {
|
|
227
186
|
initialValues: formInitValues,
|
|
228
187
|
form: form,
|
|
229
188
|
onFinish: onSearch,
|
|
230
189
|
layout: "inline",
|
|
231
190
|
style: formStyles,
|
|
232
|
-
children: [
|
|
191
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
192
|
+
style: {
|
|
193
|
+
justifyContent: isExpand && hasMore ? 'flex-start' : 'flex-end',
|
|
194
|
+
height: isExpand ? 'auto' : 32
|
|
195
|
+
},
|
|
196
|
+
className: "ccs-pl-adaptation-form",
|
|
197
|
+
ref: formItemsRef,
|
|
198
|
+
children: [renderFormItems(), isExpand && renderSearchBtn]
|
|
199
|
+
}), !isExpand && /*#__PURE__*/_jsx("div", {
|
|
200
|
+
style: {
|
|
201
|
+
flex: '0 0 auto',
|
|
202
|
+
paddingLeft: 10
|
|
203
|
+
},
|
|
204
|
+
children: renderSearchBtn
|
|
205
|
+
})]
|
|
233
206
|
})
|
|
234
207
|
})]
|
|
235
|
-
}), /*#__PURE__*/_jsxs(Card, {
|
|
208
|
+
}), toolbar && /*#__PURE__*/_jsxs(Card, {
|
|
236
209
|
styles: {
|
|
237
210
|
cover: {
|
|
238
211
|
borderRadius: 0
|
package/es/pro-table/index.less
CHANGED
package/es/pro-table/table.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type TableTitleType<T> = {
|
|
|
28
28
|
export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
|
|
29
29
|
data?: CCS.TableData<T>;
|
|
30
30
|
/** request 方法 */
|
|
31
|
-
request?: (params: any) =>
|
|
31
|
+
request?: (params: any) => Promise<HttpPageResult<T>>;
|
|
32
32
|
/** request 额外参数 */
|
|
33
33
|
requestParam?: ParamType;
|
|
34
34
|
/** class name */
|
|
@@ -41,7 +41,7 @@ export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
|
|
|
41
41
|
title?: ({ selectedRows, data, onClear }: TableTitleType<T>) => ReactNode;
|
|
42
42
|
};
|
|
43
43
|
type FormLayout = 'horizontal' | 'inline' | 'vertical' | 'adaptation';
|
|
44
|
-
export type CcsProTableProps<
|
|
44
|
+
export type CcsProTableProps<RecordType> = {
|
|
45
45
|
/** api权限标识 */
|
|
46
46
|
auth?: string | 'ignore';
|
|
47
47
|
/** 是否初始查询,默认true */
|
|
@@ -65,7 +65,7 @@ export type CcsProTableProps<T> = {
|
|
|
65
65
|
/** 展开查询条件,默认false */
|
|
66
66
|
expandForm?: boolean;
|
|
67
67
|
/** table 数据区域 */
|
|
68
|
-
table?: CcsTableProps<
|
|
68
|
+
table?: CcsTableProps<RecordType>;
|
|
69
69
|
/** table style */
|
|
70
70
|
tableStyle?: CSSProperties;
|
|
71
71
|
/** 父级值字段 */
|
|
@@ -73,7 +73,7 @@ export type CcsProTableProps<T> = {
|
|
|
73
73
|
/** 水印文字 */
|
|
74
74
|
watermark?: string;
|
|
75
75
|
/** ref 回调方法 */
|
|
76
|
-
proRef?: CCS.TableInstanceRef<
|
|
76
|
+
proRef?: CCS.TableInstanceRef<RecordType>;
|
|
77
77
|
/** 显示序号 */
|
|
78
78
|
showNumber?: boolean;
|
|
79
79
|
/** class */
|
|
@@ -87,7 +87,7 @@ export type CcsProTableProps<T> = {
|
|
|
87
87
|
/** 请求前格式化参数 */
|
|
88
88
|
onSearchBefore?: (params: SearchBeforeType, eventType?: SearchEventType) => SearchBeforeType;
|
|
89
89
|
/** 请求后格式化结果 */
|
|
90
|
-
onSearchAfter?: (data: HttpPageResult<
|
|
90
|
+
onSearchAfter?: (data: HttpPageResult<RecordType>, eventType?: SearchEventType) => any;
|
|
91
91
|
};
|
|
92
92
|
export type TableEventType = {
|
|
93
93
|
key: 'columnFilter' | 'fullScreen';
|
|
@@ -107,5 +107,5 @@ export declare const TableSelectionContext: React.Context<{
|
|
|
107
107
|
* @param ref
|
|
108
108
|
* @returns
|
|
109
109
|
*/
|
|
110
|
-
declare const InternalProTable: <
|
|
110
|
+
declare const InternalProTable: <RecordType extends object = any>(props: CcsProTableProps<RecordType>) => import("react/jsx-runtime").JSX.Element;
|
|
111
111
|
export default InternalProTable;
|
package/es/pro-table/table.js
CHANGED
|
@@ -494,7 +494,7 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
494
494
|
} : undefined
|
|
495
495
|
}));
|
|
496
496
|
};
|
|
497
|
-
var newToolbar = /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
|
|
497
|
+
var newToolbar = toolbar && /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
|
|
498
498
|
value: {
|
|
499
499
|
selectedRows: selectedRows
|
|
500
500
|
},
|