@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
@@ -0,0 +1,63 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["children", "id", "display"];
5
+ import React, { useEffect } from 'react';
6
+ import { useCreation, useMemoizedFn } from 'ahooks';
7
+ import { suid } from '@luck-design-biz/base/utils';
8
+ import { drop } from 'lodash';
9
+ import { useContext, useGet, addNode, deleteNode } from "../../../engine/provider/ContextProvider";
10
+ import Index from "./index";
11
+ import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
12
+ var FunctionDesign = function FunctionDesign(_ref) {
13
+ var children = _ref.children,
14
+ id = _ref.id,
15
+ display = _ref.display,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+ var ctx = useContext();
18
+ var current = useGet({
19
+ id: id
20
+ });
21
+ var refreshChild = useMemoizedFn(function () {
22
+ var _current$children;
23
+ var ratioArr = display.split('');
24
+ if (ratioArr.length === ((_current$children = current.children) === null || _current$children === void 0 ? void 0 : _current$children.length)) return;
25
+ drop(current.children, ratioArr.length).forEach(function (boxId) {
26
+ deleteNode(boxId);
27
+ });
28
+ ratioArr.forEach(function (_, index) {
29
+ var _current$children2;
30
+ if (!((_current$children2 = current.children) !== null && _current$children2 !== void 0 && _current$children2[index])) {
31
+ addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
32
+ buildIn: true
33
+ }));
34
+ }
35
+ });
36
+ });
37
+ useCreation(function () {
38
+ if (children !== null && children !== void 0 && children.length) return;
39
+ ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
40
+ var compId = _ref2.id;
41
+ if (compId !== id) return;
42
+ refreshChild();
43
+ }).watch();
44
+ }, []);
45
+ useEffect(function () {
46
+ var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
47
+ var compId = _ref3.id,
48
+ newValue = _ref3.newValue;
49
+ if (compId !== id) return;
50
+ if (newValue.hasOwnProperty('display')) {
51
+ refreshChild();
52
+ }
53
+ }).watch();
54
+ return function () {
55
+ return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
56
+ };
57
+ }, []);
58
+ return /*#__PURE__*/React.createElement(Index, _extends({
59
+ id: id,
60
+ display: display
61
+ }, props), children);
62
+ };
63
+ export default FunctionDesign;
@@ -0,0 +1,10 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ var _excluded = ["children"];
3
+ import React from 'react';
4
+ import Index from "./index";
5
+ var FunctionLive = function FunctionLive(_ref) {
6
+ var children = _ref.children,
7
+ props = _objectWithoutProperties(_ref, _excluded);
8
+ return /*#__PURE__*/React.createElement(Index, props, children);
9
+ };
10
+ export default FunctionLive;
@@ -0,0 +1,10 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ var _excluded = ["children"];
3
+ import React from 'react';
4
+ import Index from "./index";
5
+ var FunctionPreview = function FunctionPreview(_ref) {
6
+ var children = _ref.children,
7
+ props = _objectWithoutProperties(_ref, _excluded);
8
+ return /*#__PURE__*/React.createElement(Index, props, children);
9
+ };
10
+ export default FunctionPreview;
@@ -0,0 +1,32 @@
1
+ import React, { useRef } from 'react';
2
+ import { useMemoizedFn } from 'ahooks';
3
+ import styled from 'styled-components';
4
+ import { Layout, MemorySplit } from '@luck-design-biz/base';
5
+ import Wrapper from "../Wrapper";
6
+ var StyledLayout = styled(Layout).withConfig({
7
+ displayName: "StyledLayout",
8
+ componentId: "luckda-6530__sc-1igjuug-0"
9
+ })(["", ""], function (props) {
10
+ return props.$css;
11
+ });
12
+ var LCPageLayout = function LCPageLayout(_ref) {
13
+ var id = _ref.id,
14
+ children = _ref.children,
15
+ css = _ref.css,
16
+ display = _ref.display;
17
+ var ref = useRef();
18
+ var getTargetDom = useMemoizedFn(function () {
19
+ return ref.current;
20
+ });
21
+ return /*#__PURE__*/React.createElement(Wrapper, {
22
+ id: id,
23
+ displayName: "PageLayout",
24
+ getTargetDom: getTargetDom
25
+ }, /*#__PURE__*/React.createElement(StyledLayout, {
26
+ wrapperRef: ref,
27
+ $css: css
28
+ }, /*#__PURE__*/React.createElement(Layout.Sider, null, children === null || children === void 0 ? void 0 : children[0]), /*#__PURE__*/React.createElement(Layout.Main, null, (children === null || children === void 0 ? void 0 : children.length) === display.split('').length ? /*#__PURE__*/React.createElement(React.Fragment, null, display === 'lr' ? children === null || children === void 0 ? void 0 : children[1] : /*#__PURE__*/React.createElement(MemorySplit, {
29
+ split: display === 'ltb' ? 'horizontal' : 'vertical'
30
+ }, children === null || children === void 0 ? void 0 : children[1], children === null || children === void 0 ? void 0 : children[2])) : null)));
31
+ };
32
+ export default LCPageLayout;
@@ -0,0 +1,47 @@
1
+ {
2
+ "component": "PageLayout",
3
+ "name": "页面布局容器",
4
+ "icon": "icon-pagelayout",
5
+ "group": "container",
6
+ "groupName": "布局",
7
+ "desc": "页面布局容器一般用于构建页面时根节点的基础布局,分为左右布局、左上下布局以及左中右布局。",
8
+ "order": 1,
9
+ "props": [
10
+ {
11
+ "key": "id",
12
+ "name": "唯一标识",
13
+ "type": "string",
14
+ "disabled": true
15
+ },
16
+ {
17
+ "key": "displaySetting",
18
+ "name": "展现形式",
19
+ "type": "group",
20
+ "props": [
21
+ {
22
+ "key": "display",
23
+ "name": "#展现形式",
24
+ "type": "_PageLayoutDisplay",
25
+ "default": "lr"
26
+ }
27
+ ]
28
+ }
29
+ ],
30
+ "css": "width: 100%, height: 100%, background-color: transparent",
31
+ "advance": {
32
+ "events": [
33
+ {
34
+ "key": "onMount",
35
+ "name": "组件首次渲染时",
36
+ "desc": "在组件首次渲染时,执行方法",
37
+ "func": "function onMount() {\n\t\n}"
38
+ },
39
+ {
40
+ "key": "onUnmount",
41
+ "name": "组件卸载时",
42
+ "desc": "在组件卸载时,执行方法。",
43
+ "func": "function onUnmount() {\n\t\n}"
44
+ }
45
+ ]
46
+ }
47
+ }
@@ -1,23 +1,20 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
1
  import { reduce } from 'lodash';
3
- import { usePageData } from "../../../engine/provider/ContextProvider";
2
+ import { useGet } from "../../../engine/provider/ContextProvider";
4
3
  import useCanvasRender from "../../../engine/tools/useCanvasRender";
5
4
  import { LC_BUILDIN_UNIT_KEY_LIST } from "../../../constants";
6
5
  var PageModal = function PageModal() {
7
- var _usePageData = usePageData(function (pagedata) {
8
- return reduce(pagedata.children, function (result, childId) {
9
- if (!LC_BUILDIN_UNIT_KEY_LIST.includes(childId)) {
10
- result[childId] = pagedata[childId];
11
- if (!result.children) {
12
- result.children = [];
13
- }
14
- result.children.push(childId);
6
+ var pagemodal = useGet(function (pagedata) {
7
+ return reduce(pagedata === null || pagedata === void 0 ? void 0 : pagedata.children, function (result, childId) {
8
+ if (!LC_BUILDIN_UNIT_KEY_LIST.includes(childId)) {
9
+ result[childId] = pagedata[childId];
10
+ if (!result.children) {
11
+ result.children = [];
15
12
  }
16
- return result;
17
- }, {});
18
- }),
19
- _usePageData2 = _slicedToArray(_usePageData, 1),
20
- pagemodal = _usePageData2[0];
13
+ result.children.push(childId);
14
+ }
15
+ return result;
16
+ }, {});
17
+ });
21
18
  return useCanvasRender(pagemodal);
22
19
  };
23
20
  export default PageModal;
@@ -1,13 +1,12 @@
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"];
6
5
  import React from 'react';
7
6
  import Index from "./index";
8
7
  import { useCreation } from 'ahooks';
9
8
  import { suid } from '@luck-design-biz/base/utils';
10
- import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
9
+ import { useContext, addNode } from "../../../engine/provider/ContextProvider";
11
10
  import { add } from "../../../engine/tools/dataProcess";
12
11
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
13
12
  var FunctionDesign = function FunctionDesign(_ref) {
@@ -15,20 +14,15 @@ var FunctionDesign = function FunctionDesign(_ref) {
15
14
  id = _ref.id,
16
15
  props = _objectWithoutProperties(_ref, _excluded);
17
16
  var ctx = useContext();
18
- var _usePageData = usePageData(),
19
- _usePageData2 = _slicedToArray(_usePageData, 2),
20
- setPageData = _usePageData2[1].setPageData;
21
17
  useCreation(function () {
22
18
  if (children !== null && children !== void 0 && children.length) return;
23
19
  ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
24
- var compId = _ref2.id,
25
- pageData = _ref2.pageData;
20
+ var compId = _ref2.id;
26
21
  if (compId !== id) return;
27
22
  var boxId = "box_".concat(suid());
28
- add(pageData, id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
23
+ addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
29
24
  buildIn: true
30
25
  }));
31
- setPageData(pageData);
32
26
  }).watch();
33
27
  }, []);
34
28
  return /*#__PURE__*/React.createElement(Index, _extends({
@@ -94,13 +94,13 @@
94
94
  "key": "onMount",
95
95
  "name": "组件首次渲染时",
96
96
  "desc": "在组件首次渲染时,执行方法",
97
- "func": "(instance)=>{\n\t\n}"
97
+ "func": "function onMount(){\n\t\n}"
98
98
  },
99
99
  {
100
100
  "key": "onUnmount",
101
101
  "name": "组件卸载时",
102
102
  "desc": "在组件卸载时,执行方法。",
103
- "func": "(instance)=>{\n\t\n}"
103
+ "func": "function onUnmount()=>{\n\t\n}"
104
104
  }
105
105
  ]
106
106
  }
@@ -1,14 +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", "display"];
6
5
  import React, { useEffect } from 'react';
7
6
  import { useCreation, useMemoizedFn } from 'ahooks';
8
7
  import { suid } from '@luck-design-biz/base/utils';
9
- import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
8
+ import { drop } from 'lodash';
9
+ import { useContext, useGet, addNode, deleteNode } from "../../../engine/provider/ContextProvider";
10
10
  import Index from "./index";
11
- import { add, deleteById, findNodeAndParent } from "../../../engine/tools/dataProcess";
12
11
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
13
12
  var FunctionDesign = function FunctionDesign(_ref) {
14
13
  var children = _ref.children,
@@ -16,41 +15,41 @@ var FunctionDesign = function FunctionDesign(_ref) {
16
15
  display = _ref.display,
17
16
  props = _objectWithoutProperties(_ref, _excluded);
18
17
  var ctx = useContext();
19
- var _usePageData = usePageData(),
20
- _usePageData2 = _slicedToArray(_usePageData, 2),
21
- setPageData = _usePageData2[1].setPageData;
22
- var refreshChild = useMemoizedFn(function (_pageData) {
23
- var _findNodeAndParent = findNodeAndParent(id, _pageData),
24
- current = _findNodeAndParent.node;
25
- var ratioArr = display.ratio ? display.ratio.split(':') : new Array(display.type.length);
18
+ var current = useGet({
19
+ id: id
20
+ });
21
+ var refreshChild = useMemoizedFn(function () {
22
+ var _current$children;
23
+ var ratioArr = display.ratio.split(':');
24
+ if (ratioArr.length === ((_current$children = current.children) === null || _current$children === void 0 ? void 0 : _current$children.length)) return;
26
25
  drop(current.children, ratioArr.length).forEach(function (boxId) {
27
- deleteById(_pageData, boxId);
26
+ deleteNode(boxId);
28
27
  });
29
28
  ratioArr.forEach(function (_, index) {
30
- var _current$children;
31
- if (!((_current$children = current.children) !== null && _current$children !== void 0 && _current$children[index])) {
32
- add(_pageData, id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
29
+ var _current$children2;
30
+ if (!((_current$children2 = current.children) !== null && _current$children2 !== void 0 && _current$children2[index])) {
31
+ addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
33
32
  buildIn: true
34
33
  }));
35
34
  }
36
35
  });
37
- setPageData(_pageData);
38
36
  });
39
37
  useCreation(function () {
40
38
  if (children !== null && children !== void 0 && children.length) return;
41
39
  ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
42
- var compId = _ref2.id,
43
- pageData = _ref2.pageData;
40
+ var compId = _ref2.id;
44
41
  if (compId !== id) return;
45
- refreshChild(pageData);
42
+ refreshChild();
46
43
  }).watch();
47
44
  }, []);
48
45
  useEffect(function () {
49
46
  var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
50
47
  var compId = _ref3.id,
51
- pageData = _ref3.pageData;
48
+ newValue = _ref3.newValue;
52
49
  if (compId !== id) return;
53
- refreshChild(pageData);
50
+ if (newValue.hasOwnProperty('display')) {
51
+ refreshChild();
52
+ }
54
53
  }).watch();
55
54
  return function () {
56
55
  return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
@@ -1,8 +1,8 @@
1
1
  import React, { useRef } from 'react';
2
- import { useMemoizedFn, useCreation, usePrevious } from 'ahooks';
2
+ import { useMemoizedFn, useCreation } from 'ahooks';
3
3
  import styled from 'styled-components';
4
- import { isNil, sum } from 'lodash';
5
- import { Layout, MemorySplit } from '@luck-design-biz/base';
4
+ import { sum } from 'lodash';
5
+ import { MemorySplit } from '@luck-design-biz/base';
6
6
  import Wrapper from "../Wrapper";
7
7
  var _MAPPING_ = {
8
8
  left: 'min',
@@ -21,13 +21,11 @@ var LCSplit = function LCSplit(_ref) {
21
21
  children = _ref.children,
22
22
  css = _ref.css,
23
23
  display = _ref.display;
24
- var prevDisplay = usePrevious(display);
25
24
  var ref = useRef();
26
25
  var getTargetDom = useMemoizedFn(function () {
27
26
  return ref.current;
28
27
  });
29
28
  var _useCreation = useCreation(function () {
30
- if (isNil(display.ratio)) return {};
31
29
  var arr = display.ratio.split(':').map(function (r) {
32
30
  return parseInt(r);
33
31
  });
@@ -45,7 +43,7 @@ var LCSplit = function LCSplit(_ref) {
45
43
  }, /*#__PURE__*/React.createElement(Div, {
46
44
  ref: ref,
47
45
  $css: css
48
- }, prevDisplay && prevDisplay.type !== display.type ? null : display.type === 'normal' ? /*#__PURE__*/React.createElement(MemorySplit, {
46
+ }, /*#__PURE__*/React.createElement(MemorySplit, {
49
47
  split: display.split
50
48
  }, ratioArr.map(function (r, i) {
51
49
  return /*#__PURE__*/React.createElement(MemorySplit.Pane, {
@@ -53,8 +51,6 @@ var LCSplit = function LCSplit(_ref) {
53
51
  initialSize: "".concat(r / total * 100, "%"),
54
52
  key: i
55
53
  }, children === null || children === void 0 ? void 0 : children[i]);
56
- })) : /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Layout.Sider, null, children[0]), /*#__PURE__*/React.createElement(Layout.Main, null, display.type === 'lr' ? children === null || children === void 0 ? void 0 : children[1] : /*#__PURE__*/React.createElement(MemorySplit, {
57
- split: display.type === 'ltb' ? 'horizontal' : 'vertical'
58
- }, children === null || children === void 0 ? void 0 : children[1], children === null || children === void 0 ? void 0 : children[2])))));
54
+ }))));
59
55
  };
60
56
  export default LCSplit;
@@ -27,26 +27,26 @@
27
27
  ]
28
28
  }
29
29
  ],
30
- "css": "background-color: transparent",
30
+ "css": "width: 100%, height: 100%, background-color: transparent",
31
31
  "advance": {
32
32
  "events": [
33
33
  {
34
34
  "key": "onMount",
35
35
  "name": "组件首次渲染时",
36
36
  "desc": "在组件首次渲染时,执行方法",
37
- "func": "(params)=>{\n\t\n}"
37
+ "func": "function onMount() {\n\t\n}"
38
38
  },
39
39
  {
40
40
  "key": "onUnmount",
41
41
  "name": "组件卸载时",
42
42
  "desc": "在组件卸载时,执行方法。",
43
- "func": "(params)=>{\n\t\n}"
43
+ "func": "function onUnmount() {\n\t\n}"
44
44
  },
45
45
  {
46
46
  "key": "onChange",
47
47
  "name": "尺寸变化事件",
48
48
  "desc": "在面板尺寸发生变化时,执行方法",
49
- "func": "(value)=>{\n\t\n}"
49
+ "func": "function onChange(value) {\n\t\n}"
50
50
  }
51
51
  ]
52
52
  }
@@ -0,0 +1,138 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["options"],
6
+ _excluded2 = ["options", "apiUrl", "tableRef"];
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import { Button, Upload, notification, Icon, Progress } from 'luck-design/antd';
10
+ import { exportExcel, readExportExcelState } from "../../../../constants/api-url";
11
+ import { isString } from 'lodash';
12
+ import { useMemoizedFn, useCreation, useUnmount, useRequest } from 'ahooks';
13
+ import styles from "../../ImEx/index.less";
14
+ export var TopUpload = function TopUpload(_ref) {
15
+ var options = _ref.options,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+ var UploadConfig = {
18
+ name: 'file',
19
+ action: 'https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload',
20
+ headers: {
21
+ authorization: 'authorization-text'
22
+ }
23
+ };
24
+ return /*#__PURE__*/React.createElement(Upload, UploadConfig, /*#__PURE__*/React.createElement(Button, {
25
+ type: "primary"
26
+ }, "\u5BFC\u5165"));
27
+ };
28
+ export var TopExport = function TopExport(_ref2) {
29
+ var options = _ref2.options,
30
+ apiUrl = _ref2.apiUrl,
31
+ tableRef = _ref2.tableRef,
32
+ props = _objectWithoutProperties(_ref2, _excluded2);
33
+ var _useRequest = useRequest(exportExcel, {
34
+ manual: true
35
+ }),
36
+ loading = _useRequest.loading,
37
+ runAsync = _useRequest.runAsync,
38
+ data = _useRequest.data;
39
+ var fecthExcelState = function fecthExcelState(payload, procress, resolve, reject) {
40
+ // 查询进度
41
+ readExportExcelState(payload).then(function (ret) {
42
+ var cpage = ret.cpage,
43
+ total = ret.total,
44
+ downloadUrl = ret.downloadUrl;
45
+ if (cpage >= total) {
46
+ resolve("".concat(window.location.origin, "/api").concat(downloadUrl));
47
+ } else {
48
+ procress(cpage / total * 100);
49
+ fecthExcelState(payload, procress, resolve, reject);
50
+ }
51
+ }).catch(function () {
52
+ reject();
53
+ });
54
+ };
55
+ var handleExportAll = function handleExportAll(procress) {
56
+ return new Promise( /*#__PURE__*/function () {
57
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
58
+ var joiner, payload;
59
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
60
+ while (1) switch (_context.prev = _context.next) {
61
+ case 0:
62
+ joiner = apiUrl.indexOf('?') !== -1 ? '&' : '?';
63
+ _context.next = 3;
64
+ return runAsync({
65
+ apiUrl: "".concat(apiUrl).concat(joiner, "token=").concat(window.cookie.get(window.appConfig.authSaveKey)),
66
+ code: options.export
67
+ });
68
+ case 3:
69
+ payload = _context.sent;
70
+ if (payload && typeof payload === 'string') {
71
+ fecthExcelState(payload, procress, resolve, reject);
72
+ } else {
73
+ reject();
74
+ }
75
+ case 5:
76
+ case "end":
77
+ return _context.stop();
78
+ }
79
+ }, _callee);
80
+ }));
81
+ return function (_x, _x2) {
82
+ return _ref3.apply(this, arguments);
83
+ };
84
+ }());
85
+ };
86
+ var doExportAll = function doExportAll(onExportAll) {
87
+ var key = 'exportAll';
88
+ var notificationConfig = {
89
+ key: key,
90
+ duration: null,
91
+ message: '正在导出数据...',
92
+ placement: 'bottomRight',
93
+ closeIcon: /*#__PURE__*/React.createElement("div", null),
94
+ icon: /*#__PURE__*/React.createElement(Icon, {
95
+ type: "cloud-download",
96
+ className: styles.exportTheme
97
+ })
98
+ };
99
+ var process = function process(i) {
100
+ notification.open(_objectSpread(_objectSpread({}, notificationConfig), {}, {
101
+ description: /*#__PURE__*/React.createElement(Progress, {
102
+ percent: i
103
+ })
104
+ }));
105
+ };
106
+ notification.open(_objectSpread(_objectSpread({}, notificationConfig), {}, {
107
+ description: /*#__PURE__*/React.createElement(Progress, {
108
+ percent: 0
109
+ })
110
+ }));
111
+ onExportAll(process).then(function (ret) {
112
+ if (ret) {
113
+ window.location.href = ret;
114
+ }
115
+ notification.close(key);
116
+ }).catch(function () {
117
+ return notification.open(_objectSpread(_objectSpread({}, notificationConfig), {}, {
118
+ icon: /*#__PURE__*/React.createElement(Icon, {
119
+ type: "cloud-download",
120
+ className: styles.exportErrorTheme
121
+ }),
122
+ message: '导出失败',
123
+ duration: 4
124
+ }));
125
+ });
126
+ };
127
+ return /*#__PURE__*/React.createElement(Button, {
128
+ type: "primary",
129
+ onClick: function onClick() {
130
+ if (!isString(options.export)) {
131
+ // 默认右击导出行为
132
+ tableRef.doExportAll(tableRef.props.onExportAll);
133
+ } else {
134
+ doExportAll(handleExportAll);
135
+ }
136
+ }
137
+ }, "\u5BFC\u51FA");
138
+ };