@zhubangyun/lowcode-core 6.3.20 → 6.4.4
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.
- package/es/index.d.ts +1 -1
- package/es/index.js +5 -5
- package/es/index.less +0 -1
- package/es/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/es/utils/api/form-api/form-api.utils.js +13 -19
- package/es/utils/api/form-api.d.ts +0 -1
- package/es/utils/api/form-api.js +4 -37
- package/es/utils/api/index.d.ts +6 -1
- package/es/utils/api/rest-api.d.ts +2 -0
- package/es/utils/api/rest-api.js +125 -108
- package/es/utils/api/script-api.d.ts +1 -1
- package/es/utils/cache/cache.load-data.d.ts +1 -0
- package/es/utils/cache/cache.load-data.js +41 -0
- package/es/utils/cache/cache.page-permission.d.ts +1 -0
- package/es/utils/cache/cache.page-permission.js +28 -0
- package/es/utils/cache/cache.page-print.d.ts +1 -0
- package/es/utils/cache/cache.page-print.js +25 -0
- package/es/utils/cache/cache.page-schema.d.ts +1 -0
- package/es/utils/cache/cache.page-schema.js +96 -0
- package/es/utils/cache/cache.print.js +0 -0
- package/es/utils/cache/index.d.ts +5 -6
- package/es/utils/cache/index.js +19 -32
- package/es/utils/cache/index_db_cache.d.ts +11 -6
- package/es/utils/cache/index_db_cache.js +57 -5
- package/es/utils/page/index.js +1 -1
- package/es/utils/page/page-form-data-manager.d.ts +2 -1
- package/es/utils/page/page-form-group.js +10 -4
- package/es/utils/page/page-layout.d.ts +1 -1
- package/es/utils/page/page-load-schema.js +33 -15
- package/es/utils/page/page-render.js +5 -1
- package/es/utils/page/page-schema-utils.js +18 -2
- package/es/utils/page/print-form.js +2 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/index.less +0 -1
- package/lib/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/lib/utils/api/form-api/form-api.utils.js +13 -19
- package/lib/utils/api/form-api.d.ts +0 -1
- package/lib/utils/api/form-api.js +4 -37
- package/lib/utils/api/index.d.ts +6 -1
- package/lib/utils/api/rest-api.d.ts +2 -0
- package/lib/utils/api/rest-api.js +125 -108
- package/lib/utils/api/script-api.d.ts +1 -1
- package/lib/utils/cache/cache.load-data.d.ts +1 -0
- package/lib/utils/cache/cache.load-data.js +44 -0
- package/lib/utils/cache/cache.page-permission.d.ts +1 -0
- package/lib/utils/cache/cache.page-permission.js +33 -0
- package/lib/utils/cache/cache.page-print.d.ts +1 -0
- package/lib/utils/cache/cache.page-print.js +30 -0
- package/lib/utils/cache/cache.page-schema.d.ts +1 -0
- package/lib/utils/cache/cache.page-schema.js +101 -0
- package/lib/utils/cache/cache.print.js +1 -0
- package/lib/utils/cache/index.d.ts +5 -6
- package/lib/utils/cache/index.js +23 -35
- package/lib/utils/cache/index_db_cache.d.ts +11 -6
- package/lib/utils/cache/index_db_cache.js +61 -6
- package/lib/utils/page/index.js +1 -1
- package/lib/utils/page/page-form-data-manager.d.ts +2 -1
- package/lib/utils/page/page-form-group.js +10 -4
- package/lib/utils/page/page-layout.d.ts +1 -1
- package/lib/utils/page/page-load-schema.js +32 -14
- package/lib/utils/page/page-render.js +5 -1
- package/lib/utils/page/page-schema-utils.js +18 -2
- package/lib/utils/page/print-form.js +2 -4
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./index.less";
|
|
2
2
|
import * as lodash from "lodash";
|
|
3
|
+
import utils from "./utils/index";
|
|
3
4
|
export { LoadMaterials } from "./components/load-materials";
|
|
4
5
|
export { PageLoading } from "./components/page-loading";
|
|
5
6
|
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
6
7
|
export { Layout } from "./components/layout";
|
|
7
8
|
export { ReactRender } from "./components/react-render";
|
|
8
|
-
import utils from "./utils/index";
|
|
9
9
|
export { utils, lodash };
|
package/es/index.js
CHANGED
|
@@ -2,16 +2,16 @@ import _message from "antd/es/message";
|
|
|
2
2
|
import "./index.less";
|
|
3
3
|
import { ReactRender } from "./components/react-render";
|
|
4
4
|
import * as lodash from "lodash";
|
|
5
|
-
export { LoadMaterials } from "./components/load-materials";
|
|
6
|
-
export { PageLoading } from "./components/page-loading";
|
|
7
|
-
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
8
|
-
export { Layout } from "./components/layout";
|
|
9
|
-
export { ReactRender } from "./components/react-render";
|
|
10
5
|
import utils from "./utils/index";
|
|
11
6
|
import { uniBridge } from "./utils/uni-bridge";
|
|
12
7
|
import { initBarHeight } from "./init/init.bar-height";
|
|
13
8
|
import { initScrollSize } from "./init/init.scroll-size";
|
|
14
9
|
import { initMobileClass } from "./init/init.mobile-class";
|
|
10
|
+
export { LoadMaterials } from "./components/load-materials";
|
|
11
|
+
export { PageLoading } from "./components/page-loading";
|
|
12
|
+
export { RestApi, RestFormApi, apiRequest } from "./utils/api";
|
|
13
|
+
export { Layout } from "./components/layout";
|
|
14
|
+
export { ReactRender } from "./components/react-render";
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
window.__ReactRender = ReactRender;
|
|
17
17
|
// @ts-ignore
|
package/es/index.less
CHANGED
|
@@ -23,7 +23,7 @@ function assembleData(data, dataMap) {
|
|
|
23
23
|
for (var _iterator2 = _createForOfIteratorHelperLoose(data), _step2; !(_step2 = _iterator2()).done;) {
|
|
24
24
|
var item = _step2.value;
|
|
25
25
|
assembleObject(item, dataMap, {
|
|
26
|
-
maxDepth:
|
|
26
|
+
maxDepth: 3,
|
|
27
27
|
depth: 1
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -40,7 +40,7 @@ function assembleRefs(refs, dataMap) {
|
|
|
40
40
|
for (var _iterator4 = _createForOfIteratorHelperLoose(data), _step4; !(_step4 = _iterator4()).done;) {
|
|
41
41
|
var item = _step4.value;
|
|
42
42
|
assembleObject(item, dataMap, {
|
|
43
|
-
maxDepth:
|
|
43
|
+
maxDepth: 3,
|
|
44
44
|
depth: 1
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -73,7 +73,7 @@ function assembleObject(values, dataMap, options) {
|
|
|
73
73
|
var valueElement = _step5.value;
|
|
74
74
|
assembleObject(valueElement, dataMap, {
|
|
75
75
|
maxDepth: maxDepth,
|
|
76
|
-
depth: depth
|
|
76
|
+
depth: depth
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -82,6 +82,12 @@ function assembleObject(values, dataMap, options) {
|
|
|
82
82
|
if (dataMap.hasEntity(value)) {
|
|
83
83
|
values[key] = dataMap.getEntity(value);
|
|
84
84
|
}
|
|
85
|
+
} else if (key == "parent") {
|
|
86
|
+
//values.parent = dataMap.getEntity(value);
|
|
87
|
+
Object.defineProperty(values, "parent", {
|
|
88
|
+
value: dataMap.getEntity(value),
|
|
89
|
+
writable: true
|
|
90
|
+
});
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
}
|
|
@@ -7,24 +7,33 @@ import { isLocalhost } from "../../common";
|
|
|
7
7
|
import { formApiAssembleEntity } from "./form-api.assemble-entity";
|
|
8
8
|
import { isTemplateHost } from "../../util.common";
|
|
9
9
|
var SimpleSerialFieldNames = ["parent", "instance"];
|
|
10
|
+
var IgnoreFieldNames = ["createdAt", "createdBy", "updatedAt", "updatedBy"];
|
|
10
11
|
export function convertSaveData(data) {
|
|
11
12
|
if (!data) return data;
|
|
12
13
|
var seen = new WeakSet(); // WeakSet 只存储对象,非常适合检测引用
|
|
13
14
|
return JSON.parse(JSON.stringify(data, function (key, value) {
|
|
15
|
+
if (IgnoreFieldNames.includes(key)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
14
18
|
if (value == null) {
|
|
15
19
|
return null;
|
|
16
20
|
} else if (Array.isArray(value)) {
|
|
17
21
|
return value;
|
|
18
22
|
} else if (typeof value == "object") {
|
|
23
|
+
if (key == "form") {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
19
26
|
if (SimpleSerialFieldNames.includes(key)) {
|
|
20
27
|
var id = value === null || value === void 0 ? void 0 : value.id;
|
|
21
28
|
return id ? {
|
|
22
|
-
id: id
|
|
29
|
+
id: id,
|
|
30
|
+
form: value === null || value === void 0 ? void 0 : value.form
|
|
23
31
|
} : undefined;
|
|
24
32
|
} else if (seen.has(value)) {
|
|
25
|
-
if (value.id) {
|
|
33
|
+
if (value.id && value.form) {
|
|
26
34
|
return {
|
|
27
|
-
id: value.id
|
|
35
|
+
id: value.id,
|
|
36
|
+
form: value.form
|
|
28
37
|
};
|
|
29
38
|
} else {
|
|
30
39
|
return value;
|
|
@@ -155,24 +164,9 @@ export function handleEntityLabel(data) {
|
|
|
155
164
|
}
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
|
-
function valueToFormDataArray(value) {
|
|
159
|
-
if (typeof value == null || typeof value !== "object") {
|
|
160
|
-
return [];
|
|
161
|
-
}
|
|
162
|
-
if (Array.isArray(value)) {
|
|
163
|
-
return value === null || value === void 0 ? void 0 : value.filter(function (item) {
|
|
164
|
-
var _item$form;
|
|
165
|
-
return (item === null || item === void 0 ? void 0 : item.id) && (item === null || item === void 0 ? void 0 : (_item$form = item.form) === null || _item$form === void 0 ? void 0 : _item$form.id);
|
|
166
|
-
});
|
|
167
|
-
} else if (typeof value == "object" && value !== null) {
|
|
168
|
-
return valueToFormDataArray([value]);
|
|
169
|
-
} else {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
167
|
export function assembleAssociationField(data, refs) {
|
|
174
168
|
var start = Date.now();
|
|
175
|
-
if (isLocalhost() || isTemplateHost()) {
|
|
169
|
+
if (isLocalhost() || isTemplateHost() || window.__mock) {
|
|
176
170
|
formApiAssembleEntity(data, refs);
|
|
177
171
|
return Date.now() - start;
|
|
178
172
|
}
|
|
@@ -6,7 +6,6 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
6
6
|
private readonly fieldId?;
|
|
7
7
|
private readonly mock;
|
|
8
8
|
private initialized;
|
|
9
|
-
private schema;
|
|
10
9
|
constructor(formId: string, fieldId?: string, mock?: boolean);
|
|
11
10
|
initialize(): Promise<boolean>;
|
|
12
11
|
handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -4,7 +4,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import { RestApi } from "./rest-api";
|
|
5
5
|
import { assembleAssociationField, convertSaveData, handleFilterRules } from "./form-api/form-api.utils";
|
|
6
6
|
import { formApi } from "../cache";
|
|
7
|
-
import { getSchemaFromCache } from "./schema-api";
|
|
8
7
|
import { uuid, uuidVersion } from "../common";
|
|
9
8
|
export function getFormApi(_x, _x2, _x3) {
|
|
10
9
|
return _getFormApi.apply(this, arguments);
|
|
@@ -46,7 +45,6 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
46
45
|
_this.fieldId = void 0;
|
|
47
46
|
_this.mock = void 0;
|
|
48
47
|
_this.initialized = false;
|
|
49
|
-
_this.schema = void 0;
|
|
50
48
|
_this.formId = formId;
|
|
51
49
|
_this.fieldId = fieldId;
|
|
52
50
|
_this.mock = !!mock;
|
|
@@ -56,41 +54,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
56
54
|
var _proto = RestFormApi.prototype;
|
|
57
55
|
_proto.initialize = /*#__PURE__*/function () {
|
|
58
56
|
var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
59
|
-
var _this2 = this;
|
|
60
|
-
var res, _this$schema, _this$schema$children, _this$schema$children2;
|
|
61
57
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
62
58
|
while (1) switch (_context.prev = _context.next) {
|
|
63
59
|
case 0:
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
res = getSchemaFromCache(this.formId, this.mock);
|
|
67
|
-
this.schema = res === null || res === void 0 ? void 0 : res.data;
|
|
68
|
-
this.initialized = !!this.schema;
|
|
69
|
-
if (this.initialized) {
|
|
70
|
-
this.title = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$children = _this$schema.children[0]) === null || _this$schema$children === void 0 ? void 0 : (_this$schema$children2 = _this$schema$children.props) === null || _this$schema$children2 === void 0 ? void 0 : _this$schema$children2.label;
|
|
71
|
-
if (this.fieldId) {
|
|
72
|
-
JSON.stringify(this.schema, function (key, value) {
|
|
73
|
-
var _value$props;
|
|
74
|
-
if (key == "fdmSchema") {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
if ((value === null || value === void 0 ? void 0 : (_value$props = value.props) === null || _value$props === void 0 ? void 0 : _value$props.fieldId) === _this2.fieldId) {
|
|
78
|
-
if (value.props.label) {
|
|
79
|
-
_this2.title += "." + value.props.label;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return value;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
} catch (e) {
|
|
87
|
-
console.log("获取schema失败!", {
|
|
88
|
-
formId: this.formId,
|
|
89
|
-
field: this.fieldId,
|
|
90
|
-
mock: this.mock
|
|
91
|
-
}, e);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
60
|
+
this.initialized = true;
|
|
94
61
|
return _context.abrupt("return", this.initialized);
|
|
95
62
|
case 1:
|
|
96
63
|
case "end":
|
|
@@ -241,7 +208,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
241
208
|
}();
|
|
242
209
|
_proto.labelToValue = /*#__PURE__*/function () {
|
|
243
210
|
var _labelToValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
244
|
-
var
|
|
211
|
+
var _this2 = this;
|
|
245
212
|
var config, res;
|
|
246
213
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
247
214
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -258,8 +225,8 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
258
225
|
res.data.forEach(function (item) {
|
|
259
226
|
item.id = uuid();
|
|
260
227
|
item.form = {
|
|
261
|
-
id:
|
|
262
|
-
fieldId:
|
|
228
|
+
id: _this2.formId,
|
|
229
|
+
fieldId: _this2.fieldId
|
|
263
230
|
};
|
|
264
231
|
});
|
|
265
232
|
}
|
package/es/utils/api/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export { getUserinfo } from "./user-info";
|
|
|
6
6
|
export * as files from "./file-api";
|
|
7
7
|
export * as scrips from "./script-api";
|
|
8
8
|
export declare const apiRequest: import("axios").AxiosInstance;
|
|
9
|
-
|
|
9
|
+
interface RequestResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
data: any;
|
|
13
|
+
}
|
|
14
|
+
export declare const request: (config: import("axios").AxiosRequestConfig<any>) => Promise<RequestResult>;
|
|
10
15
|
export declare function onFulfilled(res: AxiosResponse): any;
|
|
11
16
|
export declare function onRejected(error: any): any;
|
|
@@ -45,6 +45,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
45
45
|
*/
|
|
46
46
|
getById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
47
47
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
48
|
+
saveMany(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
48
49
|
/**
|
|
49
50
|
* 创建
|
|
50
51
|
*/
|
|
@@ -98,6 +99,7 @@ export interface IBaseEntity {
|
|
|
98
99
|
labelField: string;
|
|
99
100
|
};
|
|
100
101
|
_load?: boolean;
|
|
102
|
+
_process?: boolean;
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* 基础返回结果
|