@zhubangyun/lowcode-core 6.3.25 → 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.
Files changed (59) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.js +5 -5
  3. package/es/index.less +0 -1
  4. package/es/utils/api/form-api/form-api.utils.js +4 -0
  5. package/es/utils/api/form-api.d.ts +0 -1
  6. package/es/utils/api/form-api.js +4 -37
  7. package/es/utils/api/rest-api.d.ts +1 -0
  8. package/es/utils/api/rest-api.js +125 -108
  9. package/es/utils/api/script-api.d.ts +1 -1
  10. package/es/utils/cache/cache.load-data.d.ts +1 -0
  11. package/es/utils/cache/cache.load-data.js +41 -0
  12. package/es/utils/cache/cache.page-permission.d.ts +1 -0
  13. package/es/utils/cache/cache.page-permission.js +28 -0
  14. package/es/utils/cache/cache.page-print.d.ts +1 -0
  15. package/es/utils/cache/cache.page-print.js +25 -0
  16. package/es/utils/cache/cache.page-schema.d.ts +1 -0
  17. package/es/utils/cache/cache.page-schema.js +96 -0
  18. package/es/utils/cache/cache.print.js +0 -0
  19. package/es/utils/cache/index.d.ts +5 -6
  20. package/es/utils/cache/index.js +19 -32
  21. package/es/utils/cache/index_db_cache.d.ts +11 -6
  22. package/es/utils/cache/index_db_cache.js +57 -5
  23. package/es/utils/page/index.js +1 -1
  24. package/es/utils/page/page-form-data-manager.d.ts +2 -1
  25. package/es/utils/page/page-layout.d.ts +1 -1
  26. package/es/utils/page/page-load-schema.js +33 -15
  27. package/es/utils/page/page-render.js +5 -1
  28. package/es/utils/page/page-schema-utils.js +1 -1
  29. package/es/utils/page/print-form.js +2 -4
  30. package/lib/index.d.ts +1 -1
  31. package/lib/index.js +6 -6
  32. package/lib/index.less +0 -1
  33. package/lib/utils/api/form-api/form-api.utils.js +4 -0
  34. package/lib/utils/api/form-api.d.ts +0 -1
  35. package/lib/utils/api/form-api.js +4 -37
  36. package/lib/utils/api/rest-api.d.ts +1 -0
  37. package/lib/utils/api/rest-api.js +125 -108
  38. package/lib/utils/api/script-api.d.ts +1 -1
  39. package/lib/utils/cache/cache.load-data.d.ts +1 -0
  40. package/lib/utils/cache/cache.load-data.js +44 -0
  41. package/lib/utils/cache/cache.page-permission.d.ts +1 -0
  42. package/lib/utils/cache/cache.page-permission.js +33 -0
  43. package/lib/utils/cache/cache.page-print.d.ts +1 -0
  44. package/lib/utils/cache/cache.page-print.js +30 -0
  45. package/lib/utils/cache/cache.page-schema.d.ts +1 -0
  46. package/lib/utils/cache/cache.page-schema.js +101 -0
  47. package/lib/utils/cache/cache.print.js +1 -0
  48. package/lib/utils/cache/index.d.ts +5 -6
  49. package/lib/utils/cache/index.js +23 -35
  50. package/lib/utils/cache/index_db_cache.d.ts +11 -6
  51. package/lib/utils/cache/index_db_cache.js +61 -6
  52. package/lib/utils/page/index.js +1 -1
  53. package/lib/utils/page/page-form-data-manager.d.ts +2 -1
  54. package/lib/utils/page/page-layout.d.ts +1 -1
  55. package/lib/utils/page/page-load-schema.js +32 -14
  56. package/lib/utils/page/page-render.js +5 -1
  57. package/lib/utils/page/page-schema-utils.js +1 -1
  58. package/lib/utils/page/print-form.js +2 -4
  59. package/package.json +1 -1
@@ -10,7 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _restApi = require("./rest-api");
11
11
  var _formApi = require("./form-api/form-api.utils");
12
12
  var _cache = require("../cache");
13
- var _schemaApi = require("./schema-api");
14
13
  var _common = require("../common");
15
14
  function getFormApi(_x, _x2, _x3) {
16
15
  return _getFormApi.apply(this, arguments);
@@ -52,7 +51,6 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
52
51
  _this.fieldId = void 0;
53
52
  _this.mock = void 0;
54
53
  _this.initialized = false;
55
- _this.schema = void 0;
56
54
  _this.formId = formId;
57
55
  _this.fieldId = fieldId;
58
56
  _this.mock = !!mock;
@@ -62,41 +60,10 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
62
60
  var _proto = RestFormApi.prototype;
63
61
  _proto.initialize = /*#__PURE__*/function () {
64
62
  var _initialize = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
65
- var _this2 = this;
66
- var res, _this$schema, _this$schema$children, _this$schema$children2;
67
63
  return _regenerator["default"].wrap(function (_context) {
68
64
  while (1) switch (_context.prev = _context.next) {
69
65
  case 0:
70
- if (!this.initialized) {
71
- try {
72
- res = (0, _schemaApi.getSchemaFromCache)(this.formId, this.mock);
73
- this.schema = res === null || res === void 0 ? void 0 : res.data;
74
- this.initialized = !!this.schema;
75
- if (this.initialized) {
76
- 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;
77
- if (this.fieldId) {
78
- JSON.stringify(this.schema, function (key, value) {
79
- var _value$props;
80
- if (key == "fdmSchema") {
81
- return undefined;
82
- }
83
- if ((value === null || value === void 0 ? void 0 : (_value$props = value.props) === null || _value$props === void 0 ? void 0 : _value$props.fieldId) === _this2.fieldId) {
84
- if (value.props.label) {
85
- _this2.title += "." + value.props.label;
86
- }
87
- }
88
- return value;
89
- });
90
- }
91
- }
92
- } catch (e) {
93
- console.log("获取schema失败!", {
94
- formId: this.formId,
95
- field: this.fieldId,
96
- mock: this.mock
97
- }, e);
98
- }
99
- }
66
+ this.initialized = true;
100
67
  return _context.abrupt("return", this.initialized);
101
68
  case 1:
102
69
  case "end":
@@ -247,7 +214,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
247
214
  }();
248
215
  _proto.labelToValue = /*#__PURE__*/function () {
249
216
  var _labelToValue = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
250
- var _this3 = this;
217
+ var _this2 = this;
251
218
  var config, res;
252
219
  return _regenerator["default"].wrap(function (_context5) {
253
220
  while (1) switch (_context5.prev = _context5.next) {
@@ -264,8 +231,8 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
264
231
  res.data.forEach(function (item) {
265
232
  item.id = (0, _common.uuid)();
266
233
  item.form = {
267
- id: _this3.formId,
268
- fieldId: _this3.fieldId
234
+ id: _this2.formId,
235
+ fieldId: _this2.fieldId
269
236
  };
270
237
  });
271
238
  }
@@ -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
  */
@@ -151,6 +151,23 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
151
151
  return _save.apply(this, arguments);
152
152
  }
153
153
  return save;
154
+ }();
155
+ _proto.saveMany = /*#__PURE__*/function () {
156
+ var _saveMany = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(data, options) {
157
+ return _regenerator["default"].wrap(function (_context4) {
158
+ while (1) switch (_context4.prev = _context4.next) {
159
+ case 0:
160
+ return _context4.abrupt("return", this.save(data, options));
161
+ case 1:
162
+ case "end":
163
+ return _context4.stop();
164
+ }
165
+ }, _callee4, this);
166
+ }));
167
+ function saveMany(_x6, _x7) {
168
+ return _saveMany.apply(this, arguments);
169
+ }
170
+ return saveMany;
154
171
  }()
155
172
  /**
156
173
  * 创建
@@ -159,42 +176,42 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
159
176
  _proto.create =
160
177
  /*#__PURE__*/
161
178
  function () {
162
- var _create = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(data, options) {
179
+ var _create = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
163
180
  var _this$handleRequestCo4;
164
181
  var config, res, _options$onError3, _options$onSuccess3;
165
- return _regenerator["default"].wrap(function (_context4) {
166
- while (1) switch (_context4.prev = _context4.next) {
182
+ return _regenerator["default"].wrap(function (_context5) {
183
+ while (1) switch (_context5.prev = _context5.next) {
167
184
  case 0:
168
185
  config = {};
169
- _context4.next = 1;
186
+ _context5.next = 1;
170
187
  return (_this$handleRequestCo4 = this.handleRequestConfig) === null || _this$handleRequestCo4 === void 0 ? void 0 : _this$handleRequestCo4.call(this, config);
171
188
  case 1:
172
- _context4.next = 2;
189
+ _context5.next = 2;
173
190
  return this.request.post("", data, config);
174
191
  case 2:
175
- res = _context4.sent;
192
+ res = _context5.sent;
176
193
  if (res.success) {
177
- _context4.next = 4;
194
+ _context5.next = 4;
178
195
  break;
179
196
  }
180
197
  this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
181
- _context4.next = 3;
198
+ _context5.next = 3;
182
199
  return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
183
200
  case 3:
184
- _context4.next = 5;
201
+ _context5.next = 5;
185
202
  break;
186
203
  case 4:
187
- _context4.next = 5;
204
+ _context5.next = 5;
188
205
  return options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options, res);
189
206
  case 5:
190
- return _context4.abrupt("return", res);
207
+ return _context5.abrupt("return", res);
191
208
  case 6:
192
209
  case "end":
193
- return _context4.stop();
210
+ return _context5.stop();
194
211
  }
195
- }, _callee4, this);
212
+ }, _callee5, this);
196
213
  }));
197
- function create(_x6, _x7) {
214
+ function create(_x8, _x9) {
198
215
  return _create.apply(this, arguments);
199
216
  }
200
217
  return create;
@@ -206,42 +223,42 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
206
223
  _proto.update =
207
224
  /*#__PURE__*/
208
225
  function () {
209
- var _update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(id, data, options) {
226
+ var _update = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(id, data, options) {
210
227
  var _this$handleRequestCo5;
211
228
  var config, res, _options$onError4, _options$onSuccess4;
212
- return _regenerator["default"].wrap(function (_context5) {
213
- while (1) switch (_context5.prev = _context5.next) {
229
+ return _regenerator["default"].wrap(function (_context6) {
230
+ while (1) switch (_context6.prev = _context6.next) {
214
231
  case 0:
215
232
  config = {};
216
- _context5.next = 1;
233
+ _context6.next = 1;
217
234
  return (_this$handleRequestCo5 = this.handleRequestConfig) === null || _this$handleRequestCo5 === void 0 ? void 0 : _this$handleRequestCo5.call(this, config);
218
235
  case 1:
219
- _context5.next = 2;
236
+ _context6.next = 2;
220
237
  return this.request.put(String(id), data, config);
221
238
  case 2:
222
- res = _context5.sent;
239
+ res = _context6.sent;
223
240
  if (res.success) {
224
- _context5.next = 4;
241
+ _context6.next = 4;
225
242
  break;
226
243
  }
227
244
  this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
228
- _context5.next = 3;
245
+ _context6.next = 3;
229
246
  return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
230
247
  case 3:
231
- _context5.next = 5;
248
+ _context6.next = 5;
232
249
  break;
233
250
  case 4:
234
- _context5.next = 5;
251
+ _context6.next = 5;
235
252
  return options === null || options === void 0 ? void 0 : (_options$onSuccess4 = options.onSuccess) === null || _options$onSuccess4 === void 0 ? void 0 : _options$onSuccess4.call(options, res);
236
253
  case 5:
237
- return _context5.abrupt("return", res);
254
+ return _context6.abrupt("return", res);
238
255
  case 6:
239
256
  case "end":
240
- return _context5.stop();
257
+ return _context6.stop();
241
258
  }
242
- }, _callee5, this);
259
+ }, _callee6, this);
243
260
  }));
244
- function update(_x8, _x9, _x0) {
261
+ function update(_x0, _x1, _x10) {
245
262
  return _update.apply(this, arguments);
246
263
  }
247
264
  return update;
@@ -253,55 +270,55 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
253
270
  _proto.deleteById =
254
271
  /*#__PURE__*/
255
272
  function () {
256
- var _deleteById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(id, options) {
273
+ var _deleteById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(id, options) {
257
274
  var _this$handleRequestCo6;
258
275
  var config, res, _options$onError5, _options$onSuccess5;
259
- return _regenerator["default"].wrap(function (_context6) {
260
- while (1) switch (_context6.prev = _context6.next) {
276
+ return _regenerator["default"].wrap(function (_context7) {
277
+ while (1) switch (_context7.prev = _context7.next) {
261
278
  case 0:
262
279
  config = {};
263
- _context6.next = 1;
280
+ _context7.next = 1;
264
281
  return (_this$handleRequestCo6 = this.handleRequestConfig) === null || _this$handleRequestCo6 === void 0 ? void 0 : _this$handleRequestCo6.call(this, config);
265
282
  case 1:
266
- _context6.next = 2;
283
+ _context7.next = 2;
267
284
  return this.request["delete"](String(id), config);
268
285
  case 2:
269
- res = _context6.sent;
286
+ res = _context7.sent;
270
287
  if (res.success) {
271
- _context6.next = 4;
288
+ _context7.next = 4;
272
289
  break;
273
290
  }
274
291
  this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
275
- _context6.next = 3;
292
+ _context7.next = 3;
276
293
  return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
277
294
  case 3:
278
- _context6.next = 5;
295
+ _context7.next = 5;
279
296
  break;
280
297
  case 4:
281
- _context6.next = 5;
298
+ _context7.next = 5;
282
299
  return options === null || options === void 0 ? void 0 : (_options$onSuccess5 = options.onSuccess) === null || _options$onSuccess5 === void 0 ? void 0 : _options$onSuccess5.call(options, res);
283
300
  case 5:
284
- return _context6.abrupt("return", res);
301
+ return _context7.abrupt("return", res);
285
302
  case 6:
286
303
  case "end":
287
- return _context6.stop();
304
+ return _context7.stop();
288
305
  }
289
- }, _callee6, this);
306
+ }, _callee7, this);
290
307
  }));
291
- function deleteById(_x1, _x10) {
308
+ function deleteById(_x11, _x12) {
292
309
  return _deleteById.apply(this, arguments);
293
310
  }
294
311
  return deleteById;
295
312
  }();
296
313
  _proto["delete"] = /*#__PURE__*/function () {
297
- var _delete2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(data, options) {
314
+ var _delete2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(data, options) {
298
315
  var _this$handleRequestCo7;
299
316
  var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
300
- return _regenerator["default"].wrap(function (_context7) {
301
- while (1) switch (_context7.prev = _context7.next) {
317
+ return _regenerator["default"].wrap(function (_context8) {
318
+ while (1) switch (_context8.prev = _context8.next) {
302
319
  case 0:
303
320
  config = {};
304
- _context7.next = 1;
321
+ _context8.next = 1;
305
322
  return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
306
323
  case 1:
307
324
  arrayData = [];
@@ -315,133 +332,133 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
315
332
  return !!item;
316
333
  });
317
334
  if (!(arrayData.length == 0)) {
318
- _context7.next = 2;
335
+ _context8.next = 2;
319
336
  break;
320
337
  }
321
338
  throw new Error("删除对象不可为空!");
322
339
  case 2:
323
- _context7.next = 3;
340
+ _context8.next = 3;
324
341
  return this.request.post("remove", arrayData, config);
325
342
  case 3:
326
- res = _context7.sent;
343
+ res = _context8.sent;
327
344
  if (res.success) {
328
- _context7.next = 5;
345
+ _context8.next = 5;
329
346
  break;
330
347
  }
331
348
  this.showError("\u5220\u9664\u5931\u8D25!", res).then();
332
- _context7.next = 4;
349
+ _context8.next = 4;
333
350
  return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
334
351
  case 4:
335
- _context7.next = 6;
352
+ _context8.next = 6;
336
353
  break;
337
354
  case 5:
338
- _context7.next = 6;
355
+ _context8.next = 6;
339
356
  return options === null || options === void 0 ? void 0 : (_options$onSuccess6 = options.onSuccess) === null || _options$onSuccess6 === void 0 ? void 0 : _options$onSuccess6.call(options, res);
340
357
  case 6:
341
- return _context7.abrupt("return", res);
358
+ return _context8.abrupt("return", res);
342
359
  case 7:
343
360
  case "end":
344
- return _context7.stop();
361
+ return _context8.stop();
345
362
  }
346
- }, _callee7, this);
363
+ }, _callee8, this);
347
364
  }));
348
- function _delete(_x11, _x12) {
365
+ function _delete(_x13, _x14) {
349
366
  return _delete2.apply(this, arguments);
350
367
  }
351
368
  return _delete;
352
369
  }();
353
370
  _proto["export"] = /*#__PURE__*/function () {
354
- var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(data, options) {
371
+ var _export2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(data, options) {
355
372
  var _this$handleRequestCo8;
356
373
  var config, res, _options$onError7, _options$onSuccess7;
357
- return _regenerator["default"].wrap(function (_context8) {
358
- while (1) switch (_context8.prev = _context8.next) {
374
+ return _regenerator["default"].wrap(function (_context9) {
375
+ while (1) switch (_context9.prev = _context9.next) {
359
376
  case 0:
360
377
  config = {};
361
- _context8.next = 1;
378
+ _context9.next = 1;
362
379
  return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
363
380
  case 1:
364
- _context8.next = 2;
381
+ _context9.next = 2;
365
382
  return this.request.post("/export", data, config);
366
383
  case 2:
367
- res = _context8.sent;
384
+ res = _context9.sent;
368
385
  if (res.success) {
369
- _context8.next = 4;
386
+ _context9.next = 4;
370
387
  break;
371
388
  }
372
389
  this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
373
- _context8.next = 3;
390
+ _context9.next = 3;
374
391
  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
392
  case 3:
376
- _context8.next = 5;
393
+ _context9.next = 5;
377
394
  break;
378
395
  case 4:
379
- _context8.next = 5;
396
+ _context9.next = 5;
380
397
  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
398
  case 5:
382
- return _context8.abrupt("return", res);
399
+ return _context9.abrupt("return", res);
383
400
  case 6:
384
401
  case "end":
385
- return _context8.stop();
402
+ return _context9.stop();
386
403
  }
387
- }, _callee8, this);
404
+ }, _callee9, this);
388
405
  }));
389
- function _export(_x13, _x14) {
406
+ function _export(_x15, _x16) {
390
407
  return _export2.apply(this, arguments);
391
408
  }
392
409
  return _export;
393
410
  }();
394
411
  _proto["import"] = /*#__PURE__*/function () {
395
- var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(data, options) {
412
+ var _import2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(data, options) {
396
413
  var _this$handleRequestCo9;
397
414
  var config, res, _options$onError8, _options$onSuccess8;
398
- return _regenerator["default"].wrap(function (_context9) {
399
- while (1) switch (_context9.prev = _context9.next) {
415
+ return _regenerator["default"].wrap(function (_context0) {
416
+ while (1) switch (_context0.prev = _context0.next) {
400
417
  case 0:
401
418
  config = {};
402
- _context9.next = 1;
419
+ _context0.next = 1;
403
420
  return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
404
421
  case 1:
405
- _context9.next = 2;
422
+ _context0.next = 2;
406
423
  return this.request.post("import", data, config);
407
424
  case 2:
408
- res = _context9.sent;
425
+ res = _context0.sent;
409
426
  if (res.success) {
410
- _context9.next = 4;
427
+ _context0.next = 4;
411
428
  break;
412
429
  }
413
430
  this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
414
- _context9.next = 3;
431
+ _context0.next = 3;
415
432
  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
433
  case 3:
417
- _context9.next = 5;
434
+ _context0.next = 5;
418
435
  break;
419
436
  case 4:
420
- _context9.next = 5;
437
+ _context0.next = 5;
421
438
  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
439
  case 5:
423
- return _context9.abrupt("return", res);
440
+ return _context0.abrupt("return", res);
424
441
  case 6:
425
442
  case "end":
426
- return _context9.stop();
443
+ return _context0.stop();
427
444
  }
428
- }, _callee9, this);
445
+ }, _callee0, this);
429
446
  }));
430
- function _import(_x15, _x16) {
447
+ function _import(_x17, _x18) {
431
448
  return _import2.apply(this, arguments);
432
449
  }
433
450
  return _import;
434
451
  }();
435
452
  _proto.showError = /*#__PURE__*/function () {
436
- var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(type, res) {
453
+ var _showError = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(type, res) {
437
454
  var msg, props, _t;
438
- return _regenerator["default"].wrap(function (_context0) {
439
- while (1) switch (_context0.prev = _context0.next) {
455
+ return _regenerator["default"].wrap(function (_context1) {
456
+ while (1) switch (_context1.prev = _context1.next) {
440
457
  case 0:
441
458
  msg = res.message;
442
- _context0.prev = 1;
459
+ _context1.prev = 1;
443
460
  if (!msg) {
444
- _context0.next = 4;
461
+ _context1.next = 4;
445
462
  break;
446
463
  }
447
464
  props = JSON.parse(msg);
@@ -450,31 +467,31 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
450
467
  props.title = "" + this.title + type;
451
468
  }
452
469
  if (!(props.type == "message")) {
453
- _context0.next = 2;
470
+ _context1.next = 2;
454
471
  break;
455
472
  }
456
473
  _message2["default"].error(props);
457
- return _context0.abrupt("return");
474
+ return _context1.abrupt("return");
458
475
  case 2:
459
476
  if (!(props.type == "modal")) {
460
- _context0.next = 3;
477
+ _context1.next = 3;
461
478
  break;
462
479
  }
463
480
  _modal["default"].error(props);
464
- return _context0.abrupt("return");
481
+ return _context1.abrupt("return");
465
482
  case 3:
466
483
  if (!(props.type == "notification")) {
467
- _context0.next = 4;
484
+ _context1.next = 4;
468
485
  break;
469
486
  }
470
487
  _notification2["default"].error(props);
471
- return _context0.abrupt("return");
488
+ return _context1.abrupt("return");
472
489
  case 4:
473
- _context0.next = 6;
490
+ _context1.next = 6;
474
491
  break;
475
492
  case 5:
476
- _context0.prev = 5;
477
- _t = _context0["catch"](1);
493
+ _context1.prev = 5;
494
+ _t = _context1["catch"](1);
478
495
  console.error("" + this.title + type + (msg || ""));
479
496
  _modal["default"].error({
480
497
  title: "" + this.title + type,
@@ -486,11 +503,11 @@ var BaseRestApi = exports.BaseRestApi = /*#__PURE__*/function () {
486
503
  });
487
504
  case 6:
488
505
  case "end":
489
- return _context0.stop();
506
+ return _context1.stop();
490
507
  }
491
- }, _callee0, this, [[1, 5]]);
508
+ }, _callee1, this, [[1, 5]]);
492
509
  }));
493
- function showError(_x17, _x18) {
510
+ function showError(_x19, _x20) {
494
511
  return _showError.apply(this, arguments);
495
512
  }
496
513
  return showError;
@@ -512,16 +529,16 @@ var RestApi = exports.RestApi = /*#__PURE__*/function (_BaseRestApi2) {
512
529
  (0, _inheritsLoose2["default"])(RestApi, _BaseRestApi2);
513
530
  var _proto2 = RestApi.prototype;
514
531
  _proto2.handleRequestConfig = /*#__PURE__*/function () {
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) {
532
+ var _handleRequestConfig = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10(config) {
533
+ return _regenerator["default"].wrap(function (_context10) {
534
+ while (1) switch (_context10.prev = _context10.next) {
518
535
  case 0:
519
536
  case "end":
520
- return _context1.stop();
537
+ return _context10.stop();
521
538
  }
522
- }, _callee1);
539
+ }, _callee10);
523
540
  }));
524
- function handleRequestConfig(_x19) {
541
+ function handleRequestConfig(_x21) {
525
542
  return _handleRequestConfig.apply(this, arguments);
526
543
  }
527
544
  return handleRequestConfig;
@@ -1 +1 @@
1
- export declare function loadDts(): Promise<any[]>;
1
+ export declare function loadDts(): Promise<any>;
@@ -0,0 +1 @@
1
+ declare function cacheLoadSchemas(): Promise<any>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
5
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
6
+ function cacheLoadSchemas() {
7
+ return _cacheLoadSchemas.apply(this, arguments);
8
+ }
9
+ function _cacheLoadSchemas() {
10
+ _cacheLoadSchemas = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
11
+ var _window$corp;
12
+ var corpId, res, _t;
13
+ return _regenerator["default"].wrap(function (_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ corpId = (_window$corp = window.corp) === null || _window$corp === void 0 ? void 0 : _window$corp.id;
17
+ if (corpId) {
18
+ _context.next = 1;
19
+ break;
20
+ }
21
+ return _context.abrupt("return", []);
22
+ case 1:
23
+ _context.prev = 1;
24
+ _context.next = 2;
25
+ return fetch("/clients/" + corpId + "/schemas.json");
26
+ case 2:
27
+ res = _context.sent;
28
+ _context.next = 3;
29
+ return res.json();
30
+ case 3:
31
+ return _context.abrupt("return", _context.sent);
32
+ case 4:
33
+ _context.prev = 4;
34
+ _t = _context["catch"](1);
35
+ console.error(_t);
36
+ return _context.abrupt("return", []);
37
+ case 5:
38
+ case "end":
39
+ return _context.stop();
40
+ }
41
+ }, _callee, null, [[1, 4]]);
42
+ }));
43
+ return _cacheLoadSchemas.apply(this, arguments);
44
+ }
@@ -0,0 +1 @@
1
+ export declare function getPagePermission(pageId: string): Promise<import("./index_db_cache").BaseData>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.getPagePermission = getPagePermission;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
+ var _index_db_cache = require("./index_db_cache");
9
+ function getPagePermission(_x) {
10
+ return _getPagePermission.apply(this, arguments);
11
+ }
12
+ function _getPagePermission() {
13
+ _getPagePermission = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(pageId) {
14
+ var permission;
15
+ return _regenerator["default"].wrap(function (_context) {
16
+ while (1) switch (_context.prev = _context.next) {
17
+ case 0:
18
+ _context.next = 1;
19
+ return _index_db_cache.page_permission_store.get(pageId);
20
+ case 1:
21
+ permission = _context.sent;
22
+ if (!permission) {
23
+ //TODO 创建空的permission
24
+ }
25
+ return _context.abrupt("return", permission);
26
+ case 2:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }, _callee);
31
+ }));
32
+ return _getPagePermission.apply(this, arguments);
33
+ }
@@ -0,0 +1 @@
1
+ export declare function getPagePrintTemplates(pageId: string): Promise<any[]>;