@ccs-ui/rc-pro 1.1.17 → 1.1.19-beta-1
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/dialog/HookModal.d.ts +1 -1
- package/es/keep-alive-tabs/index.less +1 -0
- package/es/pro-grid/index.d.ts +4 -5
- package/es/pro-grid/index.js +41 -38
- package/es/pro-grid/index.less +0 -5
- package/es/table/index.js +57 -8
- package/es/table/index.less +11 -10
- package/package.json +9 -2
package/es/dialog/HookModal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { FormProps } from 'antd';
|
|
3
3
|
import { DialogFormRef } from './form';
|
|
4
4
|
import { CcsDialogModal, CcsDialogModalProps } from './hook';
|
|
5
|
-
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "
|
|
5
|
+
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onRequestBefore" | "onCancel"> & {
|
|
6
6
|
formRef: React.RefObject<DialogFormRef>;
|
|
7
7
|
formInitialValues: FormProps['initialValues'];
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/pro-grid/index.d.ts
CHANGED
|
@@ -6,17 +6,16 @@ type ClassProps = {
|
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
};
|
|
8
8
|
type CcsProGridProps = ClassProps & {
|
|
9
|
-
|
|
9
|
+
gutter?: number;
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
};
|
|
12
12
|
type ColProps = CardProps & {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
colClassName?: string;
|
|
13
|
+
colWidth?: number;
|
|
14
|
+
children?: ReactNode;
|
|
16
15
|
};
|
|
17
16
|
type GridInstance = FC<CcsProGridProps> & {
|
|
18
17
|
Col: typeof GridCol;
|
|
19
18
|
};
|
|
20
|
-
declare const GridCol: ({
|
|
19
|
+
declare const GridCol: ({ children, colWidth, style, className, ...restProps }: ColProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
declare const ProGrid: GridInstance;
|
|
22
21
|
export default ProGrid;
|
package/es/pro-grid/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
var _excluded = ["
|
|
3
|
-
_excluded2 = ["
|
|
2
|
+
var _excluded = ["children", "colWidth", "style", "className"],
|
|
3
|
+
_excluded2 = ["children", "gutter"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
@@ -8,48 +8,51 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
8
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
-
import
|
|
12
|
-
import classNames from 'classnames';
|
|
11
|
+
import React from 'react';
|
|
13
12
|
import "./index.less";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
15
|
var GridCol = function GridCol(_ref) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
colWidth = _ref.colWidth,
|
|
18
|
+
style = _ref.style,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
console.log('restProps', restProps);
|
|
22
|
+
var styles = _objectSpread({}, style);
|
|
23
|
+
if (colWidth) {
|
|
24
|
+
styles.width = colWidth;
|
|
25
|
+
styles.flex = "0 0 ".concat(colWidth, "px");
|
|
26
|
+
} else {
|
|
27
|
+
styles.flex = "1 1 auto";
|
|
28
|
+
}
|
|
29
|
+
var _ref2 = restProps,
|
|
30
|
+
gutter = _ref2.gutter;
|
|
31
|
+
if (gutter) {
|
|
32
|
+
styles.marginLeft = gutter;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/_jsx("div", {
|
|
35
|
+
style: styles,
|
|
36
|
+
className: className,
|
|
37
|
+
children: children
|
|
39
38
|
});
|
|
40
39
|
};
|
|
41
|
-
var Grid = function Grid(
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
restProps = _objectWithoutProperties(
|
|
45
|
-
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
46
|
-
|
|
47
|
-
'
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
var Grid = function Grid(_ref3) {
|
|
41
|
+
var children = _ref3.children,
|
|
42
|
+
gutter = _ref3.gutter,
|
|
43
|
+
restProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
44
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
45
|
+
style: {
|
|
46
|
+
display: 'flex'
|
|
47
|
+
}
|
|
48
|
+
}, restProps), {}, {
|
|
49
|
+
children: gutter ? React.Children.map(children, function (child, index) {
|
|
50
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
51
|
+
children: /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.cloneElement(child, {
|
|
52
|
+
gutter: index !== 0 ? gutter : 0
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}) : children
|
|
53
56
|
}));
|
|
54
57
|
};
|
|
55
58
|
var ProGrid = Grid;
|
package/es/pro-grid/index.less
CHANGED
package/es/table/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
var _excluded = ["
|
|
2
|
+
var _excluded = ["onResize", "width"],
|
|
3
|
+
_excluded2 = ["data", "style", "scroll", "event$", "rowKey", "columns", "pagination", "rowSelection", "className"];
|
|
3
4
|
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; }
|
|
4
5
|
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; }
|
|
5
6
|
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; }
|
|
@@ -11,6 +12,7 @@ import { useDebounceFn, useEventListener, useUpdate, useUpdateEffect } from 'aho
|
|
|
11
12
|
import { Table, Tooltip, theme } from 'antd';
|
|
12
13
|
import classNames from 'classnames';
|
|
13
14
|
import { useRef } from 'react';
|
|
15
|
+
import { Resizable } from 'react-resizable';
|
|
14
16
|
import "./index.less";
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
18
|
var DEFAULT_PAGE = {
|
|
@@ -19,6 +21,29 @@ var DEFAULT_PAGE = {
|
|
|
19
21
|
pageSize: 10,
|
|
20
22
|
pageNo: 1
|
|
21
23
|
};
|
|
24
|
+
var ResizableTitle = function ResizableTitle(props) {
|
|
25
|
+
var onResize = props.onResize,
|
|
26
|
+
width = props.width,
|
|
27
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
28
|
+
if (!width) {
|
|
29
|
+
return /*#__PURE__*/_jsx("th", _objectSpread({}, restProps));
|
|
30
|
+
}
|
|
31
|
+
return /*#__PURE__*/_jsx(Resizable, {
|
|
32
|
+
width: width,
|
|
33
|
+
height: 0,
|
|
34
|
+
handle: /*#__PURE__*/_jsx("span", {
|
|
35
|
+
className: "react-resizable-handle",
|
|
36
|
+
onClick: function onClick(e) {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
onResize: onResize,
|
|
41
|
+
draggableOpts: {
|
|
42
|
+
enableUserSelectHack: false
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/_jsx("th", _objectSpread({}, restProps))
|
|
45
|
+
});
|
|
46
|
+
};
|
|
22
47
|
var CustomTable = function CustomTable(props) {
|
|
23
48
|
var data = props.data,
|
|
24
49
|
style = props.style,
|
|
@@ -30,7 +55,7 @@ var CustomTable = function CustomTable(props) {
|
|
|
30
55
|
rowSelection = props.rowSelection,
|
|
31
56
|
_props$className = props.className,
|
|
32
57
|
className = _props$className === void 0 ? '' : _props$className,
|
|
33
|
-
restProps = _objectWithoutProperties(props,
|
|
58
|
+
restProps = _objectWithoutProperties(props, _excluded2);
|
|
34
59
|
|
|
35
60
|
// 固定表头获取table可视高度
|
|
36
61
|
var ref = useRef(null);
|
|
@@ -95,6 +120,18 @@ var CustomTable = function CustomTable(props) {
|
|
|
95
120
|
}
|
|
96
121
|
});
|
|
97
122
|
|
|
123
|
+
// 改变列宽
|
|
124
|
+
var onResize = function onResize(dataIndex) {
|
|
125
|
+
return function (_, _ref3) {
|
|
126
|
+
var size = _ref3.size;
|
|
127
|
+
var column = columns === null || columns === void 0 ? void 0 : columns.find(function (c) {
|
|
128
|
+
return c.dataIndex === dataIndex;
|
|
129
|
+
});
|
|
130
|
+
column.width = size.width;
|
|
131
|
+
update();
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
98
135
|
// 列过滤
|
|
99
136
|
var filterColumns = function filterColumns() {
|
|
100
137
|
var cls = columns === null || columns === void 0 ? void 0 : columns.filter(function (t) {
|
|
@@ -116,6 +153,13 @@ var CustomTable = function CustomTable(props) {
|
|
|
116
153
|
});
|
|
117
154
|
};
|
|
118
155
|
}
|
|
156
|
+
// 拖拽头部改变列宽响应
|
|
157
|
+
c.onHeaderCell = function (column) {
|
|
158
|
+
return {
|
|
159
|
+
width: column.width,
|
|
160
|
+
onResize: onResize(c.dataIndex)
|
|
161
|
+
};
|
|
162
|
+
};
|
|
119
163
|
});
|
|
120
164
|
return cls;
|
|
121
165
|
};
|
|
@@ -128,10 +172,10 @@ var CustomTable = function CustomTable(props) {
|
|
|
128
172
|
}),
|
|
129
173
|
children: /*#__PURE__*/_jsx("div", {
|
|
130
174
|
ref: ref,
|
|
131
|
-
children: /*#__PURE__*/_jsx(Table, _objectSpread(
|
|
175
|
+
children: /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
|
|
132
176
|
rowKey: rowKey,
|
|
133
177
|
dataSource: result,
|
|
134
|
-
pagination: pagination
|
|
178
|
+
pagination: pagination !== null && pagination !== void 0 ? pagination : _objectSpread({
|
|
135
179
|
total: totalNum,
|
|
136
180
|
pageSize: pageSize,
|
|
137
181
|
current: pageNo,
|
|
@@ -143,16 +187,21 @@ var CustomTable = function CustomTable(props) {
|
|
|
143
187
|
pageSizeOptions: ['10', '20', '30', '50', '100'],
|
|
144
188
|
size: restProps.size === 'small' ? 'small' : 'default',
|
|
145
189
|
simple: restProps.size === 'small'
|
|
146
|
-
}, pagination),
|
|
190
|
+
}, pagination || {}),
|
|
147
191
|
rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
|
|
148
192
|
columnWidth: 60
|
|
149
193
|
}) : undefined,
|
|
150
194
|
columns: filterColumns()
|
|
151
195
|
}, restProps), {}, {
|
|
152
196
|
size: restProps.size || 'middle',
|
|
153
|
-
className: classNames(
|
|
154
|
-
scroll: scroll
|
|
155
|
-
|
|
197
|
+
className: classNames(!totalNum ? 'ccs-table-nodata' : '', className),
|
|
198
|
+
scroll: scroll,
|
|
199
|
+
components: {
|
|
200
|
+
header: {
|
|
201
|
+
cell: ResizableTitle
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}))
|
|
156
205
|
})
|
|
157
206
|
});
|
|
158
207
|
};
|
package/es/table/index.less
CHANGED
|
@@ -87,19 +87,20 @@
|
|
|
87
87
|
.ant-table-sticky-holder {
|
|
88
88
|
z-index: 100;
|
|
89
89
|
}
|
|
90
|
-
}
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
padding-left: 22px;
|
|
96
|
-
}
|
|
91
|
+
.react-resizable {
|
|
92
|
+
position: relative;
|
|
93
|
+
background-clip: padding-box;
|
|
97
94
|
}
|
|
98
95
|
|
|
99
|
-
.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
.react-resizable-handle {
|
|
97
|
+
position: absolute;
|
|
98
|
+
right: -5px;
|
|
99
|
+
bottom: 0;
|
|
100
|
+
z-index: 1;
|
|
101
|
+
width: 15px;
|
|
102
|
+
height: 100%;
|
|
103
|
+
cursor: col-resize;
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.19-beta-1",
|
|
4
|
+
"description": " ProGrid 调整",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Hong",
|
|
8
|
+
"url": "https://xz7.gitee.io/rc-pro"
|
|
9
|
+
},
|
|
6
10
|
"module": "es/index.js",
|
|
7
11
|
"types": "es/index.d.ts",
|
|
8
12
|
"files": [
|
|
@@ -64,6 +68,7 @@
|
|
|
64
68
|
"react-color": "^2.19.3",
|
|
65
69
|
"react-custom-scrollbars": "^4.2.1",
|
|
66
70
|
"react-draggable": "^4.4.5",
|
|
71
|
+
"react-resizable": "^3.0.5",
|
|
67
72
|
"react-router": "^6.11.2",
|
|
68
73
|
"react-router-dom": "^6.11.2",
|
|
69
74
|
"shortid": "^2.2.16"
|
|
@@ -76,7 +81,9 @@
|
|
|
76
81
|
"@types/react-color": "^3.0.6",
|
|
77
82
|
"@types/react-custom-scrollbars": "^4.0.10",
|
|
78
83
|
"@types/react-dom": "^18.0.0",
|
|
84
|
+
"@types/react-resizable": "^3.0.7",
|
|
79
85
|
"@types/shortid": "^0.0.29",
|
|
86
|
+
"@types/throttle-debounce": "^5.0.2",
|
|
80
87
|
"@umijs/lint": "^4.0.0",
|
|
81
88
|
"cross-env": "^7.0.3",
|
|
82
89
|
"dumi": "^2.2.0",
|