@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,421 @@
1
+ import { useState, useEffect, } from 'react';
2
+ import {
3
+ Column,
4
+ Row,
5
+ Text,
6
+ } from 'native-base';
7
+ import {
8
+ SenchaGrid,
9
+ AddressColumn,
10
+ BooleanColumn,
11
+ CheckboxColumn,
12
+ ColorColumn,
13
+ Column as Col,
14
+ DateColumn,
15
+ DecimalColumn,
16
+ EmailColumn,
17
+ FloatColumn,
18
+ IntegerColumn,
19
+ MoneyColumn,
20
+ NumberColumn,
21
+ PercentageColumn,
22
+ PhoneColumn,
23
+ TreeColumn,
24
+ } from '@sencha/sencha-grid'; // https://www.npmjs.com/package/@sencha/sencha-grid
25
+ import '@sencha/sencha-grid/dist/themes/grui.css';
26
+ import testProps from '../../Functions/testProps';
27
+ import useForceUpdate from '../../Hooks/useForceUpdate';
28
+ import Loading from '../Messages/Loading';
29
+ import Toolbar from '../Toolbar/Toolbar';
30
+ import PaginationToolbar from '../Toolbar/PaginationToolbar';
31
+ import NoRecordsFound from './NoRecordsFound';
32
+ import AngleRight from '../Icons/AngleRight';
33
+ import _ from 'lodash';
34
+
35
+ // This grid makes use of @sencha/sencha-grid
36
+
37
+ export default function Grid(props) {
38
+ const {
39
+ Repository,
40
+ topToolbar,
41
+ bottomToolbar = 'pagination',
42
+ columnsConfig = [], // json configurations for each column
43
+ showSummaries = false,
44
+ showEditors = false,
45
+ showFilters = false,
46
+ showRowExpander = false,
47
+ cellEditing = false,
48
+ rowEditing = false,
49
+ // columnProps = {},
50
+ // getRowProps = () => {
51
+ // return {
52
+ // bg: '#fff',
53
+ // p: 2,
54
+ // };
55
+ // },
56
+ gridProps = {},
57
+ pullToRefresh = true,
58
+ hideRightColumn = true,
59
+ disableLoadingIndicator = false,
60
+ noneFoundText,
61
+ disableReloadOnChangeFilters = false,
62
+
63
+ // properties
64
+ data,
65
+ treeData,
66
+ columnLines = true,
67
+ grouped = false,
68
+ groupFooter = false,
69
+ groupField,
70
+ hideHeaders = false,
71
+ scrollable = false,
72
+ itemConfig, // { body: <RowBodyComponent /> },
73
+ itemRipple, // { color: 'green' },
74
+ hideRowLines = false,
75
+ rowNumbers = false,
76
+ selectable = {
77
+ cells: false,
78
+ checkbox: true,
79
+ // checkboxColumnIndex: 0,
80
+ columns: true,
81
+ deselectable: true,
82
+ disabled: false,
83
+ drag: true,
84
+ extensible: true,
85
+ headerCheckbox: true,
86
+ mode: 'multi', // single | multi
87
+ reducible: true,
88
+ rows: true,
89
+ },
90
+ shadow = false,
91
+ sortable = true,
92
+ variableHeights = true,
93
+
94
+
95
+ // events
96
+ onBeforeComplete,
97
+ onBeforeEdit,
98
+ onBeforeGroupCollapse,
99
+ onBeforeGroupExpand,
100
+ onBeforeStartEdit,
101
+ onBeforeCancelEdit,
102
+ onCellSelection,
103
+ onColumnAdd,
104
+ onColumnHide,
105
+ onColumnMenuCreated,
106
+ onColumnMove,
107
+ onColumnResize,
108
+ onColumnSelection,
109
+ onColumnSort,
110
+ onCompleteEdit,
111
+ onDeselect,
112
+ onEdit,
113
+ onEditRestrict,
114
+ onInitialized,
115
+ onPainted,
116
+ onSelect,
117
+ onStartEdit,
118
+ onUpdateData,
119
+ onValidateEdit,
120
+
121
+ } = props,
122
+ entities = Repository.entities,
123
+ [isLoading, setIsLoading] = useState(false),
124
+ forceUpdate = useForceUpdate(),
125
+ onRefresh = () => Repository.load(),
126
+ generateColumnComponents = () => {
127
+ const columnComponents = [];
128
+ _.each(columnsConfig, (column, ix) => {
129
+
130
+ // This destructuring sets the default values
131
+ const {
132
+ type, // specify which sencha column type to use
133
+
134
+ align = 'left',
135
+ dateTimeFormatLocales = 'en-US',
136
+ editable = false,
137
+ editor, // BooleanEditor | CheckboxEditor | ColorEditor | DateEditor | IEditor | NumberEditor | PhoneEditor | SelectEditor | TextEditor |
138
+ flex,
139
+ field, // required
140
+ format,
141
+ groupable = false,
142
+ hideable = false,
143
+ hidden = false,
144
+ locked = false,
145
+ menu, // [{ text: 'menu1' }, { text: 'menu2' }]
146
+ menuDisabled = false,
147
+ minWidth,
148
+ renderer, // React component will render the output
149
+ resizable = true,
150
+ sortable = true,
151
+ style,
152
+ summary, // sum, min, max, average, variance, variancep, stddev, stddevp
153
+ summaryCell, // 'numbercell'
154
+ summaryRenderer, // fn that returns value as formatted string, like (value) => 'Maximum Cost: ' + value;
155
+ text, // i.e. header
156
+ width,
157
+ } = column,
158
+
159
+ // This var incorporates the default values, and puts them back in an obj we pass to column
160
+ propsToPass = {
161
+ align,
162
+ dateTimeFormatLocales,
163
+ editable,
164
+ field,
165
+ groupable,
166
+ hideable,
167
+ hidden,
168
+ locked,
169
+ menuDisabled,
170
+ resizable,
171
+ sortable,
172
+ },
173
+ propsToCheck = {
174
+ editor,
175
+ format,
176
+ menu,
177
+ minWidth,
178
+ renderer,
179
+ style,
180
+ summary,
181
+ summaryCell,
182
+ summaryRenderer,
183
+ text,
184
+ };
185
+ _.each(propsToCheck, (prop, name) => {
186
+ if (!_.isEmpty(prop)) {
187
+ propsToPass[name] = prop;
188
+ }
189
+ });
190
+
191
+ if (!flex && !width) {
192
+ propsToPass.flex = 1;
193
+ } else if (flex) {
194
+ propsToPass.flex = flex;
195
+ } else if (width) {
196
+ propsToPass.width = width;
197
+ }
198
+
199
+ let ColumnType;
200
+ switch(type) {
201
+ case 'address':
202
+ ColumnType = AddressColumn;
203
+ break;
204
+ case 'bool':
205
+ ColumnType = BooleanColumn;
206
+ break;
207
+ case 'checkbox':
208
+ ColumnType = CheckboxColumn;
209
+ break;
210
+ case 'color':
211
+ ColumnType = ColorColumn;
212
+ break;
213
+ case 'date':
214
+ case 'datetime':
215
+ // case 'time':
216
+ ColumnType = DateColumn;
217
+ break;
218
+ case 'decimal':
219
+ ColumnType = DecimalColumn;
220
+ break;
221
+ case 'email':
222
+ ColumnType = EmailColumn;
223
+ break;
224
+ case 'float':
225
+ ColumnType = FloatColumn;
226
+ break;
227
+ case 'int':
228
+ ColumnType = IntegerColumn;
229
+ break;
230
+ case 'currency':
231
+ ColumnType = MoneyColumn;
232
+ break;
233
+ case 'percentInt':
234
+ ColumnType = NumberColumn;
235
+ break;
236
+ case 'percent':
237
+ ColumnType = PercentageColumn;
238
+ break;
239
+ case 'phone':
240
+ ColumnType = PhoneColumn;
241
+ break;
242
+ case 'tree':
243
+ ColumnType = TreeColumn;
244
+ break;
245
+ default:
246
+ ColumnType = Col;
247
+ }
248
+
249
+ if (!_.isEmpty(editor)) {
250
+ propsToPass.editor = editor;
251
+ }
252
+
253
+ columnComponents.push(<ColumnType key={ix} {...propsToPass} />);
254
+ });
255
+
256
+ if (!hideRightColumn) {
257
+ columnComponents.push(<AngleRight
258
+ key={columnComponents.length}
259
+ color="#aaa"
260
+ variant="ghost"
261
+ w={30}
262
+ alignSelf="center"
263
+ ml={3}
264
+ />);
265
+ }
266
+ return columnComponents;
267
+ },
268
+ convertEntitiesToSenchaGrid = () => {
269
+ return _.map(Repository.entities, (entity) => {
270
+ const rec = {};
271
+ _.each(columnsConfig, (config) => {
272
+ rec[config.field] = entity[config.field];
273
+ });
274
+ return rec;
275
+ });
276
+ },
277
+ getPlugins = () => {
278
+ const plugins = {};
279
+ if (showSummaries) {
280
+ plugins.gridsummaryrow = true;
281
+ }
282
+ if (showEditors) {
283
+ plugins.gridcellediting = true;
284
+ }
285
+ if (rowEditing) {
286
+ plugins.rowedit = { autoConfirm: false, };
287
+ }
288
+ if (showRowExpander) {
289
+ plugins.rowexpander = true;
290
+ }
291
+ if (cellEditing) {
292
+ plugins.cellediting = { clicksToEdit: 2, };
293
+ }
294
+ if (showFilters) {
295
+ plugins.gridfilters = true;
296
+ }
297
+ if (grouped) {
298
+ plugins.groupingpanel = true;
299
+ }
300
+ if (pullToRefresh) {
301
+ // plugins.pullrefresh = true; // causes a crash!
302
+ }
303
+ return plugins;
304
+ };
305
+
306
+ useEffect(() => {
307
+ if (!Repository || !Repository.on) {
308
+ return;
309
+ }
310
+ if (disableLoadingIndicator) {
311
+ return;
312
+ }
313
+ const
314
+ setTrue = () => setIsLoading(true),
315
+ setFalse = () => setIsLoading(false),
316
+ onChangeFilters = () => {
317
+ if (!Repository.isAutoLoad && Repository.isLoaded && !disableReloadOnChangeFilters) {
318
+ Repository.reload();
319
+ }
320
+ };
321
+
322
+ Repository.on('beforeLoad', setTrue);
323
+ Repository.on('load', setFalse);
324
+ Repository.ons(['changePage', 'changePageSize', 'changeData', 'change'], forceUpdate);
325
+ Repository.on('changeFilters', onChangeFilters);
326
+
327
+ // LEFT OFF HERE.
328
+ // If changing the pageSize to 5, it says that it's showing page 1, but it doesn't show the first item.
329
+ // Nav to other pages doesn't work right yet.
330
+
331
+ return () => {
332
+ Repository.off('beforeLoad', setTrue);
333
+ Repository.off('load', setFalse);
334
+ Repository.offs(['changePage', 'changePageSize', 'changeData', 'change'], forceUpdate);
335
+ Repository.off('changeFilters', onChangeFilters);
336
+ };
337
+ }, [Repository, disableLoadingIndicator, disableReloadOnChangeFilters, forceUpdate]);
338
+
339
+ if (!props.Repository) {
340
+ return null;
341
+ }
342
+
343
+ const propsToPass = {
344
+ columnLines,
345
+ grouped,
346
+ groupFooter,
347
+ hideHeaders,
348
+ scrollable,
349
+ hideRowLines,
350
+ rowNumbers,
351
+ selectable,
352
+ shadow,
353
+ sortable,
354
+ variableHeights,
355
+ },
356
+ columnComponents = generateColumnComponents(),
357
+ plugins = getPlugins(),
358
+ propsToCheck = {
359
+ plugins,
360
+ groupField,
361
+ itemConfig,
362
+ itemRipple,
363
+ onBeforeComplete,
364
+ onBeforeEdit,
365
+ onBeforeGroupCollapse,
366
+ onBeforeGroupExpand,
367
+ onBeforeStartEdit,
368
+ onBeforeCancelEdit,
369
+ onCellSelection,
370
+ onColumnAdd,
371
+ onColumnHide,
372
+ onColumnMenuCreated,
373
+ onColumnMove,
374
+ onColumnResize,
375
+ onColumnSelection,
376
+ onColumnSort,
377
+ onCompleteEdit,
378
+ onDeselect,
379
+ onEdit,
380
+ onEditRestrict,
381
+ onInitialized,
382
+ onPainted,
383
+ onSelect,
384
+ onStartEdit,
385
+ onUpdateData,
386
+ onValidateEdit,
387
+ }
388
+ _.each(propsToCheck, (prop, name) => {
389
+ if (!_.isEmpty(prop)) {
390
+ propsToPass[name] = prop;
391
+ }
392
+ });
393
+ if (!_.isEmpty(data)) {
394
+ propsToPass.data = data;
395
+ } else if (!_.isEmpty(treeData)) {
396
+ propsToPass.treeData = treeData;
397
+ } else {
398
+ propsToPass.data = convertEntitiesToSenchaGrid();
399
+ }
400
+
401
+ return <Column
402
+ {...testProps('GridPanelContainer')}
403
+ flex={1}
404
+ w="100%"
405
+ >
406
+ {topToolbar && <Toolbar>{topToolbar}</Toolbar>}
407
+
408
+ {isLoading && <Column flex={1}><Loading /></Column>}
409
+
410
+ {!isLoading && (!entities.length ? <NoRecordsFound text={noneFoundText} onRefresh={onRefresh} /> :
411
+
412
+ <SenchaGrid {...propsToPass} style={{ width: "100%", height: "100%", flex: 1, }} {...gridProps}>
413
+ {columnComponents}
414
+ </SenchaGrid>)}
415
+
416
+ {bottomToolbar && (bottomToolbar === 'pagination' ?
417
+ <PaginationToolbar Repository={Repository} />:
418
+ <Toolbar>{bottomToolbar}</Toolbar>)}
419
+ </Column>;
420
+
421
+ }
@@ -0,0 +1,6 @@
1
+ .reactgrid {
2
+ flex: 1;
3
+ width: 100% !important;
4
+ height: auto;
5
+ overflow: scroll;
6
+ }
@@ -0,0 +1,176 @@
1
+ import React, { useState, useRef, useEffect, } from 'react';
2
+ import {
3
+ Button,
4
+ Column,
5
+ Icon,
6
+ Modal,
7
+ Row,
8
+ Text,
9
+ } from 'native-base';
10
+ import {
11
+ ALERT_MODE_OK,
12
+ ALERT_MODE_YES_NO,
13
+ ALERT_MODE_CUSTOM,
14
+ } from '../../Constants/Alert';
15
+ import Panel from '../Panel/Panel';
16
+ import Footer from '../Panel/Footer';
17
+ import TriangleExclamation from '../Icons/TriangleExclamation';
18
+ import _ from 'lodash';
19
+
20
+ export default function withAlert(WrappedComponent) {
21
+ return (props) => {
22
+ const
23
+ [isAlertShown, setIsAlertShown] = useState(false),
24
+ [title, setTitle] = useState(''),
25
+ [message, setMessage] = useState(''),
26
+ [includeCancel, setIncludeCancel] = useState(false),
27
+ [okCallback, setOkCallback] = useState(),
28
+ [yesCallback, setYesCallback] = useState(),
29
+ [noCallback, setNoCallback] = useState(),
30
+ [customButtons, setCustomButtons] = useState(),
31
+ [mode, setMode] = useState(ALERT_MODE_OK),
32
+ autoFocusRef = useRef(null),
33
+ onAlert = (arg1, callback, includeCancel = false) => {
34
+ clearAll();
35
+ if (_.isString(arg1)) {
36
+ setMode(ALERT_MODE_OK);
37
+ setTitle('Alert');
38
+ setMessage(arg1);
39
+ setOkCallback(() => callback);
40
+ } else if (_.isPlainObject(arg1)) {
41
+ // custom
42
+ const {
43
+ title = 'Alert',
44
+ message,
45
+ buttons,
46
+ } = arg1;
47
+ setMode(ALERT_MODE_CUSTOM);
48
+ setTitle(title);
49
+ setMessage(message);
50
+ setCustomButtons(buttons);
51
+ }
52
+ setIncludeCancel(includeCancel);
53
+ showAlert();
54
+ },
55
+ onConfirm = (message, callback, includeCancel = false) => {
56
+ clearAll();
57
+ setMode(ALERT_MODE_YES_NO);
58
+ setTitle('Confirm');
59
+ setMessage(message);
60
+ setIncludeCancel(includeCancel);
61
+ setYesCallback(() => callback);
62
+ showAlert();
63
+ },
64
+ onCancel = () => {
65
+ setIsAlertShown(false);
66
+ },
67
+ onOk = () => {
68
+ const callback = okCallback;
69
+ hideAlert();
70
+ if (callback) {
71
+ callback();
72
+ }
73
+ },
74
+ onYes = () => {
75
+ const callback = yesCallback;
76
+ hideAlert();
77
+ if (callback) {
78
+ callback();
79
+ }
80
+ },
81
+ onNo = () => {
82
+ const callback = noCallback;
83
+ hideAlert();
84
+ if (callback) {
85
+ callback();
86
+ }
87
+ },
88
+ showAlert = () => {
89
+ setIsAlertShown(true);
90
+ },
91
+ hideAlert = () => {
92
+ setIsAlertShown(false);
93
+ },
94
+ clearAll = () => {
95
+ setOkCallback();
96
+ setYesCallback();
97
+ setNoCallback();
98
+ setCustomButtons();
99
+ };
100
+
101
+ let buttons = [];
102
+ if (includeCancel) {
103
+ buttons.push(<Button
104
+ key="cancelBtn"
105
+ onPress={onCancel}
106
+ color="#fff"
107
+ variant="ghost"
108
+ >Cancel</Button>);
109
+ }
110
+ switch(mode) {
111
+ case ALERT_MODE_OK:
112
+ buttons.push(<Button
113
+ key="okBtn"
114
+ ref={autoFocusRef}
115
+ onPress={onOk}
116
+ color="#fff"
117
+ >OK</Button>);
118
+ break;
119
+ case ALERT_MODE_YES_NO:
120
+ buttons.push(<Button
121
+ key="noBtn"
122
+ onPress={onNo}
123
+ color="#fff"
124
+ variant="ghost"
125
+ >No</Button>);
126
+ buttons.push(<Button
127
+ key="yesBtn"
128
+ ref={autoFocusRef}
129
+ onPress={onYes}
130
+ color="#fff"
131
+ >Yes</Button>);
132
+ break;
133
+ case ALERT_MODE_CUSTOM:
134
+ buttons = customButtons;
135
+ break;
136
+ default:
137
+ }
138
+
139
+ return <>
140
+ <WrappedComponent
141
+ {...props}
142
+ alert={onAlert}
143
+ confirm={onConfirm}
144
+ />
145
+ <Modal
146
+ isOpen={isAlertShown}
147
+ onOpen={() => {debugger;}}
148
+ onClose={() => setIsAlertShown(false)}
149
+ >
150
+ <Column bg="#fff" w={400} onLayout={() => {
151
+ if (autoFocusRef.current) {
152
+ autoFocusRef.current.focus();
153
+ }
154
+ }}>
155
+ <Panel
156
+ title={title}
157
+ isCollapsible={false}
158
+ p={5}
159
+ footer={<Footer justifyContent="flex-end" >
160
+ <Button.Group space={2}>
161
+ {buttons}
162
+ </Button.Group>
163
+ </Footer>}
164
+ >
165
+ <Row flex={1}>
166
+ <Column w={50} p={0} mr={5}>
167
+ <Icon as={TriangleExclamation} size={10}/>
168
+ </Column>
169
+ <Text>{message}</Text>
170
+ </Row>
171
+ </Panel>
172
+ </Column>
173
+ </Modal>
174
+ </>;
175
+ };
176
+ }
@@ -0,0 +1,12 @@
1
+ import {
2
+ } from 'native-base';
3
+ import _ from 'lodash';
4
+
5
+ export default function withBlank(WrappedComponent) {
6
+ return (props) => {
7
+ const {
8
+
9
+ } = props;
10
+ return <WrappedComponent {...props} />;
11
+ };
12
+ }
@@ -0,0 +1,20 @@
1
+ import { useState } from 'react';
2
+
3
+ export default function withCollapsible(WrappedComponent) {
4
+ return (props) => {
5
+ const
6
+ {
7
+ isCollapsed = false,
8
+ startsCollapsed = false,
9
+ setIsCollapsed,
10
+ } = props,
11
+ bypass = !!setIsCollapsed,
12
+ [localIsCollapsed, setLocalIsCollapsed] = useState(startsCollapsed);
13
+
14
+ return <WrappedComponent
15
+ isCollapsed={bypass ? isCollapsed : localIsCollapsed}
16
+ setIsCollapsed={bypass ? setIsCollapsed : setLocalIsCollapsed}
17
+ {...props}
18
+ />;
19
+ };
20
+ }