@zhubangyun/lowcode-core 5.12.92 → 6.1.90

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 (98) hide show
  1. package/es/components/load-materials/index.js +44 -28
  2. package/es/components/page-loading/index.js +4 -1
  3. package/es/demo/index.js +8 -8
  4. package/es/index.d.ts +1 -1
  5. package/es/index.js +41 -2
  6. package/es/index.less +10 -0
  7. package/es/style.js +2 -2
  8. package/es/utils/api/file-api.js +21 -21
  9. package/es/utils/api/form-api.d.ts +2 -1
  10. package/es/utils/api/form-api.js +90 -51
  11. package/es/utils/api/form-api.utils.js +5 -4
  12. package/es/utils/api/index.d.ts +2 -2
  13. package/es/utils/api/index.js +1 -0
  14. package/es/utils/api/rest-api.d.ts +3 -1
  15. package/es/utils/api/rest-api.js +207 -125
  16. package/es/utils/api/schema-api.js +5 -5
  17. package/es/utils/api/schema.util.d.ts +3 -3
  18. package/es/utils/api/schema.util.js +17 -12
  19. package/es/utils/api/script-api.js +12 -12
  20. package/es/utils/api/user-info.js +7 -7
  21. package/es/utils/cache/index.js +66 -26
  22. package/es/utils/common/LoadPlugins.js +33 -33
  23. package/es/utils/common/SingletonInstanceMap.js +21 -21
  24. package/es/utils/common/index.d.ts +3 -0
  25. package/es/utils/common/index.js +13 -3
  26. package/es/utils/designer/assets/assets.parse.js +15 -15
  27. package/es/utils/designer/assets/assets.typing.js +6 -0
  28. package/es/utils/designer/engine/index.js +23 -23
  29. package/es/utils/designer/index.js +7 -7
  30. package/es/utils/page/index.js +18 -18
  31. package/es/utils/page/page-form-data-manager-group.js +9 -6
  32. package/es/utils/page/page-form-data-manager.d.ts +1 -0
  33. package/es/utils/page/page-form-data-manager.js +9 -6
  34. package/es/utils/page/page-form-group.d.ts +1 -0
  35. package/es/utils/page/page-form-group.js +8 -7
  36. package/es/utils/page/page-form.d.ts +1 -0
  37. package/es/utils/page/page-form.js +23 -12
  38. package/es/utils/page/page-layout.d.ts +3 -0
  39. package/es/utils/page/page-layout.js +33 -9
  40. package/es/utils/page/page-load-schema.js +20 -28
  41. package/es/utils/page/page-render.js +4 -4
  42. package/es/utils/page/page-show.d.ts +2 -0
  43. package/es/utils/page/page-show.js +8 -3
  44. package/es/utils/page/print-form.js +60 -51
  45. package/es/utils/uni-bridge.d.ts +18 -0
  46. package/es/utils/uni-bridge.js +130 -0
  47. package/es/utils/util.common.d.ts +1 -0
  48. package/es/utils/util.common.js +4 -0
  49. package/lib/components/load-materials/index.js +45 -30
  50. package/lib/components/page-loading/index.js +4 -1
  51. package/lib/demo/index.js +9 -10
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.js +45 -6
  54. package/lib/index.less +10 -0
  55. package/lib/style.js +2 -2
  56. package/lib/utils/api/file-api.js +21 -21
  57. package/lib/utils/api/form-api.d.ts +2 -1
  58. package/lib/utils/api/form-api.js +90 -51
  59. package/lib/utils/api/form-api.utils.js +5 -4
  60. package/lib/utils/api/index.d.ts +2 -2
  61. package/lib/utils/api/index.js +2 -2
  62. package/lib/utils/api/rest-api.d.ts +3 -1
  63. package/lib/utils/api/rest-api.js +207 -125
  64. package/lib/utils/api/schema-api.js +5 -5
  65. package/lib/utils/api/schema.util.d.ts +3 -3
  66. package/lib/utils/api/schema.util.js +19 -13
  67. package/lib/utils/api/script-api.js +12 -12
  68. package/lib/utils/api/user-info.js +7 -7
  69. package/lib/utils/cache/index.js +65 -25
  70. package/lib/utils/common/LoadPlugins.js +33 -33
  71. package/lib/utils/common/SingletonInstanceMap.js +21 -21
  72. package/lib/utils/common/index.d.ts +3 -0
  73. package/lib/utils/common/index.js +15 -2
  74. package/lib/utils/designer/assets/assets.parse.js +16 -17
  75. package/lib/utils/designer/assets/assets.typing.js +6 -0
  76. package/lib/utils/designer/engine/index.js +23 -23
  77. package/lib/utils/designer/index.js +7 -7
  78. package/lib/utils/index.js +1 -2
  79. package/lib/utils/page/index.js +18 -18
  80. package/lib/utils/page/page-form-data-manager-group.js +10 -8
  81. package/lib/utils/page/page-form-data-manager.d.ts +1 -0
  82. package/lib/utils/page/page-form-data-manager.js +10 -8
  83. package/lib/utils/page/page-form-group.d.ts +1 -0
  84. package/lib/utils/page/page-form-group.js +9 -9
  85. package/lib/utils/page/page-form.d.ts +1 -0
  86. package/lib/utils/page/page-form.js +24 -14
  87. package/lib/utils/page/page-layout.d.ts +3 -0
  88. package/lib/utils/page/page-layout.js +34 -11
  89. package/lib/utils/page/page-load-schema.js +19 -27
  90. package/lib/utils/page/page-render.js +4 -4
  91. package/lib/utils/page/page-show.d.ts +2 -0
  92. package/lib/utils/page/page-show.js +9 -5
  93. package/lib/utils/page/print-form.js +60 -51
  94. package/lib/utils/uni-bridge.d.ts +18 -0
  95. package/lib/utils/uni-bridge.js +135 -0
  96. package/lib/utils/util.common.d.ts +1 -0
  97. package/lib/utils/util.common.js +8 -0
  98. package/package.json +2 -2
@@ -4,11 +4,11 @@
4
4
  * @param callback 返回true 继续往下遍历
5
5
  */
6
6
  export declare function forEachSchema(schema: Schema, callback: (child: Schema, index: number, children: any[]) => boolean): void;
7
- export declare function forEachFormSchema(schema: Schema, fdm: boolean, callback: (child: Schema) => void): void;
8
- interface Schema {
7
+ export declare function findFormSchemas(schema: Schema): Schema[];
8
+ export declare function findFdmSchemas(schema?: Schema): Schema[];
9
+ export interface Schema {
9
10
  componentName: string;
10
11
  props: any;
11
12
  children?: Schema[];
12
13
  fdmSchema?: Schema;
13
14
  }
14
- export {};
@@ -12,21 +12,26 @@ export function forEachSchema(schema, callback) {
12
12
  }
13
13
  });
14
14
  }
15
- export function forEachFormSchema(schema, fdm, callback) {
15
+ export function findFormSchemas(schema) {
16
+ var schemas = [];
16
17
  forEachSchema(schema, function (child) {
17
18
  if (["PageForm", "SubFormField"].includes(child.componentName)) {
18
- callback(child);
19
- if (fdm) {
20
- if (child.fdmSchema) {
21
- forEachSchema(child.fdmSchema, function (fdmChild) {
22
- if (fdmChild.componentName == "PageFdm") {
23
- callback(child);
24
- }
25
- return true;
26
- });
27
- }
28
- }
19
+ schemas.push(child);
29
20
  }
30
21
  return true;
31
22
  });
23
+ return schemas;
24
+ }
25
+ export function findFdmSchemas(schema) {
26
+ var schemas = [];
27
+ if (!schema) {
28
+ return schemas;
29
+ }
30
+ forEachSchema(schema, function (child) {
31
+ if (["PageFdm"].includes(child.componentName)) {
32
+ schemas.push(child);
33
+ }
34
+ return true;
35
+ });
36
+ return schemas;
32
37
  }
@@ -5,17 +5,17 @@ export function loadDts() {
5
5
  return _loadDts.apply(this, arguments);
6
6
  }
7
7
  function _loadDts() {
8
- _loadDts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
9
- var api, res;
10
- return _regeneratorRuntime.wrap(function _callee$(_context) {
8
+ _loadDts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
9
+ var api, res, _t;
10
+ return _regeneratorRuntime.wrap(function (_context) {
11
11
  while (1) switch (_context.prev = _context.next) {
12
12
  case 0:
13
13
  _context.prev = 0;
14
- _context.next = 3;
14
+ _context.next = 1;
15
15
  return getFormApi("c40772eb-864b-42bb-ae31-9921d8ede97f");
16
- case 3:
16
+ case 1:
17
17
  api = _context.sent;
18
- _context.next = 6;
18
+ _context.next = 2;
19
19
  return api.search({
20
20
  pageSize: 1000,
21
21
  searchFields: [{
@@ -24,18 +24,18 @@ function _loadDts() {
24
24
  value: "dts"
25
25
  }]
26
26
  });
27
- case 6:
27
+ case 2:
28
28
  res = _context.sent;
29
29
  return _context.abrupt("return", res.data || []);
30
- case 10:
31
- _context.prev = 10;
32
- _context.t0 = _context["catch"](0);
30
+ case 3:
31
+ _context.prev = 3;
32
+ _t = _context["catch"](0);
33
33
  return _context.abrupt("return", []);
34
- case 13:
34
+ case 4:
35
35
  case "end":
36
36
  return _context.stop();
37
37
  }
38
- }, _callee, null, [[0, 10]]);
38
+ }, _callee, null, [[0, 3]]);
39
39
  }));
40
40
  return _loadDts.apply(this, arguments);
41
41
  }
@@ -6,9 +6,9 @@ export function getUserinfo() {
6
6
  return _getUserinfo.apply(this, arguments);
7
7
  }
8
8
  function _getUserinfo() {
9
- _getUserinfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
9
+ _getUserinfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
10
  var userinfo, cache, res;
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ return _regeneratorRuntime.wrap(function (_context) {
12
12
  while (1) switch (_context.prev = _context.next) {
13
13
  case 0:
14
14
  userinfo = null;
@@ -19,18 +19,18 @@ function _getUserinfo() {
19
19
  } catch (e) {}
20
20
  }
21
21
  if (userinfo) {
22
- _context.next = 8;
22
+ _context.next = 2;
23
23
  break;
24
24
  }
25
- _context.next = 6;
25
+ _context.next = 1;
26
26
  return apiRequest.get("auths/userinfo");
27
- case 6:
27
+ case 1:
28
28
  res = _context.sent;
29
29
  if (res.success) {
30
30
  sessionStorage.setItem(userinfoKey, JSON.stringify(res.data));
31
31
  userinfo = res.data;
32
32
  }
33
- case 8:
33
+ case 2:
34
34
  if (userinfo) {
35
35
  Object.defineProperty(window, "userinfo", {
36
36
  value: userinfo
@@ -40,7 +40,7 @@ function _getUserinfo() {
40
40
  });
41
41
  }
42
42
  return _context.abrupt("return", userinfo);
43
- case 10:
43
+ case 3:
44
44
  case "end":
45
45
  return _context.stop();
46
46
  }
@@ -3,7 +3,7 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
5
5
  import { apiRequest, RestFormApi } from "../api";
6
- import { forEachFormSchema } from "../api/schema.util";
6
+ import { findFdmSchemas, findFormSchemas } from "../api/schema.util";
7
7
  export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
8
8
  function SchemaCache() {
9
9
  return _SingletonInstanceMap.apply(this, arguments) || this;
@@ -11,44 +11,84 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
11
11
  _inheritsLoose(SchemaCache, _SingletonInstanceMap);
12
12
  var _proto = SchemaCache.prototype;
13
13
  _proto.createInstance = /*#__PURE__*/function () {
14
- var _createInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, options) {
15
- var mock, pageId, schemaRes, schema, permissionRes, permission;
16
- return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ var _createInstance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, options) {
15
+ var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
16
+ return _regeneratorRuntime.wrap(function (_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
19
19
  mock = options.mock, pageId = options.pageId;
20
- _context.next = 3;
20
+ _context.next = 1;
21
21
  return apiRequest.get("pages/" + pageId + "/schema", {
22
22
  params: {
23
23
  mock: mock
24
24
  }
25
25
  });
26
- case 3:
26
+ case 1:
27
27
  schemaRes = _context.sent;
28
+ if (schemaRes.succss) {
29
+ _context.next = 2;
30
+ break;
31
+ }
32
+ return _context.abrupt("return", schemaRes);
33
+ case 2:
28
34
  schema = schemaRes.data;
29
- if (!(typeof schema == "object")) {
30
- _context.next = 11;
35
+ if (!(schema != null && typeof schema == "object")) {
36
+ _context.next = 8;
31
37
  break;
32
38
  }
33
- _context.next = 8;
39
+ handleCommonSchema = function handleCommonSchema(schema) {
40
+ schema.props = schema.props || {};
41
+ schema.props.permission = permission;
42
+ schema.props.printTemplates = printTemplates;
43
+ schema.props.workflow = workflow;
44
+ };
45
+ //处理权限
46
+ permission = null; //处理打印
47
+ workflow = null;
48
+ if (location.pathname.startsWith("/print")) {
49
+ _context.next = 7;
50
+ break;
51
+ }
52
+ _context.next = 3;
34
53
  return apiRequest.get("pages/" + pageId + "/permission");
35
- case 8:
36
- permissionRes = _context.sent;
37
- permission = permissionRes.data;
38
- if (typeof permission == "object") {
39
- forEachFormSchema(schema, true, function (child) {
40
- child.props = child.props || {};
41
- child.props.permission = permission;
42
- });
54
+ case 3:
55
+ permission = _context.sent.data;
56
+ if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
57
+ _context.next = 7;
58
+ break;
43
59
  }
44
- case 11:
45
- console.log("schemaRes", schemaRes);
60
+ _context.prev = 4;
61
+ _context.next = 5;
62
+ return apiRequest.get("pages/" + pageId + "/printTemplates");
63
+ case 5:
64
+ printTemplates = _context.sent.data;
65
+ _context.next = 7;
66
+ break;
67
+ case 6:
68
+ _context.prev = 6;
69
+ _t = _context["catch"](4);
70
+ console.log(_t);
71
+ case 7:
72
+ findFormSchemas(schema).forEach(function (formSchema) {
73
+ handleCommonSchema(formSchema);
74
+ findFdmSchemas(formSchema.fdmSchema).forEach(function (fdmSchema) {
75
+ handleCommonSchema(fdmSchema);
76
+ fdmSchema.props.form.label = formSchema.props.label;
77
+ });
78
+ });
79
+ cloneSchema = JSON.parse(JSON.stringify(schema));
80
+ findFormSchemas(schema).forEach(function (formSchema) {
81
+ findFdmSchemas(formSchema.fdmSchema).forEach(function (fdmSchema) {
82
+ fdmSchema.props.formElement = cloneSchema;
83
+ });
84
+ });
85
+ case 8:
46
86
  return _context.abrupt("return", schemaRes);
47
- case 13:
87
+ case 9:
48
88
  case "end":
49
89
  return _context.stop();
50
90
  }
51
- }, _callee);
91
+ }, _callee, null, [[4, 6]]);
52
92
  }));
53
93
  function createInstance(_x, _x2) {
54
94
  return _createInstance.apply(this, arguments);
@@ -71,9 +111,9 @@ export var FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
71
111
  _inheritsLoose(FormApiCache, _SingletonInstanceMap2);
72
112
  var _proto2 = FormApiCache.prototype;
73
113
  _proto2.createInstance = /*#__PURE__*/function () {
74
- var _createInstance2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, options) {
114
+ var _createInstance2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, options) {
75
115
  var _options, formId, fieldId, mock, formApi;
76
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
116
+ return _regeneratorRuntime.wrap(function (_context2) {
77
117
  while (1) switch (_context2.prev = _context2.next) {
78
118
  case 0:
79
119
  if (options === void 0) {
@@ -81,11 +121,11 @@ export var FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
81
121
  }
82
122
  _options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
83
123
  formApi = new RestFormApi(formId, fieldId, mock);
84
- _context2.next = 5;
124
+ _context2.next = 1;
85
125
  return formApi.initialize();
86
- case 5:
126
+ case 1:
87
127
  return _context2.abrupt("return", formApi);
88
- case 6:
128
+ case 2:
89
129
  case "end":
90
130
  return _context2.stop();
91
131
  }
@@ -1,44 +1,44 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
3
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
6
  var doc = document;
7
7
  export function loadPlugins(_x) {
8
8
  return _loadPlugins.apply(this, arguments);
9
9
  }
10
10
  function _loadPlugins() {
11
- _loadPlugins = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(plugins) {
11
+ _loadPlugins = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(plugins) {
12
12
  var _iterator, _step, plugin, _iterator2, _step2, _plugin;
13
- return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ return _regeneratorRuntime.wrap(function (_context) {
14
14
  while (1) switch (_context.prev = _context.next) {
15
15
  case 0:
16
16
  _iterator = _createForOfIteratorHelperLoose(plugins);
17
17
  case 1:
18
18
  if ((_step = _iterator()).done) {
19
- _context.next = 7;
19
+ _context.next = 3;
20
20
  break;
21
21
  }
22
22
  plugin = _step.value;
23
- _context.next = 5;
23
+ _context.next = 2;
24
24
  return loadStyle(plugin);
25
- case 5:
25
+ case 2:
26
26
  _context.next = 1;
27
27
  break;
28
- case 7:
28
+ case 3:
29
29
  _iterator2 = _createForOfIteratorHelperLoose(plugins);
30
- case 8:
30
+ case 4:
31
31
  if ((_step2 = _iterator2()).done) {
32
- _context.next = 14;
32
+ _context.next = 6;
33
33
  break;
34
34
  }
35
35
  _plugin = _step2.value;
36
- _context.next = 12;
36
+ _context.next = 5;
37
37
  return loadScript(_plugin);
38
- case 12:
39
- _context.next = 8;
38
+ case 5:
39
+ _context.next = 4;
40
40
  break;
41
- case 14:
41
+ case 6:
42
42
  case "end":
43
43
  return _context.stop();
44
44
  }
@@ -50,20 +50,20 @@ function loadStyle(_x2) {
50
50
  return _loadStyle.apply(this, arguments);
51
51
  }
52
52
  function _loadStyle() {
53
- _loadStyle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(src) {
54
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
53
+ _loadStyle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(src) {
54
+ return _regeneratorRuntime.wrap(function (_context3) {
55
55
  while (1) switch (_context3.prev = _context3.next) {
56
56
  case 0:
57
57
  if (src.endsWith("css")) {
58
- _context3.next = 2;
58
+ _context3.next = 1;
59
59
  break;
60
60
  }
61
61
  return _context3.abrupt("return", true);
62
- case 2:
63
- return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
64
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
62
+ case 1:
63
+ return _context3.abrupt("return", new Promise(/*#__PURE__*/function () {
64
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
65
65
  var callback, target;
66
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
66
+ return _regeneratorRuntime.wrap(function (_context2) {
67
67
  while (1) switch (_context2.prev = _context2.next) {
68
68
  case 0:
69
69
  callback = function _callback(status) {
@@ -87,7 +87,7 @@ function _loadStyle() {
87
87
  } else {
88
88
  callback(true);
89
89
  }
90
- case 3:
90
+ case 1:
91
91
  case "end":
92
92
  return _context2.stop();
93
93
  }
@@ -97,7 +97,7 @@ function _loadStyle() {
97
97
  return _ref.apply(this, arguments);
98
98
  };
99
99
  }()));
100
- case 3:
100
+ case 2:
101
101
  case "end":
102
102
  return _context3.stop();
103
103
  }
@@ -109,20 +109,20 @@ function loadScript(_x3) {
109
109
  return _loadScript.apply(this, arguments);
110
110
  }
111
111
  function _loadScript() {
112
- _loadScript = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(src) {
113
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
112
+ _loadScript = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(src) {
113
+ return _regeneratorRuntime.wrap(function (_context5) {
114
114
  while (1) switch (_context5.prev = _context5.next) {
115
115
  case 0:
116
116
  if (src.endsWith("js")) {
117
- _context5.next = 2;
117
+ _context5.next = 1;
118
118
  break;
119
119
  }
120
120
  return _context5.abrupt("return", true);
121
- case 2:
122
- return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
123
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resolve, reject) {
121
+ case 1:
122
+ return _context5.abrupt("return", new Promise(/*#__PURE__*/function () {
123
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resolve, reject) {
124
124
  var callback, target;
125
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
125
+ return _regeneratorRuntime.wrap(function (_context4) {
126
126
  while (1) switch (_context4.prev = _context4.next) {
127
127
  case 0:
128
128
  callback = function _callback2(status) {
@@ -148,7 +148,7 @@ function _loadScript() {
148
148
  } else {
149
149
  callback(true);
150
150
  }
151
- case 3:
151
+ case 1:
152
152
  case "end":
153
153
  return _context4.stop();
154
154
  }
@@ -158,7 +158,7 @@ function _loadScript() {
158
158
  return _ref2.apply(this, arguments);
159
159
  };
160
160
  }()));
161
- case 3:
161
+ case 2:
162
162
  case "end":
163
163
  return _context5.stop();
164
164
  }
@@ -7,25 +7,25 @@ export var SingletonInstanceMap = /*#__PURE__*/function () {
7
7
  }
8
8
  var _proto = SingletonInstanceMap.prototype;
9
9
  _proto.getInstance = /*#__PURE__*/function () {
10
- var _getInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, options) {
11
- var self, value;
12
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
10
+ var _getInstance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, options) {
11
+ var self, value, _t;
12
+ return _regeneratorRuntime.wrap(function (_context2) {
13
13
  while (1) switch (_context2.prev = _context2.next) {
14
14
  case 0:
15
15
  self = this;
16
16
  if (!this.valueMap.has(key)) {
17
- _context2.next = 5;
17
+ _context2.next = 1;
18
18
  break;
19
19
  }
20
20
  return _context2.abrupt("return", Promise.resolve(this.valueMap.get(key)));
21
- case 5:
21
+ case 1:
22
22
  if (!this.lockMap.get(key)) {
23
- _context2.next = 9;
23
+ _context2.next = 2;
24
24
  break;
25
25
  }
26
26
  return _context2.abrupt("return", new Promise(function (resolve, reject) {
27
- setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
28
- return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
28
+ return _regeneratorRuntime.wrap(function (_context) {
29
29
  while (1) switch (_context.prev = _context.next) {
30
30
  case 0:
31
31
  resolve(self.getInstance(key, options));
@@ -36,29 +36,29 @@ export var SingletonInstanceMap = /*#__PURE__*/function () {
36
36
  }, _callee);
37
37
  })), 500);
38
38
  }));
39
- case 9:
40
- _context2.prev = 9;
39
+ case 2:
40
+ _context2.prev = 2;
41
41
  this.lockMap.set(key, true);
42
- _context2.next = 13;
42
+ _context2.next = 3;
43
43
  return this.createInstance(key, options);
44
- case 13:
44
+ case 3:
45
45
  value = _context2.sent;
46
46
  this.valueMap.set(key, value);
47
47
  this.lockMap.set(key, false);
48
48
  return _context2.abrupt("return", Promise.resolve(value));
49
- case 19:
50
- _context2.prev = 19;
51
- _context2.t0 = _context2["catch"](9);
52
- throw _context2.t0;
53
- case 22:
54
- _context2.prev = 22;
49
+ case 4:
50
+ _context2.prev = 4;
51
+ _t = _context2["catch"](2);
52
+ throw _t;
53
+ case 5:
54
+ _context2.prev = 5;
55
55
  this.lockMap.set(key, false);
56
- return _context2.finish(22);
57
- case 25:
56
+ return _context2.finish(5);
57
+ case 6:
58
58
  case "end":
59
59
  return _context2.stop();
60
60
  }
61
- }, _callee2, this, [[9, 19, 22, 25]]);
61
+ }, _callee2, this, [[2, 4, 5, 6]]);
62
62
  }));
63
63
  function getInstance(_x, _x2) {
64
64
  return _getInstance.apply(this, arguments);
@@ -1,3 +1,6 @@
1
1
  export { loadPlugins } from "./LoadPlugins";
2
2
  export declare function uuid(prefix?: string, separator?: string): string;
3
+ export declare function uuidVersion(id: string): number;
3
4
  export declare function toArray(data: any): any[];
5
+ export declare function isLocalhost(): boolean;
6
+ export declare function isMobile(): boolean;
@@ -1,13 +1,16 @@
1
- import { v4 } from "uuid";
1
+ import { v7, version } from "uuid";
2
2
  export { loadPlugins } from "./LoadPlugins";
3
3
  export function uuid(prefix, separator) {
4
4
  if (!prefix && !separator) {
5
- return v4();
5
+ return v7();
6
6
  }
7
- return [prefix, separator, v4()].filter(function (v) {
7
+ return [prefix, separator, v7()].filter(function (v) {
8
8
  return !!v;
9
9
  }).join("");
10
10
  }
11
+ export function uuidVersion(id) {
12
+ return version(id);
13
+ }
11
14
  export function toArray(data) {
12
15
  if (!data) {
13
16
  return [];
@@ -16,4 +19,11 @@ export function toArray(data) {
16
19
  } else {
17
20
  return [data];
18
21
  }
22
+ }
23
+ export function isLocalhost() {
24
+ return window.location.hostname == "localhost";
25
+ }
26
+ export function isMobile() {
27
+ var userAgent = navigator.userAgent;
28
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(userAgent);
19
29
  }
@@ -26,9 +26,9 @@ export function assetsParse(_x) {
26
26
  return _assetsParse.apply(this, arguments);
27
27
  }
28
28
  function _assetsParse() {
29
- _assetsParse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(assets) {
29
+ _assetsParse = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(assets) {
30
30
  var rawComponents, packages, libraryAsset, libraryMap, packagesMap, assetLoader, newComponents, componentDescriptions, remoteComponentDescriptions, lowcodeComponentsArray, proCodeComponentsMap, genLowCodeComponentsMap, components, lowCodeComponents;
31
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31
+ return _regeneratorRuntime.wrap(function (_context2) {
32
32
  while (1) switch (_context2.prev = _context2.next) {
33
33
  case 0:
34
34
  genLowCodeComponentsMap = function _genLowCodeComponents(components) {
@@ -62,12 +62,12 @@ function _assetsParse() {
62
62
  }
63
63
  });
64
64
  assetLoader = new AssetLoader();
65
- _context2.next = 9;
65
+ _context2.next = 1;
66
66
  return assetLoader.load(libraryAsset);
67
- case 9:
67
+ case 1:
68
68
  newComponents = rawComponents;
69
69
  if (!(rawComponents && rawComponents.length)) {
70
- _context2.next = 18;
70
+ _context2.next = 2;
71
71
  break;
72
72
  }
73
73
  componentDescriptions = [];
@@ -85,14 +85,14 @@ function _assetsParse() {
85
85
  newComponents = [].concat(componentDescriptions);
86
86
  // 如果有远程组件描述协议,则自动加载并补充到资产包中,同时出发 designer.incrementalAssetsReady 通知组件面板更新数据
87
87
  if (!(remoteComponentDescriptions && remoteComponentDescriptions.length)) {
88
- _context2.next = 18;
88
+ _context2.next = 2;
89
89
  break;
90
90
  }
91
- _context2.next = 18;
92
- return Promise.all(remoteComponentDescriptions.map( /*#__PURE__*/function () {
93
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(component) {
91
+ _context2.next = 2;
92
+ return Promise.all(remoteComponentDescriptions.map(/*#__PURE__*/function () {
93
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(component) {
94
94
  var exportName, url, npm, setAssetsComponent, setArrayAssets;
95
- return _regeneratorRuntime.wrap(function _callee$(_context) {
95
+ return _regeneratorRuntime.wrap(function (_context) {
96
96
  while (1) switch (_context.prev = _context.next) {
97
97
  case 0:
98
98
  setArrayAssets = function _setArrayAssets(value, preExportName, preSubName) {
@@ -134,9 +134,9 @@ function _assetsParse() {
134
134
  // assets.componentList = assets.componentList.concat(component.componentList || []);
135
135
  };
136
136
  exportName = component.exportName, url = component.url, npm = component.npm;
137
- _context.next = 5;
137
+ _context.next = 1;
138
138
  return new AssetLoader().load(url);
139
- case 5:
139
+ case 1:
140
140
  if (window[exportName]) {
141
141
  if (Array.isArray(window[exportName])) {
142
142
  setArrayAssets(window[exportName]);
@@ -145,7 +145,7 @@ function _assetsParse() {
145
145
  }
146
146
  }
147
147
  return _context.abrupt("return", window[exportName]);
148
- case 7:
148
+ case 2:
149
149
  case "end":
150
150
  return _context.stop();
151
151
  }
@@ -155,7 +155,7 @@ function _assetsParse() {
155
155
  return _ref.apply(this, arguments);
156
156
  };
157
157
  }()));
158
- case 18:
158
+ case 2:
159
159
  lowcodeComponentsArray = [];
160
160
  proCodeComponentsMap = newComponents.reduce(function (acc, cur) {
161
161
  if ((cur.devMode || '').toLowerCase() === 'lowcode') {
@@ -174,7 +174,7 @@ function _assetsParse() {
174
174
  return _context2.abrupt("return", {
175
175
  components: _extends({}, components, lowCodeComponents)
176
176
  });
177
- case 23:
177
+ case 3:
178
178
  case "end":
179
179
  return _context2.stop();
180
180
  }
@@ -22,7 +22,13 @@
22
22
  * 资源加载环境种类
23
23
  */
24
24
  export var LoadEnv = /*#__PURE__*/function (LoadEnv) {
25
+ /**
26
+ * 设计态
27
+ */
25
28
  LoadEnv["design"] = "design";
29
+ /**
30
+ * 运行态
31
+ */
26
32
  LoadEnv["runtime"] = "runtime";
27
33
  return LoadEnv;
28
34
  }({});