@gisce/react-ooui 1.2.0-rc.77 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAkBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;AA4bF,wBAAsC"}
1
+ {"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAkBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;AAgcF,wBAAsC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.77",
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 = {
@@ -107,6 +107,7 @@ function ActionView(props: Props, ref: any) {
107
107
  tabs,
108
108
  activeKey,
109
109
  openAction,
110
+ onRemoveTab,
110
111
  } = tabManagerContext || {};
111
112
 
112
113
  useHotkeys(
@@ -240,8 +241,9 @@ function ActionView(props: Props, ref: any) {
240
241
 
241
242
  if (!currentViewToAssign) {
242
243
  showErrorDialog(
243
- "Error determining the first view to show.\nPlease, make sure the view ids on the fields_view_get responses are the same as the ones defined in the action"
244
+ `Error determining the first view to show for model ${model}.\nPlease, make sure the view ids on the fields_view_get responses are the same as the ones defined in the action`
244
245
  );
246
+ onRemoveTab?.(tabKey);
245
247
  }
246
248
 
247
249
  setCurrentView(currentViewToAssign);
@@ -279,7 +281,9 @@ function ActionView(props: Props, ref: any) {
279
281
  }, [tabs, activeKey]);
280
282
 
281
283
  async function canWeClose() {
282
- if (currentView!.type === "form") {
284
+ if (!currentView) {
285
+ return true;
286
+ } else if (currentView!.type === "form") {
283
287
  return await (formRef.current as any).cancelUnsavedChanges();
284
288
  } else {
285
289
  return true;