@ccs-ui/rc-pro 1.1.22-beta-3 → 1.1.22-beta-5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ButtonProps, MenuProps, ThemeConfig } from 'antd';
2
2
  import { Rule } from 'antd/es/form';
3
- import { ColumnGroupType, ColumnType } from 'antd/es/table';
4
3
  import { MutableRefObject, ReactElement, ReactNode } from 'react';
4
+ import { TableColumn } from './pro-table/table';
5
5
  type MenuTreeNodeData = {
6
6
  buttonUrlId: number;
7
7
  createTime: string;
@@ -203,7 +203,5 @@ type GlobalConfig = {
203
203
  };
204
204
  type TableFormItems = TableFormItem[];
205
205
  type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
206
- type TableColumns<RecordType = any> = ((ColumnGroupType<RecordType> | ColumnType<RecordType>) & {
207
- hidden?: boolean;
208
- })[];
206
+ type TableColumns<RecordType = any> = TableColumn<RecordType>[];
209
207
  export type { PageType, RecordType, MenuTreeNode, PageQuery, ListQuery, HttpResult, GlobalConfig, HttpListResult, HttpPageResult, AuthButtonItem, MenuTreeNodeData, UserDetail, RouteHistory, TableData, TableFormItems, TableColumns, TableInstance, TableInstanceRef, TriggerChildrenProps, };
@@ -83,11 +83,12 @@ function SearchComponent(_ref) {
83
83
  _useState4 = _slicedToArray(_useState3, 2),
84
84
  filterColumns = _useState4[0],
85
85
  setFilterColumns = _useState4[1];
86
- var _useState5 = useState(expandForm),
86
+ var _useState5 = useState(false),
87
87
  _useState6 = _slicedToArray(_useState5, 2),
88
88
  isShowMore = _useState6[0],
89
89
  setIsShowMore = _useState6[1];
90
90
  var ref = useRef(null);
91
+ console.log('isShowMore', isShowMore);
91
92
  var onHasMore = function onHasMore() {
92
93
  var hasMain = formItems.filter(function (f) {
93
94
  return f.isMain;
@@ -224,7 +225,8 @@ function SearchComponent(_ref) {
224
225
  className: "".concat(classPrefix, "-header-buttons"),
225
226
  children: [onHasMore() && !expandForm && /*#__PURE__*/_jsx(Button, {
226
227
  onClick: function onClick() {
227
- return setIsShowMore(!isShowMore);
228
+ console.log(123);
229
+ setIsShowMore(!isShowMore);
228
230
  },
229
231
  icon: isShowMore ? /*#__PURE__*/_jsx(UpOutlined, {
230
232
  className: "".concat(classPrefix, "-icon")
@@ -408,14 +410,19 @@ function SearchComponent(_ref) {
408
410
  children: itemContent
409
411
  }, item.name);
410
412
  });
413
+ var style = {
414
+ overflow: 'hidden'
415
+ };
416
+ if (isShowMore || expandForm) {
417
+ style.marginBottom = 10;
418
+ } else {
419
+ style.maxHeight = 0;
420
+ style.marginBottom = 0;
421
+ }
411
422
  return /*#__PURE__*/_jsx("div", {
412
423
  className: "".concat(classPrefix, "-high-form"),
413
424
  ref: ref,
414
- style: {
415
- maxHeight: isShowMore ? 500 : 0,
416
- overflow: 'hidden',
417
- marginBottom: isShowMore ? 10 : 0
418
- },
425
+ style: style,
419
426
  children: /*#__PURE__*/_jsx(Form, {
420
427
  initialValues: formInitValues,
421
428
  form: form,
@@ -1,8 +1,9 @@
1
1
  import { ColProps, TableProps } from 'antd';
2
2
  import { FormLayout } from 'antd/es/form/Form';
3
+ import { ColumnGroupType, ColumnType } from 'antd/es/table';
3
4
  import { CSSProperties, ReactElement, ReactNode } from 'react';
4
5
  import CCS from '..';
5
- import { HttpPageResult } from '../ccs';
6
+ import { HttpPageResult, TableColumns } from '../ccs';
6
7
  import './index.less';
7
8
  type ParamType = Record<string, any>;
8
9
  export type ShowDependType = {
@@ -13,7 +14,13 @@ export type SearchEventType = 'search' | 'reset' | 'reload' | 'changePage' | 'in
13
14
  type SearchBeforeType = ParamType & {
14
15
  query: ParamType;
15
16
  };
16
- export type CcsTableProps<T> = TableProps<T> & {
17
+ export type TableColumn<RecordType = any> = (Omit<ColumnGroupType<RecordType>, 'ellipsis'> | Omit<ColumnType<RecordType>, 'ellipsis'>) & {
18
+ /** 隐藏列 */
19
+ hidden?: boolean;
20
+ /** 省略显示行数,最大支持10行 */
21
+ ellipsis?: boolean | number;
22
+ };
23
+ export type CcsTableProps<T> = Omit<TableProps<T>, 'columns'> & {
17
24
  data?: CCS.TableData<T>;
18
25
  /** request 方法 */
19
26
  request?: (params: any) => void;
@@ -25,6 +32,8 @@ export type CcsTableProps<T> = TableProps<T> & {
25
32
  event$?: any;
26
33
  /** style */
27
34
  style?: CSSProperties;
35
+ /** 列配置 */
36
+ columns?: TableColumns<T>;
28
37
  };
29
38
  export type CcsProTableProps<T> = {
30
39
  /** api权限标识 */
package/es/table/index.js CHANGED
@@ -139,16 +139,19 @@ var CustomTable = function CustomTable(props) {
139
139
  });
140
140
  cls === null || cls === void 0 ? void 0 : cls.forEach(function (c) {
141
141
  if (c.ellipsis && !c.render) {
142
- var sc = c;
143
- sc.ellipsis = {
144
- showTitle: false
145
- };
146
- sc.render = function (e) {
142
+ var isMultiRow = typeof c.ellipsis === 'number' && c.ellipsis > 1;
143
+ var ellipsis = c.ellipsis;
144
+ c.ellipsis = !isMultiRow;
145
+ c.render = function (e) {
147
146
  return /*#__PURE__*/_jsx(Tooltip, {
148
147
  zIndex: 2020,
149
148
  title: e,
150
149
  placement: "bottomLeft",
151
150
  destroyTooltipOnHide: true,
151
+ className: classNames(_defineProperty({}, "ccs-table-cell-ellipsis-multi lineclamp".concat(ellipsis), isMultiRow)),
152
+ overlayInnerStyle: {
153
+ whiteSpace: 'normal'
154
+ },
152
155
  children: e
153
156
  });
154
157
  };
@@ -104,6 +104,48 @@
104
104
  }
105
105
  }
106
106
 
107
+ &-cell-ellipsis {
108
+ overflow: hidden;
109
+ text-overflow: ellipsis;
110
+ white-space: nowrap;
111
+ }
112
+
113
+ &-cell-ellipsis-multi {
114
+ overflow: hidden;
115
+ text-overflow: ellipsis;
116
+ display: -webkit-box;
117
+ -webkit-box-orient: vertical;
118
+ white-space: normal;
119
+ }
120
+
121
+ &-cell-ellipsis-multi.lineclamp2 {
122
+ -webkit-line-clamp: 2;
123
+ }
124
+ &-cell-ellipsis-multi.lineclamp3 {
125
+ -webkit-line-clamp: 3;
126
+ }
127
+ &-cell-ellipsis-multi.lineclamp4 {
128
+ -webkit-line-clamp: 4;
129
+ }
130
+ &-cell-ellipsis-multi.lineclamp5 {
131
+ -webkit-line-clamp: 5;
132
+ }
133
+ &-cell-ellipsis-multi.lineclamp6 {
134
+ -webkit-line-clamp: 6;
135
+ }
136
+ &-cell-ellipsis-multi.lineclamp7 {
137
+ -webkit-line-clamp: 7;
138
+ }
139
+ &-cell-ellipsis-multi.lineclamp8 {
140
+ -webkit-line-clamp: 8;
141
+ }
142
+ &-cell-ellipsis-multi.lineclamp9 {
143
+ -webkit-line-clamp: 9;
144
+ }
145
+ &-cell-ellipsis-multi.lineclamp10 {
146
+ -webkit-line-clamp: 10;
147
+ }
148
+
107
149
  &-nodata {
108
150
  color: red;
109
151
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.22-beta-3",
4
- "description": "CcsDatePicker.RangePicker参数bug;CcsProTable删除disableCollapseForm参数;CcsProTable添加formItemLayout,formItemCol参数适应自定义布局",
3
+ "version": "1.1.22-beta-5",
4
+ "description": "CcsDatePicker.RangePicker参数bug;CcsProTable删除disableCollapseForm参数;CcsProTable添加formItemLayout,formItemCol参数适应自定义布局;table column支持多行省略显示",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Hong",