@gisce/react-ooui 2.0.0-alpha.43 → 2.0.0-alpha.44

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": "2.0.0-alpha.43",
3
+ "version": "2.0.0-alpha.44",
4
4
  "engines": {
5
5
  "node": "20.5.0"
6
6
  },
@@ -415,14 +415,7 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
415
415
  const res_id = result.currentId as number;
416
416
  const res_model = currentModel as string;
417
417
  openDefaultActionForModel({
418
- model: "ir.attachment",
419
- values: {
420
- selection_associated_object: `${res_model},${res_id}`,
421
- },
422
- forced_values: {
423
- res_model,
424
- res_id,
425
- },
418
+ ...getAttachmentActionPayload(res_model, res_id),
426
419
  initialViewType: "form",
427
420
  });
428
421
  }}
@@ -438,11 +431,7 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
438
431
  const res_id = result.currentId as number;
439
432
  const res_model = currentModel as string;
440
433
  openDefaultActionForModel({
441
- model: "ir.attachment",
442
- domain: [
443
- ["res_model", "=", `${res_model}`],
444
- ["res_id", "=", `${res_id}`],
445
- ],
434
+ ...getAttachmentActionPayload(res_model, res_id),
446
435
  initialViewType: "tree",
447
436
  });
448
437
  }}
@@ -483,4 +472,20 @@ async function saveDocument({
483
472
  }
484
473
  }
485
474
 
475
+ function getAttachmentActionPayload(res_model: string, res_id: number) {
476
+ return {
477
+ model: "ir.attachment",
478
+ domain: [
479
+ ["res_model", "=", `${res_model}`],
480
+ ["res_id", "=", `${res_id}`],
481
+ ],
482
+ values: {
483
+ selection_associated_object: `${res_model},${res_id}`,
484
+ },
485
+ forced_values: {
486
+ res_model,
487
+ res_id,
488
+ },
489
+ };
490
+ }
486
491
  export default FormActionBar;
@@ -45,6 +45,7 @@ export default function Field({
45
45
  name={id}
46
46
  valuePropName={valuePropName}
47
47
  rules={rules}
48
+ help={ooui.tooltipInline ? ooui.tooltip : null}
48
49
  >
49
50
  {children}
50
51
  </Form.Item>
@@ -60,7 +61,7 @@ export default function Field({
60
61
  new LabelOoui({
61
62
  name: id + "_label",
62
63
  string: label,
63
- help: tooltip,
64
+ help: ooui.tooltipInline ? false : tooltip,
64
65
  fieldForLabel: id,
65
66
  })
66
67
  }
@@ -47,3 +47,30 @@ export const Translatable = (): React.ReactElement => {
47
47
  </LocaleProvider>
48
48
  );
49
49
  };
50
+
51
+ export const Tooltip = (): React.ReactElement => {
52
+ const ooui = new CharOoui({
53
+ name: "field",
54
+ string: "Lorem ipsum",
55
+ help: "This is a simple help",
56
+ });
57
+ return (
58
+ <LocaleProvider lang="en_US">
59
+ <Char ooui={ooui} showLabel />
60
+ </LocaleProvider>
61
+ );
62
+ };
63
+
64
+ export const TooltipInline = (): React.ReactElement => {
65
+ const ooui = new CharOoui({
66
+ name: "field",
67
+ string: "Lorem ipsum",
68
+ help: "This is a simple help",
69
+ help_inline: "true",
70
+ });
71
+ return (
72
+ <LocaleProvider lang="en_US">
73
+ <Char ooui={ooui} showLabel />
74
+ </LocaleProvider>
75
+ );
76
+ };