ronds-metadata 1.0.81 → 1.0.84

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,7 +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
+ import { tr } from '../../../framework/locale';
9
9
 
10
10
  var EditableAction = function EditableAction(props) {
11
11
  var _editConfig$editCellK;
@@ -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
  }
@@ -1,2 +1 @@
1
- export declare const initLocaleMessage: () => void;
2
1
  export { setLocale, getLocale } from '../../framework/locale';
@@ -1,10 +1,8 @@
1
1
  import zhCN from './zh-CN';
2
2
  import enUS from './en-US';
3
3
  import { initLocale } from '../../framework/locale';
4
- export var initLocaleMessage = function initLocaleMessage() {
5
- initLocale({
6
- 'zh-CN': zhCN,
7
- 'en-US': enUS
8
- });
9
- };
4
+ initLocale({
5
+ 'zh-CN': zhCN,
6
+ 'en-US': enUS
7
+ });
10
8
  export { setLocale, getLocale } from '../../framework/locale';
package/es/config.js CHANGED
@@ -3,17 +3,17 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2021-09-18 14:15:04
6
- * @LastEditTime: 2022-05-09 14:06:06
6
+ * @LastEditTime: 2022-05-10 08:41:39
7
7
  */
8
8
  import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
9
9
  import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
10
10
  import { map } from 'rxjs/internal/operators/map';
11
- import { initLocaleMessage } from './comps/locales/index';
11
+ import { setLocale } from './comps/locales/index';
12
12
  import * as jq from './framework/libs/jquery.min.js';
13
- import { setLocale } from './framework/locale/index';
13
+ import { localeKey } from './framework/locale';
14
14
  window.jQuery = window.jQuery || jq;
15
15
  var defaultConfig = {
16
- locale: 'en-US',
16
+ locale: window.localStorage.getItem(localeKey) || 'zh-CN',
17
17
  theme: 'normal',
18
18
  msgpack: false,
19
19
  openLoading: true,
@@ -21,9 +21,10 @@ var defaultConfig = {
21
21
  };
22
22
  export var cssPrefix = 'ronds-metadata';
23
23
  export var globalSettingStream = new BehaviorSubject(defaultConfig);
24
- globalSettingStream.subscribe(function (p) {
25
- initLocaleMessage();
26
- setLocale(p.locale);
24
+ globalSettingStream.pipe(map(function (p) {
25
+ return p.locale;
26
+ }), distinctUntilChanged()).subscribe(function (p) {
27
+ setLocale(p);
27
28
  });
28
29
  globalSettingStream.pipe(map(function (p) {
29
30
  return p.theme;
@@ -1,4 +1,5 @@
1
1
  import DI18n from './dil8/index';
2
+ export declare const localeKey = "epm_locale";
2
3
  declare let di18n: DI18n;
3
4
  export declare function initLocale(messages: Record<'zh-CN' | 'en-US', Record<string, string>>): void;
4
5
  export declare function setLocale(l: 'zh-CN' | 'en-US'): void;
@@ -1,6 +1,7 @@
1
1
  import DI18n from './dil8/index';
2
+ export var localeKey = 'epm_locale';
2
3
  var di18n = new DI18n({
3
- locale: 'zh-CN',
4
+ locale: window.localStorage.getItem(localeKey) || 'zh-CN',
4
5
  isReplace: false,
5
6
  messages: {}
6
7
  });
@@ -8,6 +9,7 @@ export function initLocale(messages) {
8
9
  di18n.setMessages(messages);
9
10
  }
10
11
  export function setLocale(l) {
12
+ window.localStorage.setItem(localeKey, l || '');
11
13
  di18n.setLocale(l);
12
14
  }
13
15
  export function getLocale() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.81",
4
+ "version": "1.0.84",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",