@zhubangyun/lowcode-core 5.12.161 → 6.2.30
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/load-materials/index.js +38 -22
- package/es/components/page-loading/index.js +4 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +19 -2
- package/es/index.less +21 -0
- package/es/init/init.bar-height.d.ts +1 -0
- package/es/init/init.bar-height.js +37 -0
- package/es/init/init.mobile-class.d.ts +1 -0
- package/es/init/init.mobile-class.js +10 -0
- package/es/init/init.scroll-size.d.ts +5 -0
- package/es/init/init.scroll-size.js +26 -0
- package/es/style.js +3 -3
- package/es/utils/api/form-api.d.ts +2 -0
- package/es/utils/api/form-api.js +155 -34
- package/es/utils/api/index.d.ts +1 -1
- package/es/utils/api/index.js +4 -2
- package/es/utils/api/rest-api.d.ts +3 -1
- package/es/utils/api/rest-api.js +105 -23
- package/es/utils/api/schema.util.d.ts +3 -3
- package/es/utils/api/schema.util.js +17 -12
- package/es/utils/cache/index.js +57 -17
- package/es/utils/common/index.d.ts +3 -0
- package/es/utils/common/index.js +17 -3
- package/es/utils/page/index.js +10 -6
- package/es/utils/page/page-form-data-manager-group.js +10 -10
- package/es/utils/page/page-form-data-manager.d.ts +1 -0
- package/es/utils/page/page-form-data-manager.js +10 -10
- package/es/utils/page/page-form-group.d.ts +1 -0
- package/es/utils/page/page-form-group.js +2 -2
- package/es/utils/page/page-form.d.ts +1 -0
- package/es/utils/page/page-form.js +12 -4
- package/es/utils/page/page-layout.d.ts +3 -1
- package/es/utils/page/page-layout.js +44 -7
- package/es/utils/page/page-load-schema.js +20 -28
- package/es/utils/page/page-render.js +4 -5
- package/es/utils/page/page-show.d.ts +2 -0
- package/es/utils/page/page-show.js +9 -4
- package/es/utils/page/print-form.d.ts +3 -2
- package/es/utils/page/print-form.js +200 -61
- package/es/utils/uni-bridge.d.ts +20 -0
- package/es/utils/uni-bridge.js +172 -0
- package/es/utils/util.common.d.ts +1 -0
- package/es/utils/util.common.js +4 -0
- package/es/utils/utils.scrollbar-size.js +0 -0
- package/lib/components/load-materials/index.js +38 -22
- package/lib/components/page-loading/index.js +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +22 -4
- package/lib/index.less +21 -0
- package/lib/init/init.bar-height.d.ts +1 -0
- package/lib/init/init.bar-height.js +42 -0
- package/lib/init/init.mobile-class.d.ts +1 -0
- package/lib/init/init.mobile-class.js +14 -0
- package/lib/init/init.scroll-size.d.ts +5 -0
- package/lib/init/init.scroll-size.js +31 -0
- package/lib/style.js +3 -3
- package/lib/utils/api/form-api.d.ts +2 -0
- package/lib/utils/api/form-api.js +155 -34
- package/lib/utils/api/index.d.ts +1 -1
- package/lib/utils/api/index.js +4 -2
- package/lib/utils/api/rest-api.d.ts +3 -1
- package/lib/utils/api/rest-api.js +105 -23
- package/lib/utils/api/schema.util.d.ts +3 -3
- package/lib/utils/api/schema.util.js +19 -13
- package/lib/utils/cache/index.js +56 -16
- package/lib/utils/common/index.d.ts +3 -0
- package/lib/utils/common/index.js +19 -2
- package/lib/utils/page/index.js +10 -6
- package/lib/utils/page/page-form-data-manager-group.js +10 -10
- package/lib/utils/page/page-form-data-manager.d.ts +1 -0
- package/lib/utils/page/page-form-data-manager.js +10 -10
- package/lib/utils/page/page-form-group.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +2 -2
- package/lib/utils/page/page-form.d.ts +1 -0
- package/lib/utils/page/page-form.js +12 -4
- package/lib/utils/page/page-layout.d.ts +3 -1
- package/lib/utils/page/page-layout.js +44 -7
- package/lib/utils/page/page-load-schema.js +19 -27
- package/lib/utils/page/page-render.js +4 -5
- package/lib/utils/page/page-show.d.ts +2 -0
- package/lib/utils/page/page-show.js +9 -4
- package/lib/utils/page/print-form.d.ts +3 -2
- package/lib/utils/page/print-form.js +200 -61
- package/lib/utils/uni-bridge.d.ts +20 -0
- package/lib/utils/uni-bridge.js +177 -0
- package/lib/utils/util.common.d.ts +1 -0
- package/lib/utils/util.common.js +8 -0
- package/lib/utils/utils.scrollbar-size.js +1 -0
- package/package.json +2 -2
|
@@ -12,14 +12,15 @@ var _restApi = require("./rest-api");
|
|
|
12
12
|
var _formApi = require("./form-api.utils");
|
|
13
13
|
var _cache = require("../cache");
|
|
14
14
|
var _schemaApi = require("./schema-api");
|
|
15
|
+
var _common = require("../common");
|
|
15
16
|
function getFormApi(_x, _x2, _x3) {
|
|
16
17
|
return _getFormApi.apply(this, arguments);
|
|
17
18
|
}
|
|
18
19
|
function _getFormApi() {
|
|
19
|
-
_getFormApi = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
20
|
+
_getFormApi = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(formId, fieldId, mock) {
|
|
20
21
|
var key;
|
|
21
|
-
return _regenerator["default"].wrap(function (
|
|
22
|
-
while (1) switch (
|
|
22
|
+
return _regenerator["default"].wrap(function (_context1) {
|
|
23
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
23
24
|
case 0:
|
|
24
25
|
if (typeof mock != "boolean") {
|
|
25
26
|
if (typeof window.__mock == "boolean") {
|
|
@@ -29,16 +30,16 @@ function _getFormApi() {
|
|
|
29
30
|
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
30
31
|
return !!key;
|
|
31
32
|
}).join("_");
|
|
32
|
-
return
|
|
33
|
+
return _context1.abrupt("return", _cache.formApi.getInstance(key, {
|
|
33
34
|
mock: mock,
|
|
34
35
|
fieldId: fieldId,
|
|
35
36
|
formId: formId
|
|
36
37
|
}));
|
|
37
38
|
case 1:
|
|
38
39
|
case "end":
|
|
39
|
-
return
|
|
40
|
+
return _context1.stop();
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
+
}, _callee1);
|
|
42
43
|
}));
|
|
43
44
|
return _getFormApi.apply(this, arguments);
|
|
44
45
|
}
|
|
@@ -189,84 +190,204 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
189
190
|
}();
|
|
190
191
|
_proto.getById = /*#__PURE__*/function () {
|
|
191
192
|
var _getById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(id, options) {
|
|
192
|
-
var res;
|
|
193
|
+
var searchId, url, res, _t;
|
|
193
194
|
return _regenerator["default"].wrap(function (_context4) {
|
|
194
195
|
while (1) switch (_context4.prev = _context4.next) {
|
|
195
196
|
case 0:
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
if (id) {
|
|
198
|
+
_context4.next = 1;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
return _context4.abrupt("return", {
|
|
202
|
+
success: false,
|
|
203
|
+
message: "数据Id不可为空!"
|
|
204
|
+
});
|
|
198
205
|
case 1:
|
|
206
|
+
searchId = id;
|
|
207
|
+
if (!id.startsWith("http")) {
|
|
208
|
+
_context4.next = 2;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
url = new URL(searchId);
|
|
212
|
+
searchId = url.searchParams.get("dataId");
|
|
213
|
+
if (searchId) {
|
|
214
|
+
_context4.next = 2;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
return _context4.abrupt("return", {
|
|
218
|
+
success: false,
|
|
219
|
+
message: "数据Id不可为空!"
|
|
220
|
+
});
|
|
221
|
+
case 2:
|
|
222
|
+
_context4.prev = 2;
|
|
223
|
+
(0, _common.uuidVersion)(searchId);
|
|
224
|
+
_context4.next = 4;
|
|
225
|
+
break;
|
|
226
|
+
case 3:
|
|
227
|
+
_context4.prev = 3;
|
|
228
|
+
_t = _context4["catch"](2);
|
|
229
|
+
return _context4.abrupt("return", {
|
|
230
|
+
success: false,
|
|
231
|
+
message: "\u975E\u6CD5\u7684\u6570\u636EID:" + searchId
|
|
232
|
+
});
|
|
233
|
+
case 4:
|
|
234
|
+
_context4.next = 5;
|
|
235
|
+
return _RestApi.prototype.getById.call(this, searchId, options);
|
|
236
|
+
case 5:
|
|
199
237
|
res = _context4.sent;
|
|
200
238
|
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
201
239
|
console.debug("formApi.getById", res);
|
|
202
240
|
return _context4.abrupt("return", res);
|
|
203
|
-
case
|
|
241
|
+
case 6:
|
|
204
242
|
case "end":
|
|
205
243
|
return _context4.stop();
|
|
206
244
|
}
|
|
207
|
-
}, _callee4, this);
|
|
245
|
+
}, _callee4, this, [[2, 3]]);
|
|
208
246
|
}));
|
|
209
247
|
function getById(_x6, _x7) {
|
|
210
248
|
return _getById.apply(this, arguments);
|
|
211
249
|
}
|
|
212
250
|
return getById;
|
|
213
251
|
}();
|
|
214
|
-
_proto.
|
|
215
|
-
var
|
|
252
|
+
_proto.labelToValue = /*#__PURE__*/function () {
|
|
253
|
+
var _labelToValue = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
|
|
254
|
+
var _this3 = this;
|
|
255
|
+
var config, res;
|
|
216
256
|
return _regenerator["default"].wrap(function (_context5) {
|
|
217
257
|
while (1) switch (_context5.prev = _context5.next) {
|
|
218
258
|
case 0:
|
|
219
|
-
|
|
259
|
+
config = {};
|
|
260
|
+
_context5.next = 1;
|
|
261
|
+
return this.handleRequestConfig(config);
|
|
220
262
|
case 1:
|
|
263
|
+
_context5.next = 2;
|
|
264
|
+
return this.request.post("labelToValue", data, config);
|
|
265
|
+
case 2:
|
|
266
|
+
res = _context5.sent;
|
|
267
|
+
if (Array.isArray(res.data)) {
|
|
268
|
+
res.data.forEach(function (item) {
|
|
269
|
+
item.id = (0, _common.uuid)();
|
|
270
|
+
item.form = {
|
|
271
|
+
id: _this3.formId,
|
|
272
|
+
fieldId: _this3.fieldId
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
277
|
+
console.debug("formApi.labelToValue", res);
|
|
278
|
+
return _context5.abrupt("return", res);
|
|
279
|
+
case 3:
|
|
221
280
|
case "end":
|
|
222
281
|
return _context5.stop();
|
|
223
282
|
}
|
|
224
283
|
}, _callee5, this);
|
|
225
284
|
}));
|
|
226
|
-
function
|
|
227
|
-
return
|
|
285
|
+
function labelToValue(_x8, _x9) {
|
|
286
|
+
return _labelToValue.apply(this, arguments);
|
|
228
287
|
}
|
|
229
|
-
return
|
|
288
|
+
return labelToValue;
|
|
230
289
|
}();
|
|
231
|
-
_proto.
|
|
232
|
-
var
|
|
290
|
+
_proto.save = /*#__PURE__*/function () {
|
|
291
|
+
var _save = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(data, options) {
|
|
233
292
|
return _regenerator["default"].wrap(function (_context6) {
|
|
234
293
|
while (1) switch (_context6.prev = _context6.next) {
|
|
235
294
|
case 0:
|
|
236
|
-
return _context6.abrupt("return", _RestApi.prototype.
|
|
295
|
+
return _context6.abrupt("return", _RestApi.prototype.save.call(this, (0, _formApi.convertSaveData)(data), options));
|
|
237
296
|
case 1:
|
|
238
297
|
case "end":
|
|
239
298
|
return _context6.stop();
|
|
240
299
|
}
|
|
241
300
|
}, _callee6, this);
|
|
242
301
|
}));
|
|
243
|
-
function
|
|
244
|
-
return
|
|
302
|
+
function save(_x0, _x1) {
|
|
303
|
+
return _save.apply(this, arguments);
|
|
245
304
|
}
|
|
246
|
-
return
|
|
305
|
+
return save;
|
|
247
306
|
}();
|
|
248
|
-
_proto.
|
|
249
|
-
var
|
|
307
|
+
_proto.create = /*#__PURE__*/function () {
|
|
308
|
+
var _create = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(data, options) {
|
|
250
309
|
return _regenerator["default"].wrap(function (_context7) {
|
|
251
310
|
while (1) switch (_context7.prev = _context7.next) {
|
|
252
311
|
case 0:
|
|
253
|
-
return _context7.abrupt("return", _RestApi.prototype.
|
|
312
|
+
return _context7.abrupt("return", _RestApi.prototype.create.call(this, (0, _formApi.convertSaveData)(data), options));
|
|
254
313
|
case 1:
|
|
255
314
|
case "end":
|
|
256
315
|
return _context7.stop();
|
|
257
316
|
}
|
|
258
317
|
}, _callee7, this);
|
|
259
318
|
}));
|
|
260
|
-
function
|
|
319
|
+
function create(_x10, _x11) {
|
|
320
|
+
return _create.apply(this, arguments);
|
|
321
|
+
}
|
|
322
|
+
return create;
|
|
323
|
+
}();
|
|
324
|
+
_proto.update = /*#__PURE__*/function () {
|
|
325
|
+
var _update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(id, data, options) {
|
|
326
|
+
return _regenerator["default"].wrap(function (_context8) {
|
|
327
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
328
|
+
case 0:
|
|
329
|
+
return _context8.abrupt("return", _RestApi.prototype.update.call(this, id, (0, _formApi.convertSaveData)(data), options));
|
|
330
|
+
case 1:
|
|
331
|
+
case "end":
|
|
332
|
+
return _context8.stop();
|
|
333
|
+
}
|
|
334
|
+
}, _callee8, this);
|
|
335
|
+
}));
|
|
336
|
+
function update(_x12, _x13, _x14) {
|
|
261
337
|
return _update.apply(this, arguments);
|
|
262
338
|
}
|
|
263
339
|
return update;
|
|
264
340
|
}();
|
|
341
|
+
_proto.fieldFilters = /*#__PURE__*/function () {
|
|
342
|
+
var _fieldFilters = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(searchParams) {
|
|
343
|
+
var _searchParams3, _searchParams4;
|
|
344
|
+
var params, config, res;
|
|
345
|
+
return _regenerator["default"].wrap(function (_context9) {
|
|
346
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
347
|
+
case 0:
|
|
348
|
+
searchParams = searchParams || {};
|
|
349
|
+
params = {
|
|
350
|
+
formId: this.formId,
|
|
351
|
+
fieldId: this.fieldId
|
|
352
|
+
};
|
|
353
|
+
if (__mock) {
|
|
354
|
+
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
355
|
+
}
|
|
356
|
+
config = {
|
|
357
|
+
params: params
|
|
358
|
+
};
|
|
359
|
+
_context9.next = 1;
|
|
360
|
+
return this.handleRequestConfig(config);
|
|
361
|
+
case 1:
|
|
362
|
+
searchParams.filterRules = (0, _formApi.handleFilterRules)(((_searchParams3 = searchParams) === null || _searchParams3 === void 0 ? void 0 : _searchParams3.filterRules) || [], {
|
|
363
|
+
filterNullValue: false
|
|
364
|
+
});
|
|
365
|
+
searchParams.searchFields = (0, _formApi.handleFilterRules)(((_searchParams4 = searchParams) === null || _searchParams4 === void 0 ? void 0 : _searchParams4.searchFields) || [], {
|
|
366
|
+
filterNullValue: true
|
|
367
|
+
});
|
|
368
|
+
config.params = (0, _extends2["default"])({}, params, searchParams);
|
|
369
|
+
_context9.next = 2;
|
|
370
|
+
return this.request.get("fieldFilters", config);
|
|
371
|
+
case 2:
|
|
372
|
+
res = _context9.sent;
|
|
373
|
+
console.debug("form.fieldFilters:", res);
|
|
374
|
+
return _context9.abrupt("return", res);
|
|
375
|
+
case 3:
|
|
376
|
+
case "end":
|
|
377
|
+
return _context9.stop();
|
|
378
|
+
}
|
|
379
|
+
}, _callee9, this);
|
|
380
|
+
}));
|
|
381
|
+
function fieldFilters(_x15) {
|
|
382
|
+
return _fieldFilters.apply(this, arguments);
|
|
383
|
+
}
|
|
384
|
+
return fieldFilters;
|
|
385
|
+
}();
|
|
265
386
|
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
266
|
-
var _serviceUpdate = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
387
|
+
var _serviceUpdate = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(data, options) {
|
|
267
388
|
var params;
|
|
268
|
-
return _regenerator["default"].wrap(function (
|
|
269
|
-
while (1) switch (
|
|
389
|
+
return _regenerator["default"].wrap(function (_context0) {
|
|
390
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
270
391
|
case 0:
|
|
271
392
|
params = {
|
|
272
393
|
formId: this.formId,
|
|
@@ -276,16 +397,16 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
276
397
|
params.mock = true;
|
|
277
398
|
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
278
399
|
}
|
|
279
|
-
return
|
|
400
|
+
return _context0.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
280
401
|
params: params
|
|
281
402
|
}));
|
|
282
403
|
case 1:
|
|
283
404
|
case "end":
|
|
284
|
-
return
|
|
405
|
+
return _context0.stop();
|
|
285
406
|
}
|
|
286
|
-
},
|
|
407
|
+
}, _callee0, this);
|
|
287
408
|
}));
|
|
288
|
-
function serviceUpdate(
|
|
409
|
+
function serviceUpdate(_x16, _x17) {
|
|
289
410
|
return _serviceUpdate.apply(this, arguments);
|
|
290
411
|
}
|
|
291
412
|
return serviceUpdate;
|
package/lib/utils/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
1
2
|
export { RestApi } from "./rest-api";
|
|
2
3
|
export { getFormApi, RestFormApi } from "./form-api";
|
|
3
|
-
import { AxiosResponse } from "axios/index";
|
|
4
4
|
export { getSchema } from "./schema-api";
|
|
5
5
|
export { getUserinfo } from "./user-info";
|
|
6
6
|
export * as files from "./file-api";
|
package/lib/utils/api/index.js
CHANGED
|
@@ -45,12 +45,14 @@ function onFulfilled(res) {
|
|
|
45
45
|
function onRejected(error) {
|
|
46
46
|
var _error$response = error.response,
|
|
47
47
|
status = _error$response.status,
|
|
48
|
-
statusText = _error$response.statusText
|
|
48
|
+
statusText = _error$response.statusText,
|
|
49
|
+
data = _error$response.data;
|
|
50
|
+
console.error("请求失败!", error);
|
|
49
51
|
if (status == 400) {
|
|
50
52
|
return error.response.data || {};
|
|
51
53
|
}
|
|
52
54
|
return {
|
|
53
55
|
success: false,
|
|
54
|
-
message: statusText
|
|
56
|
+
message: (data === null || data === void 0 ? void 0 : data.message) || statusText
|
|
55
57
|
};
|
|
56
58
|
}
|
|
@@ -36,7 +36,7 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
36
36
|
title: string;
|
|
37
37
|
request: AxiosInstance;
|
|
38
38
|
protected constructor(uri: string, options?: RestApiOptions);
|
|
39
|
-
abstract handleRequestConfig(config: AxiosRequestConfig): void
|
|
39
|
+
abstract handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
|
|
40
40
|
search(params?: RestSearchParams): Promise<ManyResult<DataType>>;
|
|
41
41
|
/**
|
|
42
42
|
* 通过id获取
|
|
@@ -58,6 +58,8 @@ export declare abstract class BaseRestApi<DataType> {
|
|
|
58
58
|
*/
|
|
59
59
|
deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
60
60
|
delete(data: any | any[], options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
61
|
+
export(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
62
|
+
import(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
61
63
|
showError(type: string, res: BaseResult<any>): Promise<void>;
|
|
62
64
|
}
|
|
63
65
|
export declare class RestApi<DataType> extends BaseRestApi<DataType> {
|
|
@@ -350,16 +350,98 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
350
350
|
}
|
|
351
351
|
return _delete;
|
|
352
352
|
}();
|
|
353
|
-
_proto
|
|
354
|
-
var
|
|
355
|
-
var
|
|
353
|
+
_proto["export"] = /*#__PURE__*/function () {
|
|
354
|
+
var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(data, options) {
|
|
355
|
+
var _this$handleRequestCo8;
|
|
356
|
+
var config, res, _options$onError7, _options$onSuccess7;
|
|
356
357
|
return _regenerator["default"].wrap(function (_context8) {
|
|
357
358
|
while (1) switch (_context8.prev = _context8.next) {
|
|
359
|
+
case 0:
|
|
360
|
+
config = {};
|
|
361
|
+
_context8.next = 1;
|
|
362
|
+
return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
|
|
363
|
+
case 1:
|
|
364
|
+
_context8.next = 2;
|
|
365
|
+
return this.request.post("/export", data, config);
|
|
366
|
+
case 2:
|
|
367
|
+
res = _context8.sent;
|
|
368
|
+
if (res.success) {
|
|
369
|
+
_context8.next = 4;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
|
|
373
|
+
_context8.next = 3;
|
|
374
|
+
return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
|
|
375
|
+
case 3:
|
|
376
|
+
_context8.next = 5;
|
|
377
|
+
break;
|
|
378
|
+
case 4:
|
|
379
|
+
_context8.next = 5;
|
|
380
|
+
return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
|
|
381
|
+
case 5:
|
|
382
|
+
return _context8.abrupt("return", res);
|
|
383
|
+
case 6:
|
|
384
|
+
case "end":
|
|
385
|
+
return _context8.stop();
|
|
386
|
+
}
|
|
387
|
+
}, _callee8, this);
|
|
388
|
+
}));
|
|
389
|
+
function _export(_x13, _x14) {
|
|
390
|
+
return _export2.apply(this, arguments);
|
|
391
|
+
}
|
|
392
|
+
return _export;
|
|
393
|
+
}();
|
|
394
|
+
_proto["import"] = /*#__PURE__*/function () {
|
|
395
|
+
var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(data, options) {
|
|
396
|
+
var _this$handleRequestCo9;
|
|
397
|
+
var config, res, _options$onError8, _options$onSuccess8;
|
|
398
|
+
return _regenerator["default"].wrap(function (_context9) {
|
|
399
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
400
|
+
case 0:
|
|
401
|
+
config = {};
|
|
402
|
+
_context9.next = 1;
|
|
403
|
+
return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
|
|
404
|
+
case 1:
|
|
405
|
+
_context9.next = 2;
|
|
406
|
+
return this.request.post("import", data, config);
|
|
407
|
+
case 2:
|
|
408
|
+
res = _context9.sent;
|
|
409
|
+
if (res.success) {
|
|
410
|
+
_context9.next = 4;
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
|
|
414
|
+
_context9.next = 3;
|
|
415
|
+
return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
|
|
416
|
+
case 3:
|
|
417
|
+
_context9.next = 5;
|
|
418
|
+
break;
|
|
419
|
+
case 4:
|
|
420
|
+
_context9.next = 5;
|
|
421
|
+
return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
|
|
422
|
+
case 5:
|
|
423
|
+
return _context9.abrupt("return", res);
|
|
424
|
+
case 6:
|
|
425
|
+
case "end":
|
|
426
|
+
return _context9.stop();
|
|
427
|
+
}
|
|
428
|
+
}, _callee9, this);
|
|
429
|
+
}));
|
|
430
|
+
function _import(_x15, _x16) {
|
|
431
|
+
return _import2.apply(this, arguments);
|
|
432
|
+
}
|
|
433
|
+
return _import;
|
|
434
|
+
}();
|
|
435
|
+
_proto.showError = /*#__PURE__*/function () {
|
|
436
|
+
var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(type, res) {
|
|
437
|
+
var msg, props, _t;
|
|
438
|
+
return _regenerator["default"].wrap(function (_context0) {
|
|
439
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
358
440
|
case 0:
|
|
359
441
|
msg = res.message;
|
|
360
|
-
|
|
442
|
+
_context0.prev = 1;
|
|
361
443
|
if (!msg) {
|
|
362
|
-
|
|
444
|
+
_context0.next = 4;
|
|
363
445
|
break;
|
|
364
446
|
}
|
|
365
447
|
props = JSON.parse(msg);
|
|
@@ -368,31 +450,31 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
368
450
|
props.title = "" + this.title + type;
|
|
369
451
|
}
|
|
370
452
|
if (!(props.type == "message")) {
|
|
371
|
-
|
|
453
|
+
_context0.next = 2;
|
|
372
454
|
break;
|
|
373
455
|
}
|
|
374
456
|
_message2["default"].error(props);
|
|
375
|
-
return
|
|
457
|
+
return _context0.abrupt("return");
|
|
376
458
|
case 2:
|
|
377
459
|
if (!(props.type == "modal")) {
|
|
378
|
-
|
|
460
|
+
_context0.next = 3;
|
|
379
461
|
break;
|
|
380
462
|
}
|
|
381
463
|
_modal["default"].error(props);
|
|
382
|
-
return
|
|
464
|
+
return _context0.abrupt("return");
|
|
383
465
|
case 3:
|
|
384
466
|
if (!(props.type == "notification")) {
|
|
385
|
-
|
|
467
|
+
_context0.next = 4;
|
|
386
468
|
break;
|
|
387
469
|
}
|
|
388
470
|
_notification2["default"].error(props);
|
|
389
|
-
return
|
|
471
|
+
return _context0.abrupt("return");
|
|
390
472
|
case 4:
|
|
391
|
-
|
|
473
|
+
_context0.next = 6;
|
|
392
474
|
break;
|
|
393
475
|
case 5:
|
|
394
|
-
|
|
395
|
-
_t =
|
|
476
|
+
_context0.prev = 5;
|
|
477
|
+
_t = _context0["catch"](1);
|
|
396
478
|
console.error("" + this.title + type + (msg || ""));
|
|
397
479
|
_modal["default"].error({
|
|
398
480
|
title: "" + this.title + type,
|
|
@@ -404,11 +486,11 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
|
|
|
404
486
|
});
|
|
405
487
|
case 6:
|
|
406
488
|
case "end":
|
|
407
|
-
return
|
|
489
|
+
return _context0.stop();
|
|
408
490
|
}
|
|
409
|
-
},
|
|
491
|
+
}, _callee0, this, [[1, 5]]);
|
|
410
492
|
}));
|
|
411
|
-
function showError(
|
|
493
|
+
function showError(_x17, _x18) {
|
|
412
494
|
return _showError.apply(this, arguments);
|
|
413
495
|
}
|
|
414
496
|
return showError;
|
|
@@ -430,16 +512,16 @@ var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
|
|
|
430
512
|
(0, _inheritsLoose2["default"])(RestApi, _BaseRestApi2);
|
|
431
513
|
var _proto2 = RestApi.prototype;
|
|
432
514
|
_proto2.handleRequestConfig = /*#__PURE__*/function () {
|
|
433
|
-
var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
434
|
-
return _regenerator["default"].wrap(function (
|
|
435
|
-
while (1) switch (
|
|
515
|
+
var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(config) {
|
|
516
|
+
return _regenerator["default"].wrap(function (_context1) {
|
|
517
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
436
518
|
case 0:
|
|
437
519
|
case "end":
|
|
438
|
-
return
|
|
520
|
+
return _context1.stop();
|
|
439
521
|
}
|
|
440
|
-
},
|
|
522
|
+
}, _callee1);
|
|
441
523
|
}));
|
|
442
|
-
function handleRequestConfig(
|
|
524
|
+
function handleRequestConfig(_x19) {
|
|
443
525
|
return _handleRequestConfig.apply(this, arguments);
|
|
444
526
|
}
|
|
445
527
|
return handleRequestConfig;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @param callback 返回true 继续往下遍历
|
|
5
5
|
*/
|
|
6
6
|
export declare function forEachSchema(schema: Schema, callback: (child: Schema, index: number, children: any[]) => boolean): void;
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
7
|
+
export declare function findFormSchemas(schema: Schema): Schema[];
|
|
8
|
+
export declare function findFdmSchemas(schema?: Schema): Schema[];
|
|
9
|
+
export interface Schema {
|
|
9
10
|
componentName: string;
|
|
10
11
|
props: any;
|
|
11
12
|
children?: Schema[];
|
|
12
13
|
fdmSchema?: Schema;
|
|
13
14
|
}
|
|
14
|
-
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.findFdmSchemas = findFdmSchemas;
|
|
5
|
+
exports.findFormSchemas = findFormSchemas;
|
|
5
6
|
exports.forEachSchema = forEachSchema;
|
|
6
7
|
/**
|
|
7
8
|
* 遍历schema
|
|
@@ -17,21 +18,26 @@ function forEachSchema(schema, callback) {
|
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function findFormSchemas(schema) {
|
|
22
|
+
var schemas = [];
|
|
21
23
|
forEachSchema(schema, function (child) {
|
|
22
24
|
if (["PageForm", "SubFormField"].includes(child.componentName)) {
|
|
23
|
-
|
|
24
|
-
if (fdm) {
|
|
25
|
-
if (child.fdmSchema) {
|
|
26
|
-
forEachSchema(child.fdmSchema, function (fdmChild) {
|
|
27
|
-
if (fdmChild.componentName == "PageFdm") {
|
|
28
|
-
callback(child);
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
25
|
+
schemas.push(child);
|
|
34
26
|
}
|
|
35
27
|
return true;
|
|
36
28
|
});
|
|
29
|
+
return schemas;
|
|
30
|
+
}
|
|
31
|
+
function findFdmSchemas(schema) {
|
|
32
|
+
var schemas = [];
|
|
33
|
+
if (!schema) {
|
|
34
|
+
return schemas;
|
|
35
|
+
}
|
|
36
|
+
forEachSchema(schema, function (child) {
|
|
37
|
+
if (["PageFdm"].includes(child.componentName)) {
|
|
38
|
+
schemas.push(child);
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
return schemas;
|
|
37
43
|
}
|