@luck-design-biz/luckda 1.0.1 → 1.0.2

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 (227) hide show
  1. package/es/components/LDActions/index.less +3 -1
  2. package/es/components/LdAutoForm/index.js +2 -1
  3. package/es/components/LdCard/index.js +154 -67
  4. package/es/components/LdFormList/index.js +20 -6
  5. package/es/components/LdGridForm/index.js +40 -24
  6. package/es/components/LdTree/index.js +14 -8
  7. package/es/components/LdTree/index.less +4 -2
  8. package/es/helper/ldBuilder.js +1 -1
  9. package/es/locales/zh-CN.js +13 -4
  10. package/es/lowcode/constants/index.js +1 -1
  11. package/es/lowcode/engine/meta/cardlist.props.default.json +27 -6
  12. package/es/lowcode/engine/meta/cardlist.props.json +254 -72
  13. package/es/lowcode/engine/meta/components-list.json +6 -102
  14. package/es/lowcode/engine/meta/dialog.props.default.json +4 -2
  15. package/es/lowcode/engine/meta/dialog.props.json +74 -18
  16. package/es/lowcode/engine/meta/drawer.props.default.json +15 -4
  17. package/es/lowcode/engine/meta/drawer.props.json +144 -24
  18. package/es/lowcode/engine/meta/form.props.default.json +14 -3
  19. package/es/lowcode/engine/meta/form.props.json +49 -9
  20. package/es/lowcode/engine/meta/grouptree.props.default.json +16 -0
  21. package/es/lowcode/engine/meta/grouptree.props.json +83 -0
  22. package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
  23. package/es/lowcode/engine/meta/iframe.props.json +3 -4
  24. package/es/lowcode/engine/meta/image.props.default.json +3 -2
  25. package/es/lowcode/engine/meta/image.props.json +51 -16
  26. package/es/lowcode/engine/meta/imex.props.json +1 -1
  27. package/es/lowcode/engine/meta/js-editor/auto-complete.json +23 -5
  28. package/es/lowcode/engine/meta/link.props.default.json +1 -1
  29. package/es/lowcode/engine/meta/link.props.json +9 -9
  30. package/es/lowcode/engine/meta/table.props.json +1 -1
  31. package/es/lowcode/engine/meta/tabs.props.default.json +1 -1
  32. package/es/lowcode/engine/meta/tabs.props.json +1 -1
  33. package/es/lowcode/engine/meta/tree.props.json +2 -2
  34. package/es/lowcode/engine/provider/ContextProvider/index.js +6 -2
  35. package/es/lowcode/engine/provider/ContextProvider/usePageDataStore.js +82 -2
  36. package/es/lowcode/engine/tools/helper.js +21 -0
  37. package/es/lowcode/engine/tools/useCanvasRender.js +13 -1
  38. package/es/lowcode/painter/Components.js +6 -1
  39. package/es/lowcode/painter/Design.js +1 -0
  40. package/es/lowcode/painter/DesignOperator.js +25 -15
  41. package/es/lowcode/painter/DesignToolbar.js +78 -47
  42. package/es/lowcode/painter/Ribbon.js +14 -1
  43. package/es/lowcode/painter/components/ActionBindModal.js +3 -7
  44. package/es/lowcode/painter/components/DragDrop/DragDropContext.js +144 -37
  45. package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +29 -6
  46. package/es/lowcode/painter/components/DragDrop/Overlay.js +5 -2
  47. package/es/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +7 -4
  48. package/es/lowcode/painter/components/NumberInput.js +1 -1
  49. package/es/lowcode/painter/components/code-editor/BaseEditor.js +2 -1
  50. package/es/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
  51. package/es/lowcode/painter/components/field-setting/SettingUI.js +30 -2
  52. package/es/lowcode/painter/components/field-setting/index.js +26 -12
  53. package/es/lowcode/painter/expect.js +27 -0
  54. package/es/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +20 -2
  55. package/es/lowcode/painter/panel-section/ActionsEditor/index.js +18 -3
  56. package/es/lowcode/painter/panel-section/ComplexPop.js +1 -1
  57. package/es/lowcode/painter/panel-section/DataSetSelector.js +14 -3
  58. package/es/lowcode/painter/panel-section/FieldsSetting.js +2 -2
  59. package/es/lowcode/painter/panel-section/GroupClassSelector.js +55 -0
  60. package/es/lowcode/painter/panel-section/PageVars.js +1 -1
  61. package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +1 -0
  62. package/es/lowcode/painter/panel-section/TabItems.js +1 -1
  63. package/es/lowcode/painter/panel-section/TableTopFilter.js +3 -3
  64. package/es/lowcode/painter/style/action-bind-modal.less +5 -3
  65. package/es/lowcode/painter/style/design.less +26 -7
  66. package/es/lowcode/painter/style/dragdrop.less +46 -0
  67. package/es/lowcode/painter/style/list-editor.less +5 -3
  68. package/es/lowcode/painter/style/number-input.less +3 -1
  69. package/es/lowcode/painter/style/outline.less +3 -1
  70. package/es/lowcode/painter/style/panel-attrs.less +7 -3
  71. package/es/lowcode/painter/style/panel.less +9 -7
  72. package/es/lowcode/painter/style/radio.less +1 -1
  73. package/es/lowcode/painter/style/ribbon.less +4 -2
  74. package/es/lowcode/painter/svg/code.svg +3 -0
  75. package/es/lowcode/painter/svg/expect.svg +9 -0
  76. package/es/lowcode/view/lc-components/CardList/index.js +481 -12
  77. package/es/lowcode/view/lc-components/CardList/meta.json +255 -73
  78. package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +14 -6
  79. package/es/lowcode/view/lc-components/Dialog/index.js +15 -5
  80. package/es/lowcode/view/lc-components/Dialog/index.less +4 -0
  81. package/es/lowcode/view/lc-components/Dialog/meta.json +72 -18
  82. package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +51 -8
  83. package/es/lowcode/view/lc-components/Drawer/index.js +139 -24
  84. package/es/lowcode/view/lc-components/Drawer/index.less +11 -8
  85. package/es/lowcode/view/lc-components/Drawer/meta.json +136 -25
  86. package/es/lowcode/view/lc-components/Form/FunctionDesign.js +2 -1
  87. package/es/lowcode/view/lc-components/Form/index.js +45 -28
  88. package/es/lowcode/view/lc-components/Form/meta.json +44 -8
  89. package/es/lowcode/view/lc-components/GroupTree/FunctionDesign.js +10 -0
  90. package/es/lowcode/view/lc-components/GroupTree/FunctionLive.js +10 -0
  91. package/es/lowcode/view/lc-components/GroupTree/FunctionPreview.js +10 -0
  92. package/es/lowcode/view/lc-components/GroupTree/index.js +212 -0
  93. package/es/lowcode/view/lc-components/GroupTree/index.less +12 -0
  94. package/es/lowcode/view/lc-components/GroupTree/meta.json +83 -0
  95. package/es/lowcode/view/lc-components/Iframe/index.js +57 -7
  96. package/es/lowcode/view/lc-components/Iframe/meta.json +3 -4
  97. package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
  98. package/es/lowcode/view/lc-components/Image/index.js +82 -6
  99. package/es/lowcode/view/lc-components/Image/index.less +27 -0
  100. package/es/lowcode/view/lc-components/Image/meta.json +51 -16
  101. package/es/lowcode/view/lc-components/Link/index.js +53 -5
  102. package/es/lowcode/view/lc-components/Link/index.less +15 -0
  103. package/es/lowcode/view/lc-components/Link/meta.json +9 -9
  104. package/es/lowcode/view/lc-components/Table/index.js +5 -6
  105. package/es/lowcode/view/lc-components/Table/meta.json +1 -1
  106. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +40 -4
  107. package/es/lowcode/view/lc-components/Tabs/index.js +1 -1
  108. package/es/lowcode/view/lc-components/Tabs/meta.json +1 -1
  109. package/es/lowcode/view/lc-components/Tree/index.js +21 -19
  110. package/es/lowcode/view/lc-components/Tree/meta.json +2 -2
  111. package/es/utils/grid.js +3 -3
  112. package/lib/components/LDActions/index.less +3 -1
  113. package/lib/components/LdAutoForm/index.js +2 -1
  114. package/lib/components/LdCard/index.js +153 -66
  115. package/lib/components/LdFormList/index.js +19 -5
  116. package/lib/components/LdGridForm/index.js +40 -24
  117. package/lib/components/LdTree/index.js +14 -8
  118. package/lib/components/LdTree/index.less +4 -2
  119. package/lib/helper/ldBuilder.js +2 -2
  120. package/lib/locales/zh-CN.js +13 -4
  121. package/lib/lowcode/constants/index.js +1 -1
  122. package/lib/lowcode/engine/meta/cardlist.props.default.json +27 -6
  123. package/lib/lowcode/engine/meta/cardlist.props.json +254 -72
  124. package/lib/lowcode/engine/meta/components-list.json +6 -102
  125. package/lib/lowcode/engine/meta/dialog.props.default.json +4 -2
  126. package/lib/lowcode/engine/meta/dialog.props.json +74 -18
  127. package/lib/lowcode/engine/meta/drawer.props.default.json +15 -4
  128. package/lib/lowcode/engine/meta/drawer.props.json +144 -24
  129. package/lib/lowcode/engine/meta/form.props.default.json +14 -3
  130. package/lib/lowcode/engine/meta/form.props.json +49 -9
  131. package/lib/lowcode/engine/meta/grouptree.props.default.json +16 -0
  132. package/lib/lowcode/engine/meta/grouptree.props.json +83 -0
  133. package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
  134. package/lib/lowcode/engine/meta/iframe.props.json +3 -4
  135. package/lib/lowcode/engine/meta/image.props.default.json +3 -2
  136. package/lib/lowcode/engine/meta/image.props.json +51 -16
  137. package/lib/lowcode/engine/meta/imex.props.json +1 -1
  138. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +23 -5
  139. package/lib/lowcode/engine/meta/link.props.default.json +1 -1
  140. package/lib/lowcode/engine/meta/link.props.json +9 -9
  141. package/lib/lowcode/engine/meta/table.props.json +1 -1
  142. package/lib/lowcode/engine/meta/tabs.props.default.json +1 -1
  143. package/lib/lowcode/engine/meta/tabs.props.json +1 -1
  144. package/lib/lowcode/engine/meta/tree.props.json +2 -2
  145. package/lib/lowcode/engine/provider/ContextProvider/index.js +6 -2
  146. package/lib/lowcode/engine/provider/ContextProvider/usePageDataStore.js +83 -3
  147. package/lib/lowcode/engine/tools/helper.js +22 -0
  148. package/lib/lowcode/engine/tools/useCanvasRender.js +13 -1
  149. package/lib/lowcode/painter/Components.js +6 -1
  150. package/lib/lowcode/painter/Design.js +1 -0
  151. package/lib/lowcode/painter/DesignOperator.js +25 -15
  152. package/lib/lowcode/painter/DesignToolbar.js +78 -47
  153. package/lib/lowcode/painter/Ribbon.js +14 -1
  154. package/lib/lowcode/painter/components/ActionBindModal.js +3 -7
  155. package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +142 -35
  156. package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +27 -4
  157. package/lib/lowcode/painter/components/DragDrop/Overlay.js +5 -2
  158. package/lib/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +7 -4
  159. package/lib/lowcode/painter/components/NumberInput.js +1 -1
  160. package/lib/lowcode/painter/components/code-editor/BaseEditor.js +2 -1
  161. package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
  162. package/lib/lowcode/painter/components/field-setting/SettingUI.js +29 -1
  163. package/lib/lowcode/painter/components/field-setting/index.js +26 -12
  164. package/lib/lowcode/painter/expect.js +34 -0
  165. package/lib/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +19 -1
  166. package/lib/lowcode/painter/panel-section/ActionsEditor/index.js +18 -3
  167. package/lib/lowcode/painter/panel-section/ComplexPop.js +1 -1
  168. package/lib/lowcode/painter/panel-section/DataSetSelector.js +14 -3
  169. package/lib/lowcode/painter/panel-section/FieldsSetting.js +2 -2
  170. package/lib/lowcode/painter/panel-section/GroupClassSelector.js +63 -0
  171. package/lib/lowcode/painter/panel-section/PageVars.js +1 -1
  172. package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +1 -0
  173. package/lib/lowcode/painter/panel-section/TabItems.js +1 -1
  174. package/lib/lowcode/painter/panel-section/TableTopFilter.js +3 -3
  175. package/lib/lowcode/painter/style/action-bind-modal.less +5 -3
  176. package/lib/lowcode/painter/style/design.less +26 -7
  177. package/lib/lowcode/painter/style/dragdrop.less +46 -0
  178. package/lib/lowcode/painter/style/list-editor.less +5 -3
  179. package/lib/lowcode/painter/style/number-input.less +3 -1
  180. package/lib/lowcode/painter/style/outline.less +3 -1
  181. package/lib/lowcode/painter/style/panel-attrs.less +7 -3
  182. package/lib/lowcode/painter/style/panel.less +9 -7
  183. package/lib/lowcode/painter/style/radio.less +1 -1
  184. package/lib/lowcode/painter/style/ribbon.less +4 -2
  185. package/lib/lowcode/painter/svg/code.svg +3 -0
  186. package/lib/lowcode/painter/svg/expect.svg +9 -0
  187. package/lib/lowcode/view/lc-components/CardList/index.js +480 -11
  188. package/lib/lowcode/view/lc-components/CardList/meta.json +255 -73
  189. package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +13 -5
  190. package/lib/lowcode/view/lc-components/Dialog/index.js +15 -5
  191. package/lib/lowcode/view/lc-components/Dialog/index.less +4 -0
  192. package/lib/lowcode/view/lc-components/Dialog/meta.json +72 -18
  193. package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +52 -8
  194. package/lib/lowcode/view/lc-components/Drawer/index.js +138 -23
  195. package/lib/lowcode/view/lc-components/Drawer/index.less +11 -8
  196. package/lib/lowcode/view/lc-components/Drawer/meta.json +136 -25
  197. package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +2 -1
  198. package/lib/lowcode/view/lc-components/Form/index.js +44 -27
  199. package/lib/lowcode/view/lc-components/Form/meta.json +44 -8
  200. package/lib/lowcode/view/lc-components/GroupTree/FunctionDesign.js +17 -0
  201. package/lib/lowcode/view/lc-components/GroupTree/FunctionLive.js +17 -0
  202. package/lib/lowcode/view/lc-components/GroupTree/FunctionPreview.js +17 -0
  203. package/lib/lowcode/view/lc-components/GroupTree/index.js +220 -0
  204. package/lib/lowcode/view/lc-components/GroupTree/index.less +12 -0
  205. package/lib/lowcode/view/lc-components/GroupTree/meta.json +83 -0
  206. package/lib/lowcode/view/lc-components/Iframe/index.js +55 -5
  207. package/lib/lowcode/view/lc-components/Iframe/meta.json +3 -4
  208. package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
  209. package/lib/lowcode/view/lc-components/Image/index.js +80 -4
  210. package/lib/lowcode/view/lc-components/Image/index.less +27 -0
  211. package/lib/lowcode/view/lc-components/Image/meta.json +51 -16
  212. package/lib/lowcode/view/lc-components/Link/index.js +52 -4
  213. package/lib/lowcode/view/lc-components/Link/index.less +15 -0
  214. package/lib/lowcode/view/lc-components/Link/meta.json +9 -9
  215. package/lib/lowcode/view/lc-components/Table/index.js +5 -6
  216. package/lib/lowcode/view/lc-components/Table/meta.json +1 -1
  217. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +38 -2
  218. package/lib/lowcode/view/lc-components/Tabs/index.js +1 -1
  219. package/lib/lowcode/view/lc-components/Tabs/meta.json +1 -1
  220. package/lib/lowcode/view/lc-components/Tree/index.js +20 -18
  221. package/lib/lowcode/view/lc-components/Tree/meta.json +2 -2
  222. package/lib/utils/grid.js +2 -2
  223. package/package.json +10 -9
  224. package/es/lowcode/painter/style/treedragdrop.less +0 -19
  225. package/es/lowcode/view/lc-components/Form/index.less +0 -5
  226. package/lib/lowcode/painter/style/treedragdrop.less +0 -19
  227. package/lib/lowcode/view/lc-components/Form/index.less +0 -5
@@ -66,7 +66,8 @@
66
66
  ["id", "page_root"],
67
67
  ["meta.group", "container"],
68
68
  ["meta.group", "build-in"]
69
- ]
69
+ ],
70
+ "default": "page_content"
70
71
  },
71
72
  {
72
73
  "key": "renderFormLeft",
@@ -203,8 +204,18 @@
203
204
  "type": "_BlockEditor",
204
205
  "wrapper": "hidden",
205
206
  "default": {
206
- "form": { "readOnly": false, "col": 4 },
207
- "table": {
207
+ "auto": { "readOnly": false, "cols": 4 },
208
+ "grid": {
209
+ "readOnly": false,
210
+ "suppressPreset": false,
211
+ "height": "100%",
212
+ "bordered": false,
213
+ "draggable": false,
214
+ "orderByAdd": "asc",
215
+ "suppressActions": false,
216
+ "actionsColumnWidth": 160
217
+ },
218
+ "writer": {
208
219
  "readOnly": false,
209
220
  "suppressPreset": false,
210
221
  "height": "100%",
@@ -261,6 +272,11 @@
261
272
  }
262
273
  ],
263
274
  "_grid_props": [
275
+ {
276
+ "key": "height",
277
+ "name": "高度",
278
+ "type": "_WidthHeight"
279
+ },
264
280
  {
265
281
  "key": "readOnly",
266
282
  "name": "只读",
@@ -271,11 +287,6 @@
271
287
  "name": "关闭预设",
272
288
  "type": "switch"
273
289
  },
274
- {
275
- "key": "height",
276
- "name": "高度",
277
- "type": "_WidthHeight"
278
- },
279
290
  {
280
291
  "key": "bordered",
281
292
  "name": "边框线",
@@ -286,6 +297,11 @@
286
297
  "name": "拖拽排序",
287
298
  "type": "switch"
288
299
  },
300
+ {
301
+ "key": "suppressbatch",
302
+ "name": "关闭批量",
303
+ "type": "switch"
304
+ },
289
305
  {
290
306
  "key": "orderByAdd",
291
307
  "name": "排序方式",
@@ -301,6 +317,26 @@
301
317
  }
302
318
  ]
303
319
  },
320
+ {
321
+ "key": "operates",
322
+ "name": "基础操作",
323
+ "type": "checkbox",
324
+ "options": [
325
+ {
326
+ "label": "添加",
327
+ "value": "add"
328
+ },
329
+ {
330
+ "label": "删除",
331
+ "value": "delete"
332
+ },
333
+ {
334
+ "label": "修改",
335
+ "value": "update"
336
+ }
337
+ ],
338
+ "defaultValue": ["add", "delete", "update"]
339
+ },
304
340
  {
305
341
  "key": "actionsColumn",
306
342
  "name": "操作列",
@@ -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 FunctionDesign = function FunctionDesign(_ref) {
6
+ var children = _ref.children,
7
+ props = _objectWithoutProperties(_ref, _excluded);
8
+ return /*#__PURE__*/React.createElement(Index, props, children);
9
+ };
10
+ 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,212 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ import React, { useRef, useState, useEffect } from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { useMemoizedFn, useAsyncEffect, useBoolean, useLatest } from 'ahooks';
8
+ import styled from 'styled-components';
9
+ import { Tree, Empty, Spin } from 'luck-design/antd';
10
+ import { isNil } from 'lodash';
11
+ import classNames from 'classnames';
12
+ import { useContext } from "../../../engine/provider/ContextProvider";
13
+ import Wrapper from "../Wrapper";
14
+ import { noAuthReadAllBySkey } from '@luck-design-biz/base/lib/sys/services';
15
+ import { dataToTree } from '@luck-design-biz/base/utils';
16
+ import { omitBadProps, executeCode, findFirstLeafNode } from "../../../engine/tools/helper";
17
+ import defaultMeta from "../../../engine/meta/tree.props.default.json";
18
+ import styles from "./index.less";
19
+ var TreeBox = styled.div.withConfig({
20
+ displayName: "TreeBox",
21
+ componentId: "luckda-6530__sc-83o9ul-0"
22
+ })(["", ""], function (props) {
23
+ return props.$css;
24
+ });
25
+ var Title = styled.div.withConfig({
26
+ displayName: "Title",
27
+ componentId: "luckda-6530__sc-83o9ul-1"
28
+ })(["display:flex;align-items:center;justify-content:space-between;padding:0 8px;", ""], function (props) {
29
+ return props.$theme === 'base' ? "\n height: 36px;\n color: #1a1a1a;\n font-weight: 500;\n font-size: 16px;\n border-bottom: 1px solid #f1f2f5;\n " : "\n height: 42px;\n color: var(--ant-primary-color);\n font-size: 14px;\n border-bottom: 2px solid var(--ant-primary-color);\n ";
30
+ });
31
+ var GroupTree = styled(Tree).withConfig({
32
+ displayName: "GroupTree",
33
+ componentId: "luckda-6530__sc-83o9ul-2"
34
+ })([""]);
35
+ var TreeNode = Tree.TreeNode;
36
+ var LCGroupTree = function LCGroupTree(_ref) {
37
+ var id = _ref.id,
38
+ title = _ref.title,
39
+ groupClass = _ref.groupClass,
40
+ defaultExpandAll = _ref.defaultExpandAll,
41
+ onlySelectLeaf = _ref.onlySelectLeaf,
42
+ cancelSelect = _ref.cancelSelect,
43
+ defaultSelect = _ref.defaultSelect,
44
+ css = _ref.css,
45
+ advance = _ref.advance;
46
+ var ctx = useContext();
47
+ var ref = useRef();
48
+ var _useState = useState(null),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ dataSource = _useState2[0],
51
+ setDataSource = _useState2[1];
52
+ var _useState3 = useState([]),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ selectedKeys = _useState4[0],
55
+ setSelectedKeys = _useState4[1];
56
+ var _useBoolean = useBoolean(false),
57
+ _useBoolean2 = _slicedToArray(_useBoolean, 2),
58
+ loading = _useBoolean2[0],
59
+ _useBoolean2$ = _useBoolean2[1],
60
+ setTrue = _useBoolean2$.setTrue,
61
+ setFalse = _useBoolean2$.setFalse;
62
+ var latestOnlySelectLeaf = useLatest(onlySelectLeaf);
63
+ useEffect(function () {
64
+ ctx.doAction(advance.events.onMount);
65
+ return function () {
66
+ return ctx.doAction(advance.events.onUnmount);
67
+ };
68
+ }, []);
69
+ var handleSelect = useMemoizedFn(function (_selectedKeys, e) {
70
+ if (cancelSelect || e.selected) {
71
+ setSelectedKeys(_selectedKeys);
72
+ ctx.doAction(advance.events.onSelect, {
73
+ selectedKeys: _selectedKeys,
74
+ e: e
75
+ });
76
+ }
77
+ });
78
+ useAsyncEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
79
+ var _yield$noAuthReadAllB, code, list, detail, treeData, firstNode, _selectKey;
80
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
81
+ while (1) switch (_context.prev = _context.next) {
82
+ case 0:
83
+ if (!isNil(groupClass)) {
84
+ _context.next = 2;
85
+ break;
86
+ }
87
+ return _context.abrupt("return");
88
+ case 2:
89
+ setTrue();
90
+ _context.next = 5;
91
+ return noAuthReadAllBySkey({
92
+ sclassKey: groupClass
93
+ });
94
+ case 5:
95
+ _yield$noAuthReadAllB = _context.sent;
96
+ code = _yield$noAuthReadAllB.code;
97
+ list = _yield$noAuthReadAllB.list;
98
+ detail = _yield$noAuthReadAllB.detail;
99
+ if (code === 1 && list.length > 0) {
100
+ treeData = dataToTree(list.map(function (_id) {
101
+ return detail[_id];
102
+ }));
103
+ firstNode = latestOnlySelectLeaf.current ? findFirstLeafNode(treeData[0]) : treeData[0];
104
+ if (!isNil(defaultSelect)) {
105
+ _selectKey = executeCode(ctx, defaultSelect, ['treeData', 'firstNode'], treeData, firstNode);
106
+ if (_selectKey) {
107
+ handleSelect([_selectKey], {
108
+ selected: true,
109
+ selectedNodes: [detail[_selectKey]]
110
+ });
111
+ }
112
+ }
113
+ setDataSource(treeData);
114
+ } else {
115
+ setDataSource(null);
116
+ }
117
+ setFalse();
118
+ case 11:
119
+ case "end":
120
+ return _context.stop();
121
+ }
122
+ }, _callee);
123
+ })), [groupClass]);
124
+ var renderTreeNode = useMemoizedFn(function (items) {
125
+ return items.map(function (item) {
126
+ var _item$children;
127
+ if (((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0) {
128
+ return /*#__PURE__*/React.createElement(TreeNode, {
129
+ title: item.sname,
130
+ key: item.id,
131
+ dataRef: item,
132
+ selectable: !onlySelectLeaf,
133
+ disabled: onlySelectLeaf
134
+ }, renderTreeNode(item.children));
135
+ }
136
+ return /*#__PURE__*/React.createElement(TreeNode, {
137
+ title: item.sname,
138
+ key: item.id,
139
+ dataRef: item,
140
+ selectable: true,
141
+ isLeaf: true
142
+ });
143
+ });
144
+ });
145
+ var getTargetDom = useMemoizedFn(function () {
146
+ return ref.current;
147
+ });
148
+ return /*#__PURE__*/React.createElement(Wrapper, {
149
+ id: id,
150
+ displayName: "GroupTree",
151
+ getTargetDom: getTargetDom
152
+ }, /*#__PURE__*/React.createElement(TreeBox, {
153
+ ref: ref,
154
+ $css: css,
155
+ className: styles['lc-component-grouptree']
156
+ }, title ? /*#__PURE__*/React.createElement(Title, {
157
+ $theme: document.body.getAttribute('luck-theme')
158
+ }, title) : null, /*#__PURE__*/React.createElement(Spin, {
159
+ spinning: loading,
160
+ wrapperClassName: classNames(styles['lc-component-grouptree-spin'], _defineProperty({}, styles.hasTitle, !!title))
161
+ }, dataSource ? /*#__PURE__*/React.createElement(GroupTree, {
162
+ blockNode: true,
163
+ defaultExpandAll: defaultExpandAll,
164
+ selectedKeys: selectedKeys,
165
+ onSelect: handleSelect
166
+ }, renderTreeNode(dataSource)) : /*#__PURE__*/React.createElement(Empty, {
167
+ style: {
168
+ margin: '8px 0'
169
+ }
170
+ }))));
171
+ };
172
+ LCGroupTree.propTypes = {
173
+ /**
174
+ * @name 唯一标识
175
+ * @type string
176
+ * @disabled true
177
+ */
178
+ id: PropTypes.string.isRequired,
179
+ /**
180
+ * @name 标题
181
+ * @type string
182
+ * @disabled true
183
+ */
184
+ title: PropTypes.string,
185
+ /**
186
+ * @name 组维度
187
+ * @type _GroupClassSelector
188
+ */
189
+ groupClass: PropTypes.string,
190
+ /**
191
+ * @name 默认展开全部
192
+ * @type switch
193
+ */
194
+ defaultExpandAll: PropTypes.bool,
195
+ /**
196
+ * @name 仅叶子可选
197
+ * @type switch
198
+ */
199
+ onlySelectLeaf: PropTypes.bool,
200
+ /**
201
+ * @name 允许取消选中
202
+ * @type switch
203
+ */
204
+ cancelSelect: PropTypes.bool,
205
+ /**
206
+ * @name 允许取消选中
207
+ * @type _JSEditor
208
+ */
209
+ defaultSelect: PropTypes.string
210
+ };
211
+ LCGroupTree.defaultProps = omitBadProps(defaultMeta);
212
+ export default LCGroupTree;
@@ -0,0 +1,12 @@
1
+ .lc-component-grouptree {
2
+ overflow-y: auto;
3
+ &-spin.hasTitle {
4
+ height: calc(100% - 42px);
5
+ overflow-y: auto;
6
+ }
7
+
8
+ body[luck-theme='base'] &-spin.hasTitle {
9
+ height: calc(100% - 36px);
10
+ overflow-y: auto;
11
+ }
12
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "component": "GroupTree",
3
+ "name": "组织树",
4
+ "desc": "用于展示组织维度层级结构的数据。它提供了层级结构、节点展开/折叠、节点选择、节点操作和展示样式等功能。",
5
+ "icon": "icon-tree",
6
+ "group": "advance",
7
+ "groupName": "高级",
8
+ "order": 1,
9
+ "props": [
10
+ {
11
+ "key": "id",
12
+ "name": "唯一标识",
13
+ "type": "string",
14
+ "disabled": true
15
+ },
16
+ {
17
+ "key": "title",
18
+ "name": "标题",
19
+ "desc": "头部标题",
20
+ "type": "_I18nInput"
21
+ },
22
+ {
23
+ "key": "groupClass",
24
+ "name": "组维度",
25
+ "type": "_GroupClassSelector"
26
+ },
27
+ {
28
+ "key": "defaultExpandAll",
29
+ "name": "默认展开全部",
30
+ "type": "switch",
31
+ "default": true
32
+ },
33
+ {
34
+ "key": "onlySelectLeaf",
35
+ "name": "仅叶子可选",
36
+ "desc": "仅叶子节点可被选中,父节点不可选中",
37
+ "type": "switch",
38
+ "default": true
39
+ },
40
+ {
41
+ "key": "cancelSelect",
42
+ "name": "允许取消选中",
43
+ "desc": "是否可以取消选中",
44
+ "type": "switch",
45
+ "default": false
46
+ },
47
+ {
48
+ "key": "defaultSelect",
49
+ "name": "默认选中",
50
+ "desc": "返回默认选中的数据主键",
51
+ "type": "_JSEditor",
52
+ "defaultCode": "function defaultSelect(treeData, firstNode) { \n return firstNode.id; \n}",
53
+ "mustConfirm": true,
54
+ "wrapper": "collapse",
55
+ "wrapperProps": {
56
+ "suppressIcon": true
57
+ }
58
+ }
59
+ ],
60
+ "css": "width: 100%; height: 100%;",
61
+ "advance": {
62
+ "events": [
63
+ {
64
+ "key": "onMount",
65
+ "name": "组件首次渲染时",
66
+ "desc": "在组件首次渲染时,执行方法",
67
+ "func": "function onMount() {\n\t\n}"
68
+ },
69
+ {
70
+ "key": "onUnmount",
71
+ "name": "组件卸载时",
72
+ "desc": "在组件卸载时,执行方法。",
73
+ "func": "function onUnmount() {\n\t\n}"
74
+ },
75
+ {
76
+ "key": "onSelect",
77
+ "name": "选中事件",
78
+ "desc": "节点选中事件",
79
+ "func": "function onSelect(selectedKeys, e) {\n\t\n}"
80
+ }
81
+ ]
82
+ }
83
+ }
@@ -1,12 +1,35 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- var _excluded = ["id"];
3
- import React, { useRef } from 'react';
4
- import { useMemoizedFn } from 'ahooks';
4
+ var _excluded = ["id", "path", "css", "supportFullScreen"];
5
+ import React, { useEffect, useRef } from 'react';
6
+ import { useFullscreen, useHover, useMemoizedFn } from 'ahooks';
7
+ import { Icon, Tooltip } from 'luck-design/antd';
8
+ import styled from 'styled-components';
5
9
  import Wrapper from "../Wrapper";
6
- var LCIfram = function LCIfram(_ref) {
10
+ import { useContext } from "../../../engine/provider/ContextProvider";
11
+ import { formatMessage } from '@luck-design-biz/base/utils';
12
+ var StyledIframe = styled.iframe.withConfig({
13
+ displayName: "StyledIframe",
14
+ componentId: "luckda-6530__sc-82q9mj-0"
15
+ })(["border:none;", ""], function (props) {
16
+ return props.$css;
17
+ });
18
+ var LCIframe = function LCIframe(_ref) {
7
19
  var id = _ref.id,
20
+ path = _ref.path,
21
+ css = _ref.css,
22
+ supportFullScreen = _ref.supportFullScreen,
8
23
  props = _objectWithoutProperties(_ref, _excluded);
9
24
  var ref = useRef();
25
+ var parentRef = useRef();
26
+ var isHovering = useHover(parentRef);
27
+ var _useFullscreen = useFullscreen(ref, {
28
+ pageFullscreen: true
29
+ }),
30
+ _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
31
+ isFullscreen = _useFullscreen2[0],
32
+ toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
10
33
  var getTargetDom = useMemoizedFn(function () {
11
34
  return ref.current;
12
35
  });
@@ -15,7 +38,34 @@ var LCIfram = function LCIfram(_ref) {
15
38
  displayName: "Iframe",
16
39
  getTargetDom: getTargetDom
17
40
  }, /*#__PURE__*/React.createElement("div", {
18
- ref: ref
19
- }, "LCIfram"));
41
+ style: {
42
+ position: !isFullscreen ? 'relative' : 'static',
43
+ width: '100%',
44
+ height: '100%'
45
+ },
46
+ ref: parentRef
47
+ }, supportFullScreen && isHovering && /*#__PURE__*/React.createElement(Tooltip, {
48
+ title: isFullscreen ? formatMessage({
49
+ id: 'luckda.lowcode.painter.components.fullscreen-exit.tip',
50
+ label: '退出全屏'
51
+ }) : formatMessage({
52
+ id: 'luckda.lowcode.painter.components.fullscreen.tip',
53
+ label: '全屏'
54
+ })
55
+ }, /*#__PURE__*/React.createElement(Icon, {
56
+ type: isFullscreen ? 'fullscreen-exit' : 'fullscreen',
57
+ style: {
58
+ fontSize: 20,
59
+ position: isFullscreen ? 'fixed' : 'absolute',
60
+ top: 15,
61
+ right: 20,
62
+ zIndex: 9999999
63
+ },
64
+ onClick: toggleFullscreen
65
+ })), /*#__PURE__*/React.createElement(StyledIframe, _extends({}, props, {
66
+ ref: ref,
67
+ src: path,
68
+ $css: css
69
+ }))));
20
70
  };
21
- export default LCIfram;
71
+ export default LCIframe;
@@ -9,7 +9,7 @@
9
9
  "props": [
10
10
  {
11
11
  "key": "id",
12
- "desc": "唯一标识",
12
+ "name": "唯一标识",
13
13
  "type": "string",
14
14
  "disabled": true
15
15
  },
@@ -23,10 +23,9 @@
23
23
  "key": "supportFullScreen",
24
24
  "name": "支持全屏",
25
25
  "desc": "是否支持全屏展示",
26
- "type": "boolean",
26
+ "type": "switch",
27
27
  "default": true
28
28
  }
29
29
  ],
30
- "css": "",
31
- "advance": {}
30
+ "css": "background: white; width: 100%; height: 100%"
32
31
  }
@@ -9,7 +9,7 @@
9
9
  "props": [
10
10
  {
11
11
  "key": "id",
12
- "desc": "唯一标识",
12
+ "name": "唯一标识",
13
13
  "type": "string",
14
14
  "disabled": true
15
15
  },
@@ -1,12 +1,63 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- var _excluded = ["id"];
3
- import React, { useRef } from 'react';
4
- import { useMemoizedFn } from 'ahooks';
4
+ var _excluded = ["id", "src", "css", "advance", "onClick"];
5
+ import React, { useEffect, useRef } from 'react';
6
+ import { useHover, useMemoizedFn, useSetState } from 'ahooks';
7
+ import styled from 'styled-components';
8
+ import { ImgPreview } from 'luck-design';
5
9
  import Wrapper from "../Wrapper";
10
+ import styles from "./index.less";
11
+ import { Icon } from 'luck-design/antd';
12
+ import { useContext } from "../../../engine/provider/ContextProvider";
13
+ var StyledImage = styled.img.withConfig({
14
+ displayName: "StyledImage",
15
+ componentId: "luckda-6530__sc-k6wbym-0"
16
+ })(["width:", ";height:", ";object-fit:", ";cursor:", ";border-radius:", ";", ""], function (props) {
17
+ return props.autoWidth ? 'auto' : "".concat(props.width, "px");
18
+ }, function (props) {
19
+ return props.autoHeight ? 'auto' : "".concat(props.height, "px");
20
+ }, function (props) {
21
+ return props.fit;
22
+ }, function (props) {
23
+ return props.preview && 'pointer';
24
+ }, function (props) {
25
+ return props.roundRadios || "".concat(props.borderRadios, "px");
26
+ }, function (props) {
27
+ return props.$css;
28
+ });
6
29
  var LCImage = function LCImage(_ref) {
7
30
  var id = _ref.id,
31
+ src = _ref.src,
32
+ css = _ref.css,
33
+ advance = _ref.advance,
34
+ onClick = _ref.onClick,
8
35
  props = _objectWithoutProperties(_ref, _excluded);
9
36
  var ref = useRef();
37
+ var isHovering = useHover(ref);
38
+ var _useSetState = useSetState({
39
+ visible: false,
40
+ images: []
41
+ }),
42
+ _useSetState2 = _slicedToArray(_useSetState, 2),
43
+ state = _useSetState2[0],
44
+ setState = _useSetState2[1];
45
+ var ctx = useContext();
46
+ useEffect(function () {
47
+ ctx.doAction(advance.events.onMount);
48
+ return function () {
49
+ return ctx.doAction(advance.events.onUnmount);
50
+ };
51
+ }, []);
52
+ var handleClick = useMemoizedFn(function (e) {
53
+ if (onClick) {
54
+ onClick(e);
55
+ return;
56
+ }
57
+ ctx.doAction(advance.events.onClick, {
58
+ e: e
59
+ });
60
+ });
10
61
  var getTargetDom = useMemoizedFn(function () {
11
62
  return ref.current;
12
63
  });
@@ -14,8 +65,33 @@ var LCImage = function LCImage(_ref) {
14
65
  id: id,
15
66
  displayName: "Image",
16
67
  getTargetDom: getTargetDom
17
- }, /*#__PURE__*/React.createElement("div", {
18
- ref: ref
19
- }, "LCImage"));
68
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
69
+ className: props.preview && styles['lc-component-image'],
70
+ ref: ref,
71
+ onClick: props.preview ? function () {
72
+ return setState({
73
+ visible: true,
74
+ images: [{
75
+ src: src
76
+ }]
77
+ });
78
+ } : {}
79
+ }, /*#__PURE__*/React.createElement(StyledImage, _extends({
80
+ src: src,
81
+ $css: css
82
+ }, props)), props.preview && isHovering && /*#__PURE__*/React.createElement(Icon, {
83
+ type: "search",
84
+ className: styles.search
85
+ })), /*#__PURE__*/React.createElement(ImgPreview, {
86
+ visible: state.visible,
87
+ images: state.images,
88
+ activeIndex: 0,
89
+ onClose: function onClose() {
90
+ return setState({
91
+ visible: false
92
+ });
93
+ },
94
+ onClick: handleClick
95
+ })));
20
96
  };
21
97
  export default LCImage;
@@ -0,0 +1,27 @@
1
+ .lc-component-image {
2
+ position: relative;
3
+ width: fit-content;
4
+ cursor: pointer;
5
+
6
+ .search {
7
+ position: absolute;
8
+ left: 50%;
9
+ top: 50%;
10
+ transform: translate(-50%, -50%);
11
+ color: white;
12
+ }
13
+
14
+ &:hover {
15
+ &::before {
16
+ content: '';
17
+ position: absolute;
18
+ left: 50%;
19
+ top: 50%;
20
+ margin: -16px 0 0 -16px;
21
+ width: 32px;
22
+ height: 32px;
23
+ background-color: rgba(51, 51, 51, 0.6);
24
+ border-radius: 16px 16px;
25
+ }
26
+ }
27
+ }