@gisce/react-ooui 1.1.21 → 1.1.22-rc.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.
- package/dist/helpers/treeHelper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +457 -419
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +7 -7
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/widgets/base/ReferenceTree.d.ts +7 -0
- package/dist/widgets/base/ReferenceTree.d.ts.map +1 -0
- package/dist/widgets/base/many2one/Many2oneTree.d.ts +6 -0
- package/dist/widgets/base/many2one/Many2oneTree.d.ts.map +1 -0
- package/dist/widgets/views/Tree.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/helpers/treeHelper.ts +10 -2
- package/src/widgets/base/ReferenceTree.tsx +55 -0
- package/src/widgets/base/many2one/Many2oneTree.tsx +18 -0
- package/src/widgets/views/Tree.tsx +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceTree.d.ts","sourceRoot":"","sources":["ReferenceTree.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,oBAAY,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,aAAa,UACjB,kBAAkB,KACxB,MAAM,YA4CR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Many2oneTree.d.ts","sourceRoot":"","sources":["Many2oneTree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,oBAAY,iBAAiB,GAAG;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,YAAY,UAAW,iBAAiB,KAAG,MAAM,YAW7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22-rc.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ant-design/plots": "^1.0.9",
|
|
39
|
-
"@gisce/ooui": "^0.17.
|
|
39
|
+
"@gisce/ooui": "^0.17.13-rc.0",
|
|
40
40
|
"@gisce/react-formiga-table": "^0.5.0",
|
|
41
41
|
"@monaco-editor/react": "^4.4.5",
|
|
42
42
|
"@tabler/icons": "^1.96.0",
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Tree as TreeOoui,
|
|
3
|
+
Selection,
|
|
4
|
+
Many2one,
|
|
5
|
+
Boolean,
|
|
6
|
+
Reference,
|
|
7
|
+
} from "@gisce/ooui";
|
|
2
8
|
import { TreeView, Column } from "@/types";
|
|
3
9
|
|
|
4
10
|
const getTree = (treeView: TreeView): TreeOoui => {
|
|
@@ -54,7 +60,9 @@ const getTableItems = (treeOoui: TreeOoui, results: Array<any>): Array<any> => {
|
|
|
54
60
|
} else {
|
|
55
61
|
const widget = treeOoui.findById(key);
|
|
56
62
|
|
|
57
|
-
if (widget instanceof
|
|
63
|
+
if (widget instanceof Reference) {
|
|
64
|
+
parsedItem[key] = item[key];
|
|
65
|
+
} else if (widget instanceof Selection) {
|
|
58
66
|
const selection = widget;
|
|
59
67
|
parsedItem[key] = selection.selectionValues.get(item[key]);
|
|
60
68
|
} else if (widget instanceof Many2one) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { Many2oneSuffix } from "./many2one/Many2oneSuffix";
|
|
5
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
6
|
+
|
|
7
|
+
export type ReferenceTreeProps = { value: string; context?: any };
|
|
8
|
+
|
|
9
|
+
export const ReferenceTree = (
|
|
10
|
+
props: ReferenceTreeProps
|
|
11
|
+
): React.ReactElement => {
|
|
12
|
+
const { value, context } = props;
|
|
13
|
+
const [name, setName] = useState();
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
15
|
+
|
|
16
|
+
const [model, id] = value ? value.split(",") : [];
|
|
17
|
+
const intId = parseInt(id);
|
|
18
|
+
|
|
19
|
+
const fetchName = useCallback(async () => {
|
|
20
|
+
if (!value) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (value && name) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setLoading(true);
|
|
27
|
+
const nameResponse = await ConnectionProvider.getHandler().execute({
|
|
28
|
+
action: "name_get",
|
|
29
|
+
payload: [intId],
|
|
30
|
+
model,
|
|
31
|
+
context,
|
|
32
|
+
});
|
|
33
|
+
setName(nameResponse[0][1]);
|
|
34
|
+
setLoading(false);
|
|
35
|
+
}, [value, name]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
fetchName();
|
|
39
|
+
}, [value]);
|
|
40
|
+
|
|
41
|
+
if (!value && !loading) {
|
|
42
|
+
return <></>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (loading) {
|
|
46
|
+
return <LoadingOutlined />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Space>
|
|
51
|
+
<>{name}</>
|
|
52
|
+
<Many2oneSuffix id={intId} model={model} />
|
|
53
|
+
</Space>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Space } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Many2oneSuffix } from "./Many2oneSuffix";
|
|
4
|
+
|
|
5
|
+
export type Many2oneTreeProps = { m2oField: any };
|
|
6
|
+
|
|
7
|
+
export const Many2oneTree = (props: Many2oneTreeProps): React.ReactElement => {
|
|
8
|
+
const { m2oField } = props;
|
|
9
|
+
if (!m2oField) {
|
|
10
|
+
return <></>;
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<Space>
|
|
14
|
+
<>{m2oField.value}</>
|
|
15
|
+
<Many2oneSuffix id={m2oField.id} model={m2oField.model} />
|
|
16
|
+
</Space>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
} from "@ant-design/icons";
|
|
18
18
|
import { One2manyValue } from "../base/one2many/One2manyInput";
|
|
19
19
|
import { Interweave } from "interweave";
|
|
20
|
+
import { Many2oneTree } from "../base/many2one/Many2oneTree";
|
|
21
|
+
import { ReferenceTree } from "../base/ReferenceTree";
|
|
20
22
|
|
|
21
23
|
type Props = {
|
|
22
24
|
total?: number;
|
|
@@ -52,16 +54,9 @@ const booleanComponentFn = (value: boolean): React.ReactElement => {
|
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const many2OneComponentFn = (m2oField: any): React.ReactElement => {
|
|
55
|
-
|
|
56
|
-
return <></>;
|
|
57
|
-
}
|
|
58
|
-
return (
|
|
59
|
-
<Space>
|
|
60
|
-
<>{m2oField.value}</>
|
|
61
|
-
<Many2oneSuffix id={m2oField.id} model={m2oField.model} />
|
|
62
|
-
</Space>
|
|
63
|
-
);
|
|
57
|
+
return <Many2oneTree m2oField={m2oField} />;
|
|
64
58
|
};
|
|
59
|
+
|
|
65
60
|
const textComponentFn = (value: any): React.ReactElement => {
|
|
66
61
|
return <Interweave content={value?.replace(/(?:\r\n|\r|\n)/g, "<br>")} />;
|
|
67
62
|
};
|
|
@@ -92,6 +87,10 @@ const imageComponent = (value: string): React.ReactElement => {
|
|
|
92
87
|
);
|
|
93
88
|
};
|
|
94
89
|
|
|
90
|
+
const referenceComponent = (value: any): React.ReactElement => {
|
|
91
|
+
return <ReferenceTree value={value} />;
|
|
92
|
+
};
|
|
93
|
+
|
|
95
94
|
function Tree(props: Props): React.ReactElement {
|
|
96
95
|
const {
|
|
97
96
|
page = 1,
|
|
@@ -136,6 +135,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
136
135
|
image: imageComponent,
|
|
137
136
|
integer: numberComponent,
|
|
138
137
|
float: numberComponent,
|
|
138
|
+
reference: referenceComponent,
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
setColumns(columns);
|