@luck-design-biz/luckda 0.0.24-2 → 0.0.25-1

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 (466) hide show
  1. package/es/components/Builder/index.js +6 -4
  2. package/es/components/IconFont/index.js +5 -0
  3. package/es/components/LDActions/index.js +133 -0
  4. package/es/components/LDActions/index.less +65 -0
  5. package/es/components/LdAutoForm/index.js +1 -1
  6. package/es/components/LdCom/index.js +2 -1
  7. package/es/components/LdFormList/index.js +15 -10
  8. package/es/components/LdGrid/index.js +14 -8
  9. package/es/components/LdGridForm/index.js +5 -4
  10. package/es/components/LdRuntimeCom/index.js +20 -7
  11. package/es/components/LdTree/index.js +112 -31
  12. package/es/components/LdTree/index.less +6 -1
  13. package/es/helper/ldBuilder.js +28 -12
  14. package/es/helper/ldComBuild.js +29 -14
  15. package/es/index.js +1 -0
  16. package/es/locales/zh-CN.js +221 -0
  17. package/es/lowcode/constants/api-url.js +380 -262
  18. package/es/lowcode/constants/event-topics.js +4 -0
  19. package/es/lowcode/constants/index.js +30 -2
  20. package/es/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +32 -0
  21. package/es/lowcode/engine/factory/panel-item-factory/index.js +2 -0
  22. package/es/lowcode/engine/meta/box.props.default.json +3 -2
  23. package/es/lowcode/engine/meta/box.props.json +1 -3
  24. package/es/lowcode/engine/meta/button.props.default.json +5 -2
  25. package/es/lowcode/engine/meta/button.props.json +8 -8
  26. package/es/lowcode/engine/meta/cardlist.props.default.json +4 -2
  27. package/es/lowcode/engine/meta/cardlist.props.json +1 -2
  28. package/es/lowcode/engine/meta/dialog.props.default.json +4 -2
  29. package/es/lowcode/engine/meta/dialog.props.json +0 -1
  30. package/es/lowcode/engine/meta/drawer.props.default.json +4 -2
  31. package/es/lowcode/engine/meta/drawer.props.json +0 -1
  32. package/es/lowcode/engine/meta/form.props.default.json +53 -4
  33. package/es/lowcode/engine/meta/form.props.json +584 -55
  34. package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
  35. package/es/lowcode/engine/meta/iframe.props.json +1 -1
  36. package/es/lowcode/engine/meta/image.props.default.json +5 -2
  37. package/es/lowcode/engine/meta/image.props.json +1 -1
  38. package/es/lowcode/engine/meta/imex.props.default.json +5 -2
  39. package/es/lowcode/engine/meta/imex.props.json +1 -1
  40. package/es/lowcode/engine/meta/js-editor/auto-complete.json +152 -26
  41. package/es/lowcode/engine/meta/jsx.props.default.json +2 -1
  42. package/es/lowcode/engine/meta/jsx.props.json +10 -5
  43. package/es/lowcode/engine/meta/layout.props.default.json +5 -2
  44. package/es/lowcode/engine/meta/layout.props.json +1 -2
  45. package/es/lowcode/engine/meta/link.props.default.json +5 -2
  46. package/es/lowcode/engine/meta/link.props.json +2 -2
  47. package/es/lowcode/engine/meta/local/local.zh-cn.js +97 -0
  48. package/es/lowcode/engine/meta/page.props.default.json +12 -0
  49. package/es/lowcode/engine/meta/page.props.json +49 -0
  50. package/es/lowcode/engine/meta/pagecontent.props.default.json +6 -0
  51. package/es/lowcode/engine/meta/pagecontent.props.json +7 -0
  52. package/es/lowcode/engine/meta/pagefooter.props.default.json +6 -0
  53. package/es/lowcode/engine/meta/pagefooter.props.json +7 -0
  54. package/es/lowcode/engine/meta/pageheader.props.default.json +6 -0
  55. package/es/lowcode/engine/meta/pageheader.props.json +7 -0
  56. package/es/lowcode/engine/meta/section.props.default.json +5 -2
  57. package/es/lowcode/engine/meta/section.props.json +1 -1
  58. package/es/lowcode/engine/meta/split.props.default.json +9 -4
  59. package/es/lowcode/engine/meta/split.props.json +14 -29
  60. package/es/lowcode/engine/meta/table.props.default.json +23 -3
  61. package/es/lowcode/engine/meta/table.props.json +257 -55
  62. package/es/lowcode/engine/meta/tabs.props.default.json +16 -9
  63. package/es/lowcode/engine/meta/tabs.props.json +57 -81
  64. package/es/lowcode/engine/meta/text.props.default.json +5 -2
  65. package/es/lowcode/engine/meta/text.props.json +1 -1
  66. package/es/lowcode/engine/meta/tree.props.default.json +20 -7
  67. package/es/lowcode/engine/meta/tree.props.json +225 -79
  68. package/es/lowcode/engine/provider/ContextProvider/index.js +169 -0
  69. package/es/lowcode/engine/provider/RemoteSourceProvider.js +161 -0
  70. package/es/lowcode/engine/tools/dataProcess.js +64 -2
  71. package/es/lowcode/engine/tools/helper.js +96 -19
  72. package/es/lowcode/engine/tools/useCanvasRender.js +75 -0
  73. package/es/lowcode/engine/tools/usePromiseState.js +8 -6
  74. package/es/lowcode/engine/tools/useTodo.js +78 -0
  75. package/es/lowcode/index.js +1 -0
  76. package/es/lowcode/painter/Components.js +47 -21
  77. package/es/lowcode/painter/DesignOperator.js +47 -28
  78. package/es/lowcode/painter/DesignToolbar.js +86 -15
  79. package/es/lowcode/painter/I18n.js +2 -2
  80. package/es/lowcode/painter/Outline.js +31 -26
  81. package/es/lowcode/painter/Panel.js +100 -142
  82. package/es/lowcode/painter/Ribbon.js +1 -1
  83. package/es/lowcode/painter/components/ActionBindModal.js +293 -0
  84. package/es/lowcode/painter/components/AdvancePanel.js +140 -0
  85. package/es/lowcode/painter/components/AttrsPanel.js +145 -0
  86. package/es/lowcode/painter/components/Collapse.js +20 -9
  87. package/es/lowcode/painter/components/ColorInput.js +5 -3
  88. package/es/lowcode/painter/components/DragDrop/DragDropContext.js +137 -0
  89. package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +47 -0
  90. package/es/lowcode/painter/components/DragDrop/Overlay.js +8 -0
  91. package/es/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +67 -0
  92. package/es/lowcode/painter/components/FieldSelector.js +44 -0
  93. package/es/lowcode/painter/components/ListEditor.js +18 -9
  94. package/es/lowcode/painter/components/PanelItem.js +1 -1
  95. package/es/lowcode/painter/components/PopConfirm.js +10 -3
  96. package/es/lowcode/painter/components/SortBox.js +11 -4
  97. package/es/lowcode/painter/components/TreeEditor.js +13 -0
  98. package/es/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
  99. package/es/lowcode/painter/components/code-editor/JSEditor.js +25 -14
  100. package/es/lowcode/painter/components/code-editor/JsonEditor.js +41 -0
  101. package/es/lowcode/painter/components/field-setting/BatchSetting.js +144 -0
  102. package/es/lowcode/painter/components/field-setting/CheckRules.js +126 -0
  103. package/es/lowcode/painter/components/field-setting/FieldAttrs.js +287 -0
  104. package/es/lowcode/painter/components/field-setting/FieldAttrsModal.js +290 -0
  105. package/es/lowcode/painter/components/field-setting/FieldDefaultValue.js +63 -0
  106. package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +116 -0
  107. package/es/lowcode/painter/components/field-setting/SettingUI.js +419 -0
  108. package/es/lowcode/painter/components/field-setting/index.js +363 -0
  109. package/es/lowcode/painter/index.js +3 -1
  110. package/es/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +101 -0
  111. package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +74 -13
  112. package/es/lowcode/painter/panel-section/BlockEditor/index.js +24 -0
  113. package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +44 -0
  114. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +202 -0
  115. package/es/lowcode/painter/panel-section/DataSetSelector.js +115 -43
  116. package/es/lowcode/painter/panel-section/FieldsSetting.js +308 -0
  117. package/es/lowcode/painter/panel-section/Icon.js +14 -14
  118. package/es/lowcode/painter/panel-section/IconConditionSelector.js +111 -0
  119. package/es/lowcode/painter/panel-section/IconSelector.js +5 -2
  120. package/es/lowcode/painter/panel-section/ImpExp.js +91 -0
  121. package/es/lowcode/painter/panel-section/JSEditor.js +49 -0
  122. package/es/lowcode/painter/panel-section/LayoutRatio.js +6 -7
  123. package/es/lowcode/painter/panel-section/SerialsSelector.js +44 -0
  124. package/es/lowcode/painter/panel-section/SplitDisplay.js +248 -0
  125. package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
  126. package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +2 -22
  127. package/es/lowcode/painter/panel-section/TabItems.js +46 -30
  128. package/es/lowcode/painter/panel-section/TableTopFilter.js +306 -0
  129. package/es/lowcode/painter/panel-section/TableZebra.js +66 -6
  130. package/es/lowcode/painter/panel-section/TreeRootEditor.js +78 -0
  131. package/es/lowcode/painter/services/toolbar.js +25 -0
  132. package/es/lowcode/painter/style/action-bind-modal.less +102 -0
  133. package/es/lowcode/painter/style/collapse.less +6 -0
  134. package/es/lowcode/painter/style/components.less +5 -4
  135. package/es/lowcode/painter/style/design.less +2 -3
  136. package/es/lowcode/painter/style/dragdrop.less +10 -0
  137. package/es/lowcode/painter/style/fields-setting.less +25 -0
  138. package/es/lowcode/painter/style/impexp.less +7 -0
  139. package/es/lowcode/painter/style/panel-attrs.less +43 -0
  140. package/es/lowcode/painter/style/panel.less +6 -37
  141. package/es/lowcode/painter/style/pop-confirm.less +9 -2
  142. package/es/lowcode/painter/style/split-display.less +28 -0
  143. package/es/lowcode/painter/style/treedragdrop.less +19 -0
  144. package/es/lowcode/preview/index.js +14 -0
  145. package/es/lowcode/view/Canvas.js +34 -139
  146. package/es/lowcode/view/Loading.js +6 -2
  147. package/es/lowcode/view/Page.js +16 -14
  148. package/es/lowcode/view/lc-components/Box/FunctionPreview.js +9 -0
  149. package/es/lowcode/view/lc-components/Box/index.js +11 -2
  150. package/es/lowcode/view/lc-components/Box/index.less +0 -1
  151. package/es/lowcode/view/lc-components/Box/meta.json +1 -3
  152. package/es/lowcode/view/lc-components/Button/FunctionDesign.js +8 -10
  153. package/es/lowcode/view/lc-components/Button/FunctionLive.js +3 -6
  154. package/es/lowcode/view/lc-components/Button/FunctionPreview.js +6 -0
  155. package/es/lowcode/view/lc-components/Button/index.js +43 -20
  156. package/es/lowcode/view/lc-components/Button/meta.json +8 -8
  157. package/es/lowcode/view/lc-components/CardList/FunctionPreview.js +9 -0
  158. package/es/lowcode/view/lc-components/CardList/index.js +1 -0
  159. package/es/lowcode/view/lc-components/CardList/meta.json +1 -2
  160. package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +17 -23
  161. package/es/lowcode/view/lc-components/Dialog/FunctionPreview.js +9 -0
  162. package/es/lowcode/view/lc-components/Dialog/index.js +1 -0
  163. package/es/lowcode/view/lc-components/Dialog/meta.json +0 -1
  164. package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +4 -2
  165. package/es/lowcode/view/lc-components/Drawer/FunctionPreview.js +9 -0
  166. package/es/lowcode/view/lc-components/Drawer/index.js +17 -0
  167. package/es/lowcode/view/lc-components/Drawer/index.less +3 -0
  168. package/es/lowcode/view/lc-components/Drawer/meta.json +0 -1
  169. package/es/lowcode/view/lc-components/Form/FunctionDesign.js +31 -2
  170. package/es/lowcode/view/lc-components/Form/FunctionPreview.js +9 -0
  171. package/es/lowcode/view/lc-components/Form/index.js +114 -8
  172. package/es/lowcode/view/lc-components/Form/index.less +5 -0
  173. package/es/lowcode/view/lc-components/Form/meta.json +534 -55
  174. package/es/lowcode/view/lc-components/Iframe/FunctionPreview.js +9 -0
  175. package/es/lowcode/view/lc-components/Iframe/index.js +1 -0
  176. package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
  177. package/es/lowcode/view/lc-components/ImEx/FunctionPreview.js +9 -0
  178. package/es/lowcode/view/lc-components/ImEx/index.js +1 -0
  179. package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
  180. package/es/lowcode/view/lc-components/Image/FunctionPreview.js +9 -0
  181. package/es/lowcode/view/lc-components/Image/index.js +1 -0
  182. package/es/lowcode/view/lc-components/Image/meta.json +1 -1
  183. package/es/lowcode/view/lc-components/JSX/FunctionPreview.js +9 -0
  184. package/es/lowcode/view/lc-components/JSX/index.js +19 -6
  185. package/es/lowcode/view/lc-components/JSX/meta.json +8 -5
  186. package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +19 -17
  187. package/es/lowcode/view/lc-components/Layout/FunctionLive.js +3 -8
  188. package/es/lowcode/view/lc-components/Layout/FunctionPreview.js +9 -0
  189. package/es/lowcode/view/lc-components/Layout/index.js +1 -0
  190. package/es/lowcode/view/lc-components/Layout/meta.json +1 -2
  191. package/es/lowcode/view/lc-components/Link/FunctionPreview.js +9 -0
  192. package/es/lowcode/view/lc-components/Link/index.js +1 -0
  193. package/es/lowcode/view/lc-components/Link/meta.json +2 -2
  194. package/es/lowcode/view/lc-components/Page/meta.json +49 -0
  195. package/es/lowcode/view/lc-components/PageContent/index.js +53 -0
  196. package/es/lowcode/view/lc-components/PageContent/meta.json +9 -0
  197. package/es/lowcode/view/lc-components/PageFooter/index.js +38 -0
  198. package/es/lowcode/view/lc-components/PageFooter/meta.json +9 -0
  199. package/es/lowcode/view/lc-components/PageHeader/index.js +40 -0
  200. package/es/lowcode/view/lc-components/PageHeader/meta.json +9 -0
  201. package/es/lowcode/view/lc-components/PageModal/index.js +23 -0
  202. package/es/lowcode/view/lc-components/Section/FunctionPreview.js +9 -0
  203. package/es/lowcode/view/lc-components/Section/index.js +1 -0
  204. package/es/lowcode/view/lc-components/Section/meta.json +1 -1
  205. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +59 -2
  206. package/es/lowcode/view/lc-components/Split/FunctionPreview.js +9 -0
  207. package/es/lowcode/view/lc-components/Split/index.js +46 -7
  208. package/es/lowcode/view/lc-components/Split/meta.json +10 -29
  209. package/es/lowcode/view/lc-components/Table/FunctionDesign.js +41 -4
  210. package/es/lowcode/view/lc-components/Table/FunctionPreview.js +9 -0
  211. package/es/lowcode/view/lc-components/Table/components/TopFilter.js +96 -0
  212. package/es/lowcode/view/lc-components/Table/index.js +365 -49
  213. package/es/lowcode/view/lc-components/Table/meta.json +229 -55
  214. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +72 -2
  215. package/es/lowcode/view/lc-components/Tabs/FunctionLive.js +1 -0
  216. package/es/lowcode/view/lc-components/Tabs/FunctionPreview.js +10 -0
  217. package/es/lowcode/view/lc-components/Tabs/index.js +113 -10
  218. package/es/lowcode/view/lc-components/Tabs/meta.json +53 -81
  219. package/es/lowcode/view/lc-components/Text/FunctionPreview.js +9 -0
  220. package/es/lowcode/view/lc-components/Text/index.js +1 -0
  221. package/es/lowcode/view/lc-components/Text/meta.json +1 -1
  222. package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +63 -3
  223. package/es/lowcode/view/lc-components/Tree/FunctionPreview.js +26 -0
  224. package/es/lowcode/view/lc-components/Tree/index.js +323 -8
  225. package/es/lowcode/view/lc-components/Tree/index.less +5 -0
  226. package/es/lowcode/view/lc-components/Tree/meta.json +224 -80
  227. package/es/lowcode/view/lc-components/Wrapper.js +44 -27
  228. package/es/lowcode/view/style/page.less +3 -0
  229. package/es/services.js +5 -3
  230. package/es/utils/grid.js +2 -2
  231. package/lib/components/Builder/index.js +4 -1
  232. package/lib/components/IconFont/index.js +11 -0
  233. package/lib/components/LDActions/index.js +141 -0
  234. package/lib/components/LDActions/index.less +65 -0
  235. package/lib/components/LdAutoForm/index.js +1 -1
  236. package/lib/components/LdCom/index.js +2 -1
  237. package/lib/components/LdFormList/index.js +14 -9
  238. package/lib/components/LdGrid/index.js +13 -7
  239. package/lib/components/LdGridForm/index.js +4 -3
  240. package/lib/components/LdRuntimeCom/index.js +21 -8
  241. package/lib/components/LdTree/index.js +112 -31
  242. package/lib/components/LdTree/index.less +6 -1
  243. package/lib/helper/ldBuilder.js +28 -12
  244. package/lib/helper/ldComBuild.js +27 -12
  245. package/lib/index.js +8 -0
  246. package/lib/locales/zh-CN.js +227 -0
  247. package/lib/lowcode/constants/api-url.js +382 -263
  248. package/lib/lowcode/constants/event-topics.js +5 -1
  249. package/lib/lowcode/constants/index.js +31 -3
  250. package/lib/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +38 -0
  251. package/lib/lowcode/engine/factory/panel-item-factory/index.js +2 -0
  252. package/lib/lowcode/engine/meta/box.props.default.json +3 -2
  253. package/lib/lowcode/engine/meta/box.props.json +1 -3
  254. package/lib/lowcode/engine/meta/button.props.default.json +5 -2
  255. package/lib/lowcode/engine/meta/button.props.json +8 -8
  256. package/lib/lowcode/engine/meta/cardlist.props.default.json +4 -2
  257. package/lib/lowcode/engine/meta/cardlist.props.json +1 -2
  258. package/lib/lowcode/engine/meta/dialog.props.default.json +4 -2
  259. package/lib/lowcode/engine/meta/dialog.props.json +0 -1
  260. package/lib/lowcode/engine/meta/drawer.props.default.json +4 -2
  261. package/lib/lowcode/engine/meta/drawer.props.json +0 -1
  262. package/lib/lowcode/engine/meta/form.props.default.json +53 -4
  263. package/lib/lowcode/engine/meta/form.props.json +584 -55
  264. package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
  265. package/lib/lowcode/engine/meta/iframe.props.json +1 -1
  266. package/lib/lowcode/engine/meta/image.props.default.json +5 -2
  267. package/lib/lowcode/engine/meta/image.props.json +1 -1
  268. package/lib/lowcode/engine/meta/imex.props.default.json +5 -2
  269. package/lib/lowcode/engine/meta/imex.props.json +1 -1
  270. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +152 -26
  271. package/lib/lowcode/engine/meta/jsx.props.default.json +2 -1
  272. package/lib/lowcode/engine/meta/jsx.props.json +10 -5
  273. package/lib/lowcode/engine/meta/layout.props.default.json +5 -2
  274. package/lib/lowcode/engine/meta/layout.props.json +1 -2
  275. package/lib/lowcode/engine/meta/link.props.default.json +5 -2
  276. package/lib/lowcode/engine/meta/link.props.json +2 -2
  277. package/lib/lowcode/engine/meta/local/local.zh-cn.js +103 -0
  278. package/lib/lowcode/engine/meta/page.props.default.json +12 -0
  279. package/lib/lowcode/engine/meta/page.props.json +49 -0
  280. package/lib/lowcode/engine/meta/pagecontent.props.default.json +6 -0
  281. package/lib/lowcode/engine/meta/pagecontent.props.json +7 -0
  282. package/lib/lowcode/engine/meta/pagefooter.props.default.json +6 -0
  283. package/lib/lowcode/engine/meta/pagefooter.props.json +7 -0
  284. package/lib/lowcode/engine/meta/pageheader.props.default.json +6 -0
  285. package/lib/lowcode/engine/meta/pageheader.props.json +7 -0
  286. package/lib/lowcode/engine/meta/section.props.default.json +5 -2
  287. package/lib/lowcode/engine/meta/section.props.json +1 -1
  288. package/lib/lowcode/engine/meta/split.props.default.json +9 -4
  289. package/lib/lowcode/engine/meta/split.props.json +14 -29
  290. package/lib/lowcode/engine/meta/table.props.default.json +23 -3
  291. package/lib/lowcode/engine/meta/table.props.json +257 -55
  292. package/lib/lowcode/engine/meta/tabs.props.default.json +16 -9
  293. package/lib/lowcode/engine/meta/tabs.props.json +57 -81
  294. package/lib/lowcode/engine/meta/text.props.default.json +5 -2
  295. package/lib/lowcode/engine/meta/text.props.json +1 -1
  296. package/lib/lowcode/engine/meta/tree.props.default.json +20 -7
  297. package/lib/lowcode/engine/meta/tree.props.json +225 -79
  298. package/lib/lowcode/engine/provider/ContextProvider/index.js +177 -0
  299. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +169 -0
  300. package/lib/lowcode/engine/tools/dataProcess.js +64 -1
  301. package/lib/lowcode/engine/tools/helper.js +100 -18
  302. package/lib/lowcode/engine/tools/useCanvasRender.js +90 -0
  303. package/lib/lowcode/engine/tools/usePromiseState.js +7 -5
  304. package/lib/lowcode/engine/tools/useTodo.js +85 -0
  305. package/lib/lowcode/index.js +7 -0
  306. package/lib/lowcode/painter/Components.js +46 -20
  307. package/lib/lowcode/painter/DesignOperator.js +45 -26
  308. package/lib/lowcode/painter/DesignToolbar.js +82 -11
  309. package/lib/lowcode/painter/I18n.js +1 -1
  310. package/lib/lowcode/painter/Outline.js +29 -24
  311. package/lib/lowcode/painter/Panel.js +97 -139
  312. package/lib/lowcode/painter/Ribbon.js +1 -1
  313. package/lib/lowcode/painter/components/ActionBindModal.js +300 -0
  314. package/lib/lowcode/painter/components/AdvancePanel.js +148 -0
  315. package/lib/lowcode/painter/components/AttrsPanel.js +153 -0
  316. package/lib/lowcode/painter/components/Collapse.js +20 -9
  317. package/lib/lowcode/painter/components/ColorInput.js +5 -3
  318. package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +146 -0
  319. package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +54 -0
  320. package/lib/lowcode/painter/components/DragDrop/Overlay.js +15 -0
  321. package/lib/lowcode/painter/components/DragDrop/TreeDragDropWrapper.js +75 -0
  322. package/lib/lowcode/painter/components/FieldSelector.js +52 -0
  323. package/lib/lowcode/painter/components/ListEditor.js +17 -8
  324. package/lib/lowcode/painter/components/PanelItem.js +1 -1
  325. package/lib/lowcode/painter/components/PopConfirm.js +10 -3
  326. package/lib/lowcode/painter/components/SortBox.js +12 -5
  327. package/lib/lowcode/painter/components/TreeEditor.js +20 -0
  328. package/lib/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
  329. package/lib/lowcode/painter/components/code-editor/JSEditor.js +25 -14
  330. package/lib/lowcode/painter/components/code-editor/JsonEditor.js +48 -0
  331. package/lib/lowcode/painter/components/field-setting/BatchSetting.js +151 -0
  332. package/lib/lowcode/painter/components/field-setting/CheckRules.js +133 -0
  333. package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +295 -0
  334. package/lib/lowcode/painter/components/field-setting/FieldAttrsModal.js +298 -0
  335. package/lib/lowcode/painter/components/field-setting/FieldDefaultValue.js +70 -0
  336. package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +123 -0
  337. package/lib/lowcode/painter/components/field-setting/SettingUI.js +427 -0
  338. package/lib/lowcode/painter/components/field-setting/index.js +370 -0
  339. package/lib/lowcode/painter/index.js +3 -1
  340. package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +20 -66
  341. package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +71 -10
  342. package/lib/lowcode/painter/panel-section/BlockEditor/index.js +31 -0
  343. package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +51 -0
  344. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +208 -0
  345. package/lib/lowcode/painter/panel-section/DataSetSelector.js +112 -40
  346. package/lib/lowcode/painter/panel-section/FieldsSetting.js +316 -0
  347. package/lib/lowcode/painter/panel-section/Icon.js +16 -14
  348. package/lib/lowcode/painter/panel-section/IconConditionSelector.js +119 -0
  349. package/lib/lowcode/painter/panel-section/IconSelector.js +5 -2
  350. package/lib/lowcode/painter/panel-section/ImpExp.js +98 -0
  351. package/lib/lowcode/painter/panel-section/JSEditor.js +57 -0
  352. package/lib/lowcode/painter/panel-section/LayoutRatio.js +5 -6
  353. package/lib/lowcode/painter/panel-section/SerialsSelector.js +51 -0
  354. package/lib/lowcode/painter/panel-section/SplitDisplay.js +256 -0
  355. package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
  356. package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +3 -23
  357. package/lib/lowcode/painter/panel-section/TabItems.js +45 -29
  358. package/lib/lowcode/painter/panel-section/TableTopFilter.js +314 -0
  359. package/lib/lowcode/painter/panel-section/TableZebra.js +67 -6
  360. package/lib/lowcode/painter/panel-section/TreeRootEditor.js +86 -0
  361. package/lib/lowcode/painter/services/toolbar.js +32 -0
  362. package/lib/lowcode/painter/style/action-bind-modal.less +102 -0
  363. package/lib/lowcode/painter/style/collapse.less +6 -0
  364. package/lib/lowcode/painter/style/components.less +5 -4
  365. package/lib/lowcode/painter/style/design.less +2 -3
  366. package/lib/lowcode/painter/style/dragdrop.less +10 -0
  367. package/lib/lowcode/painter/style/fields-setting.less +25 -0
  368. package/lib/lowcode/painter/style/impexp.less +7 -0
  369. package/lib/lowcode/painter/style/panel-attrs.less +43 -0
  370. package/lib/lowcode/painter/style/panel.less +6 -37
  371. package/lib/lowcode/painter/style/pop-confirm.less +9 -2
  372. package/lib/lowcode/painter/style/split-display.less +28 -0
  373. package/lib/lowcode/painter/style/treedragdrop.less +19 -0
  374. package/lib/lowcode/preview/index.js +21 -0
  375. package/lib/lowcode/view/Canvas.js +32 -145
  376. package/lib/lowcode/view/Loading.js +6 -2
  377. package/lib/lowcode/view/Page.js +12 -10
  378. package/lib/lowcode/view/lc-components/Box/FunctionPreview.js +16 -0
  379. package/lib/lowcode/view/lc-components/Box/index.js +11 -2
  380. package/lib/lowcode/view/lc-components/Box/index.less +0 -1
  381. package/lib/lowcode/view/lc-components/Box/meta.json +1 -3
  382. package/lib/lowcode/view/lc-components/Button/FunctionDesign.js +8 -10
  383. package/lib/lowcode/view/lc-components/Button/FunctionLive.js +3 -6
  384. package/lib/lowcode/view/lc-components/Button/FunctionPreview.js +13 -0
  385. package/lib/lowcode/view/lc-components/Button/index.js +41 -18
  386. package/lib/lowcode/view/lc-components/Button/meta.json +8 -8
  387. package/lib/lowcode/view/lc-components/CardList/FunctionPreview.js +16 -0
  388. package/lib/lowcode/view/lc-components/CardList/index.js +1 -0
  389. package/lib/lowcode/view/lc-components/CardList/meta.json +1 -2
  390. package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +16 -23
  391. package/lib/lowcode/view/lc-components/Dialog/FunctionPreview.js +16 -0
  392. package/lib/lowcode/view/lc-components/Dialog/index.js +1 -0
  393. package/lib/lowcode/view/lc-components/Dialog/meta.json +0 -1
  394. package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +4 -2
  395. package/lib/lowcode/view/lc-components/Drawer/FunctionPreview.js +16 -0
  396. package/lib/lowcode/view/lc-components/Drawer/index.js +17 -0
  397. package/lib/lowcode/view/lc-components/Drawer/index.less +3 -0
  398. package/lib/lowcode/view/lc-components/Drawer/meta.json +0 -1
  399. package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +32 -2
  400. package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +16 -0
  401. package/lib/lowcode/view/lc-components/Form/index.js +113 -7
  402. package/lib/lowcode/view/lc-components/Form/index.less +5 -0
  403. package/lib/lowcode/view/lc-components/Form/meta.json +534 -55
  404. package/lib/lowcode/view/lc-components/Iframe/FunctionPreview.js +16 -0
  405. package/lib/lowcode/view/lc-components/Iframe/index.js +1 -0
  406. package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
  407. package/lib/lowcode/view/lc-components/ImEx/FunctionPreview.js +16 -0
  408. package/lib/lowcode/view/lc-components/ImEx/index.js +1 -0
  409. package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
  410. package/lib/lowcode/view/lc-components/Image/FunctionPreview.js +16 -0
  411. package/lib/lowcode/view/lc-components/Image/index.js +1 -0
  412. package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
  413. package/lib/lowcode/view/lc-components/JSX/FunctionPreview.js +16 -0
  414. package/lib/lowcode/view/lc-components/JSX/index.js +19 -6
  415. package/lib/lowcode/view/lc-components/JSX/meta.json +8 -5
  416. package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +21 -18
  417. package/lib/lowcode/view/lc-components/Layout/FunctionLive.js +3 -8
  418. package/lib/lowcode/view/lc-components/Layout/FunctionPreview.js +16 -0
  419. package/lib/lowcode/view/lc-components/Layout/index.js +1 -0
  420. package/lib/lowcode/view/lc-components/Layout/meta.json +1 -2
  421. package/lib/lowcode/view/lc-components/Link/FunctionPreview.js +16 -0
  422. package/lib/lowcode/view/lc-components/Link/index.js +1 -0
  423. package/lib/lowcode/view/lc-components/Link/meta.json +2 -2
  424. package/lib/lowcode/view/lc-components/Page/meta.json +49 -0
  425. package/lib/lowcode/view/lc-components/PageContent/index.js +61 -0
  426. package/lib/lowcode/view/lc-components/PageContent/meta.json +9 -0
  427. package/lib/lowcode/view/lc-components/PageFooter/index.js +46 -0
  428. package/lib/lowcode/view/lc-components/PageFooter/meta.json +9 -0
  429. package/lib/lowcode/view/lc-components/PageHeader/index.js +48 -0
  430. package/lib/lowcode/view/lc-components/PageHeader/meta.json +9 -0
  431. package/lib/lowcode/view/lc-components/PageModal/index.js +30 -0
  432. package/lib/lowcode/view/lc-components/Section/FunctionPreview.js +16 -0
  433. package/lib/lowcode/view/lc-components/Section/index.js +1 -0
  434. package/lib/lowcode/view/lc-components/Section/meta.json +1 -1
  435. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +60 -2
  436. package/lib/lowcode/view/lc-components/Split/FunctionPreview.js +16 -0
  437. package/lib/lowcode/view/lc-components/Split/index.js +45 -6
  438. package/lib/lowcode/view/lc-components/Split/meta.json +10 -29
  439. package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +43 -5
  440. package/lib/lowcode/view/lc-components/Table/FunctionPreview.js +16 -0
  441. package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +104 -0
  442. package/lib/lowcode/view/lc-components/Table/index.js +364 -48
  443. package/lib/lowcode/view/lc-components/Table/meta.json +229 -55
  444. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +73 -2
  445. package/lib/lowcode/view/lc-components/Tabs/FunctionLive.js +2 -1
  446. package/lib/lowcode/view/lc-components/Tabs/FunctionPreview.js +17 -0
  447. package/lib/lowcode/view/lc-components/Tabs/index.js +112 -9
  448. package/lib/lowcode/view/lc-components/Tabs/meta.json +53 -81
  449. package/lib/lowcode/view/lc-components/Text/FunctionPreview.js +16 -0
  450. package/lib/lowcode/view/lc-components/Text/index.js +1 -0
  451. package/lib/lowcode/view/lc-components/Text/meta.json +1 -1
  452. package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +64 -3
  453. package/lib/lowcode/view/lc-components/Tree/FunctionPreview.js +33 -0
  454. package/lib/lowcode/view/lc-components/Tree/index.js +321 -6
  455. package/lib/lowcode/view/lc-components/Tree/index.less +5 -0
  456. package/lib/lowcode/view/lc-components/Tree/meta.json +224 -80
  457. package/lib/lowcode/view/lc-components/Wrapper.js +42 -25
  458. package/lib/lowcode/view/style/page.less +3 -0
  459. package/lib/services.js +5 -3
  460. package/lib/utils/grid.js +2 -2
  461. package/package.json +12 -7
  462. package/es/lowcode/engine/provider/ContextProvider.js +0 -169
  463. package/es/lowcode/painter/components/actions-editor/ActionEditor.js +0 -147
  464. package/es/lowcode/painter/panel-section/TableActions.js +0 -19
  465. package/lib/lowcode/engine/provider/ContextProvider.js +0 -177
  466. package/lib/lowcode/painter/panel-section/TableActions.js +0 -26
@@ -0,0 +1,161 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
+ var _excluded = ["source"];
7
+ import React, { createContext, useEffect } from 'react';
8
+ import { useRequest, useSetState, useAsyncEffect, useCookieState, usePrevious, useMemoizedFn } from 'ahooks';
9
+ import { LuckDaContext } from "../../../components/Builder";
10
+ import { doAction as doActionUtils } from "../../../helper/action";
11
+ import usePromiseState from "../tools/usePromiseState";
12
+ import { decompress } from "../tools/dataProcess";
13
+ import { fetchPageData, fetchDesignModlueData, fetchModlueData, fetchAllDataset, fetchAllSerials } from "../../constants/api-url";
14
+ import { RUNTIME_COOKIE_KEY, RUNTIME, DATA_MODEL_CODE_KEY } from "../../constants";
15
+ export var RemoteSourceContext = /*#__PURE__*/createContext(null);
16
+ export default (function (_ref) {
17
+ var children = _ref.children,
18
+ code = _ref.code,
19
+ runtime = _ref.runtime;
20
+ var _usePromiseState = usePromiseState(null),
21
+ _usePromiseState2 = _slicedToArray(_usePromiseState, 2),
22
+ pageData = _usePromiseState2[0],
23
+ setPageData = _usePromiseState2[1];
24
+ var _useSetState = useSetState({}),
25
+ _useSetState2 = _slicedToArray(_useSetState, 2),
26
+ remoteSource = _useSetState2[0],
27
+ setRemoteSource = _useSetState2[1];
28
+ var _useCookieState = useCookieState(RUNTIME_COOKIE_KEY),
29
+ _useCookieState2 = _slicedToArray(_useCookieState, 2),
30
+ cookieRuntime = _useCookieState2[0],
31
+ setRuntime = _useCookieState2[1];
32
+ var prevRuntime = usePrevious(cookieRuntime);
33
+ useEffect(function () {
34
+ setRuntime(runtime);
35
+ return function () {
36
+ return setRuntime(prevRuntime);
37
+ };
38
+ }, []);
39
+
40
+ // 获取页面数据
41
+ var _useRequest = useRequest(fetchPageData, {
42
+ manual: true
43
+ }),
44
+ fetchPageDataLoading = _useRequest.loading,
45
+ runFetchPageData = _useRequest.runAsync;
46
+ // 获取模块数据
47
+ var _useRequest2 = useRequest(runtime === RUNTIME.DESIGN ? fetchDesignModlueData : fetchModlueData, {
48
+ manual: true,
49
+ onSuccess: function onSuccess(_ref2) {
50
+ var code = _ref2.code,
51
+ data = _ref2.data;
52
+ if (code === 1) {
53
+ setRemoteSource({
54
+ module: data
55
+ });
56
+ }
57
+ }
58
+ }),
59
+ fetchModlueDataLoading = _useRequest2.loading,
60
+ runFetchModlueData = _useRequest2.runAsync,
61
+ refreshModlueData = _useRequest2.refreshAsync;
62
+ // 获取数据集数据
63
+ var _useRequest3 = useRequest(fetchAllDataset, {
64
+ manual: true,
65
+ onSuccess: function onSuccess(_ref3) {
66
+ var code = _ref3.code,
67
+ data = _ref3.data;
68
+ if (code === 1) {
69
+ setRemoteSource({
70
+ dataset: data
71
+ });
72
+ }
73
+ }
74
+ }),
75
+ fetchAllDatasetLoading = _useRequest3.loading,
76
+ runFetchAllDataset = _useRequest3.run,
77
+ refreshDataset = _useRequest3.refreshAsync;
78
+ // 获取资源串数据
79
+ var _useRequest4 = useRequest(fetchAllSerials, {
80
+ manual: true,
81
+ onSuccess: function onSuccess(_ref4) {
82
+ var code = _ref4.code,
83
+ list = _ref4.list,
84
+ detail = _ref4.detail;
85
+ if (code === 1) {
86
+ setRemoteSource({
87
+ serials: list.map(function (id) {
88
+ return detail[id];
89
+ })
90
+ });
91
+ }
92
+ }
93
+ }),
94
+ fetchAllSerialsLoading = _useRequest4.loading,
95
+ runFetchAllSerials = _useRequest4.run,
96
+ refreshSerials = _useRequest4.refreshAsync;
97
+ useAsyncEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
98
+ var fetchPageDataRes, data, list, detail, _detail$list$, source, info;
99
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
100
+ while (1) switch (_context.prev = _context.next) {
101
+ case 0:
102
+ _context.next = 2;
103
+ return runFetchPageData({
104
+ code: code
105
+ });
106
+ case 2:
107
+ fetchPageDataRes = _context.sent;
108
+ if (!(fetchPageDataRes.code === 1)) {
109
+ _context.next = 13;
110
+ break;
111
+ }
112
+ data = fetchPageDataRes.data, list = fetchPageDataRes.list, detail = fetchPageDataRes.detail;
113
+ _detail$list$ = detail[list[0]], source = _detail$list$.source, info = _objectWithoutProperties(_detail$list$, _excluded);
114
+ window[DATA_MODEL_CODE_KEY] = data.dataModelKey;
115
+ _context.next = 9;
116
+ return runFetchModlueData(data.dataModelKey, {
117
+ moduleCode: data.moduleCode
118
+ });
119
+ case 9:
120
+ runFetchAllDataset({
121
+ dataModelKey: data.dataModelKey
122
+ });
123
+ runFetchAllSerials({
124
+ uid: data.moduleId
125
+ });
126
+ setRemoteSource({
127
+ pageinfo: _objectSpread({
128
+ relationship: data
129
+ }, info)
130
+ });
131
+ setPageData(decompress(source));
132
+ case 13:
133
+ case "end":
134
+ return _context.stop();
135
+ }
136
+ }, _callee);
137
+ })), [code]);
138
+ var doAction = useMemoizedFn(function (_action, _data, _params) {
139
+ doActionUtils(_action, _data, _params, {
140
+ actions: remoteSource.module.actions,
141
+ moduleCode: remoteSource.module.moduleCode
142
+ });
143
+ });
144
+ return /*#__PURE__*/React.createElement(RemoteSourceContext.Provider, {
145
+ value: _objectSpread(_objectSpread({
146
+ pageData: pageData
147
+ }, remoteSource), {}, {
148
+ loading: fetchPageDataLoading || fetchModlueDataLoading,
149
+ fetchAllDatasetLoading: fetchAllDatasetLoading,
150
+ fetchAllSerialsLoading: fetchAllSerialsLoading,
151
+ refreshModlueData: refreshModlueData,
152
+ refreshDataset: refreshDataset,
153
+ refreshSerials: refreshSerials,
154
+ setPageData: setPageData
155
+ })
156
+ }, /*#__PURE__*/React.createElement(LuckDaContext.Provider, {
157
+ value: _objectSpread(_objectSpread({}, remoteSource.module), {}, {
158
+ doAction: doAction
159
+ })
160
+ }, children));
161
+ });
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
4
  import _typeof from "@babel/runtime/helpers/esm/typeof";
5
5
  import * as LZString from 'lz-string';
6
- import { CELL_KEY } from "../../constants";
6
+ import { LC_BUILDIN_UNIT_KEY } from "../../constants";
7
7
 
8
8
  /**
9
9
  * 数据压缩
@@ -149,6 +149,68 @@ export function add(json, parentId, id, data) {
149
149
  process(json, getPathById(json, parentId), id, data);
150
150
  }
151
151
 
152
+ /**
153
+ * 移动指定的节点到另一个节点的指定位置。
154
+ *
155
+ * @param {Object} json - 要操作的JSON对象。
156
+ * @param {string} sid - 被移动的节点id
157
+ * @param {string} tid - 目标节点id
158
+ * @param {string} action - 'left': 往节点前面插入,'right':往节点后面插,'inside':往节点子节点插
159
+ */
160
+ export function move(json, sid, tid, action) {
161
+ // 验证节点存在性
162
+ var _findNodeAndParent3 = findNodeAndParent(sid, json),
163
+ sourceNode = _findNodeAndParent3.node,
164
+ sourceParent = _findNodeAndParent3.parent;
165
+ var _findNodeAndParent4 = findNodeAndParent(tid, json),
166
+ targetNode = _findNodeAndParent4.node,
167
+ targetParent = _findNodeAndParent4.parent;
168
+ if (!sourceNode || !targetNode) {
169
+ throw new Error('Source or target node does not exist.');
170
+ }
171
+
172
+ // 从原父节点中移除
173
+ if (sourceParent) {
174
+ sourceParent.children = sourceParent.children.filter(function (id) {
175
+ return id !== sid;
176
+ });
177
+ if (sourceParent.children.length === 0) {
178
+ delete sourceParent.children;
179
+ }
180
+ delete sourceParent[sid];
181
+ }
182
+ switch (action) {
183
+ case 'inside':
184
+ // 插入到目标节点的children数组
185
+ if (!targetNode.children) {
186
+ targetNode.children = [];
187
+ }
188
+ targetNode.children.push(sid);
189
+ sourceNode.props.parentId = tid;
190
+ targetNode[sid] = sourceNode;
191
+ break;
192
+ case 'left':
193
+ case 'right':
194
+ if (!targetParent) {
195
+ throw new Error('Target node must have a parent for left or right operations.');
196
+ }
197
+ // 插入到目标节点同级的前面或后面
198
+ var idx = targetParent.children.indexOf(tid);
199
+ if (idx === -1) {
200
+ throw new Error("Target node is not found in its parent's children list.");
201
+ }
202
+ if (action === 'right') {
203
+ idx++;
204
+ }
205
+ targetParent.children.splice(idx, 0, sid);
206
+ sourceNode.props.parentId = targetParent.props.id;
207
+ targetParent[sid] = sourceNode;
208
+ break;
209
+ default:
210
+ throw new Error('Invalid action type.');
211
+ }
212
+ }
213
+
152
214
  /**
153
215
  * 对指定的JSON结构进行节点的修改操作。
154
216
  *
@@ -181,7 +243,7 @@ export function deleteById(json, id) {
181
243
  export function getPathById(json, id) {
182
244
  var currentPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
183
245
  for (var key in json) {
184
- if (id === CELL_KEY.PAGE_ROOT) return '/';
246
+ if (id === LC_BUILDIN_UNIT_KEY.PAGE_ROOT) return '/';
185
247
  var newPath = currentPath ? "".concat(currentPath, "/").concat(key) : key;
186
248
  if (json[key].props && json[key].props.id === id) {
187
249
  return newPath;
@@ -1,7 +1,9 @@
1
+ import _construct from "@babel/runtime/helpers/esm/construct";
1
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
4
  import _typeof from "@babel/runtime/helpers/esm/typeof";
4
- import { omit } from 'lodash';
5
+ import { omit, omitBy, startsWith, isNil, isString, isArray } from 'lodash';
6
+ import postcss from 'postcss';
5
7
  export function isPromise(value) {
6
8
  return !!value && _typeof(value) === 'object' && typeof value.then === 'function';
7
9
  }
@@ -11,62 +13,137 @@ export function omitBadProps(props) {
11
13
  }
12
14
  export function listReducer(state, action) {
13
15
  switch (action.type) {
14
- case 'add':
16
+ case 'init':
15
17
  {
16
18
  var _action$callback;
19
+ (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, action.payload);
20
+ return action.payload;
21
+ }
22
+ case 'add':
23
+ {
24
+ var _action$callback2;
17
25
  var newState = [].concat(_toConsumableArray(state), [action.payload]);
18
- (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, newState);
26
+ (_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, newState);
19
27
  return newState;
20
28
  }
21
29
  case 'delete':
22
30
  {
23
- var _action$callback2;
31
+ var _action$callback3;
24
32
  var _newState = state.filter(function (item) {
25
33
  return item.id !== action.payload;
26
34
  });
27
- (_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, _newState);
35
+ (_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action, _newState);
28
36
  return _newState;
29
37
  }
30
38
  case 'edit':
31
39
  {
32
- var _action$callback3;
40
+ var _action$callback4;
33
41
  var _newState2 = state.map(function (item) {
34
42
  return item.id === action.payload.id ? _objectSpread(_objectSpread({}, item), action.payload.data) : item;
35
43
  });
36
- (_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action, _newState2);
44
+ (_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action, _newState2);
37
45
  return _newState2;
38
46
  }
39
- case 'active':
47
+ case 'batchEdit':
40
48
  {
41
- var _action$callback4;
49
+ var _action$callback5;
42
50
  var _newState3 = state.map(function (item) {
51
+ var newItem = action.payload.items.find(function (_id) {
52
+ return _id === item.id;
53
+ });
54
+ if (newItem) {
55
+ return _objectSpread(_objectSpread({}, item), action.payload.data);
56
+ }
57
+ return item;
58
+ });
59
+ (_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action, _newState3);
60
+ return _newState3;
61
+ }
62
+ case 'active':
63
+ {
64
+ var _action$callback6;
65
+ var _newState4 = state.map(function (item) {
43
66
  item.active = false;
44
67
  return item.id === action.payload.id ? _objectSpread(_objectSpread({}, item), action.payload.data) : item;
45
68
  });
46
- (_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action, _newState3);
47
- return _newState3;
69
+ (_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action, _newState4);
70
+ return _newState4;
48
71
  }
49
72
  case 'new':
50
73
  {
51
- var _action$callback5;
52
- var _newState4 = _toConsumableArray(action.payload);
53
- (_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action, _newState4);
54
- return _newState4;
74
+ var _action$callback7;
75
+ var _newState5 = _toConsumableArray(action.payload);
76
+ (_action$callback7 = action.callback) === null || _action$callback7 === void 0 || _action$callback7.call(action, _newState5);
77
+ return _newState5;
55
78
  }
56
79
  case 'sort':
57
80
  {
58
- var _action$callback6;
81
+ var _action$callback8;
59
82
  var sortItems = action.payload;
60
83
  var newItems = state.sort(function (a, b) {
61
84
  var indexA = sortItems.indexOf(a.id);
62
85
  var indexB = sortItems.indexOf(b.id);
63
86
  return indexA - indexB;
64
87
  });
65
- (_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action, _newState5);
66
- var _newState5 = _toConsumableArray(newItems);
67
- return _newState5;
88
+ var _newState6 = _toConsumableArray(newItems);
89
+ (_action$callback8 = action.callback) === null || _action$callback8 === void 0 || _action$callback8.call(action, _newState6);
90
+ return _newState6;
68
91
  }
69
92
  default:
70
93
  throw new Error();
71
94
  }
95
+ }
96
+ export function getCtx(context) {
97
+ return omitBy(context, function (_, key) {
98
+ return startsWith(key, '_');
99
+ });
100
+ }
101
+ export function getFuncBody(funcCode) {
102
+ var regex = /{([\s\S]*?)}(?![\s\S]*})/;
103
+ var matches = funcCode.match(regex);
104
+ if (matches) {
105
+ return matches[1].replace(/\s*\n\s*/g, ' ').trim();
106
+ }
107
+ return '';
108
+ }
109
+ export function executeCode(context, code, argsName) {
110
+ if (!isString(code)) {
111
+ throw new Error('executeCode编码参数无效');
112
+ }
113
+ for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
114
+ args[_key - 3] = arguments[_key];
115
+ }
116
+ if (isNil(argsName) && args.length > 0 || !isNil(argsName) && !isArray(argsName) || isArray(argsName) && argsName.length !== (args === null || args === void 0 ? void 0 : args.length)) {
117
+ throw new Error('executeCode参数不匹配');
118
+ }
119
+ var ctx = getCtx(context);
120
+ var func = _construct(Function, _toConsumableArray(argsName || []).concat(['ctx', getFuncBody(code)]));
121
+ return func.apply(void 0, args.concat([ctx]));
122
+ }
123
+ export function parseCSS(cssString) {
124
+ // 创建一个空对象来存储解析后的样式
125
+ var parsedStyles = {};
126
+ if (cssString) {
127
+ try {
128
+ // 解析CSS字符串
129
+ var ast = postcss.parse(cssString);
130
+
131
+ // 遍历AST中的每个规则
132
+ ast.walkDecls(function (decl) {
133
+ // 将每个声明的属性和值存储在对象中
134
+ parsedStyles[decl.prop] = decl.value;
135
+ });
136
+ } catch (e) {
137
+ console.error(e);
138
+ }
139
+ }
140
+
141
+ // 返回包含所有样式的对象
142
+ return parsedStyles;
143
+ }
144
+ ;
145
+ export function isColor(str) {
146
+ var hexRegex = /^#(?:[A-Fa-f0-9]{3,4}){1,2}$/;
147
+ var rgbaRegex = /^rgba?\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(0|1|0?\.\d+))?\s*\)$/;
148
+ return hexRegex.test(str) || rgbaRegex.test(str);
72
149
  }
@@ -0,0 +1,75 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
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
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
+ var _excluded = ["props", "children"],
7
+ _excluded2 = ["id", "component", "name", "desc", "icon", "group", "groupName", "order"];
8
+ import React, { useRef } from 'react';
9
+ import { dynamic } from 'umi';
10
+ import { useMemoizedFn, useCookieState, useCreation } from 'ahooks';
11
+ import { upperFirst } from 'lodash';
12
+ import { LC_BUILDIN_UNIT_KEY_LIST, RUNTIME_COOKIE_KEY } from "../../constants";
13
+ export default function useCanvasRender(data, deps) {
14
+ var dynamicCompMap = useRef({});
15
+ var _useCookieState = useCookieState(RUNTIME_COOKIE_KEY),
16
+ _useCookieState2 = _slicedToArray(_useCookieState, 1),
17
+ runtime = _useCookieState2[0];
18
+ var render = useMemoizedFn(function (_ref) {
19
+ var props = _ref.props,
20
+ children = _ref.children,
21
+ childrenMap = _objectWithoutProperties(_ref, _excluded);
22
+ if (props && !LC_BUILDIN_UNIT_KEY_LIST.includes(props.id)) {
23
+ var id = props.id,
24
+ component = props.component,
25
+ name = props.name,
26
+ desc = props.desc,
27
+ icon = props.icon,
28
+ group = props.group,
29
+ groupName = props.groupName,
30
+ order = props.order,
31
+ rest = _objectWithoutProperties(props, _excluded2);
32
+ if (!dynamicCompMap.current[component]) {
33
+ dynamicCompMap.current[component] = dynamic({
34
+ loader: function () {
35
+ var _loader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
36
+ var _runtime, _yield$import, _Comp;
37
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
38
+ while (1) switch (_context.prev = _context.next) {
39
+ case 0:
40
+ _runtime = upperFirst(runtime);
41
+ _context.next = 3;
42
+ return import("../../view/lc-components/".concat(component, "/Function").concat(_runtime));
43
+ case 3:
44
+ _yield$import = _context.sent;
45
+ _Comp = _yield$import.default;
46
+ return _context.abrupt("return", _Comp);
47
+ case 6:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }, _callee);
52
+ }));
53
+ function loader() {
54
+ return _loader.apply(this, arguments);
55
+ }
56
+ return loader;
57
+ }()
58
+ });
59
+ }
60
+ var Comp = dynamicCompMap.current[component];
61
+ return /*#__PURE__*/React.createElement(Comp, _extends({
62
+ key: id,
63
+ id: id
64
+ }, rest), (children === null || children === void 0 ? void 0 : children.length) > 0 ? children.map(function (_id) {
65
+ return render(childrenMap[_id]);
66
+ }) : null);
67
+ }
68
+ return (children === null || children === void 0 ? void 0 : children.length) > 0 ? children.map(function (_id) {
69
+ return render(childrenMap[_id]);
70
+ }) : null;
71
+ });
72
+ return useCreation(function () {
73
+ return render(data);
74
+ }, deps || [data]);
75
+ }
@@ -1,15 +1,17 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import { useRef, useCallback } from 'react';
3
- import { useSafeState, useDeepCompareEffect } from 'ahooks';
3
+ import { useResetState, useDeepCompareEffect } from 'ahooks';
4
4
  var usePromiseState = function usePromiseState(initialState) {
5
- var _useSafeState = useSafeState(initialState),
6
- _useSafeState2 = _slicedToArray(_useSafeState, 2),
7
- state = _useSafeState2[0],
8
- setState = _useSafeState2[1];
5
+ var _useResetState = useResetState(initialState),
6
+ _useResetState2 = _slicedToArray(_useResetState, 3),
7
+ state = _useResetState2[0],
8
+ setState = _useResetState2[1],
9
+ resetState = _useResetState2[2];
9
10
  var promiseRef = useRef(null);
10
11
  var setStatePromise = useCallback(function (_state) {
11
12
  return new Promise(function (resolve) {
12
13
  promiseRef.current = resolve;
14
+ console.log('_state', _state);
13
15
  setState(_state);
14
16
  });
15
17
  }, []);
@@ -19,6 +21,6 @@ var usePromiseState = function usePromiseState(initialState) {
19
21
  promiseRef.current = null;
20
22
  }
21
23
  }, [state]);
22
- return [state, setStatePromise];
24
+ return [state, setStatePromise, resetState];
23
25
  };
24
26
  export default usePromiseState;
@@ -0,0 +1,78 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ var _excluded = ["datasetCode"];
6
+ import { useBoolean, useMemoizedFn } from 'ahooks';
7
+ import { message } from 'luck-design/antd';
8
+ import { keys, isNil } from 'lodash';
9
+ import { executeCode } from "./helper";
10
+ import { fetchCallBehavior } from "../../constants/api-url";
11
+ var useTodo = function useTodo() {
12
+ var _useBoolean = useBoolean(),
13
+ _useBoolean2 = _slicedToArray(_useBoolean, 2),
14
+ loading = _useBoolean2[0],
15
+ _useBoolean2$ = _useBoolean2[1],
16
+ setTrue = _useBoolean2$.setTrue,
17
+ setFalse = _useBoolean2$.setFalse;
18
+ var callBehavior = useMemoizedFn(function (_ref, params, data) {
19
+ var moduleCode = _ref.moduleCode,
20
+ datasetCode = _ref.datasetCode,
21
+ behaviorKey = _ref.behaviorKey;
22
+ return fetchCallBehavior(_objectSpread({
23
+ moduleCode: moduleCode,
24
+ datasetCode: datasetCode,
25
+ behaviorKey: behaviorKey
26
+ }, params), data);
27
+ });
28
+ var todo = useMemoizedFn(function (ctx, actionPool) {
29
+ var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30
+ if (isNil(actionPool)) {
31
+ return;
32
+ }
33
+ var dsCode = argsMap.datasetCode,
34
+ args = _objectWithoutProperties(argsMap, _excluded);
35
+ var argsName = keys(args);
36
+ var _args = argsName.map(function (n) {
37
+ return args[n];
38
+ });
39
+ if (actionPool.length > 0) {
40
+ setTrue();
41
+ var tasks = actionPool.map(function (_ref2) {
42
+ var _ref3 = _slicedToArray(_ref2, 2),
43
+ actionKey = _ref3[0],
44
+ info = _ref3[1];
45
+ switch (info.category) {
46
+ case 'custom':
47
+ return Promise.resolve(executeCode.apply(void 0, [ctx, info.code, argsName].concat(_toConsumableArray(_args))));
48
+ case 'page-action':
49
+ {
50
+ var _JSON$parse = JSON.parse(info.code || '{}'),
51
+ moduleCode = _JSON$parse.moduleCode,
52
+ datasetCode = _JSON$parse.datasetCode,
53
+ params = _JSON$parse.params,
54
+ data = _JSON$parse.data;
55
+ var _dscode = datasetCode || dsCode;
56
+ if (!moduleCode || !_dscode) {
57
+ message.warning('接口重要参数(模块编码或数据集编码)丢失');
58
+ return;
59
+ }
60
+ return callBehavior({
61
+ datasetCode: _dscode,
62
+ moduleCode: moduleCode,
63
+ behaviorKey: actionKey
64
+ }, params, data);
65
+ }
66
+ case 'trigger':
67
+ return Promise.resolve();
68
+ default:
69
+ break;
70
+ }
71
+ });
72
+ return Promise.all(tasks).finally(setFalse);
73
+ }
74
+ return Promise.resolve();
75
+ });
76
+ return [todo, callBehavior, loading];
77
+ };
78
+ export default useTodo;
@@ -1,5 +1,6 @@
1
1
  export { default as Painter } from "./painter";
2
2
  export { default as View } from "./view";
3
+ export { default as Preview } from "./preview";
3
4
  // export * as dataProcess from './engine/tools/dataProcess';
4
5
 
5
6
  export default function launcher() {}