@ecoding/components.antd 0.3.47 → 0.3.49

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.
@@ -19,6 +19,7 @@ interface IProps {
19
19
  hideHeader?: boolean;
20
20
  afterRemove?: (index: any) => void;
21
21
  afterAdd?: (index: any) => void;
22
+ tStyle?: React.CSSProperties;
22
23
  operation?: {
23
24
  width?: number;
24
25
  render?: (field: FormListFieldData, index: number) => React.ReactNode;
@@ -1,7 +1,8 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useMemo, useRef } from 'react';
2
2
  import { Typography, Form, Button, Space, Tooltip } from 'antd';
3
3
  import { PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
4
- const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
4
+ const C = ({ columns, rules, tStyle, name, hideOperation, hideHeader, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
5
+ const tbodyRef = useRef(null);
5
6
  const tdStyle = {
6
7
  verticalAlign: 'top',
7
8
  lineHeight: '32px',
@@ -10,7 +11,10 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
10
11
  const thStyle = {
11
12
  textAlign: 'left',
12
13
  backgroundColor: '#fafafa',
13
- padding: '8px'
14
+ padding: '8px',
15
+ position: "sticky",
16
+ top: 0,
17
+ zIndex: 1
14
18
  };
15
19
  const trStyle = {
16
20
  borderBottom: '1px solid #eee'
@@ -29,25 +33,31 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
29
33
  return w;
30
34
  }, []);
31
35
  return (React.createElement(Form.List, { name: name, rules: rules || [] }, (fields, { add, remove }, { errors }) => {
32
- return (React.createElement(React.Fragment, null,
33
- React.createElement("div", { className: "m-form-list", style: { overflowX: 'auto', marginBottom: '4px', paddingBottom: '12px', position: 'relative' } },
36
+ return (React.createElement("div", { className: 'm-form-list' },
37
+ React.createElement("div", { ref: tbodyRef, className: "m-form-list-table", style: Object.assign({}, { marginBottom: '4px', paddingBottom: '12px', overflow: "auto", position: 'relative' }, tStyle) },
34
38
  React.createElement("table", { style: { width: widths } },
39
+ React.createElement("colgroup", null,
40
+ React.createElement("col", { style: Object.assign({}, { width: 60 }) }),
41
+ columns.map((column) => {
42
+ return (React.createElement("col", { style: Object.assign({}, { width: column.width || 200 }) }));
43
+ }),
44
+ hideOperation ? null : (React.createElement("col", { style: Object.assign({}, { width: (operation === null || operation === void 0 ? void 0 : operation.width) || 150 }) }))),
35
45
  React.createElement("thead", null, hideHeader ? null : (React.createElement("tr", null,
36
- React.createElement("th", { style: Object.assign({}, thStyle, { width: '60px' }) }, i18n ? i18n.$t("global.num", "序号") : "序号"),
46
+ React.createElement("th", { style: thStyle }, i18n ? i18n.$t("global.num", "序号") : "序号"),
37
47
  columns.map((column, i) => {
38
48
  if (column.require) {
39
- return (React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) },
49
+ return (React.createElement("th", { style: thStyle },
40
50
  React.createElement("span", { style: { color: '#ff4d4f' } }, "*"),
41
51
  column.title,
42
52
  column.tooltip ? (React.createElement(Tooltip, { placement: "top", title: column.tooltip || undefined },
43
53
  React.createElement(QuestionCircleOutlined, { style: { paddingLeft: 4, color: "rgba(0, 0, 0, 0.45)" } }))) : null));
44
54
  }
45
- return (React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) },
55
+ return (React.createElement("th", { style: thStyle },
46
56
  column.title,
47
57
  column.tooltip ? (React.createElement(Tooltip, { placement: "top", title: column.tooltip || undefined },
48
58
  React.createElement(QuestionCircleOutlined, { style: { paddingLeft: 4, color: "rgba(0, 0, 0, 0.45)" } }))) : null));
49
59
  }),
50
- hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { width: operation.width || 150, right: 0, position: "sticky" }) }, operation.title || "操作")) : (React.createElement("th", { style: Object.assign({}, thStyle, { width: 150, right: 0, position: "sticky" }) }, i18n ? i18n.$t("global.operation", "操作") : "操作"))))),
60
+ hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, operation.title || "操作")) : (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, i18n ? i18n.$t("global.operation", "操作") : "操作"))))),
51
61
  React.createElement("tbody", null, fields.map((field, index) => {
52
62
  return (React.createElement("tr", { style: trStyle },
53
63
  React.createElement("td", { style: tdStyle }, index + 1),
@@ -70,6 +80,9 @@ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operat
70
80
  hideBottom ? null : (React.createElement("div", null,
71
81
  React.createElement(Button, { icon: React.createElement(PlusCircleOutlined, null), type: "dashed", onClick: () => {
72
82
  add();
83
+ setTimeout(() => {
84
+ tbodyRef.current.scrollTop = tbodyRef.current.scrollHeight;
85
+ }, 10);
73
86
  afterAdd && afterAdd(fields.length);
74
87
  } }, i18n ? i18n.$t("global.add", "添加") : "添加")))));
75
88
  }));
@@ -3,8 +3,11 @@ export interface IModalProps {
3
3
  key?: string;
4
4
  id?: string;
5
5
  className?: string;
6
+ wrapClassName?: string;
7
+ style?: React.CSSProperties;
6
8
  open?: boolean;
7
9
  width?: string | number;
10
+ height?: string | number;
8
11
  zIndex?: number;
9
12
  mask?: boolean;
10
13
  title?: React.ReactNode;
@@ -31,8 +34,9 @@ export interface IModalProps {
31
34
  export declare class Modals extends React.Component<IModalProps> {
32
35
  static defaultProps: {
33
36
  className: string;
37
+ wrapClassName: string;
34
38
  open: boolean;
35
- bodyStyle: {};
39
+ style: {};
36
40
  width: string;
37
41
  zIndex: number;
38
42
  mask: boolean;
@@ -58,8 +62,11 @@ export declare class Modals extends React.Component<IModalProps> {
58
62
  key?: string | undefined;
59
63
  id?: string | undefined;
60
64
  className?: string | undefined;
65
+ wrapClassName?: string | undefined;
66
+ style?: React.CSSProperties | undefined;
61
67
  open?: boolean | undefined;
62
68
  width?: string | number | undefined;
69
+ height?: string | number | undefined;
63
70
  zIndex?: number | undefined;
64
71
  mask?: boolean | undefined;
65
72
  title?: React.ReactNode;
@@ -46,7 +46,7 @@ export class Modals extends React.Component {
46
46
  }
47
47
  render() {
48
48
  // if (!this.props.visible) return null;
49
- return (React.createElement(Modal, { className: this.state.className, open: this.state.open, width: this.state.width, zIndex: this.state.zIndex, mask: this.state.mask, title: typeof this.state.title === "string" ? (React.createElement("div", { style: { boxShadow: "inset 0px -1px 0px #F0F0F0", marginBottom: "20px", paddingBottom: "12px" } }, this.state.title)) : (this.state.title), closable: this.state.closable, maskClosable: this.state.maskClosable, onCancel: this.cancel, destroyOnClose: true, keyboard: false, footer: this.state.footer === null ? null : this.state.footer ? (this.state.footer) : (React.createElement(React.Fragment, null,
49
+ return (React.createElement(Modal, { className: this.state.className, wrapClassName: this.state.wrapClassName, open: this.state.open, style: this.state.style, width: this.state.width, zIndex: this.state.zIndex, mask: this.state.mask, title: typeof this.state.title === "string" ? (React.createElement("div", { style: { boxShadow: "inset 0px -1px 0px #F0F0F0", marginBottom: "20px", paddingBottom: "12px" } }, this.state.title)) : (this.state.title), closable: this.state.closable, maskClosable: this.state.maskClosable, onCancel: this.cancel, destroyOnClose: true, keyboard: false, footer: this.state.footer === null ? null : this.state.footer ? (this.state.footer) : (React.createElement(React.Fragment, null,
50
50
  this.state.addonBefore ? this.state.addonBefore : null,
51
51
  React.createElement(Button, Object.assign({}, this.state.cancelButtonProps, { key: "back", onClick: this.cancel }), this.state.cancelText),
52
52
  React.createElement(Button, Object.assign({}, this.state.okButtonProps, { danger: this.state.okDanger, key: "submit", type: this.state.okType, loading: this.state.loading, onClick: this.ok }), this.state.okText),
@@ -54,9 +54,10 @@ export class Modals extends React.Component {
54
54
  }
55
55
  }
56
56
  Modals.defaultProps = {
57
- className: "g-modals",
57
+ className: "",
58
+ wrapClassName: "g-modals",
58
59
  open: false,
59
- bodyStyle: {},
60
+ style: {},
60
61
  width: "80vw",
61
62
  zIndex: 950,
62
63
  mask: true,
@@ -8,6 +8,7 @@ interface IProps {
8
8
  className?: string;
9
9
  header?: React.ReactNode;
10
10
  buttonArea?: React.ReactNode;
11
+ scrollY?: string | number;
11
12
  filters?: {
12
13
  overMax?: number;
13
14
  colOpts?: ColProps;
@@ -4,10 +4,10 @@ import { FilterOutlined, MenuOutlined } from '@ant-design/icons';
4
4
  import TableProColumns from "./columns";
5
5
  import { getDelateTargetByClassName } from "../../helpers/dom";
6
6
  import FilterHorizontal from "./filters.horizontal";
7
- const TablePro = ({ className, header, buttonArea, filterArea, filters, searchInputArea, loading, rowKey, dataSource, pagination, offsetY, columns, operationColumn, bordered = false, selectChangeHandler, selectType, onChange, expandable, columnsTitle = "显示列", filterTitle = "筛选", locale }, ref) => {
7
+ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchInputArea, loading, rowKey, dataSource, pagination, offsetY, columns, operationColumn, bordered = false, selectChangeHandler, selectType, onChange, expandable, columnsTitle = "显示列", filterTitle = "筛选", locale, scrollY = '100%' }, ref) => {
8
8
  const tableRef = useRef(null);
9
9
  const disColumnRef = useRef([]);
10
- const [y, setY] = useState('100%');
10
+ const [y, setY] = useState(scrollY);
11
11
  const [innerColumns, setColumns] = useState(columns);
12
12
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
13
13
  const flexColumnStyle = {
@@ -86,7 +86,7 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
86
86
  }
87
87
  }, [columns]);
88
88
  useEffect(() => {
89
- if (tableRef.current && innerColumns.length > 0) {
89
+ if (tableRef.current && innerColumns.length > 0 && scrollY == '100%') {
90
90
  const thead = tableRef.current.querySelector('thead');
91
91
  setTimeout(() => {
92
92
  if (offsetY && offsetY > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.3.47",
3
+ "version": "0.3.49",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -43,5 +43,5 @@
43
43
  "antd": "^5.8.4",
44
44
  "axios": "^1.1.2"
45
45
  },
46
- "gitHead": "6ce14e373f7797fad2c5fed0a1232882a94579ff"
46
+ "gitHead": "ee7e6f5968f64b867060e9e6c1b7ddbad3572d92"
47
47
  }