@onehat/ui 0.1.2 → 0.2.0

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/ckeditor5/LICENSE.md +49 -0
  2. package/ckeditor5/README.md +68 -0
  3. package/ckeditor5/build/ckeditor.js +6 -0
  4. package/ckeditor5/build/ckeditor.js.map +1 -0
  5. package/ckeditor5/build/translations/af.js +1 -0
  6. package/ckeditor5/build/translations/ar.js +1 -0
  7. package/ckeditor5/build/translations/ast.js +1 -0
  8. package/ckeditor5/build/translations/az.js +1 -0
  9. package/ckeditor5/build/translations/bg.js +1 -0
  10. package/ckeditor5/build/translations/bn.js +1 -0
  11. package/ckeditor5/build/translations/bs.js +1 -0
  12. package/ckeditor5/build/translations/ca.js +1 -0
  13. package/ckeditor5/build/translations/cs.js +1 -0
  14. package/ckeditor5/build/translations/da.js +1 -0
  15. package/ckeditor5/build/translations/de-ch.js +1 -0
  16. package/ckeditor5/build/translations/de.js +1 -0
  17. package/ckeditor5/build/translations/el.js +1 -0
  18. package/ckeditor5/build/translations/en-au.js +1 -0
  19. package/ckeditor5/build/translations/en-gb.js +1 -0
  20. package/ckeditor5/build/translations/eo.js +1 -0
  21. package/ckeditor5/build/translations/es-co.js +1 -0
  22. package/ckeditor5/build/translations/es.js +1 -0
  23. package/ckeditor5/build/translations/et.js +1 -0
  24. package/ckeditor5/build/translations/eu.js +1 -0
  25. package/ckeditor5/build/translations/fa.js +1 -0
  26. package/ckeditor5/build/translations/fi.js +1 -0
  27. package/ckeditor5/build/translations/fr.js +1 -0
  28. package/ckeditor5/build/translations/gl.js +1 -0
  29. package/ckeditor5/build/translations/gu.js +1 -0
  30. package/ckeditor5/build/translations/he.js +1 -0
  31. package/ckeditor5/build/translations/hi.js +1 -0
  32. package/ckeditor5/build/translations/hr.js +1 -0
  33. package/ckeditor5/build/translations/hu.js +1 -0
  34. package/ckeditor5/build/translations/id.js +1 -0
  35. package/ckeditor5/build/translations/it.js +1 -0
  36. package/ckeditor5/build/translations/ja.js +1 -0
  37. package/ckeditor5/build/translations/jv.js +1 -0
  38. package/ckeditor5/build/translations/kk.js +1 -0
  39. package/ckeditor5/build/translations/km.js +1 -0
  40. package/ckeditor5/build/translations/kn.js +1 -0
  41. package/ckeditor5/build/translations/ko.js +1 -0
  42. package/ckeditor5/build/translations/ku.js +1 -0
  43. package/ckeditor5/build/translations/lt.js +1 -0
  44. package/ckeditor5/build/translations/lv.js +1 -0
  45. package/ckeditor5/build/translations/ms.js +1 -0
  46. package/ckeditor5/build/translations/nb.js +1 -0
  47. package/ckeditor5/build/translations/ne.js +1 -0
  48. package/ckeditor5/build/translations/nl.js +1 -0
  49. package/ckeditor5/build/translations/no.js +1 -0
  50. package/ckeditor5/build/translations/oc.js +1 -0
  51. package/ckeditor5/build/translations/pl.js +1 -0
  52. package/ckeditor5/build/translations/pt-br.js +1 -0
  53. package/ckeditor5/build/translations/pt.js +1 -0
  54. package/ckeditor5/build/translations/ro.js +1 -0
  55. package/ckeditor5/build/translations/ru.js +1 -0
  56. package/ckeditor5/build/translations/si.js +1 -0
  57. package/ckeditor5/build/translations/sk.js +1 -0
  58. package/ckeditor5/build/translations/sl.js +1 -0
  59. package/ckeditor5/build/translations/sq.js +1 -0
  60. package/ckeditor5/build/translations/sr-latn.js +1 -0
  61. package/ckeditor5/build/translations/sr.js +1 -0
  62. package/ckeditor5/build/translations/sv.js +1 -0
  63. package/ckeditor5/build/translations/th.js +1 -0
  64. package/ckeditor5/build/translations/tk.js +1 -0
  65. package/ckeditor5/build/translations/tr.js +1 -0
  66. package/ckeditor5/build/translations/tt.js +1 -0
  67. package/ckeditor5/build/translations/ug.js +1 -0
  68. package/ckeditor5/build/translations/uk.js +1 -0
  69. package/ckeditor5/build/translations/ur.js +1 -0
  70. package/ckeditor5/build/translations/uz.js +1 -0
  71. package/ckeditor5/build/translations/vi.js +1 -0
  72. package/ckeditor5/build/translations/zh-cn.js +1 -0
  73. package/ckeditor5/build/translations/zh.js +1 -0
  74. package/ckeditor5/package.json +46 -0
  75. package/ckeditor5/sample/index.html +130 -0
  76. package/ckeditor5/sample/styles.css +496 -0
  77. package/ckeditor5/src/ckeditor.js +138 -0
  78. package/ckeditor5/webpack.config.js +96 -0
  79. package/package.json +19 -23
  80. package/src/Components/Accordion/Accordion.js +144 -0
  81. package/src/Components/Blank.js +14 -0
  82. package/src/Components/Buttons/BackButton.js +16 -0
  83. package/src/Components/Buttons/CartButtonWithBadge.js +25 -0
  84. package/src/Components/Buttons/IconButton.js +42 -0
  85. package/src/Components/Container/Container.js +178 -0
  86. package/src/Components/Container/Splitter.js +61 -0
  87. package/src/Components/Filter/DateRange.js +99 -0
  88. package/src/Components/Filter/NumberRange.js +96 -0
  89. package/src/Components/Form/Field/CKEditor/CKEditor.js +62 -0
  90. package/src/Components/Form/Field/CKEditor/styles.css +503 -0
  91. package/src/Components/Form/Field/CKEditor.js +12 -0
  92. package/src/Components/Form/Field/CheckboxGroup/ArrayCheckboxGroup.js +13 -0
  93. package/src/Components/Form/Field/CheckboxGroup/CheckboxGroup.js +61 -0
  94. package/src/Components/Form/Field/Color.js +226 -0
  95. package/src/Components/Form/Field/Combo/ArrayCombo.js +15 -0
  96. package/src/Components/Form/Field/Combo/BooleanCombo.js +23 -0
  97. package/src/Components/Form/Field/Combo/Combo.js +504 -0
  98. package/src/Components/Form/Field/Combo/ComboEditor.js +22 -0
  99. package/src/Components/Form/Field/Combo/IntervalsCombo.js +18 -0
  100. package/src/Components/Form/Field/Combo/MonthsCombo.js +24 -0
  101. package/src/Components/Form/Field/Combo/PageSizeCombo.js +38 -0
  102. package/src/Components/Form/Field/Combo/Tag.js +12 -0
  103. package/src/Components/Form/Field/Combo/TimezonesCombo.js +432 -0
  104. package/src/Components/Form/Field/Combo/YearsCombo.js +35 -0
  105. package/src/Components/Form/Field/Date.js +370 -0
  106. package/src/Components/Form/Field/DisplayField.js +28 -0
  107. package/src/Components/Form/Field/Field.js +14 -0
  108. package/src/Components/Form/Field/File.js +218 -0
  109. package/src/Components/Form/Field/Input.js +96 -0
  110. package/src/Components/Form/Field/Number.js +151 -0
  111. package/src/Components/Form/Field/RadioGroup/ArrayRadioGroup.js +13 -0
  112. package/src/Components/Form/Field/RadioGroup/RadioGroup.js +62 -0
  113. package/src/Components/Form/Field/Tag.js +11 -0
  114. package/src/Components/Form/Field/Text.js +28 -0
  115. package/src/Components/Form/Field/TextArea.js +26 -0
  116. package/src/Components/Form/Field/Toggle.js +39 -0
  117. package/src/Components/Form/Field/datetime.css +5 -0
  118. package/src/Components/Form/FieldSet.js +64 -0
  119. package/src/Components/Form/FiltersForm.js +66 -0
  120. package/src/Components/Form/Form.js +535 -0
  121. package/src/Components/Form/Label.js +24 -0
  122. package/src/Components/Grid/Grid.js +877 -0
  123. package/src/Components/Grid/GridHeaderRow.js +455 -0
  124. package/src/Components/Grid/GridRow.js +134 -0
  125. package/src/Components/Grid/HeaderReorderHandle.js +29 -0
  126. package/src/Components/Grid/HeaderResizeHandle.js +29 -0
  127. package/src/Components/Grid/NoRecordsFound.js +43 -0
  128. package/src/Components/Grid/ReactGrid.js +468 -0
  129. package/src/Components/Grid/SenchaGrid.js +421 -0
  130. package/src/Components/Grid/reactgrid.css +6 -0
  131. package/src/Components/Hoc/withAlert.js +176 -0
  132. package/src/Components/Hoc/withBlank.js +12 -0
  133. package/src/Components/Hoc/withCollapsible.js +20 -0
  134. package/src/Components/Hoc/withContextMenu.js +127 -0
  135. package/src/Components/Hoc/withData.js +85 -0
  136. package/src/Components/Hoc/withDraggable.js +259 -0
  137. package/src/Components/Hoc/withEditor.js +160 -0
  138. package/src/Components/Hoc/withEvents.js +12 -0
  139. package/src/Components/Hoc/withFilters.js +456 -0
  140. package/src/Components/Hoc/withInlineEditor.js +119 -0
  141. package/src/Components/Hoc/withMultiSelection.js +16 -0
  142. package/src/Components/Hoc/withPresetButtons.js +239 -0
  143. package/src/Components/Hoc/withSelection.js +332 -0
  144. package/src/Components/Hoc/withTooltip.js +21 -0
  145. package/src/Components/Hoc/withValue.js +87 -0
  146. package/src/Components/Hoc/withWindowedEditor.js +51 -0
  147. package/src/Components/Icons/AddressBook.js +14 -0
  148. package/src/Components/Icons/Alt.js +17 -0
  149. package/src/Components/Icons/AngleLeft.js +18 -0
  150. package/src/Components/Icons/AngleRight.js +18 -0
  151. package/src/Components/Icons/AnglesLeft.js +18 -0
  152. package/src/Components/Icons/AnglesRight.js +18 -0
  153. package/src/Components/Icons/Asterisk.js +14 -0
  154. package/src/Components/Icons/Ban.js +18 -0
  155. package/src/Components/Icons/Bars.js +14 -0
  156. package/src/Components/Icons/BigCircle.js +17 -0
  157. package/src/Components/Icons/Book.js +14 -0
  158. package/src/Components/Icons/BookOpen.js +14 -0
  159. package/src/Components/Icons/Bug.js +14 -0
  160. package/src/Components/Icons/Building.js +14 -0
  161. package/src/Components/Icons/Calendar.js +18 -0
  162. package/src/Components/Icons/Calendar2.js +18 -0
  163. package/src/Components/Icons/CalendarDays.js +18 -0
  164. package/src/Components/Icons/Camera.js +18 -0
  165. package/src/Components/Icons/CaretDown.js +18 -0
  166. package/src/Components/Icons/CaretUp.js +18 -0
  167. package/src/Components/Icons/CartPlus.js +14 -0
  168. package/src/Components/Icons/CartShopping.js +14 -0
  169. package/src/Components/Icons/CashRegister.js +14 -0
  170. package/src/Components/Icons/ChartLine.js +14 -0
  171. package/src/Components/Icons/Check.js +14 -0
  172. package/src/Components/Icons/CheckDouble.js +14 -0
  173. package/src/Components/Icons/ChevronDown.js +14 -0
  174. package/src/Components/Icons/ChevronLeft.js +14 -0
  175. package/src/Components/Icons/ChevronRight.js +14 -0
  176. package/src/Components/Icons/ChevronUp.js +14 -0
  177. package/src/Components/Icons/CircleArrowRight.js +14 -0
  178. package/src/Components/Icons/CircleExclamation.js +18 -0
  179. package/src/Components/Icons/CircleInfo.js +14 -0
  180. package/src/Components/Icons/CircleQuestion.js +14 -0
  181. package/src/Components/Icons/CircleXmark.js +14 -0
  182. package/src/Components/Icons/CircleXmarkRegular.js +14 -0
  183. package/src/Components/Icons/Clipboard.js +18 -0
  184. package/src/Components/Icons/Clock.js +14 -0
  185. package/src/Components/Icons/ClockRegular.js +14 -0
  186. package/src/Components/Icons/ClockRotateLeft.js +14 -0
  187. package/src/Components/Icons/Clone.js +14 -0
  188. package/src/Components/Icons/Comment.js +14 -0
  189. package/src/Components/Icons/CommentRegular.js +14 -0
  190. package/src/Components/Icons/Comments.js +14 -0
  191. package/src/Components/Icons/CommentsRegular.js +14 -0
  192. package/src/Components/Icons/Copyright.js +14 -0
  193. package/src/Components/Icons/Duplicate.js +18 -0
  194. package/src/Components/Icons/Edit.js +18 -0
  195. package/src/Components/Icons/EllipsisVertical.js +18 -0
  196. package/src/Components/Icons/Envelope.js +14 -0
  197. package/src/Components/Icons/EnvelopeRegular.js +14 -0
  198. package/src/Components/Icons/Exclamation.js +14 -0
  199. package/src/Components/Icons/Expand.js +14 -0
  200. package/src/Components/Icons/Eye.js +18 -0
  201. package/src/Components/Icons/File.js +18 -0
  202. package/src/Components/Icons/FloppyDiskRegular.js +14 -0
  203. package/src/Components/Icons/Gear.js +18 -0
  204. package/src/Components/Icons/Gift.js +14 -0
  205. package/src/Components/Icons/Grip.js +18 -0
  206. package/src/Components/Icons/GripLines.js +18 -0
  207. package/src/Components/Icons/GripLinesVertical.js +18 -0
  208. package/src/Components/Icons/GripVertical.js +18 -0
  209. package/src/Components/Icons/Hammer.js +14 -0
  210. package/src/Components/Icons/Hand.js +14 -0
  211. package/src/Components/Icons/House.js +14 -0
  212. package/src/Components/Icons/Info.js +14 -0
  213. package/src/Components/Icons/ItunesNote.js +14 -0
  214. package/src/Components/Icons/List.js +14 -0
  215. package/src/Components/Icons/ListCheck.js +14 -0
  216. package/src/Components/Icons/LocationDot.js +14 -0
  217. package/src/Components/Icons/Loop.js +17 -0
  218. package/src/Components/Icons/Loop1.js +18 -0
  219. package/src/Components/Icons/LoopAll.js +18 -0
  220. package/src/Components/Icons/Maximize.js +14 -0
  221. package/src/Components/Icons/Microphone.js +14 -0
  222. package/src/Components/Icons/Minimize.js +14 -0
  223. package/src/Components/Icons/Minus.js +18 -0
  224. package/src/Components/Icons/MobileScreenButton.js +14 -0
  225. package/src/Components/Icons/MoneyBill.js +14 -0
  226. package/src/Components/Icons/MoneyBillWave.js +14 -0
  227. package/src/Components/Icons/Mouth.js +24 -0
  228. package/src/Components/Icons/Music.js +14 -0
  229. package/src/Components/Icons/NoLoop.js +24 -0
  230. package/src/Components/Icons/NoReorderRows.js +25 -0
  231. package/src/Components/Icons/ObjectGroupRegular.js +14 -0
  232. package/src/Components/Icons/Pause.js +14 -0
  233. package/src/Components/Icons/Pencil.js +18 -0
  234. package/src/Components/Icons/Phone.js +14 -0
  235. package/src/Components/Icons/Play.js +14 -0
  236. package/src/Components/Icons/Plus.js +18 -0
  237. package/src/Components/Icons/Presentation.js +19 -0
  238. package/src/Components/Icons/Print.js +18 -0
  239. package/src/Components/Icons/Question.js +14 -0
  240. package/src/Components/Icons/Rate-.25x.js +20 -0
  241. package/src/Components/Icons/Rate-.5x.js +19 -0
  242. package/src/Components/Icons/Rate-.75x.js +19 -0
  243. package/src/Components/Icons/Rate-1.25x.js +20 -0
  244. package/src/Components/Icons/Rate-1.5x.js +19 -0
  245. package/src/Components/Icons/Rate-1.75x.js +19 -0
  246. package/src/Components/Icons/Rate-1x.js +19 -0
  247. package/src/Components/Icons/Rate-2x.js +19 -0
  248. package/src/Components/Icons/RateIcon-.25x.js +20 -0
  249. package/src/Components/Icons/RateIcon-.5x.js +19 -0
  250. package/src/Components/Icons/RateIcon-.75x.js +19 -0
  251. package/src/Components/Icons/RateIcon-1.25x.js +20 -0
  252. package/src/Components/Icons/RateIcon-1.5x.js +19 -0
  253. package/src/Components/Icons/RateIcon-1.75x.js +19 -0
  254. package/src/Components/Icons/RateIcon-1x.js +19 -0
  255. package/src/Components/Icons/RateIcon-2x.js +19 -0
  256. package/src/Components/Icons/RectangleXmark.js +14 -0
  257. package/src/Components/Icons/RectangleXmarkRegular.js +14 -0
  258. package/src/Components/Icons/ReorderRows.js +21 -0
  259. package/src/Components/Icons/RightFromBracket.js +14 -0
  260. package/src/Components/Icons/RightToBracket.js +14 -0
  261. package/src/Components/Icons/Rotate.js +18 -0
  262. package/src/Components/Icons/RotateLeft.js +14 -0
  263. package/src/Components/Icons/RotateRight.js +18 -0
  264. package/src/Components/Icons/ScrewdriverWrench.js +14 -0
  265. package/src/Components/Icons/Scroll.js +14 -0
  266. package/src/Components/Icons/Share.js +14 -0
  267. package/src/Components/Icons/Shop.js +14 -0
  268. package/src/Components/Icons/SortDown.js +18 -0
  269. package/src/Components/Icons/SortUp.js +18 -0
  270. package/src/Components/Icons/Square.js +14 -0
  271. package/src/Components/Icons/SquareCheck.js +14 -0
  272. package/src/Components/Icons/SquareCheckRegular.js +14 -0
  273. package/src/Components/Icons/SquareMinus.js +18 -0
  274. package/src/Components/Icons/SquareRegular.js +14 -0
  275. package/src/Components/Icons/Store.js +14 -0
  276. package/src/Components/Icons/ThumbsDown.js +14 -0
  277. package/src/Components/Icons/ThumbsDownRegular.js +14 -0
  278. package/src/Components/Icons/ThumbsUp.js +14 -0
  279. package/src/Components/Icons/ThumbsUpRegular.js +14 -0
  280. package/src/Components/Icons/Trash.js +18 -0
  281. package/src/Components/Icons/TrashCan.js +18 -0
  282. package/src/Components/Icons/TriangleExclamation.js +18 -0
  283. package/src/Components/Icons/Truck.js +14 -0
  284. package/src/Components/Icons/TruckFast.js +14 -0
  285. package/src/Components/Icons/User.js +14 -0
  286. package/src/Components/Icons/UserGroup.js +14 -0
  287. package/src/Components/Icons/UserSecret.js +14 -0
  288. package/src/Components/Icons/X.js +14 -0
  289. package/src/Components/Icons/Xmark.js +14 -0
  290. package/src/Components/Mask.js +11 -0
  291. package/src/Components/Messages/ConfirmationMessage.js +26 -0
  292. package/src/Components/Messages/ErrorMessage.js +15 -0
  293. package/src/Components/Messages/Loading.js +16 -0
  294. package/src/Components/Messages/OkMessage.js +24 -0
  295. package/src/Components/Messages/WaitMessage.js +18 -0
  296. package/src/Components/Panel/AccordionGridPanel.js +94 -0
  297. package/src/Components/Panel/Footer.js +20 -0
  298. package/src/Components/Panel/FormPanel.js +23 -0
  299. package/src/Components/Panel/GridPanel.js +45 -0
  300. package/src/Components/Panel/Header.js +107 -0
  301. package/src/Components/Panel/Panel.js +152 -0
  302. package/src/Components/Panel/TabPanel.js +331 -0
  303. package/src/Components/Panel/UploadDownload.js +10 -0
  304. package/src/Components/Picker/Picker.js +64 -0
  305. package/src/Components/ScreenContainer.js +71 -0
  306. package/src/Components/Screens/DataMgt.js +250 -0
  307. package/src/Components/Toolbar/FilterToolbar.js +20 -0
  308. package/src/Components/Toolbar/Pagination.js +146 -0
  309. package/src/Components/Toolbar/PaginationToolbar.js +22 -0
  310. package/src/Components/Toolbar/Toolbar.js +18 -0
  311. package/src/Components/WaitModal.js +31 -0
  312. package/src/Components/Window/Editor.js +19 -0
  313. package/src/Constants/Alert.js +3 -0
  314. package/src/Constants/Date.js +3 -0
  315. package/src/Constants/Directions.js +8 -0
  316. package/src/Constants/EditorTypes.js +4 -0
  317. package/src/Constants/File.js +2 -0
  318. package/src/Constants/Grid.js +4 -0
  319. package/src/Constants/Input.js +1 -0
  320. package/src/Constants/Selection.js +5 -0
  321. package/src/Constants/Styles.js +86 -0
  322. package/src/Constants/UiModes.js +2 -0
  323. package/src/Data/Hoc/withRedux.js +48 -0
  324. package/src/Data/useOneHatData.js +75 -0
  325. package/src/Functions/BankersRound.js +11 -0
  326. package/src/Functions/Timer.js +92 -0
  327. package/src/Functions/deleteSecure.js +6 -0
  328. package/src/Functions/emptyFn.js +1 -0
  329. package/src/Functions/getComponentFromType.js +106 -0
  330. package/src/Functions/getIsMobile.js +5 -0
  331. package/src/Functions/getPref.js +7 -0
  332. package/src/Functions/getSecure.js +21 -0
  333. package/src/Functions/getTokenHeaders.js +13 -0
  334. package/src/Functions/inArray.js +5 -0
  335. package/src/Functions/isJson.js +8 -0
  336. package/src/Functions/processImage.js +16 -0
  337. package/src/Functions/setPref.js +14 -0
  338. package/src/Functions/setProgress.js +49 -0
  339. package/src/Functions/setSecure.js +35 -0
  340. package/src/Functions/setUiMode.js +5 -0
  341. package/src/Functions/sleep.js +3 -0
  342. package/src/Functions/testProps.js +24 -0
  343. package/src/Functions/trackEngagementHit.js +11 -0
  344. package/src/Functions/verifyCompleted.js +18 -0
  345. package/src/Functions/waitFor.js +16 -0
  346. package/src/Hooks/useAppState.js +34 -0
  347. package/src/Hooks/useAsync.js +13 -0
  348. package/src/Hooks/useBlocking.js +18 -0
  349. package/src/Hooks/useCameraRoll.js +41 -0
  350. package/src/Hooks/useForceUpdate.js +14 -0
  351. package/src/Hooks/useIsMounted.js +14 -0
  352. package/src/Hooks/useNotifications.js +279 -0
  353. package/src/Styles/StyleSheets.js +14 -0
  354. package/src/Styles/ThemeOverrides.js +264 -0
  355. package/src/UiConfig.js +19 -0
@@ -0,0 +1,456 @@
1
+ import { useState, useEffect, } from 'react';
2
+ import {
3
+ Column,
4
+ Modal,
5
+ Text,
6
+ } from 'native-base';
7
+ import inArray from '../../Functions/inArray';
8
+ import getComponentFromType from '../../Functions/getComponentFromType';
9
+ import IconButton from '../Buttons/IconButton';
10
+ import FormPanel from '../Panel/FormPanel';
11
+ import Ban from '../Icons/Ban';
12
+ import Gear from '../Icons/Gear';
13
+ import Toolbar from '../Toolbar/Toolbar';
14
+ import _ from 'lodash';
15
+
16
+ // Filters only work with Repository; not data array
17
+
18
+ export default function withFilters(WrappedComponent) {
19
+ return (props) => {
20
+ const {
21
+ useFilters = false,
22
+ searchAllText = true,
23
+ filter1StartingField = '',
24
+ filter2StartingField = '',
25
+ filter3StartingField = '',
26
+ filter4StartingField = '',
27
+ filter5StartingField = '',
28
+ filter1StartingValue = null,
29
+ filter2StartingValue = null,
30
+ filter3StartingValue = null,
31
+ filter4StartingValue = null,
32
+ filter5StartingValue = null,
33
+
34
+ // withData
35
+ Repository,
36
+ } = props;
37
+
38
+ let modal,
39
+ topToolbar = null;
40
+
41
+ if (useFilters && Repository) {
42
+ const
43
+ [isReady, setIsReady] = useState(false),
44
+ [isFilterSelectorShown, setIsFilterSelectorShown] = useState(false),
45
+ [filter1Field, setFilter1Field] = useState(filter1StartingField || Repository?.getSchema().model.defaultFilters?.[0] || null),
46
+ [filter2Field, setFilter2Field] = useState(filter2StartingField || Repository?.getSchema().model.defaultFilters?.[1] || null),
47
+ [filter3Field, setFilter3Field] = useState(filter3StartingField || Repository?.getSchema().model.defaultFilters?.[2] || null),
48
+ [filter4Field, setFilter4Field] = useState(filter4StartingField || Repository?.getSchema().model.defaultFilters?.[3] || null),
49
+ [filter5Field, setFilter5Field] = useState(filter5StartingField || Repository?.getSchema().model.defaultFilters?.[4] || null),
50
+ [filter1FieldForModal, setFilter1FieldForModal] = useState(filter1Field),
51
+ [filter2FieldForModal, setFilter2FieldForModal] = useState(filter2Field),
52
+ [filter3FieldForModal, setFilter3FieldForModal] = useState(filter3Field),
53
+ [filter4FieldForModal, setFilter4FieldForModal] = useState(filter4Field),
54
+ [filter5FieldForModal, setFilter5FieldForModal] = useState(filter5Field),
55
+ [filterQValue, setFilterQValue] = useState(null),
56
+ [filter1Value, setFilter1Value] = useState(filter1StartingValue),
57
+ [filter2Value, setFilter2Value] = useState(filter2StartingValue),
58
+ [filter3Value, setFilter3Value] = useState(filter3StartingValue),
59
+ [filter4Value, setFilter4Value] = useState(filter4StartingValue),
60
+ [filter5Value, setFilter5Value] = useState(filter5StartingValue),
61
+ [filterFields, setFilterFields] = useState([]),
62
+ onFilterChange = (ix, value) => {
63
+ switch(ix) {
64
+ case 'q':
65
+ setFilterQValue(value);
66
+ break;
67
+ case 0:
68
+ setFilter1Value(value);
69
+ break;
70
+ case 1:
71
+ setFilter2Value(value);
72
+ break;
73
+ case 2:
74
+ setFilter3Value(value);
75
+ break;
76
+ case 3:
77
+ setFilter4Value(value);
78
+ break;
79
+ case 4:
80
+ setFilter5Value(value);
81
+ break;
82
+ default:
83
+ }
84
+ },
85
+ getFilterType = (ix) => {
86
+ const
87
+ filterField = getFilterField(ix),
88
+ filterTypeDefinition = Repository.getSchema().model.filterTypes[filterField];
89
+ let filterType;
90
+ if (_.isString(filterTypeDefinition)) {
91
+ filterType = filterTypeDefinition;
92
+ } else {
93
+ filterType = filterTypeDefinition.type;
94
+ }
95
+ return filterType;
96
+ },
97
+ getFilterField = (ix) => {
98
+ let field;
99
+ switch(ix) {
100
+ case 0:
101
+ field = filter1Field;
102
+ break;
103
+ case 1:
104
+ field = filter2Field;
105
+ break;
106
+ case 2:
107
+ field = filter3Field;
108
+ break;
109
+ case 3:
110
+ field = filter4Field;
111
+ break;
112
+ case 4:
113
+ field = filter5Field;
114
+ break;
115
+ default:
116
+ }
117
+ return field;
118
+ },
119
+ getFilterValue = (ix) => {
120
+ let value;
121
+ switch(ix) {
122
+ case 'q':
123
+ value = filterQValue;
124
+ break;
125
+ case 0:
126
+ value = filter1Value;
127
+ break;
128
+ case 1:
129
+ value = filter2Value;
130
+ break;
131
+ case 2:
132
+ value = filter3Value;
133
+ break;
134
+ case 3:
135
+ value = filter4Value;
136
+ break;
137
+ case 4:
138
+ value = filter5Value;
139
+ break;
140
+ default:
141
+ }
142
+ return value;
143
+ },
144
+ getIsFilterRange = (ix) => {
145
+ const filterType = getFilterType(0);
146
+ return inArray(filterType, ['NumberRange', 'DateRange']);
147
+ },
148
+ renderFilters = () => {
149
+ if (!Repository) {
150
+ return null;
151
+ }
152
+
153
+ const
154
+ {
155
+ titles = [],
156
+ filterTypes = [],
157
+ virtualFields = [],
158
+ excludeFields = [],
159
+ } = Repository.getSchema().model,
160
+ filterProps = {
161
+ mx: 1,
162
+ },
163
+ filterElements = [],
164
+ addFilter = (fieldName, ix) => {
165
+ if (ix === 'q') {
166
+ // special case
167
+ const Element = getComponentFromType('Input');
168
+ filterElements.push(<Element
169
+ key={ix}
170
+ tooltip="Search all text fields"
171
+ placeholder="All text fields"
172
+ value={getFilterValue(ix)}
173
+ autoSubmit={true}
174
+ onChangeValue={(value) => onFilterChange(ix, value)}
175
+ {...filterProps}
176
+ />);
177
+ return;
178
+ }
179
+ if (inArray(fieldName, virtualFields) || inArray(fieldName, excludeFields)) {
180
+ return; // skip
181
+ }
182
+ const filterType = filterTypes[fieldName];
183
+ let Element,
184
+ modelProps = {};
185
+ if (_.isString(filterType)) {
186
+ Element = getComponentFromType(filterType);
187
+ } else if (_.isPlainObject(filterType)) {
188
+ const {
189
+ type,
190
+ ...p
191
+ } = filterType;
192
+ modelProps = p;
193
+ Element = getComponentFromType(type);
194
+ }
195
+ if (!Element) {
196
+ debugger;
197
+ }
198
+ filterElements.push(<Element
199
+ key={ix}
200
+ tooltip={titles[fieldName]}
201
+ placeholder={titles[fieldName]}
202
+ value={getFilterValue(ix)}
203
+ onChangeValue={(value) => onFilterChange(ix, value)}
204
+ {...filterProps}
205
+ {...modelProps}
206
+ />);
207
+ };
208
+ if (searchAllText) {
209
+ addFilter(null, 'q');
210
+ }
211
+ if (filter1Field) {
212
+ addFilter(filter1Field, 0);
213
+ }
214
+ if (filter2Field) {
215
+ addFilter(filter2Field, 1);
216
+ }
217
+ if (filter3Field) {
218
+ addFilter(filter3Field, 2);
219
+ }
220
+ if (filter4Field) {
221
+ addFilter(filter4Field, 3);
222
+ }
223
+ if (filter5Field) {
224
+ addFilter(filter5Field, 4);
225
+ }
226
+
227
+ filterElements.push(<IconButton
228
+ key="clear"
229
+ _icon={{
230
+ as: Ban,
231
+ }}
232
+ ml={1}
233
+ onPress={onClearFilters}
234
+ tooltip="Clear all filters"
235
+ />);
236
+ filterElements.push(<IconButton
237
+ key="gear"
238
+ _icon={{
239
+ as: Gear,
240
+ }}
241
+ ml={1}
242
+ onPress={() => setIsFilterSelectorShown(true)}
243
+ tooltip="Swap filters"
244
+ />);
245
+
246
+ return filterElements;
247
+ },
248
+ setFiltersOn = (ix, filters, newFilterFields) => {
249
+ const
250
+ filterIxField = getFilterField(ix),
251
+ filterIxValue = getFilterValue(ix),
252
+ isFilterRange = getIsFilterRange(ix);
253
+ let highValue,
254
+ lowValue,
255
+ highField,
256
+ lowField;
257
+ if (isFilterRange && !!filterIxValue) {
258
+ highValue = filterIxValue.high;
259
+ lowValue = filterIxValue.low;
260
+ highField = filterIxField + ' <=';
261
+ lowField = filterIxField + ' >=';
262
+
263
+ newFilterFields.push(highField);
264
+ newFilterFields.push(lowField);
265
+ filters.push({ name: highField, value: highValue, });
266
+ filters.push({ name: lowField, value: lowValue, });
267
+ } else {
268
+ newFilterFields.push(filterIxField);
269
+ filters.push({ name: filterIxField, value: filterIxValue, });
270
+ }
271
+ },
272
+ onClearFilters = () => {
273
+ setFilterQValue(null);
274
+ setFilter1Value(null);
275
+ setFilter2Value(null);
276
+ setFilter3Value(null);
277
+ setFilter4Value(null);
278
+ setFilter5Value(null);
279
+ };
280
+
281
+ useEffect(() => {
282
+ const
283
+ filters = [],
284
+ newFilterFields = [];
285
+
286
+ // For each filter field that is set, add a real filter for it
287
+ if (filter1Field) {
288
+ setFiltersOn(0, filters, newFilterFields);
289
+ }
290
+ if (filter2Field) {
291
+ setFiltersOn(1, filters, newFilterFields);
292
+ }
293
+ if (filter3Field) {
294
+ setFiltersOn(2, filters, newFilterFields);
295
+ }
296
+ if (filter4Field) {
297
+ setFiltersOn(3, filters, newFilterFields);
298
+ }
299
+ if (filter5Field) {
300
+ setFiltersOn(4, filters, newFilterFields);
301
+ }
302
+ if (searchAllText && !_.isEmpty(filterQValue)) {
303
+ const q = 'q';
304
+ newFilterFields.push(q);
305
+ filters.push({ name: q, value: filterQValue, });
306
+ }
307
+ setFilterFields(newFilterFields);
308
+
309
+ // Go through previous filterFields see if any are no longer used. If no longer used, set it to null so it'll be deleted
310
+ _.each(filterFields, (filterField) => {
311
+ if (!inArray(filterField, newFilterFields)) {
312
+ filters.push({ name: filterField, value: null, });
313
+ }
314
+ });
315
+
316
+ Repository.filter(filters, null, false); // false so other filters remain
317
+
318
+ if (!isReady) {
319
+ setIsReady(true);
320
+ }
321
+
322
+ }, [filter1Field, filter2Field, filter3Field, filter4Field, filter5Field,
323
+ filter1Value, filter2Value, filter3Value, filter4Value, filter5Value,
324
+ filterQValue,]);
325
+
326
+ if (!isReady) {
327
+ return null;
328
+ }
329
+
330
+
331
+ let filterComboProps = {};
332
+ if (Repository?.getSchema().model.titles) {
333
+ filterComboProps.data = [];
334
+ const schemaModel = Repository.getSchema().model;
335
+ _.each(schemaModel.titles, (title, fieldName) => {
336
+ if (!inArray(fieldName, schemaModel.virtualFields) && !inArray(fieldName, schemaModel.excludeFields) && !inArray(fieldName, schemaModel.filteringDisabled)) {
337
+ filterComboProps.data.push([fieldName, title]);
338
+ }
339
+ });
340
+ topToolbar = <Toolbar justifyContent="space-between"><Text pt={2} pr={2} userSelect="none">Filters:</Text>{renderFilters()}</Toolbar>;
341
+ }
342
+
343
+ if (isFilterSelectorShown) {
344
+ modal = <Modal
345
+ isOpen={true}
346
+ onClose={() => setIsFilterSelectorShown(false)}
347
+ >
348
+ <Column bg="#fff" w={500}>
349
+ <FormPanel
350
+ title="Filter Selector"
351
+ instructions="Please select which fields to filter by. You may select up to five filters. Leave blank for no filter."
352
+ flex={1}
353
+ startingValues={{
354
+ filter1: filter1Field,
355
+ filter2: filter2Field,
356
+ filter3: filter3Field,
357
+ filter4: filter4Field,
358
+ filter5: filter5Field,
359
+ }}
360
+ items={[
361
+ {
362
+ type: 'Column',
363
+ flex: 1,
364
+ items: [
365
+ {
366
+ type: 'Combo',
367
+ label: 'Filter 1',
368
+ name: 'filter1',
369
+ onChangeValue: (value) => {
370
+ setFilter1FieldForModal(value);
371
+ },
372
+ ...filterComboProps,
373
+ },
374
+ {
375
+ type: 'Combo',
376
+ label: 'Filter 2',
377
+ name: 'filter2',
378
+ onChangeValue: (value) => {
379
+ setFilter2FieldForModal(value);
380
+ },
381
+ ...filterComboProps,
382
+ },
383
+ {
384
+ type: 'Combo',
385
+ label: 'Filter 3',
386
+ name: 'filter3',
387
+ onChangeValue: (value) => {
388
+ setFilter3FieldForModal(value);
389
+ },
390
+ ...filterComboProps,
391
+ },
392
+ {
393
+ type: 'Combo',
394
+ label: 'Filter 4',
395
+ name: 'filter4',
396
+ onChangeValue: (value) => {
397
+ setFilter4FieldForModal(value);
398
+ },
399
+ ...filterComboProps,
400
+ },
401
+ {
402
+ type: 'Combo',
403
+ label: 'Filter 5',
404
+ name: 'filter5',
405
+ onChangeValue: (value) => {
406
+ setFilter5FieldForModal(value);
407
+ },
408
+ ...filterComboProps,
409
+ },
410
+ ],
411
+ }, // END Column
412
+ ]}
413
+ onCancel={(e) => {
414
+ setFilter1FieldForModal(filter1Field);
415
+ setFilter2FieldForModal(filter2Field);
416
+ setFilter3FieldForModal(filter3Field);
417
+ setFilter4FieldForModal(filter4Field);
418
+ setFilter5FieldForModal(filter5Field);
419
+ setIsFilterSelectorShown(false);
420
+ }}
421
+ onSave={(data, e) => {
422
+ if (filter1FieldForModal !== filter1Field) {
423
+ setFilter1Field(filter1FieldForModal);
424
+ setFilter1Value(null);
425
+ }
426
+ if (filter2FieldForModal !== filter2Field) {
427
+ setFilter2Field(filter2FieldForModal);
428
+ setFilter2Value(null);
429
+ }
430
+ if (filter3FieldForModal !== filter3Field) {
431
+ setFilter3Field(filter3FieldForModal);
432
+ setFilter3Value(null);
433
+ }
434
+ if (filter4FieldForModal !== filter4Field) {
435
+ setFilter4Field(filter4FieldForModal);
436
+ setFilter4Value(null);
437
+ }
438
+ if (filter5FieldForModal !== filter5Field) {
439
+ setFilter5Field(filter5FieldForModal);
440
+ setFilter5Value(null);
441
+ }
442
+ setIsFilterSelectorShown(false);
443
+ }}
444
+ />
445
+ </Column>
446
+ </Modal>;
447
+ }
448
+
449
+ } // END if (useFilters)
450
+
451
+ return <>
452
+ <WrappedComponent topToolbar={topToolbar} {...props} />
453
+ {modal}
454
+ </>;
455
+ };
456
+ }
@@ -0,0 +1,119 @@
1
+ import React, { useState, useEffect, useRef, } from 'react';
2
+ import {
3
+ Column,
4
+ Modal,
5
+ Row,
6
+ Text,
7
+ } from 'native-base';
8
+ import {
9
+ EDITOR_TYPE_INLINE,
10
+ } from '../../Constants/EditorTypes';
11
+ import {
12
+ UI_MODE_WEB,
13
+ UI_MODE_REACT_NATIVE,
14
+ } from '../../Constants/UiModes';
15
+ import UiConfig from '../../UiConfig';
16
+ import Form from '../Form/Form';
17
+ import withEditor from './withEditor';
18
+ import styles from '../../Constants/Styles';
19
+ import _ from 'lodash';
20
+
21
+ export default function withInlineEditor(WrappedComponent) {
22
+ if (UiConfig.mode === UI_MODE_REACT_NATIVE) {
23
+ throw new Error('Not yet implemented for RN.');
24
+ }
25
+ return withEditor((props) => {
26
+ const {
27
+ useEditor = false,
28
+ editorType,
29
+ isEditorShown,
30
+ setIsEditorShown,
31
+ isEditorViewOnly,
32
+ onEditorCancel,
33
+ onEditorSave,
34
+ onEditorClose,
35
+
36
+ // withSelection
37
+ selection,
38
+
39
+ // withData
40
+ Repository,
41
+ } = props,
42
+ inlineEditorRef = useRef(),
43
+ [localColumnsConfig, setLocalColumnsConfig] = useState([]),
44
+ [currentRow, setCurrentRow] = useState(),
45
+ onChangeColumnsConfig = (columnsConfig) => {
46
+ setLocalColumnsConfig(columnsConfig);
47
+ },
48
+ onRowClick = (item, rowIndex, e) => {
49
+ // move the editor up to the appropriate row
50
+ const currentRow = e.currentTarget;
51
+ moveEditor(currentRow);
52
+
53
+ setCurrentRow(currentRow);
54
+ },
55
+ onScreenResize = () => {
56
+ // TODO: Attach a div with zIndex 0 to body to monitor resize events. THis is handler
57
+
58
+ moveEditor(currentRow);
59
+ },
60
+ moveEditor = (currentRow) => {
61
+ const
62
+ bounds = currentRow.getBoundingClientRect(),
63
+ r = inlineEditorRef.current.style;
64
+ r.top = bounds.top -8 + 'px';
65
+ r.left = bounds.left + 'px';
66
+ r.width = bounds.width + 'px';
67
+ };
68
+
69
+ if (isEditorShown && selection.length !== 1) {
70
+ throw new Error('Can only edit one at a time with inline editor!');
71
+ }
72
+
73
+ return <>
74
+ <WrappedComponent
75
+ {...props}
76
+ inlineEditorRef={inlineEditorRef}
77
+ onChangeColumnsConfig={onChangeColumnsConfig}
78
+ onEditorRowClick={onRowClick}
79
+ />
80
+ {useEditor && editorType === EDITOR_TYPE_INLINE && Repository &&
81
+ <Modal
82
+ isOpen={isEditorShown}
83
+ onClose={() => setIsEditorShown(false)}
84
+ >
85
+ <Column position="absolute" ref={inlineEditorRef}>
86
+ {isEditorShown && <Form
87
+ editorType={EDITOR_TYPE_INLINE}
88
+ record={selection[0]}
89
+ Repository={Repository}
90
+ isMultiple={selection.length > 1}
91
+ isViewOnly={isEditorViewOnly}
92
+ columnsConfig={localColumnsConfig}
93
+ onCancel={onEditorCancel}
94
+ onSave={onEditorSave}
95
+ onClose={onEditorClose}
96
+ footerProps={{
97
+ justifyContent: 'center',
98
+ bg: null, // make bg transparent
99
+ p: 0,
100
+ }}
101
+ buttonGroupProps={{
102
+ bg: 'primary.100',
103
+ borderBottomRadius: 5,
104
+ px: 4,
105
+ py: 2,
106
+ }}
107
+ bg="#fff"
108
+ borderTopWidth={4}
109
+ borderTopColor={styles.GRID_INLINE_EDITOR_BORDER_COLOR}
110
+ borderBottomWidth={4}
111
+ borderBottomColor={styles.GRID_INLINE_EDITOR_BORDER_COLOR}
112
+ py={1}
113
+ px={0}
114
+ />}
115
+ </Column>
116
+ </Modal>}
117
+ </>;
118
+ });
119
+ }
@@ -0,0 +1,16 @@
1
+ import {
2
+ SELECTION_MODE_MULTI,
3
+ } from '../../Constants/Selection';
4
+
5
+ export default function withMultiSelection(WrappedComponent) {
6
+ return (props) => {
7
+ const
8
+ {
9
+ selectionMode = SELECTION_MODE_MULTI,
10
+ } = props;
11
+ return <WrappedComponent
12
+ selectionMode={selectionMode}
13
+ {...props}
14
+ />;
15
+ };
16
+ }