ronds-metadata 1.2.80 → 1.2.82

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 (82) hide show
  1. package/es/comps/DynamicPorts/comps/DragNode.d.ts +1 -1
  2. package/es/comps/DynamicPorts/comps/NodeElement.d.ts +1 -1
  3. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.d.ts +2 -1
  4. package/es/comps/DynamicPorts/index.d.ts +2 -1
  5. package/es/comps/Editable/DataCell/ButtonCell.d.ts +1 -1
  6. package/es/comps/Editable/DataCell/ColorPicker.d.ts +1 -1
  7. package/es/comps/Editable/DataCell/Input.d.ts +1 -1
  8. package/es/comps/Editable/DataCell/Number.d.ts +1 -1
  9. package/es/comps/Editable/DataCell/Select.d.ts +1 -1
  10. package/es/comps/Editable/DataCell/Switch.d.ts +1 -1
  11. package/es/comps/Editable/comps/EditableAction.d.ts +2 -1
  12. package/es/comps/Editable/comps/Texty.d.ts +1 -1
  13. package/es/comps/Editable/index.d.ts +2 -1
  14. package/es/comps/Editable/utils.d.ts +2 -1
  15. package/es/comps/FileView/index.d.ts +2 -1
  16. package/es/comps/FormGenerator/comps/Canvas/Preview.d.ts +6 -0
  17. package/es/comps/FormGenerator/comps/Canvas/Preview.js +58 -0
  18. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.d.ts +2 -1
  19. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.d.ts +1 -1
  20. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.d.ts +1 -1
  21. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.d.ts +1 -1
  22. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.d.ts +2 -1
  23. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.d.ts +2 -1
  24. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.d.ts +1 -1
  25. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/NumberRange.d.ts +1 -1
  26. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.d.ts +2 -1
  27. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.d.ts +1 -1
  28. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.d.ts +2 -1
  29. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.d.ts +2 -1
  30. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.d.ts +1 -1
  31. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -1
  32. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.d.ts +1 -1
  33. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.d.ts +1 -1
  34. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.d.ts +2 -1
  35. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.d.ts +2 -1
  36. package/es/comps/FormGenerator/comps/Canvas/core/index.d.ts +1 -1
  37. package/es/comps/FormGenerator/comps/Canvas/index.d.ts +2 -1
  38. package/es/comps/FormGenerator/comps/Canvas/index.js +28 -13
  39. package/es/comps/FormGenerator/comps/Settings/index.d.ts +2 -1
  40. package/es/comps/FormGenerator/comps/Sidebar/Elements.d.ts +1 -1
  41. package/es/comps/FormGenerator/comps/Sidebar/JsonSchema.d.ts +1 -1
  42. package/es/comps/FormGenerator/comps/Sidebar/index.d.ts +2 -1
  43. package/es/comps/FormGenerator/comps/Sidebar/index.js +30 -4
  44. package/es/comps/FormGenerator/index.d.ts +2 -1
  45. package/es/comps/FormGenerator/interface.d.ts +5 -1
  46. package/es/comps/FormGenerator/interface.js +1 -1
  47. package/es/comps/FormGenerator/settings/index.d.ts +1 -0
  48. package/es/comps/FormGenerator/settings/index.js +3 -2
  49. package/es/comps/JsonEdit/index.d.ts +2 -1
  50. package/es/comps/JsonView/index.d.ts +2 -1
  51. package/es/comps/JsonView/index.less +41 -41
  52. package/es/comps/MdEdit/index.d.ts +2 -1
  53. package/es/comps/MdEdit/index.less +6 -6
  54. package/es/comps/MdEditPro/index.d.ts +2 -1
  55. package/es/comps/MdNavbar/index.d.ts +2 -1
  56. package/es/comps/MdView/index.d.ts +1 -1
  57. package/es/comps/MetadataEdit/components/MetaFieldsEdit.d.ts +2 -1
  58. package/es/comps/MetadataEdit/components/MetaPropsEdit.d.ts +2 -1
  59. package/es/comps/MetadataEdit/index.d.ts +2 -1
  60. package/es/comps/MetadataEdit/index.less +10 -10
  61. package/es/comps/MetadataEdit/type.d.ts +20 -20
  62. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.d.ts +2 -1
  63. package/es/comps/MetadataEditV2/components/MetaPropsEdit.d.ts +2 -1
  64. package/es/comps/MetadataEditV2/index.d.ts +2 -1
  65. package/es/comps/MetadataForm/DataCell/Array.d.ts +1 -1
  66. package/es/comps/MetadataForm/DataCell/Input.d.ts +1 -1
  67. package/es/comps/MetadataForm/DataCell/Number.d.ts +1 -1
  68. package/es/comps/MetadataForm/DataCell/Ref.d.ts +1 -1
  69. package/es/comps/MetadataForm/DataCell/Select.d.ts +1 -1
  70. package/es/comps/MetadataForm/DataCell/Select.js +1 -1
  71. package/es/comps/MetadataForm/DataCell/Switch.d.ts +1 -1
  72. package/es/comps/MetadataForm/DataCell/layout/TableArray.d.ts +2 -1
  73. package/es/comps/MetadataForm/DataCell/plugin/NumberRange.d.ts +2 -1
  74. package/es/comps/MetadataForm/HOC/index.d.ts +2 -1
  75. package/es/comps/MetadataForm/HOC/index.less +41 -41
  76. package/es/comps/MetadataForm/index.d.ts +2 -1
  77. package/es/comps/MetadataForm/utils.d.ts +3 -2
  78. package/es/comps/Split/index.d.ts +1 -1
  79. package/es/framework/RxStore/demo/index.d.ts +2 -1
  80. package/es/framework/metadata/types.d.ts +98 -98
  81. package/es/utils.js +6 -4
  82. package/package.json +103 -103
@@ -3,5 +3,5 @@ import '../index.less';
3
3
  interface IDragNodeProps {
4
4
  data: NDPGraph.Node;
5
5
  }
6
- declare const DragNode: (props: IDragNodeProps) => JSX.Element;
6
+ declare const DragNode: (props: IDragNodeProps) => import("react").JSX.Element;
7
7
  export default DragNode;
@@ -2,5 +2,5 @@ import '../index.less';
2
2
  interface NodeElementProps {
3
3
  node?: Node;
4
4
  }
5
- declare const NodeElement: (props: NodeElementProps) => JSX.Element;
5
+ declare const NodeElement: (props: NodeElementProps) => import("react").JSX.Element;
6
6
  export default NodeElement;
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
3
  interface INodeContextMenuProps {
3
4
  graph: any;
4
5
  data: any;
5
6
  }
6
- declare const NodeContextMenu: (props: INodeContextMenuProps) => JSX.Element;
7
+ declare const NodeContextMenu: (props: INodeContextMenuProps) => React.JSX.Element;
7
8
  export default NodeContextMenu;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
3
  import './comps/shape/connector';
3
4
  import DPGraph from './graph';
@@ -20,5 +21,5 @@ interface IDynamicPortsProps {
20
21
  */
21
22
  getDPGraphInstance?: (data: DPGraph) => void;
22
23
  }
23
- declare const DynamicPorts: (props: IDynamicPortsProps) => JSX.Element;
24
+ declare const DynamicPorts: (props: IDynamicPortsProps) => React.JSX.Element;
24
25
  export default DynamicPorts;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { EditableCellProps } from '../interface';
3
- declare function Index(props: EditableCellProps): JSX.Element;
3
+ declare function Index(props: EditableCellProps): React.JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof Index>;
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { EditableCellProps } from '../interface';
3
- declare function Index(props: EditableCellProps): JSX.Element;
3
+ declare function Index(props: EditableCellProps): React.JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof Index>;
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { EditableCellProps } from '../interface';
3
- declare function Index(props: EditableCellProps): JSX.Element;
3
+ declare function Index(props: EditableCellProps): React.JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof Index>;
5
5
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare function Index(props: any): JSX.Element;
2
+ declare function Index(props: any): React.JSX.Element;
3
3
  declare const _default: React.MemoExoticComponent<typeof Index>;
4
4
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { EditableCellProps } from '../interface';
3
- declare function Index(props: EditableCellProps): JSX.Element;
3
+ declare function Index(props: EditableCellProps): React.JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof Index>;
5
5
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare function Index(props: any): JSX.Element;
2
+ declare function Index(props: any): React.JSX.Element;
3
3
  declare const _default: React.MemoExoticComponent<typeof Index>;
4
4
  export default _default;
@@ -1,6 +1,7 @@
1
+ import React from 'react';
1
2
  interface IEditableActionProps {
2
3
  type: 'single' | 'multiple' | 'freedom';
3
4
  record: any;
4
5
  }
5
- declare const EditableAction: (props: IEditableActionProps) => JSX.Element;
6
+ declare const EditableAction: (props: IEditableActionProps) => React.JSX.Element;
6
7
  export default EditableAction;
@@ -69,7 +69,7 @@ declare class Texty extends React.PureComponent<ITextyProps, any> {
69
69
  private showTimer;
70
70
  componentDidUpdate(): void;
71
71
  componentWillUnmount(): void;
72
- render(): JSX.Element;
72
+ render(): React.JSX.Element;
73
73
  renderTooltip: ({ ref, style, placement, arrowProps }: any) => React.ReactPortal;
74
74
  setTargetRef: (ref: any) => void;
75
75
  handleMouseEvent: (e: any) => void;
@@ -1,4 +1,5 @@
1
1
  import { TableProps } from 'antd';
2
+ import React from 'react';
2
3
  import { BehaviorSubject } from 'rxjs';
3
4
  import { EditColumnsType, IEditableStream } from './interface';
4
5
  import './index.less';
@@ -74,5 +75,5 @@ interface IEditableProps<R = any> {
74
75
  */
75
76
  getStreamInstance?: (subject: BehaviorSubject<IEditableStream | undefined>) => void;
76
77
  }
77
- declare const Editable: (props: IEditableProps) => JSX.Element;
78
+ declare const Editable: (props: IEditableProps) => React.JSX.Element;
78
79
  export default Editable;
@@ -1,5 +1,6 @@
1
+ import React from 'react';
1
2
  import { EditableCellProps } from './interface';
2
- export declare function getDataCell(item: EditableCellProps): JSX.Element;
3
+ export declare function getDataCell(item: EditableCellProps): React.JSX.Element;
3
4
  export declare function isFreeEditRow(curRow: any, rowIndex: number): boolean;
4
5
  export declare function isFreeEditCell(editCellKey: any, dataIndex: string, rowIndex: number): boolean;
5
6
  export declare function isCellDisabled(record: any, cellDisabled?: string): boolean;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  interface IFileViewProps {
2
3
  /**
3
4
  * 文件远程链接
@@ -16,5 +17,5 @@ interface IFileViewProps {
16
17
  */
17
18
  limit?: number;
18
19
  }
19
- declare const FileView: (props: IFileViewProps) => JSX.Element;
20
+ declare const FileView: (props: IFileViewProps) => React.JSX.Element;
20
21
  export default FileView;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface IPreviewProps {
3
+ schema: any[];
4
+ }
5
+ declare const Preview: (props: IPreviewProps) => React.JSX.Element;
6
+ export default Preview;
@@ -0,0 +1,58 @@
1
+ import "antd/es/button/style";
2
+ import _Button from "antd/es/button";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import MetadataForm from '@/comps/MetadataForm';
5
+ import Split from '../../../../comps/Split';
6
+ import React from 'react';
7
+ import JsonView from '@/comps/JsonView';
8
+ var Preview = function Preview(props) {
9
+ var schema = props.schema;
10
+ var _React$useState = React.useState(''),
11
+ _React$useState2 = _slicedToArray(_React$useState, 2),
12
+ json = _React$useState2[0],
13
+ setJson = _React$useState2[1];
14
+ var formRef = React.useRef();
15
+ var onFinish = function onFinish(vals) {
16
+ setJson(JSON.stringify(vals));
17
+ };
18
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19
+ style: {
20
+ width: '100%',
21
+ height: 'calc(100% - 40px)',
22
+ background: 'var(--ronds-metadata-color-bg-2)',
23
+ padding: '8px',
24
+ border: '1px solid var(--ronds-metadata-color-border-1)',
25
+ overflowY: 'auto'
26
+ }
27
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
28
+ type: "primary",
29
+ onClick: function onClick() {
30
+ formRef.current.submit();
31
+ }
32
+ }, "\u63D0\u4EA4"), /*#__PURE__*/React.createElement(_Button, null, "\u91CD\u7F6E")), /*#__PURE__*/React.createElement("div", {
33
+ style: {
34
+ height: 'calc(100% - 40px)',
35
+ background: 'var(--ronds-metadata-color-bg-2)'
36
+ }
37
+ }, /*#__PURE__*/React.createElement(Split, {
38
+ sizes: [70, 30],
39
+ gutterSize: 1
40
+ }, /*#__PURE__*/React.createElement("div", {
41
+ style: {
42
+ padding: '8px'
43
+ }
44
+ }, /*#__PURE__*/React.createElement(MetadataForm, {
45
+ schema: schema,
46
+ getFormInstance: function getFormInstance(form) {
47
+ formRef.current = form;
48
+ },
49
+ onFinish: onFinish
50
+ })), /*#__PURE__*/React.createElement("div", {
51
+ style: {
52
+ padding: '8px'
53
+ }
54
+ }, /*#__PURE__*/React.createElement(JsonView, {
55
+ json: json
56
+ }))))));
57
+ };
58
+ export default Preview;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ declare const _default: (props: any) => React.JSX.Element;
2
3
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (props: any) => JSX.Element;
1
+ declare const _default: (props: any) => import("react").JSX.Element;
2
2
  export default _default;
@@ -1 +1,2 @@
1
- export declare function withFieldCellWrapper(WrappedComponent: any): (props: any) => JSX.Element;
1
+ import React from 'react';
2
+ export declare function withFieldCellWrapper(WrappedComponent: any): (props: any) => React.JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { FG } from '../../../../interface';
2
+ import React from 'react';
2
3
  interface IRenderFieldProps {
3
4
  data: FG.Node;
4
5
  /**
@@ -7,5 +8,5 @@ interface IRenderFieldProps {
7
8
  refId?: string;
8
9
  isShowAction?: boolean;
9
10
  }
10
- declare const RenderField: (props: IRenderFieldProps) => JSX.Element;
11
+ declare const RenderField: (props: IRenderFieldProps) => React.JSX.Element;
11
12
  export default RenderField;
@@ -17,5 +17,5 @@ interface ICanvasCoreProps {
17
17
  */
18
18
  onChange?: (nodes: FG.Node[]) => void;
19
19
  }
20
- declare const _default: React.MemoExoticComponent<(props: ICanvasCoreProps) => JSX.Element>;
20
+ declare const _default: React.MemoExoticComponent<(props: ICanvasCoreProps) => React.JSX.Element>;
21
21
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const Canvas: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const Canvas: () => React.JSX.Element;
2
3
  export default Canvas;
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  /*
9
9
  * @Author: wangxian
10
10
  * @Date: 2023-02-06 08:24:17
11
- * @LastEditTime: 2023-06-26 08:55:24
11
+ * @LastEditTime: 2023-06-30 16:42:07
12
12
  */
13
13
  import React from 'react';
14
14
  import copy from 'copy-to-clipboard';
@@ -16,8 +16,8 @@ import { FGCtx } from '../../Provider';
16
16
  import { formSetting, streamEventType } from '../../settings';
17
17
  import { transFG2Schema } from '../../transformer';
18
18
  import CanvasCore from './core';
19
- import MetadataForm from '../../../../comps/MetadataForm';
20
19
  import useObservable from '../../../../framework/rxjs-hooks/useObservable';
20
+ import Preview from './Preview';
21
21
  var Canvas = function Canvas() {
22
22
  var nodesRef = React.useRef([]);
23
23
  var settingRef = React.useRef({
@@ -34,11 +34,27 @@ var Canvas = function Canvas() {
34
34
  case streamEventType.onSettingValueChange:
35
35
  if (p === null || p === void 0 ? void 0 : p.payload) {
36
36
  settingRef.current = p.payload.allSetting;
37
+ fGCtx.fgStream && fGCtx.fgStream.next({
38
+ type: streamEventType.onJsonSchema,
39
+ payload: {
40
+ nodes: nodesRef.current,
41
+ settings: settingRef.current,
42
+ types: typesRef.current
43
+ }
44
+ });
37
45
  }
38
46
  break;
39
47
  case streamEventType.onTypesChange:
40
48
  if (p === null || p === void 0 ? void 0 : p.payload) {
41
49
  typesRef.current = _objectSpread(_objectSpread({}, typesRef.current), p === null || p === void 0 ? void 0 : p.payload);
50
+ fGCtx.fgStream && fGCtx.fgStream.next({
51
+ type: streamEventType.onJsonSchema,
52
+ payload: {
53
+ nodes: nodesRef.current,
54
+ settings: settingRef.current,
55
+ types: typesRef.current
56
+ }
57
+ });
42
58
  }
43
59
  break;
44
60
  }
@@ -87,18 +103,9 @@ var Canvas = function Canvas() {
87
103
  _message.success("\u5DF2\u590D\u5236\u5230\u526A\u5207\u677F");
88
104
  }
89
105
  }
90
- }, "\u5BFC\u51FASchema")), schema.length > 0 && /*#__PURE__*/React.createElement("div", {
91
- style: {
92
- width: '100%',
93
- height: 'calc(100% - 40px)',
94
- background: 'var(--ronds-metadata-color-bg-2)',
95
- padding: '8px',
96
- border: '1px solid var(--ronds-metadata-color-border-1)',
97
- overflowY: 'auto'
98
- }
99
- }, /*#__PURE__*/React.createElement(MetadataForm, {
106
+ }, "\u5BFC\u51FASchema")), schema.length > 0 && /*#__PURE__*/React.createElement(Preview, {
100
107
  schema: schema
101
- })), /*#__PURE__*/React.createElement("div", {
108
+ }), /*#__PURE__*/React.createElement("div", {
102
109
  style: {
103
110
  width: '100%',
104
111
  height: '100%',
@@ -107,6 +114,14 @@ var Canvas = function Canvas() {
107
114
  }, /*#__PURE__*/React.createElement(CanvasCore, {
108
115
  onChange: function onChange(nodes) {
109
116
  nodesRef.current = nodes;
117
+ fGCtx.fgStream && fGCtx.fgStream.next({
118
+ type: streamEventType.onJsonSchema,
119
+ payload: {
120
+ nodes: nodesRef.current,
121
+ settings: settingRef.current,
122
+ types: typesRef.current
123
+ }
124
+ });
110
125
  }
111
126
  })));
112
127
  };
@@ -1,2 +1,3 @@
1
- declare const Settings: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const Settings: () => React.JSX.Element;
2
3
  export default Settings;
@@ -2,5 +2,5 @@ import { FG } from '../../interface';
2
2
  interface IElementsProps {
3
3
  data: FG.Node;
4
4
  }
5
- declare const Elements: (props: IElementsProps) => JSX.Element;
5
+ declare const Elements: (props: IElementsProps) => import("react").JSX.Element;
6
6
  export default Elements;
@@ -1,5 +1,5 @@
1
1
  interface IJsonSchemaProps {
2
2
  json: string;
3
3
  }
4
- declare const JsonSchema: (props: IJsonSchemaProps) => JSX.Element;
4
+ declare const JsonSchema: (props: IJsonSchemaProps) => import("react").JSX.Element;
5
5
  export default JsonSchema;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
- declare const Sidebar: () => JSX.Element;
3
+ declare const Sidebar: () => React.JSX.Element;
3
4
  export default Sidebar;
@@ -1,24 +1,46 @@
1
1
  import "antd/es/radio/style";
2
2
  import _Radio from "antd/es/radio";
3
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
4
  import "antd/es/row/style";
4
5
  import _Row from "antd/es/row";
5
6
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
7
  /*
7
8
  * @Author: uloveits 719310130@qq.com
8
9
  * @Date: 2023-02-04 16:35:16
9
- * @LastEditors: Please set LastEditors
10
- * @LastEditTime: 2023-06-30 10:15:25
10
+ * @LastEditors: uloveits 719310130@qq.com
11
+ * @LastEditTime: 2023-06-30 16:36:35
11
12
  */
12
13
  import React from 'react';
13
- import { sidebarCtx } from '../../settings';
14
+ import { sidebarCtx, streamEventType } from '../../settings';
14
15
  import Elements from './Elements';
15
16
  import './index.less';
16
17
  import JsonSchema from './JsonSchema';
18
+ import useObservable from '../../../../framework/rxjs-hooks/useObservable';
19
+ import { FGCtx } from '../../Provider';
20
+ import { transFG2Schema } from '../../transformer';
17
21
  var Sidebar = function Sidebar() {
18
22
  var _React$useState = React.useState('comps'),
19
23
  _React$useState2 = _slicedToArray(_React$useState, 2),
20
24
  active = _React$useState2[0],
21
25
  setActive = _React$useState2[1];
26
+ var fGCtx = React.useContext(FGCtx) || {};
27
+ var _React$useState3 = React.useState([]),
28
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
29
+ schema = _React$useState4[0],
30
+ setSchema = _React$useState4[1];
31
+ var schemaParamRef = React.useRef();
32
+ var processFgStreamData = React.useCallback(function (p) {
33
+ switch (p === null || p === void 0 ? void 0 : p.type) {
34
+ case streamEventType.onJsonSchema:
35
+ if (p === null || p === void 0 ? void 0 : p.payload) {
36
+ schemaParamRef.current = p.payload;
37
+ }
38
+ break;
39
+ }
40
+ }, []);
41
+ useObservable(function (p) {
42
+ processFgStreamData(p);
43
+ }, [fGCtx.fgStream]);
22
44
  return /*#__PURE__*/React.createElement("div", {
23
45
  className: "fg-sidebar"
24
46
  }, /*#__PURE__*/React.createElement("div", {
@@ -57,7 +79,7 @@ var Sidebar = function Sidebar() {
57
79
  display: "".concat(active === 'json' ? '' : 'none')
58
80
  }
59
81
  }, /*#__PURE__*/React.createElement(JsonSchema, {
60
- json: ""
82
+ json: JSON.stringify(schema)
61
83
  })), /*#__PURE__*/React.createElement("div", {
62
84
  className: "fg-sidebar-bottom-tool"
63
85
  }, /*#__PURE__*/React.createElement(_Radio.Group, {
@@ -70,6 +92,10 @@ var Sidebar = function Sidebar() {
70
92
  }],
71
93
  onChange: function onChange(_ref) {
72
94
  var value = _ref.target.value;
95
+ if (value === 'json' && schemaParamRef.current) {
96
+ var _schema = transFG2Schema(schemaParamRef.current.nodes, schemaParamRef.current.settings, schemaParamRef.current.types);
97
+ setSchema(_toConsumableArray(_schema || []));
98
+ }
73
99
  setActive(value);
74
100
  },
75
101
  value: active,
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
3
  interface IFormGeneratorProps {
3
4
  /**
@@ -5,5 +6,5 @@ interface IFormGeneratorProps {
5
6
  */
6
7
  defaultSchema?: any;
7
8
  }
8
- declare const FormGenerator: (props: IFormGeneratorProps) => JSX.Element;
9
+ declare const FormGenerator: (props: IFormGeneratorProps) => React.JSX.Element;
9
10
  export default FormGenerator;
@@ -68,8 +68,12 @@ export declare namespace StreamEvent {
68
68
  type: 'onDefaultValue';
69
69
  payload?: FG.IDefaultValue;
70
70
  }
71
+ interface onJsonSchema {
72
+ type: 'onJsonSchema';
73
+ payload?: FG.IDefaultValue;
74
+ }
71
75
  }
72
- export type IFGStream = StreamEvent.onNodeSelect | StreamEvent.onClearCanvas | StreamEvent.onNodeDelete | StreamEvent.onNodeCopy | StreamEvent.onSettingValueChange | StreamEvent.onDropOver | StreamEvent.onTypesChange | StreamEvent.onDefaultValue;
76
+ export type IFGStream = StreamEvent.onNodeSelect | StreamEvent.onClearCanvas | StreamEvent.onNodeDelete | StreamEvent.onNodeCopy | StreamEvent.onSettingValueChange | StreamEvent.onDropOver | StreamEvent.onTypesChange | StreamEvent.onDefaultValue | StreamEvent.onJsonSchema;
73
77
  export interface IFGCtxProps {
74
78
  fgStream?: BehaviorSubject<IFGStream | undefined>;
75
79
  types?: {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2023-02-06 08:24:17
4
- * @LastEditTime: 2023-04-21 09:13:26
4
+ * @LastEditTime: 2023-06-30 16:23:49
5
5
  */
6
6
  export {};
@@ -2383,4 +2383,5 @@ export declare const streamEventType: {
2383
2383
  onTypesChange: string;
2384
2384
  onDropOver: string;
2385
2385
  onDefaultValue: string;
2386
+ onJsonSchema: string;
2386
2387
  };
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  /*
3
3
  * @Author: wangxian
4
4
  * @Date: 2023-02-06 08:24:17
5
- * @LastEditTime: 2023-06-25 18:27:38
5
+ * @LastEditTime: 2023-06-30 16:21:01
6
6
  */
7
7
  import { RefRule, Rule } from './ruleConfig';
8
8
  export var inputSchema = [{
@@ -394,5 +394,6 @@ export var streamEventType = {
394
394
  onSettingValueChange: 'onSettingValueChange',
395
395
  onTypesChange: 'onTypesChange',
396
396
  onDropOver: 'onDropOver',
397
- onDefaultValue: 'onDefaultValue'
397
+ onDefaultValue: 'onDefaultValue',
398
+ onJsonSchema: 'onJsonSchema'
398
399
  };
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import 'codemirror/lib/codemirror.css';
2
3
  import 'codemirror/theme/neo.css';
3
4
  import 'codemirror/theme/panda-syntax.css';
@@ -65,5 +66,5 @@ interface ISqlEditProps {
65
66
  */
66
67
  onReWriteEnter?: () => void;
67
68
  }
68
- declare const SqlEdit: (props: ISqlEditProps) => JSX.Element;
69
+ declare const SqlEdit: (props: ISqlEditProps) => React.JSX.Element;
69
70
  export default SqlEdit;
@@ -1,6 +1,7 @@
1
+ import React from 'react';
1
2
  import './index.less';
2
3
  interface IJsonViewProps {
3
4
  json: string;
4
5
  }
5
- declare const JsonView: (props: IJsonViewProps) => JSX.Element;
6
+ declare const JsonView: (props: IJsonViewProps) => React.JSX.Element;
6
7
  export default JsonView;