feffery_antd_components 0.1.2 → 0.1.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.
@@ -1,7 +1,7 @@
1
1
  import React, { Component, useContext, useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Table, Tooltip, Popover, Popconfirm, ConfigProvider, Typography, Input, Form, Tag, Button, Space, message } from 'antd';
4
- import { TinyLine, TinyArea, TinyColumn, Progress } from '@ant-design/charts';
3
+ import { Table, Tooltip, Popover, Popconfirm, ConfigProvider, Typography, Input, Form, Tag, Button, Badge, Space, message } from 'antd';
4
+ import { TinyLine, TinyArea, TinyColumn, Progress, RingProgress } from '@ant-design/charts';
5
5
  import Highlighter from 'react-highlight-words';
6
6
  import { SearchOutlined, QuestionCircleOutlined } from '@ant-design/icons';
7
7
  import { str2Locale } from './locales.react';
@@ -153,61 +153,6 @@ export default class AntdTable extends Component {
153
153
 
154
154
  render() {
155
155
 
156
- // 取得必要属性或参数
157
- let {
158
- id,
159
- className,
160
- style,
161
- locale,
162
- containerId,
163
- setProps,
164
- columns,
165
- rowSelectionType,
166
- titlePopoverInfo,
167
- columnsFormatConstraint,
168
- enableHoverListen,
169
- data,
170
- sortOptions,
171
- filterOptions,
172
- pagination,
173
- bordered,
174
- maxHeight,
175
- size,
176
- mode,
177
- nClicksButton,
178
- loading_state
179
- } = this.props;
180
-
181
- let size2size = new Map([
182
- ['small', 'default'],
183
- ['default', 'small'],
184
- ['large', 'middle']
185
- ])
186
-
187
- pagination = {
188
- ...pagination,
189
- ...{
190
- showTotalPrefix: pagination?.showTotalPrefix ? pagination?.showTotalPrefix : '共 ',
191
- showTotalSuffix: pagination?.showTotalSuffix ? pagination?.showTotalSuffix : ' 条记录',
192
- }
193
- }
194
-
195
- // 为columns添加默认属性
196
- for (let i in columns) {
197
-
198
- columns[i] = {
199
- ...{ align: 'center' },
200
- ...columns[i]
201
- }
202
- }
203
-
204
- // 当未设置行key时,自动以自增1作为key
205
- for (let i in data) {
206
- if (!data[i].hasOwnProperty('key')) {
207
- data[i]['key'] = i.toString()
208
- }
209
- }
210
-
211
156
  // 自定义可编辑单元格
212
157
  const EditableContext = React.createContext(null);
213
158
 
@@ -325,6 +270,89 @@ export default class AntdTable extends Component {
325
270
  return <td {...restProps}>{childNode}</td>;
326
271
  };
327
272
 
273
+ // 配置自定义组件
274
+ const components = {
275
+ body: {
276
+ row: EditableRow,
277
+ cell: EditableCell,
278
+ },
279
+ };
280
+
281
+ // 数值比较函数
282
+ const compareNumeric = (x, y) => {
283
+ if (x.value < y.value) {
284
+ return -1;
285
+ } else if (x.value > y.value) {
286
+ return 1;
287
+ } else {
288
+ return 0;
289
+ }
290
+ }
291
+
292
+ // 取得必要属性或参数
293
+ let {
294
+ id,
295
+ className,
296
+ style,
297
+ locale,
298
+ containerId,
299
+ setProps,
300
+ columns,
301
+ miniChartHeight,
302
+ miniChartAnimation,
303
+ rowSelectionType,
304
+ selectedRowKeys,
305
+ rowSelectionWidth,
306
+ sticky,
307
+ titlePopoverInfo,
308
+ columnsFormatConstraint,
309
+ enableHoverListen,
310
+ data,
311
+ sortOptions,
312
+ filterOptions,
313
+ pagination,
314
+ bordered,
315
+ maxHeight,
316
+ maxWidth,
317
+ size,
318
+ mode,
319
+ nClicksButton,
320
+ summaryRowContents,
321
+ summaryRowFixed,
322
+ loading_state
323
+ } = this.props;
324
+
325
+ // 重新映射size到符合常识的顺序
326
+ let size2size = new Map([
327
+ ['small', 'default'],
328
+ ['default', 'small'],
329
+ ['large', 'middle']
330
+ ])
331
+
332
+ pagination = {
333
+ ...pagination,
334
+ ...{
335
+ showTotalPrefix: pagination?.showTotalPrefix ? pagination.showTotalPrefix : '共 ',
336
+ showTotalSuffix: pagination?.showTotalSuffix ? pagination.showTotalSuffix : ' 条记录',
337
+ }
338
+ }
339
+
340
+ // 当未设置行key时,自动以自增1作为key
341
+ for (let i in data) {
342
+ if (!data[i].hasOwnProperty('key')) {
343
+ data[i]['key'] = i.toString()
344
+ }
345
+ }
346
+
347
+ // 为columns添加默认属性
348
+ for (let i in columns) {
349
+
350
+ columns[i] = {
351
+ ...{ align: 'center' },
352
+ ...columns[i]
353
+ }
354
+ }
355
+
328
356
  // 处理可编辑特性
329
357
  columns = columns.map((col) => {
330
358
  if (!col.editable) {
@@ -344,17 +372,6 @@ export default class AntdTable extends Component {
344
372
 
345
373
  // 处理可筛选特性
346
374
 
347
- // 数值比较比较函数
348
- const compareNumeric = (x, y) => {
349
- if (x.value < y.value) {
350
- return -1;
351
- } else if (x.value > y.value) {
352
- return 1;
353
- } else {
354
- return 0;
355
- }
356
- }
357
-
358
375
  // 若为前端渲染模式,在filterOptions中每个字段filterCustomItems缺失的情况下
359
376
  // 则会自动根据前端一次性灌入的数据推算出所有添加过滤器字段的唯一值集合作为待选菜单
360
377
  if (mode !== 'server-side') {
@@ -511,14 +528,17 @@ export default class AntdTable extends Component {
511
528
  if (columns[i]['renderOptions']['renderType'] == 'ellipsis') {
512
529
  columns[i]['ellipsis'] = true
513
530
  columns[i]['render'] = content => (
514
- <Tooltip placement="topLeft" title={content}>
531
+ <Tooltip
532
+ placement="topLeft"
533
+ title={content}
534
+ getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}
535
+ >
515
536
  {content}
516
537
  </Tooltip>
517
538
  )
518
539
  }
519
540
  }
520
541
  }
521
-
522
542
  }
523
543
 
524
544
  // 配置字段渲染模式为link的相关参数
@@ -569,6 +589,21 @@ export default class AntdTable extends Component {
569
589
  }
570
590
  }
571
591
 
592
+ // 配置字段渲染模式为status-badge的相关参数
593
+ for (let i = 0; i < columns.length; i++) {
594
+ // 当前字段具有renderOptions参数时且renderOptions参数是字典时
595
+ if (columns[i]['renderOptions']) {
596
+ if (columns[i]['renderOptions'].hasOwnProperty('renderType')) {
597
+ // 当renderOptions参数的renderType值设置为status-badge时
598
+ if (columns[i]['renderOptions']['renderType'] == 'status-badge') {
599
+ columns[i]['render'] = content => (
600
+ <Badge status={content.status} text={content.text} />
601
+ )
602
+ }
603
+ }
604
+ }
605
+ }
606
+
572
607
  // 配置字段渲染模式为button的相关参数
573
608
  for (let i = 0; i < columns.length; i++) {
574
609
  // 当前字段具有renderOptions参数时且renderOptions参数是字典时
@@ -592,7 +627,7 @@ export default class AntdTable extends Component {
592
627
  okText={columns[i]['renderOptions']['renderButtonPopConfirmProps'].okText}
593
628
  cancelText={columns[i]['renderOptions']['renderButtonPopConfirmProps'].cancelText}
594
629
  disabled={content_.disabled}
595
- getPopupContainer={containerId ? () => document.getElementById(containerId) : undefined}
630
+ getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}
596
631
  onConfirm={() => setProps({
597
632
  recentlyButtonClickedRow: record,
598
633
  nClicksButton: nClicksButton + 1,
@@ -616,7 +651,7 @@ export default class AntdTable extends Component {
616
651
  okText={columns[i]['renderOptions']['renderButtonPopConfirmProps'].okText}
617
652
  cancelText={columns[i]['renderOptions']['renderButtonPopConfirmProps'].cancelText}
618
653
  disabled={content.disabled}
619
- getPopupContainer={containerId ? () => document.getElementById(containerId) : undefined}
654
+ getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}
620
655
  onConfirm={() => setProps({
621
656
  recentlyButtonClickedRow: record,
622
657
  nClicksButton: nClicksButton + 1,
@@ -707,62 +742,62 @@ export default class AntdTable extends Component {
707
742
  // 当renderOptions参数的renderType值设置为mini-line时
708
743
  if (columns[i]['renderOptions']['renderType'] == 'mini-line') {
709
744
  columns[i]['render'] = data => {
710
- var config = {
711
- height: "100%",
712
- width: "100%",
745
+ let config = {
713
746
  autoFit: true,
714
747
  padding: 0,
715
748
  data: data,
749
+ animation: miniChartAnimation,
716
750
  smooth: true,
717
751
  };
718
- return <div><TinyLine {...config} /></div>;
752
+ return <div style={{ height: miniChartHeight }}><TinyLine {...config} /></div>;
719
753
  }
720
754
  } else if (columns[i]['renderOptions']['renderType'] == 'mini-bar') {
721
755
  columns[i]['render'] = data => {
722
- var config = {
723
- height: "100%",
724
- width: "100%",
756
+ let config = {
725
757
  padding: 0,
726
758
  autoFit: true,
727
759
  data: data,
760
+ animation: miniChartAnimation,
728
761
  };
729
- return <div><TinyColumn {...config} /></div>;
762
+ return <div style={{ height: miniChartHeight }}><TinyColumn {...config} /></div>;
730
763
  }
731
764
  } else if (columns[i]['renderOptions']['renderType'] == 'mini-progress') {
732
765
  columns[i]['render'] = data => {
733
- var config = {
734
- height: "100%",
735
- width: "100%",
766
+ let config = {
736
767
  autoFit: true,
737
768
  padding: 0,
738
769
  percent: data,
770
+ animation: miniChartAnimation,
739
771
  color: ['#5B8FF9', '#E8EDF3'],
740
772
  };
741
- return <div><Progress {...config} /></div>;
773
+ return <div style={{ height: miniChartHeight }}><Progress {...config} /></div>;
774
+ }
775
+ } else if (columns[i]['renderOptions']['renderType'] == 'mini-ring-progress') {
776
+ columns[i]['render'] = data => {
777
+ let config = {
778
+ autoFit: true,
779
+ padding: 0,
780
+ percent: data,
781
+ animation: miniChartAnimation,
782
+ color: ['#5B8FF9', '#E8EDF3'],
783
+ };
784
+ return <div style={{ height: miniChartHeight }}><RingProgress {...config} /></div>;
742
785
  }
743
786
  } else if (columns[i]['renderOptions']['renderType'] == 'mini-area') {
744
787
  columns[i]['render'] = data => {
745
- var config = {
746
- height: "100%",
747
- width: "100%",
788
+ let config = {
748
789
  autoFit: true,
749
790
  padding: 0,
750
791
  data: data,
792
+ animation: miniChartAnimation,
751
793
  smooth: true,
752
794
  };
753
- return <div><TinyArea {...config} /></div>;
795
+ return <div style={{ height: miniChartHeight }}><TinyArea {...config} /></div>;
754
796
  }
755
797
  }
756
798
  }
757
799
  }
758
800
 
759
- // 配置自定义组件
760
- const components = {
761
- body: {
762
- row: EditableRow,
763
- cell: EditableCell,
764
- },
765
- };
766
801
 
767
802
  // 处理columns.title的增广功能设置
768
803
  if (titlePopoverInfo) {
@@ -788,7 +823,7 @@ export default class AntdTable extends Component {
788
823
  }}>{content}</div>}
789
824
  overlayStyle={{ maxWidth: '250px' }}
790
825
  placement={'bottom'}
791
- getPopupContainer={containerId ? () => document.getElementById(containerId) : undefined}>
826
+ getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}>
792
827
  <QuestionCircleOutlined
793
828
  style={{
794
829
  color: '#8c8c8c',
@@ -802,12 +837,33 @@ export default class AntdTable extends Component {
802
837
  }
803
838
  }
804
839
 
840
+ // 添加表头单元格监听事件
841
+ if (enableHoverListen) {
842
+ columns = columns.map(
843
+ item => (
844
+ {
845
+ ...item,
846
+ ...{
847
+ onHeaderCell: (e) => {
848
+ return {
849
+ onMouseEnter: event => { setProps({ recentlyMouseEnterColumn: e.dataIndex }) }, // 鼠标移入字段名
850
+ };
851
+ }
852
+ }
853
+ }
854
+ )
855
+ )
856
+ }
857
+
805
858
  let rowSelection
806
859
  // 处理行选择功能设置
807
860
  if (rowSelectionType) {
808
861
 
809
862
  rowSelection = {
863
+ columnWidth: rowSelectionWidth,
864
+ fixed: true,
810
865
  type: rowSelectionType,
866
+ selectedRowKeys: selectedRowKeys,
811
867
  selections: [
812
868
  Table.SELECTION_ALL,
813
869
  Table.SELECTION_INVERT,
@@ -822,25 +878,6 @@ export default class AntdTable extends Component {
822
878
  }
823
879
  }
824
880
 
825
- // 添加表头单元格监听事件
826
- if (enableHoverListen) {
827
- columns = columns.map(
828
- item => (
829
- {
830
- ...item,
831
- ...{
832
- onHeaderCell: (e) => {
833
- return {
834
- onMouseEnter: event => { setProps({ recentlyMouseEnterColumn: e.dataIndex }) }, // 鼠标移入字段名
835
- };
836
- }
837
- }
838
- }
839
- )
840
- )
841
- }
842
-
843
-
844
881
  return (
845
882
  <ConfigProvider locale={str2Locale.get(locale)}>
846
883
  <Table
@@ -853,11 +890,10 @@ export default class AntdTable extends Component {
853
890
  columns={columns}
854
891
  size={size2size.get(size)}
855
892
  rowSelection={rowSelection}
893
+ sticky={sticky}
856
894
  pagination={{ ...pagination, ...{ showTotal: total => `${pagination.showTotalPrefix}${total}${pagination.showTotalSuffix}` } }}
857
895
  bordered={bordered}
858
- scroll={{
859
- y: maxHeight ? maxHeight : 99999
860
- }}
896
+ scroll={{ x: maxWidth, y: maxHeight, scrollToFirstRowOnChange: true }}
861
897
  onChange={this.onPageChange}
862
898
  onRow={
863
899
  enableHoverListen ?
@@ -867,10 +903,21 @@ export default class AntdTable extends Component {
867
903
  };
868
904
  } : undefined
869
905
  }
906
+ summary={summaryRowContents ? () => (
907
+ <Table.Summary fixed={summaryRowFixed}>
908
+ <Table.Summary.Row>
909
+ {summaryRowContents.map((item, i) =>
910
+ <Table.Summary.Cell index={i} colSpan={item.colSpan} align={item.align}>
911
+ {item.content}
912
+ </Table.Summary.Cell>
913
+ )}
914
+ </Table.Summary.Row>
915
+ </Table.Summary>
916
+ ) : undefined}
870
917
  data-dash-is-loading={
871
918
  (loading_state && loading_state.is_loading) || undefined
872
919
  }
873
- getPopupContainer={containerId ? () => document.getElementById(containerId) : undefined}
920
+ getPopupContainer={containerId ? () => (document.getElementById(containerId) ? document.getElementById(containerId) : document.body) : undefined}
874
921
  />
875
922
  </ConfigProvider>
876
923
  );
@@ -906,9 +953,12 @@ AntdTable.propTypes = {
906
953
  // 预处理方式
907
954
  renderOptions: PropTypes.exact({
908
955
 
909
- // 设置渲染处理类型,可选项有'link'、'ellipsis'、'mini-line'、'mini-bar'、'mini-progress'、'mini-area'、"tags'、'button'
956
+ // 设置渲染处理类型,可选项有'link'、'ellipsis'、'mini-line'、'mini-bar'、'mini-progress'、'mini-area'、'tags'、'button'
957
+ // 'copyable'、'status-badge'
910
958
  renderType: PropTypes.oneOf([
911
- 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress', 'mini-area', 'tags', 'button', 'copyable'
959
+ 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress',
960
+ 'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable',
961
+ 'status-badge'
912
962
  ]),
913
963
 
914
964
  // 当renderType='link'时,此参数会将传入的字符串作为渲染link的显示文字内容
@@ -953,6 +1003,12 @@ AntdTable.propTypes = {
953
1003
  })
954
1004
  ),
955
1005
 
1006
+ // 为迷你图模式单元格设置像素高度,默认为30
1007
+ miniChartHeight: PropTypes.number,
1008
+
1009
+ // 设置迷你图模式是否启用出现动画,默认为false
1010
+ miniChartAnimation: PropTypes.bool,
1011
+
956
1012
  // 设置表格单元格尺寸规格,可选的有'small'、'default'和'large'
957
1013
  size: PropTypes.oneOf(['small', 'default', 'large']),
958
1014
 
@@ -960,11 +1016,25 @@ AntdTable.propTypes = {
960
1016
  rowSelectionType: PropTypes.oneOf(['checkbox', 'radio']),
961
1017
 
962
1018
  // 记录已被选择的行key值数组
963
- selectedRowKeys: PropTypes.arrayOf(PropTypes.string),
1019
+ selectedRowKeys: PropTypes.arrayOf(
1020
+ PropTypes.oneOfType([
1021
+ PropTypes.string,
1022
+ PropTypes.number
1023
+ ])
1024
+ ),
1025
+
1026
+ // 设置行选择框宽度,默认为'32px'
1027
+ rowSelectionWidth: PropTypes.oneOfType([
1028
+ PropTypes.string,
1029
+ PropTypes.number
1030
+ ]),
964
1031
 
965
1032
  // 记录已被选择的行记录值列表
966
1033
  selectedRows: PropTypes.array,
967
1034
 
1035
+ // 设置是否开启粘性头部,默认为false
1036
+ sticky: PropTypes.bool,
1037
+
968
1038
  // 设置是否启用行悬浮事件监听(此功能可能会干扰其他正常表格功能,慎用),默认为false
969
1039
  enableHoverListen: PropTypes.bool,
970
1040
 
@@ -996,7 +1066,94 @@ AntdTable.propTypes = {
996
1066
  ),
997
1067
 
998
1068
  // 定义与columns匹配的行记录数组
999
- data: PropTypes.arrayOf(PropTypes.object),
1069
+ data: PropTypes.arrayOf(
1070
+ PropTypes.objectOf(
1071
+ PropTypes.oneOfType([
1072
+ // 常规模式、ellipsis模式、copyable模式
1073
+ PropTypes.string,
1074
+
1075
+ // 常规模式、ellipsis模式、mini-prorgess模式、mini-ring-progress模式、copyable模式
1076
+ // 其中mini-prorgess模式、mini-ring-progress模式输入值需在0~1之间
1077
+ PropTypes.number,
1078
+
1079
+ // link模式
1080
+ PropTypes.exact({
1081
+ // href链接
1082
+ href: PropTypes.string,
1083
+ // target行为属性,默认为'_blank'
1084
+ target: PropTypes.string,
1085
+ // 设置是否禁用当前链接,默认为false
1086
+ disabled: PropTypes.bool
1087
+ }),
1088
+
1089
+ // mini-line模式、mini-bar模式、mini-area模式
1090
+ PropTypes.arrayOf(PropTypes.number),
1091
+
1092
+ // tags模式
1093
+ PropTypes.arrayOf(
1094
+ PropTypes.exact({
1095
+ // 标签颜色
1096
+ color: PropTypes.string,
1097
+ // 标签内容
1098
+ tag: PropTypes.oneOfType([
1099
+ PropTypes.string,
1100
+ PropTypes.number
1101
+ ])
1102
+ })
1103
+ ),
1104
+
1105
+ // button模式
1106
+ PropTypes.oneOfType([
1107
+ // 单按钮模式
1108
+ PropTypes.exact({
1109
+ // 设置是否禁用按钮,默认为false
1110
+ disabled: PropTypes.bool,
1111
+ // 设置按钮的type属性,同AntdButton
1112
+ type: PropTypes.oneOf(['primary', 'ghost', 'dashed', 'link', 'text', 'default']),
1113
+ // 设置按钮的danger属性,同AntdButton
1114
+ danger: PropTypes.bool,
1115
+ // 设置按钮的css样式
1116
+ style: PropTypes.object,
1117
+ // 设置按钮的文本内容
1118
+ content: PropTypes.oneOfType([
1119
+ PropTypes.string,
1120
+ PropTypes.number
1121
+ ])
1122
+ }),
1123
+
1124
+ // 多按钮模式
1125
+ PropTypes.arrayOf(
1126
+ PropTypes.exact({
1127
+ // 设置是否禁用按钮,默认为false
1128
+ disabled: PropTypes.bool,
1129
+ // 设置按钮的type属性,同AntdButton
1130
+ type: PropTypes.oneOf(['primary', 'ghost', 'dashed', 'link', 'text', 'default']),
1131
+ // 设置按钮的danger属性,同AntdButton
1132
+ danger: PropTypes.bool,
1133
+ // 设置按钮的css样式
1134
+ style: PropTypes.object,
1135
+ // 设置按钮的文本内容
1136
+ content: PropTypes.oneOfType([
1137
+ PropTypes.string,
1138
+ PropTypes.number
1139
+ ])
1140
+ })
1141
+ )
1142
+ ]),
1143
+
1144
+ // status-badge模式
1145
+ PropTypes.exact({
1146
+ // 设置状态徽标的状态
1147
+ status: PropTypes.oneOf(['success', 'processing', 'default', 'error', 'warning']),
1148
+ // 设置状态徽标的后缀文字内容
1149
+ text: PropTypes.oneOfType([
1150
+ PropTypes.string,
1151
+ PropTypes.number
1152
+ ])
1153
+ })
1154
+ ])
1155
+ )
1156
+ ),
1000
1157
 
1001
1158
  // 定义排序参数
1002
1159
  sortOptions: PropTypes.exact({
@@ -1012,7 +1169,7 @@ AntdTable.propTypes = {
1012
1169
  // 定义筛选参数
1013
1170
  filterOptions: PropTypes.object,
1014
1171
 
1015
- // 翻页相关参数
1172
+ // 翻页相关参数,设置为false时不展示和进行分页
1016
1173
  pagination: PropTypes.oneOfType([
1017
1174
  PropTypes.bool,
1018
1175
  PropTypes.exact({
@@ -1028,10 +1185,16 @@ AntdTable.propTypes = {
1028
1185
  // 当前的页码
1029
1186
  current: PropTypes.number,
1030
1187
 
1188
+ // 设置是否展示pageSize切换器,当total大于50时默认为true
1189
+ showSizeChanger: PropTypes.bool,
1190
+
1031
1191
  // 设定每页尺寸切换可选的范围
1032
1192
  pageSizeOptions: PropTypes.arrayOf(PropTypes.number),
1033
1193
 
1034
- // 设置是否渲染快速跳转控件
1194
+ // 设置是否显示原生页面悬浮提示title信息,默认为true
1195
+ showTitle: PropTypes.bool,
1196
+
1197
+ // 设置是否渲染快速跳转控件,默认为false
1035
1198
  showQuickJumper: PropTypes.bool,
1036
1199
 
1037
1200
  // 定义总记录行数显示部分的前缀文字,默认为"共 "
@@ -1047,8 +1210,16 @@ AntdTable.propTypes = {
1047
1210
  hideOnSinglePage: PropTypes.bool,
1048
1211
 
1049
1212
  // 设置是否开启简洁模式
1050
- simple: PropTypes.bool
1213
+ simple: PropTypes.bool,
1214
+
1215
+ // 设置是否禁用分页,默认为false
1216
+ disabled: PropTypes.bool,
1217
+
1218
+ // 设置是否开启响应式,即分页尺寸会根据屏幕宽度自动进行调整
1219
+ responsive: PropTypes.bool,
1051
1220
 
1221
+ // 设置分页器尺寸,可选的有'default'和'small',默认为'default'
1222
+ size: PropTypes.oneOf(['default', 'small'])
1052
1223
  })
1053
1224
  ]),
1054
1225
 
@@ -1058,6 +1229,9 @@ AntdTable.propTypes = {
1058
1229
  // 设置组件最大高度,每页超出部分将自动转换为竖向滑动浏览方式
1059
1230
  maxHeight: PropTypes.number,
1060
1231
 
1232
+ // 设置组件最大宽度,每页超出部分将自动转换为横向滑动浏览方式
1233
+ maxWidth: PropTypes.number,
1234
+
1061
1235
  // 经过修改操作后,当前状态下最新的dataSource数据
1062
1236
  currentData: PropTypes.array,
1063
1237
 
@@ -1088,6 +1262,26 @@ AntdTable.propTypes = {
1088
1262
  // 设置数据操纵模式,可选的有'client-side'(前端)、'server-side'(后端),默认为'client-side'
1089
1263
  mode: PropTypes.oneOf(['client-side', 'server-side']),
1090
1264
 
1265
+ // 设置总结栏内容数组,请与每个字段保持一一对应
1266
+ summaryRowContents: PropTypes.arrayOf(
1267
+ PropTypes.exact({
1268
+ // 总结栏单元格内容
1269
+ content: PropTypes.oneOfType([
1270
+ PropTypes.string,
1271
+ PropTypes.number
1272
+ ]),
1273
+
1274
+ // 设置当前值横跨的字段数量,默认为1
1275
+ colSpan: PropTypes.number,
1276
+
1277
+ // 设置列对齐方式,可选项有'left'、'center'、'right'
1278
+ align: PropTypes.oneOf(['left', 'center', 'right'])
1279
+ })
1280
+ ),
1281
+
1282
+ // 设置总结栏是否启用fixed功能,默认为false
1283
+ summaryRowFixed: PropTypes.bool,
1284
+
1091
1285
  loading_state: PropTypes.shape({
1092
1286
  /**
1093
1287
  * Determines if the component is loading or not
@@ -1112,6 +1306,9 @@ AntdTable.propTypes = {
1112
1306
 
1113
1307
  // 设置默认参数
1114
1308
  AntdTable.defaultProps = {
1309
+ summaryRowFixed: false,
1310
+ miniChartHeight: 30,
1311
+ miniChartAnimation: false,
1115
1312
  enableHoverListen: false,
1116
1313
  bordered: false,
1117
1314
  data: [],