ronds-metadata 1.2.38 → 1.2.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. package/es/api/index.js +83 -131
  2. package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
  3. package/es/comps/DynamicPorts/comps/DragNode.js +2 -7
  4. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
  5. package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
  6. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
  7. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
  8. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
  9. package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
  10. package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
  11. package/es/comps/DynamicPorts/constant/index.js +2 -5
  12. package/es/comps/DynamicPorts/graph.d.ts +2 -2
  13. package/es/comps/DynamicPorts/graph.js +228 -312
  14. package/es/comps/DynamicPorts/index.js +39 -58
  15. package/es/comps/DynamicPorts/utils.js +21 -25
  16. package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
  17. package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
  18. package/es/comps/Editable/DataCell/Input.js +5 -14
  19. package/es/comps/Editable/DataCell/Number.js +3 -10
  20. package/es/comps/Editable/DataCell/Select.js +7 -14
  21. package/es/comps/Editable/DataCell/Switch.js +2 -7
  22. package/es/comps/Editable/comps/EditableAction.js +8 -12
  23. package/es/comps/Editable/comps/EditableCell.js +16 -26
  24. package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
  25. package/es/comps/Editable/comps/EditableRow.js +49 -59
  26. package/es/comps/Editable/comps/Texty.js +36 -72
  27. package/es/comps/Editable/index.js +67 -112
  28. package/es/comps/Editable/interface.d.ts +1 -1
  29. package/es/comps/Editable/utils.js +0 -1
  30. package/es/comps/FileView/index.js +65 -101
  31. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
  32. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
  33. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
  34. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
  35. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
  36. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
  37. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
  38. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
  39. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
  40. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
  48. package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
  49. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  50. package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
  51. package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
  52. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
  53. package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
  54. package/es/comps/FormGenerator/index.js +3 -9
  55. package/es/comps/FormGenerator/interface.d.ts +1 -1
  56. package/es/comps/FormGenerator/settings/index.js +12 -11
  57. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
  58. package/es/comps/FormGenerator/transformer.js +40 -105
  59. package/es/comps/Icons/index.js +4 -7
  60. package/es/comps/JsonEdit/index.js +25 -50
  61. package/es/comps/JsonView/index.js +7 -21
  62. package/es/comps/JsonView/index.less +41 -41
  63. package/es/comps/MdEdit/index.js +7 -10
  64. package/es/comps/MdEdit/index.less +6 -6
  65. package/es/comps/MdEditPro/index.d.ts +10 -0
  66. package/es/comps/MdEditPro/index.js +22 -0
  67. package/es/comps/MdEditPro/index.less +74 -0
  68. package/es/comps/MdNavbar/index.js +17 -40
  69. package/es/comps/MdNavbar/utils.js +0 -4
  70. package/es/comps/MdView/index.js +7 -11
  71. package/es/comps/MdView/index.less +353 -353
  72. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
  73. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
  74. package/es/comps/MetadataEdit/hooks/index.js +3 -11
  75. package/es/comps/MetadataEdit/index.js +25 -58
  76. package/es/comps/MetadataEdit/index.less +10 -10
  77. package/es/comps/MetadataEdit/type.d.ts +20 -20
  78. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
  79. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
  80. package/es/comps/MetadataEditV2/hooks/index.js +5 -12
  81. package/es/comps/MetadataEditV2/index.js +30 -65
  82. package/es/comps/MetadataForm/DataCell/Array.js +12 -23
  83. package/es/comps/MetadataForm/DataCell/Input.js +12 -32
  84. package/es/comps/MetadataForm/DataCell/Number.js +10 -21
  85. package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
  86. package/es/comps/MetadataForm/DataCell/Select.js +127 -222
  87. package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
  88. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +93 -164
  89. package/es/comps/MetadataForm/HOC/index.js +20 -37
  90. package/es/comps/MetadataForm/HOC/index.less +41 -41
  91. package/es/comps/MetadataForm/hooks/index.js +12 -38
  92. package/es/comps/MetadataForm/index.js +37 -72
  93. package/es/comps/MetadataForm/interface.d.ts +3 -3
  94. package/es/comps/MetadataForm/utils.js +0 -14
  95. package/es/comps/Split/index.js +20 -22
  96. package/es/config.js +0 -4
  97. package/es/framework/RxStore/demo/index.js +9 -10
  98. package/es/framework/RxStore/hooks.d.ts +9 -9
  99. package/es/framework/RxStore/hooks.js +10 -35
  100. package/es/framework/RxStore/store.d.ts +4 -4
  101. package/es/framework/RxStore/store.js +0 -10
  102. package/es/framework/fg/index.js +18 -80
  103. package/es/framework/fg/interface.d.ts +2 -2
  104. package/es/framework/fg/utils.js +0 -10
  105. package/es/framework/graph/index.d.ts +2 -2
  106. package/es/framework/graph/index.js +55 -110
  107. package/es/framework/hooks/use-async-memo.js +3 -7
  108. package/es/framework/hooks/use-sync-scroll.js +2 -15
  109. package/es/framework/http/cache.js +25 -32
  110. package/es/framework/http/cancel.js +1 -7
  111. package/es/framework/http/index.js +22 -82
  112. package/es/framework/http/msgpack.js +0 -4
  113. package/es/framework/http/msgpack5/index.js +2 -12
  114. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
  115. package/es/framework/http/msgpack5/lib/decoder.js +10 -68
  116. package/es/framework/http/msgpack5/lib/encoder.js +8 -36
  117. package/es/framework/http/msgpack5/lib/helpers.js +3 -2
  118. package/es/framework/http/msgpack5/lib/streams.js +0 -18
  119. package/es/framework/libs/jquery.min.js +1009 -1696
  120. package/es/framework/locale/dil8/di18n.js +4 -15
  121. package/es/framework/locale/dil8/translate.js +0 -14
  122. package/es/framework/locale/dil8/util.js +0 -3
  123. package/es/framework/locale/index.js +2 -3
  124. package/es/framework/metadata/MetadataService.js +39 -78
  125. package/es/framework/metadata/index.js +4 -70
  126. package/es/framework/metadata/types.d.ts +98 -98
  127. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
  128. package/es/framework/rxjs-hooks/useObservable.js +2 -4
  129. package/es/framework/rxjs-hooks/useObservableState.js +8 -14
  130. package/es/index.d.ts +1 -0
  131. package/es/index.js +2 -1
  132. package/es/theme.less +79 -79
  133. package/es/utils.js +58 -97
  134. package/package.json +104 -102
@@ -9,24 +9,17 @@ var IMG_ATTRIBUTE = 'i18n-img';
9
9
  var CONTENT_ATTRIBUTE = 'i18n-content';
10
10
  var PLACEHOLDER_ATTRIBUTE = 'i18n-placeholder';
11
11
  var LOCALE_PATTERN = /\$\{locale}/g;
12
-
13
12
  var noop = function noop() {};
14
-
15
13
  export var DI18n = /*#__PURE__*/function (_T) {
16
14
  _inherits(DI18n, _T);
17
-
18
15
  var _super = _createSuper(DI18n);
19
-
20
- // public locale: string;
21
- // public messages: any;
22
16
  function DI18n() {
23
17
  var _this;
24
-
25
18
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
-
27
19
  _classCallCheck(this, DI18n);
28
-
29
20
  _this = _super.call(this, options);
21
+ // public locale: string;
22
+ // public messages: any;
30
23
  _this.isReplace = void 0;
31
24
  _this.currMessage = void 0;
32
25
  _this.doms = void 0;
@@ -34,17 +27,14 @@ export var DI18n = /*#__PURE__*/function (_T) {
34
27
  _this.messages = options.messages || {};
35
28
  _this.isReplace = options.isReplace || false;
36
29
  _this.currMessage = _this.messages[_this.locale];
37
- _this.doms = {}; // 是否进行DOM内容的替换
38
-
30
+ _this.doms = {};
31
+ // 是否进行DOM内容的替换
39
32
  if (_this.isReplace) {
40
33
  _this.getDoms();
41
-
42
34
  _this.fresh();
43
35
  }
44
-
45
36
  return _this;
46
37
  }
47
-
48
38
  _createClass(DI18n, [{
49
39
  key: "getDoms",
50
40
  value: function getDoms() {
@@ -126,7 +116,6 @@ export var DI18n = /*#__PURE__*/function (_T) {
126
116
  this.messages = obj;
127
117
  }
128
118
  }]);
129
-
130
119
  return DI18n;
131
120
  }(T);
132
121
  DI18n.Version = void 0;
@@ -1,54 +1,43 @@
1
1
  import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
-
5
4
  var T = /*#__PURE__*/function () {
6
5
  function T(options) {
7
6
  _classCallCheck(this, T);
8
-
9
7
  this.locale = void 0;
10
8
  this.messages = void 0;
11
9
  this.locale = options.locale || 'zh';
12
10
  this.messages = options.messages || {};
13
11
  }
14
-
15
12
  _createClass(T, [{
16
13
  key: "$t",
17
14
  value: function $t(key) {
18
15
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19
16
  args[_key - 1] = arguments[_key];
20
17
  }
21
-
22
18
  if (!this.messages || !this.messages[this.locale] || this.messages[this.locale][key] === undefined) {
23
19
  return key;
24
20
  }
25
-
26
21
  var str = String(this.messages[this.locale][key]);
27
22
  if (str == 'undefined') return key;
28
-
29
23
  if (args.length === 1 && _typeof(args[0]) === 'object') {
30
24
  args = args[0];
31
25
  } else {
32
26
  args = [];
33
27
  }
34
-
35
28
  if (!args || !args.hasOwnProperty) {
36
29
  args = [];
37
30
  }
38
-
39
31
  var RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
40
32
  return str.replace(RE_NARGS, function (match, prefix, i, index) {
41
33
  var result = '';
42
-
43
34
  if (str[index - 1] === '{' && str[index + match.length] === '}') {
44
35
  return i;
45
36
  } else {
46
37
  result = args.hasOwnProperty(i) ? args[i] : match;
47
-
48
38
  if (!result) {
49
39
  return '';
50
40
  }
51
-
52
41
  return result;
53
42
  }
54
43
  });
@@ -57,7 +46,6 @@ var T = /*#__PURE__*/function () {
57
46
  key: "$html",
58
47
  value: function $html(content) {
59
48
  var _this = this;
60
-
61
49
  content = String(content);
62
50
  var RE_NARGS = /\$\{locale\}|\$t\(['"]([\s\S]+?)['"]\)/g;
63
51
  return content.replace(RE_NARGS, function (match, prefix, i, index) {
@@ -69,8 +57,6 @@ var T = /*#__PURE__*/function () {
69
57
  });
70
58
  }
71
59
  }]);
72
-
73
60
  return T;
74
61
  }();
75
-
76
62
  export { T as default };
@@ -3,15 +3,12 @@ export function hasClass(ele, cls) {
3
3
  }
4
4
  export function addClass(ele, cls) {
5
5
  var _pattern = new RegExp(cls);
6
-
7
6
  if (!_pattern.test(ele.className)) ele.className += ' ' + cls;
8
7
  return ele;
9
8
  }
10
9
  export function removeClass(ele, cls) {
11
10
  if (!ele || ele.nodeType !== 1) return undefined;
12
-
13
11
  var _pattern = new RegExp(cls);
14
-
15
12
  if (_pattern.test(ele.className || '')) ele.className = ele.className.replace(_pattern, '');
16
13
  return ele;
17
14
  }
@@ -19,8 +19,7 @@ export function tr(key) {
19
19
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
20
20
  args[_key - 1] = arguments[_key];
21
21
  }
22
-
23
22
  return di18n.$t.apply(di18n, [key].concat(args));
24
- } //多语言
25
-
23
+ }
24
+ //多语言
26
25
  export default di18n;
@@ -1,8 +1,7 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
-
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
5
  /*
7
6
  * @Author: wangxian
8
7
  * @Date: 2021-09-18 14:15:04
@@ -16,9 +15,7 @@ export var registerMetadataAPI = function registerMetadataAPI(api) {
16
15
  export var MetadataService = /*#__PURE__*/function () {
17
16
  function MetadataService(api) {
18
17
  _classCallCheck(this, MetadataService);
19
-
20
18
  this.api = void 0;
21
-
22
19
  if (api) {
23
20
  this.api = api;
24
21
  } else if (globalAPI) {
@@ -28,142 +25,106 @@ export var MetadataService = /*#__PURE__*/function () {
28
25
  }
29
26
  }
30
27
  /** 获取元数据列表 */
31
-
32
-
33
28
  _createClass(MetadataService, [{
34
29
  key: "GetMetadataList",
35
30
  value: function () {
36
31
  var _GetMetadataList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyWords) {
37
32
  return _regeneratorRuntime.wrap(function _callee$(_context) {
38
- while (1) {
39
- switch (_context.prev = _context.next) {
40
- case 0:
41
- return _context.abrupt("return", this.api.GetMetadataList(keyWords));
42
-
43
- case 1:
44
- case "end":
45
- return _context.stop();
46
- }
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ return _context.abrupt("return", this.api.GetMetadataList(keyWords));
36
+ case 1:
37
+ case "end":
38
+ return _context.stop();
47
39
  }
48
40
  }, _callee, this);
49
41
  }));
50
-
51
42
  function GetMetadataList(_x) {
52
43
  return _GetMetadataList.apply(this, arguments);
53
44
  }
54
-
55
45
  return GetMetadataList;
56
- }()
57
- /** 通过元数据Id获取元数据详情 */
58
-
46
+ }() /** 通过元数据Id获取元数据详情 */
59
47
  }, {
60
48
  key: "GetMetadataDetailById",
61
49
  value: function () {
62
50
  var _GetMetadataDetailById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(metadataId) {
63
51
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
64
- while (1) {
65
- switch (_context2.prev = _context2.next) {
66
- case 0:
67
- return _context2.abrupt("return", this.api.GetMetadataDetailById(metadataId));
68
-
69
- case 1:
70
- case "end":
71
- return _context2.stop();
72
- }
52
+ while (1) switch (_context2.prev = _context2.next) {
53
+ case 0:
54
+ return _context2.abrupt("return", this.api.GetMetadataDetailById(metadataId));
55
+ case 1:
56
+ case "end":
57
+ return _context2.stop();
73
58
  }
74
59
  }, _callee2, this);
75
60
  }));
76
-
77
61
  function GetMetadataDetailById(_x2) {
78
62
  return _GetMetadataDetailById.apply(this, arguments);
79
63
  }
80
-
81
64
  return GetMetadataDetailById;
82
- }()
83
- /** 添加元数据 */
84
-
65
+ }() /** 添加元数据 */
85
66
  }, {
86
67
  key: "SaveMetadata",
87
68
  value: function () {
88
69
  var _SaveMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, metadataTag) {
89
70
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
90
- while (1) {
91
- switch (_context3.prev = _context3.next) {
92
- case 0:
93
- return _context3.abrupt("return", this.api.SaveMetadata(data, metadataTag));
94
-
95
- case 1:
96
- case "end":
97
- return _context3.stop();
98
- }
71
+ while (1) switch (_context3.prev = _context3.next) {
72
+ case 0:
73
+ return _context3.abrupt("return", this.api.SaveMetadata(data, metadataTag));
74
+ case 1:
75
+ case "end":
76
+ return _context3.stop();
99
77
  }
100
78
  }, _callee3, this);
101
79
  }));
102
-
103
80
  function SaveMetadata(_x3, _x4) {
104
81
  return _SaveMetadata.apply(this, arguments);
105
82
  }
106
-
107
83
  return SaveMetadata;
108
- }()
109
- /** 获取元数据的值 */
110
-
84
+ }() /** 获取元数据的值 */
111
85
  }, {
112
86
  key: "GetMetadataObjList",
113
87
  value: function () {
114
88
  var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
115
89
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
116
- while (1) {
117
- switch (_context4.prev = _context4.next) {
118
- case 0:
119
- return _context4.abrupt("return", this.api.GetMetadataObjList(data));
120
-
121
- case 1:
122
- case "end":
123
- return _context4.stop();
124
- }
90
+ while (1) switch (_context4.prev = _context4.next) {
91
+ case 0:
92
+ return _context4.abrupt("return", this.api.GetMetadataObjList(data));
93
+ case 1:
94
+ case "end":
95
+ return _context4.stop();
125
96
  }
126
97
  }, _callee4, this);
127
98
  }));
128
-
129
99
  function GetMetadataObjList(_x5) {
130
100
  return _GetMetadataObjList.apply(this, arguments);
131
101
  }
132
-
133
102
  return GetMetadataObjList;
134
- }()
135
- /** 通过扩展规则获取枚举类型的值 */
136
-
103
+ }() /** 通过扩展规则获取枚举类型的值 */
137
104
  }, {
138
105
  key: "GetEnumDataByUrl",
139
106
  value: function () {
140
107
  var _GetEnumDataByUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(url) {
141
108
  var method,
142
- body,
143
- _args5 = arguments;
109
+ body,
110
+ _args5 = arguments;
144
111
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
145
- while (1) {
146
- switch (_context5.prev = _context5.next) {
147
- case 0:
148
- method = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : 'get';
149
- body = _args5.length > 2 ? _args5[2] : undefined;
150
- return _context5.abrupt("return", this.api.GetEnumDataByUrl(url, method, body));
151
-
152
- case 3:
153
- case "end":
154
- return _context5.stop();
155
- }
112
+ while (1) switch (_context5.prev = _context5.next) {
113
+ case 0:
114
+ method = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : 'get';
115
+ body = _args5.length > 2 ? _args5[2] : undefined;
116
+ return _context5.abrupt("return", this.api.GetEnumDataByUrl(url, method, body));
117
+ case 3:
118
+ case "end":
119
+ return _context5.stop();
156
120
  }
157
121
  }, _callee5, this);
158
122
  }));
159
-
160
123
  function GetEnumDataByUrl(_x6) {
161
124
  return _GetEnumDataByUrl.apply(this, arguments);
162
125
  }
163
-
164
126
  return GetEnumDataByUrl;
165
127
  }()
166
128
  }]);
167
-
168
129
  return MetadataService;
169
130
  }();
@@ -5,11 +5,9 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  export var Enum = /*#__PURE__*/function () {
6
6
  function Enum(value) {
7
7
  _classCallCheck(this, Enum);
8
-
9
8
  this.value = void 0;
10
9
  this.value = value;
11
10
  }
12
-
13
11
  _createClass(Enum, [{
14
12
  key: "__type__",
15
13
  get: function get() {
@@ -20,76 +18,59 @@ export var Enum = /*#__PURE__*/function () {
20
18
  value: function makeEnum(name, _enum) {
21
19
  var result = /*#__PURE__*/function (_Enum) {
22
20
  _inherits(result, _Enum);
23
-
24
21
  var _super = _createSuper(result);
25
-
26
22
  function result(value) {
27
23
  _classCallCheck(this, result);
28
-
29
24
  return _super.call(this, value);
30
25
  }
31
-
32
26
  _createClass(result, [{
33
27
  key: "__type__",
34
28
  get: function get() {
35
29
  return result;
36
30
  }
37
31
  }]);
38
-
39
32
  return result;
40
33
  }(Enum);
41
-
42
34
  result['__name__'] = name;
43
35
  result['__enum__'] = _enum;
44
36
  return result;
45
37
  }
46
38
  }]);
47
-
48
39
  return Enum;
49
40
  }();
50
- export var Array = function Array(items) {
41
+ export var Array = /*#__PURE__*/_createClass(function Array(items) {
51
42
  _classCallCheck(this, Array);
52
-
53
43
  this.items = void 0;
54
44
  this.items = items;
55
- };
45
+ });
56
46
  export var MetaObject = /*#__PURE__*/function () {
57
47
  function MetaObject() {
58
48
  _classCallCheck(this, MetaObject);
59
-
60
49
  var t = this.__type__;
61
-
62
50
  var _this = this;
63
-
64
51
  t.__properties__.forEach(function (v, k) {
65
52
  switch (v) {
66
53
  case Enum:
67
54
  case String:
68
55
  _this[k] = '';
69
56
  break;
70
-
71
57
  case Number:
72
58
  _this[k] = 0;
73
59
  break;
74
-
75
60
  case Boolean:
76
61
  _this[k] = false;
77
62
  break;
78
-
79
63
  case Array:
80
64
  _this[k] = [];
81
65
  break;
82
-
83
66
  case Object:
84
67
  _this[k] = {};
85
68
  break;
86
-
87
69
  default:
88
70
  _this[k] = null;
89
71
  }
90
72
  });
91
73
  }
92
-
93
74
  _createClass(MetaObject, [{
94
75
  key: "__type__",
95
76
  get: function get() {
@@ -100,25 +81,19 @@ export var MetaObject = /*#__PURE__*/function () {
100
81
  value: function makeType(name) {
101
82
  var result = /*#__PURE__*/function (_MetaObject) {
102
83
  _inherits(result, _MetaObject);
103
-
104
84
  var _super2 = _createSuper(result);
105
-
106
85
  function result() {
107
86
  _classCallCheck(this, result);
108
-
109
87
  return _super2.apply(this, arguments);
110
88
  }
111
-
112
89
  _createClass(result, [{
113
90
  key: "__type__",
114
91
  get: function get() {
115
92
  return result;
116
93
  }
117
94
  }]);
118
-
119
95
  return result;
120
96
  }(MetaObject);
121
-
122
97
  result['__name__'] = name;
123
98
  result['__fields__'] = new Map();
124
99
  result['__properties__'] = new Map();
@@ -129,39 +104,30 @@ export var MetaObject = /*#__PURE__*/function () {
129
104
  value: function makeArray() {
130
105
  var result = /*#__PURE__*/function (_Array) {
131
106
  _inherits(result, _Array);
132
-
133
107
  var _super3 = _createSuper(result);
134
-
135
108
  function result(items) {
136
109
  _classCallCheck(this, result);
137
-
138
110
  return _super3.call(this, items);
139
111
  }
140
-
141
112
  _createClass(result, [{
142
113
  key: "type",
143
114
  get: function get() {
144
115
  return result;
145
116
  }
146
117
  }]);
147
-
148
118
  return result;
149
119
  }(Array);
150
-
151
120
  return result;
152
121
  }
153
122
  }]);
154
-
155
123
  return MetaObject;
156
124
  }();
157
125
  export var MetadataProvider = /*#__PURE__*/function () {
158
126
  function MetadataProvider() {
159
127
  _classCallCheck(this, MetadataProvider);
160
-
161
128
  this.types = new Map();
162
129
  this.fields = new Map();
163
130
  }
164
-
165
131
  _createClass(MetadataProvider, [{
166
132
  key: "construct",
167
133
  value: function construct() {}
@@ -179,12 +145,10 @@ export var MetadataProvider = /*#__PURE__*/function () {
179
145
  key: "_make_type",
180
146
  value: function _make_type(id) {
181
147
  var result = this.get_type(id);
182
-
183
148
  if (!result) {
184
149
  result = MetaObject.makeType(id);
185
150
  this.types[id] = result;
186
151
  }
187
-
188
152
  return result;
189
153
  }
190
154
  }, {
@@ -201,24 +165,19 @@ export var MetadataProvider = /*#__PURE__*/function () {
201
165
  key: "_make_array",
202
166
  value: function _make_array(id) {
203
167
  var result = this.get_type("".concat(id));
204
-
205
168
  if (!result) {
206
169
  this._make_type(id);
207
-
208
170
  result = Array;
209
171
  }
210
-
211
172
  return result;
212
173
  }
213
174
  }, {
214
175
  key: "_make_enum",
215
176
  value: function _make_enum(id, _enum) {
216
177
  var result = this.get_type(id);
217
-
218
178
  if (!result) {
219
179
  result = Enum.makeEnum(id, _enum);
220
180
  }
221
-
222
181
  return result;
223
182
  }
224
183
  }, {
@@ -232,19 +191,14 @@ export var MetadataProvider = /*#__PURE__*/function () {
232
191
  throw new Error('not implemented error');
233
192
  }
234
193
  }]);
235
-
236
194
  return MetadataProvider;
237
195
  }();
238
196
  export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
239
197
  _inherits(JsonMetadataProvider, _MetadataProvider);
240
-
241
198
  var _super4 = _createSuper(JsonMetadataProvider);
242
-
243
199
  function JsonMetadataProvider() {
244
200
  var _this2;
245
-
246
201
  _classCallCheck(this, JsonMetadataProvider);
247
-
248
202
  _this2 = _super4.call(this);
249
203
  _this2.types['str'] = String;
250
204
  _this2.types['int'] = Number;
@@ -253,26 +207,19 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
253
207
  _this2.types['object'] = Object;
254
208
  return _this2;
255
209
  }
256
-
257
210
  _createClass(JsonMetadataProvider, [{
258
211
  key: "__visit_type",
259
212
  value: function __visit_type(id, value) {
260
213
  var _this3 = this;
261
-
262
214
  var valueType = value['type'];
263
-
264
215
  if (valueType === 'object') {
265
216
  var typeInfo = this._make_type(id);
266
-
267
217
  var properties = value.properties || [];
268
218
  properties.forEach(function (p) {
269
219
  var propertyName = "".concat(p['id']);
270
-
271
220
  var property = _this3.__visit_property(typeInfo, propertyName, p);
272
-
273
- typeInfo.__properties__.set(propertyName, property); // 处理fields
274
-
275
-
221
+ typeInfo.__properties__.set(propertyName, property);
222
+ // 处理fields
276
223
  var propertyFields = (p === null || p === void 0 ? void 0 : p.fields) || [];
277
224
  propertyFields.forEach(function (f) {
278
225
  typeInfo.__fields__.set(propertyName, f.value);
@@ -281,9 +228,7 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
281
228
  return typeInfo;
282
229
  } else if (valueType === 'array') {
283
230
  var item = value['items'];
284
-
285
231
  var arrayType = this.__visit_type(item['type'], item);
286
-
287
232
  return this._make_array(arrayType.__name__);
288
233
  } else if (valueType === 'ref') {
289
234
  var refid = value['refId'] || 'object';
@@ -295,7 +240,6 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
295
240
  return this.get_type('str');
296
241
  } else if (valueType == 'enum') {
297
242
  var _value$enum;
298
-
299
243
  var _enum = [];
300
244
  (_value$enum = value['enum']) === null || _value$enum === void 0 ? void 0 : _value$enum.forEach(function (en) {
301
245
  _enum.push(en['value']);
@@ -311,7 +255,6 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
311
255
  key: "__visit_property",
312
256
  value: function __visit_property(type, id, value) {
313
257
  var valuetype = value['type'];
314
-
315
258
  if (valuetype === 'object') {
316
259
  valuetype = this.__visit_type("".concat(type.__name__, "_").concat(id), value);
317
260
  return valuetype;
@@ -328,10 +271,8 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
328
271
  key: "add_types",
329
272
  value: function add_types(typedef) {
330
273
  var _this4 = this;
331
-
332
274
  typedef.forEach(function (item) {
333
275
  var typeInfo = _this4.__visit_type("".concat(item['id']), item);
334
-
335
276
  _this4.types[typeInfo.__name__] = typeInfo;
336
277
  });
337
278
  }
@@ -347,21 +288,16 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
347
288
  key: "__visit_object",
348
289
  value: function __visit_object(typeinfo, value) {
349
290
  var _this5 = this;
350
-
351
291
  var result = new typeinfo();
352
-
353
292
  typeinfo.__properties__.forEach(function (type, name) {
354
293
  var property = value[name];
355
-
356
294
  if (property) {
357
295
  if (type.prototype instanceof MetaObject) {
358
296
  result[name] = _this5.__visit_object(type, property);
359
297
  }
360
298
  }
361
-
362
299
  result[name] = _this5.__visit_value(type, property);
363
300
  });
364
-
365
301
  return result;
366
302
  }
367
303
  }, {
@@ -370,7 +306,6 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
370
306
  if (valuetype instanceof Array) {
371
307
  return value;
372
308
  }
373
-
374
309
  if (valuetype.prototype instanceof Enum) {
375
310
  return new valuetype(value);
376
311
  } else {
@@ -378,7 +313,6 @@ export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
378
313
  }
379
314
  }
380
315
  }]);
381
-
382
316
  return JsonMetadataProvider;
383
317
  }(MetadataProvider);
384
318
  export default new JsonMetadataProvider();