@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.78",
3
+ "version": "1.2.0-rc.79",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -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 { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
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 /> {t("listAllAttachments")}
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 /> {t("addNewAttachment")}
105
+ <FileAddOutlined /> {tForLang("addNewAttachment", locale)}
103
106
  </a>
104
107
  {attachments.length > 0 && (
105
108
  <>
106
- <li className=" ant-dropdown-menu-item-divider"></li>
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
- ? t("openAttachmentLink")
123
- : t("download")
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={t("openAttachment")}>
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] = views.find(([_, viewType]) => viewType === type)!;
442
+ const [retrievedViewId] = retriedViewData.find(([_, viewType]) => viewType === type)!;
443
443
  initialView = { id: retrievedViewId, type };
444
444
  } else {
445
445
  initialView = {