@gisce/react-ooui 1.2.0-rc.9 → 1.2.0-rc.91

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 (355) hide show
  1. package/README.md +0 -6
  2. package/dist/actionbar/ActionButton.d.ts +2 -2
  3. package/dist/actionbar/ActionButton.d.ts.map +1 -1
  4. package/dist/actionbar/AttachmentsButton.d.ts +2 -2
  5. package/dist/actionbar/AttachmentsButton.d.ts.map +1 -1
  6. package/dist/actionbar/AttachmentsButtonWrapper.d.ts +2 -2
  7. package/dist/actionbar/AttachmentsButtonWrapper.d.ts.map +1 -1
  8. package/dist/actionbar/ButtonWithBadge.d.ts +2 -2
  9. package/dist/actionbar/ButtonWithBadge.d.ts.map +1 -1
  10. package/dist/actionbar/ChangeViewButton.d.ts +2 -2
  11. package/dist/actionbar/ChangeViewButton.d.ts.map +1 -1
  12. package/dist/actionbar/DashboardActionBar.d.ts +2 -2
  13. package/dist/actionbar/DashboardActionBar.d.ts.map +1 -1
  14. package/dist/actionbar/DropdownButton.d.ts +2 -2
  15. package/dist/actionbar/DropdownButton.d.ts.map +1 -1
  16. package/dist/actionbar/FormActionBar.d.ts +2 -2
  17. package/dist/actionbar/FormActionBar.d.ts.map +1 -1
  18. package/dist/actionbar/GraphActionBar.d.ts +2 -2
  19. package/dist/actionbar/GraphActionBar.d.ts.map +1 -1
  20. package/dist/actionbar/NewButton.d.ts +2 -2
  21. package/dist/actionbar/NewButton.d.ts.map +1 -1
  22. package/dist/actionbar/SearchBar.d.ts +2 -2
  23. package/dist/actionbar/SearchBar.d.ts.map +1 -1
  24. package/dist/actionbar/TreeActionBar.d.ts +2 -2
  25. package/dist/actionbar/TreeActionBar.d.ts.map +1 -1
  26. package/dist/common/ButtonWithTooltip.d.ts +2 -2
  27. package/dist/common/ButtonWithTooltip.d.ts.map +1 -1
  28. package/dist/common/DatePicker.d.ts +14 -2
  29. package/dist/common/DatePicker.d.ts.map +1 -1
  30. package/dist/common/Field.d.ts +1 -1
  31. package/dist/common/Field.d.ts.map +1 -1
  32. package/dist/context/ActionViewContext.d.ts +5 -1
  33. package/dist/context/ActionViewContext.d.ts.map +1 -1
  34. package/dist/context/ConfigContext.d.ts +7 -0
  35. package/dist/context/ConfigContext.d.ts.map +1 -0
  36. package/dist/context/ContentRootContext.d.ts.map +1 -1
  37. package/dist/context/FormContext.d.ts +4 -2
  38. package/dist/context/FormContext.d.ts.map +1 -1
  39. package/dist/helpers/errorHelper.d.ts +6 -0
  40. package/dist/helpers/errorHelper.d.ts.map +1 -0
  41. package/dist/helpers/filesHelper.d.ts.map +1 -1
  42. package/dist/helpers/formHelper.d.ts +5 -3
  43. package/dist/helpers/formHelper.d.ts.map +1 -1
  44. package/dist/helpers/iconMapper.d.ts +11 -2
  45. package/dist/helpers/iconMapper.d.ts.map +1 -1
  46. package/dist/helpers/one2manyHelper.d.ts +12 -4
  47. package/dist/helpers/one2manyHelper.d.ts.map +1 -1
  48. package/dist/helpers/searchHelper.d.ts +1 -1
  49. package/dist/helpers/searchHelper.d.ts.map +1 -1
  50. package/dist/helpers/treeHelper.d.ts +1 -1
  51. package/dist/helpers/treeHelper.d.ts.map +1 -1
  52. package/dist/hooks/useExport.d.ts +44 -0
  53. package/dist/hooks/useExport.d.ts.map +1 -0
  54. package/dist/index.d.ts +4 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/locales/ca_ES.d.ts +2 -0
  57. package/dist/locales/ca_ES.d.ts.map +1 -1
  58. package/dist/locales/en_US.d.ts +2 -0
  59. package/dist/locales/en_US.d.ts.map +1 -1
  60. package/dist/locales/es_ES.d.ts +2 -0
  61. package/dist/locales/es_ES.d.ts.map +1 -1
  62. package/dist/react-ooui.es.js +9360 -29063
  63. package/dist/react-ooui.es.js.map +1 -1
  64. package/dist/react-ooui.umd.js +16 -265
  65. package/dist/react-ooui.umd.js.map +1 -1
  66. package/dist/style.css +1 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/ui/ActionErrorDialog.d.ts.map +1 -1
  70. package/dist/ui/ErrorAlert.d.ts +6 -0
  71. package/dist/ui/ErrorAlert.d.ts.map +1 -0
  72. package/dist/ui/FavouriteButton.d.ts +2 -2
  73. package/dist/ui/FavouriteButton.d.ts.map +1 -1
  74. package/dist/ui/GoToResourceModal.d.ts +2 -2
  75. package/dist/ui/GoToResourceModal.d.ts.map +1 -1
  76. package/dist/ui/TitleHeader.d.ts +2 -2
  77. package/dist/ui/TitleHeader.d.ts.map +1 -1
  78. package/dist/views/ActionView.d.ts.map +1 -1
  79. package/dist/views/CurrentTabContent.d.ts +2 -2
  80. package/dist/views/CurrentTabContent.d.ts.map +1 -1
  81. package/dist/views/RootView.d.ts.map +1 -1
  82. package/dist/views/TabContent.d.ts +1 -1
  83. package/dist/views/TabContent.d.ts.map +1 -1
  84. package/dist/views/TabSelector.d.ts +2 -2
  85. package/dist/views/TabSelector.d.ts.map +1 -1
  86. package/dist/views/actionViews/DashboardActionView.d.ts +2 -2
  87. package/dist/views/actionViews/DashboardActionView.d.ts.map +1 -1
  88. package/dist/views/actionViews/FormActionView.d.ts +2 -2
  89. package/dist/views/actionViews/FormActionView.d.ts.map +1 -1
  90. package/dist/views/actionViews/GraphActionView.d.ts +2 -2
  91. package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
  92. package/dist/views/actionViews/TreeActionView.d.ts +2 -2
  93. package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
  94. package/dist/views/tabs/Tab.d.ts +2 -2
  95. package/dist/views/tabs/Tab.d.ts.map +1 -1
  96. package/dist/widgets/WidgetFactory.d.ts.map +1 -1
  97. package/dist/widgets/base/Binary.d.ts +3 -3
  98. package/dist/widgets/base/Binary.d.ts.map +1 -1
  99. package/dist/widgets/base/Boolean.d.ts +2 -2
  100. package/dist/widgets/base/Boolean.d.ts.map +1 -1
  101. package/dist/widgets/base/Button.d.ts +2 -2
  102. package/dist/widgets/base/Button.d.ts.map +1 -1
  103. package/dist/widgets/base/Char.d.ts +2 -2
  104. package/dist/widgets/base/Char.d.ts.map +1 -1
  105. package/dist/widgets/base/Date.d.ts +2 -2
  106. package/dist/widgets/base/Date.d.ts.map +1 -1
  107. package/dist/widgets/base/DateTime.d.ts +2 -2
  108. package/dist/widgets/base/DateTime.d.ts.map +1 -1
  109. package/dist/widgets/base/Email.d.ts +2 -2
  110. package/dist/widgets/base/Email.d.ts.map +1 -1
  111. package/dist/widgets/base/Float.d.ts +2 -2
  112. package/dist/widgets/base/Float.d.ts.map +1 -1
  113. package/dist/widgets/base/FloatTime.d.ts +1 -1
  114. package/dist/widgets/base/FloatTime.d.ts.map +1 -1
  115. package/dist/widgets/base/Image.d.ts +3 -3
  116. package/dist/widgets/base/Image.d.ts.map +1 -1
  117. package/dist/widgets/base/Integer.d.ts +2 -2
  118. package/dist/widgets/base/Integer.d.ts.map +1 -1
  119. package/dist/widgets/base/Label.d.ts +2 -2
  120. package/dist/widgets/base/Label.d.ts.map +1 -1
  121. package/dist/widgets/base/LinkInput.d.ts +2 -2
  122. package/dist/widgets/base/LinkInput.d.ts.map +1 -1
  123. package/dist/widgets/base/MultiSelection.d.ts +3 -3
  124. package/dist/widgets/base/MultiSelection.d.ts.map +1 -1
  125. package/dist/widgets/base/ProgressBar.d.ts +3 -3
  126. package/dist/widgets/base/ProgressBar.d.ts.map +1 -1
  127. package/dist/widgets/base/Reference.d.ts +1 -1
  128. package/dist/widgets/base/Reference.d.ts.map +1 -1
  129. package/dist/widgets/base/ReferenceTree.d.ts +8 -0
  130. package/dist/widgets/base/ReferenceTree.d.ts.map +1 -0
  131. package/dist/widgets/base/Selection.d.ts +3 -3
  132. package/dist/widgets/base/Selection.d.ts.map +1 -1
  133. package/dist/widgets/base/Separator.d.ts +2 -2
  134. package/dist/widgets/base/Separator.d.ts.map +1 -1
  135. package/dist/widgets/base/Text.d.ts +2 -2
  136. package/dist/widgets/base/Text.d.ts.map +1 -1
  137. package/dist/widgets/base/Url.d.ts +2 -2
  138. package/dist/widgets/base/Url.d.ts.map +1 -1
  139. package/dist/widgets/base/many2one/Many2one.d.ts +1 -1
  140. package/dist/widgets/base/many2one/Many2one.d.ts.map +1 -1
  141. package/dist/widgets/base/many2one/Many2oneSuffix.d.ts +2 -2
  142. package/dist/widgets/base/many2one/Many2oneSuffix.d.ts.map +1 -1
  143. package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts +2 -2
  144. package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts.map +1 -1
  145. package/dist/widgets/base/many2one/Many2oneTree.d.ts +6 -0
  146. package/dist/widgets/base/many2one/Many2oneTree.d.ts.map +1 -0
  147. package/dist/widgets/base/one2many/One2many.d.ts +2 -2
  148. package/dist/widgets/base/one2many/One2many.d.ts.map +1 -1
  149. package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
  150. package/dist/widgets/base/one2many/One2manyTopBar.d.ts +2 -2
  151. package/dist/widgets/base/one2many/One2manyTopBar.d.ts.map +1 -1
  152. package/dist/widgets/containers/Group.d.ts.map +1 -1
  153. package/dist/widgets/custom/Avatar.d.ts +10 -0
  154. package/dist/widgets/custom/Avatar.d.ts.map +1 -0
  155. package/dist/widgets/custom/ButtonGroup.d.ts +2 -2
  156. package/dist/widgets/custom/ButtonGroup.d.ts.map +1 -1
  157. package/dist/widgets/custom/CodeEditor.d.ts +2 -2
  158. package/dist/widgets/custom/CodeEditor.d.ts.map +1 -1
  159. package/dist/widgets/custom/FiberGrid.d.ts +3 -3
  160. package/dist/widgets/custom/FiberGrid.d.ts.map +1 -1
  161. package/dist/widgets/custom/Indicator.d.ts +2 -2
  162. package/dist/widgets/custom/Indicator.d.ts.map +1 -1
  163. package/dist/widgets/custom/Markdown.d.ts +5 -0
  164. package/dist/widgets/custom/Markdown.d.ts.map +1 -0
  165. package/dist/widgets/custom/MultiCheckbox.d.ts +3 -3
  166. package/dist/widgets/custom/MultiCheckbox.d.ts.map +1 -1
  167. package/dist/widgets/custom/Radio.d.ts +3 -3
  168. package/dist/widgets/custom/Radio.d.ts.map +1 -1
  169. package/dist/widgets/custom/Steps.d.ts +3 -3
  170. package/dist/widgets/custom/Steps.d.ts.map +1 -1
  171. package/dist/widgets/custom/Switch.d.ts +2 -2
  172. package/dist/widgets/custom/Switch.d.ts.map +1 -1
  173. package/dist/widgets/custom/Tag.d.ts +5 -0
  174. package/dist/widgets/custom/Tag.d.ts.map +1 -0
  175. package/dist/widgets/custom/Tags.d.ts +3 -3
  176. package/dist/widgets/custom/Tags.d.ts.map +1 -1
  177. package/dist/widgets/custom/Timeline.d.ts +3 -3
  178. package/dist/widgets/custom/Timeline.d.ts.map +1 -1
  179. package/dist/widgets/modals/ExportModal.d.ts +4 -3
  180. package/dist/widgets/modals/ExportModal.d.ts.map +1 -1
  181. package/dist/widgets/modals/FormModal.d.ts +2 -2
  182. package/dist/widgets/modals/FormModal.d.ts.map +1 -1
  183. package/dist/widgets/modals/SearchModal.d.ts +2 -2
  184. package/dist/widgets/modals/SearchModal.d.ts.map +1 -1
  185. package/dist/widgets/modals/TranslationModal.d.ts +2 -2
  186. package/dist/widgets/modals/TranslationModal.d.ts.map +1 -1
  187. package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
  188. package/dist/widgets/views/Dashboard/DashboardForm.d.ts +2 -2
  189. package/dist/widgets/views/Dashboard/DashboardForm.d.ts.map +1 -1
  190. package/dist/widgets/views/Dashboard/DashboardTree.d.ts +2 -2
  191. package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
  192. package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts +2 -2
  193. package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts.map +1 -1
  194. package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts +2 -2
  195. package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts.map +1 -1
  196. package/dist/widgets/views/Form.d.ts.map +1 -1
  197. package/dist/widgets/views/Graph/GraphChart.d.ts +2 -2
  198. package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
  199. package/dist/widgets/views/Graph/GraphDefaults.d.ts +36 -0
  200. package/dist/widgets/views/Graph/GraphDefaults.d.ts.map +1 -1
  201. package/dist/widgets/views/Graph/GraphIndicator.d.ts +2 -2
  202. package/dist/widgets/views/Graph/GraphIndicator.d.ts.map +1 -1
  203. package/dist/widgets/views/SearchTree.d.ts.map +1 -1
  204. package/dist/widgets/views/Tree.d.ts +2 -0
  205. package/dist/widgets/views/Tree.d.ts.map +1 -1
  206. package/dist/widgets/views/searchFilter/DateRangePicker.d.ts +2 -2
  207. package/dist/widgets/views/searchFilter/DateRangePicker.d.ts.map +1 -1
  208. package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts +2 -2
  209. package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts.map +1 -1
  210. package/dist/widgets/views/searchFilter/SearchField.d.ts +2 -2
  211. package/dist/widgets/views/searchFilter/SearchField.d.ts.map +1 -1
  212. package/dist/widgets/views/searchFilter/SearchFilter.d.ts +3 -2
  213. package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
  214. package/package.json +14 -15
  215. package/src/__tests__/iconMapper.test.ts +20 -5
  216. package/src/__tests__/searchFilterHelper.spec.ts +7 -7
  217. package/src/actionbar/AttachmentsButton.tsx +22 -24
  218. package/src/actionbar/AttachmentsButtonWrapper.tsx +15 -12
  219. package/src/actionbar/ButtonWithBadge.tsx +5 -2
  220. package/src/actionbar/ChangeViewButton.tsx +13 -7
  221. package/src/actionbar/FormActionBar.tsx +73 -11
  222. package/src/actionbar/SearchBar.tsx +8 -4
  223. package/src/actionbar/TreeActionBar.tsx +99 -97
  224. package/src/common/DatePicker.tsx +18 -13
  225. package/src/context/ActionViewContext.tsx +7 -4
  226. package/src/context/ConfigContext.tsx +9 -0
  227. package/src/context/ContentRootContext.tsx +111 -76
  228. package/src/context/FormContext.tsx +1 -4
  229. package/src/helpers/errorHelper.ts +27 -0
  230. package/src/helpers/filesHelper.ts +2 -3
  231. package/src/helpers/formHelper.ts +26 -5
  232. package/src/helpers/iconMapper.ts +141 -108
  233. package/src/helpers/one2manyHelper.ts +94 -39
  234. package/src/helpers/searchHelper.ts +8 -7
  235. package/src/helpers/treeHelper.ts +17 -5
  236. package/src/hooks/useExport.ts +439 -0
  237. package/src/index.ts +6 -0
  238. package/src/locales/ca_ES.tsx +2 -0
  239. package/src/locales/en_US.tsx +2 -0
  240. package/src/locales/es_ES.tsx +2 -0
  241. package/src/stories/Binary.stories.tsx +4 -1
  242. package/src/stories/Boolean.stories.tsx +4 -1
  243. package/src/stories/Button.stories.tsx +4 -1
  244. package/src/stories/Char.stories.tsx +4 -1
  245. package/src/stories/FiberGrid.stories.tsx +4 -1
  246. package/src/stories/Float.stories.tsx +4 -1
  247. package/src/stories/FloatTime.stories.tsx +4 -1
  248. package/src/stories/Image.stories.tsx +4 -1
  249. package/src/stories/Integer.stories.tsx +4 -1
  250. package/src/stories/Label.stories.tsx +11 -9
  251. package/src/stories/Many2one.stories.tsx +4 -1
  252. package/src/stories/One2many.stories.tsx +4 -1
  253. package/src/stories/ProgressBar.stories.tsx +4 -1
  254. package/src/stories/Reference.stories.tsx +4 -1
  255. package/src/stories/Selection.stories.tsx +4 -1
  256. package/src/stories/Separator.stories.tsx +37 -1
  257. package/src/stories/Text.stories.tsx +4 -1
  258. package/src/stories/containers/Group.stories.tsx +28 -1
  259. package/src/stories/containers/NewLine.stories.tsx +4 -1
  260. package/src/stories/containers/Notebook.stories.tsx +31 -1
  261. package/src/stories/custom/Avatar.stories.tsx +27 -0
  262. package/src/stories/custom/ButtonGroup.stories.tsx +4 -1
  263. package/src/stories/custom/CodeEditor.stories.tsx +4 -1
  264. package/src/stories/custom/Indicator.stories.tsx +4 -1
  265. package/src/stories/custom/Markdown.stories.tsx +42 -0
  266. package/src/stories/custom/MultiCheckbox.stories.tsx +4 -1
  267. package/src/stories/custom/Radio.stories.tsx +4 -1
  268. package/src/stories/custom/Steps.stories.tsx +4 -1
  269. package/src/stories/custom/Switch.stories.tsx +4 -1
  270. package/src/stories/custom/Tag.stories.tsx +60 -0
  271. package/src/stories/custom/Tags.stories.tsx +4 -1
  272. package/src/stories/forms/PreferencesForm.stories.tsx +4 -1
  273. package/src/stories/mocks/models/company.ts +2 -2
  274. package/src/stories/mocks/models/crm_case.ts +7 -10
  275. package/src/stories/ui/ActionBar.stories.tsx +2 -1
  276. package/src/stories/ui/FavouriteButton.stories.tsx +2 -1
  277. package/src/stories/ui/GoToResourceModal.stories.tsx +2 -1
  278. package/src/stories/views/SearchTree.stories.tsx +3 -1
  279. package/src/stories/views/Tab.stories.tsx +3 -1
  280. package/src/stories/views/TabsAndContent.stories.tsx +3 -1
  281. package/src/stories/views/Tree.stories.jsx +20 -6
  282. package/src/stories/views/searchFilter/DateRangePicker.stories.tsx +3 -1
  283. package/src/stories/views/searchFilter/DateTimeRangePicker.stories.tsx +4 -1
  284. package/src/stories/views/searchFilter/PairFields.stories.tsx +4 -1
  285. package/src/stories/views/searchFilter/SearchFilter.stories.tsx +4 -1
  286. package/src/stories/views/searchFilter/examples/PartnersSearchFilter.stories.tsx +4 -1
  287. package/src/types/index.ts +1 -0
  288. package/src/ui/ActionErrorDialog.tsx +4 -21
  289. package/src/ui/ErrorAlert.tsx +37 -0
  290. package/src/ui/FavouriteButton.tsx +20 -9
  291. package/src/ui/GoToResourceModal.tsx +3 -3
  292. package/src/ui/TitleHeader.tsx +18 -4
  293. package/src/views/ActionView.tsx +6 -2
  294. package/src/views/RootView.tsx +7 -1
  295. package/src/views/actionViews/GraphActionView.tsx +1 -0
  296. package/src/views/actionViews/TreeActionView.tsx +10 -1
  297. package/src/views/tabs/Tab.tsx +12 -6
  298. package/src/widgets/WidgetFactory.tsx +6 -0
  299. package/src/widgets/base/Binary.tsx +8 -5
  300. package/src/widgets/base/Boolean.tsx +8 -7
  301. package/src/widgets/base/Char.tsx +14 -12
  302. package/src/widgets/base/Float.tsx +11 -5
  303. package/src/widgets/base/FloatTime.tsx +9 -5
  304. package/src/widgets/base/Integer.tsx +10 -5
  305. package/src/widgets/base/Label.tsx +12 -12
  306. package/src/widgets/base/LinkInput.tsx +11 -6
  307. package/src/widgets/base/MultiSelection.tsx +6 -2
  308. package/src/widgets/base/Reference.tsx +13 -3
  309. package/src/widgets/base/ReferenceTree.tsx +62 -0
  310. package/src/widgets/base/Selection.tsx +6 -2
  311. package/src/widgets/base/Separator.tsx +11 -3
  312. package/src/widgets/base/Text.tsx +14 -12
  313. package/src/widgets/base/many2one/Many2one.tsx +27 -33
  314. package/src/widgets/base/many2one/Many2oneSuffixModal.tsx +3 -3
  315. package/src/widgets/base/many2one/Many2oneTree.tsx +18 -0
  316. package/src/widgets/base/one2many/One2manyInput.tsx +82 -28
  317. package/src/widgets/base/one2many/One2manyTopBar.tsx +10 -1
  318. package/src/widgets/containers/Group.tsx +7 -4
  319. package/src/widgets/custom/Avatar.tsx +33 -0
  320. package/src/widgets/custom/ButtonGroup.tsx +31 -21
  321. package/src/widgets/custom/FiberGrid.tsx +2 -5
  322. package/src/widgets/custom/Indicator.tsx +16 -15
  323. package/src/widgets/custom/Markdown.tsx +22 -0
  324. package/src/widgets/custom/MultiCheckbox.tsx +1 -0
  325. package/src/widgets/custom/Tag.tsx +24 -0
  326. package/src/widgets/custom/Tags.tsx +27 -28
  327. package/src/widgets/custom/Timeline.tsx +9 -3
  328. package/src/widgets/modals/ExportModal.tsx +33 -134
  329. package/src/widgets/modals/FormModal.tsx +3 -3
  330. package/src/widgets/modals/SearchModal.tsx +29 -31
  331. package/src/widgets/modals/TranslationModal.tsx +3 -3
  332. package/src/widgets/views/Dashboard/Dashboard.tsx +15 -4
  333. package/src/widgets/views/Dashboard/DashboardTree.tsx +1 -0
  334. package/src/widgets/views/DashboardGrid/DashboardGridItem.tsx +10 -6
  335. package/src/widgets/views/Form.tsx +41 -39
  336. package/src/widgets/views/Graph/GraphChart.tsx +6 -1
  337. package/src/widgets/views/Graph/GraphDefaults.ts +113 -0
  338. package/src/widgets/views/Graph/GraphIndicator.tsx +19 -7
  339. package/src/widgets/views/SearchTree.tsx +3 -0
  340. package/src/widgets/views/Tree.tsx +118 -26
  341. package/src/widgets/views/searchFilter/SearchField.tsx +9 -23
  342. package/src/widgets/views/searchFilter/SearchFilter.tsx +17 -8
  343. package/dist/Config.d.ts +0 -6
  344. package/dist/Config.d.ts.map +0 -1
  345. package/dist/helpers/icons/antd_icons.d.ts +0 -4
  346. package/dist/helpers/icons/antd_icons.d.ts.map +0 -1
  347. package/dist/helpers/icons/tabler_icons.d.ts +0 -4
  348. package/dist/helpers/icons/tabler_icons.d.ts.map +0 -1
  349. package/dist/main.css +0 -1
  350. package/dist/ui/Fieldset.d.ts +0 -8
  351. package/dist/ui/Fieldset.d.ts.map +0 -1
  352. package/src/Config.ts +0 -4
  353. package/src/helpers/icons/antd_icons.ts +0 -1583
  354. package/src/helpers/icons/tabler_icons.ts +0 -5367
  355. package/src/ui/Fieldset.tsx +0 -31
@@ -49,6 +49,8 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
49
49
 
50
50
  useEffect(() => {
51
51
  if (!value) {
52
+ setSelectionValue(undefined);
53
+ setMany2oneValue([]);
52
54
  return;
53
55
  }
54
56
 
@@ -73,8 +75,16 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
73
75
  }
74
76
  onChange={(changedValue: string) => {
75
77
  setSelectionValue(changedValue);
76
- setMany2oneValue([]);
77
- onChange?.(undefined);
78
+ let m2oValue = many2oneValue[0] || 0;
79
+ if (changedValue !== selectionValue) {
80
+ setMany2oneValue([]);
81
+ m2oValue = 0;
82
+ }
83
+ const referenceValue = `${changedValue},${m2oValue}`;
84
+ if (referenceValue === value) {
85
+ return;
86
+ }
87
+ onChange?.(referenceValue);
78
88
  }}
79
89
  value={selectionValue}
80
90
  />
@@ -92,7 +102,7 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
92
102
  value={many2oneValue}
93
103
  onChange={(changedValue: any[]) => {
94
104
  setMany2oneValue(changedValue);
95
- const referenceValue = `${selectionValue},${changedValue[0]}`;
105
+ const referenceValue = `${selectionValue},${changedValue[0] || 0}`;
96
106
  if (referenceValue === value) {
97
107
  return;
98
108
  }
@@ -0,0 +1,62 @@
1
+ import ConnectionProvider from "@/ConnectionProvider";
2
+ import { Space } from "antd";
3
+ import React, { useCallback, useEffect, useState } from "react";
4
+ import { Many2oneSuffix } from "./many2one/Many2oneSuffix";
5
+ import { LoadingOutlined } from "@ant-design/icons";
6
+
7
+ export type ReferenceTreeProps = {
8
+ value: string;
9
+ context?: any;
10
+ selectionValues?: any;
11
+ };
12
+
13
+ export const ReferenceTree = (
14
+ props: ReferenceTreeProps
15
+ ): React.ReactElement => {
16
+ const { value, context, selectionValues } = props;
17
+ const [name, setName] = useState();
18
+ const [loading, setLoading] = useState(false);
19
+
20
+ const [model, id] = value ? value.split(",") : [];
21
+ const intId = parseInt(id);
22
+
23
+ const fetchName = useCallback(async () => {
24
+ if (!value) {
25
+ return;
26
+ }
27
+ if (value && name) {
28
+ return;
29
+ }
30
+ setLoading(true);
31
+ const nameResponse = await ConnectionProvider.getHandler().execute({
32
+ action: "name_get",
33
+ payload: [intId],
34
+ model,
35
+ context,
36
+ });
37
+ setName(nameResponse[0][1]);
38
+ setLoading(false);
39
+ }, [value, name]);
40
+
41
+ useEffect(() => {
42
+ fetchName();
43
+ }, [value]);
44
+
45
+ if (!value && !loading) {
46
+ return <></>;
47
+ }
48
+
49
+ if (loading) {
50
+ return <LoadingOutlined />;
51
+ }
52
+
53
+ const selectionDescription = selectionValues.get(model);
54
+
55
+ return (
56
+ <Space>
57
+ <>{`${selectionDescription}:`}</>
58
+ <>{name}</>
59
+ <Many2oneSuffix id={intId} model={model} />
60
+ </Space>
61
+ );
62
+ };
@@ -5,7 +5,11 @@ import styled from "styled-components";
5
5
  import Field from "@/common/Field";
6
6
  import { Selection as SelectionOoui } from "@gisce/ooui";
7
7
  import { WidgetProps } from "@/types";
8
- import Config from "@/Config";
8
+ import { theme } from "antd";
9
+
10
+ const { defaultAlgorithm, defaultSeed } = theme;
11
+
12
+ const mapToken = defaultAlgorithm(defaultSeed);
9
13
 
10
14
  const { Option } = Select;
11
15
 
@@ -56,6 +60,6 @@ export const SelectionInput = (props: SelectionInputProps) => {
56
60
 
57
61
  const RequiredSelect = styled(Select)`
58
62
  &.ant-select:not(.ant-select-customize-input) .ant-select-selector {
59
- background-color: ${Config.requiredColor};
63
+ background-color: ${mapToken.colorPrimaryBg};
60
64
  }
61
65
  `;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import { Divider } from "antd";
2
+ import { Divider, Space } from "antd";
3
3
  import { Separator as SeparatorOoui } from "@gisce/ooui";
4
+ import iconMapper from "@/helpers/iconMapper";
4
5
 
5
6
  type Props = {
6
7
  ooui: SeparatorOoui;
@@ -8,11 +9,18 @@ type Props = {
8
9
 
9
10
  export const Separator = (props: Props) => {
10
11
  const { ooui } = props;
11
- const { label } = ooui;
12
+ const { label, icon } = ooui;
13
+ const Icon : React.ElementType | undefined = iconMapper(icon || "");
14
+
12
15
 
13
16
  return (
14
17
  <Divider orientation="left" className="text-sm">
15
- {label}
18
+ { (Icon || label) &&
19
+ <Space>
20
+ {Icon ? <Icon /> : null}
21
+ {label}
22
+ </Space>
23
+ }
16
24
  </Divider>
17
25
  );
18
26
  };
@@ -1,7 +1,6 @@
1
- import React, { useContext, useState } from "react";
2
- import { Input, Row } from "antd";
1
+ import React, { CSSProperties, useContext, useState } from "react";
2
+ import { Input, Row, theme } from "antd";
3
3
  import Field from "@/common/Field";
4
- import Config from "@/Config";
5
4
  import { Text as TextOoui } from "@gisce/ooui";
6
5
  import { TranslationModal } from "../modals/TranslationModal";
7
6
  import { FormContext, FormContextType } from "@/context/FormContext";
@@ -9,6 +8,7 @@ import ButtonWithTooltip from "@/common/ButtonWithTooltip";
9
8
  import { TranslationOutlined } from "@ant-design/icons";
10
9
  import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
11
10
  import showInfo from "@/ui/InfoDialog";
11
+ const { useToken } = theme;
12
12
 
13
13
  const { TextArea } = Input;
14
14
 
@@ -19,8 +19,11 @@ type Props = {
19
19
  const Text = (props: Props) => {
20
20
  const { ooui } = props;
21
21
  const { id, readOnly, required, height, translatable } = ooui;
22
- const requiredClass =
23
- required && !readOnly ? Config.requiredClass : undefined;
22
+ const { token } = useToken();
23
+ const requiredStyle =
24
+ required && !readOnly
25
+ ? { backgroundColor: token.colorPrimaryBg }
26
+ : undefined;
24
27
  const formContext = useContext(FormContext) as FormContextType;
25
28
  const { elementHasLostFocus } = formContext || {};
26
29
 
@@ -29,14 +32,13 @@ const Text = (props: Props) => {
29
32
  {translatable ? (
30
33
  <TranslatableText
31
34
  field={id}
32
- requiredClass={requiredClass}
33
35
  height={height}
36
+ requiredStyle={requiredStyle}
34
37
  />
35
38
  ) : (
36
39
  <TextArea
37
40
  disabled={readOnly || translatable}
38
- className={requiredClass}
39
- style={{ height: height ? height + "px" : "100%" }}
41
+ style={{ height: height ? height + "px" : "100%", ...requiredStyle }}
40
42
  rows={4}
41
43
  onBlur={elementHasLostFocus}
42
44
  />
@@ -48,13 +50,13 @@ const Text = (props: Props) => {
48
50
  const TranslatableText = ({
49
51
  value,
50
52
  field,
51
- requiredClass,
53
+ requiredStyle,
52
54
  onChange,
53
55
  height,
54
56
  }: {
55
57
  value?: string;
56
58
  field: string;
57
- requiredClass: string | undefined;
59
+ requiredStyle: CSSProperties | undefined;
58
60
  height: number | undefined;
59
61
  onChange?: (value: string) => void;
60
62
  }) => {
@@ -80,9 +82,9 @@ const TranslatableText = ({
80
82
  }}
81
83
  style={{
82
84
  height: height ? height + "px" : "100%",
85
+ ...requiredStyle
83
86
  }}
84
87
  id={field}
85
- className={requiredClass}
86
88
  rows={4}
87
89
  onBlur={elementHasLostFocus}
88
90
  />
@@ -128,10 +130,10 @@ const TranslatableText = ({
128
130
  style={{
129
131
  height: height ? height + "px" : "100%",
130
132
  cursor: "pointer",
133
+ ...requiredStyle
131
134
  }}
132
135
  id={field}
133
136
  disabled={true}
134
- className={requiredClass}
135
137
  rows={4}
136
138
  onBlur={elementHasLostFocus}
137
139
  />
@@ -6,13 +6,17 @@ import {
6
6
  LoadingOutlined,
7
7
  } from "@ant-design/icons";
8
8
  import styled from "styled-components";
9
+ import { theme } from "antd";
10
+
11
+ const { defaultAlgorithm, defaultSeed } = theme;
12
+
13
+ const mapToken = defaultAlgorithm(defaultSeed);
9
14
 
10
15
  import {
11
16
  Many2one as Many2oneOoui,
12
17
  transformDomainForChildWidget,
13
18
  } from "@gisce/ooui";
14
19
  import Field from "@/common/Field";
15
- import Config from "@/Config";
16
20
  import { SearchModal } from "@/widgets/modals/SearchModal";
17
21
  import { FormModal } from "@/widgets/modals/FormModal";
18
22
  import ConnectionProvider from "@/ConnectionProvider";
@@ -65,8 +69,10 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
65
69
  id: fieldName,
66
70
  domain: widgetDomain,
67
71
  } = ooui;
68
- const requiredClass =
69
- required && !readOnly ? Config.requiredClass : undefined;
72
+ const requiredStyle =
73
+ required && !readOnly
74
+ ? { backgroundColor: mapToken.colorPrimaryBg }
75
+ : undefined;
70
76
  const [showSearchModal, setShowSearchModal] = useState<boolean>(false);
71
77
  const [showFormModal, setShowFormModal] = useState<boolean>(false);
72
78
  const [searching, setSearching] = useState<boolean>(false);
@@ -75,14 +81,8 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
75
81
  const [inputText, setInputText] = useState<string>("");
76
82
  const inputTextRef = useRef<string>();
77
83
  const formContext = useContext(FormContext) as FormContextType;
78
- const {
79
- domain,
80
- getValues,
81
- getFields,
82
- getContext,
83
- setOriginalValue,
84
- elementHasLostFocus,
85
- } = formContext || {};
84
+ const { domain, getValues, getFields, getContext, elementHasLostFocus } =
85
+ formContext || {};
86
86
  const transformedDomain = useRef<any[]>([]);
87
87
  const [searchDomain, setSearchDomain] = useState<any>([]);
88
88
 
@@ -132,13 +132,12 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
132
132
  if (transformedDomain.current && transformedDomain.current.length > 0) {
133
133
  tryFetchFirstResultOrShowSearch(inputTextRef.current as string);
134
134
  } else {
135
- const results: any[] = await ConnectionProvider.getHandler().nameSearch(
136
- {
135
+ const results: any[] =
136
+ await ConnectionProvider.getHandler().nameSearch({
137
137
  model: relation,
138
138
  payload: inputTextRef.current as string,
139
139
  context: { ...getContext?.(), ...context },
140
- }
141
- );
140
+ });
142
141
 
143
142
  if (results.length === 1) {
144
143
  inputTextRef.current = undefined;
@@ -167,7 +166,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
167
166
  });
168
167
 
169
168
  if (resultIds.length === 1) {
170
- fetchNameAndUpdate(resultIds[0], true);
169
+ fetchNameAndUpdate(resultIds[0]);
171
170
  } else {
172
171
  setSearchText(text);
173
172
  setShowSearchModal(true);
@@ -179,10 +178,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
179
178
  setShowSearchModal(true);
180
179
  };
181
180
 
182
- const fetchNameAndUpdate = async (
183
- id: number,
184
- mustUpdateOriginalForm?: boolean
185
- ) => {
181
+ const fetchNameAndUpdate = async (id: number) => {
186
182
  setSearching(true);
187
183
 
188
184
  try {
@@ -194,10 +190,6 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
194
190
  });
195
191
 
196
192
  triggerChange([id, value[0][1]]);
197
-
198
- if (mustUpdateOriginalForm) {
199
- setOriginalValue(ooui.id, [id, value[0][1]]);
200
- }
201
193
  } catch (err) {
202
194
  showErrorDialog(err);
203
195
  } finally {
@@ -207,16 +199,16 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
207
199
 
208
200
  async function parseDomain() {
209
201
  if (widgetDomain) {
210
- transformedDomain.current = await ConnectionProvider.getHandler().evalDomain(
211
- {
202
+ transformedDomain.current =
203
+ await ConnectionProvider.getHandler().evalDomain({
212
204
  domain: widgetDomain,
213
205
  values: transformPlainMany2Ones({
214
206
  fields: getFields(),
215
207
  values: getValues(),
216
208
  }),
209
+ fields: getFields(),
217
210
  context: getContext(),
218
- }
219
- );
211
+ });
220
212
  }
221
213
 
222
214
  if (domain && domain.length > 0) {
@@ -232,7 +224,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
232
224
  }
233
225
 
234
226
  async function onKeyDown(event: any) {
235
- if (event.code === "Enter") {
227
+ if (event.keyCode === 13) {
236
228
  event.preventDefault();
237
229
  event.stopPropagation();
238
230
  await onElementLostFocus();
@@ -253,7 +245,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
253
245
  value={inputText}
254
246
  disabled={readOnly}
255
247
  onChange={onValueStringChange}
256
- className={requiredClass}
248
+ style={requiredStyle}
257
249
  onBlur={onElementLostFocus}
258
250
  onKeyDown={onKeyDown}
259
251
  suffix={
@@ -265,17 +257,18 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
265
257
  }
266
258
  />
267
259
  </Col>
268
- <Col flex="32px">
260
+ <Col flex="32px" style={{ paddingRight: 0 }}>
269
261
  <Button
270
262
  icon={<FolderOpenOutlined />}
271
263
  disabled={id === undefined || text === "" || inputText === undefined}
272
264
  onClick={() => {
273
265
  setShowFormModal(true);
274
266
  }}
267
+ style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
275
268
  tabIndex={-1}
276
269
  />
277
270
  </Col>
278
- <Col flex="32px">
271
+ <Col flex="32px" style={{ paddingLeft: 0 }}>
279
272
  <Button
280
273
  icon={searching ? <LoadingOutlined /> : <SearchOutlined />}
281
274
  disabled={readOnly || searching}
@@ -283,6 +276,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
283
276
  searchButtonTappedRef.current = true;
284
277
  tryFetchFirstResultOrShowSearch(text);
285
278
  }}
279
+ style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }}
286
280
  tabIndex={-1}
287
281
  />
288
282
  </Col>
@@ -324,6 +318,6 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
324
318
 
325
319
  const RequiredInput = styled(Input)`
326
320
  .ant-input {
327
- background-color: ${Config.requiredColor};
321
+ background-color: ${mapToken.colorPrimaryBg};
328
322
  }
329
323
  `;
@@ -14,10 +14,10 @@ export const Many2oneSuffixModal = (props: Props) => {
14
14
  const { t } = useContext(LocaleContext) as LocaleContextType;
15
15
 
16
16
  return (
17
- <Modal
17
+ (<Modal
18
18
  title={t("selectAction")}
19
19
  centered
20
- visible={visible}
20
+ open={visible}
21
21
  footer={null}
22
22
  destroyOnClose
23
23
  onCancel={onCancel}
@@ -37,6 +37,6 @@ export const Many2oneSuffixModal = (props: Props) => {
37
37
  );
38
38
  })}
39
39
  </Space>
40
- </Modal>
40
+ </Modal>)
41
41
  );
42
42
  };
@@ -0,0 +1,18 @@
1
+ import { Space } from "antd";
2
+ import React from "react";
3
+ import { Many2oneSuffix } from "./Many2oneSuffix";
4
+
5
+ export type Many2oneTreeProps = { m2oField: any };
6
+
7
+ export const Many2oneTree = (props: Many2oneTreeProps): React.ReactElement => {
8
+ const { m2oField } = props;
9
+ if (!m2oField) {
10
+ return <></>;
11
+ }
12
+ return (
13
+ <Space>
14
+ <>{m2oField.value}</>
15
+ <Many2oneSuffix id={m2oField.id} model={m2oField.model} />
16
+ </Space>
17
+ );
18
+ };
@@ -1,4 +1,10 @@
1
- import React, { useState, useRef, useContext, useEffect } from "react";
1
+ import React, {
2
+ useState,
3
+ useRef,
4
+ useContext,
5
+ useEffect,
6
+ useCallback,
7
+ } from "react";
2
8
  import { One2many as One2manyOoui } from "@gisce/ooui";
3
9
  import { Alert, Spin } from "antd";
4
10
  import { Form } from "@/index";
@@ -25,7 +31,7 @@ import { One2manyTopBar } from "@/widgets/base/one2many/One2manyTopBar";
25
31
  import { readObjectValues, getNextPendingId } from "@/helpers/one2manyHelper";
26
32
  import { SearchModal } from "@/widgets/modals/SearchModal";
27
33
  import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
28
- import { sortResults } from "@/helpers/treeHelper";
34
+ import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
29
35
  import { transformPlainMany2Ones } from "@/helpers/formHelper";
30
36
 
31
37
  type One2manyValue = {
@@ -83,7 +89,6 @@ const One2manyInput: React.FC<One2manyInputProps> = (
83
89
  formContext || {};
84
90
  const { lang, t } = useContext(LocaleContext) as LocaleContextType;
85
91
 
86
- const formRef = useRef();
87
92
  const [formHasChanges, setFormHasChanges] = useState<boolean>(false);
88
93
  const [isLoading, setIsLoading] = useState<boolean>(false);
89
94
  const [error, setError] = useState<string>();
@@ -96,6 +101,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
96
101
  const transformedDomain = useRef<any[]>([]);
97
102
  const [sorter, setSorter] = useState<any>();
98
103
  const originalSortItemIds = useRef<number[]>();
104
+ const [colorsForResults, setColorsForResults] = useState<any>(undefined);
99
105
 
100
106
  const {
101
107
  readOnly,
@@ -106,14 +112,31 @@ const One2manyInput: React.FC<One2manyInputProps> = (
106
112
  const isMany2many = ooui.type === "many2many";
107
113
  const { id: fieldName } = ooui;
108
114
  const itemsToShow = items.filter(
109
- (item) => item.values && item.operation !== "pendingRemove"
115
+ (item) =>
116
+ (item.values || item.treeValues) && item.operation !== "pendingRemove"
110
117
  );
118
+ const previousCurrentView = useRef<ViewType>();
111
119
 
112
120
  useEffect(() => {
113
- if (items.some((item) => !item.values)) {
121
+ if (previousCurrentView.current !== currentView) {
122
+ previousCurrentView.current = currentView;
123
+ fetchDataIfNeeded();
124
+ return;
125
+ }
126
+
127
+ fetchDataIfNeeded();
128
+ }, [items, currentView]);
129
+
130
+ const fetchDataIfNeeded = useCallback(() => {
131
+ if (currentView === "form" && items.some((item) => !item.values)) {
132
+ fetchData();
133
+ } else if (
134
+ currentView === "tree" &&
135
+ items.some((item) => !item.treeValues)
136
+ ) {
114
137
  fetchData();
115
138
  }
116
- }, [items]);
139
+ }, [items, currentView]);
117
140
 
118
141
  useEffect(() => {
119
142
  parseDomain();
@@ -133,25 +156,36 @@ const One2manyInput: React.FC<One2manyInputProps> = (
133
156
  }
134
157
  };
135
158
 
136
- const fetchOriginalItemsFromApi = async () => {
159
+ const fetchOriginalItemsFromApi = async (mode?: ViewType) => {
137
160
  setIsLoading(true);
138
161
  setFormHasChanges(false);
139
162
  setError(undefined);
140
163
 
141
164
  try {
142
- const itemsWithValues = await readObjectValues({
143
- treeFields: views.get("tree").fields,
144
- formFields: views.get("form")?.fields || {},
165
+ const [itemsWithValues, evaluatedColorsForTree] = await readObjectValues({
166
+ treeView: {
167
+ arch: views.get("tree")?.arch,
168
+ fields: views.get("tree")?.fields,
169
+ },
170
+ formView: {
171
+ fields: views.get("form")?.fields || {},
172
+ },
145
173
  model: relation,
146
174
  items,
147
175
  context: { ...getContext?.(), ...context },
176
+ currentView: mode || currentView,
148
177
  });
149
178
 
150
179
  if (!originalSortItemIds.current) {
151
180
  originalSortItemIds.current = itemsWithValues.map((item) => item.id!);
152
181
  }
153
182
 
183
+ if ((currentView || mode) === "tree" && evaluatedColorsForTree) {
184
+ setColorsForResults(evaluatedColorsForTree);
185
+ }
186
+
154
187
  triggerChange(itemsWithValues);
188
+ return itemsWithValues;
155
189
  } catch (err) {
156
190
  setError(err as any);
157
191
  } finally {
@@ -161,17 +195,16 @@ const One2manyInput: React.FC<One2manyInputProps> = (
161
195
 
162
196
  async function parseDomain() {
163
197
  if (widgetDomain) {
164
- transformedDomain.current = transformDomainForChildWidget({
165
- domain: await ConnectionProvider.getHandler().evalDomain({
198
+ transformedDomain.current =
199
+ await ConnectionProvider.getHandler().evalDomain({
166
200
  domain: widgetDomain,
167
201
  values: transformPlainMany2Ones({
168
202
  fields: getFields(),
169
203
  values: getValues(),
170
204
  }),
205
+ fields: getFields(),
171
206
  context: getContext(),
172
- }),
173
- widgetFieldName: fieldName,
174
- });
207
+ });
175
208
  }
176
209
 
177
210
  if (domain && domain.length > 0) {
@@ -437,10 +470,19 @@ const One2manyInput: React.FC<One2manyInputProps> = (
437
470
  }
438
471
  };
439
472
 
440
- const onTreeRowClicked = (record: any) => {
473
+ const onTreeRowClicked = async (record: any) => {
441
474
  const { id: itemId } = record;
475
+
476
+ let itemsToLoadFrom: One2manyItem[] | undefined = items;
477
+
478
+ // We should fetch the form data if needed in order to get the form values
479
+ const modalItem = items.find((item) => item.id === itemId);
480
+ if (modalItem?.values === undefined) {
481
+ itemsToLoadFrom = await fetchOriginalItemsFromApi("form");
482
+ }
483
+
442
484
  // We show the detail for the clicked item in a Form modal
443
- setModalItem(items.find((item) => item.id === itemId));
485
+ setModalItem(itemsToLoadFrom!.find((item) => item.id === itemId));
444
486
  setContinuousEntryMode(false);
445
487
  setShowFormModal(true);
446
488
  };
@@ -506,12 +548,18 @@ const One2manyInput: React.FC<One2manyInputProps> = (
506
548
  return t("noCurrentEntries");
507
549
  }
508
550
 
551
+ if (
552
+ currentView !== previousCurrentView.current &&
553
+ items.some((item) => !item.values)
554
+ ) {
555
+ return <Spin />;
556
+ }
557
+
509
558
  return (
510
559
  <Form
511
560
  formView={views.get("form")}
512
561
  values={itemsToShow[itemIndex]?.values}
513
562
  parentContext={{ ...getContext?.(), ...context }}
514
- ref={formRef}
515
563
  model={relation}
516
564
  id={itemsToShow[itemIndex]?.id}
517
565
  submitMode={"values"}
@@ -542,16 +590,20 @@ const One2manyInput: React.FC<One2manyInputProps> = (
542
590
  );
543
591
  }
544
592
 
545
- const resultsToShow = sorter
546
- ? sortResults({
547
- resultsToSort: itemsToShow.map((item) => item.treeValues),
548
- sorter,
549
- fields: {
550
- ...views.get("tree").fields,
551
- ...(views.get("form")?.fields || {}),
552
- },
553
- })
554
- : itemsToShow.map((item) => item.treeValues);
593
+ let resultsToShow = [];
594
+
595
+ if (itemsToShow.some((item) => item.treeValues)) {
596
+ resultsToShow = sorter
597
+ ? sortResults({
598
+ resultsToSort: itemsToShow.map((item) => item.treeValues),
599
+ sorter,
600
+ fields: {
601
+ ...views.get("tree").fields,
602
+ ...(views.get("form")?.fields || {}),
603
+ },
604
+ })
605
+ : itemsToShow.map((item) => item.treeValues);
606
+ }
555
607
 
556
608
  if (currentView === "tree") {
557
609
  return (
@@ -573,6 +625,8 @@ const One2manyInput: React.FC<One2manyInputProps> = (
573
625
  }}
574
626
  sorter={sorter}
575
627
  onChangeSort={setSorter}
628
+ context={{ ...getContext?.(), ...context }}
629
+ colorsForResults={colorsForResults}
576
630
  />
577
631
  );
578
632
  }