ronds-metadata 1.0.79 → 1.0.82

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.
Files changed (34) hide show
  1. package/es/comps/Editable/comps/EditableAction.js +10 -9
  2. package/es/comps/Editable/comps/EditableCell.js +3 -5
  3. package/es/comps/Editable/comps/EditableHeardCell.js +7 -6
  4. package/es/comps/Editable/index.js +4 -3
  5. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +1 -1
  6. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +4 -4
  7. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +1 -1
  8. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +4 -4
  9. package/es/comps/MetadataForm/DataCell/Array.js +2 -2
  10. package/es/comps/MetadataForm/DataCell/Ref.js +2 -2
  11. package/es/comps/MetadataForm/utils.js +1 -43
  12. package/es/comps/locales/en-US.d.ts +14 -0
  13. package/es/comps/locales/en-US.js +13 -0
  14. package/es/comps/locales/index.d.ts +2 -0
  15. package/es/comps/locales/index.js +10 -0
  16. package/es/comps/locales/zh-CN.d.ts +14 -0
  17. package/es/comps/locales/zh-CN.js +13 -0
  18. package/es/config.d.ts +4 -1
  19. package/es/config.js +28 -2
  20. package/es/framework/libs/jquery.min.js +4022 -0
  21. package/es/framework/locale/dil8/di18n.d.ts +17 -0
  22. package/es/framework/locale/dil8/di18n.js +132 -0
  23. package/es/framework/locale/dil8/index.d.ts +2 -0
  24. package/es/framework/locale/dil8/index.js +3 -0
  25. package/es/framework/locale/dil8/translate.d.ts +7 -0
  26. package/es/framework/locale/dil8/translate.js +76 -0
  27. package/es/framework/locale/dil8/util.d.ts +3 -0
  28. package/es/framework/locale/dil8/util.js +17 -0
  29. package/es/framework/locale/index.d.ts +7 -0
  30. package/es/framework/locale/index.js +24 -0
  31. package/es/index.d.ts +2 -0
  32. package/es/index.js +4 -2
  33. package/es/theme.css +6 -0
  34. package/package.json +1 -1
@@ -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;
@@ -383,7 +383,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
383
383
  }
384
384
  }))), (refIds[index] || refSchema[index]) && /*#__PURE__*/React.createElement("div", {
385
385
  style: {
386
- border: '1px solid #d9d9d9',
386
+ border: 'var(--color-border-1)',
387
387
  padding: '10px',
388
388
  marginBottom: '10px'
389
389
  }
@@ -130,7 +130,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
130
130
  case 'number':
131
131
  return /*#__PURE__*/React.createElement("div", {
132
132
  style: {
133
- border: '1px solid #d9d9d9',
133
+ border: 'var(--color-border-1)',
134
134
  padding: '10px',
135
135
  marginBottom: '10px'
136
136
  }
@@ -154,7 +154,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
154
154
  case 'ref':
155
155
  return /*#__PURE__*/React.createElement("div", {
156
156
  style: {
157
- border: '1px solid #d9d9d9',
157
+ border: '1px solid var(--color-border-1)',
158
158
  padding: '10px',
159
159
  display: 'flex',
160
160
  alignItems: 'center',
@@ -214,7 +214,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
214
214
  case 'array':
215
215
  return /*#__PURE__*/React.createElement("div", {
216
216
  style: {
217
- border: '1px solid #d9d9d9',
217
+ border: '1px solid var(--color-border-1)',
218
218
  borderRadius: '5px',
219
219
  padding: '10px',
220
220
  marginBottom: '10px',
@@ -301,7 +301,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
301
301
  case 'enum':
302
302
  return /*#__PURE__*/React.createElement("div", {
303
303
  style: {
304
- border: '1px solid #d9d9d9',
304
+ border: '1px solid var(--color-border-1)',
305
305
  padding: '10px',
306
306
  marginBottom: '10px'
307
307
  }
@@ -208,7 +208,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
208
208
  }
209
209
  }))), refIds[index] && /*#__PURE__*/React.createElement("div", {
210
210
  style: {
211
- border: '1px solid #d9d9d9',
211
+ border: '1px solid var(--color-border-1)',
212
212
  padding: '10px',
213
213
  marginBottom: '10px'
214
214
  }
@@ -158,7 +158,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
158
158
  case 'number':
159
159
  return /*#__PURE__*/React.createElement("div", {
160
160
  style: {
161
- border: '1px solid #d9d9d9',
161
+ border: '1px solid var(--color-border-1)',
162
162
  padding: '10px',
163
163
  marginBottom: '10px'
164
164
  }
@@ -179,7 +179,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
179
179
  case 'ref':
180
180
  return /*#__PURE__*/React.createElement("div", {
181
181
  style: {
182
- border: '1px solid #d9d9d9',
182
+ border: '1px solid var(--color-border-1)',
183
183
  padding: '10px',
184
184
  display: 'flex',
185
185
  alignItems: 'center',
@@ -231,7 +231,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
231
231
  case 'array':
232
232
  return /*#__PURE__*/React.createElement("div", {
233
233
  style: {
234
- border: '1px solid #d9d9d9',
234
+ border: '1px solid var(--color-border-1)',
235
235
  borderRadius: '5px',
236
236
  padding: '10px',
237
237
  marginBottom: '10px',
@@ -309,7 +309,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
309
309
  case 'enum':
310
310
  return /*#__PURE__*/React.createElement("div", {
311
311
  style: {
312
- border: '1px solid #d9d9d9',
312
+ border: '1px solid var(--color-border-1)',
313
313
  padding: '10px',
314
314
  marginBottom: '10px'
315
315
  }
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  /*
9
9
  * @Author: wangxian
10
10
  * @Date: 2021-09-18 14:15:04
11
- * @LastEditTime: 2022-05-06 12:08:47
11
+ * @LastEditTime: 2022-05-07 10:48:55
12
12
  */
13
13
  import React from 'react';
14
14
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
@@ -73,7 +73,7 @@ function Index(props) {
73
73
  }, help || (items === null || items === void 0 ? void 0 : items.type))), /*#__PURE__*/React.createElement("div", {
74
74
  style: {
75
75
  padding: '10px',
76
- border: '1px solid #d9d9d9',
76
+ border: '1px solid var(--color-border-1)',
77
77
  width: '100%',
78
78
  borderRadius: '4px'
79
79
  }
@@ -161,7 +161,7 @@ function Index(props) {
161
161
  }, extraInfo.label || id)), /*#__PURE__*/React.createElement("div", {
162
162
  style: {
163
163
  padding: '10px',
164
- border: '1px solid #d9d9d9',
164
+ border: '1px solid var(--color-border-1)',
165
165
  width: '100%',
166
166
  borderRadius: '4px'
167
167
  }
@@ -176,7 +176,7 @@ function Index(props) {
176
176
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
177
177
  style: {
178
178
  padding: '10px',
179
- border: '1px solid #d9d9d9',
179
+ border: '1px solid var(--color-border-1)',
180
180
  width: '100%',
181
181
  borderRadius: '4px'
182
182
  }
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  /*
6
6
  * @Author: wangxian
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2022-05-06 11:24:37
8
+ * @LastEditTime: 2022-05-06 13:43:47
9
9
  */
10
10
  import React from 'react';
11
11
  import Input from './DataCell/Input';
@@ -63,47 +63,5 @@ export function renderForm(schemaRef, options, stream$) {
63
63
  _form.push(getDataCell(_properties[i], options));
64
64
  }
65
65
 
66
- hasRenderAfter(_form, stream$);
67
66
  return /*#__PURE__*/React.createElement(React.Fragment, null, _form);
68
- }
69
- var __ref__ = [];
70
- var __count__ = 0;
71
-
72
- function hasRenderAfter(_form, stream$) {
73
- var _loop = function _loop(i) {
74
- if (_form[i].props.type === 'ref') {
75
- if (__ref__.findIndex(function (it) {
76
- return it === _form[i].key;
77
- }) === -1) {
78
- __ref__.push(_form[i].key);
79
- }
80
- } // if (_form[i].props.type === 'array' && _form[i].props.items.type === 'ref') {
81
- // if (__ref__.findIndex((it) => it === _form[i].key) === -1) {
82
- // __ref__.push(_form[i].key);
83
- // }
84
- // }
85
-
86
- };
87
-
88
- for (var i = 0; i < _form.length; i++) {
89
- _loop(i);
90
- }
91
-
92
- var idx = _form.findIndex(function (it) {
93
- return it.props.type === 'ref';
94
- }); // 表单渲染结束
95
-
96
-
97
- if (idx === -1) {
98
- __count__ = __count__ + 1;
99
-
100
- if (__count__ === __ref__.length && __ref__.length !== 0) {
101
- stream$ && stream$.next({
102
- type: 'onRenderAfter',
103
- payload: ''
104
- });
105
- __ref__ = [];
106
- __count__ = 0;
107
- }
108
- }
109
67
  }
@@ -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.d.ts CHANGED
@@ -1,14 +1,17 @@
1
+ import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
1
2
  export interface IConfig {
2
3
  /** 多语言 */
3
4
  locale: 'zh-CN' | 'en-US';
5
+ theme: 'normal' | 'dark';
4
6
  msgpack: boolean;
5
7
  openLoading: boolean;
6
8
  baseUrl: string;
7
9
  }
10
+ export declare const cssPrefix = "ronds-metadata";
11
+ export declare const globalSettingStream: BehaviorSubject<IConfig>;
8
12
  /** 设置配置 */
9
13
  export declare const setConfig: (opts: Partial<IConfig>) => void;
10
14
  /** 获取单个配置 */
11
15
  export declare function getConfigByKey<K extends keyof IConfig>(key: K): IConfig[K];
12
16
  /** 获取全部配置 */
13
17
  export declare const getConfig: () => IConfig;
14
- export declare const cssPrefix = "ronds-base-chart";
package/es/config.js CHANGED
@@ -1,10 +1,37 @@
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:26:10
7
+ */
8
+ import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
9
+ import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
10
+ import { map } from 'rxjs/internal/operators/map';
11
+ import { initLocaleMessage } from './comps/locales/index';
12
+ import * as jq from './framework/libs/jquery.min.js';
13
+ import { setLocale } from './framework/locale/index';
14
+ window.jQuery = window.jQuery || jq;
2
15
  var defaultConfig = {
3
16
  locale: 'zh-CN',
17
+ theme: 'normal',
4
18
  msgpack: false,
5
19
  openLoading: true,
6
20
  baseUrl: '/phm'
7
21
  };
22
+ export var cssPrefix = 'ronds-metadata';
23
+ export var globalSettingStream = new BehaviorSubject(defaultConfig);
24
+ globalSettingStream.subscribe(function (p) {
25
+ initLocaleMessage();
26
+ setLocale(p.locale);
27
+ });
28
+ globalSettingStream.pipe(map(function (p) {
29
+ return p.theme;
30
+ }), distinctUntilChanged()).subscribe(function (p) {
31
+ window.jQuery('body').removeClass("".concat(cssPrefix, "-dark"));
32
+ window.jQuery('body').removeClass("".concat(cssPrefix, "-normal"));
33
+ window.jQuery('body').addClass("".concat(cssPrefix, "-").concat(p));
34
+ });
8
35
  var config = defaultConfig;
9
36
  /** 设置配置 */
10
37
 
@@ -20,5 +47,4 @@ export function getConfigByKey(key) {
20
47
 
21
48
  export var getConfig = function getConfig() {
22
49
  return config;
23
- };
24
- export var cssPrefix = 'ronds-base-chart';
50
+ };