@ecoding/components.antd 0.4.15 → 0.4.17

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.
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  interface IComfirm {
3
3
  title?: string;
4
+ i18n?: any;
4
5
  content?: React.ReactNode;
5
6
  okText?: string;
6
7
  width?: number;
@@ -16,10 +16,10 @@ const confirm = {
16
16
  Modal.confirm({
17
17
  okType: opts.okType || "danger",
18
18
  icon: React.createElement(ExclamationCircleOutlined, null),
19
- title: opts.title || "确定要删除吗?",
19
+ title: opts.title || opts.i18n ? opts.i18n.$t('global.del.tip') : "确定要删除吗?",
20
20
  content: opts.content || "",
21
- okText: opts.okText || "确定",
22
- cancelText: opts.cancelText || "取消",
21
+ okText: opts.okText || opts.i18n ? opts.i18n.$t('global.confirm') : "确定",
22
+ cancelText: opts.cancelText || opts.i18n ? opts.i18n.$t('global.cancel') : "取消",
23
23
  width: opts.width || 450,
24
24
  onOk() {
25
25
  loading = true;
@@ -51,8 +51,8 @@ const confirm = {
51
51
  title: opts.title || "标题",
52
52
  content: opts.content || "",
53
53
  okType: opts.okType || "primary",
54
- okText: opts.okText || "确定",
55
- cancelText: opts.cancelText || "取消",
54
+ okText: opts.okText || opts.i18n ? opts.i18n.$t('global.confirm') : "确定",
55
+ cancelText: opts.cancelText || opts.i18n ? opts.i18n.$t('global.cancel') : "取消",
56
56
  width: opts.width || 450,
57
57
  onOk() {
58
58
  loading = true;
@@ -3,6 +3,7 @@ import type { DrawerProps } from "antd";
3
3
  export interface IDrawerProps {
4
4
  key?: string;
5
5
  id?: string;
6
+ i18n?: any;
6
7
  className?: string;
7
8
  closable?: boolean;
8
9
  maskClosable?: boolean;
@@ -45,8 +46,6 @@ export declare class Drawers extends React.Component<IDrawerProps, IDrawerProps>
45
46
  okType: string;
46
47
  placement: string;
47
48
  okDanger: boolean;
48
- okText: string;
49
- cancelText: string;
50
49
  maskClosable: boolean;
51
50
  closable: boolean;
52
51
  footer: null;
@@ -64,6 +63,7 @@ export declare class Drawers extends React.Component<IDrawerProps, IDrawerProps>
64
63
  state: {
65
64
  key?: string | undefined;
66
65
  id?: string | undefined;
66
+ i18n?: any;
67
67
  className?: string | undefined;
68
68
  closable?: boolean | undefined;
69
69
  maskClosable?: boolean | undefined;
@@ -68,8 +68,6 @@ Drawers.defaultProps = {
68
68
  okType: "primary",
69
69
  placement: "right",
70
70
  okDanger: false,
71
- okText: "保存",
72
- cancelText: "取消",
73
71
  maskClosable: true,
74
72
  closable: true,
75
73
  footer: null,
@@ -92,10 +90,10 @@ export default {
92
90
  props.footer = "";
93
91
  }
94
92
  if (!props.okText) {
95
- props.okText = "保存";
93
+ props.okText = props.i18n ? props.i18n.$t('global.save') : "保存";
96
94
  }
97
95
  if (!props.cancelText) {
98
- props.cancelText = "取消";
96
+ props.cancelText = props.i18n ? props.i18n.$t('global.cancel') : "取消";
99
97
  }
100
98
  InjectNotification.notice(React.createElement(Drawers, Object.assign({}, props, { key: props.id, ref: ref => InjectNotification[props.id] = ref })));
101
99
  },
@@ -2,6 +2,7 @@ import React from "react";
2
2
  export interface IModalProps {
3
3
  key?: string;
4
4
  id?: string;
5
+ i18n?: any;
5
6
  className?: string;
6
7
  wrapClassName?: string;
7
8
  style?: React.CSSProperties;
@@ -42,8 +43,6 @@ export declare class Modals extends React.Component<IModalProps> {
42
43
  mask: boolean;
43
44
  title: string;
44
45
  okType: string;
45
- okText: string;
46
- cancelText: string;
47
46
  okDanger: boolean;
48
47
  closable: boolean;
49
48
  maskClosable: boolean;
@@ -61,6 +60,7 @@ export declare class Modals extends React.Component<IModalProps> {
61
60
  state: {
62
61
  key?: string | undefined;
63
62
  id?: string | undefined;
63
+ i18n?: any;
64
64
  className?: string | undefined;
65
65
  wrapClassName?: string | undefined;
66
66
  style?: React.CSSProperties | undefined;
@@ -63,8 +63,6 @@ Modals.defaultProps = {
63
63
  mask: true,
64
64
  title: "标题",
65
65
  okType: "primary",
66
- okText: "保存",
67
- cancelText: "取消",
68
66
  okDanger: false,
69
67
  closable: true,
70
68
  maskClosable: true,
@@ -87,10 +85,10 @@ export default {
87
85
  props.footer = "";
88
86
  }
89
87
  if (!props.okText) {
90
- props.okText = "保存";
88
+ props.okText = props.i18n ? props.i18n.$t('global.save') : "保存";
91
89
  }
92
90
  if (!props.cancelText) {
93
- props.cancelText = "取消";
91
+ props.cancelText = props.i18n ? props.i18n.$t('global.cancel') : "取消";
94
92
  }
95
93
  InjectNotification.notice(React.createElement(Modals, Object.assign({}, props, { key: props.id, ref: ref => InjectNotification[props.id] = ref })));
96
94
  },
@@ -24,10 +24,10 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
24
24
  const [openFilter, setOpenFilter] = useState(false);
25
25
  const [openColumnFilter, setOpenColumnFilter] = useState(false);
26
26
  const columnsTitleStr = useMemo(() => {
27
- return columnsTitle ? columnsTitle : i18n ? i18n.$t('global.filter') : '显示列';
27
+ return columnsTitle ? columnsTitle : i18n ? i18n.$t('global.column') : '显示列';
28
28
  }, []);
29
29
  const filterTitleStr = useMemo(() => {
30
- return filterTitle ? filterTitle : i18n ? i18n.$t('global.column') : '筛选';
30
+ return filterTitle ? filterTitle : i18n ? i18n.$t('global.filter') : '筛选';
31
31
  }, []);
32
32
  const hideOpenFilter = () => {
33
33
  setOpenFilter(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.15",
3
+ "version": "0.4.17",
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": "894ee1452efeb338ca98327cdb6d27f8089d67ea"
50
+ "gitHead": "9b99649b98e3b6276244f42b2b49c13000dcf841"
51
51
  }