@gisce/react-ooui 1.2.0-rc.78 → 1.2.0-rc.79
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/AttachmentsButtonWrapper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +29 -30
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +2 -2
- package/dist/react-ooui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/actionbar/AttachmentsButtonWrapper.tsx +15 -12
- package/src/context/ContentRootContext.tsx +1 -1
package/package.json
CHANGED
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
TableOutlined,
|
|
9
9
|
} from "@ant-design/icons";
|
|
10
10
|
import { Popover, Button, Row, Col, Tooltip, Spin } from "antd";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
LocaleContext,
|
|
13
|
+
LocaleContextType,
|
|
14
|
+
tForLang,
|
|
15
|
+
} from "@/context/LocaleContext";
|
|
12
16
|
|
|
13
17
|
export type Attachment = {
|
|
14
18
|
id: number;
|
|
@@ -32,7 +36,7 @@ export const AttachmentsButtonWrapper = (
|
|
|
32
36
|
props: AttachmentsButtonWrapperProps
|
|
33
37
|
) => {
|
|
34
38
|
const { numberOfAttachments, disabled } = props;
|
|
35
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
39
|
+
const { t, lang } = useContext(LocaleContext) as LocaleContextType;
|
|
36
40
|
const [popoverVisible, setPopoverVisible] = useState<boolean>(false);
|
|
37
41
|
|
|
38
42
|
const button = (
|
|
@@ -52,7 +56,7 @@ export const AttachmentsButtonWrapper = (
|
|
|
52
56
|
onVisibleChange={(visible: boolean) => setPopoverVisible(visible)}
|
|
53
57
|
visible={popoverVisible}
|
|
54
58
|
placement="bottom"
|
|
55
|
-
content={Content(props, setPopoverVisible)}
|
|
59
|
+
content={Content(props, setPopoverVisible, lang)}
|
|
56
60
|
title={t("attachments")}
|
|
57
61
|
arrowContent={null}
|
|
58
62
|
>
|
|
@@ -63,7 +67,8 @@ export const AttachmentsButtonWrapper = (
|
|
|
63
67
|
|
|
64
68
|
const Content = (
|
|
65
69
|
props: AttachmentsButtonWrapperProps,
|
|
66
|
-
setPopoverVisible: (visible: boolean) => void
|
|
70
|
+
setPopoverVisible: (visible: boolean) => void,
|
|
71
|
+
locale: string
|
|
67
72
|
) => {
|
|
68
73
|
const {
|
|
69
74
|
attachments = [],
|
|
@@ -73,8 +78,6 @@ const Content = (
|
|
|
73
78
|
onOpenAttachmentDetail,
|
|
74
79
|
onListAllAttachments,
|
|
75
80
|
} = props;
|
|
76
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
77
|
-
|
|
78
81
|
if (loading) {
|
|
79
82
|
return <Spin style={{ padding: 20 }} />;
|
|
80
83
|
}
|
|
@@ -89,7 +92,7 @@ const Content = (
|
|
|
89
92
|
onListAllAttachments();
|
|
90
93
|
}}
|
|
91
94
|
>
|
|
92
|
-
<TableOutlined /> {
|
|
95
|
+
<TableOutlined /> {tForLang("listAllAttachments", locale)}
|
|
93
96
|
</a>
|
|
94
97
|
<a
|
|
95
98
|
style={{ display: "block" }}
|
|
@@ -99,11 +102,11 @@ const Content = (
|
|
|
99
102
|
onAddNewAttachment();
|
|
100
103
|
}}
|
|
101
104
|
>
|
|
102
|
-
<FileAddOutlined /> {
|
|
105
|
+
<FileAddOutlined /> {tForLang("addNewAttachment", locale)}
|
|
103
106
|
</a>
|
|
104
107
|
{attachments.length > 0 && (
|
|
105
108
|
<>
|
|
106
|
-
<li className="
|
|
109
|
+
<li className="ant-dropdown-menu-item-divider"></li>
|
|
107
110
|
{attachments.map((attachment: any) => {
|
|
108
111
|
const Icon = attachment.link ? LinkOutlined : DownloadOutlined;
|
|
109
112
|
return (
|
|
@@ -119,8 +122,8 @@ const Content = (
|
|
|
119
122
|
<Tooltip
|
|
120
123
|
title={
|
|
121
124
|
attachment.link
|
|
122
|
-
?
|
|
123
|
-
:
|
|
125
|
+
? tForLang("openAttachmentLink", locale)
|
|
126
|
+
: tForLang("download", locale)
|
|
124
127
|
}
|
|
125
128
|
>
|
|
126
129
|
<Icon
|
|
@@ -134,7 +137,7 @@ const Content = (
|
|
|
134
137
|
)}
|
|
135
138
|
</Col>
|
|
136
139
|
<Col flex="25px" style={{ textAlign: "center" }}>
|
|
137
|
-
<Tooltip title={
|
|
140
|
+
<Tooltip title={tForLang("openAttachment", locale)}>
|
|
138
141
|
<FormOutlined
|
|
139
142
|
style={{ cursor: "pointer" }}
|
|
140
143
|
onClick={() => {
|
|
@@ -439,7 +439,7 @@ async function getViewsAndInitialView({
|
|
|
439
439
|
};
|
|
440
440
|
} else if (!view_id) {
|
|
441
441
|
const type = view_mode.split(",")[0];
|
|
442
|
-
const [retrievedViewId] =
|
|
442
|
+
const [retrievedViewId] = retriedViewData.find(([_, viewType]) => viewType === type)!;
|
|
443
443
|
initialView = { id: retrievedViewId, type };
|
|
444
444
|
} else {
|
|
445
445
|
initialView = {
|