@luck-design-biz/luckda 0.0.25-6 → 0.0.25-8

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 (255) hide show
  1. package/es/components/LDActions/index.js +8 -10
  2. package/es/components/LDActions/index.less +7 -4
  3. package/es/components/LdAutoForm/index.js +26 -8
  4. package/es/components/LdFormList/index.js +37 -22
  5. package/es/components/LdGrid/index.js +14 -7
  6. package/es/components/LdGridForm/index.js +18 -6
  7. package/es/components/LdTree/index.js +33 -15
  8. package/es/helper/form.js +15 -8
  9. package/es/locales/zh-CN.js +16 -10
  10. package/es/lowcode/constants/api-url.js +120 -32
  11. package/es/lowcode/constants/event-topics.js +2 -0
  12. package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
  13. package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
  14. package/es/lowcode/engine/meta/box.props.json +3 -3
  15. package/es/lowcode/engine/meta/button.props.json +3 -3
  16. package/es/lowcode/engine/meta/components-list.json +6 -0
  17. package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
  18. package/es/lowcode/engine/meta/dialog.props.json +72 -42
  19. package/es/lowcode/engine/meta/drawer.props.json +8 -20
  20. package/es/lowcode/engine/meta/form.props.json +16 -10
  21. package/es/lowcode/engine/meta/imex.props.default.json +8 -1
  22. package/es/lowcode/engine/meta/imex.props.json +54 -22
  23. package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  24. package/es/lowcode/engine/meta/layout.props.json +2 -2
  25. package/es/lowcode/engine/meta/page.props.json +2 -2
  26. package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  27. package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
  28. package/es/lowcode/engine/meta/section.props.json +2 -2
  29. package/es/lowcode/engine/meta/split.props.default.json +1 -1
  30. package/es/lowcode/engine/meta/split.props.json +4 -4
  31. package/es/lowcode/engine/meta/table.props.json +17 -11
  32. package/es/lowcode/engine/meta/tabs.props.json +3 -3
  33. package/es/lowcode/engine/meta/tree.props.default.json +2 -0
  34. package/es/lowcode/engine/meta/tree.props.json +62 -6
  35. package/es/lowcode/engine/provider/ContextProvider/index.js +20 -43
  36. package/es/lowcode/engine/provider/RemoteSourceProvider.js +69 -24
  37. package/es/lowcode/engine/tools/dataProcess.js +4 -0
  38. package/es/lowcode/engine/tools/helper.js +2 -3
  39. package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
  40. package/es/lowcode/engine/tools/usePageDataStore.js +176 -0
  41. package/es/lowcode/engine/tools/usePromiseState.js +12 -23
  42. package/es/lowcode/engine/tools/useTodo.js +20 -10
  43. package/es/lowcode/painter/DesignOperator.js +12 -23
  44. package/es/lowcode/painter/DesignToolbar.js +10 -45
  45. package/es/lowcode/painter/Outline.js +2 -4
  46. package/es/lowcode/painter/Panel.js +29 -28
  47. package/es/lowcode/painter/components/ActionBindModal.js +30 -24
  48. package/es/lowcode/painter/components/AdvancePanel.js +6 -1
  49. package/es/lowcode/painter/components/AttrsPanel.js +38 -29
  50. package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
  51. package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
  52. package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
  53. package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  54. package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
  55. package/es/lowcode/painter/components/field-setting/SettingUI.js +162 -30
  56. package/es/lowcode/painter/components/field-setting/index.js +32 -63
  57. package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
  58. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +14 -17
  59. package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
  60. package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
  61. package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -8
  62. package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
  63. package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
  64. package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
  65. package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
  66. package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
  67. package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  68. package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
  69. package/es/lowcode/painter/style/action-bind-modal.less +3 -3
  70. package/es/lowcode/painter/style/design.less +1 -1
  71. package/es/lowcode/painter/style/page-layout-display.less +28 -0
  72. package/es/lowcode/painter/style/panel-item.less +1 -1
  73. package/es/lowcode/painter/style/split-display.less +0 -9
  74. package/es/lowcode/preview/index.js +4 -2
  75. package/es/lowcode/view/Canvas.js +6 -7
  76. package/es/lowcode/view/Page.js +2 -3
  77. package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  78. package/es/lowcode/view/lc-components/Box/meta.json +3 -3
  79. package/es/lowcode/view/lc-components/Button/index.js +2 -6
  80. package/es/lowcode/view/lc-components/Button/meta.json +3 -3
  81. package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
  82. package/es/lowcode/view/lc-components/Dialog/index.js +114 -19
  83. package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
  84. package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
  85. package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
  86. package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  87. package/es/lowcode/view/lc-components/Form/index.js +113 -21
  88. package/es/lowcode/view/lc-components/Form/meta.json +16 -10
  89. package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  90. package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
  91. package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
  92. package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
  93. package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +12 -19
  94. package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
  95. package/es/lowcode/view/lc-components/Page/meta.json +2 -2
  96. package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
  97. package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
  98. package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
  99. package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
  100. package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
  101. package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
  102. package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
  103. package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  104. package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
  105. package/es/lowcode/view/lc-components/Section/FunctionDesign.js +3 -9
  106. package/es/lowcode/view/lc-components/Section/meta.json +2 -2
  107. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
  108. package/es/lowcode/view/lc-components/Split/index.js +5 -9
  109. package/es/lowcode/view/lc-components/Split/meta.json +4 -4
  110. package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
  111. package/es/lowcode/view/lc-components/Table/index.js +124 -39
  112. package/es/lowcode/view/lc-components/Table/meta.json +17 -11
  113. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +10 -17
  114. package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
  115. package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
  116. package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  117. package/es/lowcode/view/lc-components/Tree/index.js +67 -18
  118. package/es/lowcode/view/lc-components/Tree/meta.json +62 -7
  119. package/es/lowcode/view/lc-components/Wrapper.js +9 -11
  120. package/es/services.js +0 -24
  121. package/es/upload/FilesWall/file.png +0 -0
  122. package/es/upload/FilesWall/index.js +422 -0
  123. package/es/upload/FilesWall/index.less +74 -0
  124. package/es/upload/Form/index.js +2 -1
  125. package/es/upload/FormItem/index.js +3 -5
  126. package/es/upload/index.js +2 -1
  127. package/es/utils/action.js +2 -2
  128. package/lib/components/LDActions/index.js +7 -9
  129. package/lib/components/LDActions/index.less +7 -4
  130. package/lib/components/LdAutoForm/index.js +25 -7
  131. package/lib/components/LdFormList/index.js +36 -21
  132. package/lib/components/LdGrid/index.js +14 -7
  133. package/lib/components/LdGridForm/index.js +16 -4
  134. package/lib/components/LdTree/index.js +33 -15
  135. package/lib/helper/form.js +14 -7
  136. package/lib/locales/zh-CN.js +16 -10
  137. package/lib/lowcode/constants/api-url.js +123 -32
  138. package/lib/lowcode/constants/event-topics.js +3 -1
  139. package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
  140. package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
  141. package/lib/lowcode/engine/meta/box.props.json +3 -3
  142. package/lib/lowcode/engine/meta/button.props.json +3 -3
  143. package/lib/lowcode/engine/meta/components-list.json +6 -0
  144. package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
  145. package/lib/lowcode/engine/meta/dialog.props.json +72 -42
  146. package/lib/lowcode/engine/meta/drawer.props.json +8 -20
  147. package/lib/lowcode/engine/meta/form.props.json +16 -10
  148. package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
  149. package/lib/lowcode/engine/meta/imex.props.json +54 -22
  150. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  151. package/lib/lowcode/engine/meta/layout.props.json +2 -2
  152. package/lib/lowcode/engine/meta/page.props.json +2 -2
  153. package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  154. package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
  155. package/lib/lowcode/engine/meta/section.props.json +2 -2
  156. package/lib/lowcode/engine/meta/split.props.default.json +1 -1
  157. package/lib/lowcode/engine/meta/split.props.json +4 -4
  158. package/lib/lowcode/engine/meta/table.props.json +17 -11
  159. package/lib/lowcode/engine/meta/tabs.props.json +3 -3
  160. package/lib/lowcode/engine/meta/tree.props.default.json +2 -0
  161. package/lib/lowcode/engine/meta/tree.props.json +62 -6
  162. package/lib/lowcode/engine/provider/ContextProvider/index.js +36 -43
  163. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +68 -23
  164. package/lib/lowcode/engine/tools/dataProcess.js +4 -0
  165. package/lib/lowcode/engine/tools/helper.js +2 -3
  166. package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
  167. package/lib/lowcode/engine/tools/usePageDataStore.js +183 -0
  168. package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
  169. package/lib/lowcode/engine/tools/useTodo.js +19 -9
  170. package/lib/lowcode/painter/DesignOperator.js +11 -22
  171. package/lib/lowcode/painter/DesignToolbar.js +9 -44
  172. package/lib/lowcode/painter/Outline.js +1 -3
  173. package/lib/lowcode/painter/Panel.js +28 -27
  174. package/lib/lowcode/painter/components/ActionBindModal.js +28 -22
  175. package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
  176. package/lib/lowcode/painter/components/AttrsPanel.js +37 -28
  177. package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
  178. package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
  179. package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
  180. package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  181. package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
  182. package/lib/lowcode/painter/components/field-setting/SettingUI.js +159 -27
  183. package/lib/lowcode/painter/components/field-setting/index.js +32 -63
  184. package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
  185. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +13 -16
  186. package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
  187. package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
  188. package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -8
  189. package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
  190. package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
  191. package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
  192. package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
  193. package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
  194. package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  195. package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
  196. package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
  197. package/lib/lowcode/painter/style/design.less +1 -1
  198. package/lib/lowcode/painter/style/page-layout-display.less +28 -0
  199. package/lib/lowcode/painter/style/panel-item.less +1 -1
  200. package/lib/lowcode/painter/style/split-display.less +0 -9
  201. package/lib/lowcode/preview/index.js +4 -2
  202. package/lib/lowcode/view/Canvas.js +5 -6
  203. package/lib/lowcode/view/Page.js +2 -3
  204. package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  205. package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
  206. package/lib/lowcode/view/lc-components/Button/index.js +2 -6
  207. package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
  208. package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
  209. package/lib/lowcode/view/lc-components/Dialog/index.js +114 -19
  210. package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
  211. package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
  212. package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
  213. package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  214. package/lib/lowcode/view/lc-components/Form/index.js +110 -18
  215. package/lib/lowcode/view/lc-components/Form/meta.json +16 -10
  216. package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  217. package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
  218. package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
  219. package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
  220. package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -18
  221. package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
  222. package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
  223. package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
  224. package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
  225. package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
  226. package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
  227. package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
  228. package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
  229. package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
  230. package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  231. package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
  232. package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +2 -8
  233. package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
  234. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
  235. package/lib/lowcode/view/lc-components/Split/index.js +2 -6
  236. package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
  237. package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
  238. package/lib/lowcode/view/lc-components/Table/index.js +123 -38
  239. package/lib/lowcode/view/lc-components/Table/meta.json +17 -11
  240. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +11 -18
  241. package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
  242. package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
  243. package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  244. package/lib/lowcode/view/lc-components/Tree/index.js +65 -16
  245. package/lib/lowcode/view/lc-components/Tree/meta.json +62 -7
  246. package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
  247. package/lib/services.js +0 -25
  248. package/lib/upload/FilesWall/file.png +0 -0
  249. package/lib/upload/FilesWall/index.js +429 -0
  250. package/lib/upload/FilesWall/index.less +74 -0
  251. package/lib/upload/Form/index.js +2 -1
  252. package/lib/upload/FormItem/index.js +3 -5
  253. package/lib/upload/index.js +8 -1
  254. package/lib/utils/action.js +2 -2
  255. package/package.json +5 -4
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance"];
5
- import React, { useRef, useImperativeHandle, forwardRef } from 'react';
5
+ var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "onlyRoot", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance", "cancelSelect", "defaultSelect"];
6
+ import React, { useRef, useImperativeHandle, forwardRef, useState, useEffect } from 'react';
6
7
  import PropTypes from 'prop-types';
7
8
  import { useMemoizedFn, useCreation } from 'ahooks';
8
9
  import classNames from 'classnames';
9
- import { isNil } from 'lodash';
10
+ import { isNil, keyBy } from 'lodash';
10
11
  import { IconFont } from '@luck-design-biz/base';
11
12
  import { suid } from '@luck-design-biz/base/utils';
12
13
  import { useContext } from "../../../engine/provider/ContextProvider";
@@ -15,6 +16,7 @@ import { LdTree } from "../../../../index";
15
16
  import { omitBadProps, executeCode } from "../../../engine/tools/helper";
16
17
  import defaultMeta from "../../../engine/meta/tree.props.default.json";
17
18
  import styles from "./index.less";
19
+ var PRIMARY = window.appConfig.constraintKeys.PRIMARY;
18
20
  var LCTree = function LCTree(_ref) {
19
21
  var id = _ref.id,
20
22
  wrapperRef = _ref.wrapperRef,
@@ -27,6 +29,7 @@ var LCTree = function LCTree(_ref) {
27
29
  actions = _ref.actions,
28
30
  editable = _ref.editable,
29
31
  showRootAdd = _ref.showRootAdd,
32
+ onlyRoot = _ref.onlyRoot,
30
33
  rootAddSetting = _ref.rootAddSetting,
31
34
  doubleClickExpand = _ref.doubleClickExpand,
32
35
  onDoubleClick = _ref.onDoubleClick,
@@ -36,16 +39,36 @@ var LCTree = function LCTree(_ref) {
36
39
  onTreeNodeRender = _ref.onTreeNodeRender,
37
40
  _treeNodeIcon = _ref.treeNodeIcon,
38
41
  advance = _ref.advance,
42
+ cancelSelect = _ref.cancelSelect,
43
+ defaultSelect = _ref.defaultSelect,
39
44
  props = _objectWithoutProperties(_ref, _excluded);
40
45
  var ctx = useContext();
41
46
  var boxRef = useRef();
42
47
  var treeRef = useRef();
48
+ var _useState = useState([]),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ selectedKeys = _useState2[0],
51
+ setSelectedKeys = _useState2[1];
43
52
  var getTargetDom = useMemoizedFn(function () {
44
53
  return boxRef.current;
45
54
  });
46
55
  useImperativeHandle(wrapperRef, function () {
47
56
  return treeRef.current;
48
57
  });
58
+ useEffect(function () {
59
+ var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref2) {
60
+ var resource = _ref2.resource,
61
+ prevResource = _ref2.prevResource;
62
+ ctx.doAction(advance.events.onPagePublicResourceChanged, {
63
+ resource: resource,
64
+ prevResource: prevResource,
65
+ instance: treeRef.current
66
+ });
67
+ }).watch();
68
+ return function () {
69
+ ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
70
+ };
71
+ }, []);
49
72
  var handleMount = useMemoizedFn(function (params) {
50
73
  ctx.doAction(advance.events.onMount, {
51
74
  params: params
@@ -71,6 +94,12 @@ var LCTree = function LCTree(_ref) {
71
94
  e: e
72
95
  });
73
96
  });
97
+ var handleDrop = useMemoizedFn(function (info, dragInfo) {
98
+ ctx.doAction(advance.events.onCheck, {
99
+ info: info,
100
+ dragInfo: dragInfo
101
+ });
102
+ });
74
103
  var events = useCreation(function () {
75
104
  if (advance !== null && advance !== void 0 && advance.events) {
76
105
  var _events = {};
@@ -79,24 +108,31 @@ var LCTree = function LCTree(_ref) {
79
108
  if (advance.events.processDataSource) _events.dataToTreeFormat = handleProcessDataSource;
80
109
  if (advance.events.onDoubleClick) _events.onNodeDoubleClick = handleNodeDoubleClick;
81
110
  if (advance.events.onCheck) _events.onCheck = handleCheck;
111
+ if (advance.events.onDrop) _events.onDrop = handleDrop;
82
112
  return _events;
83
113
  }
84
114
  return {};
85
115
  }, [advance === null || advance === void 0 ? void 0 : advance.events]);
86
- var handleDrop = useMemoizedFn(function (info, dragInfo) {
87
- if (dragInfo !== false) {
88
- // ctx.doAction(advance.events.onDoubleClick, { e, rowData });
89
- // doAction('drag', {
90
- // get: { datasetCode: dataSetKey },
91
- // post: {
92
- // fromId: info.dragNode.props.dataRef[PRIMARY],
93
- // toId: info.node.props.dataRef[PRIMARY],
94
- // }
95
- // }, {
96
- // showConfirm: false,
97
- // callback: (success) => success && onLdQuery()
98
- // });
116
+ var handleSelect = useMemoizedFn(function (_selectedKeys, e) {
117
+ if (cancelSelect || e.selected) {
118
+ setSelectedKeys(_selectedKeys);
119
+ ctx.setPagePublicResource(_defineProperty({}, id, {
120
+ selectedNodes: e.selectedNodes
121
+ }));
99
122
  }
123
+ ctx.doAction(advance.events.onSelect, {
124
+ checkedKeys: _selectedKeys,
125
+ e: e
126
+ });
127
+ });
128
+ var afterInit = useMemoizedFn(function (treeData, data) {
129
+ var selected = !isNil(defaultSelect) ? executeCode(ctx, defaultSelect, ['treeData'], treeData) : null;
130
+ selected && handleSelect(selected, {
131
+ selected: true,
132
+ selectedNodes: selected.map(function (key) {
133
+ return keyBy(data, PRIMARY)[key];
134
+ })
135
+ });
100
136
  });
101
137
  return /*#__PURE__*/React.createElement(Wrapper, {
102
138
  id: id,
@@ -125,6 +161,7 @@ var LCTree = function LCTree(_ref) {
125
161
  return ctx.doAction(rootAddSetting.actionPool);
126
162
  }
127
163
  } : null,
164
+ onlyRoot: onlyRoot,
128
165
  rightMenus: function rightMenus() {
129
166
  return actions.todoList.map(function (action) {
130
167
  return {
@@ -173,7 +210,9 @@ var LCTree = function LCTree(_ref) {
173
210
  onTreeNodeRender: onTreeNodeRender ? function (title, i) {
174
211
  return executeCode(ctx, onTreeNodeRender, ['title', 'item'], title, i);
175
212
  } : null,
176
- onDrop: handleDrop
213
+ selectedKeys: selectedKeys,
214
+ onSelect: handleSelect,
215
+ afterInit: afterInit
177
216
  }, events, props))));
178
217
  };
179
218
  LCTree.propTypes = {
@@ -257,6 +296,11 @@ LCTree.propTypes = {
257
296
  * @type bool
258
297
  */
259
298
  showRootAdd: PropTypes.bool,
299
+ /**
300
+ * @name 是否只有唯一一个根节点
301
+ * @type bool
302
+ */
303
+ onlyRoot: PropTypes.bool,
260
304
  /**
261
305
  * @name 根节点配置
262
306
  * @type object
@@ -325,7 +369,12 @@ LCTree.propTypes = {
325
369
  * @name 复选框选择事件
326
370
  * @type _JSEditor
327
371
  */
328
- onCheck: PropTypes.string
372
+ onCheck: PropTypes.string,
373
+ /**
374
+ * @name 选中事件
375
+ * @type _JSEditor
376
+ */
377
+ onSelect: PropTypes.string
329
378
  };
330
379
  LCTree.defaultProps = omitBadProps(defaultMeta);
331
380
  export default /*#__PURE__*/forwardRef(function (props, ref) {
@@ -17,7 +17,18 @@
17
17
  "key": "dataset",
18
18
  "name": "数据集",
19
19
  "desc": "选择系统中的可用树形数据集",
20
- "type": "_DataSetSelector"
20
+ "type": "_DataSetSelector",
21
+ "next": {
22
+ "name": "字段配置",
23
+ "props": [
24
+ {
25
+ "key": "fields",
26
+ "name": "#字段配置器",
27
+ "type": "_FieldsSetting",
28
+ "component": "tree"
29
+ }
30
+ ]
31
+ }
21
32
  },
22
33
  {
23
34
  "key": "title",
@@ -118,6 +129,31 @@
118
129
  "default": "0"
119
130
  }
120
131
  ]
132
+ }, {
133
+ "key": "selectSetting",
134
+ "name": "选中设置",
135
+ "type": "group",
136
+ "props": [
137
+ {
138
+ "key": "cancelSelect",
139
+ "name": "取消选中",
140
+ "desc": "是否可以取消选中",
141
+ "type": "switch",
142
+ "default": true
143
+ },
144
+ {
145
+ "key": "defaultSelect",
146
+ "name": "默认选中",
147
+ "desc": "返回默认选中的数据主键",
148
+ "type": "_JSEditor",
149
+ "defaultCode": "function defaultSelect(treeData) { \n return []; \n}",
150
+ "mustConfirm": true,
151
+ "wrapper": "collapse",
152
+ "wrapperProps": {
153
+ "suppressIcon": true
154
+ }
155
+ }
156
+ ]
121
157
  },
122
158
  {
123
159
  "key": "IconSetting",
@@ -168,6 +204,13 @@
168
204
  "type": "switch",
169
205
  "default": true
170
206
  },
207
+ {
208
+ "key": "onlyRoot",
209
+ "name": "根节点唯一",
210
+ "desc": "树组件仅一个根节点,如数据根节点数大于0,则不允许根节点新增",
211
+ "type": "switch",
212
+ "default": false
213
+ },
171
214
  {
172
215
  "key": "rootAddSetting",
173
216
  "name": "根节点配置",
@@ -270,32 +313,44 @@
270
313
  "key": "onMount",
271
314
  "name": "组件首次渲染时",
272
315
  "desc": "在组件首次渲染时,执行方法",
273
- "func": "(params)=>{\n\t\n}"
316
+ "func": "function onMount(params) {\n\t\n}"
274
317
  },
275
318
  {
276
319
  "key": "onUnmount",
277
320
  "name": "组件卸载时",
278
321
  "desc": "在组件卸载时,执行方法。",
279
- "func": "()=>{\n\t\n}"
322
+ "func": "function onUnmount() {\n\t\n}"
280
323
  },
281
324
  {
282
325
  "key": "processDataSource",
283
326
  "name": "数据预处理",
284
327
  "desc": "数据渲染前预处理",
285
- "func": "(data)=>{\n\t\n}"
328
+ "func": "function processDataSource(data) {\n\t\n}"
286
329
  },
287
330
  {
288
331
  "key": "onDoubleClick",
289
332
  "name": "双击事件",
290
333
  "desc": "树节点双击事件",
291
- "func": "(e, rowData)=>{\n\t\n}"
334
+ "func": "function onDoubleClick(e, rowData) {\n\t\n}"
292
335
  },
293
336
  {
294
337
  "key": "onCheck",
295
338
  "name": "复选框选择事件",
296
339
  "desc": "点击复选框触发",
297
- "func": "(checkedKeys, e)=>{\n\t\n}"
340
+ "func": "function onCheck(checkedKeys, e) {\n\t\n}"
341
+ },
342
+ {
343
+ "key": "onSelect",
344
+ "name": "选中事件",
345
+ "desc": "节点选中事件",
346
+ "func": "function onSelect(checkedKeys, e) {\n\t\n}"
347
+ },
348
+ {
349
+ "key": "onDrop",
350
+ "name": "拖拽事件",
351
+ "desc": "节点拖拽事件",
352
+ "func": "function onDrop(info, dragInfo) {\n\t\n}"
298
353
  }
299
354
  ]
300
355
  }
301
- }
356
+ }
@@ -1,10 +1,8 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import React, { useEffect } from 'react';
4
3
  import { useLatest, useCreation } from 'ahooks';
5
4
  import { omit } from 'lodash';
6
- import { useContext, usePageData } from "../../engine/provider/ContextProvider";
7
- import { findNodeAndParent, getPathNodesById } from "../../engine/tools/dataProcess";
5
+ import { useContext, useGet, getLevelNodes as _getLevelNodes, getSelfAndParent } from "../../engine/provider/ContextProvider";
8
6
  import { LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT, RUNTIME } from "../../constants";
9
7
  import DragDropWrapper from "../../painter/components/DragDrop/DragDropWrapper";
10
8
  var LCWrapper = function LCWrapper(_ref) {
@@ -14,23 +12,23 @@ var LCWrapper = function LCWrapper(_ref) {
14
12
  getTargetDom = _ref.getTargetDom,
15
13
  api = _ref.api;
16
14
  var ctx = useContext();
17
- var _usePageData = usePageData(),
18
- _usePageData2 = _slicedToArray(_usePageData, 1),
19
- pageData = _usePageData2[0];
20
- var _pageData = useLatest(pageData);
15
+ var selfData = useGet({
16
+ id: id
17
+ });
18
+ var _selfData = useLatest(selfData);
21
19
  useCreation(function () {
22
20
  var meta = displayName ? require("../../engine/meta/".concat(displayName.toLowerCase(), ".props.json")) : {};
23
21
  var _api = {
24
22
  self: children,
25
23
  getSelfData: function getSelfData() {
26
- return children.props;
24
+ return _selfData.current;
27
25
  },
28
26
  getSelfDom: getTargetDom,
29
- getSelfAndParentLCData: function getSelfAndParentLCData() {
30
- return findNodeAndParent(id, _pageData.current);
27
+ getSelfAndParentData: function getSelfAndParentData() {
28
+ return getSelfAndParent(id);
31
29
  },
32
30
  getLevelNodes: function getLevelNodes() {
33
- return getPathNodesById(_pageData.current, id);
31
+ return _getLevelNodes(id);
34
32
  }
35
33
  };
36
34
  ctx._register(id, new Proxy({
package/es/services.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import { stringify } from 'querystring';
4
3
  import { request } from '@luck-design-biz/base/utils';
5
4
  import api from "@/services/ApiConfig";
6
5
  export function readModlue(_x) {
@@ -21,27 +20,4 @@ function _readModlue() {
21
20
  }, _callee);
22
21
  }));
23
22
  return _readModlue.apply(this, arguments);
24
- }
25
- export function readBehaviorCall(_x2, _x3) {
26
- return _readBehaviorCall.apply(this, arguments);
27
- }
28
- function _readBehaviorCall() {
29
- _readBehaviorCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(get, post) {
30
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
31
- while (1) switch (_context2.prev = _context2.next) {
32
- case 0:
33
- return _context2.abrupt("return", request("".concat(api.API_HOST, "/lowcode/to/behavior/call?").concat(stringify(get)), {
34
- method: 'POST',
35
- body: post,
36
- headers: {
37
- 'Content-Type': 'application/json;charset=UTF-8'
38
- }
39
- }));
40
- case 1:
41
- case "end":
42
- return _context2.stop();
43
- }
44
- }, _callee2);
45
- }));
46
- return _readBehaviorCall.apply(this, arguments);
47
23
  }
Binary file