ronds-metadata 1.3.35 → 1.3.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
11
  /*
12
12
  * @Author: wangxian
13
13
  * @Date: 2021-09-18 14:15:04
14
- * @LastEditTime: 2024-03-19 15:08:05
14
+ * @LastEditTime: 2024-03-20 13:39:47
15
15
  */
16
16
  import React from 'react';
17
17
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
@@ -106,11 +106,11 @@ function Index(props) {
106
106
  key: id,
107
107
  initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue
108
108
  }, function (fields, _ref) {
109
- var _extraInfo$disabled3;
109
+ var _extraInfo$disabled4;
110
110
  var add = _ref.add,
111
111
  remove = _ref.remove;
112
112
  return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, idx) {
113
- var _extraInfo$disabled2;
113
+ var _extraInfo$disabled2, _extraInfo$disabled3;
114
114
  return /*#__PURE__*/React.createElement("div", {
115
115
  key: field.key,
116
116
  style: {
@@ -127,7 +127,7 @@ function Index(props) {
127
127
  isRefForm: isRefForm,
128
128
  isShowTypeInfo: formContext.isShowTypeInfo,
129
129
  field: field
130
- }, 23), !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) && /*#__PURE__*/React.createElement(MinusCircleOutlined, {
130
+ }, 23), !((_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled) && /*#__PURE__*/React.createElement(MinusCircleOutlined, {
131
131
  style: {
132
132
  marginLeft: '10px'
133
133
  },
@@ -137,7 +137,7 @@ function Index(props) {
137
137
  })));
138
138
  }), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
139
139
  type: "dashed",
140
- disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
140
+ disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
141
141
  onClick: function onClick() {
142
142
  return add();
143
143
  },
@@ -16,7 +16,7 @@ import _Input from "antd/es/input";
16
16
  /*
17
17
  * @Author: wangxian
18
18
  * @Date: 2021-09-18 14:15:04
19
- * @LastEditTime: 2024-02-27 09:45:47
19
+ * @LastEditTime: 2024-04-16 16:20:05
20
20
  */
21
21
  import React from 'react';
22
22
  import { UploadOutlined } from '@ant-design/icons';
@@ -95,13 +95,13 @@ function Index(props) {
95
95
  maxLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxLength,
96
96
  rows: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.textareaRows) || 4,
97
97
  disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
98
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
98
+ placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
99
99
  });
100
100
  case 'colorPicker':
101
101
  return /*#__PURE__*/React.createElement(_Input, {
102
102
  type: "color",
103
103
  disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
104
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
104
+ placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
105
105
  });
106
106
  case 'datePicker':
107
107
  return (
@@ -111,7 +111,7 @@ function Index(props) {
111
111
  showTime: true,
112
112
  format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
113
113
  disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
114
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
114
+ placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
115
115
  })
116
116
  );
117
117
  case 'upload':
@@ -125,7 +125,7 @@ function Index(props) {
125
125
  }, /*#__PURE__*/React.createElement(_Button, {
126
126
  disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
127
127
  icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
128
- }, "\u4E0A\u4F20"));
128
+ }, tr('上传')));
129
129
  case 'numberRange':
130
130
  return /*#__PURE__*/React.createElement(NumberRange, _extends({}, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.numberRange, {
131
131
  disabled: (_extraInfo$disabled6 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled6 !== void 0 ? _extraInfo$disabled6 : disabled
@@ -145,8 +145,8 @@ function Index(props) {
145
145
  showCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.showCount,
146
146
  maxLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxLength,
147
147
  disabled: (_extraInfo$disabled7 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled7 !== void 0 ? _extraInfo$disabled7 : disabled,
148
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
149
- title: valueTitle,
148
+ placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder),
149
+ title: tr(valueTitle),
150
150
  allowClear: true
151
151
  });
152
152
  }
@@ -164,7 +164,7 @@ function Index(props) {
164
164
  style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
165
165
  color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
166
166
  } : {}
167
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
167
+ }, tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
168
168
  labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
169
169
  flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
170
170
  offset: 0
@@ -179,10 +179,10 @@ function Index(props) {
179
179
  name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter6 = extraInfo.addonAfter) === null || _extraInfo$addonAfter6 === void 0 ? void 0 : _extraInfo$addonAfter6.key) ? [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name), ['value']) : [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
180
180
  rules: [{
181
181
  required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require,
182
- message: "".concat(tr('请输入')).concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
182
+ message: "".concat(tr('请输入')).concat(tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
183
183
  }].concat(_toConsumableArray(rules)),
184
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
185
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
184
+ help: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help),
185
+ tooltip: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip)
186
186
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
187
187
  }
188
188
  return !field ?
@@ -198,7 +198,7 @@ function Index(props) {
198
198
  style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
199
199
  color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
200
200
  } : {}
201
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
201
+ }, tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
202
202
  labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
203
203
  flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
204
204
  offset: 0
@@ -213,10 +213,10 @@ function Index(props) {
213
213
  name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter7 = extraInfo.addonAfter) === null || _extraInfo$addonAfter7 === void 0 ? void 0 : _extraInfo$addonAfter7.key) ? [].concat(_toConsumableArray(name), ['value']) : name,
214
214
  rules: [{
215
215
  required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require,
216
- message: "".concat(tr('请输入')).concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
216
+ message: "".concat(tr('请输入')).concat(tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
217
217
  }].concat(_toConsumableArray(rules)),
218
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
219
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
218
+ help: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help),
219
+ tooltip: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip)
220
220
  }, processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || '')) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
221
221
  style: {
222
222
  flex: 1,
@@ -226,10 +226,10 @@ function Index(props) {
226
226
  name: [field === null || field === void 0 ? void 0 : field.name],
227
227
  rules: [{
228
228
  required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require,
229
- message: "".concat(tr('请输入')).concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
229
+ message: "".concat(tr('请输入'), " ").concat(tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id)
230
230
  }].concat(_toConsumableArray(rules)),
231
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
232
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
231
+ help: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help),
232
+ tooltip: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip)
233
233
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
234
234
  }
235
235
  export default /*#__PURE__*/React.memo(Index);
@@ -16,5 +16,6 @@ declare const _default: {
16
16
  缩小: string;
17
17
  实际尺寸: string;
18
18
  适应画布: string;
19
+ 上传: string;
19
20
  };
20
21
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2022-05-09 11:53:44
4
- * @LastEditTime: 2022-05-28 10:21:09
4
+ * @LastEditTime: 2024-04-16 16:09:52
5
5
  */
6
6
  export default {
7
7
  操作: 'Operation',
@@ -20,5 +20,6 @@ export default {
20
20
  放大: 'Enlarge',
21
21
  缩小: 'zoom out',
22
22
  实际尺寸: 'Actual size',
23
- 适应画布: 'Fit to canvas'
23
+ 适应画布: 'Fit to canvas',
24
+ 上传: 'Upload'
24
25
  };
@@ -16,5 +16,6 @@ declare const _default: {
16
16
  缩小: string;
17
17
  实际尺寸: string;
18
18
  适应画布: string;
19
+ 上传: string;
19
20
  };
20
21
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2022-05-09 11:53:44
4
- * @LastEditTime: 2022-05-28 10:19:25
4
+ * @LastEditTime: 2024-04-16 16:10:08
5
5
  */
6
6
  export default {
7
7
  操作: '操作',
@@ -20,5 +20,6 @@ export default {
20
20
  放大: '放大',
21
21
  缩小: '缩小',
22
22
  实际尺寸: '实际尺寸',
23
- 适应画布: '适应画布'
23
+ 适应画布: '适应画布',
24
+ 上传: '上传'
24
25
  };
package/es/config.d.ts CHANGED
@@ -6,6 +6,10 @@ export interface IConfig {
6
6
  msgpack: boolean;
7
7
  openLoading: boolean;
8
8
  baseUrl: string;
9
+ translate: {
10
+ 'zh-CN': any;
11
+ 'en-US': any;
12
+ };
9
13
  }
10
14
  export declare const cssPrefix = "ronds-metadata";
11
15
  export declare const globalSettingStream: BehaviorSubject<IConfig>;
package/es/config.js CHANGED
@@ -2,19 +2,26 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  /*
3
3
  * @Author: wangxian
4
4
  * @Date: 2021-09-18 14:15:04
5
- * @LastEditTime: 2023-06-08 15:39:28
5
+ * @LastEditTime: 2024-04-16 16:51:55
6
6
  */
7
7
  import { BehaviorSubject, map, distinctUntilChanged } from 'rxjs';
8
8
  import { setLocale } from './comps/locales/index';
9
+ import { initLocale } from './framework/locale';
9
10
  import * as jq from './framework/libs/jquery.min.js';
10
11
  import { localeKey } from './framework/locale';
12
+ import zhCN from './comps/locales/zh-CN';
13
+ import enUS from './comps/locales/en-US';
11
14
  window.jQuery = window.jQuery || jq;
12
15
  var defaultConfig = {
13
16
  locale: window.localStorage.getItem(localeKey) || 'zh-CN',
14
17
  theme: 'normal',
15
18
  msgpack: false,
16
19
  openLoading: true,
17
- baseUrl: '/phm'
20
+ baseUrl: '/phm',
21
+ translate: {
22
+ 'zh-CN': zhCN,
23
+ 'en-US': enUS
24
+ }
18
25
  };
19
26
  export var cssPrefix = 'ronds-metadata';
20
27
  export var globalSettingStream = new BehaviorSubject(defaultConfig);
@@ -23,6 +30,14 @@ globalSettingStream.pipe(map(function (p) {
23
30
  }), distinctUntilChanged()).subscribe(function (p) {
24
31
  setLocale(p);
25
32
  });
33
+ globalSettingStream.pipe(map(function (p) {
34
+ return p.translate;
35
+ }), distinctUntilChanged()).subscribe(function (p) {
36
+ initLocale({
37
+ 'zh-CN': _objectSpread(_objectSpread({}, zhCN), p['zh-CN']),
38
+ 'en-US': _objectSpread(_objectSpread({}, enUS), p['en-US'])
39
+ });
40
+ });
26
41
  globalSettingStream.pipe(map(function (p) {
27
42
  return p.theme;
28
43
  }), distinctUntilChanged()).subscribe(function (p) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.35",
4
+ "version": "1.3.37",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",