@zhubangyun/lowcode-core 5.5.81 → 5.5.83

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.
@@ -0,0 +1,5 @@
1
+ interface LoadMaterialsProps {
2
+ children: any;
3
+ }
4
+ export declare function LoadMaterials(props: LoadMaterialsProps): any;
5
+ export {};
@@ -0,0 +1,77 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import React, { useEffect, useState } from "react";
4
+ import { PageLoading } from "../page-loading";
5
+ import { loadPlugins } from "../../utils/common";
6
+ export function LoadMaterials(props) {
7
+ var _useState = useState(false),
8
+ init = _useState[0],
9
+ setInit = _useState[1];
10
+ useEffect(function () {
11
+ initialize()["finally"](function () {
12
+ return setInit(true);
13
+ });
14
+ }, []);
15
+ function initialize() {
16
+ return _initialize.apply(this, arguments);
17
+ }
18
+ function _initialize() {
19
+ _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _context.next = 2;
24
+ return loadMaterials();
25
+ case 2:
26
+ case "end":
27
+ return _context.stop();
28
+ }
29
+ }, _callee);
30
+ }));
31
+ return _initialize.apply(this, arguments);
32
+ }
33
+ if (init) {
34
+ return props.children;
35
+ } else {
36
+ return /*#__PURE__*/React.createElement(PageLoading, {
37
+ loading: true
38
+ });
39
+ }
40
+ }
41
+ function loadMaterials() {
42
+ return _loadMaterials.apply(this, arguments);
43
+ }
44
+ function _loadMaterials() {
45
+ _loadMaterials = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
46
+ var components, urls;
47
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
48
+ while (1) switch (_context2.prev = _context2.next) {
49
+ case 0:
50
+ components = {};
51
+ urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.6.1/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
52
+ _context2.next = 4;
53
+ return loadPlugins(urls.map(function (url) {
54
+ return "https://cdn.zhiyunhe.com/plugin/" + url;
55
+ }));
56
+ case 4:
57
+ ["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
58
+ var data = window[lib];
59
+ if (data) {
60
+ Object.entries(data).forEach(function (_ref) {
61
+ var key = _ref[0],
62
+ value = _ref[1];
63
+ // @ts-ignore
64
+ components[key] = value;
65
+ });
66
+ }
67
+ });
68
+ window._components = components;
69
+ return _context2.abrupt("return", components);
70
+ case 7:
71
+ case "end":
72
+ return _context2.stop();
73
+ }
74
+ }, _callee2);
75
+ }));
76
+ return _loadMaterials.apply(this, arguments);
77
+ }
@@ -3,6 +3,6 @@ import "./index.less";
3
3
  export interface PageLadingProps {
4
4
  loading: boolean;
5
5
  background?: string;
6
- children: any;
6
+ children?: any;
7
7
  }
8
8
  export declare function PageLoading(props: PageLadingProps): import("react").JSX.Element;
@@ -13,7 +13,7 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
13
13
  args[_key] = arguments[_key];
14
14
  }
15
15
  _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
16
- _this.key = Date.now().toString(36);
16
+ _this.key = Date.now().toString(36) + Math.random().toString(36);
17
17
  _this.node = void 0;
18
18
  return _this;
19
19
  }
@@ -21,7 +21,7 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
21
21
  var _proto = ReactRender.prototype;
22
22
  _proto.render = function render() {
23
23
  var _this2 = this;
24
- var components = this.props.components;
24
+ var components = this.props.components || window._components;
25
25
  // @ts-ignore
26
26
  return /*#__PURE__*/React.createElement(_ConfigProvider, {
27
27
  locale: zhCN
@@ -32,7 +32,7 @@ export var ReactRender = /*#__PURE__*/function (_PureComponent) {
32
32
  _this2.node = node === null || node === void 0 ? void 0 : node.__ref;
33
33
  },
34
34
  thisRequiredInJSE: true,
35
- components: components || window._components || {},
35
+ components: components,
36
36
  appHelper: {
37
37
  utils: utils,
38
38
  requestHandlersMap: {
package/es/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./index.less";
2
2
  import utils from "./utils";
3
+ export { LoadMaterials } from "./components/load-materials";
3
4
  export { PageLoading } from "./components/page-loading";
4
5
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
5
6
  export { Layout } from "./components/layout";
package/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import "./index.less";
2
2
  import utils from "./utils";
3
3
  import { ReactRender } from "./components/react-render";
4
+ export { LoadMaterials } from "./components/load-materials";
4
5
  export { PageLoading } from "./components/page-loading";
5
6
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
6
7
  export { Layout } from "./components/layout";
@@ -1,33 +1,7 @@
1
- export declare function handleFormSchema(schema: any): void;
1
+ export declare function handleFormSchema(schema: any): Promise<void>;
2
2
  /**
3
3
  * 遍历schema
4
4
  * @param schema
5
5
  * @param callback 返回true 继续往下遍历
6
6
  */
7
- export declare function forEachFormSchema(schema: FormSchema, callback: (child: FormSchema, index: number, children: any[]) => boolean): void;
8
- export interface FormSchema {
9
- id?: string;
10
- state: any;
11
- methods: any;
12
- componentName: string;
13
- formId?: string;
14
- tableName?: string;
15
- schemaName?: string;
16
- columnName?: string;
17
- fdmSchema?: any;
18
- props: FormSchemaProps;
19
- children?: FormSchema[];
20
- }
21
- export interface FormSchemaProps {
22
- fieldId: string;
23
- label: string;
24
- fieldSchema?: any;
25
- columnName: string;
26
- array: boolean;
27
- layout?: "inline";
28
- fdmSchema?: any;
29
- associationForm: {
30
- id: string;
31
- fieldId: string;
32
- };
33
- }
7
+ export declare function forEachFormSchema(schema: any, callback: (child: any, index: number, children: any[]) => boolean): void;
@@ -1,54 +1,7 @@
1
- export function handleFormSchema(schema) {
2
- var fdmItems = [];
3
- var fieldIdMap = new Map();
4
- schema.state = schema.state || {};
5
- schema.methods = schema.methods || {};
6
- forEachFormSchema(schema, function (field) {
7
- if (field.fdmSchema) {
8
- var _field$fdmSchema, _field$fdmSchema2;
9
- fdmItems.push(field);
10
- field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
11
- field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
12
- field.fdmSchema.props.style.height = "100%";
13
- // @ts-ignore
14
- field.fdmSchema.props.noContainer = true;
15
- }
16
- if (field.props.fieldId) {
17
- //删除children防止循环
18
- var copyField = JSON.parse(JSON.stringify(field));
19
- delete copyField.children;
20
- fieldIdMap.set(field.props.fieldId, copyField);
21
- }
22
- return true;
23
- });
24
- //处理查询列
25
- fdmItems.forEach(function (fdmField) {
26
- forEachFormSchema(fdmField.fdmSchema, function (field) {
27
- var _field$props;
28
- var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
29
- if (findSchema) {
30
- field.componentName = findSchema.componentName;
31
- field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
32
- //处理子表查询
33
- if (findSchema.componentName == "SubFormField") {
34
- if (findSchema.fdmSchema) {
35
- var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
36
- forEachFormSchema(subFormFdmSchema, function (field) {
37
- if (field.componentName === "PageFdm") {
38
- field.props.layout = "inline";
39
- }
40
- return true;
41
- });
42
- // @ts-ignore
43
- field.props.fdmSchema = subFormFdmSchema;
44
- field.children = subFormFdmSchema.children[0].children;
45
- console.log(subFormFdmSchema);
46
- }
47
- }
48
- }
49
- return true;
50
- });
51
- });
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ export function handleFormSchema(_x) {
4
+ return _handleFormSchema.apply(this, arguments);
52
5
  }
53
6
 
54
7
  /**
@@ -56,6 +9,71 @@ export function handleFormSchema(schema) {
56
9
  * @param schema
57
10
  * @param callback 返回true 继续往下遍历
58
11
  */
12
+ function _handleFormSchema() {
13
+ _handleFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(schema) {
14
+ var fdmItems, associationFields, fieldIdMap;
15
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
16
+ while (1) switch (_context.prev = _context.next) {
17
+ case 0:
18
+ fdmItems = [];
19
+ associationFields = [];
20
+ fieldIdMap = new Map();
21
+ schema.state = schema.state || {};
22
+ schema.methods = schema.methods || {};
23
+ forEachFormSchema(schema, function (field) {
24
+ if (field.fdmSchema) {
25
+ var _field$fdmSchema, _field$fdmSchema2;
26
+ fdmItems.push(field);
27
+ field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
28
+ field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
29
+ field.fdmSchema.props.style.height = "100%";
30
+ }
31
+ if (field.props.fieldId) {
32
+ //删除children防止循环
33
+ var copyField = JSON.parse(JSON.stringify(field));
34
+ delete copyField.children;
35
+ fieldIdMap.set(field.props.fieldId, copyField);
36
+ }
37
+ if (field.componentName == "AssociationField") {
38
+ associationFields.push(field);
39
+ }
40
+ return true;
41
+ });
42
+ //处理查询列
43
+ fdmItems.forEach(function (fdmField) {
44
+ forEachFormSchema(fdmField.fdmSchema, function (field) {
45
+ var _field$props;
46
+ var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
47
+ if (findSchema) {
48
+ field.componentName = findSchema.componentName;
49
+ field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
50
+ //处理子表查询
51
+ if (findSchema.componentName == "SubFormField") {
52
+ if (findSchema.fdmSchema) {
53
+ var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
54
+ forEachFormSchema(subFormFdmSchema, function (field) {
55
+ if (field.componentName === "PageFdm") {
56
+ field.props.layout = "inline";
57
+ }
58
+ return true;
59
+ });
60
+ // @ts-ignore
61
+ field.props.fdmSchema = subFormFdmSchema;
62
+ field.children = subFormFdmSchema.children[0].children;
63
+ }
64
+ }
65
+ }
66
+ return true;
67
+ });
68
+ });
69
+ case 7:
70
+ case "end":
71
+ return _context.stop();
72
+ }
73
+ }, _callee);
74
+ }));
75
+ return _handleFormSchema.apply(this, arguments);
76
+ }
59
77
  export function forEachFormSchema(schema, callback) {
60
78
  var _schema$children;
61
79
  schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : _schema$children.forEach(function (child, index, children) {
@@ -44,11 +44,15 @@ export function hideLoading() {
44
44
  }
45
45
  function _hideLoading() {
46
46
  _hideLoading = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
47
+ var loading;
47
48
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
48
49
  while (1) switch (_context2.prev = _context2.next) {
49
50
  case 0:
50
- debounceHide();
51
- case 1:
51
+ loading = document.getElementById("fullscreen-loading");
52
+ if (loading) {
53
+ loading.style.display = "none";
54
+ }
55
+ case 2:
52
56
  case "end":
53
57
  return _context2.stop();
54
58
  }
@@ -34,10 +34,7 @@ export function PageLoadSchema(props) {
34
34
  }, []);
35
35
  if (loading) {
36
36
  return /*#__PURE__*/React.createElement(PageLoading, {
37
- loading: true,
38
- style: {
39
- background: "white"
40
- }
37
+ loading: true
41
38
  });
42
39
  }
43
40
  if (!schema) {
@@ -0,0 +1,5 @@
1
+ interface LoadMaterialsProps {
2
+ children: any;
3
+ }
4
+ export declare function LoadMaterials(props: LoadMaterialsProps): any;
5
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.LoadMaterials = LoadMaterials;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _pageLoading = require("../page-loading");
10
+ var _common = require("../../utils/common");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
+ function LoadMaterials(props) {
14
+ var _useState = (0, _react.useState)(false),
15
+ init = _useState[0],
16
+ setInit = _useState[1];
17
+ (0, _react.useEffect)(function () {
18
+ initialize()["finally"](function () {
19
+ return setInit(true);
20
+ });
21
+ }, []);
22
+ function initialize() {
23
+ return _initialize.apply(this, arguments);
24
+ }
25
+ function _initialize() {
26
+ _initialize = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
27
+ return _regenerator["default"].wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ _context.next = 2;
31
+ return loadMaterials();
32
+ case 2:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee);
37
+ }));
38
+ return _initialize.apply(this, arguments);
39
+ }
40
+ if (init) {
41
+ return props.children;
42
+ } else {
43
+ return /*#__PURE__*/_react["default"].createElement(_pageLoading.PageLoading, {
44
+ loading: true
45
+ });
46
+ }
47
+ }
48
+ function loadMaterials() {
49
+ return _loadMaterials.apply(this, arguments);
50
+ }
51
+ function _loadMaterials() {
52
+ _loadMaterials = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
53
+ var components, urls;
54
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
55
+ while (1) switch (_context2.prev = _context2.next) {
56
+ case 0:
57
+ components = {};
58
+ urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.6.1/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
59
+ _context2.next = 4;
60
+ return (0, _common.loadPlugins)(urls.map(function (url) {
61
+ return "https://cdn.zhiyunhe.com/plugin/" + url;
62
+ }));
63
+ case 4:
64
+ ["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
65
+ var data = window[lib];
66
+ if (data) {
67
+ Object.entries(data).forEach(function (_ref) {
68
+ var key = _ref[0],
69
+ value = _ref[1];
70
+ // @ts-ignore
71
+ components[key] = value;
72
+ });
73
+ }
74
+ });
75
+ window._components = components;
76
+ return _context2.abrupt("return", components);
77
+ case 7:
78
+ case "end":
79
+ return _context2.stop();
80
+ }
81
+ }, _callee2);
82
+ }));
83
+ return _loadMaterials.apply(this, arguments);
84
+ }
@@ -3,6 +3,6 @@ import "./index.less";
3
3
  export interface PageLadingProps {
4
4
  loading: boolean;
5
5
  background?: string;
6
- children: any;
6
+ children?: any;
7
7
  }
8
8
  export declare function PageLoading(props: PageLadingProps): import("react").JSX.Element;
@@ -18,7 +18,7 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
18
18
  args[_key] = arguments[_key];
19
19
  }
20
20
  _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
21
- _this.key = Date.now().toString(36);
21
+ _this.key = Date.now().toString(36) + Math.random().toString(36);
22
22
  _this.node = void 0;
23
23
  return _this;
24
24
  }
@@ -26,7 +26,7 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
26
26
  var _proto = ReactRender.prototype;
27
27
  _proto.render = function render() {
28
28
  var _this2 = this;
29
- var components = this.props.components;
29
+ var components = this.props.components || window._components;
30
30
  // @ts-ignore
31
31
  return /*#__PURE__*/React.createElement(_configProvider["default"], {
32
32
  locale: _zh_CN["default"]
@@ -37,7 +37,7 @@ var ReactRender = exports.ReactRender = /*#__PURE__*/function (_PureComponent) {
37
37
  _this2.node = node === null || node === void 0 ? void 0 : node.__ref;
38
38
  },
39
39
  thisRequiredInJSE: true,
40
- components: components || window._components || {},
40
+ components: components,
41
41
  appHelper: {
42
42
  utils: _utils["default"],
43
43
  requestHandlersMap: {
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./index.less";
2
2
  import utils from "./utils";
3
+ export { LoadMaterials } from "./components/load-materials";
3
4
  export { PageLoading } from "./components/page-loading";
4
5
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
5
6
  export { Layout } from "./components/layout";
package/lib/index.js CHANGED
@@ -2,12 +2,14 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.PageLoading = exports.Layout = void 0;
5
+ exports.apiRequest = exports.RestFormApi = exports.RestApi = exports.PageLoading = exports.LoadMaterials = exports.Layout = void 0;
6
6
  require("./index.less");
7
7
  var _utils = _interopRequireDefault(require("./utils"));
8
8
  exports.utils = _utils["default"];
9
9
  var _reactRender = require("./components/react-render");
10
10
  exports.ReactRender = _reactRender.ReactRender;
11
+ var _loadMaterials = require("./components/load-materials");
12
+ exports.LoadMaterials = _loadMaterials.LoadMaterials;
11
13
  var _pageLoading = require("./components/page-loading");
12
14
  exports.PageLoading = _pageLoading.PageLoading;
13
15
  var _api = require("./utils/api");
@@ -1,33 +1,7 @@
1
- export declare function handleFormSchema(schema: any): void;
1
+ export declare function handleFormSchema(schema: any): Promise<void>;
2
2
  /**
3
3
  * 遍历schema
4
4
  * @param schema
5
5
  * @param callback 返回true 继续往下遍历
6
6
  */
7
- export declare function forEachFormSchema(schema: FormSchema, callback: (child: FormSchema, index: number, children: any[]) => boolean): void;
8
- export interface FormSchema {
9
- id?: string;
10
- state: any;
11
- methods: any;
12
- componentName: string;
13
- formId?: string;
14
- tableName?: string;
15
- schemaName?: string;
16
- columnName?: string;
17
- fdmSchema?: any;
18
- props: FormSchemaProps;
19
- children?: FormSchema[];
20
- }
21
- export interface FormSchemaProps {
22
- fieldId: string;
23
- label: string;
24
- fieldSchema?: any;
25
- columnName: string;
26
- array: boolean;
27
- layout?: "inline";
28
- fdmSchema?: any;
29
- associationForm: {
30
- id: string;
31
- fieldId: string;
32
- };
33
- }
7
+ export declare function forEachFormSchema(schema: any, callback: (child: any, index: number, children: any[]) => boolean): void;
@@ -1,66 +1,84 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  exports.__esModule = true;
4
5
  exports.forEachFormSchema = forEachFormSchema;
5
6
  exports.handleFormSchema = handleFormSchema;
6
- function handleFormSchema(schema) {
7
- var fdmItems = [];
8
- var fieldIdMap = new Map();
9
- schema.state = schema.state || {};
10
- schema.methods = schema.methods || {};
11
- forEachFormSchema(schema, function (field) {
12
- if (field.fdmSchema) {
13
- var _field$fdmSchema, _field$fdmSchema2;
14
- fdmItems.push(field);
15
- field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
16
- field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
17
- field.fdmSchema.props.style.height = "100%";
18
- // @ts-ignore
19
- field.fdmSchema.props.noContainer = true;
20
- }
21
- if (field.props.fieldId) {
22
- //删除children防止循环
23
- var copyField = JSON.parse(JSON.stringify(field));
24
- delete copyField.children;
25
- fieldIdMap.set(field.props.fieldId, copyField);
26
- }
27
- return true;
28
- });
29
- //处理查询列
30
- fdmItems.forEach(function (fdmField) {
31
- forEachFormSchema(fdmField.fdmSchema, function (field) {
32
- var _field$props;
33
- var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
34
- if (findSchema) {
35
- field.componentName = findSchema.componentName;
36
- field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
37
- //处理子表查询
38
- if (findSchema.componentName == "SubFormField") {
39
- if (findSchema.fdmSchema) {
40
- var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
41
- forEachFormSchema(subFormFdmSchema, function (field) {
42
- if (field.componentName === "PageFdm") {
43
- field.props.layout = "inline";
44
- }
45
- return true;
46
- });
47
- // @ts-ignore
48
- field.props.fdmSchema = subFormFdmSchema;
49
- field.children = subFormFdmSchema.children[0].children;
50
- console.log(subFormFdmSchema);
51
- }
52
- }
53
- }
54
- return true;
55
- });
56
- });
7
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ function handleFormSchema(_x) {
10
+ return _handleFormSchema.apply(this, arguments);
57
11
  }
58
-
59
12
  /**
60
13
  * 遍历schema
61
14
  * @param schema
62
15
  * @param callback 返回true 继续往下遍历
63
16
  */
17
+ function _handleFormSchema() {
18
+ _handleFormSchema = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(schema) {
19
+ var fdmItems, associationFields, fieldIdMap;
20
+ return _regenerator["default"].wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ fdmItems = [];
24
+ associationFields = [];
25
+ fieldIdMap = new Map();
26
+ schema.state = schema.state || {};
27
+ schema.methods = schema.methods || {};
28
+ forEachFormSchema(schema, function (field) {
29
+ if (field.fdmSchema) {
30
+ var _field$fdmSchema, _field$fdmSchema2;
31
+ fdmItems.push(field);
32
+ field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
33
+ field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
34
+ field.fdmSchema.props.style.height = "100%";
35
+ }
36
+ if (field.props.fieldId) {
37
+ //删除children防止循环
38
+ var copyField = JSON.parse(JSON.stringify(field));
39
+ delete copyField.children;
40
+ fieldIdMap.set(field.props.fieldId, copyField);
41
+ }
42
+ if (field.componentName == "AssociationField") {
43
+ associationFields.push(field);
44
+ }
45
+ return true;
46
+ });
47
+ //处理查询列
48
+ fdmItems.forEach(function (fdmField) {
49
+ forEachFormSchema(fdmField.fdmSchema, function (field) {
50
+ var _field$props;
51
+ var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
52
+ if (findSchema) {
53
+ field.componentName = findSchema.componentName;
54
+ field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
55
+ //处理子表查询
56
+ if (findSchema.componentName == "SubFormField") {
57
+ if (findSchema.fdmSchema) {
58
+ var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
59
+ forEachFormSchema(subFormFdmSchema, function (field) {
60
+ if (field.componentName === "PageFdm") {
61
+ field.props.layout = "inline";
62
+ }
63
+ return true;
64
+ });
65
+ // @ts-ignore
66
+ field.props.fdmSchema = subFormFdmSchema;
67
+ field.children = subFormFdmSchema.children[0].children;
68
+ }
69
+ }
70
+ }
71
+ return true;
72
+ });
73
+ });
74
+ case 7:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }, _callee);
79
+ }));
80
+ return _handleFormSchema.apply(this, arguments);
81
+ }
64
82
  function forEachFormSchema(schema, callback) {
65
83
  var _schema$children;
66
84
  schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : _schema$children.forEach(function (child, index, children) {
@@ -54,11 +54,15 @@ function hideLoading() {
54
54
  }
55
55
  function _hideLoading() {
56
56
  _hideLoading = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
57
+ var loading;
57
58
  return _regenerator["default"].wrap(function _callee2$(_context2) {
58
59
  while (1) switch (_context2.prev = _context2.next) {
59
60
  case 0:
60
- debounceHide();
61
- case 1:
61
+ loading = document.getElementById("fullscreen-loading");
62
+ if (loading) {
63
+ loading.style.display = "none";
64
+ }
65
+ case 2:
62
66
  case "end":
63
67
  return _context2.stop();
64
68
  }
@@ -39,10 +39,7 @@ function PageLoadSchema(props) {
39
39
  }, []);
40
40
  if (loading) {
41
41
  return /*#__PURE__*/React.createElement(_pageLoading.PageLoading, {
42
- loading: true,
43
- style: {
44
- background: "white"
45
- }
42
+ loading: true
46
43
  });
47
44
  }
48
45
  if (!schema) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "5.5.081",
3
+ "version": "5.5.083",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",