@zat-design/sisyphus-react 4.5.6-beta.2 → 4.5.6-beta.3

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.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * iframe: 400
3
+ */
4
+
5
+ import { useState } from 'react';
6
+ import { Button, Space } from 'antd';
7
+ import { ProConfigProvider, ProForm } from '@zat-design/sisyphus-react';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const LocaleDemo = () => {
10
+ const [locale, setLocale] = useState(localStorage.getItem('locale') || 'zh-CN');
11
+ const handleChange = value => {
12
+ setLocale(value);
13
+ localStorage.setItem('locale', value);
14
+ window.location.reload();
15
+ };
16
+ return /*#__PURE__*/_jsxs(Space, {
17
+ direction: "vertical",
18
+ size: 16,
19
+ style: {
20
+ width: '100%'
21
+ },
22
+ children: [/*#__PURE__*/_jsxs(Space, {
23
+ children: [/*#__PURE__*/_jsx(Button, {
24
+ type: locale === 'zh-CN' ? 'primary' : 'default',
25
+ onClick: () => handleChange('zh-CN'),
26
+ children: "\u4E2D\u6587"
27
+ }), /*#__PURE__*/_jsx(Button, {
28
+ type: locale === 'en-US' ? 'primary' : 'default',
29
+ onClick: () => handleChange('en-US'),
30
+ children: "English"
31
+ })]
32
+ }), /*#__PURE__*/_jsx(ProConfigProvider, {
33
+ locale: locale,
34
+ children: /*#__PURE__*/_jsx(ProForm, {
35
+ columns: [{
36
+ type: 'Input',
37
+ label: locale === 'zh-CN' ? '姓名' : 'Name',
38
+ name: 'name',
39
+ required: true
40
+ }, {
41
+ type: 'Select',
42
+ label: locale === 'zh-CN' ? '状态' : 'Status',
43
+ name: 'status',
44
+ fieldProps: {
45
+ options: [{
46
+ label: locale === 'zh-CN' ? '启用' : 'Enabled',
47
+ value: '1'
48
+ }, {
49
+ label: locale === 'zh-CN' ? '禁用' : 'Disabled',
50
+ value: '0'
51
+ }]
52
+ }
53
+ }]
54
+ })
55
+ })]
56
+ });
57
+ };
58
+ export default LocaleDemo;
@@ -9,6 +9,7 @@ import dayjs from 'dayjs';
9
9
  import React from 'react';
10
10
  import { useProConfig } from "../../../../ProConfigProvider";
11
11
  import locale from "../../../../locale";
12
+ import enUS from "../../../../locale/en_US";
12
13
  import ProForm from "../../../../ProForm";
13
14
  import Container from "../../Container";
14
15
  import { useDateRange } from "./useDateRange";
@@ -35,13 +36,7 @@ const getDefaultFormat = picker => {
35
36
 
36
37
  // 获取默认快捷选项(presets 格式)
37
38
  const getDefaultPresets = () => {
38
- const rangeLabels = locale?.RangePicker?.ranges || {
39
- today: '今天',
40
- lastWeek: '近1周',
41
- lastMonth: '近1月',
42
- last3Months: '近3月',
43
- lastYear: '近1年'
44
- };
39
+ const rangeLabels = locale?.RangePicker?.ranges || enUS.RangePicker.ranges;
45
40
  return [{
46
41
  label: rangeLabels.today,
47
42
  value: [dayjs().startOf('day'), dayjs().endOf('day')]
@@ -3,10 +3,11 @@ import _isFunction from "lodash/isFunction";
3
3
  import React from 'react';
4
4
  import { Modal } from 'antd';
5
5
  import ProForm from "../../index";
6
+ import locale from "../../../locale";
6
7
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
7
8
  const defaultConfirmProps = {
8
- title: '操作提示',
9
- content: '确定要修改该字段吗?'
9
+ title: locale.ProForm.confirmTitle,
10
+ content: locale.ProForm.confirmContent
10
11
  };
11
12
  const ConfirmWrapper = props => {
12
13
  const {
@@ -115,7 +115,7 @@ const RenderFields = props => {
115
115
  }
116
116
  if (component && /*#__PURE__*/React.isValidElement(component)) {
117
117
  const newComponent = component;
118
- const isProEditTable = newComponent?.props?.onlyOneLineMsg === '请先保存数据';
118
+ const isProEditTable = newComponent?.props?.onlyOneLineMsg != null;
119
119
  TargetComponent = _isView ? viewRenderHandle || '' : component;
120
120
  // 可编辑表格内部支持
121
121
  if (isProEditTable) {
@@ -4,6 +4,7 @@ import { Space, Tooltip } from 'antd';
4
4
  import classnames from 'classnames';
5
5
  import Copy from "../Copy";
6
6
  import { checkDescribeItemsHidden, getTagKey, getDescribeValueKey } from "../../utils";
7
+ import locale, { formatMessage } from "../../../../../locale";
7
8
 
8
9
  /** 描述项里的单条值(link / copyable / tag 组合),对应 items 数组元素 */
9
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -73,11 +74,13 @@ export const DescribeItems = ({
73
74
  'pro-header-describe-items': true,
74
75
  'pro-header-describe-items-more': items.length >= 2
75
76
  }),
76
- children: [items?.length > 3 ? `共${items?.length}个,` : null, items.map((item, itemIndex) => /*#__PURE__*/_jsxs("span", {
77
+ children: [items?.length > 3 ? formatMessage(locale.ProHeader.itemsCountPrefix, {
78
+ count: items.length
79
+ }) : null, items.map((item, itemIndex) => /*#__PURE__*/_jsxs("span", {
77
80
  children: [/*#__PURE__*/_jsx(DescribeValue, {
78
81
  ...item,
79
82
  parentKey: parentKey
80
- }), items?.length !== itemIndex + 1 ? ' 、' : null]
83
+ }), items?.length !== itemIndex + 1 ? locale.ProHeader.itemsSeparator : null]
81
84
  }, getDescribeValueKey(item, parentKey, itemIndex))), itemsHidden ? /*#__PURE__*/_jsx("span", {
82
85
  className: "pro-header-describe-items-omit",
83
86
  children: "..."
@@ -1,9 +1,11 @@
1
1
  import { useState, useCallback } from 'react';
2
2
  import { Dropdown } from 'antd';
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import locale from "../../../../locale";
4
+
4
5
  /**
5
6
  * 右键菜单组件 - 兼容Antd 4.x和5.x
6
7
  */
8
+ import { jsx as _jsx } from "react/jsx-runtime";
7
9
  function TabContextMenu({
8
10
  tabId,
9
11
  children,
@@ -53,17 +55,17 @@ function TabContextMenu({
53
55
  // 默认右键菜单配置 - 统一使用items方式(antd 4.20+都支持)
54
56
  const defaultMenuItems = [{
55
57
  key: 'close',
56
- label: '关闭',
58
+ label: locale.ProLayout.tabMenuClose,
57
59
  disabled: !closable
58
60
  }, {
59
61
  key: 'closeOthers',
60
- label: '关闭其他'
62
+ label: locale.ProLayout.tabMenuCloseOthers
61
63
  }, {
62
64
  key: 'closeRight',
63
- label: '关闭右侧标签页'
65
+ label: locale.ProLayout.tabMenuCloseRight
64
66
  }, {
65
67
  key: 'closeAll',
66
- label: '关闭全部'
68
+ label: locale.ProLayout.tabMenuCloseAll
67
69
  }];
68
70
 
69
71
  // 合并自定义菜单项和默认菜单项
@@ -7,6 +7,7 @@ import { CheckOutlined } from '@ant-design/icons';
7
7
  import { ReactSVG } from 'react-svg';
8
8
  import { isEmpty, isEllipsisActive } from "../../../utils";
9
9
  import copySvg from "../../../assets/copy.svg";
10
+ import locale from "../../../locale";
10
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
12
  const {
12
13
  Paragraph,
@@ -198,7 +199,7 @@ const RenderColumn = props => {
198
199
  className: "drag-icon",
199
200
  src: copySvg
200
201
  }, "copy-icon"), /*#__PURE__*/_jsx(CheckOutlined, {}, "copied-icon")],
201
- tooltips: ['复制', '复制成功']
202
+ tooltips: locale.ProHeader.copyTooltips
202
203
  },
203
204
  children: node
204
205
  })
@@ -9,6 +9,7 @@ import WORD from "../style/icon-word.png";
9
9
  import lookSvg from "../../assets/look.svg";
10
10
  import deleteSvg from "../../assets/delete.svg";
11
11
  import downloadSvg from "../../assets/download.svg";
12
+ import locale from "../../locale";
12
13
 
13
14
  /**
14
15
  * @description: b 转成 Kb
@@ -119,10 +120,10 @@ const FileItem = props => {
119
120
  src: lookSvg
120
121
  })
121
122
  }), _showRemoveIcon && !disabled && (isConfirmDelete ? /*#__PURE__*/_jsx(Popconfirm, {
122
- title: "\u786E\u5B9A\u5220\u9664?",
123
+ title: locale.ProUpload.deleteConfirmTitle,
123
124
  onConfirm: _onRemove,
124
- okText: "\u786E\u8BA4",
125
- cancelText: "\u53D6\u6D88",
125
+ okText: locale.ProDrawerForm.confirm,
126
+ cancelText: locale.ProDrawerForm.cancel,
126
127
  children: /*#__PURE__*/_jsx(Button, {
127
128
  type: "link",
128
129
  className: "file-action-item",
@@ -10,6 +10,10 @@ declare const _default: {
10
10
  tipAlt: string;
11
11
  closeAlt: string;
12
12
  tabMaxLimitMessage: string;
13
+ tabMenuClose: string;
14
+ tabMenuCloseOthers: string;
15
+ tabMenuCloseRight: string;
16
+ tabMenuCloseAll: string;
13
17
  };
14
18
  ProHeader: {
15
19
  versionTitle: string;
@@ -18,6 +22,8 @@ declare const _default: {
18
22
  confirmTitle: string;
19
23
  backText: string;
20
24
  copyTooltips: string[];
25
+ itemsCountPrefix: string;
26
+ itemsSeparator: string;
21
27
  };
22
28
  ProDownload: {
23
29
  errorMessage: string;
@@ -39,6 +45,8 @@ declare const _default: {
39
45
  formListConfirmMessage: string;
40
46
  noData: string;
41
47
  moreItems: string;
48
+ confirmTitle: string;
49
+ confirmContent: string;
42
50
  };
43
51
  ProAction: {
44
52
  errorMessage: string;
@@ -80,6 +88,7 @@ declare const _default: {
80
88
  view: string;
81
89
  delete: string;
82
90
  download: string;
91
+ deleteConfirmTitle: string;
83
92
  };
84
93
  ProStep: {
85
94
  catalogue: string;
@@ -4,45 +4,53 @@ export default {
4
4
  confirm: 'Confirm',
5
5
  cancel: 'Cancel',
6
6
  isSureClose: 'Confirm to close the current page',
7
- secondTipsWhenSave: 'Close the current page content will not be saved, need to click the Save button to save'
7
+ secondTipsWhenSave: 'Unsaved changes will be lost. Click Save to keep your changes.'
8
8
  },
9
9
  ProLayout: {
10
10
  tipAlt: 'Tips',
11
11
  closeAlt: 'Close',
12
- tabMaxLimitMessage: 'Menu tabs cannot exceed the maximum limit of {max}'
12
+ tabMaxLimitMessage: 'Menu tabs cannot exceed the maximum limit of {max}',
13
+ tabMenuClose: 'Close',
14
+ tabMenuCloseOthers: 'Close others',
15
+ tabMenuCloseRight: 'Close tabs to the right',
16
+ tabMenuCloseAll: 'Close all'
13
17
  },
14
18
  ProHeader: {
15
19
  versionTitle: 'Version number',
16
20
  confirm: 'Confirm',
17
21
  cancel: 'Cancel',
18
22
  confirmTitle: 'Confirm return?',
19
- backText: 'Return',
20
- copyTooltips: ['Copy', 'Copy successfully']
23
+ backText: 'Back',
24
+ copyTooltips: ['Copy', 'Copied successfully'],
25
+ itemsCountPrefix: '{count} items in total, ',
26
+ itemsSeparator: ', '
21
27
  },
22
28
  ProDownload: {
23
29
  errorMessage: 'Request failed!'
24
30
  },
25
31
  ProForm: {
26
32
  unfold: 'Unfold',
27
- packUp: 'PackUp',
33
+ packUp: 'Collapse',
28
34
  inputPlaceholder: 'Please enter',
29
35
  treeSelectPlaceholder: 'Please select',
30
36
  selectPlaceHolder: 'Please select',
31
37
  switchText: ['Yes', 'No'],
32
- ruleStartEndText: ['start value', 'end value'],
38
+ ruleStartEndText: ['Start value', 'End value'],
33
39
  search: 'Search',
34
40
  reset: 'Reset',
35
- ruleText: 'correct',
36
- completeText: 'enter in full',
41
+ ruleText: 'valid',
42
+ completeText: 'Please complete all fields',
37
43
  halfRuleText: 'Enter the value of ({total})',
38
44
  formListActions: ['Add', 'Delete', 'Copy', 'Move up', 'Move down', 'Add a new line', 'Click add'],
39
- formListConfirmMessage: 'Are you sure delete it?',
45
+ formListConfirmMessage: 'Are you sure you want to delete?',
40
46
  noData: 'No data',
41
- moreItems: '{count} more...'
47
+ moreItems: '{count} more...',
48
+ confirmTitle: 'Confirm action',
49
+ confirmContent: 'Are you sure you want to modify this field?'
42
50
  },
43
51
  ProAction: {
44
52
  errorMessage: 'The configuration config for ProAction must be data',
45
- defaultTitle: 'Are you sure delete it?'
53
+ defaultTitle: 'Are you sure you want to delete?'
46
54
  },
47
55
  ProTable: {
48
56
  noData: 'No data',
@@ -51,7 +59,7 @@ export default {
51
59
  transformResponseMsg: 'Please return the correct data type',
52
60
  deselect: 'Deselect',
53
61
  selectCurPage: 'Select the current page ({total} items)',
54
- selectAll: 'Select All ({total} items)',
62
+ selectAll: 'Select all ({total} items)',
55
63
  hasSelected: '{selectedNum} items selected',
56
64
  total: '{total} items in total'
57
65
  },
@@ -61,25 +69,26 @@ export default {
61
69
  },
62
70
  ProTree: {
63
71
  inputPlaceholder: 'Please enter',
64
- unExpand: 'Put it all away',
72
+ unExpand: 'Collapse all',
65
73
  expand: 'Expand all',
66
74
  all: 'Select all',
67
- emptyTips: "what you were looking for couldn't be found"
75
+ emptyTips: 'No results found'
68
76
  },
69
77
  ProUpload: {
70
78
  exampleTitle: 'View sample',
71
- errorInfoExt: 'Only {} format files are supported',
79
+ errorInfoExt: 'Supported file formats:',
72
80
  errorInfoSize: 'File size cannot exceed ',
73
81
  buttonText: 'Upload',
74
82
  draggerSelect: 'Select file',
75
83
  draggerDelete: 'Delete',
76
- draggerTips: 'Click or drag file to this area to upload',
77
- draggerBtnTxt: 'Click to upload',
78
- draggerFileExt: 'Support for extensions',
79
- draggerLimitless: 'Limitless',
84
+ draggerTips: 'Click or drag file to this area to ',
85
+ draggerBtnTxt: 'upload',
86
+ draggerFileExt: 'Supported extensions',
87
+ draggerLimitless: 'No limit',
80
88
  view: 'View',
81
89
  delete: 'Delete',
82
- download: 'Download'
90
+ download: 'Download',
91
+ deleteConfirmTitle: 'Are you sure you want to delete?'
83
92
  },
84
93
  ProStep: {
85
94
  catalogue: 'Catalogue'
@@ -138,27 +147,27 @@ export default {
138
147
  clearAll: 'Clear all',
139
148
  checkNumber: '{num} items selected',
140
149
  noFinal: 'Oops, the content you are looking for is not found.',
141
- specifyMode: ['all', 'specify']
150
+ specifyMode: ['All', 'Specify']
142
151
  },
143
152
  ProTimeLimit: {
144
- foreverText: 'long term'
153
+ foreverText: 'Permanent'
145
154
  },
146
155
  ProThemeTools: {
147
- title: 'Global style customization ',
148
- copySuccess: 'Copy success! ',
156
+ title: 'Global style customization',
157
+ copySuccess: 'Copied successfully!',
149
158
  layout: 'Layout',
150
- layoutMode: ['Compact ', 'Regular', 'Loose'],
159
+ layoutMode: ['Compact', 'Regular', 'Loose'],
151
160
  themeColor: 'Theme color',
152
161
  formLabel: 'Form label',
153
162
  bigText: 'Large text mode',
154
- flex: ['Left align ', 'Right align'],
155
- switchText: ['on', 'off'],
163
+ flex: ['Left align', 'Right align'],
164
+ switchText: ['On', 'Off'],
156
165
  tableBorder: 'Table border',
157
- tableStripe: 'Table zebra',
166
+ tableStripe: 'Table zebra stripe',
158
167
  reset: 'Reset'
159
168
  },
160
169
  ProViewer: {
161
- preview: 'preview'
170
+ preview: 'Preview'
162
171
  },
163
172
  ProIcon: {
164
173
  language: 'en'
@@ -166,10 +175,10 @@ export default {
166
175
  RangePicker: {
167
176
  ranges: {
168
177
  today: 'Today',
169
- lastWeek: 'Last Week',
170
- lastMonth: 'Last Month',
171
- last3Months: 'Last 3 Months',
172
- lastYear: 'Last Year'
178
+ lastWeek: 'Last week',
179
+ lastMonth: 'Last month',
180
+ last3Months: 'Last 3 months',
181
+ lastYear: 'Last year'
173
182
  }
174
183
  }
175
184
  };
@@ -10,6 +10,10 @@ declare const _default: {
10
10
  tipAlt: string;
11
11
  closeAlt: string;
12
12
  tabMaxLimitMessage: string;
13
+ tabMenuClose: string;
14
+ tabMenuCloseOthers: string;
15
+ tabMenuCloseRight: string;
16
+ tabMenuCloseAll: string;
13
17
  };
14
18
  ProHeader: {
15
19
  versionTitle: string;
@@ -18,6 +22,8 @@ declare const _default: {
18
22
  cancel: string;
19
23
  backText: string;
20
24
  copyTooltips: string[];
25
+ itemsCountPrefix: string;
26
+ itemsSeparator: string;
21
27
  };
22
28
  ProDownload: {
23
29
  errorMessage: string;
@@ -39,6 +45,8 @@ declare const _default: {
39
45
  formListConfirmMessage: string;
40
46
  noData: string;
41
47
  moreItems: string;
48
+ confirmTitle: string;
49
+ confirmContent: string;
42
50
  };
43
51
  ProAction: {
44
52
  errorMessage: string;
@@ -80,6 +88,7 @@ declare const _default: {
80
88
  view: string;
81
89
  delete: string;
82
90
  download: string;
91
+ deleteConfirmTitle: string;
83
92
  };
84
93
  ProStep: {
85
94
  catalogue: string;
@@ -9,7 +9,11 @@ export default {
9
9
  ProLayout: {
10
10
  tipAlt: '提示',
11
11
  closeAlt: '关闭',
12
- tabMaxLimitMessage: '菜单tab不能超过上限{max}'
12
+ tabMaxLimitMessage: '菜单tab不能超过上限{max}',
13
+ tabMenuClose: '关闭',
14
+ tabMenuCloseOthers: '关闭其他',
15
+ tabMenuCloseRight: '关闭右侧标签页',
16
+ tabMenuCloseAll: '关闭全部'
13
17
  },
14
18
  ProHeader: {
15
19
  versionTitle: '版本号',
@@ -17,7 +21,9 @@ export default {
17
21
  confirm: '确定',
18
22
  cancel: '取消',
19
23
  backText: '返回',
20
- copyTooltips: ['复制', '复制成功']
24
+ copyTooltips: ['复制', '复制成功'],
25
+ itemsCountPrefix: '共{count}个,',
26
+ itemsSeparator: ' 、'
21
27
  },
22
28
  ProDownload: {
23
29
  errorMessage: '请求失败!'
@@ -38,7 +44,9 @@ export default {
38
44
  formListActions: ['新增', '删除', '复制', '上移', '下移', '新增一行', '点击添加'],
39
45
  formListConfirmMessage: '确认删除吗?',
40
46
  noData: '暂无数据',
41
- moreItems: '更多{count}项...'
47
+ moreItems: '更多{count}项...',
48
+ confirmTitle: '操作提示',
49
+ confirmContent: '确定要修改该字段吗?'
42
50
  },
43
51
  ProAction: {
44
52
  errorMessage: 'ProAction 配置 config 必须为数据',
@@ -79,7 +87,8 @@ export default {
79
87
  draggerLimitless: '无限制',
80
88
  view: '查看',
81
89
  delete: '删除',
82
- download: '下载'
90
+ download: '下载',
91
+ deleteConfirmTitle: '确定删除?'
83
92
  },
84
93
  ProStep: {
85
94
  catalogue: '目录'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.5.6-beta.2",
3
+ "version": "4.5.6-beta.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "es",
@@ -66,6 +66,7 @@
66
66
  "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx --ignore-pattern '**/__tests__/**' --ignore-pattern '**/*.test.*' --ignore-pattern '**/*.spec.*'",
67
67
  "code-standards:check": "node ./scripts/code-standards-check.mjs",
68
68
  "check:types": "node ./scripts/check-public-types.mjs",
69
+ "check:locale": "node ./scripts/check-locale.mjs",
69
70
  "commit-msg:format": "node ./scripts/format-commit-msg.mjs",
70
71
  "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
71
72
  "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
@@ -122,7 +123,7 @@
122
123
  "lodash": "^4.17.21",
123
124
  "react-intersection-observer": "^9.13.0",
124
125
  "react-resizable": "^3.0.5",
125
- "react-svg": "^15.1.7"
126
+ "react-svg": "^17.2.4"
126
127
  },
127
128
  "peerDependencies": {
128
129
  "@ant-design/icons": ">=6.0.0",