@ecoding/components.antd 0.4.4 → 0.4.6

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.
@@ -54,7 +54,8 @@ const LengthInput = (props) => {
54
54
  props.onChange(e);
55
55
  }, []);
56
56
  useEffect(() => {
57
- if (props.value && !v) {
57
+ // if (props.value && !v) {
58
+ if (props.value) {
58
59
  const vs = props.value || "";
59
60
  const len = getLen(vs);
60
61
  setN(len >= props.max ? props.max : len);
@@ -54,7 +54,8 @@ const LengthInputTextArea = (props) => {
54
54
  props.onChange(e);
55
55
  }, []);
56
56
  useEffect(() => {
57
- if (props.value && !v) {
57
+ // if (props.value && !v) {
58
+ if (props.value) {
58
59
  const vs = props.value || "";
59
60
  const len = getLen(vs);
60
61
  setN(len >= props.max ? props.max : len);
@@ -84,13 +84,12 @@ const SingleFileUpload = (props) => {
84
84
  }
85
85
  }, [props.value]);
86
86
  return (React.createElement(Space.Compact, { block: true },
87
- React.createElement(Input, { value: fileUrl, onChange: (e) => {
87
+ React.createElement(Input, { addonBefore: fileUrl ? (React.createElement("a", { style: { color: "#666" }, href: fileUrl, target: "_blank" }, "view")) : null, value: fileUrl, onChange: (e) => {
88
88
  const v = e.target.value.trim();
89
89
  // setFileUrl(v);
90
90
  props.onChange && props.onChange(v);
91
91
  } }),
92
92
  React.createElement(Upload, { ref: props.uploadRef, withCredentials: true, openFileDialogOnClick: props.openFileDialogOnClick, beforeUpload: beforeUpload, name: props.name, disabled: props.disabled, headers: props.headers, data: props.data, action: action, onChange: handleChange, showUploadList: false, onRemove: (e) => {
93
- console.log(e);
94
93
  props.onRemove && props.onRemove(e);
95
94
  }, maxCount: 1 },
96
95
  React.createElement(Button, { loading: loading, disabled: props.disabled, icon: props.icon ? React.createElement(UploadOutlined, null) : null }, props.buttonText))));
@@ -156,7 +156,7 @@ const ImgUpload = (props) => {
156
156
  }, [props.value]);
157
157
  return (React.createElement(Flex, { style: { fontSize: 0 } },
158
158
  imageUrl ? (React.createElement("div", { style: { position: "relative" } },
159
- React.createElement("span", { style: {
159
+ props.disabled ? null : (React.createElement("span", { style: {
160
160
  position: "absolute",
161
161
  bottom: "6px",
162
162
  right: "2px",
@@ -169,7 +169,7 @@ const ImgUpload = (props) => {
169
169
  e.stopPropagation();
170
170
  clear();
171
171
  } },
172
- React.createElement(DeleteOutlined, { style: { fontSize: 14 } })),
172
+ React.createElement(DeleteOutlined, { style: { fontSize: 14 } }))),
173
173
  React.createElement(Img, { style: { width: "102px", height: "102px", objectFit: "contain", cursor: "pointer" }, src: imageUrl }))) : (React.createElement(Upload, { withCredentials: true, beforeUpload: beforeUpload, name: props.name, data: props.data, headers: props.headers, disabled: props.disabled, listType: "picture-card", showUploadList: false, action: action, onChange: handleChange }, uploadButton)),
174
174
  props.isTip ? (React.createElement("div", { style: { fontSize: '13px', marginLeft: '18px', lineHeight: '22px' } },
175
175
  React.createElement("p", null,
@@ -10,5 +10,5 @@ interface IProps {
10
10
  searchText?: string;
11
11
  resetText?: string;
12
12
  }
13
- declare const FiltersHorizontal: React.FC<IProps>;
14
- export default FiltersHorizontal;
13
+ declare const _default: React.NamedExoticComponent<IProps>;
14
+ export default _default;
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React, { useRef, useEffect, useState, useMemo } from 'react';
10
+ import React, { useRef, useEffect, useState, useMemo, memo } from 'react';
11
11
  import { Button, Form, Row, Col, Space } from 'antd';
12
12
  const FiltersHorizontal = ({ items, onFinish, onClear, y, setY, overMax, colOpts, searchText, resetText }) => {
13
13
  const [form] = Form.useForm(); // 该组件内form全局变量
@@ -89,4 +89,11 @@ FiltersHorizontal.defaultProps = {
89
89
  items: [],
90
90
  overMax: 8,
91
91
  };
92
- export default FiltersHorizontal;
92
+ export default memo(FiltersHorizontal);
93
+ // export default memo(FiltersHorizontal, (prevProps, nextProps) => {
94
+ // 比较关键属性是否发生变化,返回true,组件不重新渲染
95
+ // return (
96
+ // prevProps.searchText === nextProps.searchText &&
97
+ // prevProps.resetText === nextProps.resetText
98
+ // );
99
+ // });
@@ -11,10 +11,11 @@ const processTreeData = (data) => {
11
11
  return processedNode;
12
12
  });
13
13
  };
14
- const C = ({ treeCheckable, i18n, disabledParent, treeData, fieldNames, onChange, treeNodeFilterProp, multiple, value, disabled }) => {
14
+ const C = (props) => {
15
+ const { treeCheckable, i18n, disabledParent, treeData, fieldNames, treeNodeFilterProp, multiple, disabled } = props;
15
16
  // 是否禁用父级
16
17
  const treeDataFormat = disabledParent ? processTreeData(treeData || []) : treeData || [];
17
- return (React.createElement(TreeSelect, { fieldNames: fieldNames, treeData: treeDataFormat, treeCheckable: treeCheckable, showSearch: true, style: { width: '100%' }, placeholder: i18n.$t('global.please.select'), allowClear: true, treeDefaultExpandAll: true, onChange: onChange, treeNodeFilterProp: treeNodeFilterProp, multiple: multiple, value: value, disabled: disabled || false }));
18
+ return (React.createElement(TreeSelect, Object.assign({}, props, { fieldNames: fieldNames, treeData: treeDataFormat, treeCheckable: treeCheckable, showSearch: true, style: { width: '100%' }, placeholder: i18n ? i18n.$t('global.please.select') : '请选择', allowClear: true, treeDefaultExpandAll: true, treeNodeFilterProp: treeNodeFilterProp })));
18
19
  };
19
20
  C.defaultProps = {
20
21
  disabledParent: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "5.27.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "a82f6dbcc087f6175bca37478a339a7babf6cfbd"
50
+ "gitHead": "a60e99d404644dc32ddba9e8eb90363962858cc5"
51
51
  }