ronds-metadata 1.0.80 → 1.0.83

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.
@@ -5,6 +5,7 @@ import _Button from "antd/es/button";
5
5
  import React from 'react';
6
6
  import { EditableContext } from '../interface';
7
7
  import { isFreeEditRow } from '../utils';
8
+ import { tr } from '../../../framework/locale';
8
9
 
9
10
  var EditableAction = function EditableAction(props) {
10
11
  var _editConfig$editCellK;
@@ -62,44 +63,44 @@ var EditableAction = function EditableAction(props) {
62
63
  disabled: (editConfig.curRow || editConfig.curRow === 0) && editConfig.curRow !== record._rowKey_,
63
64
  size: "small",
64
65
  onClick: onEdit,
65
- title: '编辑'
66
- }, "\u7F16\u8F91")), editConfig.curRow === record._rowKey_ && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
66
+ title: tr('编辑')
67
+ }, tr('编辑'))), editConfig.curRow === record._rowKey_ && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
67
68
  type: "link",
68
69
  onClick: onSave,
69
70
  style: {
70
71
  padding: 0,
71
72
  marginRight: '10px'
72
73
  }
73
- }, "\u786E\u5B9A"), editConfig.type === 'edit' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
74
+ }, tr('确定')), editConfig.type === 'edit' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
74
75
  type: "link",
75
76
  onClick: onCancel,
76
77
  style: {
77
78
  padding: 0,
78
79
  marginRight: '10px'
79
80
  }
80
- }, "\u53D6\u6D88")))), type === 'freedom' && /*#__PURE__*/React.createElement(React.Fragment, null, (record._rowKey_ === (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || isFreeEditRow(editConfig.curRow, record._rowKey_)) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
81
+ }, tr('取消'))))), type === 'freedom' && /*#__PURE__*/React.createElement(React.Fragment, null, (record._rowKey_ === (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || isFreeEditRow(editConfig.curRow, record._rowKey_)) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
81
82
  type: "link",
82
83
  onClick: onSave,
83
84
  style: {
84
85
  padding: 0,
85
86
  marginRight: '10px'
86
87
  }
87
- }, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(_Popconfirm, {
88
+ }, tr('确定')))), /*#__PURE__*/React.createElement(_Popconfirm, {
88
89
  placement: 'left',
89
- title: "\u786E\u8BA4\u5220\u9664\u8BE5\u6761\u6570\u636E\uFF1F",
90
+ title: tr('确认删除该条数据'),
90
91
  onConfirm: onDelete,
91
92
  onCancel: function onCancel(e) {
92
93
  e.stopPropagation();
93
94
  },
94
- okText: "\u786E\u5B9A",
95
- cancelText: "\u53D6\u6D88"
95
+ okText: tr('确定'),
96
+ cancelText: tr('取消')
96
97
  }, /*#__PURE__*/React.createElement(_Button, {
97
98
  type: "link",
98
99
  style: {
99
100
  padding: 0,
100
101
  marginRight: '10px'
101
102
  }
102
- }, "\u5220\u9664")));
103
+ }, tr('删除'))));
103
104
  };
104
105
 
105
106
  export default EditableAction;
@@ -8,6 +8,7 @@ import { EditableContext } from '../interface';
8
8
  import { getDataCell, isFreeEditCell, isFreeEditRow } from '../utils';
9
9
  import "./index.css";
10
10
  import Texty from './Texty';
11
+ import { tr } from '../../../framework/locale';
11
12
 
12
13
  var EditableCell = function EditableCell(props) {
13
14
  var title = props.title,
@@ -30,13 +31,13 @@ var EditableCell = function EditableCell(props) {
30
31
  if ((editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) && (editConfig === null || editConfig === void 0 ? void 0 : editConfig.curRow) !== 'undefined') {
31
32
  if (isFreeEditRow(editConfig.curRow, rowIndex)) return;
32
33
 
33
- _message.warning('请先保存正在编辑的行');
34
+ _message.warning(tr('请先保存正在编辑的行'));
34
35
 
35
36
  return;
36
37
  }
37
38
 
38
39
  if (((editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK = editConfig.editCellKey) === null || _editConfig$editCellK === void 0 ? void 0 : _editConfig$editCellK.rowIndex) || (editConfig === null || editConfig === void 0 ? void 0 : (_editConfig$editCellK2 = editConfig.editCellKey) === null || _editConfig$editCellK2 === void 0 ? void 0 : _editConfig$editCellK2.rowIndex) === 0) && rowIndex !== editConfig.editCellKey.rowIndex) {
39
- _message.warning('请先保存正在编辑的行');
40
+ _message.warning(tr('请先保存正在编辑的行'));
40
41
 
41
42
  return;
42
43
  }
@@ -51,9 +52,6 @@ var EditableCell = function EditableCell(props) {
51
52
  };
52
53
 
53
54
  var onCellClick = function onCellClick() {
54
- // if (!isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) {
55
- // editableStream.next({ type: 'editCellKey', payload: { dataIndex: undefined, rowIndex: undefined } });
56
- // }
57
55
  if (isAddColumn) {
58
56
  editableStream.next({
59
57
  type: 'editHeardCellKey',
@@ -14,6 +14,7 @@ var _excluded = ["title", "dataIndex", "isAddColumn", "children"];
14
14
  import { PlusSquareOutlined, DeleteOutlined } from '@ant-design/icons';
15
15
  import React from 'react';
16
16
  import { EditableContext } from '../interface';
17
+ import { tr } from '../../../framework/locale';
17
18
  import "./index.css";
18
19
 
19
20
  var EditableHeardCell = function EditableHeardCell(props) {
@@ -102,7 +103,7 @@ var EditableHeardCell = function EditableHeardCell(props) {
102
103
  setAddColumn(_objectSpread({}, _));
103
104
  addColumnRef.current = _;
104
105
  },
105
- placeholder: "\u8BF7\u8F93\u5165key"
106
+ placeholder: tr('请输入key')
106
107
  }), /*#__PURE__*/React.createElement(_Input, {
107
108
  value: addColumn.title,
108
109
  style: {
@@ -114,13 +115,13 @@ var EditableHeardCell = function EditableHeardCell(props) {
114
115
  setAddColumn(_objectSpread({}, _));
115
116
  addColumnRef.current = _;
116
117
  },
117
- placeholder: "\u8BF7\u8F93\u5165title",
118
+ placeholder: tr('请输入title'),
118
119
  onPressEnter: onAddColumn
119
120
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
120
121
  type: "primary",
121
122
  block: true,
122
123
  onClick: onAddColumn
123
- }, "\u786E\u5B9A")));
124
+ }, tr('确定'))));
124
125
 
125
126
  var onVisibleChange = function onVisibleChange(b) {
126
127
  setVisible(b);
@@ -143,13 +144,13 @@ var EditableHeardCell = function EditableHeardCell(props) {
143
144
  className: "".concat(editConfig.editHeardCellKey === dataIndex ? 'editable-th-hover-delete' : 'display-none')
144
145
  }, /*#__PURE__*/React.createElement(_Popconfirm, {
145
146
  placement: 'left',
146
- title: "\u786E\u8BA4\u5220\u9664\u8BE5\u6761\u5217\uFF1F",
147
+ title: tr('确认会删除该列'),
147
148
  onConfirm: onDeleteColumn,
148
149
  onCancel: function onCancel(e) {
149
150
  e.stopPropagation();
150
151
  },
151
- okText: "\u786E\u5B9A",
152
- cancelText: "\u53D6\u6D88"
152
+ okText: tr('确定'),
153
+ cancelText: tr('取消')
153
154
  }, /*#__PURE__*/React.createElement(_Button, {
154
155
  type: "link",
155
156
  icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
@@ -18,6 +18,7 @@ import { isFreeEditRow, removeCurKeyFromEditRow } from './utils';
18
18
  import EditableHeardCell from './comps/EditableHeardCell';
19
19
  import useMemoSubject from '../../framework/rxjs-hooks/useMemoSubject';
20
20
  import useObservable from '../../framework/rxjs-hooks/useObservable';
21
+ import { tr } from '../../framework/locale';
21
22
  import "./index.css";
22
23
 
23
24
  var Editable = function Editable(props) {
@@ -297,7 +298,7 @@ var Editable = function Editable(props) {
297
298
  if (!readonly) {
298
299
  var _aciton_ = {
299
300
  dataKey: '_aciton_',
300
- title: '操作',
301
+ title: tr('操作'),
301
302
  width: 40,
302
303
  ellipsis: true,
303
304
  fixed: 'left',
@@ -338,7 +339,7 @@ var Editable = function Editable(props) {
338
339
  var onAddRow = function onAddRow() {
339
340
  if (defaultValue) {
340
341
  if (type === 'freedom' && editRowKey) {
341
- _message.warn('请先保存正在编辑的行');
342
+ _message.warn(tr('请先保存正在编辑的行'));
342
343
 
343
344
  return;
344
345
  }
@@ -415,7 +416,7 @@ var Editable = function Editable(props) {
415
416
  marginTop: '5px'
416
417
  },
417
418
  onClick: onAddRow
418
- }, "\u6DFB\u52A0\u4E00\u884C")));
419
+ }, tr('添加一行'))));
419
420
  };
420
421
 
421
422
  export default Editable;
@@ -189,6 +189,11 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
189
189
  while (1) {
190
190
  switch (_context4.prev = _context4.next) {
191
191
  case 0:
192
+ if (!defaultValues) {
193
+ _context4.next = 17;
194
+ break;
195
+ }
196
+
192
197
  _ruleTypes = ruleTypes;
193
198
  _refIds = refIds;
194
199
  form.setFieldsValue({
@@ -196,40 +201,40 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
196
201
  });
197
202
  i = 0;
198
203
 
199
- case 4:
204
+ case 5:
200
205
  if (!(i < defaultValues.length)) {
201
- _context4.next = 14;
206
+ _context4.next = 15;
202
207
  break;
203
208
  }
204
209
 
205
210
  _ruleTypes[i] = defaultValues[i].type;
206
211
 
207
212
  if (!(defaultValues[i].type === 'ref')) {
208
- _context4.next = 11;
213
+ _context4.next = 12;
209
214
  break;
210
215
  }
211
216
 
212
217
  if (!(defaultValues[i].refId.indexOf('Rule.Form') > -1)) {
213
- _context4.next = 10;
218
+ _context4.next = 11;
214
219
  break;
215
220
  }
216
221
 
217
- _context4.next = 10;
222
+ _context4.next = 11;
218
223
  return processSpecialRuleData(defaultValues[i].refId, i);
219
224
 
220
- case 10:
225
+ case 11:
221
226
  _refIds[i] = defaultValues[i].refId;
222
227
 
223
- case 11:
228
+ case 12:
224
229
  i++;
225
- _context4.next = 4;
230
+ _context4.next = 5;
226
231
  break;
227
232
 
228
- case 14:
233
+ case 15:
229
234
  setRefIds(_objectSpread({}, _refIds));
230
235
  setRuleTypes(_objectSpread({}, _ruleTypes));
231
236
 
232
- case 16:
237
+ case 17:
233
238
  case "end":
234
239
  return _context4.stop();
235
240
  }
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ 操作: string;
3
+ 添加一行: string;
4
+ 编辑: string;
5
+ 删除: string;
6
+ 确定: string;
7
+ 取消: string;
8
+ 确认删除该条数据: string;
9
+ 请先保存正在编辑的行: string;
10
+ 请输入key: string;
11
+ 请输入title: string;
12
+ 确认会删除该列: string;
13
+ };
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export default {
2
+ 操作: 'Operation',
3
+ 添加一行: 'Add New Line',
4
+ 编辑: 'Edit',
5
+ 删除: 'Delete',
6
+ 确定: 'Confirm',
7
+ 取消: 'Cancel',
8
+ 确认删除该条数据: 'Confirm to delete this piece of data?',
9
+ 请先保存正在编辑的行: 'Please save the line being edited first',
10
+ 请输入key: 'Please enter key',
11
+ 请输入title: 'Please enter title',
12
+ 确认会删除该列: 'Confirm will delete the column?'
13
+ };
@@ -0,0 +1,2 @@
1
+ export declare const initLocaleMessage: () => void;
2
+ export { setLocale, getLocale } from '../../framework/locale';
@@ -0,0 +1,10 @@
1
+ import zhCN from './zh-CN';
2
+ import enUS from './en-US';
3
+ import { initLocale } from '../../framework/locale';
4
+ export var initLocaleMessage = function initLocaleMessage() {
5
+ initLocale({
6
+ 'zh-CN': zhCN,
7
+ 'en-US': enUS
8
+ });
9
+ };
10
+ export { setLocale, getLocale } from '../../framework/locale';
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ 操作: string;
3
+ 添加一行: string;
4
+ 编辑: string;
5
+ 删除: string;
6
+ 确定: string;
7
+ 取消: string;
8
+ 确定删除该条数据: string;
9
+ 请先保存正在编辑的行: string;
10
+ 请输入key: string;
11
+ 请输入title: string;
12
+ 确认会删除该列: string;
13
+ };
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export default {
2
+ 操作: '操作',
3
+ 添加一行: '添加一行',
4
+ 编辑: '编辑',
5
+ 删除: '删除',
6
+ 确定: '确定',
7
+ 取消: '取消',
8
+ 确定删除该条数据: '确定删除该条数据?',
9
+ 请先保存正在编辑的行: '请先保存正在编辑的行',
10
+ 请输入key: '请输入key',
11
+ 请输入title: '请输入title',
12
+ 确认会删除该列: '确认会删除该列?'
13
+ };
package/es/config.js CHANGED
@@ -1,8 +1,16 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+
3
+ /*
4
+ * @Author: wangxian
5
+ * @Date: 2021-09-18 14:15:04
6
+ * @LastEditTime: 2022-05-09 15:52:41
7
+ */
2
8
  import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
3
9
  import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
4
10
  import { map } from 'rxjs/internal/operators/map';
11
+ import { initLocaleMessage } from './comps/locales/index';
5
12
  import * as jq from './framework/libs/jquery.min.js';
13
+ import { setLocale } from './framework/locale/index';
6
14
  window.jQuery = window.jQuery || jq;
7
15
  var defaultConfig = {
8
16
  locale: 'zh-CN',
@@ -12,12 +20,12 @@ var defaultConfig = {
12
20
  baseUrl: '/phm'
13
21
  };
14
22
  export var cssPrefix = 'ronds-metadata';
15
- export var globalSettingStream = new BehaviorSubject({
16
- locale: 'zh-CN',
17
- theme: 'normal',
18
- msgpack: false,
19
- openLoading: true,
20
- baseUrl: '/phm'
23
+ export var globalSettingStream = new BehaviorSubject(defaultConfig);
24
+ globalSettingStream.pipe(map(function (p) {
25
+ return p.locale;
26
+ }), distinctUntilChanged()).subscribe(function (p) {
27
+ initLocaleMessage();
28
+ setLocale(p);
21
29
  });
22
30
  globalSettingStream.pipe(map(function (p) {
23
31
  return p.theme;