@fto-consult/expo-ui 1.0.4

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 (629) hide show
  1. package/assets/adaptive-icon.png +0 -0
  2. package/assets/add_photo.png +0 -0
  3. package/assets/favicon.png +0 -0
  4. package/assets/icon.png +0 -0
  5. package/assets/logo.png +0 -0
  6. package/assets/splash.png +0 -0
  7. package/babel.config.alias.js +32 -0
  8. package/babel.config.js +18 -0
  9. package/circular-dependencies.js +24 -0
  10. package/compiler.config.js +28 -0
  11. package/expo.metro.config.js +27 -0
  12. package/index.js +21 -0
  13. package/metro.config.js +1 -0
  14. package/package.json +60 -0
  15. package/src/App.js +65 -0
  16. package/src/Preferences.js +5 -0
  17. package/src/auth/Login.js +254 -0
  18. package/src/auth/index.js +3 -0
  19. package/src/components/ActivityIndicator/index.js +9 -0
  20. package/src/components/Animations/Animation/index.js +95 -0
  21. package/src/components/Animations/Animation/utils.js +78 -0
  22. package/src/components/Animations/OpacityAnimation/index.js +53 -0
  23. package/src/components/Animations/OpacityAnimation/utils.js +38 -0
  24. package/src/components/Animations/index.js +6 -0
  25. package/src/components/AppBar/Content.js +132 -0
  26. package/src/components/AppBar/index.js +164 -0
  27. package/src/components/AppBar/utils.js +204 -0
  28. package/src/components/AutoLink/index.js +45 -0
  29. package/src/components/Avatar/AutoHeightImage/AnimatableImage.js +22 -0
  30. package/src/components/Avatar/AutoHeightImage/ImagePolyfill.js +33 -0
  31. package/src/components/Avatar/AutoHeightImage/cache.js +75 -0
  32. package/src/components/Avatar/AutoHeightImage/helpers.js +2 -0
  33. package/src/components/Avatar/AutoHeightImage/index.js +97 -0
  34. package/src/components/Avatar/Image.js +115 -0
  35. package/src/components/Avatar/Text.js +74 -0
  36. package/src/components/Avatar/index.js +89 -0
  37. package/src/components/BackToTop/index.js +89 -0
  38. package/src/components/Badge/index.js +141 -0
  39. package/src/components/Badge/index1.js +34 -0
  40. package/src/components/BottomSheet/Content.js +19 -0
  41. package/src/components/BottomSheet/Menu.js +126 -0
  42. package/src/components/BottomSheet/Provider.js +58 -0
  43. package/src/components/BottomSheet/Sheet.js +434 -0
  44. package/src/components/BottomSheet/index.js +8 -0
  45. package/src/components/BottomSheet/utils.js +30 -0
  46. package/src/components/Br/index.js +4 -0
  47. package/src/components/Br/index.web.js +3 -0
  48. package/src/components/Browser/index.js +4 -0
  49. package/src/components/Button/index.js +465 -0
  50. package/src/components/CardView/index.android.js +55 -0
  51. package/src/components/CardView/index.ios.js +36 -0
  52. package/src/components/CardView/index.web.js +3 -0
  53. package/src/components/Chart/appexchart.3.5.text +14 -0
  54. package/src/components/Chart/index.js +22 -0
  55. package/src/components/Chart/index.native.js +61 -0
  56. package/src/components/Chart/utils.js +0 -0
  57. package/src/components/Checkbox/index.js +178 -0
  58. package/src/components/Chip/index.js +350 -0
  59. package/src/components/Color/ColorPicker.js +724 -0
  60. package/src/components/Color/assets/black-gradient-rotated.png +0 -0
  61. package/src/components/Color/assets/black-gradient.png +0 -0
  62. package/src/components/Color/assets/color-wheel.png +0 -0
  63. package/src/components/Color/index.js +158 -0
  64. package/src/components/ContentLoader/BarChar.js +19 -0
  65. package/src/components/ContentLoader/Circle.js +3 -0
  66. package/src/components/ContentLoader/Circle.web.js +3 -0
  67. package/src/components/ContentLoader/Datagrid.js +28 -0
  68. package/src/components/ContentLoader/Form.js +39 -0
  69. package/src/components/ContentLoader/Loader/RLoader/index.js +3 -0
  70. package/src/components/ContentLoader/Loader/RLoader/index.web.js +3 -0
  71. package/src/components/ContentLoader/Loader/index.js +20 -0
  72. package/src/components/ContentLoader/PieChart.js +22 -0
  73. package/src/components/ContentLoader/Placeholder/Placeholder.js +52 -0
  74. package/src/components/ContentLoader/Placeholder/PlaceholderLine.js +59 -0
  75. package/src/components/ContentLoader/Placeholder/PlaceholderMedia.js +47 -0
  76. package/src/components/ContentLoader/Placeholder/animations/Fade.js +58 -0
  77. package/src/components/ContentLoader/Placeholder/animations/Loader.js +24 -0
  78. package/src/components/ContentLoader/Placeholder/animations/Progressive.js +62 -0
  79. package/src/components/ContentLoader/Placeholder/animations/Raw.js +4 -0
  80. package/src/components/ContentLoader/Placeholder/animations/Shine.js +56 -0
  81. package/src/components/ContentLoader/Placeholder/animations/ShineOverlay.js +56 -0
  82. package/src/components/ContentLoader/Placeholder/animations/context.js +4 -0
  83. package/src/components/ContentLoader/Placeholder/index.js +12 -0
  84. package/src/components/ContentLoader/Placeholder/tokens.js +9 -0
  85. package/src/components/ContentLoader/Profile.js +27 -0
  86. package/src/components/ContentLoader/Rect.js +3 -0
  87. package/src/components/ContentLoader/Rect.web.js +3 -0
  88. package/src/components/ContentLoader/Skeleton.js +145 -0
  89. package/src/components/ContentLoader/Table.js +69 -0
  90. package/src/components/ContentLoader/TaskList.js +27 -0
  91. package/src/components/ContentLoader/index copy.js +148 -0
  92. package/src/components/ContentLoader/index.js +151 -0
  93. package/src/components/ContentLoader/utils.js +8 -0
  94. package/src/components/CountUp/index.js +67 -0
  95. package/src/components/Countries/SelectCountry.js +65 -0
  96. package/src/components/Countries/index.js +5 -0
  97. package/src/components/Countries/resources/countries.json +1746 -0
  98. package/src/components/Countries/resources/flags/images/ad.png +0 -0
  99. package/src/components/Countries/resources/flags/images/ae.png +0 -0
  100. package/src/components/Countries/resources/flags/images/af.png +0 -0
  101. package/src/components/Countries/resources/flags/images/ag.png +0 -0
  102. package/src/components/Countries/resources/flags/images/ai.png +0 -0
  103. package/src/components/Countries/resources/flags/images/al.png +0 -0
  104. package/src/components/Countries/resources/flags/images/am.png +0 -0
  105. package/src/components/Countries/resources/flags/images/ao.png +0 -0
  106. package/src/components/Countries/resources/flags/images/ar.png +0 -0
  107. package/src/components/Countries/resources/flags/images/as.png +0 -0
  108. package/src/components/Countries/resources/flags/images/at.png +0 -0
  109. package/src/components/Countries/resources/flags/images/au.png +0 -0
  110. package/src/components/Countries/resources/flags/images/aw.png +0 -0
  111. package/src/components/Countries/resources/flags/images/ax.png +0 -0
  112. package/src/components/Countries/resources/flags/images/az.png +0 -0
  113. package/src/components/Countries/resources/flags/images/ba.png +0 -0
  114. package/src/components/Countries/resources/flags/images/bb.png +0 -0
  115. package/src/components/Countries/resources/flags/images/bd.png +0 -0
  116. package/src/components/Countries/resources/flags/images/be.png +0 -0
  117. package/src/components/Countries/resources/flags/images/bf.png +0 -0
  118. package/src/components/Countries/resources/flags/images/bg.png +0 -0
  119. package/src/components/Countries/resources/flags/images/bh.png +0 -0
  120. package/src/components/Countries/resources/flags/images/bi.png +0 -0
  121. package/src/components/Countries/resources/flags/images/bj.png +0 -0
  122. package/src/components/Countries/resources/flags/images/bl.png +0 -0
  123. package/src/components/Countries/resources/flags/images/bm.png +0 -0
  124. package/src/components/Countries/resources/flags/images/bn.png +0 -0
  125. package/src/components/Countries/resources/flags/images/bo.png +0 -0
  126. package/src/components/Countries/resources/flags/images/bq.png +0 -0
  127. package/src/components/Countries/resources/flags/images/br.png +0 -0
  128. package/src/components/Countries/resources/flags/images/bs.png +0 -0
  129. package/src/components/Countries/resources/flags/images/bt.png +0 -0
  130. package/src/components/Countries/resources/flags/images/bw.png +0 -0
  131. package/src/components/Countries/resources/flags/images/by.png +0 -0
  132. package/src/components/Countries/resources/flags/images/bz.png +0 -0
  133. package/src/components/Countries/resources/flags/images/ca.png +0 -0
  134. package/src/components/Countries/resources/flags/images/cc.png +0 -0
  135. package/src/components/Countries/resources/flags/images/cd.png +0 -0
  136. package/src/components/Countries/resources/flags/images/cf.png +0 -0
  137. package/src/components/Countries/resources/flags/images/cg.png +0 -0
  138. package/src/components/Countries/resources/flags/images/ch.png +0 -0
  139. package/src/components/Countries/resources/flags/images/ci.png +0 -0
  140. package/src/components/Countries/resources/flags/images/ck.png +0 -0
  141. package/src/components/Countries/resources/flags/images/cl.png +0 -0
  142. package/src/components/Countries/resources/flags/images/cm.png +0 -0
  143. package/src/components/Countries/resources/flags/images/cn.png +0 -0
  144. package/src/components/Countries/resources/flags/images/co.png +0 -0
  145. package/src/components/Countries/resources/flags/images/cr.png +0 -0
  146. package/src/components/Countries/resources/flags/images/cu.png +0 -0
  147. package/src/components/Countries/resources/flags/images/cv.png +0 -0
  148. package/src/components/Countries/resources/flags/images/cw.png +0 -0
  149. package/src/components/Countries/resources/flags/images/cx.png +0 -0
  150. package/src/components/Countries/resources/flags/images/cy.png +0 -0
  151. package/src/components/Countries/resources/flags/images/cz.png +0 -0
  152. package/src/components/Countries/resources/flags/images/de.png +0 -0
  153. package/src/components/Countries/resources/flags/images/dj.png +0 -0
  154. package/src/components/Countries/resources/flags/images/dk.png +0 -0
  155. package/src/components/Countries/resources/flags/images/dm.png +0 -0
  156. package/src/components/Countries/resources/flags/images/do.png +0 -0
  157. package/src/components/Countries/resources/flags/images/dz.png +0 -0
  158. package/src/components/Countries/resources/flags/images/ec.png +0 -0
  159. package/src/components/Countries/resources/flags/images/ee.png +0 -0
  160. package/src/components/Countries/resources/flags/images/eg.png +0 -0
  161. package/src/components/Countries/resources/flags/images/eh.png +0 -0
  162. package/src/components/Countries/resources/flags/images/er.png +0 -0
  163. package/src/components/Countries/resources/flags/images/es.png +0 -0
  164. package/src/components/Countries/resources/flags/images/et.png +0 -0
  165. package/src/components/Countries/resources/flags/images/fi.png +0 -0
  166. package/src/components/Countries/resources/flags/images/fj.png +0 -0
  167. package/src/components/Countries/resources/flags/images/fk.png +0 -0
  168. package/src/components/Countries/resources/flags/images/fm.png +0 -0
  169. package/src/components/Countries/resources/flags/images/fo.png +0 -0
  170. package/src/components/Countries/resources/flags/images/fr.png +0 -0
  171. package/src/components/Countries/resources/flags/images/ga.png +0 -0
  172. package/src/components/Countries/resources/flags/images/gb.png +0 -0
  173. package/src/components/Countries/resources/flags/images/gd.png +0 -0
  174. package/src/components/Countries/resources/flags/images/ge.png +0 -0
  175. package/src/components/Countries/resources/flags/images/gf.png +0 -0
  176. package/src/components/Countries/resources/flags/images/gg.png +0 -0
  177. package/src/components/Countries/resources/flags/images/gh.png +0 -0
  178. package/src/components/Countries/resources/flags/images/gi.png +0 -0
  179. package/src/components/Countries/resources/flags/images/gm.png +0 -0
  180. package/src/components/Countries/resources/flags/images/gn.png +0 -0
  181. package/src/components/Countries/resources/flags/images/gp.png +0 -0
  182. package/src/components/Countries/resources/flags/images/gq.png +0 -0
  183. package/src/components/Countries/resources/flags/images/gr.png +0 -0
  184. package/src/components/Countries/resources/flags/images/gt.png +0 -0
  185. package/src/components/Countries/resources/flags/images/gu.png +0 -0
  186. package/src/components/Countries/resources/flags/images/gw.png +0 -0
  187. package/src/components/Countries/resources/flags/images/gy.png +0 -0
  188. package/src/components/Countries/resources/flags/images/hk.png +0 -0
  189. package/src/components/Countries/resources/flags/images/hn.png +0 -0
  190. package/src/components/Countries/resources/flags/images/hr.png +0 -0
  191. package/src/components/Countries/resources/flags/images/ht.png +0 -0
  192. package/src/components/Countries/resources/flags/images/hu.png +0 -0
  193. package/src/components/Countries/resources/flags/images/id.png +0 -0
  194. package/src/components/Countries/resources/flags/images/ie.png +0 -0
  195. package/src/components/Countries/resources/flags/images/il.png +0 -0
  196. package/src/components/Countries/resources/flags/images/im.png +0 -0
  197. package/src/components/Countries/resources/flags/images/in.png +0 -0
  198. package/src/components/Countries/resources/flags/images/io.png +0 -0
  199. package/src/components/Countries/resources/flags/images/iq.png +0 -0
  200. package/src/components/Countries/resources/flags/images/ir.png +0 -0
  201. package/src/components/Countries/resources/flags/images/is.png +0 -0
  202. package/src/components/Countries/resources/flags/images/it.png +0 -0
  203. package/src/components/Countries/resources/flags/images/je.png +0 -0
  204. package/src/components/Countries/resources/flags/images/jm.png +0 -0
  205. package/src/components/Countries/resources/flags/images/jo.png +0 -0
  206. package/src/components/Countries/resources/flags/images/jp.png +0 -0
  207. package/src/components/Countries/resources/flags/images/ke.png +0 -0
  208. package/src/components/Countries/resources/flags/images/kg.png +0 -0
  209. package/src/components/Countries/resources/flags/images/kh.png +0 -0
  210. package/src/components/Countries/resources/flags/images/ki.png +0 -0
  211. package/src/components/Countries/resources/flags/images/km.png +0 -0
  212. package/src/components/Countries/resources/flags/images/kn.png +0 -0
  213. package/src/components/Countries/resources/flags/images/kp.png +0 -0
  214. package/src/components/Countries/resources/flags/images/kr.png +0 -0
  215. package/src/components/Countries/resources/flags/images/ks.png +0 -0
  216. package/src/components/Countries/resources/flags/images/kw.png +0 -0
  217. package/src/components/Countries/resources/flags/images/ky.png +0 -0
  218. package/src/components/Countries/resources/flags/images/kz.png +0 -0
  219. package/src/components/Countries/resources/flags/images/la.png +0 -0
  220. package/src/components/Countries/resources/flags/images/lb.png +0 -0
  221. package/src/components/Countries/resources/flags/images/lc.png +0 -0
  222. package/src/components/Countries/resources/flags/images/li.png +0 -0
  223. package/src/components/Countries/resources/flags/images/lk.png +0 -0
  224. package/src/components/Countries/resources/flags/images/lr.png +0 -0
  225. package/src/components/Countries/resources/flags/images/ls.png +0 -0
  226. package/src/components/Countries/resources/flags/images/lt.png +0 -0
  227. package/src/components/Countries/resources/flags/images/lu.png +0 -0
  228. package/src/components/Countries/resources/flags/images/lv.png +0 -0
  229. package/src/components/Countries/resources/flags/images/ly.png +0 -0
  230. package/src/components/Countries/resources/flags/images/ma.png +0 -0
  231. package/src/components/Countries/resources/flags/images/mc.png +0 -0
  232. package/src/components/Countries/resources/flags/images/md.png +0 -0
  233. package/src/components/Countries/resources/flags/images/me.png +0 -0
  234. package/src/components/Countries/resources/flags/images/mf.png +0 -0
  235. package/src/components/Countries/resources/flags/images/mg.png +0 -0
  236. package/src/components/Countries/resources/flags/images/mh.png +0 -0
  237. package/src/components/Countries/resources/flags/images/mk.png +0 -0
  238. package/src/components/Countries/resources/flags/images/ml.png +0 -0
  239. package/src/components/Countries/resources/flags/images/mm.png +0 -0
  240. package/src/components/Countries/resources/flags/images/mn.png +0 -0
  241. package/src/components/Countries/resources/flags/images/mo.png +0 -0
  242. package/src/components/Countries/resources/flags/images/mp.png +0 -0
  243. package/src/components/Countries/resources/flags/images/mq.png +0 -0
  244. package/src/components/Countries/resources/flags/images/mr.png +0 -0
  245. package/src/components/Countries/resources/flags/images/ms.png +0 -0
  246. package/src/components/Countries/resources/flags/images/mt.png +0 -0
  247. package/src/components/Countries/resources/flags/images/mu.png +0 -0
  248. package/src/components/Countries/resources/flags/images/mv.png +0 -0
  249. package/src/components/Countries/resources/flags/images/mw.png +0 -0
  250. package/src/components/Countries/resources/flags/images/mx.png +0 -0
  251. package/src/components/Countries/resources/flags/images/my.png +0 -0
  252. package/src/components/Countries/resources/flags/images/mz.png +0 -0
  253. package/src/components/Countries/resources/flags/images/na.png +0 -0
  254. package/src/components/Countries/resources/flags/images/nc.png +0 -0
  255. package/src/components/Countries/resources/flags/images/ne.png +0 -0
  256. package/src/components/Countries/resources/flags/images/nf.png +0 -0
  257. package/src/components/Countries/resources/flags/images/ng.png +0 -0
  258. package/src/components/Countries/resources/flags/images/ni.png +0 -0
  259. package/src/components/Countries/resources/flags/images/nl.png +0 -0
  260. package/src/components/Countries/resources/flags/images/no.png +0 -0
  261. package/src/components/Countries/resources/flags/images/np.png +0 -0
  262. package/src/components/Countries/resources/flags/images/nr.png +0 -0
  263. package/src/components/Countries/resources/flags/images/nu.png +0 -0
  264. package/src/components/Countries/resources/flags/images/nz.png +0 -0
  265. package/src/components/Countries/resources/flags/images/om.png +0 -0
  266. package/src/components/Countries/resources/flags/images/pa.png +0 -0
  267. package/src/components/Countries/resources/flags/images/pe.png +0 -0
  268. package/src/components/Countries/resources/flags/images/pf.png +0 -0
  269. package/src/components/Countries/resources/flags/images/pg.png +0 -0
  270. package/src/components/Countries/resources/flags/images/ph.png +0 -0
  271. package/src/components/Countries/resources/flags/images/pk.png +0 -0
  272. package/src/components/Countries/resources/flags/images/pl.png +0 -0
  273. package/src/components/Countries/resources/flags/images/pm.png +0 -0
  274. package/src/components/Countries/resources/flags/images/pr.png +0 -0
  275. package/src/components/Countries/resources/flags/images/ps.png +0 -0
  276. package/src/components/Countries/resources/flags/images/pt.png +0 -0
  277. package/src/components/Countries/resources/flags/images/pw.png +0 -0
  278. package/src/components/Countries/resources/flags/images/py.png +0 -0
  279. package/src/components/Countries/resources/flags/images/qa.png +0 -0
  280. package/src/components/Countries/resources/flags/images/re.png +0 -0
  281. package/src/components/Countries/resources/flags/images/ro.png +0 -0
  282. package/src/components/Countries/resources/flags/images/rs.png +0 -0
  283. package/src/components/Countries/resources/flags/images/ru.png +0 -0
  284. package/src/components/Countries/resources/flags/images/rw.png +0 -0
  285. package/src/components/Countries/resources/flags/images/sa.png +0 -0
  286. package/src/components/Countries/resources/flags/images/sb.png +0 -0
  287. package/src/components/Countries/resources/flags/images/sc.png +0 -0
  288. package/src/components/Countries/resources/flags/images/sd.png +0 -0
  289. package/src/components/Countries/resources/flags/images/se.png +0 -0
  290. package/src/components/Countries/resources/flags/images/sg.png +0 -0
  291. package/src/components/Countries/resources/flags/images/sh.png +0 -0
  292. package/src/components/Countries/resources/flags/images/si.png +0 -0
  293. package/src/components/Countries/resources/flags/images/sj.png +0 -0
  294. package/src/components/Countries/resources/flags/images/sk.png +0 -0
  295. package/src/components/Countries/resources/flags/images/sl.png +0 -0
  296. package/src/components/Countries/resources/flags/images/sm.png +0 -0
  297. package/src/components/Countries/resources/flags/images/sn.png +0 -0
  298. package/src/components/Countries/resources/flags/images/so.png +0 -0
  299. package/src/components/Countries/resources/flags/images/sr.png +0 -0
  300. package/src/components/Countries/resources/flags/images/ss.png +0 -0
  301. package/src/components/Countries/resources/flags/images/st.png +0 -0
  302. package/src/components/Countries/resources/flags/images/sv.png +0 -0
  303. package/src/components/Countries/resources/flags/images/sx.png +0 -0
  304. package/src/components/Countries/resources/flags/images/sy.png +0 -0
  305. package/src/components/Countries/resources/flags/images/sz.png +0 -0
  306. package/src/components/Countries/resources/flags/images/tc.png +0 -0
  307. package/src/components/Countries/resources/flags/images/td.png +0 -0
  308. package/src/components/Countries/resources/flags/images/tg.png +0 -0
  309. package/src/components/Countries/resources/flags/images/th.png +0 -0
  310. package/src/components/Countries/resources/flags/images/tj.png +0 -0
  311. package/src/components/Countries/resources/flags/images/tk.png +0 -0
  312. package/src/components/Countries/resources/flags/images/tl.png +0 -0
  313. package/src/components/Countries/resources/flags/images/tm.png +0 -0
  314. package/src/components/Countries/resources/flags/images/tn.png +0 -0
  315. package/src/components/Countries/resources/flags/images/to.png +0 -0
  316. package/src/components/Countries/resources/flags/images/tr.png +0 -0
  317. package/src/components/Countries/resources/flags/images/tt.png +0 -0
  318. package/src/components/Countries/resources/flags/images/tv.png +0 -0
  319. package/src/components/Countries/resources/flags/images/tw.png +0 -0
  320. package/src/components/Countries/resources/flags/images/tz.png +0 -0
  321. package/src/components/Countries/resources/flags/images/ua.png +0 -0
  322. package/src/components/Countries/resources/flags/images/ug.png +0 -0
  323. package/src/components/Countries/resources/flags/images/us.png +0 -0
  324. package/src/components/Countries/resources/flags/images/uy.png +0 -0
  325. package/src/components/Countries/resources/flags/images/uz.png +0 -0
  326. package/src/components/Countries/resources/flags/images/va.png +0 -0
  327. package/src/components/Countries/resources/flags/images/vc.png +0 -0
  328. package/src/components/Countries/resources/flags/images/ve.png +0 -0
  329. package/src/components/Countries/resources/flags/images/vg.png +0 -0
  330. package/src/components/Countries/resources/flags/images/vi.png +0 -0
  331. package/src/components/Countries/resources/flags/images/vn.png +0 -0
  332. package/src/components/Countries/resources/flags/images/vu.png +0 -0
  333. package/src/components/Countries/resources/flags/images/wf.png +0 -0
  334. package/src/components/Countries/resources/flags/images/ws.png +0 -0
  335. package/src/components/Countries/resources/flags/images/ye.png +0 -0
  336. package/src/components/Countries/resources/flags/images/yt.png +0 -0
  337. package/src/components/Countries/resources/flags/images/za.png +0 -0
  338. package/src/components/Countries/resources/flags/images/zm.png +0 -0
  339. package/src/components/Countries/resources/flags/images/zw.png +0 -0
  340. package/src/components/Countries/resources/flags/index.js +255 -0
  341. package/src/components/Countries/utils.js +28 -0
  342. package/src/components/Datagrid/Accordion/AppleSwipeable.js +123 -0
  343. package/src/components/Datagrid/Accordion/Filters.js +186 -0
  344. package/src/components/Datagrid/Accordion/GmailSwipeable.js +85 -0
  345. package/src/components/Datagrid/Accordion/Row.js +295 -0
  346. package/src/components/Datagrid/Accordion/index.js +719 -0
  347. package/src/components/Datagrid/Accordion/utils.js +22 -0
  348. package/src/components/Datagrid/Actions/Header.js +58 -0
  349. package/src/components/Datagrid/Actions/index.js +104 -0
  350. package/src/components/Datagrid/Checkbox.js +40 -0
  351. package/src/components/Datagrid/Common/Common.js +1866 -0
  352. package/src/components/Datagrid/Common/TableData.js +245 -0
  353. package/src/components/Datagrid/Common/factory.js +9 -0
  354. package/src/components/Datagrid/Common/index.js +7 -0
  355. package/src/components/Datagrid/Common/session.js +20 -0
  356. package/src/components/Datagrid/Common/setQueryLimit.js +32 -0
  357. package/src/components/Datagrid/Footer/Footer.js +86 -0
  358. package/src/components/Datagrid/Footer/index.js +93 -0
  359. package/src/components/Datagrid/List.js +2 -0
  360. package/src/components/Datagrid/RenderType.js +53 -0
  361. package/src/components/Datagrid/RenderTypes/index.native.js +1 -0
  362. package/src/components/Datagrid/RenderTypes/index.web.js +10 -0
  363. package/src/components/Datagrid/RenderTypes/utils.js +5 -0
  364. package/src/components/Datagrid/Table/Cell.js +45 -0
  365. package/src/components/Datagrid/Table/Datatable.js +232 -0
  366. package/src/components/Datagrid/Table/index.js +446 -0
  367. package/src/components/Datagrid/Table/renderTable.js +664 -0
  368. package/src/components/Datagrid/factory.js +12 -0
  369. package/src/components/Datagrid/getComponent.js +26 -0
  370. package/src/components/Datagrid/index.js +43 -0
  371. package/src/components/Datagrid/utils.js +185 -0
  372. package/src/components/Date/DatePickerModal/index.js +10 -0
  373. package/src/components/Date/DatePickerModal/index.native.js +22 -0
  374. package/src/components/Date/PickerInput/TextInputMask.js +106 -0
  375. package/src/components/Date/PickerInput/index.js +253 -0
  376. package/src/components/Date/Time.js +154 -0
  377. package/src/components/Date/TimePickerModal/index.js +3 -0
  378. package/src/components/Date/TimePickerModal/index.native.js +21 -0
  379. package/src/components/Date/dictionary.js +26 -0
  380. package/src/components/Date/index.js +11 -0
  381. package/src/components/Date/utils.common.js +3 -0
  382. package/src/components/Date/utils.common.native.js +0 -0
  383. package/src/components/Date/utils.js +209 -0
  384. package/src/components/Dialog/AppBarDialog.js +41 -0
  385. package/src/components/Dialog/Dialog.js +377 -0
  386. package/src/components/Dialog/DialogActions.js +69 -0
  387. package/src/components/Dialog/DialogFooter.js +36 -0
  388. package/src/components/Dialog/DialogTitle.js +47 -0
  389. package/src/components/Dialog/DropdownAlert/Queue.js +28 -0
  390. package/src/components/Dialog/DropdownAlert/Utils.js +36 -0
  391. package/src/components/Dialog/DropdownAlert/assets/cancel.png +0 -0
  392. package/src/components/Dialog/DropdownAlert/assets/cancel@2x.png +0 -0
  393. package/src/components/Dialog/DropdownAlert/assets/cancel@3x.png +0 -0
  394. package/src/components/Dialog/DropdownAlert/assets/error.png +0 -0
  395. package/src/components/Dialog/DropdownAlert/assets/error@2x.png +0 -0
  396. package/src/components/Dialog/DropdownAlert/assets/error@3x.png +0 -0
  397. package/src/components/Dialog/DropdownAlert/assets/info.png +0 -0
  398. package/src/components/Dialog/DropdownAlert/assets/info@2x.png +0 -0
  399. package/src/components/Dialog/DropdownAlert/assets/info@3x.png +0 -0
  400. package/src/components/Dialog/DropdownAlert/assets/success.png +0 -0
  401. package/src/components/Dialog/DropdownAlert/assets/success@2x.png +0 -0
  402. package/src/components/Dialog/DropdownAlert/assets/success@3x.png +0 -0
  403. package/src/components/Dialog/DropdownAlert/assets/warn.png +0 -0
  404. package/src/components/Dialog/DropdownAlert/assets/warn@2x.png +0 -0
  405. package/src/components/Dialog/DropdownAlert/assets/warn@3x.png +0 -0
  406. package/src/components/Dialog/DropdownAlert/index.js +685 -0
  407. package/src/components/Dialog/Provider.js +75 -0
  408. package/src/components/Dialog/confirm/Alert/Alert.old/Alert.web.js +360 -0
  409. package/src/components/Dialog/confirm/Alert/Alert.old/index.js +2 -0
  410. package/src/components/Dialog/confirm/Alert/index.js +43 -0
  411. package/src/components/Dialog/confirm/index.js +12 -0
  412. package/src/components/Dialog/confirm/showConfirmOrAlertOrPrompt.js +145 -0
  413. package/src/components/Dialog/dialogs.js +70 -0
  414. package/src/components/Dialog/index.js +17 -0
  415. package/src/components/Dialog/showConfirmOrAlertOrPrompt.js +90 -0
  416. package/src/components/Dialog/style.css +103 -0
  417. package/src/components/Dialog/utils.js +33 -0
  418. package/src/components/Divider/index.js +44 -0
  419. package/src/components/Drawer/DrawerHeader.js +70 -0
  420. package/src/components/Drawer/DrawerItems/DrawerItem.js +88 -0
  421. package/src/components/Drawer/DrawerItems/DrawerSection.js +34 -0
  422. package/src/components/Drawer/DrawerItems/ExpandableItem.js +44 -0
  423. package/src/components/Drawer/DrawerItems/_DrawerItem.js +173 -0
  424. package/src/components/Drawer/DrawerItems/index.js +155 -0
  425. package/src/components/Drawer/DrawerItems/utils.js +107 -0
  426. package/src/components/Drawer/DrawerLayout/index.js +476 -0
  427. package/src/components/Drawer/NavigationView.js +90 -0
  428. package/src/components/Drawer/Provider.js +6 -0
  429. package/src/components/Drawer/index.js +455 -0
  430. package/src/components/Drawer/session.js +28 -0
  431. package/src/components/Drawer/utils.js +39 -0
  432. package/src/components/Dropdown/index.js +1317 -0
  433. package/src/components/Dropdown/utils.js +19 -0
  434. package/src/components/ErrorBoundary/ErrorMessage.js +107 -0
  435. package/src/components/ErrorBoundary/Provider.js +68 -0
  436. package/src/components/ErrorBoundary/index.js +64 -0
  437. package/src/components/Expandable/Item.js +159 -0
  438. package/src/components/Expandable/index.js +229 -0
  439. package/src/components/Fab/Fab.js +46 -0
  440. package/src/components/Fab/Group.js +143 -0
  441. package/src/components/Fab/GroupComponent.js +384 -0
  442. package/src/components/Fab/index.js +8 -0
  443. package/src/components/FadeInOut/index.js +70 -0
  444. package/src/components/Filter/filterTextTypes.js +1 -0
  445. package/src/components/Filter/index.js +570 -0
  446. package/src/components/Filter/session.js +18 -0
  447. package/src/components/Filter/utils.js +289 -0
  448. package/src/components/Form/Action.js +112 -0
  449. package/src/components/Form/Fields/Checkbox.js +29 -0
  450. package/src/components/Form/Fields/Color.js +21 -0
  451. package/src/components/Form/Fields/Date.js +24 -0
  452. package/src/components/Form/Fields/Field.js +1048 -0
  453. package/src/components/Form/Fields/Html.js +21 -0
  454. package/src/components/Form/Fields/IdField.js +131 -0
  455. package/src/components/Form/Fields/Image.js +65 -0
  456. package/src/components/Form/Fields/PieceField.js +143 -0
  457. package/src/components/Form/Fields/Radio.js +31 -0
  458. package/src/components/Form/Fields/SelectCountry.js +12 -0
  459. package/src/components/Form/Fields/SelectField.js +147 -0
  460. package/src/components/Form/Fields/SelectStructData.js +24 -0
  461. package/src/components/Form/Fields/SelectTableData.js +24 -0
  462. package/src/components/Form/Fields/SelectTheme.js +11 -0
  463. package/src/components/Form/Fields/Slider.js +32 -0
  464. package/src/components/Form/Fields/Switch.js +34 -0
  465. package/src/components/Form/Fields/Tel.js +21 -0
  466. package/src/components/Form/Fields/TextField.js +44 -0
  467. package/src/components/Form/Fields/Time.js +28 -0
  468. package/src/components/Form/Fields/index.js +52 -0
  469. package/src/components/Form/Fields/selectPromptField.js +59 -0
  470. package/src/components/Form/Fields/sprintf.js +42 -0
  471. package/src/components/Form/Fields/sprintfSelectors.js +117 -0
  472. package/src/components/Form/Fields/utils.js +8 -0
  473. package/src/components/Form/Form.js +221 -0
  474. package/src/components/Form/FormData/Dialog.js +116 -0
  475. package/src/components/Form/FormData/DialogProvider.js +117 -0
  476. package/src/components/Form/FormData/FormData.js +403 -0
  477. package/src/components/Form/FormData/FormDataActions.js +155 -0
  478. package/src/components/Form/FormData/componentsTypes.js +117 -0
  479. package/src/components/Form/FormData/index.js +15 -0
  480. package/src/components/Form/FormData/utils.js +111 -0
  481. package/src/components/Form/KeyboardAvoidingView.js +23 -0
  482. package/src/components/Form/KeyboardEventHandler/index.js +115 -0
  483. package/src/components/Form/KeyboardEventHandler/keyEvents.js +139 -0
  484. package/src/components/Form/KeyboardEventHandler/readMe.md +1 -0
  485. package/src/components/Form/List/List.js +794 -0
  486. package/src/components/Form/List/index.js +2 -0
  487. package/src/components/Form/index.js +14 -0
  488. package/src/components/Form/utils/FormsManager.js +101 -0
  489. package/src/components/Form/utils/index.js +8 -0
  490. package/src/components/Form/utils/keyboardEvents.js +8 -0
  491. package/src/components/Form/utils/keyboardShortcuts.js +57 -0
  492. package/src/components/Grid/Cell.js +108 -0
  493. package/src/components/Grid/Col.js +30 -0
  494. package/src/components/Grid/Grid.js +35 -0
  495. package/src/components/Grid/Row.js +30 -0
  496. package/src/components/Grid/index.js +11 -0
  497. package/src/components/Hashtag/index.js +119 -0
  498. package/src/components/HeavyScreen/index.js +52 -0
  499. package/src/components/HeavyScreen/utils.js +36 -0
  500. package/src/components/HelperText/index.js +36 -0
  501. package/src/components/Html/AutoSizedImage.js +56 -0
  502. package/src/components/Html/HtmlToElement.js +173 -0
  503. package/src/components/Html/View.js +166 -0
  504. package/src/components/Icon/Checkbox.js +83 -0
  505. package/src/components/Icon/CrossFadeIcon.js +133 -0
  506. package/src/components/Icon/Icon.js +52 -0
  507. package/src/components/Icon/IconButton.js +155 -0
  508. package/src/components/Icon/MaterialCommunityIcon.js +93 -0
  509. package/src/components/Icon/index.js +10 -0
  510. package/src/components/Icon/utils.js +15 -0
  511. package/src/components/Image/Editor/index copy.js +42 -0
  512. package/src/components/Image/Editor/index.js +52 -0
  513. package/src/components/Image/index.js +309 -0
  514. package/src/components/InlineIndicator/Select.js +58 -0
  515. package/src/components/InlineIndicator/index.js +156 -0
  516. package/src/components/Label/index.js +104 -0
  517. package/src/components/Link/Browser.js +17 -0
  518. package/src/components/Link/getUrlCallback.js +10 -0
  519. package/src/components/Link/index.js +38 -0
  520. package/src/components/List/BigList.js +44 -0
  521. package/src/components/List/Common.js +233 -0
  522. package/src/components/List/FlashList.js +29 -0
  523. package/src/components/List/FlatList.js +34 -0
  524. package/src/components/List/RecyclerView.js +83 -0
  525. package/src/components/List/index.js +12 -0
  526. package/src/components/List/utils.js +23 -0
  527. package/src/components/Logo/Logo.js +98 -0
  528. package/src/components/Logo/Progress.js +21 -0
  529. package/src/components/Logo/index.js +3 -0
  530. package/src/components/Menu/Item.js +203 -0
  531. package/src/components/Menu/Menu.js +590 -0
  532. package/src/components/Menu/index.js +118 -0
  533. package/src/components/Menu/utils.js +81 -0
  534. package/src/components/Modal/index.js +212 -0
  535. package/src/components/NewLine/index.js +4 -0
  536. package/src/components/NewLine/index.web.js +3 -0
  537. package/src/components/Paragraph/index.js +32 -0
  538. package/src/components/PasswordText/index.js +29 -0
  539. package/src/components/PhoneInput/PhoneNumber.js +121 -0
  540. package/src/components/PhoneInput/country.js +54 -0
  541. package/src/components/PhoneInput/index.js +217 -0
  542. package/src/components/PhoneInput/numberType.json +14 -0
  543. package/src/components/PhoneInput/styles.js +52 -0
  544. package/src/components/Portal/index.js +5 -0
  545. package/src/components/Preloader/index.js +227 -0
  546. package/src/components/Progress/LoadingDots.js +126 -0
  547. package/src/components/Progress/index.js +18 -0
  548. package/src/components/Radio/index.js +164 -0
  549. package/src/components/ReadMoreText/index.js +120 -0
  550. package/src/components/ScrollView/index.js +34 -0
  551. package/src/components/Signature/Panel.js +246 -0
  552. package/src/components/Signature/index.js +69 -0
  553. package/src/components/SimpleSelect/index.js +483 -0
  554. package/src/components/Slider/Slider.js +770 -0
  555. package/src/components/Slider/index.js +144 -0
  556. package/src/components/Slider/styles.js +39 -0
  557. package/src/components/SplashScreen/index.js +194 -0
  558. package/src/components/SplashScreen/styles.js +74 -0
  559. package/src/components/StatusBar/Component/index.js +5 -0
  560. package/src/components/StatusBar/Component/index.web.js +88 -0
  561. package/src/components/StatusBar/index.js +7 -0
  562. package/src/components/Surface/Elevations.js +218 -0
  563. package/src/components/Surface/index.js +22 -0
  564. package/src/components/Swipeable/Swipe.js +225 -0
  565. package/src/components/Swipeable/SwipeableGesture.js +77 -0
  566. package/src/components/Swipeable/index.js +5 -0
  567. package/src/components/Swiper/Controls.js +277 -0
  568. package/src/components/Swiper/index.js +463 -0
  569. package/src/components/Swiper/nodeType.js +8 -0
  570. package/src/components/Swiper/renderNode.js +21 -0
  571. package/src/components/Switch/index.js +172 -0
  572. package/src/components/Tab/TabContent.js +72 -0
  573. package/src/components/Tab/TabItem.js +112 -0
  574. package/src/components/Tab/TabItems.js +246 -0
  575. package/src/components/Tab/index.js +114 -0
  576. package/src/components/Table/index.js +383 -0
  577. package/src/components/TextField/Affix.js +18 -0
  578. package/src/components/TextField/index.js +749 -0
  579. package/src/components/TextField/utils.js +64 -0
  580. package/src/components/Tooltip/Popover/index.js +254 -0
  581. package/src/components/Tooltip/Popover/index.web.js +60 -0
  582. package/src/components/Tooltip/index.js +42 -0
  583. package/src/components/TouchableRipple/index.js +0 -0
  584. package/src/components/View/index.js +49 -0
  585. package/src/components/WebView/Component/index.native.js +2 -0
  586. package/src/components/WebView/Component/index.web.js +154 -0
  587. package/src/components/WebView/Component/postMock.html +21 -0
  588. package/src/components/WebView/index.js +79 -0
  589. package/src/index.js +166 -0
  590. package/src/layouts/AppBar/index.js +59 -0
  591. package/src/layouts/AppBar/utils.js +12 -0
  592. package/src/layouts/Fab/actions.js +5 -0
  593. package/src/layouts/Fab/index.js +60 -0
  594. package/src/layouts/Fab/utils.js +25 -0
  595. package/src/layouts/Footer/index.js +8 -0
  596. package/src/layouts/Screen/FormData/FormData.js +103 -0
  597. package/src/layouts/Screen/FormData/List.js +83 -0
  598. package/src/layouts/Screen/FormData/index.js +3 -0
  599. package/src/layouts/Screen/Screen.js +173 -0
  600. package/src/layouts/Screen/index.js +11 -0
  601. package/src/media/Assets/index.js +6 -0
  602. package/src/media/Assets/utils.js +28 -0
  603. package/src/media/camera.js +1 -0
  604. package/src/media/camera.native.js +4 -0
  605. package/src/media/camera.web.js +9 -0
  606. package/src/media/file-system/index.js +20 -0
  607. package/src/media/file-system/utils/index.js +32 -0
  608. package/src/media/file-system/utils/utils.js +0 -0
  609. package/src/media/file-system/utils.native/index.js +1 -0
  610. package/src/media/index.js +137 -0
  611. package/src/navigation/Drawer/ProfilAvatar/defaultAvatar.js +1 -0
  612. package/src/navigation/Drawer/ProfilAvatar/index.js +142 -0
  613. package/src/navigation/Drawer/ProfilAvatar/style.css +18 -0
  614. package/src/navigation/Drawer/index.js +81 -0
  615. package/src/navigation/Drawer/items/SidebarFeedsItems.js +0 -0
  616. package/src/navigation/Drawer/items/SyncDataItem.js +20 -0
  617. package/src/navigation/Drawer/items/index.js +23 -0
  618. package/src/navigation/Drawer/items/items.js +31 -0
  619. package/src/navigation/Drawer/utils.js +18 -0
  620. package/src/navigation/index.js +45 -0
  621. package/src/navigation/utils.js +1 -0
  622. package/src/screens/Auth/index.js +31 -0
  623. package/src/screens/Auth/routes.js +9 -0
  624. package/src/screens/Auth/utils.js +5 -0
  625. package/src/screens/index.js +201 -0
  626. package/src/screens/mainScreens.js +4 -0
  627. package/src/screens/utils.js +13 -0
  628. package/webpack.config.js +31 -0
  629. package/workflows/release-package.yml +33 -0
@@ -0,0 +1,1866 @@
1
+ import theme from "$theme";
2
+ import APP from "$capp";
3
+ import {isMobileOrTabletMedia,isSmallPhoneMedia} from "$cplatform/dimensions";
4
+ import PropTypes from "prop-types";
5
+ import {Component as AppComponent} from "$react"
6
+ import $session from "$session";
7
+ import Auth from "$cauth";
8
+ import Button from "$ecomponents/Button";
9
+ import Tooltip from "$ecomponents/Tooltip";
10
+ import setQueryLimit from "./setQueryLimit";
11
+ import {notify,showConfirm} from "$ecomponents/Dialog";
12
+ import Label from "$ecomponents/Label";
13
+ import Image from "$ecomponents/Image";
14
+ import Icon,{COPY_ICON} from "$ecomponents/Icon";
15
+ //import TableLink from "$containers/TableLink";
16
+ //import filterUtils from "$ccomponents/Filter/utils";
17
+ import Hashtag from "$ecomponents/Hashtag";
18
+ import {sortBy,extendObj,isObjOrArray,defaultNumber,defaultStr,isFunction,defaultBool,defaultArray,defaultObj,isNonNullString,defaultDecimal} from "$utils";
19
+ import {Datagrid as DatagridContentLoader} from "$ecomponents/ContentLoader";
20
+ import React from "$react";
21
+ import DateLib from "$lib/date";
22
+ //import dataFileManager from "$database/dataFileManager";
23
+ import Filter,{canHandleFilter} from "$ecomponents/Filter";
24
+ import {CHECKED_ICON_NAME} from "$ecomponents/Checkbox";
25
+ import { COLUMN_WIDTH,DATE_COLUMN_WIDTH } from "../utils";
26
+ import { StyleSheet,Dimensions,useWindowDimensions} from "react-native";
27
+ import Preloader from "$ecomponents/Preloader";
28
+ import Checkbox from "../Checkbox";
29
+ import { TouchableRipple } from "react-native-paper";
30
+ import { evalSingleValue } from "../Footer";
31
+ import i18n from "$i18n";
32
+ import { makePhoneCall,canMakePhoneCall as canMakeCall} from "$capp/MakePhoneCall";
33
+ import copyToClipboard from "$capp/clipboard";
34
+ import { Pressable } from "react-native";
35
+
36
+ export const arrayValueSeparator = ", ";
37
+
38
+ const databaseArgs = {};
39
+ export const footerFieldName = "dgrid-fters-fields";
40
+
41
+
42
+ /*****
43
+ * Pour spécifier qu'un champ du datagrid n'existe pas en bd il s'uffit de suffixer le nom du champ par le suffix : "FoundInDB" et de renseigner false comme valeur
44
+ de l'objet rowData de cette propriété
45
+ */
46
+ export default class CommonDatagridComponent extends AppComponent {
47
+ constructor(props){
48
+ super(props);
49
+ this.initSession();
50
+ this.autobind();
51
+ let {
52
+ data,
53
+ selectedRows,
54
+ ...rest
55
+ } = props;
56
+ if(this.bindResizeEvents()){
57
+ extendObj(this._events,{
58
+ RESIZE_PAGE : this.onResizePage.bind(this),
59
+ SET_DATAGRID_QUERY_LIMIT : this.onSetQueryLimit.bind(this),
60
+ });
61
+ }
62
+ rest = defaultObj(rest);
63
+ this._pagination = defaultObj(rest.pagination);
64
+ this.hasLocalFilters = false;
65
+ data = (data && typeof data == 'object')? Object.toArray(data):[];
66
+ let sRows = {}
67
+ Object.map(selectedRows,(row,i)=>{
68
+ if(isObj(row)){
69
+ sRows[this.getRowKey(row,i)] = {...row};
70
+ }
71
+ });
72
+ selectedRows = sRows;
73
+ let sData = this.getSessionData()
74
+ sData.showFooter = defaultVal(sData.showFooter,true);
75
+ sData.fixedTable = defaultBool(sData.fixedTable,false);
76
+ extendObj(this.state, {
77
+ data,
78
+ sort :defaultObj(props.sort),
79
+ showFilters : defaultBool(props.showFilters,(sData.showFilter? true : this.isPivotDatagrid())),
80
+ showFooter : defaultBool(props.showFooter,(sData.showFooter? true : false)),
81
+ fixedTable : sData.fixedTable
82
+ });
83
+ Object.defineProperties(this,{
84
+ layoutRef : {
85
+ value : React.createRef(null),
86
+ },
87
+ preparedColumns : {
88
+ value : {},override:false, writable:false,
89
+ },
90
+ selectedRows : {
91
+ value : selectedRows, override : false, writable : false,
92
+ },
93
+ selectedRowsRefs : {
94
+ value : {},override : false, writable : false,
95
+ },
96
+ [footerFieldName] : {
97
+ value : uniqid(footerFieldName),override:false, writable: false
98
+ },
99
+ })
100
+ if(!isNonNullString(this.state.sort.column)){
101
+ this.state.sort.column = "date";
102
+ }
103
+ this.state.sort.dir = defaultStr(this.state.sort.dir,this.state.sort.column == "date"?"desc":'asc')
104
+ this.hasColumnsHalreadyInitialized = false;
105
+ this.initColumns(props.columns);
106
+
107
+ this.INITIAL_STATE = {
108
+ data,
109
+ sort : this.state.sort
110
+ }
111
+ this._sort = this.state.sort;
112
+ this._datagridId = isNonNullString(this.props.id)? this.props.id : uniqid("datagrid-id")
113
+ this.canDoFilter = true;
114
+ this.filters = {}
115
+ Object.map(this.getFiltersProps(),(f,v)=>{
116
+ if(isPlainObject(f)){
117
+ this.filters[v] = f;
118
+ this.filters[v].field = defaultStr(f.field,v);
119
+ this.filters[v].originalValue = defaultVal(this.filters[v].originalValue,f.defaultValue,f.value)
120
+ } else {
121
+ this.filters[v] = {
122
+ originalValue : f,
123
+ field : v
124
+ }
125
+ }
126
+ })
127
+ this.state.filteredColumns = defaultObj(this.getSessionData("filteredColumns"+this.getSessionNameKey()),this.props.filters);
128
+ this.filtersSelectors = {selector:this.getFilters()};
129
+ this.prepareColumns();
130
+ if(this.canHandleColumnResize()){
131
+ this.state.columnsWidths = this.preparedColumns.widths;
132
+ }
133
+ extendObj(this.state,this.prepareData({data}));
134
+ const {width:windowWidth,height:windowHeight} = Dimensions.get("window");
135
+ this.state.layout = {
136
+ x : 0,
137
+ y : 0,
138
+ width : 0,
139
+ height : 0,
140
+ windowWidth,
141
+ windowHeight,
142
+ }
143
+ this.selectableColumnRef = React.createRef(null);
144
+ }
145
+ bindResizeEvents(){
146
+ return false;
147
+ }
148
+ canHandleColumnResize(){
149
+ return false;
150
+ }
151
+ initSession (){
152
+ let sessionName = this.props.sessionName;
153
+ let isDatagrid = this.isDatagrid()
154
+ if(!isNonNullString(sessionName)){
155
+ sessionName = 'datagrid';
156
+ }
157
+ let userCode = Auth.getLoggedUserCode();
158
+ Object.defineProperties(this,{
159
+ getSessionKey : {
160
+ value : ()=>{
161
+ if(!isNonNullString(sessionName) || (!isNonNullString(userCode) && !isDatagrid)) return false;
162
+ return this.getSessionPrefix()+sessionName.ltrim(this.getSessionPrefix()).replaceAll(" ",'_')+userCode;
163
+ }
164
+ },
165
+ getSessionData : {
166
+ value : (sessionKey)=>{
167
+ let key = this.getSessionKey();
168
+ let dat = {}
169
+ if(isNonNullString(key)){
170
+ dat = defaultObj($session.get(key));
171
+ }
172
+ if(isNonNullString(sessionKey)){
173
+ return dat[sessionKey]
174
+ }
175
+ return dat;
176
+ }
177
+ },
178
+ setSessionData : {
179
+ value : (sessionKey,sessionValue)=>{
180
+ if(this.props.session === false) return;
181
+ let key = this.getSessionKey();
182
+ if(!isNonNullString(key)) return false;
183
+ let dat = defaultObj(this.getSessionData());
184
+ if(isNonNullString(sessionKey)){
185
+ dat[sessionKey] = sessionValue;
186
+ } else if(isObj(sessionKey)){
187
+ extendObj(dat,sessionKey);
188
+ } else {
189
+ return dat;
190
+ }
191
+ $session.set(key,dat);
192
+ return dat;
193
+ }
194
+ }
195
+ })
196
+ }
197
+ /*** lorsque les filtres locaux changes */
198
+ onLocalFiltersChange(localFilters){
199
+ return;
200
+ let lFilters = {};
201
+ this.hasLocalFilters = false;
202
+ Object.map(localFilters,(f,i)=>{
203
+ if(!isObj(f) || !f.field) return;
204
+ lFilters[i] = f;
205
+ this.hasLocalFilters = true;
206
+ })
207
+ this.__localFilters = lFilters;
208
+ this.refresh(true);
209
+ }
210
+ /*** effectue un filtre local sur le tableau */
211
+ doLocalFilter({rowData}){
212
+ return true;
213
+ if(!isObj(rowData)) return null;
214
+ let localFilters = defaultObj(this.__localFilters);
215
+ let ret = true;
216
+ for(let i in localFilters){
217
+ let f = localFilters[i];
218
+ if(!isObj(f) || !f.field) continue;
219
+ let {value,operator,field,useRegex} = f;
220
+ if(!isDecimal(value) && !isBool(value) && !value) continue;
221
+ if(!filterUtils.match({
222
+ value : rowData[field],
223
+ filterText:value,
224
+ operator,
225
+ useRegex
226
+ }))
227
+ return false;
228
+ }
229
+ return ret;
230
+ }
231
+ initPagination(pagination){
232
+ pagination = defaultObj(pagination);
233
+ pagination.start = defaultDecimal(pagination.start);
234
+ pagination.limit = defaultDecimal(pagination.limit,this.getSessionData().paginationLimit,isMobileOrTabletMedia()?5:30);
235
+ pagination.page = defaultDecimal(pagination.page,pagination.page,1);
236
+ pagination.rows = 0;
237
+ return pagination;
238
+ }
239
+ /**** archive les documents sélectionnés */
240
+ archive(args){
241
+ args = defaultObj(args);
242
+ let archive = defaultFunc(this.props.archive);
243
+ let d = [];
244
+ Object.map(args.selectedRows,(doc)=>{
245
+ if(isDocUpdate(doc)){
246
+ d.push(doc)
247
+ }
248
+ });
249
+ args.data = d;
250
+ args.context = this;
251
+ if(d.length > 0){
252
+ let sL = d.length > 1 ? "s":"";
253
+ let tP = (!sL?" le ":(" les "+d.length.formatNumber()))+" document"+sL+" sélectionné"+sL;
254
+ showConfirm({
255
+ title : 'Archiver'+tP,
256
+ msg : "Attention il s'agit d'une opération irréversible!!\n"+'Voulez vous réellement archiver '+tP+"?",
257
+ yes : 'Archiver',
258
+ no : 'Annuler',
259
+ onSuccess : ()=>{
260
+ archive(args)
261
+ }
262
+ })
263
+ }
264
+ return ;
265
+ }
266
+ canPaginateData(){
267
+ return false;
268
+ }
269
+ getFiltersProps(){
270
+ return this.props.filters;
271
+ }
272
+ getSessionPrefix (){
273
+ return "datagrid"
274
+ }
275
+ isDatagrid(){
276
+ return false;
277
+ }
278
+ callSRowCallback({selected,row,rowIndex,key,cb}){
279
+ let count = Object.size(this.selectedRows);
280
+ let sArg = this.getActionsArgs(selected);
281
+ sArg.count = count;
282
+ sArg.rowIndex = sArg.index = rowIndex;
283
+ sArg.rowKey = key;
284
+ if(count >0){
285
+ if(selected){
286
+ if(typeof(this.props.onRowSelected) ==='function'){
287
+ sArg.selectedRow = row;
288
+ this.props.onRowSelected.call(this,sArg)
289
+ }
290
+ } else if(isFunction(this.props.onRowDeselected)) {
291
+ sArg.deselectedRow = row;
292
+ this.props.onRowDeselected.call(this,sArg);
293
+ }
294
+ if(this.isAllRowsSelected()){
295
+ if(isFunction(this.props.onRowsSelected)){
296
+ this.props.onRowsSelected.call(this,sArg);
297
+ }
298
+ }
299
+ } else {
300
+ if(count > 0 && isFunction(this.props.onRowsDeselected)){
301
+ this.props.onRowsDeselected.call(this,{context:this,props:this.props});
302
+ }
303
+ }
304
+ if(isFunction(cb)){
305
+ cb(selected,row,rowIndex,{context:this})
306
+ }
307
+ }
308
+ toggleSelectableColumnCheckbox(update){
309
+ if(isObj(this.selectableColumnRef) && isObj(this.selectableColumnRef.current) && typeof this.selectableColumnRef.current.check =='function' && typeof this.selectableColumnRef.current.uncheck =='function'){
310
+ if(typeof update !=='boolean'){
311
+ update = this.selectedRowsCount && this.selectedRowsCount === this.getMaxSelectableRows() ? true : false;
312
+ }
313
+ if(update){
314
+ this.selectableColumnRef.current.check(false);
315
+ } else {
316
+ this.selectableColumnRef.current.uncheck(false);
317
+ }
318
+ }
319
+ }
320
+ getSelectedRowsCount(){
321
+ return isDecimal(this.selectedRowsCount) ? this.selectedRowsCount: 0;
322
+ }
323
+ /**** fonction appelée lorsque l'on clique sur la checkbox permettant de sélectionner la ligne */
324
+ handleRowToggle ({row,rowIndex,rowData,rowKey,index, selected,cb,callback},cb2){
325
+ if(typeof rowKey !=='string' && typeof rowKey !=='number') return;
326
+ let selectableMultiple = defaultVal(this.props.selectableMultiple,true);
327
+ rowIndex = defaultNumber(rowIndex,index);
328
+ cb = defaultFunc(cb,callback,cb2)
329
+ row = rowData = defaultObj(row,rowData);
330
+ let size = this.selectedRowsCount;
331
+ if(selected && !selectableMultiple && size >= 1){
332
+ return notify.warning("Vous ne pouvez sélectionner plus d'un élément")
333
+ }
334
+ if(!selectableMultiple){
335
+ this.setSelectedRows();
336
+ }
337
+ let selectedRows = this.selectedRows;
338
+ const sRowRef = this.selectedRowsRefs[rowKey];
339
+ this.selectedRowsCount = isDecimal(this.selectedRowsCount)? this.selectedRowsCount : 0;
340
+ if(isObj(sRowRef) && typeof sRowRef.check =='function' && typeof sRowRef.uncheck =='function'){
341
+ selected ? sRowRef.check() : sRowRef.uncheck();
342
+ sRowRef.checked = !!selected;
343
+ }
344
+ if(selected){
345
+ this.selectedRowsCount +=1;
346
+ let max = this.getMaxSelectedRows();
347
+ if(max && size>= max){
348
+ return notify.warning("Vous avez atteint le nombre maximum d'éléments sélectionnable, qui est de "+max.formatNumber())
349
+ }
350
+ selectedRows[rowKey] = row;
351
+ } else {
352
+ this.selectedRowsCount = Math.max(this.selectedRowsCount-1,0);
353
+ delete selectedRows[rowKey];
354
+ }
355
+
356
+ this.toggleSelectableColumnCheckbox();
357
+ if(isObj(this.datagridActionsContext) && isFunction(this.datagridActionsContext.setSelectedRows)){
358
+ this.datagridActionsContext.setSelectedRows(selectedRows,x =>{
359
+ this.callSRowCallback({selected,row,rowIndex,rowKey,cb})
360
+ });
361
+ } else {
362
+ this.callSRowCallback({selected,rowData,row,rowIndex,rowKey,cb});
363
+ }
364
+ }
365
+ canExportAskDisplayMainContent(){
366
+ return false;
367
+ }
368
+ getExportableProps (){
369
+ let exportTableProps = this.props.exportTableProps;
370
+ if(isFunction(exportTableProps)){
371
+ exportTableProps = exportTableProps({context:this});
372
+ }
373
+ exportTableProps = defaultObj(exportTableProps);
374
+ exportTableProps.fileName = defaultStr(exportTableProps.fileName,this.props.title,this.props.text)
375
+ if(isFunction(exportTableProps.init)){
376
+ exportTableProps.init({data,context:this});
377
+ }
378
+ exportTableProps.askDisplayMainContent = this.canExportAskDisplayMainContent();
379
+ delete exportTableProps.init;
380
+ return exportTableProps;
381
+ }
382
+ onAllRowsToggle(){}
383
+ handleAllRowsToggle(update){
384
+ if(!defaultVal(this.props.selectableMultiple,true) && this.selectedRowsCount && this.getPaginatedData().length){
385
+ notify.warning("Vous ne pouvez sélectionner qu'un seul élément à la fois");
386
+ return;
387
+ }
388
+ if(typeof update !=='boolean'){
389
+ update = this.isAllRowsSelected();
390
+ }
391
+ let data = update ? this.getPaginatedData():[];
392
+ let max = this.getMaxSelectedRows();
393
+ if(max && data.length){
394
+ let _d = [],i=0,counter = 0,l = data.length;
395
+ while(i < max && counter < l ){
396
+ counter ++;
397
+ if(isObj(data[i])){
398
+ _d.push(data[i]);
399
+ i++;
400
+ }
401
+ }
402
+ data = _d;
403
+ }
404
+ this.setSelectedRows(data);
405
+ if(isObj(this.datagridActionsContext) && isFunction(this.datagridActionsContext.setSelectedRows)){
406
+ this.datagridActionsContext.setSelectedRows(this.selectedRows);
407
+ }
408
+ }
409
+ isAccordion(){
410
+ return false;
411
+ }
412
+ ////vérifie s'il s'agit du composant pivot grid
413
+ isPivotDatagrid(){
414
+ return false;
415
+ }
416
+ /** peut afficher les numéros de lignes */
417
+ canHandleIndexColumn(){
418
+ return this.isDatagrid();
419
+ }
420
+ getIndexColumnName(){
421
+ return "#dg-col-number"
422
+ }
423
+ getSelectableColumName(){
424
+ return "#dg-selectable-colname";
425
+ }
426
+ canHandleSelectableColumn(){
427
+ return false;
428
+ }
429
+ getSelectableColumNameStyle(){
430
+ return {alignItems:'flex-start',marginLeft:0,marginRight:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0};
431
+ }
432
+ isSelectableColumn(columnDef,columnField){
433
+ return isObj(columnDef) && defaultStr(columnDef.field,columnField) === this.getSelectableColumName();
434
+ }
435
+ initColumnsCallback(){}
436
+ initColumns (columns){
437
+ this.state.columns = {};
438
+ let colIndex = 0;
439
+ if(this.canHandleSelectableColumn()){
440
+ this.state.columns[this.getSelectableColumName()] = {
441
+ field : this.getSelectableColumName(),
442
+ style : this.getSelectableColumNameStyle(),
443
+ width : 40,
444
+ isSelectableColumnName : true,
445
+ filter : false,
446
+ visible : true,
447
+ text :"Case à cocher",
448
+ sortable : false,
449
+ }
450
+ }
451
+ if(this.canHandleIndexColumn()){
452
+ colIndex++;
453
+ this.state.columns [this.getIndexColumnName()] = {
454
+ filter : false,
455
+ visible : true,
456
+ width : 50,
457
+ frozen : 'left',
458
+ text : '#',
459
+ colIndex,
460
+ field : this.getIndexColumnName(),
461
+ sortable : false,
462
+ render : ({rowCounterIndex,columnField})=>{
463
+ return <Label primary key={rowCounterIndex+"-col-field-n"}>{rowCounterIndex}</Label>
464
+ }
465
+ }
466
+ }
467
+ let footers = this.getFooterFields(true);
468
+ let isAccordion = this.isAccordion();
469
+ Object.mapToArray(columns,(headerCol1,headerIndex)=>{
470
+ if(!isObj(headerCol1)) return;
471
+ const headerCol = Object.clone(headerCol1);
472
+ if(isAccordion && headerCol.accordion === false) return null;
473
+ let header = {...headerCol};
474
+ header.field = header.field || headerIndex
475
+ /**** pour ignorer une colonne du datagrid, il suffit de passer le paramètre datagrid à false */
476
+ if(!isNonNullString(header.field) || header.datagrid === false) {
477
+ return;
478
+ }
479
+ colIndex++;
480
+ header.visible = defaultVal(header.visible,true);
481
+ header.colIndex = colIndex;
482
+ this.state.columns[header.field] = header;
483
+ /*** les pieds de pages sont les données de type decimal, où qu'on peut compter */
484
+ if(header.footer !== false && (arrayValueExists(['decimal','number','money'],header.type) || header.format == 'money')){
485
+ footers[header.field] = header;
486
+ }
487
+ if(!this.hasColumnsHalreadyInitialized){
488
+ this.initColumnsCallback({...header,colIndex,columnField:header.field});
489
+ }
490
+ })
491
+ return footers;
492
+ }
493
+ getFooterFields(init){
494
+ this[this.footerFieldName] = init === true ? {} : defaultObj(this[this.footerFieldName]);
495
+ return this[this.footerFieldName];
496
+ }
497
+ hasFooterFields(){
498
+ return Object.size(this.getFooterFields(),true) ? true : false;
499
+ }
500
+ getActionsArgs(selected){
501
+ const r = isObj(selected)? selected : {};
502
+ const ret = {
503
+ ...databaseArgs,
504
+ selected : defaultBool(selected,false),
505
+ ...r,
506
+ isMobile : isMobileOrTabletMedia(),
507
+ component:'datagrid',
508
+ data : this.state.data,
509
+ rows : this.state.data,
510
+ allData : this.INITIAL_STATE.data,
511
+ props : this.props,
512
+ selectedRows : this.selectedRows,
513
+ context:this,
514
+ isMobile : isMobileOrTabletMedia(),
515
+ Auth,
516
+ };
517
+ if(this.props.getActionsArgs){
518
+ const sArg = this.props.getActionsArgs(ret);
519
+ if(isObj(sArg)){
520
+ return {...sArg,...ret};
521
+ }
522
+ }
523
+ return ret;
524
+ }
525
+
526
+ copyToClipboard({selectedRows}){
527
+ let keys = Object.keys(selectedRows);
528
+ let row = selectedRows[keys[0]];
529
+ if(!isObj(row)){
530
+ return notify.error("Impossible de copier le premier élément sélectionné du tableau car il est invalide");
531
+ }
532
+ return copyToClipboard({data:row,fields : this.props.columns,sessionName:defaultStr(this.props.sessionName,"datagrid")});
533
+ }
534
+
535
+ /*** les actions représentes les différents menus apparaissant lorsqu'une ligne est sélectionnée
536
+ * ou pas.
537
+ */
538
+ renderSelectedRowsActions(sActions){
539
+ let {printOptions,makePhoneCallProps,printable,print,archive,canMakePhoneCall,archivable} = this.props;
540
+ const {size} = sActions;
541
+ let r = [];
542
+ let endActs = [];
543
+ if(size <=0) {
544
+ return r
545
+ };
546
+ let selectedR = this.props.selectedRowsActions;
547
+ let sArgs = this.getActionsArgs(true);
548
+ if(isFunction(selectedR)) {
549
+ selectedR = selectedR.call(this,sArgs)
550
+ }
551
+ if(isFunction(print)){
552
+ if(isFunction(printable)){
553
+ printable = printable({context:this,props:this.props});
554
+ }
555
+ if(printable !== false){
556
+ r.push({
557
+ icon : defaultVal(this.props.printIcon,'printer'),
558
+ text : defaultVal(this.props.printButton,this.props.printText,'Imprimer'),
559
+ onPress : ()=>{
560
+ let {selectedRows}= sArgs;
561
+ let d = [];
562
+ for(let i in selectedRows){
563
+ if(isDocUpdate(selectedRows[i])){
564
+ d.push(selectedRows[i])
565
+ }
566
+ }
567
+ print({title:defaultStr(this.props.title),...defaultObj(printOptions),data:d});
568
+ },
569
+ })
570
+ }
571
+ }
572
+ Object.map(sActions,(o,i)=>{
573
+ if(isObj(o)){
574
+ let {onPress, ...rest} = o;
575
+ if(!isObj(rest) || !isFunction(onPress)) return null;
576
+ rest.onPress = (event)=>{
577
+ if(isFunction(onPress)){
578
+ onPress.call(this,sArgs);
579
+ }
580
+ }
581
+ if(o.pos !== 'end'){
582
+ r.push(rest)
583
+ } else {
584
+ endActs.push(rest);
585
+ }
586
+ }
587
+ })
588
+ Object.mapToArray(selectedR,(action,i)=>{
589
+ if(isObj(action)){
590
+ let {onPress, ...rest} = action;
591
+ if(!isObj(rest)) return null;
592
+ rest.onPress = (event)=>{
593
+ if(isFunction(onPress)){
594
+ onPress.call(this,sArgs);
595
+ }
596
+ }
597
+ r.push(rest)
598
+ }
599
+ })
600
+ endActs.map((a)=>{
601
+ r.push(a);
602
+ })
603
+ if(size === 1 && canMakePhoneCall === true && canMakeCall()){
604
+ const rowKey = Object.keys(this.selectedRows)[0], rowData = defaultObj(this.selectedRows[rowKey]);
605
+ let callProps = typeof makePhoneCallProps == 'function'? makePhoneCallProps(rowData,rowKey) : makePhoneCallProps;
606
+ callProps = defaultObj(callProps);
607
+ r.push({
608
+ text : defaultStr(callProps.text,callProps.label,'Appeler'),
609
+ icon : defaultStr(callProps.icon,'phone'),
610
+ flat : true,
611
+ onPress : ()=>{
612
+ return makePhoneCall(
613
+ rowData,
614
+ callProps
615
+ );
616
+ }
617
+ })
618
+ }
619
+ if(isObj(this.props.columns) && size ===1){
620
+ r.push({
621
+ icon : COPY_ICON,
622
+ text : 'Copier',
623
+ tooltip : 'Copier le premier élément sélectionné dans le presse papier',
624
+ pos:'end',
625
+ onPress : () =>{
626
+ this.copyToClipboard(sArgs)
627
+ },
628
+ });
629
+ }
630
+ return r;
631
+ }
632
+
633
+ /*** le trie du tableau prend en paramètre
634
+ : le nom de la colonne de trie, la direction de la conne de trie
635
+ par défaut, le trie se fait en ignorant la casse
636
+ sort : {
637
+ dir ://la direction : asc,desc
638
+ column : //le nom de la colonne à laquelle on trie
639
+ le nom de la colonne de tri doit être définie par défaut,
640
+ dans la propriété column du sort prop
641
+ ou dans la propriété sortByColumn
642
+ }
643
+ */
644
+ sort (column,dir){
645
+ let sort = extendObj({},{
646
+ dir: '',
647
+ column : '',
648
+ ignoreCase : true
649
+ }, this.state.sort);
650
+ if(isNonNullString(column)){
651
+ sort.column = column;
652
+ }
653
+ if(!isNonNullString(sort.column)){
654
+ return ;
655
+ }
656
+ if(isNonNullString(dir)){
657
+ sort.dir = dir;
658
+ }
659
+ if(this.state.sort.column === sort.column){
660
+ switch(this.state.sort.dir){
661
+ case 'asc':
662
+ sort.dir = 'desc';
663
+ break;
664
+ case 'desc':
665
+ sort.dir = 'asc';
666
+ break;
667
+ }
668
+ } else sort.dir = 'asc';
669
+
670
+ if(!isNonNullString(sort.dir)){
671
+ sort.dir = 'asc';
672
+ } else {
673
+ sort.dir = sort.dir.trim().toLowerCase();
674
+ }
675
+ if(sort.dir !== "asc" && sort.dir !== "desc") sort.dir = 'asc';
676
+ this._previousSortObj = this._sort;
677
+ this._sort = sort;
678
+ this.prepareColumns({sortedColumn : this._sort});
679
+ this.prepareData({data:this.state.data,updateFooters:false},(state)=>{
680
+ this.setState(state);
681
+ });
682
+ }
683
+
684
+ /**** pagine l'objet data passé en parmètre de manière a retourner un objet satisfaisant aux paramètres
685
+ start, limit,page
686
+ */
687
+ pagin (data,start, limit, page){
688
+ if(this.props.showPagination === false || this.props.pagin === false) return data;
689
+ this._pagination = defaultObj(this._pagination);
690
+ this._pagination.start = start;
691
+ this._pagination.limit = limit;
692
+ return data.slice(start, start + limit).filter(d => !!d);
693
+ }
694
+
695
+ _increment (){
696
+ const rows = this.INITIAL_STATE.data.length
697
+ const { start,limit, page} = this._pagination;
698
+ // Only correct multiple of rows per page
699
+ const max = rows - (rows % limit);
700
+
701
+ let newStart = Math.min(start + limit, max);
702
+ let nextPage = page + 1;
703
+ let pages = this.countPages();
704
+ if(nextPage > pages){
705
+ nextPage = pages;
706
+ }
707
+ this.handlePagination(newStart, limit, nextPage);
708
+ }
709
+
710
+ /*** aller à la dernière page */
711
+ _goToLastPage(){
712
+ let { start,limit} = this._pagination;
713
+ let numPages = this.countPages();
714
+ if(numPages <=1) return;
715
+ this.handlePagination((numPages-1)*this._pagination.limit, this._pagination.limit, numPages);
716
+ }
717
+
718
+ _decrement(){
719
+ let { start,limit,page, } = this._pagination;
720
+ let newStart = Math.max(0, start - limit);
721
+ let nextPage = page - 1;
722
+ if(nextPage < 1) nextPage = 1;
723
+ this.handlePagination(newStart, limit, nextPage);
724
+ };
725
+
726
+ /*** retourne la liste du nombre de pages */
727
+ countPages()
728
+ {
729
+ return Math.ceil(this.INITIAL_STATE.data.length / this._pagination.limit);
730
+ }
731
+
732
+
733
+ /*** lorsqu'on clique sur la ligne */
734
+ onRowPress (row,rowIndex,event){
735
+ if(isFunction(this.props.onRowPress)){
736
+ this.props.onRowPress.call(this,{row,allData:this.INITIAL_STATE.data,rowIndex,event,props:this.props,context:this});
737
+ }
738
+ }
739
+ /** lorsqu'on double click sur la ligne */
740
+ onRowDoubleClick(row,rowIndex,event){
741
+ if(isFunction(this.props.onRowDoubleClick)){
742
+ this.props.onRowDoubleClick.call(this,{row,allData:this.INITIAL_STATE.data,rowIndex,event,props:this,context:this});
743
+ }
744
+ }
745
+
746
+ /*** aller à la première page */
747
+ _goToFirstPage(){
748
+ this.handlePagination(0, this._pagination.limit, 1);
749
+ }
750
+
751
+ _setRowsPerPage (value) {
752
+ if(isObj(value) && isDecimal(value.value)){
753
+ value = value.value;
754
+ }
755
+ value = defaultDecimal(value);
756
+ this.handlePagination(0, value, 1);
757
+ };
758
+
759
+ showFilters(){
760
+ if(!this._isMounted()) {
761
+ this.isUpdating = false;
762
+ return;
763
+ }
764
+ if(this.isUpdating) return false;
765
+ this.isUpdating = true;
766
+ this.setState( {showFilters:true},()=>{
767
+ this.isUpdating = false;
768
+ this.setSessionData({showFilter:true});
769
+ })
770
+ }
771
+ hideFilters (){
772
+ if(!this._isMounted()) {
773
+ this.isUpdating = false;
774
+ return;
775
+ }
776
+ if(this.isUpdating) return false;
777
+ this.setState({showFilters:false},()=>{
778
+ this.isUpdating = false;
779
+ this.setSessionData({showFilter:false})
780
+ })
781
+ }
782
+
783
+
784
+ showFooter(){
785
+ if(!this._isMounted()) {
786
+ this.isUpdating = false;
787
+ return;
788
+ }
789
+ if(this.isUpdating) return false;
790
+ this.isUpdating = true;
791
+ this.setState( {showFooter:true},()=>{
792
+ this.isUpdating = false;
793
+ this.setSessionData({showFooter:true})
794
+ })
795
+ }
796
+ hideFooter (){
797
+ if(!this._isMounted()) {
798
+ this.isUpdating = false;
799
+ return;
800
+ }
801
+ if(this.isUpdating) return false;
802
+ this.setState({showFooter:false},()=>{
803
+ this.isUpdating = false;
804
+ this.setSessionData({showFooter:false});
805
+ })
806
+ }
807
+
808
+ toggleFixedTableState(){
809
+ const fixedTable = !this.state.fixedTable;
810
+ this.setState({fixedTable},()=>{
811
+ this.updateLayout();
812
+ this.setSessionData("fixedTable",fixedTable);
813
+ })
814
+ }
815
+ getSessionNameKey (){
816
+ return defaultStr(this.props.table,this.props.tableName,this.props.sessionName);
817
+ }
818
+ /*** affiche ou masque une colonne filtrée */
819
+ toggleFilterColumnVisibility(field){
820
+ if(!isNonNullString(field)) return;
821
+ let filteredColumns = {...this.state.filteredColumns};
822
+ filteredColumns[field] = defaultBool(filteredColumns[field],false) == false ? true : false;
823
+ this.prepareColumns({filteredColumns});
824
+ this.setState({filteredColumns},()=>{
825
+ this.setSessionData("filteredColumns"+this.getSessionNameKey(),filteredColumns);
826
+ if(!filteredColumns[field]){
827
+ this.filters[field] = defaultObj(this.filters[field]);
828
+ this.filters[field].value = this.filters[field].defaultValue = undefined;
829
+ this.doFilter({value:undefined,field})
830
+ }
831
+ });
832
+ }
833
+ /*** affiche ou masque une colonne */
834
+ toggleColumnVisibility(field,removeFocus){
835
+ if(!isNonNullString(field)) return;
836
+ let columns = {...this.state.columns};
837
+ columns[field].visible = !columns[field].visible;
838
+ let footers = this.getFooterFields();
839
+ if(isObj(footers[field])){
840
+ footers[field].visible = columns[field].visible;
841
+ }
842
+ this.prepareColumns({columns});
843
+ this.setState({columns},()=>{
844
+ if(removeFocus) document.body.click();
845
+ });
846
+ }
847
+
848
+ renderFilter(props){
849
+ return <Filter {...props}/>
850
+ }
851
+ prepareColumn(){}
852
+ beforePrepareColumns(){}
853
+ prepareColumns (args){
854
+ this.beforePrepareColumns();
855
+ args = defaultObj(args);
856
+ const filteredColumns = isObjOrArray(args.filteredColumns)?args.filteredColumns : isObjOrArray(this.state.filteredColumns) ? this.state.filteredColumns : {};
857
+ const columns = args.columns || this.state.columns;
858
+ const currentSortedColumn = isObj(args.sortedColumn) && args.sortedColumn.column? args.sortedColumn : defaultObj(this.state.sort);
859
+ const visibleColumns = [],headerFilters = [],visibleColumnsNames={};
860
+ const sortable = defaultBool(this.props.sortable,true);
861
+ const sortedColumns = {};
862
+ let sortedColumnsLength = 0;
863
+ let sortedColumn = {icon:"sort"}
864
+ let filters = defaultBool(this.props.filters,true);
865
+ if(this.props.toggleFilters ===false){
866
+ filters = false;
867
+ }
868
+ let {filterOrOperator,filterAndOperator} = this.props;
869
+ const widths = {};
870
+ let totalWidths = 0;
871
+ let columnIndex = 0,visibleColumnIndex=0;
872
+ Object.map(columns,(header,headerIndex) => {
873
+ let {
874
+ field,
875
+ render,
876
+ readOnly,
877
+ disabled,
878
+ visible,
879
+ defaultValue,
880
+ id,
881
+ key,
882
+ sortType,
883
+ width,
884
+ ...restCol
885
+ } = header;
886
+ restCol = defaultObj(restCol);
887
+ let colFilter = defaultVal(restCol.filter,true);
888
+ field = header.field = defaultStr(header.field,field,headerIndex);
889
+ delete restCol.filter;
890
+ width = defaultDecimal(width);
891
+ if(width <COLUMN_WIDTH/2){
892
+ width = COLUMN_WIDTH;
893
+ }
894
+ const type = defaultStr(header.type).toLowerCase();
895
+ sortType = defaultStr(sortType,type).toLowerCase();
896
+ if(type.contains("date")|| type.contains("time")){
897
+ width = Math.max(width,DATE_COLUMN_WIDTH);
898
+ }
899
+ totalWidths +=width;
900
+ widths[header.field] = width;
901
+ let colProps = {id,key}
902
+ colProps.key = isNonNullString(key)?key : (header.field||("datagrid-column-header-"+headerIndex))
903
+ colProps.style = Object.assign({},StyleSheet.flatten(restCol.style));
904
+ if(!visible){
905
+ colProps.style.display = 'none';
906
+ }
907
+ visibleColumnsNames[header.field] = visible ? true : false;
908
+ visibleColumns.push({
909
+ onPress : ()=>{this.toggleColumnVisibility(header.field);return false},
910
+ title : header.text||header.title||header.field,
911
+ icon : visible?CHECKED_ICON_NAME : null,
912
+ });
913
+ restCol.field = header.field;
914
+ restCol.label = defaultStr(header.text,header.label) ;
915
+ if(!restCol.label){
916
+ console.error(header," has not label or text in datagrid",columns,this.props)
917
+ }
918
+ let isColumnSortable = false,isColumnSorted = false;
919
+ if(sortable && header.sortable !== false){
920
+ isColumnSortable = true;
921
+ if(currentSortedColumn.column ==field){
922
+ isColumnSorted = true;
923
+ sortedColumn.field = currentSortedColumn.column;
924
+ sortedColumn.header = header;
925
+ sortedColumn.label = restCol.label;
926
+ const isDesc = currentSortedColumn.dir === "desc";
927
+ const prefix = (sortType =='number' || sortType == 'decimal') ? "numeric" : sortType =='boolean'?'bool' : sortType =='date'? 'calendar': sortType =='time'? 'clock' : 'alphabetical';
928
+ sortedColumn.icon = 'sort-'+prefix+'-'+(isDesc ? "descending" : "ascending");
929
+ sortedColumn.title = (isDesc ? "Trié par ordre décroissant":"Trié par ordre croissant ")+ " du champ ["+restCol.label+"]";
930
+ }
931
+ sortedColumns[field] = restCol.label;
932
+ sortedColumnsLength++;
933
+ }
934
+ colFilter = colFilter && filters !== false ? true : false;
935
+ const sortedProps = isColumnSorted ? {...sortedColumn} : {};
936
+ let filterProps = {};
937
+ if(colFilter){
938
+ let fCol = {...defaultObj(this.filters[header.field])}
939
+ this.filters[header.field] = fCol;
940
+ delete restCol.sortable;
941
+ filterProps = {
942
+ ...restCol,
943
+ key : header.field,
944
+ label : defaultStr(header.label,header.text),
945
+ orOperator : filterOrOperator,
946
+ andOperator : filterAndOperator,
947
+ searchIconTooltip : 'Filtre',
948
+ searchIcon : 'filter_list',
949
+ defaultValue : fCol.originalValue,
950
+ name : header.field,
951
+ onClearFilter : this.onClearFilter.bind(this),
952
+ onChange : this.onFilterChange.bind(this),
953
+ operator : fCol.operator,
954
+ action : defaultStr(fCol.originAction,fCol.action),
955
+ };
956
+ this.renderFilter(filterProps,headerFilters);
957
+ }
958
+ this.prepareColumn({
959
+ visible,
960
+ columnIndex,
961
+ visibleColumnIndex,
962
+ sortable:isColumnSortable,
963
+ sorted:isColumnSorted,
964
+ sortedColumn :sortedProps,///les props de la columns triée
965
+ sortedProps,
966
+ props:{...restCol,...colProps},
967
+ field,
968
+ width,
969
+ columnField : field,
970
+ columnDef : header,
971
+ index : headerIndex,
972
+ filterProps,
973
+ key : header.field,
974
+ filter :colFilter,
975
+ },headerFilters)
976
+ columnIndex++;
977
+ visibleColumnIndex++;
978
+
979
+ })
980
+ this.preparedColumns.sortedColumns = sortedColumns;
981
+ this.preparedColumns.sortedColumn = sortedColumn;
982
+ this.preparedColumns.sortedColumnsLength = sortedColumnsLength;
983
+ this.preparedColumns.visibleColumns = visibleColumns;
984
+ this.preparedColumns.visibleColumnsNames = visibleColumnsNames;
985
+ this.preparedColumns.filters = headerFilters;
986
+ this.preparedColumns.filteredColumns = filteredColumns;
987
+ this.preparedColumns.widths = widths;
988
+ this.preparedColumns.totalWidths = totalWidths;
989
+ return this.preparedColumns;
990
+ }
991
+ getPaginatedSelectedRows(data){
992
+ data = isArray(data)? data : this.INITIAL_STATE.data;
993
+ if(JSON.stringify(this._previousSortObj) !== JSON.stringify(this._sort || JSON.stringify(this._previousPagination) !== JSON.stringify(this._pagination)) && this.getPaginatedData().length !== data.length){
994
+ return {};
995
+ }
996
+ return this.selectedRows;
997
+ }
998
+ getFooterValues(){
999
+ return defaultObj(this.___evaluatedFootersValues);
1000
+ }
1001
+ prepareData(args,cb){
1002
+ let {pagination,data,force,updateFooters} = defaultObj(args);
1003
+ cb = typeof cb ==='function'? cb : typeof args.cb == 'function'? args.cb : undefined;
1004
+ let isArr = Array.isArray(data);
1005
+ //let push = (d,index) => isArr ? newData.push(d) : newData[index] = d;
1006
+ const hasLocalFilter = this.props.filters !== false && this.hasLocalFilters;
1007
+ let footersColumns = this.getFooterFields(),hasFooterFields = Object.size(footersColumns,true);
1008
+ const canUpdateFooters = !!(updateFooters !== false && hasFooterFields);
1009
+ if(hasLocalFilter || !isArr || canUpdateFooters) {
1010
+ if(canUpdateFooters){
1011
+ this.___evaluatedFootersValues = {}
1012
+ }
1013
+ const newData = [];
1014
+ Object.map(data,(d,i)=>{
1015
+ if(!isObj(d) || (hasLocalFilter && this.doLocalFilter({rowData:d,rowIndex:i}) === false)){
1016
+ return;
1017
+ }
1018
+ if(canUpdateFooters){
1019
+ Object.map(footersColumns,(columnDef,field)=>{
1020
+ evalSingleValue({data:d,columnDef,field,result:this.___evaluatedFootersValues,displayLabel:false})
1021
+ });
1022
+ }
1023
+ newData.push(d);
1024
+ //push(d,i);
1025
+ });
1026
+ data = newData;
1027
+ }
1028
+ const beforeS = data;
1029
+ if(this.isDatagrid() && isNonNullString(this._sort.column)){
1030
+ if(isObj(this.state.columns) && this.state.columns[this._sort.column]){
1031
+ let field = this.state.columns[this._sort.column];
1032
+ const cfg = Object.assign({},this._sort);
1033
+ cfg.getItem = (item,columnName,{getItem})=>{
1034
+ if(isObj(item) && (field.type =='decimal' || field.type =="number")){
1035
+ const v = item[columnName];
1036
+ return isDecimal(v)? v : isNonNullString(v)? parseDecimal(v) : 0;
1037
+ }
1038
+ return getItem(item,columnName);
1039
+ }
1040
+ data = sortBy(data,cfg);//on trie tout d'abord les données
1041
+ }
1042
+ }
1043
+ this.INITIAL_STATE.data = data;
1044
+ if(this.canPaginateData()){
1045
+ pagination = this.initPagination(pagination);
1046
+ pagination.rows = data.length;
1047
+ this._pagination = pagination;
1048
+ data = this.pagin(data,pagination.start,pagination.limit,pagination.page);
1049
+ this.setSelectedRows(this.getPaginatedSelectedRows(data));
1050
+ } else if(force){
1051
+ this.setSelectedRows();
1052
+ }
1053
+ const state = {data,isLoading:false,sort : this._sort};
1054
+ if((cb)){
1055
+ cb(state);
1056
+ }
1057
+ return state;
1058
+ }
1059
+ isRowSelected(rowKey,rowIndex){
1060
+ if(isObj(rowKey)){
1061
+ rowKey = this.getRowKey(rowKey,rowIndex);
1062
+ }
1063
+ if(isObj(this.selectedRows[rowKey])) return true;
1064
+ if(typeof rowKey !=='string' && typeof rowKey !=='number' || !isObj(this.selectedRowsRefs[rowKey])) return false;
1065
+ return !!this.selectedRowsRefs[rowKey].checked;
1066
+ }
1067
+ /*** permet de définir les lignes sélectionnées du datagrid */
1068
+ setSelectedRows (rows){
1069
+ let obj = this.selectedRows;
1070
+ this.selectedRowsCount = 0;
1071
+ Object.getOwnPropertyNames(obj).forEach((prop)=> {
1072
+ delete obj[prop];
1073
+ const sRowRef = this.selectedRowsRefs[prop];
1074
+ if(isObj(sRowRef) && sRowRef.check && sRowRef.uncheck){
1075
+ sRowRef.uncheck(false);
1076
+ }
1077
+ });
1078
+ Object.map(rows,(row,i)=>{
1079
+ if(isObj(row)) {
1080
+ const rowKey = this.getRowKey(row,i);
1081
+ this.selectedRowsCount++;
1082
+ this.selectedRows[rowKey] = row;
1083
+ const sRowRef = this.selectedRowsRefs[rowKey];
1084
+ if(isObj(sRowRef) && sRowRef.check && sRowRef.uncheck){
1085
+ sRowRef.check(false);
1086
+ }
1087
+ }
1088
+ });
1089
+ this.toggleSelectableColumnCheckbox();
1090
+ return this.selectedRows;
1091
+ }
1092
+
1093
+
1094
+ getProgressBar(props){
1095
+ if(!this.isLoading() && props !== true) return null;
1096
+ if(typeof props !=='object' || !props){
1097
+ props = {};
1098
+ }
1099
+ if(React.isValidElement(this.props.progressBar)) return this.props.progressBar ;
1100
+ if(this.props.useLinesProgressBar === true || this.props.useLineProgressBar === true){
1101
+ return CommonDatagridComponent.LineProgressBar(props);
1102
+ }
1103
+ return this.getDefaultPreloader(props);
1104
+ }
1105
+ handlePagination(start, limit, page) {
1106
+ this._previousPagination = this._pagination;
1107
+ this._pagination = {
1108
+ start,
1109
+ limit,
1110
+ page,
1111
+ rows : this.INITIAL_STATE.data.length
1112
+ }
1113
+ let data = this.pagin(this.INITIAL_STATE.data,start, limit,page)
1114
+ this.setSelectedRows(this.getPaginatedSelectedRows());
1115
+ this.setState({data},()=>{
1116
+ setTimeout(()=>{
1117
+ this.setSessionData({paginationLimit:limit})
1118
+ },1)
1119
+ });
1120
+ };
1121
+
1122
+ ///supprime tous les filtres s'ils existenent
1123
+ _clearAllFilters (){
1124
+ let filters = {};
1125
+ let defValue = undefined;
1126
+ Object.map(this.filters,(f,i)=>{
1127
+ if(!isObj(f)) return;
1128
+ defValue = undefined;
1129
+ if(f.type =="select") defValue = [];
1130
+ filters[i] = {...f,value:defValue,defaultValue:defValue,originalValue:defValue}
1131
+ })
1132
+ this.filters = filters;
1133
+ this.refresh(true);
1134
+ }
1135
+ clearAllFilters(){
1136
+ if(isObj(this.state.filteredColumns)){
1137
+ let filteredColumns = {...this.state.filteredColumns};
1138
+ for(let k in filteredColumns){
1139
+ filteredColumns[k] = false;
1140
+ }
1141
+ this.prepareColumns({filteredColumns});
1142
+ this.setState({filteredColumns},()=>{
1143
+ this.setSessionData("filteredColumns"+this.getSessionNameKey(),{});
1144
+ this._clearAllFilters();
1145
+ })
1146
+ } else {
1147
+ this._clearAllFilters();
1148
+ }
1149
+ }
1150
+ onClearFilter (arg){
1151
+ return;
1152
+ let {field,name,type} = defaultObj(arg);
1153
+ field = defaultStr(field,name);
1154
+ if(field){
1155
+ let v = defaultStr(type).toLowerCase() == "select"? []:undefined
1156
+ this.filters[field] = {value:v,defaultValue:v,originalValue:v,originValue:v}
1157
+ this.doFilter({value:v,field,force:true})
1158
+ }
1159
+ }
1160
+ /*** si la valeur de filtre peut être utilisée */
1161
+ canHandleFilterVal(f){
1162
+ return canHandleFilter(f);
1163
+ }
1164
+ onFilterChange(arg){
1165
+ this.filteredValues = defaultObj(this.filteredValues);
1166
+ let {field,operator,action,value} = defaultObj(arg);
1167
+ if(isNonNullString(field) && isNonNullString(operator) && isNonNullString(action)){
1168
+ this.filteredValues[field] = {
1169
+ operator,action,value,field
1170
+ }
1171
+ }
1172
+ return this.doFilter(arg);
1173
+ }
1174
+ getFilters(){
1175
+ let filters = {}
1176
+ this.filters = extendObj(true,{},this.filteredValues,this.filters)
1177
+ for(let i in this.filters){
1178
+ let f = this.filters[i];
1179
+ if(!this.canHandleFilterVal(f)) {
1180
+ continue;
1181
+ }
1182
+ f.field = defaultStr(f.field,i);
1183
+ if(f.action =="$today"){
1184
+ f.operator = "$and";
1185
+ f.action = "$eq"
1186
+ }
1187
+ filters[f.operator] = defaultArray(filters[f.operator]);
1188
+ let ob = {};
1189
+ ob[f.field] = {}
1190
+ if(f.action == "$period"){
1191
+ let sp = defaultStr(f.value);
1192
+ if(sp){
1193
+ sp = sp.split("=>");
1194
+ if(DateLib.isValidSQLDate(sp[0]) && DateLib.isValidSQLDate(sp[1])){
1195
+ filters[f.operator].push({
1196
+ [f.field] : {$gte:sp[0]}
1197
+ })
1198
+ filters[f.operator].push({
1199
+ [f.field] : {$lte:sp[1]}
1200
+ })
1201
+ }
1202
+ }
1203
+ } else {
1204
+ ob[f.field][f.action] = f.value;
1205
+ filters[f.operator].push(ob)
1206
+ }
1207
+ }
1208
+ return filters;
1209
+ }
1210
+ fetchData(){}
1211
+ /**** Filtre le tableau */
1212
+ doFilter ({value,field,selector,event,force}){
1213
+ if(!this._isMounted()) return;
1214
+ this.canDoFilter = false;
1215
+ selector = defaultObj(selector);
1216
+ field = defaultStr(field,selector.field);
1217
+ if(!isNonNullString(field)) return;
1218
+ let prevVal = defaultObj(this.filters[field]);
1219
+ this.filters[field] = {...selector,value,event};
1220
+ if(force !== true){
1221
+ let newVal = this.filters[field];
1222
+ let prev = {action : prevVal.action,value:prevVal.value,operator:prevVal.operator},
1223
+ current = {action : newVal.action,value:newVal.value,operator:newVal.operator}
1224
+ if(isObjOrArray(current.value)){
1225
+ current.value = JSON.stringify(current.value);
1226
+ }
1227
+ if(isObjOrArray(prev.value)){
1228
+ prev.value = JSON.stringify(prev.value);
1229
+ }
1230
+ if((prev.action === undefined && prev.value === undefined && prev.operator === undefined && (value === undefined || value === '' || value === null)) || (JSON.stringify(prev) === JSON.stringify(current) && prev.value == current.value)){
1231
+ return Promise.resolve([]);
1232
+ }
1233
+ }
1234
+ if(this.canPaginateData()){
1235
+ this._pagination = defaultObj(this._pagination);
1236
+ this._pagination.page = 1;
1237
+ this._pagination.start = 0;
1238
+ }
1239
+ this.filtersSelectors = {selector:this.getFilters()};
1240
+ return this.fetchData(true,null,this.filtersSelectors);
1241
+ }
1242
+ onSetQueryLimit(){
1243
+ if(!this.canSetQueryLimit()) return;
1244
+ const current = this.currentDatagridQueryLimit;
1245
+ const cValue = this.getQueryLimit();
1246
+ if(cValue == current) return;
1247
+ this.refresh(true);
1248
+ }
1249
+ setQueryLimit(){
1250
+ this.currentDatagridQueryLimit = this.getSessionData("databaseQueryLimit");
1251
+ setQueryLimit(this.currentDatagridQueryLimit,(limit)=>{
1252
+ this.setSessionData("databaseQueryLimit",limit)
1253
+ notify.success("Le nombre maximal d'élément a été définit à la valeur "+(limit==0?" infinit ":limit.formatNumber())+". Cette valeur sera prise en compte à la prochaine réactualisation du tableau")
1254
+ });
1255
+ }
1256
+
1257
+ canSetQueryLimit(){
1258
+ return isDecimal(this.props.queryLimit) && (this.props.queryLimit >=0) ? false : true;
1259
+ }
1260
+ getQueryLimit(){
1261
+ if(isDecimal(this.props.queryLimit) && (this.props.queryLimit >=0)) return this.props.queryLimit
1262
+ let sLimit = this.getSessionData("databaseQueryLimit");
1263
+ if(isDecimal(sLimit) && sLimit >= 0) return sLimit;
1264
+ return 0;
1265
+ }
1266
+ renderQueryLimit(content){
1267
+ let cLImit = this.getQueryLimit();
1268
+ if(cLImit == 0) cLImit = " infinit"
1269
+ let s = "";
1270
+ let canSetQ = this.canSetQueryLimit();
1271
+ if(canSetQ){
1272
+ s = ".\nPressez pendent quelques secondes pour modifier cette valeur du nombre limite d'éléments de la liste";
1273
+ }
1274
+ else if(isDecimal(cLImit)){
1275
+ cLImit = (" de "+cLImit.formatNumber())
1276
+ }
1277
+ content = isDecimal(content) || typeof content =="string" ? <Label primary textBold style={styles.queryLimit}>{content}</Label> : React.isValidElement(content)? content : null;
1278
+ return <Tooltip title={"Le nombre maximal d'éléments à récupérer depuis la base de données pour la liste est "+cLImit+s} Component={Label} cursorPointer={canSetQ}>
1279
+ <Pressable style={[theme.styles.row]} onLongPress={canSetQ?this.setQueryLimit.bind(this):undefined}>
1280
+ {content}
1281
+ {isDecimal(cLImit) && cLImit > 0 && <Label primary textBold style={styles.queryLimit}> | {cLImit.formatNumber()}</Label>}
1282
+ </Pressable>
1283
+ </Tooltip>
1284
+ }
1285
+ getFetchDataOpts(){
1286
+ return this.props.fetchDataOpts;
1287
+ }
1288
+
1289
+ forceRefresh(){
1290
+ this.refresh(true);
1291
+ }
1292
+ refresh (force,cb){}
1293
+ onResizePage(){}
1294
+ componentDidMount(){
1295
+ super.componentDidMount();
1296
+ APP.on(APP.EVENTS.RESIZE_PAGE,this._events.RESIZE_PAGE);
1297
+ APP.on(APP.EVENTS.SET_DATAGRID_QUERY_LIMIT,this._events.SET_DATAGRID_QUERY_LIMIT);
1298
+ }
1299
+ componentWillUnmount(){
1300
+ super.componentWillUnmount();
1301
+ APP.off(APP.EVENTS.RESIZE_PAGE,this._events.RESIZE_PAGE);
1302
+ APP.off(APP.EVENTS.SET_DATAGRID_QUERY_LIMIT,this._events.SET_DATAGRID_QUERY_LIMIT);
1303
+ this.clearEvents();
1304
+ }
1305
+
1306
+ /*** s'il s'agit d'un datagrid virtualisé, ie à utiliser le composant react-base-table */
1307
+ isVirtual(){
1308
+ return false;
1309
+ }
1310
+
1311
+ getRowKey(row,rowIndex){
1312
+ let k = rowIndex;
1313
+ const rowKey = this.props.rowKey;
1314
+ if(isNonNullString(rowKey) && isObj(row) && (isNonNullString(row[rowKey]) || isDecimal(row[rowKey]))){
1315
+ return row[rowKey];
1316
+ }
1317
+ if(isFunction(this.props.getRowKey)){
1318
+ k = this.props.getRowKey({row,rowData:row,data:row,rowIndex,item:row,index:rowIndex,context:this});
1319
+ } else if(isObj(row)){
1320
+ return React.getKey(row,rowIndex);
1321
+ } else k = rowIndex;
1322
+ if(isObj(row) && isNonNullString(row.rowKey)){
1323
+ k +=row.rowKey;
1324
+ }
1325
+ return isDecimal(k) ? k : defaultStr(k,uniqid("row-key-datagrid"));
1326
+ }
1327
+ /*** récupère la plage de donnée visible au travers la pagination */
1328
+ getPaginatedData(){
1329
+ return Array.isArray(this.state.data)? this.state.data: []
1330
+ }
1331
+ /*** retourne le nombre maximal d'éléments sélectionnables */
1332
+ getMaxSelectedRows(){
1333
+ return 0;
1334
+ }
1335
+ getMaxSelectableRows(){
1336
+ let max = this.getMaxSelectedRows();
1337
+ if(this.state.data && typeof this.state.data.length ==='number'){
1338
+ max = max ? Math.min(max,this.state.data.length,max) : this.state.data.length;
1339
+ }
1340
+ return max;
1341
+ }
1342
+ /**** met à jour l'état de progression de la mise à jour du tableau */
1343
+ updateProgress(state,cb){
1344
+ state = defaultObj(state);
1345
+ state.isLoading = defaultBool(state.isLoading,!!!this.state.isLoading);
1346
+ this.setState({...state},cb);
1347
+ }
1348
+ isAllRowsSelected(update){
1349
+ return this.selectedRowsCount && this.selectedRowsCount === this.getMaxSelectableRows()? true : false;
1350
+ }
1351
+ getDefaultPaginationRowsPerPageItems (){
1352
+ return [5,10,15,20,25,30,40,50,60,80,100];
1353
+ }
1354
+ measureLayout(cb,force,layoutRef){
1355
+ cb = typeof cb === 'function'? cb : x=>x;
1356
+ layoutRef = layoutRef || this.layoutRef.current;
1357
+ return new Promise((resolve)=>{
1358
+ if(layoutRef && layoutRef.measureInWindow){
1359
+ layoutRef.measureInWindow((x, y, width, height) => {
1360
+ const r = this.getLayoutState({ x, y, width, height },force);
1361
+ cb(r);
1362
+ resolve(r);
1363
+ });
1364
+ }
1365
+ })
1366
+ }
1367
+ getLayoutState(layout,force){
1368
+ layout = defaultObj(layout);
1369
+ const {width,height} = Dimensions.get("window");
1370
+ layout.windowWidth = width;
1371
+ layout.windowHeight = height;
1372
+ const prevLayout = defaultObj(this.state.layout)
1373
+ const prevY = Math.abs(defaultDecimal(prevLayout.y)-defaultDecimal(layout.y));
1374
+ const prevHeight = Math.abs(defaultDecimal(prevLayout.height)-defaultDecimal(layout.height));
1375
+ const prevWindowWidth = Math.abs(defaultDecimal(prevLayout.windowWidth)-defaultDecimal(layout.windowWidth));
1376
+ const prevWindowHeight = Math.abs(defaultDecimal(prevLayout.windowHeight)-defaultDecimal(layout.windowHeight));
1377
+ if(force !== true && prevY < 20 && prevHeight < 20 && prevWindowWidth <= 100 && prevWindowHeight <= 50) return null;
1378
+ return {
1379
+ layout,
1380
+ }
1381
+ }
1382
+ updateLayout(p){
1383
+ this.measureLayout(state=>{
1384
+ if(isObj(state)){
1385
+ if(!this.state.isReady){
1386
+ state.isReady = true;
1387
+ }
1388
+ this.setState(state);
1389
+ }
1390
+ },isObj(p) && typeof p.force ==='boolean'?p.force : !this.state.isReady)
1391
+ }
1392
+ UNSAFE_componentWillReceiveProps(nextProps){
1393
+ if('data' in nextProps && isObjOrArray(nextProps.data)){
1394
+ this.prepareData({data:nextProps.data,force:true},(state)=>{
1395
+ this.setState(state)
1396
+ });
1397
+ }
1398
+ }
1399
+ getDefaultPreloader(props){
1400
+ return CommonDatagridComponent.getDefaultPreloader();
1401
+ }
1402
+ isLoading (){
1403
+ return this.state.isLoading === true ? true : false;
1404
+ }
1405
+ getLinesProgressBar(){
1406
+ return CommonDatagridComponent.LinesProgressBar(this.props);
1407
+ }
1408
+ isSelectableMultiple(){
1409
+ return defaultBool(this.props.selectableMultiple,true)
1410
+ }
1411
+ renderHeaderCell({columnDef,columnField}){
1412
+ if(this.isSelectableColumn(columnDef,columnField)){
1413
+ return <Checkbox
1414
+ checked ={this.isAllRowsSelected()?true:false}
1415
+ key = {this.getSelectableColumName()}
1416
+ secondaryOnCheck
1417
+ style = {this.getSelectableColumNameStyle()}
1418
+ ref = {this.selectableColumnRef}
1419
+ onPress = {({checked})=>{
1420
+ this.handleAllRowsToggle(!checked);
1421
+ return;
1422
+ }}
1423
+ />
1424
+ }
1425
+ let ret = columnDef.label || columnDef.text || columnDef.field;
1426
+ const {sortedColumn} = this.preparedColumns;
1427
+ const sortable = columnDef.sortable !== false ? true : false;
1428
+ const isColumnSorted = sortable && sortedColumn.field === columnField && sortedColumn.icon ? true : false;
1429
+ const sortMe = (event)=>{
1430
+ React.stopEventPropagation(event);
1431
+ this.sort(columnField);
1432
+ };
1433
+ return <TouchableRipple disabled={!sortable} style={styles.sortableColumn} onPress={sortMe}>
1434
+ <>
1435
+ {isColumnSorted ? <Icon
1436
+ {...sortedColumn}
1437
+ size = {24}
1438
+ style = {[sortedColumn.style,styles.sortedColumnIcon]}
1439
+ name = {sortedColumn.icon}
1440
+ onPress = {sortMe}
1441
+ primary
1442
+ />: null}
1443
+ <Label primary={isColumnSorted}>{ret}</Label>
1444
+ </>
1445
+ </TouchableRipple>
1446
+ }
1447
+ renderSelectableCheckboxCell(props){
1448
+ const {containerProps} = props;
1449
+ if(isObj(containerProps)){
1450
+ containerProps.style = [this.getSelectableColumNameStyle(),containerProps.style];
1451
+ }
1452
+ return <Checkbox
1453
+ testID = {"RN_SelectableColumnName_"+(props.field||props.columnField+props.index)}
1454
+ {...props}
1455
+ style = {[props.style,this.getSelectableColumNameStyle()]}
1456
+ key = {props.rowKey}
1457
+ />
1458
+ }
1459
+ /*** retourne le rendu d'une cellule de la ligne du tableau
1460
+ @parm, rowData, object, la ligne à afficher le rendu du contenu
1461
+ @param , rowInidex, l'indice de la ligne dont on affiche le rendu en cours
1462
+ @param, columnDef, l'objet colonne dont on veut afficher le rendu pour la ligne
1463
+ @param, columnField, le nom du champ correspondant à la cellule,
1464
+ //l'objet data peut être un tableau de type string si et seulement si, le tableau dispose d'une seule colonnne
1465
+ //le formatteur de cellule, peut être :
1466
+ soit une fonction, soit une promesse.
1467
+ qu'il s'agisse d'une fonction où d'une promesse, la valeur retournée est un composant react
1468
+ quant il s'agit d'une fonction, celle-ci se doit de retourner toujours un composant react
1469
+ différent du td d'un table et ne doit pas être un TableColumn de md
1470
+ */
1471
+ renderRowCell (arg){
1472
+ let {rowData,rowKey,handleSelectableColumn,rowIndex,index,rowCounterIndex,columnDef,columnField} = arg;
1473
+ rowIndex = isDecimal(rowIndex)? rowIndex : isDecimal(index)? index : undefined;
1474
+ rowCounterIndex = isDecimal(rowCounterIndex) ? rowCounterIndex : isDecimal(rowIndex)? rowIndex+1 : defaultDecimal(rowCounterIndex);
1475
+ if(!isObj(rowData)) return {render:null,extra:{}};
1476
+ let _render = null;
1477
+ columnDef = defaultObj(columnDef);
1478
+ if(this.isSelectableColumn(columnDef,columnField)){
1479
+ rowKey = rowKey ? rowKey : this.getRowKey(rowData,rowIndex);
1480
+ return {render :handleSelectableColumn === false ? null : this.renderSelectableCheckboxCell({
1481
+ ...arg,
1482
+ rowKey,
1483
+ rowData,
1484
+ checked : this.isRowSelected(rowKey,rowIndex),
1485
+ rowsRefs : this.selectedRowsRefs,
1486
+ onChange : ({checked})=>{
1487
+ this.handleRowToggle({row:rowData,rowData,rowIndex,rowKey,selected:checked})
1488
+ }
1489
+ }),style:{},extra:{style:{}}};
1490
+ } else if(columnField == this.getIndexColumnName()){
1491
+ return {render : rowCounterIndex.formatNumber(),style:{},extra:{}};
1492
+ }
1493
+ let renderProps = undefined;
1494
+ if(isObj(columnDef.datagrid)){
1495
+ renderProps = columnDef.datagrid.renderProps;
1496
+ }
1497
+ const style = Object.assign({},StyleSheet.flatten(columnDef.style));
1498
+ if(columnDef.visible === false){
1499
+ style.display = "none";
1500
+ }
1501
+ let extra = {style},renderArgs = arg;
1502
+
1503
+ renderArgs.extra = extra;
1504
+ renderArgs.item = rowData;
1505
+ let key = this.getRowKey(rowData,rowIndex)+"-"+columnField,isTagRender = defaultStr(columnDef.table).toLowerCase().contains("tags");
1506
+ if(isObj(columnDef.datagrid) && isFunction(columnDef.datagrid.render)){
1507
+ _render = columnDef.datagrid.render.call(this,renderArgs);
1508
+ } else if(isFunction(columnDef.multiplicater)){
1509
+ _render = defaultDecimal(columnDef.multiplicater({...renderArgs,value:rowData[columnField]}),rowData[columnField]);
1510
+ } else {
1511
+ _render = rowData[columnField];
1512
+ let _type = defaultStr(columnDef.type).trim().toLowerCase();
1513
+ if(false && _type == 'datafile' && !isFunction(columnDef.render)){
1514
+ columnDef.render = ({rowData,columnField})=>{
1515
+ let v = rowData[columnField];
1516
+ let dF = dataFileManager.get(v);
1517
+ if(dF){
1518
+ return dF.code.toUpperCase();
1519
+ }
1520
+ return isNonNullString(v)? v.toUpperCase() : isArray(v)? v.join(arrayValueSeparator): v;
1521
+ }
1522
+ }
1523
+ if(defaultStr(columnDef.format).toLowerCase() === 'hashtag'){
1524
+ _render = <Hashtag>{_render}</Hashtag>
1525
+ } else if(typeof columnDef.render === "function"){
1526
+ _render = columnDef.render.call(this,renderArgs);
1527
+ } else if(arrayValueExists( _type,["date","date2time","time"]) && isNonNullString(rowData[columnField])){
1528
+ let _dd =DateLib.parse(rowData[columnField],_type === 'time'?DateLib.isoTimeFormat:DateLib.SQLDateFormat);
1529
+ if(DateLib.isDateObj(_dd)){
1530
+ _render = DateLib.format(_dd,(_type === 'time'?DateLib.defaultTimeFormat:DateLib.masks.defaultDate));
1531
+ }
1532
+ if(!_render) _render = rowData[columnField]
1533
+ } else if(arrayValueExists(_type,['switch','checkbox'])){
1534
+ let {checkedLabel,checkedTooltip,uncheckedTooltip,checkedValue,uncheckedLabel,uncheckedValue} = columnDef;
1535
+ checkedLabel = defaultStr(checkedLabel,checkedTooltip,'Désactivé/Désélectionné')
1536
+ uncheckedLabel = defaultStr(uncheckedLabel,uncheckedTooltip,'Activé/Sélectionné')
1537
+ checkedValue = defaultVal(checkedValue,1); uncheckedValue = defaultVal(uncheckedValue,0)
1538
+ let val = defaultVal(rowData[columnField],columnDef.defaultValue,columnDef.value)
1539
+ if(val === checkedValue){
1540
+ _render = checkedLabel;
1541
+ } else _render = uncheckedLabel;
1542
+ } else if(false && arrayValueExists(['piece','selecttabledata','id'],_type)){
1543
+ let _id = rowData[columnField];
1544
+ if(isNonNullString(_id)){
1545
+ let tableName = defaultStr(columnDef.tableName,columnDef.table).toUpperCase();
1546
+ let dbName = defaultStr(columnDef.dbName);
1547
+ if(!dataFileManager.isCommon(dbName) && (columnField == 'code' || _type =='piece')){
1548
+ dbName = defaultStr(rowData.dbId,dbName);
1549
+ tableName = defaultStr(rowData.table,tableName)
1550
+ }
1551
+ dbName = dataFileManager.sanitizeName(dbName,tableName);
1552
+ let pref = "";
1553
+ if(_type !=='piece'){
1554
+ pref = (tableName+"/").rtrim("/")+"/";
1555
+ _id = pref+_id.ltrim(pref);
1556
+ }
1557
+ if(rowData[columnField+"FoundInDB"] === false){
1558
+ let fTitle = "Cet élément n'existe pas en base car n'a pas été trouvé dans un fichier";
1559
+ _render = <Button icon={"database-remove"} title={fTitle}>
1560
+ {rowData[columnField]}
1561
+ </Button>
1562
+ } else {
1563
+ /*_render = <TableLink dbName={dbName} tableName = {tableName} _id = {
1564
+ _id
1565
+ }>{rowData[columnField]}</TableLink>*/
1566
+ }
1567
+ }
1568
+ } else if((_type.contains('select'))){
1569
+ let v1 = rowData[columnField];
1570
+ _render = v1;
1571
+ if(isObjOrArray(columnDef.items)){
1572
+ if(columnDef.multiple){
1573
+ v1 = Object.toArray(v1);
1574
+ _render = "";
1575
+ v1.map((v)=>{
1576
+ for(let i in columnDef.items){
1577
+ let it = columnDef.items[i];
1578
+ if(isObj(it) && defaultStr(it.code,i) == v){
1579
+ _render+=(_render?arrayValueSeparator:"")+defaultStr(it.label,it.text,v);
1580
+ } else if(isNonNullString(it) && i == v){
1581
+ _render+=(_render?arrayValueSeparator:"")+it;
1582
+ }
1583
+ }
1584
+ })
1585
+ if(!_render){
1586
+ _render = v1.join(arrayValueSeparator);
1587
+ }
1588
+ } else {
1589
+ for(let i in columnDef.items){
1590
+ let it = columnDef.items[i];
1591
+ if(isObj(it) && defaultStr(it.code,i) == v1){
1592
+ _render =defaultStr(it.label,it.text,v1);
1593
+ break;
1594
+ } else if(isNonNullString(it) && i == v1){
1595
+ _render = it;
1596
+ break;
1597
+ }
1598
+ }
1599
+ if(!_render) _render = v1;
1600
+ if(isArray(_render)){
1601
+ _render = _render.join(arrayValueSeparator)
1602
+ } else if(isObj(_render)){
1603
+ _render = "";
1604
+ }
1605
+ }
1606
+ }
1607
+ } else if(_type == 'image'){
1608
+ columnDef = defaultObj(columnDef)
1609
+ columnDef = {...columnDef,...defaultObj(columnDef.datagrid)};
1610
+ columnDef.size = defaultDecimal(columnDef.size,50);
1611
+ columnDef.editable = defaultBool(columnDef.editable,false)
1612
+ columnDef.rounded = defaultBool(columnDef.rounded,columnDef.round,true);
1613
+ columnDef.src = rowData[columnField];
1614
+ _render = <Image {...columnDef}/>
1615
+ }
1616
+ if(!_render){
1617
+ _render = rowData[columnField];
1618
+ }
1619
+ if(columnDef.type =="password" && isNonNullString(_render)){
1620
+ let l = Math.max(_render.length,20);
1621
+ _render = "";
1622
+ for(let i=0;i<l;i++){
1623
+ _render+=".";
1624
+ }
1625
+ }
1626
+ if(isArray(_render)){
1627
+ if(isTagRender){
1628
+ let nV = "";
1629
+ _render.map((v1)=>{
1630
+ nV +=(nV?arrayValueSeparator:"")+i18n.lang(v1,v1);
1631
+ })
1632
+ _render = nV;
1633
+ } else {
1634
+ _render = _render.join(arrayValueSeparator);
1635
+ }
1636
+ }
1637
+ }
1638
+ if(_render ===undefined){
1639
+ _render = rowData[columnField];
1640
+ }
1641
+ if(isArray(_render)){
1642
+ _render = _render.join(arrayValueSeparator);
1643
+ } else if(!React.isValidElement(_render) && isPlainObj(_render)){
1644
+ let __r = "";
1645
+ for(let i in _render){
1646
+ __r+= (isObj(_render[i]) && _render[i]? (_render[i].code? _render[i].code:defaultStr(_render[i].label)):(_render[i]))
1647
+ }
1648
+ _render = __r;
1649
+ }
1650
+ if(isFunction(renderProps)){
1651
+ renderProps = renderProps.call(this,renderArgs);
1652
+ }
1653
+ if(isDecimal(_render)){
1654
+ let fmat = defaultStr(columnDef.format).toLowerCase();
1655
+ if(fmat == "money"){
1656
+ _render = _render.formatMoney();
1657
+ } else if(fmat =="number") {
1658
+ _render = _render.formatNumber();
1659
+ }
1660
+ }
1661
+ if(_render && isObj(renderProps)){
1662
+ let Component = defaultVal(renderProps.Component,Label);
1663
+ delete renderProps.Component;
1664
+ _render = <Component {...renderProps}>{_render}</Component>
1665
+ }
1666
+ if(typeof _render ==='string' || typeof _render =='decimal'){
1667
+ _render = <Label selectable>{_render}</Label>
1668
+ }
1669
+ _render = React.isValidElement(_render)|| Array.isArray(_render)?_render:null;
1670
+ return {render:_render,style,extra,key};
1671
+ }
1672
+ static LinesProgressBar (props){
1673
+ return <DatagridContentLoader {...props}/>
1674
+ }
1675
+ static LineProgressBar (props){
1676
+ return CommonDatagridComponent.LinesProgressBar(props);
1677
+ }
1678
+ }
1679
+
1680
+ export const ProgressBar = CommonDatagridComponent.LinesProgressBar;
1681
+
1682
+ ///cette fonction permet de retourner le nom de la base de données à utiliser pour la récupération des données
1683
+ export const getDBName = CommonDatagridComponent.getDBName = (arg)=>{
1684
+ if(isNonNullString(arg)){
1685
+ arg = {dbName:arg};
1686
+ }
1687
+ arg = defaultObj(arg);
1688
+ let {dbName} = arg;
1689
+ if(typeof (dbName) =='function'){
1690
+ dbName = dbName(arg)
1691
+ }
1692
+ return defaultStr(dbName);
1693
+ }
1694
+
1695
+ CommonDatagridComponent.getDefaultPreloader = (props)=>{
1696
+ return <Preloader {...defaultObj(props)}/>
1697
+ }
1698
+
1699
+ CommonDatagridComponent.propTypes = {
1700
+ canMakePhoneCall : PropTypes.bool,//si l'on peut faire un appel sur la données sélectionnées
1701
+ makePhoneCallProps : PropTypes.oneOfType([
1702
+ PropTypes.object,
1703
+ PropTypes.func,
1704
+ ]),
1705
+ isLoading : PropTypes.bool,///si les données sont en train d'être chargées
1706
+ session : PropTypes.bool, /// si les données de sessions seront persistées
1707
+ exportTableProps : PropTypes.oneOfType([
1708
+ PropTypes.object,
1709
+ PropTypes.object,
1710
+ ]),
1711
+ /*** si l'opérateur or de filtre est accepté */
1712
+ filterOrOperator : PropTypes.bool,
1713
+ /*** si l'opérateur and de filtre est accepté */
1714
+ filterAndOperator : PropTypes.bool,
1715
+ /**** les actions qui s'appliquent lorsqu'une où plusieurs lignes sont sélectionnées */
1716
+ selectedRowsActions : PropTypes.oneOfType([PropTypes.object,PropTypes.array,PropTypes.func]),
1717
+ /** Les actions de la barre d'outil du datagrid : il peut s'agit d'une fonction qui lorsqu'elle est appelée retourne l'ensemble des actions du datagrid
1718
+ * La fonction prend en paramètre :
1719
+ * selectedRows : this.selectedRows : les lignes sélectionnées
1720
+ data : this.state.data : les données du datagrid
1721
+ rows : this.state.data : les données du datagrid
1722
+ allData : this.INITIAL_STATE.data : l'ensemble des données du datagrid
1723
+ mobile : bool si le rendu est fait en environnement mobile ou non
1724
+ props : {} les props passés au composant
1725
+ selected : true|| false //bolean pour spécifier s'il s'agit du rendu des actions des lignes sélectionnées
1726
+ *
1727
+ */
1728
+ actions : PropTypes.oneOfType([PropTypes.object,PropTypes.array,PropTypes.func]), //idem à selectedRowsActions
1729
+ /*** spécifie si les filtres seront affichés */
1730
+ filters : PropTypes.oneOfType([
1731
+ PropTypes.bool,
1732
+ PropTypes.object,
1733
+ ]),
1734
+ /*** affiche ou masque les filtres */
1735
+ showFilters : PropTypes.bool,
1736
+ /*** si le pied de page sera affiché */
1737
+ showFooter : PropTypes.bool,
1738
+ /*** les donnnées peuvent être soient retournées par une fonction, soit par un tableau soit une promesse */
1739
+ data : PropTypes.oneOfType([PropTypes.array, PropTypes.func,PropTypes.object]),//.isRequired,
1740
+ columns:PropTypes.oneOfType([PropTypes.array,PropTypes.object]),//.isRequired,
1741
+ selectable : PropTypes.bool, //si les lignes sont sélectionnables,
1742
+ /*** Si plusieurs lignes peuvent être sélectionnées au même moment */
1743
+ selectableMultiple : PropTypes.bool,
1744
+ showPagination : PropTypes.bool, //la pagination est toujours affichée
1745
+ showPaginationOnTop:PropTypes.bool, //si la pagination sera affiché en haut du tableau,
1746
+ pagin : PropTypes.bool,
1747
+ paginate : PropTypes.bool,
1748
+ sortable : PropTypes.bool,//si le tableau pourra être trié
1749
+ onRowSelected : PropTypes.func, //lorsqu'une ligne est sélectionnée
1750
+ onRowsSelected : PropTypes.func, // lorsque toutes les lignes du tableau sont sélectionnées
1751
+ onRowDeselected : PropTypes.func, //lorsqu'une ligne est désélectionnée
1752
+ onRowsDeselected : PropTypes.func,//lorsque toutes les lignes du datagrid sont désélectionnées
1753
+ onRowDoubleClick : PropTypes.func,//évènement appelé en cas de double clic sur la ligne
1754
+ onRowPress : PropTypes.func, //évènement appelé lorsqu'on clique sur la ligne
1755
+ column : PropTypes.shape({
1756
+ filter_value : PropTypes.any, //la valeur par défaut du champ de filtre de colonne
1757
+ field : PropTypes.string.isRequired,
1758
+ text : PropTypes.string,
1759
+ /*** si le filtre de la colonne sera affiché : default : true*/
1760
+ filter : PropTypes.bool,
1761
+ }),
1762
+ pagination:PropTypes.shape({
1763
+ start: PropTypes.number, //la page initiale : default:1
1764
+ limit: PropTypes.number, //la limite par page
1765
+ rows: PropTypes.number, //le nombre total de ligne dans le tableau
1766
+ page : PropTypes.page,//la page actuelle
1767
+ next: PropTypes.string, //la chaine de caractère pour l'affichage de la page suivante
1768
+ previous: PropTypes.string, //la chaine de caractère pour l'affichage de la page précédente
1769
+ ///....props:PropTypes.object //les props à appliquer à l'objet pagination
1770
+ }),
1771
+ sort : PropTypes.shape({
1772
+ column : PropTypes.string,
1773
+ dir : PropTypes.string,
1774
+ ignoreCase : PropTypes.bool,
1775
+ /****
1776
+ * cette fonction est utilisée pour le rendu de l'item au moment du tri du tableau
1777
+ * @param : obj : l'objet courrant à trier
1778
+ * @param : colunmName : string, le nom de la colonne de trie
1779
+ */
1780
+ getItem : PropTypes.func
1781
+ }),
1782
+ /**** la props filter, permet de filtrer les données qui seront utilisées pour le rendu du composant Dropdown
1783
+ * {row,data,allData}
1784
+ * @param : {
1785
+ * component : string, le composant qui appelle la fonction de filtre : datagrid dans notre cas
1786
+ * props : object : les props du composant qui appelle la fonction
1787
+ * row ou data : la ligne courant,
1788
+ * datas ou allData : l'ensemble des données du datagrid
1789
+ * rowIndex ou index : l'indice de la ligne courante,
1790
+ * items : la liste de tous les items,
1791
+ * index : l'indice de l'item,
1792
+ * _index : le numéro de l'indice : s'il s'agit d'un tableau
1793
+ * ,itemIndex
1794
+ * }
1795
+ *
1796
+ */
1797
+ filter : PropTypes.func,
1798
+ /*** la barre de progression */
1799
+ progressBar : PropTypes.node,
1800
+ /*** fonction permettant de retourner l'unique clé des éléments du tableau */
1801
+ getRowKey : PropTypes.func,
1802
+ ///la fonction utilisée pour l'impression du datagrid
1803
+ print : PropTypes.func,
1804
+ printOptions: PropTypes.object,
1805
+ /*** si le datagrid est imprimable */
1806
+ printable : PropTypes.oneOfType([
1807
+ PropTypes.func,
1808
+ PropTypes.string,
1809
+ PropTypes.bool
1810
+ ]),
1811
+ archive : PropTypes.func,
1812
+ archivable : PropTypes.oneOfType([
1813
+ PropTypes.func,
1814
+ PropTypes.string,
1815
+ PropTypes.bool
1816
+ ]),
1817
+ /*** si le rendu du datagrid est exportable */
1818
+ exportable : PropTypes.bool,
1819
+ baseId : PropTypes.string,
1820
+ mobile: PropTypes.bool,
1821
+ tablet: PropTypes.bool,
1822
+ ///pour l'affichage où non des filtres
1823
+ toggleFilters : PropTypes.bool,
1824
+ desktop: PropTypes.bool,
1825
+ ///les props à apppliquer à l'accordion
1826
+ /**** l'accordion peut rendre un objet ou un objet react ou null
1827
+ * si c'est un objet, alors il peut être de la forme :
1828
+ * {
1829
+ * title : PropTypes.node , //le titre du header
1830
+ * avatar : PropTypes.string(dataUrl,src,other) || PropType.node, ///l'avatar,
1831
+ * rowClassName : la class à appliquer à la ligne
1832
+ * rowProps : les props à appliquer à la ligne de la liste
1833
+ * headerClassName : la class à appliquer au header de la ligne
1834
+ * primaryText : //
1835
+ * primaryTextRigth :
1836
+ * secondaryText :
1837
+ * secondaryTextRight
1838
+ * }
1839
+ */
1840
+ accordion :PropTypes.func,
1841
+ accordionProps : PropTypes.object,
1842
+ /*** pour le rendu du footer, pied de page en affichage accordion */
1843
+ sessionName : PropTypes.string,
1844
+ onFetchData : PropTypes.func,
1845
+ getActionsArgs : PropTypes.func,//fonction permettant de récupérer les props supplémentaires à passer aux actions du datagrid
1846
+ }
1847
+
1848
+ const styles = StyleSheet.create({
1849
+ queryLimit : {
1850
+ fontSize : 16
1851
+ },
1852
+ sortableColumn : {
1853
+ flexDirection : 'row',
1854
+ flex : 1,
1855
+ alignItems : 'center',
1856
+ },
1857
+ sortedColumnIcon : {
1858
+ paddingVertical : 0,
1859
+ paddingHorizontal : 0,
1860
+ marginHorizontal : 0,
1861
+ marginVertical : 0,
1862
+ marginLeft : -10,
1863
+ //paddingRight : 2,
1864
+ //width : 27,
1865
+ },
1866
+ })