@luck-design-biz/luckda 0.0.25-4 → 0.0.25-7

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 (141) hide show
  1. package/es/components/LDActions/index.less +1 -1
  2. package/es/components/LdAutoForm/index.js +24 -8
  3. package/es/components/LdFormList/index.js +25 -18
  4. package/es/components/LdGrid/index.js +3 -2
  5. package/es/components/LdGridForm/index.js +16 -6
  6. package/es/components/LdTree/index.js +3 -2
  7. package/es/helper/form.js +6 -3
  8. package/es/locales/zh-CN.js +1 -0
  9. package/es/lowcode/constants/api-url.js +13 -11
  10. package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +5 -2
  11. package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +5 -2
  12. package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
  13. package/es/lowcode/engine/meta/dialog.props.json +72 -42
  14. package/es/lowcode/engine/meta/form.props.json +3 -3
  15. package/es/lowcode/engine/meta/table.props.json +4 -4
  16. package/es/lowcode/engine/meta/tree.props.default.json +1 -0
  17. package/es/lowcode/engine/meta/tree.props.json +7 -0
  18. package/es/lowcode/engine/provider/ContextProvider/index.js +8 -40
  19. package/es/lowcode/engine/provider/RemoteSourceProvider.js +16 -20
  20. package/es/lowcode/engine/tools/helper.js +2 -3
  21. package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
  22. package/es/lowcode/engine/tools/usePageDataStore.js +174 -0
  23. package/es/lowcode/engine/tools/usePromiseState.js +12 -23
  24. package/es/lowcode/engine/tools/useTodo.js +20 -10
  25. package/es/lowcode/painter/DesignOperator.js +11 -22
  26. package/es/lowcode/painter/DesignToolbar.js +8 -44
  27. package/es/lowcode/painter/Outline.js +2 -4
  28. package/es/lowcode/painter/Panel.js +26 -25
  29. package/es/lowcode/painter/components/ActionBindModal.js +5 -11
  30. package/es/lowcode/painter/components/AttrsPanel.js +26 -19
  31. package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
  32. package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
  33. package/es/lowcode/painter/components/field-setting/SettingUI.js +7 -7
  34. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +11 -11
  35. package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
  36. package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
  37. package/es/lowcode/painter/panel-section/FieldsSetting.js +5 -1
  38. package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
  39. package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
  40. package/es/lowcode/painter/style/design.less +1 -1
  41. package/es/lowcode/painter/style/panel-item.less +1 -1
  42. package/es/lowcode/view/Canvas.js +6 -7
  43. package/es/lowcode/view/Page.js +2 -3
  44. package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
  45. package/es/lowcode/view/lc-components/Dialog/index.js +89 -19
  46. package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
  47. package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
  48. package/es/lowcode/view/lc-components/Form/index.js +20 -6
  49. package/es/lowcode/view/lc-components/Form/meta.json +3 -3
  50. package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +12 -19
  51. package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
  52. package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
  53. package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
  54. package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
  55. package/es/lowcode/view/lc-components/Section/FunctionDesign.js +3 -9
  56. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +11 -18
  57. package/es/lowcode/view/lc-components/Table/index.js +67 -25
  58. package/es/lowcode/view/lc-components/Table/meta.json +4 -4
  59. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +9 -17
  60. package/es/lowcode/view/lc-components/Tree/index.js +8 -1
  61. package/es/lowcode/view/lc-components/Tree/meta.json +7 -0
  62. package/es/lowcode/view/lc-components/Wrapper.js +9 -11
  63. package/es/services.js +0 -24
  64. package/es/upload/FilesWall/file.png +0 -0
  65. package/es/upload/FilesWall/index.js +422 -0
  66. package/es/upload/FilesWall/index.less +74 -0
  67. package/es/upload/Form/index.js +2 -1
  68. package/es/upload/FormItem/index.js +2 -1
  69. package/es/upload/index.js +2 -1
  70. package/es/utils/action.js +2 -2
  71. package/lib/components/LDActions/index.less +1 -1
  72. package/lib/components/LdAutoForm/index.js +23 -7
  73. package/lib/components/LdFormList/index.js +25 -18
  74. package/lib/components/LdGrid/index.js +3 -2
  75. package/lib/components/LdGridForm/index.js +14 -4
  76. package/lib/components/LdTree/index.js +3 -2
  77. package/lib/helper/form.js +6 -3
  78. package/lib/locales/zh-CN.js +1 -0
  79. package/lib/lowcode/constants/api-url.js +14 -10
  80. package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +7 -4
  81. package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +6 -3
  82. package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
  83. package/lib/lowcode/engine/meta/dialog.props.json +72 -42
  84. package/lib/lowcode/engine/meta/form.props.json +3 -3
  85. package/lib/lowcode/engine/meta/table.props.json +4 -4
  86. package/lib/lowcode/engine/meta/tree.props.default.json +1 -0
  87. package/lib/lowcode/engine/meta/tree.props.json +7 -0
  88. package/lib/lowcode/engine/provider/ContextProvider/index.js +25 -41
  89. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +16 -20
  90. package/lib/lowcode/engine/tools/helper.js +2 -3
  91. package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
  92. package/lib/lowcode/engine/tools/usePageDataStore.js +181 -0
  93. package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
  94. package/lib/lowcode/engine/tools/useTodo.js +19 -9
  95. package/lib/lowcode/painter/DesignOperator.js +10 -21
  96. package/lib/lowcode/painter/DesignToolbar.js +7 -43
  97. package/lib/lowcode/painter/Outline.js +1 -3
  98. package/lib/lowcode/painter/Panel.js +25 -24
  99. package/lib/lowcode/painter/components/ActionBindModal.js +5 -11
  100. package/lib/lowcode/painter/components/AttrsPanel.js +26 -19
  101. package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
  102. package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
  103. package/lib/lowcode/painter/components/field-setting/SettingUI.js +7 -7
  104. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +10 -10
  105. package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
  106. package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
  107. package/lib/lowcode/painter/panel-section/FieldsSetting.js +5 -1
  108. package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
  109. package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
  110. package/lib/lowcode/painter/style/design.less +1 -1
  111. package/lib/lowcode/painter/style/panel-item.less +1 -1
  112. package/lib/lowcode/view/Canvas.js +5 -6
  113. package/lib/lowcode/view/Page.js +2 -3
  114. package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
  115. package/lib/lowcode/view/lc-components/Dialog/index.js +89 -19
  116. package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
  117. package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
  118. package/lib/lowcode/view/lc-components/Form/index.js +20 -6
  119. package/lib/lowcode/view/lc-components/Form/meta.json +3 -3
  120. package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -18
  121. package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
  122. package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
  123. package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
  124. package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
  125. package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +2 -8
  126. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +10 -17
  127. package/lib/lowcode/view/lc-components/Table/index.js +66 -24
  128. package/lib/lowcode/view/lc-components/Table/meta.json +4 -4
  129. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +8 -16
  130. package/lib/lowcode/view/lc-components/Tree/index.js +8 -1
  131. package/lib/lowcode/view/lc-components/Tree/meta.json +7 -0
  132. package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
  133. package/lib/services.js +0 -25
  134. package/lib/upload/FilesWall/file.png +0 -0
  135. package/lib/upload/FilesWall/index.js +429 -0
  136. package/lib/upload/FilesWall/index.less +74 -0
  137. package/lib/upload/Form/index.js +2 -1
  138. package/lib/upload/FormItem/index.js +2 -1
  139. package/lib/upload/index.js +8 -1
  140. package/lib/utils/action.js +2 -2
  141. package/package.json +4 -3
@@ -23,8 +23,7 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
23
23
  var _ref = useRef(null);
24
24
  var _rootRef = ref || _ref;
25
25
  var _useRemoteSource = useRemoteSource(),
26
- loading = _useRemoteSource.loading,
27
- pageData = _useRemoteSource.pageData;
26
+ loading = _useRemoteSource.loading;
28
27
  var getTargetDom = useMemoizedFn(function () {
29
28
  return _rootRef.current;
30
29
  });
@@ -34,6 +33,6 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
34
33
  }, /*#__PURE__*/React.createElement("div", _extends({
35
34
  ref: _rootRef,
36
35
  className: classNames(styles['lc-view-page'], _defineProperty(_defineProperty({}, styles.isloading, loading), className, !!className))
37
- }, props), isNil(pageData) ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Canvas, null), loading ? /*#__PURE__*/React.createElement(Masker, null, /*#__PURE__*/React.createElement(Loading, null)) : null)));
36
+ }, props), /*#__PURE__*/React.createElement(Canvas, null), loading ? /*#__PURE__*/React.createElement(Masker, null, /*#__PURE__*/React.createElement(Loading, null)) : null));
38
37
  });
39
38
  export default LCPage;
@@ -1,15 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
5
  var _excluded = ["id", "children", "className"];
7
6
  import React from 'react';
8
7
  import { useCreation } from 'ahooks';
9
8
  import Index from "./index";
10
9
  import { suid } from '@luck-design-biz/base/utils';
11
- import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
12
- import { add } from "../../../engine/tools/dataProcess";
10
+ import { useContext, addNode } from "../../../engine/provider/ContextProvider";
13
11
  import classNames from 'classnames';
14
12
  import styles from "./index.less";
15
13
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
@@ -19,19 +17,14 @@ var FunctionDesign = function FunctionDesign(_ref) {
19
17
  className = _ref.className,
20
18
  props = _objectWithoutProperties(_ref, _excluded);
21
19
  var ctx = useContext();
22
- var _usePageData = usePageData(),
23
- _usePageData2 = _slicedToArray(_usePageData, 2),
24
- setPageData = _usePageData2[1].setPageData;
25
20
  useCreation(function () {
26
21
  if (children !== null && children !== void 0 && children.length) return;
27
22
  ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
28
- var compId = _ref2.id,
29
- pageData = _ref2.pageData;
23
+ var compId = _ref2.id;
30
24
  if (compId !== id) return;
31
- add(pageData, id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
25
+ addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
32
26
  buildIn: true
33
27
  }));
34
- setPageData(pageData);
35
28
  }).watch();
36
29
  }, []);
37
30
  return /*#__PURE__*/React.createElement(Index, _extends({
@@ -1,29 +1,83 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["id", "children", "getContainer", "wrapClassName", "maskStyle"];
5
- import React, { useRef, useImperativeHandle } from 'react';
6
- import { useMemoizedFn, useBoolean } from 'ahooks';
7
- import { Modal } from 'luck-design/antd';
4
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
5
+ import { useMemoizedFn, useUpdateEffect, useCreation } from 'ahooks';
6
+ import { Modal, Button } from 'luck-design/antd';
8
7
  import classNames from 'classnames';
8
+ import styled from 'styled-components';
9
+ import { LDActions } from "../../../../index";
10
+ import { useContext } from "../../../engine/provider/ContextProvider";
11
+ import usePromiseState from "../../../engine/tools/usePromiseState";
9
12
  import Wrapper from "../Wrapper";
10
13
  import styles from "./index.less";
14
+ var Footer = styled.div.withConfig({
15
+ displayName: "Footer",
16
+ componentId: "luckda-6530__sc-1aeozvd-0"
17
+ })(["width:100%;display:flex;justify-content:flex-end;"]);
11
18
  var LCDialog = function LCDialog(_ref) {
12
19
  var id = _ref.id,
13
20
  children = _ref.children,
21
+ title = _ref.title,
22
+ width = _ref.width,
23
+ height = _ref.height,
14
24
  getContainer = _ref.getContainer,
15
25
  wrapClassName = _ref.wrapClassName,
16
26
  maskStyle = _ref.maskStyle,
17
- props = _objectWithoutProperties(_ref, _excluded);
27
+ defaultOpen = _ref.defaultOpen,
28
+ mask = _ref.mask,
29
+ okText = _ref.okText,
30
+ cancelText = _ref.cancelText,
31
+ footer = _ref.footer,
32
+ btnGroup = _ref.btnGroup,
33
+ advance = _ref.advance;
34
+ var ctx = useContext();
18
35
  var apiRef = useRef();
19
36
  var domRef = useRef();
20
- var _useBoolean = useBoolean(false),
21
- _useBoolean2 = _slicedToArray(_useBoolean, 2),
22
- open = _useBoolean2[0],
23
- _useBoolean2$ = _useBoolean2[1],
24
- setTrue = _useBoolean2$.setTrue,
25
- setFalse = _useBoolean2$.setFalse,
26
- toggle = _useBoolean2$.toggle;
37
+ var _usePromiseState = usePromiseState(defaultOpen),
38
+ _usePromiseState2 = _slicedToArray(_usePromiseState, 2),
39
+ open = _usePromiseState2[0],
40
+ setOpen = _usePromiseState2[1];
41
+ useEffect(function () {
42
+ ctx.doAction(advance.events.onMount);
43
+ return function () {
44
+ return ctx.doAction(advance.events.onUnmount);
45
+ };
46
+ }, []);
47
+ useUpdateEffect(function () {
48
+ if (open) {
49
+ ctx.doAction(advance.events.onOpen);
50
+ } else {
51
+ ctx.doAction(advance.events.onClose);
52
+ }
53
+ }, [open]);
54
+ var handleOk = useMemoizedFn(function () {
55
+ ctx.doAction(advance.events.onOk);
56
+ });
57
+ var _footer = useCreation(function () {
58
+ var _btnGroup$todoList;
59
+ if (!footer) return {
60
+ footer: null
61
+ };
62
+ if (!(btnGroup !== null && btnGroup !== void 0 && (_btnGroup$todoList = btnGroup.todoList) !== null && _btnGroup$todoList !== void 0 && _btnGroup$todoList.length)) return {};
63
+ return {
64
+ footer: /*#__PURE__*/React.createElement(Footer, null, /*#__PURE__*/React.createElement(LDActions, _extends({}, btnGroup, {
65
+ doAction: function doAction(action) {
66
+ return ctx.doAction(action);
67
+ }
68
+ })), /*#__PURE__*/React.createElement(Button, {
69
+ onClick: function onClick() {
70
+ return setOpen(false);
71
+ },
72
+ style: {
73
+ marginLeft: 8
74
+ }
75
+ }, cancelText), /*#__PURE__*/React.createElement(Button, {
76
+ type: "primary",
77
+ onClick: handleOk
78
+ }, okText))
79
+ };
80
+ }, [footer, btnGroup]);
27
81
  var getTargetDom = useMemoizedFn(function () {
28
82
  var _domRef$current;
29
83
  return (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.closest('.ant-modal-content');
@@ -31,22 +85,38 @@ var LCDialog = function LCDialog(_ref) {
31
85
  useImperativeHandle(apiRef, function () {
32
86
  return {
33
87
  open: open,
34
- doOpen: setTrue,
35
- doClose: setFalse,
36
- toggle: toggle
88
+ doOpen: function doOpen() {
89
+ return setOpen(true);
90
+ },
91
+ doClose: function doClose() {
92
+ return setOpen(false);
93
+ }
37
94
  };
38
- });
95
+ }, []);
39
96
  return /*#__PURE__*/React.createElement(Wrapper, {
40
97
  id: id,
41
98
  displayName: "Dialog",
42
99
  getTargetDom: getTargetDom,
43
100
  api: apiRef
44
- }, /*#__PURE__*/React.createElement(Modal, {
101
+ }, /*#__PURE__*/React.createElement(Modal, _extends({
102
+ title: title,
45
103
  visible: open,
46
104
  getContainer: getContainer,
105
+ width: width,
106
+ mask: mask,
47
107
  maskStyle: maskStyle,
108
+ bodyStyle: {
109
+ height: height,
110
+ overflowY: 'auto',
111
+ marginTop: 0
112
+ },
48
113
  wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName))
49
- }, /*#__PURE__*/React.createElement("div", {
114
+ }, _footer, {
115
+ onOk: handleOk,
116
+ onCancel: function onCancel() {
117
+ return setOpen(false);
118
+ }
119
+ }), /*#__PURE__*/React.createElement("div", {
50
120
  style: {
51
121
  height: 0,
52
122
  width: 0,
@@ -9,7 +9,7 @@
9
9
  "props": [
10
10
  {
11
11
  "key": "id",
12
- "desc": "唯一标识",
12
+ "name": "唯一标识",
13
13
  "type": "string",
14
14
  "disabled": true
15
15
  },
@@ -22,65 +22,88 @@
22
22
  },
23
23
  {
24
24
  "key": "width",
25
- "name": "宽度",
26
- "desc": "对话框的宽度",
27
- "type": "string",
25
+ "name": "对话框宽度",
26
+ "type": "_WidthHeight",
27
+ "options": [
28
+ {
29
+ "label": "px",
30
+ "value": "px"
31
+ },
32
+ {
33
+ "label": "%",
34
+ "value": "%"
35
+ },
36
+ {
37
+ "label": "vw",
38
+ "value": "vw"
39
+ },
40
+ {
41
+ "label": "A",
42
+ "value": "auto"
43
+ }
44
+ ],
28
45
  "default": "700px"
29
46
  },
30
47
  {
31
48
  "key": "height",
32
- "name": "高度",
33
- "desc": "对话框的高度",
34
- "type": "string",
35
- "default": "60vh"
36
- },
37
- {
38
- "key": "fullScreen",
39
- "name": "默认全屏",
40
- "desc": "对话框打开默认全屏",
41
- "type": "boolean",
42
- "default": false
43
- },
44
- {
45
- "key": "fullable",
46
- "name": "支持全屏切换",
47
- "desc": "可以通过右上角按钮切换全屏状态",
48
- "type": "boolean",
49
- "default": true
49
+ "name": "内容区高度",
50
+ "type": "_WidthHeight",
51
+ "options": [
52
+ {
53
+ "label": "px",
54
+ "value": "px"
55
+ },
56
+ {
57
+ "label": "vh",
58
+ "value": "vh"
59
+ },
60
+ {
61
+ "label": "A",
62
+ "value": "auto"
63
+ }
64
+ ],
65
+ "default": "50vh"
50
66
  },
51
67
  {
52
68
  "key": "defaultOpen",
53
69
  "name": "默认显示",
54
70
  "desc": "默认是否显示",
55
- "type": "boolean",
71
+ "type": "switch",
56
72
  "default": false
57
73
  },
58
74
  {
59
75
  "key": "mask",
60
76
  "name": "显示遮罩",
61
- "desc": "是否展示遮罩",
62
- "type": "boolean",
63
- "default": false
77
+ "type": "switch",
78
+ "default": true
64
79
  },
65
80
  {
66
- "key": "keyboard",
67
- "name": "ESC关闭",
68
- "desc": "是否支持键盘 esc 关闭",
69
- "type": "boolean",
70
- "default": true
81
+ "key": "okText",
82
+ "name": "确认文字",
83
+ "type": "_I18nInput",
84
+ "default": "确定"
85
+ },
86
+ {
87
+ "key": "cancelText",
88
+ "name": "取消文字",
89
+ "type": "_I18nInput",
90
+ "default": "取消"
71
91
  },
72
92
  {
73
93
  "key": "footer",
74
- "name": "底部按钮是否显示",
94
+ "name": "显示footer",
75
95
  "desc": "是否显示底部按钮区域",
76
- "type": "boolean",
96
+ "type": "switch",
77
97
  "default": true
78
98
  },
79
99
  {
80
100
  "key": "btnGroup",
81
101
  "name": "按钮组",
82
102
  "desc": "底部按钮区域的按钮组(参考按钮配置)",
83
- "type": "_ActionSelector"
103
+ "type": "_ActionsEditor",
104
+ "default": { "display": "button", "max": 2, "moreText": "操作", "todoList": [] },
105
+ "wrapper": "collapse",
106
+ "wrapperProps": { "suppressIcon": true }
84
107
  }
85
108
  ],
86
109
  "advance": {
@@ -89,31 +112,31 @@
89
112
  "key": "onMount",
90
113
  "name": "组件首次渲染时",
91
114
  "desc": "在组件首次渲染时,执行方法",
92
- "func": "(params)=>{\n\t\n}"
115
+ "func": "()=>{\n\t\n}"
93
116
  },
94
117
  {
95
118
  "key": "onUnmount",
96
119
  "name": "组件卸载时",
97
120
  "desc": "在组件卸载时,执行方法。",
98
- "func": "(params)=>{\n\t\n}"
121
+ "func": "()=>{\n\t\n}"
99
122
  },
100
123
  {
101
124
  "key": "onOpen",
102
125
  "name": "对话框打开时",
103
126
  "desc": "在对话框打开时,执行方法",
104
- "func": "(params)=>{\n\t\n}"
127
+ "func": "()=>{\n\t\n}"
105
128
  },
106
129
  {
107
130
  "key": "onClose",
108
131
  "name": "对话框关闭时",
109
132
  "desc": "在对话框打开时,执行方法,promise反馈false无法截断关闭",
110
- "func": "(params)=>{\n\t\n}"
133
+ "func": "()=>{\n\t\n}"
111
134
  },
112
135
  {
113
- "key": "onButtonClick",
114
- "name": "按钮组点击",
115
- "desc": "点击按钮组某个按钮时,执行方法",
116
- "func": "(buttonKey,params)=>{\n\t\n}"
136
+ "key": "onOk",
137
+ "name": "确定按钮点击",
138
+ "desc": "点击确定按钮时,执行方法",
139
+ "func": "()=>{\n\t\n}"
117
140
  }
118
141
  ]
119
142
  }
@@ -6,12 +6,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
6
6
  var _excluded = ["children", "blocks", "id"];
7
7
  import React, { useRef, useEffect } from 'react';
8
8
  import { usePrevious, useUpdateLayoutEffect } from 'ahooks';
9
- import { isEqual, differenceWith, cloneDeep, differenceBy } from 'lodash';
9
+ import { isEqual, cloneDeep, differenceBy } from 'lodash';
10
10
  import { suid } from '@luck-design-biz/base/utils';
11
- import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
12
- import { add, findNodeAndParent } from "../../../engine/tools/dataProcess";
11
+ import { useContext, useGet, addNode } from "../../../engine/provider/ContextProvider";
13
12
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
14
13
  import Index from "./index";
14
+ import { keyBy, forEach } from 'lodash';
15
15
  var FunctionDesign = function FunctionDesign(_ref) {
16
16
  var children = _ref.children,
17
17
  blocks = _ref.blocks,
@@ -19,38 +19,32 @@ var FunctionDesign = function FunctionDesign(_ref) {
19
19
  props = _objectWithoutProperties(_ref, _excluded);
20
20
  var ref = useRef(null);
21
21
  var ctx = useContext();
22
- var _usePageData = usePageData(),
23
- _usePageData2 = _slicedToArray(_usePageData, 2),
24
- setPageData = _usePageData2[1].setPageData;
22
+ var current = useGet({
23
+ id: id
24
+ });
25
25
  var previousBlocks = usePrevious(cloneDeep(blocks), function (prev, next) {
26
26
  return !isEqual(prev, next);
27
27
  });
28
28
  useUpdateLayoutEffect(function () {
29
- var diffDataset = differenceWith(blocks, previousBlocks, function (arrVal, othVal) {
30
- var _arrVal$dataset, _othVal$dataset;
31
- return arrVal.id === othVal.id && ((_arrVal$dataset = arrVal.dataset) === null || _arrVal$dataset === void 0 ? void 0 : _arrVal$dataset.code) === ((_othVal$dataset = othVal.dataset) === null || _othVal$dataset === void 0 ? void 0 : _othVal$dataset.code);
32
- });
33
- diffDataset.forEach(function (df) {
34
- var _df$dataset;
35
- ((_df$dataset = df.dataset) === null || _df$dataset === void 0 ? void 0 : _df$dataset.code) && ref.current.doQueryOne(df.id);
36
- });
37
- var diffColReset = differenceWith(blocks, previousBlocks, function (arrVal, othVal) {
38
- return arrVal.id === othVal.id && arrVal.actionsColumnReset === othVal.actionsColumnReset;
39
- });
40
- diffColReset.forEach(function (df) {
41
- var _ctx$componentMap$get2;
42
- var _ctx$componentMap$get = (_ctx$componentMap$get2 = ctx.componentMap.get(id)) === null || _ctx$componentMap$get2 === void 0 ? void 0 : _ctx$componentMap$get2.api.getForm().getFormRef(df.id).formRef.current,
43
- gridApi = _ctx$componentMap$get.gridApi;
44
- gridApi.api.refreshCells({
45
- columns: ['luck-actions'],
46
- force: true
47
- });
29
+ var blocksObj = keyBy(blocks, 'id');
30
+ var previousBlocksObj = keyBy(previousBlocks, 'id');
31
+ forEach(blocksObj, function (value, key) {
32
+ var _value$dataset, _previousBlocksObj$ke, _value$dataset2, _previousBlocksObj$ke2;
33
+ if (((_value$dataset = value.dataset) === null || _value$dataset === void 0 ? void 0 : _value$dataset.code) !== ((_previousBlocksObj$ke = previousBlocksObj[key]) === null || _previousBlocksObj$ke === void 0 || (_previousBlocksObj$ke = _previousBlocksObj$ke.dataset) === null || _previousBlocksObj$ke === void 0 ? void 0 : _previousBlocksObj$ke.code)) ((_value$dataset2 = value.dataset) === null || _value$dataset2 === void 0 ? void 0 : _value$dataset2.code) && ref.current.doQueryOne(key);
34
+ if (value.actionsColumnReset !== ((_previousBlocksObj$ke2 = previousBlocksObj[key]) === null || _previousBlocksObj$ke2 === void 0 ? void 0 : _previousBlocksObj$ke2.actionsColumnReset)) {
35
+ var _ctx$componentMap$get2;
36
+ var _ctx$componentMap$get = (_ctx$componentMap$get2 = ctx.componentMap.get(id)) === null || _ctx$componentMap$get2 === void 0 ? void 0 : _ctx$componentMap$get2.api.getForm().getFormRef(key).formRef.current,
37
+ gridApi = _ctx$componentMap$get.gridApi;
38
+ gridApi.api.refreshCells({
39
+ columns: ['luck-actions'],
40
+ force: true
41
+ });
42
+ }
48
43
  });
49
44
  }, [JSON.stringify(blocks)]);
50
45
  useEffect(function () {
51
46
  var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref2) {
52
47
  var compId = _ref2.id,
53
- pageData = _ref2.pageData,
54
48
  newValue = _ref2.newValue,
55
49
  oldValue = _ref2.oldValue;
56
50
  if (compId !== id || !newValue.hasOwnProperty('blocks')) return;
@@ -60,25 +54,21 @@ var FunctionDesign = function FunctionDesign(_ref) {
60
54
  newItem = _differenceBy2[0];
61
55
  if (newItem.type === 'blank') {
62
56
  var boxId = "box_".concat(suid());
63
- add(pageData, id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
57
+ addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
64
58
  buildIn: true,
65
59
  formBoxId: newItem.id
66
60
  }));
67
- setPageData(pageData);
68
61
  }
69
62
  } else if (newValue.blocks.length < oldValue.blocks.length) {
70
63
  var _differenceBy3 = differenceBy(oldValue.blocks, newValue.blocks, 'id'),
71
64
  _differenceBy4 = _slicedToArray(_differenceBy3, 1),
72
65
  removeItem = _differenceBy4[0];
73
66
  if (removeItem.type === 'blank') {
74
- var _findNodeAndParent = findNodeAndParent(id, pageData),
75
- current = _findNodeAndParent.node;
76
67
  var _boxId = current.children.find(function (childId) {
77
- return current[childId].props.tabId === removeItem.id;
68
+ return current[childId].props.formBoxId === removeItem.id;
78
69
  });
79
70
  ctx.$publisher(ctx.topics.COMPONENT_DELETE, {
80
- id: _boxId,
81
- pageData: pageData
71
+ id: _boxId
82
72
  });
83
73
  }
84
74
  }
@@ -34,6 +34,7 @@ var Header = function Header(_ref) {
34
34
  }), children);
35
35
  };
36
36
  var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
37
+ var _ctx$pagePublicResour2;
37
38
  var id = _ref2.id,
38
39
  parentId = _ref2.parentId,
39
40
  width = _ref2.width,
@@ -74,6 +75,17 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
74
75
  return {
75
76
  getForm: function getForm() {
76
77
  return (ref || formRef).current;
78
+ },
79
+ submit: function submit() {
80
+ var _ctx$pagePublicResour;
81
+ var instance = (ref || formRef).current;
82
+ var _ref3 = ((_ctx$pagePublicResour = ctx.pagePublicResource) === null || _ctx$pagePublicResour === void 0 ? void 0 : _ctx$pagePublicResour[id]) || initData || {},
83
+ formMode = _ref3.formMode;
84
+ if (formMode === 'add') {
85
+ instance.onAdd();
86
+ } else if (formMode === 'update') {
87
+ instance.onBatchUpdate();
88
+ }
77
89
  }
78
90
  };
79
91
  });
@@ -86,9 +98,9 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
86
98
  };
87
99
  return executeCode(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
88
100
  });
89
- var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat, _ref3) {
90
- var values = _ref3.values,
91
- submitData = _ref3.submitData;
101
+ var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat, _ref4) {
102
+ var values = _ref4.values,
103
+ submitData = _ref4.submitData;
92
104
  if (isNil(dataSourceFormat)) return submitData;
93
105
  return executeCode(ctx, dataSourceFormat, ['values', 'submitData'], values, submitData);
94
106
  });
@@ -122,7 +134,8 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
122
134
  });
123
135
  var renderFormList = useMemoizedFn(function (formConfig) {
124
136
  return reduce(blocks, function (result, item) {
125
- if (includes(['auto', 'grid', 'writer'], item.type) && item.dataset && includes(item.mode, formConfig.formMode)) {
137
+ if (includes(['auto', 'grid', 'writer'], item.type) && includes(item.mode, formConfig.formMode)) {
138
+ var _item$dataset;
126
139
  var data = {
127
140
  id: item.id,
128
141
  order: item.order,
@@ -130,9 +143,10 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
130
143
  readOnly: item.readOnly,
131
144
  title: item.name,
132
145
  header: item.header,
133
- dataSetKey: item.dataset.code,
146
+ dataSetKey: (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.code,
134
147
  serial: item.serial,
135
148
  serialEffect: item.serialEffect,
149
+ fields: item.fields,
136
150
  defaultDataSourceFormat: function defaultDataSourceFormat(defaultValues) {
137
151
  return handleDefaultDataSourceFormat(item.defaultDataSourceFormat, defaultValues);
138
152
  },
@@ -275,7 +289,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
275
289
  renderFormList: renderFormList,
276
290
  renderFormExtra: renderFormExtra,
277
291
  mainFormLdId: "block_main",
278
- initData: initData,
292
+ initData: ((_ctx$pagePublicResour2 = ctx.pagePublicResource) === null || _ctx$pagePublicResour2 === void 0 ? void 0 : _ctx$pagePublicResour2[id]) || initData,
279
293
  ref: ref || formRef,
280
294
  readOnly: readOnly,
281
295
  showSaveBtn: showSave,
@@ -38,7 +38,7 @@
38
38
  {
39
39
  "key": "saveTitle",
40
40
  "name": "保存按钮标题",
41
- "type": "string",
41
+ "type": "_I18nInput",
42
42
  "default": "保存"
43
43
  },
44
44
  {
@@ -120,7 +120,7 @@
120
120
  {
121
121
  "key": "name",
122
122
  "name": "区块名称",
123
- "type": "string"
123
+ "type": "_I18nInput"
124
124
  },
125
125
  {
126
126
  "key": "serial",
@@ -501,7 +501,7 @@
501
501
  {
502
502
  "key": "zipName",
503
503
  "name": "压缩包命名",
504
- "type": "string"
504
+ "type": "_I18nInput"
505
505
  },
506
506
  {
507
507
  "key": "uploadUrl",
@@ -1,15 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
4
  var _excluded = ["children", "id", "columnRatio"];
6
5
  import React, { useEffect } from 'react';
7
6
  import { useCreation, useMemoizedFn } from 'ahooks';
8
7
  import { drop } from 'lodash';
9
8
  import { suid } from '@luck-design-biz/base/utils';
10
- import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
9
+ import { useContext, useGet, addNode, deleteNode, modifyNode } from "../../../engine/provider/ContextProvider";
11
10
  import Index from "./index";
12
- import { add, modifyById, deleteById, findNodeAndParent } from "../../../engine/tools/dataProcess";
13
11
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
14
12
  var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
15
13
  var children = _ref.children,
@@ -17,29 +15,27 @@ var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
17
15
  columnRatio = _ref.columnRatio,
18
16
  props = _objectWithoutProperties(_ref, _excluded);
19
17
  var ctx = useContext();
20
- var _usePageData = usePageData(),
21
- _usePageData2 = _slicedToArray(_usePageData, 2),
22
- setPageData = _usePageData2[1].setPageData;
23
- var refreshChild = useMemoizedFn(function (_pageData) {
24
- var _findNodeAndParent = findNodeAndParent(id, _pageData),
25
- current = _findNodeAndParent.node;
18
+ var current = useGet({
19
+ id: id
20
+ });
21
+ var refreshChild = useMemoizedFn(function () {
26
22
  var ratioArr = columnRatio.split(':');
27
23
  drop(current.children, ratioArr.length).forEach(function (boxId) {
28
- deleteById(_pageData, boxId);
24
+ deleteNode(boxId);
29
25
  });
30
26
  ratioArr.forEach(function (item, index) {
31
27
  var _current$children;
32
28
  var ratio = parseInt(item, 10);
33
29
  var boxId = (_current$children = current.children) === null || _current$children === void 0 ? void 0 : _current$children[index];
34
30
  if (boxId) {
35
- modifyById(_pageData, current.children[index], _objectSpread(_objectSpread({}, current[boxId].props), {}, {
31
+ modifyNode(current.children[index], _objectSpread(_objectSpread({}, current[boxId].props), {}, {
36
32
  style: {
37
33
  gridColumn: 'span ' + ratio
38
34
  }
39
35
  }));
40
36
  } else {
41
37
  boxId = "box_".concat(suid());
42
- add(_pageData, id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
38
+ addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
43
39
  buildIn: true,
44
40
  style: {
45
41
  gridColumn: 'span ' + ratio
@@ -47,23 +43,20 @@ var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
47
43
  }));
48
44
  }
49
45
  });
50
- setPageData(_pageData);
51
46
  });
52
47
  useCreation(function () {
53
48
  if (children !== null && children !== void 0 && children.length) return;
54
49
  ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
55
- var compId = _ref2.id,
56
- pageData = _ref2.pageData;
50
+ var compId = _ref2.id;
57
51
  if (compId !== id) return;
58
- refreshChild(pageData);
52
+ refreshChild();
59
53
  }).watch();
60
54
  }, []);
61
55
  useEffect(function () {
62
56
  var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
63
- var compId = _ref3.id,
64
- pageData = _ref3.pageData;
57
+ var compId = _ref3.id;
65
58
  if (compId !== id) return;
66
- refreshChild(pageData);
59
+ refreshChild();
67
60
  }).watch();
68
61
  return function () {
69
62
  return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);