@gisce/react-ooui 1.4.3 → 1.4.4

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.4.3",
3
+ "version": "1.4.4",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -17,7 +17,7 @@ import {
17
17
  } from "@/context/TabManagerContext";
18
18
  import { FormModal } from "@/widgets/modals/FormModal";
19
19
  import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
20
- import { transformPlainMany2Ones } from "@/helpers/formHelper";
20
+ import { transformPlainMany2Ones, stringFormat } from "@/helpers/formHelper";
21
21
 
22
22
  export type ContentRootContextType = {
23
23
  processAction: ({
@@ -182,7 +182,9 @@ const ContentRootProvider = (
182
182
  context,
183
183
  });
184
184
  } else if (type === "ir.actions.act_window") {
185
- return await runAction({ actionData, fields, values, context });
185
+ return await runAction({actionData, fields, values, context});
186
+ } else if (type === "ir.actions.act_url") {
187
+ window.open(stringFormat(actionData.url, {...values, context}), "_blank");
186
188
  } else {
187
189
  showErrorDialog(`${type} action not supported`);
188
190
  return {};
@@ -295,3 +295,8 @@ export const colorTextFromBackground = (color: string) => {
295
295
  return getTextColor(color);
296
296
 
297
297
  }
298
+
299
+
300
+ export const stringFormat = (text: string, values: any): string => {
301
+ return text.replace(/\{([^}]+)\}/g, (match, key) => values[key] !== undefined ? values[key] : match);
302
+ }