@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.
- package/assets/adaptive-icon.png +0 -0
- package/assets/add_photo.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.alias.js +32 -0
- package/babel.config.js +18 -0
- package/circular-dependencies.js +24 -0
- package/compiler.config.js +28 -0
- package/expo.metro.config.js +27 -0
- package/index.js +21 -0
- package/metro.config.js +1 -0
- package/package.json +60 -0
- package/src/App.js +65 -0
- package/src/Preferences.js +5 -0
- package/src/auth/Login.js +254 -0
- package/src/auth/index.js +3 -0
- package/src/components/ActivityIndicator/index.js +9 -0
- package/src/components/Animations/Animation/index.js +95 -0
- package/src/components/Animations/Animation/utils.js +78 -0
- package/src/components/Animations/OpacityAnimation/index.js +53 -0
- package/src/components/Animations/OpacityAnimation/utils.js +38 -0
- package/src/components/Animations/index.js +6 -0
- package/src/components/AppBar/Content.js +132 -0
- package/src/components/AppBar/index.js +164 -0
- package/src/components/AppBar/utils.js +204 -0
- package/src/components/AutoLink/index.js +45 -0
- package/src/components/Avatar/AutoHeightImage/AnimatableImage.js +22 -0
- package/src/components/Avatar/AutoHeightImage/ImagePolyfill.js +33 -0
- package/src/components/Avatar/AutoHeightImage/cache.js +75 -0
- package/src/components/Avatar/AutoHeightImage/helpers.js +2 -0
- package/src/components/Avatar/AutoHeightImage/index.js +97 -0
- package/src/components/Avatar/Image.js +115 -0
- package/src/components/Avatar/Text.js +74 -0
- package/src/components/Avatar/index.js +89 -0
- package/src/components/BackToTop/index.js +89 -0
- package/src/components/Badge/index.js +141 -0
- package/src/components/Badge/index1.js +34 -0
- package/src/components/BottomSheet/Content.js +19 -0
- package/src/components/BottomSheet/Menu.js +126 -0
- package/src/components/BottomSheet/Provider.js +58 -0
- package/src/components/BottomSheet/Sheet.js +434 -0
- package/src/components/BottomSheet/index.js +8 -0
- package/src/components/BottomSheet/utils.js +30 -0
- package/src/components/Br/index.js +4 -0
- package/src/components/Br/index.web.js +3 -0
- package/src/components/Browser/index.js +4 -0
- package/src/components/Button/index.js +465 -0
- package/src/components/CardView/index.android.js +55 -0
- package/src/components/CardView/index.ios.js +36 -0
- package/src/components/CardView/index.web.js +3 -0
- package/src/components/Chart/appexchart.3.5.text +14 -0
- package/src/components/Chart/index.js +22 -0
- package/src/components/Chart/index.native.js +61 -0
- package/src/components/Chart/utils.js +0 -0
- package/src/components/Checkbox/index.js +178 -0
- package/src/components/Chip/index.js +350 -0
- package/src/components/Color/ColorPicker.js +724 -0
- package/src/components/Color/assets/black-gradient-rotated.png +0 -0
- package/src/components/Color/assets/black-gradient.png +0 -0
- package/src/components/Color/assets/color-wheel.png +0 -0
- package/src/components/Color/index.js +158 -0
- package/src/components/ContentLoader/BarChar.js +19 -0
- package/src/components/ContentLoader/Circle.js +3 -0
- package/src/components/ContentLoader/Circle.web.js +3 -0
- package/src/components/ContentLoader/Datagrid.js +28 -0
- package/src/components/ContentLoader/Form.js +39 -0
- package/src/components/ContentLoader/Loader/RLoader/index.js +3 -0
- package/src/components/ContentLoader/Loader/RLoader/index.web.js +3 -0
- package/src/components/ContentLoader/Loader/index.js +20 -0
- package/src/components/ContentLoader/PieChart.js +22 -0
- package/src/components/ContentLoader/Placeholder/Placeholder.js +52 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderLine.js +59 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderMedia.js +47 -0
- package/src/components/ContentLoader/Placeholder/animations/Fade.js +58 -0
- package/src/components/ContentLoader/Placeholder/animations/Loader.js +24 -0
- package/src/components/ContentLoader/Placeholder/animations/Progressive.js +62 -0
- package/src/components/ContentLoader/Placeholder/animations/Raw.js +4 -0
- package/src/components/ContentLoader/Placeholder/animations/Shine.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/ShineOverlay.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/context.js +4 -0
- package/src/components/ContentLoader/Placeholder/index.js +12 -0
- package/src/components/ContentLoader/Placeholder/tokens.js +9 -0
- package/src/components/ContentLoader/Profile.js +27 -0
- package/src/components/ContentLoader/Rect.js +3 -0
- package/src/components/ContentLoader/Rect.web.js +3 -0
- package/src/components/ContentLoader/Skeleton.js +145 -0
- package/src/components/ContentLoader/Table.js +69 -0
- package/src/components/ContentLoader/TaskList.js +27 -0
- package/src/components/ContentLoader/index copy.js +148 -0
- package/src/components/ContentLoader/index.js +151 -0
- package/src/components/ContentLoader/utils.js +8 -0
- package/src/components/CountUp/index.js +67 -0
- package/src/components/Countries/SelectCountry.js +65 -0
- package/src/components/Countries/index.js +5 -0
- package/src/components/Countries/resources/countries.json +1746 -0
- package/src/components/Countries/resources/flags/images/ad.png +0 -0
- package/src/components/Countries/resources/flags/images/ae.png +0 -0
- package/src/components/Countries/resources/flags/images/af.png +0 -0
- package/src/components/Countries/resources/flags/images/ag.png +0 -0
- package/src/components/Countries/resources/flags/images/ai.png +0 -0
- package/src/components/Countries/resources/flags/images/al.png +0 -0
- package/src/components/Countries/resources/flags/images/am.png +0 -0
- package/src/components/Countries/resources/flags/images/ao.png +0 -0
- package/src/components/Countries/resources/flags/images/ar.png +0 -0
- package/src/components/Countries/resources/flags/images/as.png +0 -0
- package/src/components/Countries/resources/flags/images/at.png +0 -0
- package/src/components/Countries/resources/flags/images/au.png +0 -0
- package/src/components/Countries/resources/flags/images/aw.png +0 -0
- package/src/components/Countries/resources/flags/images/ax.png +0 -0
- package/src/components/Countries/resources/flags/images/az.png +0 -0
- package/src/components/Countries/resources/flags/images/ba.png +0 -0
- package/src/components/Countries/resources/flags/images/bb.png +0 -0
- package/src/components/Countries/resources/flags/images/bd.png +0 -0
- package/src/components/Countries/resources/flags/images/be.png +0 -0
- package/src/components/Countries/resources/flags/images/bf.png +0 -0
- package/src/components/Countries/resources/flags/images/bg.png +0 -0
- package/src/components/Countries/resources/flags/images/bh.png +0 -0
- package/src/components/Countries/resources/flags/images/bi.png +0 -0
- package/src/components/Countries/resources/flags/images/bj.png +0 -0
- package/src/components/Countries/resources/flags/images/bl.png +0 -0
- package/src/components/Countries/resources/flags/images/bm.png +0 -0
- package/src/components/Countries/resources/flags/images/bn.png +0 -0
- package/src/components/Countries/resources/flags/images/bo.png +0 -0
- package/src/components/Countries/resources/flags/images/bq.png +0 -0
- package/src/components/Countries/resources/flags/images/br.png +0 -0
- package/src/components/Countries/resources/flags/images/bs.png +0 -0
- package/src/components/Countries/resources/flags/images/bt.png +0 -0
- package/src/components/Countries/resources/flags/images/bw.png +0 -0
- package/src/components/Countries/resources/flags/images/by.png +0 -0
- package/src/components/Countries/resources/flags/images/bz.png +0 -0
- package/src/components/Countries/resources/flags/images/ca.png +0 -0
- package/src/components/Countries/resources/flags/images/cc.png +0 -0
- package/src/components/Countries/resources/flags/images/cd.png +0 -0
- package/src/components/Countries/resources/flags/images/cf.png +0 -0
- package/src/components/Countries/resources/flags/images/cg.png +0 -0
- package/src/components/Countries/resources/flags/images/ch.png +0 -0
- package/src/components/Countries/resources/flags/images/ci.png +0 -0
- package/src/components/Countries/resources/flags/images/ck.png +0 -0
- package/src/components/Countries/resources/flags/images/cl.png +0 -0
- package/src/components/Countries/resources/flags/images/cm.png +0 -0
- package/src/components/Countries/resources/flags/images/cn.png +0 -0
- package/src/components/Countries/resources/flags/images/co.png +0 -0
- package/src/components/Countries/resources/flags/images/cr.png +0 -0
- package/src/components/Countries/resources/flags/images/cu.png +0 -0
- package/src/components/Countries/resources/flags/images/cv.png +0 -0
- package/src/components/Countries/resources/flags/images/cw.png +0 -0
- package/src/components/Countries/resources/flags/images/cx.png +0 -0
- package/src/components/Countries/resources/flags/images/cy.png +0 -0
- package/src/components/Countries/resources/flags/images/cz.png +0 -0
- package/src/components/Countries/resources/flags/images/de.png +0 -0
- package/src/components/Countries/resources/flags/images/dj.png +0 -0
- package/src/components/Countries/resources/flags/images/dk.png +0 -0
- package/src/components/Countries/resources/flags/images/dm.png +0 -0
- package/src/components/Countries/resources/flags/images/do.png +0 -0
- package/src/components/Countries/resources/flags/images/dz.png +0 -0
- package/src/components/Countries/resources/flags/images/ec.png +0 -0
- package/src/components/Countries/resources/flags/images/ee.png +0 -0
- package/src/components/Countries/resources/flags/images/eg.png +0 -0
- package/src/components/Countries/resources/flags/images/eh.png +0 -0
- package/src/components/Countries/resources/flags/images/er.png +0 -0
- package/src/components/Countries/resources/flags/images/es.png +0 -0
- package/src/components/Countries/resources/flags/images/et.png +0 -0
- package/src/components/Countries/resources/flags/images/fi.png +0 -0
- package/src/components/Countries/resources/flags/images/fj.png +0 -0
- package/src/components/Countries/resources/flags/images/fk.png +0 -0
- package/src/components/Countries/resources/flags/images/fm.png +0 -0
- package/src/components/Countries/resources/flags/images/fo.png +0 -0
- package/src/components/Countries/resources/flags/images/fr.png +0 -0
- package/src/components/Countries/resources/flags/images/ga.png +0 -0
- package/src/components/Countries/resources/flags/images/gb.png +0 -0
- package/src/components/Countries/resources/flags/images/gd.png +0 -0
- package/src/components/Countries/resources/flags/images/ge.png +0 -0
- package/src/components/Countries/resources/flags/images/gf.png +0 -0
- package/src/components/Countries/resources/flags/images/gg.png +0 -0
- package/src/components/Countries/resources/flags/images/gh.png +0 -0
- package/src/components/Countries/resources/flags/images/gi.png +0 -0
- package/src/components/Countries/resources/flags/images/gm.png +0 -0
- package/src/components/Countries/resources/flags/images/gn.png +0 -0
- package/src/components/Countries/resources/flags/images/gp.png +0 -0
- package/src/components/Countries/resources/flags/images/gq.png +0 -0
- package/src/components/Countries/resources/flags/images/gr.png +0 -0
- package/src/components/Countries/resources/flags/images/gt.png +0 -0
- package/src/components/Countries/resources/flags/images/gu.png +0 -0
- package/src/components/Countries/resources/flags/images/gw.png +0 -0
- package/src/components/Countries/resources/flags/images/gy.png +0 -0
- package/src/components/Countries/resources/flags/images/hk.png +0 -0
- package/src/components/Countries/resources/flags/images/hn.png +0 -0
- package/src/components/Countries/resources/flags/images/hr.png +0 -0
- package/src/components/Countries/resources/flags/images/ht.png +0 -0
- package/src/components/Countries/resources/flags/images/hu.png +0 -0
- package/src/components/Countries/resources/flags/images/id.png +0 -0
- package/src/components/Countries/resources/flags/images/ie.png +0 -0
- package/src/components/Countries/resources/flags/images/il.png +0 -0
- package/src/components/Countries/resources/flags/images/im.png +0 -0
- package/src/components/Countries/resources/flags/images/in.png +0 -0
- package/src/components/Countries/resources/flags/images/io.png +0 -0
- package/src/components/Countries/resources/flags/images/iq.png +0 -0
- package/src/components/Countries/resources/flags/images/ir.png +0 -0
- package/src/components/Countries/resources/flags/images/is.png +0 -0
- package/src/components/Countries/resources/flags/images/it.png +0 -0
- package/src/components/Countries/resources/flags/images/je.png +0 -0
- package/src/components/Countries/resources/flags/images/jm.png +0 -0
- package/src/components/Countries/resources/flags/images/jo.png +0 -0
- package/src/components/Countries/resources/flags/images/jp.png +0 -0
- package/src/components/Countries/resources/flags/images/ke.png +0 -0
- package/src/components/Countries/resources/flags/images/kg.png +0 -0
- package/src/components/Countries/resources/flags/images/kh.png +0 -0
- package/src/components/Countries/resources/flags/images/ki.png +0 -0
- package/src/components/Countries/resources/flags/images/km.png +0 -0
- package/src/components/Countries/resources/flags/images/kn.png +0 -0
- package/src/components/Countries/resources/flags/images/kp.png +0 -0
- package/src/components/Countries/resources/flags/images/kr.png +0 -0
- package/src/components/Countries/resources/flags/images/ks.png +0 -0
- package/src/components/Countries/resources/flags/images/kw.png +0 -0
- package/src/components/Countries/resources/flags/images/ky.png +0 -0
- package/src/components/Countries/resources/flags/images/kz.png +0 -0
- package/src/components/Countries/resources/flags/images/la.png +0 -0
- package/src/components/Countries/resources/flags/images/lb.png +0 -0
- package/src/components/Countries/resources/flags/images/lc.png +0 -0
- package/src/components/Countries/resources/flags/images/li.png +0 -0
- package/src/components/Countries/resources/flags/images/lk.png +0 -0
- package/src/components/Countries/resources/flags/images/lr.png +0 -0
- package/src/components/Countries/resources/flags/images/ls.png +0 -0
- package/src/components/Countries/resources/flags/images/lt.png +0 -0
- package/src/components/Countries/resources/flags/images/lu.png +0 -0
- package/src/components/Countries/resources/flags/images/lv.png +0 -0
- package/src/components/Countries/resources/flags/images/ly.png +0 -0
- package/src/components/Countries/resources/flags/images/ma.png +0 -0
- package/src/components/Countries/resources/flags/images/mc.png +0 -0
- package/src/components/Countries/resources/flags/images/md.png +0 -0
- package/src/components/Countries/resources/flags/images/me.png +0 -0
- package/src/components/Countries/resources/flags/images/mf.png +0 -0
- package/src/components/Countries/resources/flags/images/mg.png +0 -0
- package/src/components/Countries/resources/flags/images/mh.png +0 -0
- package/src/components/Countries/resources/flags/images/mk.png +0 -0
- package/src/components/Countries/resources/flags/images/ml.png +0 -0
- package/src/components/Countries/resources/flags/images/mm.png +0 -0
- package/src/components/Countries/resources/flags/images/mn.png +0 -0
- package/src/components/Countries/resources/flags/images/mo.png +0 -0
- package/src/components/Countries/resources/flags/images/mp.png +0 -0
- package/src/components/Countries/resources/flags/images/mq.png +0 -0
- package/src/components/Countries/resources/flags/images/mr.png +0 -0
- package/src/components/Countries/resources/flags/images/ms.png +0 -0
- package/src/components/Countries/resources/flags/images/mt.png +0 -0
- package/src/components/Countries/resources/flags/images/mu.png +0 -0
- package/src/components/Countries/resources/flags/images/mv.png +0 -0
- package/src/components/Countries/resources/flags/images/mw.png +0 -0
- package/src/components/Countries/resources/flags/images/mx.png +0 -0
- package/src/components/Countries/resources/flags/images/my.png +0 -0
- package/src/components/Countries/resources/flags/images/mz.png +0 -0
- package/src/components/Countries/resources/flags/images/na.png +0 -0
- package/src/components/Countries/resources/flags/images/nc.png +0 -0
- package/src/components/Countries/resources/flags/images/ne.png +0 -0
- package/src/components/Countries/resources/flags/images/nf.png +0 -0
- package/src/components/Countries/resources/flags/images/ng.png +0 -0
- package/src/components/Countries/resources/flags/images/ni.png +0 -0
- package/src/components/Countries/resources/flags/images/nl.png +0 -0
- package/src/components/Countries/resources/flags/images/no.png +0 -0
- package/src/components/Countries/resources/flags/images/np.png +0 -0
- package/src/components/Countries/resources/flags/images/nr.png +0 -0
- package/src/components/Countries/resources/flags/images/nu.png +0 -0
- package/src/components/Countries/resources/flags/images/nz.png +0 -0
- package/src/components/Countries/resources/flags/images/om.png +0 -0
- package/src/components/Countries/resources/flags/images/pa.png +0 -0
- package/src/components/Countries/resources/flags/images/pe.png +0 -0
- package/src/components/Countries/resources/flags/images/pf.png +0 -0
- package/src/components/Countries/resources/flags/images/pg.png +0 -0
- package/src/components/Countries/resources/flags/images/ph.png +0 -0
- package/src/components/Countries/resources/flags/images/pk.png +0 -0
- package/src/components/Countries/resources/flags/images/pl.png +0 -0
- package/src/components/Countries/resources/flags/images/pm.png +0 -0
- package/src/components/Countries/resources/flags/images/pr.png +0 -0
- package/src/components/Countries/resources/flags/images/ps.png +0 -0
- package/src/components/Countries/resources/flags/images/pt.png +0 -0
- package/src/components/Countries/resources/flags/images/pw.png +0 -0
- package/src/components/Countries/resources/flags/images/py.png +0 -0
- package/src/components/Countries/resources/flags/images/qa.png +0 -0
- package/src/components/Countries/resources/flags/images/re.png +0 -0
- package/src/components/Countries/resources/flags/images/ro.png +0 -0
- package/src/components/Countries/resources/flags/images/rs.png +0 -0
- package/src/components/Countries/resources/flags/images/ru.png +0 -0
- package/src/components/Countries/resources/flags/images/rw.png +0 -0
- package/src/components/Countries/resources/flags/images/sa.png +0 -0
- package/src/components/Countries/resources/flags/images/sb.png +0 -0
- package/src/components/Countries/resources/flags/images/sc.png +0 -0
- package/src/components/Countries/resources/flags/images/sd.png +0 -0
- package/src/components/Countries/resources/flags/images/se.png +0 -0
- package/src/components/Countries/resources/flags/images/sg.png +0 -0
- package/src/components/Countries/resources/flags/images/sh.png +0 -0
- package/src/components/Countries/resources/flags/images/si.png +0 -0
- package/src/components/Countries/resources/flags/images/sj.png +0 -0
- package/src/components/Countries/resources/flags/images/sk.png +0 -0
- package/src/components/Countries/resources/flags/images/sl.png +0 -0
- package/src/components/Countries/resources/flags/images/sm.png +0 -0
- package/src/components/Countries/resources/flags/images/sn.png +0 -0
- package/src/components/Countries/resources/flags/images/so.png +0 -0
- package/src/components/Countries/resources/flags/images/sr.png +0 -0
- package/src/components/Countries/resources/flags/images/ss.png +0 -0
- package/src/components/Countries/resources/flags/images/st.png +0 -0
- package/src/components/Countries/resources/flags/images/sv.png +0 -0
- package/src/components/Countries/resources/flags/images/sx.png +0 -0
- package/src/components/Countries/resources/flags/images/sy.png +0 -0
- package/src/components/Countries/resources/flags/images/sz.png +0 -0
- package/src/components/Countries/resources/flags/images/tc.png +0 -0
- package/src/components/Countries/resources/flags/images/td.png +0 -0
- package/src/components/Countries/resources/flags/images/tg.png +0 -0
- package/src/components/Countries/resources/flags/images/th.png +0 -0
- package/src/components/Countries/resources/flags/images/tj.png +0 -0
- package/src/components/Countries/resources/flags/images/tk.png +0 -0
- package/src/components/Countries/resources/flags/images/tl.png +0 -0
- package/src/components/Countries/resources/flags/images/tm.png +0 -0
- package/src/components/Countries/resources/flags/images/tn.png +0 -0
- package/src/components/Countries/resources/flags/images/to.png +0 -0
- package/src/components/Countries/resources/flags/images/tr.png +0 -0
- package/src/components/Countries/resources/flags/images/tt.png +0 -0
- package/src/components/Countries/resources/flags/images/tv.png +0 -0
- package/src/components/Countries/resources/flags/images/tw.png +0 -0
- package/src/components/Countries/resources/flags/images/tz.png +0 -0
- package/src/components/Countries/resources/flags/images/ua.png +0 -0
- package/src/components/Countries/resources/flags/images/ug.png +0 -0
- package/src/components/Countries/resources/flags/images/us.png +0 -0
- package/src/components/Countries/resources/flags/images/uy.png +0 -0
- package/src/components/Countries/resources/flags/images/uz.png +0 -0
- package/src/components/Countries/resources/flags/images/va.png +0 -0
- package/src/components/Countries/resources/flags/images/vc.png +0 -0
- package/src/components/Countries/resources/flags/images/ve.png +0 -0
- package/src/components/Countries/resources/flags/images/vg.png +0 -0
- package/src/components/Countries/resources/flags/images/vi.png +0 -0
- package/src/components/Countries/resources/flags/images/vn.png +0 -0
- package/src/components/Countries/resources/flags/images/vu.png +0 -0
- package/src/components/Countries/resources/flags/images/wf.png +0 -0
- package/src/components/Countries/resources/flags/images/ws.png +0 -0
- package/src/components/Countries/resources/flags/images/ye.png +0 -0
- package/src/components/Countries/resources/flags/images/yt.png +0 -0
- package/src/components/Countries/resources/flags/images/za.png +0 -0
- package/src/components/Countries/resources/flags/images/zm.png +0 -0
- package/src/components/Countries/resources/flags/images/zw.png +0 -0
- package/src/components/Countries/resources/flags/index.js +255 -0
- package/src/components/Countries/utils.js +28 -0
- package/src/components/Datagrid/Accordion/AppleSwipeable.js +123 -0
- package/src/components/Datagrid/Accordion/Filters.js +186 -0
- package/src/components/Datagrid/Accordion/GmailSwipeable.js +85 -0
- package/src/components/Datagrid/Accordion/Row.js +295 -0
- package/src/components/Datagrid/Accordion/index.js +719 -0
- package/src/components/Datagrid/Accordion/utils.js +22 -0
- package/src/components/Datagrid/Actions/Header.js +58 -0
- package/src/components/Datagrid/Actions/index.js +104 -0
- package/src/components/Datagrid/Checkbox.js +40 -0
- package/src/components/Datagrid/Common/Common.js +1866 -0
- package/src/components/Datagrid/Common/TableData.js +245 -0
- package/src/components/Datagrid/Common/factory.js +9 -0
- package/src/components/Datagrid/Common/index.js +7 -0
- package/src/components/Datagrid/Common/session.js +20 -0
- package/src/components/Datagrid/Common/setQueryLimit.js +32 -0
- package/src/components/Datagrid/Footer/Footer.js +86 -0
- package/src/components/Datagrid/Footer/index.js +93 -0
- package/src/components/Datagrid/List.js +2 -0
- package/src/components/Datagrid/RenderType.js +53 -0
- package/src/components/Datagrid/RenderTypes/index.native.js +1 -0
- package/src/components/Datagrid/RenderTypes/index.web.js +10 -0
- package/src/components/Datagrid/RenderTypes/utils.js +5 -0
- package/src/components/Datagrid/Table/Cell.js +45 -0
- package/src/components/Datagrid/Table/Datatable.js +232 -0
- package/src/components/Datagrid/Table/index.js +446 -0
- package/src/components/Datagrid/Table/renderTable.js +664 -0
- package/src/components/Datagrid/factory.js +12 -0
- package/src/components/Datagrid/getComponent.js +26 -0
- package/src/components/Datagrid/index.js +43 -0
- package/src/components/Datagrid/utils.js +185 -0
- package/src/components/Date/DatePickerModal/index.js +10 -0
- package/src/components/Date/DatePickerModal/index.native.js +22 -0
- package/src/components/Date/PickerInput/TextInputMask.js +106 -0
- package/src/components/Date/PickerInput/index.js +253 -0
- package/src/components/Date/Time.js +154 -0
- package/src/components/Date/TimePickerModal/index.js +3 -0
- package/src/components/Date/TimePickerModal/index.native.js +21 -0
- package/src/components/Date/dictionary.js +26 -0
- package/src/components/Date/index.js +11 -0
- package/src/components/Date/utils.common.js +3 -0
- package/src/components/Date/utils.common.native.js +0 -0
- package/src/components/Date/utils.js +209 -0
- package/src/components/Dialog/AppBarDialog.js +41 -0
- package/src/components/Dialog/Dialog.js +377 -0
- package/src/components/Dialog/DialogActions.js +69 -0
- package/src/components/Dialog/DialogFooter.js +36 -0
- package/src/components/Dialog/DialogTitle.js +47 -0
- package/src/components/Dialog/DropdownAlert/Queue.js +28 -0
- package/src/components/Dialog/DropdownAlert/Utils.js +36 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/index.js +685 -0
- package/src/components/Dialog/Provider.js +75 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/Alert.web.js +360 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/index.js +2 -0
- package/src/components/Dialog/confirm/Alert/index.js +43 -0
- package/src/components/Dialog/confirm/index.js +12 -0
- package/src/components/Dialog/confirm/showConfirmOrAlertOrPrompt.js +145 -0
- package/src/components/Dialog/dialogs.js +70 -0
- package/src/components/Dialog/index.js +17 -0
- package/src/components/Dialog/showConfirmOrAlertOrPrompt.js +90 -0
- package/src/components/Dialog/style.css +103 -0
- package/src/components/Dialog/utils.js +33 -0
- package/src/components/Divider/index.js +44 -0
- package/src/components/Drawer/DrawerHeader.js +70 -0
- package/src/components/Drawer/DrawerItems/DrawerItem.js +88 -0
- package/src/components/Drawer/DrawerItems/DrawerSection.js +34 -0
- package/src/components/Drawer/DrawerItems/ExpandableItem.js +44 -0
- package/src/components/Drawer/DrawerItems/_DrawerItem.js +173 -0
- package/src/components/Drawer/DrawerItems/index.js +155 -0
- package/src/components/Drawer/DrawerItems/utils.js +107 -0
- package/src/components/Drawer/DrawerLayout/index.js +476 -0
- package/src/components/Drawer/NavigationView.js +90 -0
- package/src/components/Drawer/Provider.js +6 -0
- package/src/components/Drawer/index.js +455 -0
- package/src/components/Drawer/session.js +28 -0
- package/src/components/Drawer/utils.js +39 -0
- package/src/components/Dropdown/index.js +1317 -0
- package/src/components/Dropdown/utils.js +19 -0
- package/src/components/ErrorBoundary/ErrorMessage.js +107 -0
- package/src/components/ErrorBoundary/Provider.js +68 -0
- package/src/components/ErrorBoundary/index.js +64 -0
- package/src/components/Expandable/Item.js +159 -0
- package/src/components/Expandable/index.js +229 -0
- package/src/components/Fab/Fab.js +46 -0
- package/src/components/Fab/Group.js +143 -0
- package/src/components/Fab/GroupComponent.js +384 -0
- package/src/components/Fab/index.js +8 -0
- package/src/components/FadeInOut/index.js +70 -0
- package/src/components/Filter/filterTextTypes.js +1 -0
- package/src/components/Filter/index.js +570 -0
- package/src/components/Filter/session.js +18 -0
- package/src/components/Filter/utils.js +289 -0
- package/src/components/Form/Action.js +112 -0
- package/src/components/Form/Fields/Checkbox.js +29 -0
- package/src/components/Form/Fields/Color.js +21 -0
- package/src/components/Form/Fields/Date.js +24 -0
- package/src/components/Form/Fields/Field.js +1048 -0
- package/src/components/Form/Fields/Html.js +21 -0
- package/src/components/Form/Fields/IdField.js +131 -0
- package/src/components/Form/Fields/Image.js +65 -0
- package/src/components/Form/Fields/PieceField.js +143 -0
- package/src/components/Form/Fields/Radio.js +31 -0
- package/src/components/Form/Fields/SelectCountry.js +12 -0
- package/src/components/Form/Fields/SelectField.js +147 -0
- package/src/components/Form/Fields/SelectStructData.js +24 -0
- package/src/components/Form/Fields/SelectTableData.js +24 -0
- package/src/components/Form/Fields/SelectTheme.js +11 -0
- package/src/components/Form/Fields/Slider.js +32 -0
- package/src/components/Form/Fields/Switch.js +34 -0
- package/src/components/Form/Fields/Tel.js +21 -0
- package/src/components/Form/Fields/TextField.js +44 -0
- package/src/components/Form/Fields/Time.js +28 -0
- package/src/components/Form/Fields/index.js +52 -0
- package/src/components/Form/Fields/selectPromptField.js +59 -0
- package/src/components/Form/Fields/sprintf.js +42 -0
- package/src/components/Form/Fields/sprintfSelectors.js +117 -0
- package/src/components/Form/Fields/utils.js +8 -0
- package/src/components/Form/Form.js +221 -0
- package/src/components/Form/FormData/Dialog.js +116 -0
- package/src/components/Form/FormData/DialogProvider.js +117 -0
- package/src/components/Form/FormData/FormData.js +403 -0
- package/src/components/Form/FormData/FormDataActions.js +155 -0
- package/src/components/Form/FormData/componentsTypes.js +117 -0
- package/src/components/Form/FormData/index.js +15 -0
- package/src/components/Form/FormData/utils.js +111 -0
- package/src/components/Form/KeyboardAvoidingView.js +23 -0
- package/src/components/Form/KeyboardEventHandler/index.js +115 -0
- package/src/components/Form/KeyboardEventHandler/keyEvents.js +139 -0
- package/src/components/Form/KeyboardEventHandler/readMe.md +1 -0
- package/src/components/Form/List/List.js +794 -0
- package/src/components/Form/List/index.js +2 -0
- package/src/components/Form/index.js +14 -0
- package/src/components/Form/utils/FormsManager.js +101 -0
- package/src/components/Form/utils/index.js +8 -0
- package/src/components/Form/utils/keyboardEvents.js +8 -0
- package/src/components/Form/utils/keyboardShortcuts.js +57 -0
- package/src/components/Grid/Cell.js +108 -0
- package/src/components/Grid/Col.js +30 -0
- package/src/components/Grid/Grid.js +35 -0
- package/src/components/Grid/Row.js +30 -0
- package/src/components/Grid/index.js +11 -0
- package/src/components/Hashtag/index.js +119 -0
- package/src/components/HeavyScreen/index.js +52 -0
- package/src/components/HeavyScreen/utils.js +36 -0
- package/src/components/HelperText/index.js +36 -0
- package/src/components/Html/AutoSizedImage.js +56 -0
- package/src/components/Html/HtmlToElement.js +173 -0
- package/src/components/Html/View.js +166 -0
- package/src/components/Icon/Checkbox.js +83 -0
- package/src/components/Icon/CrossFadeIcon.js +133 -0
- package/src/components/Icon/Icon.js +52 -0
- package/src/components/Icon/IconButton.js +155 -0
- package/src/components/Icon/MaterialCommunityIcon.js +93 -0
- package/src/components/Icon/index.js +10 -0
- package/src/components/Icon/utils.js +15 -0
- package/src/components/Image/Editor/index copy.js +42 -0
- package/src/components/Image/Editor/index.js +52 -0
- package/src/components/Image/index.js +309 -0
- package/src/components/InlineIndicator/Select.js +58 -0
- package/src/components/InlineIndicator/index.js +156 -0
- package/src/components/Label/index.js +104 -0
- package/src/components/Link/Browser.js +17 -0
- package/src/components/Link/getUrlCallback.js +10 -0
- package/src/components/Link/index.js +38 -0
- package/src/components/List/BigList.js +44 -0
- package/src/components/List/Common.js +233 -0
- package/src/components/List/FlashList.js +29 -0
- package/src/components/List/FlatList.js +34 -0
- package/src/components/List/RecyclerView.js +83 -0
- package/src/components/List/index.js +12 -0
- package/src/components/List/utils.js +23 -0
- package/src/components/Logo/Logo.js +98 -0
- package/src/components/Logo/Progress.js +21 -0
- package/src/components/Logo/index.js +3 -0
- package/src/components/Menu/Item.js +203 -0
- package/src/components/Menu/Menu.js +590 -0
- package/src/components/Menu/index.js +118 -0
- package/src/components/Menu/utils.js +81 -0
- package/src/components/Modal/index.js +212 -0
- package/src/components/NewLine/index.js +4 -0
- package/src/components/NewLine/index.web.js +3 -0
- package/src/components/Paragraph/index.js +32 -0
- package/src/components/PasswordText/index.js +29 -0
- package/src/components/PhoneInput/PhoneNumber.js +121 -0
- package/src/components/PhoneInput/country.js +54 -0
- package/src/components/PhoneInput/index.js +217 -0
- package/src/components/PhoneInput/numberType.json +14 -0
- package/src/components/PhoneInput/styles.js +52 -0
- package/src/components/Portal/index.js +5 -0
- package/src/components/Preloader/index.js +227 -0
- package/src/components/Progress/LoadingDots.js +126 -0
- package/src/components/Progress/index.js +18 -0
- package/src/components/Radio/index.js +164 -0
- package/src/components/ReadMoreText/index.js +120 -0
- package/src/components/ScrollView/index.js +34 -0
- package/src/components/Signature/Panel.js +246 -0
- package/src/components/Signature/index.js +69 -0
- package/src/components/SimpleSelect/index.js +483 -0
- package/src/components/Slider/Slider.js +770 -0
- package/src/components/Slider/index.js +144 -0
- package/src/components/Slider/styles.js +39 -0
- package/src/components/SplashScreen/index.js +194 -0
- package/src/components/SplashScreen/styles.js +74 -0
- package/src/components/StatusBar/Component/index.js +5 -0
- package/src/components/StatusBar/Component/index.web.js +88 -0
- package/src/components/StatusBar/index.js +7 -0
- package/src/components/Surface/Elevations.js +218 -0
- package/src/components/Surface/index.js +22 -0
- package/src/components/Swipeable/Swipe.js +225 -0
- package/src/components/Swipeable/SwipeableGesture.js +77 -0
- package/src/components/Swipeable/index.js +5 -0
- package/src/components/Swiper/Controls.js +277 -0
- package/src/components/Swiper/index.js +463 -0
- package/src/components/Swiper/nodeType.js +8 -0
- package/src/components/Swiper/renderNode.js +21 -0
- package/src/components/Switch/index.js +172 -0
- package/src/components/Tab/TabContent.js +72 -0
- package/src/components/Tab/TabItem.js +112 -0
- package/src/components/Tab/TabItems.js +246 -0
- package/src/components/Tab/index.js +114 -0
- package/src/components/Table/index.js +383 -0
- package/src/components/TextField/Affix.js +18 -0
- package/src/components/TextField/index.js +749 -0
- package/src/components/TextField/utils.js +64 -0
- package/src/components/Tooltip/Popover/index.js +254 -0
- package/src/components/Tooltip/Popover/index.web.js +60 -0
- package/src/components/Tooltip/index.js +42 -0
- package/src/components/TouchableRipple/index.js +0 -0
- package/src/components/View/index.js +49 -0
- package/src/components/WebView/Component/index.native.js +2 -0
- package/src/components/WebView/Component/index.web.js +154 -0
- package/src/components/WebView/Component/postMock.html +21 -0
- package/src/components/WebView/index.js +79 -0
- package/src/index.js +166 -0
- package/src/layouts/AppBar/index.js +59 -0
- package/src/layouts/AppBar/utils.js +12 -0
- package/src/layouts/Fab/actions.js +5 -0
- package/src/layouts/Fab/index.js +60 -0
- package/src/layouts/Fab/utils.js +25 -0
- package/src/layouts/Footer/index.js +8 -0
- package/src/layouts/Screen/FormData/FormData.js +103 -0
- package/src/layouts/Screen/FormData/List.js +83 -0
- package/src/layouts/Screen/FormData/index.js +3 -0
- package/src/layouts/Screen/Screen.js +173 -0
- package/src/layouts/Screen/index.js +11 -0
- package/src/media/Assets/index.js +6 -0
- package/src/media/Assets/utils.js +28 -0
- package/src/media/camera.js +1 -0
- package/src/media/camera.native.js +4 -0
- package/src/media/camera.web.js +9 -0
- package/src/media/file-system/index.js +20 -0
- package/src/media/file-system/utils/index.js +32 -0
- package/src/media/file-system/utils/utils.js +0 -0
- package/src/media/file-system/utils.native/index.js +1 -0
- package/src/media/index.js +137 -0
- package/src/navigation/Drawer/ProfilAvatar/defaultAvatar.js +1 -0
- package/src/navigation/Drawer/ProfilAvatar/index.js +142 -0
- package/src/navigation/Drawer/ProfilAvatar/style.css +18 -0
- package/src/navigation/Drawer/index.js +81 -0
- package/src/navigation/Drawer/items/SidebarFeedsItems.js +0 -0
- package/src/navigation/Drawer/items/SyncDataItem.js +20 -0
- package/src/navigation/Drawer/items/index.js +23 -0
- package/src/navigation/Drawer/items/items.js +31 -0
- package/src/navigation/Drawer/utils.js +18 -0
- package/src/navigation/index.js +45 -0
- package/src/navigation/utils.js +1 -0
- package/src/screens/Auth/index.js +31 -0
- package/src/screens/Auth/routes.js +9 -0
- package/src/screens/Auth/utils.js +5 -0
- package/src/screens/index.js +201 -0
- package/src/screens/mainScreens.js +4 -0
- package/src/screens/utils.js +13 -0
- package/webpack.config.js +31 -0
- package/workflows/release-package.yml +33 -0
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
import Button from "$ecomponents/Button";
|
|
2
|
+
import {showConfirm,notify} from "$ecomponents/Dialog";
|
|
3
|
+
import Avatar from "$ecomponents/Avatar";
|
|
4
|
+
import Icon from "$ecomponents/Icon";
|
|
5
|
+
import Datagrid from "$ecomponents/Datagrid";
|
|
6
|
+
import PropTypes from "prop-types";
|
|
7
|
+
import React,{Component as AppComponent} from "$react";
|
|
8
|
+
import {isNonNullString,defaultStr,defaultObj,defaultArray,extendObj,isObjOrArray,isFunction,isStringNumber} from "$utils";
|
|
9
|
+
import {isPhoneMedia} from "$cplatform/dimensions";
|
|
10
|
+
import View from "$ecomponents/View";
|
|
11
|
+
import {StyleSheet} from "react-native";
|
|
12
|
+
import {List} from "react-native-paper";
|
|
13
|
+
import FlashList from "$ecomponents/List";
|
|
14
|
+
import Surface from "$ecomponents/Surface";
|
|
15
|
+
import {navigate} from "$enavigation/utils";
|
|
16
|
+
import { handleBeforeSaveCallback } from "$ecomponents/Form/FormData/utils";
|
|
17
|
+
import theme from "$theme";
|
|
18
|
+
|
|
19
|
+
const NoDefinedIndexMssage = "Valeur non définie de l'indice pour l'enregistrement de la FormList";
|
|
20
|
+
|
|
21
|
+
export default class FormListComponent extends AppComponent {
|
|
22
|
+
constructor(props){
|
|
23
|
+
super(props)
|
|
24
|
+
this.autobind();
|
|
25
|
+
this.formName = isNonNullString(this.props.formName)?this.props.formName : uniqid("form-list-form");
|
|
26
|
+
this.displayTypes = Object.toArray(this.props.displayTypes);
|
|
27
|
+
if(this.displayTypes.length <=0){
|
|
28
|
+
this.displayTypes = ['list'];
|
|
29
|
+
}
|
|
30
|
+
const isHandlingObject = FormListComponent.isHandlingObject(props);
|
|
31
|
+
Object.defineProperties(this,{
|
|
32
|
+
dialogProviderRef : {
|
|
33
|
+
value : React.createRef(null),
|
|
34
|
+
},
|
|
35
|
+
isListControlled : {
|
|
36
|
+
value : typeof this.props.controlled === 'boolean'? this.props.controlled : true,
|
|
37
|
+
override : false,
|
|
38
|
+
},
|
|
39
|
+
isHandlingObject : {
|
|
40
|
+
value : isHandlingObject, override: false, writable : false,
|
|
41
|
+
},
|
|
42
|
+
push : {
|
|
43
|
+
value : isHandlingObject ? ({data,index,allData})=>{
|
|
44
|
+
allData[index] = data;
|
|
45
|
+
} : ({data,index,allData})=>{
|
|
46
|
+
allData.push(data);
|
|
47
|
+
},override : false,
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
if(this.isListControlled){
|
|
51
|
+
this.state.allData = this.getAllData(false);
|
|
52
|
+
}
|
|
53
|
+
this.canChangeDisplayType = isArray(this.displayTypes) && arrayValueExists(this.displayTypes,'list') && arrayValueExists(this.displayTypes,'table');
|
|
54
|
+
this.state.display = this.props.display;
|
|
55
|
+
}
|
|
56
|
+
getEmptyAllData(){
|
|
57
|
+
return this.isHandlingObject ? {}: [];
|
|
58
|
+
}
|
|
59
|
+
getAllData(initialized){
|
|
60
|
+
if(this.isListControlled && initialized !== false){
|
|
61
|
+
return this.state.allData;
|
|
62
|
+
}
|
|
63
|
+
let {allData} = this.props;
|
|
64
|
+
if(this.isHandlingObject){
|
|
65
|
+
return isObj(allData) ? allData : {};
|
|
66
|
+
}
|
|
67
|
+
return Array.isArray(allData)? allData : []
|
|
68
|
+
}
|
|
69
|
+
getDestructiveAllData(){
|
|
70
|
+
const allData = this.getAllData();
|
|
71
|
+
return Array.isArray(allData)? [...allData] : {...allData};
|
|
72
|
+
}
|
|
73
|
+
setAllData(allData,cb){
|
|
74
|
+
if(this.isListControlled){
|
|
75
|
+
return this.setState({allData},cb);
|
|
76
|
+
}
|
|
77
|
+
if(typeof cb =='function'){
|
|
78
|
+
cb(allData);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/*** retourne l'indice de la données à partir de la valeur data */
|
|
82
|
+
getIndex ({data,index,indexField,context,allData}){
|
|
83
|
+
context = context || this.props.context || this;
|
|
84
|
+
if(!indexField){
|
|
85
|
+
indexField = this.props.indexField;
|
|
86
|
+
}
|
|
87
|
+
if(!allData){
|
|
88
|
+
allData = this.getAllData();
|
|
89
|
+
}
|
|
90
|
+
if(this.isHandlingObject){
|
|
91
|
+
allData = defaultObj(allData)
|
|
92
|
+
} else allData = defaultArray(allData);
|
|
93
|
+
if(isFunction(indexField)){
|
|
94
|
+
index = indexField.call(context,{context,data,index,allData});
|
|
95
|
+
} else if(isNonNullString(indexField) && isObj(data) && data.hasOwnProperty(indexField)){
|
|
96
|
+
index = data[indexField];
|
|
97
|
+
}
|
|
98
|
+
const errorMessage = "Valeur de l'indice de la FormList non valide!! la fonction ou le champ index doit être une valeur entière ou une chaine de caractère";
|
|
99
|
+
if(this.isHandlingObject){
|
|
100
|
+
if(!isNonNullString(index) && !isNumber(index)){
|
|
101
|
+
console.error(errorMessage,index,this.props)
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
return index;
|
|
105
|
+
}
|
|
106
|
+
if(isStringNumber(index)){
|
|
107
|
+
index = parseInt(index) || undefined;
|
|
108
|
+
}
|
|
109
|
+
if(!isNumber(index) || Object.size(allData,true)<=0){
|
|
110
|
+
index = Object.size(allData);
|
|
111
|
+
}
|
|
112
|
+
if(!isNumber(index)){
|
|
113
|
+
console.error(errorMessage,index,this.props);
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return index;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_delete (data,index,primaryText){
|
|
120
|
+
let {beforeRemove} = this.props;
|
|
121
|
+
if(typeof beforeRemove !=='function' && isObj(this.props.formDataProps)){
|
|
122
|
+
beforeRemove = typeof this.props.formDataProps.beforeRemove =='function'? this.formDataProps.beforeRemove : undefined;
|
|
123
|
+
}
|
|
124
|
+
let context = this.props.context || this;
|
|
125
|
+
let canR = undefined;
|
|
126
|
+
const doDelete = ()=>{
|
|
127
|
+
let allData = this.getEmptyAllData();
|
|
128
|
+
let sAllData = this.getAllData();
|
|
129
|
+
const removingIndex = this.getIndex({data,allData:sAllData,context:this});
|
|
130
|
+
if((typeof removingIndex !== 'string' && typeof removingIndex !=='number') || !sAllData[removingIndex]){
|
|
131
|
+
console.error("unable to remove data from form List with index ",removingIndex,index," for data ",data," and all data is ",sAllData);
|
|
132
|
+
return notify.error("Impossible de supprimer la ligne sélectionnée car l'index "+removingIndex+", est invalide");
|
|
133
|
+
}
|
|
134
|
+
const toRemove = sAllData[removingIndex] || data;
|
|
135
|
+
Object.map(sAllData,(data,i)=>{
|
|
136
|
+
if(!isObj(data) || i === index || toRemove === data) return;
|
|
137
|
+
allData[i] = data;
|
|
138
|
+
})
|
|
139
|
+
this.setAllData(allData,()=>{
|
|
140
|
+
let context = this.props.context || this;
|
|
141
|
+
if(isFunction(this.props.onRemove)){
|
|
142
|
+
this.props.onRemove.call(context,{context,props:this.props,primaryText,data:toRemove,deleted:toRemove,removed:toRemove,index,allData});
|
|
143
|
+
} else if(isFunction(this.props.onDelete)){
|
|
144
|
+
this.props.onDelete.call(context,{context,props:this.props,primaryText,data:toRemove,deleted:toRemove,removed:toRemove,index,allData});
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
if(isFunction(beforeRemove)){
|
|
149
|
+
canR = beforeRemove.call(context,{context,action:'remove',removing:true,primaryText,data,index,allData:this.props.allData});
|
|
150
|
+
if(isNonNullString(canR)){
|
|
151
|
+
notify.error(canR);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if(canR === false) return;
|
|
155
|
+
if(isPromise(canR)){
|
|
156
|
+
canR.then((r)=>{
|
|
157
|
+
if(r === false) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if(isNonNullString(r)){
|
|
161
|
+
notify.error(r);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
doDelete();
|
|
165
|
+
}).catch((e)=>{
|
|
166
|
+
if(isNonNullString(e) || isObj(e)){
|
|
167
|
+
notify.error(e);
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
})
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
doDelete();
|
|
175
|
+
}
|
|
176
|
+
delete (data,index,primaryText){
|
|
177
|
+
if(defaultVal(this.props.confirmOnDelete,true)){
|
|
178
|
+
showConfirm({
|
|
179
|
+
title : ("Suppr : "+(isNonNullString(primaryText)?primaryText:"l'élément")),
|
|
180
|
+
message : "Voulez vous vraiment supprimer l'élément sélectionné?",
|
|
181
|
+
onSuccess :()=>{
|
|
182
|
+
this._delete(data,index,primaryText)
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
} else {
|
|
186
|
+
this._delete(data,index,primaryText)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
190
|
+
if(this.isListControlled){
|
|
191
|
+
let {allData} = nextProps;
|
|
192
|
+
if(this.isHandlingObject){
|
|
193
|
+
allData = isObj(allData) ? allData : {};
|
|
194
|
+
} else allData = Array.isArray(allData)? allData : []
|
|
195
|
+
this.setState({allData});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
componentDidUpdate(){
|
|
199
|
+
super.componentDidUpdate();
|
|
200
|
+
}
|
|
201
|
+
refresh(){
|
|
202
|
+
if(this.datagridRef && this.datagridRef.refresh){
|
|
203
|
+
this.datagridRef.refresh(true);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
onSave (arg){
|
|
207
|
+
const {data,currentIndex,isEditing} = arg;
|
|
208
|
+
const allData = this.getEmptyAllData();
|
|
209
|
+
const sAllData = this.getAllData();
|
|
210
|
+
let isDefault = isObj(data) && data.isDefault;
|
|
211
|
+
let index = isEditing? this.getIndex({data,allData:sAllData,context:this}) : currentIndex;
|
|
212
|
+
Object.map(sAllData,(d,index)=>{
|
|
213
|
+
if(!isObj(d)) return;
|
|
214
|
+
if(isDefault && data !== d){
|
|
215
|
+
d.isDefault = 0;
|
|
216
|
+
}
|
|
217
|
+
if(!this.isHandlingObject){
|
|
218
|
+
allData.push(d);
|
|
219
|
+
} else if(index === this.getIndex({data:d,index,context:this,allData:this.props.allData})){
|
|
220
|
+
allData[index] = d;
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
if(this.isHandlingObject){
|
|
224
|
+
index = this.getIndex({data,index,context:this,allData:this.props.allData});
|
|
225
|
+
if(index === undefined) {
|
|
226
|
+
//notify.error(NoDefinedIndexMssage,data,this.props.indexField)
|
|
227
|
+
return NoDefinedIndexMssage;
|
|
228
|
+
}
|
|
229
|
+
allData[index] = data;
|
|
230
|
+
} else {
|
|
231
|
+
if(!isEditing){
|
|
232
|
+
allData.push(data)
|
|
233
|
+
index = allData.length-1;
|
|
234
|
+
} else {
|
|
235
|
+
if(typeof index =='number'){
|
|
236
|
+
allData[index] = data;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return new Promise((resolve,reject)=>{
|
|
241
|
+
arg.allData = allData;
|
|
242
|
+
const befSave = defaultFunc(this.props.beforeSave,isObj(this.props.formDataProps)?this.props.formDataProps.beforeSave : undefined);
|
|
243
|
+
return handleBeforeSaveCallback(befSave,()=>{
|
|
244
|
+
return handleBeforeSaveCallback(this.props.onSave,()=>{
|
|
245
|
+
this.setAllData(allData,()=>{
|
|
246
|
+
resolve(arg)
|
|
247
|
+
})
|
|
248
|
+
},arg);
|
|
249
|
+
},arg);
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
getNavigationParams({data,index,context}){
|
|
254
|
+
let {
|
|
255
|
+
fields,
|
|
256
|
+
actions,
|
|
257
|
+
deletable,
|
|
258
|
+
renderAvatar,
|
|
259
|
+
routeName,
|
|
260
|
+
primaryText,
|
|
261
|
+
show,
|
|
262
|
+
text,
|
|
263
|
+
title,
|
|
264
|
+
indexField,
|
|
265
|
+
editable,addIcon,
|
|
266
|
+
addIconLabel,
|
|
267
|
+
onRemove,onSave,
|
|
268
|
+
onDelete,
|
|
269
|
+
beforeSave,
|
|
270
|
+
beforeRemove,
|
|
271
|
+
itemProps,
|
|
272
|
+
avatarProps,
|
|
273
|
+
secondaryText,
|
|
274
|
+
appBarProps,
|
|
275
|
+
formName,
|
|
276
|
+
content,
|
|
277
|
+
formDataProps,
|
|
278
|
+
datagridProps,
|
|
279
|
+
allData,
|
|
280
|
+
upsertProps,
|
|
281
|
+
upsertEltProps,
|
|
282
|
+
newElementLabel,
|
|
283
|
+
parentData,
|
|
284
|
+
...rest
|
|
285
|
+
} = this.props;
|
|
286
|
+
rest = defaultObj(rest);
|
|
287
|
+
data = defaultObj(data);
|
|
288
|
+
upsertEltProps = defaultVal(upsertEltProps,upsertProps);
|
|
289
|
+
let params = {
|
|
290
|
+
routeName,
|
|
291
|
+
parentData,
|
|
292
|
+
onSave : this.onSave.bind(this),
|
|
293
|
+
title,
|
|
294
|
+
newElementLabel,
|
|
295
|
+
indexField,
|
|
296
|
+
allData : this.state.allData,
|
|
297
|
+
show : this.show.bind(this),
|
|
298
|
+
currentIndex : index,
|
|
299
|
+
title : defaultStr(title,text),
|
|
300
|
+
//formDataProps,
|
|
301
|
+
formName,
|
|
302
|
+
//fields,
|
|
303
|
+
data,
|
|
304
|
+
}
|
|
305
|
+
if(typeof upsertEltProps =='function'){
|
|
306
|
+
params = {...params,...defaultObj(upsertEltProps(params)),allData:this.state.allData,onSave : this.onSave.bind(this),show : this.show.bind(this),currentIndex : index,routeName,data:params.data,indexField}
|
|
307
|
+
} else {
|
|
308
|
+
params = {...params,...defaultObj(upsertEltProps),allData:this.state.allData,onSave : this.onSave.bind(this),show : this.show.bind(this),currentIndex : index,routeName,data,indexField};
|
|
309
|
+
}
|
|
310
|
+
return params;
|
|
311
|
+
}
|
|
312
|
+
show (args){
|
|
313
|
+
const params = this.getNavigationParams(args);
|
|
314
|
+
return navigate(params,this.props.navigation)
|
|
315
|
+
}
|
|
316
|
+
/*** si l'affichage peut être sur forme de datagrid */
|
|
317
|
+
canRenderDatagrid(_fields){
|
|
318
|
+
let {datagridProps,fields} = this.props;
|
|
319
|
+
fields = isObjOrArray(_fields)? _fields:fields;
|
|
320
|
+
if(!isObjOrArray(fields)) return false;
|
|
321
|
+
let hasF = false;
|
|
322
|
+
for(let i in fields){
|
|
323
|
+
if(isObj(fields[i]) && (fields[i].label || fields[i].type || fields[i].text)){
|
|
324
|
+
hasF = true;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return hasF && (datagridProps !== false ? true : false)?true : false;
|
|
329
|
+
}
|
|
330
|
+
changeDisplayType(cb){
|
|
331
|
+
this.setState({display:this.state.display == 'table'? 'list':'table'},cb);
|
|
332
|
+
}
|
|
333
|
+
onRowPress(args){
|
|
334
|
+
if(isFunction(this._onRowsClick)){
|
|
335
|
+
this._onRowsClick(args);
|
|
336
|
+
}
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
datagridSelectedRowsActions(args){
|
|
340
|
+
let allData = this.getAllData();
|
|
341
|
+
let datagridProps = defaultObj(this.props.datagridProps);
|
|
342
|
+
let {selectedRowsActions} = datagridProps;
|
|
343
|
+
let context = this.props.context || this;
|
|
344
|
+
args.context = context;
|
|
345
|
+
args.display = "table";
|
|
346
|
+
if(isFunction(selectedRowsActions)){
|
|
347
|
+
selectedRowsActions = selectedRowsActions(args);
|
|
348
|
+
}
|
|
349
|
+
selectedRowsActions = isObjOrArray(selectedRowsActions)? selectedRowsActions : []
|
|
350
|
+
let editable = defaultVal(datagridProps.editable,this.props.editable);
|
|
351
|
+
let deletable = defaultVal(datagridProps.deletable,this.props.deletable);
|
|
352
|
+
let _sActs = isObj(selectedRowsActions)? {} : [];
|
|
353
|
+
if(editable){
|
|
354
|
+
let _edit = {
|
|
355
|
+
text : isNonNullString(editable)? editable:'Modifier l\'élément',
|
|
356
|
+
icon : 'pencil',
|
|
357
|
+
onPress : (args)=>{
|
|
358
|
+
let {selectedRows} = args;
|
|
359
|
+
let keys = Object.keys(selectedRows);
|
|
360
|
+
let index = keys[0];
|
|
361
|
+
let data = Object.assign({},selectedRows[index]);
|
|
362
|
+
let pArgs = {...args,data,index,allData:allData,selectedRows};
|
|
363
|
+
const canEdit = defaultVal(isFunction(editable)?editable.call(context,pArgs):editable,true)
|
|
364
|
+
if(canEdit){
|
|
365
|
+
return this.show(pArgs);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if(isObj(_sActs)){
|
|
370
|
+
_sActs.editSingleItem = _edit;
|
|
371
|
+
} else {
|
|
372
|
+
_sActs.push(_edit);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if(deletable){
|
|
376
|
+
const _delete = {
|
|
377
|
+
text : isNonNullString(deletable)? deletable : 'Suppr l\'élément',
|
|
378
|
+
icon : 'delete',
|
|
379
|
+
onPress : (args)=>{
|
|
380
|
+
let {selectedRows} = args;
|
|
381
|
+
let keys = Object.keys(selectedRows);
|
|
382
|
+
let index = keys[0];
|
|
383
|
+
let data = {...defaultObj(selectedRows[index])};
|
|
384
|
+
let pArgs = {...args,data,index,allData:allData,selectedRows};
|
|
385
|
+
const canDelete = defaultVal(isFunction(deletable)?deletable.call(context,pArgs):deletable,true)
|
|
386
|
+
const pText = defaultStr(data.label)+(isNonNullString(data.code)?('['+data.code+"]"):'')
|
|
387
|
+
if(canDelete){
|
|
388
|
+
return this.delete(data,index,pText);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if(isObj(_sActs)){
|
|
393
|
+
_sActs.deleteSingleItem = _delete;
|
|
394
|
+
} else {
|
|
395
|
+
_sActs.push(_delete);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return isObj(_sActs)? {..._sActs,...selectedRowsActions} : [..._sActs,...selectedRowsActions];
|
|
399
|
+
}
|
|
400
|
+
datagridActions(args){
|
|
401
|
+
let {actions} = defaultObj(this.restDatagridProps);
|
|
402
|
+
args = defaultObj(args);
|
|
403
|
+
args.context = this.props.context || this;
|
|
404
|
+
args.display = "table";
|
|
405
|
+
if(isFunction(actions)){
|
|
406
|
+
actions = actions(args);
|
|
407
|
+
}
|
|
408
|
+
actions = isObjOrArray(actions)? actions : [];
|
|
409
|
+
let _acts = isObj(actions)? {} : [];
|
|
410
|
+
let cDisplayType = {
|
|
411
|
+
text : 'Affichage en Liste',
|
|
412
|
+
icon : 'view_list',
|
|
413
|
+
onPress : this.changeDisplayType.bind(this)
|
|
414
|
+
}
|
|
415
|
+
if((this._addIcon)){
|
|
416
|
+
if(isObj(actions)){
|
|
417
|
+
_acts.addIcon = this._addIcon
|
|
418
|
+
} else {
|
|
419
|
+
_acts.push(this._addIcon);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if(this.canChangeDisplayType){
|
|
423
|
+
if(isObj(actions)){
|
|
424
|
+
_acts.changeDisplayT = cDisplayType
|
|
425
|
+
} else {
|
|
426
|
+
_acts.push(cDisplayType);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return isObj(_acts)? {..._acts,...actions} : [..._acts,...actions];
|
|
430
|
+
}
|
|
431
|
+
/*** affiche le rendu, lorsque le type d'affichage choisit est de type table */
|
|
432
|
+
render (){
|
|
433
|
+
let {fields,getRowKey,display,displayTypes,datagridProps,deletable,
|
|
434
|
+
renderAvatar,context,primaryText,show,title,indexField,
|
|
435
|
+
allData : customAllData,
|
|
436
|
+
controlled,
|
|
437
|
+
editable,addIcon,addIconLabel,onRemove,onSave,onDelete,
|
|
438
|
+
beforeSave,beforeRemove,formDataProps,formName,
|
|
439
|
+
itemProps,avatarProps,secondaryText,content,
|
|
440
|
+
itemContainerProps,
|
|
441
|
+
routeName,
|
|
442
|
+
testID,
|
|
443
|
+
save2closeAction,
|
|
444
|
+
saveAction,
|
|
445
|
+
save2NewAction,
|
|
446
|
+
newElementLabel,
|
|
447
|
+
dialogProps,
|
|
448
|
+
...props
|
|
449
|
+
} = this.props;
|
|
450
|
+
dialogProps = defaultObj(dialogProps);
|
|
451
|
+
testID = defaultStr(testID,"RN_FormListComponent")
|
|
452
|
+
const allData = this.getAllData();
|
|
453
|
+
formDataProps = defaultObj(formDataProps);
|
|
454
|
+
fields = isObjOrArray(fields) ? fields : formDataProps.fields;
|
|
455
|
+
props = defaultObj(props);
|
|
456
|
+
let ListProps = React.setProps(List,props);
|
|
457
|
+
context = context || this;
|
|
458
|
+
props = defaultObj(props);
|
|
459
|
+
avatarProps = {...defaultObj(avatarProps)}
|
|
460
|
+
secondaryText = defaultFunc(secondaryText,x=>null);
|
|
461
|
+
primaryText = defaultFunc(primaryText,x=>null);
|
|
462
|
+
renderAvatar = defaultFunc(renderAvatar,x=>null);
|
|
463
|
+
/*** les props de chaque items de la liste */
|
|
464
|
+
itemProps= {...defaultObj(itemProps)}
|
|
465
|
+
const descriptionNumberOfLines = typeof itemProps.numberOfLines ==='number' && itemProps.numberOfLines ? itemProps.numberOfLines : 3;
|
|
466
|
+
let counter = -1;
|
|
467
|
+
let is_o = this.isHandlingObject;
|
|
468
|
+
let addIconObj = null;
|
|
469
|
+
if(addIcon === false || addIcon === null) addIcon = null;
|
|
470
|
+
else {
|
|
471
|
+
let _addIcon = null;
|
|
472
|
+
let onCHandle = {onPress : (ev)=>{
|
|
473
|
+
React.stopEventPropagation(ev);
|
|
474
|
+
this.show({data:{},props:this.props,index:undefined,context,allData});
|
|
475
|
+
}}
|
|
476
|
+
addIconLabel = defaultVal(addIconLabel,"Ajouter un élément");
|
|
477
|
+
addIcon = defaultVal(addIcon,"plus")
|
|
478
|
+
addIconObj = {...onCHandle,icon:addIcon,text:addIconLabel};
|
|
479
|
+
if(isNonNullString(addIcon)) _addIcon = <Icon name={addIcon} size={40} title={'ajouter un élément'}></Icon>;
|
|
480
|
+
if(!React.isValidElement(addIcon)){
|
|
481
|
+
addIcon = _addIcon;
|
|
482
|
+
}
|
|
483
|
+
addIcon = (this.state.display != 'table') ? <Button
|
|
484
|
+
left = {addIcon}
|
|
485
|
+
style = {styles.addIconButton}
|
|
486
|
+
{...onCHandle}
|
|
487
|
+
>{addIconLabel}</Button> : {
|
|
488
|
+
style : styles.addIconButton,
|
|
489
|
+
...onCHandle,
|
|
490
|
+
right : addIcon,
|
|
491
|
+
children : addIconLabel,
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
this._addIcon = addIconObj;
|
|
495
|
+
|
|
496
|
+
let canRenderTable = this.canRenderDatagrid(fields);
|
|
497
|
+
|
|
498
|
+
if(typeof editable =='undefined'){
|
|
499
|
+
editable = true;
|
|
500
|
+
}
|
|
501
|
+
if(typeof deletable =='undefined'){
|
|
502
|
+
deletable = true;
|
|
503
|
+
}
|
|
504
|
+
const deletableFunc = typeof deletable =='function'? args => defaultVal(deletable.call(context,args,true)) : x => deletable;
|
|
505
|
+
const editableFunc = typeof editable =='function'? args => defaultVal(deletable.call(context,args),true) : x => editable;
|
|
506
|
+
const isCurrentDisplayTable = canRenderTable && this.state.display === 'table';
|
|
507
|
+
let listContent = null;
|
|
508
|
+
if(isCurrentDisplayTable){
|
|
509
|
+
datagridProps = defaultObj(datagridProps);
|
|
510
|
+
let dgProps = extendObj(true,{},{
|
|
511
|
+
pagin : false,
|
|
512
|
+
filters : false,
|
|
513
|
+
},datagridProps)
|
|
514
|
+
dgProps.progressbar = defaultVal(dgProps.progressbar,<Datagrid.LinesProgressBar/>)
|
|
515
|
+
delete dgProps.deletable;
|
|
516
|
+
delete dgProps.editable;
|
|
517
|
+
let _fields = extendObj(true,{},fields,datagridProps.fields)
|
|
518
|
+
this.restDatagridProps = dgProps;
|
|
519
|
+
this._onRowsClick = dgProps.onRowPress;
|
|
520
|
+
listContent = <Datagrid
|
|
521
|
+
testID = {testID+"_Datagrid"}
|
|
522
|
+
{...dgProps}
|
|
523
|
+
onRowPress = {this.onRowPress.bind(this)}
|
|
524
|
+
rowKey = {dgProps.rowKey === false || this.props.rowKey === false ? undefined : defaultStr(dgProps.rowKey,this.props.rowKey,dgProps.indexField,this.props.indexField,'_id')}
|
|
525
|
+
getRowKey = {(arg)=>{
|
|
526
|
+
let {row,rowIndex,...rest} = arg;
|
|
527
|
+
if(getRowKey){
|
|
528
|
+
return getRowKey({...arg,context:this,datagridContext:arg.context});
|
|
529
|
+
}
|
|
530
|
+
return this.getIndex({...defaultObj(rest),index:rowIndex,data:row,context:this,allData});
|
|
531
|
+
}}
|
|
532
|
+
isFormList
|
|
533
|
+
columns = {_fields}
|
|
534
|
+
ref = {(el)=>{
|
|
535
|
+
if(el){
|
|
536
|
+
this.datagridRef = el;
|
|
537
|
+
}
|
|
538
|
+
}}
|
|
539
|
+
data = {allData}
|
|
540
|
+
actions = {this.datagridActions.bind(this)}
|
|
541
|
+
selectedRowsActions = {this.datagridSelectedRowsActions.bind(this)}
|
|
542
|
+
/>
|
|
543
|
+
} else {
|
|
544
|
+
itemContainerProps = defaultObj(itemContainerProps);
|
|
545
|
+
if(!React.isValidElement(addIcon,true)){
|
|
546
|
+
addIcon = isObj(addIcon) ? <Button {...addIconObj} {...addIcon}/> : null;
|
|
547
|
+
}
|
|
548
|
+
listContent = <View testID={testID+"_List"} {...ListProps}>
|
|
549
|
+
<View testID={testID+"_HeaderContainer"} style={[styles.row]}>
|
|
550
|
+
{!isCurrentDisplayTable && addIcon ? <List.Subheader>{addIcon}</List.Subheader> : null}
|
|
551
|
+
{canRenderTable && this.canChangeDisplayType && <List.Subheader >
|
|
552
|
+
<Button
|
|
553
|
+
icon = {"view_column"}
|
|
554
|
+
title = "Affichage en Tableau"
|
|
555
|
+
style = {[{maxWidth:30}]}
|
|
556
|
+
onPress ={this.changeDisplayType.bind(this)}
|
|
557
|
+
>
|
|
558
|
+
{!isPhoneMedia() ? 'Affichage en ':''}Tableau
|
|
559
|
+
</Button>
|
|
560
|
+
</List.Subheader>}
|
|
561
|
+
</View>
|
|
562
|
+
<View testID={testID+"_ListWrapper"} style={[theme.styles.ph1]}>
|
|
563
|
+
<FlashList
|
|
564
|
+
items = {allData}
|
|
565
|
+
responsive
|
|
566
|
+
prepareItems = {(items)=>{
|
|
567
|
+
const itx = [];
|
|
568
|
+
Object.map(items,(data,index,ct)=>{
|
|
569
|
+
if(!isObj(data)) return null;
|
|
570
|
+
const _index = this.getIndex({data,index,allData:items});
|
|
571
|
+
if(is_o && (!isNumber(_index) && !isNonNullString(_index))) return null;
|
|
572
|
+
counter++;
|
|
573
|
+
const pArgs = {avatarProps,context,itemProps,data:data,index,allData:allData};
|
|
574
|
+
const deletable = deletableFunc(pArgs),
|
|
575
|
+
editable = editableFunc(pArgs);
|
|
576
|
+
let avatar = renderAvatar.call(context,pArgs);
|
|
577
|
+
const avatarProps = Object.assign({},avatarProps);
|
|
578
|
+
if(isObj(avatar)){
|
|
579
|
+
for(let i in avatar){
|
|
580
|
+
avatarProps[i] = avatar[i];
|
|
581
|
+
}
|
|
582
|
+
avatar = defaultStr(avatar.src,avatar.children,avatar.content);
|
|
583
|
+
}
|
|
584
|
+
if(isNonNullString(avatar)){
|
|
585
|
+
let src = undefined;
|
|
586
|
+
if(isValidImageSrc(avatar)){
|
|
587
|
+
src = avatar;
|
|
588
|
+
avatar = undefined;
|
|
589
|
+
}
|
|
590
|
+
itemProps.left = (lProps)=>{
|
|
591
|
+
return <Avatar suffix={ct} {...avatarProps} src={src}>{avatar}</Avatar>
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
const key = index+counter;
|
|
595
|
+
itx.push({
|
|
596
|
+
data,
|
|
597
|
+
index,
|
|
598
|
+
_index,
|
|
599
|
+
deletable,
|
|
600
|
+
editable,
|
|
601
|
+
key,
|
|
602
|
+
props : {
|
|
603
|
+
...itemProps,
|
|
604
|
+
onPress : typeof itemProps.onPress ==='function'? (e)=>{
|
|
605
|
+
itemProps.onPress.call(context,{data:{...data},index,allData,context,event:e},e)
|
|
606
|
+
} : undefined
|
|
607
|
+
},
|
|
608
|
+
title : primaryText.call(context,pArgs),
|
|
609
|
+
description : defaultVal(secondaryText.call(context,pArgs),''),
|
|
610
|
+
})
|
|
611
|
+
});
|
|
612
|
+
return itx;
|
|
613
|
+
}}
|
|
614
|
+
renderItem = {({item})=>{
|
|
615
|
+
const {data,title,description,key,_index,props,index,editable,deletable} = item;
|
|
616
|
+
const titleText = React.getTextContent(title);
|
|
617
|
+
return <View key={key} testID={testID+".Cell"+key} style={[theme.styles.w100]}>
|
|
618
|
+
<Surface key={key} elevation={5} {...itemContainerProps} style={[styles.itemContainer,itemContainerProps.style]}>
|
|
619
|
+
<List.Item
|
|
620
|
+
{...props}
|
|
621
|
+
titleStyle = {[{color:theme.colors.text},props.titleStyle]}
|
|
622
|
+
descriptionNumberOfLines = {descriptionNumberOfLines}
|
|
623
|
+
key = {index+counter}
|
|
624
|
+
title ={title}
|
|
625
|
+
description={description}
|
|
626
|
+
descriptionStyle = {[{color:theme.colors.text},props.descriptionStyle]}
|
|
627
|
+
style = {[props.style,styles.item]}
|
|
628
|
+
right = {!editable && !deletable?undefined : (rProps)=>{
|
|
629
|
+
return <View {...rProps} style={[styles.itemRight]}>
|
|
630
|
+
{!editable?null:<Icon title={"Modifier ["+titleText+"]"} name={"pencil"} color={theme.colors.secondary} onPress = {(e)=>{
|
|
631
|
+
React.stopEventPropagation(e);
|
|
632
|
+
this.show({data:{...data},index,_index,allData,context})
|
|
633
|
+
}} ></Icon>}
|
|
634
|
+
{!deletable?null:<Icon name="delete" color={theme.colors.error} title={"supprimer l'élément "} onPress = {(e)=>{
|
|
635
|
+
React.stopEventPropagation(e);
|
|
636
|
+
this.delete({...data},index,title);
|
|
637
|
+
}}></Icon>}
|
|
638
|
+
</View>
|
|
639
|
+
}}
|
|
640
|
+
/>
|
|
641
|
+
</Surface>
|
|
642
|
+
</View>
|
|
643
|
+
}}
|
|
644
|
+
/>
|
|
645
|
+
</View>
|
|
646
|
+
</View>
|
|
647
|
+
}
|
|
648
|
+
return <View testID={testID+"_Container"}>
|
|
649
|
+
{listContent}
|
|
650
|
+
</View>
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
FormListComponent./** détermine si la FormList manipule un objet des données
|
|
655
|
+
* si faux alors allData est un tableau de données data
|
|
656
|
+
* si vrai alors allData est un objet de données data
|
|
657
|
+
*/
|
|
658
|
+
isHandlingObject = (props)=>{
|
|
659
|
+
props = defaultObj(props);
|
|
660
|
+
if(props.handleObject === false){
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
return (isNonNullString(props.indexField)) || isFunction(props.indexField);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
FormListComponent.NoDefinedIndexMssage = NoDefinedIndexMssage;
|
|
667
|
+
|
|
668
|
+
FormListComponent.propTypes = {
|
|
669
|
+
upsertEltProps : PropTypes.oneOfType([
|
|
670
|
+
PropTypes.object,
|
|
671
|
+
PropTypes.func,
|
|
672
|
+
]),///les props supplémentaires exploités pour l'ajout où la modification d'un nouvel élément
|
|
673
|
+
upsertProps : PropTypes.oneOfType([
|
|
674
|
+
PropTypes.object,
|
|
675
|
+
PropTypes.func,
|
|
676
|
+
]), //alias à la props upsertEltProps
|
|
677
|
+
itemContainerProps : PropTypes.object,//les props à appliquer au container de chaque item
|
|
678
|
+
rowKey : PropTypes.oneOfType([
|
|
679
|
+
PropTypes.string,
|
|
680
|
+
PropTypes.bool,//si false la valeur du rowKey n'est pas pris en compte
|
|
681
|
+
]),
|
|
682
|
+
///pour récupérer la clé de l'élément de ligne, en affichage en datagrid
|
|
683
|
+
getRowKey : PropTypes.func,
|
|
684
|
+
///les types d'affichage supportés
|
|
685
|
+
displayTypes : PropTypes.array,
|
|
686
|
+
display : PropTypes.string,
|
|
687
|
+
/*** les props du datagrid */
|
|
688
|
+
datagridProps : PropTypes.oneOfType([
|
|
689
|
+
PropTypes.object,
|
|
690
|
+
PropTypes.bool, ///pour désactiver l'affichage en table
|
|
691
|
+
]),
|
|
692
|
+
/*** les champ du formulaire */
|
|
693
|
+
fields : PropTypes.oneOfType([
|
|
694
|
+
PropTypes.func,
|
|
695
|
+
PropTypes.arrayOf(PropTypes.object),
|
|
696
|
+
PropTypes.objectOf(PropTypes.object)
|
|
697
|
+
]),
|
|
698
|
+
/**** l'indice courante de l'élément dans la liste : peut être une fonction ou une chaine de caractère
|
|
699
|
+
* si c'est une chaine de caractère alors la valeur allData est un objet de données et la dite chaine est le nom de la propriété permetant de retourne l'indice unique de la données courante
|
|
700
|
+
* Si c'est une fonction alors elle doit retourner l'indique unique pour la données courante data
|
|
701
|
+
* elle prend en paramètre : param {
|
|
702
|
+
* context : le contexte de la fonction,
|
|
703
|
+
* data : la données courante,
|
|
704
|
+
index : l'indice passé par défaut,
|
|
705
|
+
allData : l'ensemble des données de la liste
|
|
706
|
+
* }
|
|
707
|
+
*/
|
|
708
|
+
indexField : PropTypes.oneOfType([
|
|
709
|
+
PropTypes.string,
|
|
710
|
+
PropTypes.func
|
|
711
|
+
]),
|
|
712
|
+
addIcon : PropTypes.oneOfType([
|
|
713
|
+
///lorsque addIcon vaut false, alors il sera impossible d'ajouter un élément dans la liste
|
|
714
|
+
PropTypes.bool,
|
|
715
|
+
/** le nom l'icone icon à définir comme icon du bouton d'ajout d'un nouvel élement d'ajout d'un nouvel élément */
|
|
716
|
+
PropTypes.element,
|
|
717
|
+
PropTypes.node,
|
|
718
|
+
]),
|
|
719
|
+
addIconLabel : PropTypes.oneOfType([
|
|
720
|
+
PropTypes.string,
|
|
721
|
+
PropTypes.element,
|
|
722
|
+
]),
|
|
723
|
+
allData : PropTypes.oneOfType([
|
|
724
|
+
PropTypes.objectOf(PropTypes.object),
|
|
725
|
+
PropTypes.arrayOf(PropTypes.object)
|
|
726
|
+
]),
|
|
727
|
+
/*** la fonction appelée, pour afficher la données courante, ou le formulaire de création d'une nouvelle données
|
|
728
|
+
* @param:
|
|
729
|
+
* data : Object : la données courante,
|
|
730
|
+
* index : l'indice de cette données dans la liste des données allData
|
|
731
|
+
*/
|
|
732
|
+
show : PropTypes.func,
|
|
733
|
+
hide : PropTypes.func,
|
|
734
|
+
//les props à attribuer au composant avatar
|
|
735
|
+
avatarProps : PropTypes.object,
|
|
736
|
+
/***
|
|
737
|
+
* La fonction utilisée pour le rendu de l'objet avatar
|
|
738
|
+
* le libelé de l'avatar à afficher sur chaque élément de la liste
|
|
739
|
+
* Il s'agit d'une fonction qui prend en paramètre la données puis retourne un noeud qui constituera
|
|
740
|
+
* le label à attribuer à l'élément de la liste : props leftAvatar
|
|
741
|
+
* @param : {
|
|
742
|
+
* context : Le contexte actuel
|
|
743
|
+
* data : la donnée courante dans l'itération sur l'ensemble des données de allData.
|
|
744
|
+
* index : l'indice de l'élemnt courant dans le tableau allData,
|
|
745
|
+
* allData : l'ensemble des données passé à la FormDataList
|
|
746
|
+
* exemple renderAvatar(data). cette fonction doit retourner un contenu du composant Avatar de react-md
|
|
747
|
+
*/
|
|
748
|
+
renderAvatar : PropTypes.func,
|
|
749
|
+
routeName : PropTypes.string,//.isRequired, //le nom de la route où l'on rediregera l'écran pour la modification ou l'ajout d'un nouvel élément
|
|
750
|
+
avatarSuffix : PropTypes.number,
|
|
751
|
+
/**** les différents props de chaque élément de la liste */
|
|
752
|
+
itemProps : PropTypes.object,
|
|
753
|
+
/*** la fonction appelée pour le rendu du contenu de la liste Item
|
|
754
|
+
* Elle prend en paramètre : l'indice courante dans la liste des données
|
|
755
|
+
* - la données courante
|
|
756
|
+
* -
|
|
757
|
+
*/
|
|
758
|
+
secondaryText : PropTypes.func,
|
|
759
|
+
/*** La fonction appelléee pour la génération du texte primaire à afficher pour la liste
|
|
760
|
+
* prend en paramète : l'indice courante, la données courante dans la boucle et l'ensemble des
|
|
761
|
+
* données de la liste
|
|
762
|
+
*/
|
|
763
|
+
primaryText : PropTypes.func,
|
|
764
|
+
///pour le rendu du contenu de la listItem,
|
|
765
|
+
//sa peut être un contenu noeu où alors un élément où une chaine de caractère
|
|
766
|
+
onRemove : PropTypes.func,
|
|
767
|
+
onDelete : PropTypes.func,
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
const styles = StyleSheet.create({
|
|
771
|
+
itemRight : {
|
|
772
|
+
flexDirection : 'row',
|
|
773
|
+
justifyContent : 'center'
|
|
774
|
+
},
|
|
775
|
+
row : {
|
|
776
|
+
flexDirection : 'row',
|
|
777
|
+
justifyContent : 'flex-start',
|
|
778
|
+
width : '100%'
|
|
779
|
+
},
|
|
780
|
+
addIconButton : {
|
|
781
|
+
fontSize : 16,
|
|
782
|
+
padding:0,
|
|
783
|
+
},
|
|
784
|
+
itemContainer : {
|
|
785
|
+
paddingVertical : 5,
|
|
786
|
+
paddingLeft : 0,
|
|
787
|
+
paddingRight : 0,
|
|
788
|
+
marginHorizontal : 10,
|
|
789
|
+
marginVertical : 10,
|
|
790
|
+
},
|
|
791
|
+
item : {
|
|
792
|
+
paddingRight : 0,
|
|
793
|
+
}
|
|
794
|
+
})
|