@luck-design-biz/luckda 0.0.25-1 → 0.0.25-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 (139) hide show
  1. package/es/locales/zh-CN.js +9 -0
  2. package/es/lowcode/constants/api-url.js +184 -100
  3. package/es/lowcode/constants/index.js +2 -1
  4. package/es/lowcode/engine/meta/box.props.default.json +1 -1
  5. package/es/lowcode/engine/meta/box.props.json +1 -1
  6. package/es/lowcode/engine/meta/button.props.json +1 -1
  7. package/es/lowcode/engine/meta/cardlist.props.json +1 -1
  8. package/es/lowcode/engine/meta/components-list.json +1 -1
  9. package/es/lowcode/engine/meta/dialog.props.json +1 -1
  10. package/es/lowcode/engine/meta/drawer.props.json +1 -1
  11. package/es/lowcode/engine/meta/form.props.default.json +4 -5
  12. package/es/lowcode/engine/meta/form.props.json +33 -30
  13. package/es/lowcode/engine/meta/image.props.json +2 -2
  14. package/es/lowcode/engine/meta/imex.props.json +1 -1
  15. package/es/lowcode/engine/meta/link.props.json +1 -1
  16. package/es/lowcode/engine/meta/section.props.default.json +4 -6
  17. package/es/lowcode/engine/meta/section.props.json +52 -49
  18. package/es/lowcode/engine/meta/text.props.json +2 -2
  19. package/es/lowcode/engine/meta/tree.props.json +2 -2
  20. package/es/lowcode/engine/provider/ContextProvider/index.js +10 -2
  21. package/es/lowcode/engine/provider/RemoteSourceProvider.js +28 -15
  22. package/es/lowcode/engine/tools/helper.js +23 -21
  23. package/es/lowcode/engine/tools/useCanvasRender.js +5 -7
  24. package/es/lowcode/engine/tools/usePromiseState.js +23 -14
  25. package/es/lowcode/painter/Design.js +34 -2
  26. package/es/lowcode/painter/DesignOperator.js +6 -8
  27. package/es/lowcode/painter/DesignToolbar.js +258 -21
  28. package/es/lowcode/painter/Panel.js +8 -9
  29. package/es/lowcode/painter/components/AttrsPanel.js +6 -6
  30. package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
  31. package/es/lowcode/painter/components/ListEditor.js +8 -2
  32. package/es/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
  33. package/es/lowcode/painter/components/field-setting/SettingUI.js +26 -7
  34. package/es/lowcode/painter/components/field-setting/index.js +18 -8
  35. package/es/lowcode/painter/index.js +1 -28
  36. package/es/lowcode/painter/panel-section/ActionsColumnWidth.js +25 -0
  37. package/es/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
  38. package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
  39. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +48 -15
  40. package/es/lowcode/painter/panel-section/FieldsSetting.js +48 -27
  41. package/es/lowcode/painter/panel-section/I18nInput.js +20 -0
  42. package/es/lowcode/painter/style/design.less +6 -2
  43. package/es/lowcode/painter/style/list-editor.less +36 -0
  44. package/es/lowcode/preview/index.js +17 -4
  45. package/es/lowcode/view/lc-components/Box/meta.json +1 -1
  46. package/es/lowcode/view/lc-components/Button/meta.json +1 -1
  47. package/es/lowcode/view/lc-components/CardList/meta.json +1 -1
  48. package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
  49. package/es/lowcode/view/lc-components/Dialog/meta.json +1 -1
  50. package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
  51. package/es/lowcode/view/lc-components/Form/FunctionDesign.js +66 -4
  52. package/es/lowcode/view/lc-components/Form/index.js +232 -61
  53. package/es/lowcode/view/lc-components/Form/meta.json +33 -30
  54. package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
  55. package/es/lowcode/view/lc-components/Image/meta.json +2 -2
  56. package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -7
  57. package/es/lowcode/view/lc-components/Link/meta.json +1 -1
  58. package/es/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
  59. package/es/lowcode/view/lc-components/Section/index.js +114 -24
  60. package/es/lowcode/view/lc-components/Section/index.less +7 -0
  61. package/es/lowcode/view/lc-components/Section/meta.json +48 -49
  62. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +4 -6
  63. package/es/lowcode/view/lc-components/Split/index.js +4 -4
  64. package/es/lowcode/view/lc-components/Table/index.js +7 -6
  65. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +2 -4
  66. package/es/lowcode/view/lc-components/Text/meta.json +2 -2
  67. package/es/lowcode/view/lc-components/Tree/meta.json +2 -2
  68. package/es/upload/Form/gridForm.js +7 -3
  69. package/lib/locales/zh-CN.js +9 -0
  70. package/lib/lowcode/constants/api-url.js +183 -100
  71. package/lib/lowcode/constants/index.js +3 -2
  72. package/lib/lowcode/engine/meta/box.props.default.json +1 -1
  73. package/lib/lowcode/engine/meta/box.props.json +1 -1
  74. package/lib/lowcode/engine/meta/button.props.json +1 -1
  75. package/lib/lowcode/engine/meta/cardlist.props.json +1 -1
  76. package/lib/lowcode/engine/meta/components-list.json +1 -1
  77. package/lib/lowcode/engine/meta/dialog.props.json +1 -1
  78. package/lib/lowcode/engine/meta/drawer.props.json +1 -1
  79. package/lib/lowcode/engine/meta/form.props.default.json +4 -5
  80. package/lib/lowcode/engine/meta/form.props.json +33 -30
  81. package/lib/lowcode/engine/meta/image.props.json +2 -2
  82. package/lib/lowcode/engine/meta/imex.props.json +1 -1
  83. package/lib/lowcode/engine/meta/link.props.json +1 -1
  84. package/lib/lowcode/engine/meta/section.props.default.json +4 -6
  85. package/lib/lowcode/engine/meta/section.props.json +52 -49
  86. package/lib/lowcode/engine/meta/text.props.json +2 -2
  87. package/lib/lowcode/engine/meta/tree.props.json +2 -2
  88. package/lib/lowcode/engine/provider/ContextProvider/index.js +10 -2
  89. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +24 -11
  90. package/lib/lowcode/engine/tools/helper.js +23 -21
  91. package/lib/lowcode/engine/tools/useCanvasRender.js +3 -5
  92. package/lib/lowcode/engine/tools/usePromiseState.js +22 -14
  93. package/lib/lowcode/painter/Design.js +32 -0
  94. package/lib/lowcode/painter/DesignOperator.js +5 -7
  95. package/lib/lowcode/painter/DesignToolbar.js +256 -19
  96. package/lib/lowcode/painter/Panel.js +7 -8
  97. package/lib/lowcode/painter/components/AttrsPanel.js +6 -6
  98. package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
  99. package/lib/lowcode/painter/components/ListEditor.js +8 -2
  100. package/lib/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
  101. package/lib/lowcode/painter/components/field-setting/SettingUI.js +26 -7
  102. package/lib/lowcode/painter/components/field-setting/index.js +18 -8
  103. package/lib/lowcode/painter/index.js +1 -30
  104. package/lib/lowcode/painter/panel-section/ActionsColumnWidth.js +32 -0
  105. package/lib/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
  106. package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
  107. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +47 -13
  108. package/lib/lowcode/painter/panel-section/FieldsSetting.js +46 -25
  109. package/lib/lowcode/painter/panel-section/I18nInput.js +27 -0
  110. package/lib/lowcode/painter/style/design.less +6 -2
  111. package/lib/lowcode/painter/style/list-editor.less +36 -0
  112. package/lib/lowcode/preview/index.js +18 -4
  113. package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
  114. package/lib/lowcode/view/lc-components/Button/meta.json +1 -1
  115. package/lib/lowcode/view/lc-components/CardList/meta.json +1 -1
  116. package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
  117. package/lib/lowcode/view/lc-components/Dialog/meta.json +1 -1
  118. package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
  119. package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +64 -2
  120. package/lib/lowcode/view/lc-components/Form/index.js +230 -59
  121. package/lib/lowcode/view/lc-components/Form/meta.json +33 -30
  122. package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
  123. package/lib/lowcode/view/lc-components/Image/meta.json +2 -2
  124. package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +5 -6
  125. package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
  126. package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
  127. package/lib/lowcode/view/lc-components/Section/index.js +113 -23
  128. package/lib/lowcode/view/lc-components/Section/index.less +7 -0
  129. package/lib/lowcode/view/lc-components/Section/meta.json +48 -49
  130. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +5 -7
  131. package/lib/lowcode/view/lc-components/Split/index.js +4 -4
  132. package/lib/lowcode/view/lc-components/Table/index.js +7 -6
  133. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +4 -6
  134. package/lib/lowcode/view/lc-components/Text/meta.json +2 -2
  135. package/lib/lowcode/view/lc-components/Tree/meta.json +2 -2
  136. package/lib/upload/Form/gridForm.js +7 -3
  137. package/package.json +1 -1
  138. package/es/lowcode/painter/services/toolbar.js +0 -25
  139. package/lib/lowcode/painter/services/toolbar.js +0 -32
@@ -99,7 +99,8 @@
99
99
  "info"
100
100
  ],
101
101
  "cols": 4,
102
- "readOnly": false
102
+ "readOnly": false,
103
+ "order": 1
103
104
  }
104
105
  ],
105
106
  "wrapper": "hidden",
@@ -116,7 +117,7 @@
116
117
  "key": "fields",
117
118
  "name": "#字段配置器",
118
119
  "type": "_FieldsSetting",
119
- "component": "table"
120
+ "component": "form"
120
121
  }
121
122
  ]
122
123
  }
@@ -203,7 +204,6 @@
203
204
  "table": {
204
205
  "readOnly": false,
205
206
  "suppressPreset": false,
206
- "width": "100%",
207
207
  "height": "100%",
208
208
  "bordered": false,
209
209
  "popTitleKey": "title",
@@ -215,12 +215,11 @@
215
215
  "uploadForm": {
216
216
  "readOnly": false,
217
217
  "suppressPreset": false,
218
- "width": "100%",
219
- "height": "100%",
218
+ "height": "300px",
220
219
  "bordered": false,
221
220
  "showNote": false,
222
221
  "zipName": "download",
223
- "useResetActions": true
222
+ "useResetActions": false
224
223
  }
225
224
  },
226
225
  "next": {
@@ -317,7 +316,8 @@
317
316
  {
318
317
  "key": "actionsColumnWidth",
319
318
  "name": "列宽",
320
- "type": "_WidthHeight",
319
+ "type": "_ActionsColumnWidth",
320
+ "convertInt": true,
321
321
  "options": [
322
322
  {
323
323
  "label": "px",
@@ -442,7 +442,8 @@
442
442
  {
443
443
  "key": "actionsColumnWidth",
444
444
  "name": "列宽",
445
- "type": "_WidthHeight",
445
+ "type": "_ActionsColumnWidth",
446
+ "convertInt": true,
446
447
  "options": [
447
448
  {
448
449
  "label": "px",
@@ -452,8 +453,8 @@
452
453
  },
453
454
  {
454
455
  "key": "actionsColumnReset",
455
- "name": "重写操列",
456
- "desc": "重写操列",
456
+ "name": "重写操作列",
457
+ "desc": "重写操作列",
457
458
  "type": "_JSEditor",
458
459
  "defaultCode": "function actionsColumnReset(data, index, actions, params) { \n \t \n}",
459
460
  "mustConfirm": true,
@@ -519,21 +520,11 @@
519
520
  "name": "只读",
520
521
  "type": "switch"
521
522
  },
522
- {
523
- "key": "colWidth",
524
- "name": "默认列长度",
525
- "type": "number"
526
- },
527
523
  {
528
524
  "key": "suppressPreset",
529
525
  "name": "关闭预设",
530
526
  "type": "switch"
531
527
  },
532
- {
533
- "key": "width",
534
- "name": "宽度",
535
- "type": "_WidthHeight"
536
- },
537
528
  {
538
529
  "key": "height",
539
530
  "name": "高度",
@@ -569,7 +560,7 @@
569
560
  "key": "resetActions",
570
561
  "name": "自定义操作列",
571
562
  "type": "_JSEditor",
572
- "defaultCode": "function resetActions(data, index, actionList, params) { \n\t\n}",
563
+ "defaultCode": "function resetActions(data, index, actionList, params) { \n return actionList; \n}",
573
564
  "mustConfirm": true,
574
565
  "wrapper": "collapse",
575
566
  "wrapperProps": {
@@ -621,25 +612,37 @@
621
612
  "key": "onMount",
622
613
  "name": "组件首次渲染时",
623
614
  "desc": "在组件首次渲染时,执行方法",
624
- "func": "(params)=>{\n\t\n}"
625
- },
626
- {
627
- "key": "onUnmount",
628
- "name": "组件卸载时",
629
- "desc": "在组件卸载时,执行方法。",
630
- "func": "(params)=>{\n\t\n}"
615
+ "func": "(instance)=>{\n\t\n}"
631
616
  },
632
617
  {
633
618
  "key": "beforeSave",
634
619
  "name": "保存前置事件",
635
620
  "desc": "保存前置事件,promise,返回false取消执行",
636
- "func": "(data, params)=>{\n\t\n}"
621
+ "func": "(values, data) => {\n return values; \n}"
637
622
  },
638
623
  {
639
624
  "key": "onSaveCallback",
640
625
  "name": "保存后回调",
641
626
  "desc": "保存后回调事件",
642
- "func": "(params)=>{\n\t\n}"
627
+ "func": "(success, mainKey, res)=>{\n\t\n}"
628
+ },
629
+ {
630
+ "key": "onUnmount",
631
+ "name": "组件卸载时",
632
+ "desc": "在组件卸载时,执行方法",
633
+ "func": "(instance)=>{\n\t\n}"
634
+ },
635
+ {
636
+ "key": "onValueChange",
637
+ "name": "参数变化的事件",
638
+ "desc": "参数变化时,执行方法",
639
+ "func": "(change, data)=>{\n\t\n}"
640
+ },
641
+ {
642
+ "key": "onChildChange",
643
+ "name": "表单内容发生改变时的回调",
644
+ "desc": "表单内容发生改变时的回调",
645
+ "func": "(instance)=>{\n\t\n}"
643
646
  }
644
647
  ]
645
648
  }
@@ -72,13 +72,13 @@
72
72
  "key": "title",
73
73
  "name": "标题",
74
74
  "desc": "图片html原生title",
75
- "type": "string"
75
+ "type": "_I18nInput"
76
76
  },
77
77
  {
78
78
  "key": "alt",
79
79
  "name": "替代文本",
80
80
  "desc": "图片加载失败的占位文字",
81
- "type": "string"
81
+ "type": "_I18nInput"
82
82
  },
83
83
  {
84
84
  "key": "preview",
@@ -34,7 +34,7 @@
34
34
  "key": "title",
35
35
  "name": "标题",
36
36
  "desc": "按钮上显示的文字",
37
- "type": "string",
37
+ "type": "_I18nInput",
38
38
  "default": "导入|导出"
39
39
  },
40
40
  {
@@ -17,7 +17,7 @@
17
17
  "key": "content",
18
18
  "name": "内容",
19
19
  "desc": "超链接的展示内容",
20
- "type": "string"
20
+ "type": "_I18nInput"
21
21
  },
22
22
  {
23
23
  "key": "textOverflow",
@@ -6,14 +6,12 @@
6
6
  "groupName": "布局",
7
7
  "desc": "分组组件用于将相关组件或内容进行分组和组织。使用户能够轻松创建具有分组效果的界面,并根据需要进行定制。s",
8
8
  "order": 1,
9
- "css": {},
9
+ "css": "width: 100%;",
10
10
  "collapse": true,
11
- "showHeader": true,
11
+ "simple": false,
12
+ "padding": true,
13
+ "destroyInactivePanel": false,
12
14
  "title": "分组",
13
- "showHeaderDivider": true,
14
- "showBorder": false,
15
- "withMargin": false,
16
- "withPadding": true,
17
15
  "advance": {
18
16
  "events": {}
19
17
  }
@@ -8,100 +8,103 @@
8
8
  "order": 1,
9
9
  "props": [
10
10
  {
11
- "key": "fieldId",
11
+ "key": "id",
12
12
  "name": "唯一标识",
13
- "desc": "组件的唯一标识符,不能够与其它组件重名,不能够为空,且只能够使用以字母开头的,下划线以及数字的组合",
14
13
  "type": "string",
15
14
  "disabled": true
16
15
  },
17
16
  {
18
17
  "key": "collapse",
19
18
  "name": "折叠",
20
- "desc": "是否采用折叠分组",
21
- "type": "boolean",
19
+ "type": "switch",
22
20
  "default": true
23
21
  },
24
22
  {
25
- "key": "showHeader",
26
- "name": "显示头部",
27
- "desc": "表示是否分组显示头部(仅在非折叠情况下有效)",
28
- "type": "boolean",
29
- "default": true
23
+ "key": "simple",
24
+ "name": "简洁风格",
25
+ "type": "switch",
26
+ "default": false
27
+ },
28
+ {
29
+ "key": "padding",
30
+ "name": "内边距",
31
+ "type": "switch",
32
+ "default": true,
33
+ "repositioning": true
34
+ },
35
+ {
36
+ "key": "destroyInactivePanel",
37
+ "name": "隐藏销毁",
38
+ "desc": "面板被折叠隐藏时销毁面板中的组件",
39
+ "type": "switch",
40
+ "default": false
30
41
  },
31
42
  {
32
43
  "key": "title",
33
44
  "name": "分组标题",
34
- "desc": "表示分组标题的名称",
35
- "type": "string",
45
+ "type": "_I18nInput",
36
46
  "default": "分组"
37
47
  },
38
48
  {
39
- "key": "icon",
49
+ "key": "iconFont",
40
50
  "name": "图标",
41
- "desc": "用于设置分组标题前面的图标",
42
- "type": "Icon"
51
+ "type": "_Icon",
52
+ "next": {
53
+ "name": "选择图标",
54
+ "autoClose": true,
55
+ "props": [
56
+ {
57
+ "key": "iconFont",
58
+ "name": "#图标选择器",
59
+ "type": "_IconSelector"
60
+ }
61
+ ]
62
+ }
43
63
  },
44
64
  {
45
65
  "key": "tooltip",
46
66
  "name": "用户提示",
47
- "desc": "用于设置分组的用户提示",
48
- "type": "string"
67
+ "type": "_I18nInput"
49
68
  },
50
69
  {
51
70
  "key": "subtitle",
52
71
  "name": "副标题插槽",
53
72
  "desc": "分组副标题的插槽内容",
54
- "type": "string"
73
+ "type": "_JSEditor",
74
+ "defaultCode": "function Component() { \n return <span>subtitle</span>; \n}",
75
+ "mustConfirm": true,
76
+ "wrapper": "collapse",
77
+ "wrapperProps": {
78
+ "suppressIcon": true
79
+ }
55
80
  },
56
81
  {
57
82
  "key": "extra",
58
83
  "name": "扩展区域插槽",
59
84
  "desc": "分组扩展区域的插槽内容",
60
- "type": "string"
61
- },
62
- {
63
- "key": "showHeaderDivider",
64
- "name": "头部分割线",
65
- "desc": "是否展示头部分割线(仅在非折叠情况下有效)",
66
- "type": "boolean",
67
- "default": true
68
- },
69
- {
70
- "key": "showBorder",
71
- "name": "显示边框",
72
- "desc": "是否展示分组边框(仅在非折叠情况下有效)",
73
- "type": "boolean",
74
- "default": false
75
- },
76
- {
77
- "key": "withMargin",
78
- "name": "外边距",
79
- "desc": "是否展示外边距",
80
- "type": "boolean",
81
- "default": false
82
- },
83
- {
84
- "key": "withPadding",
85
- "name": "内边距",
86
- "desc": "是否展示内边距",
87
- "type": "boolean",
88
- "default": true
85
+ "type": "_JSEditor",
86
+ "defaultCode": "function Component() { \n return <div>extra</div>; \n}",
87
+ "mustConfirm": true,
88
+ "wrapper": "collapse",
89
+ "wrapperProps": {
90
+ "suppressIcon": true
91
+ }
89
92
  }
90
93
  ],
91
- "css": {},
94
+ "css": "width: 100%;",
92
95
  "advance": {
93
96
  "events": [
94
97
  {
95
98
  "key": "onMount",
96
99
  "name": "组件首次渲染时",
97
100
  "desc": "在组件首次渲染时,执行方法",
98
- "func": "(params)=>{\n\t\n}"
101
+ "func": "(instance)=>{\n\t\n}"
99
102
  },
100
103
  {
101
104
  "key": "onUnmount",
102
105
  "name": "组件卸载时",
103
106
  "desc": "在组件卸载时,执行方法。",
104
- "func": "(params)=>{\n\t\n}"
107
+ "func": "(instance)=>{\n\t\n}"
105
108
  }
106
109
  ]
107
110
  }
@@ -17,7 +17,7 @@
17
17
  "key": "content",
18
18
  "name": "内容",
19
19
  "desc": "文本内容设置",
20
- "type": "string"
20
+ "type": "_I18nInput"
21
21
  },
22
22
  {
23
23
  "key": "showTitle",
@@ -30,7 +30,7 @@
30
30
  "key": "title",
31
31
  "name": "自定义标题",
32
32
  "desc": "显示标题时配置。自定义标题内容",
33
- "type": "string"
33
+ "type": "_I18nInput"
34
34
  },
35
35
  {
36
36
  "key": "maxLine",
@@ -23,7 +23,7 @@
23
23
  "key": "title",
24
24
  "name": "标题",
25
25
  "desc": "头部标题",
26
- "type": "string"
26
+ "type": "_I18nInput"
27
27
  },
28
28
  {
29
29
  "key": "readOnly",
@@ -81,7 +81,7 @@
81
81
  "key": "treeNodeTitle",
82
82
  "name": "展示字段",
83
83
  "desc": "展示字段的key",
84
- "type": "string",
84
+ "type": "_I18nInput",
85
85
  "default": "sname"
86
86
  },
87
87
  {
@@ -17,7 +17,11 @@ export var usePageData = function usePageData(_) {
17
17
  var _useReactContext = useReactContext(RemoteSourceContext),
18
18
  pageData = _useReactContext.pageData,
19
19
  loading = _useReactContext.loading,
20
- setPageData = _useReactContext.setPageData;
20
+ setPageData = _useReactContext.setPageData,
21
+ back = _useReactContext.back,
22
+ forward = _useReactContext.forward,
23
+ backLength = _useReactContext.backLength,
24
+ forwardLength = _useReactContext.forwardLength;
21
25
  var _pageData;
22
26
  if (isNil(_)) {
23
27
  _pageData = pageData;
@@ -36,7 +40,11 @@ export var usePageData = function usePageData(_) {
36
40
  }
37
41
  return [_pageData, {
38
42
  loading: loading,
39
- setPageData: setPageData
43
+ setPageData: setPageData,
44
+ back: back,
45
+ forward: forward,
46
+ backLength: backLength,
47
+ forwardLength: forwardLength
40
48
  }];
41
49
  };
42
50
  export var useRemoteSource = function useRemoteSource() {
@@ -2,40 +2,49 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
6
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
7
  var _excluded = ["source"];
7
- import React, { createContext, useEffect } from 'react';
8
- import { useRequest, useSetState, useAsyncEffect, useCookieState, usePrevious, useMemoizedFn } from 'ahooks';
8
+ import React, { createContext, useRef } from 'react';
9
+ import { useRequest, useSetState, useAsyncEffect, useMemoizedFn, useCookieState, useCreation, useUnmount } from 'ahooks';
9
10
  import { LuckDaContext } from "../../../components/Builder";
10
11
  import { doAction as doActionUtils } from "../../../helper/action";
11
12
  import usePromiseState from "../tools/usePromiseState";
12
13
  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";
14
+ import { fetchPageData, fetchDesignModlueData, fetchPreviewModlueData, fetchModlueData, fetchAllDataset, fetchAllSerials } from "../../constants/api-url";
15
+ import { RUNTIME, COOKIE_RUNTIME_KEY, DATA_MODEL_CODE_KEY } from "../../constants";
15
16
  export var RemoteSourceContext = /*#__PURE__*/createContext(null);
16
17
  export default (function (_ref) {
17
18
  var children = _ref.children,
18
19
  code = _ref.code,
19
20
  runtime = _ref.runtime;
20
21
  var _usePromiseState = usePromiseState(null),
21
- _usePromiseState2 = _slicedToArray(_usePromiseState, 2),
22
+ _usePromiseState2 = _slicedToArray(_usePromiseState, 3),
22
23
  pageData = _usePromiseState2[0],
23
- setPageData = _usePromiseState2[1];
24
+ setPageData = _usePromiseState2[1],
25
+ _usePromiseState2$ = _usePromiseState2[2],
26
+ back = _usePromiseState2$.back,
27
+ forward = _usePromiseState2$.forward,
28
+ backLength = _usePromiseState2$.backLength,
29
+ forwardLength = _usePromiseState2$.forwardLength;
24
30
  var _useSetState = useSetState({}),
25
31
  _useSetState2 = _slicedToArray(_useSetState, 2),
26
32
  remoteSource = _useSetState2[0],
27
33
  setRemoteSource = _useSetState2[1];
28
- var _useCookieState = useCookieState(RUNTIME_COOKIE_KEY),
34
+ var _useCookieState = useCookieState(COOKIE_RUNTIME_KEY),
29
35
  _useCookieState2 = _slicedToArray(_useCookieState, 2),
30
36
  cookieRuntime = _useCookieState2[0],
31
37
  setRuntime = _useCookieState2[1];
32
- var prevRuntime = usePrevious(cookieRuntime);
33
- useEffect(function () {
34
- setRuntime(runtime);
35
- return function () {
36
- return setRuntime(prevRuntime);
37
- };
38
+ var prevRuntime = useRef(cookieRuntime);
39
+ useCreation(function () {
40
+ if (runtime !== cookieRuntime) {
41
+ prevRuntime.current = cookieRuntime;
42
+ setRuntime(runtime);
43
+ }
38
44
  }, []);
45
+ useUnmount(function () {
46
+ setRuntime(prevRuntime.current);
47
+ });
39
48
 
40
49
  // 获取页面数据
41
50
  var _useRequest = useRequest(fetchPageData, {
@@ -44,7 +53,7 @@ export default (function (_ref) {
44
53
  fetchPageDataLoading = _useRequest.loading,
45
54
  runFetchPageData = _useRequest.runAsync;
46
55
  // 获取模块数据
47
- var _useRequest2 = useRequest(runtime === RUNTIME.DESIGN ? fetchDesignModlueData : fetchModlueData, {
56
+ var _useRequest2 = useRequest(_defineProperty(_defineProperty(_defineProperty({}, RUNTIME.DESIGN, fetchDesignModlueData), RUNTIME.PREVIEW, fetchPreviewModlueData), RUNTIME.LIVE, fetchModlueData)[runtime], {
48
57
  manual: true,
49
58
  onSuccess: function onSuccess(_ref2) {
50
59
  var code = _ref2.code,
@@ -151,7 +160,11 @@ export default (function (_ref) {
151
160
  refreshModlueData: refreshModlueData,
152
161
  refreshDataset: refreshDataset,
153
162
  refreshSerials: refreshSerials,
154
- setPageData: setPageData
163
+ setPageData: setPageData,
164
+ back: back,
165
+ forward: forward,
166
+ backLength: backLength,
167
+ forwardLength: forwardLength
155
168
  })
156
169
  }, /*#__PURE__*/React.createElement(LuckDaContext.Provider, {
157
170
  value: _objectSpread(_objectSpread({}, remoteSource.module), {}, {
@@ -13,41 +13,43 @@ export function omitBadProps(props) {
13
13
  }
14
14
  export function listReducer(state, action) {
15
15
  switch (action.type) {
16
- case 'init':
16
+ case 'insert':
17
17
  {
18
18
  var _action$callback;
19
- (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, action.payload);
20
- return action.payload;
19
+ var newState = _toConsumableArray(state);
20
+ newState.splice(action.payload.index + 1, 0, action.payload.data);
21
+ (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, newState);
22
+ return newState;
21
23
  }
22
24
  case 'add':
23
25
  {
24
26
  var _action$callback2;
25
- var newState = [].concat(_toConsumableArray(state), [action.payload]);
26
- (_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, newState);
27
- return newState;
27
+ var _newState = [].concat(_toConsumableArray(state), [action.payload]);
28
+ (_action$callback2 = action.callback) === null || _action$callback2 === void 0 || _action$callback2.call(action, _newState);
29
+ return _newState;
28
30
  }
29
31
  case 'delete':
30
32
  {
31
33
  var _action$callback3;
32
- var _newState = state.filter(function (item) {
34
+ var _newState2 = state.filter(function (item) {
33
35
  return item.id !== action.payload;
34
36
  });
35
- (_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action, _newState);
36
- return _newState;
37
+ (_action$callback3 = action.callback) === null || _action$callback3 === void 0 || _action$callback3.call(action, _newState2);
38
+ return _newState2;
37
39
  }
38
40
  case 'edit':
39
41
  {
40
42
  var _action$callback4;
41
- var _newState2 = state.map(function (item) {
43
+ var _newState3 = state.map(function (item) {
42
44
  return item.id === action.payload.id ? _objectSpread(_objectSpread({}, item), action.payload.data) : item;
43
45
  });
44
- (_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action, _newState2);
45
- return _newState2;
46
+ (_action$callback4 = action.callback) === null || _action$callback4 === void 0 || _action$callback4.call(action, _newState3);
47
+ return _newState3;
46
48
  }
47
49
  case 'batchEdit':
48
50
  {
49
51
  var _action$callback5;
50
- var _newState3 = state.map(function (item) {
52
+ var _newState4 = state.map(function (item) {
51
53
  var newItem = action.payload.items.find(function (_id) {
52
54
  return _id === item.id;
53
55
  });
@@ -56,25 +58,25 @@ export function listReducer(state, action) {
56
58
  }
57
59
  return item;
58
60
  });
59
- (_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action, _newState3);
60
- return _newState3;
61
+ (_action$callback5 = action.callback) === null || _action$callback5 === void 0 || _action$callback5.call(action, _newState4);
62
+ return _newState4;
61
63
  }
62
64
  case 'active':
63
65
  {
64
66
  var _action$callback6;
65
- var _newState4 = state.map(function (item) {
67
+ var _newState5 = state.map(function (item) {
66
68
  item.active = false;
67
69
  return item.id === action.payload.id ? _objectSpread(_objectSpread({}, item), action.payload.data) : item;
68
70
  });
69
- (_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action, _newState4);
70
- return _newState4;
71
+ (_action$callback6 = action.callback) === null || _action$callback6 === void 0 || _action$callback6.call(action, _newState5);
72
+ return _newState5;
71
73
  }
74
+ case 'init':
72
75
  case 'new':
73
76
  {
74
77
  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;
78
+ (_action$callback7 = action.callback) === null || _action$callback7 === void 0 || _action$callback7.call(action, action.payload);
79
+ return action.payload;
78
80
  }
79
81
  case 'sort':
80
82
  {
@@ -2,19 +2,17 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
5
  var _excluded = ["props", "children"],
7
6
  _excluded2 = ["id", "component", "name", "desc", "icon", "group", "groupName", "order"];
8
7
  import React, { useRef } from 'react';
9
8
  import { dynamic } from 'umi';
10
- import { useMemoizedFn, useCookieState, useCreation } from 'ahooks';
9
+ import { useMemoizedFn, useCreation } from 'ahooks';
11
10
  import { upperFirst } from 'lodash';
12
- import { LC_BUILDIN_UNIT_KEY_LIST, RUNTIME_COOKIE_KEY } from "../../constants";
11
+ import { useContext } from "../provider/ContextProvider";
12
+ import { LC_BUILDIN_UNIT_KEY_LIST } from "../../constants";
13
13
  export default function useCanvasRender(data, deps) {
14
14
  var dynamicCompMap = useRef({});
15
- var _useCookieState = useCookieState(RUNTIME_COOKIE_KEY),
16
- _useCookieState2 = _slicedToArray(_useCookieState, 1),
17
- runtime = _useCookieState2[0];
15
+ var ctx = useContext();
18
16
  var render = useMemoizedFn(function (_ref) {
19
17
  var props = _ref.props,
20
18
  children = _ref.children,
@@ -37,7 +35,7 @@ export default function useCanvasRender(data, deps) {
37
35
  return _regeneratorRuntime().wrap(function _callee$(_context) {
38
36
  while (1) switch (_context.prev = _context.next) {
39
37
  case 0:
40
- _runtime = upperFirst(runtime);
38
+ _runtime = upperFirst(ctx.runtime);
41
39
  _context.next = 3;
42
40
  return import("../../view/lc-components/".concat(component, "/Function").concat(_runtime));
43
41
  case 3: