@zhubangyun/lowcode-core 6.2.30 → 6.3.25
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/components/react-render/index.js +11 -1
- package/es/utils/api/form-api/form-api.assemble-entity.d.ts +2 -0
- package/es/utils/api/form-api/form-api.assemble-entity.js +101 -0
- package/es/utils/api/form-api/form-api.entity-map.d.ts +12 -0
- package/es/utils/api/form-api/form-api.entity-map.js +50 -0
- package/es/utils/api/{form-api.utils.d.ts → form-api/form-api.utils.d.ts} +3 -2
- package/es/utils/api/{form-api.utils.js → form-api/form-api.utils.js} +46 -23
- package/es/utils/api/form-api.js +10 -17
- package/es/utils/api/index.d.ts +6 -1
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/schema-api.d.ts +2 -1
- package/es/utils/api/schema-api.js +1 -1
- package/es/utils/api/schema.util.d.ts +1 -0
- package/es/utils/api/schema.util.js +10 -0
- package/es/utils/cache/index.d.ts +0 -1
- package/es/utils/cache/index.js +58 -35
- package/es/utils/cache/index_db_cache.d.ts +9 -0
- package/es/utils/cache/index_db_cache.js +7 -0
- package/es/utils/common/SingletonInstanceMap.d.ts +2 -2
- package/es/utils/data/index.d.ts +3 -1
- package/es/utils/data/index.js +10 -3
- package/es/utils/page/index.d.ts +1 -0
- package/es/utils/page/index.js +1 -1
- package/es/utils/page/page-create-element.d.ts +6 -0
- package/es/utils/page/page-create-element.js +23 -0
- package/es/utils/page/page-form-group.js +10 -4
- package/es/utils/page/page-render.js +1 -1
- package/es/utils/page/page-schema-utils.js +19 -2
- package/es/utils/page/print-form.d.ts +1 -1
- package/es/utils/page/print-form.js +13 -7
- package/es/utils/uni-bridge.js +1 -3
- package/es/utils/util.common.d.ts +1 -1
- package/es/utils/util.common.js +1 -2
- package/lib/components/react-render/index.js +11 -1
- package/lib/utils/api/form-api/form-api.assemble-entity.d.ts +2 -0
- package/lib/utils/api/form-api/form-api.assemble-entity.js +105 -0
- package/lib/utils/api/form-api/form-api.entity-map.d.ts +12 -0
- package/lib/utils/api/form-api/form-api.entity-map.js +54 -0
- package/lib/utils/api/{form-api.utils.d.ts → form-api/form-api.utils.d.ts} +3 -2
- package/lib/utils/api/{form-api.utils.js → form-api/form-api.utils.js} +46 -22
- package/lib/utils/api/form-api.js +10 -17
- package/lib/utils/api/index.d.ts +6 -1
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/schema-api.d.ts +2 -1
- package/lib/utils/api/schema-api.js +1 -1
- package/lib/utils/api/schema.util.d.ts +1 -0
- package/lib/utils/api/schema.util.js +11 -0
- package/lib/utils/cache/index.d.ts +0 -1
- package/lib/utils/cache/index.js +57 -34
- package/lib/utils/cache/index_db_cache.d.ts +9 -0
- package/lib/utils/cache/index_db_cache.js +11 -0
- package/lib/utils/common/SingletonInstanceMap.d.ts +2 -2
- package/lib/utils/data/index.d.ts +3 -1
- package/lib/utils/data/index.js +10 -3
- package/lib/utils/page/index.d.ts +1 -0
- package/lib/utils/page/index.js +4 -2
- package/lib/utils/page/page-create-element.d.ts +6 -0
- package/lib/utils/page/page-create-element.js +29 -0
- package/lib/utils/page/page-form-group.js +10 -4
- package/lib/utils/page/page-render.js +1 -1
- package/lib/utils/page/page-schema-utils.js +19 -2
- package/lib/utils/page/print-form.d.ts +1 -1
- package/lib/utils/page/print-form.js +13 -7
- package/lib/utils/uni-bridge.js +1 -3
- package/lib/utils/util.common.d.ts +1 -1
- package/lib/utils/util.common.js +2 -3
- package/package.json +5 -4
- package/es/utils/cache/schema.d.ts +0 -6
- package/es/utils/cache/schema.js +0 -14
- package/es/utils/utils.scrollbar-size.js +0 -0
- package/lib/utils/cache/schema.d.ts +0 -6
- package/lib/utils/cache/schema.js +0 -18
- package/lib/utils/utils.scrollbar-size.js +0 -1
|
@@ -5,11 +5,10 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.RestFormApi = void 0;
|
|
6
6
|
exports.getFormApi = getFormApi;
|
|
7
7
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
10
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
10
|
var _restApi = require("./rest-api");
|
|
12
|
-
var _formApi = require("./form-api.utils");
|
|
11
|
+
var _formApi = require("./form-api/form-api.utils");
|
|
13
12
|
var _cache = require("../cache");
|
|
14
13
|
var _schemaApi = require("./schema-api");
|
|
15
14
|
var _common = require("../common");
|
|
@@ -143,7 +142,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
143
142
|
_proto.search = /*#__PURE__*/function () {
|
|
144
143
|
var _search = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(searchParams) {
|
|
145
144
|
var _searchParams, _searchParams2;
|
|
146
|
-
var params, config, res
|
|
145
|
+
var params, config, res;
|
|
147
146
|
return _regenerator["default"].wrap(function (_context3) {
|
|
148
147
|
while (1) switch (_context3.prev = _context3.next) {
|
|
149
148
|
case 0:
|
|
@@ -167,14 +166,11 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
167
166
|
searchParams.searchFields = (0, _formApi.handleFilterRules)(((_searchParams2 = searchParams) === null || _searchParams2 === void 0 ? void 0 : _searchParams2.searchFields) || [], {
|
|
168
167
|
filterNullValue: true
|
|
169
168
|
});
|
|
170
|
-
config.params = (0, _extends2["default"])({}, params, searchParams);
|
|
171
169
|
_context3.next = 2;
|
|
172
|
-
return this.request.
|
|
170
|
+
return this.request.post("search", searchParams, config);
|
|
173
171
|
case 2:
|
|
174
172
|
res = _context3.sent;
|
|
175
|
-
|
|
176
|
-
start = Date.now();
|
|
177
|
-
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
173
|
+
res.assembleTime = (0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
178
174
|
console.debug("form.search:", res);
|
|
179
175
|
return _context3.abrupt("return", res);
|
|
180
176
|
case 3:
|
|
@@ -235,8 +231,8 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
235
231
|
return _RestApi.prototype.getById.call(this, searchId, options);
|
|
236
232
|
case 5:
|
|
237
233
|
res = _context4.sent;
|
|
238
|
-
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
239
|
-
console.debug("
|
|
234
|
+
res.assembleTime = (0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
235
|
+
console.debug("form.getById:", res);
|
|
240
236
|
return _context4.abrupt("return", res);
|
|
241
237
|
case 6:
|
|
242
238
|
case "end":
|
|
@@ -273,7 +269,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
273
269
|
};
|
|
274
270
|
});
|
|
275
271
|
}
|
|
276
|
-
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
272
|
+
res.assembleTime = (0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
277
273
|
console.debug("formApi.labelToValue", res);
|
|
278
274
|
return _context5.abrupt("return", res);
|
|
279
275
|
case 3:
|
|
@@ -341,7 +337,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
341
337
|
_proto.fieldFilters = /*#__PURE__*/function () {
|
|
342
338
|
var _fieldFilters = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(searchParams) {
|
|
343
339
|
var _searchParams3, _searchParams4;
|
|
344
|
-
var params, config
|
|
340
|
+
var params, config;
|
|
345
341
|
return _regenerator["default"].wrap(function (_context9) {
|
|
346
342
|
while (1) switch (_context9.prev = _context9.next) {
|
|
347
343
|
case 0:
|
|
@@ -365,13 +361,10 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
365
361
|
searchParams.searchFields = (0, _formApi.handleFilterRules)(((_searchParams4 = searchParams) === null || _searchParams4 === void 0 ? void 0 : _searchParams4.searchFields) || [], {
|
|
366
362
|
filterNullValue: true
|
|
367
363
|
});
|
|
368
|
-
config.params = (0, _extends2["default"])({}, params, searchParams);
|
|
369
364
|
_context9.next = 2;
|
|
370
|
-
return this.request.
|
|
365
|
+
return this.request.post("fieldFilters", searchParams, config);
|
|
371
366
|
case 2:
|
|
372
|
-
|
|
373
|
-
console.debug("form.fieldFilters:", res);
|
|
374
|
-
return _context9.abrupt("return", res);
|
|
367
|
+
return _context9.abrupt("return", _context9.sent);
|
|
375
368
|
case 3:
|
|
376
369
|
case "end":
|
|
377
370
|
return _context9.stop();
|
package/lib/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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
-
export type ValueType = "value" | "field" | "express";
|
|
2
|
+
export type ValueType = "value" | "field" | "express" | "column";
|
|
3
3
|
export interface RestApiOptions {
|
|
4
4
|
/**
|
|
5
5
|
* 超时时间
|
|
@@ -98,6 +98,7 @@ export interface IBaseEntity {
|
|
|
98
98
|
labelField: string;
|
|
99
99
|
};
|
|
100
100
|
_load?: boolean;
|
|
101
|
+
_process?: boolean;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* 基础返回结果
|
|
@@ -106,6 +107,7 @@ export interface BaseResult<DataType> {
|
|
|
106
107
|
success: boolean;
|
|
107
108
|
message?: string;
|
|
108
109
|
requestId: string;
|
|
110
|
+
assembleTime: number;
|
|
109
111
|
refs?: Refs;
|
|
110
112
|
}
|
|
111
113
|
export interface Ref {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { OneResult } from "./rest-api";
|
|
2
|
+
import { Schema } from "./schema.util";
|
|
2
3
|
export declare function getSchema(pageId: string, mock?: boolean): Promise<OneResult<any>>;
|
|
3
|
-
export declare function getSchemaFromCache(pageId?: string, mock?: boolean):
|
|
4
|
+
export declare function getSchemaFromCache(pageId?: string, mock?: boolean): OneResult<Schema>;
|
|
@@ -17,7 +17,7 @@ function _getSchema() {
|
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
mock = getMock(mock);
|
|
20
|
-
key = mock ? pageId + "
|
|
20
|
+
key = mock ? pageId + "_mock" : pageId;
|
|
21
21
|
_context.next = 1;
|
|
22
22
|
return _cache.schema.getInstance(key, {
|
|
23
23
|
mock: mock,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function forEachSchema(schema: Schema, callback: (child: Schema, index: number, children: any[]) => boolean): void;
|
|
7
7
|
export declare function findFormSchemas(schema: Schema): Schema[];
|
|
8
|
+
export declare function findLoadRefSchemas(schema: Schema): Schema[];
|
|
8
9
|
export declare function findFdmSchemas(schema?: Schema): Schema[];
|
|
9
10
|
export interface Schema {
|
|
10
11
|
componentName: string;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.findFdmSchemas = findFdmSchemas;
|
|
5
5
|
exports.findFormSchemas = findFormSchemas;
|
|
6
|
+
exports.findLoadRefSchemas = findLoadRefSchemas;
|
|
6
7
|
exports.forEachSchema = forEachSchema;
|
|
7
8
|
/**
|
|
8
9
|
* 遍历schema
|
|
@@ -28,6 +29,16 @@ function findFormSchemas(schema) {
|
|
|
28
29
|
});
|
|
29
30
|
return schemas;
|
|
30
31
|
}
|
|
32
|
+
function findLoadRefSchemas(schema) {
|
|
33
|
+
var schemas = [];
|
|
34
|
+
forEachSchema(schema, function (child) {
|
|
35
|
+
if (["ProcessGroupField"].includes(child.componentName)) {
|
|
36
|
+
schemas.push(child);
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
return schemas;
|
|
41
|
+
}
|
|
31
42
|
function findFdmSchemas(schema) {
|
|
32
43
|
var schemas = [];
|
|
33
44
|
if (!schema) {
|
|
@@ -12,7 +12,6 @@ export declare class FormApiCache extends SingletonInstanceMap<RestFormApi<any>,
|
|
|
12
12
|
fieldId?: string;
|
|
13
13
|
mock?: boolean;
|
|
14
14
|
}> {
|
|
15
|
-
apiMap: Map<string, RestFormApi<any>>;
|
|
16
15
|
createInstance(key: string, options?: any): Promise<RestFormApi<any>>;
|
|
17
16
|
}
|
|
18
17
|
export declare const formApi: FormApiCache;
|
package/lib/utils/cache/index.js
CHANGED
|
@@ -9,6 +9,9 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
|
9
9
|
var _SingletonInstanceMap3 = require("../common/SingletonInstanceMap");
|
|
10
10
|
var _api = require("../api");
|
|
11
11
|
var _schema = require("../api/schema.util");
|
|
12
|
+
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."); }
|
|
13
|
+
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; } }
|
|
14
|
+
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; }
|
|
12
15
|
var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
13
16
|
function SchemaCache() {
|
|
14
17
|
return _SingletonInstanceMap.apply(this, arguments) || this;
|
|
@@ -17,28 +20,24 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
17
20
|
var _proto = SchemaCache.prototype;
|
|
18
21
|
_proto.createInstance = /*#__PURE__*/function () {
|
|
19
22
|
var _createInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(key, options) {
|
|
20
|
-
var mock, pageId, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, _t;
|
|
23
|
+
var mock, pageId, params, schemaRes, schema, handleCommonSchema, permission, printTemplates, workflow, cloneSchema, refs, _iterator, _step, _ref$props, _ref$props$fieldProps, _ref$props$fieldProps2, ref, refPageId, _key, _t;
|
|
21
24
|
return _regenerator["default"].wrap(function (_context) {
|
|
22
25
|
while (1) switch (_context.prev = _context.next) {
|
|
23
26
|
case 0:
|
|
24
27
|
mock = options.mock, pageId = options.pageId;
|
|
28
|
+
params = {};
|
|
29
|
+
if (mock) {
|
|
30
|
+
params.mock = mock;
|
|
31
|
+
}
|
|
25
32
|
_context.next = 1;
|
|
26
33
|
return _api.apiRequest.get("pages/" + pageId + "/schema", {
|
|
27
|
-
params:
|
|
28
|
-
mock: mock
|
|
29
|
-
}
|
|
34
|
+
params: params
|
|
30
35
|
});
|
|
31
36
|
case 1:
|
|
32
37
|
schemaRes = _context.sent;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
return _context.abrupt("return", schemaRes);
|
|
38
|
-
case 2:
|
|
39
|
-
schema = schemaRes.data;
|
|
40
|
-
if (!(schema != null && typeof schema == "object")) {
|
|
41
|
-
_context.next = 8;
|
|
38
|
+
schema = schemaRes === null || schemaRes === void 0 ? void 0 : schemaRes.data;
|
|
39
|
+
if (!schema) {
|
|
40
|
+
_context.next = 9;
|
|
42
41
|
break;
|
|
43
42
|
}
|
|
44
43
|
handleCommonSchema = function handleCommonSchema(schema) {
|
|
@@ -51,29 +50,29 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
51
50
|
permission = null; //处理打印
|
|
52
51
|
workflow = null;
|
|
53
52
|
if (location.pathname.startsWith("/print")) {
|
|
54
|
-
_context.next =
|
|
53
|
+
_context.next = 6;
|
|
55
54
|
break;
|
|
56
55
|
}
|
|
57
|
-
_context.next =
|
|
56
|
+
_context.next = 2;
|
|
58
57
|
return _api.apiRequest.get("pages/" + pageId + "/permission");
|
|
59
|
-
case
|
|
58
|
+
case 2:
|
|
60
59
|
permission = _context.sent.data;
|
|
61
60
|
if (!((schema === null || schema === void 0 ? void 0 : schema.type) == "form")) {
|
|
62
|
-
_context.next =
|
|
61
|
+
_context.next = 6;
|
|
63
62
|
break;
|
|
64
63
|
}
|
|
65
|
-
_context.prev =
|
|
66
|
-
_context.next =
|
|
64
|
+
_context.prev = 3;
|
|
65
|
+
_context.next = 4;
|
|
67
66
|
return _api.apiRequest.get("pages/" + pageId + "/printTemplates");
|
|
68
|
-
case
|
|
67
|
+
case 4:
|
|
69
68
|
printTemplates = _context.sent.data;
|
|
70
|
-
_context.next =
|
|
69
|
+
_context.next = 6;
|
|
71
70
|
break;
|
|
72
|
-
case
|
|
73
|
-
_context.prev =
|
|
74
|
-
_t = _context["catch"](
|
|
71
|
+
case 5:
|
|
72
|
+
_context.prev = 5;
|
|
73
|
+
_t = _context["catch"](3);
|
|
75
74
|
console.log(_t);
|
|
76
|
-
case
|
|
75
|
+
case 6:
|
|
77
76
|
(0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
|
|
78
77
|
handleCommonSchema(formSchema);
|
|
79
78
|
(0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
|
|
@@ -87,13 +86,43 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
87
86
|
fdmSchema.props.formElement = cloneSchema;
|
|
88
87
|
});
|
|
89
88
|
});
|
|
89
|
+
refs = (0, _schema.findLoadRefSchemas)(schema);
|
|
90
|
+
if (!refs.length) {
|
|
91
|
+
_context.next = 9;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
_iterator = _createForOfIteratorHelperLoose(refs);
|
|
95
|
+
case 7:
|
|
96
|
+
if ((_step = _iterator()).done) {
|
|
97
|
+
_context.next = 9;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
ref = _step.value;
|
|
101
|
+
refPageId = (_ref$props = ref.props) === null || _ref$props === void 0 ? void 0 : (_ref$props$fieldProps = _ref$props.fieldProps) === null || _ref$props$fieldProps === void 0 ? void 0 : (_ref$props$fieldProps2 = _ref$props$fieldProps.associationForm) === null || _ref$props$fieldProps2 === void 0 ? void 0 : _ref$props$fieldProps2.id;
|
|
102
|
+
if (!(typeof refPageId == "string" && refPageId !== pageId)) {
|
|
103
|
+
_context.next = 8;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (this.valueMap.has(refPageId)) {
|
|
107
|
+
_context.next = 8;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
_key = mock ? refPageId + "_mock" : refPageId;
|
|
111
|
+
_context.next = 8;
|
|
112
|
+
return this.getInstance(_key, {
|
|
113
|
+
mock: mock,
|
|
114
|
+
pageId: refPageId
|
|
115
|
+
});
|
|
90
116
|
case 8:
|
|
91
|
-
|
|
117
|
+
_context.next = 7;
|
|
118
|
+
break;
|
|
92
119
|
case 9:
|
|
120
|
+
return _context.abrupt("return", schemaRes);
|
|
121
|
+
case 10:
|
|
93
122
|
case "end":
|
|
94
123
|
return _context.stop();
|
|
95
124
|
}
|
|
96
|
-
}, _callee,
|
|
125
|
+
}, _callee, this, [[3, 5]]);
|
|
97
126
|
}));
|
|
98
127
|
function createInstance(_x, _x2) {
|
|
99
128
|
return _createInstance.apply(this, arguments);
|
|
@@ -105,13 +134,7 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
|
|
|
105
134
|
var schema = exports.schema = new SchemaCache();
|
|
106
135
|
var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
|
|
107
136
|
function FormApiCache() {
|
|
108
|
-
|
|
109
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
110
|
-
args[_key] = arguments[_key];
|
|
111
|
-
}
|
|
112
|
-
_this = _SingletonInstanceMap2.call.apply(_SingletonInstanceMap2, [this].concat(args)) || this;
|
|
113
|
-
_this.apiMap = new Map();
|
|
114
|
-
return _this;
|
|
137
|
+
return _SingletonInstanceMap2.apply(this, arguments) || this;
|
|
115
138
|
}
|
|
116
139
|
(0, _inheritsLoose2["default"])(FormApiCache, _SingletonInstanceMap2);
|
|
117
140
|
var _proto2 = FormApiCache.prototype;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var _dexie = require("dexie");
|
|
6
|
+
var db_cache = new _dexie.Dexie('cache');
|
|
7
|
+
db_cache.version(1).stores({
|
|
8
|
+
page_schemas: 'page_id,schema'
|
|
9
|
+
});
|
|
10
|
+
var page_schemas = db_cache.page_schemas;
|
|
11
|
+
var _default = exports["default"] = db_cache;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare abstract class SingletonInstanceMap<Value, Options> {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
protected readonly valueMap: Map<string, Value>;
|
|
3
|
+
protected readonly lockMap: Map<string, boolean>;
|
|
4
4
|
getInstance(key: string, options: Options): Promise<Value>;
|
|
5
5
|
get(key: string): Value;
|
|
6
6
|
clear(): void;
|
package/lib/utils/data/index.js
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.transformerId = transformerId;
|
|
5
|
-
function transformerId(value) {
|
|
5
|
+
function transformerId(value, options) {
|
|
6
6
|
if (value == null) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
if (Array.isArray(value)) {
|
|
10
|
-
|
|
11
|
-
return
|
|
10
|
+
var values = value.map(function (item) {
|
|
11
|
+
return transformerId(item, options);
|
|
12
12
|
});
|
|
13
|
+
if (options !== null && options !== void 0 && options.includeNull) {
|
|
14
|
+
return values;
|
|
15
|
+
} else {
|
|
16
|
+
return values.filter(function (v) {
|
|
17
|
+
return !!v;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
if (typeof value == "object") {
|
|
15
22
|
return (value === null || value === void 0 ? void 0 : value.id) || (value === null || value === void 0 ? void 0 : value.value) || value;
|
package/lib/utils/page/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.closePage = closePage;
|
|
6
|
-
exports.getFormPrintTemplates = void 0;
|
|
6
|
+
exports.getSchema = exports.getFormPrintTemplates = exports.createForm = void 0;
|
|
7
7
|
exports.hideLoading = hideLoading;
|
|
8
8
|
exports.openPage = openPage;
|
|
9
9
|
exports.showFormGroup = exports.showFormDataManagerGroup = exports.showFormDataManager = exports.showForm = exports.show = exports.print = void 0;
|
|
@@ -11,6 +11,9 @@ exports.showLoading = showLoading;
|
|
|
11
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
var _uniBridge = require("../uni-bridge");
|
|
14
|
+
var _pageCreateElement = require("./page-create-element");
|
|
15
|
+
exports.createForm = _pageCreateElement.createForm;
|
|
16
|
+
exports.getSchema = _pageCreateElement.getSchema;
|
|
14
17
|
var _printForm = require("./print-form");
|
|
15
18
|
exports.print = _printForm.print;
|
|
16
19
|
exports.getFormPrintTemplates = _printForm.getFormPrintTemplates;
|
|
@@ -72,7 +75,6 @@ function _hideLoading() {
|
|
|
72
75
|
return _regenerator["default"].wrap(function (_context2) {
|
|
73
76
|
while (1) switch (_context2.prev = _context2.next) {
|
|
74
77
|
case 0:
|
|
75
|
-
console.log("page.hide.loading");
|
|
76
78
|
loading = document.getElementById("fullscreen-loading");
|
|
77
79
|
if (loading) {
|
|
78
80
|
loading.style.display = "none";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PageCreateOptions {
|
|
3
|
+
formId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function getSchema(pageId: string): import("../api/schema.util").Schema & import("../api/rest-api").IBaseEntity;
|
|
6
|
+
export declare function createForm(options: PageCreateOptions): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.createForm = createForm;
|
|
6
|
+
exports.getSchema = getSchema;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
var _schemaApi = require("../api/schema-api");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _reactRender = require("../../components/react-render");
|
|
12
|
+
var _excluded = ["formId"];
|
|
13
|
+
function getSchema(pageId) {
|
|
14
|
+
var _getSchemaFromCache;
|
|
15
|
+
return (_getSchemaFromCache = (0, _schemaApi.getSchemaFromCache)(pageId)) === null || _getSchemaFromCache === void 0 ? void 0 : _getSchemaFromCache.data;
|
|
16
|
+
}
|
|
17
|
+
function createForm(options) {
|
|
18
|
+
var formId = options.formId,
|
|
19
|
+
restProps = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded);
|
|
20
|
+
var schemaRes = (0, _schemaApi.getSchemaFromCache)(formId, window.__mock);
|
|
21
|
+
if (schemaRes !== null && schemaRes !== void 0 && schemaRes.success) {
|
|
22
|
+
var schema = schemaRes.data;
|
|
23
|
+
return /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({
|
|
24
|
+
schema: schema,
|
|
25
|
+
components: window._components || window.components || window.__components
|
|
26
|
+
}, restProps));
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _reactRender = require("../../components/react-render");
|
|
15
15
|
var _pageLoadSchema = require("./page-load-schema");
|
|
16
16
|
var _common = require("../common");
|
|
17
|
-
var _excluded = ["layout", "form", "
|
|
17
|
+
var _excluded = ["layout", "form", "onClose", "onSubmitOk"],
|
|
18
18
|
_excluded2 = ["container", "onClose"];
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
function showFormGroup(_x) {
|
|
@@ -61,8 +61,8 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
61
61
|
var _this$props = this.props,
|
|
62
62
|
layout = _this$props.layout,
|
|
63
63
|
form = _this$props.form,
|
|
64
|
-
items = _this$props.items,
|
|
65
64
|
onClose = _this$props.onClose,
|
|
65
|
+
onSubmitOk = _this$props.onSubmitOk,
|
|
66
66
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
67
67
|
// @ts-ignore
|
|
68
68
|
restProps.layout = layout || "modal";
|
|
@@ -72,6 +72,12 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
72
72
|
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
73
73
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
74
74
|
};
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
restProps.onSubmitOk = function (data) {
|
|
77
|
+
var _self$layoutRef2;
|
|
78
|
+
onSubmitOk === null || onSubmitOk === void 0 ? void 0 : onSubmitOk(data);
|
|
79
|
+
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
80
|
+
};
|
|
75
81
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
76
82
|
ref: function ref(layout) {
|
|
77
83
|
return _this2.layoutRef = layout;
|
|
@@ -91,9 +97,9 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
91
97
|
children: [{
|
|
92
98
|
componentName: "PageFormGroup",
|
|
93
99
|
props: {
|
|
100
|
+
mode: "show",
|
|
94
101
|
title: schema.label,
|
|
95
|
-
form: form
|
|
96
|
-
items: items
|
|
102
|
+
form: form
|
|
97
103
|
}
|
|
98
104
|
}]
|
|
99
105
|
}
|
|
@@ -4,6 +4,20 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.cloneDataView = cloneDataView;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
function replacer(key, value) {
|
|
8
|
+
if (value == null) {
|
|
9
|
+
return null;
|
|
10
|
+
} else if (Array.isArray(value)) {
|
|
11
|
+
return value;
|
|
12
|
+
} else if (value !== null && value !== void 0 && value.id) {
|
|
13
|
+
return {
|
|
14
|
+
id: value.id,
|
|
15
|
+
label: value.label,
|
|
16
|
+
form: value.form
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
7
21
|
function cloneDataView(dataView, extraProps) {
|
|
8
22
|
if (!dataView) {
|
|
9
23
|
return {};
|
|
@@ -65,10 +79,13 @@ function compileFilterRules(rules) {
|
|
|
65
79
|
if (value === "") {
|
|
66
80
|
value = "undefined";
|
|
67
81
|
}
|
|
68
|
-
} else if (rule.valueType == "value" || !rule.valueType || typeof value === "object") {
|
|
69
|
-
value = JSON.stringify(value);
|
|
82
|
+
} else if (rule.valueType == "value" || rule.valueType == "column" || !rule.valueType || typeof value === "object") {
|
|
83
|
+
value = JSON.stringify(value, replacer);
|
|
70
84
|
}
|
|
71
85
|
scripts.push("\"key\":\"" + rule.key + "\",");
|
|
86
|
+
if (rule.valueType) {
|
|
87
|
+
scripts.push("\"valueType\":\"" + rule.valueType + "\",");
|
|
88
|
+
}
|
|
72
89
|
scripts.push("\"operator\":\"" + rule.operator + "\",");
|
|
73
90
|
scripts.push("\"value\":" + value + ",");
|
|
74
91
|
}
|
|
@@ -4,6 +4,6 @@ interface PrintOptions {
|
|
|
4
4
|
mode?: "print" | "export" | "cloud_print";
|
|
5
5
|
data: any;
|
|
6
6
|
}
|
|
7
|
-
export declare function getFormPrintTemplates(formId: string): Promise<any>;
|
|
7
|
+
export declare function getFormPrintTemplates(formId: string, disableCache?: boolean): Promise<any>;
|
|
8
8
|
export declare function print(options: PrintOptions): Promise<void>;
|
|
9
9
|
export {};
|
|
@@ -11,15 +11,19 @@ var _api = require("../api");
|
|
|
11
11
|
var _formIds = require("../formIds");
|
|
12
12
|
var _index = require("./index");
|
|
13
13
|
var cache = new Map();
|
|
14
|
-
function getFormPrintTemplates(_x) {
|
|
14
|
+
function getFormPrintTemplates(_x, _x2) {
|
|
15
15
|
return _getFormPrintTemplates.apply(this, arguments);
|
|
16
16
|
}
|
|
17
17
|
function _getFormPrintTemplates() {
|
|
18
|
-
_getFormPrintTemplates = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(formId) {
|
|
18
|
+
_getFormPrintTemplates = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(formId, disableCache) {
|
|
19
19
|
var res;
|
|
20
20
|
return _regenerator["default"].wrap(function (_context2) {
|
|
21
21
|
while (1) switch (_context2.prev = _context2.next) {
|
|
22
22
|
case 0:
|
|
23
|
+
if (disableCache) {
|
|
24
|
+
_context2.next = 1;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
23
27
|
if (!cache.has(formId)) {
|
|
24
28
|
_context2.next = 1;
|
|
25
29
|
break;
|
|
@@ -56,7 +60,7 @@ function _getFormPrintTemplates() {
|
|
|
56
60
|
}));
|
|
57
61
|
return _getFormPrintTemplates.apply(this, arguments);
|
|
58
62
|
}
|
|
59
|
-
function print(
|
|
63
|
+
function print(_x3) {
|
|
60
64
|
return _print.apply(this, arguments);
|
|
61
65
|
}
|
|
62
66
|
function _print() {
|
|
@@ -109,7 +113,7 @@ function _print() {
|
|
|
109
113
|
}));
|
|
110
114
|
return _print.apply(this, arguments);
|
|
111
115
|
}
|
|
112
|
-
function openPrint(
|
|
116
|
+
function openPrint(_x4, _x5) {
|
|
113
117
|
return _openPrint.apply(this, arguments);
|
|
114
118
|
}
|
|
115
119
|
function _openPrint() {
|
|
@@ -204,7 +208,7 @@ function _openPrint() {
|
|
|
204
208
|
}
|
|
205
209
|
}, _callee5);
|
|
206
210
|
}));
|
|
207
|
-
return function (
|
|
211
|
+
return function (_x7, _x8) {
|
|
208
212
|
return _ref.apply(this, arguments);
|
|
209
213
|
};
|
|
210
214
|
}()));
|
|
@@ -274,7 +278,9 @@ var CloudPrinter = /*#__PURE__*/function () {
|
|
|
274
278
|
});
|
|
275
279
|
case 3:
|
|
276
280
|
res = _context.sent;
|
|
277
|
-
if (
|
|
281
|
+
if (res.success) {
|
|
282
|
+
_message2["default"].success(res.message);
|
|
283
|
+
} else {
|
|
278
284
|
_message2["default"].error(res.message);
|
|
279
285
|
}
|
|
280
286
|
case 4:
|
|
@@ -283,7 +289,7 @@ var CloudPrinter = /*#__PURE__*/function () {
|
|
|
283
289
|
}
|
|
284
290
|
}, _callee, this);
|
|
285
291
|
}));
|
|
286
|
-
function post(
|
|
292
|
+
function post(_x6) {
|
|
287
293
|
return _post.apply(this, arguments);
|
|
288
294
|
}
|
|
289
295
|
return post;
|