@gisce/react-ooui 1.2.0-rc.84 → 1.2.0-rc.86
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/actionbar/SearchBar.d.ts.map +1 -1
- package/dist/helpers/filesHelper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +7720 -25795
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +15 -229
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/src/actionbar/SearchBar.tsx +8 -4
- package/src/helpers/filesHelper.ts +2 -3
- package/src/stories/custom/Avatar.stories.tsx +27 -0
- package/src/stories/views/Tree.stories.jsx +12 -1
- package/src/widgets/base/many2one/Many2one.tsx +2 -2
- package/src/widgets/custom/Avatar.tsx +33 -0
- package/src/widgets/custom/FiberGrid.tsx +1 -1
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+);background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;-webkit-transform:rotate(135deg);transform:rotate(135deg)}.react-resizable-handle-e{right:0;-webkit-transform:rotate(315deg);transform:rotate(315deg)}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;-webkit-transform:rotate(225deg);transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}
|
|
1
|
+
.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+);background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;-webkit-transform:rotate(135deg);transform:rotate(135deg)}.react-resizable-handle-e{right:0;-webkit-transform:rotate(315deg);transform:rotate(315deg)}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;-webkit-transform:rotate(225deg);transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.86",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ant-design/plots": "^1.0.9",
|
|
35
|
-
"@gisce/ooui": "^0.
|
|
35
|
+
"@gisce/ooui": "^0.20.0",
|
|
36
36
|
"@gisce/react-formiga-components": "^1.0.9-rc.21",
|
|
37
37
|
"@gisce/react-formiga-table": "^0.5.0",
|
|
38
38
|
"@monaco-editor/react": "^4.4.5",
|
|
39
39
|
"@tabler/icons-react": "^2.11.0",
|
|
40
40
|
"antd": "^5.5.2",
|
|
41
41
|
"buffer": "^6.0.3",
|
|
42
|
-
"fiber-diagram": "
|
|
43
|
-
"file-type": "
|
|
42
|
+
"@gisce/fiber-diagram": "^1.0.1",
|
|
43
|
+
"file-type-buffer-browser": "git+ssh://git@github.com/mguellsegarra/file-type-buffer-browser.git",
|
|
44
44
|
"interweave": "^13.0.0",
|
|
45
45
|
"react": "^17.0.1",
|
|
46
46
|
"react-dom": "^17.0.1",
|
|
@@ -13,9 +13,8 @@ function SearchBar(props: Props) {
|
|
|
13
13
|
const { onSearch, disabled = false, searchText } = props;
|
|
14
14
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
15
15
|
const [form] = Form.useForm();
|
|
16
|
-
const [mustShowClearSuffix, setMustShowClearSuffix] =
|
|
17
|
-
false
|
|
18
|
-
);
|
|
16
|
+
const [mustShowClearSuffix, setMustShowClearSuffix] =
|
|
17
|
+
useState<boolean>(false);
|
|
19
18
|
|
|
20
19
|
function handleSubmit(values: any) {
|
|
21
20
|
onSearch(values.search);
|
|
@@ -42,6 +41,7 @@ function SearchBar(props: Props) {
|
|
|
42
41
|
onChange={(e) => {
|
|
43
42
|
setMustShowClearSuffix(e.target.value.length > 0);
|
|
44
43
|
}}
|
|
44
|
+
style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
|
|
45
45
|
suffix={
|
|
46
46
|
(mustShowClearSuffix ||
|
|
47
47
|
(searchText && searchText.length > 0)) && (
|
|
@@ -57,7 +57,11 @@ function SearchBar(props: Props) {
|
|
|
57
57
|
</Form.Item>
|
|
58
58
|
</Col>
|
|
59
59
|
<Col>
|
|
60
|
-
<Button
|
|
60
|
+
<Button
|
|
61
|
+
htmlType="submit"
|
|
62
|
+
disabled={disabled}
|
|
63
|
+
style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }}
|
|
64
|
+
>
|
|
61
65
|
{t("search")}
|
|
62
66
|
</Button>
|
|
63
67
|
</Col>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Buffer } from "buffer";
|
|
1
|
+
import { fileTypeFromBuffer } from "file-type-buffer-browser";
|
|
3
2
|
|
|
4
3
|
export function getFilesize(base64string: string) {
|
|
5
4
|
const buffer = Buffer.from(base64string, "base64");
|
|
@@ -8,7 +7,7 @@ export function getFilesize(base64string: string) {
|
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export async function getMimeType(base64string: string) {
|
|
11
|
-
const mimeInfo = await
|
|
10
|
+
const mimeInfo = await fileTypeFromBuffer(
|
|
12
11
|
Buffer.from(base64string, "base64")
|
|
13
12
|
);
|
|
14
13
|
if (!mimeInfo) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, {useState} from "react";
|
|
2
|
+
|
|
3
|
+
import { Avatar as AvatarOoui } from "@gisce/ooui";
|
|
4
|
+
import Avatar from "@/widgets/custom/Avatar";
|
|
5
|
+
import "antd/dist/antd.css";
|
|
6
|
+
import LocaleProvider from "../../context/LocaleContext";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Components/Widgets/Custom/Avatar",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = (): React.ReactElement => {
|
|
13
|
+
const ooui = new AvatarOoui({
|
|
14
|
+
name: "user",
|
|
15
|
+
string: "Lorem ipsum",
|
|
16
|
+
});
|
|
17
|
+
const value = "John Wick";
|
|
18
|
+
return (
|
|
19
|
+
<LocaleProvider lang="en_US">
|
|
20
|
+
<Avatar ooui={ooui} value={value} />
|
|
21
|
+
</LocaleProvider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
@@ -28,6 +28,7 @@ Default.args = {
|
|
|
28
28
|
results: [
|
|
29
29
|
{
|
|
30
30
|
city: false,
|
|
31
|
+
user_id: [1, "John Wick"],
|
|
31
32
|
country: false,
|
|
32
33
|
id: 62,
|
|
33
34
|
lang: false,
|
|
@@ -39,6 +40,7 @@ Default.args = {
|
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
city: "Wavre",
|
|
43
|
+
user_id: [2, "JIGNACIO FERREIRO ANDRES"],
|
|
42
44
|
country: [20, "Belgium"],
|
|
43
45
|
id: 3,
|
|
44
46
|
lang: false,
|
|
@@ -50,6 +52,7 @@ Default.args = {
|
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
54
|
city: false,
|
|
55
|
+
user_id: [3, "JOSEFA REINA GUTIERREZ"],
|
|
53
56
|
country: false,
|
|
54
57
|
id: 106,
|
|
55
58
|
lang: "ca_ES",
|
|
@@ -61,6 +64,7 @@ Default.args = {
|
|
|
61
64
|
},
|
|
62
65
|
{
|
|
63
66
|
city: "Sevilla",
|
|
67
|
+
user_id: [4, "GUADALUPE CALERO CATALAN"],
|
|
64
68
|
country: [67, "España"],
|
|
65
69
|
id: 32,
|
|
66
70
|
lang: false,
|
|
@@ -73,6 +77,7 @@ Default.args = {
|
|
|
73
77
|
{
|
|
74
78
|
city: false,
|
|
75
79
|
country: [67, "España"],
|
|
80
|
+
user_id: [5, "ANDER BAUTISTA ROLDAN"],
|
|
76
81
|
id: 82,
|
|
77
82
|
lang: "es_ES",
|
|
78
83
|
name: "Apellido2 Apellido2, Nombre",
|
|
@@ -83,6 +88,7 @@ Default.args = {
|
|
|
83
88
|
},
|
|
84
89
|
{
|
|
85
90
|
city: "Zaragoza",
|
|
91
|
+
user_id: [7, "FELICIDAD PAEZ BARRERA"],
|
|
86
92
|
country: [67, "España"],
|
|
87
93
|
id: 33,
|
|
88
94
|
lang: false,
|
|
@@ -95,12 +101,17 @@ Default.args = {
|
|
|
95
101
|
],
|
|
96
102
|
treeView: {
|
|
97
103
|
arch:
|
|
98
|
-
`<tree string="Partners">\n<field name="numeric" sum="Numeric"/><field name="name"/>\n <field name="title" widget="tag" widget_props="{'colors': {'corp': 'red', 'ltd': 'green'}}"/>\n <field name="ref"/>\n <field name="city" select="2"/>\n <field name="country" select="2"/>\n <field name="lang"/>\n <field name="progressbar" string="Progress" /> </tree>`,
|
|
104
|
+
`<tree string="Partners">\n<field name="numeric" sum="Numeric"/><field name="user_id" widget="avatar"/><field name="name"/>\n <field name="title" widget="tag" widget_props="{'colors': {'corp': 'red', 'ltd': 'green'}}"/>\n <field name="ref"/>\n <field name="city" select="2"/>\n <field name="country" select="2"/>\n <field name="lang"/>\n <field name="progressbar" string="Progress" /> </tree>`,
|
|
99
105
|
fields: {
|
|
100
106
|
progressbar: {
|
|
101
107
|
string: "Progress bar",
|
|
102
108
|
type: "progressbar",
|
|
103
109
|
},
|
|
110
|
+
user_id: {
|
|
111
|
+
string: "User",
|
|
112
|
+
type: "many2one",
|
|
113
|
+
relation: "res.users",
|
|
114
|
+
},
|
|
104
115
|
numeric: {
|
|
105
116
|
digits: [16, 3],
|
|
106
117
|
string: "Potència contractada (kW)",
|
|
@@ -257,7 +257,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
257
257
|
}
|
|
258
258
|
/>
|
|
259
259
|
</Col>
|
|
260
|
-
<Col flex="32px">
|
|
260
|
+
<Col flex="32px" style={{ paddingRight: 0 }}>
|
|
261
261
|
<Button
|
|
262
262
|
icon={<FolderOpenOutlined />}
|
|
263
263
|
disabled={id === undefined || text === "" || inputText === undefined}
|
|
@@ -268,7 +268,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
268
268
|
tabIndex={-1}
|
|
269
269
|
/>
|
|
270
270
|
</Col>
|
|
271
|
-
<Col flex="32px">
|
|
271
|
+
<Col flex="32px" style={{ paddingLeft: 0 }}>
|
|
272
272
|
<Button
|
|
273
273
|
icon={searching ? <LoadingOutlined /> : <SearchOutlined />}
|
|
274
274
|
disabled={readOnly || searching}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {WidgetProps} from "@/types";
|
|
3
|
+
import { Avatar as AntdAvatar, Tooltip } from "antd";
|
|
4
|
+
import { Avatar as AvatarOoui} from "@gisce/ooui";
|
|
5
|
+
import { colorFromString } from "@/helpers/formHelper";
|
|
6
|
+
|
|
7
|
+
type AvatarProps = WidgetProps & {
|
|
8
|
+
ooui: AvatarOoui
|
|
9
|
+
value?: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Avatar = (props: AvatarProps): React.ReactElement | null => {
|
|
13
|
+
console.log("Avatar Props", props);
|
|
14
|
+
const {ooui, value} = props;
|
|
15
|
+
if (!value) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
let formattedValue = value;
|
|
19
|
+
if (ooui.selectionValues.size) {
|
|
20
|
+
formattedValue = ooui.selectionValues.get(value);
|
|
21
|
+
} else if (Array.isArray(value)) {
|
|
22
|
+
formattedValue = value[1];
|
|
23
|
+
}
|
|
24
|
+
const text = formattedValue.toString().split(" ").filter((word:string) => word.length > 1).slice(0, 3).map((word:string) => word[0].toUpperCase()).join("");
|
|
25
|
+
const backgroundColor = colorFromString(formattedValue);
|
|
26
|
+
return (
|
|
27
|
+
<Tooltip title={formattedValue}>
|
|
28
|
+
<AntdAvatar alt={formattedValue} style={{backgroundColor}}>{text}</AntdAvatar>
|
|
29
|
+
</Tooltip>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Avatar;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import Field from "@/common/Field";
|
|
3
3
|
import { Char as CharOoui } from "@gisce/ooui";
|
|
4
4
|
import { WidgetProps } from "@/types";
|
|
5
|
-
import { GridUi } from "fiber-diagram";
|
|
5
|
+
import { GridUi } from "@gisce/fiber-diagram";
|
|
6
6
|
|
|
7
7
|
export const FiberGrid = (props: WidgetProps) => {
|
|
8
8
|
const { ooui } = props;
|