@ecoding/components.antd 0.3.46 → 0.3.48

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
  }));
@@ -50,6 +50,14 @@ const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts
50
50
  }
51
51
  return false;
52
52
  }, []);
53
+ const isLineAfter = useMemo(() => {
54
+ const len = items.length;
55
+ const temp = Math.floor(24 / colProps.span);
56
+ if (len == temp) {
57
+ return true;
58
+ }
59
+ return false;
60
+ }, []);
53
61
  useEffect(() => {
54
62
  if (ref.current) {
55
63
  if (items && items.length > overMax) {
@@ -64,7 +72,7 @@ const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts
64
72
  }
65
73
  }, [y]);
66
74
  return (React.createElement(Form, { form: form, onFinish: finish, style: { width: '100%', position: "relative" } },
67
- React.createElement("div", { style: { display: "flex" } },
75
+ React.createElement("div", { style: { display: "flex", justifyContent: "space-around", alignItems: "flex-start" } },
68
76
  React.createElement(Row, { gutter: 20, style: { overflow: "hidden", width: '100%', height: Number(wrapH) > 0 ? wrapH : 'auto' }, ref: ref },
69
77
  items && items.map((item) => {
70
78
  return (React.createElement(Col, Object.assign({}, colProps), item));
@@ -72,18 +80,10 @@ const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts
72
80
  isOpShowAfter ? (React.createElement(Col, Object.assign({}, colProps, { style: { paddingTop: 4 } }),
73
81
  React.createElement(Button, { type: "primary", className: 'mr10', size: 'small', htmlType: "submit" }, "\u641C\u7D22"),
74
82
  React.createElement(Button, { size: 'small', onClick: clear }, "\u6E05\u7A7A"))) : null),
75
- !isOpShowAfter ? (React.createElement(Space, { direction: "vertical", size: "small", style: { textAlign: "right", width: 90 } },
83
+ !isOpShowAfter ? (React.createElement(Space, { size: "small", direction: isLineAfter ? undefined : "vertical", style: Object.assign({ width: 90, textAlign: "right" }, isLineAfter ? { width: 130, margin: "4px 0 0 12px" } : {}) },
76
84
  React.createElement(Button, { type: "primary", size: 'small', htmlType: "submit" }, "\u641C\u7D22"),
77
85
  React.createElement(Button, { size: 'small', onClick: clear }, "\u6E05\u7A7A"))) : null),
78
- showMore ? (React.createElement(Button, { type: 'link', onClick: switchShow, style: { fontSize: 12, position: "absolute", bottom: -10, left: '50%', transform: "translateX(-50%)" }, size: 'small' }, moreFlag ? "收起" : "展开更多")) : null,
79
- React.createElement("span", { style: {
80
- position: "absolute",
81
- height: 0,
82
- width: "100%",
83
- left: 0,
84
- borderBottom: "1px dashed #efefef",
85
- bottom: 4
86
- } })));
86
+ showMore ? (React.createElement(Button, { type: 'link', onClick: switchShow, style: { fontSize: 12, position: "absolute", bottom: -10, left: '50%', transform: "translateX(-50%)" }, size: 'small' }, moreFlag ? "收起" : "展开更多")) : null));
87
87
  };
88
88
  FiltersHorizontal.defaultProps = {
89
89
  items: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.3.46",
3
+ "version": "0.3.48",
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": "bc713855b458f888f014acb50aea3040e36fd41e"
46
+ "gitHead": "8cba1e5d0bc72933d15c1f9b53343fbdbbb234b8"
47
47
  }