j1-template 2021.2.1 → 2021.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +6 -1
- data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +7 -0
- data/_includes/themes/j1/modules/connectors/translators/google-translator.html +11 -23
- data/_layouts/default.html +31 -25
- data/assets/data/cookieconsent.html +43 -33
- data/assets/data/msdropdown.json +155 -0
- data/assets/data/panel.html +1 -1
- data/assets/data/quicklinks.html +25 -4
- data/assets/data/translator.html +291 -0
- data/assets/data/translator_languages.json +142 -0
- data/assets/themes/j1/adapter/js/cookieConsent.js +41 -34
- data/assets/themes/j1/adapter/js/fam.js +1 -1
- data/assets/themes/j1/adapter/js/j1.js +205 -160
- data/assets/themes/j1/adapter/js/themer.js +2 -2
- data/assets/themes/j1/adapter/js/translator.js +492 -0
- data/assets/themes/j1/core/country-flags/1x1/ad.svg +148 -0
- data/assets/themes/j1/core/country-flags/1x1/ae.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/af.svg +81 -0
- data/assets/themes/j1/core/country-flags/1x1/ag.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/ai.svg +763 -0
- data/assets/themes/j1/core/country-flags/1x1/al.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/am.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/ao.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/aq.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/ar.svg +31 -0
- data/assets/themes/j1/core/country-flags/1x1/as.svg +33 -0
- data/assets/themes/j1/core/country-flags/1x1/at.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/au.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/aw.svg +186 -0
- data/assets/themes/j1/core/country-flags/1x1/ax.svg +18 -0
- data/assets/themes/j1/core/country-flags/1x1/az.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/ba.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/bb.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/bd.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/be.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/bf.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/bg.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/bh.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/bi.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/bj.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/bl.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/bm.svg +98 -0
- data/assets/themes/j1/core/country-flags/1x1/bn.svg +36 -0
- data/assets/themes/j1/core/country-flags/1x1/bo.svg +678 -0
- data/assets/themes/j1/core/country-flags/1x1/bq.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/br.svg +45 -0
- data/assets/themes/j1/core/country-flags/1x1/bs.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/bt.svg +89 -0
- data/assets/themes/j1/core/country-flags/1x1/bv.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/bw.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/by.svg +22 -0
- data/assets/themes/j1/core/country-flags/1x1/bz.svg +145 -0
- data/assets/themes/j1/core/country-flags/1x1/ca.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/cc.svg +19 -0
- data/assets/themes/j1/core/country-flags/1x1/cd.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/cf.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/cg.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/ch.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/ci.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/ck.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/cl.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/cm.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/cn.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/co.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/cr.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/cu.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/cv.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/cw.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/cx.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/cy.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/cz.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/de.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/dj.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/dk.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/dm.svg +152 -0
- data/assets/themes/j1/core/country-flags/1x1/do.svg +6745 -0
- data/assets/themes/j1/core/country-flags/1x1/dz.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/ec.svg +138 -0
- data/assets/themes/j1/core/country-flags/1x1/ee.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/eg.svg +38 -0
- data/assets/themes/j1/core/country-flags/1x1/eh.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/er.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/es-ca.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/es-ga.svg +189 -0
- data/assets/themes/j1/core/country-flags/1x1/es.svg +547 -0
- data/assets/themes/j1/core/country-flags/1x1/et.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/eu.svg +28 -0
- data/assets/themes/j1/core/country-flags/1x1/fi.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/fj.svg +125 -0
- data/assets/themes/j1/core/country-flags/1x1/fk.svg +93 -0
- data/assets/themes/j1/core/country-flags/1x1/fm.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/fo.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/fr.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/ga.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/gb-eng.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/gb-nir.svg +131 -0
- data/assets/themes/j1/core/country-flags/1x1/gb-sct.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/gb-wls.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/gb.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/gd.svg +27 -0
- data/assets/themes/j1/core/country-flags/1x1/ge.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/gf.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/gg.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/gh.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/gi.svg +32 -0
- data/assets/themes/j1/core/country-flags/1x1/gl.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/gm.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/gn.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/gp.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/gq.svg +23 -0
- data/assets/themes/j1/core/country-flags/1x1/gr.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/gs.svg +206 -0
- data/assets/themes/j1/core/country-flags/1x1/gt.svg +204 -0
- data/assets/themes/j1/core/country-flags/1x1/gu.svg +39 -0
- data/assets/themes/j1/core/country-flags/1x1/gw.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/gy.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/hk.svg +30 -0
- data/assets/themes/j1/core/country-flags/1x1/hm.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/hn.svg +18 -0
- data/assets/themes/j1/core/country-flags/1x1/hr.svg +56 -0
- data/assets/themes/j1/core/country-flags/1x1/ht.svg +116 -0
- data/assets/themes/j1/core/country-flags/1x1/hu.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/id.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ie.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/il.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/im.svg +36 -0
- data/assets/themes/j1/core/country-flags/1x1/in.svg +25 -0
- data/assets/themes/j1/core/country-flags/1x1/io.svg +140 -0
- data/assets/themes/j1/core/country-flags/1x1/iq.svg +10 -0
- data/assets/themes/j1/core/country-flags/1x1/ir.svg +219 -0
- data/assets/themes/j1/core/country-flags/1x1/is.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/it.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/je.svg +29 -0
- data/assets/themes/j1/core/country-flags/1x1/jm.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/jo.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/jp.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/ke.svg +23 -0
- data/assets/themes/j1/core/country-flags/1x1/kg.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/kh.svg +61 -0
- data/assets/themes/j1/core/country-flags/1x1/ki.svg +36 -0
- data/assets/themes/j1/core/country-flags/1x1/km.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/kn.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/kp.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/kr.svg +24 -0
- data/assets/themes/j1/core/country-flags/1x1/kw.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/ky.svg +70 -0
- data/assets/themes/j1/core/country-flags/1x1/kz.svg +23 -0
- data/assets/themes/j1/core/country-flags/1x1/la.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/lb.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/lc.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/li.svg +43 -0
- data/assets/themes/j1/core/country-flags/1x1/lk.svg +22 -0
- data/assets/themes/j1/core/country-flags/1x1/lr.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/ls.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/lt.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/lu.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/lv.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ly.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/ma.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/mc.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/md.svg +71 -0
- data/assets/themes/j1/core/country-flags/1x1/me.svg +118 -0
- data/assets/themes/j1/core/country-flags/1x1/mf.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/mg.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/mh.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/mk.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/ml.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/mm.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/mn.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/mo.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/mp.svg +86 -0
- data/assets/themes/j1/core/country-flags/1x1/mq.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/mr.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ms.svg +70 -0
- data/assets/themes/j1/core/country-flags/1x1/mt.svg +50 -0
- data/assets/themes/j1/core/country-flags/1x1/mu.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/mv.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/mw.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/mx.svg +378 -0
- data/assets/themes/j1/core/country-flags/1x1/my.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/mz.svg +21 -0
- data/assets/themes/j1/core/country-flags/1x1/na.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/nc.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/ne.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/nf.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/ng.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ni.svg +129 -0
- data/assets/themes/j1/core/country-flags/1x1/nl.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/no.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/np.svg +19 -0
- data/assets/themes/j1/core/country-flags/1x1/nr.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/nu.svg +26 -0
- data/assets/themes/j1/core/country-flags/1x1/nz.svg +41 -0
- data/assets/themes/j1/core/country-flags/1x1/om.svg +115 -0
- data/assets/themes/j1/core/country-flags/1x1/pa.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/pe.svg +244 -0
- data/assets/themes/j1/core/country-flags/1x1/pf.svg +18 -0
- data/assets/themes/j1/core/country-flags/1x1/pg.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/ph.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/pk.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/pl.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/pm.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/pn.svg +67 -0
- data/assets/themes/j1/core/country-flags/1x1/pr.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/ps.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/pt.svg +57 -0
- data/assets/themes/j1/core/country-flags/1x1/pw.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/py.svg +156 -0
- data/assets/themes/j1/core/country-flags/1x1/qa.svg +4 -0
- data/assets/themes/j1/core/country-flags/1x1/re.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/ro.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/rs.svg +296 -0
- data/assets/themes/j1/core/country-flags/1x1/ru.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/rw.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/sa.svg +26 -0
- data/assets/themes/j1/core/country-flags/1x1/sb.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/sc.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/sd.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/se.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/sg.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/sh.svg +81 -0
- data/assets/themes/j1/core/country-flags/1x1/si.svg +18 -0
- data/assets/themes/j1/core/country-flags/1x1/sj.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/sk.svg +9 -0
- data/assets/themes/j1/core/country-flags/1x1/sl.svg +12 -0
- data/assets/themes/j1/core/country-flags/1x1/sm.svg +89 -0
- data/assets/themes/j1/core/country-flags/1x1/sn.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/so.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/sr.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ss.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/st.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/sv.svg +596 -0
- data/assets/themes/j1/core/country-flags/1x1/sx.svg +56 -0
- data/assets/themes/j1/core/country-flags/1x1/sy.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/sz.svg +45 -0
- data/assets/themes/j1/core/country-flags/1x1/tc.svg +74 -0
- data/assets/themes/j1/core/country-flags/1x1/td.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/tf.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/tg.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/th.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/tj.svg +26 -0
- data/assets/themes/j1/core/country-flags/1x1/tk.svg +5 -0
- data/assets/themes/j1/core/country-flags/1x1/tl.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/tm.svg +203 -0
- data/assets/themes/j1/core/country-flags/1x1/tn.svg +13 -0
- data/assets/themes/j1/core/country-flags/1x1/to.svg +10 -0
- data/assets/themes/j1/core/country-flags/1x1/tr.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/tt.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/tv.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/tw.svg +14 -0
- data/assets/themes/j1/core/country-flags/1x1/tz.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/ua.svg +6 -0
- data/assets/themes/j1/core/country-flags/1x1/ug.svg +30 -0
- data/assets/themes/j1/core/country-flags/1x1/um.svg +15 -0
- data/assets/themes/j1/core/country-flags/1x1/un.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/us.svg +10 -0
- data/assets/themes/j1/core/country-flags/1x1/uy.svg +28 -0
- data/assets/themes/j1/core/country-flags/1x1/uz.svg +30 -0
- data/assets/themes/j1/core/country-flags/1x1/va.svg +479 -0
- data/assets/themes/j1/core/country-flags/1x1/vc.svg +8 -0
- data/assets/themes/j1/core/country-flags/1x1/ve.svg +26 -0
- data/assets/themes/j1/core/country-flags/1x1/vg.svg +128 -0
- data/assets/themes/j1/core/country-flags/1x1/vi.svg +28 -0
- data/assets/themes/j1/core/country-flags/1x1/vn.svg +11 -0
- data/assets/themes/j1/core/country-flags/1x1/vu.svg +18 -0
- data/assets/themes/j1/core/country-flags/1x1/wf.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/ws.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/xk.svg +16 -0
- data/assets/themes/j1/core/country-flags/1x1/ye.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/yt.svg +7 -0
- data/assets/themes/j1/core/country-flags/1x1/za.svg +17 -0
- data/assets/themes/j1/core/country-flags/1x1/zm.svg +27 -0
- data/assets/themes/j1/core/country-flags/1x1/zw.svg +21 -0
- data/assets/themes/j1/core/country-flags/4x3/ad.svg +150 -0
- data/assets/themes/j1/core/country-flags/4x3/ae.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/af.svg +81 -0
- data/assets/themes/j1/core/country-flags/4x3/ag.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/ai.svg +763 -0
- data/assets/themes/j1/core/country-flags/4x3/al.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/am.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/ao.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/aq.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/ar.svg +31 -0
- data/assets/themes/j1/core/country-flags/4x3/as.svg +33 -0
- data/assets/themes/j1/core/country-flags/4x3/at.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/au.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/aw.svg +186 -0
- data/assets/themes/j1/core/country-flags/4x3/ax.svg +18 -0
- data/assets/themes/j1/core/country-flags/4x3/az.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/ba.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/bb.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/bd.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/be.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/bf.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/bg.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/bh.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/bi.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/bj.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/bl.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/bm.svg +98 -0
- data/assets/themes/j1/core/country-flags/4x3/bn.svg +36 -0
- data/assets/themes/j1/core/country-flags/4x3/bo.svg +676 -0
- data/assets/themes/j1/core/country-flags/4x3/bq.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/br.svg +45 -0
- data/assets/themes/j1/core/country-flags/4x3/bs.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/bt.svg +89 -0
- data/assets/themes/j1/core/country-flags/4x3/bv.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/bw.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/by.svg +20 -0
- data/assets/themes/j1/core/country-flags/4x3/bz.svg +145 -0
- data/assets/themes/j1/core/country-flags/4x3/ca.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/cc.svg +19 -0
- data/assets/themes/j1/core/country-flags/4x3/cd.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/cf.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/cg.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/ch.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/ci.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/ck.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/cl.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/cm.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/cn.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/co.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/cr.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/cu.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/cv.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/cw.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/cx.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/cy.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/cz.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/de.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/dj.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/dk.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/dm.svg +152 -0
- data/assets/themes/j1/core/country-flags/4x3/do.svg +6745 -0
- data/assets/themes/j1/core/country-flags/4x3/dz.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/ec.svg +138 -0
- data/assets/themes/j1/core/country-flags/4x3/ee.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/eg.svg +38 -0
- data/assets/themes/j1/core/country-flags/4x3/eh.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/er.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/es-ca.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/es-ga.svg +189 -0
- data/assets/themes/j1/core/country-flags/4x3/es.svg +544 -0
- data/assets/themes/j1/core/country-flags/4x3/et.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/eu.svg +28 -0
- data/assets/themes/j1/core/country-flags/4x3/fi.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/fj.svg +122 -0
- data/assets/themes/j1/core/country-flags/4x3/fk.svg +90 -0
- data/assets/themes/j1/core/country-flags/4x3/fm.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/fo.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/fr.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/ga.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/gb-eng.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/gb-nir.svg +132 -0
- data/assets/themes/j1/core/country-flags/4x3/gb-sct.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/gb-wls.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/gb.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/gd.svg +27 -0
- data/assets/themes/j1/core/country-flags/4x3/ge.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/gf.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/gg.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/gh.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/gi.svg +32 -0
- data/assets/themes/j1/core/country-flags/4x3/gl.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/gm.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/gn.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/gp.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/gq.svg +23 -0
- data/assets/themes/j1/core/country-flags/4x3/gr.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/gs.svg +201 -0
- data/assets/themes/j1/core/country-flags/4x3/gt.svg +204 -0
- data/assets/themes/j1/core/country-flags/4x3/gu.svg +39 -0
- data/assets/themes/j1/core/country-flags/4x3/gw.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/gy.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/hk.svg +30 -0
- data/assets/themes/j1/core/country-flags/4x3/hm.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/hn.svg +18 -0
- data/assets/themes/j1/core/country-flags/4x3/hr.svg +58 -0
- data/assets/themes/j1/core/country-flags/4x3/ht.svg +116 -0
- data/assets/themes/j1/core/country-flags/4x3/hu.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/id.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ie.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/il.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/im.svg +36 -0
- data/assets/themes/j1/core/country-flags/4x3/in.svg +25 -0
- data/assets/themes/j1/core/country-flags/4x3/io.svg +138 -0
- data/assets/themes/j1/core/country-flags/4x3/iq.svg +10 -0
- data/assets/themes/j1/core/country-flags/4x3/ir.svg +219 -0
- data/assets/themes/j1/core/country-flags/4x3/is.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/it.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/je.svg +29 -0
- data/assets/themes/j1/core/country-flags/4x3/jm.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/jo.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/jp.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/ke.svg +23 -0
- data/assets/themes/j1/core/country-flags/4x3/kg.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/kh.svg +61 -0
- data/assets/themes/j1/core/country-flags/4x3/ki.svg +36 -0
- data/assets/themes/j1/core/country-flags/4x3/km.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/kn.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/kp.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/kr.svg +24 -0
- data/assets/themes/j1/core/country-flags/4x3/kw.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/ky.svg +63 -0
- data/assets/themes/j1/core/country-flags/4x3/kz.svg +23 -0
- data/assets/themes/j1/core/country-flags/4x3/la.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/lb.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/lc.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/li.svg +43 -0
- data/assets/themes/j1/core/country-flags/4x3/lk.svg +22 -0
- data/assets/themes/j1/core/country-flags/4x3/lr.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/ls.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/lt.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/lu.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/lv.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ly.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/ma.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/mc.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/md.svg +70 -0
- data/assets/themes/j1/core/country-flags/4x3/me.svg +116 -0
- data/assets/themes/j1/core/country-flags/4x3/mf.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/mg.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/mh.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/mk.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/ml.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/mm.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/mn.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/mo.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/mp.svg +86 -0
- data/assets/themes/j1/core/country-flags/4x3/mq.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/mr.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ms.svg +78 -0
- data/assets/themes/j1/core/country-flags/4x3/mt.svg +49 -0
- data/assets/themes/j1/core/country-flags/4x3/mu.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/mv.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/mw.svg +10 -0
- data/assets/themes/j1/core/country-flags/4x3/mx.svg +382 -0
- data/assets/themes/j1/core/country-flags/4x3/my.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/mz.svg +21 -0
- data/assets/themes/j1/core/country-flags/4x3/na.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/nc.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/ne.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/nf.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/ng.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ni.svg +129 -0
- data/assets/themes/j1/core/country-flags/4x3/nl.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/no.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/np.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/nr.svg +12 -0
- data/assets/themes/j1/core/country-flags/4x3/nu.svg +26 -0
- data/assets/themes/j1/core/country-flags/4x3/nz.svg +41 -0
- data/assets/themes/j1/core/country-flags/4x3/om.svg +115 -0
- data/assets/themes/j1/core/country-flags/4x3/pa.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/pe.svg +244 -0
- data/assets/themes/j1/core/country-flags/4x3/pf.svg +19 -0
- data/assets/themes/j1/core/country-flags/4x3/pg.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/ph.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/pk.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/pl.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/pm.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/pn.svg +62 -0
- data/assets/themes/j1/core/country-flags/4x3/pr.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/ps.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/pt.svg +57 -0
- data/assets/themes/j1/core/country-flags/4x3/pw.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/py.svg +157 -0
- data/assets/themes/j1/core/country-flags/4x3/qa.svg +4 -0
- data/assets/themes/j1/core/country-flags/4x3/re.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/ro.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/rs.svg +292 -0
- data/assets/themes/j1/core/country-flags/4x3/ru.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/rw.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/sa.svg +26 -0
- data/assets/themes/j1/core/country-flags/4x3/sb.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/sc.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/sd.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/se.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/sg.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/sh.svg +74 -0
- data/assets/themes/j1/core/country-flags/4x3/si.svg +18 -0
- data/assets/themes/j1/core/country-flags/4x3/sj.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/sk.svg +9 -0
- data/assets/themes/j1/core/country-flags/4x3/sl.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/sm.svg +91 -0
- data/assets/themes/j1/core/country-flags/4x3/sn.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/so.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/sr.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ss.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/st.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/sv.svg +594 -0
- data/assets/themes/j1/core/country-flags/4x3/sx.svg +56 -0
- data/assets/themes/j1/core/country-flags/4x3/sy.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/sz.svg +45 -0
- data/assets/themes/j1/core/country-flags/4x3/tc.svg +67 -0
- data/assets/themes/j1/core/country-flags/4x3/td.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/tf.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/tg.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/th.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/tj.svg +22 -0
- data/assets/themes/j1/core/country-flags/4x3/tk.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/tl.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/tm.svg +206 -0
- data/assets/themes/j1/core/country-flags/4x3/tn.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/to.svg +10 -0
- data/assets/themes/j1/core/country-flags/4x3/tr.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/tt.svg +5 -0
- data/assets/themes/j1/core/country-flags/4x3/tv.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/tw.svg +14 -0
- data/assets/themes/j1/core/country-flags/4x3/tz.svg +13 -0
- data/assets/themes/j1/core/country-flags/4x3/ua.svg +6 -0
- data/assets/themes/j1/core/country-flags/4x3/ug.svg +30 -0
- data/assets/themes/j1/core/country-flags/4x3/um.svg +15 -0
- data/assets/themes/j1/core/country-flags/4x3/un.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/us.svg +10 -0
- data/assets/themes/j1/core/country-flags/4x3/uy.svg +28 -0
- data/assets/themes/j1/core/country-flags/4x3/uz.svg +30 -0
- data/assets/themes/j1/core/country-flags/4x3/va.svg +479 -0
- data/assets/themes/j1/core/country-flags/4x3/vc.svg +8 -0
- data/assets/themes/j1/core/country-flags/4x3/ve.svg +26 -0
- data/assets/themes/j1/core/country-flags/4x3/vg.svg +127 -0
- data/assets/themes/j1/core/country-flags/4x3/vi.svg +28 -0
- data/assets/themes/j1/core/country-flags/4x3/vn.svg +11 -0
- data/assets/themes/j1/core/country-flags/4x3/vu.svg +18 -0
- data/assets/themes/j1/core/country-flags/4x3/wf.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/ws.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/xk.svg +16 -0
- data/assets/themes/j1/core/country-flags/4x3/ye.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/yt.svg +7 -0
- data/assets/themes/j1/core/country-flags/4x3/za.svg +17 -0
- data/assets/themes/j1/core/country-flags/4x3/zm.svg +27 -0
- data/assets/themes/j1/core/country-flags/4x3/zw.svg +21 -0
- data/assets/themes/j1/core/country-flags/css/theme/uno.css +73 -0
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +3 -4
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/vendor.css +1400 -0
- data/assets/themes/j1/core/css/vendor.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +8502 -10
- data/assets/themes/j1/core/js/template.min.js +16 -7
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +49 -42
- data/assets/themes/j1/modules/j1Deepl/js/j1deepl.js +388 -0
- data/assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js +18 -0
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.js +257 -240
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js +1 -2
- data/assets/themes/j1/modules/lightGallery/js/modules/lg-thumbnail.js +16 -8
- data/assets/themes/j1/modules/msDropdown/css/flags.css +1033 -0
- data/assets/themes/j1/modules/msDropdown/css/flags.min.css +23 -0
- data/assets/themes/j1/modules/msDropdown/css/msDropdown.css +278 -0
- data/assets/themes/j1/modules/msDropdown/css/msDropdown.min.css +34 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/1273404841_tick_16.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Amex-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Cash-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Discover-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Mastercard-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Paypal-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/Visa-56.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/blank.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/browser-chrome.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/browser-firefox.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/browser-msie.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/browser-opera.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/browser-safari.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/button-large.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/demoaction.jpg +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/enabled.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/flagssprite_small.png +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/giftlelo_dot_com.jpg +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon-search.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_calendar.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_cart.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_cd.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_email.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_faq.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_games.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_lockopen.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_music.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_phone.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_sales.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_secure.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/icon_video.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/jquery-msdropdown.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/msDropDown.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/preview.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/sprite.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/sprite.jpg +0 -0
- data/assets/themes/j1/modules/msDropdown/images/icons/tick.gif +0 -0
- data/assets/themes/j1/modules/msDropdown/js/msDropdown.js +2664 -0
- data/assets/themes/j1/modules/msDropdown/js/msDropdown.min.js +33 -0
- data/assets/themes/j1/modules/msDropdown/js/msDropdown.min.js.map +1 -0
- data/assets/themes/j1/modules/translator/css/translator.css +33 -0
- data/assets/themes/j1/modules/translator/css/translator.min.css +15 -0
- data/assets/themes/j1/modules/translator/js/translator.js +614 -0
- data/assets/themes/j1/modules/translator/js/translator.min.js +15 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/j1_config.yml +4 -7
- data/lib/starter_web/_data/layouts/collection.yml +1 -12
- data/lib/starter_web/_data/layouts/home.yml +0 -12
- data/lib/starter_web/_data/layouts/post.yml +0 -11
- data/lib/starter_web/_data/modules/cookieconsent.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +100 -90
- data/lib/starter_web/_data/modules/defaults/navigator.yml +1 -0
- data/lib/starter_web/_data/modules/defaults/translator.yml +142 -0
- data/lib/starter_web/_data/modules/navigator_menu.yml +3 -3
- data/lib/starter_web/_data/modules/translator.yml +31 -0
- data/lib/starter_web/_data/resources.yml +125 -100
- data/lib/starter_web/_includes/attributes.asciidoc +12 -2
- data/lib/starter_web/_plugins/asciidoctor-extensions/flag-icon-inline.rb +37 -0
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/modules/attics/markus-krisetya-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/vladislav-klapin-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/vladislav-klapin-2-1920x1280.jpg +0 -0
- data/lib/starter_web/package.json +2 -2
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +0 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +0 -8
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +3 -2
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +9 -32
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +0 -22
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +0 -20
- data/lib/starter_web/pages/public/blog/navigator/archive.html +0 -22
- data/lib/starter_web/pages/public/learn/quickstart.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +7 -3
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +3 -1
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +30 -28
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +112 -10
- data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +8 -5
- data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +4 -2
- data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +6 -8
- data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +1 -2
- data/lib/starter_web/pages/public/learn/roundtrip/_includes/attributes.asciidoc +42 -43
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +15 -15
- data/lib/starter_web/pages/public/legal/de/100_copyright.adoc +0 -1
- data/lib/starter_web/pages/public/legal/de/100_impress.adoc +0 -2
- data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +0 -1
- data/lib/starter_web/pages/public/legal/de/400_comment_policy.adoc +0 -1
- data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +0 -3
- data/lib/starter_web/pages/public/legal/en/200_impress.adoc +0 -3
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +0 -2
- data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +1 -2
- data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +743 -0
- data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +2 -0
- data/lib/starter_web/pages/public/previewer/{bootstrap_theme.adoc → preview_bootstrap_theme.adoc} +1 -2
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +581 -6
- data/assets/themes/j1/core/js/template.js.map +0 -1
- data/assets/themes/j1/modules/lightGallery/js/modules/lg-video.js +0 -342
- data/assets/themes/j1/modules/lightGallery/js/modules/lg-video.min.js +0 -5
@@ -0,0 +1,2664 @@
|
|
1
|
+
/*
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# ~/assets/themes/j1/modules/msDropdown/js/msDropdown.js
|
4
|
+
# Provides JS Core and API for MSDropdown
|
5
|
+
#
|
6
|
+
# Product/Info:
|
7
|
+
# http://jekyll.one
|
8
|
+
# https://www.marghoobsuleman.com/
|
9
|
+
#
|
10
|
+
# Copyright (C) 2021 Juergen Adams
|
11
|
+
#
|
12
|
+
# msDropdown is licensed under MIT License.
|
13
|
+
# See: https://github.com/marghoobsuleman/ms-Dropdown/blob/master/MIT-LICENSE.txt
|
14
|
+
# J1 Template is licensed under MIT License.
|
15
|
+
# See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
|
16
|
+
# -----------------------------------------------------------------------------
|
17
|
+
# NOTE:
|
18
|
+
# https://github.com/marghoobsuleman/ms-Dropdown
|
19
|
+
# https://www.marghoobsuleman.com/image-dropdown/help
|
20
|
+
# https://www.marghoobsuleman.com/image-dropdown/advanced-help
|
21
|
+
# -----------------------------------------------------------------------------
|
22
|
+
|
23
|
+
/*!
|
24
|
+
* /**
|
25
|
+
* * MSDropdown - msDropdown.js
|
26
|
+
* * @author: Marghoob Suleman
|
27
|
+
* * @website: https://www.marghoobsuleman.com/
|
28
|
+
* * @version: 4.0.2
|
29
|
+
* * @date: Sun Oct 24 2021 10:46:05 GMT+0200 (GMT+02:00)
|
30
|
+
* * msDropdown is free web component: you can redistribute it and/or modify
|
31
|
+
* * it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
|
32
|
+
* * /
|
33
|
+
*//******/ (() => { // webpackBootstrap
|
34
|
+
/******/ "use strict";
|
35
|
+
var __webpack_exports__ = {};
|
36
|
+
|
37
|
+
;// CONCATENATED MODULE: ./src/js/lib/ddmaker.js
|
38
|
+
/**
|
39
|
+
* MSDropdown - ddmaker.js
|
40
|
+
* @author: Marghoob Suleman
|
41
|
+
* @website: https://www.marghoobsuleman.com/
|
42
|
+
* @version: 4.0.3
|
43
|
+
* @revision: 6
|
44
|
+
* @date: 21st Sep 2021
|
45
|
+
* msDropdown is free web component: you can redistribute it and/or modify
|
46
|
+
* it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
|
47
|
+
*/
|
48
|
+
|
49
|
+
let _oldC = null;
|
50
|
+
class ddMaker {
|
51
|
+
|
52
|
+
constructor(ele, settings) {
|
53
|
+
let defaultSettings = {
|
54
|
+
byJson: {
|
55
|
+
data: null, selectedIndex: 0, name: null,
|
56
|
+
size: 0, multiple: false, width: 250
|
57
|
+
},
|
58
|
+
mainCss: 'ms-dd',
|
59
|
+
rowHeight: null,
|
60
|
+
visibleRows: null,
|
61
|
+
showIcon: true,
|
62
|
+
zIndex: 9999,
|
63
|
+
event:'click',
|
64
|
+
style: '',
|
65
|
+
childWidth:null,
|
66
|
+
childHeight:null,
|
67
|
+
enableCheckbox:false, //this needs to be multiple or it will set the element to multiple
|
68
|
+
checkboxNameSuffix:'_mscheck',
|
69
|
+
showPlusItemCounter:true,
|
70
|
+
enableAutoFilter:true,
|
71
|
+
showFilterAlways:false,
|
72
|
+
showListCounter:false,
|
73
|
+
imagePosition:'left',
|
74
|
+
errorMessage:'Please select an item from this list',
|
75
|
+
on: {create: null,open: null,close: null,add: null,remove: null,change: null,blur: null,click: null,dblclick: null,mousemove: null,mouseover: null,mouseout: null,focus: null,mousedown: null,mouseup: null}
|
76
|
+
};
|
77
|
+
this.ele = ele;
|
78
|
+
//merge with data settings
|
79
|
+
this._settings = {...defaultSettings, ...settings};
|
80
|
+
this._css = {};
|
81
|
+
this._onDocumentClick = null; this._onDocumentKeyDown = null; this._onDocumentKeyUp = null;
|
82
|
+
this._isOpen = false;
|
83
|
+
this._DOWN_ARROW = 40; this._UP_ARROW = 38; this._LEFT_ARROW=37; this._RIGHT_ARROW=39;
|
84
|
+
this._ESCAPE = 27; this._ENTER = 13; this._ALPHABETS_START = 47; this._SHIFT=16;
|
85
|
+
this._CONTROL = 17; this._MAC_CONTROL = 91; this._BACKSPACE=8; this._DELETE=46; this._SPACE=32;
|
86
|
+
this._shiftHolded = false; this._controlHolded = false;
|
87
|
+
this._isFirstTime = true; this._cacheEle = {};
|
88
|
+
this._isMouseDown = false; this._itemsArr = [];
|
89
|
+
|
90
|
+
this._css = {dd:this._settings.mainCss+ " ms-pr",
|
91
|
+
wrapperDisabled:'disabled',
|
92
|
+
headerA:"ms-list-option option-selected",
|
93
|
+
header: 'ms-dd-header',
|
94
|
+
headerMiddleContent: 'ms-header-middle-content',
|
95
|
+
arrow: 'ms-dd-arrow',
|
96
|
+
arrowDown: 'ms-dd-pointer-down',
|
97
|
+
arrowUp: 'ms-dd-pointer-up',
|
98
|
+
headerCounter:'ms-header-counter',
|
99
|
+
listOfItems: 'ms-options',
|
100
|
+
itemContent:'ms-dd-option-content',
|
101
|
+
item: 'ms-list-option',
|
102
|
+
itemSpan:'ms-middle',
|
103
|
+
itemSpanOpt:'ms-optgroup-padding',
|
104
|
+
itemLabel:'ms-dd-label',
|
105
|
+
itemImage:'ms-dd-option-image',
|
106
|
+
itemDesc: 'ms-dd-desc',
|
107
|
+
itemSelected: 'option-selected',
|
108
|
+
itemDisabled:'disabled',
|
109
|
+
itemEnabled:'enabled',
|
110
|
+
optgroup: "ms-optgroup",
|
111
|
+
listCounter:'ms-list-counter',
|
112
|
+
valueInput:'ms-value-input',
|
113
|
+
checkbox:'ms-checkbox',
|
114
|
+
imageRight:'ico-align-right'
|
115
|
+
};
|
116
|
+
|
117
|
+
//init
|
118
|
+
this._wrapper = {};
|
119
|
+
this._createByJson();
|
120
|
+
this._checkDataSettings();
|
121
|
+
this._isList = (this.ele.size>1);
|
122
|
+
this._isMultiple = this.ele.multiple;
|
123
|
+
|
124
|
+
this._enableCheckbox = this._settings.enableCheckbox;
|
125
|
+
|
126
|
+
if (this._isList || this._enableCheckbox.toString() === "true") {
|
127
|
+
this._isMultiple = this.ele.multiple = true;
|
128
|
+
}
|
129
|
+
|
130
|
+
this._isFilterApplied = false;
|
131
|
+
this._nexPrevCounter = 0;
|
132
|
+
|
133
|
+
this._init();
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Init
|
139
|
+
* @private
|
140
|
+
*/
|
141
|
+
_init() {
|
142
|
+
//console.log(this.name, this.selectedIndex)
|
143
|
+
this._makeLayout();
|
144
|
+
|
145
|
+
this._updateUiAndValueByIndex(this.selectedIndex);
|
146
|
+
|
147
|
+
if(this.ele.size > 1) {
|
148
|
+
this._makeUiAsList(true, this.ele.size);
|
149
|
+
this._scrollToItem();
|
150
|
+
}
|
151
|
+
|
152
|
+
//adjust child width
|
153
|
+
if(this._settings.childWidth !== null) {
|
154
|
+
this._wrapper.listOfItems.style.width = this._settings.childWidth;
|
155
|
+
}
|
156
|
+
//hide original
|
157
|
+
this._showHideOriginal(false);
|
158
|
+
|
159
|
+
|
160
|
+
if(this._settings.showFilterAlways.toString() === "true") {
|
161
|
+
this._settings.enableAutoFilter = true;
|
162
|
+
this._showHideFilterBox(true);
|
163
|
+
}
|
164
|
+
|
165
|
+
if(this.ele.autofocus) {
|
166
|
+
this._wrapper.holder.focus();
|
167
|
+
this._wrapper.filterInput.focus();
|
168
|
+
} else {
|
169
|
+
this._wrapper.filterInput.blur();
|
170
|
+
}
|
171
|
+
|
172
|
+
this.updateUiAndValue();
|
173
|
+
|
174
|
+
this._fireLocalEventIfExist("create");
|
175
|
+
this._fireEventIfExist("onCreate");
|
176
|
+
}
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Show hide Original
|
180
|
+
* @param isShow
|
181
|
+
* @private
|
182
|
+
*/
|
183
|
+
_showHideOriginal(isShow=true) {
|
184
|
+
if(isShow) {
|
185
|
+
this._show(this.ele);
|
186
|
+
} else {
|
187
|
+
this._hide(this.ele);
|
188
|
+
}
|
189
|
+
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Check data settings.
|
194
|
+
* Read from select data-* attributes
|
195
|
+
* @private
|
196
|
+
*/
|
197
|
+
_checkDataSettings() {
|
198
|
+
let dataSet = this._getDataSet(this.ele);
|
199
|
+
let settings = this._settings;
|
200
|
+
settings.mainCss = dataSet?.mainCss || settings.mainCss;
|
201
|
+
settings.showIcon = dataSet?.showIcon || settings.showIcon;
|
202
|
+
settings.event = dataSet?.event || settings.event;
|
203
|
+
settings.childWidth = dataSet?.childWidth || settings.childWidth;
|
204
|
+
settings.childHeight = dataSet?.childHeight || settings.childHeight;
|
205
|
+
settings.enableCheckbox = dataSet?.enableCheckbox || settings.enableCheckbox;
|
206
|
+
settings.checkboxNameSuffix = dataSet?.checkboxNameSuffix || settings.checkboxNameSuffix;
|
207
|
+
/*settings.append = dataSet.append || settings.append;
|
208
|
+
settings.prepend = dataSet.prepend || settings.prepend;*/
|
209
|
+
settings.enableAutoFilter = dataSet?.enableAutoFilter || settings.enableAutoFilter;
|
210
|
+
settings.visibleRows = dataSet?.visibleRows || settings.visibleRows;
|
211
|
+
settings.showPlusItemCounter = dataSet?.showPlusItemCounter || settings.showPlusItemCounter;
|
212
|
+
settings.errorMessage = dataSet?.errorMessage || settings.errorMessage;
|
213
|
+
settings.showFilterAlways = dataSet?.showFilterAlways || settings.showFilterAlways;
|
214
|
+
settings.showListCounter = dataSet?.showListCounter || settings.showListCounter;
|
215
|
+
settings.imagePosition = dataSet?.imagePosition || settings.imagePosition;
|
216
|
+
|
217
|
+
this._settings = {...this._settings, ...settings};
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Set setting attribute
|
223
|
+
* @param key
|
224
|
+
* @param value
|
225
|
+
*/
|
226
|
+
setSettingAttribute(key, value) {
|
227
|
+
this._settings[key] = value;
|
228
|
+
}
|
229
|
+
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Create by json
|
233
|
+
* @private
|
234
|
+
*/
|
235
|
+
_createByJson() {
|
236
|
+
if (this._settings.byJson.data) {
|
237
|
+
try {
|
238
|
+
let json = this._settings.byJson;
|
239
|
+
//this._settings.byJson.data = settings.byJson.data;
|
240
|
+
//change element
|
241
|
+
let obj = {};
|
242
|
+
obj.name = json.name || this.ele.id || "";
|
243
|
+
if (json.size>0) {
|
244
|
+
obj.size = json.size;
|
245
|
+
}
|
246
|
+
if(json.multiple) {
|
247
|
+
obj.multiple = json.multiple;
|
248
|
+
}
|
249
|
+
|
250
|
+
let oSelect = this._createEle("select", obj);
|
251
|
+
let total = json.data.length;
|
252
|
+
for(let i=0;i<total;i++) {
|
253
|
+
let current = json.data[i];
|
254
|
+
let opt = new Option(current.text, current.value);
|
255
|
+
if(current.disabled) {
|
256
|
+
opt.disabled = true;
|
257
|
+
}
|
258
|
+
for(let p in current) {
|
259
|
+
if (current.hasOwnProperty(p) && p.toLowerCase() !== 'text') {
|
260
|
+
let key = `data-${p}`;
|
261
|
+
key = key.replace(/([A-Z])/g, "-$1").toLowerCase(); //replace caps letter with -letter
|
262
|
+
opt.setAttribute(key, current[p]);
|
263
|
+
}
|
264
|
+
}
|
265
|
+
oSelect.options[i] = opt;
|
266
|
+
}
|
267
|
+
//add this
|
268
|
+
this.ele.appendChild(oSelect);
|
269
|
+
|
270
|
+
oSelect.selectedIndex = json.selectedIndex;
|
271
|
+
if(json.width) {
|
272
|
+
this.ele.style.width = json.width+'px';
|
273
|
+
}
|
274
|
+
|
275
|
+
//now change element for the base ele
|
276
|
+
this.ele = oSelect;
|
277
|
+
|
278
|
+
} catch(e) {
|
279
|
+
throw "There is an error in json data.";
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Scroll to item
|
286
|
+
* @param item
|
287
|
+
* @param behavior
|
288
|
+
*/
|
289
|
+
_scrollToItem(item, behavior='smooth') {
|
290
|
+
item = item || this.uiData.ui;
|
291
|
+
if(item) {
|
292
|
+
item = item.length > 1 ? item[0] : item;
|
293
|
+
this._scrollToIfNeeded(item);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Show filter box
|
299
|
+
* @param isShow
|
300
|
+
* @private
|
301
|
+
*/
|
302
|
+
_showHideFilterBox(isShow=true) {
|
303
|
+
if(isShow) {
|
304
|
+
this._show(this._wrapper.filterHolder);
|
305
|
+
this._wrapper.filterInput.focus();
|
306
|
+
if(this._settings.showFilterAlways.toString() === "false") {
|
307
|
+
this._hide(this._wrapper.headerA);
|
308
|
+
}
|
309
|
+
} else {
|
310
|
+
this._wrapper.filterInput.value = "";
|
311
|
+
this._hide(this._wrapper.filterHolder);
|
312
|
+
this._show(this._wrapper.headerA);
|
313
|
+
}
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Apply filters
|
319
|
+
* @param e
|
320
|
+
* @private
|
321
|
+
*/
|
322
|
+
_applyFilters(e) {
|
323
|
+
let sText = this._wrapper.filterInput.value;
|
324
|
+
if (sText.length === 0) {
|
325
|
+
this._show(this._wrapper.headerA);
|
326
|
+
this._makeChildren();
|
327
|
+
this._isFilterApplied = false;
|
328
|
+
} else {
|
329
|
+
|
330
|
+
if(this._settings.showFilterAlways.toString() === "false") {
|
331
|
+
this._hide(this._wrapper.headerA);
|
332
|
+
}
|
333
|
+
if(!this._isOpen) {
|
334
|
+
this.open(null);
|
335
|
+
}
|
336
|
+
|
337
|
+
//hide all
|
338
|
+
let options = [...this.options];
|
339
|
+
let filterOptions = options.filter(function(item) {
|
340
|
+
return item.nodeName !== "OPTGROUP" && item.disabled === false && item.text.toLowerCase().indexOf(sText.toLowerCase()) >= 0;
|
341
|
+
});
|
342
|
+
this._makeChildren(filterOptions);
|
343
|
+
this._isFilterApplied = true;
|
344
|
+
this._nexPrevCounter = -1;
|
345
|
+
this._scrollToIfNeeded(null, 0);
|
346
|
+
}
|
347
|
+
|
348
|
+
}
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Make filter box
|
352
|
+
* @return {any}
|
353
|
+
* @private
|
354
|
+
*/
|
355
|
+
_makeFilterBox() {
|
356
|
+
let div = this._createEle("div", {className:'ms-filter-box'})
|
357
|
+
let input = this._createEle("input", {type:"text"});
|
358
|
+
div.appendChild(input);
|
359
|
+
this._wrapper.filterInput = input;
|
360
|
+
this._wrapper.filterHolder = div;
|
361
|
+
|
362
|
+
this._bindEvents(input, "input", (evt)=> {
|
363
|
+
this._applyFilters(evt);
|
364
|
+
});
|
365
|
+
|
366
|
+
return div;
|
367
|
+
}
|
368
|
+
|
369
|
+
/**
|
370
|
+
* Make header
|
371
|
+
* @return {any}
|
372
|
+
* @private
|
373
|
+
*/
|
374
|
+
_makeHeader() {
|
375
|
+
let css = this._css;
|
376
|
+
let divHeader = this._createEle("div", {className:css.header});
|
377
|
+
let headerA = this._createEle("a", {className:css.headerA});
|
378
|
+
let headerContent = this._createEle("span", {className:css.headerMiddleContent});
|
379
|
+
let arrow = this._createEle("span", {className:css.arrow + ' '+css.arrowDown});
|
380
|
+
headerA.appendChild(arrow);
|
381
|
+
headerA.appendChild(headerContent);
|
382
|
+
divHeader.appendChild(headerA);
|
383
|
+
this._wrapper.header = divHeader;
|
384
|
+
this._wrapper.headerA = headerA;
|
385
|
+
this._wrapper.headerContent = headerContent;
|
386
|
+
this._wrapper.arrow = arrow;
|
387
|
+
|
388
|
+
if(this._settings.imagePosition !== "left") {
|
389
|
+
headerA.classList.add(css.imageRight);
|
390
|
+
}
|
391
|
+
|
392
|
+
this._bindEvents(divHeader, this._settings.event, (evt)=> {
|
393
|
+
this.open(evt);
|
394
|
+
});
|
395
|
+
|
396
|
+
return divHeader;
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Make children
|
401
|
+
* @param byOption
|
402
|
+
* @return {*}
|
403
|
+
* @private
|
404
|
+
*/
|
405
|
+
_makeChildren(byOption=null) {
|
406
|
+
let css = this._css;
|
407
|
+
let isCheckbox = (this._enableCheckbox.toString() === "true");
|
408
|
+
let ul, $this=this;
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Make Object
|
412
|
+
* @param opts
|
413
|
+
* @param counter
|
414
|
+
* @return {{opt: *, itemObj: *}}
|
415
|
+
* @private
|
416
|
+
*/
|
417
|
+
let _makeObject = function (opts, counter) {
|
418
|
+
let opt = {};
|
419
|
+
opt = $this._parseOption(opts);
|
420
|
+
//{image, title, description, value, text, className, imageCss, index, selected, disabled}
|
421
|
+
let itemObj = {
|
422
|
+
label: {
|
423
|
+
text:opt.text,
|
424
|
+
css:css.itemLabel
|
425
|
+
},
|
426
|
+
img: {
|
427
|
+
src:opt.image,
|
428
|
+
css:css.itemImage
|
429
|
+
},
|
430
|
+
desc: {
|
431
|
+
text:opt.description,
|
432
|
+
css:css.itemDesc
|
433
|
+
},
|
434
|
+
isDisabled:(opts.disabled || false),
|
435
|
+
isSelected:(opts.selected || false),
|
436
|
+
isCheckbox:isCheckbox,
|
437
|
+
value:opt.value,
|
438
|
+
title:opt.title,
|
439
|
+
imageCss:`${opt.imageCss} ${opt.className}`,
|
440
|
+
counter:counter+1,
|
441
|
+
isOptGroup: (opts.nodeName === "OPTGROUP"),
|
442
|
+
innerSpanCss:css.itemContent
|
443
|
+
};
|
444
|
+
return {opt, itemObj};
|
445
|
+
};
|
446
|
+
|
447
|
+
/**
|
448
|
+
* Bind events
|
449
|
+
* @param li
|
450
|
+
* @param itemObj
|
451
|
+
*/
|
452
|
+
let bindEvents = function (li, itemObj) {
|
453
|
+
if(!itemObj.isDisabled) {
|
454
|
+
$this._bindEvents(li, "mouseup", (evt)=> {
|
455
|
+
|
456
|
+
$this._isMouseDown = false;
|
457
|
+
if(!isCheckbox || evt.target.nodeName !== "INPUT") {
|
458
|
+
if(!$this._isList) {
|
459
|
+
$this.close(evt);
|
460
|
+
}
|
461
|
+
}
|
462
|
+
});
|
463
|
+
|
464
|
+
$this._bindEvents(li, "mousedown", (evt)=> {
|
465
|
+
$this._isMouseDown = true;
|
466
|
+
|
467
|
+
if(!isCheckbox || evt.target.nodeName !== "INPUT") {
|
468
|
+
if($this._shiftHolded && $this._isMultiple) {
|
469
|
+
//multiple select if shift is pressed
|
470
|
+
let oldIndex = $this.selectedIndex;
|
471
|
+
let newIndex = li.index;
|
472
|
+
$this._setSelectedByIndexFromTo(oldIndex, newIndex);
|
473
|
+
} else if($this._controlHolded && $this._isMultiple) {
|
474
|
+
//select another one without resetting
|
475
|
+
$this._setSelectedByItem(li, false, false);
|
476
|
+
} else {
|
477
|
+
//normal click
|
478
|
+
$this._setSelectedByItem(li);
|
479
|
+
}
|
480
|
+
} else {
|
481
|
+
//this is checkbox - make it toggle
|
482
|
+
$this._setSelectedByItemToggle(li._refCheckbox, li);
|
483
|
+
}
|
484
|
+
});
|
485
|
+
|
486
|
+
$this._bindEvents(li, "mouseover", (evt)=> {
|
487
|
+
|
488
|
+
if($this._isMouseDown && $this._isMultiple) {
|
489
|
+
$this._setSelectedByItem(li, false, false);
|
490
|
+
}
|
491
|
+
|
492
|
+
});
|
493
|
+
}
|
494
|
+
};
|
495
|
+
|
496
|
+
|
497
|
+
//use old one holder if required
|
498
|
+
if(!this._wrapper.listOfItems) {
|
499
|
+
ul = this._createEle("ul", {className:css.listOfItems, zIndex: this._settings.zIndex});
|
500
|
+
this._wrapper.listOfItems = ul;
|
501
|
+
} else {
|
502
|
+
ul = this._wrapper.listOfItems;
|
503
|
+
}
|
504
|
+
ul.innerHTML = ""; //clear old one
|
505
|
+
let options = (byOption === null) ? this.ele.children : byOption;
|
506
|
+
let optLen = options.length;
|
507
|
+
for (let i=0;i<optLen;i++) {
|
508
|
+
let current = options[i];
|
509
|
+
let parseObj = _makeObject(current, i);
|
510
|
+
let opt = parseObj.opt;
|
511
|
+
let itemObj = parseObj.itemObj;
|
512
|
+
let li = this._createRow(itemObj);
|
513
|
+
|
514
|
+
if(opt.className !== '') {
|
515
|
+
li.className = li.className + " "+opt.className;
|
516
|
+
}
|
517
|
+
if(opt.internalStyle !== '') {
|
518
|
+
li.style = opt.internalStyle;
|
519
|
+
}
|
520
|
+
|
521
|
+
li.index = opt.index;
|
522
|
+
li.setAttribute("data-ms-index", opt.index);
|
523
|
+
if(itemObj.isOptGroup) {
|
524
|
+
//let make children of optgroup
|
525
|
+
let c_options = current.children;
|
526
|
+
let c_optLen = c_options.length;
|
527
|
+
let ul2 = this._createEle("ul");
|
528
|
+
for (let j=0;j<c_optLen;j++) {
|
529
|
+
let c_current = c_options[j];
|
530
|
+
let c_parseObj = _makeObject(c_current, j);
|
531
|
+
let c_opt = c_parseObj.opt;
|
532
|
+
let c_itemObj = c_parseObj.itemObj;
|
533
|
+
let c_li = this._createRow(c_itemObj);
|
534
|
+
|
535
|
+
if(c_opt.className !== '') {
|
536
|
+
c_li.className = c_li.className + " "+c_opt.className;
|
537
|
+
}
|
538
|
+
if(c_opt.internalStyle !== '') {
|
539
|
+
c_li.style = c_opt.internalStyle;
|
540
|
+
}
|
541
|
+
|
542
|
+
c_li.index = c_opt.index;
|
543
|
+
c_li.setAttribute("data-ms-index", c_opt.index);
|
544
|
+
if(c_itemObj.isSelected) {
|
545
|
+
this._setSelectedByItem(c_li, true);
|
546
|
+
}
|
547
|
+
bindEvents(c_li, c_itemObj);
|
548
|
+
|
549
|
+
if(this._settings.imagePosition !== "left") {
|
550
|
+
c_li.classList.add(css.imageRight);
|
551
|
+
}
|
552
|
+
ul2.appendChild(c_li);
|
553
|
+
}
|
554
|
+
li.appendChild(ul2);
|
555
|
+
}
|
556
|
+
if(!itemObj.isOptGroup) {
|
557
|
+
bindEvents(li, itemObj);
|
558
|
+
}
|
559
|
+
if(this._settings.imagePosition !== "left") {
|
560
|
+
li.classList.add(css.imageRight);
|
561
|
+
}
|
562
|
+
ul.appendChild(li);
|
563
|
+
|
564
|
+
if(itemObj.isSelected) {
|
565
|
+
this._setSelectedByItem(li, true);
|
566
|
+
}
|
567
|
+
|
568
|
+
|
569
|
+
}
|
570
|
+
if(this._settings.childHeight !== null) {
|
571
|
+
ul.style.maxHeight = this._settings.childHeight+'px';
|
572
|
+
}
|
573
|
+
return ul;
|
574
|
+
}
|
575
|
+
|
576
|
+
/**
|
577
|
+
* Make Layout
|
578
|
+
* @return {any}
|
579
|
+
* @private
|
580
|
+
*/
|
581
|
+
_makeLayout() {
|
582
|
+
this.ele.tabIndex = -1;
|
583
|
+
let css = this._css;
|
584
|
+
|
585
|
+
let wrapper = this._createEle("div", {tabIndex:0, className:css.dd});
|
586
|
+
|
587
|
+
let name = this.ele.name;
|
588
|
+
let isRequired = this.ele.required;
|
589
|
+
|
590
|
+
let valueBox = this._createEle("input", {tabIndex:-1, name:name, type:"text", className:this._css.valueInput, required:isRequired});
|
591
|
+
wrapper.appendChild(valueBox);
|
592
|
+
this.ele.required = false;
|
593
|
+
this.ele.name = "";
|
594
|
+
|
595
|
+
//This is for multiple select
|
596
|
+
let moreValueBox = this._createEle("div", {className:"more", style:"display:none"});
|
597
|
+
wrapper.appendChild(moreValueBox);
|
598
|
+
|
599
|
+
this._wrapper.valueBox = valueBox;
|
600
|
+
this._wrapper.moreValueBox = moreValueBox;
|
601
|
+
|
602
|
+
|
603
|
+
//Make header
|
604
|
+
let divHeader = this._makeHeader();
|
605
|
+
|
606
|
+
//Filter box
|
607
|
+
let filterBox = this._makeFilterBox();
|
608
|
+
divHeader.appendChild(filterBox);
|
609
|
+
this._showHideFilterBox(false);
|
610
|
+
|
611
|
+
//make options
|
612
|
+
let ul = this._makeChildren();
|
613
|
+
wrapper.appendChild(divHeader);
|
614
|
+
wrapper.appendChild(ul);
|
615
|
+
|
616
|
+
this._wrapper.holder = wrapper;
|
617
|
+
|
618
|
+
|
619
|
+
//add in document
|
620
|
+
this._insertAfter(wrapper, this.ele);
|
621
|
+
|
622
|
+
//hide children
|
623
|
+
this._hide(ul);
|
624
|
+
|
625
|
+
if(this.disabled) {
|
626
|
+
wrapper.classList.add(css.wrapperDisabled);
|
627
|
+
}
|
628
|
+
|
629
|
+
let style = this._getInternalStyle(this.ele);
|
630
|
+
wrapper.setAttribute("style", style);
|
631
|
+
|
632
|
+
if(this._settings.byJson.data !== null) {
|
633
|
+
wrapper.setAttribute("style", `width:${this._settings.byJson.width}px`);
|
634
|
+
}
|
635
|
+
|
636
|
+
|
637
|
+
//clear
|
638
|
+
let div = this._createEle("div", {style:"clear:both"});
|
639
|
+
wrapper.appendChild(div);
|
640
|
+
|
641
|
+
this._bindEvents(this._wrapper.holder, "focus", (evt) => {
|
642
|
+
if(this._isList) {
|
643
|
+
this._bindDocumentEvents(null, false, true);
|
644
|
+
} else {
|
645
|
+
if(_oldC) {
|
646
|
+
_oldC.close(null);
|
647
|
+
_oldC = null;
|
648
|
+
}
|
649
|
+
this._bindDocumentEvents(null, true, true);
|
650
|
+
_oldC = this;
|
651
|
+
}
|
652
|
+
this._fireLocalEventIfExist("focus");
|
653
|
+
this._fireEventIfExist("focus");
|
654
|
+
});
|
655
|
+
|
656
|
+
this._bindEvents(this._wrapper.holder, "blur", (evt) => {
|
657
|
+
if(this._isList) {
|
658
|
+
this._unbindDocumentEvents();
|
659
|
+
}
|
660
|
+
this._fireLocalEventIfExist("blur");
|
661
|
+
this._fireEventIfExist("blur");
|
662
|
+
});
|
663
|
+
|
664
|
+
this._bindEvents(this._wrapper.holder, "dblclick", (evt) => {
|
665
|
+
this._fireLocalEventIfExist("blur");
|
666
|
+
this._fireEventIfExist("blur");
|
667
|
+
});
|
668
|
+
|
669
|
+
//For custom message on required
|
670
|
+
this._bindEvents(valueBox, "invalid", (evt)=> {
|
671
|
+
evt.target.setCustomValidity("");
|
672
|
+
if (!evt.target.validity.valid) {
|
673
|
+
evt.target.setCustomValidity(this._settings.errorMessage);
|
674
|
+
}
|
675
|
+
});
|
676
|
+
|
677
|
+
this._bindEvents(valueBox, "input", (evt)=> {
|
678
|
+
evt.target.setCustomValidity("");
|
679
|
+
});
|
680
|
+
|
681
|
+
let events = ["click", "dblclick", "mousemove", "mouseover", "mouseout", "mousedown", "mouseup"];
|
682
|
+
for (let i=0,len=events.length;i<len;i++) {
|
683
|
+
let evtName = events[i];
|
684
|
+
this._bindEvents(this._wrapper.holder, evtName, (evt) => {
|
685
|
+
this._fireLocalEventIfExist(evtName);
|
686
|
+
this._fireEventIfExist(evtName);
|
687
|
+
});
|
688
|
+
|
689
|
+
}
|
690
|
+
|
691
|
+
return wrapper;
|
692
|
+
}
|
693
|
+
|
694
|
+
/**
|
695
|
+
* Create a row
|
696
|
+
* @param obj
|
697
|
+
* @return {any}
|
698
|
+
*/
|
699
|
+
_createRow(obj) {
|
700
|
+
|
701
|
+
let itemCss = (obj.isOptGroup) ? this._css.optgroup : this._css.item;
|
702
|
+
|
703
|
+
let li = this._createEle("li", {className:itemCss});
|
704
|
+
if(obj.isCheckbox && !obj.isOptGroup) {
|
705
|
+
let checkbox = this._createEle("input", {tabIndex:-1, className:this._css.checkbox,type:"checkbox", disabled:obj.isDisabled, "checked":false, value:obj.value, name:this._wrapper.valueBox.name+this._settings.checkboxNameSuffix+"[]"})
|
706
|
+
li.appendChild(checkbox);
|
707
|
+
li._refCheckbox = checkbox;
|
708
|
+
}
|
709
|
+
|
710
|
+
let optTxtCss = (obj.isOptGroup) ? " "+this._css.itemSpanOpt : "";
|
711
|
+
|
712
|
+
let itemSpan = this._createEle("span", {className:this._css.itemSpan+optTxtCss});
|
713
|
+
|
714
|
+
let text = (this._settings.showListCounter.toString() === "true") ? `<span class='${this._css.listCounter}'>${obj.counter}</span> ${obj.label.text}` : obj.label.text;
|
715
|
+
|
716
|
+
let textSpan = this._createEle("span", {className:obj.label.css}, text);
|
717
|
+
|
718
|
+
let itemInnerSpan = this._createEle("span", {className:obj.innerSpanCss});
|
719
|
+
itemInnerSpan.appendChild(textSpan);
|
720
|
+
|
721
|
+
if(obj.img.src !== null) {
|
722
|
+
let img = this._createEle("img", {className:obj.img.css, src:obj.img.src});
|
723
|
+
itemSpan.appendChild(img);
|
724
|
+
}
|
725
|
+
|
726
|
+
if(obj.img.src === null && obj.imageCss.replace(/\s/g, '') !== '') {
|
727
|
+
let imgSpan = this._createEle("span", {className:obj.img.css+' '+obj.imageCss}, " ");
|
728
|
+
itemSpan.appendChild(imgSpan);
|
729
|
+
}
|
730
|
+
|
731
|
+
if(obj.desc.text !== null) {
|
732
|
+
let spanDesc = this._createEle("span", {className:obj.desc.css}, obj.desc.text);
|
733
|
+
itemInnerSpan.appendChild(spanDesc);
|
734
|
+
}
|
735
|
+
|
736
|
+
itemSpan.appendChild(itemInnerSpan);
|
737
|
+
|
738
|
+
|
739
|
+
|
740
|
+
li.appendChild(itemSpan);
|
741
|
+
|
742
|
+
if(obj.isDisabled) {
|
743
|
+
li.classList.add(this._css.itemDisabled);
|
744
|
+
} else if(!obj.isOptGroup) {
|
745
|
+
li.classList.add(this._css.itemEnabled);
|
746
|
+
}
|
747
|
+
|
748
|
+
if(obj.title !== '') {
|
749
|
+
li.title = obj.title;
|
750
|
+
}
|
751
|
+
return li;
|
752
|
+
}
|
753
|
+
|
754
|
+
/**
|
755
|
+
* Parse option
|
756
|
+
* @param opt
|
757
|
+
* @return {{image: *, description: *, index: *, className: *, disabled: *, text: *, imageCss: *, title: *, internalStyle: *, value: *, selected: *}}
|
758
|
+
* @private
|
759
|
+
*/
|
760
|
+
_parseOption(opt) {
|
761
|
+
|
762
|
+
let image = null, title ='', description='', value='', text='', className='', imageCss = '', index=-1, selected, disabled, internalStyle;
|
763
|
+
if (opt !== undefined) {
|
764
|
+
let optionType = opt.nodeName;
|
765
|
+
let dataSet = opt.dataset;
|
766
|
+
if(optionType === "OPTGROUP") {
|
767
|
+
text = opt.label;
|
768
|
+
} else {
|
769
|
+
text = opt.text;
|
770
|
+
value = opt.value || text;
|
771
|
+
}
|
772
|
+
index = opt.index;
|
773
|
+
selected = opt.selected;
|
774
|
+
disabled = opt.disabled;
|
775
|
+
|
776
|
+
className = opt.className || "";
|
777
|
+
title = dataSet.title || '';
|
778
|
+
description = dataSet.description || '';
|
779
|
+
image = dataSet.image || image;
|
780
|
+
imageCss = dataSet.imageCss || '';
|
781
|
+
internalStyle = this._getInternalStyle(opt);
|
782
|
+
|
783
|
+
}
|
784
|
+
|
785
|
+
return {image, title, description, value, text, className, imageCss, index, selected, disabled, internalStyle};
|
786
|
+
|
787
|
+
}
|
788
|
+
|
789
|
+
/**
|
790
|
+
* remove old selected
|
791
|
+
* @private
|
792
|
+
*/
|
793
|
+
_removeOldSelected() {
|
794
|
+
let oldSelected = this._getAllEle("ul li."+this._css.itemSelected, this._wrapper.holder);
|
795
|
+
|
796
|
+
//remove old selected
|
797
|
+
for(let i=0;i<oldSelected.length;i++) {
|
798
|
+
oldSelected[i].classList.remove(this._css.itemSelected);
|
799
|
+
if(this._isMultiple && this._enableCheckbox.toString() === "true") {
|
800
|
+
oldSelected[i]._refCheckbox.checked = false;
|
801
|
+
//this._getEle("input", oldSelected[i]).checked = false;
|
802
|
+
}
|
803
|
+
}
|
804
|
+
|
805
|
+
}
|
806
|
+
|
807
|
+
/**
|
808
|
+
* Select by index a to b
|
809
|
+
* @param indexA
|
810
|
+
* @param indexB
|
811
|
+
* @private
|
812
|
+
*/
|
813
|
+
_setSelectedByIndexFromTo(indexA, indexB) {
|
814
|
+
|
815
|
+
let min = Math.min(indexA, indexB);
|
816
|
+
let max = Math.max(indexA, indexB);
|
817
|
+
let options = this.optionsUI;
|
818
|
+
|
819
|
+
for(let i=min;i<=max;i++) {
|
820
|
+
|
821
|
+
this._setSelectedByItem(options[i], false, false);
|
822
|
+
}
|
823
|
+
}
|
824
|
+
/**
|
825
|
+
* Toggle Select
|
826
|
+
* @private
|
827
|
+
* @param checkbox
|
828
|
+
* @param li
|
829
|
+
*/
|
830
|
+
_setSelectedByItemToggle(checkbox, li) {
|
831
|
+
let isChecked = !checkbox.checked;
|
832
|
+
let index = li.index;
|
833
|
+
if(isChecked) {
|
834
|
+
li.classList.add(this._css.itemSelected);
|
835
|
+
this.ele.options[index].selected = true;
|
836
|
+
} else {
|
837
|
+
li.classList.remove(this._css.itemSelected);
|
838
|
+
this.ele.options[index].selected = false;
|
839
|
+
}
|
840
|
+
this.updateUiAndValue();
|
841
|
+
}
|
842
|
+
|
843
|
+
/**
|
844
|
+
* Set selected by an item
|
845
|
+
* @param ele
|
846
|
+
* @param dontThink
|
847
|
+
* @param resetOldSelected
|
848
|
+
* @private
|
849
|
+
*/
|
850
|
+
_setSelectedByItem(ele, dontThink=false, resetOldSelected=true) {
|
851
|
+
|
852
|
+
if(dontThink && ele) {
|
853
|
+
|
854
|
+
ele.classList.add(this._css.itemSelected);
|
855
|
+
|
856
|
+
} else {
|
857
|
+
let index = ele.index;
|
858
|
+
|
859
|
+
if(resetOldSelected === true) {
|
860
|
+
this._removeOldSelected();
|
861
|
+
this.ele.selectedIndex = index
|
862
|
+
//this.selectedIndex = index;
|
863
|
+
} else {
|
864
|
+
//it could be multiple
|
865
|
+
this.ele.options[index].selected = true;
|
866
|
+
}
|
867
|
+
ele?.classList?.add(this._css.itemSelected);
|
868
|
+
this.updateUiAndValue();
|
869
|
+
}
|
870
|
+
if(this._enableCheckbox.toString() === "true") {
|
871
|
+
if(ele?._refCheckbox) {
|
872
|
+
ele._refCheckbox.checked = true;
|
873
|
+
}
|
874
|
+
}
|
875
|
+
if(this._isFirstTime === false) {
|
876
|
+
this._fireLocalEventIfExist("change");
|
877
|
+
this._fireEventIfExist("change");
|
878
|
+
}
|
879
|
+
this._isFirstTime = false;
|
880
|
+
}
|
881
|
+
|
882
|
+
/**
|
883
|
+
* Set selected by an select option item
|
884
|
+
* @param option
|
885
|
+
* @param dontThink
|
886
|
+
* @private
|
887
|
+
*/
|
888
|
+
_setSelectedByOptionItem(option, dontThink=false) {
|
889
|
+
let index = option.index;
|
890
|
+
let dataAndUI = this._getDataAndUI(index);
|
891
|
+
this._setSelectedByItem(dataAndUI.ui, dontThink);
|
892
|
+
}
|
893
|
+
|
894
|
+
/**
|
895
|
+
* Update header ui
|
896
|
+
* @param byData
|
897
|
+
* @param innerHTML
|
898
|
+
* @private
|
899
|
+
*/
|
900
|
+
_updateHeaderUI(byData=null, innerHTML=null) {
|
901
|
+
|
902
|
+
let dataAndUI = (byData === null) ? this.uiData : byData;
|
903
|
+
|
904
|
+
let text = this._isArray(dataAndUI.index) ? dataAndUI.ui[0].innerHTML : null;
|
905
|
+
|
906
|
+
this._wrapper.headerContent.innerHTML = (innerHTML !== null) ? innerHTML : text || dataAndUI?.ui?.innerHTML || " ";
|
907
|
+
|
908
|
+
let contentHolder = this._getEle("."+this._css.itemLabel, this._wrapper.headerContent);
|
909
|
+
|
910
|
+
if(this._settings.showPlusItemCounter.toString() === "true" && dataAndUI.ui !== null && dataAndUI.ui.length > 1) {
|
911
|
+
contentHolder.innerHTML = contentHolder.innerHTML + `<span class="${this._css.headerCounter}"> (+${dataAndUI.ui.length-1})</span>`;
|
912
|
+
}
|
913
|
+
|
914
|
+
if(this._settings.showIcon.toString() === "false") {
|
915
|
+
let img = this._getEle("img", this._wrapper.headerContent);
|
916
|
+
if(img) {
|
917
|
+
this._hide(img);
|
918
|
+
}
|
919
|
+
}
|
920
|
+
|
921
|
+
this._setTitleMinHeight(false);
|
922
|
+
|
923
|
+
}
|
924
|
+
|
925
|
+
/**
|
926
|
+
* Find index By index prop
|
927
|
+
* @param index
|
928
|
+
* @return {null|*}
|
929
|
+
* @private
|
930
|
+
*/
|
931
|
+
_findElementByIndexProp(index) {
|
932
|
+
let options = this._getAllEle(`ul li.${this._css.item}`, this._wrapper.holder);
|
933
|
+
let total = options.length;
|
934
|
+
for(let i=0;i<total;i++) {
|
935
|
+
let current = options[i];
|
936
|
+
if(current.index === index) {
|
937
|
+
return options[i];
|
938
|
+
}
|
939
|
+
}
|
940
|
+
return null;
|
941
|
+
}
|
942
|
+
|
943
|
+
/**
|
944
|
+
* Get data and value
|
945
|
+
* @param byIndex
|
946
|
+
* @return {{data: *, ui: *, index: *, option: *, multiple:boolean}}
|
947
|
+
* @private
|
948
|
+
*/
|
949
|
+
_getDataAndUI(byIndex=null) {
|
950
|
+
|
951
|
+
let ele = this.ele;
|
952
|
+
let data, ui, option=null, index=-1;
|
953
|
+
let obj, $this=this;
|
954
|
+
let isArray = false;
|
955
|
+
let getByIndex = function(byIndex) {
|
956
|
+
let option = ele.options[byIndex];
|
957
|
+
let data = $this._parseOption(option);
|
958
|
+
let index = byIndex;
|
959
|
+
let ui = $this._findElementByIndexProp(index);
|
960
|
+
return {option, data, index, ui};
|
961
|
+
};
|
962
|
+
|
963
|
+
if(byIndex !== null) {
|
964
|
+
obj = getByIndex(byIndex);
|
965
|
+
option = obj.option;
|
966
|
+
data = obj.data;
|
967
|
+
index = obj.index;
|
968
|
+
ui = obj.ui;
|
969
|
+
} else {
|
970
|
+
ui = this._getAllEle("ul li." + this._css.itemSelected, this._wrapper.holder);
|
971
|
+
|
972
|
+
// if this is multiple
|
973
|
+
if (ui.length > 1) {
|
974
|
+
let data_a = [], opt_a = [], ind_a = [], ui_a = [];
|
975
|
+
for (let i = 0; i < ui.length; i++) {
|
976
|
+
obj = getByIndex(ui[i].index);
|
977
|
+
data_a.push(obj.data);
|
978
|
+
opt_a.push(obj.option);
|
979
|
+
ind_a.push(obj.index);
|
980
|
+
ui_a.push(obj.ui);
|
981
|
+
}
|
982
|
+
data = data_a;
|
983
|
+
option = opt_a;
|
984
|
+
index = ind_a;
|
985
|
+
ui = ui_a;
|
986
|
+
isArray = true;
|
987
|
+
} else {
|
988
|
+
obj = getByIndex(ui[0]?.index || this.selectedIndex);
|
989
|
+
option = obj.option || null;
|
990
|
+
data = obj.data || null;
|
991
|
+
index = obj.index || -1;
|
992
|
+
ui = obj.ui || null;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
|
996
|
+
|
997
|
+
return {data, ui, index, option, isArray};
|
998
|
+
}
|
999
|
+
|
1000
|
+
/**
|
1001
|
+
* Is Array
|
1002
|
+
* @param obj
|
1003
|
+
* @return {boolean}
|
1004
|
+
* @private
|
1005
|
+
*/
|
1006
|
+
_isArray = function(obj) {
|
1007
|
+
return (Object.prototype.toString.call(obj) === "[object Array]");
|
1008
|
+
};
|
1009
|
+
|
1010
|
+
/**
|
1011
|
+
* Update Header UI by data
|
1012
|
+
* @param byData
|
1013
|
+
*
|
1014
|
+
*/
|
1015
|
+
updateUiAndValue(byData=null) {
|
1016
|
+
let dataAndUI = (byData === null) ? this.uiData : byData;
|
1017
|
+
this._updateHeaderUI(dataAndUI);
|
1018
|
+
let valueBox = this._wrapper.valueBox;
|
1019
|
+
valueBox.value = this.ele.value;
|
1020
|
+
|
1021
|
+
//this is multiple
|
1022
|
+
if(this._isMultiple && valueBox.name.substr(valueBox.name.length-2, valueBox.name.length) === "[]") {
|
1023
|
+
this._wrapper.moreValueBox.innerHTML = "";
|
1024
|
+
for (let i=1;i<dataAndUI.data.length;i++) {
|
1025
|
+
let valueBoxM = this._createEle("input", {type:"hidden", name:valueBox.name, value:dataAndUI.data[i].value});
|
1026
|
+
this._wrapper.moreValueBox.appendChild(valueBoxM);
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
/**
|
1032
|
+
* Update Ui by index
|
1033
|
+
* @param index
|
1034
|
+
* @private
|
1035
|
+
*/
|
1036
|
+
_updateUiAndValueByIndex(index) {
|
1037
|
+
let dataAndUI = this._getDataAndUI(index);
|
1038
|
+
//this._updateHeaderUI(dataAndUI);
|
1039
|
+
this.updateUiAndValue(dataAndUI);
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
/**** Elements and Helpers ****/
|
1043
|
+
/**
|
1044
|
+
* Create an element
|
1045
|
+
* @param nm
|
1046
|
+
* @param attr
|
1047
|
+
* @param html
|
1048
|
+
* @return {any}
|
1049
|
+
* @private
|
1050
|
+
*/
|
1051
|
+
_createEle(nm, attr, html) {
|
1052
|
+
let tag = document.createElement(nm);
|
1053
|
+
if (attr) {
|
1054
|
+
for(let i in attr) {
|
1055
|
+
if(i === "style") {
|
1056
|
+
tag.style.cssText = attr[i];
|
1057
|
+
} else {
|
1058
|
+
tag[i] = attr[i];
|
1059
|
+
}
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
if (html) {
|
1063
|
+
tag.innerHTML = html;
|
1064
|
+
}
|
1065
|
+
return tag;
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
/**
|
1069
|
+
* Get one element
|
1070
|
+
* @param ele
|
1071
|
+
* @param where
|
1072
|
+
* @return {*}
|
1073
|
+
* @private
|
1074
|
+
*/
|
1075
|
+
_getEle(ele, where=null) {
|
1076
|
+
return (where === null) ? document.querySelector(ele) : where.querySelector(ele);
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* Get all elements
|
1081
|
+
* @param ele
|
1082
|
+
* @param where
|
1083
|
+
* @return {any}
|
1084
|
+
* @private
|
1085
|
+
*/
|
1086
|
+
_getAllEle(ele, where=null) {
|
1087
|
+
return where === null ? document.querySelectorAll(ele) : where.querySelectorAll(ele);
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
/**
|
1091
|
+
* Get internal style of an element
|
1092
|
+
* @param ele
|
1093
|
+
* @return {string|*}
|
1094
|
+
* @private
|
1095
|
+
*/
|
1096
|
+
_getInternalStyle(ele) {
|
1097
|
+
return (ele.style === undefined) ? "" : ele.style.cssText;
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
/**
|
1101
|
+
* Toggle show
|
1102
|
+
* @param ele
|
1103
|
+
* @private
|
1104
|
+
*/
|
1105
|
+
_toggleShow(ele) {
|
1106
|
+
ele.style.display = (ele.style.display === "none" || ele.style.display === "") ? "inherit" : "none";
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/**
|
1110
|
+
* Show an element
|
1111
|
+
* @param ele
|
1112
|
+
* @private
|
1113
|
+
*/
|
1114
|
+
_show(ele, dispaly="block") {
|
1115
|
+
ele.style.display = dispaly;
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
/**
|
1119
|
+
* Hide an element
|
1120
|
+
* @param ele
|
1121
|
+
* @private
|
1122
|
+
*/
|
1123
|
+
_hide(ele) {
|
1124
|
+
ele.style.display = "none";
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
/**
|
1128
|
+
* Insert an element after an element
|
1129
|
+
* @param ele
|
1130
|
+
* @param targetEle
|
1131
|
+
* @return {*}
|
1132
|
+
* @private
|
1133
|
+
*/
|
1134
|
+
_insertAfter(ele, targetEle) {
|
1135
|
+
return targetEle.parentNode.insertBefore(ele, targetEle.nextSibling);
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
/**
|
1139
|
+
* Not using for now
|
1140
|
+
* Insert an element before a target element
|
1141
|
+
* @param ele
|
1142
|
+
* @param targetEle
|
1143
|
+
* @return {*}
|
1144
|
+
* @private
|
1145
|
+
*/
|
1146
|
+
_insertBefore(ele, targetEle) {
|
1147
|
+
return targetEle.insertBefore(ele, targetEle);
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
/**
|
1151
|
+
* get index of a li - not in used
|
1152
|
+
* @param li
|
1153
|
+
* @return {number}
|
1154
|
+
* @private
|
1155
|
+
*/
|
1156
|
+
_getIndex(li) {
|
1157
|
+
let LIs = this._getAllEle("ul li",this._wrapper.holder);
|
1158
|
+
return [...LIs].indexOf(li);
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
/**
|
1162
|
+
* Get properties or a property - not in used
|
1163
|
+
* @param ele
|
1164
|
+
* @param key
|
1165
|
+
* @return {null|*}
|
1166
|
+
* @private
|
1167
|
+
*/
|
1168
|
+
_getProp(ele, key) {
|
1169
|
+
let obj = {};
|
1170
|
+
for (let i = 0; i < ele.attributes.length; i++) {
|
1171
|
+
let k = ele.attributes[i].nodeName;
|
1172
|
+
let v = ele.attributes[i].nodeValue;
|
1173
|
+
if(key === k) {
|
1174
|
+
return v;
|
1175
|
+
}
|
1176
|
+
obj[k] = v;
|
1177
|
+
}
|
1178
|
+
return (typeof key === "undefined") ? obj : null;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
/**
|
1182
|
+
* Get dataset
|
1183
|
+
* @param ele
|
1184
|
+
* @param key
|
1185
|
+
* @return {*|null}
|
1186
|
+
* @private
|
1187
|
+
*/
|
1188
|
+
_getDataSet(ele, key=null) {
|
1189
|
+
return (key === null) ? ele.dataset : ele.dataset[key] || null;
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
/**
|
1193
|
+
* Bind an event
|
1194
|
+
* @param ele
|
1195
|
+
* @param type
|
1196
|
+
* @param cb
|
1197
|
+
* @private
|
1198
|
+
*/
|
1199
|
+
_bindEvents(ele, type, cb) {
|
1200
|
+
ele.addEventListener(type, cb);
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
/**
|
1204
|
+
* Remove events
|
1205
|
+
* @param ele
|
1206
|
+
* @param type
|
1207
|
+
* @param fn
|
1208
|
+
* @private
|
1209
|
+
*/
|
1210
|
+
_unbindEvents(ele, type, fn) {
|
1211
|
+
ele.removeEventListener(type, fn);
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
/**
|
1215
|
+
* Adjust child height
|
1216
|
+
* @param row
|
1217
|
+
* @private
|
1218
|
+
*/
|
1219
|
+
_adjustChildHeight(row=null) {
|
1220
|
+
row = (row === null) ? parseInt(this._settings.visibleRows) : row;
|
1221
|
+
if(row !== null) {
|
1222
|
+
let li = this._getEle("li[data-ms-index='0']", this._wrapper.listOfItems);
|
1223
|
+
let size = (this._settings.rowHeight !== null) ? this._settings.rowHeight : li.clientHeight;
|
1224
|
+
this._wrapper.listOfItems.style.height = (row * size)+'px';
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
/**
|
1230
|
+
* Set max height
|
1231
|
+
* @param autoHeightByMax
|
1232
|
+
* @private
|
1233
|
+
*/
|
1234
|
+
_setTitleMinHeight(autoHeightByMax=true) {
|
1235
|
+
let max = 0;
|
1236
|
+
if(autoHeightByMax === true) {
|
1237
|
+
let lis = this._getAllEle("li", this._wrapper.listOfItems);
|
1238
|
+
let len = lis.length;
|
1239
|
+
for(let i=0;i<len;i++) {
|
1240
|
+
let current = lis[i];
|
1241
|
+
max = (current.clientHeight > max) ? current.clientHeight : max;
|
1242
|
+
}
|
1243
|
+
} else {
|
1244
|
+
//this is after selection
|
1245
|
+
max = this._wrapper.headerA.clientHeight;
|
1246
|
+
}
|
1247
|
+
|
1248
|
+
this._wrapper.header.style.minHeight = max+"px";
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
|
1252
|
+
/**
|
1253
|
+
* Make Ui as list
|
1254
|
+
* @param val
|
1255
|
+
* @param row
|
1256
|
+
* @private
|
1257
|
+
*/
|
1258
|
+
_makeUiAsList(val, row) {
|
1259
|
+
if(val === true) {
|
1260
|
+
//make ui as list
|
1261
|
+
//update height
|
1262
|
+
this._hide(this._wrapper.header);
|
1263
|
+
this.open(null, true);
|
1264
|
+
this._adjustChildHeight(row);
|
1265
|
+
this._wrapper.listOfItems.style.position = "relative";
|
1266
|
+
this._wrapper.listOfItems.style.display = "inline-block";
|
1267
|
+
this._wrapper.listOfItems.style.zIndex = 0;
|
1268
|
+
this._wrapper.holder.style.zIndex = 0;
|
1269
|
+
this._isList = true;
|
1270
|
+
} else {
|
1271
|
+
//reset to dropdown
|
1272
|
+
this._show(this._wrapper.header);
|
1273
|
+
this._wrapper.listOfItems.style.height = null;
|
1274
|
+
this._wrapper.listOfItems.style.position = "absolute";
|
1275
|
+
this._wrapper.listOfItems.style.zIndex = this._settings.zIndex;
|
1276
|
+
this._wrapper.holder.style.zIndex = 0;
|
1277
|
+
this._isList = false;
|
1278
|
+
this.close(null);
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
/**
|
1283
|
+
* Bind document events
|
1284
|
+
* @param evt
|
1285
|
+
* @private
|
1286
|
+
*/
|
1287
|
+
_bindDocumentEvents(evt, documentClick=true, documentKeyDown=true) {
|
1288
|
+
|
1289
|
+
this._unbindDocumentEvents();
|
1290
|
+
|
1291
|
+
this._onDocumentClick = (evt) => {
|
1292
|
+
//is outside?
|
1293
|
+
let box = this._wrapper.listOfItems.getBoundingClientRect();
|
1294
|
+
let headerBox = this._wrapper.header.getBoundingClientRect();
|
1295
|
+
let areaX = box.left + box.width;
|
1296
|
+
let areaY = (headerBox.top + box.height+headerBox.height);
|
1297
|
+
|
1298
|
+
if(evt.clientX < box.left || evt.clientX > areaX || evt.clientY < headerBox.y || evt.clientY > areaY) {
|
1299
|
+
this.close(evt);
|
1300
|
+
}
|
1301
|
+
};
|
1302
|
+
|
1303
|
+
this._onDocumentKeyDown = (evt) => {
|
1304
|
+
switch (evt.keyCode) {
|
1305
|
+
case this._DOWN_ARROW:
|
1306
|
+
case this._RIGHT_ARROW:
|
1307
|
+
evt.preventDefault();
|
1308
|
+
evt.stopPropagation();
|
1309
|
+
this._show(this._wrapper.listOfItems);
|
1310
|
+
this._isOpen = true;
|
1311
|
+
this.next();
|
1312
|
+
break;
|
1313
|
+
case this._UP_ARROW:
|
1314
|
+
case this._LEFT_ARROW:
|
1315
|
+
evt.preventDefault();
|
1316
|
+
evt.stopPropagation();
|
1317
|
+
this.previous();
|
1318
|
+
|
1319
|
+
break;
|
1320
|
+
case this._ESCAPE:
|
1321
|
+
case this._ENTER:
|
1322
|
+
evt.preventDefault();
|
1323
|
+
evt.stopPropagation();
|
1324
|
+
this.close(null);
|
1325
|
+
break;
|
1326
|
+
case this._SHIFT:
|
1327
|
+
this._shiftHolded = true;
|
1328
|
+
|
1329
|
+
break;
|
1330
|
+
case this._CONTROL:
|
1331
|
+
case this._MAC_CONTROL:
|
1332
|
+
this._controlHolded = true;
|
1333
|
+
break;
|
1334
|
+
case this._SPACE:
|
1335
|
+
this._show(this._wrapper.listOfItems);
|
1336
|
+
this._isOpen = true;
|
1337
|
+
break;
|
1338
|
+
default:
|
1339
|
+
if (evt.keyCode >= this._ALPHABETS_START && this._isList === false && this._settings.enableAutoFilter.toString() === "true") {
|
1340
|
+
this._showHideFilterBox(true);
|
1341
|
+
}
|
1342
|
+
this._shiftHolded = false;
|
1343
|
+
this._controlHolded = false;
|
1344
|
+
break;
|
1345
|
+
}
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
this._onDocumentKeyUp = (evt) => {
|
1349
|
+
this._shiftHolded = false;
|
1350
|
+
this._controlHolded = false;
|
1351
|
+
};
|
1352
|
+
|
1353
|
+
if(documentClick === true) {
|
1354
|
+
this._bindEvents(document, "mouseup", this._onDocumentClick);
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
if(documentKeyDown === true) {
|
1358
|
+
this._bindEvents(document, "keydown", this._onDocumentKeyDown);
|
1359
|
+
this._bindEvents(document, "keyup", this._onDocumentKeyUp);
|
1360
|
+
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
/**
|
1366
|
+
* Unbind document events
|
1367
|
+
* @private
|
1368
|
+
*/
|
1369
|
+
_unbindDocumentEvents() {
|
1370
|
+
//remove events
|
1371
|
+
if(this._onDocumentClick !== null) {
|
1372
|
+
this._unbindEvents(document, "mouseup", this._onDocumentClick);
|
1373
|
+
}
|
1374
|
+
if(this._onDocumentKeyDown !== null) {
|
1375
|
+
this._unbindEvents(document, "keydown", this._onDocumentKeyDown);
|
1376
|
+
}
|
1377
|
+
if(this._onDocumentKeyUp !== null) {
|
1378
|
+
this._unbindEvents(document, "keyup", this._onDocumentKeyUp);
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
|
1382
|
+
this._onDocumentClick = null;
|
1383
|
+
this._onDocumentKeyDown = null;
|
1384
|
+
this._onDocumentKeyUp = null;
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
/**
|
1388
|
+
* Scroll if needed
|
1389
|
+
* @param item
|
1390
|
+
* @param pos
|
1391
|
+
* @param goingWhere
|
1392
|
+
* @private
|
1393
|
+
*/
|
1394
|
+
_scrollToIfNeeded(item=null, pos=null, goingWhere="next") {
|
1395
|
+
let child = this._wrapper.listOfItems;
|
1396
|
+
let childBound = child.getBoundingClientRect();
|
1397
|
+
if(item === null && pos !== null) {
|
1398
|
+
child.scrollTop = pos;
|
1399
|
+
}
|
1400
|
+
//if scroll is needed
|
1401
|
+
item = (item !== undefined) ? item : this._getEle( "li." + this._css.itemSelected);
|
1402
|
+
if (item) {
|
1403
|
+
let itemPos = item.offsetTop;
|
1404
|
+
let ch = child.clientHeight;
|
1405
|
+
let itemHeight = (item.clientHeight); //for next
|
1406
|
+
|
1407
|
+
if ((itemPos+itemHeight) - child.scrollTop > ch && goingWhere==='next') {
|
1408
|
+
child.scrollTop = (itemPos+itemHeight) - ch;
|
1409
|
+
} else if((itemPos - child.scrollTop) < 0 && goingWhere==='previous') {
|
1410
|
+
child.scrollTop = (itemPos);
|
1411
|
+
}
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
|
1415
|
+
/**
|
1416
|
+
* Fire event that is bind on settings
|
1417
|
+
* @param evt_n
|
1418
|
+
* @private
|
1419
|
+
*/
|
1420
|
+
_fireLocalEventIfExist(evt_n, data=null) {
|
1421
|
+
if (typeof this._settings.on[evt_n] === "function") {
|
1422
|
+
let dataAndUI = (data===null) ? this._getDataAndUI() : data;
|
1423
|
+
let fn = this._settings.on[evt_n];
|
1424
|
+
try {
|
1425
|
+
fn(dataAndUI);
|
1426
|
+
} catch (e) {
|
1427
|
+
console.error(e.message);
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
}
|
1431
|
+
}
|
1432
|
+
|
1433
|
+
/**
|
1434
|
+
* Fire event if exist
|
1435
|
+
* @param evt_n
|
1436
|
+
* @return {boolean}
|
1437
|
+
* @private
|
1438
|
+
*/
|
1439
|
+
_fireEventIfExist(evt_n) {
|
1440
|
+
//data event
|
1441
|
+
if(this.ele.dataset[evt_n]) {
|
1442
|
+
let fn = new Function(this.ele.dataset[evt_n]);
|
1443
|
+
try {
|
1444
|
+
fn();
|
1445
|
+
} catch (e) {
|
1446
|
+
console.error(e.message);
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
//check if original has some
|
1451
|
+
if (this._has_handler(evt_n).hasEvent) {
|
1452
|
+
if (this._has_handler(evt_n).byElement) {
|
1453
|
+
try {
|
1454
|
+
this.ele[evt_n]();
|
1455
|
+
} catch (e) {
|
1456
|
+
try {
|
1457
|
+
this.ele["on" + evt_n]();
|
1458
|
+
}catch (e2) {
|
1459
|
+
|
1460
|
+
}
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
} else if (this._has_handler(evt_n).byJQuery) {
|
1464
|
+
switch (evt_n) {
|
1465
|
+
case "keydown":
|
1466
|
+
case "keyup":
|
1467
|
+
//key down/up will check later
|
1468
|
+
break;
|
1469
|
+
default:
|
1470
|
+
try {
|
1471
|
+
if(typeof jQuery !== "undefined") {
|
1472
|
+
jQuery(this.ele).triggerHandler(evt_n);
|
1473
|
+
}
|
1474
|
+
} catch (e) {
|
1475
|
+
//silence is bliss
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
break;
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
return false;
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
/**
|
1486
|
+
* Has any event
|
1487
|
+
* @param name
|
1488
|
+
* @return {{byJQuery: boolean, hasEvent: boolean, byElement: boolean}}
|
1489
|
+
* @private
|
1490
|
+
*/
|
1491
|
+
_has_handler(name) {
|
1492
|
+
//True if a handler has been added in the html.
|
1493
|
+
let evt = {byElement: false, local:false, byJQuery: false, hasEvent: false};
|
1494
|
+
|
1495
|
+
if (this._settings.on[name] !== null) {
|
1496
|
+
evt.hasEvent = true;
|
1497
|
+
evt.local = true;
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
//console.log(name)
|
1501
|
+
try {
|
1502
|
+
//console.log(obj.prop("on" + name) + " "+name);
|
1503
|
+
if (this._getProp(this.ele, "on" + name) !== null) {
|
1504
|
+
evt.hasEvent = true;
|
1505
|
+
evt.byElement = true;
|
1506
|
+
}
|
1507
|
+
} catch(e) {
|
1508
|
+
//console.log(e.message);
|
1509
|
+
}
|
1510
|
+
// True if a handler has been added using jQuery.
|
1511
|
+
if(typeof jQuery !== "undefined") {
|
1512
|
+
let obj = jQuery(this.ele);
|
1513
|
+
let evs;
|
1514
|
+
if (typeof jQuery?._data === "function") { //1.8
|
1515
|
+
evs = jQuery?._data(this.ele, "events");
|
1516
|
+
} else {
|
1517
|
+
evs = obj.data("events");
|
1518
|
+
}
|
1519
|
+
if (evs && evs[name]) {
|
1520
|
+
evt.hasEvent = true;
|
1521
|
+
evt.byJQuery = true;
|
1522
|
+
}
|
1523
|
+
}
|
1524
|
+
return evt;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
/***************** Public methods and props *********** /
|
1528
|
+
/**
|
1529
|
+
* Add an item to select
|
1530
|
+
* Object can be pass as below
|
1531
|
+
* new Option("Label", "value") or
|
1532
|
+
* {text:"Label", value:"value"}
|
1533
|
+
* or Label as string
|
1534
|
+
* or full object ie {text:"", value:"", description:'', image:'', className:'' title:'', imageCss:''}
|
1535
|
+
* @param obj
|
1536
|
+
* @param index
|
1537
|
+
*/
|
1538
|
+
|
1539
|
+
add(obj, index=null) {
|
1540
|
+
//
|
1541
|
+
let text, value, title, image, description, imageCss;
|
1542
|
+
let opt;
|
1543
|
+
if(obj instanceof HTMLOptionElement) {
|
1544
|
+
opt = obj;
|
1545
|
+
} else if(typeof obj === "string") {
|
1546
|
+
//passing as string
|
1547
|
+
text = value = obj;
|
1548
|
+
opt = new Option(text, value);
|
1549
|
+
} else if(obj instanceof Object) {
|
1550
|
+
text = obj.text || '';
|
1551
|
+
value = obj.value || text;
|
1552
|
+
title = obj.title || '';
|
1553
|
+
image = obj.image || '';
|
1554
|
+
imageCss = obj.imageCss || '';
|
1555
|
+
description = obj.description || '';
|
1556
|
+
opt = new Option(text, value);
|
1557
|
+
opt.setAttribute("data-description", description);
|
1558
|
+
opt.setAttribute("data-image", image);
|
1559
|
+
opt.setAttribute("data-title", title);
|
1560
|
+
opt.setAttribute("data-image-css", imageCss);
|
1561
|
+
}
|
1562
|
+
this.ele.add(opt, index);
|
1563
|
+
this._makeChildren();
|
1564
|
+
this._fireLocalEventIfExist("add");
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
/**
|
1568
|
+
* Remove an item from select
|
1569
|
+
* @param index
|
1570
|
+
*/
|
1571
|
+
remove(index) {
|
1572
|
+
let uiAndData = this._getDataAndUI(index);
|
1573
|
+
this.ele.remove(index);
|
1574
|
+
this._makeChildren();
|
1575
|
+
this._fireLocalEventIfExist("remove", uiAndData);
|
1576
|
+
return uiAndData;
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
/**
|
1580
|
+
* Move to next index
|
1581
|
+
*/
|
1582
|
+
next() {
|
1583
|
+
let $this = this;
|
1584
|
+
let allOptions = this.optionsUI;
|
1585
|
+
let totalOpt = allOptions.length;
|
1586
|
+
let counterStart;
|
1587
|
+
if(this._isFilterApplied) {
|
1588
|
+
counterStart = this._nexPrevCounter;
|
1589
|
+
} else {
|
1590
|
+
counterStart = this.selectedIndex;
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
let _getNextElem = function() {
|
1594
|
+
let i = counterStart;
|
1595
|
+
for(i;i<totalOpt;i++) {
|
1596
|
+
let next = i+1;
|
1597
|
+
next = next >= totalOpt ? totalOpt-1 : next;
|
1598
|
+
$this._nexPrevCounter++;
|
1599
|
+
if(!allOptions[next].classList.contains($this._css.itemDisabled)) {
|
1600
|
+
return allOptions[next];
|
1601
|
+
}
|
1602
|
+
}
|
1603
|
+
return null;
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
if(totalOpt > 0) {
|
1607
|
+
let nextEle = _getNextElem();
|
1608
|
+
if(nextEle) {
|
1609
|
+
this._setSelectedByItem(nextEle, false, true);
|
1610
|
+
this._scrollToIfNeeded(nextEle);
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
/**
|
1617
|
+
* Move to previous index
|
1618
|
+
*/
|
1619
|
+
previous() {
|
1620
|
+
let $this = this;
|
1621
|
+
let allOptions = this.optionsUI;//$this._getAllEle(`li.${$this._css.item}`, $this._wrapper.listOfItems);
|
1622
|
+
let totalOpt = allOptions.length;
|
1623
|
+
let counterStart;
|
1624
|
+
if(this._isFilterApplied) {
|
1625
|
+
counterStart = this._nexPrevCounter;
|
1626
|
+
} else {
|
1627
|
+
counterStart = this.selectedIndex;
|
1628
|
+
}
|
1629
|
+
let _getPreviousElem = function(ele) {
|
1630
|
+
let i = counterStart;
|
1631
|
+
for(i;i>0;i--) {
|
1632
|
+
let next = i-1;
|
1633
|
+
next = next >= 0 ? next: 0;
|
1634
|
+
$this._nexPrevCounter--;
|
1635
|
+
if(!allOptions[next].classList.contains($this._css.itemDisabled)) {
|
1636
|
+
return allOptions[next];
|
1637
|
+
}
|
1638
|
+
}
|
1639
|
+
return null;
|
1640
|
+
};
|
1641
|
+
|
1642
|
+
if(allOptions.length > 0) {
|
1643
|
+
let prevEle = _getPreviousElem();
|
1644
|
+
if(prevEle) {
|
1645
|
+
this._setSelectedByItem(prevEle, false, true);
|
1646
|
+
this._scrollToIfNeeded(prevEle, null,"previous");
|
1647
|
+
}
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
/**
|
1653
|
+
* Open this dropdown
|
1654
|
+
*/
|
1655
|
+
open(evt, justOpen=false) {
|
1656
|
+
|
1657
|
+
if (this.disabled) {
|
1658
|
+
return;
|
1659
|
+
}
|
1660
|
+
if(!this._isOpen) {
|
1661
|
+
this._isOpen = true;
|
1662
|
+
this._show(this._wrapper.listOfItems);
|
1663
|
+
|
1664
|
+
//don't bind event if just opening - useful when making as list
|
1665
|
+
if(justOpen === false) {
|
1666
|
+
this._bindDocumentEvents(evt);
|
1667
|
+
}
|
1668
|
+
//Change arrow
|
1669
|
+
this._wrapper.arrow.classList.remove(this._css.arrowDown);
|
1670
|
+
this._wrapper.arrow.classList.add(this._css.arrowUp);
|
1671
|
+
this._adjustChildHeight();
|
1672
|
+
this._scrollToItem();
|
1673
|
+
|
1674
|
+
this._fireLocalEventIfExist("open");
|
1675
|
+
|
1676
|
+
} else {
|
1677
|
+
this.close(null);
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
/**
|
1682
|
+
* Close this dropdown
|
1683
|
+
* @param evt
|
1684
|
+
*/
|
1685
|
+
close(evt) {
|
1686
|
+
let isList = this._isList;
|
1687
|
+
let isDisable = false; // clicking on disabled list - it can be true based on below statement
|
1688
|
+
|
1689
|
+
if(evt !== null) {
|
1690
|
+
evt.stopImmediatePropagation();
|
1691
|
+
let li = evt.target.closest('li');
|
1692
|
+
isDisable = (li !== null) ? li.classList.contains("disabled") : false;
|
1693
|
+
}
|
1694
|
+
|
1695
|
+
if (this.disabled || isList || isDisable) {
|
1696
|
+
return;
|
1697
|
+
}
|
1698
|
+
this._scrollToIfNeeded(null, 0);
|
1699
|
+
this._hide(this._wrapper.listOfItems);
|
1700
|
+
this._wrapper.arrow.classList.add(this._css.arrowDown);
|
1701
|
+
this._wrapper.arrow.classList.remove(this._css.arrowUp);
|
1702
|
+
|
1703
|
+
//reset few things
|
1704
|
+
this._isOpen = false;
|
1705
|
+
this._isMouseDown = false;
|
1706
|
+
this._shiftHolded = false;
|
1707
|
+
this._controlHolded = false;
|
1708
|
+
this._isFilterApplied = false;
|
1709
|
+
this._wrapper.filterInput.value = "";
|
1710
|
+
this._wrapper.filterInput.blur();
|
1711
|
+
if(this._settings.showFilterAlways.toString() === "false") {
|
1712
|
+
this._showHideFilterBox(false);
|
1713
|
+
}
|
1714
|
+
this._applyFilters()
|
1715
|
+
this._unbindDocumentEvents();
|
1716
|
+
|
1717
|
+
this._updateHeaderUI();
|
1718
|
+
|
1719
|
+
//reset list if required
|
1720
|
+
if(this.ele.length !== this._getAllEle(`li.${this._css.item}`, this._wrapper.listOfItems).length) {
|
1721
|
+
this._makeChildren();
|
1722
|
+
this.updateUiAndValue();
|
1723
|
+
}
|
1724
|
+
|
1725
|
+
this._fireLocalEventIfExist("close");
|
1726
|
+
|
1727
|
+
}
|
1728
|
+
|
1729
|
+
/**
|
1730
|
+
* Return named item element with data
|
1731
|
+
* @param name
|
1732
|
+
* @param withData
|
1733
|
+
*/
|
1734
|
+
namedItem(name, withData=false) {
|
1735
|
+
let obj = null;
|
1736
|
+
let ele = this.ele.querySelector(`option[name='${name}']`);
|
1737
|
+
if(ele && withData) {
|
1738
|
+
obj = {};
|
1739
|
+
let data = this._parseOption(ele);
|
1740
|
+
obj.option = ele;
|
1741
|
+
obj.data = data;
|
1742
|
+
} else {
|
1743
|
+
obj = ele;
|
1744
|
+
}
|
1745
|
+
return obj;
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
/**
|
1749
|
+
* Get data by index
|
1750
|
+
* @param index
|
1751
|
+
* @param withData
|
1752
|
+
*/
|
1753
|
+
item(index, withData=false) {
|
1754
|
+
let obj = null;
|
1755
|
+
let ele = this.ele.options[index];
|
1756
|
+
if(ele && withData) {
|
1757
|
+
obj = {};
|
1758
|
+
let data = this._parseOption(ele);
|
1759
|
+
obj.option = ele;
|
1760
|
+
obj.data = data;
|
1761
|
+
} else {
|
1762
|
+
obj = ele;
|
1763
|
+
}
|
1764
|
+
return obj;
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
/**
|
1768
|
+
* Show hide or get status of visibility
|
1769
|
+
* @param isShow
|
1770
|
+
* @return {boolean}
|
1771
|
+
*/
|
1772
|
+
visible(isShow=null) {
|
1773
|
+
|
1774
|
+
if(isShow === true) {
|
1775
|
+
this._show(this._wrapper.holder, "inline-block");
|
1776
|
+
} else if(isShow === false) {
|
1777
|
+
this._hide(this._wrapper.holder);
|
1778
|
+
}
|
1779
|
+
if(isShow === null) {
|
1780
|
+
return (this._wrapper.holder.style.display !== "none");
|
1781
|
+
}
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
/**
|
1785
|
+
* Calculate item height and set child height
|
1786
|
+
* @param numberOfRows
|
1787
|
+
*/
|
1788
|
+
showRows(numberOfRows) {
|
1789
|
+
this._settings.visibleRows = (numberOfRows > this.length) ? this.length : numberOfRows;
|
1790
|
+
this._adjustChildHeight();
|
1791
|
+
}
|
1792
|
+
|
1793
|
+
/**
|
1794
|
+
* Alias of showRows - undecided
|
1795
|
+
* @param numberOfRows
|
1796
|
+
*/
|
1797
|
+
visibleRows(numberOfRows) {
|
1798
|
+
this.showRows(numberOfRows);
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
/**
|
1802
|
+
* Add event listener
|
1803
|
+
* @param type
|
1804
|
+
* @param fn
|
1805
|
+
*/
|
1806
|
+
on(type, fn) {
|
1807
|
+
//this._bindEvents(this.ele, type, fn);
|
1808
|
+
this._settings.on[type] = fn;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
/**
|
1812
|
+
* Remove event listener
|
1813
|
+
* @param type
|
1814
|
+
* @param fn
|
1815
|
+
*/
|
1816
|
+
off(type, fn) {
|
1817
|
+
//this._unbindEvents(this.ele, type, fn);
|
1818
|
+
this._settings.on[type] = null;
|
1819
|
+
};
|
1820
|
+
|
1821
|
+
/**
|
1822
|
+
* Remake Everything
|
1823
|
+
*/
|
1824
|
+
refresh() {
|
1825
|
+
this._makeChildren();
|
1826
|
+
this.updateUiAndValue();
|
1827
|
+
}
|
1828
|
+
|
1829
|
+
/**
|
1830
|
+
* Destroy UI
|
1831
|
+
*/
|
1832
|
+
destroy() {
|
1833
|
+
//show original
|
1834
|
+
this._show(this.ele);
|
1835
|
+
this.ele.required = this._wrapper.valueBox.required;
|
1836
|
+
this.ele.name = this._wrapper.valueBox.name;
|
1837
|
+
this._wrapper.holder.parentNode.removeChild(this._wrapper.holder);
|
1838
|
+
}
|
1839
|
+
|
1840
|
+
|
1841
|
+
/*** Props ***/
|
1842
|
+
/**
|
1843
|
+
* Get selected index
|
1844
|
+
* @return {*}
|
1845
|
+
*/
|
1846
|
+
get selectedIndex() {
|
1847
|
+
return this.ele.selectedIndex;
|
1848
|
+
}
|
1849
|
+
|
1850
|
+
/**
|
1851
|
+
* Set Index
|
1852
|
+
* @param index
|
1853
|
+
*/
|
1854
|
+
set selectedIndex(index) {
|
1855
|
+
let $this = this;
|
1856
|
+
let selectNow = function (ind) {
|
1857
|
+
$this.ele.selectedIndex = ind;
|
1858
|
+
if(ind === -1) {
|
1859
|
+
//blank
|
1860
|
+
$this._updateHeaderUI(null, "");
|
1861
|
+
$this._removeOldSelected();
|
1862
|
+
} else {
|
1863
|
+
$this._setSelectedByOptionItem($this.ele.options[ind]);
|
1864
|
+
}
|
1865
|
+
};
|
1866
|
+
|
1867
|
+
if(index < this.length && !this._isArray(index)) {
|
1868
|
+
selectNow(index);
|
1869
|
+
} else {
|
1870
|
+
if(this._isMultiple && this._isArray(index)) {
|
1871
|
+
for (let i=0,len=index.length;i<len;i++) {
|
1872
|
+
if(index[i] < this.length && index[i] !== -1) {
|
1873
|
+
this._setSelectedByOptionItem(this.ele.options[index[i]], i>0);
|
1874
|
+
}
|
1875
|
+
}
|
1876
|
+
this._updateHeaderUI(null);
|
1877
|
+
} else {
|
1878
|
+
selectNow(index);
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
|
1882
|
+
}
|
1883
|
+
|
1884
|
+
/**
|
1885
|
+
* Get options
|
1886
|
+
* @return {*}
|
1887
|
+
*/
|
1888
|
+
get options() {
|
1889
|
+
return this.ele.options;
|
1890
|
+
}
|
1891
|
+
|
1892
|
+
/**
|
1893
|
+
* Set options length
|
1894
|
+
* @param option
|
1895
|
+
*/
|
1896
|
+
set options(option) {
|
1897
|
+
|
1898
|
+
if(option instanceof HTMLOptionElement) {
|
1899
|
+
this.ele.add(option);
|
1900
|
+
this._makeChildren();
|
1901
|
+
this.updateUiAndValue();
|
1902
|
+
} else if (typeof option === "number") {
|
1903
|
+
this.ele.length = option;
|
1904
|
+
this._makeChildren();
|
1905
|
+
this.updateUiAndValue();
|
1906
|
+
}
|
1907
|
+
}
|
1908
|
+
|
1909
|
+
/**
|
1910
|
+
* get options UI
|
1911
|
+
* @return {any}
|
1912
|
+
*/
|
1913
|
+
get optionsUI() {
|
1914
|
+
if(this._cacheEle["allItems"]) {
|
1915
|
+
//return this._cacheEle["allItems"];
|
1916
|
+
}
|
1917
|
+
return this._cacheEle["allItems"] = this._getAllEle(`li.${this._css.item}`, this._wrapper.listOfItems);
|
1918
|
+
}
|
1919
|
+
|
1920
|
+
/**
|
1921
|
+
* Get length
|
1922
|
+
* @return {*}
|
1923
|
+
*/
|
1924
|
+
get length() {
|
1925
|
+
return this.ele.length;
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
/**
|
1929
|
+
* Set length
|
1930
|
+
* @param size
|
1931
|
+
*/
|
1932
|
+
set length(size) {
|
1933
|
+
this.ele.options.length = size;
|
1934
|
+
this._makeChildren();
|
1935
|
+
this.updateUiAndValue();
|
1936
|
+
}
|
1937
|
+
|
1938
|
+
|
1939
|
+
/**
|
1940
|
+
* Get value
|
1941
|
+
* @return {*}
|
1942
|
+
*/
|
1943
|
+
get value() {
|
1944
|
+
return this.ele.value;
|
1945
|
+
}
|
1946
|
+
|
1947
|
+
/**
|
1948
|
+
* Set value
|
1949
|
+
* @param val
|
1950
|
+
*/
|
1951
|
+
set value(val) {
|
1952
|
+
this.ele.value = val;
|
1953
|
+
this.selectedIndex = this.ele.selectedIndex;
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
/**
|
1957
|
+
* get selected text
|
1958
|
+
* @return {string}
|
1959
|
+
*/
|
1960
|
+
get selectedText() {
|
1961
|
+
return ( this.selectedIndex >=0 ) ? this.ele.options[this.selectedIndex].text : ""
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
/**
|
1965
|
+
* Check if this is disabled
|
1966
|
+
* @return {boolean | * | Function}
|
1967
|
+
*/
|
1968
|
+
get disabled() {
|
1969
|
+
return this.ele.hasAttribute('disabled');
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
/**
|
1973
|
+
* Set disabled
|
1974
|
+
* @param val
|
1975
|
+
*/
|
1976
|
+
set disabled(val) {
|
1977
|
+
if (val) {
|
1978
|
+
this.ele.setAttribute('disabled', '');
|
1979
|
+
this._wrapper.holder.classList.add(this._css.wrapperDisabled);
|
1980
|
+
} else {
|
1981
|
+
this.ele.removeAttribute('disabled');
|
1982
|
+
this._wrapper.holder.classList.remove(this._css.wrapperDisabled);
|
1983
|
+
}
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
/**
|
1987
|
+
* Get form name if this is inside a form
|
1988
|
+
* @return {*}
|
1989
|
+
*/
|
1990
|
+
get form() {
|
1991
|
+
return this.ele.form;
|
1992
|
+
}
|
1993
|
+
|
1994
|
+
|
1995
|
+
/**
|
1996
|
+
* Get multiple
|
1997
|
+
* @return {*}
|
1998
|
+
*/
|
1999
|
+
get multiple() {
|
2000
|
+
return this.ele.multiple;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
/**
|
2004
|
+
* Set multiple
|
2005
|
+
* @param val
|
2006
|
+
*/
|
2007
|
+
set multiple(val) {
|
2008
|
+
if (val) {
|
2009
|
+
this.ele.setAttribute('multiple', '');
|
2010
|
+
this._enableCheckbox = this._settings.enableCheckbox;
|
2011
|
+
} else {
|
2012
|
+
this.ele.removeAttribute('multiple');
|
2013
|
+
}
|
2014
|
+
this._isMultiple = val;
|
2015
|
+
//reset if this is not multiple
|
2016
|
+
if(!val) {
|
2017
|
+
this.selectedIndex = this.ele.selectedIndex;
|
2018
|
+
this._enableCheckbox = false;
|
2019
|
+
}
|
2020
|
+
this._makeChildren();
|
2021
|
+
}
|
2022
|
+
|
2023
|
+
/**
|
2024
|
+
* Get the name
|
2025
|
+
* @return {*}
|
2026
|
+
*/
|
2027
|
+
get name() {
|
2028
|
+
if(this._wrapper?.valueBox) {
|
2029
|
+
return this._wrapper.valueBox.name || "";
|
2030
|
+
}
|
2031
|
+
return this.ele.name;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
/**
|
2035
|
+
* Set the name
|
2036
|
+
* @param val
|
2037
|
+
*/
|
2038
|
+
set name(val) {
|
2039
|
+
|
2040
|
+
if(this._wrapper?.valueBox) {
|
2041
|
+
this._wrapper.valueBox.name = val;
|
2042
|
+
} else {
|
2043
|
+
this.ele.name = val;
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
/**
|
2050
|
+
* Get required
|
2051
|
+
* @return {*}
|
2052
|
+
*/
|
2053
|
+
get required() {
|
2054
|
+
return this._wrapper.valueBox.required;
|
2055
|
+
}
|
2056
|
+
|
2057
|
+
/**
|
2058
|
+
* Set required
|
2059
|
+
* @param val
|
2060
|
+
*/
|
2061
|
+
set required(val) {
|
2062
|
+
if (val) {
|
2063
|
+
this._wrapper.valueBox.setAttribute('required', true);
|
2064
|
+
//update now
|
2065
|
+
} else {
|
2066
|
+
this._wrapper.valueBox.removeAttribute('required');
|
2067
|
+
}
|
2068
|
+
}
|
2069
|
+
|
2070
|
+
/**
|
2071
|
+
* return the size/height of the dropdown
|
2072
|
+
* @return {*}
|
2073
|
+
*/
|
2074
|
+
get size() {
|
2075
|
+
return this.ele.size;
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
/**
|
2079
|
+
* Change the height of the element
|
2080
|
+
* @param val
|
2081
|
+
*/
|
2082
|
+
set size(val) {
|
2083
|
+
this.ele.size = val;
|
2084
|
+
this._makeUiAsList(val > 1, val);
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
|
2088
|
+
/**
|
2089
|
+
* Get selected option
|
2090
|
+
* @return {null}
|
2091
|
+
*/
|
2092
|
+
get selectedOptions() {
|
2093
|
+
let selectedOptions = null;
|
2094
|
+
if(this.selectedIndex >=0 ) {
|
2095
|
+
selectedOptions = this.ele.options[this.selectedIndex];
|
2096
|
+
if(this.multiple) {
|
2097
|
+
selectedOptions = [];
|
2098
|
+
let options = this.options;
|
2099
|
+
let total = options.length;
|
2100
|
+
for (let i=0; i<total; i++) {
|
2101
|
+
if(options[i].selected) {
|
2102
|
+
selectedOptions.push(options[i])
|
2103
|
+
}
|
2104
|
+
}
|
2105
|
+
selectedOptions = selectedOptions.length === 1 ? selectedOptions[0] : selectedOptions;
|
2106
|
+
}
|
2107
|
+
}
|
2108
|
+
return selectedOptions;
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
/**
|
2112
|
+
* Get element children
|
2113
|
+
* @return {*}
|
2114
|
+
*/
|
2115
|
+
get children() {
|
2116
|
+
return this.ele.children;
|
2117
|
+
}
|
2118
|
+
|
2119
|
+
/**
|
2120
|
+
* Get selected ui data
|
2121
|
+
* @return {{data: *, ui: *, index: *, option: *}}
|
2122
|
+
*/
|
2123
|
+
get uiData() {
|
2124
|
+
return this._getDataAndUI();
|
2125
|
+
}
|
2126
|
+
|
2127
|
+
/**
|
2128
|
+
* Get version
|
2129
|
+
* @return {string}
|
2130
|
+
*/
|
2131
|
+
get version() {
|
2132
|
+
return "4.0.3";
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
|
2138
|
+
;// CONCATENATED MODULE: ./src/js/lib/dd.js
|
2139
|
+
/**
|
2140
|
+
* MSDropdown - dd.js
|
2141
|
+
* @author: Marghoob Suleman
|
2142
|
+
* @website: https://www.marghoobsuleman.com/
|
2143
|
+
* @version: 4.0.3
|
2144
|
+
* @revision: 6
|
2145
|
+
* @date: 5th Sep 2021
|
2146
|
+
* msDropdown is free web component: you can redistribute it and/or modify
|
2147
|
+
* it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
|
2148
|
+
*/
|
2149
|
+
|
2150
|
+
|
2151
|
+
|
2152
|
+
class MsDropdown {
|
2153
|
+
|
2154
|
+
constructor(ele, settings) {
|
2155
|
+
if(typeof ele === "string") {
|
2156
|
+
document.querySelectorAll(ele).forEach((current)=> {
|
2157
|
+
new MsDropdown(current,settings);
|
2158
|
+
});
|
2159
|
+
} else {
|
2160
|
+
ele.msDropdown = this;
|
2161
|
+
this._ddMaker = new ddMaker(ele, settings);
|
2162
|
+
}
|
2163
|
+
}
|
2164
|
+
/***************** Public methods and props ***********/
|
2165
|
+
|
2166
|
+
/**
|
2167
|
+
* Set setting attributes
|
2168
|
+
* @param key
|
2169
|
+
* @param value
|
2170
|
+
* @param shouldRefresh
|
2171
|
+
*/
|
2172
|
+
setSettingAttribute(key, value, shouldRefresh=false) {
|
2173
|
+
this._ddMaker.setSettingAttribute(key, value);
|
2174
|
+
if(shouldRefresh) {
|
2175
|
+
this._ddMaker.refresh();
|
2176
|
+
}
|
2177
|
+
}
|
2178
|
+
/**
|
2179
|
+
* Add an item to select
|
2180
|
+
* Object can be pass as below
|
2181
|
+
* new Option("Label", "value") or
|
2182
|
+
* {text:"Label", value:"value"}
|
2183
|
+
* or Label as string
|
2184
|
+
* or full object ie {text:"", value:"", description:'', image:'', className:'' title:'', imageCss:''}
|
2185
|
+
* @param obj {option | object}
|
2186
|
+
* @param index {int}
|
2187
|
+
*/
|
2188
|
+
add(obj, index) {
|
2189
|
+
this._ddMaker.add(obj, index);
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
/**
|
2193
|
+
* Remove an item from select
|
2194
|
+
* @param index {int}
|
2195
|
+
*/
|
2196
|
+
remove(index) {
|
2197
|
+
return this._ddMaker.remove(index);
|
2198
|
+
}
|
2199
|
+
|
2200
|
+
/**
|
2201
|
+
* Move to next index
|
2202
|
+
*/
|
2203
|
+
next() {
|
2204
|
+
this._ddMaker.next();
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
|
2208
|
+
/**
|
2209
|
+
* Move to previous index
|
2210
|
+
*/
|
2211
|
+
previous() {
|
2212
|
+
this._ddMaker.previous();
|
2213
|
+
}
|
2214
|
+
|
2215
|
+
/**
|
2216
|
+
* Open this dropdown
|
2217
|
+
*/
|
2218
|
+
open() {
|
2219
|
+
this._ddMaker.open(null, false);
|
2220
|
+
}
|
2221
|
+
|
2222
|
+
/**
|
2223
|
+
* Close this dropdown
|
2224
|
+
*/
|
2225
|
+
close() {
|
2226
|
+
this._ddMaker.close(null);
|
2227
|
+
}
|
2228
|
+
|
2229
|
+
/**
|
2230
|
+
* Return named item element with data
|
2231
|
+
* @param name {string}
|
2232
|
+
* @param withData
|
2233
|
+
*/
|
2234
|
+
namedItem(name, withData=false) {
|
2235
|
+
return this._ddMaker.namedItem(name, withData);
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
/**
|
2239
|
+
* Get data by index
|
2240
|
+
* @param index {int}
|
2241
|
+
* @param withData
|
2242
|
+
*/
|
2243
|
+
item(index, withData=false) {
|
2244
|
+
return this._ddMaker.item(index, withData);
|
2245
|
+
}
|
2246
|
+
|
2247
|
+
/**
|
2248
|
+
* Show hide or get status of visibility
|
2249
|
+
* @param isShow
|
2250
|
+
* @return {boolean}
|
2251
|
+
*/
|
2252
|
+
visible(isShow=null) {
|
2253
|
+
return this._ddMaker.visible(isShow);
|
2254
|
+
}
|
2255
|
+
|
2256
|
+
/**
|
2257
|
+
* Calculate item height and set child height
|
2258
|
+
* @param numberOfRows {int}
|
2259
|
+
*/
|
2260
|
+
showRows(numberOfRows) {
|
2261
|
+
this._ddMaker.showRows(numberOfRows);
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
/**
|
2265
|
+
* Alias of showRows
|
2266
|
+
* @param numberOfRows {int}
|
2267
|
+
*/
|
2268
|
+
visibleRows(numberOfRows) {
|
2269
|
+
this._ddMaker.showRows(numberOfRows);
|
2270
|
+
}
|
2271
|
+
|
2272
|
+
/**
|
2273
|
+
* Add event listener
|
2274
|
+
* @param type {string}
|
2275
|
+
* @param fn {function}
|
2276
|
+
*/
|
2277
|
+
on(type, fn) {
|
2278
|
+
this._ddMaker.on(type, fn);
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
/**
|
2282
|
+
* Remove event listener
|
2283
|
+
* @param type {string}
|
2284
|
+
* @param fn {function}
|
2285
|
+
*/
|
2286
|
+
off(type, fn) {
|
2287
|
+
this._ddMaker.off(type, fn);
|
2288
|
+
};
|
2289
|
+
|
2290
|
+
/**
|
2291
|
+
* update ui and value
|
2292
|
+
*/
|
2293
|
+
updateUiAndValue() {
|
2294
|
+
this._ddMaker.updateUiAndValue();
|
2295
|
+
}
|
2296
|
+
|
2297
|
+
/**
|
2298
|
+
* Remake msDropdown
|
2299
|
+
*/
|
2300
|
+
refresh() {
|
2301
|
+
this._ddMaker.refresh();
|
2302
|
+
}
|
2303
|
+
/**
|
2304
|
+
* Remove msDropdown
|
2305
|
+
*/
|
2306
|
+
destroy() {
|
2307
|
+
this._ddMaker.destroy();
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
/*** Props ***/
|
2311
|
+
/**
|
2312
|
+
* Get selected index
|
2313
|
+
* @return {int}
|
2314
|
+
*/
|
2315
|
+
get selectedIndex() {
|
2316
|
+
return this._ddMaker.selectedIndex;
|
2317
|
+
}
|
2318
|
+
|
2319
|
+
/**
|
2320
|
+
* Set Index
|
2321
|
+
* @param index {int}
|
2322
|
+
*/
|
2323
|
+
set selectedIndex(index) {
|
2324
|
+
this._ddMaker.selectedIndex = index;
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
/**
|
2328
|
+
* Get options
|
2329
|
+
* @return {HTMLOptionElement}
|
2330
|
+
*/
|
2331
|
+
get options() {
|
2332
|
+
return this._ddMaker.options;
|
2333
|
+
}
|
2334
|
+
|
2335
|
+
/**
|
2336
|
+
* Set options length
|
2337
|
+
* @param option {int | HTMLOptionElement}
|
2338
|
+
*/
|
2339
|
+
set options(option) {
|
2340
|
+
this._ddMaker.options = option;
|
2341
|
+
}
|
2342
|
+
|
2343
|
+
/**
|
2344
|
+
* get options UI
|
2345
|
+
* @return {NodeList}
|
2346
|
+
*/
|
2347
|
+
get optionsUI() {
|
2348
|
+
return this._ddMaker.optionsUI;
|
2349
|
+
}
|
2350
|
+
|
2351
|
+
/**
|
2352
|
+
* Get length
|
2353
|
+
* @return {int}
|
2354
|
+
*/
|
2355
|
+
get length() {
|
2356
|
+
return this._ddMaker.length;
|
2357
|
+
}
|
2358
|
+
|
2359
|
+
/**
|
2360
|
+
* Set length
|
2361
|
+
* @param size {int}
|
2362
|
+
*/
|
2363
|
+
set length(size) {
|
2364
|
+
this._ddMaker.length = size;
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
|
2368
|
+
/**
|
2369
|
+
* Get value
|
2370
|
+
* @return {string | any}
|
2371
|
+
*/
|
2372
|
+
get value() {
|
2373
|
+
return this._ddMaker.value;
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
/**
|
2377
|
+
* Set value
|
2378
|
+
* @param val {string | any}
|
2379
|
+
*/
|
2380
|
+
set value(val) {
|
2381
|
+
this._ddMaker.value = val;
|
2382
|
+
}
|
2383
|
+
|
2384
|
+
/**
|
2385
|
+
* get selected text
|
2386
|
+
* @return {string}
|
2387
|
+
*/
|
2388
|
+
get selectedText() {
|
2389
|
+
return this._ddMaker.selectedText;
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
/**
|
2393
|
+
* Check if this is disabled
|
2394
|
+
* @return {boolean}
|
2395
|
+
*/
|
2396
|
+
get disabled() {
|
2397
|
+
return this._ddMaker.disabled;
|
2398
|
+
}
|
2399
|
+
|
2400
|
+
/**
|
2401
|
+
* Set disabled
|
2402
|
+
* @param val {boolean}
|
2403
|
+
*/
|
2404
|
+
set disabled(val) {
|
2405
|
+
this._ddMaker.disabled = val;
|
2406
|
+
}
|
2407
|
+
|
2408
|
+
/**
|
2409
|
+
* Get form name if this is inside a form
|
2410
|
+
* @return {string}
|
2411
|
+
*/
|
2412
|
+
get form() {
|
2413
|
+
return this._ddMaker.form;
|
2414
|
+
}
|
2415
|
+
|
2416
|
+
|
2417
|
+
/**
|
2418
|
+
* Get multiple
|
2419
|
+
* @return {boolean}
|
2420
|
+
*/
|
2421
|
+
get multiple() {
|
2422
|
+
return this._ddMaker.multiple;
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
/**
|
2426
|
+
* Set multiple
|
2427
|
+
* @param val {boolean}
|
2428
|
+
*/
|
2429
|
+
set multiple(val) {
|
2430
|
+
this._ddMaker.multiple = val;
|
2431
|
+
}
|
2432
|
+
|
2433
|
+
/**
|
2434
|
+
* Get the name
|
2435
|
+
* @return {string}
|
2436
|
+
*/
|
2437
|
+
get name() {
|
2438
|
+
return this._ddMaker.name;
|
2439
|
+
}
|
2440
|
+
|
2441
|
+
/**
|
2442
|
+
* Set the name
|
2443
|
+
* @param val {string}
|
2444
|
+
*/
|
2445
|
+
set name(val) {
|
2446
|
+
this._ddMaker.name = val;
|
2447
|
+
}
|
2448
|
+
|
2449
|
+
/**
|
2450
|
+
* Get required
|
2451
|
+
* @return {boolean}
|
2452
|
+
*/
|
2453
|
+
get required() {
|
2454
|
+
return this._ddMaker.required;
|
2455
|
+
}
|
2456
|
+
|
2457
|
+
/**
|
2458
|
+
* Set required
|
2459
|
+
* @param val {boolean}
|
2460
|
+
*/
|
2461
|
+
set required(val) {
|
2462
|
+
this._ddMaker.required = val;
|
2463
|
+
}
|
2464
|
+
|
2465
|
+
/**
|
2466
|
+
* return the size/height of the dropdown
|
2467
|
+
* @return {int}
|
2468
|
+
*/
|
2469
|
+
get size() {
|
2470
|
+
return this._ddMaker.size;
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
/**
|
2474
|
+
* Change the height of the element
|
2475
|
+
* @param val {int}
|
2476
|
+
*/
|
2477
|
+
set size(val) {
|
2478
|
+
this._ddMaker.size = val;
|
2479
|
+
}
|
2480
|
+
|
2481
|
+
|
2482
|
+
/**
|
2483
|
+
* Get selected option
|
2484
|
+
* @return {HTMLOptionElement}
|
2485
|
+
*/
|
2486
|
+
get selectedOptions() {
|
2487
|
+
return this._ddMaker.selectedOptions;
|
2488
|
+
}
|
2489
|
+
|
2490
|
+
/**
|
2491
|
+
* Get element children
|
2492
|
+
* @return {HTMLCollection}
|
2493
|
+
*/
|
2494
|
+
get children() {
|
2495
|
+
return this._ddMaker.children;
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
/**
|
2499
|
+
* Get selected ui data
|
2500
|
+
* @return {object | {data: *, ui: *, index: *, option: *}}
|
2501
|
+
*/
|
2502
|
+
get uiData() {
|
2503
|
+
return this._ddMaker.uiData;
|
2504
|
+
}
|
2505
|
+
|
2506
|
+
|
2507
|
+
/**
|
2508
|
+
* Make dropdown
|
2509
|
+
* @param ele
|
2510
|
+
* @param settings
|
2511
|
+
*/
|
2512
|
+
static make(ele, settings) {
|
2513
|
+
if(!ele.msDropdown) {
|
2514
|
+
try {
|
2515
|
+
let ddSelect = new MsDropdown(ele, settings);
|
2516
|
+
ele.addEventListener("change", ()=> {
|
2517
|
+
if(!ele.multiple) {
|
2518
|
+
ele.msDropdown.selectedIndex = current.selectedIndex;
|
2519
|
+
} else {
|
2520
|
+
ele.msDropdown.refresh();
|
2521
|
+
}
|
2522
|
+
});
|
2523
|
+
return ddSelect;
|
2524
|
+
} catch (e) {
|
2525
|
+
console.log(e.message);
|
2526
|
+
}
|
2527
|
+
}
|
2528
|
+
}
|
2529
|
+
|
2530
|
+
/**
|
2531
|
+
* Get version
|
2532
|
+
* @return {string}
|
2533
|
+
*/
|
2534
|
+
static get version() {
|
2535
|
+
return "4.0.3";
|
2536
|
+
}
|
2537
|
+
|
2538
|
+
/**
|
2539
|
+
* Get author
|
2540
|
+
* @return {string}
|
2541
|
+
*/
|
2542
|
+
static get author() {
|
2543
|
+
return "Marghoob Suleman";
|
2544
|
+
}
|
2545
|
+
|
2546
|
+
}
|
2547
|
+
|
2548
|
+
|
2549
|
+
;// CONCATENATED MODULE: ./src/js/lib/dd-webcomponent.js
|
2550
|
+
|
2551
|
+
|
2552
|
+
class dd extends HTMLSelectElement {
|
2553
|
+
|
2554
|
+
constructor(element, settings) {
|
2555
|
+
super();
|
2556
|
+
}
|
2557
|
+
|
2558
|
+
|
2559
|
+
connectedCallback() {
|
2560
|
+
setTimeout(()=> {
|
2561
|
+
if(!this.msDropdown) {
|
2562
|
+
this.msDropdown = new MsDropdown(this);
|
2563
|
+
}
|
2564
|
+
try {
|
2565
|
+
this.addEventListener("change", (evt)=> {if(!this.multiple) {
|
2566
|
+
this.msDropdown.selectedIndex = this.selectedIndex;
|
2567
|
+
} else {
|
2568
|
+
this.msDropdown.refresh();
|
2569
|
+
}
|
2570
|
+
});
|
2571
|
+
|
2572
|
+
} catch (e) {
|
2573
|
+
console.log(e.message);
|
2574
|
+
}
|
2575
|
+
},1);
|
2576
|
+
}
|
2577
|
+
|
2578
|
+
disconnectedCallback() {
|
2579
|
+
// console.log('disconnectedCallback');
|
2580
|
+
}
|
2581
|
+
|
2582
|
+
adoptedCallback() {
|
2583
|
+
//console.log('adoptedCallback', this);
|
2584
|
+
}
|
2585
|
+
|
2586
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
2587
|
+
if(this.msDropdown) {
|
2588
|
+
if(name.indexOf("data-") !== -1) {
|
2589
|
+
name = name.replace("data-", "");
|
2590
|
+
let nameStr = name.toLowerCase().split('-');
|
2591
|
+
for (let i = 1; i < nameStr.length; i++) {
|
2592
|
+
nameStr[i] = nameStr[i].charAt(0).toUpperCase() + nameStr[i].substring(1);
|
2593
|
+
}
|
2594
|
+
this.msDropdown.setSettingAttribute(nameStr.join(""), newValue, true); //update settings and refresh
|
2595
|
+
} else {
|
2596
|
+
//this.msDropdown[name] = newValue;
|
2597
|
+
}
|
2598
|
+
|
2599
|
+
}
|
2600
|
+
console.log('attributeChangedCallback');
|
2601
|
+
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
static get observedAttributes() { return [
|
2605
|
+
'data-main-css',
|
2606
|
+
'data-show-icon',
|
2607
|
+
'data-event',
|
2608
|
+
'data-child-width',
|
2609
|
+
'data-child-height',
|
2610
|
+
'data-enable-checkbox',
|
2611
|
+
'data-checkbox-name-suffix',
|
2612
|
+
'data-enable-auto-filter',
|
2613
|
+
'data-visible-rows',
|
2614
|
+
'data-show-plus-item-counter',
|
2615
|
+
'data-error-message',
|
2616
|
+
'data-show-filter-always',
|
2617
|
+
'data-show-list-counter',
|
2618
|
+
'data-image-position'
|
2619
|
+
];
|
2620
|
+
}
|
2621
|
+
|
2622
|
+
}
|
2623
|
+
|
2624
|
+
customElements.define('ms-dropdown', dd, {extends:'select'});
|
2625
|
+
;// CONCATENATED MODULE: ./src/js/index.js
|
2626
|
+
|
2627
|
+
|
2628
|
+
window.MsDropdown = MsDropdown;
|
2629
|
+
|
2630
|
+
|
2631
|
+
(function () {
|
2632
|
+
let isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') == -1 && navigator.userAgent.indexOf('FxiOS') == -1;
|
2633
|
+
if(isSafari) {
|
2634
|
+
MsDropdown.make("select[is='ms-dropdown']");
|
2635
|
+
/**
|
2636
|
+
* Not a good idea to override this
|
2637
|
+
* but if you want to use document.createElement("select"); this can be enable for safari.
|
2638
|
+
* how to use:
|
2639
|
+
* var select = document.createElement("select", {is:'ms-dropdown'});
|
2640
|
+
* select.setAttribute("is", "ms-dropdown");
|
2641
|
+
* select.options[0] = new Option("Hashtag CMS", "https://www.hashtagcms.org"); // add an option
|
2642
|
+
* select.options[1] = new Option("My Website", "https://www.marghoobsuleman.com"); // add an option
|
2643
|
+
* document.body.appendChild(select);
|
2644
|
+
*/
|
2645
|
+
|
2646
|
+
/*
|
2647
|
+
window.addEventListener("load", ()=> {
|
2648
|
+
let OriginalAppendChild = Element.prototype.appendChild;
|
2649
|
+
Element.prototype.appendChild = function() {
|
2650
|
+
OriginalAppendChild.apply(this, arguments);
|
2651
|
+
let select = arguments[0];
|
2652
|
+
if(select.nodeName === "SELECT" && select.getAttribute("is") === "ms-dropdown") {
|
2653
|
+
select.msDropdown = new MsDropdown(select);
|
2654
|
+
}
|
2655
|
+
};
|
2656
|
+
|
2657
|
+
})
|
2658
|
+
*/
|
2659
|
+
|
2660
|
+
}
|
2661
|
+
})();
|
2662
|
+
|
2663
|
+
/******/ })()
|
2664
|
+
;
|