@ccs-ui/rc-pro 1.1.25-beta-11 → 1.1.25-beta-12
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/pro-table/form-item.js +12 -5
- package/es/pro-table/head.js +6 -6
- package/es/pro-table/size.d.ts +10 -0
- package/es/pro-table/size.js +17 -0
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Form } from 'antd';
|
|
2
|
-
import ResizeObserver from 'rc-resize-observer';
|
|
3
2
|
import { cloneElement, useEffect, useRef } from 'react';
|
|
3
|
+
import ResizeDom from "./size";
|
|
4
4
|
import { classPrefix } from "./table";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
8
|
export default function HeadFormItem(_ref) {
|
|
7
9
|
var label = _ref.label,
|
|
8
10
|
name = _ref.name,
|
|
@@ -44,10 +46,15 @@ export default function HeadFormItem(_ref) {
|
|
|
44
46
|
onSetShowNum();
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
|
-
return /*#__PURE__*/
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
50
|
+
children: [/*#__PURE__*/_jsx(ResizeDom, {
|
|
51
|
+
targetRef: ref,
|
|
52
|
+
onResize: onResize
|
|
53
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
50
54
|
ref: ref,
|
|
55
|
+
style: {
|
|
56
|
+
paddingRight: 10
|
|
57
|
+
},
|
|
51
58
|
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
52
59
|
name: name,
|
|
53
60
|
rules: rules,
|
|
@@ -60,6 +67,6 @@ export default function HeadFormItem(_ref) {
|
|
|
60
67
|
}) : label,
|
|
61
68
|
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
62
69
|
})
|
|
63
|
-
})
|
|
70
|
+
})]
|
|
64
71
|
});
|
|
65
72
|
}
|
package/es/pro-table/head.js
CHANGED
|
@@ -14,10 +14,10 @@ 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 ResizeObserver from 'rc-resize-observer';
|
|
18
17
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
19
18
|
import { getShowDpends } from "./_utils";
|
|
20
19
|
import HeadFormItem from "./form-item";
|
|
20
|
+
import ResizeDom from "./size";
|
|
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";
|
|
@@ -198,7 +198,7 @@ function HeadComponent(_ref) {
|
|
|
198
198
|
// table是否有边框
|
|
199
199
|
var hasBorder = titleBordered === true;
|
|
200
200
|
var formStyles = {
|
|
201
|
-
gap:
|
|
201
|
+
gap: '16px 0'
|
|
202
202
|
};
|
|
203
203
|
// 单行条件右对齐
|
|
204
204
|
if (!isExpand && (hasMore || formItemsRef.current.length - 1 === showNum)) {
|
|
@@ -206,9 +206,9 @@ function HeadComponent(_ref) {
|
|
|
206
206
|
}
|
|
207
207
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
208
208
|
children: [hasItem && /*#__PURE__*/_jsxs(_Fragment, {
|
|
209
|
-
children: [/*#__PURE__*/_jsx(
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
children: [/*#__PURE__*/_jsx(ResizeDom, {
|
|
210
|
+
targetRef: cardRef,
|
|
211
|
+
onResize: onResize
|
|
212
212
|
}), /*#__PURE__*/_jsx(Card, {
|
|
213
213
|
className: "ccs-pl-adaptation",
|
|
214
214
|
style: _objectSpread({
|
|
@@ -220,7 +220,7 @@ function HeadComponent(_ref) {
|
|
|
220
220
|
styles: {
|
|
221
221
|
body: {
|
|
222
222
|
padding: 16,
|
|
223
|
-
height: isExpand ? 'auto'
|
|
223
|
+
height: hasMore && !isExpand ? 64 : 'auto'
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
bordered: hasBorder,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useSize } from 'ahooks';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
export default function ResizeDom(_ref) {
|
|
4
|
+
var targetRef = _ref.targetRef,
|
|
5
|
+
onResize = _ref.onResize;
|
|
6
|
+
var sizeRef = useRef();
|
|
7
|
+
var size = useSize(targetRef);
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
if (size) {
|
|
10
|
+
if (sizeRef.current) {
|
|
11
|
+
onResize(size);
|
|
12
|
+
}
|
|
13
|
+
sizeRef.current = size;
|
|
14
|
+
}
|
|
15
|
+
}, [size === null || size === void 0 ? void 0 : size.height, size === null || size === void 0 ? void 0 : size.width]);
|
|
16
|
+
return null;
|
|
17
|
+
}
|