@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
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.getPagePrintTemplates = getPagePrintTemplates;
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 getPagePrintTemplates(_x) {
10
+ return _getPagePrintTemplates.apply(this, arguments);
11
+ }
12
+ function _getPagePrintTemplates() {
13
+ _getPagePrintTemplates = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(pageId) {
14
+ var pagePrint;
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_print_store.get(pageId);
20
+ case 1:
21
+ pagePrint = _context.sent;
22
+ return _context.abrupt("return", (pagePrint === null || pagePrint === void 0 ? void 0 : pagePrint.templates) || []);
23
+ case 2:
24
+ case "end":
25
+ return _context.stop();
26
+ }
27
+ }, _callee);
28
+ }));
29
+ return _getPagePrintTemplates.apply(this, arguments);
30
+ }
@@ -0,0 +1 @@
1
+ export declare function loadPageSchema(pageId: string): Promise<any>;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.loadPageSchema = loadPageSchema;
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
+ var _cache = require("./cache.page-permission");
10
+ var _cache2 = require("./cache.page-print");
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; }
15
+ var pageSchemaCacheMap = new Map();
16
+ function loadPageSchema(_x) {
17
+ return _loadPageSchema.apply(this, arguments);
18
+ }
19
+ function _loadPageSchema() {
20
+ _loadPageSchema = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(pageId) {
21
+ var schema, permission, printTemplates, handleCommonSchema, cloneSchema, refs, _iterator, _step, _ref$props, _ref$props$fieldProps, _ref$props$fieldProps2, ref, refPageId;
22
+ return _regenerator["default"].wrap(function (_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ handleCommonSchema = function _handleCommonSchema(schema) {
26
+ schema.props = schema.props || {};
27
+ schema.props.permission = permission;
28
+ schema.props.printTemplates = printTemplates;
29
+ };
30
+ if (!pageSchemaCacheMap.has(pageId)) {
31
+ _context.next = 1;
32
+ break;
33
+ }
34
+ return _context.abrupt("return", pageSchemaCacheMap.get(pageId));
35
+ case 1:
36
+ _context.next = 2;
37
+ return _index_db_cache.page_schema_store.get(pageId);
38
+ case 2:
39
+ schema = _context.sent;
40
+ if (schema) {
41
+ _context.next = 3;
42
+ break;
43
+ }
44
+ return _context.abrupt("return", null);
45
+ case 3:
46
+ _context.next = 4;
47
+ return (0, _cache.getPagePermission)(pageId);
48
+ case 4:
49
+ permission = _context.sent;
50
+ _context.next = 5;
51
+ return (0, _cache2.getPagePrintTemplates)(pageId);
52
+ case 5:
53
+ printTemplates = _context.sent;
54
+ //循环处理表单和子表单
55
+ (0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
56
+ handleCommonSchema(formSchema);
57
+ (0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
58
+ handleCommonSchema(fdmSchema);
59
+ fdmSchema.props.form.label = formSchema.props.label;
60
+ });
61
+ });
62
+
63
+ //传入formElement 表单特殊运用
64
+ cloneSchema = JSON.parse(JSON.stringify(schema));
65
+ (0, _schema.findFormSchemas)(schema).forEach(function (formSchema) {
66
+ (0, _schema.findFdmSchemas)(formSchema.fdmSchema).forEach(function (fdmSchema) {
67
+ fdmSchema.props.formElement = cloneSchema;
68
+ });
69
+ });
70
+
71
+ //加载相关表
72
+ refs = (0, _schema.findLoadRefSchemas)(schema);
73
+ _iterator = _createForOfIteratorHelperLoose(refs);
74
+ case 6:
75
+ if ((_step = _iterator()).done) {
76
+ _context.next = 8;
77
+ break;
78
+ }
79
+ ref = _step.value;
80
+ 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;
81
+ if (!(typeof refPageId == "string" && refPageId !== pageId)) {
82
+ _context.next = 7;
83
+ break;
84
+ }
85
+ if (pageSchemaCacheMap.has(refPageId)) {
86
+ _context.next = 7;
87
+ break;
88
+ }
89
+ _context.next = 7;
90
+ return loadPageSchema(refPageId);
91
+ case 7:
92
+ _context.next = 6;
93
+ break;
94
+ case 8:
95
+ case "end":
96
+ return _context.stop();
97
+ }
98
+ }, _callee);
99
+ }));
100
+ return _loadPageSchema.apply(this, arguments);
101
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,5 +1,7 @@
1
1
  import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
2
2
  import { RestFormApi } from "../api";
3
+ export { initialize } from "./index_db_cache";
4
+ export { db_cache } from "./index_db_cache";
3
5
  export declare class SchemaCache extends SingletonInstanceMap<any, {
4
6
  mock?: boolean;
5
7
  pageId: string;
@@ -7,11 +9,8 @@ export declare class SchemaCache extends SingletonInstanceMap<any, {
7
9
  createInstance(key: string, options: any): Promise<any>;
8
10
  }
9
11
  export declare const schema: SchemaCache;
10
- export declare class FormApiCache extends SingletonInstanceMap<RestFormApi<any>, {
11
- formId: string;
12
- fieldId?: string;
13
- mock?: boolean;
14
- }> {
15
- createInstance(key: string, options?: any): Promise<RestFormApi<any>>;
12
+ export declare class FormApiCache {
13
+ cache: Map<string, RestFormApi<any>>;
14
+ getInstance(key: string, options?: any): RestFormApi<any>;
16
15
  }
17
16
  export declare const formApi: FormApiCache;
@@ -2,13 +2,16 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.schema = exports.formApi = exports.SchemaCache = exports.FormApiCache = void 0;
5
+ exports.schema = exports.initialize = exports.formApi = exports.db_cache = exports.SchemaCache = exports.FormApiCache = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
8
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
9
- var _SingletonInstanceMap3 = require("../common/SingletonInstanceMap");
9
+ var _SingletonInstanceMap2 = require("../common/SingletonInstanceMap");
10
10
  var _api = require("../api");
11
11
  var _schema = require("../api/schema.util");
12
+ var _index_db_cache = require("./index_db_cache");
13
+ exports.initialize = _index_db_cache.initialize;
14
+ exports.db_cache = _index_db_cache.db_cache;
12
15
  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
16
  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
17
  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; }
@@ -20,7 +23,7 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
20
23
  var _proto = SchemaCache.prototype;
21
24
  _proto.createInstance = /*#__PURE__*/function () {
22
25
  var _createInstance = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(key, options) {
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;
26
+ var mock, pageId, params, schemaRes, schema, handleCommonSchema, permission, printTemplates, cloneSchema, refs, _iterator, _step, _ref$props, _ref$props$fieldProps, _ref$props$fieldProps2, ref, refPageId, _key, _t;
24
27
  return _regenerator["default"].wrap(function (_context) {
25
28
  while (1) switch (_context.prev = _context.next) {
26
29
  case 0:
@@ -44,11 +47,9 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
44
47
  schema.props = schema.props || {};
45
48
  schema.props.permission = permission;
46
49
  schema.props.printTemplates = printTemplates;
47
- schema.props.workflow = workflow;
48
50
  };
49
51
  //处理权限
50
52
  permission = null; //处理打印
51
- workflow = null;
52
53
  if (location.pathname.startsWith("/print")) {
53
54
  _context.next = 6;
54
55
  break;
@@ -130,40 +131,27 @@ var SchemaCache = exports.SchemaCache = /*#__PURE__*/function (_SingletonInstanc
130
131
  return createInstance;
131
132
  }();
132
133
  return SchemaCache;
133
- }(_SingletonInstanceMap3.SingletonInstanceMap);
134
+ }(_SingletonInstanceMap2.SingletonInstanceMap);
134
135
  var schema = exports.schema = new SchemaCache();
135
- var FormApiCache = exports.FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
136
+ var FormApiCache = exports.FormApiCache = /*#__PURE__*/function () {
136
137
  function FormApiCache() {
137
- return _SingletonInstanceMap2.apply(this, arguments) || this;
138
+ this.cache = new Map();
138
139
  }
139
- (0, _inheritsLoose2["default"])(FormApiCache, _SingletonInstanceMap2);
140
140
  var _proto2 = FormApiCache.prototype;
141
- _proto2.createInstance = /*#__PURE__*/function () {
142
- var _createInstance2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(key, options) {
143
- var _options, formId, fieldId, mock, formApi;
144
- return _regenerator["default"].wrap(function (_context2) {
145
- while (1) switch (_context2.prev = _context2.next) {
146
- case 0:
147
- if (options === void 0) {
148
- options = {};
149
- }
150
- _options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
151
- formApi = new _api.RestFormApi(formId, fieldId, mock);
152
- _context2.next = 1;
153
- return formApi.initialize();
154
- case 1:
155
- return _context2.abrupt("return", formApi);
156
- case 2:
157
- case "end":
158
- return _context2.stop();
159
- }
160
- }, _callee2);
161
- }));
162
- function createInstance(_x3, _x4) {
163
- return _createInstance2.apply(this, arguments);
141
+ _proto2.getInstance = function getInstance(key, options) {
142
+ if (options === void 0) {
143
+ options = {};
164
144
  }
165
- return createInstance;
166
- }();
145
+ if (!this.cache.has(key)) {
146
+ var _options = options,
147
+ formId = _options.formId,
148
+ fieldId = _options.fieldId,
149
+ mock = _options.mock;
150
+ var _formApi = new _api.RestFormApi(formId, fieldId, mock);
151
+ this.cache.set(key, _formApi);
152
+ }
153
+ return this.cache.get(key);
154
+ };
167
155
  return FormApiCache;
168
- }(_SingletonInstanceMap3.SingletonInstanceMap);
156
+ }();
169
157
  var formApi = exports.formApi = new FormApiCache();
@@ -1,9 +1,14 @@
1
1
  import { Dexie, type EntityTable } from "dexie";
2
- export interface Friend {
3
- page_id: string;
4
- schema: any;
2
+ export interface BaseData {
3
+ id: string;
4
+ value: any;
5
5
  }
6
- declare const db_cache: Dexie & {
7
- page_schemas: EntityTable<Friend, 'page_id'>;
6
+ export declare const db_cache: Dexie & {
7
+ page_schema: EntityTable<BaseData, 'id'>;
8
+ page_permission: EntityTable<BaseData, 'id'>;
9
+ page_print: EntityTable<BaseData, 'id'>;
8
10
  };
9
- export default db_cache;
11
+ export declare const page_schema_store: EntityTable<BaseData, "id", import("dexie").InsertType<BaseData, "id">>;
12
+ export declare const page_permission_store: EntityTable<BaseData, "id", import("dexie").InsertType<BaseData, "id">>;
13
+ export declare const page_print_store: EntityTable<BaseData, "id", import("dexie").InsertType<BaseData, "id">>;
14
+ export declare function initialize(): Promise<void>;
@@ -1,11 +1,66 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  exports.__esModule = true;
4
- exports["default"] = void 0;
5
+ exports.db_cache = void 0;
6
+ exports.initialize = initialize;
7
+ exports.page_schema_store = exports.page_print_store = exports.page_permission_store = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
5
10
  var _dexie = require("dexie");
6
- var db_cache = new _dexie.Dexie('cache');
7
- db_cache.version(1).stores({
8
- page_schemas: 'page_id,schema'
11
+ var _window$version$schem, _window$version, _window$version$permi, _window$version2, _window$version$print, _window$version3;
12
+ var db_cache = exports.db_cache = new _dexie.Dexie('cache');
13
+ db_cache.version((_window$version$schem = (_window$version = window.version) === null || _window$version === void 0 ? void 0 : _window$version.schema) !== null && _window$version$schem !== void 0 ? _window$version$schem : 1).stores({
14
+ page_schema: 'id,value'
9
15
  });
10
- var page_schemas = db_cache.page_schemas;
11
- var _default = exports["default"] = db_cache;
16
+ db_cache.version((_window$version$permi = (_window$version2 = window.version) === null || _window$version2 === void 0 ? void 0 : _window$version2.permission) !== null && _window$version$permi !== void 0 ? _window$version$permi : 1).stores({
17
+ page_permission: 'id,value'
18
+ });
19
+ db_cache.version((_window$version$print = (_window$version3 = window.version) === null || _window$version3 === void 0 ? void 0 : _window$version3.print) !== null && _window$version$print !== void 0 ? _window$version$print : 1).stores({
20
+ page_print: 'id,value'
21
+ });
22
+ var page_schema_store = exports.page_schema_store = db_cache.page_schema;
23
+ var page_permission_store = exports.page_permission_store = db_cache.page_permission;
24
+ var page_print_store = exports.page_print_store = db_cache.page_print;
25
+ function initialize() {
26
+ return _initialize.apply(this, arguments);
27
+ }
28
+ function _initialize() {
29
+ _initialize = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
30
+ var count, schemas, _t;
31
+ return _regenerator["default"].wrap(function (_context) {
32
+ while (1) switch (_context.prev = _context.next) {
33
+ case 0:
34
+ _context.prev = 0;
35
+ _context.next = 1;
36
+ return page_schema_store.count();
37
+ case 1:
38
+ count = _context.sent;
39
+ if (!(count == 0)) {
40
+ _context.next = 3;
41
+ break;
42
+ }
43
+ _context.next = 2;
44
+ return cacheLoadSchemas();
45
+ case 2:
46
+ schemas = _context.sent;
47
+ try {
48
+ db_cache.page_schema.bulkAdd(schemas);
49
+ } catch (e) {
50
+ console.error("加载缓存失败!", e);
51
+ }
52
+ case 3:
53
+ _context.next = 5;
54
+ break;
55
+ case 4:
56
+ _context.prev = 4;
57
+ _t = _context["catch"](0);
58
+ console.log(_t);
59
+ case 5:
60
+ case "end":
61
+ return _context.stop();
62
+ }
63
+ }, _callee, null, [[0, 4]]);
64
+ }));
65
+ return _initialize.apply(this, arguments);
66
+ }
@@ -93,7 +93,7 @@ function openPage(_x, _x2) {
93
93
  function _openPage() {
94
94
  _openPage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(url, target) {
95
95
  var _window$parent;
96
- var page, func;
96
+ var func;
97
97
  return _regenerator["default"].wrap(function (_context3) {
98
98
  while (1) switch (_context3.prev = _context3.next) {
99
99
  case 0:
@@ -6,6 +6,7 @@ interface FillRule {
6
6
  key: string;
7
7
  value: string;
8
8
  }
9
+ export type DefaultActionType = "add" | "edit" | "remove" | "temporary" | "print" | "copy" | "comment";
9
10
  export interface DataView {
10
11
  form?: {
11
12
  id?: string;
@@ -36,7 +37,7 @@ export interface DataView {
36
37
  };
37
38
  customActions?: {
38
39
  enable?: boolean;
39
- defaults?: string[];
40
+ defaults?: DefaultActionType[];
40
41
  toolbarLeftOptions?: string[];
41
42
  toolbarRightOptions?: string[];
42
43
  footerLeftOptions?: string[];
@@ -1,5 +1,5 @@
1
1
  import { Component } from "react";
2
- export type PageLayoutType = "page" | "modal" | "drawer";
2
+ export type PageLayoutType = "page" | "modal" | "drawer" | "blank";
3
3
  interface PageLayoutProps {
4
4
  container?: any;
5
5
  layout?: PageLayoutType;
@@ -8,23 +8,26 @@ var _message2 = _interopRequireDefault(require("antd/lib/message"));
8
8
  var _react = require("react");
9
9
  var _api = require("../api");
10
10
  var _schemaApi = require("../api/schema-api");
11
- var _index = require("./index");
11
+ var _pageLoading = require("../../components/page-loading");
12
12
  function PageLoadSchema(props) {
13
13
  var pageId = props.pageId,
14
14
  children = props.children;
15
15
  var cache = (0, _schemaApi.getSchemaFromCache)(pageId);
16
- var _useState = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
17
- schema = _useState[0],
18
- setSchema = _useState[1];
19
- var _useState2 = (0, _react.useState)(),
20
- errorMsg = _useState2[0],
21
- setErrorMsg = _useState2[1];
16
+ var _useState = (0, _react.useState)(false),
17
+ loading = _useState[0],
18
+ setLoading = _useState[1];
19
+ var _useState2 = (0, _react.useState)(cache === null || cache === void 0 ? void 0 : cache.data),
20
+ schema = _useState2[0],
21
+ setSchema = _useState2[1];
22
+ var _useState3 = (0, _react.useState)(),
23
+ errorMsg = _useState3[0],
24
+ setErrorMsg = _useState3[1];
22
25
  (0, _react.useEffect)(function () {
23
26
  if (cache !== null && cache !== void 0 && cache.success) {
24
27
  return;
25
28
  }
26
29
  if (pageId) {
27
- (0, _index.showLoading)().then();
30
+ setLoading(true);
28
31
  (0, _api.getSchema)(pageId).then(function (res) {
29
32
  if (res.success) {
30
33
  setSchema(res === null || res === void 0 ? void 0 : res.data);
@@ -32,22 +35,37 @@ function PageLoadSchema(props) {
32
35
  setErrorMsg(res === null || res === void 0 ? void 0 : res.message);
33
36
  }
34
37
  })["finally"](function () {
35
- (0, _index.hideLoading)().then();
38
+ setLoading(false);
36
39
  });
37
40
  } else {
38
- (0, _index.hideLoading)().then();
41
+ setLoading(false);
39
42
  setErrorMsg("参数错误:页面id不可为空!");
40
43
  _message2["default"].error("参数错误:页面id不可为空!").then();
41
44
  }
42
45
  }, []);
43
- if (schema) {
44
- return children(schema);
45
- }
46
46
  if (errorMsg) {
47
47
  return /*#__PURE__*/React.createElement(_result["default"], {
48
48
  status: 500,
49
49
  title: errorMsg
50
50
  });
51
51
  }
52
- return /*#__PURE__*/React.createElement(_react.Fragment, null);
52
+ if (schema) {
53
+ return children(schema);
54
+ }
55
+ if (loading) {
56
+ return /*#__PURE__*/React.createElement(_pageLoading.PageLoading, {
57
+ loading: loading
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ style: {
60
+ width: "100%",
61
+ height: "100%"
62
+ }
63
+ }));
64
+ }
65
+ return /*#__PURE__*/React.createElement("div", {
66
+ style: {
67
+ width: "100%",
68
+ height: "100%"
69
+ }
70
+ });
53
71
  }
@@ -25,10 +25,14 @@ function renderElement(options) {
25
25
  root = (0, _client.createRoot)(container);
26
26
  element = /*#__PURE__*/(0, _react.createElement)(component, (0, _extends2["default"])({}, props, {
27
27
  onSelectOk: function onSelectOk(data) {
28
+ if (props.onSelectOk) {
29
+ var _props$onSelectOk;
30
+ (_props$onSelectOk = props.onSelectOk) === null || _props$onSelectOk === void 0 ? void 0 : _props$onSelectOk.call(props, data || null);
31
+ }
28
32
  resolve(data || null);
29
33
  },
30
34
  onClose: function onClose() {
31
- resolve(null);
35
+ resolve(undefined);
32
36
  //等待动画结束
33
37
  setTimeout(function () {
34
38
  root.unmount();
@@ -83,7 +83,7 @@ function compileFilterRules(rules) {
83
83
  value = JSON.stringify(value, replacer);
84
84
  }
85
85
  scripts.push("\"key\":\"" + rule.key + "\",");
86
- if (rule.valueType) {
86
+ if (rule.valueType != null) {
87
87
  scripts.push("\"valueType\":\"" + rule.valueType + "\",");
88
88
  }
89
89
  scripts.push("\"operator\":\"" + rule.operator + "\",");
@@ -133,6 +133,8 @@ function _openPrint() {
133
133
  iframe.src = url;
134
134
  iframe.className = "print-iframe";
135
135
  iframe.onload = function () {
136
+ // @ts-ignore
137
+ iframe.contentWindow.__mock = window.__mock;
136
138
  // @ts-ignore
137
139
  iframe.contentWindow.printOptions = options;
138
140
  };
@@ -147,10 +149,6 @@ function _openPrint() {
147
149
  case 1:
148
150
  // @ts-ignore
149
151
  window.printWindow = printWindow;
150
- printWindow.onload = function () {
151
- // @ts-ignore
152
- printWindow.printOptions = options;
153
- };
154
152
  printWindow.addEventListener("beforeprint", function () {});
155
153
  printWindow.addEventListener("afterprint", /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
156
154
  var _printWindow, printer, _printWindow2, doc, html;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "6.3.25",
3
+ "version": "6.4.4",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",