@zhubangyun/lowcode-core 1.1.0

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 (107) hide show
  1. package/es/components/layout/index.d.ts +34 -0
  2. package/es/components/layout/index.js +63 -0
  3. package/es/components/layout/index.less +20 -0
  4. package/es/components/schema-render/components/assets.d.ts +32 -0
  5. package/es/components/schema-render/components/assets.js +53 -0
  6. package/es/components/schema-render/components/demo-schema.d.ts +85 -0
  7. package/es/components/schema-render/components/demo-schema.js +107 -0
  8. package/es/components/schema-render/components/schema-render-base.d.ts +43 -0
  9. package/es/components/schema-render/components/schema-render-base.js +142 -0
  10. package/es/components/schema-render/components/schema-render-layout.d.ts +6 -0
  11. package/es/components/schema-render/components/schema-render-layout.js +46 -0
  12. package/es/components/schema-render/index.d.ts +31 -0
  13. package/es/components/schema-render/index.js +46 -0
  14. package/es/components/typing.d.ts +3 -0
  15. package/es/components/typing.js +12 -0
  16. package/es/index.d.ts +7 -0
  17. package/es/index.js +7 -0
  18. package/es/pages/data/assets.d.ts +32 -0
  19. package/es/pages/data/assets.js +53 -0
  20. package/es/pages/data/schema.d.ts +50 -0
  21. package/es/pages/data/schema.js +49 -0
  22. package/es/pages/index.d.ts +1 -0
  23. package/es/pages/index.js +31 -0
  24. package/es/pages/index.less +0 -0
  25. package/es/style.js +6 -0
  26. package/es/utils/api/index.d.ts +1 -0
  27. package/es/utils/api/index.js +12 -0
  28. package/es/utils/common/ClientCache.d.ts +36 -0
  29. package/es/utils/common/ClientCache.js +120 -0
  30. package/es/utils/common/FormDataHandler.d.ts +45 -0
  31. package/es/utils/common/FormDataHandler.js +410 -0
  32. package/es/utils/common/LoadPlugins.d.ts +1 -0
  33. package/es/utils/common/LoadPlugins.js +158 -0
  34. package/es/utils/common/ProcessHandler.d.ts +30 -0
  35. package/es/utils/common/ProcessHandler.js +303 -0
  36. package/es/utils/common/Request.d.ts +2 -0
  37. package/es/utils/common/Request.js +20 -0
  38. package/es/utils/common/RestApi.d.ts +80 -0
  39. package/es/utils/common/RestApi.js +226 -0
  40. package/es/utils/common/RestFormApi.d.ts +12 -0
  41. package/es/utils/common/RestFormApi.js +158 -0
  42. package/es/utils/common/SubFormInstance.d.ts +26 -0
  43. package/es/utils/common/SubFormInstance.js +100 -0
  44. package/es/utils/common/UserInfo.d.ts +9 -0
  45. package/es/utils/common/UserInfo.js +19 -0
  46. package/es/utils/common/index.d.ts +7 -0
  47. package/es/utils/common/index.js +39 -0
  48. package/es/utils/index.d.ts +17 -0
  49. package/es/utils/index.js +11 -0
  50. package/es/utils/lowcode/index.d.ts +1 -0
  51. package/es/utils/lowcode/index.js +1 -0
  52. package/es/utils/lowcode/parseAssets.d.ts +3 -0
  53. package/es/utils/lowcode/parseAssets.js +185 -0
  54. package/lib/components/layout/index.d.ts +34 -0
  55. package/lib/components/layout/index.js +69 -0
  56. package/lib/components/layout/index.less +20 -0
  57. package/lib/components/schema-render/components/assets.d.ts +32 -0
  58. package/lib/components/schema-render/components/assets.js +57 -0
  59. package/lib/components/schema-render/components/demo-schema.d.ts +85 -0
  60. package/lib/components/schema-render/components/demo-schema.js +111 -0
  61. package/lib/components/schema-render/components/schema-render-base.d.ts +43 -0
  62. package/lib/components/schema-render/components/schema-render-base.js +149 -0
  63. package/lib/components/schema-render/components/schema-render-layout.d.ts +6 -0
  64. package/lib/components/schema-render/components/schema-render-layout.js +51 -0
  65. package/lib/components/schema-render/index.d.ts +31 -0
  66. package/lib/components/schema-render/index.js +53 -0
  67. package/lib/components/typing.d.ts +3 -0
  68. package/lib/components/typing.js +17 -0
  69. package/lib/index.d.ts +7 -0
  70. package/lib/index.js +15 -0
  71. package/lib/pages/data/assets.d.ts +32 -0
  72. package/lib/pages/data/assets.js +57 -0
  73. package/lib/pages/data/schema.d.ts +50 -0
  74. package/lib/pages/data/schema.js +53 -0
  75. package/lib/pages/index.d.ts +1 -0
  76. package/lib/pages/index.js +34 -0
  77. package/lib/pages/index.less +0 -0
  78. package/lib/style.js +6 -0
  79. package/lib/utils/api/index.d.ts +1 -0
  80. package/lib/utils/api/index.js +17 -0
  81. package/lib/utils/common/ClientCache.d.ts +36 -0
  82. package/lib/utils/common/ClientCache.js +125 -0
  83. package/lib/utils/common/FormDataHandler.d.ts +45 -0
  84. package/lib/utils/common/FormDataHandler.js +416 -0
  85. package/lib/utils/common/LoadPlugins.d.ts +1 -0
  86. package/lib/utils/common/LoadPlugins.js +163 -0
  87. package/lib/utils/common/ProcessHandler.d.ts +30 -0
  88. package/lib/utils/common/ProcessHandler.js +308 -0
  89. package/lib/utils/common/Request.d.ts +2 -0
  90. package/lib/utils/common/Request.js +25 -0
  91. package/lib/utils/common/RestApi.d.ts +80 -0
  92. package/lib/utils/common/RestApi.js +230 -0
  93. package/lib/utils/common/RestFormApi.d.ts +12 -0
  94. package/lib/utils/common/RestFormApi.js +163 -0
  95. package/lib/utils/common/SubFormInstance.d.ts +26 -0
  96. package/lib/utils/common/SubFormInstance.js +105 -0
  97. package/lib/utils/common/UserInfo.d.ts +9 -0
  98. package/lib/utils/common/UserInfo.js +24 -0
  99. package/lib/utils/common/index.d.ts +7 -0
  100. package/lib/utils/common/index.js +48 -0
  101. package/lib/utils/index.d.ts +17 -0
  102. package/lib/utils/index.js +34 -0
  103. package/lib/utils/lowcode/index.d.ts +1 -0
  104. package/lib/utils/lowcode/index.js +6 -0
  105. package/lib/utils/lowcode/parseAssets.d.ts +3 -0
  106. package/lib/utils/lowcode/parseAssets.js +192 -0
  107. package/package.json +65 -0
@@ -0,0 +1,158 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { RestApi } from "./RestApi";
5
+ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
6
+ function RestFormApi(formName, options) {
7
+ var _this;
8
+ _this = _RestApi.call(this, "forms/" + formName, options) || this;
9
+ _this.initialized = false;
10
+ _this.schema = void 0;
11
+ return _this;
12
+ }
13
+ _inheritsLoose(RestFormApi, _RestApi);
14
+ var _proto = RestFormApi.prototype;
15
+ _proto.initialize = /*#__PURE__*/function () {
16
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ if (this.initialized) {
21
+ _context.next = 8;
22
+ break;
23
+ }
24
+ _context.prev = 1;
25
+ //this.schema = await schemaCache.get(super.uri)
26
+ /* this.schema = await PageUtils.schemaCache.lazyGet(this.title);
27
+ this.handler = new FormDataHandler(this.schema);*/
28
+ this.initialized = true;
29
+ _context.next = 8;
30
+ break;
31
+ case 5:
32
+ _context.prev = 5;
33
+ _context.t0 = _context["catch"](1);
34
+ throw _context.t0;
35
+ case 8:
36
+ return _context.abrupt("return", this.initialized);
37
+ case 9:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee, this, [[1, 5]]);
42
+ }));
43
+ function initialize() {
44
+ return _initialize.apply(this, arguments);
45
+ }
46
+ return initialize;
47
+ }();
48
+ _proto.search = /*#__PURE__*/function () {
49
+ var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params, page, pageSize) {
50
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
51
+ while (1) switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ if (params === void 0) {
54
+ params = {};
55
+ }
56
+ if (page === void 0) {
57
+ page = 1;
58
+ }
59
+ if (pageSize === void 0) {
60
+ pageSize = 20;
61
+ }
62
+ _context2.next = 5;
63
+ return this.initialize();
64
+ case 5:
65
+ return _context2.abrupt("return", _RestApi.prototype.search.call(this, params, page, pageSize));
66
+ case 6:
67
+ case "end":
68
+ return _context2.stop();
69
+ }
70
+ }, _callee2, this);
71
+ }));
72
+ function search(_x, _x2, _x3) {
73
+ return _search.apply(this, arguments);
74
+ }
75
+ return search;
76
+ }();
77
+ _proto.getById = /*#__PURE__*/function () {
78
+ var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, options) {
79
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
80
+ while (1) switch (_context3.prev = _context3.next) {
81
+ case 0:
82
+ _context3.next = 2;
83
+ return this.initialize();
84
+ case 2:
85
+ return _context3.abrupt("return", _RestApi.prototype.getById.call(this, id, options));
86
+ case 3:
87
+ case "end":
88
+ return _context3.stop();
89
+ }
90
+ }, _callee3, this);
91
+ }));
92
+ function getById(_x4, _x5) {
93
+ return _getById.apply(this, arguments);
94
+ }
95
+ return getById;
96
+ }();
97
+ _proto.create = /*#__PURE__*/function () {
98
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
99
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
100
+ while (1) switch (_context4.prev = _context4.next) {
101
+ case 0:
102
+ _context4.next = 2;
103
+ return this.initialize();
104
+ case 2:
105
+ return _context4.abrupt("return", _RestApi.prototype.create.call(this, data, options));
106
+ case 3:
107
+ case "end":
108
+ return _context4.stop();
109
+ }
110
+ }, _callee4, this);
111
+ }));
112
+ function create(_x6, _x7) {
113
+ return _create.apply(this, arguments);
114
+ }
115
+ return create;
116
+ }();
117
+ _proto.update = /*#__PURE__*/function () {
118
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data, options) {
119
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
120
+ while (1) switch (_context5.prev = _context5.next) {
121
+ case 0:
122
+ _context5.next = 2;
123
+ return this.initialize();
124
+ case 2:
125
+ return _context5.abrupt("return", _RestApi.prototype.update.call(this, id, data, options));
126
+ case 3:
127
+ case "end":
128
+ return _context5.stop();
129
+ }
130
+ }, _callee5, this);
131
+ }));
132
+ function update(_x8, _x9, _x10) {
133
+ return _update.apply(this, arguments);
134
+ }
135
+ return update;
136
+ }();
137
+ _proto.deleteById = /*#__PURE__*/function () {
138
+ var _deleteById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, options) {
139
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
140
+ while (1) switch (_context6.prev = _context6.next) {
141
+ case 0:
142
+ _context6.next = 2;
143
+ return this.initialize();
144
+ case 2:
145
+ return _context6.abrupt("return", _RestApi.prototype.deleteById.call(this, id, options));
146
+ case 3:
147
+ case "end":
148
+ return _context6.stop();
149
+ }
150
+ }, _callee6, this);
151
+ }));
152
+ function deleteById(_x11, _x12) {
153
+ return _deleteById.apply(this, arguments);
154
+ }
155
+ return deleteById;
156
+ }();
157
+ return RestFormApi;
158
+ }(RestApi);
@@ -0,0 +1,26 @@
1
+ import { FormInstance } from "antd/lib";
2
+ import { NamePath, StoreValue } from "antd/es/form/interface";
3
+ declare type NamePaths = (string | number)[];
4
+ export declare class SubFormInstance implements FormInstance {
5
+ parentForm: FormInstance;
6
+ namePath: NamePaths;
7
+ constructor(form: FormInstance, namePath: NamePaths);
8
+ overwritePathName(name: NamePath): any[];
9
+ overwriteFields(fields: any[]): any[];
10
+ getFieldError(name: NamePath): string[];
11
+ getFieldValue(name: NamePath): StoreValue;
12
+ getFieldWarning(name: NamePath): string[];
13
+ getFieldsError(nameList: NamePath[] | undefined): any[];
14
+ getFieldsValue(nameList?: NamePath[] | true, filterFunc?: (meta: any) => boolean): any;
15
+ isFieldTouched(name: NamePath): boolean;
16
+ isFieldValidating(name: NamePath): boolean;
17
+ isFieldsTouched(): boolean;
18
+ isFieldsValidating(nameList: NamePath[]): boolean;
19
+ resetFields(fields: NamePath[] | undefined): void;
20
+ setFieldValue(name: NamePath, value: any): void;
21
+ setFields(fields: any[]): void;
22
+ setFieldsValue(values: any): void;
23
+ submit(): void;
24
+ validateFields(nameList: NamePath[] | undefined): Promise<any>;
25
+ }
26
+ export {};
@@ -0,0 +1,100 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ export var SubFormInstance = /*#__PURE__*/function () {
3
+ function SubFormInstance(form, namePath) {
4
+ this.parentForm = void 0;
5
+ this.namePath = void 0;
6
+ this.parentForm = form;
7
+ this.namePath = namePath;
8
+ }
9
+ var _proto = SubFormInstance.prototype;
10
+ _proto.overwritePathName = function overwritePathName(name) {
11
+ if (Array.isArray(name)) {
12
+ return [].concat(this.namePath, name);
13
+ } else {
14
+ return [].concat(this.namePath, [name]);
15
+ }
16
+ };
17
+ _proto.overwriteFields = function overwriteFields(fields) {
18
+ var _this = this;
19
+ return fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
20
+ return _extends({}, field, {
21
+ name: _this.overwritePathName(field.name)
22
+ });
23
+ });
24
+ };
25
+ _proto.getFieldError = function getFieldError(name) {
26
+ return this.parentForm.getFieldError(this.overwritePathName(name));
27
+ };
28
+ _proto.getFieldValue = function getFieldValue(name) {
29
+ return this.parentForm.getFieldValue(this.overwritePathName(name));
30
+ };
31
+ _proto.getFieldWarning = function getFieldWarning(name) {
32
+ return this.parentForm.getFieldWarning(this.overwritePathName(name));
33
+ }
34
+
35
+ // @ts-ignore
36
+ ;
37
+ _proto.getFieldsError = function getFieldsError(nameList) {
38
+ var _this2 = this;
39
+ return this.parentForm.getFieldsError(nameList === null || nameList === void 0 ? void 0 : nameList.map(function (name) {
40
+ return _this2.overwritePathName(name);
41
+ }));
42
+ }
43
+
44
+ // @ts-ignore
45
+ ;
46
+ _proto.getFieldsValue = function getFieldsValue(nameList, filterFunc) {
47
+ var values = _extends({}, this.parentForm.getFieldValue(this.namePath));
48
+ values.parent = this.parentForm.getFieldsValue(true);
49
+ return values;
50
+ };
51
+ _proto.isFieldTouched = function isFieldTouched(name) {
52
+ return this.parentForm.isFieldTouched(this.overwritePathName(name));
53
+ };
54
+ _proto.isFieldValidating = function isFieldValidating(name) {
55
+ return this.parentForm.isFieldValidating(this.overwritePathName(name));
56
+ };
57
+ _proto.isFieldsTouched = function isFieldsTouched() {
58
+ return this.parentForm.isFieldsTouched();
59
+ };
60
+ // @ts-ignore
61
+ _proto.isFieldsValidating = function isFieldsValidating(nameList) {
62
+ var _this3 = this;
63
+ return this.parentForm.isFieldsValidating(nameList.map(function (name) {
64
+ return _this3.overwritePathName(name);
65
+ }));
66
+ };
67
+ _proto.resetFields = function resetFields(fields) {
68
+ if (Array.isArray(fields)) {
69
+ // @ts-ignore
70
+ this.parentForm.resetFields(this.overwriteFields(fields));
71
+ } else {
72
+ this.parentForm.resetFields();
73
+ }
74
+ };
75
+ _proto.setFieldValue = function setFieldValue(name, value) {
76
+ return this.parentForm.setFieldValue(this.overwritePathName(name), value);
77
+ };
78
+ _proto.setFields = function setFields(fields) {
79
+ this.parentForm.setFields(this.overwriteFields(fields));
80
+ };
81
+ _proto.setFieldsValue = function setFieldsValue(values) {
82
+ var _this4 = this;
83
+ if (!values) return;
84
+ //删除父值
85
+ delete values.parent;
86
+ Object.keys(values).forEach(function (name) {
87
+ return _this4.parentForm.setFieldValue(_this4.overwritePathName(name), values[name]);
88
+ });
89
+ };
90
+ _proto.submit = function submit() {
91
+ this.parentForm.submit();
92
+ }
93
+
94
+ // @ts-ignore
95
+ ;
96
+ _proto.validateFields = function validateFields(nameList) {
97
+ return this.parentForm.validateFields(nameList);
98
+ };
99
+ return SubFormInstance;
100
+ }();
@@ -0,0 +1,9 @@
1
+ export interface UserInfo {
2
+ userId: string;
3
+ userName: string;
4
+ staffId: string;
5
+ staffName: string;
6
+ roleIds: string[];
7
+ deptIds: string[];
8
+ }
9
+ export declare function loadUserInfo(): Promise<UserInfo>;
@@ -0,0 +1,19 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ export function loadUserInfo() {
4
+ return _loadUserInfo.apply(this, arguments);
5
+ }
6
+ function _loadUserInfo() {
7
+ _loadUserInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
8
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
9
+ while (1) switch (_context.prev = _context.next) {
10
+ case 0:
11
+ return _context.abrupt("return", {});
12
+ case 1:
13
+ case "end":
14
+ return _context.stop();
15
+ }
16
+ }, _callee);
17
+ }));
18
+ return _loadUserInfo.apply(this, arguments);
19
+ }
@@ -0,0 +1,7 @@
1
+ import { ClientCache } from "./ClientCache";
2
+ export { RestApi } from "./RestApi";
3
+ export { RestFormApi } from "./RestFormApi";
4
+ export { ClientCache } from "./ClientCache";
5
+ export { loadPlugins } from "./LoadPlugins";
6
+ export declare function uuid(prefix?: string, separator?: string): string;
7
+ export declare const schemaCache: ClientCache;
@@ -0,0 +1,39 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { v4 } from "uuid";
4
+ import { ClientCache } from "./ClientCache";
5
+ import { request } from "../api";
6
+ export { RestApi } from "./RestApi";
7
+ export { RestFormApi } from "./RestFormApi";
8
+ export { ClientCache } from "./ClientCache";
9
+ export { loadPlugins } from "./LoadPlugins";
10
+ export function uuid(prefix, separator) {
11
+ return [prefix, separator, v4()].filter(function (v) {
12
+ return !!v;
13
+ }).join("");
14
+ }
15
+ export var schemaCache = new ClientCache({
16
+ name: "schema",
17
+ loadData: function () {
18
+ var _loadData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
19
+ var res;
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _context.next = 2;
24
+ return request.get("schemas/" + name + ".json");
25
+ case 2:
26
+ res = _context.sent;
27
+ return _context.abrupt("return", res.data);
28
+ case 4:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }, _callee);
33
+ }));
34
+ function loadData(_x) {
35
+ return _loadData.apply(this, arguments);
36
+ }
37
+ return loadData;
38
+ }()
39
+ });
@@ -0,0 +1,17 @@
1
+ export * from "./api";
2
+ export * from "./common";
3
+ export * from "./lowcode";
4
+ import * as common from "./common";
5
+ import * as api from "./api";
6
+ import * as lowcode from "./lowcode";
7
+ declare const _default: {
8
+ uuid(prefix?: string, separator?: string): string;
9
+ RestApi: typeof common.RestApi;
10
+ RestFormApi: typeof common.RestFormApi;
11
+ ClientCache: typeof common.ClientCache;
12
+ loadPlugins: typeof common.loadPlugins;
13
+ schemaCache: common.ClientCache;
14
+ api: typeof api;
15
+ lowcode: typeof lowcode;
16
+ };
17
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ export * from "./api";
3
+ export * from "./common";
4
+ export * from "./lowcode";
5
+ import * as common from "./common";
6
+ import * as api from "./api";
7
+ import * as lowcode from "./lowcode";
8
+ export default _extends({
9
+ api: api,
10
+ lowcode: lowcode
11
+ }, common);
@@ -0,0 +1 @@
1
+ export { parseAssets } from "./parseAssets";
@@ -0,0 +1 @@
1
+ export { parseAssets } from "./parseAssets";
@@ -0,0 +1,3 @@
1
+ export declare function parseAssets(assets: any): Promise<{
2
+ components: any;
3
+ }>;
@@ -0,0 +1,185 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ import { AssetLoader, buildComponents } from '@zhubangyun/lowcode-utils';
6
+ import ReactRenderer from '@zhubangyun/lowcode-renderer-core';
7
+ import React, { createElement } from 'react';
8
+ function genLowcodeComp(schema, components) {
9
+ return /*#__PURE__*/function (_React$Component) {
10
+ function LowcodeComp() {
11
+ return _React$Component.apply(this, arguments) || this;
12
+ }
13
+ _inheritsLoose(LowcodeComp, _React$Component);
14
+ var _proto = LowcodeComp.prototype;
15
+ _proto.render = function render() {
16
+ return /*#__PURE__*/createElement(ReactRenderer, _extends({}, this.props, {
17
+ schema: schema,
18
+ components: components,
19
+ designMode: ''
20
+ }));
21
+ };
22
+ return LowcodeComp;
23
+ }(React.Component);
24
+ }
25
+ export function parseAssets(_x) {
26
+ return _parseAssets.apply(this, arguments);
27
+ }
28
+ function _parseAssets() {
29
+ _parseAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(assets) {
30
+ var rawComponents, packages, libraryAsset, libraryMap, packagesMap, assetLoader, newComponents, componentDescriptions, remoteComponentDescriptions, lowcodeComponentsArray, proCodeComponentsMap, genLowCodeComponentsMap, components, lowCodeComponents;
31
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
32
+ while (1) switch (_context2.prev = _context2.next) {
33
+ case 0:
34
+ genLowCodeComponentsMap = function _genLowCodeComponents(components) {
35
+ var lowcodeComponentsMap = {};
36
+ lowcodeComponentsArray.forEach(function (lowcode) {
37
+ var _lowcode$reference, _packagesMap$id;
38
+ var id = (_lowcode$reference = lowcode.reference) === null || _lowcode$reference === void 0 ? void 0 : _lowcode$reference.id;
39
+ var schema = (_packagesMap$id = packagesMap[id]) === null || _packagesMap$id === void 0 ? void 0 : _packagesMap$id.schema;
40
+ lowcodeComponentsMap[lowcode.componentName] = genLowcodeComp(schema, _extends({}, components, lowcodeComponentsMap));
41
+ });
42
+ return lowcodeComponentsMap;
43
+ };
44
+ rawComponents = assets.components, packages = assets.packages;
45
+ libraryAsset = [];
46
+ libraryMap = {};
47
+ packagesMap = {};
48
+ packages.forEach(function (pkg) {
49
+ var _package = pkg["package"],
50
+ library = pkg.library,
51
+ urls = pkg.urls,
52
+ renderUrls = pkg.renderUrls,
53
+ id = pkg.id;
54
+ if (_package) {
55
+ libraryMap[id || _package] = library;
56
+ }
57
+ packagesMap[id || _package] = pkg;
58
+ if (renderUrls) {
59
+ libraryAsset.push(renderUrls);
60
+ } else if (urls) {
61
+ libraryAsset.push(urls);
62
+ }
63
+ });
64
+ assetLoader = new AssetLoader();
65
+ _context2.next = 9;
66
+ return assetLoader.load(libraryAsset);
67
+ case 9:
68
+ newComponents = rawComponents;
69
+ if (!(rawComponents && rawComponents.length)) {
70
+ _context2.next = 18;
71
+ break;
72
+ }
73
+ componentDescriptions = [];
74
+ remoteComponentDescriptions = [];
75
+ rawComponents.forEach(function (component) {
76
+ if (!component) {
77
+ return;
78
+ }
79
+ if (component.exportName && component.url) {
80
+ remoteComponentDescriptions.push(component);
81
+ } else {
82
+ componentDescriptions.push(component);
83
+ }
84
+ });
85
+ newComponents = [].concat(componentDescriptions);
86
+
87
+ // 如果有远程组件描述协议,则自动加载并补充到资产包中,同时出发 designer.incrementalAssetsReady 通知组件面板更新数据
88
+ if (!(remoteComponentDescriptions && remoteComponentDescriptions.length)) {
89
+ _context2.next = 18;
90
+ break;
91
+ }
92
+ _context2.next = 18;
93
+ return Promise.all(remoteComponentDescriptions.map( /*#__PURE__*/function () {
94
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(component) {
95
+ var exportName, url, npm, setAssetsComponent, setArrayAssets;
96
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
97
+ while (1) switch (_context.prev = _context.next) {
98
+ case 0:
99
+ setArrayAssets = function _setArrayAssets(value, preExportName, preSubName) {
100
+ if (preExportName === void 0) {
101
+ preExportName = '';
102
+ }
103
+ if (preSubName === void 0) {
104
+ preSubName = '';
105
+ }
106
+ value.forEach(function (d, i) {
107
+ var exportName = [preExportName, i.toString()].filter(function (d) {
108
+ return !!d;
109
+ }).join('.');
110
+ var subName = [preSubName, i.toString()].filter(function (d) {
111
+ return !!d;
112
+ }).join('.');
113
+ Array.isArray(d) ? setArrayAssets(d, exportName, subName) : setAssetsComponent(d, {
114
+ exportName: exportName,
115
+ subName: subName
116
+ });
117
+ });
118
+ };
119
+ setAssetsComponent = function _setAssetsComponent(component, extraNpmInfo) {
120
+ if (extraNpmInfo === void 0) {
121
+ extraNpmInfo = {};
122
+ }
123
+ var components = component.components;
124
+ if (Array.isArray(components)) {
125
+ components.forEach(function (d) {
126
+ newComponents = newComponents.concat(_extends({
127
+ npm: _extends({}, npm, extraNpmInfo)
128
+ }, d) || []);
129
+ });
130
+ return;
131
+ }
132
+ newComponents = newComponents.concat(_extends({
133
+ npm: _extends({}, npm, extraNpmInfo)
134
+ }, component.components) || []);
135
+ // assets.componentList = assets.componentList.concat(component.componentList || []);
136
+ };
137
+ exportName = component.exportName, url = component.url, npm = component.npm;
138
+ _context.next = 5;
139
+ return new AssetLoader().load(url);
140
+ case 5:
141
+ if (window[exportName]) {
142
+ if (Array.isArray(window[exportName])) {
143
+ setArrayAssets(window[exportName]);
144
+ } else {
145
+ setAssetsComponent(window[exportName]);
146
+ }
147
+ }
148
+ return _context.abrupt("return", window[exportName]);
149
+ case 7:
150
+ case "end":
151
+ return _context.stop();
152
+ }
153
+ }, _callee);
154
+ }));
155
+ return function (_x2) {
156
+ return _ref.apply(this, arguments);
157
+ };
158
+ }()));
159
+ case 18:
160
+ lowcodeComponentsArray = [];
161
+ proCodeComponentsMap = newComponents.reduce(function (acc, cur) {
162
+ if ((cur.devMode || '').toLowerCase() === 'lowcode') {
163
+ lowcodeComponentsArray.push(cur);
164
+ } else {
165
+ acc[cur.componentName] = _extends({}, cur.reference || cur.npm, {
166
+ componentName: cur.componentName
167
+ });
168
+ }
169
+ return acc;
170
+ }, {});
171
+ components = buildComponents(libraryMap, proCodeComponentsMap, function (schema) {
172
+ return null;
173
+ });
174
+ lowCodeComponents = genLowCodeComponentsMap(components);
175
+ return _context2.abrupt("return", {
176
+ components: _extends({}, components, lowCodeComponents)
177
+ });
178
+ case 23:
179
+ case "end":
180
+ return _context2.stop();
181
+ }
182
+ }, _callee2);
183
+ }));
184
+ return _parseAssets.apply(this, arguments);
185
+ }
@@ -0,0 +1,34 @@
1
+ import { CSSProperties, ReactNode } from "react";
2
+ import "./index.less";
3
+ export declare function Layout(props: {
4
+ header?: ReactNode;
5
+ footer?: ReactNode;
6
+ left?: ReactNode;
7
+ right?: ReactNode;
8
+ children?: ReactNode;
9
+ styles?: {
10
+ header?: CSSProperties;
11
+ footer?: CSSProperties;
12
+ left?: CSSProperties;
13
+ right?: CSSProperties;
14
+ content?: CSSProperties;
15
+ };
16
+ }): import("react").JSX.Element;
17
+ export declare function LayoutVertical(props: {
18
+ header?: ReactNode;
19
+ footer?: ReactNode;
20
+ children?: ReactNode;
21
+ styles?: {
22
+ header?: CSSProperties;
23
+ footer?: CSSProperties;
24
+ };
25
+ }): import("react").JSX.Element;
26
+ export declare function LayoutHorizontal(props: {
27
+ left?: ReactNode;
28
+ right?: ReactNode;
29
+ children?: ReactNode;
30
+ styles?: {
31
+ left?: CSSProperties;
32
+ right?: CSSProperties;
33
+ };
34
+ }): import("react").JSX.Element;