lu-lowcode-package-form 0.9.76 → 0.9.78

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.
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { Form, Row, Col } from 'antd';
3
3
 
4
- const LayoutFormRow = ({ children, layout }) => {
4
+ const LayoutFormRow = ({ children, layout, onTableAddRow,onTableRemoveRow}) => {
5
5
  layout = layout || '1';
6
6
  const getColSpan = (layoutStr) => {
7
7
  const layoutArray = layoutStr.split(',').map(Number);
@@ -16,7 +16,12 @@ const LayoutFormRow = ({ children, layout }) => {
16
16
  return React.Children.toArray(children).map((child, index) => {
17
17
  const props = child.props;
18
18
  const name = props?.componentId || props?.__id;
19
-
19
+ var componentName = child.type?.displayName || child.props?._componentName;
20
+ // console.log("initializeDependencyMap componentName", componentName)
21
+ let childComponent = child;
22
+ if (componentName == 'Field.Table')
23
+ childComponent = React.cloneElement(child, { onTableAddRow: onTableAddRow, onTableRemoveRow: onTableRemoveRow })
24
+
20
25
  if (name) {
21
26
  return (
22
27
  colSpans?.[index] && <Col span={colSpans[index]} key={index}>
@@ -27,14 +32,14 @@ const LayoutFormRow = ({ children, layout }) => {
27
32
  name={name}
28
33
  rules={[{ required: props.isRequired, message: `${props.title}不能为空!` }]}
29
34
  >
30
- {child}
35
+ {childComponent}
31
36
  </Form.Item>
32
37
  </Col>
33
38
  );
34
39
  } else {
35
40
  return (
36
41
  colSpans?.[index] && <Col span={colSpans[index]} key={index}>
37
- {child}
42
+ {childComponent}
38
43
  </Col>
39
44
  );
40
45
  }
@@ -42,6 +42,8 @@ Object.keys(Field).forEach(key => {
42
42
  Field[key].displayName = `Field.${key}`;
43
43
  });
44
44
 
45
+ console.log("Field",Field)
46
+
45
47
  const Layout = {
46
48
  FormRow: LayoutFormRow,
47
49
  FormGroupTitle: LayoutFormGroupTitle,
@@ -12,3 +12,4 @@ const evalFormula =(formula) => {
12
12
  };
13
13
 
14
14
  export {evalFormula};
15
+
@@ -1,5 +1,6 @@
1
1
  import { DeleteFilled, EditFilled, FileAddFilled } from "@ant-design/icons";
2
2
  import { Tooltip } from "antd";
3
+ import _ from "lodash";
3
4
 
4
5
  export const createPromiseWrapper = () => {
5
6
  let resolve, reject;
@@ -8,7 +9,7 @@ export const createPromiseWrapper = () => {
8
9
  resolve = res;
9
10
  reject = rej;
10
11
  });
11
-
12
+
12
13
  return { promise, resolve, reject };
13
14
  };
14
15
 
@@ -85,7 +86,7 @@ export function handleTreeEdit(
85
86
  children,
86
87
  title,
87
88
  rootId,
88
- handle = { New: () => {}, Edit: () => {}, Del: () => {} },
89
+ handle = { New: () => { }, Edit: () => { }, Del: () => { } },
89
90
  moduleName = "节点"
90
91
  ) {
91
92
  const newNode = (node) => ({
@@ -184,3 +185,19 @@ function constructTree(
184
185
  return father[parentId] === rootId;
185
186
  });
186
187
  }
188
+
189
+
190
+ const debouncers = {};
191
+ /**
192
+ * 一个带key的防抖函数
193
+ * @param {*} key
194
+ * @param {*} func
195
+ * @param {*} wait
196
+ * @returns
197
+ */
198
+ export function debounce(func, wait, key = "default") {
199
+ if (!debouncers[key]) {
200
+ debouncers[key] = _.debounce(func, wait);
201
+ }
202
+ return debouncers[key];
203
+ }
Binary file