@zhubangyun/lowcode-core 5.10.220 → 5.12.10

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 (71) hide show
  1. package/es/index.less +10 -0
  2. package/es/utils/api/file-api.d.ts +17 -5
  3. package/es/utils/api/file-api.js +10 -7
  4. package/es/utils/api/form-api.d.ts +1 -1
  5. package/es/utils/api/form-api.js +70 -66
  6. package/es/utils/api/form-api.utils.d.ts +5 -5
  7. package/es/utils/api/form-api.utils.js +55 -36
  8. package/es/utils/api/index.d.ts +4 -3
  9. package/es/utils/api/index.js +9 -2
  10. package/es/utils/api/rest-api.d.ts +6 -5
  11. package/es/utils/api/rest-api.js +1 -1
  12. package/es/utils/api/schema.util.d.ts +14 -0
  13. package/es/utils/api/schema.util.js +32 -0
  14. package/es/utils/api/script-api.js +1 -1
  15. package/es/utils/api/user-info.d.ts +16 -6
  16. package/es/utils/api/user-info.js +31 -20
  17. package/es/utils/cache/index.d.ts +6 -6
  18. package/es/utils/cache/index.js +56 -24
  19. package/es/utils/cache/schema.d.ts +0 -2
  20. package/es/utils/cache/schema.js +0 -388
  21. package/es/utils/formIds.d.ts +3 -0
  22. package/es/utils/formIds.js +3 -0
  23. package/es/utils/page/index.d.ts +2 -0
  24. package/es/utils/page/index.js +2 -0
  25. package/es/utils/page/page-form-data-manager-group.d.ts +2 -0
  26. package/es/utils/page/page-form-data-manager-group.js +3 -7
  27. package/es/utils/page/page-form-data-manager.d.ts +2 -1
  28. package/es/utils/page/page-form-data-manager.js +1 -0
  29. package/es/utils/page/page-form-group.d.ts +17 -0
  30. package/es/utils/page/page-form-group.js +97 -0
  31. package/es/utils/page/page-form.d.ts +2 -1
  32. package/es/utils/page/page-form.js +3 -3
  33. package/es/utils/page/page-show.d.ts +1 -0
  34. package/es/utils/page/print-form.d.ts +8 -0
  35. package/es/utils/page/print-form.js +147 -0
  36. package/lib/index.less +10 -0
  37. package/lib/utils/api/file-api.d.ts +17 -5
  38. package/lib/utils/api/file-api.js +10 -7
  39. package/lib/utils/api/form-api.d.ts +1 -1
  40. package/lib/utils/api/form-api.js +70 -66
  41. package/lib/utils/api/form-api.utils.d.ts +5 -5
  42. package/lib/utils/api/form-api.utils.js +55 -36
  43. package/lib/utils/api/index.d.ts +4 -3
  44. package/lib/utils/api/index.js +10 -3
  45. package/lib/utils/api/rest-api.d.ts +6 -5
  46. package/lib/utils/api/rest-api.js +1 -1
  47. package/lib/utils/api/schema.util.d.ts +14 -0
  48. package/lib/utils/api/schema.util.js +37 -0
  49. package/lib/utils/api/script-api.js +1 -1
  50. package/lib/utils/api/user-info.d.ts +16 -6
  51. package/lib/utils/api/user-info.js +32 -21
  52. package/lib/utils/cache/index.d.ts +6 -6
  53. package/lib/utils/cache/index.js +57 -24
  54. package/lib/utils/cache/schema.d.ts +0 -2
  55. package/lib/utils/cache/schema.js +0 -390
  56. package/lib/utils/formIds.d.ts +3 -0
  57. package/lib/utils/formIds.js +7 -0
  58. package/lib/utils/page/index.d.ts +2 -0
  59. package/lib/utils/page/index.js +7 -1
  60. package/lib/utils/page/page-form-data-manager-group.d.ts +2 -0
  61. package/lib/utils/page/page-form-data-manager-group.js +3 -7
  62. package/lib/utils/page/page-form-data-manager.d.ts +2 -1
  63. package/lib/utils/page/page-form-data-manager.js +1 -0
  64. package/lib/utils/page/page-form-group.d.ts +17 -0
  65. package/lib/utils/page/page-form-group.js +104 -0
  66. package/lib/utils/page/page-form.d.ts +2 -1
  67. package/lib/utils/page/page-form.js +3 -3
  68. package/lib/utils/page/page-show.d.ts +1 -0
  69. package/lib/utils/page/print-form.d.ts +8 -0
  70. package/lib/utils/page/print-form.js +153 -0
  71. package/package.json +1 -1
@@ -1,9 +1,19 @@
1
- export interface UserInfo {
2
- userId: string;
3
- userName: string;
1
+ import { IBaseEntity } from "./rest-api";
2
+ export interface Userinfo {
3
+ id: string;
4
+ label: string;
5
+ username: string;
4
6
  staffId: string;
5
7
  staffName: string;
6
- roleIds: string[];
7
- deptIds: string[];
8
+ form: {
9
+ id: string;
10
+ };
11
+ depts: IBaseEntity[];
12
+ roles: IBaseEntity[];
13
+ corp: {
14
+ id: string;
15
+ name: string;
16
+ shortName: string;
17
+ };
8
18
  }
9
- export declare function loadUserInfo(): Promise<UserInfo | false>;
19
+ export declare function getUserinfo(): Promise<Userinfo | null>;
@@ -1,39 +1,50 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  import { apiRequest } from "./index";
5
- export function loadUserInfo() {
6
- return _loadUserInfo.apply(this, arguments);
4
+ var userinfoKey = "userinfo";
5
+ export function getUserinfo() {
6
+ return _getUserinfo.apply(this, arguments);
7
7
  }
8
- function _loadUserInfo() {
9
- _loadUserInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
- var res;
8
+ function _getUserinfo() {
9
+ _getUserinfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
+ var userinfo, cache, res;
11
11
  return _regeneratorRuntime.wrap(function _callee$(_context) {
12
12
  while (1) switch (_context.prev = _context.next) {
13
13
  case 0:
14
- if (!window.userInfo) {
15
- _context.next = 4;
14
+ userinfo = null;
15
+ cache = sessionStorage.getItem(userinfoKey);
16
+ if (cache) {
17
+ try {
18
+ userinfo = JSON.parse(cache);
19
+ } catch (e) {}
20
+ }
21
+ if (userinfo) {
22
+ _context.next = 8;
16
23
  break;
17
24
  }
18
- return _context.abrupt("return", _extends({}, window.userInfo));
19
- case 4:
20
25
  _context.next = 6;
21
- return apiRequest.get("userInfo");
26
+ return apiRequest.get("auths/userinfo");
22
27
  case 6:
23
28
  res = _context.sent;
24
- if (!res.success) {
25
- _context.next = 12;
26
- break;
29
+ if (res.success) {
30
+ sessionStorage.setItem(userinfoKey, JSON.stringify(res.data));
31
+ userinfo = res.data;
32
+ }
33
+ case 8:
34
+ if (userinfo) {
35
+ Object.defineProperty(window, "userinfo", {
36
+ value: userinfo
37
+ });
38
+ Object.defineProperty(window, "corp", {
39
+ value: userinfo.corp
40
+ });
27
41
  }
28
- window.userInfo = res.data;
29
- return _context.abrupt("return", _extends({}, res.data));
30
- case 12:
31
- return _context.abrupt("return", false);
32
- case 13:
42
+ return _context.abrupt("return", userinfo);
43
+ case 10:
33
44
  case "end":
34
45
  return _context.stop();
35
46
  }
36
47
  }, _callee);
37
48
  }));
38
- return _loadUserInfo.apply(this, arguments);
49
+ return _getUserinfo.apply(this, arguments);
39
50
  }
@@ -7,12 +7,12 @@ export declare class SchemaCache extends SingletonInstanceMap<any, {
7
7
  createInstance(key: string, options: any): Promise<any>;
8
8
  }
9
9
  export declare const schema: SchemaCache;
10
- export declare class FormApiCache {
10
+ export declare class FormApiCache extends SingletonInstanceMap<RestFormApi<any>, {
11
+ formId: string;
12
+ fieldId?: string;
13
+ mock?: boolean;
14
+ }> {
11
15
  apiMap: Map<string, RestFormApi<any>>;
12
- getInstance(key: string, options: {
13
- formId: string;
14
- fieldId?: string;
15
- mock?: boolean;
16
- }): RestFormApi<any>;
16
+ createInstance(key: string, options?: any): Promise<RestFormApi<any>>;
17
17
  }
18
18
  export declare const formApi: FormApiCache;
@@ -2,9 +2,8 @@ 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
4
  import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
5
- import { RestFormApi } from "../api";
6
- import { handleFormSchema } from "./schema";
7
- import { apiRequest } from "../api";
5
+ import { apiRequest, RestFormApi } from "../api";
6
+ import { forEachFormSchema } from "../api/schema.util";
8
7
  export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
9
8
  function SchemaCache() {
10
9
  return _SingletonInstanceMap.apply(this, arguments) || this;
@@ -13,7 +12,7 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
13
12
  var _proto = SchemaCache.prototype;
14
13
  _proto.createInstance = /*#__PURE__*/function () {
15
14
  var _createInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, options) {
16
- var mock, pageId, res;
15
+ var mock, pageId, schemaRes, schema, permissionRes, permission;
17
16
  return _regeneratorRuntime.wrap(function _callee$(_context) {
18
17
  while (1) switch (_context.prev = _context.next) {
19
18
  case 0:
@@ -25,16 +24,27 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
25
24
  }
26
25
  });
27
26
  case 3:
28
- res = _context.sent;
29
- if (!res.success) {
30
- _context.next = 7;
27
+ schemaRes = _context.sent;
28
+ schema = schemaRes.data;
29
+ if (!(typeof schema == "object")) {
30
+ _context.next = 11;
31
31
  break;
32
32
  }
33
- _context.next = 7;
34
- return handleFormSchema(res.data);
35
- case 7:
36
- return _context.abrupt("return", res);
33
+ _context.next = 8;
34
+ return apiRequest.get("pages/" + pageId + "/permission");
37
35
  case 8:
36
+ permissionRes = _context.sent;
37
+ permission = permissionRes.data;
38
+ if (typeof permission == "object") {
39
+ forEachFormSchema(schema, true, function (child) {
40
+ child.props = child.props || {};
41
+ child.props.permission = permission;
42
+ });
43
+ }
44
+ case 11:
45
+ console.log("schemaRes", schemaRes);
46
+ return _context.abrupt("return", schemaRes);
47
+ case 13:
38
48
  case "end":
39
49
  return _context.stop();
40
50
  }
@@ -48,22 +58,44 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
48
58
  return SchemaCache;
49
59
  }(SingletonInstanceMap);
50
60
  export var schema = new SchemaCache();
51
- export var FormApiCache = /*#__PURE__*/function () {
61
+ export var FormApiCache = /*#__PURE__*/function (_SingletonInstanceMap2) {
52
62
  function FormApiCache() {
53
- this.apiMap = new Map();
63
+ var _this;
64
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65
+ args[_key] = arguments[_key];
66
+ }
67
+ _this = _SingletonInstanceMap2.call.apply(_SingletonInstanceMap2, [this].concat(args)) || this;
68
+ _this.apiMap = new Map();
69
+ return _this;
54
70
  }
71
+ _inheritsLoose(FormApiCache, _SingletonInstanceMap2);
55
72
  var _proto2 = FormApiCache.prototype;
56
- _proto2.getInstance = function getInstance(key, options) {
57
- if (this.apiMap.has(key)) {
58
- return this.apiMap.get(key);
73
+ _proto2.createInstance = /*#__PURE__*/function () {
74
+ var _createInstance2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, options) {
75
+ var _options, formId, fieldId, mock, formApi;
76
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
77
+ while (1) switch (_context2.prev = _context2.next) {
78
+ case 0:
79
+ if (options === void 0) {
80
+ options = {};
81
+ }
82
+ _options = options, formId = _options.formId, fieldId = _options.fieldId, mock = _options.mock;
83
+ formApi = new RestFormApi(formId, fieldId, mock);
84
+ _context2.next = 5;
85
+ return formApi.initialize();
86
+ case 5:
87
+ return _context2.abrupt("return", formApi);
88
+ case 6:
89
+ case "end":
90
+ return _context2.stop();
91
+ }
92
+ }, _callee2);
93
+ }));
94
+ function createInstance(_x3, _x4) {
95
+ return _createInstance2.apply(this, arguments);
59
96
  }
60
- var formId = options.formId,
61
- fieldId = options.fieldId,
62
- mock = options.mock;
63
- var formApi = new RestFormApi(formId, fieldId, mock);
64
- this.apiMap.set(key, formApi);
65
- return formApi;
66
- };
97
+ return createInstance;
98
+ }();
67
99
  return FormApiCache;
68
- }();
100
+ }(SingletonInstanceMap);
69
101
  export var formApi = new FormApiCache();
@@ -1,8 +1,6 @@
1
- export declare function handleFormSchema(schema: any): Promise<void>;
2
1
  /**
3
2
  * 遍历schema
4
3
  * @param schema
5
4
  * @param callback 返回true 继续往下遍历
6
5
  */
7
6
  export declare function forEachFormSchema(schema: any, callback: (child: any, index: number, children: any[]) => boolean): void;
8
- export declare function getAdminFormSchema(id: string): Promise<any>;
@@ -1,308 +1,3 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
- import utils from "../index";
7
- export function handleFormSchema(_x) {
8
- return _handleFormSchema.apply(this, arguments);
9
- }
10
-
11
- /**
12
- * 处理数据管理关联属性
13
- * @param rootSchema
14
- * @param fdmSchema
15
- */
16
- function _handleFormSchema() {
17
- _handleFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(schema) {
18
- var formFieldSchema, fdmItems, fieldIdMap, _i, _fdmItems, fdmField;
19
- return _regeneratorRuntime.wrap(function _callee$(_context) {
20
- while (1) switch (_context.prev = _context.next) {
21
- case 0:
22
- if (!((schema === null || schema === void 0 ? void 0 : schema.componentName) != "Page")) {
23
- _context.next = 2;
24
- break;
25
- }
26
- return _context.abrupt("return");
27
- case 2:
28
- formFieldSchema = new FormFieldSchema(schema.children[0], null);
29
- fdmItems = [];
30
- fieldIdMap = new Map();
31
- schema.state = schema.state || {};
32
- schema.methods = schema.methods || {};
33
- _context.next = 9;
34
- return handleAssociationForm(formFieldSchema, schema);
35
- case 9:
36
- //初次处理
37
- forEachFormSchema(schema, function (field) {
38
- if (field.fdmSchema) {
39
- var _field$fdmSchema, _field$fdmSchema2;
40
- fdmItems.push(field);
41
- field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
42
- field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
43
- field.fdmSchema.props.style.height = "100%";
44
- }
45
- if (field.props.fieldId) {
46
- //删除children防止循环
47
- var copyField = JSON.parse(JSON.stringify(field));
48
- delete copyField.children;
49
- fieldIdMap.set(field.props.fieldId, copyField);
50
- }
51
- return true;
52
- });
53
-
54
- //处理查询列
55
- _i = 0, _fdmItems = fdmItems;
56
- case 11:
57
- if (!(_i < _fdmItems.length)) {
58
- _context.next = 19;
59
- break;
60
- }
61
- fdmField = _fdmItems[_i];
62
- _context.next = 15;
63
- return handleFdmAssociationAttributeFields(formFieldSchema, fdmField.fdmSchema);
64
- case 15:
65
- forEachFormSchema(fdmField.fdmSchema, function (field) {
66
- var _field$props;
67
- var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
68
- if (findSchema) {
69
- field.componentName = findSchema.componentName;
70
- field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
71
- //处理子表查询
72
- if (findSchema.componentName == "SubFormField") {
73
- if (findSchema.fdmSchema) {
74
- var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
75
- forEachFormSchema(subFormFdmSchema, function (field) {
76
- if (field.componentName === "PageFdm") {
77
- field.props.layout = "inline";
78
- }
79
- return true;
80
- });
81
- // @ts-ignore
82
- field.props.fdmSchema = subFormFdmSchema;
83
- field.children = subFormFdmSchema.children[0].children;
84
- field.children = field.children.filter(function (item) {
85
- return !item.props.hideInSubTable;
86
- });
87
- //处理子列隐藏
88
- forEachFormSchema(field, function (subField) {
89
- if (Array.isArray(subField.children)) {
90
- subField.children = subField.children.filter(function (item) {
91
- return !item.props.hideInSubTable;
92
- });
93
- }
94
- return true;
95
- });
96
- }
97
- }
98
- }
99
- return true;
100
- });
101
- case 16:
102
- _i++;
103
- _context.next = 11;
104
- break;
105
- case 19:
106
- case "end":
107
- return _context.stop();
108
- }
109
- }, _callee);
110
- }));
111
- return _handleFormSchema.apply(this, arguments);
112
- }
113
- function handleFdmAssociationAttributeFields(_x2, _x3) {
114
- return _handleFdmAssociationAttributeFields.apply(this, arguments);
115
- } //处理关联表单
116
- function _handleFdmAssociationAttributeFields() {
117
- _handleFdmAssociationAttributeFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rootSchema, fdmSchema) {
118
- var associationAttributeFields, _i2, _associationAttribute, _attrField$props, attrField, associationAttribute, cloneSchema;
119
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
120
- while (1) switch (_context2.prev = _context2.next) {
121
- case 0:
122
- //关联属性
123
- associationAttributeFields = [];
124
- forEachFormSchema(fdmSchema, function (field) {
125
- if (field.componentName == "FdmAssociationFieldColumn") {
126
- associationAttributeFields.push(field);
127
- }
128
- return true;
129
- });
130
- _i2 = 0, _associationAttribute = associationAttributeFields;
131
- case 3:
132
- if (!(_i2 < _associationAttribute.length)) {
133
- _context2.next = 13;
134
- break;
135
- }
136
- attrField = _associationAttribute[_i2];
137
- associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : _attrField$props.associationAttribute;
138
- _context2.next = 8;
139
- return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
140
- case 8:
141
- cloneSchema = _context2.sent;
142
- if (cloneSchema) {
143
- //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
144
- attrField.componentName = cloneSchema.componentName;
145
- attrField.props = Object.assign({}, JSON.parse(JSON.stringify(cloneSchema.props)), attrField.props);
146
- attrField.props.fieldId = associationAttribute.join(".");
147
- }
148
- case 10:
149
- _i2++;
150
- _context2.next = 3;
151
- break;
152
- case 13:
153
- case "end":
154
- return _context2.stop();
155
- }
156
- }, _callee2);
157
- }));
158
- return _handleFdmAssociationAttributeFields.apply(this, arguments);
159
- }
160
- function handleAssociationForm(_x4, _x5) {
161
- return _handleAssociationForm.apply(this, arguments);
162
- }
163
- function _handleAssociationForm() {
164
- _handleAssociationForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(rootSchema, schema) {
165
- var associationAttributeFields, _i3, _associationAttribute2, _attrField$props2, _attrField$props2$fie, attrField, associationAttribute, cloneSchema;
166
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
167
- while (1) switch (_context3.prev = _context3.next) {
168
- case 0:
169
- //关联属性
170
- associationAttributeFields = []; //关联查询
171
- forEachFormSchema(schema, function (field) {
172
- if (field.componentName == "AssociationAttributeField") {
173
- associationAttributeFields.push(field);
174
- }
175
- return true;
176
- });
177
-
178
- //处理关联属性 赋值schema
179
- _i3 = 0, _associationAttribute2 = associationAttributeFields;
180
- case 3:
181
- if (!(_i3 < _associationAttribute2.length)) {
182
- _context3.next = 13;
183
- break;
184
- }
185
- attrField = _associationAttribute2[_i3];
186
- associationAttribute = (_attrField$props2 = attrField.props) === null || _attrField$props2 === void 0 ? void 0 : (_attrField$props2$fie = _attrField$props2.fieldProps) === null || _attrField$props2$fie === void 0 ? void 0 : _attrField$props2$fie.associationAttribute;
187
- _context3.next = 8;
188
- return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
189
- case 8:
190
- cloneSchema = _context3.sent;
191
- if (cloneSchema) {
192
- //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
193
- attrField.props.fieldProps.associationAttributeField = cloneSchema;
194
- }
195
- case 10:
196
- _i3++;
197
- _context3.next = 3;
198
- break;
199
- case 13:
200
- case "end":
201
- return _context3.stop();
202
- }
203
- }, _callee3);
204
- }));
205
- return _handleAssociationForm.apply(this, arguments);
206
- }
207
- function cloneAssociationAttributeFieldSchema(_x6, _x7) {
208
- return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
209
- }
210
- function _cloneAssociationAttributeFieldSchema() {
211
- _cloneAssociationAttributeFieldSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(rootSchema, associationAttribute) {
212
- var associationFormSchema;
213
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
214
- while (1) switch (_context4.prev = _context4.next) {
215
- case 0:
216
- if (Array.isArray(associationAttribute)) {
217
- _context4.next = 2;
218
- break;
219
- }
220
- return _context4.abrupt("return", null);
221
- case 2:
222
- _context4.next = 4;
223
- return getSchemaByAssociationFieldId(rootSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
224
- case 4:
225
- associationFormSchema = _context4.sent;
226
- if (!associationFormSchema) {
227
- _context4.next = 7;
228
- break;
229
- }
230
- return _context4.abrupt("return", findFieldSchema(associationFormSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]));
231
- case 7:
232
- return _context4.abrupt("return", null);
233
- case 8:
234
- case "end":
235
- return _context4.stop();
236
- }
237
- }, _callee4);
238
- }));
239
- return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
240
- }
241
- function getSchemaByAssociationFieldId(_x8, _x9) {
242
- return _getSchemaByAssociationFieldId.apply(this, arguments);
243
- }
244
- /**
245
- * 从schema中查找field
246
- * @param schema
247
- * @param fieldId
248
- */
249
- function _getSchemaByAssociationFieldId() {
250
- _getSchemaByAssociationFieldId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(rootSchema, associationFieldId) {
251
- var lastFieldId, associationFormSchema, _findAssociationField, _findAssociationField2, _findAssociationField3, findAssociationField, formId;
252
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
253
- while (1) switch (_context5.prev = _context5.next) {
254
- case 0:
255
- if (associationFieldId) {
256
- _context5.next = 2;
257
- break;
258
- }
259
- return _context5.abrupt("return", null);
260
- case 2:
261
- lastFieldId = associationFieldId.split(".").pop();
262
- associationFormSchema = null;
263
- if (!(lastFieldId == "parent")) {
264
- _context5.next = 8;
265
- break;
266
- }
267
- associationFormSchema = rootSchema.schema;
268
- _context5.next = 15;
269
- break;
270
- case 8:
271
- findAssociationField = findFieldSchema(rootSchema.schema, lastFieldId);
272
- formId = findAssociationField === null || findAssociationField === void 0 ? void 0 : (_findAssociationField = findAssociationField.props) === null || _findAssociationField === void 0 ? void 0 : (_findAssociationField2 = _findAssociationField.fieldProps) === null || _findAssociationField2 === void 0 ? void 0 : (_findAssociationField3 = _findAssociationField2.associationForm) === null || _findAssociationField3 === void 0 ? void 0 : _findAssociationField3.id;
273
- if (formId) {
274
- _context5.next = 12;
275
- break;
276
- }
277
- return _context5.abrupt("return", null);
278
- case 12:
279
- _context5.next = 14;
280
- return utils.api.getSchema(formId);
281
- case 14:
282
- associationFormSchema = _context5.sent.data;
283
- case 15:
284
- return _context5.abrupt("return", associationFormSchema);
285
- case 16:
286
- case "end":
287
- return _context5.stop();
288
- }
289
- }, _callee5);
290
- }));
291
- return _getSchemaByAssociationFieldId.apply(this, arguments);
292
- }
293
- function findFieldSchema(schema, fieldId) {
294
- var associationAttributeField = null;
295
- forEachFormSchema(schema, function (field) {
296
- if (field.props.fieldId == fieldId) {
297
- //深拷贝
298
- associationAttributeField = JSON.parse(JSON.stringify(field));
299
- return false;
300
- }
301
- return true;
302
- });
303
- return associationAttributeField;
304
- }
305
-
306
1
  /**
307
2
  * 遍历schema
308
3
  * @param schema
@@ -316,87 +11,4 @@ export function forEachFormSchema(schema, callback) {
316
11
  forEachFormSchema(child, callback);
317
12
  }
318
13
  });
319
- }
320
- var FormFieldSchema = /*#__PURE__*/function () {
321
- function FormFieldSchema(schema, parent) {
322
- var _schema$children2,
323
- _this = this;
324
- this.fieldId = void 0;
325
- this.componentName = void 0;
326
- this.parent = void 0;
327
- this.schema = void 0;
328
- this.children = void 0;
329
- this.schema = schema;
330
- this.parent = parent;
331
- this.children = [];
332
- this.fieldId = schema.props.fieldId;
333
- this.componentName = schema.componentName;
334
- (_schema$children2 = schema.children) === null || _schema$children2 === void 0 ? void 0 : _schema$children2.forEach(function (item) {
335
- _this.children.push(new FormFieldSchema(item, _this));
336
- });
337
- }
338
- var _proto = FormFieldSchema.prototype;
339
- _proto.findFieldById = function findFieldById(fieldId) {
340
- if (this.fieldId == fieldId) {
341
- return this;
342
- }
343
- for (var _iterator = _createForOfIteratorHelperLoose(this.children), _step; !(_step = _iterator()).done;) {
344
- var _child = _step.value;
345
- if (_child.findFieldById(fieldId)) {
346
- return _child.findFieldById(fieldId);
347
- }
348
- }
349
- return null;
350
- };
351
- _proto.getFieldPaths = function getFieldPaths() {
352
- var paths = [];
353
- function loopParent(field) {
354
- if (field !== null && field !== void 0 && field.parent) {
355
- paths.push(field.parent);
356
- loopParent(field.parent);
357
- }
358
- }
359
- loopParent(this);
360
- paths.reverse();
361
- paths = paths.filter(function (item) {
362
- return ["SubFormField"].includes(item.componentName);
363
- });
364
- paths.push(this);
365
- return paths.map(function (item) {
366
- return item.fieldId;
367
- }).join(".");
368
- };
369
- return FormFieldSchema;
370
- }();
371
- export function getAdminFormSchema(_x10) {
372
- return _getAdminFormSchema.apply(this, arguments);
373
- }
374
- function _getAdminFormSchema() {
375
- _getAdminFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
376
- var res, schema;
377
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
378
- while (1) switch (_context6.prev = _context6.next) {
379
- case 0:
380
- _context6.next = 2;
381
- return utils.api.getSchema(id, true);
382
- case 2:
383
- res = _context6.sent;
384
- if (!res.success) {
385
- _context6.next = 8;
386
- break;
387
- }
388
- schema = JSON.parse(JSON.stringify(res.data));
389
- _context6.next = 7;
390
- return handleFormSchema(schema);
391
- case 7:
392
- return _context6.abrupt("return", schema);
393
- case 8:
394
- return _context6.abrupt("return", null);
395
- case 9:
396
- case "end":
397
- return _context6.stop();
398
- }
399
- }, _callee6);
400
- }));
401
- return _getAdminFormSchema.apply(this, arguments);
402
14
  }
@@ -0,0 +1,3 @@
1
+ export declare const FormIds: {
2
+ printTemplate: string;
3
+ };
@@ -0,0 +1,3 @@
1
+ export var FormIds = {
2
+ printTemplate: "98cae197-549c-44c1-a3f5-0907f7d2f11b"
3
+ };
@@ -1,4 +1,6 @@
1
+ export { print, getFormPrintTemplates } from "./print-form";
1
2
  export { showForm } from "./page-form";
3
+ export { showFormGroup } from "./page-form-group";
2
4
  export { showFormDataManager } from "./page-form-data-manager";
3
5
  export { showFormDataManagerGroup } from "./page-form-data-manager-group";
4
6
  export { show } from "./page-show";
@@ -1,6 +1,8 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ export { print, getFormPrintTemplates } from "./print-form";
3
4
  export { showForm } from "./page-form";
5
+ export { showFormGroup } from "./page-form-group";
4
6
  export { showFormDataManager } from "./page-form-data-manager";
5
7
  export { showFormDataManagerGroup } from "./page-form-data-manager-group";
6
8
  export { show } from "./page-show";
@@ -4,6 +4,7 @@ export interface ShowFormDataManagerGroupProps {
4
4
  container?: HTMLDivElement;
5
5
  layout?: PageLayoutType;
6
6
  mode?: PageFormDataManagerModeType;
7
+ title?: string;
7
8
  items: any[];
8
9
  extraProps?: any;
9
10
  defaultSelectedRows?: any[];
@@ -13,5 +14,6 @@ export interface ShowFormDataManagerGroupProps {
13
14
  data: any[];
14
15
  total: number;
15
16
  }) => void | Promise<void>;
17
+ pageRef?: (page: any) => void;
16
18
  }
17
19
  export declare function showFormDataManagerGroup(options: ShowFormDataManagerGroupProps): Promise<any | any[]>;