@gisce/react-ooui 0.1.0 → 0.3.1

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.
Files changed (48) hide show
  1. package/dist/actionbar/AttachmentsButton.d.ts +1 -0
  2. package/dist/actionbar/AttachmentsButton.d.ts.map +1 -1
  3. package/dist/actionbar/AttachmentsButton.js +2 -2
  4. package/dist/actionbar/AttachmentsButton.js.map +1 -1
  5. package/dist/actionbar/AttachmentsButtonWrapper.d.ts +1 -0
  6. package/dist/actionbar/AttachmentsButtonWrapper.d.ts.map +1 -1
  7. package/dist/actionbar/AttachmentsButtonWrapper.js +13 -3
  8. package/dist/actionbar/AttachmentsButtonWrapper.js.map +1 -1
  9. package/dist/actionbar/FormActionBar.d.ts.map +1 -1
  10. package/dist/actionbar/FormActionBar.js +11 -0
  11. package/dist/actionbar/FormActionBar.js.map +1 -1
  12. package/dist/context/TabManagerContext.d.ts +2 -1
  13. package/dist/context/TabManagerContext.d.ts.map +1 -1
  14. package/dist/context/TabManagerContext.js.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/locales/ca_ES.d.ts +1 -0
  17. package/dist/locales/ca_ES.d.ts.map +1 -1
  18. package/dist/locales/ca_ES.js +1 -0
  19. package/dist/locales/ca_ES.js.map +1 -1
  20. package/dist/locales/en_US.d.ts +1 -0
  21. package/dist/locales/en_US.d.ts.map +1 -1
  22. package/dist/locales/en_US.js +1 -0
  23. package/dist/locales/en_US.js.map +1 -1
  24. package/dist/locales/es_ES.d.ts +1 -0
  25. package/dist/locales/es_ES.d.ts.map +1 -1
  26. package/dist/locales/es_ES.js +1 -0
  27. package/dist/locales/es_ES.js.map +1 -1
  28. package/dist/views/RootView.d.ts.map +1 -1
  29. package/dist/views/RootView.js +20 -19
  30. package/dist/views/RootView.js.map +1 -1
  31. package/dist/widgets/containers/Container.d.ts.map +1 -1
  32. package/dist/widgets/containers/Container.js +7 -6
  33. package/dist/widgets/containers/Container.js.map +1 -1
  34. package/dist/widgets/views/Tree.d.ts.map +1 -1
  35. package/dist/widgets/views/Tree.js +4 -0
  36. package/dist/widgets/views/Tree.js.map +1 -1
  37. package/package.json +3 -2
  38. package/src/actionbar/AttachmentsButton.tsx +3 -0
  39. package/src/actionbar/AttachmentsButtonWrapper.tsx +16 -1
  40. package/src/actionbar/FormActionBar.tsx +12 -0
  41. package/src/context/TabManagerContext.tsx +2 -0
  42. package/src/locales/ca_ES.tsx +1 -0
  43. package/src/locales/en_US.tsx +1 -0
  44. package/src/locales/es_ES.tsx +1 -0
  45. package/src/stories/containers/Notebook.stories.tsx +0 -1
  46. package/src/views/RootView.tsx +6 -1
  47. package/src/widgets/containers/Container.tsx +32 -29
  48. package/src/widgets/views/Tree.tsx +10 -0
@@ -42,41 +42,44 @@ const Container = (props: Props): React.ReactElement => {
42
42
  numberOfColumns: columns,
43
43
  });
44
44
 
45
- const rowWithEmptiesToFit = fillRowWithEmptiesToFit({
46
- row: rowWithExpandedItems,
47
- numberOfColumns: columns,
48
- mustFillWithEmpties: responsiveBehaviour,
49
- });
50
-
45
+ let rowWithEmptiesToFit;
51
46
  if (i === 0) {
47
+ rowWithEmptiesToFit = fillRowWithEmptiesToFit({
48
+ row: rowWithExpandedItems,
49
+ numberOfColumns: columns,
50
+ mustFillWithEmpties: responsiveBehaviour,
51
+ });
52
+
52
53
  firstRow = firstRow.concat(rowWithEmptiesToFit);
53
54
  }
54
55
 
55
- return rowWithEmptiesToFit.map((item: Widget, j: number) => {
56
- // We check if we have any label+field inside the container.
57
- // In this scenario, we must format the grid accordingly
58
- // Otherwise, the grid will divide uniformly
59
- if (item instanceof Label && (item as Label).fieldForLabel) {
60
- fieldInRows = true;
61
- }
56
+ return (i === 0 ? rowWithEmptiesToFit : rowWithExpandedItems).map(
57
+ (item: Widget, j: number) => {
58
+ // We check if we have any label+field inside the container.
59
+ // In this scenario, we must format the grid accordingly
60
+ // Otherwise, the grid will divide uniformly
61
+ if (item instanceof Label && (item as Label).fieldForLabel) {
62
+ fieldInRows = true;
63
+ }
62
64
 
63
- const itemRowIndex = row.indexOf(item);
65
+ const itemRowIndex = row.indexOf(item);
64
66
 
65
- return (
66
- <div
67
- key={`${i.toString()}-${itemRowIndex.toString()}`}
68
- style={{
69
- ...getSpanStyleForItem({ item, responsiveBehaviour }),
70
- minWidth: 0,
71
- }}
72
- >
73
- {createReactWidget({
74
- ooui: item,
75
- responsiveBehaviour,
76
- })}
77
- </div>
78
- );
79
- });
67
+ return (
68
+ <div
69
+ key={`${i.toString()}-${itemRowIndex.toString()}`}
70
+ style={{
71
+ ...getSpanStyleForItem({ item, responsiveBehaviour }),
72
+ minWidth: 0,
73
+ }}
74
+ >
75
+ {createReactWidget({
76
+ ooui: item,
77
+ responsiveBehaviour,
78
+ })}
79
+ </div>
80
+ );
81
+ }
82
+ );
80
83
  });
81
84
 
82
85
  const templateColumns =
@@ -70,6 +70,15 @@ const floatTimeComponent = (value: number): React.ReactElement => {
70
70
  return <>{parseFloatToString(value)}</>;
71
71
  };
72
72
 
73
+ const imageComponent = (value: string): React.ReactElement => {
74
+ return (
75
+ <img
76
+ src={`data:image/*;base64,${value}`}
77
+ style={{ maxWidth: "50px", padding: "5px" }}
78
+ />
79
+ );
80
+ };
81
+
73
82
  function Tree(props: Props): React.ReactElement {
74
83
  const {
75
84
  page = 1,
@@ -108,6 +117,7 @@ function Tree(props: Props): React.ReactElement {
108
117
  many2many: one2ManyComponentFn,
109
118
  progressbar: progressBarComponentFn,
110
119
  float_time: floatTimeComponent,
120
+ image: imageComponent,
111
121
  });
112
122
  setColumns(columns);
113
123
  }, [treeView]);