@luck-design-biz/luckda 0.0.25-7 → 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 (187) 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 +8 -6
  4. package/es/components/LdFormList/index.js +12 -4
  5. package/es/components/LdGrid/index.js +11 -5
  6. package/es/components/LdGridForm/index.js +4 -2
  7. package/es/components/LdTree/index.js +30 -13
  8. package/es/helper/form.js +9 -5
  9. package/es/locales/zh-CN.js +15 -10
  10. package/es/lowcode/constants/api-url.js +112 -26
  11. package/es/lowcode/constants/event-topics.js +2 -0
  12. package/es/lowcode/engine/meta/box.props.json +3 -3
  13. package/es/lowcode/engine/meta/button.props.json +3 -3
  14. package/es/lowcode/engine/meta/components-list.json +6 -0
  15. package/es/lowcode/engine/meta/dialog.props.json +5 -5
  16. package/es/lowcode/engine/meta/drawer.props.json +8 -20
  17. package/es/lowcode/engine/meta/form.props.json +13 -7
  18. package/es/lowcode/engine/meta/imex.props.default.json +8 -1
  19. package/es/lowcode/engine/meta/imex.props.json +54 -22
  20. package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  21. package/es/lowcode/engine/meta/layout.props.json +2 -2
  22. package/es/lowcode/engine/meta/page.props.json +2 -2
  23. package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  24. package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
  25. package/es/lowcode/engine/meta/section.props.json +2 -2
  26. package/es/lowcode/engine/meta/split.props.default.json +1 -1
  27. package/es/lowcode/engine/meta/split.props.json +4 -4
  28. package/es/lowcode/engine/meta/table.props.json +15 -9
  29. package/es/lowcode/engine/meta/tabs.props.json +3 -3
  30. package/es/lowcode/engine/meta/tree.props.default.json +1 -0
  31. package/es/lowcode/engine/meta/tree.props.json +55 -6
  32. package/es/lowcode/engine/provider/ContextProvider/index.js +12 -3
  33. package/es/lowcode/engine/provider/RemoteSourceProvider.js +55 -6
  34. package/es/lowcode/engine/tools/dataProcess.js +4 -0
  35. package/es/lowcode/engine/tools/usePageDataStore.js +4 -2
  36. package/es/lowcode/painter/DesignOperator.js +1 -1
  37. package/es/lowcode/painter/DesignToolbar.js +2 -1
  38. package/es/lowcode/painter/Panel.js +3 -3
  39. package/es/lowcode/painter/components/ActionBindModal.js +25 -13
  40. package/es/lowcode/painter/components/AdvancePanel.js +6 -1
  41. package/es/lowcode/painter/components/AttrsPanel.js +13 -11
  42. package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
  43. package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  44. package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
  45. package/es/lowcode/painter/components/field-setting/SettingUI.js +156 -24
  46. package/es/lowcode/painter/components/field-setting/index.js +32 -63
  47. package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
  48. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
  49. package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -12
  50. package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
  51. package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
  52. package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
  53. package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
  54. package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  55. package/es/lowcode/painter/style/action-bind-modal.less +3 -3
  56. package/es/lowcode/painter/style/page-layout-display.less +28 -0
  57. package/es/lowcode/painter/style/split-display.less +0 -9
  58. package/es/lowcode/preview/index.js +4 -2
  59. package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  60. package/es/lowcode/view/lc-components/Box/meta.json +3 -3
  61. package/es/lowcode/view/lc-components/Button/index.js +2 -6
  62. package/es/lowcode/view/lc-components/Button/meta.json +3 -3
  63. package/es/lowcode/view/lc-components/Dialog/index.js +27 -2
  64. package/es/lowcode/view/lc-components/Dialog/meta.json +5 -5
  65. package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
  66. package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  67. package/es/lowcode/view/lc-components/Form/index.js +99 -21
  68. package/es/lowcode/view/lc-components/Form/meta.json +13 -7
  69. package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  70. package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
  71. package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
  72. package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
  73. package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
  74. package/es/lowcode/view/lc-components/Page/meta.json +2 -2
  75. package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
  76. package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
  77. package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
  78. package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
  79. package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  80. package/es/lowcode/view/lc-components/Section/meta.json +2 -2
  81. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +11 -5
  82. package/es/lowcode/view/lc-components/Split/index.js +5 -9
  83. package/es/lowcode/view/lc-components/Split/meta.json +4 -4
  84. package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
  85. package/es/lowcode/view/lc-components/Table/index.js +60 -17
  86. package/es/lowcode/view/lc-components/Table/meta.json +15 -9
  87. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +1 -0
  88. package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
  89. package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
  90. package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  91. package/es/lowcode/view/lc-components/Tree/index.js +60 -18
  92. package/es/lowcode/view/lc-components/Tree/meta.json +55 -7
  93. package/es/upload/FormItem/index.js +1 -4
  94. package/lib/components/LDActions/index.js +7 -9
  95. package/lib/components/LDActions/index.less +7 -4
  96. package/lib/components/LdAutoForm/index.js +7 -5
  97. package/lib/components/LdFormList/index.js +11 -3
  98. package/lib/components/LdGrid/index.js +11 -5
  99. package/lib/components/LdGridForm/index.js +4 -2
  100. package/lib/components/LdTree/index.js +30 -13
  101. package/lib/helper/form.js +8 -4
  102. package/lib/locales/zh-CN.js +15 -10
  103. package/lib/lowcode/constants/api-url.js +113 -26
  104. package/lib/lowcode/constants/event-topics.js +3 -1
  105. package/lib/lowcode/engine/meta/box.props.json +3 -3
  106. package/lib/lowcode/engine/meta/button.props.json +3 -3
  107. package/lib/lowcode/engine/meta/components-list.json +6 -0
  108. package/lib/lowcode/engine/meta/dialog.props.json +5 -5
  109. package/lib/lowcode/engine/meta/drawer.props.json +8 -20
  110. package/lib/lowcode/engine/meta/form.props.json +13 -7
  111. package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
  112. package/lib/lowcode/engine/meta/imex.props.json +54 -22
  113. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  114. package/lib/lowcode/engine/meta/layout.props.json +2 -2
  115. package/lib/lowcode/engine/meta/page.props.json +2 -2
  116. package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  117. package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
  118. package/lib/lowcode/engine/meta/section.props.json +2 -2
  119. package/lib/lowcode/engine/meta/split.props.default.json +1 -1
  120. package/lib/lowcode/engine/meta/split.props.json +4 -4
  121. package/lib/lowcode/engine/meta/table.props.json +15 -9
  122. package/lib/lowcode/engine/meta/tabs.props.json +3 -3
  123. package/lib/lowcode/engine/meta/tree.props.default.json +1 -0
  124. package/lib/lowcode/engine/meta/tree.props.json +55 -6
  125. package/lib/lowcode/engine/provider/ContextProvider/index.js +11 -2
  126. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +54 -5
  127. package/lib/lowcode/engine/tools/dataProcess.js +4 -0
  128. package/lib/lowcode/engine/tools/usePageDataStore.js +4 -2
  129. package/lib/lowcode/painter/DesignOperator.js +1 -1
  130. package/lib/lowcode/painter/DesignToolbar.js +2 -1
  131. package/lib/lowcode/painter/Panel.js +3 -3
  132. package/lib/lowcode/painter/components/ActionBindModal.js +23 -11
  133. package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
  134. package/lib/lowcode/painter/components/AttrsPanel.js +12 -10
  135. package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
  136. package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  137. package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
  138. package/lib/lowcode/painter/components/field-setting/SettingUI.js +153 -21
  139. package/lib/lowcode/painter/components/field-setting/index.js +32 -63
  140. package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
  141. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
  142. package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -12
  143. package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
  144. package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
  145. package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
  146. package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
  147. package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  148. package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
  149. package/lib/lowcode/painter/style/page-layout-display.less +28 -0
  150. package/lib/lowcode/painter/style/split-display.less +0 -9
  151. package/lib/lowcode/preview/index.js +4 -2
  152. package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  153. package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
  154. package/lib/lowcode/view/lc-components/Button/index.js +2 -6
  155. package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
  156. package/lib/lowcode/view/lc-components/Dialog/index.js +29 -4
  157. package/lib/lowcode/view/lc-components/Dialog/meta.json +5 -5
  158. package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
  159. package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  160. package/lib/lowcode/view/lc-components/Form/index.js +96 -18
  161. package/lib/lowcode/view/lc-components/Form/meta.json +13 -7
  162. package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  163. package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
  164. package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
  165. package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
  166. package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
  167. package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
  168. package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
  169. package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
  170. package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
  171. package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
  172. package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  173. package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
  174. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +12 -6
  175. package/lib/lowcode/view/lc-components/Split/index.js +2 -6
  176. package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
  177. package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
  178. package/lib/lowcode/view/lc-components/Table/index.js +59 -16
  179. package/lib/lowcode/view/lc-components/Table/meta.json +15 -9
  180. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +3 -2
  181. package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
  182. package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
  183. package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  184. package/lib/lowcode/view/lc-components/Tree/index.js +58 -16
  185. package/lib/lowcode/view/lc-components/Tree/meta.json +55 -7
  186. package/lib/upload/FormItem/index.js +1 -4
  187. package/package.json +2 -2
@@ -94,13 +94,13 @@
94
94
  "key": "onMount",
95
95
  "name": "组件首次渲染时",
96
96
  "desc": "在组件首次渲染时,执行方法",
97
- "func": "(params)=>{\n\t\n}"
97
+ "func": "function onMount(params) {\n\t\n}"
98
98
  },
99
99
  {
100
100
  "key": "onUnmount",
101
101
  "name": "组件卸载时",
102
102
  "desc": "在组件卸载时,执行方法。",
103
- "func": "(params)=>{\n\t\n}"
103
+ "func": "function onUnmount(params) {\n\t\n}"
104
104
  }
105
105
  ]
106
106
  }
@@ -36,13 +36,13 @@
36
36
  "key": "onPageMount",
37
37
  "name": "组件首次渲染时",
38
38
  "desc": "在组件首次渲染时,执行方法",
39
- "func": "(params)=>{\n\t\n}"
39
+ "func": "function onPageMount()=>{\n\t\n}"
40
40
  },
41
41
  {
42
42
  "key": "onPageUnmount",
43
43
  "name": "组件卸载时",
44
44
  "desc": "在组件卸载时,执行方法。",
45
- "func": "(params)=>{\n\t\n}"
45
+ "func": "function onPageUnmount()=>{\n\t\n}"
46
46
  }
47
47
  ]
48
48
  }
@@ -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
+ }
@@ -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
  }
@@ -5,6 +5,7 @@ var _excluded = ["children", "id", "display"];
5
5
  import React, { useEffect } from 'react';
6
6
  import { useCreation, useMemoizedFn } from 'ahooks';
7
7
  import { suid } from '@luck-design-biz/base/utils';
8
+ import { drop } from 'lodash';
8
9
  import { useContext, useGet, addNode, deleteNode } from "../../../engine/provider/ContextProvider";
9
10
  import Index from "./index";
10
11
  import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
@@ -18,13 +19,15 @@ var FunctionDesign = function FunctionDesign(_ref) {
18
19
  id: id
19
20
  });
20
21
  var refreshChild = useMemoizedFn(function () {
21
- var ratioArr = display.ratio ? display.ratio.split(':') : new Array(display.type.length);
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;
22
25
  drop(current.children, ratioArr.length).forEach(function (boxId) {
23
26
  deleteNode(boxId);
24
27
  });
25
28
  ratioArr.forEach(function (_, index) {
26
- var _current$children;
27
- if (!((_current$children = current.children) !== null && _current$children !== void 0 && _current$children[index])) {
29
+ var _current$children2;
30
+ if (!((_current$children2 = current.children) !== null && _current$children2 !== void 0 && _current$children2[index])) {
28
31
  addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
29
32
  buildIn: true
30
33
  }));
@@ -41,9 +44,12 @@ var FunctionDesign = function FunctionDesign(_ref) {
41
44
  }, []);
42
45
  useEffect(function () {
43
46
  var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
44
- var compId = _ref3.id;
47
+ var compId = _ref3.id,
48
+ newValue = _ref3.newValue;
45
49
  if (compId !== id) return;
46
- refreshChild();
50
+ if (newValue.hasOwnProperty('display')) {
51
+ refreshChild();
52
+ }
47
53
  }).watch();
48
54
  return function () {
49
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
+ };
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import React, { useRef, useImperativeHandle, forwardRef } from 'react';
4
+ import React, { useRef, useImperativeHandle, forwardRef, useEffect } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useMemoizedFn, useCreation, useUnmount } from 'ahooks';
7
7
  import { isNil, isString, keyBy } from 'lodash';
@@ -14,6 +14,7 @@ import TopFilter from "./components/TopFilter";
14
14
  import { omitBadProps, executeCode } from "../../../engine/tools/helper";
15
15
  import defaultMeta from "../../../engine/meta/table.props.default.json";
16
16
  import { LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT } from "../../../constants";
17
+ import { TopUpload, TopExport } from "./components/TopImex";
17
18
  var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
19
  var id = _ref.id,
19
20
  className = _ref.className,
@@ -61,6 +62,10 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
61
62
  var instanceRef = useRef();
62
63
  useImperativeHandle(apiRef, function () {
63
64
  return {
65
+ /**
66
+ * 获取表格实例
67
+ * @method
68
+ */
64
69
  getInstance: function getInstance() {
65
70
  return instanceRef.current;
66
71
  }
@@ -168,10 +173,13 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
168
173
  } : false;
169
174
  }, [rowSelection, suppressRowSelectionPagination, rowSelectionMode, defaultRowSelectedCode, rowSelectableCode]);
170
175
  var _export = useCreation(function () {
171
- return {
172
- enableExportAll: !!impexp.export,
173
- apiUrl: isString(impexp.export) ? impexp.export : void 0
176
+ var _temp = {
177
+ enableExportAll: !!impexp.export
174
178
  };
179
+ if (isString(impexp.export)) {
180
+ _temp.apiUrl = impexp.export;
181
+ }
182
+ return _temp;
175
183
  }, [impexp.export]);
176
184
  var _batchActions = useCreation(function () {
177
185
  return {
@@ -228,17 +236,42 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
228
236
  }, [fields, formatDataSource, getDataPath, columnsRewrite, columnsReset, modelParams, draggable]);
229
237
  var renderFunctionArea = useMemoizedFn(function () {
230
238
  var _topActionGroup$todoL;
231
- return !!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length) ? /*#__PURE__*/React.createElement(LDActions, _extends({}, topActionGroup, {
232
- doAction: function doAction(action) {
233
- return ctx.doAction(action, {
234
- datasetCode: dataset.code
235
- });
236
- }
237
- })) : null;
239
+ var resultComp = [];
240
+ if (!!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length)) {
241
+ resultComp.push( /*#__PURE__*/React.createElement(LDActions, _extends({}, topActionGroup, {
242
+ doAction: function doAction(action) {
243
+ return ctx.doAction(action, {
244
+ datasetCode: dataset.code
245
+ });
246
+ }
247
+ })));
248
+ }
249
+ if (impexp.import) {
250
+ var _ref2;
251
+ var _getProps = (_ref2 = instanceRef.current || ref.current) === null || _ref2 === void 0 ? void 0 : _ref2.getProps(),
252
+ apiUrl = _getProps.apiUrl;
253
+ resultComp.push( /*#__PURE__*/React.createElement(TopUpload, {
254
+ apiUrl: apiUrl,
255
+ options: impexp,
256
+ tableRef: instanceRef.current || ref.current
257
+ }));
258
+ }
259
+ if (impexp.export) {
260
+ var _ref3;
261
+ var _getProps2 = (_ref3 = instanceRef.current || ref.current) === null || _ref3 === void 0 ? void 0 : _ref3.getProps(),
262
+ _apiUrl = _getProps2.apiUrl;
263
+ resultComp.push( /*#__PURE__*/React.createElement(TopExport, {
264
+ apiUrl: _apiUrl,
265
+ options: impexp,
266
+ tableRef: instanceRef.current || ref.current
267
+ }));
268
+ }
269
+ return resultComp;
238
270
  });
239
271
  var renderFilterArea = useMemoizedFn(function () {
240
272
  return topFilter ? /*#__PURE__*/React.createElement(TopFilter, {
241
- filter: topFilter
273
+ filter: topFilter,
274
+ instance: instanceRef
242
275
  }) : null;
243
276
  });
244
277
  var _wrapperProps = useCreation(function () {
@@ -327,11 +360,21 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
327
360
  datasetCode: dataset.code
328
361
  });
329
362
  });
330
- useUnmount(function () {
331
- ctx.doAction(advance.events.onUnmount, {
332
- datasetCode: dataset.code
333
- });
334
- });
363
+ useEffect(function () {
364
+ var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref5) {
365
+ var resource = _ref5.resource;
366
+ ctx.doAction(advance.events.onPagePublicResourceChanged, {
367
+ resource: resource,
368
+ instance: instanceRef.current
369
+ });
370
+ }).watch();
371
+ return function () {
372
+ ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
373
+ ctx.doAction(advance.events.onUnmount, {
374
+ datasetCode: dataset === null || dataset === void 0 ? void 0 : dataset.code
375
+ });
376
+ };
377
+ }, []);
335
378
  var getTargetDom = useMemoizedFn(function () {
336
379
  return wrapperRef.current;
337
380
  });