@ccs-ui/rc-pro 2.3.6-beta-1 → 2.3.6-beta-3
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/context/index.d.ts +2 -0
- package/es/dialog/button.d.ts +1 -1
- package/es/pro-table/head.d.ts +4 -1
- package/es/pro-table/head.js +3 -1
- package/es/pro-table/table.js +17 -6
- package/es/pro-tabs/index.js +10 -4
- package/es/table/index.js +10 -0
- package/es/table/index.less +17 -0
- package/package.json +1 -1
package/es/context/index.d.ts
CHANGED
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>, "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onClose" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
package/es/pro-table/head.d.ts
CHANGED
|
@@ -8,8 +8,11 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
|
|
|
8
8
|
form: FormInstance<any>;
|
|
9
9
|
/** table 操作栏 */
|
|
10
10
|
tableOperation: ReactElement;
|
|
11
|
+
/** 查询 */
|
|
11
12
|
onSearch: () => void;
|
|
13
|
+
/** header 高度改变 */
|
|
14
|
+
onHeaderResize: () => void;
|
|
12
15
|
};
|
|
13
16
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
14
|
-
declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, onHeaderResize, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
export default HeadComponent;
|
package/es/pro-table/head.js
CHANGED
|
@@ -28,7 +28,8 @@ function HeadComponent(_ref) {
|
|
|
28
28
|
formInitValues = _ref.formInitValues,
|
|
29
29
|
formItemLabelWidth = _ref.formItemLabelWidth,
|
|
30
30
|
tableOperation = _ref.tableOperation,
|
|
31
|
-
onSearch = _ref.onSearch
|
|
31
|
+
onSearch = _ref.onSearch,
|
|
32
|
+
onHeaderResize = _ref.onHeaderResize;
|
|
32
33
|
var formItemsRef = useRef(null);
|
|
33
34
|
// 查询条件是否展开
|
|
34
35
|
var _useState = useState(expandForm),
|
|
@@ -61,6 +62,7 @@ function HeadComponent(_ref) {
|
|
|
61
62
|
// 尺寸变化重设尺寸
|
|
62
63
|
var resizeFn = _debounce(function (hm) {
|
|
63
64
|
setVisible(hm);
|
|
65
|
+
onHeaderResize();
|
|
64
66
|
}, 500);
|
|
65
67
|
|
|
66
68
|
// 监听dom尺寸变化
|
package/es/pro-table/table.js
CHANGED
|
@@ -416,14 +416,21 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
416
416
|
if (sorter) {
|
|
417
417
|
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
418
418
|
if (c.sorter) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
419
|
+
if (Array.isArray(sorter)) {
|
|
420
|
+
// @ts-ignore
|
|
421
|
+
var curSorter = sorter.find(function (sort) {
|
|
422
|
+
return sort.field === c.dataIndex;
|
|
423
|
+
});
|
|
424
|
+
if (curSorter) c.sortOrder = curSorter === null || curSorter === void 0 ? void 0 : curSorter.order;
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
424
427
|
|
|
425
428
|
// @ts-ignore
|
|
426
|
-
|
|
429
|
+
if (sorter.field === c.dataIndex) {
|
|
430
|
+
c.sortOrder = sorter.order;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
c.sortOrder = undefined;
|
|
427
434
|
}
|
|
428
435
|
});
|
|
429
436
|
|
|
@@ -589,6 +596,10 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
589
596
|
formInitValues: formInitValues,
|
|
590
597
|
formItemLabelWidth: props.formItemLabelWidth,
|
|
591
598
|
onSearch: _onSearch,
|
|
599
|
+
onHeaderResize: function onHeaderResize() {
|
|
600
|
+
var _tableRef$current2;
|
|
601
|
+
return (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.onFixedThead();
|
|
602
|
+
},
|
|
592
603
|
title: props.title,
|
|
593
604
|
tableOperation: (table === null || table === void 0 ? void 0 : table.hideOperation) !== true ? /*#__PURE__*/_jsx(TableOperation, {
|
|
594
605
|
onChangeRowSize: function onChangeRowSize(e) {
|
package/es/pro-tabs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import CcsUtils from '@ccs-ui/utils';
|
|
7
8
|
import { useUpdateEffect } from 'ahooks';
|
|
8
9
|
import { theme as antTheme } from 'antd';
|
|
9
10
|
import update from 'immutability-helper';
|
|
@@ -19,16 +20,19 @@ export default (function (_ref) {
|
|
|
19
20
|
activeKey = _ref2.activeKey,
|
|
20
21
|
defaultActiveKey = _ref2.defaultActiveKey,
|
|
21
22
|
onChange = _ref2.onChange;
|
|
22
|
-
var _useState = useState(
|
|
23
|
+
var _useState = useState("ccs-tabs-".concat(CcsUtils.getUUID(5))),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
25
|
+
tabsId = _useState2[0];
|
|
26
|
+
var _useState3 = useState(function () {
|
|
23
27
|
return {
|
|
24
28
|
activeKey: defaultActiveKey || (items[0] || {}).key,
|
|
25
29
|
items: items || [],
|
|
26
30
|
options: {}
|
|
27
31
|
};
|
|
28
32
|
}),
|
|
29
|
-
|
|
30
|
-
tabsProps =
|
|
31
|
-
setTabsProps =
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
tabsProps = _useState4[0],
|
|
35
|
+
setTabsProps = _useState4[1];
|
|
32
36
|
|
|
33
37
|
// items 发生改变
|
|
34
38
|
useUpdateEffect(function () {
|
|
@@ -45,6 +49,7 @@ export default (function (_ref) {
|
|
|
45
49
|
var addOptions = {
|
|
46
50
|
items: tabsProps.items,
|
|
47
51
|
className: 'ccs-tabs',
|
|
52
|
+
id: tabsId,
|
|
48
53
|
tabBarStyle: {
|
|
49
54
|
margin: 0,
|
|
50
55
|
paddingLeft: 16,
|
|
@@ -153,6 +158,7 @@ export default (function (_ref) {
|
|
|
153
158
|
};
|
|
154
159
|
return children ? /*#__PURE__*/_jsx(TabsContext.Provider, {
|
|
155
160
|
value: {
|
|
161
|
+
tabsId: tabsId,
|
|
156
162
|
activeKey: tabsProps.activeKey,
|
|
157
163
|
options: tabsProps.options,
|
|
158
164
|
onTabChange: onHooksChange,
|
package/es/table/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Table, Tooltip, theme } from 'antd';
|
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useEffect, useImperativeHandle } from 'react';
|
|
15
15
|
import { Resizable } from 'react-resizable';
|
|
16
|
+
import useTabs from "../hooks/use-tabs";
|
|
16
17
|
import "./index.less";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
var ResizableTitle = function ResizableTitle(props) {
|
|
@@ -61,12 +62,21 @@ var CustomTable = function CustomTable(props) {
|
|
|
61
62
|
current = _ref$current === void 0 ? 1 : _ref$current,
|
|
62
63
|
_ref$total = _ref.total,
|
|
63
64
|
total = _ref$total === void 0 ? 0 : _ref$total;
|
|
65
|
+
var inTabs = useTabs();
|
|
64
66
|
|
|
65
67
|
// table 固定表头,内容滚动
|
|
66
68
|
var _useDebounceFn = useDebounceFn(function () {
|
|
67
69
|
if ((scroll === null || scroll === void 0 ? void 0 : scroll.y) === 'auto') {
|
|
68
70
|
var _tableContentRef$curr;
|
|
69
71
|
var tableTarget = tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current;
|
|
72
|
+
|
|
73
|
+
// 在ccs tabs组件内
|
|
74
|
+
if (inTabs !== null && inTabs !== void 0 && inTabs.tabsId) {
|
|
75
|
+
var tabsDom = document.getElementById(inTabs === null || inTabs === void 0 ? void 0 : inTabs.tabsId);
|
|
76
|
+
if (tabsDom) {
|
|
77
|
+
tabsDom.classList.add('ccs-tabs-auto-height');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
70
80
|
if (!tableTarget) return;
|
|
71
81
|
var tableBody = tableTarget.getElementsByClassName('ant-table-body')[0];
|
|
72
82
|
if (!tableBody) return;
|
package/es/table/index.less
CHANGED
|
@@ -171,3 +171,20 @@
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
.ccs-tabs-auto-height {
|
|
176
|
+
flex: 1 1 auto;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
> .ant-tabs-content-holder {
|
|
179
|
+
height: 100%;
|
|
180
|
+
> .ant-tabs-content {
|
|
181
|
+
height: 100%;
|
|
182
|
+
> div {
|
|
183
|
+
height: 100%;
|
|
184
|
+
> .ccs-pl {
|
|
185
|
+
height: 100%;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|