@zhubangyun/lowcode-core 5.3.131 → 5.3.181
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.d.ts +5 -8
- package/es/components/react-render/index.js +12 -19
- package/es/components/react-render/react-render-factory.d.ts +3 -0
- package/es/components/react-render/react-render-factory.js +50 -0
- package/es/components/schema-render/components/schema-render-base.js +1 -1
- package/es/index.d.ts +2 -3
- package/es/index.js +2 -3
- package/es/utils/{common → api}/RestApi.d.ts +10 -8
- package/es/utils/{common → api}/RestApi.js +142 -85
- package/es/utils/api/index.d.ts +2 -0
- package/es/utils/api/index.js +49 -2
- package/es/utils/cache/index.d.ts +9 -0
- package/es/utils/cache/index.js +75 -0
- package/es/utils/common/SingletonInstanceMap.d.ts +7 -0
- package/es/utils/common/SingletonInstanceMap.js +73 -0
- package/es/utils/common/index.d.ts +0 -2
- package/es/utils/common/index.js +1 -30
- package/es/utils/{common/RestFormApi.d.ts → form/form.api.d.ts} +9 -4
- package/es/utils/{common/RestFormApi.js → form/form.api.js} +85 -36
- package/es/utils/form/form.handler.js +0 -0
- package/es/utils/form/form.instance.d.ts +26 -0
- package/es/utils/form/form.instance.js +100 -0
- package/es/utils/form/form.process.js +0 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +2 -0
- package/lib/components/react-render/index.d.ts +5 -8
- package/lib/components/react-render/index.js +12 -21
- package/lib/components/react-render/react-render-factory.d.ts +3 -0
- package/lib/components/react-render/react-render-factory.js +55 -0
- package/lib/components/schema-render/components/schema-render-base.js +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +4 -6
- package/lib/utils/{common → api}/RestApi.d.ts +10 -8
- package/lib/utils/{common → api}/RestApi.js +142 -85
- package/lib/utils/api/index.d.ts +2 -0
- package/lib/utils/api/index.js +51 -2
- package/lib/utils/cache/index.d.ts +9 -0
- package/lib/utils/cache/index.js +80 -0
- package/lib/utils/common/SingletonInstanceMap.d.ts +7 -0
- package/lib/utils/common/SingletonInstanceMap.js +78 -0
- package/lib/utils/common/index.d.ts +0 -2
- package/lib/utils/common/index.js +2 -32
- package/lib/utils/{common/RestFormApi.d.ts → form/form.api.d.ts} +9 -4
- package/lib/utils/{common/RestFormApi.js → form/form.api.js} +85 -36
- package/lib/utils/form/form.handler.js +1 -0
- package/lib/utils/form/form.instance.d.ts +26 -0
- package/lib/utils/form/form.instance.js +105 -0
- package/lib/utils/form/form.process.js +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/package.json +1 -1
- package/es/utils/common/ClientCache.d.ts +0 -36
- package/es/utils/common/ClientCache.js +0 -120
- package/lib/utils/common/ClientCache.d.ts +0 -36
- package/lib/utils/common/ClientCache.js +0 -125
- /package/es/utils/{common → api}/Request.d.ts +0 -0
- /package/es/utils/{common → api}/Request.js +0 -0
- /package/lib/utils/{common → api}/Request.d.ts +0 -0
- /package/lib/utils/{common → api}/Request.js +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
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 { SingletonInstanceMap } from "../common/SingletonInstanceMap";
|
|
5
|
+
import { request } from "../api";
|
|
6
|
+
import { RestFormApi } from "../form/form.api";
|
|
7
|
+
export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
|
|
8
|
+
function SchemaCache() {
|
|
9
|
+
return _SingletonInstanceMap.apply(this, arguments) || this;
|
|
10
|
+
}
|
|
11
|
+
_inheritsLoose(SchemaCache, _SingletonInstanceMap);
|
|
12
|
+
var _proto = SchemaCache.prototype;
|
|
13
|
+
_proto.createInstance = /*#__PURE__*/function () {
|
|
14
|
+
var _createInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key) {
|
|
15
|
+
var mock, pageId;
|
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
mock = key.endsWith("_mock");
|
|
20
|
+
pageId = key.replace("_mock", "");
|
|
21
|
+
_context.next = 4;
|
|
22
|
+
return request.get("pages/" + pageId + "/schema", {
|
|
23
|
+
params: {
|
|
24
|
+
mock: mock
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
case 4:
|
|
28
|
+
return _context.abrupt("return", _context.sent);
|
|
29
|
+
case 5:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
function createInstance(_x) {
|
|
36
|
+
return _createInstance.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
return createInstance;
|
|
39
|
+
}();
|
|
40
|
+
return SchemaCache;
|
|
41
|
+
}(SingletonInstanceMap);
|
|
42
|
+
export var schema = new SchemaCache();
|
|
43
|
+
export var FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
|
|
44
|
+
function FormApiCache() {
|
|
45
|
+
return _SingletonInstanceMap2.apply(this, arguments) || this;
|
|
46
|
+
}
|
|
47
|
+
_inheritsLoose(FormApiCache, _SingletonInstanceMap2);
|
|
48
|
+
var _proto2 = FormApiCache.prototype;
|
|
49
|
+
_proto2.createInstance = /*#__PURE__*/function () {
|
|
50
|
+
var _createInstance2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key) {
|
|
51
|
+
var mock, formId, formApi;
|
|
52
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
mock = key.endsWith("_mock");
|
|
56
|
+
formId = key.replace("_mock", "");
|
|
57
|
+
formApi = new RestFormApi(formId, mock);
|
|
58
|
+
_context2.next = 5;
|
|
59
|
+
return formApi.initialize();
|
|
60
|
+
case 5:
|
|
61
|
+
return _context2.abrupt("return", formApi);
|
|
62
|
+
case 6:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context2.stop();
|
|
65
|
+
}
|
|
66
|
+
}, _callee2);
|
|
67
|
+
}));
|
|
68
|
+
function createInstance(_x2) {
|
|
69
|
+
return _createInstance2.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
return createInstance;
|
|
72
|
+
}();
|
|
73
|
+
return FormApiCache;
|
|
74
|
+
}(SingletonInstanceMap);
|
|
75
|
+
export var formApi = new FormApiCache();
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export var SingletonInstanceMap = /*#__PURE__*/function () {
|
|
4
|
+
function SingletonInstanceMap() {
|
|
5
|
+
this.valueMap = new Map();
|
|
6
|
+
this.lockMap = new Map();
|
|
7
|
+
}
|
|
8
|
+
var _proto = SingletonInstanceMap.prototype;
|
|
9
|
+
_proto.getInstance = /*#__PURE__*/function () {
|
|
10
|
+
var _getInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key) {
|
|
11
|
+
var self, value;
|
|
12
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
13
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
self = this;
|
|
16
|
+
if (!this.valueMap.has(key)) {
|
|
17
|
+
_context2.next = 5;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
return _context2.abrupt("return", Promise.resolve(this.valueMap.get(key)));
|
|
21
|
+
case 5:
|
|
22
|
+
if (!this.lockMap.get(key)) {
|
|
23
|
+
_context2.next = 9;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
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) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
resolve(self.getInstance(key));
|
|
32
|
+
case 1:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
})), 1000);
|
|
38
|
+
}));
|
|
39
|
+
case 9:
|
|
40
|
+
_context2.prev = 9;
|
|
41
|
+
this.lockMap.set(key, true);
|
|
42
|
+
_context2.next = 13;
|
|
43
|
+
return this.createInstance(key);
|
|
44
|
+
case 13:
|
|
45
|
+
value = _context2.sent;
|
|
46
|
+
this.valueMap.set(key, value);
|
|
47
|
+
this.lockMap.set(key, false);
|
|
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;
|
|
55
|
+
this.lockMap.set(key, false);
|
|
56
|
+
return _context2.finish(22);
|
|
57
|
+
case 25:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context2.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee2, this, [[9, 19, 22, 25]]);
|
|
62
|
+
}));
|
|
63
|
+
function getInstance(_x) {
|
|
64
|
+
return _getInstance.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
return getInstance;
|
|
67
|
+
}();
|
|
68
|
+
_proto.clear = function clear() {
|
|
69
|
+
this.lockMap.clear();
|
|
70
|
+
this.valueMap.clear();
|
|
71
|
+
};
|
|
72
|
+
return SingletonInstanceMap;
|
|
73
|
+
}();
|
package/es/utils/common/index.js
CHANGED
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
1
|
import { v4 } from "uuid";
|
|
4
|
-
import { ClientCache } from "./ClientCache";
|
|
5
|
-
import { request } from "../api";
|
|
6
2
|
export { loadPlugins } from "./LoadPlugins";
|
|
7
3
|
export function uuid(prefix, separator) {
|
|
8
4
|
return [prefix, separator, v4()].filter(function (v) {
|
|
9
5
|
return !!v;
|
|
10
6
|
}).join("");
|
|
11
|
-
}
|
|
12
|
-
export var schemaCache = new ClientCache({
|
|
13
|
-
name: "schema",
|
|
14
|
-
loadData: function () {
|
|
15
|
-
var _loadData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
16
|
-
var res;
|
|
17
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) switch (_context.prev = _context.next) {
|
|
19
|
-
case 0:
|
|
20
|
-
_context.next = 2;
|
|
21
|
-
return request.get("schemas/" + name + ".json");
|
|
22
|
-
case 2:
|
|
23
|
-
res = _context.sent;
|
|
24
|
-
return _context.abrupt("return", res.data);
|
|
25
|
-
case 4:
|
|
26
|
-
case "end":
|
|
27
|
-
return _context.stop();
|
|
28
|
-
}
|
|
29
|
-
}, _callee);
|
|
30
|
-
}));
|
|
31
|
-
function loadData(_x) {
|
|
32
|
-
return _loadData.apply(this, arguments);
|
|
33
|
-
}
|
|
34
|
-
return loadData;
|
|
35
|
-
}()
|
|
36
|
-
});
|
|
7
|
+
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { BaseRequestOptions, RestApi
|
|
1
|
+
import { BaseRequestOptions, RestApi } from "../api/RestApi";
|
|
2
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
3
|
export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
4
|
+
private readonly formId;
|
|
5
|
+
private readonly mock;
|
|
3
6
|
private initialized;
|
|
4
7
|
private schema;
|
|
5
|
-
constructor(
|
|
6
|
-
initialize(): Promise<
|
|
7
|
-
search(params?: Record<string, any>, page?: number, pageSize?: number): Promise<
|
|
8
|
+
constructor(formId: string, mock?: boolean);
|
|
9
|
+
initialize(): Promise<boolean>;
|
|
10
|
+
search(params?: Record<string, any>, page?: number, pageSize?: number): Promise<import("../api/RestApi").ManyResult<DataType>>;
|
|
8
11
|
getById(id: string, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
12
|
+
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
9
13
|
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
10
14
|
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
11
15
|
deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<any>;
|
|
16
|
+
handleRequestConfig(config: AxiosRequestConfig): void;
|
|
12
17
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import { RestApi } from "
|
|
4
|
+
import { RestApi } from "../api/RestApi";
|
|
5
|
+
import { getSchema } from "../api";
|
|
5
6
|
export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
6
|
-
function RestFormApi(
|
|
7
|
+
function RestFormApi(formId, mock) {
|
|
7
8
|
var _this;
|
|
8
|
-
_this = _RestApi.call(this, "forms
|
|
9
|
+
_this = _RestApi.call(this, "forms", {}) || this;
|
|
10
|
+
_this.formId = void 0;
|
|
11
|
+
_this.mock = void 0;
|
|
9
12
|
_this.initialized = false;
|
|
10
13
|
_this.schema = void 0;
|
|
14
|
+
_this.formId = formId;
|
|
15
|
+
_this.mock = !!mock;
|
|
11
16
|
return _this;
|
|
12
17
|
}
|
|
13
18
|
_inheritsLoose(RestFormApi, _RestApi);
|
|
@@ -17,28 +22,35 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
17
22
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18
23
|
while (1) switch (_context.prev = _context.next) {
|
|
19
24
|
case 0:
|
|
20
|
-
if (this.initialized) {
|
|
21
|
-
_context.next =
|
|
25
|
+
if (!this.initialized) {
|
|
26
|
+
_context.next = 4;
|
|
22
27
|
break;
|
|
23
28
|
}
|
|
24
|
-
_context.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
|
|
29
|
+
return _context.abrupt("return", true);
|
|
30
|
+
case 4:
|
|
31
|
+
_context.prev = 4;
|
|
32
|
+
_context.next = 7;
|
|
33
|
+
return getSchema(this.formId, this.mock);
|
|
34
|
+
case 7:
|
|
35
|
+
this.schema = _context.sent;
|
|
36
|
+
this.initialized = !!this.schema;
|
|
37
|
+
_context.next = 15;
|
|
30
38
|
break;
|
|
31
|
-
case
|
|
32
|
-
_context.prev =
|
|
33
|
-
_context.t0 = _context["catch"](
|
|
39
|
+
case 11:
|
|
40
|
+
_context.prev = 11;
|
|
41
|
+
_context.t0 = _context["catch"](4);
|
|
42
|
+
console.log("获取schema失败!", {
|
|
43
|
+
id: this.formId,
|
|
44
|
+
mock: this.mock
|
|
45
|
+
});
|
|
34
46
|
throw _context.t0;
|
|
35
|
-
case
|
|
47
|
+
case 15:
|
|
36
48
|
return _context.abrupt("return", this.initialized);
|
|
37
|
-
case
|
|
49
|
+
case 16:
|
|
38
50
|
case "end":
|
|
39
51
|
return _context.stop();
|
|
40
52
|
}
|
|
41
|
-
}, _callee, this, [[
|
|
53
|
+
}, _callee, this, [[4, 11]]);
|
|
42
54
|
}));
|
|
43
55
|
function initialize() {
|
|
44
56
|
return _initialize.apply(this, arguments);
|
|
@@ -94,65 +106,102 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
94
106
|
}
|
|
95
107
|
return getById;
|
|
96
108
|
}();
|
|
97
|
-
_proto.
|
|
98
|
-
var
|
|
109
|
+
_proto.save = /*#__PURE__*/function () {
|
|
110
|
+
var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
|
|
111
|
+
var config;
|
|
99
112
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
100
113
|
while (1) switch (_context4.prev = _context4.next) {
|
|
101
114
|
case 0:
|
|
102
115
|
_context4.next = 2;
|
|
103
116
|
return this.initialize();
|
|
104
117
|
case 2:
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
config = {};
|
|
119
|
+
this.handleRequestConfig(config);
|
|
120
|
+
return _context4.abrupt("return", _RestApi.prototype.save.call(this, data, options));
|
|
121
|
+
case 5:
|
|
107
122
|
case "end":
|
|
108
123
|
return _context4.stop();
|
|
109
124
|
}
|
|
110
125
|
}, _callee4, this);
|
|
111
126
|
}));
|
|
112
|
-
function
|
|
113
|
-
return
|
|
127
|
+
function save(_x6, _x7) {
|
|
128
|
+
return _save.apply(this, arguments);
|
|
114
129
|
}
|
|
115
|
-
return
|
|
130
|
+
return save;
|
|
116
131
|
}();
|
|
117
|
-
_proto.
|
|
118
|
-
var
|
|
132
|
+
_proto.create = /*#__PURE__*/function () {
|
|
133
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, options) {
|
|
134
|
+
var config;
|
|
119
135
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
120
136
|
while (1) switch (_context5.prev = _context5.next) {
|
|
121
137
|
case 0:
|
|
122
138
|
_context5.next = 2;
|
|
123
139
|
return this.initialize();
|
|
124
140
|
case 2:
|
|
125
|
-
|
|
126
|
-
|
|
141
|
+
config = {};
|
|
142
|
+
this.handleRequestConfig(config);
|
|
143
|
+
return _context5.abrupt("return", _RestApi.prototype.create.call(this, data, options));
|
|
144
|
+
case 5:
|
|
127
145
|
case "end":
|
|
128
146
|
return _context5.stop();
|
|
129
147
|
}
|
|
130
148
|
}, _callee5, this);
|
|
131
149
|
}));
|
|
132
|
-
function
|
|
133
|
-
return
|
|
150
|
+
function create(_x8, _x9) {
|
|
151
|
+
return _create.apply(this, arguments);
|
|
134
152
|
}
|
|
135
|
-
return
|
|
153
|
+
return create;
|
|
136
154
|
}();
|
|
137
|
-
_proto.
|
|
138
|
-
var
|
|
155
|
+
_proto.update = /*#__PURE__*/function () {
|
|
156
|
+
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, data, options) {
|
|
157
|
+
var config;
|
|
139
158
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
140
159
|
while (1) switch (_context6.prev = _context6.next) {
|
|
141
160
|
case 0:
|
|
142
161
|
_context6.next = 2;
|
|
143
162
|
return this.initialize();
|
|
144
163
|
case 2:
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
config = {};
|
|
165
|
+
this.handleRequestConfig(config);
|
|
166
|
+
return _context6.abrupt("return", _RestApi.prototype.update.call(this, id, data, options));
|
|
167
|
+
case 5:
|
|
147
168
|
case "end":
|
|
148
169
|
return _context6.stop();
|
|
149
170
|
}
|
|
150
171
|
}, _callee6, this);
|
|
151
172
|
}));
|
|
152
|
-
function
|
|
173
|
+
function update(_x10, _x11, _x12) {
|
|
174
|
+
return _update.apply(this, arguments);
|
|
175
|
+
}
|
|
176
|
+
return update;
|
|
177
|
+
}();
|
|
178
|
+
_proto.deleteById = /*#__PURE__*/function () {
|
|
179
|
+
var _deleteById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, options) {
|
|
180
|
+
var config;
|
|
181
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
182
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
_context7.next = 2;
|
|
185
|
+
return this.initialize();
|
|
186
|
+
case 2:
|
|
187
|
+
config = {};
|
|
188
|
+
this.handleRequestConfig(config);
|
|
189
|
+
return _context7.abrupt("return", _RestApi.prototype.deleteById.call(this, id, options));
|
|
190
|
+
case 5:
|
|
191
|
+
case "end":
|
|
192
|
+
return _context7.stop();
|
|
193
|
+
}
|
|
194
|
+
}, _callee7, this);
|
|
195
|
+
}));
|
|
196
|
+
function deleteById(_x13, _x14) {
|
|
153
197
|
return _deleteById.apply(this, arguments);
|
|
154
198
|
}
|
|
155
199
|
return deleteById;
|
|
156
200
|
}();
|
|
201
|
+
_proto.handleRequestConfig = function handleRequestConfig(config) {
|
|
202
|
+
config.params = config.params || {};
|
|
203
|
+
config.params.formId = this.formId;
|
|
204
|
+
config.params.mock = this.mock;
|
|
205
|
+
};
|
|
157
206
|
return RestFormApi;
|
|
158
207
|
}(RestApi);
|
|
File without changes
|
|
@@ -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
|
+
}();
|
|
File without changes
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import * as cache from "./cache";
|
|
1
2
|
import * as common from "./common";
|
|
2
3
|
import * as api from "./api";
|
|
3
4
|
import * as designer from "./designer";
|
|
4
5
|
declare const _default: {
|
|
5
6
|
api: typeof api;
|
|
7
|
+
cache: typeof cache;
|
|
6
8
|
designer: typeof designer;
|
|
7
9
|
common: typeof common;
|
|
8
10
|
};
|
package/es/utils/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
components?: any;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
}> {
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import { IRendererProps } from "@zhubangyun/lowcode-render-core/lib/types";
|
|
3
|
+
export declare class ReactRender extends PureComponent<IRendererProps & {}> {
|
|
7
4
|
key: string;
|
|
8
|
-
|
|
9
|
-
render(): JSX.Element;
|
|
5
|
+
node: any;
|
|
6
|
+
render(): import("react").JSX.Element;
|
|
10
7
|
}
|
|
@@ -5,18 +5,10 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.ReactRender = void 0;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
8
|
-
var
|
|
9
|
-
var _lowcodeRenderCore = _interopRequireWildcard(require("@zhubangyun/lowcode-render-core"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _utils = _interopRequireDefault(require("../../utils"));
|
|
8
|
+
var _react = require("react");
|
|
12
9
|
var _lowcodeDatasourceFetchHandler = require("@alilc/lowcode-datasource-fetch-handler");
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
_lowcodeRenderCore.adapter.setConfigProvider(((_window$antd = window.antd) === null || _window$antd === void 0 ? void 0 : _window$antd.ConfigProvider) || _configProvider["default"]);
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
var LocalConfig = ((_window$antd2 = window.antd) === null || _window$antd2 === void 0 ? void 0 : _window$antd2.ConfigProvider) || _configProvider["default"];
|
|
10
|
+
var _reactRenderFactory = _interopRequireDefault(require("./react-render-factory"));
|
|
11
|
+
var _utils = _interopRequireDefault(require("../../utils"));
|
|
20
12
|
var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
21
13
|
function ReactRender() {
|
|
22
14
|
var _this;
|
|
@@ -25,25 +17,24 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
|
|
|
25
17
|
}
|
|
26
18
|
_this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
|
|
27
19
|
_this.key = Date.now().toString(36);
|
|
28
|
-
_this.
|
|
20
|
+
_this.node = void 0;
|
|
29
21
|
return _this;
|
|
30
22
|
}
|
|
31
23
|
(0, _inheritsLoose2["default"])(ReactRender, _PureComponent);
|
|
32
24
|
var _proto = ReactRender.prototype;
|
|
33
25
|
_proto.render = function render() {
|
|
34
26
|
var _this2 = this;
|
|
35
|
-
var
|
|
27
|
+
var components = this.props.components;
|
|
36
28
|
// @ts-ignore
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ref: function ref(
|
|
41
|
-
|
|
29
|
+
return /*#__PURE__*/React.createElement(_reactRenderFactory["default"], (0, _extends2["default"])({
|
|
30
|
+
key: this.key
|
|
31
|
+
}, this.props, {
|
|
32
|
+
ref: function ref(node) {
|
|
33
|
+
console.log(node);
|
|
34
|
+
_this2.node = node === null || node === void 0 ? void 0 : node.__ref;
|
|
42
35
|
},
|
|
43
|
-
schema: this.props.schema,
|
|
44
36
|
thisRequiredInJSE: true,
|
|
45
|
-
|
|
46
|
-
components: components,
|
|
37
|
+
components: components || window.components || {},
|
|
47
38
|
appHelper: {
|
|
48
39
|
utils: _utils["default"],
|
|
49
40
|
requestHandlersMap: {
|