@ecoding/components.antd 0.4.20 → 0.4.22

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
@@ -12,7 +12,7 @@ import { Cascader } from "antd";
12
12
  import { LoadingOutlined } from "@ant-design/icons";
13
13
  import http from "../../helpers/http";
14
14
  import { isSomething } from "@ecoding/helper.is";
15
- import { jsonFormatNewKey } from "@ecoding/helper.json";
15
+ import { jsonFormatNewKey2 } from "@ecoding/helper.json";
16
16
  const setSourceChilren = (source, key, res) => {
17
17
  const ex = (ary) => {
18
18
  for (let i = 0; i < ary.length; i++) {
@@ -68,7 +68,7 @@ const AsyncCascader = memo((props) => {
68
68
  firResOrigin = firResOrigin[firIFace.fromKey];
69
69
  }
70
70
  }
71
- const res = jsonFormatNewKey(firResOrigin, firIFace.format);
71
+ const res = jsonFormatNewKey2(firResOrigin, firIFace.format);
72
72
  const opts = res;
73
73
  // 踢除第一级联的接口,剩下接口根据value数组遍历请求
74
74
  const afterFirFaces = interfaceUrls.slice(1);
@@ -114,7 +114,7 @@ const AsyncCascader = memo((props) => {
114
114
  resOrigin = resOrigin[iFace.fromKey];
115
115
  }
116
116
  }
117
- const formatRes = jsonFormatNewKey(resOrigin, iFace.format);
117
+ const formatRes = jsonFormatNewKey2(resOrigin, iFace.format);
118
118
  temp = setSourceChilren(opts, ary[i], formatRes);
119
119
  if (i < ary.length) {
120
120
  yield exx();
@@ -169,7 +169,7 @@ const AsyncCascader = memo((props) => {
169
169
  resOrigin = resOrigin[iFace.fromKey];
170
170
  }
171
171
  }
172
- const res = jsonFormatNewKey(resOrigin, iFace.format);
172
+ const res = jsonFormatNewKey2(resOrigin, iFace.format);
173
173
  targetOption.loading = false;
174
174
  targetOption.children = res;
175
175
  setOptions([...options]);
@@ -71,7 +71,7 @@ export declare class Drawers extends React.Component<IDrawerProps, IDrawerProps>
71
71
  width?: string | number | undefined;
72
72
  zIndex?: number | undefined;
73
73
  height?: string | number | undefined;
74
- placement?: import("rc-drawer/lib/DrawerPopup").Placement | undefined;
74
+ placement?: import("@rc-component/drawer/lib/DrawerPopup").Placement | undefined;
75
75
  okDanger?: boolean | undefined;
76
76
  title?: React.ReactNode;
77
77
  okType?: "link" | "text" | "dashed" | "default" | "primary" | undefined;
@@ -89,6 +89,9 @@ export default {
89
89
  if (props.footer !== null && !props.footer) {
90
90
  props.footer = "";
91
91
  }
92
+ if (props.extra !== null && !props.extra) {
93
+ props.extra = "";
94
+ }
92
95
  if (!props.okText) {
93
96
  props.okText = props.i18n ? props.i18n.$t('global.save') : "保存";
94
97
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  interface IProps {
3
3
  value?: string | string[];
4
4
  type?: 'secondary' | 'success' | 'warning' | 'danger';
5
- splitDot?: string;
5
+ separator?: string;
6
6
  empty?: React.ReactNode;
7
7
  disabled?: boolean;
8
8
  mark?: boolean;
@@ -25,7 +25,7 @@ const C = (_a) => {
25
25
  if (!Array.isArray(props.value)) {
26
26
  return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(props.value) ? "processing" : "error", text: props.value }));
27
27
  }
28
- return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
28
+ return (React.createElement(Space, { separator: props.separator, wrap: true }, props.value.map((item) => {
29
29
  return (React.createElement(Badge, { status: opts.status ? opts.status : isSomething(item) ? "processing" : "error", text: item }));
30
30
  })));
31
31
  }
@@ -34,7 +34,7 @@ const C = (_a) => {
34
34
  if (!Array.isArray(props.value)) {
35
35
  return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, props.value));
36
36
  }
37
- return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
37
+ return (React.createElement(Space, { separator: props.separator, wrap: true }, props.value.map((item) => {
38
38
  return (React.createElement(Tag, { style: { marginInlineEnd: 0 }, color: opts.color, bordered: opts.bordered }, item));
39
39
  })));
40
40
  }
@@ -46,7 +46,7 @@ const C = (_a) => {
46
46
  return (React.createElement(Typography.Text, { type: props.type, italic: props.italic, strong: props.strong, delete: props.delete, underline: props.underline, disabled: props.disabled, mark: props.mark, code: props.code, keyboard: props.keyboard }, props.value));
47
47
  }
48
48
  }
49
- return (React.createElement(Space, { split: props.splitDot, wrap: true }, props.value.map((item) => {
49
+ return (React.createElement(Space, { separator: props.separator, wrap: true }, props.value.map((item) => {
50
50
  if (props.link) {
51
51
  return React.createElement(Typography.Link, Object.assign({}, props.link), item);
52
52
  }
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import { isSomething } from '@ecoding/helper.is';
3
3
  import { LinkOutlined, CloudDownloadOutlined, EyeOutlined } from '@ant-design/icons';
4
4
  import { Typography, Popover, Tag, Checkbox, Space } from 'antd';
5
- import { jsonFormatNewKey } from "@ecoding/helper.json";
5
+ import { jsonFormatNewKey2 } from "@ecoding/helper.json";
6
6
  import http from "../../helpers/http";
7
7
  const InfosRender = ({ infos, i18n, format, batchDownload }) => {
8
8
  const [checkedList, setCheckedList] = useState([]);
@@ -78,7 +78,7 @@ const InfosRender = ({ infos, i18n, format, batchDownload }) => {
78
78
  };
79
79
  return (React.createElement("ul", { style: { width: 300, overflow: "hidden" } },
80
80
  React.createElement(Checkbox.Group, { style: { display: "block" }, onChange: checkChange, value: checkedList }, infos.map((info, i) => {
81
- info = format ? jsonFormatNewKey(info, format) : info;
81
+ info = format ? jsonFormatNewKey2(info, format) : info;
82
82
  return (React.createElement("li", { style: { marginBottom: 6 }, key: i },
83
83
  React.createElement("div", { style: style },
84
84
  infos.length > 1 ? (React.createElement(Checkbox, { value: info.url },
@@ -105,7 +105,7 @@ const C = ({ value, empty, render, i18n, batchDownload, format }) => {
105
105
  return React.createElement(React.Fragment, null, empty || '-');
106
106
  }
107
107
  if (Array.isArray(value)) {
108
- return (React.createElement(Popover, { destroyTooltipOnHide: true, placement: "right", trigger: "hover", title: "Uploaded", content: render ? render(value) : React.createElement(InfosRender, { batchDownload: batchDownload, format: format, i18n: i18n, infos: value }) },
108
+ return (React.createElement(Popover, { destroyOnHidden: true, placement: "right", trigger: "hover", title: "Uploaded", content: render ? render(value) : React.createElement(InfosRender, { batchDownload: batchDownload, format: format, i18n: i18n, infos: value }) },
109
109
  React.createElement(Tag, { icon: React.createElement(EyeOutlined, null), color: "processing" }, i18n ? i18n.$t('global.attachment', '附件') : '附件')));
110
110
  }
111
111
  if (typeof value === 'string') {
@@ -133,7 +133,7 @@ const C = ({ columns, rules, tStyle, name, hideHeader, hideBottom, operation, i1
133
133
  column.tooltip ? (React.createElement(Tooltip, { placement: "top", title: column.tooltip || undefined },
134
134
  React.createElement(QuestionCircleOutlined, { style: { paddingLeft: 4, color: "rgba(0, 0, 0, 0.45)" } }))) : null));
135
135
  }),
136
- (operation === null || operation === void 0 ? void 0 : operation.hide) ? null : (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, i18n ? i18n.$t("global.operation", "操作") : "操作"))))),
136
+ (operation === null || operation === void 0 ? void 0 : operation.hide) ? null : (React.createElement("th", { style: Object.assign({}, thStyle, { right: 0 }) }, i18n ? i18n.$t("global.operation", "操作") : `${(operation === null || operation === void 0 ? void 0 : operation.title) || "操作"}`))))),
137
137
  React.createElement("tbody", null,
138
138
  React.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: ({ active, over }) => {
139
139
  if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
@@ -91,6 +91,7 @@ export declare class Modals extends React.Component<IModalProps> {
91
91
  } | undefined;
92
92
  loading: boolean;
93
93
  };
94
+ update(props: IModalProps): void;
94
95
  cancel: () => void;
95
96
  ok: () => void;
96
97
  render(): JSX.Element;
@@ -44,6 +44,9 @@ export class Modals extends React.Component {
44
44
  });
45
45
  };
46
46
  }
47
+ update(props) {
48
+ this.setState(props);
49
+ }
47
50
  render() {
48
51
  // if (!this.props.visible) return null;
49
52
  return (React.createElement(Modal, { className: this.state.className, wrapClassName: this.state.wrapClassName, open: this.state.open, style: this.state.style, width: this.state.width, height: this.state.height ? this.state.height : undefined, 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, destroyOnHidden: true, keyboard: false, footer: this.state.footer === null ? null : this.state.footer ? (this.state.footer) : (React.createElement(React.Fragment, null,
@@ -18,11 +18,11 @@ const InfosRender = ({ infos, setInfos, onChange }) => {
18
18
  const temp = infos.concat([]);
19
19
  temp.splice(i, 1);
20
20
  setInfos(temp);
21
- onChange(temp);
21
+ onChange && onChange(temp);
22
22
  };
23
23
  if (infos && infos.length > 0) {
24
24
  return (React.createElement("ul", null, infos.map((info, i) => {
25
- return (React.createElement("li", { style: {
25
+ return (React.createElement("li", { key: info.url, style: {
26
26
  display: "flex",
27
27
  justifyContent: "space-between",
28
28
  maxWidth: 250
@@ -35,7 +35,7 @@ const InfosRender = ({ infos, setInfos, onChange }) => {
35
35
  React.createElement(DeleteOutlined, null))));
36
36
  })));
37
37
  }
38
- return React.createElement(Empty, { imageStyle: { height: 30 }, image: Empty.PRESENTED_IMAGE_SIMPLE });
38
+ return React.createElement(Empty, { style: { height: 30 }, image: Empty.PRESENTED_IMAGE_SIMPLE });
39
39
  };
40
40
  const MultipleUpload = (props) => {
41
41
  const [infos, setInfos] = useState([]);
@@ -125,7 +125,7 @@ const MultipleUpload = (props) => {
125
125
  props.onRemove && props.onRemove(e);
126
126
  }, maxCount: props.maxCount },
127
127
  React.createElement(Button, { disabled: props.disabled, icon: props.icon ? React.createElement(UploadOutlined, null) : null }, props.buttonText)),
128
- React.createElement(Popover, { destroyTooltipOnHide: true, open: open, placement: "right", trigger: "hover", title: "Uploaded", content: React.createElement(InfosRender, { onChange: props.onChange, infos: infos, setInfos: setInfos }) },
128
+ React.createElement(Popover, { destroyOnHidden: true, open: open, placement: "right", trigger: "hover", title: "Uploaded", content: React.createElement(InfosRender, { onChange: props.onChange, infos: infos, setInfos: setInfos }) },
129
129
  React.createElement(Button, { icon: React.createElement(EllipsisOutlined, null) }))));
130
130
  };
131
131
  MultipleUpload.defaultProps = {
@@ -137,7 +137,7 @@ MultipleUpload.defaultProps = {
137
137
  maxCount: 10,
138
138
  headers: undefined,
139
139
  buttonText: 'Upload',
140
- type: 'jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, mkv, mov, avi, xlsx, xls, doc, docx, ppt, pptx, rar, 7z',
140
+ type: 'jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, mkv, mov, avi, xlsx, xls, csv, yml, py, doc, docx, ppt, pptx, rar, 7z',
141
141
  style: {}
142
142
  };
143
143
  export default MultipleUpload;
@@ -70,7 +70,7 @@ const C = (_a) => {
70
70
  setV(value);
71
71
  }
72
72
  }, [value]);
73
- return (React.createElement(Dropdown, { destroyPopupOnHide: true, open: open, menu: { items, onClick }, overlayStyle: { maxHeight: rest.maxHeight, overflowY: "auto", boxShadow: "0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)" } },
73
+ return (React.createElement(Dropdown, { destroyOnHidden: true, open: open, menu: { items, onClick }, overlayStyle: { maxHeight: rest.maxHeight, overflowY: "auto", boxShadow: "0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)" } },
74
74
  React.createElement("div", { style: { position: "relative" } },
75
75
  React.createElement(Input, Object.assign({}, rest, { value: v, placeholder: placeholder, onChange: keyUpHandler, onBlur: () => {
76
76
  setTimeout(() => {
@@ -84,9 +84,8 @@ const SingleFileUpload = (props) => {
84
84
  }
85
85
  }, [props.value]);
86
86
  return (React.createElement(Space.Compact, { block: true },
87
- React.createElement(Input, { addonBefore: fileUrl ? (React.createElement("a", { style: { color: "#666" }, href: fileUrl, target: "_blank" }, "view")) : null, 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
- // setFileUrl(v);
90
89
  props.onChange && props.onChange(v);
91
90
  } }),
92
91
  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) => {
@@ -101,7 +100,7 @@ SingleFileUpload.defaultProps = {
101
100
  data: {},
102
101
  actionParams: {},
103
102
  buttonText: "Upload",
104
- type: "jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, mkv, mov, avi, xlsx, xls, doc, docx, ppt, pptx, rar, 7z",
103
+ type: "jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, mkv, mov, avi, xlsx, xls, csv, yml, py, doc, docx, ppt, pptx, rar, 7z",
105
104
  style: {}
106
105
  };
107
106
  export default SingleFileUpload;
@@ -11,7 +11,7 @@ interface IProps {
11
11
  header?: React.ReactNode;
12
12
  buttonArea?: React.ReactNode;
13
13
  scrollY?: string | number;
14
- scrollX?: string | number;
14
+ scrollX?: string | number | 'max-content';
15
15
  filters?: {
16
16
  overMax?: number;
17
17
  colOpts?: ColProps;
@@ -11,7 +11,6 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
11
11
  const [y, setY] = useState(scrollY);
12
12
  const [innerColumns, setColumns] = useState(columns);
13
13
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
14
- const [selectedRows, setSelectedRows] = useState([]);
15
14
  const flexColumnStyle = {
16
15
  display: 'flex',
17
16
  height: '100%',
@@ -114,7 +113,7 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
114
113
  }
115
114
  }, 100);
116
115
  }
117
- }, [header, loading, innerColumns]);
116
+ }, [header, loading]);
118
117
  useEffect(() => {
119
118
  if (selectKeys && selectKeys.length > 0 && !isEqual(selectedRowKeys, selectKeys)) {
120
119
  setSelectedRowKeys(selectKeys);
@@ -15,6 +15,7 @@ interface IProps {
15
15
  multiple?: boolean;
16
16
  treeCheckable?: boolean;
17
17
  onChange?: (value: any) => void;
18
+ onSearch?: (value: any) => void;
18
19
  }
19
20
  declare const C: React.FC<IProps>;
20
21
  export default C;
@@ -13,7 +13,7 @@ const processTreeData = (data) => {
13
13
  });
14
14
  };
15
15
  const C = (props) => {
16
- const { treeCheckable, i18n, disabledParent, treeData, fieldNames, treeNodeFilterProp, onChange, emptyType } = props;
16
+ const { treeCheckable, i18n, onSearch, disabledParent, treeData, fieldNames, treeNodeFilterProp, onChange, emptyType } = props;
17
17
  // 是否禁用父级
18
18
  const treeDataFormat = disabledParent ? processTreeData(treeData || []) : treeData || [];
19
19
  const changeHandler = (v) => {
@@ -46,7 +46,10 @@ const C = (props) => {
46
46
  }
47
47
  onChange && onChange(v);
48
48
  };
49
- 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, onChange: changeHandler })));
49
+ return (React.createElement(TreeSelect, Object.assign({}, props, { fieldNames: fieldNames, treeData: treeDataFormat, treeCheckable: treeCheckable, showSearch: {
50
+ onSearch: onSearch || undefined,
51
+ treeNodeFilterProp: treeNodeFilterProp || undefined
52
+ }, style: { width: '100%' }, placeholder: i18n ? i18n.$t('global.please.select') : '请选择', allowClear: true, treeDefaultExpandAll: true, treeNodeFilterProp: treeNodeFilterProp, onChange: changeHandler })));
50
53
  };
51
54
  C.defaultProps = {
52
55
  disabledParent: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -44,8 +44,8 @@
44
44
  "@ecoding/helper.request": "*",
45
45
  "@ecoding/helper.request.hook": "*",
46
46
  "@ecoding/helper.url": "*",
47
- "antd": "5.27.0",
47
+ "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "571168c21c039e8eed8da932957c8b567fa22abb"
50
+ "gitHead": "92f998a40fb7a5d3f41530d8533ca3eed9fd22a0"
51
51
  }