@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,1048 @@
1
+ import PropTypes from "prop-types";
2
+ import KeyboardEventHandler from "../KeyboardEventHandler";
3
+ const {getActions,getFormFields,Forms} = require("../utils")
4
+ import TextField,{parseDecimal} from "$ecomponents/TextField";
5
+ import Icon from "$ecomponents/Icon";
6
+ import {extendObj,isBool,isUndefined,uniqid,defaultObj,isObj,defaultFunc,isFunction,isNumber,arrayValueExists,defaultVal,defaultStr,isNonNullString,defaultBool,defaultDecimal} from "$utils";
7
+ import {Component as AppComponent} from "$react";
8
+ import {observable,addObserver} from "$observable";
9
+ import {Validator} from "$validator";
10
+ import theme,{grid} from "$theme";
11
+ import React from "$react";
12
+ import {StyleSheet} from "react-native";
13
+ import {isDevEnv} from "$cplatform";
14
+ import {isMobileMedia} from "$cplatform/dimensions";
15
+ import APP from "$capp/instance";
16
+ ///la combinaison à appliquer pour modifier le contenu textuel de la valeur
17
+ let sanitizeKeyEvent = 'ctrl+m' //le type hashtag
18
+ import defaultKeyboardEvents from "../utils/keyboardEvents";
19
+ import sprintf from "./sprintf";
20
+ import ErrorMessage from "$ecomponents/ErrorBoundary/ErrorMessage";
21
+ import { UPPER_CASE, LOWER_CASE} from "$common/lib/validator";
22
+
23
+
24
+ export default class Field extends AppComponent {
25
+ constructor(props) {
26
+ super(props);
27
+ observable(this);
28
+ addObserver(this);
29
+ extendObj(this._events,{
30
+ validatorBeforeValidate : this.validatorBeforeValidate.bind(this),
31
+ validatorValid : this.onValidate.bind(this),
32
+ validatorNoValid : this.onNoValidate.bind(this)
33
+ })
34
+ let {
35
+ name,
36
+ field,
37
+ formName,
38
+ beforeValidate,
39
+ onValidate,
40
+ onNoValidate,
41
+ validType,
42
+ validRule,
43
+ length,
44
+ minLength,
45
+ required,
46
+ renderfilter,
47
+ render_filter,
48
+ maxLength,
49
+ validParams,
50
+ } = props;
51
+ Object.defineProperties(this,{
52
+ __disabledSymbol : {value : Symbol('_disabled'),override:false,writable:false},
53
+ __isDisabledSymbol : { value : Symbol('_isDisabled'),override:false,writable:false},
54
+ __isReadOnlySymbol : { value : Symbol('_isReadOnly'),override:false,writable:false},
55
+ isEnabled : {
56
+ value : ()=>{
57
+ return !this.isDisabled();
58
+ },override : false, writable : false
59
+ },
60
+ isFilter : {
61
+ value : ()=>defaultVal(renderfilter,render_filter) ? true : false,override : false,writable : false,
62
+ },
63
+ isReadOnly : {
64
+ value : ()=>{
65
+ return this[this.__isReadOnlySymbol] == true;
66
+ },override : false, writable : false
67
+ },
68
+ isEditable : {
69
+ value : x=> this.isReadOnly(), override : false, writable : false,
70
+ },
71
+ isDisabled : {
72
+ value : ()=>{
73
+ return this[this.__isDisabledSymbol] === true;
74
+ }, override : false,writable : false
75
+ }
76
+ /*** désactive le champ */
77
+ ,disable : {
78
+ value : ()=>{
79
+ this[this.__disabledSymbol] = true;
80
+ this.setState({_sKey:!this.state._sKey})
81
+ }, override : false, writable : false
82
+ }
83
+ /**** active le champ */
84
+ ,enable : {
85
+ value : () => {
86
+ this[this.__disabledSymbol] = false;
87
+ this.setState({_sKey:!this.state._sKey});
88
+ }, override : false, writable : false
89
+ },
90
+ /** si la valeur valide à retourner par le field est de type decimal */
91
+ canValueBeDecimal : {
92
+ value : this.isTextField() && arrayValueExists(['number','decimal'],this.props.type)
93
+ ,override : false, writable : false
94
+ },
95
+ wrapperRef : {
96
+ value : React.createRef(null),
97
+ },
98
+ })
99
+
100
+ name = defaultStr(name,field,uniqid("form-data-field-name"));
101
+ Object.defineProperties(this,{
102
+ INITIAL_STATE : {
103
+ value : {formName},
104
+ override : false,
105
+ writable : false
106
+ }
107
+ })
108
+ validType = defaultVal(validType,validRule);
109
+ if(required && (isNonNullString(validType) || validType == null || validType ==undefined || validType === "")){
110
+ validType = isNonNullString(validType)?validType : '';
111
+ validType = validType.contains("required")? validType : ('required|'+validType)
112
+ }
113
+
114
+ if(isNonNullString(validType) || validType == "" || validType == null || validType ==undefined){
115
+ if(!isNonNullString(validType)) validType = "";
116
+ if(isNumber(length) && length>0){
117
+ if(validType.indexOf('length') === -1){
118
+ validType="length["+length+"]"+"|"+validType.trim().ltrim("|");
119
+ }
120
+ maxLength = length;
121
+ }
122
+ if(isNumber(minLength) && minLength > 0){
123
+ if(validType.indexOf('minLength') === -1){
124
+ validType+="|minLength["+minLength+"]"
125
+ }
126
+ }
127
+ if(isNumber(maxLength) && maxLength>0){
128
+ if(validType.indexOf('maxLength') === -1){
129
+ validType+="|maxLength["+maxLength+"]"
130
+ }
131
+ }
132
+ if(this.props.upper === true || this.props.upperCase === true){
133
+ validType +="|"+UPPER_CASE;
134
+ } else if(this.props.lower === true || this.props.lowerCase === true){
135
+ validType +="|"+LOWER_CASE;
136
+ }
137
+ }
138
+ this.INITIAL_STATE.validType = this.INITIAL_STATE.validRule = validType;
139
+ this.INITIAL_STATE.validParams = validParams;
140
+ Object.defineProperties(this.INITIAL_STATE,{
141
+ beforeValidate : {
142
+ value : defaultFunc(beforeValidate),override : false,
143
+ },
144
+ onValidate : {
145
+ value : defaultFunc(onValidate),override : false,
146
+ },
147
+ onNoValidate : {
148
+ value : defaultFunc(onNoValidate),override : false,
149
+ },
150
+ })
151
+ if(!this.isValidRuleDynamic()){
152
+ Object.defineProperties(this.INITIAL_STATE,{
153
+ validType : {value:validType,override:false},
154
+ validRule : {value:validType,override:false},
155
+ validParams : {value:validParams,override:false},
156
+ })
157
+ }
158
+ Object.defineProperties(this,{
159
+ name : {value:name,override:false,writable:false},
160
+ formName : {value:formName,override:false,writable : false},
161
+ canValidate : {value : defaultVal(props.validate,true),override:false,writable:false},
162
+ })
163
+ if(this.canValidate !== false){
164
+ Forms.trigger("registerField",name,formName,this);
165
+ this.initObservers();
166
+ }
167
+ this.state.errorText = null;
168
+ this.state.error = false;
169
+ this.autobind();
170
+ this.keybaordEvents = [sanitizeKeyEvent];
171
+ Object.map(this.props.keyboardEvents,(k,i)=>{
172
+ if(!defaultKeyboardEvents[k]){
173
+ this.keybaordEvents.push(k);
174
+ }
175
+ })
176
+ this.state.validatingValue = this.validatingValue = defaultVal(this.props.defaultValue);
177
+ this.keybaordEvents = [...Object.keys(defaultKeyboardEvents),...this.keybaordEvents]
178
+ this.state.isMobile = isMobileMedia();
179
+ this.state.textFieldMode = theme.textFieldMode;
180
+ }
181
+ validatorBeforeValidate({value,validRule,validParams,event,...rest}){
182
+ let _result = undefined;
183
+ this.trigger.call(this,"beforeValidate",{...defaultObj(rest),value,name:this.name,field:this.name,formName:this.formName,context:this,event,validRule,validParams},(result)=>{
184
+ for(var r in result){
185
+ if(result[r] === false) {
186
+ _result = false;
187
+ return context;
188
+ }
189
+ }
190
+ this.INITIAL_STATE.beforeValidate.call(this,{...defaultObj(rest),value,name:this.name,field:this.name,formName:this.formName,context:this,event,validRule,validParams});
191
+ });
192
+ return _result;
193
+ }
194
+ /*** si le composant devra prendre en compte les props width et height */
195
+ canHandleWidthOrHeightProps(){
196
+ return false;
197
+ }
198
+ callOnChange(args){
199
+ if(typeof this.props.onChange === "function" && this.hasValueChanged(args.value)){
200
+ this.props.onChange(args);
201
+ }
202
+ }
203
+ onValidate ({value,event,...rest}){
204
+ this.trigger.call(this,"validate",{...defaultObj(rest),value,event},(result)=>{
205
+ for(var j in result){
206
+ if(result[j] === false) return this;
207
+ }
208
+ this.validatingValue = value;
209
+ this.INITIAL_STATE._lastValidatingValue = value;
210
+ this.setState ({validValue:value,validatingValue:value,previousValue:this.state.validValue,errorText:"",error:false},()=>{
211
+ this._previousValue = this.state.validValue;
212
+ let fields = getFormFields(this.formName);
213
+ let canEnable = true;
214
+ for(var k in fields){
215
+ if(!fields[k].isValid()){
216
+ canEnable = false;
217
+ break;
218
+ }
219
+ }
220
+ let actions = getActions(this.formName);
221
+ let action = canEnable?"enable":"disable";
222
+ for(var k in actions){
223
+ actions[k][action]();
224
+ }
225
+ let form = Forms.getForm(this.formName);
226
+ this.INITIAL_STATE.onValidate.call(this,{...defaultObj(rest),props:this.props,formName:this.formName,form,name:this.name,field:this.name,value,event,context:this});
227
+ this.callOnChange({value,event,isValid:true,...rest});
228
+
229
+ if(form && form.props){
230
+ if(canEnable){
231
+ if(isFunction(form.props.onValidate)){
232
+ form.props.onValidate.call(form,{...defaultObj(rest),formName:this.formName,data:form.getData(),context:form,fieldInstance:this,field:this.name,name:this.name,value,event,form})
233
+ }
234
+ }
235
+ if(isFunction(form.props.onValidateField)){
236
+ form.props.onValidateField.call(form,{...defaultObj(rest),formName:this.formName,context:this,form,name:this.name,field:this.name,value,form,event})
237
+ }
238
+ }
239
+ });
240
+ });
241
+ }
242
+ onValidatorValid(args){
243
+ if(isFunction(this.props.onValidatorValid)){
244
+ return this.props.onValidatorValid(args);
245
+ }
246
+ return true;
247
+ }
248
+ onNoValidate({msg,value,context,validRule,validParams,event,...rest}){
249
+ this.validatingValue = value;
250
+ this.trigger.call(this,"noValidate",{...defaultObj(rest),props:this.props,context:this,msg,value,event,validRule,validParams},(result)=>{
251
+ this.setState({
252
+ errorText : msg,
253
+ invalidValue : value,
254
+ validatingValue : value,
255
+ error : true
256
+ },()=>{
257
+ const actions = getActions(this.formName);
258
+ for(var k in actions){
259
+ actions[k].disable();
260
+ }
261
+ this.INITIAL_STATE.onNoValidate.call(this,{...defaultObj(rest),props:this.props,msg,value,formName:this.formName,field:this.name,name:this.name,context:this,event,validRule,validType:validRule,validParams,context:this});
262
+ let form = Forms.getForm(this.formName);
263
+ this.callOnChange({value,validRule,validParams,event,isValid:false,...rest});
264
+ if(form){
265
+ if(form.props && isFunction(form.props.onNoValidate)){
266
+ form.props.onNoValidate.call(form,{...defaultObj(rest),formName:this.formName,fieldInstance:this,name:this.name,field:this.name,value,msg,validRule,validParams,event,context:form});
267
+ }
268
+ }
269
+ })
270
+ });
271
+ }
272
+ canRenderInlineIndicator(){
273
+ return true;
274
+ }
275
+ initObservers (){
276
+ for(let i in this._events){
277
+ this.on(i,this._events[i]);
278
+ }
279
+ }
280
+ /*** retourne l'instance de la form */
281
+ getForm(){
282
+ return Forms.getForm(this.formName);
283
+ }
284
+ ///retourne l'instance d'un champ autre que celui actuel
285
+ /// si le fieldName n'est pas définit alors on retourne l'instance du field actuel
286
+ getField (fieldName){
287
+ if(!isNonNullString(fieldName)) return this;
288
+ let form = this.getForm();
289
+ if(form && isFunction(form.getField)){
290
+ return form.getField(fieldName);
291
+ }
292
+ return null;
293
+ }
294
+
295
+ setRef (el){
296
+ if(el) this._fieldRef = el;
297
+ }
298
+ isFocused(){
299
+ const field = this.getFieldRef();
300
+ if(isObj(field) && typeof field.isFocused =="function"){
301
+ return field.isFocused();
302
+ }
303
+ return false;
304
+ }
305
+ getFieldRef (){
306
+ return this.___formattedField || this._fieldRef;
307
+ }
308
+ onRegister(field,name){}
309
+ getName (){
310
+ return this.name;
311
+ }
312
+ getFormName(){
313
+ return this.formName;
314
+ }
315
+ getOldValue () {
316
+ return this._previousValue;
317
+ }
318
+ /*** la valeur qui a été validée
319
+ * @param : l'ensemble des données du formulaire à retourner
320
+ * Ce paramètre est utile pour étendre les données validées du formulaire avec certaines données qui ne
321
+ * sont pas par défaut définies comme champ de formulaire
322
+ */
323
+ parseDecimal(v){
324
+ return parseDecimal(v,defaultStr(this.props.type,this.type));
325
+ }
326
+ getInvalidValue(){
327
+ return this.state.invalidValue;
328
+ }
329
+ getValidValue (data){
330
+ let v = this.state.validValue;
331
+ if(isFunction(this.props.getValidValue)){
332
+ let v1 = this.props.getValidValue.call(this,{data,context:this,props:this.props});
333
+ if(v1 !== undefined){
334
+ v = v1;
335
+ }
336
+ }
337
+ return this.parseDecimal(v);
338
+ }
339
+ canFocus(){
340
+ return true;
341
+ }
342
+ getComponentProps (props){
343
+ return defaultObj(props,this.props);
344
+ }
345
+ isFocused(){
346
+ let f = this.getFieldRef();
347
+ if(!f) return undefined;
348
+ if(typeof f.isFocused ==='function') return f.isFocused();
349
+ return undefined;
350
+ }
351
+ /*** pour focus le champ
352
+ * Ajout de la méthode focus, aux FormField pour focus le champ en cas de changement
353
+ * @return : vrai si l'élément a été focus et faux au cas contraire
354
+ */
355
+ focus (activate){
356
+ if(this.isDisabled() || this.isReadOnly() || !this.canFocus()){
357
+ return false;
358
+ }
359
+ let f = this.getFieldRef();
360
+ if(f && activate !== false){
361
+ if(typeof f.isFocused ==='function' && f.isFocused()) return true;
362
+ if(typeof f.focus ==='function'){
363
+ try {
364
+ f.focus();
365
+ return true;
366
+ } catch(e){
367
+ if(isDevEnv() )console.log(e," focusing field ",this.name)
368
+ }
369
+ }
370
+ return false;
371
+ }
372
+ return false;
373
+ }
374
+ /*** retourne le prochain élement et le suivant au field dans l'ensemble des fields de la form
375
+ * si la valeur du prochainFormField est égale au précédent
376
+ * @return ({keys,count:keys.length,fields,first,last,next,previous})
377
+ */
378
+ getPrev2NextFields(){
379
+ let form = this.getForm();
380
+ let next = null,nextIndex=-1,index=-1,previousIndex=-1,first,last = null,previous = null,keys=[],fields={};
381
+ if(form && isFunction(form.getFields) ){
382
+ fields = form.getFields();
383
+ if(isObj(fields)){
384
+ keys = Object.keys(fields);
385
+ first = fields[keys[0]];
386
+ last = fields[keys[keys.length-1]];
387
+ for(let f in fields){
388
+ index++;
389
+ if(fields[f] === this){
390
+ break;
391
+ }
392
+ }
393
+ if(index>= 0){
394
+ previousIndex = index-1
395
+ nextIndex = index+1;
396
+ previous = fields[keys[previousIndex]];
397
+ next = fields[keys[nextIndex]]
398
+ }
399
+ }
400
+ }
401
+ return {index,keys,count:keys.length,fields,nextIndex,previousIndex,first,last,next,previous}
402
+ }
403
+ setValue (val,focus,rest){
404
+ if(isObj(focus)){
405
+ let t = rest;
406
+ rest = focus;
407
+ focus = t;
408
+ }
409
+ if(typeof focus !== 'boolean'){
410
+ focus = false;
411
+ }
412
+ if(val == undefined || val =='undefined'){
413
+ val = '';
414
+ }
415
+ this.validate({...defaultObj(rest),value:val});
416
+ return val;
417
+ }
418
+ getValue (){
419
+ return this.validatingValue;
420
+ }
421
+ getDefaultValue (){
422
+ return defaultVal(this.getComponentProps(this.props).defaultValue,this.props.defaultValue);
423
+ }
424
+ isSelectField(){
425
+ return false;
426
+ }
427
+ getPreviousValue (){
428
+ return this._previousValue;
429
+ }
430
+ hasValueChanged(value){
431
+ return (JSON.stringify(this.state.previousValue) === JSON.stringify(value))? false : true;
432
+ }
433
+ isValidRuleDynamic(){
434
+ return false;
435
+ }
436
+ setValidRule(validRule){
437
+ if(this.isValidRuleDynamic()){
438
+ this.INITIAL_STATE.validRule = this.INITIAL_STATE.validType = validRule;
439
+ }
440
+ }
441
+ getValidRule(){
442
+ return this.INITIAL_STATE.validRule;
443
+ }
444
+ validate ({value,event,...rest}){
445
+ value = this.parseDecimal(value);
446
+ this.validatingValue = value;
447
+ if((!this.canValidate) && !this.isSelectField()){
448
+ if(this._isInitialized && !this.hasValueChanged(value)) {
449
+ return;
450
+ }
451
+ this._isInitialized = true;
452
+ this._previousValue = this.state.validValue;
453
+ this.trigger("validate",{...defaultObj(rest),context:this,value,event,oldValue:this.INITIAL_STATE._lastValidatingValue},(results)=>{
454
+ this.setState({validValue:value,validatingValue:value,sk:!this.state.sk,previousValue:this.state.validValue},()=>{
455
+ if(isFunction(this.props.onValidate)){
456
+ this.props.onValidate({...defaultObj(rest),props:this.props,name:this.name,field:this.name,value,event,context:this,oldValue:this.INITIAL_STATE._lastValidatingValue});
457
+ }
458
+ if(isFunction(this.props.onChange)){
459
+ this.props.onChange({value,previousValue:this.INITIAL_STATE._lastValidatingValue,event});
460
+ }
461
+ this.INITIAL_STATE._lastValidatingValue = value;
462
+ })
463
+ });
464
+ return;
465
+ }
466
+ const validRule = this.getValidRule();
467
+ if(this.isValidRuleDynamic()){
468
+ this.INITIAL_STATE.validRule = this.INITIAL_STATE.validType = validRule;
469
+ }
470
+ Validator.validate({...defaultObj(rest),onValidatorValid:this.onValidatorValid.bind(this),context:this,value,validRule,validType:validRule,validParams:this.INITIAL_STATE.validParams,event})
471
+ }
472
+
473
+ /**** met le focus sur l'élément précédent */
474
+ focusPrevField (){
475
+ return;
476
+ let ob = this.getPrev2NextFields();
477
+ let {previous} = ob;
478
+ let focus = false;
479
+ let canGoToNext = true;
480
+ while(canGoToNext && previous){
481
+ focus = previous.focus();
482
+ canGoToNext = previous && !focus;
483
+ if(canGoToNext){
484
+ ob = previous.getPrev2NextFields();
485
+ previous = ob.previous;
486
+ }
487
+ if(focus){
488
+ this.trigger("blur");
489
+ }
490
+ }
491
+ return ob;
492
+ }
493
+ sprintf(){
494
+ if(this.isDisabled() || this.isReadOnly()) return this;
495
+ sprintf({value:this.getValue(),cb:(val)=>{
496
+ this.setValue(APP.sprintf(val),true);
497
+ }});
498
+ }
499
+ /**** met le focus sur le prochain cham */
500
+ focusNextField (){
501
+ return;
502
+ let ob = this.getPrev2NextFields();
503
+ let {next} = ob;
504
+ let focus = false;
505
+ let canGoToNext = true;
506
+ while(canGoToNext && next){
507
+ focus = next.focus();
508
+ canGoToNext = next && !focus;
509
+ if(canGoToNext){
510
+ ob = next.getPrev2NextFields();
511
+ next = ob.next;
512
+ }
513
+ if(focus){
514
+ this.trigger("blur");
515
+ }
516
+ }
517
+ return ob;
518
+ }
519
+ componentDidUpdate(){
520
+ super.componentDidUpdate();
521
+ if(typeof this.props.updateNativePropsOnUpdate ==='function'){
522
+ this.props.updateNativePropsOnUpdate({
523
+ target : this.wrapperRef,
524
+ props : this.props,
525
+ });
526
+ }
527
+ }
528
+ componentDidMount (validate){
529
+ super.componentDidMount();
530
+ this.mediaQueryPropsSubscription = React.getMediaQueryPropsSubscription(this.mediaQueryUpdateNativeProps.bind(this),this.wrapperRef);
531
+ if(this.canValidate !== false){
532
+ Forms.trigger("registerField",this.getName(),this.getFormName(),this);
533
+ }
534
+ if(defaultVal(validate,true) && !this.isFilter()) this.validate({context:this,value:defaultVal(this.props.defaultValue)});
535
+ }
536
+ componentWillUnmount() {
537
+ super.componentWillUnmount();
538
+ this._fieldRef = undefined;
539
+ this.offAll();
540
+ this.clearEvents();
541
+ if(this.mediaQueryPropsSubscription){
542
+ this.mediaQueryPropsSubscription.remove();
543
+ }
544
+ if(this.canValidate !== false){
545
+ Forms.trigger("unregisterField",this.getName(),this.getFormName());
546
+ }
547
+ }
548
+ isHtml(){
549
+ return false;
550
+ }
551
+ mediaQueryUpdateNativeProps(args){
552
+ const {isMobile} = args;
553
+ if(typeof this.props.mediaQueryUpdateNativeProps =='function'){
554
+ args.props = this.props;
555
+ args.context = this;
556
+ return this.props.mediaQueryUpdateNativeProps(args);
557
+ }
558
+ const hasTextFieldModeChanged = this.state.textFieldMode !== theme.textFieldMode && this.state.isMobile !== isMobile;
559
+ if(this.props.responsive === false && !hasTextFieldModeChanged) return;
560
+ if((hasTextFieldModeChanged)){
561
+ this.setState({isMobile,textFieldMode:theme.textFieldMode});
562
+ return null;
563
+ }
564
+ return {style:grid.col(this.props.windowWidth)};
565
+ }
566
+ onKeyEvent(key,event){
567
+ let form = this.getForm();
568
+ if(!this.canValidate) return;
569
+ let {keyboardEvents,onKeyEvent} = this.props;
570
+ let formInstance = this.getForm();
571
+ let arg = {key,event,context:this,isFormField:true,formInstance};
572
+ let handler = undefined;
573
+ if(isObj(keyboardEvents)){
574
+ handler = keyboardEvents[key];
575
+ if(isFunction(handler) && handler.call(this,arg) === false) return;
576
+ }
577
+ if(!isFunction(handler)){
578
+ if(isFunction(keyboardEvents)){
579
+ handler = keyboardEvents;
580
+ } else if(isFunction(onKeyEvent)){
581
+ handler = onKeyEvent;
582
+ }
583
+ if(isFunction(handler) && handler.call(this,arg) === false) return;
584
+ }
585
+ handler = undefined;
586
+ if(formInstance && isObj(formInstance.props)){
587
+ let pIP = formInstance.props;
588
+ if(isObj(pIP.keyboardEvents)){
589
+ handler = pIP.keyboardEvents[key];
590
+ if(isFunction(handler)) handler.call(this,arg);
591
+ }
592
+ if(!isFunction(handler)){
593
+ if(isFunction(pIP.keyboardEvents)){
594
+ handler = pIP.keyboardEvents;
595
+ } if(isFunction(pIP.onKeyEvent)){
596
+ handler = pIP.onKeyEvent;
597
+ }
598
+ if(isFunction(handler)) handler.call(this,arg);
599
+ }
600
+ }
601
+ switch(key){
602
+ case 'down':
603
+ this.focusNextField();
604
+ break;
605
+ case 'left':
606
+ this.focusPrevField();
607
+ break;
608
+ case 'right':
609
+ this.focusNextField();
610
+ break;
611
+ case 'up':
612
+ this.focusPrevField();
613
+ break;
614
+ case 'enter' :
615
+ if(!form) return this;
616
+ break;
617
+ let {next,nextIndex,count} = this.focusNextField();
618
+ if(!next){
619
+ /**** on a atteind le dernier elément, l'on doit demander à l'enregistrement du formulaire */
620
+ if(nextIndex >= count){
621
+ let fields = form.getFields();
622
+ let canSubmit = true;
623
+ if(isObj(fields)){
624
+ for(var j in fields){
625
+ let field = fields[j];
626
+ if(field && !field.isValid()){
627
+ canSubmit = false;
628
+ ///on met le focus sur le prochain élément non valide
629
+ if(field.focus()){
630
+ break;
631
+ }
632
+ }
633
+ }
634
+ }
635
+ if(canSubmit && form.props && form.props.onSubmit) {
636
+ //le formulaire peut être envoyé maintenant
637
+ form.props.onSubmit.call(form,{data:form.getData(),context:form,currentField:this})
638
+ }
639
+ }
640
+ }
641
+ break;
642
+ default :
643
+ if(key === sanitizeKeyEvent){
644
+ this.sprintf();
645
+ return false;
646
+ }
647
+ break;
648
+ }
649
+ }
650
+
651
+ canBindResizeEvent(){
652
+ return true;
653
+ }
654
+ /*** appelée pour la mise à jour du layout state */
655
+ getLayoutState(){}
656
+ updateLayout(event){
657
+ if(!this.canBindResizeEvent()) return;
658
+
659
+ }
660
+
661
+ isValid (){
662
+ return !this.state.error ? true : false;
663
+ }
664
+ /*** cette méthode a été ajouté pour qu'à partir de certains composant Field, l'on puisse apporter des modification
665
+ * aux props immédiatement avant qu'elles soient passé au composant requis
666
+ */
667
+ removeNotAllowedProps(props){
668
+ return props;
669
+ }
670
+ isTextField(){
671
+ return true;
672
+ }
673
+ onBlurField(event){
674
+ if(isFunction(this.props.onBlur)){
675
+ this.props.onBlur({event,context:this})
676
+ }
677
+ }
678
+ onFocusField(event){
679
+ if(isFunction(this.props.onFocus)){
680
+ this.props.onFocus({event,context:this})
681
+ }
682
+ }
683
+ _render (props){
684
+ const {defaultValue} = props;
685
+ return <TextField
686
+ {...props}
687
+ value = {defaultValue}
688
+ />
689
+ }
690
+
691
+ getCallFuncArgs(){
692
+ let data = defaultObj(this.props.data);
693
+ return {
694
+ context:this,
695
+ windowResized:APP.windowHasResized,
696
+ field:this.name,
697
+ name:this.name,
698
+ ...this.props,
699
+ data,
700
+ props:this.props
701
+ }
702
+ }
703
+ UNSAFE_componentWillReceiveProps(nextProps,b,c){
704
+ if(super.UNSAFE_componentWillReceiveProps && super.UNSAFE_componentWillReceiveProps(nextProps,b,c) === false) return;
705
+ if("defaultValue" in nextProps){
706
+ const value = this.parseDecimal(nextProps.defaultValue);
707
+ if(this.isValidRuleDynamic()){
708
+ this.setState({sk:!this.state.sk},()=>{
709
+ this.validate({value})
710
+ })
711
+ } else {
712
+ this.validate({value});
713
+ }
714
+ }
715
+ }
716
+ ///si la props right peut être une fonction
717
+ canRightPropsBeFunction(){
718
+ //typeof customRight =='function' || _type =='date' || _type =='time' || _type =='text' || _type=='number' || _type =='decimal' || _type.contains('select')
719
+ return true;
720
+ }
721
+ getErrorText(includeLabel){
722
+ const label = defaultStr(this.label,this.name);
723
+ if(!isNonNullString(this.state.errorText)) return "";
724
+ if(label){
725
+ return this.state.errorText+(includeLabel !== false?(" ["+label+"]"):"");
726
+ } else {
727
+ return this.state.errorText;
728
+ }
729
+ }
730
+
731
+ render (){
732
+ let {
733
+ data,onKeyEvent,
734
+ keyboardEvents,
735
+ required,
736
+ validRule,
737
+ validType,value,selected,label,text,
738
+ getProps,
739
+ formName,
740
+ datagrid,
741
+ form,
742
+ format,
743
+ validParams,
744
+ //renderfilter, //pour spécifier que c'est un rendu de type filtre
745
+ getValidValue,
746
+ validate,
747
+ onValidate,
748
+ onValidatorValid,///il s'agit de la fonction de rappel appelée immédiatement après que le validateur ait réuissie la validation
749
+ onValidateField,
750
+ onNoValidate,
751
+ disabled,
752
+ visible,
753
+ readOnly,
754
+ editable,
755
+ beforeValidate,
756
+ footer,
757
+ archived,
758
+ windowWidth,
759
+ dataFilesInterest,
760
+ title,
761
+ tooltip,
762
+ right : customRight,
763
+ responsive,
764
+ responsiveProps,
765
+ usePlaceholderWhenEmpty,
766
+ width,
767
+ height,
768
+ ...rest
769
+ } = this.props;
770
+ if(this.state.caughtAnError){
771
+ return <ErrorMessage
772
+ error={this.state.caughtError}
773
+ info={this.state.caughtInfo}
774
+ resetError={this.resetCatchedError.bind(this)}
775
+ />
776
+ }
777
+ const isFilter = this.isFilter();
778
+ rest = defaultObj(rest);
779
+ data = defaultObj(data);
780
+ label = defaultVal(label,text);
781
+ rest.name = this.name;
782
+ rest.label = label;
783
+ rest.data = data;
784
+
785
+
786
+ rest.validRule = rest.validType = this.INITIAL_STATE.validType;
787
+ rest.validParams = this.INITIAL_STATE.validParams;
788
+
789
+ if(!isUndefined(this.___visible)){
790
+ visible = this.___visible;
791
+ }
792
+ this.___visible = undefined;
793
+ if(!isUndefined(this[this.__disabledSymbol])){
794
+ disabled = this[this.__disabledSymbol];
795
+ }
796
+
797
+ let callArgs = {context:this,field:this.name,name:this.name,
798
+ value:this.validatingValue,//rest.defaultValue,
799
+ validValue:this.state.validValue,...rest,data,props:this.props};
800
+ readOnly = defaultVal(readOnly);
801
+ if(isFunction(readOnly)){
802
+ //windowResized spécifie tout simplement que le composant est rendu après rédimensionnemnet de la page
803
+ readOnly = readOnly.call(this,callArgs);
804
+ }
805
+ if(!isUndefined(readOnly)) rest.readOnly = readOnly?true:false;
806
+
807
+ if(isFunction(editable)){
808
+ editable = editable.call(this,callArgs);
809
+ }
810
+ if(isBool(editable)) rest.editable = editable;
811
+ else rest.editable = rest.readOnly ? false : true;
812
+ if(isFunction(disabled)){
813
+ disabled = disabled.call(this,callArgs);
814
+ }
815
+ if(!isBool(disabled)) rest.disabled = disabled;
816
+ else rest.disabled = disabled ? true : false;
817
+
818
+ if(isFunction(archived)){
819
+ archived = archived.call(this,callArgs);
820
+ }
821
+ if(archived === true){
822
+ editable = false;
823
+ disabled = true;
824
+ }
825
+
826
+ if(rest.readOnly || rest.disabled){
827
+ rest.editable = false;
828
+ }
829
+ if(!disabled){
830
+ disabled = defaultBool(this.props.disabled,false);
831
+ }
832
+ rest.disabled = disabled;
833
+
834
+ this[this.__isDisabledSymbol] = rest.disabled;
835
+ this[this.__isReadOnlySymbol] = rest.readOnly || rest.editable === false ? true : false;
836
+
837
+ if(isFunction(visible)){
838
+ visible = visible({field:this.name,name:this.name,...rest,value:this.validatingValue,data});
839
+ }
840
+ visible = defaultVal(visible,true);
841
+ rest.defaultValue = this.validatingValue;
842
+ rest.style = [{backgroundColor:'transparent'},rest.style,!visible?{display:'none'}:undefined];
843
+
844
+ /**** si ce n'est pas un composant de type dropdown*/
845
+ if(!isFunction(rest.filter)){
846
+ delete rest.filter;
847
+ }
848
+
849
+ delete rest.export;
850
+ delete rest.colIndex;
851
+ delete rest.accordion;
852
+ delete rest._id;
853
+ delete rest.import;
854
+ delete rest.dataFilesInterest;
855
+
856
+ delete rest.archivable;
857
+ delete rest.archivable;
858
+
859
+ this.___formattedField = undefined;
860
+ let _type = this.type = defaultStr(this.props.type,this.type,"text").trim().toLowerCase();
861
+ format = defaultStr(format).toLowerCase().trim();
862
+ tooltip = defaultVal(tooltip,title);
863
+
864
+ const isEditable = rest.disabled !== true && rest.readOnly !== true && rest.editable !== false ? true : false;
865
+ const hasDefaultValue = isNonNullString(rest.defaultValue) || typeof rest.defaultValue =='number'? true : false;
866
+ const canChangeRight = this.isTextField() && !isEditable && hasDefaultValue;
867
+ if(canChangeRight){
868
+ rest.contentContainerProps = Object.assign({},rest.contentContainerProps);
869
+ rest.contentContainerProps.pointerEvents = defaultStr(rest.contentContainerProps.pointerEvents,"auto");
870
+ }
871
+ if(!isFilter && this.canRenderInlineIndicator()){
872
+ const canRenderHashtag = format === 'hashtag' && (!isNonNullString(_type) || _type ==='text');
873
+ const renderRigth = (props)=>{
874
+ let right = null;
875
+ let cRight = typeof customRight ==='function'? customRight(props) : customRight;
876
+ if(!React.isValidElement(cRight)){
877
+ cRight = null;
878
+ }
879
+ if(tooltip){
880
+ right = <Icon color={theme.colors.primary} {...props} tooltip = {tooltip} style={[styles.icon,props.style]} icon="information"/>;
881
+ }
882
+ if(canRenderHashtag && !rest.disabled && !rest.readOnly){
883
+ const nRight = <Icon {...props} icon={"format-header-pound"} style={[right||cRight?{marginLeft:-5}:null,props.style]} title={"Cliquer insérer un hashtag, ie faire référence à une données de ventes, d'achas, de stocks, de règlement..."} onPress={this.sprintf.bind(this)}/>;
884
+ right = right ? <>{right}{nRight}</> : nRight;
885
+ }
886
+ return (cRight)? <>{cRight}{right}</> : right;
887
+ };
888
+ rest.right = this.canRightPropsBeFunction() ? renderRigth : renderRigth({});
889
+ } else {
890
+ rest.right = customRight;
891
+ }
892
+ const hasWrapper = !isFilter ? true : false;
893
+ const wrapperProps = hasWrapper ? Object.assign({},responsiveProps) : {};
894
+ if(hasWrapper){
895
+ const rP = {};
896
+ if(_type =='switch' || _type =='checkbox' || _type =='image'){
897
+ rP.justifyContent = 'center';
898
+ }
899
+ if(_type =='image'){
900
+ if(rest.displayLabel === false){
901
+ delete rest.label;
902
+ rP.alignItems = 'center';
903
+ rP.width = "100%";
904
+ }
905
+ }
906
+ wrapperProps.style = [{marginVertical:10},responsive !== false?grid.col(windowWidth):{width:'100%'},rP,wrapperProps.style];
907
+ }
908
+ if(isFunction(getProps)){
909
+ rest = {...rest,...defaultObj(getProps.call(this,{...rest,context:this}))};
910
+ }
911
+ rest.context = this;
912
+ this.removeNotAllowedProps(rest,{formName:this.formName,context:this});
913
+ rest.setRef = this.setRef.bind(this);
914
+ rest.isFilter = isFilter;
915
+ rest.type = this.type;
916
+ if(format){
917
+ rest.format = format;
918
+ }
919
+
920
+ rest.onBlur = this.onBlurField.bind(this);
921
+ rest.autoComplete = "off";
922
+ rest.errorText = this.state.errorText;
923
+ rest.helperText = this.state.errorText;
924
+ rest.error = this.state.error;
925
+ rest.onFocus = this.onFocusField.bind(this);
926
+ rest.testID = defaultStr(rest.testID,"RN_FormField_"+this.getName());
927
+ if(this.canHandleWidthOrHeightProps()){
928
+ if(width){
929
+ rest.width = width;
930
+ }
931
+ if(height){
932
+ rest.height = height;
933
+ }
934
+ }
935
+ return <KeyboardEventHandler formFieldName={this.getName()} testID={'RN_FormFieldContainer_'+this.getName()} innerRef={this.wrapperRef} {...wrapperProps}
936
+ handleKeys={this.keybaordEvents}
937
+ onKeyEvent = {this.onKeyEvent.bind(this)}
938
+ isDisabled = {rest.disabled}
939
+ >
940
+ {(kProps)=>{
941
+ return this._render({...rest,...kProps},this.setRef.bind(this))
942
+ }}
943
+ </KeyboardEventHandler>
944
+ }
945
+ }
946
+
947
+ Field.propTypes = {
948
+ left : PropTypes.oneOfType([
949
+ PropTypes.node,
950
+ PropTypes.func,
951
+ ]),
952
+ right : PropTypes.oneOfType([
953
+ PropTypes.node,
954
+ PropTypes.func,
955
+ ]),
956
+ usePlaceholderWhenEmpty : PropTypes.bool,//si la valeur du placeholder sera utilée, lorsque la valeur du champ de type formatable est nulle ou égale à la valeur vide
957
+ responsive : PropTypes.bool,
958
+ responsiveProps : PropTypes.object,
959
+ ///la valeur à retourner au cas où defaultValue est non définie pour la formField
960
+ _defaultValue : PropTypes.any,
961
+ /*** fonction de rappel, appélée immédiatement que la validation a réussie par le validateur.
962
+ * Si cette fonction retourne un message non null ou un objet contenant la prop msg ou message non null, alors celui-ci est considéré comme une erreur
963
+ */
964
+ onValidatorValid : PropTypes.func,
965
+ /*** le format dans lequel sera rendu le contenu du textfield */
966
+ format : PropTypes.string,
967
+ //la liste d'évènements du clavier à écouter
968
+ /*** objet de la forme :
969
+ * {
970
+
971
+ * eventName : handler
972
+ avec eventName le nom de l'évènement et hanbler la fonction de rappel à appeler
973
+ * }
974
+ */
975
+ keyboardEvents : PropTypes.oneOfType([
976
+ PropTypes.object,
977
+ PropTypes.func,
978
+ ]),
979
+ onKeyEvent : PropTypes.func, /*** l'évènement global appelé lorsqu'on clique sur une touche */
980
+ onKeyEvent : PropTypes.func/*** l'évènement global appelé lorsqu'on clique sur une champ de la form */,
981
+ id: PropTypes.string,
982
+ /**** l'on peut décider que la field ait la possibilité d'exploiter le gestion de validateur ou pas
983
+ * dans ce cas, il suffit de renseigner la props validate à true ou à false
984
+ */
985
+ validate : PropTypes.bool,
986
+ /***function utile pour définir dynamiquement
987
+ certaines props de la field;
988
+ * fonction appelée pour retourner les props à passer au composant
989
+ Elle prend en paramètre : les props passés au composant de la field, ainsi que l'objet data
990
+ et doit retourner un objet props final qui sera passé à la field
991
+ * cette fonction prend en paramètre :
992
+ * -1. l'objet props, représentant les props courant de la field
993
+ * -2. l'objet data, représentant les données actuelle passées à la field
994
+ * la valeur des props retournés doit être une fusions avec les props initiaux
995
+ */
996
+ /*cette
997
+
998
+ */
999
+ getProps : PropTypes.func, //cette fonction est utile pour permettre de retourner les props par défaut de la field
1000
+ disabled : PropTypes.oneOfType([PropTypes.func,PropTypes.bool,PropTypes.string]),
1001
+ readOnly : PropTypes.oneOfType([PropTypes.func,PropTypes.bool,PropTypes.string]),
1002
+ visible : PropTypes.oneOfType([PropTypes.func,PropTypes.bool]),
1003
+ text : PropTypes.string,
1004
+ label : PropTypes.string,//le libelé du champ, idem à text
1005
+ value : PropTypes.any,
1006
+ /*** tous les champs doivent avoir un nom définit dans la prop name */
1007
+ //name : PropTypes.string.isRequired,
1008
+ defaultValue : PropTypes.any,
1009
+ selected : PropTypes.any,
1010
+ formName : PropTypes.string.isRequired,
1011
+ name : PropTypes.oneOfType([PropTypes.string]).isRequired,
1012
+ required : PropTypes.bool,
1013
+ /*** cette fonction est appelée lorsque la field est validée */
1014
+ onValidate : PropTypes.func,
1015
+ /*** la propriété onChange prend en paramètre un callback, qui est prend en paramètre
1016
+ la nouvelle valeur, et l'évènement qui est à l'origine
1017
+ */
1018
+ onChange : PropTypes.func,
1019
+ /*** le noeud de la text field à utiliser */
1020
+ onNoValidate : PropTypes.func,
1021
+ validParams : PropTypes.oneOfType([PropTypes.object,PropTypes.array]),
1022
+ validType : PropTypes.oneOfType([
1023
+ PropTypes.func,
1024
+ PropTypes.string,
1025
+ ]),
1026
+ validRule : PropTypes.oneOfType([
1027
+ PropTypes.func,
1028
+ PropTypes.string,
1029
+ ]),
1030
+ required : PropTypes.oneOfType([
1031
+ PropTypes.bool, //si c'est un boolean
1032
+ ]),
1033
+ /*** cette props est définie par le composant Filter :
1034
+ * Elle permet tout simplement de spécifier que le rendu sera un champ de filtre
1035
+ * Lorsqu'elle est définie alors le rendu lors du composant doit être de type filter
1036
+ */
1037
+ renderfilter : PropTypes.string,
1038
+ /*** cette fonction doit retourner l'instance de la field
1039
+ elle doit toujours être définie dans la classe qui hérite directement au composant Field
1040
+ */
1041
+ /////getFieldInstance : PropTypes.func.IsRequired,
1042
+ }
1043
+
1044
+ const styles = StyleSheet.create({
1045
+ icon : {
1046
+ marginHorizontal : 0
1047
+ }
1048
+ })