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.
- package/dist/index.cjs.js +365 -288
- package/dist/index.es.js +41857 -28594
- package/package.json +2 -1
- package/src/App.jsx +26 -11
- package/src/App.test.js +1 -0
- package/src/components/field/base.jsx +2 -2
- package/src/components/field/select/search-select.jsx +46 -22
- package/src/components/field/table/index.jsx +24 -12
- package/src/components/form-container/index.jsx +120 -39
- package/src/components/form-container/layout/form-row.jsx +9 -4
- package/src/components/index.jsx +2 -0
- package/src/utils/formula.js +1 -0
- package/src/utils/index.jsx +19 -2
- package/frp_0.45.0_linux_amd64.tar.gz +0 -0
@@ -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
|
-
{
|
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
|
-
{
|
42
|
+
{childComponent}
|
38
43
|
</Col>
|
39
44
|
);
|
40
45
|
}
|
package/src/components/index.jsx
CHANGED
package/src/utils/formula.js
CHANGED
package/src/utils/index.jsx
CHANGED
@@ -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
|