@gisce/react-ooui 1.2.0-rc.8 → 1.2.0-rc.82

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 (347) 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/formHelper.d.ts +5 -3
  42. package/dist/helpers/formHelper.d.ts.map +1 -1
  43. package/dist/helpers/iconMapper.d.ts +11 -2
  44. package/dist/helpers/iconMapper.d.ts.map +1 -1
  45. package/dist/helpers/one2manyHelper.d.ts +12 -4
  46. package/dist/helpers/one2manyHelper.d.ts.map +1 -1
  47. package/dist/helpers/searchHelper.d.ts +1 -1
  48. package/dist/helpers/searchHelper.d.ts.map +1 -1
  49. package/dist/helpers/treeHelper.d.ts +1 -1
  50. package/dist/helpers/treeHelper.d.ts.map +1 -1
  51. package/dist/hooks/useExport.d.ts +44 -0
  52. package/dist/hooks/useExport.d.ts.map +1 -0
  53. package/dist/index.d.ts +4 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/locales/ca_ES.d.ts +2 -0
  56. package/dist/locales/ca_ES.d.ts.map +1 -1
  57. package/dist/locales/en_US.d.ts +2 -0
  58. package/dist/locales/en_US.d.ts.map +1 -1
  59. package/dist/locales/es_ES.d.ts +2 -0
  60. package/dist/locales/es_ES.d.ts.map +1 -1
  61. package/dist/react-ooui.es.js +25826 -27484
  62. package/dist/react-ooui.es.js.map +1 -1
  63. package/dist/react-ooui.umd.js +180 -215
  64. package/dist/react-ooui.umd.js.map +1 -1
  65. package/dist/types/index.d.ts +1 -0
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/ui/ActionErrorDialog.d.ts.map +1 -1
  68. package/dist/ui/ErrorAlert.d.ts +6 -0
  69. package/dist/ui/ErrorAlert.d.ts.map +1 -0
  70. package/dist/ui/FavouriteButton.d.ts +2 -2
  71. package/dist/ui/FavouriteButton.d.ts.map +1 -1
  72. package/dist/ui/GoToResourceModal.d.ts +2 -2
  73. package/dist/ui/GoToResourceModal.d.ts.map +1 -1
  74. package/dist/ui/TitleHeader.d.ts +2 -2
  75. package/dist/ui/TitleHeader.d.ts.map +1 -1
  76. package/dist/views/ActionView.d.ts.map +1 -1
  77. package/dist/views/CurrentTabContent.d.ts +2 -2
  78. package/dist/views/CurrentTabContent.d.ts.map +1 -1
  79. package/dist/views/RootView.d.ts.map +1 -1
  80. package/dist/views/TabContent.d.ts +1 -1
  81. package/dist/views/TabContent.d.ts.map +1 -1
  82. package/dist/views/TabSelector.d.ts +2 -2
  83. package/dist/views/TabSelector.d.ts.map +1 -1
  84. package/dist/views/actionViews/DashboardActionView.d.ts +2 -2
  85. package/dist/views/actionViews/DashboardActionView.d.ts.map +1 -1
  86. package/dist/views/actionViews/FormActionView.d.ts +2 -2
  87. package/dist/views/actionViews/FormActionView.d.ts.map +1 -1
  88. package/dist/views/actionViews/GraphActionView.d.ts +2 -2
  89. package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
  90. package/dist/views/actionViews/TreeActionView.d.ts +2 -2
  91. package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
  92. package/dist/views/tabs/Tab.d.ts +2 -2
  93. package/dist/views/tabs/Tab.d.ts.map +1 -1
  94. package/dist/widgets/WidgetFactory.d.ts.map +1 -1
  95. package/dist/widgets/base/Binary.d.ts +3 -3
  96. package/dist/widgets/base/Binary.d.ts.map +1 -1
  97. package/dist/widgets/base/Boolean.d.ts +2 -2
  98. package/dist/widgets/base/Boolean.d.ts.map +1 -1
  99. package/dist/widgets/base/Button.d.ts +2 -2
  100. package/dist/widgets/base/Button.d.ts.map +1 -1
  101. package/dist/widgets/base/Char.d.ts +2 -2
  102. package/dist/widgets/base/Char.d.ts.map +1 -1
  103. package/dist/widgets/base/Date.d.ts +2 -2
  104. package/dist/widgets/base/Date.d.ts.map +1 -1
  105. package/dist/widgets/base/DateTime.d.ts +2 -2
  106. package/dist/widgets/base/DateTime.d.ts.map +1 -1
  107. package/dist/widgets/base/Email.d.ts +2 -2
  108. package/dist/widgets/base/Email.d.ts.map +1 -1
  109. package/dist/widgets/base/Float.d.ts +2 -2
  110. package/dist/widgets/base/Float.d.ts.map +1 -1
  111. package/dist/widgets/base/FloatTime.d.ts +1 -1
  112. package/dist/widgets/base/FloatTime.d.ts.map +1 -1
  113. package/dist/widgets/base/Image.d.ts +3 -3
  114. package/dist/widgets/base/Image.d.ts.map +1 -1
  115. package/dist/widgets/base/Integer.d.ts +2 -2
  116. package/dist/widgets/base/Integer.d.ts.map +1 -1
  117. package/dist/widgets/base/Label.d.ts +2 -2
  118. package/dist/widgets/base/Label.d.ts.map +1 -1
  119. package/dist/widgets/base/LinkInput.d.ts +2 -2
  120. package/dist/widgets/base/LinkInput.d.ts.map +1 -1
  121. package/dist/widgets/base/MultiSelection.d.ts +3 -3
  122. package/dist/widgets/base/MultiSelection.d.ts.map +1 -1
  123. package/dist/widgets/base/ProgressBar.d.ts +3 -3
  124. package/dist/widgets/base/ProgressBar.d.ts.map +1 -1
  125. package/dist/widgets/base/Reference.d.ts +1 -1
  126. package/dist/widgets/base/Reference.d.ts.map +1 -1
  127. package/dist/widgets/base/ReferenceTree.d.ts +8 -0
  128. package/dist/widgets/base/ReferenceTree.d.ts.map +1 -0
  129. package/dist/widgets/base/Selection.d.ts +3 -3
  130. package/dist/widgets/base/Selection.d.ts.map +1 -1
  131. package/dist/widgets/base/Separator.d.ts +2 -2
  132. package/dist/widgets/base/Separator.d.ts.map +1 -1
  133. package/dist/widgets/base/Text.d.ts +2 -2
  134. package/dist/widgets/base/Text.d.ts.map +1 -1
  135. package/dist/widgets/base/Url.d.ts +2 -2
  136. package/dist/widgets/base/Url.d.ts.map +1 -1
  137. package/dist/widgets/base/many2one/Many2one.d.ts +1 -1
  138. package/dist/widgets/base/many2one/Many2one.d.ts.map +1 -1
  139. package/dist/widgets/base/many2one/Many2oneSuffix.d.ts +2 -2
  140. package/dist/widgets/base/many2one/Many2oneSuffix.d.ts.map +1 -1
  141. package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts +2 -2
  142. package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts.map +1 -1
  143. package/dist/widgets/base/many2one/Many2oneTree.d.ts +6 -0
  144. package/dist/widgets/base/many2one/Many2oneTree.d.ts.map +1 -0
  145. package/dist/widgets/base/one2many/One2many.d.ts +2 -2
  146. package/dist/widgets/base/one2many/One2many.d.ts.map +1 -1
  147. package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
  148. package/dist/widgets/base/one2many/One2manyTopBar.d.ts +2 -2
  149. package/dist/widgets/base/one2many/One2manyTopBar.d.ts.map +1 -1
  150. package/dist/widgets/containers/Group.d.ts.map +1 -1
  151. package/dist/widgets/custom/ButtonGroup.d.ts +2 -2
  152. package/dist/widgets/custom/ButtonGroup.d.ts.map +1 -1
  153. package/dist/widgets/custom/CodeEditor.d.ts +2 -2
  154. package/dist/widgets/custom/CodeEditor.d.ts.map +1 -1
  155. package/dist/widgets/custom/FiberGrid.d.ts +3 -3
  156. package/dist/widgets/custom/FiberGrid.d.ts.map +1 -1
  157. package/dist/widgets/custom/Indicator.d.ts +2 -2
  158. package/dist/widgets/custom/Indicator.d.ts.map +1 -1
  159. package/dist/widgets/custom/Markdown.d.ts +5 -0
  160. package/dist/widgets/custom/Markdown.d.ts.map +1 -0
  161. package/dist/widgets/custom/MultiCheckbox.d.ts +3 -3
  162. package/dist/widgets/custom/MultiCheckbox.d.ts.map +1 -1
  163. package/dist/widgets/custom/Radio.d.ts +3 -3
  164. package/dist/widgets/custom/Radio.d.ts.map +1 -1
  165. package/dist/widgets/custom/Steps.d.ts +3 -3
  166. package/dist/widgets/custom/Steps.d.ts.map +1 -1
  167. package/dist/widgets/custom/Switch.d.ts +2 -2
  168. package/dist/widgets/custom/Switch.d.ts.map +1 -1
  169. package/dist/widgets/custom/Tag.d.ts +5 -0
  170. package/dist/widgets/custom/Tag.d.ts.map +1 -0
  171. package/dist/widgets/custom/Tags.d.ts +3 -3
  172. package/dist/widgets/custom/Tags.d.ts.map +1 -1
  173. package/dist/widgets/custom/Timeline.d.ts +3 -3
  174. package/dist/widgets/custom/Timeline.d.ts.map +1 -1
  175. package/dist/widgets/modals/ExportModal.d.ts +4 -3
  176. package/dist/widgets/modals/ExportModal.d.ts.map +1 -1
  177. package/dist/widgets/modals/FormModal.d.ts +2 -2
  178. package/dist/widgets/modals/FormModal.d.ts.map +1 -1
  179. package/dist/widgets/modals/SearchModal.d.ts +2 -2
  180. package/dist/widgets/modals/SearchModal.d.ts.map +1 -1
  181. package/dist/widgets/modals/TranslationModal.d.ts +2 -2
  182. package/dist/widgets/modals/TranslationModal.d.ts.map +1 -1
  183. package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
  184. package/dist/widgets/views/Dashboard/DashboardForm.d.ts +2 -2
  185. package/dist/widgets/views/Dashboard/DashboardForm.d.ts.map +1 -1
  186. package/dist/widgets/views/Dashboard/DashboardTree.d.ts +2 -2
  187. package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
  188. package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts +2 -2
  189. package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts.map +1 -1
  190. package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts +2 -2
  191. package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts.map +1 -1
  192. package/dist/widgets/views/Form.d.ts.map +1 -1
  193. package/dist/widgets/views/Graph/GraphChart.d.ts +2 -2
  194. package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
  195. package/dist/widgets/views/Graph/GraphDefaults.d.ts +36 -0
  196. package/dist/widgets/views/Graph/GraphDefaults.d.ts.map +1 -1
  197. package/dist/widgets/views/Graph/GraphIndicator.d.ts +2 -2
  198. package/dist/widgets/views/Graph/GraphIndicator.d.ts.map +1 -1
  199. package/dist/widgets/views/SearchTree.d.ts.map +1 -1
  200. package/dist/widgets/views/Tree.d.ts +2 -0
  201. package/dist/widgets/views/Tree.d.ts.map +1 -1
  202. package/dist/widgets/views/searchFilter/DateRangePicker.d.ts +2 -2
  203. package/dist/widgets/views/searchFilter/DateRangePicker.d.ts.map +1 -1
  204. package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts +2 -2
  205. package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts.map +1 -1
  206. package/dist/widgets/views/searchFilter/SearchField.d.ts +2 -2
  207. package/dist/widgets/views/searchFilter/SearchField.d.ts.map +1 -1
  208. package/dist/widgets/views/searchFilter/SearchFilter.d.ts +3 -2
  209. package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
  210. package/package.json +11 -13
  211. package/src/__tests__/iconMapper.test.ts +20 -5
  212. package/src/__tests__/searchFilterHelper.spec.ts +7 -7
  213. package/src/actionbar/AttachmentsButton.tsx +22 -24
  214. package/src/actionbar/AttachmentsButtonWrapper.tsx +15 -12
  215. package/src/actionbar/ButtonWithBadge.tsx +5 -2
  216. package/src/actionbar/ChangeViewButton.tsx +13 -7
  217. package/src/actionbar/FormActionBar.tsx +73 -11
  218. package/src/actionbar/TreeActionBar.tsx +99 -97
  219. package/src/common/DatePicker.tsx +18 -13
  220. package/src/context/ActionViewContext.tsx +7 -4
  221. package/src/context/ConfigContext.tsx +9 -0
  222. package/src/context/ContentRootContext.tsx +123 -81
  223. package/src/context/FormContext.tsx +1 -4
  224. package/src/helpers/errorHelper.ts +27 -0
  225. package/src/helpers/formHelper.ts +26 -5
  226. package/src/helpers/iconMapper.ts +141 -108
  227. package/src/helpers/one2manyHelper.ts +94 -39
  228. package/src/helpers/searchHelper.ts +8 -7
  229. package/src/helpers/treeHelper.ts +17 -5
  230. package/src/hooks/useExport.ts +439 -0
  231. package/src/index.ts +6 -0
  232. package/src/locales/ca_ES.tsx +2 -0
  233. package/src/locales/en_US.tsx +2 -0
  234. package/src/locales/es_ES.tsx +2 -0
  235. package/src/stories/Binary.stories.tsx +4 -1
  236. package/src/stories/Boolean.stories.tsx +4 -1
  237. package/src/stories/Button.stories.tsx +4 -1
  238. package/src/stories/Char.stories.tsx +4 -1
  239. package/src/stories/FiberGrid.stories.tsx +4 -1
  240. package/src/stories/Float.stories.tsx +4 -1
  241. package/src/stories/FloatTime.stories.tsx +4 -1
  242. package/src/stories/Image.stories.tsx +4 -1
  243. package/src/stories/Integer.stories.tsx +4 -1
  244. package/src/stories/Label.stories.tsx +11 -9
  245. package/src/stories/Many2one.stories.tsx +4 -1
  246. package/src/stories/One2many.stories.tsx +4 -1
  247. package/src/stories/ProgressBar.stories.tsx +4 -1
  248. package/src/stories/Reference.stories.tsx +4 -1
  249. package/src/stories/Selection.stories.tsx +4 -1
  250. package/src/stories/Separator.stories.tsx +37 -1
  251. package/src/stories/Text.stories.tsx +4 -1
  252. package/src/stories/containers/Group.stories.tsx +28 -1
  253. package/src/stories/containers/NewLine.stories.tsx +4 -1
  254. package/src/stories/containers/Notebook.stories.tsx +31 -1
  255. package/src/stories/custom/ButtonGroup.stories.tsx +4 -1
  256. package/src/stories/custom/CodeEditor.stories.tsx +4 -1
  257. package/src/stories/custom/Indicator.stories.tsx +4 -1
  258. package/src/stories/custom/Markdown.stories.tsx +42 -0
  259. package/src/stories/custom/MultiCheckbox.stories.tsx +4 -1
  260. package/src/stories/custom/Radio.stories.tsx +4 -1
  261. package/src/stories/custom/Steps.stories.tsx +4 -1
  262. package/src/stories/custom/Switch.stories.tsx +4 -1
  263. package/src/stories/custom/Tag.stories.tsx +60 -0
  264. package/src/stories/custom/Tags.stories.tsx +4 -1
  265. package/src/stories/forms/PreferencesForm.stories.tsx +4 -1
  266. package/src/stories/mocks/models/company.ts +2 -2
  267. package/src/stories/mocks/models/crm_case.ts +7 -10
  268. package/src/stories/ui/ActionBar.stories.tsx +2 -1
  269. package/src/stories/ui/FavouriteButton.stories.tsx +2 -1
  270. package/src/stories/ui/GoToResourceModal.stories.tsx +2 -1
  271. package/src/stories/views/SearchTree.stories.tsx +3 -1
  272. package/src/stories/views/Tab.stories.tsx +3 -1
  273. package/src/stories/views/TabsAndContent.stories.tsx +3 -1
  274. package/src/stories/views/Tree.stories.jsx +9 -6
  275. package/src/stories/views/searchFilter/DateRangePicker.stories.tsx +3 -1
  276. package/src/stories/views/searchFilter/DateTimeRangePicker.stories.tsx +4 -1
  277. package/src/stories/views/searchFilter/PairFields.stories.tsx +4 -1
  278. package/src/stories/views/searchFilter/SearchFilter.stories.tsx +4 -1
  279. package/src/stories/views/searchFilter/examples/PartnersSearchFilter.stories.tsx +4 -1
  280. package/src/types/index.ts +1 -0
  281. package/src/ui/ActionErrorDialog.tsx +4 -21
  282. package/src/ui/ErrorAlert.tsx +37 -0
  283. package/src/ui/FavouriteButton.tsx +20 -9
  284. package/src/ui/GoToResourceModal.tsx +3 -3
  285. package/src/ui/TitleHeader.tsx +18 -4
  286. package/src/views/ActionView.tsx +6 -2
  287. package/src/views/RootView.tsx +7 -1
  288. package/src/views/actionViews/GraphActionView.tsx +1 -0
  289. package/src/views/actionViews/TreeActionView.tsx +10 -1
  290. package/src/views/tabs/Tab.tsx +12 -6
  291. package/src/widgets/WidgetFactory.tsx +6 -0
  292. package/src/widgets/base/Binary.tsx +8 -5
  293. package/src/widgets/base/Boolean.tsx +8 -7
  294. package/src/widgets/base/Char.tsx +14 -12
  295. package/src/widgets/base/Float.tsx +11 -5
  296. package/src/widgets/base/FloatTime.tsx +9 -5
  297. package/src/widgets/base/Integer.tsx +10 -5
  298. package/src/widgets/base/Label.tsx +12 -12
  299. package/src/widgets/base/LinkInput.tsx +11 -6
  300. package/src/widgets/base/MultiSelection.tsx +6 -2
  301. package/src/widgets/base/Reference.tsx +13 -3
  302. package/src/widgets/base/ReferenceTree.tsx +62 -0
  303. package/src/widgets/base/Selection.tsx +6 -2
  304. package/src/widgets/base/Separator.tsx +11 -3
  305. package/src/widgets/base/Text.tsx +14 -12
  306. package/src/widgets/base/many2one/Many2one.tsx +25 -31
  307. package/src/widgets/base/many2one/Many2oneSuffixModal.tsx +3 -3
  308. package/src/widgets/base/many2one/Many2oneTree.tsx +18 -0
  309. package/src/widgets/base/one2many/One2manyInput.tsx +79 -23
  310. package/src/widgets/base/one2many/One2manyTopBar.tsx +10 -1
  311. package/src/widgets/containers/Group.tsx +7 -4
  312. package/src/widgets/custom/ButtonGroup.tsx +1 -1
  313. package/src/widgets/custom/FiberGrid.tsx +1 -4
  314. package/src/widgets/custom/Indicator.tsx +16 -15
  315. package/src/widgets/custom/Markdown.tsx +22 -0
  316. package/src/widgets/custom/MultiCheckbox.tsx +1 -0
  317. package/src/widgets/custom/Tag.tsx +24 -0
  318. package/src/widgets/custom/Tags.tsx +27 -28
  319. package/src/widgets/custom/Timeline.tsx +9 -3
  320. package/src/widgets/modals/ExportModal.tsx +33 -134
  321. package/src/widgets/modals/FormModal.tsx +3 -3
  322. package/src/widgets/modals/SearchModal.tsx +29 -31
  323. package/src/widgets/modals/TranslationModal.tsx +3 -3
  324. package/src/widgets/views/Dashboard/Dashboard.tsx +15 -4
  325. package/src/widgets/views/Dashboard/DashboardTree.tsx +1 -0
  326. package/src/widgets/views/DashboardGrid/DashboardGridItem.tsx +10 -6
  327. package/src/widgets/views/Form.tsx +41 -39
  328. package/src/widgets/views/Graph/GraphChart.tsx +6 -1
  329. package/src/widgets/views/Graph/GraphDefaults.ts +113 -0
  330. package/src/widgets/views/Graph/GraphIndicator.tsx +19 -7
  331. package/src/widgets/views/SearchTree.tsx +3 -0
  332. package/src/widgets/views/Tree.tsx +112 -26
  333. package/src/widgets/views/searchFilter/SearchField.tsx +9 -23
  334. package/src/widgets/views/searchFilter/SearchFilter.tsx +17 -8
  335. package/dist/Config.d.ts +0 -6
  336. package/dist/Config.d.ts.map +0 -1
  337. package/dist/helpers/icons/antd_icons.d.ts +0 -4
  338. package/dist/helpers/icons/antd_icons.d.ts.map +0 -1
  339. package/dist/helpers/icons/tabler_icons.d.ts +0 -4
  340. package/dist/helpers/icons/tabler_icons.d.ts.map +0 -1
  341. package/dist/ui/Fieldset.d.ts +0 -8
  342. package/dist/ui/Fieldset.d.ts.map +0 -1
  343. package/src/Config.ts +0 -4
  344. package/src/helpers/icons/antd_icons.ts +0 -1583
  345. package/src/helpers/icons/tabler_icons.ts +0 -5367
  346. package/src/ui/Fieldset.tsx +0 -31
  347. /package/dist/{main.css → style.css} +0 -0
@@ -1,4 +1,4 @@
1
- import { FormView, GenerateReportOptions } from "@/types";
1
+ import { FormView, GenerateReportOptions, ViewType } from "@/types";
2
2
  import React, {
3
3
  useContext,
4
4
  useRef,
@@ -43,15 +43,20 @@ type ActionModalOpts = {
43
43
  actionData?: any;
44
44
  };
45
45
 
46
- export const ContentRootContext = React.createContext<ContentRootContextType | null>(
47
- null
48
- );
46
+ export const ContentRootContext =
47
+ React.createContext<ContentRootContextType | null>(null);
49
48
 
50
49
  type ContentRootProviderProps = {
51
50
  children: React.ReactNode;
52
51
  globalValues?: any;
53
52
  };
54
53
 
54
+ const callRefreshValues = async (fns: any[]) => {
55
+ for (let i = 0; i < fns.length; i++) {
56
+ await fns?.[i]?.();
57
+ }
58
+ };
59
+
55
60
  const ContentRootProvider = (
56
61
  props: ContentRootProviderProps,
57
62
  ref: any
@@ -64,7 +69,7 @@ const ContentRootProvider = (
64
69
  TabManagerContext
65
70
  ) as TabManagerContextType;
66
71
  const { openAction } = tabManagerContext || {};
67
- const onRefreshParentValues = useRef<any>();
72
+ const onRefreshParentValues = useRef<any>([]);
68
73
  const { t } = useContext(LocaleContext) as LocaleContextType;
69
74
 
70
75
  useImperativeHandle(ref, () => ({
@@ -167,7 +172,7 @@ const ContentRootProvider = (
167
172
  onRefreshParentValues?: any;
168
173
  }) {
169
174
  const { type } = actionData;
170
- onRefreshParentValues.current = onRefreshParentValuesFn;
175
+ onRefreshParentValues.current.push(onRefreshParentValuesFn);
171
176
 
172
177
  if (type === "ir.actions.report.xml") {
173
178
  return await generateReport({
@@ -230,6 +235,7 @@ const ContentRootProvider = (
230
235
  fields,
231
236
  values: { ...values, ...globalValues },
232
237
  }),
238
+ fields,
233
239
  context: mergedContext,
234
240
  });
235
241
  }
@@ -255,33 +261,12 @@ const ContentRootProvider = (
255
261
 
256
262
  return {};
257
263
  } else {
258
- let initialView;
259
- const viewTypes = actionData.view_mode.split(",");
260
- const views = [];
261
-
262
- for (const viewType of viewTypes) {
263
- const viewData = await ConnectionProvider.getHandler().getView({
264
- model: actionData.res_model,
265
- type: viewType,
266
- context: mergedContext,
267
- });
268
- views.push([viewData.view_id, viewType]);
269
- }
270
-
271
- if (!actionData.view_id) {
272
- const type = actionData.view_mode.split(",")[0];
273
-
274
- const [retrievedViewId] = views.find(
275
- ([_, viewType]) => viewType === type
276
- )!;
277
-
278
- initialView = { id: retrievedViewId, type };
279
- } else {
280
- initialView = {
281
- id: actionData.view_id,
282
- type: actionData.view_mode.split(",")[0],
283
- };
284
- }
264
+ const { initialView, views } = await getViewsAndInitialView({
265
+ model: actionData.res_model,
266
+ context: mergedContext,
267
+ view_mode: actionData.view_mode,
268
+ views: actionData.views,
269
+ });
285
270
 
286
271
  openAction?.({
287
272
  target: "current",
@@ -347,7 +332,8 @@ const ContentRootProvider = (
347
332
  }
348
333
 
349
334
  async function onFormModalSucceed() {
350
- onRefreshParentValues.current?.();
335
+ callRefreshValues(onRefreshParentValues.current);
336
+ onRefreshParentValues.current = [];
351
337
  setActionModalVisible(false);
352
338
  setActionModalOptions({
353
339
  domain: undefined,
@@ -358,53 +344,109 @@ const ContentRootProvider = (
358
344
  });
359
345
  }
360
346
 
361
- return (
362
- <>
363
- <ContentRootContext.Provider
364
- value={{
365
- processAction,
366
- globalValues,
367
- }}
368
- >
369
- <>
370
- {children}
371
- <Modal
372
- title={t("generatingReport")}
373
- visible={reportGenerating}
374
- footer={null}
375
- closable={false}
376
- centered
377
- maskClosable={false}
378
- >
379
- <Spin />
380
- </Modal>
381
- <FormModal
382
- buttonModal
383
- parentContext={actionModalOptions.context}
384
- model={actionModalOptions.model!}
385
- formView={actionModalOptions.formView}
386
- visible={actionModalVisible}
387
- onSubmitSucceed={onFormModalSucceed}
388
- onCancel={() => {
389
- onRefreshParentValues.current?.();
390
- setActionModalVisible(false);
391
- setActionModalOptions({
392
- domain: undefined,
393
- model: undefined,
394
- context: {},
395
- formView: undefined,
396
- actionData: undefined,
397
- });
398
- }}
399
- showFooter={false}
400
- actionDomain={actionModalOptions.domain}
401
- isMenuAction={actionModalOptions?.actionData !== undefined}
402
- actionData={actionModalOptions?.actionData}
403
- />
404
- </>
405
- </ContentRootContext.Provider>
406
- </>
407
- );
347
+ return (<>
348
+ <ContentRootContext.Provider
349
+ value={{
350
+ processAction,
351
+ globalValues,
352
+ }}
353
+ >
354
+ <>
355
+ {children}
356
+ <Modal
357
+ title={t("generatingReport")}
358
+ open={reportGenerating}
359
+ footer={null}
360
+ closable={false}
361
+ centered
362
+ maskClosable={false}
363
+ >
364
+ <Spin />
365
+ </Modal>
366
+ <FormModal
367
+ buttonModal
368
+ parentContext={actionModalOptions.context}
369
+ model={actionModalOptions.model!}
370
+ formView={actionModalOptions.formView}
371
+ visible={actionModalVisible}
372
+ onSubmitSucceed={onFormModalSucceed}
373
+ onCancel={() => {
374
+ callRefreshValues(onRefreshParentValues.current);
375
+ onRefreshParentValues.current = [];
376
+ setActionModalVisible(false);
377
+ setActionModalOptions({
378
+ domain: undefined,
379
+ model: undefined,
380
+ context: {},
381
+ formView: undefined,
382
+ actionData: undefined,
383
+ });
384
+ }}
385
+ showFooter={false}
386
+ actionDomain={actionModalOptions.domain}
387
+ isMenuAction={actionModalOptions?.actionData !== undefined}
388
+ actionData={actionModalOptions?.actionData}
389
+ />
390
+ </>
391
+ </ContentRootContext.Provider>
392
+ </>);
408
393
  };
409
394
 
395
+ async function getViewsAndInitialView({
396
+ views,
397
+ view_mode,
398
+ model,
399
+ context,
400
+ view_id,
401
+ }: {
402
+ views: any[];
403
+ view_mode: string;
404
+ model: string;
405
+ context: any;
406
+ view_id?: number;
407
+ }) {
408
+ const retriedViewData = [];
409
+ let initialView;
410
+
411
+ if (views) {
412
+ for (const view of views) {
413
+ const viewData = await ConnectionProvider.getHandler().getView({
414
+ model,
415
+ type: view[1],
416
+ id: view[0],
417
+ context,
418
+ });
419
+ retriedViewData.push([viewData.view_id, view[1]]);
420
+ }
421
+ } else {
422
+ const viewTypes = view_mode.split(",");
423
+ for (const viewType of viewTypes) {
424
+ const viewData = await ConnectionProvider.getHandler().getView({
425
+ model,
426
+ type: viewType as ViewType,
427
+ context,
428
+ });
429
+ retriedViewData.push([viewData.view_id, viewType]);
430
+ }
431
+ }
432
+ if (views && views.length > 0) {
433
+ const [id, type] = views[0];
434
+ initialView = {
435
+ id,
436
+ type,
437
+ };
438
+ } else if (!view_id) {
439
+ const type = view_mode.split(",")[0];
440
+ const [retrievedViewId] = retriedViewData.find(([_, viewType]) => viewType === type)!;
441
+ initialView = { id: retrievedViewId, type };
442
+ } else {
443
+ initialView = {
444
+ id: view_id,
445
+ type: view_mode.split(",")[0],
446
+ };
447
+ }
448
+
449
+ return { views: retriedViewData, initialView };
450
+ }
451
+
410
452
  export default forwardRef(ContentRootProvider);
@@ -18,11 +18,10 @@ export type FormContextType = {
18
18
  getValues: () => Promise<any>;
19
19
  getPlainValues: () => { [key: string]: any };
20
20
  getFields: () => Promise<any>;
21
- setOriginalValue: (field: string, value: any) => void;
22
21
  domain: any[];
23
22
  submitForm?: (options?: {
24
23
  callOnSubmitSucceed?: boolean;
25
- }) => Promise<boolean>;
24
+ }) => Promise<{ succeed: boolean; id: number }>;
26
25
  fetchValues?: () => void;
27
26
  formHasChanges?: () => boolean;
28
27
  elementHasLostFocus?: () => void;
@@ -45,7 +44,6 @@ const FormProvider = (props: FormProviderProps): any => {
45
44
  getContext,
46
45
  getValues,
47
46
  getPlainValues,
48
- setOriginalValue,
49
47
  domain,
50
48
  submitForm,
51
49
  fetchValues,
@@ -67,7 +65,6 @@ const FormProvider = (props: FormProviderProps): any => {
67
65
  getFieldValue,
68
66
  executeButtonAction,
69
67
  getContext,
70
- setOriginalValue,
71
68
  submitForm,
72
69
  fetchValues,
73
70
  formHasChanges,
@@ -0,0 +1,27 @@
1
+ export const parseError = (errorResponse: string) => {
2
+ let message;
3
+ let type;
4
+ let title;
5
+
6
+ if (
7
+ typeof errorResponse === "string" &&
8
+ errorResponse.indexOf(" -- ") !== -1 &&
9
+ errorResponse.indexOf("\n\n") !== -1
10
+ ) {
11
+ const splitted = errorResponse.split("\n\n");
12
+ message = splitted[1].replace(/\n/g, "<br />");
13
+ const args = splitted[0].split(" -- ");
14
+ type = args[0];
15
+ title = args[1];
16
+ } else {
17
+ message = errorResponse;
18
+ type = "error";
19
+ title = "Error";
20
+ }
21
+
22
+ return {
23
+ type,
24
+ message,
25
+ title,
26
+ };
27
+ };
@@ -1,4 +1,5 @@
1
1
  import { One2manyItem } from "@/widgets/base/one2many/One2manyInput";
2
+ import { Form as FormOoui } from "@gisce/ooui";
2
3
 
3
4
  const filteredValues = (values: any, fields: any) => {
4
5
  if (!fields) {
@@ -100,15 +101,16 @@ export const getTouchedValues = ({
100
101
 
101
102
  export const checkFieldsType = ({
102
103
  changedFields,
103
- fields,
104
+ formOoui,
104
105
  types,
105
106
  }: {
106
107
  changedFields: string[];
107
- fields: any;
108
+ formOoui: FormOoui;
108
109
  types: string[];
109
110
  }) => {
110
111
  const valuesChecked = changedFields.map((key) => {
111
- return types.includes(fields[key]?.type);
112
+ const fieldType = formOoui?.findById(key)?.type!;
113
+ return types.includes(fieldType);
112
114
  });
113
115
  return valuesChecked.some((i) => i === true);
114
116
  };
@@ -152,16 +154,35 @@ export const getValuesForDomain = (domain: any[]) => {
152
154
  export const getOnChangePayload = ({
153
155
  onChangeFieldActionArgs,
154
156
  values,
157
+ parentValues = {},
155
158
  }: {
156
159
  onChangeFieldActionArgs: any[];
157
160
  values: any;
161
+ parentValues?: any;
158
162
  }) => {
159
163
  const payload: any = {};
160
164
  onChangeFieldActionArgs.forEach((arg: string) => {
161
- if (values[arg]) {
165
+ const splittedArg = arg.split("");
166
+
167
+ if (arg === "True") {
168
+ payload[arg] = true;
169
+ } else if (arg === "False") {
170
+ payload[arg] = false;
171
+ } else if (values[arg]) {
162
172
  payload[arg] = values[arg];
163
- } else if (arg[0] === "'") {
173
+ } else if (
174
+ splittedArg[0] === "'" &&
175
+ splittedArg[splittedArg.length - 1] === "'" &&
176
+ splittedArg.filter((i: string) => i === "'").length === 2
177
+ ) {
164
178
  payload[arg] = arg.replace(/'/g, "");
179
+ } else if (splittedArg.includes("'")) {
180
+ // This is a string with a variable in it.
181
+ // TODO: pending implement.
182
+ payload[arg] = arg;
183
+ } else if (arg.indexOf("parent.") !== -1) {
184
+ const parentKey = arg.replace("parent.", "");
185
+ payload[arg] = parentValues[parentKey] || false;
165
186
  } else {
166
187
  payload[arg] = false;
167
188
  }
@@ -1,112 +1,123 @@
1
- import React from "react";
1
+ import React, { CSSProperties } from "react";
2
+ import * as AntIcons from "@ant-design/icons";
3
+ import * as TablerIcons from "@tabler/icons-react";
2
4
  import Icon from "@ant-design/icons";
3
- import { AntIcons as Icons } from "./icons/antd_icons";
4
- import { TablerIcons } from "./icons/tabler_icons";
5
5
 
6
- const iconMapping: { [key: string]: React.ElementType } = {
7
- "terp-purchase": Icons.ShoppingCartOutlined,
8
- "terp-graph": Icons.PieChartOutlined,
9
- "terp-crm": Icons.ContactsOutlined,
10
- "terp-hr": TablerIcons.IconFriends,
11
- "terp-account": TablerIcons.IconBuildingBank,
12
- "terp-project": TablerIcons.IconChecklist,
13
- "terp-administration": TablerIcons.IconAdjustments,
14
- "terp-partner": Icons.TeamOutlined,
15
- "terp-mrp": Icons.BuildOutlined,
16
- "terp-product": Icons.ShoppingOutlined,
17
- STOCK_JUSTIFY_FILL: Icons.UnorderedListOutlined,
18
- STOCK_INDENT: TablerIcons.IconIndentIncrease,
19
- STOCK_HELP: Icons.QuestionOutlined,
20
- STOCK_GO_UP: Icons.ArrowUpOutlined,
21
- STOCK_SORT_DESCENDING: Icons.SortDescendingOutlined,
22
- STOCK_ADD: Icons.PlusOutlined,
23
- STOCK_GOTO_LAST: Icons.FastForwardOutlined,
24
- STOCK_FIND: Icons.SearchOutlined,
25
- STOCK_PROPERTIES: Icons.ControlOutlined,
26
- STOCK_DIALOG_INFO: Icons.InfoOutlined,
27
- STOCK_FLOPPY: Icons.UsbOutlined,
28
- STOCK_JUSTIFY_CENTER: Icons.AlignCenterOutlined,
29
- STOCK_GO_BACK: Icons.ArrowLeftOutlined,
30
- STOCK_UNDERLINE: Icons.UnderlineOutlined,
31
- STOCK_BOLD: Icons.BoldOutlined,
32
- STOCK_APPLY: Icons.CheckOutlined,
33
- STOCK_ZOOM_OUT: Icons.ZoomOutOutlined,
34
- STOCK_STRIKETHROUGH: Icons.StrikethroughOutlined,
35
- STOCK_MEDIA_REWIND: Icons.BackwardOutlined,
36
- STOCK_PRINT: Icons.PrinterOutlined,
37
- STOCK_NO: Icons.CloseOutlined,
38
- STOCK_GOTO_FIRST: Icons.FastBackwardOutlined,
39
- STOCK_CLOSE: Icons.CloseOutlined,
40
- STOCK_REMOVE: Icons.MinusOutlined,
41
- STOCK_CUT: Icons.ScissorOutlined,
42
- STOCK_DIALOG_AUTHENTICATION: Icons.SafetyOutlined,
43
- STOCK_ZOOM_FIT: Icons.ExpandOutlined,
44
- STOCK_JUMP_TO: Icons.SelectOutlined,
45
- STOCK_HARDDISK: Icons.HddOutlined,
46
- STOCK_SAVE_AS: Icons.SaveOutlined,
47
- STOCK_UNDO: Icons.UndoOutlined,
48
- STOCK_JUSTIFY_RIGHT: Icons.AlignRightOutlined,
49
- STOCK_DIALOG_ERROR: Icons.CloseCircleOutlined,
50
- STOCK_INDEX: Icons.ProfileOutlined,
51
- STOCK_GOTO_BOTTOM: Icons.VerticalAlignBottomOutlined,
52
- STOCK_MEDIA_NEXT: Icons.StepForwardOutlined,
53
- STOCK_REDO: Icons.RedoOutlined,
54
- STOCK_COPY: Icons.CopyOutlined,
55
- STOCK_MEDIA_PAUSE: Icons.PauseOutlined,
56
- STOCK_GO_FORWARD: Icons.ArrowRightOutlined,
57
- STOCK_UNDELETE: Icons.UndoOutlined,
58
- STOCK_EXECUTE: Icons.SettingOutlined,
59
- STOCK_SAVE: Icons.SaveOutlined,
60
- STOCK_DIALOG_QUESTION: Icons.QuestionCircleOutlined,
61
- STOCK_SORT_ASCENDING: Icons.SortAscendingOutlined,
62
- STOCK_REFRESH: Icons.ReloadOutlined,
63
- STOCK_MEDIA_FORWARD: Icons.ForwardOutlined,
64
- STOCK_STOP: Icons.BorderOutlined,
65
- STOCK_PRINT_PREVIEW: Icons.PrinterOutlined,
66
- STOCK_HOME: Icons.HomeOutlined,
67
- STOCK_PASTE: Icons.CarryOutOutlined,
68
- STOCK_ZOOM_100: Icons.ZoomInOutlined,
69
- STOCK_FIND_AND_REPLACE: Icons.FileSearchOutlined,
70
- STOCK_DIALOG_WARNING: Icons.WarningOutlined,
71
- STOCK_ZOOM_IN: Icons.ZoomInOutlined,
72
- STOCK_CONVERT: Icons.ExportOutlined,
73
- STOCK_ITALIC: Icons.ItalicOutlined,
74
- STOCK_YES: Icons.CheckOutlined,
75
- STOCK_MEDIA_PLAY: Icons.PlayCircleOutlined,
76
- STOCK_MEDIA_RECORD: Icons.VideoCameraOutlined,
77
- STOCK_MEDIA_PREVIOUS: Icons.StepBackwardOutlined,
78
- STOCK_NEW: Icons.FileAddOutlined,
79
- STOCK_CANCEL: Icons.CloseOutlined,
80
- STOCK_DISCONNECT: Icons.ApiOutlined,
81
- STOCK_JUSTIFY_LEFT: Icons.AlignLeftOutlined,
82
- STOCK_FILE: Icons.FileOutlined,
83
- STOCK_QUIT: Icons.LogoutOutlined,
84
- STOCK_EDIT: Icons.EditOutlined,
85
- STOCK_CONNECT: Icons.ApiOutlined,
86
- STOCK_GO_DOWN: Icons.CaretDownOutlined,
87
- STOCK_NETWORK: Icons.ApartmentOutlined,
88
- STOCK_OK: Icons.CheckOutlined,
89
- STOCK_GOTO_TOP: Icons.VerticalAlignTopOutlined,
90
- STOCK_ABOUT: Icons.StarOutlined,
91
- STOCK_COLOR_PICKER: Icons.AimOutlined,
92
- STOCK_SELECT_FONT: Icons.FontSizeOutlined,
93
- STOCK_DELETE: Icons.DeleteOutlined,
94
- STOCK_DND: Icons.FileTextOutlined,
95
- STOCK_CLEAR: Icons.CloseSquareOutlined,
96
- STOCK_UNINDENT: Icons.AlignLeftOutlined,
97
- STOCK_PREFERENCES: Icons.SettingOutlined,
6
+ type TablerKey = keyof typeof TablerIcons;
7
+ type AntKey = keyof typeof AntIcons;
8
+
9
+ const iconMapping: { [key: string]: string } = {
10
+ "terp-purchase": "ShoppingCart",
11
+ "terp-graph": "PieChart",
12
+ "terp-crm": "Contacts",
13
+ "terp-hr": "Friends",
14
+ "terp-account": "BuildingBank",
15
+ "terp-project": "Checklist",
16
+ "terp-administration": "Adjustments",
17
+ "terp-partner": "Team",
18
+ "terp-mrp": "Build",
19
+ "terp-product": "Shopping",
20
+ STOCK_JUSTIFY_FILL: "UnorderedList",
21
+ STOCK_INDENT: "IndentIncrease",
22
+ STOCK_HELP: "Question",
23
+ STOCK_GO_UP: "ArrowUp",
24
+ STOCK_SORT_DESCENDING: "SortDescending",
25
+ STOCK_ADD: "Plus",
26
+ STOCK_GOTO_LAST: "FastForward",
27
+ STOCK_FIND: "Search",
28
+ STOCK_PROPERTIES: "Control",
29
+ STOCK_DIALOG_INFO: "Info",
30
+ STOCK_FLOPPY: "Usb",
31
+ STOCK_JUSTIFY_CENTER: "AlignCenter",
32
+ STOCK_GO_BACK: "ArrowLeft",
33
+ STOCK_UNDERLINE: "Underline",
34
+ STOCK_BOLD: "Bold",
35
+ STOCK_APPLY: "Check",
36
+ STOCK_ZOOM_OUT: "ZoomOut",
37
+ STOCK_STRIKETHROUGH: "Strikethrough",
38
+ STOCK_MEDIA_REWIND: "Backward",
39
+ STOCK_PRINT: "Printer",
40
+ STOCK_NO: "Close",
41
+ STOCK_GOTO_FIRST: "FastBackward",
42
+ STOCK_CLOSE: "Close",
43
+ STOCK_REMOVE: "Minus",
44
+ STOCK_CUT: "Scissor",
45
+ STOCK_DIALOG_AUTHENTICATION: "Safety",
46
+ STOCK_ZOOM_FIT: "Expand",
47
+ STOCK_JUMP_TO: "Select",
48
+ STOCK_HARDDISK: "Hdd",
49
+ STOCK_SAVE_AS: "Save",
50
+ STOCK_UNDO: "Undo",
51
+ STOCK_JUSTIFY_RIGHT: "AlignRight",
52
+ STOCK_DIALOG_ERROR: "CloseCircle",
53
+ STOCK_INDEX: "Profile",
54
+ STOCK_GOTO_BOTTOM: "VerticalAlignBottom",
55
+ STOCK_MEDIA_NEXT: "StepForward",
56
+ STOCK_REDO: "Redo",
57
+ STOCK_COPY: "Copy",
58
+ STOCK_MEDIA_PAUSE: "Pause",
59
+ STOCK_GO_FORWARD: "ArrowRight",
60
+ STOCK_UNDELETE: "Undo",
61
+ STOCK_EXECUTE: "Setting",
62
+ STOCK_SAVE: "Save",
63
+ STOCK_DIALOG_QUESTION: "QuestionCircle",
64
+ STOCK_SORT_ASCENDING: "SortAscending",
65
+ STOCK_REFRESH: "Reload",
66
+ STOCK_MEDIA_FORWARD: "Forward",
67
+ STOCK_STOP: "Border",
68
+ STOCK_PRINT_PREVIEW: "Printer",
69
+ STOCK_HOME: "Home",
70
+ STOCK_PASTE: "CarryOut",
71
+ STOCK_ZOOM_100: "ZoomIn",
72
+ STOCK_FIND_AND_REPLACE: "FileSearch",
73
+ STOCK_DIALOG_WARNING: "Warning",
74
+ STOCK_ZOOM_IN: "ZoomIn",
75
+ STOCK_CONVERT: "Export",
76
+ STOCK_ITALIC: "Italic",
77
+ STOCK_YES: "Check",
78
+ STOCK_MEDIA_PLAY: "PlayCircle",
79
+ STOCK_MEDIA_RECORD: "VideoCamera",
80
+ STOCK_MEDIA_PREVIOUS: "StepBackward",
81
+ STOCK_NEW: "FileAdd",
82
+ STOCK_CANCEL: "Close",
83
+ STOCK_DISCONNECT: "Api",
84
+ STOCK_JUSTIFY_LEFT: "AlignLeft",
85
+ STOCK_FILE: "File",
86
+ STOCK_QUIT: "Logout",
87
+ STOCK_EDIT: "Edit",
88
+ STOCK_CONNECT: "Api",
89
+ STOCK_GO_DOWN: "CaretDown",
90
+ STOCK_NETWORK: "Apartment",
91
+ STOCK_OK: "Check",
92
+ STOCK_GOTO_TOP: "VerticalAlignTop",
93
+ STOCK_ABOUT: "Star",
94
+ STOCK_COLOR_PICKER: "Aim",
95
+ STOCK_SELECT_FONT: "FontSize",
96
+ STOCK_DELETE: "Delete",
97
+ STOCK_DND: "FileText",
98
+ STOCK_CLEAR: "CloseSquare",
99
+ STOCK_UNINDENT: "AlignLeft",
100
+ STOCK_PREFERENCES: "Setting",
98
101
  };
99
102
 
100
- export default (key: string): React.ElementType | undefined => {
103
+ export default (
104
+ key: string,
105
+ props?: { className?: any; style: CSSProperties }
106
+ ) => {
101
107
  if (key.indexOf("gtk-") !== -1) {
102
- const rootIcon = key.replace("gtk-", "").replace("-", "_");
103
- const newKey = `STOCK_${rootIcon.toUpperCase()}`;
104
- return iconMapping[newKey];
108
+ const rootIcon = key.replace("gtk-", "").replace(/\-/g, "_");
109
+ key = `STOCK_${rootIcon.toUpperCase()}`;
105
110
  }
111
+
106
112
  if (iconMapping.hasOwnProperty(key)) {
107
- return iconMapping[key];
113
+ return getIconForKey(iconMapping[key], props);
108
114
  }
109
- const IconCamelCase = `${key
115
+
116
+ return getIconForKey(key, props);
117
+ };
118
+
119
+ function toCamelCase(key: string): string {
120
+ return `${key
110
121
  .split("-")
111
122
  .map((word) =>
112
123
  word.replace(
@@ -115,18 +126,40 @@ export default (key: string): React.ElementType | undefined => {
115
126
  )
116
127
  )
117
128
  .join("")}`;
129
+ }
130
+
131
+ function getIconForKey(
132
+ key: string,
133
+ props?: { className?: any; style: CSSProperties }
134
+ ) {
135
+ let IconCamelCase = key.charAt(0).toUpperCase() + key.slice(1); // Capitalize first letter
136
+ if (IconCamelCase.indexOf("-") !== -1) {
137
+ IconCamelCase = toCamelCase(IconCamelCase);
138
+ }
118
139
 
119
- const antKey = `${IconCamelCase}Outlined`;
120
- if (Icons.hasOwnProperty(antKey)) {
121
- return Icons[antKey];
140
+ const antKey: AntKey = `${IconCamelCase}Outlined` as any;
141
+ if (AntIcons[antKey]) {
142
+ return () =>
143
+ React.createElement(AntIcons[antKey] as any, {
144
+ ...props,
145
+ });
122
146
  }
123
147
 
124
- const tablerKey = `Icon${IconCamelCase}`;
125
- if (TablerIcons.hasOwnProperty(tablerKey)) {
148
+ const tablerKey: TablerKey = `Icon${IconCamelCase}` as any;
149
+ if (TablerIcons[tablerKey]) {
150
+ const TablerIcon = () =>
151
+ React.createElement(TablerIcons[tablerKey] as any, {
152
+ fill: "transparent",
153
+ height: 17,
154
+ width: 17,
155
+ });
126
156
  const CustomIcon = () =>
127
- React.createElement(Icon, { component: TablerIcons[tablerKey] });
157
+ React.createElement(Icon, {
158
+ component: TablerIcon,
159
+ ...props,
160
+ });
128
161
  return CustomIcon;
129
162
  }
130
163
 
131
164
  return undefined;
132
- };
165
+ }