@luck-design-biz/luckda 0.0.25-7 → 0.0.25-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/es/components/LDActions/index.js +8 -10
  2. package/es/components/LDActions/index.less +7 -4
  3. package/es/components/LdAutoForm/index.js +8 -6
  4. package/es/components/LdFormList/index.js +12 -4
  5. package/es/components/LdGrid/index.js +11 -5
  6. package/es/components/LdGridForm/index.js +4 -2
  7. package/es/components/LdTree/index.js +30 -13
  8. package/es/helper/form.js +9 -5
  9. package/es/locales/zh-CN.js +15 -10
  10. package/es/lowcode/constants/api-url.js +112 -26
  11. package/es/lowcode/constants/event-topics.js +2 -0
  12. package/es/lowcode/engine/meta/box.props.json +3 -3
  13. package/es/lowcode/engine/meta/button.props.json +3 -3
  14. package/es/lowcode/engine/meta/components-list.json +6 -0
  15. package/es/lowcode/engine/meta/dialog.props.json +5 -5
  16. package/es/lowcode/engine/meta/drawer.props.json +8 -20
  17. package/es/lowcode/engine/meta/form.props.json +13 -7
  18. package/es/lowcode/engine/meta/imex.props.default.json +8 -1
  19. package/es/lowcode/engine/meta/imex.props.json +54 -22
  20. package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  21. package/es/lowcode/engine/meta/layout.props.json +2 -2
  22. package/es/lowcode/engine/meta/page.props.json +2 -2
  23. package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  24. package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
  25. package/es/lowcode/engine/meta/section.props.json +2 -2
  26. package/es/lowcode/engine/meta/split.props.default.json +1 -1
  27. package/es/lowcode/engine/meta/split.props.json +4 -4
  28. package/es/lowcode/engine/meta/table.props.json +15 -9
  29. package/es/lowcode/engine/meta/tabs.props.json +3 -3
  30. package/es/lowcode/engine/meta/tree.props.default.json +1 -0
  31. package/es/lowcode/engine/meta/tree.props.json +55 -6
  32. package/es/lowcode/engine/provider/ContextProvider/index.js +12 -3
  33. package/es/lowcode/engine/provider/RemoteSourceProvider.js +55 -6
  34. package/es/lowcode/engine/tools/dataProcess.js +4 -0
  35. package/es/lowcode/engine/tools/usePageDataStore.js +4 -2
  36. package/es/lowcode/painter/DesignOperator.js +1 -1
  37. package/es/lowcode/painter/DesignToolbar.js +2 -1
  38. package/es/lowcode/painter/Panel.js +3 -3
  39. package/es/lowcode/painter/components/ActionBindModal.js +25 -13
  40. package/es/lowcode/painter/components/AdvancePanel.js +6 -1
  41. package/es/lowcode/painter/components/AttrsPanel.js +13 -11
  42. package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
  43. package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  44. package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
  45. package/es/lowcode/painter/components/field-setting/SettingUI.js +156 -24
  46. package/es/lowcode/painter/components/field-setting/index.js +32 -63
  47. package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
  48. package/es/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
  49. package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -12
  50. package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
  51. package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
  52. package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
  53. package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
  54. package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  55. package/es/lowcode/painter/style/action-bind-modal.less +3 -3
  56. package/es/lowcode/painter/style/page-layout-display.less +28 -0
  57. package/es/lowcode/painter/style/split-display.less +0 -9
  58. package/es/lowcode/preview/index.js +4 -2
  59. package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  60. package/es/lowcode/view/lc-components/Box/meta.json +3 -3
  61. package/es/lowcode/view/lc-components/Button/index.js +2 -6
  62. package/es/lowcode/view/lc-components/Button/meta.json +3 -3
  63. package/es/lowcode/view/lc-components/Dialog/index.js +27 -2
  64. package/es/lowcode/view/lc-components/Dialog/meta.json +5 -5
  65. package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
  66. package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  67. package/es/lowcode/view/lc-components/Form/index.js +99 -21
  68. package/es/lowcode/view/lc-components/Form/meta.json +13 -7
  69. package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  70. package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
  71. package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
  72. package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
  73. package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
  74. package/es/lowcode/view/lc-components/Page/meta.json +2 -2
  75. package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
  76. package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
  77. package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
  78. package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
  79. package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  80. package/es/lowcode/view/lc-components/Section/meta.json +2 -2
  81. package/es/lowcode/view/lc-components/Split/FunctionDesign.js +11 -5
  82. package/es/lowcode/view/lc-components/Split/index.js +5 -9
  83. package/es/lowcode/view/lc-components/Split/meta.json +4 -4
  84. package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
  85. package/es/lowcode/view/lc-components/Table/index.js +60 -17
  86. package/es/lowcode/view/lc-components/Table/meta.json +15 -9
  87. package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +1 -0
  88. package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
  89. package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
  90. package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  91. package/es/lowcode/view/lc-components/Tree/index.js +60 -18
  92. package/es/lowcode/view/lc-components/Tree/meta.json +55 -7
  93. package/es/upload/FormItem/index.js +1 -4
  94. package/lib/components/LDActions/index.js +7 -9
  95. package/lib/components/LDActions/index.less +7 -4
  96. package/lib/components/LdAutoForm/index.js +7 -5
  97. package/lib/components/LdFormList/index.js +11 -3
  98. package/lib/components/LdGrid/index.js +11 -5
  99. package/lib/components/LdGridForm/index.js +4 -2
  100. package/lib/components/LdTree/index.js +30 -13
  101. package/lib/helper/form.js +8 -4
  102. package/lib/locales/zh-CN.js +15 -10
  103. package/lib/lowcode/constants/api-url.js +113 -26
  104. package/lib/lowcode/constants/event-topics.js +3 -1
  105. package/lib/lowcode/engine/meta/box.props.json +3 -3
  106. package/lib/lowcode/engine/meta/button.props.json +3 -3
  107. package/lib/lowcode/engine/meta/components-list.json +6 -0
  108. package/lib/lowcode/engine/meta/dialog.props.json +5 -5
  109. package/lib/lowcode/engine/meta/drawer.props.json +8 -20
  110. package/lib/lowcode/engine/meta/form.props.json +13 -7
  111. package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
  112. package/lib/lowcode/engine/meta/imex.props.json +54 -22
  113. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
  114. package/lib/lowcode/engine/meta/layout.props.json +2 -2
  115. package/lib/lowcode/engine/meta/page.props.json +2 -2
  116. package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
  117. package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
  118. package/lib/lowcode/engine/meta/section.props.json +2 -2
  119. package/lib/lowcode/engine/meta/split.props.default.json +1 -1
  120. package/lib/lowcode/engine/meta/split.props.json +4 -4
  121. package/lib/lowcode/engine/meta/table.props.json +15 -9
  122. package/lib/lowcode/engine/meta/tabs.props.json +3 -3
  123. package/lib/lowcode/engine/meta/tree.props.default.json +1 -0
  124. package/lib/lowcode/engine/meta/tree.props.json +55 -6
  125. package/lib/lowcode/engine/provider/ContextProvider/index.js +11 -2
  126. package/lib/lowcode/engine/provider/RemoteSourceProvider.js +54 -5
  127. package/lib/lowcode/engine/tools/dataProcess.js +4 -0
  128. package/lib/lowcode/engine/tools/usePageDataStore.js +4 -2
  129. package/lib/lowcode/painter/DesignOperator.js +1 -1
  130. package/lib/lowcode/painter/DesignToolbar.js +2 -1
  131. package/lib/lowcode/painter/Panel.js +3 -3
  132. package/lib/lowcode/painter/components/ActionBindModal.js +23 -11
  133. package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
  134. package/lib/lowcode/painter/components/AttrsPanel.js +12 -10
  135. package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
  136. package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
  137. package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
  138. package/lib/lowcode/painter/components/field-setting/SettingUI.js +153 -21
  139. package/lib/lowcode/painter/components/field-setting/index.js +32 -63
  140. package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
  141. package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
  142. package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -12
  143. package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
  144. package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
  145. package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
  146. package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
  147. package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
  148. package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
  149. package/lib/lowcode/painter/style/page-layout-display.less +28 -0
  150. package/lib/lowcode/painter/style/split-display.less +0 -9
  151. package/lib/lowcode/preview/index.js +4 -2
  152. package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
  153. package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
  154. package/lib/lowcode/view/lc-components/Button/index.js +2 -6
  155. package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
  156. package/lib/lowcode/view/lc-components/Dialog/index.js +29 -4
  157. package/lib/lowcode/view/lc-components/Dialog/meta.json +5 -5
  158. package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
  159. package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
  160. package/lib/lowcode/view/lc-components/Form/index.js +96 -18
  161. package/lib/lowcode/view/lc-components/Form/meta.json +13 -7
  162. package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
  163. package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
  164. package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
  165. package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
  166. package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
  167. package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
  168. package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
  169. package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
  170. package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
  171. package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
  172. package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
  173. package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
  174. package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +12 -6
  175. package/lib/lowcode/view/lc-components/Split/index.js +2 -6
  176. package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
  177. package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
  178. package/lib/lowcode/view/lc-components/Table/index.js +59 -16
  179. package/lib/lowcode/view/lc-components/Table/meta.json +15 -9
  180. package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +3 -2
  181. package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
  182. package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
  183. package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
  184. package/lib/lowcode/view/lc-components/Tree/index.js +58 -16
  185. package/lib/lowcode/view/lc-components/Tree/meta.json +55 -7
  186. package/lib/upload/FormItem/index.js +1 -4
  187. package/package.json +2 -2
@@ -13,15 +13,16 @@ var _ahooks = require("ahooks");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _index = _interopRequireDefault(require("./index"));
15
15
  var _index2 = _interopRequireDefault(require("./index.less"));
16
- var _excluded = ["children"];
16
+ var _excluded = ["children", "className"];
17
17
  var FunctionDesign = function FunctionDesign(_ref) {
18
18
  var children = _ref.children,
19
+ className = _ref.className,
19
20
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
20
21
  var isEmpty = (0, _ahooks.useCreation)(function () {
21
22
  return !children || _react.default.Children.count(children) === 0;
22
23
  }, [children]);
23
24
  return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({
24
- className: (0, _classnames.default)(_index2.default['lc-component-box-design'], (0, _defineProperty2.default)({}, _index2.default.placeholder, isEmpty))
25
+ className: (0, _classnames.default)(_index2.default['lc-component-box-design'], (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _index2.default.placeholder, isEmpty), "className", !!className))
25
26
  }, props), isEmpty ? '点击组件库的组件或拖拽组件到这里' : children);
26
27
  };
27
28
  var _default = exports.default = FunctionDesign;
@@ -21,19 +21,19 @@
21
21
  "key": "onMount",
22
22
  "name": "组件首次渲染时",
23
23
  "desc": "在组件首次渲染时,执行方法",
24
- "func": "(params)=>{\n\t\n}"
24
+ "func": "function onMount(params) {\n\t\n}"
25
25
  },
26
26
  {
27
27
  "key": "onUnmount",
28
28
  "name": "组件卸载时",
29
29
  "desc": "在组件卸载时,执行方法。",
30
- "func": "(params)=>{\n\t\n}"
30
+ "func": "function onUnmount(params) {\n\t\n}"
31
31
  },
32
32
  {
33
33
  "key": "onClick",
34
34
  "name": "点击事件",
35
35
  "desc": "点击文本时,执行方法",
36
- "func": "(e)=>{\n\t\n}"
36
+ "func": "function onClick(e) {\n\t\n}"
37
37
  }
38
38
  ]
39
39
  }
@@ -41,14 +41,10 @@ var LCButton = function LCButton(_ref) {
41
41
  var ref = (0, _react.useRef)();
42
42
  var ctx = (0, _ContextProvider.useContext)();
43
43
  (0, _ahooks.useMount)(function () {
44
- ctx.doAction(advance.events.onMount, {
45
- instance: ref.current
46
- });
44
+ ctx.doAction(advance.events.onMount);
47
45
  });
48
46
  (0, _ahooks.useUnmount)(function () {
49
- ctx.doAction(advance.events.onUnmount, {
50
- instance: ref.current
51
- });
47
+ ctx.doAction(advance.events.onUnmount);
52
48
  });
53
49
  var handleClick = (0, _ahooks.useMemoizedFn)(function (e) {
54
50
  if (onClick) {
@@ -108,19 +108,19 @@
108
108
  "key": "onMount",
109
109
  "name": "组件首次渲染时",
110
110
  "desc": "在组件首次渲染时,执行方法",
111
- "func": "(instance)=>{\n\t\n}"
111
+ "func": "function onMount() {\n\t\n}"
112
112
  },
113
113
  {
114
114
  "key": "onUnmount",
115
115
  "name": "组件卸载时",
116
116
  "desc": "在组件卸载时,执行方法。",
117
- "func": "(instance)=>{\n\t\n}"
117
+ "func": "function onUnmount() {\n\t\n}"
118
118
  },
119
119
  {
120
120
  "key": "onClick",
121
121
  "name": "点击事件",
122
122
  "desc": "点击文本时,执行方法",
123
- "func": "(e)=>{\n\t\n}"
123
+ "func": "function onClick(e) {\n\t\n}"
124
124
  }
125
125
  ]
126
126
  }
@@ -16,7 +16,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
16
16
  var _styledComponents = _interopRequireDefault(require("styled-components"));
17
17
  var _index = require("../../../../index");
18
18
  var _ContextProvider = require("../../../engine/provider/ContextProvider");
19
- var _usePromiseState3 = _interopRequireDefault(require("../../../engine/tools/usePromiseState"));
19
+ var _usePromiseState5 = _interopRequireDefault(require("../../../engine/tools/usePromiseState"));
20
20
  var _Wrapper = _interopRequireDefault(require("../Wrapper"));
21
21
  var _index2 = _interopRequireDefault(require("./index.less"));
22
22
  var Footer = _styledComponents.default.div.withConfig({
@@ -42,14 +42,19 @@ var LCDialog = function LCDialog(_ref) {
42
42
  var ctx = (0, _ContextProvider.useContext)();
43
43
  var apiRef = (0, _react.useRef)();
44
44
  var domRef = (0, _react.useRef)();
45
- var _usePromiseState = (0, _usePromiseState3.default)(defaultOpen),
45
+ var _usePromiseState = (0, _usePromiseState5.default)(defaultOpen),
46
46
  _usePromiseState2 = (0, _slicedToArray2.default)(_usePromiseState, 2),
47
47
  open = _usePromiseState2[0],
48
48
  setOpen = _usePromiseState2[1];
49
+ var _usePromiseState3 = (0, _usePromiseState5.default)(title),
50
+ _usePromiseState4 = (0, _slicedToArray2.default)(_usePromiseState3, 2),
51
+ _title = _usePromiseState4[0],
52
+ _setTitle = _usePromiseState4[1];
49
53
  (0, _react.useEffect)(function () {
50
54
  ctx.doAction(advance.events.onMount);
51
55
  return function () {
52
- return ctx.doAction(advance.events.onUnmount);
56
+ _setTitle(title);
57
+ ctx.doAction(advance.events.onUnmount);
53
58
  };
54
59
  }, []);
55
60
  (0, _ahooks.useUpdateEffect)(function () {
@@ -92,12 +97,32 @@ var LCDialog = function LCDialog(_ref) {
92
97
  });
93
98
  (0, _react.useImperativeHandle)(apiRef, function () {
94
99
  return {
100
+ /**
101
+ * 弹窗打开状态
102
+ * @property
103
+ */
95
104
  open: open,
105
+ /**
106
+ * 打开弹窗
107
+ * @method
108
+ */
96
109
  doOpen: function doOpen() {
97
110
  return setOpen(true);
98
111
  },
112
+ /**
113
+ * 关闭弹窗
114
+ * @method
115
+ */
99
116
  doClose: function doClose() {
100
117
  return setOpen(false);
118
+ },
119
+ /**
120
+ * 设置弹窗标题
121
+ * @method
122
+ * @param {stirng} title -标题
123
+ */
124
+ setTitle: function setTitle(_title) {
125
+ return _setTitle(_title);
101
126
  }
102
127
  };
103
128
  }, []);
@@ -107,7 +132,7 @@ var LCDialog = function LCDialog(_ref) {
107
132
  getTargetDom: getTargetDom,
108
133
  api: apiRef
109
134
  }, /*#__PURE__*/_react.default.createElement(_antd.Modal, (0, _extends2.default)({
110
- title: title,
135
+ title: _title,
111
136
  visible: open,
112
137
  getContainer: getContainer,
113
138
  width: width,
@@ -112,31 +112,31 @@
112
112
  "key": "onMount",
113
113
  "name": "组件首次渲染时",
114
114
  "desc": "在组件首次渲染时,执行方法",
115
- "func": "()=>{\n\t\n}"
115
+ "func": "function onMount() {\n\t\n}"
116
116
  },
117
117
  {
118
118
  "key": "onUnmount",
119
119
  "name": "组件卸载时",
120
120
  "desc": "在组件卸载时,执行方法。",
121
- "func": "()=>{\n\t\n}"
121
+ "func": "function onUnmount() {\n\t\n}"
122
122
  },
123
123
  {
124
124
  "key": "onOpen",
125
125
  "name": "对话框打开时",
126
126
  "desc": "在对话框打开时,执行方法",
127
- "func": "()=>{\n\t\n}"
127
+ "func": "function onOpen() {\n\t\n}"
128
128
  },
129
129
  {
130
130
  "key": "onClose",
131
131
  "name": "对话框关闭时",
132
132
  "desc": "在对话框打开时,执行方法,promise反馈false无法截断关闭",
133
- "func": "()=>{\n\t\n}"
133
+ "func": "function onClose() {\n\t\n}"
134
134
  },
135
135
  {
136
136
  "key": "onOk",
137
137
  "name": "确定按钮点击",
138
138
  "desc": "点击确定按钮时,执行方法",
139
- "func": "()=>{\n\t\n}"
139
+ "func": "function onOk() {\n\t\n}"
140
140
  }
141
141
  ]
142
142
  }
@@ -100,43 +100,31 @@
100
100
  "key": "onMount",
101
101
  "name": "组件首次渲染时",
102
102
  "desc": "在组件首次渲染时,执行方法",
103
- "func": "(params)=>{\n\t\n}"
103
+ "func": "function onMount() {\n\t\n}"
104
104
  },
105
105
  {
106
106
  "key": "onUnmount",
107
107
  "name": "组件卸载时",
108
108
  "desc": "在组件卸载时,执行方法。",
109
- "func": "(params)=>{\n\t\n}"
110
- },
111
- {
112
- "key": "onMount",
113
- "name": "组件首次渲染时",
114
- "desc": "在组件首次渲染时,执行方法",
115
- "func": "(params)=>{\n\t\n}"
116
- },
117
- {
118
- "key": "onUnmount",
119
- "name": "组件卸载时",
120
- "desc": "在组件卸载时,执行方法。",
121
- "func": "(params)=>{\n\t\n}"
109
+ "func": "function onUnmount() {\n\t\n}"
122
110
  },
123
111
  {
124
112
  "key": "onOpen",
125
113
  "name": "抽屉打开时",
126
114
  "desc": "在抽屉打开时,执行方法",
127
- "func": "(params)=>{\n\t\n}"
115
+ "func": "function onOpen() {\n\t\n}"
128
116
  },
129
117
  {
130
118
  "key": "onClose",
131
119
  "name": "抽屉关闭时",
132
120
  "desc": "在抽屉打开时,执行方法,promise反馈false无法截断关闭",
133
- "func": "(params)=>{\n\t\n}"
121
+ "func": "function onClose() {\n\t\n}"
134
122
  },
135
123
  {
136
- "key": "onButtonClick",
137
- "name": "按钮组点击",
138
- "desc": "点击按钮组某个按钮时,执行方法",
139
- "func": "(buttonKey,params)=>{\n\t\n}"
124
+ "key": "onOk",
125
+ "name": "确定按钮点击",
126
+ "desc": "点击确定按钮时,执行方法",
127
+ "func": "function onOk() {\n\t\n}"
140
128
  }
141
129
  ]
142
130
  }
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
11
  var _react = _interopRequireDefault(require("react"));
10
12
  var _index = _interopRequireDefault(require("./index"));
@@ -12,6 +14,11 @@ var _excluded = ["children"];
12
14
  var FunctionPreview = function FunctionPreview(_ref) {
13
15
  var children = _ref.children,
14
16
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
15
- return /*#__PURE__*/_react.default.createElement(_index.default, props, children);
17
+ return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, props, {
18
+ initData: {
19
+ formMode: 'update',
20
+ ticketData: (0, _defineProperty2.default)({}, window.appConfig.constraintKeys.PRIMARY, 'test')
21
+ }
22
+ }), children);
16
23
  };
17
24
  var _default = exports.default = FunctionPreview;
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _ahooks = require("ahooks");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _lodash = require("lodash");
15
15
  var _luckDesign = require("luck-design");
16
16
  var _base = require("@luck-design-biz/base");
17
+ var _utils = require("@luck-design-biz/base/utils");
17
18
  var _Wrapper = _interopRequireDefault(require("../Wrapper"));
18
19
  var _index = require("../../../../index");
19
20
  var _helper = require("../../../engine/tools/helper");
@@ -22,6 +23,7 @@ var _Form = _interopRequireDefault(require("../../../../upload/Form"));
22
23
  var _LdRuntimeCom = _interopRequireDefault(require("../../../../components/LdRuntimeCom"));
23
24
  var _formPropsDefault = _interopRequireDefault(require("../../../engine/meta/form.props.default.json"));
24
25
  var _index2 = _interopRequireDefault(require("./index.less"));
26
+ var _I18N_PREFIX_ = 'lc.form.validator';
25
27
  var Header = function Header(_ref) {
26
28
  var _ref$header = _ref.header,
27
29
  header = _ref$header === void 0 ? 'collapse' : _ref$header,
@@ -63,6 +65,10 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
63
65
  var formRef = (0, _react.useRef)();
64
66
  var ctx = (0, _ContextProvider.useContext)();
65
67
  var remoteSource = (0, _ContextProvider.useRemoteSource)();
68
+ var _initData = (0, _ahooks.useCreation)(function () {
69
+ return (0, _utils.getPageQuery)();
70
+ }, []); // 获取主界面传递过来的详情页参数
71
+
66
72
  var serials = (0, _ahooks.useCreation)(function () {
67
73
  var _remoteSource$serials;
68
74
  return ((_remoteSource$serials = remoteSource.serials) === null || _remoteSource$serials === void 0 ? void 0 : _remoteSource$serials.map(function (i) {
@@ -74,21 +80,41 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
74
80
  instance: (ref || formRef).current
75
81
  });
76
82
  });
77
- (0, _ahooks.useUnmount)(function () {
78
- ctx.doAction(advance.events.onUnmount, {
79
- instance: (ref || formRef).current
80
- });
81
- });
83
+ (0, _react.useEffect)(function () {
84
+ var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref3) {
85
+ var resource = _ref3.resource,
86
+ prevResource = _ref3.prevResource;
87
+ ctx.doAction(advance.events.onPagePublicResourceChanged, {
88
+ resource: resource,
89
+ prevResource: prevResource,
90
+ instance: (ref || formRef).current
91
+ });
92
+ }).watch();
93
+ return function () {
94
+ ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
95
+ ctx.doAction(advance.events.onUnmount, {
96
+ instance: (ref || formRef).current
97
+ });
98
+ };
99
+ }, []);
82
100
  (0, _react.useImperativeHandle)(apiRef, function () {
83
101
  return {
84
- getForm: function getForm() {
102
+ /**
103
+ * 获取表格实例
104
+ * @method
105
+ */
106
+ getInstance: function getInstance() {
85
107
  return (ref || formRef).current;
86
108
  },
109
+ /**
110
+ * 提交表格数据
111
+ * @method
112
+ */
87
113
  submit: function submit() {
88
114
  var _ctx$pagePublicResour;
89
115
  var instance = (ref || formRef).current;
90
- var _ref3 = ((_ctx$pagePublicResour = ctx.pagePublicResource) === null || _ctx$pagePublicResour === void 0 ? void 0 : _ctx$pagePublicResour[id]) || initData || {},
91
- formMode = _ref3.formMode;
116
+ var _ref4 = ((_ctx$pagePublicResour = ctx.pagePublicResource) === null || _ctx$pagePublicResour === void 0 ? void 0 : _ctx$pagePublicResour[id]) || initData || _initData || {},
117
+ formMode = _ref4.formMode;
92
118
  if (formMode === 'add') {
93
119
  instance.onAdd();
94
120
  } else if (formMode === 'update') {
@@ -106,11 +132,11 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
106
132
  };
107
133
  return (0, _helper.executeCode)(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
108
134
  });
109
- var handleDataSourceFormat = (0, _ahooks.useMemoizedFn)(function (dataSourceFormat, _ref4) {
110
- var values = _ref4.values,
111
- submitData = _ref4.submitData;
112
- if ((0, _lodash.isNil)(dataSourceFormat)) return submitData;
113
- return (0, _helper.executeCode)(ctx, dataSourceFormat, ['values', 'submitData'], values, submitData);
135
+ var handleDataSourceFormat = (0, _ahooks.useMemoizedFn)(function (dataSourceFormat, dataSetKey, _ref5) {
136
+ var values = _ref5.values,
137
+ submitData = _ref5.submitData;
138
+ if ((0, _lodash.isNil)(dataSourceFormat)) return (0, _defineProperty2.default)({}, dataSetKey, submitData);
139
+ return (0, _helper.executeCode)(ctx, dataSourceFormat, ['dataSetKey', 'values', 'submitData'], dataSetKey, values, submitData);
114
140
  });
115
141
  var handleResetActionsColumn = (0, _ahooks.useMemoizedFn)(function (actionsColumnReset, data, index, actions, params) {
116
142
  return (0, _helper.executeCode)(ctx, actionsColumnReset, ['data', 'index', 'actions', 'params'], data, index, actions, params);
@@ -140,6 +166,57 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
140
166
  var renderAffix = (0, _ahooks.useMemoizedFn)(function (_render) {
141
167
  return _render ? /*#__PURE__*/_react.default.createElement(_LdRuntimeCom.default, null, _render) : null;
142
168
  });
169
+ var setVerifyRules = function setVerifyRules(_props, verifyListObj) {
170
+ var _verifyListObj$length, _verifyListObj$min, _verifyListObj$max, _verifyListObj$rules;
171
+ var props = (0, _lodash.cloneDeep)(_props);
172
+ props.config.rules = props.config.rules || [];
173
+ if ((_verifyListObj$length = verifyListObj.length) !== null && _verifyListObj$length !== void 0 && _verifyListObj$length.expression) props.config.rules.push({
174
+ validator: function validator(rule, value, callback) {
175
+ var _current;
176
+ var length = (0, _helper.executeCode)(ctx, verifyListObj.length.expression, ['cValue'], (_current = (ref || formRef).current) === null || _current === void 0 ? void 0 : _current.getCValue());
177
+ if (value.length > length) callback("".concat((0, _utils.formatMessage)({
178
+ id: "".concat(_I18N_PREFIX_, ".maxLength"),
179
+ label: '字数不得超过'
180
+ })).concat(length).concat((0, _utils.formatMessage)({
181
+ id: "".concat(_I18N_PREFIX_, ".textNum"),
182
+ label: '个字符'
183
+ })));
184
+ callback();
185
+ }
186
+ });
187
+ if ((_verifyListObj$min = verifyListObj.min) !== null && _verifyListObj$min !== void 0 && _verifyListObj$min.expression) props.config.rules.push({
188
+ validator: function validator(rule, value, callback) {
189
+ var _current2;
190
+ var min = (0, _helper.executeCode)(ctx, verifyListObj.min.expression, ['cValue'], (_current2 = (ref || formRef).current) === null || _current2 === void 0 ? void 0 : _current2.getCValue());
191
+ if (value < min) callback((0, _utils.formatMessage)({
192
+ id: "".concat(_I18N_PREFIX_, ".numberBelowMin"),
193
+ label: '低于最小值'
194
+ }));
195
+ callback();
196
+ }
197
+ });
198
+ if ((_verifyListObj$max = verifyListObj.max) !== null && _verifyListObj$max !== void 0 && _verifyListObj$max.expression) props.config.rules.push({
199
+ validator: function validator(rule, value, callback) {
200
+ var _current3;
201
+ var max = (0, _helper.executeCode)(ctx, verifyListObj.max.expression, ['cValue'], (_current3 = (ref || formRef).current) === null || _current3 === void 0 ? void 0 : _current3.getCValue());
202
+ if (value > max) callback((0, _utils.formatMessage)({
203
+ id: "".concat(_I18N_PREFIX_, ".numberExceedMax"),
204
+ label: '超过最大值'
205
+ }));
206
+ callback();
207
+ }
208
+ });
209
+ if (verifyListObj.email) props.config.type = 'email';
210
+ if (verifyListObj.idcard) props.config.type = 'idcard';
211
+ if (verifyListObj.mobile) props.config.type = 'mobile';
212
+ if ((_verifyListObj$rules = verifyListObj.rules) !== null && _verifyListObj$rules !== void 0 && _verifyListObj$rules.expression) props.config.rules.push({
213
+ validator: function validator(rule, value, callback) {
214
+ var _current4;
215
+ (0, _helper.executeCode)(ctx, verifyListObj.rules.expression, ['cValue', 'rule', 'value', 'callback'], (_current4 = (ref || formRef).current) === null || _current4 === void 0 ? void 0 : _current4.getCValue(), rule, value, callback);
216
+ }
217
+ });
218
+ return props;
219
+ };
143
220
  var renderFormList = (0, _ahooks.useMemoizedFn)(function (formConfig) {
144
221
  return (0, _lodash.reduce)(blocks, function (result, item) {
145
222
  if ((0, _lodash.includes)(['auto', 'grid', 'writer'], item.type) && (0, _lodash.includes)(item.mode, formConfig.formMode)) {
@@ -160,7 +237,8 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
160
237
  },
161
238
  onUpdate: {
162
239
  post: function post(data) {
163
- return handleDataSourceFormat(item.dataSourceFormat, data);
240
+ var _item$dataset2;
241
+ return handleDataSourceFormat(item.dataSourceFormat, (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.code, data);
164
242
  }
165
243
  }
166
244
  };
@@ -258,7 +336,6 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
258
336
  });
259
337
  resolve(_data);
260
338
  }
261
- ;
262
339
  });
263
340
  });
264
341
  var afterSubmit = (0, _ahooks.useMemoizedFn)(function (success, mainKey, res) {
@@ -297,7 +374,7 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
297
374
  renderFormList: renderFormList,
298
375
  renderFormExtra: renderFormExtra,
299
376
  mainFormLdId: "block_main",
300
- initData: ((_ctx$pagePublicResour2 = ctx.pagePublicResource) === null || _ctx$pagePublicResour2 === void 0 ? void 0 : _ctx$pagePublicResour2[id]) || initData,
377
+ initData: ((_ctx$pagePublicResour2 = ctx.pagePublicResource) === null || _ctx$pagePublicResour2 === void 0 ? void 0 : _ctx$pagePublicResour2[id]) || initData || _initData,
301
378
  ref: ref || formRef,
302
379
  readOnly: readOnly,
303
380
  showSaveBtn: showSave,
@@ -312,7 +389,8 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
312
389
  beforeSubmit: beforeSubmit,
313
390
  afterSubmit: advance.events.onSaveCallback ? afterSubmit : null,
314
391
  onValueChange: onValueChange,
315
- onChildChange: onChildChange
392
+ onChildChange: onChildChange,
393
+ setVerifyRules: setVerifyRules
316
394
  })));
317
395
  });
318
396
  LCForm.defaultProps = (0, _helper.omitBadProps)(_formPropsDefault.default);
@@ -244,7 +244,7 @@
244
244
  "name": "格式化数据",
245
245
  "desc": "格式化单表提交数据",
246
246
  "type": "_JSEditor",
247
- "defaultCode": "function dataSourceFormat(values, submitData) { \n return submitData; \n}",
247
+ "defaultCode": "function dataSourceFormat(dataSetKey, values, submitData) { \n return { [dataSetKey]: submitData }; \n}",
248
248
  "mustConfirm": true,
249
249
  "wrapper": "collapse",
250
250
  "wrapperProps": { "suppressIcon": true }
@@ -562,37 +562,43 @@
562
562
  "key": "onMount",
563
563
  "name": "组件首次渲染时",
564
564
  "desc": "在组件首次渲染时,执行方法",
565
- "func": "(instance)=>{\n\t\n}"
565
+ "func": "function onMount(instance) {\n\t\n}"
566
566
  },
567
567
  {
568
568
  "key": "beforeSave",
569
569
  "name": "保存前置事件",
570
570
  "desc": "保存前置事件,promise,返回false取消执行",
571
- "func": "(values, data) => {\n return values; \n}"
571
+ "func": "function beforeSave(values, data) {\n return values; \n}"
572
572
  },
573
573
  {
574
574
  "key": "onSaveCallback",
575
575
  "name": "保存后回调",
576
576
  "desc": "保存后回调事件",
577
- "func": "(success, mainKey, res)=>{\n\t\n}"
577
+ "func": "function onSaveCallback(success, mainKey, res) {\n\t\n}"
578
578
  },
579
579
  {
580
580
  "key": "onUnmount",
581
581
  "name": "组件卸载时",
582
582
  "desc": "在组件卸载时,执行方法",
583
- "func": "(instance)=>{\n\t\n}"
583
+ "func": "function onUnmount(instance) {\n\t\n}"
584
584
  },
585
585
  {
586
586
  "key": "onValueChange",
587
587
  "name": "参数变化的事件",
588
588
  "desc": "参数变化时,执行方法",
589
- "func": "(change, data)=>{\n\t\n}"
589
+ "func": "function onValueChange(change, data) {\n\t\n}"
590
590
  },
591
591
  {
592
592
  "key": "onChildChange",
593
593
  "name": "表单内容发生改变时的回调",
594
594
  "desc": "表单内容发生改变时的回调",
595
- "func": "(instance)=>{\n\t\n}"
595
+ "func": "function onChildChange(instance) {\n\t\n}"
596
+ },
597
+ {
598
+ "key": "onPagePublicResourceChanged",
599
+ "name": "页面共享资源变化后",
600
+ "desc": "当页面共享资源发生变化后(pagePublicResourceChanged),执行方法",
601
+ "func": "function onPagePublicResourceChanged(resource, instance) {\n\t\n}"
596
602
  }
597
603
  ]
598
604
  }
@@ -5,13 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _ahooks = require("ahooks");
10
12
  var _index = _interopRequireDefault(require("./index"));
11
- var _excluded = ["children"];
13
+ var _excluded = ["className"];
12
14
  var FunctionDesign = function FunctionDesign(_ref) {
13
- var children = _ref.children,
15
+ var className = _ref.className,
14
16
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
15
- return /*#__PURE__*/_react.default.createElement(_index.default, props, children);
17
+ var handleClick = (0, _ahooks.useMemoizedFn)(function () {});
18
+ return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({
19
+ onClick: handleClick
20
+ }, props));
16
21
  };
17
22
  var _default = exports.default = FunctionDesign;