ronds-metadata 1.2.8 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
- package/es/comps/FormGenerator/index.d.ts +4 -0
- package/es/comps/FormGenerator/settings/index.d.ts +668 -49
- package/es/comps/JsonEdit/index.d.ts +5 -1
- package/es/comps/MetadataForm/index.less +1 -1
- package/es/comps/MetadataForm/utils.d.ts +1 -1
- package/package.json +1 -1
- package/es/api/index.js +0 -249
- package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
- package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
- package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
- package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
- package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
- package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
- package/es/comps/DynamicPorts/constant/index.js +0 -19
- package/es/comps/DynamicPorts/graph.js +0 -697
- package/es/comps/DynamicPorts/index.js +0 -143
- package/es/comps/DynamicPorts/interface.js +0 -6
- package/es/comps/DynamicPorts/utils.js +0 -127
- package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
- package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
- package/es/comps/Editable/DataCell/Input.js +0 -54
- package/es/comps/Editable/DataCell/Number.js +0 -44
- package/es/comps/Editable/DataCell/Select.js +0 -48
- package/es/comps/Editable/DataCell/Switch.js +0 -33
- package/es/comps/Editable/comps/EditableAction.js +0 -110
- package/es/comps/Editable/comps/EditableCell.js +0 -108
- package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
- package/es/comps/Editable/comps/EditableRow.js +0 -118
- package/es/comps/Editable/comps/Texty.js +0 -277
- package/es/comps/Editable/index.js +0 -385
- package/es/comps/Editable/interface.js +0 -8
- package/es/comps/Editable/utils.js +0 -46
- package/es/comps/FileView/index.js +0 -198
- package/es/comps/FormGenerator/Provider.js +0 -8
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
- package/es/comps/FormGenerator/comps/Canvas/index.js +0 -216
- package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
- package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
- package/es/comps/FormGenerator/index.js +0 -56
- package/es/comps/FormGenerator/settings/index.js +0 -303
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
- package/es/comps/FormGenerator/transformer.js +0 -214
- package/es/comps/Icons/index.js +0 -23
- package/es/comps/JsonEdit/constant/index.js +0 -87
- package/es/comps/JsonEdit/index.js +0 -217
- package/es/comps/JsonView/index.js +0 -109
- package/es/comps/MdEdit/index.js +0 -41
- package/es/comps/MdNavbar/index.js +0 -180
- package/es/comps/MdNavbar/utils.js +0 -34
- package/es/comps/MdView/index.js +0 -70
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
- package/es/comps/MetadataEdit/constant/index.js +0 -69
- package/es/comps/MetadataEdit/hooks/index.js +0 -43
- package/es/comps/MetadataEdit/index.js +0 -255
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
- package/es/comps/MetadataEditV2/constant/index.js +0 -69
- package/es/comps/MetadataEditV2/hooks/index.js +0 -43
- package/es/comps/MetadataEditV2/index.js +0 -298
- package/es/comps/MetadataForm/DataCell/Array.js +0 -157
- package/es/comps/MetadataForm/DataCell/Input.js +0 -197
- package/es/comps/MetadataForm/DataCell/Number.js +0 -130
- package/es/comps/MetadataForm/DataCell/Ref.js +0 -323
- package/es/comps/MetadataForm/DataCell/Select.js +0 -517
- package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
- package/es/comps/MetadataForm/HOC/index.js +0 -111
- package/es/comps/MetadataForm/constants.js +0 -11
- package/es/comps/MetadataForm/hooks/index.js +0 -128
- package/es/comps/MetadataForm/index.js +0 -268
- package/es/comps/MetadataForm/interface.js +0 -8
- package/es/comps/MetadataForm/utils.js +0 -108
- package/es/comps/locales/en-US.js +0 -24
- package/es/comps/locales/index.js +0 -8
- package/es/comps/locales/zh-CN.js +0 -24
- package/es/config.js +0 -50
- package/es/framework/graph/index.js +0 -515
- package/es/framework/hooks/use-async-memo.js +0 -32
- package/es/framework/hooks/use-sync-scroll.js +0 -106
- package/es/framework/http/cache.js +0 -137
- package/es/framework/http/cancel.js +0 -44
- package/es/framework/http/index.js +0 -392
- package/es/framework/http/msgpack.js +0 -34
- package/es/framework/http/msgpack5/index.js +0 -84
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
- package/es/framework/http/msgpack5/lib/decoder.js +0 -287
- package/es/framework/http/msgpack5/lib/encoder.js +0 -252
- package/es/framework/http/msgpack5/lib/helpers.js +0 -23
- package/es/framework/http/msgpack5/lib/streams.js +0 -93
- package/es/framework/http/types.js +0 -1
- package/es/framework/libs/jquery.min.js +0 -4022
- package/es/framework/locale/dil8/di18n.js +0 -132
- package/es/framework/locale/dil8/index.js +0 -3
- package/es/framework/locale/dil8/translate.js +0 -76
- package/es/framework/locale/dil8/util.js +0 -17
- package/es/framework/locale/index.js +0 -26
- package/es/framework/metadata/MetadataService.js +0 -169
- package/es/framework/metadata/index.js +0 -384
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
- package/es/framework/rxjs-hooks/useObservable.js +0 -22
- package/es/framework/rxjs-hooks/useObservableState.js +0 -45
- package/es/index.js +0 -27
- package/es/utils.js +0 -138
@@ -1,384 +0,0 @@
|
|
1
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
2
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
5
|
-
export var Enum = /*#__PURE__*/function () {
|
6
|
-
function Enum(value) {
|
7
|
-
_classCallCheck(this, Enum);
|
8
|
-
|
9
|
-
this.value = void 0;
|
10
|
-
this.value = value;
|
11
|
-
}
|
12
|
-
|
13
|
-
_createClass(Enum, [{
|
14
|
-
key: "__type__",
|
15
|
-
get: function get() {
|
16
|
-
return {};
|
17
|
-
}
|
18
|
-
}], [{
|
19
|
-
key: "makeEnum",
|
20
|
-
value: function makeEnum(name, _enum) {
|
21
|
-
var result = /*#__PURE__*/function (_Enum) {
|
22
|
-
_inherits(result, _Enum);
|
23
|
-
|
24
|
-
var _super = _createSuper(result);
|
25
|
-
|
26
|
-
function result(value) {
|
27
|
-
_classCallCheck(this, result);
|
28
|
-
|
29
|
-
return _super.call(this, value);
|
30
|
-
}
|
31
|
-
|
32
|
-
_createClass(result, [{
|
33
|
-
key: "__type__",
|
34
|
-
get: function get() {
|
35
|
-
return result;
|
36
|
-
}
|
37
|
-
}]);
|
38
|
-
|
39
|
-
return result;
|
40
|
-
}(Enum);
|
41
|
-
|
42
|
-
result['__name__'] = name;
|
43
|
-
result['__enum__'] = _enum;
|
44
|
-
return result;
|
45
|
-
}
|
46
|
-
}]);
|
47
|
-
|
48
|
-
return Enum;
|
49
|
-
}();
|
50
|
-
export var Array = function Array(items) {
|
51
|
-
_classCallCheck(this, Array);
|
52
|
-
|
53
|
-
this.items = void 0;
|
54
|
-
this.items = items;
|
55
|
-
};
|
56
|
-
export var MetaObject = /*#__PURE__*/function () {
|
57
|
-
function MetaObject() {
|
58
|
-
_classCallCheck(this, MetaObject);
|
59
|
-
|
60
|
-
var t = this.__type__;
|
61
|
-
|
62
|
-
var _this = this;
|
63
|
-
|
64
|
-
t.__properties__.forEach(function (v, k) {
|
65
|
-
switch (v) {
|
66
|
-
case Enum:
|
67
|
-
case String:
|
68
|
-
_this[k] = '';
|
69
|
-
break;
|
70
|
-
|
71
|
-
case Number:
|
72
|
-
_this[k] = 0;
|
73
|
-
break;
|
74
|
-
|
75
|
-
case Boolean:
|
76
|
-
_this[k] = false;
|
77
|
-
break;
|
78
|
-
|
79
|
-
case Array:
|
80
|
-
_this[k] = [];
|
81
|
-
break;
|
82
|
-
|
83
|
-
case Object:
|
84
|
-
_this[k] = {};
|
85
|
-
break;
|
86
|
-
|
87
|
-
default:
|
88
|
-
_this[k] = null;
|
89
|
-
}
|
90
|
-
});
|
91
|
-
}
|
92
|
-
|
93
|
-
_createClass(MetaObject, [{
|
94
|
-
key: "__type__",
|
95
|
-
get: function get() {
|
96
|
-
return {};
|
97
|
-
}
|
98
|
-
}], [{
|
99
|
-
key: "makeType",
|
100
|
-
value: function makeType(name) {
|
101
|
-
var result = /*#__PURE__*/function (_MetaObject) {
|
102
|
-
_inherits(result, _MetaObject);
|
103
|
-
|
104
|
-
var _super2 = _createSuper(result);
|
105
|
-
|
106
|
-
function result() {
|
107
|
-
_classCallCheck(this, result);
|
108
|
-
|
109
|
-
return _super2.apply(this, arguments);
|
110
|
-
}
|
111
|
-
|
112
|
-
_createClass(result, [{
|
113
|
-
key: "__type__",
|
114
|
-
get: function get() {
|
115
|
-
return result;
|
116
|
-
}
|
117
|
-
}]);
|
118
|
-
|
119
|
-
return result;
|
120
|
-
}(MetaObject);
|
121
|
-
|
122
|
-
result['__name__'] = name;
|
123
|
-
result['__fields__'] = new Map();
|
124
|
-
result['__properties__'] = new Map();
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
}, {
|
128
|
-
key: "makeArray",
|
129
|
-
value: function makeArray() {
|
130
|
-
var result = /*#__PURE__*/function (_Array) {
|
131
|
-
_inherits(result, _Array);
|
132
|
-
|
133
|
-
var _super3 = _createSuper(result);
|
134
|
-
|
135
|
-
function result(items) {
|
136
|
-
_classCallCheck(this, result);
|
137
|
-
|
138
|
-
return _super3.call(this, items);
|
139
|
-
}
|
140
|
-
|
141
|
-
_createClass(result, [{
|
142
|
-
key: "type",
|
143
|
-
get: function get() {
|
144
|
-
return result;
|
145
|
-
}
|
146
|
-
}]);
|
147
|
-
|
148
|
-
return result;
|
149
|
-
}(Array);
|
150
|
-
|
151
|
-
return result;
|
152
|
-
}
|
153
|
-
}]);
|
154
|
-
|
155
|
-
return MetaObject;
|
156
|
-
}();
|
157
|
-
export var MetadataProvider = /*#__PURE__*/function () {
|
158
|
-
function MetadataProvider() {
|
159
|
-
_classCallCheck(this, MetadataProvider);
|
160
|
-
|
161
|
-
this.types = new Map();
|
162
|
-
this.fields = new Map();
|
163
|
-
}
|
164
|
-
|
165
|
-
_createClass(MetadataProvider, [{
|
166
|
-
key: "construct",
|
167
|
-
value: function construct() {}
|
168
|
-
}, {
|
169
|
-
key: "get_type",
|
170
|
-
value: function get_type(id) {
|
171
|
-
return this.types[id];
|
172
|
-
}
|
173
|
-
}, {
|
174
|
-
key: "_add_type",
|
175
|
-
value: function _add_type(typeinfo) {
|
176
|
-
this.types[typeinfo.name] = typeinfo;
|
177
|
-
}
|
178
|
-
}, {
|
179
|
-
key: "_make_type",
|
180
|
-
value: function _make_type(id) {
|
181
|
-
var result = this.get_type(id);
|
182
|
-
|
183
|
-
if (!result) {
|
184
|
-
result = MetaObject.makeType(id);
|
185
|
-
this.types[id] = result;
|
186
|
-
}
|
187
|
-
|
188
|
-
return result;
|
189
|
-
}
|
190
|
-
}, {
|
191
|
-
key: "get_fields",
|
192
|
-
value: function get_fields(id) {
|
193
|
-
return this.fields[id];
|
194
|
-
}
|
195
|
-
}, {
|
196
|
-
key: "_add_fields",
|
197
|
-
value: function _add_fields(fieldsInfo) {
|
198
|
-
this.types[fieldsInfo.name] = fieldsInfo;
|
199
|
-
}
|
200
|
-
}, {
|
201
|
-
key: "_make_array",
|
202
|
-
value: function _make_array(id) {
|
203
|
-
var result = this.get_type("".concat(id));
|
204
|
-
|
205
|
-
if (!result) {
|
206
|
-
this._make_type(id);
|
207
|
-
|
208
|
-
result = Array;
|
209
|
-
}
|
210
|
-
|
211
|
-
return result;
|
212
|
-
}
|
213
|
-
}, {
|
214
|
-
key: "_make_enum",
|
215
|
-
value: function _make_enum(id, _enum) {
|
216
|
-
var result = this.get_type(id);
|
217
|
-
|
218
|
-
if (!result) {
|
219
|
-
result = Enum.makeEnum(id, _enum);
|
220
|
-
}
|
221
|
-
|
222
|
-
return result;
|
223
|
-
}
|
224
|
-
}, {
|
225
|
-
key: "add_types",
|
226
|
-
value: function add_types(typedef) {
|
227
|
-
throw new Error('not implemented error');
|
228
|
-
}
|
229
|
-
}, {
|
230
|
-
key: "get_objects",
|
231
|
-
value: function get_objects(objectdef) {
|
232
|
-
throw new Error('not implemented error');
|
233
|
-
}
|
234
|
-
}]);
|
235
|
-
|
236
|
-
return MetadataProvider;
|
237
|
-
}();
|
238
|
-
export var JsonMetadataProvider = /*#__PURE__*/function (_MetadataProvider) {
|
239
|
-
_inherits(JsonMetadataProvider, _MetadataProvider);
|
240
|
-
|
241
|
-
var _super4 = _createSuper(JsonMetadataProvider);
|
242
|
-
|
243
|
-
function JsonMetadataProvider() {
|
244
|
-
var _this2;
|
245
|
-
|
246
|
-
_classCallCheck(this, JsonMetadataProvider);
|
247
|
-
|
248
|
-
_this2 = _super4.call(this);
|
249
|
-
_this2.types['str'] = String;
|
250
|
-
_this2.types['int'] = Number;
|
251
|
-
_this2.types['double'] = Number;
|
252
|
-
_this2.types['bool'] = Boolean;
|
253
|
-
_this2.types['object'] = Object;
|
254
|
-
return _this2;
|
255
|
-
}
|
256
|
-
|
257
|
-
_createClass(JsonMetadataProvider, [{
|
258
|
-
key: "__visit_type",
|
259
|
-
value: function __visit_type(id, value) {
|
260
|
-
var _this3 = this;
|
261
|
-
|
262
|
-
var valueType = value['type'];
|
263
|
-
|
264
|
-
if (valueType === 'object') {
|
265
|
-
var typeInfo = this._make_type(id);
|
266
|
-
|
267
|
-
var properties = value.properties || [];
|
268
|
-
properties.forEach(function (p) {
|
269
|
-
var propertyName = "".concat(p['id']);
|
270
|
-
|
271
|
-
var property = _this3.__visit_property(typeInfo, propertyName, p);
|
272
|
-
|
273
|
-
typeInfo.__properties__.set(propertyName, property); // 处理fields
|
274
|
-
|
275
|
-
|
276
|
-
var propertyFields = (p === null || p === void 0 ? void 0 : p.fields) || [];
|
277
|
-
propertyFields.forEach(function (f) {
|
278
|
-
typeInfo.__fields__.set(propertyName, f.value);
|
279
|
-
});
|
280
|
-
});
|
281
|
-
return typeInfo;
|
282
|
-
} else if (valueType === 'array') {
|
283
|
-
var item = value['items'];
|
284
|
-
|
285
|
-
var arrayType = this.__visit_type(item['type'], item);
|
286
|
-
|
287
|
-
return this._make_array(arrayType.__name__);
|
288
|
-
} else if (valueType === 'ref') {
|
289
|
-
var refid = value['refId'] || 'object';
|
290
|
-
return this._make_type("".concat(refid));
|
291
|
-
} else if (valueType === 'number') {
|
292
|
-
var format = value['format'] || 'double';
|
293
|
-
return this.get_type(format);
|
294
|
-
} else if (valueType === 'text') {
|
295
|
-
return this.get_type('str');
|
296
|
-
} else if (valueType == 'enum') {
|
297
|
-
var _value$enum;
|
298
|
-
|
299
|
-
var _enum = [];
|
300
|
-
(_value$enum = value['enum']) === null || _value$enum === void 0 ? void 0 : _value$enum.forEach(function (en) {
|
301
|
-
_enum.push(en['value']);
|
302
|
-
});
|
303
|
-
return this._make_enum(value.id, _enum);
|
304
|
-
} else if (valueType == 'bool') {
|
305
|
-
return this.get_type('bool');
|
306
|
-
} else {
|
307
|
-
throw new Error('invalid type value');
|
308
|
-
}
|
309
|
-
}
|
310
|
-
}, {
|
311
|
-
key: "__visit_property",
|
312
|
-
value: function __visit_property(type, id, value) {
|
313
|
-
var valuetype = value['type'];
|
314
|
-
|
315
|
-
if (valuetype === 'object') {
|
316
|
-
valuetype = this.__visit_type("".concat(type.__name__, "_").concat(id), value);
|
317
|
-
return valuetype;
|
318
|
-
} else {
|
319
|
-
return this.__visit_type(valuetype, value);
|
320
|
-
}
|
321
|
-
}
|
322
|
-
}, {
|
323
|
-
key: "__visit_field",
|
324
|
-
value: function __visit_field(id, value) {
|
325
|
-
return this.__visit_type(id, value);
|
326
|
-
}
|
327
|
-
}, {
|
328
|
-
key: "add_types",
|
329
|
-
value: function add_types(typedef) {
|
330
|
-
var _this4 = this;
|
331
|
-
|
332
|
-
typedef.forEach(function (item) {
|
333
|
-
var typeInfo = _this4.__visit_type("".concat(item['id']), item);
|
334
|
-
|
335
|
-
_this4.types[typeInfo.__name__] = typeInfo;
|
336
|
-
});
|
337
|
-
}
|
338
|
-
}, {
|
339
|
-
key: "get_objects",
|
340
|
-
value: function get_objects(objectdef) {
|
341
|
-
var refid = objectdef['_refId'];
|
342
|
-
var typename = "".concat(refid);
|
343
|
-
var typeinfo = this.get_type(typename);
|
344
|
-
return this.__visit_object(typeinfo, objectdef);
|
345
|
-
}
|
346
|
-
}, {
|
347
|
-
key: "__visit_object",
|
348
|
-
value: function __visit_object(typeinfo, value) {
|
349
|
-
var _this5 = this;
|
350
|
-
|
351
|
-
var result = new typeinfo();
|
352
|
-
|
353
|
-
typeinfo.__properties__.forEach(function (type, name) {
|
354
|
-
var property = value[name];
|
355
|
-
|
356
|
-
if (property) {
|
357
|
-
if (type.prototype instanceof MetaObject) {
|
358
|
-
result[name] = _this5.__visit_object(type, property);
|
359
|
-
}
|
360
|
-
}
|
361
|
-
|
362
|
-
result[name] = _this5.__visit_value(type, property);
|
363
|
-
});
|
364
|
-
|
365
|
-
return result;
|
366
|
-
}
|
367
|
-
}, {
|
368
|
-
key: "__visit_value",
|
369
|
-
value: function __visit_value(valuetype, value) {
|
370
|
-
if (valuetype instanceof Array) {
|
371
|
-
return value;
|
372
|
-
}
|
373
|
-
|
374
|
-
if (valuetype.prototype instanceof Enum) {
|
375
|
-
return new valuetype(value);
|
376
|
-
} else {
|
377
|
-
return value;
|
378
|
-
}
|
379
|
-
}
|
380
|
-
}]);
|
381
|
-
|
382
|
-
return JsonMetadataProvider;
|
383
|
-
}(MetadataProvider);
|
384
|
-
export default new JsonMetadataProvider();
|
@@ -1,16 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: wangxian
|
3
|
-
* @Date: 2022-03-30 10:12:11
|
4
|
-
* @LastEditTime: 2022-04-01 08:15:21
|
5
|
-
*/
|
6
|
-
import React from 'react';
|
7
|
-
import { BehaviorSubject } from 'rxjs';
|
8
|
-
|
9
|
-
var useMemoSubject = function useMemoSubject() {
|
10
|
-
var subject$ = React.useMemo(function () {
|
11
|
-
return new BehaviorSubject(undefined);
|
12
|
-
}, []);
|
13
|
-
return subject$;
|
14
|
-
};
|
15
|
-
|
16
|
-
export default useMemoSubject;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: wangxian
|
3
|
-
* @Date: 2022-03-30 10:12:11
|
4
|
-
* @LastEditTime: 2022-07-14 08:33:58
|
5
|
-
*/
|
6
|
-
import React from 'react';
|
7
|
-
|
8
|
-
var useObservable = function useObservable(fn) {
|
9
|
-
var dep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
10
|
-
React.useEffect(function () {
|
11
|
-
var _dep$, _dep$2;
|
12
|
-
|
13
|
-
var subscription = dep[0] && ((_dep$ = dep[0]) === null || _dep$ === void 0 ? void 0 : _dep$.subscribe) && ((_dep$2 = dep[0]) === null || _dep$2 === void 0 ? void 0 : _dep$2.subscribe(function (p) {
|
14
|
-
fn(p);
|
15
|
-
}));
|
16
|
-
return function () {
|
17
|
-
return subscription && subscription.unsubscribe();
|
18
|
-
};
|
19
|
-
}, dep);
|
20
|
-
};
|
21
|
-
|
22
|
-
export default useObservable;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
|
3
|
-
/*
|
4
|
-
* @Author: wangxian
|
5
|
-
* @Date: 2022-05-27 10:32:55
|
6
|
-
* @LastEditTime: 2022-05-27 10:58:18
|
7
|
-
*/
|
8
|
-
import { useEffect, useMemo, useState } from 'react';
|
9
|
-
import { BehaviorSubject } from 'rxjs';
|
10
|
-
export var useObservableState = function useObservableState(source$, initialState) {
|
11
|
-
var source = useMemo(function () {
|
12
|
-
if (typeof source$ === 'function') {
|
13
|
-
return source$();
|
14
|
-
}
|
15
|
-
|
16
|
-
return source$;
|
17
|
-
}, [source$]);
|
18
|
-
|
19
|
-
var _useState = useState(function () {
|
20
|
-
if (source instanceof BehaviorSubject) {
|
21
|
-
return source.getValue();
|
22
|
-
}
|
23
|
-
|
24
|
-
return initialState;
|
25
|
-
}),
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
27
|
-
state = _useState2[0],
|
28
|
-
setState = _useState2[1];
|
29
|
-
|
30
|
-
useEffect(function () {
|
31
|
-
if (source) {
|
32
|
-
var sub = source.subscribe(function (v) {
|
33
|
-
if (v) {
|
34
|
-
setState(v);
|
35
|
-
}
|
36
|
-
});
|
37
|
-
return function () {
|
38
|
-
sub.unsubscribe();
|
39
|
-
};
|
40
|
-
}
|
41
|
-
|
42
|
-
return function () {};
|
43
|
-
}, [source]);
|
44
|
-
return [state, setState];
|
45
|
-
};
|
package/es/index.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author:wangxian
|
3
|
-
* @Date: 2021-09-18 14:15:04
|
4
|
-
* @LastEditTime: 2023-02-04 13:52:49
|
5
|
-
*/
|
6
|
-
import './theme.less';
|
7
|
-
export { default as MetadataEdit } from './comps/MetadataEdit';
|
8
|
-
export { default as MetaPropsEdit } from './comps/MetadataEdit/components/MetaPropsEdit';
|
9
|
-
export { default as MetadataEditV2 } from './comps/MetadataEditV2';
|
10
|
-
export { default as MetadataForm } from './comps/MetadataForm';
|
11
|
-
export { default as JsonView } from './comps/JsonView';
|
12
|
-
export { default as JsonEdit } from './comps/JsonEdit';
|
13
|
-
export { default as MdEditor } from './comps/MdEdit';
|
14
|
-
export { default as MdView } from './comps/MdView';
|
15
|
-
export { default as FileView } from './comps/FileView';
|
16
|
-
export { default as Editable } from './comps/Editable';
|
17
|
-
export { default as FormGenerator } from './comps/FormGenerator';
|
18
|
-
export { default as DynamicPorts } from './comps/DynamicPorts';
|
19
|
-
export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
|
20
|
-
export { default as Icon } from './comps/Icons';
|
21
|
-
export * from './framework/metadata/index';
|
22
|
-
export { default as http, addInterceptor } from './framework/http/index';
|
23
|
-
export { default as useMemoSubject } from './framework/rxjs-hooks/useMemoSubject';
|
24
|
-
export { default as useObservable } from './framework/rxjs-hooks/useObservable';
|
25
|
-
export { default as useSyncScroll, useSyncScrollByRefs } from './framework/hooks/use-sync-scroll';
|
26
|
-
export { registerMetadataAPI } from './framework/metadata/MetadataService';
|
27
|
-
export { globalSettingStream } from './config';
|
package/es/utils.js
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
|
4
|
-
/*
|
5
|
-
* @Author: wangxian
|
6
|
-
* @Date: 2021-09-18 14:15:04
|
7
|
-
* @LastEditTime: 2023-02-13 17:02:22
|
8
|
-
*/
|
9
|
-
import { useCallback, useEffect, useRef } from 'react';
|
10
|
-
/** 防抖 */
|
11
|
-
|
12
|
-
export function useDebounce(fn, delay) {
|
13
|
-
var dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
14
|
-
|
15
|
-
var _useRef = useRef({
|
16
|
-
fn: fn,
|
17
|
-
timer: null
|
18
|
-
}),
|
19
|
-
current = _useRef.current;
|
20
|
-
|
21
|
-
useEffect(function () {
|
22
|
-
current.fn = fn;
|
23
|
-
return function () {
|
24
|
-
if (current.timer) {
|
25
|
-
clearTimeout(current.timer);
|
26
|
-
}
|
27
|
-
}; // eslint-disable-next-line
|
28
|
-
}, [fn]);
|
29
|
-
return useCallback(function f() {
|
30
|
-
var _this = this;
|
31
|
-
|
32
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
33
|
-
args[_key] = arguments[_key];
|
34
|
-
}
|
35
|
-
|
36
|
-
if (current.timer) {
|
37
|
-
clearTimeout(current.timer);
|
38
|
-
}
|
39
|
-
|
40
|
-
current.timer = setTimeout(function () {
|
41
|
-
var _current$fn;
|
42
|
-
|
43
|
-
// @ts-ignore
|
44
|
-
(_current$fn = current.fn).call.apply(_current$fn, [_this].concat(args));
|
45
|
-
}, delay); // eslint-disable-next-line
|
46
|
-
}, dep);
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
*
|
50
|
-
* 节流
|
51
|
-
* @export
|
52
|
-
* @param {Function} fn
|
53
|
-
* @param {number} delay
|
54
|
-
* @param {DependencyList} [dep=[]]
|
55
|
-
* @returns
|
56
|
-
*/
|
57
|
-
|
58
|
-
export function useThrottle(fn, delay) {
|
59
|
-
var dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
60
|
-
|
61
|
-
var _useRef2 = useRef({
|
62
|
-
fn: fn,
|
63
|
-
timer: null
|
64
|
-
}),
|
65
|
-
current = _useRef2.current;
|
66
|
-
|
67
|
-
useEffect(function () {
|
68
|
-
current.fn = fn; // eslint-disable-next-line
|
69
|
-
}, [fn]);
|
70
|
-
return useCallback(function f() {
|
71
|
-
if (!current.timer) {
|
72
|
-
var _current$fn2;
|
73
|
-
|
74
|
-
current.timer = setTimeout(function () {
|
75
|
-
delete current.timer;
|
76
|
-
}, delay); // @ts-ignore
|
77
|
-
|
78
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
79
|
-
args[_key2] = arguments[_key2];
|
80
|
-
}
|
81
|
-
|
82
|
-
(_current$fn2 = current.fn).call.apply(_current$fn2, [this].concat(args));
|
83
|
-
} // eslint-disable-next-line
|
84
|
-
|
85
|
-
}, dep);
|
86
|
-
}
|
87
|
-
export function deepClone(target) {
|
88
|
-
return JSON.parse(JSON.stringify(target));
|
89
|
-
}
|
90
|
-
export function guid() {
|
91
|
-
var id = '',
|
92
|
-
i,
|
93
|
-
random,
|
94
|
-
chars = 'abcdef';
|
95
|
-
id += chars[Math.floor(Math.random() * Math.floor(chars.length))];
|
96
|
-
|
97
|
-
for (i = 1; i < 32; i++) {
|
98
|
-
random = Math.random() * 16 | 0;
|
99
|
-
|
100
|
-
if (i == 8 || i == 12 || i == 16 || i == 20) {
|
101
|
-
id += '-';
|
102
|
-
}
|
103
|
-
|
104
|
-
id += (i == 12 ? 4 : i == 16 ? random & 3 | 8 : random).toString(16);
|
105
|
-
}
|
106
|
-
|
107
|
-
return id;
|
108
|
-
}
|
109
|
-
|
110
|
-
var crypto = require('crypto');
|
111
|
-
|
112
|
-
export var md5 = function md5(data) {
|
113
|
-
var digest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hex';
|
114
|
-
return crypto.createHash('md5').update(data).digest(digest || 'base64');
|
115
|
-
};
|
116
|
-
export function arrayMoveMutable(array, fromIndex, toIndex) {
|
117
|
-
var startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;
|
118
|
-
|
119
|
-
if (startIndex >= 0 && startIndex < array.length) {
|
120
|
-
var endIndex = toIndex < 0 ? array.length + toIndex : toIndex;
|
121
|
-
|
122
|
-
var _array$splice = array.splice(fromIndex, 1),
|
123
|
-
_array$splice2 = _slicedToArray(_array$splice, 1),
|
124
|
-
item = _array$splice2[0];
|
125
|
-
|
126
|
-
array.splice(endIndex, 0, item);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
export function arrayMoveImmutable(array, fromIndex, toIndex) {
|
130
|
-
var newArray = _toConsumableArray(array);
|
131
|
-
|
132
|
-
arrayMoveMutable(newArray, fromIndex, toIndex);
|
133
|
-
return newArray;
|
134
|
-
}
|
135
|
-
export function arrayInsert(array, index, item) {
|
136
|
-
array.splice(index, 0, item);
|
137
|
-
return array;
|
138
|
-
}
|