@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/dist/context/ContentRootContext.d.ts.map +1 -1
- package/dist/helpers/formHelper.d.ts +1 -0
- package/dist/helpers/formHelper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +417 -407
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +8 -8
- package/dist/react-ooui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/context/ContentRootContext.tsx +4 -2
- package/src/helpers/formHelper.ts +5 -0
package/package.json
CHANGED
|
@@ -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({
|
|
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
|
+
}
|