@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,155 @@
|
|
|
1
|
+
import FormData from "./FormData";
|
|
2
|
+
import showConfirm from "$ecomponents/Dialog/confirm";
|
|
3
|
+
import Dimensions from "$cplatform/dimensions";
|
|
4
|
+
import {defaultStr,isObj,defaultObj,isNonNullString,defaultVal,defaultFunc} from "$utils";
|
|
5
|
+
import React from "$react";
|
|
6
|
+
import {isWeb} from "$cplatform";
|
|
7
|
+
import PropTypes from "prop-types";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default class FormDataActionComponent extends FormData {
|
|
11
|
+
isFullScreen(){
|
|
12
|
+
const mainProps = this.getMainProps();
|
|
13
|
+
return typeof mainProps.fullScreen =='boolean'? mainProps.fullScreen : typeof mainProps.fullPage =='boolean'? mainProps.fullPage : mainProps.responsive !== false ? Dimensions.isMobileOrTabletMedia() : false;
|
|
14
|
+
}
|
|
15
|
+
getMainProps (){
|
|
16
|
+
return this.props;
|
|
17
|
+
}
|
|
18
|
+
getConfirmTitle(){
|
|
19
|
+
const {title,subtitle,isEditing} = this.getAppBarProps();
|
|
20
|
+
if(title){
|
|
21
|
+
return subtitle ? (title+(isWeb()?(isEditing || isWeb()?' | ':''):"\n")+subtitle) : title;
|
|
22
|
+
}
|
|
23
|
+
return subtitle;
|
|
24
|
+
}
|
|
25
|
+
close (){}
|
|
26
|
+
getNewElementLabel(){
|
|
27
|
+
return defaultStr(this.getMainProps().newElementLabel,this.props.newElementLabel,'Nouveau');
|
|
28
|
+
}
|
|
29
|
+
getIndexFieldProps(){
|
|
30
|
+
return defaultVal(this.getMainProps().indexField,this.props.indexField);
|
|
31
|
+
}
|
|
32
|
+
getAppBarProps(){
|
|
33
|
+
const mainProps = this.getMainProps();
|
|
34
|
+
const data = this.getDataProp();
|
|
35
|
+
const appBarProps = Object.assign({},mainProps.appBarProps);
|
|
36
|
+
const indexField = this.getIndexFieldProps();
|
|
37
|
+
const isEditing = this.isDocEditing(data);
|
|
38
|
+
let subtitle = (isEditing?'Modifier':this.getNewElementLabel());
|
|
39
|
+
let title = React.getTextContent(defaultVal(appBarProps.title,mainProps.title,this.props.title));
|
|
40
|
+
if(isEditing){
|
|
41
|
+
let _title = "";
|
|
42
|
+
if(isNonNullString(indexField)){
|
|
43
|
+
_title = defaultStr(data[indexField]);
|
|
44
|
+
} else if(isNonNullString(data.code)){
|
|
45
|
+
_title = data.code;
|
|
46
|
+
}
|
|
47
|
+
if(_title){
|
|
48
|
+
subtitle+= " ["+_title+"]"
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
subtitle = " ["+subtitle+"]";
|
|
52
|
+
}
|
|
53
|
+
if(this.props.title !== false && mainProps.title !== false) {
|
|
54
|
+
appBarProps.title = title;
|
|
55
|
+
}
|
|
56
|
+
appBarProps.isEditing = isEditing;
|
|
57
|
+
if(appBarProps.subtitle !== false && this.props.subtitle !== false && mainProps.subtitle !== false){
|
|
58
|
+
appBarProps.subtitle = subtitle = defaultVal(appBarProps.subtitle,subtitle);
|
|
59
|
+
}
|
|
60
|
+
return appBarProps;
|
|
61
|
+
}
|
|
62
|
+
/*** si l'on doit afficher une boîte de dialogue lorsque l'on veut modifier l'élément en cours de modification */
|
|
63
|
+
showConfirmOnCancel(){
|
|
64
|
+
return this.props.confirmOnCancel !== false;
|
|
65
|
+
}
|
|
66
|
+
onBackActionPress(args,callback){
|
|
67
|
+
args = defaultObj(args);
|
|
68
|
+
const mainProps = this.getMainProps();
|
|
69
|
+
const hasP = mainProps !== this.props;
|
|
70
|
+
const cb = ()=>{
|
|
71
|
+
if(typeof mainProps.onBackActionPress =='function' && mainProps.onBackActionPress(args) === false) return
|
|
72
|
+
else if(hasP && typeof this.props.onBackActionPress =='function' && this.props.onBackActionPress(args) === false) return;
|
|
73
|
+
if(typeof callback =='function'){
|
|
74
|
+
return callback(args);
|
|
75
|
+
}
|
|
76
|
+
return this.close();
|
|
77
|
+
}
|
|
78
|
+
if(this.showConfirmOnCancel()){
|
|
79
|
+
showConfirm({
|
|
80
|
+
title : defaultStr(this.getConfirmTitle(),'Annuler L\'opération en cours'),
|
|
81
|
+
message : "Voulez vous annuler l'opération en cours?",
|
|
82
|
+
onSuccess :cb
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
cb();
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
/*** si l'on autorise la création d'un nouvel élément */
|
|
90
|
+
canCreateNew(){
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
getAppBarActionsProps(props){
|
|
94
|
+
props = defaultObj(props,this.getMainProps(),this.props);
|
|
95
|
+
let {actions,save2NewAction,save2printAction,save2closeAction,saveAction,newAction} = props;
|
|
96
|
+
const sArg = {context:this};
|
|
97
|
+
save2NewAction = typeof save2NewAction =='function' ? save2NewAction (sArg) : save2NewAction;
|
|
98
|
+
save2closeAction = typeof save2closeAction ==='function'? save2closeAction(sArg) : save2closeAction;
|
|
99
|
+
saveAction = typeof saveAction ==='function'? saveAction(sArg) : saveAction;
|
|
100
|
+
newAction = typeof newAction ==='function'? newAction (sArg) : newAction;
|
|
101
|
+
const context = this;
|
|
102
|
+
const appBarProps = this.getAppBarProps();
|
|
103
|
+
const data = this.getDataProp();
|
|
104
|
+
const isEditing = this.isDocEditing(data);
|
|
105
|
+
let textSave = isEditing ? "Modifier": 'Enregistrer';
|
|
106
|
+
const newElementLabel = defaultStr(props.newElementLabel,this.props.newElementLabel,"Nouvel Element");
|
|
107
|
+
const indexField = this.getIndexFieldProps();
|
|
108
|
+
if(isEditing){
|
|
109
|
+
const t = isNonNullString(indexField) && isNonNullString(data[indexField])? data[indexField] : isNonNullString(data.code)? data.code : undefined;
|
|
110
|
+
if(t){
|
|
111
|
+
textSave+="["+t+"]"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if(actions == undefined && actions !== false){
|
|
115
|
+
actions = {
|
|
116
|
+
save2new : save2NewAction? {
|
|
117
|
+
isAction : true,
|
|
118
|
+
text : textSave+' & '+newElementLabel,
|
|
119
|
+
icon : 'content-save-edit',
|
|
120
|
+
onPress : ()=>{
|
|
121
|
+
context.clickedAction = 'save2new';
|
|
122
|
+
}
|
|
123
|
+
} : null,
|
|
124
|
+
save2close : save2closeAction? {
|
|
125
|
+
text : textSave+'+ Fermer',
|
|
126
|
+
isAction : true,
|
|
127
|
+
icon : 'content-save-all-outline',
|
|
128
|
+
onPress : ()=>{
|
|
129
|
+
context.clickedAction = 'save2close';
|
|
130
|
+
}
|
|
131
|
+
} : null,
|
|
132
|
+
save : saveAction !== false ? {
|
|
133
|
+
isAction : true,
|
|
134
|
+
text : textSave,
|
|
135
|
+
icon : 'check',
|
|
136
|
+
title : textSave,
|
|
137
|
+
onPress : (a)=>{
|
|
138
|
+
context.clickedAction = 'save';
|
|
139
|
+
}
|
|
140
|
+
} : null,
|
|
141
|
+
newElt : isEditing && newAction && this.canCreateNew() ? {
|
|
142
|
+
isAction : false,
|
|
143
|
+
text : newElementLabel,
|
|
144
|
+
icon : 'new-box',
|
|
145
|
+
onPress : ()=>{this.createNew.bind(this)}
|
|
146
|
+
} : null,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return super.getAppBarActionsProps({actions,...props,fullScreen : this.isFullScreen(),isFormAction:true,appBarProps})
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
FormDataActionComponent.propTypes = {
|
|
154
|
+
...FormData.propTypes,
|
|
155
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {defaultStr,defaultObj,defaultVal,isObj} from "$utils";
|
|
2
|
+
import Fields from "../Fields";
|
|
3
|
+
//import dataFileManager from "$dataFileManager";
|
|
4
|
+
import i18n from "$i18n";
|
|
5
|
+
|
|
6
|
+
const componentTypes = {
|
|
7
|
+
...Fields,
|
|
8
|
+
id : Fields.IdField,
|
|
9
|
+
idfield : Fields.IdField,
|
|
10
|
+
piecefield : Fields.PieceField,
|
|
11
|
+
piece : Fields.PieceField,
|
|
12
|
+
select : Fields.SelectField,
|
|
13
|
+
switch : Fields.Switch,
|
|
14
|
+
select_country : Fields.SelectCountry,
|
|
15
|
+
selectcountry : Fields.SelectCountry,
|
|
16
|
+
date : Fields.Date,
|
|
17
|
+
time : Fields.Time,
|
|
18
|
+
checkbox : Fields.Checkbox,
|
|
19
|
+
slider : Fields.Slider,
|
|
20
|
+
color : Fields.ColorPicker,
|
|
21
|
+
tel : Fields.Tel,
|
|
22
|
+
html : Fields.Html,
|
|
23
|
+
datafile : Fields.DataFile,
|
|
24
|
+
image : Fields.Image,
|
|
25
|
+
schedule : Fields.Scheduler,
|
|
26
|
+
scheduler : Fields.Scheduler,
|
|
27
|
+
default : Fields.TextField,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default componentTypes;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export const getFilterComponentProps = (_props)=>{
|
|
34
|
+
let {
|
|
35
|
+
validType,
|
|
36
|
+
validRule,
|
|
37
|
+
required,//label,text,title,
|
|
38
|
+
onAdd,
|
|
39
|
+
onAddIconClass,
|
|
40
|
+
addIcon,
|
|
41
|
+
disabled,
|
|
42
|
+
readOnly,
|
|
43
|
+
onAddIcon,
|
|
44
|
+
tableName,
|
|
45
|
+
multiplicater,
|
|
46
|
+
dbName,
|
|
47
|
+
table,
|
|
48
|
+
piece,
|
|
49
|
+
onChange,
|
|
50
|
+
error,
|
|
51
|
+
errorText,
|
|
52
|
+
label,text,
|
|
53
|
+
primary,
|
|
54
|
+
onValidate,
|
|
55
|
+
checkPiece,
|
|
56
|
+
check,
|
|
57
|
+
width,
|
|
58
|
+
type,
|
|
59
|
+
...props
|
|
60
|
+
} = _props;
|
|
61
|
+
props = defaultObj(props);
|
|
62
|
+
let component = Fields.TextField;
|
|
63
|
+
type = defaultStr(type,'text').toLowerCase().replaceAll("_","").replaceAll("-","").trim();
|
|
64
|
+
props = defaultObj(props);
|
|
65
|
+
/*if(type =='datafile'){
|
|
66
|
+
type = 'select';
|
|
67
|
+
props = {...selectFieldProps,items : dataFileManager.getAll(),...props};
|
|
68
|
+
label = defaultStr(label,dataFileManager.dataFileText);
|
|
69
|
+
}*/
|
|
70
|
+
if(type.startsWith("select")){
|
|
71
|
+
props.inputProps = Object.assign({},props.inputProps);
|
|
72
|
+
props.inputProps.placeholder = defaultStr(props.inputProps.placeholder,i18n.lang("search.."))
|
|
73
|
+
props.label = label;
|
|
74
|
+
component = Fields.SelectField;
|
|
75
|
+
/*if(type !== 'select'){
|
|
76
|
+
if(type === 'selectstructdata') {
|
|
77
|
+
dbName = 'structData';
|
|
78
|
+
component = StructDataSelectField;
|
|
79
|
+
} else if(type === 'selecttabledata'){
|
|
80
|
+
component = TableDataSelectField;
|
|
81
|
+
}
|
|
82
|
+
props.tableName = tableName;
|
|
83
|
+
props.dbName = dbName;
|
|
84
|
+
}*/
|
|
85
|
+
type = "select";
|
|
86
|
+
} else if(type == 'switch' || type =='radio' || type ==='checkbox') {
|
|
87
|
+
type = 'select';
|
|
88
|
+
let {checkedLabel,checkedTooltip,uncheckedTooltip,checkedValue,uncheckedLabel,uncheckedValue,label,text,...pR} = props;
|
|
89
|
+
checkedLabel = defaultVal(checkedLabel,checkedTooltip,'Désactivé/Désélectionné')
|
|
90
|
+
uncheckedLabel = defaultVal(uncheckedLabel,uncheckedTooltip,'Activé/Sélectionné')
|
|
91
|
+
checkedValue = defaultVal(checkedValue,1); uncheckedValue = defaultVal(uncheckedValue,0)
|
|
92
|
+
props = pR;
|
|
93
|
+
props.items = [{code:checkedValue,label:checkedLabel},{code:uncheckedValue,label:uncheckedLabel}];
|
|
94
|
+
component = Fields.SelectField;
|
|
95
|
+
} else if(type == "date" || type =="time"){
|
|
96
|
+
component = type === 'date'? Fields.Date : Fields.Time;
|
|
97
|
+
} else if(type == 'color' || type =='colorpicker') {
|
|
98
|
+
component = Fields.ColorPicker;
|
|
99
|
+
} else {
|
|
100
|
+
delete props.dbName;
|
|
101
|
+
delete props.tableName;
|
|
102
|
+
props.label = label;
|
|
103
|
+
delete props.fieldName;
|
|
104
|
+
}
|
|
105
|
+
type = type || "text"
|
|
106
|
+
if(type =='select'){
|
|
107
|
+
props.multiple = true;
|
|
108
|
+
}
|
|
109
|
+
props.renderFilter = true;
|
|
110
|
+
if(type.contains("date") || type.contains("time")){
|
|
111
|
+
delete props.right;
|
|
112
|
+
}
|
|
113
|
+
delete props.width;
|
|
114
|
+
delete props.onAdd;
|
|
115
|
+
delete props.onAddProps;
|
|
116
|
+
return {Component:component,props,type};
|
|
117
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import FormData from "./FormData";
|
|
2
|
+
import Dialog from "./Dialog";
|
|
3
|
+
import Provider from "./DialogProvider";
|
|
4
|
+
|
|
5
|
+
FormData.Dialog = Dialog;
|
|
6
|
+
|
|
7
|
+
export {Provider as DialogProvider};
|
|
8
|
+
|
|
9
|
+
export {Dialog};
|
|
10
|
+
|
|
11
|
+
export {FormData};
|
|
12
|
+
|
|
13
|
+
export default FormData;
|
|
14
|
+
|
|
15
|
+
FormData.DialogProvider = Provider;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {isNonNullString,isObj,defaultObj,isPromise,isFunction,defaultStr,isObjOrArray,defaultFunc} from "$utils";
|
|
2
|
+
import notify from "$notify";
|
|
3
|
+
import { getFormData } from "../utils/FormsManager";
|
|
4
|
+
import {isMobileBrowser,isMobileNative} from "$cplatform";
|
|
5
|
+
import { keyboardShortcuts as KeyboardShorts } from "../utils";
|
|
6
|
+
|
|
7
|
+
export const keyboardShortcuts = {};
|
|
8
|
+
Object.map(KeyboardShorts,(st,i)=>{
|
|
9
|
+
if(isObj(st) && isNonNullString(st.action)){
|
|
10
|
+
keyboardShortcuts[st.action] = i;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const canHandleShurtCut = x=> !isMobileNative(true) && !isMobileBrowser() ? true : false;
|
|
15
|
+
|
|
16
|
+
const canHandleS = canHandleShurtCut();
|
|
17
|
+
export const getAppBarActionsProps = function(_props){
|
|
18
|
+
let {actions,formName,save,cancel,actionMutator,saveButton,saveButtonIcon,data,children,style,...props} = defaultObj(_props);
|
|
19
|
+
props = Object.assign({},props);
|
|
20
|
+
cancel = defaultFunc(cancel);
|
|
21
|
+
save = defaultFunc(save);
|
|
22
|
+
saveButton = isNonNullString(saveButton)? saveButton : Object.size(data,true) > 0 && (isNonNullString(data.code) || isNonNullString(data._id))? "Modifier":'Enregister';
|
|
23
|
+
saveButtonIcon = defaultStr(saveButtonIcon,'check')
|
|
24
|
+
if(typeof actions =='function'){
|
|
25
|
+
actions = actions(props);
|
|
26
|
+
}
|
|
27
|
+
if(actions === undefined){
|
|
28
|
+
actions = [{
|
|
29
|
+
formName,
|
|
30
|
+
text : saveButton,
|
|
31
|
+
icon : saveButtonIcon,
|
|
32
|
+
isAction: true,
|
|
33
|
+
}]
|
|
34
|
+
} else {
|
|
35
|
+
actions = (isObjOrArray(actions))?actions : [];
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...props,
|
|
39
|
+
formName,
|
|
40
|
+
data,
|
|
41
|
+
actions,
|
|
42
|
+
actionMutator:({action,...rest})=>{
|
|
43
|
+
let {isAction,canSave,shortcut,onPress,...a} = action;
|
|
44
|
+
action = defaultObj(a);
|
|
45
|
+
if(canHandleS && isNonNullString(shortcut) && isNonNullString(keyboardShortcuts[shortcut])){
|
|
46
|
+
action.tooltip = defaultStr(action.tooltip,action.title,action.text,action.label);
|
|
47
|
+
if(action.tooltip){
|
|
48
|
+
action.tooltip +=" ("+keyboardShortcuts[shortcut]+")";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
isAction = defaultBool(isAction,canSave,true);
|
|
52
|
+
action.formName = formName;
|
|
53
|
+
if(isAction) {
|
|
54
|
+
action.isFormAction = true;
|
|
55
|
+
/*
|
|
56
|
+
en cas d'action de formulaire, si la fonction onPress retourne false, alors l'enregistrement du formulaire ne sera pas possible
|
|
57
|
+
la fonction onPress du bouton d'action prend en premier paramètre les paramètres du formulaire, et en second, la fonction save permettant d'enregistrer le formulaire
|
|
58
|
+
si cette fonction retourne false, alors la fonction save ne sera pas appelée.
|
|
59
|
+
*/
|
|
60
|
+
action.onPress = (aArg) =>{
|
|
61
|
+
const args = {...aArg,data:getFormData(formName),actionElt:action,actionKey:action.key};
|
|
62
|
+
if(isFunction(onPress) && onPress(args,save) === false){
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
save(args)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
delete action.handleChange;
|
|
70
|
+
action.onPress = (event) =>{
|
|
71
|
+
if(isFunction(onPress) && onPress(event) === false) return;
|
|
72
|
+
cancel(event);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return typeof actionMutator =='function'? actionMutator({...rest,action}):action;
|
|
76
|
+
}}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**** permet d'exécuter la fonction before save passée en paramètre en fonction du résultat rétournée*/
|
|
81
|
+
export const handleBeforeSaveCallback = (beforeSaveCallback,successCb,arg)=>{
|
|
82
|
+
let bF = typeof beforeSaveCallback =='function'? beforeSaveCallback(arg) : undefined;
|
|
83
|
+
successCb = typeof successCb =='function'? successCb : x => x;
|
|
84
|
+
if(bF === false) return;
|
|
85
|
+
if(isPromise(bF)){
|
|
86
|
+
bF.then((result)=>{
|
|
87
|
+
if(result === false) return;
|
|
88
|
+
if(isNonNullString(result)){
|
|
89
|
+
notify.error(result);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
successCb(arg);
|
|
93
|
+
}).catch((e)=>{
|
|
94
|
+
console.log(e,' form-list-saving-data')
|
|
95
|
+
if(isNonNullString(e)){
|
|
96
|
+
notify.error(e);
|
|
97
|
+
} else if(e){
|
|
98
|
+
let ms = defaultStr(e.msg,e.message);
|
|
99
|
+
if(isNonNullString(ms)){
|
|
100
|
+
notify.error(ms);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
return arg;
|
|
105
|
+
} else if(isNonNullString(bF)){
|
|
106
|
+
notify.error(bF);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
successCb(arg);
|
|
110
|
+
return bF;
|
|
111
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {isIos} from "$cplatform";
|
|
2
|
+
import {KeyboardAvoidingView,StyleSheet} from 'react-native';
|
|
3
|
+
|
|
4
|
+
export default function KeyboardAvoidingViewComponent({ children,...rest }){
|
|
5
|
+
return isIos() ? (
|
|
6
|
+
<KeyboardAvoidingView
|
|
7
|
+
style={styles.wrapper}
|
|
8
|
+
behavior="padding"
|
|
9
|
+
keyboardVerticalOffset={80}
|
|
10
|
+
{...rest}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
</KeyboardAvoidingView>
|
|
14
|
+
) : (
|
|
15
|
+
<>{children}</>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
wrapper: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { findMatchedKey} from './keyEvents';
|
|
4
|
+
import View from "$ecomponents/View";
|
|
5
|
+
import {isWeb} from "$cplatform";
|
|
6
|
+
|
|
7
|
+
let exclusiveHandlers = [];
|
|
8
|
+
|
|
9
|
+
export default class KeyboardEventHandler extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
|
|
13
|
+
this.registerExclusiveHandler = this.registerExclusiveHandler.bind(this);
|
|
14
|
+
this.deregisterExclusiveHandler = this.deregisterExclusiveHandler.bind(this);
|
|
15
|
+
this.childRef = React.createRef(null);
|
|
16
|
+
Object.defineProperties(this,{
|
|
17
|
+
events : {
|
|
18
|
+
value : {
|
|
19
|
+
onKeyEvent : this.handleKeyboardEvent.bind(this),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
isFilter(){
|
|
25
|
+
return this.props.isFilter;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidUpdate(prevProps) {
|
|
29
|
+
const { isExclusive, isDisabled } = prevProps;
|
|
30
|
+
const hasChanged = this.props.isExclusive !== isExclusive ||
|
|
31
|
+
this.props.isDisabled !== isDisabled;
|
|
32
|
+
|
|
33
|
+
if (hasChanged) {
|
|
34
|
+
if (this.props.isExclusive && !this.props.isDisabled) {
|
|
35
|
+
this.registerExclusiveHandler();
|
|
36
|
+
} else {
|
|
37
|
+
this.deregisterExclusiveHandler();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
registerExclusiveHandler() {
|
|
43
|
+
this.deregisterExclusiveHandler();
|
|
44
|
+
exclusiveHandlers.unshift(this);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
deregisterExclusiveHandler() {
|
|
48
|
+
if (exclusiveHandlers.includes(this)) {
|
|
49
|
+
exclusiveHandlers = exclusiveHandlers.filter(h => h !== this);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
handleKeyboardEvent(event) {
|
|
54
|
+
const {
|
|
55
|
+
isDisabled,disabled,readOnly, handleKeys, onKeyEvent, handleEventType, children, handleFocusableElements,
|
|
56
|
+
} = this.props;
|
|
57
|
+
if (isDisabled || disabled || readOnly) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const isEventTypeMatched = !handleEventType?true : handleEventType === event.type;
|
|
61
|
+
if (!isEventTypeMatched) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const isEligibleEvent = event.target === isWeb() && typeof document !=='undefined' && document.body ? document.body : handleFocusableElements;
|
|
65
|
+
const isChildrenEvent = this.childRef.current && typeof this.childRef.current.contains =='function' && this.childRef.current.contains(event.target);
|
|
66
|
+
const isValidSource = children ? isChildrenEvent : isEligibleEvent;
|
|
67
|
+
if (!isValidSource) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const matchedKey = findMatchedKey(event, handleKeys);
|
|
71
|
+
if (matchedKey) {
|
|
72
|
+
event.formFieldName = this.props.formFieldName;
|
|
73
|
+
event.testID = this.props.testID;
|
|
74
|
+
onKeyEvent(matchedKey, event);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
let { children,isFilter,innerRef,handleKeys,isDisabled,disabled, readOnly,onKeyEvent,handleEventType,handleFocusableElements,...rest} = this.props;
|
|
83
|
+
rest = Object.assign({},rest);
|
|
84
|
+
const events = isDisabled || disabled || readOnly || isFilter ? {} : {
|
|
85
|
+
//onKeyDown : this.events.onKeyEvent,
|
|
86
|
+
//onKeyUp : this.events.onKeyEvent,
|
|
87
|
+
onKeyPress : this.events.onKeyEvent,
|
|
88
|
+
}
|
|
89
|
+
if(typeof children =='function'){
|
|
90
|
+
children = children(events);
|
|
91
|
+
}
|
|
92
|
+
if(!React.isValidElement(children)) return null;
|
|
93
|
+
return <View {...rest} ref={React.mergeRefs(this.childRef,innerRef)}>
|
|
94
|
+
{children}
|
|
95
|
+
</View>
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
KeyboardEventHandler.propTypes = {
|
|
100
|
+
handleKeys: PropTypes.array,
|
|
101
|
+
handleEventType: PropTypes.oneOf(['keydown', 'keyup', 'keypress']),
|
|
102
|
+
handleFocusableElements: PropTypes.bool,
|
|
103
|
+
onKeyEvent: PropTypes.func,
|
|
104
|
+
isDisabled: PropTypes.bool,
|
|
105
|
+
isExclusive: PropTypes.bool,
|
|
106
|
+
children: PropTypes.any,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
KeyboardEventHandler.defaultProps = {
|
|
110
|
+
handleKeys: [],
|
|
111
|
+
handleFocusableElements: false,
|
|
112
|
+
//handleEventType: 'keypress',
|
|
113
|
+
handleEventType: undefined,
|
|
114
|
+
onKeyEvent: () => null,
|
|
115
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const commonKeys = {
|
|
2
|
+
backspace: [8],
|
|
3
|
+
del: [46],
|
|
4
|
+
delete: [46],
|
|
5
|
+
ins: [45],
|
|
6
|
+
insert: [45],
|
|
7
|
+
tab: [9],
|
|
8
|
+
enter: [13],
|
|
9
|
+
return: [13],
|
|
10
|
+
esc: [27],
|
|
11
|
+
space: [32],
|
|
12
|
+
pageup: [33],
|
|
13
|
+
pagedown: [34],
|
|
14
|
+
end: [35],
|
|
15
|
+
home: [36],
|
|
16
|
+
left: [37],
|
|
17
|
+
up: [38],
|
|
18
|
+
right: [39],
|
|
19
|
+
down: [40],
|
|
20
|
+
shift: [16],
|
|
21
|
+
ctrl: [17],
|
|
22
|
+
alt: [18],
|
|
23
|
+
cap: [20],
|
|
24
|
+
num: [144],
|
|
25
|
+
clear: [12],
|
|
26
|
+
meta: [91],
|
|
27
|
+
';': [186, 59],
|
|
28
|
+
'=': [187, 61],
|
|
29
|
+
',': [188, 44],
|
|
30
|
+
'-': [189, 45, 173, 109],
|
|
31
|
+
'minus': [189, 45, 173, 109],
|
|
32
|
+
'.': [190, 110],
|
|
33
|
+
'/': [191, 111],
|
|
34
|
+
'`': [192],
|
|
35
|
+
'[': [219],
|
|
36
|
+
'\\': [220],
|
|
37
|
+
']': [221],
|
|
38
|
+
'*': [106],
|
|
39
|
+
'+': [107],
|
|
40
|
+
'plus': [107],
|
|
41
|
+
'\'': [222],
|
|
42
|
+
'quote': [222],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const commonKeysInUpperCases = Object.keys(commonKeys)
|
|
46
|
+
.reduce((accumulator, current) =>
|
|
47
|
+
Object.assign(accumulator, { [current.toUpperCase()]: commonKeys[current] }), {});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const numberKeys = '0123456789'.split('')
|
|
51
|
+
.reduce((accumulator, current, index) =>
|
|
52
|
+
Object.assign(accumulator, { [current]: [index + 48, index + 96] }), {});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const letterKeys = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
|
|
56
|
+
.reduce((accumulator, current, index) =>
|
|
57
|
+
Object.assign(
|
|
58
|
+
accumulator,
|
|
59
|
+
{ [current.toLowerCase()]: [index + 65] },
|
|
60
|
+
{ [current]: [index + 65] }), {});
|
|
61
|
+
|
|
62
|
+
const fnKeys = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19'.split(',')
|
|
63
|
+
.reduce((accumulator, current, index) =>
|
|
64
|
+
Object.assign(accumulator, { [`f${current}`]: [index + 112] }), {});
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const modifierKeys = {
|
|
68
|
+
control: 'ctrl',
|
|
69
|
+
ctrl: 'ctrl',
|
|
70
|
+
shift: 'shift',
|
|
71
|
+
meta: 'meta',
|
|
72
|
+
cmd: 'meta',
|
|
73
|
+
command: 'meta',
|
|
74
|
+
option: 'alt',
|
|
75
|
+
alt: 'alt',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const AllKeys = Object.assign({}, commonKeys, commonKeysInUpperCases, numberKeys, letterKeys, fnKeys);
|
|
79
|
+
const alphanumericKeys = Object.assign({}, numberKeys, letterKeys);
|
|
80
|
+
|
|
81
|
+
const aliasKeys = {
|
|
82
|
+
all: Object.keys(AllKeys),
|
|
83
|
+
alphanumeric: Object.keys(alphanumericKeys),
|
|
84
|
+
numeric: Object.keys(numberKeys),
|
|
85
|
+
alphabetic: Object.keys(letterKeys),
|
|
86
|
+
function: Object.keys(fnKeys),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export function matchKeyEvent(event, keyName) {
|
|
90
|
+
const eventKeyCode = event.which || event.keyCode;
|
|
91
|
+
const eventType = event.type;
|
|
92
|
+
const eventModifiers = Object.keys(modifierKeys).filter(modKey => event[`${modKey}Key`]).sort();
|
|
93
|
+
const cleanKeyName = keyName.toLowerCase().trim();
|
|
94
|
+
const keyNameParts = cleanKeyName === '+' ? ['+'] : cleanKeyName.split(/\s?\+\s?/); // e.g. 'crtl + a'
|
|
95
|
+
const mainKeyName = keyNameParts.pop();
|
|
96
|
+
const mainKeyCode = AllKeys[mainKeyName];
|
|
97
|
+
const modifierKeyNames = keyNameParts;
|
|
98
|
+
|
|
99
|
+
if (eventType === 'keypress') {
|
|
100
|
+
const eventKeyCodeString = String.fromCharCode(eventKeyCode);
|
|
101
|
+
return keyName == eventKeyCodeString.toLowerCase();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (mainKeyCode && modifierKeyNames.length === 0 && eventModifiers.length === 0) {
|
|
105
|
+
return mainKeyCode.indexOf(eventKeyCode) >= 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (mainKeyCode && modifierKeyNames.length > 0 && eventModifiers.length > 0) {
|
|
109
|
+
const modifiers = modifierKeyNames.map(modKey => modifierKeys[modKey]).sort();
|
|
110
|
+
const modifiersMatched = modifiers.length === eventModifiers.length &&
|
|
111
|
+
modifiers.every((modKey, index) => eventModifiers[index] === modKey);
|
|
112
|
+
|
|
113
|
+
return mainKeyCode.indexOf(eventKeyCode) >= 0 && modifiersMatched;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (modifierKeyNames.length == 0 && eventModifiers.length === 1) {
|
|
117
|
+
return mainKeyName === eventModifiers[0];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function findMatchedKey(event, keys) {
|
|
124
|
+
const lookupAlias = (k) => {
|
|
125
|
+
const lowerK = k.toLowerCase();
|
|
126
|
+
const found = aliasKeys[lowerK];
|
|
127
|
+
return found ? found : [k];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const expandedKeys = keys.map(lookupAlias).reduce((a, b) => a.concat(b), []);
|
|
131
|
+
|
|
132
|
+
let matchedKey = expandedKeys.find(k => matchKeyEvent(event, k));
|
|
133
|
+
|
|
134
|
+
if (!matchedKey && keys.includes('all')) {
|
|
135
|
+
matchedKey = 'other';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return matchedKey;
|
|
139
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
for web usage @see : https://github.com/linsight/react-keyboard-event-handler
|