@ecoding/components.antd 0.3.27 → 0.3.29

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/LICENSE.md ADDED
File without changes
@@ -16,6 +16,7 @@ interface IProps {
16
16
  i18n?: any;
17
17
  hideOperation?: boolean;
18
18
  hideBottom?: boolean;
19
+ hideHeader?: boolean;
19
20
  afterRemove?: (index: any) => void;
20
21
  afterAdd?: (index: any) => void;
21
22
  operation?: {
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { Typography, Form, Button, Space } from 'antd';
3
3
  import { PlusCircleOutlined } from '@ant-design/icons';
4
- const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
4
+ const C = ({ columns, rules, name, hideOperation, hideHeader, hideBottom, operation, i18n, afterRemove, afterAdd }) => {
5
5
  const tdStyle = {
6
6
  verticalAlign: 'top',
7
7
  lineHeight: '32px',
@@ -32,19 +32,18 @@ const C = ({ columns, rules, name, hideOperation, hideBottom, operation, i18n, a
32
32
  return (React.createElement(React.Fragment, null,
33
33
  React.createElement("div", { className: "m-form-list", style: { overflowX: 'auto', marginBottom: '4px', paddingBottom: '12px', position: 'relative' } },
34
34
  React.createElement("table", { style: { width: widths } },
35
- React.createElement("thead", null,
36
- React.createElement("tr", null,
37
- React.createElement("th", { style: Object.assign({}, thStyle, { width: '60px' }) }, i18n ? i18n.$t("global.num", "序号") : "序号"),
38
- columns.map((column, i) => {
39
- if (column.require) {
40
- return (React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) },
41
- React.createElement("span", { style: { color: '#ff4d4f' } }, "*"),
42
- " ",
43
- column.title));
44
- }
45
- return React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) }, column.title);
46
- }),
47
- 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", "操作") : "操作")))),
35
+ 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", "序号") : "序号"),
37
+ columns.map((column, i) => {
38
+ if (column.require) {
39
+ return (React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) },
40
+ React.createElement("span", { style: { color: '#ff4d4f' } }, "*"),
41
+ " ",
42
+ column.title));
43
+ }
44
+ return React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) }, column.title);
45
+ }),
46
+ 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", "操作") : "操作"))))),
48
47
  React.createElement("tbody", null, fields.map((field, index) => {
49
48
  return (React.createElement("tr", { style: trStyle },
50
49
  React.createElement("td", { style: tdStyle }, index + 1),
@@ -1,11 +1,24 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import React, { useCallback, useEffect, useState } from 'react';
2
13
  import { Select, Input } from 'antd';
3
14
  const LengthInput = (props) => {
4
15
  const [region, setRegion] = useState('+86');
5
16
  const [v, setV] = useState('');
17
+ const _a = props || {}, { regionWidth, regions, maxLength, onChange } = _a, rest = __rest(_a, ["regionWidth", "regions", "maxLength", "onChange"]);
6
18
  const inputHandler = useCallback((e) => {
7
19
  let vs = e.target.value.trim();
8
- props.onChange(`${region}-${vs}`);
20
+ setV(vs);
21
+ onChange && onChange(`${region}-${vs}`);
9
22
  }, [region]);
10
23
  const selectHandler = useCallback((v) => {
11
24
  setRegion(v);
@@ -23,15 +36,15 @@ const LengthInput = (props) => {
23
36
  }
24
37
  }
25
38
  }, [props]);
26
- return (React.createElement(Input, Object.assign({}, props, { maxLength: props.maxLength, value: v, addonBefore: React.createElement(Select, { className: "ant_select_no_padding", style: {
27
- width: props.regionWidth,
39
+ return (React.createElement(Input, Object.assign({}, rest, { maxLength: maxLength, value: v, addonBefore: React.createElement(Select, { className: "ant_select_no_padding", style: {
40
+ width: regionWidth,
28
41
  paddingRight: 12,
29
42
  boxSizing: 'content-box'
30
- }, value: region, bordered: false, options: props.regions, onChange: selectHandler }), onChange: inputHandler })));
43
+ }, value: region, options: regions, onChange: selectHandler }), onChange: inputHandler })));
31
44
  };
32
45
  LengthInput.defaultProps = {
33
46
  maxLength: 16,
34
- regionWidth: 60,
47
+ regionWidth: 70,
35
48
  regions: [
36
49
  { value: '+86', label: '+86' },
37
50
  { value: '+65', label: '+65' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
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": "571168c21c039e8eed8da932957c8b567fa22abb"
46
+ "gitHead": "005b4ba7e5b80be93d4a71cd091a616487f5c6d0"
47
47
  }